{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"comment-thread","type":"registry:component","title":"Comment thread","description":"A discussion attached to something: replies, reactions, @mentions, editing and deleting your own, resolve that folds the thread.","categories":["display"],"dependencies":["@radix-ui/react-dialog@1.1.23","@radix-ui/react-direction@1.1.4","@radix-ui/react-dropdown-menu@2.1.24","@radix-ui/react-label@2.1.15","@radix-ui/react-popover@1.1.23","@radix-ui/react-slot@1.3.3","clsx@^2.1.1","lucide-react@^1.48.0","motion@^13.4.4","tailwind-merge@^3.7.0"],"registryDependencies":["https://beamline.io/registry/look-prism.json"],"files":[{"path":"beamline/components/_shared/field.module.css","type":"registry:file","target":"src/ui/beamline/components/_shared/field.module.css","content":"@layer properties, theme, base, components, utilities;\n@layer components {\n  /* A field: label (with an optional aside at the end of its row), the control, then one message line. The gap under\n   the control belongs to the message (--pui-field-gap), so a message that arrives or leaves takes its gap with it. */\n  /* a column, not a grid: a message (or a fold) that leaves pulls its gap away with a negative margin, which a flex\n     column honours and a grid track does not (it would stop at zero and stretch the leaving part back open) */\n  .field {\n    --pui-field-gap: var(--pui-space-1-5);\n    /* positioned: a hidden label or a count's spoken words (sr-only, absolutely placed) stay inside the field */\n    position: relative;\n    display: flex;\n    min-width: 0;\n    flex-direction: column;\n    gap: var(--pui-field-gap);\n  }\n  .labelRow {\n    display: flex;\n    min-width: 0;\n    align-items: baseline;\n    gap: var(--pui-space-2);\n  }\n  .aside {\n    margin-inline-start: auto;\n    flex-shrink: 0;\n    color: var(--pui-ink-3);\n    font-size: var(--pui-text-xs);\n  }\n\n  /* The message: one line at a time. A new line grows in to its own height (0fr to 1fr, no measuring) while the one it\n   replaces folds away above it, so the height glides from one to the other; a line that leaves with nothing after it\n   takes the gap with it. Arrival over --pui-motion-in, departure over --pui-motion-out; reduced motion keeps the fades. */\n  .messages {\n    display: grid;\n    margin-top: calc(var(--pui-field-gap, var(--pui-space-1-5)) * -1);\n  }\n  .line {\n    display: grid;\n    grid-template-rows: 1fr;\n    opacity: 1;\n    transition:\n      grid-template-rows var(--pui-motion-in) var(--pui-ease-default),\n      opacity var(--pui-fade-in, var(--pui-motion-in)) var(--pui-ease-default);\n  }\n  @starting-style {\n    .line {\n      grid-template-rows: 0fr;\n      opacity: 0;\n    }\n  }\n  /* the line a field is first drawn with does not grow in */\n  .line[data-initial] {\n    transition: none;\n  }\n  /* a swap is one change of size: the old line folds and the new one grows over the same duration and curve, so their\n     sum (the field's height) moves straight from one to the other, with no swell between; the old words fade first */\n  .line[data-leaving] {\n    grid-template-rows: 0fr;\n    opacity: 0;\n    transition:\n      grid-template-rows var(--pui-motion-out) var(--pui-ease-default),\n      opacity var(--pui-fade-in, var(--pui-motion-in)) var(--pui-ease-default);\n    pointer-events: none;\n  }\n  .messages:has(> .line[data-leaving]) > .line:not([data-leaving], [data-initial]) {\n    transition-duration: var(--pui-motion-out), var(--pui-fade-in, var(--pui-motion-in));\n  }\n  .clip {\n    min-height: 0;\n    overflow: clip;\n    overflow-clip-margin: var(--pui-space-1);\n  }\n  .message {\n    display: flex;\n    align-items: flex-start;\n    gap: var(--pui-space-1-5);\n    padding-top: var(--pui-field-gap, var(--pui-space-1-5));\n    font-size: var(--pui-text-xs);\n    line-height: 1.375;\n  }\n  .description {\n    display: block;\n    color: var(--pui-ink-3);\n  }\n  .error {\n    color: var(--pui-red);\n  }\n  .success {\n    color: var(--pui-green);\n  }\n  .icon {\n    flex-shrink: 0;\n    width: var(--pui-icon-sm);\n    height: var(--pui-icon-sm);\n    margin-top: 1px;\n  }\n\n  /* The count in the label's row: tabular, quiet, shown with attention (.reveal) and in words near the limit. */\n  .count {\n    font-variant-numeric: tabular-nums;\n    white-space: nowrap;\n  }\n  .count[data-state=\"near\"],\n  .count[data-state=\"full\"] {\n    color: var(--pui-orange);\n  }\n  .count[data-state=\"over\"] {\n    color: var(--pui-red);\n  }\n\n  /* The status at the end of the frame: the spinner arrives scaled in from its centre, and closes into the check. */\n  .status {\n    display: inline-grid;\n    flex-shrink: 0;\n    place-items: center;\n    animation: status-in var(--pui-motion-in) var(--pui-ease-default);\n  }\n  @keyframes status-in {\n    from {\n      opacity: 0;\n      scale: calc(1 - 0.4 * var(--pui-motion-travel, 1));\n    }\n  }\n\n  /* The one frame every text-like control sits in: input, textarea, password, search, number, the select and date\n   triggers. Its paint (fill, edge, hover, focus) is the field role of the look in force (looks.css); invalid,\n   read-only and disabled are drawn here so they read the same in every look. */\n  .frame {\n    --_field-height: var(--pui-control-height-md);\n    position: relative;\n    display: flex;\n    min-width: 0; /* a grid or flex parent may make it narrower than the input's natural width */\n    align-items: center;\n    gap: var(--pui-space-2);\n    min-height: var(--_field-height);\n    padding-inline: var(--pui-space-2-5);\n    border-radius: var(--pui-field-radius, var(--pui-radius-control));\n    color: var(--pui-ink);\n    font-size: var(--pui-text-sm);\n    cursor: text;\n    transition:\n      box-shadow var(--pui-motion-out) var(--pui-ease-default),\n      background-color var(--pui-motion-out) var(--pui-ease-default);\n  }\n  .frame:hover:not([data-disabled]) {\n    transition-duration: 0ms;\n  }\n  .frame[data-state=\"open\"] {\n    box-shadow: var(--m-field-edge-focus);\n  }\n  .frame:focus-within {\n    transition: none;\n  }\n  .frame[data-disabled] {\n    opacity: var(--pui-opacity-disabled);\n    cursor: not-allowed;\n  }\n  .frame[data-readonly] {\n    --m-field-bg: transparent;\n  }\n  .sm {\n    --_field-height: var(--pui-control-height-sm);\n    padding-inline: var(--pui-space-2);\n  }\n  .lg {\n    --_field-height: var(--pui-control-height-lg);\n    padding-inline: var(--pui-space-3);\n    font-size: var(--pui-text-base);\n  }\n  .multiline {\n    align-items: stretch;\n    padding-block: var(--pui-space-2);\n  }\n\n  /* The control itself: borderless, it takes the frame's look. Focus shows on the frame, so the control's own ring is off\n   (the frame's ring is the visible focus indicator, which is always present when the control has focus). */\n  .control {\n    flex: 1;\n    min-width: 0;\n    height: 100%;\n    min-height: calc(var(--_field-height) - 2px);\n    border: 0;\n    outline: none;\n    background: transparent;\n    color: inherit;\n    font: inherit;\n    letter-spacing: inherit;\n    padding: 0;\n  }\n  .control:focus-visible {\n    outline: none;\n  }\n  .control::placeholder {\n    color: var(--pui-ink-3);\n    opacity: 1;\n  }\n  .control:disabled {\n    cursor: not-allowed;\n  }\n  textarea.control {\n    min-height: 0;\n    resize: none;\n    line-height: 1.5;\n    field-sizing: content;\n  }\n  .adornment {\n    display: inline-flex;\n    align-items: center;\n    flex-shrink: 0;\n    color: var(--pui-ink-3);\n  }\n  .adornment :where(svg) {\n    width: var(--pui-icon-md);\n    height: var(--pui-icon-md);\n  }\n}\n/* CSS-module composition only; visual rules stay in the component layer. */\n.frame {\n  composes: m-field nest-corner from global;\n}\n"},{"path":"beamline/components/_shared/field.tsx","type":"registry:file","target":"src/ui/beamline/components/_shared/field.tsx","content":"\"use client\";\nimport { useMessages } from \"../../runtime/localization\";\nimport { english } from \"./messages\";\n\nimport {\n  useEffect,\n  useId,\n  useRef,\n  useState,\n  type CSSProperties,\n  type PointerEvent as ReactPointerEvent,\n  type ReactNode,\n  type Ref,\n  type TransitionEvent,\n} from \"react\";\nimport { AlertCircle, CircleCheck } from \"lucide-react\";\nimport { Label } from \"../label/label\";\nimport { Spinner } from \"../spinner/spinner\";\nimport { cn } from \"../../lib/utils\";\nimport styles from \"./field.module.css\";\n\nexport type FieldSize = \"sm\" | \"md\" | \"lg\";\nexport type FieldClassNames = Partial<\n  Record<\"root\" | \"label\" | \"frame\" | \"leading\" | \"trailing\" | \"description\" | \"error\" | \"success\" | \"aside\", string>\n>;\n\nexport interface FieldOptions {\n  /** Visible label, also the accessible name. */\n  label?: ReactNode;\n  /** Keep the label for assistive tech only (dense rows, toolbars). */\n  hideLabel?: boolean;\n  /** One line of help under the control. */\n  description?: ReactNode;\n  /** The problem and its fix; replaces the description and marks the control invalid. */\n  error?: ReactNode;\n  /** The confirmation that the value works (\"@mira is available\"): replaces the description, with a check. */\n  success?: ReactNode;\n  required?: boolean;\n  size?: FieldSize;\n}\n\n/** Ids and aria wiring for one field: the control gets these spread onto it. */\nexport function useFieldIds(\n  id?: string,\n  { description, error, success }: Pick<FieldOptions, \"description\" | \"error\" | \"success\"> = {},\n) {\n  const auto = useId();\n  const controlId = id ?? `field-${auto}`;\n  // the line under the field is one of three, and the control points at whichever is there\n  const descriptionId = (success || description) && !error ? `${controlId}-description` : undefined;\n  const errorId = error ? `${controlId}-error` : undefined;\n  return {\n    controlId,\n    descriptionId,\n    errorId,\n    aria: {\n      id: controlId,\n      \"aria-describedby\": [descriptionId, errorId].filter(Boolean).join(\" \") || undefined,\n      \"aria-invalid\": error ? true : undefined,\n      \"aria-errormessage\": errorId,\n    },\n  };\n}\n\n/** Label above (with an optional aside at the end of its row: a counter, a link), control frame, then the message. */\nexport function Field({\n  label,\n  hideLabel,\n  description,\n  error,\n  success,\n  required,\n  controlId,\n  descriptionId,\n  errorId,\n  aside,\n  className,\n  classNames,\n  style,\n  slot = \"field\",\n  requiredOnControl,\n  children,\n}: FieldOptions & {\n  controlId: string;\n  descriptionId?: string;\n  errorId?: string;\n  /** At the end of the label's row: a character count, \"Forgot password?\", \"Optional\". */\n  aside?: ReactNode;\n  className?: string;\n  classNames?: FieldClassNames;\n  style?: CSSProperties;\n  slot?: string;\n  /** The control carries `required` itself, so the label does not repeat it in the control's name. */\n  requiredOnControl?: boolean;\n  children: ReactNode;\n}) {\n  const labelNode = label != null && (\n    <Label\n      htmlFor={controlId}\n      required={required}\n      requiredOnControl={requiredOnControl}\n      className={cn(\"text-label\", hideLabel && \"sr-only\", classNames?.label)}\n    >\n      {label}\n    </Label>\n  );\n  return (\n    <div\n      data-slot={slot}\n      data-invalid={error ? \"\" : undefined}\n      style={style}\n      className={cn(styles.field, aside != null && \"reveal-host\", classNames?.root, className)}\n    >\n      {aside != null ? (\n        <div data-slot=\"field-label-row\" className={styles.labelRow}>\n          {labelNode}\n          <span data-slot=\"field-aside\" className={cn(styles.aside, classNames?.aside)}>\n            {aside}\n          </span>\n        </div>\n      ) : (\n        labelNode\n      )}\n      {children}\n      <FieldMessage\n        error={error}\n        success={success}\n        description={description}\n        errorId={errorId}\n        descriptionId={descriptionId}\n        classNames={classNames}\n      />\n    </div>\n  );\n}\n\ntype Tone = \"error\" | \"success\" | \"description\";\ninterface Line {\n  key: string;\n  tone: Tone;\n  content: ReactNode;\n}\nconst ICON = { error: AlertCircle, success: CircleCheck } as const;\n\n/**\n * The line under a field: its problem when there is one, else its confirmation, else its help. Shared by every field\n * and choice group. A change of line keeps its path: the new line grows in under the control while the old one folds\n * away above it, so what sits below glides instead of jumping, and a quick reversal turns around from where it is.\n * The leaving line is a still copy, hidden from assistive tech and inert; ids and aria point only at the line that is\n * there. It is gone when its fold ends, and by the clock as well: a line that leaves in the frame it arrived has no\n * fold to run, so no end is reported.\n */\nexport function FieldMessage({\n  error,\n  success,\n  description,\n  errorId,\n  descriptionId,\n  slot = \"field\",\n  classNames,\n}: Pick<FieldOptions, \"error\" | \"description\" | \"success\"> & {\n  errorId?: string;\n  descriptionId?: string;\n  /** The slot names' prefix: \"checkbox\" names the lines checkbox-error, checkbox-description. */\n  slot?: string;\n  classNames?: Pick<FieldClassNames, \"error\" | \"description\" | \"success\">;\n}) {\n  const tone: Tone | null = error ? \"error\" : success ? \"success\" : description ? \"description\" : null;\n  const content = error || success || description;\n  // a new text is a new line (one problem replacing another also folds and grows); rich content changes in place\n  const text = typeof content === \"string\" || typeof content === \"number\" ? String(content) : \"\";\n  const current: Line | null = tone ? { key: `${tone}\\u0000${text}`, tone, content } : null;\n  const [last, setLast] = useState<Line | null>(current);\n  const [leaving, setLeaving] = useState<Line | null>(null);\n  // the line a field is drawn with is simply there; only a change of line moves\n  const [changed, setChanged] = useState(false);\n  if ((last?.key ?? null) !== (current?.key ?? null)) {\n    // the line that was there leaves (one at a time: a line already leaving is gone at once)\n    setLeaving(last && last.key !== current?.key ? last : null);\n    setLast(current);\n    setChanged(true);\n  }\n  const box = useRef<HTMLDivElement>(null);\n  useEffect(() => {\n    if (!leaving) return;\n    // the clock is the leaving line's own longest transition, read once as it starts to leave (the fold's end event\n    // usually comes first), so a field resolves no motion tokens of its own\n    const el = box.current?.querySelector<HTMLElement>(\"[data-leaving]\");\n    const longest = el\n      ? Math.max(\n          0,\n          ...getComputedStyle(el)\n            .transitionDuration.split(\",\")\n            .map((t) => parseFloat(t) * (t.trim().endsWith(\"ms\") ? 1 : 1000) || 0),\n        )\n      : 0;\n    const id = window.setTimeout(() => setLeaving((l) => (l === leaving ? null : l)), longest + 250);\n    return () => window.clearTimeout(id);\n  }, [leaving]);\n  if (!current && !leaving) return null;\n  const shown = leaving && leaving.key === current?.key ? null : leaving;\n  const ids = { error: errorId, success: descriptionId, description: descriptionId };\n  const line = (l: Line, gone: boolean) => {\n    const Icon = l.tone === \"description\" ? null : ICON[l.tone];\n    return (\n      <div\n        key={l.key}\n        data-slot=\"field-message-line\"\n        data-leaving={gone ? \"\" : undefined}\n        data-initial={changed ? undefined : \"\"}\n        aria-hidden={gone || undefined}\n        inert={gone || undefined}\n        className={styles.line}\n        onTransitionEnd={\n          gone\n            ? (e: TransitionEvent<HTMLDivElement>) => {\n                if (e.target === e.currentTarget && e.propertyName === \"grid-template-rows\") setLeaving(null);\n              }\n            : undefined\n        }\n      >\n        <div className={styles.clip}>\n          <p\n            id={gone ? undefined : ids[l.tone]}\n            data-slot={`${slot}-${l.tone}`}\n            className={cn(styles.message, styles[l.tone], classNames?.[l.tone])}\n          >\n            {Icon && <Icon aria-hidden className={styles.icon} />}\n            {l.content}\n          </p>\n        </div>\n      </div>\n    );\n  };\n  return (\n    <div ref={box} data-slot=\"field-message\" className={styles.messages}>\n      {shown && line(shown, true)}\n      {current && line(current, false)}\n    </div>\n  );\n}\n\n/** What the end of a text field says about its work: a spinner while a value is checked, a drawn check when it works. */\nexport type FieldStatus = \"busy\" | \"success\";\n\n/** The frame a text-like control sits in; clicking anywhere on it focuses the control. */\nexport function FieldFrame({\n  size = \"md\",\n  invalid,\n  disabled,\n  readOnly,\n  multiline,\n  status,\n  statusLabel: statusLabelProp,\n  leading,\n  trailing,\n  className,\n  classNames,\n  children,\n  onPointerDown,\n  ref,\n}: {\n  size?: FieldSize;\n  invalid?: boolean;\n  disabled?: boolean;\n  readOnly?: boolean;\n  multiline?: boolean;\n  /** busy: a spinner at the end while the value is checked or saved; success: the ring closes into a check. */\n  status?: FieldStatus;\n  /** What the spinner says while busy (\"Checking\", \"Saving\"). */\n  statusLabel?: string;\n  leading?: ReactNode;\n  trailing?: ReactNode;\n  className?: string;\n  classNames?: FieldClassNames;\n  children: ReactNode;\n  onPointerDown?: (e: ReactPointerEvent<HTMLDivElement>) => void;\n  /** The frame itself, for a control that lays out by the frame's width (useWidthAs). */\n  ref?: Ref<HTMLDivElement>;\n}) {\n  const i18n = useMessages(\"_shared\", english);\n  const statusLabel = statusLabelProp === undefined ? i18n(\"statusLabel\") : statusLabelProp;\n\n  return (\n    <div\n      ref={ref}\n      data-slot=\"field-control\"\n      data-invalid={invalid ? \"\" : undefined}\n      data-disabled={disabled ? \"\" : undefined}\n      data-readonly={readOnly ? \"\" : undefined}\n      data-status={status}\n      className={cn(styles.frame, styles[size], multiline && styles.multiline, classNames?.frame, className)}\n      onPointerDown={(e) => {\n        onPointerDown?.(e);\n        // a click on the frame's padding or an adornment that is not itself interactive focuses the control\n        const t = e.target as HTMLElement;\n        if (t === e.currentTarget || (t.closest(\"[data-adornment]\") && !t.closest(\"button, a, input, [role=button]\"))) {\n          e.preventDefault();\n          e.currentTarget.querySelector<HTMLElement>(\"input, textarea\")?.focus();\n        }\n      }}\n    >\n      {leading && (\n        <span\n          data-slot=\"field-adornment\"\n          data-adornment=\"leading\"\n          className={cn(styles.adornment, classNames?.leading)}\n        >\n          {leading}\n        </span>\n      )}\n      {children}\n      {status && (\n        // one ring for both: it spins while the value is checked and closes into the check when it works\n        <span data-slot=\"field-status\" data-adornment=\"status\" className={styles.status}>\n          <Spinner size=\"sm\" state={status === \"busy\" ? \"loading\" : \"success\"} label={statusLabel} />\n        </span>\n      )}\n      {trailing && (\n        <span\n          data-slot=\"field-adornment\"\n          data-adornment=\"trailing\"\n          className={cn(styles.adornment, classNames?.trailing)}\n        >\n          {trailing}\n        </span>\n      )}\n    </div>\n  );\n}\n\n/**\n * A character count for the label's row (Field `aside`): quiet (\"58/140\") and shown while the field has attention,\n * then always shown and in words as the limit nears (\"12 left\", \"Limit reached\", \"3 over\"), so it never competes with\n * the label at rest. Assistive tech hears it only when it crosses into those words, not at every key.\n */\nexport function FieldCount({\n  length,\n  max,\n  near: nearAt,\n  slot = \"field-count\",\n  className,\n}: {\n  length: number;\n  max: number;\n  /** How many left turns it into words: by default 10 % of the limit, at least 5 (characters); 1 suits a few tags. */\n  near?: number;\n  slot?: string;\n  className?: string;\n}) {\n  const i18n = useMessages(\"_shared\", english);\n  const left = max - length;\n  const near = left <= (nearAt ?? Math.max(5, Math.ceil(max * 0.1)));\n  const state = left < 0 ? \"over\" : left === 0 ? \"full\" : near ? \"near\" : \"room\";\n  const words =\n    state === \"over\"\n      ? i18n(\"fieldOver\", { count: -left })\n      : state === \"full\"\n        ? i18n(\"fieldFull\")\n        : i18n(\"fieldLeft\", { count: left });\n  return (\n    <span\n      data-slot={slot}\n      data-state={state}\n      data-shown={state === \"room\" ? undefined : \"\"}\n      className={cn(\"reveal\", styles.count, className)}\n    >\n      <span aria-hidden>{state === \"room\" ? `${i18n.number(length)}/${i18n.number(max)}` : words}</span>\n      <span className=\"sr-only\" aria-live=\"polite\">\n        {state === \"room\" ? \"\" : words}\n      </span>\n    </span>\n  );\n}\n\n/** The class a native input or textarea needs inside a FieldFrame. */\nexport const fieldControlClass = styles.control;\n\n/** What a choice group (segmented control, radio cards) spreads onto its own root when it is a form field. */\nexport interface ChoiceFieldAria {\n  \"aria-labelledby\": string;\n  \"aria-describedby\"?: string;\n  \"aria-invalid\"?: true;\n}\n\n/**\n * Whether a choice control (segmented control, radio cards, chip group) is laid out as a form field, its label shown\n * above like every field's: when asked (`field`), when it has a description, error or required mark, and whenever its\n * label is not hidden. A view switch or a quick filter passes `hideLabel`: its label stays for assistive tech only.\n * (Trials t16 and t19: agents wrote <SegmentedControl label=\"Catering needed\" …> and the question never showed.)\n */\nexport function choiceIsField(\n  field: boolean | undefined,\n  label: ReactNode,\n  hideLabel: boolean | undefined,\n  marked: boolean,\n) {\n  return field ?? (marked || (label != null && label !== \"\" && !hideLabel));\n}\n\n/**\n * A choice group as a form field: the visible label above (with the required marker), the group, then its help or its\n * problem — the same frame and message every text field has. Groups that name themselves only for assistive tech\n * (a view switch in a toolbar) do not use it.\n */\nexport function ChoiceField({\n  slot,\n  label,\n  hideLabel,\n  required,\n  description,\n  error,\n  className,\n  style,\n  classNames,\n  requiredOnControl,\n  children,\n}: Omit<FieldOptions, \"size\" | \"success\"> & {\n  slot: string;\n  /** The group carries `aria-required` itself (a radiogroup), so the label does not repeat it in the group's name. */\n  requiredOnControl?: boolean;\n  className?: string;\n  style?: CSSProperties;\n  classNames?: Pick<FieldClassNames, \"label\" | \"description\" | \"error\">;\n  children: (aria: ChoiceFieldAria) => ReactNode;\n}) {\n  const auto = useId();\n  const labelId = `choice-${auto}-label`;\n  const messageId = error || description ? `choice-${auto}-message` : undefined;\n  return (\n    <div data-slot={slot} data-invalid={error ? \"\" : undefined} style={style} className={cn(styles.field, className)}>\n      <Label\n        id={labelId}\n        required={required}\n        requiredOnControl={requiredOnControl}\n        className={cn(\"text-label\", hideLabel && \"sr-only\", classNames?.label)}\n      >\n        {label}\n      </Label>\n      {children({\n        \"aria-labelledby\": labelId,\n        ...(messageId ? { \"aria-describedby\": messageId } : {}),\n        ...(error ? { \"aria-invalid\": true as const } : {}),\n      })}\n      <FieldMessage\n        error={error}\n        description={description}\n        errorId={messageId}\n        descriptionId={messageId}\n        classNames={classNames}\n      />\n    </div>\n  );\n}\n"},{"path":"beamline/components/_shared/glide.tsx","type":"registry:file","target":"src/ui/beamline/components/_shared/glide.tsx","content":"\"use client\";\n\nimport { useEffect, useLayoutEffect, useRef, useState, type RefObject } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport overlay from \"./overlay.module.css\";\n\n/**\n * The gliding highlight for a list whose active row is tracked in state (command menu, listbox): one plate travels to\n * the active row for the arrow keys and the pointer alike, over --pui-duration-fast. It appears in place (no travel)\n * the first time and whenever `reset` changes (a new page or a new query), so typing never sends it flying.\n * The list must be the plate's offset parent (position: relative); rows stay above it (overlay.item is z-index 1).\n */\nexport function GlidePlate({\n  list,\n  selector,\n  reset,\n  axis = \"y\",\n  className,\n}: {\n  list: RefObject<HTMLElement | null>;\n  /** Finds the active row inside `list`; null when nothing is active. */\n  selector: string | null;\n  reset?: unknown;\n  /** \"y\" for a list (the plate spans the width); \"xy\" for a row or grid of cells (it takes each cell's size). */\n  axis?: \"y\" | \"xy\";\n  className?: string;\n}) {\n  const [plate, setPlate] = useState<{ x: number; y: number; w: number; h: number; jump: boolean } | null>(null);\n  const lastReset = useRef(reset);\n  const self = useRef<HTMLSpanElement>(null);\n  // eslint-disable-next-line react-hooks/exhaustive-deps -- every render on purpose; setPlate bails out when unchanged\n  useLayoutEffect(() => {\n    // the list holds the plate, and React attaches a parent's ref only after its children's layout effects: on the\n    // first commit the list is the plate's own parent (it placed itself only when something rendered again later)\n    const host = list.current ?? self.current?.parentElement;\n    const row = selector ? host?.querySelector<HTMLElement>(selector) : null;\n    const fresh = lastReset.current !== reset;\n    lastReset.current = reset;\n    if (!row) {\n      setPlate((p) => (p && p.h ? { ...p, h: 0 } : p));\n      return;\n    }\n    const x = row.offsetLeft,\n      y = row.offsetTop,\n      w = row.offsetWidth,\n      h = row.offsetHeight;\n    setPlate((p) =>\n      p && p.x === x && p.y === y && p.w === w && p.h === h && !fresh ? p : { x, y, w, h, jump: fresh || !p?.h },\n    );\n    // every render: rows can arrive or change height without the selector changing; an unchanged place keeps the state\n  });\n  return (\n    <span\n      ref={self}\n      aria-hidden\n      data-slot=\"list-highlight\"\n      className={cn(overlay.glide, className)}\n      data-on={plate?.h ? \"\" : undefined}\n      data-jump={plate?.jump ? \"\" : undefined}\n      data-axis={axis}\n      style={\n        !plate\n          ? undefined\n          : axis === \"y\"\n            ? { transform: `translateY(${plate.y}px)`, height: plate.h || undefined }\n            : { transform: `translate(${plate.x}px, ${plate.y}px)`, width: plate.w, height: plate.h || undefined }\n      }\n    />\n  );\n}\n\n/**\n * A GlidePlate for lists whose highlight is the pointer or keyboard focus rather than state (time picker, plain option\n * lists): it follows the row under the pointer or holding focus, and fades when neither is in the list. Rows drop\n * their own hover and focus tint.\n */\nexport function FollowPlate({\n  list,\n  rows,\n  className,\n}: {\n  list: RefObject<HTMLElement | null>;\n  /** Matches a row inside `list`, e.g. \"[role=option]\". */\n  rows: string;\n  className?: string;\n}) {\n  const [hot, setHot] = useState<string | null>(null);\n  // after the commit, when the list's ref is attached (a layout effect here ran before it and never listened)\n  useEffect(() => {\n    const el = list.current;\n    if (!el) return;\n    let n = 0;\n    const mark = (target: EventTarget | null) => {\n      const row = (target as HTMLElement | null)?.closest?.<HTMLElement>(rows);\n      if (!row || !el.contains(row)) return;\n      row.dataset.glideKey ??= String(++n);\n      setHot(row.dataset.glideKey);\n    };\n    const over = (e: Event) => mark(e.target);\n    const leave = () => {\n      if (!el.contains(document.activeElement)) setHot(null);\n    };\n    const blur = (e: FocusEvent) => {\n      if (!el.contains(e.relatedTarget as Node)) setHot(null);\n    };\n    el.addEventListener(\"pointerover\", over);\n    el.addEventListener(\"focusin\", over);\n    el.addEventListener(\"pointerleave\", leave);\n    el.addEventListener(\"focusout\", blur);\n    return () => {\n      el.removeEventListener(\"pointerover\", over);\n      el.removeEventListener(\"focusin\", over);\n      el.removeEventListener(\"pointerleave\", leave);\n      el.removeEventListener(\"focusout\", blur);\n    };\n  }, [list, rows]);\n  return <GlidePlate list={list} selector={hot ? `[data-glide-key=\"${hot}\"]` : null} className={className} />;\n}\n"},{"path":"beamline/components/_shared/match.tsx","type":"registry:file","target":"src/ui/beamline/components/_shared/match.tsx","content":"/** One way to rank and mark matches for every search-as-you-type list (command menu, combobox, multi-select). */\n\n/** How well `label` (and its keywords) answers `query`: label start 100, word start 80, anywhere 60, keyword 45,\n *  every word of a several-word query found across label, keywords and description 40 (50 when one starts the label:\n *  \"billing city\" finds Billing address › City), description 30, letters in order 15, no match 0. An empty query\n *  matches everything with 1. */\nexport function rank(query: string, label: string, keywords?: string[], description?: string): number {\n  const q = query.trim().toLowerCase();\n  if (!q) return 1;\n  const l = label.toLowerCase();\n  const at = l.indexOf(q);\n  if (at === 0) return 100 - l.length / 100;\n  if (at > 0 && /[\\s\\-/(_.]/.test(l[at - 1])) return 80;\n  if (at > 0) return 60;\n  if (keywords?.some((k) => k.toLowerCase().includes(q))) return 45;\n  const words = q.split(/\\s+/);\n  if (words.length > 1) {\n    const hay = [l, ...(keywords ?? []).map((k) => k.toLowerCase()), description?.toLowerCase() ?? \"\"];\n    if (words.every((w) => hay.some((h) => h.includes(w)))) return words.some((w) => l.startsWith(w)) ? 50 : 40;\n  }\n  if (description?.toLowerCase().includes(q)) return 30;\n  let i = 0;\n  for (const ch of l) if (ch === q[i]) i++;\n  return i === q.length ? 15 : 0;\n}\n\n/** Sorts by rank (best first, original order for ties) and drops non-matches. */\nexport function filterRanked<T>(\n  items: T[],\n  query: string,\n  get: (item: T) => { label: string; keywords?: string[]; description?: string },\n): T[] {\n  if (!query.trim()) return items;\n  return items\n    .map((item, order) => {\n      const g = get(item);\n      return { item, order, s: rank(query, g.label, g.keywords, g.description) };\n    })\n    .filter((r) => r.s > 0)\n    .sort((a, b) => b.s - a.s || a.order - b.order)\n    .map((r) => r.item);\n}\n\n/** The label with the matched run emphasised. */\nexport function Highlight({ text, query }: { text: string; query: string }) {\n  const q = query.trim().toLowerCase();\n  const at = q ? text.toLowerCase().indexOf(q) : -1;\n  if (at < 0) return <>{text}</>;\n  return (\n    <>\n      {text.slice(0, at)}\n      <mark className=\"bg-transparent font-medium text-ink\">{text.slice(at, at + q.length)}</mark>\n      {text.slice(at + q.length)}\n    </>\n  );\n}\n"},{"path":"beamline/components/_shared/menu.tsx","type":"registry:file","target":"src/ui/beamline/components/_shared/menu.tsx","content":"\"use client\";\n\nimport {\n  Fragment,\n  useCallback,\n  useRef,\n  useState,\n  type ComponentType,\n  type FocusEvent,\n  type ReactNode,\n  type Ref,\n} from \"react\";\nimport { Check, ChevronRight } from \"lucide-react\";\nimport { useDirection } from \"@radix-ui/react-direction\";\nimport { cn } from \"../../lib/utils\";\nimport { useComposedRef } from \"../../hooks/use-composed-ref\";\nimport overlay from \"./overlay.module.css\";\n\nexport interface MenuClassNames {\n  /** Classes for the root part; no override by default. */\n  root?: string;\n  /** Classes for the trigger part; no override by default. */\n  trigger?: string;\n  /** Classes for the content part; no override by default. */\n  content?: string;\n  /** Classes for the submenu part; no override by default. */\n  submenu?: string;\n  /** Classes for the indicator part; no override by default. */\n  indicator?: string;\n  /** Classes for the item part; no override by default. */\n  item?: string;\n  /** Classes for the label part; no override by default. */\n  label?: string;\n  /** Classes for the shortcut part; no override by default. */\n  shortcut?: string;\n  /** Classes for the check part; no override by default. */\n  check?: string;\n  /** Classes for the separator part; no override by default. */\n  separator?: string;\n  /** Classes for the heading part; no override by default. */\n  heading?: string;\n  /** Classes for the chevron part; no override by default. */\n  chevron?: string;\n}\n\n/** One row of any menu in the system (dropdown, context menu, menu bar). The same data renders the same everywhere. */\nexport interface MenuItem {\n  /** Stable key; the label is used when absent. */\n  id?: string;\n  /** Text displayed for this item. Required. */\n  label: ReactNode;\n  /** Icon element displayed with this item. Omitted by default. */\n  icon?: ReactNode;\n  /** A shortcut shown at the end, e.g. \"⌘D\". The app binds the key. */\n  shortcut?: string;\n  /** Runs when this item is activated. Omitted by default. */\n  onSelect?: (event: Event) => void;\n  /** Whether this option is unavailable for selection. Omitted by default. */\n  disabled?: boolean;\n  /** danger: a destructive action (red). */\n  tone?: \"danger\";\n  /** A line above this item. */\n  separatorBefore?: boolean;\n  /** A small heading above this item, starting a group. */\n  heading?: string;\n  /** A checkable item; shows a check when true. */\n  checked?: boolean;\n  /** checkbox (default when checked is set) stays open when toggled; radio is one of a set and closes the menu. */\n  type?: \"checkbox\" | \"radio\";\n  /** A submenu. */\n  items?: MenuItem[];\n}\n\ntype Part = ComponentType<any>; // eslint-disable-line @typescript-eslint/no-explicit-any -- Radix menu namespaces share part names, not prop types\n/** The Radix parts a menu needs; DropdownMenu, ContextMenu and Menubar all provide them. */\nexport interface MenuKit {\n  Content: Part;\n  SubContent: Part;\n  Item: Part;\n  CheckboxItem: Part;\n  ItemIndicator: Part;\n  Sub: Part;\n  SubTrigger: Part;\n  Separator: Part;\n  Label: Part;\n  Portal: Part;\n}\n\n/** The reading direction a menu should open in: an explicit one, else the direction in force around its trigger (read\n *  when the trigger mounts and again as it is pressed, right-clicked or keyed), else a Direction provider. Without it\n *  Radix falls back to \"ltr\", so a portalled menu on an RTL page reads left to right, opens submenus to the right and\n *  answers → instead of ←. Spread `triggerProps` on the Radix trigger and pass `dir` to the Radix root. */\nexport function useMenuDirection(explicit?: \"ltr\" | \"rtl\") {\n  const provided = useDirection();\n  const [around, setAround] = useState<\"ltr\" | \"rtl\">();\n  const read = useCallback((el: Element | null) => {\n    if (el) setAround(getComputedStyle(el).direction === \"rtl\" ? \"rtl\" : \"ltr\");\n  }, []);\n  const measure = useCallback((e: { currentTarget: Element }) => read(e.currentTarget), [read]);\n  return {\n    dir: explicit ?? around ?? provided,\n    triggerProps: {\n      ref: read,\n      onPointerDownCapture: measure,\n      onKeyDownCapture: measure,\n      onContextMenuCapture: measure,\n    },\n  };\n}\n\n/** The floating list: one surface and one highlight plate that glides between rows, under the pointer and the arrow\n *  keys alike. Extra props (align, side, sideOffset) go to the Radix content part. */\nexport function MenuSurface({\n  kit,\n  sub = false,\n  label,\n  className,\n  classNames,\n  children,\n  ref,\n  ...rest\n}: {\n  kit: MenuKit;\n  sub?: boolean;\n  label?: string;\n  className?: string;\n  classNames?: MenuClassNames;\n  children: ReactNode;\n  ref?: Ref<HTMLDivElement>;\n} & Record<string, unknown>) {\n  const surface = useRef<HTMLDivElement | null>(null);\n  // the portal's presence passes its own ref (it watches the exit animation); keep both\n  const attach = useComposedRef(surface, ref);\n  const [plate, setPlate] = useState<{ y: number; h: number; jump: boolean } | null>(null);\n  const Part = sub ? kit.SubContent : kit.Content;\n  const { onFocusOutside, ...others } = rest as { onFocusOutside?: (event: Event) => void };\n  return (\n    <Part\n      ref={attach}\n      data-slot={sub ? \"menu-submenu\" : \"menu\"}\n      aria-label={label}\n      collisionPadding={8}\n      loop\n      {...(sub ? { sideOffset: 2, alignOffset: -4 } : {})}\n      {...others}\n      // a surface still playing its exit is already closed: the focus that moves into the next menu of a menu bar\n      // must not count as \"outside\" and close the whole bar (Radix would reset the bar's open menu to none)\n      onFocusOutside={(event: Event) => {\n        if (surface.current?.dataset.state === \"closed\") event.preventDefault();\n        onFocusOutside?.(event);\n      }}\n      className={cn(\n        overlay.surface,\n        overlay.menu,\n        \"relative min-w-[11rem]\",\n        sub ? classNames?.submenu : classNames?.content,\n        className,\n      )}\n      // React events cross portals: only rows of this surface move its plate (a submenu has its own)\n      onFocusCapture={(e: FocusEvent<HTMLDivElement>) => {\n        const item = (e.target as HTMLElement).closest<HTMLElement>(\"[data-menu-item]\");\n        if (item && !surface.current?.contains(item)) return;\n        if (!item) {\n          setPlate((p) => (p ? { ...p, h: 0 } : p));\n          return;\n        }\n        setPlate((p) => ({ y: item.offsetTop, h: item.offsetHeight, jump: !p?.h }));\n      }}\n      // while a submenu is open, its trigger keeps the plate\n      onPointerLeave={() => {\n        if (!surface.current?.querySelector(\":scope > [data-menu-item][data-state=open]\"))\n          setPlate((p) => (p ? { ...p, h: 0 } : p));\n      }}\n    >\n      <span\n        aria-hidden\n        data-slot=\"menu-indicator\"\n        className={cn(overlay.glide, classNames?.indicator)}\n        data-on={plate?.h ? \"\" : undefined}\n        data-jump={plate?.jump ? \"\" : undefined}\n        style={plate ? { transform: `translateY(${plate.y}px)`, height: plate.h || undefined } : undefined}\n      />\n      {children}\n    </Part>\n  );\n}\n\n/** Rows for a MenuItem list, in any kit. */\nexport function MenuItems({\n  kit,\n  items,\n  container,\n  classNames,\n}: {\n  kit: MenuKit;\n  items: MenuItem[];\n  container?: HTMLElement | null;\n  classNames?: MenuClassNames;\n}) {\n  return items.map((item, i) => {\n    const tone = item.tone;\n    const common = {\n      \"data-menu-item\": \"\",\n      \"data-slot\": \"menu-item\",\n      \"data-glide\": \"\",\n      \"data-tone\": tone,\n      className: cn(overlay.item, classNames?.item),\n      disabled: item.disabled,\n    };\n    const content = (\n      <>\n        {item.icon}\n        <span data-slot=\"menu-label\" dir=\"auto\" className={cn(\"min-w-0 truncate\", classNames?.label)}>\n          {item.label}\n        </span>\n        {item.shortcut && (\n          <span data-slot=\"menu-shortcut\" dir=\"ltr\" className={cn(overlay.shortcut, classNames?.shortcut)}>\n            {item.shortcut}\n          </span>\n        )}\n      </>\n    );\n    let node: ReactNode;\n    if (item.items?.length) {\n      node = (\n        <kit.Sub>\n          <kit.SubTrigger {...common}>\n            {content}\n            <ChevronRight data-slot=\"menu-chevron\" className={cn(\"ms-auto rtl:rotate-180\", classNames?.chevron)} />\n          </kit.SubTrigger>\n          {container !== null && (\n            <kit.Portal container={container}>\n              <MenuSurface kit={kit} sub classNames={classNames}>\n                <MenuItems kit={kit} items={item.items} container={container} classNames={classNames} />\n              </MenuSurface>\n            </kit.Portal>\n          )}\n        </kit.Sub>\n      );\n    } else if (item.checked !== undefined && item.type === \"radio\") {\n      node = (\n        <kit.Item {...common} role=\"menuitemradio\" aria-checked={item.checked} onSelect={item.onSelect}>\n          {content}\n          <span data-slot=\"menu-check\" className={cn(overlay.check, classNames?.check)}>\n            {item.checked && <Check />}\n          </span>\n        </kit.Item>\n      );\n    } else if (item.checked !== undefined) {\n      node = (\n        <kit.CheckboxItem\n          {...common}\n          checked={item.checked}\n          onSelect={(e: Event) => {\n            e.preventDefault();\n            item.onSelect?.(e);\n          }}\n        >\n          {content}\n          <kit.ItemIndicator data-slot=\"menu-check\" className={cn(overlay.check, classNames?.check)}>\n            <Check />\n          </kit.ItemIndicator>\n        </kit.CheckboxItem>\n      );\n    } else {\n      node = (\n        <kit.Item {...common} onSelect={item.onSelect}>\n          {content}\n        </kit.Item>\n      );\n    }\n    return (\n      <Fragment key={item.id ?? (typeof item.label === \"string\" ? item.label : i)}>\n        {item.separatorBefore && i > 0 && (\n          <kit.Separator data-slot=\"menu-separator\" className={cn(overlay.separator, classNames?.separator)} />\n        )}\n        {item.heading && (\n          <kit.Label data-slot=\"menu-heading\" className={cn(overlay.heading, classNames?.heading)}>\n            {item.heading}\n          </kit.Label>\n        )}\n        {node}\n      </Fragment>\n    );\n  });\n}\n"},{"path":"beamline/components/_shared/messages.ts","type":"registry:file","target":"src/ui/beamline/components/_shared/messages.ts","content":"import type { MessageDefinitions } from \"../../runtime/messages\";\n/** Built-in English copy for this helper only. */\nexport const english = {\n  results: {\n    one: \"{count} result\",\n    other: \"{count} results\",\n  },\n  noMatch: \"No match for {query}\",\n  fieldOver: \"{count} over\",\n  fieldFull: \"Limit reached\",\n  fieldLeft: \"{count} left\",\n  foldMore: \"{list} and {count} more\",\n  foldShow: \"Show {count} more {noun}: {list}\",\n  statusLabel: \"Checking\",\n} satisfies MessageDefinitions;\n"},{"path":"beamline/components/_shared/overlay.module.css","type":"registry:file","target":"src/ui/beamline/components/_shared/overlay.module.css","content":"@layer properties, theme, base, components, utilities;\n/* the source morph's moving parts: the clip's four sides, the radius and the offset back to the trigger */\n@property --ci-t {\n  syntax: \"<length-percentage>\";\n  inherits: false;\n  initial-value: -48px;\n}\n@property --ci-r {\n  syntax: \"<length-percentage>\";\n  inherits: false;\n  initial-value: -48px;\n}\n@property --ci-b {\n  syntax: \"<length-percentage>\";\n  inherits: false;\n  initial-value: -48px;\n}\n@property --ci-l {\n  syntax: \"<length-percentage>\";\n  inherits: false;\n  initial-value: -48px;\n}\n@property --ci-x {\n  syntax: \"<length>\";\n  inherits: false;\n  initial-value: 0px;\n}\n@property --ci-y {\n  syntax: \"<length>\";\n  inherits: false;\n  initial-value: 0px;\n}\n@layer components {\n  /* Every floating layer in the system: one surface (painted by the overlay role of the look in force), one menu-item\n   look, one scrim, one enter and exit. A layer placed against a trigger opens out of it (the source morph below); one\n   without a placement arrives in --pui-motion-in scaling from its origin. Each leaves in --pui-motion-out; Radix keeps\n   it mounted until the exit animation ends. Reduced motion makes both instant (the duration tokens become 1ms). */\n  .surface {\n    z-index: var(--pui-z-popover);\n    min-width: 8rem;\n    /* never past the screen: as wide and as tall as the room beside the trigger (Radix measures it) */\n    max-width: var(--radix-popper-available-width, none);\n    max-height: var(--radix-popper-available-height, 70vh);\n    overflow: auto;\n    border-radius: var(--pui-overlay-radius, var(--pui-radius-card));\n    color: var(--pui-ink);\n    transform-origin: var(--radix-popper-transform-origin, var(--radix-dropdown-menu-content-transform-origin, center));\n    outline: none;\n  }\n  .surface[data-state=\"open\"],\n  .surface[data-state=\"delayed-open\"],\n  .surface[data-state=\"instant-open\"] {\n    animation: pop-in var(--pui-motion-in) var(--pui-ease-default);\n  }\n  .surface[data-state=\"closed\"] {\n    animation: pop-out var(--pui-motion-out) var(--pui-ease-default) forwards;\n  }\n\n  /* The source morph (research/morphing-interfaces-2026-10-04, M3): a layer placed against a trigger does not fade in\n     beside it, it opens out of it. It starts as the trigger's own box (Radix gives its size and the side and alignment\n     it was placed on), offset back onto the trigger, and grows: the side nearest the trigger is there at once, the\n     sides across follow, the far side arrives last (~200 ms), so the rows by the trigger are readable within the\n     ruled 90 ms while the outline settles. Content fades in over those 90 ms. It closes back into the trigger in the\n     ruled 180 ms. The clip ends 48px outside the box so the layer's shadow is never cut. Reduced motion: instant. */\n  .surface[data-side] {\n    --_aw: var(--radix-popper-anchor-width, 0px);\n    --_ah: var(--radix-popper-anchor-height, 0px);\n    --_gap: 6px;\n    --from-t: -48px;\n    --from-r: -48px;\n    --from-b: -48px;\n    --from-l: -48px;\n    --from-x: 0px;\n    --from-y: 0px;\n    --d-near: calc(var(--pui-duration-standard) * 0.55);\n    --d-cross: calc(var(--pui-duration-standard) * 0.85);\n    --d-far: var(--pui-duration-standard);\n    clip-path: inset(\n      var(--ci-t) var(--ci-r) var(--ci-b) var(--ci-l) round var(--pui-overlay-radius, var(--pui-radius-card))\n    );\n    translate: var(--ci-x) var(--ci-y);\n  }\n  .surface[data-side=\"bottom\"] {\n    --from-t: 0px;\n    --from-b: calc(100% - var(--_ah));\n    --from-y: calc(-1 * (var(--_ah) + var(--_gap)));\n    --d-t: var(--d-near);\n    --d-b: var(--d-far);\n    --d-l: var(--d-cross);\n    --d-r: var(--d-cross);\n  }\n  .surface[data-side=\"top\"] {\n    --from-b: 0px;\n    --from-t: calc(100% - var(--_ah));\n    --from-y: calc(var(--_ah) + var(--_gap));\n    --d-b: var(--d-near);\n    --d-t: var(--d-far);\n    --d-l: var(--d-cross);\n    --d-r: var(--d-cross);\n  }\n  .surface[data-side=\"right\"] {\n    --from-l: 0px;\n    --from-r: calc(100% - var(--_aw));\n    --from-x: calc(-1 * (var(--_aw) + var(--_gap)));\n    --d-l: var(--d-near);\n    --d-r: var(--d-far);\n    --d-t: var(--d-cross);\n    --d-b: var(--d-cross);\n  }\n  .surface[data-side=\"left\"] {\n    --from-r: 0px;\n    --from-l: calc(100% - var(--_aw));\n    --from-x: calc(var(--_aw) + var(--_gap));\n    --d-r: var(--d-near);\n    --d-l: var(--d-far);\n    --d-t: var(--d-cross);\n    --d-b: var(--d-cross);\n  }\n  /* alignment along the trigger: which part of the layer the trigger sits over */\n  .surface:is([data-side=\"bottom\"], [data-side=\"top\"])[data-align=\"start\"] {\n    --from-l: 0px;\n    --from-r: calc(100% - var(--_aw));\n  }\n  .surface:is([data-side=\"bottom\"], [data-side=\"top\"])[data-align=\"end\"] {\n    --from-l: calc(100% - var(--_aw));\n    --from-r: 0px;\n  }\n  .surface:is([data-side=\"bottom\"], [data-side=\"top\"])[data-align=\"start\"]:dir(rtl) {\n    --from-l: calc(100% - var(--_aw));\n    --from-r: 0px;\n  }\n  .surface:is([data-side=\"bottom\"], [data-side=\"top\"])[data-align=\"end\"]:dir(rtl) {\n    --from-l: 0px;\n    --from-r: calc(100% - var(--_aw));\n  }\n  .surface:is([data-side=\"bottom\"], [data-side=\"top\"])[data-align=\"center\"] {\n    --from-l: calc((100% - var(--_aw)) / 2);\n    --from-r: calc((100% - var(--_aw)) / 2);\n  }\n  .surface:is([data-side=\"left\"], [data-side=\"right\"])[data-align=\"start\"] {\n    --from-t: 0px;\n    --from-b: calc(100% - var(--_ah));\n  }\n  .surface:is([data-side=\"left\"], [data-side=\"right\"])[data-align=\"end\"] {\n    --from-t: calc(100% - var(--_ah));\n    --from-b: 0px;\n  }\n  .surface:is([data-side=\"left\"], [data-side=\"right\"])[data-align=\"center\"] {\n    --from-t: calc((100% - var(--_ah)) / 2);\n    --from-b: calc((100% - var(--_ah)) / 2);\n  }\n  .surface[data-side]:is([data-state=\"open\"], [data-state=\"delayed-open\"], [data-state=\"instant-open\"]) {\n    animation:\n      grow-t var(--d-t) var(--pui-ease-out-strong),\n      grow-r var(--d-r) var(--pui-ease-out-strong),\n      grow-b var(--d-b) var(--pui-ease-out-strong),\n      grow-l var(--d-l) var(--pui-ease-out-strong),\n      grow-xy var(--d-cross) var(--pui-ease-out-strong),\n      settling var(--d-far) step-end;\n  }\n  .surface[data-side]:is([data-state=\"open\"], [data-state=\"delayed-open\"], [data-state=\"instant-open\"]) > * {\n    animation: content-in var(--pui-motion-in) var(--pui-ease-default) both;\n  }\n  /* one duration for every part of the exit: the layer unmounts when the first of them ends */\n  .surface[data-side][data-state=\"closed\"] {\n    animation: shrink var(--pui-motion-out) var(--pui-ease-exit) forwards;\n  }\n  .surface[data-side][data-state=\"closed\"] > * {\n    animation: content-out var(--pui-motion-in) var(--pui-ease-default) forwards;\n  }\n  @keyframes grow-t {\n    from {\n      --ci-t: var(--from-t);\n    }\n  }\n  @keyframes grow-r {\n    from {\n      --ci-r: var(--from-r);\n    }\n  }\n  @keyframes grow-b {\n    from {\n      --ci-b: var(--from-b);\n    }\n  }\n  @keyframes grow-l {\n    from {\n      --ci-l: var(--from-l);\n    }\n  }\n  @keyframes grow-xy {\n    from {\n      --ci-x: var(--from-x);\n      --ci-y: var(--from-y);\n    }\n  }\n  /* it starts over its own trigger: until it has grown, the press that opened it must not land on a row */\n  @keyframes settling {\n    0%,\n    100% {\n      pointer-events: none;\n    }\n  }\n  @keyframes shrink {\n    to {\n      --ci-t: var(--from-t);\n      --ci-r: var(--from-r);\n      --ci-b: var(--from-b);\n      --ci-l: var(--from-l);\n      --ci-x: var(--from-x);\n      --ci-y: var(--from-y);\n      opacity: 0;\n    }\n  }\n  @keyframes content-in {\n    from {\n      opacity: 0;\n    }\n  }\n  @keyframes content-out {\n    to {\n      opacity: 0;\n    }\n  }\n  .padded {\n    padding: var(--pui-pad-popover);\n  }\n  .menu {\n    padding: var(--pui-space-1);\n  }\n  @keyframes pop-in {\n    from {\n      opacity: 0;\n      transform: scale(0.97);\n    }\n  }\n  @keyframes pop-out {\n    to {\n      opacity: 0;\n      transform: scale(0.98);\n    }\n  }\n\n  /* rows (and the gliding plate) nest in the list: its radius minus its padding, never rounder than a chip; on the\n     row itself, so any list that uses .item gets it */\n  .item,\n  .glide {\n    --_item-radius: min(\n      var(--pui-radius-chip),\n      calc(var(--pui-overlay-radius, var(--pui-radius-card)) - var(--pui-space-1))\n    );\n  }\n\n  /* menu rows: shared by dropdown, context menu, menubar, select, combobox lists */\n  .item {\n    position: relative;\n    z-index: 1;\n    display: flex;\n    align-items: center;\n    gap: var(--pui-space-2);\n    min-height: var(--pui-control-height-sm);\n    padding: 0 var(--pui-space-2);\n    /* nested in the list: the overlay's radius minus its padding, never rounder than a chip */\n    border-radius: var(--_item-radius);\n    color: var(--pui-ink);\n    font-size: var(--pui-text-sm);\n    cursor: default;\n    user-select: none;\n    outline: none;\n  }\n  /* on a touch screen a row is a finger's target: the touch height (44px) from the tokens; a mouse keeps the dense row */\n  @media (pointer: coarse) {\n    .item {\n      min-height: var(--pui-control-height-touch);\n    }\n  }\n  /* a destructive row speaks in the danger ink only while it can be used: disabled wins (muted ink, no alarm for an\n     action that cannot happen) */\n  .item[data-tone=\"danger\"]:not([data-disabled]) {\n    color: var(--pui-red);\n  }\n  .item[data-disabled] {\n    color: var(--pui-ink-3);\n    pointer-events: none;\n  }\n  .item :where(svg) {\n    width: var(--pui-icon-md);\n    height: var(--pui-icon-md);\n    flex-shrink: 0;\n    color: var(--pui-ink-3);\n  }\n  .item[data-tone=\"danger\"]:not([data-disabled]) :where(svg) {\n    color: currentColor;\n  }\n  .item[data-highlighted]:not([data-glide]) {\n    background: var(--pui-hover-2);\n  }\n  /* a press is acknowledged at once, over the plate, before the menu closes or the row toggles */\n  .item:active:not([data-disabled]) {\n    background: var(--pui-hover);\n  }\n  .shortcut {\n    margin-inline-start: auto;\n    padding-inline-start: var(--pui-space-4);\n    color: var(--pui-ink-3);\n    font-size: var(--pui-text-xs);\n    letter-spacing: var(--pui-tracking-mono-caps);\n  }\n  .heading {\n    padding: var(--pui-space-1-5) var(--pui-space-2) var(--pui-space-1);\n    color: var(--pui-ink-3);\n    font-size: var(--pui-text-xs);\n    font-weight: var(--pui-weight-medium);\n  }\n  .separator {\n    height: 1px;\n    margin: var(--pui-space-1) calc(var(--pui-space-1) * -1);\n    background: var(--pui-line);\n  }\n  .check {\n    margin-inline-start: auto;\n    color: var(--pui-accent) !important;\n  }\n  /* a check arrives in its row as the value changes (at once): it grows from the middle over the arrival */\n  .check :where(svg) {\n    animation: check-in var(--pui-motion-in) var(--pui-ease-out-strong);\n  }\n  @keyframes check-in {\n    from {\n      opacity: 0;\n      scale: calc(1 - 0.5 * var(--pui-motion-travel, 1));\n    }\n  }\n  /* the gliding highlight: one plate moves between rows for the pointer and the arrow keys; it appears in place */\n  .glide {\n    position: absolute;\n    z-index: 0;\n    inset-inline: var(--pui-space-1);\n    top: 0;\n    border-radius: var(--_item-radius);\n    background: var(--pui-hover-2);\n    pointer-events: none;\n    opacity: 0;\n    transition: opacity var(--pui-motion-out) var(--pui-ease-default);\n  }\n  .glide[data-on] {\n    opacity: 1;\n    transition:\n      transform var(--pui-duration-fast) var(--pui-ease-standard),\n      height var(--pui-duration-fast) var(--pui-ease-standard),\n      opacity 0ms;\n  }\n  .glide[data-jump] {\n    transition: opacity 0ms;\n  }\n  /* a plate over a row or grid of cells takes each cell's size and travels both ways */\n  .glide[data-axis=\"xy\"] {\n    inset-inline: auto;\n    left: 0;\n  }\n  .glide[data-axis=\"xy\"][data-on] {\n    transition:\n      transform var(--pui-duration-fast) var(--pui-ease-standard),\n      width var(--pui-duration-fast) var(--pui-ease-standard),\n      height var(--pui-duration-fast) var(--pui-ease-standard),\n      opacity 0ms;\n  }\n\n  /* a layer that has begun to close is out of the way at once: for the length of its exit it takes no pointer, so a tap\n     meant for the page behind (the next row, the button the panel covered) lands there, never on the leaving ghost.\n     Focus has already gone back (Radix) and it unmounts when the exit ends. */\n  .scrim[data-state=\"closed\"],\n  .surface[data-state=\"closed\"],\n  .dialog[data-state=\"closed\"],\n  .sheet[data-state=\"closed\"] {\n    pointer-events: none;\n  }\n\n  /* modal layers */\n  .scrim {\n    position: fixed;\n    inset: 0;\n    z-index: var(--pui-z-overlay);\n    background: var(--pui-scrim);\n    backdrop-filter: blur(var(--pui-blur-overlay));\n  }\n  .scrim[data-state=\"open\"] {\n    animation: fade-in var(--pui-fade-in) var(--pui-ease-default);\n  }\n  .scrim[data-state=\"closed\"] {\n    animation: fade-out var(--pui-fade-out) var(--pui-ease-default) forwards;\n  }\n  @keyframes fade-in {\n    from {\n      opacity: 0;\n    }\n  }\n  @keyframes fade-out {\n    to {\n      opacity: 0;\n    }\n  }\n  .dialog {\n    /* the content answers to the dialog's own width (a footer's buttons share the row on a phone) */\n    container-type: inline-size;\n    position: fixed;\n    z-index: var(--pui-z-modal);\n    left: 50%;\n    top: 50%;\n    width: min(calc(100vw - var(--pui-space-8)), var(--pui-dialog-width, var(--_dialog-width, 440px)));\n    max-height: calc(100dvh - var(--pui-space-12));\n    overflow: hidden;\n    translate: -50% -50%;\n    border-radius: var(--pui-dialog-radius, var(--pui-radius-window));\n    color: var(--pui-ink);\n    outline: none;\n    /* a size chosen while open (a step that needs more room) eases the width in place, centred */\n    transition: width var(--pui-duration-standard) var(--pui-ease-standard);\n  }\n  .dialog[data-state=\"open\"] {\n    animation: dialog-in var(--pui-duration-standard) var(--pui-ease-enter);\n  }\n  .dialog[data-state=\"closed\"] {\n    animation: dialog-out var(--pui-motion-out) var(--pui-ease-default) forwards;\n  }\n  /* A dialog opened from something (use-open-from.ts) grows out of it: it starts as the opener's box, offset back onto\n     it, and grows to its own place over the considered duration while its content fades in; it closes back into the\n     opener in the ruled 180 ms. Shares the source morph's moving parts and guard with .surface. */\n  .dialog[data-open-from] {\n    clip-path: inset(\n      var(--ci-t) var(--ci-r) var(--ci-b) var(--ci-l) round var(--pui-dialog-radius, var(--pui-radius-window))\n    );\n    transform: translate(var(--ci-x), var(--ci-y));\n  }\n  .dialog[data-open-from][data-state=\"open\"] {\n    animation:\n      grow-t var(--pui-duration-considered) var(--pui-ease-out-strong),\n      grow-r var(--pui-duration-considered) var(--pui-ease-out-strong),\n      grow-b var(--pui-duration-considered) var(--pui-ease-out-strong),\n      grow-l var(--pui-duration-considered) var(--pui-ease-out-strong),\n      grow-xy calc(var(--pui-duration-considered) * 0.9) var(--pui-ease-out-strong),\n      settling var(--pui-duration-considered) step-end;\n  }\n  .dialog[data-open-from][data-state=\"open\"] > * {\n    animation: content-in var(--pui-duration-standard) var(--pui-ease-default) calc(var(--pui-duration-standard) * 0.35)\n      both;\n  }\n  .dialog[data-open-from][data-state=\"closed\"] {\n    animation: shrink var(--pui-motion-out) var(--pui-ease-exit) forwards;\n  }\n  .dialog[data-open-from][data-state=\"closed\"] > * {\n    animation: content-out var(--pui-motion-in) var(--pui-ease-default) forwards;\n  }\n  /* A sheet: a panel from an edge. It slides in from its edge over the considered duration on the drawer curve and\n     goes back out to that edge in the ruled departure (a layer closes back into where it came from). The edge is\n     logical: an end (\"right\") sheet comes from the left in a right-to-left page. Its content answers to its width. */\n  .sheet {\n    --_sx: 0px;\n    --_sy: 0px;\n    container-type: inline-size;\n    /* where a finger has swiped it toward its edge (sheet.tsx); it settles back over the departure */\n    translate: var(--_swipe, 0px) 0;\n  }\n  /* a side panel leaves sideways pans to the swipe and keeps vertical scrolling native, in its body too */\n  .sheet:is([data-side=\"left\"], [data-side=\"right\"]),\n  .sheet:is([data-side=\"left\"], [data-side=\"right\"]) [data-slot=\"sheet-body\"] {\n    touch-action: pan-y;\n  }\n  .sheet:is([data-side=\"left\"], [data-side=\"right\"]) {\n    transition:\n      var(--m-transition),\n      translate var(--pui-motion-out) var(--pui-ease-default);\n  }\n  .sheet[data-swiping] {\n    transition: none;\n  }\n  .sheet[data-side=\"right\"] {\n    --_sx: 100%;\n  }\n  .sheet[data-side=\"left\"] {\n    --_sx: -100%;\n  }\n  .sheet[data-side=\"right\"]:dir(rtl) {\n    --_sx: -100%;\n  }\n  .sheet[data-side=\"left\"]:dir(rtl) {\n    --_sx: 100%;\n  }\n  .sheet[data-side=\"top\"] {\n    --_sy: -100%;\n  }\n  .sheet[data-side=\"bottom\"] {\n    --_sy: 100%;\n  }\n  .sheet[data-state=\"open\"] {\n    animation: sheet-in var(--pui-duration-considered) var(--pui-ease-drawer) both;\n  }\n  .sheet[data-state=\"closed\"] {\n    animation: sheet-out var(--pui-motion-out) var(--pui-ease-exit) forwards;\n  }\n  @keyframes sheet-in {\n    from {\n      translate: var(--_sx) var(--_sy);\n    }\n  }\n  @keyframes sheet-out {\n    to {\n      translate: var(--_sx) var(--_sy);\n    }\n  }\n  @keyframes dialog-in {\n    from {\n      opacity: 0;\n      transform: scale(0.96);\n    }\n  }\n  @keyframes dialog-out {\n    to {\n      opacity: 0;\n      transform: scale(0.98);\n    }\n  }\n}\n\n/* Reduced motion: surfaces and dialogs fade without scaling or growing, over the fade tokens (restrained under reduced,\n   1ms under none; APPEARANCE A06). */\n@media (prefers-reduced-motion: reduce) {\n  .surface,\n  .dialog,\n  .sheet {\n    animation-name: fade-in !important;\n    animation-duration: var(--pui-fade-in) !important;\n  }\n  .surface[data-state=\"closed\"],\n  .dialog[data-state=\"closed\"],\n  .sheet[data-state=\"closed\"] {\n    animation-name: fade-out !important;\n    animation-duration: var(--pui-fade-out) !important;\n  }\n}\n@layer components {\n  :global(.pui[data-motion=\"reduced\"]) .surface,\n  :global(.pui[data-motion=\"none\"]) .surface,\n  :global(.pui[data-motion=\"reduced\"]) .dialog,\n  :global(.pui[data-motion=\"none\"]) .dialog,\n  :global(.pui[data-motion=\"reduced\"]) .sheet,\n  :global(.pui[data-motion=\"none\"]) .sheet {\n    animation-name: fade-in;\n    animation-duration: var(--pui-fade-in);\n  }\n  :global(.pui[data-motion=\"reduced\"]) .surface[data-state=\"closed\"],\n  :global(.pui[data-motion=\"none\"]) .surface[data-state=\"closed\"],\n  :global(.pui[data-motion=\"reduced\"]) .dialog[data-state=\"closed\"],\n  :global(.pui[data-motion=\"none\"]) .dialog[data-state=\"closed\"],\n  :global(.pui[data-motion=\"reduced\"]) .sheet[data-state=\"closed\"],\n  :global(.pui[data-motion=\"none\"]) .sheet[data-state=\"closed\"] {\n    animation-name: fade-out;\n    animation-duration: var(--pui-fade-out);\n  }\n}\n/* CSS-module composition only; visual rules stay in the component layer. */\n.surface {\n  composes: m-overlay from global;\n}\n.dialog {\n  composes: m-overlay from global;\n}\n"},{"path":"beamline/components/_shared/use-return-focus.ts","type":"registry:file","target":"src/ui/beamline/components/_shared/use-return-focus.ts","content":"\"use client\";\n\nimport { useRef } from \"react\";\nimport { useAppearanceRoot } from \"../../runtime/appearance\";\n\n/**\n * Where focus goes when a modal layer closes. Radix returns it to its own Trigger; a layer opened another way (a\n * controlled `open`, a menu item, a shortcut) would drop focus on <body>. Spread the result on the Radix content: it\n * remembers what had focus as the layer opened and returns there, unless the caller's own handler prevents it.\n * If that opener is removed, return to its surviving owning region, or the managed scope's visual root.\n */\nexport function useReturnFocus({\n  onOpenAutoFocus,\n  onCloseAutoFocus,\n}: { onOpenAutoFocus?: (event: Event) => void; onCloseAutoFocus?: (event: Event) => void } = {}) {\n  track();\n  const before = useRef<HTMLElement | null>(null);\n  const regions = useRef<HTMLElement[]>([]);\n  const scope = useAppearanceRoot();\n  return {\n    onOpenAutoFocus: (event: Event) => {\n      before.current = outside(document.activeElement, event.currentTarget as Element | null);\n      const owners: HTMLElement[] = [];\n      let ancestor = before.current;\n      while (ancestor) {\n        if (ancestor !== document.body && ancestor.matches(\"[data-return-region]\")) owners.push(ancestor);\n        ancestor = ancestor.parentElement;\n      }\n      const root = scope ?? before.current?.closest<HTMLElement>(\".pui\");\n      if (root && root !== document.body && !owners.includes(root)) owners.push(root);\n      regions.current = owners;\n      onOpenAutoFocus?.(event);\n    },\n    /** `layer` is the layer's own element, for a caller that runs this itself instead of Radix. */\n    onCloseAutoFocus: (event: Event, layer: Element | null = event.currentTarget as Element | null) => {\n      onCloseAutoFocus?.(event);\n      if (event.defaultPrevented) return;\n      // a layer whose field took focus as it mounted (autoFocus) never hears that it opened (Radix skips the mount\n      // focus): the opener is then the last element focused outside it\n      const el =\n        before.current && before.current.isConnected && !layer?.contains?.(before.current)\n          ? before.current\n          : outside(null, layer);\n      if (el && el !== document.body && el.isConnected) {\n        event.preventDefault();\n        el.focus({ preventScroll: true });\n        return;\n      }\n      const region = regions.current.find((owner) => owner.isConnected);\n      if (region) {\n        event.preventDefault();\n        // Regions need not be tab stops, but they must receive programmatic return focus.\n        if (!region.hasAttribute(\"tabindex\")) region.tabIndex = -1;\n        region.focus({ preventScroll: true });\n      }\n    },\n  };\n}\n\n/** The last elements that took focus or were pressed, newest last, noted as it happened (capture phase, once per\n *  page). Presses count too: a click on a button does not focus it everywhere (Safari), and the control that was\n *  pressed is the opener a layer should give focus back to. */\nconst trail: Element[] = [];\nlet tracking = false;\nconst PRESSABLE =\n  \"button, a[href], [role=button], [role=menuitem], [role=option], [role=tab], [tabindex], input, select, textarea\";\nfunction note(el: Element | null) {\n  if (!el || el === document.body) return;\n  if (trail.at(-1) === el) return;\n  trail.push(el);\n  if (trail.length > 24) trail.shift();\n}\nfunction track() {\n  if (tracking || typeof document === \"undefined\") return;\n  tracking = true;\n  // A lazily mounted layer may be the first focus consumer on the page. Remember its opener before child autofocus.\n  note(document.activeElement);\n  document.addEventListener(\"focusin\", (event) => note(event.target as Element | null), true);\n  document.addEventListener(\n    \"pointerdown\",\n    (event) => note((event.target as Element | null)?.closest?.(PRESSABLE) ?? null),\n    true,\n  );\n}\n\n/** `active` unless it is inside `layer`; then the most recent element focused outside the layer that still exists. */\nfunction outside(active: Element | null, layer: Element | null): HTMLElement | null {\n  if (active && active !== document.body && !layer?.contains?.(active)) return active as HTMLElement;\n  for (let i = trail.length - 1; i >= 0; i--) {\n    const el = trail[i];\n    if (el.isConnected && el !== document.body && !layer?.contains?.(el)) return el as HTMLElement;\n  }\n  return null;\n}\n"},{"path":"beamline/components/avatar/avatar.module.css","type":"registry:file","target":"src/ui/beamline/components/avatar/avatar.module.css","content":"@layer properties, theme, base, components, utilities;\n@layer components {\n  /* Avatar: a face (initials on the name's hue, or a photo) and an optional presence mark. The mark is cut out of the\n     face with a mask, so the gap around it is truly empty and reads on any ground: a card, a row hover, glass, a photo. */\n  .root {\n    --_s: 36px;\n    --_d: 10px;\n    --_g: 2px;\n    position: relative;\n    display: inline-grid;\n    flex: none;\n    width: var(--_s);\n    height: var(--_s);\n    place-items: center;\n    /* initials scale with the face (geometry), never below 80% of the smallest type step */\n    font-size: max(calc(var(--pui-text-2xs) * 0.8), calc(var(--_s) * 0.36));\n    font-weight: var(--pui-weight-medium);\n    line-height: 1;\n    user-select: none;\n  }\n  .xs {\n    --_s: 20px;\n    --_d: 6px;\n    --_g: 1.5px;\n  }\n  .sm {\n    --_s: 28px;\n    --_d: 8px;\n  }\n  .lg {\n    --_s: 44px;\n    --_d: 12px;\n  }\n  .xl {\n    --_s: 56px;\n    --_d: 14px;\n    --_g: 2.5px;\n  }\n  .face {\n    position: absolute;\n    inset: 0;\n    display: grid;\n    place-items: center;\n    overflow: hidden;\n    border-radius: 50%;\n    background: color-mix(in oklab, var(--pui-avatar-hue) 24%, var(--pui-surface-2));\n    color: color-mix(in oklab, var(--pui-avatar-hue) 55%, var(--pui-ink));\n  }\n  /* the initials keep their tint but mix it into black or white, whichever the face's fill reads better against (its\n     luminance at WCAG's 0.179 crossover): mixed into the scope's ink they fell to 3.5–4.5 on mid fills, a brand-toned\n     sidebar's above all; this keeps every face at 5.5:1 or more in every look */\n  @supports (color: color(from red xyz-d65 x y z)) {\n    .face {\n      --_ink: color(\n        from color-mix(in oklab, var(--pui-avatar-hue) 24%, var(--pui-surface-2)) xyz-d65\n          calc(0.9505 * round(0.679 - y)) round(0.679 - y) calc(1.089 * round(0.679 - y))\n      );\n      color: color-mix(in oklab, var(--pui-avatar-hue) 55%, var(--_ink));\n    }\n  }\n  /* a company tile takes the look's card corner, never more than a third of the face, so it stays a square at xs */\n  .root[data-shape=\"square\"] .face {\n    /* nesting input (O1 §14.1, as Button): a parent that holds this near its rounded corner sets --pui-nest-radius and\n       --pui-nest-inset; the corner becomes radius − inset, clamped between a floor (chip) and the part's own role radius (or --pui-nest-ceiling: a pill container sets it to the pill radius). Unset, the declaration is invalid and the own corner\n       applies. --pui-avatar-radius wins over both. */\n    --_avatar-nest: clamp(\n      var(--pui-radius-chip),\n      calc(var(--pui-nest-radius) - var(--pui-nest-inset, 0px)),\n      var(--pui-nest-ceiling, min(var(--pui-radius-card), calc(var(--_s) / 3)))\n    );\n    --_r: var(--pui-avatar-radius, var(--_avatar-nest, min(var(--pui-radius-card), calc(var(--_s) / 3))));\n    border-radius: var(--_r);\n  }\n  .photo {\n    position: absolute;\n    inset: 0;\n    width: 100%;\n    height: 100%;\n    object-fit: cover;\n    transition: opacity var(--pui-fade-in) var(--pui-ease-default);\n  }\n  /* still on its way: the initials hold the place, and the photo fades in over them when it lands */\n  .photo[data-pending] {\n    opacity: 0;\n  }\n  /* The mark sits on the bottom inline-end corner; the face loses a disc one gap wider than the mark under it. */\n  .root[data-status] .face {\n    --_at: calc(var(--_d) / 2 - 1px);\n    mask: radial-gradient(\n      circle at calc(100% - var(--_at)) calc(100% - var(--_at)),\n      transparent calc(var(--_d) / 2 + var(--_g)),\n      black calc(var(--_d) / 2 + var(--_g) + 0.5px)\n    );\n  }\n  .root[data-status]:dir(rtl) .face {\n    mask: radial-gradient(\n      circle at var(--_at) calc(100% - var(--_at)),\n      transparent calc(var(--_d) / 2 + var(--_g)),\n      black calc(var(--_d) / 2 + var(--_g) + 0.5px)\n    );\n  }\n  .mark {\n    position: absolute;\n    inset-inline-end: -1px;\n    bottom: -1px;\n  }\n  /* a presence that changed settles into its new mark: the colour and shape arrive at once, the mark grows from a\n     little smaller (reduced motion keeps only the fade) */\n  .mark[data-changed] {\n    animation: presence-settle var(--pui-duration-feedback) var(--pui-ease-standard) both;\n  }\n\n  /* Presence: colour and shape together, so it reads in greyscale (DESIGN-LANGUAGE: colour is never the only signal).\n     online a full disc · away a crescent · busy a disc with a bar through it · offline a hollow ring. */\n  .presence {\n    --_d: 10px;\n    display: inline-block;\n    flex: none;\n    width: var(--_d);\n    height: var(--_d);\n    border-radius: 50%;\n    background: var(--_c);\n  }\n  .presence[data-size=\"xs\"] {\n    --_d: 6px;\n  }\n  .presence[data-size=\"sm\"] {\n    --_d: 8px;\n  }\n  .presence[data-size=\"lg\"] {\n    --_d: 12px;\n  }\n  .presence[data-size=\"xl\"] {\n    --_d: 14px;\n  }\n  .presence[data-status=\"online\"] {\n    --_c: var(--pui-green);\n  }\n  .presence[data-status=\"away\"] {\n    --_c: var(--pui-orange);\n    mask: radial-gradient(circle at 18% 18%, transparent calc(var(--_d) * 0.36), black calc(var(--_d) * 0.36 + 0.5px));\n  }\n  .presence[data-status=\"away\"]:dir(rtl) {\n    mask: radial-gradient(circle at 82% 18%, transparent calc(var(--_d) * 0.36), black calc(var(--_d) * 0.36 + 0.5px));\n  }\n  .presence[data-status=\"busy\"] {\n    --_c: var(--pui-red);\n    mask:\n      linear-gradient(black 0 0) center / 56% max(1.5px, 22%) no-repeat,\n      linear-gradient(black 0 0);\n    mask-composite: exclude;\n  }\n  .presence[data-status=\"offline\"] {\n    --_c: var(--pui-ink-3);\n    mask: radial-gradient(circle, transparent calc(var(--_d) * 0.24), black calc(var(--_d) * 0.24 + 0.5px));\n  }\n}\n@keyframes presence-settle {\n  from {\n    opacity: 0.4;\n    scale: calc(1 - 0.45 * var(--pui-motion-travel, 1));\n  }\n}\n"},{"path":"beamline/components/avatar/avatar.tsx","type":"registry:file","target":"src/ui/beamline/components/avatar/avatar.tsx","content":"\"use client\";\n\nimport { useMessages } from \"../../runtime/localization\";\nimport { english as englishMessages } from \"./messages\";\nimport { useComponentDefaults } from \"../../runtime/appearance\";\nimport type { AvatarDefaults } from \"./defaults\";\nexport type { AvatarDefaults } from \"./defaults\";\n\nimport { useCallback, useState, type CSSProperties, type HTMLAttributes, type Ref } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport styles from \"./avatar.module.css\";\n\nexport type AvatarSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type PresenceStatus = \"online\" | \"away\" | \"busy\" | \"offline\";\n\nconst SIZE: Record<AvatarSize, string | undefined> = {\n  xs: styles.xs,\n  sm: styles.sm,\n  md: undefined,\n  lg: styles.lg,\n  xl: styles.xl,\n};\n\n/** A person's (or account's) series hue, the same everywhere their name appears. */\nexport function hueOf(name: string) {\n  let h = 0;\n  for (const ch of name) h = (h * 31 + ch.charCodeAt(0)) | 0;\n  return `var(--pui-series-${(Math.abs(h) % 8) + 1})`;\n}\nexport const initialsOf = (name: string) =>\n  name\n    .trim()\n    .split(/\\s+/)\n    .filter((w) => /\\p{L}|\\d/u.test(w[0] ?? \"\"))\n    .slice(0, 2)\n    .map((w) => w[0].toUpperCase())\n    .join(\"\") || \"?\";\n\n/** A presence mark for avatars and lists. Colour and shape together: online a disc, away a crescent, busy a disc with\n *  a bar, offline a hollow ring, so the status survives greyscale and colour-blindness. */\nexport function PresenceDot({\n  status,\n  size = \"md\",\n  className,\n  style,\n  ref,\n  ...props\n}: {\n  status: PresenceStatus;\n  size?: AvatarSize;\n  className?: string;\n  style?: CSSProperties;\n  ref?: Ref<HTMLSpanElement>;\n} & Omit<HTMLAttributes<HTMLSpanElement>, \"children\">) {\n  const i18n = useMessages(\"avatar\", englishMessages);\n  return (\n    <span\n      {...props}\n      style={style}\n      ref={ref}\n      role=\"img\"\n      aria-label={props[\"aria-label\"] ?? i18n(status)}\n      data-slot=\"presence-dot\"\n      data-status={status}\n      data-size={size}\n      className={cn(styles.presence, className)}\n    />\n  );\n}\n\nexport interface AvatarClassNames {\n  root?: string;\n  face?: string;\n  photo?: string;\n  presence?: string;\n}\n\nexport interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {\n  name: string;\n  /** A photo; initials show while it loads and if it fails. */\n  src?: string;\n  size?: AvatarSize;\n  /** circle for people, square for companies and workspaces. */\n  shape?: \"circle\" | \"square\";\n  status?: PresenceStatus;\n  ref?: Ref<HTMLSpanElement>;\n  classNames?: AvatarClassNames;\n}\n\n/** A person or account in a small space: a photo, or initials on the colour their name always gets. A photo still on\n *  its way fades in over the initials instead of popping; a presence that changes settles into its new mark. */\nexport function Avatar({\n  name,\n  src,\n  size: sizeProp,\n  shape = \"circle\",\n  status,\n  className,\n  classNames,\n  style,\n  ref,\n  ...props\n}: AvatarProps) {\n  const i18n = useMessages(\"avatar\", englishMessages);\n  const scopeDefaults = useComponentDefaults<AvatarDefaults>(\"avatar\", [\"size\"]);\n  const size = sizeProp ?? scopeDefaults.size ?? \"md\";\n\n  const [failed, setFailed] = useState<string | null>(null);\n  const photo = src && failed !== src;\n  // a photo that is not decoded yet when it mounts waits unseen and fades in over the initials when it lands; one that\n  // is already there (cached, or loaded before the page hydrated) shows at once, so a server render never hides it\n  const [pending, setPending] = useState<string | null>(null);\n  const watch = useCallback((img: HTMLImageElement | null) => {\n    if (!img) return;\n    if (!img.complete) setPending(img.getAttribute(\"src\"));\n    // A cached/decode failure can finish before React attaches onError during hydration.\n    else if (img.naturalWidth === 0) setFailed(img.getAttribute(\"src\"));\n  }, []);\n  // a presence that changes (online → away) settles into its new mark; the first render does not play it\n  const [seen, setSeen] = useState(status);\n  const [changes, setChanges] = useState(0);\n  if (seen !== status) {\n    setSeen(status);\n    setChanges((n) => n + 1);\n  }\n  return (\n    <span\n      ref={ref}\n      data-slot=\"avatar\"\n      data-shape={shape}\n      data-status={status}\n      role=\"img\"\n      aria-label={status ? i18n(\"presence\", { name, status: i18n(status) }) : name}\n      {...props}\n      className={cn(styles.root, SIZE[size], classNames?.root, className)}\n      style={{ \"--pui-avatar-hue\": hueOf(name), ...style } as CSSProperties}\n    >\n      <span aria-hidden data-slot=\"avatar-face\" className={cn(styles.face, classNames?.face)}>\n        {initialsOf(name)}\n        {photo && (\n          <img\n            key={src}\n            ref={watch}\n            data-slot=\"avatar-photo\"\n            data-pending={pending === src || undefined}\n            src={src}\n            alt=\"\"\n            draggable={false}\n            onLoad={() => setPending(null)}\n            onError={() => setFailed(src)}\n            className={cn(styles.photo, classNames?.photo)}\n          />\n        )}\n      </span>\n      {status && (\n        <PresenceDot\n          key={changes}\n          status={status}\n          size={size}\n          data-changed={changes > 0 || undefined}\n          className={cn(styles.mark, classNames?.presence)}\n        />\n      )}\n    </span>\n  );\n}\n\nexport default Avatar;\n"},{"path":"beamline/components/avatar/defaults.ts","type":"registry:file","target":"src/ui/beamline/components/avatar/defaults.ts","content":"/** Pure allowed presentation defaults for Avatar; no component or runtime imports. */\nexport interface AvatarDefaults {\n  /** Shared size setting; omit to inherit the surrounding scope or the component default. */\n  size?: \"sm\" | \"md\" | \"xs\" | \"lg\" | \"xl\";\n}\n"},{"path":"beamline/components/avatar/messages.ts","type":"registry:file","target":"src/ui/beamline/components/avatar/messages.ts","content":"import type { MessageDefinitions } from \"../../runtime/messages\";\n/** Built-in English copy; stable keys are the public translation API. */\nexport const english = {\n  online: \"Online\",\n  away: \"Away\",\n  busy: \"Do not disturb\",\n  offline: \"Offline\",\n  presence: \"{name}, {status}\",\n} satisfies MessageDefinitions;\n"},{"path":"beamline/components/bottom-sheet/bottom-sheet.tsx","type":"registry:file","target":"src/ui/beamline/components/bottom-sheet/bottom-sheet.tsx","content":"\"use client\";\n\nimport { useMessages } from \"../../runtime/localization\";\nimport { english as englishMessages } from \"./messages\";\nimport { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type Ref, type ReactNode } from \"react\";\nimport { X } from \"lucide-react\";\nimport { animate, motion, useMotionValue, useTransform } from \"motion/react\";\nimport * as RadixDialog from \"@radix-ui/react-dialog\";\nimport { Button } from \"../button/button\";\nimport { useReturnFocus } from \"../_shared/use-return-focus\";\nimport { usePortalContainer } from \"../../runtime/appearance\";\nimport { useComposedRef } from \"../../hooks/use-composed-ref\";\nimport { useDrag } from \"../../hooks/use-drag\";\nimport { useResolvedAppearance } from \"../../hooks/use-resolved-appearance\";\nimport { motionEase } from \"../../lib/motion-tokens\";\nimport { semanticMotion } from \"../../lib/motion-source\";\nimport { cn } from \"../../lib/utils\";\nimport { useControllable } from \"../../hooks/use-controllable\";\nimport overlay from \"../_shared/overlay.module.css\";\n\nexport interface BottomSheetProps {\n  /** An element that opens it (uncontrolled use). */\n  trigger?: ReactNode;\n  /** Controlled open state; omit to use defaultOpen. */\n  open?: boolean;\n  /** Initial open state when uncontrolled. Defaults to false. */\n  defaultOpen?: boolean;\n  /** Reports open state after a change; no callback by default. */\n  onOpenChange?: (open: boolean) => void;\n  /** Heading shown above the content. Required. */\n  title: string;\n  /** Supporting text beneath the label or heading. Defaults to no supporting text. */\n  description?: string;\n  /** Resting heights as fractions of the screen, lowest first. Default [0.45, 0.92]. */\n  detents?: number[];\n  /** Which resting height it opens at. Default 0. */\n  initialDetent?: number;\n  /** Reports sheet resting height after a change; no callback by default. */\n  onDetentChange?: (index: number) => void;\n  /** Accessible text for the close control. Defaults to \"Close\". */\n  closeLabel?: string;\n  /** Classes on the documented visual root; no override by default. */\n  className?: string;\n  /** Inline styles on the documented visual root; no inline overrides by default. */\n  style?: CSSProperties;\n  /** Receives the documented root element; no ref by default. */\n  ref?: Ref<HTMLDivElement>;\n  /** Classes for the named visual parts; no part overrides by default. */\n  classNames?: Partial<\n    Record<\"root\" | \"backdrop\" | \"header\" | \"handle\" | \"title\" | \"description\" | \"close\" | \"body\", string>\n  >;\n  /** Content rendered inside the component. Defaults to no children. */\n  children?: ReactNode;\n}\n\n/**\n * A phone panel that rests at a peek and follows the finger to full height. Drag the handle (or the header) between\n * resting heights; a flick down from the lowest closes it. The handle is a button: Enter cycles heights, ↑ ↓ move.\n * Escape, the scrim and Close also close it: focus goes back at once and the sheet slides away after.\n */\nexport function BottomSheet({\n  trigger,\n  open: openProp,\n  defaultOpen = false,\n  onOpenChange,\n  title,\n  description,\n  detents = [0.45, 0.92],\n  initialDetent = 0,\n  onDetentChange,\n  closeLabel: closeLabelProp,\n  className,\n  classNames,\n  style,\n  ref,\n  children,\n}: BottomSheetProps) {\n  const i18n = useMessages(\"bottom-sheet\", englishMessages);\n  const closeLabel = closeLabelProp === undefined ? i18n(\"close\") : closeLabelProp;\n\n  const [open, setOpen] = useControllable(openProp, defaultOpen, onOpenChange);\n  const container = usePortalContainer();\n  // the panel outlives `open`: focus returns and the trap lets go as `open` turns false, the panel leaves after;\n  // opening again starts a fresh panel\n  const [shown, setShown] = useState(open);\n  const [round, setRound] = useState(0);\n  const [wasOpen, setWasOpen] = useState(open);\n  if (open !== wasOpen) {\n    setWasOpen(open);\n    if (open) {\n      setShown(true);\n      setRound((r) => r + 1);\n    }\n  }\n  return (\n    <RadixDialog.Root open={open} onOpenChange={setOpen}>\n      {trigger && <RadixDialog.Trigger asChild>{trigger}</RadixDialog.Trigger>}\n      {container !== null && shown && (\n        <RadixDialog.Portal container={container} forceMount>\n          <Panel\n            key={round}\n            open={open}\n            title={title}\n            description={description}\n            detents={detents}\n            initialDetent={initialDetent}\n            onDetentChange={onDetentChange}\n            closeLabel={closeLabel}\n            className={className}\n            classNames={classNames}\n            style={style}\n            ref={ref}\n            onClose={() => setOpen(false)}\n            onGone={() => setShown(false)}\n          >\n            {children}\n          </Panel>\n        </RadixDialog.Portal>\n      )}\n    </RadixDialog.Root>\n  );\n}\n\nfunction Panel({\n  open,\n  title,\n  description,\n  detents,\n  initialDetent,\n  onDetentChange,\n  closeLabel,\n  className,\n  classNames,\n  style,\n  ref,\n  onClose,\n  onGone,\n  children,\n}: Required<Pick<BottomSheetProps, \"title\" | \"detents\" | \"initialDetent\" | \"closeLabel\">> &\n  Pick<\n    BottomSheetProps,\n    \"description\" | \"onDetentChange\" | \"className\" | \"classNames\" | \"style\" | \"ref\" | \"children\"\n  > & { open: boolean; onClose: () => void; onGone: () => void }) {\n  const i18n = useMessages(\"bottom-sheet\", englishMessages);\n\n  const host = useRef<HTMLDivElement>(null);\n  const attach = useComposedRef(host, ref);\n  const appearance = useResolvedAppearance(host, { times: [\"duration-considered\"], easings: [\"ease-drawer\"] });\n  const entered = useRef(false);\n  const [vh, setVh] = useState(() => (typeof window === \"undefined\" ? 800 : window.innerHeight));\n  const maxH = Math.round(vh * detents[detents.length - 1]);\n  const yOf = (i: number) => maxH - Math.round(vh * detents[i]);\n  const [detent, setDetent] = useState(Math.min(initialDetent, detents.length - 1));\n  const y = useMotionValue(maxH);\n  const scrim = useTransform(y, [yOf(0), maxH], [1, 0]);\n  const drag = useRef<{ from: number } | null>(null);\n  // held: the handle answers the finger at once (wider and brighter) for as long as the sheet is held\n  const [held, setHeld] = useState(false);\n  const header = useRef<HTMLDivElement>(null);\n  // focus goes back as the sheet closes (below), so the unmount after it leaves must not move focus again\n  const released = useRef(false);\n  const focus = useReturnFocus({\n    onCloseAutoFocus: (event) => {\n      if (released.current) event.preventDefault();\n    },\n  });\n  // closed from inside (Escape, Close, the scrim, a flick): it slides away; closed by its owner: it goes at once\n  const [dismissed, setDismissed] = useState(false);\n  const away = !open && !dismissed;\n  const [headerH, setHeaderH] = useState(76);\n  useLayoutEffect(() => {\n    const element = header.current;\n    if (!element) return;\n    const measure = () => setHeaderH(element.offsetHeight);\n    measure();\n    const observer = new ResizeObserver(measure);\n    observer.observe(element);\n    return () => observer.disconnect();\n  }, []);\n\n  useEffect(() => {\n    const on = () => setVh(window.innerHeight);\n    window.addEventListener(\"resize\", on);\n    return () => window.removeEventListener(\"resize\", on);\n  }, []);\n  // the glide in flight, so a hand that grabs the sheet mid-glide takes it where it is\n  const gliding = useRef<ReturnType<typeof animate> | null>(null);\n  const go = (target: number, after?: () => void) => {\n    gliding.current?.stop();\n    const run = animate(y, target, {\n      duration: appearance.reducedMotion\n        ? 0\n        : (appearance.times[\"duration-considered\"] ?? semanticMotion.duration.considered),\n      // the drawer curve the scope resolves; before it has, the system's entrance curve\n      ease: motionEase(appearance.easings[\"ease-drawer\"], semanticMotion.ease.enter),\n    });\n    gliding.current = run;\n    if (after) run.then(after);\n  };\n  const settle = (i: number) => {\n    setDetent(i);\n    onDetentChange?.(i);\n    go(yOf(i));\n  };\n  const close = () => {\n    setDismissed(true);\n    onClose();\n  };\n  useLayoutEffect(() => {\n    if (!appearance.ready || entered.current) return;\n    entered.current = true;\n    y.set(maxH);\n    go(yOf(detent));\n  }, [appearance.ready]); // eslint-disable-line react-hooks/exhaustive-deps -- slide in once\n  useEffect(() => {\n    if (!drag.current && open) y.set(yOf(detent));\n  }, [vh]); // eslint-disable-line react-hooks/exhaustive-deps -- keep the resting height on rotation\n  // `open` turned false and the trap has let go: focus returns now (not after the slide, never through <body>), then\n  // the panel leaves; an effect, so the trap's own cleanup has already run\n  useEffect(() => {\n    if (open) return;\n    const active = document.activeElement;\n    if (!active || active === document.body || host.current?.contains(active))\n      focus.onCloseAutoFocus(new Event(\"close\", { cancelable: true }), host.current);\n    released.current = true;\n    // a leaving panel takes no focus back: not by Tab, not by a child's autofocus that lands a frame late\n    if (host.current) host.current.inert = true;\n    if (!dismissed) {\n      onGone();\n      return;\n    }\n    entered.current = true;\n    let live = true;\n    go(maxH, () => live && onGone());\n    return () => {\n      live = false;\n    };\n  }, [open]); // eslint-disable-line react-hooks/exhaustive-deps -- on close only\n\n  // the header drags the sheet through the shared drag (BUILDING §7): it follows the hand, resisting past the top; a\n  // release projects 180 ms of the throw and closes past half the way down (or on a fast flick from the lowest detent),\n  // else settles on the nearest detent; Escape mid-drag puts the sheet back on its detent and keeps it open\n  useDrag(\n    header,\n    {\n      onPress: (_, e) => {\n        if ((e.target as HTMLElement).closest(\"button:not([data-handle]), a, input, textarea, select\")) return false;\n        // a sheet still settling stops under the hand and is dragged from where it is\n        gliding.current?.stop();\n        drag.current = { from: y.get() };\n        setHeld(true);\n      },\n      onMove: (p) => {\n        const d = drag.current;\n        if (!d) return;\n        const next = d.from + p.dy;\n        y.set(next < 0 ? next * 0.2 : next); // resist past the top\n      },\n      onEnd: (p) => {\n        drag.current = null;\n        setHeld(false);\n        const v = p.vy / 1000; // px per ms\n        const projected = y.get() + v * 180;\n        if (projected > yOf(0) + (maxH - yOf(0)) * 0.5 || (v > 0.9 && detentAt(y.get()) === 0)) {\n          close();\n          return;\n        }\n        settle(detentAt(projected));\n      },\n      onTap: () => {\n        const d = drag.current;\n        drag.current = null;\n        setHeld(false);\n        if (d && Math.abs(y.get() - yOf(detent)) > 0.5) settle(detent);\n      },\n      onCancel: () => {\n        const d = drag.current;\n        drag.current = null;\n        setHeld(false);\n        if (d) settle(detentAt(d.from));\n      },\n      // a press the page took before it became a drag (a sideways move scrolls instead): let the handle go, and put a\n      // sheet stopped mid-glide on its detent\n      onAbandon: () => {\n        const d = drag.current;\n        drag.current = null;\n        setHeld(false);\n        if (d && Math.abs(y.get() - yOf(detent)) > 0.5) settle(detent);\n      },\n    },\n    { axis: \"y\" },\n  );\n  const detentAt = (pos: number) =>\n    detents.reduce((best, _, i) => (Math.abs(yOf(i) - pos) < Math.abs(yOf(best) - pos) ? i : best), 0);\n\n  return (\n    <>\n      <RadixDialog.Overlay asChild>\n        <motion.div\n          data-slot=\"bottom-sheet-backdrop\"\n          // a leaving sheet lets taps through to the page\n          className={cn(\n            overlay.scrim,\n            \"!animate-none data-[state=closed]:pointer-events-none\",\n            away && \"!opacity-0\",\n            classNames?.backdrop,\n          )}\n          style={{ opacity: scrim }}\n          onPointerDown={(e) => {\n            e.preventDefault();\n            close();\n          }}\n        />\n      </RadixDialog.Overlay>\n      <RadixDialog.Content\n        asChild\n        onEscapeKeyDown={(e) => {\n          e.preventDefault();\n          close();\n        }}\n        onPointerDownOutside={(e) => e.preventDefault()}\n        {...focus}\n      >\n        <motion.div\n          ref={attach}\n          data-slot=\"bottom-sheet\"\n          style={{ y, height: maxH, ...style }}\n          // at a lower detent part of the sheet is below the screen: a control focused down there raises the sheet\n          onFocusCapture={(e) => {\n            const last = detents.length - 1;\n            if (\n              detent < last &&\n              !drag.current &&\n              (e.target as HTMLElement).getBoundingClientRect().bottom - e.currentTarget.getBoundingClientRect().top >\n                Math.round(vh * detents[detent])\n            )\n              settle(last);\n          }}\n          className={cn(\n            \"m-overlay fixed inset-x-0 bottom-0 z-[var(--pui-z-modal)] mx-auto flex max-w-[640px] flex-col rounded-t-[var(--pui-radius-window)] text-ink outline-none data-[state=closed]:pointer-events-none\",\n            // closed by its owner it is gone from the first frame, still focusable until focus has gone back\n            away && \"opacity-0\",\n            classNames?.root,\n            className,\n          )}\n        >\n          <div\n            ref={header}\n            data-slot=\"bottom-sheet-header\"\n            data-held={held ? \"\" : undefined}\n            className={cn(\n              \"group/sheet shrink-0 cursor-grab touch-pan-x select-none active:cursor-grabbing\",\n              classNames?.header,\n            )}\n          >\n            <button // organism-allow: raw-control -- the sheet's drag handle (a grip, not an action)\n              type=\"button\"\n              data-slot=\"bottom-sheet-handle\"\n              data-handle\n              aria-label={detent === detents.length - 1 ? i18n(\"collapseSheet\") : i18n(\"expandSheet\")}\n              onClick={() => settle((detent + 1) % detents.length)}\n              onKeyDown={(e) => {\n                if (e.key === \"ArrowUp\") {\n                  e.preventDefault();\n                  settle(Math.min(detents.length - 1, detent + 1));\n                } else if (e.key === \"ArrowDown\") {\n                  e.preventDefault();\n                  if (detent === 0) close();\n                  else settle(detent - 1);\n                }\n              }}\n              className={cn(\"mx-auto mt-2 mb-1 grid h-5 w-16 place-items-center rounded-pill\", classNames?.handle)}\n            >\n              <span className=\"h-1 w-9 rounded-pill bg-line-strong transition-[width,background-color] duration-[var(--pui-motion-out)] group-data-held/sheet:w-12 group-data-held/sheet:bg-ink-3 group-data-held/sheet:duration-0\" />\n            </button>\n            <div className=\"flex items-start gap-3 px-[var(--pui-pad-panel)] pb-3\">\n              <div className=\"min-w-0 flex-1\">\n                <RadixDialog.Title\n                  data-slot=\"bottom-sheet-title\"\n                  className={cn(\"text-subheading leading-snug text-ink\", classNames?.title)}\n                >\n                  {title}\n                </RadixDialog.Title>\n                {description ? (\n                  <RadixDialog.Description\n                    data-slot=\"bottom-sheet-description\"\n                    className={cn(\"text-sm text-ink-2\", classNames?.description)}\n                  >\n                    {description}\n                  </RadixDialog.Description>\n                ) : (\n                  <RadixDialog.Description className=\"sr-only\">{title}</RadixDialog.Description>\n                )}\n              </div>\n              <Button\n                data-slot=\"bottom-sheet-close\"\n                variant=\"ghost\"\n                size=\"sm\"\n                onClick={close}\n                aria-label={closeLabel}\n                className={cn(\"-me-1\", classNames?.close)}\n              >\n                <X />\n              </Button>\n            </div>\n          </div>\n          <div\n            data-slot=\"bottom-sheet-body\"\n            className={cn(\"min-h-0 overflow-y-auto overscroll-contain border-t border-line-soft\", classNames?.body)}\n            style={{ height: Math.round(vh * detents[detent]) - headerH }}\n          >\n            {children}\n          </div>\n        </motion.div>\n      </RadixDialog.Content>\n    </>\n  );\n}\n\nexport default BottomSheet;\n"},{"path":"beamline/components/bottom-sheet/messages.ts","type":"registry:file","target":"src/ui/beamline/components/bottom-sheet/messages.ts","content":"import type { MessageDefinitions } from \"../../runtime/messages\";\n/** Built-in English copy; stable keys are the public translation API. */\nexport const english = {\n  collapseSheet: \"Collapse sheet\",\n  expandSheet: \"Expand sheet\",\n  close: \"Close\",\n} satisfies MessageDefinitions;\n"},{"path":"beamline/components/button/button-variants.ts","type":"registry:file","target":"src/ui/beamline/components/button/button-variants.ts","content":"import { cn } from \"../../lib/utils\";\nimport styles from \"./button.module.css\";\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"outline\" | \"ghost\" | \"danger\" | \"accent\";\n/** sm 32 · md 36 · lg 40 · touch 44 (a bottom action bar on a phone). */\nexport type ButtonSize = \"sm\" | \"md\" | \"lg\" | \"touch\";\n/** Market side: buy fills with --pui-up, sell with --pui-down (a red-up market flips the two tokens, not the code). */\nexport type ButtonTone = \"up\" | \"down\";\n\n/** Which paint role paints each variant: filled variants are solids, the quiet ones keep their own light paint. */\nconst ROLE: Record<ButtonVariant, string | undefined> = {\n  primary: \"m-solid\",\n  accent: \"m-solid\",\n  secondary: \"m-control\",\n  outline: undefined,\n  ghost: undefined,\n  danger: undefined,\n};\n\n/** A variant's paint without the button's layout, for a group that wears one button's look (SplitButton paints the\n *  pair as one button and leaves its halves transparent). */\nexport function buttonPaint(variant: ButtonVariant = \"primary\", tone?: ButtonTone) {\n  return cn(ROLE[variant], styles[variant], tone && styles[tone]);\n}\n\n/** The classes that make any element look like a Button, for parts that render their own element. */\nexport function buttonClassName({\n  variant = \"primary\",\n  size = \"md\",\n  tone,\n  className,\n}: { variant?: ButtonVariant; size?: ButtonSize; tone?: ButtonTone; className?: string } = {}) {\n  return cn(styles.root, ROLE[variant], styles[variant], tone && styles[tone], styles[size], className);\n}\n"},{"path":"beamline/components/button/button.module.css","type":"registry:file","target":"src/ui/beamline/components/button/button.module.css","content":"@layer properties, theme, base, components, utilities;\n@layer components {\n  /* Button. Every colour, size and duration is a token; a variant only sets the four local properties below. */\n  .root {\n    --_button-bg: transparent;\n    --_button-bg-hover: var(--pui-hover);\n    --_button-fg: var(--pui-ink);\n    --_button-edge: none;\n    --_button-height: var(--pui-control-height-md);\n    --_button-pad: 14px;\n    position: relative;\n    isolation: isolate;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: var(--pui-space-1-5);\n    flex-shrink: 0;\n    height: var(--_button-height);\n    min-width: var(--_button-height);\n    /* never wider than its room: in a narrow card the label ends in an ellipsis instead of spilling (the full words\n       stay the accessible name) */\n    max-width: 100%;\n    padding-inline: var(--_button-pad);\n    border: 0;\n    /* Nested context: inside a frame that sets --pui-nest-radius and --pui-nest-inset (and --pui-nest-ceiling for pills)\n       the corner is the shared nested corner (.nest-corner, utilities.css: radius − inset, or the button's own radius\n       where that would fall under the chip radius); elsewhere the control radius. --pui-button-radius wins over both. */\n    border-radius: var(--pui-button-radius, var(--pui-nested, var(--pui-radius-control)));\n    color: var(--_button-fg);\n    font-family: var(--pui-font-body);\n    font-size: var(--pui-text-sm);\n    font-weight: var(--pui-weight-medium);\n    line-height: 1;\n    letter-spacing: var(--pui-tracking-body);\n    white-space: nowrap;\n    text-decoration: none;\n    cursor: pointer;\n    user-select: none;\n    -webkit-tap-highlight-color: transparent;\n    /* frequency law: hover arrives at 0ms (below), leaves over the ruled departure; opacity and translate are listed\n       so a button that waits for attention (.reveal) fades away like every reveal instead of vanishing */\n    transition:\n      var(--m-transition),\n      background-color var(--pui-motion-out) var(--pui-ease-default),\n      color var(--pui-motion-out) var(--pui-ease-default),\n      opacity var(--pui-motion-out) var(--pui-ease-default),\n      translate var(--pui-motion-out) var(--pui-ease-default);\n  }\n  /* the quiet variants paint themselves; filled and secondary variants are painted by their look role (m-solid,\n   m-control), which these zero-specificity rules can never override */\n  :where(.root) {\n    background: var(--_button-bg);\n    box-shadow: var(--_button-edge);\n  }\n  :where(.root:hover:not(:disabled, [aria-disabled=\"true\"])) {\n    background: var(--_button-bg-hover);\n  }\n  .root:hover:not(:disabled, [aria-disabled=\"true\"]) {\n    transition-duration: 0ms;\n  }\n  /* the asChild form has no motion: a CSS press instead */\n  .root:not(button):active {\n    transform: scale(0.97);\n  }\n  .root:disabled,\n  .root[aria-disabled=\"true\"]:not([data-loading]) {\n    opacity: var(--pui-opacity-disabled);\n    cursor: not-allowed;\n  }\n  .root[data-loading] {\n    cursor: progress;\n  }\n\n  /* Icons: 16px unless the icon says otherwise (zero specificity, so size-5 or an inline size wins) */\n  :where(.root) :where(svg) {\n    width: var(--pui-icon-md);\n    height: var(--pui-icon-md);\n    flex-shrink: 0;\n  }\n\n  .sm {\n    --_button-height: var(--pui-control-height-sm);\n    --_button-pad: var(--pui-space-2-5);\n    /* the base gap (--pui-space-1-5); 5px had no scale step, and 6px also lets the loader's negative margin cancel\n       the gap exactly at every size */\n  }\n  .md {\n    --_button-height: var(--pui-control-height-md);\n    --_button-pad: 14px;\n  }\n  .lg {\n    --_button-height: var(--pui-control-height-lg);\n    --_button-pad: var(--pui-space-4);\n    font-size: var(--pui-text-base);\n  }\n  /* a bottom action bar on a phone: the 44 px touch target (a platform minimum, not a spacing step, so it holds when\n     the spacing parameter changes — O1 §14.2), the large label */\n  .touch {\n    --_button-height: calc(var(--pui-control-height-lg) + 0.25rem);\n    --_button-pad: var(--pui-space-5);\n    font-size: var(--pui-text-base);\n  }\n  .root[data-icon-only] {\n    padding-inline: 0;\n    width: var(--_button-height);\n  }\n\n  /* the main action: ink on the page, inverted per theme */\n  .primary {\n    --m-color: var(--pui-ink);\n    --_button-fg: var(--pui-ink-inverse);\n  }\n  .secondary {\n    --_button-fg: var(--pui-ink);\n  }\n  .outline {\n    --_button-edge: inset 0 0 0 1px var(--pui-line-strong);\n    --_button-bg-hover: var(--pui-hover);\n  }\n  .ghost {\n    --_button-fg: var(--pui-ink-2);\n    --_button-bg-hover: var(--pui-hover);\n  }\n  .ghost:hover:not(:disabled) {\n    color: var(--pui-ink);\n  }\n  .danger {\n    --_button-fg: var(--pui-red);\n    --_button-edge: inset 0 0 0 1px color-mix(in oklab, var(--pui-red) 42%, transparent);\n    --_button-bg-hover: var(--pui-red-tint);\n  }\n  .accent {\n    --m-color: var(--pui-accent);\n    --_button-fg: var(--pui-accent-foreground);\n  }\n\n  /* Market side. Declared after the variants so it wins: a filled variant takes the side's colour and its on-colour\n     ink; a quiet variant keeps its paint and colours the label. */\n  .up {\n    --m-color: var(--pui-up);\n    --_button-fg: var(--pui-up);\n  }\n  .down {\n    --m-color: var(--pui-down);\n    --_button-fg: var(--pui-down);\n  }\n  .ghost:is(.up, .down):hover:not(:disabled) {\n    color: var(--_button-fg);\n  }\n  .primary.up,\n  .accent.up {\n    --_button-fg: var(--pui-on-up);\n  }\n  .primary.down,\n  .accent.down {\n    --_button-fg: var(--pui-on-down);\n  }\n\n  /* The main actions' light, where the look provides one, as a spectrum. Glow spills a soft light in the brand's\n     spectrum from under the button's bottom edge (clipped at it, so it never tints the face) that brightens under the\n     pointer. Prism keeps it inside the glass (--m-solid-glow-fit: 1): the face the light leaves by, the bottom edge,\n     splits it into a crisp line with a faint wash rising into the face, only while pointed at. Every other look\n     leaves --m-solid-glow at none, so the layer does not exist. */\n  .primary::after,\n  .accent::after {\n    --_fit: var(--m-solid-glow-fit, 0);\n    content: var(--m-solid-glow);\n    position: absolute;\n    z-index: -1;\n    top: calc((1 - var(--_fit)) * (100% + var(--m-solid-glow-gap, 0px)));\n    inset-inline: var(--m-solid-glow-inset, 14%);\n    height: var(--m-solid-glow-height, 14px);\n    border-radius: calc(\n      var(--_fit) * var(--pui-button-radius, var(--pui-nested, var(--pui-radius-control))) + (1 - var(--_fit)) *\n        var(--pui-radius-pill)\n    );\n    background: var(--m-spectrum);\n    background-size: var(--m-spectrum-size, 100% 100%);\n    /* the part of the spectrum that shows: this button's own angle (--m-prism-seed, new at every press), turned by\n       where the pointer is across the face (--m-prism-x) in a look that turns it (--m-solid-glow-turn) */\n    background-position: calc((var(--m-prism-seed, 0.3) + var(--m-prism-x, 0.5) * var(--m-solid-glow-turn, 0)) * 100%) 0;\n    filter: blur(var(--m-solid-glow-blur, 9px));\n    clip-path: var(--m-solid-glow-clip, inset(0 -32px -32px -32px));\n    mask: var(--m-solid-glow-mask, none);\n    mask-position:\n      0 0,\n      calc(var(--m-prism-seed, 0.3) * 100%) 0;\n    mask-composite: intersect;\n    opacity: var(--m-solid-glow-rest, 0.75);\n    scale: var(--m-solid-glow-scale, 1) 1;\n    pointer-events: none;\n    transition:\n      opacity var(--pui-motion-out) var(--pui-ease-default),\n      scale var(--pui-motion-out) var(--pui-ease-default),\n      background-position var(--pui-duration-considered) var(--pui-ease-default),\n      mask-position var(--pui-duration-considered) var(--pui-ease-default);\n  }\n  /* pointed at: the light brightens (glow) or grows out from the centre and drifts along while the pointer stays\n     (prism) */\n  .primary:hover::after,\n  .accent:hover::after {\n    opacity: 1;\n    scale: 1 1;\n    transition-duration: var(--m-solid-glow-in, 0ms);\n    animation: var(--m-solid-glow-flow, none);\n  }\n  /* A change of word or colour (Save → Saved, a tone turning green) passes a band of split light across the face once,\n     in a look that has one (prism: --m-solid-shift-light; the pen hook's ::before is free on a solid otherwise). */\n  .primary[data-shift]::before,\n  .accent[data-shift]::before {\n    content: var(--m-solid-shift-light, none);\n    position: absolute;\n    inset: 0;\n    z-index: -1;\n    border: 0;\n    border-radius: inherit;\n    background: var(--m-spectrum) 0 0 / var(--m-spectrum-size, 100% 100%);\n    mask: linear-gradient(105deg, transparent 39%, #000 47.5%, #000 52.5%, transparent 61%) 0 0 / 300% 100% no-repeat;\n    opacity: 0;\n    animation: prism-shift calc(var(--pui-duration-considered) * 2.2) var(--pui-ease-default);\n    pointer-events: none;\n  }\n  @keyframes prism-shift {\n    from {\n      mask-position: 100% 0;\n      opacity: 0.25;\n    }\n    35% {\n      opacity: 0.55;\n    }\n    to {\n      mask-position: 0 0;\n      opacity: 0;\n    }\n  }\n  @media (prefers-reduced-motion: reduce) {\n    .primary::after,\n    .accent::after {\n      transition: none;\n      animation: none !important;\n    }\n    .primary[data-shift]::before,\n    .accent[data-shift]::before {\n      content: none;\n    }\n  }\n  .root:disabled::after,\n  .root[aria-disabled=\"true\"]::after {\n    content: none;\n  }\n\n  /* The loader opens its own width, and the negative margin cancels the gap so the label does not jump */\n  .loader {\n    display: inline-flex;\n    overflow: hidden;\n    margin-inline-end: calc(var(--pui-space-1-5) * -1);\n  }\n  .loader > * {\n    margin-inline-end: var(--pui-space-1-5);\n  }\n  .spinner {\n    color: currentColor;\n  }\n  .root[data-icon-only] .loader {\n    margin-inline-end: 0;\n  }\n  .root[data-icon-only] .loader > * {\n    margin-inline-end: 0;\n  }\n\n  /* The label holds its place while the text inside swaps; the leaving text pops out of flow against it */\n  .label {\n    position: relative;\n    display: inline-flex;\n    justify-content: center;\n    min-width: 0;\n    overflow: visible;\n  }\n  /* the clip box is let out by a little over a line so descenders are never cut, without changing the layout */\n  .text {\n    display: inline-block;\n    max-width: 100%;\n    margin-block: -0.2em;\n    padding-block: 0.2em;\n    overflow: hidden;\n    text-overflow: ellipsis;\n    white-space: nowrap;\n  }\n  .label[data-morphing] > .text {\n    overflow: visible;\n    text-overflow: clip;\n  }\n}\n\n@layer components {\n  :global(.pui[data-motion=\"reduced\"]) .root:not(button):active,\n  :global(.pui[data-motion=\"none\"]) .root:not(button):active {\n    transform: none;\n  }\n  @media (prefers-reduced-motion: reduce) {\n    .root:not(button):active {\n      transform: none;\n    }\n  }\n}\n/* CSS-module composition only; visual rules stay in the component layer. */\n.root {\n  composes: nest-corner from global;\n}\n"},{"path":"beamline/components/button/button.tsx","type":"registry:file","target":"src/ui/beamline/components/button/button.tsx","content":"\"use client\";\n\nimport { useMessages } from \"../../runtime/localization\";\nimport { english as englishMessages } from \"./messages\";\nimport {\n  Children,\n  Fragment,\n  isValidElement,\n  useLayoutEffect,\n  useRef,\n  type ButtonHTMLAttributes,\n  type PointerEvent,\n  type ReactNode,\n  type Ref,\n  type RefObject,\n  type ComponentProps,\n} from \"react\";\nimport { AnimatePresence, LazyMotion, m, spring, useIsPresent } from \"motion/react\";\nimport { animate } from \"motion/mini\";\nimport * as Slot from \"@radix-ui/react-slot\";\nimport { Spinner } from \"../spinner/spinner\";\nimport type { BuiltInLook as Look } from \"../../runtime/preset\";\nimport { useComposedRef } from \"../../hooks/use-composed-ref\";\nimport { useMotionTokens } from \"../../hooks/use-motion-tokens\";\nimport { cn } from \"../../lib/utils\";\nimport styles from \"./button.module.css\";\n\nexport type { ButtonVariant, ButtonSize, ButtonTone } from \"./button-variants\";\nexport { buttonPaint, buttonClassName } from \"./button-variants\";\nimport { buttonClassName, type ButtonVariant, type ButtonSize, type ButtonTone } from \"./button-variants\";\nimport type { ButtonDefaults } from \"./defaults\";\nexport type { ButtonDefaults } from \"./defaults\";\nimport { useComponentDefaults } from \"../../runtime/appearance\";\nimport { useReducedMotionSafe } from \"../../hooks/use-reduced-motion-safe\";\n\ntype NativeProps = Omit<\n  ButtonHTMLAttributes<HTMLButtonElement>,\n  \"onDrag\" | \"onDragEnd\" | \"onDragStart\" | \"onAnimationStart\"\n>;\n\nexport interface ButtonProps extends NativeProps {\n  /** Visual weight: primary (ink-filled), secondary, outline, ghost, danger, or accent (filled with the brand). */\n  variant?: ButtonVariant;\n  /** Height 32 / 36 / 40 px; touch 44 px for a bottom action bar on a phone. */\n  size?: ButtonSize;\n  /** Market side. On primary/accent the fill becomes --pui-up (buy) or --pui-down (sell); on the quiet variants the\n   *  label takes that colour. Pair it with a word or arrow: colour is never the only signal. */\n  tone?: ButtonTone;\n  /** Shows a loader in front of the label, sets aria-busy and ignores clicks; size and focus stay. */\n  loading?: boolean;\n  classNames?: Partial<Record<\"root\" | \"label\" | \"loader\", string>>;\n  /** Paint this button in another look than the one in force around it (DESIGN-LANGUAGE.md \"Looks\"). */\n  look?: Look;\n  /** Render the single child (a link, a Radix trigger) with the button's look instead of a <button>. */\n  asChild?: boolean;\n  /** A square button holding only an icon (give it an aria-label). Decided by the children when left out: icon-only when\n   *  no words sit anywhere among them (an icon, or a frame of icons), so `<span>Close</span>` is a label. */\n  iconOnly?: boolean;\n  ref?: Ref<HTMLButtonElement>;\n}\n\n// Motion's animation features arrive in a deferred chunk (AT11): the button renders and works at once, and its press,\n// loader and label motion run once they land, a frame or two after mount. Buttons that mount after that get the\n// loaded features directly, so they render once instead of again when a lazy load resolves.\ntype Features = typeof import(\"./motion-features\").default;\nlet loaded: Features | null = null;\nconst features = () =>\n  import(\"./motion-features\").then((module) => {\n    loaded = module.default;\n    return loaded;\n  });\n\n/** Children with fragments opened up, so `{busy ? <><Icon />Saving</> : …}` reads as icon plus text. */\nconst flat = (children: ReactNode): ReactNode[] =>\n  Children.toArray(children).flatMap((c) =>\n    isValidElement<{ children?: ReactNode }>(c) && c.type === Fragment ? flat(c.props.children) : [c],\n  );\n\n/** Whether any words sit anywhere inside (an icon, or a frame of icons, has none). */\nfunction hasText(node: ReactNode): boolean {\n  if (typeof node === \"string\") return node.trim() !== \"\";\n  if (typeof node === \"number\") return true;\n  if (Array.isArray(node)) return node.some(hasText);\n  return isValidElement<{ children?: ReactNode }>(node) && hasText(node.props.children);\n}\n\n/** Splits children into the text run (the label that can change) and everything else (icons), in order, and says\n *  whether any element carries content of its own (a `<span>Close</span>` label, unlike an icon). */\nfunction split(children: ReactNode) {\n  const parts = flat(children);\n  const text = parts\n    .filter((p) => typeof p === \"string\" || typeof p === \"number\")\n    .join(\"\")\n    .trim();\n  const firstText = parts.findIndex((p) => typeof p === \"string\" || typeof p === \"number\");\n  const before = firstText === -1 ? parts : parts.slice(0, firstText).filter(isValidElement);\n  const after = firstText === -1 ? [] : parts.slice(firstText).filter(isValidElement);\n  const content = parts.some((p) => isValidElement<{ children?: ReactNode }>(p) && hasText(p.props.children));\n  return { text, before, after, content };\n}\n\n/**\n * The action control. Hover answers at once and lets go over --pui-motion-out; a press scales down at once, or swells\n * on the snappy spring where the look's --pui-press-scale is above 1 (glass), never on a trigger that anchors a\n * floating layer, which would measure a resized box; a changed label slides in while the\n * width follows on a critically damped spring; loading keeps the size and the focus.\n */\nexport function Button({\n  variant: variantProp,\n  size: sizeProp,\n  tone: toneProp,\n  loading = false,\n  look,\n  asChild = false,\n  iconOnly: iconOnlyProp,\n  className,\n  classNames,\n  children,\n  type,\n  onClick,\n  onPointerMove,\n  onPointerDown,\n  disabled,\n  ref,\n  ...props\n}: ButtonProps) {\n  const i18n = useMessages(\"button\", englishMessages);\n\n  const defaults = useComponentDefaults<ButtonDefaults>(\"button\", [\"variant\", \"size\", \"tone\"]);\n  const variant = variantProp ?? defaults.variant ?? \"primary\";\n  const size = sizeProp ?? defaults.size ?? \"md\";\n  const tone = toneProp ?? defaults.tone;\n  const host = useRef<HTMLButtonElement>(null);\n  const attach = useComposedRef(host, ref);\n  const motionTokens = useMotionTokens(host);\n  const requestedReduced = useReducedMotionSafe();\n  const reduced = requestedReduced || motionTokens.reduced;\n  // Reduced motion keeps a restrained fade; none removes it (APPEARANCE A06).\n  const fade = motionTokens.mode === \"none\" ? 0 : motionTokens.fade.in;\n  // a caller's aria-disabled keeps the button focusable (focus never drops after Save resolves) but inert to presses\n  const softDisabled = props[\"aria-disabled\"] === true || props[\"aria-disabled\"] === \"true\";\n  const { text, before, after, content } = split(children);\n  const prism = usePrismLight(host, variant === \"primary\" || variant === \"accent\", `${text}|${tone}|${variant}`);\n  // with asChild the text sits inside the child (the link), not among our own children\n  const inner = asChild && isValidElement<{ children?: ReactNode }>(children) ? split(children.props.children) : null;\n  const iconOnly = iconOnlyProp ?? (inner ? !inner.text && !inner.content : !text && !content);\n  const anchor =\n    (props[\"aria-haspopup\"] != null && props[\"aria-haspopup\"] !== false && props[\"aria-haspopup\"] !== \"false\") ||\n    \"data-state\" in props;\n  const shared = {\n    \"data-slot\": \"button\",\n    \"data-variant\": variant,\n    \"data-size\": size,\n    \"data-tone\": tone,\n    \"data-icon-only\": iconOnly ? \"\" : undefined,\n    \"data-loading\": loading ? \"\" : undefined,\n    \"data-look\": look,\n    className: buttonClassName({ variant, size, tone, className: cn(classNames?.root, className) }),\n  };\n\n  if (asChild)\n    return (\n      <Slot.Root {...shared} {...props} ref={attach}>\n        {children}\n      </Slot.Root>\n    );\n\n  const button = (\n    <m.button\n      ref={attach}\n      type={type ?? \"button\"}\n      {...shared}\n      {...props}\n      disabled={disabled}\n      aria-busy={loading || undefined}\n      aria-disabled={loading || softDisabled || undefined}\n      onPointerMove={(e) => {\n        prism.turn(e);\n        onPointerMove?.(e);\n      }}\n      onPointerDown={(e) => {\n        prism.press();\n        onPointerDown?.(e);\n      }}\n      onClick={(e) => {\n        if (loading || softDisabled) {\n          e.preventDefault();\n          return;\n        }\n        onClick?.(e);\n      }}\n      whileTap={\n        reduced || anchor || disabled || loading || softDisabled\n          ? undefined\n          : {\n              scale: motionTokens.pressScale,\n              // a press that sinks lands at once; one that swells toward the finger (glass) grows on the spring\n              transition: motionTokens.pressScale > 1 ? motionTokens.spring.snappy : { duration: 0 },\n            }\n      }\n      transition={{ scale: motionTokens.spring.snappy }}\n    >\n      <AnimatePresence initial={false}>\n        {loading && (\n          <m.span\n            key=\"loader\"\n            data-slot=\"button-loader\"\n            className={cn(styles.loader, classNames?.loader)}\n            initial={reduced ? { opacity: 0 } : { width: 0, opacity: 0 }}\n            animate={{ width: \"auto\", opacity: 1 }}\n            exit={reduced ? { opacity: 0 } : { width: 0, opacity: 0 }}\n            transition={{ duration: reduced ? fade : motionTokens.duration.standard, ease: motionTokens.ease.default }}\n          >\n            <Spinner size=\"sm\" label={i18n(\"working\")} className={styles.spinner} />\n          </m.span>\n        )}\n      </AnimatePresence>\n      {iconOnly ? !loading && before : before}\n      {!iconOnly && text && (\n        <Label text={text} reduced={!!reduced} fade={fade} motionTokens={motionTokens} className={classNames?.label} />\n      )}\n      {after}\n    </m.button>\n  );\n  return <LazyMotion features={loaded ?? features}>{button}</LazyMotion>;\n}\n\n/**\n * The main action's light inside the glass, in a look that draws one (prism): its own angle from the start, turned by\n * where the pointer is across the face, a new angle at every press, and a sweep of split light (data-shift) when the\n * button's word, tone or variant changes after it first appears. Writes two style properties and one attribute on the\n * button; nothing runs at rest. Looks without this light ignore all three.\n */\nfunction usePrismLight(host: RefObject<HTMLButtonElement | null>, solid: boolean, state: string) {\n  const frame = useRef(0);\n  const shown = useRef(state);\n  const ending = useRef(0);\n  useLayoutEffect(() => {\n    const el = host.current;\n    if (el && solid) el.style.setProperty(\"--m-prism-seed\", Math.random().toFixed(3));\n  }, [host, solid]);\n  useLayoutEffect(() => {\n    const el = host.current;\n    if (!el || !solid || shown.current === state) return;\n    shown.current = state;\n    // restart the sweep if it is still running\n    delete el.dataset.shift;\n    void el.offsetWidth;\n    el.dataset.shift = \"\";\n    clearTimeout(ending.current);\n    ending.current = window.setTimeout(() => delete el.dataset.shift, 1200);\n  }, [host, solid, state]);\n  useLayoutEffect(\n    () => () => {\n      clearTimeout(ending.current);\n      cancelAnimationFrame(frame.current);\n    },\n    [],\n  );\n  return {\n    turn: (e: PointerEvent<HTMLButtonElement>) => {\n      if (!solid || e.pointerType !== \"mouse\" || frame.current) return;\n      const el = e.currentTarget;\n      const x = e.clientX;\n      frame.current = requestAnimationFrame(() => {\n        frame.current = 0;\n        const r = el.getBoundingClientRect();\n        if (r.width) el.style.setProperty(\"--m-prism-x\", ((x - r.left) / r.width).toFixed(3));\n      });\n    },\n    press: () => {\n      if (solid) host.current?.style.setProperty(\"--m-prism-seed\", Math.random().toFixed(3));\n    },\n  };\n}\n\n/** The text run. When it changes, the old words leave upward and the new ones rise in, while the width moves from the\n *  old measure to the new one; no measuring happens while the label is unchanged. */\nfunction Label({\n  text,\n  reduced,\n  fade,\n  motionTokens,\n  className,\n}: {\n  text: string;\n  reduced: boolean;\n  /** Seconds of the label crossfade under reduced motion (0 under none). */\n  fade: number;\n  /** The button's own, resolved at the button: the label sits inside it, in the same look and motion. */\n  motionTokens: ReturnType<typeof useMotionTokens>;\n  className?: string;\n}) {\n  const slot = useRef<HTMLSpanElement>(null);\n  const latest = useRef(motionTokens);\n  useLayoutEffect(() => {\n    latest.current = motionTokens;\n  }, [motionTokens]);\n  const last = useRef<{ text: string; width: number } | null>(null);\n  useLayoutEffect(() => {\n    const el = slot.current;\n    if (!el) return;\n    const prev = last.current;\n    // first mount: read the width after paint, when layout is already clean, instead of forcing a layout per button\n    if (!prev) {\n      last.current = { text, width: Number.NaN };\n      const id = requestAnimationFrame(() => {\n        if (last.current?.text === text) last.current = { text, width: el.getBoundingClientRect().width };\n      });\n      return () => cancelAnimationFrame(id);\n    }\n    el.style.width = \"\";\n    const width = el.getBoundingClientRect().width;\n    last.current = { text, width };\n    // a label that is not rendered (a hidden toolbar on a phone) has nothing to animate\n    if (prev.text === text || reduced || Number.isNaN(prev.width) || !el.getClientRects().length) return;\n    // The same spring, played natively: motion/mini samples the generator into a linear() easing.\n    const { visualDuration, bounce } = latest.current.spring.morph;\n    // while the width eases the words are clipped, not cut short with an ellipsis (that is for a room too narrow)\n    el.dataset.morphing = \"\";\n    const run = animate(el, { width: [`${prev.width}px`, `${width}px`] }, { type: spring, visualDuration, bounce });\n    run.then(() => {\n      el.style.width = \"\";\n      delete el.dataset.morphing;\n    });\n    // cancel, not stop: stop commits the running value, which throws once the element stops being rendered, and the\n    // next change measures afresh anyway\n    return () => {\n      run.cancel();\n      el.style.width = \"\";\n      delete el.dataset.morphing;\n    };\n  }, [text, reduced]);\n  // A label that changes faster than its words can rise in (a count read live while a hand drags) shows each new\n  // value at once: otherwise every value would start invisible and the button would read blank for the whole drag.\n  const rapid = useRapid(text, motionTokens.duration.standard * 1000);\n  const enter = reduced ? { opacity: 0 } : { opacity: 0, y: \"0.45em\", filter: `blur(${motionTokens.blur.subtle}px)` };\n  const leave = reduced\n    ? { opacity: 0 }\n    : {\n        opacity: 0,\n        y: \"-0.45em\",\n        filter: `blur(${motionTokens.blur.subtle}px)`,\n        transition: { duration: motionTokens.duration.fast },\n      };\n  return (\n    <span ref={slot} data-slot=\"button-label\" className={cn(styles.label, className)}>\n      <AnimatePresence mode=\"popLayout\" initial={false} custom={rapid}>\n        <Words\n          key={text}\n          className={styles.text}\n          custom={rapid}\n          variants={{\n            enter: (fast: boolean) => (fast ? { opacity: 1, y: \"0em\", filter: \"blur(0px)\" } : enter),\n            shown: { opacity: 1, y: \"0em\", filter: \"blur(0px)\" },\n            leave: (fast: boolean) => (fast ? { opacity: 0, transition: { duration: 0 } } : leave),\n          }}\n          initial=\"enter\"\n          animate=\"shown\"\n          exit=\"leave\"\n          transition={{ duration: reduced ? fade : motionTokens.duration.standard, ease: motionTokens.ease.default }}\n        >\n          {text}\n        </Words>\n      </AnimatePresence>\n    </span>\n  );\n}\n\n/** Whether `text` changed again within `ms` of its last change. Read in render: the answer belongs to this text. */\nfunction useRapid(text: string, ms: number) {\n  const seen = useRef({ text, at: Number.NEGATIVE_INFINITY, rapid: false });\n  if (seen.current.text !== text) {\n    const at = performance.now();\n    seen.current = { text, at, rapid: at - seen.current.at < ms };\n  }\n  return seen.current.rapid;\n}\n\n/** One label's words. Leaving, they are already gone for assistive tech: the button's name is the new label at once,\n *  not both while the old words animate away (or for good, where time stands still in a test). */\nfunction Words(props: ComponentProps<typeof m.span>) {\n  const present = useIsPresent();\n  return <m.span {...props} aria-hidden={present ? undefined : true} />;\n}\n\nexport default Button;\n"},{"path":"beamline/components/button/defaults.ts","type":"registry:file","target":"src/ui/beamline/components/button/defaults.ts","content":"import type { ButtonSize, ButtonTone, ButtonVariant } from \"./button-variants\";\n/** Scoped design choices only; no loading, events or domain state. */\nexport interface ButtonDefaults {\n  variant?: ButtonVariant;\n  size?: ButtonSize;\n  tone?: ButtonTone;\n}\n"},{"path":"beamline/components/button/messages.ts","type":"registry:file","target":"src/ui/beamline/components/button/messages.ts","content":"import type { MessageDefinitions } from \"../../runtime/messages\";\n/** Built-in English copy; stable keys are the public translation API. */\nexport const english = {\n  working: \"Working\",\n} satisfies MessageDefinitions;\n"},{"path":"beamline/components/button/motion-features.ts","type":"registry:file","target":"src/ui/beamline/components/button/motion-features.ts","content":"// REASON: Motion's DOM animation features (tween, spring, presence, press) are loaded after the first paint, so a\n// Button costs a small part of Motion on first load; LazyMotion in button.tsx renders until they arrive.\nimport { domAnimation } from \"motion/react\";\n\nexport default domAnimation;\n"},{"path":"beamline/components/comment-thread/comment-thread.module.css","type":"registry:file","target":"src/ui/beamline/components/comment-thread/comment-thread.module.css","content":"@layer properties, theme, base, components, utilities;\n@layer components {\n  /* Comment thread: a size container, so a narrow side panel indents replies less and keeps names on one line. */\n  .root {\n    display: grid;\n    gap: var(--pui-space-3);\n    container-type: inline-size;\n  }\n  .header {\n    display: flex;\n    align-items: center;\n    gap: var(--pui-space-2);\n  }\n  .title {\n    min-width: 0;\n    overflow: hidden;\n    color: var(--pui-ink);\n    font-size: var(--pui-text-sm);\n    font-weight: var(--pui-weight-medium);\n    text-overflow: ellipsis;\n    white-space: nowrap;\n  }\n  .count {\n    color: var(--pui-ink-3);\n    font-family: var(--pui-font-numeric);\n    font-size: var(--pui-text-2xs);\n  }\n  .resolved {\n    display: flex;\n    align-items: center;\n    gap: var(--pui-space-1-5);\n    padding: var(--pui-space-2) var(--pui-space-3);\n    border-radius: var(--pui-radius-control);\n    background: var(--pui-hover);\n    color: var(--pui-ink-3);\n    font-size: var(--pui-text-xs);\n  }\n  .resolved > svg {\n    width: 14px;\n    height: 14px;\n    color: var(--pui-green);\n  }\n  .content {\n    display: grid;\n    gap: var(--pui-space-3);\n  }\n  .list {\n    display: grid;\n    gap: var(--pui-space-4);\n  }\n  .empty {\n    color: var(--pui-ink-3);\n    font-size: var(--pui-text-xs);\n  }\n  .comment {\n    display: grid;\n    gap: var(--pui-space-2);\n  }\n  .row {\n    display: flex;\n    gap: var(--pui-space-2-5);\n  }\n  .body {\n    display: grid;\n    min-width: 0;\n    flex: 1;\n    gap: var(--pui-space-1);\n  }\n  .heading {\n    display: flex;\n    min-width: 0;\n    align-items: center;\n    gap: var(--pui-space-2);\n    min-height: 24px;\n  }\n  .author {\n    min-width: 0;\n    overflow: hidden;\n    color: var(--pui-ink);\n    font-size: var(--pui-text-sm);\n    font-weight: var(--pui-weight-medium);\n    text-overflow: ellipsis;\n    white-space: nowrap;\n  }\n  .time {\n    flex-shrink: 0;\n    color: var(--pui-ink-3);\n    font-size: var(--pui-text-2xs);\n  }\n  /* react, reply and your own actions: they wait at the end of the name line for attention and take no room of\n     their own when they arrive */\n  .tools {\n    display: flex;\n    flex-shrink: 0;\n    align-items: center;\n    gap: var(--pui-space-0-5);\n    margin-block: calc(var(--pui-space-1) * -1);\n    margin-inline-start: auto;\n  }\n  .text {\n    color: var(--pui-ink-2);\n    font-size: var(--pui-text-sm);\n    line-height: 1.625;\n    white-space: pre-wrap;\n  }\n  .reactions {\n    display: flex;\n    flex-wrap: wrap;\n    align-items: center;\n    gap: var(--pui-space-1);\n  }\n  /* a reaction: yours is filled, ringed and labelled \"including you\", so it never rests on colour alone; a press is\n     acknowledged at once */\n  .reaction {\n    display: inline-flex;\n    height: 24px;\n    align-items: center;\n    gap: var(--pui-space-1);\n    padding-inline: var(--pui-space-2);\n    border-radius: var(--pui-radius-pill);\n    color: var(--pui-ink-2);\n    font-size: var(--pui-text-xs);\n    transition:\n      background-color var(--pui-motion-out) var(--pui-ease-default),\n      color var(--pui-motion-out) var(--pui-ease-default),\n      scale var(--pui-motion-out) var(--pui-ease-default),\n      var(--m-transition);\n  }\n  .reaction[aria-pressed=\"true\"] {\n    background-color: var(--pui-current-tint, var(--pui-accent-tint));\n    box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--pui-current-edge, var(--pui-accent)) 40%, transparent);\n    color: var(--pui-current-edge, var(--pui-accent-ink));\n  }\n  .reaction:active {\n    scale: var(--pui-press-scale);\n    transition-duration: 0ms;\n  }\n  .reactionCount {\n    font-family: var(--pui-font-numeric);\n    font-size: var(--pui-text-2xs);\n  }\n  .option {\n    display: grid;\n    width: 32px;\n    height: 32px;\n    place-items: center;\n    border-radius: var(--pui-radius-chip);\n    font-size: var(--pui-text-lg);\n    transition:\n      background-color var(--pui-motion-out) var(--pui-ease-default),\n      scale var(--pui-motion-out) var(--pui-ease-default);\n  }\n  .option:hover {\n    background-color: var(--pui-hover);\n    transition-duration: 0ms;\n  }\n  .option:active {\n    scale: var(--pui-press-scale);\n    transition-duration: 0ms;\n  }\n  .replies {\n    display: grid;\n    gap: var(--pui-space-3);\n    /* the thread line runs down from the middle of a 28px avatar */\n    margin-inline-start: 14px;\n    padding-inline-start: var(--pui-space-4);\n    border-inline-start: 1px solid var(--pui-line-soft);\n  }\n  .composer {\n    display: grid;\n  }\n  .composerActions {\n    display: flex;\n    justify-content: flex-end;\n    gap: var(--pui-space-2);\n    padding-top: var(--pui-space-2);\n  }\n  @container (max-width: 24rem) {\n    .replies {\n      margin-inline-start: var(--pui-space-2);\n      padding-inline-start: var(--pui-space-2-5);\n    }\n    .row {\n      gap: var(--pui-space-2);\n    }\n  }\n}\n"},{"path":"beamline/components/comment-thread/comment-thread.tsx","type":"registry:file","target":"src/ui/beamline/components/comment-thread/comment-thread.tsx","content":"\"use client\";\n\nimport { useMessages } from \"../../runtime/localization\";\nimport { english as englishMessages } from \"./messages\";\nimport { Fragment, useRef, useState, type ReactNode, type CSSProperties, type Ref } from \"react\";\nimport { useFlip } from \"../../hooks/use-flip\";\nimport { SlotText } from \"../slot-text/slot-text\";\nimport { Check, CornerDownRight, MoreHorizontal, RotateCcw, SmilePlus } from \"lucide-react\";\nimport { Avatar } from \"../avatar/avatar\";\nimport { Button } from \"../button/button\";\nimport { DropdownMenu } from \"../dropdown-menu/dropdown-menu\";\nimport { InlineEdit } from \"../inline-edit/inline-edit\";\nimport { MentionInput, type MentionValue } from \"../mention-input/mention-input\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover/popover\";\nimport { cn } from \"../../lib/utils\";\nimport { useControllable } from \"../../hooks/use-controllable\";\nimport { localId } from \"../../lib/id\";\nimport { keepPlaceIfRemoved } from \"../../lib/focus\";\nimport styles from \"./comment-thread.module.css\";\n\nexport interface CommentAuthor {\n  /** Stable identifier used to match this record across updates. Required. */\n  id: string;\n  /** Human-readable name of this record. Required. */\n  name: string;\n  /** URL of the person avatar. Omitted by default. */\n  avatar?: string;\n}\nexport interface ThreadComment {\n  /** Stable identifier used to match this record across updates. Required. */\n  id: string;\n  /** Person who wrote this entry. Required. */\n  author: CommentAuthor;\n  /** Plain text; \"@Name\" of a known person is shown as a mention. */\n  body: string;\n  /** How the time reads: \"5h ago\", \"Yesterday\". */\n  createdAt: string;\n  /** Reactions recorded on this message. Omitted by default. */\n  reactions?: { emoji: string; users: string[] }[];\n  /** Replies in conversation order. Omitted by default. */\n  replies?: ThreadComment[];\n  /** Whether the message has been edited. Omitted by default. */\n  edited?: boolean;\n}\nexport interface CommentThreadEvent {\n  /** Type of record or operation. Required. */\n  type: \"add\" | \"reply\" | \"edit\" | \"delete\" | \"react\";\n  /** Id of the comment affected by the event. Required. */\n  commentId: string;\n}\n\nexport type CommentThreadClassNames = Partial<\n  Record<\n    | \"mention\"\n    | \"comment\"\n    | \"commentRow\"\n    | \"commentBody\"\n    | \"commentHeading\"\n    | \"author\"\n    | \"commentTime\"\n    | \"actions\"\n    | \"tools\"\n    | \"edit\"\n    | \"commentText\"\n    | \"actionRow\"\n    | \"reaction\"\n    | \"reactionCount\"\n    | \"reactionTrigger\"\n    | \"reactionPopup\"\n    | \"reactionOption\"\n    | \"reply\"\n    | \"replies\"\n    | \"root\"\n    | \"header\"\n    | \"title\"\n    | \"count\"\n    | \"resolve\"\n    | \"resolvedBody\"\n    | \"list\"\n    | \"empty\"\n    | \"composer\"\n    | \"composerActions\"\n    | \"content\"\n    | \"composerField\"\n    | \"cancel\"\n    | \"submit\",\n    string\n  >\n>;\n\nexport interface CommentThreadProps {\n  /** Classes for the named visual parts; no part overrides by default. */\n  classNames?: CommentThreadClassNames;\n  /** Inline styles on the documented visual root; no inline overrides by default. */\n  style?: CSSProperties;\n  /** Receives the documented root element; no ref by default. */\n  ref?: Ref<HTMLElement>;\n  /** Controlled comments displayed in the discussion; omit to use defaultComments. */\n  comments?: ThreadComment[];\n  /** Initial comments when uncontrolled. Defaults to an empty list. */\n  defaultComments?: ThreadComment[];\n  /** Reports comments after a change; no callback by default. */\n  onCommentsChange?: (comments: ThreadComment[], event: CommentThreadEvent) => void;\n  /** Person whose comments can be edited or removed. Required. */\n  currentUser: CommentAuthor;\n  /** Who can be @mentioned. */\n  people?: CommentAuthor[];\n  /** Controlled discussion resolution state; omit to use defaultResolved. */\n  resolved?: boolean;\n  /** Initial resolved state when uncontrolled. Defaults to false. */\n  defaultResolved?: boolean;\n  /** Reports resolved state after a change; no callback by default. */\n  onResolvedChange?: (resolved: boolean) => void;\n  /** Heading shown above the content. Defaults to no heading. */\n  title?: ReactNode;\n  /** Reactions on offer. Default 👍 🎉 👀 ✅. */\n  reactions?: string[];\n  /** Text shown before a value is entered or selected. Defaults to \"Add a comment\". */\n  placeholder?: string;\n  /** Deepest reply level. Default 2. */\n  maxDepth?: number;\n  /** How a new comment's time reads. Default \"now\". */\n  nowLabel?: string;\n  /** Classes on the documented visual root; no override by default. */\n  className?: string;\n}\n\nconst update = (list: ThreadComment[], id: string, fn: (c: ThreadComment) => ThreadComment | null): ThreadComment[] =>\n  list.flatMap((c) => {\n    if (c.id === id) {\n      const n = fn(c);\n      return n ? [n] : [];\n    }\n    return [{ ...c, replies: c.replies ? update(c.replies, id, fn) : c.replies }];\n  });\nconst count = (list: ThreadComment[]): number => list.reduce((n, c) => n + 1 + count(c.replies ?? []), 0);\n\n/**\n * A discussion attached to something: comments with replies, reactions, @mentions, editing and deleting your own,\n * and resolving the thread (it folds to a line that can reopen). At rest each comment shows who, when, what and its\n * reactions; react, reply and your own actions arrive when you point at or focus a comment (always shown on touch).\n * New comments and reactions grow in, counts roll, the composer's buttons appear once you start, and resolving\n * folds the thread to its line in place.\n */\nexport function CommentThread({\n  comments: listProp,\n  defaultComments = [],\n  onCommentsChange,\n  currentUser,\n  people = [],\n  resolved: resolvedProp,\n  defaultResolved = false,\n  onResolvedChange,\n  title,\n  reactions = [\"👍\", \"🎉\", \"👀\", \"✅\"],\n  placeholder: placeholderProp,\n  maxDepth = 2,\n  nowLabel: nowLabelProp,\n  className,\n  classNames,\n  style,\n  ref,\n}: CommentThreadProps) {\n  const i18n = useMessages(\"comment-thread\", englishMessages);\n  const placeholder = placeholderProp === undefined ? i18n(\"placeholder\") : placeholderProp;\n  const nowLabel = nowLabelProp === undefined ? i18n(\"nowLabel\") : nowLabelProp;\n\n  // each change also says what happened (posted, edited, resolved), so the event is reported beside the list\n  const [list, setList] = useControllable(listProp, defaultComments);\n  const set = (next: ThreadComment[], event: CommentThreadEvent) => {\n    setList(next);\n    onCommentsChange?.(next, event);\n  };\n  const [resolved, resolve] = useControllable(resolvedProp, defaultResolved, onResolvedChange);\n  const [replyTo, setReplyTo] = useState<string | null>(null);\n  const everyone = [currentUser, ...people.filter((p) => p.id !== currentUser.id)];\n\n  const add = (body: string, parent?: string) => {\n    const c: ThreadComment = {\n      id: localId(\"c\"),\n      author: currentUser,\n      body,\n      createdAt: nowLabel,\n    };\n    if (!parent) set([...list, c], { type: \"add\", commentId: c.id });\n    else {\n      set(\n        update(list, parent, (p) => ({ ...p, replies: [...(p.replies ?? []), c] })),\n        { type: \"reply\", commentId: c.id },\n      );\n      setReplyTo(null);\n    }\n  };\n  const react = (id: string, emoji: string) =>\n    set(\n      update(list, id, (c) => {\n        const rs = (c.reactions ?? []).map((r) => ({ ...r, users: [...r.users] }));\n        const r = rs.find((x) => x.emoji === emoji);\n        if (!r) rs.push({ emoji, users: [currentUser.id] });\n        else if (r.users.includes(currentUser.id)) r.users = r.users.filter((u) => u !== currentUser.id);\n        else r.users = [...r.users, currentUser.id];\n        return { ...c, reactions: rs.filter((x) => x.users.length) };\n      }),\n      { type: \"react\", commentId: id },\n    );\n\n  const body = (text: string) => {\n    const names = everyone\n      .map((p) => p.name)\n      .sort((a, b) => b.length - a.length)\n      .map((n) => n.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\"));\n    if (!names.length) return text;\n    const re = new RegExp(`(@(?:${names.join(\"|\")}))`, \"g\");\n    return text.split(re).map((part, i) =>\n      i % 2 ? (\n        <span\n          data-slot=\"comment-thread-mention\"\n          key={i}\n          className={cn(\n            \"rounded-[calc(var(--pui-radius-chip)-2px)] bg-accent-tint px-0.5 text-accent-ink\",\n            classNames?.mention,\n          )}\n        >\n          {part}\n        </span>\n      ) : (\n        <Fragment key={i}>{part}</Fragment>\n      ),\n    );\n  };\n\n  // a new comment or reply grows in and the thread makes room; a deleted one fades where it stood\n  const thread = useRef<HTMLOListElement>(null);\n  useFlip(thread);\n  const total = count(list);\n  const item = (c: ThreadComment, depth: number): ReactNode => {\n    const mine = c.author.id === currentUser.id;\n    return (\n      <li\n        data-slot=\"comment-thread-comment\"\n        key={c.id}\n        data-flip={c.id}\n        data-comment={c.id}\n        className={cn(styles.comment, classNames?.comment)}\n      >\n        {/* the row is what attention reveals tools on: pointing at a reply does not light its parent's */}\n        <div data-slot=\"comment-thread-commentRow\" className={cn(\"reveal-host\", styles.row, classNames?.commentRow)}>\n          <Avatar name={c.author.name} src={c.author.avatar} size=\"sm\" />\n          <div data-slot=\"comment-thread-commentBody\" className={cn(styles.body, classNames?.commentBody)}>\n            <div data-slot=\"comment-thread-commentHeading\" className={cn(styles.heading, classNames?.commentHeading)}>\n              <span data-slot=\"comment-thread-author\" className={cn(styles.author, classNames?.author)}>\n                {c.author.name}\n              </span>\n              <span data-slot=\"comment-thread-commentTime\" className={cn(styles.time, classNames?.commentTime)}>\n                {c.createdAt}\n                {c.edited ? i18n(\"edited\") : \"\"}\n              </span>\n              <Tools\n                classNames={classNames}\n                reactions={reactions}\n                onReact={(e) => react(c.id, e)}\n                onReply={depth < maxDepth ? () => setReplyTo(replyTo === c.id ? null : c.id) : undefined}\n                replying={replyTo === c.id}\n                author={c.author.name}\n                onDelete={\n                  mine\n                    ? () => {\n                        keepPlaceIfRemoved(document.querySelector(`[data-comment=\"${CSS.escape(c.id)}\"]`));\n                        set(\n                          update(list, c.id, () => null),\n                          { type: \"delete\", commentId: c.id },\n                        );\n                      }\n                    : undefined\n                }\n              />\n            </div>\n            {mine ? (\n              <InlineEdit\n                label={i18n(\"yourComment\")}\n                value={c.body}\n                multiline\n                onSave={(text) =>\n                  set(\n                    update(list, c.id, (x) => ({ ...x, body: text, edited: true })),\n                    { type: \"edit\", commentId: c.id },\n                  )\n                }\n                // the edit pencil sits in the top end corner, so a full last line never wraps it onto a line of its own\n                className={cn(\n                  \"pe-6 text-sm text-ink-2 [&>svg]:absolute [&>svg]:end-1.5 [&>svg]:top-1\",\n                  classNames?.edit,\n                )}\n              />\n            ) : (\n              <p data-slot=\"comment-thread-commentText\" className={cn(styles.text, classNames?.commentText)}>\n                {body(c.body)}\n              </p>\n            )}\n            {!!c.reactions?.length && (\n              <Reactions\n                list={c.reactions}\n                me={currentUser.id}\n                onReact={(e) => react(c.id, e)}\n                classNames={classNames}\n              />\n            )}\n          </div>\n        </div>\n        {(c.replies?.length || replyTo === c.id) && (\n          <ol data-slot=\"comment-thread-replies\" className={cn(styles.replies, classNames?.replies)}>\n            {c.replies?.map((r) => item(r, depth + 1))}\n            {replyTo === c.id && (\n              // the reply field opens under the comment, pushing what follows down instead of jumping\n              <li className=\"enter-grow\">\n                <div>\n                  <Composer\n                    classNames={classNames}\n                    people={everyone}\n                    placeholder={i18n(\"replyTo\", { name: c.author.name })}\n                    onSend={(t) => add(t, c.id)}\n                    onCancel={() => setReplyTo(null)}\n                    autoFocus\n                  />\n                </div>\n              </li>\n            )}\n          </ol>\n        )}\n      </li>\n    );\n  };\n\n  return (\n    <section\n      ref={ref}\n      style={style}\n      data-slot=\"comment-thread\"\n      data-resolved={resolved ? \"\" : undefined}\n      aria-label={typeof title === \"string\" ? title : i18n(\"comments\")}\n      className={cn(styles.root, classNames?.root, className)}\n    >\n      <header data-slot=\"comment-thread-header\" className={cn(styles.header, classNames?.header)}>\n        {title && (\n          <h3 data-slot=\"comment-thread-title\" className={cn(styles.title, classNames?.title)}>\n            {title}\n          </h3>\n        )}\n        <span data-slot=\"comment-thread-count\" className={cn(styles.count, classNames?.count)}>\n          <SlotText value={total} />\n        </span>\n        {list.length > 0 && (\n          <Button\n            variant=\"ghost\"\n            size=\"sm\"\n            aria-pressed={resolved}\n            className={cn(\"ms-auto\", classNames?.resolve)}\n            onClick={() => resolve(!resolved)}\n          >\n            {resolved ? (\n              <>\n                <RotateCcw />\n                {i18n(\"reopen\")}\n              </>\n            ) : (\n              <>\n                <Check />\n                {i18n(\"resolve\")}\n              </>\n            )}\n          </Button>\n        )}\n      </header>\n      {/* resolving folds the thread to one line in place, and reopening unfolds it: both keep their own height */}\n      <div data-slot=\"comment-thread-resolved\" data-open={resolved || undefined} className=\"disclosure-panel\">\n        <div>\n          <p data-slot=\"comment-thread-resolvedBody\" className={cn(styles.resolved, classNames?.resolvedBody)}>\n            <Check aria-hidden />\n            {i18n(\"resolved\", { count: total })}\n          </p>\n        </div>\n      </div>\n      <div\n        data-slot=\"comment-thread-content\"\n        data-open={resolved ? undefined : \"\"}\n        inert={resolved}\n        className={cn(\"disclosure-panel\", classNames?.content)}\n      >\n        <div className={styles.content}>\n          {list.length > 0 ? (\n            <ol ref={thread} data-slot=\"comment-thread-list\" className={cn(styles.list, classNames?.list)}>\n              {list.map((c) => item(c, 0))}\n            </ol>\n          ) : (\n            <p data-slot=\"comment-thread-empty\" className={cn(styles.empty, classNames?.empty)}>\n              {i18n(\"noCommentsYet\")}\n            </p>\n          )}\n          <Composer classNames={classNames} people={everyone} placeholder={placeholder} onSend={(t) => add(t)} />\n        </div>\n      </div>\n    </section>\n  );\n}\n\n/** A comment's tools: react, reply and (your own) more. They wait for attention, and stay while one of their menus is\n *  open, so the menu never hangs from a trigger that has gone. */\nfunction Tools({\n  classNames,\n  reactions,\n  onReact,\n  onReply,\n  replying,\n  author,\n  onDelete,\n}: {\n  classNames?: CommentThreadClassNames;\n  reactions: string[];\n  onReact: (emoji: string) => void;\n  onReply?: () => void;\n  replying: boolean;\n  author: string;\n  onDelete?: () => void;\n}) {\n  const i18n = useMessages(\"comment-thread\", englishMessages);\n\n  const [picking, setPicking] = useState(false);\n  const [menu, setMenu] = useState(false);\n  return (\n    <span\n      data-slot=\"comment-thread-tools\"\n      data-shown={picking || menu || replying || undefined}\n      className={cn(\"reveal\", styles.tools, classNames?.tools)}\n    >\n      <Popover open={picking} onOpenChange={setPicking}>\n        <PopoverTrigger asChild>\n          <Button\n            variant=\"ghost\"\n            size=\"sm\"\n            aria-label={i18n(\"addAReaction\")}\n            title={i18n(\"addAReaction\")}\n            className={cn(\"size-6 min-w-6 p-0 [&_svg]:!size-3.5\", classNames?.reactionTrigger)}\n          >\n            <SmilePlus />\n          </Button>\n        </PopoverTrigger>\n        <PopoverContent side=\"top\" className={cn(\"flex gap-1 p-1\", classNames?.reactionPopup)}>\n          {reactions.map((e) => (\n            <button\n              data-slot=\"comment-thread-reactionOption\"\n              key={e}\n              type=\"button\"\n              aria-label={i18n(\"react\", { e: e })}\n              onClick={() => {\n                onReact(e);\n                setPicking(false);\n              }}\n              className={cn(styles.option, classNames?.reactionOption)}\n            >\n              {e}\n            </button>\n          ))}\n        </PopoverContent>\n      </Popover>\n      {onReply && (\n        <Button\n          variant=\"ghost\"\n          size=\"sm\"\n          aria-label={i18n(\"replyTo2\", { author: author })}\n          title={i18n(\"reply\")}\n          aria-expanded={replying}\n          className={cn(\"size-6 min-w-6 p-0 [&_svg]:!size-3.5\", classNames?.reply)}\n          onClick={onReply}\n        >\n          <CornerDownRight />\n        </Button>\n      )}\n      {onDelete && (\n        <span data-slot=\"comment-thread-actions\" className={classNames?.actions}>\n          <DropdownMenu\n            label={i18n(\"actionsForYourComment\")}\n            icon={<MoreHorizontal />}\n            size=\"sm\"\n            variant=\"ghost\"\n            open={menu}\n            onOpenChange={setMenu}\n            items={[{ label: i18n(\"delete\"), tone: \"danger\", onSelect: onDelete }]}\n          />\n        </span>\n      )}\n    </span>\n  );\n}\n\n/** Reactions on a comment: a new one grows in, a count rolls, and yours is marked by fill, ring and its label. */\nfunction Reactions({\n  list,\n  me,\n  onReact,\n  classNames,\n}: {\n  list: { emoji: string; users: string[] }[];\n  me: string;\n  onReact: (emoji: string) => void;\n  classNames?: CommentThreadClassNames;\n}) {\n  const i18n = useMessages(\"comment-thread\", englishMessages);\n\n  const row = useRef<HTMLDivElement>(null);\n  useFlip(row);\n  return (\n    <div ref={row} data-slot=\"comment-thread-actionRow\" className={cn(styles.reactions, classNames?.actionRow)}>\n      {list.map((r) => {\n        const mine = r.users.includes(me);\n        return (\n          <button\n            data-slot=\"comment-thread-reaction\"\n            key={r.emoji}\n            data-flip={r.emoji}\n            type=\"button\"\n            aria-pressed={mine}\n            aria-label={`${r.emoji} ${r.users.length}${mine ? i18n(\"includingYou\") : \"\"}`}\n            onClick={() => onReact(r.emoji)}\n            className={cn(styles.reaction, !mine && \"m-control\", classNames?.reaction)}\n          >\n            <span aria-hidden>{r.emoji}</span>\n            <span\n              aria-hidden\n              data-slot=\"comment-thread-reactionCount\"\n              className={cn(styles.reactionCount, classNames?.reactionCount)}\n            >\n              <SlotText value={r.users.length} />\n            </span>\n          </button>\n        );\n      })}\n    </div>\n  );\n}\n\nfunction Composer({\n  classNames,\n  people,\n  placeholder,\n  onSend,\n  onCancel,\n  autoFocus,\n}: {\n  classNames?: CommentThreadClassNames;\n  people: CommentAuthor[];\n  placeholder: string;\n  onSend: (text: string) => void;\n  onCancel?: () => void;\n  autoFocus?: boolean;\n}) {\n  const i18n = useMessages(\"comment-thread\", englishMessages);\n\n  const [value, setValue] = useState<MentionValue>({ text: \"\", mentions: [] });\n  // the buttons wait until someone starts: a thread at rest ends in one quiet field\n  const [focused, setFocused] = useState(!!autoFocus);\n  const started = focused || !!value.text || !!onCancel;\n  const send = () => {\n    if (value.text.trim()) {\n      onSend(value.text.trim());\n      setValue({ text: \"\", mentions: [] });\n    }\n  };\n  return (\n    <div\n      data-slot=\"comment-thread-composer\"\n      className={cn(styles.composer, classNames?.composer)}\n      onKeyDown={(e) => {\n        if (e.key === \"Escape\" && onCancel) onCancel();\n      }}\n      onFocus={() => setFocused(true)}\n      onBlur={(e) => {\n        if (!e.currentTarget.contains(e.relatedTarget as Node)) setFocused(false);\n      }}\n      ref={(el) => {\n        if (autoFocus && el && !el.dataset.focused) {\n          el.dataset.focused = \"1\";\n          el.querySelector(\"textarea\")?.focus();\n        }\n      }}\n    >\n      <MentionInput\n        className={classNames?.composerField}\n        aria-label={placeholder}\n        placeholder={i18n(\"toMention\", { placeholder: placeholder })}\n        people={people.map((p) => ({ id: p.id, name: p.name, avatarSrc: p.avatar }))}\n        value={value}\n        onValueChange={setValue}\n        onSubmit={send}\n        minRows={1}\n        maxRows={6}\n      />\n      <div data-open={started || undefined} className=\"disclosure-panel\">\n        <div>\n          <div\n            data-slot=\"comment-thread-composerActions\"\n            className={cn(styles.composerActions, classNames?.composerActions)}\n          >\n            {onCancel && (\n              <Button className={classNames?.cancel} variant=\"ghost\" size=\"sm\" onClick={onCancel}>\n                {i18n(\"cancel\")}\n              </Button>\n            )}\n            <Button className={classNames?.submit} size=\"sm\" disabled={!value.text.trim()} onClick={send}>\n              {i18n(\"comment2\")}\n            </Button>\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n}\n\nexport default CommentThread;\n"},{"path":"beamline/components/comment-thread/messages.ts","type":"registry:file","target":"src/ui/beamline/components/comment-thread/messages.ts","content":"import type { MessageDefinitions } from \"../../runtime/messages\";\n/** Built-in English copy; stable keys are the public translation API. */\nexport const english = {\n  placeholder: \"Add a comment\",\n  nowLabel: \"now\",\n  edited: \" · edited\",\n  yourComment: \"Your comment\",\n  replyTo: \"Reply to {name}\",\n  comments: \"Comments\",\n  reopen: \"Reopen\",\n  resolve: \"Resolve\",\n  resolved: {\n    one: \"Resolved · {count} comment\",\n    other: \"Resolved · {count} comments\",\n  },\n  noCommentsYet: \"No comments yet.\",\n  addAReaction: \"Add a reaction\",\n  react: \"React {e}\",\n  replyTo2: \"Reply to {author}\",\n  reply: \"Reply\",\n  actionsForYourComment: \"Actions for your comment\",\n  delete: \"Delete\",\n  toMention: \"{placeholder} · @ to mention\",\n  cancel: \"Cancel\",\n  comment2: \"Comment\",\n  includingYou: \", including you\",\n} satisfies MessageDefinitions;\n"},{"path":"beamline/components/dropdown-menu/defaults.ts","type":"registry:file","target":"src/ui/beamline/components/dropdown-menu/defaults.ts","content":"/** Pure allowed presentation defaults for DropdownMenu; no component or runtime imports. */\nexport interface DropdownMenuDefaults {\n  /** Shared variant setting; omit to inherit the surrounding scope or the component default. */\n  variant?: \"primary\" | \"secondary\" | \"outline\" | \"ghost\" | \"danger\" | \"accent\";\n  /** Shared size setting; omit to inherit the surrounding scope or the component default. */\n  size?: \"sm\" | \"md\" | \"lg\" | \"touch\";\n  /** Shared align setting; omit to inherit the surrounding scope or the component default. */\n  align?: \"start\" | \"center\" | \"end\";\n}\n"},{"path":"beamline/components/dropdown-menu/dropdown-menu.tsx","type":"registry:file","target":"src/ui/beamline/components/dropdown-menu/dropdown-menu.tsx","content":"\"use client\";\n\nimport { useComponentDefaults } from \"../../runtime/appearance\";\nimport type { DropdownMenuDefaults } from \"./defaults\";\nexport type { DropdownMenuDefaults } from \"./defaults\";\n\nimport type { CSSProperties, Ref, ReactElement, ReactNode } from \"react\";\nimport * as RadixMenu from \"@radix-ui/react-dropdown-menu\";\nimport { Button, type ButtonSize, type ButtonVariant } from \"../button/button\";\nimport {\n  MenuItems,\n  MenuSurface,\n  useMenuDirection,\n  type MenuItem,\n  type MenuClassNames,\n} from \"../_shared/menu\";\nimport { cn } from \"../../lib/utils\";\nimport { usePortalContainer } from \"../../runtime/appearance\";\n\nexport type { MenuItem, MenuClassNames };\n\nexport interface DropdownMenuProps {\n  /** The menu's name: the trigger's text, or its accessible name when the trigger is an icon. */\n  label: string;\n  /** Items rendered in the component. Required. */\n  items: MenuItem[];\n  /** An icon for the built-in trigger (MoreHorizontal for row actions); with it the trigger shows only the icon, and\n   *  label becomes its accessible name, unless showLabel is set. */\n  icon?: ReactNode;\n  /** Shows the label beside the icon. Defaults to false. */\n  showLabel?: boolean;\n  /** Your own trigger (a Button, an avatar); it receives the open state and keyboard handling. */\n  trigger?: ReactElement;\n  /** Visual weight of the control. Defaults to \"ghost\". */\n  variant?: ButtonVariant;\n  /** Control size within the supported size steps. Defaults to \"sm\". */\n  size?: ButtonSize;\n  /** Alignment within the available space. Defaults to \"end\". */\n  align?: \"start\" | \"center\" | \"end\";\n  /** Edge from which the panel or anchored content opens. Defaults to \"bottom\". */\n  side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n  /** Controlled open state; omit to use defaultOpen. */\n  open?: boolean;\n  /** Initial open state when uncontrolled. Defaults to false. */\n  defaultOpen?: boolean;\n  /** Reports open state after a change; no callback by default. */\n  onOpenChange?: (open: boolean) => void;\n  /** Classes on the documented visual root; no override by default. */\n  className?: string;\n  /** Classes for the named visual parts; no part overrides by default. */\n  classNames?: MenuClassNames;\n  /** Inline styles on the documented visual root; no inline overrides by default. */\n  style?: CSSProperties;\n  /** Receives the documented root element; no ref by default. */\n  ref?: Ref<HTMLDivElement>;\n  /** Reading direction; inherits the surrounding direction when omitted. Defaults to the surrounding reading direction. */\n  dir?: \"ltr\" | \"rtl\";\n}\n\n/**\n * A list of actions behind a trigger: row actions, \"More\", an account menu. One highlight plate glides between rows\n * under the pointer and jumps with the keyboard; type to jump to an item; → opens a submenu.\n */\nexport function DropdownMenu({\n  label,\n  items,\n  icon,\n  showLabel = false,\n  trigger,\n  variant: variantProp,\n  size: sizeProp,\n  align: alignProp,\n  side = \"bottom\",\n  open,\n  defaultOpen,\n  onOpenChange,\n  className,\n  classNames,\n  style,\n  ref,\n  dir: direction,\n}: DropdownMenuProps) {\n  const scopeDefaults = useComponentDefaults<DropdownMenuDefaults>(\"dropdown-menu\", [\"variant\", \"size\", \"align\"]);\n  const variant = variantProp ?? scopeDefaults.variant ?? \"ghost\";\n  const size = sizeProp ?? scopeDefaults.size ?? \"sm\";\n  const align = alignProp ?? scopeDefaults.align ?? \"end\";\n\n  const container = usePortalContainer();\n  const iconOnly = !!icon && !showLabel;\n  const { dir, triggerProps } = useMenuDirection(direction);\n  return (\n    <RadixMenu.Root dir={dir} open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>\n      <RadixMenu.Trigger asChild data-slot=\"dropdown-menu-trigger\" className={classNames?.trigger} {...triggerProps}>\n        {trigger ?? (\n          <Button\n            data-slot=\"dropdown-menu-trigger\"\n            variant={variant}\n            size={size}\n            aria-label={iconOnly ? label : undefined}\n          >\n            {icon}\n            {!iconOnly && label}\n          </Button>\n        )}\n      </RadixMenu.Trigger>\n      {container !== null && (\n        <RadixMenu.Portal container={container}>\n          <MenuSurface\n            kit={RadixMenu}\n            label={label}\n            align={align}\n            side={side}\n            sideOffset={6}\n            className={cn(classNames?.root, className)}\n            classNames={classNames}\n            style={style}\n            ref={ref}\n          >\n            <MenuItems kit={RadixMenu} items={items} container={container} classNames={classNames} />\n          </MenuSurface>\n        </RadixMenu.Portal>\n      )}\n    </RadixMenu.Root>\n  );\n}\n\nexport default DropdownMenu;\n"},{"path":"beamline/components/inline-edit/defaults.ts","type":"registry:file","target":"src/ui/beamline/components/inline-edit/defaults.ts","content":"/** Pure allowed presentation defaults for InlineEdit; no component or runtime imports. */\nexport interface InlineEditDefaults {\n  /** Shared textStyle setting; omit to inherit the component default. Scoped defaults retain the legacy key variant. */\n  variant?: \"body\" | \"title\";\n}\n"},{"path":"beamline/components/inline-edit/inline-edit.module.css","type":"registry:file","target":"src/ui/beamline/components/inline-edit/inline-edit.module.css","content":"@layer properties, theme, base, components, utilities;\n@layer components {\n  /* Inline edit: the text and the field it turns into share one box (same padding, same type), so nothing moves when\n   editing starts. Reading is unpainted text that steps one rung on hover and shows its pencil; editing wears the\n   field role of the look, with invalid drawn through the role's inputs like every field (O1 §2). */\n  .display {\n    position: relative;\n    margin-inline: calc(var(--pui-space-1-5) * -1);\n    padding: var(--pui-size-0-5, 0.125rem) var(--pui-space-1-5); /* block = size: the line keeps its height */\n    border-radius: var(--pui-radius-chip);\n    color: var(--pui-ink);\n    transition: background-color var(--pui-motion-out) var(--pui-ease-default);\n  }\n  .display[data-empty] {\n    color: var(--pui-ink-3);\n  }\n  .display:where([role=\"button\"]) {\n    cursor: text;\n  }\n  .display:where([role=\"button\"]):hover {\n    background: var(--pui-hover);\n    transition-duration: 0ms;\n  }\n  /* the pencil is the shared reveal (utilities.css): it arrives with the pointer or focus and is always there on touch */\n  .pencil {\n    display: inline;\n    width: var(--pui-icon-sm);\n    height: var(--pui-icon-sm);\n    margin-inline-start: var(--pui-space-1-5);\n    vertical-align: baseline;\n    color: var(--pui-ink-3);\n  }\n  .tail {\n    white-space: nowrap;\n  }\n  /* saved: the text is the new text at once; afterwards a green tint fades from it and a check stands where the pencil\n     was, then the pencil comes back (commit at once, explain after) */\n  .display[data-saved] {\n    animation: saved var(--pui-duration-flash) var(--pui-ease-default);\n  }\n  @keyframes saved {\n    from {\n      background-color: var(--pui-green-tint);\n    }\n  }\n  .saved {\n    color: var(--pui-green);\n    animation: saved-mark var(--pui-motion-in) var(--pui-ease-default);\n  }\n  @keyframes saved-mark {\n    from {\n      opacity: 0;\n      scale: calc(1 - 0.4 * var(--pui-motion-travel, 1));\n    }\n  }\n\n  /* a number: tabular figures, so a column of them lines up and a digit typed never shifts the rest */\n  .numeric,\n  .numeric .field {\n    font-variant-numeric: tabular-nums;\n  }\n  [data-align=\"end\"],\n  [data-align=\"end\"] .field {\n    text-align: end;\n  }\n  /* cell: the value fills its cell (a block: the whole cell is the target), the field takes the cell's width */\n  .editor[data-density=\"cell\"] {\n    display: grid;\n    width: 100%;\n    min-width: 0;\n  }\n  .editor[data-density=\"cell\"] .field {\n    min-width: 0;\n  }\n  /* a problem in a cell floats under it, so the row never opens */\n  .editor[data-density=\"cell\"] .problem {\n    position: absolute;\n    z-index: 2;\n    inset-block-start: calc(100% + var(--pui-space-1));\n    inset-inline-end: 0;\n    width: max-content;\n    max-width: 24ch;\n    padding: var(--pui-space-1-5) var(--pui-space-2);\n    border-radius: var(--pui-radius-chip);\n    background: var(--pui-surface);\n    box-shadow:\n      var(--pui-shadow-xs),\n      0 0 0 1px var(--pui-line);\n    text-align: start;\n    contain: none;\n  }\n  .editor[data-density=\"cell\"]:not([data-align=\"end\"]) .problem {\n    inset-inline: 0 auto;\n  }\n\n  .title {\n    /* the heading role: face, size, weight, leading and tracking from the look */\n  }\n  .body {\n    font-size: var(--pui-text-base);\n    line-height: var(--pui-leading-body);\n    letter-spacing: var(--pui-tracking-body);\n  }\n\n  .editor {\n    position: relative;\n    display: grid;\n    gap: var(--pui-space-1-5);\n  }\n  .editor[data-multiline] {\n    width: 100%;\n  }\n  .editor:not([data-multiline]) {\n    display: inline-grid;\n    min-width: min(24ch, 100%); /* room to type, and a message wraps at a readable width; never past a narrow room */\n    max-width: 100%;\n  }\n  .box {\n    position: relative;\n    display: grid;\n  }\n  .field {\n    width: calc(100% + 12px);\n    margin-inline: calc(var(--pui-space-1-5) * -1);\n    padding: var(--pui-size-0-5, 0.125rem) var(--pui-space-1-5); /* block = size: the line keeps its height */\n    border: 0;\n    border-radius: var(--pui-radius-chip);\n    color: var(--pui-ink);\n    outline: none;\n    resize: none;\n    field-sizing: content;\n    transition: var(--m-transition);\n  }\n  .field::placeholder {\n    color: var(--pui-ink-3);\n    opacity: 1;\n  }\n  .field:focus-visible {\n    outline: none; /* the field role's focus edge is the visible indicator */\n  }\n  .field[aria-busy=\"true\"] {\n    padding-inline-end: var(--pui-space-7);\n    color: var(--pui-ink-2);\n  }\n  .spinner {\n    position: absolute;\n    inset-inline-end: 0;\n    inset-block: 0;\n    display: grid;\n    place-items: center;\n  }\n\n  .hint,\n  .problem {\n    font-size: var(--pui-text-xs);\n    line-height: 1.35;\n    contain: inline-size; /* the message wraps to the field's width instead of widening it */\n  }\n  .hint {\n    color: var(--pui-ink-3);\n    unicode-bidi: plaintext; /* \"⌘Enter saves\" keeps its order in a right-to-left page */\n  }\n  .problem {\n    display: flex;\n    align-items: flex-start;\n    gap: var(--pui-space-1-5);\n    color: var(--pui-red);\n    animation: problem-in var(--pui-motion-in) var(--pui-ease-default);\n  }\n  @keyframes problem-in {\n    from {\n      opacity: 0;\n      translate: 0 calc(-2px * var(--pui-motion-travel, 1));\n    }\n  }\n  .problem svg {\n    flex-shrink: 0;\n    width: var(--pui-icon-sm);\n    height: var(--pui-icon-sm);\n    margin-top: calc(var(--pui-space-0-5) / 2);\n  }\n}\n/* CSS-module composition only; visual rules stay in the component layer. */\n.title {\n  composes: text-heading from global;\n}\n.field {\n  composes: m-field from global;\n}\n"},{"path":"beamline/components/inline-edit/inline-edit.tsx","type":"registry:file","target":"src/ui/beamline/components/inline-edit/inline-edit.tsx","content":"\"use client\";\n\nimport { numberFormatter, useLocale, useMessages } from \"../../runtime/localization\";\nimport { parseLocaleNumber } from \"../../lib/number\";\nimport { english as englishMessages } from \"./messages\";\nimport { useDeprecatedProp } from \"../../hooks/use-deprecated-prop\";\n\nimport type { CSSProperties, Ref } from \"react\";\n\nimport { useComponentDefaults } from \"../../runtime/appearance\";\nimport type { InlineEditDefaults } from \"./defaults\";\nimport { cssEase } from \"../../lib/motion-tokens\";\nexport type { InlineEditDefaults } from \"./defaults\";\n\nimport {\n  useEffect,\n  useId,\n  useLayoutEffect,\n  useMemo,\n  useRef,\n  useState,\n  type ChangeEvent,\n  type AnimationEvent,\n  type ElementType,\n  type KeyboardEvent,\n} from \"react\";\nimport { AlertCircle, Check, Pencil } from \"lucide-react\";\nimport { Spinner } from \"../spinner/spinner\";\nimport { useComposedRef } from \"../../hooks/use-composed-ref\";\nimport { useMotionTokens } from \"../../hooks/use-motion-tokens\";\nimport { cn } from \"../../lib/utils\";\nimport { useControllable } from \"../../hooks/use-controllable\";\nimport styles from \"./inline-edit.module.css\";\n\nexport type InlineEditClassNames = Partial<\n  Record<\"root\" | \"tail\" | \"pencil\" | \"box\" | \"spinner\" | \"problem\" | \"hint\" | \"field\", string>\n>;\n\nexport interface InlineEditProps {\n  /** Classes for the named visual parts; no part overrides by default. */\n  classNames?: InlineEditClassNames;\n  /** Controlled committed text; omitted by default to keep accepted edits locally. */\n  value?: string;\n  /** Initial committed text when uncontrolled; defaults to an empty string. */\n  defaultValue?: string;\n  /** Reports committed text after onSave succeeds; no callback by default. */\n  onValueChange?: (value: string) => void;\n  /** Saves the new text; return a promise to show progress, throw to keep editing with the message. */\n  onSave: (next: string) => void | Promise<unknown>;\n  /** What is being edited, for assistive tech: \"Report title\". */\n  label: string;\n  /** Say what is wrong with the text, or nothing to accept it. */\n  validate?: (next: string) => string | null | undefined;\n  /** Text shown before a value is entered or selected. Defaults to \"Empty\". */\n  placeholder?: string;\n  /** Wrap and allow line breaks (⌘/Ctrl+Enter saves). */\n  multiline?: boolean;\n  /** Title or body text treatment; defaults to body. */\n  textStyle?: \"title\" | \"body\";\n  /** Legacy textStyle setting; omitted by default. @deprecated Use textStyle instead. */\n  variant?: \"title\" | \"body\";\n  /** The element the text renders as. Default span (title: h2). */\n  as?: \"h1\" | \"h2\" | \"h3\" | \"p\" | \"span\";\n  /** Prevents interaction with the control. Defaults to false. */\n  disabled?: boolean;\n  /** Inline styles on the documented visual root; no inline overrides by default. */\n  style?: CSSProperties;\n  /** Receives the display text or editing root; no ref by default. */\n  ref?: Ref<HTMLElement>;\n  /** Receives the native field; no ref by default. */\n  fieldRef?: Ref<HTMLInputElement | HTMLTextAreaElement>;\n  /** Classes on the documented visual root; no override by default. */\n  className?: string;\n  /**\n   * text (default): a value in running text or a heading, with its pencil and the \"Enter saves\" hint. cell: a value in a\n   * table cell or a dense row: fills the cell, no pencil and no hint (the hover tint says it edits), and a problem floats\n   * under the cell instead of pushing the row open.\n   */\n  density?: \"text\" | \"cell\";\n  /** Where the text sits in its box: start (default) or end (numbers in a column). */\n  align?: \"start\" | \"end\";\n  /** The text shown for the committed value (a price written as money); the value itself by default. */\n  format?: (value: string) => string;\n  /** The text the field starts with when editing begins (a price without its currency sign); the value by default. */\n  toDraft?: (value: string) => string;\n  /** Turns the typed text, once validate accepts it, into the value saved (a canonical number); the text by default. */\n  parse?: (draft: string) => string;\n  /** The on-screen keyboard to offer (decimal or numeric for numbers); text by default. */\n  inputMode?: \"text\" | \"decimal\" | \"numeric\";\n}\n\n/**\n * Text that becomes a field in the same place, without moving: click it or press Enter to edit, Enter (or ⌘Enter\n * when multiline) saves, Escape cancels, leaving saves. Saving shows progress; a failure keeps the edit and says why.\n */\nexport function InlineEdit({\n  value: valueProp,\n  defaultValue = \"\",\n  onValueChange,\n  onSave,\n  label,\n  validate,\n  placeholder: placeholderProp,\n  multiline = false,\n  textStyle: textStyleProp,\n  variant: variantProp,\n  as,\n  disabled,\n  className,\n  classNames,\n  style,\n  ref,\n  fieldRef,\n  density = \"text\",\n  align = \"start\",\n  format,\n  toDraft,\n  parse,\n  inputMode,\n}: InlineEditProps) {\n  const i18n = useMessages(\"inline-edit\", englishMessages);\n  const placeholder = placeholderProp === undefined ? i18n(\"placeholder\") : placeholderProp;\n\n  const scopeDefaults = useComponentDefaults<InlineEditDefaults>(\"inline-edit\", [\"variant\"]);\n  useDeprecatedProp(\n    \"inline-edit\",\n    \"variant\",\n    \"textStyle\",\n    variantProp !== undefined || (textStyleProp === undefined && scopeDefaults.variant !== undefined),\n  );\n  const variant = textStyleProp ?? variantProp ?? scopeDefaults.variant ?? \"body\";\n\n  const [value, setValue] = useControllable(valueProp, defaultValue, onValueChange);\n  const [editing, setEditing] = useState(false);\n  const draftOf = (v: string) => (toDraft && v ? toDraft(v) : v);\n  const [draft, setDraft] = useState(() => draftOf(value));\n  const [state, setState] = useState<\"idle\" | \"saving\">(\"idle\");\n  const [problem, setProblem] = useState<string | null>(null);\n  // a save that worked leaves an afterglow on the text: a check where the pencil was and a tint that fades\n  const [saved, setSaved] = useState(0);\n  const field = useRef<HTMLTextAreaElement & HTMLInputElement>(null);\n  const display = useRef<HTMLElement>(null);\n  const attach = useComposedRef(display, ref);\n  const attachField = useComposedRef<HTMLInputElement | HTMLTextAreaElement>(field, fieldRef);\n  const problemId = useId();\n  // the text becomes the field in place: the frame grows from the text's width to the field's, and shrinks back to\n  // the text when the edit ends; the words themselves never move\n  const motion = useMotionTokens(display);\n  const swapFrom = useRef<{ w: number; h: number } | null>(null);\n  const switchTo = (next: boolean) => {\n    const el = display.current;\n    swapFrom.current = el ? { w: el.offsetWidth, h: el.offsetHeight } : null;\n    setEditing(next);\n  };\n  useLayoutEffect(() => {\n    const el = display.current,\n      from = swapFrom.current;\n    swapFrom.current = null;\n    if (!el || !from || motion.reduced) return;\n    const ease = motion.ease.standard;\n    const timing = {\n      duration: motion.duration.considered * 1000 * 0.6,\n      easing: cssEase(ease, undefined),\n    };\n    const w = el.offsetWidth,\n      h = el.offsetHeight;\n    if (Math.abs(w - from.w) > 1 || Math.abs(h - from.h) > 1)\n      el.animate(\n        [\n          { width: `${from.w}px`, height: `${from.h}px`, overflow: \"clip\" },\n          { width: `${w}px`, height: `${h}px`, overflow: \"clip\" },\n        ],\n        timing,\n      );\n    el.querySelector(\"[data-slot=inline-edit-hint]\")?.animate(\n      [\n        { opacity: 0, transform: \"translateY(-4px)\" },\n        { opacity: 1, transform: \"none\" },\n      ],\n      timing,\n    );\n  }, [editing]); // eslint-disable-line react-hooks/exhaustive-deps -- only a swap of modes morphs\n  const Tag = (as ?? (variant === \"title\" ? \"h2\" : \"span\")) as ElementType;\n  useEffect(() => {\n    if (!editing) setDraft(draftOf(value));\n  }, [value, editing]); // eslint-disable-line react-hooks/exhaustive-deps -- toDraft is read with the value it shapes\n  useLayoutEffect(() => {\n    if (editing) {\n      field.current?.focus();\n      field.current?.select();\n    }\n  }, [editing]);\n\n  const type = variant === \"title\" ? styles.title : styles.body;\n  const cell = density === \"cell\";\n  const shown = (value && format ? format(value) : value) || placeholder;\n  const cut = shown.search(/\\S+\\s*$/);\n  const lead = cut > 0 ? shown.slice(0, cut) : \"\";\n  const tail = cut > 0 ? shown.slice(cut) : shown;\n  // focus goes back to the value once it shows again, unless it has already moved on to another control (tabbing on,\n  // a click into the next field: focusing the value then would blur that field, which saves and closes it)\n  const focusBack = () =>\n    requestAnimationFrame(() => {\n      const now = document.activeElement;\n      if (now && now !== document.body && now.isConnected && !display.current?.contains(now)) return;\n      display.current?.focus();\n    });\n  const save = async () => {\n    if (state === \"saving\") return;\n    const typed = multiline ? draft : draft.trim();\n    if (typed === draftOf(value)) {\n      switchTo(false);\n      setProblem(null);\n      return;\n    }\n    const p = validate?.(typed);\n    if (p) {\n      setProblem(p);\n      field.current?.focus();\n      return;\n    }\n    const next = parse ? parse(typed) : typed;\n    if (next === value) {\n      switchTo(false);\n      setProblem(null);\n      return;\n    }\n    setState(\"saving\");\n    try {\n      await onSave(next);\n      setValue(next);\n      switchTo(false);\n      setProblem(null);\n      setSaved((n) => n + 1);\n      focusBack();\n    } catch (e) {\n      setProblem(e instanceof Error ? e.message : i18n(\"notSavedTryAgain\"));\n      field.current?.focus();\n    } finally {\n      setState(\"idle\");\n    }\n  };\n  const cancel = () => {\n    setDraft(draftOf(value));\n    setProblem(null);\n    switchTo(false);\n    focusBack();\n  };\n\n  if (!editing) {\n    return (\n      <Tag\n        ref={attach}\n        style={style}\n        data-slot=\"inline-edit\"\n        tabIndex={disabled ? undefined : 0}\n        role={disabled ? undefined : \"button\"}\n        aria-label={disabled ? undefined : i18n(\"edit\", { label: label, value: value || placeholder })}\n        onClick={() => !disabled && switchTo(true)}\n        onKeyDown={(e: KeyboardEvent) => {\n          if (!disabled && (e.key === \"Enter\" || e.key === \" \")) {\n            e.preventDefault();\n            switchTo(true);\n          }\n        }}\n        data-empty={value ? undefined : \"\"}\n        data-saved={saved ? \"\" : undefined}\n        data-density={cell ? \"cell\" : undefined}\n        data-align={align === \"end\" ? \"end\" : undefined}\n        onAnimationEnd={(e: AnimationEvent) => {\n          if (e.target === e.currentTarget) setSaved(0);\n        }}\n        dir=\"auto\"\n        className={cn(\n          \"reveal-host\",\n          styles.display,\n          type,\n          multiline ? \"block whitespace-pre-wrap\" : cell ? \"block\" : \"inline-block\",\n          classNames?.root,\n          className,\n        )}\n      >\n        {disabled ? (\n          shown\n        ) : (\n          <>\n            {lead}\n            {/* the last word and the pencil never part: a full last line moves both to the next line together */}\n            <span data-slot=\"inline-edit-tail\" className={cn(styles.tail, classNames?.tail)}>\n              {tail}\n              {saved ? (\n                <Check aria-hidden data-slot=\"inline-edit-saved\" className={cn(styles.pencil, styles.saved)} />\n              ) : cell ? null : (\n                <Pencil\n                  aria-hidden\n                  data-slot=\"inline-edit-pencil\"\n                  className={cn(\"reveal\", styles.pencil, classNames?.pencil)}\n                />\n              )}\n            </span>\n          </>\n        )}\n      </Tag>\n    );\n  }\n  const common = {\n    ref: attachField,\n    value: draft,\n    \"aria-label\": label,\n    \"aria-invalid\": problem ? true : undefined,\n    \"aria-errormessage\": problem ? problemId : undefined,\n    \"aria-busy\": state === \"saving\" ? true : undefined,\n    // saving keeps the field and its focus; it only stops typing until the result arrives\n    readOnly: state === \"saving\",\n    \"data-slot\": \"inline-edit-field\",\n    dir: \"auto\",\n    inputMode,\n    placeholder,\n    onChange: (e: ChangeEvent<HTMLInputElement & HTMLTextAreaElement>) => {\n      setDraft(e.target.value);\n      if (problem) setProblem(null);\n    },\n    onBlur: () => void save(),\n    onKeyDown: (e: KeyboardEvent) => {\n      if (e.key === \"Escape\") {\n        e.preventDefault();\n        cancel();\n      } else if (e.key === \"Enter\" && (!multiline || e.metaKey || e.ctrlKey)) {\n        e.preventDefault();\n        void save();\n      }\n    },\n    className: cn(styles.field, type, classNames?.field),\n  };\n  return (\n    <div\n      data-slot=\"inline-edit\"\n      ref={attach}\n      style={style}\n      data-editing=\"\"\n      data-multiline={multiline ? \"\" : undefined}\n      data-density={cell ? \"cell\" : undefined}\n      data-align={align === \"end\" ? \"end\" : undefined}\n      className={cn(styles.editor, classNames?.root, className)}\n    >\n      <div data-slot=\"inline-edit-box\" className={cn(styles.box, classNames?.box)}>\n        {multiline ? (\n          <textarea\n            /* organism-allow: raw-control -- the edit field itself, sized to the text it replaces */ {...common}\n            rows={1}\n          />\n        ) : (\n          <input\n            // organism-allow: raw-control -- the edit field itself, sized to the text it replaces\n            {...common}\n            size={Math.max(8, draft.length + 1)}\n          />\n        )}\n        {state === \"saving\" && (\n          <span data-slot=\"inline-edit-spinner\" className={cn(styles.spinner, classNames?.spinner)}>\n            <Spinner size=\"sm\" label={i18n(\"saving\")} />\n          </span>\n        )}\n      </div>\n      {problem ? (\n        <span\n          id={problemId}\n          role=\"alert\"\n          data-slot=\"inline-edit-problem\"\n          className={cn(styles.problem, classNames?.problem)}\n        >\n          <AlertCircle aria-hidden />\n          {problem}\n        </span>\n      ) : cell ? null : (\n        <span data-slot=\"inline-edit-hint\" className={cn(styles.hint, classNames?.hint)}>\n          {multiline ? i18n(\"enterSavesEscCancels\") : i18n(\"enterSavesEscCancels2\")}\n        </span>\n      )}\n    </div>\n  );\n}\n\nexport interface InlineNumberProps extends Omit<\n  InlineEditProps,\n  | \"value\"\n  | \"defaultValue\"\n  | \"onValueChange\"\n  | \"onSave\"\n  | \"validate\"\n  | \"multiline\"\n  | \"format\"\n  | \"toDraft\"\n  | \"parse\"\n  | \"inputMode\"\n> {\n  /** Controlled committed number; null is no value. Omitted by default to keep accepted edits locally. */\n  value?: number | null;\n  /** Initial number when uncontrolled; null (no value) by default. */\n  defaultValue?: number | null;\n  /** Reports the committed number after onSave succeeds. */\n  onValueChange?: (value: number | null) => void;\n  /** Saves the new number (null when cleared and `optional`); return a promise to show progress, throw to refuse. */\n  onSave: (next: number | null) => void | Promise<unknown>;\n  /** A further check on the number read (after the range and step checks); say what is wrong, or nothing. */\n  validate?: (next: number | null) => string | null | undefined;\n  /** How the number reads, as Intl options: { style: \"unit\", unit: \"kilogram\" }, fraction digits, sign display. */\n  formatOptions?: Intl.NumberFormatOptions;\n  /** Money in this ISO currency (\"EUR\"): shorthand for formatOptions { style: \"currency\", currency }. */\n  currency?: string;\n  /** The locale to read and write in; the page's locale by default. */\n  locale?: string;\n  /** The smallest accepted number; none by default. */\n  min?: number;\n  /** The largest accepted number; none by default. */\n  max?: number;\n  /** Accepted numbers are min (or 0) plus whole steps: 1 for counts, 0.01 for cents. None by default. */\n  step?: number;\n  /** Clearing the field saves null instead of being refused. Default false. */\n  optional?: boolean;\n}\n\n/**\n * A number or an amount of money that reads as formatted text and edits in place: typed in the reader's locale (\"1.234,5\"\n * in German, \"1,234.5\" in English, a pasted \"€1,234.50\" too), checked against min, max and step with the reason said,\n * and saved as a number. Tabular figures; `density=\"cell\"` fits it in a table cell with the figures at the end.\n */\nexport function InlineNumber({\n  value: valueProp,\n  defaultValue = null,\n  onValueChange,\n  onSave,\n  validate,\n  formatOptions,\n  currency,\n  locale: localeProp,\n  min,\n  max,\n  step,\n  optional = false,\n  density = \"text\",\n  align,\n  className,\n  ...rest\n}: InlineNumberProps) {\n  const i18n = useMessages(\"inline-edit\", englishMessages);\n  const locale = useLocale(localeProp);\n  const [value, setValue] = useControllable<number | null>(valueProp, defaultValue, onValueChange);\n  const show = useMemo(\n    () => numberFormatter(locale, currency ? { style: \"currency\", currency, ...formatOptions } : formatOptions),\n    [locale, currency, formatOptions],\n  );\n  // the field holds the bare number in the reader's locale, at least the fraction digits it is shown with (\"12.50\")\n  const typed = useMemo(() => {\n    const digits = show.resolvedOptions().minimumFractionDigits;\n    return numberFormatter(locale, {\n      useGrouping: false,\n      minimumFractionDigits: digits,\n      maximumFractionDigits: 20,\n    });\n  }, [show, locale]);\n  const plain = (n: number) => show.format(n);\n  const check = (text: string) => {\n    if (!text.trim()) return optional ? validate?.(null) : i18n(\"needed\");\n    const n = parseLocaleNumber(text, locale);\n    if (n === null) return i18n(\"notANumber\", { example: typed.format(1234.5) });\n    if (min !== undefined && n < min) return i18n(\"atLeast\", { min: plain(min) });\n    if (max !== undefined && n > max) return i18n(\"atMost\", { max: plain(max) });\n    if (step) {\n      const k = (n - (min ?? 0)) / step;\n      if (Math.abs(k - Math.round(k)) > 1e-9) return i18n(\"inSteps\", { step: plain(step) });\n    }\n    return validate?.(n);\n  };\n  const canonical = (n: number | null) => (n === null ? \"\" : String(n));\n  return (\n    <InlineEdit\n      {...rest}\n      density={density}\n      align={align ?? (density === \"cell\" ? \"end\" : \"start\")}\n      className={cn(styles.numeric, className)}\n      value={canonical(value)}\n      onValueChange={(v) => setValue(v === \"\" ? null : Number(v))}\n      format={(v) => show.format(Number(v))}\n      toDraft={(v) => typed.format(Number(v))}\n      parse={(t) => canonical(t.trim() ? parseLocaleNumber(t, locale) : null)}\n      validate={check}\n      inputMode={step !== undefined && Number.isInteger(step) && (min ?? 0) >= 0 ? \"numeric\" : \"decimal\"}\n      onSave={(v) => onSave(v === \"\" ? null : Number(v))}\n    />\n  );\n}\n\nexport default InlineEdit;\n"},{"path":"beamline/components/inline-edit/messages.ts","type":"registry:file","target":"src/ui/beamline/components/inline-edit/messages.ts","content":"import type { MessageDefinitions } from \"../../runtime/messages\";\n/** Built-in English copy; stable keys are the public translation API. */\nexport const english = {\n  placeholder: \"Empty\",\n  edit: \"{label}: {value}. Edit\",\n  saving: \"Saving\",\n  enterSavesEscCancels: \"⌘Enter saves · Esc cancels\",\n  enterSavesEscCancels2: \"Enter saves · Esc cancels\",\n  notSavedTryAgain: \"Not saved. Try again.\",\n  notANumber: \"Enter a number, like {example}.\",\n  needed: \"Enter a value.\",\n  atLeast: \"At least {min}.\",\n  atMost: \"At most {max}.\",\n  inSteps: \"In steps of {step}.\",\n} satisfies MessageDefinitions;\n"},{"path":"beamline/components/label/label.tsx","type":"registry:file","target":"src/ui/beamline/components/label/label.tsx","content":"\"use client\";\n\nimport { useMessages } from \"../../runtime/localization\";\nimport { english as englishMessages } from \"./messages\";\nimport type { ComponentProps } from \"react\";\nimport * as RadixLabel from \"@radix-ui/react-label\";\nimport { cn } from \"../../lib/utils\";\n\nexport interface LabelProps extends ComponentProps<typeof RadixLabel.Root> {\n  /** Shows the marker and announces \"required\". */\n  required?: boolean;\n  /** The control says \"required\" itself (a native required input, a radiogroup with aria-required): the label shows\n   * the marker only, so the control's name stays the label's words and the state is announced once. */\n  requiredOnControl?: boolean;\n}\n\n/** The text label tied to a form control. It dims with a disabled control next to it (peer) or inside it (group). */\nexport function Label({ required = false, requiredOnControl = false, className, children, ...props }: LabelProps) {\n  const i18n = useMessages(\"label\", englishMessages);\n\n  return (\n    <RadixLabel.Root\n      data-slot=\"label\"\n      {...props}\n      className={cn(\n        \"inline-flex items-center gap-[var(--pui-space-1)] text-sm leading-tight font-medium text-ink select-none group-data-[disabled]:opacity-[var(--pui-opacity-disabled)] peer-disabled:opacity-[var(--pui-opacity-disabled)]\",\n        className,\n      )}\n    >\n      {children}\n      {required && (\n        <>\n          <span aria-hidden className=\"text-red\">\n            *\n          </span>\n          {!requiredOnControl && <span className=\"sr-only\">{i18n(\"required\")}</span>}\n        </>\n      )}\n    </RadixLabel.Root>\n  );\n}\n\nexport default Label;\n"},{"path":"beamline/components/label/messages.ts","type":"registry:file","target":"src/ui/beamline/components/label/messages.ts","content":"import type { MessageDefinitions } from \"../../runtime/messages\";\n/** Built-in English copy; stable keys are the public translation API. */\nexport const english = {\n  required: \"required\",\n} satisfies MessageDefinitions;\n"},{"path":"beamline/components/mention-input/mention-input.module.css","type":"registry:file","target":"src/ui/beamline/components/mention-input/mention-input.module.css","content":"@layer properties, theme, base, components, utilities;\n@layer components {\n  /* The composer wears the look's field role; invalid and disabled are drawn the way every field draws them. */\n  .root {\n    position: relative;\n    display: grid;\n    border-radius: var(--pui-field-radius, var(--pui-radius-control));\n  }\n  .root[data-disabled] {\n    opacity: var(--pui-opacity-disabled);\n  }\n  /* a mention is a tint under its own words (people take the accent, channels green); a new one buds: its tint arrives\n     over --pui-motion-in, then holds still */\n  .mention {\n    border-radius: calc(var(--pui-radius-chip) - 2px);\n    background: var(--pui-accent-tint);\n    color: transparent;\n    animation: bud var(--pui-motion-in) var(--pui-ease-default);\n  }\n  .mention[data-kind=\"channel\"] {\n    background: var(--pui-green-tint);\n  }\n  @keyframes bud {\n    from {\n      background-color: transparent;\n    }\n  }\n  /* the list stays inside a narrow composer */\n  .suggestions {\n    position: absolute;\n    z-index: var(--pui-z-popover);\n    width: min(16rem, 100%);\n  }\n}\n/* CSS-module composition only; visual rules stay in the component layer. */\n.root {\n  composes: m-field from global;\n}\n"},{"path":"beamline/components/mention-input/mention-input.tsx","type":"registry:file","target":"src/ui/beamline/components/mention-input/mention-input.tsx","content":"\"use client\";\n\nimport { useMessages } from \"../../runtime/localization\";\nimport { english as englishMessages } from \"./messages\";\nimport { useDeprecatedProp } from \"../../hooks/use-deprecated-prop\";\n\nimport {\n  useId,\n  useLayoutEffect,\n  useMemo,\n  useRef,\n  useState,\n  type ChangeEvent,\n  type KeyboardEvent,\n  type CSSProperties,\n  type ReactNode,\n  type Ref,\n} from \"react\";\nimport { Hash } from \"lucide-react\";\nimport { Avatar } from \"../avatar/avatar\";\nimport { Field, useFieldIds } from \"../_shared/field\";\nimport { GlidePlate } from \"../_shared/glide\";\nimport { Highlight, filterRanked } from \"../_shared/match\";\nimport { useComposedRef } from \"../../hooks/use-composed-ref\";\nimport { cn } from \"../../lib/utils\";\nimport { useControllable } from \"../../hooks/use-controllable\";\nimport overlay from \"../_shared/overlay.module.css\";\nimport styles from \"./mention-input.module.css\";\n\nexport interface MentionPerson {\n  /** Stable identifier used to match this record across updates. Required. */\n  id: string;\n  /** Human-readable name of this record. Required. */\n  name: string;\n  /** Role assigned to this person. Omitted by default. */\n  role?: string;\n  /** URL of the person avatar. Omitted by default. */\n  avatarSrc?: string;\n}\nexport interface MentionChannel {\n  /** Stable identifier used to match this record across updates. Required. */\n  id: string;\n  /** Human-readable name of this record. Required. */\n  name: string;\n  /** Supporting content describing this item. Omitted by default. */\n  description?: string;\n}\nexport interface Mention {\n  /** Kind of record, determining how it is rendered. Required. */\n  kind: \"person\" | \"channel\";\n  /** Stable identifier used to match this record across updates. Required. */\n  id: string;\n  /** Text displayed for this item. Required. */\n  label: string;\n  /** Inclusive UTF-16 offset of the mention in the text. Required. */\n  start: number;\n  /** Exclusive UTF-16 offset of the mention in the text. Required. */\n  end: number;\n}\n/** The text and where each mention sits in it (start inclusive, end exclusive). */\nexport interface MentionValue {\n  /** Text content of this record. Required. */\n  text: string;\n  /** Mention tokens with their text offsets. Required. */\n  mentions: Mention[];\n}\n\nexport type MentionInputClassNames = Partial<\n  Record<\n    | \"root\"\n    | \"backdrop\"\n    | \"mention\"\n    | \"field\"\n    | \"mirror\"\n    | \"suggestions\"\n    | \"option\"\n    | \"optionBody\"\n    | \"optionName\"\n    | \"optionDescription\"\n    | \"fieldRoot\"\n    | \"label\"\n    | \"description\"\n    | \"error\",\n    string\n  >\n>;\n\nexport interface MentionInputProps {\n  /** Classes for the named visual parts; no part overrides by default. */\n  classNames?: MentionInputClassNames;\n  /** Inline styles on the documented visual root; no inline overrides by default. */\n  style?: CSSProperties;\n  /** Receives the native textarea; no ref by default. */\n  ref?: Ref<HTMLTextAreaElement>;\n  /** Receives the outer visual root; no ref by default. */\n  rootRef?: Ref<HTMLDivElement>;\n  /** Controlled text together with its mention tokens and offsets; omit to use defaultValue. */\n  value?: MentionValue;\n  /** Initial text together with its mention tokens and offsets when uncontrolled. Defaults to empty text with no mentions. */\n  defaultValue?: MentionValue;\n  /** Legacy value-change callback; omitted by default. Prefer onValueChange.\n   *  @deprecated Use onValueChange; this value callback remains supported and is omitted by default. */\n  onChange?: (value: MentionValue) => void;\n  /** Reports edited text and mention offsets; no callback by default. */\n  onValueChange?: (value: MentionValue) => void;\n  /** People offered by mention suggestions. Defaults to an empty list. */\n  people?: MentionPerson[];\n  /** Channels offered by mention suggestions. Defaults to an empty list. */\n  channels?: MentionChannel[];\n  /** Receives a mention token after it is inserted; no handler by default. */\n  onMentionAdd?: (mention: Mention) => void;\n  /** Submits the current value; no handler by default. */\n  onSubmit?: (value: MentionValue) => void;\n  /** Enter sends (Shift+Enter adds a line). Default false: ⌘/Ctrl+Enter sends. */\n  submitOnEnter?: boolean;\n  /** Text shown before a value is entered or selected. Defaults to no placeholder. */\n  placeholder?: string;\n  /** Minimum visible text rows. Defaults to 2. */\n  minRows?: number;\n  /** Maximum visible text rows before scrolling. Defaults to 8. */\n  maxRows?: number;\n  /** Suggestions above or below the caret; auto picks the side with room. */\n  placement?: \"auto\" | \"top\" | \"bottom\";\n  /** Maximum mention suggestions shown at once. Defaults to 6. */\n  maxSuggestions?: number;\n  /** Prevents interaction with the control. Defaults to false. */\n  disabled?: boolean;\n  /** Field name used in native form submission. Defaults to no form field name. */\n  name?: string;\n  /** DOM id used to connect the control and its label. Defaults to an automatically generated control id. */\n  id?: string;\n  /** Accessible name read by assistive technology. Defaults to the visible label when available. */\n  \"aria-label\"?: string;\n  /** Ids of elements that describe this control. Defaults to the field help and error ids when present. */\n  \"aria-describedby\"?: string;\n  /** A visible label above the composer, like every field's (the accessible name too). Without it, pass aria-label. */\n  label?: ReactNode;\n  /** Shows the label visually while keeping its accessible name; defaults to true. Takes precedence over hideLabel. */\n  showLabel?: boolean;\n  /** Hides the label; defaults to false. @deprecated Use showLabel={false} instead. */\n  hideLabel?: boolean;\n  /** One line of help under the composer. */\n  description?: ReactNode;\n  /** The problem and its fix; marks the composer invalid. */\n  error?: ReactNode;\n  /** Lands on the composer's frame (its documented root); classNames.fieldRoot addresses the field around it. */\n  className?: string;\n}\n\ntype Suggestion = { kind: \"person\"; item: MentionPerson } | { kind: \"channel\"; item: MentionChannel };\nconst TRIGGER = /(^|\\s)([@#])([^\\s@#]{0,30})$/;\n/** The suggestions' width at most (16rem at the default type size), so the list can be kept inside the composer. */\nconst SUGGESTIONS_WIDTH = 256;\n/** Rows of the composer as a height: its own line height (1lh follows the type size) and its block padding. */\nconst rowsHeight = (rows: number) => `calc(${rows} * 1lh + 2 * var(--pui-size-2, 0.5rem))`;\n\n/** Shifts mentions after an edit and drops the ones the edit went through. */\nfunction reconcile(prev: MentionValue, text: string): Mention[] {\n  const a = prev.text;\n  let p = 0;\n  while (p < a.length && p < text.length && a[p] === text[p]) p++;\n  let s = 0;\n  while (s < a.length - p && s < text.length - p && a[a.length - 1 - s] === text[text.length - 1 - s]) s++;\n  const delta = text.length - a.length;\n  return prev.mentions.flatMap((m) =>\n    m.end <= p ? [m] : m.start >= a.length - s ? [{ ...m, start: m.start + delta, end: m.end + delta }] : [],\n  );\n}\n\n/**\n * A composer where @people and #channels become single tokens. Type @ or # for suggestions at the caret (↑ ↓, Enter\n * or Tab to pick, Escape to close); Backspace right after a mention removes it whole. The value keeps the text and\n * where each mention sits, ready for your API.\n */\nexport function MentionInput({\n  value: valueProp,\n  defaultValue = { text: \"\", mentions: [] },\n  onChange,\n  onValueChange,\n  people = [],\n  channels = [],\n  onMentionAdd,\n  onSubmit,\n  submitOnEnter = false,\n  placeholder,\n  minRows = 2,\n  maxRows = 8,\n  placement = \"auto\",\n  maxSuggestions = 6,\n  disabled,\n  name,\n  id,\n  \"aria-label\": ariaLabel,\n  \"aria-describedby\": describedBy,\n  label,\n  hideLabel: hideLabelProp,\n  showLabel,\n  description,\n  error,\n  className,\n  classNames,\n  style,\n  ref,\n  rootRef,\n}: MentionInputProps) {\n  const i18n = useMessages(\"mention-input\", englishMessages);\n\n  useDeprecatedProp(\"MentionInput\", \"hideLabel\", \"showLabel={false}\", hideLabelProp !== undefined);\n  const hideLabel = showLabel === undefined ? hideLabelProp : !showLabel;\n  useDeprecatedProp(\"MentionInput\", \"onChange\", \"onValueChange\", onChange !== undefined);\n  const [value, setValue] = useControllable(valueProp, defaultValue, onValueChange);\n  const set = (v: MentionValue) => {\n    setValue(v);\n    onChange?.(v);\n  };\n  const area = useRef<HTMLTextAreaElement>(null);\n  const fieldRef = useComposedRef(area, ref);\n  const mirror = useRef<HTMLDivElement>(null);\n  const backdrop = useRef<HTMLDivElement>(null);\n  const [query, setQuery] = useState<{ char: \"@\" | \"#\"; text: string; at: number } | null>(null);\n  const [active, setActive] = useState(0);\n  const [caret, setCaret] = useState({ x: 0, y: 0, line: 0, below: true });\n  const listId = useId();\n  const list = useRef<HTMLDivElement>(null);\n  const { controlId, descriptionId, errorId, aria } = useFieldIds(id, { description, error });\n  const asField = label != null;\n\n  const suggestions: Suggestion[] = useMemo(() => {\n    if (!query) return [];\n    const list: Suggestion[] =\n      query.char === \"@\"\n        ? filterRanked(people, query.text, (p) => ({ label: p.name, keywords: p.role ? [p.role] : [] })).map(\n            (item) => ({ kind: \"person\" as const, item }),\n          )\n        : filterRanked(channels, query.text, (c) => ({ label: c.name, description: c.description })).map((item) => ({\n            kind: \"channel\" as const,\n            item,\n          }));\n    return list.slice(0, maxSuggestions);\n  }, [query, people, channels, maxSuggestions]);\n  const open = !!query && suggestions.length > 0;\n\n  // where the caret is, from a mirror of the textarea's text up to it\n  const locate = () => {\n    const el = area.current,\n      m = mirror.current;\n    if (!el || !m) return;\n    const before = el.value.slice(0, el.selectionStart);\n    const hit = before.match(TRIGGER);\n    setQuery(hit ? { char: hit[2] as \"@\" | \"#\", text: hit[3], at: before.length - hit[3].length - 1 } : null);\n    if (!hit) return;\n    m.textContent = before;\n    const mark = document.createElement(\"span\");\n    mark.textContent = \"​\";\n    m.appendChild(mark);\n    const x = mark.offsetLeft,\n      y = mark.offsetTop - el.scrollTop;\n    const room = window.innerHeight - el.getBoundingClientRect().top - y;\n    setCaret({\n      x,\n      y,\n      line: parseFloat(getComputedStyle(el).lineHeight) || mark.offsetHeight,\n      below: placement === \"bottom\" || (placement === \"auto\" && room > 240),\n    });\n    setActive(0);\n  };\n  useLayoutEffect(() => {\n    if (backdrop.current && area.current) backdrop.current.scrollTop = area.current.scrollTop;\n  });\n\n  const pick = (s: Suggestion) => {\n    if (!query) return;\n    const label = `${query.char}${s.item.name}`;\n    const end = query.at + 1 + query.text.length;\n    const text = value.text.slice(0, query.at) + label + \" \" + value.text.slice(end);\n    const delta = label.length + 1 - (end - query.at);\n    const mention: Mention = { kind: s.kind, id: s.item.id, label, start: query.at, end: query.at + label.length };\n    const kept = value.mentions.map((m) => (m.start >= end ? { ...m, start: m.start + delta, end: m.end + delta } : m));\n    set({ text, mentions: [...kept, mention].sort((a, b) => a.start - b.start) });\n    onMentionAdd?.(mention);\n    setQuery(null);\n    requestAnimationFrame(() => {\n      const el = area.current;\n      if (el) {\n        const pos = query.at + label.length + 1;\n        el.focus();\n        el.setSelectionRange(pos, pos);\n      }\n    });\n  };\n  const onKey = (e: KeyboardEvent<HTMLTextAreaElement>) => {\n    if (open) {\n      if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n        e.preventDefault();\n        setActive((i) => (i + (e.key === \"ArrowDown\" ? 1 : -1) + suggestions.length) % suggestions.length);\n        return;\n      }\n      if (e.key === \"Enter\" || e.key === \"Tab\") {\n        e.preventDefault();\n        pick(suggestions[active]);\n        return;\n      }\n      if (e.key === \"Escape\") {\n        e.preventDefault();\n        e.stopPropagation();\n        setQuery(null);\n        return;\n      }\n    }\n    const el = e.currentTarget;\n    if (e.key === \"Backspace\" && el.selectionStart === el.selectionEnd) {\n      const m = value.mentions.find((x) => x.end === el.selectionStart);\n      if (m) {\n        e.preventDefault();\n        set({\n          text: value.text.slice(0, m.start) + value.text.slice(m.end),\n          mentions: reconcile(value, value.text.slice(0, m.start) + value.text.slice(m.end)),\n        });\n        requestAnimationFrame(() => el.setSelectionRange(m.start, m.start));\n        return;\n      }\n    }\n    if (\n      e.key === \"Enter\" &&\n      onSubmit &&\n      ((submitOnEnter && !e.shiftKey) || (!submitOnEnter && (e.metaKey || e.ctrlKey)))\n    ) {\n      e.preventDefault();\n      if (value.text.trim()) onSubmit(value);\n    }\n  };\n  const onText = (e: ChangeEvent<HTMLTextAreaElement>) => {\n    set({ text: e.target.value, mentions: reconcile(value, e.target.value) });\n    requestAnimationFrame(locate);\n  };\n\n  // the backdrop draws a chip under each mention; the textarea's own text sits on top\n  // each mention keeps its identity while the text around it changes (kind, id and which occurrence), so only a new one\n  // buds in (its tint arrives) and the others hold still\n  const parts: { text: string; mention?: Mention; key: string }[] = [];\n  const seen = new Map<string, number>();\n  let i = 0;\n  for (const m of value.mentions) {\n    if (m.start > i) parts.push({ text: value.text.slice(i, m.start), key: `t${parts.length}` });\n    const who = `${m.kind}:${m.id}`;\n    seen.set(who, (seen.get(who) ?? 0) + 1);\n    parts.push({ text: value.text.slice(m.start, m.end), mention: m, key: `m:${who}:${seen.get(who)}` });\n    i = m.end;\n  }\n  parts.push({ text: value.text.slice(i) + \"\\n\", key: \"tail\" });\n  const box =\n    \"col-start-1 row-start-1 whitespace-pre-wrap break-words px-3 py-[var(--pui-size-2,0.5rem)] text-base leading-[var(--pui-leading-reading)]\";\n  const composer = (\n    <div\n      ref={rootRef}\n      style={style}\n      data-slot=\"mention-input\"\n      data-disabled={disabled ? \"\" : undefined}\n      data-invalid={error ? \"\" : undefined}\n      className={cn(styles.root, classNames?.root, className)}\n    >\n      <div\n        data-slot=\"mention-input-backdrop\"\n        ref={backdrop}\n        aria-hidden\n        className={cn(box, \"overflow-hidden text-transparent\", classNames?.backdrop)}\n        style={{ maxHeight: rowsHeight(maxRows) }}\n      >\n        {parts.map((p) =>\n          p.mention ? (\n            <mark\n              data-slot=\"mention-input-mention\"\n              data-kind={p.mention.kind}\n              key={p.key}\n              className={cn(styles.mention, classNames?.mention)}\n            >\n              {p.text}\n            </mark>\n          ) : (\n            <span key={p.key}>{p.text}</span>\n          ),\n        )}\n      </div>\n      <textarea // organism-allow: raw-control -- the composer field itself (it is the component)\n        data-slot=\"mention-input-field\"\n        ref={fieldRef}\n        id={asField ? controlId : id}\n        name={name}\n        value={value.text}\n        disabled={disabled}\n        placeholder={placeholder}\n        aria-label={asField ? undefined : ariaLabel}\n        aria-describedby={\n          [describedBy, asField ? aria[\"aria-describedby\"] : undefined].filter(Boolean).join(\" \") || undefined\n        }\n        aria-invalid={error ? true : undefined}\n        aria-errormessage={asField ? errorId : undefined}\n        role=\"combobox\"\n        aria-expanded={open}\n        aria-controls={listId}\n        aria-autocomplete=\"list\"\n        aria-activedescendant={open ? `${listId}-${active}` : undefined}\n        onChange={onText}\n        onKeyDown={onKey}\n        onClick={locate}\n        onKeyUp={(e) => {\n          if (e.key.startsWith(\"Arrow\") && !open) locate();\n        }}\n        onBlur={() => setQuery(null)}\n        onScroll={(e) => {\n          if (backdrop.current) backdrop.current.scrollTop = e.currentTarget.scrollTop;\n        }}\n        className={cn(\n          box,\n          \"relative [field-sizing:content] resize-none overflow-y-auto bg-transparent text-ink caret-ink outline-none placeholder:text-ink-3\",\n          classNames?.field,\n        )}\n        style={{ minHeight: rowsHeight(minRows), maxHeight: rowsHeight(maxRows) }}\n      />\n      <div\n        data-slot=\"mention-input-mirror\"\n        ref={mirror}\n        aria-hidden\n        className={cn(box, \"pointer-events-none invisible absolute inset-x-0 top-0\", classNames?.mirror)}\n      />\n      {open && (\n        <div\n          data-slot=\"mention-input-suggestions\"\n          id={listId}\n          role=\"listbox\"\n          aria-label={query?.char === \"@\" ? i18n(\"people\") : i18n(\"channels\")}\n          ref={list}\n          // it opens out of the caret (the shared source morph, from a point) and stays inside a narrow composer\n          data-state=\"open\"\n          data-side={caret.below ? \"bottom\" : \"top\"}\n          data-align=\"start\"\n          className={cn(overlay.surface, overlay.menu, styles.suggestions, classNames?.suggestions)}\n          style={{\n            left: Math.max(0, Math.min(caret.x, (area.current?.clientWidth ?? 300) - SUGGESTIONS_WIDTH)),\n            ...(caret.below\n              ? { top: caret.y + caret.line + 8 }\n              : { bottom: (area.current?.clientHeight ?? 0) - caret.y + 8 }),\n          }}\n        >\n          <GlidePlate list={list} selector={`#${CSS.escape(`${listId}-${active}`)}`} reset={query?.char} />\n          {suggestions.map((s, k) => (\n            <div\n              key={s.item.id}\n              id={`${listId}-${k}`}\n              role=\"option\"\n              aria-selected={k === active}\n              onMouseDown={(e) => {\n                e.preventDefault();\n                pick(s);\n              }}\n              onPointerMove={() => setActive(k)}\n              data-slot=\"mention-input-option\"\n              data-active={k === active ? \"\" : undefined}\n              className={cn(overlay.item, \"cursor-pointer py-1.5\", classNames?.option)}\n            >\n              {s.kind === \"person\" ? <Avatar name={s.item.name} src={s.item.avatarSrc} size=\"xs\" /> : <Hash />}\n              <span\n                data-slot=\"mention-input-optionBody\"\n                className={cn(\"grid min-w-0 gap-px leading-snug\", classNames?.optionBody)}\n              >\n                <span data-slot=\"mention-input-optionName\" className={cn(\"truncate\", classNames?.optionName)}>\n                  <Highlight text={s.item.name} query={query?.text ?? \"\"} />\n                </span>\n                {(s.kind === \"person\" ? s.item.role : s.item.description) && (\n                  <span\n                    data-slot=\"mention-input-optionDescription\"\n                    className={cn(\"truncate text-xs text-ink-3\", classNames?.optionDescription)}\n                  >\n                    {s.kind === \"person\" ? s.item.role : s.item.description}\n                  </span>\n                )}\n              </span>\n            </div>\n          ))}\n        </div>\n      )}\n    </div>\n  );\n  if (!asField) return composer;\n  return (\n    <Field\n      label={label}\n      hideLabel={hideLabel}\n      description={description}\n      error={error}\n      controlId={controlId}\n      descriptionId={descriptionId}\n      errorId={errorId}\n      classNames={{\n        root: classNames?.fieldRoot,\n        label: classNames?.label,\n        description: classNames?.description,\n        error: classNames?.error,\n      }}\n    >\n      {composer}\n    </Field>\n  );\n}\n\nexport default MentionInput;\n"},{"path":"beamline/components/mention-input/messages.ts","type":"registry:file","target":"src/ui/beamline/components/mention-input/messages.ts","content":"import type { MessageDefinitions } from \"../../runtime/messages\";\n/** Built-in English copy; stable keys are the public translation API. */\nexport const english = {\n  people: \"People\",\n  channels: \"Channels\",\n} satisfies MessageDefinitions;\n"},{"path":"beamline/components/popover/popover.tsx","type":"registry:file","target":"src/ui/beamline/components/popover/popover.tsx","content":"\"use client\";\n\nimport {\n  createContext,\n  useContext,\n  useId,\n  useLayoutEffect,\n  useMemo,\n  useRef,\n  useState,\n  type ComponentProps,\n} from \"react\";\nimport * as RadixPopover from \"@radix-ui/react-popover\";\nimport { BottomSheet } from \"../bottom-sheet/bottom-sheet\";\nimport { usePhone } from \"../../hooks/use-media-query\";\nimport { useComposedRef } from \"../../hooks/use-composed-ref\";\nimport { usePortalContainer } from \"../../runtime/appearance\";\nimport { cn } from \"../../lib/utils\";\nimport { useControllable } from \"../../hooks/use-controllable\";\nimport overlay from \"../_shared/overlay.module.css\";\n\n/** The open state, for a content that leaves the popper on a phone and opens as a bottom sheet instead. */\nconst OpenState = createContext<{\n  open: boolean;\n  setOpen: (open: boolean) => void;\n  trigger: HTMLButtonElement | null;\n  setTrigger: (trigger: HTMLButtonElement | null) => void;\n} | null>(null);\n\n/** A small anchored layer for a short form or details. open / defaultOpen / onOpenChange. */\nexport function Popover({\n  open: openProp,\n  defaultOpen = false,\n  onOpenChange,\n  ...props\n}: ComponentProps<typeof RadixPopover.Root>) {\n  const [open, setOpen] = useControllable(openProp, defaultOpen, onOpenChange);\n  const [trigger, setTrigger] = useState<HTMLButtonElement | null>(null);\n  const state = useMemo(() => ({ open, setOpen, trigger, setTrigger }), [open, setOpen, trigger]);\n  return (\n    <OpenState.Provider value={state}>\n      <RadixPopover.Root open={open} onOpenChange={setOpen} {...props} />\n    </OpenState.Provider>\n  );\n}\n/** The control that opens it; use asChild around a Button. */\nexport function PopoverTrigger({ id, ref, ...props }: ComponentProps<typeof RadixPopover.Trigger>) {\n  const generatedId = useId();\n  const node = useRef<HTMLButtonElement | null>(null);\n  const attach = useComposedRef(node, ref);\n  const setTrigger = useContext(OpenState)?.setTrigger;\n  useLayoutEffect(() => {\n    // Read the actual element: asChild can supply its own id.\n    setTrigger?.(node.current);\n    return () => setTrigger?.(null);\n  }, [setTrigger, id]);\n  return <RadixPopover.Trigger id={id ?? generatedId} ref={attach} {...props} />;\n}\n/** Position against something other than the trigger. */\nexport const PopoverAnchor = RadixPopover.Anchor;\nexport const PopoverClose = RadixPopover.Close;\n\nexport interface PopoverContentProps extends ComponentProps<typeof RadixPopover.Content> {\n  /** Remove the inner padding (for lists and pickers that bring their own). */\n  flush?: boolean;\n  /** On a phone, open as a bottom sheet with this title (and line) instead of a layer beside the trigger: for a form\n   *  or a long list, which a finger and an on-screen keyboard need room for. PopoverClose still closes it. Give the\n   *  content a width that can grow (w-full with a minimum) rather than a fixed one, so it fills the sheet. */\n  sheet?: { title: string; description?: string };\n}\n\n/** The layer: grows from the trigger, closes on Escape or a click outside, returns focus to the trigger. It is never\n *  wider or taller than the room beside its trigger; with `sheet`, a phone gets a bottom sheet instead. */\nexport function PopoverContent({\n  flush = false,\n  sideOffset = 6,\n  align = \"center\",\n  collisionPadding = 8,\n  sheet,\n  className,\n  children,\n  \"aria-label\": ariaLabel,\n  \"aria-labelledby\": ariaLabelledBy,\n  ...props\n}: PopoverContentProps) {\n  const container = usePortalContainer();\n  const phone = usePhone();\n  const state = useContext(OpenState);\n  if (container === null) return null;\n  if (sheet && phone && state)\n    return (\n      <BottomSheet\n        open={state.open}\n        onOpenChange={state.setOpen}\n        title={sheet.title}\n        description={sheet.description}\n        className={className}\n      >\n        <div data-slot=\"popover\" className={cn(!flush && \"p-[var(--pui-pad-panel)]\")}>\n          {children}\n        </div>\n      </BottomSheet>\n    );\n  return (\n    <RadixPopover.Portal container={container}>\n      <RadixPopover.Content\n        data-slot=\"popover\"\n        aria-label={ariaLabel ?? (ariaLabelledBy ? undefined : sheet?.title)}\n        aria-labelledby={ariaLabelledBy ?? (ariaLabel || sheet?.title ? undefined : state?.trigger?.id)}\n        sideOffset={sideOffset}\n        align={align}\n        collisionPadding={collisionPadding}\n        className={cn(overlay.surface, !flush && overlay.padded, className)}\n        {...props}\n      >\n        {children}\n      </RadixPopover.Content>\n    </RadixPopover.Portal>\n  );\n}\n\nexport default Popover;\n"},{"path":"beamline/components/slot-text/defaults.ts","type":"registry:file","target":"src/ui/beamline/components/slot-text/defaults.ts","content":"/** Pure allowed presentation defaults for SlotText; no component or runtime imports. */\nexport interface SlotTextDefaults {\n  /** Shared align setting; omit to inherit the surrounding scope or the component default. */\n  align?: \"start\" | \"end\";\n}\n"},{"path":"beamline/components/slot-text/slot-text.module.css","type":"registry:file","target":"src/ui/beamline/components/slot-text/slot-text.module.css","content":"@layer properties, theme, base, components, utilities;\n@layer components {\n  /* A reel stands on the run of digits it is rolling to; once it lands it is quietly reset to the same digit on its\n     middle run (no motion), so the next roll can turn either way without running out of reel. A roll is an animation\n     from the numeral it showed to the one it lands on, in whole numerals (the staircase timing in slot-text.tsx), so it\n     always starts from a whole digit, even when a new value arrives mid-roll; the two names take turns so each change\n     starts afresh. */\n  .reel {\n    position: absolute;\n    inset-inline: 0;\n    top: 0;\n    display: flex;\n    flex-direction: column;\n    animation-fill-mode: both;\n  }\n  .rollA {\n    animation-name: slot-text-roll-a;\n  }\n  .rollB {\n    animation-name: slot-text-roll-b;\n  }\n  /* the inline transform names the target; a landed reel is reset over it */\n  .reel[data-settled] {\n    transform: translateY(calc(var(--_rest) * -1lh)) !important;\n    animation: none !important;\n  }\n\n  /* a new place or a changed sign waits, unseen, for its turn in the ripple (its delay is the animation's length), then\n     is there whole: never half faded over its neighbour */\n  .arrive {\n    animation-name: slot-text-wait;\n    animation-timing-function: step-end;\n  }\n  @keyframes slot-text-roll-a {\n    from {\n      transform: translateY(calc(var(--_from) * -1lh));\n    }\n    to {\n      transform: translateY(calc(var(--_to) * -1lh));\n    }\n  }\n  @keyframes slot-text-roll-b {\n    from {\n      transform: translateY(calc(var(--_from) * -1lh));\n    }\n    to {\n      transform: translateY(calc(var(--_to) * -1lh));\n    }\n  }\n  @keyframes slot-text-wait {\n    from,\n    to {\n      visibility: hidden;\n    }\n  }\n}\n"},{"path":"beamline/components/slot-text/slot-text.tsx","type":"registry:file","target":"src/ui/beamline/components/slot-text/slot-text.tsx","content":"\"use client\";\n\nimport { type AnimationEvent, type Ref } from \"react\";\nimport { useComposedRef } from \"../../hooks/use-composed-ref\";\nimport { useMotionTokens } from \"../../hooks/use-motion-tokens\";\nimport { useReducedMotionSafe } from \"../../hooks/use-reduced-motion-safe\";\n\nimport { useLocale, numberFormatter } from \"../../runtime/localization\";\nimport { useComponentDefaults } from \"../../runtime/appearance\";\nimport type { SlotTextDefaults } from \"./defaults\";\nexport type { SlotTextDefaults } from \"./defaults\";\n\nimport { useEffect, useLayoutEffect, useRef, useState, type CSSProperties } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport styles from \"./slot-text.module.css\";\n\nexport interface SlotTextClassNames {\n  /** Classes for the root part; no override by default. */\n  root?: string;\n  /** Classes for the spoken part; no override by default. */\n  spoken?: string;\n  /** Classes for the visual part; no override by default. */\n  visual?: string;\n  /** Classes for the digit part; no override by default. */\n  digit?: string;\n  /** Classes for the measure part; no override by default. */\n  measure?: string;\n  /** Classes for the reel part; no override by default. */\n  reel?: string;\n  /** Classes for the numeral part; no override by default. */\n  numeral?: string;\n  /** Classes for the character part; no override by default. */\n  character?: string;\n}\n\nexport interface SlotTextProps {\n  /** Text or number shown on the animated reels. Required. */\n  value: string | number;\n  /** Turns a number into its text: currency, thousands. */\n  format?: (value: number) => string;\n  /** ms per reel. Default: twice the considered duration (about 0.7 s), following the motion scale. */\n  duration?: number;\n  /** ms between reels, right to left. Default: the word stagger (about 30 ms), following the motion scale. */\n  stagger?: number;\n  /** Extra full turns a changing digit makes. Default 0. */\n  spins?: number;\n  /** Which side stays put when the length changes. Default end (numbers). */\n  align?: \"start\" | \"end\";\n  /** Read the new value aloud when it changes. Default false (most counters are glanceable). */\n  announce?: boolean;\n  /** Content direction. Numbers stay LTR; other text resolves its own direction instead of inheriting page layout. */\n  dir?: \"ltr\" | \"rtl\" | \"auto\";\n  /** Classes on the documented visual root; no override by default. */\n  className?: string;\n  /** Classes for the named visual parts; no part overrides by default. */\n  classNames?: SlotTextClassNames;\n  /** Receives the documented root element; no ref by default. */\n  ref?: Ref<HTMLSpanElement>;\n  /** Inline styles on the documented visual root; no inline overrides by default. */\n  style?: CSSProperties;\n}\n\nconst DIGITS = \"0123456789\";\n\n/** A roll of `n` numerals as a staircase on the system's ease-out: each numeral is shown whole and held until the eased\n *  travel reaches the next, so the reel slows into place like an odometer and no frame ever shows two digits split by\n *  the window (the owner rejected digits drawn over each other mid-roll, 27 Oct). */\nconst stairs = new Map<number, string>();\nfunction staircase(n: number) {\n  let s = stairs.get(n);\n  if (!s) {\n    // ease-out cubic: travel p at time t = 1 - (1 - p)^(1/3); numeral k shows once the travel passes the middle of k\n    const at = (k: number) => `${((1 - Math.cbrt(1 - (k - 0.5) / n)) * 100).toFixed(2)}%`;\n    const points = [\"0 0%\"];\n    for (let k = 1; k <= n; k++) points.push(`${(k - 1) / n} ${at(k)}`, `${k / n} ${at(k)}`);\n    points.push(\"1 100%\");\n    s = `linear(${points.join(\", \")})`;\n    stairs.set(n, s);\n  }\n  return s;\n}\n\n/** A caller's ms, or the token default, on the system's clock. */\nconst clock = (ms: number | undefined, token: string) =>\n  ms === undefined ? token : `calc(${ms}ms * var(--pui-motion-scale, 1) * var(--pui-motion-look, 1))`;\n\n/**\n * Text and numbers that roll into their new value on reels, digit by digit from the right. A number that goes up rolls\n * every reel up and one that goes down rolls them down (9 → 0 on the way up passes through the wrap, like an odometer),\n * so the direction of the change reads before the digits do. A reel ticks through whole numerals, slowing into place, so\n * any frame taken mid-roll reads clean digits; a place the new value no longer has goes at once, and a new place or a\n * changed sign appears whole when its turn in the ripple comes. Reduced motion swaps the value at once. The reels are\n * hidden from assistive tech, which reads the value as text.\n */\nexport function SlotText({\n  value,\n  format,\n  duration,\n  stagger,\n  spins = 0,\n  align: alignProp,\n  announce = false,\n  dir,\n  className,\n  classNames,\n  ref,\n  style,\n}: SlotTextProps) {\n  const locale = useLocale();\n  const scopeDefaults = useComponentDefaults<SlotTextDefaults>(\"slot-text\", [\"align\"]);\n  const align = alignProp ?? scopeDefaults.align ?? \"end\";\n\n  const text =\n    typeof value === \"number\"\n      ? format\n        ? format(value)\n        : numberFormatter(locale, { maximumSignificantDigits: 21 }).format(value)\n      : value;\n  const direction = dir ?? (typeof value === \"number\" || !/\\p{L}/u.test(text) ? \"ltr\" : \"auto\");\n  const host = useRef<HTMLSpanElement>(null);\n  const attach = useComposedRef(host, ref);\n  const tokens = useMotionTokens(host);\n  const managedReduced = useReducedMotionSafe();\n  const reduced = tokens.reduced || managedReduced;\n  // the change is known in the same render it arrives in (no effect-delayed second pass): what it was, which way a\n  // number went, and a run counter that restarts the character fades\n  const [seen, setSeen] = useState({ text, value });\n  const [from, setFrom] = useState(text);\n  const [trend, setTrend] = useState(0);\n  const [run, setRun] = useState(0);\n  if (text !== seen.text) {\n    setSeen({ text, value });\n    setFrom(seen.text);\n    setTrend(typeof value === \"number\" && typeof seen.value === \"number\" ? Math.sign(value - seen.value) : 0);\n    setRun((r) => r + 1);\n  }\n  // when the roll has landed, the columns the old value needed and the new one does not are let go\n  const settle = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n  useEffect(() => {\n    if (from === text) return;\n    const s = tokens.duration.considered * 2 + tokens.stagger.word * Math.max(text.length, from.length);\n    const ms = Math.max((duration ?? s * 1000) + (stagger ?? 0) * Math.max(text.length, from.length), 0) + 50;\n    settle.current = setTimeout(() => setFrom(text), reduced ? 0 : ms);\n    return () => clearTimeout(settle.current);\n  }, [from, text, run, duration, stagger, reduced, tokens.duration.considered, tokens.stagger.word]);\n  // a new roll starts from where each reel rests: the resting mark from the last roll is lifted before paint\n  useLayoutEffect(() => {\n    host.current?.querySelectorAll(\"[data-settled]\").forEach((r) => r.removeAttribute(\"data-settled\"));\n  }, [run]);\n  const len = Math.max(text.length, from.length);\n  const pad = (s: string) => (align === \"end\" ? s.padStart(len, \" \") : s.padEnd(len, \" \"));\n  const now = pad(text),\n    was = pad(from);\n  // a reel holds the digits 2·spins + 3 times; it rests on the middle run, and a roll that passes the wrap lands on\n  // the run beside it, from which the reel is quietly reset to the middle once it stops\n  const base = 10 * (spins + 1);\n  const reel = Array.from({ length: 10 * (2 * spins + 3) }, (_, k) => DIGITS[k % 10]);\n  const durationCss = clock(duration, \"calc(var(--pui-duration-considered) * 2)\");\n  const staggerCss = clock(stagger, \"var(--pui-stagger-word)\");\n  const landed = (e: AnimationEvent<HTMLSpanElement>) => {\n    const target = e.target as HTMLElement;\n    if (target.dataset.slot === \"slot-text-reel\") target.setAttribute(\"data-settled\", \"\");\n  };\n  return (\n    <span\n      ref={attach}\n      data-slot=\"slot-text\"\n      data-trend={trend > 0 ? \"up\" : trend < 0 ? \"down\" : undefined}\n      dir={direction}\n      className={cn(\"relative inline-flex tabular-nums [unicode-bidi:isolate]\", classNames?.root, className)}\n      style={style}\n    >\n      <span\n        data-slot=\"slot-text-spoken\"\n        className={cn(\"sr-only\", classNames?.spoken)}\n        aria-live={announce ? \"polite\" : undefined}\n      >\n        {text}\n      </span>\n      <span\n        aria-hidden\n        data-slot=\"slot-text-visual\"\n        className={cn(\"inline-flex overflow-hidden\", classNames?.visual)}\n        onAnimationEnd={landed}\n      >\n        {[...now].map((ch, i) => {\n          const order = align === \"end\" ? len - 1 - i : i;\n          // a column keeps its element while it stays the same distance from the aligned side, so it can roll\n          const key = align === \"end\" ? `e${order}` : `s${order}`;\n          const delay = `calc(${order} * ${staggerCss})`;\n          const old = was[i];\n          // a place the new value no longer has (1,284 → 488: the \"1\" and the \",\"): gone at once, so the number takes\n          // its new width with the change itself and no half-faded digit sits over its neighbour while the reels turn\n          const padding = align === \"end\" ? i < len - text.length : i >= text.length;\n          if (padding) return null;\n          if (DIGITS.includes(ch)) {\n            const d = Number(ch);\n            const before = Number(old);\n            const changed = old !== ch && DIGITS.includes(old) && run > 0;\n            const turns = changed ? spins * 10 : 0;\n            // the way the number went decides the way every reel turns; a text value turns each the short way\n            const to =\n              !changed || reduced\n                ? base + d\n                : trend > 0\n                  ? base + d + (d > before ? 0 : 10) + turns\n                  : trend < 0\n                    ? base + d - (d < before ? 0 : 10) - turns\n                    : base + d + turns;\n            const fresh = !DIGITS.includes(old) && run > 0 && !reduced;\n            const start = changed && !reduced ? base + before : to;\n            const steps = Math.abs(to - start);\n            return (\n              <span\n                key={key}\n                data-slot=\"slot-text-digit\"\n                className={cn(\n                  \"relative inline-block h-[1lh] overflow-hidden\",\n                  fresh && styles.arrive,\n                  classNames?.digit,\n                )}\n                style={fresh ? { animationDuration: delay } : undefined}\n              >\n                <span data-slot=\"slot-text-measure\" className={cn(\"invisible\", classNames?.measure)}>\n                  0\n                </span>\n                <span\n                  data-slot=\"slot-text-reel\"\n                  className={cn(styles.reel, steps > 0 && (run % 2 ? styles.rollA : styles.rollB), classNames?.reel)}\n                  style={\n                    {\n                      \"--_from\": start,\n                      \"--_to\": to,\n                      \"--_rest\": base + d,\n                      transform: \"translateY(calc(var(--_to) * -1lh))\",\n                      ...(run > 0 &&\n                        !reduced && {\n                          animationDuration: durationCss,\n                          animationDelay: delay,\n                          animationTimingFunction: staircase(Math.max(steps, 1)),\n                        }),\n                    } as CSSProperties\n                  }\n                >\n                  {reel.map((n, k) => (\n                    <span key={k} data-slot=\"slot-text-numeral\" className={cn(\"h-[1lh]\", classNames?.numeral)}>\n                      {n}\n                    </span>\n                  ))}\n                </span>\n              </span>\n            );\n          }\n          return (\n            <span\n              key={`${key}-${ch}-${run}`}\n              data-slot=\"slot-text-character\"\n              className={cn(\n                \"inline-block whitespace-pre\",\n                !reduced && old !== ch && run > 0 && styles.arrive,\n                classNames?.character,\n              )}\n              style={{ animationDuration: delay }}\n            >\n              {ch}\n            </span>\n          );\n        })}\n      </span>\n    </span>\n  );\n}\n\nexport default SlotText;\n"},{"path":"beamline/components/spinner/defaults.ts","type":"registry:file","target":"src/ui/beamline/components/spinner/defaults.ts","content":"/** Pure allowed presentation defaults for Spinner; no component or runtime imports. */\nexport interface SpinnerDefaults {\n  /** Shared size setting; omit to inherit the surrounding scope or the component default. */\n  size?: \"sm\" | \"md\" | \"lg\";\n}\n"},{"path":"beamline/components/spinner/messages.ts","type":"registry:file","target":"src/ui/beamline/components/spinner/messages.ts","content":"import type { MessageDefinitions } from \"../../runtime/messages\";\n/** Built-in English copy; stable keys are the public translation API. */\nexport const english = {\n  label: \"Loading\",\n  done: \"Done\",\n  error: \"Failed\",\n} satisfies MessageDefinitions;\n"},{"path":"beamline/components/spinner/spinner.module.css","type":"registry:file","target":"src/ui/beamline/components/spinner/spinner.module.css","content":"@layer properties, theme, base, components, utilities;\n@layer components {\n  /* With a delay the ring waits unseen and then fades in, so quick work never flashes it; the result (a check or a\n     cross) always shows at once. */\n  .root[data-delay] {\n    animation: appear var(--pui-fade-in) var(--pui-ease-default) var(--_delay) both;\n  }\n  @keyframes appear {\n    from {\n      opacity: 0;\n    }\n  }\n  /* The turn runs on the compositor (a CSS animation on the svg box) and costs no JS per frame. When the work ends the\n     arc closes into a full ring over the standard duration, so stopping the turn is invisible, and the check or cross\n     draws itself a beat later. All timing comes from the motion tokens; the loop period follows --pui-motion-scale. */\n  .svg[data-state=\"loading\"] {\n    animation: turn calc(0.8s * var(--pui-motion-scale, 1) * var(--pui-motion-look, 1)) linear infinite;\n  }\n  .track {\n    stroke-opacity: 0.18;\n  }\n  .arc {\n    stroke-dasharray: 0.3 1;\n    transition: stroke-dasharray var(--pui-duration-standard) var(--pui-ease-enter);\n  }\n  .svg:not([data-state=\"loading\"]) .arc {\n    stroke-dasharray: 1 1;\n  }\n  .mark {\n    stroke-dasharray: 1 1;\n    animation: draw var(--pui-duration-standard) var(--pui-ease-enter) var(--pui-duration-fast) both;\n  }\n  @keyframes turn {\n    to {\n      transform: rotate(1turn);\n    }\n  }\n  @keyframes draw {\n    from {\n      stroke-dashoffset: 1;\n    }\n    to {\n      stroke-dashoffset: 0;\n    }\n  }\n  .svg[data-paused] {\n    animation-play-state: paused;\n  }\n  .svg[data-reduced],\n  .svg[data-reduced] .mark {\n    animation: none;\n  }\n  /* Reduction retains the loading/result shape without a decorative loop. */\n  @media (prefers-reduced-motion: reduce) {\n    .svg[data-state=\"loading\"],\n    .mark {\n      animation: none;\n    }\n  }\n}\n"},{"path":"beamline/components/spinner/spinner.tsx","type":"registry:file","target":"src/ui/beamline/components/spinner/spinner.tsx","content":"\"use client\";\n\nimport { useMessages } from \"../../runtime/localization\";\nimport { english as englishMessages } from \"./messages\";\nimport { useComponentDefaults } from \"../../runtime/appearance\";\nimport type { SpinnerDefaults } from \"./defaults\";\nexport type { SpinnerDefaults } from \"./defaults\";\n\nimport { useRef, type CSSProperties, type Ref } from \"react\";\nimport { useComposedRef } from \"../../hooks/use-composed-ref\";\nimport { useActive } from \"../../hooks/use-active\";\nimport { useMotionTokens } from \"../../hooks/use-motion-tokens\";\nimport { useReducedMotionSafe } from \"../../hooks/use-reduced-motion-safe\";\nimport { cn } from \"../../lib/utils\";\nimport styles from \"./spinner.module.css\";\n\nexport interface SpinnerClassNames {\n  /** Classes for the root part; no override by default. */\n  root?: string;\n  /** Classes for the svg part; no override by default. */\n  svg?: string;\n  /** Classes for the track part; no override by default. */\n  track?: string;\n  /** Classes for the arc part; no override by default. */\n  arc?: string;\n  /** Classes for the mark part; no override by default. */\n  mark?: string;\n}\n\nexport interface SpinnerProps {\n  /** `success` draws a check out of the ring, `error` a cross; both stop spinning. */\n  state?: \"loading\" | \"success\" | \"error\";\n  /** Control size within the supported size steps. Defaults to \"md\". */\n  size?: \"sm\" | \"md\" | \"lg\";\n  /** Accessible name while loading. */\n  label?: string;\n  /** ms to wait before it shows: work that ends sooner never flashes a spinner (about 300 is a good start). Default 0. */\n  delay?: number;\n  /** Classes on the documented visual root; no override by default. */\n  className?: string;\n  /** Receives the documented root element; no ref by default. */\n  ref?: Ref<HTMLSpanElement>;\n  /** Inline styles on the documented visual root; no inline overrides by default. */\n  style?: CSSProperties;\n  /** Classes for the named visual parts; no part overrides by default. */\n  classNames?: SpinnerClassNames;\n}\n\n/** Icon box from the foundation icon steps (§14.2): sm 14, md 16, lg 20. */\nconst PX = { sm: \"var(--pui-icon-sm)\", md: \"var(--pui-icon-md)\", lg: \"var(--pui-icon-lg)\" } as const;\n\n/**\n * A ring that spins while work runs and closes into a drawn check (or cross) when it ends — the result is a shape as\n * well as a colour. With reduced motion the loading ring holds still.\n */\nexport function Spinner({\n  state = \"loading\",\n  size: sizeProp,\n  label: labelProp,\n  delay = 0,\n  className,\n  classNames,\n  style,\n  ref,\n}: SpinnerProps) {\n  const i18n = useMessages(\"spinner\", englishMessages);\n  const label = labelProp === undefined ? i18n(\"label\") : labelProp;\n\n  const scopeDefaults = useComponentDefaults<SpinnerDefaults>(\"spinner\", [\"size\"]);\n  const size = sizeProp ?? scopeDefaults.size ?? \"md\";\n  const host = useRef<HTMLSpanElement>(null);\n  const attach = useComposedRef(host, ref);\n  const active = useActive(host);\n  const tokens = useMotionTokens(host);\n  const managedReduced = useReducedMotionSafe();\n  const reduced = tokens.reduced || managedReduced;\n\n  const box = PX[size];\n  const done = state !== \"loading\";\n  const tone = state === \"success\" ? \"text-green\" : state === \"error\" ? \"text-red\" : \"text-ink-2\";\n  return (\n    <span\n      ref={attach}\n      data-slot=\"spinner\"\n      data-state={state}\n      data-delay={delay > 0 && state === \"loading\" ? \"\" : undefined}\n      role={done ? \"img\" : \"status\"}\n      aria-label={state === \"success\" ? i18n(\"done\") : state === \"error\" ? i18n(\"error\") : label}\n      className={cn(styles.root, \"relative inline-grid shrink-0 place-items-center\", tone, classNames?.root, className)}\n      style={{ width: box, height: box, \"--_delay\": `${delay}ms`, ...style } as CSSProperties}\n    >\n      <svg\n        viewBox=\"0 0 24 24\"\n        width=\"100%\"\n        height=\"100%\"\n        fill=\"none\"\n        aria-hidden=\"true\"\n        data-state={state}\n        data-slot=\"spinner-svg\"\n        data-reduced={reduced ? \"\" : undefined}\n        data-paused={active ? undefined : \"\"}\n        className={cn(styles.svg, classNames?.svg)}\n      >\n        <circle\n          data-slot=\"spinner-track\"\n          className={cn(styles.track, classNames?.track)}\n          cx=\"12\"\n          cy=\"12\"\n          r=\"9.5\"\n          stroke=\"currentColor\"\n          strokeWidth=\"2.5\"\n        />\n        <circle\n          data-slot=\"spinner-arc\"\n          className={cn(styles.arc, classNames?.arc)}\n          cx=\"12\"\n          cy=\"12\"\n          r=\"9.5\"\n          pathLength={1}\n          stroke=\"currentColor\"\n          strokeWidth=\"2.5\"\n          strokeLinecap=\"round\"\n          transform=\"rotate(-90 12 12)\"\n        />\n        {state === \"success\" && (\n          <path\n            data-slot=\"spinner-mark\"\n            className={cn(styles.mark, classNames?.mark)}\n            d=\"M7.5 12.5l3 3 6-6.5\"\n            pathLength={1}\n            stroke=\"currentColor\"\n            strokeWidth=\"2.5\"\n            strokeLinecap=\"round\"\n            strokeLinejoin=\"round\"\n          />\n        )}\n        {state === \"error\" && (\n          <path\n            data-slot=\"spinner-mark\"\n            className={cn(styles.mark, classNames?.mark)}\n            d=\"M8.5 8.5l7 7M15.5 8.5l-7 7\"\n            pathLength={1}\n            stroke=\"currentColor\"\n            strokeWidth=\"2.5\"\n            strokeLinecap=\"round\"\n          />\n        )}\n      </svg>\n    </span>\n  );\n}\n\nexport default Spinner;\n"},{"path":"beamline/hooks/use-active.ts","type":"registry:file","target":"src/ui/beamline/hooks/use-active.ts","content":"\"use client\";\n\nimport { useContext, useEffect, useState, type RefObject } from \"react\";\n\nimport { ActivityContext } from \"../runtime/activity\";\n\n/**\n * Whether an animated element should be doing work: it is (nearly) on screen and the tab is visible. Every\n * continuously animated component gates its loop, shader or CSS animation on this, so an effect scrolled out of view,\n * behind another tab, or in a collapsed panel costs nothing. One IntersectionObserver per element; no polling.\n */\nexport function useActive(\n  ref: RefObject<Element | null>,\n  {\n    margin = \"120px\",\n    key,\n    idle = true,\n  }: {\n    margin?: string;\n    /** Re-attach when this changes (an element that mounts later). */\n    key?: unknown;\n    /** Pause continuous work at the host idle boundary. Finite sequences set false so they finish. */\n    idle?: boolean;\n  } = {},\n) {\n  const active = useContext(ActivityContext);\n  const [inView, setInView] = useState(false);\n  const [visible, setVisible] = useState(\n    () => typeof document === \"undefined\" || document.visibilityState === \"visible\",\n  );\n  useEffect(() => {\n    const el = ref.current;\n    if (!el || typeof IntersectionObserver === \"undefined\") {\n      setInView(true);\n      return;\n    }\n    const io = new IntersectionObserver(([e]) => setInView(e.isIntersecting), { rootMargin: margin });\n    io.observe(el);\n    return () => io.disconnect();\n  }, [ref, margin, key]);\n  useEffect(() => {\n    const on = () => setVisible(document.visibilityState === \"visible\");\n    document.addEventListener(\"visibilitychange\", on);\n    return () => document.removeEventListener(\"visibilitychange\", on);\n  }, []);\n  return (!idle || active) && inView && visible;\n}\n"},{"path":"beamline/hooks/use-composed-ref.ts","type":"registry:file","target":"src/ui/beamline/hooks/use-composed-ref.ts","content":"\"use client\";\n\nimport { useCallback, type Ref, type RefObject } from \"react\";\n\n/** Keep a control's measurement/focus ref and the caller's ref, including React 19 callback cleanup. */\nexport function useComposedRef<T>(internal: RefObject<T | null>, external?: Ref<T>) {\n  return useCallback(\n    (node: T | null) => {\n      internal.current = node;\n      if (typeof external === \"function\") {\n        const cleanup = external(node);\n        if (typeof cleanup === \"function\")\n          return () => {\n            internal.current = null;\n            cleanup();\n          };\n      } else if (external) external.current = node;\n    },\n    [internal, external],\n  );\n}\n"},{"path":"beamline/hooks/use-controllable.ts","type":"registry:file","target":"src/ui/beamline/hooks/use-controllable.ts","content":"\"use client\";\n\nimport { useCallback, useRef, useState } from \"react\";\n\n/**\n * One value in both forms (rules/CONVENTIONS.md): the prop while it is passed, otherwise the element's own copy that\n * starts at `initial` (a value, or a function that makes it once). The setter takes a value or an updater; an updater\n * reads the latest value even twice in one event, and every change reaches `onChange`, controlled or not.\n * `Next` is what a change can carry when it is narrower than the state: a range that starts empty (null) but is only\n * ever changed to a range.\n */\nexport function useControllable<T, Next extends T = T>(\n  value: T | undefined,\n  initial: T | (() => T),\n  onChange?: (next: Next) => void,\n) {\n  const [own, setOwn] = useState<T>(initial);\n  const current = value !== undefined ? value : own;\n  const latest = useRef(current);\n  latest.current = current;\n  const set = useCallback(\n    (next: Next | ((was: T) => Next)) => {\n      const resolved = typeof next === \"function\" ? (next as (was: T) => Next)(latest.current) : next;\n      latest.current = resolved;\n      if (value === undefined) setOwn(resolved);\n      onChange?.(resolved);\n    },\n    [value, onChange],\n  );\n  return [current, set] as const;\n}\n"},{"path":"beamline/hooks/use-deprecated-prop.ts","type":"registry:file","target":"src/ui/beamline/hooks/use-deprecated-prop.ts","content":"\"use client\";\n\nimport { useEffect } from \"react\";\n\n// Bundlers replace NODE_ENV for browser builds; this declaration emits no Node dependency.\ndeclare const process: { env: { NODE_ENV?: string } };\n\nconst warned = new Set<string>();\n\n/** Report a legacy prop once after mount in development; production and server renders stay silent. */\nexport function useDeprecatedProp(component: string, prop: string, replacement: string, supplied: boolean) {\n  useEffect(() => {\n    if (process.env.NODE_ENV !== \"development\" || !supplied) return;\n    const key = `${component}.${prop}`;\n    if (warned.has(key)) return;\n    warned.add(key);\n    console.warn(`[Beamline] ${key} is deprecated. Use ${replacement} instead; the legacy prop still works.`);\n  }, [component, prop, replacement, supplied]);\n}\n"},{"path":"beamline/hooks/use-drag.ts","type":"registry:file","target":"src/ui/beamline/hooks/use-drag.ts","content":"\"use client\";\n\nimport { useEffect, useRef, useState, type RefObject } from \"react\";\nimport { VelocityTracker } from \"../lib/gesture\";\n\n/** Where the pointer is during a drag, relative to where it was pressed, with its velocity (px/s) over the last 100 ms. */\nexport interface DragPoint {\n  /** Pointer position in client coordinates. */\n  x: number;\n  y: number;\n  /** Distance from the press. */\n  dx: number;\n  dy: number;\n  /** Velocity in px/s (read from the last 100 ms, so a release carries the flick, not the whole drag). */\n  vx: number;\n  vy: number;\n  pointerType: string;\n  /** Shift was held (a part may offer a second mode on it: move one task alone, a finer step). */\n  shift: boolean;\n}\n\nexport interface DragHandlers {\n  /** A press landed on the element. Return false to leave it alone (a press on a nested button or link). */\n  onPress?: (point: DragPoint, event: PointerEvent) => boolean | void;\n  /** The pointer moved past the threshold: the drag begins (the press point is in `point.x - point.dx`). */\n  onStart?: (point: DragPoint) => void;\n  /** The pointer moved during a drag. `event` is the browser's own, for what a point does not carry: a pen's pressure,\n   *  the coalesced samples a fast stroke packs into one event (a drawing surface). */\n  onMove?: (point: DragPoint, event: PointerEvent) => void;\n  /** Released after a drag, with the release velocity. */\n  onEnd?: (point: DragPoint) => void;\n  /** Released without moving past the threshold: a tap or click (the part's tap route, WCAG 2.5.7). */\n  onTap?: (point: DragPoint) => void;\n  /** Escape, a lost pointer or the browser taking the gesture (a page scroll): put things back as they were. */\n  onCancel?: () => void;\n  /** A press that ended as neither a drag nor a tap: a finger that went on to scroll the page, or a pointer the browser\n   *  took before the threshold. Undo whatever `onPress` prepared. */\n  onAbandon?: () => void;\n}\n\nexport interface DragOptions {\n  /** The axis the part moves on. On touch, a drag that starts mostly across it is left to the page (a scroll). */\n  axis?: \"x\" | \"y\" | \"both\";\n  /** Pixels before a press becomes a drag: 3 for a mouse, 8 for a finger or pen unless given. */\n  threshold?: number;\n  disabled?: boolean;\n}\n\n/**\n * The pointer side of a hand on a part, shared by everything dragged, thrown or pulled (a thumb, a puck, a stub, a\n * task, a cable). It listens natively on the element, so moves never render React: the part writes positions in its\n * handlers (a spring, a transform, a custom property) and only `dragging`, which changes at the start and end, is\n * state (for `data-state`).\n *\n * A press becomes a drag past a small threshold, then the pointer is captured so the drag continues outside the\n * element; a release without moving is a tap (`onTap`), the route every drag needs for people who cannot drag. Escape,\n * `pointercancel` and a lost capture call `onCancel`, and the part restores what it showed before the press. On touch the\n * element needs a `touch-action` that leaves the other axis to the page (`pan-y` for a part dragged sideways; never\n * `none` on more than the dragged surface, which would block zoom), and a drag that starts across its axis is dropped\n * so the page can scroll.\n */\nexport function useDrag<T extends HTMLElement | SVGElement>(\n  ref: RefObject<T | null>,\n  handlers: DragHandlers,\n  { axis = \"both\", threshold, disabled = false }: DragOptions = {},\n): { dragging: boolean } {\n  const [dragging, setDragging] = useState(false);\n  const latest = useRef(handlers);\n  latest.current = handlers;\n\n  useEffect(() => {\n    // an SVG part (a chart's brush) is dragged the same way; its pointer events are typed as an HTML element's\n    const el = ref.current as HTMLElement | null;\n    if (!el || disabled) return;\n    const doc = el.ownerDocument;\n    // Escape during a drag belongs to the drag: listened on the window's capture phase, it runs before any dialog or\n    // popover listening on the document, which would otherwise also close around the cancelled drag\n    const win = doc.defaultView ?? window;\n    let active: {\n      id: number;\n      x0: number;\n      y0: number;\n      type: string;\n      started: boolean;\n      tracker: VelocityTracker;\n    } | null = null;\n\n    const point = (e: PointerEvent): DragPoint => {\n      const a = active!;\n      const [vx, vy] = a.tracker.velocity(e.timeStamp);\n      return {\n        x: e.clientX,\n        y: e.clientY,\n        dx: e.clientX - a.x0,\n        dy: e.clientY - a.y0,\n        vx,\n        vy,\n        pointerType: e.pointerType,\n        shift: e.shiftKey,\n      };\n    };\n\n    const finish = () => {\n      if (active?.started && el.hasPointerCapture?.(active.id)) el.releasePointerCapture(active.id);\n      active = null;\n      doc.removeEventListener(\"pointermove\", move);\n      doc.removeEventListener(\"pointerup\", up);\n      doc.removeEventListener(\"pointercancel\", cancel);\n      win.removeEventListener(\"keydown\", key, true);\n      doc.removeEventListener(\"selectstart\", hold, true);\n      doc.removeEventListener(\"dragstart\", hold, true);\n      el.removeEventListener(\"lostpointercapture\", lost);\n      setDragging(false);\n    };\n\n    const cancel = () => {\n      if (!active) return;\n      const started = active.started;\n      finish();\n      if (started) latest.current.onCancel?.();\n      else latest.current.onAbandon?.();\n    };\n\n    // only the part's own capture ending cancels: a finger's press is captured by the child it landed on, and moving\n    // the capture to the part fires lostpointercapture on that child, which bubbles here\n    const lost = (e: PointerEvent) => {\n      if (e.target === el && active?.started && e.pointerId === active.id) cancel();\n    };\n\n    const key = (e: KeyboardEvent) => {\n      if (e.key !== \"Escape\" || !active?.started) return;\n      e.preventDefault();\n      e.stopImmediatePropagation();\n      cancel();\n    };\n\n    // while the hand holds the part, the page neither selects text nor starts its own drag and drop (a selection left\n    // by an earlier drag would otherwise be dragged, and the browser cancels the pointer)\n    const hold = (e: Event) => e.preventDefault();\n\n    const move = (e: PointerEvent) => {\n      if (!active || e.pointerId !== active.id) return;\n      active.tracker.add(e.timeStamp, e.clientX, e.clientY);\n      const p = point(e);\n      if (!active.started) {\n        const limit = threshold ?? (active.type === \"mouse\" ? 3 : 8);\n        if (Math.hypot(p.dx, p.dy) < limit) return;\n        // a finger that starts across the part's axis is scrolling the page\n        const across = axis === \"x\" ? Math.abs(p.dy) > Math.abs(p.dx) : axis === \"y\" && Math.abs(p.dx) > Math.abs(p.dy);\n        if (active.type !== \"mouse\" && across) {\n          finish();\n          latest.current.onAbandon?.();\n          return;\n        }\n        active.started = true;\n        doc.getSelection()?.removeAllRanges();\n        el.setPointerCapture?.(active.id);\n        el.addEventListener(\"lostpointercapture\", lost);\n        setDragging(true);\n        latest.current.onStart?.(p);\n      }\n      latest.current.onMove?.(p, e);\n    };\n\n    const up = (e: PointerEvent) => {\n      if (!active || e.pointerId !== active.id) return;\n      active.tracker.add(e.timeStamp, e.clientX, e.clientY);\n      const p = point(e);\n      const started = active.started;\n      finish();\n      if (started) latest.current.onEnd?.(p);\n      else latest.current.onTap?.(p);\n    };\n\n    const down = (e: PointerEvent) => {\n      if (active || !e.isPrimary || (e.pointerType === \"mouse\" && e.button !== 0)) return;\n      const tracker = new VelocityTracker();\n      tracker.add(e.timeStamp, e.clientX, e.clientY);\n      active = { id: e.pointerId, x0: e.clientX, y0: e.clientY, type: e.pointerType, started: false, tracker };\n      if (latest.current.onPress?.(point(e), e) === false) {\n        active = null;\n        return;\n      }\n      doc.addEventListener(\"pointermove\", move);\n      doc.addEventListener(\"pointerup\", up);\n      doc.addEventListener(\"pointercancel\", cancel);\n      win.addEventListener(\"keydown\", key, true);\n      doc.addEventListener(\"selectstart\", hold, true);\n      doc.addEventListener(\"dragstart\", hold, true);\n    };\n\n    el.addEventListener(\"pointerdown\", down);\n    return () => {\n      el.removeEventListener(\"pointerdown\", down);\n      if (active) finish();\n    };\n  }, [ref, axis, threshold, disabled]);\n\n  return { dragging };\n}\n"},{"path":"beamline/hooks/use-flip.ts","type":"registry:file","target":"src/ui/beamline/hooks/use-flip.ts","content":"\"use client\";\n\nimport { useLayoutEffect, useRef, type RefObject } from \"react\";\nimport { useMotionTokens } from \"./use-motion-tokens\";\nimport { cssEase } from \"../lib/motion-tokens\";\n\ntype Seen = { el: HTMLElement; x: number; y: number; w: number; h: number };\n\n/**\n * Items of a collection keep their path (the morph grammar's \"changes keep their size and their path\"): mark each item\n * with `data-flip=\"<stable key>\"` inside `container`. After a change, an item that is new grows in, items that moved\n * slide from where they were, and an item that left fades out as a ghost where it stood (a still copy, inert and\n * hidden from assistive tech, removed when it has faded). The data and focus change at once; only the picture\n * settles. Nothing runs at rest; reduced motion places at once. Positions are kept in the container's own content\n * (relative to it, plus its scroll) and read at rest, so neither a scroll of the page, nor a scroll of the container\n * itself, nor an item still settling reads as movement.\n *\n * `resize`: an item whose box changed size also scales from its old box (for marks without text, a bar or a segment, so a\n * new value glides on transforms instead of laying out every frame). `origin(key)`: an element a new item grows out of\n * (a ribbon's segment becoming a column, a shared chip dividing into pieces); with `originFirst` it applies on the\n * container's first render too, so a panel that opens unfolds its items from what was already on screen. `inner`: items\n * inside another item that lies outside the container (a merge's rows inside a card that moves itself) are this\n * container's own; nesting is judged inside the container only.\n */\nexport function useFlip(\n  container: RefObject<HTMLElement | null> | (() => HTMLElement | null),\n  {\n    ghost = true,\n    enter = true,\n    resize = false,\n    origin,\n    originFirst = false,\n    inner = false,\n  }: {\n    ghost?: boolean;\n    enter?: boolean;\n    resize?: boolean;\n    origin?: (key: string) => Element | null | undefined;\n    originFirst?: boolean;\n    inner?: boolean;\n  } = {},\n) {\n  const get = typeof container === \"function\" ? container : () => container.current;\n  // timing read at the container itself, found when the commit has attached it (a function container has no ref of its\n  // own; without a host the timing stayed unresolved where no UIRoot is around, then rendered again to say so)\n  const host =\n    typeof container === \"function\"\n      ? {\n          get current() {\n            return container();\n          },\n        }\n      : container;\n  const motion = useMotionTokens(host);\n  const last = useRef<Map<string, Seen> | null>(null);\n  const lastWidth = useRef(0);\n  const flying = useRef(new Set<Animation>());\n  // where every item stands, in the container's own content (relative to it, plus its scroll): a list scrolled since the\n  // last render has moved nothing (a row that slid back by the scroll would leave the finger that is tapping it). The\n  // items' own grow-ins and slides still in flight are lifted while they are read, so each box is where the layout puts\n  // it: a render mid-flight (a live price ticking while a new row grows in) is not a move.\n  const read = (root: HTMLElement) => {\n    const lifted = [...flying.current].map((a) => a.effect as KeyframeEffect).map((e) => [e, e.target] as const);\n    for (const [effect] of lifted) effect.target = null;\n    const box = root.getBoundingClientRect();\n    const now = new Map<string, Seen>();\n    for (const el of root.querySelectorAll<HTMLElement>(\"[data-flip]\")) {\n      // only the outermost items move (with `inner`, outermost inside this container)\n      const outer = el.parentElement?.closest(\"[data-flip]\");\n      if (outer && (!inner || (outer !== root && root.contains(outer)))) continue;\n      const r = el.getBoundingClientRect();\n      now.set(el.dataset.flip!, {\n        el,\n        x: r.left - box.left + root.scrollLeft,\n        y: r.top - box.top + root.scrollTop,\n        w: r.width,\n        h: r.height,\n      });\n    }\n    for (const [effect, target] of lifted) effect.target = target;\n    return { box, now };\n  };\n  // a container that changes size at rest, with no render (fonts arriving, a scrollbar appearing, a window resized), has\n  // its places read again then: else the first change after it would take the new width for a reflow and move nothing\n  const watched = useRef<{ el: HTMLElement; observer: ResizeObserver } | null>(null);\n  useLayoutEffect(() => () => watched.current?.observer.disconnect(), []);\n  // every render on purpose: a collection changes through its parent's state, not through anything we can depend on\n  useLayoutEffect(() => {\n    const root = get();\n    // a container that is gone (a panel folded) starts over when it comes back: its items are new, not moved\n    if (!root) {\n      last.current = null;\n      return;\n    }\n    if (watched.current?.el !== root && typeof ResizeObserver !== \"undefined\") {\n      watched.current?.observer.disconnect();\n      const observer = new ResizeObserver(() => {\n        if (flying.current.size || !last.current || !root.isConnected) return;\n        const seen = read(root);\n        last.current = seen.now;\n        lastWidth.current = seen.box.width;\n      });\n      observer.observe(root);\n      watched.current = { el: root, observer };\n    }\n    const { box, now } = read(root);\n    // a container that changed width since the last render reflowed its items by itself (a panel resized, a room\n    // step crossed): that is placement, not a change a person made, so this render records the new places and moves\n    // nothing (a reflow places, only a choice travels)\n    const reflowed = Math.abs(box.width - lastWidth.current) > 0.5;\n    lastWidth.current = box.width;\n    const before = reflowed ? null : last.current;\n    last.current = now;\n    const ms = motion.duration.standard * 1000;\n    // the first render moves nothing, except items that grow out of an origin already on screen\n    if ((!before && !(origin && originFirst)) || motion.reduced || ms < 2) return;\n    const easing = cssEase(motion.ease.standard, \"ease-out\");\n    // an item in flight says so (`data-flip-flight`: \"far\" when it crosses more than its own size, a slide between groups or\n    // a share growing out of another item; \"near\" for a neighbour's step), so a part can lift what travels over other\n    // text onto a surface of its own instead of drawing words over words\n    const fly = (el: HTMLElement, keyframes: Keyframe[], far = false) => {\n      const flight = el.animate(keyframes, { duration: ms, easing });\n      flying.current.add(flight);\n      if (far || el.dataset.flipFlight !== \"far\") el.dataset.flipFlight = far ? \"far\" : \"near\";\n      const land = () => {\n        flying.current.delete(flight);\n        if (![...flying.current].some((a) => (a.effect as KeyframeEffect | null)?.target === el))\n          delete el.dataset.flipFlight;\n      };\n      flight.finished.then(land, land);\n    };\n    const boxOf = (key: string) => {\n      const from = origin?.(key);\n      if (!from || !from.isConnected) return null;\n      const r = from.getBoundingClientRect();\n      return { x: r.left - box.left + root.scrollLeft, y: r.top - box.top + root.scrollTop, w: r.width, h: r.height };\n    };\n    // from a box to where the item stands: translate and scale about the top-left corner\n    const morph = (was: { x: number; y: number; w: number; h: number }, at: Seen): Keyframe[] => [\n      {\n        transformOrigin: \"0 0\",\n        transform: `translate(${was.x - at.x}px, ${was.y - at.y}px) scale(${was.w / Math.max(at.w, 0.5)}, ${was.h / Math.max(at.h, 0.5)})`,\n      },\n      { transformOrigin: \"0 0\", transform: \"none\" },\n    ];\n    for (const [key, at] of now) {\n      const was = before?.get(key);\n      if (!was) {\n        const from = boxOf(key);\n        if (from) fly(at.el, morph(from, at), true);\n        else if (enter && before)\n          fly(at.el, [\n            { opacity: 0, transform: \"scale(0.86)\" },\n            { opacity: 1, transform: \"none\" },\n          ]);\n        continue;\n      }\n      const dx = was.x - at.x,\n        dy = was.y - at.y;\n      const resized = resize && (Math.abs(was.w - at.w) > 0.5 || Math.abs(was.h - at.h) > 0.5);\n      const far = Math.abs(dx) > at.w * 0.5 || Math.abs(dy) > at.h * 1.5;\n      if (resized) fly(at.el, morph(was, at), far);\n      else if (Math.abs(dx) > 0.5 || Math.abs(dy) > 0.5)\n        fly(at.el, [{ transform: `translate(${dx}px, ${dy}px)` }, { transform: \"none\" }], far);\n    }\n    if (!ghost || !before) return;\n    for (const [key, was] of before) {\n      if (now.has(key) || was.el.isConnected) continue;\n      const copy = was.el.cloneNode(true) as HTMLElement;\n      copy.removeAttribute(\"data-flip\");\n      // the ghost is a picture of the item, not the item: nothing that finds parts by slot or id may find it\n      for (const n of [copy, ...copy.querySelectorAll(\"[id], [data-slot]\")]) {\n        n.removeAttribute(\"id\");\n        n.removeAttribute(\"data-slot\");\n      }\n      copy.setAttribute(\"data-ghost\", \"\");\n      copy.setAttribute(\"aria-hidden\", \"true\");\n      copy.inert = true;\n      if (getComputedStyle(root).position === \"static\") root.style.position = \"relative\";\n      Object.assign(copy.style, {\n        position: \"absolute\",\n        left: `${was.x}px`,\n        top: `${was.y}px`,\n        width: `${was.w}px`,\n        height: `${was.h}px`,\n        margin: \"0\",\n        pointerEvents: \"none\",\n      });\n      root.appendChild(copy);\n      // the ghost is gone by the time a neighbour slides into its place, so their texts never mix. The clock runs\n      // straight and an even curve shapes only the fade: the front-loaded standard curve on the whole timeline passed\n      // 0.45 inside the first frame, so what left read as a pop instead of a fade\n      const fade = copy.animate(\n        [\n          { opacity: 1, transform: \"none\", easing: cssEase(motion.ease.default, \"ease-in-out\") },\n          { opacity: 0, transform: \"scale(0.9)\", offset: 0.6 },\n          { opacity: 0, transform: \"scale(0.86)\" },\n        ],\n        {\n          duration: motion.duration.standard * 1000,\n          easing: \"linear\",\n        },\n      );\n      const drop = () => copy.remove();\n      fade.finished.then(drop, drop);\n      // and by the clock as well: a fade that never reports its end (the page hidden, an animation cancelled from\n      // outside) must not leave a copy behind for a person or a test to find\n      setTimeout(drop, motion.duration.standard * 1000 + 250);\n    }\n  });\n}\n"},{"path":"beamline/hooks/use-media-query.ts","type":"registry:file","target":"src/ui/beamline/hooks/use-media-query.ts","content":"\"use client\";\n\nimport { useSyncExternalStore } from \"react\";\n\n// one MediaQueryList per query: React reads the snapshot on every render, and a part that renders thirty times a\n// second (a playing audio player's clock) would otherwise ask the browser for a new list each time\nconst lists = new Map<string, MediaQueryList>();\nconst list = (query: string) => {\n  if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") return undefined;\n  let m = lists.get(query);\n  if (!m) lists.set(query, (m = window.matchMedia(query)));\n  return m;\n};\n\n/** True while the media query matches; false on the server and in the first client render of SSR output. */\nexport function useMediaQuery(query: string): boolean {\n  return useSyncExternalStore(\n    (notify) => {\n      const m = list(query);\n      m?.addEventListener(\"change\", notify);\n      return () => m?.removeEventListener(\"change\", notify);\n    },\n    () => list(query)?.matches ?? false,\n    () => false,\n  );\n}\n\n/** Phone-width layouts: below 768px. */\nexport const usePhone = () => useMediaQuery(\"(max-width: 767px)\");\n"},{"path":"beamline/hooks/use-motion-tokens.ts","type":"registry:file","target":"src/ui/beamline/hooks/use-motion-tokens.ts","content":"\"use client\";\n\nimport { useMemo, type RefObject } from \"react\";\nimport { useAppearanceRoot } from \"../runtime/appearance\";\nimport { useResolvedAppearance } from \"./use-resolved-appearance\";\nimport { motionAt, motionEase, motionTokens, type MotionTokens } from \"../lib/motion-tokens\";\nimport { semanticMotion } from \"../lib/motion-source\";\n\nconst durationToken = (name: string) =>\n  name === \"exit\" ? \"motion-out\" : name === \"in\" || name === \"out\" ? `motion-${name}` : `duration-${name}`;\nconst easeToken = (name: string) => `ease-${name === \"inOut\" ? \"in-out\" : name}`;\nconst REQUEST = {\n  times: [\n    ...Object.keys(semanticMotion.duration).map(durationToken),\n    ...Object.keys(semanticMotion.spring).map((name) => `spring-${name}`),\n    ...Object.keys(semanticMotion.stagger).map((name) => `stagger-${name}`),\n    \"fade-in\",\n    \"fade-out\",\n  ],\n  easings: [...Object.keys(semanticMotion.ease).map(easeToken), \"ease-spring\", \"ease-spring-bounce\", \"ease-overshoot\"],\n  numbers: [\"motion-scale\", \"motion-look\", \"press-scale\"],\n  // timing only: the host's own type would make every control resolve differently from the page around it\n  typography: false,\n};\n\n/**\n * Resolve each timing at the actual host; omitted host uses the nearest managed root. The first/server snapshot is\n * the pure foundation default. Local CSS values, scope changes, font readiness, OS preference and explicit refresh\n * update the same consumer; no document-wide first-root fallback or persistent global listener.\n */\nexport function useMotionTokens(hostRef?: RefObject<HTMLElement | null>): MotionTokens & {\n  ready: boolean;\n  /** Reduced or none: movement, springs and staggers are instant. */\n  reduced: boolean;\n  mode: \"full\" | \"reduced\" | \"none\";\n  /** Opacity-only arrival and departure (seconds): kept under reduced, instant under none (APPEARANCE A06). */\n  fade: { in: number; out: number };\n} {\n  const root = useAppearanceRoot();\n  const scopeRef = useMemo(() => ({ current: root }), [root]);\n  const resolved = useResolvedAppearance(hostRef ?? scopeRef, REQUEST);\n  return useMemo(() => {\n    if (!resolved.ready)\n      return {\n        ...motionTokens,\n        ready: false,\n        reduced: false,\n        mode: \"full\" as const,\n        fade: { in: motionTokens.duration.in, out: motionTokens.duration.out },\n      };\n    const reduced = resolved.reducedMotion;\n    const speed = (resolved.numbers[\"motion-scale\"] ?? 1) * (resolved.numbers[\"motion-look\"] ?? 1);\n    const fade =\n      resolved.motionMode === \"none\"\n        ? { in: 0.001, out: 0.001 }\n        : {\n            in: resolved.times[\"fade-in\"] ?? semanticMotion.duration.in * speed,\n            out: resolved.times[\"fade-out\"] ?? semanticMotion.duration.out * speed,\n          };\n    const factor = reduced ? 0.001 / semanticMotion.duration.standard : speed;\n    const base = motionAt(factor);\n    const duration = Object.fromEntries(\n      Object.entries(base.duration).map(([name, fallback]) => [\n        name,\n        reduced ? 0.001 : (resolved.times[durationToken(name)] ?? fallback),\n      ]),\n    ) as MotionTokens[\"duration\"];\n    const stagger = Object.fromEntries(\n      Object.entries(base.stagger).map(([name, fallback]) => [\n        name,\n        reduced ? 0 : (resolved.times[`stagger-${name}`] ?? fallback),\n      ]),\n    ) as MotionTokens[\"stagger\"];\n    const ease = Object.fromEntries(\n      Object.entries(base.ease).map(([name, fallback]) => [\n        name,\n        motionEase(resolved.easings[easeToken(name)], fallback),\n      ]),\n    ) as MotionTokens[\"ease\"];\n    const spring = { ...base.spring };\n    for (const name of Object.keys(semanticMotion.spring) as (keyof typeof semanticMotion.spring)[])\n      spring[name] = {\n        ...base.spring[name],\n        visualDuration: reduced ? 0.001 : (resolved.times[`spring-${name}`] ?? base.spring[name].visualDuration),\n        bounce: reduced ? 0 : base.spring[name].bounce,\n      };\n    return {\n      ...base,\n      ready: true,\n      reduced,\n      mode: resolved.motionMode,\n      fade,\n      duration,\n      stagger,\n      ease,\n      spring,\n      pressScale: resolved.numbers[\"press-scale\"] ?? base.pressScale,\n      css: {\n        spring: resolved.easings[\"ease-spring\"] ?? base.css.spring,\n        springBounce: resolved.easings[\"ease-spring-bounce\"] ?? base.css.springBounce,\n        overshoot: resolved.easings[\"ease-overshoot\"] ?? base.css.overshoot,\n      },\n    };\n  }, [resolved]);\n}\n"},{"path":"beamline/hooks/use-reduced-motion-safe.ts","type":"registry:file","target":"src/ui/beamline/hooks/use-reduced-motion-safe.ts","content":"\"use client\";\n\nimport { useMediaQuery } from \"./use-media-query\";\nimport { useScopeMotion } from \"../runtime/appearance\";\n\n/** Managed motion policy plus the OS preference, with a stable server snapshot. */\nexport function useReducedMotionSafe() {\n  const requested = useScopeMotion();\n  const os = useMediaQuery(\"(prefers-reduced-motion: reduce)\");\n  return requested !== \"auto\" || os;\n}\n"},{"path":"beamline/lib/focus.ts","type":"registry:file","target":"src/ui/beamline/lib/focus.ts","content":"/**\n * Keeping a keyboard user's place when something disappears. Removing the element that has focus (a dismissed alert,\n * a removed chip or file, a deleted row) drops focus on <body>, and the next Tab starts at the top of the page.\n */\n\nconst TABBABLE = \"a[href], button, input:not([type=hidden]), select, textarea, [tabindex], [contenteditable=true]\";\n\nfunction tabbables(scope: Element) {\n  // a modal layer (menu, dialog) marks the rest of the page aria-hidden while it is open (data-aria-hidden): that\n  // content is still where focus should land once the layer closes\n  return [...scope.querySelectorAll<HTMLElement>(TABBABLE)].filter(\n    (e) =>\n      e.tabIndex >= 0 &&\n      !e.matches(\":disabled\") &&\n      !e.closest(\"[inert], [aria-hidden=true]:not([data-aria-hidden])\") &&\n      e.getClientRects().length > 0,\n  );\n}\n\n/** The control after `item` in reading order (outside it), or the one before it. */\nfunction neighbour(item: Element, scope: Element) {\n  const all = tabbables(scope).filter((e) => !item.contains(e));\n  return (\n    all.find((e) => item.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_FOLLOWING) ??\n    all.reverse().find((e) => item.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_PRECEDING) ??\n    null\n  );\n}\n\n/**\n * Call just before `item` is removed or hidden: if focus is inside it, focus moves to the next control after it (or\n * the one before). `scope` keeps the search inside a widget (a toolbar, a field); `fallback` is used when the scope has\n * nothing else to focus. Does nothing when focus is elsewhere, so a removal the user did not start never steals focus.\n */\nexport function focusAfterRemoval(\n  item: Element | null | undefined,\n  { scope, fallback }: { scope?: Element | null; fallback?: HTMLElement | null } = {},\n) {\n  if (!item || !item.contains(document.activeElement)) return;\n  (neighbour(item, scope ?? document.body) ?? fallback)?.focus();\n}\n\n/**\n * For an action that may or may not remove its item (the app decides, as with a row's Delete): call before running it.\n * If the item is gone afterwards and focus fell to the page, focus moves to the control that followed it.\n */\nexport function keepPlaceIfRemoved(item: Element | null | undefined, { scope }: { scope?: Element | null } = {}) {\n  if (!item) return;\n  const target = neighbour(item, scope ?? document.body);\n  const check = () => {\n    if (\n      !item.isConnected &&\n      (!document.activeElement || document.activeElement === document.body) &&\n      target?.isConnected\n    )\n      target.focus();\n  };\n  setTimeout(check, 0);\n  setTimeout(check, 400); // after an exit animation\n}\n\n/**\n * A press on a part's surface that hands focus to its control (a slider's well, a mark under its track): call from the\n * pointerdown. Focus goes to `control` without the keyboard's ring (`focusVisible: false`, so the part does not switch\n * to its keyboard look after a click). A mouse press is also followed by the browser's own focus step, which moves\n * focus to the nearest focusable ancestor or the page and leaves the arrow keys dead after the click; that step is\n * cancelled for this one press (and the press selects no text). Cancelling the pointerdown instead would also hide the\n * click from the browser, which then reads the focus as the keyboard's. A control a keyboard user already focused keeps\n * its ring.\n */\nexport function focusFromPress(\n  control: HTMLElement | null | undefined,\n  event: PointerEvent | { nativeEvent: PointerEvent },\n) {\n  if (!control) return;\n  const pointer = \"nativeEvent\" in event ? event.nativeEvent : event;\n  // asserted, not declared globally: shipped source must type-check without this repo's globals.d.ts, on the\n  // TypeScript an app already has (create-next-app installs 5.9, whose DOM lib lacks focusVisible)\n  control.focus({ preventScroll: true, focusVisible: false } as FocusOptions);\n  // the mouse's compatibility events follow the pointerdown in the same task; a finger's arrive only after a tap\n  if (pointer.pointerType !== \"mouse\") return;\n  const cancel = (e: MouseEvent) => e.preventDefault();\n  window.addEventListener(\"mousedown\", cancel, { capture: true, once: true });\n  setTimeout(() => window.removeEventListener(\"mousedown\", cancel, { capture: true }), 0);\n}\n"},{"path":"beamline/lib/gesture.ts","type":"registry:file","target":"src/ui/beamline/lib/gesture.ts","content":"import { readMotionFactor } from \"./motion-tokens\";\n\n/**\n * The arithmetic of a hand on a part, shared by every part that is dragged, thrown or pulled (useDrag is the pointer\n * side). Three pieces, each from how real interfaces feel (Apple, \"Designing Fluid Interfaces\", WWDC 2018):\n *\n * - velocity: read from the last ~100 ms of movement, so the release carries the speed of the flick, not of the whole drag;\n * - projection: where a thrown thing would come to rest if it slid on with the look's carry (`project`), so a part\n *   can decide on release (the nearest value, step or preset to that point) instead of after an animation;\n * - give: past a limit the part follows the hand less and less (`rubberband`) instead of stopping dead, and springs back.\n *\n * How much a part carries and gives is the look's material, read once per gesture from the element (`readHand`):\n * `--m-hand-carry`, `--m-hand-give` and `--m-hand-bounce` (preset-source.css), with `--m-morph-weight` scaling how\n * long things take to settle (times a motion token's duration, which carries the speed setting). Reduced motion\n * carries nothing, gives nothing and never bounces.\n */\n\nexport interface Hand {\n  /** How far a release carries: 0 stops where the hand let go, 1 slides on freely (see `project`). */\n  carry: number;\n  /** How much a part follows the hand past a limit: 0 is a hard stop, 0.55 a phone's rubber band. */\n  give: number;\n  /** Bounce of a released held object (0 critically damped). Only for what the pointer held. */\n  bounce: number;\n  /** The look's weight (`--m-morph-weight`): multiply a motion token's duration by it. The token already carries the\n   *  speed setting, so the weight never does. */\n  weight: number;\n  /** Reduced or no motion: land at once. */\n  reduced: boolean;\n}\n\n/** The hand the defaults describe; also what a server or a test without styles gets. */\nexport const DEFAULT_HAND: Hand = { carry: 0.8, give: 0.45, bounce: 0.14, weight: 1, reduced: false };\n\nconst num = (style: CSSStyleDeclaration, name: string, fallback: number) => {\n  const v = Number.parseFloat(style.getPropertyValue(name));\n  return Number.isFinite(v) ? v : fallback;\n};\n\n/** The look's physics at `el`, read once at the start of a gesture (never per frame). */\nexport function readHand(el: Element | null | undefined): Hand {\n  if (!el || typeof getComputedStyle === \"undefined\") return DEFAULT_HAND;\n  const style = getComputedStyle(el);\n  const factor = readMotionFactor(el);\n  // the motion factor is ~0.005 under reduced motion and 1 at the foundation default\n  const reduced = factor < 0.05;\n  if (reduced) return { carry: 0, give: 0, bounce: 0, weight: 1, reduced: true };\n  return {\n    carry: num(style, \"--m-hand-carry\", DEFAULT_HAND.carry),\n    give: num(style, \"--m-hand-give\", DEFAULT_HAND.give),\n    bounce: num(style, \"--m-hand-bounce\", DEFAULT_HAND.bounce),\n    weight: num(style, \"--m-morph-weight\", 1),\n    reduced: false,\n  };\n}\n\n/** Samples of a pointer's path, kept for the last `window` ms, to read its velocity at release. */\nexport class VelocityTracker {\n  private samples: { t: number; x: number; y: number }[] = [];\n  // a declared field, not a parameter property: shipped source must also compile under erasableSyntaxOnly (Vite's\n  // TypeScript template turns it on), where TypeScript-only syntax with runtime meaning is refused\n  private readonly window: number;\n  constructor(window = 100) {\n    this.window = window;\n  }\n\n  add(t: number, x: number, y: number) {\n    this.samples.push({ t, x, y });\n    const from = t - this.window;\n    while (this.samples.length > 2 && this.samples[0].t < from) this.samples.shift();\n  }\n\n  /** Units per second over the kept window; 0 when the hand stopped before letting go (a pause of more than the window). */\n  velocity(now = this.samples.at(-1)?.t ?? 0): [number, number] {\n    const s = this.samples.filter((p) => p.t >= now - this.window);\n    if (s.length < 2) return [0, 0];\n    // least squares slope over the window: one jittery last sample does not decide the throw\n    const n = s.length;\n    const mt = s.reduce((a, p) => a + p.t, 0) / n;\n    const mx = s.reduce((a, p) => a + p.x, 0) / n;\n    const my = s.reduce((a, p) => a + p.y, 0) / n;\n    let tt = 0;\n    let tx = 0;\n    let ty = 0;\n    for (const p of s) {\n      tt += (p.t - mt) ** 2;\n      tx += (p.t - mt) * (p.x - mx);\n      ty += (p.t - mt) * (p.y - my);\n    }\n    if (tt === 0) return [0, 0];\n    return [(tx / tt) * 1000, (ty / tt) * 1000];\n  }\n\n  reset() {\n    this.samples = [];\n  }\n}\n\n/**\n * How far something released at `velocity` (units/s) slides before friction stops it, with the look's carry. `rate` is\n * the speed kept per millisecond: 0.99 (the default) suits controls on a short scale (a thumb, a puck, a cut), where a\n * flick should carry a little way; 0.998 is a phone list's deceleration, for long scrolling content.\n */\nexport function project(velocity: number, carry: number, rate = 0.99): number {\n  if (carry <= 0) return 0;\n  return (((velocity / 1000) * rate) / (1 - rate)) * carry;\n}\n\n/**\n * Where a part drawn `overshoot` units past its limit sits, given the room `extent` it moves in: it follows less and\n * less the further it goes and never reaches `extent`. `give` 0 is a hard stop.\n */\nexport function rubberband(overshoot: number, extent: number, give: number): number {\n  if (give <= 0 || extent <= 0) return 0;\n  const sign = Math.sign(overshoot);\n  const x = Math.abs(overshoot);\n  return sign * (1 - 1 / ((x * give) / extent + 1)) * extent;\n}\n\n/** `value` held inside [min, max], with the part's give past either end. */\nexport function within(value: number, min: number, max: number, extent: number, give: number): number {\n  if (value < min) return min + rubberband(value - min, extent, give);\n  if (value > max) return max + rubberband(value - max, extent, give);\n  return value;\n}\n\n/** The nearest of `stops` to `value` (a projected landing point picks its step or preset this way). */\nexport function nearest(value: number, stops: readonly number[]): number {\n  let best = stops[0];\n  for (const s of stops) if (Math.abs(s - value) < Math.abs(best - value)) best = s;\n  return best;\n}\n"},{"path":"beamline/lib/id.ts","type":"registry:file","target":"src/ui/beamline/lib/id.ts","content":"let sequence = 0;\n\n/** An id for something made here and now (a sent message, a dropped file, a toast, a new rule): unique within the page\n *  and across reloads, short, and safe in a selector. For an id that must match on the server and the client, useId. */\nexport const localId = (prefix: string) => `${prefix}-${Date.now().toString(36)}${(++sequence).toString(36)}`;\n"},{"path":"beamline/lib/number.ts","type":"registry:file","target":"src/ui/beamline/lib/number.ts","content":"import { createFormatters, FALLBACK_LOCALE } from \"../runtime/messages\";\n/** Reads a number typed in `locale` (\"1.234,5\" in de, \"1,234.5\" in en): group separators dropped, the locale's decimal\n *  mark read as the point, currency signs and units ignored. Empty or unreadable text is null; nothing is clamped. */\nexport function parseLocaleNumber(text: string, locale?: string): number | null {\n  if (!text.trim()) return null;\n  // exponent form: \"1e3\" is a thousand and \"2.5e-3\" a fraction (the digits are never run together into 13)\n  const exp = text.trim().match(/^(.*\\d)\\s*e\\s*([+\\u2212-]?\\d+)$/i);\n  if (exp) {\n    const base = parseLocaleNumber(exp[1], locale);\n    return base === null ? null : Number((base * 10 ** Number(exp[2].replace(\"\\u2212\", \"-\"))).toPrecision(15));\n  }\n  const parts = new Intl.NumberFormat(locale).formatToParts(12345.6);\n  const group = parts.find((p) => p.type === \"group\")?.value ?? \",\";\n  const decimal = parts.find((p) => p.type === \"decimal\")?.value ?? \".\";\n  let ascii = text;\n  // one grouping mark that cannot group (not three digits after it) and no decimal mark: the decimal was written the\n  // other locale's way (\"1,5\" in English is one and a half, never fifteen)\n  const marks = text.split(group).length - 1;\n  if (marks === 1 && !text.includes(decimal) && !new RegExp(`\\\\${group}\\\\d{3}(?!\\\\d)`).test(text))\n    ascii = text.replace(group, decimal);\n  if (/[^\\p{ASCII}]/u.test(text)) {\n    const digits = new Intl.NumberFormat(locale, { useGrouping: false });\n    for (let value = 0; value < 10; value++) ascii = ascii.replaceAll(digits.format(value), String(value));\n  }\n  const normalized = ascii\n    .replaceAll(group, \"\")\n    .replaceAll(\"\\u202f\", \"\")\n    .replace(decimal, \".\")\n    .replace(/[\\u2212\\u2013]/g, \"-\")\n    .replace(/[^\\d.-]/g, \"\");\n  if (!/\\d/.test(normalized)) return null;\n  const n = Number(normalized);\n  return Number.isFinite(n) ? n : null;\n}\n\nconst formatters = new Map<string, Intl.NumberFormat>();\n/** A number written from serializable settings, so a server component can pass them where a `format` function cannot\n *  cross: Intl options in a locale, with words before and after (\"$\" … \" / mo\"). One Intl.NumberFormat per setting. */\nexport function formatNumber(\n  value: number,\n  { locale, formatOptions, prefix = \"\", suffix = \"\" }: NumberFormatSettings = {},\n): string {\n  const key = `${locale ?? \"\"}|${JSON.stringify(formatOptions ?? {})}`;\n  let f = formatters.get(key);\n  if (!f) formatters.set(key, (f = new Intl.NumberFormat(locale, formatOptions)));\n  return `${prefix}${f.format(value)}${suffix}`;\n}\n\nexport interface NumberFormatSettings {\n  locale?: string;\n  formatOptions?: Intl.NumberFormatOptions;\n  /** Written before the number: \"$\". */\n  prefix?: string;\n  /** Written after the number: \" ms\", \" / mo\". */\n  suffix?: string;\n}\n\n/** Binary-scaled file sizes; the digits and unit names follow the supplied locale. */\nexport function formatByteSize(bytes: number, locale = FALLBACK_LOCALE, maximumUnit = 3, fractionDigits?: number) {\n  const units = [\"byte\", \"kilobyte\", \"megabyte\", \"gigabyte\"];\n  let value = bytes,\n    unit = 0;\n  while (value >= 1024 && unit < maximumUnit) {\n    value /= 1024;\n    unit++;\n  }\n  const digits = fractionDigits ?? (value < 10 && unit > 0 ? 1 : 0);\n  return createFormatters(locale).number(value, {\n    style: \"unit\",\n    unit: units[unit],\n    unitDisplay: \"short\",\n    minimumFractionDigits: digits,\n    maximumFractionDigits: digits,\n  });\n}\n"},{"path":"beamline/lib/utils.ts","type":"registry:file","target":"src/ui/beamline/lib/utils.ts","content":"import { clsx, type ClassValue } from \"clsx\";\nimport { extendTailwindMerge } from \"tailwind-merge\";\n\n/* The type roles (utilities.css) and the 2xs step are sizes, not text colours: without this, tailwind-merge reads\n   `text-overline` as a colour and drops it next to `text-ink-3`. A role and a size step still replace each other.\n   Likewise `font-title` is the look's title weight, not a family: read as a family it dropped `font-display` beside it,\n   and every merged page title lost the look's display face. */\nconst twMerge = extendTailwindMerge({\n  extend: {\n    classGroups: {\n      \"font-weight\": [{ font: [\"title\"] }],\n      \"font-family\": [{ font: [\"display\", \"numeric\", \"figure\"] }],\n      \"font-size\": [\n        {\n          text: [\n            \"2xs\",\n            \"display\",\n            \"title\",\n            \"heading\",\n            \"subheading\",\n            \"body\",\n            \"body-sm\",\n            \"reading\",\n            \"label\",\n            \"caption\",\n            \"overline\",\n            \"numeric\",\n            \"code\",\n          ],\n        },\n      ],\n    },\n  },\n});\n\n/** Merge class names, letting later Tailwind utilities win over earlier ones. */\nexport function cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\n/** A small seeded random generator (LCG): the same seed gives the same sequence, for stable sample data and jitter. */\nexport function rng(seed = 1) {\n  let s = seed >>> 0 || 1;\n  return () => (s = (s * 1664525 + 1013904223) >>> 0) / 2 ** 32;\n}\n\nexport const clamp = (value: number, min: number, max: number) => Math.min(max, Math.max(min, value));\n"}],"docs":"Comment thread is in src/ui/beamline/components/comment-thread/comment-thread.tsx. The source is in src/ui/beamline (ui/beamline in a project without src/). After Tailwind, import its styles/beamline.css once, then styles/look-prism.css in your app stylesheet (use relative paths). Keep the shared base before all chosen looks. Wrap your app in <UIRoot preset={prism}> with UIRoot from its runtime/appearance and prism from its looks/prism.  shadcn replaces files when asked; use the Beamline managed-source CLI from the start for three-way upgrades that preserve edits.","meta":{"free":true,"version":"0.2.0-rc.42","library":"https://beamline.io/components/comment-thread"}}