@lukeashford/aurelius 4.8.0 → 4.10.0
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/dist/index.d.mts +51 -3
- package/dist/index.d.ts +51 -3
- package/dist/index.js +58 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -19
- package/dist/index.mjs.map +1 -1
- package/dist/styles/deliverable.css +357 -72
- package/dist/styles/fonts/0QI8MX1D_JOuMw_hLdO6T2wV9KnW-MoFoq92nPWc3ZyhTg.woff2 +0 -0
- package/dist/styles/fonts/0QI8MX1D_JOuMw_hLdO6T2wV9KnW-MoFoqF2nPWc3ZyhTjcV.woff2 +0 -0
- package/dist/styles/fonts/0QIvMX1D_JOuMwT7I_FMl_GW8g.woff2 +0 -0
- package/dist/styles/fonts/0QIvMX1D_JOuMwr7I_FMl_E.woff2 +0 -0
- package/dist/styles/fonts/4UaErEJDsxBrF37olUeD_xHM8pxULilENlY.woff2 +0 -0
- package/dist/styles/fonts/4UaHrEJDsxBrF37olUeD96rp57F2IwM.woff2 +0 -0
- package/dist/styles/fonts/OFL_ComicNeue.txt +93 -0
- package/dist/styles/fonts/OFL_Inter.txt +93 -0
- package/dist/styles/fonts/OFL_Lora.txt +93 -0
- package/dist/styles/fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1ZL7W0Q5nw.woff2 +0 -0
- package/dist/styles/fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa25L7W0Q5n-wU.woff2 +0 -0
- package/dist/styles/fonts.css +84 -0
- package/llms.md +2 -1
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/components/Button.tsx","../src/utils/cx.ts","../src/components/Input.tsx","../src/components/Card.tsx","../src/utils/clipboard.ts","../src/utils/textareaCaret.ts","../src/utils/hooks.ts","../src/components/Skeleton.tsx","../src/components/Container.tsx","../src/components/Row.tsx","../src/components/Col.tsx","../src/components/Stack.tsx","../src/components/Divider.tsx","../src/components/Avatar.tsx","../src/components/Badge.tsx","../src/components/Tooltip.tsx","../src/components/Table.tsx","../src/components/List.tsx","../src/components/FileChip.tsx","../src/components/MentionChip.tsx","../src/components/Combobox.tsx","../src/components/AttachmentPreview.tsx","../src/components/Label.tsx","../src/components/HelperText.tsx","../src/components/Textarea.tsx","../src/components/Select.tsx","../src/components/Checkbox.tsx","../src/components/Radio.tsx","../src/components/Switch.tsx","../src/components/Slider.tsx","../src/components/InputGroup.tsx","../src/components/Alert.tsx","../src/components/Spinner.tsx","../src/components/Progress.tsx","../src/components/Toast.tsx","../src/components/Modal.tsx","../src/components/Lightbox.tsx","../src/components/icons/ChatBubbleIcon.tsx","../src/components/icons/ChevronLeftIcon.tsx","../src/components/icons/ChevronRightIcon.tsx","../src/components/icons/CloseIcon.tsx","../src/components/icons/ExpandIcon.tsx","../src/components/icons/HistoryIcon.tsx","../src/components/icons/LayersIcon.tsx","../src/components/icons/MediaIcon.tsx","../src/components/icons/PlusIcon.tsx","../src/components/icons/CheckSquareIcon.tsx","../src/components/icons/EmptySquareIcon.tsx","../src/components/icons/CrossSquareIcon.tsx","../src/components/icons/SquareLoaderIcon.tsx","../src/components/Drawer.tsx","../src/components/Popover.tsx","../src/components/Dialog.tsx","../src/components/Tabs.tsx","../src/components/Accordion.tsx","../src/components/Menu.tsx","../src/components/Navbar.tsx","../src/components/Breadcrumb.tsx","../src/components/Pagination.tsx","../src/components/Stepper.tsx","../src/components/Message.tsx","../src/components/MarkdownContent.tsx","../src/utils/remarkMentions.ts","../src/components/StreamingCursor.tsx","../src/components/chat/ChatInterface.tsx","../src/components/chat/ChatView.tsx","../src/components/chat/hooks/useScrollAnchor.ts","../src/components/chat/hooks/useAdaptiveSpacer.ts","../src/components/chat/ThinkingIndicator.tsx","../src/components/chat/Checkpoint.tsx","../src/components/chat/GreyedDivider.tsx","../src/components/chat/ChatInput.tsx","../src/components/chat/types.ts","../src/components/chat/ArtifactsPanel.tsx","../src/components/ArtifactCard.tsx","../src/components/ImageCard.tsx","../src/components/VideoCard.tsx","../src/components/AudioCard.tsx","../src/components/PdfCard.tsx","../src/components/ScriptCard.tsx","../src/components/TextCard.tsx","../src/components/DeliverableCard.tsx","../src/utils/artifactLoading.ts","../src/components/ArtifactGroup.tsx","../src/components/ArtifactVariantStack.tsx","../src/components/ArtifactLightboxBody.tsx","../src/components/deliverable/DeliverableRenderer.tsx","../src/components/deliverable/CoverSection.tsx","../src/components/deliverable/ArtifactImageGridSection.tsx","../src/components/deliverable/ArtifactSpotlightSection.tsx","../src/components/deliverable/TextBlockSection.tsx","../src/components/deliverable/ColorPaletteSection.tsx","../src/components/deliverable/QuoteBlockSection.tsx","../src/components/chat/hooks/useResizable.ts","../src/components/chat/hooks/useArtifactTreeNavigation.ts","../src/components/chat/HistoryPanel.tsx","../src/components/chat/TodosList.tsx","../src/components/chat/ToolSidebar.tsx","../src/components/chat/ToolPanelContainer.tsx","../src/components/chat/tree.ts","../src/components/chat/MessageActions.tsx","../src/components/chat/BranchNavigator.tsx","../src/components/BrandIcon.tsx","../src/components/ColorSwatch.tsx","../src/components/SectionHeading.tsx","../src/components/ArtifactNode.ts"],"sourcesContent":["/**\n * Aurelius Design System\n *\n * A cohesive visual language for creative technologists.\n * Combines technical sophistication with artistic sensibility.\n *\n * CSS-first Tailwind v4 design system.\n * Import '@lukeashford/aurelius/styles/base.css' for complete styling.\n */\n\n// React components\nexport * from './components'\n\n// Utilities consumers commonly need (caret coords for inline autocompletes, etc.)\nexport {getTextareaCaretCoords, type TextareaCaretCoords} from './utils/textareaCaret'\n\n// Version\nexport const version = '2.0.0'\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type ButtonVariant =\n | 'primary'\n | 'important'\n | 'elevated'\n | 'outlined'\n | 'featured'\n | 'ghost'\n | 'danger'\n\nexport type ButtonSize = 'sm' | 'md' | 'lg' | 'xl'\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: ButtonVariant\n size?: ButtonSize\n loading?: boolean\n}\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({variant = 'primary', size = 'md', loading = false, className, disabled, children, ...rest},\n ref) => {\n const isDisabled = disabled || loading\n\n // Base button styles - common to all variants\n const base =\n 'inline-flex items-center justify-center font-semibold tracking-wide ' +\n 'transition-all duration-fast ' +\n 'rounded-none ' +\n 'disabled:opacity-50 disabled:cursor-not-allowed'\n\n // Variant styles\n const variantClasses = {\n primary:\n 'bg-charcoal text-white border border-gold/30 ' +\n 'hover:border-gold hover:shadow-glow hover:text-gold-light ' +\n 'active:bg-white/5 ' +\n 'focus-visible:ring-2 focus-visible:ring-gold focus-visible:ring-offset-2 ' +\n 'focus-visible:ring-offset-obsidian',\n\n important:\n 'bg-gold text-obsidian border border-gold ' +\n 'hover:bg-gold-light hover:text-obsidian ' +\n 'active:bg-gold-bright ' +\n 'focus-visible:ring-2 focus-visible:ring-gold focus-visible:ring-offset-2 ' +\n 'focus-visible:ring-offset-obsidian',\n\n elevated:\n 'bg-charcoal text-white border-0 shadow-lg ' +\n 'hover:shadow-xl hover:text-gold-light ' +\n 'active:bg-white/5 ' +\n 'focus-visible:ring-2 focus-visible:ring-gold focus-visible:ring-offset-2 ' +\n 'focus-visible:ring-offset-obsidian',\n\n outlined:\n 'bg-transparent text-white border border-ash ' +\n 'hover:border-white hover:text-white ' +\n 'active:bg-white/5 ' +\n 'focus-visible:ring-2 focus-visible:ring-gold focus-visible:ring-offset-2 ' +\n 'focus-visible:ring-offset-obsidian',\n\n featured:\n 'bg-charcoal text-white border border-gold ' +\n 'glow-sm ' +\n 'hover:glow-md hover:text-gold-light ' +\n 'active:bg-white/5 ' +\n 'focus-visible:ring-2 focus-visible:ring-gold focus-visible:ring-offset-2 ' +\n 'focus-visible:ring-offset-obsidian',\n\n ghost:\n 'bg-transparent text-gold border-0 ' +\n 'hover:text-gold-light ' +\n 'active:text-gold-bright ' +\n 'focus-visible:ring-2 focus-visible:ring-gold focus-visible:ring-offset-2 ' +\n 'focus-visible:ring-offset-obsidian',\n\n danger:\n 'bg-error text-white border-0 ' +\n 'hover:bg-error/90 ' +\n 'active:bg-error/80 ' +\n 'focus-visible:ring-2 focus-visible:ring-error focus-visible:ring-offset-2 ' +\n 'focus-visible:ring-offset-obsidian',\n }\n\n // Size styles\n const sizeClasses = {\n sm: 'h-8 px-3 text-sm',\n md: 'h-10 px-4 text-sm',\n lg: 'h-12 px-6 text-base',\n xl: 'h-14 px-8 text-lg',\n }\n\n const variantClass = variantClasses[variant]\n const sizeClass = sizeClasses[size]\n\n return (\n <button\n ref={ref}\n className={cx(base, variantClass, sizeClass, loading && 'opacity-80', className)}\n disabled={isDisabled}\n {...rest}\n >\n {loading && (\n <span\n className=\"mr-2 inline-block h-4 w-4 animate-pulse rounded-full bg-gold\"\n aria-hidden\n />\n )}\n {children}\n </button>\n )\n }\n)\n\nButton.displayName = 'Button'\n\nexport default Button\n","import {twMerge} from 'tailwind-merge';\nimport {type ClassValue, clsx} from 'clsx';\n\n/**\n * Concatenates class names and merges Tailwind utility classes correctly.\n * Uses clsx for conditional classes and tailwind-merge to handle overrides.\n */\nexport function cx(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {\n error?: boolean\n leadingIcon?: React.ReactNode\n trailingIcon?: React.ReactNode\n}\n\nexport const Input = React.forwardRef<HTMLInputElement, InputProps>(\n ({error = false, className, leadingIcon, trailingIcon, disabled, ...rest}, ref) => {\n const base =\n 'w-full h-10 px-3 bg-graphite border border-ash rounded-none ' +\n 'text-white placeholder:text-zinc ' +\n 'transition-all duration-fast ' +\n 'focus:border-gold focus:ring-1 focus:ring-gold focus:outline-none ' +\n 'disabled:bg-slate disabled:text-dim disabled:cursor-not-allowed'\n\n const errorCls = error ? 'border-error focus:border-error focus:ring-error' : ''\n\n return (\n <div className={cx('relative', disabled && 'opacity-90')}>\n {leadingIcon && (\n <span\n className=\"pointer-events-none absolute inset-y-0 left-3 flex items-center text-silver\">\n {leadingIcon}\n </span>\n )}\n <input\n ref={ref}\n className={cx(\n base,\n errorCls,\n leadingIcon ? 'pl-9' : false,\n trailingIcon ? 'pr-9' : false,\n className\n )}\n disabled={disabled}\n {...rest}\n />\n {trailingIcon && (\n <span\n className=\"pointer-events-none absolute inset-y-0 right-3 flex items-center text-silver\">\n {trailingIcon}\n </span>\n )}\n </div>\n )\n }\n)\n\nInput.displayName = 'Input'\n\nexport default Input\n","import React, {createContext, useContext, useState} from 'react'\nimport {Check} from 'lucide-react'\nimport {copyToClipboard, cx} from '../utils'\nimport {Skeleton} from './Skeleton'\n\nexport type CardVariant = 'default' | 'elevated' | 'outlined' | 'ghost' | 'featured'\n\nexport type CardSlotLoading = {\n header?: {\n title?: boolean\n subtitle?: boolean\n action?: boolean\n }\n media?: boolean\n body?: boolean\n footer?: boolean\n}\n\ninterface CardContextValue {\n loading?: CardSlotLoading\n}\n\nconst CardContext = createContext<CardContextValue>({loading: undefined})\n\nconst useCardContext = () => useContext(CardContext)\n\ntype HeaderField = keyof NonNullable<CardSlotLoading['header']>\ntype TopLevelKey = Exclude<keyof CardSlotLoading, 'header'>\ntype SlotPath = TopLevelKey | ['header', HeaderField]\n\nexport function slotLoading(\n loading: CardSlotLoading | undefined,\n path: SlotPath\n): boolean {\n if (!loading) {\n return false\n }\n if (Array.isArray(path)) {\n return !!loading.header?.[path[1]]\n }\n return !!loading[path]\n}\n\nexport interface CardProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: CardVariant\n interactive?: boolean\n selected?: boolean\n noPadding?: boolean\n loading?: CardSlotLoading\n}\n\nconst VARIANT_STYLES: Record<CardVariant, string> = {\n default: 'bg-charcoal shadow-sm border border-gold/30',\n elevated: 'bg-charcoal shadow-lg border-0',\n outlined: 'bg-charcoal shadow-none border border-ash',\n ghost: 'bg-transparent shadow-none border-0',\n featured: 'bg-charcoal border border-gold glow-sm',\n}\n\nconst CardBase = React.forwardRef<HTMLDivElement, CardProps>(\n (\n {\n variant = 'default',\n interactive = false,\n selected = false,\n noPadding = false,\n loading,\n className,\n children,\n ...props\n },\n ref\n ) => {\n return (\n <CardContext.Provider value={{loading}}>\n <div\n ref={ref}\n className={cx(\n 'rounded-none relative transition-opacity duration-500',\n !noPadding && 'p-6',\n VARIANT_STYLES[variant],\n interactive &&\n 'transition-all duration-200 hover:border-gold hover:shadow-glow cursor-pointer',\n selected && 'border-gold shadow-glow-md',\n className\n )}\n {...props}\n >\n {children}\n {selected && (\n <div\n className=\"absolute top-3 right-3 flex items-center justify-center h-6 w-6 rounded-full bg-gold text-obsidian\">\n <Check className=\"h-4 w-4\"/>\n </div>\n )}\n </div>\n </CardContext.Provider>\n )\n }\n)\n\nCardBase.displayName = 'Card'\n\n// Card.Header - header section with title and optional actions\nexport interface CardHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {\n title?: React.ReactNode\n subtitle?: React.ReactNode\n action?: React.ReactNode\n /**\n * Optional addressable handle (the artifact's `name` / `@-handle`). Renders\n * as a tertiary monospace line below the subtitle, prefixed with `@`. Click\n * copies `@<handle>` to the clipboard and pulses the handle once. Use to\n * surface the typed identifier filmmakers reference in chat.\n */\n handle?: string\n}\n\nconst CardHeader = React.forwardRef<HTMLDivElement, CardHeaderProps>(\n ({title, subtitle, action, handle, className, children, ...props}, ref) => {\n const {loading} = useCardContext()\n const titleIsLoading = slotLoading(loading, ['header', 'title'])\n const subtitleIsLoading = slotLoading(loading, ['header', 'subtitle'])\n const actionIsLoading = slotLoading(loading, ['header', 'action'])\n\n const hasContent = title || subtitle || action || handle || children\n\n if (!hasContent && !titleIsLoading && !subtitleIsLoading && !actionIsLoading) {\n return null\n }\n\n return (\n <div\n ref={ref}\n className={cx('px-6 py-4 border-b border-ash', className)}\n {...props}\n >\n {(title || subtitle || action || handle\n || titleIsLoading || subtitleIsLoading || actionIsLoading)\n ? (\n <div className=\"flex items-start justify-between gap-4\">\n <div className=\"flex-1 min-w-0\">\n {title ? (\n <h3 className=\"text-lg font-semibold text-white m-0\">{title}</h3>\n ) : titleIsLoading ? (\n <Skeleton className=\"h-5 w-3/4 mb-1\"/>\n ) : null}\n {subtitle ? (\n <p className=\"text-sm text-silver mt-1 m-0\">{subtitle}</p>\n ) : subtitleIsLoading ? (\n <Skeleton className=\"h-4 w-1/2 mt-1\"/>\n ) : null}\n {handle && <CardHandle handle={handle}/>}\n </div>\n {action ? (\n <div className=\"shrink-0\">{action}</div>\n ) : actionIsLoading ? (\n <Skeleton className=\"h-8 w-8 shrink-0\"/>\n ) : null}\n </div>\n ) : (\n children\n )}\n </div>\n )\n }\n)\n\n/**\n * Click-to-copy `@-handle` line. Rendered automatically by `Card.Header` when\n * its `handle` prop is set; exposed standalone as `Card.Handle` for custom\n * card layouts that don't use `Card.Header` (e.g. `DeliverableCard`).\n */\nexport interface CardHandleProps {\n handle: string\n}\n\nconst CardHandle: React.FC<CardHandleProps> = ({handle}) => {\n const [pulseKey, setPulseKey] = useState(0)\n const handleClick = (e: React.MouseEvent) => {\n e.stopPropagation()\n void copyToClipboard(`@${handle}`)\n setPulseKey(k => k + 1)\n }\n return (\n <button\n type=\"button\"\n onClick={handleClick}\n // `key` resets the animation so consecutive clicks pulse again.\n key={pulseKey}\n className={cx(\n 'mt-1 inline-flex items-center font-mono text-xs text-gold/70',\n 'hover:text-gold transition-colors',\n 'animate-pulse-once px-1 -mx-1',\n )}\n aria-label={`Copy @${handle} to clipboard`}\n title={`Copy @${handle} to clipboard`}\n >\n <span className=\"opacity-60\">@</span>{handle}\n </button>\n )\n}\n\nCardHeader.displayName = 'CardHeader'\n\n// Card.Body - main content area\nexport interface CardBodyProps extends React.HTMLAttributes<HTMLDivElement> {\n}\n\nconst CardBody = React.forwardRef<HTMLDivElement, CardBodyProps>(\n ({className, children, ...props}, ref) => {\n const {loading} = useCardContext()\n const isBodyLoading = slotLoading(loading, 'body')\n\n if (!children && !isBodyLoading) {\n return null\n }\n\n return (\n <div ref={ref} className={cx('px-6 py-4', className)} {...props}>\n {isBodyLoading ? (\n <div className=\"space-y-2\">\n <Skeleton className=\"h-4 w-full\"/>\n <Skeleton className=\"h-4 w-full\"/>\n <Skeleton className=\"h-4 w-3/4\"/>\n </div>\n ) : (\n children\n )}\n </div>\n )\n }\n)\n\nCardBody.displayName = 'CardBody'\n\n// Card.Footer - footer section, typically for actions\nexport interface CardFooterProps extends React.HTMLAttributes<HTMLDivElement> {\n align?: 'start' | 'center' | 'end' | 'between'\n}\n\nconst CardFooter = React.forwardRef<HTMLDivElement, CardFooterProps>(\n ({align = 'end', className, children, ...props}, ref) => {\n const alignClass = {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n between: 'justify-between',\n }[align]\n\n return (\n <div\n ref={ref}\n className={cx(\n 'px-6 py-4 border-t border-ash flex items-center gap-3',\n alignClass,\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nCardFooter.displayName = 'CardFooter'\n\n// Card.Media - image or media section\nexport interface CardMediaProps extends React.HTMLAttributes<HTMLDivElement> {\n aspect?: 'video' | 'square' | 'wide' | 'none'\n position?: 'top' | 'bottom'\n}\n\nconst CardMedia = React.forwardRef<HTMLDivElement, CardMediaProps>(\n ({\n aspect,\n position = 'top',\n className,\n children,\n ...props\n }, ref) => {\n const {loading} = useCardContext()\n const isMediaLoading = slotLoading(loading, 'media')\n const aspectClass = aspect && aspect !== 'none' ? {\n video: 'aspect-video',\n square: 'aspect-square',\n wide: 'aspect-wide',\n }[aspect] : ''\n\n if (!children && !isMediaLoading) {\n return null\n }\n\n return (\n <div\n ref={ref}\n className={cx(\n 'overflow-hidden relative',\n aspectClass,\n position === 'top' && 'border-b border-ash',\n position === 'bottom' && 'border-t border-ash',\n className\n )}\n {...props}\n >\n {isMediaLoading ? (\n <Skeleton className=\"w-full h-full\"/>\n ) : (\n children\n )}\n </div>\n )\n }\n)\n\nCardMedia.displayName = 'CardMedia'\n\nCardHandle.displayName = 'CardHandle'\n\n// Compound component pattern\nexport const Card = Object.assign(CardBase, {\n Header: CardHeader,\n Body: CardBody,\n Footer: CardFooter,\n Media: CardMedia,\n Handle: CardHandle,\n})","/**\n * Copy text to the clipboard via the async Clipboard API.\n *\n * Falls back to a hidden-textarea + `document.execCommand('copy')` for\n * environments where `navigator.clipboard` is unavailable (e.g. older\n * browsers or non-secure contexts).\n *\n * Returns `true` on success, `false` on failure. Never throws.\n */\nexport async function copyToClipboard(text: string): Promise<boolean> {\n if (typeof navigator !== 'undefined' && navigator.clipboard) {\n try {\n await navigator.clipboard.writeText(text)\n return true\n } catch {\n // fall through to legacy path\n }\n }\n\n if (typeof document === 'undefined') {\n return false\n }\n\n const textArea = document.createElement('textarea')\n textArea.value = text\n textArea.setAttribute('readonly', '')\n textArea.setAttribute('aria-hidden', 'true')\n textArea.style.position = 'fixed'\n textArea.style.opacity = '0'\n textArea.style.pointerEvents = 'none'\n document.body.appendChild(textArea)\n try {\n textArea.select()\n return document.execCommand('copy')\n } catch {\n return false\n } finally {\n document.body.removeChild(textArea)\n }\n}\n","/**\n * Returns the pixel offset of the caret inside a textarea, relative to the textarea's own\n * top-left. Use with `textarea.getBoundingClientRect()` to compute viewport / page coords\n * — typically for anchoring an `@`-mention or slash-command popover at the cursor.\n *\n * Implementation is the standard mirror-div technique: clone the textarea's text-affecting\n * styles into a hidden `<div>`, fill it with the value up to the caret, drop a marker\n * span at the caret position, and read the span's offset.\n */\nconst PROPERTIES_TO_MIRROR = [\n 'boxSizing',\n 'width',\n 'height',\n 'overflowX',\n 'overflowY',\n 'borderTopWidth',\n 'borderRightWidth',\n 'borderBottomWidth',\n 'borderLeftWidth',\n 'borderStyle',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'fontStyle',\n 'fontVariant',\n 'fontWeight',\n 'fontStretch',\n 'fontSize',\n 'fontSizeAdjust',\n 'lineHeight',\n 'fontFamily',\n 'textAlign',\n 'textTransform',\n 'textIndent',\n 'textDecoration',\n 'letterSpacing',\n 'wordSpacing',\n 'tabSize',\n] as const\n\nexport interface TextareaCaretCoords {\n /** Top of the caret, in pixels relative to the textarea's top-left. */\n top: number\n /** Left of the caret, in pixels relative to the textarea's top-left. */\n left: number\n /** Caret line height in pixels — useful when positioning a popover just above/below. */\n height: number\n}\n\nexport function getTextareaCaretCoords(textarea: HTMLTextAreaElement): TextareaCaretCoords {\n const mirror = document.createElement('div')\n mirror.setAttribute('aria-hidden', 'true')\n document.body.appendChild(mirror)\n\n const computed = window.getComputedStyle(textarea)\n const style = mirror.style\n\n style.position = 'absolute'\n style.visibility = 'hidden'\n style.whiteSpace = 'pre-wrap'\n style.wordWrap = 'break-word'\n style.top = '0'\n style.left = '-9999px'\n\n for (const prop of PROPERTIES_TO_MIRROR) {\n style[prop] = computed[prop]\n }\n\n // Textareas have a scrollbar that affects layout in some browsers; mirror it.\n style.overflow = 'hidden'\n\n mirror.textContent = textarea.value.substring(0, textarea.selectionStart)\n\n const marker = document.createElement('span')\n // Non-empty content is required so the span has measurable position.\n marker.textContent = textarea.value.substring(textarea.selectionStart) || '.'\n mirror.appendChild(marker)\n\n const top = marker.offsetTop - textarea.scrollTop\n const left = marker.offsetLeft - textarea.scrollLeft\n const height = parseInt(computed.lineHeight, 10) || parseInt(computed.fontSize, 10)\n\n document.body.removeChild(mirror)\n\n return {top, left, height}\n}\n","import {useCallback, useEffect, useRef, useState} from 'react'\nimport type {Ref} from 'react'\nimport {copyToClipboard} from './clipboard'\n\n/**\n * Compose multiple refs (callback or object) into a single callback ref.\n *\n * Useful when a component needs to attach an internal ref while still\n * forwarding a ref provided by its consumer.\n *\n * The return type is a plain function so it stays assignable across\n * duplicate @types/react resolutions (e.g. tests vs. source).\n */\nexport function composeRefs<T>(\n ...refs: Array<Ref<T> | undefined>\n): (node: T | null) => void {\n return (node: T | null) => {\n for (const ref of refs) {\n if (!ref) {\n continue\n }\n if (typeof ref === 'function') {\n ref(node)\n } else {\n // React's MutableRefObject — `current` is writable\n ;(ref as React.MutableRefObject<T | null>).current = node\n }\n }\n }\n}\n\n/**\n * Lock document scroll while `isLocked` is true. Multiple components can lock\n * concurrently — the lock is released only when every locker has released.\n *\n * Preserves and restores the original `body.overflow` and `body.paddingRight`\n * values so we don't clobber consumer styles.\n */\nlet scrollLockCount = 0\nlet scrollLockOriginalOverflow: string | null = null\nlet scrollLockOriginalPaddingRight: string | null = null\n\nexport function useScrollLock(isLocked: boolean): void {\n useEffect(() => {\n if (!isLocked || typeof document === 'undefined') {\n return\n }\n\n if (scrollLockCount === 0) {\n scrollLockOriginalOverflow = document.body.style.overflow\n scrollLockOriginalPaddingRight = document.body.style.paddingRight\n const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth\n document.body.style.overflow = 'hidden'\n if (scrollbarWidth > 0) {\n document.body.style.paddingRight = `${scrollbarWidth}px`\n }\n }\n scrollLockCount++\n\n return () => {\n scrollLockCount--\n if (scrollLockCount === 0) {\n document.body.style.overflow = scrollLockOriginalOverflow ?? ''\n document.body.style.paddingRight = scrollLockOriginalPaddingRight ?? ''\n scrollLockOriginalOverflow = null\n scrollLockOriginalPaddingRight = null\n }\n }\n }, [isLocked])\n}\n\n/**\n * Call `onEscape` whenever the user presses the Escape key while `isActive`\n * is true. Listens on `window`.\n */\nexport function useEscapeKey(onEscape: () => void, isActive = true): void {\n useEffect(() => {\n if (!isActive || typeof window === 'undefined') {\n return\n }\n const handler = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n onEscape()\n }\n }\n window.addEventListener('keydown', handler)\n return () => window.removeEventListener('keydown', handler)\n }, [onEscape, isActive])\n}\n\n/**\n * Call `handler` when a `mousedown` event occurs outside of `ref`'s element.\n * Disabled when `isActive` is false.\n */\nexport function useClickOutside<T extends HTMLElement>(\n ref: React.RefObject<T | null>,\n handler: (event: MouseEvent) => void,\n isActive = true,\n): void {\n useEffect(() => {\n if (!isActive || typeof document === 'undefined') {\n return\n }\n const listener = (event: MouseEvent) => {\n const node = ref.current\n if (node && !node.contains(event.target as Node)) {\n handler(event)\n }\n }\n document.addEventListener('mousedown', listener)\n return () => document.removeEventListener('mousedown', listener)\n }, [ref, handler, isActive])\n}\n\n/**\n * Provides a `copy(text)` function and a transient `copied` flag that flips\n * back to false after `resetMs` (default 2000). Cleans up the timer on unmount\n * and on subsequent copies.\n */\nexport interface UseCopyToClipboardReturn {\n copied: boolean\n copy: (text: string) => Promise<boolean>\n}\n\nexport function useCopyToClipboard(resetMs = 2000): UseCopyToClipboardReturn {\n const [copied, setCopied] = useState(false)\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n const mountedRef = useRef(true)\n\n useEffect(() => {\n mountedRef.current = true\n return () => {\n mountedRef.current = false\n if (timerRef.current !== null) {\n clearTimeout(timerRef.current)\n timerRef.current = null\n }\n }\n }, [])\n\n const copy = useCallback(async (text: string) => {\n const ok = await copyToClipboard(text)\n if (!mountedRef.current) {\n return ok\n }\n if (ok) {\n setCopied(true)\n if (timerRef.current !== null) {\n clearTimeout(timerRef.current)\n }\n timerRef.current = setTimeout(() => {\n timerRef.current = null\n if (mountedRef.current) {\n setCopied(false)\n }\n }, resetMs)\n }\n return ok\n }, [resetMs])\n\n return {copied, copy}\n}\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {\n}\n\nexport const Skeleton = React.forwardRef<HTMLDivElement, SkeletonProps>(\n ({className, ...rest}, ref) => {\n return (\n <div\n ref={ref}\n className={cx('animate-pulse bg-ash', className)}\n {...rest}\n />\n )\n }\n)\n\nSkeleton.displayName = 'Skeleton'\n\nexport default Skeleton\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type ContainerSize = 'sm' | 'md' | 'lg' | 'xl' | 'fluid' | 'responsive'\n\nexport interface ContainerProps extends React.HTMLAttributes<HTMLDivElement> {\n size?: ContainerSize\n}\n\nconst SIZE_CLASSES: Record<ContainerSize, string> = {\n sm: 'container-sm',\n md: 'container-md',\n lg: 'container-lg',\n xl: 'container-xl',\n fluid: 'container-fluid',\n responsive: 'container',\n}\n\nexport const Container = React.forwardRef<HTMLDivElement, ContainerProps>(\n ({size = 'responsive', className, children, ...props}, ref) => {\n return (\n <div ref={ref} className={cx(SIZE_CLASSES[size], className)} {...props}>\n {children}\n </div>\n )\n }\n)\n\nContainer.displayName = 'Container'\n","import React from 'react'\nimport {cx} from '../utils'\n\nexport type RowGutter = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12\nexport type RowJustify = 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'\nexport type RowAlign = 'start' | 'center' | 'end' | 'stretch' | 'baseline'\n\nexport interface RowProps extends React.HTMLAttributes<HTMLDivElement> {\n gutter?: RowGutter\n gutterX?: RowGutter\n gutterY?: RowGutter\n justify?: RowJustify\n align?: RowAlign\n}\n\nconst JUSTIFY_MAP: Record<RowJustify, string> = {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n between: 'justify-between',\n around: 'justify-around',\n evenly: 'justify-evenly',\n}\n\nconst ALIGN_MAP: Record<RowAlign, string> = {\n start: 'items-start',\n center: 'items-center',\n end: 'items-end',\n stretch: 'items-stretch',\n baseline: 'items-baseline',\n}\n\nconst GAP_MAP: Record<RowGutter, string> = {\n 0: 'gap-0',\n 1: 'gap-1',\n 2: 'gap-2',\n 3: 'gap-3',\n 4: 'gap-4',\n 5: 'gap-5',\n 6: 'gap-6',\n 8: 'gap-8',\n 10: 'gap-10',\n 12: 'gap-12',\n}\n\nconst GAP_X_MAP: Record<RowGutter, string> = {\n 0: 'gap-x-0',\n 1: 'gap-x-1',\n 2: 'gap-x-2',\n 3: 'gap-x-3',\n 4: 'gap-x-4',\n 5: 'gap-x-5',\n 6: 'gap-x-6',\n 8: 'gap-x-8',\n 10: 'gap-x-10',\n 12: 'gap-x-12',\n}\n\nconst GAP_Y_MAP: Record<RowGutter, string> = {\n 0: 'gap-y-0',\n 1: 'gap-y-1',\n 2: 'gap-y-2',\n 3: 'gap-y-3',\n 4: 'gap-y-4',\n 5: 'gap-y-5',\n 6: 'gap-y-6',\n 8: 'gap-y-8',\n 10: 'gap-y-10',\n 12: 'gap-y-12',\n}\n\nexport const Row = React.forwardRef<HTMLDivElement, RowProps>(\n ({gutter = 4, gutterX, gutterY, justify, align, className, children, ...props}, ref) => {\n // Directional gutters take precedence over uniform gutter\n const gapClass = gutterX === undefined && gutterY === undefined ? GAP_MAP[gutter] : ''\n const gapXClass = gutterX !== undefined ? GAP_X_MAP[gutterX] : ''\n const gapYClass = gutterY !== undefined ? GAP_Y_MAP[gutterY] : ''\n\n return (\n <div\n ref={ref}\n className={cx(\n 'row',\n gapClass,\n gapXClass,\n gapYClass,\n justify && JUSTIFY_MAP[justify],\n align && ALIGN_MAP[align],\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nRow.displayName = 'Row'\n","import React from 'react'\nimport {cx} from '../utils'\n\nexport type ColSpan = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 'auto' | 'full'\nexport type ColOffset = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11\nexport type ColOrder = 'first' | 'last' | 'none' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12\n\nexport interface ResponsiveValue<T> {\n base?: T\n sm?: T\n md?: T\n lg?: T\n xl?: T\n '2xl'?: T\n}\n\nexport interface ColProps extends React.HTMLAttributes<HTMLDivElement> {\n span?: ColSpan | ResponsiveValue<ColSpan>\n offset?: ColOffset | ResponsiveValue<ColOffset>\n order?: ColOrder | ResponsiveValue<ColOrder>\n}\n\ntype Breakpoint = 'base' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n\nconst SPAN_CLASS_MAP: Record<Breakpoint, Record<ColSpan, string>> = {\n base: {\n 1: 'col-span-1',\n 2: 'col-span-2',\n 3: 'col-span-3',\n 4: 'col-span-4',\n 5: 'col-span-5',\n 6: 'col-span-6',\n 7: 'col-span-7',\n 8: 'col-span-8',\n 9: 'col-span-9',\n 10: 'col-span-10',\n 11: 'col-span-11',\n 12: 'col-span-12',\n auto: 'col-auto',\n full: 'col-span-full',\n },\n sm: {\n 1: 'sm:col-span-1',\n 2: 'sm:col-span-2',\n 3: 'sm:col-span-3',\n 4: 'sm:col-span-4',\n 5: 'sm:col-span-5',\n 6: 'sm:col-span-6',\n 7: 'sm:col-span-7',\n 8: 'sm:col-span-8',\n 9: 'sm:col-span-9',\n 10: 'sm:col-span-10',\n 11: 'sm:col-span-11',\n 12: 'sm:col-span-12',\n auto: 'sm:col-auto',\n full: 'sm:col-span-full',\n },\n md: {\n 1: 'md:col-span-1',\n 2: 'md:col-span-2',\n 3: 'md:col-span-3',\n 4: 'md:col-span-4',\n 5: 'md:col-span-5',\n 6: 'md:col-span-6',\n 7: 'md:col-span-7',\n 8: 'md:col-span-8',\n 9: 'md:col-span-9',\n 10: 'md:col-span-10',\n 11: 'md:col-span-11',\n 12: 'md:col-span-12',\n auto: 'md:col-auto',\n full: 'md:col-span-full',\n },\n lg: {\n 1: 'lg:col-span-1',\n 2: 'lg:col-span-2',\n 3: 'lg:col-span-3',\n 4: 'lg:col-span-4',\n 5: 'lg:col-span-5',\n 6: 'lg:col-span-6',\n 7: 'lg:col-span-7',\n 8: 'lg:col-span-8',\n 9: 'lg:col-span-9',\n 10: 'lg:col-span-10',\n 11: 'lg:col-span-11',\n 12: 'lg:col-span-12',\n auto: 'lg:col-auto',\n full: 'lg:col-span-full',\n },\n xl: {\n 1: 'xl:col-span-1',\n 2: 'xl:col-span-2',\n 3: 'xl:col-span-3',\n 4: 'xl:col-span-4',\n 5: 'xl:col-span-5',\n 6: 'xl:col-span-6',\n 7: 'xl:col-span-7',\n 8: 'xl:col-span-8',\n 9: 'xl:col-span-9',\n 10: 'xl:col-span-10',\n 11: 'xl:col-span-11',\n 12: 'xl:col-span-12',\n auto: 'xl:col-auto',\n full: 'xl:col-span-full',\n },\n '2xl': {\n 1: '2xl:col-span-1',\n 2: '2xl:col-span-2',\n 3: '2xl:col-span-3',\n 4: '2xl:col-span-4',\n 5: '2xl:col-span-5',\n 6: '2xl:col-span-6',\n 7: '2xl:col-span-7',\n 8: '2xl:col-span-8',\n 9: '2xl:col-span-9',\n 10: '2xl:col-span-10',\n 11: '2xl:col-span-11',\n 12: '2xl:col-span-12',\n auto: '2xl:col-auto',\n full: '2xl:col-span-full',\n },\n}\n\nconst OFFSET_CLASS_MAP: Record<Breakpoint, Record<ColOffset, string>> = {\n base: {\n 0: '',\n 1: 'col-start-2',\n 2: 'col-start-3',\n 3: 'col-start-4',\n 4: 'col-start-5',\n 5: 'col-start-6',\n 6: 'col-start-7',\n 7: 'col-start-8',\n 8: 'col-start-9',\n 9: 'col-start-10',\n 10: 'col-start-11',\n 11: 'col-start-12',\n },\n sm: {\n 0: '',\n 1: 'sm:col-start-2',\n 2: 'sm:col-start-3',\n 3: 'sm:col-start-4',\n 4: 'sm:col-start-5',\n 5: 'sm:col-start-6',\n 6: 'sm:col-start-7',\n 7: 'sm:col-start-8',\n 8: 'sm:col-start-9',\n 9: 'sm:col-start-10',\n 10: 'sm:col-start-11',\n 11: 'sm:col-start-12',\n },\n md: {\n 0: '',\n 1: 'md:col-start-2',\n 2: 'md:col-start-3',\n 3: 'md:col-start-4',\n 4: 'md:col-start-5',\n 5: 'md:col-start-6',\n 6: 'md:col-start-7',\n 7: 'md:col-start-8',\n 8: 'md:col-start-9',\n 9: 'md:col-start-10',\n 10: 'md:col-start-11',\n 11: 'md:col-start-12',\n },\n lg: {\n 0: '',\n 1: 'lg:col-start-2',\n 2: 'lg:col-start-3',\n 3: 'lg:col-start-4',\n 4: 'lg:col-start-5',\n 5: 'lg:col-start-6',\n 6: 'lg:col-start-7',\n 7: 'lg:col-start-8',\n 8: 'lg:col-start-9',\n 9: 'lg:col-start-10',\n 10: 'lg:col-start-11',\n 11: 'lg:col-start-12',\n },\n xl: {\n 0: '',\n 1: 'xl:col-start-2',\n 2: 'xl:col-start-3',\n 3: 'xl:col-start-4',\n 4: 'xl:col-start-5',\n 5: 'xl:col-start-6',\n 6: 'xl:col-start-7',\n 7: 'xl:col-start-8',\n 8: 'xl:col-start-9',\n 9: 'xl:col-start-10',\n 10: 'xl:col-start-11',\n 11: 'xl:col-start-12',\n },\n '2xl': {\n 0: '',\n 1: '2xl:col-start-2',\n 2: '2xl:col-start-3',\n 3: '2xl:col-start-4',\n 4: '2xl:col-start-5',\n 5: '2xl:col-start-6',\n 6: '2xl:col-start-7',\n 7: '2xl:col-start-8',\n 8: '2xl:col-start-9',\n 9: '2xl:col-start-10',\n 10: '2xl:col-start-11',\n 11: '2xl:col-start-12',\n },\n}\n\nconst ORDER_CLASS_MAP: Record<Breakpoint, Record<ColOrder, string>> = {\n base: {\n first: 'order-first',\n last: 'order-last',\n none: 'order-none',\n 1: 'order-1',\n 2: 'order-2',\n 3: 'order-3',\n 4: 'order-4',\n 5: 'order-5',\n 6: 'order-6',\n 7: 'order-7',\n 8: 'order-8',\n 9: 'order-9',\n 10: 'order-10',\n 11: 'order-11',\n 12: 'order-12',\n },\n sm: {\n first: 'sm:order-first',\n last: 'sm:order-last',\n none: 'sm:order-none',\n 1: 'sm:order-1',\n 2: 'sm:order-2',\n 3: 'sm:order-3',\n 4: 'sm:order-4',\n 5: 'sm:order-5',\n 6: 'sm:order-6',\n 7: 'sm:order-7',\n 8: 'sm:order-8',\n 9: 'sm:order-9',\n 10: 'sm:order-10',\n 11: 'sm:order-11',\n 12: 'sm:order-12',\n },\n md: {\n first: 'md:order-first',\n last: 'md:order-last',\n none: 'md:order-none',\n 1: 'md:order-1',\n 2: 'md:order-2',\n 3: 'md:order-3',\n 4: 'md:order-4',\n 5: 'md:order-5',\n 6: 'md:order-6',\n 7: 'md:order-7',\n 8: 'md:order-8',\n 9: 'md:order-9',\n 10: 'md:order-10',\n 11: 'md:order-11',\n 12: 'md:order-12',\n },\n lg: {\n first: 'lg:order-first',\n last: 'lg:order-last',\n none: 'lg:order-none',\n 1: 'lg:order-1',\n 2: 'lg:order-2',\n 3: 'lg:order-3',\n 4: 'lg:order-4',\n 5: 'lg:order-5',\n 6: 'lg:order-6',\n 7: 'lg:order-7',\n 8: 'lg:order-8',\n 9: 'lg:order-9',\n 10: 'lg:order-10',\n 11: 'lg:order-11',\n 12: 'lg:order-12',\n },\n xl: {\n first: 'xl:order-first',\n last: 'xl:order-last',\n none: 'xl:order-none',\n 1: 'xl:order-1',\n 2: 'xl:order-2',\n 3: 'xl:order-3',\n 4: 'xl:order-4',\n 5: 'xl:order-5',\n 6: 'xl:order-6',\n 7: 'xl:order-7',\n 8: 'xl:order-8',\n 9: 'xl:order-9',\n 10: 'xl:order-10',\n 11: 'xl:order-11',\n 12: 'xl:order-12',\n },\n '2xl': {\n first: '2xl:order-first',\n last: '2xl:order-last',\n none: '2xl:order-none',\n 1: '2xl:order-1',\n 2: '2xl:order-2',\n 3: '2xl:order-3',\n 4: '2xl:order-4',\n 5: '2xl:order-5',\n 6: '2xl:order-6',\n 7: '2xl:order-7',\n 8: '2xl:order-8',\n 9: '2xl:order-9',\n 10: '2xl:order-10',\n 11: '2xl:order-11',\n 12: '2xl:order-12',\n },\n}\n\nfunction isResponsiveValue<T>(value: T | ResponsiveValue<T>): value is ResponsiveValue<T> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction buildResponsiveClasses<T extends string | number>(\n value: T | ResponsiveValue<T> | undefined,\n classMap: Record<Breakpoint, Record<T, string>>\n): string[] {\n if (value === undefined) {\n return []\n }\n\n if (!isResponsiveValue(value)) {\n const cls = classMap.base[value]\n return cls ? [cls] : []\n }\n\n const classes: string[] = []\n for (const [breakpoint, val] of Object.entries(value) as [Breakpoint, T][]) {\n if (val !== undefined) {\n const cls = classMap[breakpoint]?.[val]\n if (cls) {\n classes.push(cls)\n }\n }\n }\n return classes\n}\n\nexport const Col = React.forwardRef<HTMLDivElement, ColProps>(\n ({span, offset, order, className, children, ...props}, ref) => {\n const spanClasses = buildResponsiveClasses(span, SPAN_CLASS_MAP)\n const offsetClasses = buildResponsiveClasses(offset, OFFSET_CLASS_MAP)\n const orderClasses = buildResponsiveClasses(order, ORDER_CLASS_MAP)\n\n // Default to full width if no span specified\n const hasSpan = span !== undefined\n const defaultSpan = hasSpan ? '' : 'col-span-12'\n\n return (\n <div\n ref={ref}\n className={cx(\n defaultSpan,\n ...spanClasses,\n ...offsetClasses,\n ...orderClasses,\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nCol.displayName = 'Col'\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type StackDirection = 'horizontal' | 'vertical'\nexport type StackAlign = 'start' | 'center' | 'end' | 'stretch' | 'baseline'\nexport type StackJustify = 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'\nexport type StackGap = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12\n\nexport interface StackProps extends React.HTMLAttributes<HTMLDivElement> {\n direction?: StackDirection\n align?: StackAlign\n justify?: StackJustify\n gap?: StackGap\n wrap?: boolean\n as?: 'div' | 'section' | 'article' | 'nav' | 'aside' | 'header' | 'footer' | 'main'\n}\n\nconst ALIGN_MAP: Record<StackAlign, string> = {\n start: 'items-start',\n center: 'items-center',\n end: 'items-end',\n stretch: 'items-stretch',\n baseline: 'items-baseline',\n}\n\nconst JUSTIFY_MAP: Record<StackJustify, string> = {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n between: 'justify-between',\n around: 'justify-around',\n evenly: 'justify-evenly',\n}\n\nconst GAP_MAP: Record<StackGap, string> = {\n 0: 'gap-0',\n 1: 'gap-1',\n 2: 'gap-2',\n 3: 'gap-3',\n 4: 'gap-4',\n 5: 'gap-5',\n 6: 'gap-6',\n 8: 'gap-8',\n 10: 'gap-10',\n 12: 'gap-12',\n}\n\nexport const Stack = React.forwardRef<HTMLDivElement, StackProps>(\n (\n {\n direction = 'vertical',\n align,\n justify,\n gap = 4,\n wrap = false,\n as: Component = 'div',\n className,\n children,\n ...props\n },\n ref\n ) => {\n return (\n <Component\n ref={ref}\n className={cx(\n 'flex',\n direction === 'horizontal' ? 'flex-row' : 'flex-col',\n align && ALIGN_MAP[align],\n justify && JUSTIFY_MAP[justify],\n GAP_MAP[gap],\n wrap && 'flex-wrap',\n className\n )}\n {...props}\n >\n {children}\n </Component>\n )\n }\n)\n\nStack.displayName = 'Stack'\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type DividerOrientation = 'horizontal' | 'vertical'\nexport type DividerVariant = 'solid' | 'dashed' | 'dotted'\n\nexport interface DividerProps extends React.HTMLAttributes<HTMLHRElement> {\n orientation?: DividerOrientation\n variant?: DividerVariant\n label?: React.ReactNode\n color?: 'default' | 'gold' | 'muted'\n}\n\nconst COLOR_MAP: Record<string, string> = {\n default: 'border-ash',\n gold: 'border-gold/50',\n muted: 'border-slate',\n}\n\nconst VARIANT_MAP: Record<DividerVariant, string> = {\n solid: 'border-solid',\n dashed: 'border-dashed',\n dotted: 'border-dotted',\n}\n\nexport const Divider = React.forwardRef<HTMLHRElement, DividerProps>(\n (\n {\n orientation = 'horizontal',\n variant = 'solid',\n label,\n color = 'default',\n className,\n ...props\n },\n ref\n ) => {\n const isHorizontal = orientation === 'horizontal'\n\n if (label && isHorizontal) {\n return (\n <div\n className={cx('flex items-center gap-4', className)}\n role=\"separator\"\n aria-orientation={orientation}\n >\n <div\n className={cx(\n 'flex-1 border-t',\n VARIANT_MAP[variant],\n COLOR_MAP[color]\n )}\n />\n <span className=\"text-sm text-silver shrink-0\">{label}</span>\n <div\n className={cx(\n 'flex-1 border-t',\n VARIANT_MAP[variant],\n COLOR_MAP[color]\n )}\n />\n </div>\n )\n }\n\n return (\n <hr\n ref={ref}\n role=\"separator\"\n aria-orientation={orientation}\n className={cx(\n isHorizontal ? 'border-t w-full' : 'border-l h-full',\n VARIANT_MAP[variant],\n COLOR_MAP[color],\n 'border-0',\n isHorizontal ? 'border-t' : 'border-l',\n className\n )}\n {...props}\n />\n )\n }\n)\n\nDivider.displayName = 'Divider'\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\nexport type AvatarStatus = 'online' | 'offline' | 'busy'\n\nexport interface AvatarProps extends React.HTMLAttributes<HTMLDivElement> {\n src?: string\n alt?: string\n name?: string\n size?: AvatarSize\n status?: AvatarStatus\n}\n\nconst sizeMap: Record<AvatarSize, string> = {\n xs: 'h-6 w-6 text-[10px]',\n sm: 'h-8 w-8 text-[11px]',\n md: 'h-10 w-10 text-xs',\n lg: 'h-12 w-12 text-sm',\n xl: 'h-16 w-16 text-base',\n '2xl': 'h-24 w-24 text-lg',\n}\n\nfunction initials(name?: string) {\n if (!name) {\n return ''\n }\n const parts = name.trim().split(/\\s+/)\n return parts.slice(0, 2).map(p => p[0]!.toUpperCase()).join('')\n}\n\nexport const Avatar = React.forwardRef<HTMLDivElement, AvatarProps>(\n ({src, alt = '', name, size = 'md', status, className, ...rest}, ref) => {\n const statusColor =\n status === 'online' ? 'bg-success' : status === 'busy' ? 'bg-warning' : 'bg-zinc'\n\n return (\n <div\n ref={ref}\n className={cx(\n 'relative inline-flex items-center justify-center rounded-full border-2 border-ash bg-slate text-silver font-semibold select-none overflow-hidden',\n sizeMap[size],\n className\n )}\n {...rest}\n >\n {src ? (\n <img src={src} alt={alt || name || 'Avatar'}\n className=\"h-full w-full object-cover\"/>\n ) : (\n <span aria-hidden>{initials(name) || '·'}</span>\n )}\n {status && (\n <span\n className={cx(\n 'absolute bottom-0 right-0 rounded-full ring-2 ring-charcoal',\n // 25% of avatar size\n size === 'xs' ? 'h-1.5 w-1.5' :\n size === 'sm' ? 'h-2 w-2' :\n size === 'md' ? 'h-2.5 w-2.5' :\n size === 'lg' ? 'h-3 w-3' :\n size === 'xl' ? 'h-4 w-4' : 'h-5 w-5',\n statusColor\n )}\n />\n )}\n </div>\n )\n }\n)\n\nAvatar.displayName = 'Avatar'\n\nexport default Avatar\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type BadgeVariant = 'default' | 'gold' | 'success' | 'error' | 'warning' | 'info'\n\nexport interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {\n variant?: BadgeVariant\n}\n\nexport const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(\n ({variant = 'default', className, ...rest}, ref) => {\n // Base badge styles\n const base = 'inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border'\n\n // Variant styles\n const variantClasses = {\n default: 'bg-slate text-silver border-slate',\n gold: 'bg-gold/20 text-gold border-gold/30',\n success: 'bg-success/20 text-success border-success/30',\n error: 'bg-error/20 text-error border-error/30',\n warning: 'bg-warning/20 text-warning border-warning/30',\n info: 'bg-info/20 text-info border-info/30',\n }\n\n const variantClass = variantClasses[variant]\n\n return <span ref={ref} className={cx(base, variantClass, className)} {...rest} />\n }\n)\n\nBadge.displayName = 'Badge'\n\nexport default Badge\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type TooltipSide = 'top' | 'right' | 'bottom' | 'left'\n\nexport interface TooltipProps {\n content: React.ReactNode\n children: React.ReactElement\n open?: boolean\n side?: TooltipSide\n}\n\n// Simple, controlled tooltip. Consumer handles open state.\nexport const Tooltip: React.FC<TooltipProps> = ({\n content,\n children,\n open = false,\n side = 'top'\n}) => {\n return (\n <span className=\"relative inline-block\">\n {children}\n <span\n role=\"tooltip\"\n className={cx(\n 'pointer-events-none absolute z-50 whitespace-nowrap border border-ash bg-graphite px-3 py-1.5 text-sm text-white shadow-lg transition-opacity duration-200 ease-out',\n open ? 'opacity-100' : 'opacity-0',\n side === 'top' && 'left-1/2 -translate-x-1/2 -top-2 -translate-y-full',\n side === 'bottom' && 'left-1/2 -translate-x-1/2 -bottom-2 translate-y-full',\n side === 'left' && 'top-1/2 -translate-y-1/2 -left-2 -translate-x-full',\n side === 'right' && 'top-1/2 -translate-y-1/2 -right-2 translate-x-full'\n )}\n >\n {content}\n </span>\n </span>\n )\n}\n\nexport default Tooltip\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\n// Table container\nexport interface TableProps extends React.TableHTMLAttributes<HTMLTableElement> {\n responsive?: boolean\n}\n\nexport const Table = React.forwardRef<HTMLTableElement, TableProps>(\n ({responsive = true, className, children, ...props}, ref) => {\n const table = (\n <table\n ref={ref}\n className={cx('w-full text-sm', className)}\n {...props}\n >\n {children}\n </table>\n )\n\n if (responsive) {\n return <div className=\"w-full overflow-x-auto\">{table}</div>\n }\n\n return table\n }\n)\n\nTable.displayName = 'Table'\n\n// Table header\nexport interface TableHeaderProps extends React.HTMLAttributes<HTMLTableSectionElement> {\n}\n\nexport const TableHeader = React.forwardRef<HTMLTableSectionElement, TableHeaderProps>(\n ({className, children, ...props}, ref) => (\n <thead\n ref={ref}\n className={cx('bg-graphite', className)}\n {...props}\n >\n {children}\n </thead>\n )\n)\n\nTableHeader.displayName = 'TableHeader'\n\n// Table body\nexport interface TableBodyProps extends React.HTMLAttributes<HTMLTableSectionElement> {\n}\n\nexport const TableBody = React.forwardRef<HTMLTableSectionElement, TableBodyProps>(\n ({className, children, ...props}, ref) => (\n <tbody\n ref={ref}\n className={cx('divide-y divide-ash', className)}\n {...props}\n >\n {children}\n </tbody>\n )\n)\n\nTableBody.displayName = 'TableBody'\n\n// Table footer\nexport interface TableFooterProps extends React.HTMLAttributes<HTMLTableSectionElement> {\n}\n\nexport const TableFooter = React.forwardRef<HTMLTableSectionElement, TableFooterProps>(\n ({className, children, ...props}, ref) => (\n <tfoot\n ref={ref}\n className={cx('bg-graphite font-medium', className)}\n {...props}\n >\n {children}\n </tfoot>\n )\n)\n\nTableFooter.displayName = 'TableFooter'\n\n// Table row\nexport interface TableRowProps extends React.HTMLAttributes<HTMLTableRowElement> {\n hoverable?: boolean\n selected?: boolean\n}\n\nexport const TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(\n ({hoverable = true, selected = false, className, children, ...props}, ref) => (\n <tr\n ref={ref}\n className={cx(\n 'transition-colors duration-fast',\n hoverable && 'hover:bg-graphite/50',\n selected && 'bg-gold/10',\n className\n )}\n {...props}\n >\n {children}\n </tr>\n )\n)\n\nTableRow.displayName = 'TableRow'\n\n// Table header cell\nexport interface TableHeadProps extends React.ThHTMLAttributes<HTMLTableCellElement> {\n sortable?: boolean\n sortDirection?: 'asc' | 'desc' | null\n}\n\nexport const TableHead = React.forwardRef<HTMLTableCellElement, TableHeadProps>(\n ({sortable, sortDirection, className, children, ...props}, ref) => (\n <th\n ref={ref}\n className={cx(\n 'px-4 py-3 text-left font-semibold text-silver',\n sortable && 'cursor-pointer hover:text-white select-none',\n className\n )}\n {...props}\n >\n <div className=\"flex items-center gap-2\">\n {children}\n {sortable && sortDirection && (\n <span className=\"text-gold\">\n {sortDirection === 'asc' ? '↑' : '↓'}\n </span>\n )}\n </div>\n </th>\n )\n)\n\nTableHead.displayName = 'TableHead'\n\n// Table data cell\nexport interface TableCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {\n}\n\nexport const TableCell = React.forwardRef<HTMLTableCellElement, TableCellProps>(\n ({className, children, ...props}, ref) => (\n <td\n ref={ref}\n className={cx('px-4 py-3 text-white', className)}\n {...props}\n >\n {children}\n </td>\n )\n)\n\nTableCell.displayName = 'TableCell'\n\n// Table caption\nexport interface TableCaptionProps extends React.HTMLAttributes<HTMLTableCaptionElement> {\n}\n\nexport const TableCaption = React.forwardRef<HTMLTableCaptionElement, TableCaptionProps>(\n ({className, children, ...props}, ref) => (\n <caption\n ref={ref}\n className={cx('mt-4 text-sm text-silver', className)}\n {...props}\n >\n {children}\n </caption>\n )\n)\n\nTableCaption.displayName = 'TableCaption'\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\n// List container\nexport interface ListProps extends React.HTMLAttributes<HTMLUListElement> {\n variant?: 'default' | 'bordered' | 'divided'\n ordered?: boolean\n}\n\nexport const List = React.forwardRef<HTMLUListElement, ListProps>(\n ({variant = 'default', ordered = false, className, children, ...props}, ref) => {\n // `ol` and `ul` share the HTMLAttributes shape we accept; the ref is\n // narrowed to HTMLUListElement because that is the dominant case.\n const Component = (ordered ? 'ol' : 'ul') as 'ul'\n\n return (\n <Component\n ref={ref}\n className={cx(\n 'list-none m-0 p-0',\n variant === 'bordered' && 'border border-ash',\n variant === 'divided' && 'divide-y divide-ash',\n className\n )}\n {...props}\n >\n {children}\n </Component>\n )\n }\n)\n\nList.displayName = 'List'\n\n// ListItem\nexport interface ListItemProps extends React.LiHTMLAttributes<HTMLLIElement> {\n leading?: React.ReactNode\n trailing?: React.ReactNode\n interactive?: boolean\n selected?: boolean\n disabled?: boolean\n}\n\nexport const ListItem = React.forwardRef<HTMLLIElement, ListItemProps>(\n (\n {\n leading,\n trailing,\n interactive = false,\n selected = false,\n disabled = false,\n className,\n children,\n onClick,\n ...props\n },\n ref\n ) => {\n const handleClick = (e: React.MouseEvent<HTMLLIElement>) => {\n if (disabled) {\n return\n }\n onClick?.(e)\n }\n\n return (\n <li\n ref={ref}\n onClick={handleClick}\n className={cx(\n 'flex items-center gap-3 px-4 py-3',\n interactive && 'cursor-pointer transition-colors duration-fast',\n interactive && !disabled && 'hover:bg-graphite',\n selected && 'bg-gold/10',\n disabled && 'opacity-50 cursor-not-allowed',\n className\n )}\n {...props}\n >\n {leading && <div className=\"shrink-0\">{leading}</div>}\n <div className=\"flex-1 min-w-0\">{children}</div>\n {trailing && <div className=\"shrink-0\">{trailing}</div>}\n </li>\n )\n }\n)\n\nListItem.displayName = 'ListItem'\n\n// ListItemText - for structured text content\nexport interface ListItemTextProps extends React.HTMLAttributes<HTMLDivElement> {\n primary: React.ReactNode\n secondary?: React.ReactNode\n}\n\nexport const ListItemText = React.forwardRef<HTMLDivElement, ListItemTextProps>(\n ({primary, secondary, className, ...props}, ref) => {\n return (\n <div ref={ref} className={cx('flex flex-col', className)} {...props}>\n <span className=\"text-sm font-medium text-white\">{primary}</span>\n {secondary && (\n <span className=\"text-xs text-silver mt-0.5\">{secondary}</span>\n )}\n </div>\n )\n }\n)\n\nListItemText.displayName = 'ListItemText'\n\n// ListSubheader - section header within a list\nexport interface ListSubheaderProps extends React.HTMLAttributes<HTMLLIElement> {\n}\n\nexport const ListSubheader = React.forwardRef<HTMLLIElement, ListSubheaderProps>(\n ({className, children, ...props}, ref) => {\n return (\n <li\n ref={ref}\n className={cx(\n 'px-4 py-2 text-xs font-semibold text-gold uppercase tracking-wider bg-graphite',\n className\n )}\n {...props}\n >\n {children}\n </li>\n )\n }\n)\n\nListSubheader.displayName = 'ListSubheader'\n","import React, {useState} from 'react'\nimport {cx} from '../utils'\nimport {Tooltip} from './Tooltip'\nimport {\n File,\n FileArchive,\n FileAudio,\n FileCode,\n FileImage,\n FileText,\n FileVideo,\n Loader2,\n X\n} from 'lucide-react'\n\nexport type FileChipStatus =\n | 'pending'\n | 'uploading'\n | 'uploaded'\n | 'analyzing'\n | 'analyzed'\n | 'upload_failed'\n | 'analysis_failed'\n\nexport interface FileChipProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'onClick'> {\n /**\n * File name to display\n */\n name: string\n /**\n * File size in bytes (optional, will be formatted)\n */\n size?: number\n /**\n * MIME type for icon selection\n */\n type?: string\n /**\n * Upload/processing status\n */\n status?: FileChipStatus\n /**\n * Preview image URL (for images)\n */\n previewUrl?: string\n /**\n * Called when the remove button is clicked\n */\n onRemove?: () => void\n /**\n * Whether the chip is removable\n */\n removable?: boolean\n /**\n * Error message to display (when status is an error)\n */\n error?: string\n /**\n * Backend artifact id, set once the upload has been integrated. When both\n * `artifactId` and `onOpen` are present, the chip becomes clickable.\n */\n artifactId?: string\n /**\n * Click handler invoked with `artifactId` when the chip is clicked.\n * Compose-box (pre-integrate) chips should not pass this — the chip stays\n * non-clickable except for its remove button.\n */\n onOpen?: (artifactId: string) => void\n}\n\n/**\n * Format bytes to human-readable string\n */\nfunction formatBytes(bytes: number): string {\n if (bytes === 0) {\n return '0 B'\n }\n const k = 1024\n const sizes = ['B', 'KB', 'MB', 'GB']\n const i = Math.floor(Math.log(bytes) / Math.log(k))\n return `${parseFloat((bytes / Math.pow(k, i)).toFixed(1))} ${sizes[i]}`\n}\n\n/**\n * Get icon component based on MIME type\n */\nfunction getFileIcon(type?: string) {\n if (!type) {\n return File\n }\n\n if (type.startsWith('image/')) {\n return FileImage\n }\n if (type.startsWith('video/')) {\n return FileVideo\n }\n if (type.startsWith('audio/')) {\n return FileAudio\n }\n if (type.startsWith('text/')) {\n return FileText\n }\n if (type.includes('javascript') || type.includes('typescript') || type.includes('json')\n || type.includes('xml')) {\n return FileCode\n }\n if (type.includes('zip') || type.includes('rar') || type.includes('tar') || type.includes('gz')) {\n return FileArchive\n }\n\n return File\n}\n\nconst statusBorderClass: Record<FileChipStatus, string> = {\n pending: 'border-silver/30',\n uploading: 'border-gold/50',\n uploaded: 'border-info/50',\n analyzing: 'border-info/50',\n analyzed: 'border-success/50',\n upload_failed: 'border-error/50',\n analysis_failed: 'border-error/50',\n}\n\nconst statusHoverLabel: Record<FileChipStatus, string | null> = {\n pending: null,\n uploading: 'Uploading',\n uploaded: 'Analyzing',\n analyzing: 'Analyzing',\n analyzed: null,\n upload_failed: 'Upload failed',\n analysis_failed: \"Couldn't process this file\",\n}\n\nfunction isErrorStatus(status: FileChipStatus): boolean {\n return status === 'upload_failed' || status === 'analysis_failed'\n}\n\nexport const FileChip = React.forwardRef<HTMLDivElement, FileChipProps>(\n (\n {\n name,\n size,\n type,\n status = 'analyzed',\n previewUrl,\n onRemove,\n removable = true,\n error,\n artifactId,\n onOpen,\n className,\n title,\n ...rest\n },\n ref\n ) => {\n const Icon = getFileIcon(type)\n const isImage = type?.startsWith('image/')\n const showPreview = isImage && previewUrl\n\n const clickable = !!(artifactId && onOpen)\n const hoverLabel = statusHoverLabel[status]\n // Tooltip on hover/focus surfaces the lifecycle state. Errors take\n // precedence over the generic status label so the user sees the\n // specific reason. `analyzed` chips have no tooltip — the chip is\n // interactive on its own and the filename in the strip already names\n // it.\n const tooltipContent: string | null = isErrorStatus(status)\n ? (error ?? hoverLabel ?? null)\n : hoverLabel\n const [hovered, setHovered] = useState(false)\n const [focused, setFocused] = useState(false)\n const showError = isErrorStatus(status)\n\n const handleClick = () => {\n if (clickable) {\n onOpen!(artifactId!)\n }\n }\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (!clickable) {\n return\n }\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n onOpen!(artifactId!)\n }\n }\n\n const tooltipOpen = tooltipContent !== null && (hovered || focused)\n\n const chip = (\n <div\n {...rest}\n ref={ref}\n className={cx(\n 'group relative inline-flex items-center gap-2 px-2 py-1.5',\n 'bg-charcoal border text-sm text-white',\n 'transition-colors duration-150',\n statusBorderClass[status],\n showError && 'bg-error/10',\n clickable && 'cursor-pointer hover:bg-graphite',\n className\n )}\n role={clickable ? 'button' : 'listitem'}\n tabIndex={clickable ? 0 : undefined}\n onClick={clickable ? handleClick : undefined}\n onKeyDown={clickable ? handleKeyDown : undefined}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n title={title}\n aria-label={hoverLabel ? `${name}: ${hoverLabel}` : name}\n >\n {/* Preview thumbnail or icon */}\n {showPreview ? (\n <div className=\"w-8 h-8 flex-shrink-0 overflow-hidden bg-slate\">\n <img\n src={previewUrl}\n alt=\"\"\n className=\"w-full h-full object-cover\"\n />\n </div>\n ) : (\n <Icon className={cx(\n 'w-4 h-4 flex-shrink-0',\n showError ? 'text-error' : 'text-silver'\n )}/>\n )}\n\n {/* File info */}\n <div className=\"flex flex-col min-w-0 flex-1\">\n <span className=\"truncate max-w-40\" title={name}>\n {name}\n </span>\n {size !== undefined && !showError && (\n <span className=\"text-xs text-silver/60\">\n {formatBytes(size)}\n </span>\n )}\n {showError && error && (\n <span className=\"text-xs text-error truncate\" title={error}>\n {error}\n </span>\n )}\n </div>\n\n {/* Status indicator */}\n {status === 'uploading' && (\n <Loader2 className=\"w-3.5 h-3.5 text-gold animate-spin flex-shrink-0\"/>\n )}\n {(status === 'uploaded' || status === 'analyzing') && (\n <Loader2 className=\"w-3.5 h-3.5 text-info animate-spin flex-shrink-0\"/>\n )}\n {status === 'pending' && (\n <div className=\"w-2 h-2 rounded-full bg-silver/50 flex-shrink-0\"/>\n )}\n\n {/* Remove button */}\n {removable && onRemove && (\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation()\n onRemove()\n }}\n className={cx(\n 'p-0.5 text-silver/40 hover:text-white transition-colors',\n 'hover:bg-white/10',\n 'opacity-0 group-hover:opacity-100',\n 'focus:opacity-100'\n )}\n aria-label={`Remove ${name}`}\n >\n <X className=\"w-3.5 h-3.5\"/>\n </button>\n )}\n </div>\n )\n\n if (tooltipContent === null) {\n return chip\n }\n return (\n <Tooltip content={tooltipContent} open={tooltipOpen} side=\"top\">\n {chip}\n </Tooltip>\n )\n }\n)\n\nFileChip.displayName = 'FileChip'\n\nexport default FileChip\n","import React from 'react'\nimport {X} from 'lucide-react'\nimport {cx} from '../utils'\nimport {Tooltip} from './Tooltip'\n\nexport interface MentionChipProps\n extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children' | 'onClick'> {\n /**\n * The artifact name (the @-handle, without the leading @).\n */\n name: string\n /**\n * Optional human-readable title; shown in the hover tooltip alongside the name.\n */\n title?: string\n /**\n * Optional icon rendered before the name — typically a kind glyph (e.g. `FileImage`,\n * `FileVideo`) or `HelpCircle` for unknown / stale references. Sized at `w-3 h-3` to\n * match the chip's text scale.\n */\n leadingIcon?: React.ReactNode\n /**\n * Called when the chip is clicked. When provided, the chip becomes keyboard-focusable\n * and gains a hover affordance.\n */\n onClick?: () => void\n /**\n * Called when the remove (×) button is clicked. When provided, an × appears on hover/focus.\n * Use only on input-side previews; rendered messages should leave this unset.\n */\n onRemove?: () => void\n}\n\n/**\n * Inline chip representing an `@name` artifact mention. Use anywhere a stable reference to a\n * project artifact appears — typed input previews, rendered chat messages, deliverable\n * descriptions. Renders the name in monospace with a leading `@` glyph and a gold-tinted border,\n * mirroring the addressable handle the user sees on the artifact card.\n *\n * Pair with the `Combobox` primitive for the typing surface, and with the\n * `MarkdownContent` `mentionRenderer` prop to render mentions inline inside rendered chat\n * messages — typically `mentionRenderer={(name) => <MentionChip name={name} … />}`.\n */\nexport const MentionChip = React.forwardRef<HTMLSpanElement, MentionChipProps>(\n ({name, title, leadingIcon, onClick, onRemove, className, ...rest}, ref) => {\n const clickable = !!onClick\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLSpanElement>) => {\n if (!clickable) {\n return\n }\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n onClick!()\n }\n }\n\n const chip = (\n <span\n {...rest}\n ref={ref}\n role={clickable ? 'button' : undefined}\n tabIndex={clickable ? 0 : undefined}\n onClick={clickable ? onClick : undefined}\n onKeyDown={clickable ? handleKeyDown : undefined}\n className={cx(\n // `aurelius-mention` (defined in theme.css) supplies the\n // colour palette via CSS variables so the parent prose\n // context (.prose-inherit user bubble vs .prose-invert\n // assistant bubble) can override defaults via the cascade —\n // no per-call variant prop or context wiring.\n 'aurelius-mention',\n 'group relative inline-flex items-center gap-1 align-baseline',\n 'px-1.5 py-0.5 text-xs font-mono border',\n clickable && 'cursor-pointer focus:outline-none '\n + 'focus-visible:ring-1 focus-visible:ring-current',\n className\n )}\n aria-label={title ? `${name}: ${title}` : name}\n >\n {leadingIcon && (\n <span className=\"shrink-0 inline-flex items-center\">{leadingIcon}</span>\n )}\n <span className=\"truncate max-w-40\">\n <span className=\"opacity-60\">@</span>{name}\n </span>\n {onRemove && (\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation()\n onRemove()\n }}\n className={cx(\n 'aurelius-mention-x',\n 'p-0.5 -mr-0.5 transition-colors',\n 'opacity-0 group-hover:opacity-100 focus:opacity-100'\n )}\n aria-label={`Remove mention of ${name}`}\n >\n <X className=\"w-3 h-3\"/>\n </button>\n )}\n </span>\n )\n\n if (!title) {\n return chip\n }\n return (\n <Tooltip content={title} side=\"top\">\n {chip}\n </Tooltip>\n )\n }\n)\n\nMentionChip.displayName = 'MentionChip'\n\nexport default MentionChip\n","import React, {useCallback, useEffect, useRef, useState} from 'react'\nimport {cx} from '../utils'\n\nexport interface ComboboxProps<T> extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {\n /**\n * Items to display in the panel. The caller is responsible for filtering before passing.\n */\n items: T[]\n /**\n * Index of the currently highlighted (focused, not yet picked) item. Drive this from\n * `useComboboxNav` for the standard arrow-key behaviour, or manage it yourself.\n */\n selectedIndex: number\n /**\n * Render one row. `isSelected` reflects the keyboard highlight; click and hover styling\n * are applied by the panel.\n */\n renderItem: (item: T, isSelected: boolean) => React.ReactNode\n /**\n * Called when the user clicks a row. Use the same handler you call from the keyboard's\n * Enter key to keep mouse and keyboard paths consistent.\n */\n onSelectItem: (item: T) => void\n /**\n * Stable key per item. Required because the panel re-mounts rows when `items` changes.\n */\n getItemKey: (item: T) => string\n /**\n * Optional node rendered when `items` is empty. Skip the panel entirely if you'd rather\n * hide it on no-match.\n */\n emptyState?: React.ReactNode\n /**\n * Maximum pixel height of the scrollable list. The panel itself sizes to its content\n * up to this cap; rows beyond it scroll within the panel.\n * @default 256\n */\n maxHeight?: number\n}\n\n/**\n * Floating panel for inline autocompletes — `@`-mention pickers, slash-command menus, and\n * the like. The panel is unstyled-positioned (`absolute`) so the caller controls placement\n * via wrapper, `style`, or by mounting it inside their own positioned container; this keeps\n * the component agnostic to how the trigger position is computed (caret coordinates, ref\n * rect, popover anchor).\n *\n * Pair with `useComboboxNav` for the standard arrow-key + Enter/Escape behaviour.\n */\nexport function Combobox<T>(\n {items, selectedIndex, renderItem, onSelectItem, getItemKey, emptyState,\n maxHeight = 256, className, ...rest}:\n ComboboxProps<T>,\n) {\n const listRef = useRef<HTMLUListElement>(null)\n\n // Keep the highlighted row scrolled into view when the user navigates past\n // the visible range with the keyboard.\n useEffect(() => {\n const list = listRef.current\n if (!list) {\n return\n }\n const selectedNode = list.children.item(selectedIndex) as HTMLElement | null\n selectedNode?.scrollIntoView({block: 'nearest'})\n }, [selectedIndex])\n\n if (items.length === 0 && !emptyState) {\n return null\n }\n\n return (\n <div\n {...rest}\n role=\"listbox\"\n className={cx(\n 'absolute z-50 min-w-48 max-w-sm',\n 'bg-charcoal border border-ash shadow-lg',\n 'animate-fade-in',\n className\n )}\n >\n {items.length === 0 ? (\n <div className=\"px-3 py-2 text-sm text-silver/60\">{emptyState}</div>\n ) : (\n <ul ref={listRef}\n style={{maxHeight}}\n className=\"list-none m-0 p-0 overflow-y-auto\">\n {items.map((item, i) => {\n const isSelected = i === selectedIndex\n return (\n <li\n key={getItemKey(item)}\n role=\"option\"\n aria-selected={isSelected}\n onMouseDown={(e) => {\n // Prevent the input from losing focus on mouse-down so the\n // pick-and-insert flow keeps the textarea active.\n e.preventDefault()\n onSelectItem(item)\n }}\n className={cx(\n 'cursor-pointer',\n isSelected ? 'bg-gold/10' : 'hover:bg-graphite'\n )}\n >\n {renderItem(item, isSelected)}\n </li>\n )\n })}\n </ul>\n )}\n </div>\n )\n}\n\n/**\n * Result of `useComboboxNav`. Forward `handleKeyDown` from the input element that owns focus\n * (typically a textarea); it returns true when it consumed the event so the caller knows to\n * skip its own handling.\n */\nexport interface ComboboxNav {\n selectedIndex: number\n setSelectedIndex: (index: number) => void\n /**\n * Standard handler for ArrowUp / ArrowDown / Enter / Escape. Returns true when a key was\n * consumed — the caller should skip its own handling for those events.\n */\n handleKeyDown: (e: React.KeyboardEvent) => boolean\n}\n\nexport interface UseComboboxNavOptions<T> {\n items: T[]\n /**\n * Called when the user presses Enter on the highlighted item.\n */\n onSelect: (item: T) => void\n /**\n * Called when the user presses Escape.\n */\n onDismiss: () => void\n}\n\n/**\n * Standard keyboard nav for an inline autocomplete: ArrowUp / ArrowDown wrap through items,\n * Enter selects the highlighted item, Escape dismisses. Resets the highlight to 0 whenever\n * the items array changes (reference equality), so a fresh filter result starts at the top.\n */\nexport function useComboboxNav<T>(\n {items, onSelect, onDismiss}: UseComboboxNavOptions<T>): ComboboxNav {\n const [selectedIndex, setSelectedIndex] = useState(0)\n\n // Reset on length change rather than reference change — consumers commonly produce a\n // fresh `items` array each render (e.g. an inline filter), and resetting on every render\n // would clobber arrow-key navigation. Length is the load-bearing signal: a typed\n // character changes the filter length and the user expects to start from the top.\n useEffect(() => {\n setSelectedIndex(0)\n }, [items.length])\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (items.length === 0) {\n if (e.key === 'Escape') {\n e.preventDefault()\n onDismiss()\n return true\n }\n return false\n }\n\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault()\n setSelectedIndex((i) => (i + 1) % items.length)\n return true\n case 'ArrowUp':\n e.preventDefault()\n setSelectedIndex((i) => (i - 1 + items.length) % items.length)\n return true\n case 'Enter':\n case 'Tab':\n e.preventDefault()\n onSelect(items[selectedIndex])\n return true\n case 'Escape':\n e.preventDefault()\n onDismiss()\n return true\n default:\n return false\n }\n },\n [items, onSelect, onDismiss, selectedIndex]\n )\n\n return {selectedIndex, setSelectedIndex, handleKeyDown}\n}\n","import React from 'react'\nimport {cx} from '../utils'\nimport {FileChip, type FileChipStatus} from './FileChip'\n\nexport interface AttachmentItem {\n /**\n * Unique identifier\n */\n id: string\n /**\n * The file's name, size and MIME type. A real `File` object satisfies this\n * shape — compose-box callers pass File instances directly. Above-message\n * (post-send) rendering supplies a synthetic record built from persisted\n * attachment metadata.\n */\n file: Pick<File, 'name' | 'size' | 'type'>\n /**\n * Blob URL for image previews\n */\n previewUrl?: string\n /**\n * Current status\n */\n status: FileChipStatus\n /**\n * Error message if status is an error variant\n */\n error?: string\n /**\n * Backend artifact id, set once the upload has been integrated. Required to\n * make the chip clickable to open the artifact card modal.\n */\n artifactId?: string\n}\n\nexport interface AttachmentPreviewProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Array of attachments to display\n */\n attachments: AttachmentItem[]\n /**\n * Called when an attachment should be removed\n */\n onRemove?: (id: string) => void\n /**\n * Whether attachments are removable\n */\n removable?: boolean\n /**\n * Maximum number of attachments to show before collapsing\n * Set to 0 or undefined to show all\n */\n maxVisible?: number\n /**\n * Click handler for chips with an artifactId. When set, chips that carry an\n * artifactId become clickable and forward the id to this handler.\n */\n onOpen?: (artifactId: string) => void\n}\n\nexport const AttachmentPreview = React.forwardRef<HTMLDivElement, AttachmentPreviewProps>(\n (\n {\n attachments,\n onRemove,\n removable = true,\n maxVisible,\n onOpen,\n className,\n ...rest\n },\n ref\n ) => {\n if (attachments.length === 0) {\n return null\n }\n\n const visibleAttachments = maxVisible && maxVisible > 0\n ? attachments.slice(0, maxVisible)\n : attachments\n\n const hiddenCount = maxVisible && maxVisible > 0\n ? Math.max(0, attachments.length - maxVisible)\n : 0\n\n return (\n <div\n ref={ref}\n className={cx('flex flex-wrap gap-2', className)}\n role=\"list\"\n aria-label=\"Attached files\"\n {...rest}\n >\n {visibleAttachments.map((attachment) => (\n <FileChip\n key={attachment.id}\n name={attachment.file.name}\n size={attachment.file.size}\n type={attachment.file.type}\n status={attachment.status}\n previewUrl={attachment.previewUrl}\n error={attachment.error}\n removable={removable}\n onRemove={onRemove ? () => onRemove(attachment.id) : undefined}\n artifactId={attachment.artifactId}\n onOpen={onOpen}\n />\n ))}\n {hiddenCount > 0 && (\n <div\n className=\"inline-flex items-center px-2 py-1.5 bg-charcoal border border-silver/30 text-sm text-silver\">\n +{hiddenCount} more\n </div>\n )}\n </div>\n )\n }\n)\n\nAttachmentPreview.displayName = 'AttachmentPreview'\n\nexport default AttachmentPreview\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {\n required?: boolean\n}\n\nexport const Label = React.forwardRef<HTMLLabelElement, LabelProps>(\n ({className, required, children, ...rest}, ref) => {\n return (\n <label\n ref={ref}\n className={cx('block text-sm font-medium text-silver mb-1.5', className)}\n {...rest}\n >\n {children}\n {required && <span className=\"text-error ml-1\">*</span>}\n </label>\n )\n }\n)\n\nLabel.displayName = 'Label'\n\nexport default Label\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport interface HelperTextProps extends React.HTMLAttributes<HTMLParagraphElement> {\n error?: boolean\n}\n\nexport const HelperText = React.forwardRef<HTMLParagraphElement, HelperTextProps>(\n ({className, error, children, ...rest}, ref) => {\n return (\n <p\n ref={ref}\n className={cx('mt-1.5 text-xs', error ? 'text-error' : 'text-silver', className)}\n {...rest}\n >\n {children}\n </p>\n )\n }\n)\n\nHelperText.displayName = 'HelperText'\n\nexport default HelperText\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {\n error?: boolean\n}\n\nexport const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n ({error = false, className, disabled, ...rest}, ref) => {\n // Base textarea styles\n const base =\n 'w-full px-3 py-2 bg-graphite border border-ash rounded-none ' +\n 'text-white placeholder:text-zinc min-h-[80px] ' +\n 'transition-all duration-fast ' +\n 'focus:border-gold focus:ring-1 focus:ring-gold focus:outline-none ' +\n 'disabled:bg-slate disabled:text-dim disabled:cursor-not-allowed'\n\n // Error styles\n const errorCls = error ? 'border-error focus:border-error focus:ring-error' : ''\n\n return (\n <textarea\n ref={ref}\n className={cx(base, errorCls, disabled && 'opacity-90', className)}\n disabled={disabled}\n {...rest}\n />\n )\n }\n)\n\nTextarea.displayName = 'Textarea'\n\nexport default Textarea\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport interface SelectOption {\n label: string\n value: string | number\n}\n\nexport interface SelectProps extends React.SelectHTMLAttributes<HTMLSelectElement> {\n error?: boolean\n options?: SelectOption[]\n}\n\nconst selectBgImage = \"url(\\\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23C9A227' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e\\\")\"\n\nexport const Select = React.forwardRef<HTMLSelectElement, SelectProps>(\n ({error = false, className, disabled, options, children, ...rest}, ref) => {\n return (\n <select\n ref={ref}\n className={cx(\n 'appearance-none bg-graphite border border-ash rounded-none text-white px-3 py-2 pr-8',\n 'focus:border-gold focus:ring-1 focus:ring-gold focus:outline-none',\n 'disabled:opacity-50 disabled:cursor-not-allowed',\n error && 'border-error focus:border-error focus:ring-error',\n className\n )}\n style={{\n backgroundImage: selectBgImage,\n backgroundPosition: 'right 0.5rem center',\n backgroundRepeat: 'no-repeat',\n backgroundSize: '1.5em 1.5em',\n }}\n disabled={disabled}\n {...rest}\n >\n {options\n ? options.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))\n : children}\n </select>\n )\n }\n)\n\nSelect.displayName = 'Select'\n\nexport default Select\n","import React, {useCallback, useId} from 'react'\nimport {composeRefs, cx} from '../utils'\n\nexport interface CheckboxProps extends React.InputHTMLAttributes<HTMLInputElement> {\n label?: string\n}\n\nconst checkmarkSvg = \"url(\\\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='%231A1A1A' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e\\\")\"\n\nexport const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(\n ({className, label, id, onChange, ...rest}, ref) => {\n const generatedId = useId()\n const inputId = id || rest.name || generatedId\n\n const initBackground = useCallback((node: HTMLInputElement | null) => {\n if (node && node.checked) {\n node.style.backgroundImage = checkmarkSvg\n }\n }, [])\n\n const handleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n e.currentTarget.style.backgroundImage = e.currentTarget.checked ? checkmarkSvg : 'none'\n onChange?.(e)\n }, [onChange])\n\n return (\n <div className=\"flex items-center\">\n <input\n {...rest}\n type=\"checkbox\"\n id={inputId}\n ref={composeRefs(initBackground, ref)}\n className={cx(\n 'appearance-none h-4 w-4 border border-ash bg-graphite',\n 'checked:bg-gold checked:border-gold',\n 'focus:ring-1 focus:ring-gold focus:ring-offset-1 focus:ring-offset-obsidian',\n 'transition duration-200 ease-in-out cursor-pointer',\n 'disabled:opacity-50 disabled:cursor-not-allowed',\n className\n )}\n style={{\n backgroundPosition: 'center',\n backgroundSize: 'contain',\n backgroundRepeat: 'no-repeat',\n }}\n onChange={handleChange}\n />\n {label && (\n <label htmlFor={inputId}\n className=\"ml-2 text-sm text-silver cursor-pointer select-none\">\n {label}\n </label>\n )}\n </div>\n )\n }\n)\n\nCheckbox.displayName = 'Checkbox'\n\nexport default Checkbox\n","import React, {useCallback, useId} from 'react'\nimport {composeRefs, cx} from '../utils'\n\nexport interface RadioProps extends React.InputHTMLAttributes<HTMLInputElement> {\n label?: string\n}\n\nconst radioDotSvg = \"url(\\\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='%231A1A1A' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e\\\")\"\n\nexport const Radio = React.forwardRef<HTMLInputElement, RadioProps>(\n ({className, label, id, onChange, ...rest}, ref) => {\n const generatedId = useId()\n const inputId = id || rest.name || generatedId\n\n const initBackground = useCallback((node: HTMLInputElement | null) => {\n if (node && node.checked) {\n node.style.backgroundImage = radioDotSvg\n }\n }, [])\n\n const handleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const input = e.currentTarget\n if (input.checked) {\n input.style.backgroundImage = radioDotSvg\n // Clear other radios in the same group. Browsers already uncheck siblings,\n // but the inline-style background dot doesn't get a change event there.\n if (input.name) {\n const escaped = typeof CSS !== 'undefined' && typeof CSS.escape === 'function'\n ? CSS.escape(input.name)\n : input.name.replace(/[\"\\\\\\]]/g, '\\\\$&')\n const radios = input.ownerDocument.querySelectorAll<HTMLInputElement>(\n `input[type=\"radio\"][name=\"${escaped}\"]`)\n radios.forEach((radio) => {\n if (radio !== input) {\n radio.style.backgroundImage = 'none'\n }\n })\n }\n } else {\n input.style.backgroundImage = 'none'\n }\n onChange?.(e)\n }, [onChange])\n\n return (\n <div className=\"flex items-center\">\n <input\n {...rest}\n type=\"radio\"\n id={inputId}\n ref={composeRefs(initBackground, ref)}\n className={cx(\n 'appearance-none h-4 w-4 border border-ash rounded-full bg-graphite',\n 'checked:bg-gold checked:border-gold',\n 'focus:ring-1 focus:ring-gold focus:ring-offset-1 focus:ring-offset-obsidian',\n 'transition duration-200 ease-in-out cursor-pointer',\n 'disabled:opacity-50 disabled:cursor-not-allowed',\n className\n )}\n style={{\n backgroundPosition: 'center',\n backgroundSize: 'contain',\n backgroundRepeat: 'no-repeat',\n }}\n onChange={handleChange}\n />\n {label && (\n <label htmlFor={inputId}\n className=\"ml-2 text-sm text-silver cursor-pointer select-none\">\n {label}\n </label>\n )}\n </div>\n )\n }\n)\n\nRadio.displayName = 'Radio'\n\nexport default Radio\n","import React, {useCallback, useRef, useState} from 'react'\nimport {cx} from '../utils/cx'\n\nexport interface SwitchProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onChange'> {\n checked?: boolean\n defaultChecked?: boolean\n onCheckedChange?: (checked: boolean) => void\n label?: string\n}\n\nexport const Switch = React.forwardRef<HTMLButtonElement, SwitchProps>(\n ({\n checked: controlledChecked,\n defaultChecked = false,\n onCheckedChange,\n disabled,\n className,\n label,\n ...rest\n }, ref) => {\n const [internalChecked, setInternalChecked] = useState(defaultChecked)\n const isControlled = controlledChecked !== undefined\n const checked = isControlled ? controlledChecked : internalChecked\n const buttonRef = useRef<HTMLButtonElement | null>(null)\n const setRefs = useCallback(\n (node: HTMLButtonElement | null) => {\n buttonRef.current = node\n if (typeof ref === 'function') {\n ref(node)\n } else if (ref) {\n ref.current = node\n }\n },\n [ref]\n )\n\n const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n if (disabled) {\n return\n }\n const newChecked = !checked\n if (!isControlled) {\n setInternalChecked(newChecked)\n }\n onCheckedChange?.(newChecked)\n rest.onClick?.(e)\n }\n\n return (\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={checked}\n data-state={checked ? 'checked' : 'unchecked'}\n disabled={disabled}\n ref={setRefs}\n onClick={handleClick}\n className={cx(\n 'relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent',\n 'transition-colors duration-200 ease-in-out',\n 'focus:outline-none focus-visible:ring-2 focus-visible:ring-gold focus-visible:ring-offset-2 focus-visible:ring-offset-obsidian',\n 'disabled:opacity-50 disabled:cursor-not-allowed',\n checked ? 'bg-gold' : 'bg-charcoal',\n className\n )}\n {...rest}\n >\n <span\n className={cx(\n 'pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0',\n 'transition duration-200 ease-in-out',\n checked ? 'translate-x-5' : 'translate-x-0'\n )}\n />\n </button>\n {label && (\n <span\n className=\"text-sm text-silver cursor-pointer\"\n onClick={() => {\n if (disabled) {\n return\n }\n buttonRef.current?.click()\n }}\n >\n {label}\n </span>\n )}\n </div>\n )\n }\n)\n\nSwitch.displayName = 'Switch'\n\nexport default Switch\n","import React, {useCallback, useRef, useState} from 'react'\nimport {cx} from '../utils/cx'\n\nexport interface SliderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {\n value?: number\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n onChange?: (value: number) => void\n onChangeEnd?: (value: number) => void\n disabled?: boolean\n showTooltip?: boolean\n formatValue?: (value: number) => string\n size?: 'sm' | 'md' | 'lg'\n}\n\nconst SIZE_TRACK: Record<string, string> = {\n sm: 'h-1',\n md: 'h-2',\n lg: 'h-3',\n}\n\nconst SIZE_THUMB: Record<string, string> = {\n sm: 'h-3 w-3',\n md: 'h-4 w-4',\n lg: 'h-5 w-5',\n}\n\nexport const Slider = React.forwardRef<HTMLDivElement, SliderProps>(\n (\n {\n value: controlledValue,\n defaultValue = 0,\n min = 0,\n max = 100,\n step = 1,\n onChange,\n onChangeEnd,\n disabled = false,\n showTooltip = false,\n formatValue = (v) => String(v),\n size = 'md',\n className,\n ...props\n },\n ref\n ) => {\n const [internalValue, setInternalValue] = useState(defaultValue)\n const [isDragging, setIsDragging] = useState(false)\n const trackRef = useRef<HTMLDivElement>(null)\n\n const isControlled = controlledValue !== undefined\n const value = isControlled ? controlledValue : internalValue\n\n const percentage = ((value - min) / (max - min)) * 100\n\n const updateValue = useCallback(\n (clientX: number) => {\n if (!trackRef.current || disabled) {\n return\n }\n\n const rect = trackRef.current.getBoundingClientRect()\n const percent = Math.max(0, Math.min(1, (clientX - rect.left) / rect.width))\n const rawValue = min + percent * (max - min)\n const steppedValue = Math.round(rawValue / step) * step\n const clampedValue = Math.max(min, Math.min(max, steppedValue))\n\n if (!isControlled) {\n setInternalValue(clampedValue)\n }\n onChange?.(clampedValue)\n },\n [min, max, step, disabled, isControlled, onChange]\n )\n\n const handleMouseDown = (e: React.MouseEvent) => {\n if (disabled) {\n return\n }\n setIsDragging(true)\n updateValue(e.clientX)\n\n const handleMouseMove = (e: MouseEvent) => {\n updateValue(e.clientX)\n }\n\n const handleMouseUp = (e: MouseEvent) => {\n setIsDragging(false)\n document.removeEventListener('mousemove', handleMouseMove)\n document.removeEventListener('mouseup', handleMouseUp)\n\n if (trackRef.current) {\n const rect = trackRef.current.getBoundingClientRect()\n const percent = Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width))\n const rawValue = min + percent * (max - min)\n const steppedValue = Math.round(rawValue / step) * step\n const clampedValue = Math.max(min, Math.min(max, steppedValue))\n onChangeEnd?.(clampedValue)\n }\n }\n\n document.addEventListener('mousemove', handleMouseMove)\n document.addEventListener('mouseup', handleMouseUp)\n }\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n if (disabled) {\n return\n }\n\n let newValue = value\n switch (e.key) {\n case 'ArrowRight':\n case 'ArrowUp':\n newValue = Math.min(max, value + step)\n break\n case 'ArrowLeft':\n case 'ArrowDown':\n newValue = Math.max(min, value - step)\n break\n case 'Home':\n newValue = min\n break\n case 'End':\n newValue = max\n break\n default:\n return\n }\n\n e.preventDefault()\n if (!isControlled) {\n setInternalValue(newValue)\n }\n onChange?.(newValue)\n onChangeEnd?.(newValue)\n }\n\n return (\n <div\n ref={ref}\n className={cx('relative w-full py-2', disabled && 'opacity-50', className)}\n {...props}\n >\n <div\n ref={trackRef}\n className={cx(\n 'relative w-full bg-charcoal border border-ash cursor-pointer',\n SIZE_TRACK[size]\n )}\n onMouseDown={handleMouseDown}\n >\n {/* Filled track */}\n <div\n className={cx('absolute inset-y-0 left-0 bg-gold', SIZE_TRACK[size])}\n style={{width: `${percentage}%`}}\n />\n\n {/* Thumb */}\n <div\n role=\"slider\"\n tabIndex={disabled ? -1 : 0}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-valuenow={value}\n aria-disabled={disabled}\n onKeyDown={handleKeyDown}\n className={cx(\n 'absolute top-1/2 -translate-y-1/2 -translate-x-1/2',\n 'bg-gold border-2 border-gold-light rounded-full',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gold focus-visible:ring-offset-2 focus-visible:ring-offset-obsidian',\n 'transition-transform duration-fast',\n isDragging && 'scale-110',\n !disabled && 'cursor-grab active:cursor-grabbing',\n SIZE_THUMB[size]\n )}\n style={{left: `${percentage}%`}}\n >\n {/* Tooltip */}\n {showTooltip && isDragging && (\n <div\n className=\"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-graphite border border-ash text-xs text-white whitespace-nowrap\">\n {formatValue(value)}\n </div>\n )}\n </div>\n </div>\n </div>\n )\n }\n)\n\nSlider.displayName = 'Slider'\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\n// InputGroup container\nexport interface InputGroupProps extends React.HTMLAttributes<HTMLDivElement> {\n}\n\nexport const InputGroup = React.forwardRef<HTMLDivElement, InputGroupProps>(\n ({className, children, ...props}, ref) => {\n return (\n <div\n ref={ref}\n className={cx('flex', className)}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nInputGroup.displayName = 'InputGroup'\n\n// InputLeftAddon - static text/icon on the left\nexport interface InputAddonProps extends React.HTMLAttributes<HTMLDivElement> {\n}\n\nexport const InputLeftAddon = React.forwardRef<HTMLDivElement, InputAddonProps>(\n ({className, children, ...props}, ref) => {\n return (\n <div\n ref={ref}\n className={cx(\n 'flex items-center px-3 bg-slate border border-r-0 border-ash',\n 'text-sm text-silver whitespace-nowrap',\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nInputLeftAddon.displayName = 'InputLeftAddon'\n\n// InputRightAddon - static text/icon on the right\nexport const InputRightAddon = React.forwardRef<HTMLDivElement, InputAddonProps>(\n ({className, children, ...props}, ref) => {\n return (\n <div\n ref={ref}\n className={cx(\n 'flex items-center px-3 bg-slate border border-l-0 border-ash',\n 'text-sm text-silver whitespace-nowrap',\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nInputRightAddon.displayName = 'InputRightAddon'\n\n// InputLeftElement - overlaid element on the left (like an icon inside the input)\nexport interface InputElementProps extends React.HTMLAttributes<HTMLDivElement> {\n}\n\nexport const InputLeftElement = React.forwardRef<HTMLDivElement, InputElementProps>(\n ({className, children, ...props}, ref) => {\n return (\n <div\n ref={ref}\n className={cx(\n 'absolute left-0 inset-y-0 flex items-center pl-3',\n 'pointer-events-none text-silver',\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nInputLeftElement.displayName = 'InputLeftElement'\n\n// InputRightElement - overlaid element on the right (like a button inside the input)\nexport const InputRightElement = React.forwardRef<HTMLDivElement, InputElementProps>(\n ({className, children, ...props}, ref) => {\n return (\n <div\n ref={ref}\n className={cx(\n 'absolute right-0 inset-y-0 flex items-center pr-3',\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nInputRightElement.displayName = 'InputRightElement'\n\n// InputWrapper - for relative positioning when using left/right elements\nexport interface InputWrapperProps extends React.HTMLAttributes<HTMLDivElement> {\n}\n\nexport const InputWrapper = React.forwardRef<HTMLDivElement, InputWrapperProps>(\n ({className, children, ...props}, ref) => {\n return (\n <div\n ref={ref}\n className={cx('relative flex-1', className)}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nInputWrapper.displayName = 'InputWrapper'\n","import React from 'react'\nimport {AlertTriangle, CheckCircle, Info, XCircle} from 'lucide-react'\nimport {cx} from '../utils/cx'\n\nexport type AlertVariant = 'info' | 'success' | 'warning' | 'error'\n\nexport interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: AlertVariant\n title?: string\n}\n\nconst icons = {\n info: Info,\n success: CheckCircle,\n warning: AlertTriangle,\n error: XCircle,\n}\n\nconst variantStyles = {\n info: 'bg-info/10 border-info text-info',\n success: 'bg-success/10 border-success text-success',\n warning: 'bg-warning/10 border-warning text-warning',\n error: 'bg-error/10 border-error text-error',\n}\n\nexport const Alert = React.forwardRef<HTMLDivElement, AlertProps>(\n ({variant = 'info', title, children, className, ...rest}, ref) => {\n const Icon = icons[variant]\n\n return (\n <div\n ref={ref}\n role=\"alert\"\n className={cx(\n 'relative w-full p-4 rounded-none border border-l-4 flex gap-3',\n variantStyles[variant],\n className\n )}\n {...rest}\n >\n <Icon className=\"h-5 w-5 shrink-0\"/>\n <div className=\"flex-1\">\n {title && <h5\n className=\"mb-1 font-medium leading-none tracking-tight text-current\">{title}</h5>}\n <div className=\"text-sm opacity-90\">{children}</div>\n </div>\n </div>\n )\n }\n)\n\nAlert.displayName = 'Alert'\n\nexport default Alert\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type SpinnerSize = 'sm' | 'md' | 'lg'\n\nexport interface SpinnerProps extends React.SVGAttributes<SVGElement> {\n size?: SpinnerSize\n}\n\nexport const Spinner = ({className, size = 'md', ...rest}: SpinnerProps) => {\n const sizeClass =\n size === 'sm' ? 'h-4 w-4' : size === 'lg' ? 'h-8 w-8' : 'h-6 w-6'\n\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={cx('animate-spin text-gold', sizeClass, className)}\n {...rest}\n >\n <path d=\"M21 12a9 9 0 1 1-6.219-8.56\"/>\n </svg>\n )\n}\n\nSpinner.displayName = 'Spinner'\n\nexport default Spinner\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type ProgressSize = 'sm' | 'md' | 'lg'\nexport type ProgressVariant = 'default' | 'success' | 'warning' | 'error'\n\nexport interface ProgressProps extends React.HTMLAttributes<HTMLDivElement> {\n value?: number\n max?: number\n size?: ProgressSize\n variant?: ProgressVariant\n showValue?: boolean\n formatValue?: (value: number, max: number) => string\n indeterminate?: boolean\n}\n\nconst SIZE_MAP: Record<ProgressSize, string> = {\n sm: 'h-1',\n md: 'h-2',\n lg: 'h-3',\n}\n\nconst VARIANT_MAP: Record<ProgressVariant, string> = {\n default: 'bg-gold',\n success: 'bg-success',\n warning: 'bg-warning',\n error: 'bg-error',\n}\n\nexport const Progress = React.forwardRef<HTMLDivElement, ProgressProps>(\n (\n {\n value = 0,\n max = 100,\n size = 'md',\n variant = 'default',\n showValue = false,\n formatValue,\n indeterminate = false,\n className,\n ...props\n },\n ref\n ) => {\n const percentage = Math.min(100, Math.max(0, (value / max) * 100))\n const displayValue = formatValue\n ? formatValue(value, max)\n : `${Math.round(percentage)}%`\n\n return (\n <div ref={ref} className={cx('w-full', className)} {...props}>\n {showValue && (\n <div className=\"flex justify-between mb-1\">\n <span className=\"text-sm text-silver\">Progress</span>\n <span className=\"text-sm text-white font-medium\">{displayValue}</span>\n </div>\n )}\n <div\n className={cx(\n 'w-full bg-charcoal border border-ash overflow-hidden rounded-none',\n SIZE_MAP[size]\n )}\n role=\"progressbar\"\n aria-valuenow={indeterminate ? undefined : value}\n aria-valuemin={0}\n aria-valuemax={max}\n >\n <div\n className={cx(\n 'h-full transition-all duration-300 ease-out',\n VARIANT_MAP[variant],\n indeterminate && 'animate-pulse'\n )}\n style={{\n width: indeterminate ? '100%' : `${percentage}%`,\n }}\n />\n </div>\n </div>\n )\n }\n)\n\nProgress.displayName = 'Progress'\n","import React, {createContext, useCallback, useContext, useEffect, useState} from 'react'\nimport {createPortal} from 'react-dom'\nimport {AlertCircle, AlertTriangle, CheckCircle, Info, X} from 'lucide-react'\nimport {cx} from '../utils/cx'\n\nlet toastCounter = 0\nfunction createToastId(): string {\n toastCounter += 1\n return `toast-${Date.now().toString(36)}-${toastCounter}`\n}\n\nexport type ToastVariant = 'default' | 'success' | 'error' | 'warning' | 'info'\nexport type ToastPosition =\n 'top-right'\n | 'top-left'\n | 'bottom-right'\n | 'bottom-left'\n | 'top-center'\n | 'bottom-center'\n\nexport interface ToastData {\n id: string\n title?: string\n description?: string\n variant?: ToastVariant\n duration?: number\n action?: React.ReactNode\n}\n\ninterface ToastContextValue {\n toasts: ToastData[]\n addToast: (toast: Omit<ToastData, 'id'>) => string\n removeToast: (id: string) => void\n position: ToastPosition\n}\n\nconst ToastContext = createContext<ToastContextValue | null>(null)\n\nexport function useToast() {\n const context = useContext(ToastContext)\n if (!context) {\n throw new Error('useToast must be used within a ToastProvider')\n }\n\n const toast = useCallback(\n (options: Omit<ToastData, 'id'>) => {\n return context.addToast(options)\n },\n [context]\n )\n\n return {\n toast,\n dismiss: context.removeToast,\n }\n}\n\n// ToastProvider - wrap your app with this\nexport interface ToastProviderProps {\n children: React.ReactNode\n position?: ToastPosition\n defaultDuration?: number\n}\n\nexport const ToastProvider: React.FC<ToastProviderProps> = ({\n children,\n position = 'bottom-right',\n defaultDuration = 5000,\n}) => {\n const [toasts, setToasts] = useState<ToastData[]>([])\n const [mounted, setMounted] = useState(false)\n\n useEffect(() => {\n setMounted(true)\n }, [])\n\n const addToast = useCallback(\n (toast: Omit<ToastData, 'id'>) => {\n const id = createToastId()\n const newToast: ToastData = {\n ...toast,\n id,\n duration: toast.duration ?? defaultDuration,\n }\n setToasts((prev) => [...prev, newToast])\n return id\n },\n [defaultDuration]\n )\n\n const removeToast = useCallback((id: string) => {\n setToasts((prev) => prev.filter((t) => t.id !== id))\n }, [])\n\n return (\n <ToastContext.Provider value={{toasts, addToast, removeToast, position}}>\n {children}\n {mounted && <ToastViewport/>}\n </ToastContext.Provider>\n )\n}\n\nToastProvider.displayName = 'ToastProvider'\n\nconst POSITION_CLASSES: Record<ToastPosition, string> = {\n 'top-right': 'top-4 right-4',\n 'top-left': 'top-4 left-4',\n 'bottom-right': 'bottom-4 right-4',\n 'bottom-left': 'bottom-4 left-4',\n 'top-center': 'top-4 left-1/2 -translate-x-1/2',\n 'bottom-center': 'bottom-4 left-1/2 -translate-x-1/2',\n}\n\n// ToastViewport - container for all toasts\nconst ToastViewport: React.FC = () => {\n const context = useContext(ToastContext)\n if (!context) {\n return null\n }\n\n const {toasts, position} = context\n\n return createPortal(\n <div\n className={cx(\n 'fixed z-50 flex flex-col gap-2 pointer-events-none',\n POSITION_CLASSES[position]\n )}\n >\n {toasts.map((toast) => (\n <Toast key={toast.id} {...toast} />\n ))}\n </div>,\n document.body\n )\n}\n\n// Individual Toast\ninterface ToastProps extends ToastData {\n}\n\nconst VARIANT_STYLES: Record<ToastVariant, string> = {\n default: 'bg-charcoal border-ash',\n success: 'bg-charcoal border-success/50',\n error: 'bg-charcoal border-error/50',\n warning: 'bg-charcoal border-warning/50',\n info: 'bg-charcoal border-info/50',\n}\n\nconst VARIANT_ICONS: Record<ToastVariant, React.ReactNode> = {\n default: null,\n success: <CheckCircle className=\"h-5 w-5 text-success\"/>,\n error: <AlertCircle className=\"h-5 w-5 text-error\"/>,\n warning: <AlertTriangle className=\"h-5 w-5 text-warning\"/>,\n info: <Info className=\"h-5 w-5 text-info\"/>,\n}\n\nconst Toast: React.FC<ToastProps> = ({\n id,\n title,\n description,\n variant = 'default',\n duration,\n action,\n}) => {\n const context = useContext(ToastContext)\n\n useEffect(() => {\n if (duration && duration > 0) {\n const timer = setTimeout(() => {\n context?.removeToast(id)\n }, duration)\n return () => clearTimeout(timer)\n }\n }, [id, duration, context])\n\n const icon = VARIANT_ICONS[variant]\n\n return (\n <div\n role=\"alert\"\n className={cx(\n 'pointer-events-auto w-80 p-4 border shadow-lg animate-slide-in-right',\n VARIANT_STYLES[variant]\n )}\n >\n <div className=\"flex gap-3\">\n {icon && <div className=\"shrink-0 mt-0.5\">{icon}</div>}\n <div className=\"flex-1 min-w-0\">\n {title && (\n <p className=\"text-sm font-medium text-white\">{title}</p>\n )}\n {description && (\n <p className=\"text-sm text-silver mt-1\">{description}</p>\n )}\n {action && <div className=\"mt-3\">{action}</div>}\n </div>\n <button\n onClick={() => context?.removeToast(id)}\n className=\"shrink-0 text-silver hover:text-white transition-colors\"\n >\n <X className=\"h-4 w-4\"/>\n <span className=\"sr-only\">Dismiss</span>\n </button>\n </div>\n </div>\n )\n}\n\nToast.displayName = 'Toast'\n","import React, {useEffect, useState} from 'react'\nimport {createPortal} from 'react-dom'\nimport {X} from 'lucide-react'\nimport {cx, useEscapeKey, useScrollLock} from '../utils'\n\nexport interface ModalProps {\n isOpen: boolean\n onClose: () => void\n title?: string\n children: React.ReactNode\n className?: string\n}\n\nexport const Modal = ({isOpen, onClose, title, children, className}: ModalProps) => {\n const [mounted, setMounted] = useState(false)\n\n useEffect(() => {\n setMounted(true)\n }, [])\n\n useScrollLock(isOpen)\n useEscapeKey(onClose, isOpen)\n\n if (!mounted || !isOpen) {\n return null\n }\n\n const content = (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6\"\n onClick={onClose}>\n <div className=\"fixed inset-0 z-40 bg-obsidian/80 backdrop-blur-sm\" aria-hidden=\"true\"/>\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n className={cx(\n 'bg-charcoal border border-gold/30 shadow-2xl z-50 w-full max-w-lg p-6 rounded-none relative flex flex-col',\n className\n )}\n data-state=\"open\"\n onClick={(e) => e.stopPropagation()}\n >\n <div className=\"flex items-center justify-between mb-2\">\n {title ? <h3 className=\"text-xl font-semibold text-white m-0\">{title}</h3> : <div/>}\n <button onClick={onClose}\n className=\"text-silver hover:text-white transition-colors ml-auto\">\n <X className=\"h-5 w-5\"/>\n <span className=\"sr-only\">Close</span>\n </button>\n </div>\n <div className=\"overflow-y-auto min-h-0\">{children}</div>\n </div>\n </div>\n )\n\n return createPortal(content, document.body)\n}\n\nModal.displayName = 'Modal'\n\nexport default Modal\n","import React, {useCallback} from 'react'\nimport {cx, useEscapeKey} from '../utils'\nimport {CloseIcon} from './icons'\n\nexport interface LightboxProps {\n /**\n * Called when the user dismisses the lightbox (ESC, backdrop click, X button).\n * The caller owns the open/closed state — when `onClose` fires, unmount the\n * lightbox.\n */\n onClose: () => void\n /**\n * Optional kind-specific actions placed before the close button in the\n * floating top-right cluster. Typically buttons like \"Share\" or \"Download\".\n * The cluster always renders the close button; pass `undefined` if the only\n * affordance is dismiss.\n */\n actions?: React.ReactNode\n /**\n * Optional caption shown bottom-centre over the backdrop. Use for short\n * metadata like a title and subtitle. Non-interactive — clicks pass through\n * to the backdrop and dismiss.\n */\n caption?: React.ReactNode\n /**\n * The artifact body. Sits directly on the backdrop with no inner frame —\n * the body is responsible for its own layout (object-contain image, scrollable\n * deliverable, readable text column, etc.). Click events whose target is the\n * sized content wrapper (i.e. the empty area around the body) dismiss the\n * lightbox; clicks on the body itself do not.\n */\n children: React.ReactNode\n className?: string\n}\n\n/**\n * Full-bleed modal canvas for one piece of content. Premium-haptic alternative\n * to a bordered modal: deep void backdrop, scale-fade entrance, no inner frame,\n * floating glass action cluster top-right.\n *\n * The component is content-agnostic — it ships chrome, not artifact knowledge.\n * Compose it with kind-aware bodies and action sets to build the artifact\n * viewer; reach for it directly any time a single piece of content needs the\n * full screen.\n *\n * Dismiss surfaces: ESC, backdrop click (outside the sized content area),\n * close button in the action cluster.\n */\nexport function Lightbox({\n onClose,\n actions,\n caption,\n children,\n className,\n}: LightboxProps) {\n useEscapeKey(onClose)\n\n // Two close-zones: the backdrop itself and the empty area around the body\n // inside the sized content wrapper. Children that should not dismiss (the\n // body, the action cluster) are descendants — their click targets aren't\n // the wrapper, so the guard skips them.\n const handleSurfaceClick = useCallback((e: React.MouseEvent) => {\n if (e.target === e.currentTarget) {\n onClose()\n }\n }, [onClose])\n\n return (\n <div\n className={cx(\n 'fixed inset-0 z-50 flex items-center justify-center',\n 'bg-void/95 backdrop-blur-md animate-fade-in',\n className,\n )}\n onClick={handleSurfaceClick}\n role=\"dialog\"\n aria-modal=\"true\"\n >\n {/* Floating action cluster — stays put as content scrolls */}\n <div\n className={cx(\n 'absolute top-3 right-3 z-10 flex items-center',\n 'bg-charcoal/70 backdrop-blur border border-ash/40',\n 'group/actions hover:border-gold/40 transition-colors',\n )}\n >\n {actions && (\n <>\n <div className=\"flex items-center gap-1 px-1 py-1\">\n {actions}\n </div>\n <div className=\"w-px self-stretch bg-ash/40\"/>\n </>\n )}\n <button\n onClick={onClose}\n aria-label=\"Close\"\n className=\"p-2 text-silver hover:text-white hover:bg-ash/20 transition-colors\"\n >\n <CloseIcon className=\"w-5 h-5\"/>\n </button>\n </div>\n\n {/* Sized canvas — bare, no frame. Click on the empty area dismisses. */}\n <div\n className=\"relative w-11/12 h-11/12 max-w-7xl flex items-center justify-center animate-lightbox-in\"\n onClick={handleSurfaceClick}\n >\n {children}\n </div>\n\n {caption && (\n <div className=\"absolute bottom-6 left-0 right-0 text-center pointer-events-none px-4\">\n {caption}\n </div>\n )}\n </div>\n )\n}\n","import React from 'react'\nimport type {IconProps} from './index'\n\nexport function ChatBubbleIcon({className, ...props}: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className={className}\n {...props}\n >\n <path\n d=\"M2 3h16v11H6l-4 3V3z\"\n />\n </svg>\n )\n}\n","import React from 'react'\nimport type {IconProps} from './index'\n\nexport function ChevronLeftIcon({className, ...props}: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className={className}\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n","import React from 'react'\nimport type {IconProps} from './index'\n\nexport function ChevronRightIcon({className, ...props}: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className={className}\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n","import React from 'react'\nimport type {IconProps} from './index'\n\nexport function CloseIcon({className, ...props}: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className={className}\n {...props}\n >\n <path\n d=\"M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z\"\n />\n </svg>\n )\n}\n","import React from 'react'\nimport type {IconProps} from './index'\n\nexport function ExpandIcon({className, ...props}: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className={className}\n {...props}\n >\n <path\n d=\"M13.28 7.78l3.22-3.22v2.69a.75.75 0 001.5 0v-4.5a.75.75 0 00-.75-.75h-4.5a.75.75 0 000 1.5h2.69l-3.22 3.22a.75.75 0 001.06 1.06zM2 17.25v-4.5a.75.75 0 011.5 0v2.69l3.22-3.22a.75.75 0 011.06 1.06L4.56 16.5h2.69a.75.75 0 010 1.5h-4.5a.75.75 0 01-.75-.75z\"\n />\n </svg>\n )\n}\n","import React from 'react'\nimport type {IconProps} from './index'\n\nexport function HistoryIcon({className, ...props}: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className={className}\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm.75-13a.75.75 0 00-1.5 0v5c0 .414.336.75.75.75h4a.75.75 0 000-1.5h-3.25V5z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n","import React from 'react'\nimport type {IconProps} from './index'\n\nexport function LayersIcon({className, ...props}: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className={className}\n {...props}\n >\n <path\n d=\"M3.196 12.87l-.825.483a.75.75 0 000 1.294l7.25 4.25a.75.75 0 00.758 0l7.25-4.25a.75.75 0 000-1.294l-.825-.484-5.666 3.322a2.25 2.25 0 01-2.276 0L3.196 12.87z\"\n />\n <path\n d=\"M3.196 8.87l-.825.483a.75.75 0 000 1.294l7.25 4.25a.75.75 0 00.758 0l7.25-4.25a.75.75 0 000-1.294l-.825-.484-5.666 3.322a2.25 2.25 0 01-2.276 0L3.196 8.87z\"\n />\n <path\n d=\"M10.38 1.103a.75.75 0 00-.76 0l-7.25 4.25a.75.75 0 000 1.294l7.25 4.25a.75.75 0 00.76 0l7.25-4.25a.75.75 0 000-1.294l-7.25-4.25z\"\n />\n </svg>\n )\n}\n","import React from 'react'\nimport type {IconProps} from './index'\n\n/**\n * Media icon — a film frame with play triangle, representing video and media artifacts.\n */\nexport function MediaIcon({className, ...props}: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className={className}\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M2 4.5A1.5 1.5 0 013.5 3h13A1.5 1.5 0 0118 4.5v11a1.5 1.5 0 01-1.5 1.5h-13A1.5 1.5 0 012 15.5v-11zM4 5v1h1V5H4zm2 0v1h1V5H6zm7 0v1h1V5h-1zm2 0v1h1V5h-1zM4 14v1h1v-1H4zm2 0v1h1v-1H6zm7 0v1h1v-1h-1zm2 0v1h1v-1h-1zM8 8.118a.5.5 0 01.757-.429l4 2.382a.5.5 0 010 .858l-4 2.382A.5.5 0 018 12.882V8.118z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n","import React from 'react'\nimport type {IconProps} from './index'\n\nexport function PlusIcon({className, ...props}: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className={className}\n {...props}\n >\n <path\n d=\"M10.75 4.75a.75.75 0 00-1.5 0v4.5h-4.5a.75.75 0 000 1.5h4.5v4.5a.75.75 0 001.5 0v-4.5h4.5a.75.75 0 000-1.5h-4.5v-4.5z\"\n />\n </svg>\n )\n}\n","import React from 'react'\nimport {cx} from '../../utils/cx'\nimport type {IconProps} from './index'\n\nexport function CheckSquareIcon({className, ...props}: IconProps) {\n return (\n <div\n className={cx(\n 'relative w-4 h-4 flex-shrink-0 border-2 border-gold bg-gold/10',\n className\n )}\n {...props}\n >\n <svg\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n className=\"absolute inset-0 w-full h-full p-0.5\"\n >\n <path\n d=\"M3 8l3 3 7-7\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"text-gold\"\n />\n </svg>\n </div>\n )\n}\n","import React from 'react'\nimport {cx} from '../../utils/cx'\nimport type {IconProps} from './index'\n\nexport function EmptySquareIcon({className, ...props}: IconProps) {\n return (\n <div\n className={cx(\n 'w-4 h-4 flex-shrink-0 border-2 border-ash/60',\n className\n )}\n {...props}\n />\n )\n}\n","import React from 'react'\nimport {cx} from '../../utils/cx'\nimport type {IconProps} from './index'\n\nexport interface CrossSquareIconProps extends IconProps {\n /**\n * Visual variant for different states\n * - 'cancelled': subtle ash coloring\n * - 'failed': error red coloring\n */\n variant?: 'cancelled' | 'failed'\n}\n\nexport function CrossSquareIcon({className, variant = 'cancelled', ...props}: CrossSquareIconProps) {\n return (\n <div\n className={cx(\n 'relative w-4 h-4 flex-shrink-0 border-2',\n variant === 'failed' ? 'border-error/60 bg-error/5' : 'border-ash/40 bg-ash/5',\n className\n )}\n {...props}\n >\n <svg\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n className=\"absolute inset-0 w-full h-full p-0.5\"\n >\n <path\n d=\"M4 4l8 8M12 4l-8 8\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n className={variant === 'failed' ? 'text-error/60' : 'text-ash/40'}\n />\n </svg>\n </div>\n )\n}\n","import React from 'react'\nimport {cx} from '../../utils/cx'\nimport type {IconProps} from './index'\n\n/**\n * Square loading spinner with \"snake\" animation.\n * A golden stroke travels around a square border.\n */\nexport function SquareLoaderIcon({className, ...props}: IconProps) {\n return (\n <div className={cx('relative w-4 h-4 flex-shrink-0', className)} {...props}>\n <svg\n viewBox=\"0 0 16 16\"\n className=\"w-full h-full animate-snake-spin\"\n >\n {/* Square border path that the snake travels around */}\n <rect\n x=\"1\"\n y=\"1\"\n width=\"14\"\n height=\"14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n className=\"text-ash/40\"\n />\n {/* The \"snake\" - an animated stroke */}\n <rect\n x=\"1\"\n y=\"1\"\n width=\"14\"\n height=\"14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeDasharray=\"14 42\"\n strokeLinecap=\"square\"\n className=\"text-gold animate-snake-travel\"\n />\n </svg>\n </div>\n )\n}\n","import React, {useEffect, useState} from 'react'\nimport {createPortal} from 'react-dom'\nimport {X} from 'lucide-react'\nimport {cx, useEscapeKey, useScrollLock} from '../utils'\n\nexport type DrawerPosition = 'left' | 'right' | 'top' | 'bottom'\n\nexport interface DrawerProps {\n isOpen: boolean\n onClose: () => void\n position?: DrawerPosition\n title?: string\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'full'\n children: React.ReactNode\n className?: string\n}\n\nconst SIZE_MAP: Record<string, Record<DrawerPosition, string>> = {\n sm: {\n left: 'w-64',\n right: 'w-64',\n top: 'h-48',\n bottom: 'h-48',\n },\n md: {\n left: 'w-80',\n right: 'w-80',\n top: 'h-64',\n bottom: 'h-64',\n },\n lg: {\n left: 'w-96',\n right: 'w-96',\n top: 'h-80',\n bottom: 'h-80',\n },\n xl: {\n left: 'w-[32rem]',\n right: 'w-[32rem]',\n top: 'h-96',\n bottom: 'h-96',\n },\n full: {\n left: 'w-full',\n right: 'w-full',\n top: 'h-full',\n bottom: 'h-full',\n },\n}\n\nconst POSITION_CLASSES: Record<DrawerPosition, string> = {\n left: 'left-0 top-0 h-full',\n right: 'right-0 top-0 h-full',\n top: 'top-0 left-0 w-full',\n bottom: 'bottom-0 left-0 w-full',\n}\n\nconst TRANSFORM_CLASSES: Record<DrawerPosition, { open: string; closed: string }> = {\n left: {open: 'translate-x-0', closed: '-translate-x-full'},\n right: {open: 'translate-x-0', closed: 'translate-x-full'},\n top: {open: 'translate-y-0', closed: '-translate-y-full'},\n bottom: {open: 'translate-y-0', closed: 'translate-y-full'},\n}\n\nexport const Drawer: React.FC<DrawerProps> = ({\n isOpen,\n onClose,\n position = 'right',\n title,\n size = 'md',\n children,\n className,\n}) => {\n const [mounted, setMounted] = useState(false)\n\n useEffect(() => {\n setMounted(true)\n }, [])\n\n useScrollLock(isOpen)\n useEscapeKey(onClose, isOpen)\n\n if (!mounted) {\n return null\n }\n\n const content = (\n <div\n className={cx(\n 'fixed inset-0 z-50',\n isOpen ? 'pointer-events-auto' : 'pointer-events-none'\n )}\n >\n {/* Backdrop */}\n <div\n className={cx(\n 'fixed inset-0 bg-obsidian/80 backdrop-blur-sm transition-opacity duration-300',\n isOpen ? 'opacity-100' : 'opacity-0'\n )}\n onClick={onClose}\n aria-hidden=\"true\"\n />\n\n {/* Drawer panel */}\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n className={cx(\n 'fixed bg-charcoal border-ash shadow-2xl flex flex-col',\n 'transition-transform duration-300 ease-out',\n POSITION_CLASSES[position],\n SIZE_MAP[size][position],\n position === 'left' && 'border-r',\n position === 'right' && 'border-l',\n position === 'top' && 'border-b',\n position === 'bottom' && 'border-t',\n isOpen ? TRANSFORM_CLASSES[position].open : TRANSFORM_CLASSES[position].closed,\n className\n )}\n >\n {/* Header */}\n <div className=\"flex items-center justify-between px-4 py-3 border-b border-ash\">\n {title ? (\n <h2 className=\"text-lg font-semibold text-white m-0\">{title}</h2>\n ) : (\n <div/>\n )}\n <button\n onClick={onClose}\n className=\"text-silver hover:text-white transition-colors\"\n >\n <X className=\"h-5 w-5\"/>\n <span className=\"sr-only\">Close</span>\n </button>\n </div>\n\n {/* Content */}\n <div className=\"flex-1 overflow-auto p-4\">{children}</div>\n </div>\n </div>\n )\n\n return createPortal(content, document.body)\n}\n\nDrawer.displayName = 'Drawer'\n","import React, {useCallback, useId, useRef, useState} from 'react'\nimport {cx, useClickOutside, useEscapeKey} from '../utils'\n\nexport type PopoverPosition = 'top' | 'bottom' | 'left' | 'right'\nexport type PopoverAlign = 'start' | 'center' | 'end'\n\nexport interface PopoverProps {\n children: React.ReactNode\n /** The trigger element */\n trigger: React.ReactElement\n /** Position relative to trigger */\n position?: PopoverPosition\n /** Alignment along the position axis */\n align?: PopoverAlign\n /** Controlled open state */\n open?: boolean\n /** Callback when open state changes */\n onOpenChange?: (open: boolean) => void\n /** Close when clicking outside */\n closeOnClickOutside?: boolean\n}\n\nconst POSITION_CLASSES: Record<PopoverPosition, Record<PopoverAlign, string>> = {\n top: {\n start: 'bottom-full left-0 mb-2',\n center: 'bottom-full left-1/2 -translate-x-1/2 mb-2',\n end: 'bottom-full right-0 mb-2',\n },\n bottom: {\n start: 'top-full left-0 mt-2',\n center: 'top-full left-1/2 -translate-x-1/2 mt-2',\n end: 'top-full right-0 mt-2',\n },\n left: {\n start: 'right-full top-0 mr-2',\n center: 'right-full top-1/2 -translate-y-1/2 mr-2',\n end: 'right-full bottom-0 mr-2',\n },\n right: {\n start: 'left-full top-0 ml-2',\n center: 'left-full top-1/2 -translate-y-1/2 ml-2',\n end: 'left-full bottom-0 ml-2',\n },\n}\n\nexport const Popover: React.FC<PopoverProps> = ({\n children,\n trigger,\n position = 'bottom',\n align = 'center',\n open: controlledOpen,\n onOpenChange,\n closeOnClickOutside = true,\n}) => {\n const [internalOpen, setInternalOpen] = useState(false)\n const isControlled = controlledOpen !== undefined\n const isOpen = isControlled ? controlledOpen : internalOpen\n\n const containerRef = useRef<HTMLDivElement>(null)\n const baseId = useId()\n\n const setIsOpen = useCallback(\n (newOpen: boolean) => {\n if (!isControlled) {\n setInternalOpen(newOpen)\n }\n onOpenChange?.(newOpen)\n },\n [isControlled, onOpenChange]\n )\n\n const close = useCallback(() => setIsOpen(false), [setIsOpen])\n useClickOutside(containerRef, close, isOpen && closeOnClickOutside)\n useEscapeKey(close, isOpen)\n\n const handleTriggerClick = () => {\n setIsOpen(!isOpen)\n }\n\n const triggerElement = React.cloneElement(trigger as React.ReactElement<any>, {\n onClick: handleTriggerClick,\n 'aria-haspopup': 'dialog',\n 'aria-expanded': isOpen,\n 'aria-controls': `${baseId}-popover`,\n id: `${baseId}-trigger`,\n })\n\n return (\n <div ref={containerRef} className=\"relative inline-block\">\n {triggerElement}\n {isOpen && (\n <div\n id={`${baseId}-popover`}\n role=\"dialog\"\n aria-labelledby={`${baseId}-trigger`}\n className={cx(\n 'absolute z-50 min-w-48 p-4',\n 'bg-charcoal border border-ash shadow-lg',\n 'animate-fade-in',\n POSITION_CLASSES[position][align]\n )}\n >\n {children}\n </div>\n )}\n </div>\n )\n}\n\nPopover.displayName = 'Popover'\n","import React, {useCallback} from 'react'\nimport {Modal, type ModalProps} from './Modal'\nimport {Button} from './Button'\nimport {cx} from '../utils/cx'\n\n// ConfirmDialog - for confirmation actions\nexport interface ConfirmDialogProps extends Omit<ModalProps, 'children'> {\n description?: React.ReactNode\n confirmText?: string\n cancelText?: string\n onConfirm: () => void | Promise<void>\n onCancel?: () => void\n confirmVariant?: 'primary' | 'important' | 'danger'\n isLoading?: boolean\n}\n\nexport const ConfirmDialog: React.FC<ConfirmDialogProps> = ({\n title = 'Confirm',\n description,\n confirmText = 'Confirm',\n cancelText = 'Cancel',\n onConfirm,\n onCancel,\n onClose,\n confirmVariant = 'important',\n isLoading = false,\n ...props\n}) => {\n const handleCancel = useCallback(() => {\n onCancel?.()\n onClose()\n }, [onCancel, onClose])\n\n const handleConfirm = useCallback(async () => {\n await onConfirm()\n onClose()\n }, [onConfirm, onClose])\n\n return (\n <Modal title={title} onClose={onClose} {...props}>\n {description && (\n <p className=\"text-sm text-silver mb-6\">{description}</p>\n )}\n <div className=\"flex justify-end gap-3\">\n <Button variant=\"outlined\" onClick={handleCancel} disabled={isLoading}>\n {cancelText}\n </Button>\n <Button\n variant={confirmVariant}\n onClick={handleConfirm}\n loading={isLoading}\n >\n {confirmText}\n </Button>\n </div>\n </Modal>\n )\n}\n\nConfirmDialog.displayName = 'ConfirmDialog'\n\n// AlertDialog - for important alerts\nexport interface AlertDialogProps extends Omit<ModalProps, 'children'> {\n description?: React.ReactNode\n acknowledgeText?: string\n variant?: 'default' | 'warning' | 'error'\n}\n\nexport const AlertDialog: React.FC<AlertDialogProps> = ({\n title = 'Alert',\n description,\n acknowledgeText = 'OK',\n variant = 'default',\n onClose,\n ...props\n}) => {\n const titleClass = cx(\n variant === 'warning' && 'text-warning',\n variant === 'error' && 'text-error'\n )\n\n return (\n <Modal onClose={onClose} {...props}>\n <h3 className={cx('text-xl font-semibold mb-2', titleClass)}>{title}</h3>\n {description && (\n <p className=\"text-sm text-silver mb-6\">{description}</p>\n )}\n <div className=\"flex justify-end\">\n <Button variant=\"primary\" onClick={onClose}>\n {acknowledgeText}\n </Button>\n </div>\n </Modal>\n )\n}\n\nAlertDialog.displayName = 'AlertDialog'\n\n// PromptDialog - for user input\nexport interface PromptDialogProps extends Omit<ModalProps, 'children'> {\n description?: React.ReactNode\n placeholder?: string\n defaultValue?: string\n submitText?: string\n cancelText?: string\n onSubmit: (value: string) => void | Promise<void>\n onCancel?: () => void\n isLoading?: boolean\n}\n\nexport const PromptDialog: React.FC<PromptDialogProps> = ({\n title = 'Enter Value',\n description,\n placeholder,\n defaultValue = '',\n submitText = 'Submit',\n cancelText = 'Cancel',\n onSubmit,\n onCancel,\n onClose,\n isLoading = false,\n ...props\n}) => {\n const [value, setValue] = React.useState(defaultValue)\n\n const handleCancel = useCallback(() => {\n onCancel?.()\n onClose()\n }, [onCancel, onClose])\n\n const handleSubmit = useCallback(\n async (e: React.FormEvent) => {\n e.preventDefault()\n await onSubmit(value)\n onClose()\n },\n [onSubmit, value, onClose]\n )\n\n return (\n <Modal title={title} onClose={onClose} {...props}>\n <form onSubmit={handleSubmit}>\n {description && (\n <p className=\"text-sm text-silver mb-4\">{description}</p>\n )}\n <input\n type=\"text\"\n value={value}\n onChange={(e) => setValue(e.target.value)}\n placeholder={placeholder}\n className={cx(\n 'w-full px-3 py-2 bg-graphite border border-ash',\n 'text-white placeholder:text-zinc',\n 'focus:border-gold focus:ring-1 focus:ring-gold focus:outline-none',\n 'mb-6'\n )}\n autoFocus\n />\n <div className=\"flex justify-end gap-3\">\n <Button\n type=\"button\"\n variant=\"outlined\"\n onClick={handleCancel}\n disabled={isLoading}\n >\n {cancelText}\n </Button>\n <Button type=\"submit\" variant=\"important\" loading={isLoading}>\n {submitText}\n </Button>\n </div>\n </form>\n </Modal>\n )\n}\n\nPromptDialog.displayName = 'PromptDialog'\n","import React, {createContext, useCallback, useContext, useId, useState} from 'react'\nimport {cx} from '../utils/cx'\n\n// Context for managing tab state\ninterface TabsContextValue {\n activeTab: string\n setActiveTab: (id: string) => void\n baseId: string\n}\n\nconst TabsContext = createContext<TabsContextValue | null>(null)\n\nfunction useTabsContext() {\n const context = useContext(TabsContext)\n if (!context) {\n throw new Error('Tabs components must be used within a Tabs provider')\n }\n return context\n}\n\n// Main Tabs container\nexport interface TabsProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The id of the initially active tab */\n defaultValue?: string\n /** Controlled active tab value */\n value?: string\n /** Callback when active tab changes */\n onValueChange?: (value: string) => void\n}\n\nexport const Tabs = React.forwardRef<HTMLDivElement, TabsProps>(\n ({defaultValue, value, onValueChange, children, className, ...props}, ref) => {\n const [internalValue, setInternalValue] = useState(defaultValue ?? '')\n const isControlled = value !== undefined\n const activeTab = isControlled ? value : internalValue\n const baseId = useId()\n\n const setActiveTab = useCallback(\n (id: string) => {\n if (!isControlled) {\n setInternalValue(id)\n }\n onValueChange?.(id)\n },\n [isControlled, onValueChange]\n )\n\n return (\n <TabsContext.Provider value={{activeTab, setActiveTab, baseId}}>\n <div ref={ref} className={cx('w-full', className)} {...props}>\n {children}\n </div>\n </TabsContext.Provider>\n )\n }\n)\n\nTabs.displayName = 'Tabs'\n\n// TabList - container for Tab buttons\nexport interface TabListProps extends React.HTMLAttributes<HTMLDivElement> {\n}\n\nexport const TabList = React.forwardRef<HTMLDivElement, TabListProps>(\n ({children, className, ...props}, ref) => {\n return (\n <div\n ref={ref}\n role=\"tablist\"\n className={cx(\n 'flex border-b border-ash',\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nTabList.displayName = 'TabList'\n\n// Tab - individual tab button\nexport interface TabProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Unique identifier for this tab */\n value: string\n}\n\nexport const Tab = React.forwardRef<HTMLButtonElement, TabProps>(\n ({value, children, className, disabled, ...props}, ref) => {\n const {activeTab, setActiveTab, baseId} = useTabsContext()\n const isActive = activeTab === value\n const panelId = `${baseId}-panel-${value}`\n const tabId = `${baseId}-tab-${value}`\n\n return (\n <button\n ref={ref}\n id={tabId}\n type=\"button\"\n role=\"tab\"\n aria-selected={isActive}\n aria-controls={panelId}\n tabIndex={isActive ? 0 : -1}\n disabled={disabled}\n onClick={() => setActiveTab(value)}\n className={cx(\n 'px-4 py-2 text-sm font-medium transition-all duration-fast',\n 'border-b-2 -mb-px',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gold focus-visible:ring-inset',\n isActive\n ? 'border-gold text-gold'\n : 'border-transparent text-silver hover:text-white hover:border-ash',\n disabled && 'opacity-50 cursor-not-allowed',\n className\n )}\n {...props}\n >\n {children}\n </button>\n )\n }\n)\n\nTab.displayName = 'Tab'\n\n// TabPanel - content panel for a tab\nexport interface TabPanelProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Value matching the corresponding Tab */\n value: string\n /** Force the panel to stay mounted when inactive */\n forceMount?: boolean\n}\n\nexport const TabPanel = React.forwardRef<HTMLDivElement, TabPanelProps>(\n ({value, forceMount = false, children, className, ...props}, ref) => {\n const {activeTab, baseId} = useTabsContext()\n const isActive = activeTab === value\n const panelId = `${baseId}-panel-${value}`\n const tabId = `${baseId}-tab-${value}`\n\n if (!isActive && !forceMount) {\n return null\n }\n\n return (\n <div\n ref={ref}\n id={panelId}\n role=\"tabpanel\"\n aria-labelledby={tabId}\n tabIndex={0}\n hidden={!isActive}\n className={cx(\n 'pt-4 focus-visible:outline-none',\n !isActive && 'hidden',\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nTabPanel.displayName = 'TabPanel'\n","import React, {createContext, useCallback, useContext, useId, useState} from 'react'\nimport {ChevronDown} from 'lucide-react'\nimport {cx} from '../utils/cx'\n\n// Context for managing accordion state\ninterface AccordionContextValue {\n expandedItems: Set<string>\n toggleItem: (id: string) => void\n type: 'single' | 'multiple'\n}\n\nconst AccordionContext = createContext<AccordionContextValue | null>(null)\n\nfunction useAccordionContext() {\n const context = useContext(AccordionContext)\n if (!context) {\n throw new Error('Accordion components must be used within an Accordion provider')\n }\n return context\n}\n\n// Main Accordion container\nexport interface AccordionProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Allow multiple items to be open at once */\n type?: 'single' | 'multiple'\n /** Default expanded item(s) */\n defaultValue?: string | string[]\n /** Controlled expanded item(s) */\n value?: string | string[]\n /** Callback when expanded items change */\n onValueChange?: (value: string | string[]) => void\n}\n\nexport const Accordion = React.forwardRef<HTMLDivElement, AccordionProps>(\n (\n {type = 'single', defaultValue, value, onValueChange, children, className, ...props},\n ref\n ) => {\n const [internalValue, setInternalValue] = useState<Set<string>>(() => {\n if (defaultValue) {\n return new Set(Array.isArray(defaultValue) ? defaultValue : [defaultValue])\n }\n return new Set()\n })\n\n const isControlled = value !== undefined\n const expandedItems = isControlled\n ? new Set(Array.isArray(value) ? value : [value])\n : internalValue\n\n const toggleItem = useCallback(\n (id: string) => {\n const newSet = new Set(expandedItems)\n\n if (newSet.has(id)) {\n newSet.delete(id)\n } else {\n if (type === 'single') {\n newSet.clear()\n }\n newSet.add(id)\n }\n\n if (!isControlled) {\n setInternalValue(newSet)\n }\n\n const newValue = Array.from(newSet)\n onValueChange?.(type === 'single' ? newValue[0] ?? '' : newValue)\n },\n [expandedItems, type, isControlled, onValueChange]\n )\n\n return (\n <AccordionContext.Provider value={{expandedItems, toggleItem, type}}>\n <div\n ref={ref}\n className={cx('divide-y divide-ash border border-ash', className)}\n {...props}\n >\n {children}\n </div>\n </AccordionContext.Provider>\n )\n }\n)\n\nAccordion.displayName = 'Accordion'\n\n// AccordionItem - individual accordion section\nexport interface AccordionItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Unique identifier for this item */\n value: string\n /** Disable this item */\n disabled?: boolean\n}\n\nconst AccordionItemContext = createContext<{ value: string; disabled: boolean } | null>(null)\n\nexport const AccordionItem = React.forwardRef<HTMLDivElement, AccordionItemProps>(\n ({value, disabled = false, children, className, ...props}, ref) => {\n return (\n <AccordionItemContext.Provider value={{value, disabled}}>\n <div\n ref={ref}\n data-state={useAccordionContext().expandedItems.has(value) ? 'open' : 'closed'}\n className={cx('bg-charcoal', className)}\n {...props}\n >\n {children}\n </div>\n </AccordionItemContext.Provider>\n )\n }\n)\n\nAccordionItem.displayName = 'AccordionItem'\n\n// AccordionTrigger - clickable header\nexport interface AccordionTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n}\n\nexport const AccordionTrigger = React.forwardRef<HTMLButtonElement, AccordionTriggerProps>(\n ({children, className, ...props}, ref) => {\n const {expandedItems, toggleItem} = useAccordionContext()\n const itemContext = useContext(AccordionItemContext)\n const baseId = useId()\n\n if (!itemContext) {\n throw new Error('AccordionTrigger must be used within an AccordionItem')\n }\n\n const {value, disabled} = itemContext\n const isExpanded = expandedItems.has(value)\n\n return (\n <h3 className=\"m-0\">\n <button\n ref={ref}\n type=\"button\"\n id={`${baseId}-trigger-${value}`}\n aria-expanded={isExpanded}\n aria-controls={`${baseId}-content-${value}`}\n disabled={disabled}\n onClick={() => toggleItem(value)}\n className={cx(\n 'flex w-full items-center justify-between px-4 py-3',\n 'text-left text-sm font-medium text-white',\n 'transition-colors duration-fast',\n 'hover:bg-graphite',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gold focus-visible:ring-inset',\n disabled && 'opacity-50 cursor-not-allowed',\n className\n )}\n {...props}\n >\n <span>{children}</span>\n <ChevronDown\n className={cx(\n 'h-4 w-4 text-silver transition-transform duration-200',\n isExpanded && 'rotate-180'\n )}\n />\n </button>\n </h3>\n )\n }\n)\n\nAccordionTrigger.displayName = 'AccordionTrigger'\n\n// AccordionContent - expandable content\nexport interface AccordionContentProps extends React.HTMLAttributes<HTMLDivElement> {\n}\n\nexport const AccordionContent = React.forwardRef<HTMLDivElement, AccordionContentProps>(\n ({children, className, ...props}, ref) => {\n const {expandedItems} = useAccordionContext()\n const itemContext = useContext(AccordionItemContext)\n const baseId = useId()\n\n if (!itemContext) {\n throw new Error('AccordionContent must be used within an AccordionItem')\n }\n\n const {value} = itemContext\n const isExpanded = expandedItems.has(value)\n\n return (\n <div\n ref={ref}\n id={`${baseId}-content-${value}`}\n role=\"region\"\n aria-labelledby={`${baseId}-trigger-${value}`}\n hidden={!isExpanded}\n className={cx(\n 'overflow-hidden transition-all duration-200',\n isExpanded ? 'animate-fade-in' : 'hidden',\n className\n )}\n {...props}\n >\n <div className=\"px-4 pb-4 text-sm text-silver\">{children}</div>\n </div>\n )\n }\n)\n\nAccordionContent.displayName = 'AccordionContent'\n","import React, {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react'\nimport {composeRefs, cx, useEscapeKey} from '../utils'\n\n// Context for managing menu state\ninterface MenuContextValue {\n isOpen: boolean\n setIsOpen: (open: boolean) => void\n triggerId: string\n menuId: string\n}\n\nconst MenuContext = createContext<MenuContextValue | null>(null)\n\nfunction useMenuContext() {\n const context = useContext(MenuContext)\n if (!context) {\n throw new Error('Menu components must be used within a Menu provider')\n }\n return context\n}\n\n// Main Menu container\nexport interface MenuProps {\n children: React.ReactNode\n open?: boolean\n onOpenChange?: (open: boolean) => void\n}\n\nexport const Menu: React.FC<MenuProps> = ({children, open, onOpenChange}) => {\n const [internalOpen, setInternalOpen] = useState(false)\n const isControlled = open !== undefined\n const isOpen = isControlled ? open : internalOpen\n const baseId = useId()\n\n const setIsOpen = useCallback(\n (newOpen: boolean) => {\n if (!isControlled) {\n setInternalOpen(newOpen)\n }\n onOpenChange?.(newOpen)\n },\n [isControlled, onOpenChange]\n )\n\n return (\n <MenuContext.Provider\n value={{\n isOpen,\n setIsOpen,\n triggerId: `${baseId}-trigger`,\n menuId: `${baseId}-menu`,\n }}\n >\n <div className=\"relative inline-block\">{children}</div>\n </MenuContext.Provider>\n )\n}\n\nMenu.displayName = 'Menu'\n\n// MenuTrigger - button that opens the menu\nexport interface MenuTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n asChild?: boolean\n}\n\nexport const MenuTrigger = React.forwardRef<HTMLButtonElement, MenuTriggerProps>(\n ({children, className, asChild, ...props}, ref) => {\n const {isOpen, setIsOpen, triggerId, menuId} = useMenuContext()\n\n const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n e.preventDefault()\n setIsOpen(!isOpen)\n props.onClick?.(e)\n }\n\n return (\n <button\n ref={ref}\n id={triggerId}\n type=\"button\"\n aria-haspopup=\"menu\"\n aria-expanded={isOpen}\n aria-controls={menuId}\n onClick={handleClick}\n className={cx(\n 'inline-flex items-center justify-center',\n className\n )}\n {...props}\n >\n {children}\n </button>\n )\n }\n)\n\nMenuTrigger.displayName = 'MenuTrigger'\n\n// MenuContent - the dropdown menu\nexport interface MenuContentProps extends React.HTMLAttributes<HTMLDivElement> {\n align?: 'start' | 'center' | 'end'\n side?: 'top' | 'bottom'\n}\n\nconst MENU_ALIGN_CLASSES: Record<NonNullable<MenuContentProps['align']>, string> = {\n start: 'left-0',\n center: 'left-1/2 -translate-x-1/2',\n end: 'right-0',\n}\n\nconst MENU_SIDE_CLASSES: Record<NonNullable<MenuContentProps['side']>, string> = {\n top: 'bottom-full mb-1',\n bottom: 'top-full mt-1',\n}\n\nexport const MenuContent = React.forwardRef<HTMLDivElement, MenuContentProps>(\n ({children, className, align = 'start', side = 'bottom', ...props}, ref) => {\n const {isOpen, setIsOpen, triggerId, menuId} = useMenuContext()\n const menuRef = useRef<HTMLDivElement>(null)\n\n const close = useCallback(() => setIsOpen(false), [setIsOpen])\n useEscapeKey(close, isOpen)\n\n // Close on outside click — but ignore clicks on the trigger so it can toggle the menu.\n useEffect(() => {\n if (!isOpen) {\n return\n }\n const handleClickOutside = (e: MouseEvent) => {\n const target = e.target as Node\n const trigger = document.getElementById(triggerId)\n if (\n menuRef.current &&\n !menuRef.current.contains(target) &&\n !trigger?.contains(target)\n ) {\n setIsOpen(false)\n }\n }\n document.addEventListener('mousedown', handleClickOutside)\n return () => document.removeEventListener('mousedown', handleClickOutside)\n }, [isOpen, setIsOpen, triggerId])\n\n if (!isOpen) {\n return null\n }\n\n return (\n <div\n ref={composeRefs(menuRef, ref)}\n id={menuId}\n role=\"menu\"\n aria-labelledby={triggerId}\n className={cx(\n 'absolute z-50 min-w-40 py-1',\n 'bg-charcoal border border-ash shadow-lg',\n 'animate-fade-in',\n MENU_ALIGN_CLASSES[align],\n MENU_SIDE_CLASSES[side],\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nMenuContent.displayName = 'MenuContent'\n\n// MenuItem - individual menu option\nexport interface MenuItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n icon?: React.ReactNode\n destructive?: boolean\n}\n\nexport const MenuItem = React.forwardRef<HTMLButtonElement, MenuItemProps>(\n ({children, className, icon, destructive, disabled, onClick, ...props}, ref) => {\n const {setIsOpen} = useMenuContext()\n\n const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n if (disabled) {\n return\n }\n onClick?.(e)\n setIsOpen(false)\n }\n\n return (\n <button\n ref={ref}\n type=\"button\"\n role=\"menuitem\"\n disabled={disabled}\n onClick={handleClick}\n className={cx(\n 'flex w-full items-center gap-2 px-3 py-2 text-sm text-left',\n 'transition-colors duration-fast',\n destructive\n ? 'text-error hover:bg-error/10'\n : 'text-white hover:bg-graphite',\n 'focus-visible:outline-none focus-visible:bg-graphite',\n disabled && 'opacity-50 cursor-not-allowed',\n className\n )}\n {...props}\n >\n {icon && <span className=\"w-4 h-4 shrink-0\">{icon}</span>}\n {children}\n </button>\n )\n }\n)\n\nMenuItem.displayName = 'MenuItem'\n\n// MenuSeparator - divider between menu items\nexport const MenuSeparator = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({className, ...props}, ref) => (\n <div\n ref={ref}\n role=\"separator\"\n className={cx('my-1 h-px bg-ash', className)}\n {...props}\n />\n))\n\nMenuSeparator.displayName = 'MenuSeparator'\n\n// MenuLabel - non-interactive label\nexport const MenuLabel = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({className, children, ...props}, ref) => (\n <div\n ref={ref}\n className={cx('px-3 py-1.5 text-xs font-medium text-silver', className)}\n {...props}\n >\n {children}\n </div>\n))\n\nMenuLabel.displayName = 'MenuLabel'\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\n// Main Navbar container\nexport interface NavbarProps extends React.HTMLAttributes<HTMLElement> {\n fixed?: boolean\n bordered?: boolean\n}\n\nexport const Navbar = React.forwardRef<HTMLElement, NavbarProps>(\n ({fixed = false, bordered = true, className, children, ...props}, ref) => {\n return (\n <nav\n ref={ref}\n className={cx(\n 'w-full bg-charcoal px-4 py-3',\n bordered && 'border-b border-ash',\n fixed && 'fixed top-0 left-0 right-0 z-40',\n className\n )}\n {...props}\n >\n <div className=\"flex items-center justify-between\">{children}</div>\n </nav>\n )\n }\n)\n\nNavbar.displayName = 'Navbar'\n\n// NavbarBrand - logo/brand section\nexport interface NavbarBrandProps extends React.HTMLAttributes<HTMLDivElement> {\n}\n\nexport const NavbarBrand = React.forwardRef<HTMLDivElement, NavbarBrandProps>(\n ({className, children, ...props}, ref) => {\n return (\n <div\n ref={ref}\n className={cx('flex items-center gap-2', className)}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nNavbarBrand.displayName = 'NavbarBrand'\n\n// NavbarContent - center or end content area\nexport interface NavbarContentProps extends React.HTMLAttributes<HTMLDivElement> {\n position?: 'start' | 'center' | 'end'\n}\n\nexport const NavbarContent = React.forwardRef<HTMLDivElement, NavbarContentProps>(\n ({position = 'center', className, children, ...props}, ref) => {\n const positionClasses = {\n start: 'mr-auto',\n center: 'mx-auto',\n end: 'ml-auto',\n }\n\n return (\n <div\n ref={ref}\n className={cx(\n 'flex items-center gap-4',\n positionClasses[position],\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nNavbarContent.displayName = 'NavbarContent'\n\n// NavbarItem - individual navigation item\nexport interface NavbarItemProps extends React.HTMLAttributes<HTMLDivElement> {\n active?: boolean\n}\n\nexport const NavbarItem = React.forwardRef<HTMLDivElement, NavbarItemProps>(\n ({active = false, className, children, ...props}, ref) => {\n return (\n <div\n ref={ref}\n className={cx(\n 'flex items-center',\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nNavbarItem.displayName = 'NavbarItem'\n\n// NavbarLink - navigation link\nexport interface NavbarLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n active?: boolean\n}\n\nexport const NavbarLink = React.forwardRef<HTMLAnchorElement, NavbarLinkProps>(\n ({active = false, className, children, ...props}, ref) => {\n return (\n <a\n ref={ref}\n className={cx(\n 'text-sm font-medium transition-colors duration-fast',\n active ? 'text-gold' : 'text-silver hover:text-white',\n className\n )}\n {...props}\n >\n {children}\n </a>\n )\n }\n)\n\nNavbarLink.displayName = 'NavbarLink'\n\n// NavbarDivider - vertical separator\nexport const NavbarDivider = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({className, ...props}, ref) => (\n <div\n ref={ref}\n className={cx('h-6 w-px bg-ash mx-2', className)}\n {...props}\n />\n))\n\nNavbarDivider.displayName = 'NavbarDivider'\n","import React from 'react'\nimport {ChevronRight} from 'lucide-react'\nimport {cx} from '../utils'\n\n// Breadcrumb container\nexport interface BreadcrumbProps extends React.HTMLAttributes<HTMLElement> {\n separator?: React.ReactNode\n}\n\nexport const Breadcrumb = React.forwardRef<HTMLElement, BreadcrumbProps>(\n ({separator, className, children, ...props}, ref) => {\n const items = React.Children.toArray(children)\n const defaultSeparator = <ChevronRight className=\"h-4 w-4 text-ash\"/>\n\n return (\n <nav ref={ref} aria-label=\"Breadcrumb\" className={className} {...props}>\n <ol className=\"flex items-center gap-2\">\n {items.map((child, index) => (\n <li key={index} className=\"flex items-center gap-2\">\n {child}\n {index < items.length - 1 && (\n <span aria-hidden=\"true\">{separator ?? defaultSeparator}</span>\n )}\n </li>\n ))}\n </ol>\n </nav>\n )\n }\n)\n\nBreadcrumb.displayName = 'Breadcrumb'\n\n// BreadcrumbItem - individual breadcrumb item\nexport interface BreadcrumbItemProps extends React.HTMLAttributes<HTMLSpanElement> {\n current?: boolean\n}\n\nexport const BreadcrumbItem = React.forwardRef<HTMLSpanElement, BreadcrumbItemProps>(\n ({current = false, className, children, ...props}, ref) => {\n return (\n <span\n ref={ref}\n aria-current={current ? 'page' : undefined}\n className={cx(\n 'text-sm',\n current ? 'text-white font-medium' : 'text-silver',\n className\n )}\n {...props}\n >\n {children}\n </span>\n )\n }\n)\n\nBreadcrumbItem.displayName = 'BreadcrumbItem'\n\n// BreadcrumbLink - clickable breadcrumb link\nexport interface BreadcrumbLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n}\n\nexport const BreadcrumbLink = React.forwardRef<HTMLAnchorElement, BreadcrumbLinkProps>(\n ({className, children, ...props}, ref) => {\n return (\n <a\n ref={ref}\n className={cx(\n 'text-sm text-silver hover:text-gold transition-colors duration-fast',\n className\n )}\n {...props}\n >\n {children}\n </a>\n )\n }\n)\n\nBreadcrumbLink.displayName = 'BreadcrumbLink'\n","import React from 'react'\nimport {ChevronLeft, ChevronRight, MoreHorizontal} from 'lucide-react'\nimport {cx} from '../utils/cx'\n\nexport interface PaginationProps extends React.HTMLAttributes<HTMLElement> {\n page: number\n totalPages: number\n onPageChange: (page: number) => void\n siblingCount?: number\n showEdges?: boolean\n}\n\nfunction generatePagination(\n currentPage: number,\n totalPages: number,\n siblingCount: number\n): (number | 'ellipsis')[] {\n const totalSlots = siblingCount * 2 + 5 // siblings + current + 2 edges + 2 ellipses max\n\n if (totalPages <= totalSlots) {\n return Array.from({length: totalPages}, (_, i) => i + 1)\n }\n\n const leftSiblingIndex = Math.max(currentPage - siblingCount, 1)\n const rightSiblingIndex = Math.min(currentPage + siblingCount, totalPages)\n\n const showLeftEllipsis = leftSiblingIndex > 2\n const showRightEllipsis = rightSiblingIndex < totalPages - 1\n\n if (!showLeftEllipsis && showRightEllipsis) {\n const leftItemCount = 3 + 2 * siblingCount\n const leftRange = Array.from({length: leftItemCount}, (_, i) => i + 1)\n return [...leftRange, 'ellipsis', totalPages]\n }\n\n if (showLeftEllipsis && !showRightEllipsis) {\n const rightItemCount = 3 + 2 * siblingCount\n const rightRange = Array.from(\n {length: rightItemCount},\n (_, i) => totalPages - rightItemCount + i + 1\n )\n return [1, 'ellipsis', ...rightRange]\n }\n\n const middleRange = Array.from(\n {length: rightSiblingIndex - leftSiblingIndex + 1},\n (_, i) => leftSiblingIndex + i\n )\n return [1, 'ellipsis', ...middleRange, 'ellipsis', totalPages]\n}\n\nexport const Pagination = React.forwardRef<HTMLElement, PaginationProps>(\n (\n {\n page,\n totalPages,\n onPageChange,\n siblingCount = 1,\n showEdges = true,\n className,\n ...props\n },\n ref\n ) => {\n const pages = generatePagination(page, totalPages, siblingCount)\n\n const buttonBaseClass =\n 'flex items-center justify-center h-8 min-w-8 px-2 text-sm ' +\n 'border border-ash transition-colors duration-fast ' +\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gold'\n\n return (\n <nav\n ref={ref}\n role=\"navigation\"\n aria-label=\"Pagination\"\n className={cx('flex items-center gap-1', className)}\n {...props}\n >\n {/* Previous button */}\n <button\n type=\"button\"\n onClick={() => onPageChange(page - 1)}\n disabled={page <= 1}\n aria-label=\"Go to previous page\"\n className={cx(\n buttonBaseClass,\n 'text-silver hover:text-white hover:border-gold',\n page <= 1 && 'opacity-50 cursor-not-allowed hover:border-ash'\n )}\n >\n <ChevronLeft className=\"h-4 w-4\"/>\n </button>\n\n {/* Page numbers */}\n {pages.map((pageNum, index) =>\n pageNum === 'ellipsis' ? (\n <span\n key={`ellipsis-${index}`}\n className=\"flex items-center justify-center h-8 w-8 text-silver\"\n >\n <MoreHorizontal className=\"h-4 w-4\"/>\n </span>\n ) : (\n <button\n key={pageNum}\n type=\"button\"\n onClick={() => onPageChange(pageNum)}\n aria-label={`Go to page ${pageNum}`}\n aria-current={page === pageNum ? 'page' : undefined}\n className={cx(\n buttonBaseClass,\n page === pageNum\n ? 'bg-gold text-obsidian border-gold font-medium'\n : 'text-silver hover:text-white hover:border-gold'\n )}\n >\n {pageNum}\n </button>\n )\n )}\n\n {/* Next button */}\n <button\n type=\"button\"\n onClick={() => onPageChange(page + 1)}\n disabled={page >= totalPages}\n aria-label=\"Go to next page\"\n className={cx(\n buttonBaseClass,\n 'text-silver hover:text-white hover:border-gold',\n page >= totalPages && 'opacity-50 cursor-not-allowed hover:border-ash'\n )}\n >\n <ChevronRight className=\"h-4 w-4\"/>\n </button>\n </nav>\n )\n }\n)\n\nPagination.displayName = 'Pagination'\n","import React from 'react'\nimport {Check} from 'lucide-react'\nimport {cx} from '../utils/cx'\n\nexport type StepStatus = 'complete' | 'error'\n\nexport interface Step {\n id: string | number\n label: string\n}\n\nexport interface StepperProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Array of steps. Each requires: id (string | number), label (string). */\n steps: Step[]\n /** ID of the current step (must match a step.id from the steps array). */\n currentStep: string | number\n status?: StepStatus\n}\n\nexport const Stepper = React.forwardRef<HTMLDivElement, StepperProps>(\n ({steps, currentStep, status, className, ...rest}, ref) => {\n const currentIndex = steps.findIndex(step => step.id === currentStep)\n\n const getStepState = (index: number) => {\n if (index < currentIndex) {\n return 'complete'\n }\n if (index === currentIndex) {\n return status || 'current'\n }\n return 'future'\n }\n\n return (\n <div\n ref={ref}\n className={cx('flex items-center w-full', className)}\n {...rest}\n >\n {steps.map((step, index) => {\n const state = getStepState(index)\n const isLast = index === steps.length - 1\n\n return (\n <React.Fragment key={step.id}>\n <div className=\"flex flex-col items-center\">\n <div\n className={cx(\n 'flex items-center justify-center w-10 h-10 rounded-full border-2 font-semibold text-sm transition-all duration-200',\n state === 'complete' && 'bg-gold border-gold text-obsidian',\n state === 'current' && 'bg-charcoal border-gold text-gold',\n state === 'error' && 'bg-error border-error text-white',\n state === 'future' && 'bg-charcoal border-ash text-silver'\n )}\n >\n {state === 'complete' ? (\n <Check className=\"h-5 w-5\"/>\n ) : (\n <span>{index + 1}</span>\n )}\n </div>\n <span\n className={cx(\n 'mt-2 text-xs font-medium',\n state === 'complete' && 'text-gold',\n state === 'current' && 'text-white',\n state === 'error' && 'text-error',\n state === 'future' && 'text-silver'\n )}\n >\n {step.label}\n </span>\n </div>\n {!isLast && (\n <div\n className={cx(\n 'flex-1 h-0.5 mx-4 transition-all duration-200',\n index < currentIndex ? 'bg-gold' : 'bg-ash'\n )}\n />\n )}\n </React.Fragment>\n )\n })}\n </div>\n )\n }\n)\n\nStepper.displayName = 'Stepper'\n\nexport default Stepper\n","import React, {useCallback, useEffect, useRef, useState} from 'react'\nimport {Check, ChevronLeft, ChevronRight, Copy, GitBranch, Pencil, RotateCcw, Send, X} from 'lucide-react'\nimport {MarkdownContent} from './MarkdownContent'\nimport {AttachmentPreview, type AttachmentItem} from './AttachmentPreview'\nimport {cx, useCopyToClipboard} from '../utils'\n\nexport type MessageVariant = 'user' | 'assistant'\n\nexport interface MessageBranchInfo {\n /**\n * Current branch index (1-based)\n */\n current: number\n /**\n * Total number of sibling branches\n */\n total: number\n /**\n * Navigate to previous branch\n */\n onPrevious?: () => void\n /**\n * Navigate to next branch\n */\n onNext?: () => void\n}\n\nexport interface MessageActionsConfig {\n /**\n * Called when user edits a user message (creates a branch)\n */\n onEdit?: (newContent: string) => void\n /**\n * Called when user retries an assistant message (creates a branch)\n */\n onRetry?: () => void\n /**\n * Whether to show the copy button\n * @default true\n */\n showCopy?: boolean\n}\n\nexport interface MessageProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'content'> {\n /**\n * Whether the message is from the user or the assistant\n */\n variant?: MessageVariant\n /**\n * The message content (supports Markdown if string)\n */\n content: string | React.ReactNode\n /**\n * Whether the message is currently being streamed (shows cursor)\n */\n isStreaming?: boolean\n /**\n * Branch navigation info (shows branch indicator if provided and total > 1)\n */\n branchInfo?: MessageBranchInfo\n /**\n * Actions configuration (shows action bar if provided)\n */\n actions?: MessageActionsConfig\n /**\n * Whether to hide actions (e.g., during streaming)\n */\n hideActions?: boolean\n /**\n * Attachments to render above the bubble. Used by user messages to show the\n * files that were attached to that turn. Empty/undefined renders nothing.\n */\n attachments?: AttachmentItem[]\n /**\n * Click handler invoked with an attachment's `artifactId`. Wire to open the\n * artifact-card modal in the host app.\n */\n onAttachmentOpen?: (artifactId: string) => void\n /**\n * Click handler for the bubble — when provided, the message becomes a\n * navigational anchor (mirrors Checkpoint's `onJumpHere`): clicking the\n * bubble moves the active leaf to this node. Suppressed when `isActive`\n * is true (already here) or when the user is selecting text or clicking\n * a markdown link inside the bubble.\n */\n onJumpHere?: () => void\n /**\n * When true, this message is the active leaf — `onJumpHere` is suppressed\n * (no point jumping to where you already are) and the affordance hover\n * styling is skipped.\n */\n isActive?: boolean\n}\n\nconst VARIANT_STYLES: Record<MessageVariant, string> = {\n user: 'bg-gold text-obsidian ml-auto',\n assistant: 'bg-charcoal border border-ash text-white mr-auto',\n}\n\nconst ACTION_BUTTON_CLASSES = cx(\n 'p-1.5 text-silver/60 hover:text-silver transition-colors duration-150',\n 'hover:bg-white/5',\n 'disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent',\n)\n\nconst BRANCH_BUTTON_CLASSES = cx(\n 'p-0.5 hover:text-white hover:bg-white/10 transition-colors',\n 'disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-silver/70',\n)\n\ninterface ActionButtonProps {\n onClick: () => void\n label: string\n children: React.ReactNode\n disabled?: boolean\n}\n\nfunction ActionButton({onClick, label, children, disabled}: ActionButtonProps) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className={ACTION_BUTTON_CLASSES}\n aria-label={label}\n >\n {children}\n </button>\n )\n}\n\nexport const Message = React.forwardRef<HTMLDivElement, MessageProps>(\n ({\n variant = 'assistant',\n className,\n content,\n isStreaming,\n branchInfo,\n actions,\n hideActions,\n attachments,\n onAttachmentOpen,\n onJumpHere,\n isActive,\n ...rest\n }, ref) => {\n const isUser = variant === 'user'\n const isJumpInteractive = !!onJumpHere && !isActive && !isStreaming\n const handleBubbleClick = useCallback((e: React.MouseEvent<HTMLDivElement>) => {\n if (!isJumpInteractive) {\n return\n }\n // Don't hijack a markdown-link click — let the anchor's default\n // behaviour run.\n const target = e.target as HTMLElement\n if (target.closest('a, button')) {\n return\n }\n // Don't hijack a text-selection drag — if the user has highlighted\n // anything inside the bubble, the click was the end of a selection.\n const selection = typeof window !== 'undefined' ? window.getSelection() : null\n if (selection && !selection.isCollapsed) {\n return\n }\n onJumpHere!()\n }, [isJumpInteractive, onJumpHere])\n const {copied, copy} = useCopyToClipboard()\n const [isEditing, setIsEditing] = useState(false)\n const [editValue, setEditValue] = useState(typeof content === 'string' ? content : '')\n const textareaRef = useRef<HTMLTextAreaElement>(null)\n\n const showBranchNav = branchInfo && branchInfo.total > 1\n const showActions = actions && !hideActions && !isStreaming\n\n // Auto-resize textarea when editing\n useEffect(() => {\n if (isEditing && textareaRef.current) {\n const textarea = textareaRef.current\n textarea.style.height = 'auto'\n textarea.style.height = `${textarea.scrollHeight}px`\n textarea.focus()\n textarea.setSelectionRange(textarea.value.length, textarea.value.length)\n }\n }, [isEditing])\n\n const handleCopy = useCallback(() => {\n if (typeof content === 'string') {\n void copy(content)\n }\n }, [copy, content])\n\n const handleStartEdit = () => {\n if (typeof content === 'string') {\n setEditValue(content)\n setIsEditing(true)\n }\n }\n\n const handleCancelEdit = () => {\n setIsEditing(false)\n if (typeof content === 'string') {\n setEditValue(content)\n }\n }\n\n const handleSubmitEdit = () => {\n const trimmed = editValue.trim()\n if (typeof content === 'string' && trimmed && trimmed !== content) {\n actions?.onEdit?.(trimmed)\n }\n setIsEditing(false)\n }\n\n const handleEditKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault()\n handleSubmitEdit()\n } else if (e.key === 'Escape') {\n handleCancelEdit()\n }\n }\n\n const handleEditChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setEditValue(e.target.value)\n const textarea = e.target\n textarea.style.height = 'auto'\n textarea.style.height = `${textarea.scrollHeight}px`\n }\n\n return (\n <div\n ref={ref}\n className={cx(\n 'flex flex-col',\n isUser ? 'items-end' : 'items-start',\n className\n )}\n {...rest}\n >\n {/* Attachments above the bubble (user messages with prior attachments). */}\n {attachments && attachments.length > 0 && (\n <div className={cx('mb-1.5', isUser ? 'self-end' : 'self-start')}>\n <AttachmentPreview\n attachments={attachments}\n removable={false}\n onOpen={onAttachmentOpen}\n />\n </div>\n )}\n\n {/* Message bubble OR Edit input (replaces message when editing) */}\n {isUser && isEditing ? (\n <div className=\"w-full max-w-11/12\">\n <div className=\"relative bg-gold\">\n <textarea\n ref={textareaRef}\n value={editValue}\n onChange={handleEditChange}\n onKeyDown={handleEditKeyDown}\n className=\"w-full bg-transparent text-obsidian px-3 py-2 pr-20 resize-none outline-none min-h-10 text-sm\"\n rows={1}\n />\n <div className=\"absolute right-1 top-1/2 -translate-y-1/2 flex gap-0.5\">\n <button\n type=\"button\"\n onClick={handleCancelEdit}\n className=\"p-1.5 text-obsidian/60 hover:text-obsidian transition-colors\"\n aria-label=\"Cancel edit\"\n >\n <X className=\"w-4 h-4\"/>\n </button>\n <button\n type=\"button\"\n onClick={handleSubmitEdit}\n disabled={!editValue.trim() || editValue.trim() === content}\n className=\"p-1.5 text-obsidian/60 hover:text-obsidian transition-colors disabled:opacity-30\"\n aria-label=\"Submit edit\"\n >\n <Send className=\"w-4 h-4\"/>\n </button>\n </div>\n </div>\n </div>\n ) : (\n <div\n className={cx(\n 'px-3 py-2 w-fit max-w-11/12',\n VARIANT_STYLES[variant],\n isJumpInteractive && 'cursor-pointer hover:brightness-110 transition-all duration-150',\n )}\n onClick={isJumpInteractive ? handleBubbleClick : undefined}\n role={isJumpInteractive ? 'button' : undefined}\n aria-label={isJumpInteractive ? 'Jump to this message' : undefined}\n >\n {typeof content === 'string' ? (\n <MarkdownContent\n content={content}\n className={cx('prose-sm', isUser ? 'prose-inherit' : 'prose-invert')}\n isStreaming={isStreaming}\n cursorClassName=\"ml-0.5\"\n />\n ) : content}\n </div>\n )}\n\n {/* Action bar - below the message, includes branch nav on the right */}\n {showActions && !isEditing && (\n <div className={cx(\n 'flex items-center gap-0.5 mt-1',\n isUser ? 'mr-1' : 'ml-1'\n )}>\n {/* Copy - available for both */}\n {(actions.showCopy !== false) && (\n <ActionButton onClick={handleCopy}\n label={copied ? 'Copied!' : 'Copy message'}>\n {copied\n ? <Check className=\"w-3.5 h-3.5 text-success\"/>\n : <Copy className=\"w-3.5 h-3.5\"/>}\n </ActionButton>\n )}\n\n {/* Edit - only for user messages */}\n {isUser && actions.onEdit && typeof content === 'string' && (\n <ActionButton onClick={handleStartEdit} label=\"Edit message\">\n <Pencil className=\"w-3.5 h-3.5\"/>\n </ActionButton>\n )}\n\n {/* Retry - only for assistant messages */}\n {!isUser && actions.onRetry && (\n <ActionButton onClick={actions.onRetry} label=\"Regenerate response\">\n <RotateCcw className=\"w-3.5 h-3.5\"/>\n </ActionButton>\n )}\n\n {/* Branch navigator - to the right of action buttons */}\n {showBranchNav && (\n <>\n <div className=\"w-px h-4 bg-ash/40 mx-1\"/>\n <div className=\"flex items-center gap-0.5 text-silver/70\">\n <GitBranch className=\"w-3 h-3 mr-0.5 text-silver/50\"/>\n <button\n type=\"button\"\n onClick={branchInfo.onPrevious}\n disabled={branchInfo.current <= 1}\n className={BRANCH_BUTTON_CLASSES}\n aria-label=\"Previous branch\"\n >\n <ChevronLeft className=\"w-3 h-3\"/>\n </button>\n <span className=\"text-xs tabular-nums min-w-6 text-center\">\n {branchInfo.current}/{branchInfo.total}\n </span>\n <button\n type=\"button\"\n onClick={branchInfo.onNext}\n disabled={branchInfo.current >= branchInfo.total}\n className={BRANCH_BUTTON_CLASSES}\n aria-label=\"Next branch\"\n >\n <ChevronRight className=\"w-3 h-3\"/>\n </button>\n </div>\n </>\n )}\n </div>\n )}\n </div>\n )\n }\n)\n\nMessage.displayName = 'Message'\n\nexport default Message\n","import React from 'react'\nimport ReactMarkdown, {type Components} from 'react-markdown'\nimport remarkGfm from 'remark-gfm'\nimport {cx} from '../utils'\nimport {remarkMentions} from '../utils/remarkMentions'\n\nexport interface MarkdownContentProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Content to display. Markdown by default; pass `isMarkdown={false}` for literal display\n * of plain text (preserves whitespace, no parsing).\n */\n content: string\n /**\n * Whether the content should be parsed as Markdown. `false` renders the string verbatim\n * inside a `whitespace-pre-wrap` block — useful for plain-text artifacts.\n * @default true\n */\n isMarkdown?: boolean\n /**\n * When true, injects a streaming cursor at the end of the rendered content.\n */\n isStreaming?: boolean\n /**\n * Additional classes for the streaming cursor.\n */\n cursorClassName?: string\n /**\n * When set, the renderer recognises `@artifact_name` mentions in prose (anywhere except\n * inside code spans / blocks) and replaces each with the React node returned by this\n * callback. Typical wiring is `(name) => <MentionChip name={name} onClick={...} />`,\n * giving each chip a real per-call-site click handler.\n *\n * Without this prop, mentions render as literal `@name` text.\n */\n mentionRenderer?: (name: string) => React.ReactNode\n}\n\nconst CURSOR_BASE_CLASSES = 'inline-block bg-current animate-cursor-blink w-0.5 h-cursor '\n + 'translate-y-cursor-offset'\n\n/**\n * Renders Markdown content into a real React tree via `react-markdown`. Drop-in for prose\n * surfaces (chat messages, artifact bodies, deliverable text). Optional `mentionRenderer`\n * adds inline `@artifact_name` chip rendering — see prop docs.\n *\n * Raw HTML in the source is escaped (not rendered) by react-markdown's defaults; this is\n * intentional and safer than the previous pipeline. Pass markdown.\n */\nexport const MarkdownContent = React.forwardRef<HTMLDivElement, MarkdownContentProps>(\n ({className, content, isMarkdown = true, isStreaming, cursorClassName,\n mentionRenderer, ...rest}, ref) => {\n if (!isMarkdown) {\n return (\n <div ref={ref} className={cx('prose whitespace-pre-wrap', className)} {...rest}>\n {content}\n {isStreaming && (\n <span aria-hidden=\"true\"\n className={cx(CURSOR_BASE_CLASSES, cursorClassName)}/>\n )}\n </div>\n )\n }\n\n // `mention` isn't a known IntrinsicElement, but react-markdown looks tagNames up\n // by string in `components`, so a dedicated record keeps the typing honest without\n // forcing a cast on the whole `components` object.\n const components: Components & {mention?: React.ComponentType<{name: string}>} = {\n // Harden external links so user-authored URLs don't open in the same tab\n // and can't reach `window.opener`.\n a: ({href, children}) => (\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </a>\n ),\n ...(mentionRenderer && {\n mention: ({name}) => <>{mentionRenderer(name)}</>,\n }),\n }\n\n const remarkPlugins = mentionRenderer ? [remarkGfm, remarkMentions] : [remarkGfm]\n\n return (\n <div ref={ref} className={cx('prose', className)} {...rest}>\n <ReactMarkdown remarkPlugins={remarkPlugins} components={components}>\n {content}\n </ReactMarkdown>\n {isStreaming && (\n <span aria-hidden=\"true\"\n className={cx(CURSOR_BASE_CLASSES, cursorClassName)}/>\n )}\n </div>\n )\n }\n)\n\nMarkdownContent.displayName = 'MarkdownContent'\n\nexport default MarkdownContent\n","import {visit} from 'unist-util-visit'\nimport type {Root, Text, PhrasingContent} from 'mdast'\n\nconst MENTION_PATTERN = /(?<!\\w)@(\\w+)/g\n\n/**\n * Custom mdast node emitted for `@artifact_name` mentions. Map this to a renderer via the\n * `components` prop on `<ReactMarkdown>` (or `mentionRenderer` on `<MarkdownContent>`):\n * `{ mention: ({ name }) => <MyChip name={name} /> }`.\n */\nexport interface MentionNode {\n type: 'mention'\n name: string\n data?: {\n hName: string\n hProperties: { name: string }\n }\n}\n\ndeclare module 'mdast' {\n interface PhrasingContentMap {\n mention: MentionNode\n }\n interface RootContentMap {\n mention: MentionNode\n }\n}\n\n/**\n * Remark plugin that walks text nodes in the markdown AST and splits any `@artifact_name`\n * runs into a custom `mention` node. Patterns inside fenced or inline code are left\n * untouched because the markdown AST already isolates code from prose. The plugin emits\n * `data.hName = 'mention'` so rehype maps it to a custom React component.\n */\nexport function remarkMentions() {\n return (tree: Root) => {\n visit(tree, 'text', (node: Text, index, parent) => {\n if (!parent || index == null) {\n return\n }\n const {value} = node\n const matches = [...value.matchAll(MENTION_PATTERN)]\n if (matches.length === 0) {\n return\n }\n\n const replacement: PhrasingContent[] = []\n let lastEnd = 0\n for (const match of matches) {\n if (match.index > lastEnd) {\n replacement.push({type: 'text', value: value.slice(lastEnd, match.index)})\n }\n const name = match[1]\n replacement.push({\n type: 'mention',\n name,\n data: {hName: 'mention', hProperties: {name}},\n })\n lastEnd = match.index + match[0].length\n }\n if (lastEnd < value.length) {\n replacement.push({type: 'text', value: value.slice(lastEnd)})\n }\n\n parent.children.splice(index, 1, ...replacement)\n return index + replacement.length\n })\n }\n}\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport interface StreamingCursorProps extends React.HTMLAttributes<HTMLSpanElement> {\n variant?: 'block' | 'line' | 'underscore'\n}\n\nexport const StreamingCursor = React.forwardRef<HTMLSpanElement, StreamingCursorProps>(\n ({className, variant = 'line', ...rest}, ref) => {\n const variantStyles = {\n block: 'w-2.5 h-cursor translate-y-cursor-offset',\n line: 'w-0.5 h-cursor translate-y-cursor-offset',\n underscore: 'w-2.5 h-0.5 self-end mb-0.5'\n }\n\n return (\n <span\n ref={ref}\n className={cx(\n 'inline-block bg-current animate-cursor-blink',\n variantStyles[variant],\n className\n )}\n aria-hidden=\"true\"\n {...rest}\n />\n )\n }\n)\n\nStreamingCursor.displayName = 'StreamingCursor'\n\nexport default StreamingCursor\n","import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'\nimport {cx} from '../../utils'\nimport {ChatView, type ChatViewItem} from './ChatView'\nimport {ChatInput, type ChatInputNotice} from './ChatInput'\n\nimport {ArtifactsPanel} from './ArtifactsPanel'\nimport {HistoryPanel} from './HistoryPanel'\nimport {areAllTasksSettled, type Task, TodosList} from './TodosList'\nimport {\n type ExternalToolDefinition,\n type ToolDefinition,\n type ToolPanelState,\n ToolSidebar\n} from './ToolSidebar'\nimport {ToolPanelContainer} from './ToolPanelContainer'\nimport {type Artifact, useResizable} from './hooks'\nimport type {ArtifactNode} from '../ArtifactNode'\nimport {\n type Attachment,\n type ChatNode,\n type CheckpointNode,\n type ConversationTree,\n type MessageNode,\n type TreeNode,\n} from './types'\nimport {\n findAncestor,\n getActivePath,\n getGreyedFuture,\n getSiblingInfo,\n setActiveLeaf,\n switchBranch,\n} from './tree'\nimport {ChatBubbleIcon, CheckSquareIcon, MediaIcon, SquareLoaderIcon} from '../icons'\n\nexport interface Conversation {\n /**\n * Unique identifier for the conversation\n */\n id: string\n /**\n * Title shown as the first line of the row. Editable via the rename affordance.\n */\n title: string\n /**\n * Project this conversation belongs to. Shown as the second line of the row and\n * collected into the project filter in the history panel.\n */\n project?: string\n /**\n * Timestamp used to group conversations into Today / Yesterday / Older.\n * Accepts a Date, ISO string, or millisecond epoch. Not displayed.\n */\n timestamp?: string | number | Date\n /**\n * Whether this conversation is currently active (highlighted in the list).\n */\n isActive?: boolean\n}\n\nexport interface ChatInterfaceProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSubmit'> {\n /**\n * Array of messages in the conversation (flat mode)\n * Use this OR conversationTree, not both\n */\n messages?: MessageNode[]\n /**\n * Conversation tree for branching support\n * Use this OR messages, not both\n */\n conversationTree?: ConversationTree\n /**\n * Called when the conversation tree changes (for tree mode)\n */\n onTreeChange?: (tree: ConversationTree) => void\n /**\n * List of past conversations for the sidebar\n */\n conversations?: Conversation[]\n /**\n * Called when a message is submitted from the input.\n * Provides the text content and any files attached.\n */\n onMessageSubmit?: (message: string, attachments?: Attachment[]) => void\n /**\n * Called when a user message is edited.\n * In tree mode, this creates a new branch.\n */\n onEditMessage?: (messageId: string, newContent: string) => void\n /**\n * Called when an assistant message is retried.\n * In tree mode, this creates a new branch.\n */\n onRetryMessage?: (messageId: string) => void\n /**\n * Called when the user clicks a non-active node — checkpoint or message —\n * to move the active leaf there. Receives the node id; the consumer should\n * move the active leaf without forking so the artifacts panel and chat\n * re-anchor. Mirrors the per-component `onJumpHere`. In tree mode only.\n */\n onJumpHere?: (nodeId: string) => void\n /**\n * Called when the user clicks \"Jump to latest\" on the greyed-future divider\n * or otherwise asks to return to the deepest leaf they had reached.\n * In tree mode only.\n */\n onJumpToLatest?: () => void\n /**\n * Called when the Stop button is clicked during assistant streaming.\n */\n onStop?: () => void\n /**\n * Called when a conversation is selected from the sidebar.\n */\n onSelectConversation?: (id: string) => void\n /**\n * Called when the \"New Chat\" button is clicked in the sidebar.\n */\n onNewChat?: () => void\n /**\n * Called when a conversation's title is renamed from the history panel.\n * Receives the conversation id and the new, trimmed title.\n */\n onRenameConversation?: (id: string, newTitle: string) => void\n /**\n * Whether the assistant is currently streaming a response.\n * Shows a stop button and disables certain actions.\n */\n isStreaming?: boolean\n /**\n * Whether to show the thinking indicator.\n * Typically shown after a user message but before the first streaming token.\n */\n isThinking?: boolean\n /**\n * Optional verbatim label for the thinking indicator. When set, the indicator\n * suppresses its rotating phrases and renders this string as-is. Use for\n * domain-specific waits like \"Analyzing uploads...\" — any animated suffix\n * (e.g. cycling dots) is the caller's responsibility.\n */\n thinkingLabel?: string\n /**\n * Placeholder text for the main chat input.\n */\n placeholder?: string\n /**\n * Helper text shown in the empty state (when there are no messages).\n */\n emptyStateHelper?: React.ReactNode\n /**\n * Custom content to show when the conversation is empty.\n * Overrides the default centered input and helper text.\n */\n emptyState?: React.ReactNode\n /**\n * Whether to show the attachment (paperclip) button in the input.\n */\n showAttachmentButton?: boolean\n /**\n * Whether to enable message-level actions (copy, edit, retry).\n */\n enableMessageActions?: boolean\n /**\n * Current attachments for the chat input (controlled).\n */\n attachments?: Attachment[]\n /**\n * Called when attachments are added or removed in the chat input.\n */\n onAttachmentsChange?: (attachments: Attachment[]) => void\n /**\n * Called when an attachment is removed by the user (clicking the \"x\")\n */\n onAttachmentRemove?: (attachment: Attachment) => void\n /**\n * Called when a chip above a sent message is clicked. Receives the\n * `artifactId` carried by the chip; wire to open the artifact-card modal.\n * Without this, above-message chips are not clickable.\n */\n onAttachmentOpen?: (artifactId: string) => void\n /**\n * Top-level artifact tree nodes for the artifacts panel.\n */\n artifactNodes?: ArtifactNode[]\n /**\n * Whether the artifacts panel is currently open (controlled).\n * When set, maps to the tool panel system — opens the artifacts tool.\n */\n isArtifactsPanelOpen?: boolean\n /**\n * Called when the artifacts panel is opened or closed (controlled).\n */\n onArtifactsPanelOpenChange?: (open: boolean) => void\n /**\n * Resolves the floating action cluster shown over the artifact lightbox.\n * The host switches on `artifact.type` and returns the right buttons for\n * that kind (e.g. Share + Download for deliverables, Download for images).\n * Aurelius ships the close affordance itself; return only the kind-specific\n * actions, or `null` when none. Use `ctx.onClose` to dismiss the lightbox\n * after a successful operation.\n */\n getArtifactActions?: (\n artifact: Artifact,\n ctx: {onClose: () => void},\n ) => React.ReactNode\n /**\n * Tasks to display in the todos list tool panel.\n * Shows a list of tasks with status indicators.\n */\n tasks?: Task[]\n /**\n * Title for the todos list\n * @default \"Tasks\"\n */\n tasksTitle?: string\n /**\n * Called when the \"Stop All Tasks\" button is clicked in the tasks panel.\n * Only shown when at least one task has in_progress status.\n * The consumer app decides what stopping means (cancel API calls, mark tasks cancelled, etc.).\n *\n * May return a Promise. While the Promise is pending, the button becomes\n * disabled and displays a spinner with \"Stopping tasks\" so the user knows\n * the stop request is in flight.\n */\n onStopAllTasks?: () => void | Promise<void>\n /**\n * Optional notice displayed above the chat input (e.g. credit warnings or exhaustion messages).\n * Pass `{ variant: 'warning', content: '...', dismissible: true, onDismiss: () => ... }` for\n * soft warnings, or `{ variant: 'error', content: <ReactNode> }` for hard blocks.\n */\n inputNotice?: ChatInputNotice\n /**\n * Called whenever the chat input value changes, giving the consumer access to the current text.\n */\n onInputChange?: (value: string) => void\n /**\n * Initial value for the input, used for state restoration (e.g. from DB or localStorage)\n */\n initialInputValue?: string\n /**\n * Additional tools to add to the tool sidebars. Each ExternalToolDefinition provides\n * an id, icon, label, group ('top-left' | 'bottom-left' | 'top-right' | 'bottom-right'),\n * and content (ReactNode) to render when opened. Tools in the same group are mutually\n * exclusive. Built-in tools occupy: History (top-left), Artifacts (top-right), Tasks\n * (bottom-right). Consumer tools are added alongside these.\n */\n tools?: ExternalToolDefinition[]\n /**\n * Whether to automatically focus the chat input when it becomes enabled.\n * Defaults to true.\n */\n autoFocus?: boolean\n /**\n * Forwarded to the underlying chat-input `<textarea>`. Use to drive an\n * inline autocomplete (e.g. an `@`-mention picker) — read selection/caret\n * position, mirror the textarea for caret coordinates, or imperatively\n * update its value.\n */\n textareaRef?: React.Ref<HTMLTextAreaElement>\n /**\n * Forwarded to the underlying chat-input. Runs before the input's own\n * keydown handling; calling `e.preventDefault()` opts that event out of\n * default behaviour (submit-on-Enter, newline) — typical use is to claim\n * Arrow / Enter / Escape while an autocomplete panel is open.\n */\n onTextareaKeyDown?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void\n}\n\n/**\n * ChatInterface is the main orchestrator for a full-featured chat experience.\n *\n * Features:\n * - ChatView (center) — main conversation area with smart scrolling\n * - Dual tool sidebar system — IntelliJ-style tool sidebars on left and right:\n * - Left sidebar: History (top-left, conversation list + new chat) + consumer tools (bottom-left)\n * - Right sidebar: Artifacts (top-right) + Tasks (bottom-right) + consumer tools\n * - Tools in the same group are mutually exclusive\n * - Both panels can be open simultaneously — chat area shrinks to accommodate\n * - Each panel is independently width-resizable\n * - Vertical split with draggable divider when both slots in a panel are active\n * - Consumer tools via `tools` prop — provide icon, label, group, and content\n * - ChatInput — position-aware input that centers in empty state\n * - Branching — support for conversation tree with branch navigation\n * - Message Actions — copy, edit, retry\n * - Thinking Indicator — shown between user message and response\n *\n * Artifacts are supplied as a tree of ArtifactNode objects via the\n * artifactNodes prop.\n */\nexport const ChatInterface = React.forwardRef<HTMLDivElement, ChatInterfaceProps>(\n (\n {\n messages = [],\n conversationTree,\n onTreeChange,\n conversations = [],\n onMessageSubmit,\n onEditMessage,\n onRetryMessage,\n onJumpHere,\n onJumpToLatest,\n onStop,\n onSelectConversation,\n onNewChat,\n onRenameConversation,\n isStreaming = false,\n isThinking = false,\n thinkingLabel,\n placeholder = 'Send a message...',\n emptyStateHelper = \"Let's talk.\",\n emptyState,\n showAttachmentButton = true,\n enableMessageActions = true,\n attachments: propsAttachments,\n onAttachmentsChange,\n onAttachmentRemove,\n onAttachmentOpen,\n artifactNodes,\n isArtifactsPanelOpen,\n onArtifactsPanelOpenChange,\n getArtifactActions,\n tasks = [],\n tasksTitle,\n onStopAllTasks,\n inputNotice,\n onInputChange,\n initialInputValue = '',\n tools: externalTools = [],\n autoFocus = true,\n textareaRef,\n onTextareaKeyDown,\n className,\n ...rest\n },\n ref\n ) => {\n const prevArtifactNodesRef = useRef<ArtifactNode[]>([])\n const prevTasksRef = useRef<Task[]>([])\n\n // Drives the artifacts-panel modal when the user clicks an above-message\n // chip. Round-trips with `onArtifactClosed` so re-clicking the same chip\n // after a manual dismiss reopens the modal.\n const [panelOpenArtifactId, setPanelOpenArtifactId] = useState<string | null>(null)\n\n const handleAttachmentOpen = useCallback((artifactId: string) => {\n setPanelOpenArtifactId(artifactId)\n onAttachmentOpen?.(artifactId)\n }, [onAttachmentOpen])\n\n const handleArtifactPanelClosed = useCallback(() => {\n setPanelOpenArtifactId(null)\n }, [])\n\n // ── Tool panel state ──────────────────────────────────────────\n const [internalTools, setInternalTools] = useState<ToolPanelState>({\n 'top-left': 'history',\n 'bottom-left': null,\n 'top-right': null,\n 'bottom-right': null,\n })\n\n // Track tools the user has actively dismissed — auto-open won't reopen these\n const dismissedToolsRef = useRef<Set<string>>(new Set())\n\n // Controlled vs uncontrolled: isArtifactsPanelOpen maps to the tool system\n const isPanelControlled = isArtifactsPanelOpen !== undefined\n\n // Derive effective tool state\n const activeTools: ToolPanelState = useMemo(() => {\n if (isPanelControlled) {\n return {\n ...internalTools,\n 'top-right': isArtifactsPanelOpen ? 'artifacts' : internalTools['top-right'],\n }\n }\n return internalTools\n }, [isPanelControlled, isArtifactsPanelOpen, internalTools])\n\n const isLeftPanelOpen = activeTools['top-left'] !== null || activeTools['bottom-left']\n !== null\n const isRightPanelOpen = activeTools['top-right'] !== null || activeTools['bottom-right']\n !== null\n\n // ── Resizable panels ──────────────────────────────────────────\n const {\n width: rightToolsWidth,\n startResizing: startResizingRightTools\n } = useResizable({\n initialWidthPercent: 40,\n minWidthPercent: 30,\n maxWidthPercent: 80,\n direction: 'left'\n })\n\n const {\n width: leftToolsWidth,\n startResizing: startResizingLeftTools\n } = useResizable({\n initialWidthPercent: 25,\n minWidthPercent: 15,\n maxWidthPercent: 40,\n direction: 'right'\n })\n\n // ── Tool definitions ──────────────────────────────────────────\n const allSettled = tasks.length === 0 || areAllTasksSettled(tasks)\n\n // ── Merged tool definitions (built-in + external) ──────────────\n const allToolDefinitions: ToolDefinition[] = useMemo(() => {\n const builtIn: ToolDefinition[] = [\n {id: 'history', icon: <ChatBubbleIcon/>, label: 'History', group: 'top-left'},\n {id: 'artifacts', icon: <MediaIcon/>, label: 'Artifacts', group: 'top-right'},\n {\n id: 'todos',\n icon: allSettled ? <CheckSquareIcon/> : <SquareLoaderIcon/>,\n label: 'Tasks',\n group: 'bottom-right',\n },\n ]\n const external: ToolDefinition[] = externalTools.map(({content: _content, ...def}) => def)\n return [...builtIn, ...external]\n }, [allSettled, externalTools])\n\n // ── Toggle a tool ─────────────────────────────────────────────\n const toggleTool = useCallback((toolId: string) => {\n // Find the tool's group\n const toolDef = allToolDefinitions.find(t => t.id === toolId)\n if (!toolDef) {\n return\n }\n\n const group = toolDef.group\n\n // Special case: controlled artifacts panel\n if (toolId === 'artifacts' && isPanelControlled) {\n const isCurrentlyOpen = activeTools['top-right'] === 'artifacts'\n if (isCurrentlyOpen) {\n dismissedToolsRef.current.add('artifacts')\n } else {\n dismissedToolsRef.current.delete('artifacts')\n }\n onArtifactsPanelOpenChange?.(!isCurrentlyOpen)\n return\n }\n\n setInternalTools(prev => {\n const isCurrentlyOpen = prev[group] === toolId\n if (isCurrentlyOpen) {\n dismissedToolsRef.current.add(toolId)\n } else {\n dismissedToolsRef.current.delete(toolId)\n }\n return {\n ...prev,\n [group]: isCurrentlyOpen ? null : toolId,\n }\n })\n }, [allToolDefinitions, isPanelControlled, activeTools, onArtifactsPanelOpenChange])\n\n // ── Tree → rows ───────────────────────────────────────────────\n const isTreeMode = !!conversationTree\n\n const tree = isTreeMode\n ? (conversationTree as ConversationTree<ChatNode>)\n : null\n\n /** Active path nodes (root → active leaf), heterogeneous (messages + checkpoints). */\n const activePath: TreeNode<ChatNode>[] = useMemo(() => {\n if (tree) return getActivePath(tree)\n // Flat-array fallback: lift each MessageNode into a TreeNode<ChatNode> shape.\n return (messages || []).map(m => ({...m, children: [], branchIndex: 0}))\n }, [tree, messages])\n\n /** Greyed-future nodes (between active leaf and the previously-active deepest leaf). */\n const greyedFuture: TreeNode<ChatNode>[] = useMemo(\n () => (tree ? getGreyedFuture(tree) : []),\n [tree],\n )\n\n /**\n * The checkpoint currently driving the artifacts panel — the nearest\n * ancestor of the active leaf whose kind is `checkpoint`. Used to mark\n * one checkpoint row as \"active\" (gold accent, no jump affordance).\n */\n const activeCheckpointId: string | null = useMemo(() => {\n if (!tree) return null\n const found = findAncestor(\n tree,\n tree.activeLeafId,\n (n): n is TreeNode<CheckpointNode> => n.kind === 'checkpoint',\n )\n return found?.id ?? null\n }, [tree])\n\n // ── Auto-open tools when data arrives (uncontrolled mode) ─────\n // Only auto-opens a tool if the user hasn't actively dismissed it.\n useEffect(() => {\n const nodes = artifactNodes || []\n const prevNodes = prevArtifactNodesRef.current\n\n const hasNewOrChangedNode = nodes.length !== prevNodes.length\n || nodes.some((n, i) => n.id !== prevNodes[i]?.id)\n\n if (!isPanelControlled\n && hasNewOrChangedNode && nodes.length > 0\n && !dismissedToolsRef.current.has('artifacts')) {\n setInternalTools(prev => ({...prev, 'top-right': 'artifacts'}))\n }\n\n const hasNewOrUpdatedTask = (curr: Task[], prev: Task[]): boolean => {\n return curr.some(c => {\n const p = prev.find(x => x.id === c.id)\n if (!p) {\n return true\n }\n if (c.status !== p.status || c.label !== p.label) {\n return true\n }\n return !!(c.subtasks && hasNewOrUpdatedTask(c.subtasks, p?.subtasks || []));\n\n })\n }\n\n if (hasNewOrUpdatedTask(tasks, prevTasksRef.current)\n && !dismissedToolsRef.current.has('todos')) {\n setInternalTools(prev => ({...prev, 'bottom-right': 'todos'}))\n }\n\n prevArtifactNodesRef.current = nodes\n prevTasksRef.current = tasks\n }, [artifactNodes, tasks, isPanelControlled])\n\n // ── Branch switching ──────────────────────────────────────────\n const handleBranchSwitch = useCallback(\n (nodeId: string, direction: 'prev' | 'next') => {\n if (!tree || !onTreeChange) {\n return\n }\n onTreeChange(switchBranch(tree, nodeId, direction))\n },\n [tree, onTreeChange]\n )\n\n const handleJumpHere = useCallback((nodeId: string) => {\n if (!tree) return\n if (onJumpHere) {\n onJumpHere(nodeId)\n return\n }\n if (onTreeChange) {\n onTreeChange(setActiveLeaf(tree, nodeId))\n }\n }, [tree, onTreeChange, onJumpHere])\n\n const handleJumpToLatest = useCallback(() => {\n if (!tree) return\n if (onJumpToLatest) {\n onJumpToLatest()\n return\n }\n if (onTreeChange && tree.lastLeafId) {\n onTreeChange(setActiveLeaf(tree, tree.lastLeafId))\n }\n }, [tree, onTreeChange, onJumpToLatest])\n\n // ── Build the heterogeneous row list for ChatView ─────────────\n const buildItem = useCallback(\n (node: TreeNode<ChatNode>, opts: { muted?: boolean }): ChatViewItem => {\n const branchInfo = tree && getSiblingInfo(tree, node.id).total > 1\n ? {\n ...getSiblingInfo(tree, node.id),\n onPrevious: () => handleBranchSwitch(node.id, 'prev'),\n onNext: () => handleBranchSwitch(node.id, 'next'),\n }\n : undefined\n\n if (node.kind === 'checkpoint') {\n return {\n kind: 'checkpoint',\n id: node.id,\n name: node.name,\n executionKind: node.executionKind,\n status: node.status,\n isActive: node.id === activeCheckpointId && !opts.muted,\n muted: opts.muted,\n branchInfo,\n onJumpHere: () => handleJumpHere(node.id),\n }\n }\n\n const actions = enableMessageActions\n ? {\n showCopy: true,\n onEdit: node.role === 'user' && onEditMessage\n ? (newContent: string) => onEditMessage(node.id, newContent)\n : undefined,\n onRetry: node.role === 'assistant' && onRetryMessage\n ? () => onRetryMessage(node.id)\n : undefined,\n }\n : undefined\n\n const isActiveLeaf = tree?.activeLeafId === node.id\n\n return {\n kind: 'message',\n id: node.id,\n variant: node.role,\n content: node.content,\n isStreaming: node.isStreaming,\n muted: opts.muted,\n branchInfo,\n actions,\n attachments: node.attachments\n ? node.attachments.map(a => ({\n id: a.id,\n file: {name: a.name, size: a.size ?? 0, type: a.type},\n previewUrl: a.previewUrl,\n artifactId: a.artifactId,\n status: a.status ?? 'analyzed',\n }))\n : undefined,\n onAttachmentOpen: handleAttachmentOpen,\n isActive: isActiveLeaf,\n onJumpHere: () => handleJumpHere(node.id),\n }\n },\n [tree, activeCheckpointId, enableMessageActions, onEditMessage, onRetryMessage,\n handleBranchSwitch, handleJumpHere, handleAttachmentOpen],\n )\n\n const displayItems: ChatViewItem[] = useMemo(() => {\n const items: ChatViewItem[] = activePath.map(n => buildItem(n, {muted: false}))\n if (greyedFuture.length > 0) {\n const messageCount = greyedFuture.filter(n => n.kind === 'message').length\n const checkpointCount = greyedFuture.filter(n => n.kind === 'checkpoint').length\n items.push({\n kind: 'divider',\n id: '__greyed_divider__',\n messageCount,\n checkpointCount,\n onJumpToLatest: handleJumpToLatest,\n })\n for (const n of greyedFuture) {\n items.push(buildItem(n, {muted: true}))\n }\n }\n return items\n }, [activePath, greyedFuture, buildItem, handleJumpToLatest])\n\n const latestUserMessageIndex = useMemo(() => {\n for (let i = displayItems.length - 1; i >= 0; i--) {\n const item = displayItems[i]\n if (item.kind === 'message' && item.variant === 'user' && !item.muted) {\n return i\n }\n }\n return -1\n }, [displayItems])\n\n const handleSubmit = useCallback(\n (message: string, attachments?: Attachment[]) => {\n onMessageSubmit?.(message, attachments)\n },\n [onMessageSubmit]\n )\n\n const isEmpty = displayItems.length === 0\n\n // ── Derived: which sides have tools ─────────────────────────\n const leftToolDefs = useMemo(\n () => allToolDefinitions.filter(t => t.group === 'top-left' || t.group === 'bottom-left'),\n [allToolDefinitions]\n )\n const rightToolDefs = useMemo(\n () => allToolDefinitions.filter(\n t => t.group === 'top-right' || t.group === 'bottom-right'),\n [allToolDefinitions]\n )\n const hasLeftTools = leftToolDefs.length > 0\n const hasRightTools = rightToolDefs.length > 0\n\n // ── Render tool content for a given slot ──────────────────────\n const renderToolContent = (toolId: string | null) => {\n if (!toolId) {\n return null\n }\n\n switch (toolId) {\n case 'history':\n return (\n <HistoryPanel\n conversations={conversations}\n onSelectConversation={onSelectConversation}\n onNewChat={onNewChat}\n onRenameConversation={onRenameConversation}\n />\n )\n\n case 'artifacts':\n return (\n <ArtifactsPanel\n nodes={artifactNodes}\n openArtifactId={panelOpenArtifactId}\n onArtifactClosed={handleArtifactPanelClosed}\n getArtifactActions={getArtifactActions}\n className=\"h-full\"\n />\n )\n\n case 'todos':\n return tasks.length > 0\n ? <TodosList tasks={tasks} title={tasksTitle} onStopAllTasks={onStopAllTasks}\n className=\"h-full\"/>\n : (\n <div className=\"h-full flex flex-col\">\n <div className=\"flex items-center p-4 border-b border-ash/40 shrink-0\">\n <h3 className=\"text-xs font-medium text-white\">Tasks</h3>\n </div>\n <div className=\"flex-1 flex items-center justify-center\">\n <p className=\"text-xs text-silver/60\">No tasks</p>\n </div>\n </div>\n )\n\n default: {\n // External tool — render its content\n const externalTool = externalTools.find(t => t.id === toolId)\n return externalTool?.content ?? null\n }\n }\n }\n\n return (\n <div\n ref={ref}\n className={cx('flex h-full w-full bg-obsidian overflow-hidden', className)}\n {...rest}\n >\n {/* Left tool sidebar */}\n {hasLeftTools && (\n <ToolSidebar\n tools={leftToolDefs}\n activeTools={activeTools}\n onToggleTool={toggleTool}\n side=\"left\"\n />\n )}\n\n {/* Left tool panel */}\n {isLeftPanelOpen && (\n <ToolPanelContainer\n topContent={renderToolContent(activeTools['top-left'])}\n bottomContent={renderToolContent(activeTools['bottom-left'])}\n width={leftToolsWidth}\n onResizeStart={startResizingLeftTools}\n side=\"left\"\n initialTopPercent={30}\n />\n )}\n\n {/* Main content area */}\n <div className=\"flex-1 flex flex-col min-w-0 relative\">\n <div className={cx(\n \"flex-1 flex flex-col min-h-0 relative\",\n isEmpty ? \"justify-center\" : \"justify-start\"\n )}>\n {/* Top spacer for centering in empty state */}\n <div className={cx(\n \"transition-all duration-500 ease-in-out\",\n isEmpty ? \"flex-1\" : \"flex-zero\"\n )}/>\n\n {/* Messages Area */}\n <div className={cx(\n \"transition-all duration-500 ease-in-out overflow-hidden flex flex-col\",\n isEmpty ? \"flex-zero opacity-0\" : \"flex-1 opacity-100\"\n )}>\n <ChatView\n items={displayItems}\n latestUserMessageIndex={latestUserMessageIndex}\n isThinking={isThinking}\n thinkingLabel={thinkingLabel}\n className=\"flex-1\"\n />\n </div>\n\n {/* Input Area */}\n <div className={cx(\n \"transition-all duration-500 ease-in-out z-10 w-full flex flex-col items-center\",\n isEmpty ? \"p-4\" : \"shrink-0 p-4 border-t border-ash/40 bg-obsidian\"\n )}>\n {isEmpty && (\n <div className=\"mb-8 text-center animate-fade-in duration-500\">\n {emptyState ? (\n emptyState\n ) : (\n <h1 className=\"text-4xl md:text-5xl font-heading text-gold mb-2 tracking-tight\">\n Welcome!\n </h1>\n )}\n </div>\n )}\n\n <ChatInput\n position={isEmpty ? \"centered\" : \"bottom\"}\n placeholder={placeholder}\n helperText={isEmpty ? emptyStateHelper : undefined}\n onSubmit={handleSubmit}\n disabled={isEmpty ? isStreaming : (isStreaming && !onStop)}\n isStreaming={isStreaming}\n onStop={onStop}\n showAttachmentButton={showAttachmentButton}\n attachments={propsAttachments}\n onAttachmentsChange={onAttachmentsChange}\n onAttachmentRemove={onAttachmentRemove}\n notice={inputNotice}\n onInputChange={onInputChange}\n initialInputValue={initialInputValue}\n autoFocus={autoFocus}\n textareaRef={textareaRef}\n onTextareaKeyDown={onTextareaKeyDown}\n />\n </div>\n\n {/* Bottom spacer for centering in empty state */}\n <div className={cx(\n \"transition-all duration-500 ease-in-out\",\n isEmpty ? \"flex-1\" : \"flex-zero\"\n )}/>\n </div>\n </div>\n\n {/* Right tool panel */}\n {isRightPanelOpen && (\n <ToolPanelContainer\n topContent={renderToolContent(activeTools['top-right'])}\n bottomContent={renderToolContent(activeTools['bottom-right'])}\n width={rightToolsWidth}\n onResizeStart={startResizingRightTools}\n side=\"right\"\n initialTopPercent={70}\n />\n )}\n\n {/* Right tool sidebar */}\n {hasRightTools && (\n <ToolSidebar\n tools={rightToolDefs}\n activeTools={activeTools}\n onToggleTool={toggleTool}\n side=\"right\"\n />\n )}\n </div>\n )\n }\n)\n\nChatInterface.displayName = 'ChatInterface'\n","import React, {useEffect} from 'react'\nimport {\n Message,\n type MessageActionsConfig,\n type MessageBranchInfo,\n type MessageProps,\n type MessageVariant,\n} from '../Message'\nimport {composeRefs, cx} from '../../utils'\nimport {useScrollAnchor} from './hooks/useScrollAnchor'\nimport {useAdaptiveSpacer} from './hooks/useAdaptiveSpacer'\nimport {ThinkingIndicator} from './ThinkingIndicator'\nimport {Checkpoint, type CheckpointBranchInfo, type CheckpointProps} from './Checkpoint'\nimport {GreyedDivider, type GreyedDividerProps} from './GreyedDivider'\n\n/**\n * One row in the chat stream. Discriminated by `kind` so ChatView can dispatch\n * to the right renderer without leaking shape into upstream types.\n */\nexport type ChatViewItem =\n | ChatViewMessageItem\n | ChatViewCheckpointItem\n | ChatViewDividerItem\n\nexport interface ChatViewMessageItem extends Omit<MessageProps, 'variant' | 'children'> {\n kind: 'message'\n id: string\n variant: MessageVariant\n /** Branch navigation info — chevrons render only when total > 1. */\n branchInfo?: MessageBranchInfo\n /** Actions configuration (copy / edit / retry). */\n actions?: MessageActionsConfig\n /** When true, this row is rendered in the greyed-future region. */\n muted?: boolean\n /**\n * When true, this message is the active leaf — Message will suppress its\n * `onJumpHere` click target. Mirrors `ChatViewCheckpointItem.isActive`.\n */\n isActive?: boolean\n /**\n * Click handler for the bubble. When provided, the bubble becomes a\n * navigational anchor that moves the active leaf to this node. Aurelius\n * suppresses the click for `isActive` rows, link / button targets inside\n * the bubble, and active text selections.\n */\n onJumpHere?: () => void\n}\n\nexport interface ChatViewCheckpointItem extends CheckpointProps {\n kind: 'checkpoint'\n id: string\n}\n\nexport interface ChatViewDividerItem extends GreyedDividerProps {\n kind: 'divider'\n id: string\n}\n\nexport interface ChatViewProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Rows to render in the chat stream. Heterogeneous: messages, checkpoints,\n * and the greyed-future divider live in the same list, ordered top-to-bottom.\n */\n items: ChatViewItem[]\n /**\n * Index of the latest user-message row to anchor scroll to. When this index\n * changes, the corresponding row scrolls to the top. Defaults to the\n * last-found user message in `items`.\n */\n latestUserMessageIndex?: number\n /**\n * Whether to show the thinking indicator (between user message and response).\n * Renders only when the latest message is a user turn — i.e. the assistant\n * hasn't sent its first chunk yet. Streaming-cursor behavior is owned by\n * the per-node {@code isStreaming} flag on each message item.\n */\n isThinking?: boolean\n /**\n * When set, the thinking indicator renders this label verbatim instead of\n * its rotating phrases. Use for domain-specific waits like\n * \"Analyzing uploads...\" (any animated suffix is the caller's responsibility).\n */\n thinkingLabel?: string\n /**\n * Callback when the user scrolls manually.\n */\n onScroll?: (e: React.UIEvent<HTMLDivElement>) => void\n}\n\n/**\n * Renders a heterogeneous chat stream — messages, checkpoints, and the\n * greyed-future divider — with smart scrolling behavior.\n *\n * Key behaviors:\n * - When a user message arrives, it anchors to the top of the viewport\n * - Does NOT auto-scroll during streaming (respects user's reading position)\n * - Each row's renderer is dispatched from its `kind` discriminator\n */\nexport const ChatView = React.forwardRef<HTMLDivElement, ChatViewProps>(\n function ChatView(\n {\n items,\n latestUserMessageIndex,\n isThinking,\n thinkingLabel,\n onScroll,\n className,\n ...rest\n },\n ref,\n ) {\n const {containerRef, anchorRef, scrollToAnchor} = useScrollAnchor({\n behavior: 'smooth',\n block: 'start',\n })\n\n const {contentRef, spacerRef, spacerHeight} = useAdaptiveSpacer({\n containerRef,\n anchorRef,\n })\n\n const latestUserIdx =\n latestUserMessageIndex ??\n items.reduceRight((found, item, idx) => {\n if (found === -1 && item.kind === 'message' && item.variant === 'user') {\n return idx\n }\n return found\n }, -1)\n\n useEffect(() => {\n if (latestUserMessageIndex !== undefined && latestUserMessageIndex >= 0) {\n scrollToAnchor()\n }\n }, [latestUserMessageIndex, scrollToAnchor])\n\n const lastMessage = items.reduceRight<ChatViewItem | null>((found, item) => {\n return found ?? (item.kind === 'message' ? item : null)\n }, null)\n const showThinking = isThinking\n && lastMessage?.kind === 'message'\n && lastMessage.variant === 'user'\n\n return (\n <div\n ref={composeRefs(containerRef, ref)}\n onScroll={onScroll}\n className={cx(\n 'flex flex-col w-full h-full overflow-y-auto scroll-smooth',\n 'px-4 py-6 overscroll-contain',\n className,\n )}\n {...rest}\n >\n <div ref={contentRef} className=\"relative flex flex-col gap-3\">\n {items.map((item, index) => {\n const isAnchor = index === latestUserIdx\n const wrapperRef = isAnchor ? anchorRef : undefined\n const wrapperClass = isAnchor ? 'scroll-mt-4' : undefined\n\n if (item.kind === 'divider') {\n const {kind: _k, id, ...dividerProps} = item\n return (\n <div key={id}>\n <GreyedDivider {...dividerProps}/>\n </div>\n )\n }\n\n if (item.kind === 'checkpoint') {\n const {kind: _k, id, ...checkpointProps} = item\n return (\n <div key={id} ref={wrapperRef} className={wrapperClass}>\n <Checkpoint {...checkpointProps}/>\n </div>\n )\n }\n\n const {\n kind: _k,\n id,\n variant,\n muted,\n className: messageClassName,\n branchInfo,\n actions,\n isStreaming: nodeIsStreaming,\n ...messageProps\n } = item\n const isMessageStreaming = !!nodeIsStreaming\n\n return (\n <div\n key={id}\n ref={wrapperRef}\n className={cx(wrapperClass, muted && 'opacity-60')}\n >\n <Message\n variant={variant}\n isStreaming={isMessageStreaming}\n className={messageClassName}\n branchInfo={branchInfo}\n actions={actions}\n hideActions={isMessageStreaming}\n {...messageProps}\n />\n </div>\n )\n })}\n\n {showThinking && <ThinkingIndicator isVisible manualLabel={thinkingLabel}/>}\n </div>\n\n <div\n ref={spacerRef}\n className=\"shrink-0 pointer-events-none\"\n style={{height: spacerHeight}}\n aria-hidden=\"true\"\n />\n </div>\n )\n },\n)\n\nChatView.displayName = 'ChatView'\n\n// Re-export sub-row types for convenience\nexport type {CheckpointBranchInfo}\n\nexport default ChatView\n","import {useCallback, useRef} from 'react'\n\nexport interface UseScrollAnchorOptions {\n /**\n * Behavior for scrolling. Defaults to 'smooth'.\n */\n behavior?: ScrollBehavior\n /**\n * Block alignment for scrollIntoView. Defaults to 'start'.\n */\n block?: ScrollLogicalPosition\n}\n\nexport interface UseScrollAnchorReturn {\n /**\n * Ref to attach to the scrollable container\n */\n containerRef: React.RefObject<HTMLDivElement | null>\n /**\n * Ref to attach to the anchor element (latest user message)\n */\n anchorRef: React.RefObject<HTMLDivElement | null>\n /**\n * Scroll the anchor element into view. Call this on user message submission.\n */\n scrollToAnchor: () => void\n /**\n * Scroll to the bottom of the container.\n */\n scrollToBottom: () => void\n /**\n * Check if user has scrolled away from the bottom.\n */\n isScrolledToBottom: () => boolean\n}\n\n/**\n * Hook for smart scroll behavior in chat interfaces.\n *\n * Key behaviors:\n * - Anchors user messages to the top of the viewport when they send a message\n * - Does NOT auto-scroll during streaming to respect user's reading position\n * - Allows manual scroll detection\n */\nexport function useScrollAnchor(\n options: UseScrollAnchorOptions = {}\n): UseScrollAnchorReturn {\n const {behavior = 'smooth', block = 'start'} = options\n\n const containerRef = useRef<HTMLDivElement>(null)\n const anchorRef = useRef<HTMLDivElement>(null)\n\n const scrollToAnchor = useCallback(() => {\n const el = anchorRef.current\n if (!el) {\n return\n }\n\n // Double rAF to ensure layout updates (e.g., adaptive spacer) have been applied.\n // First frame: other rAF callbacks (like spacer recalculation) run\n // Second frame: scroll happens with correct layout\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n el.scrollIntoView({behavior, block})\n })\n })\n }, [behavior, block])\n\n const scrollToBottom = useCallback(() => {\n const container = containerRef.current\n if (!container) {\n return\n }\n\n if (typeof container.scrollTo === 'function') {\n container.scrollTo({top: container.scrollHeight, behavior})\n } else {\n container.scrollTop = container.scrollHeight\n }\n }, [behavior])\n\n const isScrolledToBottom = useCallback(() => {\n const container = containerRef.current\n if (!container) {\n return true\n }\n\n const threshold = 50 // pixels from bottom to consider \"at bottom\"\n const {scrollTop, scrollHeight, clientHeight} = container\n return scrollHeight - scrollTop - clientHeight < threshold\n }, [])\n\n return {\n containerRef,\n anchorRef,\n scrollToAnchor,\n scrollToBottom,\n isScrolledToBottom,\n }\n}\n\nexport default useScrollAnchor\n","import {useCallback, useEffect, useRef, useState} from 'react'\n\nexport interface UseAdaptiveSpacerOptions {\n /**\n * Minimum spacer height. Defaults to 0.\n */\n minHeight?: number\n /**\n * External container ref to use instead of creating one internally.\n * Useful when sharing the container ref with other hooks (e.g., useScrollAnchor).\n */\n containerRef?: React.RefObject<HTMLDivElement | null>\n /**\n * Ref to the anchor element (e.g., latest user message).\n * When provided, spacer is calculated to allow anchor to scroll to top.\n */\n anchorRef?: React.RefObject<HTMLDivElement | null>\n}\n\nexport interface UseAdaptiveSpacerReturn {\n /**\n * Ref to attach to the scrollable container (only use if not providing external ref)\n */\n containerRef: React.RefObject<HTMLDivElement | null>\n /**\n * Ref to attach to the content wrapper (excludes spacer)\n */\n contentRef: React.RefObject<HTMLDivElement | null>\n /**\n * Ref to attach to the spacer element for imperative height updates\n */\n spacerRef: React.RefObject<HTMLDivElement | null>\n /**\n * Calculated spacer height in pixels\n */\n spacerHeight: number\n /**\n * Force recalculation of spacer height\n */\n recalculate: () => void\n}\n\n/**\n * Hook that calculates the exact spacer height needed to fill remaining viewport space\n * while allowing the anchor element to scroll to the top.\n *\n * The spacer height is calculated as:\n * spacerHeight = containerHeight - padding - heightFromAnchorToBottom\n *\n * This ensures:\n * - The anchor message can scroll to the top of the viewport\n * - Below the anchor, content + spacer fills exactly the remaining space\n * - As content below anchor grows, spacer shrinks\n * - When content exceeds available space, spacer becomes 0\n */\nexport function useAdaptiveSpacer(\n options: UseAdaptiveSpacerOptions = {}\n): UseAdaptiveSpacerReturn {\n const {minHeight = 0, containerRef: externalContainerRef, anchorRef} = options\n\n const internalContainerRef = useRef<HTMLDivElement>(null)\n const containerRef = externalContainerRef ?? internalContainerRef\n const contentRef = useRef<HTMLDivElement>(null)\n const spacerRef = useRef<HTMLDivElement>(null)\n const [spacerHeight, setSpacerHeight] = useState(0)\n\n const recalculate = useCallback(() => {\n const container = containerRef.current\n const content = contentRef.current\n if (!container || !content) {\n return\n }\n\n // Get container's computed padding\n const style = getComputedStyle(container)\n const paddingTop = parseFloat(style.paddingTop) || 0\n const paddingBottom = parseFloat(style.paddingBottom) || 0\n const availableHeight = container.clientHeight - paddingTop - paddingBottom\n\n // Calculate height from anchor to bottom of content\n // Using offsetTop for stable measurement from \"zero\" (content top)\n let heightFromAnchorToBottom: number\n const anchor = anchorRef?.current\n\n if (anchor && content.contains(anchor)) {\n // Anchor's position from the top of content (the \"zero\" point)\n // Content wrapper has position:relative, so offsetTop is relative to it\n const anchorTop = anchor.offsetTop\n heightFromAnchorToBottom = content.scrollHeight - anchorTop\n } else {\n // No anchor, use total content height\n heightFromAnchorToBottom = content.scrollHeight\n }\n\n const newSpacerHeight = Math.max(minHeight, availableHeight - heightFromAnchorToBottom)\n\n // Update DOM imperatively for immediate effect (before React commits state)\n // This ensures scrollToAnchor sees the correct spacer height\n if (spacerRef.current) {\n spacerRef.current.style.height = `${newSpacerHeight}px`\n }\n\n // Also update state for React reconciliation\n setSpacerHeight(newSpacerHeight)\n }, [minHeight, anchorRef])\n\n useEffect(() => {\n const container = containerRef.current\n const content = contentRef.current\n if (!container || !content) {\n return\n }\n\n // Initial calculation\n recalculate()\n\n // Observe both container and content for size changes\n const resizeObserver = new ResizeObserver(() => {\n recalculate()\n })\n\n resizeObserver.observe(container)\n resizeObserver.observe(content)\n\n // Also observe mutations in content (for DOM changes that don't trigger resize)\n const mutationObserver = new MutationObserver(() => {\n // Use requestAnimationFrame to batch with render\n requestAnimationFrame(recalculate)\n })\n\n mutationObserver.observe(content, {\n childList: true,\n subtree: true,\n characterData: true,\n })\n\n return () => {\n resizeObserver.disconnect()\n mutationObserver.disconnect()\n }\n }, [recalculate])\n\n return {\n containerRef,\n contentRef,\n spacerRef,\n spacerHeight,\n recalculate,\n }\n}\n\nexport default useAdaptiveSpacer\n","import React, {useEffect, useState} from 'react'\nimport {cx} from '../../utils'\n\nconst THINKING_PHRASES = [\n 'Consulting the ancient tomes...',\n 'Parsing the ineffable...',\n 'Traversing the manifold of possibilities...',\n 'Genuflecting before the oracle...',\n 'Distilling quintessence...',\n 'Communing with the machine spirits...',\n 'Unfolding higher dimensions...',\n 'Perturbing the probability matrix...',\n 'Invoking the categorical imperative...',\n 'Reticulating splines...',\n 'Brewing a fresh batch of tokens...',\n 'Consulting my inner monologue...',\n 'Summoning the muse...',\n]\n\nexport interface ThinkingIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Whether the indicator is visible/active\n */\n isVisible?: boolean\n /**\n * Interval between phrase changes in ms\n * @default 2500\n */\n phraseInterval?: number\n /**\n * Custom phrases to cycle through (defaults to built-in phrases)\n */\n phrases?: string[]\n /**\n * When set, suppresses internal phrase rotation and renders this label\n * verbatim. Used by the host to express domain-specific waiting states\n * (e.g. \"Analyzing uploads...\"). Any animated suffix (cycling dots) is the\n * caller's responsibility — Aurelius renders the string as-is.\n */\n manualLabel?: string\n}\n\n/**\n * ThinkingIndicator shows an animated state when the assistant is processing a request\n * but has not yet started streaming tokens. It cycles through flavorful \"thinking\" phrases.\n */\nexport const ThinkingIndicator = React.forwardRef<HTMLDivElement, ThinkingIndicatorProps>(\n (\n {\n isVisible = true,\n phraseInterval = 2500,\n phrases = THINKING_PHRASES,\n manualLabel,\n className,\n ...rest\n },\n ref\n ) => {\n // Start at a random phrase each time\n const [currentIndex, setCurrentIndex] = useState(\n () => Math.floor(Math.random() * phrases.length))\n const [isTransitioning, setIsTransitioning] = useState(false)\n\n const isManual = manualLabel !== undefined\n\n useEffect(() => {\n if (!isVisible || isManual || phrases.length <= 1) {\n return\n }\n\n let fadeTimeout: ReturnType<typeof setTimeout> | null = null\n const interval = setInterval(() => {\n setIsTransitioning(true)\n // Wait for fade out, then change phrase\n fadeTimeout = setTimeout(() => {\n setCurrentIndex((prev) => (prev + 1) % phrases.length)\n setIsTransitioning(false)\n fadeTimeout = null\n }, 200)\n }, phraseInterval)\n\n return () => {\n clearInterval(interval)\n if (fadeTimeout !== null) {\n clearTimeout(fadeTimeout)\n }\n }\n }, [isVisible, isManual, phrases.length, phraseInterval])\n\n if (!isVisible) {\n return null\n }\n\n return (\n <div\n ref={ref}\n className={cx(\n 'flex items-center gap-2 px-3 py-2 w-fit',\n 'bg-charcoal border border-ash text-silver',\n 'mr-auto',\n className\n )}\n role=\"status\"\n aria-live=\"polite\"\n {...rest}\n >\n {/* Animated dots */}\n <div className=\"flex gap-1\" aria-hidden=\"true\">\n <span className=\"w-1.5 h-1.5 bg-gold/60 rounded-full animate-pulse\"\n style={{animationDelay: '0ms'}}/>\n <span className=\"w-1.5 h-1.5 bg-gold/60 rounded-full animate-pulse\"\n style={{animationDelay: '150ms'}}/>\n <span className=\"w-1.5 h-1.5 bg-gold/60 rounded-full animate-pulse\"\n style={{animationDelay: '300ms'}}/>\n </div>\n\n {/* Phrase: manual label rendered verbatim, otherwise rotating phrases. */}\n {isManual ? (\n <span className=\"text-sm italic\">{manualLabel}</span>\n ) : (\n <span\n className={cx(\n 'text-sm italic transition-opacity duration-200',\n isTransitioning ? 'opacity-0' : 'opacity-100'\n )}\n >\n {phrases[currentIndex]}\n </span>\n )}\n </div>\n )\n }\n)\n\nThinkingIndicator.displayName = 'ThinkingIndicator'\n\nexport default ThinkingIndicator\n","import React from 'react'\nimport {\n ArrowLeft,\n ChevronLeft,\n ChevronRight,\n GitBranch,\n GitCommitVertical,\n GitMerge,\n PencilLine,\n Upload,\n} from 'lucide-react'\nimport {cx} from '../../utils'\n\n/**\n * What kind of project mutation produced this checkpoint. Drives the icon and\n * visual emphasis. The label and underlying state are unchanged.\n */\nexport type CheckpointExecutionKind = 'task' | 'submit' | 'rename' | 'init' | 'ingest'\n\n/**\n * Terminal state of the underlying execution. `failed` and `cancelled` render\n * with status text and muted accents but stay clickable so the user can still\n * inspect the partial state.\n */\nexport type CheckpointStatus = 'completed' | 'failed' | 'cancelled'\n\nexport interface CheckpointBranchInfo {\n /** 1-based index of this checkpoint among its siblings. */\n current: number\n /** Total sibling count at this fork point. */\n total: number\n onPrevious?: () => void\n onNext?: () => void\n}\n\nexport interface CheckpointProps {\n /** Human-readable label, ≤ 50 chars. Comes from the underlying execution name. */\n name: string\n /** What produced the checkpoint — drives the leading icon. */\n executionKind: CheckpointExecutionKind\n /**\n * Terminal status of the execution.\n * @default 'completed'\n */\n status?: CheckpointStatus\n /**\n * When true, this checkpoint is the active leaf — the artifacts panel is\n * already showing this state. Renders without underline or jump affordance.\n */\n isActive?: boolean\n /**\n * When true, this checkpoint sits in the greyed-future region (the timeline\n * the user rewound away from). Lower opacity; still clickable to jump back.\n */\n muted?: boolean\n /**\n * Sibling info for the BranchNavigator chevrons. Chevrons render only when\n * `total > 1`.\n */\n branchInfo?: CheckpointBranchInfo\n /**\n * Click handler for the row. Called when the user wants to jump to this\n * checkpoint (rewind the artifacts panel and active leaf to here).\n */\n onJumpHere?: () => void\n}\n\nconst KIND_ICONS: Record<CheckpointExecutionKind, React.ComponentType<{ className?: string }>> = {\n task: GitBranch,\n submit: GitMerge,\n rename: PencilLine,\n init: GitCommitVertical,\n ingest: Upload,\n}\n\nconst KIND_ARIA_LABELS: Record<CheckpointExecutionKind, string> = {\n task: 'Task checkpoint',\n submit: 'Submit checkpoint',\n rename: 'Rename checkpoint',\n init: 'Project head checkpoint',\n ingest: 'Upload batch checkpoint',\n}\n\n/**\n * A single-line marker in the chat stream that anchors a chat position to a\n * project state. Clicking the underlined name rewinds the artifacts panel and\n * the active leaf to this checkpoint without forking. Chevrons switch between\n * sibling forks (e.g. parallel task attempts, alternative submits).\n *\n * Visual variants:\n * - active: gold accent, no underline (the user is already here)\n * - muted: greyed-future row, lower opacity, still clickable\n * - failed/cancelled: status suffix in muted error/silver, still clickable\n */\nexport const Checkpoint = React.forwardRef<HTMLDivElement, CheckpointProps>(\n function Checkpoint(\n {name, executionKind, status = 'completed', isActive, muted, branchInfo, onJumpHere},\n ref,\n ) {\n const KindIcon = KIND_ICONS[executionKind]\n const isFailed = status === 'failed'\n const isCancelled = status === 'cancelled'\n const isInteractive = !isActive && !!onJumpHere\n\n const iconColor = isActive\n ? 'text-gold'\n : isFailed\n ? 'text-error-muted'\n : 'text-silver/50'\n\n const nameClasses = cx(\n 'transition-colors text-xs',\n isActive\n ? 'text-silver font-medium'\n : isInteractive\n ? 'text-silver/70 hover:text-white underline decoration-silver/30 underline-offset-4 decoration-dotted hover:decoration-silver/70'\n : 'text-silver/50',\n )\n\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-label={KIND_ARIA_LABELS[executionKind]}\n className={cx(\n 'group/checkpoint flex items-center gap-2 py-1.5 select-none',\n muted && 'opacity-60',\n )}\n >\n <KindIcon className={cx('w-3.5 h-3.5 shrink-0', iconColor)} aria-hidden=\"true\"/>\n\n <button\n type=\"button\"\n onClick={isInteractive ? onJumpHere : undefined}\n disabled={!isInteractive}\n className={cx(nameClasses, 'truncate text-left',\n !isInteractive && 'cursor-default')}\n aria-label={isInteractive ? `Jump to checkpoint ${name}` : name}\n >\n <span className=\"truncate\">{name}</span>\n {isFailed && (\n <span className=\"ml-1.5 text-error-muted\">· failed</span>\n )}\n {isCancelled && (\n <span className=\"ml-1.5 text-silver/40\">· cancelled</span>\n )}\n </button>\n\n {isInteractive && (\n <span\n className={cx(\n 'ml-1 inline-flex items-center gap-1 text-xs text-silver/40',\n 'opacity-0 group-hover/checkpoint:opacity-100 transition-opacity',\n 'pointer-events-none',\n )}\n aria-hidden=\"true\"\n >\n <ArrowLeft className=\"w-3 h-3\"/>\n Jump here\n </span>\n )}\n\n {branchInfo && branchInfo.total > 1 && (\n <div\n className=\"ml-auto inline-flex items-center gap-0.5 text-silver/70 text-xs\"\n role=\"navigation\"\n aria-label=\"Switch sibling checkpoint\"\n >\n <button\n type=\"button\"\n onClick={branchInfo.onPrevious}\n disabled={branchInfo.current <= 1}\n className={cx(\n 'p-0.5 hover:text-white hover:bg-white/10 transition-colors',\n 'disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-silver/70',\n )}\n aria-label=\"Previous sibling checkpoint\"\n >\n <ChevronLeft className=\"w-3 h-3\"/>\n </button>\n <span className=\"tabular-nums min-w-6 text-center\">\n {branchInfo.current}/{branchInfo.total}\n </span>\n <button\n type=\"button\"\n onClick={branchInfo.onNext}\n disabled={branchInfo.current >= branchInfo.total}\n className={cx(\n 'p-0.5 hover:text-white hover:bg-white/10 transition-colors',\n 'disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-silver/70',\n )}\n aria-label=\"Next sibling checkpoint\"\n >\n <ChevronRight className=\"w-3 h-3\"/>\n </button>\n </div>\n )}\n </div>\n )\n },\n)\n\nCheckpoint.displayName = 'Checkpoint'\n\nexport default Checkpoint\n","import React from 'react'\nimport {ArrowDown} from 'lucide-react'\nimport {cx} from '../../utils'\n\nexport interface GreyedDividerProps {\n /** Number of message rows in the greyed-future region. */\n messageCount: number\n /** Number of checkpoint rows in the greyed-future region. */\n checkpointCount: number\n /** Click handler that jumps the active leaf to the deepest greyed leaf. */\n onJumpToLatest?: () => void\n}\n\nfunction pluralize(n: number, singular: string, plural: string): string {\n return `${n} ${n === 1 ? singular : plural}`\n}\n\nfunction summarize(messageCount: number, checkpointCount: number): string {\n const parts: string[] = []\n if (messageCount > 0) {\n parts.push(pluralize(messageCount, 'message', 'messages'))\n }\n if (checkpointCount > 0) {\n parts.push(pluralize(checkpointCount, 'checkpoint', 'checkpoints'))\n }\n return parts.length > 0 ? parts.join(', ') : 'no items'\n}\n\n/**\n * A full-width divider that announces the start of the greyed-future region —\n * the timeline beyond the user's current rewound position. Clicking\n * \"Jump to latest\" returns to the deepest leaf the user previously reached.\n *\n * Visual: hairline rule with a centered summary chip and a right-aligned\n * jump-to-latest action. Renders nothing when both counts are zero.\n */\nexport const GreyedDivider = React.forwardRef<HTMLDivElement, GreyedDividerProps>(\n function GreyedDivider({messageCount, checkpointCount, onJumpToLatest}, ref) {\n if (messageCount === 0 && checkpointCount === 0) {\n return null\n }\n\n return (\n <div\n ref={ref}\n role=\"separator\"\n aria-label=\"Start of rewound timeline\"\n className=\"flex items-center gap-3 py-2 text-xs text-silver/50 select-none\"\n >\n <div className=\"flex-1 h-px bg-ash/40\" aria-hidden=\"true\"/>\n\n <span className=\"inline-flex items-center gap-1.5 whitespace-nowrap\">\n <ArrowDown className=\"w-3 h-3\" aria-hidden=\"true\"/>\n Later in this conversation · {summarize(messageCount, checkpointCount)}\n </span>\n\n <div className=\"flex-1 h-px bg-ash/40\" aria-hidden=\"true\"/>\n\n {onJumpToLatest && (\n <button\n type=\"button\"\n onClick={onJumpToLatest}\n className={cx(\n 'shrink-0 transition-colors',\n 'text-silver/60 hover:text-white',\n 'underline decoration-silver/30 underline-offset-4 decoration-dotted hover:decoration-silver/70',\n )}\n >\n Jump to latest →\n </button>\n )}\n </div>\n )\n },\n)\n\nGreyedDivider.displayName = 'GreyedDivider'\n\nexport default GreyedDivider\n","import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'\nimport {composeRefs, cx} from '../../utils'\nimport {Paperclip, Send, Square, X} from 'lucide-react'\nimport {type AttachmentItem, AttachmentPreview} from '../AttachmentPreview'\nimport {Attachment, createPreviewUrl, generateId, isImageFile} from './types'\n\nexport interface ChatInputNotice {\n /**\n * Visual severity: 'warning' shows a dismissible amber notice, 'error' shows a persistent red\n * notice\n */\n variant: 'warning' | 'error'\n /**\n * Content to render — plain text or any React node (e.g. text + button for error state)\n */\n content: React.ReactNode\n /**\n * Whether to show a dismiss (×) button. Defaults to true for warning, ignored for error.\n */\n dismissible?: boolean\n /**\n * Called when the dismiss button is clicked. Consumer controls whether the notice disappears.\n */\n onDismiss?: () => void\n}\n\nexport type ChatInputPosition = 'centered' | 'bottom'\n\nexport interface ChatInputProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSubmit'> {\n /**\n * Position of the input: 'centered' for empty state, 'bottom' for conversation mode\n */\n position?: ChatInputPosition\n /**\n * Placeholder text for the input\n */\n placeholder?: string\n /**\n * Helper text shown above the input in centered mode\n */\n helperText?: React.ReactNode\n /**\n * Called when the user submits a message\n */\n onSubmit?: (message: string, attachments?: Attachment[]) => void\n /**\n * Whether the input is disabled (e.g., during streaming)\n */\n disabled?: boolean\n /**\n * Whether to animate the transition between positions\n */\n animate?: boolean\n /**\n * Whether the assistant is currently streaming (shows Stop button)\n */\n isStreaming?: boolean\n /**\n * Called when the Stop button is clicked during streaming\n */\n onStop?: () => void\n /**\n * Current attachments (controlled mode)\n */\n attachments?: Attachment[]\n /**\n * Called when attachments change (controlled mode)\n */\n onAttachmentsChange?: (attachments: Attachment[]) => void\n /**\n * Called when an attachment is removed by the user (clicking the \"x\")\n */\n onAttachmentRemove?: (attachment: Attachment) => void\n /**\n * Whether to show the attachment button\n */\n showAttachmentButton?: boolean\n /**\n * Accepted file types for attachments\n */\n acceptedFileTypes?: string\n /**\n * Optional notice displayed above the input (e.g. credit warnings or exhaustion messages)\n */\n notice?: ChatInputNotice\n /**\n * Called whenever the input value changes, giving the consumer access to the current text\n */\n onInputChange?: (value: string) => void\n /**\n * Initial value for the input, used for state restoration (e.g. from DB or localStorage)\n */\n initialInputValue?: string\n /**\n * Whether to automatically focus the input when it becomes enabled\n */\n autoFocus?: boolean\n /**\n * Optional ref forwarded to the underlying `<textarea>`. Use this to drive an inline\n * autocomplete (e.g. an `@`-mention picker) — read selection/caret position, mirror the\n * textarea for caret coordinates, or imperatively update its value.\n */\n textareaRef?: React.Ref<HTMLTextAreaElement>\n /**\n * Optional keydown hook that runs before the input's own handling. Call\n * `e.preventDefault()` to stop ChatInput from acting on the event — for example, to keep\n * Enter from submitting while an autocomplete is consuming it. The submit-on-Enter and\n * default newline behaviours both check `defaultPrevented` and skip when set.\n */\n onTextareaKeyDown?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void\n}\n\n/**\n * ChatInput is a context-aware input component that can transition between\n * a centered position (for empty states) and a bottom position (for active conversations).\n *\n * Features:\n * - Auto-expanding textarea\n * - File attachments with preview\n * - Drag and drop support\n * - Streaming state with stop button\n * - Animated transition between positions\n */\nexport const ChatInput = React.forwardRef<HTMLDivElement, ChatInputProps>(\n (\n {\n position = 'bottom',\n placeholder = 'Send a message...',\n helperText,\n onSubmit,\n disabled = false,\n animate = true,\n isStreaming = false,\n onStop,\n attachments: controlledAttachments,\n onAttachmentsChange,\n onAttachmentRemove,\n showAttachmentButton = true,\n acceptedFileTypes,\n notice,\n onInputChange,\n initialInputValue = '',\n autoFocus = false,\n textareaRef: externalTextareaRef,\n onTextareaKeyDown,\n className,\n ...rest\n },\n ref\n ) => {\n const [value, setValue] = useState(initialInputValue)\n const [localAttachments, setLocalAttachments] = useState<Attachment[]>([])\n const [isDragOver, setIsDragOver] = useState(false)\n const textareaRef = useRef<HTMLTextAreaElement>(null)\n const fileInputRef = useRef<HTMLInputElement>(null)\n\n const mergedTextareaRef = useMemo(\n () => composeRefs<HTMLTextAreaElement>(textareaRef, externalTextareaRef),\n [externalTextareaRef]\n )\n\n // Determine if using controlled or uncontrolled attachments\n const attachments = controlledAttachments ?? localAttachments\n const setAttachments = useCallback(\n (newAttachments: Attachment[] | ((prev: Attachment[]) => Attachment[])) => {\n if (onAttachmentsChange) {\n if (typeof newAttachments === 'function') {\n onAttachmentsChange(newAttachments(attachments))\n } else {\n onAttachmentsChange(newAttachments)\n }\n } else {\n setLocalAttachments(newAttachments)\n }\n },\n [attachments, onAttachmentsChange]\n )\n\n const handleSubmit = useCallback(() => {\n const trimmed = value.trim()\n if (!trimmed || disabled || isStreaming) {\n return\n }\n\n onSubmit?.(trimmed, attachments.length > 0 ? attachments : undefined)\n setValue('')\n setAttachments([])\n\n // Reset textarea height\n if (textareaRef.current) {\n textareaRef.current.style.height = 'auto'\n }\n }, [value, disabled, isStreaming, onSubmit, attachments, setAttachments])\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n // Consumer first — lets an attached autocomplete claim Arrow/Enter/Escape\n // before submit-on-Enter fires. A consumer that calls preventDefault opts\n // out of all default key behaviour for that event.\n onTextareaKeyDown?.(e)\n if (e.defaultPrevented) {\n return\n }\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault()\n handleSubmit()\n }\n },\n [handleSubmit, onTextareaKeyDown]\n )\n\n const handleChange = useCallback((e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setValue(e.target.value)\n onInputChange?.(e.target.value)\n\n // Auto-resize textarea\n const textarea = e.target\n textarea.style.height = 'auto'\n textarea.style.height = `${Math.min(textarea.scrollHeight, 200)}px`\n }, [onInputChange])\n\n // Focus input when it becomes enabled\n useEffect(() => {\n if (autoFocus && !disabled && !isStreaming && textareaRef.current) {\n textareaRef.current.focus()\n }\n }, [disabled, isStreaming, autoFocus])\n\n // File handling\n const addFiles = useCallback(\n (files: FileList | File[]) => {\n const newAttachments: Attachment[] = Array.from(files).map((file) => ({\n id: generateId(),\n file,\n previewUrl: isImageFile(file) ? createPreviewUrl(file) : undefined,\n status: 'pending' as const,\n }))\n setAttachments((prev) => [...prev, ...newAttachments])\n },\n [setAttachments]\n )\n\n const handleFileSelect = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const files = e.target.files\n if (files && files.length > 0) {\n addFiles(files)\n }\n // Reset input so the same file can be selected again\n e.target.value = ''\n },\n [addFiles]\n )\n\n const handleRemoveAttachment = useCallback(\n (id: string) => {\n const attachment = attachments.find((a) => a.id === id)\n if (attachment && onAttachmentRemove) {\n onAttachmentRemove(attachment)\n }\n\n setAttachments((prev) => {\n const attachmentToRemove = prev.find((a) => a.id === id)\n if (attachmentToRemove?.previewUrl) {\n URL.revokeObjectURL(attachmentToRemove.previewUrl)\n }\n return prev.filter((a) => a.id !== id)\n })\n },\n [attachments, onAttachmentRemove, setAttachments]\n )\n\n // Drag and drop handlers\n const handleDragEnter = useCallback((e: React.DragEvent) => {\n e.preventDefault()\n e.stopPropagation()\n setIsDragOver(true)\n }, [])\n\n const handleDragLeave = useCallback((e: React.DragEvent) => {\n e.preventDefault()\n e.stopPropagation()\n // Only set to false if we're leaving the container entirely\n if (!e.currentTarget.contains(e.relatedTarget as Node)) {\n setIsDragOver(false)\n }\n }, [])\n\n const handleDragOver = useCallback((e: React.DragEvent) => {\n e.preventDefault()\n e.stopPropagation()\n }, [])\n\n const handleDrop = useCallback(\n (e: React.DragEvent) => {\n e.preventDefault()\n e.stopPropagation()\n setIsDragOver(false)\n\n const files = e.dataTransfer.files\n if (files && files.length > 0) {\n addFiles(files)\n }\n },\n [addFiles]\n )\n\n const isCentered = position === 'centered'\n const hasAttachments = attachments.length > 0\n // Send is gated while bytes are still moving or have not landed at all.\n // `uploaded` and beyond are sendable; integrate handles analysis fallbacks.\n const isUploadIncomplete = attachments.some(a =>\n a.status === 'pending' || a.status === 'uploading' || a.status === 'upload_failed')\n const canSubmit = value.trim() && !disabled && !isStreaming && !isUploadIncomplete\n\n return (\n <div\n ref={ref}\n className={cx(\n 'w-full',\n isCentered && 'flex flex-col items-center justify-center',\n animate && 'transition-all duration-300 ease-out',\n className\n )}\n {...rest}\n >\n {/* Helper text for centered mode */}\n {isCentered && helperText && (\n <p className=\"text-silver text-sm mb-4 text-center\">{helperText}</p>\n )}\n\n {/* Notice bar */}\n {notice && (\n <div className={cx(\n 'w-full flex items-start gap-2 px-3 py-2 mb-1 text-xs',\n isCentered && 'max-w-lg',\n notice.variant === 'warning'\n ? 'bg-gold/5 border border-gold/20 text-gold/80'\n : 'bg-error/10 border border-error/30 text-error'\n )}>\n <span className=\"flex-1\">{notice.content}</span>\n {(notice.dismissible ?? notice.variant === 'warning') && notice.onDismiss && (\n <button\n type=\"button\"\n onClick={notice.onDismiss}\n aria-label=\"Dismiss\"\n className={cx(\n 'shrink-0 opacity-60 hover:opacity-100 transition-opacity',\n notice.variant === 'warning' ? 'text-gold' : 'text-error'\n )}\n >\n <X className=\"w-3 h-3\"/>\n </button>\n )}\n </div>\n )}\n\n {/* Input container */}\n <div\n className={cx(\n 'relative w-full bg-charcoal border',\n isDragOver ? 'border-gold ring-1 ring-gold/30' : 'border-ash/60',\n 'focus-within:border-gold/60 focus-within:ring-1 focus-within:ring-gold/20',\n 'transition-colors duration-200',\n isCentered && 'max-w-lg'\n )}\n onDragEnter={showAttachmentButton ? handleDragEnter : undefined}\n onDragLeave={showAttachmentButton ? handleDragLeave : undefined}\n onDragOver={showAttachmentButton ? handleDragOver : undefined}\n onDrop={showAttachmentButton ? handleDrop : undefined}\n >\n {/* Attachments preview */}\n {hasAttachments && (\n <div className=\"px-3 pt-3 pb-1\">\n <AttachmentPreview\n attachments={attachments as AttachmentItem[]}\n onRemove={handleRemoveAttachment}\n removable={!isStreaming}\n />\n </div>\n )}\n\n {/* Drag overlay */}\n {isDragOver && (\n <div\n className=\"absolute inset-0 bg-gold/10 flex items-center justify-center z-10 pointer-events-none\">\n <span className=\"text-gold text-sm font-medium\">Drop files here</span>\n </div>\n )}\n\n {/* Textarea row */}\n <div className=\"flex items-end\">\n {/* Attachment button */}\n {showAttachmentButton && (\n <>\n <button\n type=\"button\"\n onClick={() => fileInputRef.current?.click()}\n disabled={disabled || isStreaming}\n className={cx(\n 'p-3 text-silver/60 hover:text-silver transition-colors',\n 'disabled:opacity-50 disabled:cursor-not-allowed'\n )}\n aria-label=\"Attach file\"\n >\n <Paperclip className=\"w-5 h-5\"/>\n </button>\n <input\n ref={fileInputRef}\n type=\"file\"\n multiple\n accept={acceptedFileTypes}\n onChange={handleFileSelect}\n className=\"hidden\"\n aria-hidden=\"true\"\n />\n </>\n )}\n\n <textarea\n ref={mergedTextareaRef}\n value={value}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n disabled={disabled || isStreaming}\n rows={1}\n className={cx(\n 'flex-1 bg-transparent text-white placeholder:text-silver/60',\n 'py-3 pr-12 resize-none outline-none min-h-12',\n !showAttachmentButton && 'pl-4',\n (disabled || isStreaming) && 'opacity-50 cursor-not-allowed'\n )}\n style={{maxHeight: 200}}\n />\n\n {/* Submit or Stop button */}\n {isStreaming ? (\n <button\n type=\"button\"\n onClick={onStop}\n className={cx(\n 'absolute right-2 bottom-2 p-2',\n 'text-error hover:bg-error/10 transition-colors duration-200'\n )}\n aria-label=\"Stop generation\"\n >\n <Square className=\"w-5 h-5 fill-current\"/>\n </button>\n ) : (\n <button\n type=\"button\"\n onClick={handleSubmit}\n disabled={!canSubmit}\n className={cx(\n 'absolute right-2 bottom-2 p-2',\n 'transition-colors duration-200',\n canSubmit\n ? 'text-gold hover:bg-gold/10'\n : 'text-silver/40 cursor-not-allowed'\n )}\n aria-label=\"Send message\"\n >\n <Send className=\"w-5 h-5\"/>\n </button>\n )}\n </div>\n </div>\n </div>\n )\n }\n)\n\nChatInput.displayName = 'ChatInput'\n\nexport default ChatInput\n","/**\n * Conversation tree types.\n *\n * The chat is rendered from a tree where every fork point — user-edits,\n * retries, parallel task attempts, rewinds — produces siblings under a shared\n * parent. The tree is generic over its node type so that the topology\n * algorithms in `./tree.ts` stay free of any kind-specific branching.\n *\n * Two concrete node kinds live here today: `MessageNode` (a user or assistant\n * turn) and `CheckpointNode` (a marker anchored to a hypocaust task execution\n * that the user can rewind to). New kinds plug in by extending `NodeTopology`\n * and joining the `ChatNode` union.\n */\n\nimport {ReactNode} from 'react'\n\n// ───────────────────────────────────────────────────────────────\n// Topology\n// ───────────────────────────────────────────────────────────────\n\n/**\n * The minimal contract every tree node must satisfy. The tree algorithms only\n * ever read these fields; everything else is opaque to them.\n */\nexport interface NodeTopology {\n id: string\n parentId: string | null\n createdAt?: number\n}\n\n/**\n * A node as actually stored in the tree: the caller's data plus the adjacency\n * info the tree maintains. `children` and `branchIndex` are owned by the tree\n * and must never be set by callers — pass a plain `T` to `addNodeToTree`.\n */\nexport type TreeNode<T extends NodeTopology> = T & {\n children: string[]\n branchIndex?: number\n}\n\n// ───────────────────────────────────────────────────────────────\n// Concrete chat node kinds\n// ───────────────────────────────────────────────────────────────\n\n/**\n * A user or assistant message in the conversation.\n */\nexport interface MessageNode extends NodeTopology {\n kind: 'message'\n role: 'user' | 'assistant'\n /** Rendered content. Strings, React nodes, or anything ChatView can display. */\n content: ReactNode\n /** Whether this message is currently being streamed. */\n isStreaming?: boolean\n /**\n * Files that were attached to this message turn. Rendered as a chip strip\n * above the bubble. Empty/undefined renders nothing. The `artifactId` field\n * on each item, paired with the host's `onAttachmentOpen`, drives\n * click-through to the artifact-card modal.\n */\n attachments?: import('./types').MessageAttachmentItem[]\n}\n\n/**\n * One attachment row above a sent user message. Mirrors `AttachmentItem` but\n * carries the persisted `artifactId` instead of an in-memory File reference,\n * since these refer to artifacts that already live in the project tree.\n */\nexport interface MessageAttachmentItem {\n /** Stable identifier for the chip (typically the upload or artifact id). */\n id: string\n /** Display name (filename from the original upload). */\n name: string\n /** MIME type — drives the chip icon and image-preview branch. */\n type: string\n /** File size in bytes, optional. */\n size?: number\n /** Pre-signed thumbnail URL for image previews, optional. */\n previewUrl?: string\n /** Backend artifact id; required for click-through to work. */\n artifactId?: string\n /**\n * Lifecycle state captured at message-build time. Defaults to `analyzed`\n * for the happy path. Set to `analysis_failed` to render a red chip on a\n * successfully-integrated message, or to a pre-integrate state on a\n * message whose integrate call failed.\n */\n status?: AttachmentStatus\n}\n\n/**\n * A checkpoint that anchors a chat position to a hypocaust task execution.\n * Clicking a checkpoint rewinds the artifact view (and the tree's active leaf)\n * to the project state at that execution. New tasks sent from this position\n * use the checkpoint's `taskExecutionId` as their predecessor.\n */\nexport interface CheckpointNode extends NodeTopology {\n kind: 'checkpoint'\n /** ID of the hypocaust task execution this checkpoint anchors to. */\n taskExecutionId: string\n /** Human-readable label, ≤ 50 chars, supplied by hypocaust. */\n name: string\n /**\n * What kind of project mutation produced this checkpoint.\n * - `task`: a Claude-driven task execution\n * - `submit`: a merge of a working branch into the project head\n * - `rename`: a manual artifact rename via the artifacts panel (planned)\n * - `init`: the project head at session start (seeded into new chats)\n * - `ingest`: a batch of user uploads committed to the project tree\n */\n executionKind: 'task' | 'submit' | 'rename' | 'init' | 'ingest'\n /** Terminal status reported by hypocaust. */\n status: 'completed' | 'failed' | 'cancelled'\n}\n\n/**\n * Discriminated union of every chat-tree node kind.\n *\n * Extend by adding a new `interface FooNode extends NodeTopology { kind: 'foo' ... }`\n * and joining it here. Every algorithm in `./tree.ts` will keep working without\n * change because it operates on `NodeTopology`, not on this union.\n */\nexport type ChatNode = MessageNode | CheckpointNode\n\n// ───────────────────────────────────────────────────────────────\n// Tree\n// ───────────────────────────────────────────────────────────────\n\n/**\n * A branching conversation tree.\n *\n * The path the user is currently viewing runs from a root through descendants\n * until it reaches `activeLeafId`. `lastLeafId` records the deepest leaf the\n * user has reached on the previously-active path; when `activeLeafId` is an\n * ancestor of `lastLeafId`, the nodes between them are the \"greyed future\"\n * (the timeline the user rewound away from but can still jump back into).\n */\nexport interface ConversationTree<T extends NodeTopology = ChatNode> {\n nodes: Record<string, TreeNode<T>>\n rootIds: string[]\n /** Leaf the user is currently viewing. Active path = root → here. */\n activeLeafId: string | null\n /**\n * Deepest leaf the user reached on the previously-active path. Equal to\n * `activeLeafId` whenever no rewind is in effect; cleared/reset by branch\n * switches and new node insertions.\n */\n lastLeafId: string | null\n}\n\n// ───────────────────────────────────────────────────────────────\n// Attachments\n// ───────────────────────────────────────────────────────────────\n\n/**\n * Attachment lifecycle, mirroring the per-file backend state machine:\n * upload → analyze, with separate failure modes for each phase.\n */\nexport type AttachmentStatus =\n | 'pending'\n | 'uploading'\n | 'uploaded'\n | 'analyzing'\n | 'analyzed'\n | 'upload_failed'\n | 'analysis_failed'\n\nexport interface Attachment {\n /**\n * Unique identifier for the attachment\n */\n id: string\n /**\n * The File object\n */\n file: File\n /**\n * Blob URL for image previews\n */\n previewUrl?: string\n /**\n * Current upload status\n */\n status: AttachmentStatus\n /**\n * Error message if status is an error variant\n */\n error?: string\n /**\n * Upload progress (0-100)\n */\n progress?: number\n /**\n * Backend artifact id, set once the batch is integrated. Drives chip\n * click-through to the artifact-card modal in the host app.\n */\n artifactId?: string\n}\n\n/**\n * Helper to check if a file is an image\n */\nexport function isImageFile(file: File): boolean {\n return file.type.startsWith('image/')\n}\n\n/**\n * Helper to create a preview URL for an image file\n */\nexport function createPreviewUrl(file: File): string | undefined {\n if (isImageFile(file)) {\n return URL.createObjectURL(file)\n }\n return undefined\n}\n\n/**\n * Helper to revoke a preview URL when no longer needed\n */\nexport function revokePreviewUrl(url: string | undefined): void {\n if (url) {\n URL.revokeObjectURL(url)\n }\n}\n\n/**\n * Generate a unique ID\n */\nexport function generateId(): string {\n if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {\n return crypto.randomUUID()\n }\n return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`\n}\n","import React, {useCallback, useEffect, useRef, useState} from 'react'\nimport {Image} from 'lucide-react'\nimport {cx} from '../../utils'\nimport {ArtifactCard} from '../ArtifactCard'\nimport {ArtifactGroup} from '../ArtifactGroup'\nimport {ArtifactVariantStack} from '../ArtifactVariantStack'\nimport {ArtifactLightboxBody, getArtifactLightboxCaption} from '../ArtifactLightboxBody'\nimport {CardSlotLoading} from '../Card'\nimport {Lightbox} from '../Lightbox'\nimport {ChevronRightIcon} from '../icons'\nimport type {Artifact} from './hooks'\nimport {useArtifactTreeNavigation} from './hooks'\nimport type {ArtifactNode} from '../ArtifactNode'\n\nconst ZOOM_LEVELS = [0.25, 0.5, 0.75, 1.0] as const\n\nexport interface ArtifactsPanelProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Top-level tree nodes to display in the navigable artifact tree.\n */\n nodes?: ArtifactNode[]\n /**\n * Whether artifacts are still loading (show skeletons)\n */\n loading?: CardSlotLoading\n /**\n * When set to a non-null id, surfaces the same expanded artifact card the\n * panel grid would. Drives chip click-through from outside the panel.\n * Pair with `onArtifactClosed` so the parent can clear its controller\n * state when the user dismisses the modal.\n */\n openArtifactId?: string | null\n /**\n * Called when the user closes the expanded card (X button or backdrop).\n * The parent owns whether subsequent renders re-open by re-supplying\n * `openArtifactId`.\n */\n onArtifactClosed?: () => void\n /**\n * Resolves the floating action cluster shown over the lightbox when an\n * artifact is opened. Switch on `artifact.type` and return the host-owned\n * buttons for that kind (e.g. Share + Download for deliverables, Download\n * for images). Aurelius ships the close affordance itself; return only the\n * kind-specific actions, or `null` when there are none. The `ctx.onClose`\n * helper lets actions dismiss the lightbox after a successful operation.\n */\n getArtifactActions?: (\n artifact: Artifact,\n ctx: {onClose: () => void},\n ) => React.ReactNode\n}\n\n/**\n * Resolve the lightbox host actions for an artifact via the panel-level\n * callback. Wrapped here so the JSX reads as a single component. When the\n * host provides nothing, the lightbox renders only its close affordance.\n */\nfunction ArtifactLightbox({\n artifact,\n onClose,\n getArtifactActions,\n}: {\n artifact: Artifact\n onClose: () => void\n getArtifactActions?: (\n artifact: Artifact,\n ctx: {onClose: () => void},\n ) => React.ReactNode\n}) {\n return (\n <Lightbox\n onClose={onClose}\n actions={getArtifactActions?.(artifact, {onClose})}\n caption={getArtifactLightboxCaption(artifact)}\n >\n <ArtifactLightboxBody artifact={artifact}/>\n </Lightbox>\n )\n}\n\n/**\n * Walk the artifact tree (including variant stacks and nested groups) to find\n * a leaf artifact by id. Returns null when no match exists in the current view.\n */\nfunction findArtifactInNodes(nodes: ArtifactNode[], artifactId: string): Artifact | null {\n for (const node of nodes) {\n if (node.type === 'ARTIFACT' && node.artifact?.id === artifactId) {\n return node.artifact\n }\n if (node.children && node.children.length > 0) {\n const found = findArtifactInNodes(node.children, artifactId)\n if (found) {\n return found\n }\n }\n }\n return null\n}\n\n/**\n * Renders a single node according to its type.\n */\nfunction NodeRenderer({\n node,\n loading,\n onExpandArtifact,\n onGroupClick,\n}: {\n node: ArtifactNode\n loading?: CardSlotLoading\n onExpandArtifact: (artifact: Artifact) => void\n onGroupClick: (node: ArtifactNode) => void\n}) {\n if (node.type === 'ARTIFACT' && node.artifact) {\n return (\n <ArtifactCard\n artifact={node.artifact}\n loading={loading}\n onExpand={onExpandArtifact}\n />\n )\n }\n\n if (node.type === 'GROUP') {\n return <ArtifactGroup node={node} onClick={onGroupClick}/>\n }\n\n if (node.type === 'VARIANT_SET') {\n return (\n <ArtifactVariantStack\n node={node}\n onExpandArtifact={onExpandArtifact}\n onGroupClick={onGroupClick}\n />\n )\n }\n\n return null\n}\n\n/**\n * ArtifactsPanel displays artifacts in a navigable tree panel.\n *\n * This is a content-only component — it fills whatever container it is\n * placed in. Opening/closing and resizing are handled by the parent\n * ToolPanelContainer and ToolSidebar.\n *\n * Groups can be entered (breadcrumb navigation) and artifact nodes\n * can be expanded to a full-screen modal.\n *\n * Supports zoom controls (0.25x–1x). Zoom uses CSS `transform: scale()`\n * on the content wrapper so the entire layout scales uniformly — cards,\n * images, gaps, and text all shrink as if the viewer is physically\n * moving back from the content.\n */\nexport const ArtifactsPanel = React.forwardRef<HTMLDivElement, ArtifactsPanelProps>(\n ({\n nodes,\n loading,\n openArtifactId,\n onArtifactClosed,\n getArtifactActions,\n className,\n ...rest\n }, ref) => {\n const [expandedArtifact, setExpandedArtifact] = useState<Artifact | null>(null)\n const [zoomIndex, setZoomIndex] = useState<number>(ZOOM_LEVELS.length - 1) // default 1.0\n\n const treeNav = useArtifactTreeNavigation(nodes || [])\n\n const hasNodes = !!nodes && nodes.length > 0\n\n const handleExpandArtifact = useCallback((artifact: Artifact) => {\n setExpandedArtifact(artifact)\n }, [])\n\n const handleGroupClick = useCallback((node: ArtifactNode) => {\n treeNav.navigateInto(node)\n }, [treeNav])\n\n // Controlled open: surfaces the expanded card when the parent supplies a\n // non-null `openArtifactId`. Pairs with `onArtifactClosed` round-trip so\n // re-clicking the same chip after a manual close re-opens the modal.\n useEffect(() => {\n if (!openArtifactId || !nodes) {\n return\n }\n const found = findArtifactInNodes(nodes, openArtifactId)\n if (found) {\n setExpandedArtifact(found)\n }\n }, [openArtifactId, nodes])\n\n const handleModalClose = useCallback(() => {\n setExpandedArtifact(null)\n onArtifactClosed?.()\n }, [onArtifactClosed])\n\n const zoomIn = useCallback(() => {\n setZoomIndex(prev => Math.min(prev + 1, ZOOM_LEVELS.length - 1))\n }, [])\n\n const zoomOut = useCallback(() => {\n setZoomIndex(prev => Math.max(prev - 1, 0))\n }, [])\n\n const currentZoom = ZOOM_LEVELS[zoomIndex]\n\n // Measure content height so the scroll container can shrink to match the scaled visual height\n const contentRef = useRef<HTMLDivElement>(null)\n const [contentHeight, setContentHeight] = useState<number | undefined>(undefined)\n\n useEffect(() => {\n const el = contentRef.current\n if (!el) {\n return\n }\n const observer = new ResizeObserver(([entry]) => {\n setContentHeight(entry.contentRect.height)\n })\n observer.observe(el)\n return () => observer.disconnect()\n }, [])\n\n return (\n <>\n <div\n ref={ref}\n data-testid=\"artifacts-panel\"\n className={cx(\n 'h-full flex flex-col relative',\n className\n )}\n {...rest}\n >\n {/* Header with title and zoom controls */}\n <div\n className=\"flex items-center justify-between p-4 border-b border-ash/40 shrink-0\">\n <h3 className=\"text-sm font-semibold text-white\">Artifacts</h3>\n {hasNodes && (\n <div\n className=\"flex items-center gap-0.5\"\n data-testid=\"zoom-controls\"\n >\n <button\n onClick={zoomOut}\n disabled={zoomIndex === 0}\n className={cx(\n 'w-6 h-6 flex items-center justify-center text-xs font-bold',\n 'bg-charcoal border border-ash/40',\n zoomIndex === 0\n ? 'text-silver/30 cursor-not-allowed'\n : 'text-silver hover:text-gold hover:border-gold/40 transition-colors',\n )}\n aria-label=\"Zoom out\"\n >\n −\n </button>\n <span className=\"text-xs text-silver w-8 text-center tabular-nums\"\n data-testid=\"zoom-level\">\n {Math.round(currentZoom * 100)}%\n </span>\n <button\n onClick={zoomIn}\n disabled={zoomIndex === ZOOM_LEVELS.length - 1}\n className={cx(\n 'w-6 h-6 flex items-center justify-center text-xs font-bold',\n 'bg-charcoal border border-ash/40',\n zoomIndex === ZOOM_LEVELS.length - 1\n ? 'text-silver/30 cursor-not-allowed'\n : 'text-silver hover:text-gold hover:border-gold/40 transition-colors',\n )}\n aria-label=\"Zoom in\"\n >\n +\n </button>\n </div>\n )}\n </div>\n\n {/* Breadcrumb trail (tree mode only, when not at root) */}\n {hasNodes && !treeNav.isAtRoot && (\n <nav\n className=\"flex items-center gap-1 px-4 py-2 border-b border-ash/40 shrink-0 overflow-x-auto text-xs\"\n aria-label=\"Breadcrumb\"\n data-testid=\"breadcrumb-nav\"\n >\n {treeNav.breadcrumbs.map((crumb, i) => {\n const isLast = i === treeNav.breadcrumbs.length - 1\n return (\n <span key={i} className=\"flex items-center gap-1 shrink-0\">\n {i > 0 && (\n <ChevronRightIcon className=\"w-3 h-3 text-silver/50\" aria-hidden/>\n )}\n {isLast ? (\n <span className=\"text-gold font-medium\">{crumb.label}</span>\n ) : (\n <button\n onClick={() => treeNav.navigateTo(i)}\n className=\"text-silver hover:text-white transition-colors\"\n >\n {crumb.label}\n </button>\n )}\n </span>\n )\n })}\n </nav>\n )}\n\n {/* Content area — single column, natural widths, scrollable */}\n <div\n className=\"flex-1 overflow-auto relative\"\n data-testid=\"artifacts-scroll-area\"\n >\n {/* Sizer div: collapses to the scaled height so scrollbar tracks correctly */}\n <div\n style={currentZoom !== 1 && contentHeight !== undefined\n ? {height: contentHeight * currentZoom}\n : undefined\n }\n >\n <div\n ref={contentRef}\n data-testid=\"artifacts-grid\"\n className=\"p-4 space-y-4\"\n style={currentZoom !== 1\n ? {\n transform: `scale(${currentZoom})`,\n transformOrigin: 'top center',\n }\n : undefined\n }\n >\n {treeNav.currentNodes.length === 0 ? (\n <p className=\"text-xs text-silver/60 text-center py-8\">\n {hasNodes ? 'Empty group' : 'No artifacts to display'}\n </p>\n ) : (\n treeNav.currentNodes.map((node) => (\n <NodeRenderer\n key={node.id}\n node={node}\n loading={loading}\n onExpandArtifact={handleExpandArtifact}\n onGroupClick={handleGroupClick}\n />\n ))\n )}\n </div>\n </div>\n </div>\n\n </div>\n\n {/* Lightbox for the expanded artifact */}\n {expandedArtifact && (\n <ArtifactLightbox\n artifact={expandedArtifact}\n onClose={handleModalClose}\n getArtifactActions={getArtifactActions}\n />\n )}\n </>\n )\n }\n)\n\nArtifactsPanel.displayName = 'ArtifactsPanel'\n\n/**\n * Toggle button to expand collapsed artifacts panel\n */\nexport interface ArtifactsPanelToggleProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n artifactCount?: number\n onExpand?: () => void\n}\n\nexport const ArtifactsPanelToggle = React.forwardRef<\n HTMLButtonElement,\n ArtifactsPanelToggleProps\n>(({artifactCount = 0, onExpand, className, ...rest}, ref) => {\n return (\n <button\n ref={ref}\n onClick={onExpand}\n className={cx(\n 'p-2',\n 'bg-charcoal/80 border border-ash/40',\n 'text-silver hover:text-white hover:bg-ash/20',\n 'transition-colors duration-150',\n 'flex items-center gap-2',\n 'relative',\n className\n )}\n aria-label=\"Expand artifacts panel\"\n {...rest}\n >\n <Image className=\"w-5 h-5\" aria-hidden/>\n {artifactCount > 0 && (\n <span\n className=\"absolute -top-1 -right-1 w-4 h-4 bg-gold text-obsidian text-xs font-medium flex items-center justify-center\">\n {artifactCount}\n </span>\n )}\n </button>\n )\n})\n\nArtifactsPanelToggle.displayName = 'ArtifactsPanelToggle'\n","import React from 'react'\nimport {type CardSlotLoading} from './Card'\nimport {ImageCard} from './ImageCard'\nimport {VideoCard} from './VideoCard'\nimport {AudioCard} from './AudioCard'\nimport {PdfCard} from './PdfCard'\nimport {ScriptCard, type ScriptElement} from './ScriptCard'\nimport {TextCard} from './TextCard'\nimport {DeliverableCard} from './DeliverableCard'\nimport type {Deliverable} from './deliverable'\nimport {ExpandIcon} from './icons'\nimport {cx} from '../utils'\nimport {deriveCardSlotLoading} from '../utils/artifactLoading'\n\n/**\n * Artifact types supported by the system\n */\nexport const ARTIFACT_TYPES = {\n TEXT: 'TEXT',\n IMAGE: 'IMAGE',\n VIDEO: 'VIDEO',\n AUDIO: 'AUDIO',\n SCRIPT: 'SCRIPT',\n PDF: 'PDF',\n DELIVERABLE: 'DELIVERABLE',\n} as const\n\nexport type ArtifactType = typeof ARTIFACT_TYPES[keyof typeof ARTIFACT_TYPES]\n\nexport interface Artifact {\n id: string\n type: ArtifactType\n /**\n * For text artifacts - the content (markdown, HTML, or plain text)\n */\n inlineContent?: string\n /**\n * For artifacts that source from a URL (image, video, audio, pdf, file)\n */\n url?: string\n /**\n * The mime type of the content\n */\n mimeType?: string\n /**\n * For image artifacts - alt text\n */\n alt?: string\n /**\n * Display title shown below the artifact\n */\n title?: string\n /**\n * Display subtitle shown below the title\n */\n subtitle?: string\n /**\n * Whether this artifact is still loading (shows skeleton)\n */\n isPending?: boolean\n /**\n * Whether the artifact should span full width in the grid\n */\n fullWidth?: boolean\n /**\n * For html artifacts - structured script elements (used by ScriptCard)\n */\n scriptElements?: ScriptElement[]\n /**\n * For deliverable artifacts - the resolved presentation spec, every artifact\n * reference already inflated. Rendered as a compact card that links to the\n * full DeliverableRenderer; surfaces the cover info and section count.\n */\n deliverable?: Deliverable\n}\n\nexport interface ArtifactCardProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * The artifact object to display\n */\n artifact: Artifact\n /**\n * Callback when the artifact should be expanded/opened\n */\n onExpand?: (artifact: Artifact) => void\n /**\n * Whether the artifact is still loading\n */\n loading?: CardSlotLoading\n}\n\n/**\n * A dispatcher component that renders the appropriate specialist card\n * based on the artifact type.\n */\nexport const ArtifactCard = React.forwardRef<HTMLDivElement, ArtifactCardProps>(\n ({artifact, onExpand, loading, className, ...props}, ref) => {\n const derivedLoading = deriveCardSlotLoading(artifact)\n const commonProps = {\n title: artifact.title,\n subtitle: artifact.subtitle,\n // `Artifact.id` is the addressable name (the @-handle) — surfacing\n // it on the card lets the filmmaker recognise the typed token in\n // chat. See `Card.Header.handle` for the rendering behaviour.\n handle: artifact.id,\n loading: loading || derivedLoading,\n className: 'w-full',\n }\n\n const handleExpand = (e: React.MouseEvent) => {\n e.stopPropagation()\n if (onExpand) {\n onExpand(artifact)\n }\n }\n\n const renderContent = () => {\n switch (artifact.type) {\n case 'IMAGE':\n return (\n <ImageCard\n {...commonProps}\n src={artifact.url}\n alt={artifact.alt}\n aspectRatio=\"landscape\"\n />\n )\n case 'VIDEO':\n return (\n <VideoCard\n {...commonProps}\n src={artifact.url}\n aspectRatio=\"video\"\n controls\n />\n )\n case 'AUDIO':\n return (\n <AudioCard\n {...commonProps}\n src={artifact.url}\n controls\n />\n )\n case 'PDF':\n return (\n <PdfCard\n {...commonProps}\n src={artifact.url}\n />\n )\n case 'SCRIPT':\n return (\n <ScriptCard\n {...commonProps}\n elements={artifact.scriptElements || []}\n maxHeight=\"16rem\"\n />\n )\n case 'TEXT':\n return (\n <TextCard\n {...commonProps}\n content={artifact.inlineContent || ''}\n isMarkdown={artifact.mimeType !== 'text/plain'}\n contentClassName={cx(\n artifact.mimeType === 'text/plain' && \"whitespace-pre-wrap\"\n )}\n />\n )\n case 'DELIVERABLE':\n return (\n <DeliverableCard\n {...commonProps}\n deliverable={artifact.deliverable}\n />\n )\n default: {\n // Exhaustiveness check — adding a new ArtifactType becomes a\n // compile error here rather than a silently dropped artifact.\n const _exhaustive: never = artifact.type\n return _exhaustive\n }\n }\n }\n\n // Determine if the card itself should be clickable to expand\n // Video and Audio have their own controls, so we only expand via the button\n const isCardExpandable = !!onExpand && (\n artifact.type === 'IMAGE' ||\n artifact.type === 'PDF' ||\n artifact.type === 'SCRIPT' ||\n artifact.type === 'TEXT' ||\n artifact.type === 'DELIVERABLE'\n )\n\n return (\n <div\n ref={ref}\n className={cx(\n 'relative group',\n isCardExpandable && 'cursor-pointer',\n artifact.fullWidth && 'col-span-full',\n className\n )}\n onClick={isCardExpandable ? handleExpand : undefined}\n {...props}\n >\n {onExpand && (\n <button\n onClick={handleExpand}\n className={cx(\n 'absolute top-2 right-2 z-10 p-1.5',\n 'bg-obsidian/80 text-silver hover:text-white hover:bg-obsidian',\n 'opacity-0 group-hover:opacity-100 transition-opacity'\n )}\n aria-label=\"Expand artifact\"\n >\n <ExpandIcon className=\"w-4 h-4\"/>\n </button>\n )}\n {renderContent()}\n </div>\n )\n }\n)\n\nArtifactCard.displayName = 'ArtifactCard'\n\nexport default ArtifactCard\n","import React from 'react'\nimport {Card, type CardProps, type CardSlotLoading} from './Card'\nimport {cx} from '../utils'\n\nexport type AspectRatioPreset = 'landscape' | 'portrait' | 'square'\nexport type AspectRatio = AspectRatioPreset | `${number}/${number}`\n\nexport interface ImageCardProps extends Omit<CardProps, 'title'> {\n src?: string\n alt?: string\n title?: React.ReactNode\n subtitle?: React.ReactNode\n /** The artifact's `@-handle` — see `Card.Header.handle`. */\n handle?: string\n aspectRatio?: AspectRatio\n objectFit?: 'cover' | 'contain'\n overlay?: React.ReactNode\n mediaClassName?: string\n contentClassName?: string\n loading?: CardSlotLoading\n}\n\nconst ASPECT_RATIO_PRESETS: Record<AspectRatioPreset, string> = {\n landscape: '3 / 2',\n portrait: '2 / 3',\n square: '1 / 1',\n}\n\nfunction resolveAspectRatio(ratio: AspectRatio): string {\n if (ratio in ASPECT_RATIO_PRESETS) {\n return ASPECT_RATIO_PRESETS[ratio as AspectRatioPreset]\n }\n return ratio.replace('/', ' / ')\n}\n\nexport const ImageCard = React.forwardRef<HTMLDivElement, ImageCardProps>(\n (\n {\n src,\n alt = '',\n title,\n subtitle,\n handle,\n aspectRatio = 'landscape',\n objectFit = 'cover',\n overlay,\n mediaClassName,\n contentClassName,\n className,\n children,\n loading,\n ...props\n },\n ref\n ) => {\n return (\n <Card\n ref={ref}\n className={cx('p-0 overflow-hidden w-full', className)}\n loading={loading}\n {...props}\n >\n <Card.Media\n className={mediaClassName}\n style={{aspectRatio: resolveAspectRatio(aspectRatio)}}\n >\n <>\n {src && (\n <img\n src={src}\n alt={alt}\n className={cx(\n 'w-full h-full',\n objectFit === 'cover' ? 'object-cover' : 'object-contain'\n )}\n />\n )}\n {overlay && (\n <div\n className=\"absolute inset-0 bg-obsidian/80 opacity-0 group-hover:opacity-100 transition-opacity duration-200 flex items-center justify-center\">\n {overlay}\n </div>\n )}\n </>\n </Card.Media>\n <Card.Header\n title={title}\n subtitle={subtitle}\n handle={handle}\n className={contentClassName}\n />\n {children && <Card.Body className={contentClassName}>{children}</Card.Body>}\n </Card>\n )\n }\n)\n\nImageCard.displayName = 'ImageCard'","import React from 'react'\nimport ReactPlayer from 'react-player'\nimport {Card, type CardProps, type CardSlotLoading} from './Card'\nimport {cx} from '../utils'\n\ntype ReactPlayerProps = React.ComponentProps<typeof ReactPlayer>\n\nexport type VideoAspectRatioPreset = 'video' | 'cinema' | 'square'\nexport type VideoAspectRatio = VideoAspectRatioPreset | `${number}/${number}`\n\nexport interface VideoCardProps extends Omit<CardProps, 'title'> {\n src?: string\n title?: React.ReactNode\n subtitle?: React.ReactNode\n /** The artifact's `@-handle` — see `Card.Header.handle`. */\n handle?: string\n aspectRatio?: VideoAspectRatio\n playing?: boolean\n controls?: boolean\n light?: boolean | string\n volume?: number\n muted?: boolean\n loop?: boolean\n mediaClassName?: string\n contentClassName?: string\n /** Forwarded to the underlying ReactPlayer. */\n playerProps?: Partial<ReactPlayerProps>\n loading?: CardSlotLoading\n}\n\nconst ASPECT_RATIO_PRESETS: Record<VideoAspectRatioPreset, string> = {\n video: '16 / 9',\n cinema: '21 / 9',\n square: '1 / 1',\n}\n\nfunction resolveAspectRatio(ratio: VideoAspectRatio): string {\n if (ratio in ASPECT_RATIO_PRESETS) {\n return ASPECT_RATIO_PRESETS[ratio as VideoAspectRatioPreset]\n }\n return ratio.replace('/', ' / ')\n}\n\nexport const VideoCard = React.forwardRef<HTMLDivElement, VideoCardProps>(\n (\n {\n src,\n title,\n subtitle,\n handle,\n aspectRatio = 'video',\n playing = false,\n controls = true,\n light = false,\n volume,\n muted = false,\n loop = false,\n mediaClassName,\n contentClassName,\n className,\n children,\n playerProps,\n loading,\n ...props\n },\n ref\n ) => {\n return (\n <Card\n ref={ref}\n className={cx('p-0 overflow-hidden w-full', className)}\n loading={loading}\n {...props}\n >\n <Card.Media\n className={mediaClassName}\n style={{aspectRatio: resolveAspectRatio(aspectRatio)}}\n >\n {src && (\n <ReactPlayer\n src={src}\n playing={playing}\n controls={controls}\n light={light}\n volume={volume}\n muted={muted}\n loop={loop}\n width=\"100%\"\n height=\"100%\"\n className=\"absolute top-0 left-0\"\n {...playerProps}\n />\n )}\n </Card.Media>\n <Card.Header\n title={title}\n subtitle={subtitle}\n handle={handle}\n className={contentClassName}\n />\n {children && <Card.Body className={contentClassName}>{children}</Card.Body>}\n </Card>\n )\n }\n)\n\nVideoCard.displayName = 'VideoCard'\n","import React from 'react'\nimport ReactPlayer from 'react-player'\nimport {Music} from 'lucide-react'\nimport {Card, type CardProps, type CardSlotLoading} from './Card'\nimport {cx} from '../utils'\n\ntype ReactPlayerProps = React.ComponentProps<typeof ReactPlayer>\n\nexport interface AudioCardProps extends Omit<CardProps, 'title'> {\n src?: string\n title?: React.ReactNode\n subtitle?: React.ReactNode\n /** The artifact's `@-handle` — see `Card.Header.handle`. */\n handle?: string\n playing?: boolean\n controls?: boolean\n volume?: number\n muted?: boolean\n loop?: boolean\n mediaClassName?: string\n contentClassName?: string\n /** Forwarded to the underlying ReactPlayer. */\n playerProps?: Partial<ReactPlayerProps>\n height?: string | number\n loading?: CardSlotLoading\n}\n\nexport const AudioCard = React.forwardRef<HTMLDivElement, AudioCardProps>(\n (\n {\n src,\n title,\n subtitle,\n handle,\n playing = false,\n controls = true,\n volume,\n muted = false,\n loop = false,\n mediaClassName,\n contentClassName,\n className,\n children,\n playerProps,\n height = '40px',\n loading,\n ...props\n },\n ref\n ) => {\n return (\n <Card\n ref={ref}\n className={cx('p-0 overflow-hidden w-full', className)}\n loading={loading}\n {...props}\n >\n <Card.Media className={cx('bg-obsidian py-8 flex flex-col items-center justify-center',\n mediaClassName)}>\n <div className=\"mb-4 text-gold\">\n <Music size={48}/>\n </div>\n\n {src && (\n <div className=\"w-full px-4\">\n <ReactPlayer\n src={src}\n playing={playing}\n controls={controls}\n volume={volume}\n muted={muted}\n loop={loop}\n width=\"100%\"\n height={height}\n style={{backgroundColor: 'transparent', width: '100%', height}}\n {...playerProps}\n />\n </div>\n )}\n </Card.Media>\n <Card.Header\n title={title}\n subtitle={subtitle}\n handle={handle}\n className={contentClassName}\n />\n {children && <Card.Body className={contentClassName}>{children}</Card.Body>}\n </Card>\n )\n }\n)\n\nAudioCard.displayName = 'AudioCard'\n","import React from 'react'\nimport {FileText} from 'lucide-react'\nimport {Card, type CardProps, type CardSlotLoading} from './Card'\nimport {cx} from '../utils'\n\nexport interface PdfCardProps extends Omit<CardProps, 'title'> {\n /**\n * URL of the PDF file\n */\n src?: string\n /**\n * Title of the document\n */\n title?: React.ReactNode\n /**\n * Subtitle or document metadata\n */\n subtitle?: React.ReactNode\n /** The artifact's `@-handle` — see `Card.Header.handle`. */\n handle?: string\n /**\n * Height of the PDF viewer\n */\n height?: string | number\n /**\n * Optional class name for the media container\n */\n mediaClassName?: string\n /**\n * Optional class name for the content container\n */\n contentClassName?: string\n loading?: CardSlotLoading\n}\n\n/**\n * A card for displaying PDF documents with an embedded viewer.\n */\nexport const PdfCard = React.forwardRef<HTMLDivElement, PdfCardProps>(\n (\n {\n src,\n title,\n subtitle,\n handle,\n height = '400px',\n mediaClassName,\n contentClassName,\n className,\n children,\n loading,\n ...props\n },\n ref\n ) => {\n return (\n <Card\n ref={ref}\n className={cx('p-0 overflow-hidden w-full', className)}\n loading={loading}\n {...props}\n >\n <Card.Media\n className={cx('bg-obsidian', mediaClassName)}\n style={{height}}\n >\n {src && (\n <iframe\n src={`${src}#view=FitH`}\n title={typeof title === 'string' ? title : 'PDF Document'}\n className=\"w-full h-full border-0\"\n />\n )}\n </Card.Media>\n <Card.Header\n title={title}\n subtitle={subtitle}\n handle={handle}\n className={contentClassName}\n action={\n <div className=\"p-2 bg-ash/20 text-gold shrink-0\">\n <FileText size={20}/>\n </div>\n }\n />\n {children && <Card.Body className={contentClassName}>{children}</Card.Body>}\n </Card>\n )\n }\n)\n\nPdfCard.displayName = 'PdfCard'\n","import React from 'react'\nimport {cx} from '../utils'\n\nimport {Card, type CardProps, type CardSlotLoading} from './Card'\n\n/**\n * Script element types following standard screenplay format\n */\nexport const SCRIPT_ELEMENT_TYPES = {\n SCENE_HEADING: 'scene-heading',\n ACTION: 'action',\n CHARACTER: 'character',\n DIALOGUE: 'dialogue',\n PARENTHETICAL: 'parenthetical',\n TRANSITION: 'transition',\n TITLE: 'title',\n SUBTITLE: 'subtitle',\n} as const\n\nexport type ScriptElementType = typeof SCRIPT_ELEMENT_TYPES[keyof typeof SCRIPT_ELEMENT_TYPES]\n\n/**\n * A single element in the script\n */\nexport interface ScriptElement {\n /**\n * The type of script element (e.g., 'scene-heading', 'character', 'dialogue')\n */\n type: ScriptElementType\n /**\n * The text content of the element\n */\n content: string\n}\n\nexport interface ScriptCardProps extends Omit<CardProps, 'title'> {\n /**\n * Title of the script (shown at top)\n */\n title?: React.ReactNode\n /**\n * Subtitle/metadata (e.g., \"30-second spot • Directed by AI Creative\")\n */\n subtitle?: React.ReactNode\n /** The artifact's `@-handle` — see `Card.Header.handle`. */\n handle?: string\n /**\n * Array of script elements in order.\n * Available types: 'scene-heading', 'action', 'character', 'dialogue', 'parenthetical',\n * 'transition', 'title', 'subtitle'\n */\n elements: ScriptElement[]\n /**\n * Maximum height before scrolling (default: 16rem / 256px)\n */\n maxHeight?: string\n loading?: CardSlotLoading\n}\n\n/**\n * Render a script element with proper formatting\n */\nfunction ScriptElementRenderer({element}: { element: ScriptElement }) {\n switch (element.type) {\n case 'scene-heading':\n return (\n <p className=\"mt-4 mb-2 font-bold uppercase text-gold text-xs tracking-wide\">\n {element.content}\n </p>\n )\n\n case 'action':\n return (\n <p className=\"my-2 text-silver text-xs leading-relaxed\">\n {element.content}\n </p>\n )\n\n case 'character':\n return (\n <p className=\"mt-4 mb-0.5 ml-8 font-bold text-white text-xs uppercase tracking-wide\">\n {element.content}\n </p>\n )\n\n case 'parenthetical':\n return (\n <p className=\"ml-6 text-silver/70 text-xs italic\">\n ({element.content})\n </p>\n )\n\n case 'dialogue':\n return (\n <p className=\"ml-4 mr-8 text-silver text-xs leading-relaxed\">\n {element.content}\n </p>\n )\n\n case 'transition':\n return (\n <p className=\"mt-4 mb-2 text-right font-bold uppercase text-gold/80 text-xs tracking-wide\">\n {element.content}\n </p>\n )\n\n case 'title':\n return (\n <p className=\"mt-6 mb-2 text-center font-bold text-gold text-sm\">\n {element.content}\n </p>\n )\n\n case 'subtitle':\n return (\n <p className=\"text-center italic text-gold/70 text-xs\">\n {element.content}\n </p>\n )\n\n default:\n return null\n }\n}\n\n/**\n * ScriptCard displays a formatted movie/video script.\n *\n * Follows standard screenplay formatting conventions:\n * - Scene headings: uppercase, gold, left-aligned\n * - Action: silver, full width\n * - Character names: uppercase, centered-left\n * - Dialogue: indented from both sides\n * - Transitions: uppercase, right-aligned\n *\n * @example\n * ```tsx\n * <ScriptCard\n * title=\"The Arrival\"\n * elements={[\n * { type: 'scene-heading', content: 'EXT. SPACE STATION - NIGHT' },\n * { type: 'action', content: 'A lone ship approaches the docking bay.' },\n * { type: 'character', content: 'PILOT' },\n * { type: 'dialogue', content: 'Requesting permission to land.' }\n * ]}\n * />\n * ```\n */\nexport const ScriptCard = React.forwardRef<HTMLDivElement, ScriptCardProps>(\n ({title, subtitle, handle, elements, maxHeight = '16rem', className, style, loading, ...rest},\n ref) => {\n return (\n <Card\n ref={ref}\n className={cx('p-0 overflow-hidden w-full', className)}\n loading={loading}\n {...rest}\n >\n <Card.Header\n title={title}\n subtitle={subtitle}\n handle={handle}\n />\n <Card.Body\n className=\"font-mono overflow-y-auto\"\n style={{maxHeight, ...style}}\n >\n {elements.map((element, index) => (\n <ScriptElementRenderer key={index} element={element}/>\n ))}\n </Card.Body>\n </Card>\n )\n }\n)\n\nScriptCard.displayName = 'ScriptCard'\n\nexport default ScriptCard\n","import React from 'react'\nimport {Card, type CardProps, type CardSlotLoading} from './Card'\nimport {MarkdownContent} from './MarkdownContent'\nimport {cx} from '../utils'\n\nexport interface TextCardProps extends Omit<CardProps, 'title'> {\n /**\n * Text content to display (Markdown, HTML, or plain text)\n */\n content: string\n /**\n * Optional title for the card\n */\n title?: React.ReactNode\n /**\n * Optional subtitle or metadata\n */\n subtitle?: React.ReactNode\n /** The artifact's `@-handle` — see `Card.Header.handle`. */\n handle?: string\n /**\n * Whether the content should be treated as Markdown\n * @default true\n */\n isMarkdown?: boolean\n /**\n * Maximum height of the content area before scrolling\n * @default '16rem'\n */\n maxHeight?: string | number\n /**\n * Optional class name for the content container\n */\n contentClassName?: string\n loading?: CardSlotLoading\n}\n\n/**\n * A card for displaying text content, supporting Markdown and HTML formatting.\n */\nexport const TextCard = React.forwardRef<HTMLDivElement, TextCardProps>(\n (\n {\n content,\n title,\n subtitle,\n handle,\n isMarkdown = true,\n maxHeight = '16rem',\n contentClassName,\n className,\n loading,\n ...props\n },\n ref\n ) => {\n return (\n <Card\n ref={ref}\n className={cx('p-0 overflow-hidden w-full', className)}\n loading={loading}\n {...props}\n >\n <Card.Header\n title={title}\n subtitle={subtitle}\n handle={handle}\n />\n <Card.Body\n className={cx('overflow-y-auto', contentClassName)}\n style={{maxHeight}}\n >\n <MarkdownContent\n content={content}\n isMarkdown={isMarkdown}\n className=\"prose-sm prose-invert max-w-none\"\n />\n </Card.Body>\n </Card>\n )\n }\n)\n\nTextCard.displayName = 'TextCard'\n\nexport default TextCard\n","import React from 'react'\nimport {Card, type CardProps, type CardSlotLoading} from './Card'\nimport {cx} from '../utils'\nimport type {Deliverable} from './deliverable'\n\nexport interface DeliverableCardProps extends Omit<CardProps, 'title'> {\n /**\n * Resolved deliverable spec — every artifact reference already inflated.\n * Same shape the full DeliverableRenderer accepts.\n */\n deliverable?: Deliverable\n /** Optional override for the cover title (otherwise derived from the spec). */\n title?: React.ReactNode\n /** Optional subtitle shown below the title. */\n subtitle?: React.ReactNode\n /** The artifact's `@-handle` — see `Card.Header.handle`. */\n handle?: string\n loading?: CardSlotLoading\n}\n\n/**\n * Compact preview of a deliverable for surfaces that can't host the full\n * multi-page renderer (chat tree, artifact lists). Surfaces the deliverable's\n * cover info plus its section count. The whole card is clickable — the\n * affordance is the same expand-icon overlay that {@link ArtifactCard} shows\n * for every artifact kind, so we don't add a \"Open preview\" lure here.\n */\nexport const DeliverableCard = React.forwardRef<HTMLDivElement, DeliverableCardProps>(\n (\n {\n deliverable,\n title,\n subtitle,\n handle,\n className,\n loading,\n ...props\n },\n ref,\n ) => {\n const cover = deliverable?.sections.find(\n (s): s is Extract<typeof s, { type: 'COVER' }> => s.type === 'COVER',\n )\n const eyebrow = cover?.eyebrow\n const headline = title ?? cover?.title ?? deliverable?.title\n const tagline = subtitle ?? cover?.subtitle ?? deliverable?.subtitle\n const accent = deliverable?.accentColor?.trim()\n const style = accent\n ? ({'--deliverable-accent': accent} as React.CSSProperties)\n : undefined\n const sectionCount = deliverable?.sections.length ?? 0\n\n return (\n <Card\n ref={ref}\n variant=\"outlined\"\n interactive\n loading={loading}\n className={cx('deliverable-card overflow-hidden w-full', className)}\n style={style}\n {...props}\n >\n <div className=\"deliverable-card-cover\">\n {eyebrow && (\n <p className=\"deliverable-card-eyebrow\">{eyebrow}</p>\n )}\n {headline && (\n <p className=\"deliverable-card-title\">{headline}</p>\n )}\n {tagline && (\n <p className=\"deliverable-card-subtitle\">{tagline}</p>\n )}\n </div>\n <div className=\"deliverable-card-meta flex items-center justify-between\">\n <span>\n {sectionCount} {sectionCount === 1 ? 'section' : 'sections'}\n </span>\n {handle && <Card.Handle handle={handle}/>}\n </div>\n </Card>\n )\n },\n)\n\nDeliverableCard.displayName = 'DeliverableCard'\n","import {Artifact} from '../components'\nimport {CardSlotLoading} from '../components/Card'\n\n/**\n * Centralized policy to derive which card slots should show skeletons\n * based on the artifact's current state and pending status.\n */\nexport function deriveCardSlotLoading(a: Artifact): CardSlotLoading | undefined {\n if (!a.isPending) {\n return undefined\n }\n\n const header = {\n title: !a.title,\n subtitle: !a.subtitle,\n }\n\n const mediaNeeded = (type: string) => ['IMAGE', 'VIDEO', 'AUDIO', 'PDF'].includes(type)\n const media = mediaNeeded(a.type) && !a.url\n\n const body = (\n (a.type === 'TEXT' && !(a.inlineContent && a.inlineContent.trim().length)) ||\n (a.type === 'SCRIPT' && !(a.scriptElements && a.scriptElements.length > 0))\n )\n\n return {header, media, body}\n}\n","import React, {useEffect, useRef, useState} from 'react'\nimport {cx} from '../utils'\nimport {type ArtifactNode} from './ArtifactNode'\nimport {ArtifactCard} from './ArtifactCard'\nimport {Card} from './Card'\n\nexport interface ArtifactGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'> {\n /**\n * The GROUP node to display\n */\n node: ArtifactNode\n /**\n * Called when the group is clicked (e.g. to navigate into it)\n */\n onClick?: (node: ArtifactNode) => void\n}\n\n// Fixed offset for each layer behind the front card\nconst LAYER_OFFSET = '8px'\nconst LAYER_OFFSET_2X = '16px'\n\n/**\n * Renders a GROUP node as a Card with the group label as title. Inside,\n * the first child is shown on top with two offset layers behind it\n * (always shown as a visual symbol for \"group\"). A square count badge\n * shows the total items.\n */\nexport const ArtifactGroup = React.forwardRef<HTMLDivElement, ArtifactGroupProps>(\n ({node, onClick, className, ...props}, ref) => {\n const children = node.children\n const count = children.length\n const frontChild = children[0]\n\n // Detect count changes and trigger badge animation\n const prevCountRef = useRef(count)\n const [badgePing, setBadgePing] = useState(false)\n\n useEffect(() => {\n if (count !== prevCountRef.current) {\n prevCountRef.current = count\n setBadgePing(true)\n const timer = setTimeout(() => setBadgePing(false), 500)\n return () => clearTimeout(timer)\n }\n }, [count])\n\n const handleClick = () => {\n if (onClick) {\n onClick(node)\n }\n }\n\n const renderFrontContent = () => {\n if (!frontChild) {\n return (\n <div className=\"w-full aspect-video bg-graphite border border-ash/40 flex items-center justify-center\">\n <span className=\"text-silver text-sm\">Empty group</span>\n </div>\n )\n }\n\n if (frontChild.type === 'ARTIFACT' && frontChild.artifact) {\n return <ArtifactCard artifact={frontChild.artifact} className=\"w-full\"/>\n }\n\n // For nested groups or variant sets, show a label card\n return (\n <div\n className=\"w-full aspect-video bg-graphite border border-gold/30 flex flex-col items-center justify-center gap-2 p-4\">\n <span className=\"text-sm text-silver uppercase tracking-wider\">\n {frontChild.type === 'GROUP' ? 'Group' : 'Variants'}\n </span>\n <span className=\"text-white font-semibold\">{frontChild.label}</span>\n </div>\n )\n }\n\n return (\n <div\n ref={ref}\n className={cx(\n 'cursor-pointer group',\n className\n )}\n onClick={handleClick}\n role=\"button\"\n tabIndex={0}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n handleClick()\n }\n }}\n aria-label={`${node.label} — ${count} items`}\n {...props}\n >\n <Card noPadding className=\"p-5\">\n <h3 className=\"text-lg font-semibold text-white m-0 mb-4\">{node.label}</h3>\n {/* Outer wrapper reserves space for the offset layers */}\n <div style={{paddingRight: LAYER_OFFSET_2X, paddingBottom: LAYER_OFFSET_2X}}>\n <div className=\"relative\">\n {/* Back layer */}\n <div\n className=\"absolute inset-0 bg-charcoal border border-ash/30 pointer-events-none\"\n style={{transform: `translate(${LAYER_OFFSET_2X}, ${LAYER_OFFSET_2X})`}}\n aria-hidden=\"true\"\n />\n\n {/* Middle layer */}\n <div\n className=\"absolute inset-0 bg-charcoal border border-ash/40 pointer-events-none\"\n style={{transform: `translate(${LAYER_OFFSET}, ${LAYER_OFFSET})`}}\n aria-hidden=\"true\"\n />\n\n {/* Front card */}\n <div className=\"relative transition-transform duration-200 group-hover:-translate-y-0.5\">\n {renderFrontContent()}\n </div>\n\n {/* Count badge — square */}\n <div\n className=\"absolute -top-2 -right-2 z-10 min-w-6 h-6 px-1.5 flex items-center justify-center bg-gold text-obsidian text-xs font-bold\"\n style={badgePing ? {animation: 'badge-invert 0.6s ease-in-out'} : undefined}\n >\n {count}\n </div>\n </div>\n </div>\n </Card>\n </div>\n )\n }\n)\n\nArtifactGroup.displayName = 'ArtifactGroup'\n\nexport default ArtifactGroup\n","import React from 'react'\nimport {cx} from '../utils'\nimport {type Artifact} from './ArtifactCard'\nimport {type ArtifactNode} from './ArtifactNode'\nimport {ArtifactCard} from './ArtifactCard'\nimport {ArtifactGroup} from './ArtifactGroup'\nimport {Card} from './Card'\n\nexport interface ArtifactVariantStackProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * The VARIANT_SET node to display\n */\n node: ArtifactNode\n /**\n * Passed through to ArtifactCard children for expand/open behavior\n */\n onExpandArtifact?: (artifact: Artifact) => void\n /**\n * Passed through to ArtifactGroup children for navigation\n */\n onGroupClick?: (node: ArtifactNode) => void\n}\n\n/**\n * Renders a VARIANT_SET node as a Card with the set label as title.\n * Children are displayed in a horizontal row inside the card body.\n * Children handle their own click behavior (expand for artifacts,\n * navigate for groups).\n */\nexport const ArtifactVariantStack = React.forwardRef<HTMLDivElement, ArtifactVariantStackProps>(\n ({node, onExpandArtifact, onGroupClick, className, ...props}, ref) => {\n const children = node.children\n\n const renderChild = (child: ArtifactNode) => {\n if (child.type === 'ARTIFACT' && child.artifact) {\n return (\n <div key={child.id} className=\"flex-1 min-w-0\">\n <ArtifactCard\n artifact={child.artifact}\n onExpand={onExpandArtifact}\n className=\"w-full\"\n />\n </div>\n )\n }\n\n if (child.type === 'GROUP') {\n return (\n <div key={child.id} className=\"flex-1 min-w-0\">\n <ArtifactGroup node={child} onClick={onGroupClick}/>\n </div>\n )\n }\n\n // Nested variant set placeholder\n return (\n <div key={child.id} className=\"flex-1 min-w-0\">\n <div\n className=\"aspect-video bg-graphite border border-gold/30 flex flex-col items-center justify-center gap-2 p-4\">\n <span className=\"text-xs text-silver uppercase tracking-wider\">Variants</span>\n <span className=\"text-sm text-white font-semibold truncate max-w-full\">\n {child.label}\n </span>\n </div>\n </div>\n )\n }\n\n return (\n <Card\n ref={ref}\n noPadding\n className={cx('w-full p-5', className)}\n {...props}\n >\n <h3 className=\"text-lg font-semibold text-white m-0 mb-4\">{node.label}</h3>\n <div className=\"flex gap-3\">\n {children.map(renderChild)}\n </div>\n </Card>\n )\n }\n)\n\nArtifactVariantStack.displayName = 'ArtifactVariantStack'\n\nexport default ArtifactVariantStack\n","import React from 'react'\nimport {ARTIFACT_TYPES, type Artifact, ArtifactCard} from './ArtifactCard'\nimport {DeliverableRenderer} from './deliverable/DeliverableRenderer'\n\nexport interface ArtifactLightboxBodyProps {\n artifact: Artifact\n}\n\n/**\n * Picks the bare body for an artifact when displayed inside a {@link Lightbox}.\n *\n * Each kind decides its own internal layout — an image aspect-fits the canvas,\n * a deliverable scrolls full-bleed, and so on. Crucially, none of these wrap\n * themselves in another Card frame: the lightbox already provides the canvas,\n * and a card-inside-modal produces the nested-frame look that signals \"cheap\n * generic container.\" Kinds that don't yet have a dedicated bare body fall\n * back to {@link ArtifactCard} — adequate, but the stack-of-frames feel is the\n * thing to fix next when those kinds matter.\n *\n * Callers don't choose the body explicitly; the registry dispatches by\n * `artifact.type`. To add a kind, extend the switch — never branch on type at\n * the call site.\n */\nexport function ArtifactLightboxBody({artifact}: ArtifactLightboxBodyProps) {\n switch (artifact.type) {\n case ARTIFACT_TYPES.DELIVERABLE: {\n if (!artifact.deliverable) {\n return <ArtifactCard artifact={artifact}/>\n }\n return (\n <div className=\"w-full h-full overflow-auto\">\n <DeliverableRenderer\n deliverable={artifact.deliverable}\n hideActions\n />\n </div>\n )\n }\n\n case ARTIFACT_TYPES.IMAGE: {\n if (!artifact.url) {\n return <ArtifactCard artifact={artifact}/>\n }\n return (\n <img\n src={artifact.url}\n alt={artifact.alt ?? artifact.title ?? ''}\n className=\"max-w-full max-h-full object-contain\"\n />\n )\n }\n\n case ARTIFACT_TYPES.VIDEO: {\n if (!artifact.url) {\n return <ArtifactCard artifact={artifact}/>\n }\n return (\n <video\n src={artifact.url}\n controls\n className=\"max-w-full max-h-full object-contain bg-void\"\n />\n )\n }\n\n case ARTIFACT_TYPES.AUDIO: {\n if (!artifact.url) {\n return <ArtifactCard artifact={artifact}/>\n }\n return (\n <audio\n src={artifact.url}\n controls\n className=\"w-full max-w-2xl\"\n />\n )\n }\n\n default:\n // PDF, TEXT, SCRIPT — fall back to the panel-grid card for now. They\n // don't currently feel cheap inside a lightbox the way image and\n // deliverable did, so the bare-body work is deferred until they matter.\n return <ArtifactCard artifact={artifact}/>\n }\n}\n\n/**\n * Builds the optional caption shown bottom-centre over the lightbox backdrop.\n * Title/subtitle are repeated from the panel-grid card so the user keeps\n * orientation when the body is bare media. Returns `null` when nothing useful\n * is available — the lightbox then renders no caption row.\n */\nexport function getArtifactLightboxCaption(artifact: Artifact): React.ReactNode {\n // Deliverables surface their own cover inside the renderer; an outer caption\n // would duplicate it.\n if (artifact.type === ARTIFACT_TYPES.DELIVERABLE) {\n return null\n }\n if (!artifact.title && !artifact.subtitle) {\n return null\n }\n return (\n <div className=\"inline-flex flex-col items-center gap-1 px-4 py-2 bg-charcoal/70 backdrop-blur border border-ash/40\">\n {artifact.title && (\n <p className=\"text-xs uppercase tracking-wider text-silver\">\n {artifact.title}\n </p>\n )}\n {artifact.subtitle && (\n <p className=\"text-xs text-silver/70\">{artifact.subtitle}</p>\n )}\n </div>\n )\n}\n","import React, {useState} from 'react'\nimport {Button} from '../Button'\nimport {cx} from '../../utils'\nimport type {Deliverable, DeliverableSection} from './types'\nimport {CoverSection} from './CoverSection'\nimport {ArtifactImageGridSection} from './ArtifactImageGridSection'\nimport {ArtifactSpotlightSection} from './ArtifactSpotlightSection'\nimport {TextBlockSection} from './TextBlockSection'\nimport {ColorPaletteSection} from './ColorPaletteSection'\nimport {QuoteBlockSection} from './QuoteBlockSection'\n\nexport interface DeliverableRendererProps {\n /** Resolved deliverable spec — every artifact reference already inflated. */\n deliverable: Deliverable\n /**\n * Called when the viewer requests a PDF download. The host application is\n * responsible for fetching and triggering the file save (the URL knows\n * about share tokens and credentials we don't). When omitted, the download\n * affordance is hidden.\n */\n onDownloadPdf?: () => void | Promise<void>\n /** Hide the floating action bar entirely. Used when rendering for print. */\n hideActions?: boolean\n className?: string\n}\n\n/**\n * Render a presentable deliverable (moodboard, pitch deck) from a structured\n * spec. The same component drives the on-screen view and the print/PDF\n * version — `@media print` styles in `aurelius/styles/base.css` keep them in\n * sync. To produce a PDF, drive the page with headless Chromium and let the\n * print stylesheet do the work.\n *\n * The renderer is purely presentational: it takes a fully resolved spec\n * (artifact URLs already inflated by the caller) and dispatches each section\n * to its typed sub-renderer. Unknown section types are skipped silently\n * forward-compat for new section variants added by the backend.\n */\nexport function DeliverableRenderer({\n deliverable,\n onDownloadPdf,\n hideActions = false,\n className,\n}: DeliverableRendererProps) {\n const [isDownloading, setIsDownloading] = useState(false)\n\n const accent = deliverable.accentColor?.trim()\n const style = accent\n ? ({'--deliverable-accent': accent} as React.CSSProperties)\n : undefined\n\n const handleDownload = async () => {\n if (!onDownloadPdf || isDownloading) return\n setIsDownloading(true)\n try {\n await onDownloadPdf()\n } finally {\n setIsDownloading(false)\n }\n }\n\n return (\n <div\n className={cx('deliverable', className)}\n style={style}\n >\n {deliverable.sections.map((section, idx) =>\n renderSection(section, idx, deliverable))}\n\n {!hideActions && onDownloadPdf && (\n <div className=\"deliverable-actions\">\n <Button\n variant=\"important\"\n size=\"md\"\n onClick={handleDownload}\n loading={isDownloading}\n className=\"deliverable-action-button\"\n >\n Download PDF\n </Button>\n </div>\n )}\n </div>\n )\n}\n\nfunction renderSection(\n section: DeliverableSection,\n idx: number,\n doc: Deliverable,\n): React.ReactNode {\n const key = `${section.type}-${idx}`\n switch (section.type) {\n case 'COVER':\n return (\n <CoverSection\n key={key}\n data={section}\n clientName={doc.clientName}\n />\n )\n case 'ARTIFACT_IMAGE_GRID':\n return <ArtifactImageGridSection key={key} data={section}/>\n case 'ARTIFACT_SPOTLIGHT':\n return <ArtifactSpotlightSection key={key} data={section}/>\n case 'TEXT_BLOCK':\n return <TextBlockSection key={key} data={section}/>\n case 'COLOR_PALETTE':\n return <ColorPaletteSection key={key} data={section}/>\n case 'QUOTE_BLOCK':\n return <QuoteBlockSection key={key} data={section}/>\n default:\n // Unknown section type from a newer backend — skip to stay forward-compat.\n return null\n }\n}\n","import React from 'react'\nimport type {CoverSection as CoverSectionData} from './types'\n\nexport interface CoverSectionProps {\n data: CoverSectionData\n /** Document-level client name from {@link Deliverable.clientName}, shown as \"Prepared for {name}\". */\n clientName?: string | null\n}\n\n/**\n * Title page for a deliverable. Always rendered as the first section.\n */\nexport function CoverSection({data, clientName}: CoverSectionProps) {\n return (\n <section className=\"deliverable-cover deliverable-page\">\n <div className=\"deliverable-cover-inner\">\n {data.eyebrow && (\n <p className=\"deliverable-cover-eyebrow\">{data.eyebrow}</p>\n )}\n <h1 className=\"deliverable-cover-title\">{data.title}</h1>\n {data.subtitle && (\n <p className=\"deliverable-cover-subtitle\">{data.subtitle}</p>\n )}\n {clientName && (\n <p className=\"deliverable-cover-client\">\n Prepared for{' '}\n <span className=\"deliverable-cover-client-name\">{clientName}</span>\n </p>\n )}\n </div>\n </section>\n )\n}\n","import React from 'react'\nimport {cx} from '../../utils'\nimport type {ArtifactImageGridSection as GridData} from './types'\n\nexport interface ArtifactImageGridSectionProps {\n data: GridData\n}\n\nconst COLUMN_CLASSES: Record<1 | 2 | 3, string> = {\n 1: 'deliverable-image-grid-cols-1',\n 2: 'deliverable-image-grid-cols-2',\n 3: 'deliverable-image-grid-cols-3',\n}\n\n/**\n * Grid of project artifact images with optional captions. The number of\n * columns is fixed by the spec (1–3); the renderer enforces a sensible aspect\n * ratio per item and lets the browser flow rows.\n */\nexport function ArtifactImageGridSection({data}: ArtifactImageGridSectionProps) {\n const columns = clampColumns(data.columns)\n return (\n <section className=\"deliverable-page\">\n {data.heading && (\n <h2 className=\"deliverable-heading\">{data.heading}</h2>\n )}\n <div className={cx('deliverable-image-grid', COLUMN_CLASSES[columns])}>\n {data.items.map((item, idx) => (\n <figure key={idx} className=\"deliverable-image-item\">\n {item.artifact.url\n ? (\n <img\n src={item.artifact.url}\n alt={item.artifact.title ?? ''}\n className=\"deliverable-image-img\"\n />\n )\n : (\n <div className=\"deliverable-image-missing\">\n Missing image\n </div>\n )}\n {item.caption && (\n <figcaption className=\"deliverable-image-caption\">\n {item.caption}\n </figcaption>\n )}\n </figure>\n ))}\n </div>\n </section>\n )\n}\n\nfunction clampColumns(n: number): 1 | 2 | 3 {\n if (n <= 1) return 1\n if (n === 2) return 2\n return 3\n}\n","import React from 'react'\nimport {MarkdownContent} from '../MarkdownContent'\nimport type {ArtifactSpotlightSection as SpotlightData} from './types'\n\nexport interface ArtifactSpotlightSectionProps {\n data: SpotlightData\n}\n\n/**\n * A single hero artifact image with optional prose alongside. Reads at full\n * page width on screen and prints to a single page.\n */\nexport function ArtifactSpotlightSection({data}: ArtifactSpotlightSectionProps) {\n return (\n <section className=\"deliverable-page\">\n {data.heading && (\n <h2 className=\"deliverable-heading\">{data.heading}</h2>\n )}\n <div className=\"deliverable-spotlight-media\">\n {data.artifact.url\n ? (\n <img\n src={data.artifact.url}\n alt={data.artifact.title ?? ''}\n className=\"deliverable-spotlight-img\"\n />\n )\n : (\n <div className=\"deliverable-spotlight-missing\">\n Missing image\n </div>\n )}\n </div>\n {data.body && (\n <MarkdownContent\n content={data.body}\n className=\"deliverable-spotlight-body\"\n />\n )}\n </section>\n )\n}\n","import React from 'react'\nimport {MarkdownContent} from '../MarkdownContent'\nimport type {TextBlockSection as TextData} from './types'\n\nexport interface TextBlockSectionProps {\n data: TextData\n}\n\n/**\n * Prose section. Body is rendered as Markdown.\n */\nexport function TextBlockSection({data}: TextBlockSectionProps) {\n return (\n <section className=\"deliverable-page\">\n {data.heading && (\n <h2 className=\"deliverable-heading\">{data.heading}</h2>\n )}\n <MarkdownContent\n content={data.body}\n className=\"deliverable-text-block\"\n />\n </section>\n )\n}\n","import React from 'react'\nimport type {ColorPaletteSection as PaletteData} from './types'\n\nexport interface ColorPaletteSectionProps {\n data: PaletteData\n}\n\n/**\n * Color palette presented as labelled swatches with hex values.\n */\nexport function ColorPaletteSection({data}: ColorPaletteSectionProps) {\n return (\n <section className=\"deliverable-page\">\n {data.heading && (\n <h2 className=\"deliverable-heading\">{data.heading}</h2>\n )}\n <div className=\"deliverable-palette\">\n {data.swatches.map((swatch, idx) => (\n <div key={idx} className=\"deliverable-palette-item\">\n <div\n className=\"deliverable-palette-chip\"\n style={{backgroundColor: swatch.color}}\n aria-label={swatch.label}\n />\n <p className=\"deliverable-palette-label\">{swatch.label}</p>\n <p className=\"deliverable-palette-hex\">{swatch.color.toUpperCase()}</p>\n </div>\n ))}\n </div>\n </section>\n )\n}\n","import React from 'react'\nimport type {QuoteBlockSection as QuoteData} from './types'\n\nexport interface QuoteBlockSectionProps {\n data: QuoteData\n}\n\n/**\n * Pulled quote with optional attribution. The renderer adds the surrounding\n * quotation marks.\n */\nexport function QuoteBlockSection({data}: QuoteBlockSectionProps) {\n return (\n <section className=\"deliverable-page deliverable-quote\">\n <blockquote className=\"deliverable-quote-body\">\n <p className=\"deliverable-quote-text\">“{data.quote}”</p>\n {data.attribution && (\n <footer className=\"deliverable-quote-attribution\">\n — {data.attribution}\n </footer>\n )}\n </blockquote>\n </section>\n )\n}\n","import {useCallback, useEffect, useRef, useState} from 'react'\n\ninterface UseResizableProps {\n /**\n * Initial width as percentage of viewport (0-100)\n */\n initialWidthPercent: number\n /**\n * Minimum width as percentage of viewport (0-100)\n */\n minWidthPercent: number\n /**\n * Maximum width as percentage of viewport (0-100)\n */\n maxWidthPercent: number\n /**\n * Direction to resize from\n */\n direction: 'left' | 'right'\n}\n\n/**\n * Hook for resizable panels with percentage-based widths.\n * Returns width as a CSS percentage string (e.g., \"50%\").\n */\nexport function useResizable({\n initialWidthPercent,\n minWidthPercent,\n maxWidthPercent,\n direction,\n}: UseResizableProps) {\n const [widthPercent, setWidthPercent] = useState(initialWidthPercent)\n const [isResizing, setIsResizing] = useState(false)\n const lastX = useRef<number | null>(null)\n\n const startResizing = useCallback((e: React.MouseEvent) => {\n e.preventDefault()\n setIsResizing(true)\n lastX.current = e.clientX\n }, [])\n\n const stopResizing = useCallback(() => {\n setIsResizing(false)\n lastX.current = null\n }, [])\n\n const resize = useCallback(\n (e: MouseEvent) => {\n if (!isResizing || lastX.current === null) {\n return\n }\n\n const deltaX = e.clientX - lastX.current\n const factor = direction === 'right' ? 1 : -1\n // Convert pixel delta to percentage of viewport\n const deltaPercent = (deltaX / window.innerWidth) * 100\n\n setWidthPercent((prevPercent) => {\n const newPercent = prevPercent + deltaPercent * factor\n return Math.min(Math.max(newPercent, minWidthPercent), maxWidthPercent)\n })\n\n lastX.current = e.clientX\n },\n [isResizing, direction, minWidthPercent, maxWidthPercent]\n )\n\n useEffect(() => {\n if (isResizing) {\n window.addEventListener('mousemove', resize)\n window.addEventListener('mouseup', stopResizing)\n document.body.style.cursor = 'col-resize'\n document.body.style.userSelect = 'none'\n } else {\n window.removeEventListener('mousemove', resize)\n window.removeEventListener('mouseup', stopResizing)\n document.body.style.cursor = ''\n document.body.style.userSelect = ''\n }\n\n return () => {\n window.removeEventListener('mousemove', resize)\n window.removeEventListener('mouseup', stopResizing)\n document.body.style.cursor = ''\n document.body.style.userSelect = ''\n }\n }, [isResizing, resize, stopResizing])\n\n // Return width as CSS percentage string\n const width = `${widthPercent}vw`\n\n return {width, widthPercent, isResizing, startResizing}\n}\n","import {useCallback, useMemo, useState} from 'react'\nimport type {ArtifactNode} from '../../ArtifactNode'\n\n/**\n * A breadcrumb entry representing one level of navigation depth.\n */\nexport interface BreadcrumbEntry {\n /** Display label for this level */\n label: string\n /** The group node at this level (null for root) */\n node: ArtifactNode | null\n}\n\n/**\n * Return type for the useArtifactTreeNavigation hook.\n */\nexport interface UseArtifactTreeNavigationReturn {\n /** Nodes to display at the current navigation level */\n currentNodes: ArtifactNode[]\n /** Breadcrumb trail from root to current level */\n breadcrumbs: BreadcrumbEntry[]\n /** Whether the user is at the root level */\n isAtRoot: boolean\n /** Navigate into a group node, pushing it onto the stack */\n navigateInto: (node: ArtifactNode) => void\n /** Navigate to a specific breadcrumb level by index */\n navigateTo: (index: number) => void\n /** Navigate back one level */\n navigateBack: () => void\n}\n\n/**\n * Manages navigation state for an artifact tree panel.\n * Maintains a stack of group nodes the user has navigated into,\n * deriving children from the node references themselves.\n */\nexport function useArtifactTreeNavigation(rootNodes: ArtifactNode[]): UseArtifactTreeNavigationReturn {\n // Stack of group nodes the user has drilled into (empty = at root)\n const [stack, setStack] = useState<ArtifactNode[]>([])\n\n const currentNodes = useMemo(() => {\n if (stack.length === 0) return rootNodes\n return stack[stack.length - 1].children\n }, [rootNodes, stack])\n\n const breadcrumbs = useMemo<BreadcrumbEntry[]>(() => {\n const entries: BreadcrumbEntry[] = [{label: 'Project', node: null}]\n for (const node of stack) {\n entries.push({label: node.label, node})\n }\n return entries\n }, [stack])\n\n const isAtRoot = stack.length === 0\n\n const navigateInto = useCallback((node: ArtifactNode) => {\n setStack(prev => [...prev, node])\n }, [])\n\n const navigateTo = useCallback((index: number) => {\n // index 0 = root, so slice to 0 clears the stack\n setStack(prev => prev.slice(0, index))\n }, [])\n\n const navigateBack = useCallback(() => {\n setStack(prev => prev.slice(0, -1))\n }, [])\n\n return {\n currentNodes,\n breadcrumbs,\n isAtRoot,\n navigateInto,\n navigateTo,\n navigateBack,\n }\n}\n","import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'\nimport {ChevronDown, Pencil} from 'lucide-react'\nimport {cx, useClickOutside} from '../../utils'\nimport {PlusIcon} from '../icons'\nimport type {Conversation} from './ChatInterface'\n\nexport interface HistoryPanelProps {\n /**\n * List of past conversations to display.\n */\n conversations: Conversation[]\n /**\n * Called when a conversation is selected.\n */\n onSelectConversation?: (id: string) => void\n /**\n * Called when the \"New Chat\" button is clicked.\n */\n onNewChat?: () => void\n /**\n * Called when a conversation's title is edited.\n */\n onRenameConversation?: (id: string, newTitle: string) => void\n}\n\ntype ConversationGroup = {\n key: 'today' | 'yesterday' | 'older'\n label: string\n conversations: Conversation[]\n}\n\nfunction parseTimestamp(ts: Conversation['timestamp']): Date | null {\n if (ts == null) {\n return null\n }\n const d = ts instanceof Date ? ts : new Date(ts)\n return Number.isNaN(d.getTime()) ? null : d\n}\n\nfunction startOfDay(d: Date): Date {\n const x = new Date(d)\n x.setHours(0, 0, 0, 0)\n return x\n}\n\nfunction groupConversations(conversations: Conversation[]): ConversationGroup[] {\n const today = startOfDay(new Date())\n const yesterday = new Date(today)\n yesterday.setDate(yesterday.getDate() - 1)\n\n const todayList: Conversation[] = []\n const yesterdayList: Conversation[] = []\n const olderList: Conversation[] = []\n\n for (const c of conversations) {\n const d = parseTimestamp(c.timestamp)\n if (d && d >= today) {\n todayList.push(c)\n } else if (d && d >= yesterday) {\n yesterdayList.push(c)\n } else {\n olderList.push(c)\n }\n }\n\n return [\n {key: 'today', label: 'Today', conversations: todayList},\n {key: 'yesterday', label: 'Yesterday', conversations: yesterdayList},\n {key: 'older', label: 'Older', conversations: olderList},\n ].filter((g) => g.conversations.length > 0) as ConversationGroup[]\n}\n\nfunction ProjectFilter({\n projects,\n value,\n onChange,\n className,\n}: {\n projects: string[]\n value: string | null\n onChange: (project: string | null) => void\n className?: string\n}) {\n const [open, setOpen] = useState(false)\n const ref = useRef<HTMLDivElement>(null)\n const closeFilter = useCallback(() => setOpen(false), [])\n\n useClickOutside(ref, closeFilter, open)\n\n const label = value ?? 'All projects'\n\n return (\n <div className={cx('relative min-w-0', className)} ref={ref}>\n <button\n type=\"button\"\n onClick={() => setOpen((o) => !o)}\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n className={cx(\n 'w-full flex items-center justify-between gap-1 px-2 py-1.5',\n 'bg-obsidian/60 hover:bg-ash/30',\n 'text-silver hover:text-white',\n 'border border-ash/40',\n 'text-xs',\n 'transition-colors duration-150 min-w-0'\n )}\n >\n <span className=\"truncate\">{label}</span>\n <ChevronDown className=\"w-3 h-3 shrink-0\" aria-hidden/>\n </button>\n {open && (\n <div\n role=\"listbox\"\n className={cx(\n 'absolute top-full left-0 right-0 mt-1 z-20',\n 'bg-charcoal border border-ash/40',\n 'max-h-60 overflow-y-auto'\n )}\n >\n <button\n type=\"button\"\n role=\"option\"\n aria-selected={value === null}\n onClick={() => {\n onChange(null)\n setOpen(false)\n }}\n className={cx(\n 'w-full px-2 py-1.5 text-left text-xs truncate',\n 'transition-colors duration-150',\n value === null\n ? 'bg-gold/10 text-gold'\n : 'text-silver hover:bg-ash/20 hover:text-white'\n )}\n >\n All projects\n </button>\n {projects.map((p) => (\n <button\n key={p}\n type=\"button\"\n role=\"option\"\n aria-selected={value === p}\n onClick={() => {\n onChange(p)\n setOpen(false)\n }}\n className={cx(\n 'w-full px-2 py-1.5 text-left text-xs truncate',\n 'transition-colors duration-150',\n value === p\n ? 'bg-gold/10 text-gold'\n : 'text-silver hover:bg-ash/20 hover:text-white'\n )}\n >\n {p}\n </button>\n ))}\n </div>\n )}\n </div>\n )\n}\n\nfunction ConversationRow({\n conversation,\n onSelect,\n onRename,\n}: {\n conversation: Conversation\n onSelect?: (id: string) => void\n onRename?: (id: string, newTitle: string) => void\n}) {\n const [isEditing, setIsEditing] = useState(false)\n const [draft, setDraft] = useState(conversation.title)\n const inputRef = useRef<HTMLInputElement>(null)\n\n useEffect(() => {\n if (isEditing && inputRef.current) {\n inputRef.current.focus()\n inputRef.current.select()\n }\n }, [isEditing])\n\n const startEdit = useCallback((e: React.MouseEvent) => {\n e.stopPropagation()\n setDraft(conversation.title)\n setIsEditing(true)\n }, [conversation.title])\n\n const commit = useCallback(() => {\n const trimmed = draft.trim()\n if (trimmed && trimmed !== conversation.title) {\n onRename?.(conversation.id, trimmed)\n }\n setIsEditing(false)\n }, [draft, conversation.id, conversation.title, onRename])\n\n const cancel = useCallback(() => {\n setDraft(conversation.title)\n setIsEditing(false)\n }, [conversation.title])\n\n if (isEditing) {\n return (\n <div\n className={cx(\n 'w-full px-3 py-2',\n conversation.isActive ? 'bg-ash/40' : 'bg-ash/20'\n )}\n >\n <input\n ref={inputRef}\n type=\"text\"\n value={draft}\n onChange={(e) => setDraft(e.target.value)}\n onBlur={commit}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault()\n commit()\n } else if (e.key === 'Escape') {\n e.preventDefault()\n cancel()\n }\n }}\n className={cx(\n 'w-full px-2 py-1 text-sm font-medium text-white',\n 'bg-obsidian border border-gold/40',\n 'outline-none focus:border-gold'\n )}\n aria-label=\"Conversation title\"\n />\n {conversation.project && (\n <p className=\"text-xs text-silver/60 truncate mt-1\">\n {conversation.project}\n </p>\n )}\n </div>\n )\n }\n\n return (\n <div className=\"relative group\">\n <button\n onClick={() => onSelect?.(conversation.id)}\n className={cx(\n 'w-full px-3 py-2 text-left',\n 'transition-colors duration-150',\n conversation.isActive\n ? 'bg-ash/40 text-white'\n : 'text-silver hover:bg-ash/20 hover:text-white'\n )}\n >\n <p\n className={cx(\n 'text-sm font-medium truncate',\n onRename ? 'pr-6' : ''\n )}\n >\n {conversation.title}\n </p>\n {conversation.project && (\n <p className=\"text-xs text-silver/60 truncate mt-0.5\">\n {conversation.project}\n </p>\n )}\n </button>\n {onRename && (\n <button\n type=\"button\"\n onClick={startEdit}\n aria-label=\"Rename conversation\"\n className={cx(\n 'absolute right-2 top-2',\n 'p-1 text-silver/60 hover:text-gold hover:bg-ash/40',\n 'opacity-0 group-hover:opacity-100 focus:opacity-100',\n 'transition-opacity duration-150'\n )}\n >\n <Pencil className=\"w-3.5 h-3.5\" aria-hidden/>\n </button>\n )}\n </div>\n )\n}\n\n/**\n * HistoryPanel renders the conversation history sidebar: a project filter,\n * a \"New Chat\" button, and the conversation list grouped by recency\n * (Today / Yesterday / Older). Each row shows the title and an optional\n * project subtitle, and exposes an inline rename affordance on hover.\n */\nexport function HistoryPanel({\n conversations,\n onSelectConversation,\n onNewChat,\n onRenameConversation,\n}: HistoryPanelProps) {\n const [projectFilter, setProjectFilter] = useState<string | null>(null)\n\n const projects = useMemo(() => {\n const set = new Set<string>()\n for (const c of conversations) {\n if (c.project) {\n set.add(c.project)\n }\n }\n return Array.from(set).sort((a, b) => a.localeCompare(b))\n }, [conversations])\n\n useEffect(() => {\n if (projectFilter && !projects.includes(projectFilter)) {\n setProjectFilter(null)\n }\n }, [projects, projectFilter])\n\n const filteredConversations = useMemo(() => {\n if (!projectFilter) {\n return conversations\n }\n return conversations.filter((c) => c.project === projectFilter)\n }, [conversations, projectFilter])\n\n const groups = useMemo(\n () => groupConversations(filteredConversations),\n [filteredConversations]\n )\n\n const hasFilter = projects.length > 0\n\n return (\n <div className=\"h-full flex flex-col\">\n <div className=\"px-4 py-3 border-b border-ash/40 shrink-0 flex items-center gap-2\">\n <h3 className=\"text-xs font-medium text-white shrink-0\">History</h3>\n {(hasFilter || onNewChat) && (\n <div className=\"flex items-center gap-2 flex-1 min-w-0\">\n {hasFilter && (\n <>\n <div className=\"w-px h-3 bg-ash/40 shrink-0 mx-1\"/>\n <ProjectFilter\n projects={projects}\n value={projectFilter}\n onChange={setProjectFilter}\n className=\"flex-1\"\n />\n </>\n )}\n {onNewChat && (\n <>\n <div className=\"w-px h-3 bg-ash/40 shrink-0 mx-1\"/>\n <button\n onClick={onNewChat}\n className={cx(\n 'flex items-center gap-1 px-2.5 py-1.5 shrink-0',\n 'bg-gold/10 hover:bg-gold/20 text-gold',\n 'border border-gold/30',\n 'text-xs font-medium',\n 'transition-colors duration-200'\n )}\n >\n <PlusIcon className=\"w-4 h-4\"/>\n <span className=\"truncate\">New Chat</span>\n </button>\n </>\n )}\n </div>\n )}\n </div>\n <div className=\"flex-1 overflow-y-auto py-2\">\n {conversations.length === 0 ? (\n <p className=\"px-4 py-2 text-xs text-silver/60\">No conversations yet</p>\n ) : groups.length === 0 ? (\n <p className=\"px-4 py-2 text-xs text-silver/60\">No conversations match this filter</p>\n ) : (\n <div>\n {groups.map((group, index) => (\n <section key={group.key} className={cx(index > 0 && 'mt-3')}>\n <div className=\"flex items-center gap-2 px-3 pb-2\">\n <span\n className=\"text-xs font-medium uppercase tracking-wider text-gold/70\">\n {group.label}\n </span>\n <div className=\"flex-1 h-px bg-gold/20\"/>\n </div>\n <div className=\"space-y-1 px-2\">\n {group.conversations.map((conversation) => (\n <ConversationRow\n key={conversation.id}\n conversation={conversation}\n onSelect={onSelectConversation}\n onRename={onRenameConversation}\n />\n ))}\n </div>\n </section>\n ))}\n </div>\n )}\n </div>\n </div>\n )\n}\n","import React, {useCallback, useMemo, useState} from 'react'\nimport {Loader2, Square} from 'lucide-react'\nimport {cx} from '../../utils'\nimport {CheckSquareIcon, CrossSquareIcon, EmptySquareIcon, SquareLoaderIcon,} from '../icons'\n\nexport const TASK_STATUSES = {\n PENDING: 'pending',\n IN_PROGRESS: 'in_progress',\n DONE: 'done',\n CANCELLED: 'cancelled',\n FAILED: 'failed',\n} as const\n\nexport type TaskStatus = typeof TASK_STATUSES[keyof typeof TASK_STATUSES]\n\nexport interface Task {\n /**\n * Unique identifier for the task\n */\n id: string\n /**\n * Task description text\n */\n label: string\n /**\n * Current status of the task\n */\n status: TaskStatus\n /**\n * Optional subtasks (shown when parent is in_progress or done)\n */\n subtasks?: Task[]\n}\n\nexport interface TodosListProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Array of tasks to display\n */\n tasks: Task[]\n /**\n * Title for the todos list\n * @default \"Tasks\"\n */\n title?: string\n /**\n * Called when the \"Stop All Tasks\" button is clicked.\n * Only shown when at least one task is in_progress.\n * The consumer decides what stopping means (cancel API calls, mark cancelled, etc.).\n *\n * May return a Promise. While the Promise is pending, the button becomes\n * disabled and displays a spinner with \"Stopping tasks\" to give the user\n * feedback that the stop request is in flight.\n */\n onStopAllTasks?: () => void | Promise<void>\n}\n\n/**\n * Get the status icon for a task\n */\nfunction TaskIcon({status}: { status: TaskStatus }) {\n switch (status) {\n case 'done':\n return <CheckSquareIcon/>\n case 'in_progress':\n return <SquareLoaderIcon/>\n case 'cancelled':\n return <CrossSquareIcon variant=\"cancelled\"/>\n case 'failed':\n return <CrossSquareIcon variant=\"failed\"/>\n case 'pending':\n default:\n return <EmptySquareIcon/>\n }\n}\n\n/**\n * Sort tasks so cancelled and failed items appear at the bottom of their group.\n * This sorts in place within the local group, not globally.\n */\nfunction sortTasks(tasks: Task[]): Task[] {\n const normal: Task[] = []\n const bottomItems: Task[] = []\n\n for (const task of tasks) {\n if (task.status === 'cancelled' || task.status === 'failed') {\n bottomItems.push(task)\n } else {\n normal.push(task)\n }\n }\n\n return [...normal, ...bottomItems]\n}\n\n/**\n * Single task item component\n */\nfunction TaskItem({task, depth = 0}: { task: Task; depth?: number }) {\n const isTerminal = task.status === 'done' || task.status === 'cancelled' || task.status\n === 'failed'\n const isSubtle = task.status === 'cancelled' || task.status === 'failed'\n\n // Always show subtasks if they exist\n const showSubtasks = task.subtasks && task.subtasks.length > 0\n const sortedSubtasks = showSubtasks ? sortTasks(task.subtasks!) : []\n\n return (\n <div className=\"flex flex-col\">\n <div\n className=\"flex items-center gap-2 py-1\"\n style={{paddingLeft: `${depth * 1.5}rem`}}\n >\n <TaskIcon status={task.status}/>\n <span\n className={cx(\n 'text-xs leading-tight transition-colors',\n isTerminal && 'line-through',\n isSubtle ? 'text-silver/50' : 'text-silver',\n task.status === 'in_progress' && 'text-white',\n task.status === 'done' && 'text-silver/70'\n )}\n >\n {task.label}\n {task.status === 'cancelled' && (\n <span className=\"text-silver/40 ml-1\">(cancelled)</span>\n )}\n {task.status === 'failed' && (\n <span className=\"text-error/60 ml-1\">(failed)</span>\n )}\n </span>\n </div>\n\n {/* Render subtasks if they exist */}\n {showSubtasks && (\n <div className=\"flex flex-col\">\n {sortedSubtasks.map((subtask) => (\n <TaskItem key={subtask.id} task={subtask} depth={depth + 1}/>\n ))}\n </div>\n )}\n </div>\n )\n}\n\n/**\n * TodosList displays a structured list of tasks with status indicators.\n *\n * Features:\n * - Nested tasks with indentation\n * - Status indicators: done (checkmark), in_progress (snake animation), pending (empty),\n * cancelled, failed\n * - Done tasks are crossed out with golden checkmark\n * - Cancelled/failed tasks are crossed out with subtle styling and sorted to bottom of their local\n * group\n * - Max 1/4 screen height with scroll\n * - Subtasks appear when parent task is in_progress or done\n *\n * The component automatically sorts cancelled/failed tasks to the bottom of their local group\n * (not globally), so just changing a task's status will reorder it appropriately.\n */\n/**\n * Returns true when any task (or subtask, recursively) has in_progress status.\n */\nfunction hasInProgressTask(tasks: Task[]): boolean {\n return tasks.some(t => {\n if (t.status === 'in_progress') {\n return true\n }\n if (t.subtasks && t.subtasks.length > 0) {\n return hasInProgressTask(t.subtasks)\n }\n return false\n })\n}\n\nexport const TodosList = React.forwardRef<HTMLDivElement, TodosListProps>(\n ({tasks, title = 'Tasks', onStopAllTasks, className, ...rest}, ref) => {\n const sortedTasks = useMemo(() => sortTasks(tasks), [tasks])\n const [isStopping, setIsStopping] = useState(false)\n\n const handleStopClick = useCallback(async () => {\n if (!onStopAllTasks || isStopping) {\n return\n }\n try {\n setIsStopping(true)\n await onStopAllTasks()\n } finally {\n setIsStopping(false)\n }\n }, [onStopAllTasks, isStopping])\n\n // Count completed top-level tasks\n const countCompleted = (taskList: Task[]): number => {\n return taskList.filter(task => task.status === 'done').length\n }\n\n const countTotal = (taskList: Task[]): number => {\n return taskList.length\n }\n\n // Keep the button mounted while a stop is in flight, even if tasks have\n // already flipped out of in_progress synchronously.\n const showStopButton = !!onStopAllTasks && (hasInProgressTask(tasks) || isStopping)\n\n if (tasks.length === 0) {\n return null\n }\n\n return (\n <div\n ref={ref}\n className={cx(\n 'flex flex-col h-full',\n 'overflow-hidden',\n className\n )}\n {...rest}\n >\n {/* Header */}\n <div\n className=\"flex items-center justify-between px-4 py-2 border-b border-ash/40 flex-shrink-0\">\n <h4 className=\"text-xs font-medium text-white\">{title}</h4>\n <span className=\"text-xs text-silver/60\">\n {countCompleted(tasks)}/{countTotal(tasks)}\n </span>\n </div>\n\n {/* Tasks list */}\n <div className=\"flex-1 overflow-y-auto px-4 py-2\">\n {sortedTasks.map((task) => (\n <TaskItem key={task.id} task={task}/>\n ))}\n </div>\n\n {/* Stop All Tasks button */}\n {showStopButton && (\n <div className=\"px-4 py-2 border-t border-ash/40 flex-shrink-0\">\n <button\n type=\"button\"\n onClick={handleStopClick}\n disabled={isStopping}\n aria-busy={isStopping}\n aria-label={isStopping ? 'Stopping tasks' : 'Stop all tasks'}\n className={cx(\n 'w-full flex items-center justify-center gap-2 px-3 py-1.5',\n 'bg-error/10 text-error',\n 'border border-error/30',\n 'text-xs font-medium',\n 'transition-colors duration-200',\n isStopping\n ? 'cursor-not-allowed opacity-70'\n : 'hover:bg-error/20'\n )}\n >\n {isStopping ? (\n <>\n <Loader2 className=\"w-3 h-3 animate-spin\"/>\n Stopping tasks\n </>\n ) : (\n <>\n <Square className=\"w-3 h-3 fill-current\"/>\n Stop All Tasks\n </>\n )}\n </button>\n </div>\n )}\n </div>\n )\n }\n)\n\nTodosList.displayName = 'TodosList'\n\n/**\n * Returns true when every task (and subtask, recursively) is in a\n * terminal state: done, cancelled, or failed. Returns true for empty arrays.\n */\nexport function areAllTasksSettled(tasks: Task[]): boolean {\n return tasks.every(t => {\n const settled = t.status === 'done' || t.status === 'cancelled' || t.status === 'failed'\n if (!settled) {\n return false\n }\n if (t.subtasks && t.subtasks.length > 0) {\n return areAllTasksSettled(t.subtasks)\n }\n return true\n })\n}\n\nexport default TodosList\n","import React from 'react'\nimport {cx} from '../../utils'\n\n/**\n * Position group for a tool — combines vertical position (top/bottom)\n * with sidebar side (left/right).\n */\nexport type ToolGroup = 'top-left' | 'bottom-left' | 'top-right' | 'bottom-right'\n\n/**\n * Describes a tool that can be toggled from the sidebar.\n */\nexport interface ToolDefinition {\n /**\n * Unique identifier for this tool\n */\n id: string\n /**\n * Icon element shown in the sidebar button\n */\n icon: React.ReactNode\n /**\n * Accessible label for the button\n */\n label: string\n /**\n * Which group the tool belongs to — tools in the same group\n * are mutually exclusive (opening one closes the other).\n */\n group: ToolGroup\n}\n\n/**\n * Consumer-provided tool definition passed via ChatInterface's `tools` prop.\n * Adds the panel content to render when the tool is opened.\n */\nexport interface ExternalToolDefinition extends ToolDefinition {\n /**\n * Content to render when the tool is open\n */\n content: React.ReactNode\n}\n\n/**\n * Tracks which tool is open in each group (null = none).\n */\nexport interface ToolPanelState {\n 'top-left': string | null\n 'bottom-left': string | null\n 'top-right': string | null\n 'bottom-right': string | null\n}\n\nexport interface ToolSidebarProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Available tool definitions\n */\n tools: ToolDefinition[]\n /**\n * Current state — which tool is open per group\n */\n activeTools: ToolPanelState\n /**\n * Called when a tool button is clicked (toggle)\n */\n onToggleTool: (toolId: string) => void\n /**\n * Which side this sidebar is on — controls border direction\n */\n side: 'left' | 'right'\n}\n\n/**\n * ToolSidebar renders a vertical strip of tool icon buttons on either\n * side of the chat interface. It follows the IntelliJ pattern:\n *\n * - Top-aligned group and bottom-aligned group separated by a divider\n * - Tools in the same group are mutually exclusive\n * - Clicking an active tool closes it; clicking an inactive tool opens it\n * - Constant slim width regardless of tool panel state\n * - Can be placed on left or right side via the `side` prop\n */\nexport const ToolSidebar = React.forwardRef<HTMLDivElement, ToolSidebarProps>(\n ({tools, activeTools, onToggleTool, side, className, ...rest}, ref) => {\n const topTools = tools.filter(t => t.group === `top-${side}`)\n const bottomTools = tools.filter(t => t.group === `bottom-${side}`)\n\n const isActive = (toolId: string) => {\n const tool = tools.find(t => t.id === toolId)\n if (!tool) return false\n return activeTools[tool.group] === toolId\n }\n\n const renderButton = (tool: ToolDefinition) => {\n const active = isActive(tool.id)\n return (\n <button\n key={tool.id}\n onClick={() => onToggleTool(tool.id)}\n className={cx(\n 'w-8 h-8 flex items-center justify-center transition-colors duration-150',\n active\n ? 'bg-gold/15 text-gold border border-gold/30'\n : 'text-silver hover:text-white hover:bg-ash/20'\n )}\n aria-label={tool.label}\n aria-pressed={active}\n >\n <span className=\"w-4 h-4 block\">\n {tool.icon}\n </span>\n </button>\n )\n }\n\n return (\n <div\n ref={ref}\n className={cx(\n 'h-full w-9 bg-charcoal/80 flex flex-col items-center shrink-0 py-2',\n side === 'left' ? 'border-r border-ash/40' : 'border-l border-ash/40',\n className\n )}\n {...rest}\n >\n {/* Top-aligned tools */}\n <div className=\"flex flex-col items-center gap-1\">\n {topTools.map(renderButton)}\n </div>\n\n {/* Spacer + separator */}\n <div className=\"flex-1 flex items-center justify-center\">\n <div className=\"w-5 border-t border-ash/30\"/>\n </div>\n\n {/* Bottom-aligned tools */}\n <div className=\"flex flex-col items-center gap-1\">\n {bottomTools.map(renderButton)}\n </div>\n </div>\n )\n }\n)\n\nToolSidebar.displayName = 'ToolSidebar'\n","import React, {useCallback, useEffect, useRef, useState} from 'react'\nimport {composeRefs, cx} from '../../utils'\n\nexport interface ToolPanelContainerProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Content for the top tool slot (from the top group).\n * When null, the bottom slot takes full height.\n */\n topContent: React.ReactNode | null\n /**\n * Content for the bottom tool slot (from the bottom group).\n * When null, the top slot takes full height.\n */\n bottomContent: React.ReactNode | null\n /**\n * Panel width as CSS value (e.g., \"50vw\")\n */\n width?: string\n /**\n * Default top panel height percentage (0-100).\n * @default 60\n */\n initialTopPercent?: number\n /**\n * Callback to start horizontal resizing (width dragger)\n */\n onResizeStart?: (e: React.MouseEvent) => void\n /**\n * Which side this panel is on — controls border and resize handle position\n */\n side?: 'left' | 'right'\n}\n\n/**\n * ToolPanelContainer manages the layout of one or two tool panels\n * stacked vertically. When both top and bottom slots are filled, a\n * height-adjustable divider appears between them.\n *\n * It also renders the width-resize handle on its left edge, identical\n * to the previous ArtifactsPanel resize behavior.\n */\nexport const ToolPanelContainer = React.forwardRef<HTMLDivElement, ToolPanelContainerProps>(\n ({\n topContent,\n bottomContent,\n width,\n onResizeStart,\n side = 'right',\n className,\n initialTopPercent = 60,\n ...rest\n },\n ref) => {\n const [topPercent, setTopPercent] = useState(initialTopPercent)\n const [isResizingHeight, setIsResizingHeight] = useState(false)\n const containerRef = useRef<HTMLDivElement>(null)\n const lastY = useRef<number | null>(null)\n\n const hasBoth = topContent !== null && bottomContent !== null\n\n // Height dragger handlers\n const startHeightResize = useCallback((e: React.MouseEvent) => {\n e.preventDefault()\n setIsResizingHeight(true)\n lastY.current = e.clientY\n }, [])\n\n const stopHeightResize = useCallback(() => {\n setIsResizingHeight(false)\n lastY.current = null\n }, [])\n\n const resizeHeight = useCallback(\n (e: MouseEvent) => {\n if (!isResizingHeight || lastY.current === null || !containerRef.current) {\n return\n }\n\n const containerHeight = containerRef.current.getBoundingClientRect().height\n if (containerHeight === 0) {\n return\n }\n\n const deltaY = e.clientY - lastY.current\n const deltaPercent = (deltaY / containerHeight) * 100\n\n setTopPercent(prev => {\n const next = prev + deltaPercent\n return Math.min(Math.max(next, 20), 80)\n })\n\n lastY.current = e.clientY\n },\n [isResizingHeight]\n )\n\n useEffect(() => {\n if (isResizingHeight) {\n window.addEventListener('mousemove', resizeHeight)\n window.addEventListener('mouseup', stopHeightResize)\n document.body.style.cursor = 'row-resize'\n document.body.style.userSelect = 'none'\n } else {\n window.removeEventListener('mousemove', resizeHeight)\n window.removeEventListener('mouseup', stopHeightResize)\n document.body.style.cursor = ''\n document.body.style.userSelect = ''\n }\n\n return () => {\n window.removeEventListener('mousemove', resizeHeight)\n window.removeEventListener('mouseup', stopHeightResize)\n document.body.style.cursor = ''\n document.body.style.userSelect = ''\n }\n }, [isResizingHeight, resizeHeight, stopHeightResize])\n\n return (\n <div\n ref={composeRefs(containerRef, ref)}\n className={cx(\n 'h-full bg-charcoal/50 flex flex-col relative shrink-0',\n side === 'left' ? 'border-r border-ash/40' : 'border-l border-ash/40',\n className\n )}\n style={width ? {width} : undefined}\n {...rest}\n >\n {/* Width resize handle */}\n <div\n onMouseDown={onResizeStart}\n className={cx(\n 'absolute top-0 w-1 h-full cursor-col-resize z-30',\n 'hover:bg-gold/50 transition-colors',\n side === 'left'\n ? 'right-0 after:absolute after:inset-y-0 after:-right-1 after:w-2'\n : 'left-0 after:absolute after:inset-y-0 after:-left-1 after:w-2'\n )}\n />\n\n {/* Top slot */}\n {topContent !== null && (\n <div\n className=\"min-h-0 overflow-hidden flex flex-col\"\n style={hasBoth ? {height: `${topPercent}%`} : {flex: '1 1 0%'}}\n >\n {topContent}\n </div>\n )}\n\n {/* Height dragger — only when both slots are filled */}\n {hasBoth && (\n <div\n onMouseDown={startHeightResize}\n className={cx(\n 'h-1 cursor-row-resize z-30 shrink-0',\n 'bg-ash/40 hover:bg-gold/50 transition-colors',\n 'relative',\n 'after:absolute after:-top-1 after:left-0 after:right-0 after:h-3'\n )}\n />\n )}\n\n {/* Bottom slot */}\n {bottomContent !== null && (\n <div\n className=\"min-h-0 overflow-hidden flex flex-col\"\n style={hasBoth ? {height: `${100 - topPercent}%`} : {flex: '1 1 0%'}}\n >\n {bottomContent}\n </div>\n )}\n </div>\n )\n }\n)\n\nToolPanelContainer.displayName = 'ToolPanelContainer'\n","/**\n * Conversation tree algorithms.\n *\n * Every function here operates on `NodeTopology` only — the tree never branches\n * on a node's `kind`. Domain questions (\"where's the nearest checkpoint?\",\n * \"which message did I edit?\") become predicates passed to `findAncestor`.\n *\n * The tree is the single source of truth for navigation. `activeLeafId` is the\n * leaf the user is viewing; `lastLeafId` is the deepest leaf they reached on\n * the previously-active path. The greyed-future region is derived from the\n * pair, not stored.\n */\n\nimport {ReactNode} from 'react'\nimport type {\n ChatNode,\n ConversationTree,\n MessageNode,\n NodeTopology,\n TreeNode,\n} from './types'\n\n// ───────────────────────────────────────────────────────────────\n// Construction\n// ───────────────────────────────────────────────────────────────\n\nexport function createEmptyTree<T extends NodeTopology = ChatNode>(): ConversationTree<T> {\n return {nodes: {}, rootIds: [], activeLeafId: null, lastLeafId: null}\n}\n\n/**\n * Options for {@link addNodeToTree}.\n */\nexport interface AddNodeOptions {\n /**\n * Whether the new node should become the active leaf. Defaults to `true`,\n * matching the historical \"create-and-focus\" behaviour: a freshly added\n * node almost always represents the latest user-visible state.\n *\n * Pass `false` when focus is decided by a separate signal — e.g. an SSE\n * stream that emits `active_leaf_set` only when the new node *should*\n * pull focus (the previous active leaf was its parent), and otherwise\n * leaves the user wherever they navigated to.\n *\n * `lastLeafId` follows the same rule: it only advances to the new node\n * when the node is activated, since \"deepest leaf the user has reached\"\n * does not include nodes the system added off-screen.\n *\n * @default true\n */\n activate?: boolean\n}\n\n/**\n * Append a node under `parentId` (or as a root when null). By default the new\n * node also becomes the active leaf — sending a message, retrying, editing,\n * and submitting all rely on that. Pass `{activate: false}` to insert without\n * pulling focus, e.g. for off-branch updates from a stream.\n */\nexport function addNodeToTree<T extends NodeTopology>(\n tree: ConversationTree<T>,\n node: T,\n parentId: string | null = null,\n options: AddNodeOptions = {},\n): ConversationTree<T> {\n const activate = options.activate ?? true\n const newNodes: Record<string, TreeNode<T>> = {...tree.nodes}\n const newRootIds = [...tree.rootIds]\n\n const branchIndex = parentId\n ? newNodes[parentId]?.children.length ?? 0\n : newRootIds.length\n\n newNodes[node.id] = {\n ...node,\n parentId,\n children: [],\n branchIndex,\n createdAt: node.createdAt ?? Date.now(),\n } as TreeNode<T>\n\n if (parentId && newNodes[parentId]) {\n newNodes[parentId] = {\n ...newNodes[parentId],\n children: [...newNodes[parentId].children, node.id],\n }\n } else {\n newRootIds.push(node.id)\n }\n\n return {\n nodes: newNodes,\n rootIds: newRootIds,\n activeLeafId: activate ? node.id : tree.activeLeafId,\n lastLeafId: activate ? node.id : tree.lastLeafId,\n }\n}\n\n// ───────────────────────────────────────────────────────────────\n// Traversal — generic over node kind\n// ───────────────────────────────────────────────────────────────\n\n/**\n * Walk root → activeLeaf, returning the nodes on the active path in order.\n */\nexport function getActivePath<T extends NodeTopology>(\n tree: ConversationTree<T>,\n): TreeNode<T>[] {\n return walkUp(tree, tree.activeLeafId).reverse()\n}\n\n/**\n * Walk from `fromId` upward and return the first ancestor (inclusive) that\n * matches the predicate. Domain helpers compose on top — e.g. finding the\n * closest checkpoint is `findAncestor(t, id, n => n.kind === 'checkpoint')`.\n */\nexport function findAncestor<T extends NodeTopology>(\n tree: ConversationTree<T>,\n fromId: string | null,\n predicate: (node: TreeNode<T>) => boolean,\n): TreeNode<T> | null {\n let id: string | null = fromId\n while (id) {\n const node = tree.nodes[id]\n if (!node) return null\n if (predicate(node)) return node\n id = node.parentId\n }\n return null\n}\n\nexport function getSiblingInfo<T extends NodeTopology>(\n tree: ConversationTree<T>,\n nodeId: string,\n): { total: number; current: number } {\n const siblings = siblingsOf(tree, nodeId)\n const index = siblings.indexOf(nodeId)\n if (index < 0) return {total: 1, current: 1}\n return {total: siblings.length, current: index + 1}\n}\n\nexport function isBranchPoint<T extends NodeTopology>(\n tree: ConversationTree<T>,\n nodeId: string,\n): boolean {\n return (tree.nodes[nodeId]?.children.length ?? 0) > 1\n}\n\n// ───────────────────────────────────────────────────────────────\n// Navigation — moving the active leaf\n// ───────────────────────────────────────────────────────────────\n\n/**\n * Switch to a sibling branch at `nodeId` and follow first-children down to a\n * leaf. Used by the BranchNavigator chevrons. Resets `lastLeafId` to the new\n * leaf because the previous greyed-future, if any, lives on a different branch.\n */\nexport function switchBranch<T extends NodeTopology>(\n tree: ConversationTree<T>,\n nodeId: string,\n direction: 'prev' | 'next',\n): ConversationTree<T> {\n const siblings = siblingsOf(tree, nodeId)\n if (siblings.length <= 1) return tree\n\n const currentIndex = siblings.indexOf(nodeId)\n const newIndex = direction === 'next'\n ? (currentIndex + 1) % siblings.length\n : (currentIndex - 1 + siblings.length) % siblings.length\n\n const leafId = deepestLeafOf(tree, siblings[newIndex])\n return {...tree, activeLeafId: leafId, lastLeafId: leafId}\n}\n\n/**\n * Set the active leaf without forking. Use for rewinds (clicking a checkpoint),\n * jumping forward into the greyed future, and \"jump to latest\".\n *\n * Preserves `lastLeafId` when the new leaf is an ancestor of it (i.e. the user\n * rewound, or moved within the rewound region). Otherwise resets `lastLeafId`\n * to the new leaf — the greyed future doesn't carry over to unrelated paths.\n *\n * `null` clears the active leaf (empty session). An id that doesn't exist in\n * the tree is treated as a no-op rather than written through — the previous\n * behaviour silently set `activeLeafId` to a non-existent id, which made\n * `getActivePath` walk from a missing node and return an empty path. That\n * presented as \"the chat just cleared\" for callers that accidentally passed\n * a foreign id (a hypocaust execution id, a stale optimistic temp id, etc.).\n * A no-op turns those caller bugs into visible \"nothing happened\" instead of\n * an invisible empty-render.\n */\nexport function setActiveLeaf<T extends NodeTopology>(\n tree: ConversationTree<T>,\n leafId: string | null,\n): ConversationTree<T> {\n if (leafId === null) {\n return {...tree, activeLeafId: null, lastLeafId: null}\n }\n if (!tree.nodes[leafId]) {\n return tree\n }\n const lastLeafId = tree.lastLeafId && isAncestor(tree, leafId, tree.lastLeafId)\n ? tree.lastLeafId\n : leafId\n return {...tree, activeLeafId: leafId, lastLeafId}\n}\n\n/**\n * Nodes between `activeLeafId` (exclusive) and `lastLeafId` (inclusive) — the\n * timeline the user rewound away from. Empty whenever no rewind is in effect.\n */\nexport function getGreyedFuture<T extends NodeTopology>(\n tree: ConversationTree<T>,\n): TreeNode<T>[] {\n const {activeLeafId, lastLeafId} = tree\n if (!activeLeafId || !lastLeafId || activeLeafId === lastLeafId) return []\n\n const path: TreeNode<T>[] = []\n let id: string | null = lastLeafId\n while (id && id !== activeLeafId) {\n const node: TreeNode<T> | undefined = tree.nodes[id]\n if (!node) return []\n path.unshift(node)\n id = node.parentId\n }\n return id === activeLeafId ? path : []\n}\n\n// ───────────────────────────────────────────────────────────────\n// Mutation\n// ───────────────────────────────────────────────────────────────\n\n/**\n * Convenience: build a strictly linear message-only tree from a flat array.\n * Useful for tests, fixtures, and consumers that don't care about branching.\n */\nexport function messagesToTree(\n messages: Array<Omit<MessageNode, 'kind' | 'parentId'>>,\n): ConversationTree<MessageNode> {\n let tree = createEmptyTree<MessageNode>()\n for (const msg of messages) {\n const parentId = tree.activeLeafId\n tree = addNodeToTree(\n tree,\n {...msg, kind: 'message', parentId} as MessageNode,\n parentId,\n )\n }\n return tree\n}\n\n/**\n * Update a streaming message's content. Generic over the tree's node type so\n * the function works equally on message-only trees (`ConversationTree<MessageNode>`)\n * and mixed trees (`ConversationTree<ChatNode>`). At runtime it narrows to\n * `MessageNode` via the `kind` discriminator and silently no-ops on any other\n * kind. The single cast below is the cost of bridging a generic-T tree to the\n * concrete `MessageNode` shape it operates on.\n */\nexport function updateMessageContent<T extends NodeTopology>(\n tree: ConversationTree<T>,\n nodeId: string,\n content: ReactNode,\n isStreaming?: boolean,\n): ConversationTree<T> {\n const node = tree.nodes[nodeId] as unknown as TreeNode<MessageNode> | undefined\n if (!node || node.kind !== 'message') return tree\n const updated: TreeNode<MessageNode> = {\n ...node,\n content,\n isStreaming: isStreaming ?? node.isStreaming,\n }\n return {\n ...tree,\n nodes: {\n ...tree.nodes,\n [nodeId]: updated as unknown as TreeNode<T>,\n },\n }\n}\n\n// ───────────────────────────────────────────────────────────────\n// Internal helpers\n// ───────────────────────────────────────────────────────────────\n\nfunction walkUp<T extends NodeTopology>(\n tree: ConversationTree<T>,\n fromId: string | null,\n): TreeNode<T>[] {\n const out: TreeNode<T>[] = []\n let id: string | null = fromId\n while (id) {\n const node = tree.nodes[id]\n if (!node) break\n out.push(node)\n id = node.parentId\n }\n return out\n}\n\nfunction siblingsOf<T extends NodeTopology>(\n tree: ConversationTree<T>,\n nodeId: string,\n): string[] {\n const node = tree.nodes[nodeId]\n if (!node) return []\n return node.parentId\n ? tree.nodes[node.parentId]?.children ?? []\n : tree.rootIds\n}\n\nfunction deepestLeafOf<T extends NodeTopology>(\n tree: ConversationTree<T>,\n nodeId: string,\n): string {\n let id = nodeId\n let node = tree.nodes[id]\n while (node && node.children.length > 0) {\n id = node.children[node.children.length - 1]\n node = tree.nodes[id]\n }\n return id\n}\n\nfunction isAncestor<T extends NodeTopology>(\n tree: ConversationTree<T>,\n ancestorId: string,\n descendantId: string,\n): boolean {\n let id: string | null = descendantId\n while (id) {\n if (id === ancestorId) return true\n id = tree.nodes[id]?.parentId ?? null\n }\n return false\n}\n","import React, {useCallback, useState} from 'react'\nimport {cx, useCopyToClipboard} from '../../utils'\nimport {Check, Copy, Pencil, RotateCcw, Send, X,} from 'lucide-react'\nimport type {MessageVariant} from '../Message'\n\n/**\n * @deprecated Use MessageVariant. Kept as an alias for backwards compatibility.\n */\nexport type MessageActionsVariant = MessageVariant\n\nexport interface MessageActionsProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Whether this is for a user or assistant message\n */\n variant: MessageVariant\n /**\n * The message content for copy functionality\n */\n content: string\n /**\n * Called when user wants to edit their message\n * Consumer should handle creating a branch with the edited content\n */\n onEdit?: (newContent: string) => void\n /**\n * Called when user wants to retry/regenerate the assistant response\n * Consumer should handle creating a branch with a new response\n */\n onRetry?: () => void\n /**\n * Whether the message is currently being edited\n */\n isEditing?: boolean\n /**\n * Callback to set editing state (controlled from parent)\n */\n onEditingChange?: (isEditing: boolean) => void\n /**\n * Initial content for the edit input (defaults to content prop)\n */\n editValue?: string\n}\n\nconst ActionButton: React.FC<{\n onClick: () => void\n label: string\n children: React.ReactNode\n className?: string\n disabled?: boolean\n}> = ({onClick, label, children, className, disabled}) => (\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className={cx(\n 'p-1.5 text-silver/60 hover:text-silver transition-colors duration-150',\n 'hover:bg-white/5 ',\n 'disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent',\n className\n )}\n aria-label={label}\n >\n {children}\n </button>\n)\n\nexport const MessageActions = React.forwardRef<HTMLDivElement, MessageActionsProps>(\n (\n {\n variant,\n content,\n onEdit,\n onRetry,\n isEditing: controlledIsEditing,\n onEditingChange,\n editValue: controlledEditValue,\n className,\n ...rest\n },\n ref\n ) => {\n // Local state for uncontrolled mode\n const [localIsEditing, setLocalIsEditing] = useState(false)\n const [localEditValue, setLocalEditValue] = useState(content)\n const {copied, copy} = useCopyToClipboard()\n\n // Determine if controlled or uncontrolled\n const isEditing = controlledIsEditing ?? localIsEditing\n const editValue = controlledEditValue ?? localEditValue\n\n const setIsEditing = useCallback(\n (value: boolean) => {\n if (onEditingChange) {\n onEditingChange(value)\n } else {\n setLocalIsEditing(value)\n }\n },\n [onEditingChange]\n )\n\n const setEditValue = useCallback((value: string) => {\n setLocalEditValue(value)\n }, [])\n\n const handleCopy = useCallback(() => {\n void copy(content)\n }, [copy, content])\n\n const handleStartEdit = useCallback(() => {\n setLocalEditValue(content)\n setIsEditing(true)\n }, [content, setIsEditing])\n\n const handleCancelEdit = useCallback(() => {\n setIsEditing(false)\n setLocalEditValue(content)\n }, [content, setIsEditing])\n\n const handleSubmitEdit = useCallback(() => {\n const trimmed = editValue.trim()\n if (trimmed && trimmed !== content) {\n onEdit?.(trimmed)\n }\n setIsEditing(false)\n }, [editValue, content, onEdit, setIsEditing])\n\n const handleEditKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault()\n handleSubmitEdit()\n } else if (e.key === 'Escape') {\n handleCancelEdit()\n }\n },\n [handleSubmitEdit, handleCancelEdit]\n )\n\n const isUser = variant === 'user'\n\n // Render edit mode inline\n if (isUser && isEditing) {\n return (\n <div\n ref={ref}\n className={cx('mt-2', className)}\n {...rest}\n >\n <div\n className=\"relative bg-charcoal border border-ash/60 focus-within:border-gold/60 focus-within:ring-1 focus-within:ring-gold/20\">\n <textarea\n value={editValue}\n onChange={(e) => setEditValue(e.target.value)}\n onKeyDown={handleEditKeyDown}\n className=\"w-full bg-transparent text-white px-3 py-2 pr-20 resize-none outline-none min-h-16 text-sm\"\n autoFocus\n rows={2}\n />\n <div className=\"absolute right-2 bottom-2 flex gap-1\">\n <ActionButton\n onClick={handleCancelEdit}\n label=\"Cancel edit\"\n className=\"text-silver/60 hover:text-error\"\n >\n <X className=\"w-4 h-4\"/>\n </ActionButton>\n <ActionButton\n onClick={handleSubmitEdit}\n label=\"Submit edit\"\n className=\"text-silver/60 hover:text-gold\"\n disabled={!editValue.trim() || editValue.trim() === content}\n >\n <Send className=\"w-4 h-4\"/>\n </ActionButton>\n </div>\n </div>\n <p className=\"text-xs text-silver/50 mt-1\">\n Press Enter to submit, Esc to cancel. This will create a new branch.\n </p>\n </div>\n )\n }\n\n return (\n <div\n ref={ref}\n className={cx(\n 'flex items-center gap-0.5 mt-1',\n isUser ? 'justify-end' : 'justify-start',\n className\n )}\n {...rest}\n >\n {/* Copy - available for both user and assistant */}\n <ActionButton onClick={handleCopy} label={copied ? 'Copied!' : 'Copy message'}>\n {copied ? (\n <Check className=\"w-3.5 h-3.5 text-success\"/>\n ) : (\n <Copy className=\"w-3.5 h-3.5\"/>\n )}\n </ActionButton>\n\n {/* Edit - only for user messages */}\n {isUser && onEdit && (\n <ActionButton onClick={handleStartEdit} label=\"Edit message\">\n <Pencil className=\"w-3.5 h-3.5\"/>\n </ActionButton>\n )}\n\n {/* Retry - only for assistant messages */}\n {!isUser && onRetry && (\n <ActionButton onClick={onRetry} label=\"Regenerate response\">\n <RotateCcw className=\"w-3.5 h-3.5\"/>\n </ActionButton>\n )}\n </div>\n )\n }\n)\n\nMessageActions.displayName = 'MessageActions'\n\nexport default MessageActions\n","import React from 'react'\nimport {cx} from '../../utils/cx'\nimport {ChevronLeft, ChevronRight, GitBranch} from 'lucide-react'\n\nexport interface BranchNavigatorProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Current branch index (1-based for display)\n */\n current: number\n /**\n * Total number of sibling branches\n */\n total: number\n /**\n * Called when navigating to previous branch\n */\n onPrevious?: () => void\n /**\n * Called when navigating to next branch\n */\n onNext?: () => void\n /**\n * Size variant\n */\n size?: 'sm' | 'md'\n /**\n * Whether to show the branch icon\n */\n showIcon?: boolean\n}\n\n/**\n * BranchNavigator provides a UI for switching between conversation branches.\n * Used in the Message component to navigate sibling branches (e.g., \"1/3\").\n */\nexport const BranchNavigator = React.forwardRef<HTMLDivElement, BranchNavigatorProps>(\n (\n {\n current,\n total,\n onPrevious,\n onNext,\n size = 'sm',\n showIcon = true,\n className,\n ...rest\n },\n ref\n ) => {\n // Don't render if there's only one branch\n if (total <= 1) {\n return null\n }\n\n const isFirst = current <= 1\n const isLast = current >= total\n\n const buttonSize = size === 'sm' ? 'p-0.5' : 'p-1'\n const iconSize = size === 'sm' ? 'w-3 h-3' : 'w-4 h-4'\n const textSize = size === 'sm' ? 'text-xs' : 'text-sm'\n\n return (\n <div\n ref={ref}\n className={cx(\n 'inline-flex items-center gap-0.5 text-silver/70',\n className\n )}\n role=\"navigation\"\n aria-label=\"Branch navigation\"\n {...rest}\n >\n {/* Branch icon */}\n {showIcon && (\n <GitBranch className={cx(iconSize, 'mr-0.5 text-silver/50')} aria-hidden=\"true\"/>\n )}\n\n {/* Previous button */}\n <button\n type=\"button\"\n onClick={onPrevious}\n disabled={isFirst}\n className={cx(\n buttonSize,\n 'hover:text-white hover:bg-white/10 transition-colors',\n 'disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-silver/70'\n )}\n aria-label=\"Previous branch\"\n >\n <ChevronLeft className={iconSize}/>\n </button>\n\n {/* Counter */}\n <span className={cx(textSize, 'tabular-nums min-w-6 text-center')}>\n {current}/{total}\n </span>\n\n {/* Next button */}\n <button\n type=\"button\"\n onClick={onNext}\n disabled={isLast}\n className={cx(\n buttonSize,\n 'hover:text-white hover:bg-white/10 transition-colors',\n 'disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-silver/70'\n )}\n aria-label=\"Next branch\"\n >\n <ChevronRight className={iconSize}/>\n </button>\n </div>\n )\n }\n)\n\nBranchNavigator.displayName = 'BranchNavigator'\n\nexport default BranchNavigator\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type BrandIconSize = 'sm' | 'md' | 'lg'\nexport type BrandIconVariant = 'solid' | 'outline'\n\nexport interface BrandIconProps extends React.HTMLAttributes<HTMLDivElement> {\n size?: BrandIconSize\n variant?: BrandIconVariant\n}\n\nconst sizeMap: Record<BrandIconSize, string> = {\n sm: 'h-8 w-8 text-sm',\n md: 'h-12 w-12 text-base',\n lg: 'h-16 w-16 text-lg',\n}\n\nexport const BrandIcon = React.forwardRef<HTMLDivElement, BrandIconProps>(\n ({size = 'md', variant = 'solid', children, className, ...rest}, ref) => {\n const variantClasses =\n variant === 'solid'\n ? 'bg-gold text-obsidian border-2 border-gold'\n : 'bg-transparent text-gold border-2 border-gold'\n\n return (\n <div\n ref={ref}\n className={cx(\n 'inline-flex items-center justify-center rounded-none font-bold select-none overflow-hidden',\n sizeMap[size],\n variantClasses,\n className\n )}\n {...rest}\n >\n {children}\n </div>\n )\n }\n)\n\nBrandIcon.displayName = 'BrandIcon'\n\nexport default BrandIcon\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport interface ColorSwatchProps extends React.HTMLAttributes<HTMLDivElement> {\n color: string\n label?: string\n}\n\nexport const ColorSwatch = React.forwardRef<HTMLDivElement, ColorSwatchProps>(\n ({color, label, className, ...rest}, ref) => {\n return (\n <div\n ref={ref}\n className={cx('flex flex-col items-center gap-2', className)}\n {...rest}\n >\n <div\n className=\"h-16 w-16 border-2 border-ash rounded-none shadow-sm\"\n style={{backgroundColor: color}}\n aria-label={label || color}\n />\n {label && (\n <span className=\"text-xs text-silver font-medium\">{label}</span>\n )}\n </div>\n )\n }\n)\n\nColorSwatch.displayName = 'ColorSwatch'\n\nexport default ColorSwatch\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type SectionHeadingLevel = 'h2' | 'h3'\n\nexport interface SectionHeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {\n level?: SectionHeadingLevel\n}\n\nconst levelStyles = {\n h2: 'text-2xl mb-4',\n h3: 'text-xl mb-3',\n}\n\nexport const SectionHeading = React.forwardRef<HTMLHeadingElement, SectionHeadingProps>(\n ({level = 'h2', children, className, ...rest}, ref) => {\n const Component = level\n\n return (\n <Component\n ref={ref}\n className={cx(\n 'text-gold font-semibold tracking-tight',\n levelStyles[level],\n className\n )}\n {...rest}\n >\n {children}\n </Component>\n )\n }\n)\n\nSectionHeading.displayName = 'SectionHeading'\n\nexport default SectionHeading\n","import {type Artifact} from './ArtifactCard'\n\n/**\n * Node types in the artifact tree\n */\nexport const NODE_TYPES = {\n ARTIFACT: 'ARTIFACT',\n GROUP: 'GROUP',\n VARIANT_SET: 'VARIANT_SET',\n} as const\n\nexport type NodeType = typeof NODE_TYPES[keyof typeof NODE_TYPES]\n\n/**\n * A node in the artifact tree. Mirrors the backend ArtifactNode shape.\n * Groups and variant sets contain children; artifact nodes link to content.\n */\nexport interface ArtifactNode {\n /**\n * Unique identifier\n */\n id: string\n /**\n * The node type — ARTIFACT, GROUP, or VARIANT_SET\n */\n type: NodeType\n /**\n * Semantic name (e.g. \"storyboard\", \"protagonist_warm\")\n */\n name: string\n /**\n * Display label (e.g. \"Storyboard\", \"Warm Analog\")\n */\n label: string\n /**\n * For ARTIFACT nodes — the actual content. Null for GROUP and VARIANT_SET.\n */\n artifact?: Artifact\n /**\n * Child nodes (populated for GROUP and VARIANT_SET)\n */\n children: ArtifactNode[]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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AO;AAAA,EACP,aAAa;AACf;;;A1GQO,IAAM,UAAU;","names":["React","import_react","React","import_react","import_react","import_react","React","React","import_react","React","import_react","React","import_react","React","import_react","ALIGN_MAP","JUSTIFY_MAP","GAP_MAP","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","import_lucide_react","React","import_react","import_lucide_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","e","import_react","React","import_react","import_lucide_react","React","import_react","React","import_react","VARIANT_MAP","React","import_react","import_lucide_react","React","VARIANT_STYLES","import_react","import_react_dom","import_lucide_react","React","import_react","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","React","import_react","import_react_dom","import_lucide_react","SIZE_MAP","POSITION_CLASSES","React","import_react","POSITION_CLASSES","React","import_react","React","import_react","React","import_react","import_lucide_react","React","import_react","React","import_react","React","import_react","import_lucide_react","React","import_react","import_lucide_react","React","import_react","import_lucide_react","React","import_react","import_lucide_react","import_react","React","remarkGfm","ReactMarkdown","VARIANT_STYLES","React","import_react","React","variantStyles","import_react","import_react","import_react","import_react","import_react","React","import_react","import_lucide_react","React","Checkpoint","import_react","import_lucide_react","React","GreyedDivider","React","ChatView","_k","id","import_react","import_lucide_react","React","import_react","import_lucide_react","import_react","import_react","React","import_react","ASPECT_RATIO_PRESETS","resolveAspectRatio","React","ReactPlayer","import_react","import_react_player","import_lucide_react","React","ReactPlayer","import_react","import_lucide_react","React","import_react","React","import_react","React","import_react","React","React","import_react","React","import_react","React","import_react","import_react","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","React","React","import_react","import_react","React","import_react","import_lucide_react","React","import_react","import_lucide_react","React","import_react","React","import_react","React","React","import_react","import_lucide_react","ActionButton","React","import_react","import_lucide_react","React","import_react","sizeMap","React","import_react","React","import_react","React"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/components/Button.tsx","../src/utils/cx.ts","../src/components/Input.tsx","../src/components/Card.tsx","../src/utils/clipboard.ts","../src/utils/textareaCaret.ts","../src/utils/hooks.ts","../src/components/Skeleton.tsx","../src/components/Container.tsx","../src/components/Row.tsx","../src/components/Col.tsx","../src/components/Stack.tsx","../src/components/Divider.tsx","../src/components/Avatar.tsx","../src/components/Badge.tsx","../src/components/Tooltip.tsx","../src/components/Table.tsx","../src/components/List.tsx","../src/components/FileChip.tsx","../src/components/MentionChip.tsx","../src/components/Combobox.tsx","../src/components/AttachmentPreview.tsx","../src/components/Label.tsx","../src/components/HelperText.tsx","../src/components/Textarea.tsx","../src/components/Select.tsx","../src/components/Checkbox.tsx","../src/components/Radio.tsx","../src/components/Switch.tsx","../src/components/Slider.tsx","../src/components/InputGroup.tsx","../src/components/Alert.tsx","../src/components/Spinner.tsx","../src/components/Progress.tsx","../src/components/Toast.tsx","../src/components/Modal.tsx","../src/components/Lightbox.tsx","../src/components/icons/ChatBubbleIcon.tsx","../src/components/icons/ChevronLeftIcon.tsx","../src/components/icons/ChevronRightIcon.tsx","../src/components/icons/CloseIcon.tsx","../src/components/icons/ExpandIcon.tsx","../src/components/icons/HistoryIcon.tsx","../src/components/icons/LayersIcon.tsx","../src/components/icons/MediaIcon.tsx","../src/components/icons/PlusIcon.tsx","../src/components/icons/CheckSquareIcon.tsx","../src/components/icons/EmptySquareIcon.tsx","../src/components/icons/CrossSquareIcon.tsx","../src/components/icons/SquareLoaderIcon.tsx","../src/components/Drawer.tsx","../src/components/Popover.tsx","../src/components/Dialog.tsx","../src/components/Tabs.tsx","../src/components/Accordion.tsx","../src/components/Menu.tsx","../src/components/Navbar.tsx","../src/components/Breadcrumb.tsx","../src/components/Pagination.tsx","../src/components/Stepper.tsx","../src/components/Message.tsx","../src/components/MarkdownContent.tsx","../src/utils/remarkMentions.ts","../src/components/StreamingCursor.tsx","../src/components/chat/ChatInterface.tsx","../src/components/chat/ChatView.tsx","../src/components/chat/hooks/useScrollAnchor.ts","../src/components/chat/hooks/useAdaptiveSpacer.ts","../src/components/chat/ThinkingIndicator.tsx","../src/components/chat/Checkpoint.tsx","../src/components/chat/GreyedDivider.tsx","../src/components/chat/ChatInput.tsx","../src/components/chat/types.ts","../src/components/chat/ArtifactsPanel.tsx","../src/components/ArtifactCard.tsx","../src/components/ImageCard.tsx","../src/components/VideoCard.tsx","../src/components/AudioCard.tsx","../src/components/PdfCard.tsx","../src/components/ScriptCard.tsx","../src/components/TextCard.tsx","../src/components/DeliverableCard.tsx","../src/utils/artifactLoading.ts","../src/components/ArtifactGroup.tsx","../src/components/ArtifactVariantStack.tsx","../src/components/ArtifactLightboxBody.tsx","../src/components/deliverable/DeliverableRenderer.tsx","../src/components/deliverable/CoverSection.tsx","../src/components/deliverable/ArtifactImageGridSection.tsx","../src/components/deliverable/ArtifactSpotlightSection.tsx","../src/components/deliverable/TextBlockSection.tsx","../src/components/deliverable/ColorPaletteSection.tsx","../src/components/deliverable/QuoteBlockSection.tsx","../src/components/chat/hooks/useResizable.ts","../src/components/chat/hooks/useArtifactTreeNavigation.ts","../src/components/chat/HistoryPanel.tsx","../src/components/chat/TodosList.tsx","../src/components/chat/ToolSidebar.tsx","../src/components/chat/ToolPanelContainer.tsx","../src/components/chat/tree.ts","../src/components/chat/MessageActions.tsx","../src/components/chat/BranchNavigator.tsx","../src/components/BrandIcon.tsx","../src/components/ColorSwatch.tsx","../src/components/SectionHeading.tsx","../src/components/ArtifactNode.ts"],"sourcesContent":["/**\n * Aurelius Design System\n *\n * A cohesive visual language for creative technologists.\n * Combines technical sophistication with artistic sensibility.\n *\n * CSS-first Tailwind v4 design system.\n * Import '@lukeashford/aurelius/styles/base.css' for complete styling.\n */\n\n// React components\nexport * from './components'\n\n// Utilities consumers commonly need (caret coords for inline autocompletes, etc.)\nexport {getTextareaCaretCoords, type TextareaCaretCoords} from './utils/textareaCaret'\n\n// Version\nexport const version = '2.0.0'\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type ButtonVariant =\n | 'primary'\n | 'important'\n | 'elevated'\n | 'outlined'\n | 'featured'\n | 'ghost'\n | 'danger'\n\nexport type ButtonSize = 'sm' | 'md' | 'lg' | 'xl'\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: ButtonVariant\n size?: ButtonSize\n loading?: boolean\n}\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({variant = 'primary', size = 'md', loading = false, className, disabled, children, ...rest},\n ref) => {\n const isDisabled = disabled || loading\n\n // Base button styles - common to all variants\n const base =\n 'inline-flex items-center justify-center font-semibold tracking-wide ' +\n 'transition-all duration-fast ' +\n 'rounded-none ' +\n 'disabled:opacity-50 disabled:cursor-not-allowed'\n\n // Variant styles\n const variantClasses = {\n primary:\n 'bg-charcoal text-white border border-gold/30 ' +\n 'hover:border-gold hover:shadow-glow hover:text-gold-light ' +\n 'active:bg-white/5 ' +\n 'focus-visible:ring-2 focus-visible:ring-gold focus-visible:ring-offset-2 ' +\n 'focus-visible:ring-offset-obsidian',\n\n important:\n 'bg-gold text-obsidian border border-gold ' +\n 'hover:bg-gold-light hover:text-obsidian ' +\n 'active:bg-gold-bright ' +\n 'focus-visible:ring-2 focus-visible:ring-gold focus-visible:ring-offset-2 ' +\n 'focus-visible:ring-offset-obsidian',\n\n elevated:\n 'bg-charcoal text-white border-0 shadow-lg ' +\n 'hover:shadow-xl hover:text-gold-light ' +\n 'active:bg-white/5 ' +\n 'focus-visible:ring-2 focus-visible:ring-gold focus-visible:ring-offset-2 ' +\n 'focus-visible:ring-offset-obsidian',\n\n outlined:\n 'bg-transparent text-white border border-ash ' +\n 'hover:border-white hover:text-white ' +\n 'active:bg-white/5 ' +\n 'focus-visible:ring-2 focus-visible:ring-gold focus-visible:ring-offset-2 ' +\n 'focus-visible:ring-offset-obsidian',\n\n featured:\n 'bg-charcoal text-white border border-gold ' +\n 'glow-sm ' +\n 'hover:glow-md hover:text-gold-light ' +\n 'active:bg-white/5 ' +\n 'focus-visible:ring-2 focus-visible:ring-gold focus-visible:ring-offset-2 ' +\n 'focus-visible:ring-offset-obsidian',\n\n ghost:\n 'bg-transparent text-gold border-0 ' +\n 'hover:text-gold-light ' +\n 'active:text-gold-bright ' +\n 'focus-visible:ring-2 focus-visible:ring-gold focus-visible:ring-offset-2 ' +\n 'focus-visible:ring-offset-obsidian',\n\n danger:\n 'bg-error text-white border-0 ' +\n 'hover:bg-error/90 ' +\n 'active:bg-error/80 ' +\n 'focus-visible:ring-2 focus-visible:ring-error focus-visible:ring-offset-2 ' +\n 'focus-visible:ring-offset-obsidian',\n }\n\n // Size styles\n const sizeClasses = {\n sm: 'h-8 px-3 text-sm',\n md: 'h-10 px-4 text-sm',\n lg: 'h-12 px-6 text-base',\n xl: 'h-14 px-8 text-lg',\n }\n\n const variantClass = variantClasses[variant]\n const sizeClass = sizeClasses[size]\n\n return (\n <button\n ref={ref}\n className={cx(base, variantClass, sizeClass, loading && 'opacity-80', className)}\n disabled={isDisabled}\n {...rest}\n >\n {loading && (\n <span\n className=\"mr-2 inline-block h-4 w-4 animate-pulse rounded-full bg-gold\"\n aria-hidden\n />\n )}\n {children}\n </button>\n )\n }\n)\n\nButton.displayName = 'Button'\n\nexport default Button\n","import {twMerge} from 'tailwind-merge';\nimport {type ClassValue, clsx} from 'clsx';\n\n/**\n * Concatenates class names and merges Tailwind utility classes correctly.\n * Uses clsx for conditional classes and tailwind-merge to handle overrides.\n */\nexport function cx(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {\n error?: boolean\n leadingIcon?: React.ReactNode\n trailingIcon?: React.ReactNode\n}\n\nexport const Input = React.forwardRef<HTMLInputElement, InputProps>(\n ({error = false, className, leadingIcon, trailingIcon, disabled, ...rest}, ref) => {\n const base =\n 'w-full h-10 px-3 bg-graphite border border-ash rounded-none ' +\n 'text-white placeholder:text-zinc ' +\n 'transition-all duration-fast ' +\n 'focus:border-gold focus:ring-1 focus:ring-gold focus:outline-none ' +\n 'disabled:bg-slate disabled:text-dim disabled:cursor-not-allowed'\n\n const errorCls = error ? 'border-error focus:border-error focus:ring-error' : ''\n\n return (\n <div className={cx('relative', disabled && 'opacity-90')}>\n {leadingIcon && (\n <span\n className=\"pointer-events-none absolute inset-y-0 left-3 flex items-center text-silver\">\n {leadingIcon}\n </span>\n )}\n <input\n ref={ref}\n className={cx(\n base,\n errorCls,\n leadingIcon ? 'pl-9' : false,\n trailingIcon ? 'pr-9' : false,\n className\n )}\n disabled={disabled}\n {...rest}\n />\n {trailingIcon && (\n <span\n className=\"pointer-events-none absolute inset-y-0 right-3 flex items-center text-silver\">\n {trailingIcon}\n </span>\n )}\n </div>\n )\n }\n)\n\nInput.displayName = 'Input'\n\nexport default Input\n","import React, {createContext, useContext, useState} from 'react'\nimport {Check} from 'lucide-react'\nimport {copyToClipboard, cx} from '../utils'\nimport {Skeleton} from './Skeleton'\n\nexport type CardVariant = 'default' | 'elevated' | 'outlined' | 'ghost' | 'featured'\n\nexport type CardSlotLoading = {\n header?: {\n title?: boolean\n subtitle?: boolean\n action?: boolean\n }\n media?: boolean\n body?: boolean\n footer?: boolean\n}\n\ninterface CardContextValue {\n loading?: CardSlotLoading\n}\n\nconst CardContext = createContext<CardContextValue>({loading: undefined})\n\nconst useCardContext = () => useContext(CardContext)\n\ntype HeaderField = keyof NonNullable<CardSlotLoading['header']>\ntype TopLevelKey = Exclude<keyof CardSlotLoading, 'header'>\ntype SlotPath = TopLevelKey | ['header', HeaderField]\n\nexport function slotLoading(\n loading: CardSlotLoading | undefined,\n path: SlotPath\n): boolean {\n if (!loading) {\n return false\n }\n if (Array.isArray(path)) {\n return !!loading.header?.[path[1]]\n }\n return !!loading[path]\n}\n\nexport interface CardProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: CardVariant\n interactive?: boolean\n selected?: boolean\n noPadding?: boolean\n loading?: CardSlotLoading\n}\n\nconst VARIANT_STYLES: Record<CardVariant, string> = {\n default: 'bg-charcoal shadow-sm border border-gold/30',\n elevated: 'bg-charcoal shadow-lg border-0',\n outlined: 'bg-charcoal shadow-none border border-ash',\n ghost: 'bg-transparent shadow-none border-0',\n featured: 'bg-charcoal border border-gold glow-sm',\n}\n\nconst CardBase = React.forwardRef<HTMLDivElement, CardProps>(\n (\n {\n variant = 'default',\n interactive = false,\n selected = false,\n noPadding = false,\n loading,\n className,\n children,\n ...props\n },\n ref\n ) => {\n return (\n <CardContext.Provider value={{loading}}>\n <div\n ref={ref}\n className={cx(\n 'rounded-none relative transition-opacity duration-500',\n !noPadding && 'p-6',\n VARIANT_STYLES[variant],\n interactive &&\n 'transition-all duration-200 hover:border-gold hover:shadow-glow cursor-pointer',\n selected && 'border-gold shadow-glow-md',\n className\n )}\n {...props}\n >\n {children}\n {selected && (\n <div\n className=\"absolute top-3 right-3 flex items-center justify-center h-6 w-6 rounded-full bg-gold text-obsidian\">\n <Check className=\"h-4 w-4\"/>\n </div>\n )}\n </div>\n </CardContext.Provider>\n )\n }\n)\n\nCardBase.displayName = 'Card'\n\n// Card.Header - header section with title and optional actions\nexport interface CardHeaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {\n title?: React.ReactNode\n subtitle?: React.ReactNode\n action?: React.ReactNode\n /**\n * Optional addressable handle (the artifact's `name` / `@-handle`). Renders\n * as a tertiary monospace line below the subtitle, prefixed with `@`. Click\n * copies `@<handle>` to the clipboard and pulses the handle once. Use to\n * surface the typed identifier filmmakers reference in chat.\n */\n handle?: string\n}\n\nconst CardHeader = React.forwardRef<HTMLDivElement, CardHeaderProps>(\n ({title, subtitle, action, handle, className, children, ...props}, ref) => {\n const {loading} = useCardContext()\n const titleIsLoading = slotLoading(loading, ['header', 'title'])\n const subtitleIsLoading = slotLoading(loading, ['header', 'subtitle'])\n const actionIsLoading = slotLoading(loading, ['header', 'action'])\n\n const hasContent = title || subtitle || action || handle || children\n\n if (!hasContent && !titleIsLoading && !subtitleIsLoading && !actionIsLoading) {\n return null\n }\n\n return (\n <div\n ref={ref}\n className={cx('px-6 py-4 border-b border-ash', className)}\n {...props}\n >\n {(title || subtitle || action || handle\n || titleIsLoading || subtitleIsLoading || actionIsLoading)\n ? (\n <div className=\"flex items-start justify-between gap-4\">\n <div className=\"flex-1 min-w-0\">\n {title ? (\n <h3 className=\"text-lg font-semibold text-white m-0\">{title}</h3>\n ) : titleIsLoading ? (\n <Skeleton className=\"h-5 w-3/4 mb-1\"/>\n ) : null}\n {subtitle ? (\n <p className=\"text-sm text-silver mt-1 m-0\">{subtitle}</p>\n ) : subtitleIsLoading ? (\n <Skeleton className=\"h-4 w-1/2 mt-1\"/>\n ) : null}\n {handle && <CardHandle handle={handle}/>}\n </div>\n {action ? (\n <div className=\"shrink-0\">{action}</div>\n ) : actionIsLoading ? (\n <Skeleton className=\"h-8 w-8 shrink-0\"/>\n ) : null}\n </div>\n ) : (\n children\n )}\n </div>\n )\n }\n)\n\n/**\n * Click-to-copy `@-handle` line. Rendered automatically by `Card.Header` when\n * its `handle` prop is set; exposed standalone as `Card.Handle` for custom\n * card layouts that don't use `Card.Header` (e.g. `DeliverableCard`).\n */\nexport interface CardHandleProps {\n handle: string\n}\n\nconst CardHandle: React.FC<CardHandleProps> = ({handle}) => {\n const [pulseKey, setPulseKey] = useState(0)\n const handleClick = (e: React.MouseEvent) => {\n e.stopPropagation()\n void copyToClipboard(`@${handle}`)\n setPulseKey(k => k + 1)\n }\n return (\n <button\n type=\"button\"\n onClick={handleClick}\n // `key` resets the animation so consecutive clicks pulse again.\n key={pulseKey}\n className={cx(\n 'mt-1 inline-flex items-center font-mono text-xs text-gold/70',\n 'hover:text-gold transition-colors',\n 'animate-pulse-once px-1 -mx-1',\n )}\n aria-label={`Copy @${handle} to clipboard`}\n title={`Copy @${handle} to clipboard`}\n >\n <span className=\"opacity-60\">@</span>{handle}\n </button>\n )\n}\n\nCardHeader.displayName = 'CardHeader'\n\n// Card.Body - main content area\nexport interface CardBodyProps extends React.HTMLAttributes<HTMLDivElement> {\n}\n\nconst CardBody = React.forwardRef<HTMLDivElement, CardBodyProps>(\n ({className, children, ...props}, ref) => {\n const {loading} = useCardContext()\n const isBodyLoading = slotLoading(loading, 'body')\n\n if (!children && !isBodyLoading) {\n return null\n }\n\n return (\n <div ref={ref} className={cx('px-6 py-4', className)} {...props}>\n {isBodyLoading ? (\n <div className=\"space-y-2\">\n <Skeleton className=\"h-4 w-full\"/>\n <Skeleton className=\"h-4 w-full\"/>\n <Skeleton className=\"h-4 w-3/4\"/>\n </div>\n ) : (\n children\n )}\n </div>\n )\n }\n)\n\nCardBody.displayName = 'CardBody'\n\n// Card.Footer - footer section, typically for actions\nexport interface CardFooterProps extends React.HTMLAttributes<HTMLDivElement> {\n align?: 'start' | 'center' | 'end' | 'between'\n}\n\nconst CardFooter = React.forwardRef<HTMLDivElement, CardFooterProps>(\n ({align = 'end', className, children, ...props}, ref) => {\n const alignClass = {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n between: 'justify-between',\n }[align]\n\n return (\n <div\n ref={ref}\n className={cx(\n 'px-6 py-4 border-t border-ash flex items-center gap-3',\n alignClass,\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nCardFooter.displayName = 'CardFooter'\n\n// Card.Media - image or media section\nexport interface CardMediaProps extends React.HTMLAttributes<HTMLDivElement> {\n aspect?: 'video' | 'square' | 'wide' | 'none'\n position?: 'top' | 'bottom'\n}\n\nconst CardMedia = React.forwardRef<HTMLDivElement, CardMediaProps>(\n ({\n aspect,\n position = 'top',\n className,\n children,\n ...props\n }, ref) => {\n const {loading} = useCardContext()\n const isMediaLoading = slotLoading(loading, 'media')\n const aspectClass = aspect && aspect !== 'none' ? {\n video: 'aspect-video',\n square: 'aspect-square',\n wide: 'aspect-wide',\n }[aspect] : ''\n\n if (!children && !isMediaLoading) {\n return null\n }\n\n return (\n <div\n ref={ref}\n className={cx(\n 'overflow-hidden relative',\n aspectClass,\n position === 'top' && 'border-b border-ash',\n position === 'bottom' && 'border-t border-ash',\n className\n )}\n {...props}\n >\n {isMediaLoading ? (\n <Skeleton className=\"w-full h-full\"/>\n ) : (\n children\n )}\n </div>\n )\n }\n)\n\nCardMedia.displayName = 'CardMedia'\n\nCardHandle.displayName = 'CardHandle'\n\n// Compound component pattern\nexport const Card = Object.assign(CardBase, {\n Header: CardHeader,\n Body: CardBody,\n Footer: CardFooter,\n Media: CardMedia,\n Handle: CardHandle,\n})","/**\n * Copy text to the clipboard via the async Clipboard API.\n *\n * Falls back to a hidden-textarea + `document.execCommand('copy')` for\n * environments where `navigator.clipboard` is unavailable (e.g. older\n * browsers or non-secure contexts).\n *\n * Returns `true` on success, `false` on failure. Never throws.\n */\nexport async function copyToClipboard(text: string): Promise<boolean> {\n if (typeof navigator !== 'undefined' && navigator.clipboard) {\n try {\n await navigator.clipboard.writeText(text)\n return true\n } catch {\n // fall through to legacy path\n }\n }\n\n if (typeof document === 'undefined') {\n return false\n }\n\n const textArea = document.createElement('textarea')\n textArea.value = text\n textArea.setAttribute('readonly', '')\n textArea.setAttribute('aria-hidden', 'true')\n textArea.style.position = 'fixed'\n textArea.style.opacity = '0'\n textArea.style.pointerEvents = 'none'\n document.body.appendChild(textArea)\n try {\n textArea.select()\n return document.execCommand('copy')\n } catch {\n return false\n } finally {\n document.body.removeChild(textArea)\n }\n}\n","/**\n * Returns the pixel offset of the caret inside a textarea, relative to the textarea's own\n * top-left. Use with `textarea.getBoundingClientRect()` to compute viewport / page coords\n * — typically for anchoring an `@`-mention or slash-command popover at the cursor.\n *\n * Implementation is the standard mirror-div technique: clone the textarea's text-affecting\n * styles into a hidden `<div>`, fill it with the value up to the caret, drop a marker\n * span at the caret position, and read the span's offset.\n */\nconst PROPERTIES_TO_MIRROR = [\n 'boxSizing',\n 'width',\n 'height',\n 'overflowX',\n 'overflowY',\n 'borderTopWidth',\n 'borderRightWidth',\n 'borderBottomWidth',\n 'borderLeftWidth',\n 'borderStyle',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'fontStyle',\n 'fontVariant',\n 'fontWeight',\n 'fontStretch',\n 'fontSize',\n 'fontSizeAdjust',\n 'lineHeight',\n 'fontFamily',\n 'textAlign',\n 'textTransform',\n 'textIndent',\n 'textDecoration',\n 'letterSpacing',\n 'wordSpacing',\n 'tabSize',\n] as const\n\nexport interface TextareaCaretCoords {\n /** Top of the caret, in pixels relative to the textarea's top-left. */\n top: number\n /** Left of the caret, in pixels relative to the textarea's top-left. */\n left: number\n /** Caret line height in pixels — useful when positioning a popover just above/below. */\n height: number\n}\n\nexport function getTextareaCaretCoords(textarea: HTMLTextAreaElement): TextareaCaretCoords {\n const mirror = document.createElement('div')\n mirror.setAttribute('aria-hidden', 'true')\n document.body.appendChild(mirror)\n\n const computed = window.getComputedStyle(textarea)\n const style = mirror.style\n\n style.position = 'absolute'\n style.visibility = 'hidden'\n style.whiteSpace = 'pre-wrap'\n style.wordWrap = 'break-word'\n style.top = '0'\n style.left = '-9999px'\n\n for (const prop of PROPERTIES_TO_MIRROR) {\n style[prop] = computed[prop]\n }\n\n // Textareas have a scrollbar that affects layout in some browsers; mirror it.\n style.overflow = 'hidden'\n\n mirror.textContent = textarea.value.substring(0, textarea.selectionStart)\n\n const marker = document.createElement('span')\n // Non-empty content is required so the span has measurable position.\n marker.textContent = textarea.value.substring(textarea.selectionStart) || '.'\n mirror.appendChild(marker)\n\n const top = marker.offsetTop - textarea.scrollTop\n const left = marker.offsetLeft - textarea.scrollLeft\n const height = parseInt(computed.lineHeight, 10) || parseInt(computed.fontSize, 10)\n\n document.body.removeChild(mirror)\n\n return {top, left, height}\n}\n","import {useCallback, useEffect, useRef, useState} from 'react'\nimport type {Ref} from 'react'\nimport {copyToClipboard} from './clipboard'\n\n/**\n * Compose multiple refs (callback or object) into a single callback ref.\n *\n * Useful when a component needs to attach an internal ref while still\n * forwarding a ref provided by its consumer.\n *\n * The return type is a plain function so it stays assignable across\n * duplicate @types/react resolutions (e.g. tests vs. source).\n */\nexport function composeRefs<T>(\n ...refs: Array<Ref<T> | undefined>\n): (node: T | null) => void {\n return (node: T | null) => {\n for (const ref of refs) {\n if (!ref) {\n continue\n }\n if (typeof ref === 'function') {\n ref(node)\n } else {\n // React's MutableRefObject — `current` is writable\n ;(ref as React.MutableRefObject<T | null>).current = node\n }\n }\n }\n}\n\n/**\n * Lock document scroll while `isLocked` is true. Multiple components can lock\n * concurrently — the lock is released only when every locker has released.\n *\n * Preserves and restores the original `body.overflow` and `body.paddingRight`\n * values so we don't clobber consumer styles.\n */\nlet scrollLockCount = 0\nlet scrollLockOriginalOverflow: string | null = null\nlet scrollLockOriginalPaddingRight: string | null = null\n\nexport function useScrollLock(isLocked: boolean): void {\n useEffect(() => {\n if (!isLocked || typeof document === 'undefined') {\n return\n }\n\n if (scrollLockCount === 0) {\n scrollLockOriginalOverflow = document.body.style.overflow\n scrollLockOriginalPaddingRight = document.body.style.paddingRight\n const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth\n document.body.style.overflow = 'hidden'\n if (scrollbarWidth > 0) {\n document.body.style.paddingRight = `${scrollbarWidth}px`\n }\n }\n scrollLockCount++\n\n return () => {\n scrollLockCount--\n if (scrollLockCount === 0) {\n document.body.style.overflow = scrollLockOriginalOverflow ?? ''\n document.body.style.paddingRight = scrollLockOriginalPaddingRight ?? ''\n scrollLockOriginalOverflow = null\n scrollLockOriginalPaddingRight = null\n }\n }\n }, [isLocked])\n}\n\n/**\n * Call `onEscape` whenever the user presses the Escape key while `isActive`\n * is true. Listens on `window`.\n */\nexport function useEscapeKey(onEscape: () => void, isActive = true): void {\n useEffect(() => {\n if (!isActive || typeof window === 'undefined') {\n return\n }\n const handler = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n onEscape()\n }\n }\n window.addEventListener('keydown', handler)\n return () => window.removeEventListener('keydown', handler)\n }, [onEscape, isActive])\n}\n\n/**\n * Call `handler` when a `mousedown` event occurs outside of `ref`'s element.\n * Disabled when `isActive` is false.\n */\nexport function useClickOutside<T extends HTMLElement>(\n ref: React.RefObject<T | null>,\n handler: (event: MouseEvent) => void,\n isActive = true,\n): void {\n useEffect(() => {\n if (!isActive || typeof document === 'undefined') {\n return\n }\n const listener = (event: MouseEvent) => {\n const node = ref.current\n if (node && !node.contains(event.target as Node)) {\n handler(event)\n }\n }\n document.addEventListener('mousedown', listener)\n return () => document.removeEventListener('mousedown', listener)\n }, [ref, handler, isActive])\n}\n\n/**\n * Provides a `copy(text)` function and a transient `copied` flag that flips\n * back to false after `resetMs` (default 2000). Cleans up the timer on unmount\n * and on subsequent copies.\n */\nexport interface UseCopyToClipboardReturn {\n copied: boolean\n copy: (text: string) => Promise<boolean>\n}\n\nexport function useCopyToClipboard(resetMs = 2000): UseCopyToClipboardReturn {\n const [copied, setCopied] = useState(false)\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n const mountedRef = useRef(true)\n\n useEffect(() => {\n mountedRef.current = true\n return () => {\n mountedRef.current = false\n if (timerRef.current !== null) {\n clearTimeout(timerRef.current)\n timerRef.current = null\n }\n }\n }, [])\n\n const copy = useCallback(async (text: string) => {\n const ok = await copyToClipboard(text)\n if (!mountedRef.current) {\n return ok\n }\n if (ok) {\n setCopied(true)\n if (timerRef.current !== null) {\n clearTimeout(timerRef.current)\n }\n timerRef.current = setTimeout(() => {\n timerRef.current = null\n if (mountedRef.current) {\n setCopied(false)\n }\n }, resetMs)\n }\n return ok\n }, [resetMs])\n\n return {copied, copy}\n}\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {\n}\n\nexport const Skeleton = React.forwardRef<HTMLDivElement, SkeletonProps>(\n ({className, ...rest}, ref) => {\n return (\n <div\n ref={ref}\n className={cx('animate-pulse bg-ash', className)}\n {...rest}\n />\n )\n }\n)\n\nSkeleton.displayName = 'Skeleton'\n\nexport default Skeleton\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type ContainerSize = 'sm' | 'md' | 'lg' | 'xl' | 'fluid' | 'responsive'\n\nexport interface ContainerProps extends React.HTMLAttributes<HTMLDivElement> {\n size?: ContainerSize\n}\n\nconst SIZE_CLASSES: Record<ContainerSize, string> = {\n sm: 'container-sm',\n md: 'container-md',\n lg: 'container-lg',\n xl: 'container-xl',\n fluid: 'container-fluid',\n responsive: 'container',\n}\n\nexport const Container = React.forwardRef<HTMLDivElement, ContainerProps>(\n ({size = 'responsive', className, children, ...props}, ref) => {\n return (\n <div ref={ref} className={cx(SIZE_CLASSES[size], className)} {...props}>\n {children}\n </div>\n )\n }\n)\n\nContainer.displayName = 'Container'\n","import React from 'react'\nimport {cx} from '../utils'\n\nexport type RowGutter = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12\nexport type RowJustify = 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'\nexport type RowAlign = 'start' | 'center' | 'end' | 'stretch' | 'baseline'\n\nexport interface RowProps extends React.HTMLAttributes<HTMLDivElement> {\n gutter?: RowGutter\n gutterX?: RowGutter\n gutterY?: RowGutter\n justify?: RowJustify\n align?: RowAlign\n}\n\nconst JUSTIFY_MAP: Record<RowJustify, string> = {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n between: 'justify-between',\n around: 'justify-around',\n evenly: 'justify-evenly',\n}\n\nconst ALIGN_MAP: Record<RowAlign, string> = {\n start: 'items-start',\n center: 'items-center',\n end: 'items-end',\n stretch: 'items-stretch',\n baseline: 'items-baseline',\n}\n\nconst GAP_MAP: Record<RowGutter, string> = {\n 0: 'gap-0',\n 1: 'gap-1',\n 2: 'gap-2',\n 3: 'gap-3',\n 4: 'gap-4',\n 5: 'gap-5',\n 6: 'gap-6',\n 8: 'gap-8',\n 10: 'gap-10',\n 12: 'gap-12',\n}\n\nconst GAP_X_MAP: Record<RowGutter, string> = {\n 0: 'gap-x-0',\n 1: 'gap-x-1',\n 2: 'gap-x-2',\n 3: 'gap-x-3',\n 4: 'gap-x-4',\n 5: 'gap-x-5',\n 6: 'gap-x-6',\n 8: 'gap-x-8',\n 10: 'gap-x-10',\n 12: 'gap-x-12',\n}\n\nconst GAP_Y_MAP: Record<RowGutter, string> = {\n 0: 'gap-y-0',\n 1: 'gap-y-1',\n 2: 'gap-y-2',\n 3: 'gap-y-3',\n 4: 'gap-y-4',\n 5: 'gap-y-5',\n 6: 'gap-y-6',\n 8: 'gap-y-8',\n 10: 'gap-y-10',\n 12: 'gap-y-12',\n}\n\nexport const Row = React.forwardRef<HTMLDivElement, RowProps>(\n ({gutter = 4, gutterX, gutterY, justify, align, className, children, ...props}, ref) => {\n // Directional gutters take precedence over uniform gutter\n const gapClass = gutterX === undefined && gutterY === undefined ? GAP_MAP[gutter] : ''\n const gapXClass = gutterX !== undefined ? GAP_X_MAP[gutterX] : ''\n const gapYClass = gutterY !== undefined ? GAP_Y_MAP[gutterY] : ''\n\n return (\n <div\n ref={ref}\n className={cx(\n 'row',\n gapClass,\n gapXClass,\n gapYClass,\n justify && JUSTIFY_MAP[justify],\n align && ALIGN_MAP[align],\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nRow.displayName = 'Row'\n","import React from 'react'\nimport {cx} from '../utils'\n\nexport type ColSpan = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 'auto' | 'full'\nexport type ColOffset = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11\nexport type ColOrder = 'first' | 'last' | 'none' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12\n\nexport interface ResponsiveValue<T> {\n base?: T\n sm?: T\n md?: T\n lg?: T\n xl?: T\n '2xl'?: T\n}\n\nexport interface ColProps extends React.HTMLAttributes<HTMLDivElement> {\n span?: ColSpan | ResponsiveValue<ColSpan>\n offset?: ColOffset | ResponsiveValue<ColOffset>\n order?: ColOrder | ResponsiveValue<ColOrder>\n}\n\ntype Breakpoint = 'base' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n\nconst SPAN_CLASS_MAP: Record<Breakpoint, Record<ColSpan, string>> = {\n base: {\n 1: 'col-span-1',\n 2: 'col-span-2',\n 3: 'col-span-3',\n 4: 'col-span-4',\n 5: 'col-span-5',\n 6: 'col-span-6',\n 7: 'col-span-7',\n 8: 'col-span-8',\n 9: 'col-span-9',\n 10: 'col-span-10',\n 11: 'col-span-11',\n 12: 'col-span-12',\n auto: 'col-auto',\n full: 'col-span-full',\n },\n sm: {\n 1: 'sm:col-span-1',\n 2: 'sm:col-span-2',\n 3: 'sm:col-span-3',\n 4: 'sm:col-span-4',\n 5: 'sm:col-span-5',\n 6: 'sm:col-span-6',\n 7: 'sm:col-span-7',\n 8: 'sm:col-span-8',\n 9: 'sm:col-span-9',\n 10: 'sm:col-span-10',\n 11: 'sm:col-span-11',\n 12: 'sm:col-span-12',\n auto: 'sm:col-auto',\n full: 'sm:col-span-full',\n },\n md: {\n 1: 'md:col-span-1',\n 2: 'md:col-span-2',\n 3: 'md:col-span-3',\n 4: 'md:col-span-4',\n 5: 'md:col-span-5',\n 6: 'md:col-span-6',\n 7: 'md:col-span-7',\n 8: 'md:col-span-8',\n 9: 'md:col-span-9',\n 10: 'md:col-span-10',\n 11: 'md:col-span-11',\n 12: 'md:col-span-12',\n auto: 'md:col-auto',\n full: 'md:col-span-full',\n },\n lg: {\n 1: 'lg:col-span-1',\n 2: 'lg:col-span-2',\n 3: 'lg:col-span-3',\n 4: 'lg:col-span-4',\n 5: 'lg:col-span-5',\n 6: 'lg:col-span-6',\n 7: 'lg:col-span-7',\n 8: 'lg:col-span-8',\n 9: 'lg:col-span-9',\n 10: 'lg:col-span-10',\n 11: 'lg:col-span-11',\n 12: 'lg:col-span-12',\n auto: 'lg:col-auto',\n full: 'lg:col-span-full',\n },\n xl: {\n 1: 'xl:col-span-1',\n 2: 'xl:col-span-2',\n 3: 'xl:col-span-3',\n 4: 'xl:col-span-4',\n 5: 'xl:col-span-5',\n 6: 'xl:col-span-6',\n 7: 'xl:col-span-7',\n 8: 'xl:col-span-8',\n 9: 'xl:col-span-9',\n 10: 'xl:col-span-10',\n 11: 'xl:col-span-11',\n 12: 'xl:col-span-12',\n auto: 'xl:col-auto',\n full: 'xl:col-span-full',\n },\n '2xl': {\n 1: '2xl:col-span-1',\n 2: '2xl:col-span-2',\n 3: '2xl:col-span-3',\n 4: '2xl:col-span-4',\n 5: '2xl:col-span-5',\n 6: '2xl:col-span-6',\n 7: '2xl:col-span-7',\n 8: '2xl:col-span-8',\n 9: '2xl:col-span-9',\n 10: '2xl:col-span-10',\n 11: '2xl:col-span-11',\n 12: '2xl:col-span-12',\n auto: '2xl:col-auto',\n full: '2xl:col-span-full',\n },\n}\n\nconst OFFSET_CLASS_MAP: Record<Breakpoint, Record<ColOffset, string>> = {\n base: {\n 0: '',\n 1: 'col-start-2',\n 2: 'col-start-3',\n 3: 'col-start-4',\n 4: 'col-start-5',\n 5: 'col-start-6',\n 6: 'col-start-7',\n 7: 'col-start-8',\n 8: 'col-start-9',\n 9: 'col-start-10',\n 10: 'col-start-11',\n 11: 'col-start-12',\n },\n sm: {\n 0: '',\n 1: 'sm:col-start-2',\n 2: 'sm:col-start-3',\n 3: 'sm:col-start-4',\n 4: 'sm:col-start-5',\n 5: 'sm:col-start-6',\n 6: 'sm:col-start-7',\n 7: 'sm:col-start-8',\n 8: 'sm:col-start-9',\n 9: 'sm:col-start-10',\n 10: 'sm:col-start-11',\n 11: 'sm:col-start-12',\n },\n md: {\n 0: '',\n 1: 'md:col-start-2',\n 2: 'md:col-start-3',\n 3: 'md:col-start-4',\n 4: 'md:col-start-5',\n 5: 'md:col-start-6',\n 6: 'md:col-start-7',\n 7: 'md:col-start-8',\n 8: 'md:col-start-9',\n 9: 'md:col-start-10',\n 10: 'md:col-start-11',\n 11: 'md:col-start-12',\n },\n lg: {\n 0: '',\n 1: 'lg:col-start-2',\n 2: 'lg:col-start-3',\n 3: 'lg:col-start-4',\n 4: 'lg:col-start-5',\n 5: 'lg:col-start-6',\n 6: 'lg:col-start-7',\n 7: 'lg:col-start-8',\n 8: 'lg:col-start-9',\n 9: 'lg:col-start-10',\n 10: 'lg:col-start-11',\n 11: 'lg:col-start-12',\n },\n xl: {\n 0: '',\n 1: 'xl:col-start-2',\n 2: 'xl:col-start-3',\n 3: 'xl:col-start-4',\n 4: 'xl:col-start-5',\n 5: 'xl:col-start-6',\n 6: 'xl:col-start-7',\n 7: 'xl:col-start-8',\n 8: 'xl:col-start-9',\n 9: 'xl:col-start-10',\n 10: 'xl:col-start-11',\n 11: 'xl:col-start-12',\n },\n '2xl': {\n 0: '',\n 1: '2xl:col-start-2',\n 2: '2xl:col-start-3',\n 3: '2xl:col-start-4',\n 4: '2xl:col-start-5',\n 5: '2xl:col-start-6',\n 6: '2xl:col-start-7',\n 7: '2xl:col-start-8',\n 8: '2xl:col-start-9',\n 9: '2xl:col-start-10',\n 10: '2xl:col-start-11',\n 11: '2xl:col-start-12',\n },\n}\n\nconst ORDER_CLASS_MAP: Record<Breakpoint, Record<ColOrder, string>> = {\n base: {\n first: 'order-first',\n last: 'order-last',\n none: 'order-none',\n 1: 'order-1',\n 2: 'order-2',\n 3: 'order-3',\n 4: 'order-4',\n 5: 'order-5',\n 6: 'order-6',\n 7: 'order-7',\n 8: 'order-8',\n 9: 'order-9',\n 10: 'order-10',\n 11: 'order-11',\n 12: 'order-12',\n },\n sm: {\n first: 'sm:order-first',\n last: 'sm:order-last',\n none: 'sm:order-none',\n 1: 'sm:order-1',\n 2: 'sm:order-2',\n 3: 'sm:order-3',\n 4: 'sm:order-4',\n 5: 'sm:order-5',\n 6: 'sm:order-6',\n 7: 'sm:order-7',\n 8: 'sm:order-8',\n 9: 'sm:order-9',\n 10: 'sm:order-10',\n 11: 'sm:order-11',\n 12: 'sm:order-12',\n },\n md: {\n first: 'md:order-first',\n last: 'md:order-last',\n none: 'md:order-none',\n 1: 'md:order-1',\n 2: 'md:order-2',\n 3: 'md:order-3',\n 4: 'md:order-4',\n 5: 'md:order-5',\n 6: 'md:order-6',\n 7: 'md:order-7',\n 8: 'md:order-8',\n 9: 'md:order-9',\n 10: 'md:order-10',\n 11: 'md:order-11',\n 12: 'md:order-12',\n },\n lg: {\n first: 'lg:order-first',\n last: 'lg:order-last',\n none: 'lg:order-none',\n 1: 'lg:order-1',\n 2: 'lg:order-2',\n 3: 'lg:order-3',\n 4: 'lg:order-4',\n 5: 'lg:order-5',\n 6: 'lg:order-6',\n 7: 'lg:order-7',\n 8: 'lg:order-8',\n 9: 'lg:order-9',\n 10: 'lg:order-10',\n 11: 'lg:order-11',\n 12: 'lg:order-12',\n },\n xl: {\n first: 'xl:order-first',\n last: 'xl:order-last',\n none: 'xl:order-none',\n 1: 'xl:order-1',\n 2: 'xl:order-2',\n 3: 'xl:order-3',\n 4: 'xl:order-4',\n 5: 'xl:order-5',\n 6: 'xl:order-6',\n 7: 'xl:order-7',\n 8: 'xl:order-8',\n 9: 'xl:order-9',\n 10: 'xl:order-10',\n 11: 'xl:order-11',\n 12: 'xl:order-12',\n },\n '2xl': {\n first: '2xl:order-first',\n last: '2xl:order-last',\n none: '2xl:order-none',\n 1: '2xl:order-1',\n 2: '2xl:order-2',\n 3: '2xl:order-3',\n 4: '2xl:order-4',\n 5: '2xl:order-5',\n 6: '2xl:order-6',\n 7: '2xl:order-7',\n 8: '2xl:order-8',\n 9: '2xl:order-9',\n 10: '2xl:order-10',\n 11: '2xl:order-11',\n 12: '2xl:order-12',\n },\n}\n\nfunction isResponsiveValue<T>(value: T | ResponsiveValue<T>): value is ResponsiveValue<T> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction buildResponsiveClasses<T extends string | number>(\n value: T | ResponsiveValue<T> | undefined,\n classMap: Record<Breakpoint, Record<T, string>>\n): string[] {\n if (value === undefined) {\n return []\n }\n\n if (!isResponsiveValue(value)) {\n const cls = classMap.base[value]\n return cls ? [cls] : []\n }\n\n const classes: string[] = []\n for (const [breakpoint, val] of Object.entries(value) as [Breakpoint, T][]) {\n if (val !== undefined) {\n const cls = classMap[breakpoint]?.[val]\n if (cls) {\n classes.push(cls)\n }\n }\n }\n return classes\n}\n\nexport const Col = React.forwardRef<HTMLDivElement, ColProps>(\n ({span, offset, order, className, children, ...props}, ref) => {\n const spanClasses = buildResponsiveClasses(span, SPAN_CLASS_MAP)\n const offsetClasses = buildResponsiveClasses(offset, OFFSET_CLASS_MAP)\n const orderClasses = buildResponsiveClasses(order, ORDER_CLASS_MAP)\n\n // Default to full width if no span specified\n const hasSpan = span !== undefined\n const defaultSpan = hasSpan ? '' : 'col-span-12'\n\n return (\n <div\n ref={ref}\n className={cx(\n defaultSpan,\n ...spanClasses,\n ...offsetClasses,\n ...orderClasses,\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nCol.displayName = 'Col'\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type StackDirection = 'horizontal' | 'vertical'\nexport type StackAlign = 'start' | 'center' | 'end' | 'stretch' | 'baseline'\nexport type StackJustify = 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'\nexport type StackGap = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12\n\nexport interface StackProps extends React.HTMLAttributes<HTMLDivElement> {\n direction?: StackDirection\n align?: StackAlign\n justify?: StackJustify\n gap?: StackGap\n wrap?: boolean\n as?: 'div' | 'section' | 'article' | 'nav' | 'aside' | 'header' | 'footer' | 'main'\n}\n\nconst ALIGN_MAP: Record<StackAlign, string> = {\n start: 'items-start',\n center: 'items-center',\n end: 'items-end',\n stretch: 'items-stretch',\n baseline: 'items-baseline',\n}\n\nconst JUSTIFY_MAP: Record<StackJustify, string> = {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n between: 'justify-between',\n around: 'justify-around',\n evenly: 'justify-evenly',\n}\n\nconst GAP_MAP: Record<StackGap, string> = {\n 0: 'gap-0',\n 1: 'gap-1',\n 2: 'gap-2',\n 3: 'gap-3',\n 4: 'gap-4',\n 5: 'gap-5',\n 6: 'gap-6',\n 8: 'gap-8',\n 10: 'gap-10',\n 12: 'gap-12',\n}\n\nexport const Stack = React.forwardRef<HTMLDivElement, StackProps>(\n (\n {\n direction = 'vertical',\n align,\n justify,\n gap = 4,\n wrap = false,\n as: Component = 'div',\n className,\n children,\n ...props\n },\n ref\n ) => {\n return (\n <Component\n ref={ref}\n className={cx(\n 'flex',\n direction === 'horizontal' ? 'flex-row' : 'flex-col',\n align && ALIGN_MAP[align],\n justify && JUSTIFY_MAP[justify],\n GAP_MAP[gap],\n wrap && 'flex-wrap',\n className\n )}\n {...props}\n >\n {children}\n </Component>\n )\n }\n)\n\nStack.displayName = 'Stack'\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type DividerOrientation = 'horizontal' | 'vertical'\nexport type DividerVariant = 'solid' | 'dashed' | 'dotted'\n\nexport interface DividerProps extends React.HTMLAttributes<HTMLHRElement> {\n orientation?: DividerOrientation\n variant?: DividerVariant\n label?: React.ReactNode\n color?: 'default' | 'gold' | 'muted'\n}\n\nconst COLOR_MAP: Record<string, string> = {\n default: 'border-ash',\n gold: 'border-gold/50',\n muted: 'border-slate',\n}\n\nconst VARIANT_MAP: Record<DividerVariant, string> = {\n solid: 'border-solid',\n dashed: 'border-dashed',\n dotted: 'border-dotted',\n}\n\nexport const Divider = React.forwardRef<HTMLHRElement, DividerProps>(\n (\n {\n orientation = 'horizontal',\n variant = 'solid',\n label,\n color = 'default',\n className,\n ...props\n },\n ref\n ) => {\n const isHorizontal = orientation === 'horizontal'\n\n if (label && isHorizontal) {\n return (\n <div\n className={cx('flex items-center gap-4', className)}\n role=\"separator\"\n aria-orientation={orientation}\n >\n <div\n className={cx(\n 'flex-1 border-t',\n VARIANT_MAP[variant],\n COLOR_MAP[color]\n )}\n />\n <span className=\"text-sm text-silver shrink-0\">{label}</span>\n <div\n className={cx(\n 'flex-1 border-t',\n VARIANT_MAP[variant],\n COLOR_MAP[color]\n )}\n />\n </div>\n )\n }\n\n return (\n <hr\n ref={ref}\n role=\"separator\"\n aria-orientation={orientation}\n className={cx(\n isHorizontal ? 'border-t w-full' : 'border-l h-full',\n VARIANT_MAP[variant],\n COLOR_MAP[color],\n 'border-0',\n isHorizontal ? 'border-t' : 'border-l',\n className\n )}\n {...props}\n />\n )\n }\n)\n\nDivider.displayName = 'Divider'\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\nexport type AvatarStatus = 'online' | 'offline' | 'busy'\n\nexport interface AvatarProps extends React.HTMLAttributes<HTMLDivElement> {\n src?: string\n alt?: string\n name?: string\n size?: AvatarSize\n status?: AvatarStatus\n}\n\nconst sizeMap: Record<AvatarSize, string> = {\n xs: 'h-6 w-6 text-[10px]',\n sm: 'h-8 w-8 text-[11px]',\n md: 'h-10 w-10 text-xs',\n lg: 'h-12 w-12 text-sm',\n xl: 'h-16 w-16 text-base',\n '2xl': 'h-24 w-24 text-lg',\n}\n\nfunction initials(name?: string) {\n if (!name) {\n return ''\n }\n const parts = name.trim().split(/\\s+/)\n return parts.slice(0, 2).map(p => p[0]!.toUpperCase()).join('')\n}\n\nexport const Avatar = React.forwardRef<HTMLDivElement, AvatarProps>(\n ({src, alt = '', name, size = 'md', status, className, ...rest}, ref) => {\n const statusColor =\n status === 'online' ? 'bg-success' : status === 'busy' ? 'bg-warning' : 'bg-zinc'\n\n return (\n <div\n ref={ref}\n className={cx(\n 'relative inline-flex items-center justify-center rounded-full border-2 border-ash bg-slate text-silver font-semibold select-none overflow-hidden',\n sizeMap[size],\n className\n )}\n {...rest}\n >\n {src ? (\n <img src={src} alt={alt || name || 'Avatar'}\n className=\"h-full w-full object-cover\"/>\n ) : (\n <span aria-hidden>{initials(name) || '·'}</span>\n )}\n {status && (\n <span\n className={cx(\n 'absolute bottom-0 right-0 rounded-full ring-2 ring-charcoal',\n // 25% of avatar size\n size === 'xs' ? 'h-1.5 w-1.5' :\n size === 'sm' ? 'h-2 w-2' :\n size === 'md' ? 'h-2.5 w-2.5' :\n size === 'lg' ? 'h-3 w-3' :\n size === 'xl' ? 'h-4 w-4' : 'h-5 w-5',\n statusColor\n )}\n />\n )}\n </div>\n )\n }\n)\n\nAvatar.displayName = 'Avatar'\n\nexport default Avatar\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type BadgeVariant = 'default' | 'gold' | 'success' | 'error' | 'warning' | 'info'\n\nexport interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {\n variant?: BadgeVariant\n}\n\nexport const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(\n ({variant = 'default', className, ...rest}, ref) => {\n // Base badge styles\n const base = 'inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border'\n\n // Variant styles\n const variantClasses = {\n default: 'bg-slate text-silver border-slate',\n gold: 'bg-gold/20 text-gold border-gold/30',\n success: 'bg-success/20 text-success border-success/30',\n error: 'bg-error/20 text-error border-error/30',\n warning: 'bg-warning/20 text-warning border-warning/30',\n info: 'bg-info/20 text-info border-info/30',\n }\n\n const variantClass = variantClasses[variant]\n\n return <span ref={ref} className={cx(base, variantClass, className)} {...rest} />\n }\n)\n\nBadge.displayName = 'Badge'\n\nexport default Badge\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type TooltipSide = 'top' | 'right' | 'bottom' | 'left'\n\nexport interface TooltipProps {\n content: React.ReactNode\n children: React.ReactElement\n open?: boolean\n side?: TooltipSide\n}\n\n// Simple, controlled tooltip. Consumer handles open state.\nexport const Tooltip: React.FC<TooltipProps> = ({\n content,\n children,\n open = false,\n side = 'top'\n}) => {\n return (\n <span className=\"relative inline-block\">\n {children}\n <span\n role=\"tooltip\"\n className={cx(\n 'pointer-events-none absolute z-50 whitespace-nowrap border border-ash bg-graphite px-3 py-1.5 text-sm text-white shadow-lg transition-opacity duration-200 ease-out',\n open ? 'opacity-100' : 'opacity-0',\n side === 'top' && 'left-1/2 -translate-x-1/2 -top-2 -translate-y-full',\n side === 'bottom' && 'left-1/2 -translate-x-1/2 -bottom-2 translate-y-full',\n side === 'left' && 'top-1/2 -translate-y-1/2 -left-2 -translate-x-full',\n side === 'right' && 'top-1/2 -translate-y-1/2 -right-2 translate-x-full'\n )}\n >\n {content}\n </span>\n </span>\n )\n}\n\nexport default Tooltip\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\n// Table container\nexport interface TableProps extends React.TableHTMLAttributes<HTMLTableElement> {\n responsive?: boolean\n}\n\nexport const Table = React.forwardRef<HTMLTableElement, TableProps>(\n ({responsive = true, className, children, ...props}, ref) => {\n const table = (\n <table\n ref={ref}\n className={cx('w-full text-sm', className)}\n {...props}\n >\n {children}\n </table>\n )\n\n if (responsive) {\n return <div className=\"w-full overflow-x-auto\">{table}</div>\n }\n\n return table\n }\n)\n\nTable.displayName = 'Table'\n\n// Table header\nexport interface TableHeaderProps extends React.HTMLAttributes<HTMLTableSectionElement> {\n}\n\nexport const TableHeader = React.forwardRef<HTMLTableSectionElement, TableHeaderProps>(\n ({className, children, ...props}, ref) => (\n <thead\n ref={ref}\n className={cx('bg-graphite', className)}\n {...props}\n >\n {children}\n </thead>\n )\n)\n\nTableHeader.displayName = 'TableHeader'\n\n// Table body\nexport interface TableBodyProps extends React.HTMLAttributes<HTMLTableSectionElement> {\n}\n\nexport const TableBody = React.forwardRef<HTMLTableSectionElement, TableBodyProps>(\n ({className, children, ...props}, ref) => (\n <tbody\n ref={ref}\n className={cx('divide-y divide-ash', className)}\n {...props}\n >\n {children}\n </tbody>\n )\n)\n\nTableBody.displayName = 'TableBody'\n\n// Table footer\nexport interface TableFooterProps extends React.HTMLAttributes<HTMLTableSectionElement> {\n}\n\nexport const TableFooter = React.forwardRef<HTMLTableSectionElement, TableFooterProps>(\n ({className, children, ...props}, ref) => (\n <tfoot\n ref={ref}\n className={cx('bg-graphite font-medium', className)}\n {...props}\n >\n {children}\n </tfoot>\n )\n)\n\nTableFooter.displayName = 'TableFooter'\n\n// Table row\nexport interface TableRowProps extends React.HTMLAttributes<HTMLTableRowElement> {\n hoverable?: boolean\n selected?: boolean\n}\n\nexport const TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(\n ({hoverable = true, selected = false, className, children, ...props}, ref) => (\n <tr\n ref={ref}\n className={cx(\n 'transition-colors duration-fast',\n hoverable && 'hover:bg-graphite/50',\n selected && 'bg-gold/10',\n className\n )}\n {...props}\n >\n {children}\n </tr>\n )\n)\n\nTableRow.displayName = 'TableRow'\n\n// Table header cell\nexport interface TableHeadProps extends React.ThHTMLAttributes<HTMLTableCellElement> {\n sortable?: boolean\n sortDirection?: 'asc' | 'desc' | null\n}\n\nexport const TableHead = React.forwardRef<HTMLTableCellElement, TableHeadProps>(\n ({sortable, sortDirection, className, children, ...props}, ref) => (\n <th\n ref={ref}\n className={cx(\n 'px-4 py-3 text-left font-semibold text-silver',\n sortable && 'cursor-pointer hover:text-white select-none',\n className\n )}\n {...props}\n >\n <div className=\"flex items-center gap-2\">\n {children}\n {sortable && sortDirection && (\n <span className=\"text-gold\">\n {sortDirection === 'asc' ? '↑' : '↓'}\n </span>\n )}\n </div>\n </th>\n )\n)\n\nTableHead.displayName = 'TableHead'\n\n// Table data cell\nexport interface TableCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {\n}\n\nexport const TableCell = React.forwardRef<HTMLTableCellElement, TableCellProps>(\n ({className, children, ...props}, ref) => (\n <td\n ref={ref}\n className={cx('px-4 py-3 text-white', className)}\n {...props}\n >\n {children}\n </td>\n )\n)\n\nTableCell.displayName = 'TableCell'\n\n// Table caption\nexport interface TableCaptionProps extends React.HTMLAttributes<HTMLTableCaptionElement> {\n}\n\nexport const TableCaption = React.forwardRef<HTMLTableCaptionElement, TableCaptionProps>(\n ({className, children, ...props}, ref) => (\n <caption\n ref={ref}\n className={cx('mt-4 text-sm text-silver', className)}\n {...props}\n >\n {children}\n </caption>\n )\n)\n\nTableCaption.displayName = 'TableCaption'\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\n// List container\nexport interface ListProps extends React.HTMLAttributes<HTMLUListElement> {\n variant?: 'default' | 'bordered' | 'divided'\n ordered?: boolean\n}\n\nexport const List = React.forwardRef<HTMLUListElement, ListProps>(\n ({variant = 'default', ordered = false, className, children, ...props}, ref) => {\n // `ol` and `ul` share the HTMLAttributes shape we accept; the ref is\n // narrowed to HTMLUListElement because that is the dominant case.\n const Component = (ordered ? 'ol' : 'ul') as 'ul'\n\n return (\n <Component\n ref={ref}\n className={cx(\n 'list-none m-0 p-0',\n variant === 'bordered' && 'border border-ash',\n variant === 'divided' && 'divide-y divide-ash',\n className\n )}\n {...props}\n >\n {children}\n </Component>\n )\n }\n)\n\nList.displayName = 'List'\n\n// ListItem\nexport interface ListItemProps extends React.LiHTMLAttributes<HTMLLIElement> {\n leading?: React.ReactNode\n trailing?: React.ReactNode\n interactive?: boolean\n selected?: boolean\n disabled?: boolean\n}\n\nexport const ListItem = React.forwardRef<HTMLLIElement, ListItemProps>(\n (\n {\n leading,\n trailing,\n interactive = false,\n selected = false,\n disabled = false,\n className,\n children,\n onClick,\n ...props\n },\n ref\n ) => {\n const handleClick = (e: React.MouseEvent<HTMLLIElement>) => {\n if (disabled) {\n return\n }\n onClick?.(e)\n }\n\n return (\n <li\n ref={ref}\n onClick={handleClick}\n className={cx(\n 'flex items-center gap-3 px-4 py-3',\n interactive && 'cursor-pointer transition-colors duration-fast',\n interactive && !disabled && 'hover:bg-graphite',\n selected && 'bg-gold/10',\n disabled && 'opacity-50 cursor-not-allowed',\n className\n )}\n {...props}\n >\n {leading && <div className=\"shrink-0\">{leading}</div>}\n <div className=\"flex-1 min-w-0\">{children}</div>\n {trailing && <div className=\"shrink-0\">{trailing}</div>}\n </li>\n )\n }\n)\n\nListItem.displayName = 'ListItem'\n\n// ListItemText - for structured text content\nexport interface ListItemTextProps extends React.HTMLAttributes<HTMLDivElement> {\n primary: React.ReactNode\n secondary?: React.ReactNode\n}\n\nexport const ListItemText = React.forwardRef<HTMLDivElement, ListItemTextProps>(\n ({primary, secondary, className, ...props}, ref) => {\n return (\n <div ref={ref} className={cx('flex flex-col', className)} {...props}>\n <span className=\"text-sm font-medium text-white\">{primary}</span>\n {secondary && (\n <span className=\"text-xs text-silver mt-0.5\">{secondary}</span>\n )}\n </div>\n )\n }\n)\n\nListItemText.displayName = 'ListItemText'\n\n// ListSubheader - section header within a list\nexport interface ListSubheaderProps extends React.HTMLAttributes<HTMLLIElement> {\n}\n\nexport const ListSubheader = React.forwardRef<HTMLLIElement, ListSubheaderProps>(\n ({className, children, ...props}, ref) => {\n return (\n <li\n ref={ref}\n className={cx(\n 'px-4 py-2 text-xs font-semibold text-gold uppercase tracking-wider bg-graphite',\n className\n )}\n {...props}\n >\n {children}\n </li>\n )\n }\n)\n\nListSubheader.displayName = 'ListSubheader'\n","import React, {useState} from 'react'\nimport {cx} from '../utils'\nimport {Tooltip} from './Tooltip'\nimport {\n File,\n FileArchive,\n FileAudio,\n FileCode,\n FileImage,\n FileText,\n FileVideo,\n Loader2,\n X\n} from 'lucide-react'\n\nexport type FileChipStatus =\n | 'pending'\n | 'uploading'\n | 'uploaded'\n | 'analyzing'\n | 'analyzed'\n | 'upload_failed'\n | 'analysis_failed'\n\nexport interface FileChipProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'onClick'> {\n /**\n * File name to display\n */\n name: string\n /**\n * File size in bytes (optional, will be formatted)\n */\n size?: number\n /**\n * MIME type for icon selection\n */\n type?: string\n /**\n * Upload/processing status\n */\n status?: FileChipStatus\n /**\n * Preview image URL (for images)\n */\n previewUrl?: string\n /**\n * Called when the remove button is clicked\n */\n onRemove?: () => void\n /**\n * Whether the chip is removable\n */\n removable?: boolean\n /**\n * Error message to display (when status is an error)\n */\n error?: string\n /**\n * Backend artifact id, set once the upload has been integrated. When both\n * `artifactId` and `onOpen` are present, the chip becomes clickable.\n */\n artifactId?: string\n /**\n * Click handler invoked with `artifactId` when the chip is clicked.\n * Compose-box (pre-integrate) chips should not pass this — the chip stays\n * non-clickable except for its remove button.\n */\n onOpen?: (artifactId: string) => void\n}\n\n/**\n * Format bytes to human-readable string\n */\nfunction formatBytes(bytes: number): string {\n if (bytes === 0) {\n return '0 B'\n }\n const k = 1024\n const sizes = ['B', 'KB', 'MB', 'GB']\n const i = Math.floor(Math.log(bytes) / Math.log(k))\n return `${parseFloat((bytes / Math.pow(k, i)).toFixed(1))} ${sizes[i]}`\n}\n\n/**\n * Get icon component based on MIME type\n */\nfunction getFileIcon(type?: string) {\n if (!type) {\n return File\n }\n\n if (type.startsWith('image/')) {\n return FileImage\n }\n if (type.startsWith('video/')) {\n return FileVideo\n }\n if (type.startsWith('audio/')) {\n return FileAudio\n }\n if (type.startsWith('text/')) {\n return FileText\n }\n if (type.includes('javascript') || type.includes('typescript') || type.includes('json')\n || type.includes('xml')) {\n return FileCode\n }\n if (type.includes('zip') || type.includes('rar') || type.includes('tar') || type.includes('gz')) {\n return FileArchive\n }\n\n return File\n}\n\nconst statusBorderClass: Record<FileChipStatus, string> = {\n pending: 'border-silver/30',\n uploading: 'border-gold/50',\n uploaded: 'border-info/50',\n analyzing: 'border-info/50',\n analyzed: 'border-success/50',\n upload_failed: 'border-error/50',\n analysis_failed: 'border-error/50',\n}\n\nconst statusHoverLabel: Record<FileChipStatus, string | null> = {\n pending: null,\n uploading: 'Uploading',\n uploaded: 'Analyzing',\n analyzing: 'Analyzing',\n analyzed: null,\n upload_failed: 'Upload failed',\n analysis_failed: \"Couldn't process this file\",\n}\n\nfunction isErrorStatus(status: FileChipStatus): boolean {\n return status === 'upload_failed' || status === 'analysis_failed'\n}\n\nexport const FileChip = React.forwardRef<HTMLDivElement, FileChipProps>(\n (\n {\n name,\n size,\n type,\n status = 'analyzed',\n previewUrl,\n onRemove,\n removable = true,\n error,\n artifactId,\n onOpen,\n className,\n title,\n ...rest\n },\n ref\n ) => {\n const Icon = getFileIcon(type)\n const isImage = type?.startsWith('image/')\n const showPreview = isImage && previewUrl\n\n const clickable = !!(artifactId && onOpen)\n const hoverLabel = statusHoverLabel[status]\n // Tooltip on hover/focus surfaces the lifecycle state. Errors take\n // precedence over the generic status label so the user sees the\n // specific reason. `analyzed` chips have no tooltip — the chip is\n // interactive on its own and the filename in the strip already names\n // it.\n const tooltipContent: string | null = isErrorStatus(status)\n ? (error ?? hoverLabel ?? null)\n : hoverLabel\n const [hovered, setHovered] = useState(false)\n const [focused, setFocused] = useState(false)\n const showError = isErrorStatus(status)\n\n const handleClick = () => {\n if (clickable) {\n onOpen!(artifactId!)\n }\n }\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (!clickable) {\n return\n }\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n onOpen!(artifactId!)\n }\n }\n\n const tooltipOpen = tooltipContent !== null && (hovered || focused)\n\n const chip = (\n <div\n {...rest}\n ref={ref}\n className={cx(\n 'group relative inline-flex items-center gap-2 px-2 py-1.5',\n 'bg-charcoal border text-sm text-white',\n 'transition-colors duration-150',\n statusBorderClass[status],\n showError && 'bg-error/10',\n clickable && 'cursor-pointer hover:bg-graphite',\n className\n )}\n role={clickable ? 'button' : 'listitem'}\n tabIndex={clickable ? 0 : undefined}\n onClick={clickable ? handleClick : undefined}\n onKeyDown={clickable ? handleKeyDown : undefined}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n title={title}\n aria-label={hoverLabel ? `${name}: ${hoverLabel}` : name}\n >\n {/* Preview thumbnail or icon */}\n {showPreview ? (\n <div className=\"w-8 h-8 flex-shrink-0 overflow-hidden bg-slate\">\n <img\n src={previewUrl}\n alt=\"\"\n className=\"w-full h-full object-cover\"\n />\n </div>\n ) : (\n <Icon className={cx(\n 'w-4 h-4 flex-shrink-0',\n showError ? 'text-error' : 'text-silver'\n )}/>\n )}\n\n {/* File info */}\n <div className=\"flex flex-col min-w-0 flex-1\">\n <span className=\"truncate max-w-40\" title={name}>\n {name}\n </span>\n {size !== undefined && !showError && (\n <span className=\"text-xs text-silver/60\">\n {formatBytes(size)}\n </span>\n )}\n {showError && error && (\n <span className=\"text-xs text-error truncate\" title={error}>\n {error}\n </span>\n )}\n </div>\n\n {/* Status indicator */}\n {status === 'uploading' && (\n <Loader2 className=\"w-3.5 h-3.5 text-gold animate-spin flex-shrink-0\"/>\n )}\n {(status === 'uploaded' || status === 'analyzing') && (\n <Loader2 className=\"w-3.5 h-3.5 text-info animate-spin flex-shrink-0\"/>\n )}\n {status === 'pending' && (\n <div className=\"w-2 h-2 rounded-full bg-silver/50 flex-shrink-0\"/>\n )}\n\n {/* Remove button */}\n {removable && onRemove && (\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation()\n onRemove()\n }}\n className={cx(\n 'p-0.5 text-silver/40 hover:text-white transition-colors',\n 'hover:bg-white/10',\n 'opacity-0 group-hover:opacity-100',\n 'focus:opacity-100'\n )}\n aria-label={`Remove ${name}`}\n >\n <X className=\"w-3.5 h-3.5\"/>\n </button>\n )}\n </div>\n )\n\n if (tooltipContent === null) {\n return chip\n }\n return (\n <Tooltip content={tooltipContent} open={tooltipOpen} side=\"top\">\n {chip}\n </Tooltip>\n )\n }\n)\n\nFileChip.displayName = 'FileChip'\n\nexport default FileChip\n","import React from 'react'\nimport {X} from 'lucide-react'\nimport {cx} from '../utils'\nimport {Tooltip} from './Tooltip'\n\nexport interface MentionChipProps\n extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children' | 'onClick'> {\n /**\n * The artifact name (the @-handle, without the leading @).\n */\n name: string\n /**\n * Optional human-readable title; shown in the hover tooltip alongside the name.\n */\n title?: string\n /**\n * Optional icon rendered before the name — typically a kind glyph (e.g. `FileImage`,\n * `FileVideo`) or `HelpCircle` for unknown / stale references. Sized at `w-3 h-3` to\n * match the chip's text scale.\n */\n leadingIcon?: React.ReactNode\n /**\n * Called when the chip is clicked. When provided, the chip becomes keyboard-focusable\n * and gains a hover affordance.\n */\n onClick?: () => void\n /**\n * Called when the remove (×) button is clicked. When provided, an × appears on hover/focus.\n * Use only on input-side previews; rendered messages should leave this unset.\n */\n onRemove?: () => void\n}\n\n/**\n * Inline chip representing an `@name` artifact mention. Use anywhere a stable reference to a\n * project artifact appears — typed input previews, rendered chat messages, deliverable\n * descriptions. Renders the name in monospace with a leading `@` glyph and a gold-tinted border,\n * mirroring the addressable handle the user sees on the artifact card.\n *\n * Pair with the `Combobox` primitive for the typing surface, and with the\n * `MarkdownContent` `mentionRenderer` prop to render mentions inline inside rendered chat\n * messages — typically `mentionRenderer={(name) => <MentionChip name={name} … />}`.\n */\nexport const MentionChip = React.forwardRef<HTMLSpanElement, MentionChipProps>(\n ({name, title, leadingIcon, onClick, onRemove, className, ...rest}, ref) => {\n const clickable = !!onClick\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLSpanElement>) => {\n if (!clickable) {\n return\n }\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n onClick!()\n }\n }\n\n const chip = (\n <span\n {...rest}\n ref={ref}\n role={clickable ? 'button' : undefined}\n tabIndex={clickable ? 0 : undefined}\n onClick={clickable ? onClick : undefined}\n onKeyDown={clickable ? handleKeyDown : undefined}\n className={cx(\n // `aurelius-mention` (defined in theme.css) supplies the\n // colour palette via CSS variables so the parent prose\n // context (.prose-inherit user bubble vs .prose-invert\n // assistant bubble) can override defaults via the cascade —\n // no per-call variant prop or context wiring.\n 'aurelius-mention',\n 'group relative inline-flex items-center gap-1 align-baseline',\n 'px-1.5 py-0.5 text-xs font-mono border',\n clickable && 'cursor-pointer focus:outline-none '\n + 'focus-visible:ring-1 focus-visible:ring-current',\n className\n )}\n aria-label={title ? `${name}: ${title}` : name}\n >\n {leadingIcon && (\n <span className=\"shrink-0 inline-flex items-center\">{leadingIcon}</span>\n )}\n <span className=\"truncate max-w-40\">\n <span className=\"opacity-60\">@</span>{name}\n </span>\n {onRemove && (\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation()\n onRemove()\n }}\n className={cx(\n 'aurelius-mention-x',\n 'p-0.5 -mr-0.5 transition-colors',\n 'opacity-0 group-hover:opacity-100 focus:opacity-100'\n )}\n aria-label={`Remove mention of ${name}`}\n >\n <X className=\"w-3 h-3\"/>\n </button>\n )}\n </span>\n )\n\n if (!title) {\n return chip\n }\n return (\n <Tooltip content={title} side=\"top\">\n {chip}\n </Tooltip>\n )\n }\n)\n\nMentionChip.displayName = 'MentionChip'\n\nexport default MentionChip\n","import React, {useCallback, useEffect, useRef, useState} from 'react'\nimport {cx} from '../utils'\n\nexport interface ComboboxProps<T> extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {\n /**\n * Items to display in the panel. The caller is responsible for filtering before passing.\n */\n items: T[]\n /**\n * Index of the currently highlighted (focused, not yet picked) item. Drive this from\n * `useComboboxNav` for the standard arrow-key behaviour, or manage it yourself.\n */\n selectedIndex: number\n /**\n * Render one row. `isSelected` reflects the keyboard highlight; click and hover styling\n * are applied by the panel.\n */\n renderItem: (item: T, isSelected: boolean) => React.ReactNode\n /**\n * Called when the user clicks a row. Use the same handler you call from the keyboard's\n * Enter key to keep mouse and keyboard paths consistent.\n */\n onSelectItem: (item: T) => void\n /**\n * Stable key per item. Required because the panel re-mounts rows when `items` changes.\n */\n getItemKey: (item: T) => string\n /**\n * Optional node rendered when `items` is empty. Skip the panel entirely if you'd rather\n * hide it on no-match.\n */\n emptyState?: React.ReactNode\n /**\n * Maximum pixel height of the scrollable list. The panel itself sizes to its content\n * up to this cap; rows beyond it scroll within the panel.\n * @default 256\n */\n maxHeight?: number\n}\n\n/**\n * Floating panel for inline autocompletes — `@`-mention pickers, slash-command menus, and\n * the like. The panel is unstyled-positioned (`absolute`) so the caller controls placement\n * via wrapper, `style`, or by mounting it inside their own positioned container; this keeps\n * the component agnostic to how the trigger position is computed (caret coordinates, ref\n * rect, popover anchor).\n *\n * Pair with `useComboboxNav` for the standard arrow-key + Enter/Escape behaviour.\n */\nexport function Combobox<T>(\n {items, selectedIndex, renderItem, onSelectItem, getItemKey, emptyState,\n maxHeight = 256, className, ...rest}:\n ComboboxProps<T>,\n) {\n const listRef = useRef<HTMLUListElement>(null)\n\n // Keep the highlighted row scrolled into view when the user navigates past\n // the visible range with the keyboard.\n useEffect(() => {\n const list = listRef.current\n if (!list) {\n return\n }\n const selectedNode = list.children.item(selectedIndex) as HTMLElement | null\n selectedNode?.scrollIntoView({block: 'nearest'})\n }, [selectedIndex])\n\n if (items.length === 0 && !emptyState) {\n return null\n }\n\n return (\n <div\n {...rest}\n role=\"listbox\"\n className={cx(\n 'absolute z-50 min-w-48 max-w-sm',\n 'bg-charcoal border border-ash shadow-lg',\n 'animate-fade-in',\n className\n )}\n >\n {items.length === 0 ? (\n <div className=\"px-3 py-2 text-sm text-silver/60\">{emptyState}</div>\n ) : (\n <ul ref={listRef}\n style={{maxHeight}}\n className=\"list-none m-0 p-0 overflow-y-auto\">\n {items.map((item, i) => {\n const isSelected = i === selectedIndex\n return (\n <li\n key={getItemKey(item)}\n role=\"option\"\n aria-selected={isSelected}\n onMouseDown={(e) => {\n // Prevent the input from losing focus on mouse-down so the\n // pick-and-insert flow keeps the textarea active.\n e.preventDefault()\n onSelectItem(item)\n }}\n className={cx(\n 'cursor-pointer',\n isSelected ? 'bg-gold/10' : 'hover:bg-graphite'\n )}\n >\n {renderItem(item, isSelected)}\n </li>\n )\n })}\n </ul>\n )}\n </div>\n )\n}\n\n/**\n * Result of `useComboboxNav`. Forward `handleKeyDown` from the input element that owns focus\n * (typically a textarea); it returns true when it consumed the event so the caller knows to\n * skip its own handling.\n */\nexport interface ComboboxNav {\n selectedIndex: number\n setSelectedIndex: (index: number) => void\n /**\n * Standard handler for ArrowUp / ArrowDown / Enter / Escape. Returns true when a key was\n * consumed — the caller should skip its own handling for those events.\n */\n handleKeyDown: (e: React.KeyboardEvent) => boolean\n}\n\nexport interface UseComboboxNavOptions<T> {\n items: T[]\n /**\n * Called when the user presses Enter on the highlighted item.\n */\n onSelect: (item: T) => void\n /**\n * Called when the user presses Escape.\n */\n onDismiss: () => void\n}\n\n/**\n * Standard keyboard nav for an inline autocomplete: ArrowUp / ArrowDown wrap through items,\n * Enter selects the highlighted item, Escape dismisses. Resets the highlight to 0 whenever\n * the items array changes (reference equality), so a fresh filter result starts at the top.\n */\nexport function useComboboxNav<T>(\n {items, onSelect, onDismiss}: UseComboboxNavOptions<T>): ComboboxNav {\n const [selectedIndex, setSelectedIndex] = useState(0)\n\n // Reset on length change rather than reference change — consumers commonly produce a\n // fresh `items` array each render (e.g. an inline filter), and resetting on every render\n // would clobber arrow-key navigation. Length is the load-bearing signal: a typed\n // character changes the filter length and the user expects to start from the top.\n useEffect(() => {\n setSelectedIndex(0)\n }, [items.length])\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (items.length === 0) {\n if (e.key === 'Escape') {\n e.preventDefault()\n onDismiss()\n return true\n }\n return false\n }\n\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault()\n setSelectedIndex((i) => (i + 1) % items.length)\n return true\n case 'ArrowUp':\n e.preventDefault()\n setSelectedIndex((i) => (i - 1 + items.length) % items.length)\n return true\n case 'Enter':\n case 'Tab':\n e.preventDefault()\n onSelect(items[selectedIndex])\n return true\n case 'Escape':\n e.preventDefault()\n onDismiss()\n return true\n default:\n return false\n }\n },\n [items, onSelect, onDismiss, selectedIndex]\n )\n\n return {selectedIndex, setSelectedIndex, handleKeyDown}\n}\n","import React from 'react'\nimport {cx} from '../utils'\nimport {FileChip, type FileChipStatus} from './FileChip'\n\nexport interface AttachmentItem {\n /**\n * Unique identifier\n */\n id: string\n /**\n * The file's name, size and MIME type. A real `File` object satisfies this\n * shape — compose-box callers pass File instances directly. Above-message\n * (post-send) rendering supplies a synthetic record built from persisted\n * attachment metadata.\n */\n file: Pick<File, 'name' | 'size' | 'type'>\n /**\n * Blob URL for image previews\n */\n previewUrl?: string\n /**\n * Current status\n */\n status: FileChipStatus\n /**\n * Error message if status is an error variant\n */\n error?: string\n /**\n * Backend artifact id, set once the upload has been integrated. Required to\n * make the chip clickable to open the artifact card modal.\n */\n artifactId?: string\n}\n\nexport interface AttachmentPreviewProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Array of attachments to display\n */\n attachments: AttachmentItem[]\n /**\n * Called when an attachment should be removed\n */\n onRemove?: (id: string) => void\n /**\n * Whether attachments are removable\n */\n removable?: boolean\n /**\n * Maximum number of attachments to show before collapsing\n * Set to 0 or undefined to show all\n */\n maxVisible?: number\n /**\n * Click handler for chips with an artifactId. When set, chips that carry an\n * artifactId become clickable and forward the id to this handler.\n */\n onOpen?: (artifactId: string) => void\n}\n\nexport const AttachmentPreview = React.forwardRef<HTMLDivElement, AttachmentPreviewProps>(\n (\n {\n attachments,\n onRemove,\n removable = true,\n maxVisible,\n onOpen,\n className,\n ...rest\n },\n ref\n ) => {\n if (attachments.length === 0) {\n return null\n }\n\n const visibleAttachments = maxVisible && maxVisible > 0\n ? attachments.slice(0, maxVisible)\n : attachments\n\n const hiddenCount = maxVisible && maxVisible > 0\n ? Math.max(0, attachments.length - maxVisible)\n : 0\n\n return (\n <div\n ref={ref}\n className={cx('flex flex-wrap gap-2', className)}\n role=\"list\"\n aria-label=\"Attached files\"\n {...rest}\n >\n {visibleAttachments.map((attachment) => (\n <FileChip\n key={attachment.id}\n name={attachment.file.name}\n size={attachment.file.size}\n type={attachment.file.type}\n status={attachment.status}\n previewUrl={attachment.previewUrl}\n error={attachment.error}\n removable={removable}\n onRemove={onRemove ? () => onRemove(attachment.id) : undefined}\n artifactId={attachment.artifactId}\n onOpen={onOpen}\n />\n ))}\n {hiddenCount > 0 && (\n <div\n className=\"inline-flex items-center px-2 py-1.5 bg-charcoal border border-silver/30 text-sm text-silver\">\n +{hiddenCount} more\n </div>\n )}\n </div>\n )\n }\n)\n\nAttachmentPreview.displayName = 'AttachmentPreview'\n\nexport default AttachmentPreview\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {\n required?: boolean\n}\n\nexport const Label = React.forwardRef<HTMLLabelElement, LabelProps>(\n ({className, required, children, ...rest}, ref) => {\n return (\n <label\n ref={ref}\n className={cx('block text-sm font-medium text-silver mb-1.5', className)}\n {...rest}\n >\n {children}\n {required && <span className=\"text-error ml-1\">*</span>}\n </label>\n )\n }\n)\n\nLabel.displayName = 'Label'\n\nexport default Label\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport interface HelperTextProps extends React.HTMLAttributes<HTMLParagraphElement> {\n error?: boolean\n}\n\nexport const HelperText = React.forwardRef<HTMLParagraphElement, HelperTextProps>(\n ({className, error, children, ...rest}, ref) => {\n return (\n <p\n ref={ref}\n className={cx('mt-1.5 text-xs', error ? 'text-error' : 'text-silver', className)}\n {...rest}\n >\n {children}\n </p>\n )\n }\n)\n\nHelperText.displayName = 'HelperText'\n\nexport default HelperText\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {\n error?: boolean\n}\n\nexport const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n ({error = false, className, disabled, ...rest}, ref) => {\n // Base textarea styles\n const base =\n 'w-full px-3 py-2 bg-graphite border border-ash rounded-none ' +\n 'text-white placeholder:text-zinc min-h-[80px] ' +\n 'transition-all duration-fast ' +\n 'focus:border-gold focus:ring-1 focus:ring-gold focus:outline-none ' +\n 'disabled:bg-slate disabled:text-dim disabled:cursor-not-allowed'\n\n // Error styles\n const errorCls = error ? 'border-error focus:border-error focus:ring-error' : ''\n\n return (\n <textarea\n ref={ref}\n className={cx(base, errorCls, disabled && 'opacity-90', className)}\n disabled={disabled}\n {...rest}\n />\n )\n }\n)\n\nTextarea.displayName = 'Textarea'\n\nexport default Textarea\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport interface SelectOption {\n label: string\n value: string | number\n}\n\nexport interface SelectProps extends React.SelectHTMLAttributes<HTMLSelectElement> {\n error?: boolean\n options?: SelectOption[]\n}\n\nconst selectBgImage = \"url(\\\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23C9A227' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e\\\")\"\n\nexport const Select = React.forwardRef<HTMLSelectElement, SelectProps>(\n ({error = false, className, disabled, options, children, ...rest}, ref) => {\n return (\n <select\n ref={ref}\n className={cx(\n 'appearance-none bg-graphite border border-ash rounded-none text-white px-3 py-2 pr-8',\n 'focus:border-gold focus:ring-1 focus:ring-gold focus:outline-none',\n 'disabled:opacity-50 disabled:cursor-not-allowed',\n error && 'border-error focus:border-error focus:ring-error',\n className\n )}\n style={{\n backgroundImage: selectBgImage,\n backgroundPosition: 'right 0.5rem center',\n backgroundRepeat: 'no-repeat',\n backgroundSize: '1.5em 1.5em',\n }}\n disabled={disabled}\n {...rest}\n >\n {options\n ? options.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))\n : children}\n </select>\n )\n }\n)\n\nSelect.displayName = 'Select'\n\nexport default Select\n","import React, {useCallback, useId} from 'react'\nimport {composeRefs, cx} from '../utils'\n\nexport interface CheckboxProps extends React.InputHTMLAttributes<HTMLInputElement> {\n label?: string\n}\n\nconst checkmarkSvg = \"url(\\\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='%231A1A1A' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e\\\")\"\n\nexport const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(\n ({className, label, id, onChange, ...rest}, ref) => {\n const generatedId = useId()\n const inputId = id || rest.name || generatedId\n\n const initBackground = useCallback((node: HTMLInputElement | null) => {\n if (node && node.checked) {\n node.style.backgroundImage = checkmarkSvg\n }\n }, [])\n\n const handleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n e.currentTarget.style.backgroundImage = e.currentTarget.checked ? checkmarkSvg : 'none'\n onChange?.(e)\n }, [onChange])\n\n return (\n <div className=\"flex items-center\">\n <input\n {...rest}\n type=\"checkbox\"\n id={inputId}\n ref={composeRefs(initBackground, ref)}\n className={cx(\n 'appearance-none h-4 w-4 border border-ash bg-graphite',\n 'checked:bg-gold checked:border-gold',\n 'focus:ring-1 focus:ring-gold focus:ring-offset-1 focus:ring-offset-obsidian',\n 'transition duration-200 ease-in-out cursor-pointer',\n 'disabled:opacity-50 disabled:cursor-not-allowed',\n className\n )}\n style={{\n backgroundPosition: 'center',\n backgroundSize: 'contain',\n backgroundRepeat: 'no-repeat',\n }}\n onChange={handleChange}\n />\n {label && (\n <label htmlFor={inputId}\n className=\"ml-2 text-sm text-silver cursor-pointer select-none\">\n {label}\n </label>\n )}\n </div>\n )\n }\n)\n\nCheckbox.displayName = 'Checkbox'\n\nexport default Checkbox\n","import React, {useCallback, useId} from 'react'\nimport {composeRefs, cx} from '../utils'\n\nexport interface RadioProps extends React.InputHTMLAttributes<HTMLInputElement> {\n label?: string\n}\n\nconst radioDotSvg = \"url(\\\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='%231A1A1A' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e\\\")\"\n\nexport const Radio = React.forwardRef<HTMLInputElement, RadioProps>(\n ({className, label, id, onChange, ...rest}, ref) => {\n const generatedId = useId()\n const inputId = id || rest.name || generatedId\n\n const initBackground = useCallback((node: HTMLInputElement | null) => {\n if (node && node.checked) {\n node.style.backgroundImage = radioDotSvg\n }\n }, [])\n\n const handleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const input = e.currentTarget\n if (input.checked) {\n input.style.backgroundImage = radioDotSvg\n // Clear other radios in the same group. Browsers already uncheck siblings,\n // but the inline-style background dot doesn't get a change event there.\n if (input.name) {\n const escaped = typeof CSS !== 'undefined' && typeof CSS.escape === 'function'\n ? CSS.escape(input.name)\n : input.name.replace(/[\"\\\\\\]]/g, '\\\\$&')\n const radios = input.ownerDocument.querySelectorAll<HTMLInputElement>(\n `input[type=\"radio\"][name=\"${escaped}\"]`)\n radios.forEach((radio) => {\n if (radio !== input) {\n radio.style.backgroundImage = 'none'\n }\n })\n }\n } else {\n input.style.backgroundImage = 'none'\n }\n onChange?.(e)\n }, [onChange])\n\n return (\n <div className=\"flex items-center\">\n <input\n {...rest}\n type=\"radio\"\n id={inputId}\n ref={composeRefs(initBackground, ref)}\n className={cx(\n 'appearance-none h-4 w-4 border border-ash rounded-full bg-graphite',\n 'checked:bg-gold checked:border-gold',\n 'focus:ring-1 focus:ring-gold focus:ring-offset-1 focus:ring-offset-obsidian',\n 'transition duration-200 ease-in-out cursor-pointer',\n 'disabled:opacity-50 disabled:cursor-not-allowed',\n className\n )}\n style={{\n backgroundPosition: 'center',\n backgroundSize: 'contain',\n backgroundRepeat: 'no-repeat',\n }}\n onChange={handleChange}\n />\n {label && (\n <label htmlFor={inputId}\n className=\"ml-2 text-sm text-silver cursor-pointer select-none\">\n {label}\n </label>\n )}\n </div>\n )\n }\n)\n\nRadio.displayName = 'Radio'\n\nexport default Radio\n","import React, {useCallback, useRef, useState} from 'react'\nimport {cx} from '../utils/cx'\n\nexport interface SwitchProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onChange'> {\n checked?: boolean\n defaultChecked?: boolean\n onCheckedChange?: (checked: boolean) => void\n label?: string\n}\n\nexport const Switch = React.forwardRef<HTMLButtonElement, SwitchProps>(\n ({\n checked: controlledChecked,\n defaultChecked = false,\n onCheckedChange,\n disabled,\n className,\n label,\n ...rest\n }, ref) => {\n const [internalChecked, setInternalChecked] = useState(defaultChecked)\n const isControlled = controlledChecked !== undefined\n const checked = isControlled ? controlledChecked : internalChecked\n const buttonRef = useRef<HTMLButtonElement | null>(null)\n const setRefs = useCallback(\n (node: HTMLButtonElement | null) => {\n buttonRef.current = node\n if (typeof ref === 'function') {\n ref(node)\n } else if (ref) {\n ref.current = node\n }\n },\n [ref]\n )\n\n const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n if (disabled) {\n return\n }\n const newChecked = !checked\n if (!isControlled) {\n setInternalChecked(newChecked)\n }\n onCheckedChange?.(newChecked)\n rest.onClick?.(e)\n }\n\n return (\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={checked}\n data-state={checked ? 'checked' : 'unchecked'}\n disabled={disabled}\n ref={setRefs}\n onClick={handleClick}\n className={cx(\n 'relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent',\n 'transition-colors duration-200 ease-in-out',\n 'focus:outline-none focus-visible:ring-2 focus-visible:ring-gold focus-visible:ring-offset-2 focus-visible:ring-offset-obsidian',\n 'disabled:opacity-50 disabled:cursor-not-allowed',\n checked ? 'bg-gold' : 'bg-charcoal',\n className\n )}\n {...rest}\n >\n <span\n className={cx(\n 'pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0',\n 'transition duration-200 ease-in-out',\n checked ? 'translate-x-5' : 'translate-x-0'\n )}\n />\n </button>\n {label && (\n <span\n className=\"text-sm text-silver cursor-pointer\"\n onClick={() => {\n if (disabled) {\n return\n }\n buttonRef.current?.click()\n }}\n >\n {label}\n </span>\n )}\n </div>\n )\n }\n)\n\nSwitch.displayName = 'Switch'\n\nexport default Switch\n","import React, {useCallback, useRef, useState} from 'react'\nimport {cx} from '../utils/cx'\n\nexport interface SliderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {\n value?: number\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n onChange?: (value: number) => void\n onChangeEnd?: (value: number) => void\n disabled?: boolean\n showTooltip?: boolean\n formatValue?: (value: number) => string\n size?: 'sm' | 'md' | 'lg'\n}\n\nconst SIZE_TRACK: Record<string, string> = {\n sm: 'h-1',\n md: 'h-2',\n lg: 'h-3',\n}\n\nconst SIZE_THUMB: Record<string, string> = {\n sm: 'h-3 w-3',\n md: 'h-4 w-4',\n lg: 'h-5 w-5',\n}\n\nexport const Slider = React.forwardRef<HTMLDivElement, SliderProps>(\n (\n {\n value: controlledValue,\n defaultValue = 0,\n min = 0,\n max = 100,\n step = 1,\n onChange,\n onChangeEnd,\n disabled = false,\n showTooltip = false,\n formatValue = (v) => String(v),\n size = 'md',\n className,\n ...props\n },\n ref\n ) => {\n const [internalValue, setInternalValue] = useState(defaultValue)\n const [isDragging, setIsDragging] = useState(false)\n const trackRef = useRef<HTMLDivElement>(null)\n\n const isControlled = controlledValue !== undefined\n const value = isControlled ? controlledValue : internalValue\n\n const percentage = ((value - min) / (max - min)) * 100\n\n const updateValue = useCallback(\n (clientX: number) => {\n if (!trackRef.current || disabled) {\n return\n }\n\n const rect = trackRef.current.getBoundingClientRect()\n const percent = Math.max(0, Math.min(1, (clientX - rect.left) / rect.width))\n const rawValue = min + percent * (max - min)\n const steppedValue = Math.round(rawValue / step) * step\n const clampedValue = Math.max(min, Math.min(max, steppedValue))\n\n if (!isControlled) {\n setInternalValue(clampedValue)\n }\n onChange?.(clampedValue)\n },\n [min, max, step, disabled, isControlled, onChange]\n )\n\n const handleMouseDown = (e: React.MouseEvent) => {\n if (disabled) {\n return\n }\n setIsDragging(true)\n updateValue(e.clientX)\n\n const handleMouseMove = (e: MouseEvent) => {\n updateValue(e.clientX)\n }\n\n const handleMouseUp = (e: MouseEvent) => {\n setIsDragging(false)\n document.removeEventListener('mousemove', handleMouseMove)\n document.removeEventListener('mouseup', handleMouseUp)\n\n if (trackRef.current) {\n const rect = trackRef.current.getBoundingClientRect()\n const percent = Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width))\n const rawValue = min + percent * (max - min)\n const steppedValue = Math.round(rawValue / step) * step\n const clampedValue = Math.max(min, Math.min(max, steppedValue))\n onChangeEnd?.(clampedValue)\n }\n }\n\n document.addEventListener('mousemove', handleMouseMove)\n document.addEventListener('mouseup', handleMouseUp)\n }\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n if (disabled) {\n return\n }\n\n let newValue = value\n switch (e.key) {\n case 'ArrowRight':\n case 'ArrowUp':\n newValue = Math.min(max, value + step)\n break\n case 'ArrowLeft':\n case 'ArrowDown':\n newValue = Math.max(min, value - step)\n break\n case 'Home':\n newValue = min\n break\n case 'End':\n newValue = max\n break\n default:\n return\n }\n\n e.preventDefault()\n if (!isControlled) {\n setInternalValue(newValue)\n }\n onChange?.(newValue)\n onChangeEnd?.(newValue)\n }\n\n return (\n <div\n ref={ref}\n className={cx('relative w-full py-2', disabled && 'opacity-50', className)}\n {...props}\n >\n <div\n ref={trackRef}\n className={cx(\n 'relative w-full bg-charcoal border border-ash cursor-pointer',\n SIZE_TRACK[size]\n )}\n onMouseDown={handleMouseDown}\n >\n {/* Filled track */}\n <div\n className={cx('absolute inset-y-0 left-0 bg-gold', SIZE_TRACK[size])}\n style={{width: `${percentage}%`}}\n />\n\n {/* Thumb */}\n <div\n role=\"slider\"\n tabIndex={disabled ? -1 : 0}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-valuenow={value}\n aria-disabled={disabled}\n onKeyDown={handleKeyDown}\n className={cx(\n 'absolute top-1/2 -translate-y-1/2 -translate-x-1/2',\n 'bg-gold border-2 border-gold-light rounded-full',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gold focus-visible:ring-offset-2 focus-visible:ring-offset-obsidian',\n 'transition-transform duration-fast',\n isDragging && 'scale-110',\n !disabled && 'cursor-grab active:cursor-grabbing',\n SIZE_THUMB[size]\n )}\n style={{left: `${percentage}%`}}\n >\n {/* Tooltip */}\n {showTooltip && isDragging && (\n <div\n className=\"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-graphite border border-ash text-xs text-white whitespace-nowrap\">\n {formatValue(value)}\n </div>\n )}\n </div>\n </div>\n </div>\n )\n }\n)\n\nSlider.displayName = 'Slider'\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\n// InputGroup container\nexport interface InputGroupProps extends React.HTMLAttributes<HTMLDivElement> {\n}\n\nexport const InputGroup = React.forwardRef<HTMLDivElement, InputGroupProps>(\n ({className, children, ...props}, ref) => {\n return (\n <div\n ref={ref}\n className={cx('flex', className)}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nInputGroup.displayName = 'InputGroup'\n\n// InputLeftAddon - static text/icon on the left\nexport interface InputAddonProps extends React.HTMLAttributes<HTMLDivElement> {\n}\n\nexport const InputLeftAddon = React.forwardRef<HTMLDivElement, InputAddonProps>(\n ({className, children, ...props}, ref) => {\n return (\n <div\n ref={ref}\n className={cx(\n 'flex items-center px-3 bg-slate border border-r-0 border-ash',\n 'text-sm text-silver whitespace-nowrap',\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nInputLeftAddon.displayName = 'InputLeftAddon'\n\n// InputRightAddon - static text/icon on the right\nexport const InputRightAddon = React.forwardRef<HTMLDivElement, InputAddonProps>(\n ({className, children, ...props}, ref) => {\n return (\n <div\n ref={ref}\n className={cx(\n 'flex items-center px-3 bg-slate border border-l-0 border-ash',\n 'text-sm text-silver whitespace-nowrap',\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nInputRightAddon.displayName = 'InputRightAddon'\n\n// InputLeftElement - overlaid element on the left (like an icon inside the input)\nexport interface InputElementProps extends React.HTMLAttributes<HTMLDivElement> {\n}\n\nexport const InputLeftElement = React.forwardRef<HTMLDivElement, InputElementProps>(\n ({className, children, ...props}, ref) => {\n return (\n <div\n ref={ref}\n className={cx(\n 'absolute left-0 inset-y-0 flex items-center pl-3',\n 'pointer-events-none text-silver',\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nInputLeftElement.displayName = 'InputLeftElement'\n\n// InputRightElement - overlaid element on the right (like a button inside the input)\nexport const InputRightElement = React.forwardRef<HTMLDivElement, InputElementProps>(\n ({className, children, ...props}, ref) => {\n return (\n <div\n ref={ref}\n className={cx(\n 'absolute right-0 inset-y-0 flex items-center pr-3',\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nInputRightElement.displayName = 'InputRightElement'\n\n// InputWrapper - for relative positioning when using left/right elements\nexport interface InputWrapperProps extends React.HTMLAttributes<HTMLDivElement> {\n}\n\nexport const InputWrapper = React.forwardRef<HTMLDivElement, InputWrapperProps>(\n ({className, children, ...props}, ref) => {\n return (\n <div\n ref={ref}\n className={cx('relative flex-1', className)}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nInputWrapper.displayName = 'InputWrapper'\n","import React from 'react'\nimport {AlertTriangle, CheckCircle, Info, XCircle} from 'lucide-react'\nimport {cx} from '../utils/cx'\n\nexport type AlertVariant = 'info' | 'success' | 'warning' | 'error'\n\nexport interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {\n variant?: AlertVariant\n title?: string\n}\n\nconst icons = {\n info: Info,\n success: CheckCircle,\n warning: AlertTriangle,\n error: XCircle,\n}\n\nconst variantStyles = {\n info: 'bg-info/10 border-info text-info',\n success: 'bg-success/10 border-success text-success',\n warning: 'bg-warning/10 border-warning text-warning',\n error: 'bg-error/10 border-error text-error',\n}\n\nexport const Alert = React.forwardRef<HTMLDivElement, AlertProps>(\n ({variant = 'info', title, children, className, ...rest}, ref) => {\n const Icon = icons[variant]\n\n return (\n <div\n ref={ref}\n role=\"alert\"\n className={cx(\n 'relative w-full p-4 rounded-none border border-l-4 flex gap-3',\n variantStyles[variant],\n className\n )}\n {...rest}\n >\n <Icon className=\"h-5 w-5 shrink-0\"/>\n <div className=\"flex-1\">\n {title && <h5\n className=\"mb-1 font-medium leading-none tracking-tight text-current\">{title}</h5>}\n <div className=\"text-sm opacity-90\">{children}</div>\n </div>\n </div>\n )\n }\n)\n\nAlert.displayName = 'Alert'\n\nexport default Alert\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type SpinnerSize = 'sm' | 'md' | 'lg'\n\nexport interface SpinnerProps extends React.SVGAttributes<SVGElement> {\n size?: SpinnerSize\n}\n\nexport const Spinner = ({className, size = 'md', ...rest}: SpinnerProps) => {\n const sizeClass =\n size === 'sm' ? 'h-4 w-4' : size === 'lg' ? 'h-8 w-8' : 'h-6 w-6'\n\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={cx('animate-spin text-gold', sizeClass, className)}\n {...rest}\n >\n <path d=\"M21 12a9 9 0 1 1-6.219-8.56\"/>\n </svg>\n )\n}\n\nSpinner.displayName = 'Spinner'\n\nexport default Spinner\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type ProgressSize = 'sm' | 'md' | 'lg'\nexport type ProgressVariant = 'default' | 'success' | 'warning' | 'error'\n\nexport interface ProgressProps extends React.HTMLAttributes<HTMLDivElement> {\n value?: number\n max?: number\n size?: ProgressSize\n variant?: ProgressVariant\n showValue?: boolean\n formatValue?: (value: number, max: number) => string\n indeterminate?: boolean\n}\n\nconst SIZE_MAP: Record<ProgressSize, string> = {\n sm: 'h-1',\n md: 'h-2',\n lg: 'h-3',\n}\n\nconst VARIANT_MAP: Record<ProgressVariant, string> = {\n default: 'bg-gold',\n success: 'bg-success',\n warning: 'bg-warning',\n error: 'bg-error',\n}\n\nexport const Progress = React.forwardRef<HTMLDivElement, ProgressProps>(\n (\n {\n value = 0,\n max = 100,\n size = 'md',\n variant = 'default',\n showValue = false,\n formatValue,\n indeterminate = false,\n className,\n ...props\n },\n ref\n ) => {\n const percentage = Math.min(100, Math.max(0, (value / max) * 100))\n const displayValue = formatValue\n ? formatValue(value, max)\n : `${Math.round(percentage)}%`\n\n return (\n <div ref={ref} className={cx('w-full', className)} {...props}>\n {showValue && (\n <div className=\"flex justify-between mb-1\">\n <span className=\"text-sm text-silver\">Progress</span>\n <span className=\"text-sm text-white font-medium\">{displayValue}</span>\n </div>\n )}\n <div\n className={cx(\n 'w-full bg-charcoal border border-ash overflow-hidden rounded-none',\n SIZE_MAP[size]\n )}\n role=\"progressbar\"\n aria-valuenow={indeterminate ? undefined : value}\n aria-valuemin={0}\n aria-valuemax={max}\n >\n <div\n className={cx(\n 'h-full transition-all duration-300 ease-out',\n VARIANT_MAP[variant],\n indeterminate && 'animate-pulse'\n )}\n style={{\n width: indeterminate ? '100%' : `${percentage}%`,\n }}\n />\n </div>\n </div>\n )\n }\n)\n\nProgress.displayName = 'Progress'\n","import React, {createContext, useCallback, useContext, useEffect, useState} from 'react'\nimport {createPortal} from 'react-dom'\nimport {AlertCircle, AlertTriangle, CheckCircle, Info, X} from 'lucide-react'\nimport {cx} from '../utils/cx'\n\nlet toastCounter = 0\nfunction createToastId(): string {\n toastCounter += 1\n return `toast-${Date.now().toString(36)}-${toastCounter}`\n}\n\nexport type ToastVariant = 'default' | 'success' | 'error' | 'warning' | 'info'\nexport type ToastPosition =\n 'top-right'\n | 'top-left'\n | 'bottom-right'\n | 'bottom-left'\n | 'top-center'\n | 'bottom-center'\n\nexport interface ToastData {\n id: string\n title?: string\n description?: string\n variant?: ToastVariant\n duration?: number\n action?: React.ReactNode\n}\n\ninterface ToastContextValue {\n toasts: ToastData[]\n addToast: (toast: Omit<ToastData, 'id'>) => string\n removeToast: (id: string) => void\n position: ToastPosition\n}\n\nconst ToastContext = createContext<ToastContextValue | null>(null)\n\nexport function useToast() {\n const context = useContext(ToastContext)\n if (!context) {\n throw new Error('useToast must be used within a ToastProvider')\n }\n\n const toast = useCallback(\n (options: Omit<ToastData, 'id'>) => {\n return context.addToast(options)\n },\n [context]\n )\n\n return {\n toast,\n dismiss: context.removeToast,\n }\n}\n\n// ToastProvider - wrap your app with this\nexport interface ToastProviderProps {\n children: React.ReactNode\n position?: ToastPosition\n defaultDuration?: number\n}\n\nexport const ToastProvider: React.FC<ToastProviderProps> = ({\n children,\n position = 'bottom-right',\n defaultDuration = 5000,\n}) => {\n const [toasts, setToasts] = useState<ToastData[]>([])\n const [mounted, setMounted] = useState(false)\n\n useEffect(() => {\n setMounted(true)\n }, [])\n\n const addToast = useCallback(\n (toast: Omit<ToastData, 'id'>) => {\n const id = createToastId()\n const newToast: ToastData = {\n ...toast,\n id,\n duration: toast.duration ?? defaultDuration,\n }\n setToasts((prev) => [...prev, newToast])\n return id\n },\n [defaultDuration]\n )\n\n const removeToast = useCallback((id: string) => {\n setToasts((prev) => prev.filter((t) => t.id !== id))\n }, [])\n\n return (\n <ToastContext.Provider value={{toasts, addToast, removeToast, position}}>\n {children}\n {mounted && <ToastViewport/>}\n </ToastContext.Provider>\n )\n}\n\nToastProvider.displayName = 'ToastProvider'\n\nconst POSITION_CLASSES: Record<ToastPosition, string> = {\n 'top-right': 'top-4 right-4',\n 'top-left': 'top-4 left-4',\n 'bottom-right': 'bottom-4 right-4',\n 'bottom-left': 'bottom-4 left-4',\n 'top-center': 'top-4 left-1/2 -translate-x-1/2',\n 'bottom-center': 'bottom-4 left-1/2 -translate-x-1/2',\n}\n\n// ToastViewport - container for all toasts\nconst ToastViewport: React.FC = () => {\n const context = useContext(ToastContext)\n if (!context) {\n return null\n }\n\n const {toasts, position} = context\n\n return createPortal(\n <div\n className={cx(\n 'fixed z-50 flex flex-col gap-2 pointer-events-none',\n POSITION_CLASSES[position]\n )}\n >\n {toasts.map((toast) => (\n <Toast key={toast.id} {...toast} />\n ))}\n </div>,\n document.body\n )\n}\n\n// Individual Toast\ninterface ToastProps extends ToastData {\n}\n\nconst VARIANT_STYLES: Record<ToastVariant, string> = {\n default: 'bg-charcoal border-ash',\n success: 'bg-charcoal border-success/50',\n error: 'bg-charcoal border-error/50',\n warning: 'bg-charcoal border-warning/50',\n info: 'bg-charcoal border-info/50',\n}\n\nconst VARIANT_ICONS: Record<ToastVariant, React.ReactNode> = {\n default: null,\n success: <CheckCircle className=\"h-5 w-5 text-success\"/>,\n error: <AlertCircle className=\"h-5 w-5 text-error\"/>,\n warning: <AlertTriangle className=\"h-5 w-5 text-warning\"/>,\n info: <Info className=\"h-5 w-5 text-info\"/>,\n}\n\nconst Toast: React.FC<ToastProps> = ({\n id,\n title,\n description,\n variant = 'default',\n duration,\n action,\n}) => {\n const context = useContext(ToastContext)\n\n useEffect(() => {\n if (duration && duration > 0) {\n const timer = setTimeout(() => {\n context?.removeToast(id)\n }, duration)\n return () => clearTimeout(timer)\n }\n }, [id, duration, context])\n\n const icon = VARIANT_ICONS[variant]\n\n return (\n <div\n role=\"alert\"\n className={cx(\n 'pointer-events-auto w-80 p-4 border shadow-lg animate-slide-in-right',\n VARIANT_STYLES[variant]\n )}\n >\n <div className=\"flex gap-3\">\n {icon && <div className=\"shrink-0 mt-0.5\">{icon}</div>}\n <div className=\"flex-1 min-w-0\">\n {title && (\n <p className=\"text-sm font-medium text-white\">{title}</p>\n )}\n {description && (\n <p className=\"text-sm text-silver mt-1\">{description}</p>\n )}\n {action && <div className=\"mt-3\">{action}</div>}\n </div>\n <button\n onClick={() => context?.removeToast(id)}\n className=\"shrink-0 text-silver hover:text-white transition-colors\"\n >\n <X className=\"h-4 w-4\"/>\n <span className=\"sr-only\">Dismiss</span>\n </button>\n </div>\n </div>\n )\n}\n\nToast.displayName = 'Toast'\n","import React, {useEffect, useState} from 'react'\nimport {createPortal} from 'react-dom'\nimport {X} from 'lucide-react'\nimport {cx, useEscapeKey, useScrollLock} from '../utils'\n\nexport interface ModalProps {\n isOpen: boolean\n onClose: () => void\n title?: string\n children: React.ReactNode\n className?: string\n}\n\nexport const Modal = ({isOpen, onClose, title, children, className}: ModalProps) => {\n const [mounted, setMounted] = useState(false)\n\n useEffect(() => {\n setMounted(true)\n }, [])\n\n useScrollLock(isOpen)\n useEscapeKey(onClose, isOpen)\n\n if (!mounted || !isOpen) {\n return null\n }\n\n const content = (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6\"\n onClick={onClose}>\n <div className=\"fixed inset-0 z-40 bg-obsidian/80 backdrop-blur-sm\" aria-hidden=\"true\"/>\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n className={cx(\n 'bg-charcoal border border-gold/30 shadow-2xl z-50 w-full max-w-lg p-6 rounded-none relative flex flex-col',\n className\n )}\n data-state=\"open\"\n onClick={(e) => e.stopPropagation()}\n >\n <div className=\"flex items-center justify-between mb-2\">\n {title ? <h3 className=\"text-xl font-semibold text-white m-0\">{title}</h3> : <div/>}\n <button onClick={onClose}\n className=\"text-silver hover:text-white transition-colors ml-auto\">\n <X className=\"h-5 w-5\"/>\n <span className=\"sr-only\">Close</span>\n </button>\n </div>\n <div className=\"overflow-y-auto min-h-0\">{children}</div>\n </div>\n </div>\n )\n\n return createPortal(content, document.body)\n}\n\nModal.displayName = 'Modal'\n\nexport default Modal\n","import React, {useCallback} from 'react'\nimport {cx, useEscapeKey} from '../utils'\nimport {CloseIcon} from './icons'\n\nexport interface LightboxProps {\n /**\n * Called when the user dismisses the lightbox (ESC, backdrop click, X button).\n * The caller owns the open/closed state — when `onClose` fires, unmount the\n * lightbox.\n */\n onClose: () => void\n /**\n * Optional kind-specific actions placed before the close button in the\n * floating top-right cluster. Typically buttons like \"Share\" or \"Download\".\n * The cluster always renders the close button; pass `undefined` if the only\n * affordance is dismiss.\n */\n actions?: React.ReactNode\n /**\n * Optional caption shown bottom-centre over the backdrop. Use for short\n * metadata like a title and subtitle. Non-interactive — clicks pass through\n * to the backdrop and dismiss.\n */\n caption?: React.ReactNode\n /**\n * The artifact body. Sits directly on the backdrop with no inner frame —\n * the body is responsible for its own layout (object-contain image, scrollable\n * deliverable, readable text column, etc.). Click events whose target is the\n * sized content wrapper (i.e. the empty area around the body) dismiss the\n * lightbox; clicks on the body itself do not.\n */\n children: React.ReactNode\n className?: string\n}\n\n/**\n * Full-bleed modal canvas for one piece of content. Premium-haptic alternative\n * to a bordered modal: deep void backdrop, scale-fade entrance, no inner frame,\n * floating glass action cluster top-right.\n *\n * The component is content-agnostic — it ships chrome, not artifact knowledge.\n * Compose it with kind-aware bodies and action sets to build the artifact\n * viewer; reach for it directly any time a single piece of content needs the\n * full screen.\n *\n * Dismiss surfaces: ESC, backdrop click (outside the sized content area),\n * close button in the action cluster.\n */\nexport function Lightbox({\n onClose,\n actions,\n caption,\n children,\n className,\n}: LightboxProps) {\n useEscapeKey(onClose)\n\n // Two close-zones: the backdrop itself and the empty area around the body\n // inside the sized content wrapper. Children that should not dismiss (the\n // body, the action cluster) are descendants — their click targets aren't\n // the wrapper, so the guard skips them.\n const handleSurfaceClick = useCallback((e: React.MouseEvent) => {\n if (e.target === e.currentTarget) {\n onClose()\n }\n }, [onClose])\n\n return (\n <div\n className={cx(\n 'fixed inset-0 z-50 flex items-center justify-center',\n 'bg-void/95 backdrop-blur-md animate-fade-in',\n className,\n )}\n onClick={handleSurfaceClick}\n role=\"dialog\"\n aria-modal=\"true\"\n >\n {/* Floating action cluster — stays put as content scrolls */}\n <div\n className={cx(\n 'absolute top-3 right-3 z-10 flex items-center',\n 'bg-charcoal/70 backdrop-blur border border-ash/40',\n 'group/actions hover:border-gold/40 transition-colors',\n )}\n >\n {actions && (\n <>\n <div className=\"flex items-center gap-1 px-1 py-1\">\n {actions}\n </div>\n <div className=\"w-px self-stretch bg-ash/40\"/>\n </>\n )}\n <button\n onClick={onClose}\n aria-label=\"Close\"\n className=\"p-2 text-silver hover:text-white hover:bg-ash/20 transition-colors\"\n >\n <CloseIcon className=\"w-5 h-5\"/>\n </button>\n </div>\n\n {/* Sized canvas — bare, no frame. Click on the empty area dismisses. */}\n <div\n className=\"relative w-11/12 h-11/12 max-w-7xl flex items-center justify-center animate-lightbox-in\"\n onClick={handleSurfaceClick}\n >\n {children}\n </div>\n\n {caption && (\n <div className=\"absolute bottom-6 left-0 right-0 text-center pointer-events-none px-4\">\n {caption}\n </div>\n )}\n </div>\n )\n}\n","import React from 'react'\nimport type {IconProps} from './index'\n\nexport function ChatBubbleIcon({className, ...props}: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className={className}\n {...props}\n >\n <path\n d=\"M2 3h16v11H6l-4 3V3z\"\n />\n </svg>\n )\n}\n","import React from 'react'\nimport type {IconProps} from './index'\n\nexport function ChevronLeftIcon({className, ...props}: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className={className}\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n","import React from 'react'\nimport type {IconProps} from './index'\n\nexport function ChevronRightIcon({className, ...props}: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className={className}\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n","import React from 'react'\nimport type {IconProps} from './index'\n\nexport function CloseIcon({className, ...props}: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className={className}\n {...props}\n >\n <path\n d=\"M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z\"\n />\n </svg>\n )\n}\n","import React from 'react'\nimport type {IconProps} from './index'\n\nexport function ExpandIcon({className, ...props}: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className={className}\n {...props}\n >\n <path\n d=\"M13.28 7.78l3.22-3.22v2.69a.75.75 0 001.5 0v-4.5a.75.75 0 00-.75-.75h-4.5a.75.75 0 000 1.5h2.69l-3.22 3.22a.75.75 0 001.06 1.06zM2 17.25v-4.5a.75.75 0 011.5 0v2.69l3.22-3.22a.75.75 0 011.06 1.06L4.56 16.5h2.69a.75.75 0 010 1.5h-4.5a.75.75 0 01-.75-.75z\"\n />\n </svg>\n )\n}\n","import React from 'react'\nimport type {IconProps} from './index'\n\nexport function HistoryIcon({className, ...props}: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className={className}\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm.75-13a.75.75 0 00-1.5 0v5c0 .414.336.75.75.75h4a.75.75 0 000-1.5h-3.25V5z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n","import React from 'react'\nimport type {IconProps} from './index'\n\nexport function LayersIcon({className, ...props}: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className={className}\n {...props}\n >\n <path\n d=\"M3.196 12.87l-.825.483a.75.75 0 000 1.294l7.25 4.25a.75.75 0 00.758 0l7.25-4.25a.75.75 0 000-1.294l-.825-.484-5.666 3.322a2.25 2.25 0 01-2.276 0L3.196 12.87z\"\n />\n <path\n d=\"M3.196 8.87l-.825.483a.75.75 0 000 1.294l7.25 4.25a.75.75 0 00.758 0l7.25-4.25a.75.75 0 000-1.294l-.825-.484-5.666 3.322a2.25 2.25 0 01-2.276 0L3.196 8.87z\"\n />\n <path\n d=\"M10.38 1.103a.75.75 0 00-.76 0l-7.25 4.25a.75.75 0 000 1.294l7.25 4.25a.75.75 0 00.76 0l7.25-4.25a.75.75 0 000-1.294l-7.25-4.25z\"\n />\n </svg>\n )\n}\n","import React from 'react'\nimport type {IconProps} from './index'\n\n/**\n * Media icon — a film frame with play triangle, representing video and media artifacts.\n */\nexport function MediaIcon({className, ...props}: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className={className}\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M2 4.5A1.5 1.5 0 013.5 3h13A1.5 1.5 0 0118 4.5v11a1.5 1.5 0 01-1.5 1.5h-13A1.5 1.5 0 012 15.5v-11zM4 5v1h1V5H4zm2 0v1h1V5H6zm7 0v1h1V5h-1zm2 0v1h1V5h-1zM4 14v1h1v-1H4zm2 0v1h1v-1H6zm7 0v1h1v-1h-1zm2 0v1h1v-1h-1zM8 8.118a.5.5 0 01.757-.429l4 2.382a.5.5 0 010 .858l-4 2.382A.5.5 0 018 12.882V8.118z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n","import React from 'react'\nimport type {IconProps} from './index'\n\nexport function PlusIcon({className, ...props}: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className={className}\n {...props}\n >\n <path\n d=\"M10.75 4.75a.75.75 0 00-1.5 0v4.5h-4.5a.75.75 0 000 1.5h4.5v4.5a.75.75 0 001.5 0v-4.5h4.5a.75.75 0 000-1.5h-4.5v-4.5z\"\n />\n </svg>\n )\n}\n","import React from 'react'\nimport {cx} from '../../utils/cx'\nimport type {IconProps} from './index'\n\nexport function CheckSquareIcon({className, ...props}: IconProps) {\n return (\n <div\n className={cx(\n 'relative w-4 h-4 flex-shrink-0 border-2 border-gold bg-gold/10',\n className\n )}\n {...props}\n >\n <svg\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n className=\"absolute inset-0 w-full h-full p-0.5\"\n >\n <path\n d=\"M3 8l3 3 7-7\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"text-gold\"\n />\n </svg>\n </div>\n )\n}\n","import React from 'react'\nimport {cx} from '../../utils/cx'\nimport type {IconProps} from './index'\n\nexport function EmptySquareIcon({className, ...props}: IconProps) {\n return (\n <div\n className={cx(\n 'w-4 h-4 flex-shrink-0 border-2 border-ash/60',\n className\n )}\n {...props}\n />\n )\n}\n","import React from 'react'\nimport {cx} from '../../utils/cx'\nimport type {IconProps} from './index'\n\nexport interface CrossSquareIconProps extends IconProps {\n /**\n * Visual variant for different states\n * - 'cancelled': subtle ash coloring\n * - 'failed': error red coloring\n */\n variant?: 'cancelled' | 'failed'\n}\n\nexport function CrossSquareIcon({className, variant = 'cancelled', ...props}: CrossSquareIconProps) {\n return (\n <div\n className={cx(\n 'relative w-4 h-4 flex-shrink-0 border-2',\n variant === 'failed' ? 'border-error/60 bg-error/5' : 'border-ash/40 bg-ash/5',\n className\n )}\n {...props}\n >\n <svg\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n className=\"absolute inset-0 w-full h-full p-0.5\"\n >\n <path\n d=\"M4 4l8 8M12 4l-8 8\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n className={variant === 'failed' ? 'text-error/60' : 'text-ash/40'}\n />\n </svg>\n </div>\n )\n}\n","import React from 'react'\nimport {cx} from '../../utils/cx'\nimport type {IconProps} from './index'\n\n/**\n * Square loading spinner with \"snake\" animation.\n * A golden stroke travels around a square border.\n */\nexport function SquareLoaderIcon({className, ...props}: IconProps) {\n return (\n <div className={cx('relative w-4 h-4 flex-shrink-0', className)} {...props}>\n <svg\n viewBox=\"0 0 16 16\"\n className=\"w-full h-full animate-snake-spin\"\n >\n {/* Square border path that the snake travels around */}\n <rect\n x=\"1\"\n y=\"1\"\n width=\"14\"\n height=\"14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n className=\"text-ash/40\"\n />\n {/* The \"snake\" - an animated stroke */}\n <rect\n x=\"1\"\n y=\"1\"\n width=\"14\"\n height=\"14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeDasharray=\"14 42\"\n strokeLinecap=\"square\"\n className=\"text-gold animate-snake-travel\"\n />\n </svg>\n </div>\n )\n}\n","import React, {useEffect, useState} from 'react'\nimport {createPortal} from 'react-dom'\nimport {X} from 'lucide-react'\nimport {cx, useEscapeKey, useScrollLock} from '../utils'\n\nexport type DrawerPosition = 'left' | 'right' | 'top' | 'bottom'\n\nexport interface DrawerProps {\n isOpen: boolean\n onClose: () => void\n position?: DrawerPosition\n title?: string\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'full'\n children: React.ReactNode\n className?: string\n}\n\nconst SIZE_MAP: Record<string, Record<DrawerPosition, string>> = {\n sm: {\n left: 'w-64',\n right: 'w-64',\n top: 'h-48',\n bottom: 'h-48',\n },\n md: {\n left: 'w-80',\n right: 'w-80',\n top: 'h-64',\n bottom: 'h-64',\n },\n lg: {\n left: 'w-96',\n right: 'w-96',\n top: 'h-80',\n bottom: 'h-80',\n },\n xl: {\n left: 'w-[32rem]',\n right: 'w-[32rem]',\n top: 'h-96',\n bottom: 'h-96',\n },\n full: {\n left: 'w-full',\n right: 'w-full',\n top: 'h-full',\n bottom: 'h-full',\n },\n}\n\nconst POSITION_CLASSES: Record<DrawerPosition, string> = {\n left: 'left-0 top-0 h-full',\n right: 'right-0 top-0 h-full',\n top: 'top-0 left-0 w-full',\n bottom: 'bottom-0 left-0 w-full',\n}\n\nconst TRANSFORM_CLASSES: Record<DrawerPosition, { open: string; closed: string }> = {\n left: {open: 'translate-x-0', closed: '-translate-x-full'},\n right: {open: 'translate-x-0', closed: 'translate-x-full'},\n top: {open: 'translate-y-0', closed: '-translate-y-full'},\n bottom: {open: 'translate-y-0', closed: 'translate-y-full'},\n}\n\nexport const Drawer: React.FC<DrawerProps> = ({\n isOpen,\n onClose,\n position = 'right',\n title,\n size = 'md',\n children,\n className,\n}) => {\n const [mounted, setMounted] = useState(false)\n\n useEffect(() => {\n setMounted(true)\n }, [])\n\n useScrollLock(isOpen)\n useEscapeKey(onClose, isOpen)\n\n if (!mounted) {\n return null\n }\n\n const content = (\n <div\n className={cx(\n 'fixed inset-0 z-50',\n isOpen ? 'pointer-events-auto' : 'pointer-events-none'\n )}\n >\n {/* Backdrop */}\n <div\n className={cx(\n 'fixed inset-0 bg-obsidian/80 backdrop-blur-sm transition-opacity duration-300',\n isOpen ? 'opacity-100' : 'opacity-0'\n )}\n onClick={onClose}\n aria-hidden=\"true\"\n />\n\n {/* Drawer panel */}\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n className={cx(\n 'fixed bg-charcoal border-ash shadow-2xl flex flex-col',\n 'transition-transform duration-300 ease-out',\n POSITION_CLASSES[position],\n SIZE_MAP[size][position],\n position === 'left' && 'border-r',\n position === 'right' && 'border-l',\n position === 'top' && 'border-b',\n position === 'bottom' && 'border-t',\n isOpen ? TRANSFORM_CLASSES[position].open : TRANSFORM_CLASSES[position].closed,\n className\n )}\n >\n {/* Header */}\n <div className=\"flex items-center justify-between px-4 py-3 border-b border-ash\">\n {title ? (\n <h2 className=\"text-lg font-semibold text-white m-0\">{title}</h2>\n ) : (\n <div/>\n )}\n <button\n onClick={onClose}\n className=\"text-silver hover:text-white transition-colors\"\n >\n <X className=\"h-5 w-5\"/>\n <span className=\"sr-only\">Close</span>\n </button>\n </div>\n\n {/* Content */}\n <div className=\"flex-1 overflow-auto p-4\">{children}</div>\n </div>\n </div>\n )\n\n return createPortal(content, document.body)\n}\n\nDrawer.displayName = 'Drawer'\n","import React, {useCallback, useId, useRef, useState} from 'react'\nimport {cx, useClickOutside, useEscapeKey} from '../utils'\n\nexport type PopoverPosition = 'top' | 'bottom' | 'left' | 'right'\nexport type PopoverAlign = 'start' | 'center' | 'end'\n\nexport interface PopoverProps {\n children: React.ReactNode\n /** The trigger element */\n trigger: React.ReactElement\n /** Position relative to trigger */\n position?: PopoverPosition\n /** Alignment along the position axis */\n align?: PopoverAlign\n /** Controlled open state */\n open?: boolean\n /** Callback when open state changes */\n onOpenChange?: (open: boolean) => void\n /** Close when clicking outside */\n closeOnClickOutside?: boolean\n}\n\nconst POSITION_CLASSES: Record<PopoverPosition, Record<PopoverAlign, string>> = {\n top: {\n start: 'bottom-full left-0 mb-2',\n center: 'bottom-full left-1/2 -translate-x-1/2 mb-2',\n end: 'bottom-full right-0 mb-2',\n },\n bottom: {\n start: 'top-full left-0 mt-2',\n center: 'top-full left-1/2 -translate-x-1/2 mt-2',\n end: 'top-full right-0 mt-2',\n },\n left: {\n start: 'right-full top-0 mr-2',\n center: 'right-full top-1/2 -translate-y-1/2 mr-2',\n end: 'right-full bottom-0 mr-2',\n },\n right: {\n start: 'left-full top-0 ml-2',\n center: 'left-full top-1/2 -translate-y-1/2 ml-2',\n end: 'left-full bottom-0 ml-2',\n },\n}\n\nexport const Popover: React.FC<PopoverProps> = ({\n children,\n trigger,\n position = 'bottom',\n align = 'center',\n open: controlledOpen,\n onOpenChange,\n closeOnClickOutside = true,\n}) => {\n const [internalOpen, setInternalOpen] = useState(false)\n const isControlled = controlledOpen !== undefined\n const isOpen = isControlled ? controlledOpen : internalOpen\n\n const containerRef = useRef<HTMLDivElement>(null)\n const baseId = useId()\n\n const setIsOpen = useCallback(\n (newOpen: boolean) => {\n if (!isControlled) {\n setInternalOpen(newOpen)\n }\n onOpenChange?.(newOpen)\n },\n [isControlled, onOpenChange]\n )\n\n const close = useCallback(() => setIsOpen(false), [setIsOpen])\n useClickOutside(containerRef, close, isOpen && closeOnClickOutside)\n useEscapeKey(close, isOpen)\n\n const handleTriggerClick = () => {\n setIsOpen(!isOpen)\n }\n\n const triggerElement = React.cloneElement(trigger as React.ReactElement<any>, {\n onClick: handleTriggerClick,\n 'aria-haspopup': 'dialog',\n 'aria-expanded': isOpen,\n 'aria-controls': `${baseId}-popover`,\n id: `${baseId}-trigger`,\n })\n\n return (\n <div ref={containerRef} className=\"relative inline-block\">\n {triggerElement}\n {isOpen && (\n <div\n id={`${baseId}-popover`}\n role=\"dialog\"\n aria-labelledby={`${baseId}-trigger`}\n className={cx(\n 'absolute z-50 min-w-48 p-4',\n 'bg-charcoal border border-ash shadow-lg',\n 'animate-fade-in',\n POSITION_CLASSES[position][align]\n )}\n >\n {children}\n </div>\n )}\n </div>\n )\n}\n\nPopover.displayName = 'Popover'\n","import React, {useCallback} from 'react'\nimport {Modal, type ModalProps} from './Modal'\nimport {Button} from './Button'\nimport {cx} from '../utils/cx'\n\n// ConfirmDialog - for confirmation actions\nexport interface ConfirmDialogProps extends Omit<ModalProps, 'children'> {\n description?: React.ReactNode\n confirmText?: string\n cancelText?: string\n onConfirm: () => void | Promise<void>\n onCancel?: () => void\n confirmVariant?: 'primary' | 'important' | 'danger'\n isLoading?: boolean\n}\n\nexport const ConfirmDialog: React.FC<ConfirmDialogProps> = ({\n title = 'Confirm',\n description,\n confirmText = 'Confirm',\n cancelText = 'Cancel',\n onConfirm,\n onCancel,\n onClose,\n confirmVariant = 'important',\n isLoading = false,\n ...props\n}) => {\n const handleCancel = useCallback(() => {\n onCancel?.()\n onClose()\n }, [onCancel, onClose])\n\n const handleConfirm = useCallback(async () => {\n await onConfirm()\n onClose()\n }, [onConfirm, onClose])\n\n return (\n <Modal title={title} onClose={onClose} {...props}>\n {description && (\n <p className=\"text-sm text-silver mb-6\">{description}</p>\n )}\n <div className=\"flex justify-end gap-3\">\n <Button variant=\"outlined\" onClick={handleCancel} disabled={isLoading}>\n {cancelText}\n </Button>\n <Button\n variant={confirmVariant}\n onClick={handleConfirm}\n loading={isLoading}\n >\n {confirmText}\n </Button>\n </div>\n </Modal>\n )\n}\n\nConfirmDialog.displayName = 'ConfirmDialog'\n\n// AlertDialog - for important alerts\nexport interface AlertDialogProps extends Omit<ModalProps, 'children'> {\n description?: React.ReactNode\n acknowledgeText?: string\n variant?: 'default' | 'warning' | 'error'\n}\n\nexport const AlertDialog: React.FC<AlertDialogProps> = ({\n title = 'Alert',\n description,\n acknowledgeText = 'OK',\n variant = 'default',\n onClose,\n ...props\n}) => {\n const titleClass = cx(\n variant === 'warning' && 'text-warning',\n variant === 'error' && 'text-error'\n )\n\n return (\n <Modal onClose={onClose} {...props}>\n <h3 className={cx('text-xl font-semibold mb-2', titleClass)}>{title}</h3>\n {description && (\n <p className=\"text-sm text-silver mb-6\">{description}</p>\n )}\n <div className=\"flex justify-end\">\n <Button variant=\"primary\" onClick={onClose}>\n {acknowledgeText}\n </Button>\n </div>\n </Modal>\n )\n}\n\nAlertDialog.displayName = 'AlertDialog'\n\n// PromptDialog - for user input\nexport interface PromptDialogProps extends Omit<ModalProps, 'children'> {\n description?: React.ReactNode\n placeholder?: string\n defaultValue?: string\n submitText?: string\n cancelText?: string\n onSubmit: (value: string) => void | Promise<void>\n onCancel?: () => void\n isLoading?: boolean\n}\n\nexport const PromptDialog: React.FC<PromptDialogProps> = ({\n title = 'Enter Value',\n description,\n placeholder,\n defaultValue = '',\n submitText = 'Submit',\n cancelText = 'Cancel',\n onSubmit,\n onCancel,\n onClose,\n isLoading = false,\n ...props\n}) => {\n const [value, setValue] = React.useState(defaultValue)\n\n const handleCancel = useCallback(() => {\n onCancel?.()\n onClose()\n }, [onCancel, onClose])\n\n const handleSubmit = useCallback(\n async (e: React.FormEvent) => {\n e.preventDefault()\n await onSubmit(value)\n onClose()\n },\n [onSubmit, value, onClose]\n )\n\n return (\n <Modal title={title} onClose={onClose} {...props}>\n <form onSubmit={handleSubmit}>\n {description && (\n <p className=\"text-sm text-silver mb-4\">{description}</p>\n )}\n <input\n type=\"text\"\n value={value}\n onChange={(e) => setValue(e.target.value)}\n placeholder={placeholder}\n className={cx(\n 'w-full px-3 py-2 bg-graphite border border-ash',\n 'text-white placeholder:text-zinc',\n 'focus:border-gold focus:ring-1 focus:ring-gold focus:outline-none',\n 'mb-6'\n )}\n autoFocus\n />\n <div className=\"flex justify-end gap-3\">\n <Button\n type=\"button\"\n variant=\"outlined\"\n onClick={handleCancel}\n disabled={isLoading}\n >\n {cancelText}\n </Button>\n <Button type=\"submit\" variant=\"important\" loading={isLoading}>\n {submitText}\n </Button>\n </div>\n </form>\n </Modal>\n )\n}\n\nPromptDialog.displayName = 'PromptDialog'\n","import React, {createContext, useCallback, useContext, useId, useState} from 'react'\nimport {cx} from '../utils/cx'\n\n// Context for managing tab state\ninterface TabsContextValue {\n activeTab: string\n setActiveTab: (id: string) => void\n baseId: string\n}\n\nconst TabsContext = createContext<TabsContextValue | null>(null)\n\nfunction useTabsContext() {\n const context = useContext(TabsContext)\n if (!context) {\n throw new Error('Tabs components must be used within a Tabs provider')\n }\n return context\n}\n\n// Main Tabs container\nexport interface TabsProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The id of the initially active tab */\n defaultValue?: string\n /** Controlled active tab value */\n value?: string\n /** Callback when active tab changes */\n onValueChange?: (value: string) => void\n}\n\nexport const Tabs = React.forwardRef<HTMLDivElement, TabsProps>(\n ({defaultValue, value, onValueChange, children, className, ...props}, ref) => {\n const [internalValue, setInternalValue] = useState(defaultValue ?? '')\n const isControlled = value !== undefined\n const activeTab = isControlled ? value : internalValue\n const baseId = useId()\n\n const setActiveTab = useCallback(\n (id: string) => {\n if (!isControlled) {\n setInternalValue(id)\n }\n onValueChange?.(id)\n },\n [isControlled, onValueChange]\n )\n\n return (\n <TabsContext.Provider value={{activeTab, setActiveTab, baseId}}>\n <div ref={ref} className={cx('w-full', className)} {...props}>\n {children}\n </div>\n </TabsContext.Provider>\n )\n }\n)\n\nTabs.displayName = 'Tabs'\n\n// TabList - container for Tab buttons\nexport interface TabListProps extends React.HTMLAttributes<HTMLDivElement> {\n}\n\nexport const TabList = React.forwardRef<HTMLDivElement, TabListProps>(\n ({children, className, ...props}, ref) => {\n return (\n <div\n ref={ref}\n role=\"tablist\"\n className={cx(\n 'flex border-b border-ash',\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nTabList.displayName = 'TabList'\n\n// Tab - individual tab button\nexport interface TabProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Unique identifier for this tab */\n value: string\n}\n\nexport const Tab = React.forwardRef<HTMLButtonElement, TabProps>(\n ({value, children, className, disabled, ...props}, ref) => {\n const {activeTab, setActiveTab, baseId} = useTabsContext()\n const isActive = activeTab === value\n const panelId = `${baseId}-panel-${value}`\n const tabId = `${baseId}-tab-${value}`\n\n return (\n <button\n ref={ref}\n id={tabId}\n type=\"button\"\n role=\"tab\"\n aria-selected={isActive}\n aria-controls={panelId}\n tabIndex={isActive ? 0 : -1}\n disabled={disabled}\n onClick={() => setActiveTab(value)}\n className={cx(\n 'px-4 py-2 text-sm font-medium transition-all duration-fast',\n 'border-b-2 -mb-px',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gold focus-visible:ring-inset',\n isActive\n ? 'border-gold text-gold'\n : 'border-transparent text-silver hover:text-white hover:border-ash',\n disabled && 'opacity-50 cursor-not-allowed',\n className\n )}\n {...props}\n >\n {children}\n </button>\n )\n }\n)\n\nTab.displayName = 'Tab'\n\n// TabPanel - content panel for a tab\nexport interface TabPanelProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Value matching the corresponding Tab */\n value: string\n /** Force the panel to stay mounted when inactive */\n forceMount?: boolean\n}\n\nexport const TabPanel = React.forwardRef<HTMLDivElement, TabPanelProps>(\n ({value, forceMount = false, children, className, ...props}, ref) => {\n const {activeTab, baseId} = useTabsContext()\n const isActive = activeTab === value\n const panelId = `${baseId}-panel-${value}`\n const tabId = `${baseId}-tab-${value}`\n\n if (!isActive && !forceMount) {\n return null\n }\n\n return (\n <div\n ref={ref}\n id={panelId}\n role=\"tabpanel\"\n aria-labelledby={tabId}\n tabIndex={0}\n hidden={!isActive}\n className={cx(\n 'pt-4 focus-visible:outline-none',\n !isActive && 'hidden',\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nTabPanel.displayName = 'TabPanel'\n","import React, {createContext, useCallback, useContext, useId, useState} from 'react'\nimport {ChevronDown} from 'lucide-react'\nimport {cx} from '../utils/cx'\n\n// Context for managing accordion state\ninterface AccordionContextValue {\n expandedItems: Set<string>\n toggleItem: (id: string) => void\n type: 'single' | 'multiple'\n}\n\nconst AccordionContext = createContext<AccordionContextValue | null>(null)\n\nfunction useAccordionContext() {\n const context = useContext(AccordionContext)\n if (!context) {\n throw new Error('Accordion components must be used within an Accordion provider')\n }\n return context\n}\n\n// Main Accordion container\nexport interface AccordionProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Allow multiple items to be open at once */\n type?: 'single' | 'multiple'\n /** Default expanded item(s) */\n defaultValue?: string | string[]\n /** Controlled expanded item(s) */\n value?: string | string[]\n /** Callback when expanded items change */\n onValueChange?: (value: string | string[]) => void\n}\n\nexport const Accordion = React.forwardRef<HTMLDivElement, AccordionProps>(\n (\n {type = 'single', defaultValue, value, onValueChange, children, className, ...props},\n ref\n ) => {\n const [internalValue, setInternalValue] = useState<Set<string>>(() => {\n if (defaultValue) {\n return new Set(Array.isArray(defaultValue) ? defaultValue : [defaultValue])\n }\n return new Set()\n })\n\n const isControlled = value !== undefined\n const expandedItems = isControlled\n ? new Set(Array.isArray(value) ? value : [value])\n : internalValue\n\n const toggleItem = useCallback(\n (id: string) => {\n const newSet = new Set(expandedItems)\n\n if (newSet.has(id)) {\n newSet.delete(id)\n } else {\n if (type === 'single') {\n newSet.clear()\n }\n newSet.add(id)\n }\n\n if (!isControlled) {\n setInternalValue(newSet)\n }\n\n const newValue = Array.from(newSet)\n onValueChange?.(type === 'single' ? newValue[0] ?? '' : newValue)\n },\n [expandedItems, type, isControlled, onValueChange]\n )\n\n return (\n <AccordionContext.Provider value={{expandedItems, toggleItem, type}}>\n <div\n ref={ref}\n className={cx('divide-y divide-ash border border-ash', className)}\n {...props}\n >\n {children}\n </div>\n </AccordionContext.Provider>\n )\n }\n)\n\nAccordion.displayName = 'Accordion'\n\n// AccordionItem - individual accordion section\nexport interface AccordionItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Unique identifier for this item */\n value: string\n /** Disable this item */\n disabled?: boolean\n}\n\nconst AccordionItemContext = createContext<{ value: string; disabled: boolean } | null>(null)\n\nexport const AccordionItem = React.forwardRef<HTMLDivElement, AccordionItemProps>(\n ({value, disabled = false, children, className, ...props}, ref) => {\n return (\n <AccordionItemContext.Provider value={{value, disabled}}>\n <div\n ref={ref}\n data-state={useAccordionContext().expandedItems.has(value) ? 'open' : 'closed'}\n className={cx('bg-charcoal', className)}\n {...props}\n >\n {children}\n </div>\n </AccordionItemContext.Provider>\n )\n }\n)\n\nAccordionItem.displayName = 'AccordionItem'\n\n// AccordionTrigger - clickable header\nexport interface AccordionTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n}\n\nexport const AccordionTrigger = React.forwardRef<HTMLButtonElement, AccordionTriggerProps>(\n ({children, className, ...props}, ref) => {\n const {expandedItems, toggleItem} = useAccordionContext()\n const itemContext = useContext(AccordionItemContext)\n const baseId = useId()\n\n if (!itemContext) {\n throw new Error('AccordionTrigger must be used within an AccordionItem')\n }\n\n const {value, disabled} = itemContext\n const isExpanded = expandedItems.has(value)\n\n return (\n <h3 className=\"m-0\">\n <button\n ref={ref}\n type=\"button\"\n id={`${baseId}-trigger-${value}`}\n aria-expanded={isExpanded}\n aria-controls={`${baseId}-content-${value}`}\n disabled={disabled}\n onClick={() => toggleItem(value)}\n className={cx(\n 'flex w-full items-center justify-between px-4 py-3',\n 'text-left text-sm font-medium text-white',\n 'transition-colors duration-fast',\n 'hover:bg-graphite',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gold focus-visible:ring-inset',\n disabled && 'opacity-50 cursor-not-allowed',\n className\n )}\n {...props}\n >\n <span>{children}</span>\n <ChevronDown\n className={cx(\n 'h-4 w-4 text-silver transition-transform duration-200',\n isExpanded && 'rotate-180'\n )}\n />\n </button>\n </h3>\n )\n }\n)\n\nAccordionTrigger.displayName = 'AccordionTrigger'\n\n// AccordionContent - expandable content\nexport interface AccordionContentProps extends React.HTMLAttributes<HTMLDivElement> {\n}\n\nexport const AccordionContent = React.forwardRef<HTMLDivElement, AccordionContentProps>(\n ({children, className, ...props}, ref) => {\n const {expandedItems} = useAccordionContext()\n const itemContext = useContext(AccordionItemContext)\n const baseId = useId()\n\n if (!itemContext) {\n throw new Error('AccordionContent must be used within an AccordionItem')\n }\n\n const {value} = itemContext\n const isExpanded = expandedItems.has(value)\n\n return (\n <div\n ref={ref}\n id={`${baseId}-content-${value}`}\n role=\"region\"\n aria-labelledby={`${baseId}-trigger-${value}`}\n hidden={!isExpanded}\n className={cx(\n 'overflow-hidden transition-all duration-200',\n isExpanded ? 'animate-fade-in' : 'hidden',\n className\n )}\n {...props}\n >\n <div className=\"px-4 pb-4 text-sm text-silver\">{children}</div>\n </div>\n )\n }\n)\n\nAccordionContent.displayName = 'AccordionContent'\n","import React, {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react'\nimport {composeRefs, cx, useEscapeKey} from '../utils'\n\n// Context for managing menu state\ninterface MenuContextValue {\n isOpen: boolean\n setIsOpen: (open: boolean) => void\n triggerId: string\n menuId: string\n}\n\nconst MenuContext = createContext<MenuContextValue | null>(null)\n\nfunction useMenuContext() {\n const context = useContext(MenuContext)\n if (!context) {\n throw new Error('Menu components must be used within a Menu provider')\n }\n return context\n}\n\n// Main Menu container\nexport interface MenuProps {\n children: React.ReactNode\n open?: boolean\n onOpenChange?: (open: boolean) => void\n}\n\nexport const Menu: React.FC<MenuProps> = ({children, open, onOpenChange}) => {\n const [internalOpen, setInternalOpen] = useState(false)\n const isControlled = open !== undefined\n const isOpen = isControlled ? open : internalOpen\n const baseId = useId()\n\n const setIsOpen = useCallback(\n (newOpen: boolean) => {\n if (!isControlled) {\n setInternalOpen(newOpen)\n }\n onOpenChange?.(newOpen)\n },\n [isControlled, onOpenChange]\n )\n\n return (\n <MenuContext.Provider\n value={{\n isOpen,\n setIsOpen,\n triggerId: `${baseId}-trigger`,\n menuId: `${baseId}-menu`,\n }}\n >\n <div className=\"relative inline-block\">{children}</div>\n </MenuContext.Provider>\n )\n}\n\nMenu.displayName = 'Menu'\n\n// MenuTrigger - button that opens the menu\nexport interface MenuTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n asChild?: boolean\n}\n\nexport const MenuTrigger = React.forwardRef<HTMLButtonElement, MenuTriggerProps>(\n ({children, className, asChild, ...props}, ref) => {\n const {isOpen, setIsOpen, triggerId, menuId} = useMenuContext()\n\n const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n e.preventDefault()\n setIsOpen(!isOpen)\n props.onClick?.(e)\n }\n\n return (\n <button\n ref={ref}\n id={triggerId}\n type=\"button\"\n aria-haspopup=\"menu\"\n aria-expanded={isOpen}\n aria-controls={menuId}\n onClick={handleClick}\n className={cx(\n 'inline-flex items-center justify-center',\n className\n )}\n {...props}\n >\n {children}\n </button>\n )\n }\n)\n\nMenuTrigger.displayName = 'MenuTrigger'\n\n// MenuContent - the dropdown menu\nexport interface MenuContentProps extends React.HTMLAttributes<HTMLDivElement> {\n align?: 'start' | 'center' | 'end'\n side?: 'top' | 'bottom'\n}\n\nconst MENU_ALIGN_CLASSES: Record<NonNullable<MenuContentProps['align']>, string> = {\n start: 'left-0',\n center: 'left-1/2 -translate-x-1/2',\n end: 'right-0',\n}\n\nconst MENU_SIDE_CLASSES: Record<NonNullable<MenuContentProps['side']>, string> = {\n top: 'bottom-full mb-1',\n bottom: 'top-full mt-1',\n}\n\nexport const MenuContent = React.forwardRef<HTMLDivElement, MenuContentProps>(\n ({children, className, align = 'start', side = 'bottom', ...props}, ref) => {\n const {isOpen, setIsOpen, triggerId, menuId} = useMenuContext()\n const menuRef = useRef<HTMLDivElement>(null)\n\n const close = useCallback(() => setIsOpen(false), [setIsOpen])\n useEscapeKey(close, isOpen)\n\n // Close on outside click — but ignore clicks on the trigger so it can toggle the menu.\n useEffect(() => {\n if (!isOpen) {\n return\n }\n const handleClickOutside = (e: MouseEvent) => {\n const target = e.target as Node\n const trigger = document.getElementById(triggerId)\n if (\n menuRef.current &&\n !menuRef.current.contains(target) &&\n !trigger?.contains(target)\n ) {\n setIsOpen(false)\n }\n }\n document.addEventListener('mousedown', handleClickOutside)\n return () => document.removeEventListener('mousedown', handleClickOutside)\n }, [isOpen, setIsOpen, triggerId])\n\n if (!isOpen) {\n return null\n }\n\n return (\n <div\n ref={composeRefs(menuRef, ref)}\n id={menuId}\n role=\"menu\"\n aria-labelledby={triggerId}\n className={cx(\n 'absolute z-50 min-w-40 py-1',\n 'bg-charcoal border border-ash shadow-lg',\n 'animate-fade-in',\n MENU_ALIGN_CLASSES[align],\n MENU_SIDE_CLASSES[side],\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nMenuContent.displayName = 'MenuContent'\n\n// MenuItem - individual menu option\nexport interface MenuItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n icon?: React.ReactNode\n destructive?: boolean\n}\n\nexport const MenuItem = React.forwardRef<HTMLButtonElement, MenuItemProps>(\n ({children, className, icon, destructive, disabled, onClick, ...props}, ref) => {\n const {setIsOpen} = useMenuContext()\n\n const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n if (disabled) {\n return\n }\n onClick?.(e)\n setIsOpen(false)\n }\n\n return (\n <button\n ref={ref}\n type=\"button\"\n role=\"menuitem\"\n disabled={disabled}\n onClick={handleClick}\n className={cx(\n 'flex w-full items-center gap-2 px-3 py-2 text-sm text-left',\n 'transition-colors duration-fast',\n destructive\n ? 'text-error hover:bg-error/10'\n : 'text-white hover:bg-graphite',\n 'focus-visible:outline-none focus-visible:bg-graphite',\n disabled && 'opacity-50 cursor-not-allowed',\n className\n )}\n {...props}\n >\n {icon && <span className=\"w-4 h-4 shrink-0\">{icon}</span>}\n {children}\n </button>\n )\n }\n)\n\nMenuItem.displayName = 'MenuItem'\n\n// MenuSeparator - divider between menu items\nexport const MenuSeparator = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({className, ...props}, ref) => (\n <div\n ref={ref}\n role=\"separator\"\n className={cx('my-1 h-px bg-ash', className)}\n {...props}\n />\n))\n\nMenuSeparator.displayName = 'MenuSeparator'\n\n// MenuLabel - non-interactive label\nexport const MenuLabel = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({className, children, ...props}, ref) => (\n <div\n ref={ref}\n className={cx('px-3 py-1.5 text-xs font-medium text-silver', className)}\n {...props}\n >\n {children}\n </div>\n))\n\nMenuLabel.displayName = 'MenuLabel'\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\n// Main Navbar container\nexport interface NavbarProps extends React.HTMLAttributes<HTMLElement> {\n fixed?: boolean\n bordered?: boolean\n}\n\nexport const Navbar = React.forwardRef<HTMLElement, NavbarProps>(\n ({fixed = false, bordered = true, className, children, ...props}, ref) => {\n return (\n <nav\n ref={ref}\n className={cx(\n 'w-full bg-charcoal px-4 py-3',\n bordered && 'border-b border-ash',\n fixed && 'fixed top-0 left-0 right-0 z-40',\n className\n )}\n {...props}\n >\n <div className=\"flex items-center justify-between\">{children}</div>\n </nav>\n )\n }\n)\n\nNavbar.displayName = 'Navbar'\n\n// NavbarBrand - logo/brand section\nexport interface NavbarBrandProps extends React.HTMLAttributes<HTMLDivElement> {\n}\n\nexport const NavbarBrand = React.forwardRef<HTMLDivElement, NavbarBrandProps>(\n ({className, children, ...props}, ref) => {\n return (\n <div\n ref={ref}\n className={cx('flex items-center gap-2', className)}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nNavbarBrand.displayName = 'NavbarBrand'\n\n// NavbarContent - center or end content area\nexport interface NavbarContentProps extends React.HTMLAttributes<HTMLDivElement> {\n position?: 'start' | 'center' | 'end'\n}\n\nexport const NavbarContent = React.forwardRef<HTMLDivElement, NavbarContentProps>(\n ({position = 'center', className, children, ...props}, ref) => {\n const positionClasses = {\n start: 'mr-auto',\n center: 'mx-auto',\n end: 'ml-auto',\n }\n\n return (\n <div\n ref={ref}\n className={cx(\n 'flex items-center gap-4',\n positionClasses[position],\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nNavbarContent.displayName = 'NavbarContent'\n\n// NavbarItem - individual navigation item\nexport interface NavbarItemProps extends React.HTMLAttributes<HTMLDivElement> {\n active?: boolean\n}\n\nexport const NavbarItem = React.forwardRef<HTMLDivElement, NavbarItemProps>(\n ({active = false, className, children, ...props}, ref) => {\n return (\n <div\n ref={ref}\n className={cx(\n 'flex items-center',\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nNavbarItem.displayName = 'NavbarItem'\n\n// NavbarLink - navigation link\nexport interface NavbarLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n active?: boolean\n}\n\nexport const NavbarLink = React.forwardRef<HTMLAnchorElement, NavbarLinkProps>(\n ({active = false, className, children, ...props}, ref) => {\n return (\n <a\n ref={ref}\n className={cx(\n 'text-sm font-medium transition-colors duration-fast',\n active ? 'text-gold' : 'text-silver hover:text-white',\n className\n )}\n {...props}\n >\n {children}\n </a>\n )\n }\n)\n\nNavbarLink.displayName = 'NavbarLink'\n\n// NavbarDivider - vertical separator\nexport const NavbarDivider = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({className, ...props}, ref) => (\n <div\n ref={ref}\n className={cx('h-6 w-px bg-ash mx-2', className)}\n {...props}\n />\n))\n\nNavbarDivider.displayName = 'NavbarDivider'\n","import React from 'react'\nimport {ChevronRight} from 'lucide-react'\nimport {cx} from '../utils'\n\n// Breadcrumb container\nexport interface BreadcrumbProps extends React.HTMLAttributes<HTMLElement> {\n separator?: React.ReactNode\n}\n\nexport const Breadcrumb = React.forwardRef<HTMLElement, BreadcrumbProps>(\n ({separator, className, children, ...props}, ref) => {\n const items = React.Children.toArray(children)\n const defaultSeparator = <ChevronRight className=\"h-4 w-4 text-ash\"/>\n\n return (\n <nav ref={ref} aria-label=\"Breadcrumb\" className={className} {...props}>\n <ol className=\"flex items-center gap-2\">\n {items.map((child, index) => (\n <li key={index} className=\"flex items-center gap-2\">\n {child}\n {index < items.length - 1 && (\n <span aria-hidden=\"true\">{separator ?? defaultSeparator}</span>\n )}\n </li>\n ))}\n </ol>\n </nav>\n )\n }\n)\n\nBreadcrumb.displayName = 'Breadcrumb'\n\n// BreadcrumbItem - individual breadcrumb item\nexport interface BreadcrumbItemProps extends React.HTMLAttributes<HTMLSpanElement> {\n current?: boolean\n}\n\nexport const BreadcrumbItem = React.forwardRef<HTMLSpanElement, BreadcrumbItemProps>(\n ({current = false, className, children, ...props}, ref) => {\n return (\n <span\n ref={ref}\n aria-current={current ? 'page' : undefined}\n className={cx(\n 'text-sm',\n current ? 'text-white font-medium' : 'text-silver',\n className\n )}\n {...props}\n >\n {children}\n </span>\n )\n }\n)\n\nBreadcrumbItem.displayName = 'BreadcrumbItem'\n\n// BreadcrumbLink - clickable breadcrumb link\nexport interface BreadcrumbLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n}\n\nexport const BreadcrumbLink = React.forwardRef<HTMLAnchorElement, BreadcrumbLinkProps>(\n ({className, children, ...props}, ref) => {\n return (\n <a\n ref={ref}\n className={cx(\n 'text-sm text-silver hover:text-gold transition-colors duration-fast',\n className\n )}\n {...props}\n >\n {children}\n </a>\n )\n }\n)\n\nBreadcrumbLink.displayName = 'BreadcrumbLink'\n","import React from 'react'\nimport {ChevronLeft, ChevronRight, MoreHorizontal} from 'lucide-react'\nimport {cx} from '../utils/cx'\n\nexport interface PaginationProps extends React.HTMLAttributes<HTMLElement> {\n page: number\n totalPages: number\n onPageChange: (page: number) => void\n siblingCount?: number\n showEdges?: boolean\n}\n\nfunction generatePagination(\n currentPage: number,\n totalPages: number,\n siblingCount: number\n): (number | 'ellipsis')[] {\n const totalSlots = siblingCount * 2 + 5 // siblings + current + 2 edges + 2 ellipses max\n\n if (totalPages <= totalSlots) {\n return Array.from({length: totalPages}, (_, i) => i + 1)\n }\n\n const leftSiblingIndex = Math.max(currentPage - siblingCount, 1)\n const rightSiblingIndex = Math.min(currentPage + siblingCount, totalPages)\n\n const showLeftEllipsis = leftSiblingIndex > 2\n const showRightEllipsis = rightSiblingIndex < totalPages - 1\n\n if (!showLeftEllipsis && showRightEllipsis) {\n const leftItemCount = 3 + 2 * siblingCount\n const leftRange = Array.from({length: leftItemCount}, (_, i) => i + 1)\n return [...leftRange, 'ellipsis', totalPages]\n }\n\n if (showLeftEllipsis && !showRightEllipsis) {\n const rightItemCount = 3 + 2 * siblingCount\n const rightRange = Array.from(\n {length: rightItemCount},\n (_, i) => totalPages - rightItemCount + i + 1\n )\n return [1, 'ellipsis', ...rightRange]\n }\n\n const middleRange = Array.from(\n {length: rightSiblingIndex - leftSiblingIndex + 1},\n (_, i) => leftSiblingIndex + i\n )\n return [1, 'ellipsis', ...middleRange, 'ellipsis', totalPages]\n}\n\nexport const Pagination = React.forwardRef<HTMLElement, PaginationProps>(\n (\n {\n page,\n totalPages,\n onPageChange,\n siblingCount = 1,\n showEdges = true,\n className,\n ...props\n },\n ref\n ) => {\n const pages = generatePagination(page, totalPages, siblingCount)\n\n const buttonBaseClass =\n 'flex items-center justify-center h-8 min-w-8 px-2 text-sm ' +\n 'border border-ash transition-colors duration-fast ' +\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gold'\n\n return (\n <nav\n ref={ref}\n role=\"navigation\"\n aria-label=\"Pagination\"\n className={cx('flex items-center gap-1', className)}\n {...props}\n >\n {/* Previous button */}\n <button\n type=\"button\"\n onClick={() => onPageChange(page - 1)}\n disabled={page <= 1}\n aria-label=\"Go to previous page\"\n className={cx(\n buttonBaseClass,\n 'text-silver hover:text-white hover:border-gold',\n page <= 1 && 'opacity-50 cursor-not-allowed hover:border-ash'\n )}\n >\n <ChevronLeft className=\"h-4 w-4\"/>\n </button>\n\n {/* Page numbers */}\n {pages.map((pageNum, index) =>\n pageNum === 'ellipsis' ? (\n <span\n key={`ellipsis-${index}`}\n className=\"flex items-center justify-center h-8 w-8 text-silver\"\n >\n <MoreHorizontal className=\"h-4 w-4\"/>\n </span>\n ) : (\n <button\n key={pageNum}\n type=\"button\"\n onClick={() => onPageChange(pageNum)}\n aria-label={`Go to page ${pageNum}`}\n aria-current={page === pageNum ? 'page' : undefined}\n className={cx(\n buttonBaseClass,\n page === pageNum\n ? 'bg-gold text-obsidian border-gold font-medium'\n : 'text-silver hover:text-white hover:border-gold'\n )}\n >\n {pageNum}\n </button>\n )\n )}\n\n {/* Next button */}\n <button\n type=\"button\"\n onClick={() => onPageChange(page + 1)}\n disabled={page >= totalPages}\n aria-label=\"Go to next page\"\n className={cx(\n buttonBaseClass,\n 'text-silver hover:text-white hover:border-gold',\n page >= totalPages && 'opacity-50 cursor-not-allowed hover:border-ash'\n )}\n >\n <ChevronRight className=\"h-4 w-4\"/>\n </button>\n </nav>\n )\n }\n)\n\nPagination.displayName = 'Pagination'\n","import React from 'react'\nimport {Check} from 'lucide-react'\nimport {cx} from '../utils/cx'\n\nexport type StepStatus = 'complete' | 'error'\n\nexport interface Step {\n id: string | number\n label: string\n}\n\nexport interface StepperProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Array of steps. Each requires: id (string | number), label (string). */\n steps: Step[]\n /** ID of the current step (must match a step.id from the steps array). */\n currentStep: string | number\n status?: StepStatus\n}\n\nexport const Stepper = React.forwardRef<HTMLDivElement, StepperProps>(\n ({steps, currentStep, status, className, ...rest}, ref) => {\n const currentIndex = steps.findIndex(step => step.id === currentStep)\n\n const getStepState = (index: number) => {\n if (index < currentIndex) {\n return 'complete'\n }\n if (index === currentIndex) {\n return status || 'current'\n }\n return 'future'\n }\n\n return (\n <div\n ref={ref}\n className={cx('flex items-center w-full', className)}\n {...rest}\n >\n {steps.map((step, index) => {\n const state = getStepState(index)\n const isLast = index === steps.length - 1\n\n return (\n <React.Fragment key={step.id}>\n <div className=\"flex flex-col items-center\">\n <div\n className={cx(\n 'flex items-center justify-center w-10 h-10 rounded-full border-2 font-semibold text-sm transition-all duration-200',\n state === 'complete' && 'bg-gold border-gold text-obsidian',\n state === 'current' && 'bg-charcoal border-gold text-gold',\n state === 'error' && 'bg-error border-error text-white',\n state === 'future' && 'bg-charcoal border-ash text-silver'\n )}\n >\n {state === 'complete' ? (\n <Check className=\"h-5 w-5\"/>\n ) : (\n <span>{index + 1}</span>\n )}\n </div>\n <span\n className={cx(\n 'mt-2 text-xs font-medium',\n state === 'complete' && 'text-gold',\n state === 'current' && 'text-white',\n state === 'error' && 'text-error',\n state === 'future' && 'text-silver'\n )}\n >\n {step.label}\n </span>\n </div>\n {!isLast && (\n <div\n className={cx(\n 'flex-1 h-0.5 mx-4 transition-all duration-200',\n index < currentIndex ? 'bg-gold' : 'bg-ash'\n )}\n />\n )}\n </React.Fragment>\n )\n })}\n </div>\n )\n }\n)\n\nStepper.displayName = 'Stepper'\n\nexport default Stepper\n","import React, {useCallback, useEffect, useRef, useState} from 'react'\nimport {Check, ChevronLeft, ChevronRight, Copy, GitBranch, Pencil, RotateCcw, Send, X} from 'lucide-react'\nimport {MarkdownContent} from './MarkdownContent'\nimport {AttachmentPreview, type AttachmentItem} from './AttachmentPreview'\nimport {cx, useCopyToClipboard} from '../utils'\n\nexport type MessageVariant = 'user' | 'assistant'\n\nexport interface MessageBranchInfo {\n /**\n * Current branch index (1-based)\n */\n current: number\n /**\n * Total number of sibling branches\n */\n total: number\n /**\n * Navigate to previous branch\n */\n onPrevious?: () => void\n /**\n * Navigate to next branch\n */\n onNext?: () => void\n}\n\nexport interface MessageActionsConfig {\n /**\n * Called when user edits a user message (creates a branch)\n */\n onEdit?: (newContent: string) => void\n /**\n * Called when user retries an assistant message (creates a branch)\n */\n onRetry?: () => void\n /**\n * Whether to show the copy button\n * @default true\n */\n showCopy?: boolean\n}\n\nexport interface MessageProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'content'> {\n /**\n * Whether the message is from the user or the assistant\n */\n variant?: MessageVariant\n /**\n * The message content (supports Markdown if string)\n */\n content: string | React.ReactNode\n /**\n * Whether the message is currently being streamed (shows cursor)\n */\n isStreaming?: boolean\n /**\n * Branch navigation info (shows branch indicator if provided and total > 1)\n */\n branchInfo?: MessageBranchInfo\n /**\n * Actions configuration (shows action bar if provided)\n */\n actions?: MessageActionsConfig\n /**\n * Whether to hide actions (e.g., during streaming)\n */\n hideActions?: boolean\n /**\n * Attachments to render above the bubble. Used by user messages to show the\n * files that were attached to that turn. Empty/undefined renders nothing.\n */\n attachments?: AttachmentItem[]\n /**\n * Click handler invoked with an attachment's `artifactId`. Wire to open the\n * artifact-card modal in the host app.\n */\n onAttachmentOpen?: (artifactId: string) => void\n /**\n * Click handler for the bubble — when provided, the message becomes a\n * navigational anchor (mirrors Checkpoint's `onJumpHere`): clicking the\n * bubble moves the active leaf to this node. Suppressed when `isActive`\n * is true (already here) or when the user is selecting text or clicking\n * a markdown link inside the bubble.\n */\n onJumpHere?: () => void\n /**\n * When true, this message is the active leaf — `onJumpHere` is suppressed\n * (no point jumping to where you already are) and the affordance hover\n * styling is skipped.\n */\n isActive?: boolean\n}\n\nconst VARIANT_STYLES: Record<MessageVariant, string> = {\n user: 'bg-gold text-obsidian ml-auto',\n assistant: 'bg-charcoal border border-ash text-white mr-auto',\n}\n\nconst ACTION_BUTTON_CLASSES = cx(\n 'p-1.5 text-silver/60 hover:text-silver transition-colors duration-150',\n 'hover:bg-white/5',\n 'disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent',\n)\n\nconst BRANCH_BUTTON_CLASSES = cx(\n 'p-0.5 hover:text-white hover:bg-white/10 transition-colors',\n 'disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-silver/70',\n)\n\ninterface ActionButtonProps {\n onClick: () => void\n label: string\n children: React.ReactNode\n disabled?: boolean\n}\n\nfunction ActionButton({onClick, label, children, disabled}: ActionButtonProps) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className={ACTION_BUTTON_CLASSES}\n aria-label={label}\n >\n {children}\n </button>\n )\n}\n\nexport const Message = React.forwardRef<HTMLDivElement, MessageProps>(\n ({\n variant = 'assistant',\n className,\n content,\n isStreaming,\n branchInfo,\n actions,\n hideActions,\n attachments,\n onAttachmentOpen,\n onJumpHere,\n isActive,\n ...rest\n }, ref) => {\n const isUser = variant === 'user'\n const isJumpInteractive = !!onJumpHere && !isActive && !isStreaming\n const handleBubbleClick = useCallback((e: React.MouseEvent<HTMLDivElement>) => {\n if (!isJumpInteractive) {\n return\n }\n // Don't hijack a markdown-link click — let the anchor's default\n // behaviour run.\n const target = e.target as HTMLElement\n if (target.closest('a, button')) {\n return\n }\n // Don't hijack a text-selection drag — if the user has highlighted\n // anything inside the bubble, the click was the end of a selection.\n const selection = typeof window !== 'undefined' ? window.getSelection() : null\n if (selection && !selection.isCollapsed) {\n return\n }\n onJumpHere!()\n }, [isJumpInteractive, onJumpHere])\n const {copied, copy} = useCopyToClipboard()\n const [isEditing, setIsEditing] = useState(false)\n const [editValue, setEditValue] = useState(typeof content === 'string' ? content : '')\n const textareaRef = useRef<HTMLTextAreaElement>(null)\n\n const showBranchNav = branchInfo && branchInfo.total > 1\n const showActions = actions && !hideActions && !isStreaming\n\n // Auto-resize textarea when editing\n useEffect(() => {\n if (isEditing && textareaRef.current) {\n const textarea = textareaRef.current\n textarea.style.height = 'auto'\n textarea.style.height = `${textarea.scrollHeight}px`\n textarea.focus()\n textarea.setSelectionRange(textarea.value.length, textarea.value.length)\n }\n }, [isEditing])\n\n const handleCopy = useCallback(() => {\n if (typeof content === 'string') {\n void copy(content)\n }\n }, [copy, content])\n\n const handleStartEdit = () => {\n if (typeof content === 'string') {\n setEditValue(content)\n setIsEditing(true)\n }\n }\n\n const handleCancelEdit = () => {\n setIsEditing(false)\n if (typeof content === 'string') {\n setEditValue(content)\n }\n }\n\n const handleSubmitEdit = () => {\n const trimmed = editValue.trim()\n if (typeof content === 'string' && trimmed && trimmed !== content) {\n actions?.onEdit?.(trimmed)\n }\n setIsEditing(false)\n }\n\n const handleEditKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault()\n handleSubmitEdit()\n } else if (e.key === 'Escape') {\n handleCancelEdit()\n }\n }\n\n const handleEditChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setEditValue(e.target.value)\n const textarea = e.target\n textarea.style.height = 'auto'\n textarea.style.height = `${textarea.scrollHeight}px`\n }\n\n return (\n <div\n ref={ref}\n className={cx(\n 'flex flex-col',\n isUser ? 'items-end' : 'items-start',\n className\n )}\n {...rest}\n >\n {/* Attachments above the bubble (user messages with prior attachments). */}\n {attachments && attachments.length > 0 && (\n <div className={cx('mb-1.5', isUser ? 'self-end' : 'self-start')}>\n <AttachmentPreview\n attachments={attachments}\n removable={false}\n onOpen={onAttachmentOpen}\n />\n </div>\n )}\n\n {/* Message bubble OR Edit input (replaces message when editing) */}\n {isUser && isEditing ? (\n <div className=\"w-full max-w-11/12\">\n <div className=\"relative bg-gold\">\n <textarea\n ref={textareaRef}\n value={editValue}\n onChange={handleEditChange}\n onKeyDown={handleEditKeyDown}\n className=\"w-full bg-transparent text-obsidian px-3 py-2 pr-20 resize-none outline-none min-h-10 text-sm\"\n rows={1}\n />\n <div className=\"absolute right-1 top-1/2 -translate-y-1/2 flex gap-0.5\">\n <button\n type=\"button\"\n onClick={handleCancelEdit}\n className=\"p-1.5 text-obsidian/60 hover:text-obsidian transition-colors\"\n aria-label=\"Cancel edit\"\n >\n <X className=\"w-4 h-4\"/>\n </button>\n <button\n type=\"button\"\n onClick={handleSubmitEdit}\n disabled={!editValue.trim() || editValue.trim() === content}\n className=\"p-1.5 text-obsidian/60 hover:text-obsidian transition-colors disabled:opacity-30\"\n aria-label=\"Submit edit\"\n >\n <Send className=\"w-4 h-4\"/>\n </button>\n </div>\n </div>\n </div>\n ) : (\n <div\n className={cx(\n 'px-3 py-2 w-fit max-w-11/12',\n VARIANT_STYLES[variant],\n isJumpInteractive && 'cursor-pointer hover:brightness-110 transition-all duration-150',\n )}\n onClick={isJumpInteractive ? handleBubbleClick : undefined}\n role={isJumpInteractive ? 'button' : undefined}\n aria-label={isJumpInteractive ? 'Jump to this message' : undefined}\n >\n {typeof content === 'string' ? (\n <MarkdownContent\n content={content}\n className={cx('prose-sm', isUser ? 'prose-inherit' : 'prose-invert')}\n isStreaming={isStreaming}\n cursorClassName=\"ml-0.5\"\n />\n ) : content}\n </div>\n )}\n\n {/* Action bar - below the message, includes branch nav on the right */}\n {showActions && !isEditing && (\n <div className={cx(\n 'flex items-center gap-0.5 mt-1',\n isUser ? 'mr-1' : 'ml-1'\n )}>\n {/* Copy - available for both */}\n {(actions.showCopy !== false) && (\n <ActionButton onClick={handleCopy}\n label={copied ? 'Copied!' : 'Copy message'}>\n {copied\n ? <Check className=\"w-3.5 h-3.5 text-success\"/>\n : <Copy className=\"w-3.5 h-3.5\"/>}\n </ActionButton>\n )}\n\n {/* Edit - only for user messages */}\n {isUser && actions.onEdit && typeof content === 'string' && (\n <ActionButton onClick={handleStartEdit} label=\"Edit message\">\n <Pencil className=\"w-3.5 h-3.5\"/>\n </ActionButton>\n )}\n\n {/* Retry - only for assistant messages */}\n {!isUser && actions.onRetry && (\n <ActionButton onClick={actions.onRetry} label=\"Regenerate response\">\n <RotateCcw className=\"w-3.5 h-3.5\"/>\n </ActionButton>\n )}\n\n {/* Branch navigator - to the right of action buttons */}\n {showBranchNav && (\n <>\n <div className=\"w-px h-4 bg-ash/40 mx-1\"/>\n <div className=\"flex items-center gap-0.5 text-silver/70\">\n <GitBranch className=\"w-3 h-3 mr-0.5 text-silver/50\"/>\n <button\n type=\"button\"\n onClick={branchInfo.onPrevious}\n disabled={branchInfo.current <= 1}\n className={BRANCH_BUTTON_CLASSES}\n aria-label=\"Previous branch\"\n >\n <ChevronLeft className=\"w-3 h-3\"/>\n </button>\n <span className=\"text-xs tabular-nums min-w-6 text-center\">\n {branchInfo.current}/{branchInfo.total}\n </span>\n <button\n type=\"button\"\n onClick={branchInfo.onNext}\n disabled={branchInfo.current >= branchInfo.total}\n className={BRANCH_BUTTON_CLASSES}\n aria-label=\"Next branch\"\n >\n <ChevronRight className=\"w-3 h-3\"/>\n </button>\n </div>\n </>\n )}\n </div>\n )}\n </div>\n )\n }\n)\n\nMessage.displayName = 'Message'\n\nexport default Message\n","import React from 'react'\nimport ReactMarkdown, {type Components} from 'react-markdown'\nimport remarkGfm from 'remark-gfm'\nimport {cx} from '../utils'\nimport {remarkMentions} from '../utils/remarkMentions'\n\nexport interface MarkdownContentProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Content to display. Markdown by default; pass `isMarkdown={false}` for literal display\n * of plain text (preserves whitespace, no parsing).\n */\n content: string\n /**\n * Whether the content should be parsed as Markdown. `false` renders the string verbatim\n * inside a `whitespace-pre-wrap` block — useful for plain-text artifacts.\n * @default true\n */\n isMarkdown?: boolean\n /**\n * When true, injects a streaming cursor at the end of the rendered content.\n */\n isStreaming?: boolean\n /**\n * Additional classes for the streaming cursor.\n */\n cursorClassName?: string\n /**\n * When set, the renderer recognises `@artifact_name` mentions in prose (anywhere except\n * inside code spans / blocks) and replaces each with the React node returned by this\n * callback. Typical wiring is `(name) => <MentionChip name={name} onClick={...} />`,\n * giving each chip a real per-call-site click handler.\n *\n * Without this prop, mentions render as literal `@name` text.\n */\n mentionRenderer?: (name: string) => React.ReactNode\n}\n\nconst CURSOR_BASE_CLASSES = 'inline-block bg-current animate-cursor-blink w-0.5 h-cursor '\n + 'translate-y-cursor-offset'\n\n/**\n * Renders Markdown content into a real React tree via `react-markdown`. Drop-in for prose\n * surfaces (chat messages, artifact bodies, deliverable text). Optional `mentionRenderer`\n * adds inline `@artifact_name` chip rendering — see prop docs.\n *\n * Raw HTML in the source is escaped (not rendered) by react-markdown's defaults; this is\n * intentional and safer than the previous pipeline. Pass markdown.\n */\nexport const MarkdownContent = React.forwardRef<HTMLDivElement, MarkdownContentProps>(\n ({className, content, isMarkdown = true, isStreaming, cursorClassName,\n mentionRenderer, ...rest}, ref) => {\n if (!isMarkdown) {\n return (\n <div ref={ref} className={cx('prose whitespace-pre-wrap', className)} {...rest}>\n {content}\n {isStreaming && (\n <span aria-hidden=\"true\"\n className={cx(CURSOR_BASE_CLASSES, cursorClassName)}/>\n )}\n </div>\n )\n }\n\n // `mention` isn't a known IntrinsicElement, but react-markdown looks tagNames up\n // by string in `components`, so a dedicated record keeps the typing honest without\n // forcing a cast on the whole `components` object.\n const components: Components & {mention?: React.ComponentType<{name: string}>} = {\n // Harden external links so user-authored URLs don't open in the same tab\n // and can't reach `window.opener`.\n a: ({href, children}) => (\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </a>\n ),\n ...(mentionRenderer && {\n mention: ({name}) => <>{mentionRenderer(name)}</>,\n }),\n }\n\n const remarkPlugins = mentionRenderer ? [remarkGfm, remarkMentions] : [remarkGfm]\n\n return (\n <div ref={ref} className={cx('prose', className)} {...rest}>\n <ReactMarkdown remarkPlugins={remarkPlugins} components={components}>\n {content}\n </ReactMarkdown>\n {isStreaming && (\n <span aria-hidden=\"true\"\n className={cx(CURSOR_BASE_CLASSES, cursorClassName)}/>\n )}\n </div>\n )\n }\n)\n\nMarkdownContent.displayName = 'MarkdownContent'\n\nexport default MarkdownContent\n","import {visit} from 'unist-util-visit'\nimport type {Root, Text, PhrasingContent} from 'mdast'\n\nconst MENTION_PATTERN = /(?<!\\w)@(\\w+)/g\n\n/**\n * Custom mdast node emitted for `@artifact_name` mentions. Map this to a renderer via the\n * `components` prop on `<ReactMarkdown>` (or `mentionRenderer` on `<MarkdownContent>`):\n * `{ mention: ({ name }) => <MyChip name={name} /> }`.\n */\nexport interface MentionNode {\n type: 'mention'\n name: string\n data?: {\n hName: string\n hProperties: { name: string }\n }\n}\n\ndeclare module 'mdast' {\n interface PhrasingContentMap {\n mention: MentionNode\n }\n interface RootContentMap {\n mention: MentionNode\n }\n}\n\n/**\n * Remark plugin that walks text nodes in the markdown AST and splits any `@artifact_name`\n * runs into a custom `mention` node. Patterns inside fenced or inline code are left\n * untouched because the markdown AST already isolates code from prose. The plugin emits\n * `data.hName = 'mention'` so rehype maps it to a custom React component.\n */\nexport function remarkMentions() {\n return (tree: Root) => {\n visit(tree, 'text', (node: Text, index, parent) => {\n if (!parent || index == null) {\n return\n }\n const {value} = node\n const matches = [...value.matchAll(MENTION_PATTERN)]\n if (matches.length === 0) {\n return\n }\n\n const replacement: PhrasingContent[] = []\n let lastEnd = 0\n for (const match of matches) {\n if (match.index > lastEnd) {\n replacement.push({type: 'text', value: value.slice(lastEnd, match.index)})\n }\n const name = match[1]\n replacement.push({\n type: 'mention',\n name,\n data: {hName: 'mention', hProperties: {name}},\n })\n lastEnd = match.index + match[0].length\n }\n if (lastEnd < value.length) {\n replacement.push({type: 'text', value: value.slice(lastEnd)})\n }\n\n parent.children.splice(index, 1, ...replacement)\n return index + replacement.length\n })\n }\n}\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport interface StreamingCursorProps extends React.HTMLAttributes<HTMLSpanElement> {\n variant?: 'block' | 'line' | 'underscore'\n}\n\nexport const StreamingCursor = React.forwardRef<HTMLSpanElement, StreamingCursorProps>(\n ({className, variant = 'line', ...rest}, ref) => {\n const variantStyles = {\n block: 'w-2.5 h-cursor translate-y-cursor-offset',\n line: 'w-0.5 h-cursor translate-y-cursor-offset',\n underscore: 'w-2.5 h-0.5 self-end mb-0.5'\n }\n\n return (\n <span\n ref={ref}\n className={cx(\n 'inline-block bg-current animate-cursor-blink',\n variantStyles[variant],\n className\n )}\n aria-hidden=\"true\"\n {...rest}\n />\n )\n }\n)\n\nStreamingCursor.displayName = 'StreamingCursor'\n\nexport default StreamingCursor\n","import React, {useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState} from 'react'\nimport {cx} from '../../utils'\nimport {ChatView, type ChatViewItem} from './ChatView'\nimport {ChatInput, type ChatInputNotice} from './ChatInput'\n\nimport {ArtifactsPanel} from './ArtifactsPanel'\nimport {HistoryPanel} from './HistoryPanel'\nimport {areAllTasksSettled, type Task, TodosList} from './TodosList'\nimport {\n type ExternalToolDefinition,\n type ToolDefinition,\n type ToolPanelState,\n ToolSidebar\n} from './ToolSidebar'\nimport {ToolPanelContainer} from './ToolPanelContainer'\nimport {type Artifact, useResizable} from './hooks'\nimport type {ArtifactNode} from '../ArtifactNode'\nimport {\n type Attachment,\n type ChatNode,\n type CheckpointNode,\n type ConversationTree,\n type MessageNode,\n type TreeNode,\n} from './types'\nimport {\n findAncestor,\n getActivePath,\n getGreyedFuture,\n getSiblingInfo,\n setActiveLeaf,\n switchBranch,\n} from './tree'\nimport {ChatBubbleIcon, CheckSquareIcon, MediaIcon, SquareLoaderIcon} from '../icons'\n\nexport interface Conversation {\n /**\n * Unique identifier for the conversation\n */\n id: string\n /**\n * Title shown as the first line of the row. Editable via the rename affordance.\n */\n title: string\n /**\n * Project this conversation belongs to. Shown as the second line of the row and\n * collected into the project filter in the history panel.\n */\n project?: string\n /**\n * Timestamp used to group conversations into Today / Yesterday / Older.\n * Accepts a Date, ISO string, or millisecond epoch. Not displayed.\n */\n timestamp?: string | number | Date\n /**\n * Whether this conversation is currently active (highlighted in the list).\n */\n isActive?: boolean\n}\n\n/**\n * Imperative API exposed by `ChatInterface` via its forwarded ref. Use this from\n * call sites that need to drive the chat from outside React state — typically\n * to surface an artifact when the user clicks a `MentionChip` or other\n * cross-surface pointer. Attach with\n * `useRef<ChatInterfaceHandle>(null)` and read `ref.current?.openArtifact(name)`.\n */\nexport interface ChatInterfaceHandle {\n /**\n * Open the artifact lightbox for the given artifact name. Ensures the\n * artifacts panel is open (overriding any prior dismissal) before\n * surfacing the lightbox, since the lightbox renders inside the panel.\n * If the name is not present in the current artifact tree, the call is a\n * no-op — the chip's leading icon already signals unknown / stale\n * references via `HelpCircle`.\n */\n openArtifact(name: string): void\n}\n\nexport interface ChatInterfaceProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSubmit'> {\n /**\n * Array of messages in the conversation (flat mode)\n * Use this OR conversationTree, not both\n */\n messages?: MessageNode[]\n /**\n * Conversation tree for branching support\n * Use this OR messages, not both\n */\n conversationTree?: ConversationTree\n /**\n * Called when the conversation tree changes (for tree mode)\n */\n onTreeChange?: (tree: ConversationTree) => void\n /**\n * List of past conversations for the sidebar\n */\n conversations?: Conversation[]\n /**\n * Called when a message is submitted from the input.\n * Provides the text content and any files attached.\n */\n onMessageSubmit?: (message: string, attachments?: Attachment[]) => void\n /**\n * Called when a user message is edited.\n * In tree mode, this creates a new branch.\n */\n onEditMessage?: (messageId: string, newContent: string) => void\n /**\n * Called when an assistant message is retried.\n * In tree mode, this creates a new branch.\n */\n onRetryMessage?: (messageId: string) => void\n /**\n * Called when the user clicks a non-active node — checkpoint or message —\n * to move the active leaf there. Receives the node id; the consumer should\n * move the active leaf without forking so the artifacts panel and chat\n * re-anchor. Mirrors the per-component `onJumpHere`. In tree mode only.\n */\n onJumpHere?: (nodeId: string) => void\n /**\n * Called when the user clicks \"Jump to latest\" on the greyed-future divider\n * or otherwise asks to return to the deepest leaf they had reached.\n * In tree mode only.\n */\n onJumpToLatest?: () => void\n /**\n * Called when the Stop button is clicked during assistant streaming.\n */\n onStop?: () => void\n /**\n * Called when a conversation is selected from the sidebar.\n */\n onSelectConversation?: (id: string) => void\n /**\n * Called when the \"New Chat\" button is clicked in the sidebar.\n */\n onNewChat?: () => void\n /**\n * Called when a conversation's title is renamed from the history panel.\n * Receives the conversation id and the new, trimmed title.\n */\n onRenameConversation?: (id: string, newTitle: string) => void\n /**\n * Whether the assistant is currently streaming a response.\n * Shows a stop button and disables certain actions.\n */\n isStreaming?: boolean\n /**\n * Whether to show the thinking indicator.\n * Typically shown after a user message but before the first streaming token.\n */\n isThinking?: boolean\n /**\n * Optional verbatim label for the thinking indicator. When set, the indicator\n * suppresses its rotating phrases and renders this string as-is. Use for\n * domain-specific waits like \"Analyzing uploads...\" — any animated suffix\n * (e.g. cycling dots) is the caller's responsibility.\n */\n thinkingLabel?: string\n /**\n * Placeholder text for the main chat input.\n */\n placeholder?: string\n /**\n * Helper text shown in the empty state (when there are no messages).\n */\n emptyStateHelper?: React.ReactNode\n /**\n * Custom content to show when the conversation is empty.\n * Overrides the default centered input and helper text.\n */\n emptyState?: React.ReactNode\n /**\n * Whether to show the attachment (paperclip) button in the input.\n */\n showAttachmentButton?: boolean\n /**\n * Whether to enable message-level actions (copy, edit, retry).\n */\n enableMessageActions?: boolean\n /**\n * Current attachments for the chat input (controlled).\n */\n attachments?: Attachment[]\n /**\n * Called when attachments are added or removed in the chat input.\n */\n onAttachmentsChange?: (attachments: Attachment[]) => void\n /**\n * Called when an attachment is removed by the user (clicking the \"x\")\n */\n onAttachmentRemove?: (attachment: Attachment) => void\n /**\n * Called when a chip above a sent message is clicked. Receives the\n * `artifactId` carried by the chip; wire to open the artifact-card modal.\n * Without this, above-message chips are not clickable.\n */\n onAttachmentOpen?: (artifactId: string) => void\n /**\n * Top-level artifact tree nodes for the artifacts panel.\n */\n artifactNodes?: ArtifactNode[]\n /**\n * Whether the artifacts panel is currently open (controlled).\n * When set, maps to the tool panel system — opens the artifacts tool.\n */\n isArtifactsPanelOpen?: boolean\n /**\n * Called when the artifacts panel is opened or closed (controlled).\n */\n onArtifactsPanelOpenChange?: (open: boolean) => void\n /**\n * Resolves the floating action cluster shown over the artifact lightbox.\n * The host switches on `artifact.type` and returns the right buttons for\n * that kind (e.g. Share + Download for deliverables, Download for images).\n * Aurelius ships the close affordance itself; return only the kind-specific\n * actions, or `null` when none. Use `ctx.onClose` to dismiss the lightbox\n * after a successful operation.\n */\n getArtifactActions?: (\n artifact: Artifact,\n ctx: {onClose: () => void},\n ) => React.ReactNode\n /**\n * Tasks to display in the todos list tool panel.\n * Shows a list of tasks with status indicators.\n */\n tasks?: Task[]\n /**\n * Title for the todos list\n * @default \"Tasks\"\n */\n tasksTitle?: string\n /**\n * Called when the \"Stop All Tasks\" button is clicked in the tasks panel.\n * Only shown when at least one task has in_progress status.\n * The consumer app decides what stopping means (cancel API calls, mark tasks cancelled, etc.).\n *\n * May return a Promise. While the Promise is pending, the button becomes\n * disabled and displays a spinner with \"Stopping tasks\" so the user knows\n * the stop request is in flight.\n */\n onStopAllTasks?: () => void | Promise<void>\n /**\n * Optional notice displayed above the chat input (e.g. credit warnings or exhaustion messages).\n * Pass `{ variant: 'warning', content: '...', dismissible: true, onDismiss: () => ... }` for\n * soft warnings, or `{ variant: 'error', content: <ReactNode> }` for hard blocks.\n */\n inputNotice?: ChatInputNotice\n /**\n * Called whenever the chat input value changes, giving the consumer access to the current text.\n */\n onInputChange?: (value: string) => void\n /**\n * Initial value for the input, used for state restoration (e.g. from DB or localStorage)\n */\n initialInputValue?: string\n /**\n * Additional tools to add to the tool sidebars. Each ExternalToolDefinition provides\n * an id, icon, label, group ('top-left' | 'bottom-left' | 'top-right' | 'bottom-right'),\n * and content (ReactNode) to render when opened. Tools in the same group are mutually\n * exclusive. Built-in tools occupy: History (top-left), Artifacts (top-right), Tasks\n * (bottom-right). Consumer tools are added alongside these.\n */\n tools?: ExternalToolDefinition[]\n /**\n * Whether to automatically focus the chat input when it becomes enabled.\n * Defaults to true.\n */\n autoFocus?: boolean\n /**\n * Forwarded to the underlying chat-input `<textarea>`. Use to drive an\n * inline autocomplete (e.g. an `@`-mention picker) — read selection/caret\n * position, mirror the textarea for caret coordinates, or imperatively\n * update its value.\n */\n textareaRef?: React.Ref<HTMLTextAreaElement>\n /**\n * Forwarded to the underlying chat-input. Runs before the input's own\n * keydown handling; calling `e.preventDefault()` opts that event out of\n * default behaviour (submit-on-Enter, newline) — typical use is to claim\n * Arrow / Enter / Escape while an autocomplete panel is open.\n */\n onTextareaKeyDown?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void\n}\n\n/**\n * ChatInterface is the main orchestrator for a full-featured chat experience.\n *\n * Features:\n * - ChatView (center) — main conversation area with smart scrolling\n * - Dual tool sidebar system — IntelliJ-style tool sidebars on left and right:\n * - Left sidebar: History (top-left, conversation list + new chat) + consumer tools (bottom-left)\n * - Right sidebar: Artifacts (top-right) + Tasks (bottom-right) + consumer tools\n * - Tools in the same group are mutually exclusive\n * - Both panels can be open simultaneously — chat area shrinks to accommodate\n * - Each panel is independently width-resizable\n * - Vertical split with draggable divider when both slots in a panel are active\n * - Consumer tools via `tools` prop — provide icon, label, group, and content\n * - ChatInput — position-aware input that centers in empty state\n * - Branching — support for conversation tree with branch navigation\n * - Message Actions — copy, edit, retry\n * - Thinking Indicator — shown between user message and response\n *\n * Artifacts are supplied as a tree of ArtifactNode objects via the\n * artifactNodes prop.\n */\nexport const ChatInterface = React.forwardRef<ChatInterfaceHandle, ChatInterfaceProps>(\n (\n {\n messages = [],\n conversationTree,\n onTreeChange,\n conversations = [],\n onMessageSubmit,\n onEditMessage,\n onRetryMessage,\n onJumpHere,\n onJumpToLatest,\n onStop,\n onSelectConversation,\n onNewChat,\n onRenameConversation,\n isStreaming = false,\n isThinking = false,\n thinkingLabel,\n placeholder = 'Send a message...',\n emptyStateHelper = \"Let's talk.\",\n emptyState,\n showAttachmentButton = true,\n enableMessageActions = true,\n attachments: propsAttachments,\n onAttachmentsChange,\n onAttachmentRemove,\n onAttachmentOpen,\n artifactNodes,\n isArtifactsPanelOpen,\n onArtifactsPanelOpenChange,\n getArtifactActions,\n tasks = [],\n tasksTitle,\n onStopAllTasks,\n inputNotice,\n onInputChange,\n initialInputValue = '',\n tools: externalTools = [],\n autoFocus = true,\n textareaRef,\n onTextareaKeyDown,\n className,\n ...rest\n },\n ref\n ) => {\n const prevArtifactNodesRef = useRef<ArtifactNode[]>([])\n const prevTasksRef = useRef<Task[]>([])\n\n // Drives the artifacts-panel modal when the user clicks an above-message\n // chip. Round-trips with `onArtifactClosed` so re-clicking the same chip\n // after a manual dismiss reopens the modal.\n const [panelOpenArtifactId, setPanelOpenArtifactId] = useState<string | null>(null)\n\n // ── Tool panel state ──────────────────────────────────────────\n const [internalTools, setInternalTools] = useState<ToolPanelState>({\n 'top-left': 'history',\n 'bottom-left': null,\n 'top-right': null,\n 'bottom-right': null,\n })\n\n // Track tools the user has actively dismissed — auto-open won't reopen these\n const dismissedToolsRef = useRef<Set<string>>(new Set())\n\n // Open the artifacts panel and surface the lightbox for the given\n // artifact. Ensures the panel is mounted (the lightbox lives inside it)\n // and clears any prior dismissal — clicking a chip is an explicit\n // intent that overrides \"I closed this earlier.\"\n const openArtifact = useCallback((artifactId: string) => {\n dismissedToolsRef.current.delete('artifacts')\n if (isArtifactsPanelOpen === undefined) {\n setInternalTools(prev => prev['top-right'] === 'artifacts'\n ? prev\n : {...prev, 'top-right': 'artifacts'})\n } else if (!isArtifactsPanelOpen) {\n onArtifactsPanelOpenChange?.(true)\n }\n setPanelOpenArtifactId(artifactId)\n }, [isArtifactsPanelOpen, onArtifactsPanelOpenChange])\n\n const handleAttachmentOpen = useCallback((artifactId: string) => {\n openArtifact(artifactId)\n onAttachmentOpen?.(artifactId)\n }, [openArtifact, onAttachmentOpen])\n\n const handleArtifactPanelClosed = useCallback(() => {\n setPanelOpenArtifactId(null)\n }, [])\n\n useImperativeHandle(ref, () => ({openArtifact}), [openArtifact])\n\n // Controlled vs uncontrolled: isArtifactsPanelOpen maps to the tool system\n const isPanelControlled = isArtifactsPanelOpen !== undefined\n\n // Derive effective tool state\n const activeTools: ToolPanelState = useMemo(() => {\n if (isPanelControlled) {\n return {\n ...internalTools,\n 'top-right': isArtifactsPanelOpen ? 'artifacts' : internalTools['top-right'],\n }\n }\n return internalTools\n }, [isPanelControlled, isArtifactsPanelOpen, internalTools])\n\n const isLeftPanelOpen = activeTools['top-left'] !== null || activeTools['bottom-left']\n !== null\n const isRightPanelOpen = activeTools['top-right'] !== null || activeTools['bottom-right']\n !== null\n\n // ── Resizable panels ──────────────────────────────────────────\n const {\n width: rightToolsWidth,\n startResizing: startResizingRightTools\n } = useResizable({\n initialWidthPercent: 40,\n minWidthPercent: 30,\n maxWidthPercent: 80,\n direction: 'left'\n })\n\n const {\n width: leftToolsWidth,\n startResizing: startResizingLeftTools\n } = useResizable({\n initialWidthPercent: 25,\n minWidthPercent: 15,\n maxWidthPercent: 40,\n direction: 'right'\n })\n\n // ── Tool definitions ──────────────────────────────────────────\n const allSettled = tasks.length === 0 || areAllTasksSettled(tasks)\n\n // ── Merged tool definitions (built-in + external) ──────────────\n const allToolDefinitions: ToolDefinition[] = useMemo(() => {\n const builtIn: ToolDefinition[] = [\n {id: 'history', icon: <ChatBubbleIcon/>, label: 'History', group: 'top-left'},\n {id: 'artifacts', icon: <MediaIcon/>, label: 'Artifacts', group: 'top-right'},\n {\n id: 'todos',\n icon: allSettled ? <CheckSquareIcon/> : <SquareLoaderIcon/>,\n label: 'Tasks',\n group: 'bottom-right',\n },\n ]\n const external: ToolDefinition[] = externalTools.map(({content: _content, ...def}) => def)\n return [...builtIn, ...external]\n }, [allSettled, externalTools])\n\n // ── Toggle a tool ─────────────────────────────────────────────\n const toggleTool = useCallback((toolId: string) => {\n // Find the tool's group\n const toolDef = allToolDefinitions.find(t => t.id === toolId)\n if (!toolDef) {\n return\n }\n\n const group = toolDef.group\n\n // Special case: controlled artifacts panel\n if (toolId === 'artifacts' && isPanelControlled) {\n const isCurrentlyOpen = activeTools['top-right'] === 'artifacts'\n if (isCurrentlyOpen) {\n dismissedToolsRef.current.add('artifacts')\n } else {\n dismissedToolsRef.current.delete('artifacts')\n }\n onArtifactsPanelOpenChange?.(!isCurrentlyOpen)\n return\n }\n\n setInternalTools(prev => {\n const isCurrentlyOpen = prev[group] === toolId\n if (isCurrentlyOpen) {\n dismissedToolsRef.current.add(toolId)\n } else {\n dismissedToolsRef.current.delete(toolId)\n }\n return {\n ...prev,\n [group]: isCurrentlyOpen ? null : toolId,\n }\n })\n }, [allToolDefinitions, isPanelControlled, activeTools, onArtifactsPanelOpenChange])\n\n // ── Tree → rows ───────────────────────────────────────────────\n const isTreeMode = !!conversationTree\n\n const tree = isTreeMode\n ? (conversationTree as ConversationTree<ChatNode>)\n : null\n\n /** Active path nodes (root → active leaf), heterogeneous (messages + checkpoints). */\n const activePath: TreeNode<ChatNode>[] = useMemo(() => {\n if (tree) return getActivePath(tree)\n // Flat-array fallback: lift each MessageNode into a TreeNode<ChatNode> shape.\n return (messages || []).map(m => ({...m, children: [], branchIndex: 0}))\n }, [tree, messages])\n\n /** Greyed-future nodes (between active leaf and the previously-active deepest leaf). */\n const greyedFuture: TreeNode<ChatNode>[] = useMemo(\n () => (tree ? getGreyedFuture(tree) : []),\n [tree],\n )\n\n /**\n * The checkpoint currently driving the artifacts panel — the nearest\n * ancestor of the active leaf whose kind is `checkpoint`. Used to mark\n * one checkpoint row as \"active\" (gold accent, no jump affordance).\n */\n const activeCheckpointId: string | null = useMemo(() => {\n if (!tree) return null\n const found = findAncestor(\n tree,\n tree.activeLeafId,\n (n): n is TreeNode<CheckpointNode> => n.kind === 'checkpoint',\n )\n return found?.id ?? null\n }, [tree])\n\n // ── Auto-open tools when data arrives (uncontrolled mode) ─────\n // Only auto-opens a tool if the user hasn't actively dismissed it.\n useEffect(() => {\n const nodes = artifactNodes || []\n const prevNodes = prevArtifactNodesRef.current\n\n const hasNewOrChangedNode = nodes.length !== prevNodes.length\n || nodes.some((n, i) => n.id !== prevNodes[i]?.id)\n\n if (!isPanelControlled\n && hasNewOrChangedNode && nodes.length > 0\n && !dismissedToolsRef.current.has('artifacts')) {\n setInternalTools(prev => ({...prev, 'top-right': 'artifacts'}))\n }\n\n const hasNewOrUpdatedTask = (curr: Task[], prev: Task[]): boolean => {\n return curr.some(c => {\n const p = prev.find(x => x.id === c.id)\n if (!p) {\n return true\n }\n if (c.status !== p.status || c.label !== p.label) {\n return true\n }\n return !!(c.subtasks && hasNewOrUpdatedTask(c.subtasks, p?.subtasks || []));\n\n })\n }\n\n if (hasNewOrUpdatedTask(tasks, prevTasksRef.current)\n && !dismissedToolsRef.current.has('todos')) {\n setInternalTools(prev => ({...prev, 'bottom-right': 'todos'}))\n }\n\n prevArtifactNodesRef.current = nodes\n prevTasksRef.current = tasks\n }, [artifactNodes, tasks, isPanelControlled])\n\n // ── Branch switching ──────────────────────────────────────────\n const handleBranchSwitch = useCallback(\n (nodeId: string, direction: 'prev' | 'next') => {\n if (!tree || !onTreeChange) {\n return\n }\n onTreeChange(switchBranch(tree, nodeId, direction))\n },\n [tree, onTreeChange]\n )\n\n const handleJumpHere = useCallback((nodeId: string) => {\n if (!tree) return\n if (onJumpHere) {\n onJumpHere(nodeId)\n return\n }\n if (onTreeChange) {\n onTreeChange(setActiveLeaf(tree, nodeId))\n }\n }, [tree, onTreeChange, onJumpHere])\n\n const handleJumpToLatest = useCallback(() => {\n if (!tree) return\n if (onJumpToLatest) {\n onJumpToLatest()\n return\n }\n if (onTreeChange && tree.lastLeafId) {\n onTreeChange(setActiveLeaf(tree, tree.lastLeafId))\n }\n }, [tree, onTreeChange, onJumpToLatest])\n\n // ── Build the heterogeneous row list for ChatView ─────────────\n const buildItem = useCallback(\n (node: TreeNode<ChatNode>, opts: { muted?: boolean }): ChatViewItem => {\n const branchInfo = tree && getSiblingInfo(tree, node.id).total > 1\n ? {\n ...getSiblingInfo(tree, node.id),\n onPrevious: () => handleBranchSwitch(node.id, 'prev'),\n onNext: () => handleBranchSwitch(node.id, 'next'),\n }\n : undefined\n\n if (node.kind === 'checkpoint') {\n return {\n kind: 'checkpoint',\n id: node.id,\n name: node.name,\n executionKind: node.executionKind,\n status: node.status,\n isActive: node.id === activeCheckpointId && !opts.muted,\n muted: opts.muted,\n branchInfo,\n onJumpHere: () => handleJumpHere(node.id),\n }\n }\n\n const actions = enableMessageActions\n ? {\n showCopy: true,\n onEdit: node.role === 'user' && onEditMessage\n ? (newContent: string) => onEditMessage(node.id, newContent)\n : undefined,\n onRetry: node.role === 'assistant' && onRetryMessage\n ? () => onRetryMessage(node.id)\n : undefined,\n }\n : undefined\n\n const isActiveLeaf = tree?.activeLeafId === node.id\n\n return {\n kind: 'message',\n id: node.id,\n variant: node.role,\n content: node.content,\n isStreaming: node.isStreaming,\n muted: opts.muted,\n branchInfo,\n actions,\n attachments: node.attachments\n ? node.attachments.map(a => ({\n id: a.id,\n file: {name: a.name, size: a.size ?? 0, type: a.type},\n previewUrl: a.previewUrl,\n artifactId: a.artifactId,\n status: a.status ?? 'analyzed',\n }))\n : undefined,\n onAttachmentOpen: handleAttachmentOpen,\n isActive: isActiveLeaf,\n onJumpHere: () => handleJumpHere(node.id),\n }\n },\n [tree, activeCheckpointId, enableMessageActions, onEditMessage, onRetryMessage,\n handleBranchSwitch, handleJumpHere, handleAttachmentOpen],\n )\n\n const displayItems: ChatViewItem[] = useMemo(() => {\n const items: ChatViewItem[] = activePath.map(n => buildItem(n, {muted: false}))\n if (greyedFuture.length > 0) {\n const messageCount = greyedFuture.filter(n => n.kind === 'message').length\n const checkpointCount = greyedFuture.filter(n => n.kind === 'checkpoint').length\n items.push({\n kind: 'divider',\n id: '__greyed_divider__',\n messageCount,\n checkpointCount,\n onJumpToLatest: handleJumpToLatest,\n })\n for (const n of greyedFuture) {\n items.push(buildItem(n, {muted: true}))\n }\n }\n return items\n }, [activePath, greyedFuture, buildItem, handleJumpToLatest])\n\n const latestUserMessageIndex = useMemo(() => {\n for (let i = displayItems.length - 1; i >= 0; i--) {\n const item = displayItems[i]\n if (item.kind === 'message' && item.variant === 'user' && !item.muted) {\n return i\n }\n }\n return -1\n }, [displayItems])\n\n const handleSubmit = useCallback(\n (message: string, attachments?: Attachment[]) => {\n onMessageSubmit?.(message, attachments)\n },\n [onMessageSubmit]\n )\n\n const isEmpty = displayItems.length === 0\n\n // ── Derived: which sides have tools ─────────────────────────\n const leftToolDefs = useMemo(\n () => allToolDefinitions.filter(t => t.group === 'top-left' || t.group === 'bottom-left'),\n [allToolDefinitions]\n )\n const rightToolDefs = useMemo(\n () => allToolDefinitions.filter(\n t => t.group === 'top-right' || t.group === 'bottom-right'),\n [allToolDefinitions]\n )\n const hasLeftTools = leftToolDefs.length > 0\n const hasRightTools = rightToolDefs.length > 0\n\n // ── Render tool content for a given slot ──────────────────────\n const renderToolContent = (toolId: string | null) => {\n if (!toolId) {\n return null\n }\n\n switch (toolId) {\n case 'history':\n return (\n <HistoryPanel\n conversations={conversations}\n onSelectConversation={onSelectConversation}\n onNewChat={onNewChat}\n onRenameConversation={onRenameConversation}\n />\n )\n\n case 'artifacts':\n return (\n <ArtifactsPanel\n nodes={artifactNodes}\n openArtifactId={panelOpenArtifactId}\n onArtifactClosed={handleArtifactPanelClosed}\n getArtifactActions={getArtifactActions}\n className=\"h-full\"\n />\n )\n\n case 'todos':\n return tasks.length > 0\n ? <TodosList tasks={tasks} title={tasksTitle} onStopAllTasks={onStopAllTasks}\n className=\"h-full\"/>\n : (\n <div className=\"h-full flex flex-col\">\n <div className=\"flex items-center p-4 border-b border-ash/40 shrink-0\">\n <h3 className=\"text-xs font-medium text-white\">Tasks</h3>\n </div>\n <div className=\"flex-1 flex items-center justify-center\">\n <p className=\"text-xs text-silver/60\">No tasks</p>\n </div>\n </div>\n )\n\n default: {\n // External tool — render its content\n const externalTool = externalTools.find(t => t.id === toolId)\n return externalTool?.content ?? null\n }\n }\n }\n\n return (\n <div\n className={cx('flex h-full w-full bg-obsidian overflow-hidden', className)}\n {...rest}\n >\n {/* Left tool sidebar */}\n {hasLeftTools && (\n <ToolSidebar\n tools={leftToolDefs}\n activeTools={activeTools}\n onToggleTool={toggleTool}\n side=\"left\"\n />\n )}\n\n {/* Left tool panel */}\n {isLeftPanelOpen && (\n <ToolPanelContainer\n topContent={renderToolContent(activeTools['top-left'])}\n bottomContent={renderToolContent(activeTools['bottom-left'])}\n width={leftToolsWidth}\n onResizeStart={startResizingLeftTools}\n side=\"left\"\n initialTopPercent={30}\n />\n )}\n\n {/* Main content area */}\n <div className=\"flex-1 flex flex-col min-w-0 relative\">\n <div className={cx(\n \"flex-1 flex flex-col min-h-0 relative\",\n isEmpty ? \"justify-center\" : \"justify-start\"\n )}>\n {/* Top spacer for centering in empty state */}\n <div className={cx(\n \"transition-all duration-500 ease-in-out\",\n isEmpty ? \"flex-1\" : \"flex-zero\"\n )}/>\n\n {/* Messages Area */}\n <div className={cx(\n \"transition-all duration-500 ease-in-out overflow-hidden flex flex-col\",\n isEmpty ? \"flex-zero opacity-0\" : \"flex-1 opacity-100\"\n )}>\n <ChatView\n items={displayItems}\n latestUserMessageIndex={latestUserMessageIndex}\n isThinking={isThinking}\n thinkingLabel={thinkingLabel}\n className=\"flex-1\"\n />\n </div>\n\n {/* Input Area */}\n <div className={cx(\n \"transition-all duration-500 ease-in-out z-10 w-full flex flex-col items-center\",\n isEmpty ? \"p-4\" : \"shrink-0 p-4 border-t border-ash/40 bg-obsidian\"\n )}>\n {isEmpty && (\n <div className=\"mb-8 text-center animate-fade-in duration-500\">\n {emptyState ? (\n emptyState\n ) : (\n <h1 className=\"text-4xl md:text-5xl font-heading text-gold mb-2 tracking-tight\">\n Welcome!\n </h1>\n )}\n </div>\n )}\n\n <ChatInput\n position={isEmpty ? \"centered\" : \"bottom\"}\n placeholder={placeholder}\n helperText={isEmpty ? emptyStateHelper : undefined}\n onSubmit={handleSubmit}\n disabled={isEmpty ? isStreaming : (isStreaming && !onStop)}\n isStreaming={isStreaming}\n onStop={onStop}\n showAttachmentButton={showAttachmentButton}\n attachments={propsAttachments}\n onAttachmentsChange={onAttachmentsChange}\n onAttachmentRemove={onAttachmentRemove}\n notice={inputNotice}\n onInputChange={onInputChange}\n initialInputValue={initialInputValue}\n autoFocus={autoFocus}\n textareaRef={textareaRef}\n onTextareaKeyDown={onTextareaKeyDown}\n />\n </div>\n\n {/* Bottom spacer for centering in empty state */}\n <div className={cx(\n \"transition-all duration-500 ease-in-out\",\n isEmpty ? \"flex-1\" : \"flex-zero\"\n )}/>\n </div>\n </div>\n\n {/* Right tool panel */}\n {isRightPanelOpen && (\n <ToolPanelContainer\n topContent={renderToolContent(activeTools['top-right'])}\n bottomContent={renderToolContent(activeTools['bottom-right'])}\n width={rightToolsWidth}\n onResizeStart={startResizingRightTools}\n side=\"right\"\n initialTopPercent={70}\n />\n )}\n\n {/* Right tool sidebar */}\n {hasRightTools && (\n <ToolSidebar\n tools={rightToolDefs}\n activeTools={activeTools}\n onToggleTool={toggleTool}\n side=\"right\"\n />\n )}\n </div>\n )\n }\n)\n\nChatInterface.displayName = 'ChatInterface'\n","import React, {useEffect} from 'react'\nimport {\n Message,\n type MessageActionsConfig,\n type MessageBranchInfo,\n type MessageProps,\n type MessageVariant,\n} from '../Message'\nimport {composeRefs, cx} from '../../utils'\nimport {useScrollAnchor} from './hooks/useScrollAnchor'\nimport {useAdaptiveSpacer} from './hooks/useAdaptiveSpacer'\nimport {ThinkingIndicator} from './ThinkingIndicator'\nimport {Checkpoint, type CheckpointBranchInfo, type CheckpointProps} from './Checkpoint'\nimport {GreyedDivider, type GreyedDividerProps} from './GreyedDivider'\n\n/**\n * One row in the chat stream. Discriminated by `kind` so ChatView can dispatch\n * to the right renderer without leaking shape into upstream types.\n */\nexport type ChatViewItem =\n | ChatViewMessageItem\n | ChatViewCheckpointItem\n | ChatViewDividerItem\n\nexport interface ChatViewMessageItem extends Omit<MessageProps, 'variant' | 'children'> {\n kind: 'message'\n id: string\n variant: MessageVariant\n /** Branch navigation info — chevrons render only when total > 1. */\n branchInfo?: MessageBranchInfo\n /** Actions configuration (copy / edit / retry). */\n actions?: MessageActionsConfig\n /** When true, this row is rendered in the greyed-future region. */\n muted?: boolean\n /**\n * When true, this message is the active leaf — Message will suppress its\n * `onJumpHere` click target. Mirrors `ChatViewCheckpointItem.isActive`.\n */\n isActive?: boolean\n /**\n * Click handler for the bubble. When provided, the bubble becomes a\n * navigational anchor that moves the active leaf to this node. Aurelius\n * suppresses the click for `isActive` rows, link / button targets inside\n * the bubble, and active text selections.\n */\n onJumpHere?: () => void\n}\n\nexport interface ChatViewCheckpointItem extends CheckpointProps {\n kind: 'checkpoint'\n id: string\n}\n\nexport interface ChatViewDividerItem extends GreyedDividerProps {\n kind: 'divider'\n id: string\n}\n\nexport interface ChatViewProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Rows to render in the chat stream. Heterogeneous: messages, checkpoints,\n * and the greyed-future divider live in the same list, ordered top-to-bottom.\n */\n items: ChatViewItem[]\n /**\n * Index of the latest user-message row to anchor scroll to. When this index\n * changes, the corresponding row scrolls to the top. Defaults to the\n * last-found user message in `items`.\n */\n latestUserMessageIndex?: number\n /**\n * Whether to show the thinking indicator (between user message and response).\n * Renders only when the latest message is a user turn — i.e. the assistant\n * hasn't sent its first chunk yet. Streaming-cursor behavior is owned by\n * the per-node {@code isStreaming} flag on each message item.\n */\n isThinking?: boolean\n /**\n * When set, the thinking indicator renders this label verbatim instead of\n * its rotating phrases. Use for domain-specific waits like\n * \"Analyzing uploads...\" (any animated suffix is the caller's responsibility).\n */\n thinkingLabel?: string\n /**\n * Callback when the user scrolls manually.\n */\n onScroll?: (e: React.UIEvent<HTMLDivElement>) => void\n}\n\n/**\n * Renders a heterogeneous chat stream — messages, checkpoints, and the\n * greyed-future divider — with smart scrolling behavior.\n *\n * Key behaviors:\n * - When a user message arrives, it anchors to the top of the viewport\n * - Does NOT auto-scroll during streaming (respects user's reading position)\n * - Each row's renderer is dispatched from its `kind` discriminator\n */\nexport const ChatView = React.forwardRef<HTMLDivElement, ChatViewProps>(\n function ChatView(\n {\n items,\n latestUserMessageIndex,\n isThinking,\n thinkingLabel,\n onScroll,\n className,\n ...rest\n },\n ref,\n ) {\n const {containerRef, anchorRef, scrollToAnchor} = useScrollAnchor({\n behavior: 'smooth',\n block: 'start',\n })\n\n const {contentRef, spacerRef, spacerHeight} = useAdaptiveSpacer({\n containerRef,\n anchorRef,\n })\n\n const latestUserIdx =\n latestUserMessageIndex ??\n items.reduceRight((found, item, idx) => {\n if (found === -1 && item.kind === 'message' && item.variant === 'user') {\n return idx\n }\n return found\n }, -1)\n\n useEffect(() => {\n if (latestUserMessageIndex !== undefined && latestUserMessageIndex >= 0) {\n scrollToAnchor()\n }\n }, [latestUserMessageIndex, scrollToAnchor])\n\n const lastMessage = items.reduceRight<ChatViewItem | null>((found, item) => {\n return found ?? (item.kind === 'message' ? item : null)\n }, null)\n const showThinking = isThinking\n && lastMessage?.kind === 'message'\n && lastMessage.variant === 'user'\n\n return (\n <div\n ref={composeRefs(containerRef, ref)}\n onScroll={onScroll}\n className={cx(\n 'flex flex-col w-full h-full overflow-y-auto scroll-smooth',\n 'px-4 py-6 overscroll-contain',\n className,\n )}\n {...rest}\n >\n <div ref={contentRef} className=\"relative flex flex-col gap-3\">\n {items.map((item, index) => {\n const isAnchor = index === latestUserIdx\n const wrapperRef = isAnchor ? anchorRef : undefined\n const wrapperClass = isAnchor ? 'scroll-mt-4' : undefined\n\n if (item.kind === 'divider') {\n const {kind: _k, id, ...dividerProps} = item\n return (\n <div key={id}>\n <GreyedDivider {...dividerProps}/>\n </div>\n )\n }\n\n if (item.kind === 'checkpoint') {\n const {kind: _k, id, ...checkpointProps} = item\n return (\n <div key={id} ref={wrapperRef} className={wrapperClass}>\n <Checkpoint {...checkpointProps}/>\n </div>\n )\n }\n\n const {\n kind: _k,\n id,\n variant,\n muted,\n className: messageClassName,\n branchInfo,\n actions,\n isStreaming: nodeIsStreaming,\n ...messageProps\n } = item\n const isMessageStreaming = !!nodeIsStreaming\n\n return (\n <div\n key={id}\n ref={wrapperRef}\n className={cx(wrapperClass, muted && 'opacity-60')}\n >\n <Message\n variant={variant}\n isStreaming={isMessageStreaming}\n className={messageClassName}\n branchInfo={branchInfo}\n actions={actions}\n hideActions={isMessageStreaming}\n {...messageProps}\n />\n </div>\n )\n })}\n\n {showThinking && <ThinkingIndicator isVisible manualLabel={thinkingLabel}/>}\n </div>\n\n <div\n ref={spacerRef}\n className=\"shrink-0 pointer-events-none\"\n style={{height: spacerHeight}}\n aria-hidden=\"true\"\n />\n </div>\n )\n },\n)\n\nChatView.displayName = 'ChatView'\n\n// Re-export sub-row types for convenience\nexport type {CheckpointBranchInfo}\n\nexport default ChatView\n","import {useCallback, useRef} from 'react'\n\nexport interface UseScrollAnchorOptions {\n /**\n * Behavior for scrolling. Defaults to 'smooth'.\n */\n behavior?: ScrollBehavior\n /**\n * Block alignment for scrollIntoView. Defaults to 'start'.\n */\n block?: ScrollLogicalPosition\n}\n\nexport interface UseScrollAnchorReturn {\n /**\n * Ref to attach to the scrollable container\n */\n containerRef: React.RefObject<HTMLDivElement | null>\n /**\n * Ref to attach to the anchor element (latest user message)\n */\n anchorRef: React.RefObject<HTMLDivElement | null>\n /**\n * Scroll the anchor element into view. Call this on user message submission.\n */\n scrollToAnchor: () => void\n /**\n * Scroll to the bottom of the container.\n */\n scrollToBottom: () => void\n /**\n * Check if user has scrolled away from the bottom.\n */\n isScrolledToBottom: () => boolean\n}\n\n/**\n * Hook for smart scroll behavior in chat interfaces.\n *\n * Key behaviors:\n * - Anchors user messages to the top of the viewport when they send a message\n * - Does NOT auto-scroll during streaming to respect user's reading position\n * - Allows manual scroll detection\n */\nexport function useScrollAnchor(\n options: UseScrollAnchorOptions = {}\n): UseScrollAnchorReturn {\n const {behavior = 'smooth', block = 'start'} = options\n\n const containerRef = useRef<HTMLDivElement>(null)\n const anchorRef = useRef<HTMLDivElement>(null)\n\n const scrollToAnchor = useCallback(() => {\n const el = anchorRef.current\n if (!el) {\n return\n }\n\n // Double rAF to ensure layout updates (e.g., adaptive spacer) have been applied.\n // First frame: other rAF callbacks (like spacer recalculation) run\n // Second frame: scroll happens with correct layout\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n el.scrollIntoView({behavior, block})\n })\n })\n }, [behavior, block])\n\n const scrollToBottom = useCallback(() => {\n const container = containerRef.current\n if (!container) {\n return\n }\n\n if (typeof container.scrollTo === 'function') {\n container.scrollTo({top: container.scrollHeight, behavior})\n } else {\n container.scrollTop = container.scrollHeight\n }\n }, [behavior])\n\n const isScrolledToBottom = useCallback(() => {\n const container = containerRef.current\n if (!container) {\n return true\n }\n\n const threshold = 50 // pixels from bottom to consider \"at bottom\"\n const {scrollTop, scrollHeight, clientHeight} = container\n return scrollHeight - scrollTop - clientHeight < threshold\n }, [])\n\n return {\n containerRef,\n anchorRef,\n scrollToAnchor,\n scrollToBottom,\n isScrolledToBottom,\n }\n}\n\nexport default useScrollAnchor\n","import {useCallback, useEffect, useRef, useState} from 'react'\n\nexport interface UseAdaptiveSpacerOptions {\n /**\n * Minimum spacer height. Defaults to 0.\n */\n minHeight?: number\n /**\n * External container ref to use instead of creating one internally.\n * Useful when sharing the container ref with other hooks (e.g., useScrollAnchor).\n */\n containerRef?: React.RefObject<HTMLDivElement | null>\n /**\n * Ref to the anchor element (e.g., latest user message).\n * When provided, spacer is calculated to allow anchor to scroll to top.\n */\n anchorRef?: React.RefObject<HTMLDivElement | null>\n}\n\nexport interface UseAdaptiveSpacerReturn {\n /**\n * Ref to attach to the scrollable container (only use if not providing external ref)\n */\n containerRef: React.RefObject<HTMLDivElement | null>\n /**\n * Ref to attach to the content wrapper (excludes spacer)\n */\n contentRef: React.RefObject<HTMLDivElement | null>\n /**\n * Ref to attach to the spacer element for imperative height updates\n */\n spacerRef: React.RefObject<HTMLDivElement | null>\n /**\n * Calculated spacer height in pixels\n */\n spacerHeight: number\n /**\n * Force recalculation of spacer height\n */\n recalculate: () => void\n}\n\n/**\n * Hook that calculates the exact spacer height needed to fill remaining viewport space\n * while allowing the anchor element to scroll to the top.\n *\n * The spacer height is calculated as:\n * spacerHeight = containerHeight - padding - heightFromAnchorToBottom\n *\n * This ensures:\n * - The anchor message can scroll to the top of the viewport\n * - Below the anchor, content + spacer fills exactly the remaining space\n * - As content below anchor grows, spacer shrinks\n * - When content exceeds available space, spacer becomes 0\n */\nexport function useAdaptiveSpacer(\n options: UseAdaptiveSpacerOptions = {}\n): UseAdaptiveSpacerReturn {\n const {minHeight = 0, containerRef: externalContainerRef, anchorRef} = options\n\n const internalContainerRef = useRef<HTMLDivElement>(null)\n const containerRef = externalContainerRef ?? internalContainerRef\n const contentRef = useRef<HTMLDivElement>(null)\n const spacerRef = useRef<HTMLDivElement>(null)\n const [spacerHeight, setSpacerHeight] = useState(0)\n\n const recalculate = useCallback(() => {\n const container = containerRef.current\n const content = contentRef.current\n if (!container || !content) {\n return\n }\n\n // Get container's computed padding\n const style = getComputedStyle(container)\n const paddingTop = parseFloat(style.paddingTop) || 0\n const paddingBottom = parseFloat(style.paddingBottom) || 0\n const availableHeight = container.clientHeight - paddingTop - paddingBottom\n\n // Calculate height from anchor to bottom of content\n // Using offsetTop for stable measurement from \"zero\" (content top)\n let heightFromAnchorToBottom: number\n const anchor = anchorRef?.current\n\n if (anchor && content.contains(anchor)) {\n // Anchor's position from the top of content (the \"zero\" point)\n // Content wrapper has position:relative, so offsetTop is relative to it\n const anchorTop = anchor.offsetTop\n heightFromAnchorToBottom = content.scrollHeight - anchorTop\n } else {\n // No anchor, use total content height\n heightFromAnchorToBottom = content.scrollHeight\n }\n\n const newSpacerHeight = Math.max(minHeight, availableHeight - heightFromAnchorToBottom)\n\n // Update DOM imperatively for immediate effect (before React commits state)\n // This ensures scrollToAnchor sees the correct spacer height\n if (spacerRef.current) {\n spacerRef.current.style.height = `${newSpacerHeight}px`\n }\n\n // Also update state for React reconciliation\n setSpacerHeight(newSpacerHeight)\n }, [minHeight, anchorRef])\n\n useEffect(() => {\n const container = containerRef.current\n const content = contentRef.current\n if (!container || !content) {\n return\n }\n\n // Initial calculation\n recalculate()\n\n // Observe both container and content for size changes\n const resizeObserver = new ResizeObserver(() => {\n recalculate()\n })\n\n resizeObserver.observe(container)\n resizeObserver.observe(content)\n\n // Also observe mutations in content (for DOM changes that don't trigger resize)\n const mutationObserver = new MutationObserver(() => {\n // Use requestAnimationFrame to batch with render\n requestAnimationFrame(recalculate)\n })\n\n mutationObserver.observe(content, {\n childList: true,\n subtree: true,\n characterData: true,\n })\n\n return () => {\n resizeObserver.disconnect()\n mutationObserver.disconnect()\n }\n }, [recalculate])\n\n return {\n containerRef,\n contentRef,\n spacerRef,\n spacerHeight,\n recalculate,\n }\n}\n\nexport default useAdaptiveSpacer\n","import React, {useEffect, useState} from 'react'\nimport {cx} from '../../utils'\n\nconst THINKING_PHRASES = [\n 'Consulting the ancient tomes...',\n 'Parsing the ineffable...',\n 'Traversing the manifold of possibilities...',\n 'Genuflecting before the oracle...',\n 'Distilling quintessence...',\n 'Communing with the machine spirits...',\n 'Unfolding higher dimensions...',\n 'Perturbing the probability matrix...',\n 'Invoking the categorical imperative...',\n 'Reticulating splines...',\n 'Brewing a fresh batch of tokens...',\n 'Consulting my inner monologue...',\n 'Summoning the muse...',\n]\n\nexport interface ThinkingIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Whether the indicator is visible/active\n */\n isVisible?: boolean\n /**\n * Interval between phrase changes in ms\n * @default 2500\n */\n phraseInterval?: number\n /**\n * Custom phrases to cycle through (defaults to built-in phrases)\n */\n phrases?: string[]\n /**\n * When set, suppresses internal phrase rotation and renders this label\n * verbatim. Used by the host to express domain-specific waiting states\n * (e.g. \"Analyzing uploads...\"). Any animated suffix (cycling dots) is the\n * caller's responsibility — Aurelius renders the string as-is.\n */\n manualLabel?: string\n}\n\n/**\n * ThinkingIndicator shows an animated state when the assistant is processing a request\n * but has not yet started streaming tokens. It cycles through flavorful \"thinking\" phrases.\n */\nexport const ThinkingIndicator = React.forwardRef<HTMLDivElement, ThinkingIndicatorProps>(\n (\n {\n isVisible = true,\n phraseInterval = 2500,\n phrases = THINKING_PHRASES,\n manualLabel,\n className,\n ...rest\n },\n ref\n ) => {\n // Start at a random phrase each time\n const [currentIndex, setCurrentIndex] = useState(\n () => Math.floor(Math.random() * phrases.length))\n const [isTransitioning, setIsTransitioning] = useState(false)\n\n const isManual = manualLabel !== undefined\n\n useEffect(() => {\n if (!isVisible || isManual || phrases.length <= 1) {\n return\n }\n\n let fadeTimeout: ReturnType<typeof setTimeout> | null = null\n const interval = setInterval(() => {\n setIsTransitioning(true)\n // Wait for fade out, then change phrase\n fadeTimeout = setTimeout(() => {\n setCurrentIndex((prev) => (prev + 1) % phrases.length)\n setIsTransitioning(false)\n fadeTimeout = null\n }, 200)\n }, phraseInterval)\n\n return () => {\n clearInterval(interval)\n if (fadeTimeout !== null) {\n clearTimeout(fadeTimeout)\n }\n }\n }, [isVisible, isManual, phrases.length, phraseInterval])\n\n if (!isVisible) {\n return null\n }\n\n return (\n <div\n ref={ref}\n className={cx(\n 'flex items-center gap-2 px-3 py-2 w-fit',\n 'bg-charcoal border border-ash text-silver',\n 'mr-auto',\n className\n )}\n role=\"status\"\n aria-live=\"polite\"\n {...rest}\n >\n {/* Animated dots */}\n <div className=\"flex gap-1\" aria-hidden=\"true\">\n <span className=\"w-1.5 h-1.5 bg-gold/60 rounded-full animate-pulse\"\n style={{animationDelay: '0ms'}}/>\n <span className=\"w-1.5 h-1.5 bg-gold/60 rounded-full animate-pulse\"\n style={{animationDelay: '150ms'}}/>\n <span className=\"w-1.5 h-1.5 bg-gold/60 rounded-full animate-pulse\"\n style={{animationDelay: '300ms'}}/>\n </div>\n\n {/* Phrase: manual label rendered verbatim, otherwise rotating phrases. */}\n {isManual ? (\n <span className=\"text-sm italic\">{manualLabel}</span>\n ) : (\n <span\n className={cx(\n 'text-sm italic transition-opacity duration-200',\n isTransitioning ? 'opacity-0' : 'opacity-100'\n )}\n >\n {phrases[currentIndex]}\n </span>\n )}\n </div>\n )\n }\n)\n\nThinkingIndicator.displayName = 'ThinkingIndicator'\n\nexport default ThinkingIndicator\n","import React from 'react'\nimport {\n ArrowLeft,\n ChevronLeft,\n ChevronRight,\n GitBranch,\n GitCommitVertical,\n GitMerge,\n PencilLine,\n Upload,\n} from 'lucide-react'\nimport {cx} from '../../utils'\n\n/**\n * What kind of project mutation produced this checkpoint. Drives the icon and\n * visual emphasis. The label and underlying state are unchanged.\n */\nexport type CheckpointExecutionKind = 'task' | 'submit' | 'rename' | 'init' | 'ingest'\n\n/**\n * Terminal state of the underlying execution. `failed` and `cancelled` render\n * with status text and muted accents but stay clickable so the user can still\n * inspect the partial state.\n */\nexport type CheckpointStatus = 'completed' | 'failed' | 'cancelled'\n\nexport interface CheckpointBranchInfo {\n /** 1-based index of this checkpoint among its siblings. */\n current: number\n /** Total sibling count at this fork point. */\n total: number\n onPrevious?: () => void\n onNext?: () => void\n}\n\nexport interface CheckpointProps {\n /** Human-readable label, ≤ 50 chars. Comes from the underlying execution name. */\n name: string\n /** What produced the checkpoint — drives the leading icon. */\n executionKind: CheckpointExecutionKind\n /**\n * Terminal status of the execution.\n * @default 'completed'\n */\n status?: CheckpointStatus\n /**\n * When true, this checkpoint is the active leaf — the artifacts panel is\n * already showing this state. Renders without underline or jump affordance.\n */\n isActive?: boolean\n /**\n * When true, this checkpoint sits in the greyed-future region (the timeline\n * the user rewound away from). Lower opacity; still clickable to jump back.\n */\n muted?: boolean\n /**\n * Sibling info for the BranchNavigator chevrons. Chevrons render only when\n * `total > 1`.\n */\n branchInfo?: CheckpointBranchInfo\n /**\n * Click handler for the row. Called when the user wants to jump to this\n * checkpoint (rewind the artifacts panel and active leaf to here).\n */\n onJumpHere?: () => void\n}\n\nconst KIND_ICONS: Record<CheckpointExecutionKind, React.ComponentType<{ className?: string }>> = {\n task: GitBranch,\n submit: GitMerge,\n rename: PencilLine,\n init: GitCommitVertical,\n ingest: Upload,\n}\n\nconst KIND_ARIA_LABELS: Record<CheckpointExecutionKind, string> = {\n task: 'Task checkpoint',\n submit: 'Submit checkpoint',\n rename: 'Rename checkpoint',\n init: 'Project head checkpoint',\n ingest: 'Upload batch checkpoint',\n}\n\n/**\n * A single-line marker in the chat stream that anchors a chat position to a\n * project state. Clicking the underlined name rewinds the artifacts panel and\n * the active leaf to this checkpoint without forking. Chevrons switch between\n * sibling forks (e.g. parallel task attempts, alternative submits).\n *\n * Visual variants:\n * - active: gold accent, no underline (the user is already here)\n * - muted: greyed-future row, lower opacity, still clickable\n * - failed/cancelled: status suffix in muted error/silver, still clickable\n */\nexport const Checkpoint = React.forwardRef<HTMLDivElement, CheckpointProps>(\n function Checkpoint(\n {name, executionKind, status = 'completed', isActive, muted, branchInfo, onJumpHere},\n ref,\n ) {\n const KindIcon = KIND_ICONS[executionKind]\n const isFailed = status === 'failed'\n const isCancelled = status === 'cancelled'\n const isInteractive = !isActive && !!onJumpHere\n\n const iconColor = isActive\n ? 'text-gold'\n : isFailed\n ? 'text-error-muted'\n : 'text-silver/50'\n\n const nameClasses = cx(\n 'transition-colors text-xs',\n isActive\n ? 'text-silver font-medium'\n : isInteractive\n ? 'text-silver/70 hover:text-white underline decoration-silver/30 underline-offset-4 decoration-dotted hover:decoration-silver/70'\n : 'text-silver/50',\n )\n\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-label={KIND_ARIA_LABELS[executionKind]}\n className={cx(\n 'group/checkpoint flex items-center gap-2 py-1.5 select-none',\n muted && 'opacity-60',\n )}\n >\n <KindIcon className={cx('w-3.5 h-3.5 shrink-0', iconColor)} aria-hidden=\"true\"/>\n\n <button\n type=\"button\"\n onClick={isInteractive ? onJumpHere : undefined}\n disabled={!isInteractive}\n className={cx(nameClasses, 'truncate text-left',\n !isInteractive && 'cursor-default')}\n aria-label={isInteractive ? `Jump to checkpoint ${name}` : name}\n >\n <span className=\"truncate\">{name}</span>\n {isFailed && (\n <span className=\"ml-1.5 text-error-muted\">· failed</span>\n )}\n {isCancelled && (\n <span className=\"ml-1.5 text-silver/40\">· cancelled</span>\n )}\n </button>\n\n {isInteractive && (\n <span\n className={cx(\n 'ml-1 inline-flex items-center gap-1 text-xs text-silver/40',\n 'opacity-0 group-hover/checkpoint:opacity-100 transition-opacity',\n 'pointer-events-none',\n )}\n aria-hidden=\"true\"\n >\n <ArrowLeft className=\"w-3 h-3\"/>\n Jump here\n </span>\n )}\n\n {branchInfo && branchInfo.total > 1 && (\n <div\n className=\"ml-auto inline-flex items-center gap-0.5 text-silver/70 text-xs\"\n role=\"navigation\"\n aria-label=\"Switch sibling checkpoint\"\n >\n <button\n type=\"button\"\n onClick={branchInfo.onPrevious}\n disabled={branchInfo.current <= 1}\n className={cx(\n 'p-0.5 hover:text-white hover:bg-white/10 transition-colors',\n 'disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-silver/70',\n )}\n aria-label=\"Previous sibling checkpoint\"\n >\n <ChevronLeft className=\"w-3 h-3\"/>\n </button>\n <span className=\"tabular-nums min-w-6 text-center\">\n {branchInfo.current}/{branchInfo.total}\n </span>\n <button\n type=\"button\"\n onClick={branchInfo.onNext}\n disabled={branchInfo.current >= branchInfo.total}\n className={cx(\n 'p-0.5 hover:text-white hover:bg-white/10 transition-colors',\n 'disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-silver/70',\n )}\n aria-label=\"Next sibling checkpoint\"\n >\n <ChevronRight className=\"w-3 h-3\"/>\n </button>\n </div>\n )}\n </div>\n )\n },\n)\n\nCheckpoint.displayName = 'Checkpoint'\n\nexport default Checkpoint\n","import React from 'react'\nimport {ArrowDown} from 'lucide-react'\nimport {cx} from '../../utils'\n\nexport interface GreyedDividerProps {\n /** Number of message rows in the greyed-future region. */\n messageCount: number\n /** Number of checkpoint rows in the greyed-future region. */\n checkpointCount: number\n /** Click handler that jumps the active leaf to the deepest greyed leaf. */\n onJumpToLatest?: () => void\n}\n\nfunction pluralize(n: number, singular: string, plural: string): string {\n return `${n} ${n === 1 ? singular : plural}`\n}\n\nfunction summarize(messageCount: number, checkpointCount: number): string {\n const parts: string[] = []\n if (messageCount > 0) {\n parts.push(pluralize(messageCount, 'message', 'messages'))\n }\n if (checkpointCount > 0) {\n parts.push(pluralize(checkpointCount, 'checkpoint', 'checkpoints'))\n }\n return parts.length > 0 ? parts.join(', ') : 'no items'\n}\n\n/**\n * A full-width divider that announces the start of the greyed-future region —\n * the timeline beyond the user's current rewound position. Clicking\n * \"Jump to latest\" returns to the deepest leaf the user previously reached.\n *\n * Visual: hairline rule with a centered summary chip and a right-aligned\n * jump-to-latest action. Renders nothing when both counts are zero.\n */\nexport const GreyedDivider = React.forwardRef<HTMLDivElement, GreyedDividerProps>(\n function GreyedDivider({messageCount, checkpointCount, onJumpToLatest}, ref) {\n if (messageCount === 0 && checkpointCount === 0) {\n return null\n }\n\n return (\n <div\n ref={ref}\n role=\"separator\"\n aria-label=\"Start of rewound timeline\"\n className=\"flex items-center gap-3 py-2 text-xs text-silver/50 select-none\"\n >\n <div className=\"flex-1 h-px bg-ash/40\" aria-hidden=\"true\"/>\n\n <span className=\"inline-flex items-center gap-1.5 whitespace-nowrap\">\n <ArrowDown className=\"w-3 h-3\" aria-hidden=\"true\"/>\n Later in this conversation · {summarize(messageCount, checkpointCount)}\n </span>\n\n <div className=\"flex-1 h-px bg-ash/40\" aria-hidden=\"true\"/>\n\n {onJumpToLatest && (\n <button\n type=\"button\"\n onClick={onJumpToLatest}\n className={cx(\n 'shrink-0 transition-colors',\n 'text-silver/60 hover:text-white',\n 'underline decoration-silver/30 underline-offset-4 decoration-dotted hover:decoration-silver/70',\n )}\n >\n Jump to latest →\n </button>\n )}\n </div>\n )\n },\n)\n\nGreyedDivider.displayName = 'GreyedDivider'\n\nexport default GreyedDivider\n","import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'\nimport {composeRefs, cx} from '../../utils'\nimport {Paperclip, Send, Square, X} from 'lucide-react'\nimport {type AttachmentItem, AttachmentPreview} from '../AttachmentPreview'\nimport {Attachment, createPreviewUrl, generateId, isImageFile} from './types'\n\nexport interface ChatInputNotice {\n /**\n * Visual severity: 'warning' shows a dismissible amber notice, 'error' shows a persistent red\n * notice\n */\n variant: 'warning' | 'error'\n /**\n * Content to render — plain text or any React node (e.g. text + button for error state)\n */\n content: React.ReactNode\n /**\n * Whether to show a dismiss (×) button. Defaults to true for warning, ignored for error.\n */\n dismissible?: boolean\n /**\n * Called when the dismiss button is clicked. Consumer controls whether the notice disappears.\n */\n onDismiss?: () => void\n}\n\nexport type ChatInputPosition = 'centered' | 'bottom'\n\nexport interface ChatInputProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSubmit'> {\n /**\n * Position of the input: 'centered' for empty state, 'bottom' for conversation mode\n */\n position?: ChatInputPosition\n /**\n * Placeholder text for the input\n */\n placeholder?: string\n /**\n * Helper text shown above the input in centered mode\n */\n helperText?: React.ReactNode\n /**\n * Called when the user submits a message\n */\n onSubmit?: (message: string, attachments?: Attachment[]) => void\n /**\n * Whether the input is disabled (e.g., during streaming)\n */\n disabled?: boolean\n /**\n * Whether to animate the transition between positions\n */\n animate?: boolean\n /**\n * Whether the assistant is currently streaming (shows Stop button)\n */\n isStreaming?: boolean\n /**\n * Called when the Stop button is clicked during streaming\n */\n onStop?: () => void\n /**\n * Current attachments (controlled mode)\n */\n attachments?: Attachment[]\n /**\n * Called when attachments change (controlled mode)\n */\n onAttachmentsChange?: (attachments: Attachment[]) => void\n /**\n * Called when an attachment is removed by the user (clicking the \"x\")\n */\n onAttachmentRemove?: (attachment: Attachment) => void\n /**\n * Whether to show the attachment button\n */\n showAttachmentButton?: boolean\n /**\n * Accepted file types for attachments\n */\n acceptedFileTypes?: string\n /**\n * Optional notice displayed above the input (e.g. credit warnings or exhaustion messages)\n */\n notice?: ChatInputNotice\n /**\n * Called whenever the input value changes, giving the consumer access to the current text\n */\n onInputChange?: (value: string) => void\n /**\n * Initial value for the input, used for state restoration (e.g. from DB or localStorage)\n */\n initialInputValue?: string\n /**\n * Whether to automatically focus the input when it becomes enabled\n */\n autoFocus?: boolean\n /**\n * Optional ref forwarded to the underlying `<textarea>`. Use this to drive an inline\n * autocomplete (e.g. an `@`-mention picker) — read selection/caret position, mirror the\n * textarea for caret coordinates, or imperatively update its value.\n */\n textareaRef?: React.Ref<HTMLTextAreaElement>\n /**\n * Optional keydown hook that runs before the input's own handling. Call\n * `e.preventDefault()` to stop ChatInput from acting on the event — for example, to keep\n * Enter from submitting while an autocomplete is consuming it. The submit-on-Enter and\n * default newline behaviours both check `defaultPrevented` and skip when set.\n */\n onTextareaKeyDown?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void\n}\n\n/**\n * ChatInput is a context-aware input component that can transition between\n * a centered position (for empty states) and a bottom position (for active conversations).\n *\n * Features:\n * - Auto-expanding textarea\n * - File attachments with preview\n * - Drag and drop support\n * - Streaming state with stop button\n * - Animated transition between positions\n */\nexport const ChatInput = React.forwardRef<HTMLDivElement, ChatInputProps>(\n (\n {\n position = 'bottom',\n placeholder = 'Send a message...',\n helperText,\n onSubmit,\n disabled = false,\n animate = true,\n isStreaming = false,\n onStop,\n attachments: controlledAttachments,\n onAttachmentsChange,\n onAttachmentRemove,\n showAttachmentButton = true,\n acceptedFileTypes,\n notice,\n onInputChange,\n initialInputValue = '',\n autoFocus = false,\n textareaRef: externalTextareaRef,\n onTextareaKeyDown,\n className,\n ...rest\n },\n ref\n ) => {\n const [value, setValue] = useState(initialInputValue)\n const [localAttachments, setLocalAttachments] = useState<Attachment[]>([])\n const [isDragOver, setIsDragOver] = useState(false)\n const textareaRef = useRef<HTMLTextAreaElement>(null)\n const fileInputRef = useRef<HTMLInputElement>(null)\n\n const mergedTextareaRef = useMemo(\n () => composeRefs<HTMLTextAreaElement>(textareaRef, externalTextareaRef),\n [externalTextareaRef]\n )\n\n // Determine if using controlled or uncontrolled attachments\n const attachments = controlledAttachments ?? localAttachments\n const setAttachments = useCallback(\n (newAttachments: Attachment[] | ((prev: Attachment[]) => Attachment[])) => {\n if (onAttachmentsChange) {\n if (typeof newAttachments === 'function') {\n onAttachmentsChange(newAttachments(attachments))\n } else {\n onAttachmentsChange(newAttachments)\n }\n } else {\n setLocalAttachments(newAttachments)\n }\n },\n [attachments, onAttachmentsChange]\n )\n\n const handleSubmit = useCallback(() => {\n const trimmed = value.trim()\n if (!trimmed || disabled || isStreaming) {\n return\n }\n\n onSubmit?.(trimmed, attachments.length > 0 ? attachments : undefined)\n setValue('')\n setAttachments([])\n\n // Reset textarea height\n if (textareaRef.current) {\n textareaRef.current.style.height = 'auto'\n }\n }, [value, disabled, isStreaming, onSubmit, attachments, setAttachments])\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n // Consumer first — lets an attached autocomplete claim Arrow/Enter/Escape\n // before submit-on-Enter fires. A consumer that calls preventDefault opts\n // out of all default key behaviour for that event.\n onTextareaKeyDown?.(e)\n if (e.defaultPrevented) {\n return\n }\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault()\n handleSubmit()\n }\n },\n [handleSubmit, onTextareaKeyDown]\n )\n\n const handleChange = useCallback((e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setValue(e.target.value)\n onInputChange?.(e.target.value)\n\n // Auto-resize textarea\n const textarea = e.target\n textarea.style.height = 'auto'\n textarea.style.height = `${Math.min(textarea.scrollHeight, 200)}px`\n }, [onInputChange])\n\n // Focus input when it becomes enabled\n useEffect(() => {\n if (autoFocus && !disabled && !isStreaming && textareaRef.current) {\n textareaRef.current.focus()\n }\n }, [disabled, isStreaming, autoFocus])\n\n // File handling\n const addFiles = useCallback(\n (files: FileList | File[]) => {\n const newAttachments: Attachment[] = Array.from(files).map((file) => ({\n id: generateId(),\n file,\n previewUrl: isImageFile(file) ? createPreviewUrl(file) : undefined,\n status: 'pending' as const,\n }))\n setAttachments((prev) => [...prev, ...newAttachments])\n },\n [setAttachments]\n )\n\n const handleFileSelect = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const files = e.target.files\n if (files && files.length > 0) {\n addFiles(files)\n }\n // Reset input so the same file can be selected again\n e.target.value = ''\n },\n [addFiles]\n )\n\n const handleRemoveAttachment = useCallback(\n (id: string) => {\n const attachment = attachments.find((a) => a.id === id)\n if (attachment && onAttachmentRemove) {\n onAttachmentRemove(attachment)\n }\n\n setAttachments((prev) => {\n const attachmentToRemove = prev.find((a) => a.id === id)\n if (attachmentToRemove?.previewUrl) {\n URL.revokeObjectURL(attachmentToRemove.previewUrl)\n }\n return prev.filter((a) => a.id !== id)\n })\n },\n [attachments, onAttachmentRemove, setAttachments]\n )\n\n // Drag and drop handlers\n const handleDragEnter = useCallback((e: React.DragEvent) => {\n e.preventDefault()\n e.stopPropagation()\n setIsDragOver(true)\n }, [])\n\n const handleDragLeave = useCallback((e: React.DragEvent) => {\n e.preventDefault()\n e.stopPropagation()\n // Only set to false if we're leaving the container entirely\n if (!e.currentTarget.contains(e.relatedTarget as Node)) {\n setIsDragOver(false)\n }\n }, [])\n\n const handleDragOver = useCallback((e: React.DragEvent) => {\n e.preventDefault()\n e.stopPropagation()\n }, [])\n\n const handleDrop = useCallback(\n (e: React.DragEvent) => {\n e.preventDefault()\n e.stopPropagation()\n setIsDragOver(false)\n\n const files = e.dataTransfer.files\n if (files && files.length > 0) {\n addFiles(files)\n }\n },\n [addFiles]\n )\n\n const isCentered = position === 'centered'\n const hasAttachments = attachments.length > 0\n // Send is gated while bytes are still moving or have not landed at all.\n // `uploaded` and beyond are sendable; integrate handles analysis fallbacks.\n const isUploadIncomplete = attachments.some(a =>\n a.status === 'pending' || a.status === 'uploading' || a.status === 'upload_failed')\n const canSubmit = value.trim() && !disabled && !isStreaming && !isUploadIncomplete\n\n return (\n <div\n ref={ref}\n className={cx(\n 'w-full',\n isCentered && 'flex flex-col items-center justify-center',\n animate && 'transition-all duration-300 ease-out',\n className\n )}\n {...rest}\n >\n {/* Helper text for centered mode */}\n {isCentered && helperText && (\n <p className=\"text-silver text-sm mb-4 text-center\">{helperText}</p>\n )}\n\n {/* Notice bar */}\n {notice && (\n <div className={cx(\n 'w-full flex items-start gap-2 px-3 py-2 mb-1 text-xs',\n isCentered && 'max-w-lg',\n notice.variant === 'warning'\n ? 'bg-gold/5 border border-gold/20 text-gold/80'\n : 'bg-error/10 border border-error/30 text-error'\n )}>\n <span className=\"flex-1\">{notice.content}</span>\n {(notice.dismissible ?? notice.variant === 'warning') && notice.onDismiss && (\n <button\n type=\"button\"\n onClick={notice.onDismiss}\n aria-label=\"Dismiss\"\n className={cx(\n 'shrink-0 opacity-60 hover:opacity-100 transition-opacity',\n notice.variant === 'warning' ? 'text-gold' : 'text-error'\n )}\n >\n <X className=\"w-3 h-3\"/>\n </button>\n )}\n </div>\n )}\n\n {/* Input container */}\n <div\n className={cx(\n 'relative w-full bg-charcoal border',\n isDragOver ? 'border-gold ring-1 ring-gold/30' : 'border-ash/60',\n 'focus-within:border-gold/60 focus-within:ring-1 focus-within:ring-gold/20',\n 'transition-colors duration-200',\n isCentered && 'max-w-lg'\n )}\n onDragEnter={showAttachmentButton ? handleDragEnter : undefined}\n onDragLeave={showAttachmentButton ? handleDragLeave : undefined}\n onDragOver={showAttachmentButton ? handleDragOver : undefined}\n onDrop={showAttachmentButton ? handleDrop : undefined}\n >\n {/* Attachments preview */}\n {hasAttachments && (\n <div className=\"px-3 pt-3 pb-1\">\n <AttachmentPreview\n attachments={attachments as AttachmentItem[]}\n onRemove={handleRemoveAttachment}\n removable={!isStreaming}\n />\n </div>\n )}\n\n {/* Drag overlay */}\n {isDragOver && (\n <div\n className=\"absolute inset-0 bg-gold/10 flex items-center justify-center z-10 pointer-events-none\">\n <span className=\"text-gold text-sm font-medium\">Drop files here</span>\n </div>\n )}\n\n {/* Textarea row */}\n <div className=\"flex items-end\">\n {/* Attachment button */}\n {showAttachmentButton && (\n <>\n <button\n type=\"button\"\n onClick={() => fileInputRef.current?.click()}\n disabled={disabled || isStreaming}\n className={cx(\n 'p-3 text-silver/60 hover:text-silver transition-colors',\n 'disabled:opacity-50 disabled:cursor-not-allowed'\n )}\n aria-label=\"Attach file\"\n >\n <Paperclip className=\"w-5 h-5\"/>\n </button>\n <input\n ref={fileInputRef}\n type=\"file\"\n multiple\n accept={acceptedFileTypes}\n onChange={handleFileSelect}\n className=\"hidden\"\n aria-hidden=\"true\"\n />\n </>\n )}\n\n <textarea\n ref={mergedTextareaRef}\n value={value}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n disabled={disabled || isStreaming}\n rows={1}\n className={cx(\n 'flex-1 bg-transparent text-white placeholder:text-silver/60',\n 'py-3 pr-12 resize-none outline-none min-h-12',\n !showAttachmentButton && 'pl-4',\n (disabled || isStreaming) && 'opacity-50 cursor-not-allowed'\n )}\n style={{maxHeight: 200}}\n />\n\n {/* Submit or Stop button */}\n {isStreaming ? (\n <button\n type=\"button\"\n onClick={onStop}\n className={cx(\n 'absolute right-2 bottom-2 p-2',\n 'text-error hover:bg-error/10 transition-colors duration-200'\n )}\n aria-label=\"Stop generation\"\n >\n <Square className=\"w-5 h-5 fill-current\"/>\n </button>\n ) : (\n <button\n type=\"button\"\n onClick={handleSubmit}\n disabled={!canSubmit}\n className={cx(\n 'absolute right-2 bottom-2 p-2',\n 'transition-colors duration-200',\n canSubmit\n ? 'text-gold hover:bg-gold/10'\n : 'text-silver/40 cursor-not-allowed'\n )}\n aria-label=\"Send message\"\n >\n <Send className=\"w-5 h-5\"/>\n </button>\n )}\n </div>\n </div>\n </div>\n )\n }\n)\n\nChatInput.displayName = 'ChatInput'\n\nexport default ChatInput\n","/**\n * Conversation tree types.\n *\n * The chat is rendered from a tree where every fork point — user-edits,\n * retries, parallel task attempts, rewinds — produces siblings under a shared\n * parent. The tree is generic over its node type so that the topology\n * algorithms in `./tree.ts` stay free of any kind-specific branching.\n *\n * Two concrete node kinds live here today: `MessageNode` (a user or assistant\n * turn) and `CheckpointNode` (a marker anchored to a hypocaust task execution\n * that the user can rewind to). New kinds plug in by extending `NodeTopology`\n * and joining the `ChatNode` union.\n */\n\nimport {ReactNode} from 'react'\n\n// ───────────────────────────────────────────────────────────────\n// Topology\n// ───────────────────────────────────────────────────────────────\n\n/**\n * The minimal contract every tree node must satisfy. The tree algorithms only\n * ever read these fields; everything else is opaque to them.\n */\nexport interface NodeTopology {\n id: string\n parentId: string | null\n createdAt?: number\n}\n\n/**\n * A node as actually stored in the tree: the caller's data plus the adjacency\n * info the tree maintains. `children` and `branchIndex` are owned by the tree\n * and must never be set by callers — pass a plain `T` to `addNodeToTree`.\n */\nexport type TreeNode<T extends NodeTopology> = T & {\n children: string[]\n branchIndex?: number\n}\n\n// ───────────────────────────────────────────────────────────────\n// Concrete chat node kinds\n// ───────────────────────────────────────────────────────────────\n\n/**\n * A user or assistant message in the conversation.\n */\nexport interface MessageNode extends NodeTopology {\n kind: 'message'\n role: 'user' | 'assistant'\n /** Rendered content. Strings, React nodes, or anything ChatView can display. */\n content: ReactNode\n /** Whether this message is currently being streamed. */\n isStreaming?: boolean\n /**\n * Files that were attached to this message turn. Rendered as a chip strip\n * above the bubble. Empty/undefined renders nothing. The `artifactId` field\n * on each item, paired with the host's `onAttachmentOpen`, drives\n * click-through to the artifact-card modal.\n */\n attachments?: import('./types').MessageAttachmentItem[]\n}\n\n/**\n * One attachment row above a sent user message. Mirrors `AttachmentItem` but\n * carries the persisted `artifactId` instead of an in-memory File reference,\n * since these refer to artifacts that already live in the project tree.\n */\nexport interface MessageAttachmentItem {\n /** Stable identifier for the chip (typically the upload or artifact id). */\n id: string\n /** Display name (filename from the original upload). */\n name: string\n /** MIME type — drives the chip icon and image-preview branch. */\n type: string\n /** File size in bytes, optional. */\n size?: number\n /** Pre-signed thumbnail URL for image previews, optional. */\n previewUrl?: string\n /** Backend artifact id; required for click-through to work. */\n artifactId?: string\n /**\n * Lifecycle state captured at message-build time. Defaults to `analyzed`\n * for the happy path. Set to `analysis_failed` to render a red chip on a\n * successfully-integrated message, or to a pre-integrate state on a\n * message whose integrate call failed.\n */\n status?: AttachmentStatus\n}\n\n/**\n * A checkpoint that anchors a chat position to a hypocaust task execution.\n * Clicking a checkpoint rewinds the artifact view (and the tree's active leaf)\n * to the project state at that execution. New tasks sent from this position\n * use the checkpoint's `taskExecutionId` as their predecessor.\n */\nexport interface CheckpointNode extends NodeTopology {\n kind: 'checkpoint'\n /** ID of the hypocaust task execution this checkpoint anchors to. */\n taskExecutionId: string\n /** Human-readable label, ≤ 50 chars, supplied by hypocaust. */\n name: string\n /**\n * What kind of project mutation produced this checkpoint.\n * - `task`: a Claude-driven task execution\n * - `submit`: a merge of a working branch into the project head\n * - `rename`: a manual artifact rename via the artifacts panel (planned)\n * - `init`: the project head at session start (seeded into new chats)\n * - `ingest`: a batch of user uploads committed to the project tree\n */\n executionKind: 'task' | 'submit' | 'rename' | 'init' | 'ingest'\n /** Terminal status reported by hypocaust. */\n status: 'completed' | 'failed' | 'cancelled'\n}\n\n/**\n * Discriminated union of every chat-tree node kind.\n *\n * Extend by adding a new `interface FooNode extends NodeTopology { kind: 'foo' ... }`\n * and joining it here. Every algorithm in `./tree.ts` will keep working without\n * change because it operates on `NodeTopology`, not on this union.\n */\nexport type ChatNode = MessageNode | CheckpointNode\n\n// ───────────────────────────────────────────────────────────────\n// Tree\n// ───────────────────────────────────────────────────────────────\n\n/**\n * A branching conversation tree.\n *\n * The path the user is currently viewing runs from a root through descendants\n * until it reaches `activeLeafId`. `lastLeafId` records the deepest leaf the\n * user has reached on the previously-active path; when `activeLeafId` is an\n * ancestor of `lastLeafId`, the nodes between them are the \"greyed future\"\n * (the timeline the user rewound away from but can still jump back into).\n */\nexport interface ConversationTree<T extends NodeTopology = ChatNode> {\n nodes: Record<string, TreeNode<T>>\n rootIds: string[]\n /** Leaf the user is currently viewing. Active path = root → here. */\n activeLeafId: string | null\n /**\n * Deepest leaf the user reached on the previously-active path. Equal to\n * `activeLeafId` whenever no rewind is in effect; cleared/reset by branch\n * switches and new node insertions.\n */\n lastLeafId: string | null\n}\n\n// ───────────────────────────────────────────────────────────────\n// Attachments\n// ───────────────────────────────────────────────────────────────\n\n/**\n * Attachment lifecycle, mirroring the per-file backend state machine:\n * upload → analyze, with separate failure modes for each phase.\n */\nexport type AttachmentStatus =\n | 'pending'\n | 'uploading'\n | 'uploaded'\n | 'analyzing'\n | 'analyzed'\n | 'upload_failed'\n | 'analysis_failed'\n\nexport interface Attachment {\n /**\n * Unique identifier for the attachment\n */\n id: string\n /**\n * The File object\n */\n file: File\n /**\n * Blob URL for image previews\n */\n previewUrl?: string\n /**\n * Current upload status\n */\n status: AttachmentStatus\n /**\n * Error message if status is an error variant\n */\n error?: string\n /**\n * Upload progress (0-100)\n */\n progress?: number\n /**\n * Backend artifact id, set once the batch is integrated. Drives chip\n * click-through to the artifact-card modal in the host app.\n */\n artifactId?: string\n}\n\n/**\n * Helper to check if a file is an image\n */\nexport function isImageFile(file: File): boolean {\n return file.type.startsWith('image/')\n}\n\n/**\n * Helper to create a preview URL for an image file\n */\nexport function createPreviewUrl(file: File): string | undefined {\n if (isImageFile(file)) {\n return URL.createObjectURL(file)\n }\n return undefined\n}\n\n/**\n * Helper to revoke a preview URL when no longer needed\n */\nexport function revokePreviewUrl(url: string | undefined): void {\n if (url) {\n URL.revokeObjectURL(url)\n }\n}\n\n/**\n * Generate a unique ID\n */\nexport function generateId(): string {\n if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {\n return crypto.randomUUID()\n }\n return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`\n}\n","import React, {useCallback, useEffect, useRef, useState} from 'react'\nimport {Image} from 'lucide-react'\nimport {cx} from '../../utils'\nimport {ArtifactCard} from '../ArtifactCard'\nimport {ArtifactGroup} from '../ArtifactGroup'\nimport {ArtifactVariantStack} from '../ArtifactVariantStack'\nimport {ArtifactLightboxBody, getArtifactLightboxCaption} from '../ArtifactLightboxBody'\nimport {CardSlotLoading} from '../Card'\nimport {Lightbox} from '../Lightbox'\nimport {ChevronRightIcon} from '../icons'\nimport type {Artifact} from './hooks'\nimport {useArtifactTreeNavigation} from './hooks'\nimport type {ArtifactNode} from '../ArtifactNode'\n\nconst ZOOM_LEVELS = [0.25, 0.5, 0.75, 1.0] as const\n\nexport interface ArtifactsPanelProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Top-level tree nodes to display in the navigable artifact tree.\n */\n nodes?: ArtifactNode[]\n /**\n * Whether artifacts are still loading (show skeletons)\n */\n loading?: CardSlotLoading\n /**\n * When set to a non-null id, surfaces the same expanded artifact card the\n * panel grid would. Drives chip click-through from outside the panel.\n * Pair with `onArtifactClosed` so the parent can clear its controller\n * state when the user dismisses the modal.\n */\n openArtifactId?: string | null\n /**\n * Called when the user closes the expanded card (X button or backdrop).\n * The parent owns whether subsequent renders re-open by re-supplying\n * `openArtifactId`.\n */\n onArtifactClosed?: () => void\n /**\n * Resolves the floating action cluster shown over the lightbox when an\n * artifact is opened. Switch on `artifact.type` and return the host-owned\n * buttons for that kind (e.g. Share + Download for deliverables, Download\n * for images). Aurelius ships the close affordance itself; return only the\n * kind-specific actions, or `null` when there are none. The `ctx.onClose`\n * helper lets actions dismiss the lightbox after a successful operation.\n */\n getArtifactActions?: (\n artifact: Artifact,\n ctx: {onClose: () => void},\n ) => React.ReactNode\n}\n\n/**\n * Resolve the lightbox host actions for an artifact via the panel-level\n * callback. Wrapped here so the JSX reads as a single component. When the\n * host provides nothing, the lightbox renders only its close affordance.\n */\nfunction ArtifactLightbox({\n artifact,\n onClose,\n getArtifactActions,\n}: {\n artifact: Artifact\n onClose: () => void\n getArtifactActions?: (\n artifact: Artifact,\n ctx: {onClose: () => void},\n ) => React.ReactNode\n}) {\n return (\n <Lightbox\n onClose={onClose}\n actions={getArtifactActions?.(artifact, {onClose})}\n caption={getArtifactLightboxCaption(artifact)}\n >\n <ArtifactLightboxBody artifact={artifact}/>\n </Lightbox>\n )\n}\n\n/**\n * Walk the artifact tree (including variant stacks and nested groups) to find\n * a leaf artifact by id. Returns null when no match exists in the current view.\n */\nfunction findArtifactInNodes(nodes: ArtifactNode[], artifactId: string): Artifact | null {\n for (const node of nodes) {\n if (node.type === 'ARTIFACT' && node.artifact?.id === artifactId) {\n return node.artifact\n }\n if (node.children && node.children.length > 0) {\n const found = findArtifactInNodes(node.children, artifactId)\n if (found) {\n return found\n }\n }\n }\n return null\n}\n\n/**\n * Renders a single node according to its type.\n */\nfunction NodeRenderer({\n node,\n loading,\n onExpandArtifact,\n onGroupClick,\n}: {\n node: ArtifactNode\n loading?: CardSlotLoading\n onExpandArtifact: (artifact: Artifact) => void\n onGroupClick: (node: ArtifactNode) => void\n}) {\n if (node.type === 'ARTIFACT' && node.artifact) {\n return (\n <ArtifactCard\n artifact={node.artifact}\n loading={loading}\n onExpand={onExpandArtifact}\n />\n )\n }\n\n if (node.type === 'GROUP') {\n return <ArtifactGroup node={node} onClick={onGroupClick}/>\n }\n\n if (node.type === 'VARIANT_SET') {\n return (\n <ArtifactVariantStack\n node={node}\n onExpandArtifact={onExpandArtifact}\n onGroupClick={onGroupClick}\n />\n )\n }\n\n return null\n}\n\n/**\n * ArtifactsPanel displays artifacts in a navigable tree panel.\n *\n * This is a content-only component — it fills whatever container it is\n * placed in. Opening/closing and resizing are handled by the parent\n * ToolPanelContainer and ToolSidebar.\n *\n * Groups can be entered (breadcrumb navigation) and artifact nodes\n * can be expanded to a full-screen modal.\n *\n * Supports zoom controls (0.25x–1x). Zoom uses CSS `transform: scale()`\n * on the content wrapper so the entire layout scales uniformly — cards,\n * images, gaps, and text all shrink as if the viewer is physically\n * moving back from the content.\n */\nexport const ArtifactsPanel = React.forwardRef<HTMLDivElement, ArtifactsPanelProps>(\n ({\n nodes,\n loading,\n openArtifactId,\n onArtifactClosed,\n getArtifactActions,\n className,\n ...rest\n }, ref) => {\n const [expandedArtifact, setExpandedArtifact] = useState<Artifact | null>(null)\n const [zoomIndex, setZoomIndex] = useState<number>(ZOOM_LEVELS.length - 1) // default 1.0\n\n const treeNav = useArtifactTreeNavigation(nodes || [])\n\n const hasNodes = !!nodes && nodes.length > 0\n\n const handleExpandArtifact = useCallback((artifact: Artifact) => {\n setExpandedArtifact(artifact)\n }, [])\n\n const handleGroupClick = useCallback((node: ArtifactNode) => {\n treeNav.navigateInto(node)\n }, [treeNav])\n\n // Controlled open: surfaces the expanded card when the parent supplies a\n // non-null `openArtifactId`. Pairs with `onArtifactClosed` round-trip so\n // re-clicking the same chip after a manual close re-opens the modal.\n useEffect(() => {\n if (!openArtifactId || !nodes) {\n return\n }\n const found = findArtifactInNodes(nodes, openArtifactId)\n if (found) {\n setExpandedArtifact(found)\n }\n }, [openArtifactId, nodes])\n\n const handleModalClose = useCallback(() => {\n setExpandedArtifact(null)\n onArtifactClosed?.()\n }, [onArtifactClosed])\n\n const zoomIn = useCallback(() => {\n setZoomIndex(prev => Math.min(prev + 1, ZOOM_LEVELS.length - 1))\n }, [])\n\n const zoomOut = useCallback(() => {\n setZoomIndex(prev => Math.max(prev - 1, 0))\n }, [])\n\n const currentZoom = ZOOM_LEVELS[zoomIndex]\n\n // Measure content height so the scroll container can shrink to match the scaled visual height\n const contentRef = useRef<HTMLDivElement>(null)\n const [contentHeight, setContentHeight] = useState<number | undefined>(undefined)\n\n useEffect(() => {\n const el = contentRef.current\n if (!el) {\n return\n }\n const observer = new ResizeObserver(([entry]) => {\n setContentHeight(entry.contentRect.height)\n })\n observer.observe(el)\n return () => observer.disconnect()\n }, [])\n\n return (\n <>\n <div\n ref={ref}\n data-testid=\"artifacts-panel\"\n className={cx(\n 'h-full flex flex-col relative',\n className\n )}\n {...rest}\n >\n {/* Header with title and zoom controls */}\n <div\n className=\"flex items-center justify-between p-4 border-b border-ash/40 shrink-0\">\n <h3 className=\"text-sm font-semibold text-white\">Artifacts</h3>\n {hasNodes && (\n <div\n className=\"flex items-center gap-0.5\"\n data-testid=\"zoom-controls\"\n >\n <button\n onClick={zoomOut}\n disabled={zoomIndex === 0}\n className={cx(\n 'w-6 h-6 flex items-center justify-center text-xs font-bold',\n 'bg-charcoal border border-ash/40',\n zoomIndex === 0\n ? 'text-silver/30 cursor-not-allowed'\n : 'text-silver hover:text-gold hover:border-gold/40 transition-colors',\n )}\n aria-label=\"Zoom out\"\n >\n −\n </button>\n <span className=\"text-xs text-silver w-8 text-center tabular-nums\"\n data-testid=\"zoom-level\">\n {Math.round(currentZoom * 100)}%\n </span>\n <button\n onClick={zoomIn}\n disabled={zoomIndex === ZOOM_LEVELS.length - 1}\n className={cx(\n 'w-6 h-6 flex items-center justify-center text-xs font-bold',\n 'bg-charcoal border border-ash/40',\n zoomIndex === ZOOM_LEVELS.length - 1\n ? 'text-silver/30 cursor-not-allowed'\n : 'text-silver hover:text-gold hover:border-gold/40 transition-colors',\n )}\n aria-label=\"Zoom in\"\n >\n +\n </button>\n </div>\n )}\n </div>\n\n {/* Breadcrumb trail (tree mode only, when not at root) */}\n {hasNodes && !treeNav.isAtRoot && (\n <nav\n className=\"flex items-center gap-1 px-4 py-2 border-b border-ash/40 shrink-0 overflow-x-auto text-xs\"\n aria-label=\"Breadcrumb\"\n data-testid=\"breadcrumb-nav\"\n >\n {treeNav.breadcrumbs.map((crumb, i) => {\n const isLast = i === treeNav.breadcrumbs.length - 1\n return (\n <span key={i} className=\"flex items-center gap-1 shrink-0\">\n {i > 0 && (\n <ChevronRightIcon className=\"w-3 h-3 text-silver/50\" aria-hidden/>\n )}\n {isLast ? (\n <span className=\"text-gold font-medium\">{crumb.label}</span>\n ) : (\n <button\n onClick={() => treeNav.navigateTo(i)}\n className=\"text-silver hover:text-white transition-colors\"\n >\n {crumb.label}\n </button>\n )}\n </span>\n )\n })}\n </nav>\n )}\n\n {/* Content area — single column, natural widths, scrollable */}\n <div\n className=\"flex-1 overflow-auto relative\"\n data-testid=\"artifacts-scroll-area\"\n >\n {/* Sizer div: collapses to the scaled height so scrollbar tracks correctly */}\n <div\n style={currentZoom !== 1 && contentHeight !== undefined\n ? {height: contentHeight * currentZoom}\n : undefined\n }\n >\n <div\n ref={contentRef}\n data-testid=\"artifacts-grid\"\n className=\"p-4 space-y-4\"\n style={currentZoom !== 1\n ? {\n transform: `scale(${currentZoom})`,\n transformOrigin: 'top center',\n }\n : undefined\n }\n >\n {treeNav.currentNodes.length === 0 ? (\n <p className=\"text-xs text-silver/60 text-center py-8\">\n {hasNodes ? 'Empty group' : 'No artifacts to display'}\n </p>\n ) : (\n treeNav.currentNodes.map((node) => (\n <NodeRenderer\n key={node.id}\n node={node}\n loading={loading}\n onExpandArtifact={handleExpandArtifact}\n onGroupClick={handleGroupClick}\n />\n ))\n )}\n </div>\n </div>\n </div>\n\n </div>\n\n {/* Lightbox for the expanded artifact */}\n {expandedArtifact && (\n <ArtifactLightbox\n artifact={expandedArtifact}\n onClose={handleModalClose}\n getArtifactActions={getArtifactActions}\n />\n )}\n </>\n )\n }\n)\n\nArtifactsPanel.displayName = 'ArtifactsPanel'\n\n/**\n * Toggle button to expand collapsed artifacts panel\n */\nexport interface ArtifactsPanelToggleProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n artifactCount?: number\n onExpand?: () => void\n}\n\nexport const ArtifactsPanelToggle = React.forwardRef<\n HTMLButtonElement,\n ArtifactsPanelToggleProps\n>(({artifactCount = 0, onExpand, className, ...rest}, ref) => {\n return (\n <button\n ref={ref}\n onClick={onExpand}\n className={cx(\n 'p-2',\n 'bg-charcoal/80 border border-ash/40',\n 'text-silver hover:text-white hover:bg-ash/20',\n 'transition-colors duration-150',\n 'flex items-center gap-2',\n 'relative',\n className\n )}\n aria-label=\"Expand artifacts panel\"\n {...rest}\n >\n <Image className=\"w-5 h-5\" aria-hidden/>\n {artifactCount > 0 && (\n <span\n className=\"absolute -top-1 -right-1 w-4 h-4 bg-gold text-obsidian text-xs font-medium flex items-center justify-center\">\n {artifactCount}\n </span>\n )}\n </button>\n )\n})\n\nArtifactsPanelToggle.displayName = 'ArtifactsPanelToggle'\n","import React from 'react'\nimport {type CardSlotLoading} from './Card'\nimport {ImageCard} from './ImageCard'\nimport {VideoCard} from './VideoCard'\nimport {AudioCard} from './AudioCard'\nimport {PdfCard} from './PdfCard'\nimport {ScriptCard, type ScriptElement} from './ScriptCard'\nimport {TextCard} from './TextCard'\nimport {DeliverableCard} from './DeliverableCard'\nimport type {Deliverable} from './deliverable'\nimport {ExpandIcon} from './icons'\nimport {cx} from '../utils'\nimport {deriveCardSlotLoading} from '../utils/artifactLoading'\n\n/**\n * Artifact types supported by the system\n */\nexport const ARTIFACT_TYPES = {\n TEXT: 'TEXT',\n IMAGE: 'IMAGE',\n VIDEO: 'VIDEO',\n AUDIO: 'AUDIO',\n SCRIPT: 'SCRIPT',\n PDF: 'PDF',\n DELIVERABLE: 'DELIVERABLE',\n} as const\n\nexport type ArtifactType = typeof ARTIFACT_TYPES[keyof typeof ARTIFACT_TYPES]\n\nexport interface Artifact {\n id: string\n type: ArtifactType\n /**\n * For text artifacts - the content (markdown, HTML, or plain text)\n */\n inlineContent?: string\n /**\n * For artifacts that source from a URL (image, video, audio, pdf, file)\n */\n url?: string\n /**\n * The mime type of the content\n */\n mimeType?: string\n /**\n * For image artifacts - alt text\n */\n alt?: string\n /**\n * Display title shown below the artifact\n */\n title?: string\n /**\n * Display subtitle shown below the title\n */\n subtitle?: string\n /**\n * Whether this artifact is still loading (shows skeleton)\n */\n isPending?: boolean\n /**\n * Whether the artifact should span full width in the grid\n */\n fullWidth?: boolean\n /**\n * For html artifacts - structured script elements (used by ScriptCard)\n */\n scriptElements?: ScriptElement[]\n /**\n * For deliverable artifacts - the resolved presentation spec, every artifact\n * reference already inflated. Rendered as a compact card that links to the\n * full DeliverableRenderer; surfaces the cover info and section count.\n */\n deliverable?: Deliverable\n}\n\nexport interface ArtifactCardProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * The artifact object to display\n */\n artifact: Artifact\n /**\n * Callback when the artifact should be expanded/opened\n */\n onExpand?: (artifact: Artifact) => void\n /**\n * Whether the artifact is still loading\n */\n loading?: CardSlotLoading\n}\n\n/**\n * A dispatcher component that renders the appropriate specialist card\n * based on the artifact type.\n */\nexport const ArtifactCard = React.forwardRef<HTMLDivElement, ArtifactCardProps>(\n ({artifact, onExpand, loading, className, ...props}, ref) => {\n const derivedLoading = deriveCardSlotLoading(artifact)\n const commonProps = {\n title: artifact.title,\n subtitle: artifact.subtitle,\n // `Artifact.id` is the addressable name (the @-handle) — surfacing\n // it on the card lets the filmmaker recognise the typed token in\n // chat. See `Card.Header.handle` for the rendering behaviour.\n handle: artifact.id,\n loading: loading || derivedLoading,\n className: 'w-full',\n }\n\n const handleExpand = (e: React.MouseEvent) => {\n e.stopPropagation()\n if (onExpand) {\n onExpand(artifact)\n }\n }\n\n const renderContent = () => {\n switch (artifact.type) {\n case 'IMAGE':\n return (\n <ImageCard\n {...commonProps}\n src={artifact.url}\n alt={artifact.alt}\n aspectRatio=\"landscape\"\n />\n )\n case 'VIDEO':\n return (\n <VideoCard\n {...commonProps}\n src={artifact.url}\n aspectRatio=\"video\"\n controls\n />\n )\n case 'AUDIO':\n return (\n <AudioCard\n {...commonProps}\n src={artifact.url}\n controls\n />\n )\n case 'PDF':\n return (\n <PdfCard\n {...commonProps}\n src={artifact.url}\n />\n )\n case 'SCRIPT':\n return (\n <ScriptCard\n {...commonProps}\n elements={artifact.scriptElements || []}\n maxHeight=\"16rem\"\n />\n )\n case 'TEXT':\n return (\n <TextCard\n {...commonProps}\n content={artifact.inlineContent || ''}\n isMarkdown={artifact.mimeType !== 'text/plain'}\n contentClassName={cx(\n artifact.mimeType === 'text/plain' && \"whitespace-pre-wrap\"\n )}\n />\n )\n case 'DELIVERABLE':\n return (\n <DeliverableCard\n {...commonProps}\n deliverable={artifact.deliverable}\n />\n )\n default: {\n // Exhaustiveness check — adding a new ArtifactType becomes a\n // compile error here rather than a silently dropped artifact.\n const _exhaustive: never = artifact.type\n return _exhaustive\n }\n }\n }\n\n // Determine if the card itself should be clickable to expand\n // Video and Audio have their own controls, so we only expand via the button\n const isCardExpandable = !!onExpand && (\n artifact.type === 'IMAGE' ||\n artifact.type === 'PDF' ||\n artifact.type === 'SCRIPT' ||\n artifact.type === 'TEXT' ||\n artifact.type === 'DELIVERABLE'\n )\n\n return (\n <div\n ref={ref}\n className={cx(\n 'relative group',\n isCardExpandable && 'cursor-pointer',\n artifact.fullWidth && 'col-span-full',\n className\n )}\n onClick={isCardExpandable ? handleExpand : undefined}\n {...props}\n >\n {onExpand && (\n <button\n onClick={handleExpand}\n className={cx(\n 'absolute top-2 right-2 z-10 p-1.5',\n 'bg-obsidian/80 text-silver hover:text-white hover:bg-obsidian',\n 'opacity-0 group-hover:opacity-100 transition-opacity'\n )}\n aria-label=\"Expand artifact\"\n >\n <ExpandIcon className=\"w-4 h-4\"/>\n </button>\n )}\n {renderContent()}\n </div>\n )\n }\n)\n\nArtifactCard.displayName = 'ArtifactCard'\n\nexport default ArtifactCard\n","import React from 'react'\nimport {Card, type CardProps, type CardSlotLoading} from './Card'\nimport {cx} from '../utils'\n\nexport type AspectRatioPreset = 'landscape' | 'portrait' | 'square'\nexport type AspectRatio = AspectRatioPreset | `${number}/${number}`\n\nexport interface ImageCardProps extends Omit<CardProps, 'title'> {\n src?: string\n alt?: string\n title?: React.ReactNode\n subtitle?: React.ReactNode\n /** The artifact's `@-handle` — see `Card.Header.handle`. */\n handle?: string\n aspectRatio?: AspectRatio\n objectFit?: 'cover' | 'contain'\n overlay?: React.ReactNode\n mediaClassName?: string\n contentClassName?: string\n loading?: CardSlotLoading\n}\n\nconst ASPECT_RATIO_PRESETS: Record<AspectRatioPreset, string> = {\n landscape: '3 / 2',\n portrait: '2 / 3',\n square: '1 / 1',\n}\n\nfunction resolveAspectRatio(ratio: AspectRatio): string {\n if (ratio in ASPECT_RATIO_PRESETS) {\n return ASPECT_RATIO_PRESETS[ratio as AspectRatioPreset]\n }\n return ratio.replace('/', ' / ')\n}\n\nexport const ImageCard = React.forwardRef<HTMLDivElement, ImageCardProps>(\n (\n {\n src,\n alt = '',\n title,\n subtitle,\n handle,\n aspectRatio = 'landscape',\n objectFit = 'cover',\n overlay,\n mediaClassName,\n contentClassName,\n className,\n children,\n loading,\n ...props\n },\n ref\n ) => {\n return (\n <Card\n ref={ref}\n className={cx('p-0 overflow-hidden w-full', className)}\n loading={loading}\n {...props}\n >\n <Card.Media\n className={mediaClassName}\n style={{aspectRatio: resolveAspectRatio(aspectRatio)}}\n >\n <>\n {src && (\n <img\n src={src}\n alt={alt}\n className={cx(\n 'w-full h-full',\n objectFit === 'cover' ? 'object-cover' : 'object-contain'\n )}\n />\n )}\n {overlay && (\n <div\n className=\"absolute inset-0 bg-obsidian/80 opacity-0 group-hover:opacity-100 transition-opacity duration-200 flex items-center justify-center\">\n {overlay}\n </div>\n )}\n </>\n </Card.Media>\n <Card.Header\n title={title}\n subtitle={subtitle}\n handle={handle}\n className={contentClassName}\n />\n {children && <Card.Body className={contentClassName}>{children}</Card.Body>}\n </Card>\n )\n }\n)\n\nImageCard.displayName = 'ImageCard'","import React from 'react'\nimport ReactPlayer from 'react-player'\nimport {Card, type CardProps, type CardSlotLoading} from './Card'\nimport {cx} from '../utils'\n\ntype ReactPlayerProps = React.ComponentProps<typeof ReactPlayer>\n\nexport type VideoAspectRatioPreset = 'video' | 'cinema' | 'square'\nexport type VideoAspectRatio = VideoAspectRatioPreset | `${number}/${number}`\n\nexport interface VideoCardProps extends Omit<CardProps, 'title'> {\n src?: string\n title?: React.ReactNode\n subtitle?: React.ReactNode\n /** The artifact's `@-handle` — see `Card.Header.handle`. */\n handle?: string\n aspectRatio?: VideoAspectRatio\n playing?: boolean\n controls?: boolean\n light?: boolean | string\n volume?: number\n muted?: boolean\n loop?: boolean\n mediaClassName?: string\n contentClassName?: string\n /** Forwarded to the underlying ReactPlayer. */\n playerProps?: Partial<ReactPlayerProps>\n loading?: CardSlotLoading\n}\n\nconst ASPECT_RATIO_PRESETS: Record<VideoAspectRatioPreset, string> = {\n video: '16 / 9',\n cinema: '21 / 9',\n square: '1 / 1',\n}\n\nfunction resolveAspectRatio(ratio: VideoAspectRatio): string {\n if (ratio in ASPECT_RATIO_PRESETS) {\n return ASPECT_RATIO_PRESETS[ratio as VideoAspectRatioPreset]\n }\n return ratio.replace('/', ' / ')\n}\n\nexport const VideoCard = React.forwardRef<HTMLDivElement, VideoCardProps>(\n (\n {\n src,\n title,\n subtitle,\n handle,\n aspectRatio = 'video',\n playing = false,\n controls = true,\n light = false,\n volume,\n muted = false,\n loop = false,\n mediaClassName,\n contentClassName,\n className,\n children,\n playerProps,\n loading,\n ...props\n },\n ref\n ) => {\n return (\n <Card\n ref={ref}\n className={cx('p-0 overflow-hidden w-full', className)}\n loading={loading}\n {...props}\n >\n <Card.Media\n className={mediaClassName}\n style={{aspectRatio: resolveAspectRatio(aspectRatio)}}\n >\n {src && (\n <ReactPlayer\n src={src}\n playing={playing}\n controls={controls}\n light={light}\n volume={volume}\n muted={muted}\n loop={loop}\n width=\"100%\"\n height=\"100%\"\n className=\"absolute top-0 left-0\"\n {...playerProps}\n />\n )}\n </Card.Media>\n <Card.Header\n title={title}\n subtitle={subtitle}\n handle={handle}\n className={contentClassName}\n />\n {children && <Card.Body className={contentClassName}>{children}</Card.Body>}\n </Card>\n )\n }\n)\n\nVideoCard.displayName = 'VideoCard'\n","import React from 'react'\nimport ReactPlayer from 'react-player'\nimport {Music} from 'lucide-react'\nimport {Card, type CardProps, type CardSlotLoading} from './Card'\nimport {cx} from '../utils'\n\ntype ReactPlayerProps = React.ComponentProps<typeof ReactPlayer>\n\nexport interface AudioCardProps extends Omit<CardProps, 'title'> {\n src?: string\n title?: React.ReactNode\n subtitle?: React.ReactNode\n /** The artifact's `@-handle` — see `Card.Header.handle`. */\n handle?: string\n playing?: boolean\n controls?: boolean\n volume?: number\n muted?: boolean\n loop?: boolean\n mediaClassName?: string\n contentClassName?: string\n /** Forwarded to the underlying ReactPlayer. */\n playerProps?: Partial<ReactPlayerProps>\n height?: string | number\n loading?: CardSlotLoading\n}\n\nexport const AudioCard = React.forwardRef<HTMLDivElement, AudioCardProps>(\n (\n {\n src,\n title,\n subtitle,\n handle,\n playing = false,\n controls = true,\n volume,\n muted = false,\n loop = false,\n mediaClassName,\n contentClassName,\n className,\n children,\n playerProps,\n height = '40px',\n loading,\n ...props\n },\n ref\n ) => {\n return (\n <Card\n ref={ref}\n className={cx('p-0 overflow-hidden w-full', className)}\n loading={loading}\n {...props}\n >\n <Card.Media className={cx('bg-obsidian py-8 flex flex-col items-center justify-center',\n mediaClassName)}>\n <div className=\"mb-4 text-gold\">\n <Music size={48}/>\n </div>\n\n {src && (\n <div className=\"w-full px-4\">\n <ReactPlayer\n src={src}\n playing={playing}\n controls={controls}\n volume={volume}\n muted={muted}\n loop={loop}\n width=\"100%\"\n height={height}\n style={{backgroundColor: 'transparent', width: '100%', height}}\n {...playerProps}\n />\n </div>\n )}\n </Card.Media>\n <Card.Header\n title={title}\n subtitle={subtitle}\n handle={handle}\n className={contentClassName}\n />\n {children && <Card.Body className={contentClassName}>{children}</Card.Body>}\n </Card>\n )\n }\n)\n\nAudioCard.displayName = 'AudioCard'\n","import React from 'react'\nimport {FileText} from 'lucide-react'\nimport {Card, type CardProps, type CardSlotLoading} from './Card'\nimport {cx} from '../utils'\n\nexport interface PdfCardProps extends Omit<CardProps, 'title'> {\n /**\n * URL of the PDF file\n */\n src?: string\n /**\n * Title of the document\n */\n title?: React.ReactNode\n /**\n * Subtitle or document metadata\n */\n subtitle?: React.ReactNode\n /** The artifact's `@-handle` — see `Card.Header.handle`. */\n handle?: string\n /**\n * Height of the PDF viewer\n */\n height?: string | number\n /**\n * Optional class name for the media container\n */\n mediaClassName?: string\n /**\n * Optional class name for the content container\n */\n contentClassName?: string\n loading?: CardSlotLoading\n}\n\n/**\n * A card for displaying PDF documents with an embedded viewer.\n */\nexport const PdfCard = React.forwardRef<HTMLDivElement, PdfCardProps>(\n (\n {\n src,\n title,\n subtitle,\n handle,\n height = '400px',\n mediaClassName,\n contentClassName,\n className,\n children,\n loading,\n ...props\n },\n ref\n ) => {\n return (\n <Card\n ref={ref}\n className={cx('p-0 overflow-hidden w-full', className)}\n loading={loading}\n {...props}\n >\n <Card.Media\n className={cx('bg-obsidian', mediaClassName)}\n style={{height}}\n >\n {src && (\n <iframe\n src={`${src}#view=FitH`}\n title={typeof title === 'string' ? title : 'PDF Document'}\n className=\"w-full h-full border-0\"\n />\n )}\n </Card.Media>\n <Card.Header\n title={title}\n subtitle={subtitle}\n handle={handle}\n className={contentClassName}\n action={\n <div className=\"p-2 bg-ash/20 text-gold shrink-0\">\n <FileText size={20}/>\n </div>\n }\n />\n {children && <Card.Body className={contentClassName}>{children}</Card.Body>}\n </Card>\n )\n }\n)\n\nPdfCard.displayName = 'PdfCard'\n","import React from 'react'\nimport {cx} from '../utils'\n\nimport {Card, type CardProps, type CardSlotLoading} from './Card'\n\n/**\n * Script element types following standard screenplay format\n */\nexport const SCRIPT_ELEMENT_TYPES = {\n SCENE_HEADING: 'scene-heading',\n ACTION: 'action',\n CHARACTER: 'character',\n DIALOGUE: 'dialogue',\n PARENTHETICAL: 'parenthetical',\n TRANSITION: 'transition',\n TITLE: 'title',\n SUBTITLE: 'subtitle',\n} as const\n\nexport type ScriptElementType = typeof SCRIPT_ELEMENT_TYPES[keyof typeof SCRIPT_ELEMENT_TYPES]\n\n/**\n * A single element in the script\n */\nexport interface ScriptElement {\n /**\n * The type of script element (e.g., 'scene-heading', 'character', 'dialogue')\n */\n type: ScriptElementType\n /**\n * The text content of the element\n */\n content: string\n}\n\nexport interface ScriptCardProps extends Omit<CardProps, 'title'> {\n /**\n * Title of the script (shown at top)\n */\n title?: React.ReactNode\n /**\n * Subtitle/metadata (e.g., \"30-second spot • Directed by AI Creative\")\n */\n subtitle?: React.ReactNode\n /** The artifact's `@-handle` — see `Card.Header.handle`. */\n handle?: string\n /**\n * Array of script elements in order.\n * Available types: 'scene-heading', 'action', 'character', 'dialogue', 'parenthetical',\n * 'transition', 'title', 'subtitle'\n */\n elements: ScriptElement[]\n /**\n * Maximum height before scrolling (default: 16rem / 256px)\n */\n maxHeight?: string\n loading?: CardSlotLoading\n}\n\n/**\n * Render a script element with proper formatting\n */\nfunction ScriptElementRenderer({element}: { element: ScriptElement }) {\n switch (element.type) {\n case 'scene-heading':\n return (\n <p className=\"mt-4 mb-2 font-bold uppercase text-gold text-xs tracking-wide\">\n {element.content}\n </p>\n )\n\n case 'action':\n return (\n <p className=\"my-2 text-silver text-xs leading-relaxed\">\n {element.content}\n </p>\n )\n\n case 'character':\n return (\n <p className=\"mt-4 mb-0.5 ml-8 font-bold text-white text-xs uppercase tracking-wide\">\n {element.content}\n </p>\n )\n\n case 'parenthetical':\n return (\n <p className=\"ml-6 text-silver/70 text-xs italic\">\n ({element.content})\n </p>\n )\n\n case 'dialogue':\n return (\n <p className=\"ml-4 mr-8 text-silver text-xs leading-relaxed\">\n {element.content}\n </p>\n )\n\n case 'transition':\n return (\n <p className=\"mt-4 mb-2 text-right font-bold uppercase text-gold/80 text-xs tracking-wide\">\n {element.content}\n </p>\n )\n\n case 'title':\n return (\n <p className=\"mt-6 mb-2 text-center font-bold text-gold text-sm\">\n {element.content}\n </p>\n )\n\n case 'subtitle':\n return (\n <p className=\"text-center italic text-gold/70 text-xs\">\n {element.content}\n </p>\n )\n\n default:\n return null\n }\n}\n\n/**\n * ScriptCard displays a formatted movie/video script.\n *\n * Follows standard screenplay formatting conventions:\n * - Scene headings: uppercase, gold, left-aligned\n * - Action: silver, full width\n * - Character names: uppercase, centered-left\n * - Dialogue: indented from both sides\n * - Transitions: uppercase, right-aligned\n *\n * @example\n * ```tsx\n * <ScriptCard\n * title=\"The Arrival\"\n * elements={[\n * { type: 'scene-heading', content: 'EXT. SPACE STATION - NIGHT' },\n * { type: 'action', content: 'A lone ship approaches the docking bay.' },\n * { type: 'character', content: 'PILOT' },\n * { type: 'dialogue', content: 'Requesting permission to land.' }\n * ]}\n * />\n * ```\n */\nexport const ScriptCard = React.forwardRef<HTMLDivElement, ScriptCardProps>(\n ({title, subtitle, handle, elements, maxHeight = '16rem', className, style, loading, ...rest},\n ref) => {\n return (\n <Card\n ref={ref}\n className={cx('p-0 overflow-hidden w-full', className)}\n loading={loading}\n {...rest}\n >\n <Card.Header\n title={title}\n subtitle={subtitle}\n handle={handle}\n />\n <Card.Body\n className=\"font-mono overflow-y-auto\"\n style={{maxHeight, ...style}}\n >\n {elements.map((element, index) => (\n <ScriptElementRenderer key={index} element={element}/>\n ))}\n </Card.Body>\n </Card>\n )\n }\n)\n\nScriptCard.displayName = 'ScriptCard'\n\nexport default ScriptCard\n","import React from 'react'\nimport {Card, type CardProps, type CardSlotLoading} from './Card'\nimport {MarkdownContent} from './MarkdownContent'\nimport {cx} from '../utils'\n\nexport interface TextCardProps extends Omit<CardProps, 'title'> {\n /**\n * Text content to display (Markdown, HTML, or plain text)\n */\n content: string\n /**\n * Optional title for the card\n */\n title?: React.ReactNode\n /**\n * Optional subtitle or metadata\n */\n subtitle?: React.ReactNode\n /** The artifact's `@-handle` — see `Card.Header.handle`. */\n handle?: string\n /**\n * Whether the content should be treated as Markdown\n * @default true\n */\n isMarkdown?: boolean\n /**\n * Maximum height of the content area before scrolling\n * @default '16rem'\n */\n maxHeight?: string | number\n /**\n * Optional class name for the content container\n */\n contentClassName?: string\n loading?: CardSlotLoading\n}\n\n/**\n * A card for displaying text content, supporting Markdown and HTML formatting.\n */\nexport const TextCard = React.forwardRef<HTMLDivElement, TextCardProps>(\n (\n {\n content,\n title,\n subtitle,\n handle,\n isMarkdown = true,\n maxHeight = '16rem',\n contentClassName,\n className,\n loading,\n ...props\n },\n ref\n ) => {\n return (\n <Card\n ref={ref}\n className={cx('p-0 overflow-hidden w-full', className)}\n loading={loading}\n {...props}\n >\n <Card.Header\n title={title}\n subtitle={subtitle}\n handle={handle}\n />\n <Card.Body\n className={cx('overflow-y-auto', contentClassName)}\n style={{maxHeight}}\n >\n <MarkdownContent\n content={content}\n isMarkdown={isMarkdown}\n className=\"prose-sm prose-invert max-w-none\"\n />\n </Card.Body>\n </Card>\n )\n }\n)\n\nTextCard.displayName = 'TextCard'\n\nexport default TextCard\n","import React from 'react'\nimport {Card, type CardProps, type CardSlotLoading} from './Card'\nimport {cx} from '../utils'\nimport type {Deliverable} from './deliverable'\n\nexport interface DeliverableCardProps extends Omit<CardProps, 'title'> {\n /**\n * Resolved deliverable spec — every artifact reference already inflated.\n * Same shape the full DeliverableRenderer accepts.\n */\n deliverable?: Deliverable\n /** Optional override for the cover title (otherwise derived from the spec). */\n title?: React.ReactNode\n /** Optional subtitle shown below the title. */\n subtitle?: React.ReactNode\n /** The artifact's `@-handle` — see `Card.Header.handle`. */\n handle?: string\n loading?: CardSlotLoading\n}\n\n/**\n * Compact preview of a deliverable for surfaces that can't host the full\n * multi-page renderer (chat tree, artifact lists). Surfaces the deliverable's\n * cover info plus its section count. The whole card is clickable — the\n * affordance is the same expand-icon overlay that {@link ArtifactCard} shows\n * for every artifact kind, so we don't add a \"Open preview\" lure here.\n */\nexport const DeliverableCard = React.forwardRef<HTMLDivElement, DeliverableCardProps>(\n (\n {\n deliverable,\n title,\n subtitle,\n handle,\n className,\n loading,\n ...props\n },\n ref,\n ) => {\n const cover = deliverable?.sections.find(\n (s): s is Extract<typeof s, { type: 'COVER' }> => s.type === 'COVER',\n )\n const eyebrow = cover?.eyebrow\n const headline = title ?? cover?.title ?? deliverable?.title\n const tagline = subtitle ?? cover?.subtitle ?? deliverable?.subtitle\n const accent = deliverable?.accentColor?.trim()\n const style = accent\n ? ({'--deliverable-accent': accent} as React.CSSProperties)\n : undefined\n const sectionCount = deliverable?.sections.length ?? 0\n\n return (\n <Card\n ref={ref}\n variant=\"outlined\"\n interactive\n loading={loading}\n className={cx('deliverable-card overflow-hidden w-full', className)}\n style={style}\n {...props}\n >\n <div className=\"deliverable-card-cover\">\n {eyebrow && (\n <p className=\"deliverable-card-eyebrow\">{eyebrow}</p>\n )}\n {headline && (\n <p className=\"deliverable-card-title\">{headline}</p>\n )}\n {tagline && (\n <p className=\"deliverable-card-subtitle\">{tagline}</p>\n )}\n </div>\n <div className=\"deliverable-card-meta flex items-center justify-between\">\n <span>\n {sectionCount} {sectionCount === 1 ? 'section' : 'sections'}\n </span>\n {handle && <Card.Handle handle={handle}/>}\n </div>\n </Card>\n )\n },\n)\n\nDeliverableCard.displayName = 'DeliverableCard'\n","import {Artifact} from '../components'\nimport {CardSlotLoading} from '../components/Card'\n\n/**\n * Centralized policy to derive which card slots should show skeletons\n * based on the artifact's current state and pending status.\n */\nexport function deriveCardSlotLoading(a: Artifact): CardSlotLoading | undefined {\n if (!a.isPending) {\n return undefined\n }\n\n const header = {\n title: !a.title,\n subtitle: !a.subtitle,\n }\n\n const mediaNeeded = (type: string) => ['IMAGE', 'VIDEO', 'AUDIO', 'PDF'].includes(type)\n const media = mediaNeeded(a.type) && !a.url\n\n const body = (\n (a.type === 'TEXT' && !(a.inlineContent && a.inlineContent.trim().length)) ||\n (a.type === 'SCRIPT' && !(a.scriptElements && a.scriptElements.length > 0))\n )\n\n return {header, media, body}\n}\n","import React, {useEffect, useRef, useState} from 'react'\nimport {cx} from '../utils'\nimport {type ArtifactNode} from './ArtifactNode'\nimport {ArtifactCard} from './ArtifactCard'\nimport {Card} from './Card'\n\nexport interface ArtifactGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'> {\n /**\n * The GROUP node to display\n */\n node: ArtifactNode\n /**\n * Called when the group is clicked (e.g. to navigate into it)\n */\n onClick?: (node: ArtifactNode) => void\n}\n\n// Fixed offset for each layer behind the front card\nconst LAYER_OFFSET = '8px'\nconst LAYER_OFFSET_2X = '16px'\n\n/**\n * Renders a GROUP node as a Card with the group label as title. Inside,\n * the first child is shown on top with two offset layers behind it\n * (always shown as a visual symbol for \"group\"). A square count badge\n * shows the total items.\n */\nexport const ArtifactGroup = React.forwardRef<HTMLDivElement, ArtifactGroupProps>(\n ({node, onClick, className, ...props}, ref) => {\n const children = node.children\n const count = children.length\n const frontChild = children[0]\n\n // Detect count changes and trigger badge animation\n const prevCountRef = useRef(count)\n const [badgePing, setBadgePing] = useState(false)\n\n useEffect(() => {\n if (count !== prevCountRef.current) {\n prevCountRef.current = count\n setBadgePing(true)\n const timer = setTimeout(() => setBadgePing(false), 500)\n return () => clearTimeout(timer)\n }\n }, [count])\n\n const handleClick = () => {\n if (onClick) {\n onClick(node)\n }\n }\n\n const renderFrontContent = () => {\n if (!frontChild) {\n return (\n <div className=\"w-full aspect-video bg-graphite border border-ash/40 flex items-center justify-center\">\n <span className=\"text-silver text-sm\">Empty group</span>\n </div>\n )\n }\n\n if (frontChild.type === 'ARTIFACT' && frontChild.artifact) {\n return <ArtifactCard artifact={frontChild.artifact} className=\"w-full\"/>\n }\n\n // For nested groups or variant sets, show a label card\n return (\n <div\n className=\"w-full aspect-video bg-graphite border border-gold/30 flex flex-col items-center justify-center gap-2 p-4\">\n <span className=\"text-sm text-silver uppercase tracking-wider\">\n {frontChild.type === 'GROUP' ? 'Group' : 'Variants'}\n </span>\n <span className=\"text-white font-semibold\">{frontChild.label}</span>\n </div>\n )\n }\n\n return (\n <div\n ref={ref}\n className={cx(\n 'cursor-pointer group',\n className\n )}\n onClick={handleClick}\n role=\"button\"\n tabIndex={0}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n handleClick()\n }\n }}\n aria-label={`${node.label} — ${count} items`}\n {...props}\n >\n <Card noPadding className=\"p-5\">\n <h3 className=\"text-lg font-semibold text-white m-0 mb-4\">{node.label}</h3>\n {/* Outer wrapper reserves space for the offset layers */}\n <div style={{paddingRight: LAYER_OFFSET_2X, paddingBottom: LAYER_OFFSET_2X}}>\n <div className=\"relative\">\n {/* Back layer */}\n <div\n className=\"absolute inset-0 bg-charcoal border border-ash/30 pointer-events-none\"\n style={{transform: `translate(${LAYER_OFFSET_2X}, ${LAYER_OFFSET_2X})`}}\n aria-hidden=\"true\"\n />\n\n {/* Middle layer */}\n <div\n className=\"absolute inset-0 bg-charcoal border border-ash/40 pointer-events-none\"\n style={{transform: `translate(${LAYER_OFFSET}, ${LAYER_OFFSET})`}}\n aria-hidden=\"true\"\n />\n\n {/* Front card */}\n <div className=\"relative transition-transform duration-200 group-hover:-translate-y-0.5\">\n {renderFrontContent()}\n </div>\n\n {/* Count badge — square */}\n <div\n className=\"absolute -top-2 -right-2 z-10 min-w-6 h-6 px-1.5 flex items-center justify-center bg-gold text-obsidian text-xs font-bold\"\n style={badgePing ? {animation: 'badge-invert 0.6s ease-in-out'} : undefined}\n >\n {count}\n </div>\n </div>\n </div>\n </Card>\n </div>\n )\n }\n)\n\nArtifactGroup.displayName = 'ArtifactGroup'\n\nexport default ArtifactGroup\n","import React from 'react'\nimport {cx} from '../utils'\nimport {type Artifact} from './ArtifactCard'\nimport {type ArtifactNode} from './ArtifactNode'\nimport {ArtifactCard} from './ArtifactCard'\nimport {ArtifactGroup} from './ArtifactGroup'\nimport {Card} from './Card'\n\nexport interface ArtifactVariantStackProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * The VARIANT_SET node to display\n */\n node: ArtifactNode\n /**\n * Passed through to ArtifactCard children for expand/open behavior\n */\n onExpandArtifact?: (artifact: Artifact) => void\n /**\n * Passed through to ArtifactGroup children for navigation\n */\n onGroupClick?: (node: ArtifactNode) => void\n}\n\n/**\n * Renders a VARIANT_SET node as a Card with the set label as title.\n * Children are displayed in a horizontal row inside the card body.\n * Children handle their own click behavior (expand for artifacts,\n * navigate for groups).\n */\nexport const ArtifactVariantStack = React.forwardRef<HTMLDivElement, ArtifactVariantStackProps>(\n ({node, onExpandArtifact, onGroupClick, className, ...props}, ref) => {\n const children = node.children\n\n const renderChild = (child: ArtifactNode) => {\n if (child.type === 'ARTIFACT' && child.artifact) {\n return (\n <div key={child.id} className=\"flex-1 min-w-0\">\n <ArtifactCard\n artifact={child.artifact}\n onExpand={onExpandArtifact}\n className=\"w-full\"\n />\n </div>\n )\n }\n\n if (child.type === 'GROUP') {\n return (\n <div key={child.id} className=\"flex-1 min-w-0\">\n <ArtifactGroup node={child} onClick={onGroupClick}/>\n </div>\n )\n }\n\n // Nested variant set placeholder\n return (\n <div key={child.id} className=\"flex-1 min-w-0\">\n <div\n className=\"aspect-video bg-graphite border border-gold/30 flex flex-col items-center justify-center gap-2 p-4\">\n <span className=\"text-xs text-silver uppercase tracking-wider\">Variants</span>\n <span className=\"text-sm text-white font-semibold truncate max-w-full\">\n {child.label}\n </span>\n </div>\n </div>\n )\n }\n\n return (\n <Card\n ref={ref}\n noPadding\n className={cx('w-full p-5', className)}\n {...props}\n >\n <h3 className=\"text-lg font-semibold text-white m-0 mb-4\">{node.label}</h3>\n <div className=\"flex gap-3\">\n {children.map(renderChild)}\n </div>\n </Card>\n )\n }\n)\n\nArtifactVariantStack.displayName = 'ArtifactVariantStack'\n\nexport default ArtifactVariantStack\n","import React from 'react'\nimport {ARTIFACT_TYPES, type Artifact, ArtifactCard} from './ArtifactCard'\nimport {DeliverableRenderer} from './deliverable/DeliverableRenderer'\n\nexport interface ArtifactLightboxBodyProps {\n artifact: Artifact\n}\n\n/**\n * Picks the bare body for an artifact when displayed inside a {@link Lightbox}.\n *\n * Each kind decides its own internal layout — an image aspect-fits the canvas,\n * a deliverable scrolls full-bleed, and so on. Crucially, none of these wrap\n * themselves in another Card frame: the lightbox already provides the canvas,\n * and a card-inside-modal produces the nested-frame look that signals \"cheap\n * generic container.\" Kinds that don't yet have a dedicated bare body fall\n * back to {@link ArtifactCard} — adequate, but the stack-of-frames feel is the\n * thing to fix next when those kinds matter.\n *\n * Callers don't choose the body explicitly; the registry dispatches by\n * `artifact.type`. To add a kind, extend the switch — never branch on type at\n * the call site.\n */\nexport function ArtifactLightboxBody({artifact}: ArtifactLightboxBodyProps) {\n switch (artifact.type) {\n case ARTIFACT_TYPES.DELIVERABLE: {\n if (!artifact.deliverable) {\n return <ArtifactCard artifact={artifact}/>\n }\n return (\n <div className=\"w-full h-full overflow-auto\">\n <DeliverableRenderer\n deliverable={artifact.deliverable}\n hideActions\n />\n </div>\n )\n }\n\n case ARTIFACT_TYPES.IMAGE: {\n if (!artifact.url) {\n return <ArtifactCard artifact={artifact}/>\n }\n return (\n <img\n src={artifact.url}\n alt={artifact.alt ?? artifact.title ?? ''}\n className=\"max-w-full max-h-full object-contain\"\n />\n )\n }\n\n case ARTIFACT_TYPES.VIDEO: {\n if (!artifact.url) {\n return <ArtifactCard artifact={artifact}/>\n }\n return (\n <video\n src={artifact.url}\n controls\n className=\"max-w-full max-h-full object-contain bg-void\"\n />\n )\n }\n\n case ARTIFACT_TYPES.AUDIO: {\n if (!artifact.url) {\n return <ArtifactCard artifact={artifact}/>\n }\n return (\n <audio\n src={artifact.url}\n controls\n className=\"w-full max-w-2xl\"\n />\n )\n }\n\n default:\n // PDF, TEXT, SCRIPT — fall back to the panel-grid card for now. They\n // don't currently feel cheap inside a lightbox the way image and\n // deliverable did, so the bare-body work is deferred until they matter.\n return <ArtifactCard artifact={artifact}/>\n }\n}\n\n/**\n * Builds the optional caption shown bottom-centre over the lightbox backdrop.\n * Title/subtitle are repeated from the panel-grid card so the user keeps\n * orientation when the body is bare media. Returns `null` when nothing useful\n * is available — the lightbox then renders no caption row.\n */\nexport function getArtifactLightboxCaption(artifact: Artifact): React.ReactNode {\n // Deliverables surface their own cover inside the renderer; an outer caption\n // would duplicate it.\n if (artifact.type === ARTIFACT_TYPES.DELIVERABLE) {\n return null\n }\n if (!artifact.title && !artifact.subtitle) {\n return null\n }\n return (\n <div className=\"inline-flex flex-col items-center gap-1 px-4 py-2 bg-charcoal/70 backdrop-blur border border-ash/40\">\n {artifact.title && (\n <p className=\"text-xs uppercase tracking-wider text-silver\">\n {artifact.title}\n </p>\n )}\n {artifact.subtitle && (\n <p className=\"text-xs text-silver/70\">{artifact.subtitle}</p>\n )}\n </div>\n )\n}\n","import React, {useState} from 'react'\nimport {Button} from '../Button'\nimport {cx} from '../../utils'\nimport type {Deliverable, DeliverableSection, DeliverableTheme} from './types'\nimport {CoverSection} from './CoverSection'\nimport {ArtifactImageGridSection} from './ArtifactImageGridSection'\nimport {ArtifactSpotlightSection} from './ArtifactSpotlightSection'\nimport {TextBlockSection} from './TextBlockSection'\nimport {ColorPaletteSection} from './ColorPaletteSection'\nimport {QuoteBlockSection} from './QuoteBlockSection'\n\nconst THEME_CLASSES: Record<DeliverableTheme, string | null> = {\n cinematic: null,\n editorial: 'deliverable-theme-editorial',\n minimal: 'deliverable-theme-minimal',\n playful: 'deliverable-theme-playful',\n}\n\nexport interface DeliverableRendererProps {\n /** Resolved deliverable spec — every artifact reference already inflated. */\n deliverable: Deliverable\n /**\n * Called when the viewer requests a PDF download. The host application is\n * responsible for fetching and triggering the file save (the URL knows\n * about share tokens and credentials we don't). When omitted, the download\n * affordance is hidden.\n */\n onDownloadPdf?: () => void | Promise<void>\n /** Hide the floating action bar entirely. Used when rendering for print. */\n hideActions?: boolean\n className?: string\n}\n\n/**\n * Render a presentable deliverable (moodboard, pitch deck) from a structured\n * spec. The same component drives the on-screen view and the print/PDF\n * version — `@media print` styles in `aurelius/styles/base.css` keep them in\n * sync. To produce a PDF, drive the page with headless Chromium and let the\n * print stylesheet do the work.\n *\n * The renderer is purely presentational: it takes a fully resolved spec\n * (artifact URLs already inflated by the caller) and dispatches each section\n * to its typed sub-renderer. Unknown section types are skipped silently\n * forward-compat for new section variants added by the backend.\n */\nexport function DeliverableRenderer({\n deliverable,\n onDownloadPdf,\n hideActions = false,\n className,\n}: DeliverableRendererProps) {\n const [isDownloading, setIsDownloading] = useState(false)\n\n const accent = deliverable.accentColor?.trim()\n const style = accent\n ? ({'--deliverable-accent': accent} as React.CSSProperties)\n : undefined\n const theme: DeliverableTheme = deliverable.theme ?? 'cinematic'\n const themeClass = THEME_CLASSES[theme]\n\n const handleDownload = async () => {\n if (!onDownloadPdf || isDownloading) return\n setIsDownloading(true)\n try {\n await onDownloadPdf()\n } finally {\n setIsDownloading(false)\n }\n }\n\n return (\n <div\n className={cx('deliverable', themeClass, className)}\n style={style}\n >\n {deliverable.sections.map((section, idx) =>\n renderSection(section, idx, deliverable))}\n\n {!hideActions && onDownloadPdf && (\n <div className=\"deliverable-actions\">\n <Button\n variant=\"important\"\n size=\"md\"\n onClick={handleDownload}\n loading={isDownloading}\n className=\"deliverable-action-button\"\n >\n Download PDF\n </Button>\n </div>\n )}\n </div>\n )\n}\n\nfunction renderSection(\n section: DeliverableSection,\n idx: number,\n doc: Deliverable,\n): React.ReactNode {\n const key = `${section.type}-${idx}`\n switch (section.type) {\n case 'COVER':\n return (\n <CoverSection\n key={key}\n data={section}\n clientName={doc.clientName}\n />\n )\n case 'ARTIFACT_IMAGE_GRID':\n return <ArtifactImageGridSection key={key} data={section}/>\n case 'ARTIFACT_SPOTLIGHT':\n return <ArtifactSpotlightSection key={key} data={section}/>\n case 'TEXT_BLOCK':\n return <TextBlockSection key={key} data={section}/>\n case 'COLOR_PALETTE':\n return <ColorPaletteSection key={key} data={section}/>\n case 'QUOTE_BLOCK':\n return <QuoteBlockSection key={key} data={section}/>\n default:\n // Unknown section type from a newer backend — skip to stay forward-compat.\n return null\n }\n}\n","import React from 'react'\nimport type {CoverSection as CoverSectionData} from './types'\n\nexport interface CoverSectionProps {\n data: CoverSectionData\n /** Document-level client name from {@link Deliverable.clientName}, shown as \"Prepared for {name}\". */\n clientName?: string | null\n}\n\n/**\n * Title page for a deliverable. Always rendered as the first section.\n */\nexport function CoverSection({data, clientName}: CoverSectionProps) {\n return (\n <section className=\"deliverable-cover deliverable-page\">\n <div className=\"deliverable-cover-inner\">\n {data.eyebrow && (\n <>\n <p className=\"deliverable-cover-eyebrow\">{data.eyebrow}</p>\n <div className=\"deliverable-cover-rule\" aria-hidden=\"true\"/>\n </>\n )}\n <h1 className=\"deliverable-cover-title\">{data.title}</h1>\n {data.subtitle && (\n <p className=\"deliverable-cover-subtitle\">{data.subtitle}</p>\n )}\n {clientName && (\n <p className=\"deliverable-cover-client\">\n Prepared for{' '}\n <span className=\"deliverable-cover-client-name\">{clientName}</span>\n </p>\n )}\n </div>\n </section>\n )\n}\n","import React from 'react'\nimport {cx} from '../../utils'\nimport type {\n ArtifactImageGridSection as GridData,\n ImageGridAspectRatio,\n} from './types'\n\nexport interface ArtifactImageGridSectionProps {\n data: GridData\n}\n\nconst COLUMN_CLASSES: Record<1 | 2 | 3, string> = {\n 1: 'deliverable-image-grid-cols-1',\n 2: 'deliverable-image-grid-cols-2',\n 3: 'deliverable-image-grid-cols-3',\n}\n\nconst ASPECT_CLASSES: Record<ImageGridAspectRatio, string> = {\n landscape: 'deliverable-image-grid-aspect-landscape',\n portrait: 'deliverable-image-grid-aspect-portrait',\n square: 'deliverable-image-grid-aspect-square',\n wide: 'deliverable-image-grid-aspect-wide',\n}\n\n/**\n * Grid of project artifact images with optional captions. The number of\n * columns is fixed by the spec (1–3); the renderer enforces a sensible aspect\n * ratio per item and lets the browser flow rows.\n */\nexport function ArtifactImageGridSection({data}: ArtifactImageGridSectionProps) {\n const columns = clampColumns(data.columns)\n const aspect = data.aspectRatio ?? 'landscape'\n return (\n <section className=\"deliverable-page\">\n {data.heading && (\n <h2 className=\"deliverable-heading\">{data.heading}</h2>\n )}\n <div\n className={cx(\n 'deliverable-image-grid',\n COLUMN_CLASSES[columns],\n ASPECT_CLASSES[aspect],\n )}\n >\n {data.items.map((item, idx) => (\n <figure key={idx} className=\"deliverable-image-item\">\n {item.artifact.url\n ? (\n <img\n src={item.artifact.url}\n alt={item.artifact.title ?? ''}\n className=\"deliverable-image-img\"\n />\n )\n : (\n <div className=\"deliverable-image-missing\">\n Missing image\n </div>\n )}\n {item.caption && (\n <figcaption className=\"deliverable-image-caption\">\n {item.caption}\n </figcaption>\n )}\n </figure>\n ))}\n </div>\n </section>\n )\n}\n\nfunction clampColumns(n: number): 1 | 2 | 3 {\n if (n <= 1) return 1\n if (n === 2) return 2\n return 3\n}\n","import React from 'react'\nimport {MarkdownContent} from '../MarkdownContent'\nimport {cx} from '../../utils'\nimport type {\n ArtifactSpotlightSection as SpotlightData,\n SpotlightVariant,\n} from './types'\n\nexport interface ArtifactSpotlightSectionProps {\n data: SpotlightData\n}\n\nconst VARIANT_CLASSES: Record<SpotlightVariant, string | null> = {\n framed: null,\n 'full-bleed': 'deliverable-spotlight-variant-full-bleed',\n 'side-by-side': 'deliverable-spotlight-variant-side-by-side',\n}\n\n/**\n * A single hero artifact image with optional prose alongside. Reads at full\n * page width on screen and prints to a single page (or a full-bleed page for\n * the `full-bleed` variant).\n */\nexport function ArtifactSpotlightSection({data}: ArtifactSpotlightSectionProps) {\n const variant: SpotlightVariant = data.variant ?? 'framed'\n return (\n <section className={cx('deliverable-page', VARIANT_CLASSES[variant])}>\n {data.heading && (\n <h2 className=\"deliverable-heading\">{data.heading}</h2>\n )}\n <div className=\"deliverable-spotlight-media\">\n {data.artifact.url\n ? (\n <img\n src={data.artifact.url}\n alt={data.artifact.title ?? ''}\n className=\"deliverable-spotlight-img\"\n />\n )\n : (\n <div className=\"deliverable-spotlight-missing\">\n Missing image\n </div>\n )}\n </div>\n {data.body && (\n <MarkdownContent\n content={data.body}\n className=\"deliverable-spotlight-body\"\n />\n )}\n </section>\n )\n}\n","import React from 'react'\nimport {MarkdownContent} from '../MarkdownContent'\nimport type {TextBlockSection as TextData} from './types'\n\nexport interface TextBlockSectionProps {\n data: TextData\n}\n\n/**\n * Prose section. Body is rendered as Markdown.\n */\nexport function TextBlockSection({data}: TextBlockSectionProps) {\n return (\n <section className=\"deliverable-page\">\n {data.heading && (\n <h2 className=\"deliverable-heading\">{data.heading}</h2>\n )}\n <MarkdownContent\n content={data.body}\n className=\"deliverable-text-block\"\n />\n </section>\n )\n}\n","import React from 'react'\nimport type {ColorPaletteSection as PaletteData} from './types'\n\nexport interface ColorPaletteSectionProps {\n data: PaletteData\n}\n\n/**\n * Color palette presented as labelled swatches with hex values.\n */\nexport function ColorPaletteSection({data}: ColorPaletteSectionProps) {\n return (\n <section className=\"deliverable-page\">\n {data.heading && (\n <h2 className=\"deliverable-heading\">{data.heading}</h2>\n )}\n <div className=\"deliverable-palette\">\n {data.swatches.map((swatch, idx) => (\n <div key={idx} className=\"deliverable-palette-item\">\n <div\n className=\"deliverable-palette-chip\"\n style={{backgroundColor: swatch.color}}\n aria-label={swatch.label}\n />\n <p className=\"deliverable-palette-label\">{swatch.label}</p>\n <p className=\"deliverable-palette-hex\">{swatch.color.toUpperCase()}</p>\n </div>\n ))}\n </div>\n </section>\n )\n}\n","import React from 'react'\nimport type {QuoteBlockSection as QuoteData} from './types'\n\nexport interface QuoteBlockSectionProps {\n data: QuoteData\n}\n\n/**\n * Pulled quote with optional attribution. The renderer adds the surrounding\n * quotation marks.\n */\nexport function QuoteBlockSection({data}: QuoteBlockSectionProps) {\n return (\n <section className=\"deliverable-page deliverable-quote\">\n <blockquote className=\"deliverable-quote-body\">\n <p className=\"deliverable-quote-text\">“{data.quote}”</p>\n {data.attribution && (\n <footer className=\"deliverable-quote-attribution\">\n — {data.attribution}\n </footer>\n )}\n </blockquote>\n </section>\n )\n}\n","import {useCallback, useEffect, useRef, useState} from 'react'\n\ninterface UseResizableProps {\n /**\n * Initial width as percentage of viewport (0-100)\n */\n initialWidthPercent: number\n /**\n * Minimum width as percentage of viewport (0-100)\n */\n minWidthPercent: number\n /**\n * Maximum width as percentage of viewport (0-100)\n */\n maxWidthPercent: number\n /**\n * Direction to resize from\n */\n direction: 'left' | 'right'\n}\n\n/**\n * Hook for resizable panels with percentage-based widths.\n * Returns width as a CSS percentage string (e.g., \"50%\").\n */\nexport function useResizable({\n initialWidthPercent,\n minWidthPercent,\n maxWidthPercent,\n direction,\n}: UseResizableProps) {\n const [widthPercent, setWidthPercent] = useState(initialWidthPercent)\n const [isResizing, setIsResizing] = useState(false)\n const lastX = useRef<number | null>(null)\n\n const startResizing = useCallback((e: React.MouseEvent) => {\n e.preventDefault()\n setIsResizing(true)\n lastX.current = e.clientX\n }, [])\n\n const stopResizing = useCallback(() => {\n setIsResizing(false)\n lastX.current = null\n }, [])\n\n const resize = useCallback(\n (e: MouseEvent) => {\n if (!isResizing || lastX.current === null) {\n return\n }\n\n const deltaX = e.clientX - lastX.current\n const factor = direction === 'right' ? 1 : -1\n // Convert pixel delta to percentage of viewport\n const deltaPercent = (deltaX / window.innerWidth) * 100\n\n setWidthPercent((prevPercent) => {\n const newPercent = prevPercent + deltaPercent * factor\n return Math.min(Math.max(newPercent, minWidthPercent), maxWidthPercent)\n })\n\n lastX.current = e.clientX\n },\n [isResizing, direction, minWidthPercent, maxWidthPercent]\n )\n\n useEffect(() => {\n if (isResizing) {\n window.addEventListener('mousemove', resize)\n window.addEventListener('mouseup', stopResizing)\n document.body.style.cursor = 'col-resize'\n document.body.style.userSelect = 'none'\n } else {\n window.removeEventListener('mousemove', resize)\n window.removeEventListener('mouseup', stopResizing)\n document.body.style.cursor = ''\n document.body.style.userSelect = ''\n }\n\n return () => {\n window.removeEventListener('mousemove', resize)\n window.removeEventListener('mouseup', stopResizing)\n document.body.style.cursor = ''\n document.body.style.userSelect = ''\n }\n }, [isResizing, resize, stopResizing])\n\n // Return width as CSS percentage string\n const width = `${widthPercent}vw`\n\n return {width, widthPercent, isResizing, startResizing}\n}\n","import {useCallback, useMemo, useState} from 'react'\nimport type {ArtifactNode} from '../../ArtifactNode'\n\n/**\n * A breadcrumb entry representing one level of navigation depth.\n */\nexport interface BreadcrumbEntry {\n /** Display label for this level */\n label: string\n /** The group node at this level (null for root) */\n node: ArtifactNode | null\n}\n\n/**\n * Return type for the useArtifactTreeNavigation hook.\n */\nexport interface UseArtifactTreeNavigationReturn {\n /** Nodes to display at the current navigation level */\n currentNodes: ArtifactNode[]\n /** Breadcrumb trail from root to current level */\n breadcrumbs: BreadcrumbEntry[]\n /** Whether the user is at the root level */\n isAtRoot: boolean\n /** Navigate into a group node, pushing it onto the stack */\n navigateInto: (node: ArtifactNode) => void\n /** Navigate to a specific breadcrumb level by index */\n navigateTo: (index: number) => void\n /** Navigate back one level */\n navigateBack: () => void\n}\n\n/**\n * Manages navigation state for an artifact tree panel.\n * Maintains a stack of group nodes the user has navigated into,\n * deriving children from the node references themselves.\n */\nexport function useArtifactTreeNavigation(rootNodes: ArtifactNode[]): UseArtifactTreeNavigationReturn {\n // Stack of group nodes the user has drilled into (empty = at root)\n const [stack, setStack] = useState<ArtifactNode[]>([])\n\n const currentNodes = useMemo(() => {\n if (stack.length === 0) return rootNodes\n return stack[stack.length - 1].children\n }, [rootNodes, stack])\n\n const breadcrumbs = useMemo<BreadcrumbEntry[]>(() => {\n const entries: BreadcrumbEntry[] = [{label: 'Project', node: null}]\n for (const node of stack) {\n entries.push({label: node.label, node})\n }\n return entries\n }, [stack])\n\n const isAtRoot = stack.length === 0\n\n const navigateInto = useCallback((node: ArtifactNode) => {\n setStack(prev => [...prev, node])\n }, [])\n\n const navigateTo = useCallback((index: number) => {\n // index 0 = root, so slice to 0 clears the stack\n setStack(prev => prev.slice(0, index))\n }, [])\n\n const navigateBack = useCallback(() => {\n setStack(prev => prev.slice(0, -1))\n }, [])\n\n return {\n currentNodes,\n breadcrumbs,\n isAtRoot,\n navigateInto,\n navigateTo,\n navigateBack,\n }\n}\n","import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'\nimport {ChevronDown, Pencil} from 'lucide-react'\nimport {cx, useClickOutside} from '../../utils'\nimport {PlusIcon} from '../icons'\nimport type {Conversation} from './ChatInterface'\n\nexport interface HistoryPanelProps {\n /**\n * List of past conversations to display.\n */\n conversations: Conversation[]\n /**\n * Called when a conversation is selected.\n */\n onSelectConversation?: (id: string) => void\n /**\n * Called when the \"New Chat\" button is clicked.\n */\n onNewChat?: () => void\n /**\n * Called when a conversation's title is edited.\n */\n onRenameConversation?: (id: string, newTitle: string) => void\n}\n\ntype ConversationGroup = {\n key: 'today' | 'yesterday' | 'older'\n label: string\n conversations: Conversation[]\n}\n\nfunction parseTimestamp(ts: Conversation['timestamp']): Date | null {\n if (ts == null) {\n return null\n }\n const d = ts instanceof Date ? ts : new Date(ts)\n return Number.isNaN(d.getTime()) ? null : d\n}\n\nfunction startOfDay(d: Date): Date {\n const x = new Date(d)\n x.setHours(0, 0, 0, 0)\n return x\n}\n\nfunction groupConversations(conversations: Conversation[]): ConversationGroup[] {\n const today = startOfDay(new Date())\n const yesterday = new Date(today)\n yesterday.setDate(yesterday.getDate() - 1)\n\n const todayList: Conversation[] = []\n const yesterdayList: Conversation[] = []\n const olderList: Conversation[] = []\n\n for (const c of conversations) {\n const d = parseTimestamp(c.timestamp)\n if (d && d >= today) {\n todayList.push(c)\n } else if (d && d >= yesterday) {\n yesterdayList.push(c)\n } else {\n olderList.push(c)\n }\n }\n\n return [\n {key: 'today', label: 'Today', conversations: todayList},\n {key: 'yesterday', label: 'Yesterday', conversations: yesterdayList},\n {key: 'older', label: 'Older', conversations: olderList},\n ].filter((g) => g.conversations.length > 0) as ConversationGroup[]\n}\n\nfunction ProjectFilter({\n projects,\n value,\n onChange,\n className,\n}: {\n projects: string[]\n value: string | null\n onChange: (project: string | null) => void\n className?: string\n}) {\n const [open, setOpen] = useState(false)\n const ref = useRef<HTMLDivElement>(null)\n const closeFilter = useCallback(() => setOpen(false), [])\n\n useClickOutside(ref, closeFilter, open)\n\n const label = value ?? 'All projects'\n\n return (\n <div className={cx('relative min-w-0', className)} ref={ref}>\n <button\n type=\"button\"\n onClick={() => setOpen((o) => !o)}\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n className={cx(\n 'w-full flex items-center justify-between gap-1 px-2 py-1.5',\n 'bg-obsidian/60 hover:bg-ash/30',\n 'text-silver hover:text-white',\n 'border border-ash/40',\n 'text-xs',\n 'transition-colors duration-150 min-w-0'\n )}\n >\n <span className=\"truncate\">{label}</span>\n <ChevronDown className=\"w-3 h-3 shrink-0\" aria-hidden/>\n </button>\n {open && (\n <div\n role=\"listbox\"\n className={cx(\n 'absolute top-full left-0 right-0 mt-1 z-20',\n 'bg-charcoal border border-ash/40',\n 'max-h-60 overflow-y-auto'\n )}\n >\n <button\n type=\"button\"\n role=\"option\"\n aria-selected={value === null}\n onClick={() => {\n onChange(null)\n setOpen(false)\n }}\n className={cx(\n 'w-full px-2 py-1.5 text-left text-xs truncate',\n 'transition-colors duration-150',\n value === null\n ? 'bg-gold/10 text-gold'\n : 'text-silver hover:bg-ash/20 hover:text-white'\n )}\n >\n All projects\n </button>\n {projects.map((p) => (\n <button\n key={p}\n type=\"button\"\n role=\"option\"\n aria-selected={value === p}\n onClick={() => {\n onChange(p)\n setOpen(false)\n }}\n className={cx(\n 'w-full px-2 py-1.5 text-left text-xs truncate',\n 'transition-colors duration-150',\n value === p\n ? 'bg-gold/10 text-gold'\n : 'text-silver hover:bg-ash/20 hover:text-white'\n )}\n >\n {p}\n </button>\n ))}\n </div>\n )}\n </div>\n )\n}\n\nfunction ConversationRow({\n conversation,\n onSelect,\n onRename,\n}: {\n conversation: Conversation\n onSelect?: (id: string) => void\n onRename?: (id: string, newTitle: string) => void\n}) {\n const [isEditing, setIsEditing] = useState(false)\n const [draft, setDraft] = useState(conversation.title)\n const inputRef = useRef<HTMLInputElement>(null)\n\n useEffect(() => {\n if (isEditing && inputRef.current) {\n inputRef.current.focus()\n inputRef.current.select()\n }\n }, [isEditing])\n\n const startEdit = useCallback((e: React.MouseEvent) => {\n e.stopPropagation()\n setDraft(conversation.title)\n setIsEditing(true)\n }, [conversation.title])\n\n const commit = useCallback(() => {\n const trimmed = draft.trim()\n if (trimmed && trimmed !== conversation.title) {\n onRename?.(conversation.id, trimmed)\n }\n setIsEditing(false)\n }, [draft, conversation.id, conversation.title, onRename])\n\n const cancel = useCallback(() => {\n setDraft(conversation.title)\n setIsEditing(false)\n }, [conversation.title])\n\n if (isEditing) {\n return (\n <div\n className={cx(\n 'w-full px-3 py-2',\n conversation.isActive ? 'bg-ash/40' : 'bg-ash/20'\n )}\n >\n <input\n ref={inputRef}\n type=\"text\"\n value={draft}\n onChange={(e) => setDraft(e.target.value)}\n onBlur={commit}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault()\n commit()\n } else if (e.key === 'Escape') {\n e.preventDefault()\n cancel()\n }\n }}\n className={cx(\n 'w-full px-2 py-1 text-sm font-medium text-white',\n 'bg-obsidian border border-gold/40',\n 'outline-none focus:border-gold'\n )}\n aria-label=\"Conversation title\"\n />\n {conversation.project && (\n <p className=\"text-xs text-silver/60 truncate mt-1\">\n {conversation.project}\n </p>\n )}\n </div>\n )\n }\n\n return (\n <div className=\"relative group\">\n <button\n onClick={() => onSelect?.(conversation.id)}\n className={cx(\n 'w-full px-3 py-2 text-left',\n 'transition-colors duration-150',\n conversation.isActive\n ? 'bg-ash/40 text-white'\n : 'text-silver hover:bg-ash/20 hover:text-white'\n )}\n >\n <p\n className={cx(\n 'text-sm font-medium truncate',\n onRename ? 'pr-6' : ''\n )}\n >\n {conversation.title}\n </p>\n {conversation.project && (\n <p className=\"text-xs text-silver/60 truncate mt-0.5\">\n {conversation.project}\n </p>\n )}\n </button>\n {onRename && (\n <button\n type=\"button\"\n onClick={startEdit}\n aria-label=\"Rename conversation\"\n className={cx(\n 'absolute right-2 top-2',\n 'p-1 text-silver/60 hover:text-gold hover:bg-ash/40',\n 'opacity-0 group-hover:opacity-100 focus:opacity-100',\n 'transition-opacity duration-150'\n )}\n >\n <Pencil className=\"w-3.5 h-3.5\" aria-hidden/>\n </button>\n )}\n </div>\n )\n}\n\n/**\n * HistoryPanel renders the conversation history sidebar: a project filter,\n * a \"New Chat\" button, and the conversation list grouped by recency\n * (Today / Yesterday / Older). Each row shows the title and an optional\n * project subtitle, and exposes an inline rename affordance on hover.\n */\nexport function HistoryPanel({\n conversations,\n onSelectConversation,\n onNewChat,\n onRenameConversation,\n}: HistoryPanelProps) {\n const [projectFilter, setProjectFilter] = useState<string | null>(null)\n\n const projects = useMemo(() => {\n const set = new Set<string>()\n for (const c of conversations) {\n if (c.project) {\n set.add(c.project)\n }\n }\n return Array.from(set).sort((a, b) => a.localeCompare(b))\n }, [conversations])\n\n useEffect(() => {\n if (projectFilter && !projects.includes(projectFilter)) {\n setProjectFilter(null)\n }\n }, [projects, projectFilter])\n\n const filteredConversations = useMemo(() => {\n if (!projectFilter) {\n return conversations\n }\n return conversations.filter((c) => c.project === projectFilter)\n }, [conversations, projectFilter])\n\n const groups = useMemo(\n () => groupConversations(filteredConversations),\n [filteredConversations]\n )\n\n const hasFilter = projects.length > 0\n\n return (\n <div className=\"h-full flex flex-col\">\n <div className=\"px-4 py-3 border-b border-ash/40 shrink-0 flex items-center gap-2\">\n <h3 className=\"text-xs font-medium text-white shrink-0\">History</h3>\n {(hasFilter || onNewChat) && (\n <div className=\"flex items-center gap-2 flex-1 min-w-0\">\n {hasFilter && (\n <>\n <div className=\"w-px h-3 bg-ash/40 shrink-0 mx-1\"/>\n <ProjectFilter\n projects={projects}\n value={projectFilter}\n onChange={setProjectFilter}\n className=\"flex-1\"\n />\n </>\n )}\n {onNewChat && (\n <>\n <div className=\"w-px h-3 bg-ash/40 shrink-0 mx-1\"/>\n <button\n onClick={onNewChat}\n className={cx(\n 'flex items-center gap-1 px-2.5 py-1.5 shrink-0',\n 'bg-gold/10 hover:bg-gold/20 text-gold',\n 'border border-gold/30',\n 'text-xs font-medium',\n 'transition-colors duration-200'\n )}\n >\n <PlusIcon className=\"w-4 h-4\"/>\n <span className=\"truncate\">New Chat</span>\n </button>\n </>\n )}\n </div>\n )}\n </div>\n <div className=\"flex-1 overflow-y-auto py-2\">\n {conversations.length === 0 ? (\n <p className=\"px-4 py-2 text-xs text-silver/60\">No conversations yet</p>\n ) : groups.length === 0 ? (\n <p className=\"px-4 py-2 text-xs text-silver/60\">No conversations match this filter</p>\n ) : (\n <div>\n {groups.map((group, index) => (\n <section key={group.key} className={cx(index > 0 && 'mt-3')}>\n <div className=\"flex items-center gap-2 px-3 pb-2\">\n <span\n className=\"text-xs font-medium uppercase tracking-wider text-gold/70\">\n {group.label}\n </span>\n <div className=\"flex-1 h-px bg-gold/20\"/>\n </div>\n <div className=\"space-y-1 px-2\">\n {group.conversations.map((conversation) => (\n <ConversationRow\n key={conversation.id}\n conversation={conversation}\n onSelect={onSelectConversation}\n onRename={onRenameConversation}\n />\n ))}\n </div>\n </section>\n ))}\n </div>\n )}\n </div>\n </div>\n )\n}\n","import React, {useCallback, useMemo, useState} from 'react'\nimport {Loader2, Square} from 'lucide-react'\nimport {cx} from '../../utils'\nimport {CheckSquareIcon, CrossSquareIcon, EmptySquareIcon, SquareLoaderIcon,} from '../icons'\n\nexport const TASK_STATUSES = {\n PENDING: 'pending',\n IN_PROGRESS: 'in_progress',\n DONE: 'done',\n CANCELLED: 'cancelled',\n FAILED: 'failed',\n} as const\n\nexport type TaskStatus = typeof TASK_STATUSES[keyof typeof TASK_STATUSES]\n\nexport interface Task {\n /**\n * Unique identifier for the task\n */\n id: string\n /**\n * Task description text\n */\n label: string\n /**\n * Current status of the task\n */\n status: TaskStatus\n /**\n * Optional subtasks (shown when parent is in_progress or done)\n */\n subtasks?: Task[]\n}\n\nexport interface TodosListProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Array of tasks to display\n */\n tasks: Task[]\n /**\n * Title for the todos list\n * @default \"Tasks\"\n */\n title?: string\n /**\n * Called when the \"Stop All Tasks\" button is clicked.\n * Only shown when at least one task is in_progress.\n * The consumer decides what stopping means (cancel API calls, mark cancelled, etc.).\n *\n * May return a Promise. While the Promise is pending, the button becomes\n * disabled and displays a spinner with \"Stopping tasks\" to give the user\n * feedback that the stop request is in flight.\n */\n onStopAllTasks?: () => void | Promise<void>\n}\n\n/**\n * Get the status icon for a task\n */\nfunction TaskIcon({status}: { status: TaskStatus }) {\n switch (status) {\n case 'done':\n return <CheckSquareIcon/>\n case 'in_progress':\n return <SquareLoaderIcon/>\n case 'cancelled':\n return <CrossSquareIcon variant=\"cancelled\"/>\n case 'failed':\n return <CrossSquareIcon variant=\"failed\"/>\n case 'pending':\n default:\n return <EmptySquareIcon/>\n }\n}\n\n/**\n * Sort tasks so cancelled and failed items appear at the bottom of their group.\n * This sorts in place within the local group, not globally.\n */\nfunction sortTasks(tasks: Task[]): Task[] {\n const normal: Task[] = []\n const bottomItems: Task[] = []\n\n for (const task of tasks) {\n if (task.status === 'cancelled' || task.status === 'failed') {\n bottomItems.push(task)\n } else {\n normal.push(task)\n }\n }\n\n return [...normal, ...bottomItems]\n}\n\n/**\n * Single task item component\n */\nfunction TaskItem({task, depth = 0}: { task: Task; depth?: number }) {\n const isTerminal = task.status === 'done' || task.status === 'cancelled' || task.status\n === 'failed'\n const isSubtle = task.status === 'cancelled' || task.status === 'failed'\n\n // Always show subtasks if they exist\n const showSubtasks = task.subtasks && task.subtasks.length > 0\n const sortedSubtasks = showSubtasks ? sortTasks(task.subtasks!) : []\n\n return (\n <div className=\"flex flex-col\">\n <div\n className=\"flex items-center gap-2 py-1\"\n style={{paddingLeft: `${depth * 1.5}rem`}}\n >\n <TaskIcon status={task.status}/>\n <span\n className={cx(\n 'text-xs leading-tight transition-colors',\n isTerminal && 'line-through',\n isSubtle ? 'text-silver/50' : 'text-silver',\n task.status === 'in_progress' && 'text-white',\n task.status === 'done' && 'text-silver/70'\n )}\n >\n {task.label}\n {task.status === 'cancelled' && (\n <span className=\"text-silver/40 ml-1\">(cancelled)</span>\n )}\n {task.status === 'failed' && (\n <span className=\"text-error/60 ml-1\">(failed)</span>\n )}\n </span>\n </div>\n\n {/* Render subtasks if they exist */}\n {showSubtasks && (\n <div className=\"flex flex-col\">\n {sortedSubtasks.map((subtask) => (\n <TaskItem key={subtask.id} task={subtask} depth={depth + 1}/>\n ))}\n </div>\n )}\n </div>\n )\n}\n\n/**\n * TodosList displays a structured list of tasks with status indicators.\n *\n * Features:\n * - Nested tasks with indentation\n * - Status indicators: done (checkmark), in_progress (snake animation), pending (empty),\n * cancelled, failed\n * - Done tasks are crossed out with golden checkmark\n * - Cancelled/failed tasks are crossed out with subtle styling and sorted to bottom of their local\n * group\n * - Max 1/4 screen height with scroll\n * - Subtasks appear when parent task is in_progress or done\n *\n * The component automatically sorts cancelled/failed tasks to the bottom of their local group\n * (not globally), so just changing a task's status will reorder it appropriately.\n */\n/**\n * Returns true when any task (or subtask, recursively) has in_progress status.\n */\nfunction hasInProgressTask(tasks: Task[]): boolean {\n return tasks.some(t => {\n if (t.status === 'in_progress') {\n return true\n }\n if (t.subtasks && t.subtasks.length > 0) {\n return hasInProgressTask(t.subtasks)\n }\n return false\n })\n}\n\nexport const TodosList = React.forwardRef<HTMLDivElement, TodosListProps>(\n ({tasks, title = 'Tasks', onStopAllTasks, className, ...rest}, ref) => {\n const sortedTasks = useMemo(() => sortTasks(tasks), [tasks])\n const [isStopping, setIsStopping] = useState(false)\n\n const handleStopClick = useCallback(async () => {\n if (!onStopAllTasks || isStopping) {\n return\n }\n try {\n setIsStopping(true)\n await onStopAllTasks()\n } finally {\n setIsStopping(false)\n }\n }, [onStopAllTasks, isStopping])\n\n // Count completed top-level tasks\n const countCompleted = (taskList: Task[]): number => {\n return taskList.filter(task => task.status === 'done').length\n }\n\n const countTotal = (taskList: Task[]): number => {\n return taskList.length\n }\n\n // Keep the button mounted while a stop is in flight, even if tasks have\n // already flipped out of in_progress synchronously.\n const showStopButton = !!onStopAllTasks && (hasInProgressTask(tasks) || isStopping)\n\n if (tasks.length === 0) {\n return null\n }\n\n return (\n <div\n ref={ref}\n className={cx(\n 'flex flex-col h-full',\n 'overflow-hidden',\n className\n )}\n {...rest}\n >\n {/* Header */}\n <div\n className=\"flex items-center justify-between px-4 py-2 border-b border-ash/40 flex-shrink-0\">\n <h4 className=\"text-xs font-medium text-white\">{title}</h4>\n <span className=\"text-xs text-silver/60\">\n {countCompleted(tasks)}/{countTotal(tasks)}\n </span>\n </div>\n\n {/* Tasks list */}\n <div className=\"flex-1 overflow-y-auto px-4 py-2\">\n {sortedTasks.map((task) => (\n <TaskItem key={task.id} task={task}/>\n ))}\n </div>\n\n {/* Stop All Tasks button */}\n {showStopButton && (\n <div className=\"px-4 py-2 border-t border-ash/40 flex-shrink-0\">\n <button\n type=\"button\"\n onClick={handleStopClick}\n disabled={isStopping}\n aria-busy={isStopping}\n aria-label={isStopping ? 'Stopping tasks' : 'Stop all tasks'}\n className={cx(\n 'w-full flex items-center justify-center gap-2 px-3 py-1.5',\n 'bg-error/10 text-error',\n 'border border-error/30',\n 'text-xs font-medium',\n 'transition-colors duration-200',\n isStopping\n ? 'cursor-not-allowed opacity-70'\n : 'hover:bg-error/20'\n )}\n >\n {isStopping ? (\n <>\n <Loader2 className=\"w-3 h-3 animate-spin\"/>\n Stopping tasks\n </>\n ) : (\n <>\n <Square className=\"w-3 h-3 fill-current\"/>\n Stop All Tasks\n </>\n )}\n </button>\n </div>\n )}\n </div>\n )\n }\n)\n\nTodosList.displayName = 'TodosList'\n\n/**\n * Returns true when every task (and subtask, recursively) is in a\n * terminal state: done, cancelled, or failed. Returns true for empty arrays.\n */\nexport function areAllTasksSettled(tasks: Task[]): boolean {\n return tasks.every(t => {\n const settled = t.status === 'done' || t.status === 'cancelled' || t.status === 'failed'\n if (!settled) {\n return false\n }\n if (t.subtasks && t.subtasks.length > 0) {\n return areAllTasksSettled(t.subtasks)\n }\n return true\n })\n}\n\nexport default TodosList\n","import React from 'react'\nimport {cx} from '../../utils'\n\n/**\n * Position group for a tool — combines vertical position (top/bottom)\n * with sidebar side (left/right).\n */\nexport type ToolGroup = 'top-left' | 'bottom-left' | 'top-right' | 'bottom-right'\n\n/**\n * Describes a tool that can be toggled from the sidebar.\n */\nexport interface ToolDefinition {\n /**\n * Unique identifier for this tool\n */\n id: string\n /**\n * Icon element shown in the sidebar button\n */\n icon: React.ReactNode\n /**\n * Accessible label for the button\n */\n label: string\n /**\n * Which group the tool belongs to — tools in the same group\n * are mutually exclusive (opening one closes the other).\n */\n group: ToolGroup\n}\n\n/**\n * Consumer-provided tool definition passed via ChatInterface's `tools` prop.\n * Adds the panel content to render when the tool is opened.\n */\nexport interface ExternalToolDefinition extends ToolDefinition {\n /**\n * Content to render when the tool is open\n */\n content: React.ReactNode\n}\n\n/**\n * Tracks which tool is open in each group (null = none).\n */\nexport interface ToolPanelState {\n 'top-left': string | null\n 'bottom-left': string | null\n 'top-right': string | null\n 'bottom-right': string | null\n}\n\nexport interface ToolSidebarProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Available tool definitions\n */\n tools: ToolDefinition[]\n /**\n * Current state — which tool is open per group\n */\n activeTools: ToolPanelState\n /**\n * Called when a tool button is clicked (toggle)\n */\n onToggleTool: (toolId: string) => void\n /**\n * Which side this sidebar is on — controls border direction\n */\n side: 'left' | 'right'\n}\n\n/**\n * ToolSidebar renders a vertical strip of tool icon buttons on either\n * side of the chat interface. It follows the IntelliJ pattern:\n *\n * - Top-aligned group and bottom-aligned group separated by a divider\n * - Tools in the same group are mutually exclusive\n * - Clicking an active tool closes it; clicking an inactive tool opens it\n * - Constant slim width regardless of tool panel state\n * - Can be placed on left or right side via the `side` prop\n */\nexport const ToolSidebar = React.forwardRef<HTMLDivElement, ToolSidebarProps>(\n ({tools, activeTools, onToggleTool, side, className, ...rest}, ref) => {\n const topTools = tools.filter(t => t.group === `top-${side}`)\n const bottomTools = tools.filter(t => t.group === `bottom-${side}`)\n\n const isActive = (toolId: string) => {\n const tool = tools.find(t => t.id === toolId)\n if (!tool) return false\n return activeTools[tool.group] === toolId\n }\n\n const renderButton = (tool: ToolDefinition) => {\n const active = isActive(tool.id)\n return (\n <button\n key={tool.id}\n onClick={() => onToggleTool(tool.id)}\n className={cx(\n 'w-8 h-8 flex items-center justify-center transition-colors duration-150',\n active\n ? 'bg-gold/15 text-gold border border-gold/30'\n : 'text-silver hover:text-white hover:bg-ash/20'\n )}\n aria-label={tool.label}\n aria-pressed={active}\n >\n <span className=\"w-4 h-4 block\">\n {tool.icon}\n </span>\n </button>\n )\n }\n\n return (\n <div\n ref={ref}\n className={cx(\n 'h-full w-9 bg-charcoal/80 flex flex-col items-center shrink-0 py-2',\n side === 'left' ? 'border-r border-ash/40' : 'border-l border-ash/40',\n className\n )}\n {...rest}\n >\n {/* Top-aligned tools */}\n <div className=\"flex flex-col items-center gap-1\">\n {topTools.map(renderButton)}\n </div>\n\n {/* Spacer + separator */}\n <div className=\"flex-1 flex items-center justify-center\">\n <div className=\"w-5 border-t border-ash/30\"/>\n </div>\n\n {/* Bottom-aligned tools */}\n <div className=\"flex flex-col items-center gap-1\">\n {bottomTools.map(renderButton)}\n </div>\n </div>\n )\n }\n)\n\nToolSidebar.displayName = 'ToolSidebar'\n","import React, {useCallback, useEffect, useRef, useState} from 'react'\nimport {composeRefs, cx} from '../../utils'\n\nexport interface ToolPanelContainerProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Content for the top tool slot (from the top group).\n * When null, the bottom slot takes full height.\n */\n topContent: React.ReactNode | null\n /**\n * Content for the bottom tool slot (from the bottom group).\n * When null, the top slot takes full height.\n */\n bottomContent: React.ReactNode | null\n /**\n * Panel width as CSS value (e.g., \"50vw\")\n */\n width?: string\n /**\n * Default top panel height percentage (0-100).\n * @default 60\n */\n initialTopPercent?: number\n /**\n * Callback to start horizontal resizing (width dragger)\n */\n onResizeStart?: (e: React.MouseEvent) => void\n /**\n * Which side this panel is on — controls border and resize handle position\n */\n side?: 'left' | 'right'\n}\n\n/**\n * ToolPanelContainer manages the layout of one or two tool panels\n * stacked vertically. When both top and bottom slots are filled, a\n * height-adjustable divider appears between them.\n *\n * It also renders the width-resize handle on its left edge, identical\n * to the previous ArtifactsPanel resize behavior.\n */\nexport const ToolPanelContainer = React.forwardRef<HTMLDivElement, ToolPanelContainerProps>(\n ({\n topContent,\n bottomContent,\n width,\n onResizeStart,\n side = 'right',\n className,\n initialTopPercent = 60,\n ...rest\n },\n ref) => {\n const [topPercent, setTopPercent] = useState(initialTopPercent)\n const [isResizingHeight, setIsResizingHeight] = useState(false)\n const containerRef = useRef<HTMLDivElement>(null)\n const lastY = useRef<number | null>(null)\n\n const hasBoth = topContent !== null && bottomContent !== null\n\n // Height dragger handlers\n const startHeightResize = useCallback((e: React.MouseEvent) => {\n e.preventDefault()\n setIsResizingHeight(true)\n lastY.current = e.clientY\n }, [])\n\n const stopHeightResize = useCallback(() => {\n setIsResizingHeight(false)\n lastY.current = null\n }, [])\n\n const resizeHeight = useCallback(\n (e: MouseEvent) => {\n if (!isResizingHeight || lastY.current === null || !containerRef.current) {\n return\n }\n\n const containerHeight = containerRef.current.getBoundingClientRect().height\n if (containerHeight === 0) {\n return\n }\n\n const deltaY = e.clientY - lastY.current\n const deltaPercent = (deltaY / containerHeight) * 100\n\n setTopPercent(prev => {\n const next = prev + deltaPercent\n return Math.min(Math.max(next, 20), 80)\n })\n\n lastY.current = e.clientY\n },\n [isResizingHeight]\n )\n\n useEffect(() => {\n if (isResizingHeight) {\n window.addEventListener('mousemove', resizeHeight)\n window.addEventListener('mouseup', stopHeightResize)\n document.body.style.cursor = 'row-resize'\n document.body.style.userSelect = 'none'\n } else {\n window.removeEventListener('mousemove', resizeHeight)\n window.removeEventListener('mouseup', stopHeightResize)\n document.body.style.cursor = ''\n document.body.style.userSelect = ''\n }\n\n return () => {\n window.removeEventListener('mousemove', resizeHeight)\n window.removeEventListener('mouseup', stopHeightResize)\n document.body.style.cursor = ''\n document.body.style.userSelect = ''\n }\n }, [isResizingHeight, resizeHeight, stopHeightResize])\n\n return (\n <div\n ref={composeRefs(containerRef, ref)}\n className={cx(\n 'h-full bg-charcoal/50 flex flex-col relative shrink-0',\n side === 'left' ? 'border-r border-ash/40' : 'border-l border-ash/40',\n className\n )}\n style={width ? {width} : undefined}\n {...rest}\n >\n {/* Width resize handle */}\n <div\n onMouseDown={onResizeStart}\n className={cx(\n 'absolute top-0 w-1 h-full cursor-col-resize z-30',\n 'hover:bg-gold/50 transition-colors',\n side === 'left'\n ? 'right-0 after:absolute after:inset-y-0 after:-right-1 after:w-2'\n : 'left-0 after:absolute after:inset-y-0 after:-left-1 after:w-2'\n )}\n />\n\n {/* Top slot */}\n {topContent !== null && (\n <div\n className=\"min-h-0 overflow-hidden flex flex-col\"\n style={hasBoth ? {height: `${topPercent}%`} : {flex: '1 1 0%'}}\n >\n {topContent}\n </div>\n )}\n\n {/* Height dragger — only when both slots are filled */}\n {hasBoth && (\n <div\n onMouseDown={startHeightResize}\n className={cx(\n 'h-1 cursor-row-resize z-30 shrink-0',\n 'bg-ash/40 hover:bg-gold/50 transition-colors',\n 'relative',\n 'after:absolute after:-top-1 after:left-0 after:right-0 after:h-3'\n )}\n />\n )}\n\n {/* Bottom slot */}\n {bottomContent !== null && (\n <div\n className=\"min-h-0 overflow-hidden flex flex-col\"\n style={hasBoth ? {height: `${100 - topPercent}%`} : {flex: '1 1 0%'}}\n >\n {bottomContent}\n </div>\n )}\n </div>\n )\n }\n)\n\nToolPanelContainer.displayName = 'ToolPanelContainer'\n","/**\n * Conversation tree algorithms.\n *\n * Every function here operates on `NodeTopology` only — the tree never branches\n * on a node's `kind`. Domain questions (\"where's the nearest checkpoint?\",\n * \"which message did I edit?\") become predicates passed to `findAncestor`.\n *\n * The tree is the single source of truth for navigation. `activeLeafId` is the\n * leaf the user is viewing; `lastLeafId` is the deepest leaf they reached on\n * the previously-active path. The greyed-future region is derived from the\n * pair, not stored.\n */\n\nimport {ReactNode} from 'react'\nimport type {\n ChatNode,\n ConversationTree,\n MessageNode,\n NodeTopology,\n TreeNode,\n} from './types'\n\n// ───────────────────────────────────────────────────────────────\n// Construction\n// ───────────────────────────────────────────────────────────────\n\nexport function createEmptyTree<T extends NodeTopology = ChatNode>(): ConversationTree<T> {\n return {nodes: {}, rootIds: [], activeLeafId: null, lastLeafId: null}\n}\n\n/**\n * Options for {@link addNodeToTree}.\n */\nexport interface AddNodeOptions {\n /**\n * Whether the new node should become the active leaf. Defaults to `true`,\n * matching the historical \"create-and-focus\" behaviour: a freshly added\n * node almost always represents the latest user-visible state.\n *\n * Pass `false` when focus is decided by a separate signal — e.g. an SSE\n * stream that emits `active_leaf_set` only when the new node *should*\n * pull focus (the previous active leaf was its parent), and otherwise\n * leaves the user wherever they navigated to.\n *\n * `lastLeafId` follows the same rule: it only advances to the new node\n * when the node is activated, since \"deepest leaf the user has reached\"\n * does not include nodes the system added off-screen.\n *\n * @default true\n */\n activate?: boolean\n}\n\n/**\n * Append a node under `parentId` (or as a root when null). By default the new\n * node also becomes the active leaf — sending a message, retrying, editing,\n * and submitting all rely on that. Pass `{activate: false}` to insert without\n * pulling focus, e.g. for off-branch updates from a stream.\n */\nexport function addNodeToTree<T extends NodeTopology>(\n tree: ConversationTree<T>,\n node: T,\n parentId: string | null = null,\n options: AddNodeOptions = {},\n): ConversationTree<T> {\n const activate = options.activate ?? true\n const newNodes: Record<string, TreeNode<T>> = {...tree.nodes}\n const newRootIds = [...tree.rootIds]\n\n const branchIndex = parentId\n ? newNodes[parentId]?.children.length ?? 0\n : newRootIds.length\n\n newNodes[node.id] = {\n ...node,\n parentId,\n children: [],\n branchIndex,\n createdAt: node.createdAt ?? Date.now(),\n } as TreeNode<T>\n\n if (parentId && newNodes[parentId]) {\n newNodes[parentId] = {\n ...newNodes[parentId],\n children: [...newNodes[parentId].children, node.id],\n }\n } else {\n newRootIds.push(node.id)\n }\n\n return {\n nodes: newNodes,\n rootIds: newRootIds,\n activeLeafId: activate ? node.id : tree.activeLeafId,\n lastLeafId: activate ? node.id : tree.lastLeafId,\n }\n}\n\n// ───────────────────────────────────────────────────────────────\n// Traversal — generic over node kind\n// ───────────────────────────────────────────────────────────────\n\n/**\n * Walk root → activeLeaf, returning the nodes on the active path in order.\n */\nexport function getActivePath<T extends NodeTopology>(\n tree: ConversationTree<T>,\n): TreeNode<T>[] {\n return walkUp(tree, tree.activeLeafId).reverse()\n}\n\n/**\n * Walk from `fromId` upward and return the first ancestor (inclusive) that\n * matches the predicate. Domain helpers compose on top — e.g. finding the\n * closest checkpoint is `findAncestor(t, id, n => n.kind === 'checkpoint')`.\n */\nexport function findAncestor<T extends NodeTopology>(\n tree: ConversationTree<T>,\n fromId: string | null,\n predicate: (node: TreeNode<T>) => boolean,\n): TreeNode<T> | null {\n let id: string | null = fromId\n while (id) {\n const node = tree.nodes[id]\n if (!node) return null\n if (predicate(node)) return node\n id = node.parentId\n }\n return null\n}\n\nexport function getSiblingInfo<T extends NodeTopology>(\n tree: ConversationTree<T>,\n nodeId: string,\n): { total: number; current: number } {\n const siblings = siblingsOf(tree, nodeId)\n const index = siblings.indexOf(nodeId)\n if (index < 0) return {total: 1, current: 1}\n return {total: siblings.length, current: index + 1}\n}\n\nexport function isBranchPoint<T extends NodeTopology>(\n tree: ConversationTree<T>,\n nodeId: string,\n): boolean {\n return (tree.nodes[nodeId]?.children.length ?? 0) > 1\n}\n\n// ───────────────────────────────────────────────────────────────\n// Navigation — moving the active leaf\n// ───────────────────────────────────────────────────────────────\n\n/**\n * Switch to a sibling branch at `nodeId` and follow first-children down to a\n * leaf. Used by the BranchNavigator chevrons. Resets `lastLeafId` to the new\n * leaf because the previous greyed-future, if any, lives on a different branch.\n */\nexport function switchBranch<T extends NodeTopology>(\n tree: ConversationTree<T>,\n nodeId: string,\n direction: 'prev' | 'next',\n): ConversationTree<T> {\n const siblings = siblingsOf(tree, nodeId)\n if (siblings.length <= 1) return tree\n\n const currentIndex = siblings.indexOf(nodeId)\n const newIndex = direction === 'next'\n ? (currentIndex + 1) % siblings.length\n : (currentIndex - 1 + siblings.length) % siblings.length\n\n const leafId = deepestLeafOf(tree, siblings[newIndex])\n return {...tree, activeLeafId: leafId, lastLeafId: leafId}\n}\n\n/**\n * Set the active leaf without forking. Use for rewinds (clicking a checkpoint),\n * jumping forward into the greyed future, and \"jump to latest\".\n *\n * Preserves `lastLeafId` when the new leaf is an ancestor of it (i.e. the user\n * rewound, or moved within the rewound region). Otherwise resets `lastLeafId`\n * to the new leaf — the greyed future doesn't carry over to unrelated paths.\n *\n * `null` clears the active leaf (empty session). An id that doesn't exist in\n * the tree is treated as a no-op rather than written through — the previous\n * behaviour silently set `activeLeafId` to a non-existent id, which made\n * `getActivePath` walk from a missing node and return an empty path. That\n * presented as \"the chat just cleared\" for callers that accidentally passed\n * a foreign id (a hypocaust execution id, a stale optimistic temp id, etc.).\n * A no-op turns those caller bugs into visible \"nothing happened\" instead of\n * an invisible empty-render.\n */\nexport function setActiveLeaf<T extends NodeTopology>(\n tree: ConversationTree<T>,\n leafId: string | null,\n): ConversationTree<T> {\n if (leafId === null) {\n return {...tree, activeLeafId: null, lastLeafId: null}\n }\n if (!tree.nodes[leafId]) {\n return tree\n }\n const lastLeafId = tree.lastLeafId && isAncestor(tree, leafId, tree.lastLeafId)\n ? tree.lastLeafId\n : leafId\n return {...tree, activeLeafId: leafId, lastLeafId}\n}\n\n/**\n * Nodes between `activeLeafId` (exclusive) and `lastLeafId` (inclusive) — the\n * timeline the user rewound away from. Empty whenever no rewind is in effect.\n */\nexport function getGreyedFuture<T extends NodeTopology>(\n tree: ConversationTree<T>,\n): TreeNode<T>[] {\n const {activeLeafId, lastLeafId} = tree\n if (!activeLeafId || !lastLeafId || activeLeafId === lastLeafId) return []\n\n const path: TreeNode<T>[] = []\n let id: string | null = lastLeafId\n while (id && id !== activeLeafId) {\n const node: TreeNode<T> | undefined = tree.nodes[id]\n if (!node) return []\n path.unshift(node)\n id = node.parentId\n }\n return id === activeLeafId ? path : []\n}\n\n// ───────────────────────────────────────────────────────────────\n// Mutation\n// ───────────────────────────────────────────────────────────────\n\n/**\n * Convenience: build a strictly linear message-only tree from a flat array.\n * Useful for tests, fixtures, and consumers that don't care about branching.\n */\nexport function messagesToTree(\n messages: Array<Omit<MessageNode, 'kind' | 'parentId'>>,\n): ConversationTree<MessageNode> {\n let tree = createEmptyTree<MessageNode>()\n for (const msg of messages) {\n const parentId = tree.activeLeafId\n tree = addNodeToTree(\n tree,\n {...msg, kind: 'message', parentId} as MessageNode,\n parentId,\n )\n }\n return tree\n}\n\n/**\n * Update a streaming message's content. Generic over the tree's node type so\n * the function works equally on message-only trees (`ConversationTree<MessageNode>`)\n * and mixed trees (`ConversationTree<ChatNode>`). At runtime it narrows to\n * `MessageNode` via the `kind` discriminator and silently no-ops on any other\n * kind. The single cast below is the cost of bridging a generic-T tree to the\n * concrete `MessageNode` shape it operates on.\n */\nexport function updateMessageContent<T extends NodeTopology>(\n tree: ConversationTree<T>,\n nodeId: string,\n content: ReactNode,\n isStreaming?: boolean,\n): ConversationTree<T> {\n const node = tree.nodes[nodeId] as unknown as TreeNode<MessageNode> | undefined\n if (!node || node.kind !== 'message') return tree\n const updated: TreeNode<MessageNode> = {\n ...node,\n content,\n isStreaming: isStreaming ?? node.isStreaming,\n }\n return {\n ...tree,\n nodes: {\n ...tree.nodes,\n [nodeId]: updated as unknown as TreeNode<T>,\n },\n }\n}\n\n// ───────────────────────────────────────────────────────────────\n// Internal helpers\n// ───────────────────────────────────────────────────────────────\n\nfunction walkUp<T extends NodeTopology>(\n tree: ConversationTree<T>,\n fromId: string | null,\n): TreeNode<T>[] {\n const out: TreeNode<T>[] = []\n let id: string | null = fromId\n while (id) {\n const node = tree.nodes[id]\n if (!node) break\n out.push(node)\n id = node.parentId\n }\n return out\n}\n\nfunction siblingsOf<T extends NodeTopology>(\n tree: ConversationTree<T>,\n nodeId: string,\n): string[] {\n const node = tree.nodes[nodeId]\n if (!node) return []\n return node.parentId\n ? tree.nodes[node.parentId]?.children ?? []\n : tree.rootIds\n}\n\nfunction deepestLeafOf<T extends NodeTopology>(\n tree: ConversationTree<T>,\n nodeId: string,\n): string {\n let id = nodeId\n let node = tree.nodes[id]\n while (node && node.children.length > 0) {\n id = node.children[node.children.length - 1]\n node = tree.nodes[id]\n }\n return id\n}\n\nfunction isAncestor<T extends NodeTopology>(\n tree: ConversationTree<T>,\n ancestorId: string,\n descendantId: string,\n): boolean {\n let id: string | null = descendantId\n while (id) {\n if (id === ancestorId) return true\n id = tree.nodes[id]?.parentId ?? null\n }\n return false\n}\n","import React, {useCallback, useState} from 'react'\nimport {cx, useCopyToClipboard} from '../../utils'\nimport {Check, Copy, Pencil, RotateCcw, Send, X,} from 'lucide-react'\nimport type {MessageVariant} from '../Message'\n\n/**\n * @deprecated Use MessageVariant. Kept as an alias for backwards compatibility.\n */\nexport type MessageActionsVariant = MessageVariant\n\nexport interface MessageActionsProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Whether this is for a user or assistant message\n */\n variant: MessageVariant\n /**\n * The message content for copy functionality\n */\n content: string\n /**\n * Called when user wants to edit their message\n * Consumer should handle creating a branch with the edited content\n */\n onEdit?: (newContent: string) => void\n /**\n * Called when user wants to retry/regenerate the assistant response\n * Consumer should handle creating a branch with a new response\n */\n onRetry?: () => void\n /**\n * Whether the message is currently being edited\n */\n isEditing?: boolean\n /**\n * Callback to set editing state (controlled from parent)\n */\n onEditingChange?: (isEditing: boolean) => void\n /**\n * Initial content for the edit input (defaults to content prop)\n */\n editValue?: string\n}\n\nconst ActionButton: React.FC<{\n onClick: () => void\n label: string\n children: React.ReactNode\n className?: string\n disabled?: boolean\n}> = ({onClick, label, children, className, disabled}) => (\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className={cx(\n 'p-1.5 text-silver/60 hover:text-silver transition-colors duration-150',\n 'hover:bg-white/5 ',\n 'disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent',\n className\n )}\n aria-label={label}\n >\n {children}\n </button>\n)\n\nexport const MessageActions = React.forwardRef<HTMLDivElement, MessageActionsProps>(\n (\n {\n variant,\n content,\n onEdit,\n onRetry,\n isEditing: controlledIsEditing,\n onEditingChange,\n editValue: controlledEditValue,\n className,\n ...rest\n },\n ref\n ) => {\n // Local state for uncontrolled mode\n const [localIsEditing, setLocalIsEditing] = useState(false)\n const [localEditValue, setLocalEditValue] = useState(content)\n const {copied, copy} = useCopyToClipboard()\n\n // Determine if controlled or uncontrolled\n const isEditing = controlledIsEditing ?? localIsEditing\n const editValue = controlledEditValue ?? localEditValue\n\n const setIsEditing = useCallback(\n (value: boolean) => {\n if (onEditingChange) {\n onEditingChange(value)\n } else {\n setLocalIsEditing(value)\n }\n },\n [onEditingChange]\n )\n\n const setEditValue = useCallback((value: string) => {\n setLocalEditValue(value)\n }, [])\n\n const handleCopy = useCallback(() => {\n void copy(content)\n }, [copy, content])\n\n const handleStartEdit = useCallback(() => {\n setLocalEditValue(content)\n setIsEditing(true)\n }, [content, setIsEditing])\n\n const handleCancelEdit = useCallback(() => {\n setIsEditing(false)\n setLocalEditValue(content)\n }, [content, setIsEditing])\n\n const handleSubmitEdit = useCallback(() => {\n const trimmed = editValue.trim()\n if (trimmed && trimmed !== content) {\n onEdit?.(trimmed)\n }\n setIsEditing(false)\n }, [editValue, content, onEdit, setIsEditing])\n\n const handleEditKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault()\n handleSubmitEdit()\n } else if (e.key === 'Escape') {\n handleCancelEdit()\n }\n },\n [handleSubmitEdit, handleCancelEdit]\n )\n\n const isUser = variant === 'user'\n\n // Render edit mode inline\n if (isUser && isEditing) {\n return (\n <div\n ref={ref}\n className={cx('mt-2', className)}\n {...rest}\n >\n <div\n className=\"relative bg-charcoal border border-ash/60 focus-within:border-gold/60 focus-within:ring-1 focus-within:ring-gold/20\">\n <textarea\n value={editValue}\n onChange={(e) => setEditValue(e.target.value)}\n onKeyDown={handleEditKeyDown}\n className=\"w-full bg-transparent text-white px-3 py-2 pr-20 resize-none outline-none min-h-16 text-sm\"\n autoFocus\n rows={2}\n />\n <div className=\"absolute right-2 bottom-2 flex gap-1\">\n <ActionButton\n onClick={handleCancelEdit}\n label=\"Cancel edit\"\n className=\"text-silver/60 hover:text-error\"\n >\n <X className=\"w-4 h-4\"/>\n </ActionButton>\n <ActionButton\n onClick={handleSubmitEdit}\n label=\"Submit edit\"\n className=\"text-silver/60 hover:text-gold\"\n disabled={!editValue.trim() || editValue.trim() === content}\n >\n <Send className=\"w-4 h-4\"/>\n </ActionButton>\n </div>\n </div>\n <p className=\"text-xs text-silver/50 mt-1\">\n Press Enter to submit, Esc to cancel. This will create a new branch.\n </p>\n </div>\n )\n }\n\n return (\n <div\n ref={ref}\n className={cx(\n 'flex items-center gap-0.5 mt-1',\n isUser ? 'justify-end' : 'justify-start',\n className\n )}\n {...rest}\n >\n {/* Copy - available for both user and assistant */}\n <ActionButton onClick={handleCopy} label={copied ? 'Copied!' : 'Copy message'}>\n {copied ? (\n <Check className=\"w-3.5 h-3.5 text-success\"/>\n ) : (\n <Copy className=\"w-3.5 h-3.5\"/>\n )}\n </ActionButton>\n\n {/* Edit - only for user messages */}\n {isUser && onEdit && (\n <ActionButton onClick={handleStartEdit} label=\"Edit message\">\n <Pencil className=\"w-3.5 h-3.5\"/>\n </ActionButton>\n )}\n\n {/* Retry - only for assistant messages */}\n {!isUser && onRetry && (\n <ActionButton onClick={onRetry} label=\"Regenerate response\">\n <RotateCcw className=\"w-3.5 h-3.5\"/>\n </ActionButton>\n )}\n </div>\n )\n }\n)\n\nMessageActions.displayName = 'MessageActions'\n\nexport default MessageActions\n","import React from 'react'\nimport {cx} from '../../utils/cx'\nimport {ChevronLeft, ChevronRight, GitBranch} from 'lucide-react'\n\nexport interface BranchNavigatorProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Current branch index (1-based for display)\n */\n current: number\n /**\n * Total number of sibling branches\n */\n total: number\n /**\n * Called when navigating to previous branch\n */\n onPrevious?: () => void\n /**\n * Called when navigating to next branch\n */\n onNext?: () => void\n /**\n * Size variant\n */\n size?: 'sm' | 'md'\n /**\n * Whether to show the branch icon\n */\n showIcon?: boolean\n}\n\n/**\n * BranchNavigator provides a UI for switching between conversation branches.\n * Used in the Message component to navigate sibling branches (e.g., \"1/3\").\n */\nexport const BranchNavigator = React.forwardRef<HTMLDivElement, BranchNavigatorProps>(\n (\n {\n current,\n total,\n onPrevious,\n onNext,\n size = 'sm',\n showIcon = true,\n className,\n ...rest\n },\n ref\n ) => {\n // Don't render if there's only one branch\n if (total <= 1) {\n return null\n }\n\n const isFirst = current <= 1\n const isLast = current >= total\n\n const buttonSize = size === 'sm' ? 'p-0.5' : 'p-1'\n const iconSize = size === 'sm' ? 'w-3 h-3' : 'w-4 h-4'\n const textSize = size === 'sm' ? 'text-xs' : 'text-sm'\n\n return (\n <div\n ref={ref}\n className={cx(\n 'inline-flex items-center gap-0.5 text-silver/70',\n className\n )}\n role=\"navigation\"\n aria-label=\"Branch navigation\"\n {...rest}\n >\n {/* Branch icon */}\n {showIcon && (\n <GitBranch className={cx(iconSize, 'mr-0.5 text-silver/50')} aria-hidden=\"true\"/>\n )}\n\n {/* Previous button */}\n <button\n type=\"button\"\n onClick={onPrevious}\n disabled={isFirst}\n className={cx(\n buttonSize,\n 'hover:text-white hover:bg-white/10 transition-colors',\n 'disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-silver/70'\n )}\n aria-label=\"Previous branch\"\n >\n <ChevronLeft className={iconSize}/>\n </button>\n\n {/* Counter */}\n <span className={cx(textSize, 'tabular-nums min-w-6 text-center')}>\n {current}/{total}\n </span>\n\n {/* Next button */}\n <button\n type=\"button\"\n onClick={onNext}\n disabled={isLast}\n className={cx(\n buttonSize,\n 'hover:text-white hover:bg-white/10 transition-colors',\n 'disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-silver/70'\n )}\n aria-label=\"Next branch\"\n >\n <ChevronRight className={iconSize}/>\n </button>\n </div>\n )\n }\n)\n\nBranchNavigator.displayName = 'BranchNavigator'\n\nexport default BranchNavigator\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type BrandIconSize = 'sm' | 'md' | 'lg'\nexport type BrandIconVariant = 'solid' | 'outline'\n\nexport interface BrandIconProps extends React.HTMLAttributes<HTMLDivElement> {\n size?: BrandIconSize\n variant?: BrandIconVariant\n}\n\nconst sizeMap: Record<BrandIconSize, string> = {\n sm: 'h-8 w-8 text-sm',\n md: 'h-12 w-12 text-base',\n lg: 'h-16 w-16 text-lg',\n}\n\nexport const BrandIcon = React.forwardRef<HTMLDivElement, BrandIconProps>(\n ({size = 'md', variant = 'solid', children, className, ...rest}, ref) => {\n const variantClasses =\n variant === 'solid'\n ? 'bg-gold text-obsidian border-2 border-gold'\n : 'bg-transparent text-gold border-2 border-gold'\n\n return (\n <div\n ref={ref}\n className={cx(\n 'inline-flex items-center justify-center rounded-none font-bold select-none overflow-hidden',\n sizeMap[size],\n variantClasses,\n className\n )}\n {...rest}\n >\n {children}\n </div>\n )\n }\n)\n\nBrandIcon.displayName = 'BrandIcon'\n\nexport default BrandIcon\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport interface ColorSwatchProps extends React.HTMLAttributes<HTMLDivElement> {\n color: string\n label?: string\n}\n\nexport const ColorSwatch = React.forwardRef<HTMLDivElement, ColorSwatchProps>(\n ({color, label, className, ...rest}, ref) => {\n return (\n <div\n ref={ref}\n className={cx('flex flex-col items-center gap-2', className)}\n {...rest}\n >\n <div\n className=\"h-16 w-16 border-2 border-ash rounded-none shadow-sm\"\n style={{backgroundColor: color}}\n aria-label={label || color}\n />\n {label && (\n <span className=\"text-xs text-silver font-medium\">{label}</span>\n )}\n </div>\n )\n }\n)\n\nColorSwatch.displayName = 'ColorSwatch'\n\nexport default ColorSwatch\n","import React from 'react'\nimport {cx} from '../utils/cx'\n\nexport type SectionHeadingLevel = 'h2' | 'h3'\n\nexport interface SectionHeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {\n level?: SectionHeadingLevel\n}\n\nconst levelStyles = {\n h2: 'text-2xl mb-4',\n h3: 'text-xl mb-3',\n}\n\nexport const SectionHeading = React.forwardRef<HTMLHeadingElement, SectionHeadingProps>(\n ({level = 'h2', children, className, ...rest}, ref) => {\n const Component = level\n\n return (\n <Component\n ref={ref}\n className={cx(\n 'text-gold font-semibold tracking-tight',\n levelStyles[level],\n className\n )}\n {...rest}\n >\n {children}\n </Component>\n )\n }\n)\n\nSectionHeading.displayName = 'SectionHeading'\n\nexport default SectionHeading\n","import {type Artifact} from './ArtifactCard'\n\n/**\n * Node types in the artifact tree\n */\nexport const NODE_TYPES = {\n ARTIFACT: 'ARTIFACT',\n GROUP: 'GROUP',\n VARIANT_SET: 'VARIANT_SET',\n} as const\n\nexport type NodeType = typeof NODE_TYPES[keyof typeof NODE_TYPES]\n\n/**\n * A node in the artifact tree. Mirrors the backend ArtifactNode shape.\n * Groups and variant sets contain children; artifact nodes link to content.\n */\nexport interface ArtifactNode {\n /**\n * Unique identifier\n */\n id: string\n /**\n * The node type — ARTIFACT, GROUP, or VARIANT_SET\n */\n type: NodeType\n /**\n * Semantic name (e.g. \"storyboard\", \"protagonist_warm\")\n */\n name: string\n /**\n * Display label (e.g. \"Storyboard\", \"Warm Analog\")\n */\n label: string\n /**\n * For ARTIFACT nodes — the actual content. Null for GROUP and VARIANT_SET.\n */\n artifact?: Artifact\n /**\n * Child nodes (populated for GROUP and VARIANT_SET)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;AACrD,UAAM,YAAY;AAElB,WACI,+BAAAA,QAAA;AAAA,MAAC;AAAA;AAAA,QACG;AAAA,QACA,WAAW;AAAA,UACP;AAAA,UACA,YAAY,KAAK;AAAA,UACjB;AAAA,QACJ;AAAA,QACC,GAAG;AAAA;AAAA,MAEL;AAAA,IACH;AAAA,EAEN;AACJ;AAEA,eAAe,cAAc;;;AC7BtB,IAAM,aAAa;AAAA,EACxB,UAAU;AAAA,EACV,OAAO;AAAA,EACP,aAAa;AACf;;;A1GQO,IAAM,UAAU;","names":["React","import_react","React","import_react","import_react","import_react","React","React","import_react","React","import_react","React","import_react","React","import_react","ALIGN_MAP","JUSTIFY_MAP","GAP_MAP","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","import_lucide_react","React","import_react","import_lucide_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","e","import_react","React","import_react","import_lucide_react","React","import_react","React","import_react","VARIANT_MAP","React","import_react","import_lucide_react","React","VARIANT_STYLES","import_react","import_react_dom","import_lucide_react","React","import_react","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","React","import_react","import_react_dom","import_lucide_react","SIZE_MAP","POSITION_CLASSES","React","import_react","POSITION_CLASSES","React","import_react","React","import_react","React","import_react","import_lucide_react","React","import_react","React","import_react","React","import_react","import_lucide_react","React","import_react","import_lucide_react","React","import_react","import_lucide_react","React","import_react","import_lucide_react","import_react","React","remarkGfm","ReactMarkdown","VARIANT_STYLES","React","import_react","React","variantStyles","import_react","import_react","import_react","import_react","import_react","React","import_react","import_lucide_react","React","Checkpoint","import_react","import_lucide_react","React","GreyedDivider","React","ChatView","_k","id","import_react","import_lucide_react","React","import_react","import_lucide_react","import_react","import_react","React","import_react","ASPECT_RATIO_PRESETS","resolveAspectRatio","React","ReactPlayer","import_react","import_react_player","import_lucide_react","React","ReactPlayer","import_react","import_lucide_react","React","import_react","React","import_react","React","import_react","React","React","import_react","React","import_react","React","import_react","import_react","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","import_react","React","React","React","import_react","import_react","React","import_react","import_lucide_react","React","import_react","import_lucide_react","React","import_react","React","import_react","React","React","import_react","import_lucide_react","ActionButton","React","import_react","import_lucide_react","React","import_react","sizeMap","React","import_react","React","import_react","React"]}
|