@ai-matrx/design-system 0.86.349 → 0.86.350
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 +17 -2
- package/dist/carousel.cjs.map +1 -1
- package/dist/carousel.js +5 -5
- package/dist/chunk-4WSXAP24.js +51 -0
- package/dist/chunk-4WSXAP24.js.map +1 -0
- package/dist/{chunk-XTP6HOB6.js → chunk-6XNYYROM.js} +1 -1
- package/dist/chunk-6XNYYROM.js.map +1 -0
- package/dist/{chunk-54UK6P7E.js → chunk-BCGNEWZM.js} +3 -3
- package/dist/{chunk-CEA6X445.js → chunk-CFUXEGW2.js} +2 -2
- package/dist/{chunk-BC7LMEOD.js → chunk-GJ6UGQ4X.js} +7 -3
- package/dist/chunk-GJ6UGQ4X.js.map +1 -0
- package/dist/{chunk-6QKT52FR.js → chunk-MTE6N7XU.js} +2 -2
- package/dist/{chunk-S6F34AX5.js → chunk-QA7EHFRX.js} +2 -2
- package/dist/{chunk-KYH42WEX.js → chunk-SC3XPADZ.js} +3 -3
- package/dist/{chunk-CJBSBKG5.js → chunk-SOCNWQMX.js} +2 -2
- package/dist/{chunk-GLLPO66A.js → chunk-U46XUQI7.js} +2 -2
- package/dist/{chunk-6CDAHINE.js → chunk-UTADJKVR.js} +2 -2
- package/dist/{chunk-TWRC7NP4.js → chunk-WUD23YTG.js} +4 -4
- package/dist/{chunk-MIJMP4WI.js → chunk-YRF22M5S.js} +6 -1
- package/dist/{chunk-MIJMP4WI.js.map → chunk-YRF22M5S.js.map} +1 -1
- package/dist/clipboard-fallback-dialog.cjs.map +1 -1
- package/dist/clipboard-fallback-dialog.js +1 -1
- package/dist/controls.cjs.map +1 -1
- package/dist/controls.css +25 -0
- package/dist/controls.d.cts +2 -2
- package/dist/controls.d.ts +2 -2
- package/dist/controls.js +5 -5
- package/dist/data-table/data-row-inspector.cjs.map +1 -1
- package/dist/data-table/data-row-inspector.js +4 -4
- package/dist/data-table/data-row-window.cjs.map +1 -1
- package/dist/data-table/data-row-window.js +5 -5
- package/dist/data-table/index.cjs +8 -5
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.js +9 -9
- package/dist/data-table/pagination.cjs.map +1 -1
- package/dist/data-table/pagination.js +2 -2
- package/dist/data-table/spreadsheet.cjs +6 -2
- package/dist/data-table/spreadsheet.cjs.map +1 -1
- package/dist/data-table/spreadsheet.d.cts +4 -1
- package/dist/data-table/spreadsheet.d.ts +4 -1
- package/dist/data-table/spreadsheet.js +3 -1
- package/dist/data-table/uuid-cell.cjs.map +1 -1
- package/dist/data-table/uuid-cell.js +2 -2
- package/dist/desktop.cjs +93 -12
- package/dist/desktop.cjs.map +1 -1
- package/dist/desktop.css +27 -0
- package/dist/desktop.d.cts +6 -5
- package/dist/desktop.d.ts +6 -5
- package/dist/desktop.js +64 -15
- package/dist/desktop.js.map +1 -1
- package/dist/index.cjs +17 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -4
- package/dist/index.d.ts +13 -4
- package/dist/index.js +21 -14
- package/dist/index.js.map +1 -1
- package/dist/item.cjs.map +1 -1
- package/dist/item.js +2 -2
- package/dist/lite-table.cjs.map +1 -1
- package/dist/lite-table.js +1 -1
- package/dist/notice-stack.cjs +70 -0
- package/dist/notice-stack.cjs.map +1 -0
- package/dist/notice-stack.d.cts +60 -0
- package/dist/notice-stack.d.ts +60 -0
- package/dist/notice-stack.js +16 -0
- package/dist/notice-stack.js.map +1 -0
- package/dist/record-list.cjs.map +1 -1
- package/dist/record-list.js +2 -2
- package/dist/settings.cjs.map +1 -1
- package/dist/settings.js +3 -3
- package/dist/swipe-deck.cjs +95 -25
- package/dist/swipe-deck.cjs.map +1 -1
- package/dist/swipe-deck.css +14 -0
- package/dist/swipe-deck.d.cts +20 -0
- package/dist/swipe-deck.d.ts +20 -0
- package/dist/swipe-deck.js +87 -25
- package/dist/swipe-deck.js.map +1 -1
- package/dist/writing-field.cjs.map +1 -1
- package/dist/writing-field.js +2 -2
- package/package.json +12 -18
- package/dist/chunk-BC7LMEOD.js.map +0 -1
- package/dist/chunk-XTP6HOB6.js.map +0 -1
- /package/dist/{chunk-54UK6P7E.js.map → chunk-BCGNEWZM.js.map} +0 -0
- /package/dist/{chunk-CEA6X445.js.map → chunk-CFUXEGW2.js.map} +0 -0
- /package/dist/{chunk-6QKT52FR.js.map → chunk-MTE6N7XU.js.map} +0 -0
- /package/dist/{chunk-S6F34AX5.js.map → chunk-QA7EHFRX.js.map} +0 -0
- /package/dist/{chunk-KYH42WEX.js.map → chunk-SC3XPADZ.js.map} +0 -0
- /package/dist/{chunk-CJBSBKG5.js.map → chunk-SOCNWQMX.js.map} +0 -0
- /package/dist/{chunk-GLLPO66A.js.map → chunk-U46XUQI7.js.map} +0 -0
- /package/dist/{chunk-6CDAHINE.js.map → chunk-UTADJKVR.js.map} +0 -0
- /package/dist/{chunk-TWRC7NP4.js.map → chunk-WUD23YTG.js.map} +0 -0
package/dist/desktop.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/desktop/cn.ts","../src/desktop/text.tsx","../src/desktop/spinner.tsx","../src/desktop/button.tsx","../src/desktop/tooltip.tsx","../src/desktop/field.tsx","../src/desktop/select.tsx","../src/desktop/segmented.tsx","../src/desktop/controls.tsx","../src/desktop/layout.tsx","../src/desktop/native.tsx","../src/desktop/sheet.tsx","../src/desktop/group.tsx","../src/desktop/settings.tsx","../src/desktop/settings-controls.tsx","../src/desktop/code-block.tsx","../src/desktop/inspector-panel.tsx","../src/desktop/pull-down.tsx","../src/desktop/menu-entries.tsx","../src/desktop/toolbar-overflow.tsx","../src/desktop/document.tsx","../src/desktop/monitor.tsx","../src/desktop/log-view.tsx","../src/desktop/icon-view.tsx","../src/desktop/column-browser.tsx","../src/desktop/quick-look.tsx","../src/desktop/rename-field.tsx","../src/desktop/table.tsx","../src/desktop/tag.tsx","../src/desktop/state.tsx","../src/desktop/errors.ts","../src/desktop/table-filter.tsx","../src/desktop/source-list.tsx","../src/desktop/message-list.tsx","../src/desktop/split-view.tsx","../src/desktop/resizable-pane.tsx","../src/desktop/edge-resizer.tsx","../src/desktop/conversation.tsx","../src/desktop/media.tsx","../src/desktop/resource.tsx","../src/desktop/coming-soon.tsx","../src/desktop/tile.tsx","../src/desktop/library.tsx","../src/desktop/start-page.tsx","../src/desktop/store.tsx","../src/desktop/credentials.tsx","../src/desktop/meter.tsx","../src/desktop/format.ts","../src/desktop/index.ts","../src/desktop/popover.tsx","../src/desktop/list-row.tsx","../src/desktop/info-hint.tsx","../src/desktop/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 color) 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 \"sidebar-row-tall\",\n \"row-table\",\n \"table-header\",\n \"navigator-item\",\n \"row\",\n \"row-tall\",\n \"toolbar\",\n \"icon-sm\",\n \"icon\",\n \"icon-lg\",\n \"icon-xl\",\n ],\n radius: [\"control\", \"tile\", \"group\", \"panel\"],\n container: [\"form\", \"page\", \"wide\"],\n text: [\"title-large\", \"title-1\", \"title-2\", \"title-3\", \"headline\", \"body\", \"callout\", \"subheadline\", \"footnote\", \"caption\", \"caption-2\", \"code\", \"table-header\"],\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/**\n * Apple's macOS text styles (HIG, NSFont.TextStyle). Nothing else sets a font size in desktop app\n * code. Content text is 13 pt (body) or larger; the styles under 13 pt (callout, subheadline,\n * footnote, caption, caption-2) belong to components (a toolbar subtitle, a tag, a chart's axis),\n * and the app lint refuses them in screens: secondary text is `tone=\"secondary\"` at body size.\n */\nexport type TextVariant =\n | \"title-large\"\n | \"title-1\"\n | \"title-2\"\n | \"title-3\"\n | \"headline\"\n | \"body\"\n | \"callout\"\n | \"subheadline\"\n | \"footnote\"\n | \"caption\"\n | \"caption-2\";\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 subheadline: \"text-subheadline\",\n footnote: \"text-footnote\",\n caption: \"text-caption\",\n \"caption-2\": \"text-caption-2\",\n};\n\n/** Each text style's point size, for a library that takes a number (a terminal's font size); CSS\n * and screens use the styles themselves. Matches desktop.css. */\nexport const TEXT_STYLE_POINTS = {\n \"title-large\": 26,\n \"title-1\": 22,\n \"title-2\": 17,\n \"title-3\": 15,\n headline: 13,\n body: 13,\n callout: 12,\n subheadline: 11,\n footnote: 10,\n caption: 10,\n \"caption-2\": 10,\n code: 13,\n} as const;\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 /** The style's emphasized weight (HIG): bold titles, heavy headline, semibold body, medium caption. */\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 data-variant={variant}\n data-emphasized={emphasized || undefined}\n className={cn(\n VARIANT[variant],\n TEXT_TONE[tone],\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\n/**\n * One line cut in the MIDDLE, as AppKit does for names, paths and identifiers\n * (NSLineBreakByTruncatingMiddle: About's Name, Finder's long file names): the start and the end\n * stay readable (\"dsm12-dh255-32…4c71a2\"), the whole text is the hover tooltip. Short text draws whole.\n */\nexport function MiddleTruncate({ text, tail = 8, className, ...props }: Omit<React.HTMLAttributes<HTMLSpanElement>, \"children\"> & { text: string; tail?: number }) {\n // One line: runs of white space read as one space (what `nowrap` drew before).\n const line = text.replace(/\\s+/g, \" \");\n const cut = line.length > tail * 2 ? line.length - tail : line.length;\n // The two pieces are flex items, and a flex item drops the white space at its own start and end\n // under `nowrap`: a cut beside a space drew \"Sign in toMatrx 2\". `whitespace-pre` keeps it (the\n // line holds no newlines, so it still never wraps).\n return (\n <span data-slot=\"middle-truncate\" title={text} className={cn(\"inline-flex min-w-0 max-w-full whitespace-pre\", className)} {...props}>\n <span data-slot=\"middle-truncate-head\" className=\"min-w-0 overflow-hidden text-ellipsis whitespace-pre\">\n {line.slice(0, cut)}\n </span>\n {cut < line.length ? (\n <span data-slot=\"middle-truncate-tail\" className=\"shrink-0 whitespace-pre\">\n {line.slice(cut)}\n </span>\n ) : null}\n </span>\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, TooltipTrigger } from \"../tooltip\";\nimport { TooltipContent } 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 * - `link`: a borderless accent-colored action under a placeholder (Console's \"Start streaming\"\n * under \"No Messages\"); never in a toolbar or a form.\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 // Disabled, the default button is drawn as AppKit draws it: the standard bordered bezel,\n // dimmed, the same as its secondary peers; never a filled gray block beside outlined ones.\n primary:\n \"bg-tint text-tint-label shadow-control hover:brightness-110 active:brightness-95 disabled:bg-control disabled:text-label\",\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 link: \"bg-transparent text-tint hover:brightness-125 active:brightness-90\",\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 data-variant={variant ?? \"secondary\"}\n // AppKit metrics on every pointer and window width: the web kit's 44 px touch floor (a dialog\n // footer under 1024 px wide lifted a sheet's Cancel and Done to 44 px squares) never applies.\n data-touch-exempt=\"\"\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 shown or hidden, 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 data-touch-exempt=\"\"\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\nexport interface LinkButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Render the child (an `<a>` or a router `Link`) with the link's look, for a real navigation. */\n asChild?: boolean;\n /**\n * A name in a table row (a chat, an account): the surrounding text's own color at rest (a row\n * of names is not a column of blue), the accent and an underline only under the pointer or\n * focus, as Mail's and Finder's clickable names. A link in a line of prose stays the accent.\n */\n quiet?: boolean;\n}\n\n/**\n * AppKit's borderless link-style button (an NSButton drawn as accent text: Settings' \"Learn more…\",\n * Finder's \"Show\"): an action that sits in a line of text, at the text's own size and weight, with\n * no bezel, no padding and no fixed height. Use it for a clickable name in prose or a fact (an\n * account, a project, a chat). For an accent action under an empty placeholder use\n * `Button variant=\"link\"` (a control-sized button); never in a toolbar or a form.\n */\nexport const LinkButton = React.forwardRef<HTMLButtonElement, LinkButtonProps>(function LinkButton(\n { asChild, quiet = false, className, 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=\"link-button\"\n data-quiet={quiet ? \"\" : undefined}\n data-touch-exempt=\"\"\n className={cn(\n \"focus-ring inline cursor-pointer rounded-control border-0 bg-transparent p-0 text-left disabled:pointer-events-none disabled:opacity-40\",\n quiet\n ? \"underline-offset-2 hover:text-tint hover:underline focus-visible:text-tint focus-visible:underline\"\n : \"text-tint hover:brightness-125 active:brightness-90\",\n className,\n )}\n {...props}\n />\n );\n});\n","import * as React from \"react\";\n\nimport { TooltipContent as BaseTooltipContent, type TooltipContentProps } from \"../tooltip\";\n\n/**\n * The desktop tooltip opens BELOW its control, as macOS draws them (the pointer sits on the\n * control, the hint hangs under it): a tooltip above a row near the top would cover the toolbar.\n * In a vertical stack (an icon column, a list) it opens beside the control instead, never over the\n * next one (THE SMART SIDE, title-tooltips.ts). It flips when there is no room and stays inside the\n * window. A desktop host sets `data-title-side=\"bottom\"` on <html> so `title` tooltips agree.\n */\nexport const TooltipContent = React.forwardRef<React.ComponentRef<typeof BaseTooltipContent>, TooltipContentProps>(\n function TooltipContent({ fallbackSide = \"bottom\", ...props }, ref) {\n return <BaseTooltipContent ref={ref} fallbackSide={fallbackSide} {...props} />;\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:font-sans 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","import * as SelectPrimitive from \"@radix-ui/react-select\";\nimport * as React from \"react\";\n\nimport { ChevronsUpDownIcon } from \"../icons\";\nimport { SelectContent, SelectItem, SelectLabel, SelectSeparator } from \"../select\";\nimport { cn } from \"./cn\";\n\nexport interface SelectOption {\n value: string;\n label: React.ReactNode;\n /** Short trailing text in the menu only (a size, why it cannot be chosen); the trigger shows only `label`. */\n meta?: string;\n /** A section heading: the menu shows it above the first option of each consecutive run with this group. */\n group?: string;\n disabled?: boolean;\n}\n\n/**\n * Options are EXACT: a field this Select does not draw is a type error, never silently dropped (a\n * renderer once handed `group`/`meta` to a Select that had neither, and a whole heading never showed).\n */\nexport type ExactSelectOption<O> = O extends object ? O & { [K in Exclude<keyof O, keyof SelectOption>]: never } : O;\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 /** A value only another place can change (the OS's own pane): the value reads at full strength as\n * the setting it is, only the chevrons dim, and it never opens. `title` says where it changes.\n * Never `disabled` for this: a dimmed value reads as off, the content people came for lost. */\n readOnly?: boolean;\n /** `push` (default): the raised pop-up button. `inline`: System Settings' pop-up in a row's\n * trailing edge (\"Do Nothing ⌃⌄\"): the value as text and the up/down chevrons in a small capsule,\n * no bezel until pressed. */\n appearance?: \"push\" | \"inline\";\n /** The tooltip (why it is off, where it changes). */\n title?: string;\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<O extends SelectOption | \"-\">(props: Omit<SelectProps, \"options\"> & { options: ReadonlyArray<ExactSelectOption<O>> }): React.JSX.Element;\nexport function Select({\n value,\n onValueChange,\n options,\n placeholder,\n size = \"md\",\n disabled,\n readOnly = false,\n appearance = \"push\",\n title,\n id,\n className,\n \"aria-label\": ariaLabel,\n ...data\n}: SelectProps): React.JSX.Element {\n const inline = appearance === \"inline\";\n // Read-only is not disabled: the value keeps the label color; the trigger simply never opens.\n const locked = readOnly && !disabled;\n return (\n <SelectPrimitive.Root {...(value === undefined ? {} : { value })} onValueChange={onValueChange} disabled={(disabled ?? false) || readOnly}>\n <SelectPrimitive.Trigger\n {...data}\n id={id}\n aria-label={ariaLabel}\n title={title}\n data-slot=\"select\"\n data-appearance={appearance}\n data-read-only={locked ? \"\" : undefined}\n aria-readonly={locked || undefined}\n className={cn(\n \"focus-ring inline-flex min-w-0 items-center justify-between gap-2 rounded-control text-label data-[placeholder]:text-label-secondary\",\n inline\n ? cn(\"bg-transparent pl-1.5 pr-0.5\", locked ? \"cursor-default\" : \"hover:bg-fill-secondary disabled:text-label-tertiary disabled:hover:bg-transparent\")\n : cn(\"bg-control pl-2.5 pr-1.5 shadow-control\", locked ? \"cursor-default\" : \"hover:bg-fill-secondary disabled:opacity-40\"),\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 {inline ? (\n <span data-slot=\"select-chevrons\" className={cn(\"flex size-icon-lg shrink-0 items-center justify-center rounded-full bg-fill-secondary text-label-secondary\", locked && \"opacity-40\")}>\n <ChevronsUpDownIcon className=\"size-icon-sm\" />\n </span>\n ) : (\n <ChevronsUpDownIcon data-slot=\"select-chevrons\" className={cn(\"size-icon-sm shrink-0 text-label-secondary\", locked && \"opacity-40\")} />\n )}\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n {/* NSMenu draws no keyboard-focus outline around a pop-up's menu: the highlighted item is the\n focus. The open list takes focus, so its own outline is removed (the browser's default ring\n drew a white frame around the whole menu). */}\n <SelectContent data-slot=\"select-menu\" className=\"outline-none focus:outline-none focus-visible:outline-none\">\n {menuRuns(options).map((run, index) =>\n run === \"-\" ? (\n <SelectSeparator key={`sep-${index}`} />\n ) : run.group === undefined ? (\n run.items.map(item)\n ) : (\n <SelectPrimitive.Group key={`group-${index}`} data-slot=\"select-group\">\n <SelectLabel data-slot=\"select-group-heading\">{run.group}</SelectLabel>\n {run.items.map(item)}\n </SelectPrimitive.Group>\n ),\n )}\n </SelectContent>\n </SelectPrimitive.Root>\n );\n}\n\nfunction item(option: SelectOption): React.JSX.Element {\n return (\n <SelectItem key={option.value} value={option.value} disabled={option.disabled ?? false} meta={option.meta} {...(option.meta ? { title: option.meta } : {})}>\n {option.label}\n </SelectItem>\n );\n}\n\ntype MenuRun = \"-\" | { group: string | undefined; items: SelectOption[] };\n\n/** Options as the menu draws them: separators, and consecutive runs of one group (a heading over each grouped run, a separator before it). */\nfunction menuRuns(options: ReadonlyArray<SelectOption | \"-\">): MenuRun[] {\n const runs: MenuRun[] = [];\n for (const option of options) {\n const last = runs[runs.length - 1];\n if (option === \"-\") {\n if (last !== undefined && last !== \"-\") runs.push(\"-\");\n continue;\n }\n if (last !== undefined && last !== \"-\" && last.group === option.group) {\n last.items.push(option);\n continue;\n }\n if (option.group !== undefined && last !== undefined && last !== \"-\") runs.push(\"-\");\n runs.push({ group: option.group, items: [option] });\n }\n return runs;\n}\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 /** The chosen segment fills with the accent (System Settings' tab-like switches: Sound's Output |\n * Input, Screen Time's Day | Week); the default is the toolbar's neutral raised segment. */\n prominent?: boolean;\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 prominent = false,\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={cn(\n \"focus-ring inline-flex min-w-0 flex-1 items-center justify-center gap-1 whitespace-nowrap rounded-control px-2.5 transition-colors duration-100 disabled:opacity-40 [&_svg]:size-icon-sm\",\n prominent\n ? \"text-label hover:text-label data-[state=on]:bg-tint data-[state=on]:text-tint-label\"\n : \"text-label-secondary hover:text-label data-[state=on]:bg-control data-[state=on]:text-label data-[state=on]:shadow-control\",\n )}\n >\n {segment.label}\n </ToggleGroup.Item>\n ))}\n </ToggleGroup.Root>\n );\n}\n","import * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\nimport * as SwitchPrimitive from \"@radix-ui/react-switch\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\n/**\n * The macOS checkbox (NSButton, checkbox style, regular size): a 14 px rounded square on the\n * control surface with a hairline edge; checked or mixed, it fills with the tint and draws a white\n * glyph. Disabled dims to 40 %. The keyboard ring is the one focus ring.\n */\nexport interface CheckboxProps extends React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root> {}\n\nexport const Checkbox = React.forwardRef<React.ComponentRef<typeof CheckboxPrimitive.Root>, CheckboxProps>(function Checkbox(\n { className, checked, ...props },\n ref,\n) {\n return (\n <CheckboxPrimitive.Root\n ref={ref}\n {...(checked === undefined ? {} : { checked })}\n data-slot=\"checkbox\"\n className={cn(\n \"focus-ring peer inline-flex size-checkbox shrink-0 items-center justify-center rounded-checkbox bg-control text-tint-label shadow-control\",\n \"data-[state=checked]:bg-tint data-[state=checked]:shadow-none data-[state=indeterminate]:bg-tint data-[state=indeterminate]:shadow-none\",\n \"disabled:cursor-default disabled:opacity-40\",\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator data-slot=\"checkbox-indicator\" className=\"flex items-center justify-center\">\n {checked === \"indeterminate\" ? (\n <svg viewBox=\"0 0 10 10\" className=\"size-2.5\" aria-hidden>\n <path d=\"M2 5h6\" stroke=\"currentColor\" strokeWidth={1.75} strokeLinecap=\"round\" fill=\"none\" />\n </svg>\n ) : (\n <svg viewBox=\"0 0 10 10\" className=\"size-2.5\" aria-hidden>\n <path d=\"M2 5.2 4.1 7.3 8 2.8\" stroke=\"currentColor\" strokeWidth={1.75} strokeLinecap=\"round\" strokeLinejoin=\"round\" fill=\"none\" />\n </svg>\n )}\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n});\n\n/**\n * The macOS switch (NSSwitch, small): a 32 × 18 capsule. Off is a neutral track with the knob at\n * the left; on fills with the tint and slides the knob right, so the state reads at a glance\n * without color (position) and with it (tint). `size=\"sm\"` is the 26 × 15 mini size.\n */\nexport interface SwitchProps extends React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root> {\n /** `md` (default) is NSSwitch small, 32 × 18; `sm` is mini, 26 × 15 (rows and tables). */\n size?: \"sm\" | \"md\";\n}\n\nexport const Switch = React.forwardRef<React.ComponentRef<typeof SwitchPrimitive.Root>, SwitchProps>(function Switch(\n { className, size = \"md\", ...props },\n ref,\n) {\n return (\n <SwitchPrimitive.Root\n ref={ref}\n data-slot=\"switch\"\n data-size={size}\n className={cn(\n \"focus-ring peer inline-flex shrink-0 items-center rounded-full p-px transition-colors duration-150\",\n \"bg-fill-tertiary data-[state=checked]:bg-tint disabled:cursor-default disabled:opacity-40\",\n size === \"sm\" ? \"h-switch-mini-h w-switch-mini\" : \"h-switch-h w-switch\",\n className,\n )}\n {...props}\n >\n <SwitchPrimitive.Thumb\n data-slot=\"switch-thumb\"\n className={cn(\n \"pointer-events-none block rounded-full bg-knob shadow-control transition-transform duration-150 data-[state=unchecked]:translate-x-0\",\n size === \"sm\" ? \"size-switch-knob-mini data-[state=checked]:translate-x-switch-travel-mini\" : \"size-switch-knob data-[state=checked]:translate-x-switch-travel\",\n )}\n />\n </SwitchPrimitive.Root>\n );\n});\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { intoToolbar, useToolbarAdoption } from \"./native\";\nimport { Text } from \"./text\";\n\nexport type PageWidth = \"form\" | \"wide\" | \"full\";\n\n/** Every page uses the whole window (Arman, 2026-10-06: \"I need those pages to be full width so I\n * can use them\"). The prop stays for callers; no width narrows a page. */\nconst WIDTH: Record<PageWidth, string> = {\n form: \"max-w-none\",\n wide: \"max-w-none\",\n full: \"max-w-none\",\n};\n\nexport interface PageProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Kept for callers; every page fills the window whatever it says. */\n width?: PageWidth;\n /** The page header; drawn at the top of the scrolling column. */\n header?: React.ReactNode;\n /** Banners (errors, \"Not live\", a result, a selection bar). They sit in the page's foot bar, in\n * the layout flow, never over content; the scrolling column's top never moves when one appears\n * or goes. The lint refuses a Banner anywhere else on a page. */\n notices?: React.ReactNode;\n /** A leading source list inside the page (Console's devices and reports, System Information's\n * categories): a fixed column with its own scroll, a hairline on its trailing edge. */\n sidebar?: React.ReactNode;\n /** A bar fixed above the scrolling column (Console's scope bar: All Messages · Errors and Faults). */\n scopeBar?: React.ReactNode;\n /** A pane fixed below the scrolling column (Activity Monitor's summary strip, Console's detail\n * pane, Finder's path bar). It never scrolls away and never moves the column's top. */\n footer?: React.ReactNode;\n /** No margins: the column's first child (a table) starts right under the toolbar and runs edge to\n * edge, as Activity Monitor's and Console's tables do. */\n flush?: boolean;\n}\n\n/**\n * Banners in the layout flow: one stack, in the place its container gives it, never floating over\n * content (HIG: a notice never covers what it is about). Page draws one as its foot bar, below the\n * scrolling column, so a notice appearing moves nothing that is already on screen: the column's\n * top stays put and only its visible foot gets shorter. Empty, it draws nothing.\n */\nfunction hasNotices(children: React.ReactNode): boolean {\n // A fragment of conditionals (`<>{a ? <Banner/> : null}</>`) counts only what it really draws.\n return React.Children.toArray(children).some((c) => (React.isValidElement(c) && c.type === React.Fragment ? hasNotices((c.props as { children?: React.ReactNode }).children) : Boolean(c)));\n}\n\nexport function Notices({ children, className, onHeight, ...props }: React.HTMLAttributes<HTMLDivElement> & { onHeight?: (height: number) => void }) {\n const stack = React.useRef<HTMLDivElement>(null);\n const drawn = hasNotices(children);\n // Reports what the stack really occupies (0 when nothing it holds draws anything).\n React.useLayoutEffect(() => {\n const el = stack.current;\n if (!onHeight) return;\n if (!el) return onHeight(0);\n const report = () => onHeight(el.offsetHeight);\n report();\n if (typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(report);\n observer.observe(el);\n return () => {\n observer.disconnect();\n onHeight(0);\n };\n }, [onHeight, drawn]);\n if (!drawn) return null;\n return (\n <div ref={stack} data-slot=\"notices\" aria-live=\"polite\" className={cn(\"flex shrink-0 flex-col gap-2 empty:hidden\", className)} {...props}>\n {children}\n </div>\n );\n}\n\n/**\n * The message slot of a dialog, sheet or any surface that cannot float its notices: a fixed-height\n * box that is always there, so an error appearing in it (or leaving) moves nothing around it.\n * One banner fits; a longer one is clipped to the slot, never grown.\n */\nexport function NoticeSlot({ children, className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div data-slot=\"notice-slot\" aria-live=\"polite\" className={cn(\"h-16 shrink-0 overflow-hidden [&>*]:h-full [&>*]:overflow-hidden\", className)} {...props}>\n {children}\n </div>\n );\n}\n\n/**\n * One scrolling content page: 20 px window margins, the HIG spacing scale (20 px between groups),\n * and its notices in a foot bar below the scrolling column (see Notices).\n */\nexport const Page = React.forwardRef<HTMLDivElement, PageProps>(function Page(\n { width = \"wide\", header, notices, sidebar, scopeBar, footer, flush, className, children, ...props },\n ref,\n) {\n const frame = (\n // The frame is always there (with or without notices), so a notice never remounts the page.\n <div data-slot=\"page-frame\" className=\"flex h-full min-w-0 flex-1 flex-col bg-content\">\n {scopeBar ? (\n <div data-slot=\"page-scope-bar\" className=\"flex h-control-lg shrink-0 items-center gap-2 border-b border-separator px-3\">\n {scopeBar}\n </div>\n ) : null}\n <div ref={ref} data-slot=\"page\" data-flush={flush || undefined} className={cn(\"min-h-0 flex-1 overflow-y-auto bg-content\", className)} {...props}>\n <div className={cn(\"flex w-full flex-col\", flush ? \"min-h-full\" : \"gap-5 px-5 pb-5 pt-3\", WIDTH[width])}>\n {header}\n {children}\n </div>\n </div>\n {footer ? (\n <div data-slot=\"page-footer\" className=\"flex shrink-0 flex-col border-t border-separator bg-content\">\n {footer}\n </div>\n ) : null}\n <Notices data-page-notices=\"\" className=\"border-t border-separator px-5 py-3\">\n {notices}\n </Notices>\n </div>\n );\n if (!sidebar) return frame;\n return (\n <div data-slot=\"page-split\" className=\"flex h-full bg-content\">\n <aside data-slot=\"page-sidebar\" className=\"flex w-44 shrink-0 flex-col overflow-y-auto border-r border-separator py-2\">\n {sidebar}\n </aside>\n {frame}\n </div>\n );\n});\n\nexport interface PageHeaderProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** Omit when the window's toolbar already names this page (System Settings: the toolbar is the\n * title). The header then keeps its height and carries the subtitle and actions alone. */\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 /** In the window's toolbar, this page's controls are the whole toolbar (Activity Monitor, Console:\n * Stop and Inspect, the view switch, the search field). The host folds its own app-wide items\n * into one More button (`useWindowToolbarFull`), so nothing it adds crowds the page's controls. */\n fullToolbar?: boolean;\n /** The page draws its own large title (Reminders' list name in its color, Notes' folder): the\n * window's toolbar then draws no title of its own, so the name is never said twice. */\n largeTitle?: boolean;\n /** The page's actions end in its own ⋯ menu (Finder's Action menu), which carries the host's\n * app-wide items at its end (`WindowToolbarHostMenu`): the host then draws no ⋯ of its own. */\n ownsMore?: boolean;\n}\n\nexport function PageHeader({ title, subtitle, icon, actions, fullToolbar, largeTitle, ownsMore, className, ...props }: PageHeaderProps) {\n // Inside a WindowToolbarProvider (the window's unified toolbar), a header the toolbar already names\n // moves into the toolbar: its subtitle under the window title, its actions on the trailing side.\n const toolbar = useToolbarAdoption(!title && !icon, fullToolbar ?? false, largeTitle ?? false, ownsMore ?? false);\n if (toolbar) {\n return (\n <>\n {subtitle ? intoToolbar(<span data-slot=\"page-header-subtitle\">{subtitle}</span>, toolbar.subtitle) : null}\n {actions\n ? intoToolbar(\n <div data-slot=\"page-header-actions\" className=\"flex min-w-0 items-center gap-2\">\n {actions}\n </div>,\n toolbar.actions,\n )\n : null}\n </>\n );\n }\n return (\n <header data-slot=\"page-header\" className={cn(\"flex items-center gap-3\", actions && \"min-h-control-lg\", 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 {title ? (\n <Text as=\"h1\" variant=\"title-2\" truncate>\n {title}\n </Text>\n ) : null}\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 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\";\nimport { createPortal } from \"react-dom\";\n\nimport { Dialog } from \"../dialog\";\nimport { Tooltip, TooltipTrigger } from \"../tooltip\";\nimport { Button } from \"./button\";\nimport { cn } from \"./cn\";\nimport { Checkbox } from \"./controls\";\nimport { DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from \"./sheet\";\nimport { TooltipContent } from \"./tooltip\";\nimport { useScrollFade } from \"../use-scroll-fade\";\n\n/**\n * The window layer of the desktop standard: OS-drawn symbols, the unified toolbar a title-less\n * PageHeader moves into, and the navigator column of the window's areas. A symbol draws its fallback\n * until a `SymbolProvider` resolves it (Windows and Linux keep the Lucide fallback), and a\n * `PageHeader` stays in the page until a `WindowToolbarProvider` gives it a toolbar to move into.\n */\n\n/* ---------------------------------------------------------------------------------------------- */\n/* System symbols (SF Symbols drawn by the OS) */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport type SymbolWeight = \"ultralight\" | \"thin\" | \"light\" | \"regular\" | \"medium\" | \"semibold\" | \"bold\" | \"heavy\" | \"black\";\n\n/** A rendered symbol: an image URL (drawn as a mask in the current text color) and its size in points. */\nexport interface SymbolImage {\n url: string;\n width: number;\n height: number;\n}\n\n/** Renders `name` at `pointSize` and `weight`, or resolves null when this OS has no such symbol. */\nexport type SymbolResolver = (name: string, pointSize: number, weight: SymbolWeight) => Promise<SymbolImage | null>;\n\nconst SymbolContext = React.createContext<SymbolResolver | null>(null);\n/** Per resolver: settled images (null = missing) and the renders in flight. */\nconst symbolCache = new WeakMap<SymbolResolver, Map<string, SymbolImage | null | Promise<SymbolImage | null>>>();\n\nfunction cacheFor(resolve: SymbolResolver): Map<string, SymbolImage | null | Promise<SymbolImage | null>> {\n let cache = symbolCache.get(resolve);\n if (!cache) symbolCache.set(resolve, (cache = new Map()));\n return cache;\n}\n\n/** The host's symbol renderer (Matrx 2: Electron `nativeImage.createFromNamedImage` in main). */\nexport function SymbolProvider({ resolve, children }: { resolve: SymbolResolver | null; children: React.ReactNode }) {\n return <SymbolContext.Provider value={resolve}>{children}</SymbolContext.Provider>;\n}\n\nexport interface SystemSymbolProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** The SF Symbol name (\"folder\", \"chevron.left\"). Omit to draw the fallback. */\n name?: string | undefined;\n /** Drawn where there is no symbol renderer (Windows, Linux, the web) or the name is missing. */\n fallback: React.ReactNode;\n /** Point size of the symbol's font (13 = body). */\n size?: number;\n weight?: SymbolWeight;\n}\n\n/**\n * An SF Symbol rendered by the OS at the size and weight asked for, cached, drawn in `currentColor`.\n * Without a renderer, or for a name this OS lacks, it draws `fallback` (a Lucide icon) instead, so\n * every platform shows an icon in the same place.\n */\nexport function SystemSymbol({ name, fallback, size = 13, weight = \"regular\", className, style, ...props }: SystemSymbolProps) {\n const resolve = React.useContext(SymbolContext);\n const key = `${name ?? \"\"}|${size}|${weight}`;\n const read = (): SymbolImage | null | undefined => {\n if (!resolve || !name) return null;\n const hit = cacheFor(resolve).get(key);\n return hit instanceof Promise ? undefined : hit;\n };\n const [image, setImage] = React.useState<SymbolImage | null | undefined>(read);\n React.useEffect(() => {\n const now = read();\n setImage(now);\n if (now !== undefined || !resolve || !name) return;\n const cache = cacheFor(resolve);\n let pending = cache.get(key);\n if (!(pending instanceof Promise)) {\n pending = resolve(name, size, weight).catch(() => null);\n cache.set(key, pending);\n void pending.then((result) => cache.set(key, result));\n }\n let live = true;\n void pending.then((result) => {\n if (live) setImage(result);\n });\n return () => {\n live = false;\n };\n // `read` closes over these same inputs.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [resolve, key]);\n\n // The layout box is the point size, square, from the first frame to the last: the OS image (often\n // wider or taller than its point size) is centered over it and may overflow it, never resize it,\n // so nothing around a symbol moves when the image arrives or the name turns out missing.\n const box: React.CSSProperties = { width: size, height: size, ...style };\n if (image === null) {\n return (\n <span\n data-slot=\"system-symbol\"\n data-symbol-fallback={name ?? \"\"}\n className={cn(\"inline-flex shrink-0 items-center justify-center\", className)}\n style={resolve && name ? box : style}\n {...props}\n >\n {fallback}\n </span>\n );\n }\n return (\n <span\n aria-hidden\n data-slot=\"system-symbol\"\n data-symbol={name}\n data-pending={image === undefined || undefined}\n className={cn(\"relative inline-block shrink-0\", className)}\n style={box}\n {...props}\n >\n {image ? (\n <span\n data-symbol-image\n className=\"pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-current\"\n style={{\n width: image.width,\n height: image.height,\n maskImage: `url(\"${image.url}\")`,\n WebkitMaskImage: `url(\"${image.url}\")`,\n maskSize: \"100% 100%\",\n WebkitMaskSize: \"100% 100%\",\n maskRepeat: \"no-repeat\",\n WebkitMaskRepeat: \"no-repeat\",\n }}\n />\n ) : null}\n </span>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* The window's unified toolbar: a title-less PageHeader moves into it */\n/* ---------------------------------------------------------------------------------------------- */\n\ninterface ToolbarStore {\n subtitle: HTMLElement | null;\n actions: HTMLElement | null;\n setSubtitle: (el: HTMLElement | null) => void;\n setActions: (el: HTMLElement | null) => void;\n /** Only one header owns the toolbar: the first mounted; the next takes over when it goes. */\n claim: (id: string, full: boolean, untitled?: boolean, ownsMore?: boolean) => void;\n release: (id: string) => void;\n owner: string | null;\n /** The owning header fills the whole toolbar (`PageHeader fullToolbar`). */\n full: boolean;\n /** The owning page draws its own large title (Reminders, Notes): the toolbar shows none. */\n untitled: boolean;\n /** The owning page draws its own ⋯ menu, and it carries the host's items (`WindowToolbarHostMenu`). */\n ownsMore: boolean;\n /** The host's app-wide toolbar items as menu items, for a page whose ⋯ menu carries them. */\n hostMenu: React.ReactNode;\n}\n\nconst WindowToolbarContext = React.createContext<ToolbarStore | null>(null);\n\n/**\n * Makes the window's unified toolbar the home of every title-less `PageHeader` (AppKit: the toolbar\n * IS the page's header — its subtitle sits under the window title, its search and view switch on\n * the toolbar's trailing side). The targets are `WindowToolbarTitle` and `WindowToolbarActions`;\n * their refs are stable, so a field moved into the toolbar keeps focus across renders.\n */\nexport function WindowToolbarProvider({ children, hostMenu = null }: { children: React.ReactNode; hostMenu?: React.ReactNode }) {\n const [subtitle, setSubtitle] = React.useState<HTMLElement | null>(null);\n const [actions, setActions] = React.useState<HTMLElement | null>(null);\n const [claims, setClaims] = React.useState<ReadonlyArray<{ id: string; full: boolean; untitled: boolean; ownsMore: boolean }>>([]);\n const claim = React.useCallback(\n // A header already claiming keeps its place in the queue; only its flags change.\n (id: string, full: boolean, untitled = false, ownsMore = false) =>\n setClaims((c) =>\n c.some((x) => x.id === id)\n ? c.some((x) => x.id === id && x.full === full && x.untitled === untitled && x.ownsMore === ownsMore)\n ? c\n : c.map((x) => (x.id === id ? { id, full, untitled, ownsMore } : x))\n : [...c, { id, full, untitled, ownsMore }],\n ),\n [],\n );\n const release = React.useCallback((id: string) => setClaims((c) => c.filter((x) => x.id !== id)), []);\n const value = React.useMemo<ToolbarStore>(\n () => ({\n subtitle,\n actions,\n setSubtitle,\n setActions,\n claim,\n release,\n owner: claims[0]?.id ?? null,\n full: claims[0]?.full ?? false,\n untitled: claims[0]?.untitled ?? false,\n ownsMore: claims[0]?.ownsMore ?? false,\n hostMenu,\n }),\n [subtitle, actions, claim, release, claims, hostMenu],\n );\n return <WindowToolbarContext.Provider value={value}>{children}</WindowToolbarContext.Provider>;\n}\n\n/** The toolbar slots a `PageHeader` with no title renders into, when it owns the toolbar. `full`:\n * the header's controls are the whole toolbar (see `useWindowToolbarFull`); `untitled`: the page\n * draws its own large title, so the toolbar draws none (Reminders, Notes). */\nexport function useToolbarAdoption(adoptable: boolean, full = false, untitled = false, ownsMore = false): { subtitle: HTMLElement; actions: HTMLElement } | null {\n const toolbar = React.useContext(WindowToolbarContext);\n const id = React.useId();\n const claim = toolbar?.claim;\n const release = toolbar?.release;\n React.useLayoutEffect(() => {\n if (!adoptable || !claim || !release) return;\n claim(id, full, untitled, ownsMore);\n return () => release(id);\n }, [adoptable, full, untitled, ownsMore, claim, release, id]);\n if (!adoptable || !toolbar || toolbar.owner !== id || !toolbar.subtitle || !toolbar.actions) return null;\n return { subtitle: toolbar.subtitle, actions: toolbar.actions };\n}\n\n/**\n * True while the page that owns the window's toolbar fills it with its own controls (Activity\n * Monitor, Console: Stop and Inspect, the view switch, the search field — and nothing the app adds).\n * The host then folds its own app-wide toolbar items into one More button, so the page's view\n * switch and search field keep their room and their place on every view.\n */\nexport function useWindowToolbarFull(): boolean {\n return React.useContext(WindowToolbarContext)?.full ?? false;\n}\n\n/**\n * True while the page that owns the toolbar draws its own ⋯ menu (Finder's Action menu) and that\n * menu carries the host's items: the host then draws no ⋯ of its own, so the toolbar never shows\n * two ellipses side by side.\n */\nexport function useWindowToolbarOwnsMore(): boolean {\n const toolbar = React.useContext(WindowToolbarContext);\n return (toolbar?.ownsMore ?? false) && toolbar?.hostMenu !== null && toolbar?.hostMenu !== undefined;\n}\n\n/**\n * The host's app-wide toolbar items, as menu items, placed at the end of a page's own ⋯ menu\n * (`PageHeader ownsMore`). Nothing when the host gives none.\n */\nexport function WindowToolbarHostMenu(): React.ReactNode {\n return React.useContext(WindowToolbarContext)?.hostMenu ?? null;\n}\n\n/** Portals `node` into `target` (a toolbar slot). */\nexport function intoToolbar(node: React.ReactNode, target: HTMLElement): React.ReactPortal {\n return createPortal(node, target);\n}\n\nexport interface WindowToolbarTitleProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** The window title: the open place (Finder's folder, System Settings' pane). */\n title: React.ReactNode;\n}\n\n/**\n * The toolbar's title block (NSWindow title in a unified toolbar): the title, and under it the\n * subtitle the open page's header hands up. AppKit metrics: 15 pt bold alone; 13 pt bold over an\n * 11 pt secondary subtitle.\n */\nexport function WindowToolbarTitle({ title, className, ...props }: WindowToolbarTitleProps) {\n const toolbar = React.useContext(WindowToolbarContext);\n // A page with its own large title (Reminders' list name): the window keeps its title for the\n // Window menu and assistive tech, but the toolbar draws none, so the name is never said twice.\n const untitled = toolbar?.untitled === true;\n return (\n // As narrow as its title, never narrower: the subtitle gives way first (desktop.css), so the\n // page's controls keep their room and the title is never cut.\n <div data-slot=\"window-toolbar-title\" data-untitled={untitled || undefined} className={cn(\"flex min-w-min flex-col justify-center\", className)} {...props}>\n <span data-slot=\"window-title\" className={cn(\"truncate text-label\", untitled && \"sr-only\")}>\n {title}\n </span>\n <span ref={toolbar?.setSubtitle} data-slot=\"window-subtitle\" className=\"text-label-secondary empty:hidden\" />\n </div>\n );\n}\n\n/** Where the open page's header actions (search, its one view switch, its main action) land. */\nexport function WindowToolbarActions({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n const toolbar = React.useContext(WindowToolbarContext);\n // min-w-0: the search field inside may give way (its 220 pt is a wish, not a minimum).\n return <div ref={toolbar?.setActions} data-slot=\"window-toolbar-actions\" className={cn(\"flex min-w-0 shrink-0 items-center gap-2 empty:hidden\", className)} {...props} />;\n}\n\n/** A capsule of related toolbar buttons (Finder's back/forward pair). */\nexport function ToolbarGroup({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return <div role=\"group\" data-slot=\"toolbar-group\" className={cn(\"flex h-control-lg shrink-0 items-center rounded-full bg-fill px-0.5\", className)} {...props} />;\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Navigator column: the areas down the sidebar panel's leading edge */\n/* ---------------------------------------------------------------------------------------------- */\n\n/**\n * The window's areas as one column of icons down the leading edge of the sidebar panel, the open\n * area's list beside it, in one panel: any number of areas (it scrolls), never a separate activity\n * bar. Up/Down move between them; right-click is the host's (Customize…).\n */\nexport function NavigatorColumn({ className, onKeyDown, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n // More areas than fit scroll under a soft edge with the scroller hidden (as the source list).\n const fade = useScrollFade();\n return (\n <div\n ref={fade.ref}\n data-fade-top={fade.fadeProps[\"data-fade-top\"]}\n data-fade-bottom={fade.fadeProps[\"data-fade-bottom\"]}\n role=\"tablist\"\n aria-orientation=\"vertical\"\n data-slot=\"navigator-column\"\n className={cn(\"flex min-h-0 shrink-0 flex-col items-center gap-1 overflow-y-auto overflow-x-hidden\", className)}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || ![\"ArrowUp\", \"ArrowDown\", \"Home\", \"End\"].includes(event.key)) return;\n const tabs = Array.from(event.currentTarget.querySelectorAll<HTMLElement>(`[data-slot=navigator-item]`));\n const at = tabs.indexOf(document.activeElement as HTMLElement);\n if (at === -1) return;\n const next = event.key === \"Home\" ? 0 : event.key === \"End\" ? tabs.length - 1 : at + (event.key === \"ArrowDown\" ? 1 : -1);\n const target = tabs[Math.max(0, Math.min(tabs.length - 1, next))];\n if (target) {\n event.preventDefault();\n target.focus();\n }\n }}\n {...props}\n />\n );\n}\n\nexport interface NavigatorItemProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"aria-label\"> {\n icon: React.ReactNode;\n /** Required: the accessible name and the tooltip. */\n label: string;\n shortcut?: string | undefined;\n /** The open area: the accent with a white symbol in the key window (the open row's selection). */\n active?: boolean;\n /** A small corner dot: this area has something for the person (a session running, new output). */\n dot?: \"tint\" | \"warning\" | \"danger\" | undefined;\n}\n\nexport const NavigatorItem = React.forwardRef<HTMLButtonElement, NavigatorItemProps>(function NavigatorItem(\n { icon, label, shortcut, active, dot, className, type = \"button\", ...props },\n ref,\n) {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n ref={ref}\n type={type}\n role=\"tab\"\n aria-selected={Boolean(active)}\n aria-label={label}\n tabIndex={active ? 0 : -1}\n data-slot=\"navigator-item\"\n data-active={active || undefined}\n className={cn(\n \"focus-ring relative flex size-navigator-item shrink-0 items-center justify-center rounded-control text-label-secondary transition-colors duration-100 hover:bg-fill hover:text-label\",\n active && \"bg-selection-muted text-label hover:bg-selection-muted\",\n className,\n )}\n {...props}\n >\n {icon}\n {dot ? (\n <span\n aria-hidden\n data-navigator-dot={dot}\n className={cn(\n \"pointer-events-none absolute right-0.5 top-0.5 size-1.5 rounded-full\",\n dot === \"tint\" ? \"bg-tint\" : dot === \"warning\" ? \"bg-system-orange\" : \"bg-system-red\",\n )}\n />\n ) : null}\n </button>\n </TooltipTrigger>\n {/* Beside the icon, not under it: the column is vertical, so a tooltip below would cover the\n next icon (Codex, Xcode's navigator). */}\n <TooltipContent side=\"right\">\n {label}\n {shortcut ? <span className=\"ml-2 opacity-60\">{shortcut}</span> : null}\n </TooltipContent>\n </Tooltip>\n );\n});\n\n/** One area as the Customize sheet lists it. */\nexport interface NavigatorCustomizeItem {\n id: string;\n label: string;\n icon: React.ReactNode;\n hidden: boolean;\n}\n\nexport interface NavigatorCustomizeSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Every area, in the person's order, hidden ones included. */\n items: ReadonlyArray<NavigatorCustomizeItem>;\n /** The new order and visibility, on every change (it applies at once, as Finder's do). */\n onChange: (items: NavigatorCustomizeItem[]) => void;\n onRestoreDefaults: () => void;\n title?: string;\n}\n\nconst CUSTOMIZE_ROW = `[data-customize-item]`;\n\n/** Moves the item at `from` to `to`. */\nexport function moveItem<T>(list: ReadonlyArray<T>, from: number, to: number): T[] {\n const next = [...list];\n const [item] = next.splice(from, 1);\n if (item === undefined) return next;\n next.splice(Math.max(0, Math.min(next.length, to)), 0, item);\n return next;\n}\n\n/**\n * Customize the areas (Safari's and Finder's toolbar customization): drag a row to reorder it\n * (or Option-Up/Down on a focused row), uncheck it to hide it; changes apply at once. One area\n * always stays shown. Restore Defaults puts back the built-in order with every area shown.\n */\nexport function NavigatorCustomizeSheet({ open, onOpenChange, items, onChange, onRestoreDefaults, title = \"Customize Areas\" }: NavigatorCustomizeSheetProps) {\n const list = React.useRef<HTMLDivElement>(null);\n const [dragging, setDragging] = React.useState<string | null>(null);\n const shown = items.filter((i) => !i.hidden).length;\n const startDrag = (event: React.PointerEvent<HTMLElement>, id: string) => {\n if (event.button !== 0) return;\n const rows = Array.from(list.current?.querySelectorAll<HTMLElement>(CUSTOMIZE_ROW) ?? []);\n const height = rows[0]?.getBoundingClientRect().height ?? 32;\n const handle = event.currentTarget;\n handle.setPointerCapture(event.pointerId);\n event.preventDefault();\n let origin = event.clientY;\n let current = [...items];\n setDragging(id);\n const move = (e: PointerEvent) => {\n const steps = Math.trunc((e.clientY - origin) / height);\n if (steps === 0) return;\n const from = current.findIndex((i) => i.id === id);\n const to = Math.max(0, Math.min(current.length - 1, from + steps));\n if (to === from) return;\n origin += (to - from) * height;\n current = moveItem(current, from, to);\n onChange(current);\n };\n const up = () => {\n setDragging(null);\n handle.removeEventListener(\"pointermove\", move);\n handle.removeEventListener(\"pointerup\", up);\n handle.removeEventListener(\"pointercancel\", up);\n };\n handle.addEventListener(\"pointermove\", move);\n handle.addEventListener(\"pointerup\", up);\n handle.addEventListener(\"pointercancel\", up);\n };\n return (\n <Dialog modal open={open} onOpenChange={onOpenChange}>\n <DialogContent data-navigator-customize=\"\" className=\"max-w-form\">\n <DialogHeader>\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>Drag to reorder. Uncheck to hide.</DialogDescription>\n </DialogHeader>\n <div ref={list} role=\"list\" aria-label=\"Areas\" className=\"flex max-h-96 flex-col overflow-y-auto rounded-group bg-group p-1\">\n {items.map((item, index) => (\n <div\n key={item.id}\n role=\"listitem\"\n tabIndex={0}\n data-customize-item={item.id}\n data-hidden={item.hidden || undefined}\n data-dragging={dragging === item.id || undefined}\n aria-label={`${item.label}${item.hidden ? \", hidden\" : \"\"}`}\n onPointerDown={(event) => {\n if ((event.target as HTMLElement).closest(\"button\")) return;\n startDrag(event, item.id);\n }}\n onKeyDown={(event) => {\n if (!event.altKey || (event.key !== \"ArrowUp\" && event.key !== \"ArrowDown\")) return;\n event.preventDefault();\n const to = index + (event.key === \"ArrowUp\" ? -1 : 1);\n if (to < 0 || to >= items.length) return;\n onChange(moveItem(items, index, to));\n requestAnimationFrame(() => list.current?.querySelector<HTMLElement>(`[data-customize-item=\"${item.id}\"]`)?.focus());\n }}\n className={cn(\n \"focus-ring flex h-sidebar-row cursor-grab items-center gap-2 rounded-control px-2 text-body text-label active:cursor-grabbing\",\n dragging === item.id && \"bg-selection-muted\",\n )}\n >\n <Checkbox\n aria-label={`Show ${item.label}`}\n checked={!item.hidden}\n disabled={!item.hidden && shown <= 1}\n onCheckedChange={(on) => onChange(items.map((i) => (i.id === item.id ? { ...i, hidden: on !== true } : i)))}\n />\n <span className={cn(\"flex size-icon shrink-0 items-center justify-center\", item.hidden ? \"text-label-tertiary\" : \"text-label-secondary\")}>{item.icon}</span>\n <span className={cn(\"min-w-0 flex-1 truncate\", item.hidden && \"text-label-secondary\")}>{item.label}</span>\n <span aria-hidden className=\"flex shrink-0 flex-col gap-0.5 text-label-tertiary\">\n <span className=\"block h-px w-3 bg-current\" />\n <span className=\"block h-px w-3 bg-current\" />\n <span className=\"block h-px w-3 bg-current\" />\n </span>\n </div>\n ))}\n </div>\n <DialogFooter>\n <Button data-navigator-restore className=\"mr-auto\" onClick={onRestoreDefaults}>\n Restore Defaults\n </Button>\n <Button data-navigator-done variant=\"primary\" onClick={() => onOpenChange(false)}>\n Done\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n","import * as React from \"react\";\n\nimport type { ConfirmDialogProps } from \"../confirm-dialog\";\nimport {\n Dialog,\n DialogContent as WebDialogContent,\n DialogDescription as WebDialogDescription,\n DialogFooter as WebDialogFooter,\n DialogHeader as WebDialogHeader,\n DialogTitle as WebDialogTitle,\n type DialogContentProps,\n} from \"../dialog\";\nimport { Button } from \"./button\";\nimport { cn } from \"./cn\";\n\n/**\n * The macOS sheet: a rounded panel attached to the window's top edge, under the unified toolbar,\n * that drops down out of the toolbar's foot and goes back up into it (AppKit's sheet\n * presentation), centered across the window, the content color with no edge or shadow, the window\n * behind dimmed (desktop.css), the 20 px window margin inside, body text at 13 pt, no close (×): a sheet is\n * dismissed by its own Cancel / Done buttons or Escape. Inside it, the standard controls keep their\n * standard row density and the one focus ring; a `NoticeSlot` floats over the sheet's foot instead\n * of holding an empty box open.\n */\nexport const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(function DialogContent(\n { className, showCloseButton = false, mobileSheet = false, ...props },\n ref,\n) {\n return (\n <WebDialogContent\n ref={ref}\n data-desktop-sheet=\"\"\n showCloseButton={showCloseButton}\n mobileSheet={mobileSheet}\n animated={false}\n className={cn(\n \"mx-sheet gap-4 rounded-panel border-0 bg-content p-5 font-sans text-body text-label sm:rounded-panel\",\n className,\n )}\n {...props}\n />\n );\n});\n\n/** The sheet's title block: title then one line of description, left-aligned. */\nexport function DialogHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return <WebDialogHeader className={cn(\"gap-1 space-y-0 pr-0 text-left sm:text-left\", className)} {...props} />;\n}\n\n/**\n * The sheet's scrolling body, for a sheet that can outgrow the window (an account's facts and its\n * actions): the sheet sizes to its content up to its max height, the header and the footer's\n * button bar stay put, and only this body scrolls between them. When it holds more than shows, a\n * hairline marks each edge it scrolls under, as System Settings' sheets do; a short body has none.\n */\nexport function DialogBody({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n const ref = React.useRef<HTMLDivElement>(null);\n const [overflowing, setOverflowing] = React.useState(false);\n React.useLayoutEffect(() => {\n const el = ref.current;\n if (!el) return;\n const measure = () => setOverflowing(el.scrollHeight > el.clientHeight + 1);\n measure();\n if (typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(measure);\n observer.observe(el);\n for (const child of Array.from(el.children)) observer.observe(child);\n return () => observer.disconnect();\n }, [children]);\n return (\n <div ref={ref} data-slot=\"sheet-body\" data-overflowing={overflowing ? \"\" : undefined} className={cn(\"flex min-h-0 flex-col gap-4\", className)} {...props}>\n {children}\n </div>\n );\n}\n\n/** The sheet's buttons: trailing, 8 px apart, the default (primary) one rightmost. */\nexport function DialogFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return <WebDialogFooter className={cn(\"flex-row justify-end gap-2 space-x-0 bg-content pt-1 sm:gap-2 sm:space-x-0\", className)} {...props} />;\n}\n\nexport const DialogTitle = React.forwardRef<HTMLHeadingElement, React.ComponentPropsWithoutRef<typeof WebDialogTitle>>(function DialogTitle(\n { className, ...props },\n ref,\n) {\n return <WebDialogTitle ref={ref} className={cn(\"text-headline text-label\", className)} {...props} />;\n});\n\nexport const DialogDescription = React.forwardRef<HTMLParagraphElement, React.ComponentPropsWithoutRef<typeof WebDialogDescription>>(\n function DialogDescription({ className, ...props }, ref) {\n return <WebDialogDescription ref={ref} className={cn(\"text-body text-label-secondary\", className)} {...props} />;\n },\n);\n\n/** A confirmation the host asks with the OS's own alert (Matrx 2: an AppKit sheet on the window). */\nexport interface NativeConfirmRequest {\n title: string;\n message?: string;\n confirmLabel: string;\n cancelLabel: string;\n destructive: boolean;\n}\n/** Resolves true when the person confirmed. */\nexport type NativeConfirm = (request: NativeConfirmRequest) => Promise<boolean>;\n\nconst NativeConfirmContext = React.createContext<NativeConfirm | null>(null);\n\n/**\n * Inside this provider every plain `ConfirmDialog` (a title, an optional text description, no\n * extra content) is asked through `confirm` — the host's native alert sheet, attached to its window\n * (NSAlert via Electron's dialog.showMessageBox with the parent window) — instead of a drawn one.\n * A confirmation that carries its own content keeps the drawn sheet.\n */\nexport function NativeConfirmProvider({ confirm, children }: { confirm: NativeConfirm | null; children: React.ReactNode }) {\n return <NativeConfirmContext.Provider value={confirm}>{children}</NativeConfirmContext.Provider>;\n}\n\n/**\n * The confirmation, as a sheet: the consequence as its description, Cancel then the confirming\n * button (destructive when it loses something), Escape cancels. The same props as the web\n * ConfirmDialog, so a screen swaps nothing but the import. Under a `NativeConfirmProvider` a plain\n * one is the OS's own alert sheet instead.\n */\nexport function ConfirmDialog(props: ConfirmDialogProps) {\n const native = React.useContext(NativeConfirmContext);\n const plain =\n native !== null &&\n props.content === undefined &&\n typeof props.title === \"string\" &&\n (props.description === undefined || typeof props.description === \"string\") &&\n !props.confirmHeld &&\n props.cancelLabel !== null;\n if (native && plain) return <NativeConfirmDialog {...props} confirm={native} />;\n return <DrawnConfirmDialog {...props} />;\n}\n\nfunction NativeConfirmDialog({\n open,\n onOpenChange,\n title,\n description,\n confirmLabel = \"Confirm\",\n cancelLabel = \"Cancel\",\n variant = \"default\",\n onConfirm,\n confirm,\n}: ConfirmDialogProps & { confirm: NativeConfirm }) {\n // Latest handlers, so the one alert in flight answers to the current props.\n const handlers = React.useRef({ onOpenChange, onConfirm });\n handlers.current = { onOpenChange, onConfirm };\n React.useEffect(() => {\n if (!open) return;\n let live = true;\n void confirm({\n title: String(title),\n ...(typeof description === \"string\" ? { message: description } : {}),\n confirmLabel: String(confirmLabel),\n cancelLabel: String(cancelLabel ?? \"Cancel\"),\n destructive: variant === \"destructive\",\n }).then((ok) => {\n if (!live) return;\n // The alert is gone either way: confirmed runs the action first.\n if (ok) void handlers.current.onConfirm();\n handlers.current.onOpenChange(false);\n });\n return () => {\n live = false;\n };\n }, [open, confirm, title, description, confirmLabel, cancelLabel, variant]);\n return null;\n}\n\nfunction DrawnConfirmDialog({\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 <Dialog modal open={open} onOpenChange={onOpenChange}>\n <DialogContent data-confirm-sheet=\"\" role=\"alertdialog\" className={contentClassName} {...(portalContainer !== undefined ? { container: portalContainer } : {})}>\n <DialogHeader>\n <DialogTitle>{title}</DialogTitle>\n {description ? <DialogDescription asChild><div>{description}</div></DialogDescription> : null}\n </DialogHeader>\n {content}\n <DialogFooter>\n {cancelLabel !== null ? (\n <Button disabled={busy} onClick={() => onOpenChange(false)}>\n {cancelLabel}\n </Button>\n ) : null}\n {confirmHeld ? null : (\n <Button\n autoFocus\n variant={variant === \"destructive\" ? \"destructive\" : \"primary\"}\n disabled={busy || confirmDisabled}\n onClick={() => void onConfirm()}\n >\n {confirmLabel}\n </Button>\n )}\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\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\", className)} {...props}>\n {title || actions ? (\n // The title line is only as tall as its controls need: a bare title is one text line, so no\n // dead band opens between sections (HIG: 20 px between groups, 8 px title to group).\n <div className={cn(\"flex items-end gap-2\", actions && \"min-h-control\")}>\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\" && \"overflow-hidden rounded-group bg-group shadow-raised\",\n )}\n >\n {children}\n </div>\n {footer ? (\n <Text as=\"p\" 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 /** `avatar`: a 32 pt slot for a person's or an app's picture (Users & Groups, Internet Accounts),\n * the row as tall as Apple's (54 pt with a subtitle). The default is the 20 pt symbol slot. */\n iconSize?: \"symbol\" | \"avatar\";\n title: React.ReactNode;\n /** Second line under the title; makes the row tall. */\n subtitle?: React.ReactNode;\n /** The subtitle wraps instead of ending in an ellipsis: a reason or a warning is said in full\n * (System Settings' descriptions; Xcode's Welcome rows). A path or a name keeps one line. */\n subtitleWraps?: boolean;\n /** The title wraps instead of ending in an ellipsis: a note row in a group (Bluetooth's\n * \"AirDrop, AirPlay … use Bluetooth.\") is said in full. A name keeps one line. */\n titleWraps?: boolean;\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 *\n * When the row is narrow, AppKit's priorities hold: the value gives way first (it ends in \"…\"),\n * then the title; the accessory's controls never shrink. The title column is as wide as the\n * title itself (the subtitle never widens it), so a short label (\"Pairing code\") stays whole\n * beside a long value and three buttons, and a device's name outlasts its state word. A row\n * whose text wraps keeps its controls on the title's line (Bluetooth's switch), not centered\n * on the paragraph.\n */\nexport const Row = React.forwardRef<HTMLElement, RowProps>(function Row(\n { icon, iconSize = \"symbol\", title, subtitle, subtitleWraps = false, titleWraps = false, 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\n data-slot=\"row-icon\"\n className={cn(\n \"flex shrink-0 items-center justify-center text-label-secondary\",\n iconSize === \"avatar\" ? \"size-icon-xl [&>img]:size-icon-xl [&_svg]:size-icon-lg\" : \"size-icon-lg [&_svg]:size-icon\",\n )}\n >\n {icon}\n </span>\n ) : null}\n {/* flex-auto: the column's basis is the title's own width (the subtitle is contained), so\n the value, which shrinks a thousand times faster, gives way before the title does. */}\n <span data-slot=\"row-text\" className=\"flex min-w-0 flex-auto flex-col\">\n <Text\n tone={destructive ? \"danger\" : \"primary\"}\n mono={mono}\n truncate={!titleWraps}\n data-title-wraps={titleWraps || undefined}\n className={cn(titleWraps && \"contain-inline-size\", selected && \"text-inherit\")}\n >\n {title}\n </Text>\n {subtitle ? (\n <Text\n tone=\"secondary\"\n truncate={!subtitleWraps}\n data-subtitle-wraps={subtitleWraps || undefined}\n className={cn(\"contain-inline-size\", selected && \"text-inherit opacity-80\")}\n >\n {subtitle}\n </Text>\n ) : null}\n </span>\n {value !== undefined && value !== null ? (\n <Text data-slot=\"row-value\" tone=\"secondary\" tabular truncate className={cn(\"min-w-0 max-w-1/2 shrink-1000 text-right\", selected && \"text-inherit opacity-80\")}>\n {value}\n </Text>\n ) : null}\n {accessory ? (\n <span\n data-slot=\"row-accessory\"\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 gap-3 px-3 text-left before:absolute before:right-0 before:top-0 before:hidden before:h-px before:bg-separator\",\n icon ? (iconSize === \"avatar\" ? \"before:left-14\" : \"before:left-11\") : \"before:left-3\",\n // Wrapped text: the icon and the controls sit on the title's line (System Settings' lead rows).\n subtitleWraps || titleWraps ? \"items-start\" : \"items-center\",\n iconSize === \"avatar\" && icon ? \"min-h-row-tall py-2.5\" : 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 { IconButton } from \"./button\";\nimport { cn } from \"./cn\";\nimport { SystemSymbol } from \"./native\";\nimport { Text } from \"./text\";\n\n/**\n * The System Settings pane parts (macOS 26): the pane header (General, Screen Time, Apple Account),\n * a row of buttons inside or under a group (\"Display Settings…\", \"Add Account…\"), the (i) button\n * that opens a row's sheet, the storage-style usage bar with its legend, and the Displays pane's\n * arrangement. Pages compose them with `Section` and `Row`.\n */\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Pane header */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface PaneHeaderProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** The pane's picture: a 64 pt `SymbolTile`-style icon, a device symbol, or an app's own icon. */\n icon: React.ReactNode;\n /** The pane's (or the thing's) name. */\n title: React.ReactNode;\n /** One or two short lines under the name (what the pane is for, or the thing's model). */\n description?: React.ReactNode;\n /** One small control under the text (a \"Learn more…\" plain button), centered. */\n children?: React.ReactNode;\n}\n\n/**\n * System Settings' pane header: a grouped box at the top of a top-level pane, the picture centered,\n * the name in bold, one line of what it is. Also About's device header (the Mac's picture, its name\n * and its model) — one box, centered, never a card of its own style.\n */\nexport function PaneHeader({ icon, title, description, children, className, ...props }: PaneHeaderProps) {\n return (\n <header\n data-slot=\"pane-header\"\n className={cn(\"flex flex-col items-center gap-1 rounded-group bg-group px-6 pb-4 pt-5 text-center\", className)}\n {...props}\n >\n <span data-slot=\"pane-header-icon\" className=\"mb-1 flex min-h-16 items-center justify-center text-label-secondary\">\n {icon}\n </span>\n <Text as=\"h1\" variant=\"title-1\" emphasized>\n {title}\n </Text>\n {description ? (\n <Text as=\"p\" tone=\"secondary\" className=\"max-w-lg text-balance\">\n {description}\n </Text>\n ) : null}\n {children ? <div className=\"mt-1 flex items-center gap-2\">{children}</div> : null}\n </header>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Buttons in a group */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface SectionButtonsProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Under the group, outside its box (Internet Accounts' \"Add Account…\", Users & Groups' \"Add\n * User…\"). Without it the buttons are the group's last row (About's \"Display Settings…\",\n * Keyboard's \"Keyboard Shortcuts…\"), behind the same inset hairline as any row. */\n below?: boolean;\n}\n\n/** A trailing row of regular buttons, as System Settings ends a group: the default one rightmost. */\nexport function SectionButtons({ below, className, ...props }: SectionButtonsProps) {\n return (\n <div\n data-slot={below ? \"section-buttons\" : \"row\"}\n className={cn(\n \"flex flex-wrap items-center justify-end gap-2\",\n below ? \"-mt-2\" : \"relative px-3 py-2 before:absolute before:left-3 before:right-0 before:top-0 before:hidden before:h-px before:bg-separator\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* The (i) button */\n/* ---------------------------------------------------------------------------------------------- */\n\nfunction InfoGlyph() {\n return (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={1.75} strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n </svg>\n );\n}\n\nexport interface InfoButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\" | \"aria-label\"> {\n /** What the sheet shows (\"Details for work\"): the accessible name and the tooltip. */\n label: string;\n}\n\n/** System Settings' (i) at a row's trailing edge: it opens that row's sheet (details, Done). */\nexport const InfoButton = React.forwardRef<HTMLButtonElement, InfoButtonProps>(function InfoButton({ label, className, ...props }, ref) {\n return (\n <IconButton\n ref={ref}\n data-info-button=\"\"\n label={label}\n size=\"sm\"\n className={cn(\"text-label-secondary hover:text-label\", className)}\n icon={<SystemSymbol name=\"info.circle\" size={15} fallback={<InfoGlyph />} />}\n {...props}\n />\n );\n});\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Usage bar (About › Storage, Screen Time's categories) */\n/* ---------------------------------------------------------------------------------------------- */\n\n/** A segment's color: macOS's system colors, one per category (Storage: Apps, Documents …). */\nexport type UsageColor = \"blue\" | \"purple\" | \"orange\" | \"green\" | \"yellow\" | \"red\" | \"gray\";\n\nconst USAGE_COLOR: Record<UsageColor, string> = {\n blue: \"bg-system-blue\",\n purple: \"bg-system-purple\",\n orange: \"bg-system-orange\",\n green: \"bg-system-green\",\n yellow: \"bg-system-yellow\",\n red: \"bg-system-red\",\n gray: \"bg-system-gray\",\n};\n\nexport interface UsageSegment {\n key: string;\n label: string;\n value: number;\n color: UsageColor;\n /** The value as the legend says it (\"$1.20\", \"12 GB\"); defaults to the number. */\n valueLabel?: string;\n}\n\nexport interface UsageBarProps {\n [data: `data-${string}`]: string | undefined;\n segments: ReadonlyArray<UsageSegment>;\n /** The bar's whole length; defaults to the segments' sum (a full bar). */\n max?: number;\n \"aria-label\": string;\n className?: string;\n}\n\n/**\n * About › Storage's bar (and Screen Time's category split): one rounded bar, a colored run per\n * category in order, the rest empty; the legend under it names each color with its value.\n * A segment of 0 is left out of the bar but stays in the legend.\n */\nexport function UsageBar({ segments, max, className, \"aria-label\": ariaLabel, ...data }: UsageBarProps) {\n const sum = segments.reduce((s, x) => s + Math.max(0, x.value), 0);\n const whole = Math.max(max ?? sum, 1e-9);\n return (\n <div {...data} data-slot=\"usage-bar\" className={cn(\"flex w-full flex-col gap-2\", className)}>\n <div role=\"img\" aria-label={ariaLabel} className=\"flex h-3 w-full overflow-hidden rounded-full bg-fill-tertiary\">\n {segments\n .filter((s) => s.value > 0)\n .map((s) => (\n <span\n key={s.key}\n data-usage-segment={s.key}\n title={`${s.label}: ${s.valueLabel ?? String(s.value)}`}\n className={cn(\"h-full shrink-0 border-r border-content last:border-r-0\", USAGE_COLOR[s.color])}\n style={{ width: `${(Math.max(0, s.value) / whole) * 100}%` }}\n />\n ))}\n </div>\n <ul data-slot=\"usage-legend\" className=\"flex flex-wrap items-center gap-x-4 gap-y-1\">\n {segments.map((s) => (\n <li key={s.key} className=\"flex min-w-0 items-center gap-1.5\">\n <span aria-hidden className={cn(\"size-2 shrink-0 rounded-full\", USAGE_COLOR[s.color])} />\n <Text tone=\"secondary\" truncate>\n {s.label}\n </Text>\n {s.valueLabel !== undefined ? (\n <Text tabular truncate>\n {s.valueLabel}\n </Text>\n ) : null}\n </li>\n ))}\n </ul>\n </div>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Display arrangement (System Settings › Displays) */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface ArrangedDisplay {\n id: string;\n name: string;\n /** Global position and size in points, as the OS arranges them. */\n x: number;\n y: number;\n width: number;\n height: number;\n /** The main display carries the menu bar. */\n primary?: boolean;\n /** The computer's own screen (a laptop's): drawn on its base, never on a stand. */\n builtin?: boolean;\n /** An image of what the display shows (a capture); otherwise the screen is drawn dark. */\n preview?: string;\n}\n\nexport interface DisplayArrangementProps {\n [data: `data-${string}`]: string | undefined;\n displays: ReadonlyArray<ArrangedDisplay>;\n selected: string | null;\n onSelect: (id: string) => void;\n className?: string;\n}\n\n/** The arrangement's drawing box, in px: wide enough for three side by side, as tall as Displays' band. */\nconst ARRANGE_W = 480;\nconst ARRANGE_H = 104;\n\n/**\n * Displays' top band: every display drawn where the OS arranges it, to scale, its name under it; the\n * selected one ringed in the accent (its form follows below). One display draws large and centered.\n * Clicking a display selects it; arrow keys move between them.\n */\nexport function DisplayArrangement({ displays, selected, onSelect, className, ...data }: DisplayArrangementProps) {\n const minX = Math.min(...displays.map((d) => d.x));\n const minY = Math.min(...displays.map((d) => d.y));\n const maxX = Math.max(...displays.map((d) => d.x + d.width));\n const maxY = Math.max(...displays.map((d) => d.y + d.height));\n const scale = displays.length ? Math.min(ARRANGE_W / Math.max(1, maxX - minX), ARRANGE_H / Math.max(1, maxY - minY)) : 1;\n const boxW = (maxX - minX) * scale;\n const boxH = (maxY - minY) * scale;\n const move = (from: number, step: number) => {\n const next = displays[(from + step + displays.length) % displays.length];\n if (next) onSelect(next.id);\n };\n return (\n <div {...data} data-slot=\"display-arrangement\" role=\"listbox\" aria-label=\"Displays\" className={cn(\"flex justify-center rounded-group bg-group px-6 pb-3 pt-5\", className)}>\n <div className=\"relative\" style={{ width: boxW, height: boxH + 36 }}>\n {displays.map((d, i) => {\n const on = d.id === selected;\n return (\n <button\n key={d.id}\n type=\"button\"\n role=\"option\"\n aria-selected={on}\n data-arranged-display={d.id}\n onClick={() => onSelect(d.id)}\n onKeyDown={(event) => {\n if (event.key === \"ArrowRight\" || event.key === \"ArrowDown\") move(i, 1);\n else if (event.key === \"ArrowLeft\" || event.key === \"ArrowUp\") move(i, -1);\n else return;\n event.preventDefault();\n }}\n className=\"focus-ring absolute flex flex-col items-center gap-1.5 rounded-control\"\n style={{ left: (d.x - minX) * scale, top: (d.y - minY) * scale, width: d.width * scale }}\n >\n <span className=\"flex w-full flex-col items-center\">\n <span\n className={cn(\n \"block w-full overflow-hidden rounded-control bg-display-screen shadow-raised ring-offset-2 ring-offset-content\",\n on ? \"ring-2 ring-tint\" : \"ring-1 ring-separator\",\n )}\n style={{ height: d.height * scale }}\n >\n {d.preview ? <img alt=\"\" src={d.preview} draggable={false} className=\"size-full object-cover\" /> : null}\n </span>\n {/* Displays draws each screen as the thing it is: a laptop's on its base, a monitor on its stand. */}\n {d.builtin ? (\n <span aria-hidden data-display-base=\"\" className=\"block h-1 w-full rounded-b-control bg-label-tertiary\" />\n ) : (\n <span aria-hidden data-display-stand=\"\" className=\"flex w-full flex-col items-center\">\n <span className=\"block h-1.5 w-1/6 bg-label-tertiary\" />\n <span className=\"block h-0.5 w-1/3 rounded-full bg-label-tertiary\" />\n </span>\n )}\n </span>\n <Text emphasized={on} truncate className=\"max-w-full\">\n {d.name}\n </Text>\n </button>\n );\n })}\n </div>\n </div>\n );\n}\n","import * as SliderPrimitive from \"@radix-ui/react-slider\";\nimport * as React from \"react\";\n\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover\";\nimport { IconButton } from \"./button\";\nimport { cn } from \"./cn\";\nimport { SystemSymbol } from \"./native\";\nimport type { UsageColor } from \"./settings\";\nimport { Text } from \"./text\";\n\n/**\n * The rest of System Settings' controls (macOS 26): the slider with its tick marks and end labels\n * (Keyboard's Key repeat rate, Sound's Output volume), the round \"?\" help button at a pane's foot,\n * Screen Time's activity chart (a bar per day, split by category, with the average dashed) and its\n * date stepper (\"‹ Today ›\"). Pages compose them inside `Section` and `Row`.\n */\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Slider */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface SliderProps {\n [data: `data-${string}`]: string | undefined;\n value: number;\n min?: number;\n max?: number;\n step?: number;\n /** While dragging. */\n onValueChange?: (value: number) => void;\n /** When the person lets go (or presses a key): where a setting is written. */\n onValueCommit?: (value: number) => void;\n /** Tick marks under the track, evenly spaced, ends included (Keyboard's sliders have 8). */\n ticks?: number;\n /** Under the track's two ends: \"Slow\" and \"Fast\", \"Long\" and \"Short\". */\n minLabel?: React.ReactNode;\n maxLabel?: React.ReactNode;\n /** Beside the track's two ends: Sound's quiet and loud speakers. */\n leading?: React.ReactNode;\n trailing?: React.ReactNode;\n disabled?: boolean;\n \"aria-label\": string;\n className?: string;\n}\n\n/**\n * NSSlider (linear, regular): a thin track filled in the tint up to a round white knob, optional\n * tick marks under it and a label under each end. Arrow keys step; the value is written on commit.\n */\nexport function Slider({\n value,\n min = 0,\n max = 100,\n step = 1,\n onValueChange,\n onValueCommit,\n ticks,\n minLabel,\n maxLabel,\n leading,\n trailing,\n disabled,\n className,\n \"aria-label\": ariaLabel,\n ...data\n}: SliderProps) {\n return (\n <div {...data} data-slot=\"slider\" className={cn(\"flex w-full min-w-0 flex-col gap-0.5\", className)}>\n <div className=\"flex min-w-0 items-center gap-2\">\n {leading ? <span className=\"flex shrink-0 items-center text-label-secondary\">{leading}</span> : null}\n <SliderPrimitive.Root\n value={[value]}\n min={min}\n max={max}\n step={step}\n disabled={disabled === true}\n aria-label={ariaLabel}\n onValueChange={(v) => onValueChange?.(v[0] ?? value)}\n onValueCommit={(v) => onValueCommit?.(v[0] ?? value)}\n className=\"relative flex h-5 min-w-0 flex-1 touch-none select-none items-center data-[disabled]:opacity-40\"\n >\n <SliderPrimitive.Track className=\"relative h-1 grow overflow-hidden rounded-full bg-fill-tertiary\">\n <SliderPrimitive.Range data-slot=\"slider-range\" className=\"absolute h-full bg-tint\" />\n </SliderPrimitive.Track>\n <SliderPrimitive.Thumb\n aria-label={ariaLabel}\n data-slot=\"slider-thumb\"\n className=\"focus-ring block size-5 rounded-full bg-knob shadow-control transition-transform duration-100 active:scale-95\"\n />\n </SliderPrimitive.Root>\n {trailing ? <span className=\"flex shrink-0 items-center text-label-secondary\">{trailing}</span> : null}\n </div>\n {ticks && ticks > 1 ? (\n // NSSlider's tick marks: a small dot under the track at each stop (Keyboard, Sound).\n <div aria-hidden data-slot=\"slider-ticks\" className={cn(\"-mt-0.5 flex justify-between px-2.5\", leading ? \"ml-6\" : \"\", trailing ? \"mr-6\" : \"\")}>\n {Array.from({ length: ticks }, (_, i) => (\n <span key={i} className=\"size-0.5 rounded-full bg-label-tertiary\" />\n ))}\n </div>\n ) : null}\n {minLabel || maxLabel ? (\n // The end labels in the label color, as Keyboard's \"Off … Fast\" (measured: #272727 on the group).\n <div data-slot=\"slider-labels\" className=\"flex justify-between\">\n <Text variant=\"footnote\">{minLabel}</Text>\n <Text variant=\"footnote\">{maxLabel}</Text>\n </div>\n ) : null}\n </div>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* The \"?\" help button */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface HelpButtonProps {\n [data: `data-${string}`]: string | undefined;\n /** The pane the help is about (\"Help for Sound\"): the accessible name and the tooltip. */\n label: string;\n /** What the popover says: a title line and one or two short lines. */\n children: React.ReactNode;\n className?: string;\n}\n\n/**\n * System Settings' round \"?\" at the pane's trailing foot. Apple's opens the Mac User Guide; ours\n * opens a popover that says what the pane is and does, so the button is never a dead end.\n */\nexport function HelpButton({ label, children, className, ...data }: HelpButtonProps) {\n return (\n <div {...data} data-slot=\"help-button-row\" className={cn(\"flex justify-end\", className)}>\n <Popover>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n aria-label={label}\n title={label}\n data-help-button=\"\"\n className=\"focus-ring inline-flex size-5 items-center justify-center rounded-full bg-control text-body text-label shadow-control\"\n >\n ?\n </button>\n </PopoverTrigger>\n <PopoverContent align=\"end\" className=\"w-72\" data-help-popover=\"\">\n <div className=\"flex flex-col gap-1\">{children}</div>\n </PopoverContent>\n </Popover>\n </div>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Screen Time's activity chart */\n/* ---------------------------------------------------------------------------------------------- */\n\nconst BAR_COLOR: Record<UsageColor, string> = {\n blue: \"bg-system-blue\",\n purple: \"bg-system-purple\",\n orange: \"bg-system-orange\",\n green: \"bg-system-green\",\n yellow: \"bg-system-yellow\",\n red: \"bg-system-red\",\n gray: \"bg-system-gray\",\n};\n\nexport interface ActivityBar {\n key: string;\n /** Under the bar: \"S\", \"M\", \"T\" (a day), \"12 AM\" (an hour). */\n label: string;\n /** The whole bar's name and value for the tooltip and screen readers (\"Wed, Oct 8: $41.20\"). */\n title: string;\n segments: ReadonlyArray<{ key: string; value: number; color: UsageColor }>;\n}\n\nexport interface ActivityChartProps {\n [data: `data-${string}`]: string | undefined;\n bars: ReadonlyArray<ActivityBar>;\n /** The bar shown in the list below; the others draw lighter. */\n selected?: string | null;\n onSelect?: (key: string) => void;\n /** The average across the bars, drawn as a dashed line labeled \"avg\". */\n average?: number | null;\n /** An axis value as it should read, in the chart's real units (\"$80\", \"$0.50\"): the top, the\n * middle and zero are each labeled, so a bar reads against the lines beside it. */\n formatValue: (value: number) => string;\n /** The chart's own legend under the days (Screen Time's categories): each color's name and, when\n * given, its figure for the period (\"Chats $0.27 · Helpers $0.00\"), so no separate bar repeats it. */\n legend?: ReadonlyArray<{ key: string; label: string; color: UsageColor; valueLabel?: string }>;\n \"aria-label\": string;\n className?: string;\n}\n\n/** A clean top for the axis: 1, 2 or 5 × a power of ten, at or above the tallest bar. */\nfunction niceMax(v: number): number {\n if (v <= 0) return 1;\n const p = 10 ** Math.floor(Math.log10(v));\n for (const m of [1, 2, 5, 10]) if (m * p >= v) return m * p;\n return 10 * p;\n}\n\n/**\n * Screen Time's App & Website Activity chart: a bar per day, each stacked by category in the\n * category's color, the average as a dashed line with \"avg\", the scale on the trailing edge, the\n * day under each bar. Clicking a bar selects that day (the list below follows); the others dim.\n */\nexport function ActivityChart({ bars, selected, onSelect, average, formatValue, legend, className, \"aria-label\": ariaLabel, ...data }: ActivityChartProps) {\n const totals = bars.map((b) => b.segments.reduce((s, x) => s + Math.max(0, x.value), 0));\n const top = niceMax(Math.max(0, ...totals, average ?? 0));\n const pct = (v: number) => `${Math.min(100, (Math.max(0, v) / top) * 100)}%`;\n return (\n <div {...data} data-slot=\"activity-chart\" role=\"group\" aria-label={ariaLabel} className={cn(\"flex w-full flex-col gap-1\", className)}>\n <div className=\"flex items-stretch gap-2\">\n <div className=\"relative flex h-32 flex-1 items-end gap-2 border-b border-separator\">\n {/* The scale's middle and top lines, as Screen Time draws them. */}\n <span aria-hidden className=\"pointer-events-none absolute inset-x-0 top-0 border-t border-separator\" />\n <span aria-hidden className=\"pointer-events-none absolute inset-x-0 top-1/2 border-t border-separator\" />\n {average && average > 0 ? (\n <span aria-hidden data-slot=\"activity-average\" className=\"pointer-events-none absolute inset-x-0 border-t border-dashed border-system-green\" style={{ bottom: pct(average) }} />\n ) : null}\n {bars.map((b, i) => {\n const on = selected === undefined || selected === null || selected === b.key;\n return (\n <button\n key={b.key}\n type=\"button\"\n data-activity-bar={b.key}\n aria-pressed={selected === b.key}\n aria-label={b.title}\n title={b.title}\n onClick={() => onSelect?.(b.key)}\n disabled={!onSelect}\n className={cn(\"focus-ring relative flex h-full min-w-0 flex-1 flex-col justify-end rounded-control disabled:cursor-default\", on ? \"\" : \"opacity-40\")}\n >\n <span className=\"flex w-full flex-col-reverse overflow-hidden rounded-t-control\" style={{ height: pct(totals[i] ?? 0) }}>\n {b.segments\n .filter((s) => s.value > 0)\n .map((s) => (\n <span key={s.key} data-activity-segment={s.key} className={cn(\"w-full shrink-0\", BAR_COLOR[s.color])} style={{ height: `${((totals[i] ?? 0) > 0 ? s.value / (totals[i] ?? 1) : 0) * 100}%` }} />\n ))}\n </span>\n </button>\n );\n })}\n </div>\n {/* The scale in real units at each line it draws (Screen Time: the top, the middle, zero), and\n \"avg\" beside the dashed line, at its own height. */}\n <div aria-hidden data-slot=\"activity-axis\" className=\"relative w-12\">\n <Text variant=\"footnote\" tone=\"secondary\" tabular data-activity-axis=\"top\" className=\"absolute left-0 top-0 -translate-y-1/2 whitespace-nowrap\">\n {formatValue(top)}\n </Text>\n <Text variant=\"footnote\" tone=\"secondary\" tabular data-activity-axis=\"middle\" className=\"absolute left-0 top-1/2 -translate-y-1/2 whitespace-nowrap\">\n {formatValue(top / 2)}\n </Text>\n <Text variant=\"footnote\" tone=\"secondary\" tabular data-activity-axis=\"zero\" className=\"absolute bottom-0 left-0 translate-y-1/2 whitespace-nowrap\">\n {formatValue(0)}\n </Text>\n {average && average > 0 ? (\n <Text variant=\"footnote\" className=\"absolute right-0 translate-y-1/2 text-system-green\" style={{ bottom: pct(average) }}>\n avg\n </Text>\n ) : null}\n </div>\n </div>\n <div aria-hidden className=\"flex gap-2 pr-14\">\n {bars.map((b) => (\n <Text key={b.key} variant=\"footnote\" tone={selected === b.key ? undefined : \"secondary\"} emphasized={selected === b.key} className=\"min-w-0 flex-1 whitespace-nowrap text-center\">\n {b.label}\n </Text>\n ))}\n </div>\n {legend?.length ? (\n <ul data-slot=\"activity-legend\" className=\"mt-2 flex flex-wrap items-center gap-x-4 gap-y-1\">\n {legend.map((l) => (\n <li key={l.key} data-activity-legend={l.key} className=\"flex min-w-0 items-center gap-1.5\">\n <span aria-hidden className={cn(\"size-2 shrink-0 rounded-full\", BAR_COLOR[l.color])} />\n <Text tone=\"secondary\" truncate>\n {l.label}\n </Text>\n {l.valueLabel !== undefined ? (\n <Text tabular truncate>\n {l.valueLabel}\n </Text>\n ) : null}\n </li>\n ))}\n </ul>\n ) : null}\n </div>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Date stepper */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface DateStepperProps {\n [data: `data-${string}`]: string | undefined;\n /** \"Today\", \"Yesterday\", \"Wednesday, Oct 8\", \"This Week\". */\n label: React.ReactNode;\n onPrevious: () => void;\n onNext: () => void;\n previousDisabled?: boolean;\n nextDisabled?: boolean;\n className?: string;\n}\n\n/** Screen Time's period stepper: a back and a forward chevron around the period it shows. */\nexport function DateStepper({ label, onPrevious, onNext, previousDisabled, nextDisabled, className, ...data }: DateStepperProps) {\n return (\n <div {...data} data-slot=\"date-stepper\" className={cn(\"inline-flex items-center gap-1\", className)}>\n <IconButton label=\"Previous\" size=\"sm\" disabled={previousDisabled === true} onClick={onPrevious} icon={<SystemSymbol name=\"chevron.left\" size={13} fallback={<Chevron left />} />} />\n <Text emphasized className=\"min-w-24 text-center\" data-date-stepper-label=\"\">\n {label}\n </Text>\n <IconButton label=\"Next\" size=\"sm\" disabled={nextDisabled === true} onClick={onNext} icon={<SystemSymbol name=\"chevron.right\" size={13} fallback={<Chevron />} />} />\n </div>\n );\n}\n\nfunction Chevron({ left }: { left?: boolean }) {\n return (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d={left ? \"m15 18-6-6 6-6\" : \"m9 18 6-6-6-6\"} />\n </svg>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* A small table inside a group (Sound's devices) */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface GroupTableColumn {\n key: string;\n header: string;\n /** The first column takes the spare width; the others are this wide (\"md\" = 8 rem, \"lg\" = 12 rem). */\n width?: \"md\" | \"lg\";\n}\n\nexport interface GroupTableRow {\n key: string;\n cells: ReadonlyArray<React.ReactNode>;\n /** Extra hooks for the row (tests, screens). */\n data?: Record<`data-${string}`, string | undefined>;\n}\n\nexport interface GroupTableProps {\n [data: `data-${string}`]: string | undefined;\n columns: ReadonlyArray<GroupTableColumn>;\n rows: ReadonlyArray<GroupTableRow>;\n /** The row the system is using now (Sound's selected device): drawn in the selection's gray. */\n current?: string | null;\n \"aria-label\": string;\n className?: string;\n}\n\n/**\n * The small table System Settings draws inside a group (Sound › Output & Input): a header of\n * column names in the label color, then a row per thing on alternating stripes, the one in use highlighted.\n * It shows; it does not pick (a choice goes through a control that really changes it).\n */\nexport function GroupTable({ columns, rows, current, className, \"aria-label\": ariaLabel, ...data }: GroupTableProps) {\n const width = (c: GroupTableColumn, i: number) => (i === 0 ? \"min-w-0 flex-1\" : c.width === \"lg\" ? \"w-48 shrink-0\" : \"w-32 shrink-0\");\n return (\n <div {...data} data-slot=\"group-table\" role=\"table\" aria-label={ariaLabel} className={cn(\"flex flex-col\", className)}>\n <div role=\"row\" className=\"flex items-center gap-3 border-b border-separator px-3 py-1\">\n {columns.map((c, i) => (\n // Sound's \"Name\" and \"Type\": 11 pt in the label color (measured #252525), never a faint caption.\n <Text key={c.key} role=\"columnheader\" variant=\"subheadline\" className={width(c, i)}>\n {c.header}\n </Text>\n ))}\n </div>\n {rows.map((r) => (\n <div\n key={r.key}\n role=\"row\"\n aria-current={r.key === current ? \"true\" : undefined}\n {...r.data}\n className={cn(\"flex h-6 items-center gap-3 px-3 even:bg-fill-tertiary\", r.key === current ? \"bg-selection-muted even:bg-selection-muted\" : \"\")}\n >\n {r.cells.map((cell, i) => (\n <span key={columns[i]?.key ?? i} role=\"cell\" className={cn(\"flex items-center\", width(columns[i] ?? { key: \"\", header: \"\" }, i))}>\n {typeof cell === \"string\" ? <Text truncate>{cell}</Text> : cell}\n </span>\n ))}\n </div>\n ))}\n </div>\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-code text-label\",\n scroll && \"max-h-80 overflow-y-auto\",\n className,\n )}\n {...props}\n >\n {children}\n </pre>\n );\n}\n\n/**\n * Terminal's default profile (macOS 26), measured from Terminal itself: the same in light and dark\n * (Terminal keeps its profile whatever the appearance) — light text on a deep blue-grey, a solid\n * light block cursor. For a library that paints its own surface (xterm) and takes literal colors;\n * this is the profile's art, never interface color for anything else.\n */\nexport const TERMINAL_PROFILE = {\n background: \"#212734\",\n foreground: \"#e6e6e6\",\n cursor: \"#dedede\",\n selection: \"#4a5468\",\n} as const;\n","import * as React from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { XIcon } from \"../icons\";\nimport { IconButton } from \"./button\";\nimport { cn } from \"./cn\";\nimport { clampRectToViewport, readViewport, useDragMove } from \"../window-drag\";\n\n/** Px of the panel that stay on screen when it is dragged toward an edge. */\nconst TITLEBAR_KEEP_VISIBLE = 80;\n\nexport interface InspectorPanelProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n open: boolean;\n /** Close (its close button, or Escape while focus is inside it). */\n onClose: () => void;\n /** The panel's title bar (\"mds (114)\"). */\n title: string;\n /** The buttons at its foot (Activity Monitor's Sample and Quit), trailing. */\n footer?: React.ReactNode;\n children: React.ReactNode;\n}\n\n/**\n * Activity Monitor's process inspector: a utility panel of its own over the window, never a sheet.\n * Nothing behind it is dimmed or blocked (the table stays live: select, scroll, open another row),\n * its title bar names what it inspects and drags it, its close button sits at the leading edge, and\n * Escape inside it closes it. It opens at the window's trailing side, under the toolbar.\n */\nexport function InspectorPanel({ open, onClose, title, footer, children, className, ...props }: InspectorPanelProps) {\n const [offset, setOffset] = React.useState({ x: 0, y: 0 });\n const panelRef = React.useRef<HTMLDivElement | null>(null);\n const [element, setElement] = React.useState<HTMLDivElement | null>(null);\n const setPanel = React.useCallback((node: HTMLDivElement | null) => {\n panelRef.current = node;\n setElement(node);\n }, []);\n // THE WINDOW DRAG (window-drag.ts): the title bar drags it, the title bar stays on screen.\n const drag = useDragMove({\n element,\n paint: \"offset\",\n offset,\n constrain: (next) => clampRectToViewport(next, readViewport(), { keepVisible: TITLEBAR_KEEP_VISIBLE }),\n onCommit: (_rect, commit) => setOffset(commit.offset),\n });\n // A panel opens where it opened last (AppKit keeps a panel's frame), and takes focus once.\n React.useEffect(() => {\n if (open) panelRef.current?.focus();\n }, [open]);\n if (!open || typeof document === \"undefined\") return null;\n return createPortal(\n <div\n ref={setPanel}\n role=\"dialog\"\n aria-modal={false}\n aria-label={title}\n tabIndex={-1}\n data-slot=\"inspector-panel\"\n className={cn(\"fixed right-6 top-16 flex w-96 max-w-full flex-col overflow-hidden rounded-panel bg-content text-body text-label outline-none\", className)}\n style={{ translate: `${offset.x}px ${offset.y}px` }}\n onKeyDown={(event) => {\n if (event.key === \"Escape\" && !event.defaultPrevented) {\n event.stopPropagation();\n onClose();\n }\n }}\n {...props}\n >\n <div data-slot=\"inspector-panel-titlebar\" className=\"relative flex h-control-lg shrink-0 cursor-default items-center justify-center px-2\" onPointerDown={drag.onPointerDown}>\n <span className=\"absolute left-2 flex items-center\">\n <IconButton size=\"sm\" label=\"Close\" icon={<XIcon />} onClick={onClose} />\n </span>\n <span data-slot=\"inspector-panel-title\" className=\"min-w-0 truncate px-8 text-headline\">\n {title}\n </span>\n </div>\n <div data-slot=\"inspector-panel-body\" className=\"flex min-h-0 flex-col gap-3 overflow-y-auto px-5 pb-5 pt-2\">\n {children}\n </div>\n {footer ? <div data-slot=\"inspector-panel-footer\" className=\"flex shrink-0 items-center gap-2 px-5 pb-5\">{footer}</div> : null}\n </div>,\n document.body,\n );\n}\n","import * as React from \"react\";\n\nimport { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from \"../dropdown-menu\";\nimport { ChevronDownIcon } from \"../icons\";\nimport { Tooltip, TooltipTrigger } from \"../tooltip\";\nimport { cn } from \"./cn\";\nimport { ConfirmDialog } from \"./sheet\";\nimport { DropdownMenuEntries, type RowMenuItem } from \"./menu-entries\";\nimport { TooltipContent } from \"./tooltip\";\n\nexport interface PullDownButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\" | \"aria-label\" | \"type\"> {\n /** The accessible name and the tooltip (\"Process actions\"). */\n label: string;\n /** The symbol before the arrow (an `ellipsis.circle` SystemSymbol). */\n icon: React.ReactNode;\n /** The menu: `\"-\"` items are separators; a destructive item with `confirm` asks first. */\n items: ReadonlyArray<RowMenuItem>;\n}\n\n/**\n * A toolbar pull-down (NSPopUpButton, pullsDown): a symbol with a small down arrow beside it that\n * opens a menu of actions, as Activity Monitor's \"…\" before its view switch acts on the selected\n * process. Never a bare \"…\" at the toolbar's end.\n */\nexport function PullDownButton({ label, icon, items, disabled = false, className, ...props }: PullDownButtonProps) {\n const [asking, setAsking] = React.useState<RowMenuItem | null>(null);\n return (\n <>\n <DropdownMenu>\n <Tooltip>\n <TooltipTrigger asChild>\n <DropdownMenuTrigger asChild>\n <button\n {...props}\n type=\"button\"\n data-slot=\"pull-down-button\"\n aria-label={label}\n disabled={disabled}\n className={cn(\n \"focus-ring inline-flex h-control shrink-0 select-none items-center gap-0.5 rounded-control px-1 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-[state=open]:bg-fill-secondary [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className,\n )}\n >\n <span className=\"flex size-icon items-center justify-center [&_svg]:size-icon\">{icon}</span>\n <ChevronDownIcon aria-hidden className=\"size-2.5\" />\n </button>\n </DropdownMenuTrigger>\n </TooltipTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n <DropdownMenuContent align=\"start\" data-slot=\"pull-down-menu\">\n <DropdownMenuEntries items={items} onAsk={setAsking} />\n </DropdownMenuContent>\n </DropdownMenu>\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 </>\n );\n}\n","import * as React from \"react\";\n\nimport { ContextMenuItem, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger } from \"../context-menu\";\nimport { DropdownMenuItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger } from \"../dropdown-menu\";\n\n/** One item of a row's (or tile's, or pull-down's) menu. */\nexport interface RowMenuItem {\n /** The item's words; \"-\" is a separator between groups (NSMenu's sections). */\n label: string;\n onSelect: () => void;\n /** The leading SF Symbol (a `SystemSymbol`), or an app's own icon, as macOS 26 menus draw one beside each item. */\n icon?: React.ReactNode;\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 /** A submenu (NSMenu's): the item opens these choices beside it; its own `onSelect` is not called. */\n items?: ReadonlyArray<RowMenuItem>;\n}\n\n/** A menu item's content: its leading symbol (when it has one) and its words. */\nexport function MenuItemLabel({ item }: { item: Pick<RowMenuItem, \"label\" | \"icon\"> }) {\n return (\n <>\n {item.icon ? (\n <span aria-hidden data-slot=\"menu-item-symbol\">\n {item.icon}\n </span>\n ) : null}\n <span className=\"min-w-0 flex-1 truncate\">{item.label}</span>\n </>\n );\n}\n\n/** What a destructive item with a question does on select: asks through `onAsk`, else runs. */\nconst choose = (item: RowMenuItem, onAsk: (item: RowMenuItem) => void) => () => (item.destructive && item.confirm ? onAsk(item) : item.onSelect());\n\n/**\n * A right-click menu's items, the one way every desktop menu draws them: separators, destructive\n * items in red (asking first), and submenus. Every menu that takes `RowMenuItem`s renders through this.\n */\nexport function ContextMenuEntries({ items, onAsk }: { items: ReadonlyArray<RowMenuItem>; onAsk: (item: RowMenuItem) => void }): React.JSX.Element {\n return (\n <>\n {items.map((item, i) =>\n item.label === \"-\" ? (\n <ContextMenuSeparator key={`sep-${i}`} />\n ) : item.items ? (\n <ContextMenuSub key={`${item.label}-${i}`}>\n <ContextMenuSubTrigger data-menu-item={item.label} {...(item.disabled ? { disabled: true } : {})}>\n <MenuItemLabel item={item} />\n </ContextMenuSubTrigger>\n <ContextMenuSubContent>\n <ContextMenuEntries items={item.items} onAsk={onAsk} />\n </ContextMenuSubContent>\n </ContextMenuSub>\n ) : (\n <ContextMenuItem\n key={`${item.label}-${i}`}\n data-menu-item={item.label}\n {...(item.disabled !== undefined ? { disabled: item.disabled } : {})}\n {...(item.destructive ? { className: \"text-system-red\", \"data-destructive\": \"\" } : {})}\n onSelect={choose(item, onAsk)}\n >\n <MenuItemLabel item={item} />\n </ContextMenuItem>\n ),\n )}\n </>\n );\n}\n\n/** The same items in a pull-down (a More button, a toolbar pull-down). */\nexport function DropdownMenuEntries({ items, onAsk }: { items: ReadonlyArray<RowMenuItem>; onAsk: (item: RowMenuItem) => void }): React.JSX.Element {\n return (\n <>\n {items.map((item, i) =>\n item.label === \"-\" ? (\n <DropdownMenuSeparator key={`sep-${i}`} />\n ) : item.items ? (\n <DropdownMenuSub key={`${item.label}-${i}`}>\n <DropdownMenuSubTrigger data-menu-item={item.label} {...(item.disabled ? { disabled: true } : {})}>\n <MenuItemLabel item={item} />\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent>\n <DropdownMenuEntries items={item.items} onAsk={onAsk} />\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n ) : (\n <DropdownMenuItem\n key={`${item.label}-${i}`}\n data-menu-item={item.label}\n disabled={item.disabled ?? false}\n onSelect={choose(item, onAsk)}\n {...(item.destructive ? { className: \"text-system-red focus:text-system-red\", \"data-destructive\": \"\" } : {})}\n >\n <MenuItemLabel item={item} />\n </DropdownMenuItem>\n ),\n )}\n </>\n );\n}\n","import * as React from \"react\";\nimport { flushSync } from \"react-dom\";\n\nimport { DropdownMenu, DropdownMenuContent, DropdownMenuSeparator, DropdownMenuTrigger } from \"../dropdown-menu\";\nimport { IconButton } from \"./button\";\nimport { cn } from \"./cn\";\nimport { SystemSymbol } from \"./native\";\n\nexport interface ToolbarOverflowItem {\n /** Stable id (`data-toolbar-item`). */\n id: string;\n /** The item as the toolbar draws it. */\n item: React.ReactNode;\n /** Its menu form (NSToolbarItem.menuFormRepresentation): DropdownMenu items shown in the » menu\n * while the item does not fit. Absent: the item never leaves the toolbar (search, filter). */\n menu?: React.ReactNode;\n /** NSToolbarItem.visibilityPriority: lower leaves first; ties leave from the trailing end. */\n priority?: number;\n /** Items of one section share the » menu without a separator; a new section starts after one. */\n section?: string;\n}\n\nexport interface ToolbarOverflowProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n /** In toolbar order. `false`/`null` entries are skipped, so items can be written conditionally. */\n items: ReadonlyArray<ToolbarOverflowItem | false | null | undefined>;\n /** The » button's name and tooltip. */\n label?: string;\n}\n\nconst NONE: ReadonlySet<string> = new Set();\n\n/** The free width in the row that clips the toolbar (the space before its trailing group). */\nfunction freeSpace(el: HTMLElement): number {\n let row = el.parentElement;\n while (row && row !== document.body) {\n const style = getComputedStyle(row);\n if (style.overflowX !== \"visible\") break;\n row = row.parentElement;\n }\n if (!row || row === document.body) return 0;\n const style = getComputedStyle(row);\n if (!style.display.includes(\"flex\") || style.flexDirection.startsWith(\"column\")) return 0;\n const kids = Array.from(row.children).filter((c) => {\n if (c.getClientRects().length === 0) return false;\n const position = getComputedStyle(c).position;\n return position !== \"absolute\" && position !== \"fixed\";\n });\n const gap = Number.parseFloat(style.columnGap) || 0;\n const used = kids.reduce((n, c) => n + c.getBoundingClientRect().width, 0) + gap * Math.max(0, kids.length - 1);\n const inner = row.clientWidth - (Number.parseFloat(style.paddingLeft) || 0) - (Number.parseFloat(style.paddingRight) || 0);\n return Math.max(0, inner - used);\n}\n\nfunction sameSet(a: ReadonlySet<string>, b: ReadonlySet<string>): boolean {\n return a.size === b.size && [...a].every((x) => b.has(x));\n}\n\n/**\n * NSToolbar's overflow: a row of toolbar items that keeps every one it has room for and moves the\n * rest, lowest priority first, into a » menu at its trailing end, each as its menu form — so a\n * narrow window never cuts an item off and every action stays one click away. Items with no `menu`\n * (the search field, the filter) always stay. Put it in a `PageHeader`'s `actions`.\n */\nexport function ToolbarOverflow({ items, label = \"More toolbar items\", className, ...props }: ToolbarOverflowProps) {\n const list = items.filter((i): i is ToolbarOverflowItem => Boolean(i));\n const root = React.useRef<HTMLDivElement>(null);\n // Each item's width as last laid out (kept while it sits in the » menu). Items that always stay\n // (a search field) are flexible: they give way to their own minimum before anything leaves.\n const widths = React.useRef(new Map<string, number>());\n const [hidden, setHidden] = React.useState<ReadonlySet<string>>(NONE);\n const latest = React.useRef(list);\n latest.current = list;\n\n const fit = React.useCallback(() => {\n const el = root.current;\n if (!el) return;\n for (const child of Array.from(el.children) as HTMLElement[]) {\n const id = child.dataset.toolbarItem ?? (child.dataset.toolbarOverflow !== undefined ? \"\\u00bb\" : undefined);\n if (id === undefined) continue;\n // An item that always stays is laid out as its own content (display: contents).\n const boxes = child.dataset.toolbarPinned !== undefined ? (Array.from(child.children) as HTMLElement[]) : [child];\n if (boxes.every((b) => b.getClientRects().length === 0)) continue;\n widths.current.set(id, boxes.reduce((n, b) => n + b.getBoundingClientRect().width, 0));\n }\n const all = latest.current;\n const gap = Number.parseFloat(getComputedStyle(el).columnGap) || 0;\n const available = el.clientWidth + freeSpace(el);\n const need = (shown: ToolbarOverflowItem[], chevron: boolean): number => {\n const parts = shown.map((i) => widths.current.get(i.id) ?? 0);\n if (chevron) parts.push(widths.current.get(\"»\") ?? 0);\n return parts.reduce((n, w) => n + w, 0) + gap * Math.max(0, parts.length - 1);\n };\n const next = new Set<string>();\n if (need(all, false) > available + 0.5) {\n const order = all\n .map((item, index) => ({ item, index }))\n .filter(({ item }) => item.menu !== undefined)\n .sort((a, b) => (a.item.priority ?? 0) - (b.item.priority ?? 0) || b.index - a.index);\n for (const { item } of order) {\n next.add(item.id);\n if (need(all.filter((i) => !next.has(i.id)), true) <= available + 0.5) break;\n }\n }\n setHidden((prev) => (sameSet(prev, next) ? prev : next));\n }, []);\n\n // Every render: an item came or went, or one changed size.\n React.useLayoutEffect(fit);\n React.useEffect(() => {\n const el = root.current;\n if (!el || typeof ResizeObserver === \"undefined\") return;\n // After the observer's turn, never inside it (a layout change there is the \"ResizeObserver loop\").\n let timer: ReturnType<typeof setTimeout> | undefined;\n const later = () => {\n clearTimeout(timer);\n // Committed at once, so the window's own fold check that follows sees the items already gone.\n timer = setTimeout(() => flushSync(fit), 0);\n };\n const observer = new ResizeObserver(later);\n for (let node: HTMLElement | null = el; node && node !== document.body; node = node.parentElement) observer.observe(node);\n return () => {\n clearTimeout(timer);\n observer.disconnect();\n };\n }, [fit]);\n\n const overflowed = list.filter((i) => hidden.has(i.id));\n return (\n <div ref={root} data-slot=\"toolbar-overflow\" className={cn(\"relative flex min-w-0 items-center gap-2\", className)} {...props}>\n {list.map((i) => (\n <div\n key={i.id}\n data-toolbar-item={i.id}\n data-toolbar-pinned={i.menu === undefined ? \"\" : undefined}\n data-overflowed={hidden.has(i.id) || undefined}\n // An item that always stays is its content's own flex item, so a search field gives way to its minimum.\n className={cn(i.menu === undefined ? \"contents\" : \"flex shrink-0 items-center\", hidden.has(i.id) && \"hidden\")}\n >\n {i.item}\n </div>\n ))}\n {/* Always laid out so its width is known; out of the flow and unseen until something overflows. */}\n <div data-toolbar-overflow=\"\" className={cn(\"flex shrink-0 items-center\", overflowed.length === 0 && \"invisible absolute\")} aria-hidden={overflowed.length === 0 || undefined}>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <IconButton\n data-toolbar-overflow-button=\"\"\n label={label}\n tabIndex={overflowed.length === 0 ? -1 : undefined}\n icon={\n <SystemSymbol\n name=\"chevron.forward.2\"\n size={15}\n fallback={\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"m6 17 5-5-5-5\" />\n <path d=\"m13 17 5-5-5-5\" />\n </svg>\n }\n />\n }\n />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" data-slot=\"toolbar-overflow-menu\">\n {overflowed.map((i, n) => (\n <React.Fragment key={i.id}>\n {n > 0 && (i.section ?? i.id) !== (overflowed[n - 1]?.section ?? overflowed[n - 1]?.id) ? <DropdownMenuSeparator /> : null}\n {i.menu}\n </React.Fragment>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n </div>\n );\n}\n","import * as React from \"react\";\n\nimport { RadixCheckIcon, ChevronRightIcon, PlusIcon } from \"../icons\";\nimport { cn } from \"./cn\";\nimport { Spinner } from \"./spinner\";\nimport { Text } from \"./text\";\n\n/*\n * The document apps' parts: Finder's Get Info window (header, disclosure sections, right-aligned\n * facts) and its status bar, Reminders' list (tinted title and count, ring rows), the empty states\n * of Notes and Reminders (\"No Notes\"), Simulator's device and FileMerge's two panes.\n */\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Get Info */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface InfoHeaderProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** The thing's icon or symbol, drawn at 32 pt. */\n icon: React.ReactNode;\n title: React.ReactNode;\n /** Trailing on the title line (Get Info: the size). */\n value?: React.ReactNode;\n /** The line under the title (Get Info: \"Modified: Today, 6:23 AM\"). */\n subtitle?: React.ReactNode;\n}\n\n/**\n * Get Info's head: the big icon, the name in bold with its size trailing, one secondary line. A long\n * name wraps under itself; give a `MiddleTruncate` (text.tsx) as the title to cut its middle on one\n * line instead, as Get Info does a long file name. The icon keeps the color it is given.\n */\nexport function InfoHeader({ icon, title, value, subtitle, className, ...props }: InfoHeaderProps) {\n return (\n <header data-slot=\"info-header\" className={cn(\"flex items-start gap-3 px-3 py-3\", className)} {...props}>\n <span className=\"flex size-icon-xl shrink-0 items-center justify-center text-tint [&_img]:size-icon-xl [&_svg]:size-icon-xl\">{icon}</span>\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <div className=\"flex min-w-0 items-baseline gap-2\">\n <Text as=\"h1\" variant=\"headline\" data-slot=\"info-header-title\" className=\"min-w-0 flex-1 wrap-anywhere\">\n {title}\n </Text>\n {value !== undefined && value !== null ? (\n <Text tabular className=\"shrink-0\">\n {value}\n </Text>\n ) : null}\n </div>\n {subtitle ? (\n <Text tone=\"secondary\" truncate>\n {subtitle}\n </Text>\n ) : null}\n </div>\n </header>\n );\n}\n\nexport interface DisclosureProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** The section's name, without its colon (Get Info writes \"General:\"). */\n title: string;\n /** Uncontrolled: open at first (default true). */\n defaultOpen?: boolean;\n /** Controlled open state. */\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\n/**\n * Get Info's collapsible section: a disclosure triangle and \"Title:\" on a 24 pt line, a hairline\n * above, the content indented under the title. The triangle turns down when open.\n */\nexport function Disclosure({ title, defaultOpen = true, open, onOpenChange, className, children, ...props }: DisclosureProps) {\n const [own, setOwn] = React.useState(defaultOpen);\n const shown = open ?? own;\n const id = React.useId();\n const toggle = () => {\n if (open === undefined) setOwn(!shown);\n onOpenChange?.(!shown);\n };\n return (\n <section data-slot=\"disclosure\" data-state={shown ? \"open\" : \"closed\"} className={cn(\"border-t border-separator\", className)} {...props}>\n <button\n type=\"button\"\n aria-expanded={shown}\n aria-controls={id}\n onClick={toggle}\n className=\"focus-ring flex h-row-compact w-full items-center gap-1 px-1.5 text-left text-body text-label\"\n >\n <ChevronRightIcon aria-hidden className={cn(\"size-icon-sm shrink-0 text-label-secondary transition-transform duration-100\", shown && \"rotate-90\")} />\n <span className=\"truncate\">{title}:</span>\n </button>\n {shown ? (\n <div id={id} className=\"pb-3 pl-6 pr-3\">\n {children}\n </div>\n ) : null}\n </section>\n );\n}\n\nexport interface InfoFact {\n label: string;\n value: React.ReactNode;\n}\n\nexport interface InfoFactsProps extends React.HTMLAttributes<HTMLDListElement> {\n facts: ReadonlyArray<InfoFact>;\n /** A narrow window: each label over its value (Get Info never gets this narrow; a canvas pane does). */\n stacked?: boolean;\n}\n\n/**\n * Get Info's facts: the labels right-aligned in one column (\"Kind:\", \"Where:\"), the values beside\n * them, wrapping, selectable. Each row carries `data-fact=\"<label>\"`.\n *\n * The label column is as wide as its longest label (AppKit's form layout: the labels' column sizes\n * to them), up to half the width; a longer label wraps inside its column (desktop.css, the\n * `info-facts` grid). Never a fixed width: a label wider than a fixed column ran into its value\n * (\"Pages per keyword10\").\n */\nexport function InfoFacts({ facts, stacked = false, className, ...props }: InfoFactsProps) {\n return (\n <dl\n data-slot=\"info-facts\"\n data-stacked={stacked ? \"\" : undefined}\n className={cn(stacked ? \"flex flex-col gap-0.5\" : \"grid gap-x-2 gap-y-0.5\", \"text-body\", className)}\n {...props}\n >\n {facts.map((f) => (\n <div key={f.label} data-fact={f.label} className={stacked ? \"flex min-w-0 flex-col\" : \"contents\"}>\n <dt className={cn(\"text-label\", stacked ? \"text-label-secondary\" : \"min-w-0 break-words text-right\")}>{f.label}:</dt>\n <dd className=\"min-w-0 select-text break-words text-label\">{f.value}</dd>\n </div>\n ))}\n </dl>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Reminders */\n/* ---------------------------------------------------------------------------------------------- */\n\n/** A Reminders list's color (its icon, title and count). */\nexport type ListColor = \"tint\" | \"red\" | \"orange\" | \"yellow\" | \"green\" | \"blue\" | \"purple\" | \"gray\";\n\nconst LIST_COLOR: Record<ListColor, string> = {\n tint: \"text-tint\",\n red: \"text-system-red\",\n orange: \"text-system-orange\",\n yellow: \"text-system-yellow\",\n green: \"text-system-green\",\n blue: \"text-system-blue\",\n purple: \"text-system-purple\",\n gray: \"text-system-gray\",\n};\n\nexport interface ListHeadingProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** The list's name, in the list's color, large and bold. */\n title: React.ReactNode;\n /** The count trailing in the same color and size. */\n count?: number;\n /** The quiet line under the title, above its hairline (\"0 Completed\"). */\n detail?: React.ReactNode;\n /** The list's own color (Reminders gives every list one). Default: the accent. A list whose\n * color is the accent can read as a link beside accent buttons; give it its own. */\n color?: ListColor;\n}\n\n/** Reminders' list heading: the name large and bold in the list's color, its count trailing, a quiet line under it. */\nexport function ListHeading({ title, count, detail, color = \"tint\", className, ...props }: ListHeadingProps) {\n return (\n <header data-slot=\"list-heading\" data-color={color} className={cn(\"flex flex-col gap-1\", className)} {...props}>\n <div className=\"flex items-baseline gap-3\">\n <Text as=\"h1\" variant=\"title-large\" emphasized truncate className={cn(\"min-w-0 flex-1\", LIST_COLOR[color])}>\n {title}\n </Text>\n {count !== undefined ? (\n <Text variant=\"title-large\" tabular data-slot=\"list-heading-count\" className={cn(\"shrink-0\", LIST_COLOR[color])}>\n {count.toLocaleString()}\n </Text>\n ) : null}\n </div>\n {detail ? (\n <div className=\"border-b border-separator pb-2\">\n <Text tone=\"secondary\">{detail}</Text>\n </div>\n ) : null}\n </header>\n );\n}\n\nexport interface ChecklistRowProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n title: React.ReactNode;\n /** The line under the title (a folder, a due time). */\n subtitle?: React.ReactNode;\n /** `open` an empty ring · `running` the activity indicator in the ring (work still going) · `done` filled with a check. */\n state?: \"open\" | \"running\" | \"done\";\n /** Makes the ring a checkbox (Reminders' complete). Absent: the ring only shows the state. */\n onToggle?: () => void;\n /** The ring's name when it is a checkbox (\"Complete\"). */\n toggleLabel?: string;\n /** Trailing on the title line (a time, a flag). */\n trailing?: React.ReactNode;\n /** The ring can't act on this row (nothing to complete or hold): drawn faint, so it never reads as a checkbox. */\n disabled?: boolean;\n}\n\n/**\n * Reminders' row: a 20 pt ring, the title, a secondary line under it, and the hairline under the\n * text only (it starts where the text does).\n */\nexport function ChecklistRow({ title, subtitle, state = \"open\", onToggle, toggleLabel = \"Complete\", trailing, disabled, className, ...props }: ChecklistRowProps) {\n const ring = (\n <span\n aria-hidden={onToggle ? true : undefined}\n data-ring-disabled={disabled || undefined}\n className={cn(\n \"flex size-icon-lg items-center justify-center rounded-full border\",\n // Disabled: a solid gray disc, plainly not a checkbox (a dashed hairline read as missing).\n state === \"done\" ? \"border-tint bg-tint text-tint-label\" : disabled ? \"border-label-quaternary bg-fill-secondary\" : \"border-label-tertiary\",\n \"[&_svg]:size-icon-sm\",\n )}\n >\n {state === \"running\" ? <Spinner size=\"sm\" label=\"Running\" /> : state === \"done\" ? <RadixCheckIcon /> : null}\n </span>\n );\n return (\n <div data-slot=\"checklist-row\" data-state={state} className={cn(\"flex items-start gap-3\", className)} {...props}>\n {onToggle && !disabled ? (\n <button type=\"button\" role=\"checkbox\" aria-checked={state === \"done\"} aria-label={toggleLabel} onClick={onToggle} className=\"focus-ring mt-1.5 shrink-0 rounded-full\">\n {ring}\n </button>\n ) : (\n <span className=\"mt-1.5 shrink-0\">{ring}</span>\n )}\n <div className=\"flex min-w-0 flex-1 items-start gap-2 border-b border-separator py-1.5\">\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <Text truncate>{title}</Text>\n {subtitle ? (\n <Text tone=\"secondary\" truncate>\n {subtitle}\n </Text>\n ) : null}\n </div>\n {trailing ? <div className=\"flex shrink-0 items-center gap-2\">{trailing}</div> : null}\n </div>\n </div>\n );\n}\n\nexport interface ChecklistAddRowProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\"> {\n /** What pressing it makes (\"New session\"). */\n label: string;\n}\n\n/**\n * Reminders' add row at the foot of a list: a ring holding a plus in the list's accent, the label\n * in the accent beside it, lined up with the rows' rings and text. Pressing it starts a new item.\n */\nexport function ChecklistAddRow({ label, className, type = \"button\", ...props }: ChecklistAddRowProps) {\n return (\n <button type={type} data-slot=\"checklist-add-row\" className={cn(\"focus-ring flex w-full items-center gap-3 rounded-control py-1.5 text-left text-tint disabled:opacity-40\", className)} {...props}>\n <span aria-hidden className=\"flex size-icon-lg shrink-0 items-center justify-center rounded-full bg-tint text-tint-label [&_svg]:size-icon-sm\">\n <PlusIcon />\n </span>\n <Text tone=\"tint\">{label}</Text>\n </button>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Empty content (Notes' \"No Notes\", Reminders' \"No Reminders\") */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface EmptyContentProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** The thing's symbol (`SystemSymbol size={48}`), large and quiet over the title, as\n * ContentUnavailableView draws it. Absent: the title alone (\"No Notes\"). */\n icon?: React.ReactNode;\n /** \"No Notes\": large, centered, in the secondary label color (legible in both themes). */\n title: React.ReactNode;\n /** At most one short secondary line, its lines balanced. */\n message?: React.ReactNode;\n /** Buttons under the line, the default one rightmost (Mail's \"2 messages selected\" with what to do with them). */\n actions?: React.ReactNode;\n}\n\n/**\n * The empty list of Notes and Reminders, and ContentUnavailableView: an optional large tertiary\n * symbol, one large secondary line centered in the space, one balanced secondary line under it, and\n * at most a button or two. Never drawn over a table or list: it IS the content when there is none.\n */\nexport function EmptyContent({ icon, title, message, actions, className, ...props }: EmptyContentProps) {\n return (\n <div data-slot=\"empty-content\" className={cn(\"flex h-full min-h-40 flex-col items-center justify-center gap-1 px-6 text-center\", className)} {...props}>\n {icon ? (\n <span data-slot=\"empty-content-symbol\" aria-hidden className=\"mb-2 flex items-center justify-center text-label-tertiary [&_svg]:size-12\">\n {icon}\n </span>\n ) : null}\n <Text variant=\"title-1\" tone=\"secondary\" emphasized={icon ? true : undefined}>\n {title}\n </Text>\n {message ? (\n <Text as=\"p\" tone=\"secondary\" className=\"mt-1 max-w-sm text-balance\">\n {message}\n </Text>\n ) : null}\n {actions ? <div className=\"mt-3 flex items-center gap-2\">{actions}</div> : null}\n </div>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Status bar (Finder, the Clipboard window, FileMerge) */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface StatusBarProps extends React.HTMLAttributes<HTMLDivElement> {\n /** `center`: Finder's \"4 items, 120 GB available\". `start`: FileMerge's status, the Clipboard window's kind. */\n align?: \"start\" | \"center\";\n /** Controls at the trailing edge (FileMerge's Actions). */\n trailing?: React.ReactNode;\n}\n\n/** The window's foot: a hairline, then one quiet line at the content minimum, 13 pt (the window's\n * status, never a message; AppKit draws it at 11 pt, the desktop standard never draws content under 13). */\nexport function StatusBar({ align = \"start\", trailing, className, children, ...props }: StatusBarProps) {\n return (\n <div\n data-slot=\"status-bar\"\n className={cn(\"flex h-control-lg shrink-0 items-center gap-2 border-t border-separator px-3 text-body text-label-secondary\", className)}\n {...props}\n >\n <span className={cn(\"min-w-0 flex-1 truncate\", align === \"center\" && \"text-center\")}>{children}</span>\n {trailing ? <span className=\"flex shrink-0 items-center gap-2\">{trailing}</span> : null}\n </div>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Simulator's device */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface DeviceFrameProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The device's name, its accessible label (\"iPhone\"). */\n label: string;\n /**\n * The status bar's clock (\"9:41\"): with it the screen draws iOS's status bar (the time at the\n * leading edge, signal, Wi-Fi and battery at the trailing edge, either side of the Dynamic Island).\n */\n time?: string;\n /** The Home Screen's dock: the glass shelf at the foot of the screen, empty (no apps installed). */\n dock?: boolean;\n}\n\n/*\n * Device art, not interface color: Simulator draws the phone in its own black titanium in both\n * appearances, with a black screen until the device boots.\n */\nconst DEVICE_BODY = \"#2b2b2d\";\nconst DEVICE_EDGE = \"#4a4a4d\";\nconst DEVICE_SCREEN = \"#000000\";\nconst DEVICE_INK = \"#ffffff\";\nconst DEVICE_GLASS = \"rgba(255,255,255,0.16)\";\n\n/**\n * Simulator's window body: an iPhone at 1:1 (240 × 520 pt) with its bezel, Dynamic Island and side\n * buttons, centered, nothing else. With `time` the screen carries iOS's status bar; with `dock` the\n * Home Screen's empty glass dock and the home indicator. The children draw on the screen (light text\n * on black), between the status bar and the dock.\n */\nexport function DeviceFrame({ label, time, dock = false, className, children, ...props }: DeviceFrameProps) {\n return (\n <div data-slot=\"device-frame\" className={cn(\"flex h-full min-h-0 items-center justify-center overflow-auto p-4\", className)} {...props}>\n <div role=\"img\" aria-label={label} className=\"relative h-130 w-60 shrink-0\">\n <svg viewBox=\"0 0 240 520\" aria-hidden className=\"absolute inset-0 size-full\">\n <rect x=\"-2\" y=\"96\" width=\"4\" height=\"22\" rx=\"2\" fill={DEVICE_EDGE} />\n <rect x=\"-2\" y=\"132\" width=\"4\" height=\"40\" rx=\"2\" fill={DEVICE_EDGE} />\n <rect x=\"-2\" y=\"180\" width=\"4\" height=\"40\" rx=\"2\" fill={DEVICE_EDGE} />\n <rect x=\"238\" y=\"150\" width=\"4\" height=\"62\" rx=\"2\" fill={DEVICE_EDGE} />\n <rect x=\"1\" y=\"1\" width=\"238\" height=\"518\" rx=\"44\" fill={DEVICE_BODY} stroke={DEVICE_EDGE} strokeWidth=\"2\" />\n <rect x=\"9\" y=\"9\" width=\"222\" height=\"502\" rx=\"36\" fill={DEVICE_SCREEN} />\n <rect x=\"86\" y=\"20\" width=\"68\" height=\"20\" rx=\"10\" fill={DEVICE_SCREEN} stroke={DEVICE_BODY} />\n {time !== undefined ? (\n <g data-slot=\"device-status-bar\">\n <text x=\"50\" y=\"35\" textAnchor=\"middle\" fill={DEVICE_INK} fontSize=\"12\" fontWeight=\"600\" fontFamily=\"-apple-system, BlinkMacSystemFont, sans-serif\">\n {time}\n </text>\n {/* Signal: four bars rising. */}\n {[0, 1, 2, 3].map((i) => (\n <rect key={i} x={165 + i * 3.5} y={33 - (i + 1) * 2.2} width=\"2.5\" height={(i + 1) * 2.2} rx=\"0.6\" fill={DEVICE_INK} />\n ))}\n {/* Wi-Fi: three arcs over a dot. */}\n <path d=\"M185 24.5a10 10 0 0 1 13 0M187.3 27.2a6.5 6.5 0 0 1 8.4 0M189.6 29.9a3 3 0 0 1 3.8 0\" stroke={DEVICE_INK} strokeWidth=\"1.5\" fill=\"none\" strokeLinecap=\"round\" />\n <circle cx=\"191.5\" cy=\"32.3\" r=\"1\" fill={DEVICE_INK} />\n {/* Battery: an outline, its charge and the cap. */}\n <rect x=\"203\" y=\"24.5\" width=\"17\" height=\"9\" rx=\"2.4\" stroke={DEVICE_INK} strokeOpacity=\"0.4\" fill=\"none\" />\n <rect x=\"204.6\" y=\"26.1\" width=\"13.8\" height=\"5.8\" rx=\"1.3\" fill={DEVICE_INK} />\n <rect x=\"221\" y=\"27.3\" width=\"1.4\" height=\"3.4\" rx=\"0.6\" fill={DEVICE_INK} fillOpacity=\"0.4\" />\n </g>\n ) : null}\n {dock ? (\n <g data-slot=\"device-dock\">\n <rect x=\"20\" y=\"430\" width=\"200\" height=\"62\" rx=\"22\" fill={DEVICE_GLASS} />\n <rect x=\"86\" y=\"500\" width=\"68\" height=\"3.5\" rx=\"1.75\" fill={DEVICE_INK} />\n </g>\n ) : null}\n </svg>\n <div className={cn(\"dark absolute inset-x-4 flex flex-col items-center justify-center gap-2 text-center text-label\", time !== undefined ? \"top-14\" : \"top-14\", dock ? \"bottom-24\" : \"bottom-12\")}>{children}</div>\n </div>\n </div>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* FileMerge's two panes */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface ComparePane {\n /** The file and where it lives (\"old.py - /Users/…\"), over its pane. */\n title: React.ReactNode;\n /** The pop-up under the title that jumps to a function (FileMerge's \"total\" ⌃⌄). */\n selector?: React.ReactNode;\n content: React.ReactNode;\n}\n\n/** One difference: the lines it spans on each side (0-based, `end` exclusive; an insertion has start === end). */\nexport interface CompareChange {\n left: readonly [start: number, end: number];\n right: readonly [start: number, end: number];\n}\n\nexport interface CompareViewProps extends React.HTMLAttributes<HTMLDivElement> {\n left: ComparePane;\n right: ComparePane;\n /**\n * The differences, drawn in the gutter between the panes as FileMerge draws them: a band from each\n * change on the left to where it lands on the right, numbered, with its arrow. Line positions\n * follow `lineHeight`.\n */\n changes?: ReadonlyArray<CompareChange>;\n /** The selected difference (its band in the selection color). */\n current?: number;\n /** One text line's height in px in both panes (default 16, the code style's). */\n lineHeight?: number;\n /** The merge pane under both (FileMerge's result), with its own pop-up centered over it. */\n merge?: { selector?: React.ReactNode; content: React.ReactNode } | React.ReactNode;\n /** The status line at the foot (\"status: 2 differences\"). */\n status: React.ReactNode;\n /** Trailing in the status bar (FileMerge's Actions pop-up). */\n actions?: React.ReactNode;\n}\n\n/** The languages `SourceText` colors (Xcode's default theme); \"plain\" colors nothing. */\nexport type SourceLanguage = \"python\" | \"typescript\" | \"plain\";\n\nconst KEYWORDS: Record<Exclude<SourceLanguage, \"plain\">, ReadonlySet<string>> = {\n python: new Set(\n \"False None True and as assert async await break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield print\".split(\" \"),\n ),\n typescript: new Set(\n \"abstract as async await break case catch class const continue default delete do else enum export extends false finally for from function if implements import in instanceof interface let new null of private protected public readonly return static super switch this throw true try type typeof undefined var void while with yield\".split(\" \"),\n ),\n};\n\nconst TOKEN = /(\\x22(?:[^\\x22\\\\]|\\\\.)*\\x22?|\\x27(?:[^\\x27\\\\]|\\\\.)*\\x27?|\\x60(?:[^\\x60\\\\]|\\\\.)*\\x60?)|(#.*|\\/\\/.*)|(\\b\\d[\\d_]*(?:\\.\\d+)?(?:e[+-]?\\d+)?\\b)|([A-Za-z_$][\\w$]*)/g;\n\n/**\n * One line of source in Xcode's default colors: keywords, strings, numbers and comments; the rest\n * in the label color. A line-at-a-time scanner (no multi-line strings), enough for a diff or a snippet.\n */\nexport function SourceText({ text, language }: { text: string; language: SourceLanguage }): React.ReactNode {\n if (language === \"plain\" || !text) return text;\n const keywords = KEYWORDS[language];\n const comment = language === \"python\" ? \"#\" : \"//\";\n const out: React.ReactNode[] = [];\n let at = 0;\n for (const m of text.matchAll(TOKEN)) {\n const [whole, str, cmt, num, word] = m;\n const start = m.index ?? 0;\n if (cmt && !cmt.startsWith(comment)) continue;\n if (start > at) out.push(text.slice(at, start));\n const tone = str ? \"text-syntax-string\" : cmt ? \"text-syntax-comment\" : num ? \"text-syntax-number\" : word && keywords.has(word) ? \"text-syntax-keyword\" : null;\n out.push(\n tone ? (\n <span key={start} data-syntax={str ? \"string\" : cmt ? \"comment\" : num ? \"number\" : \"keyword\"} className={tone}>\n {whole}\n </span>\n ) : (\n whole\n ),\n );\n at = start + whole.length;\n if (cmt) break;\n }\n if (at < text.length) out.push(text.slice(at));\n return out;\n}\n\nexport interface CompareLinesProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The file's text, one entry per line. */\n lines: ReadonlyArray<string>;\n /** The file's language, colored as FileMerge colors it (Xcode's theme). Default \"plain\". */\n language?: SourceLanguage;\n /** The lines each difference spans in THIS pane (0-based, `end` exclusive), in the order CompareView numbers them. */\n changes?: ReadonlyArray<readonly [start: number, end: number]>;\n /** The selected difference: its lines in the selection tint between two selection rules. */\n current?: number | undefined;\n}\n\n/**\n * One FileMerge pane's text: monospaced lines 16 pt apart (CompareView's `lineHeight`), each\n * difference's lines on a gray band and the selected one tinted between two rules, as FileMerge\n * marks the change it would act on. An insertion point (start === end) is drawn as the rule alone.\n */\nexport function CompareLines({ lines, changes = [], current, language = \"plain\", className, ...props }: CompareLinesProps) {\n const changeOf = (line: number) => changes.findIndex(([a, b]) => line >= a && line < b);\n return (\n <div data-slot=\"compare-lines\" className={cn(\"min-w-max py-0 font-mono text-code\", className)} {...props}>\n {lines.map((text, i) => {\n const change = changeOf(i);\n const selected = change >= 0 && change === current;\n const first = change >= 0 && changes[change]?.[0] === i;\n const last = change >= 0 && (changes[change]?.[1] ?? 0) - 1 === i;\n const insertion = changes.findIndex(([a, b]) => a === b && a === i);\n return (\n <div\n key={i}\n data-line={i + 1}\n data-change={change >= 0 ? change + 1 : undefined}\n data-current={selected ? \"\" : undefined}\n className={cn(\n \"h-4 whitespace-pre px-1 text-label\",\n change >= 0 && (selected ? \"bg-compare-current\" : \"bg-fill\"),\n selected && first && \"border-t border-compare-current-edge\",\n selected && last && \"border-b border-compare-current-edge\",\n insertion >= 0 && insertion === current && \"border-t border-compare-current-edge\",\n )}\n >\n {text ? <SourceText text={text} language={language} /> : \" \"}\n </div>\n );\n })}\n </div>\n );\n}\n\nconst GUTTER = 60;\n\nfunction isMergePane(merge: CompareViewProps[\"merge\"]): merge is { selector?: React.ReactNode; content: React.ReactNode } {\n return typeof merge === \"object\" && merge !== null && !React.isValidElement(merge) && \"content\" in merge;\n}\n\n/** The gutter's bands: each change's left lines joined to its right lines by a curved band, numbered with an arrow. */\nfunction CompareGutter({ changes, current, lineHeight }: { changes: ReadonlyArray<CompareChange>; current: number | undefined; lineHeight: number }) {\n const height = Math.max(1, ...changes.map((c) => Math.max(c.left[1], c.right[1]) + 1)) * lineHeight;\n const mid = GUTTER / 2;\n return (\n <svg data-slot=\"compare-gutter-bands\" aria-hidden width={GUTTER} height={height} className=\"block overflow-visible\">\n {changes.map((c, i) => {\n const [l0, l1] = [c.left[0] * lineHeight, Math.max(c.left[1], c.left[0]) * lineHeight];\n const [r0, r1] = [c.right[0] * lineHeight, Math.max(c.right[1], c.right[0]) * lineHeight];\n const y = (r0 + r1) / 2 || r0;\n const selected = i === current;\n return (\n <g key={i} data-change={i + 1} data-current={selected ? \"\" : undefined}>\n <path\n d={`M0 ${l0} C${mid} ${l0} ${mid} ${r0} ${GUTTER} ${r0} L${GUTTER} ${r1} C${mid} ${r1} ${mid} ${l1} 0 ${l1} Z`}\n className={selected ? \"fill-compare-current stroke-compare-current-edge\" : \"fill-fill-tertiary stroke-separator\"}\n strokeWidth=\"1\"\n />\n <path d={`M14 ${y + 6} H${GUTTER - 16} M${GUTTER - 21} ${y + 2} L${GUTTER - 15} ${y + 6} L${GUTTER - 21} ${y + 10}`} className=\"stroke-label-secondary\" strokeWidth=\"1.5\" fill=\"none\" />\n <text x={mid - 2} y={y + 2} textAnchor=\"middle\" className=\"fill-label\" fontSize=\"9\" fontFamily=\"inherit\">\n {i + 1}\n </text>\n </g>\n );\n })}\n </svg>\n );\n}\n\n/**\n * FileMerge's window body: the two files side by side, each with its name and place over a pop-up\n * and a bordered text pane, the gutter between them where the differences are joined by numbered\n * bands, the merge pane under both behind a divider dot with its own pop-up, and the status bar\n * (\"status: 2 differences\") with the Actions pop-up trailing.\n */\nexport function CompareView({ left, right, changes = [], current, lineHeight = 16, merge, status, actions, className, ...props }: CompareViewProps) {\n const head = (side: \"left\" | \"right\", p: ComparePane) => (\n <div data-compare-head={side} className=\"flex min-w-0 flex-1 flex-col\">\n <Text truncate data-slot=\"compare-pane-title\" className=\"px-1 py-0.5\">\n {p.title}\n </Text>\n {p.selector ? <div className=\"flex px-0.5 pb-1 [&>*]:w-full\">{p.selector}</div> : null}\n </div>\n );\n const body = (side: \"left\" | \"right\", p: ComparePane) => (\n <div data-compare-pane={side} className=\"min-h-0 min-w-0 flex-1 overflow-auto border border-separator bg-content font-mono text-code\">\n {p.content}\n </div>\n );\n const mergePane = isMergePane(merge) ? merge : merge !== undefined ? { content: merge } : null;\n return (\n <div data-slot=\"compare-view\" className={cn(\"flex h-full min-h-0 flex-col bg-window\", className)} {...props}>\n {/* Each file's path line and pop-up over its pane; the gutter starts where the text does. */}\n <div className=\"flex shrink-0 px-1 pt-1\">\n {head(\"left\", left)}\n <div aria-hidden className=\"w-15 shrink-0\" />\n {head(\"right\", right)}\n </div>\n <div className=\"flex min-h-0 flex-1 px-1\">\n {body(\"left\", left)}\n <div data-compare-gutter aria-hidden className=\"w-15 min-h-0 shrink-0 overflow-hidden border-y border-separator bg-content\">\n {changes.length > 0 ? <CompareGutter changes={changes} current={current} lineHeight={lineHeight} /> : null}\n </div>\n {body(\"right\", right)}\n </div>\n {mergePane ? (\n <div data-compare-merge className=\"flex h-2/5 shrink-0 flex-col px-1\">\n <div aria-hidden className=\"flex h-3 shrink-0 items-center justify-center\">\n <span className=\"size-1 rounded-full bg-label-tertiary\" />\n </div>\n {mergePane.selector ? <div className=\"flex justify-center pb-1 [&>*]:w-1/2\">{mergePane.selector}</div> : null}\n <div className=\"min-h-0 flex-1 overflow-auto border border-separator bg-content font-mono text-code\">{mergePane.content}</div>\n </div>\n ) : null}\n <StatusBar trailing={actions} className=\"mt-1 border-t-0 text-body\">\n {status}\n </StatusBar>\n </div>\n );\n}\n","import * as React from \"react\";\n\nimport { ChevronRightIcon } from \"../icons\";\nimport { cn } from \"./cn\";\nimport { MiddleTruncate, Text } from \"./text\";\n\n/**\n * The monitor apps' parts (Activity Monitor, Console, System Information, Finder): the summary strip\n * under a process table, a label/value fact list, a path bar, and a scope bar. Pages place them with\n * `Page footer`, `Page scopeBar` and `Page sidebar`.\n */\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Summary strip (Activity Monitor's footer) */\n/* ---------------------------------------------------------------------------------------------- */\n\n/**\n * Activity Monitor's summary under its table: one rounded box centered in the footer, its panes side\n * by side with hairlines between them (facts, a graph, more facts).\n */\nexport function SummaryStrip({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div data-slot=\"summary-strip-frame\" className=\"flex justify-center px-5 py-3\">\n <div\n role=\"group\"\n data-slot=\"summary-strip\"\n className={cn(\"flex w-full max-w-3xl divide-x divide-separator overflow-hidden rounded-control border border-separator bg-content\", className)}\n {...props}\n />\n </div>\n );\n}\n\nexport interface SummaryPaneProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** A graph's caption, drawn in small capitals at the pane's top (\"CPU LOAD\"). */\n title?: string;\n}\n\n/**\n * One pane of the strip: `SummaryFact` rows, or a titled graph. A facts pane is as wide as its\n * longest label and value (never cut: Activity Monitor's \"Compressed:\" reads whole); the graph panes\n * share what is left.\n */\nexport function SummaryPane({ title, className, children, ...props }: SummaryPaneProps) {\n return (\n <div\n data-slot=\"summary-pane\"\n data-kind={title ? \"graph\" : \"facts\"}\n className={cn(\"flex flex-col px-3 py-2\", title ? \"min-w-0 flex-1\" : \"min-w-44 shrink-0 grow-0\", className)}\n {...props}\n >\n {title ? (\n <div data-slot=\"summary-pane-title\" className=\"truncate pb-1 text-center text-caption-2 uppercase text-label-secondary\">\n {title}\n </div>\n ) : null}\n {children}\n </div>\n );\n}\n\nconst FACT_TONE = {\n red: \"text-system-red\",\n blue: \"text-system-blue\",\n green: \"text-system-green\",\n orange: \"text-system-orange\",\n purple: \"text-system-purple\",\n} as const;\n\nexport interface SummaryFactProps extends React.HTMLAttributes<HTMLDivElement> {\n label: React.ReactNode;\n value: React.ReactNode;\n /** Activity Monitor colors a value by its graph series (System red, User blue). */\n tone?: keyof typeof FACT_TONE;\n}\n\n/** A label and its right-aligned value, with a hairline under it (Activity Monitor's \"System: 14.17%\").\n * The label is never cut: its pane is as wide as its longest fact. */\nexport function SummaryFact({ label, value, tone, className, ...props }: SummaryFactProps) {\n return (\n <div data-slot=\"summary-fact\" className={cn(\"flex h-control items-center gap-3 border-b border-separator text-body last:border-b-0\", className)} {...props}>\n <span data-slot=\"summary-fact-label\" className=\"flex-1 whitespace-nowrap text-label\">\n {label}\n </span>\n <span className={cn(\"shrink-0 tabular-nums\", tone ? FACT_TONE[tone] : \"text-label\")}>{value}</span>\n </div>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Fact list (System Information's detail) */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface Fact {\n label: string;\n value: React.ReactNode;\n}\n\nexport interface FactListProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** The bold heading over the facts (\"Hardware Overview:\"). */\n title?: React.ReactNode;\n facts: ReadonlyArray<Fact>;\n}\n\n/**\n * System Information's facts: a bold heading, then label and value in two columns, the labels as\n * wide as the longest one, plain text, selectable. Each row carries `data-fact=\"<label>\"`.\n */\nexport function FactList({ title, facts, className, ...props }: FactListProps) {\n return (\n <section data-slot=\"fact-list\" className={cn(\"flex flex-col gap-2\", className)} {...props}>\n {title ? (\n <Text as=\"h2\" variant=\"headline\">\n {title}\n </Text>\n ) : null}\n <dl data-slot=\"fact-grid\" className=\"grid gap-x-3 gap-y-0.5 pl-1.5 text-body\">\n {facts.map((f) => (\n <div key={f.label} data-fact={f.label} className=\"col-span-full grid grid-cols-subgrid\">\n <dt className=\"whitespace-nowrap text-label\">{f.label}:</dt>\n {/* One line, as System Information: a long text value (a host name, a path) is cut in\n the middle, whole in its tooltip, never wrapped mid-token. */}\n <dd className=\"min-w-0 select-text text-label\">{typeof f.value === \"string\" ? <MiddleTruncate text={f.value} /> : f.value}</dd>\n </div>\n ))}\n </dl>\n </section>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Path bar (Finder, System Information) */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface PathBarItem {\n label: string;\n icon?: React.ReactNode;\n}\n\n/**\n * Finder's path bar: where the shown thing lives, each step separated by a chevron, at the window's\n * foot. When the bar is too narrow, Finder's way: the steps nearest the top shrink to their icon\n * alone (the name is the tooltip), the last step always keeps its name; only when even that is too\n * wide do the top steps give way to one \"…\" (its tooltip is the whole path). Never an ellipsis on\n * every step; the last step is cut only when it alone does not fit.\n */\nexport function PathBar({ items, className, ...props }: { items: ReadonlyArray<PathBarItem> } & React.HTMLAttributes<HTMLElement>) {\n const ref = React.useRef<HTMLElement>(null);\n // How many leading steps show their icon only, then how many are gone behind \"…\".\n const [squeeze, setSqueeze] = React.useState({ compact: 0, hidden: 0 });\n const signature = items.map((i) => i.label).join(\"\\u0000\");\n const [measured, setMeasured] = React.useState(signature);\n // New steps: measure again from the whole path.\n if (measured !== signature) {\n setMeasured(signature);\n setSqueeze({ compact: 0, hidden: 0 });\n }\n // Only steps with an icon can shrink to it; the last step never does.\n const compactable = items.slice(0, -1).filter((i) => i.icon).length;\n React.useLayoutEffect(() => {\n const el = ref.current;\n if (!el || el.scrollWidth <= el.clientWidth + 1) return;\n if (squeeze.compact < compactable) setSqueeze((s) => ({ ...s, compact: s.compact + 1 }));\n else if (squeeze.hidden < items.length - 1) setSqueeze((s) => ({ ...s, hidden: s.hidden + 1 }));\n }, [squeeze, signature, items.length, compactable]);\n React.useEffect(() => {\n const el = ref.current;\n if (!el || typeof ResizeObserver === \"undefined\") return;\n let width = el.clientWidth;\n let timer: ReturnType<typeof setTimeout> | undefined;\n // Measured again after the observer's turn, never inside it (a layout change inside a\n // ResizeObserver callback is the \"ResizeObserver loop\" error).\n const observer = new ResizeObserver(() => {\n clearTimeout(timer);\n timer = setTimeout(() => {\n if (el.clientWidth === width) return;\n width = el.clientWidth;\n setSqueeze({ compact: 0, hidden: 0 });\n }, 0);\n });\n observer.observe(el);\n return () => {\n clearTimeout(timer);\n observer.disconnect();\n };\n }, []);\n const { hidden } = squeeze;\n // The first `compact` steps that have an icon draw it alone.\n const iconOnly = new Set<number>();\n for (let i = 0, n = 0; i < items.length - 1 && n < squeeze.compact; i += 1) {\n if (items[i]?.icon) {\n iconOnly.add(i);\n n += 1;\n }\n }\n const shown = items.slice(hidden);\n const lastOnly = hidden >= items.length - 1;\n return (\n <nav\n ref={ref}\n aria-label=\"Path\"\n data-slot=\"path-bar\"\n data-hidden-steps={hidden || undefined}\n data-compact-steps={squeeze.compact || undefined}\n className={cn(\"flex h-control shrink-0 items-center gap-1 overflow-hidden px-3 text-body text-label-secondary\", className)}\n {...props}\n >\n {hidden > 0 ? (\n <span data-slot=\"path-bar-more\" title={items.map((i) => i.label).join(\" › \")} className=\"shrink-0\">\n …\n </span>\n ) : null}\n {shown.map((item, i) => {\n const index = hidden + i;\n const last = i === shown.length - 1;\n const compact = iconOnly.has(index);\n return (\n <React.Fragment key={`${index}-${item.label}`}>\n {i > 0 || hidden > 0 ? <ChevronRightIcon aria-hidden className=\"size-icon-sm shrink-0 text-label-tertiary\" /> : null}\n <span\n data-slot=\"path-bar-step\"\n data-compact={compact || undefined}\n title={compact ? item.label : undefined}\n className={cn(\"flex items-center gap-1 whitespace-nowrap\", last ? \"text-label\" : null, last && lastOnly ? \"min-w-0\" : \"shrink-0\")}\n >\n {item.icon ? <span className=\"flex size-icon shrink-0 items-center justify-center\">{item.icon}</span> : null}\n {compact ? <span className=\"sr-only\">{item.label}</span> : <span className={last && lastOnly ? \"truncate\" : undefined}>{item.label}</span>}\n </span>\n </React.Fragment>\n );\n })}\n </nav>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Scope bar (Console's All Messages · Errors and Faults) */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface Scope<V extends string> {\n value: V;\n label: string;\n /** A count after the label (tertiary). */\n count?: number;\n}\n\nexport interface ScopeBarProps<V extends string> extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n value: V;\n onValueChange: (value: V) => void;\n scopes: ReadonlyArray<Scope<V>>;\n \"aria-label\": string;\n /** In a narrow column, lay the scopes out on as many lines as they need (Notes' lanes in its\n * 280 pt list) instead of scrolling sideways: every scope stays in view and reachable. */\n wrap?: boolean;\n}\n\n/**\n * The scope bar under a toolbar (Console, Finder's search scopes): recessed buttons, the chosen one\n * filled. It narrows what the table below shows; it never switches to another page (that is the\n * toolbar's Segmented). In a narrow column the bar scrolls sideways (no scrollbar) and keeps the chosen scope in view; a label is never cut.\n * With `wrap`, the scopes go onto a second line instead, so none is ever out of view.\n */\nexport function ScopeBar<V extends string>({ value, onValueChange, scopes, wrap = false, className, ...props }: ScopeBarProps<V>) {\n return (\n <div role=\"radiogroup\" data-slot=\"scope-bar\" data-wrap={wrap || undefined} className={cn(\"flex min-w-0 items-center gap-1\", wrap ? \"flex-wrap\" : \"overflow-x-auto\", className)} {...props}>\n {scopes.map((s) => {\n const on = s.value === value;\n return (\n <button\n key={s.value}\n type=\"button\"\n role=\"radio\"\n aria-checked={on}\n data-scope={s.value}\n data-state={on ? \"on\" : \"off\"}\n ref={on ? (el) => el?.scrollIntoView?.({ block: \"nearest\", inline: \"nearest\" }) : undefined}\n onClick={() => onValueChange(s.value)}\n className={cn(\n \"focus-ring flex h-control shrink-0 items-center gap-1.5 whitespace-nowrap rounded-control px-2.5 text-body transition-colors duration-100\",\n on ? \"bg-fill-secondary text-label\" : \"text-label-secondary hover:bg-fill hover:text-label\",\n )}\n >\n {s.label}\n {/* Room for three digits, so a count turning 9 to 10 (or 99 to 100) never moves the scopes after it. */}\n {s.count !== undefined ? (\n <span data-slot=\"scope-count\" className=\"inline-flex min-w-count tabular-nums text-label-tertiary\">\n {s.count.toLocaleString()}\n </span>\n ) : null}\n </button>\n );\n })}\n </div>\n );\n}\n","import * as React from \"react\";\n\nimport { Button } from \"./button\";\nimport { cn } from \"./cn\";\n\n/** One line of a log. `group` ties lines of one message together (hover shows the whole message). */\nexport interface LogLine {\n /** Stable and unique (a running line number works). */\n key: number;\n text: string;\n /** Shown in the gutter; unselectable, so a copy carries only the text. */\n number?: number;\n tone?: \"error\" | \"warning\" | null;\n group?: number;\n /** Console's Time column (the `console` look): the line's own time, already formatted. */\n time?: string;\n /** Console's Process column (the `console` look): who wrote the line. */\n source?: string;\n}\n\n/** The `console` look's column titles (Console.app: Type, Time, Process, Message). */\nexport interface LogColumns {\n type?: string;\n time?: string;\n source?: string;\n message?: string;\n}\n\nexport interface LogViewProps {\n lines: readonly LogLine[];\n /** Keep the newest line in view. The view turns it off when the person scrolls up, and on at the bottom. */\n follow: boolean;\n onFollowChange: (follow: boolean) => void;\n /** Shown instead of the lines when there are none. */\n empty?: React.ReactNode;\n /** A small action on the hovered line (e.g. Hide). */\n lineAction?: { label: string; onSelect: (line: LogLine) => void };\n /** The button that returns to the newest line while not following. */\n jumpLabel?: string;\n /** `plain` (default): monospace lines in a recessed box, long lines scroll sideways (a terminal's\n * output). `console`: Console.app's message list, flush and full width — a Type dot, Time,\n * Process and Message columns under a table header, 24 pt striped rows of body text, each message\n * on one line ending in an ellipsis (its whole text is the tooltip). */\n look?: \"plain\" | \"console\";\n /** The `console` look's column titles. */\n columns?: LogColumns;\n /** The `console` look's columns the person turned off (Console's View › Time, Process). The\n * Message column takes their width. */\n hide?: ReadonlyArray<\"time\" | \"source\">;\n \"aria-label\": string;\n className?: string;\n}\n\n/** The fixed line height (px): virtualising needs every row the same height (Console.app does the same). */\nexport const LOG_LINE_PX = 18;\n/** The `console` look's row height: a table row (24 pt), as Console's message list. */\nexport const CONSOLE_LINE_PX = 24;\nconst OVERSCAN = 30;\n\n/**\n * A live log, virtualised: only the lines in view are in the DOM, so 100,000+ lines scroll and\n * follow smoothly. Monospace, one line per row (long lines scroll sideways), selectable text,\n * error and warning tones, the hovered message highlighted as a whole, an optional per-line action,\n * and a \"jump to the newest line\" button while the person has scrolled up.\n */\nexport function LogView({ lines, follow, onFollowChange, empty, lineAction, jumpLabel = \"Jump to bottom\", look = \"plain\", columns, hide, className, ...props }: LogViewProps) {\n const showTime = !hide?.includes(\"time\");\n const showSource = !hide?.includes(\"source\");\n const consoleLook = look === \"console\";\n const LINE = consoleLook ? CONSOLE_LINE_PX : LOG_LINE_PX;\n const ref = React.useRef<HTMLDivElement>(null);\n const [view, setView] = React.useState({ top: 0, height: 600 });\n const [hoverGroup, setHoverGroup] = React.useState<number | null>(null);\n const followRef = React.useRef(follow);\n followRef.current = follow;\n\n React.useLayoutEffect(() => {\n const el = ref.current;\n if (!el) return;\n const measure = () => setView({ top: el.scrollTop, height: el.clientHeight || 600 });\n measure();\n if (typeof ResizeObserver === \"undefined\") return;\n const ro = new ResizeObserver(measure);\n ro.observe(el);\n return () => ro.disconnect();\n }, []);\n\n // The console look clips rows cleanly under its header (Console's message table): the list is\n // padded below its last line (less than a row) so that, scrolled to the end, the top row starts\n // exactly under the header and is never cut in half there.\n const padFor = (height: number) => (consoleLook && lines.length * LINE > height ? height % LINE : 0);\n\n React.useLayoutEffect(() => {\n const el = ref.current;\n if (!el || !follow) return;\n const bottom = Math.max(0, lines.length * LINE + padFor(el.clientHeight) - el.clientHeight);\n // Following scrolls to the bottom, which reads as \"at the bottom\" in onScroll: no flag needed\n // (a flag set here stuck when the browser fired no scroll event, and ate the person's next scroll).\n if (Math.abs(el.scrollTop - bottom) > 1) el.scrollTop = bottom;\n setView({ top: el.scrollTop, height: el.clientHeight || 600 });\n }, [follow, lines, LINE]);\n\n const total = lines.length * LINE + padFor(view.height);\n const first = Math.max(0, Math.floor(view.top / LINE) - OVERSCAN);\n const last = Math.min(lines.length, Math.ceil((view.top + view.height) / LINE) + OVERSCAN);\n const shown = lines.slice(first, last);\n const titles = { type: \"Type\", time: \"Time\", source: \"Process\", message: \"Message\", ...columns };\n\n return (\n <div data-slot=\"log-view\" data-look={look} className={cn(\"relative flex min-h-0 flex-1 flex-col\", consoleLook ? \"bg-content\" : \"rounded-control bg-fill\", className)}>\n {consoleLook ? (\n // Console's message list header (an NSTableView header): the columns' titles, a hairline under.\n <div data-slot=\"log-view-header\" aria-hidden className=\"flex h-table-header shrink-0 items-center border-b border-separator text-table-header text-label-secondary\">\n <span className=\"w-12 shrink-0 px-3\">{titles.type}</span>\n {showTime ? <span data-slot=\"log-view-column\" className=\"w-28 shrink-0 px-3\">{titles.time}</span> : null}\n {showSource ? <span data-slot=\"log-view-column\" className=\"w-28 shrink-0 px-3\">{titles.source}</span> : null}\n <span data-slot=\"log-view-column\" className=\"min-w-0 flex-1 px-3\">{titles.message}</span>\n </div>\n ) : null}\n <div\n ref={ref}\n role=\"log\"\n aria-live=\"off\"\n tabIndex={0}\n {...props}\n className={cn(\"focus-ring min-h-0 flex-1\", consoleLook ? \"overflow-y-auto overflow-x-hidden\" : \"overflow-auto rounded-control\")}\n onScroll={(event) => {\n const el = event.currentTarget;\n setView({ top: el.scrollTop, height: el.clientHeight || 600 });\n const atBottom = el.scrollHeight - el.scrollTop - el.clientHeight < LINE;\n if (atBottom !== followRef.current) onFollowChange(atBottom);\n }}\n onMouseLeave={() => setHoverGroup(null)}\n >\n {lines.length === 0 ? (\n <div className={consoleLook ? \"flex h-full items-center justify-center px-3 py-2 text-center\" : \"px-3 py-2\"}>{empty}</div>\n ) : consoleLook ? (\n <div className=\"relative w-full\" style={{ height: total }}>\n <div style={{ transform: `translateY(${first * LINE}px)` }}>\n {shown.map((line, i) => {\n const lit = line.group !== undefined && line.group === hoverGroup;\n const striped = (first + i) % 2 === 1;\n return (\n <div\n key={line.key}\n data-line={line.number ?? line.key}\n data-group={line.group}\n data-tone={line.tone ?? undefined}\n onMouseEnter={() => setHoverGroup(line.group ?? null)}\n className={cn(\"group/line flex select-text items-center text-body text-label\", lit ? \"bg-fill-secondary\" : striped ? \"bg-fill\" : null)}\n style={{ height: LINE }}\n >\n {/* Console's Type: a dot for an error (red) or a warning (orange), nothing for the rest. */}\n <span className=\"flex w-12 shrink-0 select-none items-center px-3\">\n {line.tone ? (\n <span\n role=\"img\"\n aria-label={line.tone === \"error\" ? \"Error\" : \"Warning\"}\n data-slot=\"log-view-type\"\n className={cn(\"size-2 rounded-full\", line.tone === \"error\" ? \"bg-system-red\" : \"bg-system-orange\")}\n />\n ) : null}\n </span>\n {showTime ? (\n <span data-slot=\"log-view-time\" className=\"w-28 shrink-0 truncate px-3 tabular-nums\">\n {line.time ?? \"\"}\n </span>\n ) : null}\n {showSource ? (\n <span data-slot=\"log-view-source\" className=\"w-28 shrink-0 truncate px-3\">\n {line.source ?? \"\"}\n </span>\n ) : null}\n <span data-slot=\"log-view-message\" title={line.text} className=\"min-w-0 flex-1 truncate px-3\">\n {line.text}\n </span>\n {lineAction ? (\n <Button size=\"sm\" variant=\"plain\" className=\"invisible mr-2 shrink-0 group-hover/line:visible\" onClick={() => lineAction.onSelect(line)}>\n {lineAction.label}\n </Button>\n ) : null}\n </div>\n );\n })}\n </div>\n </div>\n ) : (\n <div className=\"relative w-max min-w-full py-1\" style={{ height: total + 8 }}>\n <div style={{ transform: `translateY(${first * LINE}px)` }}>\n {shown.map((line) => {\n const lit = line.group !== undefined && line.group === hoverGroup;\n return (\n <div\n key={line.key}\n data-line={line.number ?? line.key}\n data-group={line.group}\n data-tone={line.tone ?? undefined}\n onMouseEnter={() => setHoverGroup(line.group ?? null)}\n className={cn(\n \"group/line flex select-text items-center gap-3 whitespace-pre px-3 font-mono text-code\",\n lit ? \"bg-fill-secondary\" : null,\n line.tone === \"error\" ? \"text-system-red\" : line.tone === \"warning\" ? \"text-system-orange\" : \"text-label\",\n )}\n style={{ height: LINE }}\n >\n {line.number !== undefined ? <span className=\"w-12 shrink-0 select-none text-right text-label-tertiary\">{line.number}</span> : null}\n <span className=\"min-w-0\">{line.text}</span>\n {lineAction ? (\n <Button\n size=\"sm\"\n variant=\"plain\"\n className=\"invisible sticky right-2 ml-auto shrink-0 group-hover/line:visible\"\n onClick={() => lineAction.onSelect(line)}\n >\n {lineAction.label}\n </Button>\n ) : null}\n </div>\n );\n })}\n </div>\n </div>\n )}\n </div>\n {!follow && lines.length > 0 ? (\n <Button\n size=\"sm\"\n variant=\"primary\"\n className=\"absolute bottom-3 right-4 shadow-raised\"\n onClick={() => {\n onFollowChange(true);\n }}\n >\n {jumpLabel}\n </Button>\n ) : null}\n </div>\n );\n}\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\n/*\n * Finder's icon view: the folder's items as large icons with their names under them, in rows that\n * fill the window. A click selects an item (its icon on a soft gray square, its name on the\n * accent capsule while the window is key), a double-click or ⌘↓ opens it; the arrow keys move the\n * selection across the grid in reading order (Up/Down by a whole row).\n */\n\nexport interface IconViewProps extends React.HTMLAttributes<HTMLDivElement> {\n \"aria-label\": string;\n}\n\n/** The grid: as many 96 pt cells as fit, the items in reading order. */\nexport function IconView({ className, onKeyDown, ...props }: IconViewProps) {\n return (\n <div\n role=\"listbox\"\n data-slot=\"icon-view\"\n className={cn(\"grid content-start justify-start gap-x-2 gap-y-3 p-4\", className)}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n const keys = [\"ArrowRight\", \"ArrowLeft\", \"ArrowDown\", \"ArrowUp\", \"Home\", \"End\"];\n if (!keys.includes(event.key)) return;\n const items = Array.from(event.currentTarget.querySelectorAll<HTMLElement>('[data-slot=\"icon-view-item\"]'));\n const at = items.indexOf(document.activeElement as HTMLElement);\n if (at === -1 || items.length === 0) return;\n const top = items[at]?.offsetTop ?? 0;\n const perRow = Math.max(1, items.filter((t) => t.offsetTop === top).length);\n const step: Record<string, number> = { ArrowRight: 1, ArrowLeft: -1, ArrowDown: perRow, ArrowUp: -perRow };\n const next = event.key === \"Home\" ? 0 : event.key === \"End\" ? items.length - 1 : at + (step[event.key] ?? 0);\n const target = items[Math.max(0, Math.min(items.length - 1, next))];\n if (target) {\n event.preventDefault();\n target.focus();\n target.click();\n }\n }}\n {...props}\n />\n );\n}\n\nexport interface IconViewItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** The item's icon at 64 pt (`SystemSymbol size={56}`, an app icon image). */\n icon: React.ReactNode;\n /** Its name, under the icon on at most two centered lines. */\n title: string;\n selected?: boolean;\n onSelect?: () => void;\n /** Double-click or ⌘↓ (Finder's Open). */\n onOpen?: () => void;\n /** Renaming in place: a `RenameField` drawn where the name sits. */\n nameEditor?: React.ReactNode;\n}\n\n/** One item of the icon view: the large icon, the name under it; selected, the icon sits on gray and the name on the accent. */\nexport function IconViewItem({ icon, title, selected = false, onSelect, onOpen, nameEditor, className, onKeyDown, ...props }: IconViewItemProps) {\n return (\n <div\n role=\"option\"\n aria-selected={selected}\n tabIndex={selected ? 0 : -1}\n data-slot=\"icon-view-item\"\n data-selected={selected || undefined}\n title={title}\n className={cn(\"focus-ring group/item flex w-24 flex-col items-center gap-1 rounded-control outline-none\", className)}\n onClick={onSelect}\n onDoubleClick={onOpen}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n if ((event.key === \"ArrowDown\" && event.metaKey) || event.key === \"Enter\") {\n event.preventDefault();\n onOpen?.();\n }\n }}\n {...props}\n >\n <span data-slot=\"icon-view-icon\" aria-hidden className={cn(\"flex size-18 items-center justify-center rounded-control [&_img]:size-16 [&_svg]:size-14\", selected && \"bg-selection-muted\")}>\n {icon}\n </span>\n {nameEditor ? (\n <span data-slot=\"icon-view-name-editor\" className=\"flex max-w-full justify-center\">\n {nameEditor}\n </span>\n ) : (\n <span data-slot=\"icon-view-name\" className={cn(\"line-clamp-2 max-w-full break-words rounded-control px-1 text-center text-body text-label\", selected && \"bg-selection-muted\")}>\n {title}\n </span>\n )}\n </div>\n );\n}\n","import * as React from \"react\";\n\nimport { ChevronRightIcon } from \"../icons\";\nimport { cn } from \"./cn\";\nimport { Spinner } from \"./spinner\";\n\n/*\n * Finder's column view (NSBrowser): one column per level of the path, each a list of 20 pt rows\n * (icon, name, and a chevron when the item holds more), side by side under hairlines and scrolled\n * sideways so the newest column is always in view. Clicking a row selects it and the host opens the\n * next column (its contents) or, for a leaf, the preview column (`preview`). The path's earlier\n * selections stay marked on gray; the column with focus marks its selection in the accent while the\n * window is key. Up/Down move within a column, Right enters the next column (its first row), Left\n * returns to the one before, ⌘↓ / Return / double-click open.\n *\n * Controlled: the host owns the path (which item is selected in each column) and what each column\n * holds; the component draws it and reports intent.\n */\n\nexport interface ColumnBrowserColumn<T> {\n /** Stable key of this column (the folder it lists). */\n key: string;\n /** Its items; `null` while they are being read. */\n items: readonly T[] | null;\n /** The item selected in this column (the next column's parent), if any. */\n selectedKey?: string | null | undefined;\n /** Shown when `items` is empty (Finder leaves an empty folder's column blank; a short line here). */\n empty?: React.ReactNode | undefined;\n /** Shown instead of the items when the column could not be read. */\n failed?: React.ReactNode | undefined;\n}\n\nexport interface ColumnBrowserProps<T> {\n \"aria-label\": string;\n columns: ReadonlyArray<ColumnBrowserColumn<T>>;\n itemKey: (item: T) => string;\n itemLabel: (item: T) => string;\n /** The small icon before the name (a `SystemSymbol size={15}`). */\n itemIcon?: ((item: T) => React.ReactNode) | undefined;\n /** True for an item that opens a further column (a folder): it wears the chevron. */\n isBranch: (item: T) => boolean;\n /** A row was chosen in `column` (click, arrow keys). The host truncates the path after it. */\n onSelect: (column: number, item: T) => void;\n /** Double-click, Return or ⌘↓ on a row. */\n onOpen?: ((item: T) => void) | undefined;\n /** Right-click on a row: the row is selected first, then this opens its menu at the pointer. */\n onItemContextMenu?: ((item: T, event: React.MouseEvent) => void) | undefined;\n /** Renaming in place: a `RenameField` for the row being renamed (null for every other row). */\n itemEditor?: ((item: T) => React.ReactNode | null) | undefined;\n /** Per-row `data-*` attributes (test hooks). */\n itemData?: ((item: T) => Record<string, string>) | undefined;\n /** The preview column after the last list (a leaf's icon, name and facts). */\n preview?: React.ReactNode | undefined;\n className?: string | undefined;\n /** `data-*` attributes on the browser itself (test hooks), as every desktop component takes. */\n [data: `data-${string}`]: string | boolean | undefined;\n}\n\nconst ROW = '[data-slot=\"column-browser-row\"]';\n\nfunction rowsOf(column: HTMLElement | null): HTMLElement[] {\n return column ? Array.from(column.querySelectorAll<HTMLElement>(ROW)) : [];\n}\n\n/** The Finder column view: the path as side-by-side lists, a preview column after a leaf. */\nexport function ColumnBrowser<T>({\n \"aria-label\": label,\n columns,\n itemKey,\n itemLabel,\n itemIcon,\n isBranch,\n onSelect,\n onOpen,\n onItemContextMenu,\n itemData,\n itemEditor,\n preview,\n className,\n ...data\n}: ColumnBrowserProps<T>): React.JSX.Element {\n const scroller = React.useRef<HTMLDivElement>(null);\n const refs = React.useRef<Array<HTMLDivElement | null>>([]);\n // Keyboard intent waiting for the next column to arrive: focus its first row once it renders.\n const enterNext = React.useRef<number | null>(null);\n\n // The newest column (or the preview) always scrolls into view, as Finder's does.\n React.useEffect(() => {\n const el = scroller.current;\n if (el) el.scrollLeft = el.scrollWidth;\n }, [columns.length, preview !== undefined && preview !== null]);\n\n React.useEffect(() => {\n const at = enterNext.current;\n if (at === null) return;\n const column = columns[at];\n if (!column?.items) return;\n enterNext.current = null;\n const first = column.items[0];\n if (first) {\n onSelect(at, first);\n requestAnimationFrame(() => rowsOf(refs.current[at] ?? null)[0]?.focus());\n }\n });\n\n const onKeyDown = (index: number, event: React.KeyboardEvent<HTMLDivElement>): void => {\n const column = columns[index];\n const items = column?.items ?? [];\n const rows = rowsOf(refs.current[index] ?? null);\n const at = rows.indexOf(document.activeElement as HTMLElement);\n const current = at >= 0 ? items[at] : undefined;\n if ((event.key === \"ArrowDown\" && event.metaKey) || event.key === \"Enter\") {\n if (current) {\n event.preventDefault();\n onOpen?.(current);\n }\n return;\n }\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\" || event.key === \"Home\" || event.key === \"End\") {\n if (items.length === 0) return;\n event.preventDefault();\n const next =\n event.key === \"Home\" ? 0 : event.key === \"End\" ? items.length - 1 : Math.max(0, Math.min(items.length - 1, (at < 0 ? -1 : at) + (event.key === \"ArrowDown\" ? 1 : -1)));\n const item = items[next];\n if (item) {\n onSelect(index, item);\n rows[next]?.focus();\n }\n return;\n }\n if (event.key === \"ArrowRight\") {\n if (!current || !isBranch(current)) return;\n event.preventDefault();\n const following = columns[index + 1];\n if (following?.items) {\n const first = following.items[0];\n if (first) {\n onSelect(index + 1, first);\n rowsOf(refs.current[index + 1] ?? null)[0]?.focus();\n }\n } else {\n enterNext.current = index + 1;\n }\n return;\n }\n if (event.key === \"ArrowLeft\" && index > 0) {\n event.preventDefault();\n const parent = columns[index - 1];\n const parentItems = parent?.items ?? [];\n const parentAt = parentItems.findIndex((i) => itemKey(i) === parent?.selectedKey);\n const item = parentItems[parentAt];\n if (item) {\n onSelect(index - 1, item);\n rowsOf(refs.current[index - 1] ?? null)[parentAt]?.focus();\n }\n }\n };\n\n return (\n <div ref={scroller} role=\"group\" aria-label={label} data-slot=\"column-browser\" className={cn(\"flex h-full min-h-0 overflow-x-auto overflow-y-hidden\", className)} {...data}>\n {columns.map((column, index) => (\n <div\n key={column.key}\n ref={(el) => {\n refs.current[index] = el;\n }}\n role=\"listbox\"\n aria-label={`${label}, column ${index + 1}`}\n data-slot=\"column-browser-column\"\n data-column={column.key}\n className=\"flex h-full shrink-0 flex-col overflow-y-auto py-1\"\n onKeyDown={(event) => onKeyDown(index, event)}\n >\n {column.failed ? (\n <div data-slot=\"column-browser-note\" className=\"px-3 py-2 text-body text-label-secondary\">\n {column.failed}\n </div>\n ) : column.items === null ? (\n <div data-slot=\"column-browser-note\" className=\"flex justify-center py-2\">\n <Spinner />\n </div>\n ) : column.items.length === 0 ? (\n <div data-slot=\"column-browser-note\" className=\"px-3 py-2 text-body text-label-secondary\">\n {column.empty ?? null}\n </div>\n ) : (\n column.items.map((item) => {\n const key = itemKey(item);\n const selected = column.selectedKey === key;\n const branch = isBranch(item);\n return (\n <div\n key={key}\n role=\"option\"\n aria-selected={selected}\n tabIndex={selected || (column.selectedKey == null && item === column.items?.[0]) ? 0 : -1}\n data-slot=\"column-browser-row\"\n data-selected={selected || undefined}\n data-branch={branch || undefined}\n title={itemLabel(item)}\n className=\"mx-1 flex shrink-0 items-center gap-1.5 px-2 text-body text-label outline-none\"\n onClick={(event) => {\n onSelect(index, item);\n event.currentTarget.focus();\n }}\n onDoubleClick={() => onOpen?.(item)}\n onContextMenu={\n onItemContextMenu\n ? (event) => {\n event.preventDefault();\n onSelect(index, item);\n onItemContextMenu(item, event);\n }\n : undefined\n }\n {...(itemData?.(item) ?? {})}\n >\n {itemIcon ? (\n <span aria-hidden className=\"flex w-5 shrink-0 justify-center\">\n {itemIcon(item)}\n </span>\n ) : null}\n {itemEditor?.(item) ?? <span className=\"min-w-0 flex-1 truncate\">{itemLabel(item)}</span>}\n {branch ? <ChevronRightIcon aria-hidden data-slot=\"column-browser-chevron\" className=\"size-3 shrink-0 text-label-secondary\" /> : null}\n </div>\n );\n })\n )}\n </div>\n ))}\n {preview ? (\n // Finder's preview column is a column like the others (240 pt), never squeezed by the ones\n // before it: the browser scrolls sideways instead.\n <div data-slot=\"column-browser-preview\" className=\"flex h-full w-60 shrink-0 flex-col items-center overflow-y-auto px-4 py-4\">\n {preview}\n </div>\n ) : null}\n </div>\n );\n}\n","import * as React from \"react\";\n\nimport { Dialog } from \"../dialog\";\nimport { Button } from \"./button\";\nimport { DialogContent, DialogDescription, DialogTitle } from \"./sheet\";\n\n/*\n * Quick Look where the OS has none (Windows, Linux): the file's preview in a large floating panel over\n * the window, its name as the title, \"Open with <app>\" trailing, dismissed by Space, Escape or Close\n * (macOS draws its own QLPreviewPanel; the host calls that there instead). The host gives the\n * preview: an image, the text, or the file's icon and facts.\n */\n\nexport interface QuickLookSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** The file's name, the panel's title. */\n title: string;\n /** One line under it: \"Plain Text Document - 12 KB\". */\n subtitle?: React.ReactNode | undefined;\n /** \"Open with Default App\" (the host's open); absent, no button. */\n onOpen?: (() => void) | undefined;\n openLabel?: string | undefined;\n /** The preview itself. */\n children: React.ReactNode;\n}\n\n/** A Quick Look panel: name, one fact line, the preview filling the rest; Space or Escape closes it. */\nexport function QuickLookSheet({ open, onOpenChange, title, subtitle, onOpen, openLabel = \"Open\", children }: QuickLookSheetProps) {\n return (\n <Dialog open={open} onOpenChange={onOpenChange}>\n <DialogContent\n data-slot=\"quick-look\"\n className=\"flex w-full max-w-3xl flex-col gap-3\"\n onKeyDown={(event) => {\n // Space toggles Quick Look shut, as it opened it (never while typing in a field inside).\n if (event.key === \" \" && !(event.target instanceof HTMLInputElement) && !(event.target instanceof HTMLTextAreaElement)) {\n event.preventDefault();\n onOpenChange(false);\n }\n }}\n >\n <div className=\"flex min-w-0 items-start gap-3\">\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <DialogTitle className=\"truncate\" title={title}>\n {title}\n </DialogTitle>\n {subtitle ? <DialogDescription>{subtitle}</DialogDescription> : <DialogDescription className=\"sr-only\">Quick Look</DialogDescription>}\n </div>\n {onOpen ? (\n <Button size=\"sm\" variant=\"secondary\" onClick={onOpen}>\n {openLabel}\n </Button>\n ) : null}\n <Button size=\"sm\" variant=\"secondary\" data-quick-look-close onClick={() => onOpenChange(false)}>\n Close\n </Button>\n </div>\n <div data-slot=\"quick-look-preview\" className=\"flex min-h-0 flex-1 items-center justify-center overflow-auto\">\n {children}\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\n/*\n * Finder's rename in place: the name becomes an editable field where it sits (a list's name cell, an\n * icon's caption, a column's row), its base name selected and the extension left alone (\"Report\" of\n * \"Report.pdf\"; a folder's whole name). Return or clicking away commits; Escape cancels. An unchanged\n * or empty name commits nothing (onCancel). Keys typed here never reach the view around it.\n */\n\nexport interface RenameFieldProps {\n /** The current name. */\n name: string;\n /** Select the whole name (a folder) instead of the part before the extension. */\n wholeName?: boolean | undefined;\n onCommit: (next: string) => void;\n onCancel: () => void;\n \"aria-label\"?: string | undefined;\n className?: string | undefined;\n}\n\n/** Where the base name ends: before the last dot, unless the name starts with it (\".env\") or has none. */\nexport function baseNameEnd(name: string): number {\n const dot = name.lastIndexOf(\".\");\n return dot > 0 ? dot : name.length;\n}\n\nexport function RenameField({ name, wholeName = false, onCommit, onCancel, \"aria-label\": label = \"Name\", className }: RenameFieldProps) {\n const ref = React.useRef<HTMLInputElement>(null);\n const [value, setValue] = React.useState(name);\n const done = React.useRef(false);\n React.useLayoutEffect(() => {\n const el = ref.current;\n if (!el) return;\n el.focus();\n el.setSelectionRange(0, wholeName ? name.length : baseNameEnd(name));\n }, []);\n const finish = (commit: boolean) => {\n if (done.current) return;\n done.current = true;\n const next = value.trim();\n if (commit && next && next !== name) onCommit(next);\n else onCancel();\n };\n return (\n <input\n ref={ref}\n data-slot=\"rename-field\"\n aria-label={label}\n value={value}\n spellCheck={false}\n className={cn(\"min-w-0 select-text rounded-control bg-content px-1 text-body text-label outline-none ring-2 ring-tint\", className)}\n onChange={(event) => setValue(event.target.value)}\n onClick={(event) => event.stopPropagation()}\n onDoubleClick={(event) => event.stopPropagation()}\n onKeyDown={(event) => {\n event.stopPropagation();\n if (event.key === \"Enter\") {\n event.preventDefault();\n finish(true);\n } else if (event.key === \"Escape\") {\n event.preventDefault();\n finish(false);\n }\n }}\n onBlur={() => finish(true)}\n />\n );\n}\n","import * as React from \"react\";\n\nimport { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuTrigger } from \"../context-menu\";\nimport { ContextMenuEntries, DropdownMenuEntries, type RowMenuItem } from \"./menu-entries\";\nimport { Checkbox } from \"./controls\";\nimport { ConfirmDialog } from \"./sheet\";\nimport { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from \"../dropdown-menu\";\nimport { ChevronDownIcon, ChevronRightIcon, MoreHorizontalIcon } from \"../icons\";\nimport { Button, IconButton } from \"./button\";\nimport { cn } from \"./cn\";\nimport { StatusLight } from \"./tag\";\nimport { StateView } from \"./state\";\nimport { ClearFiltersButton, EMPTY_TABLE_FILTER, TableFilterBar, filterActive, filterRows, noResultsMessage, tableFilters, type ColumnFilter, type FilterableColumn, type TableFilterState } from \"./table-filter\";\nimport { Text } from \"./text\";\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 /** What the column holds, which decides its width (Activity Monitor's model):\n * - `flex`: the text that carries the information (a name, a command). It takes the spare width\n * and is the ONLY kind that truncates (with an ellipsis).\n * - `text`, `numeric`, `status`, `date`: fit their content and are never cut; numbers are\n * right-aligned with tabular figures. Spare width is shared with them so a wide window never\n * leaves one huge gap after a short name (Mail).\n * - `action`: buttons or icons; exactly as wide as its content, never stretched, never clipped.\n * The table scrolls sideways only when the fitted columns truly exceed the width.\n * Default: `numeric` when `numeric` is set, else from `width` (`auto`/`md`/`lg` → flex,\n * `xs`/`sm` → text, `fit` → action). */\n kind?: ColumnKind;\n /** Legacy sizing hint, read only when `kind` is not given (see `kind`). The named sizes are now\n * minimum widths, never caps. */\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 /** The direction of the header's first click; default by kind: words A–Z, numbers and dates biggest/newest first (firstDirection). */\n firstSort?: \"ascending\" | \"descending\";\n sort?: (a: T, b: T) => number;\n /** An optional column (NSTableView's header menu): right-click the header row to show or hide\n * it. `shown` starts visible, `hidden` starts hidden; a column without it is always shown. */\n optional?: \"shown\" | \"hidden\";\n /** The column's name in the header menu when `header` is not plain text. */\n title?: string;\n /** A `flex` column of secondary words (a status sentence beside the name): it gives way down to\n * 6rem before the table scrolls sideways, where a name keeps 10rem. */\n narrow?: boolean;\n /** A column of secondary words that YIELDS to the key column (Finder's Kind beside Name): it\n * takes only the room the other columns leave, so it gives way, with an ellipsis, down to 6rem\n * before the name loses a letter; in a wide window it takes the spare width once every name is\n * whole. Its whole value is the cell's tooltip when cut. */\n yields?: boolean;\n /** How the column filters (the table's filter button lists its values with their counts; see\n * `ColumnFilter`). A table with a filterable or searchable column draws its filter bar. */\n filter?: ColumnFilter<T>;\n /** The column joins the table's search field: `true` reads the row's field named by `key`; a\n * function returns the words to match (a name, a path). */\n search?: boolean | ((row: T) => string | null | undefined);\n}\n\n/** Finder's and Mail's \"Use Groups\": the rows under one heading per group, sorted within it. */\nexport interface TableGroups<T> {\n /** The group a row belongs to. */\n by: (row: T) => string;\n /** The heading drawn over the group's rows (its name, a count: \"Matrx Local · 12 of 40 proven\"). */\n header: (key: string, rows: ReadonlyArray<T>) => React.ReactNode;\n /** The groups' order; groups not named here follow in the order their first row was given. */\n order?: ReadonlyArray<string>;\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 /** Drawn as a compact icon button whose label is its tooltip and accessible name (rowButtons\n * only): a row that carries several actions keeps them all visible without crowding its data. */\n icon?: React.ReactNode;\n}\n\nexport type { RowMenuItem } from \"./menu-entries\";\nexport { MenuItemLabel } from \"./menu-entries\";\n\nexport interface SortState {\n key: string;\n direction: \"ascending\" | \"descending\";\n}\n\nexport type ColumnKind = \"flex\" | \"text\" | \"numeric\" | \"status\" | \"date\" | \"action\";\n\n/** A column's kind (see `Column.kind`). */\n/** A header's first-click direction: words ascending (A–Z), numbers and dates descending (biggest, newest first). */\nexport function firstDirection(column: Pick<Column<never>, \"kind\" | \"numeric\" | \"width\" | \"firstSort\"> | undefined): \"ascending\" | \"descending\" {\n if (!column) return \"ascending\";\n if (column.firstSort) return column.firstSort;\n const kind = columnKind(column);\n return kind === \"numeric\" || kind === \"date\" ? \"descending\" : \"ascending\";\n}\n\nexport function columnKind(column: Pick<Column<never>, \"kind\" | \"numeric\" | \"width\">): ColumnKind {\n if (column.kind) return column.kind;\n if (column.numeric) return \"numeric\";\n const w = column.width ?? \"auto\";\n if (w === \"fit\") return \"action\";\n if (w === \"xs\" || w === \"sm\") return \"text\";\n return \"flex\";\n}\n\n/** The grid track per kind. The table is a CSS grid whose rows are subgrids, so every column is\n * sized once for all rows. Fitted kinds never go below their content. The flex column grows first,\n * up to its whole content (it never truncates while there is room), and gives way first when there\n * is not (down to 6rem, so a narrow list keeps its numbers and actions in view). Width left over after that is shared by every `auto` track\n * (grid's auto-track stretch), so a wide window spreads the columns instead of opening one gap. */\nconst TRACK: Record<ColumnKind, string> = {\n // The key column (a name) keeps 10rem before it truncates (min() cannot take max-content: an\n // intrinsic size inside min() voids the whole template). The fitted\n // columns beside it are short, so the thing a row IS stays readable at every window width.\n flex: \"minmax(10rem, auto)\",\n text: \"minmax(max-content, auto)\",\n numeric: \"minmax(max-content, auto)\",\n status: \"minmax(max-content, auto)\",\n date: \"minmax(max-content, auto)\",\n action: \"max-content\",\n};\n/** A `narrow` flex column's track: secondary words give way to 6rem (a name keeps 10rem). */\nconst NARROW_FLEX = \"minmax(6rem, auto)\";\n/** A `yields` column's track: a flexible track is sized only after every other track has its\n * content (grid's \"expand flexible tracks\" runs last), so it gets what is left, never below 6rem. */\nconst YIELDS = \"minmax(6rem, 1fr)\";\n/** The least a fitted column is, so a short value (\"3\") still reads as a column. */\nconst MIN: Partial<Record<ColumnKind, string>> = { numeric: \"min-w-14\", status: \"min-w-16\", date: \"min-w-16\" };\nconst LEGACY_MIN = { auto: \"\", fit: \"\", xs: \"min-w-12\", sm: \"min-w-16\", md: \"\", lg: \"\" } as const;\n\nfunction gridTemplate(\n columns: ReadonlyArray<Column<never>>,\n lead: { selection: boolean; detail: boolean },\n actions: boolean,\n widths: ReadonlyMap<string, number> = new Map(),\n spare: \"shared\" | \"flex\" = \"shared\",\n): string {\n const tracks: string[] = [];\n if (lead.selection) tracks.push(\"2rem\");\n if (lead.detail) tracks.push(\"1.5rem\");\n // A column the person resized keeps its width; every other one autosizes (AppKit's table view).\n for (const c of columns) {\n const w = widths.get(c.key);\n const kind = columnKind(c);\n tracks.push(w !== undefined ? `${w}px` : c.yields ? YIELDS : spare === \"flex\" && kind !== \"flex\" ? \"max-content\" : kind === \"flex\" && c.narrow ? NARROW_FLEX : TRACK[kind]);\n }\n if (actions) tracks.push(\"max-content\");\n return tracks.join(\" \");\n}\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 /** AppKit multiple selection (Finder, Mail): with `onSelectedKeysChange`, ⌘-click adds or removes\n * a row, ⇧-click and ⇧↑/⇧↓ extend from the row last clicked, ⌘A selects every row; a plain click\n * selects one. `onRowSelect` still names the row clicked last (the lead). */\n selectedKeys?: ReadonlySet<string> | undefined;\n onSelectedKeysChange?: ((keys: Set<string>) => void) | undefined;\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 /** A fixed set of buttons on every row, always visible and always in the same order; one that\n * does not apply to a row is disabled, never hidden, so nothing shifts from row to row. */\n rowButtons?: (row: T) => ReadonlyArray<RowAction>;\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 /** Draw only the first `limit` rows AFTER sorting (long lists: the caller offers \"Show more\"). */\n limit?: number;\n /** Controlled sort: the caller keeps it (to remember it, or to reset it with its filters). */\n sort?: SortState | null;\n onSortChange?: (sort: SortState | null) => void;\n /** Checkbox selection: a leading column of checkboxes, and one in the header for every row given. */\n selection?: { selected: ReadonlySet<string>; onChange: (next: Set<string>) => void };\n /** Double-click or ⌘↓ on a row (Activity Monitor's Inspect, Finder's Open). */\n onRowOpen?: (row: T) => void;\n /** An outline (Activity Monitor's \"All Processes, Hierarchically\"): a row's child rows, drawn as\n * real rows in the same columns under it, indented, with a disclosure triangle in the first\n * column; open by default, Right/Left or the triangle open and close it. Children sort with\n * their siblings. Return null or [] for a leaf. */\n subRows?: (row: T) => ReadonlyArray<T> | null;\n /** How an outline starts: `open` (Activity Monitor's hierarchy, the default) or `closed` (Finder's\n * list view: each folder shut until its triangle is clicked). */\n outline?: \"open\" | \"closed\";\n /** A row that is a branch before its children are known (Finder's folders, read when opened):\n * it draws its disclosure triangle; `subRows` gives its children once they are there. */\n expandable?: (row: T) => boolean;\n /** A branch opened or closed (the triangle, Right/Left): the caller reads its children. */\n onOutlineChange?: (row: T, open: boolean) => void;\n /** `small`: Finder's list view, 20 pt rows (its small icons). Default `regular`, 24 pt. */\n rowSize?: \"regular\" | \"small\";\n /** The table fills the page's height and its stripes run on below the last row to the foot, as\n * an NSTableView's alternating rows do (use in a `Page flush`). */\n fill?: boolean;\n /** Who gets the width left over: `shared` (default) spreads it over every column (Mail);\n * `flex` gives all of it to the `flex` column and keeps every other column exactly as wide as\n * its content (Console's Message, Finder's Name, System Information's item). */\n spare?: \"shared\" | \"flex\";\n /** Right-click on a row (Activity Monitor, Finder): the row is selected and this menu opens.\n * Items labeled \"-\" are separators; destructive items with `confirm` ask first. */\n rowContextMenu?: (row: T) => ReadonlyArray<RowMenuItem> | null;\n /** The optional columns hidden now (controlled; see `Column.optional`). Uncontrolled, the table\n * keeps them itself, starting from each column's `optional`. */\n hiddenColumns?: ReadonlySet<string>;\n onHiddenColumnsChange?: (next: Set<string>) => void;\n /** Group the rows under headings (Finder's Use Groups); rows sort within their group. */\n groups?: TableGroups<T>;\n /** Controlled search and filters (the page keeps them: in the address, as saved filters). Uncontrolled,\n * the table keeps them itself, starting from `defaultFilter`. */\n filterState?: TableFilterState;\n onFilterStateChange?: (next: TableFilterState) => void;\n defaultFilter?: TableFilterState;\n /** The table's own filter bar over its header (default, when a column filters or searches). `false`\n * when the page draws the controls itself (`SearchField` + `TableFilterMenu` in its header's\n * actions) and passes `filterState`. */\n filterBar?: boolean;\n className?: string;\n}\n\n/** Which optional columns start hidden (`Column.optional === \"hidden\"`). */\nexport function initiallyHiddenColumns(columns: ReadonlyArray<Pick<Column<never>, \"key\" | \"optional\">>): Set<string> {\n return new Set(columns.filter((c) => c.optional === \"hidden\").map((c) => c.key));\n}\n\n/**\n * The macOS table (NSTableView .fullWidth, as in Activity Monitor): 13 pt rows 24 pt\n * tall, full width with no box, alternating rows, a 22 pt system header that stays put, the whole\n * header cell sorts with a trailing chevron, every column resizes (double-click its edge to fit),\n * column kinds sized like Activity Monitor's, the accent selection while focused. Arrow keys move\n * between rows when rows are selectable.\n */\nexport function DataTable<T>({\n rowKey,\n onRowSelect,\n selectedKey,\n selectedKeys,\n onSelectedKeysChange,\n empty,\n striped = true,\n detail,\n isDisabled,\n rowAction,\n rowMenu,\n rowButtons,\n defaultSort,\n rowData,\n limit,\n sort: sortProp,\n onSortChange,\n selection,\n onRowOpen,\n subRows,\n outline = \"open\",\n expandable,\n onOutlineChange,\n rowSize = \"regular\",\n fill,\n spare = \"shared\",\n rowContextMenu,\n hiddenColumns,\n onHiddenColumnsChange,\n groups,\n filterState,\n onFilterStateChange,\n defaultFilter,\n filterBar = true,\n className,\n \"aria-label\": ariaLabel,\n columns: allColumns,\n rows: givenRows,\n ...rest\n}: DataTableProps<T>) {\n // Search and filters (G1): every column that declares `filter` or `search` takes part, with no\n // code on the page. Controlled like the sort, or kept here.\n const filterable = tableFilters(allColumns as ReadonlyArray<FilterableColumn<never>>);\n const [filterKept, setFilterKept] = React.useState<TableFilterState>(defaultFilter ?? EMPTY_TABLE_FILTER);\n const filter = filterState ?? filterKept;\n const setFilter = (next: TableFilterState) => {\n if (filterState === undefined) setFilterKept(next);\n onFilterStateChange?.(next);\n };\n // The table keeps its place while a filter is on (no layout shift): the frame reserves the height\n // the FULL set of rows takes now (bar + header + every row the table would draw unfiltered), so\n // the page under a stuck filter bar never scrolls back (its scroll is clamped when content\n // shrinks). The reservation follows the rows, never a stale snapshot: a refresh that drops rows\n // shrinks it, and the bar, header and row heights are measured again on every render and on\n // every window resize, filtered or not. (Top-level rows and group headings; open outline\n // children and detail rows are not reserved.)\n const frameRef = React.useRef<HTMLDivElement>(null);\n const [metrics, setMetrics] = React.useState<{ bar: number; head: number; row: number } | null>(null);\n const [resized, setResized] = React.useState(0);\n const narrowed = filterable && filterActive(filter);\n React.useEffect(() => {\n if (!filterable) return undefined;\n const onResize = () => setResized((n) => n + 1);\n window.addEventListener(\"resize\", onResize);\n return () => window.removeEventListener(\"resize\", onResize);\n }, [filterable]);\n React.useLayoutEffect(() => {\n const frame = frameRef.current;\n if (!frame) return;\n const height = (sel: string) => frame.querySelector(sel)?.getBoundingClientRect().height ?? 0;\n const bar = height('[data-slot=\"data-table-filter-bar\"]');\n const head = height('[data-slot=\"data-table-header\"]');\n const row = height('[data-slot=\"data-table-row\"]');\n // No Results draws no header and no row: keep the last ones measured.\n setMetrics((prev) => {\n const next = { bar: bar || prev?.bar || 0, head: head || prev?.head || 0, row: row || prev?.row || 0 };\n return prev && prev.bar === next.bar && prev.head === next.head && prev.row === next.row ? prev : next;\n });\n });\n void resized;\n const fullRows = limit !== undefined ? Math.min(givenRows.length, limit) : givenRows.length;\n const fullGroups = groups ? new Set(givenRows.map((r) => groups.by(r))).size : 0;\n const heldHeight = narrowed && metrics && metrics.row > 0 ? Math.round(metrics.bar + metrics.head + (fullRows + fullGroups) * metrics.row) : null;\n const rows = React.useMemo(\n () => (filterable ? filterRows(allColumns as ReadonlyArray<FilterableColumn<T>>, givenRows, filter) : givenRows),\n [filterable, allColumns, givenRows, filter],\n );\n // The optional columns the person hid (NSTableView's header menu), controlled or kept here.\n const [hiddenState, setHiddenState] = React.useState<ReadonlySet<string>>(() => initiallyHiddenColumns(allColumns as ReadonlyArray<Column<never>>));\n const hidden = hiddenColumns ?? hiddenState;\n const setColumnShown = (key: string, shown: boolean) => {\n const next = new Set(hidden);\n if (shown) next.delete(key);\n else next.add(key);\n if (hiddenColumns === undefined) setHiddenState(next);\n onHiddenColumnsChange?.(next);\n };\n const optionalColumns = allColumns.filter((c) => c.optional);\n const columns = allColumns.filter((c) => !c.optional || !hidden.has(c.key));\n const bodyRef = React.useRef<HTMLTableSectionElement>(null);\n const [menuRow, setMenuRow] = React.useState<T | null>(null);\n const [askingMenu, setAskingMenu] = React.useState<RowMenuItem | null>(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 [sortState, setSortState] = React.useState<SortState | null>(defaultSort ?? null);\n const controlled = sortProp !== undefined;\n const sort = controlled ? sortProp : sortState;\n const setSort = (next: (prev: SortState | null) => SortState | null) => {\n const value = next(sort);\n if (controlled) onSortChange?.(value);\n else {\n setSortState(value);\n onSortChange?.(value);\n }\n };\n const sortColumn = sort ? allColumns.find((c) => c.key === sort.key && c.sort) : undefined;\n const ordered = React.useMemo(() => {\n const cut = (list: ReadonlyArray<T>) => (limit !== undefined && list.length > limit ? list.slice(0, limit) : list);\n if (!sort || !sortColumn?.sort) return cut(rows);\n const by = sortColumn.sort;\n const sign = sort.direction === \"ascending\" ? 1 : -1;\n return cut([...rows].sort((a, b) => sign * by(a, b)));\n }, [rows, sort, sortColumn, limit]);\n // The outline: every visible row with its depth (children sorted like their parents).\n // The rows the person turned from how the outline starts (`outline`): closed ones of an open\n // outline, opened ones of a closed one.\n const [flipped, setFlipped] = React.useState<ReadonlySet<string>>(() => new Set());\n const collapsed = React.useMemo(() => ({ has: (key: string) => (outline === \"closed\" ? !flipped.has(key) : flipped.has(key)) }), [flipped, outline]);\n const setOpen = (key: string, open: boolean, row?: T) => {\n setFlipped((prev) => {\n const next = new Set(prev);\n if (open === (outline === \"closed\")) next.add(key);\n else next.delete(key);\n return next;\n });\n if (row !== undefined) onOutlineChange?.(row, open);\n };\n // Finder's Use Groups: the (sorted) rows split under their headings, in the groups' order.\n const segments = React.useMemo(() => {\n if (!groups) return [{ key: null as string | null, rows: ordered }];\n const byKey = new Map<string, T[]>();\n for (const row of rows) {\n const key = groups.by(row);\n if (!byKey.has(key)) byKey.set(key, []);\n }\n for (const row of ordered) byKey.get(groups.by(row))?.push(row);\n const keys = [...(groups.order ?? []).filter((k) => byKey.has(k)), ...[...byKey.keys()].filter((k) => !(groups.order ?? []).includes(k))];\n return keys.map((key) => ({ key: key as string | null, rows: byKey.get(key) ?? [] })).filter((g) => g.rows.length > 0);\n }, [groups, rows, ordered]);\n const { flat, groupStarts } = React.useMemo(() => {\n type Item = { row: T; depth: number; parent: boolean };\n const by = sort && sortColumn?.sort ? sortColumn.sort : null;\n const sign = sort?.direction === \"ascending\" ? 1 : -1;\n const out: Item[] = [];\n const starts = new Map<number, { key: string; rows: ReadonlyArray<T> }>();\n const walk = (list: ReadonlyArray<T>, depth: number) => {\n for (const row of list) {\n const kids = subRows?.(row) ?? [];\n out.push({ row, depth, parent: kids.length > 0 || (expandable?.(row) ?? false) });\n if (kids.length > 0 && !collapsed.has(rowKey(row))) walk(by ? [...kids].sort((a, b) => sign * by(a, b)) : kids, depth + 1);\n }\n };\n for (const segment of segments) {\n if (segment.key !== null) starts.set(out.length, { key: segment.key, rows: segment.rows });\n walk(segment.rows, 0);\n }\n return { flat: out, groupStarts: starts };\n }, [segments, subRows, expandable, collapsed, sort, sortColumn, rowKey]);\n // A first click sorts the way a Mac table does (Finder, Activity Monitor): words A–Z; numbers\n // and dates biggest and newest first. `Column.firstSort` overrides it; a second click reverses.\n const toggleSort = (key: string) =>\n setSort((prev) => (prev?.key === key ? { key, direction: prev.direction === \"ascending\" ? \"descending\" : \"ascending\" } : { key, direction: firstDirection(allColumns.find((c) => c.key === key)) }));\n const hasActions = Boolean(rowAction || rowMenu || rowButtons);\n const span = columns.length + (detail ? 1 : 0) + (hasActions ? 1 : 0) + (selection ? 1 : 0);\n // A dimmed row (isDisabled) is never picked: its checkbox is off and the header leaves it out.\n const allKeys = selection ? rows.filter((r) => !isDisabled?.(r)).map(rowKey) : [];\n const picked = selection ? allKeys.filter((k) => selection.selected.has(k)).length : 0;\n const [focusedKey, setFocusedKey] = React.useState<string | null>(null);\n // Column widths the person dragged (NSTableColumn resizing); a double-click on the edge autosizes.\n const [widths, setWidths] = React.useState<ReadonlyMap<string, number>>(() => new Map());\n const resizeFrom = (key: string, event: React.PointerEvent<HTMLSpanElement>) => {\n const th = event.currentTarget.parentElement;\n if (!th) return;\n event.preventDefault();\n event.stopPropagation();\n const start = event.clientX;\n const base = th.getBoundingClientRect().width;\n const handle = event.currentTarget;\n handle.setPointerCapture(event.pointerId);\n const move = (e: PointerEvent) => setWidths((m) => new Map(m).set(key, Math.max(40, Math.round(base + e.clientX - start))));\n const up = () => {\n handle.removeEventListener(\"pointermove\", move);\n handle.removeEventListener(\"pointerup\", up);\n handle.removeEventListener(\"pointercancel\", up);\n };\n handle.addEventListener(\"pointermove\", move);\n handle.addEventListener(\"pointerup\", up);\n handle.addEventListener(\"pointercancel\", up);\n };\n const autosize = (key: string) =>\n setWidths((m) => {\n const next = new Map(m);\n next.delete(key);\n return next;\n });\n const rowFocusable = (row: T) =>\n !(isDisabled?.(row) ?? false) && Boolean(onRowSelect || onRowOpen || (detail && detail(row) !== null) || (subRows && ((subRows(row)?.length ?? 0) > 0 || (expandable?.(row) ?? false))));\n const focusableKeys = flat.map((f) => f.row).filter(rowFocusable).map(rowKey);\n const tabRowKey =\n selectedKey != null && focusableKeys.includes(selectedKey)\n ? selectedKey\n : focusedKey != null && focusableKeys.includes(focusedKey)\n ? focusedKey\n : (focusableKeys[0] ?? null);\n // Multiple selection: the row a ⇧-click or ⇧-arrow extends from (the last row clicked).\n const anchorRef = React.useRef<string | null>(null);\n const multi = onSelectedKeysChange !== undefined;\n /** A click or key that changes a multiple selection; true when it was handled here. */\n const pick = (key: string, row: T, mods: { meta: boolean; shift: boolean }): boolean => {\n if (!onSelectedKeysChange) return false;\n const current = new Set(selectedKeys ?? (selectedKey != null ? [selectedKey] : []));\n const anchor = anchorRef.current ?? selectedKey ?? null;\n if (mods.shift && anchor !== null && focusableKeys.includes(anchor)) {\n const a = focusableKeys.indexOf(anchor);\n const b = focusableKeys.indexOf(key);\n const range = focusableKeys.slice(Math.min(a, b), Math.max(a, b) + 1);\n onSelectedKeysChange(new Set([...(mods.meta ? current : []), ...range]));\n } else if (mods.meta) {\n if (current.has(key)) current.delete(key);\n else current.add(key);\n anchorRef.current = key;\n onSelectedKeysChange(current);\n } else {\n anchorRef.current = key;\n onSelectedKeysChange(new Set([key]));\n }\n onRowSelect?.(row);\n return true;\n };\n const moveFocus = (event: React.KeyboardEvent<HTMLTableRowElement>, delta: number) => {\n const rowsEls = Array.from(bodyRef.current?.rows ?? []).filter((tr) => tr.hasAttribute(\"data-row-focusable\"));\n const at = rowsEls.indexOf(event.currentTarget);\n const next = rowsEls[delta === Infinity ? rowsEls.length - 1 : delta === -Infinity ? 0 : at + delta];\n if (next) {\n event.preventDefault();\n next.focus();\n }\n };\n const contextItems = menuRow !== null && rowContextMenu ? (rowContextMenu(menuRow) ?? null) : null;\n // No rows: Console's \"No Messages\" — the placeholder alone, centered on a plain content area, with no\n // header and no stripes (an empty NSTableView draws nothing behind a placeholder).\n const bar =\n filterable && filterBar && givenRows.length > 0 ? (\n <TableFilterBar columns={allColumns as ReadonlyArray<FilterableColumn<T>>} rows={givenRows} state={filter} onChange={setFilter} shown={rows.length} label={ariaLabel.toLowerCase()} />\n ) : null;\n const framed = (body: React.ReactElement) =>\n bar ? (\n <div\n ref={frameRef}\n data-slot=\"data-table-frame\"\n data-held={heldHeight ? \"\" : undefined}\n className={cn(\"flex min-h-0 flex-col\", fill && \"flex-1\")}\n style={heldHeight ? { minHeight: heldHeight } : undefined}\n >\n {bar}\n {body}\n </div>\n ) : (\n body\n );\n // The filters keep no row: say so where the rows were, with the way back (the bar stays put).\n if (givenRows.length > 0 && rows.length === 0 && filterable) {\n return framed(\n <div data-slot=\"data-table\" data-empty=\"\" data-filtered-empty=\"\" role=\"table\" aria-label={ariaLabel} aria-rowcount={0} className={cn(\"flex items-center justify-center py-6\", fill ? \"min-h-0 flex-1\" : null, className)} {...rest}>\n <StateView kind=\"empty\" title=\"No Results\" message={noResultsMessage(filter)} actions={filterActive(filter) ? <ClearFiltersButton onClear={() => setFilter(EMPTY_TABLE_FILTER)} /> : null} />\n </div>,\n );\n }\n if (givenRows.length === 0 && empty) {\n return (\n <div\n data-slot=\"data-table\"\n data-empty=\"\"\n data-fill={fill || undefined}\n role=\"table\"\n aria-label={ariaLabel}\n aria-rowcount={0}\n className={cn(\"flex items-center justify-center\", fill ? \"min-h-0 flex-1\" : null, className)}\n {...rest}\n >\n {empty}\n </div>\n );\n }\n const openDetails = detail ? flat.filter(({ row }) => expanded.has(rowKey(row))).length : 0;\n // Each group's stripes start again under its heading; the filler continues the last group's.\n const groupStartAt = (index: number) => {\n let at = 0;\n for (const start of groupStarts.keys()) if (start <= index) at = start;\n return at;\n };\n const lastStripe = flat.length - groupStartAt(Math.max(0, flat.length - 1));\n const drawn = flat.length + groupStarts.size;\n const fillerStart = drawn - (lastStripe % 2);\n const table = (\n <div\n data-slot=\"data-table\"\n data-fill={fill || undefined}\n data-spare={spare}\n data-row-size={rowSize === \"small\" ? \"small\" : undefined}\n className={cn(\"overflow-x-auto\", fill && \"flex-1\", className)}\n {...rest}\n // The rows paint their own (rounded) stripes; the filler's stripes start at the even row at or\n // above the table's end, so none is painted twice. An open detail row has its own height, so\n // while one is open there is no filler (its rows could not line up).\n data-detail-open={openDetails > 0 || undefined}\n style={fill ? ({ ...rest.style, \"--mx-table-rows\": String(fillerStart) } as React.CSSProperties) : rest.style}\n >\n <table\n aria-label={ariaLabel}\n className=\"grid w-full border-collapse text-body\"\n style={{ gridTemplateColumns: gridTemplate(columns as ReadonlyArray<Column<never>>, { selection: Boolean(selection), detail: Boolean(detail) }, hasActions, widths, spare) }}\n >\n <thead role=\"rowgroup\" className=\"contents\">\n <HeaderMenu columns={optionalColumns} hidden={hidden} onToggle={setColumnShown}>\n <tr role=\"row\" data-slot=\"data-table-header\" data-column-menu={optionalColumns.length > 0 ? \"\" : undefined} className=\"col-span-full grid h-table-header grid-cols-subgrid border-b border-separator\">\n {selection ? (\n <th className=\"flex items-center pl-3\">\n <Checkbox\n aria-label=\"Select every row\"\n data-select-all\n checked={picked === 0 ? false : picked === allKeys.length ? true : \"indeterminate\"}\n onCheckedChange={(on) => selection.onChange(on === true ? new Set([...selection.selected, ...allKeys]) : new Set([...selection.selected].filter((k) => !allKeys.includes(k))))}\n />\n </th>\n ) : null}\n {detail ? <th aria-hidden /> : 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 role=\"columnheader\"\n data-kind={columnKind(column as Column<never>)}\n aria-sort={column.sort ? (sorted ?? \"none\") : undefined}\n data-sorted={sorted ? \"\" : undefined}\n className={cn(\n // A header never wraps (\"Started by\" is one line): it is part of its column's\n // fitted width.\n // The column names in the label color, as Activity Monitor's (measured #272727): the gray\n // secondary read as a smaller, fainter font than Apple's header.\n \"relative content-center truncate whitespace-nowrap px-3 text-table-header text-label\",\n MIN[columnKind(column as Column<never>)],\n column.kind ? null : LEGACY_MIN[column.width ?? \"auto\"],\n ALIGN[column.align ?? (columnKind(column as Column<never>) === \"numeric\" ? \"end\" : \"start\")],\n )}\n >\n {column.sort ? (\n // The whole header cell sorts (NSTableHeaderView); the sort chevron sits at the\n // cell's trailing edge, up for ascending, and only on the sorted column.\n <button\n type=\"button\"\n onClick={() => toggleSort(column.key)}\n className={cn(\n \"focus-ring flex h-full w-full items-center gap-1 rounded-control hover:text-label\",\n sorted && \"text-label\",\n (column.align ?? (columnKind(column as Column<never>) === \"numeric\" ? \"end\" : \"start\")) === \"end\" && \"justify-end\",\n )}\n >\n <span className=\"min-w-0 truncate\">{column.header}</span>\n <ChevronDownIcon\n aria-hidden\n data-sort-chevron={sorted ?? undefined}\n className={cn(\n \"size-2.5 shrink-0 text-label-secondary\",\n (column.align ?? (columnKind(column as Column<never>) === \"numeric\" ? \"end\" : \"start\")) !== \"end\" && \"ml-auto\",\n // Only the sorted column draws its chevron; every other header takes no room\n // for one, so a right-aligned title ends flush over its numbers (AppKit).\n !sorted && \"hidden\",\n sorted === \"ascending\" && \"rotate-180\",\n )}\n />\n </button>\n ) : (\n column.header\n )}\n {columnKind(column as Column<never>) === \"action\" ? null : (\n <span\n aria-hidden\n data-slot=\"column-resizer\"\n title=\"Drag to resize · double-click to fit\"\n className=\"absolute inset-y-0 -right-1 w-2 cursor-col-resize\"\n onPointerDown={(event) => resizeFrom(column.key, event)}\n onDoubleClick={() => autosize(column.key)}\n />\n )}\n </th>\n );\n })}\n {hasActions ? <th aria-label=\"Actions\" /> : null}\n </tr>\n </HeaderMenu>\n </thead>\n {(\n <tbody ref={bodyRef} role=\"rowgroup\" className=\"contents\">\n {flat.map(({ row, depth, parent }, index) => {\n const tabKey = tabRowKey;\n const key = rowKey(row);\n const branchOpen = parent && !collapsed.has(key);\n const selected = selectedKey === key || (multi && (selectedKeys?.has(key) ?? false));\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) : parent ? () => setOpen(key, !branchOpen, row) : undefined;\n const focusable = Boolean(activate || onRowOpen) && !disabled;\n const group = groupStarts.get(index);\n const stripe = index - groupStartAt(index);\n return (\n <React.Fragment key={key}>\n {group ? (\n <tr role=\"row\" data-slot=\"data-table-group\" data-group={group.key} className=\"col-span-full grid h-row-table grid-cols-subgrid border-b border-separator\">\n <td role=\"cell\" colSpan={span} className=\"col-span-full min-w-0 content-center truncate px-3\">\n {groups?.header(group.key, group.rows)}\n </td>\n </tr>\n ) : null}\n <tr\n {...rowData?.(row)}\n // One Tab stop for the whole table (AppKit's table view): the selected row, else\n // the last one focused, else the first; the arrows move between rows.\n tabIndex={focusable ? (key === tabKey ? 0 : -1) : undefined}\n data-row-focusable={focusable || undefined}\n // Only the row itself becomes the Tab row: a control in another row's cell, reached by Tab,\n // must leave this row and its actions in the Tab order, so Shift-Tab walks back over them.\n onFocus={focusable ? (event) => (event.target === event.currentTarget ? setFocusedKey(key) : undefined) : undefined}\n aria-selected={onRowSelect ? selected : undefined}\n data-selected={selected || undefined}\n aria-expanded={content !== null ? open : parent ? branchOpen : undefined}\n aria-level={subRows ? depth + 1 : undefined}\n data-depth={subRows ? depth : undefined}\n onDoubleClick={\n onRowOpen && focusable\n ? (event) => {\n if (insideControl(event.target as HTMLElement, event.currentTarget)) return;\n onRowOpen(row);\n }\n : undefined\n }\n onContextMenu={\n rowContextMenu && !disabled\n ? () => {\n // Right-clicking a row selects it first (Activity Monitor, Finder).\n setMenuRow(row);\n if (!selected) onRowSelect?.(row);\n }\n : undefined\n }\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 if (multi && onRowSelect && pick(key, row, { meta: event.metaKey || event.ctrlKey, shift: event.shiftKey })) return;\n activate?.();\n }\n : undefined\n }\n onKeyDown={\n focusable\n ? (event) => {\n if (multi && (event.metaKey || event.ctrlKey) && event.key.toLowerCase() === \"a\") {\n event.preventDefault();\n onSelectedKeysChange?.(new Set(focusableKeys));\n return;\n }\n if (multi && event.shiftKey && (event.key === \"ArrowDown\" || event.key === \"ArrowUp\")) {\n const at = focusableKeys.indexOf(key);\n const nextKey = focusableKeys[at + (event.key === \"ArrowDown\" ? 1 : -1)];\n const nextRow = nextKey === undefined ? undefined : flat.find((f) => rowKey(f.row) === nextKey)?.row;\n if (nextKey !== undefined && nextRow !== undefined) {\n const keep = anchorRef.current;\n pick(nextKey, nextRow, { meta: false, shift: true });\n anchorRef.current = keep ?? key;\n moveFocus(event, event.key === \"ArrowDown\" ? 1 : -1);\n }\n return;\n }\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n activate?.();\n } else if (event.key === \"ArrowDown\" && event.metaKey && onRowOpen) {\n event.preventDefault();\n onRowOpen(row);\n } else if (event.key === \"ArrowDown\") moveFocus(event, 1);\n else if (event.key === \"ArrowUp\") moveFocus(event, -1);\n else if (event.key === \"Home\") moveFocus(event, -Infinity);\n else if (event.key === \"End\") moveFocus(event, Infinity);\n else if (event.key === \"ArrowRight\" && content !== null) toggle(key, true);\n else if (event.key === \"ArrowLeft\" && content !== null) toggle(key, false);\n else if (event.key === \"ArrowRight\" && parent) setOpen(key, true, row);\n else if (event.key === \"ArrowLeft\" && parent) setOpen(key, false, row);\n }\n : undefined\n }\n role=\"row\"\n data-slot=\"data-table-row\"\n className={cn(\n \"group/row col-span-full grid h-row-table grid-cols-subgrid\",\n // alternatingContentBackgroundColors: every other row, edge to edge and square\n // (NSTableView .fullWidth, as in Activity Monitor).\n striped && stripe % 2 === 1 && \"bg-fill\",\n focusable && \"focus-ring -outline-offset-3\",\n disabled && \"text-label-tertiary\",\n // Unemphasised gray; the accent with white text while the table has focus in\n // the key window (desktop.css), as an NSTableView selection.\n selected && \"bg-selection-muted\",\n )}\n >\n {selection ? (\n <td className=\"flex items-center pl-3\">\n <Checkbox\n aria-label=\"Select row\"\n data-select-row={key}\n disabled={disabled}\n checked={!disabled && selection.selected.has(key)}\n onCheckedChange={(on) => {\n const next = new Set(selection.selected);\n if (on === true) next.add(key);\n else next.delete(key);\n selection.onChange(next);\n }}\n />\n </td>\n ) : null}\n {detail ? (\n <td className=\"flex items-center 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, columnIndex) => {\n const kind = columnKind(column as Column<never>);\n const outline = subRows && columnIndex === 0;\n const gives = kind === \"flex\" || column.yields === true;\n const body = gives ? <FitText>{column.cell(row)}</FitText> : column.cell(row);\n return (\n <td\n key={column.key}\n role=\"cell\"\n data-kind={kind}\n className={cn(\n \"content-center px-3\",\n // Only the flex column (and a column that yields) gives way, with an\n // ellipsis; every other kind is as wide as its widest value.\n gives ? \"min-w-0 truncate\" : \"whitespace-nowrap\",\n ALIGN[column.align ?? (kind === \"numeric\" ? \"end\" : \"start\")],\n kind === \"numeric\" && \"tabular-nums\",\n column.mono && \"font-mono text-code\",\n )}\n >\n {outline ? (\n <span data-slot=\"outline-cell\" className=\"flex min-w-0 items-center gap-1\" style={{ paddingInlineStart: `${depth}rem` }}>\n <span\n aria-hidden\n data-disclosure={parent ? (branchOpen ? \"open\" : \"closed\") : undefined}\n className=\"flex size-icon shrink-0 items-center justify-center\"\n onClick={\n parent\n ? (event) => {\n event.stopPropagation();\n setOpen(key, !branchOpen, row);\n }\n : undefined\n }\n >\n {parent ? <ChevronRightIcon className={cn(\"size-icon-sm text-label-secondary transition-transform duration-100\", branchOpen && \"rotate-90\")} /> : null}\n </span>\n <span className=\"min-w-0 flex-1\">{body}</span>\n </span>\n ) : (\n body\n )}\n </td>\n );\n })}\n {hasActions ? (\n // Always visible, in their own column (Arman, 2026-10-07): a row's buttons are\n // there to be seen and used, never revealed on hover.\n <td role=\"cell\" data-kind=\"action\" className=\"content-center whitespace-nowrap px-2\">\n <RowActions tabbable={!focusable || key === tabKey} buttons={rowButtons?.(row) ?? null} action={rowAction?.(row) ?? null} menu={rowMenu?.(row) ?? null} />\n </td>\n ) : null}\n </tr>\n {open ? (\n <tr role=\"row\" className={cn(\"col-span-full grid grid-cols-subgrid\", striped && stripe % 2 === 1 && \"bg-fill\")}>\n <td colSpan={span} className=\"col-span-full min-w-0 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 if (!rowContextMenu) return framed(table);\n return framed(\n <>\n <ContextMenu onOpenChange={(open) => (open ? undefined : setMenuRow(null))}>\n <ContextMenuTrigger asChild>{table}</ContextMenuTrigger>\n {contextItems && contextItems.length ? (\n <ContextMenuContent data-slot=\"data-table-menu\">\n <ContextMenuEntries items={contextItems} onAsk={setAskingMenu} />\n </ContextMenuContent>\n ) : null}\n </ContextMenu>\n <ConfirmDialog\n open={askingMenu !== null}\n onOpenChange={(open) => (open ? undefined : setAskingMenu(null))}\n title={askingMenu?.confirm ?? \"\"}\n confirmLabel={askingMenu?.label}\n variant=\"destructive\"\n onConfirm={() => {\n askingMenu?.onSelect();\n setAskingMenu(null);\n }}\n />\n </>,\n );\n}\n\n/**\n * NSTableView's header menu: right-click the column headers for a checked list of the optional\n * columns, each shown or hidden in place (Finder's and Mail's Show Columns). A table with no\n * optional column has no menu.\n */\nfunction HeaderMenu<T>({\n columns,\n hidden,\n onToggle,\n children,\n}: {\n columns: ReadonlyArray<Column<T>>;\n hidden: ReadonlySet<string>;\n onToggle: (key: string, shown: boolean) => void;\n children: React.ReactElement;\n}) {\n if (columns.length === 0) return children;\n return (\n <ContextMenu>\n {/* The row menu (rowContextMenu) wraps the whole table: the header's right-click is its own. */}\n <ContextMenuTrigger asChild onContextMenu={(event) => event.stopPropagation()}>\n {children}\n </ContextMenuTrigger>\n <ContextMenuContent data-slot=\"data-table-column-menu\">\n {columns.map((column) => (\n <ContextMenuCheckboxItem\n key={column.key}\n data-column-toggle={column.key}\n checked={!hidden.has(column.key)}\n onCheckedChange={(on) => onToggle(column.key, on === true)}\n >\n {column.title ?? (typeof column.header === \"string\" ? column.header : column.key)}\n </ContextMenuCheckboxItem>\n ))}\n </ContextMenuContent>\n </ContextMenu>\n );\n}\n\nfunction RowActions({\n tabbable,\n buttons,\n action,\n menu,\n}: {\n /** Only the table's Tab row keeps its actions in the Tab order (one stop per table, then its\n * row's actions); the arrows move to another row, whose actions Tab then reaches. */\n tabbable: boolean;\n buttons: ReadonlyArray<RowAction> | null;\n action: RowAction | null;\n menu: ReadonlyArray<RowMenuItem> | null;\n}) {\n const [asking, setAsking] = React.useState<RowMenuItem | null>(null);\n const tab = tabbable ? {} : { tabIndex: -1 };\n return (\n <span className=\"flex items-center justify-end gap-1\">\n {buttons?.map((b) =>\n b.icon ? (\n <IconButton key={b.label} size=\"sm\" label={b.label} icon={b.icon} disabled={b.disabled ?? false} onClick={b.onSelect} {...tab} />\n ) : (\n <Button key={b.label} size=\"sm\" disabled={b.disabled ?? false} onClick={b.onSelect} {...tab}>\n {b.label}\n </Button>\n ),\n )}\n {action ? (\n <Button size=\"sm\" disabled={action.disabled ?? false} onClick={action.onSelect} {...tab}>\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 />} {...tab} />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n <DropdownMenuEntries items={menu} onAsk={setAsking} />\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\n/**\n * The flex column's content: one line that ends in an ellipsis when it must (whatever the cell\n * drew: a string, a Text, a row of spans) and, only then, shows its whole text as the tooltip on\n * hover, as Finder's and Activity Monitor's expansion tooltips do. A child that truncates itself\n * (and already has a title) keeps its own.\n */\nfunction FitText({ children }: { children: React.ReactNode }) {\n const ref = React.useRef<HTMLDivElement>(null);\n const reveal = () => {\n const el = ref.current;\n if (!el) return;\n const cut = [el, ...Array.from(el.querySelectorAll<HTMLElement>(\"*\"))].some((n) => n.scrollWidth > n.clientWidth + 1 && !n.title);\n const text = el.textContent?.trim() ?? \"\";\n if (cut && text) el.title = text;\n else el.removeAttribute(\"title\");\n };\n return (\n <div ref={ref} data-slot=\"cell-text\" className=\"min-w-0 truncate\" onPointerEnter={reveal}>\n {children}\n </div>\n );\n}\n\nexport interface NameCellProps {\n /** The thing's name: it gets the room first, ends in an ellipsis when it must, and its tooltip\n * is the whole name. */\n name: string;\n /** A secondary line beside the name (a summary): it gives way first. */\n detail?: React.ReactNode;\n mono?: boolean;\n tone?: \"primary\" | \"tertiary\";\n}\n\n/** A table's name cell: name first (never cut mid-word while a summary still has room), then detail. */\nexport interface StateCellProps {\n [data: `data-${string}`]: string | undefined;\n /** The light's color: `success` live/open, `neutral` off/closed, `warning`/`danger` for health. */\n tone: \"success\" | \"neutral\" | \"warning\" | \"danger\";\n /** The state in one word beside the light (\"Open\", \"Closed\"). */\n state: string;\n /** A short fact after it, secondary (\"2 chats open\"). */\n detail?: string | undefined;\n /** The one action this state calls for (Closed → Open, Open → Restart…), a small button at the\n * cell's trailing edge; disabled with its reason as the tooltip when it cannot act. */\n action?: { label: string; onSelect: () => void; disabled?: boolean; title?: string } | null;\n}\n\n/**\n * A state column with its one action (Activity Monitor has none; Accounts' Window column): the\n * status light and its word, an optional secondary fact, then the action that state calls for. The\n * one sanctioned control in a cell besides RemovableTag: the action is part of the state it changes,\n * so it sits beside it rather than in the row's trailing buttons. The column is `kind: \"action\"`.\n */\nexport function StateCell({ tone, state, detail, action, ...data }: StateCellProps) {\n return (\n <span {...data} data-slot=\"state-cell\" className=\"flex min-w-0 items-center gap-1.5\">\n <StatusLight tone={tone} label={state} />\n <Text>{state}</Text>\n {detail ? (\n <Text tone=\"secondary\" truncate>\n {`· ${detail}`}\n </Text>\n ) : null}\n {action ? (\n <Button size=\"sm\" className=\"ml-auto shrink-0\" data-state-action={action.label} disabled={action.disabled === true} title={action.title} onClick={(e) => { e.stopPropagation(); action.onSelect(); }}>\n {action.label}\n </Button>\n ) : null}\n </span>\n );\n}\n\nexport function NameCell({ name, detail, mono, tone = \"primary\" }: NameCellProps) {\n return (\n <span data-slot=\"name-cell\" className=\"flex min-w-0 items-baseline gap-2\">\n <span\n title={name}\n className={cn(\n \"min-w-0 max-w-full shrink-0 truncate\",\n detail ? \"max-w-3/5\" : null,\n mono ? \"font-mono text-code\" : \"text-body\",\n tone === \"tertiary\" ? \"text-label-tertiary\" : \"text-label\",\n )}\n >\n {name}\n </span>\n {detail ? <span className=\"min-w-0 flex-1 truncate text-body text-label-secondary\">{detail}</span> : null}\n </span>\n );\n}\n","import * as React from \"react\";\n\nimport { XIcon } from \"../icons\";\nimport { cn } from \"./cn\";\n\nexport type TagTone = \"neutral\" | \"tint\" | \"success\" | \"warning\" | \"danger\";\n\nconst TONE: Record<TagTone, string> = {\n // A hairline capsule, no fill: a chip states a fact and must never look pressable (buttons\n // carry the control fill and shadow).\n neutral: \"text-label-secondary ring-1 ring-inset ring-separator\",\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. 12 pt medium (Apple's\n * callout, the smallest a label carrying words is drawn at), 20 px. In the light appearance the\n * colored tones' text is the system color deepened (desktop.css), so it reads on its tinted fill. */\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-5 shrink-0 cursor-default select-none items-center gap-1 whitespace-nowrap rounded-full px-2 text-callout font-medium [&_svg]:size-3\",\n TONE[tone],\n className,\n )}\n {...props}\n />\n );\n}\n\nexport interface RemovableTagProps extends Omit<TagProps, \"children\"> {\n children: React.ReactNode;\n /** Takes the thing out (a chat out of a project). */\n onRemove: () => void;\n /** The ×'s accessible name and tooltip, in words (\"Take out of Research\"). */\n removeLabel: string;\n disabled?: boolean;\n}\n\n/**\n * A chip with a one-click × (Mail's address tokens, Finder's tag tokens): the one control allowed\n * inside a DataTable cell. The × is its own button, so a press on it never selects the row.\n */\nexport function RemovableTag({ children, onRemove, removeLabel, disabled, className, ...props }: RemovableTagProps) {\n return (\n <Tag data-removable=\"\" className={cn(\"pr-0.5\", className)} {...props}>\n <span className=\"min-w-0 truncate\">{children}</span>\n <button\n type=\"button\"\n aria-label={removeLabel}\n title={removeLabel}\n disabled={disabled}\n data-slot=\"tag-remove\"\n onClick={(event) => {\n event.stopPropagation();\n onRemove();\n }}\n className=\"focus-ring inline-flex size-3.5 shrink-0 items-center justify-center rounded-full text-label-tertiary hover:bg-fill-secondary hover:text-label disabled:opacity-50\"\n >\n <XIcon aria-hidden />\n </button>\n </Tag>\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-subheadline text-label-secondary\", className)}\n {...props}\n />\n );\n}\n\n/**\n * Where one thing is, per place (a chat per window): `in` filled, `out` an empty ring, `hidden` a\n * tint ring (there, but that place does not show it), `open` green (in use there now). `marked`\n * adds a small dot inside (the place's own mark, e.g. its pin). 12 px; the label is the tooltip\n * and the accessible name, so a mark is never unexplained.\n */\nexport type PlaceMarkState = \"in\" | \"out\" | \"hidden\" | \"open\";\n\nconst PLACE: Record<PlaceMarkState, string> = {\n in: \"bg-tint\",\n out: \"border border-label-tertiary\",\n hidden: \"border-2 border-tint\",\n open: \"bg-system-green\",\n};\n\nconst PLACE_DOT: Record<PlaceMarkState, string> = {\n in: \"bg-window\",\n out: \"bg-label-secondary\",\n hidden: \"bg-tint\",\n open: \"bg-window\",\n};\n\nexport interface PlaceMarkProps extends Omit<React.HTMLAttributes<HTMLElement>, \"children\" | \"onSelect\"> {\n state: PlaceMarkState;\n /** The place's own mark on the thing (a pin): a dot inside the circle. */\n marked?: boolean;\n /** What the mark says (\"emily: listed, pinned\"); tooltip and accessible name. */\n label: string;\n /** Makes the mark a control (put it there / take it off): a button with the same look. */\n onSelect?: () => void;\n disabled?: boolean;\n}\n\nexport function PlaceMark({ state, marked = false, label, onSelect, disabled, className, ...props }: PlaceMarkProps) {\n const dot = marked ? <span className={cn(\"size-1.5 rounded-full\", PLACE_DOT[state])} /> : null;\n if (onSelect) {\n return (\n <button\n type=\"button\"\n aria-label={label}\n title={label}\n disabled={disabled}\n onClick={(event) => {\n event.stopPropagation();\n onSelect();\n }}\n data-slot=\"place-mark\"\n data-state={state}\n data-marked={marked ? \"true\" : undefined}\n className={cn(\n \"focus-ring inline-flex size-3 shrink-0 items-center justify-center rounded-full hover:opacity-70 disabled:opacity-50\",\n PLACE[state],\n className,\n )}\n {...props}\n >\n {dot}\n </button>\n );\n }\n return (\n <span\n role=\"img\"\n aria-label={label}\n title={label}\n data-slot=\"place-mark\"\n data-state={state}\n data-marked={marked ? \"true\" : undefined}\n className={cn(\"inline-flex size-3 shrink-0 items-center justify-center rounded-full\", PLACE[state], className)}\n {...props}\n >\n {dot}\n </span>\n );\n}\n\n/** A row of PlaceMarks in a fixed order (one per place), e.g. a chat's windows in a table cell. */\nexport function PlaceStrip({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) {\n return <span data-slot=\"place-strip\" className={cn(\"inline-flex items-center gap-1\", className)} {...props} />;\n}\n","import * as React from \"react\";\nimport { copyText } from \"@ai-matrx/kit/clipboard\";\n\nimport { XIcon } from \"../icons\";\nimport { Button, IconButton } from \"./button\";\nimport { describeError } from \"./errors\";\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` centers in the whole content area; `inline` sits inside a section or table; `row` is one\n * quiet centered line the height of a row, as Internet Accounts says \"No accounts\" in its group. */\n size?: \"page\" | \"inline\" | \"row\";\n}\n\n/** The standard empty glyph (an empty tray, as Mail and Finder draw \"nothing here\"). */\nconst EMPTY_ICON = (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={1.75} strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M22 12h-6l-2 3h-4l-2-3H2\" />\n <path d=\"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z\" />\n </svg>\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 if (size === \"row\") {\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(\"flex min-h-row items-center justify-center gap-2 px-3 py-2 text-center\", className)}\n {...props}\n >\n {kind === \"loading\" ? <Spinner size=\"sm\" /> : null}\n <Text tone={kind === \"error\" ? \"danger\" : \"secondary\"}>{title}</Text>\n {actions ? <div className=\"flex items-center gap-2\">{actions}</div> : null}\n </div>\n );\n }\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-8\",\n className,\n )}\n {...props}\n >\n {kind === \"loading\" ? (\n <Spinner size=\"lg\" />\n ) : icon || kind === \"empty\" ? (\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 ?? EMPTY_ICON}\n </span>\n ) : null}\n {/* Empty reads quietly (secondary), as an empty Mail mailbox does; a failure reads at full strength. */}\n <Text variant={size === \"page\" ? \"title-3\" : \"headline\"} tone={kind === \"error\" ? \"primary\" : \"secondary\"}>\n {title}\n </Text>\n {message ? (\n <Text as=\"p\" 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\n/** lucide glyphs, inlined (policy C19). One per tone, so every banner of a kind looks the same. */\nfunction Glyph({ d }: { d: ReadonlyArray<string> }) {\n return (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={1.75} strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n {d.map((path) => (\n <path key={path} d={path} />\n ))}\n </svg>\n );\n}\nconst ALERT = [\"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\", \"M12 9v4\", \"M12 17h.01\"];\nconst INFO = [\"M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20Z\", \"M12 16v-4\", \"M12 8h.01\"];\nconst DONE = [\"M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20Z\", \"m9 12 2 2 4-4\"];\nconst BANNER_ICON: Record<BannerTone, React.ReactNode> = {\n neutral: <Glyph d={INFO} />,\n info: <Glyph d={INFO} />,\n warning: <Glyph d={ALERT} />,\n danger: <Glyph d={ALERT} />,\n success: <Glyph d={DONE} />,\n};\n\nexport interface BannerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n tone: BannerTone;\n /** Override the tone's own icon (rarely: the tone's glyph is the standard). */\n icon?: React.ReactNode;\n title: React.ReactNode;\n message?: React.ReactNode;\n /** Trailing Buttons (size sm). */\n actions?: React.ReactNode;\n /** The raw text behind the message (an error's own words): offered as Copy details and shown\n * as the message's tooltip, never as the message. */\n detail?: string;\n /** Shows the close (×) button: for notices the person can put away. */\n onDismiss?: () => void;\n}\n\n/**\n * THE inline notice (one pattern, every screen): the tone's icon, a semantic tint, one fixed\n * minimum height, the title and one line, trailing actions, and × when it can be put away.\n */\nexport function Banner({ tone, icon, title, message, actions, detail, onDismiss, className, ...props }: BannerProps) {\n const [copied, setCopied] = React.useState(false);\n return (\n <div\n role={tone === \"danger\" || tone === \"warning\" ? \"alert\" : \"status\"}\n data-slot=\"banner\"\n data-tone={tone}\n className={cn(\"flex min-h-row items-center gap-2.5 rounded-group px-3 py-2\", BANNER_TONE[tone].box, className)}\n {...props}\n >\n <span className={cn(\"flex shrink-0 self-start pt-px [&_svg]:size-icon\", BANNER_TONE[tone].icon)}>{icon ?? BANNER_ICON[tone]}</span>\n {/* The text and the actions share one wrapping row: the text takes the width that is left (never\n squeezed under ~14 rem), and when the actions do not fit beside it they drop under it. */}\n <div data-slot=\"banner-body\" className=\"flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-2\">\n <div data-slot=\"banner-text\" className=\"flex min-w-0 flex-1 basis-56 flex-col gap-0.5\" title={detail || undefined}>\n <Text emphasized>{title}</Text>\n {message ? (\n <Text as=\"p\" tone=\"secondary\" selectable>\n {message}\n </Text>\n ) : null}\n </div>\n {actions || detail ? (\n <div data-slot=\"banner-actions\" className=\"ml-auto flex shrink-0 items-center gap-2\">\n {detail ? (\n <Button\n size=\"sm\"\n variant=\"plain\"\n onClick={() => {\n void copyText(detail).then((copied) => copied && setCopied(true));\n }}\n >\n {copied ? \"Copied\" : \"Copy details\"}\n </Button>\n ) : null}\n {actions}\n </div>\n ) : null}\n </div>\n {onDismiss ? <IconButton size=\"sm\" label=\"Dismiss\" icon={<XIcon />} onClick={onDismiss} /> : null}\n </div>\n );\n}\n\nexport interface ErrorBannerProps extends Omit<BannerProps, \"tone\" | \"title\" | \"message\" | \"actions\" | \"detail\" | \"onDismiss\"> {\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 /** Trailing Buttons (a Try again). */\n actions?: React.ReactNode;\n}\n\n/** THE banner for a failed action: an actionable cause (describeError), Copy details, and ×. */\nexport function ErrorBanner({ error, onDismiss, title = \"That didn't work\", ...props }: ErrorBannerProps) {\n if (!error) return null;\n const said = describeError(error);\n return <Banner tone=\"danger\" title={title} message={said.cause} {...(said.detail ? { detail: said.detail } : {})} onDismiss={onDismiss} {...props} />;\n}\n","/**\n * THE error-wording layer. A failure is shown as a cause the person can act on (\"A program it\n * needs isn't installed\"), never as the raw text a process threw (\"spawn uv ENOENT\"). The raw text\n * is kept, whole, as `detail` — the banner offers it behind Copy details and a tooltip, for a bug\n * report or an agent. One table, so every screen and every service says the same thing.\n */\n\nexport interface DescribedError {\n /** One plain sentence: what went wrong and, where it helps, what to do. */\n cause: string;\n /** The raw text, unedited (empty when it would only repeat `cause`). */\n detail: string;\n /** A short machine code when one was recognized (\"ENOENT\", \"TIMEOUT\"). */\n code?: string;\n}\n\ninterface Rule {\n code: string;\n test: RegExp;\n cause: string;\n}\n\n/** Ordered: the first rule whose pattern matches the raw text wins. */\nconst RULES: ReadonlyArray<Rule> = [\n { code: \"ENOENT\", test: /\\b(spawn\\s+\\S+\\s+)?ENOENT\\b|command not found|no such file or directory/i, cause: \"A program or file it needs isn't on this computer. Install it or update Matrx, then try again.\" },\n { code: \"EACCES\", test: /\\bEACCES\\b|\\bEPERM\\b|permission denied|operation not permitted|not authori[sz]ed by the user/i, cause: \"Matrx isn't allowed to do that. Grant access in System Settings › Privacy & Security, then try again.\" },\n { code: \"EADDRINUSE\", test: /\\bEADDRINUSE\\b|address already in use|port .* (is )?(already )?in use/i, cause: \"Another program is already using that port. Stop it, or choose another port.\" },\n { code: \"ECONNREFUSED\", test: /\\bECONNREFUSED\\b|connection refused/i, cause: \"The service isn't answering. It may have stopped; start it again.\" },\n { code: \"OFFLINE\", test: /\\bENOTFOUND\\b|\\bEAI_AGAIN\\b|\\bENETUNREACH\\b|getaddrinfo|network (is )?unreachable|failed to fetch|offline/i, cause: \"Can't reach the internet. Check the connection and try again.\" },\n { code: \"TIMEOUT\", test: /\\bETIMEDOUT\\b|timed? ?out|\\bTIMEOUT\\b|deadline exceeded/i, cause: \"It took too long to answer. Try again in a moment.\" },\n { code: \"ENOSPC\", test: /\\bENOSPC\\b|no space left/i, cause: \"The disk is full. Free some space, then try again.\" },\n { code: \"ENOMEM\", test: /\\bENOMEM\\b|out of memory|cannot allocate memory/i, cause: \"The computer ran out of memory. Close something and try again.\" },\n { code: \"UNAUTHORIZED\", test: /\\b401\\b|unauthori[sz]ed|invalid (api )?key|not signed in|jwt expired|session expired/i, cause: \"You're signed out, or the key was refused. Sign in again.\" },\n { code: \"FORBIDDEN\", test: /\\b403\\b|forbidden/i, cause: \"This account isn't allowed to do that.\" },\n { code: \"NOT_FOUND\", test: /\\b404\\b|not found/i, cause: \"It isn't there any more. Refresh and try again.\" },\n { code: \"RATE_LIMIT\", test: /\\b429\\b|rate.?limit|too many requests/i, cause: \"Too many requests just now. Wait a moment and try again.\" },\n { code: \"SERVER\", test: /\\b5\\d\\d\\b|internal server error|bad gateway|service unavailable/i, cause: \"The server had a problem. Try again in a moment.\" },\n { code: \"EXITED\", test: /exited with code|process exited|crashed|SIGKILL|SIGSEGV|SIGTERM/i, cause: \"The service stopped unexpectedly. Start it again; Copy details if it keeps happening.\" },\n];\n\nconst RAW = /\\b[A-Z]{2,}[A-Z_]*\\b|[\\\\/][\\w.-]+[\\\\/]|\\bat \\S+ \\(|\\{|\\}|errno|stack|undefined|null|\\bspawn\\b/;\n\nfunction rawText(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 \"\";\n}\n\n/**\n * Turn any thrown or returned error into words a person can act on. Already-humane text (a full\n * sentence the app wrote itself, with no codes, paths or stack) passes through unchanged.\n */\nexport function describeError(error: unknown, fallback = \"Something went wrong. Try again.\"): DescribedError {\n const detail = rawText(error).trim();\n if (!detail) return { cause: fallback, detail: \"\" };\n for (const rule of RULES) {\n if (rule.test.test(detail)) return { cause: rule.cause, detail, code: rule.code };\n }\n if (!RAW.test(detail) && detail.length <= 160) return { cause: detail, detail: \"\" };\n return { cause: fallback, detail };\n}\n","import * as React from \"react\";\n\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from \"../dropdown-menu\";\nimport { ListFilterIcon } from \"../icons\";\nimport { Button, IconButton } from \"./button\";\nimport { cn } from \"./cn\";\nimport { SearchField } from \"./field\";\nimport { RemovableTag } from \"./tag\";\nimport { Text } from \"./text\";\n\n/**\n * How a column filters (Mail's and Finder's filter menus, Numbers' column filter):\n * - `values`: the column holds one of a set of values (Status, App, Plan). The filter menu lists\n * every value with how many rows have it; the person ticks the ones to keep. `value` reads the\n * row's value(s) — a string, or several (a row tagged twice counts under both); without it the\n * row's own field named by the column's `key` is read. A date column filters the same way with a\n * `value` that returns its bucket (\"Today\", \"This week\", \"Older\").\n */\nexport interface ColumnValuesFilter<T> {\n kind: \"values\";\n value?: (row: T) => string | ReadonlyArray<string> | null | undefined;\n /** The words the menu and the token show for a value (default: the value itself). */\n label?: (value: string) => string;\n /** The values' order in the menu; values not named follow, most rows first. */\n order?: ReadonlyArray<string>;\n}\n\nexport type ColumnFilter<T> = ColumnValuesFilter<T>;\n\n/** The table's search and filters: what the person typed and, per column, the values kept. */\nexport interface TableFilterState {\n query: string;\n /** Column key → the values kept (a row passes when it has ANY of them; columns AND together). */\n values: Readonly<Record<string, ReadonlyArray<string>>>;\n}\n\nexport const EMPTY_TABLE_FILTER: TableFilterState = { query: \"\", values: {} };\n\n/** The parts of a column the filter reads (Column<T> carries them). */\nexport interface FilterableColumn<T> {\n key: string;\n header: React.ReactNode;\n title?: string;\n filter?: ColumnFilter<T>;\n /** The column joins the table's search: `true` reads the row's field named by `key`; a function\n * returns the words to match. */\n search?: boolean | ((row: T) => string | null | undefined);\n}\n\nfunction field<T>(row: T, key: string): unknown {\n return row !== null && typeof row === \"object\" ? (row as Record<string, unknown>)[key] : undefined;\n}\n\nfunction asText(v: unknown): string {\n if (v === null || v === undefined) return \"\";\n if (typeof v === \"string\") return v;\n if (typeof v === \"number\" || typeof v === \"boolean\") return String(v);\n return \"\";\n}\n\n/** The column's display name (its `title`, a plain-text header, else its key). */\nexport function columnName(column: Pick<FilterableColumn<never>, \"key\" | \"header\" | \"title\">): string {\n return column.title ?? (typeof column.header === \"string\" ? column.header : column.key);\n}\n\n/** The value(s) a row has in a values-filtered column. */\nexport function filterValues<T>(column: FilterableColumn<T>, row: T): string[] {\n const f = column.filter;\n if (!f) return [];\n const raw = f.value ? f.value(row) : asText(field(row, column.key));\n if (raw === null || raw === undefined) return [];\n return (typeof raw === \"string\" ? [raw] : [...raw]).filter((v) => v !== \"\");\n}\n\nfunction searchText<T>(column: FilterableColumn<T>, row: T): string {\n if (!column.search) return \"\";\n return (column.search === true ? asText(field(row, column.key)) : (column.search(row) ?? \"\")).toLowerCase();\n}\n\n/** True when the table has a search or any filterable column (it then draws its filter bar). */\nexport function tableFilters(columns: ReadonlyArray<FilterableColumn<never>>): boolean {\n return columns.some((c) => c.search || c.filter);\n}\n\nfunction passesQuery<T>(columns: ReadonlyArray<FilterableColumn<T>>, row: T, words: ReadonlyArray<string>): boolean {\n if (words.length === 0) return true;\n const texts = columns.filter((c) => c.search).map((c) => searchText(c, row));\n // Every word must be found, each in any searched column (Finder, Mail).\n return words.every((w) => texts.some((t) => t.includes(w)));\n}\n\nfunction passesValues<T>(columns: ReadonlyArray<FilterableColumn<T>>, row: T, state: TableFilterState, skip?: string): boolean {\n for (const column of columns) {\n if (!column.filter || column.key === skip) continue;\n const kept = state.values[column.key];\n if (!kept || kept.length === 0) continue;\n const has = filterValues(column, row);\n if (!has.some((v) => kept.includes(v))) return false;\n }\n return true;\n}\n\nfunction queryWords(query: string): string[] {\n return query.trim().toLowerCase().split(/\\s+/).filter(Boolean);\n}\n\n/** The rows that pass the search and every column's kept values (the page can filter the same way). */\nexport function filterRows<T>(columns: ReadonlyArray<FilterableColumn<T>>, rows: ReadonlyArray<T>, state: TableFilterState): T[] {\n const words = queryWords(state.query);\n return rows.filter((row) => passesQuery(columns, row, words) && passesValues(columns, row, state));\n}\n\nexport interface FilterChoice {\n value: string;\n label: string;\n /** Rows with this value among those the OTHER filters and the search keep (Finder's counts). */\n count: number;\n}\n\n/** A values column's choices, each with its count under every other filter and the search. */\nexport function filterChoices<T>(column: FilterableColumn<T>, rows: ReadonlyArray<T>, columns: ReadonlyArray<FilterableColumn<T>>, state: TableFilterState): FilterChoice[] {\n const f = column.filter;\n if (!f) return [];\n const words = queryWords(state.query);\n const counts = new Map<string, number>();\n // Every value any row has is listed (a value filtered to 0 still shows, so ticking is reversible).\n for (const row of rows) for (const v of filterValues(column, row)) if (!counts.has(v)) counts.set(v, 0);\n for (const row of rows) {\n if (!passesQuery(columns, row, words) || !passesValues(columns, row, state, column.key)) continue;\n for (const v of new Set(filterValues(column, row))) counts.set(v, (counts.get(v) ?? 0) + 1);\n }\n for (const v of state.values[column.key] ?? []) if (!counts.has(v)) counts.set(v, 0);\n const order = f.order ?? [];\n const keys = [...counts.keys()].sort((a, b) => {\n const ia = order.indexOf(a);\n const ib = order.indexOf(b);\n if (ia !== -1 || ib !== -1) return (ia === -1 ? Infinity : ia) - (ib === -1 ? Infinity : ib);\n return (counts.get(b) ?? 0) - (counts.get(a) ?? 0) || a.localeCompare(b);\n });\n return keys.map((value) => ({ value, label: f.label ? f.label(value) : value, count: counts.get(value) ?? 0 }));\n}\n\n/** True when the person searched or kept any value. */\nexport function filterActive(state: TableFilterState): boolean {\n return state.query.trim() !== \"\" || Object.values(state.values).some((v) => v.length > 0);\n}\n\nfunction setValues(state: TableFilterState, key: string, next: ReadonlyArray<string>): TableFilterState {\n const values = { ...state.values };\n if (next.length === 0) delete values[key];\n else values[key] = next;\n return { ...state, values };\n}\n\nexport interface TableFilterMenuProps<T> {\n columns: ReadonlyArray<FilterableColumn<T>>;\n rows: ReadonlyArray<T>;\n state: TableFilterState;\n onChange: (next: TableFilterState) => void;\n}\n\n/**\n * Mail's filter button: one menu, each filterable column a submenu of its values with their\n * counts, ticked to keep; \"Clear Filters\" at its foot. Lit while any filter is on.\n */\nexport function TableFilterMenu<T>({ columns, rows, state, onChange }: TableFilterMenuProps<T>) {\n const filterable = columns.filter((c) => c.filter);\n if (filterable.length === 0) return null;\n const on = filterable.filter((c) => (state.values[c.key]?.length ?? 0) > 0).length;\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <IconButton size=\"sm\" data-table-filter-menu data-filters-on={on} active={on > 0} label={on ? `Filter (${on} on)` : \"Filter\"} icon={<ListFilterIcon />} />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {filterable.length === 1 ? <DropdownMenuLabel>{`Filter by ${columnName(filterable[0] as FilterableColumn<never>)}`}</DropdownMenuLabel> : null}\n {filterable.map((column) => {\n const items = <FilterItems column={column} rows={rows} columns={columns} state={state} onChange={onChange} />;\n if (filterable.length === 1) return <React.Fragment key={column.key}>{items}</React.Fragment>;\n const kept = state.values[column.key]?.length ?? 0;\n return (\n <DropdownMenuSub key={column.key}>\n <DropdownMenuSubTrigger data-table-filter-column={column.key}>\n <span className=\"flex-1\">{columnName(column as FilterableColumn<never>)}</span>\n {kept ? <span className=\"ml-4 text-label-secondary tabular-nums\">{kept}</span> : null}\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent className=\"max-h-80 overflow-y-auto\">{items}</DropdownMenuSubContent>\n </DropdownMenuSub>\n );\n })}\n <DropdownMenuSeparator />\n <DropdownMenuItem data-table-filter-clear disabled={on === 0} onSelect={() => onChange({ ...state, values: {} })}>\n Clear Filters\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\nfunction FilterItems<T>({ column, rows, columns, state, onChange }: { column: FilterableColumn<T>; rows: ReadonlyArray<T>; columns: ReadonlyArray<FilterableColumn<T>>; state: TableFilterState; onChange: (next: TableFilterState) => void }) {\n const kept = state.values[column.key] ?? [];\n return (\n <>\n {filterChoices(column, rows, columns, state).map((choice) => (\n <DropdownMenuCheckboxItem\n key={choice.value}\n data-table-filter-value={choice.value}\n data-count={choice.count}\n checked={kept.includes(choice.value)}\n // The menu stays open so several values can be ticked (Finder's filter menus).\n onSelect={(event) => event.preventDefault()}\n onCheckedChange={(on) => onChange(setValues(state, column.key, on === true ? [...kept, choice.value] : kept.filter((v) => v !== choice.value)))}\n >\n <span className=\"flex-1 truncate\">{choice.label}</span>\n <span className=\"ml-6 text-label-secondary tabular-nums\">{choice.count}</span>\n </DropdownMenuCheckboxItem>\n ))}\n </>\n );\n}\n\n/** The tokens of the filters now on (Mail's filter tokens): one per column, its values, a ✕ removes it. */\nexport function TableFilterTokens<T>({ columns, state, onChange }: Omit<TableFilterMenuProps<T>, \"rows\">) {\n const on = columns.filter((c) => c.filter && (state.values[c.key]?.length ?? 0) > 0);\n return (\n <>\n {on.map((column) => {\n const name = columnName(column as FilterableColumn<never>);\n const labels = (state.values[column.key] ?? []).map((v) => (column.filter?.label ? column.filter.label(v) : v));\n return (\n <RemovableTag key={column.key} data-table-filter-token={column.key} className=\"shrink-0\" removeLabel={`Remove the ${name} filter`} onRemove={() => onChange(setValues(state, column.key, []))}>\n {`${name}: ${labels.join(\", \")}`}\n </RemovableTag>\n );\n })}\n </>\n );\n}\n\nexport interface TableFilterBarProps<T> extends TableFilterMenuProps<T> {\n /** Rows shown after filtering. */\n shown: number;\n /** What the rows are, for the search field's name (\"Search processes\"). */\n label: string;\n}\n\n/**\n * The table's own filter bar (Finder's search bar, Mail's filter tokens), drawn above its header\n * at one fixed height whether or not a filter is on, so the rows never move when one changes: the\n * active filters' tokens (or the row count) lead; the search field and the filter button trail.\n */\nexport function TableFilterBar<T>({ columns, rows, state, onChange, shown, label }: TableFilterBarProps<T>) {\n const searchable = columns.some((c) => c.search);\n const active = filterActive(state);\n return (\n <div data-slot=\"data-table-filter-bar\" className=\"flex h-table-filter-bar shrink-0 items-center gap-2 border-b border-separator px-3\">\n <div className=\"flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden\">\n <TableFilterTokens columns={columns} state={state} onChange={onChange} />\n <Text tone=\"secondary\" className=\"shrink-0 tabular-nums\" data-table-filter-count={shown}>\n {active ? `${shown} of ${rows.length}` : `${rows.length}`}\n </Text>\n </div>\n {searchable ? (\n <SearchField\n size=\"sm\"\n className=\"w-48 shrink\"\n data-table-search\n aria-label={`Search ${label}`}\n value={state.query}\n onValueChange={(query) => onChange({ ...state, query })}\n />\n ) : null}\n <TableFilterMenu columns={columns} rows={rows} state={state} onChange={onChange} />\n </div>\n );\n}\n\n/** The \"No Results\" body when the filters keep no row: what hid them, and the way back. */\nexport function noResultsMessage(state: TableFilterState): string {\n const q = state.query.trim();\n return q ? `No rows match “${q}”${Object.keys(state.values).length ? \" with these filters\" : \"\"}.` : \"No rows match these filters.\";\n}\n\nexport function ClearFiltersButton({ onClear, className }: { onClear: () => void; className?: string }) {\n return (\n <Button size=\"sm\" data-table-filter-reset className={cn(className)} onClick={onClear}>\n Clear Search and Filters\n </Button>\n );\n}\n","import * as React from \"react\";\n\nimport { ChevronRightIcon } from \"../icons\";\nimport { useScrollFade } from \"../use-scroll-fade\";\nimport { cn } from \"./cn\";\nimport { Text } from \"./text\";\n\n/**\n * The source list (Finder / Mail / Notes sidebar, macOS 26). Sections of 32 pt rows; the open row is\n * a soft translucent gray capsule with its icon and label in the accent while the window is key, the\n * same gray with the plain label when it is not (`[data-window-active=false]` on any ancestor;\n * desktop.css). Up/Down arrow keys move between rows; Home/End jump to the ends.\n */\nexport interface SourceListProps extends React.HTMLAttributes<HTMLElement> {\n /** The app's own accent for the open row, where it has one (Notes' yellow, Reminders' list\n * color); default the person's accent. */\n tint?: \"red\" | \"orange\" | \"yellow\" | \"green\" | \"blue\" | \"purple\";\n /** How the open row is drawn: `sidebar` (default), the window sidebar's gray capsule with the\n * accent label (Finder, Mail); `emphasized`, the solid accent with a white label while the window\n * is key, as a list inside the content selects (Console's Devices, System Information's\n * categories). */\n selection?: \"sidebar\" | \"emphasized\";\n}\n\n/**\n * Sections follow one another with no gap (Finder: a header row is the only space between groups).\n * A list taller than its column scrolls under a soft edge (macOS 26's scroll edge effect) with the\n * overlay scroller hidden, never a permanent scroll bar or a hard-cut row.\n */\nexport function SourceList({ className, onKeyDown, tint, selection = \"sidebar\", ...props }: SourceListProps) {\n const fade = useScrollFade();\n return (\n <nav\n ref={fade.ref}\n data-slot=\"source-list\"\n data-tint={tint}\n data-selection={selection === \"emphasized\" ? \"emphasized\" : undefined}\n data-fade-top={fade.fadeProps[\"data-fade-top\"]}\n data-fade-bottom={fade.fadeProps[\"data-fade-bottom\"]}\n className={cn(\"flex min-h-0 flex-col 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 // Finder's section header (NSOutlineView .sourceList): 11 pt semibold, secondary, sitting\n // on the rows below it.\n <div data-slot=\"source-list-header\" className=\"flex h-sidebar-row items-end gap-2 px-2 pb-1\">\n <Text id={id} variant=\"subheadline\" tone=\"secondary\" 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 /** Not built yet: full-strength label, no hint, a trailing \"Soon\" at full strength (it opens its Coming soon\n * page). Never dimmed: dimmed means disabled, and this row is clickable. */\n soon?: boolean;\n /** An outline row (System Information's \"Hardware\" over its categories): its depth, each level\n * indented one step. */\n level?: number;\n /** This row has rows under it: the disclosure triangle shows whether they are shown; clicking the\n * triangle, or Right and Left on the row, opens and closes them. */\n disclosure?: { open: boolean; onToggle: (open: boolean) => void };\n}\n\nexport const SourceListItem = React.forwardRef<HTMLButtonElement, SourceListItemProps>(function SourceListItem(\n { icon, label, hint, badge, current, soon, level = 0, disclosure, className, onKeyDown, style, type = \"button\", ...props },\n ref,\n) {\n const outline = level > 0 || disclosure !== undefined;\n // The open row is always in view, as Finder, Mail and System Settings keep their selection: a\n // row that becomes current (a link, ⌘1–9, the back button, the first paint of a late row) scrolls\n // its list only as far as it needs to show it (\"nearest\"), never jumping a row already in view.\n const own = React.useRef<HTMLButtonElement | null>(null);\n const setRef = React.useCallback(\n (node: HTMLButtonElement | null) => {\n own.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n },\n [ref],\n );\n React.useEffect(() => {\n if (current) own.current?.scrollIntoView?.({ block: \"nearest\", inline: \"nearest\" });\n }, [current]);\n return (\n <button\n ref={setRef}\n type={type}\n data-slot=\"source-list-item\"\n data-current={current || undefined}\n data-soon={soon || undefined}\n data-two-line={hint && !soon ? \"\" : undefined}\n data-level={outline ? level : undefined}\n aria-current={current ? \"page\" : undefined}\n aria-expanded={disclosure ? disclosure.open : undefined}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || !disclosure) return;\n if (event.key === \"ArrowRight\" && !disclosure.open) {\n event.preventDefault();\n disclosure.onToggle(true);\n } else if (event.key === \"ArrowLeft\" && disclosure.open) {\n event.preventDefault();\n disclosure.onToggle(false);\n }\n }}\n // Each outline level is one 16 pt step in (the triangle's width), as NSOutlineView indents.\n style={outline ? { paddingInlineStart: 4 + level * 16, ...style } : style}\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 // One row height per list: desktop.css lifts every row of a list holding a two-line row\n // to the two-line height, so no list mixes heights.\n hint && !soon ? \"h-sidebar-row-tall\" : \"h-sidebar-row\",\n // The gray capsule (desktop.css draws it, with the accent label in the key window).\n current && \"bg-selection-muted hover:bg-selection-muted\",\n className,\n )}\n {...props}\n >\n {outline ? (\n <span\n aria-hidden\n data-slot=\"source-list-disclosure\"\n data-open={disclosure ? disclosure.open : undefined}\n className=\"flex size-icon shrink-0 items-center justify-center text-label-secondary\"\n onClick={\n disclosure\n ? (event) => {\n event.stopPropagation();\n disclosure.onToggle(!disclosure.open);\n }\n : undefined\n }\n >\n {disclosure ? <ChevronRightIcon className={cn(\"size-icon-sm transition-transform duration-100\", disclosure.open && \"rotate-90\")} /> : null}\n </span>\n ) : null}\n {icon ? (\n <span data-slot=\"source-list-icon\" 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 && !soon ? <span className=\"truncate text-body text-label-secondary\">{hint}</span> : null}\n </span>\n {badge ? (\n // Room for three digits, right-aligned: a count gaining a digit grows leftward inside a box that stays put.\n <span data-slot=\"source-list-badge\" className=\"flex min-w-count shrink-0 items-center justify-end text-body tabular-nums text-label-secondary\">\n {badge}\n </span>\n ) : soon ? (\n // Unbuilt is not disabled: the row reads at full strength (it opens its Coming soon page)\n // and says \"Soon\" at the end, at full strength too, at the row's own 13 pt (content is never\n // under 13 pt). Only a disabled row is dimmed.\n <span aria-hidden data-slot=\"source-list-soon\" className=\"shrink-0 text-body text-label\">\n Soon\n </span>\n ) : 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-body text-tint hover:text-label\", className)}\n >\n {expanded ? \"Show less\" : \"Show more\"}\n </button>\n );\n}\n","import * as React from \"react\";\n\nimport { ContextMenu, ContextMenuContent, ContextMenuTrigger } from \"../context-menu\";\nimport { cn } from \"./cn\";\nimport { ConfirmDialog } from \"./sheet\";\nimport { ContextMenuEntries, type RowMenuItem } from \"./menu-entries\";\n\n/**\n * The message list (Mail's message list, Messages' conversation list, Voice Memos' recordings,\n * Notes' note list): a column of two- or three-line rows — a bold title with the date trailing on\n * the first line, a second line, an optional secondary third — separated by inset hairlines, with\n * Mail's leading slot (the unread dot, an avatar, a Reminders circle). `appearance=\"messages\"` is\n * Messages' macOS 26 conversation list: 40 pt avatars, no lines, a softer rounded highlight.\n *\n * Selection is AppKit's: a click selects one row, ⌘-click adds or removes one, ⇧-click selects a\n * range, Up/Down move it. The selected rows wear the accent with white text while the list has\n * focus in the key window, the unemphasised gray otherwise — a rounded inset highlight, as Mail and\n * Notes draw it. A row's actions live in its context menu (right-click) and in the window's\n * toolbar for the selection, never as buttons inside the row.\n */\nexport interface MessageListProps<T> extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\" | \"aria-label\" | \"title\"> {\n \"aria-label\": string;\n rows: ReadonlyArray<T>;\n rowKey: (row: T) => string;\n /** Line one, bold (the sender, the chat, the recording). */\n title: (row: T) => React.ReactNode;\n /** Trailing on line one, secondary (a date, a time, a countdown). */\n date?: (row: T) => React.ReactNode;\n /** Line two (the subject; a project and app). */\n subtitle?: (row: T) => React.ReactNode;\n /** Line three, secondary (a preview, a path). */\n detail?: (row: T) => React.ReactNode;\n /** The leading slot: Mail's unread dot, Messages' avatar, a Reminders circle. Its width is kept on\n * every row whether or not a row draws one, so titles line up. */\n leading?: (row: T) => React.ReactNode;\n /** The leading slot's width: `dot` (16 pt, Mail's unread dot), `icon` (32 pt: Passwords' site\n * icons, Shortcuts' list view tiles) or `avatar` (40 pt: Messages' conversation avatars, an\n * `Avatar size=\"md\"`). */\n leadingSize?: \"dot\" | \"icon\" | \"avatar\";\n /** `mail` (the default): Mail's rows, inset hairlines between them and the 7 pt control-radius\n * highlight. `messages`: Messages' conversation list on macOS 26, no lines between rows, a\n * softer 12 pt-radius highlight and the second line in the secondary color (the preview). */\n appearance?: \"mail\" | \"messages\";\n /** Trailing glyphs on line two (a star, a flag, a count). */\n accessories?: (row: T) => React.ReactNode;\n /** The selected row keys. */\n selected: ReadonlySet<string>;\n /** The new selection; `focus` is the row the person acted on last (the one a viewer shows). */\n onSelectionChange: (next: Set<string>, focus: string | null) => void;\n /** One row only (Messages, Voice Memos): ⌘-click and ⇧-click select just that row. */\n single?: boolean;\n /** Double-click or Return on a row (Mail opens the message in its own window). */\n onOpen?: (row: T) => void;\n /** Right-click menu for a row (destructive items with `confirm` ask first). */\n rowMenu?: (row: T) => ReadonlyArray<RowMenuItem> | null;\n /** `data-*` hooks on each row (tests, deep links). */\n rowData?: (row: T) => Record<string, string | undefined>;\n /** Shown instead of rows when there are none. */\n empty?: React.ReactNode;\n /** Under the last row (a loading row while the next page comes in). */\n footer?: React.ReactNode;\n /** The list scrolled to its end: load the next page (Mail's and Messages' endless list; the web's\n * conversation list loads the same way). Pass it only while there IS more; rows are never dropped.\n * Fired when the end comes into view, and again after each page while the end is still in view. */\n onEndReached?: (() => void) | undefined;\n /** The window's first responder when the list first shows rows (AppKit's initialFirstResponder:\n * Passwords' and Mail's list has the keyboard when the window opens), so its selection wears the\n * accent. Never taken from a field being typed in. */\n initialFocus?: boolean;\n}\n\nconst ROW_SELECTOR = '[data-slot=\"message-list-row\"]';\n/** Controls that take typing: the list never takes the keyboard from one. */\nconst TEXT_ENTRY = 'input:not([type=\"button\"]):not([type=\"checkbox\"]):not([type=\"radio\"]), textarea, select, [contenteditable=\"true\"], [role=\"textbox\"], [role=\"combobox\"]';\n\nexport function MessageList<T>({\n rows,\n rowKey,\n title,\n date,\n subtitle,\n detail,\n leading,\n leadingSize = \"dot\",\n appearance = \"mail\",\n accessories,\n selected,\n onSelectionChange,\n single,\n onOpen,\n rowMenu,\n rowData,\n empty,\n footer,\n onEndReached,\n initialFocus,\n className,\n onKeyDown,\n onContextMenu,\n onPointerDown,\n ...props\n}: MessageListProps<T>) {\n const anchor = React.useRef<string | null>(null);\n const listRef = React.useRef<HTMLDivElement | null>(null);\n const focusedOnce = React.useRef(false);\n // Radix asks whether it may open synchronously. Keep the target in a ref so a first right-click\n // and a touch long-press both have their row before React has rendered the menu items.\n const menuRowRef = React.useRef<T | null>(null);\n const [menuRow, setMenuRow] = React.useState<T | null>(null);\n const [menuOpen, setMenuOpen] = React.useState(false);\n const [asking, setAsking] = React.useState<RowMenuItem | null>(null);\n const keys = React.useMemo(() => rows.map(rowKey), [rows, rowKey]);\n\n const select = (key: string, event: { metaKey: boolean; ctrlKey: boolean; shiftKey: boolean }) => {\n if (!single && (event.metaKey || event.ctrlKey)) {\n const next = new Set(selected);\n if (next.has(key)) next.delete(key);\n else next.add(key);\n anchor.current = key;\n onSelectionChange(next, next.has(key) ? key : null);\n return;\n }\n if (!single && event.shiftKey && anchor.current && keys.includes(anchor.current)) {\n const a = keys.indexOf(anchor.current);\n const b = keys.indexOf(key);\n onSelectionChange(new Set(keys.slice(Math.min(a, b), Math.max(a, b) + 1)), key);\n return;\n }\n anchor.current = key;\n onSelectionChange(new Set([key]), key);\n };\n\n const focusRow = (list: HTMLElement, key: string) => {\n const el = Array.from(list.querySelectorAll<HTMLElement>(ROW_SELECTOR)).find((r) => r.dataset[\"rowKey\"] === key);\n el?.focus();\n el?.scrollIntoView?.({ block: \"nearest\" });\n };\n\n // The first responder once, when there is a row to hold it: the selected row, else the first.\n React.useEffect(() => {\n if (!initialFocus || focusedOnce.current || keys.length === 0 || !listRef.current) return;\n focusedOnce.current = true;\n // A field being typed in keeps the keyboard; anything else (the row or rail button that\n // opened this page, a container) hands it to the list, as AppKit's window does on open.\n const active = document.activeElement;\n if (active instanceof HTMLElement && active.matches(TEXT_ENTRY)) return;\n const key = keys.find((k) => selected.has(k)) ?? (keys[0] as string);\n Array.from(listRef.current.querySelectorAll<HTMLElement>(ROW_SELECTOR))\n .find((r) => r.dataset[\"rowKey\"] === key)\n ?.focus({ preventScroll: true });\n }, [initialFocus, keys, selected]);\n\n const menu = menuRow ? (rowMenu?.(menuRow) ?? null) : null;\n const hasMenu = Boolean(menu?.length);\n const setMenuTarget = (row: T, key: string) => {\n menuRowRef.current = row;\n setMenuRow(row);\n // Right-clicking or long-pressing an unselected row selects it first (Mail, Finder).\n if (!selected.has(key)) select(key, { metaKey: false, ctrlKey: false, shiftKey: false });\n };\n const clearMenuTarget = () => {\n menuRowRef.current = null;\n setMenuRow(null);\n setMenuOpen(false);\n };\n const isRowTarget = (target: EventTarget | null) => target instanceof Element && target.closest(ROW_SELECTOR) !== null;\n const onMenuOpenChange = (open: boolean) => {\n const target = menuRowRef.current;\n const targetMenu = target ? (rowMenu?.(target) ?? null) : null;\n if (open && targetMenu?.length) {\n setMenuRow(target);\n setMenuOpen(true);\n return;\n }\n clearMenuTarget();\n };\n\n const list = (\n <div\n ref={listRef}\n role=\"listbox\"\n aria-multiselectable={!single || undefined}\n data-slot=\"message-list\"\n data-appearance={appearance}\n className={cn(\"flex flex-col px-2 py-1 outline-none\", className)}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || keys.length === 0) return;\n const current = (document.activeElement as HTMLElement | null)?.dataset?.[\"rowKey\"] ?? [...selected].pop() ?? null;\n const at = current ? keys.indexOf(current) : -1;\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\" || event.key === \"Home\" || event.key === \"End\") {\n event.preventDefault();\n const next =\n event.key === \"Home\" ? 0 : event.key === \"End\" ? keys.length - 1 : Math.max(0, Math.min(keys.length - 1, at + (event.key === \"ArrowDown\" ? 1 : -1)));\n const key = keys[next] as string;\n select(key, { metaKey: false, ctrlKey: false, shiftKey: event.shiftKey });\n focusRow(event.currentTarget, key);\n } else if (event.key === \"Enter\" && onOpen && at >= 0) {\n event.preventDefault();\n onOpen(rows[at] as T);\n }\n }}\n onContextMenu={(event) => {\n onContextMenu?.(event);\n // A keyboard context-menu key can target the list itself. Never reuse a previous row then.\n if (!isRowTarget(event.target)) clearMenuTarget();\n }}\n onPointerDown={(event) => {\n onPointerDown?.(event);\n if (!isRowTarget(event.target)) clearMenuTarget();\n }}\n {...props}\n >\n {rows.length === 0 ? (\n <div data-slot=\"message-list-empty\">{empty}</div>\n ) : (\n rows.map((row, i) => {\n const key = keys[i] as string;\n const isSelected = selected.has(key);\n const nextSelected = i + 1 < keys.length && selected.has(keys[i + 1] as string);\n const prevSelected = i > 0 && selected.has(keys[i - 1] as string);\n const lead = leading?.(row);\n const when = date?.(row);\n const line2 = subtitle?.(row);\n const line3 = detail?.(row);\n const glyphs = accessories?.(row);\n return (\n <div\n key={key}\n role=\"option\"\n aria-selected={isSelected}\n tabIndex={isSelected || (selected.size === 0 && i === 0) ? 0 : -1}\n data-slot=\"message-list-row\"\n data-row-key={key}\n data-selected={isSelected || undefined}\n {...(rowData?.(row) ?? {})}\n onMouseDown={(event) => {\n // ⇧-click must not select text across rows.\n if (event.shiftKey) event.preventDefault();\n }}\n onPointerDown={(event) => {\n // Radix opens a touch/pen menu from its long-press timer, before a contextmenu event.\n // It also reaches here before its trigger for a mouse's secondary button.\n if (event.pointerType === \"touch\" || event.pointerType === \"pen\" || event.button === 2) setMenuTarget(row, key);\n }}\n onClick={(event) => select(key, event)}\n onDoubleClick={() => onOpen?.(row)}\n onContextMenu={() => {\n setMenuTarget(row, key);\n }}\n className={cn(\n \"group/message focus-ring relative flex cursor-default gap-1.5 py-2 pl-1 pr-3 text-body text-label\",\n appearance === \"messages\" ? \"rounded-group\" : \"rounded-control\",\n leadingSize !== \"dot\" && \"gap-2.5 pl-2\",\n // The highlight: the unemphasised gray; the accent while the list has focus in the key window.\n isSelected && \"bg-selection-muted\",\n // Adjacent selected rows are one continuous highlight (Mail): square where they meet.\n isSelected && prevSelected && \"rounded-t-none\",\n isSelected && nextSelected && \"rounded-b-none\",\n isSelected &&\n \"[[data-window-active=true]_[data-slot=message-list]:focus-within_&]:bg-selection [[data-window-active=true]_[data-slot=message-list]:focus-within_&]:text-selection-label [:root_[data-slot=message-list]:not([data-window-active]_*):focus-within_&]:bg-selection [:root_[data-slot=message-list]:not([data-window-active]_*):focus-within_&]:text-selection-label\",\n // Everything in a highlighted row reads in the selection's label color (a tone, a secondary line).\n isSelected &&\n \"[[data-window-active=true]_[data-slot=message-list]:focus-within_&]:**:text-inherit [:root_[data-slot=message-list]:not([data-window-active]_*):focus-within_&]:**:text-inherit\",\n )}\n >\n {/* The leading slot keeps its width on every row (Mail's unread-dot gutter). */}\n <span data-slot=\"message-list-leading\" className={cn(\"flex shrink-0 justify-center\", leadingSize === \"avatar\" ? \"w-10 self-center\" : leadingSize === \"icon\" ? \"w-8 self-center\" : \"w-4 pt-1\")}>\n {lead}\n </span>\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"flex min-w-0 items-baseline gap-2\">\n <span data-slot=\"message-list-title\" className=\"min-w-0 flex-1 truncate text-headline\">\n {title(row)}\n </span>\n {when !== undefined && when !== null ? (\n <span data-slot=\"message-list-date\" className={cn(\"shrink-0 tabular-nums\", isSelected ? \"text-inherit opacity-80\" : \"text-label-secondary\")}>\n {when}\n </span>\n ) : null}\n </span>\n {line2 !== undefined && line2 !== null ? (\n <span className=\"flex min-w-0 items-center gap-2\">\n <span data-slot=\"message-list-subtitle\" className={cn(\"flex min-w-0 flex-1 items-center gap-1.5 truncate\", appearance === \"messages\" && !isSelected && \"text-label-secondary\")}>\n {/* A flex box does not draw an ellipsis for its own text (the text is an\n anonymous flex item): plain words get their own truncating span, so a long\n line ends in \"…\" instead of being cut mid-letter at the column's edge. */}\n {typeof line2 === \"string\" || typeof line2 === \"number\" ? <span className=\"min-w-0 truncate\">{line2}</span> : line2}\n </span>\n {glyphs ? <span className=\"flex shrink-0 items-center gap-1 text-label-secondary [&_svg]:size-icon-sm\">{glyphs}</span> : null}\n </span>\n ) : null}\n {line3 !== undefined && line3 !== null ? (\n <span data-slot=\"message-list-detail\" className={cn(\"line-clamp-2 min-w-0\", isSelected ? \"opacity-80\" : \"text-label-secondary\")}>\n {line3}\n </span>\n ) : null}\n </span>\n {/* Mail's separator: a hairline inset to the text, hidden around a highlighted row.\n Messages draws none: its rows are told apart by their avatars and spacing. */}\n {appearance === \"mail\" && i + 1 < rows.length && !isSelected && !nextSelected ? (\n <span data-slot=\"message-list-separator\" aria-hidden className={cn(\"pointer-events-none absolute bottom-0 right-1 h-px bg-separator\", leadingSize === \"avatar\" ? \"left-14\" : leadingSize === \"icon\" ? \"left-11\" : \"left-6\")} />\n ) : null}\n </div>\n );\n })\n )}\n {onEndReached && rows.length > 0 ? <EndOfList key={rows.length} onEndReached={onEndReached} /> : null}\n {footer}\n </div>\n );\n\n return (\n <>\n {rowMenu ? (\n <ContextMenu open={menuOpen && hasMenu} onOpenChange={onMenuOpenChange}>\n <ContextMenuTrigger asChild>{list}</ContextMenuTrigger>\n <ContextMenuContent data-slot=\"message-list-menu\">\n {menu ? <ContextMenuEntries items={menu} onAsk={setAsking} /> : null}\n </ContextMenuContent>\n </ContextMenu>\n ) : (\n list\n )}\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 </>\n );\n}\n\n/** Mail's unread dot: the accent, 8 pt, in a row's leading slot. */\nexport function UnreadDot({ label = \"Unread\", className, ...props }: React.HTMLAttributes<HTMLSpanElement> & { label?: string }) {\n return <span role=\"img\" aria-label={label} data-slot=\"unread-dot\" className={cn(\"mt-px size-2 shrink-0 rounded-full bg-tint [[data-window-active=true]_[data-slot=message-list]:focus-within_[data-selected]_&]:bg-selection-label\", className)} {...props} />;\n}\n\n/** The list's end: in view (the person scrolled there, or a short page fills less than the column)\n * asks for the next page. Keyed by the row count, so each new page looks again. */\nfunction EndOfList({ onEndReached }: { onEndReached: () => void }) {\n const ref = React.useRef<HTMLDivElement | null>(null);\n const latest = React.useRef(onEndReached);\n latest.current = onEndReached;\n React.useEffect(() => {\n const el = ref.current;\n if (!el || typeof IntersectionObserver === \"undefined\") return;\n let asked = false;\n const io = new IntersectionObserver(\n (entries) => {\n if (asked || !entries.some((e) => e.isIntersecting)) return;\n asked = true;\n latest.current();\n },\n { rootMargin: \"0px 0px 240px 0px\" },\n );\n io.observe(el);\n return () => io.disconnect();\n }, []);\n return <div ref={ref} data-slot=\"message-list-end\" aria-hidden className=\"h-px\" />;\n}\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { Notices } from \"./layout\";\n\nexport interface SplitViewProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The page header (a title-less PageHeader moves into the window's unified toolbar). */\n header?: React.ReactNode;\n /** Banners, in the frame's foot bar (the same rule as Page: nothing moves when one appears). */\n notices?: React.ReactNode;\n /** An optional leading column (Notes' folders, Mail's mailboxes when the window sidebar is not them). */\n source?: React.ReactNode;\n /** The list column (a MessageList): Mail's message list, Messages' conversations, Voice Memos' recordings. */\n list: React.ReactNode;\n /** Pinned at the top of the list column, above its scrolling rows (a search field, a filter bar). */\n listHeader?: React.ReactNode;\n /** Pinned at the foot of the list column (Voice Memos' record button, a count). */\n listFooter?: React.ReactNode;\n /** The viewer (the open message, conversation or recording). It scrolls itself unless `detailScrolls`\n * is false. Absent: the list takes the rest of the width (Mail with its viewer hidden). */\n detail?: React.ReactNode;\n /** The list column's width: `md` 280 (Messages, Voice Memos), `lg` 340 (Mail). In a narrow\n * window the source column (to 160) and the list (to 224) yield first, so the viewer keeps 320\n * and a title in it wraps at most once. */\n listWidth?: \"md\" | \"lg\";\n /** False when the viewer manages its own scrolling (a transcript pinned over a composer). */\n detailScrolls?: boolean;\n /**\n * The one column that stays when the body is too narrow for its columns side by side (a window\n * made small, or an inspector beside it): `detail` while something is open in the viewer, `list`\n * otherwise — NavigationSplitView's collapsed stack; the window's Back returns to the list. The\n * other columns hide (never clipped off the edge). Absent: the columns only shrink to their minimums.\n */\n narrow?: \"list\" | \"detail\";\n}\n\nconst LIST_WIDTH = { md: \"w-70\", lg: \"w-85\" } as const;\n\n/**\n * Mail's, Messages' and Notes' window body: columns side by side under the unified toolbar, each\n * scrolling on its own, divided by hairlines — an optional source column, the list, and the viewer.\n * The columns fill the window's height; nothing scrolls the frame itself.\n */\nexport function SplitView({ header, notices, source, list, listHeader, listFooter, detail, listWidth = \"lg\", detailScrolls = true, narrow, className, ...props }: SplitViewProps) {\n return (\n <div data-slot=\"split-view\" className={cn(\"flex h-full min-h-0 flex-col bg-content\", className)} {...props}>\n {header ? <div className=\"shrink-0 px-5 empty:hidden\">{header}</div> : null}\n <div data-slot=\"split-columns\" data-narrow={detail !== undefined ? narrow : undefined} data-has-source={source ? \"\" : undefined} className=\"flex min-h-0 flex-1\">\n {source ? (\n <div data-slot=\"split-view-source\" className=\"flex w-52 min-w-40 shrink flex-col overflow-y-auto border-r border-separator py-2\">\n {source}\n </div>\n ) : null}\n <div data-slot=\"split-view-list\" className={cn(\"flex flex-col\", detail === undefined ? \"min-w-0 flex-1\" : cn(\"min-w-56 shrink border-r border-separator\", LIST_WIDTH[listWidth]))}>\n {listHeader ? <div className=\"flex shrink-0 flex-col gap-2 px-3 pb-2 pt-1\">{listHeader}</div> : null}\n <div className=\"min-h-0 flex-1 overflow-y-auto\">{list}</div>\n {listFooter ? <div className=\"flex shrink-0 items-center justify-center border-t border-separator px-3 py-3\">{listFooter}</div> : null}\n </div>\n {detail !== undefined ? (\n <div data-slot=\"split-view-detail\" className={cn(\"flex min-w-80 flex-1 flex-col\", detailScrolls ? \"overflow-y-auto\" : \"min-h-0\")}>\n {detail}\n </div>\n ) : null}\n </div>\n <Notices data-page-notices=\"\" className=\"border-t border-separator px-5 py-3\">\n {notices}\n </Notices>\n </div>\n );\n}\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport interface ResizablePaneProps extends React.HTMLAttributes<HTMLDivElement> {\n [data: `data-${string}`]: string | undefined;\n /** The pane's height (px) before the person drags it, and what a double-click on the divider restores (when not `collapsible`). */\n defaultSize: number;\n /** The least the pane may be (px) while open. */\n minSize?: number;\n /** The least the content above keeps (px): the pane never grows past its window less this (except `maximized`). */\n reserve?: number;\n /** Remembers the person's height, and whether the pane is collapsed or maximized, under this name (NSSplitView's autosaveName), per computer. */\n autosaveName?: string;\n /** The divider's accessible name (\"Resize the log\"). */\n dividerLabel: string;\n /**\n * NSSplitView's collapsible subview: dragging the divider past half of `minSize` snaps the pane\n * shut (height 0, the divider stays as a hairline to drag it back), and a double-click or Enter\n * on the divider toggles collapsed and open at the last height.\n */\n collapsible?: boolean;\n /** Controlled collapsed state (a toolbar button or View-menu item drives it). Omit to let the pane keep its own. */\n collapsed?: boolean;\n /** Collapsed state on first open when uncontrolled and nothing is saved. */\n defaultCollapsed?: boolean;\n /** Called whenever the person (or a gesture) collapses or opens the pane. */\n onCollapsedChange?: (collapsed: boolean) => void;\n /**\n * Controlled: the content above collapses and this pane fills the split (\"focus on one pane\").\n * Turning it off returns both panes to their sizes. Omit to let the pane keep its own.\n */\n maximized?: boolean;\n /** Called when the pane leaves (or enters) the maximized state: dragging the divider or Enter/double-click leaves it. */\n onMaximizedChange?: (maximized: boolean) => void;\n children: React.ReactNode;\n}\n\ntype PaneState = \"open\" | \"collapsed\" | \"maximized\";\n\nconst STEP = 16;\nconst key = (name: string) => `mx-split:${name}`;\nconst stateKey = (name: string) => `mx-split:${name}:state`;\n\nfunction saved(name: string | undefined): number | null {\n if (!name) return null;\n try {\n const raw = globalThis.localStorage?.getItem(key(name));\n const n = raw === null || raw === undefined ? Number.NaN : Number(raw);\n return Number.isFinite(n) && n > 0 ? n : null;\n } catch {\n return null;\n }\n}\n\nfunction save(name: string | undefined, size: number): void {\n if (!name) return;\n try {\n globalThis.localStorage?.setItem(key(name), String(Math.round(size)));\n } catch {\n // A window that cannot store keeps the height for this visit only.\n }\n}\n\nfunction savedState(name: string | undefined): PaneState | null {\n if (!name) return null;\n try {\n const raw = globalThis.localStorage?.getItem(stateKey(name));\n return raw === \"collapsed\" || raw === \"maximized\" || raw === \"open\" ? raw : null;\n } catch {\n return null;\n }\n}\n\nfunction saveState(name: string | undefined, state: PaneState): void {\n if (!name) return;\n try {\n globalThis.localStorage?.setItem(stateKey(name), state);\n } catch {\n // As above: kept for this visit only.\n }\n}\n\n/**\n * NSSplitView's lower pane (Console's message detail, Xcode's debug area, Local servers' log): a\n * pane under the window's content whose top edge is a divider the person drags. It keeps its\n * height between visits (`autosaveName`), never squeezes the content above below `reserve`,\n * a double-click on the divider restores `defaultSize`, and the divider takes the keyboard\n * (↑/↓ by 16 px, Home for the most, End for the least). `collapsible` lets it snap shut and open\n * again (drag, double-click, Enter); `collapsed` and `maximized` let a toolbar button or a\n * View-menu item hide it or make it fill the split, and bring it back.\n */\nexport function ResizablePane({\n defaultSize,\n minSize = 120,\n reserve = 160,\n autosaveName,\n dividerLabel,\n collapsible = false,\n collapsed: collapsedProp,\n defaultCollapsed = false,\n onCollapsedChange,\n maximized: maximizedProp,\n onMaximizedChange,\n className,\n children,\n ...props\n}: ResizablePaneProps) {\n const ref = React.useRef<HTMLDivElement>(null);\n const [size, setSize] = React.useState(() => saved(autosaveName) ?? defaultSize);\n const [ownState, setOwnState] = React.useState<PaneState>(() => savedState(autosaveName) ?? (defaultCollapsed ? \"collapsed\" : \"open\"));\n const [room, setRoom] = React.useState<number | null>(null);\n\n const collapsed = collapsedProp ?? ownState === \"collapsed\";\n const maximized = !collapsed && (maximizedProp ?? ownState === \"maximized\");\n const state: PaneState = collapsed ? \"collapsed\" : maximized ? \"maximized\" : \"open\";\n\n // Always the latest state and callbacks, so a drag's listeners never act on a stale render.\n const live = React.useRef({ state, onCollapsedChange, onMaximizedChange });\n live.current = { state, onCollapsedChange, onMaximizedChange };\n\n const setState = React.useCallback((next: PaneState) => {\n const { state: was, onCollapsedChange: oc, onMaximizedChange: om } = live.current;\n if (next === was) return;\n live.current = { ...live.current, state: next };\n setOwnState(next);\n if ((was === \"collapsed\") !== (next === \"collapsed\")) oc?.(next === \"collapsed\");\n if ((was === \"maximized\") !== (next === \"maximized\")) om?.(next === \"maximized\");\n }, []);\n\n // Whichever drives it (the person, a toolbar button, a menu item), the state is remembered.\n React.useEffect(() => saveState(autosaveName, state), [autosaveName, state]);\n\n // How tall the window's content is, so the pane never covers all of it.\n React.useLayoutEffect(() => {\n const el = ref.current;\n const frame = el?.closest<HTMLElement>('[data-slot=\"page-frame\"], [data-slot=\"split-view\"]') ?? el?.parentElement ?? null;\n if (!frame) return;\n const measure = () => setRoom(frame.clientHeight || null);\n measure();\n if (typeof ResizeObserver === \"undefined\") return;\n const ro = new ResizeObserver(measure);\n ro.observe(frame);\n return () => ro.disconnect();\n }, []);\n\n const most = room === null ? Number.POSITIVE_INFINITY : Math.max(minSize, room - reserve);\n const clamp = (n: number) => Math.min(most, Math.max(minSize, n));\n const open = clamp(size);\n const height = state === \"collapsed\" ? 0 : state === \"maximized\" ? room : open;\n const shown = height ?? open;\n const commit = (n: number) => {\n const next = clamp(n);\n setSize(next);\n save(autosaveName, next);\n };\n // Collapsed or open at the last height; leaving maximized returns to the last height too.\n const toggle = () => setState(state === \"open\" ? \"collapsed\" : \"open\");\n\n const drag = (event: React.PointerEvent<HTMLDivElement>) => {\n if (event.button !== 0) return;\n event.preventDefault();\n const divider = event.currentTarget;\n divider.setPointerCapture?.(event.pointerId);\n const startY = event.clientY;\n const start = shown;\n const restore = open;\n let last = open;\n let moved = false;\n const move = (e: PointerEvent) => {\n const raw = start - (e.clientY - startY);\n if (!moved && raw === start) return;\n moved = true;\n if (collapsible && raw < minSize / 2) {\n setState(\"collapsed\");\n last = restore;\n setSize(restore);\n return;\n }\n if (live.current.state !== \"open\") setState(\"open\");\n last = clamp(raw);\n setSize(last);\n };\n const up = () => {\n divider.removeEventListener(\"pointermove\", move);\n divider.removeEventListener(\"pointerup\", up);\n divider.removeEventListener(\"pointercancel\", up);\n if (moved) save(autosaveName, last);\n };\n divider.addEventListener(\"pointermove\", move);\n divider.addEventListener(\"pointerup\", up);\n divider.addEventListener(\"pointercancel\", up);\n };\n\n return (\n <div\n ref={ref}\n data-slot=\"resizable-pane\"\n data-size={Math.round(shown)}\n data-state={state}\n className={cn(\"relative flex min-h-0 shrink-0 flex-col\", state === \"collapsed\" && \"overflow-hidden\", className)}\n style={{ height: height ?? (state === \"maximized\" ? \"100%\" : open) }}\n {...props}\n >\n {/* `contents` keeps the children the pane's own flex items; `inert` takes a collapsed pane out of focus and reading order without unmounting it. */}\n <div className=\"contents\" inert={state === \"collapsed\"}>\n {children}\n </div>\n {/* The divider: the pane's top hairline, with a few points either side to grab (AppKit's thin divider). Collapsed, it draws the hairline itself. */}\n <div\n role=\"separator\"\n aria-orientation=\"horizontal\"\n aria-label={dividerLabel}\n aria-valuenow={Math.round(shown)}\n aria-valuemin={collapsible ? 0 : minSize}\n aria-valuemax={state === \"maximized\" && room !== null ? Math.round(room) : Number.isFinite(most) ? Math.round(most) : undefined}\n aria-valuetext={state === \"collapsed\" ? \"Collapsed\" : state === \"maximized\" ? \"Full height\" : undefined}\n tabIndex={0}\n title={collapsible ? \"Drag to resize · double-click to collapse or open\" : \"Drag to resize · double-click to restore\"}\n data-slot=\"resizable-pane-divider\"\n data-state={state}\n className=\"focus-ring absolute inset-x-0 -top-1 h-2 cursor-row-resize touch-none\"\n onPointerDown={drag}\n onDoubleClick={() => {\n if (collapsible) toggle();\n else {\n setState(\"open\");\n commit(defaultSize);\n }\n }}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" && collapsible) {\n event.preventDefault();\n toggle();\n return;\n }\n if (collapsible && state === \"collapsed\" && event.key === \"ArrowUp\") {\n event.preventDefault();\n setState(\"open\");\n return;\n }\n if (collapsible && state === \"open\" && event.key === \"ArrowDown\" && open <= minSize) {\n event.preventDefault();\n setState(\"collapsed\");\n return;\n }\n const from = state === \"maximized\" && room !== null ? room : open;\n const next =\n event.key === \"ArrowUp\" ? from + STEP : event.key === \"ArrowDown\" ? from - STEP : event.key === \"Home\" ? most : event.key === \"End\" ? minSize : null;\n if (next === null) return;\n event.preventDefault();\n setState(\"open\");\n commit(Number.isFinite(next) ? next : from);\n }}\n >\n {state === \"collapsed\" ? <span aria-hidden className=\"pointer-events-none absolute inset-x-0 top-1 h-px bg-separator\" /> : null}\n </div>\n </div>\n );\n}\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport interface EdgeResizerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n [data: `data-${string}`]: string | undefined;\n /** The column's width now (px); the host owns it. */\n width: number;\n /** The least it may be while open (px). */\n minWidth: number;\n /** The most it may be (px). */\n maxWidth: number;\n /** Which side of the column the edge is on: dragging away from the column widens it. */\n side?: \"right\" | \"left\";\n /** The edge's accessible name (\"Resize the sidebar\"). */\n label: string;\n /** Called with each new width while dragging or on the arrow keys, always within min and max. */\n onResize: (width: number) => void;\n /**\n * NSSplitView's collapsible column (Finder, Mail): dragged this far (px) below `minWidth`, the\n * column snaps shut and this is called instead of `onResize`. Omit for a column that never closes.\n */\n onCollapse?: () => void;\n /** How far below `minWidth` a drag must go before the column snaps shut (default 48). */\n snap?: number;\n}\n\nconst STEP = 16;\n\n/**\n * The draggable edge of a column (a sidebar, an inspector): a hairline you grab a few points either\n * side of, sideways. Dragging resizes within min and max and, when the column is collapsible, past\n * the minimum snaps it shut; the arrow keys step it, Home and End jump to the ends. The host owns\n * the width (often the main process, which also draws the window's material at that width).\n */\nexport function EdgeResizer({ width, minWidth, maxWidth, side = \"right\", label, onResize, onCollapse, snap = 48, className, ...props }: EdgeResizerProps) {\n const clamp = (w: number) => Math.round(Math.min(maxWidth, Math.max(minWidth, w)));\n const drag = (event: React.PointerEvent<HTMLDivElement>) => {\n if (event.button !== 0) return;\n event.preventDefault();\n const edge = event.currentTarget;\n edge.setPointerCapture(event.pointerId);\n const startX = event.clientX;\n const start = width;\n let collapsed = false;\n const move = (e: PointerEvent) => {\n if (collapsed) return;\n const raw = start + (side === \"right\" ? e.clientX - startX : startX - e.clientX);\n if (onCollapse && raw < minWidth - snap) {\n collapsed = true;\n onCollapse();\n return;\n }\n onResize(clamp(raw));\n };\n const up = () => {\n edge.removeEventListener(\"pointermove\", move);\n edge.removeEventListener(\"pointerup\", up);\n edge.removeEventListener(\"pointercancel\", up);\n };\n edge.addEventListener(\"pointermove\", move);\n edge.addEventListener(\"pointerup\", up);\n edge.addEventListener(\"pointercancel\", up);\n };\n const grow = side === \"right\" ? \"ArrowRight\" : \"ArrowLeft\";\n const shrink = side === \"right\" ? \"ArrowLeft\" : \"ArrowRight\";\n return (\n <div\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={label}\n aria-valuenow={Math.round(width)}\n aria-valuemin={minWidth}\n aria-valuemax={maxWidth}\n tabIndex={0}\n data-slot=\"edge-resizer\"\n data-side={side}\n className={cn(\"focus-ring absolute inset-y-0 w-2 cursor-col-resize touch-none\", side === \"right\" ? \"-right-1\" : \"-left-1\", className)}\n onPointerDown={drag}\n onKeyDown={(event) => {\n if (event.key === shrink && onCollapse && width <= minWidth) {\n event.preventDefault();\n onCollapse();\n return;\n }\n const next =\n event.key === grow ? width + STEP : event.key === shrink ? width - STEP : event.key === \"Home\" ? minWidth : event.key === \"End\" ? maxWidth : null;\n if (next === null) return;\n event.preventDefault();\n onResize(clamp(next));\n }}\n {...props}\n />\n );\n}\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { Text } from \"./text\";\n\n/**\n * Messages' and FaceTime's parts: the round avatar, the conversation's centered header, the composer\n * at the foot of a conversation, and FaceTime's round call buttons.\n */\n\nexport interface AvatarProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Who it is: its initials are drawn when there is no `symbol`, and it is the accessible name. */\n label: string;\n /** A glyph instead of initials (an agent, a lock). */\n symbol?: React.ReactNode;\n /** `sm` 28 pt (a list row), `md` 40 pt (Messages' header), `lg` 64 pt, `xl` 96 pt (FaceTime's call). */\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\";\n}\n\nconst AVATAR_SIZE = { sm: \"size-7\", md: \"size-10\", lg: \"size-16\", xl: \"size-24\" } as const;\nconst AVATAR_TEXT = { sm: \"text-body\", md: \"text-title-3\", lg: \"text-title-1\", xl: \"text-title-large\" } as const;\nconst AVATAR_ICON = { sm: \"[&_svg]:size-icon\", md: \"[&_svg]:size-icon-lg\", lg: \"[&_svg]:size-icon-xl\", xl: \"[&_svg]:size-12\" } as const;\n\nconst initials = (label: string) =>\n label\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, 2)\n .map((w) => w[0]?.toUpperCase() ?? \"\")\n .join(\"\");\n\n/** Contacts' monogram: a gray circle with the initials (or a glyph) in white. */\nexport function Avatar({ label, symbol, size = \"md\", className, ...props }: AvatarProps) {\n return (\n <span\n role=\"img\"\n aria-label={label}\n data-slot=\"avatar\"\n className={cn(\"flex shrink-0 select-none items-center justify-center rounded-full bg-system-gray font-medium text-tint-label\", AVATAR_SIZE[size], AVATAR_TEXT[size], AVATAR_ICON[size], className)}\n {...props}\n >\n {symbol ?? initials(label)}\n </span>\n );\n}\n\nexport interface ConversationHeaderProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** The avatar over the name (Messages draws it small, centered). */\n avatar?: React.ReactNode;\n title: React.ReactNode;\n /** How the conversation travels (\"iMessage\"; ours: \"Matrx Cloud\", \"On this computer\"). */\n subtitle?: React.ReactNode;\n}\n\n/** Messages' conversation header: who, centered, with how it travels under it, over a hairline. */\nexport function ConversationHeader({ avatar, title, subtitle, className, ...props }: ConversationHeaderProps) {\n return (\n <header data-slot=\"conversation-header\" className={cn(\"flex shrink-0 flex-col items-center gap-1 border-b border-separator pb-2 pt-3\", className)} {...props}>\n {avatar}\n <Text emphasized>{title}</Text>\n {subtitle ? (\n <Text tone=\"secondary\" className=\"flex items-center gap-1\">\n {subtitle}\n </Text>\n ) : null}\n </header>\n );\n}\n\nexport interface MessageComposerProps extends Omit<React.FormHTMLAttributes<HTMLFormElement>, \"onSubmit\"> {\n /** The field's placeholder (Messages: \"iMessage\"). It is also the field's name. */\n placeholder: string;\n value: string;\n onValueChange: (value: string) => void;\n /** Return in the field. */\n onSend?: (text: string) => void;\n /** The leading + button (Messages' Photos, Files, Screen share menu). */\n leading?: React.ReactNode;\n /** The trailing button inside the field (Messages' emoji or dictation). */\n trailing?: React.ReactNode;\n /** Nothing can be typed or sent (a conversation that is not open yet). */\n disabled?: boolean;\n}\n\n/**\n * Messages' composer at the foot of a conversation: a round + button, then a capsule field with a\n * trailing button inside it. Return sends.\n */\nexport function MessageComposer({ placeholder, value, onValueChange, onSend, leading, trailing, disabled, className, ...props }: MessageComposerProps) {\n return (\n <form\n data-slot=\"message-composer\"\n className={cn(\"flex shrink-0 items-center gap-2 px-3 py-2.5\", className)}\n onSubmit={(event) => {\n event.preventDefault();\n const text = value.trim();\n if (text && !disabled) onSend?.(text);\n }}\n {...props}\n >\n {leading}\n <span className=\"relative flex min-w-0 flex-1 items-center\">\n <input\n type=\"text\"\n aria-label={placeholder}\n placeholder={placeholder}\n value={value}\n disabled={disabled}\n onChange={(event) => onValueChange(event.target.value)}\n className=\"focus-ring h-control-lg w-full min-w-0 select-text rounded-full border border-separator bg-content px-3 pr-9 text-body text-label placeholder:text-label-tertiary disabled:opacity-60\"\n />\n {trailing ? <span className=\"absolute right-1 flex items-center\">{trailing}</span> : null}\n </span>\n </form>\n );\n}\n\nexport interface CallButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\" | \"aria-label\"> {\n icon: React.ReactNode;\n /** Its name, drawn under it (FaceTime: Mute, Speaker, End). */\n label: string;\n /** `end`: the red End button. */\n tone?: \"default\" | \"end\";\n}\n\n/** FaceTime's call control: a 48 pt round button with its name under it; End is red. */\nexport function CallButton({ icon, label, tone = \"default\", className, type = \"button\", ...props }: CallButtonProps) {\n return (\n <span data-slot=\"call-button\" className=\"flex flex-col items-center gap-1.5\">\n <button\n type={type}\n aria-label={label}\n className={cn(\n \"focus-ring flex size-12 items-center justify-center rounded-full [&_svg]:size-icon-lg disabled:opacity-40\",\n tone === \"end\" ? \"bg-system-red text-tint-label\" : \"bg-fill-secondary text-label\",\n className,\n )}\n {...props}\n >\n {icon}\n </button>\n <Text tone=\"secondary\">{label}</Text>\n </span>\n );\n}\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\n/**\n * Voice Memos' parts: the recording's waveform with its playhead, and the round red Record button.\n */\n\nexport interface WaveformProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"aria-label\"> {\n /** The recording's loudness, one value 0–1 per bar, oldest first (`peaksOf` makes them). */\n peaks: ReadonlyArray<number>;\n /** How far playback has gone, 0–1: the bars before it in the label color, the playhead there. */\n progress?: number;\n /** A click (or Left/Right) moves the playhead; omitted, the waveform is a picture. */\n onSeek?: (fraction: number) => void;\n \"aria-label\": string;\n}\n\n/**\n * Voice Memos' waveform: thin rounded bars mirrored about the center line, the played part in the\n * label color and the rest tertiary, the playhead a tint line with a dot on top. It fills its\n * container's width; its height is the row-tall named size, four of them.\n */\nexport function Waveform({ peaks, progress = 0, onSeek, className, \"aria-label\": label, ...props }: WaveformProps) {\n const bars = peaks.length;\n const at = Math.max(0, Math.min(1, progress));\n const seek = (event: React.MouseEvent<HTMLDivElement>) => {\n if (!onSeek) return;\n const box = event.currentTarget.getBoundingClientRect();\n if (box.width > 0) onSeek(Math.max(0, Math.min(1, (event.clientX - box.left) / box.width)));\n };\n return (\n <div\n data-slot=\"waveform\"\n role={onSeek ? \"slider\" : \"img\"}\n aria-label={label}\n {...(onSeek ? { \"aria-valuemin\": 0, \"aria-valuemax\": 100, \"aria-valuenow\": Math.round(at * 100), tabIndex: 0 } : {})}\n onClick={seek}\n onKeyDown={(event) => {\n if (!onSeek) return;\n if (event.key === \"ArrowLeft\" || event.key === \"ArrowRight\") {\n event.preventDefault();\n onSeek(Math.max(0, Math.min(1, at + (event.key === \"ArrowRight\" ? 0.05 : -0.05))));\n }\n }}\n className={cn(\"focus-ring relative h-48 w-full cursor-default select-none rounded-control\", className)}\n {...props}\n >\n <svg viewBox={`0 0 ${Math.max(bars, 1) * 3} 100`} preserveAspectRatio=\"none\" className=\"absolute inset-0 size-full\" aria-hidden>\n <line x1=\"0\" x2={Math.max(bars, 1) * 3} y1=\"50\" y2=\"50\" className=\"stroke-separator\" strokeWidth=\"0.5\" vectorEffect=\"non-scaling-stroke\" />\n {peaks.map((p, i) => {\n const h = Math.max(1.5, Math.min(1, p) * 92);\n const played = (i + 0.5) / bars <= at;\n return <rect key={i} x={i * 3 + 0.6} y={50 - h / 2} width=\"1.8\" height={h} rx=\"0.9\" className={played ? \"fill-label\" : \"fill-label-tertiary\"} />;\n })}\n </svg>\n {/* The playhead: a tint line the full height, a dot at its top (Voice Memos). */}\n <span data-slot=\"waveform-playhead\" aria-hidden className=\"pointer-events-none absolute inset-y-0 w-px bg-tint\" style={{ left: `${at * 100}%` }}>\n <span className=\"absolute -left-1 -top-1 size-2 rounded-full bg-tint\" />\n </span>\n </div>\n );\n}\n\n/**\n * The loudness of `samples` (one channel, −1…1) as `bars` peaks 0–1, scaled so the loudest bar is\n * full height (Voice Memos draws every recording at a readable size).\n */\nexport function peaksOf(samples: ArrayLike<number>, bars: number): number[] {\n const n = Math.max(1, Math.floor(bars));\n if (samples.length === 0) return new Array<number>(n).fill(0);\n const per = samples.length / n;\n const out: number[] = [];\n for (let b = 0; b < n; b += 1) {\n const from = Math.floor(b * per);\n const to = Math.max(from + 1, Math.floor((b + 1) * per));\n let peak = 0;\n for (let i = from; i < to && i < samples.length; i += 1) peak = Math.max(peak, Math.abs(samples[i] ?? 0));\n out.push(peak);\n }\n const loudest = Math.max(...out);\n return loudest > 0 ? out.map((p) => p / loudest) : out;\n}\n\nexport interface RecordButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\" | \"aria-label\"> {\n /** Recording now: the red dot becomes a rounded square (Stop). */\n recording?: boolean;\n /** The button's name and tooltip (\"Record\", \"Stop recording\"). */\n label: string;\n}\n\n/** Voice Memos' Record button: a red dot in a ring, 44 pt; while recording, a red rounded square. */\nexport const RecordButton = React.forwardRef<HTMLButtonElement, RecordButtonProps>(function RecordButton({ recording = false, label, className, type = \"button\", ...props }, ref) {\n return (\n <button\n ref={ref}\n type={type}\n data-slot=\"record-button\"\n data-recording={recording || undefined}\n aria-label={label}\n title={label}\n className={cn(\n \"focus-ring flex size-11 shrink-0 items-center justify-center rounded-full border-2 border-label-tertiary bg-content disabled:opacity-40\",\n className,\n )}\n {...props}\n >\n <span className={cn(\"bg-system-red transition-all duration-150\", recording ? \"size-4 rounded-tile\" : \"size-8 rounded-full\")} />\n </button>\n );\n});\n","import * as React from \"react\";\nimport { copyText } from \"@ai-matrx/kit/clipboard\";\n\nimport { Button } from \"./button\";\nimport { describeError } from \"./errors\";\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 const said = describeError(state.error);\n return (\n <StateView\n kind=\"error\"\n size={size}\n title={failed}\n message={<span title={said.detail || undefined}>{said.cause}</span>}\n actions={\n <>\n {state.refetch ? <Button onClick={() => void state.refetch?.()}>Try again</Button> : null}\n {said.detail ? (\n <Button variant=\"plain\" onClick={() => void copyText(said.detail)}>\n Copy details\n </Button>\n ) : null}\n </>\n }\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\";\nimport { Text } from \"./text\";\n\nexport interface ComingSoonProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** The feature's symbol (the same one its menu entry shows), at 48 pt (`SystemSymbol size={48}`). */\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 /** The one thing to do from here (a regular `Button`), under the text, as an empty Shortcuts\n * library offers \"Browse Gallery\". */\n action?: React.ReactNode;\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. It is Apple's empty state\n * (ContentUnavailableView: an empty Notes folder, an empty Shortcuts library): centered in the page,\n * a large tertiary symbol, the name in bold secondary type, one line of what it will do and that it\n * is coming, what it will include (secondary, legible in both themes), and at most one button. No card, no border, no badge.\n */\nexport function ComingSoon({ icon, title, summary, includes, action, className, ...props }: ComingSoonProps) {\n const lines = (includes ?? []).slice(0, 4);\n return (\n <div\n data-slot=\"coming-soon\"\n data-coming-soon={title}\n className={cn(\"flex h-full min-h-60 flex-col items-center justify-center overflow-y-auto bg-content px-8 py-10 text-center\", className)}\n {...props}\n >\n <span data-coming-soon-symbol className=\"mb-3 flex items-center justify-center text-label-tertiary [&_svg]:size-12\">\n {icon}\n </span>\n <Text as=\"h1\" variant=\"title-1\" emphasized tone=\"secondary\">\n {title}\n </Text>\n {/* Balanced lines, as ContentUnavailableView wraps its description: never \"Coming\" / \"soon.\" alone. */}\n <Text as=\"p\" tone=\"secondary\" className=\"mt-2 max-w-sm text-balance\">\n {summary} <span data-coming-soon-status className=\"whitespace-nowrap\">Coming soon.</span>\n </Text>\n {lines.length > 0 ? (\n <ul data-coming-soon-includes className=\"mt-3 flex flex-col items-center gap-1\">\n {lines.map((line) => (\n <li key={line}>\n <Text tone=\"secondary\">{line}</Text>\n </li>\n ))}\n </ul>\n ) : null}\n {action ? <div className=\"mt-4 flex items-center gap-2\">{action}</div> : null}\n </div>\n );\n}\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\n/** A tile's color: macOS's system colors, used here as a category's color (System Settings'\n * pane icons, Shortcuts' action categories). */\nexport type SymbolTileColor = \"red\" | \"orange\" | \"yellow\" | \"green\" | \"blue\" | \"purple\" | \"gray\";\n\nconst COLOR: Record<SymbolTileColor, string> = {\n red: \"bg-system-red\",\n orange: \"bg-system-orange\",\n yellow: \"bg-system-yellow\",\n green: \"bg-system-green\",\n blue: \"bg-system-blue\",\n purple: \"bg-system-purple\",\n gray: \"bg-system-gray\",\n};\n\n/**\n * The tile's size and the glyph inside it:\n * - `sm` 20 pt: a `Row`'s icon (System Settings' sidebar, Shortcuts' action list);\n * - `md` 32 pt: a list row's icon (Passwords' list, Shortcuts' list view);\n * - `lg` 64 pt: an app icon in a shelf (App Store's lockups);\n * - `xl` 128 pt: the big icon on a detail page (App Store's product page).\n * The bigger sizes are app icons: Apple's continuous-corner squircle radius and a soft top sheen.\n */\nexport type SymbolTileSize = \"sm\" | \"md\" | \"lg\" | \"xl\";\n\nconst SIZE: Record<SymbolTileSize, string> = {\n sm: \"size-icon-lg rounded-tile [&_svg]:size-icon-sm\",\n md: \"size-8 rounded-control [&_svg]:size-icon-lg\",\n lg: \"size-16 rounded-icon-lg [&_svg]:size-icon-xl\",\n xl: \"size-32 rounded-icon-xl [&_svg]:size-16\",\n};\n\n/** A tile color picked by a key (a category, a name): the same key always gets the same color.\n * Yellow is left out: white type on it is too faint for a name (Shortcuts darkens its yellow). */\nexport function tileColorFor(key: string): SymbolTileColor {\n const colors: SymbolTileColor[] = [\"blue\", \"purple\", \"orange\", \"green\", \"red\", \"gray\"];\n let hash = 0;\n for (let i = 0; i < key.length; i += 1) hash = (hash * 31 + key.charCodeAt(i)) >>> 0;\n return colors[hash % colors.length] ?? \"blue\";\n}\n\nexport interface SymbolTileProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** The glyph (a `SystemSymbol`, or its Lucide fallback), drawn white on the color. */\n children: React.ReactNode;\n color: SymbolTileColor;\n size?: SymbolTileSize;\n}\n\n/**\n * THE colored icon tile: a white glyph on a rounded square of one system color (System Settings'\n * pane icons, Shortcuts' actions; at `lg`/`xl` an app icon in App Store's shelves and product page).\n * At `sm` it fills a `Row`'s icon slot exactly. Decorative: the row's title names the thing.\n */\nexport function SymbolTile({ children, color, size = \"sm\", className, ...props }: SymbolTileProps) {\n return (\n <span\n aria-hidden\n data-slot=\"symbol-tile\"\n data-color={color}\n data-size={size}\n className={cn(\"flex shrink-0 items-center justify-center text-tint-label\", SIZE[size], COLOR[color], className)}\n {...props}\n >\n {children}\n </span>\n );\n}\n","import * as React from \"react\";\n\nimport { ContextMenu, ContextMenuContent, ContextMenuTrigger } from \"../context-menu\";\nimport { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from \"../dropdown-menu\";\nimport { Tooltip, TooltipTrigger } from \"../tooltip\";\nimport { cn } from \"./cn\";\nimport { ContextMenuEntries, DropdownMenuEntries, type RowMenuItem } from \"./menu-entries\";\nimport { ConfirmDialog } from \"./sheet\";\nimport type { SymbolTileColor } from \"./tile\";\nimport { TooltipContent } from \"./tooltip\";\n\n/*\n * Shortcuts' library: a grid of colored tiles, one per shortcut — its glyph at the top leading\n * corner, its name at the foot in white, and on hover (or while the tile is selected or focused) the\n * run button and the More (ellipsis) button at the top trailing corner; More opens the tile's menu. A click selects the tile, a double-click or\n * Return opens it, Space runs it; right-click opens its menu. The arrow keys move the selection\n * across the grid in reading order (Up/Down by a whole row).\n */\n\nconst TILE_COLOR: Record<SymbolTileColor, string> = {\n red: \"bg-system-red\",\n orange: \"bg-system-orange\",\n yellow: \"bg-system-yellow\",\n green: \"bg-system-green\",\n blue: \"bg-system-blue\",\n purple: \"bg-system-purple\",\n gray: \"bg-system-gray\",\n};\n\nexport interface TileGridProps extends React.HTMLAttributes<HTMLDivElement> {\n \"aria-label\": string;\n}\n\n/** The grid Shortcuts lays its tiles in: as many 170 pt columns as fit, 12 pt apart, filling the row. */\nexport function TileGrid({ className, onKeyDown, ...props }: TileGridProps) {\n return (\n <div\n role=\"listbox\"\n data-slot=\"tile-grid\"\n className={cn(\"grid gap-3\", className)}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n const keys = [\"ArrowRight\", \"ArrowLeft\", \"ArrowDown\", \"ArrowUp\", \"Home\", \"End\"];\n if (!keys.includes(event.key)) return;\n const tiles = Array.from(event.currentTarget.querySelectorAll<HTMLElement>('[data-slot=\"shortcut-tile\"]'));\n const at = tiles.indexOf(document.activeElement as HTMLElement);\n if (at === -1 || tiles.length === 0) return;\n // A row is every tile on the same line as the focused one.\n const top = tiles[at]?.offsetTop ?? 0;\n const perRow = Math.max(1, tiles.filter((t) => t.offsetTop === top).length);\n const step: Record<string, number> = { ArrowRight: 1, ArrowLeft: -1, ArrowDown: perRow, ArrowUp: -perRow };\n const next = event.key === \"Home\" ? 0 : event.key === \"End\" ? tiles.length - 1 : at + (step[event.key] ?? 0);\n const target = tiles[Math.max(0, Math.min(tiles.length - 1, next))];\n if (target) {\n event.preventDefault();\n target.focus();\n target.click();\n }\n }}\n {...props}\n />\n );\n}\n\nexport interface ShortcutTileProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\" | \"color\"> {\n /** The tile's color (Shortcuts lets each shortcut pick one; a category's color here). */\n color: SymbolTileColor;\n /** The glyph at the top leading corner (a `SystemSymbol` with its Lucide fallback), drawn white. */\n glyph: React.ReactNode;\n /** The name, white, at the tile's foot (two lines at most). */\n title: string;\n selected?: boolean;\n onSelect?: () => void;\n /** Double-click or Return. */\n onOpen?: () => void;\n /** The run button (top trailing corner, on hover): its name is its tooltip (\"Run in AI Matrx\"). */\n run?: { label: string; onRun: () => void; icon: React.ReactNode };\n /** The tile's menu: right-click, or its More (ellipsis) button on hover. */\n menu?: ReadonlyArray<RowMenuItem>;\n}\n\n/** The round white-on-color buttons at a tile's top trailing corner (Shortcuts' play and ellipsis). */\nconst CORNER_BUTTON =\n \"flex size-control-lg items-center justify-center rounded-full text-tint-label opacity-0 transition-opacity duration-100 group-hover/tile:opacity-100 group-focus-visible/tile:opacity-100 group-data-[selected]/tile:opacity-100 data-[state=open]:opacity-100 [&_svg]:size-icon-sm\";\n\nfunction MoreGlyph(): React.JSX.Element {\n return (\n <svg viewBox=\"0 0 16 16\" aria-hidden fill=\"currentColor\">\n <circle cx=\"3\" cy=\"8\" r=\"1.5\" />\n <circle cx=\"8\" cy=\"8\" r=\"1.5\" />\n <circle cx=\"13\" cy=\"8\" r=\"1.5\" />\n </svg>\n );\n}\n\nexport function ShortcutTile({ color, glyph, title, selected, onSelect, onOpen, run, menu, className, onKeyDown, ...props }: ShortcutTileProps) {\n // A destructive item with a question asks first (the shared menu entries hand it here).\n const [asking, setAsking] = React.useState<RowMenuItem | null>(null);\n const confirm = (\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 );\n const tile = (\n <div\n role=\"option\"\n aria-selected={Boolean(selected)}\n aria-label={title}\n tabIndex={0}\n data-slot=\"shortcut-tile\"\n data-color={color}\n data-selected={selected || undefined}\n onClick={() => onSelect?.()}\n onDoubleClick={() => onOpen?.()}\n onContextMenu={() => onSelect?.()}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n if (event.key === \"Enter\" && onOpen) {\n event.preventDefault();\n onOpen();\n } else if (event.key === \" \" && run) {\n event.preventDefault();\n run.onRun();\n }\n }}\n className={cn(\n \"group/tile focus-ring relative flex h-28 cursor-default select-none flex-col justify-between rounded-group p-3 text-tint-label shadow-raised\",\n TILE_COLOR[color],\n className,\n )}\n {...props}\n >\n <span aria-hidden className=\"flex size-icon-xl items-center justify-center [&_svg]:size-icon-xl\">\n {glyph}\n </span>\n <span data-slot=\"shortcut-tile-title\" className=\"line-clamp-2 pr-1 text-body\">\n {title}\n </span>\n {run || (menu && menu.length > 0) ? (\n <span className=\"absolute right-2 top-2 flex items-center gap-1\">\n {run ? (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n aria-label={run.label}\n data-slot=\"shortcut-tile-run\"\n tabIndex={-1}\n onClick={(event) => {\n event.stopPropagation();\n run.onRun();\n }}\n onDoubleClick={(event) => event.stopPropagation()}\n className={CORNER_BUTTON}\n >\n {run.icon}\n </button>\n </TooltipTrigger>\n <TooltipContent>{run.label}</TooltipContent>\n </Tooltip>\n ) : null}\n {menu && menu.length > 0 ? (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <button\n type=\"button\"\n aria-label={`More for ${title}`}\n data-slot=\"shortcut-tile-more\"\n tabIndex={-1}\n onClick={(event) => {\n event.stopPropagation();\n onSelect?.();\n }}\n onDoubleClick={(event) => event.stopPropagation()}\n className={CORNER_BUTTON}\n >\n <MoreGlyph />\n </button>\n </DropdownMenuTrigger>\n {/* Opens from the More button toward the tile's own side (a pull-down's leading edge at\n its button), never out past the tile toward the sidebar. */}\n <DropdownMenuContent align=\"start\" data-slot=\"shortcut-tile-menu\">\n <DropdownMenuEntries items={menu} onAsk={setAsking} />\n </DropdownMenuContent>\n </DropdownMenu>\n ) : null}\n </span>\n ) : null}\n </div>\n );\n if (!menu || menu.length === 0) return tile;\n return (\n <>\n {confirm}\n <ContextMenu>\n <ContextMenuTrigger asChild>{tile}</ContextMenuTrigger>\n <ContextMenuContent data-slot=\"shortcut-tile-menu\">\n <ContextMenuEntries items={menu} onAsk={setAsking} />\n </ContextMenuContent>\n </ContextMenu>\n </>\n );\n}\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { Text } from \"./text\";\n\n/*\n * Safari's Start Page: what an empty browser tab shows — the sections (\"Favorites\") of large rounded\n * tiles, each the site's icon (or its first letter) over its name, centered in the page.\n */\n\nexport interface StartPageProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n}\n\n/** The page: its sections centered in one column on the content color, from the top, scrolling. */\nexport function StartPage({ className, children, ...props }: StartPageProps) {\n return (\n <div data-slot=\"start-page\" className={cn(\"flex h-full min-h-0 flex-col items-center overflow-y-auto bg-content px-6 pb-8 pt-12\", className)} {...props}>\n <div className=\"flex w-full max-w-2xl flex-col gap-8\">{children}</div>\n </div>\n );\n}\n\nexport interface StartPageSectionProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** \"Favorites\". */\n title: string;\n /** One quiet line under the tiles (what the section is, or how to add to it). */\n footer?: React.ReactNode;\n}\n\n/** One section: its name in bold, then its tiles in a wrapping row. */\nexport function StartPageSection({ title, footer, className, children, ...props }: StartPageSectionProps) {\n return (\n <section data-slot=\"start-page-section\" aria-label={title} className={cn(\"flex flex-col gap-3\", className)} {...props}>\n <Text as=\"h2\" variant=\"title-3\" emphasized>\n {title}\n </Text>\n <div className=\"flex flex-wrap gap-x-4 gap-y-3\">{children}</div>\n {footer ? <Text tone=\"secondary\">{footer}</Text> : null}\n </section>\n );\n}\n\nexport interface FavoriteTileProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"title\" | \"children\"> {\n /** The site's name under its tile. */\n title: string;\n /** The site's icon; without one the tile shows the name's first letter. */\n icon?: React.ReactNode;\n}\n\n/** A favorite: a 64 pt rounded tile with the site's icon or letter, its name under it; pressing it opens the site. */\nexport function FavoriteTile({ title, icon, className, ...props }: FavoriteTileProps) {\n return (\n <button type=\"button\" data-slot=\"favorite-tile\" className={cn(\"focus-ring group flex w-20 flex-col items-center gap-1.5 rounded-control p-1\", className)} {...props}>\n <span className=\"flex size-16 items-center justify-center rounded-icon-lg bg-control shadow-raised group-hover:brightness-95 [&_img]:size-8 [&_svg]:size-8\">\n {icon ?? (\n <Text variant=\"title-1\" tone=\"secondary\" aria-hidden>\n {title.slice(0, 1).toUpperCase()}\n </Text>\n )}\n </span>\n <Text truncate className=\"w-full text-center\">\n {title}\n </Text>\n </button>\n );\n}\n","import * as React from \"react\";\n\nimport { Tooltip, TooltipTrigger } from \"../tooltip\";\nimport { cn } from \"./cn\";\nimport { Text } from \"./text\";\nimport { TooltipContent } from \"./tooltip\";\n\n/*\n * App Store's parts: the shelf (a bold title, See All, lockups in columns), the lockup (the app\n * icon, its name, one line, a quiet fact, and the Get capsule), the Get capsule itself (Get, Open,\n * the download ring with its stop square, or a quiet label for what cannot be had yet), the product\n * page's header (the big icon, the name, the maker, the capsule) and its info strip (columns of a\n * caption, a large value and a quiet line, all 13 pt or larger, hairlines between them).\n */\n\n/* ---------------------------------------------------------------------------------------------- */\n/* The download ring */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface ProgressRingProps extends React.SVGAttributes<SVGSVGElement> {\n /** 0–1; null while the total is not known yet (the ring spins). */\n value: number | null;\n /** Accessible name (\"Downloading Whisper Small\"). */\n label: string;\n}\n\n/** App Store's download ring: a quiet track, the accent arc growing clockwise from the top. */\nexport function ProgressRing({ value, label, className, ...props }: ProgressRingProps) {\n const r = 10;\n const length = 2 * Math.PI * r;\n const shown = value === null ? 0.25 : Math.max(0, Math.min(1, value));\n return (\n <svg\n viewBox=\"0 0 24 24\"\n role=\"progressbar\"\n aria-label={label}\n aria-valuemin={0}\n aria-valuemax={100}\n {...(value === null ? {} : { \"aria-valuenow\": Math.round(shown * 100) })}\n data-slot=\"progress-ring\"\n data-indeterminate={value === null || undefined}\n className={cn(\"size-control shrink-0\", className)}\n {...props}\n >\n <circle cx=\"12\" cy=\"12\" r={r} fill=\"none\" strokeWidth=\"2.5\" className=\"stroke-fill-tertiary\" />\n <circle\n cx=\"12\"\n cy=\"12\"\n r={r}\n fill=\"none\"\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeDasharray={`${shown * length} ${length}`}\n transform=\"rotate(-90 12 12)\"\n className=\"stroke-tint\"\n />\n </svg>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* The Get capsule */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport type GetButtonState =\n /** Not on this computer yet: \"Get\" (or `label`). */\n | { kind: \"get\"; label?: string }\n /** Here and ready: \"Open\" (or `label`). */\n | { kind: \"open\"; label?: string }\n /** Downloading: the ring (null: not measured yet); pressing it stops the download. */\n | { kind: \"progress\"; value: number | null }\n /** Cannot be had yet (\"Soon\"): the capsule, quiet, with the reason as its tooltip. */\n | { kind: \"unavailable\"; label: string; reason: string };\n\nexport interface GetButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"onClick\" | \"children\"> {\n state: GetButtonState;\n /** What the capsule is for, read by assistive tech (\"Get Whisper Small\"). */\n name: string;\n /** Get or Open. */\n onPress?: () => void;\n /** Stop a download (the ring's square). */\n onStop?: () => void;\n}\n\n/**\n * App Store's Get capsule: a gray pill with the bold accent label (\"Get\", \"Open\"); while it\n * downloads, the ring with a stop square in it; a thing that cannot be had yet keeps the pill with a\n * quiet label and says why on hover (App Store's \"Coming Soon\" pre-order line).\n */\nexport function GetButton({ state, name, onPress, onStop, className, disabled, ...props }: GetButtonProps) {\n if (state.kind === \"progress\") {\n return (\n <button\n type=\"button\"\n data-slot=\"get-button\"\n data-state=\"progress\"\n aria-label={`Stop ${name}`}\n onClick={(event) => {\n event.stopPropagation();\n onStop?.();\n }}\n className={cn(\"focus-ring relative flex size-control-lg shrink-0 items-center justify-center rounded-full\", className)}\n {...props}\n >\n <ProgressRing value={state.value} label={`Downloading ${name}`} className=\"absolute inset-0 size-control-lg\" />\n <span aria-hidden data-slot=\"get-button-stop\" className=\"size-2 rounded-checkbox bg-tint\" />\n </button>\n );\n }\n const unavailable = state.kind === \"unavailable\";\n const label = state.kind === \"unavailable\" ? state.label : (state.label ?? (state.kind === \"open\" ? \"Open\" : \"Get\"));\n const pill = (\n <button\n type=\"button\"\n data-slot=\"get-button\"\n data-state={state.kind}\n aria-label={`${label} ${name}`}\n aria-disabled={unavailable || disabled || undefined}\n disabled={disabled}\n onClick={(event) => {\n event.stopPropagation();\n if (!unavailable) onPress?.();\n }}\n className={cn(\n \"focus-ring inline-flex h-control-lg min-w-16 shrink-0 items-center justify-center whitespace-nowrap rounded-full bg-fill-secondary px-4 text-body transition-colors duration-100 disabled:opacity-40\",\n unavailable ? \"cursor-default text-label-secondary\" : \"text-tint hover:bg-fill-tertiary\",\n className,\n )}\n {...props}\n >\n {label}\n </button>\n );\n if (!unavailable) return pill;\n return (\n <Tooltip>\n <TooltipTrigger asChild>{pill}</TooltipTrigger>\n <TooltipContent>{state.reason}</TooltipContent>\n </Tooltip>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* The shelf and its lockups */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface StoreShelfProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n title: string;\n /** One quiet line under the title (what the shelf holds). */\n subtitle?: React.ReactNode;\n /** Trailing on the title line (\"See All\", a plain Button). */\n action?: React.ReactNode;\n}\n\n/** App Store's shelf: a bold title with See All trailing, its lockups in columns under it. */\nexport function StoreShelf({ title, subtitle, action, className, children, ...props }: StoreShelfProps) {\n const id = React.useId();\n return (\n <section aria-labelledby={id} data-slot=\"store-shelf\" className={cn(\"flex flex-col gap-2\", className)} {...props}>\n <header className=\"flex items-end gap-3 border-t border-separator pt-3\">\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <Text id={id} as=\"h2\" variant=\"title-2\" emphasized truncate>\n {title}\n </Text>\n {subtitle ? (\n <Text tone=\"secondary\" truncate>\n {subtitle}\n </Text>\n ) : null}\n </span>\n {action}\n </header>\n <div data-slot=\"store-shelf-grid\" className=\"grid gap-x-6\">\n {children}\n </div>\n </section>\n );\n}\n\nexport interface StoreLockupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** The app icon: a `SymbolTile size=\"lg\"`. */\n icon: React.ReactNode;\n title: string;\n /** One line: what it is for. */\n subtitle?: React.ReactNode;\n /** One quiet fact (the size, \"Fits this computer\"). */\n detail?: React.ReactNode;\n /** The Get capsule. */\n action?: React.ReactNode;\n /** Opens its product page (a click anywhere but the capsule). */\n onOpen?: () => void;\n}\n\n/** One app in a shelf: the icon, the name, one line and one fact, the Get capsule trailing; a hairline under it. */\nexport function StoreLockup({ icon, title, subtitle, detail, action, onOpen, className, ...props }: StoreLockupProps) {\n return (\n <div data-slot=\"store-lockup\" className={cn(\"flex min-w-0 items-center gap-3 border-b border-separator py-3\", className)} {...props}>\n <button\n type=\"button\"\n data-slot=\"store-lockup-open\"\n aria-label={`${title}, details`}\n onClick={onOpen}\n className=\"focus-ring flex min-w-0 flex-1 items-center gap-3 rounded-control text-left\"\n >\n {icon}\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <Text emphasized truncate>\n {title}\n </Text>\n {subtitle ? (\n // Two lines at most, wrapped at words (App Store's lockup subtitle), never cut mid-word on one.\n <Text data-slot=\"store-lockup-subtitle\" tone=\"secondary\" className=\"line-clamp-2\">\n {subtitle}\n </Text>\n ) : null}\n {detail ? (\n <Text data-slot=\"store-lockup-detail\" tone=\"secondary\" className=\"whitespace-nowrap\">\n {detail}\n </Text>\n ) : null}\n </span>\n </button>\n {action}\n </div>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* The product page */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface StoreHeaderProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** The big app icon: a `SymbolTile size=\"xl\"`. */\n icon: React.ReactNode;\n title: string;\n /** The maker or the one-line pitch, under the name. */\n subtitle?: React.ReactNode;\n /** The Get capsule, under the text. */\n action?: React.ReactNode;\n /** One quiet line beside the capsule (\"Runs on this computer\"). */\n note?: React.ReactNode;\n}\n\n/** App Store's product page head: the big icon, the name in bold, the maker, the Get capsule. */\nexport function StoreHeader({ icon, title, subtitle, action, note, className, ...props }: StoreHeaderProps) {\n return (\n <header data-slot=\"store-header\" className={cn(\"flex items-center gap-6\", className)} {...props}>\n {icon}\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <Text as=\"h1\" variant=\"title-large\" emphasized truncate>\n {title}\n </Text>\n {subtitle ? (\n <Text variant=\"title-3\" tone=\"secondary\" truncate>\n {subtitle}\n </Text>\n ) : null}\n {action || note ? (\n <div className=\"mt-3 flex items-center gap-3\">\n {action}\n {note ? <Text tone=\"secondary\">{note}</Text> : null}\n </div>\n ) : null}\n </div>\n </header>\n );\n}\n\nexport interface InfoStripItem {\n /** The caption over the value (\"Size\"). */\n label: string;\n /** The large value (\"4.7 GB\"); a short word or a symbol. */\n value: React.ReactNode;\n /** The small line under it (\"Download\"). */\n caption?: React.ReactNode;\n}\n\nexport interface InfoStripProps extends React.HTMLAttributes<HTMLDListElement> {\n items: ReadonlyArray<InfoStripItem>;\n}\n\n/**\n * App Store's information strip under a product's header: equal columns, each a caption, a large\n * bold value and a quiet line (13 pt or larger), divided by short hairlines. Each column carries\n * `data-info=\"<label>\"`.\n */\nexport function InfoStrip({ items, className, ...props }: InfoStripProps) {\n return (\n <dl data-slot=\"info-strip\" className={cn(\"flex border-y border-separator py-3\", className)} {...props}>\n {items.map((item, i) => (\n <div\n key={item.label}\n data-info={item.label}\n className={cn(\"flex min-w-0 flex-1 flex-col items-center gap-0.5 px-3 text-center\", i > 0 && \"border-l border-separator\")}\n >\n {/* Every line 13 pt or larger (the desktop standard's floor), the value large and bold. */}\n <dt data-slot=\"info-strip-label\" className=\"truncate text-body text-label-secondary\">\n {item.label}\n </dt>\n <dd data-slot=\"info-strip-value\" className=\"truncate text-title-2 text-label-secondary\">\n {item.value}\n </dd>\n {item.caption ? <dd className=\"truncate text-body text-label-tertiary\">{item.caption}</dd> : null}\n </div>\n ))}\n </dl>\n );\n}\n","import * as React from \"react\";\n\nimport { formatDurationMs, groupCode } from \"@ai-matrx/kit/format\";\nimport { cn } from \"./cn\";\nimport { Text } from \"./text\";\nimport { Button } from \"../controls/controls\";\n\n/*\n * Passwords' detail pane: the head (the site's icon, its name in bold, when it last changed, Edit\n * trailing) and the grouped box of fields under it — each a label and its value on one line; a\n * secret is drawn as dots only (Passwords shows no character of it, not even a hint) and never as\n * its value; hovering or focusing a field shows its Copy button over the field's trailing edge, as\n * Passwords does — it takes no room of its own, so the value and its note use the field's width.\n */\n\nexport interface CredentialHeaderProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** The site's or item's icon: a `SymbolTile size=\"lg\"`. */\n icon: React.ReactNode;\n title: string;\n /** One quiet line (\"Last modified 9 October 2026\"). */\n subtitle?: React.ReactNode;\n /** Trailing at the top (Edit, Share). */\n actions?: React.ReactNode;\n}\n\nexport function CredentialHeader({ icon, title, subtitle, actions, className, ...props }: CredentialHeaderProps) {\n return (\n <header data-slot=\"credential-header\" className={cn(\"flex items-center gap-4\", className)} {...props}>\n {icon}\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <Text as=\"h1\" variant=\"title-1\" emphasized truncate>\n {title}\n </Text>\n {subtitle ? (\n <Text tone=\"secondary\" truncate>\n {subtitle}\n </Text>\n ) : null}\n </div>\n {actions ? <div className=\"flex shrink-0 items-center gap-2 self-start\">{actions}</div> : null}\n </header>\n );\n}\n\n/** The grouped box the fields sit in (System Settings' and Passwords' inset group). */\nexport function CredentialFields({ className, ...props }: React.HTMLAttributes<HTMLDListElement>) {\n return <dl data-slot=\"credential-fields\" className={cn(\"flex flex-col rounded-group bg-group px-3\", className)} {...props} />;\n}\n\nexport interface CredentialFieldProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n label: string;\n /** The value as written (a user name, a site); ignored for a secret. */\n value?: React.ReactNode;\n /** A secret: drawn as dots, never as its value nor any part of it. */\n secret?: boolean;\n /** The trailing Copy button (a small plain `Button`); shown on hover or focus. */\n copy?: React.ReactNode;\n /** One quiet line under the value (why it cannot be copied, where it is kept). */\n note?: React.ReactNode;\n /**\n * A secret's value once the person asked to see it (Passwords shows it on hover; Matrx 2 on a\n * click, since every reveal is an audited server call). Drawn in the mono face, selectable;\n * null or absent: the dots.\n */\n revealed?: string | null;\n /** Click the dots to reveal (the dots become a button named \"Show <label>\"). */\n onReveal?: () => void;\n /** A reveal is on its way: the dots stay and the button waits. */\n revealing?: boolean;\n /** Edit mode (Passwords' Edit): the field's own control in place of its value (a `TextField`). */\n editor?: React.ReactNode;\n}\n\n/** Passwords' dots: full-size bullets (U+25CF), never the small \"•\" that reads as periods. */\nexport const CREDENTIAL_DOTS = \"●●●●●●●●●●\";\n\nexport function CredentialField({ label, value, secret, copy, note, revealed, onReveal, revealing, editor, className, ...props }: CredentialFieldProps) {\n const shown = secret && typeof revealed === \"string\";\n const dots = (\n <span data-slot=\"credential-dots\" aria-label=\"Hidden\">\n {CREDENTIAL_DOTS}\n </span>\n );\n return (\n <div\n data-slot=\"credential-field\"\n data-field={label}\n data-secret={secret || undefined}\n data-revealed={shown || undefined}\n data-editing={editor ? true : undefined}\n className={cn(\"group/field relative flex min-h-row items-center gap-3 border-b border-separator py-2 last:border-b-0\", className)}\n {...props}\n >\n <dt className={cn(\"w-28 shrink-0 text-body text-label-secondary\", editor ? \"self-center\" : \"self-start pt-px\")}>{label}</dt>\n <dd className=\"flex min-w-0 flex-1 flex-col\">\n {editor ? (\n editor\n ) : (\n <span className={cn(\"min-w-0 select-text break-words text-body text-label\", secret && \"tabular-nums\", shown && \"font-mono\")}>\n {!secret ? (\n value\n ) : shown ? (\n <span data-slot=\"credential-revealed\">{revealed}</span>\n ) : onReveal ? (\n // The dots are the control (Passwords': point at them to see the password).\n <Button\n type=\"button\"\n variant=\"quiet\"\n data-slot=\"credential-reveal\"\n aria-label={`Show ${label}`}\n title={`Show ${label}`}\n disabled={revealing}\n aria-busy={revealing || undefined}\n onClick={onReveal}\n className=\"cursor-default\"\n >\n {dots}\n </Button>\n ) : (\n dots\n )}\n </span>\n )}\n {note ? <span className=\"text-body text-label-secondary\">{note}</span> : null}\n </dd>\n {copy && !editor ? (\n // Over the field's trailing edge on the group's own color (it hides what it covers while shown).\n <span\n data-slot=\"credential-copy\"\n className=\"absolute inset-y-0 right-0 flex items-center bg-group pl-2 opacity-0 transition-opacity duration-100 group-hover/field:opacity-100 group-focus-within/field:opacity-100\"\n >\n {copy}\n </span>\n ) : null}\n </div>\n );\n}\n\nexport interface TimedCodeProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, \"children\"> {\n /** The current one-time code (\"123456\"); null while it is being fetched. */\n code: string | null;\n /** When this code stops being valid (epoch ms). */\n validUntilMs: number;\n /** How long each code lasts (30 s for most authenticators). */\n periodSeconds: number;\n /** The clock, for tests (Date.now by default). */\n now?: () => number;\n /** Called once when the code runs out, so the host fetches the next one. */\n onExpire?: () => void;\n}\n\n\n/**\n * The time a code has left, as Passwords draws it: a small pie that empties clockwise from 12\n * o'clock inside a hairline circle (the circle stays when the pie is gone), in the secondary label\n * color — never a spinner's blue arc. Decorative beside the seconds its label says.\n */\nexport function CodeTimer({ fraction, label, className }: { fraction: number; label: string; className?: string }) {\n const f = Math.max(0, Math.min(1, fraction));\n const angle = f * 2 * Math.PI;\n const x = 8 + 6 * Math.sin(angle);\n const y = 8 - 6 * Math.cos(angle);\n const wedge = f >= 0.999 ? null : f <= 0.001 ? \"\" : `M8 8 L8 2 A6 6 0 ${f > 0.5 ? 1 : 0} 1 ${x.toFixed(3)} ${y.toFixed(3)} Z`;\n return (\n <svg viewBox=\"0 0 16 16\" role=\"img\" aria-label={label} data-slot=\"code-timer\" data-fraction={f.toFixed(3)} className={cn(\"size-icon shrink-0\", className)}>\n <circle cx=\"8\" cy=\"8\" r=\"7.25\" fill=\"none\" strokeWidth=\"1\" className=\"stroke-label-tertiary\" />\n {wedge === null ? <circle cx=\"8\" cy=\"8\" r=\"6\" className=\"fill-label-secondary\" /> : wedge ? <path d={wedge} className=\"fill-label-secondary\" /> : null}\n </svg>\n );\n}\n\n/**\n * Passwords' verification code: the code in two groups, in the text face with even digits (never a\n * code face), beside a pie of the time it has left. Ticks once a second while shown.\n */\nexport function TimedCode({ code, validUntilMs, periodSeconds, now = Date.now, onExpire, className, ...props }: TimedCodeProps) {\n const [at, setAt] = React.useState(() => now());\n const expired = React.useRef(false);\n React.useEffect(() => {\n expired.current = false;\n const id = setInterval(() => setAt(now()), 1000);\n return () => clearInterval(id);\n }, [validUntilMs, now]);\n const left = Math.max(0, validUntilMs - at);\n React.useEffect(() => {\n if (left === 0 && !expired.current) {\n expired.current = true;\n onExpire?.();\n }\n }, [left, onExpire]);\n const seconds = Math.ceil(left / 1000);\n const fraction = periodSeconds > 0 ? Math.min(1, left / (periodSeconds * 1000)) : 0;\n return (\n <span data-slot=\"timed-code\" data-seconds-left={seconds} className={cn(\"inline-flex items-center gap-2\", className)} {...props}>\n <span className=\"select-text tabular-nums text-body text-label\">{code ? groupCode(code) : \"●●● ●●●\"}</span>\n <CodeTimer fraction={fraction} label={`${formatDurationMs(seconds * 1000, { style: \"long\" })} left`} />\n </span>\n );\n}\n","import * as ProgressPrimitive from \"@radix-ui/react-progress\";\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` colors 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\nexport interface SparklineProps {\n [data: `data-${string}`]: string | undefined;\n /** Oldest first. Fewer than two values draws nothing but the frame. */\n values: ReadonlyArray<number>;\n /** The top of the graph; defaults to the largest value. */\n max?: number;\n /** A dashed reference line (a capacity, a comfort limit), in the same units as the values. */\n mark?: number;\n /** `level` colors the line by the latest value's fullness (one threshold rule with Meter). */\n kind?: \"level\" | \"progress\";\n /** Axis context: what the top of the graph means (\"100%\", \"16 GB\"). Drawn at the top-right. */\n topLabel?: string;\n /** Axis context: how far back the left edge is (\"1 hour ago\"). The right edge always reads \"Now\". */\n span?: string;\n \"aria-label\": string;\n className?: string;\n}\n\nconst SPARK_W = 300;\nconst SPARK_H = 40;\n\n/** A history line, Activity Monitor's CPU Load and Memory Pressure graphs: stretches to its width. */\nexport function Sparkline({ values, max, mark, kind = \"progress\", topLabel, span, className, \"aria-label\": ariaLabel, ...data }: SparklineProps) {\n const top = Math.max(max ?? 0, ...values, mark ?? 0, 1e-9);\n const y = (v: number) => SPARK_H - 1 - Math.min(1, Math.max(0, v / top)) * (SPARK_H - 2);\n const n = values.length;\n const points = n < 2 ? \"\" : values.map((v, i) => `${((i / (n - 1)) * SPARK_W).toFixed(1)},${y(v).toFixed(1)}`).join(\" \");\n const tone = kind === \"level\" && n ? meterTone(values[n - 1]! / top) : \"progress\";\n const graph = (\n <svg\n {...data}\n role=\"img\"\n aria-label={ariaLabel}\n data-slot=\"sparkline\"\n viewBox={`0 0 ${SPARK_W} ${SPARK_H}`}\n preserveAspectRatio=\"none\"\n className={cn(\n // Activity Monitor's graph: a hairline-framed plot on the content color, the history a\n // filled area under its line (CPU Load's blue, Memory Pressure's green).\n \"block h-10 w-full rounded-control border border-separator bg-content\",\n tone === \"progress\" && \"text-tint\",\n tone === \"normal\" && \"text-system-green\",\n tone === \"warning\" && \"text-system-orange\",\n tone === \"critical\" && \"text-system-red\",\n className,\n )}\n >\n {mark !== undefined ? (\n <line x1={0} x2={SPARK_W} y1={y(mark)} y2={y(mark)} className=\"stroke-label-tertiary\" strokeDasharray=\"3 3\" vectorEffect=\"non-scaling-stroke\" />\n ) : null}\n {points ? <polygon data-slot=\"sparkline-area\" points={`0,${SPARK_H} ${points} ${SPARK_W},${SPARK_H}`} fill=\"currentColor\" fillOpacity={0.28} stroke=\"none\" /> : null}\n {points ? <polyline points={points} fill=\"none\" stroke=\"currentColor\" strokeWidth={1.5} vectorEffect=\"non-scaling-stroke\" /> : null}\n </svg>\n );\n if (!topLabel && !span) return graph;\n // Axis context (Activity Monitor) sits OUTSIDE the plot: the scale on a line above it, the time\n // span underneath, so a label never collides with the line it describes.\n return (\n <div data-slot=\"sparkline-frame\" className=\"flex w-full flex-col gap-0.5\">\n {topLabel ? (\n <div aria-hidden data-slot=\"sparkline-scale\" className=\"text-right text-subheadline tabular-nums text-label-tertiary\">\n {topLabel}\n </div>\n ) : null}\n {graph}\n {span ? (\n <div aria-hidden className=\"flex justify-between text-subheadline text-label-tertiary\">\n <span>{span}</span>\n <span>Now</span>\n </div>\n ) : null}\n </div>\n );\n}\n\nexport interface LevelIndicatorProps {\n [data: `data-${string}`]: string | undefined;\n /** 0 … 100: how much of the scale is lit. `null` while there is no reading (every dot unlit). */\n value: number | null;\n /** How many dots the scale has (Sound's Input level: 15). */\n segments?: number;\n \"aria-label\": string;\n className?: string;\n}\n\n/**\n * NSLevelIndicator's discrete style, as Sound's \"Input level\" draws it: a row of small round dots,\n * lit from the leading edge as the level rises, the rest a quiet fill. Live: the caller feeds it\n * many times a second (a microphone's level); it never animates on its own.\n */\nexport function LevelIndicator({ value, segments = 15, className, \"aria-label\": ariaLabel, ...data }: LevelIndicatorProps) {\n const count = Math.max(1, Math.round(segments));\n const level = value === null ? 0 : Math.min(100, Math.max(0, value));\n const lit = Math.round((level / 100) * count);\n return (\n <div\n {...data}\n role=\"meter\"\n aria-label={ariaLabel}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={value === null ? undefined : Math.round(level)}\n data-slot=\"level-indicator\"\n data-lit={lit}\n className={cn(\"inline-flex items-center gap-1.5\", className)}\n >\n {Array.from({ length: count }, (_, i) => (\n <span key={i} aria-hidden data-on={i < lit ? \"\" : undefined} className={cn(\"size-2 shrink-0 rounded-full\", i < lit ? \"bg-label-secondary\" : \"bg-fill-tertiary\")} />\n ))}\n </div>\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 DISK sizes in decimal units (1 GB = 1,000,000,000 bytes: Finder, Disk\n * Utility) and MEMORY in binary units still labeled \"GB\" (1 GB = 1,073,741,824 bytes: Activity\n * Monitor, About This Mac). `formatBytes` is for files and disks, `formatMemory` for memory; the\n * same 256 GB of RAM never reads \"275 GB\" anywhere.\n *\n * The size, duration and age voices are @ai-matrx/kit/format's, named here for desktop screens. Finder's\n * Date Modified voice is `formatFinderDate`; list date headings are `groupByDateSection`.\n */\n\nimport { formatDurationMs, formatFileSize, formatRelativeTime } from \"@ai-matrx/kit/format\";\n\nconst DAY_MS = 86_400_000;\n\n/** A file or disk size the way Finder shows it: \"45.3 GB\", \"420 MB\", \"512 bytes\". */\nexport function formatBytes(bytes: number | null | undefined): string {\n return formatFileSize(bytes, { base: 1000 });\n}\n\n/** \"3 sec\", \"4 min 5 sec\", \"2 hr 5 min\", \"3 days 4 hr\" — the two largest units. */\nexport function formatDuration(ms: number | null | undefined): string {\n return formatDurationMs(ms, { style: \"long\", parts: 2, abbreviate: true });\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 return formatRelativeTime(at, {\n suffix: false,\n minUnit: \"minute\",\n absoluteAfter: 7 * DAY_MS,\n absolute: \"monthDay\",\n now,\n });\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 disk is used, in the same words everywhere: \"183 GB of 500 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\nconst MEMORY_UNITS = [\"bytes\", \"KB\", \"MB\", \"GB\", \"TB\"] as const;\n\n/**\n * Memory the way Activity Monitor shows it: binary units labeled KB/MB/GB (\"16.26 GB\", \"747.4 MB\",\n * \"256 GB\" for 256 × 2³⁰ bytes). Two decimals in GB, one in MB, none in KB; \".00\" dropped.\n */\nexport function formatMemory(bytes: number | null | undefined): string {\n if (bytes === null || bytes === undefined || !Number.isFinite(bytes)) return \"—\";\n if (bytes < 1024) return `${Math.round(bytes)} ${bytes === 1 ? \"byte\" : \"bytes\"}`;\n let value = bytes;\n let unit = 0;\n while (value >= 1024 && unit < MEMORY_UNITS.length - 1) {\n value /= 1024;\n unit += 1;\n }\n const digits = unit >= 3 ? 2 : unit === 2 ? 1 : 0;\n return `${value.toFixed(digits).replace(/\\.0+$/, \"\")} ${MEMORY_UNITS[unit]}`;\n}\n\n/** How much memory is used, in the same words everywhere: \"149.23 GB of 256 GB in use\". */\nexport function formatMemoryUsage(used: number | null | undefined, total: number | null | undefined): string {\n if (used === null || used === undefined || total === null || total === undefined) return \"—\";\n return `${formatMemory(used)} of ${formatMemory(total)} in use`;\n}\n\n/** Midnight of the day `at` falls on, in the person's own time zone. */\nfunction startOfLocalDay(at: Date): number {\n return new Date(at.getFullYear(), at.getMonth(), at.getDate()).getTime();\n}\n\n/** Whole calendar days from `at` to `now` (0 = the same day, 1 = yesterday), counted across DST changes. */\nfunction calendarDaysAgo(at: Date, now: Date): number {\n return Math.round((startOfLocalDay(now) - startOfLocalDay(at)) / DAY_MS);\n}\n\nfunction toDate(at: Date | number | string | null | undefined): Date | null {\n if (at === null || at === undefined) return null;\n const time = at instanceof Date ? at.getTime() : typeof at === \"string\" ? Date.parse(at) : at;\n return Number.isFinite(time) ? new Date(time) : null;\n}\n\nexport interface FinderDateOptions {\n /** \"Today\" is decided against this (default: the current time). */\n now?: Date | number;\n /** The locale for the day and the time (default: the person's own). */\n locale?: string;\n}\n\n/**\n * Finder's Date Modified / Date Created voice: \"Today at 6:23 AM\", \"Yesterday at 9:10 PM\", else\n * \"Oct 9, 2026 at 6:23 AM\". Days are calendar days in the person's time zone, never 24-hour spans.\n * The ONE copy: a screen never writes its own (guarded in matrx-desktop's unit tests).\n */\nexport function formatFinderDate(at: Date | number | string | null | undefined, options: FinderDateOptions = {}): string {\n const date = toDate(at);\n if (!date) return \"--\";\n const now = options.now === undefined ? new Date() : new Date(options.now);\n const days = calendarDaysAgo(date, now);\n const day =\n days === 0\n ? \"Today\"\n : days === 1\n ? \"Yesterday\"\n : date.toLocaleDateString(options.locale, { month: \"short\", day: \"numeric\", year: \"numeric\" });\n const time = options.locale ? new Intl.DateTimeFormat(options.locale, { hour: \"numeric\", minute: \"2-digit\" }).format(date) : formatClockTime(date);\n return `${day} at ${time}`;\n}\n\n/** Which date section a row falls in (Notes', Mail's and the chats sidebar's list headings). */\nexport type DateSectionKey = \"today\" | \"yesterday\" | \"previous-7-days\" | \"previous-30-days\" | `month:${number}-${number}` | `year:${number}` | \"undated\";\n\nexport interface DateSection {\n key: DateSectionKey;\n /** \"Today\", \"Yesterday\", \"Previous 7 Days\", \"Previous 30 Days\", \"September\", \"2025\", \"No Date\". */\n title: string;\n}\n\n/**\n * The date section of one time, as Apple Notes heads its list: Today, Yesterday, Previous 7 Days,\n * Previous 30 Days, then each earlier month of this year by name (\"September\"), then each earlier\n * year (\"2025\"). Calendar days in the person's time zone; a time ahead of `now` counts as Today.\n */\nexport function dateSectionOf(at: Date | number | string | null | undefined, options: FinderDateOptions = {}): DateSection {\n const date = toDate(at);\n if (!date) return { key: \"undated\", title: \"No Date\" };\n const now = options.now === undefined ? new Date() : new Date(options.now);\n const days = calendarDaysAgo(date, now);\n if (days <= 0) return { key: \"today\", title: \"Today\" };\n if (days === 1) return { key: \"yesterday\", title: \"Yesterday\" };\n if (days <= 7) return { key: \"previous-7-days\", title: \"Previous 7 Days\" };\n if (days <= 30) return { key: \"previous-30-days\", title: \"Previous 30 Days\" };\n if (date.getFullYear() === now.getFullYear()) {\n return { key: `month:${date.getFullYear()}-${date.getMonth() + 1}`, title: date.toLocaleDateString(options.locale, { month: \"long\" }) };\n }\n return { key: `year:${date.getFullYear()}`, title: String(date.getFullYear()) };\n}\n\nexport interface DatedSection<T> extends DateSection {\n items: T[];\n}\n\n/**\n * Rows into their date sections, in the order given (sort newest first before calling): one section\n * per key, in the order its first row appears, each row kept in its own order. Undated rows go last.\n */\nexport function groupByDateSection<T>(\n items: readonly T[],\n whenOf: (item: T) => Date | number | string | null | undefined,\n options: FinderDateOptions = {},\n): DatedSection<T>[] {\n const sections = new Map<DateSectionKey, DatedSection<T>>();\n let undated: DatedSection<T> | null = null;\n for (const item of items) {\n const section = dateSectionOf(whenOf(item), options);\n if (section.key === \"undated\") {\n undated ??= { ...section, items: [] };\n undated.items.push(item);\n continue;\n }\n const existing = sections.get(section.key);\n if (existing) existing.items.push(item);\n else sections.set(section.key, { ...section, items: [item] });\n }\n return undated ? [...sections.values(), undated] : [...sections.values()];\n}\n","\"use client\";\n\n/**\n * @ai-matrx/design-system/desktop — THE DESKTOP STANDARD.\n *\n * A desktop app imports its UI from this entry ONLY (lint-enforced in the app). Everything here is\n * sized by the named scale in `desktop.css`; nothing takes a raw size or color. Rules: DESKTOP.md.\n */\n\n// Foundations\nexport { cn } from \"./cn\";\nexport { MiddleTruncate, Text, TEXT_STYLE_POINTS, TEXT_TONE, type TextProps, type TextTone, type TextVariant } from \"./text\";\nexport { Spinner, type SpinnerProps } from \"./spinner\";\n\n// Controls\nexport { Button, IconButton, LinkButton, buttonVariants, type ButtonProps, type IconButtonProps, type LinkButtonProps } from \"./button\";\nexport { SearchField, TextArea, TextField, FIELD, type SearchFieldProps, type TextAreaProps, type TextFieldProps } from \"./field\";\nexport { Select, type SelectOption, type SelectProps } from \"./select\";\nexport { Segmented, type Segment, type SegmentedProps } from \"./segmented\";\nexport { Checkbox, Switch, type CheckboxProps, type SwitchProps } from \"./controls\";\n\n// Layout\nexport { NoticeSlot, Notices, Page, PageHeader, Toolbar, ToolbarDivider, ToolbarSpacer, type PageHeaderProps, type PageProps, type PageWidth, type ToolbarProps } from \"./layout\";\n// The window layer: OS-drawn symbols, the unified toolbar a title-less PageHeader moves into, and the\n// navigator column of the window's areas (with its Customize sheet).\nexport {\n moveItem,\n NavigatorColumn,\n NavigatorCustomizeSheet,\n NavigatorItem,\n SymbolProvider,\n SystemSymbol,\n ToolbarGroup,\n WindowToolbarActions,\n WindowToolbarProvider,\n WindowToolbarTitle,\n useWindowToolbarFull,\n useWindowToolbarOwnsMore,\n WindowToolbarHostMenu,\n type NavigatorCustomizeItem,\n type NavigatorCustomizeSheetProps,\n type NavigatorItemProps,\n type SymbolImage,\n type SymbolResolver,\n type SymbolWeight,\n type SystemSymbolProps,\n type WindowToolbarTitleProps,\n} from \"./native\";\nexport { FieldRow, Row, Section, SectionContent, type FieldRowProps, type RowProps, type SectionProps } from \"./group\";\n// System Settings pane parts: the pane header, buttons in or under a group, the (i) button, the usage bar, Displays' arrangement.\nexport { DisplayArrangement, InfoButton, PaneHeader, SectionButtons, UsageBar, type ArrangedDisplay, type DisplayArrangementProps, type InfoButtonProps, type PaneHeaderProps, type SectionButtonsProps, type UsageBarProps, type UsageColor, type UsageSegment } from \"./settings\";\n// System Settings' sliders, the \"?\" help button, Screen Time's activity chart and date stepper.\nexport { ActivityChart, DateStepper, GroupTable, HelpButton, Slider, type ActivityBar, type ActivityChartProps, type DateStepperProps, type GroupTableColumn, type GroupTableProps, type GroupTableRow, type HelpButtonProps, type SliderProps } from \"./settings-controls\";\nexport { CodeBlock, TERMINAL_PROFILE, type CodeBlockProps } from \"./code-block\";\n// Activity Monitor's inspector: a utility panel over the window, not a sheet.\nexport { InspectorPanel, type InspectorPanelProps } from \"./inspector-panel\";\n// A toolbar pull-down of actions (Activity Monitor's \"…\" with its arrow).\nexport { PullDownButton, type PullDownButtonProps } from \"./pull-down\";\n// NSToolbar's overflow: items that do not fit move, lowest priority first, into a » menu.\nexport { ToolbarOverflow, type ToolbarOverflowItem, type ToolbarOverflowProps } from \"./toolbar-overflow\";\n// The document apps' parts (Get Info, Reminders, the empty Notes list, the status bar, Simulator's\n// device, FileMerge's panes).\nexport {\n ChecklistAddRow,\n ChecklistRow,\n CompareLines,\n CompareView,\n type CompareChange,\n DeviceFrame,\n Disclosure,\n EmptyContent,\n InfoFacts,\n InfoHeader,\n ListHeading,\n SourceText,\n StatusBar,\n type SourceLanguage,\n type ChecklistAddRowProps,\n type ChecklistRowProps,\n type CompareLinesProps,\n type ComparePane,\n type CompareViewProps,\n type DeviceFrameProps,\n type DisclosureProps,\n type EmptyContentProps,\n type InfoFact,\n type InfoFactsProps,\n type InfoHeaderProps,\n type ListHeadingProps,\n type ListColor,\n type StatusBarProps,\n} from \"./document\";\n// The monitor apps' parts (Activity Monitor's summary strip, System Information's facts, Finder's\n// path bar, Console's scope bar).\nexport {\n FactList,\n PathBar,\n ScopeBar,\n SummaryFact,\n SummaryPane,\n SummaryStrip,\n type Fact,\n type FactListProps,\n type PathBarItem,\n type Scope,\n type ScopeBarProps,\n type SummaryFactProps,\n type SummaryPaneProps,\n} from \"./monitor\";\nexport { CONSOLE_LINE_PX, LogView, LOG_LINE_PX, type LogColumns, type LogLine, type LogViewProps } from \"./log-view\";\nexport { IconView, IconViewItem, type IconViewItemProps, type IconViewProps } from \"./icon-view\";\nexport { ColumnBrowser, type ColumnBrowserColumn, type ColumnBrowserProps } from \"./column-browser\";\nexport { QuickLookSheet, type QuickLookSheetProps } from \"./quick-look\";\nexport { baseNameEnd, RenameField, type RenameFieldProps } from \"./rename-field\";\nexport { DataTable, NameCell, StateCell, type StateCellProps, columnKind, initiallyHiddenColumns, type ColumnKind, type NameCellProps, type Column, type DataTableProps, type RowAction, type RowMenuItem, type SortState, type TableGroups } from \"./table\";\nexport { ClearFiltersButton, EMPTY_TABLE_FILTER, TableFilterBar, TableFilterMenu, TableFilterTokens, columnName, filterActive, filterChoices, filterRows, filterValues, tableFilters, type ColumnFilter, type ColumnValuesFilter, type FilterChoice, type FilterableColumn, type TableFilterBarProps, type TableFilterMenuProps, type TableFilterState } from \"./table-filter\";\nexport { ContextMenuEntries, DropdownMenuEntries, MenuItemLabel } from \"./menu-entries\";\nexport {\n SourceList,\n SourceListItem,\n SourceListMore,\n SourceListSection,\n type SourceListProps,\n type SourceListItemProps,\n type SourceListMoreProps,\n type SourceListSectionProps,\n} from \"./source-list\";\n// Mail's, Messages' and Notes' window body: the split view and its message list.\nexport { MessageList, UnreadDot, type MessageListProps } from \"./message-list\";\nexport { SplitView, type SplitViewProps } from \"./split-view\";\n// NSSplitView's lower pane: a pane under the content whose top edge the person drags (Console's detail, a server's log).\nexport { ResizablePane, type ResizablePaneProps } from \"./resizable-pane\";\nexport { EdgeResizer, type EdgeResizerProps } from \"./edge-resizer\";\n// Messages' and FaceTime's parts: the avatar, the centered conversation header, the composer, the call buttons.\nexport { Avatar, CallButton, ConversationHeader, MessageComposer, type AvatarProps, type CallButtonProps, type ConversationHeaderProps, type MessageComposerProps } from \"./conversation\";\n// Voice Memos' parts: the waveform with its playhead (and the peaks it draws), the Record button.\nexport { peaksOf, RecordButton, Waveform, type RecordButtonProps, type WaveformProps } from \"./media\";\n\n// Data and placeholders\nexport { Resource, type ResourceProps, type ResourceState } from \"./resource\";\nexport { ComingSoon, type ComingSoonProps } from \"./coming-soon\";\nexport { SymbolTile, tileColorFor, type SymbolTileColor, type SymbolTileProps, type SymbolTileSize } from \"./tile\";\n// Shortcuts' library (a grid of colored tiles with a run button), App Store's shelves, lockups, Get\n// capsule, download ring, product header and info strip, and Passwords' detail (head and fields).\nexport { ShortcutTile, TileGrid, type ShortcutTileProps, type TileGridProps } from \"./library\";\n// Safari's Start Page (an empty browser tab): sections of favorite tiles.\nexport { FavoriteTile, StartPage, StartPageSection, type FavoriteTileProps, type StartPageProps, type StartPageSectionProps } from \"./start-page\";\nexport {\n GetButton,\n InfoStrip,\n ProgressRing,\n StoreHeader,\n StoreLockup,\n StoreShelf,\n type GetButtonProps,\n type GetButtonState,\n type InfoStripItem,\n type InfoStripProps,\n type ProgressRingProps,\n type StoreHeaderProps,\n type StoreLockupProps,\n type StoreShelfProps,\n} from \"./store\";\nexport { CREDENTIAL_DOTS, CredentialField, CredentialFields, CredentialHeader, TimedCode, type CredentialFieldProps, type CredentialHeaderProps, type TimedCodeProps } from \"./credentials\";\n\n// Status and feedback\nexport { Banner, ErrorBanner, StateView, type BannerProps, type BannerTone, type ErrorBannerProps, type StateViewProps } from \"./state\";\nexport { LevelIndicator, Meter, METER_THRESHOLDS, meterTone, Sparkline, type LevelIndicatorProps, type MeterProps, type SparklineProps } from \"./meter\";\nexport { Kbd, PlaceMark, PlaceStrip, RemovableTag, StatusLight, Tag, type PlaceMarkProps, type RemovableTagProps, type PlaceMarkState, type StatusLightProps, type StatusTone as StatusLightTone, type TagProps, type TagTone } from \"./tag\";\n\n// Errors: the one wording layer (an actionable cause; the raw text kept as detail).\nexport { describeError, type DescribedError } from \"./errors\";\n\n// Formatting\nexport {\n dateSectionOf,\n errorMessage,\n formatAge,\n formatBytes,\n formatClockTime,\n formatDuration,\n formatFinderDate,\n formatMemory,\n formatMemoryUsage,\n formatUsage,\n groupByDateSection,\n type DatedSection,\n type DateSection,\n type DateSectionKey,\n type FinderDateOptions,\n} from \"./format\";\n/** Counts (tokens, rows): the one count voice, \"1,234,567\" or compact \"1.2m\" (kit).*/\nexport { formatCount, formatRelativeTime } from \"@ai-matrx/kit/format\";\n\n// Overlays and menus: the shared Radix primitives, unchanged.\nexport { clipTooltipText, Tooltip, TooltipProvider, TooltipTrigger, TOOLTIP_TEXT_BUDGET, type TooltipContentProps } from \"../tooltip\";\nexport { TooltipContent } from \"./tooltip\";\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from \"../dropdown-menu\";\nexport {\n ContextMenu,\n ContextMenuContent,\n ContextMenuItem,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuTrigger,\n} from \"../context-menu\";\nexport { Dialog, DialogClose, DialogTrigger } from \"../dialog\";\n// Dialogs are macOS sheets: attached to the window under the toolbar, desktop type and density.\nexport { ConfirmDialog, DialogBody, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, NativeConfirmProvider, type NativeConfirm, type NativeConfirmRequest } from \"./sheet\";\nexport type { ConfirmDialogProps } from \"../confirm-dialog\";\nexport { ConfirmDialogHost } from \"../confirm-host\";\nexport { Popover, PopoverAnchor, PopoverTrigger } from \"../popover\";\n// NSPopover's look (rounded material panel with an arrow); the web keeps the shared PopoverContent.\nexport { PopoverContent, POPOVER_ARROW, type DesktopPopoverContentProps } from \"./popover\";\nexport { ListRow, type ListRowProps } from \"./list-row\";\nexport { InfoHint, INFO_HINT_MAX, infoHintText, type InfoHintProps } from \"./info-hint\";\nexport { Collapsible, CollapsibleContent, CollapsibleTrigger } from \"../collapsible\";\nexport { Skeleton } from \"../skeleton\";\n\n// App shell (rail, mode switch) and identity.\nexport * from \"../app-shell/index\";\nexport { OrganizationMark, organizationColor } from \"../organization-picker\";\nexport { OrganizationPickerSheet, type DesktopPickerOrganization, type OrganizationPickerSheetProps } from \"./organization-picker\";\n","\"use client\";\n\n/**\n * The desktop's popover: NSPopover's look over the shared Radix popover (`../popover`), which the\n * web keeps as it is. A rounded 12 pt panel of translucent, blurred popover material with the\n * popover shadow and an arrow pointing at what opened it (the arrow is on by default; `arrow={false}`\n * for a popover anchored to nothing visible). The body scrolls inside the panel, so the arrow is\n * never clipped. Same props as the shared PopoverContent.\n */\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { PopoverContent as BasePopoverContent, type PopoverContentProps as BasePopoverContentProps } from \"../popover\";\n\nexport interface DesktopPopoverContentProps extends BasePopoverContentProps {\n /** NSPopover's arrow toward the anchor. Default true. */\n arrow?: boolean;\n}\n\n/** Arrow size (pt): NSPopover's is about 18 wide, 9 tall. */\nexport const POPOVER_ARROW = { width: 18, height: 9 } as const;\n\nexport const PopoverContent = React.forwardRef<React.ComponentRef<typeof PopoverPrimitive.Content>, DesktopPopoverContentProps>(\n ({ arrow = true, sideOffset, className, children, ...props }, ref) => (\n <BasePopoverContent\n ref={ref}\n sideOffset={sideOffset ?? (arrow ? POPOVER_ARROW.height + 2 : 4)}\n data-slot=\"desktop-popover\"\n data-arrow={arrow ? \"\" : undefined}\n // The panel itself never scrolls (it would clip the arrow): its body does.\n className={cn(\"overflow-visible\", className)}\n {...props}\n >\n <div data-slot=\"desktop-popover-body\" className=\"overflow-y-auto overscroll-contain\">\n {children}\n </div>\n {arrow ? <PopoverPrimitive.Arrow data-slot=\"desktop-popover-arrow\" width={POPOVER_ARROW.width} height={POPOVER_ARROW.height} /> : null}\n </BasePopoverContent>\n ),\n);\nPopoverContent.displayName = \"DesktopPopoverContent\";\n","\"use client\";\n\n/**\n * One row of a list in a popover, a sidebar-less list or an inspector (Safari's Downloads, Control\n * Center's lists): a leading icon, a title, secondary text under it, and a trailing accessory (a\n * button, a progress ring, a chevron). With `onSelect` the row is one button (the accessory's own\n * controls stay separate); without it, a plain row. 13 pt title, secondary at the same size in the\n * secondary label color.\n */\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { Tile } from \"../controls/surfaces\";\n\nexport interface ListRowProps {\n /** Leading icon or tile (an SF Symbol, a file icon). */\n icon?: React.ReactNode;\n title: React.ReactNode;\n /** The line under the title (size, status, where it is). */\n secondary?: React.ReactNode;\n /** Trailing control or status (a Show in Finder button, progress, a chevron). */\n accessory?: React.ReactNode;\n /** Makes the row itself a button. */\n onSelect?: () => void;\n selected?: boolean;\n disabled?: boolean;\n className?: string;\n \"aria-label\"?: string;\n}\n\nexport function ListRow({ icon, title, secondary, accessory, onSelect, selected = false, disabled = false, className, \"aria-label\": ariaLabel }: ListRowProps): React.JSX.Element {\n const body = (\n <>\n {icon ? (\n <span data-slot=\"list-row-icon\" className=\"flex size-icon-xl shrink-0 items-center justify-center\">\n {icon}\n </span>\n ) : null}\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span data-slot=\"list-row-title\" className={cn(\"truncate text-body\", disabled ? \"text-label-tertiary\" : \"text-label\")}>\n {title}\n </span>\n {secondary ? (\n <span data-slot=\"list-row-secondary\" className={cn(\"truncate text-body\", disabled ? \"text-label-quaternary\" : \"text-label-secondary\")}>\n {secondary}\n </span>\n ) : null}\n </span>\n </>\n );\n const rowClass = cn(\n \"flex min-h-row w-full items-center gap-2 rounded-control px-2 py-1 text-left\",\n selected && \"bg-selection-muted\",\n className,\n );\n return (\n <div data-slot=\"list-row\" data-selected={selected ? \"\" : undefined} className={onSelect ? \"flex items-center gap-1\" : rowClass}>\n {onSelect ? (\n <Tile type=\"button\" data-slot=\"list-row-button\" aria-label={ariaLabel} title={body} selected={selected} disabled={disabled} onClick={onSelect} className=\"min-w-0 flex-1\" variant=\"quiet\" hoverStyle=\"fill\" />\n ) : (\n body\n )}\n {accessory ? (\n <span data-slot=\"list-row-accessory\" className=\"flex shrink-0 items-center gap-1\">\n {accessory}\n </span>\n ) : null}\n </div>\n );\n}\n","\"use client\";\n\n/**\n * A small hint beside a setting or a heading (System Settings' ⓘ): an info.circle in the secondary\n * label color that opens a native popover (the desktop PopoverContent: material, arrow) with one\n * or two sentences. A real button, so Tab reaches it and Space/Return opens it; its accessible label\n * says what it explains. The text is a hint, not documentation: at most INFO_HINT_MAX characters.\n * A longer text is cut there with an ellipsis AND reported with console.error naming the hint, so it\n * is never a silent cut.\n */\nimport * as React from \"react\";\n\nimport { Popover, PopoverTrigger } from \"../popover\";\nimport { SystemSymbol } from \"./native\";\nimport { Button } from \"../controls/controls\";\nimport { PopoverContent } from \"./popover\";\n\nexport const INFO_HINT_MAX = 140;\n\nexport interface InfoHintProps {\n /** What the hint explains, for the accessible label (\"About Start with the app\"). */\n label: string;\n /** The hint itself: one or two sentences, at most INFO_HINT_MAX characters. */\n text: string;\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n className?: string;\n}\n\n/** The text as shown: itself, or cut at INFO_HINT_MAX with an ellipsis (and reported). */\nexport function infoHintText(label: string, text: string): string {\n if (text.length <= INFO_HINT_MAX) return text;\n console.error(`[InfoHint] \"${label}\": the hint is ${text.length} characters; the cap is ${INFO_HINT_MAX}. It is cut. Shorten it.`);\n return `${text.slice(0, INFO_HINT_MAX - 1).trimEnd()}…`;\n}\n\nfunction InfoGlyph(): React.JSX.Element {\n return (\n <svg viewBox=\"0 0 16 16\" className=\"size-icon-sm\" aria-hidden=\"true\">\n <circle cx=\"8\" cy=\"8\" r=\"6.5\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.2\" />\n <circle cx=\"8\" cy=\"5\" r=\"0.9\" fill=\"currentColor\" />\n <rect x=\"7.4\" y=\"6.8\" width=\"1.2\" height=\"4.6\" rx=\"0.6\" fill=\"currentColor\" />\n </svg>\n );\n}\n\nexport function InfoHint({ label, text, side = \"top\", className }: InfoHintProps): React.JSX.Element {\n const shown = React.useMemo(() => infoHintText(label, text), [label, text]);\n return (\n <Popover>\n <PopoverTrigger asChild>\n <Button\n type=\"button\"\n variant=\"quiet\"\n aria-label={label}\n icon={<SystemSymbol name=\"info.circle\" size={13} fallback={<InfoGlyph />} />}\n data-slot=\"info-hint\"\n className={className}\n />\n </PopoverTrigger>\n <PopoverContent side={side} width=\"sm\" padding=\"sm\" data-info-hint-popover=\"\" aria-label={label}>\n <p className=\"text-body text-label\">{shown}</p>\n </PopoverContent>\n </Popover>\n );\n}\n","import * as React from \"react\";\n\nimport { Dialog } from \"../dialog\";\nimport { StarIcon } from \"../icons\";\nimport { matchesOrganizationQuery, OrganizationMark, orderOrganizationsForPicker } from \"../organization-picker\";\nimport { Button, IconButton } from \"./button\";\nimport { SearchField } from \"./field\";\nimport { SystemSymbol } from \"./native\";\nimport { DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from \"./sheet\";\nimport { StateView } from \"./state\";\nimport { DataTable, type Column } from \"./table\";\nimport { Text } from \"./text\";\n\n/**\n * \"Other organizations…\": the desktop organization picker, as Wi-Fi › Other Networks is a sheet\n * over the window — a search field, a table (a star column, Name, Role; headers sort), and Cancel /\n * Switch (the default, primary). The order and the search are the root OrganizationPicker's own\n * (`orderOrganizationsForPicker`, `matchesOrganizationQuery`): favorites, then the person's own,\n * then the rest. The star favorites; it never selects (a sibling of the row's choice, as in the\n * web picker). It picks nothing on its own: Switch hands the chosen row to the host.\n */\n\nexport interface DesktopPickerOrganization {\n id: string;\n name: string;\n abbreviation?: string | null;\n logoUrl?: string | null;\n /** owner | admin | member */\n role?: string | null;\n isOwn?: boolean;\n}\n\nexport interface OrganizationPickerSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n organizations: readonly DesktopPickerOrganization[];\n activeOrganizationId: string | null;\n favoriteOrganizationIds: readonly string[];\n /** Switch to the chosen organization (the sheet closes). */\n onSwitch: (organizationId: string) => void;\n /** Star (true) or unstar (false). Omit to draw the stars read-only. */\n onToggleFavorite?: (organizationId: string, favorite: boolean) => void;\n}\n\nconst ROLE: Record<string, string> = { owner: \"Owner\", admin: \"Admin\", member: \"Member\" };\n\nfunction roleLabel(role: string | null | undefined): string {\n return (role && ROLE[role]) || (role ? role.charAt(0).toUpperCase() + role.slice(1) : \"Member\");\n}\n\nexport function OrganizationPickerSheet({\n open,\n onOpenChange,\n organizations,\n activeOrganizationId,\n favoriteOrganizationIds,\n onSwitch,\n onToggleFavorite,\n}: OrganizationPickerSheetProps) {\n const [query, setQuery] = React.useState(\"\");\n const [chosen, setChosen] = React.useState<string | null>(activeOrganizationId);\n React.useEffect(() => {\n if (open) {\n setQuery(\"\");\n setChosen(activeOrganizationId);\n }\n }, [open, activeOrganizationId]);\n\n const favorites = new Set(favoriteOrganizationIds);\n const rows = orderOrganizationsForPicker(organizations, favoriteOrganizationIds).filter((o) => matchesOrganizationQuery(o, query));\n const columns: Column<DesktopPickerOrganization>[] = [\n {\n key: \"favorite\",\n header: <span className=\"sr-only\">Favorite</span>,\n title: \"Favorite\",\n kind: \"action\",\n cell: (o) => {\n const on = favorites.has(o.id);\n const label = on ? `Remove ${o.name} from favorites` : `Add ${o.name} to favorites`;\n return onToggleFavorite ? (\n <IconButton\n data-org-favorite={on ? \"on\" : \"off\"}\n aria-pressed={on}\n size=\"sm\"\n label={label}\n icon={<SystemSymbol name={on ? \"star.fill\" : \"star\"} size={12} fallback={<StarIcon className={on ? \"size-icon-sm fill-current\" : \"size-icon-sm\"} />} />}\n onClick={(event) => {\n event.stopPropagation();\n onToggleFavorite(o.id, !on);\n }}\n />\n ) : on ? (\n <SystemSymbol name=\"star.fill\" size={12} aria-label=\"Favorite\" fallback={<StarIcon className=\"size-icon-sm fill-current\" />} />\n ) : null;\n },\n sort: (a, b) => Number(favorites.has(b.id)) - Number(favorites.has(a.id)),\n },\n {\n key: \"name\",\n header: \"Name\",\n kind: \"flex\",\n cell: (o) => (\n <span className=\"flex min-w-0 items-center gap-2\">\n <OrganizationMark id={o.id} name={o.name} abbreviation={o.abbreviation} logoUrl={o.logoUrl} size={16} />\n <Text truncate>{o.name}</Text>\n </span>\n ),\n sort: (a, b) => a.name.localeCompare(b.name),\n },\n { key: \"role\", header: \"Role\", kind: \"text\", cell: (o) => roleLabel(o.role), sort: (a, b) => roleLabel(a.role).localeCompare(roleLabel(b.role)) },\n ];\n\n const canSwitch = chosen !== null && chosen !== activeOrganizationId && organizations.some((o) => o.id === chosen);\n return (\n <Dialog modal open={open} onOpenChange={onOpenChange}>\n <DialogContent data-organization-sheet=\"\" className=\"max-w-form\">\n <DialogHeader>\n <DialogTitle>Choose an organization</DialogTitle>\n <DialogDescription>Everything you make goes into the organization you choose.</DialogDescription>\n </DialogHeader>\n <SearchField data-organization-search aria-label=\"Search organizations\" value={query} onValueChange={setQuery} />\n <div className=\"max-h-80 overflow-y-auto\">\n <DataTable\n aria-label=\"Organizations\"\n columns={columns}\n rows={rows}\n rowKey={(o) => o.id}\n selectedKey={chosen}\n onRowSelect={(o) => setChosen(o.id)}\n onRowOpen={(o) => {\n onSwitch(o.id);\n onOpenChange(false);\n }}\n rowData={(o) => ({ \"data-organization-row\": o.id, \"data-active\": o.id === activeOrganizationId ? \"true\" : undefined })}\n empty={<StateView kind=\"empty\" title=\"No matches\" />}\n />\n </div>\n <DialogFooter>\n <Button data-organization-cancel onClick={() => onOpenChange(false)}>\n Cancel\n </Button>\n <Button\n data-organization-switch\n variant=\"primary\"\n disabled={!canSwitch}\n onClick={() => {\n if (!chosen) return;\n onSwitch(chosen);\n onOpenChange(false);\n }}\n >\n Switch\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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A,OACF;AAAA,KACF,GACF;AAEJ;","names":["cn","Text","Tag","cn","jsx","cn","React","React","jsx","TooltipContent","jsx","jsxs","Button","cn","IconButton","TooltipContent","LinkButton","React","jsx","jsxs","TextField","cn","TextArea","SearchField","jsx","jsxs","cn","jsx","cn","React","jsx","Checkbox","cn","Switch","React","React","React","jsx","jsxs","DialogContent","cn","DialogHeader","DialogFooter","DialogTitle","DialogDescription","Button","jsx","jsxs","key","cn","NavigatorItem","TooltipContent","item","DialogContent","DialogHeader","DialogTitle","DialogDescription","DialogFooter","Button","Fragment","jsx","jsxs","cn","Page","React","Fragment","jsx","jsxs","cn","Row","field","React","jsx","jsxs","cn","InfoButton","jsx","jsxs","cn","React","jsx","cn","React","createPortal","jsx","jsxs","createPortal","cn","React","Fragment","jsx","jsxs","item","Fragment","jsx","jsxs","cn","TooltipContent","React","jsx","jsxs","style","item","cn","React","jsx","jsxs","cn","merge","React","jsx","jsxs","cn","item","React","jsx","jsxs","cn","Button","jsx","jsxs","cn","React","jsx","jsxs","item","cn","key","jsx","jsxs","DialogContent","DialogTitle","DialogDescription","Button","React","jsx","cn","React","jsx","jsxs","cn","React","jsx","jsxs","cn","Button","copied","React","Fragment","jsx","jsxs","key","Button","cn","Fragment","jsx","jsxs","bar","key","cn","outline","Button","React","jsx","jsxs","cn","SourceListItem","React","Fragment","jsx","jsxs","key","list","cn","jsx","jsxs","cn","React","jsx","jsxs","cn","jsx","STEP","cn","jsx","jsxs","cn","React","jsx","jsxs","cn","RecordButton","copyText","Fragment","jsx","jsxs","Button","copyText","jsx","jsxs","cn","jsx","SIZE","key","cn","React","Fragment","jsx","jsxs","cn","TooltipContent","jsx","jsxs","cn","React","jsx","jsxs","cn","TooltipContent","item","React","jsx","jsxs","cn","jsx","jsxs","cn","formatDurationMs","item","formatRelativeTime","React","jsx","jsxs","PopoverContent","Fragment","jsx","jsxs","React","jsx","jsxs","InfoGlyph","PopoverContent","React","jsx","jsxs","DialogContent","DialogHeader","DialogTitle","DialogDescription","DialogFooter","Button"]}
|
|
1
|
+
{"version":3,"sources":["../src/desktop/cn.ts","../src/desktop/text.tsx","../src/desktop/spinner.tsx","../src/desktop/button.tsx","../src/desktop/tooltip.tsx","../src/desktop/field.tsx","../src/desktop/select.tsx","../src/desktop/segmented.tsx","../src/desktop/controls.tsx","../src/desktop/layout.tsx","../src/desktop/native.tsx","../src/desktop/sheet.tsx","../src/desktop/group.tsx","../src/desktop/settings.tsx","../src/desktop/settings-controls.tsx","../src/desktop/code-block.tsx","../src/desktop/inspector-panel.tsx","../src/desktop/pull-down.tsx","../src/desktop/menu-entries.tsx","../src/desktop/toolbar-overflow.tsx","../src/desktop/document.tsx","../src/desktop/monitor.tsx","../src/desktop/log-view.tsx","../src/desktop/icon-view.tsx","../src/desktop/column-browser.tsx","../src/desktop/quick-look.tsx","../src/desktop/rename-field.tsx","../src/desktop/table.tsx","../src/desktop/tag.tsx","../src/desktop/state.tsx","../src/desktop/errors.ts","../src/desktop/table-filter.tsx","../src/desktop/source-list.tsx","../src/desktop/message-list.tsx","../src/desktop/split-view.tsx","../src/desktop/resizable-pane.tsx","../src/desktop/edge-resizer.tsx","../src/desktop/conversation.tsx","../src/desktop/media.tsx","../src/desktop/resource.tsx","../src/desktop/coming-soon.tsx","../src/desktop/tile.tsx","../src/desktop/library.tsx","../src/desktop/start-page.tsx","../src/desktop/store.tsx","../src/desktop/credentials.tsx","../src/desktop/meter.tsx","../src/desktop/format.ts","../src/desktop/index.ts","../src/desktop/popover.tsx","../src/desktop/list-row.tsx","../src/desktop/info-hint.tsx","../src/desktop/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 color) 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 \"sidebar-row-tall\",\n \"row-table\",\n \"table-header\",\n \"navigator-item\",\n \"row\",\n \"row-tall\",\n \"toolbar\",\n \"icon-sm\",\n \"icon\",\n \"icon-lg\",\n \"icon-xl\",\n ],\n radius: [\"control\", \"tile\", \"group\", \"panel\"],\n container: [\"form\", \"page\", \"wide\"],\n text: [\"title-large\", \"title-1\", \"title-2\", \"title-3\", \"headline\", \"body\", \"callout\", \"subheadline\", \"footnote\", \"caption\", \"caption-2\", \"code\", \"table-header\"],\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/**\n * Apple's macOS text styles (HIG, NSFont.TextStyle). Nothing else sets a font size in desktop app\n * code. Content text is 13 pt (body) or larger; the styles under 13 pt (callout, subheadline,\n * footnote, caption, caption-2) belong to components (a toolbar subtitle, a tag, a chart's axis),\n * and the app lint refuses them in screens: secondary text is `tone=\"secondary\"` at body size.\n */\nexport type TextVariant =\n | \"title-large\"\n | \"title-1\"\n | \"title-2\"\n | \"title-3\"\n | \"headline\"\n | \"body\"\n | \"callout\"\n | \"subheadline\"\n | \"footnote\"\n | \"caption\"\n | \"caption-2\";\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 subheadline: \"text-subheadline\",\n footnote: \"text-footnote\",\n caption: \"text-caption\",\n \"caption-2\": \"text-caption-2\",\n};\n\n/** Each text style's point size, for a library that takes a number (a terminal's font size); CSS\n * and screens use the styles themselves. Matches desktop.css. */\nexport const TEXT_STYLE_POINTS = {\n \"title-large\": 26,\n \"title-1\": 22,\n \"title-2\": 17,\n \"title-3\": 15,\n headline: 13,\n body: 13,\n callout: 12,\n subheadline: 11,\n footnote: 10,\n caption: 10,\n \"caption-2\": 10,\n code: 13,\n} as const;\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 /** The style's emphasized weight (HIG): bold titles, heavy headline, semibold body, medium caption. */\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 data-variant={variant}\n data-emphasized={emphasized || undefined}\n className={cn(\n VARIANT[variant],\n TEXT_TONE[tone],\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\n/**\n * One line cut in the MIDDLE, as AppKit does for names, paths and identifiers\n * (NSLineBreakByTruncatingMiddle: About's Name, Finder's long file names): the start and the end\n * stay readable (\"dsm12-dh255-32…4c71a2\"), the whole text is the hover tooltip. Short text draws whole.\n */\nexport function MiddleTruncate({ text, tail = 8, className, ...props }: Omit<React.HTMLAttributes<HTMLSpanElement>, \"children\"> & { text: string; tail?: number }) {\n // One line: runs of white space read as one space (what `nowrap` drew before).\n const line = text.replace(/\\s+/g, \" \");\n const cut = line.length > tail * 2 ? line.length - tail : line.length;\n // The two pieces are flex items, and a flex item drops the white space at its own start and end\n // under `nowrap`: a cut beside a space drew \"Sign in toMatrx 2\". `whitespace-pre` keeps it (the\n // line holds no newlines, so it still never wraps).\n return (\n <span data-slot=\"middle-truncate\" title={text} className={cn(\"inline-flex min-w-0 max-w-full whitespace-pre\", className)} {...props}>\n <span data-slot=\"middle-truncate-head\" className=\"min-w-0 overflow-hidden text-ellipsis whitespace-pre\">\n {line.slice(0, cut)}\n </span>\n {cut < line.length ? (\n <span data-slot=\"middle-truncate-tail\" className=\"shrink-0 whitespace-pre\">\n {line.slice(cut)}\n </span>\n ) : null}\n </span>\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, TooltipTrigger } from \"../tooltip\";\nimport { TooltipContent } 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 * - `link`: a borderless accent-colored action under a placeholder (Console's \"Start streaming\"\n * under \"No Messages\"); never in a toolbar or a form.\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 // Disabled, the default button is drawn as AppKit draws it: the standard bordered bezel,\n // dimmed, the same as its secondary peers; never a filled gray block beside outlined ones.\n primary:\n \"bg-tint text-tint-label shadow-control hover:brightness-110 active:brightness-95 disabled:bg-control disabled:text-label\",\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 link: \"bg-transparent text-tint hover:brightness-125 active:brightness-90\",\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 data-variant={variant ?? \"secondary\"}\n // AppKit metrics on every pointer and window width: the web kit's 44 px touch floor (a dialog\n // footer under 1024 px wide lifted a sheet's Cancel and Done to 44 px squares) never applies.\n data-touch-exempt=\"\"\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 shown or hidden, 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 data-touch-exempt=\"\"\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\nexport interface LinkButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Render the child (an `<a>` or a router `Link`) with the link's look, for a real navigation. */\n asChild?: boolean;\n /**\n * A name in a table row (a chat, an account): the surrounding text's own color at rest (a row\n * of names is not a column of blue), the accent and an underline only under the pointer or\n * focus, as Mail's and Finder's clickable names. A link in a line of prose stays the accent.\n */\n quiet?: boolean;\n}\n\n/**\n * AppKit's borderless link-style button (an NSButton drawn as accent text: Settings' \"Learn more…\",\n * Finder's \"Show\"): an action that sits in a line of text, at the text's own size and weight, with\n * no bezel, no padding and no fixed height. Use it for a clickable name in prose or a fact (an\n * account, a project, a chat). For an accent action under an empty placeholder use\n * `Button variant=\"link\"` (a control-sized button); never in a toolbar or a form.\n */\nexport const LinkButton = React.forwardRef<HTMLButtonElement, LinkButtonProps>(function LinkButton(\n { asChild, quiet = false, className, 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=\"link-button\"\n data-quiet={quiet ? \"\" : undefined}\n data-touch-exempt=\"\"\n className={cn(\n \"focus-ring inline cursor-pointer rounded-control border-0 bg-transparent p-0 text-left disabled:pointer-events-none disabled:opacity-40\",\n quiet\n ? \"underline-offset-2 hover:text-tint hover:underline focus-visible:text-tint focus-visible:underline\"\n : \"text-tint hover:brightness-125 active:brightness-90\",\n className,\n )}\n {...props}\n />\n );\n});\n","import * as React from \"react\";\n\nimport { TooltipContent as BaseTooltipContent, type TooltipContentProps } from \"../tooltip\";\n\n/**\n * The desktop tooltip opens BELOW its control, as macOS draws them (the pointer sits on the\n * control, the hint hangs under it): a tooltip above a row near the top would cover the toolbar.\n * In a vertical stack (an icon column, a list) it opens beside the control instead, never over the\n * next one (THE SMART SIDE, title-tooltips.ts). It flips when there is no room and stays inside the\n * window. A desktop host sets `data-title-side=\"bottom\"` on <html> so `title` tooltips agree.\n */\nexport const TooltipContent = React.forwardRef<React.ComponentRef<typeof BaseTooltipContent>, TooltipContentProps>(\n function TooltipContent({ fallbackSide = \"bottom\", ...props }, ref) {\n return <BaseTooltipContent ref={ref} fallbackSide={fallbackSide} {...props} />;\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:font-sans 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","import * as SelectPrimitive from \"@radix-ui/react-select\";\nimport * as React from \"react\";\n\nimport { ChevronsUpDownIcon } from \"../icons\";\nimport { SelectContent, SelectItem, SelectLabel, SelectSeparator } from \"../select\";\nimport { cn } from \"./cn\";\n\nexport interface SelectOption {\n value: string;\n label: React.ReactNode;\n /** Short trailing text in the menu only (a size, why it cannot be chosen); the trigger shows only `label`. */\n meta?: string;\n /** A section heading: the menu shows it above the first option of each consecutive run with this group. */\n group?: string;\n disabled?: boolean;\n}\n\n/**\n * Options are EXACT: a field this Select does not draw is a type error, never silently dropped (a\n * renderer once handed `group`/`meta` to a Select that had neither, and a whole heading never showed).\n */\nexport type ExactSelectOption<O> = O extends object ? O & { [K in Exclude<keyof O, keyof SelectOption>]: never } : O;\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 /** A value only another place can change (the OS's own pane): the value reads at full strength as\n * the setting it is, only the chevrons dim, and it never opens. `title` says where it changes.\n * Never `disabled` for this: a dimmed value reads as off, the content people came for lost. */\n readOnly?: boolean;\n /** `push` (default): the raised pop-up button. `inline`: System Settings' pop-up in a row's\n * trailing edge (\"Do Nothing ⌃⌄\"): the value as text and the up/down chevrons in a small capsule,\n * no bezel until pressed. */\n appearance?: \"push\" | \"inline\";\n /** The tooltip (why it is off, where it changes). */\n title?: string;\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<O extends SelectOption | \"-\">(props: Omit<SelectProps, \"options\"> & { options: ReadonlyArray<ExactSelectOption<O>> }): React.JSX.Element;\nexport function Select({\n value,\n onValueChange,\n options,\n placeholder,\n size = \"md\",\n disabled,\n readOnly = false,\n appearance = \"push\",\n title,\n id,\n className,\n \"aria-label\": ariaLabel,\n ...data\n}: SelectProps): React.JSX.Element {\n const inline = appearance === \"inline\";\n // Read-only is not disabled: the value keeps the label color; the trigger simply never opens.\n const locked = readOnly && !disabled;\n return (\n <SelectPrimitive.Root {...(value === undefined ? {} : { value })} onValueChange={onValueChange} disabled={(disabled ?? false) || readOnly}>\n <SelectPrimitive.Trigger\n {...data}\n id={id}\n aria-label={ariaLabel}\n title={title}\n data-slot=\"select\"\n data-appearance={appearance}\n data-read-only={locked ? \"\" : undefined}\n aria-readonly={locked || undefined}\n className={cn(\n \"focus-ring inline-flex min-w-0 items-center justify-between gap-2 rounded-control text-label data-[placeholder]:text-label-secondary\",\n inline\n ? cn(\"bg-transparent pl-1.5 pr-0.5\", locked ? \"cursor-default\" : \"hover:bg-fill-secondary disabled:text-label-tertiary disabled:hover:bg-transparent\")\n : cn(\"bg-control pl-2.5 pr-1.5 shadow-control\", locked ? \"cursor-default\" : \"hover:bg-fill-secondary disabled:opacity-40\"),\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 {inline ? (\n <span data-slot=\"select-chevrons\" className={cn(\"flex size-icon-lg shrink-0 items-center justify-center rounded-full bg-fill-secondary text-label-secondary\", locked && \"opacity-40\")}>\n <ChevronsUpDownIcon className=\"size-icon-sm\" />\n </span>\n ) : (\n <ChevronsUpDownIcon data-slot=\"select-chevrons\" className={cn(\"size-icon-sm shrink-0 text-label-secondary\", locked && \"opacity-40\")} />\n )}\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n {/* NSMenu draws no keyboard-focus outline around a pop-up's menu: the highlighted item is the\n focus. The open list takes focus, so its own outline is removed (the browser's default ring\n drew a white frame around the whole menu). */}\n <SelectContent data-slot=\"select-menu\" className=\"outline-none focus:outline-none focus-visible:outline-none\">\n {menuRuns(options).map((run, index) =>\n run === \"-\" ? (\n <SelectSeparator key={`sep-${index}`} />\n ) : run.group === undefined ? (\n run.items.map(item)\n ) : (\n <SelectPrimitive.Group key={`group-${index}`} data-slot=\"select-group\">\n <SelectLabel data-slot=\"select-group-heading\">{run.group}</SelectLabel>\n {run.items.map(item)}\n </SelectPrimitive.Group>\n ),\n )}\n </SelectContent>\n </SelectPrimitive.Root>\n );\n}\n\nfunction item(option: SelectOption): React.JSX.Element {\n return (\n <SelectItem key={option.value} value={option.value} disabled={option.disabled ?? false} meta={option.meta} {...(option.meta ? { title: option.meta } : {})}>\n {option.label}\n </SelectItem>\n );\n}\n\ntype MenuRun = \"-\" | { group: string | undefined; items: SelectOption[] };\n\n/** Options as the menu draws them: separators, and consecutive runs of one group (a heading over each grouped run, a separator before it). */\nfunction menuRuns(options: ReadonlyArray<SelectOption | \"-\">): MenuRun[] {\n const runs: MenuRun[] = [];\n for (const option of options) {\n const last = runs[runs.length - 1];\n if (option === \"-\") {\n if (last !== undefined && last !== \"-\") runs.push(\"-\");\n continue;\n }\n if (last !== undefined && last !== \"-\" && last.group === option.group) {\n last.items.push(option);\n continue;\n }\n if (option.group !== undefined && last !== undefined && last !== \"-\") runs.push(\"-\");\n runs.push({ group: option.group, items: [option] });\n }\n return runs;\n}\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 /** The chosen segment fills with the accent (System Settings' tab-like switches: Sound's Output |\n * Input, Screen Time's Day | Week); the default is the toolbar's neutral raised segment. */\n prominent?: boolean;\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 prominent = false,\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={cn(\n \"focus-ring inline-flex min-w-0 flex-1 items-center justify-center gap-1 whitespace-nowrap rounded-control px-2.5 transition-colors duration-100 disabled:opacity-40 [&_svg]:size-icon-sm\",\n prominent\n ? \"text-label hover:text-label data-[state=on]:bg-tint data-[state=on]:text-tint-label\"\n : \"text-label-secondary hover:text-label data-[state=on]:bg-control data-[state=on]:text-label data-[state=on]:shadow-control\",\n )}\n >\n {segment.label}\n </ToggleGroup.Item>\n ))}\n </ToggleGroup.Root>\n );\n}\n","import * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\nimport * as SwitchPrimitive from \"@radix-ui/react-switch\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\n/**\n * The macOS checkbox (NSButton, checkbox style, regular size): a 14 px rounded square on the\n * control surface with a hairline edge; checked or mixed, it fills with the tint and draws a white\n * glyph. Disabled dims to 40 %. The keyboard ring is the one focus ring.\n */\nexport interface CheckboxProps extends React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root> {}\n\nexport const Checkbox = React.forwardRef<React.ComponentRef<typeof CheckboxPrimitive.Root>, CheckboxProps>(function Checkbox(\n { className, checked, ...props },\n ref,\n) {\n return (\n <CheckboxPrimitive.Root\n ref={ref}\n {...(checked === undefined ? {} : { checked })}\n data-slot=\"checkbox\"\n className={cn(\n \"focus-ring peer inline-flex size-checkbox shrink-0 items-center justify-center rounded-checkbox bg-control text-tint-label shadow-control\",\n \"data-[state=checked]:bg-tint data-[state=checked]:shadow-none data-[state=indeterminate]:bg-tint data-[state=indeterminate]:shadow-none\",\n \"disabled:cursor-default disabled:opacity-40\",\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator data-slot=\"checkbox-indicator\" className=\"flex items-center justify-center\">\n {checked === \"indeterminate\" ? (\n <svg viewBox=\"0 0 10 10\" className=\"size-2.5\" aria-hidden>\n <path d=\"M2 5h6\" stroke=\"currentColor\" strokeWidth={1.75} strokeLinecap=\"round\" fill=\"none\" />\n </svg>\n ) : (\n <svg viewBox=\"0 0 10 10\" className=\"size-2.5\" aria-hidden>\n <path d=\"M2 5.2 4.1 7.3 8 2.8\" stroke=\"currentColor\" strokeWidth={1.75} strokeLinecap=\"round\" strokeLinejoin=\"round\" fill=\"none\" />\n </svg>\n )}\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n});\n\n/**\n * The macOS switch (NSSwitch, small): a 32 × 18 capsule. Off is a neutral track with the knob at\n * the left; on fills with the tint and slides the knob right, so the state reads at a glance\n * without color (position) and with it (tint). `size=\"sm\"` is the 26 × 15 mini size.\n */\nexport interface SwitchProps extends React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root> {\n /** `md` (default) is NSSwitch small, 32 × 18; `sm` is mini, 26 × 15 (rows and tables). */\n size?: \"sm\" | \"md\";\n}\n\nexport const Switch = React.forwardRef<React.ComponentRef<typeof SwitchPrimitive.Root>, SwitchProps>(function Switch(\n { className, size = \"md\", ...props },\n ref,\n) {\n return (\n <SwitchPrimitive.Root\n ref={ref}\n data-slot=\"switch\"\n data-size={size}\n className={cn(\n \"focus-ring peer inline-flex shrink-0 items-center rounded-full p-px transition-colors duration-150\",\n \"bg-fill-tertiary data-[state=checked]:bg-tint disabled:cursor-default disabled:opacity-40\",\n size === \"sm\" ? \"h-switch-mini-h w-switch-mini\" : \"h-switch-h w-switch\",\n className,\n )}\n {...props}\n >\n <SwitchPrimitive.Thumb\n data-slot=\"switch-thumb\"\n className={cn(\n \"pointer-events-none block rounded-full bg-knob shadow-control transition-transform duration-150 data-[state=unchecked]:translate-x-0\",\n size === \"sm\" ? \"size-switch-knob-mini data-[state=checked]:translate-x-switch-travel-mini\" : \"size-switch-knob data-[state=checked]:translate-x-switch-travel\",\n )}\n />\n </SwitchPrimitive.Root>\n );\n});\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { intoToolbar, useToolbarAdoption } from \"./native\";\nimport { Text } from \"./text\";\nimport { NOTICE_STACK, collapseNotices, noticeKey, visibleNotices } from \"../notice-stack\";\n\nexport type PageWidth = \"form\" | \"wide\" | \"full\";\n\n/** Every page uses the whole window (Arman, 2026-10-06: \"I need those pages to be full width so I\n * can use them\"). The prop stays for callers; no width narrows a page. */\nconst WIDTH: Record<PageWidth, string> = {\n form: \"max-w-none\",\n wide: \"max-w-none\",\n full: \"max-w-none\",\n};\n\nexport interface PageProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Kept for callers; every page fills the window whatever it says. */\n width?: PageWidth;\n /** The page header; drawn at the top of the scrolling column. */\n header?: React.ReactNode;\n /** Banners (errors, \"Not live\", a result). They float as small cards in the page's top-right\n * corner (Notices), never a bar across it. The lint refuses a Banner anywhere else on a page. */\n notices?: React.ReactNode;\n /** A leading source list inside the page (Console's devices and reports, System Information's\n * categories): a fixed column with its own scroll, a hairline on its trailing edge. */\n sidebar?: React.ReactNode;\n /** A bar fixed above the scrolling column (Console's scope bar: All Messages · Errors and Faults). */\n scopeBar?: React.ReactNode;\n /** A pane fixed below the scrolling column (Activity Monitor's summary strip, Console's detail\n * pane, Finder's path bar). It never scrolls away and never moves the column's top. */\n footer?: React.ReactNode;\n /** No margins: the column's first child (a table) starts right under the toolbar and runs edge to\n * edge, as Activity Monitor's and Console's tables do. */\n flush?: boolean;\n}\n\n/**\n * THE NOTICE STACK (Arman, 2026-10-23: \"a small something that resembles errors from a normal\n * macos\"). Every notice floats as a small card of translucent material in the frame's TOP-RIGHT\n * corner, the macOS notification's place: never a bar across the window, never in the foot where\n * the composer and the list's end live. The rule is ../notice-stack.ts (shared with the web's one\n * toast stack): identical notices collapse into one card with a count, at most 3 show and the rest\n * fold into \"N more\". The stack is out of the layout flow, so a notice appearing moves nothing.\n * Empty, it draws nothing. The frame that holds it (Page, SplitView, a chat frame) is `relative`.\n */\nfunction noticeElements(children: React.ReactNode): React.ReactElement[] {\n // A fragment of conditionals (`<>{a ? <Banner/> : null}</>`) counts only what it really draws.\n const out: React.ReactElement[] = [];\n for (const c of React.Children.toArray(children)) {\n if (!React.isValidElement(c)) continue;\n if (c.type === React.Fragment) out.push(...noticeElements((c.props as { children?: React.ReactNode }).children));\n else out.push(c);\n }\n return out;\n}\n\n/** Two cards say the same thing when their tone, title and line are the same text. */\nfunction elementKey(el: React.ReactElement): string | null {\n const p = el.props as { tone?: unknown; title?: unknown; message?: unknown };\n if (typeof p.tone !== \"string\" || (typeof p.title !== \"string\" && typeof p.title !== \"number\")) return null;\n return noticeKey(p.tone, p.title, p.message);\n}\n\n/** Inside the stack, a Banner draws as the floating card (state.tsx reads it). */\nexport const NoticeStackContext = React.createContext(false);\n\nexport function Notices({ children, className, onHeight, ...props }: React.HTMLAttributes<HTMLDivElement> & { onHeight?: (height: number) => void }) {\n const stack = React.useRef<HTMLDivElement>(null);\n const [expanded, setExpanded] = React.useState(false);\n const elements = noticeElements(children);\n const drawn = elements.length > 0;\n // Reports what the stack really occupies (0 when nothing it holds draws anything).\n React.useLayoutEffect(() => {\n const el = stack.current;\n if (!onHeight) return;\n if (!el) return onHeight(0);\n const report = () => onHeight(el.offsetHeight);\n report();\n if (typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(report);\n observer.observe(el);\n return () => {\n observer.disconnect();\n onHeight(0);\n };\n }, [onHeight, drawn]);\n if (!drawn) return null;\n const groups = collapseNotices(elements, elementKey);\n const { shown, folded } = expanded ? { shown: groups, folded: 0 } : visibleNotices(groups);\n return (\n <div\n ref={stack}\n data-slot=\"notices\"\n data-float=\"\"\n aria-live=\"polite\"\n style={{ width: `${NOTICE_STACK.widthRem}rem` }}\n className={cn(\"flex flex-col items-stretch gap-2 empty:hidden\", className)}\n {...props}\n >\n <NoticeStackContext.Provider value={true}>\n {folded > 0 ? (\n <button type=\"button\" data-slot=\"notices-more\" className=\"self-end rounded-full px-2 py-0.5\" onClick={() => setExpanded(true)}>\n <Text variant=\"caption\" tone=\"secondary\">\n {folded} more\n </Text>\n </button>\n ) : null}\n {shown.map((g) => (g.count > 1 ? React.cloneElement(g.item as React.ReactElement<{ count?: number }>, { count: g.count }) : g.item))}\n </NoticeStackContext.Provider>\n </div>\n );\n}\n\n/**\n * The message slot of a dialog, sheet or any surface that cannot float its notices: a fixed-height\n * box that is always there, so an error appearing in it (or leaving) moves nothing around it.\n * One banner fits; a longer one is clipped to the slot, never grown.\n */\nexport function NoticeSlot({ children, className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div data-slot=\"notice-slot\" aria-live=\"polite\" className={cn(\"h-16 shrink-0 overflow-hidden [&>*]:h-full [&>*]:overflow-hidden\", className)} {...props}>\n {children}\n </div>\n );\n}\n\n/**\n * One scrolling content page: 20 px window margins, the HIG spacing scale (20 px between groups),\n * and its notices as small cards in its top-right corner (see Notices).\n */\nexport const Page = React.forwardRef<HTMLDivElement, PageProps>(function Page(\n { width = \"wide\", header, notices, sidebar, scopeBar, footer, flush, className, children, ...props },\n ref,\n) {\n const frame = (\n // The frame is always there (with or without notices), so a notice never remounts the page.\n <div data-slot=\"page-frame\" className=\"relative flex h-full min-w-0 flex-1 flex-col bg-content\">\n {scopeBar ? (\n <div data-slot=\"page-scope-bar\" className=\"flex h-control-lg shrink-0 items-center gap-2 border-b border-separator px-3\">\n {scopeBar}\n </div>\n ) : null}\n <div ref={ref} data-slot=\"page\" data-flush={flush || undefined} className={cn(\"min-h-0 flex-1 overflow-y-auto bg-content\", className)} {...props}>\n <div className={cn(\"flex w-full flex-col\", flush ? \"min-h-full\" : \"gap-5 px-5 pb-5 pt-3\", WIDTH[width])}>\n {header}\n {children}\n </div>\n </div>\n {footer ? (\n <div data-slot=\"page-footer\" className=\"flex shrink-0 flex-col border-t border-separator bg-content\">\n {footer}\n </div>\n ) : null}\n <Notices data-page-notices=\"\">{notices}</Notices>\n </div>\n );\n if (!sidebar) return frame;\n return (\n <div data-slot=\"page-split\" className=\"flex h-full bg-content\">\n <aside data-slot=\"page-sidebar\" className=\"flex w-44 shrink-0 flex-col overflow-y-auto border-r border-separator py-2\">\n {sidebar}\n </aside>\n {frame}\n </div>\n );\n});\n\nexport interface PageHeaderProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** Omit when the window's toolbar already names this page (System Settings: the toolbar is the\n * title). The header then keeps its height and carries the subtitle and actions alone. */\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 /** In the window's toolbar, this page's controls are the whole toolbar (Activity Monitor, Console:\n * Stop and Inspect, the view switch, the search field). The host folds its own app-wide items\n * into one More button (`useWindowToolbarFull`), so nothing it adds crowds the page's controls. */\n fullToolbar?: boolean;\n /** The page draws its own large title (Reminders' list name in its color, Notes' folder): the\n * window's toolbar then draws no title of its own, so the name is never said twice. */\n largeTitle?: boolean;\n /** The page's actions end in its own ⋯ menu (Finder's Action menu), which carries the host's\n * app-wide items at its end (`WindowToolbarHostMenu`): the host then draws no ⋯ of its own. */\n ownsMore?: boolean;\n}\n\nexport function PageHeader({ title, subtitle, icon, actions, fullToolbar, largeTitle, ownsMore, className, ...props }: PageHeaderProps) {\n // Inside a WindowToolbarProvider (the window's unified toolbar), a header the toolbar already names\n // moves into the toolbar: its subtitle under the window title, its actions on the trailing side.\n const toolbar = useToolbarAdoption(!title && !icon, fullToolbar ?? false, largeTitle ?? false, ownsMore ?? false);\n if (toolbar) {\n return (\n <>\n {subtitle ? intoToolbar(<span data-slot=\"page-header-subtitle\">{subtitle}</span>, toolbar.subtitle) : null}\n {actions\n ? intoToolbar(\n <div data-slot=\"page-header-actions\" className=\"flex min-w-0 items-center gap-2\">\n {actions}\n </div>,\n toolbar.actions,\n )\n : null}\n </>\n );\n }\n return (\n <header data-slot=\"page-header\" className={cn(\"flex items-center gap-3\", actions && \"min-h-control-lg\", 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 {title ? (\n <Text as=\"h1\" variant=\"title-2\" truncate>\n {title}\n </Text>\n ) : null}\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 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\";\nimport { createPortal } from \"react-dom\";\n\nimport { Dialog } from \"../dialog\";\nimport { Tooltip, TooltipTrigger } from \"../tooltip\";\nimport { Button } from \"./button\";\nimport { cn } from \"./cn\";\nimport { Checkbox } from \"./controls\";\nimport { DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from \"./sheet\";\nimport { TooltipContent } from \"./tooltip\";\nimport { useScrollFade } from \"../use-scroll-fade\";\n\n/**\n * The window layer of the desktop standard: OS-drawn symbols, the unified toolbar a title-less\n * PageHeader moves into, and the navigator column of the window's areas. A symbol draws its fallback\n * until a `SymbolProvider` resolves it (Windows and Linux keep the Lucide fallback), and a\n * `PageHeader` stays in the page until a `WindowToolbarProvider` gives it a toolbar to move into.\n */\n\n/* ---------------------------------------------------------------------------------------------- */\n/* System symbols (SF Symbols drawn by the OS) */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport type SymbolWeight = \"ultralight\" | \"thin\" | \"light\" | \"regular\" | \"medium\" | \"semibold\" | \"bold\" | \"heavy\" | \"black\";\n\n/** A rendered symbol: an image URL (drawn as a mask in the current text color) and its size in points. */\nexport interface SymbolImage {\n url: string;\n width: number;\n height: number;\n}\n\n/** Renders `name` at `pointSize` and `weight`, or resolves null when this OS has no such symbol. */\nexport type SymbolResolver = (name: string, pointSize: number, weight: SymbolWeight) => Promise<SymbolImage | null>;\n\nconst SymbolContext = React.createContext<SymbolResolver | null>(null);\n/** Per resolver: settled images (null = missing) and the renders in flight. */\nconst symbolCache = new WeakMap<SymbolResolver, Map<string, SymbolImage | null | Promise<SymbolImage | null>>>();\n\nfunction cacheFor(resolve: SymbolResolver): Map<string, SymbolImage | null | Promise<SymbolImage | null>> {\n let cache = symbolCache.get(resolve);\n if (!cache) symbolCache.set(resolve, (cache = new Map()));\n return cache;\n}\n\n/** The host's symbol renderer (Matrx 2: Electron `nativeImage.createFromNamedImage` in main). */\nexport function SymbolProvider({ resolve, children }: { resolve: SymbolResolver | null; children: React.ReactNode }) {\n return <SymbolContext.Provider value={resolve}>{children}</SymbolContext.Provider>;\n}\n\nexport interface SystemSymbolProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** The SF Symbol name (\"folder\", \"chevron.left\"). Omit to draw the fallback. */\n name?: string | undefined;\n /** Drawn where there is no symbol renderer (Windows, Linux, the web) or the name is missing. */\n fallback: React.ReactNode;\n /** Point size of the symbol's font (13 = body). */\n size?: number;\n weight?: SymbolWeight;\n}\n\n/**\n * An SF Symbol rendered by the OS at the size and weight asked for, cached, drawn in `currentColor`.\n * Without a renderer, or for a name this OS lacks, it draws `fallback` (a Lucide icon) instead, so\n * every platform shows an icon in the same place.\n */\nexport function SystemSymbol({ name, fallback, size = 13, weight = \"regular\", className, style, ...props }: SystemSymbolProps) {\n const resolve = React.useContext(SymbolContext);\n const key = `${name ?? \"\"}|${size}|${weight}`;\n const read = (): SymbolImage | null | undefined => {\n if (!resolve || !name) return null;\n const hit = cacheFor(resolve).get(key);\n return hit instanceof Promise ? undefined : hit;\n };\n const [image, setImage] = React.useState<SymbolImage | null | undefined>(read);\n React.useEffect(() => {\n const now = read();\n setImage(now);\n if (now !== undefined || !resolve || !name) return;\n const cache = cacheFor(resolve);\n let pending = cache.get(key);\n if (!(pending instanceof Promise)) {\n pending = resolve(name, size, weight).catch(() => null);\n cache.set(key, pending);\n void pending.then((result) => cache.set(key, result));\n }\n let live = true;\n void pending.then((result) => {\n if (live) setImage(result);\n });\n return () => {\n live = false;\n };\n // `read` closes over these same inputs.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [resolve, key]);\n\n // The layout box is the point size, square, from the first frame to the last: the OS image (often\n // wider or taller than its point size) is centered over it and may overflow it, never resize it,\n // so nothing around a symbol moves when the image arrives or the name turns out missing.\n const box: React.CSSProperties = { width: size, height: size, ...style };\n if (image === null) {\n return (\n <span\n data-slot=\"system-symbol\"\n data-symbol-fallback={name ?? \"\"}\n className={cn(\"inline-flex shrink-0 items-center justify-center\", className)}\n style={resolve && name ? box : style}\n {...props}\n >\n {fallback}\n </span>\n );\n }\n return (\n <span\n aria-hidden\n data-slot=\"system-symbol\"\n data-symbol={name}\n data-pending={image === undefined || undefined}\n className={cn(\"relative inline-block shrink-0\", className)}\n style={box}\n {...props}\n >\n {image ? (\n <span\n data-symbol-image\n className=\"pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-current\"\n style={{\n width: image.width,\n height: image.height,\n maskImage: `url(\"${image.url}\")`,\n WebkitMaskImage: `url(\"${image.url}\")`,\n maskSize: \"100% 100%\",\n WebkitMaskSize: \"100% 100%\",\n maskRepeat: \"no-repeat\",\n WebkitMaskRepeat: \"no-repeat\",\n }}\n />\n ) : null}\n </span>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* The window's unified toolbar: a title-less PageHeader moves into it */\n/* ---------------------------------------------------------------------------------------------- */\n\ninterface ToolbarStore {\n subtitle: HTMLElement | null;\n actions: HTMLElement | null;\n setSubtitle: (el: HTMLElement | null) => void;\n setActions: (el: HTMLElement | null) => void;\n /** Only one header owns the toolbar: the first mounted; the next takes over when it goes. */\n claim: (id: string, full: boolean, untitled?: boolean, ownsMore?: boolean) => void;\n release: (id: string) => void;\n owner: string | null;\n /** The owning header fills the whole toolbar (`PageHeader fullToolbar`). */\n full: boolean;\n /** The owning page draws its own large title (Reminders, Notes): the toolbar shows none. */\n untitled: boolean;\n /** The owning page draws its own ⋯ menu, and it carries the host's items (`WindowToolbarHostMenu`). */\n ownsMore: boolean;\n /** The host's app-wide toolbar items as menu items, for a page whose ⋯ menu carries them. */\n hostMenu: React.ReactNode;\n}\n\nconst WindowToolbarContext = React.createContext<ToolbarStore | null>(null);\n\n/**\n * Makes the window's unified toolbar the home of every title-less `PageHeader` (AppKit: the toolbar\n * IS the page's header — its subtitle sits under the window title, its search and view switch on\n * the toolbar's trailing side). The targets are `WindowToolbarTitle` and `WindowToolbarActions`;\n * their refs are stable, so a field moved into the toolbar keeps focus across renders.\n */\nexport function WindowToolbarProvider({ children, hostMenu = null }: { children: React.ReactNode; hostMenu?: React.ReactNode }) {\n const [subtitle, setSubtitle] = React.useState<HTMLElement | null>(null);\n const [actions, setActions] = React.useState<HTMLElement | null>(null);\n const [claims, setClaims] = React.useState<ReadonlyArray<{ id: string; full: boolean; untitled: boolean; ownsMore: boolean }>>([]);\n const claim = React.useCallback(\n // A header already claiming keeps its place in the queue; only its flags change.\n (id: string, full: boolean, untitled = false, ownsMore = false) =>\n setClaims((c) =>\n c.some((x) => x.id === id)\n ? c.some((x) => x.id === id && x.full === full && x.untitled === untitled && x.ownsMore === ownsMore)\n ? c\n : c.map((x) => (x.id === id ? { id, full, untitled, ownsMore } : x))\n : [...c, { id, full, untitled, ownsMore }],\n ),\n [],\n );\n const release = React.useCallback((id: string) => setClaims((c) => c.filter((x) => x.id !== id)), []);\n const value = React.useMemo<ToolbarStore>(\n () => ({\n subtitle,\n actions,\n setSubtitle,\n setActions,\n claim,\n release,\n owner: claims[0]?.id ?? null,\n full: claims[0]?.full ?? false,\n untitled: claims[0]?.untitled ?? false,\n ownsMore: claims[0]?.ownsMore ?? false,\n hostMenu,\n }),\n [subtitle, actions, claim, release, claims, hostMenu],\n );\n return <WindowToolbarContext.Provider value={value}>{children}</WindowToolbarContext.Provider>;\n}\n\n/** The toolbar slots a `PageHeader` with no title renders into, when it owns the toolbar. `full`:\n * the header's controls are the whole toolbar (see `useWindowToolbarFull`); `untitled`: the page\n * draws its own large title, so the toolbar draws none (Reminders, Notes). */\nexport function useToolbarAdoption(adoptable: boolean, full = false, untitled = false, ownsMore = false): { subtitle: HTMLElement; actions: HTMLElement } | null {\n const toolbar = React.useContext(WindowToolbarContext);\n const id = React.useId();\n const claim = toolbar?.claim;\n const release = toolbar?.release;\n React.useLayoutEffect(() => {\n if (!adoptable || !claim || !release) return;\n claim(id, full, untitled, ownsMore);\n return () => release(id);\n }, [adoptable, full, untitled, ownsMore, claim, release, id]);\n if (!adoptable || !toolbar || toolbar.owner !== id || !toolbar.subtitle || !toolbar.actions) return null;\n return { subtitle: toolbar.subtitle, actions: toolbar.actions };\n}\n\n/**\n * True while the page that owns the window's toolbar fills it with its own controls (Activity\n * Monitor, Console: Stop and Inspect, the view switch, the search field — and nothing the app adds).\n * The host then folds its own app-wide toolbar items into one More button, so the page's view\n * switch and search field keep their room and their place on every view.\n */\nexport function useWindowToolbarFull(): boolean {\n return React.useContext(WindowToolbarContext)?.full ?? false;\n}\n\n/**\n * True while the page that owns the toolbar draws its own ⋯ menu (Finder's Action menu) and that\n * menu carries the host's items: the host then draws no ⋯ of its own, so the toolbar never shows\n * two ellipses side by side.\n */\nexport function useWindowToolbarOwnsMore(): boolean {\n const toolbar = React.useContext(WindowToolbarContext);\n return (toolbar?.ownsMore ?? false) && toolbar?.hostMenu !== null && toolbar?.hostMenu !== undefined;\n}\n\n/**\n * The host's app-wide toolbar items, as menu items, placed at the end of a page's own ⋯ menu\n * (`PageHeader ownsMore`). Nothing when the host gives none.\n */\nexport function WindowToolbarHostMenu(): React.ReactNode {\n return React.useContext(WindowToolbarContext)?.hostMenu ?? null;\n}\n\n/** Portals `node` into `target` (a toolbar slot). */\nexport function intoToolbar(node: React.ReactNode, target: HTMLElement): React.ReactPortal {\n return createPortal(node, target);\n}\n\nexport interface WindowToolbarTitleProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** The window title: the open place (Finder's folder, System Settings' pane). */\n title: React.ReactNode;\n}\n\n/**\n * The toolbar's title block (NSWindow title in a unified toolbar): the title, and under it the\n * subtitle the open page's header hands up. AppKit metrics: 15 pt bold alone; 13 pt bold over an\n * 11 pt secondary subtitle.\n */\nexport function WindowToolbarTitle({ title, className, ...props }: WindowToolbarTitleProps) {\n const toolbar = React.useContext(WindowToolbarContext);\n // A page with its own large title (Reminders' list name): the window keeps its title for the\n // Window menu and assistive tech, but the toolbar draws none, so the name is never said twice.\n const untitled = toolbar?.untitled === true;\n return (\n // As narrow as its title, never narrower: the subtitle gives way first (desktop.css), so the\n // page's controls keep their room and the title is never cut.\n <div data-slot=\"window-toolbar-title\" data-untitled={untitled || undefined} className={cn(\"flex min-w-min flex-col justify-center\", className)} {...props}>\n <span data-slot=\"window-title\" className={cn(\"truncate text-label\", untitled && \"sr-only\")}>\n {title}\n </span>\n <span ref={toolbar?.setSubtitle} data-slot=\"window-subtitle\" className=\"text-label-secondary empty:hidden\" />\n </div>\n );\n}\n\n/** Where the open page's header actions (search, its one view switch, its main action) land. */\nexport function WindowToolbarActions({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n const toolbar = React.useContext(WindowToolbarContext);\n // min-w-0: the search field inside may give way (its 220 pt is a wish, not a minimum).\n return <div ref={toolbar?.setActions} data-slot=\"window-toolbar-actions\" className={cn(\"flex min-w-0 shrink-0 items-center gap-2 empty:hidden\", className)} {...props} />;\n}\n\n/** A capsule of related toolbar buttons (Finder's back/forward pair). */\nexport function ToolbarGroup({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return <div role=\"group\" data-slot=\"toolbar-group\" className={cn(\"flex h-control-lg shrink-0 items-center rounded-full bg-fill px-0.5\", className)} {...props} />;\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Navigator column: the areas down the sidebar panel's leading edge */\n/* ---------------------------------------------------------------------------------------------- */\n\n/**\n * The window's areas as one column of icons down the leading edge of the sidebar panel, the open\n * area's list beside it, in one panel: any number of areas (it scrolls), never a separate activity\n * bar. Up/Down move between them; right-click is the host's (Customize…).\n */\nexport function NavigatorColumn({ className, onKeyDown, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n // More areas than fit scroll under a soft edge with the scroller hidden (as the source list).\n const fade = useScrollFade();\n return (\n <div\n ref={fade.ref}\n data-fade-top={fade.fadeProps[\"data-fade-top\"]}\n data-fade-bottom={fade.fadeProps[\"data-fade-bottom\"]}\n role=\"tablist\"\n aria-orientation=\"vertical\"\n data-slot=\"navigator-column\"\n className={cn(\"flex min-h-0 shrink-0 flex-col items-center gap-1 overflow-y-auto overflow-x-hidden\", className)}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || ![\"ArrowUp\", \"ArrowDown\", \"Home\", \"End\"].includes(event.key)) return;\n const tabs = Array.from(event.currentTarget.querySelectorAll<HTMLElement>(`[data-slot=navigator-item]`));\n const at = tabs.indexOf(document.activeElement as HTMLElement);\n if (at === -1) return;\n const next = event.key === \"Home\" ? 0 : event.key === \"End\" ? tabs.length - 1 : at + (event.key === \"ArrowDown\" ? 1 : -1);\n const target = tabs[Math.max(0, Math.min(tabs.length - 1, next))];\n if (target) {\n event.preventDefault();\n target.focus();\n }\n }}\n {...props}\n />\n );\n}\n\nexport interface NavigatorItemProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"aria-label\"> {\n icon: React.ReactNode;\n /** Required: the accessible name and the tooltip. */\n label: string;\n shortcut?: string | undefined;\n /** The open area: the accent with a white symbol in the key window (the open row's selection). */\n active?: boolean;\n /** A small corner dot: this area has something for the person (a session running, new output). */\n dot?: \"tint\" | \"warning\" | \"danger\" | undefined;\n}\n\nexport const NavigatorItem = React.forwardRef<HTMLButtonElement, NavigatorItemProps>(function NavigatorItem(\n { icon, label, shortcut, active, dot, className, type = \"button\", ...props },\n ref,\n) {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n ref={ref}\n type={type}\n role=\"tab\"\n aria-selected={Boolean(active)}\n aria-label={label}\n tabIndex={active ? 0 : -1}\n data-slot=\"navigator-item\"\n data-active={active || undefined}\n className={cn(\n \"focus-ring relative flex size-navigator-item shrink-0 items-center justify-center rounded-control text-label-secondary transition-colors duration-100 hover:bg-fill hover:text-label\",\n active && \"bg-selection-muted text-label hover:bg-selection-muted\",\n className,\n )}\n {...props}\n >\n {icon}\n {dot ? (\n <span\n aria-hidden\n data-navigator-dot={dot}\n className={cn(\n \"pointer-events-none absolute right-0.5 top-0.5 size-1.5 rounded-full\",\n dot === \"tint\" ? \"bg-tint\" : dot === \"warning\" ? \"bg-system-orange\" : \"bg-system-red\",\n )}\n />\n ) : null}\n </button>\n </TooltipTrigger>\n {/* Beside the icon, not under it: the column is vertical, so a tooltip below would cover the\n next icon (Codex, Xcode's navigator). */}\n <TooltipContent side=\"right\">\n {label}\n {shortcut ? <span className=\"ml-2 opacity-60\">{shortcut}</span> : null}\n </TooltipContent>\n </Tooltip>\n );\n});\n\n/** One area as the Customize sheet lists it. */\nexport interface NavigatorCustomizeItem {\n id: string;\n label: string;\n icon: React.ReactNode;\n hidden: boolean;\n}\n\nexport interface NavigatorCustomizeSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Every area, in the person's order, hidden ones included. */\n items: ReadonlyArray<NavigatorCustomizeItem>;\n /** The new order and visibility, on every change (it applies at once, as Finder's do). */\n onChange: (items: NavigatorCustomizeItem[]) => void;\n onRestoreDefaults: () => void;\n title?: string;\n}\n\nconst CUSTOMIZE_ROW = `[data-customize-item]`;\n\n/** Moves the item at `from` to `to`. */\nexport function moveItem<T>(list: ReadonlyArray<T>, from: number, to: number): T[] {\n const next = [...list];\n const [item] = next.splice(from, 1);\n if (item === undefined) return next;\n next.splice(Math.max(0, Math.min(next.length, to)), 0, item);\n return next;\n}\n\n/**\n * Customize the areas (Safari's and Finder's toolbar customization): drag a row to reorder it\n * (or Option-Up/Down on a focused row), uncheck it to hide it; changes apply at once. One area\n * always stays shown. Restore Defaults puts back the built-in order with every area shown.\n */\nexport function NavigatorCustomizeSheet({ open, onOpenChange, items, onChange, onRestoreDefaults, title = \"Customize Areas\" }: NavigatorCustomizeSheetProps) {\n const list = React.useRef<HTMLDivElement>(null);\n const [dragging, setDragging] = React.useState<string | null>(null);\n const shown = items.filter((i) => !i.hidden).length;\n const startDrag = (event: React.PointerEvent<HTMLElement>, id: string) => {\n if (event.button !== 0) return;\n const rows = Array.from(list.current?.querySelectorAll<HTMLElement>(CUSTOMIZE_ROW) ?? []);\n const height = rows[0]?.getBoundingClientRect().height ?? 32;\n const handle = event.currentTarget;\n handle.setPointerCapture(event.pointerId);\n event.preventDefault();\n let origin = event.clientY;\n let current = [...items];\n setDragging(id);\n const move = (e: PointerEvent) => {\n const steps = Math.trunc((e.clientY - origin) / height);\n if (steps === 0) return;\n const from = current.findIndex((i) => i.id === id);\n const to = Math.max(0, Math.min(current.length - 1, from + steps));\n if (to === from) return;\n origin += (to - from) * height;\n current = moveItem(current, from, to);\n onChange(current);\n };\n const up = () => {\n setDragging(null);\n handle.removeEventListener(\"pointermove\", move);\n handle.removeEventListener(\"pointerup\", up);\n handle.removeEventListener(\"pointercancel\", up);\n };\n handle.addEventListener(\"pointermove\", move);\n handle.addEventListener(\"pointerup\", up);\n handle.addEventListener(\"pointercancel\", up);\n };\n return (\n <Dialog modal open={open} onOpenChange={onOpenChange}>\n <DialogContent data-navigator-customize=\"\" className=\"max-w-form\">\n <DialogHeader>\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>Drag to reorder. Uncheck to hide.</DialogDescription>\n </DialogHeader>\n <div ref={list} role=\"list\" aria-label=\"Areas\" className=\"flex max-h-96 flex-col overflow-y-auto rounded-group bg-group p-1\">\n {items.map((item, index) => (\n <div\n key={item.id}\n role=\"listitem\"\n tabIndex={0}\n data-customize-item={item.id}\n data-hidden={item.hidden || undefined}\n data-dragging={dragging === item.id || undefined}\n aria-label={`${item.label}${item.hidden ? \", hidden\" : \"\"}`}\n onPointerDown={(event) => {\n if ((event.target as HTMLElement).closest(\"button\")) return;\n startDrag(event, item.id);\n }}\n onKeyDown={(event) => {\n if (!event.altKey || (event.key !== \"ArrowUp\" && event.key !== \"ArrowDown\")) return;\n event.preventDefault();\n const to = index + (event.key === \"ArrowUp\" ? -1 : 1);\n if (to < 0 || to >= items.length) return;\n onChange(moveItem(items, index, to));\n requestAnimationFrame(() => list.current?.querySelector<HTMLElement>(`[data-customize-item=\"${item.id}\"]`)?.focus());\n }}\n className={cn(\n \"focus-ring flex h-sidebar-row cursor-grab items-center gap-2 rounded-control px-2 text-body text-label active:cursor-grabbing\",\n dragging === item.id && \"bg-selection-muted\",\n )}\n >\n <Checkbox\n aria-label={`Show ${item.label}`}\n checked={!item.hidden}\n disabled={!item.hidden && shown <= 1}\n onCheckedChange={(on) => onChange(items.map((i) => (i.id === item.id ? { ...i, hidden: on !== true } : i)))}\n />\n <span className={cn(\"flex size-icon shrink-0 items-center justify-center\", item.hidden ? \"text-label-tertiary\" : \"text-label-secondary\")}>{item.icon}</span>\n <span className={cn(\"min-w-0 flex-1 truncate\", item.hidden && \"text-label-secondary\")}>{item.label}</span>\n <span aria-hidden className=\"flex shrink-0 flex-col gap-0.5 text-label-tertiary\">\n <span className=\"block h-px w-3 bg-current\" />\n <span className=\"block h-px w-3 bg-current\" />\n <span className=\"block h-px w-3 bg-current\" />\n </span>\n </div>\n ))}\n </div>\n <DialogFooter>\n <Button data-navigator-restore className=\"mr-auto\" onClick={onRestoreDefaults}>\n Restore Defaults\n </Button>\n <Button data-navigator-done variant=\"primary\" onClick={() => onOpenChange(false)}>\n Done\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n","import * as React from \"react\";\n\nimport type { ConfirmDialogProps } from \"../confirm-dialog\";\nimport {\n Dialog,\n DialogContent as WebDialogContent,\n DialogDescription as WebDialogDescription,\n DialogFooter as WebDialogFooter,\n DialogHeader as WebDialogHeader,\n DialogTitle as WebDialogTitle,\n type DialogContentProps,\n} from \"../dialog\";\nimport { Button } from \"./button\";\nimport { cn } from \"./cn\";\n\n/**\n * The macOS sheet: a rounded panel attached to the window's top edge, under the unified toolbar,\n * that drops down out of the toolbar's foot and goes back up into it (AppKit's sheet\n * presentation), centered across the window, the content color with no edge or shadow, the window\n * behind dimmed (desktop.css), the 20 px window margin inside, body text at 13 pt, no close (×): a sheet is\n * dismissed by its own Cancel / Done buttons or Escape. Inside it, the standard controls keep their\n * standard row density and the one focus ring; a `NoticeSlot` floats over the sheet's foot instead\n * of holding an empty box open.\n */\nexport const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(function DialogContent(\n { className, showCloseButton = false, mobileSheet = false, ...props },\n ref,\n) {\n return (\n <WebDialogContent\n ref={ref}\n data-desktop-sheet=\"\"\n showCloseButton={showCloseButton}\n mobileSheet={mobileSheet}\n animated={false}\n className={cn(\n \"mx-sheet gap-4 rounded-panel border-0 bg-content p-5 font-sans text-body text-label sm:rounded-panel\",\n className,\n )}\n {...props}\n />\n );\n});\n\n/** The sheet's title block: title then one line of description, left-aligned. */\nexport function DialogHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return <WebDialogHeader className={cn(\"gap-1 space-y-0 pr-0 text-left sm:text-left\", className)} {...props} />;\n}\n\n/**\n * The sheet's scrolling body, for a sheet that can outgrow the window (an account's facts and its\n * actions): the sheet sizes to its content up to its max height, the header and the footer's\n * button bar stay put, and only this body scrolls between them. When it holds more than shows, a\n * hairline marks each edge it scrolls under, as System Settings' sheets do; a short body has none.\n */\nexport function DialogBody({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n const ref = React.useRef<HTMLDivElement>(null);\n const [overflowing, setOverflowing] = React.useState(false);\n React.useLayoutEffect(() => {\n const el = ref.current;\n if (!el) return;\n const measure = () => setOverflowing(el.scrollHeight > el.clientHeight + 1);\n measure();\n if (typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(measure);\n observer.observe(el);\n for (const child of Array.from(el.children)) observer.observe(child);\n return () => observer.disconnect();\n }, [children]);\n return (\n <div ref={ref} data-slot=\"sheet-body\" data-overflowing={overflowing ? \"\" : undefined} className={cn(\"flex min-h-0 flex-col gap-4\", className)} {...props}>\n {children}\n </div>\n );\n}\n\n/** The sheet's buttons: trailing, 8 px apart, the default (primary) one rightmost. */\nexport function DialogFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return <WebDialogFooter className={cn(\"flex-row justify-end gap-2 space-x-0 bg-content pt-1 sm:gap-2 sm:space-x-0\", className)} {...props} />;\n}\n\nexport const DialogTitle = React.forwardRef<HTMLHeadingElement, React.ComponentPropsWithoutRef<typeof WebDialogTitle>>(function DialogTitle(\n { className, ...props },\n ref,\n) {\n return <WebDialogTitle ref={ref} className={cn(\"text-headline text-label\", className)} {...props} />;\n});\n\nexport const DialogDescription = React.forwardRef<HTMLParagraphElement, React.ComponentPropsWithoutRef<typeof WebDialogDescription>>(\n function DialogDescription({ className, ...props }, ref) {\n return <WebDialogDescription ref={ref} className={cn(\"text-body text-label-secondary\", className)} {...props} />;\n },\n);\n\n/** A confirmation the host asks with the OS's own alert (Matrx 2: an AppKit sheet on the window). */\nexport interface NativeConfirmRequest {\n title: string;\n message?: string;\n confirmLabel: string;\n cancelLabel: string;\n destructive: boolean;\n}\n/** Resolves true when the person confirmed. */\nexport type NativeConfirm = (request: NativeConfirmRequest) => Promise<boolean>;\n\nconst NativeConfirmContext = React.createContext<NativeConfirm | null>(null);\n\n/**\n * Inside this provider every plain `ConfirmDialog` (a title, an optional text description, no\n * extra content) is asked through `confirm` — the host's native alert sheet, attached to its window\n * (NSAlert via Electron's dialog.showMessageBox with the parent window) — instead of a drawn one.\n * A confirmation that carries its own content keeps the drawn sheet.\n */\nexport function NativeConfirmProvider({ confirm, children }: { confirm: NativeConfirm | null; children: React.ReactNode }) {\n return <NativeConfirmContext.Provider value={confirm}>{children}</NativeConfirmContext.Provider>;\n}\n\n/**\n * The confirmation, as a sheet: the consequence as its description, Cancel then the confirming\n * button (destructive when it loses something), Escape cancels. The same props as the web\n * ConfirmDialog, so a screen swaps nothing but the import. Under a `NativeConfirmProvider` a plain\n * one is the OS's own alert sheet instead.\n */\nexport function ConfirmDialog(props: ConfirmDialogProps) {\n const native = React.useContext(NativeConfirmContext);\n const plain =\n native !== null &&\n props.content === undefined &&\n typeof props.title === \"string\" &&\n (props.description === undefined || typeof props.description === \"string\") &&\n !props.confirmHeld &&\n props.cancelLabel !== null;\n if (native && plain) return <NativeConfirmDialog {...props} confirm={native} />;\n return <DrawnConfirmDialog {...props} />;\n}\n\nfunction NativeConfirmDialog({\n open,\n onOpenChange,\n title,\n description,\n confirmLabel = \"Confirm\",\n cancelLabel = \"Cancel\",\n variant = \"default\",\n onConfirm,\n confirm,\n}: ConfirmDialogProps & { confirm: NativeConfirm }) {\n // Latest handlers, so the one alert in flight answers to the current props.\n const handlers = React.useRef({ onOpenChange, onConfirm });\n handlers.current = { onOpenChange, onConfirm };\n React.useEffect(() => {\n if (!open) return;\n let live = true;\n void confirm({\n title: String(title),\n ...(typeof description === \"string\" ? { message: description } : {}),\n confirmLabel: String(confirmLabel),\n cancelLabel: String(cancelLabel ?? \"Cancel\"),\n destructive: variant === \"destructive\",\n }).then((ok) => {\n if (!live) return;\n // The alert is gone either way: confirmed runs the action first.\n if (ok) void handlers.current.onConfirm();\n handlers.current.onOpenChange(false);\n });\n return () => {\n live = false;\n };\n }, [open, confirm, title, description, confirmLabel, cancelLabel, variant]);\n return null;\n}\n\nfunction DrawnConfirmDialog({\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 <Dialog modal open={open} onOpenChange={onOpenChange}>\n <DialogContent data-confirm-sheet=\"\" role=\"alertdialog\" className={contentClassName} {...(portalContainer !== undefined ? { container: portalContainer } : {})}>\n <DialogHeader>\n <DialogTitle>{title}</DialogTitle>\n {description ? <DialogDescription asChild><div>{description}</div></DialogDescription> : null}\n </DialogHeader>\n {content}\n <DialogFooter>\n {cancelLabel !== null ? (\n <Button disabled={busy} onClick={() => onOpenChange(false)}>\n {cancelLabel}\n </Button>\n ) : null}\n {confirmHeld ? null : (\n <Button\n autoFocus\n variant={variant === \"destructive\" ? \"destructive\" : \"primary\"}\n disabled={busy || confirmDisabled}\n onClick={() => void onConfirm()}\n >\n {confirmLabel}\n </Button>\n )}\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\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\", className)} {...props}>\n {title || actions ? (\n // The title line is only as tall as its controls need: a bare title is one text line, so no\n // dead band opens between sections (HIG: 20 px between groups, 8 px title to group).\n <div className={cn(\"flex items-end gap-2\", actions && \"min-h-control\")}>\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\" && \"overflow-hidden rounded-group bg-group shadow-raised\",\n )}\n >\n {children}\n </div>\n {footer ? (\n <Text as=\"p\" 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 /** `avatar`: a 32 pt slot for a person's or an app's picture (Users & Groups, Internet Accounts),\n * the row as tall as Apple's (54 pt with a subtitle). The default is the 20 pt symbol slot. */\n iconSize?: \"symbol\" | \"avatar\";\n title: React.ReactNode;\n /** Second line under the title; makes the row tall. */\n subtitle?: React.ReactNode;\n /** The subtitle wraps instead of ending in an ellipsis: a reason or a warning is said in full\n * (System Settings' descriptions; Xcode's Welcome rows). A path or a name keeps one line. */\n subtitleWraps?: boolean;\n /** The title wraps instead of ending in an ellipsis: a note row in a group (Bluetooth's\n * \"AirDrop, AirPlay … use Bluetooth.\") is said in full. A name keeps one line. */\n titleWraps?: boolean;\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 *\n * When the row is narrow, AppKit's priorities hold: the value gives way first (it ends in \"…\"),\n * then the title; the accessory's controls never shrink. The title column is as wide as the\n * title itself (the subtitle never widens it), so a short label (\"Pairing code\") stays whole\n * beside a long value and three buttons, and a device's name outlasts its state word. A row\n * whose text wraps keeps its controls on the title's line (Bluetooth's switch), not centered\n * on the paragraph.\n */\nexport const Row = React.forwardRef<HTMLElement, RowProps>(function Row(\n { icon, iconSize = \"symbol\", title, subtitle, subtitleWraps = false, titleWraps = false, 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\n data-slot=\"row-icon\"\n className={cn(\n \"flex shrink-0 items-center justify-center text-label-secondary\",\n iconSize === \"avatar\" ? \"size-icon-xl [&>img]:size-icon-xl [&_svg]:size-icon-lg\" : \"size-icon-lg [&_svg]:size-icon\",\n )}\n >\n {icon}\n </span>\n ) : null}\n {/* flex-auto: the column's basis is the title's own width (the subtitle is contained), so\n the value, which shrinks a thousand times faster, gives way before the title does. */}\n <span data-slot=\"row-text\" className=\"flex min-w-0 flex-auto flex-col\">\n <Text\n tone={destructive ? \"danger\" : \"primary\"}\n mono={mono}\n truncate={!titleWraps}\n data-title-wraps={titleWraps || undefined}\n className={cn(titleWraps && \"contain-inline-size\", selected && \"text-inherit\")}\n >\n {title}\n </Text>\n {subtitle ? (\n <Text\n tone=\"secondary\"\n truncate={!subtitleWraps}\n data-subtitle-wraps={subtitleWraps || undefined}\n className={cn(\"contain-inline-size\", selected && \"text-inherit opacity-80\")}\n >\n {subtitle}\n </Text>\n ) : null}\n </span>\n {value !== undefined && value !== null ? (\n <Text data-slot=\"row-value\" tone=\"secondary\" tabular truncate className={cn(\"min-w-0 max-w-1/2 shrink-1000 text-right\", selected && \"text-inherit opacity-80\")}>\n {value}\n </Text>\n ) : null}\n {accessory ? (\n <span\n data-slot=\"row-accessory\"\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 gap-3 px-3 text-left before:absolute before:right-0 before:top-0 before:hidden before:h-px before:bg-separator\",\n icon ? (iconSize === \"avatar\" ? \"before:left-14\" : \"before:left-11\") : \"before:left-3\",\n // Wrapped text: the icon and the controls sit on the title's line (System Settings' lead rows).\n subtitleWraps || titleWraps ? \"items-start\" : \"items-center\",\n iconSize === \"avatar\" && icon ? \"min-h-row-tall py-2.5\" : 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 { IconButton } from \"./button\";\nimport { cn } from \"./cn\";\nimport { SystemSymbol } from \"./native\";\nimport { Text } from \"./text\";\n\n/**\n * The System Settings pane parts (macOS 26): the pane header (General, Screen Time, Apple Account),\n * a row of buttons inside or under a group (\"Display Settings…\", \"Add Account…\"), the (i) button\n * that opens a row's sheet, the storage-style usage bar with its legend, and the Displays pane's\n * arrangement. Pages compose them with `Section` and `Row`.\n */\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Pane header */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface PaneHeaderProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** The pane's picture: a 64 pt `SymbolTile`-style icon, a device symbol, or an app's own icon. */\n icon: React.ReactNode;\n /** The pane's (or the thing's) name. */\n title: React.ReactNode;\n /** One or two short lines under the name (what the pane is for, or the thing's model). */\n description?: React.ReactNode;\n /** One small control under the text (a \"Learn more…\" plain button), centered. */\n children?: React.ReactNode;\n}\n\n/**\n * System Settings' pane header: a grouped box at the top of a top-level pane, the picture centered,\n * the name in bold, one line of what it is. Also About's device header (the Mac's picture, its name\n * and its model) — one box, centered, never a card of its own style.\n */\nexport function PaneHeader({ icon, title, description, children, className, ...props }: PaneHeaderProps) {\n return (\n <header\n data-slot=\"pane-header\"\n className={cn(\"flex flex-col items-center gap-1 rounded-group bg-group px-6 pb-4 pt-5 text-center\", className)}\n {...props}\n >\n <span data-slot=\"pane-header-icon\" className=\"mb-1 flex min-h-16 items-center justify-center text-label-secondary\">\n {icon}\n </span>\n <Text as=\"h1\" variant=\"title-1\" emphasized>\n {title}\n </Text>\n {description ? (\n <Text as=\"p\" tone=\"secondary\" className=\"max-w-lg text-balance\">\n {description}\n </Text>\n ) : null}\n {children ? <div className=\"mt-1 flex items-center gap-2\">{children}</div> : null}\n </header>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Buttons in a group */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface SectionButtonsProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Under the group, outside its box (Internet Accounts' \"Add Account…\", Users & Groups' \"Add\n * User…\"). Without it the buttons are the group's last row (About's \"Display Settings…\",\n * Keyboard's \"Keyboard Shortcuts…\"), behind the same inset hairline as any row. */\n below?: boolean;\n}\n\n/** A trailing row of regular buttons, as System Settings ends a group: the default one rightmost. */\nexport function SectionButtons({ below, className, ...props }: SectionButtonsProps) {\n return (\n <div\n data-slot={below ? \"section-buttons\" : \"row\"}\n className={cn(\n \"flex flex-wrap items-center justify-end gap-2\",\n below ? \"-mt-2\" : \"relative px-3 py-2 before:absolute before:left-3 before:right-0 before:top-0 before:hidden before:h-px before:bg-separator\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* The (i) button */\n/* ---------------------------------------------------------------------------------------------- */\n\nfunction InfoGlyph() {\n return (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={1.75} strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n </svg>\n );\n}\n\nexport interface InfoButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\" | \"aria-label\"> {\n /** What the sheet shows (\"Details for work\"): the accessible name and the tooltip. */\n label: string;\n}\n\n/** System Settings' (i) at a row's trailing edge: it opens that row's sheet (details, Done). */\nexport const InfoButton = React.forwardRef<HTMLButtonElement, InfoButtonProps>(function InfoButton({ label, className, ...props }, ref) {\n return (\n <IconButton\n ref={ref}\n data-info-button=\"\"\n label={label}\n size=\"sm\"\n className={cn(\"text-label-secondary hover:text-label\", className)}\n icon={<SystemSymbol name=\"info.circle\" size={15} fallback={<InfoGlyph />} />}\n {...props}\n />\n );\n});\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Usage bar (About › Storage, Screen Time's categories) */\n/* ---------------------------------------------------------------------------------------------- */\n\n/** A segment's color: macOS's system colors, one per category (Storage: Apps, Documents …). */\nexport type UsageColor = \"blue\" | \"purple\" | \"orange\" | \"green\" | \"yellow\" | \"red\" | \"gray\";\n\nconst USAGE_COLOR: Record<UsageColor, string> = {\n blue: \"bg-system-blue\",\n purple: \"bg-system-purple\",\n orange: \"bg-system-orange\",\n green: \"bg-system-green\",\n yellow: \"bg-system-yellow\",\n red: \"bg-system-red\",\n gray: \"bg-system-gray\",\n};\n\nexport interface UsageSegment {\n key: string;\n label: string;\n value: number;\n color: UsageColor;\n /** The value as the legend says it (\"$1.20\", \"12 GB\"); defaults to the number. */\n valueLabel?: string;\n}\n\nexport interface UsageBarProps {\n [data: `data-${string}`]: string | undefined;\n segments: ReadonlyArray<UsageSegment>;\n /** The bar's whole length; defaults to the segments' sum (a full bar). */\n max?: number;\n \"aria-label\": string;\n className?: string;\n}\n\n/**\n * About › Storage's bar (and Screen Time's category split): one rounded bar, a colored run per\n * category in order, the rest empty; the legend under it names each color with its value.\n * A segment of 0 is left out of the bar but stays in the legend.\n */\nexport function UsageBar({ segments, max, className, \"aria-label\": ariaLabel, ...data }: UsageBarProps) {\n const sum = segments.reduce((s, x) => s + Math.max(0, x.value), 0);\n const whole = Math.max(max ?? sum, 1e-9);\n return (\n <div {...data} data-slot=\"usage-bar\" className={cn(\"flex w-full flex-col gap-2\", className)}>\n <div role=\"img\" aria-label={ariaLabel} className=\"flex h-3 w-full overflow-hidden rounded-full bg-fill-tertiary\">\n {segments\n .filter((s) => s.value > 0)\n .map((s) => (\n <span\n key={s.key}\n data-usage-segment={s.key}\n title={`${s.label}: ${s.valueLabel ?? String(s.value)}`}\n className={cn(\"h-full shrink-0 border-r border-content last:border-r-0\", USAGE_COLOR[s.color])}\n style={{ width: `${(Math.max(0, s.value) / whole) * 100}%` }}\n />\n ))}\n </div>\n <ul data-slot=\"usage-legend\" className=\"flex flex-wrap items-center gap-x-4 gap-y-1\">\n {segments.map((s) => (\n <li key={s.key} className=\"flex min-w-0 items-center gap-1.5\">\n <span aria-hidden className={cn(\"size-2 shrink-0 rounded-full\", USAGE_COLOR[s.color])} />\n <Text tone=\"secondary\" truncate>\n {s.label}\n </Text>\n {s.valueLabel !== undefined ? (\n <Text tabular truncate>\n {s.valueLabel}\n </Text>\n ) : null}\n </li>\n ))}\n </ul>\n </div>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Display arrangement (System Settings › Displays) */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface ArrangedDisplay {\n id: string;\n name: string;\n /** Global position and size in points, as the OS arranges them. */\n x: number;\n y: number;\n width: number;\n height: number;\n /** The main display carries the menu bar. */\n primary?: boolean;\n /** The computer's own screen (a laptop's): drawn on its base, never on a stand. */\n builtin?: boolean;\n /** An image of what the display shows (a capture); otherwise the screen is drawn dark. */\n preview?: string;\n}\n\nexport interface DisplayArrangementProps {\n [data: `data-${string}`]: string | undefined;\n displays: ReadonlyArray<ArrangedDisplay>;\n selected: string | null;\n onSelect: (id: string) => void;\n className?: string;\n}\n\n/** The arrangement's drawing box, in px: wide enough for three side by side, as tall as Displays' band. */\nconst ARRANGE_W = 480;\nconst ARRANGE_H = 104;\n\n/**\n * Displays' top band: every display drawn where the OS arranges it, to scale, its name under it; the\n * selected one ringed in the accent (its form follows below). One display draws large and centered.\n * Clicking a display selects it; arrow keys move between them.\n */\nexport function DisplayArrangement({ displays, selected, onSelect, className, ...data }: DisplayArrangementProps) {\n const minX = Math.min(...displays.map((d) => d.x));\n const minY = Math.min(...displays.map((d) => d.y));\n const maxX = Math.max(...displays.map((d) => d.x + d.width));\n const maxY = Math.max(...displays.map((d) => d.y + d.height));\n const scale = displays.length ? Math.min(ARRANGE_W / Math.max(1, maxX - minX), ARRANGE_H / Math.max(1, maxY - minY)) : 1;\n const boxW = (maxX - minX) * scale;\n const boxH = (maxY - minY) * scale;\n const move = (from: number, step: number) => {\n const next = displays[(from + step + displays.length) % displays.length];\n if (next) onSelect(next.id);\n };\n return (\n <div {...data} data-slot=\"display-arrangement\" role=\"listbox\" aria-label=\"Displays\" className={cn(\"flex justify-center rounded-group bg-group px-6 pb-3 pt-5\", className)}>\n <div className=\"relative\" style={{ width: boxW, height: boxH + 36 }}>\n {displays.map((d, i) => {\n const on = d.id === selected;\n return (\n <button\n key={d.id}\n type=\"button\"\n role=\"option\"\n aria-selected={on}\n data-arranged-display={d.id}\n onClick={() => onSelect(d.id)}\n onKeyDown={(event) => {\n if (event.key === \"ArrowRight\" || event.key === \"ArrowDown\") move(i, 1);\n else if (event.key === \"ArrowLeft\" || event.key === \"ArrowUp\") move(i, -1);\n else return;\n event.preventDefault();\n }}\n className=\"focus-ring absolute flex flex-col items-center gap-1.5 rounded-control\"\n style={{ left: (d.x - minX) * scale, top: (d.y - minY) * scale, width: d.width * scale }}\n >\n <span className=\"flex w-full flex-col items-center\">\n <span\n className={cn(\n \"block w-full overflow-hidden rounded-control bg-display-screen shadow-raised ring-offset-2 ring-offset-content\",\n on ? \"ring-2 ring-tint\" : \"ring-1 ring-separator\",\n )}\n style={{ height: d.height * scale }}\n >\n {d.preview ? <img alt=\"\" src={d.preview} draggable={false} className=\"size-full object-cover\" /> : null}\n </span>\n {/* Displays draws each screen as the thing it is: a laptop's on its base, a monitor on its stand. */}\n {d.builtin ? (\n <span aria-hidden data-display-base=\"\" className=\"block h-1 w-full rounded-b-control bg-label-tertiary\" />\n ) : (\n <span aria-hidden data-display-stand=\"\" className=\"flex w-full flex-col items-center\">\n <span className=\"block h-1.5 w-1/6 bg-label-tertiary\" />\n <span className=\"block h-0.5 w-1/3 rounded-full bg-label-tertiary\" />\n </span>\n )}\n </span>\n <Text emphasized={on} truncate className=\"max-w-full\">\n {d.name}\n </Text>\n </button>\n );\n })}\n </div>\n </div>\n );\n}\n","import * as SliderPrimitive from \"@radix-ui/react-slider\";\nimport * as React from \"react\";\n\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover\";\nimport { IconButton } from \"./button\";\nimport { cn } from \"./cn\";\nimport { SystemSymbol } from \"./native\";\nimport type { UsageColor } from \"./settings\";\nimport { Text } from \"./text\";\n\n/**\n * The rest of System Settings' controls (macOS 26): the slider with its tick marks and end labels\n * (Keyboard's Key repeat rate, Sound's Output volume), the round \"?\" help button at a pane's foot,\n * Screen Time's activity chart (a bar per day, split by category, with the average dashed) and its\n * date stepper (\"‹ Today ›\"). Pages compose them inside `Section` and `Row`.\n */\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Slider */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface SliderProps {\n [data: `data-${string}`]: string | undefined;\n value: number;\n min?: number;\n max?: number;\n step?: number;\n /** While dragging. */\n onValueChange?: (value: number) => void;\n /** When the person lets go (or presses a key): where a setting is written. */\n onValueCommit?: (value: number) => void;\n /** Tick marks under the track, evenly spaced, ends included (Keyboard's sliders have 8). */\n ticks?: number;\n /** Under the track's two ends: \"Slow\" and \"Fast\", \"Long\" and \"Short\". */\n minLabel?: React.ReactNode;\n maxLabel?: React.ReactNode;\n /** Beside the track's two ends: Sound's quiet and loud speakers. */\n leading?: React.ReactNode;\n trailing?: React.ReactNode;\n disabled?: boolean;\n \"aria-label\": string;\n className?: string;\n}\n\n/**\n * NSSlider (linear, regular): a thin track filled in the tint up to a round white knob, optional\n * tick marks under it and a label under each end. Arrow keys step; the value is written on commit.\n */\nexport function Slider({\n value,\n min = 0,\n max = 100,\n step = 1,\n onValueChange,\n onValueCommit,\n ticks,\n minLabel,\n maxLabel,\n leading,\n trailing,\n disabled,\n className,\n \"aria-label\": ariaLabel,\n ...data\n}: SliderProps) {\n return (\n <div {...data} data-slot=\"slider\" className={cn(\"flex w-full min-w-0 flex-col gap-0.5\", className)}>\n <div className=\"flex min-w-0 items-center gap-2\">\n {leading ? <span className=\"flex shrink-0 items-center text-label-secondary\">{leading}</span> : null}\n <SliderPrimitive.Root\n value={[value]}\n min={min}\n max={max}\n step={step}\n disabled={disabled === true}\n aria-label={ariaLabel}\n onValueChange={(v) => onValueChange?.(v[0] ?? value)}\n onValueCommit={(v) => onValueCommit?.(v[0] ?? value)}\n className=\"relative flex h-5 min-w-0 flex-1 touch-none select-none items-center data-[disabled]:opacity-40\"\n >\n <SliderPrimitive.Track className=\"relative h-1 grow overflow-hidden rounded-full bg-fill-tertiary\">\n <SliderPrimitive.Range data-slot=\"slider-range\" className=\"absolute h-full bg-tint\" />\n </SliderPrimitive.Track>\n <SliderPrimitive.Thumb\n aria-label={ariaLabel}\n data-slot=\"slider-thumb\"\n className=\"focus-ring block size-5 rounded-full bg-knob shadow-control transition-transform duration-100 active:scale-95\"\n />\n </SliderPrimitive.Root>\n {trailing ? <span className=\"flex shrink-0 items-center text-label-secondary\">{trailing}</span> : null}\n </div>\n {ticks && ticks > 1 ? (\n // NSSlider's tick marks: a small dot under the track at each stop (Keyboard, Sound).\n <div aria-hidden data-slot=\"slider-ticks\" className={cn(\"-mt-0.5 flex justify-between px-2.5\", leading ? \"ml-6\" : \"\", trailing ? \"mr-6\" : \"\")}>\n {Array.from({ length: ticks }, (_, i) => (\n <span key={i} className=\"size-0.5 rounded-full bg-label-tertiary\" />\n ))}\n </div>\n ) : null}\n {minLabel || maxLabel ? (\n // The end labels in the label color, as Keyboard's \"Off … Fast\" (measured: #272727 on the group).\n <div data-slot=\"slider-labels\" className=\"flex justify-between\">\n <Text variant=\"footnote\">{minLabel}</Text>\n <Text variant=\"footnote\">{maxLabel}</Text>\n </div>\n ) : null}\n </div>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* The \"?\" help button */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface HelpButtonProps {\n [data: `data-${string}`]: string | undefined;\n /** The pane the help is about (\"Help for Sound\"): the accessible name and the tooltip. */\n label: string;\n /** What the popover says: a title line and one or two short lines. */\n children: React.ReactNode;\n className?: string;\n}\n\n/**\n * System Settings' round \"?\" at the pane's trailing foot. Apple's opens the Mac User Guide; ours\n * opens a popover that says what the pane is and does, so the button is never a dead end.\n */\nexport function HelpButton({ label, children, className, ...data }: HelpButtonProps) {\n return (\n <div {...data} data-slot=\"help-button-row\" className={cn(\"flex justify-end\", className)}>\n <Popover>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n aria-label={label}\n title={label}\n data-help-button=\"\"\n className=\"focus-ring inline-flex size-5 items-center justify-center rounded-full bg-control text-body text-label shadow-control\"\n >\n ?\n </button>\n </PopoverTrigger>\n <PopoverContent align=\"end\" className=\"w-72\" data-help-popover=\"\">\n <div className=\"flex flex-col gap-1\">{children}</div>\n </PopoverContent>\n </Popover>\n </div>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Screen Time's activity chart */\n/* ---------------------------------------------------------------------------------------------- */\n\nconst BAR_COLOR: Record<UsageColor, string> = {\n blue: \"bg-system-blue\",\n purple: \"bg-system-purple\",\n orange: \"bg-system-orange\",\n green: \"bg-system-green\",\n yellow: \"bg-system-yellow\",\n red: \"bg-system-red\",\n gray: \"bg-system-gray\",\n};\n\nexport interface ActivityBar {\n key: string;\n /** Under the bar: \"S\", \"M\", \"T\" (a day), \"12 AM\" (an hour). */\n label: string;\n /** The whole bar's name and value for the tooltip and screen readers (\"Wed, Oct 8: $41.20\"). */\n title: string;\n segments: ReadonlyArray<{ key: string; value: number; color: UsageColor }>;\n}\n\nexport interface ActivityChartProps {\n [data: `data-${string}`]: string | undefined;\n bars: ReadonlyArray<ActivityBar>;\n /** The bar shown in the list below; the others draw lighter. */\n selected?: string | null;\n onSelect?: (key: string) => void;\n /** The average across the bars, drawn as a dashed line labeled \"avg\". */\n average?: number | null;\n /** An axis value as it should read, in the chart's real units (\"$80\", \"$0.50\"): the top, the\n * middle and zero are each labeled, so a bar reads against the lines beside it. */\n formatValue: (value: number) => string;\n /** The chart's own legend under the days (Screen Time's categories): each color's name and, when\n * given, its figure for the period (\"Chats $0.27 · Helpers $0.00\"), so no separate bar repeats it. */\n legend?: ReadonlyArray<{ key: string; label: string; color: UsageColor; valueLabel?: string }>;\n \"aria-label\": string;\n className?: string;\n}\n\n/** A clean top for the axis: 1, 2 or 5 × a power of ten, at or above the tallest bar. */\nfunction niceMax(v: number): number {\n if (v <= 0) return 1;\n const p = 10 ** Math.floor(Math.log10(v));\n for (const m of [1, 2, 5, 10]) if (m * p >= v) return m * p;\n return 10 * p;\n}\n\n/**\n * Screen Time's App & Website Activity chart: a bar per day, each stacked by category in the\n * category's color, the average as a dashed line with \"avg\", the scale on the trailing edge, the\n * day under each bar. Clicking a bar selects that day (the list below follows); the others dim.\n */\nexport function ActivityChart({ bars, selected, onSelect, average, formatValue, legend, className, \"aria-label\": ariaLabel, ...data }: ActivityChartProps) {\n const totals = bars.map((b) => b.segments.reduce((s, x) => s + Math.max(0, x.value), 0));\n const top = niceMax(Math.max(0, ...totals, average ?? 0));\n const pct = (v: number) => `${Math.min(100, (Math.max(0, v) / top) * 100)}%`;\n return (\n <div {...data} data-slot=\"activity-chart\" role=\"group\" aria-label={ariaLabel} className={cn(\"flex w-full flex-col gap-1\", className)}>\n <div className=\"flex items-stretch gap-2\">\n <div className=\"relative flex h-32 flex-1 items-end gap-2 border-b border-separator\">\n {/* The scale's middle and top lines, as Screen Time draws them. */}\n <span aria-hidden className=\"pointer-events-none absolute inset-x-0 top-0 border-t border-separator\" />\n <span aria-hidden className=\"pointer-events-none absolute inset-x-0 top-1/2 border-t border-separator\" />\n {average && average > 0 ? (\n <span aria-hidden data-slot=\"activity-average\" className=\"pointer-events-none absolute inset-x-0 border-t border-dashed border-system-green\" style={{ bottom: pct(average) }} />\n ) : null}\n {bars.map((b, i) => {\n const on = selected === undefined || selected === null || selected === b.key;\n return (\n <button\n key={b.key}\n type=\"button\"\n data-activity-bar={b.key}\n aria-pressed={selected === b.key}\n aria-label={b.title}\n title={b.title}\n onClick={() => onSelect?.(b.key)}\n disabled={!onSelect}\n className={cn(\"focus-ring relative flex h-full min-w-0 flex-1 flex-col justify-end rounded-control disabled:cursor-default\", on ? \"\" : \"opacity-40\")}\n >\n <span className=\"flex w-full flex-col-reverse overflow-hidden rounded-t-control\" style={{ height: pct(totals[i] ?? 0) }}>\n {b.segments\n .filter((s) => s.value > 0)\n .map((s) => (\n <span key={s.key} data-activity-segment={s.key} className={cn(\"w-full shrink-0\", BAR_COLOR[s.color])} style={{ height: `${((totals[i] ?? 0) > 0 ? s.value / (totals[i] ?? 1) : 0) * 100}%` }} />\n ))}\n </span>\n </button>\n );\n })}\n </div>\n {/* The scale in real units at each line it draws (Screen Time: the top, the middle, zero), and\n \"avg\" beside the dashed line, at its own height. */}\n <div aria-hidden data-slot=\"activity-axis\" className=\"relative w-12\">\n <Text variant=\"footnote\" tone=\"secondary\" tabular data-activity-axis=\"top\" className=\"absolute left-0 top-0 -translate-y-1/2 whitespace-nowrap\">\n {formatValue(top)}\n </Text>\n <Text variant=\"footnote\" tone=\"secondary\" tabular data-activity-axis=\"middle\" className=\"absolute left-0 top-1/2 -translate-y-1/2 whitespace-nowrap\">\n {formatValue(top / 2)}\n </Text>\n <Text variant=\"footnote\" tone=\"secondary\" tabular data-activity-axis=\"zero\" className=\"absolute bottom-0 left-0 translate-y-1/2 whitespace-nowrap\">\n {formatValue(0)}\n </Text>\n {average && average > 0 ? (\n <Text variant=\"footnote\" className=\"absolute right-0 translate-y-1/2 text-system-green\" style={{ bottom: pct(average) }}>\n avg\n </Text>\n ) : null}\n </div>\n </div>\n <div aria-hidden className=\"flex gap-2 pr-14\">\n {bars.map((b) => (\n <Text key={b.key} variant=\"footnote\" tone={selected === b.key ? undefined : \"secondary\"} emphasized={selected === b.key} className=\"min-w-0 flex-1 whitespace-nowrap text-center\">\n {b.label}\n </Text>\n ))}\n </div>\n {legend?.length ? (\n <ul data-slot=\"activity-legend\" className=\"mt-2 flex flex-wrap items-center gap-x-4 gap-y-1\">\n {legend.map((l) => (\n <li key={l.key} data-activity-legend={l.key} className=\"flex min-w-0 items-center gap-1.5\">\n <span aria-hidden className={cn(\"size-2 shrink-0 rounded-full\", BAR_COLOR[l.color])} />\n <Text tone=\"secondary\" truncate>\n {l.label}\n </Text>\n {l.valueLabel !== undefined ? (\n <Text tabular truncate>\n {l.valueLabel}\n </Text>\n ) : null}\n </li>\n ))}\n </ul>\n ) : null}\n </div>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Date stepper */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface DateStepperProps {\n [data: `data-${string}`]: string | undefined;\n /** \"Today\", \"Yesterday\", \"Wednesday, Oct 8\", \"This Week\". */\n label: React.ReactNode;\n onPrevious: () => void;\n onNext: () => void;\n previousDisabled?: boolean;\n nextDisabled?: boolean;\n className?: string;\n}\n\n/** Screen Time's period stepper: a back and a forward chevron around the period it shows. */\nexport function DateStepper({ label, onPrevious, onNext, previousDisabled, nextDisabled, className, ...data }: DateStepperProps) {\n return (\n <div {...data} data-slot=\"date-stepper\" className={cn(\"inline-flex items-center gap-1\", className)}>\n <IconButton label=\"Previous\" size=\"sm\" disabled={previousDisabled === true} onClick={onPrevious} icon={<SystemSymbol name=\"chevron.left\" size={13} fallback={<Chevron left />} />} />\n <Text emphasized className=\"min-w-24 text-center\" data-date-stepper-label=\"\">\n {label}\n </Text>\n <IconButton label=\"Next\" size=\"sm\" disabled={nextDisabled === true} onClick={onNext} icon={<SystemSymbol name=\"chevron.right\" size={13} fallback={<Chevron />} />} />\n </div>\n );\n}\n\nfunction Chevron({ left }: { left?: boolean }) {\n return (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d={left ? \"m15 18-6-6 6-6\" : \"m9 18 6-6-6-6\"} />\n </svg>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* A small table inside a group (Sound's devices) */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface GroupTableColumn {\n key: string;\n header: string;\n /** The first column takes the spare width; the others are this wide (\"md\" = 8 rem, \"lg\" = 12 rem). */\n width?: \"md\" | \"lg\";\n}\n\nexport interface GroupTableRow {\n key: string;\n cells: ReadonlyArray<React.ReactNode>;\n /** Extra hooks for the row (tests, screens). */\n data?: Record<`data-${string}`, string | undefined>;\n}\n\nexport interface GroupTableProps {\n [data: `data-${string}`]: string | undefined;\n columns: ReadonlyArray<GroupTableColumn>;\n rows: ReadonlyArray<GroupTableRow>;\n /** The row the system is using now (Sound's selected device): drawn in the selection's gray. */\n current?: string | null;\n \"aria-label\": string;\n className?: string;\n}\n\n/**\n * The small table System Settings draws inside a group (Sound › Output & Input): a header of\n * column names in the label color, then a row per thing on alternating stripes, the one in use highlighted.\n * It shows; it does not pick (a choice goes through a control that really changes it).\n */\nexport function GroupTable({ columns, rows, current, className, \"aria-label\": ariaLabel, ...data }: GroupTableProps) {\n const width = (c: GroupTableColumn, i: number) => (i === 0 ? \"min-w-0 flex-1\" : c.width === \"lg\" ? \"w-48 shrink-0\" : \"w-32 shrink-0\");\n return (\n <div {...data} data-slot=\"group-table\" role=\"table\" aria-label={ariaLabel} className={cn(\"flex flex-col\", className)}>\n <div role=\"row\" className=\"flex items-center gap-3 border-b border-separator px-3 py-1\">\n {columns.map((c, i) => (\n // Sound's \"Name\" and \"Type\": 11 pt in the label color (measured #252525), never a faint caption.\n <Text key={c.key} role=\"columnheader\" variant=\"subheadline\" className={width(c, i)}>\n {c.header}\n </Text>\n ))}\n </div>\n {rows.map((r) => (\n <div\n key={r.key}\n role=\"row\"\n aria-current={r.key === current ? \"true\" : undefined}\n {...r.data}\n className={cn(\"flex h-6 items-center gap-3 px-3 even:bg-fill-tertiary\", r.key === current ? \"bg-selection-muted even:bg-selection-muted\" : \"\")}\n >\n {r.cells.map((cell, i) => (\n <span key={columns[i]?.key ?? i} role=\"cell\" className={cn(\"flex items-center\", width(columns[i] ?? { key: \"\", header: \"\" }, i))}>\n {typeof cell === \"string\" ? <Text truncate>{cell}</Text> : cell}\n </span>\n ))}\n </div>\n ))}\n </div>\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-code text-label\",\n scroll && \"max-h-80 overflow-y-auto\",\n className,\n )}\n {...props}\n >\n {children}\n </pre>\n );\n}\n\n/**\n * Terminal's default profile (macOS 26), measured from Terminal itself: the same in light and dark\n * (Terminal keeps its profile whatever the appearance) — light text on a deep blue-grey, a solid\n * light block cursor. For a library that paints its own surface (xterm) and takes literal colors;\n * this is the profile's art, never interface color for anything else.\n */\nexport const TERMINAL_PROFILE = {\n background: \"#212734\",\n foreground: \"#e6e6e6\",\n cursor: \"#dedede\",\n selection: \"#4a5468\",\n} as const;\n","import * as React from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { XIcon } from \"../icons\";\nimport { IconButton } from \"./button\";\nimport { cn } from \"./cn\";\nimport { clampRectToViewport, readViewport, useDragMove } from \"../window-drag\";\n\n/** Px of the panel that stay on screen when it is dragged toward an edge. */\nconst TITLEBAR_KEEP_VISIBLE = 80;\n\nexport interface InspectorPanelProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n open: boolean;\n /** Close (its close button, or Escape while focus is inside it). */\n onClose: () => void;\n /** The panel's title bar (\"mds (114)\"). */\n title: string;\n /** The buttons at its foot (Activity Monitor's Sample and Quit), trailing. */\n footer?: React.ReactNode;\n children: React.ReactNode;\n}\n\n/**\n * Activity Monitor's process inspector: a utility panel of its own over the window, never a sheet.\n * Nothing behind it is dimmed or blocked (the table stays live: select, scroll, open another row),\n * its title bar names what it inspects and drags it, its close button sits at the leading edge, and\n * Escape inside it closes it. It opens at the window's trailing side, under the toolbar.\n */\nexport function InspectorPanel({ open, onClose, title, footer, children, className, ...props }: InspectorPanelProps) {\n const [offset, setOffset] = React.useState({ x: 0, y: 0 });\n const panelRef = React.useRef<HTMLDivElement | null>(null);\n const [element, setElement] = React.useState<HTMLDivElement | null>(null);\n const setPanel = React.useCallback((node: HTMLDivElement | null) => {\n panelRef.current = node;\n setElement(node);\n }, []);\n // THE WINDOW DRAG (window-drag.ts): the title bar drags it, the title bar stays on screen.\n const drag = useDragMove({\n element,\n paint: \"offset\",\n offset,\n constrain: (next) => clampRectToViewport(next, readViewport(), { keepVisible: TITLEBAR_KEEP_VISIBLE }),\n onCommit: (_rect, commit) => setOffset(commit.offset),\n });\n // A panel opens where it opened last (AppKit keeps a panel's frame), and takes focus once.\n React.useEffect(() => {\n if (open) panelRef.current?.focus();\n }, [open]);\n if (!open || typeof document === \"undefined\") return null;\n return createPortal(\n <div\n ref={setPanel}\n role=\"dialog\"\n aria-modal={false}\n aria-label={title}\n tabIndex={-1}\n data-slot=\"inspector-panel\"\n className={cn(\"fixed right-6 top-16 flex w-96 max-w-full flex-col overflow-hidden rounded-panel bg-content text-body text-label outline-none\", className)}\n style={{ translate: `${offset.x}px ${offset.y}px` }}\n onKeyDown={(event) => {\n if (event.key === \"Escape\" && !event.defaultPrevented) {\n event.stopPropagation();\n onClose();\n }\n }}\n {...props}\n >\n <div data-slot=\"inspector-panel-titlebar\" className=\"relative flex h-control-lg shrink-0 cursor-default items-center justify-center px-2\" onPointerDown={drag.onPointerDown}>\n <span className=\"absolute left-2 flex items-center\">\n <IconButton size=\"sm\" label=\"Close\" icon={<XIcon />} onClick={onClose} />\n </span>\n <span data-slot=\"inspector-panel-title\" className=\"min-w-0 truncate px-8 text-headline\">\n {title}\n </span>\n </div>\n <div data-slot=\"inspector-panel-body\" className=\"flex min-h-0 flex-col gap-3 overflow-y-auto px-5 pb-5 pt-2\">\n {children}\n </div>\n {footer ? <div data-slot=\"inspector-panel-footer\" className=\"flex shrink-0 items-center gap-2 px-5 pb-5\">{footer}</div> : null}\n </div>,\n document.body,\n );\n}\n","import * as React from \"react\";\n\nimport { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from \"../dropdown-menu\";\nimport { ChevronDownIcon } from \"../icons\";\nimport { Tooltip, TooltipTrigger } from \"../tooltip\";\nimport { cn } from \"./cn\";\nimport { ConfirmDialog } from \"./sheet\";\nimport { DropdownMenuEntries, type RowMenuItem } from \"./menu-entries\";\nimport { TooltipContent } from \"./tooltip\";\n\nexport interface PullDownButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\" | \"aria-label\" | \"type\"> {\n /** The accessible name and the tooltip (\"Process actions\"). */\n label: string;\n /** The symbol before the arrow (an `ellipsis.circle` SystemSymbol). */\n icon: React.ReactNode;\n /** The menu: `\"-\"` items are separators; a destructive item with `confirm` asks first. */\n items: ReadonlyArray<RowMenuItem>;\n}\n\n/**\n * A toolbar pull-down (NSPopUpButton, pullsDown): a symbol with a small down arrow beside it that\n * opens a menu of actions, as Activity Monitor's \"…\" before its view switch acts on the selected\n * process. Never a bare \"…\" at the toolbar's end.\n */\nexport function PullDownButton({ label, icon, items, disabled = false, className, ...props }: PullDownButtonProps) {\n const [asking, setAsking] = React.useState<RowMenuItem | null>(null);\n return (\n <>\n <DropdownMenu>\n <Tooltip>\n <TooltipTrigger asChild>\n <DropdownMenuTrigger asChild>\n <button\n {...props}\n type=\"button\"\n data-slot=\"pull-down-button\"\n aria-label={label}\n disabled={disabled}\n className={cn(\n \"focus-ring inline-flex h-control shrink-0 select-none items-center gap-0.5 rounded-control px-1 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-[state=open]:bg-fill-secondary [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className,\n )}\n >\n <span className=\"flex size-icon items-center justify-center [&_svg]:size-icon\">{icon}</span>\n <ChevronDownIcon aria-hidden className=\"size-2.5\" />\n </button>\n </DropdownMenuTrigger>\n </TooltipTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n <DropdownMenuContent align=\"start\" data-slot=\"pull-down-menu\">\n <DropdownMenuEntries items={items} onAsk={setAsking} />\n </DropdownMenuContent>\n </DropdownMenu>\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 </>\n );\n}\n","import * as React from \"react\";\n\nimport { ContextMenuItem, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger } from \"../context-menu\";\nimport { DropdownMenuItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger } from \"../dropdown-menu\";\n\n/** One item of a row's (or tile's, or pull-down's) menu. */\nexport interface RowMenuItem {\n /** The item's words; \"-\" is a separator between groups (NSMenu's sections). */\n label: string;\n onSelect: () => void;\n /** The leading SF Symbol (a `SystemSymbol`), or an app's own icon, as macOS 26 menus draw one beside each item. */\n icon?: React.ReactNode;\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 /** A submenu (NSMenu's): the item opens these choices beside it; its own `onSelect` is not called. */\n items?: ReadonlyArray<RowMenuItem>;\n}\n\n/** A menu item's content: its leading symbol (when it has one) and its words. */\nexport function MenuItemLabel({ item }: { item: Pick<RowMenuItem, \"label\" | \"icon\"> }) {\n return (\n <>\n {item.icon ? (\n <span aria-hidden data-slot=\"menu-item-symbol\">\n {item.icon}\n </span>\n ) : null}\n <span className=\"min-w-0 flex-1 truncate\">{item.label}</span>\n </>\n );\n}\n\n/** What a destructive item with a question does on select: asks through `onAsk`, else runs. */\nconst choose = (item: RowMenuItem, onAsk: (item: RowMenuItem) => void) => () => (item.destructive && item.confirm ? onAsk(item) : item.onSelect());\n\n/**\n * A right-click menu's items, the one way every desktop menu draws them: separators, destructive\n * items in red (asking first), and submenus. Every menu that takes `RowMenuItem`s renders through this.\n */\nexport function ContextMenuEntries({ items, onAsk }: { items: ReadonlyArray<RowMenuItem>; onAsk: (item: RowMenuItem) => void }): React.JSX.Element {\n return (\n <>\n {items.map((item, i) =>\n item.label === \"-\" ? (\n <ContextMenuSeparator key={`sep-${i}`} />\n ) : item.items ? (\n <ContextMenuSub key={`${item.label}-${i}`}>\n <ContextMenuSubTrigger data-menu-item={item.label} {...(item.disabled ? { disabled: true } : {})}>\n <MenuItemLabel item={item} />\n </ContextMenuSubTrigger>\n <ContextMenuSubContent>\n <ContextMenuEntries items={item.items} onAsk={onAsk} />\n </ContextMenuSubContent>\n </ContextMenuSub>\n ) : (\n <ContextMenuItem\n key={`${item.label}-${i}`}\n data-menu-item={item.label}\n {...(item.disabled !== undefined ? { disabled: item.disabled } : {})}\n {...(item.destructive ? { className: \"text-system-red\", \"data-destructive\": \"\" } : {})}\n onSelect={choose(item, onAsk)}\n >\n <MenuItemLabel item={item} />\n </ContextMenuItem>\n ),\n )}\n </>\n );\n}\n\n/** The same items in a pull-down (a More button, a toolbar pull-down). */\nexport function DropdownMenuEntries({ items, onAsk }: { items: ReadonlyArray<RowMenuItem>; onAsk: (item: RowMenuItem) => void }): React.JSX.Element {\n return (\n <>\n {items.map((item, i) =>\n item.label === \"-\" ? (\n <DropdownMenuSeparator key={`sep-${i}`} />\n ) : item.items ? (\n <DropdownMenuSub key={`${item.label}-${i}`}>\n <DropdownMenuSubTrigger data-menu-item={item.label} {...(item.disabled ? { disabled: true } : {})}>\n <MenuItemLabel item={item} />\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent>\n <DropdownMenuEntries items={item.items} onAsk={onAsk} />\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n ) : (\n <DropdownMenuItem\n key={`${item.label}-${i}`}\n data-menu-item={item.label}\n disabled={item.disabled ?? false}\n onSelect={choose(item, onAsk)}\n {...(item.destructive ? { className: \"text-system-red focus:text-system-red\", \"data-destructive\": \"\" } : {})}\n >\n <MenuItemLabel item={item} />\n </DropdownMenuItem>\n ),\n )}\n </>\n );\n}\n","import * as React from \"react\";\nimport { flushSync } from \"react-dom\";\n\nimport { DropdownMenu, DropdownMenuContent, DropdownMenuSeparator, DropdownMenuTrigger } from \"../dropdown-menu\";\nimport { IconButton } from \"./button\";\nimport { cn } from \"./cn\";\nimport { SystemSymbol } from \"./native\";\n\nexport interface ToolbarOverflowItem {\n /** Stable id (`data-toolbar-item`). */\n id: string;\n /** The item as the toolbar draws it. */\n item: React.ReactNode;\n /** Its menu form (NSToolbarItem.menuFormRepresentation): DropdownMenu items shown in the » menu\n * while the item does not fit. Absent: the item never leaves the toolbar (search, filter). */\n menu?: React.ReactNode;\n /** NSToolbarItem.visibilityPriority: lower leaves first; ties leave from the trailing end. */\n priority?: number;\n /** Items of one section share the » menu without a separator; a new section starts after one. */\n section?: string;\n}\n\nexport interface ToolbarOverflowProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n /** In toolbar order. `false`/`null` entries are skipped, so items can be written conditionally. */\n items: ReadonlyArray<ToolbarOverflowItem | false | null | undefined>;\n /** The » button's name and tooltip. */\n label?: string;\n}\n\nconst NONE: ReadonlySet<string> = new Set();\n\n/** The free width in the row that clips the toolbar (the space before its trailing group). */\nfunction freeSpace(el: HTMLElement): number {\n let row = el.parentElement;\n while (row && row !== document.body) {\n const style = getComputedStyle(row);\n if (style.overflowX !== \"visible\") break;\n row = row.parentElement;\n }\n if (!row || row === document.body) return 0;\n const style = getComputedStyle(row);\n if (!style.display.includes(\"flex\") || style.flexDirection.startsWith(\"column\")) return 0;\n const kids = Array.from(row.children).filter((c) => {\n if (c.getClientRects().length === 0) return false;\n const position = getComputedStyle(c).position;\n return position !== \"absolute\" && position !== \"fixed\";\n });\n const gap = Number.parseFloat(style.columnGap) || 0;\n const used = kids.reduce((n, c) => n + c.getBoundingClientRect().width, 0) + gap * Math.max(0, kids.length - 1);\n const inner = row.clientWidth - (Number.parseFloat(style.paddingLeft) || 0) - (Number.parseFloat(style.paddingRight) || 0);\n return Math.max(0, inner - used);\n}\n\nfunction sameSet(a: ReadonlySet<string>, b: ReadonlySet<string>): boolean {\n return a.size === b.size && [...a].every((x) => b.has(x));\n}\n\n/**\n * NSToolbar's overflow: a row of toolbar items that keeps every one it has room for and moves the\n * rest, lowest priority first, into a » menu at its trailing end, each as its menu form — so a\n * narrow window never cuts an item off and every action stays one click away. Items with no `menu`\n * (the search field, the filter) always stay. Put it in a `PageHeader`'s `actions`.\n */\nexport function ToolbarOverflow({ items, label = \"More toolbar items\", className, ...props }: ToolbarOverflowProps) {\n const list = items.filter((i): i is ToolbarOverflowItem => Boolean(i));\n const root = React.useRef<HTMLDivElement>(null);\n // Each item's width as last laid out (kept while it sits in the » menu). Items that always stay\n // (a search field) are flexible: they give way to their own minimum before anything leaves.\n const widths = React.useRef(new Map<string, number>());\n const [hidden, setHidden] = React.useState<ReadonlySet<string>>(NONE);\n const latest = React.useRef(list);\n latest.current = list;\n\n const fit = React.useCallback(() => {\n const el = root.current;\n if (!el) return;\n for (const child of Array.from(el.children) as HTMLElement[]) {\n const id = child.dataset.toolbarItem ?? (child.dataset.toolbarOverflow !== undefined ? \"\\u00bb\" : undefined);\n if (id === undefined) continue;\n // An item that always stays is laid out as its own content (display: contents).\n const boxes = child.dataset.toolbarPinned !== undefined ? (Array.from(child.children) as HTMLElement[]) : [child];\n if (boxes.every((b) => b.getClientRects().length === 0)) continue;\n widths.current.set(id, boxes.reduce((n, b) => n + b.getBoundingClientRect().width, 0));\n }\n const all = latest.current;\n const gap = Number.parseFloat(getComputedStyle(el).columnGap) || 0;\n const available = el.clientWidth + freeSpace(el);\n const need = (shown: ToolbarOverflowItem[], chevron: boolean): number => {\n const parts = shown.map((i) => widths.current.get(i.id) ?? 0);\n if (chevron) parts.push(widths.current.get(\"»\") ?? 0);\n return parts.reduce((n, w) => n + w, 0) + gap * Math.max(0, parts.length - 1);\n };\n const next = new Set<string>();\n if (need(all, false) > available + 0.5) {\n const order = all\n .map((item, index) => ({ item, index }))\n .filter(({ item }) => item.menu !== undefined)\n .sort((a, b) => (a.item.priority ?? 0) - (b.item.priority ?? 0) || b.index - a.index);\n for (const { item } of order) {\n next.add(item.id);\n if (need(all.filter((i) => !next.has(i.id)), true) <= available + 0.5) break;\n }\n }\n setHidden((prev) => (sameSet(prev, next) ? prev : next));\n }, []);\n\n // Every render: an item came or went, or one changed size.\n React.useLayoutEffect(fit);\n React.useEffect(() => {\n const el = root.current;\n if (!el || typeof ResizeObserver === \"undefined\") return;\n // After the observer's turn, never inside it (a layout change there is the \"ResizeObserver loop\").\n let timer: ReturnType<typeof setTimeout> | undefined;\n const later = () => {\n clearTimeout(timer);\n // Committed at once, so the window's own fold check that follows sees the items already gone.\n timer = setTimeout(() => flushSync(fit), 0);\n };\n const observer = new ResizeObserver(later);\n for (let node: HTMLElement | null = el; node && node !== document.body; node = node.parentElement) observer.observe(node);\n return () => {\n clearTimeout(timer);\n observer.disconnect();\n };\n }, [fit]);\n\n const overflowed = list.filter((i) => hidden.has(i.id));\n return (\n <div ref={root} data-slot=\"toolbar-overflow\" className={cn(\"relative flex min-w-0 items-center gap-2\", className)} {...props}>\n {list.map((i) => (\n <div\n key={i.id}\n data-toolbar-item={i.id}\n data-toolbar-pinned={i.menu === undefined ? \"\" : undefined}\n data-overflowed={hidden.has(i.id) || undefined}\n // An item that always stays is its content's own flex item, so a search field gives way to its minimum.\n className={cn(i.menu === undefined ? \"contents\" : \"flex shrink-0 items-center\", hidden.has(i.id) && \"hidden\")}\n >\n {i.item}\n </div>\n ))}\n {/* Always laid out so its width is known; out of the flow and unseen until something overflows. */}\n <div data-toolbar-overflow=\"\" className={cn(\"flex shrink-0 items-center\", overflowed.length === 0 && \"invisible absolute\")} aria-hidden={overflowed.length === 0 || undefined}>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <IconButton\n data-toolbar-overflow-button=\"\"\n label={label}\n tabIndex={overflowed.length === 0 ? -1 : undefined}\n icon={\n <SystemSymbol\n name=\"chevron.forward.2\"\n size={15}\n fallback={\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"m6 17 5-5-5-5\" />\n <path d=\"m13 17 5-5-5-5\" />\n </svg>\n }\n />\n }\n />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" data-slot=\"toolbar-overflow-menu\">\n {overflowed.map((i, n) => (\n <React.Fragment key={i.id}>\n {n > 0 && (i.section ?? i.id) !== (overflowed[n - 1]?.section ?? overflowed[n - 1]?.id) ? <DropdownMenuSeparator /> : null}\n {i.menu}\n </React.Fragment>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n </div>\n );\n}\n","import * as React from \"react\";\n\nimport { RadixCheckIcon, ChevronRightIcon, PlusIcon } from \"../icons\";\nimport { cn } from \"./cn\";\nimport { Spinner } from \"./spinner\";\nimport { Text } from \"./text\";\n\n/*\n * The document apps' parts: Finder's Get Info window (header, disclosure sections, right-aligned\n * facts) and its status bar, Reminders' list (tinted title and count, ring rows), the empty states\n * of Notes and Reminders (\"No Notes\"), Simulator's device and FileMerge's two panes.\n */\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Get Info */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface InfoHeaderProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** The thing's icon or symbol, drawn at 32 pt. */\n icon: React.ReactNode;\n title: React.ReactNode;\n /** Trailing on the title line (Get Info: the size). */\n value?: React.ReactNode;\n /** The line under the title (Get Info: \"Modified: Today, 6:23 AM\"). */\n subtitle?: React.ReactNode;\n}\n\n/**\n * Get Info's head: the big icon, the name in bold with its size trailing, one secondary line. A long\n * name wraps under itself; give a `MiddleTruncate` (text.tsx) as the title to cut its middle on one\n * line instead, as Get Info does a long file name. The icon keeps the color it is given.\n */\nexport function InfoHeader({ icon, title, value, subtitle, className, ...props }: InfoHeaderProps) {\n return (\n <header data-slot=\"info-header\" className={cn(\"flex items-start gap-3 px-3 py-3\", className)} {...props}>\n <span className=\"flex size-icon-xl shrink-0 items-center justify-center text-tint [&_img]:size-icon-xl [&_svg]:size-icon-xl\">{icon}</span>\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <div className=\"flex min-w-0 items-baseline gap-2\">\n <Text as=\"h1\" variant=\"headline\" data-slot=\"info-header-title\" className=\"min-w-0 flex-1 wrap-anywhere\">\n {title}\n </Text>\n {value !== undefined && value !== null ? (\n <Text tabular className=\"shrink-0\">\n {value}\n </Text>\n ) : null}\n </div>\n {subtitle ? (\n <Text tone=\"secondary\" truncate>\n {subtitle}\n </Text>\n ) : null}\n </div>\n </header>\n );\n}\n\nexport interface DisclosureProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** The section's name, without its colon (Get Info writes \"General:\"). */\n title: string;\n /** Uncontrolled: open at first (default true). */\n defaultOpen?: boolean;\n /** Controlled open state. */\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\n/**\n * Get Info's collapsible section: a disclosure triangle and \"Title:\" on a 24 pt line, a hairline\n * above, the content indented under the title. The triangle turns down when open.\n */\nexport function Disclosure({ title, defaultOpen = true, open, onOpenChange, className, children, ...props }: DisclosureProps) {\n const [own, setOwn] = React.useState(defaultOpen);\n const shown = open ?? own;\n const id = React.useId();\n const toggle = () => {\n if (open === undefined) setOwn(!shown);\n onOpenChange?.(!shown);\n };\n return (\n <section data-slot=\"disclosure\" data-state={shown ? \"open\" : \"closed\"} className={cn(\"border-t border-separator\", className)} {...props}>\n <button\n type=\"button\"\n aria-expanded={shown}\n aria-controls={id}\n onClick={toggle}\n className=\"focus-ring flex h-row-compact w-full items-center gap-1 px-1.5 text-left text-body text-label\"\n >\n <ChevronRightIcon aria-hidden className={cn(\"size-icon-sm shrink-0 text-label-secondary transition-transform duration-100\", shown && \"rotate-90\")} />\n <span className=\"truncate\">{title}:</span>\n </button>\n {shown ? (\n <div id={id} className=\"pb-3 pl-6 pr-3\">\n {children}\n </div>\n ) : null}\n </section>\n );\n}\n\nexport interface InfoFact {\n label: string;\n value: React.ReactNode;\n}\n\nexport interface InfoFactsProps extends React.HTMLAttributes<HTMLDListElement> {\n facts: ReadonlyArray<InfoFact>;\n /** A narrow window: each label over its value (Get Info never gets this narrow; a canvas pane does). */\n stacked?: boolean;\n}\n\n/**\n * Get Info's facts: the labels right-aligned in one column (\"Kind:\", \"Where:\"), the values beside\n * them, wrapping, selectable. Each row carries `data-fact=\"<label>\"`.\n *\n * The label column is as wide as its longest label (AppKit's form layout: the labels' column sizes\n * to them), up to half the width; a longer label wraps inside its column (desktop.css, the\n * `info-facts` grid). Never a fixed width: a label wider than a fixed column ran into its value\n * (\"Pages per keyword10\").\n */\nexport function InfoFacts({ facts, stacked = false, className, ...props }: InfoFactsProps) {\n return (\n <dl\n data-slot=\"info-facts\"\n data-stacked={stacked ? \"\" : undefined}\n className={cn(stacked ? \"flex flex-col gap-0.5\" : \"grid gap-x-2 gap-y-0.5\", \"text-body\", className)}\n {...props}\n >\n {facts.map((f) => (\n <div key={f.label} data-fact={f.label} className={stacked ? \"flex min-w-0 flex-col\" : \"contents\"}>\n <dt className={cn(\"text-label\", stacked ? \"text-label-secondary\" : \"min-w-0 break-words text-right\")}>{f.label}:</dt>\n <dd className=\"min-w-0 select-text break-words text-label\">{f.value}</dd>\n </div>\n ))}\n </dl>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Reminders */\n/* ---------------------------------------------------------------------------------------------- */\n\n/** A Reminders list's color (its icon, title and count). */\nexport type ListColor = \"tint\" | \"red\" | \"orange\" | \"yellow\" | \"green\" | \"blue\" | \"purple\" | \"gray\";\n\nconst LIST_COLOR: Record<ListColor, string> = {\n tint: \"text-tint\",\n red: \"text-system-red\",\n orange: \"text-system-orange\",\n yellow: \"text-system-yellow\",\n green: \"text-system-green\",\n blue: \"text-system-blue\",\n purple: \"text-system-purple\",\n gray: \"text-system-gray\",\n};\n\nexport interface ListHeadingProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** The list's name, in the list's color, large and bold. */\n title: React.ReactNode;\n /** The count trailing in the same color and size. */\n count?: number;\n /** The quiet line under the title, above its hairline (\"0 Completed\"). */\n detail?: React.ReactNode;\n /** The list's own color (Reminders gives every list one). Default: the accent. A list whose\n * color is the accent can read as a link beside accent buttons; give it its own. */\n color?: ListColor;\n}\n\n/** Reminders' list heading: the name large and bold in the list's color, its count trailing, a quiet line under it. */\nexport function ListHeading({ title, count, detail, color = \"tint\", className, ...props }: ListHeadingProps) {\n return (\n <header data-slot=\"list-heading\" data-color={color} className={cn(\"flex flex-col gap-1\", className)} {...props}>\n <div className=\"flex items-baseline gap-3\">\n <Text as=\"h1\" variant=\"title-large\" emphasized truncate className={cn(\"min-w-0 flex-1\", LIST_COLOR[color])}>\n {title}\n </Text>\n {count !== undefined ? (\n <Text variant=\"title-large\" tabular data-slot=\"list-heading-count\" className={cn(\"shrink-0\", LIST_COLOR[color])}>\n {count.toLocaleString()}\n </Text>\n ) : null}\n </div>\n {detail ? (\n <div className=\"border-b border-separator pb-2\">\n <Text tone=\"secondary\">{detail}</Text>\n </div>\n ) : null}\n </header>\n );\n}\n\nexport interface ChecklistRowProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n title: React.ReactNode;\n /** The line under the title (a folder, a due time). */\n subtitle?: React.ReactNode;\n /** `open` an empty ring · `running` the activity indicator in the ring (work still going) · `done` filled with a check. */\n state?: \"open\" | \"running\" | \"done\";\n /** Makes the ring a checkbox (Reminders' complete). Absent: the ring only shows the state. */\n onToggle?: () => void;\n /** The ring's name when it is a checkbox (\"Complete\"). */\n toggleLabel?: string;\n /** Trailing on the title line (a time, a flag). */\n trailing?: React.ReactNode;\n /** The ring can't act on this row (nothing to complete or hold): drawn faint, so it never reads as a checkbox. */\n disabled?: boolean;\n}\n\n/**\n * Reminders' row: a 20 pt ring, the title, a secondary line under it, and the hairline under the\n * text only (it starts where the text does).\n */\nexport function ChecklistRow({ title, subtitle, state = \"open\", onToggle, toggleLabel = \"Complete\", trailing, disabled, className, ...props }: ChecklistRowProps) {\n const ring = (\n <span\n aria-hidden={onToggle ? true : undefined}\n data-ring-disabled={disabled || undefined}\n className={cn(\n \"flex size-icon-lg items-center justify-center rounded-full border\",\n // Disabled: a solid gray disc, plainly not a checkbox (a dashed hairline read as missing).\n state === \"done\" ? \"border-tint bg-tint text-tint-label\" : disabled ? \"border-label-quaternary bg-fill-secondary\" : \"border-label-tertiary\",\n \"[&_svg]:size-icon-sm\",\n )}\n >\n {state === \"running\" ? <Spinner size=\"sm\" label=\"Running\" /> : state === \"done\" ? <RadixCheckIcon /> : null}\n </span>\n );\n return (\n <div data-slot=\"checklist-row\" data-state={state} className={cn(\"flex items-start gap-3\", className)} {...props}>\n {onToggle && !disabled ? (\n <button type=\"button\" role=\"checkbox\" aria-checked={state === \"done\"} aria-label={toggleLabel} onClick={onToggle} className=\"focus-ring mt-1.5 shrink-0 rounded-full\">\n {ring}\n </button>\n ) : (\n <span className=\"mt-1.5 shrink-0\">{ring}</span>\n )}\n <div className=\"flex min-w-0 flex-1 items-start gap-2 border-b border-separator py-1.5\">\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <Text truncate>{title}</Text>\n {subtitle ? (\n <Text tone=\"secondary\" truncate>\n {subtitle}\n </Text>\n ) : null}\n </div>\n {trailing ? <div className=\"flex shrink-0 items-center gap-2\">{trailing}</div> : null}\n </div>\n </div>\n );\n}\n\nexport interface ChecklistAddRowProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\"> {\n /** What pressing it makes (\"New session\"). */\n label: string;\n}\n\n/**\n * Reminders' add row at the foot of a list: a ring holding a plus in the list's accent, the label\n * in the accent beside it, lined up with the rows' rings and text. Pressing it starts a new item.\n */\nexport function ChecklistAddRow({ label, className, type = \"button\", ...props }: ChecklistAddRowProps) {\n return (\n <button type={type} data-slot=\"checklist-add-row\" className={cn(\"focus-ring flex w-full items-center gap-3 rounded-control py-1.5 text-left text-tint disabled:opacity-40\", className)} {...props}>\n <span aria-hidden className=\"flex size-icon-lg shrink-0 items-center justify-center rounded-full bg-tint text-tint-label [&_svg]:size-icon-sm\">\n <PlusIcon />\n </span>\n <Text tone=\"tint\">{label}</Text>\n </button>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Empty content (Notes' \"No Notes\", Reminders' \"No Reminders\") */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface EmptyContentProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** The thing's symbol (`SystemSymbol size={48}`), large and quiet over the title, as\n * ContentUnavailableView draws it. Absent: the title alone (\"No Notes\"). */\n icon?: React.ReactNode;\n /** \"No Notes\": large, centered, in the secondary label color (legible in both themes). */\n title: React.ReactNode;\n /** At most one short secondary line, its lines balanced. */\n message?: React.ReactNode;\n /** Buttons under the line, the default one rightmost (Mail's \"2 messages selected\" with what to do with them). */\n actions?: React.ReactNode;\n}\n\n/**\n * The empty list of Notes and Reminders, and ContentUnavailableView: an optional large tertiary\n * symbol, one large secondary line centered in the space, one balanced secondary line under it, and\n * at most a button or two. Never drawn over a table or list: it IS the content when there is none.\n */\nexport function EmptyContent({ icon, title, message, actions, className, ...props }: EmptyContentProps) {\n return (\n <div data-slot=\"empty-content\" className={cn(\"flex h-full min-h-40 flex-col items-center justify-center gap-1 px-6 text-center\", className)} {...props}>\n {icon ? (\n <span data-slot=\"empty-content-symbol\" aria-hidden className=\"mb-2 flex items-center justify-center text-label-tertiary [&_svg]:size-12\">\n {icon}\n </span>\n ) : null}\n <Text variant=\"title-1\" tone=\"secondary\" emphasized={icon ? true : undefined}>\n {title}\n </Text>\n {message ? (\n <Text as=\"p\" tone=\"secondary\" className=\"mt-1 max-w-sm text-balance\">\n {message}\n </Text>\n ) : null}\n {actions ? <div className=\"mt-3 flex items-center gap-2\">{actions}</div> : null}\n </div>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Status bar (Finder, the Clipboard window, FileMerge) */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface StatusBarProps extends React.HTMLAttributes<HTMLDivElement> {\n /** `center`: Finder's \"4 items, 120 GB available\". `start`: FileMerge's status, the Clipboard window's kind. */\n align?: \"start\" | \"center\";\n /** Controls at the trailing edge (FileMerge's Actions). */\n trailing?: React.ReactNode;\n}\n\n/** The window's foot: a hairline, then one quiet line at the content minimum, 13 pt (the window's\n * status, never a message; AppKit draws it at 11 pt, the desktop standard never draws content under 13). */\nexport function StatusBar({ align = \"start\", trailing, className, children, ...props }: StatusBarProps) {\n return (\n <div\n data-slot=\"status-bar\"\n className={cn(\"flex h-control-lg shrink-0 items-center gap-2 border-t border-separator px-3 text-body text-label-secondary\", className)}\n {...props}\n >\n <span className={cn(\"min-w-0 flex-1 truncate\", align === \"center\" && \"text-center\")}>{children}</span>\n {trailing ? <span className=\"flex shrink-0 items-center gap-2\">{trailing}</span> : null}\n </div>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Simulator's device */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface DeviceFrameProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The device's name, its accessible label (\"iPhone\"). */\n label: string;\n /**\n * The status bar's clock (\"9:41\"): with it the screen draws iOS's status bar (the time at the\n * leading edge, signal, Wi-Fi and battery at the trailing edge, either side of the Dynamic Island).\n */\n time?: string;\n /** The Home Screen's dock: the glass shelf at the foot of the screen, empty (no apps installed). */\n dock?: boolean;\n}\n\n/*\n * Device art, not interface color: Simulator draws the phone in its own black titanium in both\n * appearances, with a black screen until the device boots.\n */\nconst DEVICE_BODY = \"#2b2b2d\";\nconst DEVICE_EDGE = \"#4a4a4d\";\nconst DEVICE_SCREEN = \"#000000\";\nconst DEVICE_INK = \"#ffffff\";\nconst DEVICE_GLASS = \"rgba(255,255,255,0.16)\";\n\n/**\n * Simulator's window body: an iPhone at 1:1 (240 × 520 pt) with its bezel, Dynamic Island and side\n * buttons, centered, nothing else. With `time` the screen carries iOS's status bar; with `dock` the\n * Home Screen's empty glass dock and the home indicator. The children draw on the screen (light text\n * on black), between the status bar and the dock.\n */\nexport function DeviceFrame({ label, time, dock = false, className, children, ...props }: DeviceFrameProps) {\n return (\n <div data-slot=\"device-frame\" className={cn(\"flex h-full min-h-0 items-center justify-center overflow-auto p-4\", className)} {...props}>\n <div role=\"img\" aria-label={label} className=\"relative h-130 w-60 shrink-0\">\n <svg viewBox=\"0 0 240 520\" aria-hidden className=\"absolute inset-0 size-full\">\n <rect x=\"-2\" y=\"96\" width=\"4\" height=\"22\" rx=\"2\" fill={DEVICE_EDGE} />\n <rect x=\"-2\" y=\"132\" width=\"4\" height=\"40\" rx=\"2\" fill={DEVICE_EDGE} />\n <rect x=\"-2\" y=\"180\" width=\"4\" height=\"40\" rx=\"2\" fill={DEVICE_EDGE} />\n <rect x=\"238\" y=\"150\" width=\"4\" height=\"62\" rx=\"2\" fill={DEVICE_EDGE} />\n <rect x=\"1\" y=\"1\" width=\"238\" height=\"518\" rx=\"44\" fill={DEVICE_BODY} stroke={DEVICE_EDGE} strokeWidth=\"2\" />\n <rect x=\"9\" y=\"9\" width=\"222\" height=\"502\" rx=\"36\" fill={DEVICE_SCREEN} />\n <rect x=\"86\" y=\"20\" width=\"68\" height=\"20\" rx=\"10\" fill={DEVICE_SCREEN} stroke={DEVICE_BODY} />\n {time !== undefined ? (\n <g data-slot=\"device-status-bar\">\n <text x=\"50\" y=\"35\" textAnchor=\"middle\" fill={DEVICE_INK} fontSize=\"12\" fontWeight=\"600\" fontFamily=\"-apple-system, BlinkMacSystemFont, sans-serif\">\n {time}\n </text>\n {/* Signal: four bars rising. */}\n {[0, 1, 2, 3].map((i) => (\n <rect key={i} x={165 + i * 3.5} y={33 - (i + 1) * 2.2} width=\"2.5\" height={(i + 1) * 2.2} rx=\"0.6\" fill={DEVICE_INK} />\n ))}\n {/* Wi-Fi: three arcs over a dot. */}\n <path d=\"M185 24.5a10 10 0 0 1 13 0M187.3 27.2a6.5 6.5 0 0 1 8.4 0M189.6 29.9a3 3 0 0 1 3.8 0\" stroke={DEVICE_INK} strokeWidth=\"1.5\" fill=\"none\" strokeLinecap=\"round\" />\n <circle cx=\"191.5\" cy=\"32.3\" r=\"1\" fill={DEVICE_INK} />\n {/* Battery: an outline, its charge and the cap. */}\n <rect x=\"203\" y=\"24.5\" width=\"17\" height=\"9\" rx=\"2.4\" stroke={DEVICE_INK} strokeOpacity=\"0.4\" fill=\"none\" />\n <rect x=\"204.6\" y=\"26.1\" width=\"13.8\" height=\"5.8\" rx=\"1.3\" fill={DEVICE_INK} />\n <rect x=\"221\" y=\"27.3\" width=\"1.4\" height=\"3.4\" rx=\"0.6\" fill={DEVICE_INK} fillOpacity=\"0.4\" />\n </g>\n ) : null}\n {dock ? (\n <g data-slot=\"device-dock\">\n <rect x=\"20\" y=\"430\" width=\"200\" height=\"62\" rx=\"22\" fill={DEVICE_GLASS} />\n <rect x=\"86\" y=\"500\" width=\"68\" height=\"3.5\" rx=\"1.75\" fill={DEVICE_INK} />\n </g>\n ) : null}\n </svg>\n <div className={cn(\"dark absolute inset-x-4 flex flex-col items-center justify-center gap-2 text-center text-label\", time !== undefined ? \"top-14\" : \"top-14\", dock ? \"bottom-24\" : \"bottom-12\")}>{children}</div>\n </div>\n </div>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* FileMerge's two panes */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface ComparePane {\n /** The file and where it lives (\"old.py - /Users/…\"), over its pane. */\n title: React.ReactNode;\n /** The pop-up under the title that jumps to a function (FileMerge's \"total\" ⌃⌄). */\n selector?: React.ReactNode;\n content: React.ReactNode;\n}\n\n/** One difference: the lines it spans on each side (0-based, `end` exclusive; an insertion has start === end). */\nexport interface CompareChange {\n left: readonly [start: number, end: number];\n right: readonly [start: number, end: number];\n}\n\nexport interface CompareViewProps extends React.HTMLAttributes<HTMLDivElement> {\n left: ComparePane;\n right: ComparePane;\n /**\n * The differences, drawn in the gutter between the panes as FileMerge draws them: a band from each\n * change on the left to where it lands on the right, numbered, with its arrow. Line positions\n * follow `lineHeight`.\n */\n changes?: ReadonlyArray<CompareChange>;\n /** The selected difference (its band in the selection color). */\n current?: number;\n /** One text line's height in px in both panes (default 16, the code style's). */\n lineHeight?: number;\n /** The merge pane under both (FileMerge's result), with its own pop-up centered over it. */\n merge?: { selector?: React.ReactNode; content: React.ReactNode } | React.ReactNode;\n /** The status line at the foot (\"status: 2 differences\"). */\n status: React.ReactNode;\n /** Trailing in the status bar (FileMerge's Actions pop-up). */\n actions?: React.ReactNode;\n}\n\n/** The languages `SourceText` colors (Xcode's default theme); \"plain\" colors nothing. */\nexport type SourceLanguage = \"python\" | \"typescript\" | \"plain\";\n\nconst KEYWORDS: Record<Exclude<SourceLanguage, \"plain\">, ReadonlySet<string>> = {\n python: new Set(\n \"False None True and as assert async await break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield print\".split(\" \"),\n ),\n typescript: new Set(\n \"abstract as async await break case catch class const continue default delete do else enum export extends false finally for from function if implements import in instanceof interface let new null of private protected public readonly return static super switch this throw true try type typeof undefined var void while with yield\".split(\" \"),\n ),\n};\n\nconst TOKEN = /(\\x22(?:[^\\x22\\\\]|\\\\.)*\\x22?|\\x27(?:[^\\x27\\\\]|\\\\.)*\\x27?|\\x60(?:[^\\x60\\\\]|\\\\.)*\\x60?)|(#.*|\\/\\/.*)|(\\b\\d[\\d_]*(?:\\.\\d+)?(?:e[+-]?\\d+)?\\b)|([A-Za-z_$][\\w$]*)/g;\n\n/**\n * One line of source in Xcode's default colors: keywords, strings, numbers and comments; the rest\n * in the label color. A line-at-a-time scanner (no multi-line strings), enough for a diff or a snippet.\n */\nexport function SourceText({ text, language }: { text: string; language: SourceLanguage }): React.ReactNode {\n if (language === \"plain\" || !text) return text;\n const keywords = KEYWORDS[language];\n const comment = language === \"python\" ? \"#\" : \"//\";\n const out: React.ReactNode[] = [];\n let at = 0;\n for (const m of text.matchAll(TOKEN)) {\n const [whole, str, cmt, num, word] = m;\n const start = m.index ?? 0;\n if (cmt && !cmt.startsWith(comment)) continue;\n if (start > at) out.push(text.slice(at, start));\n const tone = str ? \"text-syntax-string\" : cmt ? \"text-syntax-comment\" : num ? \"text-syntax-number\" : word && keywords.has(word) ? \"text-syntax-keyword\" : null;\n out.push(\n tone ? (\n <span key={start} data-syntax={str ? \"string\" : cmt ? \"comment\" : num ? \"number\" : \"keyword\"} className={tone}>\n {whole}\n </span>\n ) : (\n whole\n ),\n );\n at = start + whole.length;\n if (cmt) break;\n }\n if (at < text.length) out.push(text.slice(at));\n return out;\n}\n\nexport interface CompareLinesProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The file's text, one entry per line. */\n lines: ReadonlyArray<string>;\n /** The file's language, colored as FileMerge colors it (Xcode's theme). Default \"plain\". */\n language?: SourceLanguage;\n /** The lines each difference spans in THIS pane (0-based, `end` exclusive), in the order CompareView numbers them. */\n changes?: ReadonlyArray<readonly [start: number, end: number]>;\n /** The selected difference: its lines in the selection tint between two selection rules. */\n current?: number | undefined;\n}\n\n/**\n * One FileMerge pane's text: monospaced lines 16 pt apart (CompareView's `lineHeight`), each\n * difference's lines on a gray band and the selected one tinted between two rules, as FileMerge\n * marks the change it would act on. An insertion point (start === end) is drawn as the rule alone.\n */\nexport function CompareLines({ lines, changes = [], current, language = \"plain\", className, ...props }: CompareLinesProps) {\n const changeOf = (line: number) => changes.findIndex(([a, b]) => line >= a && line < b);\n return (\n <div data-slot=\"compare-lines\" className={cn(\"min-w-max py-0 font-mono text-code\", className)} {...props}>\n {lines.map((text, i) => {\n const change = changeOf(i);\n const selected = change >= 0 && change === current;\n const first = change >= 0 && changes[change]?.[0] === i;\n const last = change >= 0 && (changes[change]?.[1] ?? 0) - 1 === i;\n const insertion = changes.findIndex(([a, b]) => a === b && a === i);\n return (\n <div\n key={i}\n data-line={i + 1}\n data-change={change >= 0 ? change + 1 : undefined}\n data-current={selected ? \"\" : undefined}\n className={cn(\n \"h-4 whitespace-pre px-1 text-label\",\n change >= 0 && (selected ? \"bg-compare-current\" : \"bg-fill\"),\n selected && first && \"border-t border-compare-current-edge\",\n selected && last && \"border-b border-compare-current-edge\",\n insertion >= 0 && insertion === current && \"border-t border-compare-current-edge\",\n )}\n >\n {text ? <SourceText text={text} language={language} /> : \" \"}\n </div>\n );\n })}\n </div>\n );\n}\n\nconst GUTTER = 60;\n\nfunction isMergePane(merge: CompareViewProps[\"merge\"]): merge is { selector?: React.ReactNode; content: React.ReactNode } {\n return typeof merge === \"object\" && merge !== null && !React.isValidElement(merge) && \"content\" in merge;\n}\n\n/** The gutter's bands: each change's left lines joined to its right lines by a curved band, numbered with an arrow. */\nfunction CompareGutter({ changes, current, lineHeight }: { changes: ReadonlyArray<CompareChange>; current: number | undefined; lineHeight: number }) {\n const height = Math.max(1, ...changes.map((c) => Math.max(c.left[1], c.right[1]) + 1)) * lineHeight;\n const mid = GUTTER / 2;\n return (\n <svg data-slot=\"compare-gutter-bands\" aria-hidden width={GUTTER} height={height} className=\"block overflow-visible\">\n {changes.map((c, i) => {\n const [l0, l1] = [c.left[0] * lineHeight, Math.max(c.left[1], c.left[0]) * lineHeight];\n const [r0, r1] = [c.right[0] * lineHeight, Math.max(c.right[1], c.right[0]) * lineHeight];\n const y = (r0 + r1) / 2 || r0;\n const selected = i === current;\n return (\n <g key={i} data-change={i + 1} data-current={selected ? \"\" : undefined}>\n <path\n d={`M0 ${l0} C${mid} ${l0} ${mid} ${r0} ${GUTTER} ${r0} L${GUTTER} ${r1} C${mid} ${r1} ${mid} ${l1} 0 ${l1} Z`}\n className={selected ? \"fill-compare-current stroke-compare-current-edge\" : \"fill-fill-tertiary stroke-separator\"}\n strokeWidth=\"1\"\n />\n <path d={`M14 ${y + 6} H${GUTTER - 16} M${GUTTER - 21} ${y + 2} L${GUTTER - 15} ${y + 6} L${GUTTER - 21} ${y + 10}`} className=\"stroke-label-secondary\" strokeWidth=\"1.5\" fill=\"none\" />\n <text x={mid - 2} y={y + 2} textAnchor=\"middle\" className=\"fill-label\" fontSize=\"9\" fontFamily=\"inherit\">\n {i + 1}\n </text>\n </g>\n );\n })}\n </svg>\n );\n}\n\n/**\n * FileMerge's window body: the two files side by side, each with its name and place over a pop-up\n * and a bordered text pane, the gutter between them where the differences are joined by numbered\n * bands, the merge pane under both behind a divider dot with its own pop-up, and the status bar\n * (\"status: 2 differences\") with the Actions pop-up trailing.\n */\nexport function CompareView({ left, right, changes = [], current, lineHeight = 16, merge, status, actions, className, ...props }: CompareViewProps) {\n const head = (side: \"left\" | \"right\", p: ComparePane) => (\n <div data-compare-head={side} className=\"flex min-w-0 flex-1 flex-col\">\n <Text truncate data-slot=\"compare-pane-title\" className=\"px-1 py-0.5\">\n {p.title}\n </Text>\n {p.selector ? <div className=\"flex px-0.5 pb-1 [&>*]:w-full\">{p.selector}</div> : null}\n </div>\n );\n const body = (side: \"left\" | \"right\", p: ComparePane) => (\n <div data-compare-pane={side} className=\"min-h-0 min-w-0 flex-1 overflow-auto border border-separator bg-content font-mono text-code\">\n {p.content}\n </div>\n );\n const mergePane = isMergePane(merge) ? merge : merge !== undefined ? { content: merge } : null;\n return (\n <div data-slot=\"compare-view\" className={cn(\"flex h-full min-h-0 flex-col bg-window\", className)} {...props}>\n {/* Each file's path line and pop-up over its pane; the gutter starts where the text does. */}\n <div className=\"flex shrink-0 px-1 pt-1\">\n {head(\"left\", left)}\n <div aria-hidden className=\"w-15 shrink-0\" />\n {head(\"right\", right)}\n </div>\n <div className=\"flex min-h-0 flex-1 px-1\">\n {body(\"left\", left)}\n <div data-compare-gutter aria-hidden className=\"w-15 min-h-0 shrink-0 overflow-hidden border-y border-separator bg-content\">\n {changes.length > 0 ? <CompareGutter changes={changes} current={current} lineHeight={lineHeight} /> : null}\n </div>\n {body(\"right\", right)}\n </div>\n {mergePane ? (\n <div data-compare-merge className=\"flex h-2/5 shrink-0 flex-col px-1\">\n <div aria-hidden className=\"flex h-3 shrink-0 items-center justify-center\">\n <span className=\"size-1 rounded-full bg-label-tertiary\" />\n </div>\n {mergePane.selector ? <div className=\"flex justify-center pb-1 [&>*]:w-1/2\">{mergePane.selector}</div> : null}\n <div className=\"min-h-0 flex-1 overflow-auto border border-separator bg-content font-mono text-code\">{mergePane.content}</div>\n </div>\n ) : null}\n <StatusBar trailing={actions} className=\"mt-1 border-t-0 text-body\">\n {status}\n </StatusBar>\n </div>\n );\n}\n","import * as React from \"react\";\n\nimport { ChevronRightIcon } from \"../icons\";\nimport { cn } from \"./cn\";\nimport { MiddleTruncate, Text } from \"./text\";\n\n/**\n * The monitor apps' parts (Activity Monitor, Console, System Information, Finder): the summary strip\n * under a process table, a label/value fact list, a path bar, and a scope bar. Pages place them with\n * `Page footer`, `Page scopeBar` and `Page sidebar`.\n */\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Summary strip (Activity Monitor's footer) */\n/* ---------------------------------------------------------------------------------------------- */\n\n/**\n * Activity Monitor's summary under its table: one rounded box centered in the footer, its panes side\n * by side with hairlines between them (facts, a graph, more facts).\n */\nexport function SummaryStrip({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div data-slot=\"summary-strip-frame\" className=\"flex justify-center px-5 py-3\">\n <div\n role=\"group\"\n data-slot=\"summary-strip\"\n className={cn(\"flex w-full max-w-3xl divide-x divide-separator overflow-hidden rounded-control border border-separator bg-content\", className)}\n {...props}\n />\n </div>\n );\n}\n\nexport interface SummaryPaneProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** A graph's caption, drawn in small capitals at the pane's top (\"CPU LOAD\"). */\n title?: string;\n}\n\n/**\n * One pane of the strip: `SummaryFact` rows, or a titled graph. A facts pane is as wide as its\n * longest label and value (never cut: Activity Monitor's \"Compressed:\" reads whole); the graph panes\n * share what is left.\n */\nexport function SummaryPane({ title, className, children, ...props }: SummaryPaneProps) {\n return (\n <div\n data-slot=\"summary-pane\"\n data-kind={title ? \"graph\" : \"facts\"}\n className={cn(\"flex flex-col px-3 py-2\", title ? \"min-w-0 flex-1\" : \"min-w-44 shrink-0 grow-0\", className)}\n {...props}\n >\n {title ? (\n <div data-slot=\"summary-pane-title\" className=\"truncate pb-1 text-center text-caption-2 uppercase text-label-secondary\">\n {title}\n </div>\n ) : null}\n {children}\n </div>\n );\n}\n\nconst FACT_TONE = {\n red: \"text-system-red\",\n blue: \"text-system-blue\",\n green: \"text-system-green\",\n orange: \"text-system-orange\",\n purple: \"text-system-purple\",\n} as const;\n\nexport interface SummaryFactProps extends React.HTMLAttributes<HTMLDivElement> {\n label: React.ReactNode;\n value: React.ReactNode;\n /** Activity Monitor colors a value by its graph series (System red, User blue). */\n tone?: keyof typeof FACT_TONE;\n}\n\n/** A label and its right-aligned value, with a hairline under it (Activity Monitor's \"System: 14.17%\").\n * The label is never cut: its pane is as wide as its longest fact. */\nexport function SummaryFact({ label, value, tone, className, ...props }: SummaryFactProps) {\n return (\n <div data-slot=\"summary-fact\" className={cn(\"flex h-control items-center gap-3 border-b border-separator text-body last:border-b-0\", className)} {...props}>\n <span data-slot=\"summary-fact-label\" className=\"flex-1 whitespace-nowrap text-label\">\n {label}\n </span>\n <span className={cn(\"shrink-0 tabular-nums\", tone ? FACT_TONE[tone] : \"text-label\")}>{value}</span>\n </div>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Fact list (System Information's detail) */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface Fact {\n label: string;\n value: React.ReactNode;\n}\n\nexport interface FactListProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** The bold heading over the facts (\"Hardware Overview:\"). */\n title?: React.ReactNode;\n facts: ReadonlyArray<Fact>;\n}\n\n/**\n * System Information's facts: a bold heading, then label and value in two columns, the labels as\n * wide as the longest one, plain text, selectable. Each row carries `data-fact=\"<label>\"`.\n */\nexport function FactList({ title, facts, className, ...props }: FactListProps) {\n return (\n <section data-slot=\"fact-list\" className={cn(\"flex flex-col gap-2\", className)} {...props}>\n {title ? (\n <Text as=\"h2\" variant=\"headline\">\n {title}\n </Text>\n ) : null}\n <dl data-slot=\"fact-grid\" className=\"grid gap-x-3 gap-y-0.5 pl-1.5 text-body\">\n {facts.map((f) => (\n <div key={f.label} data-fact={f.label} className=\"col-span-full grid grid-cols-subgrid\">\n <dt className=\"whitespace-nowrap text-label\">{f.label}:</dt>\n {/* One line, as System Information: a long text value (a host name, a path) is cut in\n the middle, whole in its tooltip, never wrapped mid-token. */}\n <dd className=\"min-w-0 select-text text-label\">{typeof f.value === \"string\" ? <MiddleTruncate text={f.value} /> : f.value}</dd>\n </div>\n ))}\n </dl>\n </section>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Path bar (Finder, System Information) */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface PathBarItem {\n label: string;\n icon?: React.ReactNode;\n}\n\n/**\n * Finder's path bar: where the shown thing lives, each step separated by a chevron, at the window's\n * foot. When the bar is too narrow, Finder's way: the steps nearest the top shrink to their icon\n * alone (the name is the tooltip), the last step always keeps its name; only when even that is too\n * wide do the top steps give way to one \"…\" (its tooltip is the whole path). Never an ellipsis on\n * every step; the last step is cut only when it alone does not fit.\n */\nexport function PathBar({ items, className, ...props }: { items: ReadonlyArray<PathBarItem> } & React.HTMLAttributes<HTMLElement>) {\n const ref = React.useRef<HTMLElement>(null);\n // How many leading steps show their icon only, then how many are gone behind \"…\".\n const [squeeze, setSqueeze] = React.useState({ compact: 0, hidden: 0 });\n const signature = items.map((i) => i.label).join(\"\\u0000\");\n const [measured, setMeasured] = React.useState(signature);\n // New steps: measure again from the whole path.\n if (measured !== signature) {\n setMeasured(signature);\n setSqueeze({ compact: 0, hidden: 0 });\n }\n // Only steps with an icon can shrink to it; the last step never does.\n const compactable = items.slice(0, -1).filter((i) => i.icon).length;\n React.useLayoutEffect(() => {\n const el = ref.current;\n if (!el || el.scrollWidth <= el.clientWidth + 1) return;\n if (squeeze.compact < compactable) setSqueeze((s) => ({ ...s, compact: s.compact + 1 }));\n else if (squeeze.hidden < items.length - 1) setSqueeze((s) => ({ ...s, hidden: s.hidden + 1 }));\n }, [squeeze, signature, items.length, compactable]);\n React.useEffect(() => {\n const el = ref.current;\n if (!el || typeof ResizeObserver === \"undefined\") return;\n let width = el.clientWidth;\n let timer: ReturnType<typeof setTimeout> | undefined;\n // Measured again after the observer's turn, never inside it (a layout change inside a\n // ResizeObserver callback is the \"ResizeObserver loop\" error).\n const observer = new ResizeObserver(() => {\n clearTimeout(timer);\n timer = setTimeout(() => {\n if (el.clientWidth === width) return;\n width = el.clientWidth;\n setSqueeze({ compact: 0, hidden: 0 });\n }, 0);\n });\n observer.observe(el);\n return () => {\n clearTimeout(timer);\n observer.disconnect();\n };\n }, []);\n const { hidden } = squeeze;\n // The first `compact` steps that have an icon draw it alone.\n const iconOnly = new Set<number>();\n for (let i = 0, n = 0; i < items.length - 1 && n < squeeze.compact; i += 1) {\n if (items[i]?.icon) {\n iconOnly.add(i);\n n += 1;\n }\n }\n const shown = items.slice(hidden);\n const lastOnly = hidden >= items.length - 1;\n return (\n <nav\n ref={ref}\n aria-label=\"Path\"\n data-slot=\"path-bar\"\n data-hidden-steps={hidden || undefined}\n data-compact-steps={squeeze.compact || undefined}\n className={cn(\"flex h-control shrink-0 items-center gap-1 overflow-hidden px-3 text-body text-label-secondary\", className)}\n {...props}\n >\n {hidden > 0 ? (\n <span data-slot=\"path-bar-more\" title={items.map((i) => i.label).join(\" › \")} className=\"shrink-0\">\n …\n </span>\n ) : null}\n {shown.map((item, i) => {\n const index = hidden + i;\n const last = i === shown.length - 1;\n const compact = iconOnly.has(index);\n return (\n <React.Fragment key={`${index}-${item.label}`}>\n {i > 0 || hidden > 0 ? <ChevronRightIcon aria-hidden className=\"size-icon-sm shrink-0 text-label-tertiary\" /> : null}\n <span\n data-slot=\"path-bar-step\"\n data-compact={compact || undefined}\n title={compact ? item.label : undefined}\n className={cn(\"flex items-center gap-1 whitespace-nowrap\", last ? \"text-label\" : null, last && lastOnly ? \"min-w-0\" : \"shrink-0\")}\n >\n {item.icon ? <span className=\"flex size-icon shrink-0 items-center justify-center\">{item.icon}</span> : null}\n {compact ? <span className=\"sr-only\">{item.label}</span> : <span className={last && lastOnly ? \"truncate\" : undefined}>{item.label}</span>}\n </span>\n </React.Fragment>\n );\n })}\n </nav>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* Scope bar (Console's All Messages · Errors and Faults) */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface Scope<V extends string> {\n value: V;\n label: string;\n /** A count after the label (tertiary). */\n count?: number;\n}\n\nexport interface ScopeBarProps<V extends string> extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n value: V;\n onValueChange: (value: V) => void;\n scopes: ReadonlyArray<Scope<V>>;\n \"aria-label\": string;\n /** In a narrow column, lay the scopes out on as many lines as they need (Notes' lanes in its\n * 280 pt list) instead of scrolling sideways: every scope stays in view and reachable. */\n wrap?: boolean;\n}\n\n/**\n * The scope bar under a toolbar (Console, Finder's search scopes): recessed buttons, the chosen one\n * filled. It narrows what the table below shows; it never switches to another page (that is the\n * toolbar's Segmented). In a narrow column the bar scrolls sideways (no scrollbar) and keeps the chosen scope in view; a label is never cut.\n * With `wrap`, the scopes go onto a second line instead, so none is ever out of view.\n */\nexport function ScopeBar<V extends string>({ value, onValueChange, scopes, wrap = false, className, ...props }: ScopeBarProps<V>) {\n return (\n <div role=\"radiogroup\" data-slot=\"scope-bar\" data-wrap={wrap || undefined} className={cn(\"flex min-w-0 items-center gap-1\", wrap ? \"flex-wrap\" : \"overflow-x-auto\", className)} {...props}>\n {scopes.map((s) => {\n const on = s.value === value;\n return (\n <button\n key={s.value}\n type=\"button\"\n role=\"radio\"\n aria-checked={on}\n data-scope={s.value}\n data-state={on ? \"on\" : \"off\"}\n ref={on ? (el) => el?.scrollIntoView?.({ block: \"nearest\", inline: \"nearest\" }) : undefined}\n onClick={() => onValueChange(s.value)}\n className={cn(\n \"focus-ring flex h-control shrink-0 items-center gap-1.5 whitespace-nowrap rounded-control px-2.5 text-body transition-colors duration-100\",\n on ? \"bg-fill-secondary text-label\" : \"text-label-secondary hover:bg-fill hover:text-label\",\n )}\n >\n {s.label}\n {/* Room for three digits, so a count turning 9 to 10 (or 99 to 100) never moves the scopes after it. */}\n {s.count !== undefined ? (\n <span data-slot=\"scope-count\" className=\"inline-flex min-w-count tabular-nums text-label-tertiary\">\n {s.count.toLocaleString()}\n </span>\n ) : null}\n </button>\n );\n })}\n </div>\n );\n}\n","import * as React from \"react\";\n\nimport { Button } from \"./button\";\nimport { cn } from \"./cn\";\n\n/** One line of a log. `group` ties lines of one message together (hover shows the whole message). */\nexport interface LogLine {\n /** Stable and unique (a running line number works). */\n key: number;\n text: string;\n /** Shown in the gutter; unselectable, so a copy carries only the text. */\n number?: number;\n tone?: \"error\" | \"warning\" | null;\n group?: number;\n /** Console's Time column (the `console` look): the line's own time, already formatted. */\n time?: string;\n /** Console's Process column (the `console` look): who wrote the line. */\n source?: string;\n}\n\n/** The `console` look's column titles (Console.app: Type, Time, Process, Message). */\nexport interface LogColumns {\n type?: string;\n time?: string;\n source?: string;\n message?: string;\n}\n\nexport interface LogViewProps {\n lines: readonly LogLine[];\n /** Keep the newest line in view. The view turns it off when the person scrolls up, and on at the bottom. */\n follow: boolean;\n onFollowChange: (follow: boolean) => void;\n /** Shown instead of the lines when there are none. */\n empty?: React.ReactNode;\n /** A small action on the hovered line (e.g. Hide). */\n lineAction?: { label: string; onSelect: (line: LogLine) => void };\n /** The button that returns to the newest line while not following. */\n jumpLabel?: string;\n /** `plain` (default): monospace lines in a recessed box, long lines scroll sideways (a terminal's\n * output). `console`: Console.app's message list, flush and full width — a Type dot, Time,\n * Process and Message columns under a table header, 24 pt striped rows of body text, each message\n * on one line ending in an ellipsis (its whole text is the tooltip). */\n look?: \"plain\" | \"console\";\n /** The `console` look's column titles. */\n columns?: LogColumns;\n /** The `console` look's columns the person turned off (Console's View › Time, Process). The\n * Message column takes their width. */\n hide?: ReadonlyArray<\"time\" | \"source\">;\n \"aria-label\": string;\n className?: string;\n}\n\n/** The fixed line height (px): virtualising needs every row the same height (Console.app does the same). */\nexport const LOG_LINE_PX = 18;\n/** The `console` look's row height: a table row (24 pt), as Console's message list. */\nexport const CONSOLE_LINE_PX = 24;\nconst OVERSCAN = 30;\n\n/**\n * A live log, virtualised: only the lines in view are in the DOM, so 100,000+ lines scroll and\n * follow smoothly. Monospace, one line per row (long lines scroll sideways), selectable text,\n * error and warning tones, the hovered message highlighted as a whole, an optional per-line action,\n * and a \"jump to the newest line\" button while the person has scrolled up.\n */\nexport function LogView({ lines, follow, onFollowChange, empty, lineAction, jumpLabel = \"Jump to bottom\", look = \"plain\", columns, hide, className, ...props }: LogViewProps) {\n const showTime = !hide?.includes(\"time\");\n const showSource = !hide?.includes(\"source\");\n const consoleLook = look === \"console\";\n const LINE = consoleLook ? CONSOLE_LINE_PX : LOG_LINE_PX;\n const ref = React.useRef<HTMLDivElement>(null);\n const [view, setView] = React.useState({ top: 0, height: 600 });\n const [hoverGroup, setHoverGroup] = React.useState<number | null>(null);\n const followRef = React.useRef(follow);\n followRef.current = follow;\n\n React.useLayoutEffect(() => {\n const el = ref.current;\n if (!el) return;\n const measure = () => setView({ top: el.scrollTop, height: el.clientHeight || 600 });\n measure();\n if (typeof ResizeObserver === \"undefined\") return;\n const ro = new ResizeObserver(measure);\n ro.observe(el);\n return () => ro.disconnect();\n }, []);\n\n // The console look clips rows cleanly under its header (Console's message table): the list is\n // padded below its last line (less than a row) so that, scrolled to the end, the top row starts\n // exactly under the header and is never cut in half there.\n const padFor = (height: number) => (consoleLook && lines.length * LINE > height ? height % LINE : 0);\n\n React.useLayoutEffect(() => {\n const el = ref.current;\n if (!el || !follow) return;\n const bottom = Math.max(0, lines.length * LINE + padFor(el.clientHeight) - el.clientHeight);\n // Following scrolls to the bottom, which reads as \"at the bottom\" in onScroll: no flag needed\n // (a flag set here stuck when the browser fired no scroll event, and ate the person's next scroll).\n if (Math.abs(el.scrollTop - bottom) > 1) el.scrollTop = bottom;\n setView({ top: el.scrollTop, height: el.clientHeight || 600 });\n }, [follow, lines, LINE]);\n\n const total = lines.length * LINE + padFor(view.height);\n const first = Math.max(0, Math.floor(view.top / LINE) - OVERSCAN);\n const last = Math.min(lines.length, Math.ceil((view.top + view.height) / LINE) + OVERSCAN);\n const shown = lines.slice(first, last);\n const titles = { type: \"Type\", time: \"Time\", source: \"Process\", message: \"Message\", ...columns };\n\n return (\n <div data-slot=\"log-view\" data-look={look} className={cn(\"relative flex min-h-0 flex-1 flex-col\", consoleLook ? \"bg-content\" : \"rounded-control bg-fill\", className)}>\n {consoleLook ? (\n // Console's message list header (an NSTableView header): the columns' titles, a hairline under.\n <div data-slot=\"log-view-header\" aria-hidden className=\"flex h-table-header shrink-0 items-center border-b border-separator text-table-header text-label-secondary\">\n <span className=\"w-12 shrink-0 px-3\">{titles.type}</span>\n {showTime ? <span data-slot=\"log-view-column\" className=\"w-28 shrink-0 px-3\">{titles.time}</span> : null}\n {showSource ? <span data-slot=\"log-view-column\" className=\"w-28 shrink-0 px-3\">{titles.source}</span> : null}\n <span data-slot=\"log-view-column\" className=\"min-w-0 flex-1 px-3\">{titles.message}</span>\n </div>\n ) : null}\n <div\n ref={ref}\n role=\"log\"\n aria-live=\"off\"\n tabIndex={0}\n {...props}\n className={cn(\"focus-ring min-h-0 flex-1\", consoleLook ? \"overflow-y-auto overflow-x-hidden\" : \"overflow-auto rounded-control\")}\n onScroll={(event) => {\n const el = event.currentTarget;\n setView({ top: el.scrollTop, height: el.clientHeight || 600 });\n const atBottom = el.scrollHeight - el.scrollTop - el.clientHeight < LINE;\n if (atBottom !== followRef.current) onFollowChange(atBottom);\n }}\n onMouseLeave={() => setHoverGroup(null)}\n >\n {lines.length === 0 ? (\n <div className={consoleLook ? \"flex h-full items-center justify-center px-3 py-2 text-center\" : \"px-3 py-2\"}>{empty}</div>\n ) : consoleLook ? (\n <div className=\"relative w-full\" style={{ height: total }}>\n <div style={{ transform: `translateY(${first * LINE}px)` }}>\n {shown.map((line, i) => {\n const lit = line.group !== undefined && line.group === hoverGroup;\n const striped = (first + i) % 2 === 1;\n return (\n <div\n key={line.key}\n data-line={line.number ?? line.key}\n data-group={line.group}\n data-tone={line.tone ?? undefined}\n onMouseEnter={() => setHoverGroup(line.group ?? null)}\n className={cn(\"group/line flex select-text items-center text-body text-label\", lit ? \"bg-fill-secondary\" : striped ? \"bg-fill\" : null)}\n style={{ height: LINE }}\n >\n {/* Console's Type: a dot for an error (red) or a warning (orange), nothing for the rest. */}\n <span className=\"flex w-12 shrink-0 select-none items-center px-3\">\n {line.tone ? (\n <span\n role=\"img\"\n aria-label={line.tone === \"error\" ? \"Error\" : \"Warning\"}\n data-slot=\"log-view-type\"\n className={cn(\"size-2 rounded-full\", line.tone === \"error\" ? \"bg-system-red\" : \"bg-system-orange\")}\n />\n ) : null}\n </span>\n {showTime ? (\n <span data-slot=\"log-view-time\" className=\"w-28 shrink-0 truncate px-3 tabular-nums\">\n {line.time ?? \"\"}\n </span>\n ) : null}\n {showSource ? (\n <span data-slot=\"log-view-source\" className=\"w-28 shrink-0 truncate px-3\">\n {line.source ?? \"\"}\n </span>\n ) : null}\n <span data-slot=\"log-view-message\" title={line.text} className=\"min-w-0 flex-1 truncate px-3\">\n {line.text}\n </span>\n {lineAction ? (\n <Button size=\"sm\" variant=\"plain\" className=\"invisible mr-2 shrink-0 group-hover/line:visible\" onClick={() => lineAction.onSelect(line)}>\n {lineAction.label}\n </Button>\n ) : null}\n </div>\n );\n })}\n </div>\n </div>\n ) : (\n <div className=\"relative w-max min-w-full py-1\" style={{ height: total + 8 }}>\n <div style={{ transform: `translateY(${first * LINE}px)` }}>\n {shown.map((line) => {\n const lit = line.group !== undefined && line.group === hoverGroup;\n return (\n <div\n key={line.key}\n data-line={line.number ?? line.key}\n data-group={line.group}\n data-tone={line.tone ?? undefined}\n onMouseEnter={() => setHoverGroup(line.group ?? null)}\n className={cn(\n \"group/line flex select-text items-center gap-3 whitespace-pre px-3 font-mono text-code\",\n lit ? \"bg-fill-secondary\" : null,\n line.tone === \"error\" ? \"text-system-red\" : line.tone === \"warning\" ? \"text-system-orange\" : \"text-label\",\n )}\n style={{ height: LINE }}\n >\n {line.number !== undefined ? <span className=\"w-12 shrink-0 select-none text-right text-label-tertiary\">{line.number}</span> : null}\n <span className=\"min-w-0\">{line.text}</span>\n {lineAction ? (\n <Button\n size=\"sm\"\n variant=\"plain\"\n className=\"invisible sticky right-2 ml-auto shrink-0 group-hover/line:visible\"\n onClick={() => lineAction.onSelect(line)}\n >\n {lineAction.label}\n </Button>\n ) : null}\n </div>\n );\n })}\n </div>\n </div>\n )}\n </div>\n {!follow && lines.length > 0 ? (\n <Button\n size=\"sm\"\n variant=\"primary\"\n className=\"absolute bottom-3 right-4 shadow-raised\"\n onClick={() => {\n onFollowChange(true);\n }}\n >\n {jumpLabel}\n </Button>\n ) : null}\n </div>\n );\n}\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\n/*\n * Finder's icon view: the folder's items as large icons with their names under them, in rows that\n * fill the window. A click selects an item (its icon on a soft gray square, its name on the\n * accent capsule while the window is key), a double-click or ⌘↓ opens it; the arrow keys move the\n * selection across the grid in reading order (Up/Down by a whole row).\n */\n\nexport interface IconViewProps extends React.HTMLAttributes<HTMLDivElement> {\n \"aria-label\": string;\n}\n\n/** The grid: as many 96 pt cells as fit, the items in reading order. */\nexport function IconView({ className, onKeyDown, ...props }: IconViewProps) {\n return (\n <div\n role=\"listbox\"\n data-slot=\"icon-view\"\n className={cn(\"grid content-start justify-start gap-x-2 gap-y-3 p-4\", className)}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n const keys = [\"ArrowRight\", \"ArrowLeft\", \"ArrowDown\", \"ArrowUp\", \"Home\", \"End\"];\n if (!keys.includes(event.key)) return;\n const items = Array.from(event.currentTarget.querySelectorAll<HTMLElement>('[data-slot=\"icon-view-item\"]'));\n const at = items.indexOf(document.activeElement as HTMLElement);\n if (at === -1 || items.length === 0) return;\n const top = items[at]?.offsetTop ?? 0;\n const perRow = Math.max(1, items.filter((t) => t.offsetTop === top).length);\n const step: Record<string, number> = { ArrowRight: 1, ArrowLeft: -1, ArrowDown: perRow, ArrowUp: -perRow };\n const next = event.key === \"Home\" ? 0 : event.key === \"End\" ? items.length - 1 : at + (step[event.key] ?? 0);\n const target = items[Math.max(0, Math.min(items.length - 1, next))];\n if (target) {\n event.preventDefault();\n target.focus();\n target.click();\n }\n }}\n {...props}\n />\n );\n}\n\nexport interface IconViewItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** The item's icon at 64 pt (`SystemSymbol size={56}`, an app icon image). */\n icon: React.ReactNode;\n /** Its name, under the icon on at most two centered lines. */\n title: string;\n selected?: boolean;\n onSelect?: () => void;\n /** Double-click or ⌘↓ (Finder's Open). */\n onOpen?: () => void;\n /** Renaming in place: a `RenameField` drawn where the name sits. */\n nameEditor?: React.ReactNode;\n}\n\n/** One item of the icon view: the large icon, the name under it; selected, the icon sits on gray and the name on the accent. */\nexport function IconViewItem({ icon, title, selected = false, onSelect, onOpen, nameEditor, className, onKeyDown, ...props }: IconViewItemProps) {\n return (\n <div\n role=\"option\"\n aria-selected={selected}\n tabIndex={selected ? 0 : -1}\n data-slot=\"icon-view-item\"\n data-selected={selected || undefined}\n title={title}\n className={cn(\"focus-ring group/item flex w-24 flex-col items-center gap-1 rounded-control outline-none\", className)}\n onClick={onSelect}\n onDoubleClick={onOpen}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n if ((event.key === \"ArrowDown\" && event.metaKey) || event.key === \"Enter\") {\n event.preventDefault();\n onOpen?.();\n }\n }}\n {...props}\n >\n <span data-slot=\"icon-view-icon\" aria-hidden className={cn(\"flex size-18 items-center justify-center rounded-control [&_img]:size-16 [&_svg]:size-14\", selected && \"bg-selection-muted\")}>\n {icon}\n </span>\n {nameEditor ? (\n <span data-slot=\"icon-view-name-editor\" className=\"flex max-w-full justify-center\">\n {nameEditor}\n </span>\n ) : (\n <span data-slot=\"icon-view-name\" className={cn(\"line-clamp-2 max-w-full break-words rounded-control px-1 text-center text-body text-label\", selected && \"bg-selection-muted\")}>\n {title}\n </span>\n )}\n </div>\n );\n}\n","import * as React from \"react\";\n\nimport { ChevronRightIcon } from \"../icons\";\nimport { cn } from \"./cn\";\nimport { Spinner } from \"./spinner\";\n\n/*\n * Finder's column view (NSBrowser): one column per level of the path, each a list of 20 pt rows\n * (icon, name, and a chevron when the item holds more), side by side under hairlines and scrolled\n * sideways so the newest column is always in view. Clicking a row selects it and the host opens the\n * next column (its contents) or, for a leaf, the preview column (`preview`). The path's earlier\n * selections stay marked on gray; the column with focus marks its selection in the accent while the\n * window is key. Up/Down move within a column, Right enters the next column (its first row), Left\n * returns to the one before, ⌘↓ / Return / double-click open.\n *\n * Controlled: the host owns the path (which item is selected in each column) and what each column\n * holds; the component draws it and reports intent.\n */\n\nexport interface ColumnBrowserColumn<T> {\n /** Stable key of this column (the folder it lists). */\n key: string;\n /** Its items; `null` while they are being read. */\n items: readonly T[] | null;\n /** The item selected in this column (the next column's parent), if any. */\n selectedKey?: string | null | undefined;\n /** Shown when `items` is empty (Finder leaves an empty folder's column blank; a short line here). */\n empty?: React.ReactNode | undefined;\n /** Shown instead of the items when the column could not be read. */\n failed?: React.ReactNode | undefined;\n}\n\nexport interface ColumnBrowserProps<T> {\n \"aria-label\": string;\n columns: ReadonlyArray<ColumnBrowserColumn<T>>;\n itemKey: (item: T) => string;\n itemLabel: (item: T) => string;\n /** The small icon before the name (a `SystemSymbol size={15}`). */\n itemIcon?: ((item: T) => React.ReactNode) | undefined;\n /** True for an item that opens a further column (a folder): it wears the chevron. */\n isBranch: (item: T) => boolean;\n /** A row was chosen in `column` (click, arrow keys). The host truncates the path after it. */\n onSelect: (column: number, item: T) => void;\n /** Double-click, Return or ⌘↓ on a row. */\n onOpen?: ((item: T) => void) | undefined;\n /** Right-click on a row: the row is selected first, then this opens its menu at the pointer. */\n onItemContextMenu?: ((item: T, event: React.MouseEvent) => void) | undefined;\n /** Renaming in place: a `RenameField` for the row being renamed (null for every other row). */\n itemEditor?: ((item: T) => React.ReactNode | null) | undefined;\n /** Per-row `data-*` attributes (test hooks). */\n itemData?: ((item: T) => Record<string, string>) | undefined;\n /** The preview column after the last list (a leaf's icon, name and facts). */\n preview?: React.ReactNode | undefined;\n className?: string | undefined;\n /** `data-*` attributes on the browser itself (test hooks), as every desktop component takes. */\n [data: `data-${string}`]: string | boolean | undefined;\n}\n\nconst ROW = '[data-slot=\"column-browser-row\"]';\n\nfunction rowsOf(column: HTMLElement | null): HTMLElement[] {\n return column ? Array.from(column.querySelectorAll<HTMLElement>(ROW)) : [];\n}\n\n/** The Finder column view: the path as side-by-side lists, a preview column after a leaf. */\nexport function ColumnBrowser<T>({\n \"aria-label\": label,\n columns,\n itemKey,\n itemLabel,\n itemIcon,\n isBranch,\n onSelect,\n onOpen,\n onItemContextMenu,\n itemData,\n itemEditor,\n preview,\n className,\n ...data\n}: ColumnBrowserProps<T>): React.JSX.Element {\n const scroller = React.useRef<HTMLDivElement>(null);\n const refs = React.useRef<Array<HTMLDivElement | null>>([]);\n // Keyboard intent waiting for the next column to arrive: focus its first row once it renders.\n const enterNext = React.useRef<number | null>(null);\n\n // The newest column (or the preview) always scrolls into view, as Finder's does.\n React.useEffect(() => {\n const el = scroller.current;\n if (el) el.scrollLeft = el.scrollWidth;\n }, [columns.length, preview !== undefined && preview !== null]);\n\n React.useEffect(() => {\n const at = enterNext.current;\n if (at === null) return;\n const column = columns[at];\n if (!column?.items) return;\n enterNext.current = null;\n const first = column.items[0];\n if (first) {\n onSelect(at, first);\n requestAnimationFrame(() => rowsOf(refs.current[at] ?? null)[0]?.focus());\n }\n });\n\n const onKeyDown = (index: number, event: React.KeyboardEvent<HTMLDivElement>): void => {\n const column = columns[index];\n const items = column?.items ?? [];\n const rows = rowsOf(refs.current[index] ?? null);\n const at = rows.indexOf(document.activeElement as HTMLElement);\n const current = at >= 0 ? items[at] : undefined;\n if ((event.key === \"ArrowDown\" && event.metaKey) || event.key === \"Enter\") {\n if (current) {\n event.preventDefault();\n onOpen?.(current);\n }\n return;\n }\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\" || event.key === \"Home\" || event.key === \"End\") {\n if (items.length === 0) return;\n event.preventDefault();\n const next =\n event.key === \"Home\" ? 0 : event.key === \"End\" ? items.length - 1 : Math.max(0, Math.min(items.length - 1, (at < 0 ? -1 : at) + (event.key === \"ArrowDown\" ? 1 : -1)));\n const item = items[next];\n if (item) {\n onSelect(index, item);\n rows[next]?.focus();\n }\n return;\n }\n if (event.key === \"ArrowRight\") {\n if (!current || !isBranch(current)) return;\n event.preventDefault();\n const following = columns[index + 1];\n if (following?.items) {\n const first = following.items[0];\n if (first) {\n onSelect(index + 1, first);\n rowsOf(refs.current[index + 1] ?? null)[0]?.focus();\n }\n } else {\n enterNext.current = index + 1;\n }\n return;\n }\n if (event.key === \"ArrowLeft\" && index > 0) {\n event.preventDefault();\n const parent = columns[index - 1];\n const parentItems = parent?.items ?? [];\n const parentAt = parentItems.findIndex((i) => itemKey(i) === parent?.selectedKey);\n const item = parentItems[parentAt];\n if (item) {\n onSelect(index - 1, item);\n rowsOf(refs.current[index - 1] ?? null)[parentAt]?.focus();\n }\n }\n };\n\n return (\n <div ref={scroller} role=\"group\" aria-label={label} data-slot=\"column-browser\" className={cn(\"flex h-full min-h-0 overflow-x-auto overflow-y-hidden\", className)} {...data}>\n {columns.map((column, index) => (\n <div\n key={column.key}\n ref={(el) => {\n refs.current[index] = el;\n }}\n role=\"listbox\"\n aria-label={`${label}, column ${index + 1}`}\n data-slot=\"column-browser-column\"\n data-column={column.key}\n className=\"flex h-full shrink-0 flex-col overflow-y-auto py-1\"\n onKeyDown={(event) => onKeyDown(index, event)}\n >\n {column.failed ? (\n <div data-slot=\"column-browser-note\" className=\"px-3 py-2 text-body text-label-secondary\">\n {column.failed}\n </div>\n ) : column.items === null ? (\n <div data-slot=\"column-browser-note\" className=\"flex justify-center py-2\">\n <Spinner />\n </div>\n ) : column.items.length === 0 ? (\n <div data-slot=\"column-browser-note\" className=\"px-3 py-2 text-body text-label-secondary\">\n {column.empty ?? null}\n </div>\n ) : (\n column.items.map((item) => {\n const key = itemKey(item);\n const selected = column.selectedKey === key;\n const branch = isBranch(item);\n return (\n <div\n key={key}\n role=\"option\"\n aria-selected={selected}\n tabIndex={selected || (column.selectedKey == null && item === column.items?.[0]) ? 0 : -1}\n data-slot=\"column-browser-row\"\n data-selected={selected || undefined}\n data-branch={branch || undefined}\n title={itemLabel(item)}\n className=\"mx-1 flex shrink-0 items-center gap-1.5 px-2 text-body text-label outline-none\"\n onClick={(event) => {\n onSelect(index, item);\n event.currentTarget.focus();\n }}\n onDoubleClick={() => onOpen?.(item)}\n onContextMenu={\n onItemContextMenu\n ? (event) => {\n event.preventDefault();\n onSelect(index, item);\n onItemContextMenu(item, event);\n }\n : undefined\n }\n {...(itemData?.(item) ?? {})}\n >\n {itemIcon ? (\n <span aria-hidden className=\"flex w-5 shrink-0 justify-center\">\n {itemIcon(item)}\n </span>\n ) : null}\n {itemEditor?.(item) ?? <span className=\"min-w-0 flex-1 truncate\">{itemLabel(item)}</span>}\n {branch ? <ChevronRightIcon aria-hidden data-slot=\"column-browser-chevron\" className=\"size-3 shrink-0 text-label-secondary\" /> : null}\n </div>\n );\n })\n )}\n </div>\n ))}\n {preview ? (\n // Finder's preview column is a column like the others (240 pt), never squeezed by the ones\n // before it: the browser scrolls sideways instead.\n <div data-slot=\"column-browser-preview\" className=\"flex h-full w-60 shrink-0 flex-col items-center overflow-y-auto px-4 py-4\">\n {preview}\n </div>\n ) : null}\n </div>\n );\n}\n","import * as React from \"react\";\n\nimport { Dialog } from \"../dialog\";\nimport { Button } from \"./button\";\nimport { DialogContent, DialogDescription, DialogTitle } from \"./sheet\";\n\n/*\n * Quick Look where the OS has none (Windows, Linux): the file's preview in a large floating panel over\n * the window, its name as the title, \"Open with <app>\" trailing, dismissed by Space, Escape or Close\n * (macOS draws its own QLPreviewPanel; the host calls that there instead). The host gives the\n * preview: an image, the text, or the file's icon and facts.\n */\n\nexport interface QuickLookSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** The file's name, the panel's title. */\n title: string;\n /** One line under it: \"Plain Text Document - 12 KB\". */\n subtitle?: React.ReactNode | undefined;\n /** \"Open with Default App\" (the host's open); absent, no button. */\n onOpen?: (() => void) | undefined;\n openLabel?: string | undefined;\n /** The preview itself. */\n children: React.ReactNode;\n}\n\n/** A Quick Look panel: name, one fact line, the preview filling the rest; Space or Escape closes it. */\nexport function QuickLookSheet({ open, onOpenChange, title, subtitle, onOpen, openLabel = \"Open\", children }: QuickLookSheetProps) {\n return (\n <Dialog open={open} onOpenChange={onOpenChange}>\n <DialogContent\n data-slot=\"quick-look\"\n className=\"flex w-full max-w-3xl flex-col gap-3\"\n onKeyDown={(event) => {\n // Space toggles Quick Look shut, as it opened it (never while typing in a field inside).\n if (event.key === \" \" && !(event.target instanceof HTMLInputElement) && !(event.target instanceof HTMLTextAreaElement)) {\n event.preventDefault();\n onOpenChange(false);\n }\n }}\n >\n <div className=\"flex min-w-0 items-start gap-3\">\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <DialogTitle className=\"truncate\" title={title}>\n {title}\n </DialogTitle>\n {subtitle ? <DialogDescription>{subtitle}</DialogDescription> : <DialogDescription className=\"sr-only\">Quick Look</DialogDescription>}\n </div>\n {onOpen ? (\n <Button size=\"sm\" variant=\"secondary\" onClick={onOpen}>\n {openLabel}\n </Button>\n ) : null}\n <Button size=\"sm\" variant=\"secondary\" data-quick-look-close onClick={() => onOpenChange(false)}>\n Close\n </Button>\n </div>\n <div data-slot=\"quick-look-preview\" className=\"flex min-h-0 flex-1 items-center justify-center overflow-auto\">\n {children}\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\n/*\n * Finder's rename in place: the name becomes an editable field where it sits (a list's name cell, an\n * icon's caption, a column's row), its base name selected and the extension left alone (\"Report\" of\n * \"Report.pdf\"; a folder's whole name). Return or clicking away commits; Escape cancels. An unchanged\n * or empty name commits nothing (onCancel). Keys typed here never reach the view around it.\n */\n\nexport interface RenameFieldProps {\n /** The current name. */\n name: string;\n /** Select the whole name (a folder) instead of the part before the extension. */\n wholeName?: boolean | undefined;\n onCommit: (next: string) => void;\n onCancel: () => void;\n \"aria-label\"?: string | undefined;\n className?: string | undefined;\n}\n\n/** Where the base name ends: before the last dot, unless the name starts with it (\".env\") or has none. */\nexport function baseNameEnd(name: string): number {\n const dot = name.lastIndexOf(\".\");\n return dot > 0 ? dot : name.length;\n}\n\nexport function RenameField({ name, wholeName = false, onCommit, onCancel, \"aria-label\": label = \"Name\", className }: RenameFieldProps) {\n const ref = React.useRef<HTMLInputElement>(null);\n const [value, setValue] = React.useState(name);\n const done = React.useRef(false);\n React.useLayoutEffect(() => {\n const el = ref.current;\n if (!el) return;\n el.focus();\n el.setSelectionRange(0, wholeName ? name.length : baseNameEnd(name));\n }, []);\n const finish = (commit: boolean) => {\n if (done.current) return;\n done.current = true;\n const next = value.trim();\n if (commit && next && next !== name) onCommit(next);\n else onCancel();\n };\n return (\n <input\n ref={ref}\n data-slot=\"rename-field\"\n aria-label={label}\n value={value}\n spellCheck={false}\n className={cn(\"min-w-0 select-text rounded-control bg-content px-1 text-body text-label outline-none ring-2 ring-tint\", className)}\n onChange={(event) => setValue(event.target.value)}\n onClick={(event) => event.stopPropagation()}\n onDoubleClick={(event) => event.stopPropagation()}\n onKeyDown={(event) => {\n event.stopPropagation();\n if (event.key === \"Enter\") {\n event.preventDefault();\n finish(true);\n } else if (event.key === \"Escape\") {\n event.preventDefault();\n finish(false);\n }\n }}\n onBlur={() => finish(true)}\n />\n );\n}\n","import * as React from \"react\";\n\nimport { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuTrigger } from \"../context-menu\";\nimport { ContextMenuEntries, DropdownMenuEntries, type RowMenuItem } from \"./menu-entries\";\nimport { Checkbox } from \"./controls\";\nimport { ConfirmDialog } from \"./sheet\";\nimport { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from \"../dropdown-menu\";\nimport { ChevronDownIcon, ChevronRightIcon, MoreHorizontalIcon } from \"../icons\";\nimport { Button, IconButton } from \"./button\";\nimport { cn } from \"./cn\";\nimport { StatusLight } from \"./tag\";\nimport { StateView } from \"./state\";\nimport { ClearFiltersButton, EMPTY_TABLE_FILTER, TableFilterBar, filterActive, filterRows, noResultsMessage, tableFilters, type ColumnFilter, type FilterableColumn, type TableFilterState } from \"./table-filter\";\nimport { Text } from \"./text\";\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 /** What the column holds, which decides its width (Activity Monitor's model):\n * - `flex`: the text that carries the information (a name, a command). It takes the spare width\n * and is the ONLY kind that truncates (with an ellipsis).\n * - `text`, `numeric`, `status`, `date`: fit their content and are never cut; numbers are\n * right-aligned with tabular figures. Spare width is shared with them so a wide window never\n * leaves one huge gap after a short name (Mail).\n * - `action`: buttons or icons; exactly as wide as its content, never stretched, never clipped.\n * The table scrolls sideways only when the fitted columns truly exceed the width.\n * Default: `numeric` when `numeric` is set, else from `width` (`auto`/`md`/`lg` → flex,\n * `xs`/`sm` → text, `fit` → action). */\n kind?: ColumnKind;\n /** Legacy sizing hint, read only when `kind` is not given (see `kind`). The named sizes are now\n * minimum widths, never caps. */\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 /** The direction of the header's first click; default by kind: words A–Z, numbers and dates biggest/newest first (firstDirection). */\n firstSort?: \"ascending\" | \"descending\";\n sort?: (a: T, b: T) => number;\n /** An optional column (NSTableView's header menu): right-click the header row to show or hide\n * it. `shown` starts visible, `hidden` starts hidden; a column without it is always shown. */\n optional?: \"shown\" | \"hidden\";\n /** The column's name in the header menu when `header` is not plain text. */\n title?: string;\n /** A `flex` column of secondary words (a status sentence beside the name): it gives way down to\n * 6rem before the table scrolls sideways, where a name keeps 10rem. */\n narrow?: boolean;\n /** A column of secondary words that YIELDS to the key column (Finder's Kind beside Name): it\n * takes only the room the other columns leave, so it gives way, with an ellipsis, down to 6rem\n * before the name loses a letter; in a wide window it takes the spare width once every name is\n * whole. Its whole value is the cell's tooltip when cut. */\n yields?: boolean;\n /** How the column filters (the table's filter button lists its values with their counts; see\n * `ColumnFilter`). A table with a filterable or searchable column draws its filter bar. */\n filter?: ColumnFilter<T>;\n /** The column joins the table's search field: `true` reads the row's field named by `key`; a\n * function returns the words to match (a name, a path). */\n search?: boolean | ((row: T) => string | null | undefined);\n}\n\n/** Finder's and Mail's \"Use Groups\": the rows under one heading per group, sorted within it. */\nexport interface TableGroups<T> {\n /** The group a row belongs to. */\n by: (row: T) => string;\n /** The heading drawn over the group's rows (its name, a count: \"Matrx Local · 12 of 40 proven\"). */\n header: (key: string, rows: ReadonlyArray<T>) => React.ReactNode;\n /** The groups' order; groups not named here follow in the order their first row was given. */\n order?: ReadonlyArray<string>;\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 /** Drawn as a compact icon button whose label is its tooltip and accessible name (rowButtons\n * only): a row that carries several actions keeps them all visible without crowding its data. */\n icon?: React.ReactNode;\n}\n\nexport type { RowMenuItem } from \"./menu-entries\";\nexport { MenuItemLabel } from \"./menu-entries\";\n\nexport interface SortState {\n key: string;\n direction: \"ascending\" | \"descending\";\n}\n\nexport type ColumnKind = \"flex\" | \"text\" | \"numeric\" | \"status\" | \"date\" | \"action\";\n\n/** A column's kind (see `Column.kind`). */\n/** A header's first-click direction: words ascending (A–Z), numbers and dates descending (biggest, newest first). */\nexport function firstDirection(column: Pick<Column<never>, \"kind\" | \"numeric\" | \"width\" | \"firstSort\"> | undefined): \"ascending\" | \"descending\" {\n if (!column) return \"ascending\";\n if (column.firstSort) return column.firstSort;\n const kind = columnKind(column);\n return kind === \"numeric\" || kind === \"date\" ? \"descending\" : \"ascending\";\n}\n\nexport function columnKind(column: Pick<Column<never>, \"kind\" | \"numeric\" | \"width\">): ColumnKind {\n if (column.kind) return column.kind;\n if (column.numeric) return \"numeric\";\n const w = column.width ?? \"auto\";\n if (w === \"fit\") return \"action\";\n if (w === \"xs\" || w === \"sm\") return \"text\";\n return \"flex\";\n}\n\n/** The grid track per kind. The table is a CSS grid whose rows are subgrids, so every column is\n * sized once for all rows. Fitted kinds never go below their content. The flex column grows first,\n * up to its whole content (it never truncates while there is room), and gives way first when there\n * is not (down to 6rem, so a narrow list keeps its numbers and actions in view). Width left over after that is shared by every `auto` track\n * (grid's auto-track stretch), so a wide window spreads the columns instead of opening one gap. */\nconst TRACK: Record<ColumnKind, string> = {\n // The key column (a name) keeps 10rem before it truncates (min() cannot take max-content: an\n // intrinsic size inside min() voids the whole template). The fitted\n // columns beside it are short, so the thing a row IS stays readable at every window width.\n flex: \"minmax(10rem, auto)\",\n text: \"minmax(max-content, auto)\",\n numeric: \"minmax(max-content, auto)\",\n status: \"minmax(max-content, auto)\",\n date: \"minmax(max-content, auto)\",\n action: \"max-content\",\n};\n/** A `narrow` flex column's track: secondary words give way to 6rem (a name keeps 10rem). */\nconst NARROW_FLEX = \"minmax(6rem, auto)\";\n/** A `yields` column's track: a flexible track is sized only after every other track has its\n * content (grid's \"expand flexible tracks\" runs last), so it gets what is left, never below 6rem. */\nconst YIELDS = \"minmax(6rem, 1fr)\";\n/** The least a fitted column is, so a short value (\"3\") still reads as a column. */\nconst MIN: Partial<Record<ColumnKind, string>> = { numeric: \"min-w-14\", status: \"min-w-16\", date: \"min-w-16\" };\nconst LEGACY_MIN = { auto: \"\", fit: \"\", xs: \"min-w-12\", sm: \"min-w-16\", md: \"\", lg: \"\" } as const;\n\nfunction gridTemplate(\n columns: ReadonlyArray<Column<never>>,\n lead: { selection: boolean; detail: boolean },\n actions: boolean,\n widths: ReadonlyMap<string, number> = new Map(),\n spare: \"shared\" | \"flex\" = \"shared\",\n): string {\n const tracks: string[] = [];\n if (lead.selection) tracks.push(\"2rem\");\n if (lead.detail) tracks.push(\"1.5rem\");\n // A column the person resized keeps its width; every other one autosizes (AppKit's table view).\n for (const c of columns) {\n const w = widths.get(c.key);\n const kind = columnKind(c);\n tracks.push(w !== undefined ? `${w}px` : c.yields ? YIELDS : spare === \"flex\" && kind !== \"flex\" ? \"max-content\" : kind === \"flex\" && c.narrow ? NARROW_FLEX : TRACK[kind]);\n }\n if (actions) tracks.push(\"max-content\");\n return tracks.join(\" \");\n}\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 /** AppKit multiple selection (Finder, Mail): with `onSelectedKeysChange`, ⌘-click adds or removes\n * a row, ⇧-click and ⇧↑/⇧↓ extend from the row last clicked, ⌘A selects every row; a plain click\n * selects one. `onRowSelect` still names the row clicked last (the lead). */\n selectedKeys?: ReadonlySet<string> | undefined;\n onSelectedKeysChange?: ((keys: Set<string>) => void) | undefined;\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 /** A fixed set of buttons on every row, always visible and always in the same order; one that\n * does not apply to a row is disabled, never hidden, so nothing shifts from row to row. */\n rowButtons?: (row: T) => ReadonlyArray<RowAction>;\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 /** Draw only the first `limit` rows AFTER sorting (long lists: the caller offers \"Show more\"). */\n limit?: number;\n /** Controlled sort: the caller keeps it (to remember it, or to reset it with its filters). */\n sort?: SortState | null;\n onSortChange?: (sort: SortState | null) => void;\n /** Checkbox selection: a leading column of checkboxes, and one in the header for every row given. */\n selection?: { selected: ReadonlySet<string>; onChange: (next: Set<string>) => void };\n /** Double-click or ⌘↓ on a row (Activity Monitor's Inspect, Finder's Open). */\n onRowOpen?: (row: T) => void;\n /** An outline (Activity Monitor's \"All Processes, Hierarchically\"): a row's child rows, drawn as\n * real rows in the same columns under it, indented, with a disclosure triangle in the first\n * column; open by default, Right/Left or the triangle open and close it. Children sort with\n * their siblings. Return null or [] for a leaf. */\n subRows?: (row: T) => ReadonlyArray<T> | null;\n /** How an outline starts: `open` (Activity Monitor's hierarchy, the default) or `closed` (Finder's\n * list view: each folder shut until its triangle is clicked). */\n outline?: \"open\" | \"closed\";\n /** A row that is a branch before its children are known (Finder's folders, read when opened):\n * it draws its disclosure triangle; `subRows` gives its children once they are there. */\n expandable?: (row: T) => boolean;\n /** A branch opened or closed (the triangle, Right/Left): the caller reads its children. */\n onOutlineChange?: (row: T, open: boolean) => void;\n /** `small`: Finder's list view, 20 pt rows (its small icons). Default `regular`, 24 pt. */\n rowSize?: \"regular\" | \"small\";\n /** The table fills the page's height and its stripes run on below the last row to the foot, as\n * an NSTableView's alternating rows do (use in a `Page flush`). */\n fill?: boolean;\n /** Who gets the width left over: `shared` (default) spreads it over every column (Mail);\n * `flex` gives all of it to the `flex` column and keeps every other column exactly as wide as\n * its content (Console's Message, Finder's Name, System Information's item). */\n spare?: \"shared\" | \"flex\";\n /** Right-click on a row (Activity Monitor, Finder): the row is selected and this menu opens.\n * Items labeled \"-\" are separators; destructive items with `confirm` ask first. */\n rowContextMenu?: (row: T) => ReadonlyArray<RowMenuItem> | null;\n /** The optional columns hidden now (controlled; see `Column.optional`). Uncontrolled, the table\n * keeps them itself, starting from each column's `optional`. */\n hiddenColumns?: ReadonlySet<string>;\n onHiddenColumnsChange?: (next: Set<string>) => void;\n /** Group the rows under headings (Finder's Use Groups); rows sort within their group. */\n groups?: TableGroups<T>;\n /** Controlled search and filters (the page keeps them: in the address, as saved filters). Uncontrolled,\n * the table keeps them itself, starting from `defaultFilter`. */\n filterState?: TableFilterState;\n onFilterStateChange?: (next: TableFilterState) => void;\n defaultFilter?: TableFilterState;\n /** The table's own filter bar over its header (default, when a column filters or searches). `false`\n * when the page draws the controls itself (`SearchField` + `TableFilterMenu` in its header's\n * actions) and passes `filterState`. */\n filterBar?: boolean;\n className?: string;\n}\n\n/** Which optional columns start hidden (`Column.optional === \"hidden\"`). */\nexport function initiallyHiddenColumns(columns: ReadonlyArray<Pick<Column<never>, \"key\" | \"optional\">>): Set<string> {\n return new Set(columns.filter((c) => c.optional === \"hidden\").map((c) => c.key));\n}\n\n/**\n * The macOS table (NSTableView .fullWidth, as in Activity Monitor): 13 pt rows 24 pt\n * tall, full width with no box, alternating rows, a 22 pt system header that stays put, the whole\n * header cell sorts with a trailing chevron, every column resizes (double-click its edge to fit),\n * column kinds sized like Activity Monitor's, the accent selection while focused. Arrow keys move\n * between rows when rows are selectable.\n */\nexport function DataTable<T>({\n rowKey,\n onRowSelect,\n selectedKey,\n selectedKeys,\n onSelectedKeysChange,\n empty,\n striped = true,\n detail,\n isDisabled,\n rowAction,\n rowMenu,\n rowButtons,\n defaultSort,\n rowData,\n limit,\n sort: sortProp,\n onSortChange,\n selection,\n onRowOpen,\n subRows,\n outline = \"open\",\n expandable,\n onOutlineChange,\n rowSize = \"regular\",\n fill,\n spare = \"shared\",\n rowContextMenu,\n hiddenColumns,\n onHiddenColumnsChange,\n groups,\n filterState,\n onFilterStateChange,\n defaultFilter,\n filterBar = true,\n className,\n \"aria-label\": ariaLabel,\n columns: allColumns,\n rows: givenRows,\n ...rest\n}: DataTableProps<T>) {\n // Search and filters (G1): every column that declares `filter` or `search` takes part, with no\n // code on the page. Controlled like the sort, or kept here.\n const filterable = tableFilters(allColumns as ReadonlyArray<FilterableColumn<never>>);\n const [filterKept, setFilterKept] = React.useState<TableFilterState>(defaultFilter ?? EMPTY_TABLE_FILTER);\n const filter = filterState ?? filterKept;\n const setFilter = (next: TableFilterState) => {\n if (filterState === undefined) setFilterKept(next);\n onFilterStateChange?.(next);\n };\n // The table keeps its place while a filter is on (no layout shift): the frame reserves the height\n // the FULL set of rows takes now (bar + header + every row the table would draw unfiltered), so\n // the page under a stuck filter bar never scrolls back (its scroll is clamped when content\n // shrinks). The reservation follows the rows, never a stale snapshot: a refresh that drops rows\n // shrinks it, and the bar, header and row heights are measured again on every render and on\n // every window resize, filtered or not. (Top-level rows and group headings; open outline\n // children and detail rows are not reserved.)\n const frameRef = React.useRef<HTMLDivElement>(null);\n const [metrics, setMetrics] = React.useState<{ bar: number; head: number; row: number } | null>(null);\n const [resized, setResized] = React.useState(0);\n const narrowed = filterable && filterActive(filter);\n React.useEffect(() => {\n if (!filterable) return undefined;\n const onResize = () => setResized((n) => n + 1);\n window.addEventListener(\"resize\", onResize);\n return () => window.removeEventListener(\"resize\", onResize);\n }, [filterable]);\n React.useLayoutEffect(() => {\n const frame = frameRef.current;\n if (!frame) return;\n const height = (sel: string) => frame.querySelector(sel)?.getBoundingClientRect().height ?? 0;\n const bar = height('[data-slot=\"data-table-filter-bar\"]');\n const head = height('[data-slot=\"data-table-header\"]');\n const row = height('[data-slot=\"data-table-row\"]');\n // No Results draws no header and no row: keep the last ones measured.\n setMetrics((prev) => {\n const next = { bar: bar || prev?.bar || 0, head: head || prev?.head || 0, row: row || prev?.row || 0 };\n return prev && prev.bar === next.bar && prev.head === next.head && prev.row === next.row ? prev : next;\n });\n });\n void resized;\n const fullRows = limit !== undefined ? Math.min(givenRows.length, limit) : givenRows.length;\n const fullGroups = groups ? new Set(givenRows.map((r) => groups.by(r))).size : 0;\n const heldHeight = narrowed && metrics && metrics.row > 0 ? Math.round(metrics.bar + metrics.head + (fullRows + fullGroups) * metrics.row) : null;\n const rows = React.useMemo(\n () => (filterable ? filterRows(allColumns as ReadonlyArray<FilterableColumn<T>>, givenRows, filter) : givenRows),\n [filterable, allColumns, givenRows, filter],\n );\n // The optional columns the person hid (NSTableView's header menu), controlled or kept here.\n const [hiddenState, setHiddenState] = React.useState<ReadonlySet<string>>(() => initiallyHiddenColumns(allColumns as ReadonlyArray<Column<never>>));\n const hidden = hiddenColumns ?? hiddenState;\n const setColumnShown = (key: string, shown: boolean) => {\n const next = new Set(hidden);\n if (shown) next.delete(key);\n else next.add(key);\n if (hiddenColumns === undefined) setHiddenState(next);\n onHiddenColumnsChange?.(next);\n };\n const optionalColumns = allColumns.filter((c) => c.optional);\n const columns = allColumns.filter((c) => !c.optional || !hidden.has(c.key));\n const bodyRef = React.useRef<HTMLTableSectionElement>(null);\n const [menuRow, setMenuRow] = React.useState<T | null>(null);\n const [askingMenu, setAskingMenu] = React.useState<RowMenuItem | null>(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 [sortState, setSortState] = React.useState<SortState | null>(defaultSort ?? null);\n const controlled = sortProp !== undefined;\n const sort = controlled ? sortProp : sortState;\n const setSort = (next: (prev: SortState | null) => SortState | null) => {\n const value = next(sort);\n if (controlled) onSortChange?.(value);\n else {\n setSortState(value);\n onSortChange?.(value);\n }\n };\n const sortColumn = sort ? allColumns.find((c) => c.key === sort.key && c.sort) : undefined;\n const ordered = React.useMemo(() => {\n const cut = (list: ReadonlyArray<T>) => (limit !== undefined && list.length > limit ? list.slice(0, limit) : list);\n if (!sort || !sortColumn?.sort) return cut(rows);\n const by = sortColumn.sort;\n const sign = sort.direction === \"ascending\" ? 1 : -1;\n return cut([...rows].sort((a, b) => sign * by(a, b)));\n }, [rows, sort, sortColumn, limit]);\n // The outline: every visible row with its depth (children sorted like their parents).\n // The rows the person turned from how the outline starts (`outline`): closed ones of an open\n // outline, opened ones of a closed one.\n const [flipped, setFlipped] = React.useState<ReadonlySet<string>>(() => new Set());\n const collapsed = React.useMemo(() => ({ has: (key: string) => (outline === \"closed\" ? !flipped.has(key) : flipped.has(key)) }), [flipped, outline]);\n const setOpen = (key: string, open: boolean, row?: T) => {\n setFlipped((prev) => {\n const next = new Set(prev);\n if (open === (outline === \"closed\")) next.add(key);\n else next.delete(key);\n return next;\n });\n if (row !== undefined) onOutlineChange?.(row, open);\n };\n // Finder's Use Groups: the (sorted) rows split under their headings, in the groups' order.\n const segments = React.useMemo(() => {\n if (!groups) return [{ key: null as string | null, rows: ordered }];\n const byKey = new Map<string, T[]>();\n for (const row of rows) {\n const key = groups.by(row);\n if (!byKey.has(key)) byKey.set(key, []);\n }\n for (const row of ordered) byKey.get(groups.by(row))?.push(row);\n const keys = [...(groups.order ?? []).filter((k) => byKey.has(k)), ...[...byKey.keys()].filter((k) => !(groups.order ?? []).includes(k))];\n return keys.map((key) => ({ key: key as string | null, rows: byKey.get(key) ?? [] })).filter((g) => g.rows.length > 0);\n }, [groups, rows, ordered]);\n const { flat, groupStarts } = React.useMemo(() => {\n type Item = { row: T; depth: number; parent: boolean };\n const by = sort && sortColumn?.sort ? sortColumn.sort : null;\n const sign = sort?.direction === \"ascending\" ? 1 : -1;\n const out: Item[] = [];\n const starts = new Map<number, { key: string; rows: ReadonlyArray<T> }>();\n const walk = (list: ReadonlyArray<T>, depth: number) => {\n for (const row of list) {\n const kids = subRows?.(row) ?? [];\n out.push({ row, depth, parent: kids.length > 0 || (expandable?.(row) ?? false) });\n if (kids.length > 0 && !collapsed.has(rowKey(row))) walk(by ? [...kids].sort((a, b) => sign * by(a, b)) : kids, depth + 1);\n }\n };\n for (const segment of segments) {\n if (segment.key !== null) starts.set(out.length, { key: segment.key, rows: segment.rows });\n walk(segment.rows, 0);\n }\n return { flat: out, groupStarts: starts };\n }, [segments, subRows, expandable, collapsed, sort, sortColumn, rowKey]);\n // A first click sorts the way a Mac table does (Finder, Activity Monitor): words A–Z; numbers\n // and dates biggest and newest first. `Column.firstSort` overrides it; a second click reverses.\n const toggleSort = (key: string) =>\n setSort((prev) => (prev?.key === key ? { key, direction: prev.direction === \"ascending\" ? \"descending\" : \"ascending\" } : { key, direction: firstDirection(allColumns.find((c) => c.key === key)) }));\n const hasActions = Boolean(rowAction || rowMenu || rowButtons);\n const span = columns.length + (detail ? 1 : 0) + (hasActions ? 1 : 0) + (selection ? 1 : 0);\n // A dimmed row (isDisabled) is never picked: its checkbox is off and the header leaves it out.\n const allKeys = selection ? rows.filter((r) => !isDisabled?.(r)).map(rowKey) : [];\n const picked = selection ? allKeys.filter((k) => selection.selected.has(k)).length : 0;\n const [focusedKey, setFocusedKey] = React.useState<string | null>(null);\n // Column widths the person dragged (NSTableColumn resizing); a double-click on the edge autosizes.\n const [widths, setWidths] = React.useState<ReadonlyMap<string, number>>(() => new Map());\n const resizeFrom = (key: string, event: React.PointerEvent<HTMLSpanElement>) => {\n const th = event.currentTarget.parentElement;\n if (!th) return;\n event.preventDefault();\n event.stopPropagation();\n const start = event.clientX;\n const base = th.getBoundingClientRect().width;\n const handle = event.currentTarget;\n handle.setPointerCapture(event.pointerId);\n const move = (e: PointerEvent) => setWidths((m) => new Map(m).set(key, Math.max(40, Math.round(base + e.clientX - start))));\n const up = () => {\n handle.removeEventListener(\"pointermove\", move);\n handle.removeEventListener(\"pointerup\", up);\n handle.removeEventListener(\"pointercancel\", up);\n };\n handle.addEventListener(\"pointermove\", move);\n handle.addEventListener(\"pointerup\", up);\n handle.addEventListener(\"pointercancel\", up);\n };\n const autosize = (key: string) =>\n setWidths((m) => {\n const next = new Map(m);\n next.delete(key);\n return next;\n });\n const rowFocusable = (row: T) =>\n !(isDisabled?.(row) ?? false) && Boolean(onRowSelect || onRowOpen || (detail && detail(row) !== null) || (subRows && ((subRows(row)?.length ?? 0) > 0 || (expandable?.(row) ?? false))));\n const focusableKeys = flat.map((f) => f.row).filter(rowFocusable).map(rowKey);\n const tabRowKey =\n selectedKey != null && focusableKeys.includes(selectedKey)\n ? selectedKey\n : focusedKey != null && focusableKeys.includes(focusedKey)\n ? focusedKey\n : (focusableKeys[0] ?? null);\n // Multiple selection: the row a ⇧-click or ⇧-arrow extends from (the last row clicked).\n const anchorRef = React.useRef<string | null>(null);\n const multi = onSelectedKeysChange !== undefined;\n /** A click or key that changes a multiple selection; true when it was handled here. */\n const pick = (key: string, row: T, mods: { meta: boolean; shift: boolean }): boolean => {\n if (!onSelectedKeysChange) return false;\n const current = new Set(selectedKeys ?? (selectedKey != null ? [selectedKey] : []));\n const anchor = anchorRef.current ?? selectedKey ?? null;\n if (mods.shift && anchor !== null && focusableKeys.includes(anchor)) {\n const a = focusableKeys.indexOf(anchor);\n const b = focusableKeys.indexOf(key);\n const range = focusableKeys.slice(Math.min(a, b), Math.max(a, b) + 1);\n onSelectedKeysChange(new Set([...(mods.meta ? current : []), ...range]));\n } else if (mods.meta) {\n if (current.has(key)) current.delete(key);\n else current.add(key);\n anchorRef.current = key;\n onSelectedKeysChange(current);\n } else {\n anchorRef.current = key;\n onSelectedKeysChange(new Set([key]));\n }\n onRowSelect?.(row);\n return true;\n };\n const moveFocus = (event: React.KeyboardEvent<HTMLTableRowElement>, delta: number) => {\n const rowsEls = Array.from(bodyRef.current?.rows ?? []).filter((tr) => tr.hasAttribute(\"data-row-focusable\"));\n const at = rowsEls.indexOf(event.currentTarget);\n const next = rowsEls[delta === Infinity ? rowsEls.length - 1 : delta === -Infinity ? 0 : at + delta];\n if (next) {\n event.preventDefault();\n next.focus();\n }\n };\n const contextItems = menuRow !== null && rowContextMenu ? (rowContextMenu(menuRow) ?? null) : null;\n // No rows: Console's \"No Messages\" — the placeholder alone, centered on a plain content area, with no\n // header and no stripes (an empty NSTableView draws nothing behind a placeholder).\n const bar =\n filterable && filterBar && givenRows.length > 0 ? (\n <TableFilterBar columns={allColumns as ReadonlyArray<FilterableColumn<T>>} rows={givenRows} state={filter} onChange={setFilter} shown={rows.length} label={ariaLabel.toLowerCase()} />\n ) : null;\n const framed = (body: React.ReactElement) =>\n bar ? (\n <div\n ref={frameRef}\n data-slot=\"data-table-frame\"\n data-held={heldHeight ? \"\" : undefined}\n className={cn(\"flex min-h-0 flex-col\", fill && \"flex-1\")}\n style={heldHeight ? { minHeight: heldHeight } : undefined}\n >\n {bar}\n {body}\n </div>\n ) : (\n body\n );\n // The filters keep no row: say so where the rows were, with the way back (the bar stays put).\n if (givenRows.length > 0 && rows.length === 0 && filterable) {\n return framed(\n <div data-slot=\"data-table\" data-empty=\"\" data-filtered-empty=\"\" role=\"table\" aria-label={ariaLabel} aria-rowcount={0} className={cn(\"flex items-center justify-center py-6\", fill ? \"min-h-0 flex-1\" : null, className)} {...rest}>\n <StateView kind=\"empty\" title=\"No Results\" message={noResultsMessage(filter)} actions={filterActive(filter) ? <ClearFiltersButton onClear={() => setFilter(EMPTY_TABLE_FILTER)} /> : null} />\n </div>,\n );\n }\n if (givenRows.length === 0 && empty) {\n return (\n <div\n data-slot=\"data-table\"\n data-empty=\"\"\n data-fill={fill || undefined}\n role=\"table\"\n aria-label={ariaLabel}\n aria-rowcount={0}\n className={cn(\"flex items-center justify-center\", fill ? \"min-h-0 flex-1\" : null, className)}\n {...rest}\n >\n {empty}\n </div>\n );\n }\n const openDetails = detail ? flat.filter(({ row }) => expanded.has(rowKey(row))).length : 0;\n // Each group's stripes start again under its heading; the filler continues the last group's.\n const groupStartAt = (index: number) => {\n let at = 0;\n for (const start of groupStarts.keys()) if (start <= index) at = start;\n return at;\n };\n const lastStripe = flat.length - groupStartAt(Math.max(0, flat.length - 1));\n const drawn = flat.length + groupStarts.size;\n const fillerStart = drawn - (lastStripe % 2);\n const table = (\n <div\n data-slot=\"data-table\"\n data-fill={fill || undefined}\n data-spare={spare}\n data-row-size={rowSize === \"small\" ? \"small\" : undefined}\n className={cn(\"overflow-x-auto\", fill && \"flex-1\", className)}\n {...rest}\n // The rows paint their own (rounded) stripes; the filler's stripes start at the even row at or\n // above the table's end, so none is painted twice. An open detail row has its own height, so\n // while one is open there is no filler (its rows could not line up).\n data-detail-open={openDetails > 0 || undefined}\n style={fill ? ({ ...rest.style, \"--mx-table-rows\": String(fillerStart) } as React.CSSProperties) : rest.style}\n >\n <table\n aria-label={ariaLabel}\n className=\"grid w-full border-collapse text-body\"\n style={{ gridTemplateColumns: gridTemplate(columns as ReadonlyArray<Column<never>>, { selection: Boolean(selection), detail: Boolean(detail) }, hasActions, widths, spare) }}\n >\n <thead role=\"rowgroup\" className=\"contents\">\n <HeaderMenu columns={optionalColumns} hidden={hidden} onToggle={setColumnShown}>\n <tr role=\"row\" data-slot=\"data-table-header\" data-column-menu={optionalColumns.length > 0 ? \"\" : undefined} className=\"col-span-full grid h-table-header grid-cols-subgrid border-b border-separator\">\n {selection ? (\n <th className=\"flex items-center pl-3\">\n <Checkbox\n aria-label=\"Select every row\"\n data-select-all\n checked={picked === 0 ? false : picked === allKeys.length ? true : \"indeterminate\"}\n onCheckedChange={(on) => selection.onChange(on === true ? new Set([...selection.selected, ...allKeys]) : new Set([...selection.selected].filter((k) => !allKeys.includes(k))))}\n />\n </th>\n ) : null}\n {detail ? <th aria-hidden /> : 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 role=\"columnheader\"\n data-kind={columnKind(column as Column<never>)}\n aria-sort={column.sort ? (sorted ?? \"none\") : undefined}\n data-sorted={sorted ? \"\" : undefined}\n className={cn(\n // A header never wraps (\"Started by\" is one line): it is part of its column's\n // fitted width.\n // The column names in the label color, as Activity Monitor's (measured #272727): the gray\n // secondary read as a smaller, fainter font than Apple's header.\n \"relative content-center truncate whitespace-nowrap px-3 text-table-header text-label\",\n MIN[columnKind(column as Column<never>)],\n column.kind ? null : LEGACY_MIN[column.width ?? \"auto\"],\n ALIGN[column.align ?? (columnKind(column as Column<never>) === \"numeric\" ? \"end\" : \"start\")],\n )}\n >\n {column.sort ? (\n // The whole header cell sorts (NSTableHeaderView); the sort chevron sits at the\n // cell's trailing edge, up for ascending, and only on the sorted column.\n <button\n type=\"button\"\n onClick={() => toggleSort(column.key)}\n className={cn(\n \"focus-ring flex h-full w-full items-center gap-1 rounded-control hover:text-label\",\n sorted && \"text-label\",\n (column.align ?? (columnKind(column as Column<never>) === \"numeric\" ? \"end\" : \"start\")) === \"end\" && \"justify-end\",\n )}\n >\n <span className=\"min-w-0 truncate\">{column.header}</span>\n <ChevronDownIcon\n aria-hidden\n data-sort-chevron={sorted ?? undefined}\n className={cn(\n \"size-2.5 shrink-0 text-label-secondary\",\n (column.align ?? (columnKind(column as Column<never>) === \"numeric\" ? \"end\" : \"start\")) !== \"end\" && \"ml-auto\",\n // Only the sorted column draws its chevron; every other header takes no room\n // for one, so a right-aligned title ends flush over its numbers (AppKit).\n !sorted && \"hidden\",\n sorted === \"ascending\" && \"rotate-180\",\n )}\n />\n </button>\n ) : (\n column.header\n )}\n {columnKind(column as Column<never>) === \"action\" ? null : (\n <span\n aria-hidden\n data-slot=\"column-resizer\"\n title=\"Drag to resize · double-click to fit\"\n className=\"absolute inset-y-0 -right-1 w-2 cursor-col-resize\"\n onPointerDown={(event) => resizeFrom(column.key, event)}\n onDoubleClick={() => autosize(column.key)}\n />\n )}\n </th>\n );\n })}\n {hasActions ? <th aria-label=\"Actions\" /> : null}\n </tr>\n </HeaderMenu>\n </thead>\n {(\n <tbody ref={bodyRef} role=\"rowgroup\" className=\"contents\">\n {flat.map(({ row, depth, parent }, index) => {\n const tabKey = tabRowKey;\n const key = rowKey(row);\n const branchOpen = parent && !collapsed.has(key);\n const selected = selectedKey === key || (multi && (selectedKeys?.has(key) ?? false));\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) : parent ? () => setOpen(key, !branchOpen, row) : undefined;\n const focusable = Boolean(activate || onRowOpen) && !disabled;\n const group = groupStarts.get(index);\n const stripe = index - groupStartAt(index);\n return (\n <React.Fragment key={key}>\n {group ? (\n <tr role=\"row\" data-slot=\"data-table-group\" data-group={group.key} className=\"col-span-full grid h-row-table grid-cols-subgrid border-b border-separator\">\n <td role=\"cell\" colSpan={span} className=\"col-span-full min-w-0 content-center truncate px-3\">\n {groups?.header(group.key, group.rows)}\n </td>\n </tr>\n ) : null}\n <tr\n {...rowData?.(row)}\n // One Tab stop for the whole table (AppKit's table view): the selected row, else\n // the last one focused, else the first; the arrows move between rows.\n tabIndex={focusable ? (key === tabKey ? 0 : -1) : undefined}\n data-row-focusable={focusable || undefined}\n // Only the row itself becomes the Tab row: a control in another row's cell, reached by Tab,\n // must leave this row and its actions in the Tab order, so Shift-Tab walks back over them.\n onFocus={focusable ? (event) => (event.target === event.currentTarget ? setFocusedKey(key) : undefined) : undefined}\n aria-selected={onRowSelect ? selected : undefined}\n data-selected={selected || undefined}\n aria-expanded={content !== null ? open : parent ? branchOpen : undefined}\n aria-level={subRows ? depth + 1 : undefined}\n data-depth={subRows ? depth : undefined}\n onDoubleClick={\n onRowOpen && focusable\n ? (event) => {\n if (insideControl(event.target as HTMLElement, event.currentTarget)) return;\n onRowOpen(row);\n }\n : undefined\n }\n onContextMenu={\n rowContextMenu && !disabled\n ? () => {\n // Right-clicking a row selects it first (Activity Monitor, Finder).\n setMenuRow(row);\n if (!selected) onRowSelect?.(row);\n }\n : undefined\n }\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 if (multi && onRowSelect && pick(key, row, { meta: event.metaKey || event.ctrlKey, shift: event.shiftKey })) return;\n activate?.();\n }\n : undefined\n }\n onKeyDown={\n focusable\n ? (event) => {\n if (multi && (event.metaKey || event.ctrlKey) && event.key.toLowerCase() === \"a\") {\n event.preventDefault();\n onSelectedKeysChange?.(new Set(focusableKeys));\n return;\n }\n if (multi && event.shiftKey && (event.key === \"ArrowDown\" || event.key === \"ArrowUp\")) {\n const at = focusableKeys.indexOf(key);\n const nextKey = focusableKeys[at + (event.key === \"ArrowDown\" ? 1 : -1)];\n const nextRow = nextKey === undefined ? undefined : flat.find((f) => rowKey(f.row) === nextKey)?.row;\n if (nextKey !== undefined && nextRow !== undefined) {\n const keep = anchorRef.current;\n pick(nextKey, nextRow, { meta: false, shift: true });\n anchorRef.current = keep ?? key;\n moveFocus(event, event.key === \"ArrowDown\" ? 1 : -1);\n }\n return;\n }\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n activate?.();\n } else if (event.key === \"ArrowDown\" && event.metaKey && onRowOpen) {\n event.preventDefault();\n onRowOpen(row);\n } else if (event.key === \"ArrowDown\") moveFocus(event, 1);\n else if (event.key === \"ArrowUp\") moveFocus(event, -1);\n else if (event.key === \"Home\") moveFocus(event, -Infinity);\n else if (event.key === \"End\") moveFocus(event, Infinity);\n else if (event.key === \"ArrowRight\" && content !== null) toggle(key, true);\n else if (event.key === \"ArrowLeft\" && content !== null) toggle(key, false);\n else if (event.key === \"ArrowRight\" && parent) setOpen(key, true, row);\n else if (event.key === \"ArrowLeft\" && parent) setOpen(key, false, row);\n }\n : undefined\n }\n role=\"row\"\n data-slot=\"data-table-row\"\n className={cn(\n \"group/row col-span-full grid h-row-table grid-cols-subgrid\",\n // alternatingContentBackgroundColors: every other row, edge to edge and square\n // (NSTableView .fullWidth, as in Activity Monitor).\n striped && stripe % 2 === 1 && \"bg-fill\",\n focusable && \"focus-ring -outline-offset-3\",\n disabled && \"text-label-tertiary\",\n // Unemphasised gray; the accent with white text while the table has focus in\n // the key window (desktop.css), as an NSTableView selection.\n selected && \"bg-selection-muted\",\n )}\n >\n {selection ? (\n <td className=\"flex items-center pl-3\">\n <Checkbox\n aria-label=\"Select row\"\n data-select-row={key}\n disabled={disabled}\n checked={!disabled && selection.selected.has(key)}\n onCheckedChange={(on) => {\n const next = new Set(selection.selected);\n if (on === true) next.add(key);\n else next.delete(key);\n selection.onChange(next);\n }}\n />\n </td>\n ) : null}\n {detail ? (\n <td className=\"flex items-center 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, columnIndex) => {\n const kind = columnKind(column as Column<never>);\n const outline = subRows && columnIndex === 0;\n const gives = kind === \"flex\" || column.yields === true;\n const body = gives ? <FitText>{column.cell(row)}</FitText> : column.cell(row);\n return (\n <td\n key={column.key}\n role=\"cell\"\n data-kind={kind}\n className={cn(\n \"content-center px-3\",\n // Only the flex column (and a column that yields) gives way, with an\n // ellipsis; every other kind is as wide as its widest value.\n gives ? \"min-w-0 truncate\" : \"whitespace-nowrap\",\n ALIGN[column.align ?? (kind === \"numeric\" ? \"end\" : \"start\")],\n kind === \"numeric\" && \"tabular-nums\",\n column.mono && \"font-mono text-code\",\n )}\n >\n {outline ? (\n <span data-slot=\"outline-cell\" className=\"flex min-w-0 items-center gap-1\" style={{ paddingInlineStart: `${depth}rem` }}>\n <span\n aria-hidden\n data-disclosure={parent ? (branchOpen ? \"open\" : \"closed\") : undefined}\n className=\"flex size-icon shrink-0 items-center justify-center\"\n onClick={\n parent\n ? (event) => {\n event.stopPropagation();\n setOpen(key, !branchOpen, row);\n }\n : undefined\n }\n >\n {parent ? <ChevronRightIcon className={cn(\"size-icon-sm text-label-secondary transition-transform duration-100\", branchOpen && \"rotate-90\")} /> : null}\n </span>\n <span className=\"min-w-0 flex-1\">{body}</span>\n </span>\n ) : (\n body\n )}\n </td>\n );\n })}\n {hasActions ? (\n // Always visible, in their own column (Arman, 2026-10-07): a row's buttons are\n // there to be seen and used, never revealed on hover.\n <td role=\"cell\" data-kind=\"action\" className=\"content-center whitespace-nowrap px-2\">\n <RowActions tabbable={!focusable || key === tabKey} buttons={rowButtons?.(row) ?? null} action={rowAction?.(row) ?? null} menu={rowMenu?.(row) ?? null} />\n </td>\n ) : null}\n </tr>\n {open ? (\n <tr role=\"row\" className={cn(\"col-span-full grid grid-cols-subgrid\", striped && stripe % 2 === 1 && \"bg-fill\")}>\n <td colSpan={span} className=\"col-span-full min-w-0 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 if (!rowContextMenu) return framed(table);\n return framed(\n <>\n <ContextMenu onOpenChange={(open) => (open ? undefined : setMenuRow(null))}>\n <ContextMenuTrigger asChild>{table}</ContextMenuTrigger>\n {contextItems && contextItems.length ? (\n <ContextMenuContent data-slot=\"data-table-menu\">\n <ContextMenuEntries items={contextItems} onAsk={setAskingMenu} />\n </ContextMenuContent>\n ) : null}\n </ContextMenu>\n <ConfirmDialog\n open={askingMenu !== null}\n onOpenChange={(open) => (open ? undefined : setAskingMenu(null))}\n title={askingMenu?.confirm ?? \"\"}\n confirmLabel={askingMenu?.label}\n variant=\"destructive\"\n onConfirm={() => {\n askingMenu?.onSelect();\n setAskingMenu(null);\n }}\n />\n </>,\n );\n}\n\n/**\n * NSTableView's header menu: right-click the column headers for a checked list of the optional\n * columns, each shown or hidden in place (Finder's and Mail's Show Columns). A table with no\n * optional column has no menu.\n */\nfunction HeaderMenu<T>({\n columns,\n hidden,\n onToggle,\n children,\n}: {\n columns: ReadonlyArray<Column<T>>;\n hidden: ReadonlySet<string>;\n onToggle: (key: string, shown: boolean) => void;\n children: React.ReactElement;\n}) {\n if (columns.length === 0) return children;\n return (\n <ContextMenu>\n {/* The row menu (rowContextMenu) wraps the whole table: the header's right-click is its own. */}\n <ContextMenuTrigger asChild onContextMenu={(event) => event.stopPropagation()}>\n {children}\n </ContextMenuTrigger>\n <ContextMenuContent data-slot=\"data-table-column-menu\">\n {columns.map((column) => (\n <ContextMenuCheckboxItem\n key={column.key}\n data-column-toggle={column.key}\n checked={!hidden.has(column.key)}\n onCheckedChange={(on) => onToggle(column.key, on === true)}\n >\n {column.title ?? (typeof column.header === \"string\" ? column.header : column.key)}\n </ContextMenuCheckboxItem>\n ))}\n </ContextMenuContent>\n </ContextMenu>\n );\n}\n\nfunction RowActions({\n tabbable,\n buttons,\n action,\n menu,\n}: {\n /** Only the table's Tab row keeps its actions in the Tab order (one stop per table, then its\n * row's actions); the arrows move to another row, whose actions Tab then reaches. */\n tabbable: boolean;\n buttons: ReadonlyArray<RowAction> | null;\n action: RowAction | null;\n menu: ReadonlyArray<RowMenuItem> | null;\n}) {\n const [asking, setAsking] = React.useState<RowMenuItem | null>(null);\n const tab = tabbable ? {} : { tabIndex: -1 };\n return (\n <span className=\"flex items-center justify-end gap-1\">\n {buttons?.map((b) =>\n b.icon ? (\n <IconButton key={b.label} size=\"sm\" label={b.label} icon={b.icon} disabled={b.disabled ?? false} onClick={b.onSelect} {...tab} />\n ) : (\n <Button key={b.label} size=\"sm\" disabled={b.disabled ?? false} onClick={b.onSelect} {...tab}>\n {b.label}\n </Button>\n ),\n )}\n {action ? (\n <Button size=\"sm\" disabled={action.disabled ?? false} onClick={action.onSelect} {...tab}>\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 />} {...tab} />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n <DropdownMenuEntries items={menu} onAsk={setAsking} />\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\n/**\n * The flex column's content: one line that ends in an ellipsis when it must (whatever the cell\n * drew: a string, a Text, a row of spans) and, only then, shows its whole text as the tooltip on\n * hover, as Finder's and Activity Monitor's expansion tooltips do. A child that truncates itself\n * (and already has a title) keeps its own.\n */\nfunction FitText({ children }: { children: React.ReactNode }) {\n const ref = React.useRef<HTMLDivElement>(null);\n const reveal = () => {\n const el = ref.current;\n if (!el) return;\n const cut = [el, ...Array.from(el.querySelectorAll<HTMLElement>(\"*\"))].some((n) => n.scrollWidth > n.clientWidth + 1 && !n.title);\n const text = el.textContent?.trim() ?? \"\";\n if (cut && text) el.title = text;\n else el.removeAttribute(\"title\");\n };\n return (\n <div ref={ref} data-slot=\"cell-text\" className=\"min-w-0 truncate\" onPointerEnter={reveal}>\n {children}\n </div>\n );\n}\n\nexport interface NameCellProps {\n /** The thing's name: it gets the room first, ends in an ellipsis when it must, and its tooltip\n * is the whole name. */\n name: string;\n /** A secondary line beside the name (a summary): it gives way first. */\n detail?: React.ReactNode;\n mono?: boolean;\n tone?: \"primary\" | \"tertiary\";\n}\n\n/** A table's name cell: name first (never cut mid-word while a summary still has room), then detail. */\nexport interface StateCellProps {\n [data: `data-${string}`]: string | undefined;\n /** The light's color: `success` live/open, `neutral` off/closed, `warning`/`danger` for health. */\n tone: \"success\" | \"neutral\" | \"warning\" | \"danger\";\n /** The state in one word beside the light (\"Open\", \"Closed\"). */\n state: string;\n /** A short fact after it, secondary (\"2 chats open\"). */\n detail?: string | undefined;\n /** The one action this state calls for (Closed → Open, Open → Restart…), a small button at the\n * cell's trailing edge; disabled with its reason as the tooltip when it cannot act. */\n action?: { label: string; onSelect: () => void; disabled?: boolean; title?: string } | null;\n}\n\n/**\n * A state column with its one action (Activity Monitor has none; Accounts' Window column): the\n * status light and its word, an optional secondary fact, then the action that state calls for. The\n * one sanctioned control in a cell besides RemovableTag: the action is part of the state it changes,\n * so it sits beside it rather than in the row's trailing buttons. The column is `kind: \"action\"`.\n */\nexport function StateCell({ tone, state, detail, action, ...data }: StateCellProps) {\n return (\n <span {...data} data-slot=\"state-cell\" className=\"flex min-w-0 items-center gap-1.5\">\n <StatusLight tone={tone} label={state} />\n <Text>{state}</Text>\n {detail ? (\n <Text tone=\"secondary\" truncate>\n {`· ${detail}`}\n </Text>\n ) : null}\n {action ? (\n <Button size=\"sm\" className=\"ml-auto shrink-0\" data-state-action={action.label} disabled={action.disabled === true} title={action.title} onClick={(e) => { e.stopPropagation(); action.onSelect(); }}>\n {action.label}\n </Button>\n ) : null}\n </span>\n );\n}\n\nexport function NameCell({ name, detail, mono, tone = \"primary\" }: NameCellProps) {\n return (\n <span data-slot=\"name-cell\" className=\"flex min-w-0 items-baseline gap-2\">\n <span\n title={name}\n className={cn(\n \"min-w-0 max-w-full shrink-0 truncate\",\n detail ? \"max-w-3/5\" : null,\n mono ? \"font-mono text-code\" : \"text-body\",\n tone === \"tertiary\" ? \"text-label-tertiary\" : \"text-label\",\n )}\n >\n {name}\n </span>\n {detail ? <span className=\"min-w-0 flex-1 truncate text-body text-label-secondary\">{detail}</span> : null}\n </span>\n );\n}\n","import * as React from \"react\";\n\nimport { XIcon } from \"../icons\";\nimport { cn } from \"./cn\";\n\nexport type TagTone = \"neutral\" | \"tint\" | \"success\" | \"warning\" | \"danger\";\n\nconst TONE: Record<TagTone, string> = {\n // A hairline capsule, no fill: a chip states a fact and must never look pressable (buttons\n // carry the control fill and shadow).\n neutral: \"text-label-secondary ring-1 ring-inset ring-separator\",\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. 12 pt medium (Apple's\n * callout, the smallest a label carrying words is drawn at), 20 px. In the light appearance the\n * colored tones' text is the system color deepened (desktop.css), so it reads on its tinted fill. */\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-5 shrink-0 cursor-default select-none items-center gap-1 whitespace-nowrap rounded-full px-2 text-callout font-medium [&_svg]:size-3\",\n TONE[tone],\n className,\n )}\n {...props}\n />\n );\n}\n\nexport interface RemovableTagProps extends Omit<TagProps, \"children\"> {\n children: React.ReactNode;\n /** Takes the thing out (a chat out of a project). */\n onRemove: () => void;\n /** The ×'s accessible name and tooltip, in words (\"Take out of Research\"). */\n removeLabel: string;\n disabled?: boolean;\n}\n\n/**\n * A chip with a one-click × (Mail's address tokens, Finder's tag tokens): the one control allowed\n * inside a DataTable cell. The × is its own button, so a press on it never selects the row.\n */\nexport function RemovableTag({ children, onRemove, removeLabel, disabled, className, ...props }: RemovableTagProps) {\n return (\n <Tag data-removable=\"\" className={cn(\"pr-0.5\", className)} {...props}>\n <span className=\"min-w-0 truncate\">{children}</span>\n <button\n type=\"button\"\n aria-label={removeLabel}\n title={removeLabel}\n disabled={disabled}\n data-slot=\"tag-remove\"\n onClick={(event) => {\n event.stopPropagation();\n onRemove();\n }}\n className=\"focus-ring inline-flex size-3.5 shrink-0 items-center justify-center rounded-full text-label-tertiary hover:bg-fill-secondary hover:text-label disabled:opacity-50\"\n >\n <XIcon aria-hidden />\n </button>\n </Tag>\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-subheadline text-label-secondary\", className)}\n {...props}\n />\n );\n}\n\n/**\n * Where one thing is, per place (a chat per window): `in` filled, `out` an empty ring, `hidden` a\n * tint ring (there, but that place does not show it), `open` green (in use there now). `marked`\n * adds a small dot inside (the place's own mark, e.g. its pin). 12 px; the label is the tooltip\n * and the accessible name, so a mark is never unexplained.\n */\nexport type PlaceMarkState = \"in\" | \"out\" | \"hidden\" | \"open\";\n\nconst PLACE: Record<PlaceMarkState, string> = {\n in: \"bg-tint\",\n out: \"border border-label-tertiary\",\n hidden: \"border-2 border-tint\",\n open: \"bg-system-green\",\n};\n\nconst PLACE_DOT: Record<PlaceMarkState, string> = {\n in: \"bg-window\",\n out: \"bg-label-secondary\",\n hidden: \"bg-tint\",\n open: \"bg-window\",\n};\n\nexport interface PlaceMarkProps extends Omit<React.HTMLAttributes<HTMLElement>, \"children\" | \"onSelect\"> {\n state: PlaceMarkState;\n /** The place's own mark on the thing (a pin): a dot inside the circle. */\n marked?: boolean;\n /** What the mark says (\"emily: listed, pinned\"); tooltip and accessible name. */\n label: string;\n /** Makes the mark a control (put it there / take it off): a button with the same look. */\n onSelect?: () => void;\n disabled?: boolean;\n}\n\nexport function PlaceMark({ state, marked = false, label, onSelect, disabled, className, ...props }: PlaceMarkProps) {\n const dot = marked ? <span className={cn(\"size-1.5 rounded-full\", PLACE_DOT[state])} /> : null;\n if (onSelect) {\n return (\n <button\n type=\"button\"\n aria-label={label}\n title={label}\n disabled={disabled}\n onClick={(event) => {\n event.stopPropagation();\n onSelect();\n }}\n data-slot=\"place-mark\"\n data-state={state}\n data-marked={marked ? \"true\" : undefined}\n className={cn(\n \"focus-ring inline-flex size-3 shrink-0 items-center justify-center rounded-full hover:opacity-70 disabled:opacity-50\",\n PLACE[state],\n className,\n )}\n {...props}\n >\n {dot}\n </button>\n );\n }\n return (\n <span\n role=\"img\"\n aria-label={label}\n title={label}\n data-slot=\"place-mark\"\n data-state={state}\n data-marked={marked ? \"true\" : undefined}\n className={cn(\"inline-flex size-3 shrink-0 items-center justify-center rounded-full\", PLACE[state], className)}\n {...props}\n >\n {dot}\n </span>\n );\n}\n\n/** A row of PlaceMarks in a fixed order (one per place), e.g. a chat's windows in a table cell. */\nexport function PlaceStrip({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) {\n return <span data-slot=\"place-strip\" className={cn(\"inline-flex items-center gap-1\", className)} {...props} />;\n}\n","import * as React from \"react\";\nimport { NoticeStackContext } from \"./layout\";\nimport { copyText } from \"@ai-matrx/kit/clipboard\";\n\nimport { XIcon } from \"../icons\";\nimport { Button, IconButton } from \"./button\";\nimport { describeError } from \"./errors\";\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` centers in the whole content area; `inline` sits inside a section or table; `row` is one\n * quiet centered line the height of a row, as Internet Accounts says \"No accounts\" in its group. */\n size?: \"page\" | \"inline\" | \"row\";\n}\n\n/** The standard empty glyph (an empty tray, as Mail and Finder draw \"nothing here\"). */\nconst EMPTY_ICON = (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={1.75} strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M22 12h-6l-2 3h-4l-2-3H2\" />\n <path d=\"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z\" />\n </svg>\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 if (size === \"row\") {\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(\"flex min-h-row items-center justify-center gap-2 px-3 py-2 text-center\", className)}\n {...props}\n >\n {kind === \"loading\" ? <Spinner size=\"sm\" /> : null}\n <Text tone={kind === \"error\" ? \"danger\" : \"secondary\"}>{title}</Text>\n {actions ? <div className=\"flex items-center gap-2\">{actions}</div> : null}\n </div>\n );\n }\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-8\",\n className,\n )}\n {...props}\n >\n {kind === \"loading\" ? (\n <Spinner size=\"lg\" />\n ) : icon || kind === \"empty\" ? (\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 ?? EMPTY_ICON}\n </span>\n ) : null}\n {/* Empty reads quietly (secondary), as an empty Mail mailbox does; a failure reads at full strength. */}\n <Text variant={size === \"page\" ? \"title-3\" : \"headline\"} tone={kind === \"error\" ? \"primary\" : \"secondary\"}>\n {title}\n </Text>\n {message ? (\n <Text as=\"p\" 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\n/** lucide glyphs, inlined (policy C19). One per tone, so every banner of a kind looks the same. */\nfunction Glyph({ d }: { d: ReadonlyArray<string> }) {\n return (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={1.75} strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n {d.map((path) => (\n <path key={path} d={path} />\n ))}\n </svg>\n );\n}\nconst ALERT = [\"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\", \"M12 9v4\", \"M12 17h.01\"];\nconst INFO = [\"M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20Z\", \"M12 16v-4\", \"M12 8h.01\"];\nconst DONE = [\"M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20Z\", \"m9 12 2 2 4-4\"];\nconst BANNER_ICON: Record<BannerTone, React.ReactNode> = {\n neutral: <Glyph d={INFO} />,\n info: <Glyph d={INFO} />,\n warning: <Glyph d={ALERT} />,\n danger: <Glyph d={ALERT} />,\n success: <Glyph d={DONE} />,\n};\n\nexport interface BannerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n tone: BannerTone;\n /** Override the tone's own icon (rarely: the tone's glyph is the standard). */\n icon?: React.ReactNode;\n title: React.ReactNode;\n message?: React.ReactNode;\n /** Trailing Buttons (size sm). */\n actions?: React.ReactNode;\n /** The raw text behind the message (an error's own words): offered as Copy details and shown\n * as the message's tooltip, never as the message. */\n detail?: string;\n /** Shows the close (×) button: for notices the person can put away. */\n onDismiss?: () => void;\n /** How many identical notices this card stands for (the stack collapses them, Notices). */\n count?: number;\n}\n\n/**\n * THE inline notice (one pattern, every screen): the tone's icon, a semantic tint, one fixed\n * minimum height, the title and one line, trailing actions, and × when it can be put away.\n */\nexport function Banner({ tone, icon, title, message, actions, detail, onDismiss, count, className, ...props }: BannerProps) {\n const [copied, setCopied] = React.useState(false);\n // In the notice stack it is the macOS notification card: translucent material, the tone only in\n // its icon (desktop.css [data-slot=\"banner\"][data-float]).\n const floating = React.useContext(NoticeStackContext);\n return (\n <div\n role={tone === \"danger\" || tone === \"warning\" ? \"alert\" : \"status\"}\n data-slot=\"banner\"\n data-tone={tone}\n data-float={floating ? \"\" : undefined}\n data-count={count && count > 1 ? count : undefined}\n className={cn(\"flex min-h-row items-center gap-2.5 rounded-group px-3 py-2\", floating ? \"items-start\" : BANNER_TONE[tone].box, className)}\n {...props}\n >\n <span className={cn(\"flex shrink-0 self-start pt-px [&_svg]:size-icon\", BANNER_TONE[tone].icon)}>{icon ?? BANNER_ICON[tone]}</span>\n {/* The text and the actions share one wrapping row: the text takes the width that is left (never\n squeezed under ~14 rem), and when the actions do not fit beside it they drop under it. */}\n <div data-slot=\"banner-body\" className=\"flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-2\">\n <div data-slot=\"banner-text\" className=\"flex min-w-0 flex-1 basis-56 flex-col gap-0.5\" title={detail || undefined}>\n <Text emphasized className={floating ? \"line-clamp-1\" : undefined}>\n {title}\n {count && count > 1 ? (\n <span data-slot=\"banner-count\" className=\"ml-1.5 font-normal text-label-secondary\">\n ×{count}\n </span>\n ) : null}\n </Text>\n {message ? (\n <Text as=\"p\" tone=\"secondary\" selectable className={floating ? \"line-clamp-2\" : undefined}>\n {message}\n </Text>\n ) : null}\n </div>\n {actions || detail ? (\n <div data-slot=\"banner-actions\" className=\"ml-auto flex shrink-0 items-center gap-2\">\n {detail ? (\n <Button\n size=\"sm\"\n variant=\"plain\"\n onClick={() => {\n void copyText(detail).then((copied) => copied && setCopied(true));\n }}\n >\n {copied ? \"Copied\" : \"Copy details\"}\n </Button>\n ) : null}\n {actions}\n </div>\n ) : null}\n </div>\n {onDismiss ? <IconButton size=\"sm\" label=\"Dismiss\" icon={<XIcon />} onClick={onDismiss} /> : null}\n </div>\n );\n}\n\nexport interface ErrorBannerProps extends Omit<BannerProps, \"tone\" | \"title\" | \"message\" | \"actions\" | \"detail\" | \"onDismiss\"> {\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 /** Trailing Buttons (a Try again). */\n actions?: React.ReactNode;\n}\n\n/** THE banner for a failed action: an actionable cause (describeError), Copy details, and ×. */\nexport function ErrorBanner({ error, onDismiss, title = \"That didn't work\", ...props }: ErrorBannerProps) {\n if (!error) return null;\n const said = describeError(error);\n return <Banner tone=\"danger\" title={title} message={said.cause} {...(said.detail ? { detail: said.detail } : {})} onDismiss={onDismiss} {...props} />;\n}\n","/**\n * THE error-wording layer. A failure is shown as a cause the person can act on (\"A program it\n * needs isn't installed\"), never as the raw text a process threw (\"spawn uv ENOENT\"). The raw text\n * is kept, whole, as `detail` — the banner offers it behind Copy details and a tooltip, for a bug\n * report or an agent. One table, so every screen and every service says the same thing.\n */\n\nexport interface DescribedError {\n /** One plain sentence: what went wrong and, where it helps, what to do. */\n cause: string;\n /** The raw text, unedited (empty when it would only repeat `cause`). */\n detail: string;\n /** A short machine code when one was recognized (\"ENOENT\", \"TIMEOUT\"). */\n code?: string;\n}\n\ninterface Rule {\n code: string;\n test: RegExp;\n cause: string;\n}\n\n/** Ordered: the first rule whose pattern matches the raw text wins. */\nconst RULES: ReadonlyArray<Rule> = [\n { code: \"ENOENT\", test: /\\b(spawn\\s+\\S+\\s+)?ENOENT\\b|command not found|no such file or directory/i, cause: \"A program or file it needs isn't on this computer. Install it or update Matrx, then try again.\" },\n { code: \"EACCES\", test: /\\bEACCES\\b|\\bEPERM\\b|permission denied|operation not permitted|not authori[sz]ed by the user/i, cause: \"Matrx isn't allowed to do that. Grant access in System Settings › Privacy & Security, then try again.\" },\n { code: \"EADDRINUSE\", test: /\\bEADDRINUSE\\b|address already in use|port .* (is )?(already )?in use/i, cause: \"Another program is already using that port. Stop it, or choose another port.\" },\n { code: \"ECONNREFUSED\", test: /\\bECONNREFUSED\\b|connection refused/i, cause: \"The service isn't answering. It may have stopped; start it again.\" },\n { code: \"OFFLINE\", test: /\\bENOTFOUND\\b|\\bEAI_AGAIN\\b|\\bENETUNREACH\\b|getaddrinfo|network (is )?unreachable|failed to fetch|offline/i, cause: \"Can't reach the internet. Check the connection and try again.\" },\n { code: \"TIMEOUT\", test: /\\bETIMEDOUT\\b|timed? ?out|\\bTIMEOUT\\b|deadline exceeded/i, cause: \"It took too long to answer. Try again in a moment.\" },\n { code: \"ENOSPC\", test: /\\bENOSPC\\b|no space left/i, cause: \"The disk is full. Free some space, then try again.\" },\n { code: \"ENOMEM\", test: /\\bENOMEM\\b|out of memory|cannot allocate memory/i, cause: \"The computer ran out of memory. Close something and try again.\" },\n { code: \"UNAUTHORIZED\", test: /\\b401\\b|unauthori[sz]ed|invalid (api )?key|not signed in|jwt expired|session expired/i, cause: \"You're signed out, or the key was refused. Sign in again.\" },\n { code: \"FORBIDDEN\", test: /\\b403\\b|forbidden/i, cause: \"This account isn't allowed to do that.\" },\n { code: \"NOT_FOUND\", test: /\\b404\\b|not found/i, cause: \"It isn't there any more. Refresh and try again.\" },\n { code: \"RATE_LIMIT\", test: /\\b429\\b|rate.?limit|too many requests/i, cause: \"Too many requests just now. Wait a moment and try again.\" },\n { code: \"SERVER\", test: /\\b5\\d\\d\\b|internal server error|bad gateway|service unavailable/i, cause: \"The server had a problem. Try again in a moment.\" },\n { code: \"EXITED\", test: /exited with code|process exited|crashed|SIGKILL|SIGSEGV|SIGTERM/i, cause: \"The service stopped unexpectedly. Start it again; Copy details if it keeps happening.\" },\n];\n\nconst RAW = /\\b[A-Z]{2,}[A-Z_]*\\b|[\\\\/][\\w.-]+[\\\\/]|\\bat \\S+ \\(|\\{|\\}|errno|stack|undefined|null|\\bspawn\\b/;\n\nfunction rawText(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 \"\";\n}\n\n/**\n * Turn any thrown or returned error into words a person can act on. Already-humane text (a full\n * sentence the app wrote itself, with no codes, paths or stack) passes through unchanged.\n */\nexport function describeError(error: unknown, fallback = \"Something went wrong. Try again.\"): DescribedError {\n const detail = rawText(error).trim();\n if (!detail) return { cause: fallback, detail: \"\" };\n for (const rule of RULES) {\n if (rule.test.test(detail)) return { cause: rule.cause, detail, code: rule.code };\n }\n if (!RAW.test(detail) && detail.length <= 160) return { cause: detail, detail: \"\" };\n return { cause: fallback, detail };\n}\n","import * as React from \"react\";\n\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from \"../dropdown-menu\";\nimport { ListFilterIcon } from \"../icons\";\nimport { Button, IconButton } from \"./button\";\nimport { cn } from \"./cn\";\nimport { SearchField } from \"./field\";\nimport { RemovableTag } from \"./tag\";\nimport { Text } from \"./text\";\n\n/**\n * How a column filters (Mail's and Finder's filter menus, Numbers' column filter):\n * - `values`: the column holds one of a set of values (Status, App, Plan). The filter menu lists\n * every value with how many rows have it; the person ticks the ones to keep. `value` reads the\n * row's value(s) — a string, or several (a row tagged twice counts under both); without it the\n * row's own field named by the column's `key` is read. A date column filters the same way with a\n * `value` that returns its bucket (\"Today\", \"This week\", \"Older\").\n */\nexport interface ColumnValuesFilter<T> {\n kind: \"values\";\n value?: (row: T) => string | ReadonlyArray<string> | null | undefined;\n /** The words the menu and the token show for a value (default: the value itself). */\n label?: (value: string) => string;\n /** The values' order in the menu; values not named follow, most rows first. */\n order?: ReadonlyArray<string>;\n}\n\nexport type ColumnFilter<T> = ColumnValuesFilter<T>;\n\n/** The table's search and filters: what the person typed and, per column, the values kept. */\nexport interface TableFilterState {\n query: string;\n /** Column key → the values kept (a row passes when it has ANY of them; columns AND together). */\n values: Readonly<Record<string, ReadonlyArray<string>>>;\n}\n\nexport const EMPTY_TABLE_FILTER: TableFilterState = { query: \"\", values: {} };\n\n/** The parts of a column the filter reads (Column<T> carries them). */\nexport interface FilterableColumn<T> {\n key: string;\n header: React.ReactNode;\n title?: string;\n filter?: ColumnFilter<T>;\n /** The column joins the table's search: `true` reads the row's field named by `key`; a function\n * returns the words to match. */\n search?: boolean | ((row: T) => string | null | undefined);\n}\n\nfunction field<T>(row: T, key: string): unknown {\n return row !== null && typeof row === \"object\" ? (row as Record<string, unknown>)[key] : undefined;\n}\n\nfunction asText(v: unknown): string {\n if (v === null || v === undefined) return \"\";\n if (typeof v === \"string\") return v;\n if (typeof v === \"number\" || typeof v === \"boolean\") return String(v);\n return \"\";\n}\n\n/** The column's display name (its `title`, a plain-text header, else its key). */\nexport function columnName(column: Pick<FilterableColumn<never>, \"key\" | \"header\" | \"title\">): string {\n return column.title ?? (typeof column.header === \"string\" ? column.header : column.key);\n}\n\n/** The value(s) a row has in a values-filtered column. */\nexport function filterValues<T>(column: FilterableColumn<T>, row: T): string[] {\n const f = column.filter;\n if (!f) return [];\n const raw = f.value ? f.value(row) : asText(field(row, column.key));\n if (raw === null || raw === undefined) return [];\n return (typeof raw === \"string\" ? [raw] : [...raw]).filter((v) => v !== \"\");\n}\n\nfunction searchText<T>(column: FilterableColumn<T>, row: T): string {\n if (!column.search) return \"\";\n return (column.search === true ? asText(field(row, column.key)) : (column.search(row) ?? \"\")).toLowerCase();\n}\n\n/** True when the table has a search or any filterable column (it then draws its filter bar). */\nexport function tableFilters(columns: ReadonlyArray<FilterableColumn<never>>): boolean {\n return columns.some((c) => c.search || c.filter);\n}\n\nfunction passesQuery<T>(columns: ReadonlyArray<FilterableColumn<T>>, row: T, words: ReadonlyArray<string>): boolean {\n if (words.length === 0) return true;\n const texts = columns.filter((c) => c.search).map((c) => searchText(c, row));\n // Every word must be found, each in any searched column (Finder, Mail).\n return words.every((w) => texts.some((t) => t.includes(w)));\n}\n\nfunction passesValues<T>(columns: ReadonlyArray<FilterableColumn<T>>, row: T, state: TableFilterState, skip?: string): boolean {\n for (const column of columns) {\n if (!column.filter || column.key === skip) continue;\n const kept = state.values[column.key];\n if (!kept || kept.length === 0) continue;\n const has = filterValues(column, row);\n if (!has.some((v) => kept.includes(v))) return false;\n }\n return true;\n}\n\nfunction queryWords(query: string): string[] {\n return query.trim().toLowerCase().split(/\\s+/).filter(Boolean);\n}\n\n/** The rows that pass the search and every column's kept values (the page can filter the same way). */\nexport function filterRows<T>(columns: ReadonlyArray<FilterableColumn<T>>, rows: ReadonlyArray<T>, state: TableFilterState): T[] {\n const words = queryWords(state.query);\n return rows.filter((row) => passesQuery(columns, row, words) && passesValues(columns, row, state));\n}\n\nexport interface FilterChoice {\n value: string;\n label: string;\n /** Rows with this value among those the OTHER filters and the search keep (Finder's counts). */\n count: number;\n}\n\n/** A values column's choices, each with its count under every other filter and the search. */\nexport function filterChoices<T>(column: FilterableColumn<T>, rows: ReadonlyArray<T>, columns: ReadonlyArray<FilterableColumn<T>>, state: TableFilterState): FilterChoice[] {\n const f = column.filter;\n if (!f) return [];\n const words = queryWords(state.query);\n const counts = new Map<string, number>();\n // Every value any row has is listed (a value filtered to 0 still shows, so ticking is reversible).\n for (const row of rows) for (const v of filterValues(column, row)) if (!counts.has(v)) counts.set(v, 0);\n for (const row of rows) {\n if (!passesQuery(columns, row, words) || !passesValues(columns, row, state, column.key)) continue;\n for (const v of new Set(filterValues(column, row))) counts.set(v, (counts.get(v) ?? 0) + 1);\n }\n for (const v of state.values[column.key] ?? []) if (!counts.has(v)) counts.set(v, 0);\n const order = f.order ?? [];\n const keys = [...counts.keys()].sort((a, b) => {\n const ia = order.indexOf(a);\n const ib = order.indexOf(b);\n if (ia !== -1 || ib !== -1) return (ia === -1 ? Infinity : ia) - (ib === -1 ? Infinity : ib);\n return (counts.get(b) ?? 0) - (counts.get(a) ?? 0) || a.localeCompare(b);\n });\n return keys.map((value) => ({ value, label: f.label ? f.label(value) : value, count: counts.get(value) ?? 0 }));\n}\n\n/** True when the person searched or kept any value. */\nexport function filterActive(state: TableFilterState): boolean {\n return state.query.trim() !== \"\" || Object.values(state.values).some((v) => v.length > 0);\n}\n\nfunction setValues(state: TableFilterState, key: string, next: ReadonlyArray<string>): TableFilterState {\n const values = { ...state.values };\n if (next.length === 0) delete values[key];\n else values[key] = next;\n return { ...state, values };\n}\n\nexport interface TableFilterMenuProps<T> {\n columns: ReadonlyArray<FilterableColumn<T>>;\n rows: ReadonlyArray<T>;\n state: TableFilterState;\n onChange: (next: TableFilterState) => void;\n}\n\n/**\n * Mail's filter button: one menu, each filterable column a submenu of its values with their\n * counts, ticked to keep; \"Clear Filters\" at its foot. Lit while any filter is on.\n */\nexport function TableFilterMenu<T>({ columns, rows, state, onChange }: TableFilterMenuProps<T>) {\n const filterable = columns.filter((c) => c.filter);\n if (filterable.length === 0) return null;\n const on = filterable.filter((c) => (state.values[c.key]?.length ?? 0) > 0).length;\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <IconButton size=\"sm\" data-table-filter-menu data-filters-on={on} active={on > 0} label={on ? `Filter (${on} on)` : \"Filter\"} icon={<ListFilterIcon />} />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {filterable.length === 1 ? <DropdownMenuLabel>{`Filter by ${columnName(filterable[0] as FilterableColumn<never>)}`}</DropdownMenuLabel> : null}\n {filterable.map((column) => {\n const items = <FilterItems column={column} rows={rows} columns={columns} state={state} onChange={onChange} />;\n if (filterable.length === 1) return <React.Fragment key={column.key}>{items}</React.Fragment>;\n const kept = state.values[column.key]?.length ?? 0;\n return (\n <DropdownMenuSub key={column.key}>\n <DropdownMenuSubTrigger data-table-filter-column={column.key}>\n <span className=\"flex-1\">{columnName(column as FilterableColumn<never>)}</span>\n {kept ? <span className=\"ml-4 text-label-secondary tabular-nums\">{kept}</span> : null}\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent className=\"max-h-80 overflow-y-auto\">{items}</DropdownMenuSubContent>\n </DropdownMenuSub>\n );\n })}\n <DropdownMenuSeparator />\n <DropdownMenuItem data-table-filter-clear disabled={on === 0} onSelect={() => onChange({ ...state, values: {} })}>\n Clear Filters\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\nfunction FilterItems<T>({ column, rows, columns, state, onChange }: { column: FilterableColumn<T>; rows: ReadonlyArray<T>; columns: ReadonlyArray<FilterableColumn<T>>; state: TableFilterState; onChange: (next: TableFilterState) => void }) {\n const kept = state.values[column.key] ?? [];\n return (\n <>\n {filterChoices(column, rows, columns, state).map((choice) => (\n <DropdownMenuCheckboxItem\n key={choice.value}\n data-table-filter-value={choice.value}\n data-count={choice.count}\n checked={kept.includes(choice.value)}\n // The menu stays open so several values can be ticked (Finder's filter menus).\n onSelect={(event) => event.preventDefault()}\n onCheckedChange={(on) => onChange(setValues(state, column.key, on === true ? [...kept, choice.value] : kept.filter((v) => v !== choice.value)))}\n >\n <span className=\"flex-1 truncate\">{choice.label}</span>\n <span className=\"ml-6 text-label-secondary tabular-nums\">{choice.count}</span>\n </DropdownMenuCheckboxItem>\n ))}\n </>\n );\n}\n\n/** The tokens of the filters now on (Mail's filter tokens): one per column, its values, a ✕ removes it. */\nexport function TableFilterTokens<T>({ columns, state, onChange }: Omit<TableFilterMenuProps<T>, \"rows\">) {\n const on = columns.filter((c) => c.filter && (state.values[c.key]?.length ?? 0) > 0);\n return (\n <>\n {on.map((column) => {\n const name = columnName(column as FilterableColumn<never>);\n const labels = (state.values[column.key] ?? []).map((v) => (column.filter?.label ? column.filter.label(v) : v));\n return (\n <RemovableTag key={column.key} data-table-filter-token={column.key} className=\"shrink-0\" removeLabel={`Remove the ${name} filter`} onRemove={() => onChange(setValues(state, column.key, []))}>\n {`${name}: ${labels.join(\", \")}`}\n </RemovableTag>\n );\n })}\n </>\n );\n}\n\nexport interface TableFilterBarProps<T> extends TableFilterMenuProps<T> {\n /** Rows shown after filtering. */\n shown: number;\n /** What the rows are, for the search field's name (\"Search processes\"). */\n label: string;\n}\n\n/**\n * The table's own filter bar (Finder's search bar, Mail's filter tokens), drawn above its header\n * at one fixed height whether or not a filter is on, so the rows never move when one changes: the\n * active filters' tokens (or the row count) lead; the search field and the filter button trail.\n */\nexport function TableFilterBar<T>({ columns, rows, state, onChange, shown, label }: TableFilterBarProps<T>) {\n const searchable = columns.some((c) => c.search);\n const active = filterActive(state);\n return (\n <div data-slot=\"data-table-filter-bar\" className=\"flex h-table-filter-bar shrink-0 items-center gap-2 border-b border-separator px-3\">\n <div className=\"flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden\">\n <TableFilterTokens columns={columns} state={state} onChange={onChange} />\n <Text tone=\"secondary\" className=\"shrink-0 tabular-nums\" data-table-filter-count={shown}>\n {active ? `${shown} of ${rows.length}` : `${rows.length}`}\n </Text>\n </div>\n {searchable ? (\n <SearchField\n size=\"sm\"\n className=\"w-48 shrink\"\n data-table-search\n aria-label={`Search ${label}`}\n value={state.query}\n onValueChange={(query) => onChange({ ...state, query })}\n />\n ) : null}\n <TableFilterMenu columns={columns} rows={rows} state={state} onChange={onChange} />\n </div>\n );\n}\n\n/** The \"No Results\" body when the filters keep no row: what hid them, and the way back. */\nexport function noResultsMessage(state: TableFilterState): string {\n const q = state.query.trim();\n return q ? `No rows match “${q}”${Object.keys(state.values).length ? \" with these filters\" : \"\"}.` : \"No rows match these filters.\";\n}\n\nexport function ClearFiltersButton({ onClear, className }: { onClear: () => void; className?: string }) {\n return (\n <Button size=\"sm\" data-table-filter-reset className={cn(className)} onClick={onClear}>\n Clear Search and Filters\n </Button>\n );\n}\n","import * as React from \"react\";\n\nimport { ChevronRightIcon } from \"../icons\";\nimport { useScrollFade } from \"../use-scroll-fade\";\nimport { cn } from \"./cn\";\nimport { Text } from \"./text\";\n\n/**\n * The source list (Finder / Mail / Notes sidebar, macOS 26). Sections of 32 pt rows; the open row is\n * a soft translucent gray capsule with its icon and label in the accent while the window is key, the\n * same gray with the plain label when it is not (`[data-window-active=false]` on any ancestor;\n * desktop.css). Up/Down arrow keys move between rows; Home/End jump to the ends.\n */\nexport interface SourceListProps extends React.HTMLAttributes<HTMLElement> {\n /** The app's own accent for the open row, where it has one (Notes' yellow, Reminders' list\n * color); default the person's accent. */\n tint?: \"red\" | \"orange\" | \"yellow\" | \"green\" | \"blue\" | \"purple\";\n /** How the open row is drawn: `sidebar` (default), the window sidebar's gray capsule with the\n * accent label (Finder, Mail); `emphasized`, the solid accent with a white label while the window\n * is key, as a list inside the content selects (Console's Devices, System Information's\n * categories). */\n selection?: \"sidebar\" | \"emphasized\";\n}\n\n/**\n * Sections follow one another with no gap (Finder: a header row is the only space between groups).\n * A list taller than its column scrolls under a soft edge (macOS 26's scroll edge effect) with the\n * overlay scroller hidden, never a permanent scroll bar or a hard-cut row.\n */\nexport function SourceList({ className, onKeyDown, tint, selection = \"sidebar\", ...props }: SourceListProps) {\n const fade = useScrollFade();\n return (\n <nav\n ref={fade.ref}\n data-slot=\"source-list\"\n data-tint={tint}\n data-selection={selection === \"emphasized\" ? \"emphasized\" : undefined}\n data-fade-top={fade.fadeProps[\"data-fade-top\"]}\n data-fade-bottom={fade.fadeProps[\"data-fade-bottom\"]}\n className={cn(\"flex min-h-0 flex-col 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 // Finder's section header (NSOutlineView .sourceList): 11 pt semibold, secondary, sitting\n // on the rows below it.\n <div data-slot=\"source-list-header\" className=\"flex h-sidebar-row items-end gap-2 px-2 pb-1\">\n <Text id={id} variant=\"subheadline\" tone=\"secondary\" 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 /** Not built yet: full-strength label, no hint, a trailing \"Soon\" at full strength (it opens its Coming soon\n * page). Never dimmed: dimmed means disabled, and this row is clickable. */\n soon?: boolean;\n /** An outline row (System Information's \"Hardware\" over its categories): its depth, each level\n * indented one step. */\n level?: number;\n /** This row has rows under it: the disclosure triangle shows whether they are shown; clicking the\n * triangle, or Right and Left on the row, opens and closes them. */\n disclosure?: { open: boolean; onToggle: (open: boolean) => void };\n}\n\nexport const SourceListItem = React.forwardRef<HTMLButtonElement, SourceListItemProps>(function SourceListItem(\n { icon, label, hint, badge, current, soon, level = 0, disclosure, className, onKeyDown, style, type = \"button\", ...props },\n ref,\n) {\n const outline = level > 0 || disclosure !== undefined;\n // The open row is always in view, as Finder, Mail and System Settings keep their selection: a\n // row that becomes current (a link, ⌘1–9, the back button, the first paint of a late row) scrolls\n // its list only as far as it needs to show it (\"nearest\"), never jumping a row already in view.\n const own = React.useRef<HTMLButtonElement | null>(null);\n const setRef = React.useCallback(\n (node: HTMLButtonElement | null) => {\n own.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n },\n [ref],\n );\n React.useEffect(() => {\n if (current) own.current?.scrollIntoView?.({ block: \"nearest\", inline: \"nearest\" });\n }, [current]);\n return (\n <button\n ref={setRef}\n type={type}\n data-slot=\"source-list-item\"\n data-current={current || undefined}\n data-soon={soon || undefined}\n data-two-line={hint && !soon ? \"\" : undefined}\n data-level={outline ? level : undefined}\n aria-current={current ? \"page\" : undefined}\n aria-expanded={disclosure ? disclosure.open : undefined}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || !disclosure) return;\n if (event.key === \"ArrowRight\" && !disclosure.open) {\n event.preventDefault();\n disclosure.onToggle(true);\n } else if (event.key === \"ArrowLeft\" && disclosure.open) {\n event.preventDefault();\n disclosure.onToggle(false);\n }\n }}\n // Each outline level is one 16 pt step in (the triangle's width), as NSOutlineView indents.\n style={outline ? { paddingInlineStart: 4 + level * 16, ...style } : style}\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 // One row height per list: desktop.css lifts every row of a list holding a two-line row\n // to the two-line height, so no list mixes heights.\n hint && !soon ? \"h-sidebar-row-tall\" : \"h-sidebar-row\",\n // The gray capsule (desktop.css draws it, with the accent label in the key window).\n current && \"bg-selection-muted hover:bg-selection-muted\",\n className,\n )}\n {...props}\n >\n {outline ? (\n <span\n aria-hidden\n data-slot=\"source-list-disclosure\"\n data-open={disclosure ? disclosure.open : undefined}\n className=\"flex size-icon shrink-0 items-center justify-center text-label-secondary\"\n onClick={\n disclosure\n ? (event) => {\n event.stopPropagation();\n disclosure.onToggle(!disclosure.open);\n }\n : undefined\n }\n >\n {disclosure ? <ChevronRightIcon className={cn(\"size-icon-sm transition-transform duration-100\", disclosure.open && \"rotate-90\")} /> : null}\n </span>\n ) : null}\n {icon ? (\n <span data-slot=\"source-list-icon\" 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 && !soon ? <span className=\"truncate text-body text-label-secondary\">{hint}</span> : null}\n </span>\n {badge ? (\n // Room for three digits, right-aligned: a count gaining a digit grows leftward inside a box that stays put.\n <span data-slot=\"source-list-badge\" className=\"flex min-w-count shrink-0 items-center justify-end text-body tabular-nums text-label-secondary\">\n {badge}\n </span>\n ) : soon ? (\n // Unbuilt is not disabled: the row reads at full strength (it opens its Coming soon page)\n // and says \"Soon\" at the end, at full strength too, at the row's own 13 pt (content is never\n // under 13 pt). Only a disabled row is dimmed.\n <span aria-hidden data-slot=\"source-list-soon\" className=\"shrink-0 text-body text-label\">\n Soon\n </span>\n ) : 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-body text-tint hover:text-label\", className)}\n >\n {expanded ? \"Show less\" : \"Show more\"}\n </button>\n );\n}\n","import * as React from \"react\";\n\nimport { ContextMenu, ContextMenuContent, ContextMenuTrigger } from \"../context-menu\";\nimport { cn } from \"./cn\";\nimport { ConfirmDialog } from \"./sheet\";\nimport { ContextMenuEntries, type RowMenuItem } from \"./menu-entries\";\n\n/**\n * The message list (Mail's message list, Messages' conversation list, Voice Memos' recordings,\n * Notes' note list): a column of two- or three-line rows — a bold title with the date trailing on\n * the first line, a second line, an optional secondary third — separated by inset hairlines, with\n * Mail's leading slot (the unread dot, an avatar, a Reminders circle). `appearance=\"messages\"` is\n * Messages' macOS 26 conversation list: 40 pt avatars, no lines, a softer rounded highlight.\n *\n * Selection is AppKit's: a click selects one row, ⌘-click adds or removes one, ⇧-click selects a\n * range, Up/Down move it. The selected rows wear the accent with white text while the list has\n * focus in the key window, the unemphasised gray otherwise — a rounded inset highlight, as Mail and\n * Notes draw it. A row's actions live in its context menu (right-click) and in the window's\n * toolbar for the selection, never as buttons inside the row.\n */\nexport interface MessageListProps<T> extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\" | \"aria-label\" | \"title\"> {\n \"aria-label\": string;\n rows: ReadonlyArray<T>;\n rowKey: (row: T) => string;\n /** Line one, bold (the sender, the chat, the recording). */\n title: (row: T) => React.ReactNode;\n /** Trailing on line one, secondary (a date, a time, a countdown). */\n date?: (row: T) => React.ReactNode;\n /** Line two (the subject; a project and app). */\n subtitle?: (row: T) => React.ReactNode;\n /** Line three, secondary (a preview, a path). */\n detail?: (row: T) => React.ReactNode;\n /** The leading slot: Mail's unread dot, Messages' avatar, a Reminders circle. Its width is kept on\n * every row whether or not a row draws one, so titles line up. */\n leading?: (row: T) => React.ReactNode;\n /** The leading slot's width: `dot` (16 pt, Mail's unread dot), `icon` (32 pt: Passwords' site\n * icons, Shortcuts' list view tiles) or `avatar` (40 pt: Messages' conversation avatars, an\n * `Avatar size=\"md\"`). */\n leadingSize?: \"dot\" | \"icon\" | \"avatar\";\n /** `mail` (the default): Mail's rows, inset hairlines between them and the 7 pt control-radius\n * highlight. `messages`: Messages' conversation list on macOS 26, no lines between rows, a\n * softer 12 pt-radius highlight and the second line in the secondary color (the preview). */\n appearance?: \"mail\" | \"messages\";\n /** Trailing glyphs on line two (a star, a flag, a count). */\n accessories?: (row: T) => React.ReactNode;\n /** The selected row keys. */\n selected: ReadonlySet<string>;\n /** The new selection; `focus` is the row the person acted on last (the one a viewer shows). */\n onSelectionChange: (next: Set<string>, focus: string | null) => void;\n /** One row only (Messages, Voice Memos): ⌘-click and ⇧-click select just that row. */\n single?: boolean;\n /** Double-click or Return on a row (Mail opens the message in its own window). */\n onOpen?: (row: T) => void;\n /** Right-click menu for a row (destructive items with `confirm` ask first). */\n rowMenu?: (row: T) => ReadonlyArray<RowMenuItem> | null;\n /** `data-*` hooks on each row (tests, deep links). */\n rowData?: (row: T) => Record<string, string | undefined>;\n /** Shown instead of rows when there are none. */\n empty?: React.ReactNode;\n /** Under the last row (a loading row while the next page comes in). */\n footer?: React.ReactNode;\n /** The list scrolled to its end: load the next page (Mail's and Messages' endless list; the web's\n * conversation list loads the same way). Pass it only while there IS more; rows are never dropped.\n * Fired when the end comes into view, and again after each page while the end is still in view. */\n onEndReached?: (() => void) | undefined;\n /** The window's first responder when the list first shows rows (AppKit's initialFirstResponder:\n * Passwords' and Mail's list has the keyboard when the window opens), so its selection wears the\n * accent. Never taken from a field being typed in. */\n initialFocus?: boolean;\n}\n\nconst ROW_SELECTOR = '[data-slot=\"message-list-row\"]';\n/** Controls that take typing: the list never takes the keyboard from one. */\nconst TEXT_ENTRY = 'input:not([type=\"button\"]):not([type=\"checkbox\"]):not([type=\"radio\"]), textarea, select, [contenteditable=\"true\"], [role=\"textbox\"], [role=\"combobox\"]';\n\nexport function MessageList<T>({\n rows,\n rowKey,\n title,\n date,\n subtitle,\n detail,\n leading,\n leadingSize = \"dot\",\n appearance = \"mail\",\n accessories,\n selected,\n onSelectionChange,\n single,\n onOpen,\n rowMenu,\n rowData,\n empty,\n footer,\n onEndReached,\n initialFocus,\n className,\n onKeyDown,\n onContextMenu,\n onPointerDown,\n ...props\n}: MessageListProps<T>) {\n const anchor = React.useRef<string | null>(null);\n const listRef = React.useRef<HTMLDivElement | null>(null);\n const focusedOnce = React.useRef(false);\n // Radix asks whether it may open synchronously. Keep the target in a ref so a first right-click\n // and a touch long-press both have their row before React has rendered the menu items.\n const menuRowRef = React.useRef<T | null>(null);\n const [menuRow, setMenuRow] = React.useState<T | null>(null);\n const [menuOpen, setMenuOpen] = React.useState(false);\n const [asking, setAsking] = React.useState<RowMenuItem | null>(null);\n const keys = React.useMemo(() => rows.map(rowKey), [rows, rowKey]);\n\n const select = (key: string, event: { metaKey: boolean; ctrlKey: boolean; shiftKey: boolean }) => {\n if (!single && (event.metaKey || event.ctrlKey)) {\n const next = new Set(selected);\n if (next.has(key)) next.delete(key);\n else next.add(key);\n anchor.current = key;\n onSelectionChange(next, next.has(key) ? key : null);\n return;\n }\n if (!single && event.shiftKey && anchor.current && keys.includes(anchor.current)) {\n const a = keys.indexOf(anchor.current);\n const b = keys.indexOf(key);\n onSelectionChange(new Set(keys.slice(Math.min(a, b), Math.max(a, b) + 1)), key);\n return;\n }\n anchor.current = key;\n onSelectionChange(new Set([key]), key);\n };\n\n const focusRow = (list: HTMLElement, key: string) => {\n const el = Array.from(list.querySelectorAll<HTMLElement>(ROW_SELECTOR)).find((r) => r.dataset[\"rowKey\"] === key);\n el?.focus();\n el?.scrollIntoView?.({ block: \"nearest\" });\n };\n\n // The first responder once, when there is a row to hold it: the selected row, else the first.\n React.useEffect(() => {\n if (!initialFocus || focusedOnce.current || keys.length === 0 || !listRef.current) return;\n focusedOnce.current = true;\n // A field being typed in keeps the keyboard; anything else (the row or rail button that\n // opened this page, a container) hands it to the list, as AppKit's window does on open.\n const active = document.activeElement;\n if (active instanceof HTMLElement && active.matches(TEXT_ENTRY)) return;\n const key = keys.find((k) => selected.has(k)) ?? (keys[0] as string);\n Array.from(listRef.current.querySelectorAll<HTMLElement>(ROW_SELECTOR))\n .find((r) => r.dataset[\"rowKey\"] === key)\n ?.focus({ preventScroll: true });\n }, [initialFocus, keys, selected]);\n\n const menu = menuRow ? (rowMenu?.(menuRow) ?? null) : null;\n const hasMenu = Boolean(menu?.length);\n const setMenuTarget = (row: T, key: string) => {\n menuRowRef.current = row;\n setMenuRow(row);\n // Right-clicking or long-pressing an unselected row selects it first (Mail, Finder).\n if (!selected.has(key)) select(key, { metaKey: false, ctrlKey: false, shiftKey: false });\n };\n const clearMenuTarget = () => {\n menuRowRef.current = null;\n setMenuRow(null);\n setMenuOpen(false);\n };\n const isRowTarget = (target: EventTarget | null) => target instanceof Element && target.closest(ROW_SELECTOR) !== null;\n const onMenuOpenChange = (open: boolean) => {\n const target = menuRowRef.current;\n const targetMenu = target ? (rowMenu?.(target) ?? null) : null;\n if (open && targetMenu?.length) {\n setMenuRow(target);\n setMenuOpen(true);\n return;\n }\n clearMenuTarget();\n };\n\n const list = (\n <div\n ref={listRef}\n role=\"listbox\"\n aria-multiselectable={!single || undefined}\n data-slot=\"message-list\"\n data-appearance={appearance}\n className={cn(\"flex flex-col px-2 py-1 outline-none\", className)}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || keys.length === 0) return;\n const current = (document.activeElement as HTMLElement | null)?.dataset?.[\"rowKey\"] ?? [...selected].pop() ?? null;\n const at = current ? keys.indexOf(current) : -1;\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\" || event.key === \"Home\" || event.key === \"End\") {\n event.preventDefault();\n const next =\n event.key === \"Home\" ? 0 : event.key === \"End\" ? keys.length - 1 : Math.max(0, Math.min(keys.length - 1, at + (event.key === \"ArrowDown\" ? 1 : -1)));\n const key = keys[next] as string;\n select(key, { metaKey: false, ctrlKey: false, shiftKey: event.shiftKey });\n focusRow(event.currentTarget, key);\n } else if (event.key === \"Enter\" && onOpen && at >= 0) {\n event.preventDefault();\n onOpen(rows[at] as T);\n }\n }}\n onContextMenu={(event) => {\n onContextMenu?.(event);\n // A keyboard context-menu key can target the list itself. Never reuse a previous row then.\n if (!isRowTarget(event.target)) clearMenuTarget();\n }}\n onPointerDown={(event) => {\n onPointerDown?.(event);\n if (!isRowTarget(event.target)) clearMenuTarget();\n }}\n {...props}\n >\n {rows.length === 0 ? (\n <div data-slot=\"message-list-empty\">{empty}</div>\n ) : (\n rows.map((row, i) => {\n const key = keys[i] as string;\n const isSelected = selected.has(key);\n const nextSelected = i + 1 < keys.length && selected.has(keys[i + 1] as string);\n const prevSelected = i > 0 && selected.has(keys[i - 1] as string);\n const lead = leading?.(row);\n const when = date?.(row);\n const line2 = subtitle?.(row);\n const line3 = detail?.(row);\n const glyphs = accessories?.(row);\n return (\n <div\n key={key}\n role=\"option\"\n aria-selected={isSelected}\n tabIndex={isSelected || (selected.size === 0 && i === 0) ? 0 : -1}\n data-slot=\"message-list-row\"\n data-row-key={key}\n data-selected={isSelected || undefined}\n {...(rowData?.(row) ?? {})}\n onMouseDown={(event) => {\n // ⇧-click must not select text across rows.\n if (event.shiftKey) event.preventDefault();\n }}\n onPointerDown={(event) => {\n // Radix opens a touch/pen menu from its long-press timer, before a contextmenu event.\n // It also reaches here before its trigger for a mouse's secondary button.\n if (event.pointerType === \"touch\" || event.pointerType === \"pen\" || event.button === 2) setMenuTarget(row, key);\n }}\n onClick={(event) => select(key, event)}\n onDoubleClick={() => onOpen?.(row)}\n onContextMenu={() => {\n setMenuTarget(row, key);\n }}\n className={cn(\n \"group/message focus-ring relative flex cursor-default gap-1.5 py-2 pl-1 pr-3 text-body text-label\",\n appearance === \"messages\" ? \"rounded-group\" : \"rounded-control\",\n leadingSize !== \"dot\" && \"gap-2.5 pl-2\",\n // The highlight: the unemphasised gray; the accent while the list has focus in the key window.\n isSelected && \"bg-selection-muted\",\n // Adjacent selected rows are one continuous highlight (Mail): square where they meet.\n isSelected && prevSelected && \"rounded-t-none\",\n isSelected && nextSelected && \"rounded-b-none\",\n isSelected &&\n \"[[data-window-active=true]_[data-slot=message-list]:focus-within_&]:bg-selection [[data-window-active=true]_[data-slot=message-list]:focus-within_&]:text-selection-label [:root_[data-slot=message-list]:not([data-window-active]_*):focus-within_&]:bg-selection [:root_[data-slot=message-list]:not([data-window-active]_*):focus-within_&]:text-selection-label\",\n // Everything in a highlighted row reads in the selection's label color (a tone, a secondary line).\n isSelected &&\n \"[[data-window-active=true]_[data-slot=message-list]:focus-within_&]:**:text-inherit [:root_[data-slot=message-list]:not([data-window-active]_*):focus-within_&]:**:text-inherit\",\n )}\n >\n {/* The leading slot keeps its width on every row (Mail's unread-dot gutter). */}\n <span data-slot=\"message-list-leading\" className={cn(\"flex shrink-0 justify-center\", leadingSize === \"avatar\" ? \"w-10 self-center\" : leadingSize === \"icon\" ? \"w-8 self-center\" : \"w-4 pt-1\")}>\n {lead}\n </span>\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"flex min-w-0 items-baseline gap-2\">\n <span data-slot=\"message-list-title\" className=\"min-w-0 flex-1 truncate text-headline\">\n {title(row)}\n </span>\n {when !== undefined && when !== null ? (\n <span data-slot=\"message-list-date\" className={cn(\"shrink-0 tabular-nums\", isSelected ? \"text-inherit opacity-80\" : \"text-label-secondary\")}>\n {when}\n </span>\n ) : null}\n </span>\n {line2 !== undefined && line2 !== null ? (\n <span className=\"flex min-w-0 items-center gap-2\">\n <span data-slot=\"message-list-subtitle\" className={cn(\"flex min-w-0 flex-1 items-center gap-1.5 truncate\", appearance === \"messages\" && !isSelected && \"text-label-secondary\")}>\n {/* A flex box does not draw an ellipsis for its own text (the text is an\n anonymous flex item): plain words get their own truncating span, so a long\n line ends in \"…\" instead of being cut mid-letter at the column's edge. */}\n {typeof line2 === \"string\" || typeof line2 === \"number\" ? <span className=\"min-w-0 truncate\">{line2}</span> : line2}\n </span>\n {glyphs ? <span className=\"flex shrink-0 items-center gap-1 text-label-secondary [&_svg]:size-icon-sm\">{glyphs}</span> : null}\n </span>\n ) : null}\n {line3 !== undefined && line3 !== null ? (\n <span data-slot=\"message-list-detail\" className={cn(\"line-clamp-2 min-w-0\", isSelected ? \"opacity-80\" : \"text-label-secondary\")}>\n {line3}\n </span>\n ) : null}\n </span>\n {/* Mail's separator: a hairline inset to the text, hidden around a highlighted row.\n Messages draws none: its rows are told apart by their avatars and spacing. */}\n {appearance === \"mail\" && i + 1 < rows.length && !isSelected && !nextSelected ? (\n <span data-slot=\"message-list-separator\" aria-hidden className={cn(\"pointer-events-none absolute bottom-0 right-1 h-px bg-separator\", leadingSize === \"avatar\" ? \"left-14\" : leadingSize === \"icon\" ? \"left-11\" : \"left-6\")} />\n ) : null}\n </div>\n );\n })\n )}\n {onEndReached && rows.length > 0 ? <EndOfList key={rows.length} onEndReached={onEndReached} /> : null}\n {footer}\n </div>\n );\n\n return (\n <>\n {rowMenu ? (\n <ContextMenu open={menuOpen && hasMenu} onOpenChange={onMenuOpenChange}>\n <ContextMenuTrigger asChild>{list}</ContextMenuTrigger>\n <ContextMenuContent data-slot=\"message-list-menu\">\n {menu ? <ContextMenuEntries items={menu} onAsk={setAsking} /> : null}\n </ContextMenuContent>\n </ContextMenu>\n ) : (\n list\n )}\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 </>\n );\n}\n\n/** Mail's unread dot: the accent, 8 pt, in a row's leading slot. */\nexport function UnreadDot({ label = \"Unread\", className, ...props }: React.HTMLAttributes<HTMLSpanElement> & { label?: string }) {\n return <span role=\"img\" aria-label={label} data-slot=\"unread-dot\" className={cn(\"mt-px size-2 shrink-0 rounded-full bg-tint [[data-window-active=true]_[data-slot=message-list]:focus-within_[data-selected]_&]:bg-selection-label\", className)} {...props} />;\n}\n\n/** The list's end: in view (the person scrolled there, or a short page fills less than the column)\n * asks for the next page. Keyed by the row count, so each new page looks again. */\nfunction EndOfList({ onEndReached }: { onEndReached: () => void }) {\n const ref = React.useRef<HTMLDivElement | null>(null);\n const latest = React.useRef(onEndReached);\n latest.current = onEndReached;\n React.useEffect(() => {\n const el = ref.current;\n if (!el || typeof IntersectionObserver === \"undefined\") return;\n let asked = false;\n const io = new IntersectionObserver(\n (entries) => {\n if (asked || !entries.some((e) => e.isIntersecting)) return;\n asked = true;\n latest.current();\n },\n { rootMargin: \"0px 0px 240px 0px\" },\n );\n io.observe(el);\n return () => io.disconnect();\n }, []);\n return <div ref={ref} data-slot=\"message-list-end\" aria-hidden className=\"h-px\" />;\n}\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { Notices } from \"./layout\";\n\nexport interface SplitViewProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The page header (a title-less PageHeader moves into the window's unified toolbar). */\n header?: React.ReactNode;\n /** Banners, in the frame's foot bar (the same rule as Page: nothing moves when one appears). */\n notices?: React.ReactNode;\n /** An optional leading column (Notes' folders, Mail's mailboxes when the window sidebar is not them). */\n source?: React.ReactNode;\n /** The list column (a MessageList): Mail's message list, Messages' conversations, Voice Memos' recordings. */\n list: React.ReactNode;\n /** Pinned at the top of the list column, above its scrolling rows (a search field, a filter bar). */\n listHeader?: React.ReactNode;\n /** Pinned at the foot of the list column (Voice Memos' record button, a count). */\n listFooter?: React.ReactNode;\n /** The viewer (the open message, conversation or recording). It scrolls itself unless `detailScrolls`\n * is false. Absent: the list takes the rest of the width (Mail with its viewer hidden). */\n detail?: React.ReactNode;\n /** The list column's width: `md` 280 (Messages, Voice Memos), `lg` 340 (Mail). In a narrow\n * window the source column (to 160) and the list (to 224) yield first, so the viewer keeps 320\n * and a title in it wraps at most once. */\n listWidth?: \"md\" | \"lg\";\n /** False when the viewer manages its own scrolling (a transcript pinned over a composer). */\n detailScrolls?: boolean;\n /**\n * The one column that stays when the body is too narrow for its columns side by side (a window\n * made small, or an inspector beside it): `detail` while something is open in the viewer, `list`\n * otherwise — NavigationSplitView's collapsed stack; the window's Back returns to the list. The\n * other columns hide (never clipped off the edge). Absent: the columns only shrink to their minimums.\n */\n narrow?: \"list\" | \"detail\";\n}\n\nconst LIST_WIDTH = { md: \"w-70\", lg: \"w-85\" } as const;\n\n/**\n * Mail's, Messages' and Notes' window body: columns side by side under the unified toolbar, each\n * scrolling on its own, divided by hairlines — an optional source column, the list, and the viewer.\n * The columns fill the window's height; nothing scrolls the frame itself.\n */\nexport function SplitView({ header, notices, source, list, listHeader, listFooter, detail, listWidth = \"lg\", detailScrolls = true, narrow, className, ...props }: SplitViewProps) {\n return (\n <div data-slot=\"split-view\" className={cn(\"relative flex h-full min-h-0 flex-col bg-content\", className)} {...props}>\n {header ? <div className=\"shrink-0 px-5 empty:hidden\">{header}</div> : null}\n <div data-slot=\"split-columns\" data-narrow={detail !== undefined ? narrow : undefined} data-has-source={source ? \"\" : undefined} className=\"flex min-h-0 flex-1\">\n {source ? (\n <div data-slot=\"split-view-source\" className=\"flex w-52 min-w-40 shrink flex-col overflow-y-auto border-r border-separator py-2\">\n {source}\n </div>\n ) : null}\n <div data-slot=\"split-view-list\" className={cn(\"flex flex-col\", detail === undefined ? \"min-w-0 flex-1\" : cn(\"min-w-56 shrink border-r border-separator\", LIST_WIDTH[listWidth]))}>\n {listHeader ? <div className=\"flex shrink-0 flex-col gap-2 px-3 pb-2 pt-1\">{listHeader}</div> : null}\n <div className=\"min-h-0 flex-1 overflow-y-auto\">{list}</div>\n {listFooter ? <div className=\"flex shrink-0 items-center justify-center border-t border-separator px-3 py-3\">{listFooter}</div> : null}\n </div>\n {detail !== undefined ? (\n <div data-slot=\"split-view-detail\" className={cn(\"flex min-w-80 flex-1 flex-col\", detailScrolls ? \"overflow-y-auto\" : \"min-h-0\")}>\n {detail}\n </div>\n ) : null}\n </div>\n <Notices data-page-notices=\"\">{notices}</Notices>\n </div>\n );\n}\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport interface ResizablePaneProps extends React.HTMLAttributes<HTMLDivElement> {\n [data: `data-${string}`]: string | undefined;\n /** The pane's height (px) before the person drags it, and what a double-click on the divider restores (when not `collapsible`). */\n defaultSize: number;\n /** The least the pane may be (px) while open. */\n minSize?: number;\n /** The least the content above keeps (px): the pane never grows past its window less this (except `maximized`). */\n reserve?: number;\n /** Remembers the person's height, and whether the pane is collapsed or maximized, under this name (NSSplitView's autosaveName), per computer. */\n autosaveName?: string;\n /** The divider's accessible name (\"Resize the log\"). */\n dividerLabel: string;\n /**\n * NSSplitView's collapsible subview: dragging the divider past half of `minSize` snaps the pane\n * shut (height 0, the divider stays as a hairline to drag it back), and a double-click or Enter\n * on the divider toggles collapsed and open at the last height.\n */\n collapsible?: boolean;\n /** Controlled collapsed state (a toolbar button or View-menu item drives it). Omit to let the pane keep its own. */\n collapsed?: boolean;\n /** Collapsed state on first open when uncontrolled and nothing is saved. */\n defaultCollapsed?: boolean;\n /** Called whenever the person (or a gesture) collapses or opens the pane. */\n onCollapsedChange?: (collapsed: boolean) => void;\n /**\n * Controlled: the content above collapses and this pane fills the split (\"focus on one pane\").\n * Turning it off returns both panes to their sizes. Omit to let the pane keep its own.\n */\n maximized?: boolean;\n /** Called when the pane leaves (or enters) the maximized state: dragging the divider or Enter/double-click leaves it. */\n onMaximizedChange?: (maximized: boolean) => void;\n children: React.ReactNode;\n}\n\ntype PaneState = \"open\" | \"collapsed\" | \"maximized\";\n\nconst STEP = 16;\nconst key = (name: string) => `mx-split:${name}`;\nconst stateKey = (name: string) => `mx-split:${name}:state`;\n\nfunction saved(name: string | undefined): number | null {\n if (!name) return null;\n try {\n const raw = globalThis.localStorage?.getItem(key(name));\n const n = raw === null || raw === undefined ? Number.NaN : Number(raw);\n return Number.isFinite(n) && n > 0 ? n : null;\n } catch {\n return null;\n }\n}\n\nfunction save(name: string | undefined, size: number): void {\n if (!name) return;\n try {\n globalThis.localStorage?.setItem(key(name), String(Math.round(size)));\n } catch {\n // A window that cannot store keeps the height for this visit only.\n }\n}\n\nfunction savedState(name: string | undefined): PaneState | null {\n if (!name) return null;\n try {\n const raw = globalThis.localStorage?.getItem(stateKey(name));\n return raw === \"collapsed\" || raw === \"maximized\" || raw === \"open\" ? raw : null;\n } catch {\n return null;\n }\n}\n\nfunction saveState(name: string | undefined, state: PaneState): void {\n if (!name) return;\n try {\n globalThis.localStorage?.setItem(stateKey(name), state);\n } catch {\n // As above: kept for this visit only.\n }\n}\n\n/**\n * NSSplitView's lower pane (Console's message detail, Xcode's debug area, Local servers' log): a\n * pane under the window's content whose top edge is a divider the person drags. It keeps its\n * height between visits (`autosaveName`), never squeezes the content above below `reserve`,\n * a double-click on the divider restores `defaultSize`, and the divider takes the keyboard\n * (↑/↓ by 16 px, Home for the most, End for the least). `collapsible` lets it snap shut and open\n * again (drag, double-click, Enter); `collapsed` and `maximized` let a toolbar button or a\n * View-menu item hide it or make it fill the split, and bring it back.\n */\nexport function ResizablePane({\n defaultSize,\n minSize = 120,\n reserve = 160,\n autosaveName,\n dividerLabel,\n collapsible = false,\n collapsed: collapsedProp,\n defaultCollapsed = false,\n onCollapsedChange,\n maximized: maximizedProp,\n onMaximizedChange,\n className,\n children,\n ...props\n}: ResizablePaneProps) {\n const ref = React.useRef<HTMLDivElement>(null);\n const [size, setSize] = React.useState(() => saved(autosaveName) ?? defaultSize);\n const [ownState, setOwnState] = React.useState<PaneState>(() => savedState(autosaveName) ?? (defaultCollapsed ? \"collapsed\" : \"open\"));\n const [room, setRoom] = React.useState<number | null>(null);\n\n const collapsed = collapsedProp ?? ownState === \"collapsed\";\n const maximized = !collapsed && (maximizedProp ?? ownState === \"maximized\");\n const state: PaneState = collapsed ? \"collapsed\" : maximized ? \"maximized\" : \"open\";\n\n // Always the latest state and callbacks, so a drag's listeners never act on a stale render.\n const live = React.useRef({ state, onCollapsedChange, onMaximizedChange });\n live.current = { state, onCollapsedChange, onMaximizedChange };\n\n const setState = React.useCallback((next: PaneState) => {\n const { state: was, onCollapsedChange: oc, onMaximizedChange: om } = live.current;\n if (next === was) return;\n live.current = { ...live.current, state: next };\n setOwnState(next);\n if ((was === \"collapsed\") !== (next === \"collapsed\")) oc?.(next === \"collapsed\");\n if ((was === \"maximized\") !== (next === \"maximized\")) om?.(next === \"maximized\");\n }, []);\n\n // Whichever drives it (the person, a toolbar button, a menu item), the state is remembered.\n React.useEffect(() => saveState(autosaveName, state), [autosaveName, state]);\n\n // How tall the window's content is, so the pane never covers all of it.\n React.useLayoutEffect(() => {\n const el = ref.current;\n const frame = el?.closest<HTMLElement>('[data-slot=\"page-frame\"], [data-slot=\"split-view\"]') ?? el?.parentElement ?? null;\n if (!frame) return;\n const measure = () => setRoom(frame.clientHeight || null);\n measure();\n if (typeof ResizeObserver === \"undefined\") return;\n const ro = new ResizeObserver(measure);\n ro.observe(frame);\n return () => ro.disconnect();\n }, []);\n\n const most = room === null ? Number.POSITIVE_INFINITY : Math.max(minSize, room - reserve);\n const clamp = (n: number) => Math.min(most, Math.max(minSize, n));\n const open = clamp(size);\n const height = state === \"collapsed\" ? 0 : state === \"maximized\" ? room : open;\n const shown = height ?? open;\n const commit = (n: number) => {\n const next = clamp(n);\n setSize(next);\n save(autosaveName, next);\n };\n // Collapsed or open at the last height; leaving maximized returns to the last height too.\n const toggle = () => setState(state === \"open\" ? \"collapsed\" : \"open\");\n\n const drag = (event: React.PointerEvent<HTMLDivElement>) => {\n if (event.button !== 0) return;\n event.preventDefault();\n const divider = event.currentTarget;\n divider.setPointerCapture?.(event.pointerId);\n const startY = event.clientY;\n const start = shown;\n const restore = open;\n let last = open;\n let moved = false;\n const move = (e: PointerEvent) => {\n const raw = start - (e.clientY - startY);\n if (!moved && raw === start) return;\n moved = true;\n if (collapsible && raw < minSize / 2) {\n setState(\"collapsed\");\n last = restore;\n setSize(restore);\n return;\n }\n if (live.current.state !== \"open\") setState(\"open\");\n last = clamp(raw);\n setSize(last);\n };\n const up = () => {\n divider.removeEventListener(\"pointermove\", move);\n divider.removeEventListener(\"pointerup\", up);\n divider.removeEventListener(\"pointercancel\", up);\n if (moved) save(autosaveName, last);\n };\n divider.addEventListener(\"pointermove\", move);\n divider.addEventListener(\"pointerup\", up);\n divider.addEventListener(\"pointercancel\", up);\n };\n\n return (\n <div\n ref={ref}\n data-slot=\"resizable-pane\"\n data-size={Math.round(shown)}\n data-state={state}\n className={cn(\"relative flex min-h-0 shrink-0 flex-col\", state === \"collapsed\" && \"overflow-hidden\", className)}\n style={{ height: height ?? (state === \"maximized\" ? \"100%\" : open) }}\n {...props}\n >\n {/* `contents` keeps the children the pane's own flex items; `inert` takes a collapsed pane out of focus and reading order without unmounting it. */}\n <div className=\"contents\" inert={state === \"collapsed\"}>\n {children}\n </div>\n {/* The divider: the pane's top hairline, with a few points either side to grab (AppKit's thin divider). Collapsed, it draws the hairline itself. */}\n <div\n role=\"separator\"\n aria-orientation=\"horizontal\"\n aria-label={dividerLabel}\n aria-valuenow={Math.round(shown)}\n aria-valuemin={collapsible ? 0 : minSize}\n aria-valuemax={state === \"maximized\" && room !== null ? Math.round(room) : Number.isFinite(most) ? Math.round(most) : undefined}\n aria-valuetext={state === \"collapsed\" ? \"Collapsed\" : state === \"maximized\" ? \"Full height\" : undefined}\n tabIndex={0}\n title={collapsible ? \"Drag to resize · double-click to collapse or open\" : \"Drag to resize · double-click to restore\"}\n data-slot=\"resizable-pane-divider\"\n data-state={state}\n className=\"focus-ring absolute inset-x-0 -top-1 h-2 cursor-row-resize touch-none\"\n onPointerDown={drag}\n onDoubleClick={() => {\n if (collapsible) toggle();\n else {\n setState(\"open\");\n commit(defaultSize);\n }\n }}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" && collapsible) {\n event.preventDefault();\n toggle();\n return;\n }\n if (collapsible && state === \"collapsed\" && event.key === \"ArrowUp\") {\n event.preventDefault();\n setState(\"open\");\n return;\n }\n if (collapsible && state === \"open\" && event.key === \"ArrowDown\" && open <= minSize) {\n event.preventDefault();\n setState(\"collapsed\");\n return;\n }\n const from = state === \"maximized\" && room !== null ? room : open;\n const next =\n event.key === \"ArrowUp\" ? from + STEP : event.key === \"ArrowDown\" ? from - STEP : event.key === \"Home\" ? most : event.key === \"End\" ? minSize : null;\n if (next === null) return;\n event.preventDefault();\n setState(\"open\");\n commit(Number.isFinite(next) ? next : from);\n }}\n >\n {state === \"collapsed\" ? <span aria-hidden className=\"pointer-events-none absolute inset-x-0 top-1 h-px bg-separator\" /> : null}\n </div>\n </div>\n );\n}\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\nexport interface EdgeResizerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n [data: `data-${string}`]: string | undefined;\n /** The column's width now (px); the host owns it. */\n width: number;\n /** The least it may be while open (px). */\n minWidth: number;\n /** The most it may be (px). */\n maxWidth: number;\n /** Which side of the column the edge is on: dragging away from the column widens it. */\n side?: \"right\" | \"left\";\n /** The edge's accessible name (\"Resize the sidebar\"). */\n label: string;\n /** Called with each new width while dragging or on the arrow keys, always within min and max. */\n onResize: (width: number) => void;\n /**\n * NSSplitView's collapsible column (Finder, Mail): dragged this far (px) below `minWidth`, the\n * column snaps shut and this is called instead of `onResize`. Omit for a column that never closes.\n */\n onCollapse?: () => void;\n /** How far below `minWidth` a drag must go before the column snaps shut (default 48). */\n snap?: number;\n}\n\nconst STEP = 16;\n\n/**\n * The draggable edge of a column (a sidebar, an inspector): a hairline you grab a few points either\n * side of, sideways. Dragging resizes within min and max and, when the column is collapsible, past\n * the minimum snaps it shut; the arrow keys step it, Home and End jump to the ends. The host owns\n * the width (often the main process, which also draws the window's material at that width).\n */\nexport function EdgeResizer({ width, minWidth, maxWidth, side = \"right\", label, onResize, onCollapse, snap = 48, className, ...props }: EdgeResizerProps) {\n const clamp = (w: number) => Math.round(Math.min(maxWidth, Math.max(minWidth, w)));\n const drag = (event: React.PointerEvent<HTMLDivElement>) => {\n if (event.button !== 0) return;\n event.preventDefault();\n const edge = event.currentTarget;\n edge.setPointerCapture(event.pointerId);\n const startX = event.clientX;\n const start = width;\n let collapsed = false;\n const move = (e: PointerEvent) => {\n if (collapsed) return;\n const raw = start + (side === \"right\" ? e.clientX - startX : startX - e.clientX);\n if (onCollapse && raw < minWidth - snap) {\n collapsed = true;\n onCollapse();\n return;\n }\n onResize(clamp(raw));\n };\n const up = () => {\n edge.removeEventListener(\"pointermove\", move);\n edge.removeEventListener(\"pointerup\", up);\n edge.removeEventListener(\"pointercancel\", up);\n };\n edge.addEventListener(\"pointermove\", move);\n edge.addEventListener(\"pointerup\", up);\n edge.addEventListener(\"pointercancel\", up);\n };\n const grow = side === \"right\" ? \"ArrowRight\" : \"ArrowLeft\";\n const shrink = side === \"right\" ? \"ArrowLeft\" : \"ArrowRight\";\n return (\n <div\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={label}\n aria-valuenow={Math.round(width)}\n aria-valuemin={minWidth}\n aria-valuemax={maxWidth}\n tabIndex={0}\n data-slot=\"edge-resizer\"\n data-side={side}\n className={cn(\"focus-ring absolute inset-y-0 w-2 cursor-col-resize touch-none\", side === \"right\" ? \"-right-1\" : \"-left-1\", className)}\n onPointerDown={drag}\n onKeyDown={(event) => {\n if (event.key === shrink && onCollapse && width <= minWidth) {\n event.preventDefault();\n onCollapse();\n return;\n }\n const next =\n event.key === grow ? width + STEP : event.key === shrink ? width - STEP : event.key === \"Home\" ? minWidth : event.key === \"End\" ? maxWidth : null;\n if (next === null) return;\n event.preventDefault();\n onResize(clamp(next));\n }}\n {...props}\n />\n );\n}\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { Text } from \"./text\";\n\n/**\n * Messages' and FaceTime's parts: the round avatar, the conversation's centered header, the composer\n * at the foot of a conversation, and FaceTime's round call buttons.\n */\n\nexport interface AvatarProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Who it is: its initials are drawn when there is no `symbol`, and it is the accessible name. */\n label: string;\n /** A glyph instead of initials (an agent, a lock). */\n symbol?: React.ReactNode;\n /** `sm` 28 pt (a list row), `md` 40 pt (Messages' header), `lg` 64 pt, `xl` 96 pt (FaceTime's call). */\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\";\n}\n\nconst AVATAR_SIZE = { sm: \"size-7\", md: \"size-10\", lg: \"size-16\", xl: \"size-24\" } as const;\nconst AVATAR_TEXT = { sm: \"text-body\", md: \"text-title-3\", lg: \"text-title-1\", xl: \"text-title-large\" } as const;\nconst AVATAR_ICON = { sm: \"[&_svg]:size-icon\", md: \"[&_svg]:size-icon-lg\", lg: \"[&_svg]:size-icon-xl\", xl: \"[&_svg]:size-12\" } as const;\n\nconst initials = (label: string) =>\n label\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, 2)\n .map((w) => w[0]?.toUpperCase() ?? \"\")\n .join(\"\");\n\n/** Contacts' monogram: a gray circle with the initials (or a glyph) in white. */\nexport function Avatar({ label, symbol, size = \"md\", className, ...props }: AvatarProps) {\n return (\n <span\n role=\"img\"\n aria-label={label}\n data-slot=\"avatar\"\n className={cn(\"flex shrink-0 select-none items-center justify-center rounded-full bg-system-gray font-medium text-tint-label\", AVATAR_SIZE[size], AVATAR_TEXT[size], AVATAR_ICON[size], className)}\n {...props}\n >\n {symbol ?? initials(label)}\n </span>\n );\n}\n\nexport interface ConversationHeaderProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** The avatar over the name (Messages draws it small, centered). */\n avatar?: React.ReactNode;\n title: React.ReactNode;\n /** How the conversation travels (\"iMessage\"; ours: \"Matrx Cloud\", \"On this computer\"). */\n subtitle?: React.ReactNode;\n}\n\n/** Messages' conversation header: who, centered, with how it travels under it, over a hairline. */\nexport function ConversationHeader({ avatar, title, subtitle, className, ...props }: ConversationHeaderProps) {\n return (\n <header data-slot=\"conversation-header\" className={cn(\"flex shrink-0 flex-col items-center gap-1 border-b border-separator pb-2 pt-3\", className)} {...props}>\n {avatar}\n <Text emphasized>{title}</Text>\n {subtitle ? (\n <Text tone=\"secondary\" className=\"flex items-center gap-1\">\n {subtitle}\n </Text>\n ) : null}\n </header>\n );\n}\n\nexport interface MessageComposerProps extends Omit<React.FormHTMLAttributes<HTMLFormElement>, \"onSubmit\"> {\n /** The field's placeholder (Messages: \"iMessage\"). It is also the field's name. */\n placeholder: string;\n value: string;\n onValueChange: (value: string) => void;\n /** Return in the field. */\n onSend?: (text: string) => void;\n /** The leading + button (Messages' Photos, Files, Screen share menu). */\n leading?: React.ReactNode;\n /** The trailing button inside the field (Messages' emoji or dictation). */\n trailing?: React.ReactNode;\n /** Nothing can be typed or sent (a conversation that is not open yet). */\n disabled?: boolean;\n}\n\n/**\n * Messages' composer at the foot of a conversation: a round + button, then a capsule field with a\n * trailing button inside it. Return sends.\n */\nexport function MessageComposer({ placeholder, value, onValueChange, onSend, leading, trailing, disabled, className, ...props }: MessageComposerProps) {\n return (\n <form\n data-slot=\"message-composer\"\n className={cn(\"flex shrink-0 items-center gap-2 px-3 py-2.5\", className)}\n onSubmit={(event) => {\n event.preventDefault();\n const text = value.trim();\n if (text && !disabled) onSend?.(text);\n }}\n {...props}\n >\n {leading}\n <span className=\"relative flex min-w-0 flex-1 items-center\">\n <input\n type=\"text\"\n aria-label={placeholder}\n placeholder={placeholder}\n value={value}\n disabled={disabled}\n onChange={(event) => onValueChange(event.target.value)}\n className=\"focus-ring h-control-lg w-full min-w-0 select-text rounded-full border border-separator bg-content px-3 pr-9 text-body text-label placeholder:text-label-tertiary disabled:opacity-60\"\n />\n {trailing ? <span className=\"absolute right-1 flex items-center\">{trailing}</span> : null}\n </span>\n </form>\n );\n}\n\nexport interface CallButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\" | \"aria-label\"> {\n icon: React.ReactNode;\n /** Its name, drawn under it (FaceTime: Mute, Speaker, End). */\n label: string;\n /** `end`: the red End button. */\n tone?: \"default\" | \"end\";\n}\n\n/** FaceTime's call control: a 48 pt round button with its name under it; End is red. */\nexport function CallButton({ icon, label, tone = \"default\", className, type = \"button\", ...props }: CallButtonProps) {\n return (\n <span data-slot=\"call-button\" className=\"flex flex-col items-center gap-1.5\">\n <button\n type={type}\n aria-label={label}\n className={cn(\n \"focus-ring flex size-12 items-center justify-center rounded-full [&_svg]:size-icon-lg disabled:opacity-40\",\n tone === \"end\" ? \"bg-system-red text-tint-label\" : \"bg-fill-secondary text-label\",\n className,\n )}\n {...props}\n >\n {icon}\n </button>\n <Text tone=\"secondary\">{label}</Text>\n </span>\n );\n}\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\n/**\n * Voice Memos' parts: the recording's waveform with its playhead, and the round red Record button.\n */\n\nexport interface WaveformProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"aria-label\"> {\n /** The recording's loudness, one value 0–1 per bar, oldest first (`peaksOf` makes them). */\n peaks: ReadonlyArray<number>;\n /** How far playback has gone, 0–1: the bars before it in the label color, the playhead there. */\n progress?: number;\n /** A click (or Left/Right) moves the playhead; omitted, the waveform is a picture. */\n onSeek?: (fraction: number) => void;\n \"aria-label\": string;\n}\n\n/**\n * Voice Memos' waveform: thin rounded bars mirrored about the center line, the played part in the\n * label color and the rest tertiary, the playhead a tint line with a dot on top. It fills its\n * container's width; its height is the row-tall named size, four of them.\n */\nexport function Waveform({ peaks, progress = 0, onSeek, className, \"aria-label\": label, ...props }: WaveformProps) {\n const bars = peaks.length;\n const at = Math.max(0, Math.min(1, progress));\n const seek = (event: React.MouseEvent<HTMLDivElement>) => {\n if (!onSeek) return;\n const box = event.currentTarget.getBoundingClientRect();\n if (box.width > 0) onSeek(Math.max(0, Math.min(1, (event.clientX - box.left) / box.width)));\n };\n return (\n <div\n data-slot=\"waveform\"\n role={onSeek ? \"slider\" : \"img\"}\n aria-label={label}\n {...(onSeek ? { \"aria-valuemin\": 0, \"aria-valuemax\": 100, \"aria-valuenow\": Math.round(at * 100), tabIndex: 0 } : {})}\n onClick={seek}\n onKeyDown={(event) => {\n if (!onSeek) return;\n if (event.key === \"ArrowLeft\" || event.key === \"ArrowRight\") {\n event.preventDefault();\n onSeek(Math.max(0, Math.min(1, at + (event.key === \"ArrowRight\" ? 0.05 : -0.05))));\n }\n }}\n className={cn(\"focus-ring relative h-48 w-full cursor-default select-none rounded-control\", className)}\n {...props}\n >\n <svg viewBox={`0 0 ${Math.max(bars, 1) * 3} 100`} preserveAspectRatio=\"none\" className=\"absolute inset-0 size-full\" aria-hidden>\n <line x1=\"0\" x2={Math.max(bars, 1) * 3} y1=\"50\" y2=\"50\" className=\"stroke-separator\" strokeWidth=\"0.5\" vectorEffect=\"non-scaling-stroke\" />\n {peaks.map((p, i) => {\n const h = Math.max(1.5, Math.min(1, p) * 92);\n const played = (i + 0.5) / bars <= at;\n return <rect key={i} x={i * 3 + 0.6} y={50 - h / 2} width=\"1.8\" height={h} rx=\"0.9\" className={played ? \"fill-label\" : \"fill-label-tertiary\"} />;\n })}\n </svg>\n {/* The playhead: a tint line the full height, a dot at its top (Voice Memos). */}\n <span data-slot=\"waveform-playhead\" aria-hidden className=\"pointer-events-none absolute inset-y-0 w-px bg-tint\" style={{ left: `${at * 100}%` }}>\n <span className=\"absolute -left-1 -top-1 size-2 rounded-full bg-tint\" />\n </span>\n </div>\n );\n}\n\n/**\n * The loudness of `samples` (one channel, −1…1) as `bars` peaks 0–1, scaled so the loudest bar is\n * full height (Voice Memos draws every recording at a readable size).\n */\nexport function peaksOf(samples: ArrayLike<number>, bars: number): number[] {\n const n = Math.max(1, Math.floor(bars));\n if (samples.length === 0) return new Array<number>(n).fill(0);\n const per = samples.length / n;\n const out: number[] = [];\n for (let b = 0; b < n; b += 1) {\n const from = Math.floor(b * per);\n const to = Math.max(from + 1, Math.floor((b + 1) * per));\n let peak = 0;\n for (let i = from; i < to && i < samples.length; i += 1) peak = Math.max(peak, Math.abs(samples[i] ?? 0));\n out.push(peak);\n }\n const loudest = Math.max(...out);\n return loudest > 0 ? out.map((p) => p / loudest) : out;\n}\n\nexport interface RecordButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\" | \"aria-label\"> {\n /** Recording now: the red dot becomes a rounded square (Stop). */\n recording?: boolean;\n /** The button's name and tooltip (\"Record\", \"Stop recording\"). */\n label: string;\n}\n\n/** Voice Memos' Record button: a red dot in a ring, 44 pt; while recording, a red rounded square. */\nexport const RecordButton = React.forwardRef<HTMLButtonElement, RecordButtonProps>(function RecordButton({ recording = false, label, className, type = \"button\", ...props }, ref) {\n return (\n <button\n ref={ref}\n type={type}\n data-slot=\"record-button\"\n data-recording={recording || undefined}\n aria-label={label}\n title={label}\n className={cn(\n \"focus-ring flex size-11 shrink-0 items-center justify-center rounded-full border-2 border-label-tertiary bg-content disabled:opacity-40\",\n className,\n )}\n {...props}\n >\n <span className={cn(\"bg-system-red transition-all duration-150\", recording ? \"size-4 rounded-tile\" : \"size-8 rounded-full\")} />\n </button>\n );\n});\n","import * as React from \"react\";\nimport { copyText } from \"@ai-matrx/kit/clipboard\";\n\nimport { Button } from \"./button\";\nimport { describeError } from \"./errors\";\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 const said = describeError(state.error);\n return (\n <StateView\n kind=\"error\"\n size={size}\n title={failed}\n message={<span title={said.detail || undefined}>{said.cause}</span>}\n actions={\n <>\n {state.refetch ? <Button onClick={() => void state.refetch?.()}>Try again</Button> : null}\n {said.detail ? (\n <Button variant=\"plain\" onClick={() => void copyText(said.detail)}>\n Copy details\n </Button>\n ) : null}\n </>\n }\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\";\nimport { Text } from \"./text\";\n\nexport interface ComingSoonProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** The feature's symbol (the same one its menu entry shows), at 48 pt (`SystemSymbol size={48}`). */\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 /** The one thing to do from here (a regular `Button`), under the text, as an empty Shortcuts\n * library offers \"Browse Gallery\". */\n action?: React.ReactNode;\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. It is Apple's empty state\n * (ContentUnavailableView: an empty Notes folder, an empty Shortcuts library): centered in the page,\n * a large tertiary symbol, the name in bold secondary type, one line of what it will do and that it\n * is coming, what it will include (secondary, legible in both themes), and at most one button. No card, no border, no badge.\n */\nexport function ComingSoon({ icon, title, summary, includes, action, className, ...props }: ComingSoonProps) {\n const lines = (includes ?? []).slice(0, 4);\n return (\n <div\n data-slot=\"coming-soon\"\n data-coming-soon={title}\n className={cn(\"flex h-full min-h-60 flex-col items-center justify-center overflow-y-auto bg-content px-8 py-10 text-center\", className)}\n {...props}\n >\n <span data-coming-soon-symbol className=\"mb-3 flex items-center justify-center text-label-tertiary [&_svg]:size-12\">\n {icon}\n </span>\n <Text as=\"h1\" variant=\"title-1\" emphasized tone=\"secondary\">\n {title}\n </Text>\n {/* Balanced lines, as ContentUnavailableView wraps its description: never \"Coming\" / \"soon.\" alone. */}\n <Text as=\"p\" tone=\"secondary\" className=\"mt-2 max-w-sm text-balance\">\n {summary} <span data-coming-soon-status className=\"whitespace-nowrap\">Coming soon.</span>\n </Text>\n {lines.length > 0 ? (\n <ul data-coming-soon-includes className=\"mt-3 flex flex-col items-center gap-1\">\n {lines.map((line) => (\n <li key={line}>\n <Text tone=\"secondary\">{line}</Text>\n </li>\n ))}\n </ul>\n ) : null}\n {action ? <div className=\"mt-4 flex items-center gap-2\">{action}</div> : null}\n </div>\n );\n}\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\n\n/** A tile's color: macOS's system colors, used here as a category's color (System Settings'\n * pane icons, Shortcuts' action categories). */\nexport type SymbolTileColor = \"red\" | \"orange\" | \"yellow\" | \"green\" | \"blue\" | \"purple\" | \"gray\";\n\nconst COLOR: Record<SymbolTileColor, string> = {\n red: \"bg-system-red\",\n orange: \"bg-system-orange\",\n yellow: \"bg-system-yellow\",\n green: \"bg-system-green\",\n blue: \"bg-system-blue\",\n purple: \"bg-system-purple\",\n gray: \"bg-system-gray\",\n};\n\n/**\n * The tile's size and the glyph inside it:\n * - `sm` 20 pt: a `Row`'s icon (System Settings' sidebar, Shortcuts' action list);\n * - `md` 32 pt: a list row's icon (Passwords' list, Shortcuts' list view);\n * - `lg` 64 pt: an app icon in a shelf (App Store's lockups);\n * - `xl` 128 pt: the big icon on a detail page (App Store's product page).\n * The bigger sizes are app icons: Apple's continuous-corner squircle radius and a soft top sheen.\n */\nexport type SymbolTileSize = \"sm\" | \"md\" | \"lg\" | \"xl\";\n\nconst SIZE: Record<SymbolTileSize, string> = {\n sm: \"size-icon-lg rounded-tile [&_svg]:size-icon-sm\",\n md: \"size-8 rounded-control [&_svg]:size-icon-lg\",\n lg: \"size-16 rounded-icon-lg [&_svg]:size-icon-xl\",\n xl: \"size-32 rounded-icon-xl [&_svg]:size-16\",\n};\n\n/** A tile color picked by a key (a category, a name): the same key always gets the same color.\n * Yellow is left out: white type on it is too faint for a name (Shortcuts darkens its yellow). */\nexport function tileColorFor(key: string): SymbolTileColor {\n const colors: SymbolTileColor[] = [\"blue\", \"purple\", \"orange\", \"green\", \"red\", \"gray\"];\n let hash = 0;\n for (let i = 0; i < key.length; i += 1) hash = (hash * 31 + key.charCodeAt(i)) >>> 0;\n return colors[hash % colors.length] ?? \"blue\";\n}\n\nexport interface SymbolTileProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** The glyph (a `SystemSymbol`, or its Lucide fallback), drawn white on the color. */\n children: React.ReactNode;\n color: SymbolTileColor;\n size?: SymbolTileSize;\n}\n\n/**\n * THE colored icon tile: a white glyph on a rounded square of one system color (System Settings'\n * pane icons, Shortcuts' actions; at `lg`/`xl` an app icon in App Store's shelves and product page).\n * At `sm` it fills a `Row`'s icon slot exactly. Decorative: the row's title names the thing.\n */\nexport function SymbolTile({ children, color, size = \"sm\", className, ...props }: SymbolTileProps) {\n return (\n <span\n aria-hidden\n data-slot=\"symbol-tile\"\n data-color={color}\n data-size={size}\n className={cn(\"flex shrink-0 items-center justify-center text-tint-label\", SIZE[size], COLOR[color], className)}\n {...props}\n >\n {children}\n </span>\n );\n}\n","import * as React from \"react\";\n\nimport { ContextMenu, ContextMenuContent, ContextMenuTrigger } from \"../context-menu\";\nimport { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from \"../dropdown-menu\";\nimport { Tooltip, TooltipTrigger } from \"../tooltip\";\nimport { cn } from \"./cn\";\nimport { ContextMenuEntries, DropdownMenuEntries, type RowMenuItem } from \"./menu-entries\";\nimport { ConfirmDialog } from \"./sheet\";\nimport type { SymbolTileColor } from \"./tile\";\nimport { TooltipContent } from \"./tooltip\";\n\n/*\n * Shortcuts' library: a grid of colored tiles, one per shortcut — its glyph at the top leading\n * corner, its name at the foot in white, and on hover (or while the tile is selected or focused) the\n * run button and the More (ellipsis) button at the top trailing corner; More opens the tile's menu. A click selects the tile, a double-click or\n * Return opens it, Space runs it; right-click opens its menu. The arrow keys move the selection\n * across the grid in reading order (Up/Down by a whole row).\n */\n\nconst TILE_COLOR: Record<SymbolTileColor, string> = {\n red: \"bg-system-red\",\n orange: \"bg-system-orange\",\n yellow: \"bg-system-yellow\",\n green: \"bg-system-green\",\n blue: \"bg-system-blue\",\n purple: \"bg-system-purple\",\n gray: \"bg-system-gray\",\n};\n\nexport interface TileGridProps extends React.HTMLAttributes<HTMLDivElement> {\n \"aria-label\": string;\n}\n\n/** The grid Shortcuts lays its tiles in: as many 170 pt columns as fit, 12 pt apart, filling the row. */\nexport function TileGrid({ className, onKeyDown, ...props }: TileGridProps) {\n return (\n <div\n role=\"listbox\"\n data-slot=\"tile-grid\"\n className={cn(\"grid gap-3\", className)}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n const keys = [\"ArrowRight\", \"ArrowLeft\", \"ArrowDown\", \"ArrowUp\", \"Home\", \"End\"];\n if (!keys.includes(event.key)) return;\n const tiles = Array.from(event.currentTarget.querySelectorAll<HTMLElement>('[data-slot=\"shortcut-tile\"]'));\n const at = tiles.indexOf(document.activeElement as HTMLElement);\n if (at === -1 || tiles.length === 0) return;\n // A row is every tile on the same line as the focused one.\n const top = tiles[at]?.offsetTop ?? 0;\n const perRow = Math.max(1, tiles.filter((t) => t.offsetTop === top).length);\n const step: Record<string, number> = { ArrowRight: 1, ArrowLeft: -1, ArrowDown: perRow, ArrowUp: -perRow };\n const next = event.key === \"Home\" ? 0 : event.key === \"End\" ? tiles.length - 1 : at + (step[event.key] ?? 0);\n const target = tiles[Math.max(0, Math.min(tiles.length - 1, next))];\n if (target) {\n event.preventDefault();\n target.focus();\n target.click();\n }\n }}\n {...props}\n />\n );\n}\n\nexport interface ShortcutTileProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\" | \"color\"> {\n /** The tile's color (Shortcuts lets each shortcut pick one; a category's color here). */\n color: SymbolTileColor;\n /** The glyph at the top leading corner (a `SystemSymbol` with its Lucide fallback), drawn white. */\n glyph: React.ReactNode;\n /** The name, white, at the tile's foot (two lines at most). */\n title: string;\n selected?: boolean;\n onSelect?: () => void;\n /** Double-click or Return. */\n onOpen?: () => void;\n /** The run button (top trailing corner, on hover): its name is its tooltip (\"Run in AI Matrx\"). */\n run?: { label: string; onRun: () => void; icon: React.ReactNode };\n /** The tile's menu: right-click, or its More (ellipsis) button on hover. */\n menu?: ReadonlyArray<RowMenuItem>;\n}\n\n/** The round white-on-color buttons at a tile's top trailing corner (Shortcuts' play and ellipsis). */\nconst CORNER_BUTTON =\n \"flex size-control-lg items-center justify-center rounded-full text-tint-label opacity-0 transition-opacity duration-100 group-hover/tile:opacity-100 group-focus-visible/tile:opacity-100 group-data-[selected]/tile:opacity-100 data-[state=open]:opacity-100 [&_svg]:size-icon-sm\";\n\nfunction MoreGlyph(): React.JSX.Element {\n return (\n <svg viewBox=\"0 0 16 16\" aria-hidden fill=\"currentColor\">\n <circle cx=\"3\" cy=\"8\" r=\"1.5\" />\n <circle cx=\"8\" cy=\"8\" r=\"1.5\" />\n <circle cx=\"13\" cy=\"8\" r=\"1.5\" />\n </svg>\n );\n}\n\nexport function ShortcutTile({ color, glyph, title, selected, onSelect, onOpen, run, menu, className, onKeyDown, ...props }: ShortcutTileProps) {\n // A destructive item with a question asks first (the shared menu entries hand it here).\n const [asking, setAsking] = React.useState<RowMenuItem | null>(null);\n const confirm = (\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 );\n const tile = (\n <div\n role=\"option\"\n aria-selected={Boolean(selected)}\n aria-label={title}\n tabIndex={0}\n data-slot=\"shortcut-tile\"\n data-color={color}\n data-selected={selected || undefined}\n onClick={() => onSelect?.()}\n onDoubleClick={() => onOpen?.()}\n onContextMenu={() => onSelect?.()}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n if (event.key === \"Enter\" && onOpen) {\n event.preventDefault();\n onOpen();\n } else if (event.key === \" \" && run) {\n event.preventDefault();\n run.onRun();\n }\n }}\n className={cn(\n \"group/tile focus-ring relative flex h-28 cursor-default select-none flex-col justify-between rounded-group p-3 text-tint-label shadow-raised\",\n TILE_COLOR[color],\n className,\n )}\n {...props}\n >\n <span aria-hidden className=\"flex size-icon-xl items-center justify-center [&_svg]:size-icon-xl\">\n {glyph}\n </span>\n <span data-slot=\"shortcut-tile-title\" className=\"line-clamp-2 pr-1 text-body\">\n {title}\n </span>\n {run || (menu && menu.length > 0) ? (\n <span className=\"absolute right-2 top-2 flex items-center gap-1\">\n {run ? (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n aria-label={run.label}\n data-slot=\"shortcut-tile-run\"\n tabIndex={-1}\n onClick={(event) => {\n event.stopPropagation();\n run.onRun();\n }}\n onDoubleClick={(event) => event.stopPropagation()}\n className={CORNER_BUTTON}\n >\n {run.icon}\n </button>\n </TooltipTrigger>\n <TooltipContent>{run.label}</TooltipContent>\n </Tooltip>\n ) : null}\n {menu && menu.length > 0 ? (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <button\n type=\"button\"\n aria-label={`More for ${title}`}\n data-slot=\"shortcut-tile-more\"\n tabIndex={-1}\n onClick={(event) => {\n event.stopPropagation();\n onSelect?.();\n }}\n onDoubleClick={(event) => event.stopPropagation()}\n className={CORNER_BUTTON}\n >\n <MoreGlyph />\n </button>\n </DropdownMenuTrigger>\n {/* Opens from the More button toward the tile's own side (a pull-down's leading edge at\n its button), never out past the tile toward the sidebar. */}\n <DropdownMenuContent align=\"start\" data-slot=\"shortcut-tile-menu\">\n <DropdownMenuEntries items={menu} onAsk={setAsking} />\n </DropdownMenuContent>\n </DropdownMenu>\n ) : null}\n </span>\n ) : null}\n </div>\n );\n if (!menu || menu.length === 0) return tile;\n return (\n <>\n {confirm}\n <ContextMenu>\n <ContextMenuTrigger asChild>{tile}</ContextMenuTrigger>\n <ContextMenuContent data-slot=\"shortcut-tile-menu\">\n <ContextMenuEntries items={menu} onAsk={setAsking} />\n </ContextMenuContent>\n </ContextMenu>\n </>\n );\n}\n","import * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { Text } from \"./text\";\n\n/*\n * Safari's Start Page: what an empty browser tab shows — the sections (\"Favorites\") of large rounded\n * tiles, each the site's icon (or its first letter) over its name, centered in the page.\n */\n\nexport interface StartPageProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n}\n\n/** The page: its sections centered in one column on the content color, from the top, scrolling. */\nexport function StartPage({ className, children, ...props }: StartPageProps) {\n return (\n <div data-slot=\"start-page\" className={cn(\"flex h-full min-h-0 flex-col items-center overflow-y-auto bg-content px-6 pb-8 pt-12\", className)} {...props}>\n <div className=\"flex w-full max-w-2xl flex-col gap-8\">{children}</div>\n </div>\n );\n}\n\nexport interface StartPageSectionProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** \"Favorites\". */\n title: string;\n /** One quiet line under the tiles (what the section is, or how to add to it). */\n footer?: React.ReactNode;\n}\n\n/** One section: its name in bold, then its tiles in a wrapping row. */\nexport function StartPageSection({ title, footer, className, children, ...props }: StartPageSectionProps) {\n return (\n <section data-slot=\"start-page-section\" aria-label={title} className={cn(\"flex flex-col gap-3\", className)} {...props}>\n <Text as=\"h2\" variant=\"title-3\" emphasized>\n {title}\n </Text>\n <div className=\"flex flex-wrap gap-x-4 gap-y-3\">{children}</div>\n {footer ? <Text tone=\"secondary\">{footer}</Text> : null}\n </section>\n );\n}\n\nexport interface FavoriteTileProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"title\" | \"children\"> {\n /** The site's name under its tile. */\n title: string;\n /** The site's icon; without one the tile shows the name's first letter. */\n icon?: React.ReactNode;\n}\n\n/** A favorite: a 64 pt rounded tile with the site's icon or letter, its name under it; pressing it opens the site. */\nexport function FavoriteTile({ title, icon, className, ...props }: FavoriteTileProps) {\n return (\n <button type=\"button\" data-slot=\"favorite-tile\" className={cn(\"focus-ring group flex w-20 flex-col items-center gap-1.5 rounded-control p-1\", className)} {...props}>\n <span className=\"flex size-16 items-center justify-center rounded-icon-lg bg-control shadow-raised group-hover:brightness-95 [&_img]:size-8 [&_svg]:size-8\">\n {icon ?? (\n <Text variant=\"title-1\" tone=\"secondary\" aria-hidden>\n {title.slice(0, 1).toUpperCase()}\n </Text>\n )}\n </span>\n <Text truncate className=\"w-full text-center\">\n {title}\n </Text>\n </button>\n );\n}\n","import * as React from \"react\";\n\nimport { Tooltip, TooltipTrigger } from \"../tooltip\";\nimport { cn } from \"./cn\";\nimport { Text } from \"./text\";\nimport { TooltipContent } from \"./tooltip\";\n\n/*\n * App Store's parts: the shelf (a bold title, See All, lockups in columns), the lockup (the app\n * icon, its name, one line, a quiet fact, and the Get capsule), the Get capsule itself (Get, Open,\n * the download ring with its stop square, or a quiet label for what cannot be had yet), the product\n * page's header (the big icon, the name, the maker, the capsule) and its info strip (columns of a\n * caption, a large value and a quiet line, all 13 pt or larger, hairlines between them).\n */\n\n/* ---------------------------------------------------------------------------------------------- */\n/* The download ring */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface ProgressRingProps extends React.SVGAttributes<SVGSVGElement> {\n /** 0–1; null while the total is not known yet (the ring spins). */\n value: number | null;\n /** Accessible name (\"Downloading Whisper Small\"). */\n label: string;\n}\n\n/** App Store's download ring: a quiet track, the accent arc growing clockwise from the top. */\nexport function ProgressRing({ value, label, className, ...props }: ProgressRingProps) {\n const r = 10;\n const length = 2 * Math.PI * r;\n const shown = value === null ? 0.25 : Math.max(0, Math.min(1, value));\n return (\n <svg\n viewBox=\"0 0 24 24\"\n role=\"progressbar\"\n aria-label={label}\n aria-valuemin={0}\n aria-valuemax={100}\n {...(value === null ? {} : { \"aria-valuenow\": Math.round(shown * 100) })}\n data-slot=\"progress-ring\"\n data-indeterminate={value === null || undefined}\n className={cn(\"size-control shrink-0\", className)}\n {...props}\n >\n <circle cx=\"12\" cy=\"12\" r={r} fill=\"none\" strokeWidth=\"2.5\" className=\"stroke-fill-tertiary\" />\n <circle\n cx=\"12\"\n cy=\"12\"\n r={r}\n fill=\"none\"\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeDasharray={`${shown * length} ${length}`}\n transform=\"rotate(-90 12 12)\"\n className=\"stroke-tint\"\n />\n </svg>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* The Get capsule */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport type GetButtonState =\n /** Not on this computer yet: \"Get\" (or `label`). */\n | { kind: \"get\"; label?: string }\n /** Here and ready: \"Open\" (or `label`). */\n | { kind: \"open\"; label?: string }\n /** Downloading: the ring (null: not measured yet); pressing it stops the download. */\n | { kind: \"progress\"; value: number | null }\n /** Cannot be had yet (\"Soon\"): the capsule, quiet, with the reason as its tooltip. */\n | { kind: \"unavailable\"; label: string; reason: string };\n\nexport interface GetButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"onClick\" | \"children\"> {\n state: GetButtonState;\n /** What the capsule is for, read by assistive tech (\"Get Whisper Small\"). */\n name: string;\n /** Get or Open. */\n onPress?: () => void;\n /** Stop a download (the ring's square). */\n onStop?: () => void;\n}\n\n/**\n * App Store's Get capsule: a gray pill with the bold accent label (\"Get\", \"Open\"); while it\n * downloads, the ring with a stop square in it; a thing that cannot be had yet keeps the pill with a\n * quiet label and says why on hover (App Store's \"Coming Soon\" pre-order line).\n */\nexport function GetButton({ state, name, onPress, onStop, className, disabled, ...props }: GetButtonProps) {\n if (state.kind === \"progress\") {\n return (\n <button\n type=\"button\"\n data-slot=\"get-button\"\n data-state=\"progress\"\n aria-label={`Stop ${name}`}\n onClick={(event) => {\n event.stopPropagation();\n onStop?.();\n }}\n className={cn(\"focus-ring relative flex size-control-lg shrink-0 items-center justify-center rounded-full\", className)}\n {...props}\n >\n <ProgressRing value={state.value} label={`Downloading ${name}`} className=\"absolute inset-0 size-control-lg\" />\n <span aria-hidden data-slot=\"get-button-stop\" className=\"size-2 rounded-checkbox bg-tint\" />\n </button>\n );\n }\n const unavailable = state.kind === \"unavailable\";\n const label = state.kind === \"unavailable\" ? state.label : (state.label ?? (state.kind === \"open\" ? \"Open\" : \"Get\"));\n const pill = (\n <button\n type=\"button\"\n data-slot=\"get-button\"\n data-state={state.kind}\n aria-label={`${label} ${name}`}\n aria-disabled={unavailable || disabled || undefined}\n disabled={disabled}\n onClick={(event) => {\n event.stopPropagation();\n if (!unavailable) onPress?.();\n }}\n className={cn(\n \"focus-ring inline-flex h-control-lg min-w-16 shrink-0 items-center justify-center whitespace-nowrap rounded-full bg-fill-secondary px-4 text-body transition-colors duration-100 disabled:opacity-40\",\n unavailable ? \"cursor-default text-label-secondary\" : \"text-tint hover:bg-fill-tertiary\",\n className,\n )}\n {...props}\n >\n {label}\n </button>\n );\n if (!unavailable) return pill;\n return (\n <Tooltip>\n <TooltipTrigger asChild>{pill}</TooltipTrigger>\n <TooltipContent>{state.reason}</TooltipContent>\n </Tooltip>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* The shelf and its lockups */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface StoreShelfProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n title: string;\n /** One quiet line under the title (what the shelf holds). */\n subtitle?: React.ReactNode;\n /** Trailing on the title line (\"See All\", a plain Button). */\n action?: React.ReactNode;\n}\n\n/** App Store's shelf: a bold title with See All trailing, its lockups in columns under it. */\nexport function StoreShelf({ title, subtitle, action, className, children, ...props }: StoreShelfProps) {\n const id = React.useId();\n return (\n <section aria-labelledby={id} data-slot=\"store-shelf\" className={cn(\"flex flex-col gap-2\", className)} {...props}>\n <header className=\"flex items-end gap-3 border-t border-separator pt-3\">\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <Text id={id} as=\"h2\" variant=\"title-2\" emphasized truncate>\n {title}\n </Text>\n {subtitle ? (\n <Text tone=\"secondary\" truncate>\n {subtitle}\n </Text>\n ) : null}\n </span>\n {action}\n </header>\n <div data-slot=\"store-shelf-grid\" className=\"grid gap-x-6\">\n {children}\n </div>\n </section>\n );\n}\n\nexport interface StoreLockupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** The app icon: a `SymbolTile size=\"lg\"`. */\n icon: React.ReactNode;\n title: string;\n /** One line: what it is for. */\n subtitle?: React.ReactNode;\n /** One quiet fact (the size, \"Fits this computer\"). */\n detail?: React.ReactNode;\n /** The Get capsule. */\n action?: React.ReactNode;\n /** Opens its product page (a click anywhere but the capsule). */\n onOpen?: () => void;\n}\n\n/** One app in a shelf: the icon, the name, one line and one fact, the Get capsule trailing; a hairline under it. */\nexport function StoreLockup({ icon, title, subtitle, detail, action, onOpen, className, ...props }: StoreLockupProps) {\n return (\n <div data-slot=\"store-lockup\" className={cn(\"flex min-w-0 items-center gap-3 border-b border-separator py-3\", className)} {...props}>\n <button\n type=\"button\"\n data-slot=\"store-lockup-open\"\n aria-label={`${title}, details`}\n onClick={onOpen}\n className=\"focus-ring flex min-w-0 flex-1 items-center gap-3 rounded-control text-left\"\n >\n {icon}\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <Text emphasized truncate>\n {title}\n </Text>\n {subtitle ? (\n // Two lines at most, wrapped at words (App Store's lockup subtitle), never cut mid-word on one.\n <Text data-slot=\"store-lockup-subtitle\" tone=\"secondary\" className=\"line-clamp-2\">\n {subtitle}\n </Text>\n ) : null}\n {detail ? (\n <Text data-slot=\"store-lockup-detail\" tone=\"secondary\" className=\"whitespace-nowrap\">\n {detail}\n </Text>\n ) : null}\n </span>\n </button>\n {action}\n </div>\n );\n}\n\n/* ---------------------------------------------------------------------------------------------- */\n/* The product page */\n/* ---------------------------------------------------------------------------------------------- */\n\nexport interface StoreHeaderProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** The big app icon: a `SymbolTile size=\"xl\"`. */\n icon: React.ReactNode;\n title: string;\n /** The maker or the one-line pitch, under the name. */\n subtitle?: React.ReactNode;\n /** The Get capsule, under the text. */\n action?: React.ReactNode;\n /** One quiet line beside the capsule (\"Runs on this computer\"). */\n note?: React.ReactNode;\n}\n\n/** App Store's product page head: the big icon, the name in bold, the maker, the Get capsule. */\nexport function StoreHeader({ icon, title, subtitle, action, note, className, ...props }: StoreHeaderProps) {\n return (\n <header data-slot=\"store-header\" className={cn(\"flex items-center gap-6\", className)} {...props}>\n {icon}\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <Text as=\"h1\" variant=\"title-large\" emphasized truncate>\n {title}\n </Text>\n {subtitle ? (\n <Text variant=\"title-3\" tone=\"secondary\" truncate>\n {subtitle}\n </Text>\n ) : null}\n {action || note ? (\n <div className=\"mt-3 flex items-center gap-3\">\n {action}\n {note ? <Text tone=\"secondary\">{note}</Text> : null}\n </div>\n ) : null}\n </div>\n </header>\n );\n}\n\nexport interface InfoStripItem {\n /** The caption over the value (\"Size\"). */\n label: string;\n /** The large value (\"4.7 GB\"); a short word or a symbol. */\n value: React.ReactNode;\n /** The small line under it (\"Download\"). */\n caption?: React.ReactNode;\n}\n\nexport interface InfoStripProps extends React.HTMLAttributes<HTMLDListElement> {\n items: ReadonlyArray<InfoStripItem>;\n}\n\n/**\n * App Store's information strip under a product's header: equal columns, each a caption, a large\n * bold value and a quiet line (13 pt or larger), divided by short hairlines. Each column carries\n * `data-info=\"<label>\"`.\n */\nexport function InfoStrip({ items, className, ...props }: InfoStripProps) {\n return (\n <dl data-slot=\"info-strip\" className={cn(\"flex border-y border-separator py-3\", className)} {...props}>\n {items.map((item, i) => (\n <div\n key={item.label}\n data-info={item.label}\n className={cn(\"flex min-w-0 flex-1 flex-col items-center gap-0.5 px-3 text-center\", i > 0 && \"border-l border-separator\")}\n >\n {/* Every line 13 pt or larger (the desktop standard's floor), the value large and bold. */}\n <dt data-slot=\"info-strip-label\" className=\"truncate text-body text-label-secondary\">\n {item.label}\n </dt>\n <dd data-slot=\"info-strip-value\" className=\"truncate text-title-2 text-label-secondary\">\n {item.value}\n </dd>\n {item.caption ? <dd className=\"truncate text-body text-label-tertiary\">{item.caption}</dd> : null}\n </div>\n ))}\n </dl>\n );\n}\n","import * as React from \"react\";\n\nimport { formatDurationMs, groupCode } from \"@ai-matrx/kit/format\";\nimport { cn } from \"./cn\";\nimport { Text } from \"./text\";\nimport { Button } from \"../controls/controls\";\n\n/*\n * Passwords' detail pane: the head (the site's icon, its name in bold, when it last changed, Edit\n * trailing) and the grouped box of fields under it — each a label and its value on one line; a\n * secret is drawn as dots only (Passwords shows no character of it, not even a hint) and never as\n * its value; hovering or focusing a field shows its Copy button over the field's trailing edge, as\n * Passwords does — it takes no room of its own, so the value and its note use the field's width.\n */\n\nexport interface CredentialHeaderProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n /** The site's or item's icon: a `SymbolTile size=\"lg\"`. */\n icon: React.ReactNode;\n title: string;\n /** One quiet line (\"Last modified 9 October 2026\"). */\n subtitle?: React.ReactNode;\n /** Trailing at the top (Edit, Share). */\n actions?: React.ReactNode;\n}\n\nexport function CredentialHeader({ icon, title, subtitle, actions, className, ...props }: CredentialHeaderProps) {\n return (\n <header data-slot=\"credential-header\" className={cn(\"flex items-center gap-4\", className)} {...props}>\n {icon}\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <Text as=\"h1\" variant=\"title-1\" emphasized truncate>\n {title}\n </Text>\n {subtitle ? (\n <Text tone=\"secondary\" truncate>\n {subtitle}\n </Text>\n ) : null}\n </div>\n {actions ? <div className=\"flex shrink-0 items-center gap-2 self-start\">{actions}</div> : null}\n </header>\n );\n}\n\n/** The grouped box the fields sit in (System Settings' and Passwords' inset group). */\nexport function CredentialFields({ className, ...props }: React.HTMLAttributes<HTMLDListElement>) {\n return <dl data-slot=\"credential-fields\" className={cn(\"flex flex-col rounded-group bg-group px-3\", className)} {...props} />;\n}\n\nexport interface CredentialFieldProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n label: string;\n /** The value as written (a user name, a site); ignored for a secret. */\n value?: React.ReactNode;\n /** A secret: drawn as dots, never as its value nor any part of it. */\n secret?: boolean;\n /** The trailing Copy button (a small plain `Button`); shown on hover or focus. */\n copy?: React.ReactNode;\n /** One quiet line under the value (why it cannot be copied, where it is kept). */\n note?: React.ReactNode;\n /**\n * A secret's value once the person asked to see it (Passwords shows it on hover; Matrx 2 on a\n * click, since every reveal is an audited server call). Drawn in the mono face, selectable;\n * null or absent: the dots.\n */\n revealed?: string | null;\n /** Click the dots to reveal (the dots become a button named \"Show <label>\"). */\n onReveal?: () => void;\n /** A reveal is on its way: the dots stay and the button waits. */\n revealing?: boolean;\n /** Edit mode (Passwords' Edit): the field's own control in place of its value (a `TextField`). */\n editor?: React.ReactNode;\n}\n\n/** Passwords' dots: full-size bullets (U+25CF), never the small \"•\" that reads as periods. */\nexport const CREDENTIAL_DOTS = \"●●●●●●●●●●\";\n\nexport function CredentialField({ label, value, secret, copy, note, revealed, onReveal, revealing, editor, className, ...props }: CredentialFieldProps) {\n const shown = secret && typeof revealed === \"string\";\n const dots = (\n <span data-slot=\"credential-dots\" aria-label=\"Hidden\">\n {CREDENTIAL_DOTS}\n </span>\n );\n return (\n <div\n data-slot=\"credential-field\"\n data-field={label}\n data-secret={secret || undefined}\n data-revealed={shown || undefined}\n data-editing={editor ? true : undefined}\n className={cn(\"group/field relative flex min-h-row items-center gap-3 border-b border-separator py-2 last:border-b-0\", className)}\n {...props}\n >\n <dt className={cn(\"w-28 shrink-0 text-body text-label-secondary\", editor ? \"self-center\" : \"self-start pt-px\")}>{label}</dt>\n <dd className=\"flex min-w-0 flex-1 flex-col\">\n {editor ? (\n editor\n ) : (\n <span className={cn(\"min-w-0 select-text break-words text-body text-label\", secret && \"tabular-nums\", shown && \"font-mono\")}>\n {!secret ? (\n value\n ) : shown ? (\n <span data-slot=\"credential-revealed\">{revealed}</span>\n ) : onReveal ? (\n // The dots are the control (Passwords': point at them to see the password).\n <Button\n type=\"button\"\n variant=\"quiet\"\n data-slot=\"credential-reveal\"\n aria-label={`Show ${label}`}\n title={`Show ${label}`}\n disabled={revealing}\n aria-busy={revealing || undefined}\n onClick={onReveal}\n className=\"cursor-default\"\n >\n {dots}\n </Button>\n ) : (\n dots\n )}\n </span>\n )}\n {note ? <span className=\"text-body text-label-secondary\">{note}</span> : null}\n </dd>\n {copy && !editor ? (\n // Over the field's trailing edge on the group's own color (it hides what it covers while shown).\n <span\n data-slot=\"credential-copy\"\n className=\"absolute inset-y-0 right-0 flex items-center bg-group pl-2 opacity-0 transition-opacity duration-100 group-hover/field:opacity-100 group-focus-within/field:opacity-100\"\n >\n {copy}\n </span>\n ) : null}\n </div>\n );\n}\n\nexport interface TimedCodeProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, \"children\"> {\n /** The current one-time code (\"123456\"); null while it is being fetched. */\n code: string | null;\n /** When this code stops being valid (epoch ms). */\n validUntilMs: number;\n /** How long each code lasts (30 s for most authenticators). */\n periodSeconds: number;\n /** The clock, for tests (Date.now by default). */\n now?: () => number;\n /** Called once when the code runs out, so the host fetches the next one. */\n onExpire?: () => void;\n}\n\n\n/**\n * The time a code has left, as Passwords draws it: a small pie that empties clockwise from 12\n * o'clock inside a hairline circle (the circle stays when the pie is gone), in the secondary label\n * color — never a spinner's blue arc. Decorative beside the seconds its label says.\n */\nexport function CodeTimer({ fraction, label, className }: { fraction: number; label: string; className?: string }) {\n const f = Math.max(0, Math.min(1, fraction));\n const angle = f * 2 * Math.PI;\n const x = 8 + 6 * Math.sin(angle);\n const y = 8 - 6 * Math.cos(angle);\n const wedge = f >= 0.999 ? null : f <= 0.001 ? \"\" : `M8 8 L8 2 A6 6 0 ${f > 0.5 ? 1 : 0} 1 ${x.toFixed(3)} ${y.toFixed(3)} Z`;\n return (\n <svg viewBox=\"0 0 16 16\" role=\"img\" aria-label={label} data-slot=\"code-timer\" data-fraction={f.toFixed(3)} className={cn(\"size-icon shrink-0\", className)}>\n <circle cx=\"8\" cy=\"8\" r=\"7.25\" fill=\"none\" strokeWidth=\"1\" className=\"stroke-label-tertiary\" />\n {wedge === null ? <circle cx=\"8\" cy=\"8\" r=\"6\" className=\"fill-label-secondary\" /> : wedge ? <path d={wedge} className=\"fill-label-secondary\" /> : null}\n </svg>\n );\n}\n\n/**\n * Passwords' verification code: the code in two groups, in the text face with even digits (never a\n * code face), beside a pie of the time it has left. Ticks once a second while shown.\n */\nexport function TimedCode({ code, validUntilMs, periodSeconds, now = Date.now, onExpire, className, ...props }: TimedCodeProps) {\n const [at, setAt] = React.useState(() => now());\n const expired = React.useRef(false);\n React.useEffect(() => {\n expired.current = false;\n const id = setInterval(() => setAt(now()), 1000);\n return () => clearInterval(id);\n }, [validUntilMs, now]);\n const left = Math.max(0, validUntilMs - at);\n React.useEffect(() => {\n if (left === 0 && !expired.current) {\n expired.current = true;\n onExpire?.();\n }\n }, [left, onExpire]);\n const seconds = Math.ceil(left / 1000);\n const fraction = periodSeconds > 0 ? Math.min(1, left / (periodSeconds * 1000)) : 0;\n return (\n <span data-slot=\"timed-code\" data-seconds-left={seconds} className={cn(\"inline-flex items-center gap-2\", className)} {...props}>\n <span className=\"select-text tabular-nums text-body text-label\">{code ? groupCode(code) : \"●●● ●●●\"}</span>\n <CodeTimer fraction={fraction} label={`${formatDurationMs(seconds * 1000, { style: \"long\" })} left`} />\n </span>\n );\n}\n","import * as ProgressPrimitive from \"@radix-ui/react-progress\";\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` colors 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\nexport interface SparklineProps {\n [data: `data-${string}`]: string | undefined;\n /** Oldest first. Fewer than two values draws nothing but the frame. */\n values: ReadonlyArray<number>;\n /** The top of the graph; defaults to the largest value. */\n max?: number;\n /** A dashed reference line (a capacity, a comfort limit), in the same units as the values. */\n mark?: number;\n /** `level` colors the line by the latest value's fullness (one threshold rule with Meter). */\n kind?: \"level\" | \"progress\";\n /** Axis context: what the top of the graph means (\"100%\", \"16 GB\"). Drawn at the top-right. */\n topLabel?: string;\n /** Axis context: how far back the left edge is (\"1 hour ago\"). The right edge always reads \"Now\". */\n span?: string;\n \"aria-label\": string;\n className?: string;\n}\n\nconst SPARK_W = 300;\nconst SPARK_H = 40;\n\n/** A history line, Activity Monitor's CPU Load and Memory Pressure graphs: stretches to its width. */\nexport function Sparkline({ values, max, mark, kind = \"progress\", topLabel, span, className, \"aria-label\": ariaLabel, ...data }: SparklineProps) {\n const top = Math.max(max ?? 0, ...values, mark ?? 0, 1e-9);\n const y = (v: number) => SPARK_H - 1 - Math.min(1, Math.max(0, v / top)) * (SPARK_H - 2);\n const n = values.length;\n const points = n < 2 ? \"\" : values.map((v, i) => `${((i / (n - 1)) * SPARK_W).toFixed(1)},${y(v).toFixed(1)}`).join(\" \");\n const tone = kind === \"level\" && n ? meterTone(values[n - 1]! / top) : \"progress\";\n const graph = (\n <svg\n {...data}\n role=\"img\"\n aria-label={ariaLabel}\n data-slot=\"sparkline\"\n viewBox={`0 0 ${SPARK_W} ${SPARK_H}`}\n preserveAspectRatio=\"none\"\n className={cn(\n // Activity Monitor's graph: a hairline-framed plot on the content color, the history a\n // filled area under its line (CPU Load's blue, Memory Pressure's green).\n \"block h-10 w-full rounded-control border border-separator bg-content\",\n tone === \"progress\" && \"text-tint\",\n tone === \"normal\" && \"text-system-green\",\n tone === \"warning\" && \"text-system-orange\",\n tone === \"critical\" && \"text-system-red\",\n className,\n )}\n >\n {mark !== undefined ? (\n <line x1={0} x2={SPARK_W} y1={y(mark)} y2={y(mark)} className=\"stroke-label-tertiary\" strokeDasharray=\"3 3\" vectorEffect=\"non-scaling-stroke\" />\n ) : null}\n {points ? <polygon data-slot=\"sparkline-area\" points={`0,${SPARK_H} ${points} ${SPARK_W},${SPARK_H}`} fill=\"currentColor\" fillOpacity={0.28} stroke=\"none\" /> : null}\n {points ? <polyline points={points} fill=\"none\" stroke=\"currentColor\" strokeWidth={1.5} vectorEffect=\"non-scaling-stroke\" /> : null}\n </svg>\n );\n if (!topLabel && !span) return graph;\n // Axis context (Activity Monitor) sits OUTSIDE the plot: the scale on a line above it, the time\n // span underneath, so a label never collides with the line it describes.\n return (\n <div data-slot=\"sparkline-frame\" className=\"flex w-full flex-col gap-0.5\">\n {topLabel ? (\n <div aria-hidden data-slot=\"sparkline-scale\" className=\"text-right text-subheadline tabular-nums text-label-tertiary\">\n {topLabel}\n </div>\n ) : null}\n {graph}\n {span ? (\n <div aria-hidden className=\"flex justify-between text-subheadline text-label-tertiary\">\n <span>{span}</span>\n <span>Now</span>\n </div>\n ) : null}\n </div>\n );\n}\n\nexport interface LevelIndicatorProps {\n [data: `data-${string}`]: string | undefined;\n /** 0 … 100: how much of the scale is lit. `null` while there is no reading (every dot unlit). */\n value: number | null;\n /** How many dots the scale has (Sound's Input level: 15). */\n segments?: number;\n \"aria-label\": string;\n className?: string;\n}\n\n/**\n * NSLevelIndicator's discrete style, as Sound's \"Input level\" draws it: a row of small round dots,\n * lit from the leading edge as the level rises, the rest a quiet fill. Live: the caller feeds it\n * many times a second (a microphone's level); it never animates on its own.\n */\nexport function LevelIndicator({ value, segments = 15, className, \"aria-label\": ariaLabel, ...data }: LevelIndicatorProps) {\n const count = Math.max(1, Math.round(segments));\n const level = value === null ? 0 : Math.min(100, Math.max(0, value));\n const lit = Math.round((level / 100) * count);\n return (\n <div\n {...data}\n role=\"meter\"\n aria-label={ariaLabel}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={value === null ? undefined : Math.round(level)}\n data-slot=\"level-indicator\"\n data-lit={lit}\n className={cn(\"inline-flex items-center gap-1.5\", className)}\n >\n {Array.from({ length: count }, (_, i) => (\n <span key={i} aria-hidden data-on={i < lit ? \"\" : undefined} className={cn(\"size-2 shrink-0 rounded-full\", i < lit ? \"bg-label-secondary\" : \"bg-fill-tertiary\")} />\n ))}\n </div>\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 DISK sizes in decimal units (1 GB = 1,000,000,000 bytes: Finder, Disk\n * Utility) and MEMORY in binary units still labeled \"GB\" (1 GB = 1,073,741,824 bytes: Activity\n * Monitor, About This Mac). `formatBytes` is for files and disks, `formatMemory` for memory; the\n * same 256 GB of RAM never reads \"275 GB\" anywhere.\n *\n * The size, duration and age voices are @ai-matrx/kit/format's, named here for desktop screens. Finder's\n * Date Modified voice is `formatFinderDate`; list date headings are `groupByDateSection`.\n */\n\nimport { formatDurationMs, formatFileSize, formatRelativeTime } from \"@ai-matrx/kit/format\";\n\nconst DAY_MS = 86_400_000;\n\n/** A file or disk size the way Finder shows it: \"45.3 GB\", \"420 MB\", \"512 bytes\". */\nexport function formatBytes(bytes: number | null | undefined): string {\n return formatFileSize(bytes, { base: 1000 });\n}\n\n/** \"3 sec\", \"4 min 5 sec\", \"2 hr 5 min\", \"3 days 4 hr\" — the two largest units. */\nexport function formatDuration(ms: number | null | undefined): string {\n return formatDurationMs(ms, { style: \"long\", parts: 2, abbreviate: true });\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 return formatRelativeTime(at, {\n suffix: false,\n minUnit: \"minute\",\n absoluteAfter: 7 * DAY_MS,\n absolute: \"monthDay\",\n now,\n });\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 disk is used, in the same words everywhere: \"183 GB of 500 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\nconst MEMORY_UNITS = [\"bytes\", \"KB\", \"MB\", \"GB\", \"TB\"] as const;\n\n/**\n * Memory the way Activity Monitor shows it: binary units labeled KB/MB/GB (\"16.26 GB\", \"747.4 MB\",\n * \"256 GB\" for 256 × 2³⁰ bytes). Two decimals in GB, one in MB, none in KB; \".00\" dropped.\n */\nexport function formatMemory(bytes: number | null | undefined): string {\n if (bytes === null || bytes === undefined || !Number.isFinite(bytes)) return \"—\";\n if (bytes < 1024) return `${Math.round(bytes)} ${bytes === 1 ? \"byte\" : \"bytes\"}`;\n let value = bytes;\n let unit = 0;\n while (value >= 1024 && unit < MEMORY_UNITS.length - 1) {\n value /= 1024;\n unit += 1;\n }\n const digits = unit >= 3 ? 2 : unit === 2 ? 1 : 0;\n return `${value.toFixed(digits).replace(/\\.0+$/, \"\")} ${MEMORY_UNITS[unit]}`;\n}\n\n/** How much memory is used, in the same words everywhere: \"149.23 GB of 256 GB in use\". */\nexport function formatMemoryUsage(used: number | null | undefined, total: number | null | undefined): string {\n if (used === null || used === undefined || total === null || total === undefined) return \"—\";\n return `${formatMemory(used)} of ${formatMemory(total)} in use`;\n}\n\n/** Midnight of the day `at` falls on, in the person's own time zone. */\nfunction startOfLocalDay(at: Date): number {\n return new Date(at.getFullYear(), at.getMonth(), at.getDate()).getTime();\n}\n\n/** Whole calendar days from `at` to `now` (0 = the same day, 1 = yesterday), counted across DST changes. */\nfunction calendarDaysAgo(at: Date, now: Date): number {\n return Math.round((startOfLocalDay(now) - startOfLocalDay(at)) / DAY_MS);\n}\n\nfunction toDate(at: Date | number | string | null | undefined): Date | null {\n if (at === null || at === undefined) return null;\n const time = at instanceof Date ? at.getTime() : typeof at === \"string\" ? Date.parse(at) : at;\n return Number.isFinite(time) ? new Date(time) : null;\n}\n\nexport interface FinderDateOptions {\n /** \"Today\" is decided against this (default: the current time). */\n now?: Date | number;\n /** The locale for the day and the time (default: the person's own). */\n locale?: string;\n}\n\n/**\n * Finder's Date Modified / Date Created voice: \"Today at 6:23 AM\", \"Yesterday at 9:10 PM\", else\n * \"Oct 9, 2026 at 6:23 AM\". Days are calendar days in the person's time zone, never 24-hour spans.\n * The ONE copy: a screen never writes its own (guarded in matrx-desktop's unit tests).\n */\nexport function formatFinderDate(at: Date | number | string | null | undefined, options: FinderDateOptions = {}): string {\n const date = toDate(at);\n if (!date) return \"--\";\n const now = options.now === undefined ? new Date() : new Date(options.now);\n const days = calendarDaysAgo(date, now);\n const day =\n days === 0\n ? \"Today\"\n : days === 1\n ? \"Yesterday\"\n : date.toLocaleDateString(options.locale, { month: \"short\", day: \"numeric\", year: \"numeric\" });\n const time = options.locale ? new Intl.DateTimeFormat(options.locale, { hour: \"numeric\", minute: \"2-digit\" }).format(date) : formatClockTime(date);\n return `${day} at ${time}`;\n}\n\n/** Which date section a row falls in (Notes', Mail's and the chats sidebar's list headings). */\nexport type DateSectionKey = \"today\" | \"yesterday\" | \"previous-7-days\" | \"previous-30-days\" | `month:${number}-${number}` | `year:${number}` | \"undated\";\n\nexport interface DateSection {\n key: DateSectionKey;\n /** \"Today\", \"Yesterday\", \"Previous 7 Days\", \"Previous 30 Days\", \"September\", \"2025\", \"No Date\". */\n title: string;\n}\n\n/**\n * The date section of one time, as Apple Notes heads its list: Today, Yesterday, Previous 7 Days,\n * Previous 30 Days, then each earlier month of this year by name (\"September\"), then each earlier\n * year (\"2025\"). Calendar days in the person's time zone; a time ahead of `now` counts as Today.\n */\nexport function dateSectionOf(at: Date | number | string | null | undefined, options: FinderDateOptions = {}): DateSection {\n const date = toDate(at);\n if (!date) return { key: \"undated\", title: \"No Date\" };\n const now = options.now === undefined ? new Date() : new Date(options.now);\n const days = calendarDaysAgo(date, now);\n if (days <= 0) return { key: \"today\", title: \"Today\" };\n if (days === 1) return { key: \"yesterday\", title: \"Yesterday\" };\n if (days <= 7) return { key: \"previous-7-days\", title: \"Previous 7 Days\" };\n if (days <= 30) return { key: \"previous-30-days\", title: \"Previous 30 Days\" };\n if (date.getFullYear() === now.getFullYear()) {\n return { key: `month:${date.getFullYear()}-${date.getMonth() + 1}`, title: date.toLocaleDateString(options.locale, { month: \"long\" }) };\n }\n return { key: `year:${date.getFullYear()}`, title: String(date.getFullYear()) };\n}\n\nexport interface DatedSection<T> extends DateSection {\n items: T[];\n}\n\n/**\n * Rows into their date sections, in the order given (sort newest first before calling): one section\n * per key, in the order its first row appears, each row kept in its own order. Undated rows go last.\n */\nexport function groupByDateSection<T>(\n items: readonly T[],\n whenOf: (item: T) => Date | number | string | null | undefined,\n options: FinderDateOptions = {},\n): DatedSection<T>[] {\n const sections = new Map<DateSectionKey, DatedSection<T>>();\n let undated: DatedSection<T> | null = null;\n for (const item of items) {\n const section = dateSectionOf(whenOf(item), options);\n if (section.key === \"undated\") {\n undated ??= { ...section, items: [] };\n undated.items.push(item);\n continue;\n }\n const existing = sections.get(section.key);\n if (existing) existing.items.push(item);\n else sections.set(section.key, { ...section, items: [item] });\n }\n return undated ? [...sections.values(), undated] : [...sections.values()];\n}\n","\"use client\";\n\n/**\n * @ai-matrx/design-system/desktop — THE DESKTOP STANDARD.\n *\n * A desktop app imports its UI from this entry ONLY (lint-enforced in the app). Everything here is\n * sized by the named scale in `desktop.css`; nothing takes a raw size or color. Rules: DESKTOP.md.\n */\n\n// Foundations\nexport { cn } from \"./cn\";\nexport { MiddleTruncate, Text, TEXT_STYLE_POINTS, TEXT_TONE, type TextProps, type TextTone, type TextVariant } from \"./text\";\nexport { Spinner, type SpinnerProps } from \"./spinner\";\n\n// Controls\nexport { Button, IconButton, LinkButton, buttonVariants, type ButtonProps, type IconButtonProps, type LinkButtonProps } from \"./button\";\nexport { SearchField, TextArea, TextField, FIELD, type SearchFieldProps, type TextAreaProps, type TextFieldProps } from \"./field\";\nexport { Select, type SelectOption, type SelectProps } from \"./select\";\nexport { Segmented, type Segment, type SegmentedProps } from \"./segmented\";\nexport { Checkbox, Switch, type CheckboxProps, type SwitchProps } from \"./controls\";\n\n// Layout\nexport { NoticeSlot, Notices, Page, PageHeader, Toolbar, ToolbarDivider, ToolbarSpacer, type PageHeaderProps, type PageProps, type PageWidth, type ToolbarProps } from \"./layout\";\n// The window layer: OS-drawn symbols, the unified toolbar a title-less PageHeader moves into, and the\n// navigator column of the window's areas (with its Customize sheet).\nexport {\n moveItem,\n NavigatorColumn,\n NavigatorCustomizeSheet,\n NavigatorItem,\n SymbolProvider,\n SystemSymbol,\n ToolbarGroup,\n WindowToolbarActions,\n WindowToolbarProvider,\n WindowToolbarTitle,\n useWindowToolbarFull,\n useWindowToolbarOwnsMore,\n WindowToolbarHostMenu,\n type NavigatorCustomizeItem,\n type NavigatorCustomizeSheetProps,\n type NavigatorItemProps,\n type SymbolImage,\n type SymbolResolver,\n type SymbolWeight,\n type SystemSymbolProps,\n type WindowToolbarTitleProps,\n} from \"./native\";\nexport { FieldRow, Row, Section, SectionContent, type FieldRowProps, type RowProps, type SectionProps } from \"./group\";\n// System Settings pane parts: the pane header, buttons in or under a group, the (i) button, the usage bar, Displays' arrangement.\nexport { DisplayArrangement, InfoButton, PaneHeader, SectionButtons, UsageBar, type ArrangedDisplay, type DisplayArrangementProps, type InfoButtonProps, type PaneHeaderProps, type SectionButtonsProps, type UsageBarProps, type UsageColor, type UsageSegment } from \"./settings\";\n// System Settings' sliders, the \"?\" help button, Screen Time's activity chart and date stepper.\nexport { ActivityChart, DateStepper, GroupTable, HelpButton, Slider, type ActivityBar, type ActivityChartProps, type DateStepperProps, type GroupTableColumn, type GroupTableProps, type GroupTableRow, type HelpButtonProps, type SliderProps } from \"./settings-controls\";\nexport { CodeBlock, TERMINAL_PROFILE, type CodeBlockProps } from \"./code-block\";\n// Activity Monitor's inspector: a utility panel over the window, not a sheet.\nexport { InspectorPanel, type InspectorPanelProps } from \"./inspector-panel\";\n// A toolbar pull-down of actions (Activity Monitor's \"…\" with its arrow).\nexport { PullDownButton, type PullDownButtonProps } from \"./pull-down\";\n// NSToolbar's overflow: items that do not fit move, lowest priority first, into a » menu.\nexport { ToolbarOverflow, type ToolbarOverflowItem, type ToolbarOverflowProps } from \"./toolbar-overflow\";\n// The document apps' parts (Get Info, Reminders, the empty Notes list, the status bar, Simulator's\n// device, FileMerge's panes).\nexport {\n ChecklistAddRow,\n ChecklistRow,\n CompareLines,\n CompareView,\n type CompareChange,\n DeviceFrame,\n Disclosure,\n EmptyContent,\n InfoFacts,\n InfoHeader,\n ListHeading,\n SourceText,\n StatusBar,\n type SourceLanguage,\n type ChecklistAddRowProps,\n type ChecklistRowProps,\n type CompareLinesProps,\n type ComparePane,\n type CompareViewProps,\n type DeviceFrameProps,\n type DisclosureProps,\n type EmptyContentProps,\n type InfoFact,\n type InfoFactsProps,\n type InfoHeaderProps,\n type ListHeadingProps,\n type ListColor,\n type StatusBarProps,\n} from \"./document\";\n// The monitor apps' parts (Activity Monitor's summary strip, System Information's facts, Finder's\n// path bar, Console's scope bar).\nexport {\n FactList,\n PathBar,\n ScopeBar,\n SummaryFact,\n SummaryPane,\n SummaryStrip,\n type Fact,\n type FactListProps,\n type PathBarItem,\n type Scope,\n type ScopeBarProps,\n type SummaryFactProps,\n type SummaryPaneProps,\n} from \"./monitor\";\nexport { CONSOLE_LINE_PX, LogView, LOG_LINE_PX, type LogColumns, type LogLine, type LogViewProps } from \"./log-view\";\nexport { IconView, IconViewItem, type IconViewItemProps, type IconViewProps } from \"./icon-view\";\nexport { ColumnBrowser, type ColumnBrowserColumn, type ColumnBrowserProps } from \"./column-browser\";\nexport { QuickLookSheet, type QuickLookSheetProps } from \"./quick-look\";\nexport { baseNameEnd, RenameField, type RenameFieldProps } from \"./rename-field\";\nexport { DataTable, NameCell, StateCell, type StateCellProps, columnKind, initiallyHiddenColumns, type ColumnKind, type NameCellProps, type Column, type DataTableProps, type RowAction, type RowMenuItem, type SortState, type TableGroups } from \"./table\";\nexport { ClearFiltersButton, EMPTY_TABLE_FILTER, TableFilterBar, TableFilterMenu, TableFilterTokens, columnName, filterActive, filterChoices, filterRows, filterValues, tableFilters, type ColumnFilter, type ColumnValuesFilter, type FilterChoice, type FilterableColumn, type TableFilterBarProps, type TableFilterMenuProps, type TableFilterState } from \"./table-filter\";\nexport { ContextMenuEntries, DropdownMenuEntries, MenuItemLabel } from \"./menu-entries\";\nexport {\n SourceList,\n SourceListItem,\n SourceListMore,\n SourceListSection,\n type SourceListProps,\n type SourceListItemProps,\n type SourceListMoreProps,\n type SourceListSectionProps,\n} from \"./source-list\";\n// Mail's, Messages' and Notes' window body: the split view and its message list.\nexport { MessageList, UnreadDot, type MessageListProps } from \"./message-list\";\nexport { SplitView, type SplitViewProps } from \"./split-view\";\n// NSSplitView's lower pane: a pane under the content whose top edge the person drags (Console's detail, a server's log).\nexport { ResizablePane, type ResizablePaneProps } from \"./resizable-pane\";\nexport { EdgeResizer, type EdgeResizerProps } from \"./edge-resizer\";\n// Messages' and FaceTime's parts: the avatar, the centered conversation header, the composer, the call buttons.\nexport { Avatar, CallButton, ConversationHeader, MessageComposer, type AvatarProps, type CallButtonProps, type ConversationHeaderProps, type MessageComposerProps } from \"./conversation\";\n// Voice Memos' parts: the waveform with its playhead (and the peaks it draws), the Record button.\nexport { peaksOf, RecordButton, Waveform, type RecordButtonProps, type WaveformProps } from \"./media\";\n\n// Data and placeholders\nexport { Resource, type ResourceProps, type ResourceState } from \"./resource\";\nexport { ComingSoon, type ComingSoonProps } from \"./coming-soon\";\nexport { SymbolTile, tileColorFor, type SymbolTileColor, type SymbolTileProps, type SymbolTileSize } from \"./tile\";\n// Shortcuts' library (a grid of colored tiles with a run button), App Store's shelves, lockups, Get\n// capsule, download ring, product header and info strip, and Passwords' detail (head and fields).\nexport { ShortcutTile, TileGrid, type ShortcutTileProps, type TileGridProps } from \"./library\";\n// Safari's Start Page (an empty browser tab): sections of favorite tiles.\nexport { FavoriteTile, StartPage, StartPageSection, type FavoriteTileProps, type StartPageProps, type StartPageSectionProps } from \"./start-page\";\nexport {\n GetButton,\n InfoStrip,\n ProgressRing,\n StoreHeader,\n StoreLockup,\n StoreShelf,\n type GetButtonProps,\n type GetButtonState,\n type InfoStripItem,\n type InfoStripProps,\n type ProgressRingProps,\n type StoreHeaderProps,\n type StoreLockupProps,\n type StoreShelfProps,\n} from \"./store\";\nexport { CREDENTIAL_DOTS, CredentialField, CredentialFields, CredentialHeader, TimedCode, type CredentialFieldProps, type CredentialHeaderProps, type TimedCodeProps } from \"./credentials\";\n\n// Status and feedback\nexport { Banner, ErrorBanner, StateView, type BannerProps, type BannerTone, type ErrorBannerProps, type StateViewProps } from \"./state\";\nexport { LevelIndicator, Meter, METER_THRESHOLDS, meterTone, Sparkline, type LevelIndicatorProps, type MeterProps, type SparklineProps } from \"./meter\";\nexport { Kbd, PlaceMark, PlaceStrip, RemovableTag, StatusLight, Tag, type PlaceMarkProps, type RemovableTagProps, type PlaceMarkState, type StatusLightProps, type StatusTone as StatusLightTone, type TagProps, type TagTone } from \"./tag\";\n\n// Errors: the one wording layer (an actionable cause; the raw text kept as detail).\nexport { describeError, type DescribedError } from \"./errors\";\n\n// Formatting\nexport {\n dateSectionOf,\n errorMessage,\n formatAge,\n formatBytes,\n formatClockTime,\n formatDuration,\n formatFinderDate,\n formatMemory,\n formatMemoryUsage,\n formatUsage,\n groupByDateSection,\n type DatedSection,\n type DateSection,\n type DateSectionKey,\n type FinderDateOptions,\n} from \"./format\";\n/** Counts (tokens, rows): the one count voice, \"1,234,567\" or compact \"1.2m\" (kit).*/\nexport { formatCount, formatRelativeTime } from \"@ai-matrx/kit/format\";\n\n// Overlays and menus: the shared Radix primitives, unchanged.\nexport { clipTooltipText, Tooltip, TooltipProvider, TooltipTrigger, TOOLTIP_TEXT_BUDGET, type TooltipContentProps } from \"../tooltip\";\nexport { TooltipContent } from \"./tooltip\";\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from \"../dropdown-menu\";\nexport {\n ContextMenu,\n ContextMenuContent,\n ContextMenuItem,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuTrigger,\n} from \"../context-menu\";\nexport { Dialog, DialogClose, DialogTrigger } from \"../dialog\";\n// Dialogs are macOS sheets: attached to the window under the toolbar, desktop type and density.\nexport { ConfirmDialog, DialogBody, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, NativeConfirmProvider, type NativeConfirm, type NativeConfirmRequest } from \"./sheet\";\nexport type { ConfirmDialogProps } from \"../confirm-dialog\";\nexport { ConfirmDialogHost } from \"../confirm-host\";\nexport { Popover, PopoverAnchor, PopoverTrigger } from \"../popover\";\n// NSPopover's look (rounded material panel with an arrow); the web keeps the shared PopoverContent.\nexport { PopoverContent, POPOVER_ARROW, type DesktopPopoverContentProps } from \"./popover\";\nexport { ListRow, type ListRowProps } from \"./list-row\";\nexport { InfoHint, INFO_HINT_MAX, infoHintText, type InfoHintProps } from \"./info-hint\";\nexport { Collapsible, CollapsibleContent, CollapsibleTrigger } from \"../collapsible\";\nexport { Skeleton } from \"../skeleton\";\n\n// App shell (rail, mode switch) and identity.\nexport * from \"../app-shell/index\";\nexport { OrganizationMark, organizationColor } from \"../organization-picker\";\nexport { OrganizationPickerSheet, type DesktopPickerOrganization, type OrganizationPickerSheetProps } from \"./organization-picker\";\n","\"use client\";\n\n/**\n * The desktop's popover: NSPopover's look over the shared Radix popover (`../popover`), which the\n * web keeps as it is. A rounded 12 pt panel of translucent, blurred popover material with the\n * popover shadow and an arrow pointing at what opened it (the arrow is on by default; `arrow={false}`\n * for a popover anchored to nothing visible). The body scrolls inside the panel, so the arrow is\n * never clipped. Same props as the shared PopoverContent.\n */\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { PopoverContent as BasePopoverContent, type PopoverContentProps as BasePopoverContentProps } from \"../popover\";\n\nexport interface DesktopPopoverContentProps extends BasePopoverContentProps {\n /** NSPopover's arrow toward the anchor. Default true. */\n arrow?: boolean;\n}\n\n/** Arrow size (pt): NSPopover's is about 18 wide, 9 tall. */\nexport const POPOVER_ARROW = { width: 18, height: 9 } as const;\n\nexport const PopoverContent = React.forwardRef<React.ComponentRef<typeof PopoverPrimitive.Content>, DesktopPopoverContentProps>(\n ({ arrow = true, sideOffset, className, children, ...props }, ref) => (\n <BasePopoverContent\n ref={ref}\n sideOffset={sideOffset ?? (arrow ? POPOVER_ARROW.height + 2 : 4)}\n data-slot=\"desktop-popover\"\n data-arrow={arrow ? \"\" : undefined}\n // The panel itself never scrolls (it would clip the arrow): its body does.\n className={cn(\"overflow-visible\", className)}\n {...props}\n >\n <div data-slot=\"desktop-popover-body\" className=\"overflow-y-auto overscroll-contain\">\n {children}\n </div>\n {arrow ? <PopoverPrimitive.Arrow data-slot=\"desktop-popover-arrow\" width={POPOVER_ARROW.width} height={POPOVER_ARROW.height} /> : null}\n </BasePopoverContent>\n ),\n);\nPopoverContent.displayName = \"DesktopPopoverContent\";\n","\"use client\";\n\n/**\n * One row of a list in a popover, a sidebar-less list or an inspector (Safari's Downloads, Control\n * Center's lists): a leading icon, a title, secondary text under it, and a trailing accessory (a\n * button, a progress ring, a chevron). With `onSelect` the row is one button (the accessory's own\n * controls stay separate); without it, a plain row. 13 pt title, secondary at the same size in the\n * secondary label color.\n */\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { Tile } from \"../controls/surfaces\";\n\nexport interface ListRowProps {\n /** Leading icon or tile (an SF Symbol, a file icon). */\n icon?: React.ReactNode;\n title: React.ReactNode;\n /** The line under the title (size, status, where it is). */\n secondary?: React.ReactNode;\n /** Trailing control or status (a Show in Finder button, progress, a chevron). */\n accessory?: React.ReactNode;\n /** Makes the row itself a button. */\n onSelect?: () => void;\n selected?: boolean;\n disabled?: boolean;\n className?: string;\n \"aria-label\"?: string;\n}\n\nexport function ListRow({ icon, title, secondary, accessory, onSelect, selected = false, disabled = false, className, \"aria-label\": ariaLabel }: ListRowProps): React.JSX.Element {\n const body = (\n <>\n {icon ? (\n <span data-slot=\"list-row-icon\" className=\"flex size-icon-xl shrink-0 items-center justify-center\">\n {icon}\n </span>\n ) : null}\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span data-slot=\"list-row-title\" className={cn(\"truncate text-body\", disabled ? \"text-label-tertiary\" : \"text-label\")}>\n {title}\n </span>\n {secondary ? (\n <span data-slot=\"list-row-secondary\" className={cn(\"truncate text-body\", disabled ? \"text-label-quaternary\" : \"text-label-secondary\")}>\n {secondary}\n </span>\n ) : null}\n </span>\n </>\n );\n const rowClass = cn(\n \"flex min-h-row w-full items-center gap-2 rounded-control px-2 py-1 text-left\",\n selected && \"bg-selection-muted\",\n className,\n );\n return (\n <div data-slot=\"list-row\" data-selected={selected ? \"\" : undefined} className={onSelect ? \"flex items-center gap-1\" : rowClass}>\n {onSelect ? (\n <Tile type=\"button\" data-slot=\"list-row-button\" aria-label={ariaLabel} title={body} selected={selected} disabled={disabled} onClick={onSelect} className=\"min-w-0 flex-1\" variant=\"quiet\" hoverStyle=\"fill\" />\n ) : (\n body\n )}\n {accessory ? (\n <span data-slot=\"list-row-accessory\" className=\"flex shrink-0 items-center gap-1\">\n {accessory}\n </span>\n ) : null}\n </div>\n );\n}\n","\"use client\";\n\n/**\n * A small hint beside a setting or a heading (System Settings' ⓘ): an info.circle in the secondary\n * label color that opens a native popover (the desktop PopoverContent: material, arrow) with one\n * or two sentences. A real button, so Tab reaches it and Space/Return opens it; its accessible label\n * says what it explains. The text is a hint, not documentation: at most INFO_HINT_MAX characters.\n * A longer text is cut there with an ellipsis AND reported with console.error naming the hint, so it\n * is never a silent cut.\n */\nimport * as React from \"react\";\n\nimport { Popover, PopoverTrigger } from \"../popover\";\nimport { SystemSymbol } from \"./native\";\nimport { Button } from \"../controls/controls\";\nimport { PopoverContent } from \"./popover\";\n\nexport const INFO_HINT_MAX = 140;\n\nexport interface InfoHintProps {\n /** What the hint explains, for the accessible label (\"About Start with the app\"). */\n label: string;\n /** The hint itself: one or two sentences, at most INFO_HINT_MAX characters. */\n text: string;\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n className?: string;\n}\n\n/** The text as shown: itself, or cut at INFO_HINT_MAX with an ellipsis (and reported). */\nexport function infoHintText(label: string, text: string): string {\n if (text.length <= INFO_HINT_MAX) return text;\n console.error(`[InfoHint] \"${label}\": the hint is ${text.length} characters; the cap is ${INFO_HINT_MAX}. It is cut. Shorten it.`);\n return `${text.slice(0, INFO_HINT_MAX - 1).trimEnd()}…`;\n}\n\nfunction InfoGlyph(): React.JSX.Element {\n return (\n <svg viewBox=\"0 0 16 16\" className=\"size-icon-sm\" aria-hidden=\"true\">\n <circle cx=\"8\" cy=\"8\" r=\"6.5\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.2\" />\n <circle cx=\"8\" cy=\"5\" r=\"0.9\" fill=\"currentColor\" />\n <rect x=\"7.4\" y=\"6.8\" width=\"1.2\" height=\"4.6\" rx=\"0.6\" fill=\"currentColor\" />\n </svg>\n );\n}\n\nexport function InfoHint({ label, text, side = \"top\", className }: InfoHintProps): React.JSX.Element {\n const shown = React.useMemo(() => infoHintText(label, text), [label, text]);\n return (\n <Popover>\n <PopoverTrigger asChild>\n <Button\n type=\"button\"\n variant=\"quiet\"\n aria-label={label}\n icon={<SystemSymbol name=\"info.circle\" size={13} fallback={<InfoGlyph />} />}\n data-slot=\"info-hint\"\n className={className}\n />\n </PopoverTrigger>\n <PopoverContent side={side} width=\"sm\" padding=\"sm\" data-info-hint-popover=\"\" aria-label={label}>\n <p className=\"text-body text-label\">{shown}</p>\n </PopoverContent>\n </Popover>\n );\n}\n","import * as React from \"react\";\n\nimport { Dialog } from \"../dialog\";\nimport { StarIcon } from \"../icons\";\nimport { matchesOrganizationQuery, OrganizationMark, orderOrganizationsForPicker } from \"../organization-picker\";\nimport { Button, IconButton } from \"./button\";\nimport { SearchField } from \"./field\";\nimport { SystemSymbol } from \"./native\";\nimport { DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from \"./sheet\";\nimport { StateView } from \"./state\";\nimport { DataTable, type Column } from \"./table\";\nimport { Text } from \"./text\";\n\n/**\n * \"Other organizations…\": the desktop organization picker, as Wi-Fi › Other Networks is a sheet\n * over the window — a search field, a table (a star column, Name, Role; headers sort), and Cancel /\n * Switch (the default, primary). The order and the search are the root OrganizationPicker's own\n * (`orderOrganizationsForPicker`, `matchesOrganizationQuery`): favorites, then the person's own,\n * then the rest. The star favorites; it never selects (a sibling of the row's choice, as in the\n * web picker). It picks nothing on its own: Switch hands the chosen row to the host.\n */\n\nexport interface DesktopPickerOrganization {\n id: string;\n name: string;\n abbreviation?: string | null;\n logoUrl?: string | null;\n /** owner | admin | member */\n role?: string | null;\n isOwn?: boolean;\n}\n\nexport interface OrganizationPickerSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n organizations: readonly DesktopPickerOrganization[];\n activeOrganizationId: string | null;\n favoriteOrganizationIds: readonly string[];\n /** Switch to the chosen organization (the sheet closes). */\n onSwitch: (organizationId: string) => void;\n /** Star (true) or unstar (false). Omit to draw the stars read-only. */\n onToggleFavorite?: (organizationId: string, favorite: boolean) => void;\n}\n\nconst ROLE: Record<string, string> = { owner: \"Owner\", admin: \"Admin\", member: \"Member\" };\n\nfunction roleLabel(role: string | null | undefined): string {\n return (role && ROLE[role]) || (role ? role.charAt(0).toUpperCase() + role.slice(1) : \"Member\");\n}\n\nexport function OrganizationPickerSheet({\n open,\n onOpenChange,\n organizations,\n activeOrganizationId,\n favoriteOrganizationIds,\n onSwitch,\n onToggleFavorite,\n}: OrganizationPickerSheetProps) {\n const [query, setQuery] = React.useState(\"\");\n const [chosen, setChosen] = React.useState<string | null>(activeOrganizationId);\n React.useEffect(() => {\n if (open) {\n setQuery(\"\");\n setChosen(activeOrganizationId);\n }\n }, [open, activeOrganizationId]);\n\n const favorites = new Set(favoriteOrganizationIds);\n const rows = orderOrganizationsForPicker(organizations, favoriteOrganizationIds).filter((o) => matchesOrganizationQuery(o, query));\n const columns: Column<DesktopPickerOrganization>[] = [\n {\n key: \"favorite\",\n header: <span className=\"sr-only\">Favorite</span>,\n title: \"Favorite\",\n kind: \"action\",\n cell: (o) => {\n const on = favorites.has(o.id);\n const label = on ? `Remove ${o.name} from favorites` : `Add ${o.name} to favorites`;\n return onToggleFavorite ? (\n <IconButton\n data-org-favorite={on ? \"on\" : \"off\"}\n aria-pressed={on}\n size=\"sm\"\n label={label}\n icon={<SystemSymbol name={on ? \"star.fill\" : \"star\"} size={12} fallback={<StarIcon className={on ? \"size-icon-sm fill-current\" : \"size-icon-sm\"} />} />}\n onClick={(event) => {\n event.stopPropagation();\n onToggleFavorite(o.id, !on);\n }}\n />\n ) : on ? (\n <SystemSymbol name=\"star.fill\" size={12} aria-label=\"Favorite\" fallback={<StarIcon className=\"size-icon-sm fill-current\" />} />\n ) : null;\n },\n sort: (a, b) => Number(favorites.has(b.id)) - Number(favorites.has(a.id)),\n },\n {\n key: \"name\",\n header: \"Name\",\n kind: \"flex\",\n cell: (o) => (\n <span className=\"flex min-w-0 items-center gap-2\">\n <OrganizationMark id={o.id} name={o.name} abbreviation={o.abbreviation} logoUrl={o.logoUrl} size={16} />\n <Text truncate>{o.name}</Text>\n </span>\n ),\n sort: (a, b) => a.name.localeCompare(b.name),\n },\n { key: \"role\", header: \"Role\", kind: \"text\", cell: (o) => roleLabel(o.role), sort: (a, b) => roleLabel(a.role).localeCompare(roleLabel(b.role)) },\n ];\n\n const canSwitch = chosen !== null && chosen !== activeOrganizationId && organizations.some((o) => o.id === chosen);\n return (\n <Dialog modal open={open} onOpenChange={onOpenChange}>\n <DialogContent data-organization-sheet=\"\" className=\"max-w-form\">\n <DialogHeader>\n <DialogTitle>Choose an organization</DialogTitle>\n <DialogDescription>Everything you make goes into the organization you choose.</DialogDescription>\n </DialogHeader>\n <SearchField data-organization-search aria-label=\"Search organizations\" value={query} onValueChange={setQuery} />\n <div className=\"max-h-80 overflow-y-auto\">\n <DataTable\n aria-label=\"Organizations\"\n columns={columns}\n rows={rows}\n rowKey={(o) => o.id}\n selectedKey={chosen}\n onRowSelect={(o) => setChosen(o.id)}\n onRowOpen={(o) => {\n onSwitch(o.id);\n onOpenChange(false);\n }}\n rowData={(o) => ({ \"data-organization-row\": o.id, \"data-active\": o.id === activeOrganizationId ? \"true\" : undefined })}\n empty={<StateView kind=\"empty\" title=\"No matches\" />}\n />\n </div>\n <DialogFooter>\n <Button data-organization-cancel onClick={() => onOpenChange(false)}>\n Cancel\n </Button>\n <Button\n data-organization-switch\n variant=\"primary\"\n disabled={!canSwitch}\n onClick={() => {\n if (!chosen) return;\n onSwitch(chosen);\n onOpenChange(false);\n }}\n >\n Switch\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\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,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACA,QAAQ,CAAC,WAAW,QAAQ,SAAS,OAAO;AAAA,MAC5C,WAAW,CAAC,QAAQ,QAAQ,MAAM;AAAA,MAClC,MAAM,CAAC,eAAe,WAAW,WAAW,WAAW,YAAY,QAAQ,WAAW,eAAe,YAAY,WAAW,aAAa,QA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QACC,cAAW;AAAA,QACX;AAAA,QACA;AAAA,QACA,QAAQ,CAAC,MAAM,EAAE;AAAA,QACjB,aAAa;AAAA,QACb,aAAa,CAAC,MAAM,UAAU,EAAE,EAAE;AAAA,QAClC,WAAW,CAAC,MAAM;AAChB,mBAAS,EAAE,EAAE;AACb,uBAAa,KAAK;AAAA,QACpB;AAAA,QACA,SAAS,CAAC,OAAO,EAAE,yBAAyB,EAAE,IAAI,eAAe,EAAE,OAAO,uBAAuB,SAAS,OAAU;AAAA,QACpH,OAAO,gBAAAA,MAAC,aAAU,MAAK,SAAQ,OAAM,cAAa;AAAA;AAAA,IACpD,GACF;AAAA,IACA,gBAAAC,OAACK,eAAA,EACC;AAAA,sBAAAN,MAACO,SAAA,EAAO,4BAAwB,MAAC,SAAS,MAAM,aAAa,KAAK,GAAG,oBAErE;AAAA,MACA,gBAAAP;AAAA,QAACO;AAAA,QAAA;AAAA,UACC,4BAAwB;AAAA,UACxB,SAAQ;AAAA,UACR,UAAU,CAAC;AAAA,UACX,SAAS,MAAM;AACb,gBAAI,CAAC,OAAQ;AACb,qBAAS,MAAM;AACf,yBAAa,KAAK;AAAA,UACpB;AAAA,UACD;AAAA;AAAA,MAED;AAAA,OACF;AAAA,KACF,GACF;AAEJ;","names":["cn","Text","Tag","cn","jsx","cn","React","React","jsx","TooltipContent","jsx","jsxs","Button","cn","IconButton","TooltipContent","LinkButton","React","jsx","jsxs","TextField","cn","TextArea","SearchField","jsx","jsxs","cn","jsx","cn","React","jsx","Checkbox","cn","Switch","React","React","React","jsx","jsxs","DialogContent","cn","DialogHeader","DialogFooter","DialogTitle","DialogDescription","Button","jsx","jsxs","key","cn","NavigatorItem","TooltipContent","item","DialogContent","DialogHeader","DialogTitle","DialogDescription","DialogFooter","Button","Fragment","jsx","jsxs","cn","Page","React","Fragment","jsx","jsxs","cn","Row","field","React","jsx","jsxs","cn","InfoButton","jsx","jsxs","cn","React","jsx","cn","React","createPortal","jsx","jsxs","createPortal","cn","React","Fragment","jsx","jsxs","item","Fragment","jsx","jsxs","cn","TooltipContent","React","jsx","jsxs","style","item","cn","React","jsx","jsxs","cn","merge","React","jsx","jsxs","cn","item","React","jsx","jsxs","cn","Button","jsx","jsxs","cn","React","jsx","jsxs","item","cn","key","jsx","jsxs","DialogContent","DialogTitle","DialogDescription","Button","React","jsx","cn","React","jsx","jsxs","cn","React","jsx","jsxs","cn","Button","copied","React","Fragment","jsx","jsxs","key","Button","cn","Fragment","jsx","jsxs","bar","key","cn","outline","Button","React","jsx","jsxs","cn","SourceListItem","React","Fragment","jsx","jsxs","key","list","cn","jsx","jsxs","cn","React","jsx","jsxs","cn","jsx","STEP","cn","jsx","jsxs","cn","React","jsx","jsxs","cn","RecordButton","copyText","Fragment","jsx","jsxs","Button","copyText","jsx","jsxs","cn","jsx","SIZE","key","cn","React","Fragment","jsx","jsxs","cn","TooltipContent","jsx","jsxs","cn","React","jsx","jsxs","cn","TooltipContent","item","React","jsx","jsxs","cn","jsx","jsxs","cn","formatDurationMs","item","formatRelativeTime","React","jsx","jsxs","PopoverContent","Fragment","jsx","jsxs","React","jsx","jsxs","InfoGlyph","PopoverContent","React","jsx","jsxs","DialogContent","DialogHeader","DialogTitle","DialogDescription","DialogFooter","Button"]}
|