@ai-matrx/design-system 0.55.1 → 0.56.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/data-table/index.cjs +2 -1
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.js +2 -1
- package/dist/data-table/index.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/styles.css +46 -27
- package/dist/tokens.css +19 -5
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/accordion.tsx","../src/cn.ts","../src/icons.tsx","../src/badge.tsx","../src/bottom-sheet.tsx","../src/drawer.tsx","../src/floating-layer.tsx","../src/radix-dialog-modal-context.tsx","../src/alert.tsx","../src/error-box.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/menu-scroll-edges.tsx","../src/use-scroll-fade.ts","../src/submenu-focus.ts","../src/select.tsx","../src/field-surface.ts","../src/creatable-picker.tsx","../src/popover.tsx","../src/dialog.tsx","../src/layer-front.ts","../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/archive-filter.tsx","../src/archived-disclosure.tsx","../src/separator.tsx","../src/sheet.tsx","../src/organization-picker.tsx","../src/skeleton.tsx","../src/sidebar.tsx","../src/tooltip.tsx","../src/title-tooltips.ts","../src/app-shell/app-rail.tsx","../src/app-shell/status-dot.tsx","../src/app-shell/canvas.tsx","../src/resizable.tsx","../src/app-shell/mode-switch.tsx","../src/switch.tsx","../src/tabbed-bottom-sheet.tsx","../src/table.tsx","../src/tabs.tsx","../src/textarea.tsx","../src/hover-card.tsx","../src/radio-group.tsx","../src/slider.tsx","../src/toggle.tsx","../src/tap-target/tap-target-button.tsx","../src/tap-target/cn.ts","../src/tap-target/tap-target-guard.ts","../src/tap-target/tap-features.tsx","../src/tap-target/link.ts","../src/tap-target/tap-target-labeled.tsx","../src/tap-target/tap-target-copy.tsx","../src/tap-target/tap-target-search.tsx"],"sourcesContent":["\"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/**\n * lucide `loader-2` — the spinner glyph. Callers add `matrx-spin`.\n * Never a resting icon: at rest this incomplete arc reads as a broken\n * half-circle. Refresh controls use arrows, then swap to this only while busy.\n */\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 `chevron-down` — the disclosure's open glyph. */\nexport function ChevronDownIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n );\n}\n\n/** lucide `archive` — the archived-rows glyph (ArchivedDisclosure). */\nexport function ArchiveIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <rect width=\"20\" height=\"5\" x=\"2\" y=\"3\" rx=\"1\" />\n <path d=\"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8\" />\n <path d=\"M10 12h4\" />\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 `pencil` — the edit glyph (the table card's Edit action). */\nexport function PencilIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z\" />\n <path d=\"m15 5 4 4\" />\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\n/** lucide `star` — the default-organization badge (OrganizationPicker). */\nexport function StarIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z\" />\n </svg>\n );\n}\n\n/** lucide `building-2` — the organization glyph (OrganizationPicker trigger). */\nexport function Building2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z\" />\n <path d=\"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2\" />\n <path d=\"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2\" />\n <path d=\"M10 6h4\" />\n <path d=\"M10 10h4\" />\n <path d=\"M10 14h4\" />\n <path d=\"M10 18h4\" />\n </svg>\n );\n}\n\n/** lucide `panel-left` — the sidebar toggle glyph. */\nexport function PanelLeftIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M9 3v18\" />\n </svg>\n );\n}\n\n/** lucide `ellipsis-vertical` — a panel's \"more\" menu. */\nexport function MoreVerticalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n <circle cx=\"12\" cy=\"5\" r=\"1\" />\n <circle cx=\"12\" cy=\"19\" r=\"1\" />\n </svg>\n );\n}\n\n/** lucide `maximize-2` — expand a panel. */\nexport function Maximize2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M15 3h6v6\" />\n <path d=\"m21 3-7 7\" />\n <path d=\"m3 21 7-7\" />\n <path d=\"M9 21H3v-6\" />\n </svg>\n );\n}\n\n/** lucide `minimize-2` — restore an expanded panel. */\nexport function Minimize2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"m14 10 7-7\" />\n <path d=\"M20 10h-6V4\" />\n <path d=\"m3 21 7-7\" />\n <path d=\"M4 14h6v6\" />\n </svg>\n );\n}\n\n/** lucide `arrow-left`. */\nexport function ArrowLeftIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"m12 19-7-7 7-7\" />\n <path d=\"M19 12H5\" />\n </svg>\n );\n}\n\n/** lucide `arrow-right`. */\nexport function ArrowRightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M5 12h14\" />\n <path d=\"m12 5 7 7-7 7\" />\n </svg>\n );\n}\n\n/** lucide `rotate-cw` — reload. */\nexport function RotateCwIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8\" />\n <path d=\"M21 3v5h-5\" />\n </svg>\n );\n}\n\n/** lucide `globe` — a web page with no favicon. */\nexport function GlobeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20\" />\n <path d=\"M2 12h20\" />\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 data-slot=\"badge\" 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, up to\n * 90dvh (no minimum). 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 {/* The dialog layer (z-[10000], see dialog.tsx), never below it: a\n sheet opened from inside a dialog or modal (the phone's ⋯ menu in\n a compact chat modal) otherwise opens BEHIND that dialog's scrim.\n Equal z, so the later-opened layer paints on top. */}\n <DrawerPrimitive.Overlay\n className={cn(\"fixed inset-0 z-[10000] bg-[var(--matrx-overlay-scrim)]\", \"fixed inset-0 z-[10000]\")}\n style={{ background: \"var(--matrx-overlay-scrim-drawer)\" }}\n />\n <DrawerContentPrimitive\n className={cn(\n \"fixed inset-x-0 bottom-0 z-[10000] mt-24 flex flex-col rounded-t-2xl overflow-hidden\",\n // Adaptive sizes to its content, up to 90dvh — never a 60dvh floor that\n // left a two-action sheet mostly empty (hosts overrode it with min-h-0).\n size === \"full\" ? \"h-[92dvh]\" : \"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 data-slot=\"bottom-sheet-footer\"\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 { keepFloatingLayersInside, useModalLayer } from \"./floating-layer\";\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 onOpenChange,\n ...props\n}: DrawerProps) => {\n const direction: DrawerDirection = props.direction ?? \"bottom\";\n const handleOpenChange = (open: boolean) => {\n if (\n open &&\n typeof document !== \"undefined\" &&\n document.activeElement instanceof HTMLElement\n ) {\n // Vaul applies aria-hidden to the application tree synchronously, before\n // Radix transfers focus into the portalled dialog. Release the trigger\n // first so a focused descendant is never hidden from assistive tech.\n document.activeElement.blur();\n }\n onOpenChange?.(open);\n };\n return (\n <RadixDialogModalProvider modal>\n <DrawerDirectionContext.Provider value={direction}>\n <DrawerPrimitive.Root\n modal\n shouldScaleBackground={shouldScaleBackground}\n {...props}\n onOpenChange={handleOpenChange}\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>(({ onInteractOutside, ...props }, ref) => {\n // A drawer is always modal: floating layers opened from it stack above its\n // scrim, and a press inside one is not an outside press (floating-layer.tsx).\n useModalLayer(true);\n return (\n <DrawerPrimitive.Content\n // NO SLIDE-IN (styles.css, `[data-matrx-entrance=\"none\"]`). Measured on\n // a 375x812 phone (PB-08, 2026-10-01): for ~250 ms after open the spot\n // where a row settles was still the SCRIM, so a tap there was an outside\n // press and closed the sheet; for the next ~150 ms it was a DIFFERENT\n // row. The sheet is therefore at rest from its first frame; the scrim\n // still fades and the exit still slides. Same class as the composer\n // menu's popper entrance (matrx-frontend 286ef577fb).\n data-matrx-entrance=\"none\"\n {...props}\n ref={ref}\n aria-modal=\"true\"\n onInteractOutside={keepFloatingLayersInside(onInteractOutside)}\n />\n );\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 * FLOATING LAYERS OPENED FROM INSIDE A MODAL — one contract, every surface.\n *\n * A blocking surface (a `modal` Dialog, AlertDialog, Sheet, Drawer,\n * BottomSheet, CommandDialog — and every Dialog on a phone) paints a scrim at\n * the modal tier, `MODAL_LAYER_Z`. Radix children of that surface (Popover,\n * Select, menus) are safe: they portal into it or after it at the same z, and\n * Radix counts a press inside them as inside. A floating layer that is NOT a\n * Radix child — a host window manager's window, the associations picker\n * window, anything `createPortal`ed to `<body>` at its own z — was not: it\n * painted UNDER the scrim (a window manager lives near z-1000), so the click\n * that picked an option landed on the scrim and closed the modal (Source\n * screen side sheet + association picker, 2026-09-26). Behind the scrim it\n * would also have lost focus to the modal's trap and had presses inside it\n * counted as outside-clicks.\n *\n * The contract, in three parts:\n *\n * 1. Every modal content registers while it is open (`useModalLayer`), and\n * treats a press or focus inside any `[data-matrx-floating-layer]` as\n * inside (`keepFloatingLayersInside`).\n * 2. A floating layer reads `useFloatingLayerZIndex(ownZ)`: while a modal is\n * open it is lifted to the modal tier. Equal z, so DOM order decides — a\n * layer opened AFTER the modal (portal appended later) paints above its\n * scrim; a window that was already open stays underneath, as it should.\n * While lifted, several floating layers order by when they opened, not by\n * their own manager's focus order; that returns when the modal closes.\n * 3. A floating layer's root is wrapped in `<FloatingLayer>`: it carries the\n * marker attribute, re-asserts `pointer-events: auto` (a modal sets `none`\n * on `<body>`), and mounts a non-trapping focus scope, which pauses the\n * modal's focus trap while the layer is open so its inputs take focus.\n *\n * 4. Popper content (a Popover, a combobox) a floating layer opens is portaled\n * to <body>; while a floating layer is open it counts as part of it, and\n * wheel/touchmove inside either stops at <body> so the modal's scroll lock\n * never cancels it.\n *\n * Guard: `floating-layer.test.tsx` — a window-manager-style layer opened from\n * each blocking surface must stack above the scrim, keep the modal open when\n * it or a popover it opened is pressed, scroll, keep focus in its own input,\n * and hand focus back to its opener when it closes.\n */\n\nimport { FocusScope } from \"@radix-ui/react-focus-scope\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport * as React from \"react\";\n\n/** The modal tier: every blocking scrim and its content sit here. */\nexport const MODAL_LAYER_Z = 10000;\n\n/** Marker attribute on the root of a floating layer. */\nexport const FLOATING_LAYER_ATTR = \"data-matrx-floating-layer\";\n\n// ── the open-modal registry ─────────────────────────────────────────────────\n// Shared identity across independently bundled public entrypoints, like the\n// dialog contexts: two copies of this module must see one count.\ninterface ModalLayerRegistry {\n count: number;\n listeners: Set<() => void>;\n}\nconst REGISTRY_SLOT = Symbol.for(\"ai-matrx.design-system.modal-layer-registry\");\nconst registryHost = globalThis as typeof globalThis & {\n [REGISTRY_SLOT]?: ModalLayerRegistry;\n};\nconst registry: ModalLayerRegistry = (registryHost[REGISTRY_SLOT] ??= {\n count: 0,\n listeners: new Set(),\n});\n\nfunction emit(): void {\n for (const listener of registry.listeners) listener();\n}\n\n// A modal's scroll lock (react-remove-scroll) cancels wheel and touchmove on\n// `document` for anything outside the modal's own content — including a\n// floating layer opened from it, whose list then never scrolls. While a modal\n// is open, a scroll gesture inside a floating layer stops at <body>: React's\n// own portal listener on <body> still sees it (stopPropagation never stops\n// listeners on the same node), the lock on `document` never does.\nconst SCROLL_EVENTS = [\"wheel\", \"touchmove\"] as const;\nfunction stopAtBody(event: Event): void {\n if (isInsideFloatingLayer(event.target)) event.stopPropagation();\n}\nfunction setScrollPassthrough(on: boolean): void {\n if (typeof document === \"undefined\" || !document.body) return;\n for (const type of SCROLL_EVENTS) {\n if (on) document.body.addEventListener(type, stopAtBody, { passive: true });\n else document.body.removeEventListener(type, stopAtBody);\n }\n}\n\n/** Register one open modal layer; returns its release. */\nexport function registerModalLayer(): () => void {\n registry.count += 1;\n if (registry.count === 1) setScrollPassthrough(true);\n emit();\n let released = false;\n return () => {\n if (released) return;\n released = true;\n registry.count = Math.max(0, registry.count - 1);\n if (registry.count === 0) setScrollPassthrough(false);\n emit();\n };\n}\n\n/** True while at least one blocking surface is open. */\nexport function isModalLayerOpen(): boolean {\n return registry.count > 0;\n}\n\nfunction subscribe(listener: () => void): () => void {\n registry.listeners.add(listener);\n return () => registry.listeners.delete(listener);\n}\n\n/** Reactive `isModalLayerOpen()`. */\nexport function useModalLayerOpen(): boolean {\n return React.useSyncExternalStore(subscribe, isModalLayerOpen, () => false);\n}\n\n/**\n * Called by every modal content while it is mounted. `active` is false for a\n * content whose root is not modal (a windowed dialog, a `modal={false}` sheet).\n */\nexport function useModalLayer(active: boolean): void {\n React.useLayoutEffect(() => (active ? registerModalLayer() : undefined), [active]);\n}\n\n// ── the outside-click guard ─────────────────────────────────────────────────\n\nconst POPPER_WRAPPER = \"[data-radix-popper-content-wrapper]\";\n\n/**\n * True when `target` is inside a floating layer — or inside popper content (a\n * Popover, a combobox list) while a floating layer is open. Popper content a\n * window opens is portaled to <body>, outside the window's own element and\n * outside the modal's React tree; popper content the MODAL opens is portaled\n * into the modal and never reaches this check.\n */\nexport function isInsideFloatingLayer(target: EventTarget | null | undefined): boolean {\n if (!(target instanceof Element)) return false;\n if (target.closest(`[${FLOATING_LAYER_ATTR}]`)) return true;\n return (\n target.closest(POPPER_WRAPPER) !== null &&\n target.ownerDocument.querySelector(`[${FLOATING_LAYER_ATTR}]`) !== null\n );\n}\n\n/**\n * Wrap a Radix `onInteractOutside` so a press or focus inside a floating layer\n * never dismisses the modal. The caller's handler still runs first.\n */\nexport function keepFloatingLayersInside<\n E extends { target: EventTarget | null; preventDefault: () => void },\n>(handler?: (event: E) => void): (event: E) => void {\n return (event) => {\n handler?.(event);\n if (isInsideFloatingLayer(event.target)) event.preventDefault();\n };\n}\n\n// ── the floating layer's side ───────────────────────────────────────────────\n\n/** Pure form of `useFloatingLayerZIndex`, for callers outside React. */\nexport function floatingLayerZIndex(ownZ: number, modalOpen: boolean): number {\n return modalOpen ? Math.max(ownZ, MODAL_LAYER_Z) : ownZ;\n}\n\n/** The z-index a floating layer should paint at, given its own. */\nexport function useFloatingLayerZIndex(ownZ: number): number {\n return floatingLayerZIndex(ownZ, useModalLayerOpen());\n}\n\nconst preventAutoFocus = (event: Event) => event.preventDefault();\n\n/**\n * Wrap the root element of a floating layer (exactly one element child).\n * Marks it, keeps it pressable under a modal's `pointer-events: none` body,\n * and pauses the modal's focus trap while it is mounted. It never takes focus\n * on open. On close, if focus was lost with it while a modal is still open,\n * focus returns to the control that opened it — otherwise the next Tab would\n * land behind the modal.\n */\nexport const FloatingLayer = React.forwardRef<\n HTMLElement,\n { children: React.ReactElement }\n>(({ children }, ref) => {\n const [opener] = React.useState<Element | null>(() =>\n typeof document === \"undefined\" ? null : document.activeElement,\n );\n const returnFocus = (event: Event) => {\n event.preventDefault();\n const active = document.activeElement;\n const lost = !active || active === document.body || !active.isConnected;\n if (lost && isModalLayerOpen() && opener instanceof HTMLElement && opener.isConnected) {\n opener.focus({ preventScroll: true });\n }\n };\n return (\n <FocusScope\n asChild\n trapped={false}\n loop={false}\n onMountAutoFocus={preventAutoFocus}\n onUnmountAutoFocus={returnFocus}\n >\n <Slot\n ref={ref}\n {...{ [FLOATING_LAYER_ATTR]: \"\" }}\n style={{ pointerEvents: \"auto\" }}\n >\n {children}\n </Slot>\n </FocusScope>\n );\n});\nFloatingLayer.displayName = \"FloatingLayer\";\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\n// Shared identity across independently bundled public entrypoints/loaders.\nconst CONTEXT_SLOT = Symbol.for(\"ai-matrx.design-system.dialog-modal-context\");\nconst contextRegistry = globalThis as typeof globalThis & { [CONTEXT_SLOT]?: React.Context<boolean> };\nconst RadixDialogModalContext = contextRegistry[CONTEXT_SLOT] ??= React.createContext<boolean>(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\";\nimport { ErrorActions, type ErrorActionsInput } from \"./error-box\";\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 /**\n * The error's facts for the host's error actions (destructive only): the raw\n * error, the operation, the records. Without it the host reads the words\n * from the rendered Alert.\n */\n errorFacts?: ErrorActionsInput | undefined;\n}\n\nconst Alert = React.forwardRef<HTMLDivElement, AlertProps>(\n ({ className, variant, children, errorFacts, ...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 {children}\n {/* A destructive Alert is an error on screen: the host's error actions\n (ErrorActionsProvider) ride it. The words are the Alert's own, so the\n host reads them from the rendered box. */}\n {variant === \"destructive\" ? (\n <ErrorActions origin=\"design-system/Alert\" {...errorFacts} />\n ) : null}\n </div>\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","/**\n * ErrorBox — THE one way a package draws an error on screen, and the seam a\n * host uses to put its own actions on every one of them.\n *\n * Every error sentence this package (and every sibling package that depends\n * on it) shows is an `ErrorBox`. The box is a plain `role=\"alert\"` element —\n * its tag and classes are the caller's, so nothing about the look changes — and\n * after its children it renders whatever the host's `ErrorActionsProvider`\n * returns for that error. With no provider it renders nothing extra.\n *\n * Why a slot and not a menu: the package cannot know the host's AI copy, bug\n * report, or support flow (Matrx fills it with its Alchemy copy-for-AI menu at\n * the app root). The package supplies the error's facts — the sentence, the\n * raw error, the operation, the records — and the host decides the actions.\n *\n * Guard: `error-box.census.test.ts` fails when a package file renders\n * `role=\"alert\"` for an error without going through `ErrorBox` (or, for the\n * `Alert` family, `ErrorActions`).\n */\nimport * as React from \"react\";\n\nexport interface ErrorActionsRecord {\n type: string;\n id: string;\n label?: string;\n}\n\n/** The facts a package knows about an error it is showing. All optional. */\nexport interface ErrorActionsInput {\n /** The sentence shown. Omit when the words are only in the rendered box. */\n message?: string;\n title?: string;\n /** The raw error (code/status/stack stay available to the host). */\n error?: unknown;\n /** What was being attempted (\"Load saved views\"). */\n operation?: string;\n records?: readonly ErrorActionsRecord[];\n /** The person's input that did not land. */\n unsavedInput?: unknown;\n /** The package + component that drew it (\"design-system/SavedViewsControl\"). */\n origin?: string;\n}\n\nexport type ErrorActionsRenderer = (input: ErrorActionsInput) => React.ReactNode;\n\n/**\n * ONE context for every copy of this module. tsup builds each entry point\n * (`.`, `./data-table`, …) without code splitting, so this file is inlined into\n * several bundles; a plain `createContext` would give each bundle its own\n * context and the host's provider (imported from `.`) would never reach an\n * error drawn by the data table. The registry key makes them one.\n */\nconst CONTEXT_KEY = Symbol.for(\"@ai-matrx/design-system/error-actions\");\ntype ContextRegistry = Record<symbol, React.Context<ErrorActionsRenderer | null> | undefined>;\nconst registry = globalThis as unknown as ContextRegistry;\nconst ErrorActionsContext: React.Context<ErrorActionsRenderer | null> =\n registry[CONTEXT_KEY] ??\n (registry[CONTEXT_KEY] = React.createContext<ErrorActionsRenderer | null>(null));\n\n/** Mount once at the host's app root; every ErrorBox below renders `render(...)`. */\nexport function ErrorActionsProvider({\n render,\n children,\n}: {\n render: ErrorActionsRenderer;\n children: React.ReactNode;\n}) {\n return (\n <ErrorActionsContext.Provider value={render}>{children}</ErrorActionsContext.Provider>\n );\n}\n\nexport function useErrorActions(): ErrorActionsRenderer | null {\n return React.useContext(ErrorActionsContext);\n}\n\n/**\n * The host's actions for one error, placed wherever the caller puts this\n * element. Renders nothing without a provider. Use inside a box you do not\n * render yourself (the `Alert` family); everything else uses `ErrorBox`.\n */\nexport function ErrorActions(props: ErrorActionsInput) {\n const render = useErrorActions();\n if (!render) return null;\n return <>{render(props)}</>;\n}\n\ntype ErrorBoxTag = \"p\" | \"div\" | \"span\" | \"section\" | \"li\";\n\nexport interface ErrorBoxProps\n extends Omit<React.HTMLAttributes<HTMLElement>, \"role\" | \"title\">,\n ErrorActionsInput {\n /** The element drawn — the caller's existing tag, so layout never shifts. */\n as?: ErrorBoxTag;\n}\n\nexport const ErrorBox = React.forwardRef<HTMLElement, ErrorBoxProps>(function ErrorBox(\n {\n as = \"p\",\n message,\n title,\n error,\n operation,\n records,\n unsavedInput,\n origin,\n children,\n ...rest\n },\n ref,\n) {\n const Tag = as as React.ElementType;\n const facts: ErrorActionsInput = {\n ...(message !== undefined ? { message } : {}),\n ...(title !== undefined ? { title } : {}),\n ...(error !== undefined ? { error } : {}),\n ...(operation !== undefined ? { operation } : {}),\n ...(records !== undefined ? { records } : {}),\n ...(unsavedInput !== undefined ? { unsavedInput } : {}),\n ...(origin !== undefined ? { origin } : {}),\n };\n return (\n <Tag ref={ref} role=\"alert\" data-error-box=\"\" {...rest}>\n {children ?? message}\n <ErrorActions {...facts} />\n </Tag>\n );\n});\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` hands its bottom padding to the footer), which\n * 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 { useModalLayer } from \"./floating-layer\";\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 // Always blocking: floating layers opened from it stack above its scrim.\n useModalLayer(true);\n return <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.\n //\n // 🚨 THERE IS NO `mb-[…]` HERE, AND THERE MUST NEVER BE ONE AGAIN\n // (0.11.3, feedback bf8fb00b). The bleed over the card's bottom padding\n // used to be a NEGATIVE BLOCK MARGIN, which makes this box taller than\n // the grid area the card allocates it — and `position: sticky` CLAMPS a\n // box to its containing block, so the browser yanked the footer UP by\n // `--dialog-pad` against the card's `gap-4` and painted 8px of opaque\n // footer over the last line of the consequence, at every length. The\n // card now RESERVES this footer's block size instead (`matrx-dialog-card`\n // in styles.css hands over its `padding-bottom`), so the bleed costs no\n // margin at all. Guard: `sticky-footer-geometry.test.tsx`.\n //\n // These stay UTILITIES rather than a shipped rule so a caller's\n // `className` still wins through tailwind-merge — a shipped rule would\n // have to be unlayered to survive Tailwind preflight (§ THE PREFLIGHT\n // RULE in styles.css) and would then override every caller's padding.\n \"sticky bottom-0 z-10 bg-background pt-3\",\n \"mx-[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\n/**\n * THE TOUCH FLOOR (2026-09-17).\n *\n * Every rung of the size scale below `xl` is shorter than the 44px platform\n * touch target: `xs` 24, `icon-sm` 28, `sm` 32, `roundIcon` 32, `default`/`md`\n * 36, `icon` 36, `lg` 40. Measured live at 390x844 on `/masterwork/<id>`, ALL\n * SEVEN design-system Buttons in the viewport were under the floor (four at\n * 32px, two at 28px).\n *\n * The floor is raised in CSS, under `@media (pointer: coarse)` ONLY, so DESKTOP\n * DENSITY IS UNTOUCHED — a narrow desktop window is not a finger, which is why\n * this rule deliberately does NOT carry the `(max-width: 1023px)` half that the\n * dialog-footer floor in `styles.css` uses.\n *\n * WHY EVERY SUB-44 RUNG AND NOT JUST `sm`: a floor applied to one rung inverts\n * the scale. Lift `sm` (32) alone and it renders TALLER on a phone than\n * `default` (36) and `lg` (40) — the scale would stop being a scale. A floor is\n * only coherent applied to everything beneath it.\n *\n * The mechanism is `min-height`/`min-width`, not an invisible 44px hit ring\n * over a 32px pill. A ring is the tap-target package's pattern and it is right\n * THERE (isolated glass buttons), but on a toolbar of adjacent `sm` buttons\n * separated by an 8px gap the rings overlap in the gap and one button silently\n * eats taps aimed at its neighbour — unacceptable where a neighbour is\n * destructive. `lib/entity-list`'s own phone contract (`h-11 min-w-11`) already\n * chose growth for the same reason; this is that choice made once, in the\n * primitive, instead of per surface.\n *\n * `min-width` is raised only on the SQUARE rungs (`icon`, `icon-sm`,\n * `roundIcon`) — a text button is already wider than 44px, and forcing a floor\n * on it would stretch short labels.\n *\n * Opt out on a control that is genuinely not a finger target with\n * `data-touch-exempt` (same escape hatch the footer floor honours), and say why\n * at the call site.\n */\nconst TOUCH_FLOOR_SIZES = new Set([\n \"xs\",\n \"sm\",\n \"default\",\n \"md\",\n \"lg\",\n \"icon\",\n \"icon-sm\",\n \"roundIcon\",\n]);\nconst SQUARE_SIZES = new Set([\"icon\", \"icon-sm\", \"roundIcon\"]);\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 const resolvedSize = size ?? \"default\";\n return (\n <Component\n className={cn(buttonVariants({ variant, size, className }))}\n data-matrx-button=\"\"\n data-tap-floor={TOUCH_FLOOR_SIZES.has(resolvedSize) ? \"\" : undefined}\n data-tap-floor-square={\n SQUARE_SIZES.has(resolvedSize) ? \"\" : undefined\n }\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\n// Shared identity across independently bundled public entrypoints/loaders.\nconst CONTEXT_SLOT = Symbol.for(\"ai-matrx.design-system.portal-container-context\");\nconst contextRegistry = globalThis as typeof globalThis & { [CONTEXT_SLOT]?: React.Context<HTMLElement | null | undefined> };\nconst PortalContainerContext = contextRegistry[CONTEXT_SLOT] ??= React.createContext<HTMLElement | null | undefined>(undefined);\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 { keepFloatingLayersInside, useModalLayer } from \"./floating-layer\";\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, onInteractOutside, ...props }, ref) => {\n const isMobile = useIsMobile();\n const isModal = useRadixDialogModal();\n useModalLayer(isModal);\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 onInteractOutside={keepFloatingLayersInside(onInteractOutside)}\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","/**\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 * The body lives in `@ai-matrx/kit/media-query` (chat-package independence\n * P12, 2026-10-01): the app's `hooks/use-mobile` and this package each carried\n * their own copy, and two breakpoint hooks is exactly the duplication this\n * package exists to end. Kit's reads through `useSyncExternalStore` — `false`\n * on the server and during hydration, so the desktop geometry hydrates — and\n * never throws where `matchMedia` is absent.\n */\nexport { MOBILE_BREAKPOINT, useIsMobile } from \"@ai-matrx/kit/media-query\";\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. Use it for\n * supplementary or interactive content that is not part of the dialog's\n * accessible consequence 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 * The question is not answerable yet — Confirm is ABSENT, not disabled (a\n * control is absent or honest, never dead). The body carries its own loading\n * state; Cancel stays. Set by `ConfirmDialogHost` while `ConfirmOptions.ready`\n * is pending (0.54.0).\n */\n confirmHeld?: 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 confirmHeld = 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 asChild>\n <div>{description}</div>\n </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 {confirmHeld ? null : (\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 )}\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 the opener's\n * queue; `useOpenerHost` (`@ai-matrx/kit/opener-react`) drains it one at a time\n * and this component renders a `<ConfirmDialog>` 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 { confirmOpener } from \"@ai-matrx/kit/confirm-opener\";\nimport { useOpenerHost } from \"@ai-matrx/kit/opener-react\";\nimport * as React from \"react\";\n\nimport { ConfirmDialog } from \"./confirm-dialog\";\n\nexport function ConfirmDialogHost() {\n // The registration, the ref-backed queue, the drain effect and the\n // settle-once callback are ALL `useOpenerHost` (kit 0.10.0). They used to be\n // written out here — and identically in three matrx-frontend dialog hosts,\n // which is exactly the duplication the opener primitive ends. What is left\n // below is the only part that was ever this package's: the dialog body.\n // `shown`, not `request`: the dialog animates out AFTER it is answered, and\n // `request` is already null by then — the body used to fade out empty\n // (reviewer, 2026-10-02). `shown` keeps the answered words until the next\n // question replaces them.\n const { shown, open, settle } = useOpenerHost(confirmOpener);\n\n // `ready` (kit 0.22.0): Confirm is held until the question can say what it\n // will do. Settling either way releases it — a failed read never traps the\n // person. Keyed by the request object, so the next question starts held.\n const [readyFor, setReadyFor] = React.useState<object | null>(null);\n const ready = shown?.ready;\n React.useEffect(() => {\n if (!shown || !ready) return undefined;\n let live = true;\n const release = () => {\n if (live) setReadyFor(shown);\n };\n Promise.resolve(ready).then(release, release);\n return () => {\n live = false;\n };\n }, [shown, ready]);\n const held = !!ready && readyFor !== shown;\n\n const handleConfirm = React.useCallback(() => settle(true), [settle]);\n const handleOpenChange = React.useCallback(\n (next: boolean) => {\n // Any dismiss (Esc / backdrop / Cancel) is a \"no\" — never a silent yes.\n if (!next) settle(false);\n },\n [settle],\n );\n\n return (\n <ConfirmDialog\n open={open}\n onOpenChange={handleOpenChange}\n title={shown?.title ?? \"\"}\n description={shown?.description}\n confirmLabel={shown?.confirmLabel}\n cancelLabel={shown?.cancelLabel}\n variant={shown?.variant}\n confirmHeld={held}\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\";\nimport { useMenuScrollEdges } from \"./menu-scroll-edges\";\nimport { useSubmenuSurvivesParentPanelFocus } from \"./submenu-focus\";\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-[10001] 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\n/** Portalled like its parent, so it opens BESIDE it — see `DropdownMenuSubContent` for why. */\nconst ContextMenuSubContent = React.forwardRef<\n React.ComponentRef<typeof ContextMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent> & { container?: HTMLElement | null }\n>(({ className, container, onFocusOutside, children, ...props }, ref) => {\n const portalContainer = usePortalContainer(container);\n // A flipped submenu survives the pointer leaving its trigger (see submenu-focus.ts).\n const keep = useSubmenuSurvivesParentPanelFocus(ref, onFocusOutside);\n const edges = useMenuScrollEdges(keep.ref);\n return (\n <ContextMenuPrimitive.Portal container={portalContainer}>\n <ContextMenuPrimitive.SubContent\n ref={edges.ref}\n onFocusOutside={keep.onFocusOutside}\n data-slot=\"context-menu-sub-content\"\n className={cn(SURFACE_CLASS, edges.surfaceClassName, \"shadow-lg\", MOTION_POPPER, className)}\n {...props}\n >\n {edges.wrap(children)}\n </ContextMenuPrimitive.SubContent>\n </ContextMenuPrimitive.Portal>\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, children, ...props }, ref) => {\n const portalContainer = usePortalContainer(container);\n const edges = useMenuScrollEdges(ref);\n return (\n <ContextMenuPrimitive.Portal container={portalContainer}>\n <ContextMenuPrimitive.Content\n ref={edges.ref}\n data-slot=\"context-menu-content\"\n className={cn(SURFACE_CLASS, edges.surfaceClassName, \"shadow-md\", MOTION_POPPER, className)}\n {...props}\n >\n {edges.wrap(children)}\n </ContextMenuPrimitive.Content>\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 * A MENU THAT HIDES ITEMS SAYS SO (Arman, 2026-10-02: \"A menu that hides\n * options needs to use best in class UI to show there is more\").\n *\n * Every menu surface already caps at Radix's measured available height and\n * scrolls. What it lacked was any sign that it scrolls: the note editor's\n * right-click menu in Split mode hid Chat and AI Actions below the fold and a\n * reader concluded they did not exist. Champion: macOS menus (an arrow strip\n * at the hidden edge that scrolls while hovered) plus the Linear/Radix edge\n * fade.\n *\n * Each edge that actually hides items gets a soft fade and a chevron strip;\n * an edge that is scrolled to its end gets neither, and a menu that fits gets\n * nothing at all. Measurement is `useScrollFade` (the package's one \"is there\n * more\" meter) — but drawn as OVERLAY elements, not its `mask-image` class:\n * a mask clips everything outside the border box, which would erase the\n * menu's own shadow.\n *\n * The overlays are zero-height `position: sticky` rows inside the surface, so\n * the surface stays the scroller: Radix's keyboard focus still scrolls the\n * focused item into view natively, and `scroll-padding-block` (styles.css)\n * keeps it clear of the fade. Pointer hover on a chevron glides toward the\n * hidden items; a press (touch included) moves one page.\n */\n\nimport * as React from \"react\";\n\nimport { RadixChevronDownIcon, RadixChevronUpIcon } from \"./icons\";\nimport { useScrollFade } from \"./use-scroll-fade\";\n\n/** px per millisecond while a chevron is hovered (~ macOS menu arrow speed). */\nconst HOVER_SPEED = 0.6;\n/** A press keeps this much of the previous page in view, so the reader keeps their place. */\nconst PAGE_OVERLAP = 48;\n\ntype Side = \"top\" | \"bottom\";\n\nfunction composeRefs<T>(...refs: Array<React.Ref<T> | undefined>) {\n return (node: T | null) => {\n for (const ref of refs) {\n if (typeof ref === \"function\") ref(node);\n else if (ref) (ref as React.MutableRefObject<T | null>).current = node;\n }\n };\n}\n\nfunction MenuScrollEdge({ side, scroller }: { side: Side; scroller: React.RefObject<HTMLElement | null> }) {\n const frame = React.useRef<number | null>(null);\n const dir = side === \"top\" ? -1 : 1;\n\n const stop = React.useCallback(() => {\n if (frame.current !== null) cancelAnimationFrame(frame.current);\n frame.current = null;\n }, []);\n\n const glide = React.useCallback(() => {\n stop();\n let last = performance.now();\n const step = (now: number) => {\n const el = scroller.current;\n if (!el) return stop();\n el.scrollTop += dir * HOVER_SPEED * (now - last);\n last = now;\n frame.current = requestAnimationFrame(step);\n };\n frame.current = requestAnimationFrame(step);\n }, [dir, scroller, stop]);\n\n // The edge unmounts the moment its end is reached; the glide stops with it.\n React.useEffect(() => stop, [stop]);\n\n return (\n <div aria-hidden data-menu-scroll-edge={side} className=\"matrx-menu-scroll-edge\">\n <div className=\"matrx-menu-scroll-fade\">\n <div\n data-menu-scroll-button=\"\"\n className=\"matrx-menu-scroll-button\"\n onPointerEnter={(e) => {\n if (e.pointerType !== \"touch\") glide();\n }}\n onPointerLeave={stop}\n onPointerDown={(e) => {\n // Never steal focus from the item the keyboard is on.\n e.preventDefault();\n const el = scroller.current;\n if (!el) return;\n el.scrollTop += dir * Math.max(el.clientHeight - PAGE_OVERLAP, PAGE_OVERLAP);\n }}\n >\n {side === \"top\" ? <RadixChevronUpIcon /> : <RadixChevronDownIcon />}\n </div>\n </div>\n </div>\n );\n}\n\n/**\n * Wire a menu surface: spread `ref` onto the Radix Content/SubContent and wrap\n * its children with `wrap`. Forwarded refs are composed, never replaced.\n */\nexport function useMenuScrollEdges<T extends HTMLElement>(...forwarded: Array<React.Ref<T> | undefined>) {\n const fade = useScrollFade();\n const scroller = React.useRef<HTMLElement | null>(null);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const ref = React.useCallback(composeRefs<T>(scroller as React.Ref<T>, fade.ref as React.Ref<T>, ...forwarded), [\n fade.ref,\n ...forwarded,\n ]);\n const wrap = (children: React.ReactNode) => (\n <>\n {fade.state.top ? <MenuScrollEdge side=\"top\" scroller={scroller} /> : null}\n {children}\n {fade.state.bottom ? <MenuScrollEdge side=\"bottom\" scroller={scroller} /> : null}\n </>\n );\n return { ref, wrap, surfaceClassName: \"matrx-menu-surface\" };\n}\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 // Every menu surface now carries this hook, so it must also run where\n // ResizeObserver does not exist (jsdom suites in every consumer); scroll\n // and mutation still measure there.\n const ro = typeof ResizeObserver === \"undefined\" ? null : 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","import * as React from \"react\";\n\n/**\n * A SUBMENU NEVER CLOSES BECAUSE ITS PARENT PANEL TOOK FOCUS (blind run PB-04, /notes,\n * 2026-10-02: at a 1024 px viewport AI Actions ▸ Text Operations ▸ Text Tools closed the whole\n * menu; works at 1600 px).\n *\n * Radix keeps a submenu open while the pointer leaves its trigger only when the pointer's last\n * horizontal move inside the parent panel points at the side the submenu is drawn on. A narrow\n * viewport FLIPS the submenu to the left; a pointer that last moved right (or jumped) and heads\n * for it is \"not moving to the submenu\", so Radix focuses the parent PANEL itself, the submenu\n * reads that as focus outside and closes under the pointer, and the click meant for it lands on\n * the page and closes the whole menu. Focus on the parent panel (role=\"menu\", the panel holding\n * this submenu's trigger) only means \"the pointer left a row without entering another one\" — it\n * never closes a submenu, on either side. Focus on another ROW still closes it, as before.\n *\n * Returns the composed ref and the `onFocusOutside` handler a SubContent wrapper spreads.\n */\nexport function useSubmenuSurvivesParentPanelFocus<T extends HTMLElement, E extends Event>(\n forwardedRef: React.ForwardedRef<T>,\n onFocusOutside: ((event: E) => void) | undefined,\n): { ref: (node: T | null) => void; onFocusOutside: (event: E) => void } {\n const content = React.useRef<T | null>(null);\n const ref = React.useCallback(\n (node: T | null) => {\n content.current = node;\n if (typeof forwardedRef === \"function\") forwardedRef(node);\n else if (forwardedRef) forwardedRef.current = node;\n },\n [forwardedRef],\n );\n const handle = (event: E) => {\n onFocusOutside?.(event);\n if (event.defaultPrevented) return;\n const to = event.target;\n const id = content.current?.id;\n if (!(to instanceof Element) || !id || to.getAttribute(\"role\") !== \"menu\") return;\n const holdsTrigger = Array.from(to.querySelectorAll(\"[aria-controls]\")).some((el) => el.getAttribute(\"aria-controls\") === id);\n if (holdsTrigger) event.preventDefault();\n };\n return { ref, onFocusOutside: handle };\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\";\nimport { FIELD_SURFACE_CLASS } from \"./field-surface\";\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 gap-2 whitespace-nowrap rounded-md ${FIELD_SURFACE_CLASS} 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]:min-w-0 [&>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\n/**\n * THE ONE DROPDOWN CHEVRON (page-pass 2026-09-27, /crm/<id>). Pickers drew three\n * different trigger glyphs side by side — a down chevron, an up-down pair, and\n * a larger up-down — so one form read as three kinds of control. Every dropdown\n * trigger (Select, CreatablePicker, every host combobox) draws THIS.\n */\nexport function SelectChevron({ className, size = \"default\" }: { className?: string; size?: \"sm\" | \"default\" }) {\n return (\n <RadixChevronDownIcon\n aria-hidden=\"true\"\n data-select-chevron=\"\"\n className={cn(size === \"sm\" ? \"h-3.5 w-3.5\" : \"h-4 w-4\", \"shrink-0 opacity-50\", className)}\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 <SelectChevron size={size === \"sm\" ? \"sm\" : \"default\"} />\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] max-w-[calc(100vw-2rem)] 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 \"max-w-full overflow-y-auto p-0.5\",\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 min-w-0 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 <span className=\"min-w-0 whitespace-normal break-words [overflow-wrap:anywhere]\">\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </span>\n {description ? (\n <span className=\"block min-w-0 break-words text-xs leading-snug text-muted-foreground [overflow-wrap:anywhere]\">\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","/**\n * THE ONE FIELD SURFACE (page-pass shared fix, 2026-09-27).\n *\n * Every control a person types into or picks from — Input, BasicInput,\n * Textarea, the Select trigger, and the host's ProInput / ProTextarea — sits on\n * this fill and this border. They used to disagree: Input and the elevated\n * Textarea filled with `bg-background` (the grey page colour in light mode),\n * BasicInput and the control Textarea were `bg-transparent` (grey on a grey\n * page), while the Select trigger filled with `bg-card` (white). On one form\n * the text fields therefore looked disabled beside white Selects\n * (/hr/settings/employer, the message-template editor) — a screen that lies\n * about what it will let you do.\n *\n * The surface is the Select's: the card fill and the regular border. A caller\n * that genuinely wants no fill (an inline cell editor) still passes\n * `bg-transparent`, which wins through `cn`.\n */\nexport const FIELD_SURFACE_CLASS = \"border border-border bg-card\";\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 { SelectChevron } from \"./select\";\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 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 <SelectChevron size=\"sm\" />\n </button>\n </PopoverTrigger>\n <PopoverContent sizing=\"content\" align=\"start\" className=\"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 * HOW WIDE THE POPOVER IS ALLOWED TO BE, and it is the SYSTEM that decides — never a\n * surface pasting its own `w-64` over the default (lane FIX-14, 2026-09-22).\n *\n * `\"fixed\"` (default) is the historical `w-72`: right for a menu of short, known\n * labels, where a ragged edge would look broken.\n *\n * `\"content\"` is for a popover whose whole job is to SHOW SOMETHING THE SYSTEM DID\n * NOT CHOOSE — a person's name, a record's title, a row the user is about to\n * create. The relation picker offered\n *\n * Create “Marisol Okonkwo — 418 Calle Pu\n *\n * inside a 16rem box, cut mid-word, on the one control that exists to show the name\n * being created. A fixed width cannot be right for content of unknown length, so\n * this one grows to its content between an honest floor and an honest ceiling:\n *\n * · at least the trigger's own width, and at least 20rem — the width Airtable's and\n * Notion's link-record pickers settle on, and wide enough that an ordinary\n * \"name — street, town\" fits on one line;\n * · at most 28rem, and never wider than the viewport less a 1rem gutter each side,\n * so it still fits a 375px phone with nothing running off the screen. The floor is\n * clamped by the same gutter, so on a very narrow screen the ceiling still wins.\n *\n * Beyond that ceiling the CONTENT truncates with an ellipsis and carries a `title`.\n * Growing, then ellipsis — never a mid-word cut.\n *\n * BOTH modes keep the phone gutter (2026-09-26): the box is never wider than the\n * viewport less 1rem each side, and Radix keeps it `collisionPadding` (16px) off every\n * screen edge. Measured at 375px before this: `w-72`/`w-80` callers landed flush on\n * the right edge (55→375) because collision padding was 0.\n */\n sizing?: \"fixed\" | \"content\";\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 sizing = \"fixed\",\n collisionPadding = 16,\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 collisionPadding={collisionPadding}\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] 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 sizing === \"content\"\n ? \"w-auto min-w-[min(max(var(--radix-popover-trigger-width),20rem),calc(100vw-2rem))] max-w-[min(28rem,calc(100vw-2rem))]\"\n : \"w-72 max-w-[calc(100vw-2rem)]\",\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` in `styles.css` hands its bottom\n * padding to the footer), so scrolled content never shows through beneath\n * the actions AND the footer never covers the row above it. Outside a\n * DialogContent both variables are unset, the padding falls back to `0px`,\n * and the footer is the plain row 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 * 6. ON DESKTOP A DIALOG IS A WINDOW, NOT A WALL (0.38.0, Arman 2026-09-23:\n * \"none of the built-in page ai integrations are accessible because the\n * page is totally blocked\"). Unless the caller passes `modal`, a desktop\n * dialog does not block the page: no overlay, the page, the Agents menu,\n * the assist dock and right-click AI stay usable beside it. It behaves like\n * a window: a click outside never closes it (`dismissOnOutsideClick` opts a\n * quick picker back in), Escape closes it only while focus is inside it\n * (Escape in the page belongs to the page), and its `DialogHeader` drags\n * it, clamped on screen, double-click to recenter. On a phone it stays the\n * blocking bottom sheet — nothing useful sits behind a sheet. Confirmations\n * are `AlertDialog`, a different component, and stay blocking. This is a\n * LIGHT window: the host's heavy window manager (tray, persistence) is a\n * separate system and must not be pulled into every dialog.\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 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\";\nimport { announceLayerFront, LAYER_FRONT_EVENT, type LayerFrontDetail } from \"./layer-front\";\nimport { keepFloatingLayersInside, useModalLayer } from \"./floating-layer\";\n\n/**\n * True when the dialog is a window because the caller said nothing about\n * modality (rule 6), false when the caller passed `modal={false}` itself.\n * The two sit on different layers: a default window sits WITH the other\n * layers it was opened from (z-10000 — a dialog opened from a menu, a popover\n * or a host window must never appear behind its opener), while an explicit\n * `modal={false}` keeps the older coexistence contract below the host's window\n * manager (z-900).\n */\nconst DialogWindowedByDefaultContext = React.createContext(false);\n\nconst Dialog = ({\n children,\n ...props\n}: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>) => {\n const isMobile = useIsMobile();\n // A window on desktop, a blocking sheet on a phone; `modal` forces either (rule 6).\n const modal = props.modal ?? isMobile;\n return (\n <DialogWindowedByDefaultContext.Provider value={props.modal === undefined}>\n <RadixDialogModalProvider modal={modal}>\n <DialogPrimitive.Root {...props} modal={modal}>\n {children}\n </DialogPrimitive.Root>\n </RadixDialogModalProvider>\n </DialogWindowedByDefaultContext.Provider>\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\n// Shared identity across independently bundled public entrypoints/loaders.\nconst CONTEXT_SLOT = Symbol.for(\"ai-matrx.design-system.dialog-container-context\");\nconst contextRegistry = globalThis as typeof globalThis & { [CONTEXT_SLOT]?: React.Context<HTMLElement | null> };\nconst DialogContainerContext = contextRegistry[CONTEXT_SLOT] ??= 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>(({ onInteractOutside, ...props }, ref) => {\n const isModal = useRadixDialogModal();\n // A blocking dialog registers, so floating layers opened from it (a host\n // window, a picker window) stack above its scrim (floating-layer.tsx).\n useModalLayer(isModal);\n return (\n <DialogPrimitive.Content\n {...props}\n ref={ref}\n aria-modal={isModal || undefined}\n onInteractOutside={keepFloatingLayersInside(onInteractOutside)}\n />\n );\n});\nDialogContentPrimitive.displayName = \"DialogContentPrimitive\";\n\nconst DIALOG_DESKTOP_CLASSES =\n \"matrx-dialog-card fixed inset-0 z-[10000] m-auto grid h-fit min-w-0 w-full max-w-lg 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] 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-none w-full max-w-full max-h-[90dvh] rounded-b-none rounded-t-2xl overflow-y-auto\";\n\n/** Drag props the windowed DialogContent hands its DialogHeader (rule 6). */\ntype DialogWindowHandle = {\n onPointerDown: (event: React.PointerEvent<HTMLElement>) => void;\n onPointerMove: (event: React.PointerEvent<HTMLElement>) => void;\n onPointerUp: (event: React.PointerEvent<HTMLElement>) => void;\n onPointerCancel: (event: React.PointerEvent<HTMLElement>) => void;\n onDoubleClick: () => void;\n};\nconst DialogWindowHandleContext = React.createContext<DialogWindowHandle | null>(null);\n\n/** Pixels of a dragged window that must stay on screen. */\nconst WINDOW_KEEP_VISIBLE = 80;\n\nfunction isInteractiveTarget(target: EventTarget | null): boolean {\n return (\n target instanceof Element &&\n Boolean(target.closest(\"button, a, input, textarea, select, [role='button'], [contenteditable='true']\"))\n );\n}\n\nexport interface DialogContentProps\n extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {\n /**\n * Windowed (non-blocking) dialogs never close from a click outside them —\n * the person is reaching for the page or an AI control beside the window.\n * Pass `true` for a quick picker that should close when the person clicks\n * away. Ignored on a blocking dialog, which keeps Radix's behaviour.\n */\n dismissOnOutsideClick?: boolean;\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 dismissOnOutsideClick = false,\n onInteractOutside,\n onEscapeKeyDown,\n onPointerDownCapture,\n onFocusCapture,\n style,\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 windowed = !isModal && !asSheet;\n const windowedByDefault = React.useContext(DialogWindowedByDefaultContext);\n const [containerEl, setContainerEl] = React.useState<HTMLElement | null>(\n null,\n );\n\n // ── the front-most layer (layer-front.ts) ───────────────────────────────\n // A default window sits at z-10000 with the layers it was opened from; it\n // steps behind when another layer comes to the front after it (a host\n // window opened from the Agents menu) and returns when the person reaches\n // for it again. An explicit modal={false} keeps its fixed z-900 contract.\n const stacks = windowed && windowedByDefault;\n const [behind, setBehind] = React.useState(false);\n React.useEffect(() => {\n if (!stacks || !containerEl) return;\n const onFront = (event: Event) => {\n const element = (event as CustomEvent<LayerFrontDetail>).detail?.element ?? null;\n if (element && (element === containerEl || containerEl.contains(element))) return;\n setBehind(true);\n };\n document.addEventListener(LAYER_FRONT_EVENT, onFront);\n // Opening is coming to the front.\n announceLayerFront(containerEl);\n return () => document.removeEventListener(LAYER_FRONT_EVENT, onFront);\n }, [stacks, containerEl]);\n const bringToFront = () => {\n if (!stacks || !containerEl) return;\n setBehind(false);\n announceLayerFront(containerEl);\n };\n\n // ── rule 6: the windowed dialog drags by its header ──────────────────────\n const [offset, setOffset] = React.useState({ x: 0, y: 0 });\n const dragRef = React.useRef<{ x: number; y: number; baseX: number; baseY: number } | null>(null);\n const handle = React.useMemo<DialogWindowHandle | null>(() => {\n if (!windowed) return null;\n const clamp = (value: number, limit: number) => Math.max(-limit, Math.min(limit, value));\n return {\n onPointerDown: (event) => {\n if (event.button !== 0 || isInteractiveTarget(event.target)) return;\n dragRef.current = { x: event.clientX, y: event.clientY, baseX: offset.x, baseY: offset.y };\n event.currentTarget.setPointerCapture?.(event.pointerId);\n },\n onPointerMove: (event) => {\n const start = dragRef.current;\n if (!start) return;\n setOffset({\n x: clamp(start.baseX + event.clientX - start.x, window.innerWidth / 2 - WINDOW_KEEP_VISIBLE / 2),\n y: clamp(start.baseY + event.clientY - start.y, window.innerHeight / 2 - WINDOW_KEEP_VISIBLE / 2),\n });\n },\n onPointerUp: (event) => {\n if (!dragRef.current) return;\n dragRef.current = null;\n event.currentTarget.releasePointerCapture?.(event.pointerId);\n },\n onPointerCancel: () => {\n dragRef.current = null;\n },\n onDoubleClick: () => setOffset({ x: 0, y: 0 }),\n };\n }, [windowed, offset.x, offset.y]);\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 && !windowedByDefault && \"z-[900]\",\n // Another layer came to the front after this window (layer-front.ts).\n stacks && behind && \"z-[999]\",\n // Without an overlay the card needs its own separation from the page.\n windowed && \"shadow-2xl ring-1 ring-border/60\",\n )}\n style={\n windowed && (offset.x !== 0 || offset.y !== 0)\n ? { ...style, translate: `${offset.x}px ${offset.y}px` }\n : style\n }\n onPointerDownCapture={(event) => {\n onPointerDownCapture?.(event);\n if (behind) bringToFront();\n }}\n onFocusCapture={(event) => {\n onFocusCapture?.(event);\n if (behind) bringToFront();\n }}\n onInteractOutside={(event) => {\n onInteractOutside?.(event);\n if (windowed && !dismissOnOutsideClick) event.preventDefault();\n }}\n onEscapeKeyDown={(event) => {\n onEscapeKeyDown?.(event);\n // Escape pressed in the page belongs to the page (a grid cancelling\n // an edit), not to the window beside it.\n // The key's own target is where the person pressed it; focus is\n // the fallback when the event carries no element target.\n const pressedIn =\n event.target instanceof Node && event.target !== document.body\n ? event.target\n : document.activeElement;\n if (windowed && containerEl && !(pressedIn && containerEl.contains(pressedIn))) {\n event.preventDefault();\n }\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 <DialogWindowHandleContext.Provider value={handle}>\n <PortalContainerProvider\n container={containerEl ?? injectedContainer ?? null}\n >\n {children}\n </PortalContainerProvider>\n </DialogWindowHandleContext.Provider>\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 // In a windowed dialog the header is the drag handle (rule 6).\n const handle = React.useContext(DialogWindowHandleContext);\n return (\n <div\n data-slot=\"dialog-header\"\n {...(handle\n ? {\n ...handle,\n \"data-window-handle\": \"\",\n title: \"Drag to move · double-click to recenter\",\n }\n : {})}\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 handle && \"cursor-grab select-none active:cursor-grabbing\",\n className,\n )}\n {...props}\n />\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/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 //\n // 🚨 THERE IS NO `mb-[…]` HERE, AND THERE MUST NEVER BE ONE AGAIN\n // (0.11.3, feedback bf8fb00b). The bleed over the card's bottom padding\n // used to be a NEGATIVE BLOCK MARGIN, which makes this box taller than\n // the grid area the card allocates it — and `position: sticky` CLAMPS a\n // box to its containing block, so the browser yanked the footer UP by\n // `--dialog-pad` against the card's `gap-4` and painted 8px of opaque\n // footer over the last line of the consequence, at every length. The\n // card now RESERVES this footer's block size instead (`matrx-dialog-card`\n // in styles.css hands over its `padding-bottom`), so the bleed costs no\n // margin at all. Guard: `sticky-footer-geometry.test.tsx`.\n //\n // These stay UTILITIES rather than a shipped rule so a caller's\n // `className` still wins through tailwind-merge — a shipped rule would\n // have to be unlayered to survive Tailwind preflight (§ THE PREFLIGHT\n // RULE in styles.css) and would then override every caller's padding.\n \"sticky bottom-0 z-10 bg-background pt-3\",\n \"mx-[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","/**\n * THE FRONT-MOST LAYER — one signal every floating layer shares, so the layer\n * the person used last is the one on top.\n *\n * A windowed Dialog sits at z-10000 so it is never behind the menu, popover or\n * host window it was opened from (0.38.1). But a host window opened or focused\n * AFTER it — the window an agent run opens from the Agents menu while Table\n * settings is open — then sat underneath it, and its composer could not be\n * clicked or typed into (found live 2026-09-26, register ARE-010). Recency has\n * to decide, across both systems, without coupling them.\n *\n * So any layer that comes to the front announces it: `announceLayerFront(el)`\n * dispatches `matrx:layer-front` on `document`. A windowed Dialog announces\n * itself when it opens and when the person presses or focuses inside it; it\n * steps BEHIND (z-999, still above the page and below the host's window\n * manager at 1000+) whenever another layer announces, and comes back the\n * moment the person reaches for it. A host window manager announces its\n * window on open and on focus.\n */\n\nexport const LAYER_FRONT_EVENT = \"matrx:layer-front\";\n\nexport interface LayerFrontDetail {\n /** The element that came to the front. */\n element: Element | null;\n}\n\n/** Tell every other floating layer that `element` is now the one in front. */\nexport function announceLayerFront(element: Element | null): void {\n if (typeof document === \"undefined\") return;\n document.dispatchEvent(\n new CustomEvent<LayerFrontDetail>(LAYER_FRONT_EVENT, { detail: { element } }),\n );\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\";\nimport { useMenuScrollEdges } from \"./menu-scroll-edges\";\nimport { useSubmenuSurvivesParentPanelFocus } from \"./submenu-focus\";\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\n// gap-2: an item's icon never touches its label (page-pass 2026-09-27, admin pass — every menu).\nconst MENU_ITEM_CLASS =\n \"relative flex cursor-default select-none items-center gap-2 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\n/**\n * A SUBMENU OPENS BESIDE ITS PARENT, NEVER ON TOP OF IT (merged-grid review 2, C1: \"nested\n * submenus overlap the parent menu\"). The submenu was drawn INSIDE the parent's surface, and that\n * surface's entry animation leaves a `transform` on it — which makes the parent the containing\n * block of the submenu's `position: fixed`. Radix measured the submenu's place in viewport\n * coordinates and the browser applied them from the parent's corner, so it landed over the parent\n * (and was clipped by the parent's scroll box). Portalled like every other surface, through the\n * same container seam, it sits beside its trigger as Radix placed it.\n */\nconst DropdownMenuSubContent = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent> & { container?: HTMLElement | null }\n>(({ className, container, sideOffset = 2, alignOffset = -4, collisionPadding = 8, onFocusOutside, children, ...props }, ref) => {\n const portalContainer = usePortalContainer(container);\n // A flipped submenu survives the pointer leaving its trigger (see submenu-focus.ts).\n const keep = useSubmenuSurvivesParentPanelFocus(ref, onFocusOutside);\n const edges = useMenuScrollEdges(keep.ref);\n return (\n <DropdownMenuPrimitive.Portal container={portalContainer}>\n <DropdownMenuPrimitive.SubContent\n ref={edges.ref}\n onFocusOutside={keep.onFocusOutside}\n data-slot=\"dropdown-menu-sub-content\"\n sideOffset={sideOffset}\n alignOffset={alignOffset}\n collisionPadding={collisionPadding}\n className={cn(MENU_SURFACE_CLASS, edges.surfaceClassName, \"shadow-lg\", MOTION_POPPER, className)}\n {...props}\n >\n {edges.wrap(children)}\n </DropdownMenuPrimitive.SubContent>\n </DropdownMenuPrimitive.Portal>\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, children, ...props }, ref) => {\n const portalContainer = usePortalContainer(container);\n const edges = useMenuScrollEdges(ref);\n return (\n <DropdownMenuPrimitive.Portal container={portalContainer}>\n <DropdownMenuPrimitive.Content\n ref={edges.ref}\n data-slot=\"dropdown-menu-content\"\n sideOffset={sideOffset}\n className={cn(\n MENU_SURFACE_CLASS,\n edges.surfaceClassName,\n \"shadow-md\",\n MOTION_POPPER,\n className,\n )}\n {...props}\n >\n {edges.wrap(children)}\n </DropdownMenuPrimitive.Content>\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\";\nimport { FIELD_SURFACE_CLASS } from \"./field-surface\";\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 ${FIELD_SURFACE_CLASS} 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-card [&:-webkit-autofill]:shadow-[0_0_0_1000px_hsl(var(--card))_inset] [&:-webkit-autofill]:[caret-color:currentColor]\n dark:[&:-webkit-autofill]:shadow-[0_0_0_1000px_hsl(var(--card))_inset] dark:[&:-webkit-autofill]:[-webkit-text-fill-color:hsl(var(--foreground))]\n [&:-webkit-autofill:hover]:shadow-[0_0_0_1000px_hsl(var(--card))_inset] [&:-webkit-autofill:focus]:shadow-[0_0_0_1000px_hsl(var(--card))_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 ${FIELD_SURFACE_CLASS} 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 flex-1 transition-all\",\n PROGRESS_TONES[tone],\n // The sweep sets its own width (package layer); a `w-full` utility\n // here would outrank it and paint a solid bar.\n isIndeterminate ? \"matrx-progress-indeterminate\" : \"w-full\",\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 /** Stable accessible name when the visual label contains separate nodes. */\n ariaLabel?: string;\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 aria-label={option.ariaLabel}\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 * ArchiveFilter — THE platform archive filter control.\n *\n * THE ARCHIVED-ITEMS LAW (Arman, 2026-09-09 —\n * common-docs/policies/archived-items.md): every list surface over an entity\n * that can be archived carries this control, its default hides archived rows,\n * and revealing them is ONE click. It is a class, not an instance: agents,\n * workflows, employees, HR documents, conversations, admin tables — the same\n * three states, the same words, everywhere.\n *\n * The vocabulary is `matrx-frontend/lib/entity-list`'s `ArchivedFilter`\n * verbatim (`active` | `archived` | `all`, default `active`, labels \"Active\n * only\" / \"Archived only\" / \"Active + archived\") so a user meets one control,\n * not one per app. `@ai-matrx/agents/catalog`'s `archFilter` is the same axis\n * with its own legacy third value (`both`); `ARCHIVE_FILTER_VALUES` is the\n * canonical set new code binds to.\n *\n * The filter is a REQUEST, never a client-side sieve: hand the value to the\n * reader (an RPC's `p_archived`, an endpoint's `archived=`) so counts, badges\n * and pagination describe what the list actually renders.\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { SegmentedControl, type SegmentOption } from \"./segmented-control\";\n\n/** The three states, in display order. */\nexport const ARCHIVE_FILTER_VALUES = [\"active\", \"archived\", \"all\"] as const;\n\nexport type ArchiveFilterValue = (typeof ARCHIVE_FILTER_VALUES)[number];\n\n/** The platform default: a list hides archived rows until asked. */\nexport const DEFAULT_ARCHIVE_FILTER: ArchiveFilterValue = \"active\";\n\n/**\n * The ONE noun for archived rows, platform-wide. Both controls speak it: the\n * filter's `archived` state (\"Archived only\") and `ArchivedDisclosure`'s\n * button (\"Archived (N)\"). Renaming it in one place renames it in both, which\n * is the point — a user meets one word, not two.\n */\nexport const ARCHIVE_LABEL = \"Archived\";\n\n/** The one wording. Hosts pass `labels` only to shorten, never to rename. */\nexport const ARCHIVE_FILTER_LABELS: Record<ArchiveFilterValue, string> = {\n active: \"Active only\",\n archived: `${ARCHIVE_LABEL} only`,\n all: \"Active + archived\",\n};\n\n/**\n * A disclosure's open/closed state said in the tri-state vocabulary, for the\n * hosts whose \"Archived (N)\" toggle IS a server request rather than a nested\n * render. Closed asks for the platform default (archived hidden); open asks\n * for `all`, because a disclosure reveals archived rows BESIDE the live ones —\n * it never replaces the list with the archive.\n */\nexport function archiveFilterFromDisclosure(open: boolean): ArchiveFilterValue {\n return open ? \"all\" : DEFAULT_ARCHIVE_FILTER;\n}\n\n/**\n * Narrow an untrusted value (a URL param, a stored preference, an API echo)\n * to the tri-state. Anything unrecognised falls back to the platform default\n * rather than silently widening a list to archived rows.\n */\nexport function toArchiveFilter(\n value: unknown,\n fallback: ArchiveFilterValue = DEFAULT_ARCHIVE_FILTER,\n): ArchiveFilterValue {\n return ARCHIVE_FILTER_VALUES.includes(value as ArchiveFilterValue)\n ? (value as ArchiveFilterValue)\n : fallback;\n}\n\nexport interface ArchiveFilterProps {\n value: ArchiveFilterValue;\n onValueChange: (value: ArchiveFilterValue) => void;\n /**\n * Per-state row counts, when the reader returns them (a facet query, a\n * `total_count`). A count that is not honest is worse than none, so pass a\n * key only when the number describes what the list would actually render.\n */\n counts?: Partial<Record<ArchiveFilterValue, number>>;\n /** Shorter wording for a dense toolbar. Never a different meaning. */\n labels?: Partial<Record<ArchiveFilterValue, string>>;\n size?: \"sm\" | \"md\" | \"lg\";\n className?: string;\n /** Accessible name for the group. */\n \"aria-label\"?: string;\n disabled?: boolean;\n}\n\n/**\n * The control. One click from \"Active only\" to seeing archived rows.\n */\nexport function ArchiveFilter({\n value,\n onValueChange,\n counts,\n labels,\n size = \"sm\",\n className,\n \"aria-label\": ariaLabel = \"Archive filter\",\n disabled = false,\n}: ArchiveFilterProps) {\n const data = React.useMemo<SegmentOption[]>(\n () =>\n ARCHIVE_FILTER_VALUES.map((state) => {\n const text = labels?.[state] ?? ARCHIVE_FILTER_LABELS[state];\n const count = counts?.[state];\n return {\n value: state,\n disabled,\n ariaLabel: typeof count === \"number\" ? `${text} ${count}` : text,\n label:\n typeof count === \"number\" ? (\n <span className=\"inline-flex items-center gap-1.5\">\n <span>{text}</span>\n <span className=\"text-muted-foreground tabular-nums\">{count}</span>\n </span>\n ) : (\n text\n ),\n };\n }),\n [counts, labels, disabled],\n );\n\n return (\n <div role=\"group\" aria-label={ariaLabel} className={cn(\"inline-flex\", className)}>\n <SegmentedControl\n value={value}\n onValueChange={(next) => onValueChange(toArchiveFilter(next, value))}\n data={data}\n size={size}\n />\n </div>\n );\n}\n","\"use client\";\n\n/**\n * ArchivedDisclosure — THE ARCHIVED-ITEMS LAW, card-list half.\n * (`common-docs/policies/archived-items.md`, Arman 2026-09-09.)\n *\n * Every list over an entity that can be archived carries an archive control,\n * it defaults to HIDING archived rows, and revealing them is one or two\n * clicks — on the surface itself. There are exactly TWO implementations of\n * that control in the platform, and both live in THIS package:\n *\n * • `ArchiveFilter` — the tri-state segmented control (Active only /\n * Archived only / Active + archived) for table and browse surfaces whose\n * reader takes an archive parameter. Prefer it whenever the surface can\n * express the request server-side.\n * • `ArchivedDisclosure` — THIS component: a one-click \"Archived (N)\"\n * disclosure, closed by default, revealing the archived rows in place\n * underneath. For card lists, panels and pickers that are not table\n * shaped.\n *\n * Never invent a third. The disclosure was proven first in matrx-frontend's\n * Transcript Studio, lived as `components/official/ArchivedDisclosure` there,\n * and moved here (0.14.0) verbatim so every client inherits the same control\n * instead of re-growing it per app.\n *\n * Both controls share one vocabulary: `ARCHIVE_LABEL` is the single noun, and\n * `archiveFilterFromDisclosure(open)` says a disclosure's state in the\n * tri-state words for a host whose toggle IS a server request.\n *\n * Two shapes, one primitive:\n *\n * <ArchivedDisclosure count={n} open={open} onOpenChange={setOpen}>\n * …archived rows…\n * </ArchivedDisclosure>\n *\n * renders the button AND the revealed block. Omit `children` when the caller\n * merges the archived rows into an existing table/grid itself — the button is\n * then the whole control.\n *\n * The count is ALWAYS the true number of archived rows the surface holds. A\n * screen never lies: when there is nothing archived the control renders\n * nothing at all rather than an empty promise. A surface whose archive view is\n * a SERVER request (the rows below the button are the archived page itself,\n * not children of it) passes `keepWhileOpen` so the revealed view never loses\n * its way back.\n *\n * `countLabel` exists for the one case a bare integer cannot tell the truth: a\n * server-side count that hit its cap (render `\"12+\"`), or a count that has not\n * landed yet (pass `null` and no parenthetical is printed at all).\n */\n\nimport * as React from \"react\";\n\nimport { ARCHIVE_LABEL } from \"./archive-filter\";\nimport { cn } from \"./cn\";\nimport { ArchiveIcon, ChevronDownIcon, ChevronRightIcon } from \"./icons\";\n\nexport interface ArchivedDisclosureProps {\n /** True number of archived rows this surface holds. 0 renders nothing. */\n count: number;\n /** Whether archived rows are currently revealed. */\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /**\n * The archived rows. Omit when the host merges them into its own list and\n * only needs the toggle.\n */\n children?: React.ReactNode;\n /** Noun for the rows, so the button reads in the surface's own words. */\n label?: string;\n /**\n * Override the parenthetical. A string replaces the number (`\"12+\"` for a\n * capped server count); `null` prints no parenthetical at all, for a count\n * that has not arrived yet. Omit it and the honest `count` is printed.\n */\n countLabel?: string | null;\n /**\n * Keep the control rendered while `open` even at `count === 0`. For surfaces\n * where opening SWITCHES the list to the archive (a server-side filter)\n * rather than nesting rows inside this component: without it the way back\n * would vanish the moment the count read zero or had not landed.\n */\n keepWhileOpen?: boolean;\n className?: string;\n contentClassName?: string;\n}\n\nexport function ArchivedDisclosure({\n count,\n open,\n onOpenChange,\n children,\n label = ARCHIVE_LABEL,\n countLabel,\n keepWhileOpen = false,\n className,\n contentClassName,\n}: ArchivedDisclosureProps) {\n // Nothing archived: an empty promise, so render nothing — unless this\n // surface's open state IS the archive view, whose way back must never vanish.\n if (count <= 0 && !(open && keepWhileOpen)) return null;\n\n const parenthetical = countLabel === undefined ? String(count) : countLabel;\n\n return (\n <div className={cn(\"min-w-0\", className)}>\n <button\n type=\"button\"\n onClick={() => onOpenChange(!open)}\n aria-expanded={open}\n className=\"flex w-full items-center gap-2 rounded-lg px-2 py-2 text-sm text-muted-foreground hover:bg-accent active:bg-accent\"\n >\n {open ? (\n <ChevronDownIcon className=\"h-4 w-4 shrink-0\" />\n ) : (\n <ChevronRightIcon className=\"h-4 w-4 shrink-0\" />\n )}\n <ArchiveIcon className=\"h-4 w-4 shrink-0\" />\n <span className=\"truncate\">\n {parenthetical === null ? label : `${label} (${parenthetical})`}\n </span>\n </button>\n {open && children ? (\n <div className={cn(\"mt-1\", contentClassName)}>{children}</div>\n ) : null}\n </div>\n );\n}\n\nexport default ArchivedDisclosure;\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 { keepFloatingLayersInside, useModalLayer } from \"./floating-layer\";\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>(({ onInteractOutside, ...props }, ref) => {\n const isModal = useRadixDialogModal();\n useModalLayer(isModal);\n return (\n <SheetPrimitive.Content\n {...props}\n ref={ref}\n aria-modal={isModal || undefined}\n onInteractOutside={keepFloatingLayersInside(onInteractOutside)}\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 // The modal tier (floating-layer.tsx), like every other blocking scrim: a\n // sheet at z-50 opened from a host window (z-1000+) opened behind it.\n \"fixed inset-0 z-[10000] 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 isModal = useRadixDialogModal();\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 // A blocking sheet sits on the modal tier; a non-modal side panel\n // keeps z-50 beside the page.\n isModal && \"z-[10000]\",\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 data-slot=\"sheet-footer\"\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","\"use client\";\n\n/**\n * OrganizationPicker — THE ONE \"which organization am I acting in\" control,\n * identical on every Matrx surface (the main app's user menu and header nudge,\n * Workflow Studio's sidebar, the admin dashboard's settings).\n *\n * Ported from matrx-frontend `features/organizations/components/\n * OrganizationPickerPanel.tsx` + `UserMenuOrgSection.tsx` + `DefaultOrgSwitch.tsx`\n * (2026-09-08), which until then were the ONLY surfaces with the full picker;\n * Studio and the dashboard each had a bare `<Select>` with different copy,\n * different placement and no default control. Three UIs for one fact.\n *\n * THE ACTIVE ROW IS THE ANSWER (owner, 2026-10-01). The active organization is\n * the highlighted row — tinted, bold, ringed and checked — and nothing else:\n * the \"Working in …\" sentence above the list is gone (\"It should be\n * highlighted and clear\"), and so is the \"Keep it at the top\" switch.\n *\n * FAVORITES (owner, 2026-10-01: \"add a star you can click to favorite any of\n * them\"). Every row carries its own star; a person favorites as many as they\n * like, and favorites are drawn first. The star never selects the row — it is\n * a sibling button, not part of the row — and it picks no organization for\n * anyone: which organization you are working in is this device's own\n * remembered choice (the host's resolver), never a star.\n *\n * 🚨 A HUNDRED ROWS IS NOT A LIST (VERIFIER-8 MEDIUM-3, 2026-09-21).\n * The first screen of the data product offered the admin account's 116\n * organizations nine at a time, with no search, most of them lane fixtures.\n * Three things answer that, and all three are here rather than in one host:\n * • SEARCH over name and abbreviation, once the list passes eight rows.\n * • TEST ORGANIZATIONS HIDDEN by default behind the platform's one\n * archive-style disclosure (`ArchivedDisclosure`), with their count always\n * on screen. Hidden, never dropped.\n * • THE PERSON'S OWN organizations drawn first, under the starred one.\n * The host classifies (`isTestFixture`, `isOwn`); this component decides\n * nothing about a name it is given.\n *\n * Seam inversions from the origin: lucide `Check`/`Star` become package\n * SVGs (C19); the host `Switch` becomes this package's; `cn` is local.\n */\n\nimport * as React from \"react\";\n\nimport { ArchivedDisclosure } from \"./archived-disclosure\";\nimport { cn } from \"./cn\";\nimport { ErrorBox } from \"./error-box\";\nimport { LucideCheckIcon, StarIcon } from \"./icons\";\nimport { Input } from \"./input\";\nimport { Skeleton } from \"./skeleton\";\n\n/**\n * Above this many rows the list stops being something a person reads and\n * starts being something they hunt through, so the search box appears. Below\n * it a search box is one more control over a list the eye already took in.\n */\nconst SEARCH_APPEARS_ABOVE = 8;\n\n/** Case-insensitive substring over the two things a person actually types. */\nfunction matchesQuery(org: OrganizationPickerOrganization, query: string): boolean {\n const q = query.trim().toLowerCase();\n if (!q) return true;\n if (org.name.toLowerCase().includes(q)) return true;\n const abbreviation = org.abbreviation?.trim().toLowerCase();\n return !!abbreviation && abbreviation.includes(q);\n}\n\nexport interface OrganizationPickerOrganization {\n id: string;\n name: string;\n /** Database-validated 2–3 uppercase letters. Optional — not every report carries it. */\n abbreviation?: string | null;\n /**\n * THE ADDRESS, for when the NAME is not enough — its slug, or whatever else the\n * host has that tells two of them apart.\n *\n * 🚨 WHY (crew D2, 2026-09-21). Two organizations called \"Kessler Lab for Applied\n * Microbial Ecology\" and two called \"Wraithmoor Regional Museum of Art & Craft\" sat\n * in one list, identical down to the abbreviation tile, and a person had no way of\n * knowing which one they were about to work in. The list drew the name and nothing\n * else, so there was nothing for it to draw.\n *\n * It is shown ONLY on the rows whose name another row in the list also carries —\n * the way Slack shows a workspace's URL and Google shows the account's email, and\n * only where it settles the question. A list of distinct names stays exactly as it\n * was, because a second line under every row is noise a person learns to skip.\n */\n distinguisher?: string | null;\n /**\n * This organization is a TEST FIXTURE — a lane's scratch organization, not a\n * business anybody works in. Classified in `iam.organizations.settings`\n * (`test_fixture`), never guessed from its name.\n *\n * 🚨 WHY (VERIFIER-8 MEDIUM-3, 2026-09-21). The admin account belongs to 116\n * organizations and 59 of them are fixtures. The first screen of the data\n * product offered all of them, nine at a time, with no search — so the two\n * or three a person actually works in were buried under lane debris. The\n * archived-items law already answers this shape everywhere else in the\n * platform: hide by default, ONE disclosure to reveal, and the count of what\n * is hidden is always on screen. It is hidden, never dropped: a fixture the\n * person genuinely wants is one click away.\n */\n isTestFixture?: boolean;\n /**\n * The signed-in person created this organization. Drawn before the rest,\n * under the starred one — the same reason Slack puts your own workspace\n * first: in a list of a hundred, yours must not be something you search for.\n */\n isOwn?: boolean;\n /**\n * A short trailing label for the row — what a click does or the row's state\n * (\"Open\", \"Finish setup\", \"Turn on HR\"). Muted text, right-aligned; the row\n * stays one button. Omitted, the row is exactly as before.\n */\n detail?: string | null;\n /**\n * Fold this row behind the host's second disclosure (`foldedLabel`) — for rows\n * the person rarely came for (organizations without HR). Hidden, counted,\n * one click away; a search that matches only folded rows opens the fold.\n */\n folded?: boolean;\n}\n\nexport interface OrganizationPickerProps {\n organizations: readonly OrganizationPickerOrganization[];\n /** The organization the person is acting in right now; null = nothing chosen. */\n activeOrganizationId: string | null;\n /** The person's favorite organizations, drawn first and starred. */\n favoriteOrganizationIds?: readonly string[];\n loading?: boolean;\n /** Memberships could not be read. The panel says so instead of showing an empty list. */\n loadFailed?: boolean;\n /** Choose the active organization. Hosts persist + refetch here. */\n onSelect: (organization: OrganizationPickerOrganization) => void;\n /**\n * Favorite (true) or unfavorite (false) one organization. Omit to draw no\n * star buttons — a host with no write path must not show a control that\n * does nothing (a favorite is still marked, read-only).\n */\n onToggleFavorite?: ((organizationId: string, favorite: boolean) => void) | undefined;\n /** Hide the \"Organization\" eyebrow when the host already labels the section. */\n hideHeading?: boolean;\n /** Extra classes on each row button (e.g. a host menu's item class). */\n itemClassName?: string;\n /** The noun on the disclosure that holds `folded` rows. Default \"More\". */\n foldedLabel?: string;\n className?: string;\n}\n\n/**\n * An organization's colour — one of a fixed set of hues, chosen from its id so\n * the same organization wears the same colour on every surface and every\n * device. Color tells organizations apart at a glance; the letters still say\n * which one (owner, 2026-10-01: \"a bit of color for the logos\").\n */\nconst ORGANIZATION_HUES = [217, 262, 330, 12, 32, 152, 189, 290] as const;\nexport function organizationColor(seed: string): { background: string; color: string } {\n let hash = 0;\n for (let index = 0; index < seed.length; index += 1) {\n hash = (hash * 31 + seed.charCodeAt(index)) >>> 0;\n }\n const hue = ORGANIZATION_HUES[hash % ORGANIZATION_HUES.length];\n return { background: `hsl(${hue} 62% 46%)`, color: \"#fff\" };\n}\n\n/**\n * THE organization mark — its own logo when it has one, otherwise its 2–3\n * letter abbreviation on its colour tile (the first letter of the name when the\n * report has no abbreviation, so a tile is never empty). Three letters get a\n * smaller face than two so they fit the tile. Every Matrx surface draws this.\n */\nexport function OrganizationMark({\n id,\n name,\n abbreviation,\n logoUrl,\n size = 20,\n className,\n}: {\n /** Seeds the colour; the name is used when absent. */\n id?: string | null | undefined;\n name: string;\n abbreviation?: string | null | undefined;\n logoUrl?: string | null | undefined;\n size?: number;\n className?: string | undefined;\n}) {\n const box = { width: size, height: size };\n if (logoUrl) {\n return (\n <span\n style={box}\n className={cn(\"relative inline-flex shrink-0 overflow-hidden rounded-md bg-muted\", className)}\n data-slot=\"organization-mark\"\n >\n <img src={logoUrl} alt={name} className=\"h-full w-full object-cover\" />\n </span>\n );\n }\n const letters = ((abbreviation && abbreviation.trim()) || name.trim().slice(0, 1) || \"?\")\n .slice(0, 3)\n .toUpperCase();\n const fontSize = Math.round(size * (letters.length >= 3 ? 0.36 : 0.44));\n return (\n <span\n style={{ ...box, ...organizationColor(id || name), fontSize }}\n className={cn(\n \"inline-flex shrink-0 items-center justify-center rounded-md font-bold leading-none tracking-tight\",\n className,\n )}\n aria-label={`Organization abbreviation ${letters}`}\n title={letters}\n data-slot=\"organization-mark\"\n >\n {letters}\n </span>\n );\n}\n\nexport function OrganizationPicker({\n organizations,\n activeOrganizationId,\n favoriteOrganizationIds = [],\n loading = false,\n loadFailed = false,\n onSelect,\n onToggleFavorite,\n hideHeading = false,\n itemClassName,\n foldedLabel = \"More\",\n className,\n}: OrganizationPickerProps) {\n const [query, setQuery] = React.useState(\"\");\n const [showFixtures, setShowFixtures] = React.useState(false);\n const [showFolded, setShowFolded] = React.useState(false);\n\n const favorites = new Set(favoriteOrganizationIds);\n const isFavorite = (id: string) => favorites.has(id);\n /**\n * THE ORDER, and it is the whole point of this control on an account with a\n * hundred memberships: the person's favorites, then their OWN organizations,\n * then everything else. Inside each band the host's order is kept exactly as\n * given — this reorders bands, it never sorts names.\n */\n const rank = (org: OrganizationPickerOrganization) =>\n isFavorite(org.id) ? 0 : org.isOwn ? 1 : 2;\n const ordered = [...organizations].sort((a, b) => rank(a) - rank(b));\n\n const matching = ordered.filter((org) => matchesQuery(org, query));\n const listed = matching.filter((org) => !org.isTestFixture && !org.folded);\n const folded = matching.filter((org) => !org.isTestFixture && org.folded);\n const fixtures = matching.filter((org) => org.isTestFixture);\n // The fold opens by itself when it is all there is, or when a search found\n // something inside it — a match is never hidden behind a closed disclosure.\n const foldOpen =\n showFolded || (folded.length > 0 && (listed.length === 0 || query.trim().length > 0));\n const searchable = organizations.length > SEARCH_APPEARS_ABOVE;\n /**\n * Which display names appear more than once in THIS list — the only rows where the\n * second line earns its space. Computed from the list itself, so the answer is right\n * for the person looking at it rather than for organizations they cannot see.\n */\n const sharesItsName = (org: OrganizationPickerOrganization) =>\n organizations.filter((other) => other.name.trim() === org.name.trim()).length > 1;\n\n const renderRow = (org: OrganizationPickerOrganization) => {\n const isActive = org.id === activeOrganizationId;\n const favorite = isFavorite(org.id);\n return (\n <li key={org.id} role=\"none\" className=\"group/org relative flex items-center\">\n <button\n type=\"button\"\n role=\"option\"\n aria-selected={isActive}\n aria-pressed={isActive}\n onClick={(event) => {\n // Inside a host menu the click must not also close/route the menu.\n event.stopPropagation();\n onSelect(org);\n }}\n className={cn(\n \"flex w-full min-w-0 items-center gap-2.5 rounded-md py-1.5 pl-2 pr-8 text-left text-sm text-foreground transition-colors hover:bg-accent\",\n isActive && \"bg-primary/10 font-semibold text-primary ring-1 ring-inset ring-primary/30 hover:bg-primary/15\",\n itemClassName,\n )}\n data-active={isActive ? \"\" : undefined}\n >\n <OrganizationMark id={org.id} name={org.name} abbreviation={org.abbreviation} size={20} />\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"truncate\">{org.name}</span>\n {/* Only where the name does not settle it — see `distinguisher`. */}\n {sharesItsName(org) && org.distinguisher ? (\n <span className=\"truncate text-[10px] font-normal text-muted-foreground\">\n {org.distinguisher}\n </span>\n ) : null}\n </span>\n {org.detail ? (\n <span\n className=\"shrink-0 text-xs font-normal text-muted-foreground\"\n data-slot=\"organization-picker-detail\"\n >\n {org.detail}\n </span>\n ) : null}\n {isActive && (\n <LucideCheckIcon className=\"h-[15px] w-[15px] shrink-0 text-primary\" />\n )}\n </button>\n {/* THE STAR — its own button beside the row, never part of it: a star\n favorites, it never selects. Shown on hover/focus, always shown\n while favorited. Read-only (a mark) when the host has no write. */}\n {onToggleFavorite ? (\n <button\n type=\"button\"\n aria-pressed={favorite}\n aria-label={favorite ? `Remove ${org.name} from favorites` : `Add ${org.name} to favorites`}\n title={favorite ? \"Remove from favorites\" : \"Add to favorites\"}\n onClick={(event) => {\n event.stopPropagation();\n onToggleFavorite(org.id, !favorite);\n }}\n className={cn(\n \"absolute right-1 flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-opacity hover:bg-accent hover:text-foreground focus-visible:opacity-100\",\n favorite ? \"opacity-100\" : \"opacity-0 group-hover/org:opacity-100\",\n )}\n data-slot=\"organization-picker-favorite\"\n >\n <StarIcon\n className={cn(\"h-[14px] w-[14px]\", favorite && \"fill-warning text-warning\")}\n />\n </button>\n ) : favorite ? (\n <StarIcon\n className=\"absolute right-2 h-[13px] w-[13px] fill-warning text-warning\"\n aria-hidden={false}\n aria-label=\"Favorite\"\n role=\"img\"\n />\n ) : null}\n </li>\n );\n };\n\n return (\n <div className={cn(\"flex flex-col\", className)} data-slot=\"organization-picker\">\n {!hideHeading && (\n <p className=\"px-2 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground\">\n Organization\n </p>\n )}\n\n {loading ? (\n <div className=\"space-y-1 px-1 py-1\" aria-busy=\"true\" aria-label=\"Loading organizations\">\n <Skeleton className=\"h-7 rounded-md\" />\n <Skeleton className=\"h-7 rounded-md\" />\n </div>\n ) : loadFailed ? (\n <ErrorBox\n className=\"px-2 py-2 text-xs text-destructive\"\n operation=\"Load your organizations\"\n origin=\"design-system/OrganizationPicker\"\n >\n Could not load organizations.\n </ErrorBox>\n ) : organizations.length === 0 ? (\n <p className=\"px-2 py-2 text-xs text-muted-foreground\">\n Your account is not a member of any organization. Ask an administrator to add you to one.\n </p>\n ) : (\n <>\n {/* SEARCH. A list a person scrolls nine rows at a time is not a\n control, it is a filing cabinet (VERIFIER-8 MEDIUM-3). Name and\n abbreviation, case-insensitive substring; an empty box is exactly\n the list that was there before. */}\n {searchable && (\n <div className=\"px-2 pb-1.5\">\n <Input\n type=\"search\"\n value={query}\n onChange={(event) => setQuery(event.target.value)}\n onClick={(event) => event.stopPropagation()}\n onKeyDown={(event) => event.stopPropagation()}\n placeholder=\"Search organizations\"\n aria-label=\"Search organizations by name or abbreviation\"\n className=\"h-8 text-sm\"\n data-slot=\"organization-picker-search\"\n />\n </div>\n )}\n\n {listed.length === 0 && folded.length === 0 && fixtures.length === 0 ? (\n <p\n className=\"px-2 py-2 text-xs text-muted-foreground\"\n data-slot=\"organization-picker-no-match\"\n >\n No organization matches “{query.trim()}”.\n </p>\n ) : listed.length === 0 && folded.length > 0 ? null : listed.length === 0 ? (\n /* THE ARCHIVED-ITEMS LAW, honesty half: \"nothing\" may only be said\n when both halves are empty. Here the other half is one line down.\n AND IT SAYS WHAT IS TRUE, NOT WHAT IS EMPTY. The earlier sentence\n read \"Nothing matches “X” outside the test organizations below\" —\n which opens by negating the very rows sitting one click away, and\n `fixtures` IS query-filtered, so those rows ARE matches for X. A\n person reading \"nothing matches\" retypes their search instead of\n clicking. So: count the matches, say where they are, and carry\n the click that reveals them — the same shape as the honest\n empty-filter twin one line down. (TAILS-3) */\n <p\n className=\"px-2 py-2 text-xs text-muted-foreground\"\n data-slot=\"organization-picker-only-fixtures\"\n >\n {query.trim() ? (\n <>\n {fixtures.length === 1\n ? `1 match for “${query.trim()}” is in your test organizations`\n : `All ${fixtures.length} matches for “${query.trim()}” are in your test organizations`}\n {showFixtures ? (\n \", listed below.\"\n ) : (\n <>\n {\" — \"}\n <button\n type=\"button\"\n className=\"underline underline-offset-2 hover:text-foreground\"\n data-slot=\"organization-picker-show-fixtures\"\n onClick={(event) => {\n event.stopPropagation();\n setShowFixtures(true);\n }}\n >\n show them\n </button>\n .\n </>\n )}\n </>\n ) : (\n `Every organization you belong to is a test organization — all ${fixtures.length} are below.`\n )}\n </p>\n ) : (\n <ul className=\"max-h-72 overflow-y-auto\" role=\"listbox\" aria-label=\"Organizations\">\n {listed.map(renderRow)}\n </ul>\n )}\n\n {/* THE HOST'S FOLD — rows it marked `folded`, counted, one click away. */}\n <ArchivedDisclosure\n count={folded.length}\n open={foldOpen}\n onOpenChange={setShowFolded}\n label={foldedLabel}\n className=\"mt-0.5\"\n >\n <ul className=\"max-h-72 overflow-y-auto\" role=\"listbox\" aria-label={foldedLabel}>\n {folded.map(renderRow)}\n </ul>\n </ArchivedDisclosure>\n\n {/* THE TEST ORGANIZATIONS, behind the platform's ONE archive-style\n disclosure (`ArchivedDisclosure`, the archived-items law). Hidden\n by default, counted out loud, one click away — never silently\n dropped. */}\n <ArchivedDisclosure\n count={fixtures.length}\n open={showFixtures}\n onOpenChange={setShowFixtures}\n label=\"Test organizations\"\n className=\"mt-0.5\"\n >\n <ul\n className=\"max-h-72 overflow-y-auto\"\n role=\"listbox\"\n aria-label=\"Test organizations\"\n >\n {fixtures.map(renderRow)}\n </ul>\n </ArchivedDisclosure>\n\n </>\n )}\n </div>\n );\n}\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 * Sidebar — ported from shadcn/ui `apps/v4/registry/new-york-v4/ui/sidebar.tsx`\n * (MIT, Copyright (c) 2023 shadcn). Behavior-verbatim; only coupling seams changed:\n *\n * - Imports resolve to this package's own Button, Input, Separator, Sheet, Skeleton,\n * Tooltip and `useIsMobile`; the toggle glyph is the package-inlined `PanelLeftIcon` (C19).\n * - Tokens use the AI Matrx vocabulary (`--sidebar-background`, `--sidebar-foreground`,\n * `--sidebar-accent`, `--sidebar-border`, `--sidebar-ring`, …), defaulted in tokens.css.\n * - No persistence (C10): the original wrote a cookie on every toggle. A host that keeps the\n * state passes `open` / `onOpenChange` and stores it where its own state lives.\n * - The keyboard shortcut is a prop (`keyboardShortcut`, default \"b\"; `null` turns it off for\n * hosts that own their accelerators, such as a desktop app menu).\n * - Collapse timing is a knob: `--sidebar-duration` / `--sidebar-easing` on the provider\n * (defaults: shadcn's 200ms linear).\n */\n\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { Button } from \"./button\";\nimport { cn } from \"./cn\";\nimport { PanelLeftIcon } from \"./icons\";\nimport { Input } from \"./input\";\nimport { Separator } from \"./separator\";\nimport { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from \"./sheet\";\nimport { Skeleton } from \"./skeleton\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"./tooltip\";\nimport { useIsMobile } from \"./use-is-mobile\";\n\nconst SIDEBAR_WIDTH = \"16rem\";\nconst SIDEBAR_WIDTH_MOBILE = \"18rem\";\nconst SIDEBAR_WIDTH_ICON = \"3rem\";\nconst SIDEBAR_KEYBOARD_SHORTCUT = \"b\";\n\ntype SidebarContextProps = {\n state: \"expanded\" | \"collapsed\";\n open: boolean;\n setOpen: (open: boolean) => void;\n openMobile: boolean;\n setOpenMobile: (open: boolean) => void;\n isMobile: boolean;\n toggleSidebar: () => void;\n};\n\nconst SidebarContext = React.createContext<SidebarContextProps | null>(null);\n\nfunction useSidebar() {\n const context = React.useContext(SidebarContext);\n if (!context) {\n throw new Error(\"useSidebar must be used within a SidebarProvider.\");\n }\n\n return context;\n}\n\nfunction SidebarProvider({\n defaultOpen = true,\n open: openProp,\n onOpenChange: setOpenProp,\n keyboardShortcut = SIDEBAR_KEYBOARD_SHORTCUT,\n className,\n style,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & {\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** ⌘/Ctrl + this key toggles the sidebar. `null` when the host owns its shortcuts. */\n keyboardShortcut?: string | null;\n}) {\n const isMobile = useIsMobile();\n const [openMobile, setOpenMobile] = React.useState(false);\n\n // This is the internal state of the sidebar.\n // We use openProp and setOpenProp for control from outside the component.\n const [_open, _setOpen] = React.useState(defaultOpen);\n const open = openProp ?? _open;\n const setOpen = React.useCallback(\n (value: boolean | ((value: boolean) => boolean)) => {\n const openState = typeof value === \"function\" ? value(open) : value;\n if (setOpenProp) {\n setOpenProp(openState);\n } else {\n _setOpen(openState);\n }\n },\n [setOpenProp, open],\n );\n\n // Helper to toggle the sidebar.\n const toggleSidebar = React.useCallback(() => {\n return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);\n }, [isMobile, setOpen, setOpenMobile]);\n\n // Adds a keyboard shortcut to toggle the sidebar.\n React.useEffect(() => {\n if (!keyboardShortcut) return;\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === keyboardShortcut && (event.metaKey || event.ctrlKey)) {\n event.preventDefault();\n toggleSidebar();\n }\n };\n\n window.addEventListener(\"keydown\", handleKeyDown);\n return () => window.removeEventListener(\"keydown\", handleKeyDown);\n }, [keyboardShortcut, toggleSidebar]);\n\n // We add a state so that we can do data-state=\"expanded\" or \"collapsed\".\n // This makes it easier to style the sidebar with Tailwind classes.\n const state = open ? \"expanded\" : \"collapsed\";\n\n const contextValue = React.useMemo<SidebarContextProps>(\n () => ({\n state,\n open,\n setOpen,\n isMobile,\n openMobile,\n setOpenMobile,\n toggleSidebar,\n }),\n [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar],\n );\n\n return (\n <SidebarContext.Provider value={contextValue}>\n <TooltipProvider delayDuration={0}>\n <div\n data-slot=\"sidebar-wrapper\"\n style={\n {\n \"--sidebar-width\": SIDEBAR_WIDTH,\n \"--sidebar-width-icon\": SIDEBAR_WIDTH_ICON,\n \"--sidebar-duration\": \"200ms\",\n \"--sidebar-easing\": \"linear\",\n ...style,\n } as React.CSSProperties\n }\n className={cn(\n \"group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar-background\",\n className,\n )}\n {...props}\n >\n {children}\n </div>\n </TooltipProvider>\n </SidebarContext.Provider>\n );\n}\n\nfunction Sidebar({\n side = \"left\",\n variant = \"sidebar\",\n collapsible = \"offcanvas\",\n className,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & {\n side?: \"left\" | \"right\";\n variant?: \"sidebar\" | \"floating\" | \"inset\";\n collapsible?: \"offcanvas\" | \"icon\" | \"none\";\n}) {\n const { isMobile, state, openMobile, setOpenMobile } = useSidebar();\n\n if (collapsible === \"none\") {\n return (\n <div\n data-slot=\"sidebar\"\n className={cn(\n \"flex h-full w-(--sidebar-width) flex-col bg-sidebar-background text-sidebar-foreground\",\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n }\n\n if (isMobile) {\n return (\n // The original spread the desktop container's div props onto the Sheet root, which\n // accepts none of them; the mobile sheet takes only its open state.\n <Sheet open={openMobile} onOpenChange={setOpenMobile}>\n <SheetContent\n data-sidebar=\"sidebar\"\n data-slot=\"sidebar\"\n data-mobile=\"true\"\n className=\"w-(--sidebar-width) bg-sidebar-background p-0 text-sidebar-foreground [&>button]:hidden\"\n style={\n {\n \"--sidebar-width\": SIDEBAR_WIDTH_MOBILE,\n } as React.CSSProperties\n }\n side={side}\n >\n <SheetHeader className=\"sr-only\">\n <SheetTitle>Sidebar</SheetTitle>\n <SheetDescription>Displays the mobile sidebar.</SheetDescription>\n </SheetHeader>\n <div className=\"flex h-full w-full flex-col\">{children}</div>\n </SheetContent>\n </Sheet>\n );\n }\n\n return (\n <div\n className=\"group peer hidden text-sidebar-foreground md:block\"\n data-state={state}\n data-collapsible={state === \"collapsed\" ? collapsible : \"\"}\n data-variant={variant}\n data-side={side}\n data-slot=\"sidebar\"\n >\n {/* This is what handles the sidebar gap on desktop */}\n <div\n data-slot=\"sidebar-gap\"\n className={cn(\n \"relative w-(--sidebar-width) bg-transparent transition-[width] duration-(--sidebar-duration) ease-(--sidebar-easing)\",\n \"group-data-[collapsible=offcanvas]:w-0\",\n \"group-data-[side=right]:rotate-180\",\n variant === \"floating\" || variant === \"inset\"\n ? \"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]\"\n : \"group-data-[collapsible=icon]:w-(--sidebar-width-icon)\",\n )}\n />\n <div\n data-slot=\"sidebar-container\"\n className={cn(\n \"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-(--sidebar-duration) ease-(--sidebar-easing) md:flex\",\n side === \"left\"\n ? \"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]\"\n : \"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]\",\n // Adjust the padding for floating and inset variants.\n variant === \"floating\" || variant === \"inset\"\n ? \"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]\"\n : \"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l\",\n className,\n )}\n {...props}\n >\n <div\n data-sidebar=\"sidebar\"\n data-slot=\"sidebar-inner\"\n className=\"flex h-full w-full flex-col bg-sidebar-background group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm\"\n >\n {children}\n </div>\n </div>\n </div>\n );\n}\n\nfunction SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>) {\n const { toggleSidebar } = useSidebar();\n\n return (\n <Button\n data-sidebar=\"trigger\"\n data-slot=\"sidebar-trigger\"\n variant=\"ghost\"\n size=\"icon\"\n className={cn(\"size-7\", className)}\n onClick={(event) => {\n onClick?.(event);\n toggleSidebar();\n }}\n {...props}\n >\n <PanelLeftIcon />\n <span className=\"sr-only\">Toggle Sidebar</span>\n </Button>\n );\n}\n\nfunction SidebarRail({ className, ...props }: React.ComponentProps<\"button\">) {\n const { toggleSidebar } = useSidebar();\n\n return (\n <button\n data-sidebar=\"rail\"\n data-slot=\"sidebar-rail\"\n aria-label=\"Toggle Sidebar\"\n tabIndex={-1}\n onClick={toggleSidebar}\n title=\"Toggle Sidebar\"\n className={cn(\n \"absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex\",\n \"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize\",\n \"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize\",\n \"group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar-background\",\n \"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2\",\n \"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarInset({ className, ...props }: React.ComponentProps<\"main\">) {\n return (\n <main\n data-slot=\"sidebar-inset\"\n className={cn(\n \"relative flex w-full flex-1 flex-col bg-background\",\n \"md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarInput({ className, ...props }: React.ComponentProps<typeof Input>) {\n return (\n <Input\n data-slot=\"sidebar-input\"\n data-sidebar=\"input\"\n className={cn(\"h-8 w-full bg-background shadow-none\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-header\"\n data-sidebar=\"header\"\n className={cn(\"flex flex-col gap-2 p-2\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-footer\"\n data-sidebar=\"footer\"\n className={cn(\"flex flex-col gap-2 p-2\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarSeparator({ className, ...props }: React.ComponentProps<typeof Separator>) {\n return (\n <Separator\n data-slot=\"sidebar-separator\"\n data-sidebar=\"separator\"\n className={cn(\"mx-2 w-auto bg-sidebar-border\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-content\"\n data-sidebar=\"content\"\n className={cn(\n \"flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-group\"\n data-sidebar=\"group\"\n className={cn(\"relative flex w-full min-w-0 flex-col p-2\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarGroupLabel({\n className,\n asChild = false,\n ...props\n}: React.ComponentProps<\"div\"> & { asChild?: boolean }) {\n const Comp = asChild ? Slot : \"div\";\n\n return (\n <Comp\n data-slot=\"sidebar-group-label\"\n data-sidebar=\"group-label\"\n className={cn(\n \"flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-(--sidebar-duration) ease-(--sidebar-easing) focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n \"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarGroupAction({\n className,\n asChild = false,\n ...props\n}: React.ComponentProps<\"button\"> & { asChild?: boolean }) {\n const Comp = asChild ? Slot : \"button\";\n\n return (\n <Comp\n data-slot=\"sidebar-group-action\"\n data-sidebar=\"group-action\"\n className={cn(\n \"absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n // Increases the hit area of the button on mobile.\n \"after:absolute after:-inset-2 md:after:hidden\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarGroupContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-group-content\"\n data-sidebar=\"group-content\"\n className={cn(\"w-full text-sm\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarMenu({ className, ...props }: React.ComponentProps<\"ul\">) {\n return (\n <ul\n data-slot=\"sidebar-menu\"\n data-sidebar=\"menu\"\n className={cn(\"flex w-full min-w-0 flex-col gap-1\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarMenuItem({ className, ...props }: React.ComponentProps<\"li\">) {\n return (\n <li\n data-slot=\"sidebar-menu-item\"\n data-sidebar=\"menu-item\"\n className={cn(\"group/menu-item relative\", className)}\n {...props}\n />\n );\n}\n\nconst sidebarMenuButtonVariants = cva(\n \"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0\",\n {\n variants: {\n variant: {\n default: \"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground\",\n outline:\n \"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]\",\n },\n size: {\n default: \"h-8 text-sm\",\n sm: \"h-7 text-xs\",\n lg: \"h-12 text-sm group-data-[collapsible=icon]:p-0!\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nfunction SidebarMenuButton({\n asChild = false,\n isActive = false,\n variant = \"default\",\n size = \"default\",\n tooltip,\n className,\n ...props\n}: React.ComponentProps<\"button\"> & {\n asChild?: boolean;\n isActive?: boolean;\n tooltip?: string | React.ComponentProps<typeof TooltipContent>;\n} & VariantProps<typeof sidebarMenuButtonVariants>) {\n const Comp = asChild ? Slot : \"button\";\n const { isMobile, state } = useSidebar();\n\n const button = (\n <Comp\n data-slot=\"sidebar-menu-button\"\n data-sidebar=\"menu-button\"\n data-size={size}\n data-active={isActive}\n className={cn(sidebarMenuButtonVariants({ variant, size }), className)}\n {...props}\n />\n );\n\n if (!tooltip) {\n return button;\n }\n\n if (typeof tooltip === \"string\") {\n tooltip = {\n children: tooltip,\n };\n }\n\n return (\n <Tooltip>\n <TooltipTrigger asChild>{button}</TooltipTrigger>\n <TooltipContent\n side=\"right\"\n align=\"center\"\n hidden={state !== \"collapsed\" || isMobile}\n {...tooltip}\n />\n </Tooltip>\n );\n}\n\nfunction SidebarMenuAction({\n className,\n asChild = false,\n showOnHover = false,\n ...props\n}: React.ComponentProps<\"button\"> & {\n asChild?: boolean;\n showOnHover?: boolean;\n}) {\n const Comp = asChild ? Slot : \"button\";\n\n return (\n <Comp\n data-slot=\"sidebar-menu-action\"\n data-sidebar=\"menu-action\"\n className={cn(\n \"absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform peer-hover/menu-button:text-sidebar-accent-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n // Increases the hit area of the button on mobile.\n \"after:absolute after:-inset-2 md:after:hidden\",\n \"peer-data-[size=sm]/menu-button:top-1\",\n \"peer-data-[size=default]/menu-button:top-1.5\",\n \"peer-data-[size=lg]/menu-button:top-2.5\",\n \"group-data-[collapsible=icon]:hidden\",\n showOnHover &&\n \"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground data-[state=open]:opacity-100 md:opacity-0\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarMenuBadge({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-menu-badge\"\n data-sidebar=\"menu-badge\"\n className={cn(\n \"pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none\",\n \"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground\",\n \"peer-data-[size=sm]/menu-button:top-1\",\n \"peer-data-[size=default]/menu-button:top-1.5\",\n \"peer-data-[size=lg]/menu-button:top-2.5\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarMenuSkeleton({\n className,\n showIcon = false,\n ...props\n}: React.ComponentProps<\"div\"> & {\n showIcon?: boolean;\n}) {\n // Random width between 50 to 90%.\n const width = React.useMemo(() => {\n return `${Math.floor(Math.random() * 40) + 50}%`;\n }, []);\n\n return (\n <div\n data-slot=\"sidebar-menu-skeleton\"\n data-sidebar=\"menu-skeleton\"\n className={cn(\"flex h-8 items-center gap-2 rounded-md px-2\", className)}\n {...props}\n >\n {showIcon && <Skeleton className=\"size-4 rounded-md\" data-sidebar=\"menu-skeleton-icon\" />}\n <Skeleton\n className=\"h-4 max-w-(--skeleton-width) flex-1\"\n data-sidebar=\"menu-skeleton-text\"\n style={\n {\n \"--skeleton-width\": width,\n } as React.CSSProperties\n }\n />\n </div>\n );\n}\n\nfunction SidebarMenuSub({ className, ...props }: React.ComponentProps<\"ul\">) {\n return (\n <ul\n data-slot=\"sidebar-menu-sub\"\n data-sidebar=\"menu-sub\"\n className={cn(\n \"mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarMenuSubItem({ className, ...props }: React.ComponentProps<\"li\">) {\n return (\n <li\n data-slot=\"sidebar-menu-sub-item\"\n data-sidebar=\"menu-sub-item\"\n className={cn(\"group/menu-sub-item relative\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarMenuSubButton({\n asChild = false,\n size = \"md\",\n isActive = false,\n className,\n ...props\n}: React.ComponentProps<\"a\"> & {\n asChild?: boolean;\n size?: \"sm\" | \"md\";\n isActive?: boolean;\n}) {\n const Comp = asChild ? Slot : \"a\";\n\n return (\n <Comp\n data-slot=\"sidebar-menu-sub-button\"\n data-sidebar=\"menu-sub-button\"\n data-size={size}\n data-active={isActive}\n className={cn(\n \"flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground\",\n \"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground\",\n size === \"sm\" && \"text-xs\",\n size === \"md\" && \"text-sm\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport {\n Sidebar,\n SidebarContent,\n SidebarFooter,\n SidebarGroup,\n SidebarGroupAction,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarHeader,\n SidebarInput,\n SidebarInset,\n SidebarMenu,\n SidebarMenuAction,\n SidebarMenuBadge,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSkeleton,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n SidebarProvider,\n SidebarRail,\n SidebarSeparator,\n SidebarTrigger,\n sidebarMenuButtonVariants,\n useSidebar,\n};\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 TOKEN-DRIVEN, NOT BRANDED. Popover tokens, not\n * `bg-primary`: rich tooltip content using `text-muted-foreground` was\n * illegible on a brand-coloured background in one theme or the other.\n * Since 2026-09-28 the `.matrx-tooltip` class re-scopes those tokens to a dark,\n * high-contrast chip in both themes (styles.css, THE TOOLTIP SURFACE): the\n * neutral white surface it wore before was indistinguishable from the\n * browser's own `title` box.\n *\n * 3. EVERY `title` IS THIS TOOLTIP. The provider installs the title takeover\n * (`title-tooltips.ts`), so a hand-written `title=` anywhere in the\n * document shows this surface, never the browser's.\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\";\nimport { acquireTitleTooltips, TOOLTIP_TRIGGER_ATTR } from \"./title-tooltips\";\n\nexport interface TooltipProviderProps\n extends React.ComponentProps<typeof TooltipPrimitive.Provider> {\n /**\n * THE TITLE TAKEOVER (2026-09-28) — while any provider is mounted, every native\n * `title` attribute in the document shows as this tooltip instead of the\n * browser's (see `title-tooltips.ts`). On by default, because a rule every\n * author must remember is a rule that is broken; pass `false` only for a\n * surface that must keep the browser's own box. One provider opting out does\n * not turn it off while another one is mounted.\n */\n titleTooltips?: boolean;\n}\n\n/**\n * Mount once near the app root. Every tooltip in the tree shares its\n * `delayDuration` / `skipDelayDuration` timing, and the root provider takes\n * over native `title` attributes (see `titleTooltips`).\n */\nfunction TooltipProvider({ titleTooltips = true, ...props }: TooltipProviderProps) {\n React.useEffect(() => {\n if (!titleTooltips) return;\n return acquireTitleTooltips();\n }, [titleTooltips]);\n return <TooltipPrimitive.Provider {...props} />;\n}\n\nconst Tooltip = TooltipPrimitive.Root;\n\n/**\n * Stamps `data-matrx-tooltip-trigger` so the title takeover never draws a\n * second tooltip over a control that already has this one — it still lifts a\n * `title` on the same control, so the browser's box never doubles it either.\n */\nconst TooltipTrigger = React.forwardRef<\n React.ComponentRef<typeof TooltipPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Trigger>\n>((props, ref) => (\n <TooltipPrimitive.Trigger ref={ref} {...{ [TOOLTIP_TRIGGER_ATTR]: \"\" }} {...props} />\n));\nTooltipTrigger.displayName = TooltipPrimitive.Trigger.displayName;\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 \"matrx-tooltip z-[10001] overflow-hidden rounded-md border border-border bg-popover px-2.5 py-1 text-xs font-medium text-popover-foreground\",\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 };\nexport { acquireTitleTooltips, NATIVE_TITLE_OPT_OUT_ATTR } from \"./title-tooltips\";\n","/**\n * THE TITLE TAKEOVER — every native `title` attribute in the document shows\n * as THE fleet tooltip instead of the browser's.\n *\n * Why this exists. A `title=` is the one tooltip nobody has to import, so it\n * is what every hand-written control reaches for: ~50 of them on an ordinary\n * matrx-frontend page (2026-09-28), next to the Radix tooltips on the tap\n * buttons. The browser draws those as a slow, unstyled system box, and a page\n * that mixes the two reads as having \"lost all of its tooltips\" (Arman,\n * 2026-09-28). Asking every author — human or agent — to wrap every control in\n * `<Tooltip>` is a rule that is broken the day it is written. So the\n * `TooltipProvider` every host already mounts at its root installs this layer,\n * and a `title` is simply a tooltip from then on. Nothing to remember.\n *\n * How it works. On hover (mouse or pen) or keyboard focus (`:focus-visible`)\n * of an element that carries a `title`, the attribute is lifted onto\n * `data-matrx-title` for exactly as long as the pointer or focus stays — so\n * the browser has nothing to show — and one shared, script-placed element\n * wearing `.matrx-tooltip` shows the text instead. When the pointer or focus\n * leaves, the `title` is put back, so assistive technology and every\n * `[title]` selector read the element exactly as authored the rest of the\n * time. Touch never shows it (a `title` has no touch affordance either).\n *\n * What it does not draw: a tooltip that only repeats text already readable in\n * full inside the element (it still draws when that text is hidden or\n * truncated).\n *\n * What it leaves alone:\n * - an element that is already a Radix tooltip trigger\n * (`[data-matrx-tooltip-trigger]`, stamped by `TooltipTrigger`): its\n * `title` is still lifted — two tooltips on one control was the other\n * half of the mess — but only the Radix one shows;\n * - anything inside `[data-native-title]` (the explicit opt-out);\n * - SVG `<title>` children, which are elements, not attributes.\n *\n * Placement. Above the element, centred, flipped below when there is no room,\n * clamped into the viewport. `data-title-side=\"right\" | \"left\" | \"bottom\" |\n * \"top\"` on the element or any ancestor states a preferred side — a vertical\n * rail sets `right` once on its container.\n *\n * Installed at most once per document, reference-counted across every\n * mounted provider, and removed when the last one unmounts.\n */\n\nexport const TITLE_TOOLTIP_ATTR = \"data-matrx-title\";\nexport const TOOLTIP_TRIGGER_ATTR = \"data-matrx-tooltip-trigger\";\nexport const NATIVE_TITLE_OPT_OUT_ATTR = \"data-native-title\";\n\ntype Side = \"top\" | \"bottom\" | \"left\" | \"right\";\n\nconst OPEN_DELAY_MS = 350;\n/** Moving from one titled control to the next inside this window is instant. */\nconst SKIP_DELAY_MS = 500;\nconst GAP_PX = 6;\nconst EDGE_PX = 8;\n\nconst SURFACE_CLASS =\n \"matrx-tooltip matrx-title-tooltip matrx-motion-popper z-[10001] rounded-md border border-border bg-popover px-2.5 py-1 text-xs font-medium text-popover-foreground\";\n\ninterface Installation {\n count: number;\n uninstall: () => void;\n}\n\n/**\n * Keyed on the document itself through a registered symbol, never a module\n * WeakMap: tsup bundles this module into more than one entry (`index`,\n * `tap-target`), and two module copies each holding their own map would\n * install twice — two listeners, two surfaces.\n */\nconst INSTALLATION_KEY = Symbol.for(\"@ai-matrx/design-system/title-tooltips\");\ntype DocumentWithInstallation = Document & { [INSTALLATION_KEY]?: Installation };\nconst installations = {\n get: (doc: Document) => (doc as DocumentWithInstallation)[INSTALLATION_KEY],\n set: (doc: Document, value: Installation) => {\n (doc as DocumentWithInstallation)[INSTALLATION_KEY] = value;\n },\n delete: (doc: Document) => {\n delete (doc as DocumentWithInstallation)[INSTALLATION_KEY];\n },\n};\n\n/** Install the takeover on `doc`. Returns the release function. */\nexport function acquireTitleTooltips(doc: Document | undefined = typeof document === \"undefined\" ? undefined : document): () => void {\n if (!doc) return () => {};\n const existing = installations.get(doc);\n if (existing) {\n existing.count += 1;\n } else {\n installations.set(doc, { count: 1, uninstall: install(doc) });\n }\n let released = false;\n return () => {\n if (released) return;\n released = true;\n const current = installations.get(doc);\n if (!current) return;\n current.count -= 1;\n if (current.count <= 0) {\n current.uninstall();\n installations.delete(doc);\n }\n };\n}\n\nfunction install(doc: Document): () => void {\n const win = doc.defaultView;\n let active: HTMLElement | null = null;\n let surface: HTMLDivElement | null = null;\n let openTimer: ReturnType<typeof setTimeout> | undefined;\n let lastClosedAt = 0;\n\n const HTMLElementCtor = win?.HTMLElement;\n\n const titledAncestor = (node: EventTarget | null): HTMLElement | null => {\n if (!HTMLElementCtor || !(node instanceof win!.Node)) return null;\n const start = node instanceof HTMLElementCtor ? node : (node as Node).parentElement;\n if (!start) return null;\n const el = start.closest<HTMLElement>(`[title], [${TITLE_TOOLTIP_ATTR}]`);\n if (!el || !(el instanceof HTMLElementCtor)) return null;\n if (el.closest(`[${NATIVE_TITLE_OPT_OUT_ATTR}]`)) return null;\n return el;\n };\n\n const textOf = (el: HTMLElement) => (el.getAttribute(TITLE_TOOLTIP_ATTR) ?? el.getAttribute(\"title\") ?? \"\").trim();\n\n const lift = (el: HTMLElement) => {\n const title = el.getAttribute(\"title\");\n if (title === null) return;\n el.setAttribute(TITLE_TOOLTIP_ATTR, title);\n el.removeAttribute(\"title\");\n };\n\n const restore = (el: HTMLElement) => {\n const held = el.getAttribute(TITLE_TOOLTIP_ATTR);\n if (held === null) return;\n // An author who changed or removed the title while it was lifted wins:\n // only put ours back when nothing re-set it in the meantime.\n if (!el.hasAttribute(\"title\")) el.setAttribute(\"title\", held);\n el.removeAttribute(TITLE_TOOLTIP_ATTR);\n };\n\n const ensureSurface = () => {\n if (surface && surface.isConnected) return surface;\n surface = doc.createElement(\"div\");\n surface.setAttribute(\"role\", \"tooltip\");\n surface.setAttribute(\"data-slot\", \"title-tooltip\");\n surface.className = SURFACE_CLASS;\n surface.style.visibility = \"hidden\";\n doc.body.appendChild(surface);\n return surface;\n };\n\n const preferredSide = (el: HTMLElement): Side => {\n const hint = el.closest(\"[data-title-side]\")?.getAttribute(\"data-title-side\");\n return hint === \"bottom\" || hint === \"left\" || hint === \"right\" ? hint : \"top\";\n };\n\n const place = (el: HTMLElement, node: HTMLDivElement) => {\n const vw = win?.innerWidth ?? 0;\n const vh = win?.innerHeight ?? 0;\n const anchor = el.getBoundingClientRect();\n const box = node.getBoundingClientRect();\n const fits: Record<Side, boolean> = {\n top: anchor.top - GAP_PX - box.height >= EDGE_PX,\n bottom: anchor.bottom + GAP_PX + box.height <= vh - EDGE_PX,\n left: anchor.left - GAP_PX - box.width >= EDGE_PX,\n right: anchor.right + GAP_PX + box.width <= vw - EDGE_PX,\n };\n const opposite: Record<Side, Side> = { top: \"bottom\", bottom: \"top\", left: \"right\", right: \"left\" };\n const wanted = preferredSide(el);\n const side: Side = fits[wanted] ? wanted : fits[opposite[wanted]] ? opposite[wanted] : wanted;\n\n let x: number;\n let y: number;\n if (side === \"top\" || side === \"bottom\") {\n x = anchor.left + anchor.width / 2 - box.width / 2;\n y = side === \"top\" ? anchor.top - GAP_PX - box.height : anchor.bottom + GAP_PX;\n } else {\n y = anchor.top + anchor.height / 2 - box.height / 2;\n x = side === \"left\" ? anchor.left - GAP_PX - box.width : anchor.right + GAP_PX;\n }\n x = Math.min(Math.max(x, EDGE_PX), Math.max(EDGE_PX, vw - EDGE_PX - box.width));\n y = Math.min(Math.max(y, EDGE_PX), Math.max(EDGE_PX, vh - EDGE_PX - box.height));\n node.style.transform = `translate(${Math.round(x)}px, ${Math.round(y)}px)`;\n node.setAttribute(\"data-side\", side);\n };\n\n const isShown = (node: HTMLElement, root: HTMLElement) => {\n const rect = node.getBoundingClientRect();\n if (rect.width <= 0 || rect.height <= 0) return false;\n for (let cur: HTMLElement | null = node; cur; cur = cur === root ? null : cur.parentElement) {\n const cs = win?.getComputedStyle(cur);\n if (!cs) return false;\n if (cs.display === \"none\" || cs.visibility === \"hidden\" || Number(cs.opacity) === 0) return false;\n }\n return true;\n };\n\n /**\n * A tooltip that repeats text the person can already read in full is noise\n * (an expanded sidebar row, a \"Save\" button titled \"Save\"). It still shows\n * when that text is hidden (a collapsed rail's label) or cut off\n * (truncated) — the two cases a title exists for.\n */\n const repeatsVisibleText = (el: HTMLElement, text: string) => {\n const norm = (t: string) => t.replace(/\\s+/g, \" \").trim().toLowerCase();\n const want = norm(text);\n if (!want || !win) return false;\n const walker = doc.createTreeWalker(el, win.NodeFilter.SHOW_TEXT);\n for (let node = walker.nextNode(); node; node = walker.nextNode()) {\n if (norm(node.textContent ?? \"\") !== want) continue;\n const host = node.parentElement;\n if (!host || !isShown(host, el)) continue;\n if (host.scrollWidth > host.clientWidth + 1) continue;\n return true;\n }\n return false;\n };\n\n const show = (el: HTMLElement, instant: boolean) => {\n if (active !== el) return;\n // A Radix tooltip trigger shows its own tooltip — never a second one.\n if (el.closest(`[${TOOLTIP_TRIGGER_ATTR}]`)) return;\n const text = textOf(el);\n if (!text || !el.isConnected) return;\n if (repeatsVisibleText(el, text)) return;\n const node = ensureSurface();\n node.textContent = text;\n node.style.visibility = \"hidden\";\n node.setAttribute(\"data-state\", instant ? \"instant-open\" : \"delayed-open\");\n place(el, node);\n node.style.visibility = \"visible\";\n if (el.id) node.id = `${el.id}-title-tooltip`;\n };\n\n const hide = () => {\n if (openTimer !== undefined) clearTimeout(openTimer);\n openTimer = undefined;\n if (surface && surface.style.visibility === \"visible\") lastClosedAt = Date.now();\n if (surface) {\n surface.style.visibility = \"hidden\";\n surface.removeAttribute(\"data-state\");\n }\n };\n\n const activate = (el: HTMLElement) => {\n if (active === el) return;\n deactivate();\n active = el;\n lift(el);\n const instant = Date.now() - lastClosedAt < SKIP_DELAY_MS;\n if (instant) show(el, true);\n else openTimer = setTimeout(() => show(el, false), OPEN_DELAY_MS);\n };\n\n const deactivate = () => {\n hide();\n if (active) restore(active);\n active = null;\n };\n\n const onPointerOver = (e: PointerEvent) => {\n if (e.pointerType === \"touch\") return;\n const el = titledAncestor(e.target);\n if (el) activate(el);\n else if (active) deactivate();\n };\n\n const onPointerOut = (e: PointerEvent) => {\n if (!active) return;\n const next = e.relatedTarget;\n if (next instanceof win!.Node && active.contains(next)) return;\n deactivate();\n };\n\n const onFocusIn = (e: FocusEvent) => {\n const el = titledAncestor(e.target);\n if (!el) return;\n let visible = true;\n try {\n visible = (e.target as Element).matches(\":focus-visible\");\n } catch {\n visible = true;\n }\n if (visible) activate(el);\n };\n\n const onFocusOut = (e: FocusEvent) => {\n if (!active) return;\n const next = e.relatedTarget;\n if (next instanceof win!.Node && active.contains(next)) return;\n deactivate();\n };\n\n const onDismiss = () => deactivate();\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") deactivate();\n };\n\n doc.addEventListener(\"pointerover\", onPointerOver, true);\n doc.addEventListener(\"pointerout\", onPointerOut, true);\n doc.addEventListener(\"focusin\", onFocusIn, true);\n doc.addEventListener(\"focusout\", onFocusOut, true);\n doc.addEventListener(\"pointerdown\", onDismiss, true);\n doc.addEventListener(\"keydown\", onKeyDown, true);\n doc.addEventListener(\"scroll\", onDismiss, true);\n win?.addEventListener(\"blur\", onDismiss);\n\n return () => {\n deactivate();\n doc.removeEventListener(\"pointerover\", onPointerOver, true);\n doc.removeEventListener(\"pointerout\", onPointerOut, true);\n doc.removeEventListener(\"focusin\", onFocusIn, true);\n doc.removeEventListener(\"focusout\", onFocusOut, true);\n doc.removeEventListener(\"pointerdown\", onDismiss, true);\n doc.removeEventListener(\"keydown\", onKeyDown, true);\n doc.removeEventListener(\"scroll\", onDismiss, true);\n win?.removeEventListener(\"blur\", onDismiss);\n surface?.remove();\n surface = null;\n };\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../tooltip\";\nimport { StatusDot, type StatusTone } from \"./status-dot\";\n\n/**\n * The app rail: a narrow, never-changing strip of area icons on the far left, with the\n * person at the bottom (Codex, VS Code, Slack, Teams). It answers \"where am I\"; the panel\n * beside it answers \"what can I do here\". Width is the `--app-rail-width` knob (48 px).\n */\n\nexport function AppRail({ className, style, ...props }: React.HTMLAttributes<HTMLElement>) {\n return (\n <nav\n data-slot=\"app-rail\"\n aria-label=\"Areas\"\n className={cn(\"flex h-full w-(--app-rail-width) shrink-0 flex-col items-center gap-1 py-2\", className)}\n style={{ \"--app-rail-width\": \"48px\", ...style } as React.CSSProperties}\n {...props}\n />\n );\n}\n\nexport function AppRailGroup({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return <div data-slot=\"app-rail-group\" className={cn(\"flex flex-col items-center gap-1\", className)} {...props} />;\n}\n\n/** Pushes everything after it to the bottom of the rail. */\nexport function AppRailSpacer() {\n return <div data-slot=\"app-rail-spacer\" className=\"flex-1\" />;\n}\n\nexport interface AppRailItemProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\"> {\n icon: React.ReactNode;\n label: string;\n /** Shown in the tooltip after the label, e.g. \"⌘1\". */\n shortcut?: string;\n active?: boolean;\n /** A hollow corner mark when the area needs attention; healthy areas carry none. */\n attention?: StatusTone;\n attentionLabel?: string;\n}\n\nexport const AppRailItem = React.forwardRef<HTMLButtonElement, AppRailItemProps>(function AppRailItem(\n { icon, label, shortcut, active = false, attention, attentionLabel, className, ...props },\n ref,\n) {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n ref={ref}\n type=\"button\"\n data-slot=\"app-rail-item\"\n data-active={active}\n aria-label={label}\n aria-current={active ? \"page\" : undefined}\n className={cn(\n \"relative flex size-8 items-center justify-center rounded-lg text-foreground/55 outline-none transition-colors\",\n \"hover:bg-foreground/[0.06] hover:text-foreground\",\n \"data-[active=true]:bg-foreground/[0.08] data-[active=true]:text-foreground\",\n \"focus-visible:ring-2 focus-visible:ring-ring\",\n \"[&_svg]:size-[18px] [&_svg]:shrink-0\",\n className,\n )}\n {...props}\n >\n {icon}\n {attention ? (\n <StatusDot\n tone={attention}\n variant=\"ring\"\n {...(attentionLabel ? { label: attentionLabel } : {})}\n className=\"absolute right-0.5 bottom-0.5\"\n />\n ) : null}\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"right\" align=\"center\">\n <span className=\"flex items-center gap-2\">\n {label}\n {shortcut ? <span className=\"opacity-60\">{shortcut}</span> : null}\n </span>\n </TooltipContent>\n </Tooltip>\n );\n});\n\nexport interface AppRailAvatarProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\"> {\n /** Up to two letters. Ignored when `children` is given. */\n initials?: string;\n label: string;\n /** A glyph instead of initials (e.g. a neutral person while signed out). */\n children?: React.ReactNode;\n}\n\n/** The person, at the bottom of the rail (Codex's initials circle). */\nexport const AppRailAvatar = React.forwardRef<HTMLButtonElement, AppRailAvatarProps>(function AppRailAvatar(\n { initials = \"\", label, className, children, ...props },\n ref,\n) {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n ref={ref}\n type=\"button\"\n data-slot=\"app-rail-avatar\"\n aria-label={label}\n className={cn(\n \"flex size-6 items-center justify-center rounded-full bg-foreground/[0.12] text-[10px] font-semibold leading-none text-foreground/80 outline-none [&_svg]:size-3.5\",\n \"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n className,\n )}\n {...props}\n >\n {children ?? initials.slice(0, 2).toUpperCase()}\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"right\" align=\"center\">\n {label}\n </TooltipContent>\n </Tooltip>\n );\n});\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\n\n/**\n * A 6 px status mark. Tones read semantic tokens (`--info` blue, `--warning` orange,\n * `--destructive` red, `--success` green), so a host re-tints them with its own values.\n * `ring` is the hollow variant for icon corners, where a filled dot reads as \"unread\".\n */\nexport type StatusTone = \"info\" | \"warning\" | \"danger\" | \"success\" | \"neutral\";\n\nconst FILL: Record<StatusTone, string> = {\n info: \"bg-info\",\n warning: \"bg-warning\",\n danger: \"bg-destructive\",\n success: \"bg-success\",\n neutral: \"bg-muted-foreground/60\",\n};\n\nconst RING: Record<StatusTone, string> = {\n info: \"border-info\",\n warning: \"border-warning\",\n danger: \"border-destructive\",\n success: \"border-success\",\n neutral: \"border-muted-foreground/60\",\n};\n\nexport interface StatusDotProps extends React.HTMLAttributes<HTMLSpanElement> {\n tone: StatusTone;\n variant?: \"solid\" | \"ring\";\n /** Accessible name; without it the dot is decorative. */\n label?: string;\n}\n\nexport function StatusDot({ tone, variant = \"solid\", label, className, ...props }: StatusDotProps) {\n return (\n <span\n data-slot=\"status-dot\"\n data-tone={tone}\n data-variant={variant}\n {...(label ? { role: \"img\", \"aria-label\": label } : { \"aria-hidden\": true })}\n className={cn(\n \"inline-block shrink-0 rounded-full\",\n variant === \"solid\" ? cn(\"size-1.5\", FILL[tone]) : cn(\"size-2 border-[1.5px] bg-transparent\", RING[tone]),\n className,\n )}\n {...props}\n />\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { ResizableHandle, ResizablePanel, ResizablePanelGroup } from \"../resizable\";\n\n/**\n * The canvas: a right-hand workspace of panels (terminal, files, browser, info) beside the\n * main content, as in Claude desktop and Codex. Panels stack in columns, resize by dragging\n * the gaps between them, and any one can expand to fill the whole canvas region.\n *\n * The layout is presentational: the host owns which panels are open, which is expanded and\n * what each renders. The panel CHROME (CanvasPanel, CanvasPanelEmpty, BrowserTabs, BrowserBar)\n * lives in @ai-matrx/canvas/react — the one canvas chrome; this package cannot depend on it\n * (canvas → tap-target → design-system would be a cycle).\n */\n\nexport interface CanvasPanelDef {\n id: string;\n node: React.ReactNode;\n /** Pixels (number) or percent of the column (string). */\n minSize?: number | string;\n defaultSize?: number | string;\n}\n\nexport interface CanvasColumnDef {\n id: string;\n panels: CanvasPanelDef[];\n minSize?: number | string;\n defaultSize?: number | string;\n}\n\nexport interface CanvasLayoutProps {\n columns: CanvasColumnDef[];\n /** When set, only this panel renders, filling the layout. */\n expandedId?: string | null;\n className?: string;\n}\n\nconst GAP = \"bg-transparent data-[separator=hover]:bg-foreground/15 data-[separator=active]:bg-foreground/25\";\n\nexport function CanvasLayout({ columns, expandedId = null, className }: CanvasLayoutProps) {\n const visible = columns.filter((c) => c.panels.length > 0);\n const expanded = expandedId ? visible.flatMap((c) => c.panels).find((p) => p.id === expandedId) : undefined;\n\n if (expanded) {\n return (\n <div data-slot=\"canvas-layout\" data-expanded={expanded.id} className={cn(\"flex h-full w-full\", className)}>\n {expanded.node}\n </div>\n );\n }\n\n return (\n <ResizablePanelGroup data-slot=\"canvas-layout\" orientation=\"horizontal\" className={cn(\"gap-0\", className)}>\n {visible.map((column, ci) => (\n <React.Fragment key={column.id}>\n {ci > 0 ? <ResizableHandle data-canvas-gap=\"column\" size=\"md\" className={GAP} /> : null}\n <ResizablePanel\n id={column.id}\n minSize={column.minSize ?? 220}\n {...(column.defaultSize !== undefined ? { defaultSize: column.defaultSize } : {})}\n >\n <ResizablePanelGroup data-canvas-column={column.id} orientation=\"vertical\">\n {column.panels.map((panel, pi) => (\n <React.Fragment key={panel.id}>\n {pi > 0 ? <ResizableHandle data-canvas-gap=\"row\" size=\"md\" className={GAP} /> : null}\n <ResizablePanel\n id={panel.id}\n minSize={panel.minSize ?? 120}\n {...(panel.defaultSize !== undefined ? { defaultSize: panel.defaultSize } : {})}\n >\n {panel.node}\n </ResizablePanel>\n </React.Fragment>\n ))}\n </ResizablePanelGroup>\n </ResizablePanel>\n </React.Fragment>\n ))}\n </ResizablePanelGroup>\n );\n}\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\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../tooltip\";\n\n/**\n * A small segmented group of icon buttons for switching the app's mode (Claude desktop's\n * chat | code pair in the title bar). A radio group: arrow keys move, one is always checked.\n */\n\nexport interface ModeSwitchOption<T extends string> {\n value: T;\n label: string;\n icon: React.ReactNode;\n shortcut?: string;\n}\n\nexport interface ModeSwitchProps<T extends string> {\n value: T;\n onValueChange: (value: T) => void;\n options: ReadonlyArray<ModeSwitchOption<T>>;\n label?: string;\n className?: string;\n}\n\nexport function ModeSwitch<T extends string>({ value, onValueChange, options, label = \"Mode\", className }: ModeSwitchProps<T>) {\n const refs = React.useRef<Array<HTMLButtonElement | null>>([]);\n\n const move = (from: number, delta: number) => {\n const next = (from + delta + options.length) % options.length;\n const option = options[next];\n if (!option) return;\n onValueChange(option.value);\n refs.current[next]?.focus();\n };\n\n return (\n <div\n role=\"radiogroup\"\n aria-label={label}\n data-slot=\"mode-switch\"\n className={cn(\"inline-flex items-center gap-0.5 rounded-lg bg-foreground/[0.06] p-0.5\", className)}\n >\n {options.map((option, index) => {\n const checked = option.value === value;\n return (\n <Tooltip key={option.value}>\n <TooltipTrigger asChild>\n <button\n ref={(el) => {\n refs.current[index] = el;\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={checked}\n aria-label={option.label}\n data-slot=\"mode-switch-item\"\n data-value={option.value}\n tabIndex={checked ? 0 : -1}\n onClick={() => onValueChange(option.value)}\n onKeyDown={(event) => {\n if (event.key === \"ArrowRight\" || event.key === \"ArrowDown\") {\n event.preventDefault();\n move(index, 1);\n } else if (event.key === \"ArrowLeft\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n move(index, -1);\n }\n }}\n className={cn(\n \"flex h-6 w-7 items-center justify-center rounded-md text-foreground/55 outline-none transition-colors\",\n \"hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\",\n \"aria-checked:bg-background aria-checked:text-foreground aria-checked:shadow-[0_0_0_0.5px_hsl(var(--foreground)/0.12),0_1px_2px_hsl(var(--foreground)/0.08)]\",\n \"dark:aria-checked:bg-foreground/[0.14] dark:aria-checked:shadow-none\",\n \"[&_svg]:size-[15px] [&_svg]:shrink-0\",\n )}\n >\n {option.icon}\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"bottom\" align=\"center\">\n <span className=\"flex items-center gap-2\">\n {option.label}\n {option.shortcut ? <span className=\"opacity-60\">{option.shortcut}</span> : null}\n </span>\n </TooltipContent>\n </Tooltip>\n );\n })}\n </div>\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\n/** What a tab body can do to the sheet that hosts it. */\nexport interface TabbedBottomSheetTabNav {\n /**\n * Leave this tab for the index, keeping the sheet open. A finished pick\n * inside a tab (attach a note) calls this instead of closing the sheet, so\n * the person lands where they can continue (PB-08, 2026-10-01: attaching a\n * note closed the whole sheet with no way back to its other tabs).\n */\n showIndex: () => void;\n}\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 /** The tab body, or a render function given the sheet's navigation. */\n content: ReactNode | ((nav: TabbedBottomSheetTabNav) => ReactNode);\n}\n\nexport interface TabbedBottomSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n title: string;\n tabs: TabbedBottomSheetTab[];\n /** Start each open inside this tab when it exists; otherwise show the index. */\n initialTabId?: string | null;\n}\n\nexport function TabbedBottomSheet({\n open,\n onOpenChange,\n title,\n tabs,\n initialTabId = null,\n}: TabbedBottomSheetProps) {\n const [selectedTabId, setSelectedTabId] = useState<string | null>(initialTabId);\n\n // Every open starts on its requested tab, or 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(initialTabId);\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 {typeof selectedTab.content === \"function\"\n ? selectedTab.content({ showIndex: () => setSelectedTabId(null) })\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-safe 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\";\nimport { FIELD_SURFACE_CLASS } from \"./field-surface\";\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 ${FIELD_SURFACE_CLASS} 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 ${FIELD_SURFACE_CLASS} 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/**\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 * 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\nimport {\n cloneElement,\n forwardRef,\n isValidElement,\n useCallback,\n useRef,\n type ButtonHTMLAttributes,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from \"react\";\n\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../tooltip\";\nimport { cn } from \"./cn\";\nimport { classNameMisuse, useTapGuardRef } from \"./tap-target-guard\";\nimport {\n TAP_SOLID_TONE,\n TAP_TONE_CLASS,\n TapBadge,\n TapChevron,\n TapSpinner,\n formatShortcut,\n tooltipBody,\n useTapShortcut,\n type TapFeatureProps,\n type TapShortcut,\n type TapSolidTone,\n} from \"./tap-features\";\nimport {\n getTapTargetLinkComponent,\n type TapTargetLinkComponent,\n} from \"./link\";\n\nexport interface TapTargetButtonProps extends TapFeatureProps {\n icon?: React.ReactNode;\n children?: React.ReactNode;\n strokeWidth?: number | undefined;\n onClick?: (() => void) | undefined;\n className?: string | undefined;\n as?: \"button\" | \"label\" | undefined;\n htmlFor?: string | undefined;\n ariaLabel?: string | undefined;\n disabled?: boolean | undefined;\n /**\n * When set, the tap button renders as a link instead of a button.\n * - Internal hrefs (e.g. \"/tasks\") render via the injected link component\n * (`setTapTargetLinkComponent` / the `linkComponent` prop), falling back\n * to a plain `<a>` when none is registered.\n * - External hrefs (http://, https://, mailto:, tel:) render as `<a>`\n * with `target=\"_blank\"` and `rel=\"noopener noreferrer\"` by default.\n * - When combined with `disabled`, the trigger renders as a non-navigable\n * `<span aria-disabled=\"true\">` with the same visual styling.\n */\n href?: string | undefined;\n /** Override target. Works on both internal links and external anchors. */\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\" | undefined;\n /** Override rel. Works on both internal links and external anchors. */\n rel?: string | undefined;\n /** Forwarded to the injected link component. Pass `false` to disable prefetching. */\n prefetch?: boolean | null | undefined;\n /**\n * Per-instance link component for internal hrefs — overrides the\n * module-level `setTapTargetLinkComponent` registration.\n */\n linkComponent?: TapTargetLinkComponent | undefined;\n /**\n * Tooltip text. Defaults to `ariaLabel` when omitted.\n * EVERY tap button shows a tooltip (owner ruling 2026-10-01). `false` no\n * longer hides it: it renders the tooltip through `title` (the provider's\n * title takeover draws the same surface) — for a button nested inside\n * another `asChild` trigger, where the Tooltip wrapper cannot sit.\n */\n tooltip?: string | false | undefined;\n /** Tooltip placement. Defaults to \"top\". */\n tooltipSide?: \"top\" | \"right\" | \"bottom\" | \"left\" | undefined;\n /** Tooltip alignment along its side. Defaults to \"center\". */\n tooltipAlign?: \"start\" | \"center\" | \"end\" | undefined;\n /**\n * Visible caption rendered inline after the icon (`[icon Label]`).\n * Widens the pill automatically. Tooltip defaults to off when set — the\n * label is self-describing. Visible text becomes the accessible name.\n */\n label?: string | undefined;\n /**\n * Collapse an icon + caption pill to its icon-only 44px tap target below\n * the `sm` breakpoint. The caption and inline geometry return at `sm+`;\n * `ariaLabel` (falling back to `label`) remains the accessible name.\n */\n mobileIconOnly?: boolean | undefined;\n}\n\nexport interface TapTargetButtonSolidProps extends Omit<TapTargetButtonProps, \"tone\"> {\n /** The fill, from the system's list. Replaces bgColor / iconColor / hover / active. */\n tone?: TapSolidTone | undefined;\n bgColor?: string | undefined;\n iconColor?: string | undefined;\n hoverBgColor?: string | undefined;\n /**\n * Press-state background. Defaults to `group-active/tap:brightness-90` (the\n * BOX is what is pressed — its touch area included), which works on\n * any color. Override when using a custom `bgColor` that should darken to a\n * specific shade on press (e.g. `group-active/tap:bg-primary/60`).\n */\n activeBgColor?: string | undefined;\n}\n\n/** Native button attributes a tap button accepts — everything except `style`:\n * a tap button's geometry is the system's, never the caller's. */\nexport type TapTargetNativeProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"style\">;\n\nconst EXTERNAL_RE = /^(https?:|mailto:|tel:)/i;\n\n// Geometry + press feedback + tap hygiene are the SINGLE SOURCE OF TRUTH in\n// the shipped stylesheet (the `.matrx-tap-*` family in styles.css — import\n// \"@ai-matrx/tap-target/styles.css\" once at app root). This component only\n// picks the right class and layers each variant's decoration on top.\nconst TAP_OUTER_CLASS = \"matrx-tap-target group group/tap\";\nconst TAP_GROUP_OUTER_CLASS = \"matrx-tap-target matrx-tap-target-sm group group/tap\";\n\nfunction IconContent({\n icon,\n children,\n strokeWidth = 2,\n className,\n}: Pick<\n TapTargetButtonProps,\n \"icon\" | \"children\" | \"strokeWidth\" | \"className\"\n>) {\n if (icon) {\n if (isValidElement<{ className?: string }>(icon)) {\n return cloneElement(icon, {\n className: cn(className, icon.props.className),\n });\n }\n return <span className={className}>{icon}</span>;\n }\n return (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n {children}\n </svg>\n );\n}\n\ntype TapTargetSize = \"default\" | \"sm\";\n\nfunction resolveTapGeometry(\n label: string | undefined,\n size: TapTargetSize,\n mobileIconOnly: boolean,\n) {\n const inline = Boolean(label);\n if (size === \"sm\") {\n return {\n outerClassName:\n inline && mobileIconOnly\n ? \"matrx-tap-target matrx-tap-target-sm matrx-tap-target-mobile-icon-only-sm group group/tap\"\n : inline\n ? \"matrx-tap-target matrx-tap-target-sm matrx-tap-target-inline-sm group group/tap\"\n : TAP_GROUP_OUTER_CLASS,\n inlineModifier: mobileIconOnly\n ? \"matrx-tap-pill-mobile-icon-only-sm\"\n : \"matrx-tap-pill-inline-sm\",\n };\n }\n return {\n outerClassName:\n inline && mobileIconOnly\n ? `${TAP_OUTER_CLASS} matrx-tap-target-mobile-icon-only`\n : inline\n ? `${TAP_OUTER_CLASS} matrx-tap-target-inline`\n : TAP_OUTER_CLASS,\n inlineModifier: mobileIconOnly\n ? \"matrx-tap-pill-mobile-icon-only\"\n : \"matrx-tap-pill-inline\",\n };\n}\n\nfunction buildTapInner({\n label,\n pillClassName,\n iconClassName,\n labelClassName,\n inlineModifier,\n icon,\n children,\n strokeWidth = 2,\n loading,\n chevron,\n}: {\n label?: string | undefined;\n pillClassName: string;\n iconClassName: string;\n labelClassName?: string | undefined;\n inlineModifier: string;\n icon?: React.ReactNode;\n children?: React.ReactNode;\n strokeWidth?: number | undefined;\n loading?: boolean | undefined;\n chevron?: boolean | undefined;\n}) {\n const iconEl = loading ? (\n <TapSpinner className={iconClassName} />\n ) : (\n <IconContent\n icon={icon}\n strokeWidth={strokeWidth}\n className={iconClassName}\n >\n {children}\n </IconContent>\n );\n const pillClasses = label\n ? `${pillClassName} ${inlineModifier}`.trim()\n : pillClassName;\n\n if (!label) {\n return <div className={pillClasses}>{iconEl}</div>;\n }\n\n return (\n <div className={pillClasses}>\n {iconEl}\n <span className={labelClassName ?? \"matrx-tap-label\"}>{label}</span>\n {chevron ? <TapChevron /> : null}\n </div>\n );\n}\n\ninterface RenderTapTargetArgs extends Pick<\n TapTargetButtonProps,\n | \"icon\"\n | \"children\"\n | \"strokeWidth\"\n | \"label\"\n | \"mobileIconOnly\"\n | \"onClick\"\n | \"as\"\n | \"htmlFor\"\n | \"ariaLabel\"\n | \"disabled\"\n | \"href\"\n | \"target\"\n | \"rel\"\n | \"prefetch\"\n | \"linkComponent\"\n | \"tooltip\"\n | \"tooltipSide\"\n | \"tooltipAlign\"\n> {\n size?: TapTargetSize;\n /** The caller's raw `className` (the glyph colour) — checked by the guard. */\n colorClassName?: string | undefined;\n pillClassName: string;\n iconClassName: string;\n labelClassName?: string | undefined;\n rest?: (TapTargetNativeProps & TapFeatureProps) | undefined;\n buttonRef?: Ref<HTMLButtonElement> | undefined;\n}\n\n// A hook (it carries the guard ref); every variant calls it exactly once.\nfunction useTapTarget({\n size = \"default\",\n colorClassName,\n pillClassName,\n iconClassName,\n labelClassName,\n icon,\n children,\n strokeWidth,\n label,\n mobileIconOnly = false,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n rest,\n buttonRef,\n}: RenderTapTargetArgs): ReactElement {\n const {\n tone,\n badge,\n pressed,\n loading,\n disabledReason,\n shortcut,\n chevron,\n ...nativeRest\n } = rest ?? {};\n const isDisabled = Boolean(disabled || disabledReason);\n // FORCED TOOLTIPS: the text is the reason, an explicit tooltip, the\n // accessible name, or the label — and a button with none is a defect.\n const tipText =\n disabledReason || (typeof tooltip === \"string\" && tooltip ? tooltip : undefined) || ariaLabel || label;\n const titleMode = tooltip === false;\n const propViolation =\n (tipText ? null : \"every tap button needs a tooltip — pass ariaLabel\") ??\n classNameMisuse(colorClassName ?? nativeRest.className) ??\n ((nativeRest as { style?: unknown }).style ? \"style is not supported on a tap button\" : null);\n const guardRef = useTapGuardRef<HTMLElement>(\n buttonRef as Ref<HTMLElement> | undefined,\n propViolation,\n );\n const nodeRef = useRef<HTMLElement | null>(null);\n const triggerRef = useCallback(\n (node: HTMLElement | null) => {\n nodeRef.current = node;\n guardRef(node);\n },\n [guardRef],\n );\n const getNode = useCallback(() => nodeRef.current, []);\n useTapShortcut(shortcut, getNode, !isDisabled && !loading);\n\n // Tone (or a pressed toggle) owns the glyph and label colour.\n const toneColor = tone ? TAP_TONE_CLASS[tone] : pressed && !colorClassName ? TAP_TONE_CLASS.primary : null;\n if (toneColor) {\n iconClassName = `matrx-tap-icon ${toneColor}`;\n labelClassName = `matrx-tap-label ${toneColor}`;\n }\n if (pressed) pillClassName = `${pillClassName} matrx-tap-pressed`;\n const { outerClassName, inlineModifier } = resolveTapGeometry(\n label,\n size,\n mobileIconOnly,\n );\n const responsiveLabelClassName = mobileIconOnly\n ? `${labelClassName ?? \"matrx-tap-label\"} matrx-tap-label-mobile-icon-only`\n : labelClassName;\n const inner = buildTapInner({\n label,\n pillClassName,\n iconClassName,\n labelClassName: responsiveLabelClassName,\n inlineModifier: label ? inlineModifier : \"\",\n icon,\n children,\n strokeWidth,\n loading,\n chevron,\n });\n const triggerAriaLabel =\n label && !mobileIconOnly ? undefined : (ariaLabel ?? label);\n const trigger = renderTrigger({\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n as,\n htmlFor,\n onClick: loading ? undefined : onClick,\n ariaLabel: triggerAriaLabel,\n disabled: isDisabled,\n outerClassName,\n title: titleMode && tipText ? (shortcut ? `${tipText} (${formatShortcut(shortcut)})` : tipText) : undefined,\n children: (\n <>\n {inner}\n {badge !== undefined ? <TapBadge badge={badge} /> : null}\n </>\n ),\n rest: {\n ...nativeRest,\n ...(pressed !== undefined ? { \"aria-pressed\": pressed } : {}),\n ...(loading ? { \"aria-busy\": true } : {}),\n ...(shortcut ? { \"aria-keyshortcuts\": shortcut.replace(/mod/i, \"Meta\") } : {}),\n },\n triggerRef,\n });\n if (titleMode || !tipText) return trigger;\n return withTooltip(trigger, {\n tooltip: tipText,\n ariaLabel: tipText,\n disabled: isDisabled,\n tooltipSide,\n tooltipAlign,\n shortcut,\n });\n}\n\ninterface RenderTriggerArgs {\n href?: string | undefined;\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\" | undefined;\n rel?: string | undefined;\n prefetch?: boolean | null | undefined;\n linkComponent?: TapTargetLinkComponent | undefined;\n as?: \"button\" | \"label\" | undefined;\n htmlFor?: string | undefined;\n onClick?: (() => void) | undefined;\n ariaLabel?: string | undefined;\n disabled?: boolean | undefined;\n outerClassName: string;\n children: ReactNode;\n rest?: ButtonHTMLAttributes<HTMLButtonElement> | undefined;\n triggerRef: Ref<HTMLElement>;\n /** Tooltip text drawn through `title` (tooltip={false}: a nested trigger). */\n title?: string | undefined;\n}\n\n/**\n * Resolves the correct trigger element based on the props passed.\n *\n * - `href` + `disabled` → unclickable `<span aria-disabled>`\n * - `href` matching `http(s):|mailto:|tel:` → `<a target=\"_blank\" rel=\"noopener noreferrer\">`\n * - `href` (internal) → the injected link component (per-instance\n * `linkComponent` prop, else `setTapTargetLinkComponent` registration),\n * falling back to a plain `<a>` when none is registered\n * - `as=\"label\"` → `<label htmlFor=...>`\n * - default → `<button>`\n */\nfunction renderTrigger({\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n as,\n htmlFor,\n onClick,\n ariaLabel,\n disabled,\n outerClassName,\n children,\n rest,\n triggerRef,\n title,\n}: RenderTriggerArgs): ReactElement {\n const { style: _style, ...restWithoutStyle } = rest ?? {};\n if (disabled && href) {\n return (\n <span\n ref={triggerRef}\n aria-disabled=\"true\"\n aria-label={ariaLabel}\n title={title}\n className={`${outerClassName} opacity-40 pointer-events-none`}\n >\n {children}\n </span>\n );\n }\n if (href) {\n const isExternal = EXTERNAL_RE.test(href);\n if (isExternal) {\n return (\n <a\n ref={triggerRef as Ref<HTMLAnchorElement>}\n href={href}\n target={target ?? \"_blank\"}\n rel={rel ?? \"noopener noreferrer\"}\n aria-label={ariaLabel}\n title={title}\n className={outerClassName}\n >\n {children}\n </a>\n );\n }\n const Link = linkComponent ?? getTapTargetLinkComponent();\n if (Link) {\n return (\n <Link\n ref={triggerRef as Ref<HTMLAnchorElement>}\n href={href}\n target={target}\n rel={rel}\n prefetch={prefetch}\n aria-label={ariaLabel}\n title={title}\n className={outerClassName}\n >\n {children}\n </Link>\n );\n }\n // No link component registered — plain <a>. `prefetch` is a router hint,\n // not a DOM attribute, so it is deliberately dropped here.\n return (\n <a\n ref={triggerRef as Ref<HTMLAnchorElement>}\n href={href}\n target={target}\n rel={rel}\n aria-label={ariaLabel}\n title={title}\n className={outerClassName}\n >\n {children}\n </a>\n );\n }\n if (as === \"label\") {\n return (\n <label\n ref={triggerRef as Ref<HTMLLabelElement>}\n htmlFor={htmlFor}\n aria-label={ariaLabel}\n title={title}\n className={outerClassName}\n >\n {children}\n </label>\n );\n }\n return (\n <button\n ref={triggerRef as Ref<HTMLButtonElement>}\n type=\"button\"\n onClick={onClick}\n aria-label={ariaLabel}\n title={title}\n disabled={disabled}\n {...restWithoutStyle}\n className={outerClassName}\n >\n {children}\n </button>\n );\n}\n\n/**\n * Wraps a trigger element in a Tooltip when a tooltip label is available.\n * Falls back to `ariaLabel` when `tooltip` is not explicitly set. If both\n * are absent (or `tooltip === false`), the trigger is returned unwrapped.\n */\nfunction withTooltip(\n trigger: ReactElement,\n {\n tooltip,\n ariaLabel,\n disabled,\n tooltipSide = \"top\",\n tooltipAlign = \"center\",\n shortcut,\n }: {\n tooltip?: string | false | undefined;\n ariaLabel?: string | undefined;\n disabled?: boolean | undefined;\n tooltipSide?: \"top\" | \"right\" | \"bottom\" | \"left\" | undefined;\n tooltipAlign?: \"start\" | \"center\" | \"end\" | undefined;\n shortcut?: TapShortcut | undefined;\n },\n): ReactElement {\n if (tooltip === false) return trigger;\n const label =\n typeof tooltip === \"string\" && tooltip.length > 0 ? tooltip : ariaLabel;\n if (!label) return trigger;\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n {disabled ? (\n // Radix Tooltip triggers need a hoverable element; a disabled button\n // does not dispatch pointer events, so we wrap in a span for the\n // trigger target while keeping the disabled visual state.\n <span className=\"inline-flex\">{trigger}</span>\n ) : (\n trigger\n )}\n </TooltipTrigger>\n <TooltipContent side={tooltipSide} align={tooltipAlign}>\n {tooltipBody(label, shortcut)}\n </TooltipContent>\n </Tooltip>\n );\n}\n\n// To resize/retune every tap button, edit styles.css — not here.\n\nexport const TapTargetButton = forwardRef<\n HTMLButtonElement,\n TapTargetButtonProps & TapTargetNativeProps\n>(function TapTargetButton(\n {\n icon,\n children,\n strokeWidth = 2,\n onClick,\n className,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...rest\n },\n ref,\n) {\n const color = className ?? \"text-foreground\";\n return useTapTarget({\n colorClassName: className,\n icon,\n children,\n strokeWidth,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n pillClassName: \"matrx-tap-pill matrx-glass-thin-border\",\n iconClassName: `matrx-tap-icon ${color}`,\n rest,\n buttonRef: ref,\n });\n});\n\nexport const TapTargetButtonTransparent = forwardRef<\n HTMLButtonElement,\n TapTargetButtonProps & TapTargetNativeProps\n>(function TapTargetButtonTransparent(\n {\n icon,\n children,\n strokeWidth = 2,\n onClick,\n className,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...rest\n },\n ref,\n) {\n const color = className ?? \"text-foreground\";\n return useTapTarget({\n colorClassName: className,\n icon,\n children,\n strokeWidth,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n pillClassName:\n \"matrx-tap-pill group-hover/tap:bg-muted group-active/tap:bg-muted-foreground/15\",\n iconClassName: `matrx-tap-icon ${color}`,\n rest,\n buttonRef: ref,\n });\n});\n\n/** Outline pill — a plain 1px border, no fill, no blur, no shadow. Glass only\n * reads as glass over something you can see through; on an opaque card or\n * header use THIS. Same colors as the classic square \"+\": border-border,\n * muted glyph, primary border + foreground glyph on hover. */\nexport const TapTargetButtonOutline = forwardRef<\n HTMLButtonElement,\n TapTargetButtonProps & TapTargetNativeProps\n>(function TapTargetButtonOutline(\n {\n icon,\n children,\n strokeWidth = 2,\n onClick,\n className,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...rest\n },\n ref,\n) {\n const color =\n className ?? \"text-muted-foreground group-hover/tap:text-foreground\";\n return useTapTarget({\n colorClassName: className,\n icon,\n children,\n strokeWidth,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n pillClassName:\n \"matrx-tap-pill border border-border bg-transparent transition-colors group-hover/tap:border-primary/60 group-active/tap:bg-muted\",\n iconClassName: `matrx-tap-icon ${color}`,\n labelClassName: `matrx-tap-label ${color}`,\n rest,\n buttonRef: ref,\n });\n});\n\nexport const TapTargetButtonSolid = forwardRef<\n HTMLButtonElement,\n TapTargetButtonSolidProps & TapTargetNativeProps\n>(function TapTargetButtonSolid(\n {\n icon,\n children,\n strokeWidth = 2,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tone,\n bgColor,\n iconColor,\n hoverBgColor,\n activeBgColor,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...rest\n },\n ref,\n) {\n return useTapTarget({\n icon,\n children,\n strokeWidth,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...solidClasses(tone, bgColor, iconColor, hoverBgColor, activeBgColor),\n rest,\n buttonRef: ref,\n });\n});\n\n// `tone` is the system's fill; the four colour strings are the pre-tone API,\n// accepted only until their last callers move to `tone`.\nfunction solidClasses(\n tone: TapSolidTone | undefined,\n bgColor: string | undefined,\n iconColor: string | undefined,\n hoverBgColor: string | undefined,\n activeBgColor: string | undefined,\n) {\n const legacy = !tone && (bgColor || iconColor || hoverBgColor || activeBgColor);\n if (!legacy) {\n const t = TAP_SOLID_TONE[tone ?? \"primary\"];\n return {\n pillClassName: `matrx-tap-pill ${t.fill} ${t.glyph} group-active/tap:brightness-90`,\n iconClassName: `matrx-tap-icon ${t.glyph}`,\n labelClassName: `matrx-tap-label ${t.glyph}`,\n };\n }\n const glyph = iconColor ?? \"text-primary-foreground\";\n return {\n pillClassName: `matrx-tap-pill ${bgColor ?? \"bg-primary\"} ${glyph} ${hoverBgColor ?? \"group-hover/tap:bg-primary/80\"} ${activeBgColor ?? \"group-active/tap:brightness-90\"}`,\n iconClassName: `matrx-tap-icon ${glyph}`,\n labelClassName: `matrx-tap-label ${glyph}`,\n };\n}\n\n/** Solid destructive pill — delete/remove actions. White-on-red like the\n * primary solid is white-on-blue. Use THIS, never hand-pass bg-destructive\n * with the default (dark) icon color. */\nexport const TapTargetButtonDestructive = forwardRef<\n HTMLButtonElement,\n TapTargetButtonSolidProps & TapTargetNativeProps\n>(function TapTargetButtonDestructive({ tone = \"destructive\", ...rest }, ref) {\n return <TapTargetButtonSolid ref={ref} tone={tone} {...rest} />;\n});\n\nexport const TapTargetButtonForGroup = forwardRef<\n HTMLButtonElement,\n TapTargetButtonProps & TapTargetNativeProps\n>(function TapTargetButtonForGroup(\n {\n icon,\n children,\n strokeWidth = 2,\n onClick,\n className,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...rest\n },\n ref,\n) {\n const color = className ?? \"text-foreground\";\n return useTapTarget({\n colorClassName: className,\n size: \"sm\",\n icon,\n children,\n strokeWidth,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n pillClassName: \"matrx-tap-pill matrx-tap-pill-sm matrx-glass-interactive\",\n iconClassName: `matrx-tap-icon ${color}`,\n labelClassName: `matrx-tap-label ${color}`,\n rest,\n buttonRef: ref,\n });\n});\n\nexport function TapTargetButtonGroup({\n children,\n className,\n surface = \"glass\",\n}: {\n children: React.ReactNode;\n className?: string | undefined;\n /**\n * GLASS ONLY FLOATS (owner rule, 2026-10-02): glass belongs on a bar that\n * floats over scrolling content or a see-through plane. On a solid surface\n * (a page, a card, a toast, a table toolbar) use `\"solid\"`: a muted track,\n * no glass stroke, the same geometry.\n */\n surface?: \"glass\" | \"solid\" | undefined;\n}) {\n // Geometry (height, the half-gap outside the capsule, the capsule itself)\n // is `.matrx-tap-group*` in tap-target.css.\n return (\n <div\n className={className ? `matrx-tap-group ${className}` : \"matrx-tap-group\"}\n data-surface={surface}\n >\n <div\n className={\n surface === \"solid\"\n ? \"matrx-tap-group-capsule matrx-tap-group-capsule-solid\"\n : \"matrx-tap-group-capsule matrx-glass-thin-border\"\n }\n />\n <div className=\"matrx-tap-group-row\">{children}</div>\n </div>\n );\n}\n","/**\n * Minimal className join — the only piece of `cn` this package needs.\n * No tailwind-merge / clsx dependency by design: callers pass literal strings.\n */\nexport function cn(\n ...values: Array<string | null | undefined | false>\n): string {\n return values.filter(Boolean).join(\" \").trim();\n}\n","\"use client\";\n\n// THE TAP-TARGET GUARD — development builds only.\n//\n// The lock layer in tap-target.css makes a tap button's own box, pill and\n// glyph impossible to resize from outside. What CSS cannot stop is a caller\n// bending the system AROUND the button: a parent that adds `gap` between two\n// tap buttons, a wrapper with margin or padding, a local override of a\n// `--matrx-tap-*` token, a utility class smuggled in through `className`.\n// After a tap button mounts, this guard measures it in the real layout and,\n// on any of those, marks it `data-matrx-tap-violation`: the stylesheet then\n// paints it as a giant red box carrying the reason, and the console names\n// the element.\n//\n// OFF until the host turns it on with `enableTapTargetGuard()` — from code the\n// HOST compiles, e.g. matrx-frontend's dev-only client boot. Never gate it on\n// `process.env.NODE_ENV` in here: this package's own build inlines that\n// expression, so a \"dev only\" check written here would run in production too\n// (see @ai-matrx/associations' context.tsx for the outage that taught this).\n\nimport { useCallback, useRef, type MutableRefObject, type Ref } from \"react\";\n\n// A `Symbol.for` slot on globalThis, like the link seam: the `.` and\n// `./buttons` bundles each inline this module, and one switch must reach both.\nconst GUARD_SLOT = Symbol.for(\"@ai-matrx/tap-target:guard\");\ntype GlobalWithGuard = typeof globalThis & { [GUARD_SLOT]?: boolean };\n\n/** Turn the development guard on (or off). Call once at client boot, only in\n * development builds of the host. */\nexport function enableTapTargetGuard(on = true): void {\n (globalThis as GlobalWithGuard)[GUARD_SLOT] = on;\n}\n\nfunction guardOn(): boolean {\n return (globalThis as GlobalWithGuard)[GUARD_SLOT] === true;\n}\n\nconst TOKENS = [\n \"--matrx-tap-box\",\n \"--matrx-tap-gap\",\n \"--matrx-tap-pill-size\",\n \"--matrx-tap-pill-sm-size\",\n \"--matrx-tap-wide-size\",\n \"--matrx-tap-icon-size\",\n \"--matrx-tap-touch-min\",\n \"--matrx-tap-target-size\",\n] as const;\n\n/** The only scopes that may move tap tokens, and which ones — each owned by\n * this package's own CSS: the table density scales (tap-target.css) and\n * Alchemy's 18px trigger glyph (content-transfer.css). */\nconst SANCTIONED: ReadonlyArray<{ scope: string; tokens: ReadonlySet<string> }> = [\n {\n scope: \"[data-matrx-table][data-matrx-table-density]\",\n tokens: new Set([\n \"--matrx-tap-target-size\",\n \"--matrx-tap-pill-size\",\n \"--matrx-tap-wide-size\",\n \"--matrx-tap-pill-sm-size\",\n \"--matrx-tap-icon-size\",\n ]),\n },\n { scope: \"[data-alchemy-trigger]\", tokens: new Set([\"--matrx-tap-icon-size\"]) },\n];\nconst TABLE_SCOPE = SANCTIONED[0]!.scope;\nconst TAP_ITEM = \".matrx-tap-target, .matrx-tap-group\";\n\n/** `className` on a tap button is the GLYPH COLOUR. Anything that sizes,\n * spaces, positions or fills is misuse. */\nconst NON_COLOUR_CLASS =\n /^(?:[^\\s:]+:)*!?-?(?:\\[&|scale|translate|h|w|size|min-h|min-w|max-h|max-w|p|px|py|ps|pe|pt|pb|pl|pr|m|mx|my|ms|me|mt|mb|ml|mr|gap|space-x|space-y|bg|rounded|border|ring|shadow|absolute|relative|fixed|sticky|inset|top|left|right|bottom|flex|grid|block|inline|hidden|z|shrink|grow|basis|self|order)(?:-|$|\\[)/;\n\nexport function classNameMisuse(className: string | undefined): string | null {\n if (!guardOn() || !className) return null;\n const bad = className.split(/\\s+/).filter((t) => t && NON_COLOUR_CLASS.test(t));\n return bad.length\n ? `className is the glyph colour only — remove \"${bad.join(\" \")}\"`\n : null;\n}\n\nfunction px(value: string): number {\n const n = Number.parseFloat(value);\n return Number.isFinite(n) ? n : 0;\n}\n\nfunction describe(el: Element): string {\n const cls = typeof el.className === \"string\" ? el.className.trim().split(/\\s+/).slice(0, 4).join(\".\") : \"\";\n return `<${el.tagName.toLowerCase()}${cls ? `.${cls}` : \"\"}>`;\n}\n\n/** Elements that ride along with a tap button without taking space from it\n * (a badge, a capsule, a tooltip portal anchor). */\nfunction isDecor(el: Element, view: Window): boolean {\n const cs = view.getComputedStyle(el);\n return cs.position === \"absolute\" || cs.position === \"fixed\" || cs.display === \"none\";\n}\n\nfunction tapCount(el: Element): number {\n return el.matches(TAP_ITEM) ? 1 : el.querySelectorAll(TAP_ITEM).length;\n}\n\n/** Visible text in `container` outside `tap` and outside decor (a badge's\n * count is decor) — a wrapper with its own words is a chip, not a wrapper. */\nfunction ownText(container: Element, tap: Element, view: Window): string {\n let out = \"\";\n const walk = (node: Node) => {\n if (node === tap) return;\n if (node.nodeType === 3) out += node.textContent ?? \"\";\n else if (node.nodeType === 1 && !isDecor(node as Element, view)) node.childNodes.forEach(walk);\n };\n container.childNodes.forEach(walk);\n return out.trim();\n}\n\n/** True when `child` is a tap button, or a plain wrapper whose only content\n * is ONE tap button (plus decor) — never a search box that happens to hold\n * a clear button, never a chip with words. */\nfunction isTapSlot(child: Element, view: Window): boolean {\n if (child.matches(TAP_ITEM)) return true;\n if (tapCount(child) !== 1) return false;\n const tap = child.querySelector(TAP_ITEM)!;\n const controls = Array.from(child.querySelectorAll(\"input, select, textarea, button, a, [role='button']\"));\n if (controls.some((c) => c !== tap && !tap.contains(c))) return false;\n return ownText(child, tap, view) === \"\";\n}\n\nlet probe: { key: string; target: number; pill: number; sm: number; smPill: number; wide: number; icon: number } | null = null;\n\n/** What the package's own CSS produces with no surrounding context — the\n * canon every mounted button is measured against. Re-measured whenever the\n * root tokens change (the lab page switches the gap). */\nfunction canon(doc: Document) {\n const view = doc.defaultView!;\n const root = view.getComputedStyle(doc.documentElement);\n const key = TOKENS.map((t) => root.getPropertyValue(t)).join(\"|\");\n if (probe?.key === key) return probe;\n const host = doc.createElement(\"div\");\n host.setAttribute(\"aria-hidden\", \"true\");\n host.style.cssText = \"position:absolute;visibility:hidden;pointer-events:none;left:-9999px;top:0\";\n host.innerHTML =\n '<button class=\"matrx-tap-target\"><div class=\"matrx-tap-pill\"><svg class=\"matrx-tap-icon\"></svg></div></button>' +\n '<button class=\"matrx-tap-target matrx-tap-target-sm\"><div class=\"matrx-tap-pill matrx-tap-pill-sm\"></div></button>' +\n '<button class=\"matrx-tap-target matrx-tap-target-inline\"><div class=\"matrx-tap-pill matrx-tap-pill-inline\"></div></button>';\n doc.body.appendChild(host);\n const [a, b, w] = Array.from(host.children) as HTMLElement[];\n probe = {\n key,\n target: a!.offsetHeight,\n pill: (a!.firstElementChild as HTMLElement).offsetHeight,\n icon: px(view.getComputedStyle(a!.querySelector(\"svg\")!).height),\n sm: b!.offsetHeight,\n smPill: (b!.firstElementChild as HTMLElement).offsetHeight,\n wide: (w!.firstElementChild as HTMLElement).offsetHeight,\n };\n host.remove();\n return probe;\n}\n\n/** Returns the first rule this mounted tap button breaks, or null. */\nexport function findTapViolation(el: HTMLElement): string | null {\n const doc = el.ownerDocument;\n const view = doc.defaultView;\n if (!view || !el.isConnected) return null;\n const cs = view.getComputedStyle(el);\n if (cs.display === \"none\") return null;\n\n // 1. Tokens are the package's alone. Only the table-density scope may move\n // the three it owns.\n const root = view.getComputedStyle(doc.documentElement);\n const inTable = el.closest(TABLE_SCOPE) !== null;\n const moved = new Set<string>();\n for (const token of TOKENS) {\n const mine = cs.getPropertyValue(token).trim();\n const base = root.getPropertyValue(token).trim();\n if (mine === base) continue;\n if (!SANCTIONED.some((s) => s.tokens.has(token) && el.closest(s.scope))) {\n return `${token} overridden to \"${mine}\" — tap geometry is not configurable`;\n }\n moved.add(token);\n }\n\n // 2. Measured geometry equals the canon (outside table density, which\n // sizes by its own tokens).\n const sm = el.classList.contains(\"matrx-tap-target-sm\");\n const inline = /matrx-tap-target-(?:inline|mobile-icon-only)/.test(el.className);\n const pill = el.querySelector<HTMLElement>(\":scope > .matrx-tap-pill\");\n const icon = pill?.querySelector(\".matrx-tap-icon\") ?? null;\n // A host touch floor (min-width / min-height) may enlarge a box; that is\n // the floor working, not a bend.\n const floored =\n px(cs.minHeight) >= el.offsetHeight - 0.5 || px(cs.minWidth) >= el.offsetWidth - 0.5;\n if (!inTable && pill && !floored) {\n const c = canon(doc);\n const box = sm ? c.sm : c.target;\n // A labelled pill is a WIDE shape (shorter than a round one); below the\n // `sm` breakpoint a mobile-icon-only pill is round again — either is canon.\n const pillSizes = sm ? [c.smPill] : inline ? [c.pill, c.wide] : [c.pill];\n if (Math.abs(el.offsetHeight - box) > 0.5) return `button is ${el.offsetHeight}px tall, canon is ${box}px`;\n if (!inline && Math.abs(el.offsetWidth - box) > 0.5) return `button is ${el.offsetWidth}px wide, canon is ${box}px`;\n if (!pillSizes.some((p) => Math.abs(pill.offsetHeight - p) <= 0.5)) {\n return `pill is ${pill.offsetHeight}px, canon is ${pillSizes.join(\" or \")}px`;\n }\n if (icon && !moved.has(\"--matrx-tap-icon-size\")) {\n const size = px(view.getComputedStyle(icon).height);\n if (Math.abs(size - c.icon) > 0.5) return `glyph is ${size}px, canon is ${c.icon}px`;\n }\n }\n\n // 3. Nothing adds space around it. Climb the wrappers that hold only this\n // button (plus decor such as a badge); none may carry inline margin or\n // padding. A tap button inside a group is represented by its group.\n let slot: Element = el;\n if (el.parentElement?.matches(\".matrx-tap-group-row, .matrx-tap-search-measure\")) {\n const group = el.closest(\".matrx-tap-group\");\n if (group && tapCount(el.parentElement) > 1) return null;\n slot = group ?? el;\n }\n for (let depth = 0; depth < 2; depth += 1) {\n const parent: HTMLElement | null = slot.parentElement;\n if (!parent || parent === doc.body) break;\n const others = Array.from(parent.children).filter((c) => c !== slot && !isDecor(c, view));\n if (others.length > 0) break; // `parent` is the row\n if (ownText(parent, slot, view) !== \"\") break; // a chip or a titled header\n const pcs = view.getComputedStyle(parent);\n const space = px(pcs.marginLeft) + px(pcs.marginRight) + px(pcs.paddingLeft) + px(pcs.paddingRight);\n if (space > 0.5) {\n return `${describe(parent)} adds ${space}px around a tap button — tap buttons space themselves`;\n }\n slot = parent;\n }\n\n // 4. The row adds no gap between tap buttons.\n const row = slot.parentElement;\n if (row) {\n const rcs = view.getComputedStyle(row);\n const flexOrGrid = /flex|grid/.test(rcs.display);\n const neighbours = Array.from(row.children).filter((c) => c !== slot && isTapSlot(c, view));\n if (flexOrGrid && neighbours.length > 0) {\n const horizontal = rcs.display.includes(\"grid\") || !rcs.flexDirection.startsWith(\"column\");\n const gap = px(horizontal ? rcs.columnGap : rcs.rowGap);\n if (gap > 0.5) {\n return `${describe(row)} adds a ${gap}px gap between tap buttons — remove it; tap buttons space themselves`;\n }\n }\n }\n return null;\n}\n\n/* ------------------------------------------------------------------ */\n/* PLACEMENT — the three rules a tap button's SURROUNDINGS must keep */\n/* (owner, 2026-10-02). Reported as a WARNING (a dashed outline and one */\n/* console error naming the fix), not the misuse box: they are about */\n/* the page around the button, and the whole app is being brought into */\n/* line with them. */\n/* 1. GLASS ONLY FLOATS — glass is see-through; it belongs on a bar */\n/* that floats over moving content (position fixed/sticky) or on a */\n/* plane marked `data-matrx-glass-plane`. On a page, card, toast or */\n/* table use `variant=\"transparent\"` / a solid group. */\n/* 2. ALL GLASS OR NONE — a glass item's row holds only glass items */\n/* (glass tap buttons, glass groups, or `data-matrx-glass` pieces). */\n/* 3. NEIGHBOURS KEEP THEIR HALF-GAP — a tap box carries 3px of unseen */\n/* space each side (box − pill = one gap, 6px). Anything beside it */\n/* adds its own 3px, so the visible distance is always one gap. */\n/* ------------------------------------------------------------------ */\n\nconst GLASS = \".matrx-glass-thin-border, .matrx-glass-interactive\";\n\nfunction isGlassItem(node: Element): boolean {\n if (node.hasAttribute(\"data-matrx-glass\")) return true;\n if (node.matches(\".matrx-tap-group\")) return node.querySelector(\":scope > .matrx-tap-group-capsule.matrx-glass-thin-border\") !== null;\n if (node.matches(\".matrx-tap-target\")) return node.querySelector(`:scope > .matrx-tap-pill:is(${GLASS})`) !== null;\n // A plain wrapper whose only content is ONE tap button (plus decor such as a\n // badge) is that button: a badge host around a glass button is glass.\n const view = node.ownerDocument.defaultView;\n if (view && isTapSlot(node, view)) return isGlassItem(node.querySelector(TAP_ITEM)!);\n return false;\n}\n\nconst SCROLLS = /^(auto|scroll|overlay)$/;\n\n/** True when `el` rides a bar over moving content: a fixed/sticky ancestor (or\n * a glass plane) reached BEFORE any scroll container. Inside a scroller the\n * button IS the moving content — an app root that is itself `position:\n * fixed` (the shell) must not make every page button \"float\". */\nfunction floats(el: Element, view: Window): boolean {\n for (let n: Element | null = el; n && n !== el.ownerDocument.body; n = n.parentElement) {\n if (n.hasAttribute(\"data-matrx-glass-plane\")) return true;\n const cs = view.getComputedStyle(n);\n if (cs.position === \"fixed\" || cs.position === \"sticky\") return true;\n if (n !== el && (SCROLLS.test(cs.overflowY) || SCROLLS.test(cs.overflowX))) return false;\n }\n return false;\n}\n\nfunction visible(el: Element, view: Window): boolean {\n if (el.getAttribute(\"aria-hidden\") === \"true\" || isDecor(el, view)) return false;\n const r = el.getBoundingClientRect();\n return r.width > 1 && r.height > 1;\n}\n\n/** The first placement rule this tap button's surroundings break, or null. */\nexport function findTapPlacementWarning(el: HTMLElement): string | null {\n const doc = el.ownerDocument;\n const view = doc.defaultView;\n if (!view || !el.isConnected) return null;\n // A button inside a group is judged as its group.\n const slot: Element = el.closest(\".matrx-tap-group\") ?? el;\n const glass = isGlassItem(slot);\n\n if (glass && !floats(slot, view)) {\n return 'glass on a solid surface — glass only floats over moving content; use variant=\"transparent\" (or a solid group)';\n }\n\n const row = slot.parentElement;\n if (!row) return null;\n if (glass) {\n const mixed = Array.from(row.children).find((c) => c !== slot && visible(c, view) && !isGlassItem(c));\n if (mixed) return `glass beside non-glass ${describe(mixed)} — make the row all glass or none`;\n }\n\n const pill = (el.querySelector(\":scope > .matrx-tap-pill\") as HTMLElement | null) ?? (slot.querySelector(\".matrx-tap-group-capsule\") as HTMLElement | null);\n if (!pill) return null;\n const gap = px(view.getComputedStyle(el).getPropertyValue(\"--matrx-tap-gap\")) || 6;\n const p = pill.getBoundingClientRect();\n if (p.width === 0) return null;\n for (const [side, sib] of [[\"after\", slot.nextElementSibling], [\"before\", slot.previousElementSibling]] as const) {\n if (!sib || !visible(sib, view) || isTapSlot(sib, view) || isGlassItem(sib)) continue;\n const r = sib.getBoundingClientRect();\n if (Math.abs(r.top + r.height / 2 - (p.top + p.height / 2)) > p.height) continue; // not on this row\n const cs = view.getComputedStyle(sib);\n const distance = side === \"after\" ? r.left + px(cs.paddingLeft) - p.right : p.left - (r.right - px(cs.paddingRight));\n if (distance < gap - 0.5) {\n return `${describe(sib)} sits ${Math.round(distance)}px from the pill — anything beside a tap button adds its own ${gap / 2}px (the box only carries ${gap / 2}px)`;\n }\n }\n return null;\n}\n\nconst reported = new Set<string>();\n\nfunction report(el: HTMLElement, reason: string) {\n el.setAttribute(\"data-matrx-tap-violation\", reason);\n const key = `${reason}@${el.getAttribute(\"aria-label\") ?? el.textContent ?? \"\"}`;\n if (reported.has(key)) return;\n reported.add(key);\n console.error(`[tap-target] ${reason}`, el);\n}\n\nconst mounted = new Set<HTMLElement>();\nlet resizeTimer: ReturnType<typeof setTimeout> | null = null;\nlet listening = false;\n\nfunction check(node: HTMLElement) {\n const reason = findTapViolation(node);\n if (reason) {\n report(node, reason);\n return;\n }\n node.removeAttribute(\"data-matrx-tap-violation\");\n const warning = findTapPlacementWarning(node);\n if (warning) {\n node.setAttribute(\"data-matrx-tap-warning\", warning);\n const key = `w:${warning}@${node.getAttribute(\"aria-label\") ?? \"\"}`;\n if (!reported.has(key)) {\n reported.add(key);\n console.error(`[tap-target] ${warning}`, node);\n }\n } else node.removeAttribute(\"data-matrx-tap-warning\");\n}\n\nfunction listenForResize(view: Window) {\n if (listening) return;\n listening = true;\n view.addEventListener(\"resize\", () => {\n if (resizeTimer) clearTimeout(resizeTimer);\n resizeTimer = setTimeout(() => mounted.forEach((n) => (n.isConnected ? check(n) : mounted.delete(n))), 200);\n });\n}\n\nfunction assignRef<T>(ref: Ref<T> | undefined, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) (ref as MutableRefObject<T | null>).current = value;\n}\n\n/**\n * The callback ref every tap trigger carries. In production it only forwards\n * the caller's ref; in development it also measures the trigger once it is in\n * the layout and paints a violation.\n */\nexport function useTapGuardRef<T extends HTMLElement>(\n forwarded: Ref<T> | undefined,\n propViolation: string | null,\n): (node: T | null) => void {\n const current = useRef<T | null>(null);\n return useCallback(\n (node: T | null) => {\n assignRef(forwarded, node);\n if (current.current && current.current !== node) mounted.delete(current.current);\n current.current = node;\n if (!guardOn() || !node) return;\n if (propViolation) {\n report(node, propViolation);\n return;\n }\n const view = node.ownerDocument.defaultView;\n if (!view) return;\n mounted.add(node);\n listenForResize(view);\n view.requestAnimationFrame(() => check(node));\n },\n [forwarded, propViolation],\n );\n}\n","\"use client\";\n\n// THE BUILT-IN CAPABILITIES of every tap button — each one an enum or a flag,\n// never a class a caller writes. Rendering and geometry live in tap-target.css\n// (`.matrx-tap-badge`, `.matrx-tap-pressed`, `.matrx-tap-chevron`, …).\n\nimport { useEffect, type ReactNode } from \"react\";\n\nimport { MOTION_SPIN } from \"../motion\";\n\n/** Glyph colour. Replaces the free-form `className`. */\nexport type TapTone = \"default\" | \"muted\" | \"primary\" | \"destructive\" | \"success\" | \"warning\" | \"info\";\n\n/** Fill of a solid button. Replaces `bgColor` / `iconColor` / hover / active. */\nexport type TapSolidTone = \"primary\" | \"destructive\" | \"success\" | \"warning\" | \"neutral\";\n\nexport const TAP_TONE_CLASS: Record<TapTone, string> = {\n default: \"text-foreground\",\n muted: \"text-muted-foreground group-hover/tap:text-foreground\",\n primary: \"text-primary\",\n destructive: \"text-destructive\",\n success: \"text-success\",\n warning: \"text-warning\",\n info: \"text-info\",\n};\n\nexport const TAP_SOLID_TONE: Record<TapSolidTone, { fill: string; glyph: string }> = {\n primary: { fill: \"bg-primary group-hover/tap:bg-primary/85\", glyph: \"text-primary-foreground\" },\n destructive: { fill: \"bg-destructive group-hover/tap:bg-destructive/85\", glyph: \"text-destructive-foreground\" },\n success: { fill: \"bg-success group-hover/tap:bg-success/85\", glyph: \"text-success-foreground\" },\n warning: { fill: \"bg-warning group-hover/tap:bg-warning/85\", glyph: \"text-warning-foreground\" },\n neutral: { fill: \"bg-foreground group-hover/tap:bg-foreground/85\", glyph: \"text-background\" },\n};\n\n/**\n * A keyboard shortcut: modifiers joined by \"+\", then one key —\n * \"mod+k\" (⌘ on Apple, Ctrl elsewhere), \"shift+mod+p\", \"alt+n\", \"/\", \"?\".\n */\nexport type TapShortcut = string;\n\nexport interface TapFeatureProps {\n /** Glyph colour, from the system's list. */\n tone?: TapTone | undefined;\n /** A count (99+ past 99) or a dot, drawn on the pill's corner by the system. */\n badge?: number | \"dot\" | undefined;\n /** A toggle that is on (sidebar open, filter on): tinted pill + aria-pressed. */\n pressed?: boolean | undefined;\n /** Work in flight: the glyph becomes a spinner and presses are ignored. */\n loading?: boolean | undefined;\n /** Why the button cannot be used — disables it and becomes its tooltip. */\n disabledReason?: string | undefined;\n /** Keyboard shortcut that presses the button; shown in its tooltip. */\n shortcut?: TapShortcut | undefined;\n /** A menu trigger: a small chevron after the label. */\n chevron?: boolean | undefined;\n}\n\nconst IS_APPLE =\n typeof navigator !== \"undefined\" && /Mac|iPhone|iPad|iPod/.test(navigator.platform || navigator.userAgent);\n\ninterface ParsedShortcut {\n mod: boolean;\n shift: boolean;\n alt: boolean;\n key: string;\n}\n\nexport function parseShortcut(shortcut: TapShortcut): ParsedShortcut {\n const parts = shortcut.toLowerCase().split(\"+\");\n const key = parts.pop() ?? \"\";\n return { mod: parts.includes(\"mod\"), shift: parts.includes(\"shift\"), alt: parts.includes(\"alt\"), key };\n}\n\n/** \"mod+k\" → \"⌘K\" on Apple, \"Ctrl+K\" elsewhere. */\nexport function formatShortcut(shortcut: TapShortcut): string {\n const p = parseShortcut(shortcut);\n const key = p.key.length === 1 ? p.key.toUpperCase() : p.key[0]!.toUpperCase() + p.key.slice(1);\n if (IS_APPLE) return `${p.alt ? \"⌥\" : \"\"}${p.shift ? \"⇧\" : \"\"}${p.mod ? \"⌘\" : \"\"}${key}`;\n return [p.mod && \"Ctrl\", p.alt && \"Alt\", p.shift && \"Shift\", key].filter(Boolean).join(\"+\");\n}\n\nfunction isTyping(target: EventTarget | null): boolean {\n const el = target as HTMLElement | null;\n return !!el && (el.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName));\n}\n\nexport function matchesShortcut(e: KeyboardEvent, shortcut: TapShortcut): boolean {\n const p = parseShortcut(shortcut);\n if ((e.metaKey || e.ctrlKey) !== p.mod || e.altKey !== p.alt) return false;\n // \"?\" and other shifted symbols arrive with shiftKey set — only compare\n // shift for letters and named keys.\n if (/^[a-z0-9]$|^[a-z]{2,}$/.test(p.key) && e.shiftKey !== p.shift) return false;\n if (!p.mod && isTyping(e.target)) return false;\n return e.key.toLowerCase() === p.key;\n}\n\n/** Presses `node` when its shortcut is typed anywhere on the page. */\nexport function useTapShortcut(shortcut: TapShortcut | undefined, getNode: () => HTMLElement | null, enabled: boolean) {\n useEffect(() => {\n if (!shortcut || !enabled) return;\n const onKey = (e: KeyboardEvent) => {\n if (!matchesShortcut(e, shortcut)) return;\n const node = getNode();\n if (!node || !node.isConnected) return;\n e.preventDefault();\n node.click();\n };\n window.addEventListener(\"keydown\", onKey);\n return () => window.removeEventListener(\"keydown\", onKey);\n }, [shortcut, enabled, getNode]);\n}\n\nexport function TapBadge({ badge }: { badge: number | \"dot\" }) {\n if (badge === \"dot\") return <span aria-hidden=\"true\" className=\"matrx-tap-badge\" data-dot=\"\" />;\n if (badge <= 0) return null;\n return (\n <span aria-hidden=\"true\" className=\"matrx-tap-badge\">\n {badge > 99 ? \"99+\" : badge}\n </span>\n );\n}\n\nexport function TapSpinner({ className }: { className: string }) {\n return (\n <svg className={className} fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={2} aria-hidden=\"true\">\n <circle\n className={MOTION_SPIN}\n cx=\"12\"\n cy=\"12\"\n r=\"9\"\n strokeDasharray=\"28.27\"\n strokeDashoffset=\"9\"\n strokeLinecap=\"round\"\n style={{ transformOrigin: \"12px 12px\" }}\n />\n </svg>\n );\n}\n\nexport function TapChevron() {\n return (\n <svg\n className=\"matrx-tap-chevron\"\n aria-hidden=\"true\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n );\n}\n\n/** Tooltip body: the label, then the shortcut as a key cap. */\nexport function tooltipBody(label: string, shortcut: TapShortcut | undefined): ReactNode {\n if (!shortcut) return label;\n return (\n <span className=\"matrx-tap-tooltip\">\n {label}\n <kbd className=\"matrx-tap-kbd\">{formatShortcut(shortcut)}</kbd>\n </span>\n );\n}\n","import type { ComponentType, ReactNode, Ref } from \"react\";\n\n/**\n * The injectable link seam — the package's replacement for the original\n * hard `next/link` import.\n *\n * Internal hrefs (anything NOT matching `http(s):`, `mailto:`, `tel:`) render\n * through the link component resolved here; external hrefs always render a\n * plain `<a target=\"_blank\" rel=\"noopener noreferrer\">`, exactly like the\n * original. When nothing is registered and no per-instance `linkComponent`\n * prop is given, internal hrefs fall back to a plain `<a>` (no prefetch, no\n * client-side routing — still a working link).\n */\nexport interface TapTargetLinkProps {\n href: string;\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\" | undefined;\n rel?: string | undefined;\n /** Router prefetch hint (next/link semantics). Plain `<a>` fallback ignores it. */\n prefetch?: boolean | null | undefined;\n \"aria-label\"?: string | undefined;\n /** Tooltip text drawn through `title` (the provider's title takeover). */\n title?: string | undefined;\n className?: string | undefined;\n children?: ReactNode;\n /** The trigger's ref (the development guard measures the rendered link).\n * next/link forwards it to its `<a>`. */\n ref?: Ref<HTMLAnchorElement> | undefined;\n}\n\nexport type TapTargetLinkComponent = ComponentType<TapTargetLinkProps>;\n\n/**\n * The registered component lives in a `Symbol.for` slot on `globalThis` — NOT\n * in module state — so it survives the module graph being instantiated more\n * than once: the `.` and `./buttons` dist bundles each inline the primitives\n * (tsup `splitting: false`), and a consumer may even mix `import` and\n * `require`. One registration must reach every copy.\n */\nconst LINK_SLOT = Symbol.for(\"@ai-matrx/tap-target:link-component\");\n\ntype GlobalWithLinkSlot = typeof globalThis & {\n [LINK_SLOT]?: TapTargetLinkComponent | null;\n};\n\n/**\n * Register the app's link component once at startup (e.g. `next/link`):\n *\n * ```tsx\n * import Link from \"next/link\";\n * import { setTapTargetLinkComponent } from \"@ai-matrx/tap-target\";\n * setTapTargetLinkComponent(Link);\n * ```\n *\n * Pass `null` to unregister (plain `<a>` fallback resumes).\n */\nexport function setTapTargetLinkComponent(\n component: TapTargetLinkComponent | null,\n): void {\n (globalThis as GlobalWithLinkSlot)[LINK_SLOT] = component;\n}\n\n/** The currently registered link component, or `null` when none is set. */\nexport function getTapTargetLinkComponent(): TapTargetLinkComponent | null {\n return (globalThis as GlobalWithLinkSlot)[LINK_SLOT] ?? null;\n}\n","\"use client\";\n\nimport { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from \"../tooltip\";\n\n/**\n * Wraps a TapTargetButton (or any tap control) like the button-demo page:\n * no extra padding on the control — only `gap-0.5` before the caption.\n * Tooltip shows the full `label`; the caption truncates at max-w-[52px].\n */\nexport function TapTargetLabeled({\n label,\n children,\n hideLabel = false,\n toolTipSide = \"bottom\",\n}: {\n label: string;\n children: React.ReactNode;\n hideLabel?: boolean | undefined;\n toolTipSide?: \"top\" | \"bottom\" | \"left\" | \"right\" | undefined;\n}) {\n return (\n <TooltipProvider delayDuration={200}>\n <Tooltip>\n <TooltipTrigger asChild>\n <div className=\"flex flex-col items-center p-0 gap-0 space-y-0 space-x-0 shrink-0\">\n {children}\n {!hideLabel && (\n <span className=\"text-[10px] text-muted-foreground/70 leading-tight max-w-[52px] text-center truncate\">\n {label}\n </span>\n )}\n </div>\n </TooltipTrigger>\n <TooltipContent side={toolTipSide}>\n <span className=\"font-mono text-xs max-w-[280px] break-all\">\n {label}\n </span>\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n","\"use client\";\n\n// TapTargetCopyButton — one press copies, and the button itself says so: the\n// glyph becomes a check (success tone) and the tooltip reads \"Copied\" for\n// 1.6s; a failure shows a destructive \"Copy failed\" instead of nothing.\n// Replaces the copy-then-flash logic screens used to hand-build.\n\nimport { forwardRef, useEffect, useRef, useState } from \"react\";\n\nimport {\n TapTargetButton,\n TapTargetButtonForGroup,\n TapTargetButtonOutline,\n TapTargetButtonTransparent,\n type TapTargetButtonProps,\n} from \"./tap-target-button\";\n\nexport interface TapTargetCopyButtonProps\n extends Omit<TapTargetButtonProps, \"onClick\" | \"icon\" | \"children\" | \"tone\" | \"loading\" | \"className\"> {\n /** What to copy — a string, or a function (sync or async) that produces it on press. */\n value: string | (() => string | Promise<string>);\n variant?: \"glass\" | \"transparent\" | \"outline\" | \"group\" | undefined;\n onCopied?: ((text: string) => void) | undefined;\n}\n\nconst COPY = (\n <>\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </>\n);\nconst CHECK = <path d=\"M20 6 9 17l-5-5\" />;\nconst FAIL = (\n <>\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </>\n);\n\nconst VARIANTS = {\n glass: TapTargetButton,\n transparent: TapTargetButtonTransparent,\n outline: TapTargetButtonOutline,\n group: TapTargetButtonForGroup,\n} as const;\n\nexport const TapTargetCopyButton = forwardRef<HTMLButtonElement, TapTargetCopyButtonProps>(\n function TapTargetCopyButton({ value, variant = \"glass\", onCopied, ariaLabel = \"Copy\", tooltip, ...rest }, ref) {\n const [state, setState] = useState<\"idle\" | \"copied\" | \"failed\">(\"idle\");\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n useEffect(() => () => {\n if (timer.current) clearTimeout(timer.current);\n }, []);\n\n const copy = async () => {\n try {\n const text = typeof value === \"function\" ? await value() : value;\n await navigator.clipboard.writeText(text);\n setState(\"copied\");\n onCopied?.(text);\n } catch {\n setState(\"failed\");\n }\n if (timer.current) clearTimeout(timer.current);\n timer.current = setTimeout(() => setState(\"idle\"), 1600);\n };\n\n const Button = VARIANTS[variant];\n return (\n <Button\n ref={ref}\n {...rest}\n ariaLabel={ariaLabel}\n tooltip={state === \"copied\" ? \"Copied\" : state === \"failed\" ? \"Copy failed\" : tooltip}\n tone={state === \"copied\" ? \"success\" : state === \"failed\" ? \"destructive\" : undefined}\n onClick={() => void copy()}\n >\n {state === \"copied\" ? CHECK : state === \"failed\" ? FAIL : COPY}\n </Button>\n );\n },\n);\n","\"use client\";\n\n// TapTargetSearchGroup — search anywhere, in the space of one group.\n//\n// The macOS toolbar search: a tap-button group carries a search button; tap it\n// and the group's other buttons give way to a search field in the SAME glass\n// capsule, focused and ready; Escape (or the close button) brings the buttons\n// back. With no other children it is a lone search button that opens into a\n// field. Origin: matrx-frontend's CSS-only SearchGroup (2026-03), rebuilt on\n// the tap geometry with real focus, keyboard and screen-reader behaviour.\n//\n// Behaviour, fixed (the opinions ARE the component):\n// • open → the field takes the group's place and focuses.\n// • Escape → clears a non-empty query; on an empty field, closes and\n// returns focus to the search button.\n// • close (×) → clears and closes.\n// • focus leaves with an EMPTY query → closes. A non-empty query stays open,\n// because a filter in effect must stay visible.\n// • Enter → onSubmit(query).\n\nimport {\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n} from \"react\";\n\nimport { TapTargetButtonForGroup } from \"./tap-target-button\";\n\nexport type TapTargetSearchShortcut = \"mod+k\" | \"mod+f\" | \"/\" | false;\n\nexport interface TapTargetSearchGroupProps {\n /** The group's other buttons (`TapTargetButtonForGroup` / `variant=\"group\"`). */\n children?: ReactNode;\n value?: string | undefined;\n defaultValue?: string | undefined;\n onValueChange?: ((value: string) => void) | undefined;\n onSubmit?: ((value: string) => void) | undefined;\n open?: boolean | undefined;\n defaultOpen?: boolean | undefined;\n onOpenChange?: ((open: boolean) => void) | undefined;\n /** Field placeholder and the search button's name. Default \"Search\". */\n placeholder?: string | undefined;\n /** Where the search button sits among the group's buttons. Default \"end\". */\n searchPosition?: \"start\" | \"end\" | undefined;\n /** Open width: \"fit\" (16rem, shrinking in a tight row) or \"fill\" (the row's free space). */\n width?: \"fit\" | \"fill\" | undefined;\n /** Keyboard shortcut that opens the field. Default none. */\n shortcut?: TapTargetSearchShortcut | undefined;\n}\n\nconst SHORTCUT_LABEL: Record<Exclude<TapTargetSearchShortcut, false>, string> = {\n \"mod+k\": \"⌘K\",\n \"mod+f\": \"⌘F\",\n \"/\": \"/\",\n};\n\nfunction isTyping(target: EventTarget | null): boolean {\n const el = target as HTMLElement | null;\n if (!el) return false;\n return el.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName);\n}\n\nconst SearchGlyph = (\n <>\n <circle cx=\"11\" cy=\"11\" r=\"8\" />\n <path d=\"m21 21-4.34-4.34\" />\n </>\n);\nconst CloseGlyph = (\n <>\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </>\n);\n\nexport function TapTargetSearchGroup({\n children,\n value: valueProp,\n defaultValue = \"\",\n onValueChange,\n onSubmit,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n placeholder = \"Search\",\n searchPosition = \"end\",\n width = \"fit\",\n shortcut = false,\n}: TapTargetSearchGroupProps) {\n const [ownValue, setOwnValue] = useState(defaultValue);\n const [ownOpen, setOwnOpen] = useState(defaultOpen);\n const value = valueProp ?? ownValue;\n const open = openProp ?? ownOpen;\n const fieldId = useId();\n const rootRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const measureRef = useRef<HTMLDivElement>(null);\n const [buttonsWidth, setButtonsWidth] = useState<number | null>(null);\n\n // The buttons' real width, so open/close animate between two measured\n // widths instead of a max-width guess (which stalls, then snaps).\n useLayoutEffect(() => {\n const el = measureRef.current;\n if (!el) return;\n const read = () => setButtonsWidth(el.offsetWidth);\n read();\n if (typeof ResizeObserver === \"undefined\") return;\n const ro = new ResizeObserver(read);\n ro.observe(el);\n return () => ro.disconnect();\n }, []);\n\n const setValue = useCallback(\n (next: string) => {\n if (valueProp === undefined) setOwnValue(next);\n onValueChange?.(next);\n },\n [valueProp, onValueChange],\n );\n const setOpen = useCallback(\n (next: boolean, returnFocus = false) => {\n if (openProp === undefined) setOwnOpen(next);\n onOpenChange?.(next);\n if (returnFocus) requestAnimationFrame(() => triggerRef.current?.focus());\n },\n [openProp, onOpenChange],\n );\n\n // Focus the field the moment it opens (click, shortcut or a controlled\n // prop) — in the layout phase, before the browser moves focus off the\n // now-inert search button, so that blur never reads as \"focus left\".\n useLayoutEffect(() => {\n if (open) inputRef.current?.focus();\n }, [open]);\n\n useEffect(() => {\n if (!shortcut) return;\n const onKey = (e: globalThis.KeyboardEvent) => {\n const mod = e.metaKey || e.ctrlKey;\n const hit =\n shortcut === \"/\"\n ? e.key === \"/\" && !mod && !isTyping(e.target)\n : mod && e.key.toLowerCase() === shortcut.slice(-1);\n if (!hit) return;\n e.preventDefault();\n setOpen(true);\n inputRef.current?.focus();\n };\n window.addEventListener(\"keydown\", onKey);\n return () => window.removeEventListener(\"keydown\", onKey);\n }, [shortcut, setOpen]);\n\n const onKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Escape\") {\n e.preventDefault();\n if (value) setValue(\"\");\n else setOpen(false, true);\n } else if (e.key === \"Enter\") {\n onSubmit?.(value);\n }\n };\n\n const label = shortcut ? `${placeholder} (${SHORTCUT_LABEL[shortcut]})` : placeholder;\n const trigger = (\n <TapTargetButtonForGroup\n ref={triggerRef}\n ariaLabel={label}\n aria-expanded={open}\n aria-controls={fieldId}\n onClick={() => setOpen(true)}\n >\n {SearchGlyph}\n </TapTargetButtonForGroup>\n );\n\n return (\n <div\n ref={rootRef}\n role=\"search\"\n className=\"matrx-tap-group matrx-tap-search\"\n data-open={open ? \"\" : undefined}\n data-width={width}\n onBlur={() => {\n // Decide after focus has settled: closing on an empty query only when\n // focus really left the group.\n setTimeout(() => {\n const root = rootRef.current;\n if (root && !root.contains(document.activeElement) && !inputRef.current?.value) setOpen(false);\n }, 0);\n }}\n >\n <div className=\"matrx-tap-group-capsule matrx-glass-thin-border\" />\n <div\n className=\"matrx-tap-group-row matrx-tap-search-buttons\"\n inert={open}\n style={\n buttonsWidth === null\n ? undefined\n : ({ \"--matrx-tap-search-buttons-w\": `${buttonsWidth}px` } as CSSProperties)\n }\n >\n <div ref={measureRef} className=\"matrx-tap-search-measure\">\n {searchPosition === \"start\" ? trigger : null}\n {children}\n {searchPosition === \"end\" ? trigger : null}\n </div>\n </div>\n <div className=\"matrx-tap-search-field\" id={fieldId} inert={!open}>\n <svg\n className=\"matrx-tap-search-glyph\"\n aria-hidden=\"true\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n {SearchGlyph}\n </svg>\n <input\n ref={inputRef}\n type=\"search\"\n className=\"matrx-tap-search-input\"\n value={value}\n placeholder={placeholder}\n aria-label={placeholder}\n autoComplete=\"off\"\n enterKeyHint=\"search\"\n onChange={(e) => setValue(e.target.value)}\n onKeyDown={onKeyDown}\n />\n <TapTargetButtonForGroup\n ariaLabel=\"Close search\"\n tooltip={false}\n onClick={() => {\n setValue(\"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KAAK;AAAA,cACL,MAAK;AAAA,cACL,WAAU;AAAA,cACV;AAAA,cACA;AAAA,cACA,cAAY;AAAA,cACZ,cAAa;AAAA,cACb,cAAa;AAAA,cACb,UAAU,CAAC,MAAM,SAAS,EAAE,OAAO,KAAK;AAAA,cACxC;AAAA;AAAA,UACF;AAAA,UACA,gBAAAA;AAAA,YAAC;AAAA;AAAA,cACC,WAAU;AAAA,cACV,SAAS;AAAA,cACT,SAAS,MAAM;AACb,yBAAS,EAAE;AACX,wBAAQ,OAAO,IAAI;AAAA,cACrB;AAAA,cAEC;AAAA;AAAA,UACH;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["jsx","jsxs","jsx","DrawerPrimitive","React","React","jsx","React","jsx","jsx","jsxs","jsx","jsxs","DrawerPrimitive","cva","React","React","jsx","jsxs","registry","ErrorBox","jsx","jsxs","cva","treeContainsComponent","React","Slot","cva","React","jsx","cva","Slot","React","jsx","CONTEXT_SLOT","contextRegistry","jsx","jsxs","treeContainsComponent","React","jsx","React","jsx","React","jsx","React","jsx","CollapsibleTrigger","CollapsibleContent","React","jsx","jsxs","jsx","jsxs","React","jsx","React","React","useCallback","useEffect","useState","Fragment","jsx","jsxs","React","jsx","jsxs","cva","React","jsx","jsxs","cva","useRef","useState","React","jsx","jsx","jsxs","useState","useRef","Icon","DialogPrimitive","VisuallyHidden","treeContainsComponent","React","jsx","jsxs","CONTEXT_SLOT","contextRegistry","DIALOG_DESKTOP_CLASSES","DIALOG_MOBILE_SHEET_CLASSES","DIALOG_MOBILE_SHEET_OVERRIDE","treeContainsComponent","React","jsx","jsxs","useCallback","useEffect","useRef","useState","jsx","jsxs","useState","useRef","useEffect","useCallback","result","React","jsx","jsxs","React","jsx","Label","useLayoutEffect","useMemo","useRef","useState","Fragment","jsx","jsxs","Icon","useMemo","useRef","useState","useLayoutEffect","React","jsx","React","jsx","jsxs","jsx","jsxs","jsx","React","jsx","jsxs","jsx","jsxs","React","jsx","Separator","treeContainsComponent","cva","React","jsx","jsxs","cva","treeContainsComponent","React","jsx","Fragment","jsx","jsxs","Slot","cva","React","React","GAP_PX","SURFACE_CLASS","visible","jsx","jsx","jsxs","open","Separator","Slot","cva","React","jsx","jsx","jsxs","AppRailItem","AppRailAvatar","React","Group","Separator","jsx","Group","Separator","jsx","jsxs","visible","React","jsx","jsxs","React","jsx","useState","jsx","jsxs","useState","Icon","React","jsx","React","jsx","React","jsx","jsxs","React","jsx","React","jsx","RadioGroup","React","jsx","jsxs","cva","React","jsx","cva","forwardRef","useCallback","useRef","cn","useCallback","useRef","useEffect","jsx","jsxs","useEffect","Fragment","jsx","jsxs","cn","useRef","useCallback","forwardRef","TapTargetButton","TapTargetButtonTransparent","TapTargetButtonOutline","TapTargetButtonSolid","TapTargetButtonDestructive","TapTargetButtonForGroup","jsx","jsxs","forwardRef","useEffect","useRef","useState","Fragment","jsx","jsxs","forwardRef","TapTargetCopyButton","useState","useRef","useEffect","Button","useCallback","useEffect","useLayoutEffect","useRef","useState","Fragment","jsx","jsxs","isTyping","useState","useRef","useLayoutEffect","useCallback","useEffect"]}
|
|
1
|
+
{"version":3,"sources":["../src/accordion.tsx","../src/cn.ts","../src/icons.tsx","../src/badge.tsx","../src/bottom-sheet.tsx","../src/drawer.tsx","../src/floating-layer.tsx","../src/radix-dialog-modal-context.tsx","../src/alert.tsx","../src/error-box.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/menu-scroll-edges.tsx","../src/use-scroll-fade.ts","../src/submenu-focus.ts","../src/select.tsx","../src/field-surface.ts","../src/creatable-picker.tsx","../src/popover.tsx","../src/dialog.tsx","../src/layer-front.ts","../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/archive-filter.tsx","../src/archived-disclosure.tsx","../src/separator.tsx","../src/sheet.tsx","../src/organization-picker.tsx","../src/skeleton.tsx","../src/sidebar.tsx","../src/tooltip.tsx","../src/title-tooltips.ts","../src/app-shell/app-rail.tsx","../src/app-shell/status-dot.tsx","../src/app-shell/canvas.tsx","../src/resizable.tsx","../src/app-shell/mode-switch.tsx","../src/switch.tsx","../src/tabbed-bottom-sheet.tsx","../src/table.tsx","../src/tabs.tsx","../src/textarea.tsx","../src/hover-card.tsx","../src/radio-group.tsx","../src/slider.tsx","../src/toggle.tsx","../src/tap-target/tap-target-button.tsx","../src/tap-target/cn.ts","../src/tap-target/tap-target-guard.ts","../src/tap-target/tap-features.tsx","../src/tap-target/link.ts","../src/tap-target/tap-target-labeled.tsx","../src/tap-target/tap-target-copy.tsx","../src/tap-target/tap-target-search.tsx"],"sourcesContent":["\"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/**\n * lucide `loader-2` — the spinner glyph. Callers add `matrx-spin`.\n * Never a resting icon: at rest this incomplete arc reads as a broken\n * half-circle. Refresh controls use arrows, then swap to this only while busy.\n */\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 `chevron-down` — the disclosure's open glyph. */\nexport function ChevronDownIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n );\n}\n\n/** lucide `archive` — the archived-rows glyph (ArchivedDisclosure). */\nexport function ArchiveIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <rect width=\"20\" height=\"5\" x=\"2\" y=\"3\" rx=\"1\" />\n <path d=\"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8\" />\n <path d=\"M10 12h4\" />\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 `pencil` — the edit glyph (the table card's Edit action). */\nexport function PencilIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z\" />\n <path d=\"m15 5 4 4\" />\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\n/** lucide `star` — the default-organization badge (OrganizationPicker). */\nexport function StarIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z\" />\n </svg>\n );\n}\n\n/** lucide `building-2` — the organization glyph (OrganizationPicker trigger). */\nexport function Building2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z\" />\n <path d=\"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2\" />\n <path d=\"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2\" />\n <path d=\"M10 6h4\" />\n <path d=\"M10 10h4\" />\n <path d=\"M10 14h4\" />\n <path d=\"M10 18h4\" />\n </svg>\n );\n}\n\n/** lucide `panel-left` — the sidebar toggle glyph. */\nexport function PanelLeftIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M9 3v18\" />\n </svg>\n );\n}\n\n/** lucide `ellipsis-vertical` — a panel's \"more\" menu. */\nexport function MoreVerticalIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <circle cx=\"12\" cy=\"12\" r=\"1\" />\n <circle cx=\"12\" cy=\"5\" r=\"1\" />\n <circle cx=\"12\" cy=\"19\" r=\"1\" />\n </svg>\n );\n}\n\n/** lucide `maximize-2` — expand a panel. */\nexport function Maximize2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M15 3h6v6\" />\n <path d=\"m21 3-7 7\" />\n <path d=\"m3 21 7-7\" />\n <path d=\"M9 21H3v-6\" />\n </svg>\n );\n}\n\n/** lucide `minimize-2` — restore an expanded panel. */\nexport function Minimize2Icon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"m14 10 7-7\" />\n <path d=\"M20 10h-6V4\" />\n <path d=\"m3 21 7-7\" />\n <path d=\"M4 14h6v6\" />\n </svg>\n );\n}\n\n/** lucide `arrow-left`. */\nexport function ArrowLeftIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"m12 19-7-7 7-7\" />\n <path d=\"M19 12H5\" />\n </svg>\n );\n}\n\n/** lucide `arrow-right`. */\nexport function ArrowRightIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M5 12h14\" />\n <path d=\"m12 5 7 7-7 7\" />\n </svg>\n );\n}\n\n/** lucide `rotate-cw` — reload. */\nexport function RotateCwIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <path d=\"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8\" />\n <path d=\"M21 3v5h-5\" />\n </svg>\n );\n}\n\n/** lucide `globe` — a web page with no favicon. */\nexport function GlobeIcon(props: IconProps) {\n return (\n <svg {...lucideProps(props)}>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20\" />\n <path d=\"M2 12h20\" />\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 data-slot=\"badge\" 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, up to\n * 90dvh (no minimum). 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 {/* The dialog layer (z-[10000], see dialog.tsx), never below it: a\n sheet opened from inside a dialog or modal (the phone's ⋯ menu in\n a compact chat modal) otherwise opens BEHIND that dialog's scrim.\n Equal z, so the later-opened layer paints on top. */}\n <DrawerPrimitive.Overlay\n className={cn(\"fixed inset-0 z-[10000] bg-[var(--matrx-overlay-scrim)]\", \"fixed inset-0 z-[10000]\")}\n style={{ background: \"var(--matrx-overlay-scrim-drawer)\" }}\n />\n <DrawerContentPrimitive\n className={cn(\n \"fixed inset-x-0 bottom-0 z-[10000] mt-24 flex flex-col rounded-t-2xl overflow-hidden\",\n // Adaptive sizes to its content, up to 90dvh — never a 60dvh floor that\n // left a two-action sheet mostly empty (hosts overrode it with min-h-0).\n size === \"full\" ? \"h-[92dvh]\" : \"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 data-slot=\"bottom-sheet-footer\"\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 { keepFloatingLayersInside, useModalLayer } from \"./floating-layer\";\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 onOpenChange,\n ...props\n}: DrawerProps) => {\n const direction: DrawerDirection = props.direction ?? \"bottom\";\n const handleOpenChange = (open: boolean) => {\n if (\n open &&\n typeof document !== \"undefined\" &&\n document.activeElement instanceof HTMLElement\n ) {\n // Vaul applies aria-hidden to the application tree synchronously, before\n // Radix transfers focus into the portalled dialog. Release the trigger\n // first so a focused descendant is never hidden from assistive tech.\n document.activeElement.blur();\n }\n onOpenChange?.(open);\n };\n return (\n <RadixDialogModalProvider modal>\n <DrawerDirectionContext.Provider value={direction}>\n <DrawerPrimitive.Root\n modal\n shouldScaleBackground={shouldScaleBackground}\n {...props}\n onOpenChange={handleOpenChange}\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>(({ onInteractOutside, ...props }, ref) => {\n // A drawer is always modal: floating layers opened from it stack above its\n // scrim, and a press inside one is not an outside press (floating-layer.tsx).\n useModalLayer(true);\n return (\n <DrawerPrimitive.Content\n // NO SLIDE-IN (styles.css, `[data-matrx-entrance=\"none\"]`). Measured on\n // a 375x812 phone (PB-08, 2026-10-01): for ~250 ms after open the spot\n // where a row settles was still the SCRIM, so a tap there was an outside\n // press and closed the sheet; for the next ~150 ms it was a DIFFERENT\n // row. The sheet is therefore at rest from its first frame; the scrim\n // still fades and the exit still slides. Same class as the composer\n // menu's popper entrance (matrx-frontend 286ef577fb).\n data-matrx-entrance=\"none\"\n {...props}\n ref={ref}\n aria-modal=\"true\"\n onInteractOutside={keepFloatingLayersInside(onInteractOutside)}\n />\n );\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 * FLOATING LAYERS OPENED FROM INSIDE A MODAL — one contract, every surface.\n *\n * A blocking surface (a `modal` Dialog, AlertDialog, Sheet, Drawer,\n * BottomSheet, CommandDialog — and every Dialog on a phone) paints a scrim at\n * the modal tier, `MODAL_LAYER_Z`. Radix children of that surface (Popover,\n * Select, menus) are safe: they portal into it or after it at the same z, and\n * Radix counts a press inside them as inside. A floating layer that is NOT a\n * Radix child — a host window manager's window, the associations picker\n * window, anything `createPortal`ed to `<body>` at its own z — was not: it\n * painted UNDER the scrim (a window manager lives near z-1000), so the click\n * that picked an option landed on the scrim and closed the modal (Source\n * screen side sheet + association picker, 2026-09-26). Behind the scrim it\n * would also have lost focus to the modal's trap and had presses inside it\n * counted as outside-clicks.\n *\n * The contract, in three parts:\n *\n * 1. Every modal content registers while it is open (`useModalLayer`), and\n * treats a press or focus inside any `[data-matrx-floating-layer]` as\n * inside (`keepFloatingLayersInside`).\n * 2. A floating layer reads `useFloatingLayerZIndex(ownZ)`: while a modal is\n * open it is lifted to the modal tier. Equal z, so DOM order decides — a\n * layer opened AFTER the modal (portal appended later) paints above its\n * scrim; a window that was already open stays underneath, as it should.\n * While lifted, several floating layers order by when they opened, not by\n * their own manager's focus order; that returns when the modal closes.\n * 3. A floating layer's root is wrapped in `<FloatingLayer>`: it carries the\n * marker attribute, re-asserts `pointer-events: auto` (a modal sets `none`\n * on `<body>`), and mounts a non-trapping focus scope, which pauses the\n * modal's focus trap while the layer is open so its inputs take focus.\n *\n * 4. Popper content (a Popover, a combobox) a floating layer opens is portaled\n * to <body>; while a floating layer is open it counts as part of it, and\n * wheel/touchmove inside either stops at <body> so the modal's scroll lock\n * never cancels it.\n *\n * Guard: `floating-layer.test.tsx` — a window-manager-style layer opened from\n * each blocking surface must stack above the scrim, keep the modal open when\n * it or a popover it opened is pressed, scroll, keep focus in its own input,\n * and hand focus back to its opener when it closes.\n */\n\nimport { FocusScope } from \"@radix-ui/react-focus-scope\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport * as React from \"react\";\n\n/** The modal tier: every blocking scrim and its content sit here. */\nexport const MODAL_LAYER_Z = 10000;\n\n/** Marker attribute on the root of a floating layer. */\nexport const FLOATING_LAYER_ATTR = \"data-matrx-floating-layer\";\n\n// ── the open-modal registry ─────────────────────────────────────────────────\n// Shared identity across independently bundled public entrypoints, like the\n// dialog contexts: two copies of this module must see one count.\ninterface ModalLayerRegistry {\n count: number;\n listeners: Set<() => void>;\n}\nconst REGISTRY_SLOT = Symbol.for(\"ai-matrx.design-system.modal-layer-registry\");\nconst registryHost = globalThis as typeof globalThis & {\n [REGISTRY_SLOT]?: ModalLayerRegistry;\n};\nconst registry: ModalLayerRegistry = (registryHost[REGISTRY_SLOT] ??= {\n count: 0,\n listeners: new Set(),\n});\n\nfunction emit(): void {\n for (const listener of registry.listeners) listener();\n}\n\n// A modal's scroll lock (react-remove-scroll) cancels wheel and touchmove on\n// `document` for anything outside the modal's own content — including a\n// floating layer opened from it, whose list then never scrolls. While a modal\n// is open, a scroll gesture inside a floating layer stops at <body>: React's\n// own portal listener on <body> still sees it (stopPropagation never stops\n// listeners on the same node), the lock on `document` never does.\nconst SCROLL_EVENTS = [\"wheel\", \"touchmove\"] as const;\nfunction stopAtBody(event: Event): void {\n if (isInsideFloatingLayer(event.target)) event.stopPropagation();\n}\nfunction setScrollPassthrough(on: boolean): void {\n if (typeof document === \"undefined\" || !document.body) return;\n for (const type of SCROLL_EVENTS) {\n if (on) document.body.addEventListener(type, stopAtBody, { passive: true });\n else document.body.removeEventListener(type, stopAtBody);\n }\n}\n\n/** Register one open modal layer; returns its release. */\nexport function registerModalLayer(): () => void {\n registry.count += 1;\n if (registry.count === 1) setScrollPassthrough(true);\n emit();\n let released = false;\n return () => {\n if (released) return;\n released = true;\n registry.count = Math.max(0, registry.count - 1);\n if (registry.count === 0) setScrollPassthrough(false);\n emit();\n };\n}\n\n/** True while at least one blocking surface is open. */\nexport function isModalLayerOpen(): boolean {\n return registry.count > 0;\n}\n\nfunction subscribe(listener: () => void): () => void {\n registry.listeners.add(listener);\n return () => registry.listeners.delete(listener);\n}\n\n/** Reactive `isModalLayerOpen()`. */\nexport function useModalLayerOpen(): boolean {\n return React.useSyncExternalStore(subscribe, isModalLayerOpen, () => false);\n}\n\n/**\n * Called by every modal content while it is mounted. `active` is false for a\n * content whose root is not modal (a windowed dialog, a `modal={false}` sheet).\n */\nexport function useModalLayer(active: boolean): void {\n React.useLayoutEffect(() => (active ? registerModalLayer() : undefined), [active]);\n}\n\n// ── the outside-click guard ─────────────────────────────────────────────────\n\nconst POPPER_WRAPPER = \"[data-radix-popper-content-wrapper]\";\n\n/**\n * True when `target` is inside a floating layer — or inside popper content (a\n * Popover, a combobox list) while a floating layer is open. Popper content a\n * window opens is portaled to <body>, outside the window's own element and\n * outside the modal's React tree; popper content the MODAL opens is portaled\n * into the modal and never reaches this check.\n */\nexport function isInsideFloatingLayer(target: EventTarget | null | undefined): boolean {\n if (!(target instanceof Element)) return false;\n if (target.closest(`[${FLOATING_LAYER_ATTR}]`)) return true;\n return (\n target.closest(POPPER_WRAPPER) !== null &&\n target.ownerDocument.querySelector(`[${FLOATING_LAYER_ATTR}]`) !== null\n );\n}\n\n/**\n * Wrap a Radix `onInteractOutside` so a press or focus inside a floating layer\n * never dismisses the modal. The caller's handler still runs first.\n */\nexport function keepFloatingLayersInside<\n E extends { target: EventTarget | null; preventDefault: () => void },\n>(handler?: (event: E) => void): (event: E) => void {\n return (event) => {\n handler?.(event);\n if (isInsideFloatingLayer(event.target)) event.preventDefault();\n };\n}\n\n// ── the floating layer's side ───────────────────────────────────────────────\n\n/** Pure form of `useFloatingLayerZIndex`, for callers outside React. */\nexport function floatingLayerZIndex(ownZ: number, modalOpen: boolean): number {\n return modalOpen ? Math.max(ownZ, MODAL_LAYER_Z) : ownZ;\n}\n\n/** The z-index a floating layer should paint at, given its own. */\nexport function useFloatingLayerZIndex(ownZ: number): number {\n return floatingLayerZIndex(ownZ, useModalLayerOpen());\n}\n\nconst preventAutoFocus = (event: Event) => event.preventDefault();\n\n/**\n * Wrap the root element of a floating layer (exactly one element child).\n * Marks it, keeps it pressable under a modal's `pointer-events: none` body,\n * and pauses the modal's focus trap while it is mounted. It never takes focus\n * on open. On close, if focus was lost with it while a modal is still open,\n * focus returns to the control that opened it — otherwise the next Tab would\n * land behind the modal.\n */\nexport const FloatingLayer = React.forwardRef<\n HTMLElement,\n { children: React.ReactElement }\n>(({ children }, ref) => {\n const [opener] = React.useState<Element | null>(() =>\n typeof document === \"undefined\" ? null : document.activeElement,\n );\n const returnFocus = (event: Event) => {\n event.preventDefault();\n const active = document.activeElement;\n const lost = !active || active === document.body || !active.isConnected;\n if (lost && isModalLayerOpen() && opener instanceof HTMLElement && opener.isConnected) {\n opener.focus({ preventScroll: true });\n }\n };\n return (\n <FocusScope\n asChild\n trapped={false}\n loop={false}\n onMountAutoFocus={preventAutoFocus}\n onUnmountAutoFocus={returnFocus}\n >\n <Slot\n ref={ref}\n {...{ [FLOATING_LAYER_ATTR]: \"\" }}\n style={{ pointerEvents: \"auto\" }}\n >\n {children}\n </Slot>\n </FocusScope>\n );\n});\nFloatingLayer.displayName = \"FloatingLayer\";\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\n// Shared identity across independently bundled public entrypoints/loaders.\nconst CONTEXT_SLOT = Symbol.for(\"ai-matrx.design-system.dialog-modal-context\");\nconst contextRegistry = globalThis as typeof globalThis & { [CONTEXT_SLOT]?: React.Context<boolean> };\nconst RadixDialogModalContext = contextRegistry[CONTEXT_SLOT] ??= React.createContext<boolean>(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\";\nimport { ErrorActions, type ErrorActionsInput } from \"./error-box\";\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 /**\n * The error's facts for the host's error actions (destructive only): the raw\n * error, the operation, the records. Without it the host reads the words\n * from the rendered Alert.\n */\n errorFacts?: ErrorActionsInput | undefined;\n}\n\nconst Alert = React.forwardRef<HTMLDivElement, AlertProps>(\n ({ className, variant, children, errorFacts, ...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 {children}\n {/* A destructive Alert is an error on screen: the host's error actions\n (ErrorActionsProvider) ride it. The words are the Alert's own, so the\n host reads them from the rendered box. */}\n {variant === \"destructive\" ? (\n <ErrorActions origin=\"design-system/Alert\" {...errorFacts} />\n ) : null}\n </div>\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","/**\n * ErrorBox — THE one way a package draws an error on screen, and the seam a\n * host uses to put its own actions on every one of them.\n *\n * Every error sentence this package (and every sibling package that depends\n * on it) shows is an `ErrorBox`. The box is a plain `role=\"alert\"` element —\n * its tag and classes are the caller's, so nothing about the look changes — and\n * after its children it renders whatever the host's `ErrorActionsProvider`\n * returns for that error. With no provider it renders nothing extra.\n *\n * Why a slot and not a menu: the package cannot know the host's AI copy, bug\n * report, or support flow (Matrx fills it with its Alchemy copy-for-AI menu at\n * the app root). The package supplies the error's facts — the sentence, the\n * raw error, the operation, the records — and the host decides the actions.\n *\n * Guard: `error-box.census.test.ts` fails when a package file renders\n * `role=\"alert\"` for an error without going through `ErrorBox` (or, for the\n * `Alert` family, `ErrorActions`).\n */\nimport * as React from \"react\";\n\nexport interface ErrorActionsRecord {\n type: string;\n id: string;\n label?: string;\n}\n\n/** The facts a package knows about an error it is showing. All optional. */\nexport interface ErrorActionsInput {\n /** The sentence shown. Omit when the words are only in the rendered box. */\n message?: string;\n title?: string;\n /** The raw error (code/status/stack stay available to the host). */\n error?: unknown;\n /** What was being attempted (\"Load saved views\"). */\n operation?: string;\n records?: readonly ErrorActionsRecord[];\n /** The person's input that did not land. */\n unsavedInput?: unknown;\n /** The package + component that drew it (\"design-system/SavedViewsControl\"). */\n origin?: string;\n}\n\nexport type ErrorActionsRenderer = (input: ErrorActionsInput) => React.ReactNode;\n\n/**\n * ONE context for every copy of this module. tsup builds each entry point\n * (`.`, `./data-table`, …) without code splitting, so this file is inlined into\n * several bundles; a plain `createContext` would give each bundle its own\n * context and the host's provider (imported from `.`) would never reach an\n * error drawn by the data table. The registry key makes them one.\n */\nconst CONTEXT_KEY = Symbol.for(\"@ai-matrx/design-system/error-actions\");\ntype ContextRegistry = Record<symbol, React.Context<ErrorActionsRenderer | null> | undefined>;\nconst registry = globalThis as unknown as ContextRegistry;\nconst ErrorActionsContext: React.Context<ErrorActionsRenderer | null> =\n registry[CONTEXT_KEY] ??\n (registry[CONTEXT_KEY] = React.createContext<ErrorActionsRenderer | null>(null));\n\n/** Mount once at the host's app root; every ErrorBox below renders `render(...)`. */\nexport function ErrorActionsProvider({\n render,\n children,\n}: {\n render: ErrorActionsRenderer;\n children: React.ReactNode;\n}) {\n return (\n <ErrorActionsContext.Provider value={render}>{children}</ErrorActionsContext.Provider>\n );\n}\n\nexport function useErrorActions(): ErrorActionsRenderer | null {\n return React.useContext(ErrorActionsContext);\n}\n\n/**\n * The host's actions for one error, placed wherever the caller puts this\n * element. Renders nothing without a provider. Use inside a box you do not\n * render yourself (the `Alert` family); everything else uses `ErrorBox`.\n */\nexport function ErrorActions(props: ErrorActionsInput) {\n const render = useErrorActions();\n if (!render) return null;\n return <>{render(props)}</>;\n}\n\ntype ErrorBoxTag = \"p\" | \"div\" | \"span\" | \"section\" | \"li\";\n\nexport interface ErrorBoxProps\n extends Omit<React.HTMLAttributes<HTMLElement>, \"role\" | \"title\">,\n ErrorActionsInput {\n /** The element drawn — the caller's existing tag, so layout never shifts. */\n as?: ErrorBoxTag;\n}\n\nexport const ErrorBox = React.forwardRef<HTMLElement, ErrorBoxProps>(function ErrorBox(\n {\n as = \"p\",\n message,\n title,\n error,\n operation,\n records,\n unsavedInput,\n origin,\n children,\n ...rest\n },\n ref,\n) {\n const Tag = as as React.ElementType;\n const facts: ErrorActionsInput = {\n ...(message !== undefined ? { message } : {}),\n ...(title !== undefined ? { title } : {}),\n ...(error !== undefined ? { error } : {}),\n ...(operation !== undefined ? { operation } : {}),\n ...(records !== undefined ? { records } : {}),\n ...(unsavedInput !== undefined ? { unsavedInput } : {}),\n ...(origin !== undefined ? { origin } : {}),\n };\n return (\n <Tag ref={ref} role=\"alert\" data-error-box=\"\" {...rest}>\n {children ?? message}\n <ErrorActions {...facts} />\n </Tag>\n );\n});\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` hands its bottom padding to the footer), which\n * 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 { useModalLayer } from \"./floating-layer\";\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 // Always blocking: floating layers opened from it stack above its scrim.\n useModalLayer(true);\n return <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.\n //\n // 🚨 THERE IS NO `mb-[…]` HERE, AND THERE MUST NEVER BE ONE AGAIN\n // (0.11.3, feedback bf8fb00b). The bleed over the card's bottom padding\n // used to be a NEGATIVE BLOCK MARGIN, which makes this box taller than\n // the grid area the card allocates it — and `position: sticky` CLAMPS a\n // box to its containing block, so the browser yanked the footer UP by\n // `--dialog-pad` against the card's `gap-4` and painted 8px of opaque\n // footer over the last line of the consequence, at every length. The\n // card now RESERVES this footer's block size instead (`matrx-dialog-card`\n // in styles.css hands over its `padding-bottom`), so the bleed costs no\n // margin at all. Guard: `sticky-footer-geometry.test.tsx`.\n //\n // These stay UTILITIES rather than a shipped rule so a caller's\n // `className` still wins through tailwind-merge — a shipped rule would\n // have to be unlayered to survive Tailwind preflight (§ THE PREFLIGHT\n // RULE in styles.css) and would then override every caller's padding.\n \"sticky bottom-0 z-10 bg-background pt-3\",\n \"mx-[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\n/**\n * THE TOUCH FLOOR (2026-09-17).\n *\n * Every rung of the size scale below `xl` is shorter than the 44px platform\n * touch target: `xs` 24, `icon-sm` 28, `sm` 32, `roundIcon` 32, `default`/`md`\n * 36, `icon` 36, `lg` 40. Measured live at 390x844 on `/masterwork/<id>`, ALL\n * SEVEN design-system Buttons in the viewport were under the floor (four at\n * 32px, two at 28px).\n *\n * The floor is raised in CSS, under `@media (pointer: coarse)` ONLY, so DESKTOP\n * DENSITY IS UNTOUCHED — a narrow desktop window is not a finger, which is why\n * this rule deliberately does NOT carry the `(max-width: 1023px)` half that the\n * dialog-footer floor in `styles.css` uses.\n *\n * WHY EVERY SUB-44 RUNG AND NOT JUST `sm`: a floor applied to one rung inverts\n * the scale. Lift `sm` (32) alone and it renders TALLER on a phone than\n * `default` (36) and `lg` (40) — the scale would stop being a scale. A floor is\n * only coherent applied to everything beneath it.\n *\n * The mechanism is `min-height`/`min-width`, not an invisible 44px hit ring\n * over a 32px pill. A ring is the tap-target package's pattern and it is right\n * THERE (isolated glass buttons), but on a toolbar of adjacent `sm` buttons\n * separated by an 8px gap the rings overlap in the gap and one button silently\n * eats taps aimed at its neighbour — unacceptable where a neighbour is\n * destructive. `lib/entity-list`'s own phone contract (`h-11 min-w-11`) already\n * chose growth for the same reason; this is that choice made once, in the\n * primitive, instead of per surface.\n *\n * `min-width` is raised only on the SQUARE rungs (`icon`, `icon-sm`,\n * `roundIcon`) — a text button is already wider than 44px, and forcing a floor\n * on it would stretch short labels.\n *\n * Opt out on a control that is genuinely not a finger target with\n * `data-touch-exempt` (same escape hatch the footer floor honours), and say why\n * at the call site.\n */\nconst TOUCH_FLOOR_SIZES = new Set([\n \"xs\",\n \"sm\",\n \"default\",\n \"md\",\n \"lg\",\n \"icon\",\n \"icon-sm\",\n \"roundIcon\",\n]);\nconst SQUARE_SIZES = new Set([\"icon\", \"icon-sm\", \"roundIcon\"]);\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 const resolvedSize = size ?? \"default\";\n return (\n <Component\n className={cn(buttonVariants({ variant, size, className }))}\n data-matrx-button=\"\"\n data-tap-floor={TOUCH_FLOOR_SIZES.has(resolvedSize) ? \"\" : undefined}\n data-tap-floor-square={\n SQUARE_SIZES.has(resolvedSize) ? \"\" : undefined\n }\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\n// Shared identity across independently bundled public entrypoints/loaders.\nconst CONTEXT_SLOT = Symbol.for(\"ai-matrx.design-system.portal-container-context\");\nconst contextRegistry = globalThis as typeof globalThis & { [CONTEXT_SLOT]?: React.Context<HTMLElement | null | undefined> };\nconst PortalContainerContext = contextRegistry[CONTEXT_SLOT] ??= React.createContext<HTMLElement | null | undefined>(undefined);\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 { keepFloatingLayersInside, useModalLayer } from \"./floating-layer\";\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, onInteractOutside, ...props }, ref) => {\n const isMobile = useIsMobile();\n const isModal = useRadixDialogModal();\n useModalLayer(isModal);\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 onInteractOutside={keepFloatingLayersInside(onInteractOutside)}\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","/**\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 * The body lives in `@ai-matrx/kit/media-query` (chat-package independence\n * P12, 2026-10-01): the app's `hooks/use-mobile` and this package each carried\n * their own copy, and two breakpoint hooks is exactly the duplication this\n * package exists to end. Kit's reads through `useSyncExternalStore` — `false`\n * on the server and during hydration, so the desktop geometry hydrates — and\n * never throws where `matchMedia` is absent.\n */\nexport { MOBILE_BREAKPOINT, useIsMobile } from \"@ai-matrx/kit/media-query\";\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. Use it for\n * supplementary or interactive content that is not part of the dialog's\n * accessible consequence 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 * The question is not answerable yet — Confirm is ABSENT, not disabled (a\n * control is absent or honest, never dead). The body carries its own loading\n * state; Cancel stays. Set by `ConfirmDialogHost` while `ConfirmOptions.ready`\n * is pending (0.54.0).\n */\n confirmHeld?: 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 confirmHeld = 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 asChild>\n <div>{description}</div>\n </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 {confirmHeld ? null : (\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 )}\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 the opener's\n * queue; `useOpenerHost` (`@ai-matrx/kit/opener-react`) drains it one at a time\n * and this component renders a `<ConfirmDialog>` 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 { confirmOpener } from \"@ai-matrx/kit/confirm-opener\";\nimport { useOpenerHost } from \"@ai-matrx/kit/opener-react\";\nimport * as React from \"react\";\n\nimport { ConfirmDialog } from \"./confirm-dialog\";\n\nexport function ConfirmDialogHost() {\n // The registration, the ref-backed queue, the drain effect and the\n // settle-once callback are ALL `useOpenerHost` (kit 0.10.0). They used to be\n // written out here — and identically in three matrx-frontend dialog hosts,\n // which is exactly the duplication the opener primitive ends. What is left\n // below is the only part that was ever this package's: the dialog body.\n // `shown`, not `request`: the dialog animates out AFTER it is answered, and\n // `request` is already null by then — the body used to fade out empty\n // (reviewer, 2026-10-02). `shown` keeps the answered words until the next\n // question replaces them.\n const { shown, open, settle } = useOpenerHost(confirmOpener);\n\n // `ready` (kit 0.22.0): Confirm is held until the question can say what it\n // will do. Settling either way releases it — a failed read never traps the\n // person. Keyed by the request object, so the next question starts held.\n const [readyFor, setReadyFor] = React.useState<object | null>(null);\n const ready = shown?.ready;\n React.useEffect(() => {\n if (!shown || !ready) return undefined;\n let live = true;\n const release = () => {\n if (live) setReadyFor(shown);\n };\n Promise.resolve(ready).then(release, release);\n return () => {\n live = false;\n };\n }, [shown, ready]);\n const held = !!ready && readyFor !== shown;\n\n const handleConfirm = React.useCallback(() => settle(true), [settle]);\n const handleOpenChange = React.useCallback(\n (next: boolean) => {\n // Any dismiss (Esc / backdrop / Cancel) is a \"no\" — never a silent yes.\n if (!next) settle(false);\n },\n [settle],\n );\n\n return (\n <ConfirmDialog\n open={open}\n onOpenChange={handleOpenChange}\n title={shown?.title ?? \"\"}\n description={shown?.description}\n confirmLabel={shown?.confirmLabel}\n cancelLabel={shown?.cancelLabel}\n variant={shown?.variant}\n confirmHeld={held}\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\";\nimport { useMenuScrollEdges } from \"./menu-scroll-edges\";\nimport { useSubmenuSurvivesParentPanelFocus } from \"./submenu-focus\";\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-[10001] 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\n/** Portalled like its parent, so it opens BESIDE it — see `DropdownMenuSubContent` for why. */\nconst ContextMenuSubContent = React.forwardRef<\n React.ComponentRef<typeof ContextMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent> & { container?: HTMLElement | null }\n>(({ className, container, onFocusOutside, children, ...props }, ref) => {\n const portalContainer = usePortalContainer(container);\n // A flipped submenu survives the pointer leaving its trigger (see submenu-focus.ts).\n const keep = useSubmenuSurvivesParentPanelFocus(ref, onFocusOutside);\n const edges = useMenuScrollEdges(keep.ref);\n return (\n <ContextMenuPrimitive.Portal container={portalContainer}>\n <ContextMenuPrimitive.SubContent\n ref={edges.ref}\n onFocusOutside={keep.onFocusOutside}\n data-slot=\"context-menu-sub-content\"\n className={cn(SURFACE_CLASS, edges.surfaceClassName, \"shadow-lg\", MOTION_POPPER, className)}\n {...props}\n >\n {edges.wrap(children)}\n </ContextMenuPrimitive.SubContent>\n </ContextMenuPrimitive.Portal>\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, children, ...props }, ref) => {\n const portalContainer = usePortalContainer(container);\n const edges = useMenuScrollEdges(ref);\n return (\n <ContextMenuPrimitive.Portal container={portalContainer}>\n <ContextMenuPrimitive.Content\n ref={edges.ref}\n data-slot=\"context-menu-content\"\n className={cn(SURFACE_CLASS, edges.surfaceClassName, \"shadow-md\", MOTION_POPPER, className)}\n {...props}\n >\n {edges.wrap(children)}\n </ContextMenuPrimitive.Content>\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 * A MENU THAT HIDES ITEMS SAYS SO (Arman, 2026-10-02: \"A menu that hides\n * options needs to use best in class UI to show there is more\").\n *\n * Every menu surface already caps at Radix's measured available height and\n * scrolls. What it lacked was any sign that it scrolls: the note editor's\n * right-click menu in Split mode hid Chat and AI Actions below the fold and a\n * reader concluded they did not exist. Champion: macOS menus (an arrow strip\n * at the hidden edge that scrolls while hovered) plus the Linear/Radix edge\n * fade.\n *\n * Each edge that actually hides items gets a soft fade and a chevron strip;\n * an edge that is scrolled to its end gets neither, and a menu that fits gets\n * nothing at all. Measurement is `useScrollFade` (the package's one \"is there\n * more\" meter) — but drawn as OVERLAY elements, not its `mask-image` class:\n * a mask clips everything outside the border box, which would erase the\n * menu's own shadow.\n *\n * The overlays are zero-height `position: sticky` rows inside the surface, so\n * the surface stays the scroller: Radix's keyboard focus still scrolls the\n * focused item into view natively, and `scroll-padding-block` (styles.css)\n * keeps it clear of the fade. Pointer hover on a chevron glides toward the\n * hidden items; a press (touch included) moves one page.\n */\n\nimport * as React from \"react\";\n\nimport { RadixChevronDownIcon, RadixChevronUpIcon } from \"./icons\";\nimport { useScrollFade } from \"./use-scroll-fade\";\n\n/** px per millisecond while a chevron is hovered (~ macOS menu arrow speed). */\nconst HOVER_SPEED = 0.6;\n/** A press keeps this much of the previous page in view, so the reader keeps their place. */\nconst PAGE_OVERLAP = 48;\n\ntype Side = \"top\" | \"bottom\";\n\nfunction composeRefs<T>(...refs: Array<React.Ref<T> | undefined>) {\n return (node: T | null) => {\n for (const ref of refs) {\n if (typeof ref === \"function\") ref(node);\n else if (ref) (ref as React.MutableRefObject<T | null>).current = node;\n }\n };\n}\n\nfunction MenuScrollEdge({ side, scroller }: { side: Side; scroller: React.RefObject<HTMLElement | null> }) {\n const frame = React.useRef<number | null>(null);\n const dir = side === \"top\" ? -1 : 1;\n\n const stop = React.useCallback(() => {\n if (frame.current !== null) cancelAnimationFrame(frame.current);\n frame.current = null;\n }, []);\n\n const glide = React.useCallback(() => {\n stop();\n let last = performance.now();\n const step = (now: number) => {\n const el = scroller.current;\n if (!el) return stop();\n el.scrollTop += dir * HOVER_SPEED * (now - last);\n last = now;\n frame.current = requestAnimationFrame(step);\n };\n frame.current = requestAnimationFrame(step);\n }, [dir, scroller, stop]);\n\n // The edge unmounts the moment its end is reached; the glide stops with it.\n React.useEffect(() => stop, [stop]);\n\n return (\n <div aria-hidden data-menu-scroll-edge={side} className=\"matrx-menu-scroll-edge\">\n <div className=\"matrx-menu-scroll-fade\">\n <div\n data-menu-scroll-button=\"\"\n className=\"matrx-menu-scroll-button\"\n onPointerEnter={(e) => {\n if (e.pointerType !== \"touch\") glide();\n }}\n onPointerLeave={stop}\n onPointerDown={(e) => {\n // Never steal focus from the item the keyboard is on.\n e.preventDefault();\n const el = scroller.current;\n if (!el) return;\n el.scrollTop += dir * Math.max(el.clientHeight - PAGE_OVERLAP, PAGE_OVERLAP);\n }}\n >\n {side === \"top\" ? <RadixChevronUpIcon /> : <RadixChevronDownIcon />}\n </div>\n </div>\n </div>\n );\n}\n\n/**\n * Wire a menu surface: spread `ref` onto the Radix Content/SubContent and wrap\n * its children with `wrap`. Forwarded refs are composed, never replaced.\n */\nexport function useMenuScrollEdges<T extends HTMLElement>(...forwarded: Array<React.Ref<T> | undefined>) {\n const fade = useScrollFade();\n const scroller = React.useRef<HTMLElement | null>(null);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const ref = React.useCallback(composeRefs<T>(scroller as React.Ref<T>, fade.ref as React.Ref<T>, ...forwarded), [\n fade.ref,\n ...forwarded,\n ]);\n const wrap = (children: React.ReactNode) => (\n <>\n {fade.state.top ? <MenuScrollEdge side=\"top\" scroller={scroller} /> : null}\n {children}\n {fade.state.bottom ? <MenuScrollEdge side=\"bottom\" scroller={scroller} /> : null}\n </>\n );\n return { ref, wrap, surfaceClassName: \"matrx-menu-surface\" };\n}\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 // Every menu surface now carries this hook, so it must also run where\n // ResizeObserver does not exist (jsdom suites in every consumer); scroll\n // and mutation still measure there.\n const ro = typeof ResizeObserver === \"undefined\" ? null : 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","import * as React from \"react\";\n\n/**\n * A SUBMENU NEVER CLOSES BECAUSE ITS PARENT PANEL TOOK FOCUS (blind run PB-04, /notes,\n * 2026-10-02: at a 1024 px viewport AI Actions ▸ Text Operations ▸ Text Tools closed the whole\n * menu; works at 1600 px).\n *\n * Radix keeps a submenu open while the pointer leaves its trigger only when the pointer's last\n * horizontal move inside the parent panel points at the side the submenu is drawn on. A narrow\n * viewport FLIPS the submenu to the left; a pointer that last moved right (or jumped) and heads\n * for it is \"not moving to the submenu\", so Radix focuses the parent PANEL itself, the submenu\n * reads that as focus outside and closes under the pointer, and the click meant for it lands on\n * the page and closes the whole menu. Focus on the parent panel (role=\"menu\", the panel holding\n * this submenu's trigger) only means \"the pointer left a row without entering another one\" — it\n * never closes a submenu, on either side. Focus on another ROW still closes it, as before.\n *\n * Returns the composed ref and the `onFocusOutside` handler a SubContent wrapper spreads.\n */\nexport function useSubmenuSurvivesParentPanelFocus<T extends HTMLElement, E extends Event>(\n forwardedRef: React.ForwardedRef<T>,\n onFocusOutside: ((event: E) => void) | undefined,\n): { ref: (node: T | null) => void; onFocusOutside: (event: E) => void } {\n const content = React.useRef<T | null>(null);\n const ref = React.useCallback(\n (node: T | null) => {\n content.current = node;\n if (typeof forwardedRef === \"function\") forwardedRef(node);\n else if (forwardedRef) forwardedRef.current = node;\n },\n [forwardedRef],\n );\n const handle = (event: E) => {\n onFocusOutside?.(event);\n if (event.defaultPrevented) return;\n const to = event.target;\n const id = content.current?.id;\n if (!(to instanceof Element) || !id || to.getAttribute(\"role\") !== \"menu\") return;\n const holdsTrigger = Array.from(to.querySelectorAll(\"[aria-controls]\")).some((el) => el.getAttribute(\"aria-controls\") === id);\n if (holdsTrigger) event.preventDefault();\n };\n return { ref, onFocusOutside: handle };\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\";\nimport { FIELD_SURFACE_CLASS } from \"./field-surface\";\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 gap-2 whitespace-nowrap rounded-md ${FIELD_SURFACE_CLASS} 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]:min-w-0 [&>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\n/**\n * THE ONE DROPDOWN CHEVRON (page-pass 2026-09-27, /crm/<id>). Pickers drew three\n * different trigger glyphs side by side — a down chevron, an up-down pair, and\n * a larger up-down — so one form read as three kinds of control. Every dropdown\n * trigger (Select, CreatablePicker, every host combobox) draws THIS.\n */\nexport function SelectChevron({ className, size = \"default\" }: { className?: string; size?: \"sm\" | \"default\" }) {\n return (\n <RadixChevronDownIcon\n aria-hidden=\"true\"\n data-select-chevron=\"\"\n className={cn(size === \"sm\" ? \"h-3.5 w-3.5\" : \"h-4 w-4\", \"shrink-0 opacity-50\", className)}\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 <SelectChevron size={size === \"sm\" ? \"sm\" : \"default\"} />\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] max-w-[calc(100vw-2rem)] 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 \"max-w-full overflow-y-auto p-0.5\",\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 min-w-0 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 <span className=\"min-w-0 whitespace-normal break-words [overflow-wrap:anywhere]\">\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </span>\n {description ? (\n <span className=\"block min-w-0 break-words text-xs leading-snug text-muted-foreground [overflow-wrap:anywhere]\">\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","/**\n * THE ONE FIELD SURFACE (page-pass shared fix, 2026-09-27).\n *\n * Every control a person types into or picks from — Input, BasicInput,\n * Textarea, the Select trigger, and the host's ProInput / ProTextarea — sits on\n * this fill and this border. They used to disagree: Input and the elevated\n * Textarea filled with `bg-background` (the grey page colour in light mode),\n * BasicInput and the control Textarea were `bg-transparent` (grey on a grey\n * page), while the Select trigger filled with `bg-card` (white). On one form\n * the text fields therefore looked disabled beside white Selects\n * (/hr/settings/employer, the message-template editor) — a screen that lies\n * about what it will let you do.\n *\n * The surface is the Select's: the card fill and the regular border. A caller\n * that genuinely wants no fill (an inline cell editor) still passes\n * `bg-transparent`, which wins through `cn`.\n */\nexport const FIELD_SURFACE_CLASS = \"border border-border bg-card\";\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 { SelectChevron } from \"./select\";\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 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 <SelectChevron size=\"sm\" />\n </button>\n </PopoverTrigger>\n <PopoverContent sizing=\"content\" align=\"start\" className=\"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 * HOW WIDE THE POPOVER IS ALLOWED TO BE, and it is the SYSTEM that decides — never a\n * surface pasting its own `w-64` over the default (lane FIX-14, 2026-09-22).\n *\n * `\"fixed\"` (default) is the historical `w-72`: right for a menu of short, known\n * labels, where a ragged edge would look broken.\n *\n * `\"content\"` is for a popover whose whole job is to SHOW SOMETHING THE SYSTEM DID\n * NOT CHOOSE — a person's name, a record's title, a row the user is about to\n * create. The relation picker offered\n *\n * Create “Marisol Okonkwo — 418 Calle Pu\n *\n * inside a 16rem box, cut mid-word, on the one control that exists to show the name\n * being created. A fixed width cannot be right for content of unknown length, so\n * this one grows to its content between an honest floor and an honest ceiling:\n *\n * · at least the trigger's own width, and at least 20rem — the width Airtable's and\n * Notion's link-record pickers settle on, and wide enough that an ordinary\n * \"name — street, town\" fits on one line;\n * · at most 28rem, and never wider than the viewport less a 1rem gutter each side,\n * so it still fits a 375px phone with nothing running off the screen. The floor is\n * clamped by the same gutter, so on a very narrow screen the ceiling still wins.\n *\n * Beyond that ceiling the CONTENT truncates with an ellipsis and carries a `title`.\n * Growing, then ellipsis — never a mid-word cut.\n *\n * BOTH modes keep the phone gutter (2026-09-26): the box is never wider than the\n * viewport less 1rem each side, and Radix keeps it `collisionPadding` (16px) off every\n * screen edge. Measured at 375px before this: `w-72`/`w-80` callers landed flush on\n * the right edge (55→375) because collision padding was 0.\n */\n sizing?: \"fixed\" | \"content\";\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 sizing = \"fixed\",\n collisionPadding = 16,\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 collisionPadding={collisionPadding}\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] 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 sizing === \"content\"\n ? \"w-auto min-w-[min(max(var(--radix-popover-trigger-width),20rem),calc(100vw-2rem))] max-w-[min(28rem,calc(100vw-2rem))]\"\n : \"w-72 max-w-[calc(100vw-2rem)]\",\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` in `styles.css` hands its bottom\n * padding to the footer), so scrolled content never shows through beneath\n * the actions AND the footer never covers the row above it. Outside a\n * DialogContent both variables are unset, the padding falls back to `0px`,\n * and the footer is the plain row 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 * 6. ON DESKTOP A DIALOG IS A WINDOW, NOT A WALL (0.38.0, Arman 2026-09-23:\n * \"none of the built-in page ai integrations are accessible because the\n * page is totally blocked\"). Unless the caller passes `modal`, a desktop\n * dialog does not block the page: no overlay, the page, the Agents menu,\n * the assist dock and right-click AI stay usable beside it. It behaves like\n * a window: a click outside never closes it (`dismissOnOutsideClick` opts a\n * quick picker back in), Escape closes it only while focus is inside it\n * (Escape in the page belongs to the page), and its `DialogHeader` drags\n * it, clamped on screen, double-click to recenter. On a phone it stays the\n * blocking bottom sheet — nothing useful sits behind a sheet. Confirmations\n * are `AlertDialog`, a different component, and stay blocking. This is a\n * LIGHT window: the host's heavy window manager (tray, persistence) is a\n * separate system and must not be pulled into every dialog.\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 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\";\nimport { announceLayerFront, LAYER_FRONT_EVENT, type LayerFrontDetail } from \"./layer-front\";\nimport { keepFloatingLayersInside, useModalLayer } from \"./floating-layer\";\n\n/**\n * True when the dialog is a window because the caller said nothing about\n * modality (rule 6), false when the caller passed `modal={false}` itself.\n * The two sit on different layers: a default window sits WITH the other\n * layers it was opened from (z-10000 — a dialog opened from a menu, a popover\n * or a host window must never appear behind its opener), while an explicit\n * `modal={false}` keeps the older coexistence contract below the host's window\n * manager (z-900).\n */\nconst DialogWindowedByDefaultContext = React.createContext(false);\n\nconst Dialog = ({\n children,\n ...props\n}: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>) => {\n const isMobile = useIsMobile();\n // A window on desktop, a blocking sheet on a phone; `modal` forces either (rule 6).\n const modal = props.modal ?? isMobile;\n return (\n <DialogWindowedByDefaultContext.Provider value={props.modal === undefined}>\n <RadixDialogModalProvider modal={modal}>\n <DialogPrimitive.Root {...props} modal={modal}>\n {children}\n </DialogPrimitive.Root>\n </RadixDialogModalProvider>\n </DialogWindowedByDefaultContext.Provider>\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\n// Shared identity across independently bundled public entrypoints/loaders.\nconst CONTEXT_SLOT = Symbol.for(\"ai-matrx.design-system.dialog-container-context\");\nconst contextRegistry = globalThis as typeof globalThis & { [CONTEXT_SLOT]?: React.Context<HTMLElement | null> };\nconst DialogContainerContext = contextRegistry[CONTEXT_SLOT] ??= 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>(({ onInteractOutside, ...props }, ref) => {\n const isModal = useRadixDialogModal();\n // A blocking dialog registers, so floating layers opened from it (a host\n // window, a picker window) stack above its scrim (floating-layer.tsx).\n useModalLayer(isModal);\n return (\n <DialogPrimitive.Content\n {...props}\n ref={ref}\n aria-modal={isModal || undefined}\n onInteractOutside={keepFloatingLayersInside(onInteractOutside)}\n />\n );\n});\nDialogContentPrimitive.displayName = \"DialogContentPrimitive\";\n\nconst DIALOG_DESKTOP_CLASSES =\n \"matrx-dialog-card fixed inset-0 z-[10000] m-auto grid h-fit min-w-0 w-full max-w-lg 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] 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-none w-full max-w-full max-h-[90dvh] rounded-b-none rounded-t-2xl overflow-y-auto\";\n\n/** Drag props the windowed DialogContent hands its DialogHeader (rule 6). */\ntype DialogWindowHandle = {\n onPointerDown: (event: React.PointerEvent<HTMLElement>) => void;\n onPointerMove: (event: React.PointerEvent<HTMLElement>) => void;\n onPointerUp: (event: React.PointerEvent<HTMLElement>) => void;\n onPointerCancel: (event: React.PointerEvent<HTMLElement>) => void;\n onDoubleClick: () => void;\n};\nconst DialogWindowHandleContext = React.createContext<DialogWindowHandle | null>(null);\n\n/** Pixels of a dragged window that must stay on screen. */\nconst WINDOW_KEEP_VISIBLE = 80;\n\nfunction isInteractiveTarget(target: EventTarget | null): boolean {\n return (\n target instanceof Element &&\n Boolean(target.closest(\"button, a, input, textarea, select, [role='button'], [contenteditable='true']\"))\n );\n}\n\nexport interface DialogContentProps\n extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {\n /**\n * Windowed (non-blocking) dialogs never close from a click outside them —\n * the person is reaching for the page or an AI control beside the window.\n * Pass `true` for a quick picker that should close when the person clicks\n * away. Ignored on a blocking dialog, which keeps Radix's behaviour.\n */\n dismissOnOutsideClick?: boolean;\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 dismissOnOutsideClick = false,\n onInteractOutside,\n onEscapeKeyDown,\n onPointerDownCapture,\n onFocusCapture,\n style,\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 windowed = !isModal && !asSheet;\n const windowedByDefault = React.useContext(DialogWindowedByDefaultContext);\n const [containerEl, setContainerEl] = React.useState<HTMLElement | null>(\n null,\n );\n\n // ── the front-most layer (layer-front.ts) ───────────────────────────────\n // A default window sits at z-10000 with the layers it was opened from; it\n // steps behind when another layer comes to the front after it (a host\n // window opened from the Agents menu) and returns when the person reaches\n // for it again. An explicit modal={false} keeps its fixed z-900 contract.\n const stacks = windowed && windowedByDefault;\n const [behind, setBehind] = React.useState(false);\n React.useEffect(() => {\n if (!stacks || !containerEl) return;\n const onFront = (event: Event) => {\n const element = (event as CustomEvent<LayerFrontDetail>).detail?.element ?? null;\n if (element && (element === containerEl || containerEl.contains(element))) return;\n setBehind(true);\n };\n document.addEventListener(LAYER_FRONT_EVENT, onFront);\n // Opening is coming to the front.\n announceLayerFront(containerEl);\n return () => document.removeEventListener(LAYER_FRONT_EVENT, onFront);\n }, [stacks, containerEl]);\n const bringToFront = () => {\n if (!stacks || !containerEl) return;\n setBehind(false);\n announceLayerFront(containerEl);\n };\n\n // ── rule 6: the windowed dialog drags by its header ──────────────────────\n const [offset, setOffset] = React.useState({ x: 0, y: 0 });\n const dragRef = React.useRef<{ x: number; y: number; baseX: number; baseY: number } | null>(null);\n const handle = React.useMemo<DialogWindowHandle | null>(() => {\n if (!windowed) return null;\n const clamp = (value: number, limit: number) => Math.max(-limit, Math.min(limit, value));\n return {\n onPointerDown: (event) => {\n if (event.button !== 0 || isInteractiveTarget(event.target)) return;\n dragRef.current = { x: event.clientX, y: event.clientY, baseX: offset.x, baseY: offset.y };\n event.currentTarget.setPointerCapture?.(event.pointerId);\n },\n onPointerMove: (event) => {\n const start = dragRef.current;\n if (!start) return;\n setOffset({\n x: clamp(start.baseX + event.clientX - start.x, window.innerWidth / 2 - WINDOW_KEEP_VISIBLE / 2),\n y: clamp(start.baseY + event.clientY - start.y, window.innerHeight / 2 - WINDOW_KEEP_VISIBLE / 2),\n });\n },\n onPointerUp: (event) => {\n if (!dragRef.current) return;\n dragRef.current = null;\n event.currentTarget.releasePointerCapture?.(event.pointerId);\n },\n onPointerCancel: () => {\n dragRef.current = null;\n },\n onDoubleClick: () => setOffset({ x: 0, y: 0 }),\n };\n }, [windowed, offset.x, offset.y]);\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 && !windowedByDefault && \"z-[900]\",\n // Another layer came to the front after this window (layer-front.ts).\n stacks && behind && \"z-[999]\",\n // Without an overlay the card needs its own separation from the page.\n windowed && \"shadow-2xl ring-1 ring-border/60\",\n )}\n style={\n windowed && (offset.x !== 0 || offset.y !== 0)\n ? { ...style, translate: `${offset.x}px ${offset.y}px` }\n : style\n }\n onPointerDownCapture={(event) => {\n onPointerDownCapture?.(event);\n if (behind) bringToFront();\n }}\n onFocusCapture={(event) => {\n onFocusCapture?.(event);\n if (behind) bringToFront();\n }}\n onInteractOutside={(event) => {\n onInteractOutside?.(event);\n if (windowed && !dismissOnOutsideClick) event.preventDefault();\n }}\n onEscapeKeyDown={(event) => {\n onEscapeKeyDown?.(event);\n // Escape pressed in the page belongs to the page (a grid cancelling\n // an edit), not to the window beside it.\n // The key's own target is where the person pressed it; focus is\n // the fallback when the event carries no element target.\n const pressedIn =\n event.target instanceof Node && event.target !== document.body\n ? event.target\n : document.activeElement;\n if (windowed && containerEl && !(pressedIn && containerEl.contains(pressedIn))) {\n event.preventDefault();\n }\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 <DialogWindowHandleContext.Provider value={handle}>\n <PortalContainerProvider\n container={containerEl ?? injectedContainer ?? null}\n >\n {children}\n </PortalContainerProvider>\n </DialogWindowHandleContext.Provider>\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 // In a windowed dialog the header is the drag handle (rule 6).\n const handle = React.useContext(DialogWindowHandleContext);\n return (\n <div\n data-slot=\"dialog-header\"\n {...(handle\n ? {\n ...handle,\n \"data-window-handle\": \"\",\n title: \"Drag to move · double-click to recenter\",\n }\n : {})}\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 handle && \"cursor-grab select-none active:cursor-grabbing\",\n className,\n )}\n {...props}\n />\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/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 //\n // 🚨 THERE IS NO `mb-[…]` HERE, AND THERE MUST NEVER BE ONE AGAIN\n // (0.11.3, feedback bf8fb00b). The bleed over the card's bottom padding\n // used to be a NEGATIVE BLOCK MARGIN, which makes this box taller than\n // the grid area the card allocates it — and `position: sticky` CLAMPS a\n // box to its containing block, so the browser yanked the footer UP by\n // `--dialog-pad` against the card's `gap-4` and painted 8px of opaque\n // footer over the last line of the consequence, at every length. The\n // card now RESERVES this footer's block size instead (`matrx-dialog-card`\n // in styles.css hands over its `padding-bottom`), so the bleed costs no\n // margin at all. Guard: `sticky-footer-geometry.test.tsx`.\n //\n // These stay UTILITIES rather than a shipped rule so a caller's\n // `className` still wins through tailwind-merge — a shipped rule would\n // have to be unlayered to survive Tailwind preflight (§ THE PREFLIGHT\n // RULE in styles.css) and would then override every caller's padding.\n \"sticky bottom-0 z-10 bg-background pt-3\",\n \"mx-[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","/**\n * THE FRONT-MOST LAYER — one signal every floating layer shares, so the layer\n * the person used last is the one on top.\n *\n * A windowed Dialog sits at z-10000 so it is never behind the menu, popover or\n * host window it was opened from (0.38.1). But a host window opened or focused\n * AFTER it — the window an agent run opens from the Agents menu while Table\n * settings is open — then sat underneath it, and its composer could not be\n * clicked or typed into (found live 2026-09-26, register ARE-010). Recency has\n * to decide, across both systems, without coupling them.\n *\n * So any layer that comes to the front announces it: `announceLayerFront(el)`\n * dispatches `matrx:layer-front` on `document`. A windowed Dialog announces\n * itself when it opens and when the person presses or focuses inside it; it\n * steps BEHIND (z-999, still above the page and below the host's window\n * manager at 1000+) whenever another layer announces, and comes back the\n * moment the person reaches for it. A host window manager announces its\n * window on open and on focus.\n */\n\nexport const LAYER_FRONT_EVENT = \"matrx:layer-front\";\n\nexport interface LayerFrontDetail {\n /** The element that came to the front. */\n element: Element | null;\n}\n\n/** Tell every other floating layer that `element` is now the one in front. */\nexport function announceLayerFront(element: Element | null): void {\n if (typeof document === \"undefined\") return;\n document.dispatchEvent(\n new CustomEvent<LayerFrontDetail>(LAYER_FRONT_EVENT, { detail: { element } }),\n );\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\";\nimport { useMenuScrollEdges } from \"./menu-scroll-edges\";\nimport { useSubmenuSurvivesParentPanelFocus } from \"./submenu-focus\";\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\n// gap-2: an item's icon never touches its label (page-pass 2026-09-27, admin pass — every menu).\nconst MENU_ITEM_CLASS =\n \"relative flex cursor-default select-none items-center gap-2 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\n/**\n * A SUBMENU OPENS BESIDE ITS PARENT, NEVER ON TOP OF IT (merged-grid review 2, C1: \"nested\n * submenus overlap the parent menu\"). The submenu was drawn INSIDE the parent's surface, and that\n * surface's entry animation leaves a `transform` on it — which makes the parent the containing\n * block of the submenu's `position: fixed`. Radix measured the submenu's place in viewport\n * coordinates and the browser applied them from the parent's corner, so it landed over the parent\n * (and was clipped by the parent's scroll box). Portalled like every other surface, through the\n * same container seam, it sits beside its trigger as Radix placed it.\n */\nconst DropdownMenuSubContent = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent> & { container?: HTMLElement | null }\n>(({ className, container, sideOffset = 2, alignOffset = -4, collisionPadding = 8, onFocusOutside, children, ...props }, ref) => {\n const portalContainer = usePortalContainer(container);\n // A flipped submenu survives the pointer leaving its trigger (see submenu-focus.ts).\n const keep = useSubmenuSurvivesParentPanelFocus(ref, onFocusOutside);\n const edges = useMenuScrollEdges(keep.ref);\n return (\n <DropdownMenuPrimitive.Portal container={portalContainer}>\n <DropdownMenuPrimitive.SubContent\n ref={edges.ref}\n onFocusOutside={keep.onFocusOutside}\n data-slot=\"dropdown-menu-sub-content\"\n sideOffset={sideOffset}\n alignOffset={alignOffset}\n collisionPadding={collisionPadding}\n className={cn(MENU_SURFACE_CLASS, edges.surfaceClassName, \"shadow-lg\", MOTION_POPPER, className)}\n {...props}\n >\n {edges.wrap(children)}\n </DropdownMenuPrimitive.SubContent>\n </DropdownMenuPrimitive.Portal>\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, children, ...props }, ref) => {\n const portalContainer = usePortalContainer(container);\n const edges = useMenuScrollEdges(ref);\n return (\n <DropdownMenuPrimitive.Portal container={portalContainer}>\n <DropdownMenuPrimitive.Content\n ref={edges.ref}\n data-slot=\"dropdown-menu-content\"\n sideOffset={sideOffset}\n className={cn(\n MENU_SURFACE_CLASS,\n edges.surfaceClassName,\n \"shadow-md\",\n MOTION_POPPER,\n className,\n )}\n {...props}\n >\n {edges.wrap(children)}\n </DropdownMenuPrimitive.Content>\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\";\nimport { FIELD_SURFACE_CLASS } from \"./field-surface\";\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 ${FIELD_SURFACE_CLASS} 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-card [&:-webkit-autofill]:shadow-[0_0_0_1000px_hsl(var(--card))_inset] [&:-webkit-autofill]:[caret-color:currentColor]\n dark:[&:-webkit-autofill]:shadow-[0_0_0_1000px_hsl(var(--card))_inset] dark:[&:-webkit-autofill]:[-webkit-text-fill-color:hsl(var(--foreground))]\n [&:-webkit-autofill:hover]:shadow-[0_0_0_1000px_hsl(var(--card))_inset] [&:-webkit-autofill:focus]:shadow-[0_0_0_1000px_hsl(var(--card))_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 ${FIELD_SURFACE_CLASS} 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 flex-1 transition-all\",\n PROGRESS_TONES[tone],\n // The sweep sets its own width (package layer); a `w-full` utility\n // here would outrank it and paint a solid bar.\n isIndeterminate ? \"matrx-progress-indeterminate\" : \"w-full\",\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 /** Stable accessible name when the visual label contains separate nodes. */\n ariaLabel?: string;\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 aria-label={option.ariaLabel}\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 * ArchiveFilter — THE platform archive filter control.\n *\n * THE ARCHIVED-ITEMS LAW (Arman, 2026-09-09 —\n * common-docs/policies/archived-items.md): every list surface over an entity\n * that can be archived carries this control, its default hides archived rows,\n * and revealing them is ONE click. It is a class, not an instance: agents,\n * workflows, employees, HR documents, conversations, admin tables — the same\n * three states, the same words, everywhere.\n *\n * The vocabulary is `matrx-frontend/lib/entity-list`'s `ArchivedFilter`\n * verbatim (`active` | `archived` | `all`, default `active`, labels \"Active\n * only\" / \"Archived only\" / \"Active + archived\") so a user meets one control,\n * not one per app. `@ai-matrx/agents/catalog`'s `archFilter` is the same axis\n * with its own legacy third value (`both`); `ARCHIVE_FILTER_VALUES` is the\n * canonical set new code binds to.\n *\n * The filter is a REQUEST, never a client-side sieve: hand the value to the\n * reader (an RPC's `p_archived`, an endpoint's `archived=`) so counts, badges\n * and pagination describe what the list actually renders.\n */\n\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { SegmentedControl, type SegmentOption } from \"./segmented-control\";\n\n/** The three states, in display order. */\nexport const ARCHIVE_FILTER_VALUES = [\"active\", \"archived\", \"all\"] as const;\n\nexport type ArchiveFilterValue = (typeof ARCHIVE_FILTER_VALUES)[number];\n\n/** The platform default: a list hides archived rows until asked. */\nexport const DEFAULT_ARCHIVE_FILTER: ArchiveFilterValue = \"active\";\n\n/**\n * The ONE noun for archived rows, platform-wide. Both controls speak it: the\n * filter's `archived` state (\"Archived only\") and `ArchivedDisclosure`'s\n * button (\"Archived (N)\"). Renaming it in one place renames it in both, which\n * is the point — a user meets one word, not two.\n */\nexport const ARCHIVE_LABEL = \"Archived\";\n\n/** The one wording. Hosts pass `labels` only to shorten, never to rename. */\nexport const ARCHIVE_FILTER_LABELS: Record<ArchiveFilterValue, string> = {\n active: \"Active only\",\n archived: `${ARCHIVE_LABEL} only`,\n all: \"Active + archived\",\n};\n\n/**\n * A disclosure's open/closed state said in the tri-state vocabulary, for the\n * hosts whose \"Archived (N)\" toggle IS a server request rather than a nested\n * render. Closed asks for the platform default (archived hidden); open asks\n * for `all`, because a disclosure reveals archived rows BESIDE the live ones —\n * it never replaces the list with the archive.\n */\nexport function archiveFilterFromDisclosure(open: boolean): ArchiveFilterValue {\n return open ? \"all\" : DEFAULT_ARCHIVE_FILTER;\n}\n\n/**\n * Narrow an untrusted value (a URL param, a stored preference, an API echo)\n * to the tri-state. Anything unrecognised falls back to the platform default\n * rather than silently widening a list to archived rows.\n */\nexport function toArchiveFilter(\n value: unknown,\n fallback: ArchiveFilterValue = DEFAULT_ARCHIVE_FILTER,\n): ArchiveFilterValue {\n return ARCHIVE_FILTER_VALUES.includes(value as ArchiveFilterValue)\n ? (value as ArchiveFilterValue)\n : fallback;\n}\n\nexport interface ArchiveFilterProps {\n value: ArchiveFilterValue;\n onValueChange: (value: ArchiveFilterValue) => void;\n /**\n * Per-state row counts, when the reader returns them (a facet query, a\n * `total_count`). A count that is not honest is worse than none, so pass a\n * key only when the number describes what the list would actually render.\n */\n counts?: Partial<Record<ArchiveFilterValue, number>>;\n /** Shorter wording for a dense toolbar. Never a different meaning. */\n labels?: Partial<Record<ArchiveFilterValue, string>>;\n size?: \"sm\" | \"md\" | \"lg\";\n className?: string;\n /** Accessible name for the group. */\n \"aria-label\"?: string;\n disabled?: boolean;\n}\n\n/**\n * The control. One click from \"Active only\" to seeing archived rows.\n */\nexport function ArchiveFilter({\n value,\n onValueChange,\n counts,\n labels,\n size = \"sm\",\n className,\n \"aria-label\": ariaLabel = \"Archive filter\",\n disabled = false,\n}: ArchiveFilterProps) {\n const data = React.useMemo<SegmentOption[]>(\n () =>\n ARCHIVE_FILTER_VALUES.map((state) => {\n const text = labels?.[state] ?? ARCHIVE_FILTER_LABELS[state];\n const count = counts?.[state];\n return {\n value: state,\n disabled,\n ariaLabel: typeof count === \"number\" ? `${text} ${count}` : text,\n label:\n typeof count === \"number\" ? (\n <span className=\"inline-flex items-center gap-1.5\">\n <span>{text}</span>\n <span className=\"text-muted-foreground tabular-nums\">{count}</span>\n </span>\n ) : (\n text\n ),\n };\n }),\n [counts, labels, disabled],\n );\n\n return (\n <div role=\"group\" aria-label={ariaLabel} className={cn(\"inline-flex\", className)}>\n <SegmentedControl\n value={value}\n onValueChange={(next) => onValueChange(toArchiveFilter(next, value))}\n data={data}\n size={size}\n />\n </div>\n );\n}\n","\"use client\";\n\n/**\n * ArchivedDisclosure — THE ARCHIVED-ITEMS LAW, card-list half.\n * (`common-docs/policies/archived-items.md`, Arman 2026-09-09.)\n *\n * Every list over an entity that can be archived carries an archive control,\n * it defaults to HIDING archived rows, and revealing them is one or two\n * clicks — on the surface itself. There are exactly TWO implementations of\n * that control in the platform, and both live in THIS package:\n *\n * • `ArchiveFilter` — the tri-state segmented control (Active only /\n * Archived only / Active + archived) for table and browse surfaces whose\n * reader takes an archive parameter. Prefer it whenever the surface can\n * express the request server-side.\n * • `ArchivedDisclosure` — THIS component: a one-click \"Archived (N)\"\n * disclosure, closed by default, revealing the archived rows in place\n * underneath. For card lists, panels and pickers that are not table\n * shaped.\n *\n * Never invent a third. The disclosure was proven first in matrx-frontend's\n * Transcript Studio, lived as `components/official/ArchivedDisclosure` there,\n * and moved here (0.14.0) verbatim so every client inherits the same control\n * instead of re-growing it per app.\n *\n * Both controls share one vocabulary: `ARCHIVE_LABEL` is the single noun, and\n * `archiveFilterFromDisclosure(open)` says a disclosure's state in the\n * tri-state words for a host whose toggle IS a server request.\n *\n * Two shapes, one primitive:\n *\n * <ArchivedDisclosure count={n} open={open} onOpenChange={setOpen}>\n * …archived rows…\n * </ArchivedDisclosure>\n *\n * renders the button AND the revealed block. Omit `children` when the caller\n * merges the archived rows into an existing table/grid itself — the button is\n * then the whole control.\n *\n * The count is ALWAYS the true number of archived rows the surface holds. A\n * screen never lies: when there is nothing archived the control renders\n * nothing at all rather than an empty promise. A surface whose archive view is\n * a SERVER request (the rows below the button are the archived page itself,\n * not children of it) passes `keepWhileOpen` so the revealed view never loses\n * its way back.\n *\n * `countLabel` exists for the one case a bare integer cannot tell the truth: a\n * server-side count that hit its cap (render `\"12+\"`), or a count that has not\n * landed yet (pass `null` and no parenthetical is printed at all).\n */\n\nimport * as React from \"react\";\n\nimport { ARCHIVE_LABEL } from \"./archive-filter\";\nimport { cn } from \"./cn\";\nimport { ArchiveIcon, ChevronDownIcon, ChevronRightIcon } from \"./icons\";\n\nexport interface ArchivedDisclosureProps {\n /** True number of archived rows this surface holds. 0 renders nothing. */\n count: number;\n /** Whether archived rows are currently revealed. */\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /**\n * The archived rows. Omit when the host merges them into its own list and\n * only needs the toggle.\n */\n children?: React.ReactNode;\n /** Noun for the rows, so the button reads in the surface's own words. */\n label?: string;\n /**\n * Override the parenthetical. A string replaces the number (`\"12+\"` for a\n * capped server count); `null` prints no parenthetical at all, for a count\n * that has not arrived yet. Omit it and the honest `count` is printed.\n */\n countLabel?: string | null;\n /**\n * Keep the control rendered while `open` even at `count === 0`. For surfaces\n * where opening SWITCHES the list to the archive (a server-side filter)\n * rather than nesting rows inside this component: without it the way back\n * would vanish the moment the count read zero or had not landed.\n */\n keepWhileOpen?: boolean;\n className?: string;\n contentClassName?: string;\n}\n\nexport function ArchivedDisclosure({\n count,\n open,\n onOpenChange,\n children,\n label = ARCHIVE_LABEL,\n countLabel,\n keepWhileOpen = false,\n className,\n contentClassName,\n}: ArchivedDisclosureProps) {\n // Nothing archived: an empty promise, so render nothing — unless this\n // surface's open state IS the archive view, whose way back must never vanish.\n if (count <= 0 && !(open && keepWhileOpen)) return null;\n\n const parenthetical = countLabel === undefined ? String(count) : countLabel;\n\n return (\n <div className={cn(\"min-w-0\", className)}>\n <button\n type=\"button\"\n onClick={() => onOpenChange(!open)}\n aria-expanded={open}\n className=\"flex w-full items-center gap-2 rounded-lg px-2 py-2 text-sm text-muted-foreground hover:bg-accent active:bg-accent\"\n >\n {open ? (\n <ChevronDownIcon className=\"h-4 w-4 shrink-0\" />\n ) : (\n <ChevronRightIcon className=\"h-4 w-4 shrink-0\" />\n )}\n <ArchiveIcon className=\"h-4 w-4 shrink-0\" />\n <span className=\"truncate\">\n {parenthetical === null ? label : `${label} (${parenthetical})`}\n </span>\n </button>\n {open && children ? (\n <div className={cn(\"mt-1\", contentClassName)}>{children}</div>\n ) : null}\n </div>\n );\n}\n\nexport default ArchivedDisclosure;\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 { keepFloatingLayersInside, useModalLayer } from \"./floating-layer\";\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>(({ onInteractOutside, ...props }, ref) => {\n const isModal = useRadixDialogModal();\n useModalLayer(isModal);\n return (\n <SheetPrimitive.Content\n {...props}\n ref={ref}\n aria-modal={isModal || undefined}\n onInteractOutside={keepFloatingLayersInside(onInteractOutside)}\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 // The modal tier (floating-layer.tsx), like every other blocking scrim: a\n // sheet at z-50 opened from a host window (z-1000+) opened behind it.\n \"fixed inset-0 z-[10000] 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 isModal = useRadixDialogModal();\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 // A blocking sheet sits on the modal tier; a non-modal side panel\n // keeps z-50 beside the page.\n isModal && \"z-[10000]\",\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 data-slot=\"sheet-footer\"\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","\"use client\";\n\n/**\n * OrganizationPicker — THE ONE \"which organization am I acting in\" control,\n * identical on every Matrx surface (the main app's user menu and header nudge,\n * Workflow Studio's sidebar, the admin dashboard's settings).\n *\n * Ported from matrx-frontend `features/organizations/components/\n * OrganizationPickerPanel.tsx` + `UserMenuOrgSection.tsx` + `DefaultOrgSwitch.tsx`\n * (2026-09-08), which until then were the ONLY surfaces with the full picker;\n * Studio and the dashboard each had a bare `<Select>` with different copy,\n * different placement and no default control. Three UIs for one fact.\n *\n * THE ACTIVE ROW IS THE ANSWER (owner, 2026-10-01). The active organization is\n * the highlighted row — tinted, bold, ringed and checked — and nothing else:\n * the \"Working in …\" sentence above the list is gone (\"It should be\n * highlighted and clear\"), and so is the \"Keep it at the top\" switch.\n *\n * FAVORITES (owner, 2026-10-01: \"add a star you can click to favorite any of\n * them\"). Every row carries its own star; a person favorites as many as they\n * like, and favorites are drawn first. The star never selects the row — it is\n * a sibling button, not part of the row — and it picks no organization for\n * anyone: which organization you are working in is this device's own\n * remembered choice (the host's resolver), never a star.\n *\n * 🚨 A HUNDRED ROWS IS NOT A LIST (VERIFIER-8 MEDIUM-3, 2026-09-21).\n * The first screen of the data product offered the admin account's 116\n * organizations nine at a time, with no search, most of them lane fixtures.\n * Three things answer that, and all three are here rather than in one host:\n * • SEARCH over name and abbreviation, once the list passes eight rows.\n * • TEST ORGANIZATIONS HIDDEN by default behind the platform's one\n * archive-style disclosure (`ArchivedDisclosure`), with their count always\n * on screen. Hidden, never dropped.\n * • THE PERSON'S OWN organizations drawn first, under the starred one.\n * The host classifies (`isTestFixture`, `isOwn`); this component decides\n * nothing about a name it is given.\n *\n * Seam inversions from the origin: lucide `Check`/`Star` become package\n * SVGs (C19); the host `Switch` becomes this package's; `cn` is local.\n */\n\nimport * as React from \"react\";\n\nimport { ArchivedDisclosure } from \"./archived-disclosure\";\nimport { cn } from \"./cn\";\nimport { ErrorBox } from \"./error-box\";\nimport { LucideCheckIcon, StarIcon } from \"./icons\";\nimport { Input } from \"./input\";\nimport { Skeleton } from \"./skeleton\";\n\n/**\n * Above this many rows the list stops being something a person reads and\n * starts being something they hunt through, so the search box appears. Below\n * it a search box is one more control over a list the eye already took in.\n */\nconst SEARCH_APPEARS_ABOVE = 8;\n\n/** Case-insensitive substring over the two things a person actually types. */\nfunction matchesQuery(org: OrganizationPickerOrganization, query: string): boolean {\n const q = query.trim().toLowerCase();\n if (!q) return true;\n if (org.name.toLowerCase().includes(q)) return true;\n const abbreviation = org.abbreviation?.trim().toLowerCase();\n return !!abbreviation && abbreviation.includes(q);\n}\n\nexport interface OrganizationPickerOrganization {\n id: string;\n name: string;\n /** Database-validated 2–3 uppercase letters. Optional — not every report carries it. */\n abbreviation?: string | null;\n /**\n * THE ADDRESS, for when the NAME is not enough — its slug, or whatever else the\n * host has that tells two of them apart.\n *\n * 🚨 WHY (crew D2, 2026-09-21). Two organizations called \"Kessler Lab for Applied\n * Microbial Ecology\" and two called \"Wraithmoor Regional Museum of Art & Craft\" sat\n * in one list, identical down to the abbreviation tile, and a person had no way of\n * knowing which one they were about to work in. The list drew the name and nothing\n * else, so there was nothing for it to draw.\n *\n * It is shown ONLY on the rows whose name another row in the list also carries —\n * the way Slack shows a workspace's URL and Google shows the account's email, and\n * only where it settles the question. A list of distinct names stays exactly as it\n * was, because a second line under every row is noise a person learns to skip.\n */\n distinguisher?: string | null;\n /**\n * This organization is a TEST FIXTURE — a lane's scratch organization, not a\n * business anybody works in. Classified in `iam.organizations.settings`\n * (`test_fixture`), never guessed from its name.\n *\n * 🚨 WHY (VERIFIER-8 MEDIUM-3, 2026-09-21). The admin account belongs to 116\n * organizations and 59 of them are fixtures. The first screen of the data\n * product offered all of them, nine at a time, with no search — so the two\n * or three a person actually works in were buried under lane debris. The\n * archived-items law already answers this shape everywhere else in the\n * platform: hide by default, ONE disclosure to reveal, and the count of what\n * is hidden is always on screen. It is hidden, never dropped: a fixture the\n * person genuinely wants is one click away.\n */\n isTestFixture?: boolean;\n /**\n * The signed-in person created this organization. Drawn before the rest,\n * under the starred one — the same reason Slack puts your own workspace\n * first: in a list of a hundred, yours must not be something you search for.\n */\n isOwn?: boolean;\n /**\n * A short trailing label for the row — what a click does or the row's state\n * (\"Open\", \"Finish setup\", \"Turn on HR\"). Muted text, right-aligned; the row\n * stays one button. Omitted, the row is exactly as before.\n */\n detail?: string | null;\n /**\n * Fold this row behind the host's second disclosure (`foldedLabel`) — for rows\n * the person rarely came for (organizations without HR). Hidden, counted,\n * one click away; a search that matches only folded rows opens the fold.\n */\n folded?: boolean;\n}\n\nexport interface OrganizationPickerProps {\n organizations: readonly OrganizationPickerOrganization[];\n /** The organization the person is acting in right now; null = nothing chosen. */\n activeOrganizationId: string | null;\n /** The person's favorite organizations, drawn first and starred. */\n favoriteOrganizationIds?: readonly string[];\n loading?: boolean;\n /** Memberships could not be read. The panel says so instead of showing an empty list. */\n loadFailed?: boolean;\n /** Choose the active organization. Hosts persist + refetch here. */\n onSelect: (organization: OrganizationPickerOrganization) => void;\n /**\n * Favorite (true) or unfavorite (false) one organization. Omit to draw no\n * star buttons — a host with no write path must not show a control that\n * does nothing (a favorite is still marked, read-only).\n */\n onToggleFavorite?: ((organizationId: string, favorite: boolean) => void) | undefined;\n /** Hide the \"Organization\" eyebrow when the host already labels the section. */\n hideHeading?: boolean;\n /** Extra classes on each row button (e.g. a host menu's item class). */\n itemClassName?: string;\n /** The noun on the disclosure that holds `folded` rows. Default \"More\". */\n foldedLabel?: string;\n className?: string;\n}\n\n/**\n * An organization's colour — one of a fixed set of hues, chosen from its id so\n * the same organization wears the same colour on every surface and every\n * device. Color tells organizations apart at a glance; the letters still say\n * which one (owner, 2026-10-01: \"a bit of color for the logos\").\n */\nconst ORGANIZATION_HUES = [217, 262, 330, 12, 32, 152, 189, 290] as const;\nexport function organizationColor(seed: string): { background: string; color: string } {\n let hash = 0;\n for (let index = 0; index < seed.length; index += 1) {\n hash = (hash * 31 + seed.charCodeAt(index)) >>> 0;\n }\n const hue = ORGANIZATION_HUES[hash % ORGANIZATION_HUES.length];\n return { background: `hsl(${hue} 62% 46%)`, color: \"#fff\" };\n}\n\n/**\n * THE organization mark — its own logo when it has one, otherwise its 2–3\n * letter abbreviation on its colour tile (the first letter of the name when the\n * report has no abbreviation, so a tile is never empty). Three letters get a\n * smaller face than two so they fit the tile. Every Matrx surface draws this.\n */\nexport function OrganizationMark({\n id,\n name,\n abbreviation,\n logoUrl,\n size = 20,\n className,\n}: {\n /** Seeds the colour; the name is used when absent. */\n id?: string | null | undefined;\n name: string;\n abbreviation?: string | null | undefined;\n logoUrl?: string | null | undefined;\n size?: number;\n className?: string | undefined;\n}) {\n const box = { width: size, height: size };\n if (logoUrl) {\n return (\n <span\n style={box}\n className={cn(\"relative inline-flex shrink-0 overflow-hidden rounded-md bg-muted\", className)}\n data-slot=\"organization-mark\"\n >\n <img src={logoUrl} alt={name} className=\"h-full w-full object-cover\" />\n </span>\n );\n }\n const letters = ((abbreviation && abbreviation.trim()) || name.trim().slice(0, 1) || \"?\")\n .slice(0, 3)\n .toUpperCase();\n const fontSize = Math.round(size * (letters.length >= 3 ? 0.36 : 0.44));\n return (\n <span\n style={{ ...box, ...organizationColor(id || name), fontSize }}\n className={cn(\n \"inline-flex shrink-0 items-center justify-center rounded-md font-bold leading-none tracking-tight\",\n className,\n )}\n aria-label={`Organization abbreviation ${letters}`}\n title={letters}\n data-slot=\"organization-mark\"\n >\n {letters}\n </span>\n );\n}\n\nexport function OrganizationPicker({\n organizations,\n activeOrganizationId,\n favoriteOrganizationIds = [],\n loading = false,\n loadFailed = false,\n onSelect,\n onToggleFavorite,\n hideHeading = false,\n itemClassName,\n foldedLabel = \"More\",\n className,\n}: OrganizationPickerProps) {\n const [query, setQuery] = React.useState(\"\");\n const [showFixtures, setShowFixtures] = React.useState(false);\n const [showFolded, setShowFolded] = React.useState(false);\n\n const favorites = new Set(favoriteOrganizationIds);\n const isFavorite = (id: string) => favorites.has(id);\n /**\n * THE ORDER, and it is the whole point of this control on an account with a\n * hundred memberships: the person's favorites, then their OWN organizations,\n * then everything else. Inside each band the host's order is kept exactly as\n * given — this reorders bands, it never sorts names.\n */\n const rank = (org: OrganizationPickerOrganization) =>\n isFavorite(org.id) ? 0 : org.isOwn ? 1 : 2;\n const ordered = [...organizations].sort((a, b) => rank(a) - rank(b));\n\n const matching = ordered.filter((org) => matchesQuery(org, query));\n const listed = matching.filter((org) => !org.isTestFixture && !org.folded);\n const folded = matching.filter((org) => !org.isTestFixture && org.folded);\n const fixtures = matching.filter((org) => org.isTestFixture);\n // The fold opens by itself when it is all there is, or when a search found\n // something inside it — a match is never hidden behind a closed disclosure.\n const foldOpen =\n showFolded || (folded.length > 0 && (listed.length === 0 || query.trim().length > 0));\n const searchable = organizations.length > SEARCH_APPEARS_ABOVE;\n /**\n * Which display names appear more than once in THIS list — the only rows where the\n * second line earns its space. Computed from the list itself, so the answer is right\n * for the person looking at it rather than for organizations they cannot see.\n */\n const sharesItsName = (org: OrganizationPickerOrganization) =>\n organizations.filter((other) => other.name.trim() === org.name.trim()).length > 1;\n\n const renderRow = (org: OrganizationPickerOrganization) => {\n const isActive = org.id === activeOrganizationId;\n const favorite = isFavorite(org.id);\n return (\n <li key={org.id} role=\"none\" className=\"group/org relative flex items-center\">\n <button\n type=\"button\"\n role=\"option\"\n aria-selected={isActive}\n aria-pressed={isActive}\n onClick={(event) => {\n // Inside a host menu the click must not also close/route the menu.\n event.stopPropagation();\n onSelect(org);\n }}\n className={cn(\n \"flex w-full min-w-0 items-center gap-2.5 rounded-md py-1.5 pl-2 pr-8 text-left text-sm text-foreground transition-colors hover:bg-accent\",\n isActive && \"bg-primary/10 font-semibold text-primary ring-1 ring-inset ring-primary/30 hover:bg-primary/15\",\n itemClassName,\n )}\n data-active={isActive ? \"\" : undefined}\n >\n <OrganizationMark id={org.id} name={org.name} abbreviation={org.abbreviation} size={20} />\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"truncate\">{org.name}</span>\n {/* Only where the name does not settle it — see `distinguisher`. */}\n {sharesItsName(org) && org.distinguisher ? (\n <span className=\"truncate text-[10px] font-normal text-muted-foreground\">\n {org.distinguisher}\n </span>\n ) : null}\n </span>\n {org.detail ? (\n <span\n className=\"shrink-0 text-xs font-normal text-muted-foreground\"\n data-slot=\"organization-picker-detail\"\n >\n {org.detail}\n </span>\n ) : null}\n {isActive && (\n <LucideCheckIcon className=\"h-[15px] w-[15px] shrink-0 text-primary\" />\n )}\n </button>\n {/* THE STAR — its own button beside the row, never part of it: a star\n favorites, it never selects. Shown on hover/focus, always shown\n while favorited. Read-only (a mark) when the host has no write. */}\n {onToggleFavorite ? (\n <button\n type=\"button\"\n aria-pressed={favorite}\n aria-label={favorite ? `Remove ${org.name} from favorites` : `Add ${org.name} to favorites`}\n title={favorite ? \"Remove from favorites\" : \"Add to favorites\"}\n onClick={(event) => {\n event.stopPropagation();\n onToggleFavorite(org.id, !favorite);\n }}\n className={cn(\n \"absolute right-1 flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-opacity hover:bg-accent hover:text-foreground focus-visible:opacity-100\",\n favorite ? \"opacity-100\" : \"opacity-0 group-hover/org:opacity-100\",\n )}\n data-slot=\"organization-picker-favorite\"\n >\n <StarIcon\n className={cn(\"h-[14px] w-[14px]\", favorite && \"fill-warning text-warning\")}\n />\n </button>\n ) : favorite ? (\n <StarIcon\n className=\"absolute right-2 h-[13px] w-[13px] fill-warning text-warning\"\n aria-hidden={false}\n aria-label=\"Favorite\"\n role=\"img\"\n />\n ) : null}\n </li>\n );\n };\n\n return (\n <div className={cn(\"flex flex-col\", className)} data-slot=\"organization-picker\">\n {!hideHeading && (\n <p className=\"px-2 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground\">\n Organization\n </p>\n )}\n\n {loading ? (\n <div className=\"space-y-1 px-1 py-1\" aria-busy=\"true\" aria-label=\"Loading organizations\">\n <Skeleton className=\"h-7 rounded-md\" />\n <Skeleton className=\"h-7 rounded-md\" />\n </div>\n ) : loadFailed ? (\n <ErrorBox\n className=\"px-2 py-2 text-xs text-destructive\"\n operation=\"Load your organizations\"\n origin=\"design-system/OrganizationPicker\"\n >\n Could not load organizations.\n </ErrorBox>\n ) : organizations.length === 0 ? (\n <p className=\"px-2 py-2 text-xs text-muted-foreground\">\n Your account is not a member of any organization. Ask an administrator to add you to one.\n </p>\n ) : (\n <>\n {/* SEARCH. A list a person scrolls nine rows at a time is not a\n control, it is a filing cabinet (VERIFIER-8 MEDIUM-3). Name and\n abbreviation, case-insensitive substring; an empty box is exactly\n the list that was there before. */}\n {searchable && (\n <div className=\"px-2 pb-1.5\">\n <Input\n type=\"search\"\n value={query}\n onChange={(event) => setQuery(event.target.value)}\n onClick={(event) => event.stopPropagation()}\n onKeyDown={(event) => event.stopPropagation()}\n placeholder=\"Search organizations\"\n aria-label=\"Search organizations by name or abbreviation\"\n className=\"h-8 text-sm\"\n data-slot=\"organization-picker-search\"\n />\n </div>\n )}\n\n {listed.length === 0 && folded.length === 0 && fixtures.length === 0 ? (\n <p\n className=\"px-2 py-2 text-xs text-muted-foreground\"\n data-slot=\"organization-picker-no-match\"\n >\n No organization matches “{query.trim()}”.\n </p>\n ) : listed.length === 0 && folded.length > 0 ? null : listed.length === 0 ? (\n /* THE ARCHIVED-ITEMS LAW, honesty half: \"nothing\" may only be said\n when both halves are empty. Here the other half is one line down.\n AND IT SAYS WHAT IS TRUE, NOT WHAT IS EMPTY. The earlier sentence\n read \"Nothing matches “X” outside the test organizations below\" —\n which opens by negating the very rows sitting one click away, and\n `fixtures` IS query-filtered, so those rows ARE matches for X. A\n person reading \"nothing matches\" retypes their search instead of\n clicking. So: count the matches, say where they are, and carry\n the click that reveals them — the same shape as the honest\n empty-filter twin one line down. (TAILS-3) */\n <p\n className=\"px-2 py-2 text-xs text-muted-foreground\"\n data-slot=\"organization-picker-only-fixtures\"\n >\n {query.trim() ? (\n <>\n {fixtures.length === 1\n ? `1 match for “${query.trim()}” is in your test organizations`\n : `All ${fixtures.length} matches for “${query.trim()}” are in your test organizations`}\n {showFixtures ? (\n \", listed below.\"\n ) : (\n <>\n {\" — \"}\n <button\n type=\"button\"\n className=\"underline underline-offset-2 hover:text-foreground\"\n data-slot=\"organization-picker-show-fixtures\"\n onClick={(event) => {\n event.stopPropagation();\n setShowFixtures(true);\n }}\n >\n show them\n </button>\n .\n </>\n )}\n </>\n ) : (\n `Every organization you belong to is a test organization — all ${fixtures.length} are below.`\n )}\n </p>\n ) : (\n <ul className=\"max-h-72 overflow-y-auto\" role=\"listbox\" aria-label=\"Organizations\">\n {listed.map(renderRow)}\n </ul>\n )}\n\n {/* THE HOST'S FOLD — rows it marked `folded`, counted, one click away. */}\n <ArchivedDisclosure\n count={folded.length}\n open={foldOpen}\n onOpenChange={setShowFolded}\n label={foldedLabel}\n className=\"mt-0.5\"\n >\n <ul className=\"max-h-72 overflow-y-auto\" role=\"listbox\" aria-label={foldedLabel}>\n {folded.map(renderRow)}\n </ul>\n </ArchivedDisclosure>\n\n {/* THE TEST ORGANIZATIONS, behind the platform's ONE archive-style\n disclosure (`ArchivedDisclosure`, the archived-items law). Hidden\n by default, counted out loud, one click away — never silently\n dropped. */}\n <ArchivedDisclosure\n count={fixtures.length}\n open={showFixtures}\n onOpenChange={setShowFixtures}\n label=\"Test organizations\"\n className=\"mt-0.5\"\n >\n <ul\n className=\"max-h-72 overflow-y-auto\"\n role=\"listbox\"\n aria-label=\"Test organizations\"\n >\n {fixtures.map(renderRow)}\n </ul>\n </ArchivedDisclosure>\n\n </>\n )}\n </div>\n );\n}\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 * Sidebar — ported from shadcn/ui `apps/v4/registry/new-york-v4/ui/sidebar.tsx`\n * (MIT, Copyright (c) 2023 shadcn). Behavior-verbatim; only coupling seams changed:\n *\n * - Imports resolve to this package's own Button, Input, Separator, Sheet, Skeleton,\n * Tooltip and `useIsMobile`; the toggle glyph is the package-inlined `PanelLeftIcon` (C19).\n * - Tokens use the AI Matrx vocabulary (`--sidebar-background`, `--sidebar-foreground`,\n * `--sidebar-accent`, `--sidebar-border`, `--sidebar-ring`, …), defaulted in tokens.css.\n * - No persistence (C10): the original wrote a cookie on every toggle. A host that keeps the\n * state passes `open` / `onOpenChange` and stores it where its own state lives.\n * - The keyboard shortcut is a prop (`keyboardShortcut`, default \"b\"; `null` turns it off for\n * hosts that own their accelerators, such as a desktop app menu).\n * - Collapse timing is a knob: `--sidebar-duration` / `--sidebar-easing` on the provider,\n * defined from THE panel motion (`--matrx-motion-duration-panel` / `--matrx-motion-ease-panel`,\n * 0.56.0 — the motion standard), never shadcn's 200ms linear.\n */\n\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { Button } from \"./button\";\nimport { cn } from \"./cn\";\nimport { PanelLeftIcon } from \"./icons\";\nimport { Input } from \"./input\";\nimport { Separator } from \"./separator\";\nimport { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from \"./sheet\";\nimport { Skeleton } from \"./skeleton\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"./tooltip\";\nimport { useIsMobile } from \"./use-is-mobile\";\n\nconst SIDEBAR_WIDTH = \"16rem\";\nconst SIDEBAR_WIDTH_MOBILE = \"18rem\";\nconst SIDEBAR_WIDTH_ICON = \"3rem\";\nconst SIDEBAR_KEYBOARD_SHORTCUT = \"b\";\n\ntype SidebarContextProps = {\n state: \"expanded\" | \"collapsed\";\n open: boolean;\n setOpen: (open: boolean) => void;\n openMobile: boolean;\n setOpenMobile: (open: boolean) => void;\n isMobile: boolean;\n toggleSidebar: () => void;\n};\n\nconst SidebarContext = React.createContext<SidebarContextProps | null>(null);\n\nfunction useSidebar() {\n const context = React.useContext(SidebarContext);\n if (!context) {\n throw new Error(\"useSidebar must be used within a SidebarProvider.\");\n }\n\n return context;\n}\n\nfunction SidebarProvider({\n defaultOpen = true,\n open: openProp,\n onOpenChange: setOpenProp,\n keyboardShortcut = SIDEBAR_KEYBOARD_SHORTCUT,\n className,\n style,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & {\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** ⌘/Ctrl + this key toggles the sidebar. `null` when the host owns its shortcuts. */\n keyboardShortcut?: string | null;\n}) {\n const isMobile = useIsMobile();\n const [openMobile, setOpenMobile] = React.useState(false);\n\n // This is the internal state of the sidebar.\n // We use openProp and setOpenProp for control from outside the component.\n const [_open, _setOpen] = React.useState(defaultOpen);\n const open = openProp ?? _open;\n const setOpen = React.useCallback(\n (value: boolean | ((value: boolean) => boolean)) => {\n const openState = typeof value === \"function\" ? value(open) : value;\n if (setOpenProp) {\n setOpenProp(openState);\n } else {\n _setOpen(openState);\n }\n },\n [setOpenProp, open],\n );\n\n // Helper to toggle the sidebar.\n const toggleSidebar = React.useCallback(() => {\n return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);\n }, [isMobile, setOpen, setOpenMobile]);\n\n // Adds a keyboard shortcut to toggle the sidebar.\n React.useEffect(() => {\n if (!keyboardShortcut) return;\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === keyboardShortcut && (event.metaKey || event.ctrlKey)) {\n event.preventDefault();\n toggleSidebar();\n }\n };\n\n window.addEventListener(\"keydown\", handleKeyDown);\n return () => window.removeEventListener(\"keydown\", handleKeyDown);\n }, [keyboardShortcut, toggleSidebar]);\n\n // We add a state so that we can do data-state=\"expanded\" or \"collapsed\".\n // This makes it easier to style the sidebar with Tailwind classes.\n const state = open ? \"expanded\" : \"collapsed\";\n\n const contextValue = React.useMemo<SidebarContextProps>(\n () => ({\n state,\n open,\n setOpen,\n isMobile,\n openMobile,\n setOpenMobile,\n toggleSidebar,\n }),\n [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar],\n );\n\n return (\n <SidebarContext.Provider value={contextValue}>\n <TooltipProvider delayDuration={0}>\n <div\n data-slot=\"sidebar-wrapper\"\n style={\n {\n \"--sidebar-width\": SIDEBAR_WIDTH,\n \"--sidebar-width-icon\": SIDEBAR_WIDTH_ICON,\n \"--sidebar-duration\": \"var(--matrx-motion-duration-panel)\",\n \"--sidebar-easing\": \"var(--matrx-motion-ease-panel)\",\n ...style,\n } as React.CSSProperties\n }\n className={cn(\n \"group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar-background\",\n className,\n )}\n {...props}\n >\n {children}\n </div>\n </TooltipProvider>\n </SidebarContext.Provider>\n );\n}\n\nfunction Sidebar({\n side = \"left\",\n variant = \"sidebar\",\n collapsible = \"offcanvas\",\n className,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & {\n side?: \"left\" | \"right\";\n variant?: \"sidebar\" | \"floating\" | \"inset\";\n collapsible?: \"offcanvas\" | \"icon\" | \"none\";\n}) {\n const { isMobile, state, openMobile, setOpenMobile } = useSidebar();\n\n if (collapsible === \"none\") {\n return (\n <div\n data-slot=\"sidebar\"\n className={cn(\n \"flex h-full w-(--sidebar-width) flex-col bg-sidebar-background text-sidebar-foreground\",\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n }\n\n if (isMobile) {\n return (\n // The original spread the desktop container's div props onto the Sheet root, which\n // accepts none of them; the mobile sheet takes only its open state.\n <Sheet open={openMobile} onOpenChange={setOpenMobile}>\n <SheetContent\n data-sidebar=\"sidebar\"\n data-slot=\"sidebar\"\n data-mobile=\"true\"\n className=\"w-(--sidebar-width) bg-sidebar-background p-0 text-sidebar-foreground [&>button]:hidden\"\n style={\n {\n \"--sidebar-width\": SIDEBAR_WIDTH_MOBILE,\n } as React.CSSProperties\n }\n side={side}\n >\n <SheetHeader className=\"sr-only\">\n <SheetTitle>Sidebar</SheetTitle>\n <SheetDescription>Displays the mobile sidebar.</SheetDescription>\n </SheetHeader>\n <div className=\"flex h-full w-full flex-col\">{children}</div>\n </SheetContent>\n </Sheet>\n );\n }\n\n return (\n <div\n className=\"group peer hidden text-sidebar-foreground md:block\"\n data-state={state}\n data-collapsible={state === \"collapsed\" ? collapsible : \"\"}\n data-variant={variant}\n data-side={side}\n data-slot=\"sidebar\"\n >\n {/* This is what handles the sidebar gap on desktop */}\n <div\n data-slot=\"sidebar-gap\"\n className={cn(\n \"relative w-(--sidebar-width) bg-transparent transition-[width] duration-(--sidebar-duration) ease-(--sidebar-easing)\",\n \"group-data-[collapsible=offcanvas]:w-0\",\n \"group-data-[side=right]:rotate-180\",\n variant === \"floating\" || variant === \"inset\"\n ? \"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]\"\n : \"group-data-[collapsible=icon]:w-(--sidebar-width-icon)\",\n )}\n />\n <div\n data-slot=\"sidebar-container\"\n className={cn(\n \"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-(--sidebar-duration) ease-(--sidebar-easing) md:flex\",\n side === \"left\"\n ? \"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]\"\n : \"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]\",\n // Adjust the padding for floating and inset variants.\n variant === \"floating\" || variant === \"inset\"\n ? \"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]\"\n : \"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l\",\n className,\n )}\n {...props}\n >\n <div\n data-sidebar=\"sidebar\"\n data-slot=\"sidebar-inner\"\n className=\"flex h-full w-full flex-col bg-sidebar-background group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm\"\n >\n {children}\n </div>\n </div>\n </div>\n );\n}\n\nfunction SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>) {\n const { toggleSidebar } = useSidebar();\n\n return (\n <Button\n data-sidebar=\"trigger\"\n data-slot=\"sidebar-trigger\"\n variant=\"ghost\"\n size=\"icon\"\n className={cn(\"size-7\", className)}\n onClick={(event) => {\n onClick?.(event);\n toggleSidebar();\n }}\n {...props}\n >\n <PanelLeftIcon />\n <span className=\"sr-only\">Toggle Sidebar</span>\n </Button>\n );\n}\n\nfunction SidebarRail({ className, ...props }: React.ComponentProps<\"button\">) {\n const { toggleSidebar } = useSidebar();\n\n return (\n <button\n data-sidebar=\"rail\"\n data-slot=\"sidebar-rail\"\n aria-label=\"Toggle Sidebar\"\n tabIndex={-1}\n onClick={toggleSidebar}\n title=\"Toggle Sidebar\"\n className={cn(\n \"absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex\",\n \"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize\",\n \"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize\",\n \"group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar-background\",\n \"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2\",\n \"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarInset({ className, ...props }: React.ComponentProps<\"main\">) {\n return (\n <main\n data-slot=\"sidebar-inset\"\n className={cn(\n \"relative flex w-full flex-1 flex-col bg-background\",\n \"md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarInput({ className, ...props }: React.ComponentProps<typeof Input>) {\n return (\n <Input\n data-slot=\"sidebar-input\"\n data-sidebar=\"input\"\n className={cn(\"h-8 w-full bg-background shadow-none\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-header\"\n data-sidebar=\"header\"\n className={cn(\"flex flex-col gap-2 p-2\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-footer\"\n data-sidebar=\"footer\"\n className={cn(\"flex flex-col gap-2 p-2\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarSeparator({ className, ...props }: React.ComponentProps<typeof Separator>) {\n return (\n <Separator\n data-slot=\"sidebar-separator\"\n data-sidebar=\"separator\"\n className={cn(\"mx-2 w-auto bg-sidebar-border\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-content\"\n data-sidebar=\"content\"\n className={cn(\n \"flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-group\"\n data-sidebar=\"group\"\n className={cn(\"relative flex w-full min-w-0 flex-col p-2\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarGroupLabel({\n className,\n asChild = false,\n ...props\n}: React.ComponentProps<\"div\"> & { asChild?: boolean }) {\n const Comp = asChild ? Slot : \"div\";\n\n return (\n <Comp\n data-slot=\"sidebar-group-label\"\n data-sidebar=\"group-label\"\n className={cn(\n \"flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-(--sidebar-duration) ease-(--sidebar-easing) focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n \"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarGroupAction({\n className,\n asChild = false,\n ...props\n}: React.ComponentProps<\"button\"> & { asChild?: boolean }) {\n const Comp = asChild ? Slot : \"button\";\n\n return (\n <Comp\n data-slot=\"sidebar-group-action\"\n data-sidebar=\"group-action\"\n className={cn(\n \"absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n // Increases the hit area of the button on mobile.\n \"after:absolute after:-inset-2 md:after:hidden\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarGroupContent({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-group-content\"\n data-sidebar=\"group-content\"\n className={cn(\"w-full text-sm\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarMenu({ className, ...props }: React.ComponentProps<\"ul\">) {\n return (\n <ul\n data-slot=\"sidebar-menu\"\n data-sidebar=\"menu\"\n className={cn(\"flex w-full min-w-0 flex-col gap-1\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarMenuItem({ className, ...props }: React.ComponentProps<\"li\">) {\n return (\n <li\n data-slot=\"sidebar-menu-item\"\n data-sidebar=\"menu-item\"\n className={cn(\"group/menu-item relative\", className)}\n {...props}\n />\n );\n}\n\nconst sidebarMenuButtonVariants = cva(\n \"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0\",\n {\n variants: {\n variant: {\n default: \"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground\",\n outline:\n \"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]\",\n },\n size: {\n default: \"h-8 text-sm\",\n sm: \"h-7 text-xs\",\n lg: \"h-12 text-sm group-data-[collapsible=icon]:p-0!\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nfunction SidebarMenuButton({\n asChild = false,\n isActive = false,\n variant = \"default\",\n size = \"default\",\n tooltip,\n className,\n ...props\n}: React.ComponentProps<\"button\"> & {\n asChild?: boolean;\n isActive?: boolean;\n tooltip?: string | React.ComponentProps<typeof TooltipContent>;\n} & VariantProps<typeof sidebarMenuButtonVariants>) {\n const Comp = asChild ? Slot : \"button\";\n const { isMobile, state } = useSidebar();\n\n const button = (\n <Comp\n data-slot=\"sidebar-menu-button\"\n data-sidebar=\"menu-button\"\n data-size={size}\n data-active={isActive}\n className={cn(sidebarMenuButtonVariants({ variant, size }), className)}\n {...props}\n />\n );\n\n if (!tooltip) {\n return button;\n }\n\n if (typeof tooltip === \"string\") {\n tooltip = {\n children: tooltip,\n };\n }\n\n return (\n <Tooltip>\n <TooltipTrigger asChild>{button}</TooltipTrigger>\n <TooltipContent\n side=\"right\"\n align=\"center\"\n hidden={state !== \"collapsed\" || isMobile}\n {...tooltip}\n />\n </Tooltip>\n );\n}\n\nfunction SidebarMenuAction({\n className,\n asChild = false,\n showOnHover = false,\n ...props\n}: React.ComponentProps<\"button\"> & {\n asChild?: boolean;\n showOnHover?: boolean;\n}) {\n const Comp = asChild ? Slot : \"button\";\n\n return (\n <Comp\n data-slot=\"sidebar-menu-action\"\n data-sidebar=\"menu-action\"\n className={cn(\n \"absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform peer-hover/menu-button:text-sidebar-accent-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n // Increases the hit area of the button on mobile.\n \"after:absolute after:-inset-2 md:after:hidden\",\n \"peer-data-[size=sm]/menu-button:top-1\",\n \"peer-data-[size=default]/menu-button:top-1.5\",\n \"peer-data-[size=lg]/menu-button:top-2.5\",\n \"group-data-[collapsible=icon]:hidden\",\n showOnHover &&\n \"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground data-[state=open]:opacity-100 md:opacity-0\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarMenuBadge({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-menu-badge\"\n data-sidebar=\"menu-badge\"\n className={cn(\n \"pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none\",\n \"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground\",\n \"peer-data-[size=sm]/menu-button:top-1\",\n \"peer-data-[size=default]/menu-button:top-1.5\",\n \"peer-data-[size=lg]/menu-button:top-2.5\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarMenuSkeleton({\n className,\n showIcon = false,\n ...props\n}: React.ComponentProps<\"div\"> & {\n showIcon?: boolean;\n}) {\n // Random width between 50 to 90%.\n const width = React.useMemo(() => {\n return `${Math.floor(Math.random() * 40) + 50}%`;\n }, []);\n\n return (\n <div\n data-slot=\"sidebar-menu-skeleton\"\n data-sidebar=\"menu-skeleton\"\n className={cn(\"flex h-8 items-center gap-2 rounded-md px-2\", className)}\n {...props}\n >\n {showIcon && <Skeleton className=\"size-4 rounded-md\" data-sidebar=\"menu-skeleton-icon\" />}\n <Skeleton\n className=\"h-4 max-w-(--skeleton-width) flex-1\"\n data-sidebar=\"menu-skeleton-text\"\n style={\n {\n \"--skeleton-width\": width,\n } as React.CSSProperties\n }\n />\n </div>\n );\n}\n\nfunction SidebarMenuSub({ className, ...props }: React.ComponentProps<\"ul\">) {\n return (\n <ul\n data-slot=\"sidebar-menu-sub\"\n data-sidebar=\"menu-sub\"\n className={cn(\n \"mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SidebarMenuSubItem({ className, ...props }: React.ComponentProps<\"li\">) {\n return (\n <li\n data-slot=\"sidebar-menu-sub-item\"\n data-sidebar=\"menu-sub-item\"\n className={cn(\"group/menu-sub-item relative\", className)}\n {...props}\n />\n );\n}\n\nfunction SidebarMenuSubButton({\n asChild = false,\n size = \"md\",\n isActive = false,\n className,\n ...props\n}: React.ComponentProps<\"a\"> & {\n asChild?: boolean;\n size?: \"sm\" | \"md\";\n isActive?: boolean;\n}) {\n const Comp = asChild ? Slot : \"a\";\n\n return (\n <Comp\n data-slot=\"sidebar-menu-sub-button\"\n data-sidebar=\"menu-sub-button\"\n data-size={size}\n data-active={isActive}\n className={cn(\n \"flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground\",\n \"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground\",\n size === \"sm\" && \"text-xs\",\n size === \"md\" && \"text-sm\",\n \"group-data-[collapsible=icon]:hidden\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport {\n Sidebar,\n SidebarContent,\n SidebarFooter,\n SidebarGroup,\n SidebarGroupAction,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarHeader,\n SidebarInput,\n SidebarInset,\n SidebarMenu,\n SidebarMenuAction,\n SidebarMenuBadge,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSkeleton,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n SidebarProvider,\n SidebarRail,\n SidebarSeparator,\n SidebarTrigger,\n sidebarMenuButtonVariants,\n useSidebar,\n};\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 TOKEN-DRIVEN, NOT BRANDED. Popover tokens, not\n * `bg-primary`: rich tooltip content using `text-muted-foreground` was\n * illegible on a brand-coloured background in one theme or the other.\n * Since 2026-09-28 the `.matrx-tooltip` class re-scopes those tokens to a dark,\n * high-contrast chip in both themes (styles.css, THE TOOLTIP SURFACE): the\n * neutral white surface it wore before was indistinguishable from the\n * browser's own `title` box.\n *\n * 3. EVERY `title` IS THIS TOOLTIP. The provider installs the title takeover\n * (`title-tooltips.ts`), so a hand-written `title=` anywhere in the\n * document shows this surface, never the browser's.\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\";\nimport { acquireTitleTooltips, TOOLTIP_TRIGGER_ATTR } from \"./title-tooltips\";\n\nexport interface TooltipProviderProps\n extends React.ComponentProps<typeof TooltipPrimitive.Provider> {\n /**\n * THE TITLE TAKEOVER (2026-09-28) — while any provider is mounted, every native\n * `title` attribute in the document shows as this tooltip instead of the\n * browser's (see `title-tooltips.ts`). On by default, because a rule every\n * author must remember is a rule that is broken; pass `false` only for a\n * surface that must keep the browser's own box. One provider opting out does\n * not turn it off while another one is mounted.\n */\n titleTooltips?: boolean;\n}\n\n/**\n * Mount once near the app root. Every tooltip in the tree shares its\n * `delayDuration` / `skipDelayDuration` timing, and the root provider takes\n * over native `title` attributes (see `titleTooltips`).\n */\nfunction TooltipProvider({ titleTooltips = true, ...props }: TooltipProviderProps) {\n React.useEffect(() => {\n if (!titleTooltips) return;\n return acquireTitleTooltips();\n }, [titleTooltips]);\n return <TooltipPrimitive.Provider {...props} />;\n}\n\nconst Tooltip = TooltipPrimitive.Root;\n\n/**\n * Stamps `data-matrx-tooltip-trigger` so the title takeover never draws a\n * second tooltip over a control that already has this one — it still lifts a\n * `title` on the same control, so the browser's box never doubles it either.\n */\nconst TooltipTrigger = React.forwardRef<\n React.ComponentRef<typeof TooltipPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Trigger>\n>((props, ref) => (\n <TooltipPrimitive.Trigger ref={ref} {...{ [TOOLTIP_TRIGGER_ATTR]: \"\" }} {...props} />\n));\nTooltipTrigger.displayName = TooltipPrimitive.Trigger.displayName;\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 \"matrx-tooltip z-[10001] overflow-hidden rounded-md border border-border bg-popover px-2.5 py-1 text-xs font-medium text-popover-foreground\",\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 };\nexport { acquireTitleTooltips, NATIVE_TITLE_OPT_OUT_ATTR } from \"./title-tooltips\";\n","/**\n * THE TITLE TAKEOVER — every native `title` attribute in the document shows\n * as THE fleet tooltip instead of the browser's.\n *\n * Why this exists. A `title=` is the one tooltip nobody has to import, so it\n * is what every hand-written control reaches for: ~50 of them on an ordinary\n * matrx-frontend page (2026-09-28), next to the Radix tooltips on the tap\n * buttons. The browser draws those as a slow, unstyled system box, and a page\n * that mixes the two reads as having \"lost all of its tooltips\" (Arman,\n * 2026-09-28). Asking every author — human or agent — to wrap every control in\n * `<Tooltip>` is a rule that is broken the day it is written. So the\n * `TooltipProvider` every host already mounts at its root installs this layer,\n * and a `title` is simply a tooltip from then on. Nothing to remember.\n *\n * How it works. On hover (mouse or pen) or keyboard focus (`:focus-visible`)\n * of an element that carries a `title`, the attribute is lifted onto\n * `data-matrx-title` for exactly as long as the pointer or focus stays — so\n * the browser has nothing to show — and one shared, script-placed element\n * wearing `.matrx-tooltip` shows the text instead. When the pointer or focus\n * leaves, the `title` is put back, so assistive technology and every\n * `[title]` selector read the element exactly as authored the rest of the\n * time. Touch never shows it (a `title` has no touch affordance either).\n *\n * What it does not draw: a tooltip that only repeats text already readable in\n * full inside the element (it still draws when that text is hidden or\n * truncated).\n *\n * What it leaves alone:\n * - an element that is already a Radix tooltip trigger\n * (`[data-matrx-tooltip-trigger]`, stamped by `TooltipTrigger`): its\n * `title` is still lifted — two tooltips on one control was the other\n * half of the mess — but only the Radix one shows;\n * - anything inside `[data-native-title]` (the explicit opt-out);\n * - SVG `<title>` children, which are elements, not attributes.\n *\n * Placement. Above the element, centred, flipped below when there is no room,\n * clamped into the viewport. `data-title-side=\"right\" | \"left\" | \"bottom\" |\n * \"top\"` on the element or any ancestor states a preferred side — a vertical\n * rail sets `right` once on its container.\n *\n * Installed at most once per document, reference-counted across every\n * mounted provider, and removed when the last one unmounts.\n */\n\nexport const TITLE_TOOLTIP_ATTR = \"data-matrx-title\";\nexport const TOOLTIP_TRIGGER_ATTR = \"data-matrx-tooltip-trigger\";\nexport const NATIVE_TITLE_OPT_OUT_ATTR = \"data-native-title\";\n\ntype Side = \"top\" | \"bottom\" | \"left\" | \"right\";\n\nconst OPEN_DELAY_MS = 350;\n/** Moving from one titled control to the next inside this window is instant. */\nconst SKIP_DELAY_MS = 500;\nconst GAP_PX = 6;\nconst EDGE_PX = 8;\n\nconst SURFACE_CLASS =\n \"matrx-tooltip matrx-title-tooltip matrx-motion-popper z-[10001] rounded-md border border-border bg-popover px-2.5 py-1 text-xs font-medium text-popover-foreground\";\n\ninterface Installation {\n count: number;\n uninstall: () => void;\n}\n\n/**\n * Keyed on the document itself through a registered symbol, never a module\n * WeakMap: tsup bundles this module into more than one entry (`index`,\n * `tap-target`), and two module copies each holding their own map would\n * install twice — two listeners, two surfaces.\n */\nconst INSTALLATION_KEY = Symbol.for(\"@ai-matrx/design-system/title-tooltips\");\ntype DocumentWithInstallation = Document & { [INSTALLATION_KEY]?: Installation };\nconst installations = {\n get: (doc: Document) => (doc as DocumentWithInstallation)[INSTALLATION_KEY],\n set: (doc: Document, value: Installation) => {\n (doc as DocumentWithInstallation)[INSTALLATION_KEY] = value;\n },\n delete: (doc: Document) => {\n delete (doc as DocumentWithInstallation)[INSTALLATION_KEY];\n },\n};\n\n/** Install the takeover on `doc`. Returns the release function. */\nexport function acquireTitleTooltips(doc: Document | undefined = typeof document === \"undefined\" ? undefined : document): () => void {\n if (!doc) return () => {};\n const existing = installations.get(doc);\n if (existing) {\n existing.count += 1;\n } else {\n installations.set(doc, { count: 1, uninstall: install(doc) });\n }\n let released = false;\n return () => {\n if (released) return;\n released = true;\n const current = installations.get(doc);\n if (!current) return;\n current.count -= 1;\n if (current.count <= 0) {\n current.uninstall();\n installations.delete(doc);\n }\n };\n}\n\nfunction install(doc: Document): () => void {\n const win = doc.defaultView;\n let active: HTMLElement | null = null;\n let surface: HTMLDivElement | null = null;\n let openTimer: ReturnType<typeof setTimeout> | undefined;\n let lastClosedAt = 0;\n\n const HTMLElementCtor = win?.HTMLElement;\n\n const titledAncestor = (node: EventTarget | null): HTMLElement | null => {\n if (!HTMLElementCtor || !(node instanceof win!.Node)) return null;\n const start = node instanceof HTMLElementCtor ? node : (node as Node).parentElement;\n if (!start) return null;\n const el = start.closest<HTMLElement>(`[title], [${TITLE_TOOLTIP_ATTR}]`);\n if (!el || !(el instanceof HTMLElementCtor)) return null;\n if (el.closest(`[${NATIVE_TITLE_OPT_OUT_ATTR}]`)) return null;\n return el;\n };\n\n const textOf = (el: HTMLElement) => (el.getAttribute(TITLE_TOOLTIP_ATTR) ?? el.getAttribute(\"title\") ?? \"\").trim();\n\n const lift = (el: HTMLElement) => {\n const title = el.getAttribute(\"title\");\n if (title === null) return;\n el.setAttribute(TITLE_TOOLTIP_ATTR, title);\n el.removeAttribute(\"title\");\n };\n\n const restore = (el: HTMLElement) => {\n const held = el.getAttribute(TITLE_TOOLTIP_ATTR);\n if (held === null) return;\n // An author who changed or removed the title while it was lifted wins:\n // only put ours back when nothing re-set it in the meantime.\n if (!el.hasAttribute(\"title\")) el.setAttribute(\"title\", held);\n el.removeAttribute(TITLE_TOOLTIP_ATTR);\n };\n\n const ensureSurface = () => {\n if (surface && surface.isConnected) return surface;\n surface = doc.createElement(\"div\");\n surface.setAttribute(\"role\", \"tooltip\");\n surface.setAttribute(\"data-slot\", \"title-tooltip\");\n surface.className = SURFACE_CLASS;\n surface.style.visibility = \"hidden\";\n doc.body.appendChild(surface);\n return surface;\n };\n\n const preferredSide = (el: HTMLElement): Side => {\n const hint = el.closest(\"[data-title-side]\")?.getAttribute(\"data-title-side\");\n return hint === \"bottom\" || hint === \"left\" || hint === \"right\" ? hint : \"top\";\n };\n\n const place = (el: HTMLElement, node: HTMLDivElement) => {\n const vw = win?.innerWidth ?? 0;\n const vh = win?.innerHeight ?? 0;\n const anchor = el.getBoundingClientRect();\n const box = node.getBoundingClientRect();\n const fits: Record<Side, boolean> = {\n top: anchor.top - GAP_PX - box.height >= EDGE_PX,\n bottom: anchor.bottom + GAP_PX + box.height <= vh - EDGE_PX,\n left: anchor.left - GAP_PX - box.width >= EDGE_PX,\n right: anchor.right + GAP_PX + box.width <= vw - EDGE_PX,\n };\n const opposite: Record<Side, Side> = { top: \"bottom\", bottom: \"top\", left: \"right\", right: \"left\" };\n const wanted = preferredSide(el);\n const side: Side = fits[wanted] ? wanted : fits[opposite[wanted]] ? opposite[wanted] : wanted;\n\n let x: number;\n let y: number;\n if (side === \"top\" || side === \"bottom\") {\n x = anchor.left + anchor.width / 2 - box.width / 2;\n y = side === \"top\" ? anchor.top - GAP_PX - box.height : anchor.bottom + GAP_PX;\n } else {\n y = anchor.top + anchor.height / 2 - box.height / 2;\n x = side === \"left\" ? anchor.left - GAP_PX - box.width : anchor.right + GAP_PX;\n }\n x = Math.min(Math.max(x, EDGE_PX), Math.max(EDGE_PX, vw - EDGE_PX - box.width));\n y = Math.min(Math.max(y, EDGE_PX), Math.max(EDGE_PX, vh - EDGE_PX - box.height));\n node.style.transform = `translate(${Math.round(x)}px, ${Math.round(y)}px)`;\n node.setAttribute(\"data-side\", side);\n };\n\n const isShown = (node: HTMLElement, root: HTMLElement) => {\n const rect = node.getBoundingClientRect();\n if (rect.width <= 0 || rect.height <= 0) return false;\n for (let cur: HTMLElement | null = node; cur; cur = cur === root ? null : cur.parentElement) {\n const cs = win?.getComputedStyle(cur);\n if (!cs) return false;\n if (cs.display === \"none\" || cs.visibility === \"hidden\" || Number(cs.opacity) === 0) return false;\n }\n return true;\n };\n\n /**\n * A tooltip that repeats text the person can already read in full is noise\n * (an expanded sidebar row, a \"Save\" button titled \"Save\"). It still shows\n * when that text is hidden (a collapsed rail's label) or cut off\n * (truncated) — the two cases a title exists for.\n */\n const repeatsVisibleText = (el: HTMLElement, text: string) => {\n const norm = (t: string) => t.replace(/\\s+/g, \" \").trim().toLowerCase();\n const want = norm(text);\n if (!want || !win) return false;\n const walker = doc.createTreeWalker(el, win.NodeFilter.SHOW_TEXT);\n for (let node = walker.nextNode(); node; node = walker.nextNode()) {\n if (norm(node.textContent ?? \"\") !== want) continue;\n const host = node.parentElement;\n if (!host || !isShown(host, el)) continue;\n if (host.scrollWidth > host.clientWidth + 1) continue;\n return true;\n }\n return false;\n };\n\n const show = (el: HTMLElement, instant: boolean) => {\n if (active !== el) return;\n // A Radix tooltip trigger shows its own tooltip — never a second one.\n if (el.closest(`[${TOOLTIP_TRIGGER_ATTR}]`)) return;\n const text = textOf(el);\n if (!text || !el.isConnected) return;\n if (repeatsVisibleText(el, text)) return;\n const node = ensureSurface();\n node.textContent = text;\n node.style.visibility = \"hidden\";\n node.setAttribute(\"data-state\", instant ? \"instant-open\" : \"delayed-open\");\n place(el, node);\n node.style.visibility = \"visible\";\n if (el.id) node.id = `${el.id}-title-tooltip`;\n };\n\n const hide = () => {\n if (openTimer !== undefined) clearTimeout(openTimer);\n openTimer = undefined;\n if (surface && surface.style.visibility === \"visible\") lastClosedAt = Date.now();\n if (surface) {\n surface.style.visibility = \"hidden\";\n surface.removeAttribute(\"data-state\");\n }\n };\n\n const activate = (el: HTMLElement) => {\n if (active === el) return;\n deactivate();\n active = el;\n lift(el);\n const instant = Date.now() - lastClosedAt < SKIP_DELAY_MS;\n if (instant) show(el, true);\n else openTimer = setTimeout(() => show(el, false), OPEN_DELAY_MS);\n };\n\n const deactivate = () => {\n hide();\n if (active) restore(active);\n active = null;\n };\n\n const onPointerOver = (e: PointerEvent) => {\n if (e.pointerType === \"touch\") return;\n const el = titledAncestor(e.target);\n if (el) activate(el);\n else if (active) deactivate();\n };\n\n const onPointerOut = (e: PointerEvent) => {\n if (!active) return;\n const next = e.relatedTarget;\n if (next instanceof win!.Node && active.contains(next)) return;\n deactivate();\n };\n\n const onFocusIn = (e: FocusEvent) => {\n const el = titledAncestor(e.target);\n if (!el) return;\n let visible = true;\n try {\n visible = (e.target as Element).matches(\":focus-visible\");\n } catch {\n visible = true;\n }\n if (visible) activate(el);\n };\n\n const onFocusOut = (e: FocusEvent) => {\n if (!active) return;\n const next = e.relatedTarget;\n if (next instanceof win!.Node && active.contains(next)) return;\n deactivate();\n };\n\n const onDismiss = () => deactivate();\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") deactivate();\n };\n\n doc.addEventListener(\"pointerover\", onPointerOver, true);\n doc.addEventListener(\"pointerout\", onPointerOut, true);\n doc.addEventListener(\"focusin\", onFocusIn, true);\n doc.addEventListener(\"focusout\", onFocusOut, true);\n doc.addEventListener(\"pointerdown\", onDismiss, true);\n doc.addEventListener(\"keydown\", onKeyDown, true);\n doc.addEventListener(\"scroll\", onDismiss, true);\n win?.addEventListener(\"blur\", onDismiss);\n\n return () => {\n deactivate();\n doc.removeEventListener(\"pointerover\", onPointerOver, true);\n doc.removeEventListener(\"pointerout\", onPointerOut, true);\n doc.removeEventListener(\"focusin\", onFocusIn, true);\n doc.removeEventListener(\"focusout\", onFocusOut, true);\n doc.removeEventListener(\"pointerdown\", onDismiss, true);\n doc.removeEventListener(\"keydown\", onKeyDown, true);\n doc.removeEventListener(\"scroll\", onDismiss, true);\n win?.removeEventListener(\"blur\", onDismiss);\n surface?.remove();\n surface = null;\n };\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../tooltip\";\nimport { StatusDot, type StatusTone } from \"./status-dot\";\n\n/**\n * The app rail: a narrow, never-changing strip of area icons on the far left, with the\n * person at the bottom (Codex, VS Code, Slack, Teams). It answers \"where am I\"; the panel\n * beside it answers \"what can I do here\". Width is the `--app-rail-width` knob (48 px).\n */\n\nexport function AppRail({ className, style, ...props }: React.HTMLAttributes<HTMLElement>) {\n return (\n <nav\n data-slot=\"app-rail\"\n aria-label=\"Areas\"\n className={cn(\"flex h-full w-(--app-rail-width) shrink-0 flex-col items-center gap-1 py-2\", className)}\n style={{ \"--app-rail-width\": \"48px\", ...style } as React.CSSProperties}\n {...props}\n />\n );\n}\n\nexport function AppRailGroup({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return <div data-slot=\"app-rail-group\" className={cn(\"flex flex-col items-center gap-1\", className)} {...props} />;\n}\n\n/** Pushes everything after it to the bottom of the rail. */\nexport function AppRailSpacer() {\n return <div data-slot=\"app-rail-spacer\" className=\"flex-1\" />;\n}\n\nexport interface AppRailItemProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\"> {\n icon: React.ReactNode;\n label: string;\n /** Shown in the tooltip after the label, e.g. \"⌘1\". */\n shortcut?: string;\n active?: boolean;\n /** A hollow corner mark when the area needs attention; healthy areas carry none. */\n attention?: StatusTone;\n attentionLabel?: string;\n}\n\nexport const AppRailItem = React.forwardRef<HTMLButtonElement, AppRailItemProps>(function AppRailItem(\n { icon, label, shortcut, active = false, attention, attentionLabel, className, ...props },\n ref,\n) {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n ref={ref}\n type=\"button\"\n data-slot=\"app-rail-item\"\n data-active={active}\n aria-label={label}\n aria-current={active ? \"page\" : undefined}\n className={cn(\n \"relative flex size-8 items-center justify-center rounded-lg text-foreground/55 outline-none transition-colors\",\n \"hover:bg-foreground/[0.06] hover:text-foreground\",\n \"data-[active=true]:bg-foreground/[0.08] data-[active=true]:text-foreground\",\n \"focus-visible:ring-2 focus-visible:ring-ring\",\n \"[&_svg]:size-[18px] [&_svg]:shrink-0\",\n className,\n )}\n {...props}\n >\n {icon}\n {attention ? (\n <StatusDot\n tone={attention}\n variant=\"ring\"\n {...(attentionLabel ? { label: attentionLabel } : {})}\n className=\"absolute right-0.5 bottom-0.5\"\n />\n ) : null}\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"right\" align=\"center\">\n <span className=\"flex items-center gap-2\">\n {label}\n {shortcut ? <span className=\"opacity-60\">{shortcut}</span> : null}\n </span>\n </TooltipContent>\n </Tooltip>\n );\n});\n\nexport interface AppRailAvatarProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\"> {\n /** Up to two letters. Ignored when `children` is given. */\n initials?: string;\n label: string;\n /** A glyph instead of initials (e.g. a neutral person while signed out). */\n children?: React.ReactNode;\n}\n\n/** The person, at the bottom of the rail (Codex's initials circle). */\nexport const AppRailAvatar = React.forwardRef<HTMLButtonElement, AppRailAvatarProps>(function AppRailAvatar(\n { initials = \"\", label, className, children, ...props },\n ref,\n) {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n ref={ref}\n type=\"button\"\n data-slot=\"app-rail-avatar\"\n aria-label={label}\n className={cn(\n \"flex size-6 items-center justify-center rounded-full bg-foreground/[0.12] text-[10px] font-semibold leading-none text-foreground/80 outline-none [&_svg]:size-3.5\",\n \"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n className,\n )}\n {...props}\n >\n {children ?? initials.slice(0, 2).toUpperCase()}\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"right\" align=\"center\">\n {label}\n </TooltipContent>\n </Tooltip>\n );\n});\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\n\n/**\n * A 6 px status mark. Tones read semantic tokens (`--info` blue, `--warning` orange,\n * `--destructive` red, `--success` green), so a host re-tints them with its own values.\n * `ring` is the hollow variant for icon corners, where a filled dot reads as \"unread\".\n */\nexport type StatusTone = \"info\" | \"warning\" | \"danger\" | \"success\" | \"neutral\";\n\nconst FILL: Record<StatusTone, string> = {\n info: \"bg-info\",\n warning: \"bg-warning\",\n danger: \"bg-destructive\",\n success: \"bg-success\",\n neutral: \"bg-muted-foreground/60\",\n};\n\nconst RING: Record<StatusTone, string> = {\n info: \"border-info\",\n warning: \"border-warning\",\n danger: \"border-destructive\",\n success: \"border-success\",\n neutral: \"border-muted-foreground/60\",\n};\n\nexport interface StatusDotProps extends React.HTMLAttributes<HTMLSpanElement> {\n tone: StatusTone;\n variant?: \"solid\" | \"ring\";\n /** Accessible name; without it the dot is decorative. */\n label?: string;\n}\n\nexport function StatusDot({ tone, variant = \"solid\", label, className, ...props }: StatusDotProps) {\n return (\n <span\n data-slot=\"status-dot\"\n data-tone={tone}\n data-variant={variant}\n {...(label ? { role: \"img\", \"aria-label\": label } : { \"aria-hidden\": true })}\n className={cn(\n \"inline-block shrink-0 rounded-full\",\n variant === \"solid\" ? cn(\"size-1.5\", FILL[tone]) : cn(\"size-2 border-[1.5px] bg-transparent\", RING[tone]),\n className,\n )}\n {...props}\n />\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { ResizableHandle, ResizablePanel, ResizablePanelGroup } from \"../resizable\";\n\n/**\n * The canvas: a right-hand workspace of panels (terminal, files, browser, info) beside the\n * main content, as in Claude desktop and Codex. Panels stack in columns, resize by dragging\n * the gaps between them, and any one can expand to fill the whole canvas region.\n *\n * The layout is presentational: the host owns which panels are open, which is expanded and\n * what each renders. The panel CHROME (CanvasPanel, CanvasPanelEmpty, BrowserTabs, BrowserBar)\n * lives in @ai-matrx/canvas/react — the one canvas chrome; this package cannot depend on it\n * (canvas → tap-target → design-system would be a cycle).\n */\n\nexport interface CanvasPanelDef {\n id: string;\n node: React.ReactNode;\n /** Pixels (number) or percent of the column (string). */\n minSize?: number | string;\n defaultSize?: number | string;\n}\n\nexport interface CanvasColumnDef {\n id: string;\n panels: CanvasPanelDef[];\n minSize?: number | string;\n defaultSize?: number | string;\n}\n\nexport interface CanvasLayoutProps {\n columns: CanvasColumnDef[];\n /** When set, only this panel renders, filling the layout. */\n expandedId?: string | null;\n className?: string;\n}\n\nconst GAP = \"bg-transparent data-[separator=hover]:bg-foreground/15 data-[separator=active]:bg-foreground/25\";\n\nexport function CanvasLayout({ columns, expandedId = null, className }: CanvasLayoutProps) {\n const visible = columns.filter((c) => c.panels.length > 0);\n const expanded = expandedId ? visible.flatMap((c) => c.panels).find((p) => p.id === expandedId) : undefined;\n\n if (expanded) {\n return (\n <div data-slot=\"canvas-layout\" data-expanded={expanded.id} className={cn(\"flex h-full w-full\", className)}>\n {expanded.node}\n </div>\n );\n }\n\n return (\n <ResizablePanelGroup data-slot=\"canvas-layout\" orientation=\"horizontal\" className={cn(\"gap-0\", className)}>\n {visible.map((column, ci) => (\n <React.Fragment key={column.id}>\n {ci > 0 ? <ResizableHandle data-canvas-gap=\"column\" size=\"md\" className={GAP} /> : null}\n <ResizablePanel\n id={column.id}\n minSize={column.minSize ?? 220}\n {...(column.defaultSize !== undefined ? { defaultSize: column.defaultSize } : {})}\n >\n <ResizablePanelGroup data-canvas-column={column.id} orientation=\"vertical\">\n {column.panels.map((panel, pi) => (\n <React.Fragment key={panel.id}>\n {pi > 0 ? <ResizableHandle data-canvas-gap=\"row\" size=\"md\" className={GAP} /> : null}\n <ResizablePanel\n id={panel.id}\n minSize={panel.minSize ?? 120}\n {...(panel.defaultSize !== undefined ? { defaultSize: panel.defaultSize } : {})}\n >\n {panel.node}\n </ResizablePanel>\n </React.Fragment>\n ))}\n </ResizablePanelGroup>\n </ResizablePanel>\n </React.Fragment>\n ))}\n </ResizablePanelGroup>\n );\n}\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\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../tooltip\";\n\n/**\n * A small segmented group of icon buttons for switching the app's mode (Claude desktop's\n * chat | code pair in the title bar). A radio group: arrow keys move, one is always checked.\n */\n\nexport interface ModeSwitchOption<T extends string> {\n value: T;\n label: string;\n icon: React.ReactNode;\n shortcut?: string;\n}\n\nexport interface ModeSwitchProps<T extends string> {\n value: T;\n onValueChange: (value: T) => void;\n options: ReadonlyArray<ModeSwitchOption<T>>;\n label?: string;\n className?: string;\n}\n\nexport function ModeSwitch<T extends string>({ value, onValueChange, options, label = \"Mode\", className }: ModeSwitchProps<T>) {\n const refs = React.useRef<Array<HTMLButtonElement | null>>([]);\n\n const move = (from: number, delta: number) => {\n const next = (from + delta + options.length) % options.length;\n const option = options[next];\n if (!option) return;\n onValueChange(option.value);\n refs.current[next]?.focus();\n };\n\n return (\n <div\n role=\"radiogroup\"\n aria-label={label}\n data-slot=\"mode-switch\"\n className={cn(\"inline-flex items-center gap-0.5 rounded-lg bg-foreground/[0.06] p-0.5\", className)}\n >\n {options.map((option, index) => {\n const checked = option.value === value;\n return (\n <Tooltip key={option.value}>\n <TooltipTrigger asChild>\n <button\n ref={(el) => {\n refs.current[index] = el;\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={checked}\n aria-label={option.label}\n data-slot=\"mode-switch-item\"\n data-value={option.value}\n tabIndex={checked ? 0 : -1}\n onClick={() => onValueChange(option.value)}\n onKeyDown={(event) => {\n if (event.key === \"ArrowRight\" || event.key === \"ArrowDown\") {\n event.preventDefault();\n move(index, 1);\n } else if (event.key === \"ArrowLeft\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n move(index, -1);\n }\n }}\n className={cn(\n \"flex h-6 w-7 items-center justify-center rounded-md text-foreground/55 outline-none transition-colors\",\n \"hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\",\n \"aria-checked:bg-background aria-checked:text-foreground aria-checked:shadow-[0_0_0_0.5px_hsl(var(--foreground)/0.12),0_1px_2px_hsl(var(--foreground)/0.08)]\",\n \"dark:aria-checked:bg-foreground/[0.14] dark:aria-checked:shadow-none\",\n \"[&_svg]:size-[15px] [&_svg]:shrink-0\",\n )}\n >\n {option.icon}\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"bottom\" align=\"center\">\n <span className=\"flex items-center gap-2\">\n {option.label}\n {option.shortcut ? <span className=\"opacity-60\">{option.shortcut}</span> : null}\n </span>\n </TooltipContent>\n </Tooltip>\n );\n })}\n </div>\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\n/** What a tab body can do to the sheet that hosts it. */\nexport interface TabbedBottomSheetTabNav {\n /**\n * Leave this tab for the index, keeping the sheet open. A finished pick\n * inside a tab (attach a note) calls this instead of closing the sheet, so\n * the person lands where they can continue (PB-08, 2026-10-01: attaching a\n * note closed the whole sheet with no way back to its other tabs).\n */\n showIndex: () => void;\n}\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 /** The tab body, or a render function given the sheet's navigation. */\n content: ReactNode | ((nav: TabbedBottomSheetTabNav) => ReactNode);\n}\n\nexport interface TabbedBottomSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n title: string;\n tabs: TabbedBottomSheetTab[];\n /** Start each open inside this tab when it exists; otherwise show the index. */\n initialTabId?: string | null;\n}\n\nexport function TabbedBottomSheet({\n open,\n onOpenChange,\n title,\n tabs,\n initialTabId = null,\n}: TabbedBottomSheetProps) {\n const [selectedTabId, setSelectedTabId] = useState<string | null>(initialTabId);\n\n // Every open starts on its requested tab, or 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(initialTabId);\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 {typeof selectedTab.content === \"function\"\n ? selectedTab.content({ showIndex: () => setSelectedTabId(null) })\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-safe 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\";\nimport { FIELD_SURFACE_CLASS } from \"./field-surface\";\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 ${FIELD_SURFACE_CLASS} 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 ${FIELD_SURFACE_CLASS} 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/**\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 * 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\nimport {\n cloneElement,\n forwardRef,\n isValidElement,\n useCallback,\n useRef,\n type ButtonHTMLAttributes,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from \"react\";\n\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../tooltip\";\nimport { cn } from \"./cn\";\nimport { classNameMisuse, useTapGuardRef } from \"./tap-target-guard\";\nimport {\n TAP_SOLID_TONE,\n TAP_TONE_CLASS,\n TapBadge,\n TapChevron,\n TapSpinner,\n formatShortcut,\n tooltipBody,\n useTapShortcut,\n type TapFeatureProps,\n type TapShortcut,\n type TapSolidTone,\n} from \"./tap-features\";\nimport {\n getTapTargetLinkComponent,\n type TapTargetLinkComponent,\n} from \"./link\";\n\nexport interface TapTargetButtonProps extends TapFeatureProps {\n icon?: React.ReactNode;\n children?: React.ReactNode;\n strokeWidth?: number | undefined;\n onClick?: (() => void) | undefined;\n className?: string | undefined;\n as?: \"button\" | \"label\" | undefined;\n htmlFor?: string | undefined;\n ariaLabel?: string | undefined;\n disabled?: boolean | undefined;\n /**\n * When set, the tap button renders as a link instead of a button.\n * - Internal hrefs (e.g. \"/tasks\") render via the injected link component\n * (`setTapTargetLinkComponent` / the `linkComponent` prop), falling back\n * to a plain `<a>` when none is registered.\n * - External hrefs (http://, https://, mailto:, tel:) render as `<a>`\n * with `target=\"_blank\"` and `rel=\"noopener noreferrer\"` by default.\n * - When combined with `disabled`, the trigger renders as a non-navigable\n * `<span aria-disabled=\"true\">` with the same visual styling.\n */\n href?: string | undefined;\n /** Override target. Works on both internal links and external anchors. */\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\" | undefined;\n /** Override rel. Works on both internal links and external anchors. */\n rel?: string | undefined;\n /** Forwarded to the injected link component. Pass `false` to disable prefetching. */\n prefetch?: boolean | null | undefined;\n /**\n * Per-instance link component for internal hrefs — overrides the\n * module-level `setTapTargetLinkComponent` registration.\n */\n linkComponent?: TapTargetLinkComponent | undefined;\n /**\n * Tooltip text. Defaults to `ariaLabel` when omitted.\n * EVERY tap button shows a tooltip (owner ruling 2026-10-01). `false` no\n * longer hides it: it renders the tooltip through `title` (the provider's\n * title takeover draws the same surface) — for a button nested inside\n * another `asChild` trigger, where the Tooltip wrapper cannot sit.\n */\n tooltip?: string | false | undefined;\n /** Tooltip placement. Defaults to \"top\". */\n tooltipSide?: \"top\" | \"right\" | \"bottom\" | \"left\" | undefined;\n /** Tooltip alignment along its side. Defaults to \"center\". */\n tooltipAlign?: \"start\" | \"center\" | \"end\" | undefined;\n /**\n * Visible caption rendered inline after the icon (`[icon Label]`).\n * Widens the pill automatically. Tooltip defaults to off when set — the\n * label is self-describing. Visible text becomes the accessible name.\n */\n label?: string | undefined;\n /**\n * Collapse an icon + caption pill to its icon-only 44px tap target below\n * the `sm` breakpoint. The caption and inline geometry return at `sm+`;\n * `ariaLabel` (falling back to `label`) remains the accessible name.\n */\n mobileIconOnly?: boolean | undefined;\n}\n\nexport interface TapTargetButtonSolidProps extends Omit<TapTargetButtonProps, \"tone\"> {\n /** The fill, from the system's list. Replaces bgColor / iconColor / hover / active. */\n tone?: TapSolidTone | undefined;\n bgColor?: string | undefined;\n iconColor?: string | undefined;\n hoverBgColor?: string | undefined;\n /**\n * Press-state background. Defaults to `group-active/tap:brightness-90` (the\n * BOX is what is pressed — its touch area included), which works on\n * any color. Override when using a custom `bgColor` that should darken to a\n * specific shade on press (e.g. `group-active/tap:bg-primary/60`).\n */\n activeBgColor?: string | undefined;\n}\n\n/** Native button attributes a tap button accepts — everything except `style`:\n * a tap button's geometry is the system's, never the caller's. */\nexport type TapTargetNativeProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"style\">;\n\nconst EXTERNAL_RE = /^(https?:|mailto:|tel:)/i;\n\n// Geometry + press feedback + tap hygiene are the SINGLE SOURCE OF TRUTH in\n// the shipped stylesheet (the `.matrx-tap-*` family in styles.css — import\n// \"@ai-matrx/tap-target/styles.css\" once at app root). This component only\n// picks the right class and layers each variant's decoration on top.\nconst TAP_OUTER_CLASS = \"matrx-tap-target group group/tap\";\nconst TAP_GROUP_OUTER_CLASS = \"matrx-tap-target matrx-tap-target-sm group group/tap\";\n\nfunction IconContent({\n icon,\n children,\n strokeWidth = 2,\n className,\n}: Pick<\n TapTargetButtonProps,\n \"icon\" | \"children\" | \"strokeWidth\" | \"className\"\n>) {\n if (icon) {\n if (isValidElement<{ className?: string }>(icon)) {\n return cloneElement(icon, {\n className: cn(className, icon.props.className),\n });\n }\n return <span className={className}>{icon}</span>;\n }\n return (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n {children}\n </svg>\n );\n}\n\ntype TapTargetSize = \"default\" | \"sm\";\n\nfunction resolveTapGeometry(\n label: string | undefined,\n size: TapTargetSize,\n mobileIconOnly: boolean,\n) {\n const inline = Boolean(label);\n if (size === \"sm\") {\n return {\n outerClassName:\n inline && mobileIconOnly\n ? \"matrx-tap-target matrx-tap-target-sm matrx-tap-target-mobile-icon-only-sm group group/tap\"\n : inline\n ? \"matrx-tap-target matrx-tap-target-sm matrx-tap-target-inline-sm group group/tap\"\n : TAP_GROUP_OUTER_CLASS,\n inlineModifier: mobileIconOnly\n ? \"matrx-tap-pill-mobile-icon-only-sm\"\n : \"matrx-tap-pill-inline-sm\",\n };\n }\n return {\n outerClassName:\n inline && mobileIconOnly\n ? `${TAP_OUTER_CLASS} matrx-tap-target-mobile-icon-only`\n : inline\n ? `${TAP_OUTER_CLASS} matrx-tap-target-inline`\n : TAP_OUTER_CLASS,\n inlineModifier: mobileIconOnly\n ? \"matrx-tap-pill-mobile-icon-only\"\n : \"matrx-tap-pill-inline\",\n };\n}\n\nfunction buildTapInner({\n label,\n pillClassName,\n iconClassName,\n labelClassName,\n inlineModifier,\n icon,\n children,\n strokeWidth = 2,\n loading,\n chevron,\n}: {\n label?: string | undefined;\n pillClassName: string;\n iconClassName: string;\n labelClassName?: string | undefined;\n inlineModifier: string;\n icon?: React.ReactNode;\n children?: React.ReactNode;\n strokeWidth?: number | undefined;\n loading?: boolean | undefined;\n chevron?: boolean | undefined;\n}) {\n const iconEl = loading ? (\n <TapSpinner className={iconClassName} />\n ) : (\n <IconContent\n icon={icon}\n strokeWidth={strokeWidth}\n className={iconClassName}\n >\n {children}\n </IconContent>\n );\n const pillClasses = label\n ? `${pillClassName} ${inlineModifier}`.trim()\n : pillClassName;\n\n if (!label) {\n return <div className={pillClasses}>{iconEl}</div>;\n }\n\n return (\n <div className={pillClasses}>\n {iconEl}\n <span className={labelClassName ?? \"matrx-tap-label\"}>{label}</span>\n {chevron ? <TapChevron /> : null}\n </div>\n );\n}\n\ninterface RenderTapTargetArgs extends Pick<\n TapTargetButtonProps,\n | \"icon\"\n | \"children\"\n | \"strokeWidth\"\n | \"label\"\n | \"mobileIconOnly\"\n | \"onClick\"\n | \"as\"\n | \"htmlFor\"\n | \"ariaLabel\"\n | \"disabled\"\n | \"href\"\n | \"target\"\n | \"rel\"\n | \"prefetch\"\n | \"linkComponent\"\n | \"tooltip\"\n | \"tooltipSide\"\n | \"tooltipAlign\"\n> {\n size?: TapTargetSize;\n /** The caller's raw `className` (the glyph colour) — checked by the guard. */\n colorClassName?: string | undefined;\n pillClassName: string;\n iconClassName: string;\n labelClassName?: string | undefined;\n rest?: (TapTargetNativeProps & TapFeatureProps) | undefined;\n buttonRef?: Ref<HTMLButtonElement> | undefined;\n}\n\n// A hook (it carries the guard ref); every variant calls it exactly once.\nfunction useTapTarget({\n size = \"default\",\n colorClassName,\n pillClassName,\n iconClassName,\n labelClassName,\n icon,\n children,\n strokeWidth,\n label,\n mobileIconOnly = false,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n rest,\n buttonRef,\n}: RenderTapTargetArgs): ReactElement {\n const {\n tone,\n badge,\n pressed,\n loading,\n disabledReason,\n shortcut,\n chevron,\n ...nativeRest\n } = rest ?? {};\n const isDisabled = Boolean(disabled || disabledReason);\n // FORCED TOOLTIPS: the text is the reason, an explicit tooltip, the\n // accessible name, or the label — and a button with none is a defect.\n const tipText =\n disabledReason || (typeof tooltip === \"string\" && tooltip ? tooltip : undefined) || ariaLabel || label;\n const titleMode = tooltip === false;\n const propViolation =\n (tipText ? null : \"every tap button needs a tooltip — pass ariaLabel\") ??\n classNameMisuse(colorClassName ?? nativeRest.className) ??\n ((nativeRest as { style?: unknown }).style ? \"style is not supported on a tap button\" : null);\n const guardRef = useTapGuardRef<HTMLElement>(\n buttonRef as Ref<HTMLElement> | undefined,\n propViolation,\n );\n const nodeRef = useRef<HTMLElement | null>(null);\n const triggerRef = useCallback(\n (node: HTMLElement | null) => {\n nodeRef.current = node;\n guardRef(node);\n },\n [guardRef],\n );\n const getNode = useCallback(() => nodeRef.current, []);\n useTapShortcut(shortcut, getNode, !isDisabled && !loading);\n\n // Tone (or a pressed toggle) owns the glyph and label colour.\n const toneColor = tone ? TAP_TONE_CLASS[tone] : pressed && !colorClassName ? TAP_TONE_CLASS.primary : null;\n if (toneColor) {\n iconClassName = `matrx-tap-icon ${toneColor}`;\n labelClassName = `matrx-tap-label ${toneColor}`;\n }\n if (pressed) pillClassName = `${pillClassName} matrx-tap-pressed`;\n const { outerClassName, inlineModifier } = resolveTapGeometry(\n label,\n size,\n mobileIconOnly,\n );\n const responsiveLabelClassName = mobileIconOnly\n ? `${labelClassName ?? \"matrx-tap-label\"} matrx-tap-label-mobile-icon-only`\n : labelClassName;\n const inner = buildTapInner({\n label,\n pillClassName,\n iconClassName,\n labelClassName: responsiveLabelClassName,\n inlineModifier: label ? inlineModifier : \"\",\n icon,\n children,\n strokeWidth,\n loading,\n chevron,\n });\n const triggerAriaLabel =\n label && !mobileIconOnly ? undefined : (ariaLabel ?? label);\n const trigger = renderTrigger({\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n as,\n htmlFor,\n onClick: loading ? undefined : onClick,\n ariaLabel: triggerAriaLabel,\n disabled: isDisabled,\n outerClassName,\n title: titleMode && tipText ? (shortcut ? `${tipText} (${formatShortcut(shortcut)})` : tipText) : undefined,\n children: (\n <>\n {inner}\n {badge !== undefined ? <TapBadge badge={badge} /> : null}\n </>\n ),\n rest: {\n ...nativeRest,\n ...(pressed !== undefined ? { \"aria-pressed\": pressed } : {}),\n ...(loading ? { \"aria-busy\": true } : {}),\n ...(shortcut ? { \"aria-keyshortcuts\": shortcut.replace(/mod/i, \"Meta\") } : {}),\n },\n triggerRef,\n });\n if (titleMode || !tipText) return trigger;\n return withTooltip(trigger, {\n tooltip: tipText,\n ariaLabel: tipText,\n disabled: isDisabled,\n tooltipSide,\n tooltipAlign,\n shortcut,\n });\n}\n\ninterface RenderTriggerArgs {\n href?: string | undefined;\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\" | undefined;\n rel?: string | undefined;\n prefetch?: boolean | null | undefined;\n linkComponent?: TapTargetLinkComponent | undefined;\n as?: \"button\" | \"label\" | undefined;\n htmlFor?: string | undefined;\n onClick?: (() => void) | undefined;\n ariaLabel?: string | undefined;\n disabled?: boolean | undefined;\n outerClassName: string;\n children: ReactNode;\n rest?: ButtonHTMLAttributes<HTMLButtonElement> | undefined;\n triggerRef: Ref<HTMLElement>;\n /** Tooltip text drawn through `title` (tooltip={false}: a nested trigger). */\n title?: string | undefined;\n}\n\n/**\n * Resolves the correct trigger element based on the props passed.\n *\n * - `href` + `disabled` → unclickable `<span aria-disabled>`\n * - `href` matching `http(s):|mailto:|tel:` → `<a target=\"_blank\" rel=\"noopener noreferrer\">`\n * - `href` (internal) → the injected link component (per-instance\n * `linkComponent` prop, else `setTapTargetLinkComponent` registration),\n * falling back to a plain `<a>` when none is registered\n * - `as=\"label\"` → `<label htmlFor=...>`\n * - default → `<button>`\n */\nfunction renderTrigger({\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n as,\n htmlFor,\n onClick,\n ariaLabel,\n disabled,\n outerClassName,\n children,\n rest,\n triggerRef,\n title,\n}: RenderTriggerArgs): ReactElement {\n const { style: _style, ...restWithoutStyle } = rest ?? {};\n if (disabled && href) {\n return (\n <span\n ref={triggerRef}\n aria-disabled=\"true\"\n aria-label={ariaLabel}\n title={title}\n className={`${outerClassName} opacity-40 pointer-events-none`}\n >\n {children}\n </span>\n );\n }\n if (href) {\n const isExternal = EXTERNAL_RE.test(href);\n if (isExternal) {\n return (\n <a\n ref={triggerRef as Ref<HTMLAnchorElement>}\n href={href}\n target={target ?? \"_blank\"}\n rel={rel ?? \"noopener noreferrer\"}\n aria-label={ariaLabel}\n title={title}\n className={outerClassName}\n >\n {children}\n </a>\n );\n }\n const Link = linkComponent ?? getTapTargetLinkComponent();\n if (Link) {\n return (\n <Link\n ref={triggerRef as Ref<HTMLAnchorElement>}\n href={href}\n target={target}\n rel={rel}\n prefetch={prefetch}\n aria-label={ariaLabel}\n title={title}\n className={outerClassName}\n >\n {children}\n </Link>\n );\n }\n // No link component registered — plain <a>. `prefetch` is a router hint,\n // not a DOM attribute, so it is deliberately dropped here.\n return (\n <a\n ref={triggerRef as Ref<HTMLAnchorElement>}\n href={href}\n target={target}\n rel={rel}\n aria-label={ariaLabel}\n title={title}\n className={outerClassName}\n >\n {children}\n </a>\n );\n }\n if (as === \"label\") {\n return (\n <label\n ref={triggerRef as Ref<HTMLLabelElement>}\n htmlFor={htmlFor}\n aria-label={ariaLabel}\n title={title}\n className={outerClassName}\n >\n {children}\n </label>\n );\n }\n return (\n <button\n ref={triggerRef as Ref<HTMLButtonElement>}\n type=\"button\"\n onClick={onClick}\n aria-label={ariaLabel}\n title={title}\n disabled={disabled}\n {...restWithoutStyle}\n className={outerClassName}\n >\n {children}\n </button>\n );\n}\n\n/**\n * Wraps a trigger element in a Tooltip when a tooltip label is available.\n * Falls back to `ariaLabel` when `tooltip` is not explicitly set. If both\n * are absent (or `tooltip === false`), the trigger is returned unwrapped.\n */\nfunction withTooltip(\n trigger: ReactElement,\n {\n tooltip,\n ariaLabel,\n disabled,\n tooltipSide = \"top\",\n tooltipAlign = \"center\",\n shortcut,\n }: {\n tooltip?: string | false | undefined;\n ariaLabel?: string | undefined;\n disabled?: boolean | undefined;\n tooltipSide?: \"top\" | \"right\" | \"bottom\" | \"left\" | undefined;\n tooltipAlign?: \"start\" | \"center\" | \"end\" | undefined;\n shortcut?: TapShortcut | undefined;\n },\n): ReactElement {\n if (tooltip === false) return trigger;\n const label =\n typeof tooltip === \"string\" && tooltip.length > 0 ? tooltip : ariaLabel;\n if (!label) return trigger;\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n {disabled ? (\n // Radix Tooltip triggers need a hoverable element; a disabled button\n // does not dispatch pointer events, so we wrap in a span for the\n // trigger target while keeping the disabled visual state.\n <span className=\"inline-flex\">{trigger}</span>\n ) : (\n trigger\n )}\n </TooltipTrigger>\n <TooltipContent side={tooltipSide} align={tooltipAlign}>\n {tooltipBody(label, shortcut)}\n </TooltipContent>\n </Tooltip>\n );\n}\n\n// To resize/retune every tap button, edit styles.css — not here.\n\nexport const TapTargetButton = forwardRef<\n HTMLButtonElement,\n TapTargetButtonProps & TapTargetNativeProps\n>(function TapTargetButton(\n {\n icon,\n children,\n strokeWidth = 2,\n onClick,\n className,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...rest\n },\n ref,\n) {\n const color = className ?? \"text-foreground\";\n return useTapTarget({\n colorClassName: className,\n icon,\n children,\n strokeWidth,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n pillClassName: \"matrx-tap-pill matrx-glass-thin-border\",\n iconClassName: `matrx-tap-icon ${color}`,\n rest,\n buttonRef: ref,\n });\n});\n\nexport const TapTargetButtonTransparent = forwardRef<\n HTMLButtonElement,\n TapTargetButtonProps & TapTargetNativeProps\n>(function TapTargetButtonTransparent(\n {\n icon,\n children,\n strokeWidth = 2,\n onClick,\n className,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...rest\n },\n ref,\n) {\n const color = className ?? \"text-foreground\";\n return useTapTarget({\n colorClassName: className,\n icon,\n children,\n strokeWidth,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n pillClassName:\n \"matrx-tap-pill group-hover/tap:bg-muted group-active/tap:bg-muted-foreground/15\",\n iconClassName: `matrx-tap-icon ${color}`,\n rest,\n buttonRef: ref,\n });\n});\n\n/** Outline pill — a plain 1px border, no fill, no blur, no shadow. Glass only\n * reads as glass over something you can see through; on an opaque card or\n * header use THIS. Same colors as the classic square \"+\": border-border,\n * muted glyph, primary border + foreground glyph on hover. */\nexport const TapTargetButtonOutline = forwardRef<\n HTMLButtonElement,\n TapTargetButtonProps & TapTargetNativeProps\n>(function TapTargetButtonOutline(\n {\n icon,\n children,\n strokeWidth = 2,\n onClick,\n className,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...rest\n },\n ref,\n) {\n const color =\n className ?? \"text-muted-foreground group-hover/tap:text-foreground\";\n return useTapTarget({\n colorClassName: className,\n icon,\n children,\n strokeWidth,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n pillClassName:\n \"matrx-tap-pill border border-border bg-transparent transition-colors group-hover/tap:border-primary/60 group-active/tap:bg-muted\",\n iconClassName: `matrx-tap-icon ${color}`,\n labelClassName: `matrx-tap-label ${color}`,\n rest,\n buttonRef: ref,\n });\n});\n\nexport const TapTargetButtonSolid = forwardRef<\n HTMLButtonElement,\n TapTargetButtonSolidProps & TapTargetNativeProps\n>(function TapTargetButtonSolid(\n {\n icon,\n children,\n strokeWidth = 2,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tone,\n bgColor,\n iconColor,\n hoverBgColor,\n activeBgColor,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...rest\n },\n ref,\n) {\n return useTapTarget({\n icon,\n children,\n strokeWidth,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...solidClasses(tone, bgColor, iconColor, hoverBgColor, activeBgColor),\n rest,\n buttonRef: ref,\n });\n});\n\n// `tone` is the system's fill; the four colour strings are the pre-tone API,\n// accepted only until their last callers move to `tone`.\nfunction solidClasses(\n tone: TapSolidTone | undefined,\n bgColor: string | undefined,\n iconColor: string | undefined,\n hoverBgColor: string | undefined,\n activeBgColor: string | undefined,\n) {\n const legacy = !tone && (bgColor || iconColor || hoverBgColor || activeBgColor);\n if (!legacy) {\n const t = TAP_SOLID_TONE[tone ?? \"primary\"];\n return {\n pillClassName: `matrx-tap-pill ${t.fill} ${t.glyph} group-active/tap:brightness-90`,\n iconClassName: `matrx-tap-icon ${t.glyph}`,\n labelClassName: `matrx-tap-label ${t.glyph}`,\n };\n }\n const glyph = iconColor ?? \"text-primary-foreground\";\n return {\n pillClassName: `matrx-tap-pill ${bgColor ?? \"bg-primary\"} ${glyph} ${hoverBgColor ?? \"group-hover/tap:bg-primary/80\"} ${activeBgColor ?? \"group-active/tap:brightness-90\"}`,\n iconClassName: `matrx-tap-icon ${glyph}`,\n labelClassName: `matrx-tap-label ${glyph}`,\n };\n}\n\n/** Solid destructive pill — delete/remove actions. White-on-red like the\n * primary solid is white-on-blue. Use THIS, never hand-pass bg-destructive\n * with the default (dark) icon color. */\nexport const TapTargetButtonDestructive = forwardRef<\n HTMLButtonElement,\n TapTargetButtonSolidProps & TapTargetNativeProps\n>(function TapTargetButtonDestructive({ tone = \"destructive\", ...rest }, ref) {\n return <TapTargetButtonSolid ref={ref} tone={tone} {...rest} />;\n});\n\nexport const TapTargetButtonForGroup = forwardRef<\n HTMLButtonElement,\n TapTargetButtonProps & TapTargetNativeProps\n>(function TapTargetButtonForGroup(\n {\n icon,\n children,\n strokeWidth = 2,\n onClick,\n className,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n ...rest\n },\n ref,\n) {\n const color = className ?? \"text-foreground\";\n return useTapTarget({\n colorClassName: className,\n size: \"sm\",\n icon,\n children,\n strokeWidth,\n onClick,\n as,\n htmlFor,\n ariaLabel,\n disabled,\n href,\n target,\n rel,\n prefetch,\n linkComponent,\n tooltip,\n tooltipSide,\n tooltipAlign,\n label,\n mobileIconOnly,\n pillClassName: \"matrx-tap-pill matrx-tap-pill-sm matrx-glass-interactive\",\n iconClassName: `matrx-tap-icon ${color}`,\n labelClassName: `matrx-tap-label ${color}`,\n rest,\n buttonRef: ref,\n });\n});\n\nexport function TapTargetButtonGroup({\n children,\n className,\n surface = \"glass\",\n}: {\n children: React.ReactNode;\n className?: string | undefined;\n /**\n * GLASS ONLY FLOATS (owner rule, 2026-10-02): glass belongs on a bar that\n * floats over scrolling content or a see-through plane. On a solid surface\n * (a page, a card, a toast, a table toolbar) use `\"solid\"`: a muted track,\n * no glass stroke, the same geometry.\n */\n surface?: \"glass\" | \"solid\" | undefined;\n}) {\n // Geometry (height, the half-gap outside the capsule, the capsule itself)\n // is `.matrx-tap-group*` in tap-target.css.\n return (\n <div\n className={className ? `matrx-tap-group ${className}` : \"matrx-tap-group\"}\n data-surface={surface}\n >\n <div\n className={\n surface === \"solid\"\n ? \"matrx-tap-group-capsule matrx-tap-group-capsule-solid\"\n : \"matrx-tap-group-capsule matrx-glass-thin-border\"\n }\n />\n <div className=\"matrx-tap-group-row\">{children}</div>\n </div>\n );\n}\n","/**\n * Minimal className join — the only piece of `cn` this package needs.\n * No tailwind-merge / clsx dependency by design: callers pass literal strings.\n */\nexport function cn(\n ...values: Array<string | null | undefined | false>\n): string {\n return values.filter(Boolean).join(\" \").trim();\n}\n","\"use client\";\n\n// THE TAP-TARGET GUARD — development builds only.\n//\n// The lock layer in tap-target.css makes a tap button's own box, pill and\n// glyph impossible to resize from outside. What CSS cannot stop is a caller\n// bending the system AROUND the button: a parent that adds `gap` between two\n// tap buttons, a wrapper with margin or padding, a local override of a\n// `--matrx-tap-*` token, a utility class smuggled in through `className`.\n// After a tap button mounts, this guard measures it in the real layout and,\n// on any of those, marks it `data-matrx-tap-violation`: the stylesheet then\n// paints it as a giant red box carrying the reason, and the console names\n// the element.\n//\n// OFF until the host turns it on with `enableTapTargetGuard()` — from code the\n// HOST compiles, e.g. matrx-frontend's dev-only client boot. Never gate it on\n// `process.env.NODE_ENV` in here: this package's own build inlines that\n// expression, so a \"dev only\" check written here would run in production too\n// (see @ai-matrx/associations' context.tsx for the outage that taught this).\n\nimport { useCallback, useRef, type MutableRefObject, type Ref } from \"react\";\n\n// A `Symbol.for` slot on globalThis, like the link seam: the `.` and\n// `./buttons` bundles each inline this module, and one switch must reach both.\nconst GUARD_SLOT = Symbol.for(\"@ai-matrx/tap-target:guard\");\ntype GlobalWithGuard = typeof globalThis & { [GUARD_SLOT]?: boolean };\n\n/** Turn the development guard on (or off). Call once at client boot, only in\n * development builds of the host. */\nexport function enableTapTargetGuard(on = true): void {\n (globalThis as GlobalWithGuard)[GUARD_SLOT] = on;\n}\n\nfunction guardOn(): boolean {\n return (globalThis as GlobalWithGuard)[GUARD_SLOT] === true;\n}\n\nconst TOKENS = [\n \"--matrx-tap-box\",\n \"--matrx-tap-gap\",\n \"--matrx-tap-pill-size\",\n \"--matrx-tap-pill-sm-size\",\n \"--matrx-tap-wide-size\",\n \"--matrx-tap-icon-size\",\n \"--matrx-tap-touch-min\",\n \"--matrx-tap-target-size\",\n] as const;\n\n/** The only scopes that may move tap tokens, and which ones — each owned by\n * this package's own CSS: the table density scales (tap-target.css) and\n * Alchemy's 18px trigger glyph (content-transfer.css). */\nconst SANCTIONED: ReadonlyArray<{ scope: string; tokens: ReadonlySet<string> }> = [\n {\n scope: \"[data-matrx-table][data-matrx-table-density]\",\n tokens: new Set([\n \"--matrx-tap-target-size\",\n \"--matrx-tap-pill-size\",\n \"--matrx-tap-wide-size\",\n \"--matrx-tap-pill-sm-size\",\n \"--matrx-tap-icon-size\",\n ]),\n },\n { scope: \"[data-alchemy-trigger]\", tokens: new Set([\"--matrx-tap-icon-size\"]) },\n];\nconst TABLE_SCOPE = SANCTIONED[0]!.scope;\nconst TAP_ITEM = \".matrx-tap-target, .matrx-tap-group\";\n\n/** `className` on a tap button is the GLYPH COLOUR. Anything that sizes,\n * spaces, positions or fills is misuse. */\nconst NON_COLOUR_CLASS =\n /^(?:[^\\s:]+:)*!?-?(?:\\[&|scale|translate|h|w|size|min-h|min-w|max-h|max-w|p|px|py|ps|pe|pt|pb|pl|pr|m|mx|my|ms|me|mt|mb|ml|mr|gap|space-x|space-y|bg|rounded|border|ring|shadow|absolute|relative|fixed|sticky|inset|top|left|right|bottom|flex|grid|block|inline|hidden|z|shrink|grow|basis|self|order)(?:-|$|\\[)/;\n\nexport function classNameMisuse(className: string | undefined): string | null {\n if (!guardOn() || !className) return null;\n const bad = className.split(/\\s+/).filter((t) => t && NON_COLOUR_CLASS.test(t));\n return bad.length\n ? `className is the glyph colour only — remove \"${bad.join(\" \")}\"`\n : null;\n}\n\nfunction px(value: string): number {\n const n = Number.parseFloat(value);\n return Number.isFinite(n) ? n : 0;\n}\n\nfunction describe(el: Element): string {\n const cls = typeof el.className === \"string\" ? el.className.trim().split(/\\s+/).slice(0, 4).join(\".\") : \"\";\n return `<${el.tagName.toLowerCase()}${cls ? `.${cls}` : \"\"}>`;\n}\n\n/** Elements that ride along with a tap button without taking space from it\n * (a badge, a capsule, a tooltip portal anchor). */\nfunction isDecor(el: Element, view: Window): boolean {\n const cs = view.getComputedStyle(el);\n return cs.position === \"absolute\" || cs.position === \"fixed\" || cs.display === \"none\";\n}\n\nfunction tapCount(el: Element): number {\n return el.matches(TAP_ITEM) ? 1 : el.querySelectorAll(TAP_ITEM).length;\n}\n\n/** Visible text in `container` outside `tap` and outside decor (a badge's\n * count is decor) — a wrapper with its own words is a chip, not a wrapper. */\nfunction ownText(container: Element, tap: Element, view: Window): string {\n let out = \"\";\n const walk = (node: Node) => {\n if (node === tap) return;\n if (node.nodeType === 3) out += node.textContent ?? \"\";\n else if (node.nodeType === 1 && !isDecor(node as Element, view)) node.childNodes.forEach(walk);\n };\n container.childNodes.forEach(walk);\n return out.trim();\n}\n\n/** True when `child` is a tap button, or a plain wrapper whose only content\n * is ONE tap button (plus decor) — never a search box that happens to hold\n * a clear button, never a chip with words. */\nfunction isTapSlot(child: Element, view: Window): boolean {\n if (child.matches(TAP_ITEM)) return true;\n if (tapCount(child) !== 1) return false;\n const tap = child.querySelector(TAP_ITEM)!;\n const controls = Array.from(child.querySelectorAll(\"input, select, textarea, button, a, [role='button']\"));\n if (controls.some((c) => c !== tap && !tap.contains(c))) return false;\n return ownText(child, tap, view) === \"\";\n}\n\nlet probe: { key: string; target: number; pill: number; sm: number; smPill: number; wide: number; icon: number } | null = null;\n\n/** What the package's own CSS produces with no surrounding context — the\n * canon every mounted button is measured against. Re-measured whenever the\n * root tokens change (the lab page switches the gap). */\nfunction canon(doc: Document) {\n const view = doc.defaultView!;\n const root = view.getComputedStyle(doc.documentElement);\n const key = TOKENS.map((t) => root.getPropertyValue(t)).join(\"|\");\n if (probe?.key === key) return probe;\n const host = doc.createElement(\"div\");\n host.setAttribute(\"aria-hidden\", \"true\");\n host.style.cssText = \"position:absolute;visibility:hidden;pointer-events:none;left:-9999px;top:0\";\n host.innerHTML =\n '<button class=\"matrx-tap-target\"><div class=\"matrx-tap-pill\"><svg class=\"matrx-tap-icon\"></svg></div></button>' +\n '<button class=\"matrx-tap-target matrx-tap-target-sm\"><div class=\"matrx-tap-pill matrx-tap-pill-sm\"></div></button>' +\n '<button class=\"matrx-tap-target matrx-tap-target-inline\"><div class=\"matrx-tap-pill matrx-tap-pill-inline\"></div></button>';\n doc.body.appendChild(host);\n const [a, b, w] = Array.from(host.children) as HTMLElement[];\n probe = {\n key,\n target: a!.offsetHeight,\n pill: (a!.firstElementChild as HTMLElement).offsetHeight,\n icon: px(view.getComputedStyle(a!.querySelector(\"svg\")!).height),\n sm: b!.offsetHeight,\n smPill: (b!.firstElementChild as HTMLElement).offsetHeight,\n wide: (w!.firstElementChild as HTMLElement).offsetHeight,\n };\n host.remove();\n return probe;\n}\n\n/** Returns the first rule this mounted tap button breaks, or null. */\nexport function findTapViolation(el: HTMLElement): string | null {\n const doc = el.ownerDocument;\n const view = doc.defaultView;\n if (!view || !el.isConnected) return null;\n const cs = view.getComputedStyle(el);\n if (cs.display === \"none\") return null;\n\n // 1. Tokens are the package's alone. Only the table-density scope may move\n // the three it owns.\n const root = view.getComputedStyle(doc.documentElement);\n const inTable = el.closest(TABLE_SCOPE) !== null;\n const moved = new Set<string>();\n for (const token of TOKENS) {\n const mine = cs.getPropertyValue(token).trim();\n const base = root.getPropertyValue(token).trim();\n if (mine === base) continue;\n if (!SANCTIONED.some((s) => s.tokens.has(token) && el.closest(s.scope))) {\n return `${token} overridden to \"${mine}\" — tap geometry is not configurable`;\n }\n moved.add(token);\n }\n\n // 2. Measured geometry equals the canon (outside table density, which\n // sizes by its own tokens).\n const sm = el.classList.contains(\"matrx-tap-target-sm\");\n const inline = /matrx-tap-target-(?:inline|mobile-icon-only)/.test(el.className);\n const pill = el.querySelector<HTMLElement>(\":scope > .matrx-tap-pill\");\n const icon = pill?.querySelector(\".matrx-tap-icon\") ?? null;\n // A host touch floor (min-width / min-height) may enlarge a box; that is\n // the floor working, not a bend.\n const floored =\n px(cs.minHeight) >= el.offsetHeight - 0.5 || px(cs.minWidth) >= el.offsetWidth - 0.5;\n if (!inTable && pill && !floored) {\n const c = canon(doc);\n const box = sm ? c.sm : c.target;\n // A labelled pill is a WIDE shape (shorter than a round one); below the\n // `sm` breakpoint a mobile-icon-only pill is round again — either is canon.\n const pillSizes = sm ? [c.smPill] : inline ? [c.pill, c.wide] : [c.pill];\n if (Math.abs(el.offsetHeight - box) > 0.5) return `button is ${el.offsetHeight}px tall, canon is ${box}px`;\n if (!inline && Math.abs(el.offsetWidth - box) > 0.5) return `button is ${el.offsetWidth}px wide, canon is ${box}px`;\n if (!pillSizes.some((p) => Math.abs(pill.offsetHeight - p) <= 0.5)) {\n return `pill is ${pill.offsetHeight}px, canon is ${pillSizes.join(\" or \")}px`;\n }\n if (icon && !moved.has(\"--matrx-tap-icon-size\")) {\n const size = px(view.getComputedStyle(icon).height);\n if (Math.abs(size - c.icon) > 0.5) return `glyph is ${size}px, canon is ${c.icon}px`;\n }\n }\n\n // 3. Nothing adds space around it. Climb the wrappers that hold only this\n // button (plus decor such as a badge); none may carry inline margin or\n // padding. A tap button inside a group is represented by its group.\n let slot: Element = el;\n if (el.parentElement?.matches(\".matrx-tap-group-row, .matrx-tap-search-measure\")) {\n const group = el.closest(\".matrx-tap-group\");\n if (group && tapCount(el.parentElement) > 1) return null;\n slot = group ?? el;\n }\n for (let depth = 0; depth < 2; depth += 1) {\n const parent: HTMLElement | null = slot.parentElement;\n if (!parent || parent === doc.body) break;\n const others = Array.from(parent.children).filter((c) => c !== slot && !isDecor(c, view));\n if (others.length > 0) break; // `parent` is the row\n if (ownText(parent, slot, view) !== \"\") break; // a chip or a titled header\n const pcs = view.getComputedStyle(parent);\n const space = px(pcs.marginLeft) + px(pcs.marginRight) + px(pcs.paddingLeft) + px(pcs.paddingRight);\n if (space > 0.5) {\n return `${describe(parent)} adds ${space}px around a tap button — tap buttons space themselves`;\n }\n slot = parent;\n }\n\n // 4. The row adds no gap between tap buttons.\n const row = slot.parentElement;\n if (row) {\n const rcs = view.getComputedStyle(row);\n const flexOrGrid = /flex|grid/.test(rcs.display);\n const neighbours = Array.from(row.children).filter((c) => c !== slot && isTapSlot(c, view));\n if (flexOrGrid && neighbours.length > 0) {\n const horizontal = rcs.display.includes(\"grid\") || !rcs.flexDirection.startsWith(\"column\");\n const gap = px(horizontal ? rcs.columnGap : rcs.rowGap);\n if (gap > 0.5) {\n return `${describe(row)} adds a ${gap}px gap between tap buttons — remove it; tap buttons space themselves`;\n }\n }\n }\n return null;\n}\n\n/* ------------------------------------------------------------------ */\n/* PLACEMENT — the three rules a tap button's SURROUNDINGS must keep */\n/* (owner, 2026-10-02). Reported as a WARNING (a dashed outline and one */\n/* console error naming the fix), not the misuse box: they are about */\n/* the page around the button, and the whole app is being brought into */\n/* line with them. */\n/* 1. GLASS ONLY FLOATS — glass is see-through; it belongs on a bar */\n/* that floats over moving content (position fixed/sticky) or on a */\n/* plane marked `data-matrx-glass-plane`. On a page, card, toast or */\n/* table use `variant=\"transparent\"` / a solid group. */\n/* 2. ALL GLASS OR NONE — a glass item's row holds only glass items */\n/* (glass tap buttons, glass groups, or `data-matrx-glass` pieces). */\n/* 3. NEIGHBOURS KEEP THEIR HALF-GAP — a tap box carries 3px of unseen */\n/* space each side (box − pill = one gap, 6px). Anything beside it */\n/* adds its own 3px, so the visible distance is always one gap. */\n/* ------------------------------------------------------------------ */\n\nconst GLASS = \".matrx-glass-thin-border, .matrx-glass-interactive\";\n\nfunction isGlassItem(node: Element): boolean {\n if (node.hasAttribute(\"data-matrx-glass\")) return true;\n if (node.matches(\".matrx-tap-group\")) return node.querySelector(\":scope > .matrx-tap-group-capsule.matrx-glass-thin-border\") !== null;\n if (node.matches(\".matrx-tap-target\")) return node.querySelector(`:scope > .matrx-tap-pill:is(${GLASS})`) !== null;\n // A plain wrapper whose only content is ONE tap button (plus decor such as a\n // badge) is that button: a badge host around a glass button is glass.\n const view = node.ownerDocument.defaultView;\n if (view && isTapSlot(node, view)) return isGlassItem(node.querySelector(TAP_ITEM)!);\n return false;\n}\n\nconst SCROLLS = /^(auto|scroll|overlay)$/;\n\n/** True when `el` rides a bar over moving content: a fixed/sticky ancestor (or\n * a glass plane) reached BEFORE any scroll container. Inside a scroller the\n * button IS the moving content — an app root that is itself `position:\n * fixed` (the shell) must not make every page button \"float\". */\nfunction floats(el: Element, view: Window): boolean {\n for (let n: Element | null = el; n && n !== el.ownerDocument.body; n = n.parentElement) {\n if (n.hasAttribute(\"data-matrx-glass-plane\")) return true;\n const cs = view.getComputedStyle(n);\n if (cs.position === \"fixed\" || cs.position === \"sticky\") return true;\n if (n !== el && (SCROLLS.test(cs.overflowY) || SCROLLS.test(cs.overflowX))) return false;\n }\n return false;\n}\n\nfunction visible(el: Element, view: Window): boolean {\n if (el.getAttribute(\"aria-hidden\") === \"true\" || isDecor(el, view)) return false;\n const r = el.getBoundingClientRect();\n return r.width > 1 && r.height > 1;\n}\n\n/** The first placement rule this tap button's surroundings break, or null. */\nexport function findTapPlacementWarning(el: HTMLElement): string | null {\n const doc = el.ownerDocument;\n const view = doc.defaultView;\n if (!view || !el.isConnected) return null;\n // A button inside a group is judged as its group.\n const slot: Element = el.closest(\".matrx-tap-group\") ?? el;\n const glass = isGlassItem(slot);\n\n if (glass && !floats(slot, view)) {\n return 'glass on a solid surface — glass only floats over moving content; use variant=\"transparent\" (or a solid group)';\n }\n\n const row = slot.parentElement;\n if (!row) return null;\n if (glass) {\n const mixed = Array.from(row.children).find((c) => c !== slot && visible(c, view) && !isGlassItem(c));\n if (mixed) return `glass beside non-glass ${describe(mixed)} — make the row all glass or none`;\n }\n\n const pill = (el.querySelector(\":scope > .matrx-tap-pill\") as HTMLElement | null) ?? (slot.querySelector(\".matrx-tap-group-capsule\") as HTMLElement | null);\n if (!pill) return null;\n const gap = px(view.getComputedStyle(el).getPropertyValue(\"--matrx-tap-gap\")) || 6;\n const p = pill.getBoundingClientRect();\n if (p.width === 0) return null;\n for (const [side, sib] of [[\"after\", slot.nextElementSibling], [\"before\", slot.previousElementSibling]] as const) {\n if (!sib || !visible(sib, view) || isTapSlot(sib, view) || isGlassItem(sib)) continue;\n const r = sib.getBoundingClientRect();\n if (Math.abs(r.top + r.height / 2 - (p.top + p.height / 2)) > p.height) continue; // not on this row\n const cs = view.getComputedStyle(sib);\n const distance = side === \"after\" ? r.left + px(cs.paddingLeft) - p.right : p.left - (r.right - px(cs.paddingRight));\n if (distance < gap - 0.5) {\n return `${describe(sib)} sits ${Math.round(distance)}px from the pill — anything beside a tap button adds its own ${gap / 2}px (the box only carries ${gap / 2}px)`;\n }\n }\n return null;\n}\n\nconst reported = new Set<string>();\n\nfunction report(el: HTMLElement, reason: string) {\n el.setAttribute(\"data-matrx-tap-violation\", reason);\n const key = `${reason}@${el.getAttribute(\"aria-label\") ?? el.textContent ?? \"\"}`;\n if (reported.has(key)) return;\n reported.add(key);\n console.error(`[tap-target] ${reason}`, el);\n}\n\nconst mounted = new Set<HTMLElement>();\nlet resizeTimer: ReturnType<typeof setTimeout> | null = null;\nlet listening = false;\n\nfunction check(node: HTMLElement) {\n const reason = findTapViolation(node);\n if (reason) {\n report(node, reason);\n return;\n }\n node.removeAttribute(\"data-matrx-tap-violation\");\n const warning = findTapPlacementWarning(node);\n if (warning) {\n node.setAttribute(\"data-matrx-tap-warning\", warning);\n const key = `w:${warning}@${node.getAttribute(\"aria-label\") ?? \"\"}`;\n if (!reported.has(key)) {\n reported.add(key);\n console.error(`[tap-target] ${warning}`, node);\n }\n } else node.removeAttribute(\"data-matrx-tap-warning\");\n}\n\nfunction listenForResize(view: Window) {\n if (listening) return;\n listening = true;\n view.addEventListener(\"resize\", () => {\n if (resizeTimer) clearTimeout(resizeTimer);\n resizeTimer = setTimeout(() => mounted.forEach((n) => (n.isConnected ? check(n) : mounted.delete(n))), 200);\n });\n}\n\nfunction assignRef<T>(ref: Ref<T> | undefined, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) (ref as MutableRefObject<T | null>).current = value;\n}\n\n/**\n * The callback ref every tap trigger carries. In production it only forwards\n * the caller's ref; in development it also measures the trigger once it is in\n * the layout and paints a violation.\n */\nexport function useTapGuardRef<T extends HTMLElement>(\n forwarded: Ref<T> | undefined,\n propViolation: string | null,\n): (node: T | null) => void {\n const current = useRef<T | null>(null);\n return useCallback(\n (node: T | null) => {\n assignRef(forwarded, node);\n if (current.current && current.current !== node) mounted.delete(current.current);\n current.current = node;\n if (!guardOn() || !node) return;\n if (propViolation) {\n report(node, propViolation);\n return;\n }\n const view = node.ownerDocument.defaultView;\n if (!view) return;\n mounted.add(node);\n listenForResize(view);\n view.requestAnimationFrame(() => check(node));\n },\n [forwarded, propViolation],\n );\n}\n","\"use client\";\n\n// THE BUILT-IN CAPABILITIES of every tap button — each one an enum or a flag,\n// never a class a caller writes. Rendering and geometry live in tap-target.css\n// (`.matrx-tap-badge`, `.matrx-tap-pressed`, `.matrx-tap-chevron`, …).\n\nimport { useEffect, type ReactNode } from \"react\";\n\nimport { MOTION_SPIN } from \"../motion\";\n\n/** Glyph colour. Replaces the free-form `className`. */\nexport type TapTone = \"default\" | \"muted\" | \"primary\" | \"destructive\" | \"success\" | \"warning\" | \"info\";\n\n/** Fill of a solid button. Replaces `bgColor` / `iconColor` / hover / active. */\nexport type TapSolidTone = \"primary\" | \"destructive\" | \"success\" | \"warning\" | \"neutral\";\n\nexport const TAP_TONE_CLASS: Record<TapTone, string> = {\n default: \"text-foreground\",\n muted: \"text-muted-foreground group-hover/tap:text-foreground\",\n primary: \"text-primary\",\n destructive: \"text-destructive\",\n success: \"text-success\",\n warning: \"text-warning\",\n info: \"text-info\",\n};\n\nexport const TAP_SOLID_TONE: Record<TapSolidTone, { fill: string; glyph: string }> = {\n primary: { fill: \"bg-primary group-hover/tap:bg-primary/85\", glyph: \"text-primary-foreground\" },\n destructive: { fill: \"bg-destructive group-hover/tap:bg-destructive/85\", glyph: \"text-destructive-foreground\" },\n success: { fill: \"bg-success group-hover/tap:bg-success/85\", glyph: \"text-success-foreground\" },\n warning: { fill: \"bg-warning group-hover/tap:bg-warning/85\", glyph: \"text-warning-foreground\" },\n neutral: { fill: \"bg-foreground group-hover/tap:bg-foreground/85\", glyph: \"text-background\" },\n};\n\n/**\n * A keyboard shortcut: modifiers joined by \"+\", then one key —\n * \"mod+k\" (⌘ on Apple, Ctrl elsewhere), \"shift+mod+p\", \"alt+n\", \"/\", \"?\".\n */\nexport type TapShortcut = string;\n\nexport interface TapFeatureProps {\n /** Glyph colour, from the system's list. */\n tone?: TapTone | undefined;\n /** A count (99+ past 99) or a dot, drawn on the pill's corner by the system. */\n badge?: number | \"dot\" | undefined;\n /** A toggle that is on (sidebar open, filter on): tinted pill + aria-pressed. */\n pressed?: boolean | undefined;\n /** Work in flight: the glyph becomes a spinner and presses are ignored. */\n loading?: boolean | undefined;\n /** Why the button cannot be used — disables it and becomes its tooltip. */\n disabledReason?: string | undefined;\n /** Keyboard shortcut that presses the button; shown in its tooltip. */\n shortcut?: TapShortcut | undefined;\n /** A menu trigger: a small chevron after the label. */\n chevron?: boolean | undefined;\n}\n\nconst IS_APPLE =\n typeof navigator !== \"undefined\" && /Mac|iPhone|iPad|iPod/.test(navigator.platform || navigator.userAgent);\n\ninterface ParsedShortcut {\n mod: boolean;\n shift: boolean;\n alt: boolean;\n key: string;\n}\n\nexport function parseShortcut(shortcut: TapShortcut): ParsedShortcut {\n const parts = shortcut.toLowerCase().split(\"+\");\n const key = parts.pop() ?? \"\";\n return { mod: parts.includes(\"mod\"), shift: parts.includes(\"shift\"), alt: parts.includes(\"alt\"), key };\n}\n\n/** \"mod+k\" → \"⌘K\" on Apple, \"Ctrl+K\" elsewhere. */\nexport function formatShortcut(shortcut: TapShortcut): string {\n const p = parseShortcut(shortcut);\n const key = p.key.length === 1 ? p.key.toUpperCase() : p.key[0]!.toUpperCase() + p.key.slice(1);\n if (IS_APPLE) return `${p.alt ? \"⌥\" : \"\"}${p.shift ? \"⇧\" : \"\"}${p.mod ? \"⌘\" : \"\"}${key}`;\n return [p.mod && \"Ctrl\", p.alt && \"Alt\", p.shift && \"Shift\", key].filter(Boolean).join(\"+\");\n}\n\nfunction isTyping(target: EventTarget | null): boolean {\n const el = target as HTMLElement | null;\n return !!el && (el.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName));\n}\n\nexport function matchesShortcut(e: KeyboardEvent, shortcut: TapShortcut): boolean {\n const p = parseShortcut(shortcut);\n if ((e.metaKey || e.ctrlKey) !== p.mod || e.altKey !== p.alt) return false;\n // \"?\" and other shifted symbols arrive with shiftKey set — only compare\n // shift for letters and named keys.\n if (/^[a-z0-9]$|^[a-z]{2,}$/.test(p.key) && e.shiftKey !== p.shift) return false;\n if (!p.mod && isTyping(e.target)) return false;\n return e.key.toLowerCase() === p.key;\n}\n\n/** Presses `node` when its shortcut is typed anywhere on the page. */\nexport function useTapShortcut(shortcut: TapShortcut | undefined, getNode: () => HTMLElement | null, enabled: boolean) {\n useEffect(() => {\n if (!shortcut || !enabled) return;\n const onKey = (e: KeyboardEvent) => {\n if (!matchesShortcut(e, shortcut)) return;\n const node = getNode();\n if (!node || !node.isConnected) return;\n e.preventDefault();\n node.click();\n };\n window.addEventListener(\"keydown\", onKey);\n return () => window.removeEventListener(\"keydown\", onKey);\n }, [shortcut, enabled, getNode]);\n}\n\nexport function TapBadge({ badge }: { badge: number | \"dot\" }) {\n if (badge === \"dot\") return <span aria-hidden=\"true\" className=\"matrx-tap-badge\" data-dot=\"\" />;\n if (badge <= 0) return null;\n return (\n <span aria-hidden=\"true\" className=\"matrx-tap-badge\">\n {badge > 99 ? \"99+\" : badge}\n </span>\n );\n}\n\nexport function TapSpinner({ className }: { className: string }) {\n return (\n <svg className={className} fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={2} aria-hidden=\"true\">\n <circle\n className={MOTION_SPIN}\n cx=\"12\"\n cy=\"12\"\n r=\"9\"\n strokeDasharray=\"28.27\"\n strokeDashoffset=\"9\"\n strokeLinecap=\"round\"\n style={{ transformOrigin: \"12px 12px\" }}\n />\n </svg>\n );\n}\n\nexport function TapChevron() {\n return (\n <svg\n className=\"matrx-tap-chevron\"\n aria-hidden=\"true\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n );\n}\n\n/** Tooltip body: the label, then the shortcut as a key cap. */\nexport function tooltipBody(label: string, shortcut: TapShortcut | undefined): ReactNode {\n if (!shortcut) return label;\n return (\n <span className=\"matrx-tap-tooltip\">\n {label}\n <kbd className=\"matrx-tap-kbd\">{formatShortcut(shortcut)}</kbd>\n </span>\n );\n}\n","import type { ComponentType, ReactNode, Ref } from \"react\";\n\n/**\n * The injectable link seam — the package's replacement for the original\n * hard `next/link` import.\n *\n * Internal hrefs (anything NOT matching `http(s):`, `mailto:`, `tel:`) render\n * through the link component resolved here; external hrefs always render a\n * plain `<a target=\"_blank\" rel=\"noopener noreferrer\">`, exactly like the\n * original. When nothing is registered and no per-instance `linkComponent`\n * prop is given, internal hrefs fall back to a plain `<a>` (no prefetch, no\n * client-side routing — still a working link).\n */\nexport interface TapTargetLinkProps {\n href: string;\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\" | undefined;\n rel?: string | undefined;\n /** Router prefetch hint (next/link semantics). Plain `<a>` fallback ignores it. */\n prefetch?: boolean | null | undefined;\n \"aria-label\"?: string | undefined;\n /** Tooltip text drawn through `title` (the provider's title takeover). */\n title?: string | undefined;\n className?: string | undefined;\n children?: ReactNode;\n /** The trigger's ref (the development guard measures the rendered link).\n * next/link forwards it to its `<a>`. */\n ref?: Ref<HTMLAnchorElement> | undefined;\n}\n\nexport type TapTargetLinkComponent = ComponentType<TapTargetLinkProps>;\n\n/**\n * The registered component lives in a `Symbol.for` slot on `globalThis` — NOT\n * in module state — so it survives the module graph being instantiated more\n * than once: the `.` and `./buttons` dist bundles each inline the primitives\n * (tsup `splitting: false`), and a consumer may even mix `import` and\n * `require`. One registration must reach every copy.\n */\nconst LINK_SLOT = Symbol.for(\"@ai-matrx/tap-target:link-component\");\n\ntype GlobalWithLinkSlot = typeof globalThis & {\n [LINK_SLOT]?: TapTargetLinkComponent | null;\n};\n\n/**\n * Register the app's link component once at startup (e.g. `next/link`):\n *\n * ```tsx\n * import Link from \"next/link\";\n * import { setTapTargetLinkComponent } from \"@ai-matrx/tap-target\";\n * setTapTargetLinkComponent(Link);\n * ```\n *\n * Pass `null` to unregister (plain `<a>` fallback resumes).\n */\nexport function setTapTargetLinkComponent(\n component: TapTargetLinkComponent | null,\n): void {\n (globalThis as GlobalWithLinkSlot)[LINK_SLOT] = component;\n}\n\n/** The currently registered link component, or `null` when none is set. */\nexport function getTapTargetLinkComponent(): TapTargetLinkComponent | null {\n return (globalThis as GlobalWithLinkSlot)[LINK_SLOT] ?? null;\n}\n","\"use client\";\n\nimport { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from \"../tooltip\";\n\n/**\n * Wraps a TapTargetButton (or any tap control) like the button-demo page:\n * no extra padding on the control — only `gap-0.5` before the caption.\n * Tooltip shows the full `label`; the caption truncates at max-w-[52px].\n */\nexport function TapTargetLabeled({\n label,\n children,\n hideLabel = false,\n toolTipSide = \"bottom\",\n}: {\n label: string;\n children: React.ReactNode;\n hideLabel?: boolean | undefined;\n toolTipSide?: \"top\" | \"bottom\" | \"left\" | \"right\" | undefined;\n}) {\n return (\n <TooltipProvider delayDuration={200}>\n <Tooltip>\n <TooltipTrigger asChild>\n <div className=\"flex flex-col items-center p-0 gap-0 space-y-0 space-x-0 shrink-0\">\n {children}\n {!hideLabel && (\n <span className=\"text-[10px] text-muted-foreground/70 leading-tight max-w-[52px] text-center truncate\">\n {label}\n </span>\n )}\n </div>\n </TooltipTrigger>\n <TooltipContent side={toolTipSide}>\n <span className=\"font-mono text-xs max-w-[280px] break-all\">\n {label}\n </span>\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n","\"use client\";\n\n// TapTargetCopyButton — one press copies, and the button itself says so: the\n// glyph becomes a check (success tone) and the tooltip reads \"Copied\" for\n// 1.6s; a failure shows a destructive \"Copy failed\" instead of nothing.\n// Replaces the copy-then-flash logic screens used to hand-build.\n\nimport { forwardRef, useEffect, useRef, useState } from \"react\";\n\nimport {\n TapTargetButton,\n TapTargetButtonForGroup,\n TapTargetButtonOutline,\n TapTargetButtonTransparent,\n type TapTargetButtonProps,\n} from \"./tap-target-button\";\n\nexport interface TapTargetCopyButtonProps\n extends Omit<TapTargetButtonProps, \"onClick\" | \"icon\" | \"children\" | \"tone\" | \"loading\" | \"className\"> {\n /** What to copy — a string, or a function (sync or async) that produces it on press. */\n value: string | (() => string | Promise<string>);\n variant?: \"glass\" | \"transparent\" | \"outline\" | \"group\" | undefined;\n onCopied?: ((text: string) => void) | undefined;\n}\n\nconst COPY = (\n <>\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </>\n);\nconst CHECK = <path d=\"M20 6 9 17l-5-5\" />;\nconst FAIL = (\n <>\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </>\n);\n\nconst VARIANTS = {\n glass: TapTargetButton,\n transparent: TapTargetButtonTransparent,\n outline: TapTargetButtonOutline,\n group: TapTargetButtonForGroup,\n} as const;\n\nexport const TapTargetCopyButton = forwardRef<HTMLButtonElement, TapTargetCopyButtonProps>(\n function TapTargetCopyButton({ value, variant = \"glass\", onCopied, ariaLabel = \"Copy\", tooltip, ...rest }, ref) {\n const [state, setState] = useState<\"idle\" | \"copied\" | \"failed\">(\"idle\");\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n useEffect(() => () => {\n if (timer.current) clearTimeout(timer.current);\n }, []);\n\n const copy = async () => {\n try {\n const text = typeof value === \"function\" ? await value() : value;\n await navigator.clipboard.writeText(text);\n setState(\"copied\");\n onCopied?.(text);\n } catch {\n setState(\"failed\");\n }\n if (timer.current) clearTimeout(timer.current);\n timer.current = setTimeout(() => setState(\"idle\"), 1600);\n };\n\n const Button = VARIANTS[variant];\n return (\n <Button\n ref={ref}\n {...rest}\n ariaLabel={ariaLabel}\n tooltip={state === \"copied\" ? \"Copied\" : state === \"failed\" ? \"Copy failed\" : tooltip}\n tone={state === \"copied\" ? \"success\" : state === \"failed\" ? \"destructive\" : undefined}\n onClick={() => void copy()}\n >\n {state === \"copied\" ? CHECK : state === \"failed\" ? FAIL : COPY}\n </Button>\n );\n },\n);\n","\"use client\";\n\n// TapTargetSearchGroup — search anywhere, in the space of one group.\n//\n// The macOS toolbar search: a tap-button group carries a search button; tap it\n// and the group's other buttons give way to a search field in the SAME glass\n// capsule, focused and ready; Escape (or the close button) brings the buttons\n// back. With no other children it is a lone search button that opens into a\n// field. Origin: matrx-frontend's CSS-only SearchGroup (2026-03), rebuilt on\n// the tap geometry with real focus, keyboard and screen-reader behaviour.\n//\n// Behaviour, fixed (the opinions ARE the component):\n// • open → the field takes the group's place and focuses.\n// • Escape → clears a non-empty query; on an empty field, closes and\n// returns focus to the search button.\n// • close (×) → clears and closes.\n// • focus leaves with an EMPTY query → closes. A non-empty query stays open,\n// because a filter in effect must stay visible.\n// • Enter → onSubmit(query).\n\nimport {\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n} from \"react\";\n\nimport { TapTargetButtonForGroup } from \"./tap-target-button\";\n\nexport type TapTargetSearchShortcut = \"mod+k\" | \"mod+f\" | \"/\" | false;\n\nexport interface TapTargetSearchGroupProps {\n /** The group's other buttons (`TapTargetButtonForGroup` / `variant=\"group\"`). */\n children?: ReactNode;\n value?: string | undefined;\n defaultValue?: string | undefined;\n onValueChange?: ((value: string) => void) | undefined;\n onSubmit?: ((value: string) => void) | undefined;\n open?: boolean | undefined;\n defaultOpen?: boolean | undefined;\n onOpenChange?: ((open: boolean) => void) | undefined;\n /** Field placeholder and the search button's name. Default \"Search\". */\n placeholder?: string | undefined;\n /** Where the search button sits among the group's buttons. Default \"end\". */\n searchPosition?: \"start\" | \"end\" | undefined;\n /** Open width: \"fit\" (16rem, shrinking in a tight row) or \"fill\" (the row's free space). */\n width?: \"fit\" | \"fill\" | undefined;\n /** Keyboard shortcut that opens the field. Default none. */\n shortcut?: TapTargetSearchShortcut | undefined;\n}\n\nconst SHORTCUT_LABEL: Record<Exclude<TapTargetSearchShortcut, false>, string> = {\n \"mod+k\": \"⌘K\",\n \"mod+f\": \"⌘F\",\n \"/\": \"/\",\n};\n\nfunction isTyping(target: EventTarget | null): boolean {\n const el = target as HTMLElement | null;\n if (!el) return false;\n return el.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName);\n}\n\nconst SearchGlyph = (\n <>\n <circle cx=\"11\" cy=\"11\" r=\"8\" />\n <path d=\"m21 21-4.34-4.34\" />\n </>\n);\nconst CloseGlyph = (\n <>\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </>\n);\n\nexport function TapTargetSearchGroup({\n children,\n value: valueProp,\n defaultValue = \"\",\n onValueChange,\n onSubmit,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n placeholder = \"Search\",\n searchPosition = \"end\",\n width = \"fit\",\n shortcut = false,\n}: TapTargetSearchGroupProps) {\n const [ownValue, setOwnValue] = useState(defaultValue);\n const [ownOpen, setOwnOpen] = useState(defaultOpen);\n const value = valueProp ?? ownValue;\n const open = openProp ?? ownOpen;\n const fieldId = useId();\n const rootRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const measureRef = useRef<HTMLDivElement>(null);\n const [buttonsWidth, setButtonsWidth] = useState<number | null>(null);\n\n // The buttons' real width, so open/close animate between two measured\n // widths instead of a max-width guess (which stalls, then snaps).\n useLayoutEffect(() => {\n const el = measureRef.current;\n if (!el) return;\n const read = () => setButtonsWidth(el.offsetWidth);\n read();\n if (typeof ResizeObserver === \"undefined\") return;\n const ro = new ResizeObserver(read);\n ro.observe(el);\n return () => ro.disconnect();\n }, []);\n\n const setValue = useCallback(\n (next: string) => {\n if (valueProp === undefined) setOwnValue(next);\n onValueChange?.(next);\n },\n [valueProp, onValueChange],\n );\n const setOpen = useCallback(\n (next: boolean, returnFocus = false) => {\n if (openProp === undefined) setOwnOpen(next);\n onOpenChange?.(next);\n if (returnFocus) requestAnimationFrame(() => triggerRef.current?.focus());\n },\n [openProp, onOpenChange],\n );\n\n // Focus the field the moment it opens (click, shortcut or a controlled\n // prop) — in the layout phase, before the browser moves focus off the\n // now-inert search button, so that blur never reads as \"focus left\".\n useLayoutEffect(() => {\n if (open) inputRef.current?.focus();\n }, [open]);\n\n useEffect(() => {\n if (!shortcut) return;\n const onKey = (e: globalThis.KeyboardEvent) => {\n const mod = e.metaKey || e.ctrlKey;\n const hit =\n shortcut === \"/\"\n ? e.key === \"/\" && !mod && !isTyping(e.target)\n : mod && e.key.toLowerCase() === shortcut.slice(-1);\n if (!hit) return;\n e.preventDefault();\n setOpen(true);\n inputRef.current?.focus();\n };\n window.addEventListener(\"keydown\", onKey);\n return () => window.removeEventListener(\"keydown\", onKey);\n }, [shortcut, setOpen]);\n\n const onKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Escape\") {\n e.preventDefault();\n if (value) setValue(\"\");\n else setOpen(false, true);\n } else if (e.key === \"Enter\") {\n onSubmit?.(value);\n }\n };\n\n const label = shortcut ? `${placeholder} (${SHORTCUT_LABEL[shortcut]})` : placeholder;\n const trigger = (\n <TapTargetButtonForGroup\n ref={triggerRef}\n ariaLabel={label}\n aria-expanded={open}\n aria-controls={fieldId}\n onClick={() => setOpen(true)}\n >\n {SearchGlyph}\n </TapTargetButtonForGroup>\n );\n\n return (\n <div\n ref={rootRef}\n role=\"search\"\n className=\"matrx-tap-group matrx-tap-search\"\n data-open={open ? \"\" : undefined}\n data-width={width}\n onBlur={() => {\n // Decide after focus has settled: closing on an empty query only when\n // focus really left the group.\n setTimeout(() => {\n const root = rootRef.current;\n if (root && !root.contains(document.activeElement) && !inputRef.current?.value) setOpen(false);\n }, 0);\n }}\n >\n <div className=\"matrx-tap-group-capsule matrx-glass-thin-border\" />\n <div\n className=\"matrx-tap-group-row matrx-tap-search-buttons\"\n inert={open}\n style={\n buttonsWidth === null\n ? undefined\n : ({ \"--matrx-tap-search-buttons-w\": `${buttonsWidth}px` } as CSSProperties)\n }\n >\n <div ref={measureRef} className=\"matrx-tap-search-measure\">\n {searchPosition === \"start\" ? trigger : null}\n {children}\n {searchPosition === \"end\" ? trigger : null}\n </div>\n </div>\n <div className=\"matrx-tap-search-field\" id={fieldId} inert={!open}>\n <svg\n className=\"matrx-tap-search-glyph\"\n aria-hidden=\"true\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n {SearchGlyph}\n </svg>\n <input\n ref={inputRef}\n type=\"search\"\n className=\"matrx-tap-search-input\"\n value={value}\n placeholder={placeholder}\n aria-label={placeholder}\n autoComplete=\"off\"\n enterKeyHint=\"search\"\n onChange={(e) => setValue(e.target.value)}\n onKeyDown={onKeyDown}\n />\n <TapTargetButtonForGroup\n ariaLabel=\"Close search\"\n tooltip={false}\n onClick={() => {\n setValue(\"\");\n setOpen(false, true);\n }}\n >\n {CloseGlyph}\n </TapTargetButtonForGroup>\n </div>\n </div>\n );\n}\n"],"mappings":";;;AAyCA,YAAY,wBAAwB;AACpC,YAAY,WAAW;;;AC1CvB,SAAS,YAA6B;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAA8B;AAClD,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ACgCM,cAmCF,YAnCE;AAtBN,SAAS,YAAY,OAAsD;AACzE,SAAO;AAAA,IACL,OAAO;AAAA,IACP,SAAS;AAAA,IACT,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,eAAe;AAAA,IACf,GAAG;AAAA,EACL;AACF;AAOO,SAAS,YAAY,OAAkB;AAC5C,SACE,oBAAC,SAAK,GAAG,YAAY,KAAK,GACxB,8BAAC,UAAK,GAAE,+BAA8B,GACxC;AAEJ;AAGO,SAAS,gBAAgB,OAAkB;AAChD,SACE,oBAAC,SAAK,GAAG,YAAY,KAAK,GACxB,8BAAC,UAAK,GAAE,kBAAiB,GAC3B;AAEJ;AAGO,SAAS,iBAAiB,OAAkB;AACjD,SACE,oBAAC,SAAK,GAAG,YAAY,KAAK,GACxB,8BAAC,UAAK,GAAE,iBAAgB,GAC1B;AAEJ;AAGO,SAAS,gBAAgB,OAAkB;AAChD,SAC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ACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,QACJ,aAAa;AACf,SAAO,aAAa;AAAA,IAClB,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,eACE;AAAA,IACF,eAAe,kBAAkB,KAAK;AAAA,IACtC,gBAAgB,mBAAmB,KAAK;AAAA,IACxC;AAAA,IACA,WAAW;AAAA,EACb,CAAC;AACH,CAAC;AAEM,IAAM,uBAAuBH,aAGlC,SAASI,sBACT;AAAA,EACE;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,SAAO,aAAa;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG,aAAa,MAAM,SAAS,WAAW,cAAc,aAAa;AAAA,IACrE;AAAA,IACA,WAAW;AAAA,EACb,CAAC;AACH,CAAC;AAID,SAAS,aACP,MACA,SACA,WACA,cACA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,QAAQ,UAAU;AAAA,eACxC;AAAA;AAAA,QACF;AAAA,QACA,gBAAAA,OAAC,SAAI,WAAU,0BAAyB,IAAI,SAAS,OAAO,CAAC,MAC3D;AAAA,0BAAAD;AAAA,YAAC;AAAA;AAAA,cACC,WAAU;AAAA,cACV,eAAY;AAAA,cACZ,MAAK;AAAA,cACL,SAAQ;AAAA,cACR,QAAO;AAAA,cACP,aAAa;AAAA,cACb,eAAc;AAAA,cACd,gBAAe;AAAA,cAEd;AAAA;AAAA,UACH;AAAA,UACA,gBAAAA;AAAA,YAAC;AAAA;AAAA,cACC,KAAK;AAAA,cACL,MAAK;AAAA,cACL,WAAU;AAAA,cACV;AAAA,cACA;AAAA,cACA,cAAY;AAAA,cACZ,cAAa;AAAA,cACb,cAAa;AAAA,cACb,UAAU,CAAC,MAAM,SAAS,EAAE,OAAO,KAAK;AAAA,cACxC;AAAA;AAAA,UACF;AAAA,UACA,gBAAAA;AAAA,YAAC;AAAA;AAAA,cACC,WAAU;AAAA,cACV,SAAS;AAAA,cACT,SAAS,MAAM;AACb,yBAAS,EAAE;AACX,wBAAQ,OAAO,IAAI;AAAA,cACrB;AAAA,cAEC;AAAA;AAAA,UACH;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["jsx","jsxs","jsx","DrawerPrimitive","React","React","jsx","React","jsx","jsx","jsxs","jsx","jsxs","DrawerPrimitive","cva","React","React","jsx","jsxs","registry","ErrorBox","jsx","jsxs","cva","treeContainsComponent","React","Slot","cva","React","jsx","cva","Slot","React","jsx","CONTEXT_SLOT","contextRegistry","jsx","jsxs","treeContainsComponent","React","jsx","React","jsx","React","jsx","React","jsx","CollapsibleTrigger","CollapsibleContent","React","jsx","jsxs","jsx","jsxs","React","jsx","React","React","useCallback","useEffect","useState","Fragment","jsx","jsxs","React","jsx","jsxs","cva","React","jsx","jsxs","cva","useRef","useState","React","jsx","jsx","jsxs","useState","useRef","Icon","DialogPrimitive","VisuallyHidden","treeContainsComponent","React","jsx","jsxs","CONTEXT_SLOT","contextRegistry","DIALOG_DESKTOP_CLASSES","DIALOG_MOBILE_SHEET_CLASSES","DIALOG_MOBILE_SHEET_OVERRIDE","treeContainsComponent","React","jsx","jsxs","useCallback","useEffect","useRef","useState","jsx","jsxs","useState","useRef","useEffect","useCallback","result","React","jsx","jsxs","React","jsx","Label","useLayoutEffect","useMemo","useRef","useState","Fragment","jsx","jsxs","Icon","useMemo","useRef","useState","useLayoutEffect","React","jsx","React","jsx","jsxs","jsx","jsxs","jsx","React","jsx","jsxs","jsx","jsxs","React","jsx","Separator","treeContainsComponent","cva","React","jsx","jsxs","cva","treeContainsComponent","React","jsx","Fragment","jsx","jsxs","Slot","cva","React","React","GAP_PX","SURFACE_CLASS","visible","jsx","jsx","jsxs","open","Separator","Slot","cva","React","jsx","jsx","jsxs","AppRailItem","AppRailAvatar","React","Group","Separator","jsx","Group","Separator","jsx","jsxs","visible","React","jsx","jsxs","React","jsx","useState","jsx","jsxs","useState","Icon","React","jsx","React","jsx","React","jsx","jsxs","React","jsx","React","jsx","RadioGroup","React","jsx","jsxs","cva","React","jsx","cva","forwardRef","useCallback","useRef","cn","useCallback","useRef","useEffect","jsx","jsxs","useEffect","Fragment","jsx","jsxs","cn","useRef","useCallback","forwardRef","TapTargetButton","TapTargetButtonTransparent","TapTargetButtonOutline","TapTargetButtonSolid","TapTargetButtonDestructive","TapTargetButtonForGroup","jsx","jsxs","forwardRef","useEffect","useRef","useState","Fragment","jsx","jsxs","forwardRef","TapTargetCopyButton","useState","useRef","useEffect","Button","useCallback","useEffect","useLayoutEffect","useRef","useState","Fragment","jsx","jsxs","isTyping","useState","useRef","useLayoutEffect","useCallback","useEffect"]}
|