@ai-matrx/design-system 0.5.0 → 0.5.2
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/CHANGELOG.md +28 -1
- package/dist/index.cjs +7 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/badge.tsx","../src/cn.ts","../src/bottom-sheet.tsx","../src/icons.tsx","../src/radix-dialog-modal-context.tsx","../src/button.tsx","../src/avatar.tsx","../src/card.tsx","../src/checkbox.tsx","../src/collapsible.tsx","../src/command.tsx","../src/portal-container.tsx","../src/use-is-mobile.ts","../src/context-menu.tsx","../src/creatable-picker.tsx","../src/popover.tsx","../src/dialog.tsx","../src/dropdown-menu.tsx","../src/editable-label.tsx","../src/input.tsx","../src/label.tsx","../src/overflow-toolbar.tsx","../src/progress.tsx","../src/scroll-area.tsx","../src/score-ring.tsx","../src/segmented-control.tsx","../src/select.tsx","../src/separator.tsx","../src/sheet.tsx","../src/skeleton.tsx","../src/switch.tsx","../src/tabbed-bottom-sheet.tsx","../src/table.tsx","../src/tabs.tsx","../src/textarea.tsx","../src/use-scroll-fade.ts"],"sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport const badgeVariants = cva(\n \"inline-flex items-center rounded-md border px-2 py-0.5 text-[11px] font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-0\",\n {\n variants: {\n variant: {\n default: \"border-transparent bg-primary/15 text-primary\",\n secondary: \"border-transparent bg-secondary text-secondary-foreground\",\n destructive: \"border-transparent bg-destructive/15 text-destructive\",\n outline: \"border-border text-foreground\",\n success: \"border-transparent bg-success/15 text-success\",\n warning: \"border-transparent bg-warning/15 text-warning\",\n info: \"border-info/30 bg-info/15 text-info\",\n error: \"border-transparent bg-destructive/15 text-destructive\",\n neutral: \"border-border bg-muted text-muted-foreground\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\n\nexport interface BadgeProps\n extends React.HTMLAttributes<HTMLSpanElement>,\n VariantProps<typeof badgeVariants> {}\n\nexport function Badge({ className, variant, ...props }: BadgeProps) {\n return <span className={cn(badgeVariants({ variant }), className)} {...props} />;\n}\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","\"use client\";\n\n/**\n * BottomSheet — the canonical mobile sheet. Ported verbatim from\n * matrx-frontend `components/official/bottom-sheet/BottomSheet.tsx` (S19).\n *\n * `vaul` is a sanctioned real dependency here, the same way\n * @radix-ui/react-alert-dialog is for @ai-matrx/kit `/confirm`: the drag-to-\n * dismiss drawer physics IS the component — there is no BottomSheet without\n * it, and reimplementing gesture/velocity handling would be a vendored twin\n * of a maintained library rather than of our own code. Rationale recorded in\n * FEATURE.md.\n *\n * Seam inversions:\n * - The host's `components/ui/drawer.tsx` wrappers are inlined as private\n * equivalents with identical behavior (thin over vaul + the shared\n * RadixDialogModalProvider); the host keeps its own drawer module for its\n * other drawer surfaces.\n * - `ChevronLeft` is the package's inlined SVG (C19).\n *\n * Host-owned CSS contracts (documented, not shipped): the glass tokens\n * `--matrx-glass-bg` / `--matrx-glass-border-color`, the utility classes\n * `matrx-glass-thin-border` and `pb-safe`, and semantic color tokens.\n */\n\nimport { VisuallyHidden } from \"@radix-ui/react-visually-hidden\";\nimport * as React from \"react\";\nimport { Drawer as DrawerPrimitive } from \"vaul\";\n\nimport { cn } from \"./cn\";\nimport { ChevronLeftIcon } from \"./icons\";\nimport { RadixDialogModalProvider } from \"./radix-dialog-modal-context\";\n\ntype DrawerRootProps = React.ComponentProps<typeof DrawerPrimitive.Root> & {\n /** Vaul does not forward false to its underlying Radix root. */\n modal?: true;\n};\n\nconst DrawerRoot = ({\n children,\n shouldScaleBackground = true,\n ...props\n}: DrawerRootProps) => (\n <RadixDialogModalProvider modal>\n <DrawerPrimitive.Root\n modal\n shouldScaleBackground={shouldScaleBackground}\n {...props}\n >\n {children}\n </DrawerPrimitive.Root>\n </RadixDialogModalProvider>\n);\nDrawerRoot.displayName = \"DrawerRoot\";\n\n/**\n * Unstyled, non-portalling Content for custom Drawer layouts. It derives\n * explicit modal semantics while Vaul retains focus/background behavior.\n */\nconst DrawerContentPrimitive = React.forwardRef<\n React.ComponentRef<typeof DrawerPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>\n>(({ ...props }, ref) => (\n <DrawerPrimitive.Content {...props} ref={ref} aria-modal=\"true\" />\n));\nDrawerContentPrimitive.displayName = \"DrawerContentPrimitive\";\n\nexport interface BottomSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n title?: string;\n /**\n * `adaptive` (default) — the sheet sizes to its content between 60dvh and\n * 90dvh. Correct for a single short list.\n *\n * `full` — ONE fixed height (92dvh) that never changes as content changes.\n * Use it for any sheet whose body varies (multi-level navigation, tabs,\n * search results): an adaptive sheet there resizes under the user's thumb\n * on every keystroke and every drill-in, which reads as the panel jumping.\n */\n size?: \"adaptive\" | \"full\";\n /** Visual treatment for the panel. Solid is intended for dense, long-lived surfaces. */\n surface?: \"glass\" | \"solid\";\n /** Merged onto the sheet panel. */\n contentClassName?: string;\n children: React.ReactNode;\n}\n\nexport function BottomSheet({\n open,\n onOpenChange,\n title = \"Bottom Sheet\",\n size = \"adaptive\",\n surface = \"glass\",\n contentClassName,\n children,\n}: BottomSheetProps) {\n return (\n <DrawerRoot open={open} onOpenChange={onOpenChange}>\n <DrawerPrimitive.Portal>\n {/* Identical output to the host's DrawerOverlay wrapper: its base\n classes merged with the caller classes, inline background wins. */}\n <DrawerPrimitive.Overlay\n className={cn(\"fixed inset-0 z-50 bg-[var(--matrx-overlay-scrim)]\", \"fixed inset-0 z-50\")}\n style={{ background: \"var(--matrx-overlay-scrim-drawer)\" }}\n />\n <DrawerContentPrimitive\n className={cn(\n \"fixed inset-x-0 bottom-0 z-50 mt-24 flex flex-col rounded-t-2xl overflow-hidden\",\n size === \"full\" ? \"h-[92dvh]\" : \"min-h-[60dvh] max-h-[90dvh]\",\n surface === \"solid\" &&\n \"border border-b-0 border-border bg-background shadow-2xl\",\n contentClassName,\n )}\n style={\n surface === \"glass\"\n ? {\n background: \"var(--matrx-glass-bg)\",\n backdropFilter: \"blur(20px) saturate(180%)\",\n WebkitBackdropFilter: \"blur(20px) saturate(180%)\",\n border: \"1px solid var(--matrx-glass-border-color)\",\n borderBottom: \"none\",\n }\n : undefined\n }\n >\n <VisuallyHidden>\n <DrawerPrimitive.Title>{title}</DrawerPrimitive.Title>\n <DrawerPrimitive.Description>\n Bottom sheet panel.\n </DrawerPrimitive.Description>\n </VisuallyHidden>\n <div className=\"mx-auto mt-3 mb-1 h-1.5 w-10 rounded-full bg-muted-foreground/30 flex-shrink-0\" />\n {children}\n </DrawerContentPrimitive>\n </DrawerPrimitive.Portal>\n </DrawerRoot>\n );\n}\n\nexport interface BottomSheetHeaderProps {\n title: string;\n showBack?: boolean;\n onBack?: () => void;\n trailing?: React.ReactNode;\n}\n\nexport function BottomSheetHeader({\n title,\n showBack = false,\n onBack,\n trailing,\n}: BottomSheetHeaderProps) {\n return (\n <div className=\"flex items-center px-2 pt-1 pb-2 flex-shrink-0 min-h-[44px]\">\n <div className=\"min-w-[44px] flex items-center justify-start\">\n <button\n onClick={onBack}\n className={cn(\n \"h-8 w-8 rounded-full matrx-glass-thin-border flex items-center justify-center transition-all active:scale-95\",\n showBack ? \"opacity-100\" : \"opacity-0 pointer-events-none\",\n )}\n aria-hidden={!showBack}\n tabIndex={showBack ? 0 : -1}\n >\n <ChevronLeftIcon className=\"h-4 w-4 text-foreground\" />\n </button>\n </div>\n <span className=\"text-[17px] font-semibold flex-1 text-center truncate\">\n {title}\n </span>\n <div className=\"min-w-[44px] flex items-center justify-end\">\n {trailing}\n </div>\n </div>\n );\n}\n\nexport interface BottomSheetBodyProps {\n children: React.ReactNode;\n className?: string;\n}\n\nexport function BottomSheetBody({ children, className }: BottomSheetBodyProps) {\n return (\n <div\n className={cn(\n // min-h-0 is load-bearing: without it a flex child's min-height:auto\n // floors it at content height and the body grows instead of scrolling.\n \"min-h-0 flex-1 overflow-y-auto overscroll-contain pb-safe\",\n className,\n )}\n >\n {children}\n </div>\n );\n}\n\nexport interface BottomSheetFooterProps {\n children: React.ReactNode;\n className?: string;\n}\n\nexport function BottomSheetFooter({\n children,\n className,\n}: BottomSheetFooterProps) {\n return (\n <div\n className={cn(\n \"flex-shrink-0 px-4 py-3 pb-safe border-t border-[var(--matrx-sheet-divider)]\",\n className,\n )}\n >\n {children}\n </div>\n );\n}\n","/**\n * Internal inlined SVG icons (policy C19: no icon-library dependency, ever).\n *\n * Each icon is copied from the exact glyph the ported originals rendered:\n * lucide-react's Loader2 / ChevronLeft / ChevronRight / MoreHorizontal and\n * @radix-ui/react-icons' Cross2Icon. Same viewBoxes, same paths, same default\n * stroke geometry — a host swapping the import sees pixel-identical output.\n *\n * Not exported from the package entry; components consume them directly.\n */\n\nimport * as React from \"react\";\n\ntype IconProps = React.SVGAttributes<SVGSVGElement>;\n\nfunction lucideProps(props: IconProps): React.SVGAttributes<SVGSVGElement> {\n return {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: 2,\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n \"aria-hidden\": true,\n ...props,\n };\n}\n\n/** lucide `loader-2` — the spinner glyph. Callers add `animate-spin`. */\nexport function Loader2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M21 12a9 9 0 1 1-6.219-8.56\" />\n </svg>\n );\n}\n\n/** lucide `chevron-left`. */\nexport function ChevronLeftIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n );\n}\n\n/** lucide `chevron-right`. */\nexport function ChevronRightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n );\n}\n\n/** lucide `more-horizontal` — the kebab/ellipsis glyph. */\nexport function MoreHorizontalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n <circle cx=\"19\" cy=\"12\" r=\"1\" />\n <circle cx=\"5\" cy=\"12\" r=\"1\" />\n </svg>\n );\n}\n\n/** lucide `check` — the selected-row tick (CreatablePicker). */\nexport function LucideCheckIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n );\n}\n\n/** lucide `chevrons-up-down` — the combobox trigger glyph. */\nexport function ChevronsUpDownIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"m7 15 5 5 5-5\" />\n <path d=\"m7 9 5-5 5 5\" />\n </svg>\n );\n}\n\n/** lucide `external-link` — the manage-in-new-tab glyph. */\nexport function ExternalLinkIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M15 3h6v6\" />\n <path d=\"M10 14 21 3\" />\n <path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" />\n </svg>\n );\n}\n\n/** lucide `lock` — the platform-governed vocabulary glyph. */\nexport function LockIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\" />\n <path d=\"M7 11V7a5 5 0 0 1 10 0v4\" />\n </svg>\n );\n}\n\n/** lucide `plus` — the create/add glyph. */\nexport function PlusIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M5 12h14\" />\n <path d=\"M12 5v14\" />\n </svg>\n );\n}\n\n/** lucide `x` — the dialog close glyph (host dialog module used lucide X). */\nexport function XIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n );\n}\n\n/**\n * @radix-ui/react-icons components default to width/height 15 — the bare\n * `<ChevronUpIcon />` renders in Select's scroll buttons rely on it.\n */\nfunction radixProps(props: IconProps): React.SVGAttributes<SVGSVGElement> {\n return {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 15 15\",\n width: 15,\n height: 15,\n fill: \"none\",\n \"aria-hidden\": true,\n ...props,\n };\n}\n\n/** @radix-ui/react-icons `MagnifyingGlassIcon` — the command search glyph. */\nexport function MagnifyingGlassIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `CheckIcon` — the select item indicator glyph. */\nexport function CheckIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/**\n * @radix-ui/react-icons `DividerHorizontalIcon` — the INDETERMINATE checkbox\n * glyph. Radix renders the indicator for both `true` and `\"indeterminate\"`, so\n * a half-selected \"select all\" that shows a full check states something false;\n * the two states get different glyphs on purpose.\n */\nexport function DividerHorizontalIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M2 7.5C2 7.22386 2.22386 7 2.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H2.5C2.22386 8 2 7.77614 2 7.5Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `DotFilledIcon` — the menu radio-item indicator. */\nexport function DotFilledIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M9.875 7.5C9.875 8.81168 8.81168 9.875 7.5 9.875C6.18832 9.875 5.125 8.81168 5.125 7.5C5.125 6.18832 6.18832 5.125 7.5 5.125C8.81168 5.125 9.875 6.18832 9.875 7.5Z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `ChevronRightIcon` — the submenu-trigger glyph. */\nexport function RadixChevronRightIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `ChevronDownIcon` — the select trigger/scroll glyph. */\nexport function RadixChevronDownIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `ChevronUpIcon` — the select scroll-up glyph. */\nexport function RadixChevronUpIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `Cross2Icon` — the dialog/sheet close glyph. */\nexport function Cross2Icon(props: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 15 15\"\n fill=\"none\"\n aria-hidden\n {...props}\n >\n <path\n d=\"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n","\"use client\";\n\n/**\n * Ported verbatim from matrx-frontend `components/ui/radix-dialog-modal-context.tsx`.\n * Shared by the Sheet and BottomSheet families (and available to hosts that\n * compose their own Radix Dialog-derived wrappers around these primitives).\n */\n\nimport * as React from \"react\";\n\nconst RadixDialogModalContext = React.createContext(true);\n\nexport interface RadixDialogModalProviderProps {\n children: React.ReactNode;\n modal: boolean;\n}\n\n/**\n * Keeps our Radix-based content wrappers aligned with the owning Root's\n * modality so ARIA semantics cannot drift from focus/pointer behavior.\n */\nexport function RadixDialogModalProvider({\n children,\n modal,\n}: RadixDialogModalProviderProps) {\n return (\n <RadixDialogModalContext.Provider value={modal}>\n {children}\n </RadixDialogModalContext.Provider>\n );\n}\n\n/** Returns whether the nearest Radix Dialog-derived root is modal. */\nexport function useRadixDialogModal(): boolean {\n return React.useContext(RadixDialogModalContext);\n}\n","\"use client\";\n\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport const buttonVariants = cva(\n \"inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-0 disabled:pointer-events-none disabled:opacity-50 active:scale-[0.98] [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90\",\n outline:\n \"border border-border bg-card shadow-sm hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n subtle:\n \"border border-transparent bg-muted/50 text-foreground hover:border-border hover:bg-muted\",\n },\n size: {\n default: \"h-9 px-4 py-2\",\n sm: \"h-8 rounded-md px-3 text-xs\",\n lg: \"h-10 rounded-md px-6\",\n icon: \"h-9 w-9\",\n \"icon-sm\": \"h-7 w-7\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Component = asChild ? Slot : \"button\";\n return (\n <Component\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n />\n );\n },\n);\nButton.displayName = \"Button\";\n","\"use client\";\n\n/**\n * Avatar — Radix avatar with the package's token vocabulary.\n *\n * The forks differed only in the root's fixed size (matrx-frontend `h-10 w-10`,\n * dashboard `h-9 w-9`) and in whether the fallback carried type styling. Both\n * are settled here as props rather than copies: `size` picks the box, and the\n * fallback always carries the muted type treatment (dashboard's version — a\n * fallback renders initials, and unstyled initials inherit whatever the row\n * was using, which is how the two hosts' avatars stopped matching).\n */\n\nimport * as AvatarPrimitive from \"@radix-ui/react-avatar\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport type AvatarSize = \"sm\" | \"md\" | \"lg\";\n\nconst AVATAR_SIZES: Record<AvatarSize, string> = {\n sm: \"h-8 w-8 text-[11px]\",\n md: \"h-9 w-9 text-xs\",\n lg: \"h-10 w-10 text-sm\",\n};\n\nexport interface AvatarProps\n extends React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root> {\n /** Box size. Default `lg` (the h-10 box matrx-frontend has always shipped). */\n size?: AvatarSize;\n}\n\nconst Avatar = React.forwardRef<\n React.ComponentRef<typeof AvatarPrimitive.Root>,\n AvatarProps\n>(({ className, size = \"lg\", ...props }, ref) => (\n <AvatarPrimitive.Root\n ref={ref}\n data-slot=\"avatar\"\n className={cn(\n \"relative flex shrink-0 overflow-hidden rounded-full\",\n AVATAR_SIZES[size],\n className,\n )}\n {...props}\n />\n));\nAvatar.displayName = AvatarPrimitive.Root.displayName;\n\nconst AvatarImage = React.forwardRef<\n React.ComponentRef<typeof AvatarPrimitive.Image>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Image\n ref={ref}\n data-slot=\"avatar-image\"\n className={cn(\"aspect-square h-full w-full\", className)}\n {...props}\n />\n));\nAvatarImage.displayName = AvatarPrimitive.Image.displayName;\n\nconst AvatarFallback = React.forwardRef<\n React.ComponentRef<typeof AvatarPrimitive.Fallback>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Fallback\n ref={ref}\n data-slot=\"avatar-fallback\"\n className={cn(\n \"flex h-full w-full items-center justify-center rounded-full bg-muted font-medium text-muted-foreground\",\n className,\n )}\n {...props}\n />\n));\nAvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;\n\nexport { Avatar, AvatarFallback, AvatarImage };\n","\"use client\";\n\n/**\n * Card — the surface every host had already forked, four different ways.\n *\n * The census that motivated this file (2026-09-07): matrx-frontend padded its\n * sections `p-2`, matrx-extend `p-4`, aidream/apps/dashboard `p-6`, and\n * matrx-games ran a Base-UI-generation card of its own. The STRUCTURE was\n * identical in all of them — a bordered, tokenised surface with header /\n * title / description / content / footer slots. Only the density differed.\n *\n * So density is a PROP, not a fork. `size` is declared once on `<Card>` and\n * every section reads it from context, which means a host cannot end up with a\n * `p-6` header above a `p-2` body — the failure mode that made the forks drift\n * in the first place. A host that wants its historical density binds the size\n * once at its import site; nothing else moves.\n *\n * sm → p-2, rounded-xl, `shadow` (matrx-frontend's density)\n * md → p-4, rounded-lg, `shadow-sm` (matrx-extend's density; the default)\n * lg → p-6, rounded-lg, `shadow-sm` (dashboard's density)\n *\n * Colour is tokens only (`bg-card` / `text-card-foreground` / `border`), so a\n * host re-themes cards by redefining tokens, never by editing this file.\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport type CardSize = \"sm\" | \"md\" | \"lg\";\n\ninterface CardSizeSpec {\n root: string;\n pad: string;\n padTopless: string;\n}\n\nconst CARD_SIZES: Record<CardSize, CardSizeSpec> = {\n sm: {\n root: \"rounded-xl border bg-card text-card-foreground shadow\",\n pad: \"p-2\",\n padTopless: \"p-2 pt-0\",\n },\n md: {\n root: \"rounded-lg border bg-card text-card-foreground shadow-sm\",\n pad: \"p-4\",\n padTopless: \"p-4 pt-0\",\n },\n lg: {\n root: \"rounded-lg border bg-card text-card-foreground shadow-sm\",\n pad: \"p-6\",\n padTopless: \"p-6 pt-0\",\n },\n};\n\nconst CardSizeContext = React.createContext<CardSize>(\"md\");\n\n/** The size the nearest enclosing `<Card>` declared. `md` outside one. */\nexport function useCardSize(): CardSize {\n return React.useContext(CardSizeContext);\n}\n\nexport interface CardProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Density for this card and every section inside it. Default `md`. */\n size?: CardSize;\n}\n\nconst Card = React.forwardRef<HTMLDivElement, CardProps>(\n ({ className, size = \"md\", ...props }, ref) => (\n <CardSizeContext.Provider value={size}>\n <div\n ref={ref}\n data-slot=\"card\"\n data-size={size}\n className={cn(CARD_SIZES[size].root, className)}\n {...props}\n />\n </CardSizeContext.Provider>\n ),\n);\nCard.displayName = \"Card\";\n\nconst CardHeader = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => {\n const size = useCardSize();\n return (\n <div\n ref={ref}\n data-slot=\"card-header\"\n className={cn(\n \"flex flex-col space-y-1.5 rounded-t-[inherit]\",\n CARD_SIZES[size].pad,\n className,\n )}\n {...props}\n />\n );\n});\nCardHeader.displayName = \"CardHeader\";\n\nconst CardTitle = React.forwardRef<\n HTMLHeadingElement,\n React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n <h3\n ref={ref}\n data-slot=\"card-title\"\n className={cn(\"font-semibold leading-none tracking-tight\", className)}\n {...props}\n />\n));\nCardTitle.displayName = \"CardTitle\";\n\nconst CardDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <p\n ref={ref}\n data-slot=\"card-description\"\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nCardDescription.displayName = \"CardDescription\";\n\n/**\n * Trailing control slot for a header (a menu button, a status pill). Absent\n * from every fork except matrx-games', which is why headers elsewhere grew\n * one-off absolute wrappers. Positions itself against the header's row.\n */\nconst CardAction = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"card-action\"\n className={cn(\"ml-auto self-start\", className)}\n {...props}\n />\n));\nCardAction.displayName = \"CardAction\";\n\nconst CardContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => {\n const size = useCardSize();\n return (\n <div\n ref={ref}\n data-slot=\"card-content\"\n className={cn(CARD_SIZES[size].padTopless, className)}\n {...props}\n />\n );\n});\nCardContent.displayName = \"CardContent\";\n\nconst CardFooter = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => {\n const size = useCardSize();\n return (\n <div\n ref={ref}\n data-slot=\"card-footer\"\n className={cn(\n \"flex items-center rounded-b-[inherit]\",\n CARD_SIZES[size].padTopless,\n className,\n )}\n {...props}\n />\n );\n});\nCardFooter.displayName = \"CardFooter\";\n\nexport {\n Card,\n CardAction,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n};\n","\"use client\";\n\n/**\n * Checkbox — Radix checkbox, and the indeterminate ruling that came with it.\n *\n * RADIX RENDERS THE INDICATOR FOR BOTH `checked` AND `\"indeterminate\"`. The\n * stock shadcn body puts a full check inside it either way, so a half-selected\n * \"select all\" tells the user every row is selected — a screen stating\n * something false. The two states get different glyphs here, always.\n *\n * `size` carries the two boxes the hosts had forked into: matrx-frontend's\n * dense 14px control and the stock 16px one.\n */\n\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { CheckIcon, DividerHorizontalIcon } from \"./icons\";\n\nexport type CheckboxSize = \"sm\" | \"md\";\n\nconst CHECKBOX_SIZES: Record<CheckboxSize, { root: string; glyph: string }> = {\n sm: { root: \"h-3.5 w-3.5 rounded-xs\", glyph: \"h-3 w-3\" },\n md: { root: \"h-4 w-4 rounded-sm\", glyph: \"h-3.5 w-3.5\" },\n};\n\nexport interface CheckboxProps\n extends React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root> {\n /** Box size. Default `sm` (the dense 14px control). */\n size?: CheckboxSize;\n}\n\nconst Checkbox = React.forwardRef<\n React.ComponentRef<typeof CheckboxPrimitive.Root>,\n CheckboxProps\n>(({ className, size = \"sm\", ...props }, ref) => (\n <CheckboxPrimitive.Root\n ref={ref}\n data-slot=\"checkbox\"\n className={cn(\n \"peer shrink-0 cursor-pointer border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground\",\n CHECKBOX_SIZES[size].root,\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n data-slot=\"checkbox-indicator\"\n className=\"flex items-center justify-center text-current\"\n >\n {props.checked === \"indeterminate\" ? (\n <DividerHorizontalIcon className={CHECKBOX_SIZES[size].glyph} />\n ) : (\n <CheckIcon className={CHECKBOX_SIZES[size].glyph} />\n )}\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n));\nCheckbox.displayName = CheckboxPrimitive.Root.displayName;\n\nexport { Checkbox };\n","\"use client\";\n\n/**\n * Collapsible — Radix's, unwrapped.\n *\n * THE ROOT RENDERS UNCONDITIONALLY — no mount gate. The matrx-frontend\n * original carried the note that earned this line: a wrapper used to defer\n * rendering until after hydration on the theory that \"Radix generates dynamic\n * aria-controls ids that differ between SSR and client\". That was false —\n * Radix ids come from React's SSR-stable `useId` — and the gate was actively\n * harmful, because a Collapsible's Trigger wraps ALWAYS-VISIBLE content, so\n * `return null` deleted it from SSR and from the first client paint.\n *\n * Nothing here is restyled: the trigger and content are the host's to dress,\n * and every fork agreed on that. The file exists so no host re-derives the\n * SSR reasoning above from scratch — and gets it wrong again.\n */\n\nimport * as CollapsiblePrimitive from \"@radix-ui/react-collapsible\";\n\nconst Collapsible = CollapsiblePrimitive.Root;\nconst CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;\nconst CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;\n\nexport { Collapsible, CollapsibleContent, CollapsibleTrigger };\n","\"use client\";\n\n/**\n * Command — ported verbatim from matrx-frontend `components/ui/command.tsx`.\n *\n * `cmdk` is a SANCTIONED REAL DEPENDENCY (the vaul ↔ BottomSheet precedent):\n * the filtering/scoring/keyboard engine IS the component's product — there is\n * no Command palette without it, and reimplementing type-ahead ranking plus\n * roving keyboard selection would twin a maintained library rather than our\n * own code. See FEATURE.md.\n *\n * Seam inversions:\n * - `MagnifyingGlassIcon` comes from the package's inlined SVGs (C19), not\n * @radix-ui/react-icons.\n * - `CommandDialog` composed the host dialog module (`Dialog`, `DialogContent`,\n * `DialogTitle`). Those pieces are inlined privately below with identical\n * behavior — modal context, overlay, desktop card / mobile bottom-sheet\n * geometry, close control, portal — except the host's popout-aware\n * `DialogPortal` becomes the package's `PortalContainerProvider` seam\n * (plus an explicit `container` prop, which keeps top priority).\n * - The host's `useIsMobile` (a plain matchMedia breakpoint hook, not\n * host-shaped) became the package's own `./use-is-mobile`, with the same\n * 768px breakpoint. It started life inlined here; `Dialog` needed the same\n * answer, so it moved to a module both read rather than being copied.\n */\n\nimport type { DialogProps } from \"@radix-ui/react-dialog\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { MagnifyingGlassIcon, XIcon } from \"./icons\";\nimport { usePortalContainer } from \"./portal-container\";\nimport {\n RadixDialogModalProvider,\n useRadixDialogModal,\n} from \"./radix-dialog-modal-context\";\nimport { useIsMobile } from \"./use-is-mobile\";\n\nexport const Command = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n className={cn(\n \"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground\",\n className,\n )}\n {...props}\n />\n));\nCommand.displayName = CommandPrimitive.displayName;\n\n/* ------------------------------------------------------------------ */\n/* Private dialog internals for CommandDialog (host dialog module, */\n/* behavior-identical, portal seam inverted). */\n/* ------------------------------------------------------------------ */\n\nconst DIALOG_DESKTOP_CLASSES =\n \"fixed left-[50%] top-[50%] z-[10000] grid min-w-0 w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 overflow-x-clip border bg-background p-6 shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg\";\n\nconst DIALOG_MOBILE_SHEET_CLASSES =\n \"fixed inset-x-0 bottom-0 left-0 right-0 top-auto z-[10000] flex min-w-0 flex-col w-full max-w-full max-h-[90dvh] translate-x-0 translate-y-0 gap-4 overflow-x-clip border-t bg-background p-4 pb-safe shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full duration-200 rounded-t-2xl rounded-b-none overflow-y-auto overscroll-contain data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom\";\n\n// Re-asserted LAST so the sheet geometry always wins over any caller className.\nconst DIALOG_MOBILE_SHEET_OVERRIDE =\n \"inset-x-0 bottom-0 left-0 right-0 top-auto translate-x-0 translate-y-0 w-full max-w-full max-h-[90dvh] rounded-b-none rounded-t-2xl overflow-y-auto\";\n\nconst CommandDialogContent = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {\n container?: HTMLElement | null;\n }\n>(({ className, children, container, ...props }, ref) => {\n const isMobile = useIsMobile();\n const isModal = useRadixDialogModal();\n const portalContainer = usePortalContainer(container);\n return (\n <DialogPrimitive.Portal container={portalContainer}>\n {isModal ? (\n <DialogPrimitive.Overlay\n className=\"fixed inset-0 z-[10000] bg-[var(--matrx-overlay-scrim-soft)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\"\n />\n ) : null}\n <DialogPrimitive.Content\n ref={ref}\n aria-modal={isModal || undefined}\n aria-describedby={undefined}\n className={cn(\n isMobile ? DIALOG_MOBILE_SHEET_CLASSES : DIALOG_DESKTOP_CLASSES,\n className,\n isMobile && DIALOG_MOBILE_SHEET_OVERRIDE,\n !isModal && \"z-[900]\",\n )}\n {...props}\n >\n {children}\n <DialogPrimitive.Close className=\"absolute right-2 top-4 flex h-10 w-10 items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground sm:right-4\">\n <XIcon className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n );\n});\nCommandDialogContent.displayName = \"CommandDialogContent\";\n\nexport interface CommandDialogProps extends DialogProps {\n /** Explicit portal target for the dialog; beats the injected seam. */\n container?: HTMLElement | null;\n}\n\nexport const CommandDialog = ({\n children,\n container,\n ...props\n}: CommandDialogProps) => {\n const modal = props.modal ?? true;\n return (\n <RadixDialogModalProvider modal={modal}>\n <DialogPrimitive.Root {...props} modal={modal}>\n <CommandDialogContent\n className=\"overflow-hidden p-0\"\n {...(container !== undefined ? { container } : {})}\n >\n <DialogPrimitive.Title className=\"sr-only\"></DialogPrimitive.Title>\n <Command className=\"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\">\n {children}\n </Command>\n </CommandDialogContent>\n </DialogPrimitive.Root>\n </RadixDialogModalProvider>\n );\n};\n\nexport const CommandInput = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Input>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>\n>(({ className, ...props }, ref) => (\n <div className=\"flex items-center border-b px-3\" cmdk-input-wrapper=\"\">\n <MagnifyingGlassIcon className=\"mr-2 h-4 w-4 shrink-0 opacity-50\" />\n <CommandPrimitive.Input\n ref={ref}\n className={cn(\n \"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n {...props}\n />\n </div>\n));\nCommandInput.displayName = CommandPrimitive.Input.displayName;\n\nexport const CommandList = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.List\n ref={ref}\n className={cn(\"max-h-[300px] overflow-y-auto overflow-x-hidden\", className)}\n {...props}\n />\n));\nCommandList.displayName = CommandPrimitive.List.displayName;\n\nexport const CommandEmpty = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Empty>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>((props, ref) => (\n <CommandPrimitive.Empty\n ref={ref}\n className=\"py-6 text-center text-sm\"\n {...props}\n />\n));\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName;\n\nexport const CommandGroup = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Group>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Group\n ref={ref}\n className={cn(\n \"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground\",\n className,\n )}\n {...props}\n />\n));\nCommandGroup.displayName = CommandPrimitive.Group.displayName;\n\nexport const CommandSeparator = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 h-px bg-border\", className)}\n {...props}\n />\n));\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName;\n\nexport const CommandItem = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n className,\n )}\n {...props}\n />\n));\nCommandItem.displayName = CommandPrimitive.Item.displayName;\n\nexport const CommandShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground\",\n className,\n )}\n {...props}\n />\n );\n};\nCommandShortcut.displayName = \"CommandShortcut\";\n","\"use client\";\n\n/**\n * Injected portal-container seam.\n *\n * The matrx-frontend original resolved nested portal targets through\n * `useNestedPortalContainer` (explicit prop > dialog content > popout body >\n * document.body) — a host-shaped hook wired to that app's dialog and\n * window-panel systems. The package inverts the seam: hosts provide the\n * resolved container through `PortalContainerProvider`; an explicit\n * `container` prop on a component still wins, and with neither the portal\n * falls through to `document.body` (Radix default). Priority semantics are\n * unchanged from the original.\n */\n\nimport * as React from \"react\";\n\nconst PortalContainerContext = React.createContext<HTMLElement | null | undefined>(\n undefined,\n);\n\nexport interface PortalContainerProviderProps {\n /** Where nested Radix portals (Popover, etc.) should mount. `null`/`undefined` → document.body. */\n container: HTMLElement | null | undefined;\n children: React.ReactNode;\n}\n\nexport function PortalContainerProvider({\n container,\n children,\n}: PortalContainerProviderProps) {\n return (\n <PortalContainerContext.Provider value={container ?? undefined}>\n {children}\n </PortalContainerContext.Provider>\n );\n}\n\n/**\n * Resolve a portal target: explicit prop (including an explicit `null`,\n * meaning \"the default body\") beats the injected container.\n */\nexport function usePortalContainer(\n explicit?: HTMLElement | null,\n): HTMLElement | undefined {\n const injected = React.useContext(PortalContainerContext);\n\n if (explicit !== undefined) {\n return explicit ?? undefined;\n }\n\n return injected ?? undefined;\n}\n","\"use client\";\n\n/**\n * useIsMobile — the ONE breakpoint hook the package's responsive primitives\n * read (CommandDialog and Dialog both auto-render as a bottom sheet below it).\n *\n * Lifted out of `command.tsx`, where it lived privately, when Dialog arrived\n * and needed the SAME answer: two copies of a breakpoint hook is exactly the\n * duplication this package exists to end, and a Dialog that disagreed with a\n * CommandDialog about what \"mobile\" means would render two different sheet\n * geometries on one screen.\n *\n * SSR-safe by construction: `false` until mounted, so the server and the first\n * client paint agree and the desktop geometry is what hydrates. The mobile\n * geometry swaps in on the effect pass.\n *\n * The breakpoint is the host-original 768px (Tailwind `md`). It is exported so\n * a host can branch on the same number instead of inventing a second one.\n */\n\nimport * as React from \"react\";\n\n/** Viewport width (px) below which the package treats a surface as mobile. */\nexport const MOBILE_BREAKPOINT = 768;\n\nexport function useIsMobile(): boolean {\n const [isMobile, setIsMobile] = React.useState(false);\n const [hasMounted, setHasMounted] = React.useState(false);\n\n React.useEffect(() => {\n setHasMounted(true);\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n };\n onChange();\n mql.addEventListener(\"change\", onChange);\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n if (!hasMounted) {\n return false;\n }\n return isMobile;\n}\n","\"use client\";\n\n/**\n * ContextMenu — the right-click menu primitive.\n *\n * THE ROOT RENDERS UNCONDITIONALLY — no hydration mount gate. The gate a\n * matrx-frontend wrapper once carried (\"Radix generates dynamic aria-controls\n * ids that differ between SSR and client\") was false twice over: a CLOSED\n * `ContextMenuTrigger` renders only `data-state` / `data-disabled` and emits\n * no id at all, so there was never a mismatch to defend against. And the gate\n * was actively harmful: the Trigger wraps ALWAYS-VISIBLE content, so `return\n * null` deleted the wrapped subtree from the server render and the first\n * client render — around a list row, that means the list paints EMPTY and\n * fills in after hydration. Gating the Root would additionally orphan any\n * Trigger rendered beneath it.\n *\n * That history is exactly why this belongs in the package: the same repo had\n * already accumulated two copies of this wrapper, one gated and one not, with\n * the CORRECT one sitting unused beside the defective one.\n *\n * This is the PRIMITIVE only. A host's actual right-click menu SYSTEM — the\n * sections, the copy/export/convert actions, the surface registry — composes\n * these parts and stays host-owned; nothing here knows what an action is.\n *\n * Portalling goes through the package's `usePortalContainer` seam so a menu\n * raised inside a Dialog mounts inside it; an explicit `container` wins.\n */\n\nimport * as ContextMenuPrimitive from \"@radix-ui/react-context-menu\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { CheckIcon, DotFilledIcon, RadixChevronRightIcon } from \"./icons\";\nimport { usePortalContainer } from \"./portal-container\";\n\nconst ContextMenu = ContextMenuPrimitive.Root;\nconst ContextMenuTrigger = ContextMenuPrimitive.Trigger;\nconst ContextMenuGroup = ContextMenuPrimitive.Group;\nconst ContextMenuPortal = ContextMenuPrimitive.Portal;\nconst ContextMenuSub = ContextMenuPrimitive.Sub;\nconst ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;\n\nconst SURFACE_CLASS =\n \"z-50 min-w-[8rem] max-h-[var(--radix-context-menu-content-available-height)] overflow-y-auto overflow-x-hidden overscroll-contain rounded-md border bg-popover p-1 text-popover-foreground\";\n\nconst MOTION_CLASS =\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\";\n\nconst ITEM_CLASS =\n \"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\";\n\nconst INDICATOR_ITEM_CLASS =\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\";\n\nconst ContextMenuSubTrigger = React.forwardRef<\n React.ComponentRef<typeof ContextMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <ContextMenuPrimitive.SubTrigger\n ref={ref}\n data-slot=\"context-menu-sub-trigger\"\n className={cn(\n \"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground\",\n inset && \"pl-8\",\n className,\n )}\n {...props}\n >\n {children}\n <RadixChevronRightIcon className=\"ml-auto h-4 w-4\" />\n </ContextMenuPrimitive.SubTrigger>\n));\nContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;\n\nconst ContextMenuSubContent = React.forwardRef<\n React.ComponentRef<typeof ContextMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.SubContent\n ref={ref}\n data-slot=\"context-menu-sub-content\"\n className={cn(SURFACE_CLASS, \"shadow-lg\", MOTION_CLASS, className)}\n {...props}\n />\n));\nContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;\n\nexport interface ContextMenuContentProps\n extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content> {\n /** Explicit portal target; wins over the injected container. */\n container?: HTMLElement | null;\n}\n\nconst ContextMenuContent = React.forwardRef<\n React.ComponentRef<typeof ContextMenuPrimitive.Content>,\n ContextMenuContentProps\n>(({ className, container, ...props }, ref) => {\n const portalContainer = usePortalContainer(container);\n return (\n <ContextMenuPrimitive.Portal container={portalContainer}>\n <ContextMenuPrimitive.Content\n ref={ref}\n data-slot=\"context-menu-content\"\n className={cn(SURFACE_CLASS, \"shadow-md\", MOTION_CLASS, className)}\n {...props}\n />\n </ContextMenuPrimitive.Portal>\n );\n});\nContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;\n\nconst ContextMenuItem = React.forwardRef<\n React.ComponentRef<typeof ContextMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Item\n ref={ref}\n data-slot=\"context-menu-item\"\n className={cn(\n ITEM_CLASS,\n \"gap-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n inset && \"pl-8\",\n className,\n )}\n {...props}\n />\n));\nContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;\n\nconst ContextMenuCheckboxItem = React.forwardRef<\n React.ComponentRef<typeof ContextMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>\n>(({ className, children, ...props }, ref) => (\n <ContextMenuPrimitive.CheckboxItem\n ref={ref}\n data-slot=\"context-menu-checkbox-item\"\n className={cn(INDICATOR_ITEM_CLASS, className)}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <CheckIcon className=\"h-4 w-4\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.CheckboxItem>\n));\nContextMenuCheckboxItem.displayName =\n ContextMenuPrimitive.CheckboxItem.displayName;\n\nconst ContextMenuRadioItem = React.forwardRef<\n React.ComponentRef<typeof ContextMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <ContextMenuPrimitive.RadioItem\n ref={ref}\n data-slot=\"context-menu-radio-item\"\n className={cn(INDICATOR_ITEM_CLASS, className)}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <DotFilledIcon className=\"h-4 w-4 fill-current\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.RadioItem>\n));\nContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;\n\nconst ContextMenuLabel = React.forwardRef<\n React.ComponentRef<typeof ContextMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Label\n ref={ref}\n data-slot=\"context-menu-label\"\n className={cn(\n \"px-2 py-1.5 text-sm font-semibold text-foreground\",\n inset && \"pl-8\",\n className,\n )}\n {...props}\n />\n));\nContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;\n\nconst ContextMenuSeparator = React.forwardRef<\n React.ComponentRef<typeof ContextMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Separator\n ref={ref}\n data-slot=\"context-menu-separator\"\n className={cn(\"-mx-1 my-1 h-px bg-border\", className)}\n {...props}\n />\n));\nContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;\n\nconst ContextMenuShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => (\n <span\n data-slot=\"context-menu-shortcut\"\n className={cn(\"ml-auto text-xs tracking-widest text-muted-foreground\", className)}\n {...props}\n />\n);\nContextMenuShortcut.displayName = \"ContextMenuShortcut\";\n\nexport {\n ContextMenu,\n ContextMenuCheckboxItem,\n ContextMenuContent,\n ContextMenuGroup,\n ContextMenuItem,\n ContextMenuLabel,\n ContextMenuPortal,\n ContextMenuRadioGroup,\n ContextMenuRadioItem,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n ContextMenuTrigger,\n};\n","\"use client\";\n\n/**\n * CreatablePicker — ported verbatim from matrx-frontend\n * `components/ui/creatable-picker.tsx`.\n *\n * P23 — EVERY PICKER TAKES NEW INPUT.\n *\n * Arman, 2026-08-23: \"We have to annihilate the UIs that offer options but\n * don't allow custom entry because those are the ones that lose the platform\n * the best users… the moment I went in to assign a tier, I got a pop up that\n * forced me to choose from the shitty options I had in front of me. So instead\n * of our system getting significantly better because I took the initiative to\n * add something, our system was too arrogant and cocky and didn't want my\n * opinion. … It's the lazy coding agent who builds a popover with a drop down,\n * but is too lazy to include an add feature.\"\n *\n * THIS COMPONENT IS THE ANSWER, and it is the ONLY shape a keyword-system\n * choice control may take. Type-ahead over the existing options, and whatever\n * you typed that matched nothing is offered back as \"Create «what you typed»\".\n * One click turns it into a real row through the feature's ONE write path and\n * selects it — never a second creation path, never a \"go somewhere else first\".\n *\n * P11 — THE ONE EXCEPTION, AND IT IS NEVER A DEAD END. A platform-shared\n * vocabulary (traffic classes, the platform dimensions every tenant shares) is\n * governed centrally, so this control does not pretend it can widen it. It SAYS\n * so and offers the door instead: `lockedNote` + `lockedAction` render a\n * footer that takes the person to \"make this your own dimension\".\n *\n * It knows nothing about any vocabulary. The caller supplies the options and\n * ONE `onCreate` that writes through whatever the canonical path for that\n * vocabulary already is — this component must never grow a write path of its\n * own, or it becomes the second one.\n *\n * SoR: common-docs/systems/marketing/seo/seo-keywords/keyword-system-decisions.md\n * (P23, P11) + value-system.md § THE ASSIGNMENT LAYER.\n *\n * Seam inversions (the only changes from the origin):\n * - Popover/Command come from this package's own primitives (which route\n * portals through the `PortalContainerProvider` seam).\n * - The lucide icons become package-inlined SVGs (C19); `LucideIcon` in the\n * `footerActions` contract becomes the structural `PickerIcon`.\n */\n\nimport {\n useRef,\n useState,\n type ComponentType,\n type ReactNode,\n} from \"react\";\n\nimport { cn } from \"./cn\";\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n} from \"./command\";\nimport {\n ChevronsUpDownIcon,\n ExternalLinkIcon,\n Loader2Icon,\n LockIcon,\n LucideCheckIcon,\n PlusIcon,\n} from \"./icons\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\n\n/** Structural stand-in for the host's `LucideIcon` in `footerActions`. */\nexport type PickerIcon = ComponentType<{ className?: string }>;\n\n/**\n * \"Add a offering…\" is the kind of small wrongness that makes a product feel\n * unfinished, and the noun is caller-supplied so the article has to be derived.\n */\nfunction article(noun: string): string {\n return /^[aeiou]/i.test(noun.trim()) ? `an ${noun}` : `a ${noun}`;\n}\n\nexport interface CreatableOption {\n value: string;\n label: string;\n /** Right-aligned detail — a count, a description, \"yours\". */\n hint?: string;\n /** Rendered instead of the plain label (a band chip, a coloured pill). */\n render?: ReactNode;\n /** Extra words the type-ahead should match on. */\n keywords?: string;\n /**\n * The heading this option files under. Options keep the caller's order; a\n * group is opened the first time an option names it. Omit on every option\n * for a single ungrouped list.\n *\n * THE CATALOG IS NOT A WALL (Arman, 2026-08-24, on being shown offerings\n * that were not his): a set that legitimately holds more than this tenant's\n * own rows says so with a heading instead of hiding the rest.\n */\n group?: string;\n}\n\nexport interface CreatablePickerProps {\n value: string | null;\n options: CreatableOption[];\n onSelect: (value: string) => void;\n placeholder: string;\n searchPlaceholder?: string;\n /** The noun in \"Add a level…\" / \"Create «x»\". Always a person's word. */\n noun: string;\n /**\n * Turns typed text into a real row and returns the option value to select.\n * Return null when the caller handled it another way (opened a dialog that\n * needs more than a name — a level needs a threshold).\n */\n onCreate?: (typed: string) => Promise<string | null>;\n /**\n * Creating this noun needs more than a name, so the picker hands the typed\n * text to the caller's dialog instead of writing anything itself.\n */\n onCreateRequiresMore?: (typed: string) => void;\n disabled?: boolean;\n loading?: boolean;\n className?: string;\n triggerClassName?: string;\n emptyLabel?: string;\n ariaLabel?: string;\n /** P11: a sentence saying this vocabulary is platform-governed. */\n lockedNote?: string;\n /** P11: the door out of that refusal — never leave them with only \"no\". */\n lockedAction?: { label: string; onSelect: () => void };\n /**\n * Rendered inside the create footer, above the create button — for the one\n * extra choice a vocabulary needs at creation time (a category's parent,\n * say). It is a SLOT, not a second write path: whatever it collects is read\n * by the caller's own `onCreate`. A function receives what the person typed,\n * so a slot can offer matching suggestions (e.g. a shared catalog) instead\n * of a fixed block.\n */\n createExtra?: ReactNode | ((typed: string) => ReactNode);\n /**\n * THE MANAGE DOOR. Arman, 2026-08-24: \"where we have 'add' we should also\n * have a 'manage' button that opens that thing in a new tab.\" A control that\n * names a vocabulary must also be able to reach the place that vocabulary is\n * governed — otherwise the person who wants to rename, re-parent, or retire\n * an option has to go hunting for a screen they may not know exists.\n *\n * It opens in a NEW TAB on purpose: nobody loses the row they were editing\n * in order to go look at the catalog.\n */\n manageAction?: { label: string; href: string };\n /**\n * Doors to a DIFFERENT answer than this vocabulary can give. The offering\n * picker's \"this isn't something we offer\" lives here, because that ruling\n * is a traffic class, not an offering — and sending someone to look for\n * another column on their own is the dead end this slot exists to close.\n */\n footerActions?: Array<{\n label: string;\n icon?: PickerIcon;\n onSelect: () => void;\n /** A sentence under the door saying what it does, when it needs one. */\n note?: string;\n }>;\n /**\n * What the TRIGGER shows for the current selection, when the caller wants\n * something other than the option row's own `render`. A dense table cell\n * needs one compact line (\"Data Destruction Services · ITAD\"); the list row\n * it came from is indented and annotated. Same selection, two jobs.\n */\n renderSelected?: ReactNode;\n size?: \"sm\" | \"md\";\n}\n\nexport function CreatablePicker({\n value,\n options,\n onSelect,\n placeholder,\n searchPlaceholder,\n noun,\n onCreate,\n onCreateRequiresMore,\n disabled,\n loading,\n className,\n triggerClassName,\n emptyLabel = \"No match.\",\n ariaLabel,\n lockedNote,\n lockedAction,\n createExtra,\n manageAction,\n footerActions,\n renderSelected,\n size = \"sm\",\n}: CreatablePickerProps) {\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState(\"\");\n const [busy, setBusy] = useState(false);\n /**\n * THE FOOTER IS NEVER A DEAD CLICK. Arman, 2026-08-24: \"one of the options is\n * to allow you to add. When I click add offering, however, nothing happens.\"\n * He was right, and the cause was here, not in the popover: with nothing\n * typed, `create(\"\")` fell straight out of `if (!name) return` and the\n * button ate the click in silence. A control whose whole purpose is P23 may\n * not be the control that ignores you — so an empty \"Add…\" now puts the\n * cursor in the box and SAYS what it wants.\n */\n const inputRef = useRef<HTMLInputElement>(null);\n const [needsName, setNeedsName] = useState(false);\n\n const selected = options.find((option) => option.value === value) ?? null;\n\n // Caller order is the order. A heading opens the first time an option names\n // it, so a tree stays in tree order inside its own heading.\n const groups: Array<{ heading?: string; options: CreatableOption[] }> = [];\n for (const option of options) {\n const last = groups[groups.length - 1];\n if (last && last.heading === option.group) last.options.push(option);\n else\n groups.push(\n option.group === undefined\n ? { options: [option] }\n : { heading: option.group, options: [option] },\n );\n }\n\n const typed = query.trim();\n const exactMatch = options.some(\n (option) => option.label.toLowerCase() === typed.toLowerCase(),\n );\n const canCreate = Boolean(onCreate ?? onCreateRequiresMore) && !lockedNote;\n\n const close = () => {\n setOpen(false);\n setQuery(\"\");\n setNeedsName(false);\n };\n\n const create = async (text: string) => {\n const name = text.trim();\n if (busy) return;\n // `onCreateRequiresMore` opens a dialog that asks for the name itself, so\n // a blank click there is legitimate — it opens the dialog empty. Only the\n // write-it-now path needs a name before it can do anything.\n if (onCreateRequiresMore) {\n close();\n onCreateRequiresMore(name);\n return;\n }\n if (!onCreate) return;\n if (!name) {\n setNeedsName(true);\n inputRef.current?.focus();\n return;\n }\n setBusy(true);\n try {\n const next = await onCreate(name);\n if (next) onSelect(next);\n close();\n } finally {\n setBusy(false);\n }\n };\n\n return (\n <Popover open={open} onOpenChange={(next) => (next ? setOpen(true) : close())}>\n <PopoverTrigger asChild disabled={disabled}>\n <button\n type=\"button\"\n aria-label={ariaLabel ?? placeholder}\n className={cn(\n \"flex w-full items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 text-left shadow-xs transition-colors\",\n \"hover:border-primary/50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n size === \"sm\" ? \"h-8 text-xs\" : \"h-9 text-sm\",\n className,\n triggerClassName,\n )}\n >\n <span className=\"min-w-0 flex-1 truncate\">\n {selected ? (\n (renderSelected ?? selected.render ?? selected.label)\n ) : (\n <span className=\"text-muted-foreground\">\n {loading ? \"Loading…\" : placeholder}\n </span>\n )}\n </span>\n <ChevronsUpDownIcon className=\"size-3.5 shrink-0 opacity-50\" />\n </button>\n </PopoverTrigger>\n <PopoverContent align=\"start\" className=\"w-[--radix-popover-trigger-width] min-w-56 p-0\">\n <Command\n filter={(itemValue, search, keywords) => {\n const haystack = `${itemValue} ${keywords?.join(\" \") ?? \"\"}`.toLowerCase();\n return haystack.includes(search.toLowerCase()) ? 1 : 0;\n }}\n >\n <CommandInput\n ref={inputRef}\n value={query}\n onValueChange={(next) => {\n setQuery(next);\n if (next.trim()) setNeedsName(false);\n }}\n placeholder={searchPlaceholder ?? `Search or add ${article(noun)}…`}\n />\n <CommandList>\n <CommandEmpty>{emptyLabel}</CommandEmpty>\n {groups.map((group) => (\n <CommandGroup\n key={group.heading ?? \"__ungrouped__\"}\n {...(group.heading === undefined\n ? {}\n : { heading: group.heading })}\n >\n {group.options.map((option) => (\n <CommandItem\n key={option.value}\n value={option.label}\n {...(option.keywords\n ? { keywords: [option.keywords] }\n : {})}\n onSelect={() => {\n onSelect(option.value);\n close();\n }}\n className=\"gap-2 text-xs\"\n >\n <LucideCheckIcon\n className={cn(\n \"size-3.5 shrink-0\",\n option.value === value ? \"opacity-100\" : \"opacity-0\",\n )}\n />\n <span className=\"min-w-0 flex-1 truncate\">\n {option.render ?? option.label}\n </span>\n {option.hint ? (\n <span className=\"shrink-0 text-[10px] text-muted-foreground\">\n {option.hint}\n </span>\n ) : null}\n </CommandItem>\n ))}\n </CommandGroup>\n ))}\n </CommandList>\n\n {/* The \"+ Add\" footer sits OUTSIDE CommandList so the search can\n never hide the one thing the person came here to do (P23). */}\n {canCreate ? (\n <div className=\"space-y-1 border-t border-border p-1\">\n {createExtra && typed && !exactMatch ? (\n <div className=\"px-1 pt-0.5\">\n {typeof createExtra === \"function\"\n ? createExtra(typed)\n : createExtra}\n </div>\n ) : null}\n <button\n type=\"button\"\n disabled={busy}\n onClick={() => void create(typed)}\n className=\"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50\"\n >\n {busy ? (\n <Loader2Icon className=\"size-3.5 shrink-0 animate-spin\" />\n ) : (\n <PlusIcon className=\"size-3.5 shrink-0\" />\n )}\n <span className=\"min-w-0 truncate\">\n {typed && !exactMatch\n ? `Create “${typed}”`\n : `Add ${article(noun)}…`}\n </span>\n </button>\n {needsName ? (\n <p className=\"px-2 pb-0.5 text-[11px] leading-snug text-muted-foreground\">\n Type the name of the {noun} you want to add — then this\n creates it.\n </p>\n ) : null}\n </div>\n ) : null}\n\n {/* THE DOORS. Everything this control names must be reachable from\n it: the place the vocabulary is governed, and the other answer\n when this vocabulary is the wrong one to be answering with. */}\n {footerActions?.length || manageAction ? (\n <div className=\"space-y-0.5 border-t border-border p-1\">\n {footerActions?.map((action) => {\n const Icon = action.icon;\n return (\n <div key={action.label}>\n <button\n type=\"button\"\n onClick={() => {\n close();\n action.onSelect();\n }}\n className=\"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n {Icon ? <Icon className=\"size-3.5 shrink-0\" /> : null}\n <span className=\"min-w-0 truncate\">{action.label}</span>\n </button>\n {action.note ? (\n <p className=\"px-2 pb-1 text-[10px] leading-snug text-muted-foreground\">\n {action.note}\n </p>\n ) : null}\n </div>\n );\n })}\n {manageAction ? (\n <a\n href={manageAction.href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n onClick={close}\n className=\"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n <ExternalLinkIcon className=\"size-3.5 shrink-0\" />\n <span className=\"min-w-0 truncate\">{manageAction.label}</span>\n </a>\n ) : null}\n </div>\n ) : null}\n\n {/* P11 — shared vocabulary. Say it, then hand them the door. */}\n {lockedNote ? (\n <div className=\"space-y-1 border-t border-border p-2\">\n <p className=\"flex gap-1.5 text-[11px] leading-snug text-muted-foreground\">\n <LockIcon className=\"mt-px size-3 shrink-0\" />\n <span>{lockedNote}</span>\n </p>\n {lockedAction ? (\n <button\n type=\"button\"\n onClick={() => {\n close();\n lockedAction.onSelect();\n }}\n className=\"flex w-full items-center gap-2 rounded-sm px-1 py-1 text-left text-xs font-medium text-primary transition-colors hover:bg-accent\"\n >\n <PlusIcon className=\"size-3.5 shrink-0\" />\n <span className=\"min-w-0 truncate\">{lockedAction.label}</span>\n </button>\n ) : null}\n </div>\n ) : null}\n </Command>\n </PopoverContent>\n </Popover>\n );\n}\n","\"use client\";\n\n/**\n * Popover — ported verbatim from matrx-frontend `components/ui/popover.tsx`.\n *\n * Seam inversion: the host's `useNestedPortalContainer` (dialog/popout aware)\n * becomes the injected `PortalContainerProvider` seam (`portal-container.tsx`);\n * the explicit `container` prop keeps top priority, exactly as before.\n *\n * THE ROOT RENDERS UNCONDITIONALLY — no mount gate. This wrapper used to defer\n * rendering until after hydration (\"Radix generates dynamic aria-controls ids\n * that differ between SSR and client\"), and that justification was false:\n * Radix ids come from React's SSR-stable `useId` (verified against\n * @radix-ui/react-popover 1.1.17 / react-id 1.1.2). The gate was actively\n * harmful — the Trigger wraps ALWAYS-VISIBLE content, so `return null`\n * deleted it from SSR and the first client paint.\n */\n\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { usePortalContainer } from \"./portal-container\";\n\nexport const Popover = PopoverPrimitive.Root;\n\nexport const PopoverTrigger = PopoverPrimitive.Trigger;\n\nexport const PopoverAnchor = PopoverPrimitive.Anchor;\n\nexport const PopoverContent = React.forwardRef<\n React.ComponentRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> & {\n container?: HTMLElement | null;\n }\n>(\n (\n { className, align = \"center\", sideOffset = 4, container, ...props },\n ref,\n ) => {\n const portalContainer = usePortalContainer(container);\n return (\n <PopoverPrimitive.Portal container={portalContainer}>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n // Cap to the viewport space Radix measured and scroll — a popover taller\n // than the screen must never trap the user with unreachable content.\n // z must EQUAL the dialog layer (z-[10000]), never exceed it: with equal\n // z, DOM portal order decides, so a dialog opened FROM a popover stacks\n // above it, and a popover opened from a dialog still stacks above the\n // dialog. z-[10001] buried dialogs behind fullscreen popovers.\n \"z-[10000] w-72 max-h-[var(--radix-popover-content-available-height)] overflow-y-auto overscroll-contain rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n );\n },\n);\nPopoverContent.displayName = PopoverPrimitive.Content.displayName;\n","\"use client\";\n\n/**\n * Dialog — the modal surface, carrying every ruling the host forks paid for.\n *\n * Four hosts shipped four dialogs. Three were the stock shadcn body: a\n * fixed-size centered card with `overflow: visible`. matrx-frontend's had been\n * hardened, incident by incident, and those hardenings are the reason this\n * component belongs in the package rather than being copied a fifth time:\n *\n * 1. THE ROOT RENDERS UNCONDITIONALLY — no hydration mount gate. The gate a\n * wrapper once carried (\"Radix ids differ between SSR and client\") was\n * false — Radix ids come from React's SSR-stable `useId` — and it deleted\n * the always-visible Trigger from SSR and the first client paint.\n *\n * 2. THE DIALOG IS CLAMPED TO THE VIEWPORT AND SCROLLS INSIDE ITSELF. Proven\n * live: an admin \"Create Category\" dialog rendered 851px tall in a 657px\n * viewport with `overflow-y: visible`, so its Create button sat below the\n * fold, unreachable. The only way out was a backdrop click — which\n * dismisses WITHOUT writing, and is indistinguishable from a silent save\n * failure. `max-h-[85dvh] overflow-y-auto` is the cap.\n *\n * 3. THE PRIMARY ACTION IS ALWAYS PRESSABLE. `DialogFooter` is sticky and\n * bleeds to the card's edges using `--dialog-pad`, so scrolled content\n * never shows through beneath it. Outside a DialogContent the variable is\n * unset, the padding falls back to `0px`, and the footer is the plain row\n * it always was.\n *\n * 4. ON MOBILE THE SAME DIALOG IS A BOTTOM SHEET — full width, bottom\n * anchored, height-capped, internally scrollable, safe-area padded. Opt out\n * with `mobileSheet={false}` only for the rare surface that must stay\n * centered (a tiny spinner). The sheet geometry is re-asserted AFTER the\n * caller's className so a desktop `max-w-2xl` cannot un-fullscreen it.\n *\n * 5. AN UNTITLED DIALOG IS STILL ACCESSIBLE. Radix warns (correctly) that\n * every dialog needs a title; rather than let hosts ship the warning, a\n * visually-hidden title is injected when the tree has none, and\n * `aria-describedby` is dropped when there is no description rather than\n * pointing at nothing.\n *\n * SEAM INVERSIONS. The host original resolved its portal target through\n * app-shaped hooks (a popped-out window-panel body). Here that is the\n * package's `PortalContainerProvider` seam, with an explicit `container` prop\n * keeping top priority. And DialogContent PROVIDES that seam to its own\n * children, so a Popover or menu opened inside a dialog portals INTO the\n * dialog — staying inside the scroll shard, where its wheel events work.\n * `useDialogContainer` exposes the same element for host code that needs it.\n */\n\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport * as VisuallyHidden from \"@radix-ui/react-visually-hidden\";\nimport { treeContainsComponent } from \"@ai-matrx/kit/react-tree\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { XIcon } from \"./icons\";\nimport { usePortalContainer, PortalContainerProvider } from \"./portal-container\";\nimport {\n RadixDialogModalProvider,\n useRadixDialogModal,\n} from \"./radix-dialog-modal-context\";\nimport { useIsMobile } from \"./use-is-mobile\";\n\nconst Dialog = ({\n children,\n ...props\n}: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>) => {\n const modal = props.modal ?? true;\n return (\n <RadixDialogModalProvider modal={modal}>\n <DialogPrimitive.Root {...props} modal={modal}>\n {children}\n </DialogPrimitive.Root>\n </RadixDialogModalProvider>\n );\n};\nDialog.displayName = \"Dialog\";\n\nconst DialogTrigger = DialogPrimitive.Trigger;\nconst DialogClose = DialogPrimitive.Close;\n\n/**\n * Portal-seam-aware DialogPortal. An explicit `container` always wins; with\n * none, the injected `PortalContainerProvider` value decides; with neither,\n * Radix's `document.body`.\n */\nconst DialogPortal = ({\n container,\n ...props\n}: Omit<\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>,\n \"container\"\n> & {\n /** `undefined` → use the injected container; `null` → force document.body. */\n container?: HTMLElement | null | undefined;\n}) => {\n const resolved = usePortalContainer(container);\n return <DialogPrimitive.Portal container={resolved ?? null} {...props} />;\n};\nDialogPortal.displayName = \"DialogPortal\";\n\nconst DialogContainerContext = React.createContext<HTMLElement | null>(null);\n\n/** The DialogContent element, for host code that portals into the dialog. */\nexport const useDialogContainer = (): HTMLElement | null =>\n React.useContext(DialogContainerContext);\n\nconst DialogOverlay = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n data-slot=\"dialog-overlay\"\n className={cn(\n // Page context behind the modal stays readable; separation comes from a\n // light token scrim, not a blur.\n \"fixed inset-0 z-[10000] bg-[var(--matrx-overlay-scrim-soft)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n className,\n )}\n {...props}\n />\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\n/**\n * Unstyled, non-portalling Content for custom dialog layouts. Preserves Radix\n * focus/background behavior and derives `aria-modal` from the Root.\n */\nconst DialogContentPrimitive = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>\n>((props, ref) => {\n const isModal = useRadixDialogModal();\n return (\n <DialogPrimitive.Content\n {...props}\n ref={ref}\n aria-modal={isModal || undefined}\n />\n );\n});\nDialogContentPrimitive.displayName = \"DialogContentPrimitive\";\n\nconst DIALOG_DESKTOP_CLASSES =\n \"fixed left-[50%] top-[50%] z-[10000] grid min-w-0 w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 max-h-[85dvh] overflow-y-auto overscroll-contain [--dialog-pad:1.5rem] overflow-x-clip border bg-background p-6 shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg\";\n\nconst DIALOG_MOBILE_SHEET_CLASSES =\n \"matrx-mobile-sheet fixed inset-x-0 bottom-0 left-0 right-0 top-auto z-[10000] flex min-w-0 flex-col w-full max-w-full max-h-[90dvh] translate-x-0 translate-y-0 gap-4 [--dialog-pad:1rem] overflow-x-clip border-t bg-background p-4 pb-safe shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full duration-200 rounded-t-2xl rounded-b-none overflow-y-auto overscroll-contain data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom\";\n\n// Re-asserted LAST so sheet geometry always wins over a caller className.\nconst DIALOG_MOBILE_SHEET_OVERRIDE =\n \"inset-x-0 bottom-0 left-0 right-0 top-auto translate-x-0 translate-y-0 w-full max-w-full max-h-[90dvh] rounded-b-none rounded-t-2xl overflow-y-auto\";\n\nexport interface DialogContentProps\n extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {\n /** Render as a bottom sheet below the mobile breakpoint. Default `true`. */\n mobileSheet?: boolean;\n /** Render the built-in close control. Default `true`. */\n showCloseButton?: boolean;\n /** Explicit portal target; wins over the injected container. */\n container?: HTMLElement | null;\n}\n\nconst DialogContent = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Content>,\n DialogContentProps\n>(\n (\n {\n className,\n children,\n mobileSheet = true,\n showCloseButton = true,\n container,\n ...props\n },\n ref,\n ) => {\n const isMobile = useIsMobile();\n const isModal = useRadixDialogModal();\n // Falls through to the injected container while `containerEl` is unset\n // (pre-mount) — the original's dialog > popout > body priority.\n const injectedContainer = usePortalContainer(container);\n const asSheet = mobileSheet && isMobile;\n const [containerEl, setContainerEl] = React.useState<HTMLElement | null>(\n null,\n );\n\n const mergedRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n setContainerEl(node);\n if (typeof ref === \"function\") ref(node);\n else if (ref)\n (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n },\n [ref],\n );\n\n const hasTitle =\n treeContainsComponent(children, DialogTitle) ||\n treeContainsComponent(children, DialogPrimitive.Title);\n const hasDescription =\n treeContainsComponent(children, DialogDescription) ||\n treeContainsComponent(children, DialogPrimitive.Description);\n\n return (\n <DialogPortal container={container}>\n {isModal ? <DialogOverlay /> : null}\n <DialogContentPrimitive\n ref={mergedRef}\n data-slot=\"dialog-content\"\n className={cn(\n asSheet ? DIALOG_MOBILE_SHEET_CLASSES : DIALOG_DESKTOP_CLASSES,\n className,\n asSheet && DIALOG_MOBILE_SHEET_OVERRIDE,\n // A non-modal dialog is the coexistence contract for content that\n // can sit beside a host's floating window manager (which starts at\n // z=1000); staying below that boundary makes a newly focused window\n // usable without coupling the two systems.\n !isModal && \"z-[900]\",\n )}\n {...(hasDescription ? {} : { \"aria-describedby\": undefined })}\n {...props}\n >\n {hasTitle ? null : (\n <VisuallyHidden.Root>\n <DialogPrimitive.Title>Dialog</DialogPrimitive.Title>\n </VisuallyHidden.Root>\n )}\n <DialogContainerContext.Provider value={containerEl}>\n <PortalContainerProvider\n container={containerEl ?? injectedContainer ?? null}\n >\n {children}\n </PortalContainerProvider>\n </DialogContainerContext.Provider>\n {showCloseButton ? (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n aria-label=\"Close\"\n className=\"absolute right-2 top-4 flex h-11 w-11 items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground sm:right-4 lg:h-10 lg:w-10\"\n >\n <XIcon className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n ) : null}\n </DialogContentPrimitive>\n </DialogPortal>\n );\n },\n);\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n data-slot=\"dialog-header\"\n className={cn(\n // DialogContent owns an absolute close control. Reserve its hit area in\n // every header so trailing actions never render underneath it.\n \"flex flex-col space-y-1.5 pr-12 text-center sm:text-left\",\n className,\n )}\n {...props}\n />\n);\nDialogHeader.displayName = \"DialogHeader\";\n\nconst DialogFooter = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n \"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n \"sticky bottom-0 z-10 bg-background pt-3\",\n \"mx-[calc(var(--dialog-pad,0px)*-1)] mb-[calc(var(--dialog-pad,0px)*-1)] px-[var(--dialog-pad,0px)] pb-[var(--dialog-pad,0px)]\",\n className,\n )}\n {...props}\n />\n);\nDialogFooter.displayName = \"DialogFooter\";\n\nconst DialogTitle = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n data-slot=\"dialog-title\"\n className={cn(\"text-lg font-semibold leading-none tracking-tight\", className)}\n {...props}\n />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n data-slot=\"dialog-description\"\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogContentPrimitive,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n};\n","\"use client\";\n\n/**\n * DropdownMenu — Radix dropdown with two behaviours the stock body lacks.\n *\n * 1. THE ROOT RENDERS UNCONDITIONALLY — no hydration mount gate. A wrapper in\n * matrx-frontend once deferred rendering until after hydration on a false\n * premise (Radix ids come from React's SSR-stable `useId`), which deleted\n * the always-visible trigger — buttons, `…` menus — from SSR and the first\n * client paint.\n *\n * 2. A LONG MENU SCROLLS INSTEAD OF GROWING OFF-SCREEN. Content and SubContent\n * cap at `--radix-dropdown-menu-content-available-height` — the space Radix\n * actually measured between the trigger and the viewport edge — and scroll\n * past it. Without the cap a menu longer than the viewport puts its last\n * items where no pointer can reach them, and on a short window that can be\n * the only exit from the surface.\n *\n * Portalling goes through the package's `usePortalContainer` seam, so a menu\n * opened inside a Dialog mounts INSIDE the dialog (staying in the scroll\n * shard, where its wheel events work) instead of at `document.body`. An\n * explicit `container` prop still wins.\n *\n * Icons are the package's inlined SVGs (C19) — no icon-library dependency.\n */\n\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { CheckIcon, DotFilledIcon, RadixChevronRightIcon } from \"./icons\";\nimport { usePortalContainer } from \"./portal-container\";\n\nconst DropdownMenu = DropdownMenuPrimitive.Root;\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst MENU_SURFACE_CLASS =\n \"z-[10001] min-w-[8rem] max-h-[var(--radix-dropdown-menu-content-available-height)] overflow-y-auto overflow-x-hidden overscroll-contain rounded-md border bg-popover p-1 text-popover-foreground\";\n\nconst MENU_MOTION_CLASS =\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\";\n\nconst MENU_ITEM_CLASS =\n \"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\";\n\nconst MENU_INDICATOR_ITEM_CLASS =\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\";\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n data-slot=\"dropdown-menu-sub-trigger\"\n className={cn(\n \"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent\",\n inset && \"pl-8\",\n className,\n )}\n {...props}\n >\n {children}\n <RadixChevronRightIcon className=\"ml-auto h-4 w-4\" />\n </DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName =\n DropdownMenuPrimitive.SubTrigger.displayName;\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n data-slot=\"dropdown-menu-sub-content\"\n className={cn(MENU_SURFACE_CLASS, \"shadow-lg\", MENU_MOTION_CLASS, className)}\n {...props}\n />\n));\nDropdownMenuSubContent.displayName =\n DropdownMenuPrimitive.SubContent.displayName;\n\nexport interface DropdownMenuContentProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content> {\n /** Explicit portal target; wins over the injected container. */\n container?: HTMLElement | null;\n}\n\nconst DropdownMenuContent = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Content>,\n DropdownMenuContentProps\n>(({ className, sideOffset = 4, container, ...props }, ref) => {\n const portalContainer = usePortalContainer(container);\n return (\n <DropdownMenuPrimitive.Portal container={portalContainer}>\n <DropdownMenuPrimitive.Content\n ref={ref}\n data-slot=\"dropdown-menu-content\"\n sideOffset={sideOffset}\n className={cn(\n MENU_SURFACE_CLASS,\n \"shadow-md\",\n MENU_MOTION_CLASS,\n className,\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n );\n});\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\nconst DropdownMenuItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n data-slot=\"dropdown-menu-item\"\n className={cn(MENU_ITEM_CLASS, inset && \"pl-8\", className)}\n {...props}\n />\n));\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n data-slot=\"dropdown-menu-checkbox-item\"\n className={cn(MENU_INDICATOR_ITEM_CLASS, className)}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CheckIcon className=\"h-4 w-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName =\n DropdownMenuPrimitive.CheckboxItem.displayName;\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n data-slot=\"dropdown-menu-radio-item\"\n className={cn(MENU_INDICATOR_ITEM_CLASS, className)}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <DotFilledIcon className=\"h-4 w-4 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n));\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n data-slot=\"dropdown-menu-label\"\n className={cn(\"px-2 py-1.5 text-sm font-semibold\", inset && \"pl-8\", className)}\n {...props}\n />\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n data-slot=\"dropdown-menu-separator\"\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nconst DropdownMenuShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\"ml-auto text-xs tracking-widest opacity-60\", className)}\n {...props}\n />\n);\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\";\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n};\n","\"use client\";\n\n/**\n * EditableLabel — inline rename-in-place text.\n *\n * Ported verbatim from matrx-frontend\n * `components/official/item/EditableLabel.tsx` (S16). Commit on Enter/blur,\n * Esc cancels, whitespace-only falls back to `emptyFallback` (or cancels),\n * stays in sync with upstream `value` while not editing. Decoupled from any\n * store — `onCommit(next)` is the only side-effect channel.\n *\n * Three activation modes:\n * - \"click\" → click the display text to edit (header titles)\n * - \"doubleClick\" → double-click to edit (rows where single-click selects)\n * - \"controlled\" → host owns `editing`; this renders ONLY the input while\n * editing (the host renders its own display element)\n *\n * Seam inversions:\n * - Prop types come with the component instead of the host's item-system\n * `types.ts` (identical shapes).\n * - The lucide `Loader2` busy spinner is the package's inlined SVG (C19).\n */\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { cn } from \"./cn\";\nimport { Loader2Icon } from \"./icons\";\n\nexport type EditableLabelCommitMode = \"optimistic\" | \"await\";\nexport type EditableLabelActivation = \"click\" | \"doubleClick\" | \"controlled\";\n\nexport interface EditableLabelProps {\n value: string;\n /**\n * Commit handler. optimistic (default): edit mode exits immediately, the\n * promise is fire-and-forget (owners do optimistic update + revert + toast).\n * await: input disables with a spinner until the promise resolves; a\n * rejection keeps edit mode open to retry.\n */\n onCommit: (next: string) => void | Promise<void>;\n commitMode?: EditableLabelCommitMode;\n /** Return an error message to block the commit (shown under the input). */\n validate?: (next: string) => string | null;\n /** Used when the trimmed draft is empty. Undefined → empty cancels. */\n emptyFallback?: string;\n maxLength?: number; // default 120\n /**\n * \"click\"/\"doubleClick\" — internal edit state (headers). \"controlled\" — host\n * owns `editing`; EditableLabel renders ONLY the input when editing.\n */\n activation?: EditableLabelActivation;\n editing?: boolean; // controlled mode\n /** Edit-state notifications. Controlled mode: the ONLY state channel.\n * Uncontrolled modes: fired as a notification (layout hooks etc.). */\n onEditingChange?: (editing: boolean) => void;\n selectOnEdit?: boolean; // default true\n placeholder?: string;\n /** Accessible name, e.g. \"Session title\". Default \"Name\". */\n ariaLabel?: string;\n truncate?: boolean; // display mode, default true\n className?: string; // both modes\n displayClassName?: string;\n inputClassName?: string;\n}\n\nexport function EditableLabel({\n value,\n onCommit,\n commitMode = \"optimistic\",\n validate,\n emptyFallback,\n maxLength = 120,\n activation = \"click\",\n editing: editingProp,\n onEditingChange,\n selectOnEdit = true,\n placeholder,\n ariaLabel = \"Name\",\n truncate = true,\n className,\n displayClassName,\n inputClassName,\n}: EditableLabelProps) {\n const controlled = activation === \"controlled\";\n const [internalEditing, setInternalEditing] = useState(false);\n const editing = controlled ? !!editingProp : internalEditing;\n\n const [draft, setDraft] = useState(value);\n const [error, setError] = useState<string | null>(null);\n const [busy, setBusy] = useState(false);\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n // Stay in sync with upstream changes (realtime / auto-label) while idle.\n useEffect(() => {\n if (!editing) setDraft(value);\n }, [value, editing]);\n\n // Focus + select on entering edit mode.\n useEffect(() => {\n if (editing && inputRef.current) {\n inputRef.current.focus();\n if (selectOnEdit) inputRef.current.select();\n }\n }, [editing, selectOnEdit]);\n\n const setEditing = useCallback(\n (next: boolean) => {\n if (controlled) {\n onEditingChange?.(next);\n } else {\n // Uncontrolled hosts still get notified — lets them adjust layout\n // (e.g. widen the edit box) without taking over the edit state.\n setInternalEditing(next);\n onEditingChange?.(next);\n }\n },\n [controlled, onEditingChange],\n );\n\n const startEdit = useCallback(() => {\n setDraft(value);\n setError(null);\n setEditing(true);\n }, [value, setEditing]);\n\n const cancel = useCallback(() => {\n setDraft(value);\n setError(null);\n setBusy(false);\n setEditing(false);\n }, [value, setEditing]);\n\n const commit = useCallback(() => {\n if (busy) return;\n const trimmed = draft.trim();\n const next = trimmed || emptyFallback;\n\n // Empty + no fallback → cancel rather than commit garbage.\n if (next === undefined) {\n cancel();\n return;\n }\n\n const validationError = validate?.(next) ?? null;\n if (validationError) {\n setError(validationError);\n return;\n }\n\n // No-op commit — skip the side effect entirely.\n if (next === value) {\n setEditing(false);\n setError(null);\n return;\n }\n\n if (commitMode === \"await\") {\n const result = onCommit(next);\n if (result instanceof Promise) {\n setBusy(true);\n result\n .then(() => {\n setBusy(false);\n setEditing(false);\n })\n .catch(() => {\n // Keep edit mode open so the user can retry.\n setBusy(false);\n });\n return;\n }\n setEditing(false);\n return;\n }\n\n // optimistic — exit immediately, fire-and-forget.\n setEditing(false);\n setError(null);\n const result = onCommit(next);\n if (result instanceof Promise) result.catch(() => {});\n }, [\n busy,\n draft,\n emptyFallback,\n validate,\n value,\n commitMode,\n onCommit,\n cancel,\n setEditing,\n ]);\n\n if (editing) {\n return (\n <span className={cn(\"relative flex min-w-0 flex-1 items-center\", className)}>\n <input\n ref={inputRef}\n type=\"text\"\n value={draft}\n disabled={busy}\n placeholder={placeholder}\n onChange={(e) => {\n setDraft(e.target.value);\n if (error) setError(null);\n }}\n onBlur={commit}\n onClick={(e) => e.stopPropagation()}\n onDoubleClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => {\n // Contain editing keystrokes so host rows / global hotkeys stay quiet.\n if (e.key === \"Enter\") {\n e.preventDefault();\n e.stopPropagation();\n commit();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n cancel();\n } else if (e.key === \" \") {\n e.stopPropagation();\n }\n }}\n maxLength={maxLength}\n aria-label={ariaLabel}\n aria-invalid={error ? true : undefined}\n // 16px on mobile prevents iOS focus-zoom; sm on desktop.\n className={cn(\n \"w-full min-w-0 rounded-sm bg-transparent px-1 outline-none\",\n \"text-base md:text-sm\",\n \"focus:bg-background focus:ring-1 focus:ring-ring\",\n busy && \"opacity-60\",\n inputClassName,\n )}\n />\n {busy && (\n <Loader2Icon className=\"absolute right-1 h-3.5 w-3.5 animate-spin text-muted-foreground\" />\n )}\n {error && (\n <span className=\"absolute left-0 top-full mt-0.5 whitespace-nowrap text-xs text-destructive\">\n {error}\n </span>\n )}\n </span>\n );\n }\n\n // Controlled mode: host owns the display; render nothing while idle.\n if (controlled) return null;\n\n return (\n <button\n type=\"button\"\n onClick={\n activation === \"click\"\n ? (e) => {\n e.stopPropagation();\n startEdit();\n }\n : undefined\n }\n onDoubleClick={\n activation === \"doubleClick\"\n ? (e) => {\n e.stopPropagation();\n startEdit();\n }\n : undefined\n }\n onKeyDown={(e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n e.stopPropagation();\n startEdit();\n }\n }}\n title={activation === \"doubleClick\" ? \"Double-click to rename\" : \"Click to rename\"}\n aria-label={`Rename ${ariaLabel.toLowerCase()}: ${value}`}\n className={cn(\n \"min-w-0 max-w-full rounded-sm px-1 text-left transition-colors\",\n \"hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\",\n truncate && \"block truncate\",\n className,\n displayClassName,\n )}\n >\n {value || placeholder || \"\"}\n </button>\n );\n}\n","\"use client\";\n\n/**\n * Input family — ported verbatim from matrx-frontend `components/ui/input.tsx`.\n *\n * Seam inversions:\n * - `MatrxVariant` (host `components/ui/types`) becomes the structural\n * `InputVariant` union with the identical members, so host call sites are\n * drop-in compatible.\n * - The host file's `CopyInput` / `FancyInput` / `DeleteInput` are\n * deliberately NOT absorbed (C8 split-out law): they carry a `motion/react`\n * dependency (and clipboard behavior) that plain-Input consumers must not\n * pay for. They stay host-owned until sanctioned separately.\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport type InputVariant =\n | \"default\"\n | \"destructive\"\n | \"success\"\n | \"outline\"\n | \"secondary\"\n | \"ghost\"\n | \"link\"\n | \"primary\";\n\nexport interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {\n variant?: InputVariant;\n}\n\nconst getVariantStyles = (variant: InputVariant = \"default\") => {\n const baseStyles = `flex h-10 w-full border border-border bg-background text-foreground shadow-input rounded-md px-3 py-2 text-sm file:border-0 file:bg-transparent\n file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground\n focus-visible:outline-none focus-visible:ring-[2px] focus-visible:ring-ring\n disabled:cursor-not-allowed disabled:opacity-50\n dark:shadow-none\n transition duration-400\n [&:-webkit-autofill]:bg-background [&:-webkit-autofill]:shadow-[0_0_0_1000px_hsl(var(--background))_inset] [&:-webkit-autofill]:[caret-color:currentColor]\n dark:[&:-webkit-autofill]:shadow-[0_0_0_1000px_hsl(var(--background))_inset] dark:[&:-webkit-autofill]:[-webkit-text-fill-color:hsl(var(--foreground))]\n [&:-webkit-autofill:hover]:shadow-[0_0_0_1000px_hsl(var(--background))_inset] [&:-webkit-autofill:focus]:shadow-[0_0_0_1000px_hsl(var(--background))_inset]`;\n\n switch (variant) {\n case \"destructive\":\n return `${baseStyles} bg-destructive text-destructive-foreground`;\n case \"outline\":\n return `${baseStyles} border-2`;\n case \"secondary\":\n return `${baseStyles} bg-secondary text-secondary-foreground`;\n case \"ghost\":\n return `${baseStyles} bg-transparent shadow-none`;\n case \"link\":\n return `${baseStyles} bg-transparent underline-offset-4 hover:underline`;\n case \"primary\":\n return `${baseStyles} bg-primary text-primary-foreground`;\n default:\n return baseStyles;\n }\n};\n\nexport const Input = React.forwardRef<HTMLInputElement, InputProps>(\n ({ className, type, variant = \"default\", ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(getVariantStyles(variant), className)}\n ref={ref}\n {...props}\n />\n );\n },\n);\nInput.displayName = \"Input\";\n\nexport interface EnterInputProps extends InputProps {\n onEnter?: () => void;\n}\n\nexport const EnterInput = React.forwardRef<HTMLInputElement, EnterInputProps>(\n ({ onEnter, ...props }, ref) => {\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\" && onEnter) {\n e.preventDefault();\n onEnter();\n }\n };\n\n return (\n <Input\n {...props}\n ref={ref}\n onKeyDown={(e) => {\n handleKeyDown(e);\n if (props.onKeyDown) {\n props.onKeyDown(e);\n }\n }}\n />\n );\n },\n);\n\nEnterInput.displayName = \"EnterInput\";\n\nexport const BasicInput = React.forwardRef<HTMLInputElement, InputProps>(\n // `variant` is accepted (prop-compatible with Input) but intentionally\n // unused — and destructured so it never leaks onto the DOM element.\n ({ className, type, variant: _variant = \"default\", ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n \"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n ref={ref}\n {...props}\n />\n );\n },\n);\nBasicInput.displayName = \"BasicInput\";\n\nexport interface InputWithPrefixProps extends Omit<InputProps, \"prefix\"> {\n prefix?: React.ReactNode;\n wrapperClassName?: string;\n}\n\nexport const InputWithPrefix = React.forwardRef<\n HTMLInputElement,\n InputWithPrefixProps\n>(({ prefix, className, wrapperClassName, ...props }, ref) => {\n return (\n <div className={cn(\"relative\", wrapperClassName)}>\n {prefix && (\n <div className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\">\n {prefix}\n </div>\n )}\n <Input\n ref={ref}\n className={cn(prefix && \"pl-10\", className)}\n {...props}\n />\n </div>\n );\n});\nInputWithPrefix.displayName = \"InputWithPrefix\";\n","\"use client\";\n\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport const Label = React.forwardRef<\n React.ComponentRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <LabelPrimitive.Root\n ref={ref}\n className={cn(\n \"text-sm font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n className,\n )}\n {...props}\n />\n));\nLabel.displayName = LabelPrimitive.Root.displayName;\n","\"use client\";\n\n/**\n * OverflowToolbar — a horizontal row of consistent, compact action buttons\n * that collapses the buttons that don't fit into a single \"more\" (…) menu.\n * Ported verbatim from matrx-frontend\n * `components/official/toolbar/OverflowToolbar.tsx` (S20).\n *\n * ┌───────────────────────────────────────────────┐\n * │ [leading] [Btn] [Btn] [Btn] [ … ] │\n * └───────────────────────────────────────────────┘\n *\n * Design rules (the primitive enforces them so callers can't drift):\n * - Every button is the same height (h-7), padding, text size, icon size.\n * - `hideLabel` renders an icon-only button with a tooltip — use it for\n * \"obvious\" actions (Find, Source, …).\n * - `tone: \"primary\"` colors a button without changing its size, so the\n * primary action is NOT visually larger than the rest.\n * - When the row is too narrow, the LAST actions collapse into the overflow\n * menu first. Order your actions most-important-first.\n *\n * Measurement is done with a hidden \"ghost\" row (always renders every action\n * + the kebab) read via a ResizeObserver, so the visible row never reflows\n * mid-frame.\n *\n * Seam inversions (host-shaped chrome becomes injected):\n * - `icon: LucideIcon` → the structural `ToolbarIcon`\n * (`ComponentType<{ className?: string }>`) — any SVG component fits.\n * - The host Tooltip wrapper → `renderTooltip` prop. Without it, icon-only\n * buttons render bare (they always carry `aria-label`); hosts inject their\n * tooltip system for the original hover behavior.\n * - The host ItemMenu overflow menu → `renderOverflowMenu` prop (required):\n * the host receives the collapsed actions plus the ready-made kebab trigger\n * and renders them with its own menu system.\n */\n\nimport React, { useLayoutEffect, useMemo, useRef, useState } from \"react\";\n\nimport { cn } from \"./cn\";\nimport { Loader2Icon, MoreHorizontalIcon } from \"./icons\";\n\nexport type ToolbarActionTone = \"default\" | \"primary\" | \"destructive\";\n\n/** Structural icon contract (a lucide icon satisfies it, so does any SVG component). */\nexport type ToolbarIcon = React.ComponentType<{ className?: string }>;\n\nexport interface ToolbarAction {\n id: string;\n label: string;\n icon: ToolbarIcon;\n /** Click handler. Ignored when `href` is set. */\n onSelect?: () => void;\n /** Renders an anchor instead of a button. */\n href?: string;\n target?: \"_blank\";\n disabled?: boolean;\n /** Swaps the icon for a spinner and (optionally) shows `runningLabel`. */\n running?: boolean;\n runningLabel?: string;\n tone?: ToolbarActionTone;\n /** Icon-only button (tooltip carries the label). For obvious actions. */\n hideLabel?: boolean;\n /** Drop the action entirely. */\n hidden?: boolean;\n}\n\nexport interface OverflowToolbarProps {\n actions: ToolbarAction[];\n /**\n * Optional element pinned at the start of the row — never collapsed, never\n * measured into the action budget except as a fixed prefix (e.g. a surface\n * switcher / context chip cluster).\n */\n leading?: React.ReactNode;\n /** Accessible label for the overflow trigger. */\n overflowAriaLabel?: string;\n className?: string;\n /**\n * Injected overflow-menu seam: render the collapsed actions with the host's\n * menu system, using `trigger` (the ready-made kebab button) as the menu\n * trigger element.\n */\n renderOverflowMenu: (args: {\n actions: ToolbarAction[];\n trigger: React.ReactNode;\n }) => React.ReactNode;\n /**\n * Injected tooltip seam for icon-only buttons (their label lives nowhere\n * else on screen). Omitted → the bare control renders (aria-label intact).\n */\n renderTooltip?: (control: React.ReactElement, label: string) => React.ReactNode;\n}\n\nconst GAP_PX = 6; // gap-1.5\n\n// ── Button ──────────────────────────────────────────────────────────────────\n\nconst TONE: Record<ToolbarActionTone, string> = {\n default: \"border border-border bg-background hover:bg-accent text-foreground\",\n primary: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive:\n \"border border-destructive/40 text-destructive hover:bg-destructive/10\",\n};\n\nfunction ToolbarButton({\n action,\n enableTooltip = false,\n renderTooltip,\n}: {\n action: ToolbarAction;\n /** Wrap icon-only buttons in a styled tooltip. Off for the ghost row. */\n enableTooltip?: boolean;\n renderTooltip?:\n | ((control: React.ReactElement, label: string) => React.ReactNode)\n | undefined;\n}) {\n const tone = action.tone ?? \"default\";\n const Icon = action.running ? Loader2Icon : action.icon;\n const showLabel =\n !action.hideLabel || (action.running && action.runningLabel);\n const text =\n action.running && action.runningLabel ? action.runningLabel : action.label;\n\n const className = cn(\n \"inline-flex items-center gap-1 h-7 rounded-md text-[11px] font-medium transition-colors whitespace-nowrap\",\n \"disabled:opacity-50 disabled:pointer-events-none\",\n action.hideLabel && !action.running ? \"w-7 justify-center px-0\" : \"px-2\",\n TONE[tone],\n );\n\n const inner = (\n <>\n <Icon\n className={cn(\"w-3.5 h-3.5 shrink-0\", action.running && \"animate-spin\")}\n />\n {showLabel && <span>{text}</span>}\n </>\n );\n\n const control =\n action.href && !action.disabled ? (\n <a\n href={action.href}\n target={action.target}\n rel={action.target === \"_blank\" ? \"noopener noreferrer\" : undefined}\n className={className}\n aria-label={action.label}\n >\n {inner}\n </a>\n ) : (\n <button\n type=\"button\"\n onClick={action.onSelect}\n disabled={action.disabled}\n className={className}\n aria-label={action.label}\n >\n {inner}\n </button>\n );\n\n // Icon-only buttons need a styled tooltip to be discoverable — the label\n // lives nowhere else on screen. Labeled buttons are self-describing.\n if (enableTooltip && action.hideLabel && renderTooltip) {\n return <>{renderTooltip(control, action.label)}</>;\n }\n\n return control;\n}\n\nfunction OverflowTrigger({ ariaLabel }: { ariaLabel: string }) {\n return (\n <button\n type=\"button\"\n aria-label={ariaLabel}\n aria-haspopup=\"menu\"\n title=\"More actions\"\n className={cn(\n \"inline-flex items-center justify-center h-7 w-7 rounded-md transition-colors\",\n \"border border-border bg-background hover:bg-accent text-foreground\",\n )}\n >\n <MoreHorizontalIcon className=\"w-3.5 h-3.5\" />\n </button>\n );\n}\n\n// ── Toolbar ───────────────────────────────────────────────────────────────\n\nexport function OverflowToolbar({\n actions,\n leading,\n overflowAriaLabel = \"More actions\",\n className,\n renderOverflowMenu,\n renderTooltip,\n}: OverflowToolbarProps) {\n const visibleActions = useMemo(\n () => actions.filter((a) => !a.hidden),\n [actions],\n );\n\n const containerRef = useRef<HTMLDivElement>(null);\n const ghostRef = useRef<HTMLDivElement>(null);\n // The leading slot renders ONCE (in the visible row) — it may host a\n // stateful/data-fetching component, so we never duplicate it into the ghost.\n // Its width is read directly off this ref instead.\n const leadingRef = useRef<HTMLSpanElement>(null);\n const [visibleCount, setVisibleCount] = useState(visibleActions.length);\n\n // Re-measure whenever the rendered text/state of any action changes (label,\n // icon-only mode, or running label all change a button's width).\n const signature = visibleActions\n .map(\n (a) =>\n `${a.id}:${a.hideLabel ? 1 : 0}:${a.running ? 1 : 0}:${a.runningLabel ?? \"\"}:${a.label}`,\n )\n .join(\"|\");\n\n useLayoutEffect(() => {\n const container = containerRef.current;\n const ghost = ghostRef.current;\n if (!container || !ghost) return undefined;\n\n const compute = () => {\n const available = container.clientWidth;\n const n = visibleActions.length;\n const children = Array.from(ghost.children) as HTMLElement[];\n const hasLeading = leading != null;\n const leadingW = hasLeading ? (leadingRef.current?.offsetWidth ?? 0) : 0;\n const itemW = (i: number) => children[i]?.offsetWidth ?? 0;\n const kebabW = children[n]?.offsetWidth ?? 28;\n\n // Width consumed by the always-present leading slot.\n const base = leadingW + (hasLeading && n > 0 ? GAP_PX : 0);\n\n // Does everything fit with no kebab?\n let totalAll = base;\n for (let i = 0; i < n; i++) totalAll += itemW(i) + (i > 0 ? GAP_PX : 0);\n if (totalAll <= available) {\n setVisibleCount(n);\n return;\n }\n\n // Otherwise fit as many as possible while reserving room for the kebab.\n let used = base;\n let count = 0;\n for (let i = 0; i < n; i++) {\n const add = itemW(i) + (count > 0 ? GAP_PX : 0);\n if (used + add + GAP_PX + kebabW <= available) {\n used += add;\n count += 1;\n } else break;\n }\n setVisibleCount(count);\n };\n\n compute();\n const ro = new ResizeObserver(compute);\n ro.observe(container);\n return () => ro.disconnect();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [signature, leading != null]);\n\n const shown = visibleActions.slice(0, visibleCount);\n const hidden = visibleActions.slice(visibleCount);\n\n return (\n <div ref={containerRef} className={cn(\"relative min-w-0\", className)}>\n {/* Ghost measuring row — every action button + kebab, never visible.\n The leading slot is intentionally NOT duplicated here (it may be a\n stateful/fetching component); its width is read off `leadingRef`. */}\n <div\n ref={ghostRef}\n aria-hidden\n className=\"pointer-events-none absolute left-0 top-0 flex items-center gap-1.5 opacity-0\"\n >\n {visibleActions.map((a) => (\n <ToolbarButton key={a.id} action={a} />\n ))}\n <OverflowTrigger ariaLabel={overflowAriaLabel} />\n </div>\n\n {/* Visible row — right-aligned cluster that collapses overflow. */}\n <div className=\"flex items-center justify-end gap-1.5\">\n {leading != null && (\n <span ref={leadingRef} className=\"shrink-0\">\n {leading}\n </span>\n )}\n {shown.map((a) => (\n <ToolbarButton\n key={a.id}\n action={a}\n enableTooltip\n renderTooltip={renderTooltip}\n />\n ))}\n {hidden.length > 0 &&\n renderOverflowMenu({\n actions: hidden,\n trigger: <OverflowTrigger ariaLabel={overflowAriaLabel} />,\n })}\n </div>\n </div>\n );\n}\n","\"use client\";\n\n/**\n * Progress — a determinate bar.\n *\n * THE INDETERMINATE CASE IS NOT SILENT. Radix treats `value={null}` (or an\n * omitted value) as indeterminate, and the shadcn fork every host copied\n * computed `translateX(-${100 - (value || 0)}%)`, which turns an unknown value\n * into a confident, wrong \"0%\" — a bar that says the work has not started when\n * the truth is that nobody knows. Here an indeterminate bar renders a moving\n * sweep and carries `data-state=\"indeterminate\"`, so it LOOKS different from\n * stalled-at-zero.\n *\n * `tone` maps the fill onto the semantic status tokens, rather than leaving a\n * host to reach for a raw palette utility on a failing bar.\n */\n\nimport * as ProgressPrimitive from \"@radix-ui/react-progress\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport type ProgressTone = \"default\" | \"success\" | \"warning\" | \"destructive\";\n\nconst PROGRESS_TONES: Record<ProgressTone, string> = {\n default: \"bg-primary\",\n success: \"bg-success\",\n warning: \"bg-warning\",\n destructive: \"bg-destructive\",\n};\n\nexport interface ProgressProps\n extends React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root> {\n /** Fill colour, from the semantic status tokens. Default `default`. */\n tone?: ProgressTone;\n /** Classes for the moving fill. */\n indicatorClassName?: string;\n}\n\nconst Progress = React.forwardRef<\n React.ComponentRef<typeof ProgressPrimitive.Root>,\n ProgressProps\n>(({ className, tone = \"default\", indicatorClassName, ...props }, ref) => {\n const { value, max } = props;\n const ceiling = max ?? 100;\n const isIndeterminate = value === null || value === undefined;\n const pct = isIndeterminate\n ? 0\n : Math.min(100, Math.max(0, (value / ceiling) * 100));\n\n return (\n <ProgressPrimitive.Root\n ref={ref}\n data-slot=\"progress\"\n className={cn(\n \"relative h-2 w-full overflow-hidden rounded-full bg-primary/20\",\n className,\n )}\n {...props}\n >\n <ProgressPrimitive.Indicator\n data-slot=\"progress-indicator\"\n className={cn(\n \"h-full w-full flex-1 transition-all\",\n PROGRESS_TONES[tone],\n isIndeterminate && \"matrx-progress-indeterminate\",\n indicatorClassName,\n )}\n style={\n isIndeterminate ? undefined : { transform: `translateX(-${100 - pct}%)` }\n }\n />\n </ProgressPrimitive.Root>\n );\n});\nProgress.displayName = ProgressPrimitive.Root.displayName;\n\nexport { Progress };\n","\"use client\";\n\n/**\n * ScrollArea — Radix scroll area with a custom, token-coloured scrollbar.\n *\n * Every fork was the same component; what they could not share was the\n * VIEWPORT. Radix renders an internal `display: table` div inside the\n * viewport, and workflow-studio's fork had to reach through it\n * (`[&>div]:!block [&>div]:min-w-0`) so long content wraps instead of forcing\n * the table cell wider than its container. That is the exact reason a host\n * forks: a class it cannot pass. So the viewport is addressable here —\n * `viewportClassName` and `viewportRef` — and nobody needs a copy to style it.\n *\n * `viewportRef` also unlocks the thing hosts hand-rolled around this\n * component: programmatic scrolling (scroll-to-bottom on a new message,\n * restoring a position) needs the scrolling element, and the Root's ref is not\n * it.\n *\n * The thumb reads `bg-border`; a host that wants workflow-studio's dimmer\n * thumb passes `scrollBarClassName`.\n */\n\nimport * as ScrollAreaPrimitive from \"@radix-ui/react-scroll-area\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport interface ScrollAreaProps\n extends React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> {\n /** Classes for the scrolling viewport (not the Root). */\n viewportClassName?: string;\n /** Ref to the scrolling element — the one `scrollTop` lives on. */\n viewportRef?: React.Ref<HTMLDivElement>;\n /** Classes for the vertical scrollbar this component renders. */\n scrollBarClassName?: string;\n /** Scrollbar orientation to render. Default `vertical`. */\n orientation?: \"vertical\" | \"horizontal\";\n}\n\nconst ScrollArea = React.forwardRef<\n React.ComponentRef<typeof ScrollAreaPrimitive.Root>,\n ScrollAreaProps\n>(\n (\n {\n className,\n children,\n viewportClassName,\n viewportRef,\n scrollBarClassName,\n orientation = \"vertical\",\n ...props\n },\n ref,\n ) => (\n <ScrollAreaPrimitive.Root\n ref={ref}\n data-slot=\"scroll-area\"\n className={cn(\"relative overflow-hidden\", className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport\n ref={viewportRef}\n data-slot=\"scroll-area-viewport\"\n className={cn(\"h-full w-full rounded-[inherit]\", viewportClassName)}\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n <ScrollBar orientation={orientation} className={scrollBarClassName} />\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n ),\n);\nScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;\n\nconst ScrollBar = React.forwardRef<\n React.ComponentRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,\n React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>\n>(({ className, orientation = \"vertical\", ...props }, ref) => (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n ref={ref}\n data-slot=\"scroll-area-scrollbar\"\n orientation={orientation}\n className={cn(\n \"flex touch-none select-none transition-colors\",\n orientation === \"vertical\" &&\n \"h-full w-2.5 border-l border-l-transparent p-[1px]\",\n orientation === \"horizontal\" &&\n \"h-2.5 flex-col border-t border-t-transparent p-[1px]\",\n className,\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb\n data-slot=\"scroll-area-thumb\"\n className=\"relative flex-1 rounded-full bg-border\"\n />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n));\nScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;\n\nexport { ScrollArea, ScrollBar };\n","\"use client\";\n\n/**\n * ScoreRing — SVG progress ring + the shared score→color threshold semantics.\n * Ported verbatim from matrx-frontend `components/official/ScoreRing.tsx`\n * (S18). The thresholds ARE the product: green at/above `good`, orange\n * at/above `warning`, red below, muted for null. No seams.\n */\n\nimport { cn } from \"./cn\";\n\nexport interface ScoreThresholds {\n /** Scores at or above this value are green. */\n good: number;\n /** Scores at or above this value (but below good) are orange. */\n warning: number;\n}\n\nexport const DEFAULT_SCORE_THRESHOLDS: ScoreThresholds = {\n good: 75,\n warning: 50,\n};\n\n/** Semantic score color shared by ring and accent consumers. */\nexport function scoreRingColorClasses(\n pct: number | null,\n thresholds: ScoreThresholds = DEFAULT_SCORE_THRESHOLDS,\n): string {\n if (pct === null) return \"text-muted-foreground\";\n if (pct >= thresholds.good) return \"text-success\";\n if (pct >= thresholds.warning) return \"text-warning\";\n return \"text-destructive\";\n}\n\n/** Solid-background twin of `scoreRingColorClasses`. */\nexport function scoreAccentBgClasses(\n pct: number | null,\n thresholds: ScoreThresholds = DEFAULT_SCORE_THRESHOLDS,\n): string {\n if (pct === null) return \"bg-muted-foreground/30\";\n if (pct >= thresholds.good) return \"bg-success\";\n if (pct >= thresholds.warning) return \"bg-warning\";\n return \"bg-destructive\";\n}\n\nexport interface ScoreRingProps {\n pct: number | null;\n size?: number;\n strokeWidth?: number;\n label?: string;\n valueClassName?: string;\n className?: string;\n thresholds?: ScoreThresholds;\n /** Visible suffix; study keeps `%`, while Lighthouse convention omits it. */\n suffix?: string;\n}\n\n/**\n * Shared SVG score ring. `pct` is 0–100; threshold semantics are supplied by\n * the domain (for example Lighthouse uses 90/50 while study uses 75/50).\n */\nexport function ScoreRing({\n pct,\n size = 112,\n strokeWidth = 8,\n label,\n valueClassName,\n className,\n thresholds = DEFAULT_SCORE_THRESHOLDS,\n suffix = \"%\",\n}: ScoreRingProps) {\n const radius = 50 - strokeWidth / 2;\n const circumference = 2 * Math.PI * radius;\n const boundedPct = pct === null ? 0 : Math.max(0, Math.min(100, pct));\n const dashOffset = circumference * (1 - boundedPct / 100);\n\n return (\n <div\n className={cn(\n \"relative flex shrink-0 items-center justify-center\",\n className,\n )}\n style={{ width: size, height: size }}\n role=\"img\"\n aria-label={`${label ?? \"Score\"}: ${pct === null ? \"not available\" : `${pct} out of 100`}`}\n >\n <svg viewBox=\"0 0 100 100\" className=\"h-full w-full -rotate-90\">\n <circle\n cx=\"50\"\n cy=\"50\"\n r={radius}\n className=\"stroke-muted\"\n strokeWidth={strokeWidth}\n fill=\"none\"\n />\n {pct !== null ? (\n <circle\n cx=\"50\"\n cy=\"50\"\n r={radius}\n className={cn(\n \"transition-[stroke-dashoffset] duration-700 ease-out\",\n scoreRingColorClasses(pct, thresholds),\n )}\n stroke=\"currentColor\"\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n fill=\"none\"\n strokeDasharray={circumference}\n strokeDashoffset={dashOffset}\n />\n ) : null}\n </svg>\n <div className=\"absolute flex flex-col items-center justify-center\">\n <span\n className={cn(\n \"font-bold tabular-nums text-foreground\",\n valueClassName ?? \"text-2xl\",\n )}\n >\n {pct === null ? \"—\" : `${pct}${suffix}`}\n </span>\n {label ? (\n <span className=\"max-w-[74px] truncate text-[9px] font-semibold uppercase tracking-wide text-muted-foreground\">\n {label}\n </span>\n ) : null}\n </div>\n </div>\n );\n}\n","\"use client\";\n\n/**\n * SegmentedControl — sized accessible segmented toggle.\n * Ported verbatim from matrx-frontend `components/ui/segmented-control.tsx`\n * (S17). No seams: pure markup over host semantic tokens. The option/prop\n * interfaces are exported here (the original kept them file-local).\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport interface SegmentOption {\n value: string;\n label: React.ReactNode;\n disabled?: boolean;\n}\n\nexport interface SegmentedControlProps {\n value: string;\n onValueChange: (value: string) => void;\n data: SegmentOption[];\n name?: string;\n className?: string;\n fullWidth?: boolean;\n size?: \"sm\" | \"md\" | \"lg\";\n}\n\nexport function SegmentedControl({\n value,\n onValueChange,\n data,\n name: _name,\n className,\n fullWidth = false,\n size = \"md\",\n}: SegmentedControlProps) {\n // Handle size classes\n const sizeClasses = {\n sm: \"h-7 text-xs\",\n md: \"h-9 text-sm\",\n lg: \"h-10 text-base\",\n };\n\n return (\n <div\n className={cn(\n \"inline-flex p-0.5 bg-muted rounded-md\",\n fullWidth && \"w-full\",\n className\n )}\n role=\"tablist\"\n >\n {data.map((option) => {\n const isActive = value === option.value;\n return (\n <button\n key={option.value}\n type=\"button\"\n role=\"tab\"\n aria-selected={isActive}\n disabled={option.disabled}\n onClick={() => onValueChange(option.value)}\n className={cn(\n \"relative flex items-center justify-center rounded-[0.2rem] px-3 py-1.5 transition-all\",\n sizeClasses[size],\n fullWidth && \"flex-1\",\n isActive\n ? \"bg-background text-foreground shadow-sm\"\n : \"text-muted-foreground hover:text-foreground hover:bg-background/50\",\n option.disabled && \"opacity-50 cursor-not-allowed\"\n )}\n >\n {option.label}\n </button>\n );\n })}\n </div>\n );\n}\n","\"use client\";\n\n/**\n * Select — ported verbatim from matrx-frontend `components/ui/select.tsx`.\n *\n * Seam inversions:\n * - The host's `useNestedPortalContainer` (dialog/popout aware) becomes the\n * injected `PortalContainerProvider` seam (`portal-container.tsx`); the\n * explicit `container` prop keeps top priority, exactly as before.\n * - `ChevronDownIcon` / `ChevronUpIcon` / `CheckIcon` come from the package's\n * inlined SVGs (C19), not @radix-ui/react-icons — same glyphs, same\n * viewBoxes. (The origin also imported `CaretSortIcon` without ever using\n * it; the dead import is not carried along.)\n *\n * THE ROOT RENDERS UNCONDITIONALLY — no mount gate. This wrapper used to defer\n * rendering until after hydration (\"Radix generates dynamic aria-controls ids\n * that differ between SSR and client\"), and that justification was false:\n * Radix ids come from React's SSR-stable `useId` (verified against\n * @radix-ui/react-select 2.3.1 / react-id 1.1.2). The gate was actively\n * harmful — it deleted the ALWAYS-VISIBLE select trigger (a form control)\n * from SSR and the first client paint.\n */\n\nimport * as SelectPrimitive from \"@radix-ui/react-select\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport {\n CheckIcon,\n RadixChevronDownIcon,\n RadixChevronUpIcon,\n} from \"./icons\";\nimport { usePortalContainer } from \"./portal-container\";\n\nexport const Select = SelectPrimitive.Root;\n\nexport const SelectGroup = SelectPrimitive.Group;\n\nexport const SelectValue = SelectPrimitive.Value;\n\nexport const selectTriggerVariants = cva(\n \"flex w-full items-center justify-between whitespace-nowrap rounded-md border border-border bg-card text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground transition-colors hover:bg-accent hover:border-accent-foreground/20 focus:outline-none focus:ring-1 focus:ring-primary/30 focus:border-primary/40 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1\",\n {\n variants: {\n size: {\n sm: \"h-7 px-2 py-1 text-xs\",\n default: \"h-9 px-3 py-1\",\n lg: \"h-10 px-3 py-2\",\n },\n },\n defaultVariants: {\n size: \"default\",\n },\n },\n);\n\nexport interface SelectTriggerProps\n extends\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>,\n VariantProps<typeof selectTriggerVariants> {\n hideArrow?: boolean;\n}\n\nexport const SelectTrigger = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Trigger>,\n SelectTriggerProps\n>(({ className, children, hideArrow = false, size, ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(selectTriggerVariants({ size, className }))}\n {...props}\n >\n {children}\n {!hideArrow && (\n <SelectPrimitive.Icon asChild>\n <RadixChevronDownIcon className=\"h-4 w-4 opacity-50\" />\n </SelectPrimitive.Icon>\n )}\n </SelectPrimitive.Trigger>\n));\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;\n\nexport const SelectScrollUpButton = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.ScrollUpButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollUpButton\n ref={ref}\n className={cn(\n \"flex cursor-default items-center justify-center py-1\",\n className,\n )}\n {...props}\n >\n <RadixChevronUpIcon />\n </SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;\n\nexport const SelectScrollDownButton = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.ScrollDownButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollDownButton\n ref={ref}\n className={cn(\n \"flex cursor-default items-center justify-center py-1\",\n className,\n )}\n {...props}\n >\n <RadixChevronDownIcon />\n </SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName =\n SelectPrimitive.ScrollDownButton.displayName;\n\nexport const SelectContent = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> & {\n container?: HTMLElement | null;\n }\n>(({ className, children, position = \"popper\", container, ...props }, ref) => {\n const portalContainer = usePortalContainer(container);\n return (\n <SelectPrimitive.Portal container={portalContainer}>\n <SelectPrimitive.Content\n ref={ref}\n className={cn(\n \"relative z-[10001] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n position === \"popper\" &&\n \"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\",\n className,\n )}\n position={position}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n \"p-0.5 overflow-y-auto\",\n position === \"popper\" &&\n \"w-full min-w-[var(--radix-select-trigger-width)] max-h-[var(--radix-select-content-available-height)]\",\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n );\n});\nSelectContent.displayName = SelectPrimitive.Content.displayName;\n\nexport const SelectLabel = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn(\"px-2 py-1.5 text-sm font-semibold\", className)}\n {...props}\n />\n));\nSelectLabel.displayName = SelectPrimitive.Label.displayName;\n\nexport const SelectItem = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item> & {\n /**\n * Secondary line shown under the label IN THE LIST ONLY. Rendered outside\n * Radix `ItemText` on purpose: everything inside `ItemText` is what the\n * closed trigger displays, so a description passed as `children` gets\n * squeezed into the fixed-height trigger and clipped. This prop keeps the\n * trigger to the one-line label while the open list shows both lines.\n */\n description?: React.ReactNode;\n }\n>(({ className, children, description, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex w-full cursor-default select-none rounded-sm py-1 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n description ? \"flex-col items-start gap-0.5 py-1.5\" : \"items-center\",\n className,\n )}\n {...props}\n >\n <span className=\"absolute right-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <CheckIcon className=\"h-4 w-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n {description ? (\n <span className=\"block text-xs leading-snug text-muted-foreground\">\n {description}\n </span>\n ) : null}\n </SelectPrimitive.Item>\n));\nSelectItem.displayName = SelectPrimitive.Item.displayName;\n\nexport const SelectSeparator = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n));\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName;\n","\"use client\";\n\nimport * as SeparatorPrimitive from \"@radix-ui/react-separator\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport const Separator = React.forwardRef<\n React.ComponentRef<typeof SeparatorPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\n>(({ className, orientation = \"horizontal\", decorative = true, ...props }, ref) => (\n <SeparatorPrimitive.Root\n ref={ref}\n decorative={decorative}\n orientation={orientation}\n className={cn(\n \"shrink-0 bg-border\",\n orientation === \"horizontal\" ? \"h-px w-full\" : \"h-full w-px\",\n className,\n )}\n {...props}\n />\n));\nSeparator.displayName = SeparatorPrimitive.Root.displayName;\n","\"use client\";\n\n/**\n * Sheet — ported verbatim from matrx-frontend `components/ui/sheet.tsx`.\n *\n * Seam inversions:\n * - The host's `DialogContentPrimitive` (from its dialog module) is inlined\n * here as a private wrapper with identical behavior: unstyled non-portalling\n * Radix Content that derives `aria-modal` from the owning Root's modality.\n * - `Cross2Icon` comes from the package's inlined SVGs (C19), not\n * @radix-ui/react-icons.\n * - `treeContainsComponent` stays the ONE kit implementation\n * (@ai-matrx/kit/react-tree) — never a vendored twin.\n *\n * THE ROOT RENDERS UNCONDITIONALLY — no mount gate. This wrapper used to defer\n * rendering until after hydration (\"Radix generates dynamic aria-controls ids\n * that differ between SSR and client\"), and that justification was false:\n * Radix ids come from React's SSR-stable `useId` (verified against\n * @radix-ui/react-dialog 1.1.17 / react-id 1.1.2). The gate was actively\n * harmful — the Trigger wraps ALWAYS-VISIBLE content, so `return null`\n * deleted it from SSR and the first client paint.\n * The RadixDialogModalProvider wrapper stays — it is unrelated to hydration.\n */\n\nimport * as SheetPrimitive from \"@radix-ui/react-dialog\";\nimport { treeContainsComponent } from \"@ai-matrx/kit/react-tree\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { Cross2Icon } from \"./icons\";\nimport {\n RadixDialogModalProvider,\n useRadixDialogModal,\n} from \"./radix-dialog-modal-context\";\n\n/**\n * Unstyled, non-portalling Content for Sheet layouts. It preserves Radix\n * focus/background behavior and derives `aria-modal` from the owning Root\n * (identical to the host dialog module's DialogContentPrimitive).\n */\nconst SheetContentBase = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>\n>(({ ...props }, ref) => {\n const isModal = useRadixDialogModal();\n return (\n <SheetPrimitive.Content\n {...props}\n ref={ref}\n aria-modal={isModal || undefined}\n />\n );\n});\nSheetContentBase.displayName = \"SheetContentBase\";\n\nexport const Sheet = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Root>\n>(({ children, ...props }, _ref) => {\n const modal = props.modal ?? true;\n\n return (\n <RadixDialogModalProvider modal={modal}>\n <SheetPrimitive.Root {...props} modal={modal}>\n {children}\n </SheetPrimitive.Root>\n </RadixDialogModalProvider>\n );\n});\nSheet.displayName = \"Sheet\";\n\nexport const SheetTrigger = SheetPrimitive.Trigger;\n\nexport const SheetClose = SheetPrimitive.Close;\n\nexport const SheetPortal = SheetPrimitive.Portal;\n\nexport const SheetOverlay = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <SheetPrimitive.Overlay\n className={cn(\n \"fixed inset-0 z-50 bg-[var(--matrx-overlay-scrim)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n className,\n )}\n {...props}\n ref={ref}\n />\n));\nSheetOverlay.displayName = SheetPrimitive.Overlay.displayName;\n\nexport const sheetVariants = cva(\n \"fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out\",\n {\n variants: {\n side: {\n top: \"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top\",\n bottom:\n \"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom\",\n left: \"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm\",\n right:\n \"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm\",\n center:\n \"inset-0 m-auto max-h-full max-w-full border rounded-lg data-[state=closed]:fade-out data-[state=open]:fade-in\",\n },\n },\n defaultVariants: {\n side: \"right\",\n },\n },\n);\n\nexport interface SheetContentProps\n extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,\n VariantProps<typeof sheetVariants> {\n hideCloseButton?: boolean;\n /** Skip the dimming overlay — for non-modal side panels (e.g. chat canvas). */\n hideOverlay?: boolean;\n /** Optional className for the overlay when shown. */\n overlayClassName?: string;\n}\n\nexport const SheetDescription = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <SheetPrimitive.Description\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nSheetDescription.displayName = SheetPrimitive.Description.displayName;\n\nexport const SheetContent = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Content>,\n SheetContentProps\n>(\n (\n {\n side = \"right\",\n className,\n children,\n hideCloseButton = false,\n hideOverlay = false,\n overlayClassName,\n ...props\n },\n ref,\n ) => {\n const hasDescription =\n treeContainsComponent(children, SheetDescription) ||\n treeContainsComponent(children, SheetPrimitive.Description);\n return (\n <SheetPortal>\n {!hideOverlay && <SheetOverlay className={overlayClassName} />}\n <SheetContentBase\n ref={ref}\n className={cn(sheetVariants({ side }), className)}\n {...(hasDescription ? {} : { \"aria-describedby\": undefined })}\n {...props}\n >\n {!hideCloseButton && (\n <SheetPrimitive.Close className=\"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary\">\n <Cross2Icon className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </SheetPrimitive.Close>\n )}\n {children}\n </SheetContentBase>\n </SheetPortal>\n );\n },\n);\nSheetContent.displayName = SheetPrimitive.Content.displayName;\n\nexport const SheetHeader = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col space-y-2 text-center sm:text-left\",\n className,\n )}\n {...props}\n />\n);\nSheetHeader.displayName = \"SheetHeader\";\n\nexport const SheetFooter = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n className,\n )}\n {...props}\n />\n);\nSheetFooter.displayName = \"SheetFooter\";\n\nexport const SheetTitle = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <SheetPrimitive.Title\n ref={ref}\n className={cn(\"text-lg font-semibold text-foreground\", className)}\n {...props}\n />\n));\nSheetTitle.displayName = SheetPrimitive.Title.displayName;\n","/**\n * Skeleton — ported verbatim from matrx-frontend `components/ui/skeleton.tsx`.\n * No seams: pure markup over host semantic tokens.\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport function Skeleton({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n className={cn(\"animate-pulse rounded-md bg-primary/10\", className)}\n {...props}\n />\n );\n}\n","\"use client\";\n\n/**\n * Switch — Radix switch, one implementation, two sizes.\n *\n * The four forks were the same control with two different tracks: a 16px track\n * with a visible border and an overhanging thumb (matrx-frontend) and a 20px\n * track with a transparent border and an inset thumb (matrx-extend, dashboard,\n * workflow-studio). Both stay reachable through `size`, so no host has to keep\n * a copy to keep its look:\n *\n * sm → h-4 track, bordered, thumb sits proud of the rail\n * md → h-5 track, transparent border, thumb sits inside (the default)\n *\n * The unchecked track reads `bg-input`, the token that exists for exactly this\n * — workflow-studio's fork used `bg-muted`, which is the surface token and\n * makes an off switch disappear into a muted panel.\n */\n\nimport * as SwitchPrimitives from \"@radix-ui/react-switch\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport type SwitchSize = \"sm\" | \"md\";\n\nconst SWITCH_SIZES: Record<SwitchSize, { root: string; thumb: string }> = {\n sm: {\n root: \"h-4 w-9 border-border data-[state=unchecked]:bg-input\",\n thumb:\n \"h-4 w-4 border border-primary data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0\",\n },\n md: {\n root: \"h-5 w-9 border-transparent data-[state=unchecked]:bg-input\",\n thumb:\n \"h-4 w-4 data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0\",\n },\n};\n\nexport interface SwitchProps\n extends React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> {\n /** Track size. Default `md`. */\n size?: SwitchSize;\n}\n\nconst Switch = React.forwardRef<\n React.ComponentRef<typeof SwitchPrimitives.Root>,\n SwitchProps\n>(({ className, size = \"md\", ...props }, ref) => (\n <SwitchPrimitives.Root\n ref={ref}\n data-slot=\"switch\"\n className={cn(\n \"peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary\",\n SWITCH_SIZES[size].root,\n className,\n )}\n {...props}\n >\n <SwitchPrimitives.Thumb\n data-slot=\"switch-thumb\"\n className={cn(\n \"pointer-events-none block rounded-full bg-background shadow-lg ring-0 transition-transform\",\n SWITCH_SIZES[size].thumb,\n )}\n />\n </SwitchPrimitives.Root>\n));\nSwitch.displayName = SwitchPrimitives.Root.displayName;\n\nexport { Switch };\n","\"use client\";\n\n/**\n * TabbedBottomSheet — iOS Settings–style two-level navigation for tabbed menus.\n * Ported verbatim from matrx-frontend\n * `components/official/bottom-sheet/TabbedBottomSheet.tsx` (S19).\n *\n * Level 1: a scrollable list of tabs (icon + label + chevron).\n * Level 2: drill into one tab's content with a back button in the header.\n *\n * Two invariants make this ONE surface instead of a different panel per tab:\n *\n * 1. **Fixed height** (`size=\"full\"`) — the sheet is the same near-full\n * height on the index and inside every tab, and it never resizes as\n * content loads, filters, or expands. An adaptive height here meant the\n * panel grew and shrank under the user's thumb on every keystroke.\n * 2. **One typography scale** (`matrx-mobile-sheet`, host globals.css) —\n * the tab bodies are the same components the desktop window renders at\n * desktop density (11–12px). That is unreadable and untappable on a\n * phone, so the sheet promotes small text to mobile sizes and every\n * field to the 16px that stops iOS focus-zoom. Panels stay density-free;\n * the host decides the density.\n *\n * Seam inversions: `ChevronRight` is the package's inlined SVG (C19); the\n * `matrx-mobile-sheet` and `pb-safe` utility classes are host-owned CSS.\n */\n\nimport { useState, type ComponentType, type ReactNode } from \"react\";\n\nimport { BottomSheet, BottomSheetBody, BottomSheetHeader } from \"./bottom-sheet\";\nimport { ChevronRightIcon } from \"./icons\";\n\nexport interface TabbedBottomSheetTab {\n id: string;\n label: string;\n icon?: ComponentType<{ className?: string }>;\n /** Optional trailing badge / dot shown on the index row. */\n trailing?: ReactNode;\n content: ReactNode;\n}\n\nexport interface TabbedBottomSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n title: string;\n tabs: TabbedBottomSheetTab[];\n}\n\nexport function TabbedBottomSheet({\n open,\n onOpenChange,\n title,\n tabs,\n}: TabbedBottomSheetProps) {\n const [selectedTabId, setSelectedTabId] = useState<string | null>(null);\n\n // Every open starts on the index. Adjusted during render (the React-docs\n // pattern for state derived from a prop change) rather than in an effect,\n // which would render the previous tab's body for one frame first.\n const [wasOpen, setWasOpen] = useState(open);\n if (open !== wasOpen) {\n setWasOpen(open);\n if (open) setSelectedTabId(null);\n }\n\n const selectedTab = selectedTabId\n ? tabs.find((tab) => tab.id === selectedTabId)\n : null;\n\n return (\n <BottomSheet\n open={open}\n onOpenChange={onOpenChange}\n title={title}\n size=\"full\"\n >\n <div className=\"matrx-mobile-sheet flex min-h-0 flex-1 flex-col\">\n <BottomSheetHeader\n title={selectedTab ? selectedTab.label : title}\n showBack={!!selectedTab}\n onBack={() => setSelectedTabId(null)}\n />\n {selectedTab ? (\n <div className=\"flex min-h-0 flex-1 flex-col overflow-hidden pb-safe\">\n {selectedTab.content}\n </div>\n ) : (\n <BottomSheetBody>\n <ul className=\"divide-y divide-border\">\n {tabs.map((tab) => {\n const Icon = tab.icon;\n return (\n <li key={tab.id}>\n <button\n type=\"button\"\n onClick={() => setSelectedTabId(tab.id)}\n className=\"flex w-full items-center gap-3 px-4 py-3.5 text-left transition-colors hover:bg-muted/60 active:bg-muted\"\n >\n {Icon ? (\n <Icon className=\"h-5 w-5 shrink-0 text-muted-foreground\" />\n ) : null}\n <span className=\"min-w-0 flex-1 text-base text-foreground\">\n {tab.label}\n </span>\n {tab.trailing}\n <ChevronRightIcon className=\"h-5 w-5 shrink-0 text-muted-foreground\" />\n </button>\n </li>\n );\n })}\n </ul>\n </BottomSheetBody>\n )}\n </div>\n </BottomSheet>\n );\n}\n","\"use client\";\n\n/**\n * Table — the semantic table shell. No data logic, no sorting, no virtualiser:\n * those belong to the host's data-table layer, which composes these elements.\n *\n * The two forks disagreed on exactly three things, all of them now props:\n *\n * 1. matrx-frontend wrapped `<table>` in `relative w-full overflow-auto` so a\n * wide table scrolls inside itself instead of pushing the page sideways;\n * dashboard emitted a bare `<table>`. The wrapper is the correct default —\n * a table that widens its page is a layout bug on every narrow viewport —\n * so it stays on, with `wrap={false}` for a host that already owns a\n * scroll container (double scrollers are their own defect).\n * 2. dashboard's header was `sticky top-0 z-10 bg-background`. That is a real\n * capability, not a style opinion, so it is `sticky` on `TableHeader` —\n * opt-in, because a sticky header inside an unbounded page sticks to\n * nothing and only costs a stacking context.\n * 3. Cell density: `p-2` vs `p-3`. Declared once on `<Table size>` and read\n * from context by every cell, so a table cannot mix densities.\n *\n * Colour is tokens only.\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport type TableSize = \"sm\" | \"md\";\n\nconst TABLE_SIZES: Record<TableSize, { head: string; cell: string }> = {\n sm: { head: \"px-2\", cell: \"p-2\" },\n md: { head: \"px-3\", cell: \"p-3\" },\n};\n\nconst TableSizeContext = React.createContext<TableSize>(\"sm\");\n\n/** The density the nearest enclosing `<Table>` declared. `sm` outside one. */\nexport function useTableSize(): TableSize {\n return React.useContext(TableSizeContext);\n}\n\nexport interface TableProps extends React.HTMLAttributes<HTMLTableElement> {\n /** Cell density for this table. Default `sm` (`p-2`). */\n size?: TableSize;\n /**\n * Wrap the table in its own horizontal scroll container. Default `true`.\n * Pass `false` only when an ancestor already scrolls this table.\n */\n wrap?: boolean;\n /** Classes for the scroll wrapper (ignored when `wrap` is false). */\n wrapperClassName?: string;\n}\n\nconst Table = React.forwardRef<HTMLTableElement, TableProps>(\n ({ className, size = \"sm\", wrap = true, wrapperClassName, ...props }, ref) => {\n const table = (\n <table\n ref={ref}\n data-slot=\"table\"\n data-size={size}\n className={cn(\"w-full caption-bottom text-sm\", className)}\n {...props}\n />\n );\n\n return (\n <TableSizeContext.Provider value={size}>\n {wrap ? (\n <div\n data-slot=\"table-wrapper\"\n className={cn(\"relative w-full overflow-auto\", wrapperClassName)}\n >\n {table}\n </div>\n ) : (\n table\n )}\n </TableSizeContext.Provider>\n );\n },\n);\nTable.displayName = \"Table\";\n\nexport interface TableHeaderProps\n extends React.HTMLAttributes<HTMLTableSectionElement> {\n /**\n * Pin the header to the top of the nearest scroll container. Opt-in: it\n * needs a bounded scroll ancestor to stick to, and it opens a stacking\n * context whether or not it sticks.\n */\n sticky?: boolean;\n}\n\nconst TableHeader = React.forwardRef<\n HTMLTableSectionElement,\n TableHeaderProps\n>(({ className, sticky = false, ...props }, ref) => (\n <thead\n ref={ref}\n data-slot=\"table-header\"\n className={cn(\n \"[&_tr]:border-b\",\n sticky && \"sticky top-0 z-10 bg-background\",\n className,\n )}\n {...props}\n />\n));\nTableHeader.displayName = \"TableHeader\";\n\nconst TableBody = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <tbody\n ref={ref}\n data-slot=\"table-body\"\n className={cn(\"[&_tr:last-child]:border-0\", className)}\n {...props}\n />\n));\nTableBody.displayName = \"TableBody\";\n\nconst TableFooter = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <tfoot\n ref={ref}\n data-slot=\"table-footer\"\n className={cn(\n \"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0\",\n className,\n )}\n {...props}\n />\n));\nTableFooter.displayName = \"TableFooter\";\n\nconst TableRow = React.forwardRef<\n HTMLTableRowElement,\n React.HTMLAttributes<HTMLTableRowElement>\n>(({ className, ...props }, ref) => (\n <tr\n ref={ref}\n data-slot=\"table-row\"\n className={cn(\n \"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted\",\n className,\n )}\n {...props}\n />\n));\nTableRow.displayName = \"TableRow\";\n\nconst TableHead = React.forwardRef<\n HTMLTableCellElement,\n React.ThHTMLAttributes<HTMLTableCellElement>\n>(({ className, ...props }, ref) => {\n const size = useTableSize();\n return (\n <th\n ref={ref}\n data-slot=\"table-head\"\n className={cn(\n \"h-10 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]\",\n TABLE_SIZES[size].head,\n className,\n )}\n {...props}\n />\n );\n});\nTableHead.displayName = \"TableHead\";\n\nconst TableCell = React.forwardRef<\n HTMLTableCellElement,\n React.TdHTMLAttributes<HTMLTableCellElement>\n>(({ className, ...props }, ref) => {\n const size = useTableSize();\n return (\n <td\n ref={ref}\n data-slot=\"table-cell\"\n className={cn(\n \"align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]\",\n TABLE_SIZES[size].cell,\n className,\n )}\n {...props}\n />\n );\n});\nTableCell.displayName = \"TableCell\";\n\nconst TableCaption = React.forwardRef<\n HTMLTableCaptionElement,\n React.HTMLAttributes<HTMLTableCaptionElement>\n>(({ className, ...props }, ref) => (\n <caption\n ref={ref}\n data-slot=\"table-caption\"\n className={cn(\"mt-4 text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nTableCaption.displayName = \"TableCaption\";\n\nexport {\n Table,\n TableBody,\n TableCaption,\n TableCell,\n TableFooter,\n TableHead,\n TableHeader,\n TableRow,\n};\n","\"use client\";\n\n/**\n * Tabs — Radix tabs, carrying two rulings the forks had already paid for.\n *\n * 1. THE ROOT RENDERS UNCONDITIONALLY — no mount gate. A wrapper in\n * matrx-frontend used to defer rendering until after hydration (\"Radix\n * generates dynamic aria-controls ids that differ between SSR and client\").\n * That was false — Radix ids come from React's SSR-stable `useId` — and the\n * gate deleted the ENTIRE tab bar and active panel from SSR and the first\n * client paint.\n *\n * 2. INACTIVE PANELS UNMOUNT — Radix's default, restored in matrx-frontend on\n * 2026-08-15 after a wrapper hardcoded `forceMount`. Every tab panel in that\n * app was live at all times: effects running, fetches firing, subscriptions\n * open, registrations registered — while invisible. Not theoretical: on the\n * agent-apps executions page both tabs' tables registered a runtime provider\n * for the same surface at the same depth, the HIDDEN tab won the tie-break,\n * and agents on the VISIBLE tab were handed the other tab's rows.\n *\n * `forceMount` is OPT-IN. Pass it on the panels that genuinely must survive\n * a switch — an in-flight editor, a scroll position, a live stream that\n * must not be torn down. `data-[state=inactive]:hidden` is applied\n * unconditionally (inert when the panel unmounts), so passing the prop is\n * the whole opt-in.\n *\n * Do NOT reach for `forceMount` to preserve a form draft. Lift that state to\n * the component that owns the `<Tabs>`; the panel is then free to unmount\n * and the draft survives a close/reopen too, which force-mounting never gave\n * you.\n *\n * `TabsTriggerCore` is the trigger WITHOUT the resting muted-foreground\n * treatment, for hosts that colour their own inactive tabs. Both triggers\n * otherwise share one class string.\n */\n\nimport * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nconst Tabs = TabsPrimitive.Root;\n\nconst TABS_TRIGGER_BASE =\n \"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm\";\n\nconst TabsList = React.forwardRef<\n React.ComponentRef<typeof TabsPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.List\n ref={ref}\n data-slot=\"tabs-list\"\n className={cn(\n \"inline-flex h-9 items-center justify-center gap-1 rounded-lg bg-muted p-1 text-muted-foreground\",\n className,\n )}\n {...props}\n />\n));\nTabsList.displayName = TabsPrimitive.List.displayName;\n\nconst TabsTrigger = React.forwardRef<\n React.ComponentRef<typeof TabsPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.Trigger\n ref={ref}\n data-slot=\"tabs-trigger\"\n className={cn(\n TABS_TRIGGER_BASE,\n \"text-muted-foreground hover:text-foreground\",\n className,\n )}\n {...props}\n />\n));\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName;\n\n/** The trigger without the resting muted/hover treatment. */\nconst TabsTriggerCore = React.forwardRef<\n React.ComponentRef<typeof TabsPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.Trigger\n ref={ref}\n data-slot=\"tabs-trigger\"\n className={cn(TABS_TRIGGER_BASE, className)}\n {...props}\n />\n));\nTabsTriggerCore.displayName = TabsPrimitive.Trigger.displayName;\n\nconst TabsContent = React.forwardRef<\n React.ComponentRef<typeof TabsPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.Content\n ref={ref}\n data-slot=\"tabs-content\"\n className={cn(\n \"data-[state=inactive]:hidden\",\n \"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n className,\n )}\n {...props}\n />\n));\nTabsContent.displayName = TabsPrimitive.Content.displayName;\n\nexport { Tabs, TabsContent, TabsList, TabsTrigger, TabsTriggerCore };\n","\"use client\";\n\n/**\n * Textarea — the multi-line twin of the Input family, same three shapes:\n * `Textarea` (elevated), `BasicTextarea` (plain control), and\n * `TextareaWithPrefix`.\n *\n * WHAT THE FORKS PROVED. Three hosts shipped a bare `<textarea>` with a\n * min-height and nothing else; matrx-frontend shipped auto-grow, min/max\n * height clamping, and a stretch-detection pass. That last one is the reason\n * this file is worth having: a `<textarea>` is a REPLACED element, so\n * `className=\"h-full\"` on it does nothing useful unless its parent is also\n * told to stretch — which is why every host that wanted a filling textarea\n * ended up wrapping it by hand at the call site, differently each time.\n * `getStretchClasses` reads the caller's own fill intent out of the className\n * and builds the wrapper for them.\n *\n * COLOUR IS TOKENS (C26). The ported original pinned its body text to literal\n * black/white, its placeholder and focus ring to raw palette steps, and its\n * dark elevation to a custom property no host defined — so that shadow\n * computed to nothing. All four now resolve from the semantic vocabulary.\n *\n * AND `shadow-textarea` NOW EXISTS. The original's resting elevation class was\n * `shadow-textarea`, and NO host defined `--shadow-textarea` or generated that\n * utility — 125 call sites asked for an elevation they never got. The package\n * ships the token (defaulting to the Input family's `--shadow-input`, which is\n * plainly what the twin class meant) and the rule, so the class finally does\n * what it says. A host that wants the flat look sets `--shadow-textarea: none`.\n *\n * The clipboard/motion variants matrx-frontend layers on top (CopyTextarea,\n * FancyTextarea) stay host-owned under the C8 split-out law: they drag in\n * `motion/react`, and plain-textarea consumers must not pay for it.\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport interface TextareaProps\n extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {\n /** Grow to fit content as the user types (and stop growing at `maxHeight`). */\n autoGrow?: boolean;\n /** Minimum height in px. */\n minHeight?: number;\n /** Maximum height in px; past it the field scrolls instead of growing. */\n maxHeight?: number;\n /** Classes for the wrapper this component adds when one is needed. */\n wrapperClassName?: string;\n}\n\nconst FILL_HEIGHT_REGEX = /(?:^|\\s)(h-full|h-dvh|flex-1|grow)(?:\\s|$)/;\nconst FILL_WIDTH_REGEX = /(?:^|\\s)(w-full|w-screen)(?:\\s|$)/;\n\n/**\n * A `<textarea>` cannot fill a box on its own — the box has to be told too.\n * Read the caller's fill intent out of its own className and mirror it onto\n * the wrapper, so `className=\"h-full\"` means what the caller thought it meant.\n */\nfunction getStretchClasses(className?: string): string | undefined {\n if (!className) return undefined;\n const fills: string[] = [];\n if (FILL_HEIGHT_REGEX.test(className)) fills.push(\"h-full min-h-0\");\n if (FILL_WIDTH_REGEX.test(className)) fills.push(\"w-full\");\n return fills.length ? fills.join(\" \") : undefined;\n}\n\nconst TEXTAREA_ELEVATED_CLASS =\n \"flex h-auto w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground shadow-textarea transition duration-400 placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-[2px] focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50\";\n\nconst TEXTAREA_CONTROL_CLASS =\n \"flex w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm text-foreground shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50\";\n\nfunction useAutoGrow(\n ref: React.RefObject<HTMLTextAreaElement | null>,\n value: React.TextareaHTMLAttributes<HTMLTextAreaElement>[\"value\"],\n autoGrow = false,\n minHeight?: number,\n maxHeight?: number,\n): void {\n React.useEffect(() => {\n if (!autoGrow || !ref.current) return;\n\n const textarea = ref.current;\n textarea.style.height = \"auto\";\n\n let newHeight = textarea.scrollHeight;\n if (minHeight) newHeight = Math.max(newHeight, minHeight);\n\n if (maxHeight && newHeight >= maxHeight) {\n textarea.style.height = `${maxHeight}px`;\n textarea.style.overflowY = \"auto\";\n } else {\n textarea.style.height = `${newHeight}px`;\n textarea.style.overflowY = \"hidden\";\n }\n }, [value, autoGrow, minHeight, maxHeight, ref]);\n}\n\n/** Merge a forwarded ref with the internal one auto-grow needs to measure. */\nfunction useMergedTextareaRef(\n forwarded: React.ForwardedRef<HTMLTextAreaElement>,\n): {\n ref: React.RefObject<HTMLTextAreaElement | null>;\n callback: (node: HTMLTextAreaElement | null) => void;\n} {\n const internal = React.useRef<HTMLTextAreaElement | null>(null);\n const callback = React.useCallback(\n (node: HTMLTextAreaElement | null) => {\n internal.current = node;\n if (typeof forwarded === \"function\") forwarded(node);\n else if (forwarded) forwarded.current = node;\n },\n [forwarded],\n );\n return { ref: internal, callback };\n}\n\nfunction boxStyle(\n minHeight?: number,\n maxHeight?: number,\n): React.CSSProperties | undefined {\n if (minHeight === undefined && maxHeight === undefined) return undefined;\n return {\n minHeight: minHeight ? `${minHeight}px` : undefined,\n maxHeight: maxHeight ? `${maxHeight}px` : undefined,\n };\n}\n\n/** The elevated textarea — the Input family's `Input`, in multi-line form. */\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n (\n { className, autoGrow, minHeight, maxHeight, wrapperClassName, ...props },\n forwarded,\n ) => {\n const { ref, callback } = useMergedTextareaRef(forwarded);\n const stretchClasses = getStretchClasses(className);\n const needsWrapper = Boolean(wrapperClassName || stretchClasses);\n\n useAutoGrow(ref, props.value, autoGrow, minHeight, maxHeight);\n\n const textarea = (\n <textarea\n ref={callback}\n data-slot=\"textarea\"\n className={cn(\n TEXTAREA_ELEVATED_CLASS,\n autoGrow && \"resize-none\",\n stretchClasses,\n className,\n )}\n style={boxStyle(minHeight, maxHeight)}\n {...props}\n />\n );\n\n if (!needsWrapper) return textarea;\n\n return <div className={cn(stretchClasses, wrapperClassName)}>{textarea}</div>;\n },\n);\nTextarea.displayName = \"Textarea\";\n\n/**\n * The plain control — a bordered, transparent field with a 60px floor. This is\n * what matrx-extend, aidream/apps/dashboard and workflow-studio each called\n * `Textarea`; the floor is theirs and it is the sensible default (a one-line\n * box for multi-line content invites a scrollbar on the first Enter).\n */\nconst BasicTextarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n ({ className, autoGrow, minHeight, maxHeight, ...props }, forwarded) => {\n const { ref, callback } = useMergedTextareaRef(forwarded);\n\n useAutoGrow(ref, props.value, autoGrow, minHeight, maxHeight);\n\n return (\n <textarea\n ref={callback}\n data-slot=\"textarea\"\n className={cn(\n TEXTAREA_CONTROL_CLASS,\n \"h-auto min-h-[60px]\",\n autoGrow && \"resize-none\",\n className,\n )}\n style={boxStyle(minHeight, maxHeight)}\n {...props}\n />\n );\n },\n);\nBasicTextarea.displayName = \"BasicTextarea\";\n\nexport interface TextareaWithPrefixProps extends Omit<TextareaProps, \"prefix\"> {\n /** Leading adornment, absolutely placed at the field's top-left. */\n prefix?: React.ReactNode;\n}\n\nconst TextareaWithPrefix = React.forwardRef<\n HTMLTextAreaElement,\n TextareaWithPrefixProps\n>(\n (\n {\n prefix,\n className,\n wrapperClassName,\n autoGrow,\n minHeight,\n maxHeight,\n ...props\n },\n forwarded,\n ) => {\n const { ref, callback } = useMergedTextareaRef(forwarded);\n\n useAutoGrow(ref, props.value, autoGrow, minHeight, maxHeight);\n\n return (\n <div\n className={cn(\"relative\", getStretchClasses(className), wrapperClassName)}\n >\n {prefix ? (\n <div className=\"pointer-events-none absolute left-3 top-3 z-10 text-muted-foreground\">\n {prefix}\n </div>\n ) : null}\n <textarea\n ref={callback}\n data-slot=\"textarea\"\n className={cn(\n TEXTAREA_CONTROL_CLASS,\n \"resize-y\",\n prefix && \"pl-10\",\n autoGrow && \"resize-none\",\n className,\n )}\n style={boxStyle(minHeight, maxHeight)}\n {...props}\n />\n </div>\n );\n },\n);\nTextareaWithPrefix.displayName = \"TextareaWithPrefix\";\n\nexport { BasicTextarea, Textarea, TextareaWithPrefix };\n","\"use client\";\n\n// useScrollFade — ported verbatim from matrx-frontend\n// `components/official/scroll-fade/useScrollFade.ts` (S21).\n//\n// \"There is more below\" — told to the eye, not to nobody.\n//\n// A scroll container that simply hard-clips its last row reads as FINISHED.\n// The user never scrolls, because nothing suggested there was anything to\n// scroll to. A soft fade at the overflowing edge is the standard cue, and it\n// must appear ONLY on the edges that actually overflow — a permanent fade on a\n// non-scrolling list just makes the last item look broken.\n//\n// Attach `ref` to the scrolling element and spread `fadeProps`. Styling is\n// host-owned CSS (the `.matrx-scroll-fade` class in the host's globals.css),\n// keyed off the data attributes.\n//\n// The ref is a CALLBACK ref, not a useRef object, on purpose: these containers\n// are usually mounted conditionally (a popover body, a lazily-resolved menu),\n// so an effect that reads `ref.current` on mount finds null and — with no\n// dependency that ever changes — never runs again. The fade then silently\n// never appears, which is exactly the failure this hook exists to prevent.\n//\n// TWO RULES THE CALLBACK MUST OBEY (both learned the hard way — breaking\n// either one produced \"Maximum update depth exceeded\" on a page of 13 menus):\n// 1. NEVER setState synchronously inside the callback. Radix composes our\n// ref with its own via useComposedRefs, whose identity changes every render,\n// so the ref detaches+reattaches on every commit. A synchronous setState\n// there re-renders, which re-attaches, which sets state again — forever.\n// Measurement is always deferred to rAF.\n// 2. NEVER setState on detach (node === null). A detach/attach pair would\n// otherwise flip the fade off and on and drive the same loop.\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport interface ScrollFadeState {\n top: boolean;\n bottom: boolean;\n}\n\nexport interface UseScrollFadeResult {\n ref: (node: HTMLElement | null) => void;\n fadeProps: {\n \"data-fade-top\": \"\" | undefined;\n \"data-fade-bottom\": \"\" | undefined;\n className: string;\n };\n state: ScrollFadeState;\n}\n\n/** Slack below which we treat the edge as reached (sub-pixel scroll math). */\nconst EPSILON = 2;\n\nexport function useScrollFade(): UseScrollFadeResult {\n const [state, setState] = useState<ScrollFadeState>({\n top: false,\n bottom: false,\n });\n const nodeRef = useRef<HTMLElement | null>(null);\n const cleanupRef = useRef<(() => void) | null>(null);\n\n const measure = useCallback(() => {\n const el = nodeRef.current;\n if (!el) return;\n const overflowing = el.scrollHeight - el.clientHeight > EPSILON;\n const next: ScrollFadeState = {\n top: overflowing && el.scrollTop > EPSILON,\n bottom:\n overflowing &&\n el.scrollTop + el.clientHeight < el.scrollHeight - EPSILON,\n };\n setState((prev) =>\n prev.top === next.top && prev.bottom === next.bottom ? prev : next,\n );\n }, []);\n\n const ref = useCallback(\n (node: HTMLElement | null) => {\n cleanupRef.current?.();\n cleanupRef.current = null;\n nodeRef.current = node;\n // Rule 2: no state change on detach.\n if (!node) return;\n\n node.addEventListener(\"scroll\", measure, { passive: true });\n // Content can arrive after mount (lazy menu configs, async lists) and the\n // box can be resized by the viewport, so watch both.\n const ro = new ResizeObserver(measure);\n ro.observe(node);\n const mo = new MutationObserver(measure);\n mo.observe(node, { childList: true, subtree: true });\n\n cleanupRef.current = () => {\n node.removeEventListener(\"scroll\", measure);\n ro.disconnect();\n mo.disconnect();\n };\n\n // Rule 1: deferred, never synchronous. Radix also animates the panel in,\n // so its final height is not known on the frame it mounts anyway.\n requestAnimationFrame(measure);\n },\n [measure],\n );\n\n useEffect(() => () => cleanupRef.current?.(), []);\n\n return {\n ref,\n state,\n fadeProps: {\n \"data-fade-top\": state.top ? \"\" : undefined,\n \"data-fade-bottom\": state.bottom ? \"\" : undefined,\n className: \"matrx-scroll-fade\",\n },\n };\n}\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U,GAAG,CAAC,CAAC;AAEhD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT,iBAAiB,MAAM,MAAM,KAAK;AAAA,MAClC,oBAAoB,MAAM,SAAS,KAAK;AAAA,MACxC,WAAW;AAAA,IACb;AAAA,EACF;AACF;","names":["React","jsx","jsx","jsx","jsxs","cva","React","jsx","cva","React","jsx","React","jsx","React","jsx","CollapsibleTrigger","CollapsibleContent","React","React","jsx","React","jsx","jsxs","React","jsx","jsxs","useState","React","jsx","jsx","jsxs","useState","Icon","DialogPrimitive","VisuallyHidden","React","jsx","jsxs","DIALOG_DESKTOP_CLASSES","DIALOG_MOBILE_SHEET_CLASSES","DIALOG_MOBILE_SHEET_OVERRIDE","React","jsx","jsxs","useCallback","useEffect","useRef","useState","jsx","jsxs","useState","useRef","useEffect","useCallback","result","React","jsx","jsxs","React","jsx","Label","useRef","useState","jsx","jsxs","Icon","useRef","useState","React","jsx","React","jsx","jsxs","jsx","jsxs","jsx","cva","React","jsx","jsxs","cva","React","jsx","Separator","treeContainsComponent","cva","React","jsx","jsxs","cva","treeContainsComponent","jsx","React","jsx","useState","jsx","jsxs","useState","Icon","React","jsx","React","jsx","React","jsx","jsxs","useCallback","useEffect","useRef","useState"]}
|
|
1
|
+
{"version":3,"sources":["../src/badge.tsx","../src/cn.ts","../src/bottom-sheet.tsx","../src/icons.tsx","../src/radix-dialog-modal-context.tsx","../src/button.tsx","../src/avatar.tsx","../src/card.tsx","../src/checkbox.tsx","../src/collapsible.tsx","../src/command.tsx","../src/portal-container.tsx","../src/use-is-mobile.ts","../src/context-menu.tsx","../src/creatable-picker.tsx","../src/popover.tsx","../src/dialog.tsx","../src/dropdown-menu.tsx","../src/editable-label.tsx","../src/input.tsx","../src/label.tsx","../src/overflow-toolbar.tsx","../src/progress.tsx","../src/scroll-area.tsx","../src/score-ring.tsx","../src/segmented-control.tsx","../src/select.tsx","../src/separator.tsx","../src/sheet.tsx","../src/skeleton.tsx","../src/switch.tsx","../src/tabbed-bottom-sheet.tsx","../src/table.tsx","../src/tabs.tsx","../src/textarea.tsx","../src/use-scroll-fade.ts"],"sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport const badgeVariants = cva(\n \"inline-flex items-center rounded-md border px-2 py-0.5 text-[11px] font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-0\",\n {\n variants: {\n variant: {\n default: \"border-transparent bg-primary/15 text-primary\",\n secondary: \"border-transparent bg-secondary text-secondary-foreground\",\n destructive: \"border-transparent bg-destructive/15 text-destructive\",\n outline: \"border-border text-foreground\",\n success: \"border-transparent bg-success/15 text-success\",\n warning: \"border-transparent bg-warning/15 text-warning\",\n info: \"border-info/30 bg-info/15 text-info\",\n error: \"border-transparent bg-destructive/15 text-destructive\",\n neutral: \"border-border bg-muted text-muted-foreground\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\n\nexport interface BadgeProps\n extends React.HTMLAttributes<HTMLSpanElement>,\n VariantProps<typeof badgeVariants> {}\n\nexport function Badge({ className, variant, ...props }: BadgeProps) {\n return <span className={cn(badgeVariants({ variant }), className)} {...props} />;\n}\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","\"use client\";\n\n/**\n * BottomSheet — the canonical mobile sheet. Ported verbatim from\n * matrx-frontend `components/official/bottom-sheet/BottomSheet.tsx` (S19).\n *\n * `vaul` is a sanctioned real dependency here, the same way\n * @radix-ui/react-alert-dialog is for @ai-matrx/kit `/confirm`: the drag-to-\n * dismiss drawer physics IS the component — there is no BottomSheet without\n * it, and reimplementing gesture/velocity handling would be a vendored twin\n * of a maintained library rather than of our own code. Rationale recorded in\n * FEATURE.md.\n *\n * Seam inversions:\n * - The host's `components/ui/drawer.tsx` wrappers are inlined as private\n * equivalents with identical behavior (thin over vaul + the shared\n * RadixDialogModalProvider); the host keeps its own drawer module for its\n * other drawer surfaces.\n * - `ChevronLeft` is the package's inlined SVG (C19).\n *\n * Host-owned CSS contracts (documented, not shipped): the glass tokens\n * `--matrx-glass-bg` / `--matrx-glass-border-color`, the utility classes\n * `matrx-glass-thin-border` and `pb-safe`, and semantic color tokens.\n */\n\nimport { VisuallyHidden } from \"@radix-ui/react-visually-hidden\";\nimport * as React from \"react\";\nimport { Drawer as DrawerPrimitive } from \"vaul\";\n\nimport { cn } from \"./cn\";\nimport { ChevronLeftIcon } from \"./icons\";\nimport { RadixDialogModalProvider } from \"./radix-dialog-modal-context\";\n\ntype DrawerRootProps = React.ComponentProps<typeof DrawerPrimitive.Root> & {\n /** Vaul does not forward false to its underlying Radix root. */\n modal?: true;\n};\n\nconst DrawerRoot = ({\n children,\n shouldScaleBackground = true,\n ...props\n}: DrawerRootProps) => (\n <RadixDialogModalProvider modal>\n <DrawerPrimitive.Root\n modal\n shouldScaleBackground={shouldScaleBackground}\n {...props}\n >\n {children}\n </DrawerPrimitive.Root>\n </RadixDialogModalProvider>\n);\nDrawerRoot.displayName = \"DrawerRoot\";\n\n/**\n * Unstyled, non-portalling Content for custom Drawer layouts. It derives\n * explicit modal semantics while Vaul retains focus/background behavior.\n */\nconst DrawerContentPrimitive = React.forwardRef<\n React.ComponentRef<typeof DrawerPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>\n>(({ ...props }, ref) => (\n <DrawerPrimitive.Content {...props} ref={ref} aria-modal=\"true\" />\n));\nDrawerContentPrimitive.displayName = \"DrawerContentPrimitive\";\n\nexport interface BottomSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n title?: string;\n /**\n * `adaptive` (default) — the sheet sizes to its content between 60dvh and\n * 90dvh. Correct for a single short list.\n *\n * `full` — ONE fixed height (92dvh) that never changes as content changes.\n * Use it for any sheet whose body varies (multi-level navigation, tabs,\n * search results): an adaptive sheet there resizes under the user's thumb\n * on every keystroke and every drill-in, which reads as the panel jumping.\n */\n size?: \"adaptive\" | \"full\";\n /** Visual treatment for the panel. Solid is intended for dense, long-lived surfaces. */\n surface?: \"glass\" | \"solid\";\n /** Merged onto the sheet panel. */\n contentClassName?: string;\n children: React.ReactNode;\n}\n\nexport function BottomSheet({\n open,\n onOpenChange,\n title = \"Bottom Sheet\",\n size = \"adaptive\",\n surface = \"glass\",\n contentClassName,\n children,\n}: BottomSheetProps) {\n return (\n <DrawerRoot open={open} onOpenChange={onOpenChange}>\n <DrawerPrimitive.Portal>\n {/* Identical output to the host's DrawerOverlay wrapper: its base\n classes merged with the caller classes, inline background wins. */}\n <DrawerPrimitive.Overlay\n className={cn(\"fixed inset-0 z-50 bg-[var(--matrx-overlay-scrim)]\", \"fixed inset-0 z-50\")}\n style={{ background: \"var(--matrx-overlay-scrim-drawer)\" }}\n />\n <DrawerContentPrimitive\n className={cn(\n \"fixed inset-x-0 bottom-0 z-50 mt-24 flex flex-col rounded-t-2xl overflow-hidden\",\n size === \"full\" ? \"h-[92dvh]\" : \"min-h-[60dvh] max-h-[90dvh]\",\n surface === \"solid\" &&\n \"border border-b-0 border-border bg-background shadow-2xl\",\n contentClassName,\n )}\n style={\n surface === \"glass\"\n ? {\n background: \"var(--matrx-glass-bg)\",\n backdropFilter: \"blur(20px) saturate(180%)\",\n WebkitBackdropFilter: \"blur(20px) saturate(180%)\",\n border: \"1px solid var(--matrx-glass-border-color)\",\n borderBottom: \"none\",\n }\n : undefined\n }\n >\n <VisuallyHidden>\n <DrawerPrimitive.Title>{title}</DrawerPrimitive.Title>\n <DrawerPrimitive.Description>\n Bottom sheet panel.\n </DrawerPrimitive.Description>\n </VisuallyHidden>\n <div className=\"mx-auto mt-3 mb-1 h-1.5 w-10 rounded-full bg-muted-foreground/30 flex-shrink-0\" />\n {children}\n </DrawerContentPrimitive>\n </DrawerPrimitive.Portal>\n </DrawerRoot>\n );\n}\n\nexport interface BottomSheetHeaderProps {\n title: string;\n showBack?: boolean;\n onBack?: () => void;\n trailing?: React.ReactNode;\n}\n\nexport function BottomSheetHeader({\n title,\n showBack = false,\n onBack,\n trailing,\n}: BottomSheetHeaderProps) {\n return (\n <div className=\"flex items-center px-2 pt-1 pb-2 flex-shrink-0 min-h-[44px]\">\n <div className=\"min-w-[44px] flex items-center justify-start\">\n <button\n onClick={onBack}\n className={cn(\n \"h-8 w-8 rounded-full matrx-glass-thin-border flex items-center justify-center transition-all active:scale-95\",\n showBack ? \"opacity-100\" : \"opacity-0 pointer-events-none\",\n )}\n aria-hidden={!showBack}\n tabIndex={showBack ? 0 : -1}\n >\n <ChevronLeftIcon className=\"h-4 w-4 text-foreground\" />\n </button>\n </div>\n <span className=\"text-[17px] font-semibold flex-1 text-center truncate\">\n {title}\n </span>\n <div className=\"min-w-[44px] flex items-center justify-end\">\n {trailing}\n </div>\n </div>\n );\n}\n\nexport interface BottomSheetBodyProps {\n children: React.ReactNode;\n className?: string;\n}\n\nexport function BottomSheetBody({ children, className }: BottomSheetBodyProps) {\n return (\n <div\n className={cn(\n // min-h-0 is load-bearing: without it a flex child's min-height:auto\n // floors it at content height and the body grows instead of scrolling.\n \"min-h-0 flex-1 overflow-y-auto overscroll-contain pb-safe\",\n className,\n )}\n >\n {children}\n </div>\n );\n}\n\nexport interface BottomSheetFooterProps {\n children: React.ReactNode;\n className?: string;\n}\n\nexport function BottomSheetFooter({\n children,\n className,\n}: BottomSheetFooterProps) {\n return (\n <div\n className={cn(\n \"flex-shrink-0 px-4 py-3 pb-safe border-t border-[var(--matrx-sheet-divider)]\",\n className,\n )}\n >\n {children}\n </div>\n );\n}\n","/**\n * Internal inlined SVG icons (policy C19: no icon-library dependency, ever).\n *\n * Each icon is copied from the exact glyph the ported originals rendered:\n * lucide-react's Loader2 / ChevronLeft / ChevronRight / MoreHorizontal and\n * @radix-ui/react-icons' Cross2Icon. Same viewBoxes, same paths, same default\n * stroke geometry — a host swapping the import sees pixel-identical output.\n *\n * Not exported from the package entry; components consume them directly.\n */\n\nimport * as React from \"react\";\n\ntype IconProps = React.SVGAttributes<SVGSVGElement>;\n\nfunction lucideProps(props: IconProps): React.SVGAttributes<SVGSVGElement> {\n return {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: 2,\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n \"aria-hidden\": true,\n ...props,\n };\n}\n\n/** lucide `loader-2` — the spinner glyph. Callers add `animate-spin`. */\nexport function Loader2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M21 12a9 9 0 1 1-6.219-8.56\" />\n </svg>\n );\n}\n\n/** lucide `chevron-left`. */\nexport function ChevronLeftIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n );\n}\n\n/** lucide `chevron-right`. */\nexport function ChevronRightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n );\n}\n\n/** lucide `more-horizontal` — the kebab/ellipsis glyph. */\nexport function MoreHorizontalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n <circle cx=\"19\" cy=\"12\" r=\"1\" />\n <circle cx=\"5\" cy=\"12\" r=\"1\" />\n </svg>\n );\n}\n\n/** lucide `check` — the selected-row tick (CreatablePicker). */\nexport function LucideCheckIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n );\n}\n\n/** lucide `chevrons-up-down` — the combobox trigger glyph. */\nexport function ChevronsUpDownIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"m7 15 5 5 5-5\" />\n <path d=\"m7 9 5-5 5 5\" />\n </svg>\n );\n}\n\n/** lucide `external-link` — the manage-in-new-tab glyph. */\nexport function ExternalLinkIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M15 3h6v6\" />\n <path d=\"M10 14 21 3\" />\n <path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" />\n </svg>\n );\n}\n\n/** lucide `lock` — the platform-governed vocabulary glyph. */\nexport function LockIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\" />\n <path d=\"M7 11V7a5 5 0 0 1 10 0v4\" />\n </svg>\n );\n}\n\n/** lucide `plus` — the create/add glyph. */\nexport function PlusIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M5 12h14\" />\n <path d=\"M12 5v14\" />\n </svg>\n );\n}\n\n/** lucide `x` — the dialog close glyph (host dialog module used lucide X). */\nexport function XIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n );\n}\n\n/**\n * @radix-ui/react-icons components default to width/height 15 — the bare\n * `<ChevronUpIcon />` renders in Select's scroll buttons rely on it.\n */\nfunction radixProps(props: IconProps): React.SVGAttributes<SVGSVGElement> {\n return {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 15 15\",\n width: 15,\n height: 15,\n fill: \"none\",\n \"aria-hidden\": true,\n ...props,\n };\n}\n\n/** @radix-ui/react-icons `MagnifyingGlassIcon` — the command search glyph. */\nexport function MagnifyingGlassIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `CheckIcon` — the select item indicator glyph. */\nexport function CheckIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/**\n * @radix-ui/react-icons `DividerHorizontalIcon` — the INDETERMINATE checkbox\n * glyph. Radix renders the indicator for both `true` and `\"indeterminate\"`, so\n * a half-selected \"select all\" that shows a full check states something false;\n * the two states get different glyphs on purpose.\n */\nexport function DividerHorizontalIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M2 7.5C2 7.22386 2.22386 7 2.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H2.5C2.22386 8 2 7.77614 2 7.5Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `DotFilledIcon` — the menu radio-item indicator. */\nexport function DotFilledIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M9.875 7.5C9.875 8.81168 8.81168 9.875 7.5 9.875C6.18832 9.875 5.125 8.81168 5.125 7.5C5.125 6.18832 6.18832 5.125 7.5 5.125C8.81168 5.125 9.875 6.18832 9.875 7.5Z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `ChevronRightIcon` — the submenu-trigger glyph. */\nexport function RadixChevronRightIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `ChevronDownIcon` — the select trigger/scroll glyph. */\nexport function RadixChevronDownIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `ChevronUpIcon` — the select scroll-up glyph. */\nexport function RadixChevronUpIcon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\n/** @radix-ui/react-icons `Cross2Icon` — the dialog/sheet close glyph. */\nexport function Cross2Icon(props: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 15 15\"\n fill=\"none\"\n aria-hidden\n {...props}\n >\n <path\n d=\"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n","\"use client\";\n\n/**\n * Ported verbatim from matrx-frontend `components/ui/radix-dialog-modal-context.tsx`.\n * Shared by the Sheet and BottomSheet families (and available to hosts that\n * compose their own Radix Dialog-derived wrappers around these primitives).\n */\n\nimport * as React from \"react\";\n\nconst RadixDialogModalContext = React.createContext(true);\n\nexport interface RadixDialogModalProviderProps {\n children: React.ReactNode;\n modal: boolean;\n}\n\n/**\n * Keeps our Radix-based content wrappers aligned with the owning Root's\n * modality so ARIA semantics cannot drift from focus/pointer behavior.\n */\nexport function RadixDialogModalProvider({\n children,\n modal,\n}: RadixDialogModalProviderProps) {\n return (\n <RadixDialogModalContext.Provider value={modal}>\n {children}\n </RadixDialogModalContext.Provider>\n );\n}\n\n/** Returns whether the nearest Radix Dialog-derived root is modal. */\nexport function useRadixDialogModal(): boolean {\n return React.useContext(RadixDialogModalContext);\n}\n","\"use client\";\n\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport const buttonVariants = cva(\n \"inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-0 disabled:pointer-events-none disabled:opacity-50 active:scale-[0.98] [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90\",\n outline:\n \"border border-border bg-card shadow-sm hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n subtle:\n \"border border-transparent bg-muted/50 text-foreground hover:border-border hover:bg-muted\",\n },\n size: {\n default: \"h-9 px-4 py-2\",\n sm: \"h-8 rounded-md px-3 text-xs\",\n lg: \"h-10 rounded-md px-6\",\n icon: \"h-9 w-9\",\n \"icon-sm\": \"h-7 w-7\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Component = asChild ? Slot : \"button\";\n return (\n <Component\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n />\n );\n },\n);\nButton.displayName = \"Button\";\n","\"use client\";\n\n/**\n * Avatar — Radix avatar with the package's token vocabulary.\n *\n * The forks differed only in the root's fixed size (matrx-frontend `h-10 w-10`,\n * dashboard `h-9 w-9`) and in whether the fallback carried type styling. Both\n * are settled here as props rather than copies: `size` picks the box, and the\n * fallback always carries the muted type treatment (dashboard's version — a\n * fallback renders initials, and unstyled initials inherit whatever the row\n * was using, which is how the two hosts' avatars stopped matching).\n */\n\nimport * as AvatarPrimitive from \"@radix-ui/react-avatar\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport type AvatarSize = \"sm\" | \"md\" | \"lg\";\n\nconst AVATAR_SIZES: Record<AvatarSize, string> = {\n sm: \"h-8 w-8 text-[11px]\",\n md: \"h-9 w-9 text-xs\",\n lg: \"h-10 w-10 text-sm\",\n};\n\nexport interface AvatarProps\n extends React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root> {\n /** Box size. Default `lg` (the h-10 box matrx-frontend has always shipped). */\n size?: AvatarSize;\n}\n\nconst Avatar = React.forwardRef<\n React.ComponentRef<typeof AvatarPrimitive.Root>,\n AvatarProps\n>(({ className, size = \"lg\", ...props }, ref) => (\n <AvatarPrimitive.Root\n ref={ref}\n data-slot=\"avatar\"\n className={cn(\n \"relative flex shrink-0 overflow-hidden rounded-full\",\n AVATAR_SIZES[size],\n className,\n )}\n {...props}\n />\n));\nAvatar.displayName = AvatarPrimitive.Root.displayName;\n\nconst AvatarImage = React.forwardRef<\n React.ComponentRef<typeof AvatarPrimitive.Image>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Image\n ref={ref}\n data-slot=\"avatar-image\"\n className={cn(\"aspect-square h-full w-full\", className)}\n {...props}\n />\n));\nAvatarImage.displayName = AvatarPrimitive.Image.displayName;\n\nconst AvatarFallback = React.forwardRef<\n React.ComponentRef<typeof AvatarPrimitive.Fallback>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Fallback\n ref={ref}\n data-slot=\"avatar-fallback\"\n className={cn(\n \"flex h-full w-full items-center justify-center rounded-full bg-muted font-medium text-muted-foreground\",\n className,\n )}\n {...props}\n />\n));\nAvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;\n\nexport { Avatar, AvatarFallback, AvatarImage };\n","\"use client\";\n\n/**\n * Card — the surface every host had already forked, four different ways.\n *\n * The census that motivated this file (2026-09-07): matrx-frontend padded its\n * sections `p-2`, matrx-extend `p-4`, aidream/apps/dashboard `p-6`, and\n * matrx-games ran a Base-UI-generation card of its own. The STRUCTURE was\n * identical in all of them — a bordered, tokenised surface with header /\n * title / description / content / footer slots. Only the density differed.\n *\n * So density is a PROP, not a fork. `size` is declared once on `<Card>` and\n * every section reads it from context, which means a host cannot end up with a\n * `p-6` header above a `p-2` body — the failure mode that made the forks drift\n * in the first place. A host that wants its historical density binds the size\n * once at its import site; nothing else moves.\n *\n * sm → p-2, rounded-xl, `shadow` (matrx-frontend's density)\n * md → p-4, rounded-lg, `shadow-sm` (matrx-extend's density; the default)\n * lg → p-6, rounded-lg, `shadow-sm` (dashboard's density)\n *\n * Colour is tokens only (`bg-card` / `text-card-foreground` / `border`), so a\n * host re-themes cards by redefining tokens, never by editing this file.\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport type CardSize = \"sm\" | \"md\" | \"lg\";\n\ninterface CardSizeSpec {\n root: string;\n pad: string;\n padTopless: string;\n}\n\nconst CARD_SIZES: Record<CardSize, CardSizeSpec> = {\n sm: {\n root: \"rounded-xl border bg-card text-card-foreground shadow\",\n pad: \"p-2\",\n padTopless: \"p-2 pt-0\",\n },\n md: {\n root: \"rounded-lg border bg-card text-card-foreground shadow-sm\",\n pad: \"p-4\",\n padTopless: \"p-4 pt-0\",\n },\n lg: {\n root: \"rounded-lg border bg-card text-card-foreground shadow-sm\",\n pad: \"p-6\",\n padTopless: \"p-6 pt-0\",\n },\n};\n\nconst CardSizeContext = React.createContext<CardSize>(\"md\");\n\n/** The size the nearest enclosing `<Card>` declared. `md` outside one. */\nexport function useCardSize(): CardSize {\n return React.useContext(CardSizeContext);\n}\n\nexport interface CardProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Density for this card and every section inside it. Default `md`. */\n size?: CardSize;\n}\n\nconst Card = React.forwardRef<HTMLDivElement, CardProps>(\n ({ className, size = \"md\", ...props }, ref) => (\n <CardSizeContext.Provider value={size}>\n <div\n ref={ref}\n data-slot=\"card\"\n data-size={size}\n className={cn(CARD_SIZES[size].root, className)}\n {...props}\n />\n </CardSizeContext.Provider>\n ),\n);\nCard.displayName = \"Card\";\n\nconst CardHeader = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => {\n const size = useCardSize();\n return (\n <div\n ref={ref}\n data-slot=\"card-header\"\n className={cn(\n \"flex flex-col space-y-1.5 rounded-t-[inherit]\",\n CARD_SIZES[size].pad,\n className,\n )}\n {...props}\n />\n );\n});\nCardHeader.displayName = \"CardHeader\";\n\nconst CardTitle = React.forwardRef<\n HTMLHeadingElement,\n React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n <h3\n ref={ref}\n data-slot=\"card-title\"\n className={cn(\"font-semibold leading-none tracking-tight\", className)}\n {...props}\n />\n));\nCardTitle.displayName = \"CardTitle\";\n\nconst CardDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <p\n ref={ref}\n data-slot=\"card-description\"\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nCardDescription.displayName = \"CardDescription\";\n\n/**\n * Trailing control slot for a header (a menu button, a status pill). Absent\n * from every fork except matrx-games', which is why headers elsewhere grew\n * one-off absolute wrappers. Positions itself against the header's row.\n */\nconst CardAction = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"card-action\"\n className={cn(\"ml-auto self-start\", className)}\n {...props}\n />\n));\nCardAction.displayName = \"CardAction\";\n\nconst CardContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => {\n const size = useCardSize();\n return (\n <div\n ref={ref}\n data-slot=\"card-content\"\n className={cn(CARD_SIZES[size].padTopless, className)}\n {...props}\n />\n );\n});\nCardContent.displayName = \"CardContent\";\n\nconst CardFooter = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => {\n const size = useCardSize();\n return (\n <div\n ref={ref}\n data-slot=\"card-footer\"\n className={cn(\n \"flex items-center rounded-b-[inherit]\",\n CARD_SIZES[size].padTopless,\n className,\n )}\n {...props}\n />\n );\n});\nCardFooter.displayName = \"CardFooter\";\n\nexport {\n Card,\n CardAction,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n};\n","\"use client\";\n\n/**\n * Checkbox — Radix checkbox, and the indeterminate ruling that came with it.\n *\n * RADIX RENDERS THE INDICATOR FOR BOTH `checked` AND `\"indeterminate\"`. The\n * stock shadcn body puts a full check inside it either way, so a half-selected\n * \"select all\" tells the user every row is selected — a screen stating\n * something false. The two states get different glyphs here, always.\n *\n * `size` carries the two boxes the hosts had forked into: matrx-frontend's\n * dense 14px control and the stock 16px one.\n */\n\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { CheckIcon, DividerHorizontalIcon } from \"./icons\";\n\nexport type CheckboxSize = \"sm\" | \"md\";\n\nconst CHECKBOX_SIZES: Record<CheckboxSize, { root: string; glyph: string }> = {\n sm: { root: \"h-3.5 w-3.5 rounded-xs\", glyph: \"h-3 w-3\" },\n md: { root: \"h-4 w-4 rounded-sm\", glyph: \"h-3.5 w-3.5\" },\n};\n\nexport interface CheckboxProps\n extends React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root> {\n /** Box size. Default `md` (the stock 16px control); `sm` is the dense 14px one. */\n size?: CheckboxSize;\n}\n\nconst Checkbox = React.forwardRef<\n React.ComponentRef<typeof CheckboxPrimitive.Root>,\n CheckboxProps\n>(({ className, size = \"md\", ...props }, ref) => (\n <CheckboxPrimitive.Root\n ref={ref}\n data-slot=\"checkbox\"\n className={cn(\n \"peer shrink-0 cursor-pointer border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground\",\n CHECKBOX_SIZES[size].root,\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n data-slot=\"checkbox-indicator\"\n className=\"flex items-center justify-center text-current\"\n >\n {props.checked === \"indeterminate\" ? (\n <DividerHorizontalIcon className={CHECKBOX_SIZES[size].glyph} />\n ) : (\n <CheckIcon className={CHECKBOX_SIZES[size].glyph} />\n )}\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n));\nCheckbox.displayName = CheckboxPrimitive.Root.displayName;\n\nexport { Checkbox };\n","\"use client\";\n\n/**\n * Collapsible — Radix's, unwrapped.\n *\n * THE ROOT RENDERS UNCONDITIONALLY — no mount gate. The matrx-frontend\n * original carried the note that earned this line: a wrapper used to defer\n * rendering until after hydration on the theory that \"Radix generates dynamic\n * aria-controls ids that differ between SSR and client\". That was false —\n * Radix ids come from React's SSR-stable `useId` — and the gate was actively\n * harmful, because a Collapsible's Trigger wraps ALWAYS-VISIBLE content, so\n * `return null` deleted it from SSR and from the first client paint.\n *\n * Nothing here is restyled: the trigger and content are the host's to dress,\n * and every fork agreed on that. The file exists so no host re-derives the\n * SSR reasoning above from scratch — and gets it wrong again.\n */\n\nimport * as CollapsiblePrimitive from \"@radix-ui/react-collapsible\";\n\nconst Collapsible = CollapsiblePrimitive.Root;\nconst CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;\nconst CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;\n\nexport { Collapsible, CollapsibleContent, CollapsibleTrigger };\n","\"use client\";\n\n/**\n * Command — ported verbatim from matrx-frontend `components/ui/command.tsx`.\n *\n * `cmdk` is a SANCTIONED REAL DEPENDENCY (the vaul ↔ BottomSheet precedent):\n * the filtering/scoring/keyboard engine IS the component's product — there is\n * no Command palette without it, and reimplementing type-ahead ranking plus\n * roving keyboard selection would twin a maintained library rather than our\n * own code. See FEATURE.md.\n *\n * Seam inversions:\n * - `MagnifyingGlassIcon` comes from the package's inlined SVGs (C19), not\n * @radix-ui/react-icons.\n * - `CommandDialog` composed the host dialog module (`Dialog`, `DialogContent`,\n * `DialogTitle`). Those pieces are inlined privately below with identical\n * behavior — modal context, overlay, desktop card / mobile bottom-sheet\n * geometry, close control, portal — except the host's popout-aware\n * `DialogPortal` becomes the package's `PortalContainerProvider` seam\n * (plus an explicit `container` prop, which keeps top priority).\n * - The host's `useIsMobile` (a plain matchMedia breakpoint hook, not\n * host-shaped) became the package's own `./use-is-mobile`, with the same\n * 768px breakpoint. It started life inlined here; `Dialog` needed the same\n * answer, so it moved to a module both read rather than being copied.\n */\n\nimport type { DialogProps } from \"@radix-ui/react-dialog\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { MagnifyingGlassIcon, XIcon } from \"./icons\";\nimport { usePortalContainer } from \"./portal-container\";\nimport {\n RadixDialogModalProvider,\n useRadixDialogModal,\n} from \"./radix-dialog-modal-context\";\nimport { useIsMobile } from \"./use-is-mobile\";\n\nexport const Command = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n className={cn(\n \"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground\",\n className,\n )}\n {...props}\n />\n));\nCommand.displayName = CommandPrimitive.displayName;\n\n/* ------------------------------------------------------------------ */\n/* Private dialog internals for CommandDialog (host dialog module, */\n/* behavior-identical, portal seam inverted). */\n/* ------------------------------------------------------------------ */\n\nconst DIALOG_DESKTOP_CLASSES =\n \"fixed left-[50%] top-[50%] z-[10000] grid min-w-0 w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 overflow-x-clip border bg-background p-6 shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg\";\n\nconst DIALOG_MOBILE_SHEET_CLASSES =\n \"fixed inset-x-0 bottom-0 left-0 right-0 top-auto z-[10000] flex min-w-0 flex-col w-full max-w-full max-h-[90dvh] translate-x-0 translate-y-0 gap-4 overflow-x-clip border-t bg-background p-4 pb-safe shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full duration-200 rounded-t-2xl rounded-b-none overflow-y-auto overscroll-contain data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom\";\n\n// Re-asserted LAST so the sheet geometry always wins over any caller className.\nconst DIALOG_MOBILE_SHEET_OVERRIDE =\n \"inset-x-0 bottom-0 left-0 right-0 top-auto translate-x-0 translate-y-0 w-full max-w-full max-h-[90dvh] rounded-b-none rounded-t-2xl overflow-y-auto\";\n\nconst CommandDialogContent = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {\n container?: HTMLElement | null;\n }\n>(({ className, children, container, ...props }, ref) => {\n const isMobile = useIsMobile();\n const isModal = useRadixDialogModal();\n const portalContainer = usePortalContainer(container);\n return (\n <DialogPrimitive.Portal container={portalContainer}>\n {isModal ? (\n <DialogPrimitive.Overlay\n className=\"fixed inset-0 z-[10000] bg-[var(--matrx-overlay-scrim-soft)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\"\n />\n ) : null}\n <DialogPrimitive.Content\n ref={ref}\n aria-modal={isModal || undefined}\n aria-describedby={undefined}\n className={cn(\n isMobile ? DIALOG_MOBILE_SHEET_CLASSES : DIALOG_DESKTOP_CLASSES,\n className,\n isMobile && DIALOG_MOBILE_SHEET_OVERRIDE,\n !isModal && \"z-[900]\",\n )}\n {...props}\n >\n {children}\n <DialogPrimitive.Close className=\"absolute right-2 top-4 flex h-10 w-10 items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground sm:right-4\">\n <XIcon className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n );\n});\nCommandDialogContent.displayName = \"CommandDialogContent\";\n\nexport interface CommandDialogProps extends DialogProps {\n /** Explicit portal target for the dialog; beats the injected seam. */\n container?: HTMLElement | null;\n}\n\nexport const CommandDialog = ({\n children,\n container,\n ...props\n}: CommandDialogProps) => {\n const modal = props.modal ?? true;\n return (\n <RadixDialogModalProvider modal={modal}>\n <DialogPrimitive.Root {...props} modal={modal}>\n <CommandDialogContent\n className=\"overflow-hidden p-0\"\n {...(container !== undefined ? { container } : {})}\n >\n <DialogPrimitive.Title className=\"sr-only\"></DialogPrimitive.Title>\n <Command className=\"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\">\n {children}\n </Command>\n </CommandDialogContent>\n </DialogPrimitive.Root>\n </RadixDialogModalProvider>\n );\n};\n\nexport const CommandInput = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Input>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>\n>(({ className, ...props }, ref) => (\n <div className=\"flex items-center border-b px-3\" cmdk-input-wrapper=\"\">\n <MagnifyingGlassIcon className=\"mr-2 h-4 w-4 shrink-0 opacity-50\" />\n <CommandPrimitive.Input\n ref={ref}\n className={cn(\n \"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n {...props}\n />\n </div>\n));\nCommandInput.displayName = CommandPrimitive.Input.displayName;\n\nexport const CommandList = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.List\n ref={ref}\n className={cn(\"max-h-[300px] overflow-y-auto overflow-x-hidden\", className)}\n {...props}\n />\n));\nCommandList.displayName = CommandPrimitive.List.displayName;\n\nexport const CommandEmpty = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Empty>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>((props, ref) => (\n <CommandPrimitive.Empty\n ref={ref}\n className=\"py-6 text-center text-sm\"\n {...props}\n />\n));\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName;\n\nexport const CommandGroup = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Group>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Group\n ref={ref}\n className={cn(\n \"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground\",\n className,\n )}\n {...props}\n />\n));\nCommandGroup.displayName = CommandPrimitive.Group.displayName;\n\nexport const CommandSeparator = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 h-px bg-border\", className)}\n {...props}\n />\n));\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName;\n\nexport const CommandItem = React.forwardRef<\n React.ComponentRef<typeof CommandPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n className,\n )}\n {...props}\n />\n));\nCommandItem.displayName = CommandPrimitive.Item.displayName;\n\nexport const CommandShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground\",\n className,\n )}\n {...props}\n />\n );\n};\nCommandShortcut.displayName = \"CommandShortcut\";\n","\"use client\";\n\n/**\n * Injected portal-container seam.\n *\n * The matrx-frontend original resolved nested portal targets through\n * `useNestedPortalContainer` (explicit prop > dialog content > popout body >\n * document.body) — a host-shaped hook wired to that app's dialog and\n * window-panel systems. The package inverts the seam: hosts provide the\n * resolved container through `PortalContainerProvider`; an explicit\n * `container` prop on a component still wins, and with neither the portal\n * falls through to `document.body` (Radix default). Priority semantics are\n * unchanged from the original.\n */\n\nimport * as React from \"react\";\n\nconst PortalContainerContext = React.createContext<HTMLElement | null | undefined>(\n undefined,\n);\n\nexport interface PortalContainerProviderProps {\n /** Where nested Radix portals (Popover, etc.) should mount. `null`/`undefined` → document.body. */\n container: HTMLElement | null | undefined;\n children: React.ReactNode;\n}\n\nexport function PortalContainerProvider({\n container,\n children,\n}: PortalContainerProviderProps) {\n return (\n <PortalContainerContext.Provider value={container ?? undefined}>\n {children}\n </PortalContainerContext.Provider>\n );\n}\n\n/**\n * Resolve a portal target: explicit prop (including an explicit `null`,\n * meaning \"the default body\") beats the injected container.\n */\nexport function usePortalContainer(\n explicit?: HTMLElement | null,\n): HTMLElement | undefined {\n const injected = React.useContext(PortalContainerContext);\n\n if (explicit !== undefined) {\n return explicit ?? undefined;\n }\n\n return injected ?? undefined;\n}\n","\"use client\";\n\n/**\n * useIsMobile — the ONE breakpoint hook the package's responsive primitives\n * read (CommandDialog and Dialog both auto-render as a bottom sheet below it).\n *\n * Lifted out of `command.tsx`, where it lived privately, when Dialog arrived\n * and needed the SAME answer: two copies of a breakpoint hook is exactly the\n * duplication this package exists to end, and a Dialog that disagreed with a\n * CommandDialog about what \"mobile\" means would render two different sheet\n * geometries on one screen.\n *\n * SSR-safe by construction: `false` until mounted, so the server and the first\n * client paint agree and the desktop geometry is what hydrates. The mobile\n * geometry swaps in on the effect pass.\n *\n * The breakpoint is the host-original 768px (Tailwind `md`). It is exported so\n * a host can branch on the same number instead of inventing a second one.\n */\n\nimport * as React from \"react\";\n\n/** Viewport width (px) below which the package treats a surface as mobile. */\nexport const MOBILE_BREAKPOINT = 768;\n\nexport function useIsMobile(): boolean {\n const [isMobile, setIsMobile] = React.useState(false);\n const [hasMounted, setHasMounted] = React.useState(false);\n\n React.useEffect(() => {\n setHasMounted(true);\n\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n };\n onChange();\n\n // NO ENVIRONMENT MAY CRASH ON THIS HOOK. `matchMedia` is absent in older\n // jsdom setups and in some embedded webviews, and a primitive that throws\n // there takes the whole host's test suite (or screen) down over a\n // breakpoint — a cost wildly out of proportion to the answer. Without it\n // the width read above still gives a correct first answer; only live\n // resize tracking is lost, which is exactly what is unavailable.\n if (typeof window.matchMedia !== \"function\") {\n return undefined;\n }\n\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);\n mql.addEventListener(\"change\", onChange);\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n if (!hasMounted) {\n return false;\n }\n return isMobile;\n}\n","\"use client\";\n\n/**\n * ContextMenu — the right-click menu primitive.\n *\n * THE ROOT RENDERS UNCONDITIONALLY — no hydration mount gate. The gate a\n * matrx-frontend wrapper once carried (\"Radix generates dynamic aria-controls\n * ids that differ between SSR and client\") was false twice over: a CLOSED\n * `ContextMenuTrigger` renders only `data-state` / `data-disabled` and emits\n * no id at all, so there was never a mismatch to defend against. And the gate\n * was actively harmful: the Trigger wraps ALWAYS-VISIBLE content, so `return\n * null` deleted the wrapped subtree from the server render and the first\n * client render — around a list row, that means the list paints EMPTY and\n * fills in after hydration. Gating the Root would additionally orphan any\n * Trigger rendered beneath it.\n *\n * That history is exactly why this belongs in the package: the same repo had\n * already accumulated two copies of this wrapper, one gated and one not, with\n * the CORRECT one sitting unused beside the defective one.\n *\n * This is the PRIMITIVE only. A host's actual right-click menu SYSTEM — the\n * sections, the copy/export/convert actions, the surface registry — composes\n * these parts and stays host-owned; nothing here knows what an action is.\n *\n * Portalling goes through the package's `usePortalContainer` seam so a menu\n * raised inside a Dialog mounts inside it; an explicit `container` wins.\n */\n\nimport * as ContextMenuPrimitive from \"@radix-ui/react-context-menu\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { CheckIcon, DotFilledIcon, RadixChevronRightIcon } from \"./icons\";\nimport { usePortalContainer } from \"./portal-container\";\n\nconst ContextMenu = ContextMenuPrimitive.Root;\nconst ContextMenuTrigger = ContextMenuPrimitive.Trigger;\nconst ContextMenuGroup = ContextMenuPrimitive.Group;\nconst ContextMenuPortal = ContextMenuPrimitive.Portal;\nconst ContextMenuSub = ContextMenuPrimitive.Sub;\nconst ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;\n\nconst SURFACE_CLASS =\n \"z-50 min-w-[8rem] max-h-[var(--radix-context-menu-content-available-height)] overflow-y-auto overflow-x-hidden overscroll-contain rounded-md border bg-popover p-1 text-popover-foreground\";\n\nconst MOTION_CLASS =\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\";\n\nconst ITEM_CLASS =\n \"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\";\n\nconst INDICATOR_ITEM_CLASS =\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\";\n\nconst ContextMenuSubTrigger = React.forwardRef<\n React.ComponentRef<typeof ContextMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <ContextMenuPrimitive.SubTrigger\n ref={ref}\n data-slot=\"context-menu-sub-trigger\"\n className={cn(\n \"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground\",\n inset && \"pl-8\",\n className,\n )}\n {...props}\n >\n {children}\n <RadixChevronRightIcon className=\"ml-auto h-4 w-4\" />\n </ContextMenuPrimitive.SubTrigger>\n));\nContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;\n\nconst ContextMenuSubContent = React.forwardRef<\n React.ComponentRef<typeof ContextMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.SubContent\n ref={ref}\n data-slot=\"context-menu-sub-content\"\n className={cn(SURFACE_CLASS, \"shadow-lg\", MOTION_CLASS, className)}\n {...props}\n />\n));\nContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;\n\nexport interface ContextMenuContentProps\n extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content> {\n /** Explicit portal target; wins over the injected container. */\n container?: HTMLElement | null;\n}\n\nconst ContextMenuContent = React.forwardRef<\n React.ComponentRef<typeof ContextMenuPrimitive.Content>,\n ContextMenuContentProps\n>(({ className, container, ...props }, ref) => {\n const portalContainer = usePortalContainer(container);\n return (\n <ContextMenuPrimitive.Portal container={portalContainer}>\n <ContextMenuPrimitive.Content\n ref={ref}\n data-slot=\"context-menu-content\"\n className={cn(SURFACE_CLASS, \"shadow-md\", MOTION_CLASS, className)}\n {...props}\n />\n </ContextMenuPrimitive.Portal>\n );\n});\nContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;\n\nconst ContextMenuItem = React.forwardRef<\n React.ComponentRef<typeof ContextMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Item\n ref={ref}\n data-slot=\"context-menu-item\"\n className={cn(\n ITEM_CLASS,\n \"gap-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n inset && \"pl-8\",\n className,\n )}\n {...props}\n />\n));\nContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;\n\nconst ContextMenuCheckboxItem = React.forwardRef<\n React.ComponentRef<typeof ContextMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>\n>(({ className, children, ...props }, ref) => (\n <ContextMenuPrimitive.CheckboxItem\n ref={ref}\n data-slot=\"context-menu-checkbox-item\"\n className={cn(INDICATOR_ITEM_CLASS, className)}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <CheckIcon className=\"h-4 w-4\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.CheckboxItem>\n));\nContextMenuCheckboxItem.displayName =\n ContextMenuPrimitive.CheckboxItem.displayName;\n\nconst ContextMenuRadioItem = React.forwardRef<\n React.ComponentRef<typeof ContextMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <ContextMenuPrimitive.RadioItem\n ref={ref}\n data-slot=\"context-menu-radio-item\"\n className={cn(INDICATOR_ITEM_CLASS, className)}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <DotFilledIcon className=\"h-4 w-4 fill-current\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.RadioItem>\n));\nContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;\n\nconst ContextMenuLabel = React.forwardRef<\n React.ComponentRef<typeof ContextMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Label\n ref={ref}\n data-slot=\"context-menu-label\"\n className={cn(\n \"px-2 py-1.5 text-sm font-semibold text-foreground\",\n inset && \"pl-8\",\n className,\n )}\n {...props}\n />\n));\nContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;\n\nconst ContextMenuSeparator = React.forwardRef<\n React.ComponentRef<typeof ContextMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Separator\n ref={ref}\n data-slot=\"context-menu-separator\"\n className={cn(\"-mx-1 my-1 h-px bg-border\", className)}\n {...props}\n />\n));\nContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;\n\nconst ContextMenuShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => (\n <span\n data-slot=\"context-menu-shortcut\"\n className={cn(\"ml-auto text-xs tracking-widest text-muted-foreground\", className)}\n {...props}\n />\n);\nContextMenuShortcut.displayName = \"ContextMenuShortcut\";\n\nexport {\n ContextMenu,\n ContextMenuCheckboxItem,\n ContextMenuContent,\n ContextMenuGroup,\n ContextMenuItem,\n ContextMenuLabel,\n ContextMenuPortal,\n ContextMenuRadioGroup,\n ContextMenuRadioItem,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n ContextMenuTrigger,\n};\n","\"use client\";\n\n/**\n * CreatablePicker — ported verbatim from matrx-frontend\n * `components/ui/creatable-picker.tsx`.\n *\n * P23 — EVERY PICKER TAKES NEW INPUT.\n *\n * Arman, 2026-08-23: \"We have to annihilate the UIs that offer options but\n * don't allow custom entry because those are the ones that lose the platform\n * the best users… the moment I went in to assign a tier, I got a pop up that\n * forced me to choose from the shitty options I had in front of me. So instead\n * of our system getting significantly better because I took the initiative to\n * add something, our system was too arrogant and cocky and didn't want my\n * opinion. … It's the lazy coding agent who builds a popover with a drop down,\n * but is too lazy to include an add feature.\"\n *\n * THIS COMPONENT IS THE ANSWER, and it is the ONLY shape a keyword-system\n * choice control may take. Type-ahead over the existing options, and whatever\n * you typed that matched nothing is offered back as \"Create «what you typed»\".\n * One click turns it into a real row through the feature's ONE write path and\n * selects it — never a second creation path, never a \"go somewhere else first\".\n *\n * P11 — THE ONE EXCEPTION, AND IT IS NEVER A DEAD END. A platform-shared\n * vocabulary (traffic classes, the platform dimensions every tenant shares) is\n * governed centrally, so this control does not pretend it can widen it. It SAYS\n * so and offers the door instead: `lockedNote` + `lockedAction` render a\n * footer that takes the person to \"make this your own dimension\".\n *\n * It knows nothing about any vocabulary. The caller supplies the options and\n * ONE `onCreate` that writes through whatever the canonical path for that\n * vocabulary already is — this component must never grow a write path of its\n * own, or it becomes the second one.\n *\n * SoR: common-docs/systems/marketing/seo/seo-keywords/keyword-system-decisions.md\n * (P23, P11) + value-system.md § THE ASSIGNMENT LAYER.\n *\n * Seam inversions (the only changes from the origin):\n * - Popover/Command come from this package's own primitives (which route\n * portals through the `PortalContainerProvider` seam).\n * - The lucide icons become package-inlined SVGs (C19); `LucideIcon` in the\n * `footerActions` contract becomes the structural `PickerIcon`.\n */\n\nimport {\n useRef,\n useState,\n type ComponentType,\n type ReactNode,\n} from \"react\";\n\nimport { cn } from \"./cn\";\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n} from \"./command\";\nimport {\n ChevronsUpDownIcon,\n ExternalLinkIcon,\n Loader2Icon,\n LockIcon,\n LucideCheckIcon,\n PlusIcon,\n} from \"./icons\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\n\n/** Structural stand-in for the host's `LucideIcon` in `footerActions`. */\nexport type PickerIcon = ComponentType<{ className?: string }>;\n\n/**\n * \"Add a offering…\" is the kind of small wrongness that makes a product feel\n * unfinished, and the noun is caller-supplied so the article has to be derived.\n */\nfunction article(noun: string): string {\n return /^[aeiou]/i.test(noun.trim()) ? `an ${noun}` : `a ${noun}`;\n}\n\nexport interface CreatableOption {\n value: string;\n label: string;\n /** Right-aligned detail — a count, a description, \"yours\". */\n hint?: string;\n /** Rendered instead of the plain label (a band chip, a coloured pill). */\n render?: ReactNode;\n /** Extra words the type-ahead should match on. */\n keywords?: string;\n /**\n * The heading this option files under. Options keep the caller's order; a\n * group is opened the first time an option names it. Omit on every option\n * for a single ungrouped list.\n *\n * THE CATALOG IS NOT A WALL (Arman, 2026-08-24, on being shown offerings\n * that were not his): a set that legitimately holds more than this tenant's\n * own rows says so with a heading instead of hiding the rest.\n */\n group?: string;\n}\n\nexport interface CreatablePickerProps {\n value: string | null;\n options: CreatableOption[];\n onSelect: (value: string) => void;\n placeholder: string;\n searchPlaceholder?: string;\n /** The noun in \"Add a level…\" / \"Create «x»\". Always a person's word. */\n noun: string;\n /**\n * Turns typed text into a real row and returns the option value to select.\n * Return null when the caller handled it another way (opened a dialog that\n * needs more than a name — a level needs a threshold).\n */\n onCreate?: (typed: string) => Promise<string | null>;\n /**\n * Creating this noun needs more than a name, so the picker hands the typed\n * text to the caller's dialog instead of writing anything itself.\n */\n onCreateRequiresMore?: (typed: string) => void;\n disabled?: boolean;\n loading?: boolean;\n className?: string;\n triggerClassName?: string;\n emptyLabel?: string;\n ariaLabel?: string;\n /** P11: a sentence saying this vocabulary is platform-governed. */\n lockedNote?: string;\n /** P11: the door out of that refusal — never leave them with only \"no\". */\n lockedAction?: { label: string; onSelect: () => void };\n /**\n * Rendered inside the create footer, above the create button — for the one\n * extra choice a vocabulary needs at creation time (a category's parent,\n * say). It is a SLOT, not a second write path: whatever it collects is read\n * by the caller's own `onCreate`. A function receives what the person typed,\n * so a slot can offer matching suggestions (e.g. a shared catalog) instead\n * of a fixed block.\n */\n createExtra?: ReactNode | ((typed: string) => ReactNode);\n /**\n * THE MANAGE DOOR. Arman, 2026-08-24: \"where we have 'add' we should also\n * have a 'manage' button that opens that thing in a new tab.\" A control that\n * names a vocabulary must also be able to reach the place that vocabulary is\n * governed — otherwise the person who wants to rename, re-parent, or retire\n * an option has to go hunting for a screen they may not know exists.\n *\n * It opens in a NEW TAB on purpose: nobody loses the row they were editing\n * in order to go look at the catalog.\n */\n manageAction?: { label: string; href: string };\n /**\n * Doors to a DIFFERENT answer than this vocabulary can give. The offering\n * picker's \"this isn't something we offer\" lives here, because that ruling\n * is a traffic class, not an offering — and sending someone to look for\n * another column on their own is the dead end this slot exists to close.\n */\n footerActions?: Array<{\n label: string;\n icon?: PickerIcon;\n onSelect: () => void;\n /** A sentence under the door saying what it does, when it needs one. */\n note?: string;\n }>;\n /**\n * What the TRIGGER shows for the current selection, when the caller wants\n * something other than the option row's own `render`. A dense table cell\n * needs one compact line (\"Data Destruction Services · ITAD\"); the list row\n * it came from is indented and annotated. Same selection, two jobs.\n */\n renderSelected?: ReactNode;\n size?: \"sm\" | \"md\";\n}\n\nexport function CreatablePicker({\n value,\n options,\n onSelect,\n placeholder,\n searchPlaceholder,\n noun,\n onCreate,\n onCreateRequiresMore,\n disabled,\n loading,\n className,\n triggerClassName,\n emptyLabel = \"No match.\",\n ariaLabel,\n lockedNote,\n lockedAction,\n createExtra,\n manageAction,\n footerActions,\n renderSelected,\n size = \"sm\",\n}: CreatablePickerProps) {\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState(\"\");\n const [busy, setBusy] = useState(false);\n /**\n * THE FOOTER IS NEVER A DEAD CLICK. Arman, 2026-08-24: \"one of the options is\n * to allow you to add. When I click add offering, however, nothing happens.\"\n * He was right, and the cause was here, not in the popover: with nothing\n * typed, `create(\"\")` fell straight out of `if (!name) return` and the\n * button ate the click in silence. A control whose whole purpose is P23 may\n * not be the control that ignores you — so an empty \"Add…\" now puts the\n * cursor in the box and SAYS what it wants.\n */\n const inputRef = useRef<HTMLInputElement>(null);\n const [needsName, setNeedsName] = useState(false);\n\n const selected = options.find((option) => option.value === value) ?? null;\n\n // Caller order is the order. A heading opens the first time an option names\n // it, so a tree stays in tree order inside its own heading.\n const groups: Array<{ heading?: string; options: CreatableOption[] }> = [];\n for (const option of options) {\n const last = groups[groups.length - 1];\n if (last && last.heading === option.group) last.options.push(option);\n else\n groups.push(\n option.group === undefined\n ? { options: [option] }\n : { heading: option.group, options: [option] },\n );\n }\n\n const typed = query.trim();\n const exactMatch = options.some(\n (option) => option.label.toLowerCase() === typed.toLowerCase(),\n );\n const canCreate = Boolean(onCreate ?? onCreateRequiresMore) && !lockedNote;\n\n const close = () => {\n setOpen(false);\n setQuery(\"\");\n setNeedsName(false);\n };\n\n const create = async (text: string) => {\n const name = text.trim();\n if (busy) return;\n // `onCreateRequiresMore` opens a dialog that asks for the name itself, so\n // a blank click there is legitimate — it opens the dialog empty. Only the\n // write-it-now path needs a name before it can do anything.\n if (onCreateRequiresMore) {\n close();\n onCreateRequiresMore(name);\n return;\n }\n if (!onCreate) return;\n if (!name) {\n setNeedsName(true);\n inputRef.current?.focus();\n return;\n }\n setBusy(true);\n try {\n const next = await onCreate(name);\n if (next) onSelect(next);\n close();\n } finally {\n setBusy(false);\n }\n };\n\n return (\n <Popover open={open} onOpenChange={(next) => (next ? setOpen(true) : close())}>\n <PopoverTrigger asChild disabled={disabled}>\n <button\n type=\"button\"\n aria-label={ariaLabel ?? placeholder}\n className={cn(\n \"flex w-full items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 text-left shadow-xs transition-colors\",\n \"hover:border-primary/50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n size === \"sm\" ? \"h-8 text-xs\" : \"h-9 text-sm\",\n className,\n triggerClassName,\n )}\n >\n <span className=\"min-w-0 flex-1 truncate\">\n {selected ? (\n (renderSelected ?? selected.render ?? selected.label)\n ) : (\n <span className=\"text-muted-foreground\">\n {loading ? \"Loading…\" : placeholder}\n </span>\n )}\n </span>\n <ChevronsUpDownIcon className=\"size-3.5 shrink-0 opacity-50\" />\n </button>\n </PopoverTrigger>\n <PopoverContent align=\"start\" className=\"w-[--radix-popover-trigger-width] min-w-56 p-0\">\n <Command\n filter={(itemValue, search, keywords) => {\n const haystack = `${itemValue} ${keywords?.join(\" \") ?? \"\"}`.toLowerCase();\n return haystack.includes(search.toLowerCase()) ? 1 : 0;\n }}\n >\n <CommandInput\n ref={inputRef}\n value={query}\n onValueChange={(next) => {\n setQuery(next);\n if (next.trim()) setNeedsName(false);\n }}\n placeholder={searchPlaceholder ?? `Search or add ${article(noun)}…`}\n />\n <CommandList>\n <CommandEmpty>{emptyLabel}</CommandEmpty>\n {groups.map((group) => (\n <CommandGroup\n key={group.heading ?? \"__ungrouped__\"}\n {...(group.heading === undefined\n ? {}\n : { heading: group.heading })}\n >\n {group.options.map((option) => (\n <CommandItem\n key={option.value}\n value={option.label}\n {...(option.keywords\n ? { keywords: [option.keywords] }\n : {})}\n onSelect={() => {\n onSelect(option.value);\n close();\n }}\n className=\"gap-2 text-xs\"\n >\n <LucideCheckIcon\n className={cn(\n \"size-3.5 shrink-0\",\n option.value === value ? \"opacity-100\" : \"opacity-0\",\n )}\n />\n <span className=\"min-w-0 flex-1 truncate\">\n {option.render ?? option.label}\n </span>\n {option.hint ? (\n <span className=\"shrink-0 text-[10px] text-muted-foreground\">\n {option.hint}\n </span>\n ) : null}\n </CommandItem>\n ))}\n </CommandGroup>\n ))}\n </CommandList>\n\n {/* The \"+ Add\" footer sits OUTSIDE CommandList so the search can\n never hide the one thing the person came here to do (P23). */}\n {canCreate ? (\n <div className=\"space-y-1 border-t border-border p-1\">\n {createExtra && typed && !exactMatch ? (\n <div className=\"px-1 pt-0.5\">\n {typeof createExtra === \"function\"\n ? createExtra(typed)\n : createExtra}\n </div>\n ) : null}\n <button\n type=\"button\"\n disabled={busy}\n onClick={() => void create(typed)}\n className=\"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50\"\n >\n {busy ? (\n <Loader2Icon className=\"size-3.5 shrink-0 animate-spin\" />\n ) : (\n <PlusIcon className=\"size-3.5 shrink-0\" />\n )}\n <span className=\"min-w-0 truncate\">\n {typed && !exactMatch\n ? `Create “${typed}”`\n : `Add ${article(noun)}…`}\n </span>\n </button>\n {needsName ? (\n <p className=\"px-2 pb-0.5 text-[11px] leading-snug text-muted-foreground\">\n Type the name of the {noun} you want to add — then this\n creates it.\n </p>\n ) : null}\n </div>\n ) : null}\n\n {/* THE DOORS. Everything this control names must be reachable from\n it: the place the vocabulary is governed, and the other answer\n when this vocabulary is the wrong one to be answering with. */}\n {footerActions?.length || manageAction ? (\n <div className=\"space-y-0.5 border-t border-border p-1\">\n {footerActions?.map((action) => {\n const Icon = action.icon;\n return (\n <div key={action.label}>\n <button\n type=\"button\"\n onClick={() => {\n close();\n action.onSelect();\n }}\n className=\"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n {Icon ? <Icon className=\"size-3.5 shrink-0\" /> : null}\n <span className=\"min-w-0 truncate\">{action.label}</span>\n </button>\n {action.note ? (\n <p className=\"px-2 pb-1 text-[10px] leading-snug text-muted-foreground\">\n {action.note}\n </p>\n ) : null}\n </div>\n );\n })}\n {manageAction ? (\n <a\n href={manageAction.href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n onClick={close}\n className=\"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n <ExternalLinkIcon className=\"size-3.5 shrink-0\" />\n <span className=\"min-w-0 truncate\">{manageAction.label}</span>\n </a>\n ) : null}\n </div>\n ) : null}\n\n {/* P11 — shared vocabulary. Say it, then hand them the door. */}\n {lockedNote ? (\n <div className=\"space-y-1 border-t border-border p-2\">\n <p className=\"flex gap-1.5 text-[11px] leading-snug text-muted-foreground\">\n <LockIcon className=\"mt-px size-3 shrink-0\" />\n <span>{lockedNote}</span>\n </p>\n {lockedAction ? (\n <button\n type=\"button\"\n onClick={() => {\n close();\n lockedAction.onSelect();\n }}\n className=\"flex w-full items-center gap-2 rounded-sm px-1 py-1 text-left text-xs font-medium text-primary transition-colors hover:bg-accent\"\n >\n <PlusIcon className=\"size-3.5 shrink-0\" />\n <span className=\"min-w-0 truncate\">{lockedAction.label}</span>\n </button>\n ) : null}\n </div>\n ) : null}\n </Command>\n </PopoverContent>\n </Popover>\n );\n}\n","\"use client\";\n\n/**\n * Popover — ported verbatim from matrx-frontend `components/ui/popover.tsx`.\n *\n * Seam inversion: the host's `useNestedPortalContainer` (dialog/popout aware)\n * becomes the injected `PortalContainerProvider` seam (`portal-container.tsx`);\n * the explicit `container` prop keeps top priority, exactly as before.\n *\n * THE ROOT RENDERS UNCONDITIONALLY — no mount gate. This wrapper used to defer\n * rendering until after hydration (\"Radix generates dynamic aria-controls ids\n * that differ between SSR and client\"), and that justification was false:\n * Radix ids come from React's SSR-stable `useId` (verified against\n * @radix-ui/react-popover 1.1.17 / react-id 1.1.2). The gate was actively\n * harmful — the Trigger wraps ALWAYS-VISIBLE content, so `return null`\n * deleted it from SSR and the first client paint.\n */\n\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { usePortalContainer } from \"./portal-container\";\n\nexport const Popover = PopoverPrimitive.Root;\n\nexport const PopoverTrigger = PopoverPrimitive.Trigger;\n\nexport const PopoverAnchor = PopoverPrimitive.Anchor;\n\nexport const PopoverContent = React.forwardRef<\n React.ComponentRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> & {\n container?: HTMLElement | null;\n }\n>(\n (\n { className, align = \"center\", sideOffset = 4, container, ...props },\n ref,\n ) => {\n const portalContainer = usePortalContainer(container);\n return (\n <PopoverPrimitive.Portal container={portalContainer}>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n // Cap to the viewport space Radix measured and scroll — a popover taller\n // than the screen must never trap the user with unreachable content.\n // z must EQUAL the dialog layer (z-[10000]), never exceed it: with equal\n // z, DOM portal order decides, so a dialog opened FROM a popover stacks\n // above it, and a popover opened from a dialog still stacks above the\n // dialog. z-[10001] buried dialogs behind fullscreen popovers.\n \"z-[10000] w-72 max-h-[var(--radix-popover-content-available-height)] overflow-y-auto overscroll-contain rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n );\n },\n);\nPopoverContent.displayName = PopoverPrimitive.Content.displayName;\n","\"use client\";\n\n/**\n * Dialog — the modal surface, carrying every ruling the host forks paid for.\n *\n * Four hosts shipped four dialogs. Three were the stock shadcn body: a\n * fixed-size centered card with `overflow: visible`. matrx-frontend's had been\n * hardened, incident by incident, and those hardenings are the reason this\n * component belongs in the package rather than being copied a fifth time:\n *\n * 1. THE ROOT RENDERS UNCONDITIONALLY — no hydration mount gate. The gate a\n * wrapper once carried (\"Radix ids differ between SSR and client\") was\n * false — Radix ids come from React's SSR-stable `useId` — and it deleted\n * the always-visible Trigger from SSR and the first client paint.\n *\n * 2. THE DIALOG IS CLAMPED TO THE VIEWPORT AND SCROLLS INSIDE ITSELF. Proven\n * live: an admin \"Create Category\" dialog rendered 851px tall in a 657px\n * viewport with `overflow-y: visible`, so its Create button sat below the\n * fold, unreachable. The only way out was a backdrop click — which\n * dismisses WITHOUT writing, and is indistinguishable from a silent save\n * failure. `max-h-[85dvh] overflow-y-auto` is the cap.\n *\n * 3. THE PRIMARY ACTION IS ALWAYS PRESSABLE. `DialogFooter` is sticky and\n * bleeds to the card's edges using `--dialog-pad`, so scrolled content\n * never shows through beneath it. Outside a DialogContent the variable is\n * unset, the padding falls back to `0px`, and the footer is the plain row\n * it always was.\n *\n * 4. ON MOBILE THE SAME DIALOG IS A BOTTOM SHEET — full width, bottom\n * anchored, height-capped, internally scrollable, safe-area padded. Opt out\n * with `mobileSheet={false}` only for the rare surface that must stay\n * centered (a tiny spinner). The sheet geometry is re-asserted AFTER the\n * caller's className so a desktop `max-w-2xl` cannot un-fullscreen it.\n *\n * 5. AN UNTITLED DIALOG IS STILL ACCESSIBLE. Radix warns (correctly) that\n * every dialog needs a title; rather than let hosts ship the warning, a\n * visually-hidden title is injected when the tree has none, and\n * `aria-describedby` is dropped when there is no description rather than\n * pointing at nothing.\n *\n * SEAM INVERSIONS. The host original resolved its portal target through\n * app-shaped hooks (a popped-out window-panel body). Here that is the\n * package's `PortalContainerProvider` seam, with an explicit `container` prop\n * keeping top priority. And DialogContent PROVIDES that seam to its own\n * children, so a Popover or menu opened inside a dialog portals INTO the\n * dialog — staying inside the scroll shard, where its wheel events work.\n * `useDialogContainer` exposes the same element for host code that needs it.\n */\n\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport * as VisuallyHidden from \"@radix-ui/react-visually-hidden\";\nimport { treeContainsComponent } from \"@ai-matrx/kit/react-tree\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { XIcon } from \"./icons\";\nimport { usePortalContainer, PortalContainerProvider } from \"./portal-container\";\nimport {\n RadixDialogModalProvider,\n useRadixDialogModal,\n} from \"./radix-dialog-modal-context\";\nimport { useIsMobile } from \"./use-is-mobile\";\n\nconst Dialog = ({\n children,\n ...props\n}: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>) => {\n const modal = props.modal ?? true;\n return (\n <RadixDialogModalProvider modal={modal}>\n <DialogPrimitive.Root {...props} modal={modal}>\n {children}\n </DialogPrimitive.Root>\n </RadixDialogModalProvider>\n );\n};\nDialog.displayName = \"Dialog\";\n\nconst DialogTrigger = DialogPrimitive.Trigger;\nconst DialogClose = DialogPrimitive.Close;\n\n/**\n * Portal-seam-aware DialogPortal. An explicit `container` always wins; with\n * none, the injected `PortalContainerProvider` value decides; with neither,\n * Radix's `document.body`.\n */\nconst DialogPortal = ({\n container,\n ...props\n}: Omit<\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>,\n \"container\"\n> & {\n /** `undefined` → use the injected container; `null` → force document.body. */\n container?: HTMLElement | null | undefined;\n}) => {\n const resolved = usePortalContainer(container);\n return <DialogPrimitive.Portal container={resolved ?? null} {...props} />;\n};\nDialogPortal.displayName = \"DialogPortal\";\n\nconst DialogContainerContext = React.createContext<HTMLElement | null>(null);\n\n/** The DialogContent element, for host code that portals into the dialog. */\nexport const useDialogContainer = (): HTMLElement | null =>\n React.useContext(DialogContainerContext);\n\nconst DialogOverlay = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n data-slot=\"dialog-overlay\"\n className={cn(\n // Page context behind the modal stays readable; separation comes from a\n // light token scrim, not a blur.\n \"fixed inset-0 z-[10000] bg-[var(--matrx-overlay-scrim-soft)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n className,\n )}\n {...props}\n />\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\n/**\n * Unstyled, non-portalling Content for custom dialog layouts. Preserves Radix\n * focus/background behavior and derives `aria-modal` from the Root.\n */\nconst DialogContentPrimitive = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>\n>((props, ref) => {\n const isModal = useRadixDialogModal();\n return (\n <DialogPrimitive.Content\n {...props}\n ref={ref}\n aria-modal={isModal || undefined}\n />\n );\n});\nDialogContentPrimitive.displayName = \"DialogContentPrimitive\";\n\nconst DIALOG_DESKTOP_CLASSES =\n \"fixed left-[50%] top-[50%] z-[10000] grid min-w-0 w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 max-h-[85dvh] overflow-y-auto overscroll-contain [--dialog-pad:1.5rem] overflow-x-clip border bg-background p-6 shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg\";\n\nconst DIALOG_MOBILE_SHEET_CLASSES =\n \"matrx-mobile-sheet fixed inset-x-0 bottom-0 left-0 right-0 top-auto z-[10000] flex min-w-0 flex-col w-full max-w-full max-h-[90dvh] translate-x-0 translate-y-0 gap-4 [--dialog-pad:1rem] overflow-x-clip border-t bg-background p-4 pb-safe shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full duration-200 rounded-t-2xl rounded-b-none overflow-y-auto overscroll-contain data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom\";\n\n// Re-asserted LAST so sheet geometry always wins over a caller className.\nconst DIALOG_MOBILE_SHEET_OVERRIDE =\n \"inset-x-0 bottom-0 left-0 right-0 top-auto translate-x-0 translate-y-0 w-full max-w-full max-h-[90dvh] rounded-b-none rounded-t-2xl overflow-y-auto\";\n\nexport interface DialogContentProps\n extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {\n /** Render as a bottom sheet below the mobile breakpoint. Default `true`. */\n mobileSheet?: boolean;\n /** Render the built-in close control. Default `true`. */\n showCloseButton?: boolean;\n /** Explicit portal target; wins over the injected container. */\n container?: HTMLElement | null;\n}\n\nconst DialogContent = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Content>,\n DialogContentProps\n>(\n (\n {\n className,\n children,\n mobileSheet = true,\n showCloseButton = true,\n container,\n ...props\n },\n ref,\n ) => {\n const isMobile = useIsMobile();\n const isModal = useRadixDialogModal();\n // Falls through to the injected container while `containerEl` is unset\n // (pre-mount) — the original's dialog > popout > body priority.\n const injectedContainer = usePortalContainer(container);\n const asSheet = mobileSheet && isMobile;\n const [containerEl, setContainerEl] = React.useState<HTMLElement | null>(\n null,\n );\n\n const mergedRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n setContainerEl(node);\n if (typeof ref === \"function\") ref(node);\n else if (ref)\n (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n },\n [ref],\n );\n\n const hasTitle =\n treeContainsComponent(children, DialogTitle) ||\n treeContainsComponent(children, DialogPrimitive.Title);\n const hasDescription =\n treeContainsComponent(children, DialogDescription) ||\n treeContainsComponent(children, DialogPrimitive.Description);\n\n return (\n <DialogPortal container={container}>\n {isModal ? <DialogOverlay /> : null}\n <DialogContentPrimitive\n ref={mergedRef}\n data-slot=\"dialog-content\"\n className={cn(\n asSheet ? DIALOG_MOBILE_SHEET_CLASSES : DIALOG_DESKTOP_CLASSES,\n className,\n asSheet && DIALOG_MOBILE_SHEET_OVERRIDE,\n // A non-modal dialog is the coexistence contract for content that\n // can sit beside a host's floating window manager (which starts at\n // z=1000); staying below that boundary makes a newly focused window\n // usable without coupling the two systems.\n !isModal && \"z-[900]\",\n )}\n {...(hasDescription ? {} : { \"aria-describedby\": undefined })}\n {...props}\n >\n {hasTitle ? null : (\n <VisuallyHidden.Root>\n <DialogPrimitive.Title>Dialog</DialogPrimitive.Title>\n </VisuallyHidden.Root>\n )}\n <DialogContainerContext.Provider value={containerEl}>\n <PortalContainerProvider\n container={containerEl ?? injectedContainer ?? null}\n >\n {children}\n </PortalContainerProvider>\n </DialogContainerContext.Provider>\n {showCloseButton ? (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n aria-label=\"Close\"\n className=\"absolute right-2 top-4 flex h-11 w-11 items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground sm:right-4 lg:h-10 lg:w-10\"\n >\n <XIcon className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n ) : null}\n </DialogContentPrimitive>\n </DialogPortal>\n );\n },\n);\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n data-slot=\"dialog-header\"\n className={cn(\n // DialogContent owns an absolute close control. Reserve its hit area in\n // every header so trailing actions never render underneath it.\n \"flex flex-col space-y-1.5 pr-12 text-center sm:text-left\",\n className,\n )}\n {...props}\n />\n);\nDialogHeader.displayName = \"DialogHeader\";\n\nconst DialogFooter = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n \"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n \"sticky bottom-0 z-10 bg-background pt-3\",\n \"mx-[calc(var(--dialog-pad,0px)*-1)] mb-[calc(var(--dialog-pad,0px)*-1)] px-[var(--dialog-pad,0px)] pb-[var(--dialog-pad,0px)]\",\n className,\n )}\n {...props}\n />\n);\nDialogFooter.displayName = \"DialogFooter\";\n\nconst DialogTitle = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n data-slot=\"dialog-title\"\n className={cn(\"text-lg font-semibold leading-none tracking-tight\", className)}\n {...props}\n />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n data-slot=\"dialog-description\"\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogContentPrimitive,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n};\n","\"use client\";\n\n/**\n * DropdownMenu — Radix dropdown with two behaviours the stock body lacks.\n *\n * 1. THE ROOT RENDERS UNCONDITIONALLY — no hydration mount gate. A wrapper in\n * matrx-frontend once deferred rendering until after hydration on a false\n * premise (Radix ids come from React's SSR-stable `useId`), which deleted\n * the always-visible trigger — buttons, `…` menus — from SSR and the first\n * client paint.\n *\n * 2. A LONG MENU SCROLLS INSTEAD OF GROWING OFF-SCREEN. Content and SubContent\n * cap at `--radix-dropdown-menu-content-available-height` — the space Radix\n * actually measured between the trigger and the viewport edge — and scroll\n * past it. Without the cap a menu longer than the viewport puts its last\n * items where no pointer can reach them, and on a short window that can be\n * the only exit from the surface.\n *\n * Portalling goes through the package's `usePortalContainer` seam, so a menu\n * opened inside a Dialog mounts INSIDE the dialog (staying in the scroll\n * shard, where its wheel events work) instead of at `document.body`. An\n * explicit `container` prop still wins.\n *\n * Icons are the package's inlined SVGs (C19) — no icon-library dependency.\n */\n\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { CheckIcon, DotFilledIcon, RadixChevronRightIcon } from \"./icons\";\nimport { usePortalContainer } from \"./portal-container\";\n\nconst DropdownMenu = DropdownMenuPrimitive.Root;\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst MENU_SURFACE_CLASS =\n \"z-[10001] min-w-[8rem] max-h-[var(--radix-dropdown-menu-content-available-height)] overflow-y-auto overflow-x-hidden overscroll-contain rounded-md border bg-popover p-1 text-popover-foreground\";\n\nconst MENU_MOTION_CLASS =\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\";\n\nconst MENU_ITEM_CLASS =\n \"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\";\n\nconst MENU_INDICATOR_ITEM_CLASS =\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\";\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n data-slot=\"dropdown-menu-sub-trigger\"\n className={cn(\n \"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent\",\n inset && \"pl-8\",\n className,\n )}\n {...props}\n >\n {children}\n <RadixChevronRightIcon className=\"ml-auto h-4 w-4\" />\n </DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName =\n DropdownMenuPrimitive.SubTrigger.displayName;\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n data-slot=\"dropdown-menu-sub-content\"\n className={cn(MENU_SURFACE_CLASS, \"shadow-lg\", MENU_MOTION_CLASS, className)}\n {...props}\n />\n));\nDropdownMenuSubContent.displayName =\n DropdownMenuPrimitive.SubContent.displayName;\n\nexport interface DropdownMenuContentProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content> {\n /** Explicit portal target; wins over the injected container. */\n container?: HTMLElement | null;\n}\n\nconst DropdownMenuContent = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Content>,\n DropdownMenuContentProps\n>(({ className, sideOffset = 4, container, ...props }, ref) => {\n const portalContainer = usePortalContainer(container);\n return (\n <DropdownMenuPrimitive.Portal container={portalContainer}>\n <DropdownMenuPrimitive.Content\n ref={ref}\n data-slot=\"dropdown-menu-content\"\n sideOffset={sideOffset}\n className={cn(\n MENU_SURFACE_CLASS,\n \"shadow-md\",\n MENU_MOTION_CLASS,\n className,\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n );\n});\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\nconst DropdownMenuItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n data-slot=\"dropdown-menu-item\"\n className={cn(MENU_ITEM_CLASS, inset && \"pl-8\", className)}\n {...props}\n />\n));\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n data-slot=\"dropdown-menu-checkbox-item\"\n className={cn(MENU_INDICATOR_ITEM_CLASS, className)}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CheckIcon className=\"h-4 w-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName =\n DropdownMenuPrimitive.CheckboxItem.displayName;\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n data-slot=\"dropdown-menu-radio-item\"\n className={cn(MENU_INDICATOR_ITEM_CLASS, className)}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <DotFilledIcon className=\"h-4 w-4 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n));\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n data-slot=\"dropdown-menu-label\"\n className={cn(\"px-2 py-1.5 text-sm font-semibold\", inset && \"pl-8\", className)}\n {...props}\n />\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n data-slot=\"dropdown-menu-separator\"\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nconst DropdownMenuShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\"ml-auto text-xs tracking-widest opacity-60\", className)}\n {...props}\n />\n);\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\";\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n};\n","\"use client\";\n\n/**\n * EditableLabel — inline rename-in-place text.\n *\n * Ported verbatim from matrx-frontend\n * `components/official/item/EditableLabel.tsx` (S16). Commit on Enter/blur,\n * Esc cancels, whitespace-only falls back to `emptyFallback` (or cancels),\n * stays in sync with upstream `value` while not editing. Decoupled from any\n * store — `onCommit(next)` is the only side-effect channel.\n *\n * Three activation modes:\n * - \"click\" → click the display text to edit (header titles)\n * - \"doubleClick\" → double-click to edit (rows where single-click selects)\n * - \"controlled\" → host owns `editing`; this renders ONLY the input while\n * editing (the host renders its own display element)\n *\n * Seam inversions:\n * - Prop types come with the component instead of the host's item-system\n * `types.ts` (identical shapes).\n * - The lucide `Loader2` busy spinner is the package's inlined SVG (C19).\n */\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { cn } from \"./cn\";\nimport { Loader2Icon } from \"./icons\";\n\nexport type EditableLabelCommitMode = \"optimistic\" | \"await\";\nexport type EditableLabelActivation = \"click\" | \"doubleClick\" | \"controlled\";\n\nexport interface EditableLabelProps {\n value: string;\n /**\n * Commit handler. optimistic (default): edit mode exits immediately, the\n * promise is fire-and-forget (owners do optimistic update + revert + toast).\n * await: input disables with a spinner until the promise resolves; a\n * rejection keeps edit mode open to retry.\n */\n onCommit: (next: string) => void | Promise<void>;\n commitMode?: EditableLabelCommitMode;\n /** Return an error message to block the commit (shown under the input). */\n validate?: (next: string) => string | null;\n /** Used when the trimmed draft is empty. Undefined → empty cancels. */\n emptyFallback?: string;\n maxLength?: number; // default 120\n /**\n * \"click\"/\"doubleClick\" — internal edit state (headers). \"controlled\" — host\n * owns `editing`; EditableLabel renders ONLY the input when editing.\n */\n activation?: EditableLabelActivation;\n editing?: boolean; // controlled mode\n /** Edit-state notifications. Controlled mode: the ONLY state channel.\n * Uncontrolled modes: fired as a notification (layout hooks etc.). */\n onEditingChange?: (editing: boolean) => void;\n selectOnEdit?: boolean; // default true\n placeholder?: string;\n /** Accessible name, e.g. \"Session title\". Default \"Name\". */\n ariaLabel?: string;\n truncate?: boolean; // display mode, default true\n className?: string; // both modes\n displayClassName?: string;\n inputClassName?: string;\n}\n\nexport function EditableLabel({\n value,\n onCommit,\n commitMode = \"optimistic\",\n validate,\n emptyFallback,\n maxLength = 120,\n activation = \"click\",\n editing: editingProp,\n onEditingChange,\n selectOnEdit = true,\n placeholder,\n ariaLabel = \"Name\",\n truncate = true,\n className,\n displayClassName,\n inputClassName,\n}: EditableLabelProps) {\n const controlled = activation === \"controlled\";\n const [internalEditing, setInternalEditing] = useState(false);\n const editing = controlled ? !!editingProp : internalEditing;\n\n const [draft, setDraft] = useState(value);\n const [error, setError] = useState<string | null>(null);\n const [busy, setBusy] = useState(false);\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n // Stay in sync with upstream changes (realtime / auto-label) while idle.\n useEffect(() => {\n if (!editing) setDraft(value);\n }, [value, editing]);\n\n // Focus + select on entering edit mode.\n useEffect(() => {\n if (editing && inputRef.current) {\n inputRef.current.focus();\n if (selectOnEdit) inputRef.current.select();\n }\n }, [editing, selectOnEdit]);\n\n const setEditing = useCallback(\n (next: boolean) => {\n if (controlled) {\n onEditingChange?.(next);\n } else {\n // Uncontrolled hosts still get notified — lets them adjust layout\n // (e.g. widen the edit box) without taking over the edit state.\n setInternalEditing(next);\n onEditingChange?.(next);\n }\n },\n [controlled, onEditingChange],\n );\n\n const startEdit = useCallback(() => {\n setDraft(value);\n setError(null);\n setEditing(true);\n }, [value, setEditing]);\n\n const cancel = useCallback(() => {\n setDraft(value);\n setError(null);\n setBusy(false);\n setEditing(false);\n }, [value, setEditing]);\n\n const commit = useCallback(() => {\n if (busy) return;\n const trimmed = draft.trim();\n const next = trimmed || emptyFallback;\n\n // Empty + no fallback → cancel rather than commit garbage.\n if (next === undefined) {\n cancel();\n return;\n }\n\n const validationError = validate?.(next) ?? null;\n if (validationError) {\n setError(validationError);\n return;\n }\n\n // No-op commit — skip the side effect entirely.\n if (next === value) {\n setEditing(false);\n setError(null);\n return;\n }\n\n if (commitMode === \"await\") {\n const result = onCommit(next);\n if (result instanceof Promise) {\n setBusy(true);\n result\n .then(() => {\n setBusy(false);\n setEditing(false);\n })\n .catch(() => {\n // Keep edit mode open so the user can retry.\n setBusy(false);\n });\n return;\n }\n setEditing(false);\n return;\n }\n\n // optimistic — exit immediately, fire-and-forget.\n setEditing(false);\n setError(null);\n const result = onCommit(next);\n if (result instanceof Promise) result.catch(() => {});\n }, [\n busy,\n draft,\n emptyFallback,\n validate,\n value,\n commitMode,\n onCommit,\n cancel,\n setEditing,\n ]);\n\n if (editing) {\n return (\n <span className={cn(\"relative flex min-w-0 flex-1 items-center\", className)}>\n <input\n ref={inputRef}\n type=\"text\"\n value={draft}\n disabled={busy}\n placeholder={placeholder}\n onChange={(e) => {\n setDraft(e.target.value);\n if (error) setError(null);\n }}\n onBlur={commit}\n onClick={(e) => e.stopPropagation()}\n onDoubleClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => {\n // Contain editing keystrokes so host rows / global hotkeys stay quiet.\n if (e.key === \"Enter\") {\n e.preventDefault();\n e.stopPropagation();\n commit();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n cancel();\n } else if (e.key === \" \") {\n e.stopPropagation();\n }\n }}\n maxLength={maxLength}\n aria-label={ariaLabel}\n aria-invalid={error ? true : undefined}\n // 16px on mobile prevents iOS focus-zoom; sm on desktop.\n className={cn(\n \"w-full min-w-0 rounded-sm bg-transparent px-1 outline-none\",\n \"text-base md:text-sm\",\n \"focus:bg-background focus:ring-1 focus:ring-ring\",\n busy && \"opacity-60\",\n inputClassName,\n )}\n />\n {busy && (\n <Loader2Icon className=\"absolute right-1 h-3.5 w-3.5 animate-spin text-muted-foreground\" />\n )}\n {error && (\n <span className=\"absolute left-0 top-full mt-0.5 whitespace-nowrap text-xs text-destructive\">\n {error}\n </span>\n )}\n </span>\n );\n }\n\n // Controlled mode: host owns the display; render nothing while idle.\n if (controlled) return null;\n\n return (\n <button\n type=\"button\"\n onClick={\n activation === \"click\"\n ? (e) => {\n e.stopPropagation();\n startEdit();\n }\n : undefined\n }\n onDoubleClick={\n activation === \"doubleClick\"\n ? (e) => {\n e.stopPropagation();\n startEdit();\n }\n : undefined\n }\n onKeyDown={(e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n e.stopPropagation();\n startEdit();\n }\n }}\n title={activation === \"doubleClick\" ? \"Double-click to rename\" : \"Click to rename\"}\n aria-label={`Rename ${ariaLabel.toLowerCase()}: ${value}`}\n className={cn(\n \"min-w-0 max-w-full rounded-sm px-1 text-left transition-colors\",\n \"hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\",\n truncate && \"block truncate\",\n className,\n displayClassName,\n )}\n >\n {value || placeholder || \"\"}\n </button>\n );\n}\n","\"use client\";\n\n/**\n * Input family — ported verbatim from matrx-frontend `components/ui/input.tsx`.\n *\n * Seam inversions:\n * - `MatrxVariant` (host `components/ui/types`) becomes the structural\n * `InputVariant` union with the identical members, so host call sites are\n * drop-in compatible.\n * - The host file's `CopyInput` / `FancyInput` / `DeleteInput` are\n * deliberately NOT absorbed (C8 split-out law): they carry a `motion/react`\n * dependency (and clipboard behavior) that plain-Input consumers must not\n * pay for. They stay host-owned until sanctioned separately.\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport type InputVariant =\n | \"default\"\n | \"destructive\"\n | \"success\"\n | \"outline\"\n | \"secondary\"\n | \"ghost\"\n | \"link\"\n | \"primary\";\n\nexport interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {\n variant?: InputVariant;\n}\n\nconst getVariantStyles = (variant: InputVariant = \"default\") => {\n const baseStyles = `flex h-10 w-full border border-border bg-background text-foreground shadow-input rounded-md px-3 py-2 text-sm file:border-0 file:bg-transparent\n file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground\n focus-visible:outline-none focus-visible:ring-[2px] focus-visible:ring-ring\n disabled:cursor-not-allowed disabled:opacity-50\n dark:shadow-none\n transition duration-400\n [&:-webkit-autofill]:bg-background [&:-webkit-autofill]:shadow-[0_0_0_1000px_hsl(var(--background))_inset] [&:-webkit-autofill]:[caret-color:currentColor]\n dark:[&:-webkit-autofill]:shadow-[0_0_0_1000px_hsl(var(--background))_inset] dark:[&:-webkit-autofill]:[-webkit-text-fill-color:hsl(var(--foreground))]\n [&:-webkit-autofill:hover]:shadow-[0_0_0_1000px_hsl(var(--background))_inset] [&:-webkit-autofill:focus]:shadow-[0_0_0_1000px_hsl(var(--background))_inset]`;\n\n switch (variant) {\n case \"destructive\":\n return `${baseStyles} bg-destructive text-destructive-foreground`;\n case \"outline\":\n return `${baseStyles} border-2`;\n case \"secondary\":\n return `${baseStyles} bg-secondary text-secondary-foreground`;\n case \"ghost\":\n return `${baseStyles} bg-transparent shadow-none`;\n case \"link\":\n return `${baseStyles} bg-transparent underline-offset-4 hover:underline`;\n case \"primary\":\n return `${baseStyles} bg-primary text-primary-foreground`;\n default:\n return baseStyles;\n }\n};\n\nexport const Input = React.forwardRef<HTMLInputElement, InputProps>(\n ({ className, type, variant = \"default\", ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(getVariantStyles(variant), className)}\n ref={ref}\n {...props}\n />\n );\n },\n);\nInput.displayName = \"Input\";\n\nexport interface EnterInputProps extends InputProps {\n onEnter?: () => void;\n}\n\nexport const EnterInput = React.forwardRef<HTMLInputElement, EnterInputProps>(\n ({ onEnter, ...props }, ref) => {\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\" && onEnter) {\n e.preventDefault();\n onEnter();\n }\n };\n\n return (\n <Input\n {...props}\n ref={ref}\n onKeyDown={(e) => {\n handleKeyDown(e);\n if (props.onKeyDown) {\n props.onKeyDown(e);\n }\n }}\n />\n );\n },\n);\n\nEnterInput.displayName = \"EnterInput\";\n\nexport const BasicInput = React.forwardRef<HTMLInputElement, InputProps>(\n // `variant` is accepted (prop-compatible with Input) but intentionally\n // unused — and destructured so it never leaks onto the DOM element.\n ({ className, type, variant: _variant = \"default\", ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n \"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n ref={ref}\n {...props}\n />\n );\n },\n);\nBasicInput.displayName = \"BasicInput\";\n\nexport interface InputWithPrefixProps extends Omit<InputProps, \"prefix\"> {\n prefix?: React.ReactNode;\n wrapperClassName?: string;\n}\n\nexport const InputWithPrefix = React.forwardRef<\n HTMLInputElement,\n InputWithPrefixProps\n>(({ prefix, className, wrapperClassName, ...props }, ref) => {\n return (\n <div className={cn(\"relative\", wrapperClassName)}>\n {prefix && (\n <div className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\">\n {prefix}\n </div>\n )}\n <Input\n ref={ref}\n className={cn(prefix && \"pl-10\", className)}\n {...props}\n />\n </div>\n );\n});\nInputWithPrefix.displayName = \"InputWithPrefix\";\n","\"use client\";\n\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport const Label = React.forwardRef<\n React.ComponentRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <LabelPrimitive.Root\n ref={ref}\n className={cn(\n \"text-sm font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n className,\n )}\n {...props}\n />\n));\nLabel.displayName = LabelPrimitive.Root.displayName;\n","\"use client\";\n\n/**\n * OverflowToolbar — a horizontal row of consistent, compact action buttons\n * that collapses the buttons that don't fit into a single \"more\" (…) menu.\n * Ported verbatim from matrx-frontend\n * `components/official/toolbar/OverflowToolbar.tsx` (S20).\n *\n * ┌───────────────────────────────────────────────┐\n * │ [leading] [Btn] [Btn] [Btn] [ … ] │\n * └───────────────────────────────────────────────┘\n *\n * Design rules (the primitive enforces them so callers can't drift):\n * - Every button is the same height (h-7), padding, text size, icon size.\n * - `hideLabel` renders an icon-only button with a tooltip — use it for\n * \"obvious\" actions (Find, Source, …).\n * - `tone: \"primary\"` colors a button without changing its size, so the\n * primary action is NOT visually larger than the rest.\n * - When the row is too narrow, the LAST actions collapse into the overflow\n * menu first. Order your actions most-important-first.\n *\n * Measurement is done with a hidden \"ghost\" row (always renders every action\n * + the kebab) read via a ResizeObserver, so the visible row never reflows\n * mid-frame.\n *\n * Seam inversions (host-shaped chrome becomes injected):\n * - `icon: LucideIcon` → the structural `ToolbarIcon`\n * (`ComponentType<{ className?: string }>`) — any SVG component fits.\n * - The host Tooltip wrapper → `renderTooltip` prop. Without it, icon-only\n * buttons render bare (they always carry `aria-label`); hosts inject their\n * tooltip system for the original hover behavior.\n * - The host ItemMenu overflow menu → `renderOverflowMenu` prop (required):\n * the host receives the collapsed actions plus the ready-made kebab trigger\n * and renders them with its own menu system.\n */\n\nimport React, { useLayoutEffect, useMemo, useRef, useState } from \"react\";\n\nimport { cn } from \"./cn\";\nimport { Loader2Icon, MoreHorizontalIcon } from \"./icons\";\n\nexport type ToolbarActionTone = \"default\" | \"primary\" | \"destructive\";\n\n/** Structural icon contract (a lucide icon satisfies it, so does any SVG component). */\nexport type ToolbarIcon = React.ComponentType<{ className?: string }>;\n\nexport interface ToolbarAction {\n id: string;\n label: string;\n icon: ToolbarIcon;\n /** Click handler. Ignored when `href` is set. */\n onSelect?: () => void;\n /** Renders an anchor instead of a button. */\n href?: string;\n target?: \"_blank\";\n disabled?: boolean;\n /** Swaps the icon for a spinner and (optionally) shows `runningLabel`. */\n running?: boolean;\n runningLabel?: string;\n tone?: ToolbarActionTone;\n /** Icon-only button (tooltip carries the label). For obvious actions. */\n hideLabel?: boolean;\n /** Drop the action entirely. */\n hidden?: boolean;\n}\n\nexport interface OverflowToolbarProps {\n actions: ToolbarAction[];\n /**\n * Optional element pinned at the start of the row — never collapsed, never\n * measured into the action budget except as a fixed prefix (e.g. a surface\n * switcher / context chip cluster).\n */\n leading?: React.ReactNode;\n /** Accessible label for the overflow trigger. */\n overflowAriaLabel?: string;\n className?: string;\n /**\n * Injected overflow-menu seam: render the collapsed actions with the host's\n * menu system, using `trigger` (the ready-made kebab button) as the menu\n * trigger element.\n */\n renderOverflowMenu: (args: {\n actions: ToolbarAction[];\n trigger: React.ReactNode;\n }) => React.ReactNode;\n /**\n * Injected tooltip seam for icon-only buttons (their label lives nowhere\n * else on screen). Omitted → the bare control renders (aria-label intact).\n */\n renderTooltip?: (control: React.ReactElement, label: string) => React.ReactNode;\n}\n\nconst GAP_PX = 6; // gap-1.5\n\n// ── Button ──────────────────────────────────────────────────────────────────\n\nconst TONE: Record<ToolbarActionTone, string> = {\n default: \"border border-border bg-background hover:bg-accent text-foreground\",\n primary: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive:\n \"border border-destructive/40 text-destructive hover:bg-destructive/10\",\n};\n\nfunction ToolbarButton({\n action,\n enableTooltip = false,\n renderTooltip,\n}: {\n action: ToolbarAction;\n /** Wrap icon-only buttons in a styled tooltip. Off for the ghost row. */\n enableTooltip?: boolean;\n renderTooltip?:\n | ((control: React.ReactElement, label: string) => React.ReactNode)\n | undefined;\n}) {\n const tone = action.tone ?? \"default\";\n const Icon = action.running ? Loader2Icon : action.icon;\n const showLabel =\n !action.hideLabel || (action.running && action.runningLabel);\n const text =\n action.running && action.runningLabel ? action.runningLabel : action.label;\n\n const className = cn(\n \"inline-flex items-center gap-1 h-7 rounded-md text-[11px] font-medium transition-colors whitespace-nowrap\",\n \"disabled:opacity-50 disabled:pointer-events-none\",\n action.hideLabel && !action.running ? \"w-7 justify-center px-0\" : \"px-2\",\n TONE[tone],\n );\n\n const inner = (\n <>\n <Icon\n className={cn(\"w-3.5 h-3.5 shrink-0\", action.running && \"animate-spin\")}\n />\n {showLabel && <span>{text}</span>}\n </>\n );\n\n const control =\n action.href && !action.disabled ? (\n <a\n href={action.href}\n target={action.target}\n rel={action.target === \"_blank\" ? \"noopener noreferrer\" : undefined}\n className={className}\n aria-label={action.label}\n >\n {inner}\n </a>\n ) : (\n <button\n type=\"button\"\n onClick={action.onSelect}\n disabled={action.disabled}\n className={className}\n aria-label={action.label}\n >\n {inner}\n </button>\n );\n\n // Icon-only buttons need a styled tooltip to be discoverable — the label\n // lives nowhere else on screen. Labeled buttons are self-describing.\n if (enableTooltip && action.hideLabel && renderTooltip) {\n return <>{renderTooltip(control, action.label)}</>;\n }\n\n return control;\n}\n\nfunction OverflowTrigger({ ariaLabel }: { ariaLabel: string }) {\n return (\n <button\n type=\"button\"\n aria-label={ariaLabel}\n aria-haspopup=\"menu\"\n title=\"More actions\"\n className={cn(\n \"inline-flex items-center justify-center h-7 w-7 rounded-md transition-colors\",\n \"border border-border bg-background hover:bg-accent text-foreground\",\n )}\n >\n <MoreHorizontalIcon className=\"w-3.5 h-3.5\" />\n </button>\n );\n}\n\n// ── Toolbar ───────────────────────────────────────────────────────────────\n\nexport function OverflowToolbar({\n actions,\n leading,\n overflowAriaLabel = \"More actions\",\n className,\n renderOverflowMenu,\n renderTooltip,\n}: OverflowToolbarProps) {\n const visibleActions = useMemo(\n () => actions.filter((a) => !a.hidden),\n [actions],\n );\n\n const containerRef = useRef<HTMLDivElement>(null);\n const ghostRef = useRef<HTMLDivElement>(null);\n // The leading slot renders ONCE (in the visible row) — it may host a\n // stateful/data-fetching component, so we never duplicate it into the ghost.\n // Its width is read directly off this ref instead.\n const leadingRef = useRef<HTMLSpanElement>(null);\n const [visibleCount, setVisibleCount] = useState(visibleActions.length);\n\n // Re-measure whenever the rendered text/state of any action changes (label,\n // icon-only mode, or running label all change a button's width).\n const signature = visibleActions\n .map(\n (a) =>\n `${a.id}:${a.hideLabel ? 1 : 0}:${a.running ? 1 : 0}:${a.runningLabel ?? \"\"}:${a.label}`,\n )\n .join(\"|\");\n\n useLayoutEffect(() => {\n const container = containerRef.current;\n const ghost = ghostRef.current;\n if (!container || !ghost) return undefined;\n\n const compute = () => {\n const available = container.clientWidth;\n const n = visibleActions.length;\n const children = Array.from(ghost.children) as HTMLElement[];\n const hasLeading = leading != null;\n const leadingW = hasLeading ? (leadingRef.current?.offsetWidth ?? 0) : 0;\n const itemW = (i: number) => children[i]?.offsetWidth ?? 0;\n const kebabW = children[n]?.offsetWidth ?? 28;\n\n // Width consumed by the always-present leading slot.\n const base = leadingW + (hasLeading && n > 0 ? GAP_PX : 0);\n\n // Does everything fit with no kebab?\n let totalAll = base;\n for (let i = 0; i < n; i++) totalAll += itemW(i) + (i > 0 ? GAP_PX : 0);\n if (totalAll <= available) {\n setVisibleCount(n);\n return;\n }\n\n // Otherwise fit as many as possible while reserving room for the kebab.\n let used = base;\n let count = 0;\n for (let i = 0; i < n; i++) {\n const add = itemW(i) + (count > 0 ? GAP_PX : 0);\n if (used + add + GAP_PX + kebabW <= available) {\n used += add;\n count += 1;\n } else break;\n }\n setVisibleCount(count);\n };\n\n compute();\n const ro = new ResizeObserver(compute);\n ro.observe(container);\n return () => ro.disconnect();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [signature, leading != null]);\n\n const shown = visibleActions.slice(0, visibleCount);\n const hidden = visibleActions.slice(visibleCount);\n\n return (\n <div ref={containerRef} className={cn(\"relative min-w-0\", className)}>\n {/* Ghost measuring row — every action button + kebab, never visible.\n The leading slot is intentionally NOT duplicated here (it may be a\n stateful/fetching component); its width is read off `leadingRef`. */}\n <div\n ref={ghostRef}\n aria-hidden\n className=\"pointer-events-none absolute left-0 top-0 flex items-center gap-1.5 opacity-0\"\n >\n {visibleActions.map((a) => (\n <ToolbarButton key={a.id} action={a} />\n ))}\n <OverflowTrigger ariaLabel={overflowAriaLabel} />\n </div>\n\n {/* Visible row — right-aligned cluster that collapses overflow. */}\n <div className=\"flex items-center justify-end gap-1.5\">\n {leading != null && (\n <span ref={leadingRef} className=\"shrink-0\">\n {leading}\n </span>\n )}\n {shown.map((a) => (\n <ToolbarButton\n key={a.id}\n action={a}\n enableTooltip\n renderTooltip={renderTooltip}\n />\n ))}\n {hidden.length > 0 &&\n renderOverflowMenu({\n actions: hidden,\n trigger: <OverflowTrigger ariaLabel={overflowAriaLabel} />,\n })}\n </div>\n </div>\n );\n}\n","\"use client\";\n\n/**\n * Progress — a determinate bar.\n *\n * THE INDETERMINATE CASE IS NOT SILENT. Radix treats `value={null}` (or an\n * omitted value) as indeterminate, and the shadcn fork every host copied\n * computed `translateX(-${100 - (value || 0)}%)`, which turns an unknown value\n * into a confident, wrong \"0%\" — a bar that says the work has not started when\n * the truth is that nobody knows. Here an indeterminate bar renders a moving\n * sweep and carries `data-state=\"indeterminate\"`, so it LOOKS different from\n * stalled-at-zero.\n *\n * `tone` maps the fill onto the semantic status tokens, rather than leaving a\n * host to reach for a raw palette utility on a failing bar.\n */\n\nimport * as ProgressPrimitive from \"@radix-ui/react-progress\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport type ProgressTone = \"default\" | \"success\" | \"warning\" | \"destructive\";\n\nconst PROGRESS_TONES: Record<ProgressTone, string> = {\n default: \"bg-primary\",\n success: \"bg-success\",\n warning: \"bg-warning\",\n destructive: \"bg-destructive\",\n};\n\nexport interface ProgressProps\n extends React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root> {\n /** Fill colour, from the semantic status tokens. Default `default`. */\n tone?: ProgressTone;\n /** Classes for the moving fill. */\n indicatorClassName?: string;\n}\n\nconst Progress = React.forwardRef<\n React.ComponentRef<typeof ProgressPrimitive.Root>,\n ProgressProps\n>(({ className, tone = \"default\", indicatorClassName, ...props }, ref) => {\n const { value, max } = props;\n const ceiling = max ?? 100;\n const isIndeterminate = value === null || value === undefined;\n const pct = isIndeterminate\n ? 0\n : Math.min(100, Math.max(0, (value / ceiling) * 100));\n\n return (\n <ProgressPrimitive.Root\n ref={ref}\n data-slot=\"progress\"\n className={cn(\n \"relative h-2 w-full overflow-hidden rounded-full bg-primary/20\",\n className,\n )}\n {...props}\n >\n <ProgressPrimitive.Indicator\n data-slot=\"progress-indicator\"\n className={cn(\n \"h-full w-full flex-1 transition-all\",\n PROGRESS_TONES[tone],\n isIndeterminate && \"matrx-progress-indeterminate\",\n indicatorClassName,\n )}\n style={\n isIndeterminate ? undefined : { transform: `translateX(-${100 - pct}%)` }\n }\n />\n </ProgressPrimitive.Root>\n );\n});\nProgress.displayName = ProgressPrimitive.Root.displayName;\n\nexport { Progress };\n","\"use client\";\n\n/**\n * ScrollArea — Radix scroll area with a custom, token-coloured scrollbar.\n *\n * Every fork was the same component; what they could not share was the\n * VIEWPORT. Radix renders an internal `display: table` div inside the\n * viewport, and workflow-studio's fork had to reach through it\n * (`[&>div]:!block [&>div]:min-w-0`) so long content wraps instead of forcing\n * the table cell wider than its container. That is the exact reason a host\n * forks: a class it cannot pass. So the viewport is addressable here —\n * `viewportClassName` and `viewportRef` — and nobody needs a copy to style it.\n *\n * `viewportRef` also unlocks the thing hosts hand-rolled around this\n * component: programmatic scrolling (scroll-to-bottom on a new message,\n * restoring a position) needs the scrolling element, and the Root's ref is not\n * it.\n *\n * The thumb reads `bg-border`; a host that wants workflow-studio's dimmer\n * thumb passes `scrollBarClassName`.\n */\n\nimport * as ScrollAreaPrimitive from \"@radix-ui/react-scroll-area\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport interface ScrollAreaProps\n extends React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> {\n /** Classes for the scrolling viewport (not the Root). */\n viewportClassName?: string;\n /** Ref to the scrolling element — the one `scrollTop` lives on. */\n viewportRef?: React.Ref<HTMLDivElement>;\n /** Classes for the vertical scrollbar this component renders. */\n scrollBarClassName?: string;\n /** Scrollbar orientation to render. Default `vertical`. */\n orientation?: \"vertical\" | \"horizontal\";\n}\n\nconst ScrollArea = React.forwardRef<\n React.ComponentRef<typeof ScrollAreaPrimitive.Root>,\n ScrollAreaProps\n>(\n (\n {\n className,\n children,\n viewportClassName,\n viewportRef,\n scrollBarClassName,\n orientation = \"vertical\",\n ...props\n },\n ref,\n ) => (\n <ScrollAreaPrimitive.Root\n ref={ref}\n data-slot=\"scroll-area\"\n className={cn(\"relative overflow-hidden\", className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport\n ref={viewportRef}\n data-slot=\"scroll-area-viewport\"\n className={cn(\"h-full w-full rounded-[inherit]\", viewportClassName)}\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n <ScrollBar orientation={orientation} className={scrollBarClassName} />\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n ),\n);\nScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;\n\nconst ScrollBar = React.forwardRef<\n React.ComponentRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,\n React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>\n>(({ className, orientation = \"vertical\", ...props }, ref) => (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n ref={ref}\n data-slot=\"scroll-area-scrollbar\"\n orientation={orientation}\n className={cn(\n \"flex touch-none select-none transition-colors\",\n orientation === \"vertical\" &&\n \"h-full w-2.5 border-l border-l-transparent p-[1px]\",\n orientation === \"horizontal\" &&\n \"h-2.5 flex-col border-t border-t-transparent p-[1px]\",\n className,\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb\n data-slot=\"scroll-area-thumb\"\n className=\"relative flex-1 rounded-full bg-border\"\n />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n));\nScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;\n\nexport { ScrollArea, ScrollBar };\n","\"use client\";\n\n/**\n * ScoreRing — SVG progress ring + the shared score→color threshold semantics.\n * Ported verbatim from matrx-frontend `components/official/ScoreRing.tsx`\n * (S18). The thresholds ARE the product: green at/above `good`, orange\n * at/above `warning`, red below, muted for null. No seams.\n */\n\nimport { cn } from \"./cn\";\n\nexport interface ScoreThresholds {\n /** Scores at or above this value are green. */\n good: number;\n /** Scores at or above this value (but below good) are orange. */\n warning: number;\n}\n\nexport const DEFAULT_SCORE_THRESHOLDS: ScoreThresholds = {\n good: 75,\n warning: 50,\n};\n\n/** Semantic score color shared by ring and accent consumers. */\nexport function scoreRingColorClasses(\n pct: number | null,\n thresholds: ScoreThresholds = DEFAULT_SCORE_THRESHOLDS,\n): string {\n if (pct === null) return \"text-muted-foreground\";\n if (pct >= thresholds.good) return \"text-success\";\n if (pct >= thresholds.warning) return \"text-warning\";\n return \"text-destructive\";\n}\n\n/** Solid-background twin of `scoreRingColorClasses`. */\nexport function scoreAccentBgClasses(\n pct: number | null,\n thresholds: ScoreThresholds = DEFAULT_SCORE_THRESHOLDS,\n): string {\n if (pct === null) return \"bg-muted-foreground/30\";\n if (pct >= thresholds.good) return \"bg-success\";\n if (pct >= thresholds.warning) return \"bg-warning\";\n return \"bg-destructive\";\n}\n\nexport interface ScoreRingProps {\n pct: number | null;\n size?: number;\n strokeWidth?: number;\n label?: string;\n valueClassName?: string;\n className?: string;\n thresholds?: ScoreThresholds;\n /** Visible suffix; study keeps `%`, while Lighthouse convention omits it. */\n suffix?: string;\n}\n\n/**\n * Shared SVG score ring. `pct` is 0–100; threshold semantics are supplied by\n * the domain (for example Lighthouse uses 90/50 while study uses 75/50).\n */\nexport function ScoreRing({\n pct,\n size = 112,\n strokeWidth = 8,\n label,\n valueClassName,\n className,\n thresholds = DEFAULT_SCORE_THRESHOLDS,\n suffix = \"%\",\n}: ScoreRingProps) {\n const radius = 50 - strokeWidth / 2;\n const circumference = 2 * Math.PI * radius;\n const boundedPct = pct === null ? 0 : Math.max(0, Math.min(100, pct));\n const dashOffset = circumference * (1 - boundedPct / 100);\n\n return (\n <div\n className={cn(\n \"relative flex shrink-0 items-center justify-center\",\n className,\n )}\n style={{ width: size, height: size }}\n role=\"img\"\n aria-label={`${label ?? \"Score\"}: ${pct === null ? \"not available\" : `${pct} out of 100`}`}\n >\n <svg viewBox=\"0 0 100 100\" className=\"h-full w-full -rotate-90\">\n <circle\n cx=\"50\"\n cy=\"50\"\n r={radius}\n className=\"stroke-muted\"\n strokeWidth={strokeWidth}\n fill=\"none\"\n />\n {pct !== null ? (\n <circle\n cx=\"50\"\n cy=\"50\"\n r={radius}\n className={cn(\n \"transition-[stroke-dashoffset] duration-700 ease-out\",\n scoreRingColorClasses(pct, thresholds),\n )}\n stroke=\"currentColor\"\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n fill=\"none\"\n strokeDasharray={circumference}\n strokeDashoffset={dashOffset}\n />\n ) : null}\n </svg>\n <div className=\"absolute flex flex-col items-center justify-center\">\n <span\n className={cn(\n \"font-bold tabular-nums text-foreground\",\n valueClassName ?? \"text-2xl\",\n )}\n >\n {pct === null ? \"—\" : `${pct}${suffix}`}\n </span>\n {label ? (\n <span className=\"max-w-[74px] truncate text-[9px] font-semibold uppercase tracking-wide text-muted-foreground\">\n {label}\n </span>\n ) : null}\n </div>\n </div>\n );\n}\n","\"use client\";\n\n/**\n * SegmentedControl — sized accessible segmented toggle.\n * Ported verbatim from matrx-frontend `components/ui/segmented-control.tsx`\n * (S17). No seams: pure markup over host semantic tokens. The option/prop\n * interfaces are exported here (the original kept them file-local).\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport interface SegmentOption {\n value: string;\n label: React.ReactNode;\n disabled?: boolean;\n}\n\nexport interface SegmentedControlProps {\n value: string;\n onValueChange: (value: string) => void;\n data: SegmentOption[];\n name?: string;\n className?: string;\n fullWidth?: boolean;\n size?: \"sm\" | \"md\" | \"lg\";\n}\n\nexport function SegmentedControl({\n value,\n onValueChange,\n data,\n name: _name,\n className,\n fullWidth = false,\n size = \"md\",\n}: SegmentedControlProps) {\n // Handle size classes\n const sizeClasses = {\n sm: \"h-7 text-xs\",\n md: \"h-9 text-sm\",\n lg: \"h-10 text-base\",\n };\n\n return (\n <div\n className={cn(\n \"inline-flex p-0.5 bg-muted rounded-md\",\n fullWidth && \"w-full\",\n className\n )}\n role=\"tablist\"\n >\n {data.map((option) => {\n const isActive = value === option.value;\n return (\n <button\n key={option.value}\n type=\"button\"\n role=\"tab\"\n aria-selected={isActive}\n disabled={option.disabled}\n onClick={() => onValueChange(option.value)}\n className={cn(\n \"relative flex items-center justify-center rounded-[0.2rem] px-3 py-1.5 transition-all\",\n sizeClasses[size],\n fullWidth && \"flex-1\",\n isActive\n ? \"bg-background text-foreground shadow-sm\"\n : \"text-muted-foreground hover:text-foreground hover:bg-background/50\",\n option.disabled && \"opacity-50 cursor-not-allowed\"\n )}\n >\n {option.label}\n </button>\n );\n })}\n </div>\n );\n}\n","\"use client\";\n\n/**\n * Select — ported verbatim from matrx-frontend `components/ui/select.tsx`.\n *\n * Seam inversions:\n * - The host's `useNestedPortalContainer` (dialog/popout aware) becomes the\n * injected `PortalContainerProvider` seam (`portal-container.tsx`); the\n * explicit `container` prop keeps top priority, exactly as before.\n * - `ChevronDownIcon` / `ChevronUpIcon` / `CheckIcon` come from the package's\n * inlined SVGs (C19), not @radix-ui/react-icons — same glyphs, same\n * viewBoxes. (The origin also imported `CaretSortIcon` without ever using\n * it; the dead import is not carried along.)\n *\n * THE ROOT RENDERS UNCONDITIONALLY — no mount gate. This wrapper used to defer\n * rendering until after hydration (\"Radix generates dynamic aria-controls ids\n * that differ between SSR and client\"), and that justification was false:\n * Radix ids come from React's SSR-stable `useId` (verified against\n * @radix-ui/react-select 2.3.1 / react-id 1.1.2). The gate was actively\n * harmful — it deleted the ALWAYS-VISIBLE select trigger (a form control)\n * from SSR and the first client paint.\n */\n\nimport * as SelectPrimitive from \"@radix-ui/react-select\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport {\n CheckIcon,\n RadixChevronDownIcon,\n RadixChevronUpIcon,\n} from \"./icons\";\nimport { usePortalContainer } from \"./portal-container\";\n\nexport const Select = SelectPrimitive.Root;\n\nexport const SelectGroup = SelectPrimitive.Group;\n\nexport const SelectValue = SelectPrimitive.Value;\n\nexport const selectTriggerVariants = cva(\n \"flex w-full items-center justify-between whitespace-nowrap rounded-md border border-border bg-card text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground transition-colors hover:bg-accent hover:border-accent-foreground/20 focus:outline-none focus:ring-1 focus:ring-primary/30 focus:border-primary/40 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1\",\n {\n variants: {\n size: {\n sm: \"h-7 px-2 py-1 text-xs\",\n default: \"h-9 px-3 py-1\",\n lg: \"h-10 px-3 py-2\",\n },\n },\n defaultVariants: {\n size: \"default\",\n },\n },\n);\n\nexport interface SelectTriggerProps\n extends\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>,\n VariantProps<typeof selectTriggerVariants> {\n hideArrow?: boolean;\n}\n\nexport const SelectTrigger = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Trigger>,\n SelectTriggerProps\n>(({ className, children, hideArrow = false, size, ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(selectTriggerVariants({ size, className }))}\n {...props}\n >\n {children}\n {!hideArrow && (\n <SelectPrimitive.Icon asChild>\n <RadixChevronDownIcon className=\"h-4 w-4 opacity-50\" />\n </SelectPrimitive.Icon>\n )}\n </SelectPrimitive.Trigger>\n));\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;\n\nexport const SelectScrollUpButton = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.ScrollUpButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollUpButton\n ref={ref}\n className={cn(\n \"flex cursor-default items-center justify-center py-1\",\n className,\n )}\n {...props}\n >\n <RadixChevronUpIcon />\n </SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;\n\nexport const SelectScrollDownButton = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.ScrollDownButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollDownButton\n ref={ref}\n className={cn(\n \"flex cursor-default items-center justify-center py-1\",\n className,\n )}\n {...props}\n >\n <RadixChevronDownIcon />\n </SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName =\n SelectPrimitive.ScrollDownButton.displayName;\n\nexport const SelectContent = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> & {\n container?: HTMLElement | null;\n }\n>(({ className, children, position = \"popper\", container, ...props }, ref) => {\n const portalContainer = usePortalContainer(container);\n return (\n <SelectPrimitive.Portal container={portalContainer}>\n <SelectPrimitive.Content\n ref={ref}\n className={cn(\n \"relative z-[10001] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n position === \"popper\" &&\n \"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\",\n className,\n )}\n position={position}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n \"p-0.5 overflow-y-auto\",\n position === \"popper\" &&\n \"w-full min-w-[var(--radix-select-trigger-width)] max-h-[var(--radix-select-content-available-height)]\",\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n );\n});\nSelectContent.displayName = SelectPrimitive.Content.displayName;\n\nexport const SelectLabel = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn(\"px-2 py-1.5 text-sm font-semibold\", className)}\n {...props}\n />\n));\nSelectLabel.displayName = SelectPrimitive.Label.displayName;\n\nexport const SelectItem = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item> & {\n /**\n * Secondary line shown under the label IN THE LIST ONLY. Rendered outside\n * Radix `ItemText` on purpose: everything inside `ItemText` is what the\n * closed trigger displays, so a description passed as `children` gets\n * squeezed into the fixed-height trigger and clipped. This prop keeps the\n * trigger to the one-line label while the open list shows both lines.\n */\n description?: React.ReactNode;\n }\n>(({ className, children, description, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex w-full cursor-default select-none rounded-sm py-1 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n description ? \"flex-col items-start gap-0.5 py-1.5\" : \"items-center\",\n className,\n )}\n {...props}\n >\n <span className=\"absolute right-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <CheckIcon className=\"h-4 w-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n {description ? (\n <span className=\"block text-xs leading-snug text-muted-foreground\">\n {description}\n </span>\n ) : null}\n </SelectPrimitive.Item>\n));\nSelectItem.displayName = SelectPrimitive.Item.displayName;\n\nexport const SelectSeparator = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n));\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName;\n","\"use client\";\n\nimport * as SeparatorPrimitive from \"@radix-ui/react-separator\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport const Separator = React.forwardRef<\n React.ComponentRef<typeof SeparatorPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\n>(({ className, orientation = \"horizontal\", decorative = true, ...props }, ref) => (\n <SeparatorPrimitive.Root\n ref={ref}\n decorative={decorative}\n orientation={orientation}\n className={cn(\n \"shrink-0 bg-border\",\n orientation === \"horizontal\" ? \"h-px w-full\" : \"h-full w-px\",\n className,\n )}\n {...props}\n />\n));\nSeparator.displayName = SeparatorPrimitive.Root.displayName;\n","\"use client\";\n\n/**\n * Sheet — ported verbatim from matrx-frontend `components/ui/sheet.tsx`.\n *\n * Seam inversions:\n * - The host's `DialogContentPrimitive` (from its dialog module) is inlined\n * here as a private wrapper with identical behavior: unstyled non-portalling\n * Radix Content that derives `aria-modal` from the owning Root's modality.\n * - `Cross2Icon` comes from the package's inlined SVGs (C19), not\n * @radix-ui/react-icons.\n * - `treeContainsComponent` stays the ONE kit implementation\n * (@ai-matrx/kit/react-tree) — never a vendored twin.\n *\n * THE ROOT RENDERS UNCONDITIONALLY — no mount gate. This wrapper used to defer\n * rendering until after hydration (\"Radix generates dynamic aria-controls ids\n * that differ between SSR and client\"), and that justification was false:\n * Radix ids come from React's SSR-stable `useId` (verified against\n * @radix-ui/react-dialog 1.1.17 / react-id 1.1.2). The gate was actively\n * harmful — the Trigger wraps ALWAYS-VISIBLE content, so `return null`\n * deleted it from SSR and the first client paint.\n * The RadixDialogModalProvider wrapper stays — it is unrelated to hydration.\n */\n\nimport * as SheetPrimitive from \"@radix-ui/react-dialog\";\nimport { treeContainsComponent } from \"@ai-matrx/kit/react-tree\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { Cross2Icon } from \"./icons\";\nimport {\n RadixDialogModalProvider,\n useRadixDialogModal,\n} from \"./radix-dialog-modal-context\";\n\n/**\n * Unstyled, non-portalling Content for Sheet layouts. It preserves Radix\n * focus/background behavior and derives `aria-modal` from the owning Root\n * (identical to the host dialog module's DialogContentPrimitive).\n */\nconst SheetContentBase = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>\n>(({ ...props }, ref) => {\n const isModal = useRadixDialogModal();\n return (\n <SheetPrimitive.Content\n {...props}\n ref={ref}\n aria-modal={isModal || undefined}\n />\n );\n});\nSheetContentBase.displayName = \"SheetContentBase\";\n\nexport const Sheet = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Root>\n>(({ children, ...props }, _ref) => {\n const modal = props.modal ?? true;\n\n return (\n <RadixDialogModalProvider modal={modal}>\n <SheetPrimitive.Root {...props} modal={modal}>\n {children}\n </SheetPrimitive.Root>\n </RadixDialogModalProvider>\n );\n});\nSheet.displayName = \"Sheet\";\n\nexport const SheetTrigger = SheetPrimitive.Trigger;\n\nexport const SheetClose = SheetPrimitive.Close;\n\nexport const SheetPortal = SheetPrimitive.Portal;\n\nexport const SheetOverlay = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <SheetPrimitive.Overlay\n className={cn(\n \"fixed inset-0 z-50 bg-[var(--matrx-overlay-scrim)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n className,\n )}\n {...props}\n ref={ref}\n />\n));\nSheetOverlay.displayName = SheetPrimitive.Overlay.displayName;\n\nexport const sheetVariants = cva(\n \"fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out\",\n {\n variants: {\n side: {\n top: \"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top\",\n bottom:\n \"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom\",\n left: \"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm\",\n right:\n \"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm\",\n center:\n \"inset-0 m-auto max-h-full max-w-full border rounded-lg data-[state=closed]:fade-out data-[state=open]:fade-in\",\n },\n },\n defaultVariants: {\n side: \"right\",\n },\n },\n);\n\nexport interface SheetContentProps\n extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,\n VariantProps<typeof sheetVariants> {\n hideCloseButton?: boolean;\n /** Skip the dimming overlay — for non-modal side panels (e.g. chat canvas). */\n hideOverlay?: boolean;\n /** Optional className for the overlay when shown. */\n overlayClassName?: string;\n}\n\nexport const SheetDescription = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <SheetPrimitive.Description\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nSheetDescription.displayName = SheetPrimitive.Description.displayName;\n\nexport const SheetContent = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Content>,\n SheetContentProps\n>(\n (\n {\n side = \"right\",\n className,\n children,\n hideCloseButton = false,\n hideOverlay = false,\n overlayClassName,\n ...props\n },\n ref,\n ) => {\n const hasDescription =\n treeContainsComponent(children, SheetDescription) ||\n treeContainsComponent(children, SheetPrimitive.Description);\n return (\n <SheetPortal>\n {!hideOverlay && <SheetOverlay className={overlayClassName} />}\n <SheetContentBase\n ref={ref}\n className={cn(sheetVariants({ side }), className)}\n {...(hasDescription ? {} : { \"aria-describedby\": undefined })}\n {...props}\n >\n {!hideCloseButton && (\n <SheetPrimitive.Close className=\"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary\">\n <Cross2Icon className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </SheetPrimitive.Close>\n )}\n {children}\n </SheetContentBase>\n </SheetPortal>\n );\n },\n);\nSheetContent.displayName = SheetPrimitive.Content.displayName;\n\nexport const SheetHeader = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col space-y-2 text-center sm:text-left\",\n className,\n )}\n {...props}\n />\n);\nSheetHeader.displayName = \"SheetHeader\";\n\nexport const SheetFooter = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n className,\n )}\n {...props}\n />\n);\nSheetFooter.displayName = \"SheetFooter\";\n\nexport const SheetTitle = React.forwardRef<\n React.ComponentRef<typeof SheetPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <SheetPrimitive.Title\n ref={ref}\n className={cn(\"text-lg font-semibold text-foreground\", className)}\n {...props}\n />\n));\nSheetTitle.displayName = SheetPrimitive.Title.displayName;\n","/**\n * Skeleton — ported verbatim from matrx-frontend `components/ui/skeleton.tsx`.\n * No seams: pure markup over host semantic tokens.\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport function Skeleton({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n className={cn(\"animate-pulse rounded-md bg-primary/10\", className)}\n {...props}\n />\n );\n}\n","\"use client\";\n\n/**\n * Switch — Radix switch, one implementation, two sizes.\n *\n * The four forks were the same control with two different tracks: a 16px track\n * with a visible border and an overhanging thumb (matrx-frontend) and a 20px\n * track with a transparent border and an inset thumb (matrx-extend, dashboard,\n * workflow-studio). Both stay reachable through `size`, so no host has to keep\n * a copy to keep its look:\n *\n * sm → h-4 track, bordered, thumb sits proud of the rail\n * md → h-5 track, transparent border, thumb sits inside (the default)\n *\n * The unchecked track reads `bg-input`, the token that exists for exactly this\n * — workflow-studio's fork used `bg-muted`, which is the surface token and\n * makes an off switch disappear into a muted panel.\n */\n\nimport * as SwitchPrimitives from \"@radix-ui/react-switch\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport type SwitchSize = \"sm\" | \"md\";\n\nconst SWITCH_SIZES: Record<SwitchSize, { root: string; thumb: string }> = {\n sm: {\n root: \"h-4 w-9 border-border data-[state=unchecked]:bg-input\",\n thumb:\n \"h-4 w-4 border border-primary data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0\",\n },\n md: {\n root: \"h-5 w-9 border-transparent data-[state=unchecked]:bg-input\",\n thumb:\n \"h-4 w-4 data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0\",\n },\n};\n\nexport interface SwitchProps\n extends React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> {\n /** Track size. Default `md`. */\n size?: SwitchSize;\n}\n\nconst Switch = React.forwardRef<\n React.ComponentRef<typeof SwitchPrimitives.Root>,\n SwitchProps\n>(({ className, size = \"md\", ...props }, ref) => (\n <SwitchPrimitives.Root\n ref={ref}\n data-slot=\"switch\"\n className={cn(\n \"peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary\",\n SWITCH_SIZES[size].root,\n className,\n )}\n {...props}\n >\n <SwitchPrimitives.Thumb\n data-slot=\"switch-thumb\"\n className={cn(\n \"pointer-events-none block rounded-full bg-background shadow-lg ring-0 transition-transform\",\n SWITCH_SIZES[size].thumb,\n )}\n />\n </SwitchPrimitives.Root>\n));\nSwitch.displayName = SwitchPrimitives.Root.displayName;\n\nexport { Switch };\n","\"use client\";\n\n/**\n * TabbedBottomSheet — iOS Settings–style two-level navigation for tabbed menus.\n * Ported verbatim from matrx-frontend\n * `components/official/bottom-sheet/TabbedBottomSheet.tsx` (S19).\n *\n * Level 1: a scrollable list of tabs (icon + label + chevron).\n * Level 2: drill into one tab's content with a back button in the header.\n *\n * Two invariants make this ONE surface instead of a different panel per tab:\n *\n * 1. **Fixed height** (`size=\"full\"`) — the sheet is the same near-full\n * height on the index and inside every tab, and it never resizes as\n * content loads, filters, or expands. An adaptive height here meant the\n * panel grew and shrank under the user's thumb on every keystroke.\n * 2. **One typography scale** (`matrx-mobile-sheet`, host globals.css) —\n * the tab bodies are the same components the desktop window renders at\n * desktop density (11–12px). That is unreadable and untappable on a\n * phone, so the sheet promotes small text to mobile sizes and every\n * field to the 16px that stops iOS focus-zoom. Panels stay density-free;\n * the host decides the density.\n *\n * Seam inversions: `ChevronRight` is the package's inlined SVG (C19); the\n * `matrx-mobile-sheet` and `pb-safe` utility classes are host-owned CSS.\n */\n\nimport { useState, type ComponentType, type ReactNode } from \"react\";\n\nimport { BottomSheet, BottomSheetBody, BottomSheetHeader } from \"./bottom-sheet\";\nimport { ChevronRightIcon } from \"./icons\";\n\nexport interface TabbedBottomSheetTab {\n id: string;\n label: string;\n icon?: ComponentType<{ className?: string }>;\n /** Optional trailing badge / dot shown on the index row. */\n trailing?: ReactNode;\n content: ReactNode;\n}\n\nexport interface TabbedBottomSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n title: string;\n tabs: TabbedBottomSheetTab[];\n}\n\nexport function TabbedBottomSheet({\n open,\n onOpenChange,\n title,\n tabs,\n}: TabbedBottomSheetProps) {\n const [selectedTabId, setSelectedTabId] = useState<string | null>(null);\n\n // Every open starts on the index. Adjusted during render (the React-docs\n // pattern for state derived from a prop change) rather than in an effect,\n // which would render the previous tab's body for one frame first.\n const [wasOpen, setWasOpen] = useState(open);\n if (open !== wasOpen) {\n setWasOpen(open);\n if (open) setSelectedTabId(null);\n }\n\n const selectedTab = selectedTabId\n ? tabs.find((tab) => tab.id === selectedTabId)\n : null;\n\n return (\n <BottomSheet\n open={open}\n onOpenChange={onOpenChange}\n title={title}\n size=\"full\"\n >\n <div className=\"matrx-mobile-sheet flex min-h-0 flex-1 flex-col\">\n <BottomSheetHeader\n title={selectedTab ? selectedTab.label : title}\n showBack={!!selectedTab}\n onBack={() => setSelectedTabId(null)}\n />\n {selectedTab ? (\n <div className=\"flex min-h-0 flex-1 flex-col overflow-hidden pb-safe\">\n {selectedTab.content}\n </div>\n ) : (\n <BottomSheetBody>\n <ul className=\"divide-y divide-border\">\n {tabs.map((tab) => {\n const Icon = tab.icon;\n return (\n <li key={tab.id}>\n <button\n type=\"button\"\n onClick={() => setSelectedTabId(tab.id)}\n className=\"flex w-full items-center gap-3 px-4 py-3.5 text-left transition-colors hover:bg-muted/60 active:bg-muted\"\n >\n {Icon ? (\n <Icon className=\"h-5 w-5 shrink-0 text-muted-foreground\" />\n ) : null}\n <span className=\"min-w-0 flex-1 text-base text-foreground\">\n {tab.label}\n </span>\n {tab.trailing}\n <ChevronRightIcon className=\"h-5 w-5 shrink-0 text-muted-foreground\" />\n </button>\n </li>\n );\n })}\n </ul>\n </BottomSheetBody>\n )}\n </div>\n </BottomSheet>\n );\n}\n","\"use client\";\n\n/**\n * Table — the semantic table shell. No data logic, no sorting, no virtualiser:\n * those belong to the host's data-table layer, which composes these elements.\n *\n * The two forks disagreed on exactly three things, all of them now props:\n *\n * 1. matrx-frontend wrapped `<table>` in `relative w-full overflow-auto` so a\n * wide table scrolls inside itself instead of pushing the page sideways;\n * dashboard emitted a bare `<table>`. The wrapper is the correct default —\n * a table that widens its page is a layout bug on every narrow viewport —\n * so it stays on, with `wrap={false}` for a host that already owns a\n * scroll container (double scrollers are their own defect).\n * 2. dashboard's header was `sticky top-0 z-10 bg-background`. That is a real\n * capability, not a style opinion, so it is `sticky` on `TableHeader` —\n * opt-in, because a sticky header inside an unbounded page sticks to\n * nothing and only costs a stacking context.\n * 3. Cell density: `p-2` vs `p-3`. Declared once on `<Table size>` and read\n * from context by every cell, so a table cannot mix densities.\n *\n * Colour is tokens only.\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport type TableSize = \"sm\" | \"md\";\n\nconst TABLE_SIZES: Record<TableSize, { head: string; cell: string }> = {\n sm: { head: \"px-2\", cell: \"p-2\" },\n md: { head: \"px-3\", cell: \"p-3\" },\n};\n\nconst TableSizeContext = React.createContext<TableSize>(\"md\");\n\n/** The density the nearest enclosing `<Table>` declared. `md` outside one. */\nexport function useTableSize(): TableSize {\n return React.useContext(TableSizeContext);\n}\n\nexport interface TableProps extends React.HTMLAttributes<HTMLTableElement> {\n /** Cell density for this table. Default `md` (`p-3`); `sm` is `p-2`. */\n size?: TableSize;\n /**\n * Wrap the table in its own horizontal scroll container. Default `true`.\n * Pass `false` only when an ancestor already scrolls this table.\n */\n wrap?: boolean;\n /** Classes for the scroll wrapper (ignored when `wrap` is false). */\n wrapperClassName?: string;\n}\n\nconst Table = React.forwardRef<HTMLTableElement, TableProps>(\n ({ className, size = \"md\", wrap = true, wrapperClassName, ...props }, ref) => {\n const table = (\n <table\n ref={ref}\n data-slot=\"table\"\n data-size={size}\n className={cn(\"w-full caption-bottom text-sm\", className)}\n {...props}\n />\n );\n\n return (\n <TableSizeContext.Provider value={size}>\n {wrap ? (\n <div\n data-slot=\"table-wrapper\"\n className={cn(\"relative w-full overflow-auto\", wrapperClassName)}\n >\n {table}\n </div>\n ) : (\n table\n )}\n </TableSizeContext.Provider>\n );\n },\n);\nTable.displayName = \"Table\";\n\nexport interface TableHeaderProps\n extends React.HTMLAttributes<HTMLTableSectionElement> {\n /**\n * Pin the header to the top of the nearest scroll container. Opt-in: it\n * needs a bounded scroll ancestor to stick to, and it opens a stacking\n * context whether or not it sticks.\n */\n sticky?: boolean;\n}\n\nconst TableHeader = React.forwardRef<\n HTMLTableSectionElement,\n TableHeaderProps\n>(({ className, sticky = false, ...props }, ref) => (\n <thead\n ref={ref}\n data-slot=\"table-header\"\n className={cn(\n \"[&_tr]:border-b\",\n sticky && \"sticky top-0 z-10 bg-background\",\n className,\n )}\n {...props}\n />\n));\nTableHeader.displayName = \"TableHeader\";\n\nconst TableBody = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <tbody\n ref={ref}\n data-slot=\"table-body\"\n className={cn(\"[&_tr:last-child]:border-0\", className)}\n {...props}\n />\n));\nTableBody.displayName = \"TableBody\";\n\nconst TableFooter = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <tfoot\n ref={ref}\n data-slot=\"table-footer\"\n className={cn(\n \"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0\",\n className,\n )}\n {...props}\n />\n));\nTableFooter.displayName = \"TableFooter\";\n\nconst TableRow = React.forwardRef<\n HTMLTableRowElement,\n React.HTMLAttributes<HTMLTableRowElement>\n>(({ className, ...props }, ref) => (\n <tr\n ref={ref}\n data-slot=\"table-row\"\n className={cn(\n \"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted\",\n className,\n )}\n {...props}\n />\n));\nTableRow.displayName = \"TableRow\";\n\nconst TableHead = React.forwardRef<\n HTMLTableCellElement,\n React.ThHTMLAttributes<HTMLTableCellElement>\n>(({ className, ...props }, ref) => {\n const size = useTableSize();\n return (\n <th\n ref={ref}\n data-slot=\"table-head\"\n className={cn(\n \"h-10 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]\",\n TABLE_SIZES[size].head,\n className,\n )}\n {...props}\n />\n );\n});\nTableHead.displayName = \"TableHead\";\n\nconst TableCell = React.forwardRef<\n HTMLTableCellElement,\n React.TdHTMLAttributes<HTMLTableCellElement>\n>(({ className, ...props }, ref) => {\n const size = useTableSize();\n return (\n <td\n ref={ref}\n data-slot=\"table-cell\"\n className={cn(\n \"align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]\",\n TABLE_SIZES[size].cell,\n className,\n )}\n {...props}\n />\n );\n});\nTableCell.displayName = \"TableCell\";\n\nconst TableCaption = React.forwardRef<\n HTMLTableCaptionElement,\n React.HTMLAttributes<HTMLTableCaptionElement>\n>(({ className, ...props }, ref) => (\n <caption\n ref={ref}\n data-slot=\"table-caption\"\n className={cn(\"mt-4 text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nTableCaption.displayName = \"TableCaption\";\n\nexport {\n Table,\n TableBody,\n TableCaption,\n TableCell,\n TableFooter,\n TableHead,\n TableHeader,\n TableRow,\n};\n","\"use client\";\n\n/**\n * Tabs — Radix tabs, carrying two rulings the forks had already paid for.\n *\n * 1. THE ROOT RENDERS UNCONDITIONALLY — no mount gate. A wrapper in\n * matrx-frontend used to defer rendering until after hydration (\"Radix\n * generates dynamic aria-controls ids that differ between SSR and client\").\n * That was false — Radix ids come from React's SSR-stable `useId` — and the\n * gate deleted the ENTIRE tab bar and active panel from SSR and the first\n * client paint.\n *\n * 2. INACTIVE PANELS UNMOUNT — Radix's default, restored in matrx-frontend on\n * 2026-08-15 after a wrapper hardcoded `forceMount`. Every tab panel in that\n * app was live at all times: effects running, fetches firing, subscriptions\n * open, registrations registered — while invisible. Not theoretical: on the\n * agent-apps executions page both tabs' tables registered a runtime provider\n * for the same surface at the same depth, the HIDDEN tab won the tie-break,\n * and agents on the VISIBLE tab were handed the other tab's rows.\n *\n * `forceMount` is OPT-IN. Pass it on the panels that genuinely must survive\n * a switch — an in-flight editor, a scroll position, a live stream that\n * must not be torn down. `data-[state=inactive]:hidden` is applied\n * unconditionally (inert when the panel unmounts), so passing the prop is\n * the whole opt-in.\n *\n * Do NOT reach for `forceMount` to preserve a form draft. Lift that state to\n * the component that owns the `<Tabs>`; the panel is then free to unmount\n * and the draft survives a close/reopen too, which force-mounting never gave\n * you.\n *\n * `TabsTriggerCore` is the trigger WITHOUT the resting muted-foreground\n * treatment, for hosts that colour their own inactive tabs. Both triggers\n * otherwise share one class string.\n */\n\nimport * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nconst Tabs = TabsPrimitive.Root;\n\nconst TABS_TRIGGER_BASE =\n \"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm\";\n\nconst TabsList = React.forwardRef<\n React.ComponentRef<typeof TabsPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.List\n ref={ref}\n data-slot=\"tabs-list\"\n className={cn(\n \"inline-flex h-9 items-center justify-center gap-1 rounded-lg bg-muted p-1 text-muted-foreground\",\n className,\n )}\n {...props}\n />\n));\nTabsList.displayName = TabsPrimitive.List.displayName;\n\nconst TabsTrigger = React.forwardRef<\n React.ComponentRef<typeof TabsPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.Trigger\n ref={ref}\n data-slot=\"tabs-trigger\"\n className={cn(\n TABS_TRIGGER_BASE,\n \"text-muted-foreground hover:text-foreground\",\n className,\n )}\n {...props}\n />\n));\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName;\n\n/** The trigger without the resting muted/hover treatment. */\nconst TabsTriggerCore = React.forwardRef<\n React.ComponentRef<typeof TabsPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.Trigger\n ref={ref}\n data-slot=\"tabs-trigger\"\n className={cn(TABS_TRIGGER_BASE, className)}\n {...props}\n />\n));\nTabsTriggerCore.displayName = TabsPrimitive.Trigger.displayName;\n\nconst TabsContent = React.forwardRef<\n React.ComponentRef<typeof TabsPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.Content\n ref={ref}\n data-slot=\"tabs-content\"\n className={cn(\n \"data-[state=inactive]:hidden\",\n \"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n className,\n )}\n {...props}\n />\n));\nTabsContent.displayName = TabsPrimitive.Content.displayName;\n\nexport { Tabs, TabsContent, TabsList, TabsTrigger, TabsTriggerCore };\n","\"use client\";\n\n/**\n * Textarea — the multi-line twin of the Input family, same three shapes:\n * `Textarea` (elevated), `BasicTextarea` (plain control), and\n * `TextareaWithPrefix`.\n *\n * WHAT THE FORKS PROVED. Three hosts shipped a bare `<textarea>` with a\n * min-height and nothing else; matrx-frontend shipped auto-grow, min/max\n * height clamping, and a stretch-detection pass. That last one is the reason\n * this file is worth having: a `<textarea>` is a REPLACED element, so\n * `className=\"h-full\"` on it does nothing useful unless its parent is also\n * told to stretch — which is why every host that wanted a filling textarea\n * ended up wrapping it by hand at the call site, differently each time.\n * `getStretchClasses` reads the caller's own fill intent out of the className\n * and builds the wrapper for them.\n *\n * COLOUR IS TOKENS (C26). The ported original pinned its body text to literal\n * black/white, its placeholder and focus ring to raw palette steps, and its\n * dark elevation to a custom property no host defined — so that shadow\n * computed to nothing. All four now resolve from the semantic vocabulary.\n *\n * AND `shadow-textarea` NOW EXISTS. The original's resting elevation class was\n * `shadow-textarea`, and NO host defined `--shadow-textarea` or generated that\n * utility — 125 call sites asked for an elevation they never got. The package\n * ships the token (defaulting to the Input family's `--shadow-input`, which is\n * plainly what the twin class meant) and the rule, so the class finally does\n * what it says. A host that wants the flat look sets `--shadow-textarea: none`.\n *\n * The clipboard/motion variants matrx-frontend layers on top (CopyTextarea,\n * FancyTextarea) stay host-owned under the C8 split-out law: they drag in\n * `motion/react`, and plain-textarea consumers must not pay for it.\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport interface TextareaProps\n extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {\n /** Grow to fit content as the user types (and stop growing at `maxHeight`). */\n autoGrow?: boolean;\n /** Minimum height in px. */\n minHeight?: number;\n /** Maximum height in px; past it the field scrolls instead of growing. */\n maxHeight?: number;\n /** Classes for the wrapper this component adds when one is needed. */\n wrapperClassName?: string;\n}\n\nconst FILL_HEIGHT_REGEX = /(?:^|\\s)(h-full|h-dvh|flex-1|grow)(?:\\s|$)/;\nconst FILL_WIDTH_REGEX = /(?:^|\\s)(w-full|w-screen)(?:\\s|$)/;\n\n/**\n * A `<textarea>` cannot fill a box on its own — the box has to be told too.\n * Read the caller's fill intent out of its own className and mirror it onto\n * the wrapper, so `className=\"h-full\"` means what the caller thought it meant.\n */\nfunction getStretchClasses(className?: string): string | undefined {\n if (!className) return undefined;\n const fills: string[] = [];\n if (FILL_HEIGHT_REGEX.test(className)) fills.push(\"h-full min-h-0\");\n if (FILL_WIDTH_REGEX.test(className)) fills.push(\"w-full\");\n return fills.length ? fills.join(\" \") : undefined;\n}\n\nconst TEXTAREA_ELEVATED_CLASS =\n \"flex h-auto w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground shadow-textarea transition duration-400 placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-[2px] focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50\";\n\nconst TEXTAREA_CONTROL_CLASS =\n \"flex w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm text-foreground shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50\";\n\nfunction useAutoGrow(\n ref: React.RefObject<HTMLTextAreaElement | null>,\n value: React.TextareaHTMLAttributes<HTMLTextAreaElement>[\"value\"],\n autoGrow = false,\n minHeight?: number,\n maxHeight?: number,\n): void {\n React.useEffect(() => {\n if (!autoGrow || !ref.current) return;\n\n const textarea = ref.current;\n textarea.style.height = \"auto\";\n\n let newHeight = textarea.scrollHeight;\n if (minHeight) newHeight = Math.max(newHeight, minHeight);\n\n if (maxHeight && newHeight >= maxHeight) {\n textarea.style.height = `${maxHeight}px`;\n textarea.style.overflowY = \"auto\";\n } else {\n textarea.style.height = `${newHeight}px`;\n textarea.style.overflowY = \"hidden\";\n }\n }, [value, autoGrow, minHeight, maxHeight, ref]);\n}\n\n/** Merge a forwarded ref with the internal one auto-grow needs to measure. */\nfunction useMergedTextareaRef(\n forwarded: React.ForwardedRef<HTMLTextAreaElement>,\n): {\n ref: React.RefObject<HTMLTextAreaElement | null>;\n callback: (node: HTMLTextAreaElement | null) => void;\n} {\n const internal = React.useRef<HTMLTextAreaElement | null>(null);\n const callback = React.useCallback(\n (node: HTMLTextAreaElement | null) => {\n internal.current = node;\n if (typeof forwarded === \"function\") forwarded(node);\n else if (forwarded) forwarded.current = node;\n },\n [forwarded],\n );\n return { ref: internal, callback };\n}\n\nfunction boxStyle(\n minHeight?: number,\n maxHeight?: number,\n): React.CSSProperties | undefined {\n if (minHeight === undefined && maxHeight === undefined) return undefined;\n return {\n minHeight: minHeight ? `${minHeight}px` : undefined,\n maxHeight: maxHeight ? `${maxHeight}px` : undefined,\n };\n}\n\n/** The elevated textarea — the Input family's `Input`, in multi-line form. */\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n (\n { className, autoGrow, minHeight, maxHeight, wrapperClassName, ...props },\n forwarded,\n ) => {\n const { ref, callback } = useMergedTextareaRef(forwarded);\n const stretchClasses = getStretchClasses(className);\n const needsWrapper = Boolean(wrapperClassName || stretchClasses);\n\n useAutoGrow(ref, props.value, autoGrow, minHeight, maxHeight);\n\n const textarea = (\n <textarea\n ref={callback}\n data-slot=\"textarea\"\n className={cn(\n TEXTAREA_ELEVATED_CLASS,\n autoGrow && \"resize-none\",\n stretchClasses,\n className,\n )}\n style={boxStyle(minHeight, maxHeight)}\n {...props}\n />\n );\n\n if (!needsWrapper) return textarea;\n\n return <div className={cn(stretchClasses, wrapperClassName)}>{textarea}</div>;\n },\n);\nTextarea.displayName = \"Textarea\";\n\n/**\n * The plain control — a bordered, transparent field with a 60px floor. This is\n * what matrx-extend, aidream/apps/dashboard and workflow-studio each called\n * `Textarea`; the floor is theirs and it is the sensible default (a one-line\n * box for multi-line content invites a scrollbar on the first Enter).\n */\nconst BasicTextarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n ({ className, autoGrow, minHeight, maxHeight, ...props }, forwarded) => {\n const { ref, callback } = useMergedTextareaRef(forwarded);\n\n useAutoGrow(ref, props.value, autoGrow, minHeight, maxHeight);\n\n return (\n <textarea\n ref={callback}\n data-slot=\"textarea\"\n className={cn(\n TEXTAREA_CONTROL_CLASS,\n \"h-auto min-h-[60px]\",\n autoGrow && \"resize-none\",\n className,\n )}\n style={boxStyle(minHeight, maxHeight)}\n {...props}\n />\n );\n },\n);\nBasicTextarea.displayName = \"BasicTextarea\";\n\nexport interface TextareaWithPrefixProps extends Omit<TextareaProps, \"prefix\"> {\n /** Leading adornment, absolutely placed at the field's top-left. */\n prefix?: React.ReactNode;\n}\n\nconst TextareaWithPrefix = React.forwardRef<\n HTMLTextAreaElement,\n TextareaWithPrefixProps\n>(\n (\n {\n prefix,\n className,\n wrapperClassName,\n autoGrow,\n minHeight,\n maxHeight,\n ...props\n },\n forwarded,\n ) => {\n const { ref, callback } = useMergedTextareaRef(forwarded);\n\n useAutoGrow(ref, props.value, autoGrow, minHeight, maxHeight);\n\n return (\n <div\n className={cn(\"relative\", getStretchClasses(className), wrapperClassName)}\n >\n {prefix ? (\n <div className=\"pointer-events-none absolute left-3 top-3 z-10 text-muted-foreground\">\n {prefix}\n </div>\n ) : null}\n <textarea\n ref={callback}\n data-slot=\"textarea\"\n className={cn(\n TEXTAREA_CONTROL_CLASS,\n \"resize-y\",\n prefix && \"pl-10\",\n autoGrow && \"resize-none\",\n className,\n )}\n style={boxStyle(minHeight, maxHeight)}\n {...props}\n />\n </div>\n );\n },\n);\nTextareaWithPrefix.displayName = \"TextareaWithPrefix\";\n\nexport { BasicTextarea, Textarea, TextareaWithPrefix };\n","\"use client\";\n\n// useScrollFade — ported verbatim from matrx-frontend\n// `components/official/scroll-fade/useScrollFade.ts` (S21).\n//\n// \"There is more below\" — told to the eye, not to nobody.\n//\n// A scroll container that simply hard-clips its last row reads as FINISHED.\n// The user never scrolls, because nothing suggested there was anything to\n// scroll to. A soft fade at the overflowing edge is the standard cue, and it\n// must appear ONLY on the edges that actually overflow — a permanent fade on a\n// non-scrolling list just makes the last item look broken.\n//\n// Attach `ref` to the scrolling element and spread `fadeProps`. Styling is\n// host-owned CSS (the `.matrx-scroll-fade` class in the host's globals.css),\n// keyed off the data attributes.\n//\n// The ref is a CALLBACK ref, not a useRef object, on purpose: these containers\n// are usually mounted conditionally (a popover body, a lazily-resolved menu),\n// so an effect that reads `ref.current` on mount finds null and — with no\n// dependency that ever changes — never runs again. The fade then silently\n// never appears, which is exactly the failure this hook exists to prevent.\n//\n// TWO RULES THE CALLBACK MUST OBEY (both learned the hard way — breaking\n// either one produced \"Maximum update depth exceeded\" on a page of 13 menus):\n// 1. NEVER setState synchronously inside the callback. Radix composes our\n// ref with its own via useComposedRefs, whose identity changes every render,\n// so the ref detaches+reattaches on every commit. A synchronous setState\n// there re-renders, which re-attaches, which sets state again — forever.\n// Measurement is always deferred to rAF.\n// 2. NEVER setState on detach (node === null). A detach/attach pair would\n// otherwise flip the fade off and on and drive the same loop.\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport interface ScrollFadeState {\n top: boolean;\n bottom: boolean;\n}\n\nexport interface UseScrollFadeResult {\n ref: (node: HTMLElement | null) => void;\n fadeProps: {\n \"data-fade-top\": \"\" | undefined;\n \"data-fade-bottom\": \"\" | undefined;\n className: string;\n };\n state: ScrollFadeState;\n}\n\n/** Slack below which we treat the edge as reached (sub-pixel scroll math). */\nconst EPSILON = 2;\n\nexport function useScrollFade(): UseScrollFadeResult {\n const [state, setState] = useState<ScrollFadeState>({\n top: false,\n bottom: false,\n });\n const nodeRef = useRef<HTMLElement | null>(null);\n const cleanupRef = useRef<(() => void) | null>(null);\n\n const measure = useCallback(() => {\n const el = nodeRef.current;\n if (!el) return;\n const overflowing = el.scrollHeight - el.clientHeight > EPSILON;\n const next: ScrollFadeState = {\n top: overflowing && el.scrollTop > EPSILON,\n bottom:\n overflowing &&\n el.scrollTop + el.clientHeight < el.scrollHeight - EPSILON,\n };\n setState((prev) =>\n prev.top === next.top && prev.bottom === next.bottom ? prev : next,\n );\n }, []);\n\n const ref = useCallback(\n (node: HTMLElement | null) => {\n cleanupRef.current?.();\n cleanupRef.current = null;\n nodeRef.current = node;\n // Rule 2: no state change on detach.\n if (!node) return;\n\n node.addEventListener(\"scroll\", measure, { passive: true });\n // Content can arrive after mount (lazy menu configs, async lists) and the\n // box can be resized by the viewport, so watch both.\n const ro = new ResizeObserver(measure);\n ro.observe(node);\n const mo = new MutationObserver(measure);\n mo.observe(node, { childList: true, subtree: true });\n\n cleanupRef.current = () => {\n node.removeEventListener(\"scroll\", measure);\n ro.disconnect();\n mo.disconnect();\n };\n\n // Rule 1: deferred, never synchronous. Radix also animates the panel in,\n // so its final height is not known on the frame it mounts anyway.\n requestAnimationFrame(measure);\n },\n [measure],\n );\n\n useEffect(() => () => cleanupRef.current?.(), []);\n\n return {\n ref,\n state,\n fadeProps: {\n \"data-fade-top\": state.top ? \"\" : undefined,\n \"data-fade-bottom\": state.bottom ? \"\" : undefined,\n className: \"matrx-scroll-fade\",\n },\n };\n}\n"],"mappings":";;;AAAA,SAAS,WAA8B;;;ACAvC,SAAS,YAA6B;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAA8B;AAClD,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;AD2BS;AA3BF,IAAM,gBAAgB;AAAA,EAC3B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,WAAW;AAAA,QACX,aAAa;AAAA,QACb,SAAS;AAAA,QACT,SAAS;AAAA,QACT,SAAS;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,QACP,SAAS;AAAA,MACX;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,IACX;AAAA,EACF;AACF;AAMO,SAAS,MAAM,EAAE,WAAW,S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B;AAAA,MAC5B,KAAK,eAAe,GAAG,YAAY;AAAA,MACnC,QACE,eACA,GAAG,YAAY,GAAG,eAAe,GAAG,eAAe;AAAA,IACvD;AACA;AAAA,MAAS,CAAC,SACR,KAAK,QAAQ,KAAK,OAAO,KAAK,WAAW,KAAK,SAAS,OAAO;AAAA,IAChE;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,MAAMA;AAAA,IACV,CAAC,SAA6B;AAC5B,iBAAW,UAAU;AACrB,iBAAW,UAAU;AACrB,cAAQ,UAAU;AAElB,UAAI,CAAC,KAAM;AAEX,WAAK,iBAAiB,UAAU,SAAS,EAAE,SAAS,KAAK,CAAC;AAG1D,YAAM,KAAK,IAAI,eAAe,OAAO;AACrC,SAAG,QAAQ,IAAI;AACf,YAAM,KAAK,IAAI,iBAAiB,OAAO;AACvC,SAAG,QAAQ,MAAM,EAAE,WAAW,MAAM,SAAS,KAAK,CAAC;AAEnD,iBAAW,UAAU,MAAM;AACzB,aAAK,oBAAoB,UAAU,OAAO;AAC1C,WAAG,WAAW;AACd,WAAG,WAAW;AAAA,MAChB;AAIA,4BAAsB,OAAO;AAAA,IAC/B;AAAA,IACA,CAAC,OAAO;AAAA,EACV;AAEA,EAAAC,WAAU,MAAM,MAAM,WAAW,UAAU,GAAG,CAAC,CAAC;AAEhD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT,iBAAiB,MAAM,MAAM,KAAK;AAAA,MAClC,oBAAoB,MAAM,SAAS,KAAK;AAAA,MACxC,WAAW;AAAA,IACb;AAAA,EACF;AACF;","names":["React","jsx","jsx","jsx","jsxs","cva","React","jsx","cva","React","jsx","React","jsx","React","jsx","CollapsibleTrigger","CollapsibleContent","React","React","jsx","React","jsx","jsxs","React","jsx","jsxs","useState","React","jsx","jsx","jsxs","useState","Icon","DialogPrimitive","VisuallyHidden","React","jsx","jsxs","DIALOG_DESKTOP_CLASSES","DIALOG_MOBILE_SHEET_CLASSES","DIALOG_MOBILE_SHEET_OVERRIDE","React","jsx","jsxs","useCallback","useEffect","useRef","useState","jsx","jsxs","useState","useRef","useEffect","useCallback","result","React","jsx","jsxs","React","jsx","Label","useRef","useState","jsx","jsxs","Icon","useRef","useState","React","jsx","React","jsx","jsxs","jsx","jsxs","jsx","cva","React","jsx","jsxs","cva","React","jsx","Separator","treeContainsComponent","cva","React","jsx","jsxs","cva","treeContainsComponent","jsx","React","jsx","useState","jsx","jsxs","useState","Icon","React","jsx","React","jsx","React","jsx","jsxs","useCallback","useEffect","useRef","useState"]}
|