{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ide",
  "title": "IDE",
  "author": "superzero11 <https://github.com/superzero11/uiset>",
  "description": "A code editor's parts on UI SDK: a file tree on Tree with version control marks and New, Rename, Move and Delete; editor tabs on Tabs; a code editor with syntax colors, indenting and problems; a command palette on Command; problems and a status bar.",
  "dependencies": [
    "@ui-sdk/core@0.1.0-beta.5",
    "@ui-sdk/react@0.1.0-beta.5",
    "shiki@4.6.0"
  ],
  "registryDependencies": [
    "https://uiset.dev/r/uiset.json",
    "https://uiset.dev/r/alert-dialog.json",
    "https://uiset.dev/r/button.json",
    "https://uiset.dev/r/command.json",
    "https://uiset.dev/r/dialog.json",
    "https://uiset.dev/r/field.json",
    "https://uiset.dev/r/menu.json",
    "https://uiset.dev/r/select.json",
    "https://uiset.dev/r/tabs.json",
    "https://uiset.dev/r/textarea.json",
    "https://uiset.dev/r/tree.json"
  ],
  "files": [
    {
      "path": "registry/uiset/ui/ide.tsx",
      "content": "\"use client\"\n\nimport { announce, createUndoStack, matchesShortcut } from \"@ui-sdk/core\"\nimport { fuzzyScore, matchRanges, matchSegments } from \"@ui-sdk/core/text-match\"\nimport { flushSync } from \"react-dom\"\nimport {\n  memo,\n  useEffect,\n  useId,\n  useImperativeHandle,\n  useLayoutEffect,\n  useMemo,\n  useRef,\n  useState,\n  type KeyboardEvent as ReactKeyboardEvent,\n  type ReactNode,\n  type Ref,\n} from \"react\"\nimport {\n  AlertDialog,\n  AlertDialogBackdrop,\n  AlertDialogClose,\n  AlertDialogContent,\n  AlertDialogDescription,\n  AlertDialogTitle,\n} from \"./alert-dialog\"\nimport { Button } from \"./button\"\nimport { Command, CommandEmpty, CommandInput, CommandItem, CommandList, CommandShortcut, type CommandData } from \"./command\"\nimport {\n  Dialog,\n  DialogBackdrop,\n  DialogClose,\n  DialogContent,\n  DialogDescription,\n  DialogTitle,\n  DialogTrigger,\n  createDialogController,\n} from \"./dialog\"\nimport { Field, FieldError, FieldLabel, Input } from \"./field\"\nimport { Menu, MenuContent, MenuItem, MenuSeparator, MenuTrigger } from \"./menu\"\nimport { Select, SelectContent, SelectItem, SelectLabel, SelectTrigger } from \"./select\"\nimport { Icon } from \"./shell/icons\"\nimport { Tabs, TabsList, TabsPanel, TabsTab } from \"./tabs\"\nimport { Textarea } from \"./textarea\"\nimport {\n  Tree,\n  TreeGroup,\n  TreeItem,\n  TreeItemIndicator,\n  TreeItemLabel,\n  createTreeController,\n  treeFromPaths,\n  visibleTreeRows,\n  type TreeController,\n  type TreeItemData,\n} from \"./tree\"\nimport { languageOf, tokenize, type Token } from \"./code/highlight\"\nimport { indent, lineCol, moveLines, newline, offsetOf, outdent, type Edit, type Problem } from \"./ide/editing\"\nimport \"./shell/shell.css\"\nimport \"./code/code.css\"\nimport \"./ide/ide.css\"\nimport { returnFocus } from \"./uiset/focus\"\n\nconst baseName = (path: string) => path.split(\"/\").pop() ?? path\nconst dirName = (path: string) => path.split(\"/\").slice(0, -1).join(\"/\")\n\n/* ------------------------------------------------------------------ File tree */\n\ntype FileStatus = \"modified\" | \"added\" | \"deleted\" | \"untracked\" | \"conflict\"\n\nconst statusMark: Record<FileStatus, [string, string]> = {\n  modified: [\"M\", \"modified\"],\n  added: [\"A\", \"added\"],\n  deleted: [\"D\", \"deleted\"],\n  untracked: [\"U\", \"untracked\"],\n  conflict: [\"!\", \"has conflicts\"],\n}\n\ntype FileTreeProps = {\n  /** The tree's name, like \"Files\". */\n  label: string\n  /** Every file's path; a path ending in \"/\" is an empty folder. */\n  paths: string[]\n  value?: string | null\n  defaultValue?: string | null\n  onValueChange?: (path: string | null) => void\n  /** Enter or a click on a file. */\n  onOpen?: (path: string) => void\n  /** Version control marks, by path. Folders show when anything inside them changed. */\n  status?: Record<string, FileStatus>\n  defaultExpanded?: string[]\n  /** Creates a file or folder at a path; return a message to refuse it. */\n  onCreate?: (path: string, kind: \"file\" | \"folder\") => string | void\n  /** Renames a file or folder; return a message to refuse it. */\n  onRename?: (from: string, to: string) => string | void\n  /** Moves a file or folder into a folder (\"\" for the top); return a message to refuse it. */\n  onMove?: (from: string, toFolder: string) => string | void\n  onDelete?: (path: string) => void\n  /** Drives the tree from elsewhere: `createTreeController()`. */\n  controller?: TreeController\n  /** The level of the pane's heading, to fit the page's outline. */\n  headingLevel?: 2 | 3 | 4 | 5 | 6\n  className?: string\n}\n\ntype NameDialog = { mode: \"file\" | \"folder\" | \"rename\" | \"move\"; path: string }\n\n/** The tree's rows, defined once so a re-render keeps every item, and the focused one. */\nfunction FileItems({\n  list,\n  folders,\n  status,\n  changed,\n}: {\n  list: TreeItemData[]\n  folders: Set<string>\n  status: Record<string, FileStatus>\n  changed: Set<string>\n}) {\n  return list.map((item) => {\n    const branch = folders.has(item.value)\n    const mark = status[item.value]\n    // The mark is a letter on screen; its name says it in words, after the file's name.\n    const note = mark ? `, ${statusMark[mark][1]}` : branch && changed.has(item.value) ? \", has changes\" : \"\"\n    return (\n      <TreeItem key={item.value} value={item.value} label={item.label} className=\"ide-tree-item\" data-status={mark} data-path={item.value}>\n        {/* The item takes its name from its label part. */}\n        <TreeItemLabel className=\"ide-tree-label\" aria-label={note ? `${item.label}${note}` : undefined}>\n          {branch ? (\n            <TreeItemIndicator className=\"ide-tree-chevron\">\n              <Icon name=\"chevron\" />\n            </TreeItemIndicator>\n          ) : (\n            <span className=\"ide-tree-chevron\" />\n          )}\n          <Icon name={branch ? \"folder\" : \"file\"} className=\"ide-tree-icon\" />\n          <span className=\"ide-tree-name\">{item.label}</span>\n          {mark ? (\n            <span className=\"ide-tree-mark\" aria-hidden=\"true\">\n              {statusMark[mark][0]}\n            </span>\n          ) : branch && changed.has(item.value) ? (\n            <span className=\"ide-tree-dot\" aria-hidden=\"true\" />\n          ) : null}\n        </TreeItemLabel>\n        {item.children && (\n          <TreeGroup>\n            <FileItems list={item.children} folders={folders} status={status} changed={changed} />\n          </TreeGroup>\n        )}\n      </TreeItem>\n    )\n  })\n}\n\n/**\n * A project's files on UI SDK's Tree: folders first, version control marks, and New file,\n * New folder, Rename (F2), Move and Delete (Delete key) for the selected item.\n */\nfunction FileTree({\n  label,\n  paths,\n  value,\n  defaultValue = null,\n  onValueChange,\n  onOpen,\n  status = {},\n  defaultExpanded,\n  onCreate,\n  onRename,\n  onMove,\n  onDelete,\n  controller,\n  headingLevel = 2,\n  className,\n}: FileTreeProps) {\n  const Heading = `h${headingLevel}` as \"h2\"\n  const titleId = useId()\n  const [own, setOwn] = useState<string | null>(defaultValue)\n  const selected = value === undefined ? own : value\n  const select = (path: string | null) => {\n    if (value === undefined) setOwn(path)\n    onValueChange?.(path)\n  }\n  const [tree] = useState(() => controller ?? createTreeController())\n  // Folders first, then names without regard to case, as file managers sort.\n  const items = treeFromPaths([...paths].sort((a, b) => a.localeCompare(b, undefined, { sensitivity: \"base\" })))\n  const files = new Set(paths.filter((p) => !p.endsWith(\"/\")))\n  const folders = new Set<string>()\n  for (const p of paths) {\n    const parts = p.replace(/\\/$/, \"\").split(\"/\")\n    for (let i = 1; i < (p.endsWith(\"/\") ? parts.length + 1 : parts.length); i++) folders.add(parts.slice(0, i).join(\"/\"))\n  }\n  const isFolder = (path: string) => folders.has(path)\n  const changedFolders = new Set<string>()\n  for (const p of Object.keys(status)) {\n    const parts = p.split(\"/\")\n    for (let i = 1; i < parts.length; i++) changedFolders.add(parts.slice(0, i).join(\"/\"))\n  }\n  const [dialog, setDialog] = useState<NameDialog | null>(null)\n  const [deleting, setDeleting] = useState<string | null>(null)\n  const [error, setError] = useState<string | null>(null)\n  // Focus follows a new, renamed or moved item once the tree has rendered it.\n  const reveal = useRef<string | null>(null)\n  useEffect(() => {\n    const path = reveal.current\n    if (!path || !(files.has(path) || folders.has(path))) return\n    reveal.current = null\n    // A frame later, after a closing dialog has handed focus back to its trigger.\n    const frame = requestAnimationFrame(() => tree.reveal(path))\n    return () => cancelAnimationFrame(frame)\n  })\n\n  const folderOf = (path: string | null) => (!path ? \"\" : isFolder(path) ? path : dirName(path))\n  const join = (folder: string, name: string) => (folder ? `${folder}/${name}` : name)\n  const exists = (path: string) => files.has(path) || folders.has(path)\n  const neighbor = (path: string) => {\n    const rows = visibleTreeRows(items, tree.getExpanded()).map((row) => row.item.value)\n    const at = rows.indexOf(path)\n    return rows.slice(at + 1).find((v) => !v.startsWith(`${path}/`)) ?? rows.slice(0, Math.max(0, at)).at(-1) ?? null\n  }\n\n  const submit = (name: string, to?: string) => {\n    if (!dialog) return\n    const clean = name.trim()\n    if (dialog.mode !== \"move\") {\n      if (!clean) return setError(\"Give it a name.\")\n      if (/[/\\\\]/.test(clean)) return setError(\"A name can't have slashes.\")\n    }\n    const target =\n      dialog.mode === \"rename\"\n        ? join(dirName(dialog.path), clean)\n        : dialog.mode === \"move\"\n          ? join(to ?? \"\", baseName(dialog.path))\n          : join(dialog.path, clean)\n    if (target === dialog.path) return setDialog(null)\n    if (exists(target)) return setError(`${baseName(target)} already exists there.`)\n    const refused =\n      dialog.mode === \"rename\"\n        ? onRename?.(dialog.path, target)\n        : dialog.mode === \"move\"\n          ? onMove?.(dialog.path, to ?? \"\")\n          : onCreate?.(target, dialog.mode)\n    if (refused) return setError(refused)\n    setError(null)\n    setDialog(null)\n    reveal.current = target\n    select(target)\n  }\n\n  // F2 and Delete act on the item with focus, which can differ from the selection.\n  const keyDown = (event: ReactKeyboardEvent) => {\n    const target = event.target as HTMLElement\n    if (target.closest(\"input, textarea\")) return\n    const path = target.closest<HTMLElement>(\"[data-path]\")?.dataset.path\n    if (!path) return\n    if (event.key === \"F2\" && onRename) {\n      event.preventDefault()\n      setDialog({ mode: \"rename\", path })\n    } else if ((event.key === \"Delete\" || (event.key === \"Backspace\" && event.metaKey)) && onDelete) {\n      event.preventDefault()\n      setDeleting(path)\n    }\n  }\n\n  const canEdit = onCreate || onRename || onMove || onDelete\n  const allFolders = [\"\", ...[...folders].sort()]\n\n  return (\n    <section className={[\"ide-files\", className].filter(Boolean).join(\" \")} aria-labelledby={titleId}>\n      <div className=\"ide-pane-header\">\n        <Heading id={titleId} className=\"ide-pane-title\">\n          {label}\n        </Heading>\n        {canEdit && (\n          <div className=\"ide-pane-actions\">\n            {onCreate && (\n              <>\n                <Button variant=\"ghost\" aria-label=\"New file\" onClick={() => setDialog({ mode: \"file\", path: folderOf(selected) })}>\n                  <Icon name=\"file\" />\n                </Button>\n                <Button variant=\"ghost\" aria-label=\"New folder\" onClick={() => setDialog({ mode: \"folder\", path: folderOf(selected) })}>\n                  <Icon name=\"folder\" />\n                </Button>\n              </>\n            )}\n            {/* Menu items run through the menu's onAction: Enter, Space or a click. */}\n            <Menu\n              onAction={(action: unknown) => {\n                if (action === \"collapse\") tree.collapseAll()\n                else if (!selected) return\n                else if (action === \"rename\") setDialog({ mode: \"rename\", path: selected })\n                else if (action === \"move\") setDialog({ mode: \"move\", path: selected })\n                else if (action === \"copy\") void navigator.clipboard?.writeText(selected)\n                else if (action === \"delete\") setDeleting(selected)\n              }}\n            >\n              <MenuTrigger data-variant=\"ghost\" aria-label={`More file actions${selected ? ` for ${baseName(selected)}` : \"\"}`}>\n                <Icon name=\"more\" />\n              </MenuTrigger>\n              <MenuContent>\n                {onRename && (\n                  <MenuItem value=\"rename\" disabled={!selected}>\n                    Rename… <span className=\"ide-menu-key\">F2</span>\n                  </MenuItem>\n                )}\n                {onMove && (\n                  <MenuItem value=\"move\" disabled={!selected}>\n                    Move to…\n                  </MenuItem>\n                )}\n                <MenuItem value=\"copy\" disabled={!selected}>\n                  Copy path\n                </MenuItem>\n                <MenuItem value=\"collapse\">Collapse folders</MenuItem>\n                {onDelete && (\n                  <>\n                    <MenuSeparator />\n                    <MenuItem value=\"delete\" destructive disabled={!selected}>\n                      Delete…\n                    </MenuItem>\n                  </>\n                )}\n              </MenuContent>\n            </Menu>\n          </div>\n        )}\n      </div>\n      <Tree\n        aria-labelledby={titleId}\n        className=\"ide-tree\"\n        items={items}\n        controller={tree}\n        value={selected}\n        onValueChange={(next, details) => {\n          select(next as string | null)\n          // An agent's choice of a file opens it, as Enter or a click would for a person.\n          if (details?.reason === \"imperative\" && typeof next === \"string\" && files.has(next)) onOpen?.(next)\n        }}\n        activation=\"automatic\"\n        defaultExpanded={defaultExpanded}\n        onAction={(path) => {\n          if (files.has(path)) onOpen?.(path)\n        }}\n        onKeyDown={keyDown}\n      >\n        <FileItems list={items} folders={folders} status={status} changed={changedFolders} />\n      </Tree>\n\n      <Dialog open={dialog !== null} onOpenChange={(open: boolean) => !open && (setDialog(null), setError(null))}>\n        <DialogBackdrop />\n        <DialogContent className=\"ide-dialog\">\n          {dialog && (\n            <form\n              key={`${dialog.mode}:${dialog.path}`}\n              className=\"ide-dialog-form\"\n              aria-labelledby={`${titleId}-dialog`}\n              onSubmit={(event) => {\n                event.preventDefault()\n                const data = new FormData(event.currentTarget)\n                submit(String(data.get(\"name\") ?? \"\"), String(data.get(\"folder\") ?? \"\"))\n              }}\n            >\n              <DialogTitle id={`${titleId}-dialog`}>\n                {dialog.mode === \"file\"\n                  ? \"New file\"\n                  : dialog.mode === \"folder\"\n                    ? \"New folder\"\n                    : dialog.mode === \"rename\"\n                      ? `Rename ${baseName(dialog.path)}`\n                      : `Move ${baseName(dialog.path)}`}\n              </DialogTitle>\n              <DialogDescription>\n                {dialog.mode === \"move\" ? `From ${dirName(dialog.path) || \"the top\"}.` : `In ${(dialog.mode === \"rename\" ? dirName(dialog.path) : dialog.path) || \"the top folder\"}.`}\n              </DialogDescription>\n              {dialog.mode === \"move\" ? (\n                <Field name=\"folder\">\n                  <Select name=\"folder\" defaultValue={dirName(dialog.path)}>\n                    <SelectLabel>Folder</SelectLabel>\n                    <SelectTrigger />\n                    <SelectContent>\n                      {allFolders\n                        .filter((f) => f !== dialog.path && !f.startsWith(`${dialog.path}/`))\n                        .map((f) => (\n                          <SelectItem key={f || \"top\"} value={f}>\n                            {f || \"Top folder\"}\n                          </SelectItem>\n                        ))}\n                    </SelectContent>\n                  </Select>\n                </Field>\n              ) : (\n                <Field name=\"name\" invalid={error ? true : undefined}>\n                  <FieldLabel>Name</FieldLabel>\n                  <Input\n                    required\n                    autoFocus\n                    autoComplete=\"off\"\n                    spellCheck={false}\n                    defaultValue={dialog.mode === \"rename\" ? baseName(dialog.path) : \"\"}\n                    placeholder={dialog.mode === \"folder\" ? \"components\" : \"index.ts\"}\n                    onChange={() => setError(null)}\n                  />\n                  <FieldError match=\"valueMissing\">Give it a name.</FieldError>\n                  {error && <FieldError>{error}</FieldError>}\n                </Field>\n              )}\n              {dialog.mode === \"move\" && error && (\n                <p className=\"ide-error\" role=\"alert\">\n                  {error}\n                </p>\n              )}\n              <div className=\"ide-dialog-actions\">\n                <DialogClose>Cancel</DialogClose>\n                <Button type=\"submit\">\n                  {dialog.mode === \"rename\" ? \"Rename\" : dialog.mode === \"move\" ? \"Move\" : \"Create\"}\n                </Button>\n              </div>\n            </form>\n          )}\n        </DialogContent>\n      </Dialog>\n\n      <AlertDialog open={deleting !== null} onOpenChange={(open: boolean) => !open && setDeleting(null)}>\n        <AlertDialogBackdrop />\n        <AlertDialogContent>\n          <AlertDialogTitle>Delete {deleting ? baseName(deleting) : \"\"}?</AlertDialogTitle>\n          <AlertDialogDescription>\n            {deleting && isFolder(deleting) ? \"The folder goes with everything in it.\" : \"It can't be brought back here.\"}\n          </AlertDialogDescription>\n          <div className=\"ide-dialog-actions\">\n            <AlertDialogClose>Keep it</AlertDialogClose>\n            <AlertDialogClose\n              data-variant=\"destructive\"\n              data-agent-confirm={`Deletes ${deleting ?? \"the file\"}`}\n              onClick={() => {\n                if (!deleting) return\n                const next = neighbor(deleting)\n                onDelete?.(deleting)\n                announce(`Deleted ${baseName(deleting)}.`)\n                select(next)\n                reveal.current = next\n              }}\n            >\n              Delete\n            </AlertDialogClose>\n          </div>\n        </AlertDialogContent>\n      </AlertDialog>\n    </section>\n  )\n}\n\n/* ---------------------------------------------------------------- Editor tabs */\n\ntype EditorFile = { path: string; dirty?: boolean }\n\n/** The tab that takes over when `path` closes: the one after it, else the one before. */\nfunction nextTab(paths: string[], path: string) {\n  const at = paths.indexOf(path)\n  return paths[at + 1] ?? paths[at - 1] ?? null\n}\n\n/**\n * Open files as tabs on UI SDK's Tabs. Delete on a tab, a middle click or its × asks to\n * close it through `onClose`, which may refuse (to ask about unsaved changes first); once\n * the file leaves `files`, focus goes to the tab that took over, or to the empty pane.\n * Every open file keeps its own panel, so an editor keeps its caret, scroll and undo.\n */\nfunction EditorTabs({\n  label = \"Open files\",\n  files,\n  value,\n  onValueChange,\n  onClose,\n  children,\n  empty,\n  className,\n}: {\n  label?: string\n  files: EditorFile[]\n  value: string | null\n  onValueChange: (path: string) => void\n  /** Asks to close a file. Remove it from `files` (and pick the next `value`, see `nextTab`) to close it. */\n  onClose: (path: string) => void\n  /** A file's content, like a CodeEditor; rendered for every open file and kept while hidden. */\n  children: (path: string) => ReactNode\n  /** Shown with no files open. */\n  empty?: ReactNode\n  className?: string\n}) {\n  const tabs = useRef(new Map<string, HTMLElement>())\n  const emptyPane = useRef<HTMLDivElement>(null)\n  const closing = useRef<string | null>(null)\n  const names = new Map<string, number>()\n  for (const f of files) names.set(baseName(f.path), (names.get(baseName(f.path)) ?? 0) + 1)\n  // The tab shown: the chosen one while it's open, else the first.\n  const current = value && files.some((f) => f.path === value) ? value : (files[0]?.path ?? null)\n  const close = (path: string) => {\n    closing.current = path\n    onClose(path)\n  }\n  // Once a closed file has gone, focus the tab that took over, or the empty pane. A close\n  // that was refused (a dialog asking first) leaves focus to that dialog.\n  useEffect(() => {\n    const gone = closing.current\n    if (!gone || files.some((f) => f.path === gone)) return\n    closing.current = null\n    returnFocus(() => (current ? tabs.current.get(current) : emptyPane.current) ?? undefined)\n  })\n  if (!files.length)\n    return (\n      <div ref={emptyPane} tabIndex={-1} className={[\"ide-editor-empty\", className].filter(Boolean).join(\" \")}>\n        {empty}\n      </div>\n    )\n  return (\n    <Tabs\n      className={[\"ide-tabs\", className].filter(Boolean).join(\" \")}\n      // The agent bridge names tabs from their root in the browser; the list names them for people.\n      aria-label={label}\n      value={current}\n      onValueChange={(next: unknown) => onValueChange(String(next))}\n    >\n      <TabsList className=\"ide-tab-list\" aria-label={label}>\n        {files.map((file) => {\n          const name = baseName(file.path)\n          const twin = (names.get(name) ?? 0) > 1\n          return (\n            <span key={file.path} className=\"ide-tab\" role=\"presentation\" data-dirty={file.dirty ? \"\" : undefined}>\n              <TabsTab\n                value={file.path}\n                ref={(el: HTMLElement | null) => {\n                  if (el) tabs.current.set(file.path, el)\n                  else tabs.current.delete(file.path)\n                }}\n                className=\"ide-tab-button\"\n                title={file.path}\n                // Visible text first, then what the dot means.\n                aria-label={`${name}${twin ? ` ${dirName(file.path)}` : \"\"}${file.dirty ? \", unsaved\" : \"\"}`}\n                onKeyDown={(event: ReactKeyboardEvent) => {\n                  if (event.key === \"Delete\") {\n                    event.preventDefault()\n                    close(file.path)\n                  }\n                }}\n                onAuxClick={(event: React.MouseEvent) => {\n                  if (event.button === 1) close(file.path)\n                }}\n              >\n                <Icon name=\"file\" className=\"ide-tab-icon\" />\n                <span className=\"ide-tab-name\">{name}</span>\n                {twin && <span className=\"ide-tab-dir\">{dirName(file.path)}</span>}\n              </TabsTab>\n              {/* The keyboard closes a tab with Delete; this button is for the pointer, and never takes focus. */}\n              <button\n                type=\"button\"\n                className=\"ide-tab-close\"\n                tabIndex={-1}\n                aria-hidden=\"true\"\n                title={`Close ${name}`}\n                onPointerDown={(event) => event.preventDefault()}\n                onClick={() => close(file.path)}\n              >\n                <Icon name=\"close\" />\n              </button>\n            </span>\n          )\n        })}\n      </TabsList>\n      {files.map((file) => (\n        <TabsPanel key={file.path} value={file.path} className=\"ide-tab-panel\" keepMounted>\n          {children(file.path)}\n        </TabsPanel>\n      ))}\n    </Tabs>\n  )\n}\n\n/* ---------------------------------------------------------------- Code editor */\n\n\ntype CodeEditorHandle = {\n  focus(): void\n  /** Puts the caret at a line and column (from 1) and scrolls it into view. */\n  goTo(line: number, col?: number): void\n}\n\ntype CodeEditorProps = {\n  /** The editor's name, like the file's path. */\n  label: string\n  value?: string\n  defaultValue?: string\n  onValueChange?: (value: string) => void\n  /** For syntax colors: a path (\"app.tsx\") or a language (\"tsx\"). */\n  path?: string\n  language?: string\n  readOnly?: boolean\n  /** Spaces per indent. */\n  tabSize?: number\n  /** Where the caret is: on every move, on focus, and when it mounts. */\n  onCursorChange?: (cursor: { line: number; col: number }) => void\n  /** This file's problems: marked in the gutter; F8 and Shift+F8 go between them. */\n  problems?: Problem[]\n  ref?: Ref<CodeEditorHandle>\n  className?: string\n}\n\nconst LINE = 20 // px: --code-line in ide.css\nconst PAD = 12 // px: --code-pad\n\nconst glyph = { error: \"●\", warning: \"▲\", info: \"■\" } as const\n\n/** The colored text, memoized so caret moves don't redraw it. */\nconst CodeColors = memo(function CodeColors({ lines, colored }: { lines: string[]; colored: Map<string, Token[]> | null }) {\n  return (\n    <pre className=\"ide-code-colors\" aria-hidden=\"true\">\n      {lines.map((line, i) => {\n        // Lines whose tokens are known keep their colors while an edit is being colored.\n        const tokens = colored?.get(line)\n        return (\n          <span key={i} className=\"ide-code-line\">\n            {tokens\n              ? tokens.map((token, j) => (\n                  <span key={j} style={token.color ? { color: token.color } : undefined}>\n                    {token.content}\n                  </span>\n                ))\n              : line}\n            {\"\\n\"}\n          </span>\n        )\n      })}\n    </pre>\n  )\n})\n\nconst CodeGutter = memo(function CodeGutter({ count, marks }: { count: number; marks: Map<number, Problem[\"severity\"]> }) {\n  return (\n    <div className=\"ide-code-gutter\" aria-hidden=\"true\">\n      {Array.from({ length: count }, (_, i) => {\n        const mark = marks.get(i + 1)\n        return (\n          <span key={i} className=\"ide-code-number\" data-problem={mark}>\n            {mark && <span className=\"ide-code-mark\">{glyph[mark]}</span>}\n            {i + 1}\n          </span>\n        )\n      })}\n    </div>\n  )\n})\n\n/**\n * A code editor on a native textarea (UI SDK's Textarea, so agents can read and write it)\n * with line numbers and syntax colors drawn behind the text. Tab indents and Shift+Tab\n * outdents; press Escape first to let Tab leave the editor. Enter keeps the indent.\n */\nfunction CodeEditor({\n  label,\n  value,\n  defaultValue = \"\",\n  onValueChange,\n  path,\n  language,\n  readOnly = false,\n  tabSize = 2,\n  onCursorChange,\n  problems = [],\n  ref,\n  className,\n}: CodeEditorProps) {\n  const hintId = useId()\n  const [own, setOwn] = useState(value ?? defaultValue)\n  const text = value ?? own\n  // React writes a changed defaultValue into the textarea's own text node, which ends the\n  // browser's undo step; the first text is the only one it's given.\n  const [initial] = useState(text)\n  const input = useRef<HTMLTextAreaElement>(null)\n  const scroller = useRef<HTMLDivElement>(null)\n  const bar = useRef<HTMLDivElement>(null)\n  const escaped = useRef(false)\n  const unit = \" \".repeat(tabSize)\n  const lang = language ?? (path ? languageOf(path) : undefined)\n\n  // The textarea keeps its own text, so the browser's typing and undo stay whole: React\n  // writing to the page during an input event would end the undo step at every key. New\n  // text reaches the app a frame later; text the app changes is written back here.\n  const pending = useRef<number | null>(null)\n  // The texts this editor sent up and hasn't seen back: when one comes back as `value`,\n  // it's an echo, not news, even if renders lag behind the typing.\n  const sent = useRef<string[]>([])\n  const report = () => {\n    pending.current = null\n    const next = input.current?.value ?? \"\"\n    sent.current.push(next)\n    // Rendered here, inside the frame: React writing the page in a task between two keys\n    // would end the browser's undo step, as writing during a key does.\n    flushSync(() => {\n      if (value === undefined) setOwn(next)\n      onValueChange?.(next)\n    })\n  }\n  const applying = useRef(false)\n  const changed = () => {\n    // An edit the editor makes (Tab, Enter) records itself, as one step.\n    if (!applying.current) remember(\"typing\")\n    if (pending.current === null) pending.current = requestAnimationFrame(report)\n  }\n\n  // Undo is the editor's own. In Chrome any text change on the page while typing (the\n  // colors here) ends the browser's undo step at every key, so a run of typing couldn't be\n  // one step. Typing joins one step until a pause or a caret move; Tab, Enter and changes\n  // from outside are steps of their own; the caret comes back with the text.\n  type Snapshot = { text: string; start: number; end: number }\n  const [history] = useState(() => createUndoStack<Snapshot>({ text, start: 0, end: 0 }, { limit: 500, groupDelay: 800 }))\n  // Where the last edit left the caret: a caret anywhere else moved on its own.\n  const editedAt = useRef(-1)\n  const remember = (group: string) => {\n    const el = input.current\n    if (!el) return\n    editedAt.current = el.selectionEnd\n    history.record({ text: el.value, start: el.selectionStart, end: el.selectionEnd }, { group })\n  }\n  const restore = (snapshot: Snapshot | undefined) => {\n    const el = input.current\n    if (!snapshot || !el) return\n    el.value = snapshot.text\n    el.setSelectionRange(snapshot.start, snapshot.end)\n    if (pending.current === null) pending.current = requestAnimationFrame(report)\n    track()\n    showCaret()\n  }\n  const step = (back: boolean) => {\n    history.seal()\n    restore(back ? history.undo() : history.redo())\n  }\n  useEffect(() => () => void (pending.current !== null && cancelAnimationFrame(pending.current)), [])\n  // Text from elsewhere (a command, an agent) is written in; an echo of typing that has\n  // since moved on is not.\n  useLayoutEffect(() => {\n    const el = input.current\n    if (!el) return\n    const echo = sent.current.indexOf(text)\n    if (echo >= 0) {\n      sent.current = sent.current.slice(echo + 1)\n      return\n    }\n    sent.current = []\n    if (el.value === text) return\n    el.value = text\n    // A change from outside (a command, an agent) is an undo step of its own.\n    history.seal()\n    remember(\"outside\")\n    history.seal()\n  }, [text])\n\n  // Colors arrive after typing pauses, longer for long files; meanwhile, lines that haven't\n  // changed keep theirs.\n  const [colored, setColored] = useState<Map<string, Token[]> | null>(null)\n  const lines = text.split(\"\\n\")\n  useEffect(() => {\n    if (!lang) return\n    let current = true\n    const timer = setTimeout(\n      () => {\n        tokenize(text, lang)\n          .then((tokens) => {\n            if (!current || !tokens) return\n            const byLine = new Map<string, Token[]>()\n            text.split(\"\\n\").forEach((line, i) => !byLine.has(line) && tokens[i] && byLine.set(line, tokens[i]!))\n            setColored(byLine)\n          })\n          .catch(() => {})\n      },\n      Math.min(400, 40 + lines.length / 10),\n    )\n    return () => {\n      current = false\n      clearTimeout(timer)\n    }\n  }, [text, lang, lines.length])\n\n  const marks = useMemo(() => {\n    const map = new Map<number, Problem[\"severity\"]>()\n    const rank = { error: 3, warning: 2, info: 1 }\n    for (const p of problems) {\n      const was = map.get(p.line)\n      if (!was || rank[p.severity] > rank[was]) map.set(p.line, p.severity)\n    }\n    return map\n  }, [problems])\n\n  // The caret's line is one bar moved under the text, so a caret move redraws nothing.\n  const cursor = useRef({ line: 1, col: 1 })\n  const cursorFrame = useRef<number | null>(null)\n  const track = () => {\n    const el = input.current\n    if (!el) return\n    const at = lineCol(el.value, el.selectionStart)\n    if (bar.current) bar.current.style.translate = `0 ${(at.line - 1) * LINE}px`\n    if (at.line !== cursor.current.line || at.col !== cursor.current.col) {\n      cursor.current = at\n      // Reported once a frame, inside it, for the same reason as the text.\n      if (cursorFrame.current === null)\n        cursorFrame.current = requestAnimationFrame(() => {\n          cursorFrame.current = null\n          flushSync(() => onCursorChange?.(cursor.current))\n        })\n    }\n  }\n  const showCaret = () => {\n    const el = input.current\n    const frame = scroller.current\n    if (!el || !frame) return\n    const at = lineCol(el.value, el.selectionEnd)\n    const top = (at.line - 1) * LINE + PAD\n    const pad = LINE * 2\n    if (top < frame.scrollTop + pad) frame.scrollTop = Math.max(0, top - pad)\n    else if (top + LINE > frame.scrollTop + frame.clientHeight - pad) frame.scrollTop = top + LINE - frame.clientHeight + pad\n  }\n  const goTo = (line: number, col = 1) => {\n    const el = input.current\n    if (!el) return\n    const at = offsetOf(el.value, line, col)\n    el.focus()\n    el.setSelectionRange(at, at)\n    track()\n    showCaret()\n  }\n  useImperativeHandle(ref, () => ({ focus: () => input.current?.focus(), goTo }), [])\n  useEffect(() => {\n    onCursorChange?.(cursor.current)\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [])\n\n  // The caret's line and column, however it moved: keys, the pointer, or an edit.\n  useEffect(() => {\n    const moved = () => {\n      const el = input.current\n      if (!el || document.activeElement !== el) return\n      // The caret moving on its own (arrows, a click) ends a run of typing.\n      if (el.selectionEnd !== editedAt.current || el.selectionStart !== el.selectionEnd) history.seal()\n      track()\n      showCaret()\n    }\n    document.addEventListener(\"selectionchange\", moved)\n    return () => document.removeEventListener(\"selectionchange\", moved)\n  })\n\n  // One native edit, so the browser's own undo keeps working.\n  const apply = (edit: Edit) => {\n    const el = input.current!\n    history.seal()\n    el.setSelectionRange(edit.from, edit.to)\n    applying.current = true\n    const done = document.execCommand?.(\"insertText\", false, edit.insert)\n    if (!done) {\n      el.setRangeText(edit.insert, edit.from, edit.to, \"end\")\n      changed()\n    }\n    applying.current = false\n    el.setSelectionRange(edit.start, edit.end)\n    remember(\"edit\")\n    history.seal()\n    track()\n    showCaret()\n  }\n\n  const keyDown = (event: ReactKeyboardEvent<HTMLTextAreaElement>) => {\n    const el = event.currentTarget\n    if (event.nativeEvent.isComposing) return\n    const plain = !event.ctrlKey && !event.metaKey && !event.altKey\n    if (!readOnly && (matchesShortcut(event.nativeEvent, \"mod+shift+z\") || matchesShortcut(event.nativeEvent, \"mod+y\"))) {\n      event.preventDefault()\n      step(false)\n      return\n    }\n    if (!readOnly && matchesShortcut(event.nativeEvent, \"mod+z\")) {\n      event.preventDefault()\n      step(true)\n      return\n    }\n    if (event.key === \"Escape\") {\n      escaped.current = true\n      return\n    }\n    // After Escape, Tab moves focus on like anywhere else.\n    if (event.key === \"Tab\" && plain && escaped.current) {\n      escaped.current = false\n      return\n    }\n    escaped.current = false\n    if (event.key === \"F8\" && problems.length) {\n      event.preventDefault()\n      const sorted = [...problems].sort((a, b) => a.line - b.line || (a.col ?? 1) - (b.col ?? 1))\n      const line = lineCol(el.value, el.selectionStart).line\n      const next = event.shiftKey\n        ? ([...sorted].reverse().find((p) => p.line < line) ?? sorted.at(-1)!)\n        : (sorted.find((p) => p.line > line) ?? sorted[0]!)\n      goTo(next.line, next.col)\n      announce(`Line ${next.line}: ${next.severity}, ${next.message}`)\n      return\n    }\n    // The textarea is as tall as its text, so Page Up and Page Down move the caret by a\n    // frame's worth of lines, as editors do; the frame follows it.\n    if ((event.key === \"PageDown\" || event.key === \"PageUp\") && !event.ctrlKey && !event.metaKey && !event.altKey) {\n      event.preventDefault()\n      const page = Math.max(1, Math.floor((scroller.current?.clientHeight ?? LINE * 10) / LINE) - 1)\n      const to = moveLines(el.value, el.selectionEnd, event.key === \"PageDown\" ? page : -page)\n      el.setSelectionRange(event.shiftKey ? Math.min(el.selectionStart, to) : to, event.shiftKey ? Math.max(el.selectionStart, to) : to)\n      return\n    }\n    if (readOnly) return\n    if (event.key === \"Tab\" && plain) {\n      event.preventDefault()\n      apply((event.shiftKey ? outdent : indent)(el.value, el.selectionStart, el.selectionEnd, unit))\n      return\n    }\n    if (event.key === \"Enter\" && plain && !event.shiftKey) {\n      event.preventDefault()\n      apply(newline(el.value, el.selectionStart, el.selectionEnd, unit))\n    }\n  }\n\n  const width = lines.reduce((most, line) => Math.max(most, line.length), 1)\n\n  return (\n    // Code reads left to right and isn't translated, whatever the page's language does.\n    <div className={[\"ide-code\", className].filter(Boolean).join(\" \")} data-readonly={readOnly ? \"\" : undefined} dir=\"ltr\" translate=\"no\">\n      <div\n        className=\"ide-code-scroll\"\n        ref={scroller}\n        style={{ \"--code-digits\": String(lines.length).length } as React.CSSProperties}\n      >\n        <CodeGutter count={lines.length} marks={marks} />\n        <div className=\"ide-code-body\" style={{ \"--code-columns\": width } as React.CSSProperties}>\n          <div ref={bar} className=\"ide-code-current\" aria-hidden=\"true\" />\n          <CodeColors lines={lines} colored={lang ? colored : null} />\n          <Textarea\n            ref={input}\n            className=\"ide-code-input\"\n            aria-label={label}\n            aria-describedby={hintId}\n            defaultValue={initial}\n            onValueChange={changed}\n            readOnly={readOnly}\n            wrap=\"off\"\n            spellCheck={false}\n            autoCapitalize=\"off\"\n            autoComplete=\"off\"\n            autoCorrect=\"off\"\n            onKeyDown={keyDown}\n            // Undo and Redo from the Edit menu or a gesture take the same steps.\n            onBeforeInput={(event: React.FormEvent<HTMLTextAreaElement>) => {\n              const kind = (event.nativeEvent as InputEvent).inputType\n              if (kind === \"historyUndo\" || kind === \"historyRedo\") {\n                event.preventDefault()\n                step(kind === \"historyUndo\")\n              }\n            }}\n            onFocus={() => {\n              escaped.current = false\n              onCursorChange?.(cursor.current)\n            }}\n            onPointerDown={() => {\n              escaped.current = false\n            }}\n          />\n        </div>\n      </div>\n      <p id={hintId} hidden>\n        {readOnly\n          ? \"Read only.\"\n          : `Tab indents and Shift+Tab outdents; press Escape, then Tab, to leave the editor.${\n              problems.length\n                ? ` ${problems.length} ${problems.length === 1 ? \"problem\" : \"problems\"}; F8 goes to the next.`\n                : \"\"\n            }`}\n      </p>\n    </div>\n  )\n}\n\n/* ------------------------------------------------------------- Command palette */\n\ntype PaletteCommand = { value: string; label: string; shortcut?: string; keywords?: string[] }\n\n/**\n * Go to a file, run a command (start with >) or go to a line (start with :), on UI SDK's\n * Command in a Dialog. Two triggers open it: files with ⌘P / Ctrl+P, commands with\n * ⌘⇧P / Ctrl+Shift+P.\n */\nfunction CommandPalette({\n  files,\n  recent = [],\n  commands = [],\n  onOpenFile,\n  onCommand,\n  onGoToLine,\n  className,\n}: {\n  files: string[]\n  /** Shown first while nothing is typed. */\n  recent?: string[]\n  commands?: PaletteCommand[]\n  onOpenFile: (path: string) => void\n  onCommand?: (value: string) => void\n  /** Without it, \":\" doesn't go to lines. */\n  onGoToLine?: (line: number) => void\n  className?: string\n}) {\n  const [open, setOpen] = useState(false)\n  const [query, setQuery] = useState(\"\")\n  // Each trigger says what it opens, so its shortcut starts the right search too.\n  const [palette] = useState(() => createDialogController<\"files\" | \"commands\">())\n  const start = (what: unknown) => setQuery(what === \"commands\" ? \"> \" : \"\")\n  // Escape goes back where you were (the editor, say), not to the trigger.\n  const returnTo = useRef<HTMLElement | null>(null)\n  const mode = query.startsWith(\">\") ? \"commands\" : query.startsWith(\":\") && onGoToLine ? \"line\" : \"files\"\n  const text = query.replace(/^[>:]\\s*/, \"\")\n  const line = Number.parseInt(text, 10)\n\n  const items: CommandData =\n    mode === \"commands\"\n      ? commands.map((c) => ({ value: `cmd:${c.value}`, label: c.label, keywords: c.keywords, shortcut: c.shortcut }))\n      : mode === \"line\"\n        ? Number.isFinite(line) && line > 0\n          ? [{ value: `line:${line}`, label: `Go to line ${line}` }]\n          : []\n        : [\n            ...(text ? [] : recent.filter((p) => files.includes(p)).map((p) => ({ value: `file:${p}`, label: p, keywords: [\"recent\"] }))),\n            ...files\n              .filter((p) => text || !recent.includes(p))\n              .map((p) => ({ value: `file:${p}`, label: p })),\n          ]\n\n  const run = (value: string) => {\n    setOpen(false)\n    if (value.startsWith(\"file:\")) onOpenFile(value.slice(5))\n    else if (value.startsWith(\"cmd:\")) onCommand?.(value.slice(4))\n    else if (value.startsWith(\"line:\")) onGoToLine?.(Number(value.slice(5)))\n  }\n\n  return (\n    <Dialog\n      controller={palette}\n      open={open}\n      onOpenChange={(next: boolean) => {\n        if (next) {\n          start(palette.getPayload())\n          const was = document.activeElement\n          returnTo.current = was instanceof HTMLElement && was !== document.body ? was : null\n        }\n        setOpen(next)\n      }}\n      onPayloadChange={(what: unknown) => start(what)}\n    >\n      <div className={[\"ide-palette-triggers\", className].filter(Boolean).join(\" \")}>\n        <DialogTrigger className=\"ide-palette-trigger\" shortcut=\"mod+p\" payload=\"files\">\n          <Icon name=\"search\" />\n          <span>Go to file…</span>\n        </DialogTrigger>\n        {commands.length > 0 && (\n          <DialogTrigger data-variant=\"ghost\" shortcut=\"mod+shift+p\" payload=\"commands\">\n            Commands…\n          </DialogTrigger>\n        )}\n      </div>\n      <DialogBackdrop />\n      {/* Kept in the page, so its title names the dialog while it's closed: with two triggers it\n          takes no name from either (UI SDK's advice for a dialog with several triggers). */}\n      <DialogContent className=\"ide-palette\" keepMounted initialFocus=\"input\" finalFocus={() => (returnTo.current?.isConnected ? returnTo.current : undefined)}>\n        <DialogTitle className=\"uiset-visually-hidden\">\n          {mode === \"commands\" ? \"Run a command\" : mode === \"line\" ? \"Go to line\" : \"Go to file\"}\n        </DialogTitle>\n        <Command\n          items={items}\n          query={query}\n          onQueryChange={(next: string, details: { reason?: string }) => {\n            // Escape closes the palette, rather than first clearing a \">\" or \":\".\n            if (details?.reason === \"escape-key\") setOpen(false)\n            else setQuery(next)\n          }}\n          filter={(item: { label: string; keywords?: string[] }) =>\n            mode === \"line\" || !text ? 1 : fuzzyScore([item.label, ...(item.keywords ?? [])].join(\" \"), text)\n          }\n          onAction={(value: string) => run(value)}\n        >\n          <div className=\"ide-palette-search\">\n            <Icon name=\"search\" />\n            <CommandInput\n              // The shortcuts switch modes here too, instead of reaching the browser's Print.\n              onKeyDown={(event: ReactKeyboardEvent) => {\n                const native = event.nativeEvent\n                if (matchesShortcut(native, \"mod+shift+p\")) {\n                  event.preventDefault()\n                  setQuery(\"> \")\n                } else if (matchesShortcut(native, \"mod+p\")) {\n                  event.preventDefault()\n                  setQuery(\"\")\n                }\n              }}\n              aria-label=\"Go to a file, a command after >, or a line after :\"\n              placeholder={commands.length ? \"Search files, > for commands, : for a line\" : \"Search files\"}\n            />\n          </div>\n          <CommandEmpty className=\"ide-palette-empty\">\n            {mode === \"line\" ? \"Type a line number.\" : \"Nothing matches.\"}\n          </CommandEmpty>\n          <CommandList className=\"ide-palette-list\">\n            {(state: { items: CommandData }) =>\n              (state.items as { value: string; label: string; shortcut?: string; keywords?: string[] }[]).map((item) => {\n                const isFile = item.value.startsWith(\"file:\")\n                const label = isFile ? baseName(item.label) : item.label\n                return (\n                  <CommandItem key={item.value} value={item.value} shortcut={item.shortcut} className=\"ide-palette-item\">\n                    {isFile && <Icon name=\"file\" />}\n                    <span className=\"ide-palette-label\">\n                      {matchSegments(label, text ? matchRanges(label, text, \"fuzzy\") : []).map((part, i) =>\n                        part.match ? <mark key={i}>{part.text}</mark> : <span key={i}>{part.text}</span>,\n                      )}\n                    </span>\n                    {isFile && dirName(item.label) && <span className=\"ide-palette-dir\">{dirName(item.label)}</span>}\n                    {isFile && !text && item.keywords?.includes(\"recent\") && <span className=\"ide-palette-dir\">recent</span>}\n                    {item.shortcut && <CommandShortcut className=\"ide-palette-key\">{(s: { text: string }) => s.text}</CommandShortcut>}\n                  </CommandItem>\n                )\n              })\n            }\n          </CommandList>\n        </Command>\n      </DialogContent>\n    </Dialog>\n  )\n}\n\n/* ------------------------------------------------------- Problems and status bar */\n\nconst severityName = { error: \"Error\", warning: \"Warning\", info: \"Note\" } as const\nconst severityIcon = { error: \"danger\", warning: \"warning\", info: \"info\" } as const\n\n/** Every problem, worst first; choosing one opens its file at the line. */\nfunction ProblemsList({\n  problems,\n  onChoose,\n  empty = \"No problems found.\",\n}: {\n  problems: Problem[]\n  onChoose: (problem: Problem) => void\n  empty?: string\n}) {\n  if (!problems.length) return <p className=\"ide-problems-empty\">{empty}</p>\n  const rank = { error: 0, warning: 1, info: 2 }\n  const sorted = [...problems].sort((a, b) => rank[a.severity] - rank[b.severity] || a.path.localeCompare(b.path) || a.line - b.line)\n  return (\n    <ul className=\"ide-problems\">\n      {sorted.map((p, i) => (\n        <li key={`${p.path}:${p.line}:${i}`}>\n          <Button variant=\"ghost\" className=\"ide-problem\" data-severity={p.severity} onClick={() => onChoose(p)}>\n            <Icon name={severityIcon[p.severity]} className=\"ide-problem-icon\" />\n            <span className=\"uiset-visually-hidden\">{severityName[p.severity]}: </span>\n            <span className=\"ide-problem-message\">{p.message}</span>\n            {/* A space in the name, which the layout's columns don't need. */}\n            <span className=\"uiset-visually-hidden\"> </span>\n            {/* The file's name, not its path: an agent naming the editor by path finds only it. */}\n            <span className=\"ide-problem-where\" title={p.path}>\n              {baseName(p.path)}:{p.line}\n              {p.col ? `:${p.col}` : \"\"}\n            </span>\n          </Button>\n        </li>\n      ))}\n    </ul>\n  )\n}\n\n/** The strip along the bottom: branch, problems, cursor, language. Items are text or buttons. */\nfunction StatusBar({ label = \"Status\", children }: { label?: string; children: ReactNode }) {\n  return (\n    <div className=\"ide-status\" role=\"group\" aria-label={label}>\n      {children}\n    </div>\n  )\n}\n\nfunction StatusBarItem({ children, onClick, label }: { children: ReactNode; onClick?: () => void; label?: string }) {\n  return onClick ? (\n    <Button variant=\"ghost\" className=\"ide-status-item\" onClick={onClick} aria-label={label}>\n      {children}\n    </Button>\n  ) : (\n    <span className=\"ide-status-item\">{children}</span>\n  )\n}\n\nexport { CodeEditor, CommandPalette, EditorTabs, FileTree, nextTab, ProblemsList, StatusBar, StatusBarItem }\nexport type { CodeEditorHandle, CodeEditorProps, EditorFile, FileStatus, FileTreeProps, PaletteCommand, Problem }\n",
      "type": "registry:ui",
      "target": "@ui/ide.tsx"
    },
    {
      "path": "registry/uiset/ui/ide/ide.css",
      "content": "@layer ui-sdk, uiset.tokens, uiset.base, uiset.skin;\n\n/* An IDE's parts: file tree, editor tabs, code editor, command palette, problems, status. */\n@layer uiset.base {\n  /* The selection: a light tint of the accent on Base; a darkening on the mid-tone skins,\n     where the accent is near-white and a tint would lighten the ground under light text. */\n  :where([data-uiset]) {\n    --code-selection: color-mix(in oklch, var(--ui-primary) 14%, transparent);\n  }\n\n  :where([data-uiset][data-skin=\"blueprint\"], [data-uiset][data-skin=\"studio\"]) {\n    --code-selection: oklch(0 0 0 / 0.32);\n  }\n\n  .ide-files {\n    display: grid;\n    grid-template-rows: auto 1fr;\n    min-block-size: 0;\n    color: var(--ui-foreground);\n  }\n\n  .ide-pane-header {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    gap: 0.5rem;\n    min-block-size: 2.25rem;\n    padding-inline: 0.75rem 0.25rem;\n  }\n\n  .ide-pane-title {\n    margin: 0;\n    color: var(--ui-muted-foreground);\n    font-size: 0.75rem;\n    font-weight: 600;\n    letter-spacing: 0.04em;\n    text-transform: uppercase;\n  }\n\n  .ide-pane-actions {\n    display: flex;\n    gap: 0.125rem;\n\n    [data-slot=\"button\"],\n    [data-slot=\"menu-trigger\"] {\n      min-inline-size: 1.75rem;\n      block-size: 1.75rem;\n      padding-inline: 0.25rem;\n    }\n  }\n\n  .ide-menu-key {\n    margin-inline-start: auto;\n    padding-inline-start: 1rem;\n    color: var(--ui-muted-foreground);\n    font-size: 0.75rem;\n  }\n\n  .ide-tree {\n    min-block-size: 0;\n    overflow: auto;\n    padding-block-end: 0.5rem;\n    font-size: 0.8125rem;\n  }\n\n  .ide-tree-label {\n    display: flex;\n    align-items: center;\n    gap: 0.25rem;\n    min-block-size: 1.625rem;\n    padding-inline: calc(0.5rem + (var(--tree-level, 1) - 1) * 0.875rem) 0.5rem;\n    white-space: nowrap;\n  }\n\n  .ide-tree-chevron {\n    display: inline-grid;\n    flex: none;\n    place-items: center;\n    inline-size: 1rem;\n    block-size: 1rem;\n    color: var(--ui-muted-foreground);\n\n    .uiset-icon {\n      inline-size: 0.875rem;\n      transition: rotate 120ms;\n    }\n\n    [aria-expanded=\"true\"] > .ide-tree-label & .uiset-icon {\n      rotate: 90deg;\n    }\n\n    /* In right-to-left text the chevron points left, and turns down the other way. */\n    &:dir(rtl) .uiset-icon {\n      scale: -1 1;\n    }\n\n    [aria-expanded=\"true\"] > .ide-tree-label &:dir(rtl) .uiset-icon {\n      rotate: -90deg;\n    }\n  }\n\n  .ide-tree-icon {\n    flex: none;\n    inline-size: 1rem;\n    color: var(--ui-muted-foreground);\n  }\n\n  .ide-tree-name {\n    overflow: hidden;\n    text-overflow: ellipsis;\n  }\n\n  .ide-tree-mark {\n    margin-inline-start: auto;\n    padding-inline-start: 0.5rem;\n    font-size: 0.75rem;\n    font-weight: 700;\n    font-variant-numeric: tabular-nums;\n  }\n\n  .ide-tree-dot {\n    margin-inline-start: auto;\n    inline-size: 0.375rem;\n    block-size: 0.375rem;\n    border-radius: 50%;\n    background: var(--ui-muted-foreground);\n  }\n\n  .ide-tree-item {\n    &[data-status=\"modified\"] > .ide-tree-label {\n      --mark: var(--tone-warning);\n    }\n\n    &[data-status=\"added\"] > .ide-tree-label,\n    &[data-status=\"untracked\"] > .ide-tree-label {\n      --mark: var(--tone-success);\n    }\n\n    &[data-status=\"deleted\"] > .ide-tree-label,\n    &[data-status=\"conflict\"] > .ide-tree-label {\n      --mark: var(--tone-danger);\n    }\n\n    &[data-status] > .ide-tree-label :is(.ide-tree-name, .ide-tree-mark) {\n      color: var(--mark);\n    }\n\n    &[data-status=\"deleted\"] > .ide-tree-label .ide-tree-name {\n      text-decoration: line-through;\n    }\n  }\n\n  .ide-dialog {\n    inline-size: min(calc(100vw - 2rem), 26rem);\n  }\n\n  .ide-dialog-form {\n    display: grid;\n    gap: 1rem;\n  }\n\n  .ide-dialog-actions {\n    display: flex;\n    flex-wrap: wrap;\n    justify-content: flex-end;\n    gap: 0.5rem;\n  }\n\n  .ide-error {\n    margin: 0;\n    color: var(--tone-danger);\n    font-size: 0.875rem;\n  }\n\n  /* Editor tabs */\n  .ide-tabs {\n    display: grid;\n    grid-template-rows: auto 1fr;\n    min-block-size: 0;\n  }\n\n  .ide-tab-list {\n    display: flex;\n    overflow-x: auto;\n    border-block-end: 1px solid var(--ui-border);\n    background: color-mix(in oklch, var(--ui-muted) 50%, var(--ui-background));\n    scrollbar-width: thin;\n  }\n\n  .ide-tab {\n    position: relative;\n    display: flex;\n    flex: none;\n    align-items: center;\n    border-inline-end: 1px solid var(--ui-border);\n\n    &:has([aria-selected=\"true\"]) {\n      background: var(--ui-background);\n      box-shadow: inset 0 2px 0 var(--ui-primary);\n    }\n  }\n\n  .ide-tab-button {\n    display: flex;\n    align-items: center;\n    gap: 0.375rem;\n    block-size: 2.25rem;\n    padding-inline: 0.75rem 0.25rem;\n    border: 0;\n    background: transparent;\n    color: var(--ui-muted-foreground);\n    font: inherit;\n    font-size: 0.8125rem;\n    white-space: nowrap;\n    cursor: pointer;\n\n    &[aria-selected=\"true\"] {\n      color: var(--ui-foreground);\n    }\n  }\n\n  .ide-tab-icon {\n    inline-size: 0.875rem;\n  }\n\n  .ide-tab-dir {\n    color: var(--ui-muted-foreground);\n    font-size: 0.75rem;\n  }\n\n  .ide-tab-close {\n    display: grid;\n    place-items: center;\n    inline-size: 1.5rem;\n    block-size: 1.5rem;\n    margin-inline-end: 0.375rem;\n    padding: 0;\n    border: 0;\n    border-radius: var(--ui-radius);\n    background: transparent;\n    color: var(--ui-muted-foreground);\n    cursor: pointer;\n\n    .uiset-icon {\n      inline-size: 0.875rem;\n    }\n\n    &:hover {\n      background: var(--ui-muted);\n      color: var(--ui-foreground);\n    }\n\n    /* An unsaved file shows a dot where the close button sits, until it's pointed at. */\n    .ide-tab[data-dirty] & {\n      .uiset-icon {\n        display: none;\n      }\n\n      /* A glyph, not a painted dot, so forced colors keep it. */\n      &::before {\n        content: \"●\";\n        font-size: 0.625rem;\n        line-height: 1;\n      }\n\n      &:hover::before {\n        display: none;\n      }\n\n      &:hover .uiset-icon {\n        display: block;\n      }\n    }\n  }\n\n  .ide-tab-panel {\n    min-block-size: 0;\n    outline: none;\n  }\n\n  .ide-editor-empty {\n    display: grid;\n    place-items: center;\n    padding: 2rem;\n    color: var(--ui-muted-foreground);\n    text-align: center;\n  }\n\n  /* Code editor: a transparent textarea over colored text, line for line. */\n  .ide-code {\n    --code-line: 20px;\n    --code-pad: 12px;\n    display: grid;\n    block-size: 100%;\n    min-block-size: 0;\n    background: var(--ui-background);\n    color: var(--ui-foreground);\n  }\n\n  .ide-code-scroll {\n    /* Keeps the caret clear of the sticky line numbers when the code scrolls sideways. */\n    scroll-padding-inline-start: calc(var(--code-digits, 2) * 1ch + 1.875rem);\n    display: grid;\n    grid-template-columns: auto 1fr;\n    align-items: start;\n    min-block-size: 0;\n    overflow: auto;\n    font-family: var(--ui-font-mono);\n    font-size: 13px;\n    line-height: var(--code-line);\n    tab-size: 2;\n  }\n\n  .ide-code-gutter {\n    position: sticky;\n    inset-inline-start: 0;\n    z-index: 1;\n    display: grid;\n    grid-auto-rows: var(--code-line);\n    align-content: start;\n    align-self: stretch;\n    padding-block: var(--code-pad);\n    padding-inline: 0.75rem 0.625rem;\n    background: var(--ui-background);\n    color: var(--ui-muted-foreground);\n    text-align: end;\n    font-variant-numeric: tabular-nums;\n    user-select: none;\n  }\n\n  .ide-code-number {\n    position: relative;\n    block-size: var(--code-line);\n  }\n\n  /* A problem's mark is a glyph, shaped by severity as well as colored, and kept in forced colors. */\n  .ide-code-mark {\n    position: absolute;\n    inset-inline-start: -0.625rem;\n    font-size: 0.5rem;\n    line-height: var(--code-line);\n    color: var(--tone-danger);\n\n    [data-problem=\"warning\"] > & {\n      color: var(--tone-warning);\n    }\n\n    [data-problem=\"info\"] > & {\n      color: var(--tone-info, var(--ui-muted-foreground));\n    }\n  }\n\n  .ide-code-body {\n    position: relative;\n    isolation: isolate;\n    display: grid;\n    min-inline-size: calc(var(--code-columns) * 1ch + var(--code-pad) * 2);\n  }\n\n  .ide-code-colors,\n  .ide-code-input {\n    grid-area: 1 / 1;\n    box-sizing: border-box;\n    margin: 0;\n    padding: var(--code-pad);\n    border: 0;\n    font: inherit;\n    line-height: inherit;\n    letter-spacing: 0;\n    white-space: pre;\n    tab-size: inherit;\n    overflow-wrap: normal;\n  }\n\n  .ide-code-colors {\n    color: var(--shiki-foreground);\n    pointer-events: none;\n  }\n\n  .ide-code-line {\n    display: block;\n    block-size: var(--code-line);\n  }\n\n  /* The caret's line: one bar the editor moves, behind the text. */\n  .ide-code-current {\n    position: absolute;\n    z-index: -1;\n    inset-inline: 0;\n    inset-block-start: var(--code-pad);\n    block-size: var(--code-line);\n    background: color-mix(in oklch, var(--ui-muted) 55%, transparent);\n    pointer-events: none;\n\n    .ide-code:not(:focus-within) & {\n      background: transparent;\n    }\n  }\n\n  .ide-code-input {\n    inline-size: 100%;\n    block-size: 100%;\n    min-block-size: calc(var(--code-line) + var(--code-pad) * 2);\n    resize: none;\n    overflow: hidden;\n    background: transparent;\n    color: transparent;\n    caret-color: var(--ui-foreground);\n    outline: none;\n\n    /* Moves the background away from the text, so colored code under it keeps 4.5:1. */\n    &::selection {\n      background: var(--code-selection);\n      color: transparent;\n    }\n  }\n\n  /* The ring is drawn over the editor (the sticky line numbers would cover an outline's\n     left edge), so focusing never moves anything. */\n  .ide-code {\n    position: relative;\n  }\n\n  .ide-code:has(.ide-code-input:focus-visible)::after {\n    content: \"\";\n    position: absolute;\n    inset: 0;\n    z-index: 2;\n    border: 2px solid var(--ui-ring-border);\n    border-radius: inherit;\n    pointer-events: none;\n  }\n\n  /* Command palette */\n  .ide-palette-triggers {\n    display: flex;\n    flex: 0 1 auto;\n    align-items: center;\n    gap: 0.25rem;\n    min-inline-size: 0;\n  }\n\n  .ide-palette-trigger {\n    display: flex;\n    flex: 0 1 18rem;\n    align-items: center;\n    gap: 0.5rem;\n    min-inline-size: 0;\n    color: var(--ui-muted-foreground);\n\n    .uiset-icon {\n      inline-size: 1rem;\n    }\n  }\n\n  .ide-palette {\n    inline-size: min(calc(100vw - 2rem), 36rem);\n    padding: 0;\n    overflow: hidden;\n  }\n\n  /* The command menu is the palette's whole body: it fills the dialog and borrows its\n     surface, rather than drawing a second, narrower panel inside it. */\n  .ide-palette > [data-slot=\"command\"] {\n    flex: 1 1 auto;\n    inline-size: 100%;\n    min-inline-size: 0;\n    border: 0;\n    border-radius: 0;\n    background: transparent;\n    box-shadow: none;\n  }\n\n  /* The search row shows focus as a line under it; a ring on the field would be clipped\n     by the palette's edge. */\n  [data-uiset] .ide-palette-search [data-slot=\"command-input\"]:focus-visible {\n    outline: none;\n  }\n\n  .ide-palette-search:has(:focus-visible) {\n    border-block-end-color: var(--ui-ring-border);\n    box-shadow: 0 1px 0 var(--ui-ring-border);\n  }\n\n  .ide-palette-search {\n    display: flex;\n    align-items: center;\n    gap: 0.5rem;\n    padding-inline: 0.875rem;\n    border-block-end: 1px solid var(--ui-border);\n    color: var(--ui-muted-foreground);\n\n    input {\n      flex: 1;\n      min-inline-size: 0;\n      block-size: 2.75rem;\n      border: 0;\n      background: transparent;\n      color: var(--ui-foreground);\n      font: inherit;\n      outline: none;\n    }\n  }\n\n  .ide-palette-list {\n    max-block-size: min(60vh, 22rem);\n    overflow: auto;\n    padding: 0.375rem;\n  }\n\n  .ide-palette-item {\n    display: flex;\n    align-items: center;\n    gap: 0.5rem;\n    padding: 0.375rem 0.5rem;\n    border-radius: var(--ui-radius);\n    font-size: 0.875rem;\n    cursor: pointer;\n\n    &[data-highlighted] {\n      background: var(--ui-muted);\n    }\n\n    .uiset-icon {\n      flex: none;\n      inline-size: 1rem;\n      color: var(--ui-muted-foreground);\n    }\n\n    mark {\n      background: none;\n      color: var(--ui-primary);\n      font-weight: 650;\n    }\n  }\n\n  .ide-palette-label {\n    overflow: hidden;\n    text-overflow: ellipsis;\n    white-space: nowrap;\n  }\n\n  .ide-palette-dir,\n  .ide-palette-key {\n    flex: none;\n    color: var(--ui-muted-foreground);\n    font-size: 0.75rem;\n  }\n\n  .ide-palette-key {\n    margin-inline-start: auto;\n  }\n\n  .ide-palette-empty {\n    padding: 1.5rem;\n    color: var(--ui-muted-foreground);\n    text-align: center;\n\n    /* Without a message (something matches), it takes no room. */\n    &:empty {\n      display: none;\n    }\n  }\n\n  /* Problems */\n  .ide-problems {\n    display: grid;\n    margin: 0;\n    padding: 0.25rem;\n    list-style: none;\n  }\n\n  /* Kit buttons, laid out as rows: specific enough to outrank the base button. */\n  .ide-problems .ide-problem[data-slot] {\n    justify-content: flex-start;\n    block-size: auto;\n    min-block-size: 1.75rem;\n    font-weight: 400;\n  }\n\n  .ide-problem {\n    display: flex;\n    align-items: baseline;\n    gap: 0.5rem;\n    inline-size: 100%;\n    padding: 0.25rem 0.5rem;\n    border: 0;\n    border-radius: var(--ui-radius);\n    background: transparent;\n    color: var(--ui-foreground);\n    font: inherit;\n    font-size: 0.8125rem;\n    text-align: start;\n    cursor: pointer;\n\n    &:hover {\n      background: var(--ui-muted);\n    }\n\n    &:focus-visible {\n      outline: 2px solid var(--ui-ring-border);\n      outline-offset: -2px;\n    }\n  }\n\n  .ide-problem-icon {\n    flex: none;\n    align-self: center;\n    inline-size: 1rem;\n\n    [data-severity=\"error\"] & {\n      color: var(--tone-danger);\n    }\n\n    [data-severity=\"warning\"] & {\n      color: var(--tone-warning);\n    }\n\n    [data-severity=\"info\"] & {\n      color: var(--ui-muted-foreground);\n    }\n  }\n\n  .ide-problem-where {\n    margin-inline-start: auto;\n    color: var(--ui-muted-foreground);\n    font-family: var(--ui-font-mono);\n    font-size: 0.75rem;\n    white-space: nowrap;\n  }\n\n  .ide-problems-empty {\n    margin: 0;\n    padding: 0.75rem;\n    color: var(--ui-muted-foreground);\n    font-size: 0.875rem;\n  }\n\n  /* Status bar */\n  /* One line: on a narrow screen it scrolls sideways rather than wrapping. */\n  .ide-status {\n    display: flex;\n    flex-wrap: nowrap;\n    overflow-x: auto;\n    scrollbar-width: none;\n    align-items: center;\n    gap: 0 0.25rem;\n    min-block-size: 1.75rem;\n    padding-inline: 0.5rem;\n    border-block-start: 1px solid var(--ui-border);\n    background: color-mix(in oklch, var(--ui-muted) 50%, var(--ui-background));\n    color: var(--ui-foreground);\n    font-size: 0.75rem;\n  }\n\n  .ide-status .ide-status-item[data-slot] {\n    block-size: auto;\n    min-block-size: 1.5rem;\n    padding-inline: 0.375rem;\n    font-size: inherit;\n    font-weight: 400;\n  }\n\n  .ide-status-item {\n    display: inline-flex;\n    align-items: center;\n    gap: 0.25rem;\n    min-block-size: 1.5rem;\n    padding-inline: 0.375rem;\n    border: 0;\n    border-radius: var(--ui-radius);\n    background: transparent;\n    color: inherit;\n    font: inherit;\n    white-space: nowrap;\n\n    &:is(button) {\n      cursor: pointer;\n\n      &:hover {\n        background: var(--ui-muted);\n      }\n\n      &:focus-visible {\n        outline: 2px solid var(--ui-ring-border);\n        outline-offset: -2px;\n      }\n    }\n\n    .uiset-icon {\n      inline-size: 0.875rem;\n    }\n\n    &:first-child {\n      margin-inline-end: auto;\n    }\n  }\n\n  @media (forced-colors: active) {\n    .ide-tab:has([aria-selected=\"true\"]) {\n      outline: 2px solid Highlight;\n      outline-offset: -2px;\n    }\n\n    .ide-code-current {\n      outline: 1px solid CanvasText;\n    }\n  }\n}\n\n/*\n * The editor's textarea is a code surface, not a form field: skins dress fields (Studio\n * recesses them, Blueprint underlines them), and that decoration would cover the colors\n * drawn beneath it. Undone here, in the skin layer, for this textarea only.\n */\n@layer uiset.skin {\n  [data-uiset] .ide-code .ide-code-input[data-slot=\"textarea\"] {\n    border: 0;\n    border-radius: 0;\n    background: transparent;\n    box-shadow: none;\n    color: transparent;\n\n    &:focus-visible {\n      outline: none;\n    }\n  }\n}\n",
      "type": "registry:file",
      "target": "@ui/ide/ide.css"
    },
    {
      "path": "registry/uiset/ui/ide/editing.ts",
      "content": "// Text edits a code editor makes on keys, as pure functions over the text and selection,\n// so they're testable and the editor applies each as one native edit (keeping undo).\n\ntype Edit = {\n  /** Replace the text from `from` to `to` with `insert`… */\n  from: number\n  to: number\n  insert: string\n  /** …then select from `start` to `end`. */\n  start: number\n  end: number\n}\n\nconst lineStart = (text: string, at: number) => text.lastIndexOf(\"\\n\", at - 1) + 1\n\n/** Line and column of an offset, both from 1. */\nfunction lineCol(text: string, at: number) {\n  const before = text.slice(0, at)\n  const line = before.split(\"\\n\").length\n  return { line, col: at - lineStart(text, at) + 1 }\n}\n\n/** The offset of a line and column (from 1), clamped to the text. */\nfunction offsetOf(text: string, line: number, col = 1) {\n  const lines = text.split(\"\\n\")\n  const l = Math.max(1, Math.min(line, lines.length))\n  let at = 0\n  for (let i = 0; i < l - 1; i++) at += lines[i]!.length + 1\n  return at + Math.max(0, Math.min(col - 1, lines[l - 1]!.length))\n}\n\n/**\n * Tab: with no selection, an indent at the caret; across lines, an indent at the start of\n * each line the selection touches.\n */\nfunction indent(text: string, start: number, end: number, unit = \"  \"): Edit {\n  if (start === end || !text.slice(start, end).includes(\"\\n\")) {\n    return { from: start, to: end, insert: unit, start: start + unit.length, end: start + unit.length }\n  }\n  const from = lineStart(text, start)\n  const to = end > from && text[end - 1] === \"\\n\" ? end - 1 : end\n  const block = text.slice(from, to)\n  const lines = block.split(\"\\n\")\n  const insert = lines.map((line) => (line.length ? unit + line : line)).join(\"\\n\")\n  return { from, to, insert, start: start + unit.length, end: end + (insert.length - block.length) }\n}\n\n/** Shift+Tab: up to one indent off the start of each line the selection touches. */\nfunction outdent(text: string, start: number, end: number, unit = \"  \"): Edit {\n  const from = lineStart(text, start)\n  // A selection ending at the very start of a line leaves that line alone.\n  const last = end > start && text[end - 1] === \"\\n\" ? end - 1 : end\n  const lineEnd = text.indexOf(\"\\n\", last)\n  const to = lineEnd < 0 ? text.length : lineEnd\n  const block = text.slice(from, to)\n  const cuts: number[] = []\n  const insert = block\n    .split(\"\\n\")\n    .map((line) => {\n      const lead = line.match(/^[ \\t]*/)![0]\n      const cut = lead.startsWith(\"\\t\") ? 1 : Math.min(lead.length, unit.length)\n      cuts.push(cut)\n      return line.slice(cut)\n    })\n    .join(\"\\n\")\n  const removed = block.length - insert.length\n  return {\n    from,\n    to,\n    insert,\n    start: Math.max(from, start - cuts[0]!),\n    end: start === end ? Math.max(from, start - cuts[0]!) : Math.max(from, end - removed),\n  }\n}\n\n/** Enter: a new line indented like the current one, one deeper after an opening bracket. */\nfunction newline(text: string, start: number, end: number, unit = \"  \"): Edit {\n  const line = text.slice(lineStart(text, start), start)\n  const current = line.match(/^[ \\t]*/)![0]\n  const opens = /[{[(]\\s*$/.test(line)\n  const closes = /^\\s*[}\\])]/.test(text.slice(end, text.indexOf(\"\\n\", end) < 0 ? undefined : text.indexOf(\"\\n\", end)))\n  if (opens && closes) {\n    // Between a pair: the caret goes on its own indented line, the closer below it.\n    const insert = `\\n${current}${unit}\\n${current}`\n    const caret = start + 1 + current.length + unit.length\n    return { from: start, to: end, insert, start: caret, end: caret }\n  }\n  const insert = `\\n${current}${opens ? unit : \"\"}`\n  return { from: start, to: end, insert, start: start + insert.length, end: start + insert.length }\n}\n\n/** The offset `delta` lines up or down from `at`, keeping its column where the line allows. */\nfunction moveLines(text: string, at: number, delta: number) {\n  const { line, col } = lineCol(text, at)\n  return offsetOf(text, Math.max(1, line + delta), col)\n}\n\nexport { indent, lineCol, moveLines, newline, offsetOf, outdent }\nexport type { Edit, Problem }\n\n/** A problem in a file, from a linter or a language server: marked in the gutter, listed in Problems. */\ntype Problem = {\n  path: string\n  line: number\n  col?: number\n  severity: \"error\" | \"warning\" | \"info\"\n  message: string\n}\n",
      "type": "registry:file",
      "target": "@ui/ide/editing.ts"
    },
    {
      "path": "registry/uiset/ui/code/highlight.ts",
      "content": "// Syntax colors from shiki, loaded on first use: the core and the JavaScript regex engine\n// once, then each language the first time it's asked for. Its css-variables theme colors\n// tokens from --shiki-* variables (code/code.css), so every skin themes code.\n\ntype Token = { content: string; color?: string }\ntype Highlighter = {\n  codeToTokensBase: (code: string, options: { lang: string; theme: string }) => Token[][]\n  loadLanguage: (...langs: unknown[]) => Promise<void>\n  getLoadedLanguages: () => string[]\n}\n\nlet highlighter: Promise<Highlighter> | null = null\n\nfunction loadHighlighter() {\n  highlighter ??= (async () => {\n    const [{ createHighlighterCore, createCssVariablesTheme }, { createJavaScriptRegexEngine }] = await Promise.all([\n      import(\"shiki/core\"),\n      import(\"shiki/engine/javascript\"),\n    ])\n    return (await createHighlighterCore({\n      themes: [createCssVariablesTheme({ name: \"uiset\", variablePrefix: \"--shiki-\" })],\n      langs: [],\n      engine: createJavaScriptRegexEngine(),\n    })) as unknown as Highlighter\n  })()\n  return highlighter\n}\n\n/** Lines of colored tokens, or null for a language shiki doesn't know. */\nasync function tokenize(code: string, language: string): Promise<Token[][] | null> {\n  const shiki = await loadHighlighter()\n  const { bundledLanguages, bundledLanguagesAlias } = (await import(\"shiki/langs\")) as unknown as {\n    bundledLanguages: Record<string, () => Promise<unknown>>\n    bundledLanguagesAlias: Record<string, () => Promise<unknown>>\n  }\n  const load = bundledLanguages[language] ?? bundledLanguagesAlias[language]\n  if (!load) return null\n  if (!shiki.getLoadedLanguages().includes(language)) await shiki.loadLanguage(load())\n  return shiki.codeToTokensBase(code, { lang: language, theme: \"uiset\" })\n}\n\nconst byExtension: Record<string, string> = {\n  ts: \"typescript\",\n  tsx: \"tsx\",\n  js: \"javascript\",\n  jsx: \"jsx\",\n  mjs: \"javascript\",\n  cjs: \"javascript\",\n  json: \"json\",\n  css: \"css\",\n  html: \"html\",\n  md: \"markdown\",\n  mdx: \"mdx\",\n  py: \"python\",\n  rs: \"rust\",\n  go: \"go\",\n  sh: \"shellscript\",\n  yml: \"yaml\",\n  yaml: \"yaml\",\n  toml: \"toml\",\n  sql: \"sql\",\n}\n\n/** The language for a file name, like \"tsx\" for \"app.tsx\", or undefined for plain text. */\nfunction languageOf(path: string) {\n  const name = path.split(\"/\").pop() ?? path\n  const ext = name.includes(\".\") ? name.split(\".\").pop()!.toLowerCase() : \"\"\n  return byExtension[ext]\n}\n\nexport { languageOf, loadHighlighter, tokenize }\nexport type { Token }\n",
      "type": "registry:file",
      "target": "@ui/code/highlight.ts"
    },
    {
      "path": "registry/uiset/ui/code/code.css",
      "content": "@layer ui-sdk, uiset.tokens, uiset.base, uiset.skin;\n\n/*\n * Code token colors for shiki's css-variables theme, shared by chat code blocks and the\n * IDE's editor. Each is 4.5:1 on --ui-muted and on --ui-background in its scheme.\n */\n@layer uiset.base {\n  :where([data-uiset]) {\n    --shiki-foreground: var(--ui-foreground);\n    --shiki-background: transparent;\n    /* Dark keyword at 0.84: Blueprint's code blocks sit on its muted blue, not its page. */\n    --shiki-token-keyword: light-dark(oklch(0.47 0.19 300), oklch(0.84 0.1 300));\n    --shiki-token-string: light-dark(oklch(0.45 0.13 150), oklch(0.82 0.13 150));\n    --shiki-token-string-expression: light-dark(\n      oklch(0.45 0.13 150),\n      oklch(0.82 0.13 150)\n    );\n    --shiki-token-comment: var(--ui-muted-foreground);\n    --shiki-token-function: light-dark(oklch(0.46 0.15 255), oklch(0.8 0.11 240));\n    --shiki-token-constant: light-dark(oklch(0.48 0.16 35), oklch(0.82 0.12 60));\n    --shiki-token-parameter: light-dark(oklch(0.44 0.12 20), oklch(0.82 0.09 30));\n    --shiki-token-punctuation: var(--ui-foreground);\n    --shiki-token-link: light-dark(oklch(0.46 0.15 255), oklch(0.8 0.11 240));\n  }\n}\n",
      "type": "registry:file",
      "target": "@ui/code/code.css"
    },
    {
      "path": "registry/uiset/ui/shell/shell.css",
      "content": "@layer ui-sdk, uiset.tokens, uiset.base, uiset.skin;\n\n@layer uiset.base {\n  :where([data-uiset]) {\n    /* Status colors: text and edges hold 4.5:1 / 3:1 on --ui-background in each scheme. */\n    /* Dark values also clear 4.5:1 on the mid-dark Blueprint and Studio panels. */\n    --tone-info: light-dark(oklch(0.48 0.15 255), oklch(0.86 0.08 240));\n    --tone-success: light-dark(oklch(0.47 0.12 150), oklch(0.87 0.11 150));\n    --tone-warning: light-dark(oklch(0.5 0.12 70), oklch(0.89 0.11 85));\n    --tone-danger: light-dark(oklch(0.46 0.19 27), oklch(0.86 0.08 25));\n    --tone-neutral: var(--ui-muted-foreground);\n  }\n\n  .uiset-visually-hidden {\n    position: absolute;\n    width: 1px;\n    height: 1px;\n    overflow: hidden;\n    clip-path: inset(50%);\n    white-space: nowrap;\n  }\n\n  .uiset-icon {\n    width: 1rem;\n    height: 1rem;\n    flex-shrink: 0;\n    fill: none;\n    stroke: currentColor;\n    stroke-width: 1.75;\n    stroke-linecap: round;\n    stroke-linejoin: round;\n  }\n\n  /* App shell */\n\n  .app-shell {\n    --sidebar-width: 15rem;\n    display: grid;\n    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);\n    min-height: var(--app-shell-height, 100dvh);\n    background: var(--ui-background);\n    color: var(--ui-foreground);\n\n    &[data-narrow] {\n      grid-template-columns: minmax(0, 1fr);\n    }\n  }\n\n  [data-sidebar=\"collapsed\"] .app-shell:not([data-narrow]) {\n    --sidebar-width: 3.75rem;\n  }\n\n  .app-sidebar,\n  .app-drawer {\n    display: flex;\n    flex-direction: column;\n    gap: 0.75rem;\n    min-width: 0;\n    padding: 0.75rem;\n    border-inline-end: 1px solid var(--ui-border);\n    background: color-mix(in oklab, var(--ui-muted) 55%, var(--ui-background));\n    overflow: hidden;\n  }\n\n  .app-sidebar-top {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    gap: 0.5rem;\n    min-height: 2.25rem;\n  }\n\n  .app-brand {\n    min-width: 0;\n    margin: 0;\n    overflow: hidden;\n    font-weight: 600;\n    white-space: nowrap;\n    text-overflow: ellipsis;\n  }\n\n  [data-sidebar=\"collapsed\"] .app-sidebar .app-brand {\n    display: none;\n  }\n\n  .app-sidebar-toggle,\n  .app-menu-button {\n    flex-shrink: 0;\n    width: 2.25rem;\n    height: 2.25rem;\n    padding: 0;\n  }\n\n  .app-main {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n  }\n\n  /* Its padding counts in its height, with or without a page's box-sizing reset. */\n  .app-header {\n    box-sizing: border-box;\n    display: flex;\n    flex-wrap: wrap;\n    align-items: center;\n    gap: 0.75rem;\n    min-height: 3.25rem;\n    padding: 0.5rem 1rem;\n    border-bottom: 1px solid var(--ui-border);\n  }\n\n  /* The padding is a variable, so a full-bleed page (an inbox) can cancel it exactly. */\n  .app-content {\n    --app-shell-pad: clamp(1rem, 3vw, 2rem);\n    flex: 1;\n    min-width: 0;\n    padding: var(--app-shell-pad);\n  }\n\n  .sidebar-nav {\n    display: grid;\n    gap: 1rem;\n  }\n\n  .sidebar-group {\n    display: grid;\n    gap: 0.25rem;\n\n    ul {\n      display: grid;\n      gap: 2px;\n      margin: 0;\n      padding: 0;\n      list-style: none;\n    }\n  }\n\n  .sidebar-group-title {\n    margin: 0;\n    padding-inline: 0.5rem;\n    font-size: 0.75rem;\n    font-weight: 600;\n    color: var(--ui-muted-foreground);\n  }\n\n  /* Collapsed to icons: group titles leave the layout (a hidden title used to keep its\n     width and push the icons off center), and a rule separates the groups instead. */\n  [data-sidebar=\"collapsed\"] .app-sidebar {\n    .sidebar-group-title {\n      position: absolute;\n      width: 1px;\n      height: 1px;\n      overflow: hidden;\n      clip-path: inset(50%);\n      white-space: nowrap;\n    }\n\n    .sidebar-nav {\n      gap: 0.5rem;\n    }\n\n    .sidebar-group + .sidebar-group {\n      padding-block-start: 0.5rem;\n      border-block-start: 1px solid var(--ui-border);\n    }\n  }\n\n  /* A tooltip trigger, so UI SDK's stylesheet would draw it as a button: reset that. */\n  .sidebar-link {\n    display: flex;\n    align-items: center;\n    justify-content: flex-start;\n    gap: 0.625rem;\n    width: 100%;\n    height: auto;\n    min-height: 2.25rem;\n    padding: 0.375rem 0.5rem;\n    border: 0;\n    border-radius: var(--ui-radius);\n    background: transparent;\n    color: var(--ui-foreground);\n    font-weight: 400;\n    text-decoration: none;\n\n    &:hover {\n      background: var(--ui-muted);\n    }\n\n    &[aria-current=\"page\"] {\n      position: relative;\n      background: var(--ui-muted);\n      font-weight: 600;\n\n      /* A short bar, inset from the corners (an inset shadow bent around them). */\n      &::before {\n        content: \"\";\n        position: absolute;\n        inset-block: 0.5rem;\n        inset-inline-start: 0;\n        inline-size: 3px;\n        border-radius: 999px;\n        background: var(--ui-primary);\n      }\n    }\n\n    &:focus-visible {\n      outline: 2px solid var(--ui-ring-border);\n      outline-offset: -2px;\n    }\n  }\n\n  .sidebar-icon {\n    display: inline-grid;\n    place-items: center;\n    width: 1.25rem;\n    flex-shrink: 0;\n  }\n\n  .sidebar-label {\n    flex: 1;\n    min-width: 0;\n    overflow: hidden;\n    white-space: nowrap;\n    text-overflow: ellipsis;\n  }\n\n  .sidebar-badge {\n    font-size: 0.75rem;\n  }\n\n  /* Each link is a square icon button, centered in the rail under the toggle; the current\n     page shows by its fill and an accent icon (a side bar on a square reads as a glitch). */\n  [data-sidebar=\"collapsed\"] .app-sidebar {\n    .sidebar-link {\n      justify-content: center;\n      inline-size: 2.25rem;\n      min-block-size: 2.25rem;\n      margin-inline: auto;\n      padding: 0;\n\n      &[aria-current=\"page\"] {\n        color: color-mix(in oklch, var(--ui-primary) 55%, var(--ui-foreground));\n\n        &::before {\n          display: none;\n        }\n      }\n    }\n\n    .sidebar-label,\n    .sidebar-badge {\n      position: absolute;\n      width: 1px;\n      height: 1px;\n      overflow: hidden;\n      clip-path: inset(50%);\n    }\n  }\n\n  /* The tooltip repeats the visible label, so it only shows when labels are hidden. */\n  [data-sidebar=\"expanded\"] .sidebar-tooltip,\n  .app-drawer .sidebar-tooltip {\n    display: none;\n  }\n\n  /* Page structure */\n\n  .breadcrumbs ol {\n    display: flex;\n    flex-wrap: wrap;\n    align-items: center;\n    gap: 0.25rem;\n    margin: 0;\n    padding: 0;\n    list-style: none;\n    font-size: 0.875rem;\n  }\n\n  .breadcrumbs li {\n    display: inline-flex;\n    align-items: center;\n    gap: 0.25rem;\n    color: var(--ui-muted-foreground);\n\n    a {\n      color: inherit;\n      text-underline-offset: 0.2em;\n    }\n\n    [aria-current=\"page\"] {\n      color: var(--ui-foreground);\n      font-weight: 500;\n    }\n  }\n\n  .breadcrumbs-separator {\n    width: 0.875rem;\n    height: 0.875rem;\n  }\n\n  .page-header {\n    display: grid;\n    gap: 0.75rem;\n    margin-bottom: 1.5rem;\n  }\n\n  .page-header-row {\n    display: flex;\n    flex-wrap: wrap;\n    align-items: flex-end;\n    justify-content: space-between;\n    gap: 1rem;\n  }\n\n  .page-header-title {\n    margin: 0;\n    font-size: clamp(1.5rem, 3vw, 1.875rem);\n    line-height: 1.15;\n    text-wrap: balance;\n  }\n\n  .page-header-description {\n    max-width: 42rem;\n    margin: 0.375rem 0 0;\n    color: var(--ui-muted-foreground);\n  }\n\n  .page-header-actions {\n    display: flex;\n    flex-wrap: wrap;\n    gap: 0.5rem;\n  }\n\n  .card {\n    display: grid;\n    gap: 1rem;\n    min-width: 0;\n    padding: 1.25rem;\n    border: 1px solid var(--ui-border);\n    border-radius: calc(var(--ui-radius) + 6px);\n    background: var(--ui-background);\n  }\n\n  .card-header {\n    display: grid;\n    gap: 0.25rem;\n  }\n\n  .card-title {\n    margin: 0;\n    font-size: 1rem;\n    font-weight: 600;\n  }\n\n  .card-description {\n    margin: 0;\n    color: var(--ui-muted-foreground);\n    font-size: 0.875rem;\n  }\n\n  .card-footer {\n    display: flex;\n    flex-wrap: wrap;\n    gap: 0.5rem;\n    padding-top: 1rem;\n    border-top: 1px solid var(--ui-border);\n  }\n\n  /* Data display */\n\n  .badge {\n    --badge-color: var(--tone-neutral);\n    display: inline-flex;\n    align-items: center;\n    gap: 0.25rem;\n    padding: 0.0625rem 0.5rem;\n    border: 1px solid color-mix(in oklab, var(--badge-color) 55%, transparent);\n    border-radius: min(999px, calc(var(--ui-radius) * 999));\n    background: color-mix(in oklab, var(--badge-color) 10%, var(--ui-background));\n    color: var(--badge-color);\n    font-size: 0.75rem;\n    font-weight: 600;\n    line-height: 1.5;\n    white-space: nowrap;\n\n    &[data-tone=\"info\"] {\n      --badge-color: var(--tone-info);\n    }\n\n    &[data-tone=\"success\"] {\n      --badge-color: var(--tone-success);\n    }\n\n    &[data-tone=\"warning\"] {\n      --badge-color: var(--tone-warning);\n    }\n\n    &[data-tone=\"danger\"] {\n      --badge-color: var(--tone-danger);\n    }\n  }\n\n  .count-badge {\n    position: relative;\n    display: inline-flex;\n    vertical-align: middle;\n  }\n\n  /* The solid button's colors: every skin already holds 4.5:1 between them. */\n  .count-badge-count {\n    position: absolute;\n    inset-block-start: 0;\n    inset-inline-end: 0;\n    translate: 40% -40%;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    box-sizing: border-box;\n    min-width: 1.125rem;\n    height: 1.125rem;\n    padding-inline: 0.3125rem;\n    border-radius: min(999px, calc(var(--ui-radius) * 999));\n    background: var(--uiset-solid-bg);\n    color: var(--uiset-solid-fg);\n    box-shadow: 0 0 0 2px var(--ui-background);\n    font-size: 0.6875rem;\n    font-weight: 600;\n    font-variant-numeric: tabular-nums;\n    line-height: 1;\n    white-space: nowrap;\n    pointer-events: none;\n\n    &:dir(rtl) {\n      translate: -40% -40%;\n    }\n\n    &[data-dot] {\n      min-width: 0.625rem;\n      width: 0.625rem;\n      height: 0.625rem;\n      padding: 0;\n      translate: 20% -20%;\n\n      &:dir(rtl) {\n        translate: -20% -20%;\n      }\n    }\n  }\n\n  /* Each avatar overlaps the one before it, with a ring of the page color between them. */\n  .avatar-group {\n    display: inline-flex;\n    align-items: center;\n    vertical-align: middle;\n\n    & > * {\n      box-shadow: 0 0 0 2px var(--ui-background);\n    }\n\n    /* A small overlap: more would cover the next avatar's initials. */\n    & > * + * {\n      margin-inline-start: calc(var(--ui-spacing) * -1);\n    }\n  }\n\n  .avatar-group-more {\n    font-variant-numeric: tabular-nums;\n  }\n\n  /* Content sits at the top, so figures in a row line up whether or not one has a trend. */\n  .stat {\n    display: grid;\n    align-content: start;\n    gap: 0.25rem;\n\n    p {\n      margin: 0;\n    }\n  }\n\n  .stat-label {\n    font-size: 0.875rem;\n    color: var(--ui-muted-foreground);\n  }\n\n  .stat-trend {\n    max-inline-size: 100%;\n  }\n\n  /* A standalone figure keeps proportional digits; tabular ones look loose this big. */\n  .stat-value {\n    font-size: 1.75rem;\n    font-weight: 650;\n    line-height: 1.15;\n  }\n\n  .stat-change {\n    display: inline-flex;\n    align-items: center;\n    gap: 0.25rem;\n    font-size: 0.875rem;\n    font-weight: 600;\n\n    &[data-good] {\n      color: var(--tone-success);\n    }\n\n    &[data-bad] {\n      color: var(--tone-danger);\n    }\n  }\n\n  .stat-period,\n  .stat-description {\n    color: var(--ui-muted-foreground);\n    font-weight: 400;\n  }\n\n  .stat-description {\n    font-size: 0.8125rem;\n  }\n\n  .empty-state {\n    display: grid;\n    justify-items: center;\n    gap: 0.5rem;\n    padding: 2.5rem 1rem;\n    text-align: center;\n  }\n\n  .empty-state-icon {\n    width: 2rem;\n    height: 2rem;\n    color: var(--ui-muted-foreground);\n  }\n\n  .empty-state-title {\n    margin: 0.25rem 0 0;\n    font-size: 1.0625rem;\n  }\n\n  .empty-state-description {\n    max-width: 28rem;\n    margin: 0;\n    color: var(--ui-muted-foreground);\n  }\n\n  .empty-state-actions {\n    display: flex;\n    flex-wrap: wrap;\n    justify-content: center;\n    gap: 0.5rem;\n    margin-top: 0.5rem;\n  }\n\n  .skeleton {\n    display: block;\n    width: 100%;\n    border-radius: var(--ui-radius);\n    background: linear-gradient(\n        90deg,\n        var(--ui-muted) 0 35%,\n        color-mix(in oklab, var(--ui-muted), var(--ui-foreground) 8%) 50%,\n        var(--ui-muted) 65% 100%\n      )\n      0 0 / 300% 100%;\n    animation: skeleton-wave 1.6s ease-in-out infinite;\n  }\n\n  .skeleton-text {\n    display: grid;\n    gap: 0.5rem;\n\n    .skeleton {\n      height: 0.75rem;\n    }\n  }\n\n  @keyframes skeleton-wave {\n    from {\n      background-position: 100% 0;\n    }\n    to {\n      background-position: 0 0;\n    }\n  }\n\n  .description-list {\n    display: grid;\n    margin: 0;\n\n    &[data-layout=\"columns\"] .description-item {\n      display: grid;\n      grid-template-columns: minmax(8rem, 1fr) 2fr;\n      gap: 1rem;\n    }\n\n    dt {\n      color: var(--ui-muted-foreground);\n    }\n\n    dd {\n      margin: 0;\n      min-width: 0;\n      overflow-wrap: anywhere;\n    }\n  }\n\n  .description-item {\n    padding-block: 0.625rem;\n    border-bottom: 1px solid var(--ui-border);\n\n    &:last-child {\n      border-bottom: 0;\n    }\n  }\n\n  .item-list {\n    display: grid;\n    margin: 0;\n    padding: 0;\n    list-style: none;\n  }\n\n  .item {\n    display: flex;\n    align-items: center;\n    gap: 0.75rem;\n    min-height: 3rem;\n    padding-block: 0.625rem;\n    border-bottom: 1px solid var(--ui-border);\n\n    &:last-child {\n      border-bottom: 0;\n    }\n  }\n\n  .item-text {\n    display: grid;\n    flex: 1;\n    min-width: 0;\n  }\n\n  .item-title {\n    overflow: hidden;\n    color: var(--ui-foreground);\n    font-weight: 500;\n    white-space: nowrap;\n    text-overflow: ellipsis;\n  }\n\n  a.item-title {\n    text-decoration: none;\n\n    &:hover {\n      text-decoration: underline;\n    }\n  }\n\n  .item-description,\n  .item-meta {\n    color: var(--ui-muted-foreground);\n    font-size: 0.8125rem;\n  }\n\n  .item-actions {\n    display: flex;\n    gap: 0.25rem;\n  }\n\n  .alert {\n    --alert-color: var(--tone-info);\n    display: grid;\n    grid-template-columns: auto minmax(0, 1fr) auto;\n    gap: 0.75rem;\n    align-items: start;\n    padding: 0.875rem 1rem;\n    position: relative;\n    overflow: hidden;\n    padding-inline-start: calc(1rem + 3px);\n    border: 1px solid color-mix(in oklab, var(--alert-color) 45%, var(--ui-border));\n    border-radius: calc(var(--ui-radius) + 4px);\n    background: color-mix(in oklab, var(--alert-color) 7%, var(--ui-background));\n\n    /* The accent is a straight bar the corners clip; a thick border would taper into them. */\n    &::before {\n      content: \"\";\n      position: absolute;\n      inset-block: 0;\n      inset-inline-start: 0;\n      inline-size: 4px;\n      background: var(--alert-color);\n    }\n\n    &[data-tone=\"success\"] {\n      --alert-color: var(--tone-success);\n    }\n\n    &[data-tone=\"warning\"] {\n      --alert-color: var(--tone-warning);\n    }\n\n    &[data-tone=\"danger\"] {\n      --alert-color: var(--tone-danger);\n    }\n  }\n\n  .alert-icon {\n    width: 1.25rem;\n    height: 1.25rem;\n    color: var(--alert-color);\n  }\n\n  .alert-body {\n    display: grid;\n    gap: 0.25rem;\n  }\n\n  .alert-title {\n    margin: 0;\n    font-weight: 600;\n  }\n\n  .alert-text {\n    color: var(--ui-foreground);\n  }\n\n  .alert-actions {\n    display: flex;\n    flex-wrap: wrap;\n    gap: 0.5rem;\n    margin-top: 0.375rem;\n  }\n\n  .alert-dismiss {\n    width: 2rem;\n    height: 2rem;\n    padding: 0;\n  }\n\n  /* Sized in its own em so a key sits inside a line of text, not below it. */\n  .kbd {\n    display: inline-flex;\n    align-items: center;\n    min-width: 1.75em;\n    height: 1.75em;\n    justify-content: center;\n    padding-inline: 0.4em;\n    vertical-align: 0.125em;\n    line-height: 1;\n    border: 1px solid var(--ui-input);\n    border-bottom-width: 2px;\n    border-radius: calc(var(--ui-radius) / 2 + 2px);\n    background: var(--ui-background);\n    color: var(--ui-foreground);\n    font-family: var(--ui-font-mono);\n    font-size: 0.75rem;\n  }\n\n  .spinner {\n    display: inline-block;\n    flex-shrink: 0;\n    border: 2px solid color-mix(in oklab, var(--ui-foreground) 18%, transparent);\n    border-top-color: var(--ui-primary);\n    border-radius: 50%;\n    animation: spinner-turn 0.8s linear infinite;\n  }\n\n  @keyframes spinner-turn {\n    to {\n      rotate: 1turn;\n    }\n  }\n\n  .stepper {\n    container-type: inline-size;\n  }\n\n  .stepper ol {\n    display: flex;\n    flex-wrap: wrap;\n    gap: 0.25rem 1rem;\n    margin: 0;\n    padding: 0;\n    list-style: none;\n  }\n\n  /* Marks line up across steps, whether a step has a description or not. */\n  .stepper-step {\n    align-items: flex-start;\n    gap: 0.625rem;\n    height: auto;\n    min-height: 2.75rem;\n    padding: 0.375rem 0.625rem 0.375rem 0.375rem;\n    text-align: start;\n  }\n\n  @container (max-width: 30rem) {\n    .stepper ol {\n      flex-direction: column;\n      flex-wrap: nowrap;\n    }\n  }\n\n  .stepper-mark {\n    box-sizing: border-box;\n    display: inline-grid;\n    place-items: center;\n    width: 1.75rem;\n    height: 1.75rem;\n    flex-shrink: 0;\n    border: 2px solid var(--ui-input);\n    border-radius: 50%;\n    font-size: 0.8125rem;\n    font-weight: 600;\n    font-variant-numeric: tabular-nums;\n  }\n\n  .stepper li[data-state=\"current\"] .stepper-mark {\n    border-color: var(--ui-primary);\n    color: var(--ui-primary);\n  }\n\n  .stepper li[data-state=\"complete\"] .stepper-mark {\n    border-color: var(--ui-primary);\n    background: var(--ui-primary);\n    color: var(--ui-primary-foreground);\n  }\n\n  /* The label's first line centers on the mark, whatever the page's line height. */\n  .stepper-text {\n    display: grid;\n    padding-block-start: max(0px, calc((1.75rem - 1lh) / 2));\n  }\n\n  .stepper-label {\n    font-weight: 600;\n  }\n\n  .stepper-description {\n    font-size: 0.75rem;\n    color: var(--ui-muted-foreground);\n  }\n\n  .search-field {\n    position: relative;\n    display: flex;\n    /* A row even as a UI SDK field (which stacks its parts), so the icon centers. */\n    flex-direction: row;\n    align-items: center;\n    width: 100%;\n\n    [data-slot=\"input\"] {\n      width: 100%;\n      padding-inline: 2.125rem 3rem;\n    }\n  }\n\n  .search-field-icon {\n    position: absolute;\n    inset-inline-start: 0.625rem;\n    color: var(--ui-muted-foreground);\n    pointer-events: none;\n  }\n\n  .search-field-clear {\n    position: absolute;\n    inset-inline-end: 0.25rem;\n    width: 1.75rem;\n    height: 1.75rem;\n    padding: 0;\n  }\n\n  /* The browser's own clear button would duplicate ours. */\n  .search-field input[type=\"search\"]::-webkit-search-cancel-button {\n    display: none;\n  }\n\n  .search-field-hint {\n    position: absolute;\n    inset-inline-end: 0.5rem;\n    pointer-events: none;\n  }\n\n  .copy-button {\n    gap: 0.375rem;\n  }\n\n  @media (prefers-reduced-motion: reduce) {\n    .skeleton,\n    .spinner {\n      animation-duration: 0s;\n    }\n\n    .spinner {\n      border-top-color: var(--ui-muted-foreground);\n    }\n  }\n\n  @media (forced-colors: active) {\n    .badge,\n    .alert,\n    .kbd {\n      border-color: CanvasText;\n    }\n\n    /* Shadows don't draw here, so the rings become real edges. */\n    .avatar-group > *,\n    .count-badge-count {\n      outline: 1px solid CanvasText;\n    }\n\n    .count-badge-count {\n      background: Canvas;\n      color: CanvasText;\n    }\n\n    .sidebar-link[aria-current=\"page\"] {\n      outline: 2px solid Highlight;\n    }\n\n    .stepper li[data-state=\"complete\"] .stepper-mark {\n      background: Highlight;\n      color: HighlightText;\n    }\n  }\n}\n",
      "type": "registry:file",
      "target": "@ui/shell/shell.css"
    },
    {
      "path": "registry/uiset/ui/shell/icons.tsx",
      "content": "import { iconPaths, type IconName } from \"./icon-paths\"\n\nfunction Icon({ name, className }: { name: IconName; className?: string }) {\n  return (\n    <svg\n      viewBox=\"0 0 24 24\"\n      aria-hidden=\"true\"\n      focusable=\"false\"\n      className={[\"uiset-icon\", className].filter(Boolean).join(\" \")}\n    >\n      <path d={iconPaths[name]} />\n    </svg>\n  )\n}\n\nexport { Icon }\nexport type { IconName }\n",
      "type": "registry:file",
      "target": "@ui/shell/icons.tsx"
    },
    {
      "path": "registry/uiset/ui/shell/icon-paths.ts",
      "content": "// UISet's icons as SVG path data on a 24×24 grid, stroked: framework-free, so the React\n// Icon and the web elements draw the same shapes.\nconst iconPaths = {\n  // Text editing (the rich text editor's toolbar).\n  bold: \"M7 5h6a3.5 3.5 0 0 1 0 7H7zM7 12h7a3.5 3.5 0 0 1 0 7H7z\",\n  italic: \"M10 5h8M6 19h8M14 5l-4 14\",\n  underline: \"M7 5v6a5 5 0 0 0 10 0V5M5 20h14\",\n  strike: \"M5 12h14M16 7a4 4 0 0 0-3.5-2h-1A3.5 3.5 0 0 0 8 8.5c0 1.4.8 2.4 2.5 3M8 17a4 4 0 0 0 3.5 2h1a3.5 3.5 0 0 0 3.5-3.5c0-.6-.1-1.1-.4-1.5\",\n  \"code-inline\": \"M9 8l-4 4 4 4M15 8l4 4-4 4\",\n  link: \"M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1\",\n  \"list-bullet\": \"M9 6h11M9 12h11M9 18h11M4.5 6v.01M4.5 12v.01M4.5 18v.01\",\n  \"list-ordered\": \"M10 6h10M10 12h10M10 18h10M4 4.5l1.5-.5v4.5M4 15a1.3 1.3 0 0 1 2.4.6c0 .8-2.4 1.7-2.4 2.9h2.6\",\n  \"list-check\": \"M11 6h9M11 12h9M11 18h9M3.5 6l1.5 1.5L8 4.5M3.5 12l1.5 1.5 3-3M3.5 18l1.5 1.5 3-3\",\n  quote: \"M6 7h4v4c0 3-1.3 5-4 6M14 7h4v4c0 3-1.3 5-4 6\",\n  undo: \"M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3\",\n  redo: \"M15 14l5-5-5-5M20 9H10a6 6 0 0 0 0 12h3\",\n  image: \"M4 5h16v14H4zM4 16l5-5 4 4 3-3 4 4M15 9.5v.01\",\n  \"code-block\": \"M4 5h16v14H4zM9.5 10l-2 2 2 2M14.5 10l2 2-2 2\",\n  rule: \"M4 12h16M8 8h8M8 16h8\",\n  menu: \"M4 7h16M4 12h16M4 17h16\",\n  sidebar: \"M4 5h16v14H4zM9 5v14\",\n  chevron: \"M9 6l6 6-6 6\",\n  search: \"M11 18a7 7 0 1 1 0-14 7 7 0 0 1 0 14zM20 20l-4-4\",\n  close: \"M6 6l12 12M18 6L6 18\",\n  copy: \"M8 8h11v11H8zM5 16V5h11\",\n  check: \"M5 12.5l4.5 4.5L19 7.5\",\n  info: \"M12 11v6M12 7.5v.01M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18z\",\n  success: \"M8 12.5l2.5 2.5L16 9.5M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18z\",\n  warning:\n    \"M12 9v4M12 16.5v.01M10.3 4.2L2.6 18a2 2 0 0 0 1.7 3h15.4a2 2 0 0 0 1.7-3L13.7 4.2a2 2 0 0 0-3.4 0z\",\n  danger: \"M15 9l-6 6M9 9l6 6M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18z\",\n  up: \"M7 14l5-5 5 5\",\n  down: \"M7 10l5 5 5-5\",\n  inbox: \"M4 13l2.5-7h11l2.5 7v6H4zM4 13h5l1 2h4l1-2h5\",\n  more: \"M4.8 12a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0M10.8 12a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0M16.8 12a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0\",\n  columns: \"M4 5h16v14H4zM10 5v14M15 5v14\",\n  download: \"M12 4v11M7 10l5 5 5-5M5 20h14\",\n  upload: \"M12 15V4M7 9l5-5 5 5M5 20h14\",\n  retry: \"M20 12a8 8 0 1 1-8-8c2.2 0 4.3.9 5.9 2.4L20 8.5M20 4v4.5h-4.5\",\n  filter: \"M4 6h16M7 12h10M10 18h4\",\n  home: \"M4 11l8-7 8 7M6 9.5V20h12V9.5M10 20v-5h4v5\",\n  users: \"M9 11a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7zM3 20c0-3.3 2.7-6 6-6s6 2.7 6 6M16 4.5a3.5 3.5 0 0 1 0 6.5M21 20c0-2.6-1.6-4.8-4-5.6\",\n  orders: \"M6 4h12l1 16H5zM9 8a3 3 0 0 0 6 0\",\n  reports: \"M5 20V10M12 20V4M19 20v-7\",\n  settings: \"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM19.4 13.5l1.6 1.2-2 3.4-1.9-.7a7 7 0 0 1-2 1.2l-.3 2h-4l-.3-2a7 7 0 0 1-2-1.2l-1.9.7-2-3.4 1.6-1.2a7 7 0 0 1 0-3l-1.6-1.2 2-3.4 1.9.7a7 7 0 0 1 2-1.2l.3-2h4l.3 2a7 7 0 0 1 2 1.2l1.9-.7 2 3.4-1.6 1.2a7 7 0 0 1 0 3z\",\n  mail: \"M4 6h16v12H4zM4 7l8 6 8-6\",\n  star: \"M12 4l2.5 5.2 5.5.8-4 3.9.9 5.6L12 16.8 7.1 19.5l.9-5.6-4-3.9 5.5-.8z\",\n  archive: \"M4 5h16v4H4zM6 9v10h12V9M10 13h4\",\n  trash: \"M5 7h14M10 7V5h4v2M7 7l1 13h8l1-13\",\n  plus: \"M12 5v14M5 12h14\",\n  minus: \"M5 12h14\",\n  fit: \"M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5\",\n  folder: \"M3.5 6.5a1.5 1.5 0 0 1 1.5-1.5h4l2 2h8a1.5 1.5 0 0 1 1.5 1.5v9a1.5 1.5 0 0 1-1.5 1.5H5a1.5 1.5 0 0 1-1.5-1.5z\",\n  file: \"M6 3.5h8l4 4v13H6zM14 3.5v4h4\",\n  branch: \"M6 4v16M18 8a2 2 0 1 0 0-4 2 2 0 0 0 0 4zM18 8c0 5-6 5-12 8\",\n  grip: \"M9 6.5v.01M15 6.5v.01M9 12v.01M15 12v.01M9 17.5v.01M15 17.5v.01\",\n  edit: \"M5 19h4L19 9l-4-4L5 15zM14 6l4 4\",\n  send: \"M4 12l16-8-6 16-2-7z\",\n  card: \"M3 6h18v12H3zM3 10h18M7 15h4\",\n  shield: \"M12 3l7 3v5c0 4.5-3 8.5-7 10-4-1.5-7-5.5-7-10V6z\",\n  bell: \"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0\",\n}\n\ntype IconName = keyof typeof iconPaths\n\n/** An icon as an SVG element, for code without React. */\nfunction iconElement(name: IconName, className?: string) {\n  const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\")\n  svg.setAttribute(\"viewBox\", \"0 0 24 24\")\n  svg.setAttribute(\"aria-hidden\", \"true\")\n  svg.setAttribute(\"focusable\", \"false\")\n  svg.setAttribute(\"class\", [\"uiset-icon\", className].filter(Boolean).join(\" \"))\n  const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\")\n  path.setAttribute(\"d\", iconPaths[name])\n  svg.append(path)\n  return svg\n}\n\nexport { iconElement, iconPaths }\nexport type { IconName }\n",
      "type": "registry:file",
      "target": "@ui/shell/icon-paths.ts"
    }
  ],
  "type": "registry:ui"
}