@ai-matrx/design-system 0.60.1 → 0.60.6
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 +41 -0
- package/dist/desktop-lint.mjs +218 -0
- package/dist/desktop.cjs +3565 -0
- package/dist/desktop.cjs.map +1 -0
- package/dist/desktop.css +234 -0
- package/dist/desktop.d.cts +484 -0
- package/dist/desktop.d.ts +484 -0
- package/dist/desktop.js +3533 -0
- package/dist/desktop.js.map +1 -0
- package/dist/index.d.cts +14 -876
- package/dist/index.d.ts +14 -876
- package/dist/organization-picker-mLqIcesx.d.cts +875 -0
- package/dist/organization-picker-mLqIcesx.d.ts +875 -0
- package/package.json +13 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/desktop/cn.ts","../src/desktop/text.tsx","../src/desktop/spinner.tsx","../src/desktop/button.tsx","../src/tooltip.tsx","../src/cn.ts","../src/motion.ts","../src/portal-container.tsx","../src/title-tooltips.ts","../src/desktop/field.tsx","../src/icons.tsx","../src/desktop/select.tsx","../src/select.tsx","../src/field-surface.ts","../src/desktop/segmented.tsx","../src/switch.tsx","../src/checkbox.tsx","../src/desktop/layout.tsx","../src/desktop/group.tsx","../src/desktop/code-block.tsx","../src/desktop/table.tsx","../src/alert-dialog.tsx","../src/button.tsx","../src/floating-layer.tsx","../src/confirm-dialog.tsx","../src/dropdown-menu.tsx","../src/menu-scroll-edges.tsx","../src/use-scroll-fade.ts","../src/submenu-focus.ts","../src/desktop/source-list.tsx","../src/desktop/state.tsx","../src/desktop/resource.tsx","../src/desktop/tag.tsx","../src/desktop/coming-soon.tsx","../src/desktop/meter.tsx","../src/desktop/format.ts","../src/context-menu.tsx","../src/dialog.tsx","../src/radix-dialog-modal-context.tsx","../src/use-is-mobile.ts","../src/layer-front.ts","../src/confirm-host.tsx","../src/popover.tsx","../src/collapsible.tsx","../src/skeleton.tsx","../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/organization-picker.tsx"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { extendTailwindMerge } from \"tailwind-merge\";\n\n/**\n * The desktop `cn`: tailwind-merge taught the desktop scale (desktop.css), so `text-body` is\n * known to be a font size (not a colour) and `h-control` a height. Without this, a caller's\n * `text-label-secondary` could silently delete a component's `text-body`.\n */\nconst merge = extendTailwindMerge({\n extend: {\n theme: {\n spacing: [\n \"control-sm\",\n \"control\",\n \"control-lg\",\n \"row-compact\",\n \"sidebar-row\",\n \"row\",\n \"row-tall\",\n \"toolbar\",\n \"icon-sm\",\n \"icon\",\n \"icon-lg\",\n \"icon-xl\",\n ],\n radius: [\"control\", \"group\", \"panel\"],\n container: [\"form\", \"page\", \"wide\"],\n text: [\"title-large\", \"title-1\", \"title-2\", \"title-3\", \"headline\", \"body\", \"callout\", \"caption\"],\n shadow: [\"control\", \"raised\", \"popover\"],\n },\n },\n});\n\nexport function cn(...inputs: ClassValue[]): string {\n return merge(clsx(inputs));\n}\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\n/** The macOS text styles. Nothing else sets a font size in desktop app code. */\nexport type TextVariant =\n | \"title-large\"\n | \"title-1\"\n | \"title-2\"\n | \"title-3\"\n | \"headline\"\n | \"body\"\n | \"callout\"\n | \"caption\";\n\n/** Emphasis levels and status tones. Status tones are for status words only, never decoration. */\nexport type TextTone = \"primary\" | \"secondary\" | \"tertiary\" | \"tint\" | \"danger\" | \"warning\" | \"success\";\n\nconst VARIANT: Record<TextVariant, string> = {\n \"title-large\": \"text-title-large\",\n \"title-1\": \"text-title-1\",\n \"title-2\": \"text-title-2\",\n \"title-3\": \"text-title-3\",\n headline: \"text-headline\",\n body: \"text-body\",\n callout: \"text-callout\",\n caption: \"text-caption\",\n};\n\nexport const TEXT_TONE: Record<TextTone, string> = {\n primary: \"text-label\",\n secondary: \"text-label-secondary\",\n tertiary: \"text-label-tertiary\",\n tint: \"text-tint\",\n danger: \"text-system-red\",\n warning: \"text-system-orange\",\n success: \"text-system-green\",\n};\n\nexport interface TextProps extends React.HTMLAttributes<HTMLElement> {\n variant?: TextVariant | undefined;\n tone?: TextTone | undefined;\n /** Medium weight for emphasis inside body copy (titles carry their own weight). */\n emphasized?: boolean | undefined;\n mono?: boolean | undefined;\n /** One line, ellipsis at the end. */\n truncate?: boolean | undefined;\n /** Numbers that line up in columns. */\n tabular?: boolean | undefined;\n /** Text the user may select and copy (desktop chrome is unselectable by default). */\n selectable?: boolean | undefined;\n as?: \"span\" | \"p\" | \"div\" | \"h1\" | \"h2\" | \"h3\" | \"label\" | \"dt\" | \"dd\";\n}\n\nexport const Text = React.forwardRef<HTMLElement, TextProps>(function Text(\n {\n variant = \"body\",\n tone = \"primary\",\n emphasized,\n mono,\n truncate,\n tabular,\n selectable,\n as: Tag = \"span\",\n className,\n ...props\n },\n ref,\n) {\n return (\n <Tag\n ref={ref as React.Ref<never>}\n data-slot=\"text\"\n className={cn(\n VARIANT[variant],\n TEXT_TONE[tone],\n emphasized && \"font-medium\",\n mono && \"font-mono\",\n truncate && \"min-w-0 truncate\",\n tabular && \"tabular-nums\",\n selectable && \"select-text\",\n className,\n )}\n {...props}\n />\n );\n});\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nconst SPOKES = Array.from({ length: 12 }, (_, i) => i);\n\nexport interface SpinnerProps extends React.SVGAttributes<SVGSVGElement> {\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\";\n /** Accessible name; omit when a visible label already says what is loading. */\n label?: string;\n}\n\nconst SIZE = { sm: \"size-icon-sm\", md: \"size-icon\", lg: \"size-icon-lg\", xl: \"size-icon-xl\" } as const;\n\n/** The macOS activity indicator: twelve fading spokes, stepped rotation. */\nexport function Spinner({ size = \"md\", label, className, ...props }: SpinnerProps) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n role={label ? \"status\" : undefined}\n aria-label={label}\n aria-hidden={label ? undefined : true}\n data-slot=\"spinner\"\n className={cn(\"mx-spinner shrink-0 text-label-secondary\", SIZE[size], className)}\n {...props}\n >\n {SPOKES.map((i) => (\n <rect\n key={i}\n x=\"11\"\n y=\"2\"\n width=\"2\"\n height=\"6\"\n rx=\"1\"\n fill=\"currentColor\"\n opacity={0.18 + (0.82 * (i + 1)) / 12}\n transform={`rotate(${i * 30} 12 12)`}\n />\n ))}\n </svg>\n );\n}\n","import { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../tooltip\";\nimport { cn } from \"./cn\";\nimport { Spinner } from \"./spinner\";\n\n/**\n * The macOS push button family.\n * - `primary`: the default action (the one blue button in a sheet or form). One per view.\n * - `secondary`: an ordinary push button (raised control surface, hairline edge).\n * - `plain`: borderless toolbar/inline button; shows a fill on hover.\n * - `destructive`: an action that removes or stops something.\n */\nexport const buttonVariants = cva(\n \"focus-ring inline-flex shrink-0 select-none items-center justify-center gap-1.5 whitespace-nowrap rounded-control font-medium transition-colors duration-100 disabled:pointer-events-none disabled:opacity-40 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n {\n variants: {\n variant: {\n primary:\n \"bg-tint text-tint-label shadow-control hover:brightness-110 active:brightness-95 disabled:bg-fill-secondary disabled:text-label-tertiary disabled:opacity-100 disabled:shadow-none\",\n secondary: \"bg-control text-label shadow-control hover:bg-fill-secondary active:bg-fill-tertiary\",\n plain: \"bg-transparent text-label hover:bg-fill-secondary active:bg-fill-tertiary\",\n destructive: \"bg-control text-system-red shadow-control hover:bg-fill-secondary active:bg-fill-tertiary\",\n },\n size: {\n sm: \"h-control-sm px-2 text-callout [&_svg]:size-icon-sm\",\n md: \"h-control px-3 text-body [&_svg]:size-icon\",\n lg: \"h-control-lg px-4 text-body [&_svg]:size-icon\",\n },\n },\n defaultVariants: { variant: \"secondary\", size: \"md\" },\n },\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n /** Leading icon (16 px; 14 px at `sm`). */\n icon?: React.ReactNode;\n /** Shows the activity indicator in place of the icon and disables the button. */\n busy?: boolean;\n asChild?: boolean;\n}\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n { variant, size, icon, busy, asChild, disabled, className, children, type = \"button\", ...props },\n ref,\n) {\n const Comp = asChild ? Slot : \"button\";\n return (\n <Comp\n ref={ref}\n type={asChild ? undefined : type}\n data-slot=\"button\"\n disabled={disabled || busy}\n aria-busy={busy || undefined}\n className={cn(buttonVariants({ variant, size }), className)}\n {...props}\n >\n {asChild ? (\n children\n ) : (\n <>\n {busy ? <Spinner size={size === \"sm\" ? \"sm\" : \"md\"} /> : icon}\n {children}\n </>\n )}\n </Comp>\n );\n});\n\nconst iconButtonVariants = cva(\n \"focus-ring inline-flex shrink-0 select-none items-center justify-center rounded-control text-label-secondary transition-colors duration-100 hover:bg-fill-secondary hover:text-label active:bg-fill-tertiary disabled:pointer-events-none disabled:opacity-40 data-[active=true]:bg-fill-secondary data-[active=true]:text-label [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n {\n variants: {\n size: {\n sm: \"size-control-sm [&_svg]:size-icon-sm\",\n md: \"size-control [&_svg]:size-icon\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n);\n\nexport interface IconButtonProps\n extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\" | \"aria-label\">,\n VariantProps<typeof iconButtonVariants> {\n icon: React.ReactNode;\n /** Required: the accessible name and the tooltip. An icon without a name is a guess. */\n label: string;\n /** Keyboard shortcut shown in the tooltip, e.g. \"⌘K\". */\n shortcut?: string;\n /** Pressed/on state for toggles (sidebar visibility, filters). */\n active?: boolean;\n}\n\nexport const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n { icon, label, shortcut, active, size, className, type = \"button\", ...props },\n ref,\n) {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n ref={ref}\n type={type}\n data-slot=\"icon-button\"\n aria-label={label}\n aria-pressed={active === undefined ? undefined : active}\n data-active={active || undefined}\n className={cn(iconButtonVariants({ size }), className)}\n {...props}\n >\n {icon}\n </button>\n </TooltipTrigger>\n <TooltipContent>\n {label}\n {shortcut ? <span className=\"ml-2 opacity-60\">{shortcut}</span> : null}\n </TooltipContent>\n </Tooltip>\n );\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","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 * 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","/**\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","import * as React from \"react\";\n\nimport { MagnifyingGlassIcon, XIcon } from \"../icons\";\nimport { cn } from \"./cn\";\n\n/** The text field surface: inset well, hairline edge, tint halo on focus. */\nexport const FIELD =\n \"focus-ring w-full min-w-0 rounded-control bg-control text-body text-label shadow-control placeholder:text-label-tertiary disabled:opacity-40 read-only:bg-fill\";\n\nexport interface TextFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\"> {\n size?: \"sm\" | \"md\";\n invalid?: boolean;\n}\n\nexport const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(function TextField(\n { size = \"md\", invalid, className, ...props },\n ref,\n) {\n return (\n <input\n ref={ref}\n data-slot=\"text-field\"\n aria-invalid={invalid || undefined}\n className={cn(\n FIELD,\n \"select-text px-2\",\n size === \"sm\" ? \"h-control-sm text-callout\" : \"h-control\",\n invalid && \"outline outline-2 outline-system-red/60\",\n className,\n )}\n {...props}\n />\n );\n});\n\nexport interface TextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {\n invalid?: boolean;\n}\n\nexport const TextArea = React.forwardRef<HTMLTextAreaElement, TextAreaProps>(function TextArea(\n { invalid, className, rows = 4, ...props },\n ref,\n) {\n return (\n <textarea\n ref={ref}\n rows={rows}\n data-slot=\"text-area\"\n aria-invalid={invalid || undefined}\n className={cn(FIELD, \"select-text resize-none px-2 py-1.5\", invalid && \"outline outline-2 outline-system-red/60\", className)}\n {...props}\n />\n );\n});\n\nexport interface SearchFieldProps\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\" | \"value\" | \"onChange\" | \"type\"> {\n value: string;\n onValueChange: (value: string) => void;\n size?: \"sm\" | \"md\";\n}\n\n/** The rounded search field: magnifier, clear button when non-empty, Escape clears. */\nexport const SearchField = React.forwardRef<HTMLInputElement, SearchFieldProps>(function SearchField(\n { value, onValueChange, size = \"md\", placeholder = \"Search\", className, onKeyDown, ...props },\n ref,\n) {\n return (\n <div\n data-slot=\"search-field\"\n className={cn(\"relative flex items-center\", size === \"sm\" ? \"h-control-sm\" : \"h-control\", className)}\n >\n <MagnifyingGlassIcon className=\"pointer-events-none absolute left-2 size-icon-sm text-label-tertiary\" />\n <input\n ref={ref}\n type=\"search\"\n value={value}\n placeholder={placeholder}\n onChange={(event) => onValueChange(event.target.value)}\n onKeyDown={(event) => {\n if (event.key === \"Escape\" && value) {\n event.preventDefault();\n onValueChange(\"\");\n }\n onKeyDown?.(event);\n }}\n className={cn(\n FIELD,\n \"h-full select-text bg-fill pl-7 pr-7 shadow-none [&::-webkit-search-cancel-button]:hidden\",\n size === \"sm\" && \"text-callout\",\n )}\n {...props}\n />\n {value ? (\n <button\n type=\"button\"\n aria-label=\"Clear search\"\n onClick={() => onValueChange(\"\")}\n className=\"focus-ring absolute right-1.5 flex size-icon items-center justify-center rounded-full bg-label-tertiary text-content hover:bg-label-secondary\"\n >\n <XIcon className=\"size-2.5\" strokeWidth={3} />\n </button>\n ) : null}\n </div>\n );\n});\n","/**\n * Internal inlined SVG icons (policy C19: no icon-library dependency, ever).\n *\n * Each icon is copied from the exact glyph the ported originals rendered:\n * lucide-react's Loader2 / ChevronLeft / ChevronRight / MoreHorizontal and\n * @radix-ui/react-icons' Cross2Icon. Same viewBoxes, same paths, same default\n * stroke geometry — a host swapping the import sees pixel-identical output.\n *\n * Not exported from the package entry; components consume them directly.\n */\n\nimport * as React from \"react\";\n\ntype IconProps = React.SVGAttributes<SVGSVGElement>;\n\nfunction lucideProps(props: IconProps): React.SVGAttributes<SVGSVGElement> {\n return {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: 2,\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n \"aria-hidden\": true,\n ...props,\n };\n}\n\n/**\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 * as SelectPrimitive from \"@radix-ui/react-select\";\nimport * as React from \"react\";\n\nimport { ChevronsUpDownIcon } from \"../icons\";\nimport { SelectContent, SelectItem, SelectSeparator } from \"../select\";\nimport { cn } from \"./cn\";\n\nexport interface SelectOption {\n value: string;\n label: React.ReactNode;\n disabled?: boolean;\n}\n\nexport interface SelectProps {\n value: string | undefined;\n onValueChange: (value: string) => void;\n /** Options; `\"-\"` draws a separator. */\n options: ReadonlyArray<SelectOption | \"-\">;\n placeholder?: string;\n size?: \"sm\" | \"md\";\n disabled?: boolean;\n /** Accessible name when no visible label is associated. */\n \"aria-label\"?: string;\n id?: string;\n className?: string;\n /** `data-*` hooks land on the trigger. */\n [data: `data-${string}`]: string | undefined;\n}\n\n/** The macOS pop-up button: a raised control with the up/down chevron, menu of options. */\nexport function Select({\n value,\n onValueChange,\n options,\n placeholder,\n size = \"md\",\n disabled,\n id,\n className,\n \"aria-label\": ariaLabel,\n ...data\n}: SelectProps) {\n return (\n <SelectPrimitive.Root {...(value === undefined ? {} : { value })} onValueChange={onValueChange} disabled={disabled ?? false}>\n <SelectPrimitive.Trigger\n {...data}\n id={id}\n aria-label={ariaLabel}\n data-slot=\"select\"\n className={cn(\n \"focus-ring inline-flex min-w-0 items-center justify-between gap-2 rounded-control bg-control pl-2.5 pr-1.5 text-label shadow-control hover:bg-fill-secondary disabled:opacity-40 data-[placeholder]:text-label-tertiary\",\n size === \"sm\" ? \"h-control-sm text-callout\" : \"h-control text-body\",\n className,\n )}\n >\n <span className=\"min-w-0 truncate\">\n <SelectPrimitive.Value placeholder={placeholder} />\n </span>\n <SelectPrimitive.Icon asChild>\n <ChevronsUpDownIcon className=\"size-icon-sm shrink-0 text-label-secondary\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n <SelectContent>\n {options.map((option, index) =>\n option === \"-\" ? (\n <SelectSeparator key={`sep-${index}`} />\n ) : (\n <SelectItem key={option.value} value={option.value} disabled={option.disabled ?? false}>\n {option.label}\n </SelectItem>\n ),\n )}\n </SelectContent>\n </SelectPrimitive.Root>\n );\n}\n","\"use client\";\n\n/**\n * Select — ported verbatim from matrx-frontend `components/ui/select.tsx`.\n *\n * Seam inversions:\n * - The host's `useNestedPortalContainer` (dialog/popout aware) becomes the\n * injected `PortalContainerProvider` seam (`portal-container.tsx`); the\n * explicit `container` prop keeps top priority, exactly as before.\n * - `ChevronDownIcon` / `ChevronUpIcon` / `CheckIcon` come from the package's\n * inlined SVGs (C19), not @radix-ui/react-icons — same glyphs, same\n * viewBoxes. (The origin also imported `CaretSortIcon` without ever using\n * it; the dead import is not carried along.)\n *\n * THE ROOT RENDERS UNCONDITIONALLY — no mount gate. This wrapper used to defer\n * rendering until after hydration (\"Radix generates dynamic aria-controls ids\n * that differ between SSR and client\"), and that justification was false:\n * Radix ids come from React's SSR-stable `useId` (verified against\n * @radix-ui/react-select 2.3.1 / react-id 1.1.2). The gate was actively\n * harmful — it deleted the ALWAYS-VISIBLE select trigger (a form control)\n * from SSR and the first client paint.\n */\n\nimport * as SelectPrimitive from \"@radix-ui/react-select\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { MOTION_POPPER, POPPER_OFFSET } from \"./motion\";\nimport {\n CheckIcon,\n RadixChevronDownIcon,\n RadixChevronUpIcon,\n} from \"./icons\";\nimport { usePortalContainer } from \"./portal-container\";\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 select-none rounded-sm py-1 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground 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","import * as ToggleGroup from \"@radix-ui/react-toggle-group\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport interface Segment<T extends string> {\n value: T;\n label: React.ReactNode;\n /** Required when `label` is an icon. */\n ariaLabel?: string;\n disabled?: boolean;\n}\n\nexport interface SegmentedProps<T extends string> {\n value: T;\n onValueChange: (value: T) => void;\n segments: ReadonlyArray<Segment<T>>;\n size?: \"sm\" | \"md\";\n \"aria-label\": string;\n className?: string;\n [data: `data-${string}`]: string | undefined;\n}\n\n/** The macOS segmented control: one choice of a few (≤ 5), arrow keys move between segments. */\nexport function Segmented<T extends string>({\n value,\n onValueChange,\n segments,\n size = \"md\",\n className,\n \"aria-label\": ariaLabel,\n ...data\n}: SegmentedProps<T>) {\n return (\n <ToggleGroup.Root\n {...data}\n type=\"single\"\n value={value}\n aria-label={ariaLabel}\n onValueChange={(next) => {\n if (next) onValueChange(next as T);\n }}\n data-slot=\"segmented\"\n className={cn(\n \"inline-flex items-stretch gap-0.5 rounded-control bg-fill-secondary p-0.5\",\n size === \"sm\" ? \"h-control-sm text-callout\" : \"h-control text-body\",\n className,\n )}\n >\n {segments.map((segment) => (\n <ToggleGroup.Item\n key={segment.value}\n value={segment.value}\n aria-label={segment.ariaLabel}\n disabled={segment.disabled}\n className=\"focus-ring inline-flex min-w-0 flex-1 items-center justify-center gap-1 rounded-control px-2.5 text-label-secondary transition-colors duration-100 hover:text-label disabled:opacity-40 data-[state=on]:bg-control data-[state=on]:text-label data-[state=on]:shadow-control [&_svg]:size-icon-sm\"\n >\n {segment.label}\n </ToggleGroup.Item>\n ))}\n </ToggleGroup.Root>\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 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 * 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 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","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { Text } from \"./text\";\n\nexport type PageWidth = \"form\" | \"wide\" | \"full\";\n\nconst WIDTH: Record<PageWidth, string> = {\n form: \"max-w-form\",\n wide: \"max-w-wide\",\n full: \"max-w-none\",\n};\n\nexport interface PageProps extends React.HTMLAttributes<HTMLDivElement> {\n /** `wide` (default) for every screen that lists things — tables, devices, displays, windows;\n * `form` for settings and one thing's facts (the body narrows, the left edge and header stay);\n * `full` only for a canvas-like screen. */\n width?: PageWidth;\n /** The page header; drawn at the top of the scrolling column. */\n header?: React.ReactNode;\n}\n\n/**\n * One scrolling content page: fixed side gutters, a centred column of the chosen width, and the\n * same vertical rhythm on every screen (24 px between sections).\n */\nexport const Page = React.forwardRef<HTMLDivElement, PageProps>(function Page(\n { width = \"wide\", header, className, children, ...props },\n ref,\n) {\n return (\n <div ref={ref} data-slot=\"page\" className={cn(\"h-full overflow-y-auto bg-content\", className)} {...props}>\n {/* Every page shares one left edge and one header line (the wide column); a form page only\n narrows its body, so switching screens never moves the title or the first control. */}\n <div className={cn(\"mx-auto flex w-full flex-col gap-6 px-8 pb-10 pt-6\", width === \"full\" ? WIDTH.full : WIDTH.wide)}>\n {header}\n {width === \"form\" ? <div className={cn(\"flex w-full flex-col gap-6\", WIDTH.form)}>{children}</div> : children}\n </div>\n </div>\n );\n});\n\nexport interface PageHeaderProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n title: React.ReactNode;\n /** One short line under the title (a status or a count; never a paragraph). */\n subtitle?: React.ReactNode;\n /** Leading icon or symbol (32 px). */\n icon?: React.ReactNode;\n /** Trailing controls: buttons, a search field. */\n actions?: React.ReactNode;\n}\n\nexport function PageHeader({ title, subtitle, icon, actions, className, ...props }: PageHeaderProps) {\n return (\n <header data-slot=\"page-header\" className={cn(\"flex min-h-control-lg items-center gap-3\", className)} {...props}>\n {icon ? (\n <span className=\"flex size-icon-xl shrink-0 items-center justify-center text-label-secondary [&_svg]:size-icon-lg\">\n {icon}\n </span>\n ) : null}\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <Text as=\"h1\" variant=\"title-2\" truncate>\n {title}\n </Text>\n {/* The subtitle line is always reserved: every header is the same height, so the first\n section starts at the same place on every screen. */}\n <Text variant=\"callout\" tone=\"secondary\" truncate aria-hidden={subtitle ? undefined : true}>\n {subtitle ?? \"\\u00a0\"}\n </Text>\n </div>\n {actions ? <div className=\"flex shrink-0 items-center gap-2\">{actions}</div> : null}\n </header>\n );\n}\n\nexport interface ToolbarProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The toolbar drags the window (title bar / unified toolbar). Controls inside never drag. */\n draggable?: boolean;\n}\n\n/** A unified-toolbar row: 52 px, controls 28 px, 8 px apart. */\nexport function Toolbar({ draggable, className, ...props }: ToolbarProps) {\n return (\n <div\n role=\"toolbar\"\n data-slot=\"toolbar\"\n className={cn(\n \"flex h-toolbar shrink-0 items-center gap-2 px-3 [&_button]:window-no-drag [&_input]:window-no-drag\",\n draggable && \"window-drag\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** Pushes the following toolbar items to the trailing edge. */\nexport function ToolbarSpacer() {\n return <div aria-hidden className=\"flex-1\" />;\n}\n\n/** A thin vertical rule between toolbar groups. */\nexport function ToolbarDivider() {\n return <div aria-hidden className=\"mx-1 h-icon w-px bg-separator\" />;\n}\n","import * as React from \"react\";\n\nimport { ChevronRightIcon } from \"../icons\";\nimport { cn } from \"./cn\";\nimport { Text } from \"./text\";\n\nexport interface SectionProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** Section title above the group (headline). */\n title?: React.ReactNode;\n /** Controls on the title line (a button, a count). */\n actions?: React.ReactNode;\n /** Explanatory line below the group (caption, secondary). */\n footer?: React.ReactNode;\n /** `grouped` (default) draws the inset rounded box with hairlines between rows (System\n * Settings). `plain` draws the rows straight on the page. */\n appearance?: \"grouped\" | \"plain\";\n}\n\n/**\n * A titled group of rows. Children are `Row`s (or `SectionContent` for free content); the\n * hairline between rows is drawn here, inset to where the text starts, so no screen draws its own.\n */\nexport function Section({ title, actions, footer, appearance = \"grouped\", className, children, ...props }: SectionProps) {\n return (\n <section data-slot=\"section\" className={cn(\"flex flex-col gap-2\", appearance === \"grouped\" && \"max-w-form\", className)} {...props}>\n {title || actions ? (\n <div className=\"flex min-h-control items-end gap-2\">\n {title ? (\n <Text as=\"h2\" variant=\"headline\" className=\"flex-1\" truncate>\n {title}\n </Text>\n ) : (\n <span className=\"flex-1\" />\n )}\n {actions ? <div className=\"flex items-center gap-2\">{actions}</div> : null}\n </div>\n ) : null}\n <div\n data-appearance={appearance}\n className={cn(\n \"flex flex-col [&>[data-slot=row]+[data-slot=row]]:before:block\",\n appearance === \"grouped\" && \"max-w-form overflow-hidden rounded-group bg-group shadow-raised\",\n )}\n >\n {children}\n </div>\n {footer ? (\n <Text as=\"p\" variant=\"caption\" tone=\"secondary\">\n {footer}\n </Text>\n ) : null}\n </section>\n );\n}\n\n/** Free content inside a Section's group (a chart, a code block), with the group's padding. */\nexport function SectionContent({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return <div data-slot=\"row\" className={cn(\"relative px-3 py-3\", className)} {...props} />;\n}\n\nexport interface RowProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\" | \"onSelect\"> {\n /** Leading icon (16 px) or a small image. */\n icon?: React.ReactNode;\n title: React.ReactNode;\n /** Second line under the title; makes the row tall. */\n subtitle?: React.ReactNode;\n /** Trailing value text (secondary), e.g. \"16 GB\". */\n value?: React.ReactNode;\n /** Trailing control (a Switch, a Button, a Tag). Clicks inside it never select the row. */\n accessory?: React.ReactNode;\n /** Shows the disclosure chevron: the row opens a deeper page. */\n chevron?: boolean;\n /** Makes the whole row a button. */\n onSelect?: () => void;\n selected?: boolean;\n disabled?: boolean;\n destructive?: boolean;\n /** Monospace title (paths, commands, identifiers). */\n mono?: boolean;\n}\n\n/**\n * THE row. Leading icon · title / subtitle · value · accessory · chevron. 36 px single line,\n * 48 px with a subtitle. Selectable rows are buttons with the tint focus ring.\n */\nexport const Row = React.forwardRef<HTMLElement, RowProps>(function Row(\n { icon, title, subtitle, value, accessory, chevron, onSelect, selected, disabled, destructive, mono, className, style, ...props },\n ref,\n) {\n const interactive = Boolean(onSelect) && !disabled;\n const body = (\n <>\n {icon ? (\n <span className=\"flex size-icon-lg shrink-0 items-center justify-center text-label-secondary [&_svg]:size-icon\">\n {icon}\n </span>\n ) : null}\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <Text tone={destructive ? \"danger\" : \"primary\"} mono={mono} truncate className={cn(selected && \"text-inherit\")}>\n {title}\n </Text>\n {subtitle ? (\n <Text variant=\"callout\" tone=\"secondary\" truncate className={cn(selected && \"text-inherit opacity-80\")}>\n {subtitle}\n </Text>\n ) : null}\n </span>\n {value !== undefined && value !== null ? (\n <Text tone=\"secondary\" tabular truncate className={cn(\"max-w-1/2 shrink-0 text-right\", selected && \"text-inherit opacity-80\")}>\n {value}\n </Text>\n ) : null}\n {accessory ? (\n <span\n className=\"flex shrink-0 items-center gap-2\"\n onClick={(event) => event.stopPropagation()}\n onKeyDown={(event) => event.stopPropagation()}\n >\n {accessory}\n </span>\n ) : null}\n {chevron ? <ChevronRightIcon aria-hidden className=\"size-icon-sm shrink-0 text-label-tertiary\" /> : null}\n </>\n );\n // The hairline above this row (shown by Section between rows), inset to where the text starts.\n const rowClass = cn(\n \"relative flex w-full items-center gap-3 px-3 text-left before:absolute before:right-0 before:top-0 before:hidden before:h-px before:bg-separator\",\n icon ? \"before:left-11\" : \"before:left-3\",\n subtitle ? \"min-h-row-tall py-1.5\" : \"min-h-row py-1\",\n disabled && \"opacity-40\",\n selected && \"bg-selection text-selection-label\",\n className,\n );\n if (interactive) {\n return (\n <button\n ref={ref as React.Ref<HTMLButtonElement>}\n type=\"button\"\n data-slot=\"row\"\n aria-current={selected || undefined}\n onClick={onSelect}\n style={style}\n className={cn(rowClass, \"focus-ring -outline-offset-3 transition-colors duration-100\", !selected && \"hover:bg-fill active:bg-fill-secondary\")}\n {...(props as React.ButtonHTMLAttributes<HTMLButtonElement>)}\n >\n {body}\n </button>\n );\n }\n return (\n <div ref={ref as React.Ref<HTMLDivElement>} data-slot=\"row\" style={style} className={rowClass} {...props}>\n {body}\n </div>\n );\n});\n\nexport interface FieldRowProps extends Omit<React.FormHTMLAttributes<HTMLFormElement>, \"onSubmit\" | \"action\"> {\n /** Label before the field (omit when the Section title already says it). */\n label?: React.ReactNode;\n /** The input: TextField, SearchField or Select. */\n field: React.ReactNode;\n /** The action that uses it (a Button; `type=\"submit\"` makes Enter run it). */\n action?: React.ReactNode;\n /** Runs on Enter / the submit button. */\n onSubmit?: () => void;\n /** A multi-line field (TextArea): the action sits under it, at the trailing edge. */\n stacked?: boolean;\n}\n\n/**\n * THE input-plus-action row (a command to start, a link to open, a path to transcribe): one row in\n * a Section, the field filling the space, the action at the trailing edge. Enter submits.\n */\nexport function FieldRow({ label, field, action, onSubmit, stacked, className, ...props }: FieldRowProps) {\n return (\n <form\n data-slot=\"row\"\n noValidate\n onSubmit={(event) => {\n event.preventDefault();\n onSubmit?.();\n }}\n className={cn(\n \"relative flex min-h-row w-full gap-3 px-3 py-1.5 before:absolute before:left-3 before:right-0 before:top-0 before:hidden before:h-px before:bg-separator\",\n stacked ? \"flex-col py-3\" : \"items-center\",\n className,\n )}\n {...props}\n >\n {label ? (\n <Text variant=\"body\" className=\"w-32 shrink-0\" truncate>\n {label}\n </Text>\n ) : null}\n <div className=\"min-w-0 flex-1\">{field}</div>\n {action ? <div className={cn(\"flex shrink-0 items-center gap-2\", stacked && \"self-end\")}>{action}</div> : null}\n </form>\n );\n}\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport interface CodeBlockProps extends React.HTMLAttributes<HTMLPreElement> {\n /** Cap the height and scroll inside (long output, clipboard text, logs). */\n scroll?: boolean;\n /** Keep the newest line in view as text arrives (live output), unless the person scrolled up. */\n follow?: boolean;\n}\n\n/** Preformatted, selectable monospace text: command output, file contents, the clipboard. */\nexport function CodeBlock({ scroll = true, follow = false, className, children, ...props }: CodeBlockProps) {\n const ref = React.useRef<HTMLPreElement>(null);\n const pinned = React.useRef(true);\n React.useLayoutEffect(() => {\n const el = ref.current;\n if (follow && el && pinned.current) el.scrollTop = el.scrollHeight;\n }, [follow, children]);\n return (\n <pre\n ref={ref}\n onScroll={(event) => {\n const el = event.currentTarget;\n pinned.current = el.scrollHeight - el.scrollTop - el.clientHeight < 8;\n }}\n data-slot=\"code-block\"\n className={cn(\n \"m-0 select-text whitespace-pre-wrap break-words rounded-control bg-fill px-3 py-2 font-mono text-callout text-label\",\n scroll && \"max-h-80 overflow-y-auto\",\n className,\n )}\n {...props}\n >\n {children}\n </pre>\n );\n}\n","import * as React from \"react\";\n\nimport { ConfirmDialog } from \"../confirm-dialog\";\nimport { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from \"../dropdown-menu\";\nimport { ChevronDownIcon, ChevronRightIcon, MoreHorizontalIcon } from \"../icons\";\nimport { Button, IconButton } from \"./button\";\nimport { cn } from \"./cn\";\n\nexport interface Column<T> {\n key: string;\n header: React.ReactNode;\n /** Cell content. Strings truncate with an ellipsis. */\n cell: (row: T) => React.ReactNode;\n /** Column width: `auto` shares the remaining space (default); `fit` shrinks to its content;\n * the named widths are fixed. */\n width?: \"auto\" | \"fit\" | \"xs\" | \"sm\" | \"md\" | \"lg\";\n align?: \"start\" | \"end\" | \"center\";\n /** Numbers: right-aligned, tabular figures. */\n numeric?: boolean;\n mono?: boolean;\n /** Makes the header sortable (click, or Enter on it); returns the ascending order. */\n sort?: (a: T, b: T) => number;\n}\n\n/** The ONE action a row may show inline: always a small secondary button, never destructive. */\nexport interface RowAction {\n label: string;\n onSelect: () => void;\n disabled?: boolean;\n}\n\n/** Everything else a row can do, behind its More button. Destructive items are drawn in red and\n * ask for confirmation in their own words. */\nexport interface RowMenuItem {\n label: string;\n onSelect: () => void;\n /** Drawn in red; with `confirm`, asks first (\"Stop node (pid 96209)?\"). */\n destructive?: boolean;\n /** The confirmation question for a destructive item. */\n confirm?: string;\n disabled?: boolean;\n}\n\nexport interface SortState {\n key: string;\n direction: \"ascending\" | \"descending\";\n}\n\nconst WIDTH = { auto: \"\", fit: \"w-px whitespace-nowrap\", xs: \"w-16\", sm: \"w-24\", md: \"w-36\", lg: \"w-56\" } as const;\nconst ALIGN = { start: \"text-left\", end: \"text-right\", center: \"text-center\" } as const;\n\nconst CONTROL_TAGS = new Set([\"BUTTON\", \"A\", \"INPUT\", \"SELECT\", \"TEXTAREA\"]);\n\n/** True when the click landed on a control (or a menu item portalled from one) inside the row. */\nfunction insideControl(target: HTMLElement, row: HTMLElement): boolean {\n for (let el: HTMLElement | null = target; el && el !== row; el = el.parentElement) {\n if (CONTROL_TAGS.has(el.tagName) || el.getAttribute(\"role\") === \"menuitem\") return true;\n }\n return false;\n}\n\nexport interface DataTableProps<T> extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\" | \"aria-label\"> {\n columns: ReadonlyArray<Column<T>>;\n rows: ReadonlyArray<T>;\n rowKey: (row: T) => string;\n /** Row activation (click / Enter). */\n onRowSelect?: (row: T) => void;\n selectedKey?: string | null;\n /** Shown in place of the body when there are no rows (use `StateView`). */\n empty?: React.ReactNode;\n /** Accessible name. */\n \"aria-label\": string;\n /** Alternating row backgrounds (macOS table default). */\n striped?: boolean;\n /** An outline row: content shown under the row when it is expanded (disclosure triangle,\n * click or Right/Left arrow). Return null for a row with nothing to show. */\n detail?: (row: T) => React.ReactNode | null;\n /** Rows that cannot be selected or expanded (drawn dimmed). */\n isDisabled?: (row: T) => boolean;\n /** The row's one inline action (e.g. Open, Show, Capture). */\n rowAction?: (row: T) => RowAction | null;\n /** The row's other actions (Edit, Remove, Stop), behind a More button. */\n rowMenu?: (row: T) => ReadonlyArray<RowMenuItem> | null;\n /** Initial sort (a sortable column's key). The person can change it by clicking headers. */\n defaultSort?: SortState;\n /** `data-*` attributes for a row (test hooks, state markers). */\n rowData?: (row: T) => Record<`data-${string}`, string | undefined>;\n className?: string;\n}\n\n/**\n * The macOS table: 24 px rows, caption-weight headers, hairline under the header, optional\n * alternating rows, tint selection. Arrow keys move between rows when rows are selectable.\n */\nexport function DataTable<T>({\n columns,\n rows,\n rowKey,\n onRowSelect,\n selectedKey,\n empty,\n striped = true,\n detail,\n isDisabled,\n rowAction,\n rowMenu,\n defaultSort,\n rowData,\n className,\n \"aria-label\": ariaLabel,\n ...rest\n}: DataTableProps<T>) {\n const bodyRef = React.useRef<HTMLTableSectionElement>(null);\n const [expanded, setExpanded] = React.useState<ReadonlySet<string>>(() => new Set());\n const toggle = (key: string, open?: boolean) =>\n setExpanded((prev) => {\n const next = new Set(prev);\n if (open ?? !next.has(key)) next.add(key);\n else next.delete(key);\n return next;\n });\n const [sort, setSort] = React.useState<SortState | null>(defaultSort ?? null);\n const sortColumn = sort ? columns.find((c) => c.key === sort.key && c.sort) : undefined;\n const ordered = React.useMemo(() => {\n if (!sort || !sortColumn?.sort) return rows;\n const by = sortColumn.sort;\n const sign = sort.direction === \"ascending\" ? 1 : -1;\n return [...rows].sort((a, b) => sign * by(a, b));\n }, [rows, sort, sortColumn]);\n const toggleSort = (key: string) =>\n setSort((prev) => (prev?.key === key ? { key, direction: prev.direction === \"ascending\" ? \"descending\" : \"ascending\" } : { key, direction: \"descending\" }));\n const hasActions = Boolean(rowAction || rowMenu);\n const span = columns.length + (detail ? 1 : 0) + (hasActions ? 1 : 0);\n const moveFocus = (event: React.KeyboardEvent<HTMLTableRowElement>, delta: number) => {\n const rowsEls = Array.from(bodyRef.current?.rows ?? []).filter((tr) => tr.tabIndex >= 0);\n const next = rowsEls[rowsEls.indexOf(event.currentTarget) + delta];\n if (next) {\n event.preventDefault();\n next.focus();\n }\n };\n return (\n <div data-slot=\"data-table\" className={cn(\"overflow-hidden rounded-group bg-content shadow-raised\", className)} {...rest}>\n <table aria-label={ariaLabel} className=\"w-full table-auto border-collapse text-body\">\n <thead>\n <tr className=\"h-row-compact border-b border-separator\">\n {detail ? <th aria-hidden className=\"w-6\" /> : null}\n {columns.map((column) => {\n const sorted = sort?.key === column.key ? sort.direction : undefined;\n return (\n <th\n key={column.key}\n scope=\"col\"\n aria-sort={column.sort ? (sorted ?? \"none\") : undefined}\n className={cn(\n \"px-3 text-caption font-medium text-label-secondary\",\n WIDTH[column.width ?? \"auto\"],\n ALIGN[column.align ?? (column.numeric ? \"end\" : \"start\")],\n )}\n >\n {column.sort ? (\n <button\n type=\"button\"\n onClick={() => toggleSort(column.key)}\n className={cn(\n \"focus-ring inline-flex items-center gap-1 rounded-control hover:text-label\",\n sorted && \"text-label\",\n (column.align ?? (column.numeric ? \"end\" : \"start\")) === \"end\" && \"flex-row-reverse\",\n )}\n >\n {column.header}\n <ChevronDownIcon\n aria-hidden\n className={cn(\"size-2.5 transition-transform duration-100\", !sorted && \"invisible\", sorted === \"ascending\" && \"rotate-180\")}\n />\n </button>\n ) : (\n column.header\n )}\n </th>\n );\n })}\n {hasActions ? <th aria-label=\"Actions\" className=\"w-px\" /> : null}\n </tr>\n </thead>\n {rows.length === 0 && empty ? (\n <tbody>\n <tr>\n <td colSpan={span}>{empty}</td>\n </tr>\n </tbody>\n ) : (\n <tbody ref={bodyRef}>\n {ordered.map((row, index) => {\n const key = rowKey(row);\n const selected = selectedKey === key;\n const disabled = isDisabled?.(row) ?? false;\n const content = detail && !disabled ? detail(row) : null;\n const open = content !== null && expanded.has(key);\n const activate = onRowSelect ? () => onRowSelect(row) : content !== null ? () => toggle(key) : undefined;\n const focusable = Boolean(activate) && !disabled;\n return (\n <React.Fragment key={key}>\n <tr\n {...rowData?.(row)}\n tabIndex={focusable ? 0 : undefined}\n aria-selected={onRowSelect ? selected : undefined}\n aria-expanded={content !== null ? open : undefined}\n aria-disabled={disabled || undefined}\n data-row-key={key}\n onClick={\n focusable\n ? (event) => {\n // A control inside a cell (Stop, a menu, a link) acts alone; it never\n // also selects or expands the row.\n if (insideControl(event.target as HTMLElement, event.currentTarget)) return;\n activate?.();\n }\n : undefined\n }\n onKeyDown={\n focusable\n ? (event) => {\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n activate?.();\n } else if (event.key === \"ArrowDown\") moveFocus(event, 1);\n else if (event.key === \"ArrowUp\") moveFocus(event, -1);\n else if (event.key === \"ArrowRight\" && content !== null) toggle(key, true);\n else if (event.key === \"ArrowLeft\" && content !== null) toggle(key, false);\n }\n : undefined\n }\n className={cn(\n \"group/row h-row-compact\",\n striped && index % 2 === 1 && \"bg-fill\",\n focusable && \"focus-ring -outline-offset-3\",\n disabled && \"text-label-tertiary\",\n selected && \"bg-selection text-selection-label\",\n )}\n >\n {detail ? (\n <td className=\"w-6 pl-2\">\n {content !== null ? (\n <ChevronRightIcon\n aria-hidden\n className={cn(\"size-icon-sm text-label-secondary transition-transform duration-100\", open && \"rotate-90\")}\n />\n ) : null}\n </td>\n ) : null}\n {columns.map((column) => (\n <td\n key={column.key}\n className={cn(\n \"max-w-0 truncate px-3\",\n WIDTH[column.width ?? \"auto\"],\n ALIGN[column.align ?? (column.numeric ? \"end\" : \"start\")],\n column.numeric && \"tabular-nums\",\n column.mono && \"font-mono text-callout\",\n column.width === \"fit\" && \"max-w-none\",\n )}\n >\n {column.cell(row)}\n </td>\n ))}\n {hasActions ? (\n <td\n className={cn(\n \"w-px whitespace-nowrap px-2\",\n // Finder: a row's buttons appear on hover, keyboard focus or selection only.\n !selected && \"opacity-0 group-hover/row:opacity-100 group-focus-within/row:opacity-100 has-[[data-state=open]]:opacity-100\",\n )}\n >\n <RowActions action={rowAction?.(row) ?? null} menu={rowMenu?.(row) ?? null} />\n </td>\n ) : null}\n </tr>\n {open ? (\n <tr className={cn(striped && index % 2 === 1 && \"bg-fill\")}>\n <td colSpan={span} className=\"px-3 pb-2 pl-9\">\n {content}\n </td>\n </tr>\n ) : null}\n </React.Fragment>\n );\n })}\n </tbody>\n )}\n </table>\n </div>\n );\n}\n\nfunction RowActions({ action, menu }: { action: RowAction | null; menu: ReadonlyArray<RowMenuItem> | null }) {\n const [asking, setAsking] = React.useState<RowMenuItem | null>(null);\n return (\n <span className=\"flex items-center justify-end gap-1\">\n {action ? (\n <Button size=\"sm\" disabled={action.disabled ?? false} onClick={action.onSelect}>\n {action.label}\n </Button>\n ) : null}\n {menu && menu.length > 0 ? (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <IconButton size=\"sm\" label=\"More\" icon={<MoreHorizontalIcon />} />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {menu.map((item) => (\n <DropdownMenuItem\n key={item.label}\n disabled={item.disabled ?? false}\n onSelect={() => (item.destructive && item.confirm ? setAsking(item) : item.onSelect())}\n className={item.destructive ? \"text-system-red focus:text-system-red\" : undefined}\n >\n {item.label}\n </DropdownMenuItem>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n ) : null}\n <ConfirmDialog\n open={asking !== null}\n onOpenChange={(open) => (open ? undefined : setAsking(null))}\n title={asking?.confirm ?? \"\"}\n confirmLabel={asking?.label}\n variant=\"destructive\"\n onConfirm={() => {\n asking?.onSelect();\n setAsking(null);\n }}\n />\n </span>\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 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: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\n/**\n * THE CURSOR LAW (common-docs/policies/cursor-law.md): a disabled control says\n * so with `not-allowed`, which the package's base layer sets on `:disabled`\n * and `[aria-disabled=\"true\"]`. `pointer-events: none` is never the mechanism\n * — it swallows the cursor. A native `<button disabled>` already fires no\n * click; the two shapes that WOULD fire one are handled here, once:\n * - `asChild` + `disabled` (a Link wearing button styles): marked\n * `aria-disabled`, taken out of the tab order, and its click is swallowed;\n * - `aria-disabled=\"true\"` on an enabled button: its click is swallowed.\n */\nfunction swallowClick(event: React.MouseEvent<HTMLButtonElement>): void {\n event.preventDefault();\n event.stopPropagation();\n}\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, onClick, ...props }, ref) => {\n const Component = asChild ? Slot : \"button\";\n const resolvedSize = size ?? \"default\";\n const disabledChild = asChild && Boolean(props.disabled);\n const ariaDisabled = props[\"aria-disabled\"];\n const inert =\n disabledChild || ariaDisabled === true || ariaDisabled === \"true\";\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 aria-disabled={disabledChild ? true : ariaDisabled}\n tabIndex={disabledChild ? -1 : props.tabIndex}\n onClick={inert ? swallowClick : onClick}\n />\n );\n },\n);\nButton.displayName = \"Button\";\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 * 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 * 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 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]:opacity-50\";\n\nconst MENU_INDICATOR_ITEM_CLASS =\n \"relative flex 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]: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 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 * 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","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { Text } from \"./text\";\n\n/**\n * The source list (Finder / Mail / Notes sidebar). Sections of 28 px rows; the open row carries a\n * neutral selection fill that dims when the window is inactive (`[data-window-active=false]` on any\n * ancestor). Up/Down arrow keys move between rows; Home/End jump to the ends.\n */\nexport function SourceList({ className, onKeyDown, ...props }: React.HTMLAttributes<HTMLElement>) {\n return (\n <nav\n data-slot=\"source-list\"\n className={cn(\"flex min-h-0 flex-col gap-3 px-2\", className)}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n const keys = [\"ArrowDown\", \"ArrowUp\", \"Home\", \"End\"];\n if (!keys.includes(event.key)) return;\n const items = Array.from(event.currentTarget.querySelectorAll<HTMLElement>(\"[data-slot=source-list-item]:not(:disabled)\"));\n const at = items.indexOf(document.activeElement as HTMLElement);\n if (at === -1) return;\n const next =\n event.key === \"Home\" ? 0 : event.key === \"End\" ? items.length - 1 : at + (event.key === \"ArrowDown\" ? 1 : -1);\n const target = items[Math.max(0, Math.min(items.length - 1, next))];\n if (target) {\n event.preventDefault();\n target.focus();\n }\n }}\n {...props}\n />\n );\n}\n\nexport interface SourceListSectionProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n title?: React.ReactNode;\n /** A trailing control on the title line (an IconButton \"+\"). */\n action?: React.ReactNode;\n}\n\nexport function SourceListSection({ title, action, className, children, ...props }: SourceListSectionProps) {\n const id = React.useId();\n return (\n <div role=\"group\" aria-labelledby={title ? id : undefined} data-slot=\"source-list-section\" className={cn(\"flex flex-col\", className)} {...props}>\n {title || action ? (\n <div className=\"flex h-row-compact items-center gap-2 px-2\">\n <Text id={id} variant=\"caption\" tone=\"tertiary\" emphasized className=\"flex-1\" truncate>\n {title}\n </Text>\n {action}\n </div>\n ) : null}\n {children}\n </div>\n );\n}\n\nexport interface SourceListItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Leading icon (16 px, secondary) or a StatusLight. */\n icon?: React.ReactNode;\n label: React.ReactNode;\n /** Second line (caption): makes the row two lines tall. */\n hint?: React.ReactNode;\n /** Trailing count or Tag. */\n badge?: React.ReactNode;\n /** This row is the open page. */\n current?: boolean;\n}\n\nexport const SourceListItem = React.forwardRef<HTMLButtonElement, SourceListItemProps>(function SourceListItem(\n { icon, label, hint, badge, current, className, type = \"button\", ...props },\n ref,\n) {\n return (\n <button\n ref={ref}\n type={type}\n data-slot=\"source-list-item\"\n data-current={current || undefined}\n aria-current={current ? \"page\" : undefined}\n className={cn(\n \"focus-ring group/item flex w-full items-center gap-2 rounded-control px-2 text-left text-body text-label transition-colors duration-100 hover:bg-fill disabled:opacity-40\",\n hint ? \"min-h-row py-1\" : \"h-sidebar-row\",\n current && \"bg-selection-muted font-medium hover:bg-selection-muted [[data-window-active=false]_&]:bg-fill\",\n className,\n )}\n {...props}\n >\n {icon ? (\n <span className={cn(\"flex size-icon shrink-0 items-center justify-center text-label-secondary [&_svg]:size-icon\", hint && \"self-start mt-px\")}>\n {icon}\n </span>\n ) : null}\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"truncate\">{label}</span>\n {hint ? <span className=\"truncate text-callout font-normal text-label-secondary\">{hint}</span> : null}\n </span>\n {badge ? <span className=\"flex shrink-0 items-center text-callout tabular-nums text-label-tertiary\">{badge}</span> : null}\n </button>\n );\n});\n\n/** \"Show more / Show less\" under a long section. */\nexport interface SourceListMoreProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"onClick\"> {\n expanded: boolean;\n onToggle: () => void;\n}\n\nexport function SourceListMore({ expanded, onToggle, className, ...props }: SourceListMoreProps) {\n return (\n <button\n {...props}\n type=\"button\"\n data-slot=\"source-list-more\"\n aria-expanded={expanded}\n onClick={onToggle}\n className={cn(\"focus-ring flex h-sidebar-row w-full items-center rounded-control px-2 text-left text-callout text-label-tertiary hover:text-label-secondary\", className)}\n >\n {expanded ? \"Show less\" : \"Show more\"}\n </button>\n );\n}\n","import * as React from \"react\";\n\nimport { Button } from \"./button\";\nimport { cn } from \"./cn\";\nimport { Spinner } from \"./spinner\";\nimport { Text } from \"./text\";\n\nexport interface StateViewProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** `empty`: nothing here yet. `loading`: work in flight. `error`: it failed (say why). */\n kind: \"empty\" | \"loading\" | \"error\";\n /** Large glyph (empty/error). Loading always shows the activity indicator. */\n icon?: React.ReactNode;\n title: React.ReactNode;\n /** One line: the reason, or what to do. */\n message?: React.ReactNode;\n /** One or two Buttons (Retry, Create). */\n actions?: React.ReactNode;\n /** `page` centres in the whole content area; `inline` sits inside a section or table. */\n size?: \"page\" | \"inline\";\n}\n\n/** THE empty / loading / error state. Every screen says these three things the same way. */\nexport function StateView({ kind, icon, title, message, actions, size = \"inline\", className, ...props }: StateViewProps) {\n return (\n <div\n role={kind === \"error\" ? \"alert\" : kind === \"loading\" ? \"status\" : undefined}\n aria-busy={kind === \"loading\" || undefined}\n data-slot=\"state-view\"\n data-kind={kind}\n className={cn(\n \"flex flex-col items-center justify-center gap-2 px-6 text-center\",\n size === \"page\" ? \"h-full min-h-60 py-16\" : \"py-10\",\n className,\n )}\n {...props}\n >\n {kind === \"loading\" ? (\n <Spinner size=\"lg\" />\n ) : icon ? (\n <span\n className={cn(\n \"mb-1 flex items-center justify-center [&_svg]:size-icon-xl\",\n kind === \"error\" ? \"text-system-red\" : \"text-label-tertiary\",\n )}\n >\n {icon}\n </span>\n ) : null}\n <Text variant={size === \"page\" ? \"title-3\" : \"headline\"} tone={kind === \"loading\" ? \"secondary\" : \"primary\"}>\n {title}\n </Text>\n {message ? (\n <Text as=\"p\" variant=\"callout\" tone=\"secondary\" selectable={kind === \"error\"} className=\"max-w-form\">\n {message}\n </Text>\n ) : null}\n {actions ? <div className=\"mt-2 flex items-center gap-2\">{actions}</div> : null}\n </div>\n );\n}\n\nexport type BannerTone = \"neutral\" | \"info\" | \"warning\" | \"danger\" | \"success\";\n\nconst BANNER_TONE: Record<BannerTone, { box: string; icon: string }> = {\n neutral: { box: \"bg-fill\", icon: \"text-label-secondary\" },\n info: { box: \"bg-system-blue/10\", icon: \"text-system-blue\" },\n warning: { box: \"bg-system-orange/12\", icon: \"text-system-orange\" },\n danger: { box: \"bg-system-red/10\", icon: \"text-system-red\" },\n success: { box: \"bg-system-green/10\", icon: \"text-system-green\" },\n};\n\nexport interface BannerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n tone: BannerTone;\n icon?: React.ReactNode;\n title: React.ReactNode;\n message?: React.ReactNode;\n /** Trailing Buttons (size sm). */\n actions?: React.ReactNode;\n}\n\n/** An inline notice above content: something failed, needs attention, or just happened. */\nexport function Banner({ tone, icon, title, message, actions, className, ...props }: BannerProps) {\n return (\n <div\n role={tone === \"danger\" || tone === \"warning\" ? \"alert\" : \"status\"}\n data-slot=\"banner\"\n data-tone={tone}\n className={cn(\"flex gap-2.5 rounded-group px-3 py-2\", message ? \"items-start\" : \"items-center\", BANNER_TONE[tone].box, className)}\n {...props}\n >\n {icon ? <span className={cn(\"flex shrink-0 [&_svg]:size-icon\", message && \"mt-px\", BANNER_TONE[tone].icon)}>{icon}</span> : null}\n <div className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <Text emphasized>{title}</Text>\n {message ? (\n <Text as=\"p\" variant=\"callout\" tone=\"secondary\" selectable>\n {message}\n </Text>\n ) : null}\n </div>\n {actions ? <div className=\"flex shrink-0 items-center gap-2\">{actions}</div> : null}\n </div>\n );\n}\n\nexport interface ErrorBannerProps extends Omit<BannerProps, \"tone\" | \"title\" | \"message\" | \"actions\"> {\n /** The failed action's error (e.g. `useDesktopAction().error`); nothing renders without one. */\n error: { message: string } | null | undefined;\n onDismiss: () => void;\n /** Headline; default \"That didn't work\". */\n title?: React.ReactNode;\n}\n\n/** lucide `triangle-alert` (policy C19: icons are inlined, never a dependency). */\nfunction AlertGlyph() {\n return (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={1.75} strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n </svg>\n );\n}\n\n/** THE banner for a failed action: the error's own words and a Dismiss button. */\nexport function ErrorBanner({ error, onDismiss, title = \"That didn't work\", ...props }: ErrorBannerProps) {\n if (!error) return null;\n return (\n <Banner\n tone=\"danger\"\n icon={<AlertGlyph />}\n title={title}\n message={error.message}\n actions={\n <Button size=\"sm\" onClick={onDismiss}>\n Dismiss\n </Button>\n }\n {...props}\n />\n );\n}\n","import * as React from \"react\";\n\nimport { Button } from \"./button\";\nimport { StateView } from \"./state\";\n\n/** Any read in flight: the shape `useDesktopRequest` returns (and any query hook can match). */\nexport interface ResourceState<T> {\n data: T | undefined;\n error: { message: string } | undefined | null;\n loading: boolean;\n refetch?: () => unknown;\n}\n\nexport interface ResourceProps<T> {\n state: ResourceState<T>;\n /** What is being read, as the loading line (\"Reading processes\"). */\n loading: string;\n /** What failed, as the error title (\"Processes can't be read\"). */\n failed: string;\n /** Treat the data as empty (render `empty`). Default: an empty array. */\n isEmpty?: (data: T) => boolean;\n /** The empty state (a StateView kind=\"empty\"). */\n empty?: React.ReactNode;\n /** `page` fills the content area; `inline` sits in a section (default). */\n size?: \"page\" | \"inline\";\n children: (data: T) => React.ReactNode;\n}\n\n/**\n * THE way a screen shows data it reads: loading → error (with Try again) → empty → the content.\n * Once data has arrived, a background refresh never blanks it; a refresh error keeps the last data.\n */\nexport function Resource<T>({ state, loading, failed, isEmpty, empty, size = \"inline\", children }: ResourceProps<T>) {\n if (state.data === undefined) {\n if (state.error) {\n return (\n <StateView\n kind=\"error\"\n size={size}\n title={failed}\n message={state.error.message}\n actions={state.refetch ? <Button onClick={() => void state.refetch?.()}>Try again</Button> : undefined}\n />\n );\n }\n return <StateView kind=\"loading\" size={size} title={loading} />;\n }\n const blank = isEmpty ? isEmpty(state.data) : Array.isArray(state.data) && state.data.length === 0;\n if (blank && empty) return <>{empty}</>;\n return <>{children(state.data)}</>;\n}\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport type TagTone = \"neutral\" | \"tint\" | \"success\" | \"warning\" | \"danger\";\n\nconst TONE: Record<TagTone, string> = {\n neutral: \"bg-fill-secondary text-label-secondary\",\n tint: \"bg-tint/12 text-tint\",\n success: \"bg-system-green/14 text-system-green\",\n warning: \"bg-system-orange/14 text-system-orange\",\n danger: \"bg-system-red/12 text-system-red\",\n};\n\nexport interface TagProps extends React.HTMLAttributes<HTMLSpanElement> {\n tone?: TagTone;\n}\n\n/** A small capsule label: a state (\"Running\"), a kind (\"Beta\"), a count. Caption size, 18 px. */\nexport function Tag({ tone = \"neutral\", className, ...props }: TagProps) {\n return (\n <span\n data-slot=\"tag\"\n data-tone={tone}\n className={cn(\n \"inline-flex h-4.5 shrink-0 items-center gap-1 whitespace-nowrap rounded-full px-1.5 text-caption font-medium [&_svg]:size-2.5\",\n TONE[tone],\n className,\n )}\n {...props}\n />\n );\n}\n\nexport type StatusTone = \"neutral\" | \"success\" | \"warning\" | \"danger\" | \"tint\";\n\nconst DOT: Record<StatusTone, string> = {\n neutral: \"bg-system-gray\",\n success: \"bg-system-green\",\n warning: \"bg-system-orange\",\n danger: \"bg-system-red\",\n tint: \"bg-tint\",\n};\n\n/** The status light (8 px): running, stopped, needs attention. Always paired with words or a label. */\nexport interface StatusLightProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, \"children\"> {\n tone: StatusTone;\n /** What the light means (\"Running\"); read by assistive tech unless `aria-hidden`. */\n label: string;\n}\n\nexport function StatusLight({ tone, label, className, ...props }: StatusLightProps) {\n return (\n <span\n role=\"img\"\n aria-label={label}\n data-slot=\"status-light\"\n className={cn(\"inline-block size-2 shrink-0 rounded-full\", DOT[tone], className)}\n {...props}\n />\n );\n}\n\n/** A keyboard shortcut, e.g. `<Kbd>⌘K</Kbd>`. */\nexport function Kbd({ className, ...props }: React.HTMLAttributes<HTMLElement>) {\n return (\n <kbd\n data-slot=\"kbd\"\n className={cn(\"inline-flex h-4.5 items-center rounded-control bg-fill-secondary px-1 font-sans text-caption text-label-secondary\", className)}\n {...props}\n />\n );\n}\n","import * as React from \"react\";\n\nimport { Page } from \"./layout\";\nimport { Tag } from \"./tag\";\nimport { Text } from \"./text\";\n\nexport interface ComingSoonProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** The feature's icon (the same one its menu entry shows). */\n icon: React.ReactNode;\n /** The feature's name, exactly as its menu entry says it. */\n title: string;\n /** One line: what it will do for the person. */\n summary: string;\n /** Up to four short lines: what it will include. */\n includes?: ReadonlyArray<string>;\n}\n\n/**\n * THE page for anything not built yet. Every menu entry, button and route either opens its real\n * screen or this — never a control that does nothing. Same place, same look, every time.\n */\nexport function ComingSoon({ icon, title, summary, includes, className, ...props }: ComingSoonProps) {\n return (\n <Page width=\"full\" data-coming-soon={title} className={className} {...props}>\n <div className=\"mx-auto flex max-w-form flex-col items-center gap-3 pt-16 text-center\">\n <span className=\"flex size-16 items-center justify-center rounded-panel bg-fill-secondary text-label-secondary [&_svg]:size-icon-xl\">\n {icon}\n </span>\n <div className=\"flex flex-col items-center gap-1.5\">\n <Tag>Coming soon</Tag>\n <Text as=\"h1\" variant=\"title-1\">\n {title}\n </Text>\n <Text as=\"p\" variant=\"body\" tone=\"secondary\" className=\"max-w-form\">\n {summary}\n </Text>\n </div>\n {includes && includes.length > 0 ? (\n <ul className=\"mt-3 flex flex-col gap-2 text-left\">\n {includes.slice(0, 4).map((line) => (\n <li key={line} className=\"flex items-start gap-2\">\n <span aria-hidden className=\"mt-1.5 size-1.5 shrink-0 rounded-full bg-label-tertiary\" />\n <Text variant=\"callout\" tone=\"secondary\">\n {line}\n </Text>\n </li>\n ))}\n </ul>\n ) : null}\n </div>\n </Page>\n );\n}\n","import * as ProgressPrimitive from \"@radix-ui/react-progress\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport interface MeterProps {\n [data: `data-${string}`]: string | undefined;\n /** 0 … max. `null` draws the indeterminate bar. */\n value: number | null;\n max?: number;\n /** `level` colours by fullness (green → orange ≥ 70 % → red ≥ 90 %), for capacity (disk, memory).\n * `progress` is always the tint, for work under way. */\n kind?: \"level\" | \"progress\";\n size?: \"sm\" | \"md\";\n \"aria-label\": string;\n className?: string;\n}\n\nexport const METER_THRESHOLDS = { warning: 0.7, critical: 0.9 } as const;\n\nexport function meterTone(fraction: number): \"normal\" | \"warning\" | \"critical\" {\n if (fraction >= METER_THRESHOLDS.critical) return \"critical\";\n if (fraction >= METER_THRESHOLDS.warning) return \"warning\";\n return \"normal\";\n}\n\n/** The level indicator / progress bar. One threshold rule for every capacity in the app. */\nexport function Meter({ value, max = 100, kind = \"progress\", size = \"md\", className, \"aria-label\": ariaLabel, ...data }: MeterProps) {\n const fraction = value === null ? 0 : Math.min(1, Math.max(0, value / max));\n const tone = kind === \"level\" ? meterTone(fraction) : \"progress\";\n return (\n <ProgressPrimitive.Root\n {...data}\n value={value}\n max={max}\n aria-label={ariaLabel}\n data-slot=\"meter\"\n className={cn(\"relative w-full min-w-16 overflow-hidden rounded-full bg-fill-tertiary\", size === \"sm\" ? \"h-1\" : \"h-1.5\", className)}\n >\n <ProgressPrimitive.Indicator\n className={cn(\n \"h-full rounded-full transition-all duration-200\",\n value === null && \"w-1/3 animate-pulse\",\n tone === \"progress\" && \"bg-tint\",\n tone === \"normal\" && \"bg-system-green\",\n tone === \"warning\" && \"bg-system-orange\",\n tone === \"critical\" && \"bg-system-red\",\n )}\n style={value === null ? undefined : { width: `${fraction * 100}%` }}\n />\n </ProgressPrimitive.Root>\n );\n}\n","/**\n * Display formatting for desktop screens: ONE way to show a size, a duration, a time and an error.\n * macOS shows file and memory sizes in decimal units (1 GB = 1,000,000,000 bytes), so do we.\n */\n\nconst BYTE_UNITS = [\"bytes\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\"] as const;\n\nexport function formatBytes(bytes: number | null | undefined): string {\n if (bytes === null || bytes === undefined || !Number.isFinite(bytes)) return \"—\";\n if (bytes < 1000) return `${Math.round(bytes)} ${bytes === 1 ? \"byte\" : \"bytes\"}`;\n let value = bytes;\n let unit = 0;\n while (value >= 1000 && unit < BYTE_UNITS.length - 1) {\n value /= 1000;\n unit += 1;\n }\n return `${value >= 100 ? Math.round(value) : value.toFixed(1).replace(/\\.0$/, \"\")} ${BYTE_UNITS[unit]}`;\n}\n\n/** \"3 sec\", \"4 min\", \"2 hr 5 min\", \"3 days 4 hr\" — the two largest units. */\nexport function formatDuration(ms: number | null | undefined): string {\n if (ms === null || ms === undefined || !Number.isFinite(ms) || ms < 0) return \"—\";\n const s = Math.floor(ms / 1000);\n if (s < 60) return `${s} sec`;\n const m = Math.floor(s / 60);\n if (m < 60) return `${m} min`;\n const h = Math.floor(m / 60);\n if (h < 24) return m % 60 ? `${h} hr ${m % 60} min` : `${h} hr`;\n const d = Math.floor(h / 24);\n return h % 24 ? `${d} ${d === 1 ? \"day\" : \"days\"} ${h % 24} hr` : `${d} ${d === 1 ? \"day\" : \"days\"}`;\n}\n\nconst RELATIVE = new Intl.RelativeTimeFormat(undefined, { numeric: \"auto\" });\nconst SAME_YEAR = new Intl.DateTimeFormat(undefined, { month: \"short\", day: \"numeric\", hour: \"numeric\", minute: \"2-digit\" });\nconst OTHER_YEAR = new Intl.DateTimeFormat(undefined, { year: \"numeric\", month: \"short\", day: \"numeric\" });\n\n/** \"just now\", \"5 minutes ago\", \"yesterday\", then a date (Finder's Date Modified style). */\nexport function formatRelativeTime(at: Date | number | string | null | undefined, now: number = Date.now()): string {\n if (at === null || at === undefined) return \"—\";\n const time = at instanceof Date ? at.getTime() : typeof at === \"string\" ? Date.parse(at) : at;\n if (!Number.isFinite(time)) return \"—\";\n const seconds = Math.round((time - now) / 1000);\n const abs = Math.abs(seconds);\n if (abs < 45) return \"just now\";\n if (abs < 3600) return RELATIVE.format(Math.round(seconds / 60), \"minute\");\n if (abs < 86400) return RELATIVE.format(Math.round(seconds / 3600), \"hour\");\n if (abs < 86400 * 2) return RELATIVE.format(Math.round(seconds / 86400), \"day\");\n return new Date(time).getFullYear() === new Date(now).getFullYear() ? SAME_YEAR.format(time) : OTHER_YEAR.format(time);\n}\n\n/** The human sentence for any thrown value. */\nexport function errorMessage(error: unknown): string {\n if (error instanceof Error) return error.message || error.name;\n if (typeof error === \"string\") return error;\n if (error && typeof error === \"object\" && \"message\" in error && typeof (error as { message: unknown }).message === \"string\") {\n return (error as { message: string }).message;\n }\n return \"Something went wrong.\";\n}\n\n/** The compact age for dense table cells: \"now\", \"5m\", \"10h\", \"3d\", then \"Oct 3\" (Mail's list). */\nexport function formatAge(at: Date | number | string | null | undefined, now: number = Date.now()): string {\n if (at === null || at === undefined) return \"—\";\n const time = at instanceof Date ? at.getTime() : typeof at === \"string\" ? Date.parse(at) : at;\n if (!Number.isFinite(time)) return \"—\";\n const minutes = Math.floor((now - time) / 60_000);\n if (minutes < 1) return \"now\";\n if (minutes < 60) return `${minutes}m`;\n if (minutes < 60 * 24) return `${Math.floor(minutes / 60)}h`;\n if (minutes < 60 * 24 * 7) return `${Math.floor(minutes / (60 * 24))}d`;\n return new Date(time).toLocaleDateString(undefined, { month: \"short\", day: \"numeric\" });\n}\n\nconst CLOCK = new Intl.DateTimeFormat(undefined, { hour: \"numeric\", minute: \"2-digit\" });\n\n/** A time of day, the way the menu bar shows it: \"2:44 PM\" (24-hour where the person's locale is). */\nexport function formatClockTime(at: Date | number | string | null | undefined): string {\n if (at === null || at === undefined) return \"—\";\n const time = at instanceof Date ? at.getTime() : typeof at === \"string\" ? Date.parse(at) : at;\n return Number.isFinite(time) ? CLOCK.format(time) : \"—\";\n}\n\n/** How much of a capacity is used, in the same words everywhere: \"183 GB of 275 GB in use\". */\nexport function formatUsage(used: number | null | undefined, total: number | null | undefined): string {\n if (used === null || used === undefined || total === null || total === undefined) return \"—\";\n return `${formatBytes(used)} of ${formatBytes(total)} in use`;\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 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]:opacity-50\";\n\nconst INDICATOR_ITEM_CLASS =\n \"relative flex 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]: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 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 * 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 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","\"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","/**\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","/**\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 * `<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 * 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 * 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","/**\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\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 * 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"],"mappings":";;;AAAA,SAAS,YAA6B;AACtC,SAAS,2BAA2B;AAOpC,IAAM,QAAQ,oBAAoB;AAAA,EAChC,QAAQ;AAAA,IACN,OAAO;AAAA,MACL,SAAS;AAAA,QACP;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACA,QAAQ,CAAC,WAAW,SAAS,OAAO;AAAA,MACpC,WAAW,CAAC,QAAQ,QAAQ,MAAM;AAAA,MAClC,MAAM,CAAC,eAAe,WAAW,WAAW,WAAW,YAAY,QAAQ,WAAW,SAAS;AAAA,MAC/F,QAAQ,CAAC,WAAW,UAAU,SAAS;AAAA,IACzC;AAAA,EACF;AACF,CAAC;AAEM,SAAS,MAAM,QAA8B;AAClD,SAAO,MAAM,KAAK,MAAM,CAAC;AAC3B;;;ACnCA,YAAY,WAAW;AAsEnB;AApDJ,IAAM,UAAuC;AAAA,EAC3C,eAAe;AAAA,EACf,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,UAAU;AAAA,EACV,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AACX;AAEO,IAAM,YAAsC;AAAA,EACjD,SAAS;AAAA,EACT,WAAW;AAAA,EACX,UAAU;AAAA,EACV,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AACX;AAiBO,IAAM,OAAa,iBAAmC,SAASA,MACpE;AAAA,EACE,UAAU;AAAA,EACV,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,E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AAG,qEAAqE,SAAS;AAAA,QAC5F,aAAU;AAAA,QAEV,0BAAAD,MAAC,SAAI,KAAK,SAAS,KAAK,MAAM,WAAU,8BAA6B;AAAA;AAAA,IACvE;AAAA,EAEJ;AACA,QAAM,WAAY,gBAAgB,aAAa,KAAK,KAAM,KAAK,KAAK,EAAE,MAAM,GAAG,CAAC,KAAK,KAClF,MAAM,GAAG,CAAC,EACV,YAAY;AACf,QAAM,WAAW,KAAK,MAAM,QAAQ,QAAQ,UAAU,IAAI,OAAO,KAAK;AACtE,SACE,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,EAAE,GAAG,KAAK,GAAG,kBAAkB,MAAM,IAAI,GAAG,SAAS;AAAA,MAC5D,WAAWC;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACA,cAAY,6BAA6B,OAAO;AAAA,MAChD,OAAO;AAAA,MACP,aAAU;AAAA,MAET;AAAA;AAAA,EACH;AAEJ;","names":["Text","Tag","jsx","React","React","clsx","cn","React","jsx","jsx","cn","jsx","Button","IconButton","React","jsx","jsxs","jsx","jsxs","jsx","jsxs","jsx","jsxs","jsx","jsx","jsx","jsxs","TextField","TextArea","SearchField","SelectPrimitive","cva","React","jsx","jsxs","cva","jsx","cn","jsxs","jsx","jsxs","jsx","React","jsx","cn","React","jsx","cn","React","jsx","jsxs","Page","React","Fragment","jsx","jsxs","Row","React","jsx","React","React","Slot","cva","React","jsx","buttonVariants","cva","Button","Slot","cn","Slot","React","jsx","jsx","Slot","jsx","jsxs","jsx","cn","jsxs","buttonVariants","jsx","jsxs","cn","buttonVariants","React","React","useEffect","useRef","useState","Fragment","jsx","jsxs","React","jsx","jsxs","jsxs","cn","jsx","jsx","jsxs","WIDTH","React","jsx","jsxs","SourceListItem","jsx","jsxs","Fragment","jsx","jsx","jsx","jsxs","jsx","React","jsx","jsxs","SURFACE_CLASS","jsxs","cn","jsx","treeContainsComponent","React","React","jsx","CONTEXT_SLOT","contextRegistry","jsx","jsxs","CONTEXT_SLOT","contextRegistry","jsx","cn","treeContainsComponent","jsxs","React","jsx","React","jsx","cn","React","jsx","CollapsibleTrigger","CollapsibleContent","cn","jsx","cn","React","jsx","cn","jsx","jsxs","cn","AppRailItem","AppRailAvatar","React","Group","Separator","jsx","Group","cn","Separator","jsx","jsxs","cn","React","jsx","jsxs","cn","React","Fragment","jsx","jsxs","jsx","cn"]}
|