@ai-matrx/design-system 0.11.2 → 0.11.3

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/accordion.tsx","../src/cn.ts","../src/icons.tsx","../src/badge.tsx","../src/bottom-sheet.tsx","../src/drawer.tsx","../src/radix-dialog-modal-context.tsx","../src/alert.tsx","../src/alert-dialog.tsx","../src/button.tsx","../src/motion.ts","../src/portal-container.tsx","../src/avatar.tsx","../src/card.tsx","../src/checkbox.tsx","../src/collapsible.tsx","../src/command.tsx","../src/use-is-mobile.ts","../src/confirm-dialog.tsx","../src/confirm-host.tsx","../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","../src/hover-card.tsx","../src/radio-group.tsx","../src/resizable.tsx","../src/slider.tsx","../src/toggle.tsx","../src/tooltip.tsx"],"sourcesContent":["export {\n Accordion,\n AccordionContent,\n AccordionItem,\n AccordionTrigger,\n useAccordionSize,\n type AccordionProps,\n type AccordionSize,\n type AccordionTriggerProps,\n} from \"./accordion\";\nexport { Badge, badgeVariants, type BadgeProps } from \"./badge\";\nexport {\n BottomSheet,\n BottomSheetBody,\n BottomSheetFooter,\n BottomSheetHeader,\n type BottomSheetBodyProps,\n type BottomSheetFooterProps,\n type BottomSheetHeaderProps,\n type BottomSheetProps,\n} from \"./bottom-sheet\";\nexport {\n Alert,\n AlertDescription,\n AlertTitle,\n alertVariants,\n type AlertProps,\n} from \"./alert\";\nexport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogContentPrimitive,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogOverlay,\n AlertDialogPortal,\n AlertDialogTitle,\n AlertDialogTrigger,\n type AlertDialogContentProps,\n} from \"./alert-dialog\";\nexport { Button, buttonVariants, type ButtonProps } from \"./button\";\nexport {\n Avatar,\n AvatarFallback,\n AvatarImage,\n type AvatarProps,\n type AvatarSize,\n} from \"./avatar\";\nexport {\n Card,\n CardAction,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n useCardSize,\n type CardProps,\n type CardSize,\n} from \"./card\";\nexport { Checkbox, type CheckboxProps, type CheckboxSize } from \"./checkbox\";\nexport { cn } from \"./cn\";\nexport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n type CollapsibleContentProps,\n} from \"./collapsible\";\nexport {\n Command,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n CommandShortcut,\n type CommandDialogProps,\n} from \"./command\";\n/**\n * THE CONFIRM SURFACE (0.11.0, census row 19i). The body lives here; the\n * imperative `confirm()` stays in `@ai-matrx/kit/confirm-opener` — mount\n * `<ConfirmDialogHost />` from this package once at your provider root, then\n * `await confirm({...})` from anywhere in kit. Deliberately NOT re-exported\n * from here (the row-20a precedent: one owner per surface, no twin door).\n */\nexport {\n ConfirmDialog,\n type ConfirmDialogProps,\n} from \"./confirm-dialog\";\nexport { ConfirmDialogHost } from \"./confirm-host\";\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 type ContextMenuContentProps,\n} from \"./context-menu\";\nexport {\n CreatablePicker,\n type CreatableOption,\n type CreatablePickerProps,\n type PickerIcon,\n} from \"./creatable-picker\";\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogContentPrimitive,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n useDialogContainer,\n type DialogContentProps,\n} from \"./dialog\";\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 type DropdownMenuContentProps,\n} from \"./dropdown-menu\";\nexport {\n EditableLabel,\n type EditableLabelActivation,\n type EditableLabelCommitMode,\n type EditableLabelProps,\n} from \"./editable-label\";\nexport {\n BasicInput,\n EnterInput,\n Input,\n InputWithPrefix,\n type EnterInputProps,\n type InputProps,\n type InputVariant,\n type InputWithPrefixProps,\n} from \"./input\";\nexport { Label } from \"./label\";\nexport {\n OverflowToolbar,\n type OverflowToolbarProps,\n type ToolbarAction,\n type ToolbarActionTone,\n type ToolbarIcon,\n} from \"./overflow-toolbar\";\nexport {\n Popover,\n PopoverAnchor,\n PopoverContent,\n type PopoverContentProps,\n PopoverTrigger,\n} from \"./popover\";\nexport {\n Progress,\n type ProgressProps,\n type ProgressTone,\n} from \"./progress\";\nexport {\n PortalContainerProvider,\n usePortalContainer,\n type PortalContainerProviderProps,\n} from \"./portal-container\";\nexport {\n RadixDialogModalProvider,\n useRadixDialogModal,\n type RadixDialogModalProviderProps,\n} from \"./radix-dialog-modal-context\";\nexport {\n ScrollArea,\n ScrollBar,\n type ScrollAreaProps,\n} from \"./scroll-area\";\nexport {\n DEFAULT_SCORE_THRESHOLDS,\n ScoreRing,\n scoreAccentBgClasses,\n scoreRingColorClasses,\n type ScoreRingProps,\n type ScoreThresholds,\n} from \"./score-ring\";\nexport {\n SegmentedControl,\n type SegmentOption,\n type SegmentedControlProps,\n} from \"./segmented-control\";\nexport {\n Select,\n SelectContent,\n type SelectContentProps,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n selectTriggerVariants,\n type SelectTriggerProps,\n} from \"./select\";\nexport { Separator } from \"./separator\";\nexport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetFooter,\n SheetHeader,\n SheetOverlay,\n SheetPortal,\n SheetTitle,\n SheetTrigger,\n sheetVariants,\n type SheetContentProps,\n} from \"./sheet\";\nexport { Skeleton, type SkeletonProps } from \"./skeleton\";\nexport { Switch, type SwitchProps, type SwitchSize } from \"./switch\";\nexport {\n TabbedBottomSheet,\n type TabbedBottomSheetProps,\n type TabbedBottomSheetTab,\n} from \"./tabbed-bottom-sheet\";\nexport {\n Table,\n TableBody,\n TableCaption,\n TableCell,\n TableFooter,\n TableHead,\n TableHeader,\n TableRow,\n useTableSize,\n type TableHeaderProps,\n type TableProps,\n type TableSize,\n} from \"./table\";\nexport {\n Tabs,\n TabsContent,\n TabsList,\n TabsTrigger,\n TabsTriggerCore,\n} from \"./tabs\";\nexport {\n BasicTextarea,\n Textarea,\n TextareaWithPrefix,\n type TextareaProps,\n type TextareaWithPrefixProps,\n} from \"./textarea\";\nexport { MOBILE_BREAKPOINT, useIsMobile } from \"./use-is-mobile\";\nexport {\n useScrollFade,\n type ScrollFadeState,\n type UseScrollFadeResult,\n} from \"./use-scroll-fade\";\n\nexport {\n Drawer,\n DrawerBody,\n DrawerClose,\n DrawerContent,\n DrawerContentPrimitive,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerOverlay,\n DrawerPortal,\n DrawerTitle,\n DrawerTrigger,\n useDrawerDirection,\n type DrawerContentProps,\n type DrawerDirection,\n type DrawerProps,\n type DrawerSize,\n} from \"./drawer\";\nexport {\n HoverCard,\n HoverCardContent,\n HoverCardTrigger,\n type HoverCardContentProps,\n} from \"./hover-card\";\nexport {\n RadioGroup,\n RadioGroupItem,\n type RadioGroupItemProps,\n type RadioGroupProps,\n type RadioGroupSize,\n} from \"./radio-group\";\nexport {\n ResizableHandle,\n ResizablePanel,\n ResizablePanelGroup,\n type ResizableHandleProps,\n type ResizableHandleSize,\n} from \"./resizable\";\nexport { Slider, type SliderProps, type SliderSize } from \"./slider\";\nexport {\n Toggle,\n ToggleGroup,\n ToggleGroupItem,\n toggleVariants,\n type ToggleGroupItemProps,\n type ToggleGroupProps,\n type ToggleProps,\n} from \"./toggle\";\nexport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n type TooltipContentProps,\n} from \"./tooltip\";\n\n/**\n * THE MOTION CONTRACT (0.10.0, + the 0.10.1 geometry split). Exported so a\n * host can assert against the\n * same class names the package applies — and so a consumer auditing its own\n * CSS can prove it is not relying on `tailwindcss-animate` / `tw-animate-css`\n * for anything this package renders. Do not hand-write these strings.\n */\nexport {\n ALL_MOTION_CLASSES,\n CENTERED_DIALOG,\n FORBIDDEN_HOST_MOTION_UTILITIES,\n MOTION_BOTTOM_SHEET,\n MOTION_DIALOG,\n MOTION_OVERLAY,\n MOTION_POPPER,\n MOTION_PULSE,\n MOTION_SHEET,\n MOTION_SPIN,\n POPPER_OFFSET,\n} from \"./motion\";\n","\"use client\";\n\n/**\n * Accordion — the last primitive the fleet was still standing in for.\n *\n * The census that motivated this file (2026-09-07, census row 19c): the growth\n * waves collapsed Card, Table, Alert, Avatar, Progress, Collapsible, Checkbox,\n * Slider and RadioGroup into this package, but Accordion existed nowhere in\n * it — so `aidream/apps/workflow-studio`'s DB-authored component scope was\n * still handing agent-authored components four dependency-free `<div>`s named\n * Accordion / AccordionItem / AccordionTrigger / AccordionContent. A DB-\n * authored component that asked for an accordion got four stacked divs: every\n * section permanently open, no trigger, no keyboard, no ARIA. That is the\n * \"dead-looking screen\" failure, not a styling nit.\n *\n * THE ROOT RENDERS UNCONDITIONALLY — no mount gate. The matrx-frontend\n * original carried a wrapper that deferred rendering until after hydration on\n * the theory that \"Radix generates dynamic aria-controls ids that differ\n * between SSR and client\". That is false — Radix ids come from React's\n * SSR-stable `useId` — and the gate deleted every accordion HEADER (and any\n * defaultValue-open item) from SSR and the first client paint. Same reasoning,\n * same verdict, as `collapsible.tsx`.\n *\n * Density is a PROP, exactly as on Card and Table: declared once on the root,\n * read from context by every trigger and panel, so an accordion cannot end up\n * with a `p-4` header above a `p-2` body.\n *\n * sm → py-2 trigger, pb-2 content (dense panels, inspector sidebars)\n * md → p-4 trigger, pb-4 content (reading surfaces; the default)\n *\n * The open/close height transition is package-owned CSS\n * (`.matrx-accordion-content` in `styles.css`, keyed off Radix's\n * `--radix-accordion-content-height`). It is NOT the Tailwind\n * `animate-accordion-down` utility the matrx-frontend fork used: that name\n * only exists in a host `tailwind.config.js`, so a fresh consumer got a\n * component that jumped open with no animation and no error — the exact\n * silent-host-contract failure C26 (the styling contract) exists to stop.\n *\n * Colour is tokens only.\n */\n\nimport * as AccordionPrimitive from \"@radix-ui/react-accordion\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { RadixChevronDownIcon } from \"./icons\";\n\nexport type AccordionSize = \"sm\" | \"md\";\n\nconst ACCORDION_SIZES: Record<\n AccordionSize,\n { trigger: string; content: string }\n> = {\n sm: { trigger: \"py-2 text-sm\", content: \"pb-2\" },\n md: { trigger: \"p-4 text-sm\", content: \"px-4 pb-4\" },\n};\n\nconst AccordionSizeContext = React.createContext<AccordionSize>(\"md\");\n\n/** The density the nearest enclosing `<Accordion>` declared. `md` outside one. */\nexport function useAccordionSize(): AccordionSize {\n return React.useContext(AccordionSizeContext);\n}\n\ntype AccordionRootProps = React.ComponentPropsWithoutRef<\n typeof AccordionPrimitive.Root\n> & {\n /** Density for this accordion and every section inside it. Default `md`. */\n size?: AccordionSize;\n};\n\nexport type AccordionProps = AccordionRootProps;\n\nconst Accordion = React.forwardRef<\n React.ComponentRef<typeof AccordionPrimitive.Root>,\n AccordionRootProps\n>(({ size = \"md\", ...props }, ref) => (\n <AccordionSizeContext.Provider value={size}>\n <AccordionPrimitive.Root ref={ref} data-slot=\"accordion\" data-size={size} {...props} />\n </AccordionSizeContext.Provider>\n));\nAccordion.displayName = \"Accordion\";\n\nconst AccordionItem = React.forwardRef<\n React.ComponentRef<typeof AccordionPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>\n>(({ className, ...props }, ref) => (\n <AccordionPrimitive.Item\n ref={ref}\n data-slot=\"accordion-item\"\n // A single-item accordion is a disclosure, not a list — the divider under\n // it would be a line under nothing.\n className={cn(\"[&:not(:only-child)]:border-b\", className)}\n {...props}\n />\n));\nAccordionItem.displayName = \"AccordionItem\";\n\nexport interface AccordionTriggerProps\n extends React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger> {\n /**\n * Controls rendered on the trigger row, before the chevron (a count badge, a\n * status pill). They live INSIDE the button, so keep them non-interactive —\n * a nested button is invalid HTML and swallows the toggle.\n */\n rightElements?: React.ReactNode;\n}\n\nconst AccordionTrigger = React.forwardRef<\n React.ComponentRef<typeof AccordionPrimitive.Trigger>,\n AccordionTriggerProps\n>(({ className, children, rightElements, ...props }, ref) => {\n const size = useAccordionSize();\n return (\n <AccordionPrimitive.Header className=\"flex w-full\">\n <AccordionPrimitive.Trigger\n ref={ref}\n data-slot=\"accordion-trigger\"\n className={cn(\n \"flex w-full items-center justify-between gap-2 rounded-md text-left font-medium transition-all\",\n \"hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n \"[&[data-state=open]>[data-slot=accordion-trigger-end]>svg]:rotate-180\",\n ACCORDION_SIZES[size].trigger,\n className,\n )}\n {...props}\n >\n {children}\n <span\n data-slot=\"accordion-trigger-end\"\n className=\"flex shrink-0 items-center gap-2\"\n >\n {rightElements}\n <RadixChevronDownIcon className=\"size-4 shrink-0 text-muted-foreground transition-transform duration-200\" />\n </span>\n </AccordionPrimitive.Trigger>\n </AccordionPrimitive.Header>\n );\n});\nAccordionTrigger.displayName = \"AccordionTrigger\";\n\nconst AccordionContent = React.forwardRef<\n React.ComponentRef<typeof AccordionPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>\n>(({ className, children, ...props }, ref) => {\n const size = useAccordionSize();\n return (\n <AccordionPrimitive.Content\n ref={ref}\n data-slot=\"accordion-content\"\n className=\"matrx-accordion-content overflow-hidden text-sm\"\n {...props}\n >\n <div className={cn(ACCORDION_SIZES[size].content, className)}>{children}</div>\n </AccordionPrimitive.Content>\n );\n});\nAccordionContent.displayName = \"AccordionContent\";\n\nexport { Accordion, AccordionContent, AccordionItem, AccordionTrigger };\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","/**\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 `matrx-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\n/**\n * @radix-ui/react-icons `DragHandleDots2Icon` — the grip on `ResizableHandle`.\n * Inlined per C19: this package depends on no icon library.\n */\nexport function DragHandleDots2Icon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M4.5 2.5C5.05228 2.5 5.5 2.05228 5.5 1.5C5.5 0.947715 5.05228 0.5 4.5 0.5C3.94772 0.5 3.5 0.947715 3.5 1.5C3.5 2.05228 3.94772 2.5 4.5 2.5ZM4.5 6.5C5.05228 6.5 5.5 6.05229 5.5 5.5C5.5 4.94771 5.05228 4.5 4.5 4.5C3.94772 4.5 3.5 4.94771 3.5 5.5C3.5 6.05229 3.94772 6.5 4.5 6.5ZM5.5 9.5C5.5 10.0523 5.05228 10.5 4.5 10.5C3.94772 10.5 3.5 10.0523 3.5 9.5C3.5 8.94771 3.94772 8.5 4.5 8.5C5.05228 8.5 5.5 8.94771 5.5 9.5ZM4.5 14.5C5.05228 14.5 5.5 14.0523 5.5 13.5C5.5 12.9477 5.05228 12.5 4.5 12.5C3.94772 12.5 3.5 12.9477 3.5 13.5C3.5 14.0523 3.94772 14.5 4.5 14.5ZM11.5 1.5C11.5 2.05228 11.0523 2.5 10.5 2.5C9.94771 2.5 9.5 2.05228 9.5 1.5C9.5 0.947715 9.94771 0.5 10.5 0.5C11.0523 0.5 11.5 0.947715 11.5 1.5ZM10.5 6.5C11.0523 6.5 11.5 6.05229 11.5 5.5C11.5 4.94771 11.0523 4.5 10.5 4.5C9.94771 4.5 9.5 4.94771 9.5 5.5C9.5 6.05229 9.94771 6.5 10.5 6.5ZM11.5 9.5C11.5 10.0523 11.0523 10.5 10.5 10.5C9.94771 10.5 9.5 10.0523 9.5 9.5C9.5 8.94771 9.94771 8.5 10.5 8.5C11.0523 8.5 11.5 8.94771 11.5 9.5ZM10.5 14.5C11.0523 14.5 11.5 14.0523 11.5 13.5C11.5 12.9477 11.0523 12.5 10.5 12.5C9.94771 12.5 9.5 12.9477 9.5 13.5C9.5 14.0523 9.94771 14.5 10.5 14.5Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n","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","\"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 vaul wrappers (root + unstyled content primitive) were inlined here\n * privately in 0.5.0 because no shared Drawer existed. Since 0.6.0 the\n * package OWNS `./drawer`, so this file composes `Drawer` and\n * `DrawerContentPrimitive` from it: one vaul wrapper in the package, not\n * two. BottomSheet keeps its own geometry (that IS its product).\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 { Drawer as DrawerRoot, DrawerContentPrimitive } from \"./drawer\";\nimport { ChevronLeftIcon } from \"./icons\";\n\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","\"use client\";\n\n/**\n * Drawer — the vaul drawer family, and the package's iOS-mobile-first surface.\n *\n * WHY IT IS HERE. matrx-frontend's `components/ui/drawer.tsx` had 121 import\n * sites, and that host's own doctrine is \"Drawer, not Dialog, on mobile\" — so\n * the drawer is the surface most of this platform's mobile UX lands on. It was\n * also the LAST place still holding a copy of `RadixDialogModalProvider`, the\n * context this package already owned: a host copy of a React CONTEXT is the\n * quiet twin, because `useContext` matches by object identity, so the host\n * Drawer's provider and the package Sheet's consumer were two different\n * contexts that merely looked alike. Shipping the Drawer here closes that.\n *\n * `BottomSheet` (this package) previously inlined its own private vaul\n * wrappers because no Drawer existed to share; it now composes these, so there\n * is one vaul wrapper in the package rather than two.\n *\n * THE MOBILE-FIRST RULES THIS COMPONENT OWNS (so no host re-derives them):\n *\n * 1. `dvh`, NEVER `vh`. iOS Safari's `vh` is the tallest-possible viewport, so\n * a `vh`-capped drawer hides its own footer behind the browser chrome. The\n * cap is `max-h-[90dvh]`, and `size=\"full\"` is `h-dvh`.\n * 2. THE SAFE AREA IS PADDING, NOT A GUESS. Content bottom padding is\n * `pb-safe` (`env(safe-area-inset-bottom)`; shipped in `styles.css`), so the\n * home indicator never sits on top of the last control.\n * 3. THE GRAB HANDLE IS A 44px TARGET. The visible pill is 4px tall; it lives\n * inside a `min-h-11` (44px) grab area, the Apple HIG minimum. The old host\n * copy shipped the pill alone, so the affordance was three times smaller\n * than the gesture it advertises.\n * 4. THE BODY SCROLLS, THE FOOTER DOES NOT. `DrawerBody` is the\n * `flex-1 min-h-0 overflow-y-auto overscroll-contain` shard;\n * `DrawerFooter` is `mt-auto` and safe-area padded, so the primary action\n * is reachable however long the body is.\n * 5. A FIELD UNDER 16px ZOOMS iOS IN AND NEVER BACK OUT — the drawer's own\n * text scale therefore never goes below `text-base` on coarse pointers;\n * the floor itself is a host CSS concern, restated in `styles.css`.\n *\n * `direction` is forwarded to vaul and drives the content geometry, so a side\n * or top drawer is a prop rather than a fork.\n */\n\nimport { treeContainsComponent } from \"@ai-matrx/kit/react-tree\";\nimport * as React from \"react\";\nimport { Drawer as DrawerPrimitive } from \"vaul\";\n\nimport { cn } from \"./cn\";\nimport { RadixDialogModalProvider } from \"./radix-dialog-modal-context\";\n\nexport type DrawerDirection = \"top\" | \"bottom\" | \"left\" | \"right\";\n\nconst DrawerDirectionContext = React.createContext<DrawerDirection>(\"bottom\");\n\n/** The direction of the nearest Drawer root. */\nexport const useDrawerDirection = (): DrawerDirection =>\n React.useContext(DrawerDirectionContext);\n\n/**\n * `vaul`'s Root props are a DISCRIMINATED UNION (the snap-point branch adds\n * `fadeFromIndex`), so this type intersects the union rather than `Omit`-ing\n * from it — flattening the union collapses the discriminant and makes every\n * snap-point drawer a type error.\n *\n * Vaul does not forward `modal={false}` to its underlying Radix root, so a\n * \"non-modal\" drawer would claim ARIA semantics it does not have; the type\n * refuses the value rather than shipping the lie.\n */\nexport type DrawerProps = React.ComponentProps<typeof DrawerPrimitive.Root> & {\n modal?: true;\n direction?: DrawerDirection;\n};\n\nconst Drawer = ({\n children,\n shouldScaleBackground = true,\n ...props\n}: DrawerProps) => {\n const direction: DrawerDirection = props.direction ?? \"bottom\";\n return (\n <RadixDialogModalProvider modal>\n <DrawerDirectionContext.Provider value={direction}>\n <DrawerPrimitive.Root\n modal\n shouldScaleBackground={shouldScaleBackground}\n {...props}\n direction={direction}\n >\n {children}\n </DrawerPrimitive.Root>\n </DrawerDirectionContext.Provider>\n </RadixDialogModalProvider>\n );\n};\nDrawer.displayName = \"Drawer\";\n\nconst DrawerTrigger = DrawerPrimitive.Trigger;\nconst DrawerPortal = DrawerPrimitive.Portal;\nconst DrawerClose = DrawerPrimitive.Close;\n\nconst DrawerOverlay = React.forwardRef<\n React.ComponentRef<typeof DrawerPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DrawerPrimitive.Overlay\n ref={ref}\n data-slot=\"drawer-overlay\"\n className={cn(\n \"fixed inset-0 z-[10000] bg-[var(--matrx-overlay-scrim)]\",\n className,\n )}\n {...props}\n />\n));\nDrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName;\n\nconst DrawerDescription = React.forwardRef<\n React.ComponentRef<typeof DrawerPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DrawerPrimitive.Description\n ref={ref}\n data-slot=\"drawer-description\"\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nDrawerDescription.displayName = DrawerPrimitive.Description.displayName;\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\n/**\n * `adaptive` (default) sizes to content up to 90dvh — right for one short\n * list. `full` is ONE fixed height that never changes as content changes: use\n * it for any drawer whose body varies (tabs, search results, multi-level\n * navigation), because an adaptive drawer there resizes under the user's thumb\n * on every keystroke, which reads as the panel jumping.\n */\nexport type DrawerSize = \"adaptive\" | \"full\";\n\nconst DIRECTION_CLASSES: Record<DrawerDirection, string> = {\n bottom:\n \"inset-x-0 bottom-0 mt-24 flex-col rounded-t-[10px] border-t pb-safe\",\n top: \"inset-x-0 top-0 mb-24 flex-col rounded-b-[10px] border-b pt-safe\",\n left: \"inset-y-0 left-0 mr-24 flex-row rounded-r-[10px] border-r\",\n right: \"inset-y-0 right-0 ml-24 flex-row rounded-l-[10px] border-l\",\n};\n\nconst SIZE_CLASSES: Record<DrawerDirection, Record<DrawerSize, string>> = {\n bottom: { adaptive: \"h-auto max-h-[90dvh]\", full: \"h-[92dvh]\" },\n top: { adaptive: \"h-auto max-h-[90dvh]\", full: \"h-[92dvh]\" },\n left: { adaptive: \"w-auto max-w-[92vw]\", full: \"h-dvh w-[92vw] max-w-sm\" },\n right: { adaptive: \"w-auto max-w-[92vw]\", full: \"h-dvh w-[92vw] max-w-sm\" },\n};\n\nexport interface DrawerContentProps\n extends React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content> {\n /** Height/width posture. Default `adaptive`. */\n size?: DrawerSize;\n /** Render the drag-handle pill. Default: only for `top`/`bottom` drawers. */\n showHandle?: boolean;\n}\n\nconst DrawerContent = React.forwardRef<\n React.ComponentRef<typeof DrawerPrimitive.Content>,\n DrawerContentProps\n>(({ className, children, size = \"adaptive\", showHandle, ...props }, ref) => {\n const direction = useDrawerDirection();\n const hasDescription =\n treeContainsComponent(children, DrawerDescription) ||\n treeContainsComponent(children, DrawerPrimitive.Description);\n const withHandle =\n showHandle ?? (direction === \"bottom\" || direction === \"top\");\n\n return (\n <DrawerPortal>\n <DrawerOverlay />\n <DrawerContentPrimitive\n ref={ref}\n data-slot=\"drawer-content\"\n data-direction={direction}\n className={cn(\n \"fixed z-[10000] flex min-w-0 border bg-background\",\n DIRECTION_CLASSES[direction],\n SIZE_CLASSES[direction][size],\n className,\n )}\n {...(hasDescription ? {} : { \"aria-describedby\": undefined })}\n {...props}\n >\n {withHandle ? (\n // Rule 3: the pill is 4px; the TARGET is 44px.\n <div\n aria-hidden\n data-slot=\"drawer-handle\"\n className={cn(\n \"flex min-h-11 w-full shrink-0 cursor-grab items-center justify-center active:cursor-grabbing\",\n direction === \"top\" && \"order-last\",\n )}\n >\n <div className=\"h-1 w-[100px] rounded-full bg-muted\" />\n </div>\n ) : null}\n {children}\n </DrawerContentPrimitive>\n </DrawerPortal>\n );\n});\nDrawerContent.displayName = \"DrawerContent\";\n\nconst DrawerHeader = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n data-slot=\"drawer-header\"\n className={cn(\n \"grid shrink-0 gap-1.5 p-4 text-center sm:text-left\",\n className,\n )}\n {...props}\n />\n);\nDrawerHeader.displayName = \"DrawerHeader\";\n\n/**\n * The scroll shard. `flex-1 min-h-0` is the pair that actually bounds a scroll\n * area inside a flex column — `flex-1` alone leaves `min-height: auto`, and the\n * body grows past the drawer instead of scrolling inside it.\n */\nconst DrawerBody = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n data-slot=\"drawer-body\"\n className={cn(\"min-h-0 flex-1 overflow-y-auto overscroll-contain px-4\", className)}\n {...props}\n />\n);\nDrawerBody.displayName = \"DrawerBody\";\n\nconst DrawerFooter = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n data-slot=\"drawer-footer\"\n className={cn(\"mt-auto flex shrink-0 flex-col gap-2 p-4 pb-safe\", className)}\n {...props}\n />\n);\nDrawerFooter.displayName = \"DrawerFooter\";\n\nconst DrawerTitle = React.forwardRef<\n React.ComponentRef<typeof DrawerPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DrawerPrimitive.Title\n ref={ref}\n data-slot=\"drawer-title\"\n className={cn(\n \"text-lg font-semibold leading-none tracking-tight\",\n className,\n )}\n {...props}\n />\n));\nDrawerTitle.displayName = DrawerPrimitive.Title.displayName;\n\nexport {\n Drawer,\n DrawerBody,\n DrawerClose,\n DrawerContent,\n DrawerContentPrimitive,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerOverlay,\n DrawerPortal,\n DrawerTitle,\n DrawerTrigger,\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\n/**\n * Alert — the inline status banner (76 host import sites).\n *\n * Ported from matrx-frontend `components/ui/alert.tsx`. That copy shipped two\n * variants, `default` and `destructive`, so every \"this is a warning\" and\n * \"this succeeded\" banner in the fleet was hand-rolled: an amber or emerald\n * `<div>` carrying literal palette classes and a hand-written dark-mode twin,\n * written once per surface. The census that opened this wave found dozens of those\n * across four repos.\n *\n * So the variant set is the token vocabulary this package already declares —\n * `default | destructive | warning | success | info` — and none of them\n * hardcode a colour (C26). A host that wants a different amber changes\n * `--warning`; it never writes another banner.\n *\n * `Alert` is a plain `role=\"alert\"` region, NOT a toast: it stays on the page,\n * it is not dismissed on a timer, and a screen reader announces it where it\n * sits. Transient notifications are the host's toast system.\n */\n\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nconst alertVariants = cva(\n \"relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg~*]:pl-7\",\n {\n variants: {\n variant: {\n default: \"bg-background text-foreground [&>svg]:text-foreground\",\n destructive:\n \"border-destructive/50 bg-destructive/5 text-destructive dark:border-destructive [&>svg]:text-destructive\",\n warning:\n \"border-warning/50 bg-warning/5 text-warning dark:border-warning [&>svg]:text-warning\",\n success:\n \"border-success/50 bg-success/5 text-success dark:border-success [&>svg]:text-success\",\n info: \"border-info/50 bg-info/5 text-info dark:border-info [&>svg]:text-info\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\n\nexport interface AlertProps\n extends React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof alertVariants> {}\n\nconst Alert = React.forwardRef<HTMLDivElement, AlertProps>(\n ({ className, variant, ...props }, ref) => (\n <div\n ref={ref}\n role=\"alert\"\n data-slot=\"alert\"\n data-variant={variant ?? \"default\"}\n className={cn(alertVariants({ variant }), className)}\n {...props}\n />\n ),\n);\nAlert.displayName = \"Alert\";\n\nconst AlertTitle = React.forwardRef<\n HTMLHeadingElement,\n React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n <h5\n ref={ref}\n data-slot=\"alert-title\"\n className={cn(\"mb-1 font-medium leading-none tracking-tight\", className)}\n {...props}\n />\n));\nAlertTitle.displayName = \"AlertTitle\";\n\nconst AlertDescription = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"alert-description\"\n className={cn(\"text-sm [&_p]:leading-relaxed\", className)}\n {...props}\n />\n));\nAlertDescription.displayName = \"AlertDescription\";\n\nexport { Alert, AlertDescription, AlertTitle, alertVariants };\n","\"use client\";\n\n/**\n * AlertDialog — the confirm/destroy surface (78 host import sites).\n *\n * Ported from matrx-frontend `components/ui/alert-dialog.tsx`, which was the\n * only variant in the fleet that had been hardened. Its rulings, kept verbatim:\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, and it deleted always-visible Triggers (delete buttons, mostly)\n * from SSR and the first client paint.\n *\n * 2. AN UNDESCRIBED ALERT DIALOG STILL DESCRIBES ITSELF. A confirm dialog with\n * no `AlertDialogDescription` gets a screen-reader-only one rather than a\n * console warning — the surface where a blind user is about to destroy\n * something is the wrong place to ship an accessibility gap.\n *\n * ADDED HERE, from the same doctrine `Dialog` already carries and this\n * component demonstrably needed:\n *\n * 3. IT IS CLAMPED TO THE VIEWPORT AND SCROLLS INSIDE ITSELF\n * (`max-h-[85dvh] overflow-y-auto`). The host copy was NOT — an alert\n * dialog whose body listed what is about to be deleted pushed Cancel and\n * Continue below the fold on a short viewport, and the only way out was a\n * backdrop click. On an ALERT dialog Radix does not dismiss on backdrop\n * click, so the surface was a genuine dead end. Recorded in CHANGELOG as a\n * real defect fixed in the port, not \"preserved\".\n *\n * 4. THE ACTIONS ARE 44px TALL ON COARSE POINTERS. `AlertDialogAction` and\n * `AlertDialogCancel` inherit the package Button's own target rules through\n * `buttonVariants`; the footer keeps them safe-area padded on mobile.\n *\n * SEAM INVERSION. The host resolved its portal target through\n * `usePopoutContainer` (its window-panel popout body); here that is the\n * package's `PortalContainerProvider`, with an explicit `container` prop still\n * winning.\n */\n\nimport * as AlertDialogPrimitive from \"@radix-ui/react-alert-dialog\";\nimport { treeContainsComponent } from \"@ai-matrx/kit/react-tree\";\nimport * as React from \"react\";\n\nimport { buttonVariants } from \"./button\";\nimport { cn } from \"./cn\";\nimport { CENTERED_DIALOG, MOTION_DIALOG, MOTION_OVERLAY } from \"./motion\";\nimport { usePortalContainer } from \"./portal-container\";\n\nconst AlertDialog = AlertDialogPrimitive.Root;\n\nconst AlertDialogTrigger = AlertDialogPrimitive.Trigger;\n\n/**\n * Portal-seam-aware AlertDialogPortal. Explicit `container` wins; with none,\n * the injected container; with neither, Radix's `document.body`.\n */\nconst AlertDialogPortal = ({\n container,\n ...props\n}: Omit<\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.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 (\n <AlertDialogPrimitive.Portal container={resolved ?? null} {...props} />\n );\n};\nAlertDialogPortal.displayName = \"AlertDialogPortal\";\n\nconst AlertDialogOverlay = React.forwardRef<\n React.ComponentRef<typeof AlertDialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Overlay\n ref={ref}\n data-slot=\"alert-dialog-overlay\"\n className={cn(\n \"fixed inset-0 z-[10000] bg-[var(--matrx-overlay-scrim)]\",\n MOTION_OVERLAY,\n className,\n )}\n {...props}\n />\n));\nAlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;\n\n/**\n * Unstyled, non-portalling Content for custom layouts. AlertDialog is always\n * modal, so `aria-modal` is stated rather than derived.\n */\nconst AlertDialogContentPrimitive = React.forwardRef<\n React.ComponentRef<typeof AlertDialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>\n>((props, ref) => (\n <AlertDialogPrimitive.Content {...props} ref={ref} aria-modal=\"true\" />\n));\nAlertDialogContentPrimitive.displayName = \"AlertDialogContentPrimitive\";\n\nconst AlertDialogDescription = React.forwardRef<\n React.ComponentRef<typeof AlertDialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Description\n ref={ref}\n data-slot=\"alert-dialog-description\"\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nAlertDialogDescription.displayName =\n AlertDialogPrimitive.Description.displayName;\n\nexport interface AlertDialogContentProps\n extends React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content> {\n /** Explicit portal target; wins over the injected container. */\n container?: HTMLElement | null;\n /**\n * Package-owned open/close motion. Default `true`. Pass `false` for a\n * surface that must appear instantly. It is NOT the reduced-motion switch;\n * `styles.css` already honours `prefers-reduced-motion`.\n */\n animated?: boolean;\n}\n\nconst AlertDialogContent = React.forwardRef<\n React.ComponentRef<typeof AlertDialogPrimitive.Content>,\n AlertDialogContentProps\n>(({ className, children, container, animated = true, ...props }, ref) => {\n const hasDescription =\n treeContainsComponent(children, AlertDialogDescription) ||\n treeContainsComponent(children, AlertDialogPrimitive.Description);\n return (\n <AlertDialogPortal container={container}>\n <AlertDialogOverlay />\n <AlertDialogContentPrimitive\n ref={ref}\n data-slot=\"alert-dialog-content\"\n className={cn(\n `fixed left-[50%] top-[50%] z-[10000] grid min-w-0 w-full max-w-lg ${CENTERED_DIALOG} gap-4 border bg-background p-6 shadow-lg`,\n // Ruling 3 — never taller than the viewport, always scrollable, and\n // the footer stays reachable via --dialog-pad like Dialog's.\n \"max-h-[85dvh] overflow-y-auto overscroll-contain [--dialog-pad:1.5rem] overflow-x-clip [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full\",\n \"sm:rounded-lg\",\n animated && MOTION_DIALOG,\n className,\n )}\n {...props}\n >\n {hasDescription ? null : (\n <AlertDialogPrimitive.Description className=\"sr-only\">\n Please confirm the action described in this dialog.\n </AlertDialogPrimitive.Description>\n )}\n {children}\n </AlertDialogContentPrimitive>\n </AlertDialogPortal>\n );\n});\nAlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;\n\nconst AlertDialogHeader = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n data-slot=\"alert-dialog-header\"\n className={cn(\"flex flex-col space-y-2 text-center sm:text-left\", className)}\n {...props}\n />\n);\nAlertDialogHeader.displayName = \"AlertDialogHeader\";\n\nconst AlertDialogFooter = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n data-slot=\"alert-dialog-footer\"\n className={cn(\n \"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n // Ruling 3/4 — sticky to the card edges so a scrolled body never shows\n // through under the actions, and safe-area padded on a phone.\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);\nAlertDialogFooter.displayName = \"AlertDialogFooter\";\n\nconst AlertDialogTitle = React.forwardRef<\n React.ComponentRef<typeof AlertDialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Title\n ref={ref}\n data-slot=\"alert-dialog-title\"\n className={cn(\"text-lg font-semibold\", className)}\n {...props}\n />\n));\nAlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;\n\nconst AlertDialogAction = React.forwardRef<\n React.ComponentRef<typeof AlertDialogPrimitive.Action>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Action\n ref={ref}\n data-slot=\"alert-dialog-action\"\n className={cn(buttonVariants(), className)}\n {...props}\n />\n));\nAlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;\n\nconst AlertDialogCancel = React.forwardRef<\n React.ComponentRef<typeof AlertDialogPrimitive.Cancel>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Cancel\n ref={ref}\n data-slot=\"alert-dialog-cancel\"\n className={cn(\n buttonVariants({ variant: \"outline\" }),\n \"mt-2 sm:mt-0\",\n className,\n )}\n {...props}\n />\n));\nAlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;\n\nexport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogContentPrimitive,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogOverlay,\n AlertDialogPortal,\n AlertDialogTitle,\n AlertDialogTrigger,\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 /**\n * An explicit spelling of `default`, identical by construction. It is\n * not decoration: matrx-frontend's `ButtonMine` fork carried it, ~17\n * call sites say `variant=\"primary\"`, and the alternative to keeping\n * the word was a host shim translating a prop — the massage C22 bans.\n */\n primary: \"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 /** The affirmative twin of `destructive` — confirm, approve, publish. */\n success:\n \"bg-success text-success-foreground shadow-sm hover:bg-success/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 /**\n * ONE size scale, xs → 3xl, plus the two icon boxes. The top and bottom\n * of the scale came in from matrx-frontend's `ButtonMine` fork (2026-09-07):\n * a dense toolbar needs `xs`, and a marketing/hero call to action needs\n * `xl`+. A host that has to reach outside this scale forks the button,\n * which is exactly how `ButtonMine` was born.\n */\n size: {\n xs: \"h-6 rounded-md px-1 text-xs\",\n sm: \"h-8 rounded-md px-3 text-xs\",\n default: \"h-9 px-4 py-2\",\n /** An explicit spelling of `default` (the fork's middle rung). */\n md: \"h-9 px-4 py-2\",\n lg: \"h-10 rounded-md px-6\",\n xl: \"h-12 px-8 py-3 text-base\",\n \"2xl\": \"h-14 px-10 py-3 text-base\",\n \"3xl\": \"h-16 px-12 py-3 text-base\",\n icon: \"h-9 w-9\",\n \"icon-sm\": \"h-7 w-7\",\n /** A circular icon box — an avatar-shaped control, not a square one. */\n roundIcon: \"h-8 w-8 rounded-full p-0\",\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","/**\n * THE MOTION CONTRACT (0.10.0) — the class names every animated surface in\n * this package puts on the DOM, in ONE place.\n *\n * Why a module and not ten inline strings: the sweep that produced this file\n * found the same defect ten times over, and it was invisible each time\n * because each primitive spelled its animation out by hand. Ten hand-written\n * copies of `data-[state=open]:animate-in data-[state=closed]:animate-out\n * data-[state=closed]:fade-out-0 …` meant ten chances to reach for a utility\n * nothing in the package defines — which is exactly what happened. A single\n * exported constant per motion SHAPE means the next primitive cannot invent\n * an eleventh spelling, and `styles.test.ts` can prove every one of them\n * resolves to a rule in the shipped stylesheet.\n *\n * Every rule these name lives in `styles.css` under the package's own\n * keyframes. NONE of them is a Tailwind utility, and none requires a host\n * plugin — see that file's header for the measurement that made this\n * necessary.\n */\n\n/** Modal scrims: Dialog, AlertDialog, Sheet, CommandDialog. Fade only. */\nexport const MOTION_OVERLAY = \"matrx-motion-overlay\";\n\n/** The centred dialog card. Fades and scales; centring is not its business. */\nexport const MOTION_DIALOG = \"matrx-motion-dialog\";\n\n/**\n * THE CENTRING OF A CENTRED DIALOG CARD — package-owned, in the `translate`\n * property, and NEVER a Tailwind `translate-x-[-50%] translate-y-[-50%]` pair.\n *\n * Those utilities do not compile to the same thing in every host: Tailwind v3\n * writes them into `transform`, Tailwind v4 writes them into the independent\n * `translate` property, which COMPOSES with `transform` instead of being\n * replaced by it. 0.10.0's keyframes restated the centring inside `transform`,\n * which was harmless on v3 and doubled the centring on v4 — the card flew in\n * from off the top-left of the viewport for the animation's whole duration and\n * snapped into place at the end (fixed in 0.10.1).\n *\n * Owning it here means one spelling that reads the same on both, and it frees\n * `transform` so the keyframes carry ONLY the delta. Put this on every centred\n * surface UNCONDITIONALLY — it is geometry, so unlike {@link MOTION_DIALOG} it\n * must survive `animated={false}`. Its rule ships in `styles.css`.\n */\nexport const CENTERED_DIALOG = \"matrx-dialog-centered\";\n\n/**\n * The resting gap between a `popper`-positioned surface and its trigger, for\n * the primitives that want one (today: `Select`). Same law and same reason as\n * {@link CENTERED_DIALOG} — a position an animated surface holds AT REST is\n * the `translate` property's job, never a Tailwind translate utility, because\n * those land in `transform` on a v3 host and in `translate` on a v4 one while\n * the keyframes animate `transform` either way. Sizes from\n * `--matrx-popper-offset`; keys off Radix's `data-side`.\n */\nexport const POPPER_OFFSET = \"matrx-popper-offset\";\n\n/** The mobile Dialog / CommandDialog bottom sheet. Slides up and fades. */\nexport const MOTION_BOTTOM_SHEET = \"matrx-motion-bottom-sheet\";\n\n/**\n * Radix-popper surfaces: Popover, DropdownMenu, ContextMenu, HoverCard,\n * Select, Tooltip. Reads `--radix-popper-transform-origin` so the surface\n * grows out of its trigger, and `data-side` so it travels from it.\n */\nexport const MOTION_POPPER = \"matrx-motion-popper\";\n\n/** Edge sheets, one class per `sheetVariants` side. */\nexport const MOTION_SHEET = {\n top: \"matrx-motion-sheet-top\",\n bottom: \"matrx-motion-sheet-bottom\",\n left: \"matrx-motion-sheet-left\",\n right: \"matrx-motion-sheet-right\",\n center: \"matrx-motion-sheet-center\",\n} as const;\n\n/** Skeleton's breathing loop. */\nexport const MOTION_PULSE = \"matrx-pulse\";\n\n/** The spinner loop, for every inline busy indicator in the package. */\nexport const MOTION_SPIN = \"matrx-spin\";\n\n/**\n * Every motion class the package ships, for the guards. If a rule for one of\n * these is missing from `styles.css`, a component animates in no consumer and\n * says nothing about it — the C26 failure this list exists to make loud.\n */\nexport const ALL_MOTION_CLASSES = [\n MOTION_OVERLAY,\n MOTION_DIALOG,\n MOTION_BOTTOM_SHEET,\n MOTION_POPPER,\n ...Object.values(MOTION_SHEET),\n MOTION_PULSE,\n MOTION_SPIN,\n] as const;\n\n/**\n * The host-plugin utilities this package is forbidden to emit. They are\n * supplied by `tailwindcss-animate` / `tw-animate-css`, which is a HOST CSS\n * entry concern a package cannot declare a dependency on: three of the four\n * AI Matrx consumers never loaded it, so every surface wearing these appeared\n * with no animation and no error. `styles.test.ts` fails the build if one\n * comes back.\n */\nexport const FORBIDDEN_HOST_MOTION_UTILITIES = [\n \"animate-in\",\n \"animate-out\",\n \"fade-in\",\n \"fade-out\",\n \"zoom-in\",\n \"zoom-out\",\n \"slide-in-from\",\n \"slide-out-to\",\n \"animate-accordion\",\n \"animate-slide-down\",\n \"animate-slide-up\",\n \"animate-pulse\",\n \"animate-spin\",\n] as const;\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 * 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, with the one thing Radix does not ship: the open/close\n * transition.\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 * THE TRANSITION IS PACKAGE-OWNED (census row 19f, the tail of 19c). Until\n * 0.9.0 this file was a bare re-export and the package shipped NO transition,\n * so every consumer invented its own — and two of them invented it wrong.\n * `matrx-collapsible.tsx` and `enhanced-collapsible.tsx` put\n * `animate-accordion-down`/`-up` on a COLLAPSIBLE panel: those keyframes\n * interpolate to `--radix-ACCORDION-content-height`, a variable Radix never\n * publishes on a collapsible, so they had never animated once — silently, with\n * no error, for as long as they existed. Six other matrx-frontend components\n * used host-only `animate-slide-down`/`-up` keyframes that WERE keyed\n * correctly — and worked in exactly one app in the fleet, because the\n * keyframes lived in that app's `globals.css`. Both shapes are the same C26\n * failure: a component whose motion depends on a contract the host has to\n * happen to hold. `.matrx-collapsible-content` in `styles.css` ends it — keyed\n * off Radix's runtime `--radix-collapsible-content-height`, honouring\n * `prefers-reduced-motion`, shipped in the tarball.\n *\n * Nothing else here is restyled: the trigger and the panel's own padding are\n * the host's to dress, and every fork agreed on that. Unlike `AccordionContent`\n * this component does NOT wrap children in a padding div — collapsibles in the\n * fleet pad their own bodies, and inserting a box would move every one of them.\n */\n\nimport * as CollapsiblePrimitive from \"@radix-ui/react-collapsible\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nconst Collapsible = CollapsiblePrimitive.Root;\nconst CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;\n\nexport interface CollapsibleContentProps\n extends React.ComponentPropsWithoutRef<\n typeof CollapsiblePrimitive.CollapsibleContent\n > {\n /**\n * Animate the height on open/close. Default `true`.\n *\n * Pass `false` for the rare panel that must not clip or must not move: the\n * animated panel carries `overflow-hidden` (a height transition without it\n * spills the body over whatever is below), so a panel with a child that\n * deliberately overflows its bounds — a non-portalled popover, a sticky\n * column header — opts out here rather than fighting the class. Opting out\n * gives you bare Radix: instant open, no clipping, no keyframes.\n *\n * `prefers-reduced-motion` is NOT this prop's job; the stylesheet already\n * drops the animation for those users while keeping the clipping.\n */\n animated?: boolean;\n}\n\nconst CollapsibleContent = React.forwardRef<\n React.ComponentRef<typeof CollapsiblePrimitive.CollapsibleContent>,\n CollapsibleContentProps\n>(({ className, animated = true, ...props }, ref) => (\n <CollapsiblePrimitive.CollapsibleContent\n ref={ref}\n data-slot=\"collapsible-content\"\n className={cn(\n animated && \"matrx-collapsible-content overflow-hidden\",\n className,\n )}\n {...props}\n />\n));\nCollapsibleContent.displayName = \"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 {\n CENTERED_DIALOG,\n MOTION_BOTTOM_SHEET,\n MOTION_DIALOG,\n MOTION_OVERLAY,\n} from \"./motion\";\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 ${CENTERED_DIALOG} gap-4 overflow-x-clip border bg-background p-6 shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full 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 rounded-t-2xl rounded-b-none overflow-y-auto overscroll-contain\";\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={cn(\n \"fixed inset-0 z-[10000] bg-[var(--matrx-overlay-scrim-soft)]\",\n MOTION_OVERLAY,\n )}\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 isMobile ? MOTION_BOTTOM_SHEET : MOTION_DIALOG,\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 * 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 * ConfirmDialog — the `window.confirm` replacement, declarative half.\n *\n * WHY IT LIVES HERE AND NOT IN `@ai-matrx/kit` (census row 19i, decided by the\n * package-graph ruling of 2026-09-07, on the row-20a Tooltip precedent).\n *\n * kit shipped this dialog with its own inlined AlertDialog, its own inlined\n * button class strings, a hardcoded 80%-opaque black scrim, and\n * `data-[state=open]:animate-in … zoom-in-95 … slide-in-from-top-[48%]` —\n * host-plugin utilities `tailwindcss-animate`/`tw-animate-css` supply and a\n * package cannot ship. kit ships NO stylesheet at all, so in three of the four\n * consumers the most consequential surface in the app (the one standing\n * between a user and a destroyed thing) appeared with no animation, no error,\n * and a scrim that ignored the theme. kit could not import the fix:\n * `@ai-matrx/design-system` depends on `@ai-matrx/kit`, so importing back is a\n * cycle; giving kit its own sheet would invent a second required-CSS contract\n * no consumer performs (the C26 silent host contract, one layer down).\n *\n * The resolution is the one row 20a already proved: the surface moves to the\n * package that owns the surface. This file is built on THIS package's\n * `AlertDialog` — so it inherits, for free and forever:\n *\n * - the package motion layer (`matrx-motion-overlay` / `matrx-motion-dialog`),\n * whose rules ship in `styles.css` and are proven present in the tarball;\n * - `--matrx-overlay-scrim`, a token that answers to the host's theme,\n * instead of an opaque black literal;\n * - AlertDialog ruling 3 — clamped to `max-h-[85dvh]`, scrolling inside\n * itself, with a sticky footer. **This is what makes the consequence-first\n * copy law survivable**: a confirmation that names everything it is about\n * to destroy can be long, and in kit's copy a long one pushed Cancel and\n * Continue below the fold of a short viewport with no backdrop dismissal —\n * a dead end on a destructive action;\n * - `buttonVariants` as the ONE source of button appearance, including the\n * 44px coarse-pointer target;\n * - `PortalContainerProvider`, so a dialog opened inside a popped-out window\n * panel renders in THAT window's document.\n *\n * kit keeps `./confirm-opener` — the pure, React-free imperative `confirm()`\n * and its `globalThis`-slotted host registry — and re-exports nothing of this.\n * Consumers mount `<ConfirmDialogHost />` from here and call `confirm()` from\n * there. See `confirm-host.tsx` for the join.\n *\n * BEHAVIOR IS THE KIT PORT, VERBATIM. Every prop, default and interaction is\n * unchanged; only the chrome underneath it is the package's.\n *\n * Pattern: hold the pending target in state, render `<ConfirmDialog />` once at\n * the bottom of the component, and open it by setting the target. When busy\n * state is meaningful (a network delete that should hold the dialog open with a\n * spinner), use THIS component inline; the imperative `confirm()` closes\n * immediately on click.\n */\n\nimport * as React from \"react\";\n\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n} from \"./alert-dialog\";\nimport { buttonVariants } from \"./button\";\nimport { cn } from \"./cn\";\nimport { Loader2Icon } from \"./icons\";\nimport { MOTION_SPIN } from \"./motion\";\n\nexport interface ConfirmDialogProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n title: React.ReactNode;\n /**\n * THE CONSEQUENCE. Per the platform's destructive-and-expensive-actions law,\n * a confirmation must name what is lost, what is duplicated, and/or what it\n * costs — \"Are you sure?\" is not a confirmation. This renders as the dialog's\n * accessible description, so a screen-reader user is told the consequence\n * too, and it is never clamped or truncated.\n */\n description?: React.ReactNode | undefined;\n /**\n * Rich body rendered between the header and the footer, OUTSIDE the\n * description `<p>` — use for block-level content (diffs, previews, lists of\n * exactly what is about to be deleted) that would be invalid HTML inside\n * `description`.\n */\n content?: React.ReactNode | undefined;\n /** Extra classes for the dialog content (e.g. a wider max-w for diffs). */\n contentClassName?: string | undefined;\n confirmLabel?: string | undefined;\n /**\n * `null` hides the cancel button entirely — for acknowledge-only dialogs\n * where there is nothing to cancel. Anything else labels it.\n */\n cancelLabel?: string | null | undefined;\n variant?: \"default\" | \"destructive\" | undefined;\n busy?: boolean | undefined;\n /**\n * Blocks confirming without pretending work is in flight. For a dialog whose\n * `content` asks the user something the action cannot proceed without — the\n * choice is missing, not loading — `busy` would show a misleading spinner.\n */\n confirmDisabled?: boolean | undefined;\n /**\n * Explicit portal target. Default (undefined): the container injected by\n * `PortalContainerProvider`, else `document.body`. Hosts with retargeting\n * needs (a popped-out browser window whose dialog must render in THAT\n * window's document) may still pass the element directly.\n */\n portalContainer?: HTMLElement | null | undefined;\n onConfirm: () => void | Promise<void>;\n}\n\n/**\n * Drop-in replacement for `window.confirm`. Use this anywhere you would\n * otherwise reach for a browser-level confirm dialog.\n */\nexport function ConfirmDialog({\n open,\n onOpenChange,\n title,\n description,\n content,\n contentClassName,\n confirmLabel = \"Confirm\",\n cancelLabel = \"Cancel\",\n variant = \"default\",\n busy = false,\n confirmDisabled = false,\n portalContainer,\n onConfirm,\n}: ConfirmDialogProps) {\n return (\n <AlertDialog open={open} onOpenChange={onOpenChange}>\n <AlertDialogContent\n className={contentClassName}\n {...(portalContainer === undefined ? {} : { container: portalContainer })}\n >\n <AlertDialogHeader>\n <AlertDialogTitle>{title}</AlertDialogTitle>\n {description ? (\n <AlertDialogDescription>{description}</AlertDialogDescription>\n ) : null}\n </AlertDialogHeader>\n {content ?? null}\n <AlertDialogFooter>\n {cancelLabel === null ? null : (\n <AlertDialogCancel className=\"max-lg:min-h-11\" disabled={busy}>\n {cancelLabel}\n </AlertDialogCancel>\n )}\n <AlertDialogAction\n disabled={busy || confirmDisabled}\n onClick={(event) => {\n event.preventDefault();\n void onConfirm();\n }}\n className={cn(\n \"max-lg:min-h-11\",\n // One source of button appearance: the destructive look comes\n // from `buttonVariants`, not a second hand-written copy of it.\n // tailwind-merge makes it WIN over the default variant classes.\n variant === \"destructive\" &&\n buttonVariants({ variant: \"destructive\" }),\n )}\n >\n {busy ? (\n <Loader2Icon className={cn(\"mr-2 h-4 w-4\", MOTION_SPIN)} />\n ) : null}\n {confirmLabel}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n );\n}\n","\"use client\";\n\n/**\n * `<ConfirmDialogHost />` — render ONCE, near the root of every provider tree,\n * so the imperative `confirm()` always has a live host to dispatch to.\n *\n * THE SPLIT (census row 19i, 2026-09-07). The confirm system is two halves in\n * two packages, on purpose:\n *\n * `@ai-matrx/kit/confirm-opener` the OPENER — `confirm()`, the host\n * registry, the request queue. Pure TS: zero\n * React, zero markup, zero CSS. Statically\n * importable from a Redux thunk, a util, a\n * sync handler — hundreds of call sites at\n * near-zero bundle cost.\n * `@ai-matrx/design-system` the BODY — this host and `ConfirmDialog`,\n * built on the package AlertDialog so the\n * surface gets the shipped motion layer and\n * the themed scrim instead of the host-plugin\n * classes and the hardcoded black scrim\n * kit could neither style nor animate.\n *\n * Design-system depends on kit, so this direction is the acyclic one; kit\n * re-exports nothing of the body. A consumer mounts `<ConfirmDialogHost />`\n * from here and calls `confirm()` from there — the two find each other through\n * the opener's `Symbol.for(\"ai-matrx.kit.confirm-opener-state\")` globalThis\n * slot, which is deliberately NOT a module-level variable: with unsplit dual\n * ESM/CJS bundles each loader graph instantiates its own module, and a module\n * local would silently split host registration from callers. Never \"clean that\n * up\".\n *\n * Pre-mount `confirm()` calls queue inside the opener and resolve as soon as\n * this host registers — a destructive action triggered in the first ~50ms after\n * load still gets a real confirmation, never a silent default-yes/no.\n *\n * NO FRAMEWORK IMPORT. The matrx-frontend original split shell + impl and\n * loaded the impl through `next/dynamic({ ssr: false })` to keep radix out of\n * route entry chunks. A framework-agnostic package cannot do that, so this is\n * ONE directly-imported component; hosts that want the code-splitting lazy-load\n * it themselves:\n * `dynamic(() => import(\"@ai-matrx/design-system\").then(m => m.ConfirmDialogHost), { ssr: false })`\n * The \"render `<ConfirmDialogHost/>` once\" contract is unchanged either way.\n *\n * Imperative model: calls to `confirm(...)` push a request into a ref-backed\n * queue; this component drains it one at a time and renders a `<ConfirmDialog>`\n * for the active request. The promise resolves `true` on Confirm, `false` on\n * cancel/dismiss. The dialog closes immediately on click — callers that need an\n * in-dialog busy spinner during async work use the inline `<ConfirmDialog>`\n * with the `busy` prop instead.\n */\n\nimport {\n _registerHost,\n _unregisterHost,\n type ConfirmOptions,\n} from \"@ai-matrx/kit/confirm-opener\";\nimport * as React from \"react\";\n\nimport { ConfirmDialog } from \"./confirm-dialog\";\n\ninterface ActiveRequest {\n opts: ConfirmOptions;\n resolve: (confirmed: boolean) => void;\n}\n\nexport function ConfirmDialogHost() {\n const [active, setActive] = React.useState<ActiveRequest | null>(null);\n const [tick, setTick] = React.useState(0);\n const queueRef = React.useRef<ActiveRequest[]>([]);\n\n // Register/unregister the controller exactly once. The controller's `show`\n // always pushes onto the queue and bumps `tick`; the drain effect below picks\n // up from there. This avoids stale-closure bugs around `active`.\n React.useEffect(() => {\n const controller = {\n show: (opts: ConfirmOptions, resolve: (confirmed: boolean) => void) => {\n queueRef.current.push({ opts, resolve });\n setTick((n) => n + 1);\n },\n };\n _registerHost(controller);\n return () => _unregisterHost(controller);\n }, []);\n\n // Drain the queue whenever nothing is showing.\n React.useEffect(() => {\n if (active === null && queueRef.current.length > 0) {\n setActive(queueRef.current.shift()!);\n }\n }, [active, tick]);\n\n const handleConfirm = React.useCallback(() => {\n if (!active) return;\n active.resolve(true);\n setActive(null);\n }, [active]);\n\n const handleOpenChange = React.useCallback(\n (open: boolean) => {\n if (!open && active) {\n active.resolve(false);\n setActive(null);\n }\n },\n [active],\n );\n\n return (\n <ConfirmDialog\n open={!!active}\n onOpenChange={handleOpenChange}\n title={active?.opts.title ?? \"\"}\n description={active?.opts.description}\n confirmLabel={active?.opts.confirmLabel}\n cancelLabel={active?.opts.cancelLabel}\n variant={active?.opts.variant}\n onConfirm={handleConfirm}\n />\n );\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 { MOTION_POPPER } from \"./motion\";\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\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_POPPER, 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_POPPER, 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 matrx-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 { MOTION_POPPER } from \"./motion\";\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 interface PopoverContentProps\n extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> {\n /** Explicit portal target; wins over the injected container. */\n container?: HTMLElement | null;\n /**\n * Package-owned open/close motion. Default `true`. Pass `false` for a\n * surface that must appear instantly — a picker re-anchoring while the user\n * types, a measurement pass. It is NOT the reduced-motion switch;\n * `styles.css` already honours `prefers-reduced-motion`.\n */\n animated?: boolean;\n}\n\nexport const PopoverContent = React.forwardRef<\n React.ComponentRef<typeof PopoverPrimitive.Content>,\n PopoverContentProps\n>(\n (\n {\n className,\n align = \"center\",\n sideOffset = 4,\n container,\n animated = true,\n ...props\n },\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\",\n animated && MOTION_POPPER,\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 {\n CENTERED_DIALOG,\n MOTION_BOTTOM_SHEET,\n MOTION_DIALOG,\n MOTION_OVERLAY,\n} from \"./motion\";\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)]\",\n MOTION_OVERLAY,\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 ${CENTERED_DIALOG} 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 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 rounded-t-2xl rounded-b-none overflow-y-auto overscroll-contain\";\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 * Package-owned open/close motion. Default `true`. Pass `false` for a\n * surface that must appear instantly. It is NOT the reduced-motion switch;\n * `styles.css` already honours `prefers-reduced-motion`.\n */\n animated?: boolean;\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 animated = 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 animated && (asSheet ? MOTION_BOTTOM_SHEET : MOTION_DIALOG),\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 { MOTION_POPPER } from \"./motion\";\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\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\", MOTION_POPPER, 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 MOTION_POPPER,\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 matrx-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 && \"matrx-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 { MOTION_POPPER, POPPER_OFFSET } from \"./motion\";\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 interface SelectContentProps\n extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> {\n /** Explicit portal target; wins over the injected container. */\n container?: HTMLElement | null;\n /**\n * Package-owned open/close motion. Default `true`. Pass `false` for a\n * surface that must appear instantly. It is NOT the reduced-motion switch;\n * `styles.css` already honours `prefers-reduced-motion`.\n */\n animated?: boolean;\n}\n\nexport const SelectContent = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Content>,\n SelectContentProps\n>(\n (\n {\n className,\n children,\n position = \"popper\",\n container,\n animated = true,\n ...props\n },\n ref,\n ) => {\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\",\n animated && MOTION_POPPER,\n // The resting gap from the trigger. It is the `translate` property\n // (POPPER_OFFSET), never Tailwind translate utilities: those compose\n // with `transform` on a v4 host and are REPLACED by it on a v3 one,\n // so on v3 the animation ate the gap and the surface snapped 4px at\n // the end. Same law as the centred dialog card — see motion.ts.\n position === \"popper\" && POPPER_OFFSET,\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 { MOTION_OVERLAY, MOTION_SHEET } from \"./motion\";\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)]\",\n MOTION_OVERLAY,\n className,\n )}\n {...props}\n ref={ref}\n />\n));\nSheetOverlay.displayName = SheetPrimitive.Overlay.displayName;\n\nexport const sheetVariants = cva(\n // Motion is NOT stated here (0.10.0). The `data-[state=*]:animate-in/out`\n // + `slide-in-from-*` pairs this base and its side variants used to carry\n // came from the `tailwindcss-animate` HOST plugin, which three of four\n // consumers never loaded — every sheet in them slammed open with no\n // animation and no error. `SheetContent` now applies the package-owned\n // `MOTION_SHEET[side]` class alongside these variants; the keyframes,\n // durations and reduced-motion handling all live in `styles.css`.\n \"fixed z-50 gap-4 bg-background p-6 shadow-lg\",\n {\n variants: {\n side: {\n top: \"inset-x-0 top-0 border-b\",\n bottom: \"inset-x-0 bottom-0 border-t\",\n left: \"inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm\",\n right: \"inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm\",\n center: \"inset-0 m-auto max-h-full max-w-full border rounded-lg\",\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 * Package-owned open/close motion. Default `true`. Pass `false` for a panel\n * that must appear instantly — a persistent side rail toggled by a keyboard\n * shortcut, say. It is NOT the reduced-motion switch; `styles.css` already\n * honours `prefers-reduced-motion`.\n */\n animated?: boolean;\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 animated = true,\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(\n sheetVariants({ side }),\n animated && MOTION_SHEET[side ?? \"right\"],\n className,\n )}\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 — the \"content is coming\" placeholder.\n *\n * Ported from matrx-frontend `components/ui/skeleton.tsx`; no seams, pure\n * markup over semantic tokens. ONE change from the original (0.10.0): the\n * breathing loop is `.matrx-pulse`, a package-owned keyframe, not Tailwind's\n * `animate-pulse`. A Skeleton that does not pulse is indistinguishable from an\n * empty grey box — it stops saying \"loading\" and starts saying \"nothing here\"\n * — so the motion is part of the component's meaning and ships with it (see\n * `styles.css` § THE MOTION LAYER).\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { MOTION_PULSE } from \"./motion\";\n\nexport interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Package-owned pulse. Default `true`. Pass `false` for a static\n * placeholder — a print/PDF render, or a screenshot fixture where the\n * animation makes the output non-deterministic. `prefers-reduced-motion`\n * already SLOWS the pulse rather than stopping it (a still skeleton would\n * lose the information), so this is not the accessibility switch.\n */\n animated?: boolean;\n}\n\nexport function Skeleton({ className, animated = true, ...props }: SkeletonProps) {\n return (\n <div\n data-slot=\"skeleton\"\n className={cn(\n \"rounded-md bg-primary/10\",\n animated && MOTION_PULSE,\n className,\n )}\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","\"use client\";\n\n/**\n * HoverCard — the rich hover surface (16 host import sites).\n *\n * Ported from matrx-frontend `components/ui/hover-card.tsx`, including its\n * recorded ruling:\n *\n * THE ROOT RENDERS UNCONDITIONALLY — no hydration mount gate. The gate the\n * host wrapper once carried (\"Radix generates dynamic aria-controls ids that\n * differ between SSR and client\") was doubly false here:\n * `@radix-ui/react-hover-card` generates no ids of its own at all, and Radix\n * ids generally come from React's SSR-stable `useId`. The gate was actively\n * harmful — a Trigger wraps ALWAYS-VISIBLE content, so `return null` deleted\n * that subtree from SSR and the first client paint.\n *\n * SEAM INVERSION (new here). The host copy portalled nowhere — it rendered\n * `Content` inline, so a hover card inside an overflow-hidden ancestor was\n * clipped, and one inside a popped-out window-panel could not exist. It now\n * portals through the package's `PortalContainerProvider` seam like every\n * other floating surface in this package, with an explicit `container` prop\n * winning and `document.body` as the fallback. Behaviour for a card that was\n * never clipped is unchanged.\n *\n * A HOVER CARD IS NOT A TOOLTIP AND NOT A MENU: it is hover-only and not\n * focusable, so nothing inside it may be the ONLY way to reach an action —\n * touch and keyboard users never open it. Put the action somewhere else too.\n */\n\nimport * as HoverCardPrimitive from \"@radix-ui/react-hover-card\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { MOTION_POPPER } from \"./motion\";\nimport { usePortalContainer } from \"./portal-container\";\n\nconst HoverCard = HoverCardPrimitive.Root;\n\nconst HoverCardTrigger = HoverCardPrimitive.Trigger;\n\nexport interface HoverCardContentProps\n extends React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content> {\n /** Explicit portal target; wins over the injected container. */\n container?: HTMLElement | null;\n /**\n * Package-owned open/close motion. Default `true`. Pass `false` for a\n * surface that must appear instantly — a picker re-anchoring while the user\n * types, a measurement pass. It is NOT the reduced-motion switch;\n * `styles.css` already honours `prefers-reduced-motion`.\n */\n animated?: boolean;\n}\n\nconst HoverCardContent = React.forwardRef<\n React.ComponentRef<typeof HoverCardPrimitive.Content>,\n HoverCardContentProps\n>(\n (\n { className, align = \"center\", sideOffset = 4, container, animated = true, ...props },\n ref,\n ) => {\n const resolved = usePortalContainer(container);\n return (\n <HoverCardPrimitive.Portal container={resolved ?? null}>\n <HoverCardPrimitive.Content\n ref={ref}\n data-slot=\"hover-card-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-[10001] w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none\",\n animated && MOTION_POPPER,\n className,\n )}\n {...props}\n />\n </HoverCardPrimitive.Portal>\n );\n});\nHoverCardContent.displayName = HoverCardPrimitive.Content.displayName;\n\nexport { HoverCard, HoverCardContent, HoverCardTrigger };\n","\"use client\";\n\n/**\n * RadioGroup — single-choice selection (30 host import sites).\n *\n * Ported from matrx-frontend `components/ui/radio-group.tsx`, with the same\n * two corrections the rest of this wave carries:\n *\n * 1. DENSITY IS A PROP (C18) — `size=\"sm|md|lg\"` on the ROOT, read from\n * context by every item, so a group cannot mix control sizes. Matches the\n * `Checkbox` / `Switch` / `Card` shape already shipped in 0.5.0.\n *\n * 2. THE TARGET IS 44px ON COARSE POINTERS. A 16px radio is a mouse control;\n * an invisible pseudo-target expands the hit area without changing layout,\n * so a settings list works with a thumb. (A label wired via `htmlFor` also\n * extends the target — that stays the host's composition choice; this makes\n * the control itself usable on its own.)\n *\n * The indicator is a filled dot rather than Radix's default icon slot, which\n * is what every host variant drew.\n */\n\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport type RadioGroupSize = \"sm\" | \"md\" | \"lg\";\n\nconst RadioGroupSizeContext = React.createContext<RadioGroupSize>(\"md\");\n\nconst CONTROL_CLASSES: Record<RadioGroupSize, string> = {\n sm: \"h-3.5 w-3.5\",\n md: \"h-4 w-4\",\n lg: \"h-5 w-5\",\n};\n\nconst DOT_CLASSES: Record<RadioGroupSize, string> = {\n sm: \"h-1 w-1\",\n md: \"h-1.5 w-1.5\",\n lg: \"h-2 w-2\",\n};\n\nexport interface RadioGroupProps\n extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root> {\n /** Control scale for every item in the group. Default `md`. */\n size?: RadioGroupSize;\n}\n\nconst RadioGroup = React.forwardRef<\n React.ComponentRef<typeof RadioGroupPrimitive.Root>,\n RadioGroupProps\n>(({ className, size = \"md\", ...props }, ref) => (\n <RadioGroupSizeContext.Provider value={size}>\n <RadioGroupPrimitive.Root\n ref={ref}\n data-slot=\"radio-group\"\n className={cn(\"grid gap-2\", className)}\n {...props}\n />\n </RadioGroupSizeContext.Provider>\n));\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName;\n\nexport interface RadioGroupItemProps\n extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item> {\n /** Override the group's scale for one item. */\n size?: RadioGroupSize;\n}\n\nconst RadioGroupItem = React.forwardRef<\n React.ComponentRef<typeof RadioGroupPrimitive.Item>,\n RadioGroupItemProps\n>(({ className, size, ...props }, ref) => {\n const groupSize = React.useContext(RadioGroupSizeContext);\n const resolved = size ?? groupSize;\n return (\n <RadioGroupPrimitive.Item\n ref={ref}\n data-slot=\"radio-group-item\"\n className={cn(\n \"relative aspect-square shrink-0 rounded-full border border-primary shadow\",\n \"focus:outline-none focus-visible:ring-1 focus-visible:ring-ring\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n \"data-[state=checked]:border-primary data-[state=checked]:bg-primary\",\n // Ruling 2 — invisible 44px target on touch, layout untouched.\n \"after:absolute after:left-1/2 after:top-1/2 after:-translate-x-1/2 after:-translate-y-1/2 after:content-['']\",\n \"pointer-coarse:after:h-11 pointer-coarse:after:w-11\",\n CONTROL_CLASSES[resolved],\n className,\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator className=\"flex items-center justify-center\">\n <div\n className={cn(\"rounded-full bg-primary-foreground\", DOT_CLASSES[resolved])}\n />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n );\n});\nRadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;\n\nexport { RadioGroup, RadioGroupItem };\n","\"use client\";\n\n/**\n * Resizable — the split-pane family, on react-resizable-panels **v4**.\n *\n * TWO FORKS COLLAPSE INTO ONE COMPONENT. matrx-frontend shipped\n * `components/ui/resizable.tsx` (38 import sites, one fixed handle width) AND\n * `components/ui/matrx/resizable.tsx` (6 sites, an eight-step `size` scale).\n * They disagreed about exactly one thing — how thick the handle is — which is\n * the C18 density-as-a-fork pattern this package exists to end. `size` is a\n * prop here; both forks die.\n *\n * v4 IS NOT v1/v2, and the differences are the reason a wrapper exists at all:\n * - the group prop is `orientation`, not `direction`;\n * - `data-panel-group-direction` is gone — the separator states\n * `aria-orientation`, and it is `vertical` in a HORIZONTAL group (it is the\n * separator's own axis, not the group's), which is why every orientation\n * selector below reads the way it does;\n * - `Group` sets `height:100%/width:100%/overflow:hidden` internally;\n * - `Panel` renders an outer flex-sizing div wrapping an inner\n * `overflow:auto` div that receives `className`/`style` — to make a panel\n * clip instead of scroll, pass `style={{ overflow: \"hidden\", height: \"100%\" }}`;\n * - numeric size props are PIXELS; percentages are strings (`\"30%\"`).\n *\n * THE DRAG OUTLINE BUG, kept fixed. The library sets `tabIndex=0` on the\n * separator, so a mouse drag FOCUSES it and the browser's default outline\n * flashes — which rendered as a near-white bar in dark mode. `focus-visible:`\n * does not suppress it (that is keyboard-only); `focus:outline-none` does, and\n * the keyboard ring is restored explicitly on `focus-visible`.\n *\n * MOUSE TOLERANCE IS AN INVISIBLE TARGET. A 2px line is not grabbable; an\n * `::after` overlay widens the hit area without widening the rule, and goes to\n * 44px on coarse pointers.\n *\n * `react-resizable-panels` is an ordinary dependency, not a peer (C23): the\n * panel geometry IS this component's product.\n */\n\nimport * as React from \"react\";\nimport { Group, Panel, Separator } from \"react-resizable-panels\";\n\nimport { cn } from \"./cn\";\nimport { DragHandleDots2Icon } from \"./icons\";\n\nexport type ResizableHandleSize =\n | \"xs\"\n | \"sm\"\n | \"md\"\n | \"lg\"\n | \"xl\"\n | \"2xl\"\n | \"3xl\"\n | \"4xl\";\n\n/**\n * The separator's own thickness. `aria-orientation=horizontal` means a\n * separator lying across a VERTICAL group, so its thickness is a height.\n */\nconst HANDLE_SIZES: Record<ResizableHandleSize, string> = {\n xs: \"w-0.5 [&[aria-orientation=horizontal]]:h-0.5 [&[aria-orientation=horizontal]]:w-full\",\n sm: \"w-1 [&[aria-orientation=horizontal]]:h-1 [&[aria-orientation=horizontal]]:w-full\",\n md: \"w-1.5 [&[aria-orientation=horizontal]]:h-1.5 [&[aria-orientation=horizontal]]:w-full\",\n lg: \"w-2 [&[aria-orientation=horizontal]]:h-2 [&[aria-orientation=horizontal]]:w-full\",\n xl: \"w-3 [&[aria-orientation=horizontal]]:h-3 [&[aria-orientation=horizontal]]:w-full\",\n \"2xl\":\n \"w-4 [&[aria-orientation=horizontal]]:h-4 [&[aria-orientation=horizontal]]:w-full\",\n \"3xl\":\n \"w-6 [&[aria-orientation=horizontal]]:h-6 [&[aria-orientation=horizontal]]:w-full\",\n \"4xl\":\n \"w-8 [&[aria-orientation=horizontal]]:h-8 [&[aria-orientation=horizontal]]:w-full\",\n};\n\nconst ResizablePanelGroup = ({\n className,\n ...props\n}: React.ComponentProps<typeof Group>) => (\n <Group\n data-slot=\"resizable-group\"\n className={cn(\"flex h-full w-full\", className)}\n {...props}\n />\n);\nResizablePanelGroup.displayName = \"ResizablePanelGroup\";\n\nconst ResizablePanel = Panel;\n\nexport interface ResizableHandleProps\n extends React.ComponentProps<typeof Separator> {\n /** Render the centered grip. */\n withHandle?: boolean;\n /** Separator thickness. Default `xs` — matrx-frontend's original 2px line. */\n size?: ResizableHandleSize;\n}\n\nconst ResizableHandle = ({\n withHandle,\n size = \"xs\",\n className,\n ...props\n}: ResizableHandleProps) => (\n <Separator\n data-slot=\"resizable-handle\"\n className={cn(\n \"group/handle relative flex shrink-0 items-center justify-center bg-border transition-colors\",\n // Invisible hit target centered on the line; wider still on touch.\n \"after:absolute after:inset-y-0 after:left-1/2 after:w-1.5 after:-translate-x-1/2 after:content-['']\",\n \"pointer-coarse:after:w-11\",\n \"[&[aria-orientation=horizontal]]:after:inset-x-0 [&[aria-orientation=horizontal]]:after:left-0 [&[aria-orientation=horizontal]]:after:top-1/2 [&[aria-orientation=horizontal]]:after:h-1.5 [&[aria-orientation=horizontal]]:after:w-full [&[aria-orientation=horizontal]]:after:-translate-x-0 [&[aria-orientation=horizontal]]:after:-translate-y-1/2\",\n \"pointer-coarse:[&[aria-orientation=horizontal]]:after:h-11\",\n // The drag-outline bug: suppress for ALL focus, restore for keyboard.\n \"focus:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1\",\n // Library-driven state feedback.\n \"data-[separator=hover]:bg-primary data-[separator=active]:bg-primary\",\n HANDLE_SIZES[size],\n \"cursor-col-resize [&[aria-orientation=horizontal]]:cursor-row-resize\",\n className,\n )}\n {...props}\n >\n {withHandle ? (\n <div className=\"z-10 flex h-8 w-4 items-center justify-center rounded-sm border bg-border group-aria-[orientation=horizontal]/handle:h-4 group-aria-[orientation=horizontal]/handle:w-8\">\n <DragHandleDots2Icon className=\"h-2.5 w-2.5 group-aria-[orientation=horizontal]/handle:rotate-90\" />\n </div>\n ) : null}\n </Separator>\n);\nResizableHandle.displayName = \"ResizableHandle\";\n\nexport { ResizableHandle, ResizablePanel, ResizablePanelGroup };\n","\"use client\";\n\n/**\n * Slider — the range control (46 host import sites).\n *\n * Ported from matrx-frontend `components/ui/slider.tsx`. Two things the host\n * copy could not do, both fixed here rather than in a fork:\n *\n * 1. A 16px THUMB IS NOT A TOUCH TARGET. The stock thumb is `h-4 w-4`, well\n * under the 44px Apple HIG minimum, so a slider that worked with a mouse\n * was a coin-flip with a thumb. The visible thumb keeps its size (`size`\n * controls it), and an invisible `::after` pseudo-target expands the hit\n * area to 44px on coarse pointers without changing the layout — the same\n * trick `ResizableHandle` uses for mouse tolerance.\n *\n * 2. DENSITY IS A PROP, NOT A FORK (C18). `size=\"sm|md|lg\"` picks the track\n * height and thumb diameter together, so a dense admin panel and a\n * touch-first settings screen use ONE component.\n *\n * Multi-thumb ranges work: a `Thumb` is rendered per value, which is what\n * Radix requires and what the host copy (a single hardcoded Thumb) got wrong\n * for any `value` array longer than one.\n */\n\nimport * as SliderPrimitive from \"@radix-ui/react-slider\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport type SliderSize = \"sm\" | \"md\" | \"lg\";\n\nconst TRACK_CLASSES: Record<SliderSize, string> = {\n sm: \"h-1\",\n md: \"h-1.5\",\n lg: \"h-2.5\",\n};\n\nconst THUMB_CLASSES: Record<SliderSize, string> = {\n sm: \"h-3.5 w-3.5\",\n md: \"h-4 w-4\",\n lg: \"h-5 w-5\",\n};\n\nexport interface SliderProps\n extends React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root> {\n /** Track + thumb scale. Default `md`. */\n size?: SliderSize;\n}\n\nconst Slider = React.forwardRef<\n React.ComponentRef<typeof SliderPrimitive.Root>,\n SliderProps\n>(({ className, size = \"md\", ...props }, ref) => {\n // One Thumb per value — controlled `value` wins, then `defaultValue`, then\n // the single-thumb default. Radix renders nothing sensible if the count is\n // wrong, which is how the host copy silently dropped a range's upper thumb.\n const thumbCount = Math.max(\n 1,\n (props.value ?? props.defaultValue ?? [0]).length,\n );\n\n return (\n <SliderPrimitive.Root\n ref={ref}\n data-slot=\"slider\"\n className={cn(\n \"relative flex w-full touch-none select-none items-center data-[disabled]:opacity-50\",\n \"data-[orientation=vertical]:h-full data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col\",\n className,\n )}\n {...props}\n >\n <SliderPrimitive.Track\n data-slot=\"slider-track\"\n className={cn(\n \"relative w-full grow overflow-hidden rounded-full bg-primary/20\",\n TRACK_CLASSES[size],\n \"data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5\",\n )}\n >\n <SliderPrimitive.Range\n data-slot=\"slider-range\"\n className=\"absolute h-full bg-primary data-[orientation=vertical]:w-full\"\n />\n </SliderPrimitive.Track>\n {Array.from({ length: thumbCount }, (_, index) => (\n <SliderPrimitive.Thumb\n key={index}\n data-slot=\"slider-thumb\"\n className={cn(\n \"relative block cursor-grab rounded-full border border-primary/50 bg-background shadow transition-colors active:cursor-grabbing\",\n \"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n // Ruling 1 — invisible 44px target, coarse pointers only, so a\n // dense desktop row keeps its exact hit behaviour.\n \"after:absolute after:left-1/2 after:top-1/2 after:-translate-x-1/2 after:-translate-y-1/2 after:content-['']\",\n \"pointer-coarse:after:h-11 pointer-coarse:after:w-11\",\n THUMB_CLASSES[size],\n )}\n />\n ))}\n </SliderPrimitive.Root>\n );\n});\nSlider.displayName = SliderPrimitive.Root.displayName;\n\nexport { Slider };\n","\"use client\";\n\n/**\n * Toggle / ToggleGroup — the pressed-state control and its exclusive or\n * multiple group (10 host import sites between them).\n *\n * Ported from matrx-frontend `components/ui/toggle.tsx` +\n * `components/ui/toggle-group.tsx`. They ship as ONE module because\n * `ToggleGroupItem` reads `toggleVariants` and the group's variant CONTEXT:\n * the two host files were a circular pair held together by an import, and a\n * host copy of a React context is the quiet twin this package has already been\n * bitten by (`useContext` matches by object identity, so two look-alike\n * contexts silently never see each other). One module, one context.\n *\n * `Toggle` is NOT `Switch`. A Switch states a setting (\"notifications: on\")\n * and applies immediately; a Toggle is a pressed button in a toolbar (\"bold\").\n * Reach for `SegmentedControl` when the choice is between labelled options\n * rather than on/off.\n *\n * Density is `size=\"sm|default|lg\"`, declared on the group and inherited by\n * every item, so a toolbar cannot mix button heights.\n */\n\nimport * as ToggleGroupPrimitive from \"@radix-ui/react-toggle-group\";\nimport * as TogglePrimitive from \"@radix-ui/react-toggle\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nconst toggleVariants = cva(\n \"inline-flex cursor-pointer items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n {\n variants: {\n variant: {\n default: \"bg-transparent\",\n outline:\n \"border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground\",\n },\n size: {\n default: \"h-9 min-w-9 px-3\",\n sm: \"h-8 min-w-8 px-2\",\n lg: \"h-10 min-w-10 px-3\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nexport interface ToggleProps\n extends React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root>,\n VariantProps<typeof toggleVariants> {}\n\nconst Toggle = React.forwardRef<\n React.ComponentRef<typeof TogglePrimitive.Root>,\n ToggleProps\n>(({ className, variant, size, ...props }, ref) => (\n <TogglePrimitive.Root\n ref={ref}\n data-slot=\"toggle\"\n className={cn(toggleVariants({ variant, size }), className)}\n {...props}\n />\n));\nToggle.displayName = TogglePrimitive.Root.displayName;\n\nconst ToggleGroupContext = React.createContext<\n VariantProps<typeof toggleVariants>\n>({ size: \"default\", variant: \"default\" });\n\nexport type ToggleGroupProps = React.ComponentPropsWithoutRef<\n typeof ToggleGroupPrimitive.Root\n> &\n VariantProps<typeof toggleVariants>;\n\nconst ToggleGroup = React.forwardRef<\n React.ComponentRef<typeof ToggleGroupPrimitive.Root>,\n ToggleGroupProps\n>(({ className, variant, size, children, ...props }, ref) => (\n <ToggleGroupPrimitive.Root\n ref={ref}\n data-slot=\"toggle-group\"\n className={cn(\"flex items-center justify-center gap-1\", className)}\n {...props}\n >\n <ToggleGroupContext.Provider value={{ variant, size }}>\n {children}\n </ToggleGroupContext.Provider>\n </ToggleGroupPrimitive.Root>\n));\nToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;\n\nexport interface ToggleGroupItemProps\n extends React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item>,\n VariantProps<typeof toggleVariants> {}\n\nconst ToggleGroupItem = React.forwardRef<\n React.ComponentRef<typeof ToggleGroupPrimitive.Item>,\n ToggleGroupItemProps\n>(({ className, children, variant, size, ...props }, ref) => {\n const context = React.useContext(ToggleGroupContext);\n return (\n <ToggleGroupPrimitive.Item\n ref={ref}\n data-slot=\"toggle-group-item\"\n className={cn(\n toggleVariants({\n variant: context.variant ?? variant,\n size: context.size ?? size,\n }),\n className,\n )}\n {...props}\n >\n {children}\n </ToggleGroupPrimitive.Item>\n );\n});\nToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;\n\nexport { Toggle, ToggleGroup, ToggleGroupItem, toggleVariants };\n","\"use client\";\n\n/**\n * Tooltip — the ONE tooltip in the fleet.\n *\n * THE COLLAPSE (0.6.0). Two implementations existed: matrx-frontend's\n * `components/ui/tooltip.tsx` (182 import sites) and `@ai-matrx/tap-target`'s\n * `src/tooltip.tsx` — the latter an explicit inlined PORT of the former,\n * carrying a header that said so. tap-target shipped it only because its ~60\n * tap buttons need a tooltip and no shared package owned one; four repos then\n * adopted `TooltipProvider` from tap-target. That made tap-target — a\n * button-geometry package — the accidental owner of a design-system primitive,\n * with a second copy living in the biggest host.\n *\n * A tooltip is a design-system surface, so it lives here. tap-target now takes\n * `@ai-matrx/design-system` as an ordinary sibling dependency and imports this\n * file; its own copy is deleted, and its re-export removed. The DAG already\n * ordered design-system before tap-target, so no cycle is introduced.\n *\n * BEHAVIOUR is matrx-frontend's, verbatim, including the ruling both copies\n * carried in prose:\n *\n * 1. THE ROOT RENDERS UNCONDITIONALLY — no hydration mount gate. The gate the\n * host wrapper once carried (\"Radix generates dynamic aria-controls ids that\n * differ between SSR and client\") was false: Radix ids come from React's\n * SSR-stable `useId`. It was actively harmful — a Trigger wraps\n * ALWAYS-VISIBLE content, so `return null` deleted that subtree from SSR and\n * the first client paint.\n *\n * 2. THE SURFACE IS NEUTRAL, NOT BRANDED. Popover tokens, not `bg-primary`:\n * rich tooltip content using `text-muted-foreground` was illegible on a\n * brand-coloured background in one theme or the other.\n *\n * SEAM INVERSION. The host resolved nested portal targets through\n * `useNestedPortalContainer` (an app hook wired to its dialog + window-panel\n * systems); tap-target's port dropped that seam entirely and always portalled\n * to `document.body` — which is why a tooltip inside a popped-out panel landed\n * in the wrong window. Here it is the package's `PortalContainerProvider`\n * seam: an explicit `container` prop wins, then the injected container, then\n * `document.body`. Both prior behaviours are reachable; neither is forked.\n */\n\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { MOTION_POPPER } from \"./motion\";\nimport { usePortalContainer } from \"./portal-container\";\n\n/**\n * Mount once near the app root. Every tooltip in the tree shares its\n * `delayDuration` / `skipDelayDuration` timing.\n */\nconst TooltipProvider = TooltipPrimitive.Provider;\n\nconst Tooltip = TooltipPrimitive.Root;\n\nconst TooltipTrigger = TooltipPrimitive.Trigger;\n\nexport interface TooltipContentProps\n extends React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> {\n /**\n * Explicit portal target; wins over the injected `PortalContainerProvider`\n * value. Pass `null` to force `document.body`.\n */\n container?: HTMLElement | null;\n /**\n * Package-owned open/close motion. Default `true`. Pass `false` for a\n * surface that must appear instantly. It is NOT the reduced-motion switch;\n * `styles.css` already honours `prefers-reduced-motion`.\n */\n animated?: boolean;\n}\n\nconst TooltipContent = React.forwardRef<\n React.ComponentRef<typeof TooltipPrimitive.Content>,\n TooltipContentProps\n>(({ className, sideOffset = 4, container, animated = true, ...props }, ref) => {\n const resolved = usePortalContainer(container);\n return (\n <TooltipPrimitive.Portal container={resolved ?? null}>\n <TooltipPrimitive.Content\n ref={ref}\n data-slot=\"tooltip-content\"\n sideOffset={sideOffset}\n className={cn(\n \"z-[10001] overflow-hidden rounded-md border border-border bg-popover px-3 py-1.5 text-xs text-popover-foreground shadow-md\",\n animated && MOTION_POPPER,\n className,\n )}\n {...props}\n />\n </TooltipPrimitive.Portal>\n );\n});\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAAA;AAAA,EAAA,0BAAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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;AAAA,EACN,GACF;AAEJ,CAAC;AACD,eAAe,cAA+B,yBAAQ;","names":["CollapsibleContent","CollapsibleTrigger","Label","RadioGroup","Separator","import_jsx_runtime","import_jsx_runtime","import_vaul","React","React","import_jsx_runtime","import_jsx_runtime","DrawerPrimitive","import_jsx_runtime","DrawerPrimitive","import_class_variance_authority","React","import_jsx_runtime","import_react_tree","React","import_class_variance_authority","React","import_jsx_runtime","React","import_jsx_runtime","import_jsx_runtime","React","import_jsx_runtime","React","import_jsx_runtime","React","import_jsx_runtime","React","import_jsx_runtime","CollapsibleTrigger","CollapsibleContent","React","React","import_jsx_runtime","CommandPrimitive","import_jsx_runtime","React","import_jsx_runtime","React","import_jsx_runtime","React","import_jsx_runtime","import_jsx_runtime","Icon","DialogPrimitive","VisuallyHidden","import_react_tree","React","import_jsx_runtime","DIALOG_DESKTOP_CLASSES","DIALOG_MOBILE_SHEET_CLASSES","DIALOG_MOBILE_SHEET_OVERRIDE","React","import_jsx_runtime","import_react","import_jsx_runtime","result","React","import_jsx_runtime","React","import_jsx_runtime","Label","import_react","import_jsx_runtime","Icon","React","import_jsx_runtime","React","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_class_variance_authority","React","import_jsx_runtime","React","import_jsx_runtime","Separator","import_react_tree","import_class_variance_authority","React","import_jsx_runtime","import_jsx_runtime","React","import_jsx_runtime","import_react","import_jsx_runtime","Icon","React","import_jsx_runtime","React","import_jsx_runtime","React","import_jsx_runtime","import_react","React","import_jsx_runtime","React","import_jsx_runtime","RadioGroup","import_jsx_runtime","React","import_jsx_runtime","import_class_variance_authority","React","import_jsx_runtime","React","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/accordion.tsx","../src/cn.ts","../src/icons.tsx","../src/badge.tsx","../src/bottom-sheet.tsx","../src/drawer.tsx","../src/radix-dialog-modal-context.tsx","../src/alert.tsx","../src/alert-dialog.tsx","../src/button.tsx","../src/motion.ts","../src/portal-container.tsx","../src/avatar.tsx","../src/card.tsx","../src/checkbox.tsx","../src/collapsible.tsx","../src/command.tsx","../src/use-is-mobile.ts","../src/confirm-dialog.tsx","../src/confirm-host.tsx","../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","../src/hover-card.tsx","../src/radio-group.tsx","../src/resizable.tsx","../src/slider.tsx","../src/toggle.tsx","../src/tooltip.tsx"],"sourcesContent":["export {\n Accordion,\n AccordionContent,\n AccordionItem,\n AccordionTrigger,\n useAccordionSize,\n type AccordionProps,\n type AccordionSize,\n type AccordionTriggerProps,\n} from \"./accordion\";\nexport { Badge, badgeVariants, type BadgeProps } from \"./badge\";\nexport {\n BottomSheet,\n BottomSheetBody,\n BottomSheetFooter,\n BottomSheetHeader,\n type BottomSheetBodyProps,\n type BottomSheetFooterProps,\n type BottomSheetHeaderProps,\n type BottomSheetProps,\n} from \"./bottom-sheet\";\nexport {\n Alert,\n AlertDescription,\n AlertTitle,\n alertVariants,\n type AlertProps,\n} from \"./alert\";\nexport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogContentPrimitive,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogOverlay,\n AlertDialogPortal,\n AlertDialogTitle,\n AlertDialogTrigger,\n type AlertDialogContentProps,\n} from \"./alert-dialog\";\nexport { Button, buttonVariants, type ButtonProps } from \"./button\";\nexport {\n Avatar,\n AvatarFallback,\n AvatarImage,\n type AvatarProps,\n type AvatarSize,\n} from \"./avatar\";\nexport {\n Card,\n CardAction,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n useCardSize,\n type CardProps,\n type CardSize,\n} from \"./card\";\nexport { Checkbox, type CheckboxProps, type CheckboxSize } from \"./checkbox\";\nexport { cn } from \"./cn\";\nexport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n type CollapsibleContentProps,\n} from \"./collapsible\";\nexport {\n Command,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n CommandShortcut,\n type CommandDialogProps,\n} from \"./command\";\n/**\n * THE CONFIRM SURFACE (0.11.0, census row 19i). The body lives here; the\n * imperative `confirm()` stays in `@ai-matrx/kit/confirm-opener` — mount\n * `<ConfirmDialogHost />` from this package once at your provider root, then\n * `await confirm({...})` from anywhere in kit. Deliberately NOT re-exported\n * from here (the row-20a precedent: one owner per surface, no twin door).\n */\nexport {\n ConfirmDialog,\n type ConfirmDialogProps,\n} from \"./confirm-dialog\";\nexport { ConfirmDialogHost } from \"./confirm-host\";\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 type ContextMenuContentProps,\n} from \"./context-menu\";\nexport {\n CreatablePicker,\n type CreatableOption,\n type CreatablePickerProps,\n type PickerIcon,\n} from \"./creatable-picker\";\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogContentPrimitive,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n useDialogContainer,\n type DialogContentProps,\n} from \"./dialog\";\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 type DropdownMenuContentProps,\n} from \"./dropdown-menu\";\nexport {\n EditableLabel,\n type EditableLabelActivation,\n type EditableLabelCommitMode,\n type EditableLabelProps,\n} from \"./editable-label\";\nexport {\n BasicInput,\n EnterInput,\n Input,\n InputWithPrefix,\n type EnterInputProps,\n type InputProps,\n type InputVariant,\n type InputWithPrefixProps,\n} from \"./input\";\nexport { Label } from \"./label\";\nexport {\n OverflowToolbar,\n type OverflowToolbarProps,\n type ToolbarAction,\n type ToolbarActionTone,\n type ToolbarIcon,\n} from \"./overflow-toolbar\";\nexport {\n Popover,\n PopoverAnchor,\n PopoverContent,\n type PopoverContentProps,\n PopoverTrigger,\n} from \"./popover\";\nexport {\n Progress,\n type ProgressProps,\n type ProgressTone,\n} from \"./progress\";\nexport {\n PortalContainerProvider,\n usePortalContainer,\n type PortalContainerProviderProps,\n} from \"./portal-container\";\nexport {\n RadixDialogModalProvider,\n useRadixDialogModal,\n type RadixDialogModalProviderProps,\n} from \"./radix-dialog-modal-context\";\nexport {\n ScrollArea,\n ScrollBar,\n type ScrollAreaProps,\n} from \"./scroll-area\";\nexport {\n DEFAULT_SCORE_THRESHOLDS,\n ScoreRing,\n scoreAccentBgClasses,\n scoreRingColorClasses,\n type ScoreRingProps,\n type ScoreThresholds,\n} from \"./score-ring\";\nexport {\n SegmentedControl,\n type SegmentOption,\n type SegmentedControlProps,\n} from \"./segmented-control\";\nexport {\n Select,\n SelectContent,\n type SelectContentProps,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n selectTriggerVariants,\n type SelectTriggerProps,\n} from \"./select\";\nexport { Separator } from \"./separator\";\nexport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetFooter,\n SheetHeader,\n SheetOverlay,\n SheetPortal,\n SheetTitle,\n SheetTrigger,\n sheetVariants,\n type SheetContentProps,\n} from \"./sheet\";\nexport { Skeleton, type SkeletonProps } from \"./skeleton\";\nexport { Switch, type SwitchProps, type SwitchSize } from \"./switch\";\nexport {\n TabbedBottomSheet,\n type TabbedBottomSheetProps,\n type TabbedBottomSheetTab,\n} from \"./tabbed-bottom-sheet\";\nexport {\n Table,\n TableBody,\n TableCaption,\n TableCell,\n TableFooter,\n TableHead,\n TableHeader,\n TableRow,\n useTableSize,\n type TableHeaderProps,\n type TableProps,\n type TableSize,\n} from \"./table\";\nexport {\n Tabs,\n TabsContent,\n TabsList,\n TabsTrigger,\n TabsTriggerCore,\n} from \"./tabs\";\nexport {\n BasicTextarea,\n Textarea,\n TextareaWithPrefix,\n type TextareaProps,\n type TextareaWithPrefixProps,\n} from \"./textarea\";\nexport { MOBILE_BREAKPOINT, useIsMobile } from \"./use-is-mobile\";\nexport {\n useScrollFade,\n type ScrollFadeState,\n type UseScrollFadeResult,\n} from \"./use-scroll-fade\";\n\nexport {\n Drawer,\n DrawerBody,\n DrawerClose,\n DrawerContent,\n DrawerContentPrimitive,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerOverlay,\n DrawerPortal,\n DrawerTitle,\n DrawerTrigger,\n useDrawerDirection,\n type DrawerContentProps,\n type DrawerDirection,\n type DrawerProps,\n type DrawerSize,\n} from \"./drawer\";\nexport {\n HoverCard,\n HoverCardContent,\n HoverCardTrigger,\n type HoverCardContentProps,\n} from \"./hover-card\";\nexport {\n RadioGroup,\n RadioGroupItem,\n type RadioGroupItemProps,\n type RadioGroupProps,\n type RadioGroupSize,\n} from \"./radio-group\";\nexport {\n ResizableHandle,\n ResizablePanel,\n ResizablePanelGroup,\n type ResizableHandleProps,\n type ResizableHandleSize,\n} from \"./resizable\";\nexport { Slider, type SliderProps, type SliderSize } from \"./slider\";\nexport {\n Toggle,\n ToggleGroup,\n ToggleGroupItem,\n toggleVariants,\n type ToggleGroupItemProps,\n type ToggleGroupProps,\n type ToggleProps,\n} from \"./toggle\";\nexport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n type TooltipContentProps,\n} from \"./tooltip\";\n\n/**\n * THE MOTION CONTRACT (0.10.0, + the 0.10.1 geometry split). Exported so a\n * host can assert against the\n * same class names the package applies — and so a consumer auditing its own\n * CSS can prove it is not relying on `tailwindcss-animate` / `tw-animate-css`\n * for anything this package renders. Do not hand-write these strings.\n */\nexport {\n ALL_MOTION_CLASSES,\n CENTERED_DIALOG,\n FORBIDDEN_HOST_MOTION_UTILITIES,\n MOTION_BOTTOM_SHEET,\n MOTION_DIALOG,\n MOTION_OVERLAY,\n MOTION_POPPER,\n MOTION_PULSE,\n MOTION_SHEET,\n MOTION_SPIN,\n POPPER_OFFSET,\n} from \"./motion\";\n","\"use client\";\n\n/**\n * Accordion — the last primitive the fleet was still standing in for.\n *\n * The census that motivated this file (2026-09-07, census row 19c): the growth\n * waves collapsed Card, Table, Alert, Avatar, Progress, Collapsible, Checkbox,\n * Slider and RadioGroup into this package, but Accordion existed nowhere in\n * it — so `aidream/apps/workflow-studio`'s DB-authored component scope was\n * still handing agent-authored components four dependency-free `<div>`s named\n * Accordion / AccordionItem / AccordionTrigger / AccordionContent. A DB-\n * authored component that asked for an accordion got four stacked divs: every\n * section permanently open, no trigger, no keyboard, no ARIA. That is the\n * \"dead-looking screen\" failure, not a styling nit.\n *\n * THE ROOT RENDERS UNCONDITIONALLY — no mount gate. The matrx-frontend\n * original carried a wrapper that deferred rendering until after hydration on\n * the theory that \"Radix generates dynamic aria-controls ids that differ\n * between SSR and client\". That is false — Radix ids come from React's\n * SSR-stable `useId` — and the gate deleted every accordion HEADER (and any\n * defaultValue-open item) from SSR and the first client paint. Same reasoning,\n * same verdict, as `collapsible.tsx`.\n *\n * Density is a PROP, exactly as on Card and Table: declared once on the root,\n * read from context by every trigger and panel, so an accordion cannot end up\n * with a `p-4` header above a `p-2` body.\n *\n * sm → py-2 trigger, pb-2 content (dense panels, inspector sidebars)\n * md → p-4 trigger, pb-4 content (reading surfaces; the default)\n *\n * The open/close height transition is package-owned CSS\n * (`.matrx-accordion-content` in `styles.css`, keyed off Radix's\n * `--radix-accordion-content-height`). It is NOT the Tailwind\n * `animate-accordion-down` utility the matrx-frontend fork used: that name\n * only exists in a host `tailwind.config.js`, so a fresh consumer got a\n * component that jumped open with no animation and no error — the exact\n * silent-host-contract failure C26 (the styling contract) exists to stop.\n *\n * Colour is tokens only.\n */\n\nimport * as AccordionPrimitive from \"@radix-ui/react-accordion\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { RadixChevronDownIcon } from \"./icons\";\n\nexport type AccordionSize = \"sm\" | \"md\";\n\nconst ACCORDION_SIZES: Record<\n AccordionSize,\n { trigger: string; content: string }\n> = {\n sm: { trigger: \"py-2 text-sm\", content: \"pb-2\" },\n md: { trigger: \"p-4 text-sm\", content: \"px-4 pb-4\" },\n};\n\nconst AccordionSizeContext = React.createContext<AccordionSize>(\"md\");\n\n/** The density the nearest enclosing `<Accordion>` declared. `md` outside one. */\nexport function useAccordionSize(): AccordionSize {\n return React.useContext(AccordionSizeContext);\n}\n\ntype AccordionRootProps = React.ComponentPropsWithoutRef<\n typeof AccordionPrimitive.Root\n> & {\n /** Density for this accordion and every section inside it. Default `md`. */\n size?: AccordionSize;\n};\n\nexport type AccordionProps = AccordionRootProps;\n\nconst Accordion = React.forwardRef<\n React.ComponentRef<typeof AccordionPrimitive.Root>,\n AccordionRootProps\n>(({ size = \"md\", ...props }, ref) => (\n <AccordionSizeContext.Provider value={size}>\n <AccordionPrimitive.Root ref={ref} data-slot=\"accordion\" data-size={size} {...props} />\n </AccordionSizeContext.Provider>\n));\nAccordion.displayName = \"Accordion\";\n\nconst AccordionItem = React.forwardRef<\n React.ComponentRef<typeof AccordionPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>\n>(({ className, ...props }, ref) => (\n <AccordionPrimitive.Item\n ref={ref}\n data-slot=\"accordion-item\"\n // A single-item accordion is a disclosure, not a list — the divider under\n // it would be a line under nothing.\n className={cn(\"[&:not(:only-child)]:border-b\", className)}\n {...props}\n />\n));\nAccordionItem.displayName = \"AccordionItem\";\n\nexport interface AccordionTriggerProps\n extends React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger> {\n /**\n * Controls rendered on the trigger row, before the chevron (a count badge, a\n * status pill). They live INSIDE the button, so keep them non-interactive —\n * a nested button is invalid HTML and swallows the toggle.\n */\n rightElements?: React.ReactNode;\n}\n\nconst AccordionTrigger = React.forwardRef<\n React.ComponentRef<typeof AccordionPrimitive.Trigger>,\n AccordionTriggerProps\n>(({ className, children, rightElements, ...props }, ref) => {\n const size = useAccordionSize();\n return (\n <AccordionPrimitive.Header className=\"flex w-full\">\n <AccordionPrimitive.Trigger\n ref={ref}\n data-slot=\"accordion-trigger\"\n className={cn(\n \"flex w-full items-center justify-between gap-2 rounded-md text-left font-medium transition-all\",\n \"hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n \"[&[data-state=open]>[data-slot=accordion-trigger-end]>svg]:rotate-180\",\n ACCORDION_SIZES[size].trigger,\n className,\n )}\n {...props}\n >\n {children}\n <span\n data-slot=\"accordion-trigger-end\"\n className=\"flex shrink-0 items-center gap-2\"\n >\n {rightElements}\n <RadixChevronDownIcon className=\"size-4 shrink-0 text-muted-foreground transition-transform duration-200\" />\n </span>\n </AccordionPrimitive.Trigger>\n </AccordionPrimitive.Header>\n );\n});\nAccordionTrigger.displayName = \"AccordionTrigger\";\n\nconst AccordionContent = React.forwardRef<\n React.ComponentRef<typeof AccordionPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>\n>(({ className, children, ...props }, ref) => {\n const size = useAccordionSize();\n return (\n <AccordionPrimitive.Content\n ref={ref}\n data-slot=\"accordion-content\"\n className=\"matrx-accordion-content overflow-hidden text-sm\"\n {...props}\n >\n <div className={cn(ACCORDION_SIZES[size].content, className)}>{children}</div>\n </AccordionPrimitive.Content>\n );\n});\nAccordionContent.displayName = \"AccordionContent\";\n\nexport { Accordion, AccordionContent, AccordionItem, AccordionTrigger };\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","/**\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 `matrx-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\n/**\n * @radix-ui/react-icons `DragHandleDots2Icon` — the grip on `ResizableHandle`.\n * Inlined per C19: this package depends on no icon library.\n */\nexport function DragHandleDots2Icon(props: IconProps) {\n return (\n <svg {...radixProps(props)}>\n <path\n d=\"M4.5 2.5C5.05228 2.5 5.5 2.05228 5.5 1.5C5.5 0.947715 5.05228 0.5 4.5 0.5C3.94772 0.5 3.5 0.947715 3.5 1.5C3.5 2.05228 3.94772 2.5 4.5 2.5ZM4.5 6.5C5.05228 6.5 5.5 6.05229 5.5 5.5C5.5 4.94771 5.05228 4.5 4.5 4.5C3.94772 4.5 3.5 4.94771 3.5 5.5C3.5 6.05229 3.94772 6.5 4.5 6.5ZM5.5 9.5C5.5 10.0523 5.05228 10.5 4.5 10.5C3.94772 10.5 3.5 10.0523 3.5 9.5C3.5 8.94771 3.94772 8.5 4.5 8.5C5.05228 8.5 5.5 8.94771 5.5 9.5ZM4.5 14.5C5.05228 14.5 5.5 14.0523 5.5 13.5C5.5 12.9477 5.05228 12.5 4.5 12.5C3.94772 12.5 3.5 12.9477 3.5 13.5C3.5 14.0523 3.94772 14.5 4.5 14.5ZM11.5 1.5C11.5 2.05228 11.0523 2.5 10.5 2.5C9.94771 2.5 9.5 2.05228 9.5 1.5C9.5 0.947715 9.94771 0.5 10.5 0.5C11.0523 0.5 11.5 0.947715 11.5 1.5ZM10.5 6.5C11.0523 6.5 11.5 6.05229 11.5 5.5C11.5 4.94771 11.0523 4.5 10.5 4.5C9.94771 4.5 9.5 4.94771 9.5 5.5C9.5 6.05229 9.94771 6.5 10.5 6.5ZM11.5 9.5C11.5 10.0523 11.0523 10.5 10.5 10.5C9.94771 10.5 9.5 10.0523 9.5 9.5C9.5 8.94771 9.94771 8.5 10.5 8.5C11.0523 8.5 11.5 8.94771 11.5 9.5ZM10.5 14.5C11.0523 14.5 11.5 14.0523 11.5 13.5C11.5 12.9477 11.0523 12.5 10.5 12.5C9.94771 12.5 9.5 12.9477 9.5 13.5C9.5 14.0523 9.94771 14.5 10.5 14.5Z\"\n fill=\"currentColor\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n","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","\"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 vaul wrappers (root + unstyled content primitive) were inlined here\n * privately in 0.5.0 because no shared Drawer existed. Since 0.6.0 the\n * package OWNS `./drawer`, so this file composes `Drawer` and\n * `DrawerContentPrimitive` from it: one vaul wrapper in the package, not\n * two. BottomSheet keeps its own geometry (that IS its product).\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 { Drawer as DrawerRoot, DrawerContentPrimitive } from \"./drawer\";\nimport { ChevronLeftIcon } from \"./icons\";\n\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","\"use client\";\n\n/**\n * Drawer — the vaul drawer family, and the package's iOS-mobile-first surface.\n *\n * WHY IT IS HERE. matrx-frontend's `components/ui/drawer.tsx` had 121 import\n * sites, and that host's own doctrine is \"Drawer, not Dialog, on mobile\" — so\n * the drawer is the surface most of this platform's mobile UX lands on. It was\n * also the LAST place still holding a copy of `RadixDialogModalProvider`, the\n * context this package already owned: a host copy of a React CONTEXT is the\n * quiet twin, because `useContext` matches by object identity, so the host\n * Drawer's provider and the package Sheet's consumer were two different\n * contexts that merely looked alike. Shipping the Drawer here closes that.\n *\n * `BottomSheet` (this package) previously inlined its own private vaul\n * wrappers because no Drawer existed to share; it now composes these, so there\n * is one vaul wrapper in the package rather than two.\n *\n * THE MOBILE-FIRST RULES THIS COMPONENT OWNS (so no host re-derives them):\n *\n * 1. `dvh`, NEVER `vh`. iOS Safari's `vh` is the tallest-possible viewport, so\n * a `vh`-capped drawer hides its own footer behind the browser chrome. The\n * cap is `max-h-[90dvh]`, and `size=\"full\"` is `h-dvh`.\n * 2. THE SAFE AREA IS PADDING, NOT A GUESS. Content bottom padding is\n * `pb-safe` (`env(safe-area-inset-bottom)`; shipped in `styles.css`), so the\n * home indicator never sits on top of the last control.\n * 3. THE GRAB HANDLE IS A 44px TARGET. The visible pill is 4px tall; it lives\n * inside a `min-h-11` (44px) grab area, the Apple HIG minimum. The old host\n * copy shipped the pill alone, so the affordance was three times smaller\n * than the gesture it advertises.\n * 4. THE BODY SCROLLS, THE FOOTER DOES NOT. `DrawerBody` is the\n * `flex-1 min-h-0 overflow-y-auto overscroll-contain` shard;\n * `DrawerFooter` is `mt-auto` and safe-area padded, so the primary action\n * is reachable however long the body is.\n * 5. A FIELD UNDER 16px ZOOMS iOS IN AND NEVER BACK OUT — the drawer's own\n * text scale therefore never goes below `text-base` on coarse pointers;\n * the floor itself is a host CSS concern, restated in `styles.css`.\n *\n * `direction` is forwarded to vaul and drives the content geometry, so a side\n * or top drawer is a prop rather than a fork.\n */\n\nimport { treeContainsComponent } from \"@ai-matrx/kit/react-tree\";\nimport * as React from \"react\";\nimport { Drawer as DrawerPrimitive } from \"vaul\";\n\nimport { cn } from \"./cn\";\nimport { RadixDialogModalProvider } from \"./radix-dialog-modal-context\";\n\nexport type DrawerDirection = \"top\" | \"bottom\" | \"left\" | \"right\";\n\nconst DrawerDirectionContext = React.createContext<DrawerDirection>(\"bottom\");\n\n/** The direction of the nearest Drawer root. */\nexport const useDrawerDirection = (): DrawerDirection =>\n React.useContext(DrawerDirectionContext);\n\n/**\n * `vaul`'s Root props are a DISCRIMINATED UNION (the snap-point branch adds\n * `fadeFromIndex`), so this type intersects the union rather than `Omit`-ing\n * from it — flattening the union collapses the discriminant and makes every\n * snap-point drawer a type error.\n *\n * Vaul does not forward `modal={false}` to its underlying Radix root, so a\n * \"non-modal\" drawer would claim ARIA semantics it does not have; the type\n * refuses the value rather than shipping the lie.\n */\nexport type DrawerProps = React.ComponentProps<typeof DrawerPrimitive.Root> & {\n modal?: true;\n direction?: DrawerDirection;\n};\n\nconst Drawer = ({\n children,\n shouldScaleBackground = true,\n ...props\n}: DrawerProps) => {\n const direction: DrawerDirection = props.direction ?? \"bottom\";\n return (\n <RadixDialogModalProvider modal>\n <DrawerDirectionContext.Provider value={direction}>\n <DrawerPrimitive.Root\n modal\n shouldScaleBackground={shouldScaleBackground}\n {...props}\n direction={direction}\n >\n {children}\n </DrawerPrimitive.Root>\n </DrawerDirectionContext.Provider>\n </RadixDialogModalProvider>\n );\n};\nDrawer.displayName = \"Drawer\";\n\nconst DrawerTrigger = DrawerPrimitive.Trigger;\nconst DrawerPortal = DrawerPrimitive.Portal;\nconst DrawerClose = DrawerPrimitive.Close;\n\nconst DrawerOverlay = React.forwardRef<\n React.ComponentRef<typeof DrawerPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DrawerPrimitive.Overlay\n ref={ref}\n data-slot=\"drawer-overlay\"\n className={cn(\n \"fixed inset-0 z-[10000] bg-[var(--matrx-overlay-scrim)]\",\n className,\n )}\n {...props}\n />\n));\nDrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName;\n\nconst DrawerDescription = React.forwardRef<\n React.ComponentRef<typeof DrawerPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DrawerPrimitive.Description\n ref={ref}\n data-slot=\"drawer-description\"\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nDrawerDescription.displayName = DrawerPrimitive.Description.displayName;\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\n/**\n * `adaptive` (default) sizes to content up to 90dvh — right for one short\n * list. `full` is ONE fixed height that never changes as content changes: use\n * it for any drawer whose body varies (tabs, search results, multi-level\n * navigation), because an adaptive drawer there resizes under the user's thumb\n * on every keystroke, which reads as the panel jumping.\n */\nexport type DrawerSize = \"adaptive\" | \"full\";\n\nconst DIRECTION_CLASSES: Record<DrawerDirection, string> = {\n bottom:\n \"inset-x-0 bottom-0 mt-24 flex-col rounded-t-[10px] border-t pb-safe\",\n top: \"inset-x-0 top-0 mb-24 flex-col rounded-b-[10px] border-b pt-safe\",\n left: \"inset-y-0 left-0 mr-24 flex-row rounded-r-[10px] border-r\",\n right: \"inset-y-0 right-0 ml-24 flex-row rounded-l-[10px] border-l\",\n};\n\nconst SIZE_CLASSES: Record<DrawerDirection, Record<DrawerSize, string>> = {\n bottom: { adaptive: \"h-auto max-h-[90dvh]\", full: \"h-[92dvh]\" },\n top: { adaptive: \"h-auto max-h-[90dvh]\", full: \"h-[92dvh]\" },\n left: { adaptive: \"w-auto max-w-[92vw]\", full: \"h-dvh w-[92vw] max-w-sm\" },\n right: { adaptive: \"w-auto max-w-[92vw]\", full: \"h-dvh w-[92vw] max-w-sm\" },\n};\n\nexport interface DrawerContentProps\n extends React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content> {\n /** Height/width posture. Default `adaptive`. */\n size?: DrawerSize;\n /** Render the drag-handle pill. Default: only for `top`/`bottom` drawers. */\n showHandle?: boolean;\n}\n\nconst DrawerContent = React.forwardRef<\n React.ComponentRef<typeof DrawerPrimitive.Content>,\n DrawerContentProps\n>(({ className, children, size = \"adaptive\", showHandle, ...props }, ref) => {\n const direction = useDrawerDirection();\n const hasDescription =\n treeContainsComponent(children, DrawerDescription) ||\n treeContainsComponent(children, DrawerPrimitive.Description);\n const withHandle =\n showHandle ?? (direction === \"bottom\" || direction === \"top\");\n\n return (\n <DrawerPortal>\n <DrawerOverlay />\n <DrawerContentPrimitive\n ref={ref}\n data-slot=\"drawer-content\"\n data-direction={direction}\n className={cn(\n \"fixed z-[10000] flex min-w-0 border bg-background\",\n DIRECTION_CLASSES[direction],\n SIZE_CLASSES[direction][size],\n className,\n )}\n {...(hasDescription ? {} : { \"aria-describedby\": undefined })}\n {...props}\n >\n {withHandle ? (\n // Rule 3: the pill is 4px; the TARGET is 44px.\n <div\n aria-hidden\n data-slot=\"drawer-handle\"\n className={cn(\n \"flex min-h-11 w-full shrink-0 cursor-grab items-center justify-center active:cursor-grabbing\",\n direction === \"top\" && \"order-last\",\n )}\n >\n <div className=\"h-1 w-[100px] rounded-full bg-muted\" />\n </div>\n ) : null}\n {children}\n </DrawerContentPrimitive>\n </DrawerPortal>\n );\n});\nDrawerContent.displayName = \"DrawerContent\";\n\nconst DrawerHeader = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n data-slot=\"drawer-header\"\n className={cn(\n \"grid shrink-0 gap-1.5 p-4 text-center sm:text-left\",\n className,\n )}\n {...props}\n />\n);\nDrawerHeader.displayName = \"DrawerHeader\";\n\n/**\n * The scroll shard. `flex-1 min-h-0` is the pair that actually bounds a scroll\n * area inside a flex column — `flex-1` alone leaves `min-height: auto`, and the\n * body grows past the drawer instead of scrolling inside it.\n */\nconst DrawerBody = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n data-slot=\"drawer-body\"\n className={cn(\"min-h-0 flex-1 overflow-y-auto overscroll-contain px-4\", className)}\n {...props}\n />\n);\nDrawerBody.displayName = \"DrawerBody\";\n\nconst DrawerFooter = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n data-slot=\"drawer-footer\"\n className={cn(\"mt-auto flex shrink-0 flex-col gap-2 p-4 pb-safe\", className)}\n {...props}\n />\n);\nDrawerFooter.displayName = \"DrawerFooter\";\n\nconst DrawerTitle = React.forwardRef<\n React.ComponentRef<typeof DrawerPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DrawerPrimitive.Title\n ref={ref}\n data-slot=\"drawer-title\"\n className={cn(\n \"text-lg font-semibold leading-none tracking-tight\",\n className,\n )}\n {...props}\n />\n));\nDrawerTitle.displayName = DrawerPrimitive.Title.displayName;\n\nexport {\n Drawer,\n DrawerBody,\n DrawerClose,\n DrawerContent,\n DrawerContentPrimitive,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerOverlay,\n DrawerPortal,\n DrawerTitle,\n DrawerTrigger,\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\n/**\n * Alert — the inline status banner (76 host import sites).\n *\n * Ported from matrx-frontend `components/ui/alert.tsx`. That copy shipped two\n * variants, `default` and `destructive`, so every \"this is a warning\" and\n * \"this succeeded\" banner in the fleet was hand-rolled: an amber or emerald\n * `<div>` carrying literal palette classes and a hand-written dark-mode twin,\n * written once per surface. The census that opened this wave found dozens of those\n * across four repos.\n *\n * So the variant set is the token vocabulary this package already declares —\n * `default | destructive | warning | success | info` — and none of them\n * hardcode a colour (C26). A host that wants a different amber changes\n * `--warning`; it never writes another banner.\n *\n * `Alert` is a plain `role=\"alert\"` region, NOT a toast: it stays on the page,\n * it is not dismissed on a timer, and a screen reader announces it where it\n * sits. Transient notifications are the host's toast system.\n */\n\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nconst alertVariants = cva(\n \"relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg~*]:pl-7\",\n {\n variants: {\n variant: {\n default: \"bg-background text-foreground [&>svg]:text-foreground\",\n destructive:\n \"border-destructive/50 bg-destructive/5 text-destructive dark:border-destructive [&>svg]:text-destructive\",\n warning:\n \"border-warning/50 bg-warning/5 text-warning dark:border-warning [&>svg]:text-warning\",\n success:\n \"border-success/50 bg-success/5 text-success dark:border-success [&>svg]:text-success\",\n info: \"border-info/50 bg-info/5 text-info dark:border-info [&>svg]:text-info\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\n\nexport interface AlertProps\n extends React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof alertVariants> {}\n\nconst Alert = React.forwardRef<HTMLDivElement, AlertProps>(\n ({ className, variant, ...props }, ref) => (\n <div\n ref={ref}\n role=\"alert\"\n data-slot=\"alert\"\n data-variant={variant ?? \"default\"}\n className={cn(alertVariants({ variant }), className)}\n {...props}\n />\n ),\n);\nAlert.displayName = \"Alert\";\n\nconst AlertTitle = React.forwardRef<\n HTMLHeadingElement,\n React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n <h5\n ref={ref}\n data-slot=\"alert-title\"\n className={cn(\"mb-1 font-medium leading-none tracking-tight\", className)}\n {...props}\n />\n));\nAlertTitle.displayName = \"AlertTitle\";\n\nconst AlertDescription = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"alert-description\"\n className={cn(\"text-sm [&_p]:leading-relaxed\", className)}\n {...props}\n />\n));\nAlertDescription.displayName = \"AlertDescription\";\n\nexport { Alert, AlertDescription, AlertTitle, alertVariants };\n","\"use client\";\n\n/**\n * AlertDialog — the confirm/destroy surface (78 host import sites).\n *\n * Ported from matrx-frontend `components/ui/alert-dialog.tsx`, which was the\n * only variant in the fleet that had been hardened. Its rulings, kept verbatim:\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, and it deleted always-visible Triggers (delete buttons, mostly)\n * from SSR and the first client paint.\n *\n * 2. AN UNDESCRIBED ALERT DIALOG STILL DESCRIBES ITSELF. A confirm dialog with\n * no `AlertDialogDescription` gets a screen-reader-only one rather than a\n * console warning — the surface where a blind user is about to destroy\n * something is the wrong place to ship an accessibility gap.\n *\n * ADDED HERE, from the same doctrine `Dialog` already carries and this\n * component demonstrably needed:\n *\n * 3. IT IS CLAMPED TO THE VIEWPORT AND SCROLLS INSIDE ITSELF\n * (`max-h-[85dvh] overflow-y-auto`). The host copy was NOT — an alert\n * dialog whose body listed what is about to be deleted pushed Cancel and\n * Continue below the fold on a short viewport, and the only way out was a\n * backdrop click. On an ALERT dialog Radix does not dismiss on backdrop\n * click, so the surface was a genuine dead end. Recorded in CHANGELOG as a\n * real defect fixed in the port, not \"preserved\".\n *\n * 4. THE ACTIONS ARE 44px TALL ON COARSE POINTERS. `AlertDialogAction` and\n * `AlertDialogCancel` inherit the package Button's own target rules through\n * `buttonVariants`; the footer keeps them safe-area padded on mobile.\n *\n * 5. THE STICKY FOOTER NEVER PAINTS OVER THE BODY (0.11.3). Ruling 3's footer\n * bled over the card's bottom padding with a negative block margin, and\n * `position: sticky` clamps a box to its containing block — so the footer\n * was dragged UP by `--dialog-pad` against the card's `gap-4`, covering the\n * last 8px of the consequence copy at every length, unreachable because the\n * card did not scroll. The bleed is now the card's RESERVATION\n * (`matrx-dialog-card` gives its bottom padding to `matrx-dialog-footer`),\n * which sticky has nothing to clamp. See `sticky-footer-geometry.test.tsx`.\n *\n * SEAM INVERSION. The host resolved its portal target through\n * `usePopoutContainer` (its window-panel popout body); here that is the\n * package's `PortalContainerProvider`, with an explicit `container` prop still\n * winning.\n */\n\nimport * as AlertDialogPrimitive from \"@radix-ui/react-alert-dialog\";\nimport { treeContainsComponent } from \"@ai-matrx/kit/react-tree\";\nimport * as React from \"react\";\n\nimport { buttonVariants } from \"./button\";\nimport { cn } from \"./cn\";\nimport { CENTERED_DIALOG, MOTION_DIALOG, MOTION_OVERLAY } from \"./motion\";\nimport { usePortalContainer } from \"./portal-container\";\n\nconst AlertDialog = AlertDialogPrimitive.Root;\n\nconst AlertDialogTrigger = AlertDialogPrimitive.Trigger;\n\n/**\n * Portal-seam-aware AlertDialogPortal. Explicit `container` wins; with none,\n * the injected container; with neither, Radix's `document.body`.\n */\nconst AlertDialogPortal = ({\n container,\n ...props\n}: Omit<\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.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 (\n <AlertDialogPrimitive.Portal container={resolved ?? null} {...props} />\n );\n};\nAlertDialogPortal.displayName = \"AlertDialogPortal\";\n\nconst AlertDialogOverlay = React.forwardRef<\n React.ComponentRef<typeof AlertDialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Overlay\n ref={ref}\n data-slot=\"alert-dialog-overlay\"\n className={cn(\n \"fixed inset-0 z-[10000] bg-[var(--matrx-overlay-scrim)]\",\n MOTION_OVERLAY,\n className,\n )}\n {...props}\n />\n));\nAlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;\n\n/**\n * Unstyled, non-portalling Content for custom layouts. AlertDialog is always\n * modal, so `aria-modal` is stated rather than derived.\n */\nconst AlertDialogContentPrimitive = React.forwardRef<\n React.ComponentRef<typeof AlertDialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>\n>((props, ref) => (\n <AlertDialogPrimitive.Content {...props} ref={ref} aria-modal=\"true\" />\n));\nAlertDialogContentPrimitive.displayName = \"AlertDialogContentPrimitive\";\n\nconst AlertDialogDescription = React.forwardRef<\n React.ComponentRef<typeof AlertDialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Description\n ref={ref}\n data-slot=\"alert-dialog-description\"\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nAlertDialogDescription.displayName =\n AlertDialogPrimitive.Description.displayName;\n\nexport interface AlertDialogContentProps\n extends React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content> {\n /** Explicit portal target; wins over the injected container. */\n container?: HTMLElement | null;\n /**\n * Package-owned open/close motion. Default `true`. Pass `false` for a\n * surface that must appear instantly. It is NOT the reduced-motion switch;\n * `styles.css` already honours `prefers-reduced-motion`.\n */\n animated?: boolean;\n}\n\nconst AlertDialogContent = React.forwardRef<\n React.ComponentRef<typeof AlertDialogPrimitive.Content>,\n AlertDialogContentProps\n>(({ className, children, container, animated = true, ...props }, ref) => {\n const hasDescription =\n treeContainsComponent(children, AlertDialogDescription) ||\n treeContainsComponent(children, AlertDialogPrimitive.Description);\n return (\n <AlertDialogPortal container={container}>\n <AlertDialogOverlay />\n <AlertDialogContentPrimitive\n ref={ref}\n data-slot=\"alert-dialog-content\"\n className={cn(\n `matrx-dialog-card fixed left-[50%] top-[50%] z-[10000] grid min-w-0 w-full max-w-lg ${CENTERED_DIALOG} gap-4 border bg-background p-6 shadow-lg`,\n // Ruling 3 — never taller than the viewport, always scrollable, and\n // the footer stays reachable via --dialog-pad like Dialog's.\n // Ruling 5 (0.11.3) — `matrx-dialog-card` hands the bottom padding to\n // a sticky footer when there is one, so the footer's box matches the\n // space the grid gave it and sticky never clamps it up over the\n // consequence copy.\n \"max-h-[85dvh] overflow-y-auto overscroll-contain [--dialog-pad:1.5rem] overflow-x-clip [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full\",\n \"sm:rounded-lg\",\n animated && MOTION_DIALOG,\n className,\n )}\n {...props}\n >\n {hasDescription ? null : (\n <AlertDialogPrimitive.Description className=\"sr-only\">\n Please confirm the action described in this dialog.\n </AlertDialogPrimitive.Description>\n )}\n {children}\n </AlertDialogContentPrimitive>\n </AlertDialogPortal>\n );\n});\nAlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;\n\nconst AlertDialogHeader = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n data-slot=\"alert-dialog-header\"\n className={cn(\"flex flex-col space-y-2 text-center sm:text-left\", className)}\n {...props}\n />\n);\nAlertDialogHeader.displayName = \"AlertDialogHeader\";\n\nconst AlertDialogFooter = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n data-slot=\"alert-dialog-footer\"\n className={cn(\n \"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n // Ruling 3/4 — sticky to the card edges so a scrolled body never shows\n // through under the actions, and safe-area padded on a phone. ALL of\n // that geometry is `matrx-dialog-footer`, a rule this package SHIPS\n // (styles.css), because the utility spelling of it carried a negative\n // block margin that sticky clamped — painting the footer over the last\n // 8px of the consequence at every description length (0.11.3).\n \"matrx-dialog-footer bg-background\",\n className,\n )}\n {...props}\n />\n);\nAlertDialogFooter.displayName = \"AlertDialogFooter\";\n\nconst AlertDialogTitle = React.forwardRef<\n React.ComponentRef<typeof AlertDialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Title\n ref={ref}\n data-slot=\"alert-dialog-title\"\n className={cn(\"text-lg font-semibold\", className)}\n {...props}\n />\n));\nAlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;\n\nconst AlertDialogAction = React.forwardRef<\n React.ComponentRef<typeof AlertDialogPrimitive.Action>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Action\n ref={ref}\n data-slot=\"alert-dialog-action\"\n className={cn(buttonVariants(), className)}\n {...props}\n />\n));\nAlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;\n\nconst AlertDialogCancel = React.forwardRef<\n React.ComponentRef<typeof AlertDialogPrimitive.Cancel>,\n React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>\n>(({ className, ...props }, ref) => (\n <AlertDialogPrimitive.Cancel\n ref={ref}\n data-slot=\"alert-dialog-cancel\"\n className={cn(\n buttonVariants({ variant: \"outline\" }),\n \"mt-2 sm:mt-0\",\n className,\n )}\n {...props}\n />\n));\nAlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;\n\nexport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogContentPrimitive,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogOverlay,\n AlertDialogPortal,\n AlertDialogTitle,\n AlertDialogTrigger,\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 /**\n * An explicit spelling of `default`, identical by construction. It is\n * not decoration: matrx-frontend's `ButtonMine` fork carried it, ~17\n * call sites say `variant=\"primary\"`, and the alternative to keeping\n * the word was a host shim translating a prop — the massage C22 bans.\n */\n primary: \"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 /** The affirmative twin of `destructive` — confirm, approve, publish. */\n success:\n \"bg-success text-success-foreground shadow-sm hover:bg-success/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 /**\n * ONE size scale, xs → 3xl, plus the two icon boxes. The top and bottom\n * of the scale came in from matrx-frontend's `ButtonMine` fork (2026-09-07):\n * a dense toolbar needs `xs`, and a marketing/hero call to action needs\n * `xl`+. A host that has to reach outside this scale forks the button,\n * which is exactly how `ButtonMine` was born.\n */\n size: {\n xs: \"h-6 rounded-md px-1 text-xs\",\n sm: \"h-8 rounded-md px-3 text-xs\",\n default: \"h-9 px-4 py-2\",\n /** An explicit spelling of `default` (the fork's middle rung). */\n md: \"h-9 px-4 py-2\",\n lg: \"h-10 rounded-md px-6\",\n xl: \"h-12 px-8 py-3 text-base\",\n \"2xl\": \"h-14 px-10 py-3 text-base\",\n \"3xl\": \"h-16 px-12 py-3 text-base\",\n icon: \"h-9 w-9\",\n \"icon-sm\": \"h-7 w-7\",\n /** A circular icon box — an avatar-shaped control, not a square one. */\n roundIcon: \"h-8 w-8 rounded-full p-0\",\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","/**\n * THE MOTION CONTRACT (0.10.0) — the class names every animated surface in\n * this package puts on the DOM, in ONE place.\n *\n * Why a module and not ten inline strings: the sweep that produced this file\n * found the same defect ten times over, and it was invisible each time\n * because each primitive spelled its animation out by hand. Ten hand-written\n * copies of `data-[state=open]:animate-in data-[state=closed]:animate-out\n * data-[state=closed]:fade-out-0 …` meant ten chances to reach for a utility\n * nothing in the package defines — which is exactly what happened. A single\n * exported constant per motion SHAPE means the next primitive cannot invent\n * an eleventh spelling, and `styles.test.ts` can prove every one of them\n * resolves to a rule in the shipped stylesheet.\n *\n * Every rule these name lives in `styles.css` under the package's own\n * keyframes. NONE of them is a Tailwind utility, and none requires a host\n * plugin — see that file's header for the measurement that made this\n * necessary.\n */\n\n/** Modal scrims: Dialog, AlertDialog, Sheet, CommandDialog. Fade only. */\nexport const MOTION_OVERLAY = \"matrx-motion-overlay\";\n\n/** The centred dialog card. Fades and scales; centring is not its business. */\nexport const MOTION_DIALOG = \"matrx-motion-dialog\";\n\n/**\n * THE CENTRING OF A CENTRED DIALOG CARD — package-owned, in the `translate`\n * property, and NEVER a Tailwind `translate-x-[-50%] translate-y-[-50%]` pair.\n *\n * Those utilities do not compile to the same thing in every host: Tailwind v3\n * writes them into `transform`, Tailwind v4 writes them into the independent\n * `translate` property, which COMPOSES with `transform` instead of being\n * replaced by it. 0.10.0's keyframes restated the centring inside `transform`,\n * which was harmless on v3 and doubled the centring on v4 — the card flew in\n * from off the top-left of the viewport for the animation's whole duration and\n * snapped into place at the end (fixed in 0.10.1).\n *\n * Owning it here means one spelling that reads the same on both, and it frees\n * `transform` so the keyframes carry ONLY the delta. Put this on every centred\n * surface UNCONDITIONALLY — it is geometry, so unlike {@link MOTION_DIALOG} it\n * must survive `animated={false}`. Its rule ships in `styles.css`.\n */\nexport const CENTERED_DIALOG = \"matrx-dialog-centered\";\n\n/**\n * The resting gap between a `popper`-positioned surface and its trigger, for\n * the primitives that want one (today: `Select`). Same law and same reason as\n * {@link CENTERED_DIALOG} — a position an animated surface holds AT REST is\n * the `translate` property's job, never a Tailwind translate utility, because\n * those land in `transform` on a v3 host and in `translate` on a v4 one while\n * the keyframes animate `transform` either way. Sizes from\n * `--matrx-popper-offset`; keys off Radix's `data-side`.\n */\nexport const POPPER_OFFSET = \"matrx-popper-offset\";\n\n/** The mobile Dialog / CommandDialog bottom sheet. Slides up and fades. */\nexport const MOTION_BOTTOM_SHEET = \"matrx-motion-bottom-sheet\";\n\n/**\n * Radix-popper surfaces: Popover, DropdownMenu, ContextMenu, HoverCard,\n * Select, Tooltip. Reads `--radix-popper-transform-origin` so the surface\n * grows out of its trigger, and `data-side` so it travels from it.\n */\nexport const MOTION_POPPER = \"matrx-motion-popper\";\n\n/** Edge sheets, one class per `sheetVariants` side. */\nexport const MOTION_SHEET = {\n top: \"matrx-motion-sheet-top\",\n bottom: \"matrx-motion-sheet-bottom\",\n left: \"matrx-motion-sheet-left\",\n right: \"matrx-motion-sheet-right\",\n center: \"matrx-motion-sheet-center\",\n} as const;\n\n/** Skeleton's breathing loop. */\nexport const MOTION_PULSE = \"matrx-pulse\";\n\n/** The spinner loop, for every inline busy indicator in the package. */\nexport const MOTION_SPIN = \"matrx-spin\";\n\n/**\n * Every motion class the package ships, for the guards. If a rule for one of\n * these is missing from `styles.css`, a component animates in no consumer and\n * says nothing about it — the C26 failure this list exists to make loud.\n */\nexport const ALL_MOTION_CLASSES = [\n MOTION_OVERLAY,\n MOTION_DIALOG,\n MOTION_BOTTOM_SHEET,\n MOTION_POPPER,\n ...Object.values(MOTION_SHEET),\n MOTION_PULSE,\n MOTION_SPIN,\n] as const;\n\n/**\n * The host-plugin utilities this package is forbidden to emit. They are\n * supplied by `tailwindcss-animate` / `tw-animate-css`, which is a HOST CSS\n * entry concern a package cannot declare a dependency on: three of the four\n * AI Matrx consumers never loaded it, so every surface wearing these appeared\n * with no animation and no error. `styles.test.ts` fails the build if one\n * comes back.\n */\nexport const FORBIDDEN_HOST_MOTION_UTILITIES = [\n \"animate-in\",\n \"animate-out\",\n \"fade-in\",\n \"fade-out\",\n \"zoom-in\",\n \"zoom-out\",\n \"slide-in-from\",\n \"slide-out-to\",\n \"animate-accordion\",\n \"animate-slide-down\",\n \"animate-slide-up\",\n \"animate-pulse\",\n \"animate-spin\",\n] as const;\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 * 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, with the one thing Radix does not ship: the open/close\n * transition.\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 * THE TRANSITION IS PACKAGE-OWNED (census row 19f, the tail of 19c). Until\n * 0.9.0 this file was a bare re-export and the package shipped NO transition,\n * so every consumer invented its own — and two of them invented it wrong.\n * `matrx-collapsible.tsx` and `enhanced-collapsible.tsx` put\n * `animate-accordion-down`/`-up` on a COLLAPSIBLE panel: those keyframes\n * interpolate to `--radix-ACCORDION-content-height`, a variable Radix never\n * publishes on a collapsible, so they had never animated once — silently, with\n * no error, for as long as they existed. Six other matrx-frontend components\n * used host-only `animate-slide-down`/`-up` keyframes that WERE keyed\n * correctly — and worked in exactly one app in the fleet, because the\n * keyframes lived in that app's `globals.css`. Both shapes are the same C26\n * failure: a component whose motion depends on a contract the host has to\n * happen to hold. `.matrx-collapsible-content` in `styles.css` ends it — keyed\n * off Radix's runtime `--radix-collapsible-content-height`, honouring\n * `prefers-reduced-motion`, shipped in the tarball.\n *\n * Nothing else here is restyled: the trigger and the panel's own padding are\n * the host's to dress, and every fork agreed on that. Unlike `AccordionContent`\n * this component does NOT wrap children in a padding div — collapsibles in the\n * fleet pad their own bodies, and inserting a box would move every one of them.\n */\n\nimport * as CollapsiblePrimitive from \"@radix-ui/react-collapsible\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nconst Collapsible = CollapsiblePrimitive.Root;\nconst CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;\n\nexport interface CollapsibleContentProps\n extends React.ComponentPropsWithoutRef<\n typeof CollapsiblePrimitive.CollapsibleContent\n > {\n /**\n * Animate the height on open/close. Default `true`.\n *\n * Pass `false` for the rare panel that must not clip or must not move: the\n * animated panel carries `overflow-hidden` (a height transition without it\n * spills the body over whatever is below), so a panel with a child that\n * deliberately overflows its bounds — a non-portalled popover, a sticky\n * column header — opts out here rather than fighting the class. Opting out\n * gives you bare Radix: instant open, no clipping, no keyframes.\n *\n * `prefers-reduced-motion` is NOT this prop's job; the stylesheet already\n * drops the animation for those users while keeping the clipping.\n */\n animated?: boolean;\n}\n\nconst CollapsibleContent = React.forwardRef<\n React.ComponentRef<typeof CollapsiblePrimitive.CollapsibleContent>,\n CollapsibleContentProps\n>(({ className, animated = true, ...props }, ref) => (\n <CollapsiblePrimitive.CollapsibleContent\n ref={ref}\n data-slot=\"collapsible-content\"\n className={cn(\n animated && \"matrx-collapsible-content overflow-hidden\",\n className,\n )}\n {...props}\n />\n));\nCollapsibleContent.displayName = \"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 {\n CENTERED_DIALOG,\n MOTION_BOTTOM_SHEET,\n MOTION_DIALOG,\n MOTION_OVERLAY,\n} from \"./motion\";\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 ${CENTERED_DIALOG} gap-4 overflow-x-clip border bg-background p-6 shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full 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 rounded-t-2xl rounded-b-none overflow-y-auto overscroll-contain\";\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={cn(\n \"fixed inset-0 z-[10000] bg-[var(--matrx-overlay-scrim-soft)]\",\n MOTION_OVERLAY,\n )}\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 isMobile ? MOTION_BOTTOM_SHEET : MOTION_DIALOG,\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 * 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 * ConfirmDialog — the `window.confirm` replacement, declarative half.\n *\n * WHY IT LIVES HERE AND NOT IN `@ai-matrx/kit` (census row 19i, decided by the\n * package-graph ruling of 2026-09-07, on the row-20a Tooltip precedent).\n *\n * kit shipped this dialog with its own inlined AlertDialog, its own inlined\n * button class strings, a hardcoded 80%-opaque black scrim, and\n * `data-[state=open]:animate-in … zoom-in-95 … slide-in-from-top-[48%]` —\n * host-plugin utilities `tailwindcss-animate`/`tw-animate-css` supply and a\n * package cannot ship. kit ships NO stylesheet at all, so in three of the four\n * consumers the most consequential surface in the app (the one standing\n * between a user and a destroyed thing) appeared with no animation, no error,\n * and a scrim that ignored the theme. kit could not import the fix:\n * `@ai-matrx/design-system` depends on `@ai-matrx/kit`, so importing back is a\n * cycle; giving kit its own sheet would invent a second required-CSS contract\n * no consumer performs (the C26 silent host contract, one layer down).\n *\n * The resolution is the one row 20a already proved: the surface moves to the\n * package that owns the surface. This file is built on THIS package's\n * `AlertDialog` — so it inherits, for free and forever:\n *\n * - the package motion layer (`matrx-motion-overlay` / `matrx-motion-dialog`),\n * whose rules ship in `styles.css` and are proven present in the tarball;\n * - `--matrx-overlay-scrim`, a token that answers to the host's theme,\n * instead of an opaque black literal;\n * - AlertDialog ruling 3 — clamped to `max-h-[85dvh]`, scrolling inside\n * itself, with a sticky footer. **This is what makes the consequence-first\n * copy law survivable**: a confirmation that names everything it is about\n * to destroy can be long, and in kit's copy a long one pushed Cancel and\n * Continue below the fold of a short viewport with no backdrop dismissal —\n * a dead end on a destructive action;\n * - `buttonVariants` as the ONE source of button appearance, including the\n * 44px coarse-pointer target;\n * - `PortalContainerProvider`, so a dialog opened inside a popped-out window\n * panel renders in THAT window's document.\n *\n * kit keeps `./confirm-opener` — the pure, React-free imperative `confirm()`\n * and its `globalThis`-slotted host registry — and re-exports nothing of this.\n * Consumers mount `<ConfirmDialogHost />` from here and call `confirm()` from\n * there. See `confirm-host.tsx` for the join.\n *\n * BEHAVIOR IS THE KIT PORT, VERBATIM. Every prop, default and interaction is\n * unchanged; only the chrome underneath it is the package's.\n *\n * Pattern: hold the pending target in state, render `<ConfirmDialog />` once at\n * the bottom of the component, and open it by setting the target. When busy\n * state is meaningful (a network delete that should hold the dialog open with a\n * spinner), use THIS component inline; the imperative `confirm()` closes\n * immediately on click.\n */\n\nimport * as React from \"react\";\n\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n} from \"./alert-dialog\";\nimport { buttonVariants } from \"./button\";\nimport { cn } from \"./cn\";\nimport { Loader2Icon } from \"./icons\";\nimport { MOTION_SPIN } from \"./motion\";\n\nexport interface ConfirmDialogProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n title: React.ReactNode;\n /**\n * THE CONSEQUENCE. Per the platform's destructive-and-expensive-actions law,\n * a confirmation must name what is lost, what is duplicated, and/or what it\n * costs — \"Are you sure?\" is not a confirmation. This renders as the dialog's\n * accessible description, so a screen-reader user is told the consequence\n * too, and it is never clamped or truncated.\n */\n description?: React.ReactNode | undefined;\n /**\n * Rich body rendered between the header and the footer, OUTSIDE the\n * description `<p>` — use for block-level content (diffs, previews, lists of\n * exactly what is about to be deleted) that would be invalid HTML inside\n * `description`.\n */\n content?: React.ReactNode | undefined;\n /** Extra classes for the dialog content (e.g. a wider max-w for diffs). */\n contentClassName?: string | undefined;\n confirmLabel?: string | undefined;\n /**\n * `null` hides the cancel button entirely — for acknowledge-only dialogs\n * where there is nothing to cancel. Anything else labels it.\n */\n cancelLabel?: string | null | undefined;\n variant?: \"default\" | \"destructive\" | undefined;\n busy?: boolean | undefined;\n /**\n * Blocks confirming without pretending work is in flight. For a dialog whose\n * `content` asks the user something the action cannot proceed without — the\n * choice is missing, not loading — `busy` would show a misleading spinner.\n */\n confirmDisabled?: boolean | undefined;\n /**\n * Explicit portal target. Default (undefined): the container injected by\n * `PortalContainerProvider`, else `document.body`. Hosts with retargeting\n * needs (a popped-out browser window whose dialog must render in THAT\n * window's document) may still pass the element directly.\n */\n portalContainer?: HTMLElement | null | undefined;\n onConfirm: () => void | Promise<void>;\n}\n\n/**\n * Drop-in replacement for `window.confirm`. Use this anywhere you would\n * otherwise reach for a browser-level confirm dialog.\n */\nexport function ConfirmDialog({\n open,\n onOpenChange,\n title,\n description,\n content,\n contentClassName,\n confirmLabel = \"Confirm\",\n cancelLabel = \"Cancel\",\n variant = \"default\",\n busy = false,\n confirmDisabled = false,\n portalContainer,\n onConfirm,\n}: ConfirmDialogProps) {\n return (\n <AlertDialog open={open} onOpenChange={onOpenChange}>\n <AlertDialogContent\n className={contentClassName}\n {...(portalContainer === undefined ? {} : { container: portalContainer })}\n >\n <AlertDialogHeader>\n <AlertDialogTitle>{title}</AlertDialogTitle>\n {description ? (\n <AlertDialogDescription>{description}</AlertDialogDescription>\n ) : null}\n </AlertDialogHeader>\n {content ?? null}\n <AlertDialogFooter>\n {cancelLabel === null ? null : (\n <AlertDialogCancel className=\"max-lg:min-h-11\" disabled={busy}>\n {cancelLabel}\n </AlertDialogCancel>\n )}\n <AlertDialogAction\n disabled={busy || confirmDisabled}\n onClick={(event) => {\n event.preventDefault();\n void onConfirm();\n }}\n className={cn(\n \"max-lg:min-h-11\",\n // One source of button appearance: the destructive look comes\n // from `buttonVariants`, not a second hand-written copy of it.\n // tailwind-merge makes it WIN over the default variant classes.\n variant === \"destructive\" &&\n buttonVariants({ variant: \"destructive\" }),\n )}\n >\n {busy ? (\n <Loader2Icon className={cn(\"mr-2 h-4 w-4\", MOTION_SPIN)} />\n ) : null}\n {confirmLabel}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n );\n}\n","\"use client\";\n\n/**\n * `<ConfirmDialogHost />` — render ONCE, near the root of every provider tree,\n * so the imperative `confirm()` always has a live host to dispatch to.\n *\n * THE SPLIT (census row 19i, 2026-09-07). The confirm system is two halves in\n * two packages, on purpose:\n *\n * `@ai-matrx/kit/confirm-opener` the OPENER — `confirm()`, the host\n * registry, the request queue. Pure TS: zero\n * React, zero markup, zero CSS. Statically\n * importable from a Redux thunk, a util, a\n * sync handler — hundreds of call sites at\n * near-zero bundle cost.\n * `@ai-matrx/design-system` the BODY — this host and `ConfirmDialog`,\n * built on the package AlertDialog so the\n * surface gets the shipped motion layer and\n * the themed scrim instead of the host-plugin\n * classes and the hardcoded black scrim\n * kit could neither style nor animate.\n *\n * Design-system depends on kit, so this direction is the acyclic one; kit\n * re-exports nothing of the body. A consumer mounts `<ConfirmDialogHost />`\n * from here and calls `confirm()` from there — the two find each other through\n * the opener's `Symbol.for(\"ai-matrx.kit.confirm-opener-state\")` globalThis\n * slot, which is deliberately NOT a module-level variable: with unsplit dual\n * ESM/CJS bundles each loader graph instantiates its own module, and a module\n * local would silently split host registration from callers. Never \"clean that\n * up\".\n *\n * Pre-mount `confirm()` calls queue inside the opener and resolve as soon as\n * this host registers — a destructive action triggered in the first ~50ms after\n * load still gets a real confirmation, never a silent default-yes/no.\n *\n * NO FRAMEWORK IMPORT. The matrx-frontend original split shell + impl and\n * loaded the impl through `next/dynamic({ ssr: false })` to keep radix out of\n * route entry chunks. A framework-agnostic package cannot do that, so this is\n * ONE directly-imported component; hosts that want the code-splitting lazy-load\n * it themselves:\n * `dynamic(() => import(\"@ai-matrx/design-system\").then(m => m.ConfirmDialogHost), { ssr: false })`\n * The \"render `<ConfirmDialogHost/>` once\" contract is unchanged either way.\n *\n * Imperative model: calls to `confirm(...)` push a request into a ref-backed\n * queue; this component drains it one at a time and renders a `<ConfirmDialog>`\n * for the active request. The promise resolves `true` on Confirm, `false` on\n * cancel/dismiss. The dialog closes immediately on click — callers that need an\n * in-dialog busy spinner during async work use the inline `<ConfirmDialog>`\n * with the `busy` prop instead.\n */\n\nimport {\n _registerHost,\n _unregisterHost,\n type ConfirmOptions,\n} from \"@ai-matrx/kit/confirm-opener\";\nimport * as React from \"react\";\n\nimport { ConfirmDialog } from \"./confirm-dialog\";\n\ninterface ActiveRequest {\n opts: ConfirmOptions;\n resolve: (confirmed: boolean) => void;\n}\n\nexport function ConfirmDialogHost() {\n const [active, setActive] = React.useState<ActiveRequest | null>(null);\n const [tick, setTick] = React.useState(0);\n const queueRef = React.useRef<ActiveRequest[]>([]);\n\n // Register/unregister the controller exactly once. The controller's `show`\n // always pushes onto the queue and bumps `tick`; the drain effect below picks\n // up from there. This avoids stale-closure bugs around `active`.\n React.useEffect(() => {\n const controller = {\n show: (opts: ConfirmOptions, resolve: (confirmed: boolean) => void) => {\n queueRef.current.push({ opts, resolve });\n setTick((n) => n + 1);\n },\n };\n _registerHost(controller);\n return () => _unregisterHost(controller);\n }, []);\n\n // Drain the queue whenever nothing is showing.\n React.useEffect(() => {\n if (active === null && queueRef.current.length > 0) {\n setActive(queueRef.current.shift()!);\n }\n }, [active, tick]);\n\n const handleConfirm = React.useCallback(() => {\n if (!active) return;\n active.resolve(true);\n setActive(null);\n }, [active]);\n\n const handleOpenChange = React.useCallback(\n (open: boolean) => {\n if (!open && active) {\n active.resolve(false);\n setActive(null);\n }\n },\n [active],\n );\n\n return (\n <ConfirmDialog\n open={!!active}\n onOpenChange={handleOpenChange}\n title={active?.opts.title ?? \"\"}\n description={active?.opts.description}\n confirmLabel={active?.opts.confirmLabel}\n cancelLabel={active?.opts.cancelLabel}\n variant={active?.opts.variant}\n onConfirm={handleConfirm}\n />\n );\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 { MOTION_POPPER } from \"./motion\";\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\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_POPPER, 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_POPPER, 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 matrx-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 { MOTION_POPPER } from \"./motion\";\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 interface PopoverContentProps\n extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> {\n /** Explicit portal target; wins over the injected container. */\n container?: HTMLElement | null;\n /**\n * Package-owned open/close motion. Default `true`. Pass `false` for a\n * surface that must appear instantly — a picker re-anchoring while the user\n * types, a measurement pass. It is NOT the reduced-motion switch;\n * `styles.css` already honours `prefers-reduced-motion`.\n */\n animated?: boolean;\n}\n\nexport const PopoverContent = React.forwardRef<\n React.ComponentRef<typeof PopoverPrimitive.Content>,\n PopoverContentProps\n>(\n (\n {\n className,\n align = \"center\",\n sideOffset = 4,\n container,\n animated = true,\n ...props\n },\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\",\n animated && MOTION_POPPER,\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 — AND NEVER ON TOP OF THE BODY.\n * `DialogFooter` is sticky and bleeds to the card's edges using\n * `--dialog-pad`. Until 0.11.3 that bleed was a NEGATIVE BLOCK MARGIN,\n * which sticky clamps: the footer was dragged up over the row above it by\n * `--dialog-pad` minus the card gap. The card now RESERVES the footer's\n * block size instead (`matrx-dialog-card` / `matrx-dialog-footer` in\n * `styles.css`), so scrolled content never shows through beneath it AND the\n * footer never covers the row above 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 {\n CENTERED_DIALOG,\n MOTION_BOTTOM_SHEET,\n MOTION_DIALOG,\n MOTION_OVERLAY,\n} from \"./motion\";\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)]\",\n MOTION_OVERLAY,\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 `matrx-dialog-card fixed left-[50%] top-[50%] z-[10000] grid min-w-0 w-full max-w-lg ${CENTERED_DIALOG} 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 sm:rounded-lg`;\n\nconst DIALOG_MOBILE_SHEET_CLASSES =\n \"matrx-mobile-sheet matrx-dialog-card 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 rounded-t-2xl rounded-b-none overflow-y-auto overscroll-contain\";\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 * Package-owned open/close motion. Default `true`. Pass `false` for a\n * surface that must appear instantly. It is NOT the reduced-motion switch;\n * `styles.css` already honours `prefers-reduced-motion`.\n */\n animated?: boolean;\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 animated = 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 animated && (asSheet ? MOTION_BOTTOM_SHEET : MOTION_DIALOG),\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 // Ruling 3 — the geometry is `matrx-dialog-footer`, a rule this package\n // SHIPS (styles.css). It used to be utilities, one of which was a\n // negative block margin that `position: sticky` clamps — the footer was\n // yanked up over the row above it by `--dialog-pad` minus the card gap\n // (0.11.3). The card gives the footer its bottom padding instead.\n \"matrx-dialog-footer bg-background\",\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 { MOTION_POPPER } from \"./motion\";\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\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\", MOTION_POPPER, 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 MOTION_POPPER,\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 matrx-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 && \"matrx-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 { MOTION_POPPER, POPPER_OFFSET } from \"./motion\";\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 interface SelectContentProps\n extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> {\n /** Explicit portal target; wins over the injected container. */\n container?: HTMLElement | null;\n /**\n * Package-owned open/close motion. Default `true`. Pass `false` for a\n * surface that must appear instantly. It is NOT the reduced-motion switch;\n * `styles.css` already honours `prefers-reduced-motion`.\n */\n animated?: boolean;\n}\n\nexport const SelectContent = React.forwardRef<\n React.ComponentRef<typeof SelectPrimitive.Content>,\n SelectContentProps\n>(\n (\n {\n className,\n children,\n position = \"popper\",\n container,\n animated = true,\n ...props\n },\n ref,\n ) => {\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\",\n animated && MOTION_POPPER,\n // The resting gap from the trigger. It is the `translate` property\n // (POPPER_OFFSET), never Tailwind translate utilities: those compose\n // with `transform` on a v4 host and are REPLACED by it on a v3 one,\n // so on v3 the animation ate the gap and the surface snapped 4px at\n // the end. Same law as the centred dialog card — see motion.ts.\n position === \"popper\" && POPPER_OFFSET,\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 { MOTION_OVERLAY, MOTION_SHEET } from \"./motion\";\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)]\",\n MOTION_OVERLAY,\n className,\n )}\n {...props}\n ref={ref}\n />\n));\nSheetOverlay.displayName = SheetPrimitive.Overlay.displayName;\n\nexport const sheetVariants = cva(\n // Motion is NOT stated here (0.10.0). The `data-[state=*]:animate-in/out`\n // + `slide-in-from-*` pairs this base and its side variants used to carry\n // came from the `tailwindcss-animate` HOST plugin, which three of four\n // consumers never loaded — every sheet in them slammed open with no\n // animation and no error. `SheetContent` now applies the package-owned\n // `MOTION_SHEET[side]` class alongside these variants; the keyframes,\n // durations and reduced-motion handling all live in `styles.css`.\n \"fixed z-50 gap-4 bg-background p-6 shadow-lg\",\n {\n variants: {\n side: {\n top: \"inset-x-0 top-0 border-b\",\n bottom: \"inset-x-0 bottom-0 border-t\",\n left: \"inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm\",\n right: \"inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm\",\n center: \"inset-0 m-auto max-h-full max-w-full border rounded-lg\",\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 * Package-owned open/close motion. Default `true`. Pass `false` for a panel\n * that must appear instantly — a persistent side rail toggled by a keyboard\n * shortcut, say. It is NOT the reduced-motion switch; `styles.css` already\n * honours `prefers-reduced-motion`.\n */\n animated?: boolean;\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 animated = true,\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(\n sheetVariants({ side }),\n animated && MOTION_SHEET[side ?? \"right\"],\n className,\n )}\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 — the \"content is coming\" placeholder.\n *\n * Ported from matrx-frontend `components/ui/skeleton.tsx`; no seams, pure\n * markup over semantic tokens. ONE change from the original (0.10.0): the\n * breathing loop is `.matrx-pulse`, a package-owned keyframe, not Tailwind's\n * `animate-pulse`. A Skeleton that does not pulse is indistinguishable from an\n * empty grey box — it stops saying \"loading\" and starts saying \"nothing here\"\n * — so the motion is part of the component's meaning and ships with it (see\n * `styles.css` § THE MOTION LAYER).\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { MOTION_PULSE } from \"./motion\";\n\nexport interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Package-owned pulse. Default `true`. Pass `false` for a static\n * placeholder — a print/PDF render, or a screenshot fixture where the\n * animation makes the output non-deterministic. `prefers-reduced-motion`\n * already SLOWS the pulse rather than stopping it (a still skeleton would\n * lose the information), so this is not the accessibility switch.\n */\n animated?: boolean;\n}\n\nexport function Skeleton({ className, animated = true, ...props }: SkeletonProps) {\n return (\n <div\n data-slot=\"skeleton\"\n className={cn(\n \"rounded-md bg-primary/10\",\n animated && MOTION_PULSE,\n className,\n )}\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","\"use client\";\n\n/**\n * HoverCard — the rich hover surface (16 host import sites).\n *\n * Ported from matrx-frontend `components/ui/hover-card.tsx`, including its\n * recorded ruling:\n *\n * THE ROOT RENDERS UNCONDITIONALLY — no hydration mount gate. The gate the\n * host wrapper once carried (\"Radix generates dynamic aria-controls ids that\n * differ between SSR and client\") was doubly false here:\n * `@radix-ui/react-hover-card` generates no ids of its own at all, and Radix\n * ids generally come from React's SSR-stable `useId`. The gate was actively\n * harmful — a Trigger wraps ALWAYS-VISIBLE content, so `return null` deleted\n * that subtree from SSR and the first client paint.\n *\n * SEAM INVERSION (new here). The host copy portalled nowhere — it rendered\n * `Content` inline, so a hover card inside an overflow-hidden ancestor was\n * clipped, and one inside a popped-out window-panel could not exist. It now\n * portals through the package's `PortalContainerProvider` seam like every\n * other floating surface in this package, with an explicit `container` prop\n * winning and `document.body` as the fallback. Behaviour for a card that was\n * never clipped is unchanged.\n *\n * A HOVER CARD IS NOT A TOOLTIP AND NOT A MENU: it is hover-only and not\n * focusable, so nothing inside it may be the ONLY way to reach an action —\n * touch and keyboard users never open it. Put the action somewhere else too.\n */\n\nimport * as HoverCardPrimitive from \"@radix-ui/react-hover-card\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { MOTION_POPPER } from \"./motion\";\nimport { usePortalContainer } from \"./portal-container\";\n\nconst HoverCard = HoverCardPrimitive.Root;\n\nconst HoverCardTrigger = HoverCardPrimitive.Trigger;\n\nexport interface HoverCardContentProps\n extends React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content> {\n /** Explicit portal target; wins over the injected container. */\n container?: HTMLElement | null;\n /**\n * Package-owned open/close motion. Default `true`. Pass `false` for a\n * surface that must appear instantly — a picker re-anchoring while the user\n * types, a measurement pass. It is NOT the reduced-motion switch;\n * `styles.css` already honours `prefers-reduced-motion`.\n */\n animated?: boolean;\n}\n\nconst HoverCardContent = React.forwardRef<\n React.ComponentRef<typeof HoverCardPrimitive.Content>,\n HoverCardContentProps\n>(\n (\n { className, align = \"center\", sideOffset = 4, container, animated = true, ...props },\n ref,\n ) => {\n const resolved = usePortalContainer(container);\n return (\n <HoverCardPrimitive.Portal container={resolved ?? null}>\n <HoverCardPrimitive.Content\n ref={ref}\n data-slot=\"hover-card-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-[10001] w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none\",\n animated && MOTION_POPPER,\n className,\n )}\n {...props}\n />\n </HoverCardPrimitive.Portal>\n );\n});\nHoverCardContent.displayName = HoverCardPrimitive.Content.displayName;\n\nexport { HoverCard, HoverCardContent, HoverCardTrigger };\n","\"use client\";\n\n/**\n * RadioGroup — single-choice selection (30 host import sites).\n *\n * Ported from matrx-frontend `components/ui/radio-group.tsx`, with the same\n * two corrections the rest of this wave carries:\n *\n * 1. DENSITY IS A PROP (C18) — `size=\"sm|md|lg\"` on the ROOT, read from\n * context by every item, so a group cannot mix control sizes. Matches the\n * `Checkbox` / `Switch` / `Card` shape already shipped in 0.5.0.\n *\n * 2. THE TARGET IS 44px ON COARSE POINTERS. A 16px radio is a mouse control;\n * an invisible pseudo-target expands the hit area without changing layout,\n * so a settings list works with a thumb. (A label wired via `htmlFor` also\n * extends the target — that stays the host's composition choice; this makes\n * the control itself usable on its own.)\n *\n * The indicator is a filled dot rather than Radix's default icon slot, which\n * is what every host variant drew.\n */\n\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport type RadioGroupSize = \"sm\" | \"md\" | \"lg\";\n\nconst RadioGroupSizeContext = React.createContext<RadioGroupSize>(\"md\");\n\nconst CONTROL_CLASSES: Record<RadioGroupSize, string> = {\n sm: \"h-3.5 w-3.5\",\n md: \"h-4 w-4\",\n lg: \"h-5 w-5\",\n};\n\nconst DOT_CLASSES: Record<RadioGroupSize, string> = {\n sm: \"h-1 w-1\",\n md: \"h-1.5 w-1.5\",\n lg: \"h-2 w-2\",\n};\n\nexport interface RadioGroupProps\n extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root> {\n /** Control scale for every item in the group. Default `md`. */\n size?: RadioGroupSize;\n}\n\nconst RadioGroup = React.forwardRef<\n React.ComponentRef<typeof RadioGroupPrimitive.Root>,\n RadioGroupProps\n>(({ className, size = \"md\", ...props }, ref) => (\n <RadioGroupSizeContext.Provider value={size}>\n <RadioGroupPrimitive.Root\n ref={ref}\n data-slot=\"radio-group\"\n className={cn(\"grid gap-2\", className)}\n {...props}\n />\n </RadioGroupSizeContext.Provider>\n));\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName;\n\nexport interface RadioGroupItemProps\n extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item> {\n /** Override the group's scale for one item. */\n size?: RadioGroupSize;\n}\n\nconst RadioGroupItem = React.forwardRef<\n React.ComponentRef<typeof RadioGroupPrimitive.Item>,\n RadioGroupItemProps\n>(({ className, size, ...props }, ref) => {\n const groupSize = React.useContext(RadioGroupSizeContext);\n const resolved = size ?? groupSize;\n return (\n <RadioGroupPrimitive.Item\n ref={ref}\n data-slot=\"radio-group-item\"\n className={cn(\n \"relative aspect-square shrink-0 rounded-full border border-primary shadow\",\n \"focus:outline-none focus-visible:ring-1 focus-visible:ring-ring\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n \"data-[state=checked]:border-primary data-[state=checked]:bg-primary\",\n // Ruling 2 — invisible 44px target on touch, layout untouched.\n \"after:absolute after:left-1/2 after:top-1/2 after:-translate-x-1/2 after:-translate-y-1/2 after:content-['']\",\n \"pointer-coarse:after:h-11 pointer-coarse:after:w-11\",\n CONTROL_CLASSES[resolved],\n className,\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator className=\"flex items-center justify-center\">\n <div\n className={cn(\"rounded-full bg-primary-foreground\", DOT_CLASSES[resolved])}\n />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n );\n});\nRadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;\n\nexport { RadioGroup, RadioGroupItem };\n","\"use client\";\n\n/**\n * Resizable — the split-pane family, on react-resizable-panels **v4**.\n *\n * TWO FORKS COLLAPSE INTO ONE COMPONENT. matrx-frontend shipped\n * `components/ui/resizable.tsx` (38 import sites, one fixed handle width) AND\n * `components/ui/matrx/resizable.tsx` (6 sites, an eight-step `size` scale).\n * They disagreed about exactly one thing — how thick the handle is — which is\n * the C18 density-as-a-fork pattern this package exists to end. `size` is a\n * prop here; both forks die.\n *\n * v4 IS NOT v1/v2, and the differences are the reason a wrapper exists at all:\n * - the group prop is `orientation`, not `direction`;\n * - `data-panel-group-direction` is gone — the separator states\n * `aria-orientation`, and it is `vertical` in a HORIZONTAL group (it is the\n * separator's own axis, not the group's), which is why every orientation\n * selector below reads the way it does;\n * - `Group` sets `height:100%/width:100%/overflow:hidden` internally;\n * - `Panel` renders an outer flex-sizing div wrapping an inner\n * `overflow:auto` div that receives `className`/`style` — to make a panel\n * clip instead of scroll, pass `style={{ overflow: \"hidden\", height: \"100%\" }}`;\n * - numeric size props are PIXELS; percentages are strings (`\"30%\"`).\n *\n * THE DRAG OUTLINE BUG, kept fixed. The library sets `tabIndex=0` on the\n * separator, so a mouse drag FOCUSES it and the browser's default outline\n * flashes — which rendered as a near-white bar in dark mode. `focus-visible:`\n * does not suppress it (that is keyboard-only); `focus:outline-none` does, and\n * the keyboard ring is restored explicitly on `focus-visible`.\n *\n * MOUSE TOLERANCE IS AN INVISIBLE TARGET. A 2px line is not grabbable; an\n * `::after` overlay widens the hit area without widening the rule, and goes to\n * 44px on coarse pointers.\n *\n * `react-resizable-panels` is an ordinary dependency, not a peer (C23): the\n * panel geometry IS this component's product.\n */\n\nimport * as React from \"react\";\nimport { Group, Panel, Separator } from \"react-resizable-panels\";\n\nimport { cn } from \"./cn\";\nimport { DragHandleDots2Icon } from \"./icons\";\n\nexport type ResizableHandleSize =\n | \"xs\"\n | \"sm\"\n | \"md\"\n | \"lg\"\n | \"xl\"\n | \"2xl\"\n | \"3xl\"\n | \"4xl\";\n\n/**\n * The separator's own thickness. `aria-orientation=horizontal` means a\n * separator lying across a VERTICAL group, so its thickness is a height.\n */\nconst HANDLE_SIZES: Record<ResizableHandleSize, string> = {\n xs: \"w-0.5 [&[aria-orientation=horizontal]]:h-0.5 [&[aria-orientation=horizontal]]:w-full\",\n sm: \"w-1 [&[aria-orientation=horizontal]]:h-1 [&[aria-orientation=horizontal]]:w-full\",\n md: \"w-1.5 [&[aria-orientation=horizontal]]:h-1.5 [&[aria-orientation=horizontal]]:w-full\",\n lg: \"w-2 [&[aria-orientation=horizontal]]:h-2 [&[aria-orientation=horizontal]]:w-full\",\n xl: \"w-3 [&[aria-orientation=horizontal]]:h-3 [&[aria-orientation=horizontal]]:w-full\",\n \"2xl\":\n \"w-4 [&[aria-orientation=horizontal]]:h-4 [&[aria-orientation=horizontal]]:w-full\",\n \"3xl\":\n \"w-6 [&[aria-orientation=horizontal]]:h-6 [&[aria-orientation=horizontal]]:w-full\",\n \"4xl\":\n \"w-8 [&[aria-orientation=horizontal]]:h-8 [&[aria-orientation=horizontal]]:w-full\",\n};\n\nconst ResizablePanelGroup = ({\n className,\n ...props\n}: React.ComponentProps<typeof Group>) => (\n <Group\n data-slot=\"resizable-group\"\n className={cn(\"flex h-full w-full\", className)}\n {...props}\n />\n);\nResizablePanelGroup.displayName = \"ResizablePanelGroup\";\n\nconst ResizablePanel = Panel;\n\nexport interface ResizableHandleProps\n extends React.ComponentProps<typeof Separator> {\n /** Render the centered grip. */\n withHandle?: boolean;\n /** Separator thickness. Default `xs` — matrx-frontend's original 2px line. */\n size?: ResizableHandleSize;\n}\n\nconst ResizableHandle = ({\n withHandle,\n size = \"xs\",\n className,\n ...props\n}: ResizableHandleProps) => (\n <Separator\n data-slot=\"resizable-handle\"\n className={cn(\n \"group/handle relative flex shrink-0 items-center justify-center bg-border transition-colors\",\n // Invisible hit target centered on the line; wider still on touch.\n \"after:absolute after:inset-y-0 after:left-1/2 after:w-1.5 after:-translate-x-1/2 after:content-['']\",\n \"pointer-coarse:after:w-11\",\n \"[&[aria-orientation=horizontal]]:after:inset-x-0 [&[aria-orientation=horizontal]]:after:left-0 [&[aria-orientation=horizontal]]:after:top-1/2 [&[aria-orientation=horizontal]]:after:h-1.5 [&[aria-orientation=horizontal]]:after:w-full [&[aria-orientation=horizontal]]:after:-translate-x-0 [&[aria-orientation=horizontal]]:after:-translate-y-1/2\",\n \"pointer-coarse:[&[aria-orientation=horizontal]]:after:h-11\",\n // The drag-outline bug: suppress for ALL focus, restore for keyboard.\n \"focus:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1\",\n // Library-driven state feedback.\n \"data-[separator=hover]:bg-primary data-[separator=active]:bg-primary\",\n HANDLE_SIZES[size],\n \"cursor-col-resize [&[aria-orientation=horizontal]]:cursor-row-resize\",\n className,\n )}\n {...props}\n >\n {withHandle ? (\n <div className=\"z-10 flex h-8 w-4 items-center justify-center rounded-sm border bg-border group-aria-[orientation=horizontal]/handle:h-4 group-aria-[orientation=horizontal]/handle:w-8\">\n <DragHandleDots2Icon className=\"h-2.5 w-2.5 group-aria-[orientation=horizontal]/handle:rotate-90\" />\n </div>\n ) : null}\n </Separator>\n);\nResizableHandle.displayName = \"ResizableHandle\";\n\nexport { ResizableHandle, ResizablePanel, ResizablePanelGroup };\n","\"use client\";\n\n/**\n * Slider — the range control (46 host import sites).\n *\n * Ported from matrx-frontend `components/ui/slider.tsx`. Two things the host\n * copy could not do, both fixed here rather than in a fork:\n *\n * 1. A 16px THUMB IS NOT A TOUCH TARGET. The stock thumb is `h-4 w-4`, well\n * under the 44px Apple HIG minimum, so a slider that worked with a mouse\n * was a coin-flip with a thumb. The visible thumb keeps its size (`size`\n * controls it), and an invisible `::after` pseudo-target expands the hit\n * area to 44px on coarse pointers without changing the layout — the same\n * trick `ResizableHandle` uses for mouse tolerance.\n *\n * 2. DENSITY IS A PROP, NOT A FORK (C18). `size=\"sm|md|lg\"` picks the track\n * height and thumb diameter together, so a dense admin panel and a\n * touch-first settings screen use ONE component.\n *\n * Multi-thumb ranges work: a `Thumb` is rendered per value, which is what\n * Radix requires and what the host copy (a single hardcoded Thumb) got wrong\n * for any `value` array longer than one.\n */\n\nimport * as SliderPrimitive from \"@radix-ui/react-slider\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport type SliderSize = \"sm\" | \"md\" | \"lg\";\n\nconst TRACK_CLASSES: Record<SliderSize, string> = {\n sm: \"h-1\",\n md: \"h-1.5\",\n lg: \"h-2.5\",\n};\n\nconst THUMB_CLASSES: Record<SliderSize, string> = {\n sm: \"h-3.5 w-3.5\",\n md: \"h-4 w-4\",\n lg: \"h-5 w-5\",\n};\n\nexport interface SliderProps\n extends React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root> {\n /** Track + thumb scale. Default `md`. */\n size?: SliderSize;\n}\n\nconst Slider = React.forwardRef<\n React.ComponentRef<typeof SliderPrimitive.Root>,\n SliderProps\n>(({ className, size = \"md\", ...props }, ref) => {\n // One Thumb per value — controlled `value` wins, then `defaultValue`, then\n // the single-thumb default. Radix renders nothing sensible if the count is\n // wrong, which is how the host copy silently dropped a range's upper thumb.\n const thumbCount = Math.max(\n 1,\n (props.value ?? props.defaultValue ?? [0]).length,\n );\n\n return (\n <SliderPrimitive.Root\n ref={ref}\n data-slot=\"slider\"\n className={cn(\n \"relative flex w-full touch-none select-none items-center data-[disabled]:opacity-50\",\n \"data-[orientation=vertical]:h-full data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col\",\n className,\n )}\n {...props}\n >\n <SliderPrimitive.Track\n data-slot=\"slider-track\"\n className={cn(\n \"relative w-full grow overflow-hidden rounded-full bg-primary/20\",\n TRACK_CLASSES[size],\n \"data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5\",\n )}\n >\n <SliderPrimitive.Range\n data-slot=\"slider-range\"\n className=\"absolute h-full bg-primary data-[orientation=vertical]:w-full\"\n />\n </SliderPrimitive.Track>\n {Array.from({ length: thumbCount }, (_, index) => (\n <SliderPrimitive.Thumb\n key={index}\n data-slot=\"slider-thumb\"\n className={cn(\n \"relative block cursor-grab rounded-full border border-primary/50 bg-background shadow transition-colors active:cursor-grabbing\",\n \"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n // Ruling 1 — invisible 44px target, coarse pointers only, so a\n // dense desktop row keeps its exact hit behaviour.\n \"after:absolute after:left-1/2 after:top-1/2 after:-translate-x-1/2 after:-translate-y-1/2 after:content-['']\",\n \"pointer-coarse:after:h-11 pointer-coarse:after:w-11\",\n THUMB_CLASSES[size],\n )}\n />\n ))}\n </SliderPrimitive.Root>\n );\n});\nSlider.displayName = SliderPrimitive.Root.displayName;\n\nexport { Slider };\n","\"use client\";\n\n/**\n * Toggle / ToggleGroup — the pressed-state control and its exclusive or\n * multiple group (10 host import sites between them).\n *\n * Ported from matrx-frontend `components/ui/toggle.tsx` +\n * `components/ui/toggle-group.tsx`. They ship as ONE module because\n * `ToggleGroupItem` reads `toggleVariants` and the group's variant CONTEXT:\n * the two host files were a circular pair held together by an import, and a\n * host copy of a React context is the quiet twin this package has already been\n * bitten by (`useContext` matches by object identity, so two look-alike\n * contexts silently never see each other). One module, one context.\n *\n * `Toggle` is NOT `Switch`. A Switch states a setting (\"notifications: on\")\n * and applies immediately; a Toggle is a pressed button in a toolbar (\"bold\").\n * Reach for `SegmentedControl` when the choice is between labelled options\n * rather than on/off.\n *\n * Density is `size=\"sm|default|lg\"`, declared on the group and inherited by\n * every item, so a toolbar cannot mix button heights.\n */\n\nimport * as ToggleGroupPrimitive from \"@radix-ui/react-toggle-group\";\nimport * as TogglePrimitive from \"@radix-ui/react-toggle\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nconst toggleVariants = cva(\n \"inline-flex cursor-pointer items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n {\n variants: {\n variant: {\n default: \"bg-transparent\",\n outline:\n \"border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground\",\n },\n size: {\n default: \"h-9 min-w-9 px-3\",\n sm: \"h-8 min-w-8 px-2\",\n lg: \"h-10 min-w-10 px-3\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nexport interface ToggleProps\n extends React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root>,\n VariantProps<typeof toggleVariants> {}\n\nconst Toggle = React.forwardRef<\n React.ComponentRef<typeof TogglePrimitive.Root>,\n ToggleProps\n>(({ className, variant, size, ...props }, ref) => (\n <TogglePrimitive.Root\n ref={ref}\n data-slot=\"toggle\"\n className={cn(toggleVariants({ variant, size }), className)}\n {...props}\n />\n));\nToggle.displayName = TogglePrimitive.Root.displayName;\n\nconst ToggleGroupContext = React.createContext<\n VariantProps<typeof toggleVariants>\n>({ size: \"default\", variant: \"default\" });\n\nexport type ToggleGroupProps = React.ComponentPropsWithoutRef<\n typeof ToggleGroupPrimitive.Root\n> &\n VariantProps<typeof toggleVariants>;\n\nconst ToggleGroup = React.forwardRef<\n React.ComponentRef<typeof ToggleGroupPrimitive.Root>,\n ToggleGroupProps\n>(({ className, variant, size, children, ...props }, ref) => (\n <ToggleGroupPrimitive.Root\n ref={ref}\n data-slot=\"toggle-group\"\n className={cn(\"flex items-center justify-center gap-1\", className)}\n {...props}\n >\n <ToggleGroupContext.Provider value={{ variant, size }}>\n {children}\n </ToggleGroupContext.Provider>\n </ToggleGroupPrimitive.Root>\n));\nToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;\n\nexport interface ToggleGroupItemProps\n extends React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item>,\n VariantProps<typeof toggleVariants> {}\n\nconst ToggleGroupItem = React.forwardRef<\n React.ComponentRef<typeof ToggleGroupPrimitive.Item>,\n ToggleGroupItemProps\n>(({ className, children, variant, size, ...props }, ref) => {\n const context = React.useContext(ToggleGroupContext);\n return (\n <ToggleGroupPrimitive.Item\n ref={ref}\n data-slot=\"toggle-group-item\"\n className={cn(\n toggleVariants({\n variant: context.variant ?? variant,\n size: context.size ?? size,\n }),\n className,\n )}\n {...props}\n >\n {children}\n </ToggleGroupPrimitive.Item>\n );\n});\nToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;\n\nexport { Toggle, ToggleGroup, ToggleGroupItem, toggleVariants };\n","\"use client\";\n\n/**\n * Tooltip — the ONE tooltip in the fleet.\n *\n * THE COLLAPSE (0.6.0). Two implementations existed: matrx-frontend's\n * `components/ui/tooltip.tsx` (182 import sites) and `@ai-matrx/tap-target`'s\n * `src/tooltip.tsx` — the latter an explicit inlined PORT of the former,\n * carrying a header that said so. tap-target shipped it only because its ~60\n * tap buttons need a tooltip and no shared package owned one; four repos then\n * adopted `TooltipProvider` from tap-target. That made tap-target — a\n * button-geometry package — the accidental owner of a design-system primitive,\n * with a second copy living in the biggest host.\n *\n * A tooltip is a design-system surface, so it lives here. tap-target now takes\n * `@ai-matrx/design-system` as an ordinary sibling dependency and imports this\n * file; its own copy is deleted, and its re-export removed. The DAG already\n * ordered design-system before tap-target, so no cycle is introduced.\n *\n * BEHAVIOUR is matrx-frontend's, verbatim, including the ruling both copies\n * carried in prose:\n *\n * 1. THE ROOT RENDERS UNCONDITIONALLY — no hydration mount gate. The gate the\n * host wrapper once carried (\"Radix generates dynamic aria-controls ids that\n * differ between SSR and client\") was false: Radix ids come from React's\n * SSR-stable `useId`. It was actively harmful — a Trigger wraps\n * ALWAYS-VISIBLE content, so `return null` deleted that subtree from SSR and\n * the first client paint.\n *\n * 2. THE SURFACE IS NEUTRAL, NOT BRANDED. Popover tokens, not `bg-primary`:\n * rich tooltip content using `text-muted-foreground` was illegible on a\n * brand-coloured background in one theme or the other.\n *\n * SEAM INVERSION. The host resolved nested portal targets through\n * `useNestedPortalContainer` (an app hook wired to its dialog + window-panel\n * systems); tap-target's port dropped that seam entirely and always portalled\n * to `document.body` — which is why a tooltip inside a popped-out panel landed\n * in the wrong window. Here it is the package's `PortalContainerProvider`\n * seam: an explicit `container` prop wins, then the injected container, then\n * `document.body`. Both prior behaviours are reachable; neither is forked.\n */\n\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { MOTION_POPPER } from \"./motion\";\nimport { usePortalContainer } from \"./portal-container\";\n\n/**\n * Mount once near the app root. Every tooltip in the tree shares its\n * `delayDuration` / `skipDelayDuration` timing.\n */\nconst TooltipProvider = TooltipPrimitive.Provider;\n\nconst Tooltip = TooltipPrimitive.Root;\n\nconst TooltipTrigger = TooltipPrimitive.Trigger;\n\nexport interface TooltipContentProps\n extends React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> {\n /**\n * Explicit portal target; wins over the injected `PortalContainerProvider`\n * value. Pass `null` to force `document.body`.\n */\n container?: HTMLElement | null;\n /**\n * Package-owned open/close motion. Default `true`. Pass `false` for a\n * surface that must appear instantly. It is NOT the reduced-motion switch;\n * `styles.css` already honours `prefers-reduced-motion`.\n */\n animated?: boolean;\n}\n\nconst TooltipContent = React.forwardRef<\n React.ComponentRef<typeof TooltipPrimitive.Content>,\n TooltipContentProps\n>(({ className, sideOffset = 4, container, animated = true, ...props }, ref) => {\n const resolved = usePortalContainer(container);\n return (\n <TooltipPrimitive.Portal container={resolved ?? null}>\n <TooltipPrimitive.Content\n ref={ref}\n data-slot=\"tooltip-content\"\n sideOffset={sideOffset}\n className={cn(\n \"z-[10001] overflow-hidden rounded-md border border-border bg-popover px-3 py-1.5 text-xs text-popover-foreground shadow-md\",\n animated && MOTION_POPPER,\n className,\n )}\n {...props}\n />\n </TooltipPrimitive.Portal>\n );\n});\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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AC,uBAAA;AA5BN,IAAM,kBAAmC;AAEzC,IAAM,UAA2B;AAEjC,IAAM,iBAAkC;AAiBxC,IAAM,iBAAuB,mBAG3B,CAAC,EAAE,WAAW,aAAa,GAAG,WAAW,WAAW,MAAM,GAAG,MAAM,GAAG,QAAQ;AAC9E,QAAM,WAAW,mBAAmB,SAAS;AAC7C,SACE,8CAAkB,yBAAjB,EAAwB,WAAW,YAAY,MAC9C;AAAA,IAAkB;AAAA,IAAjB;AAAA,MACC;AAAA,MACA,aAAU;AAAA,MACV;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA,YAAY;AAAA,QACZ;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN,GACF;AAEJ,CAAC;AACD,eAAe,cAA+B,yBAAQ;","names":["CollapsibleContent","CollapsibleTrigger","Label","RadioGroup","Separator","import_jsx_runtime","import_jsx_runtime","import_vaul","React","React","import_jsx_runtime","import_jsx_runtime","DrawerPrimitive","import_jsx_runtime","DrawerPrimitive","import_class_variance_authority","React","import_jsx_runtime","import_react_tree","React","import_class_variance_authority","React","import_jsx_runtime","React","import_jsx_runtime","import_jsx_runtime","React","import_jsx_runtime","React","import_jsx_runtime","React","import_jsx_runtime","React","import_jsx_runtime","CollapsibleTrigger","CollapsibleContent","React","React","import_jsx_runtime","CommandPrimitive","import_jsx_runtime","React","import_jsx_runtime","React","import_jsx_runtime","React","import_jsx_runtime","import_jsx_runtime","Icon","DialogPrimitive","VisuallyHidden","import_react_tree","React","import_jsx_runtime","DIALOG_DESKTOP_CLASSES","DIALOG_MOBILE_SHEET_CLASSES","DIALOG_MOBILE_SHEET_OVERRIDE","React","import_jsx_runtime","import_react","import_jsx_runtime","result","React","import_jsx_runtime","React","import_jsx_runtime","Label","import_react","import_jsx_runtime","Icon","React","import_jsx_runtime","React","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_class_variance_authority","React","import_jsx_runtime","React","import_jsx_runtime","Separator","import_react_tree","import_class_variance_authority","React","import_jsx_runtime","import_jsx_runtime","React","import_jsx_runtime","import_react","import_jsx_runtime","Icon","React","import_jsx_runtime","React","import_jsx_runtime","React","import_jsx_runtime","import_react","React","import_jsx_runtime","React","import_jsx_runtime","RadioGroup","import_jsx_runtime","React","import_jsx_runtime","import_class_variance_authority","React","import_jsx_runtime","React","import_jsx_runtime"]}