{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "assistant-app",
  "type": "registry:block",
  "title": "Assistant App",
  "description": "A small, complete assistant with chats and projects in the sidebar, files you can attach, and replies that write themselves out word by word.",
  "categories": [
    "block",
    "Apps"
  ],
  "dependencies": [
    "lucide-react",
    "motion"
  ],
  "registryDependencies": [
    "utils",
    "https://coss.com/ui/r/avatar.json",
    "https://coss.com/ui/r/button.json",
    "https://coss.com/ui/r/composer.json",
    "https://coss.com/ui/r/input-group.json",
    "https://coss.com/ui/r/scroll-area.json",
    "https://coss.com/ui/r/segmented-control.json"
  ],
  "files": [
    {
      "path": "registry/devl/assistant-app.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport {\n  ArrowUpIcon,\n  CheckIcon,\n  ChevronRightIcon,\n  CopyIcon,\n  FileTextIcon,\n  FolderIcon,\n  FolderKanbanIcon,\n  type LucideIcon,\n  MessageSquareIcon,\n  PanelLeftCloseIcon,\n  PanelLeftIcon,\n  PaperclipIcon,\n  PlusIcon,\n  RotateCcwIcon,\n  SearchIcon,\n  SparklesIcon,\n  SquareIcon,\n  SquarePenIcon,\n  ThumbsDownIcon,\n  ThumbsUpIcon,\n  XIcon,\n} from \"lucide-react\";\nimport { AnimatePresence, LayoutGroup, MotionConfig, motion, useReducedMotion } from \"motion/react\";\nimport { useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport { Avatar, AvatarFallback } from \"@/components/ui/avatar\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n  Composer,\n  ComposerActionGroup,\n  ComposerActions,\n  ComposerInput,\n  ComposerSubmit,\n  type ComposerValue,\n  getComposerText,\n} from \"@/components/ui/composer\";\nimport { InputGroup, InputGroupAddon, InputGroupInput } from \"@/components/ui/input-group\";\nimport { ScrollArea } from \"@/components/ui/scroll-area\";\nimport { SegmentedControl, SegmentedControlItem } from \"@/components/ui/segmented-control\";\nimport { cn } from \"@/lib/utils\";\n\nexport type AssistantTone = 1 | 2 | 3 | 4 | 5;\n\nexport interface AssistantAttachment {\n  name: string;\n  size?: string;\n}\n\nexport interface AssistantMessage {\n  id: string;\n  role: \"user\" | \"assistant\";\n  content: string;\n  attachments?: AssistantAttachment[];\n}\n\nexport interface AssistantChat {\n  id: string;\n  title: string;\n  group?: string;\n  projectId?: string;\n  messages?: AssistantMessage[];\n}\n\nexport interface AssistantProject {\n  id: string;\n  name: string;\n  description?: string;\n  icon?: LucideIcon;\n  tone?: AssistantTone;\n  files?: number;\n  updated?: string;\n  suggestions?: AssistantSuggestion[];\n}\n\nexport interface AssistantSuggestion {\n  icon?: LucideIcon;\n  title: string;\n  hint?: string;\n  prompt?: string;\n}\n\nexport interface AssistantAppProps {\n  productName?: string;\n  user?: { name: string; initials: string; plan?: string };\n  greeting?: string;\n  chats?: AssistantChat[];\n  projects?: AssistantProject[];\n  suggestions?: AssistantSuggestion[];\n  defaultChatId?: string;\n  reply?: (prompt: string, project?: AssistantProject) => string;\n  className?: string;\n}\n\ntype Status = \"thinking\" | \"streaming\" | \"done\";\ntype LiveMessage = AssistantMessage & { status: Status; full?: string };\ntype LiveChat = Omit<AssistantChat, \"messages\"> & { messages: LiveMessage[] };\n\nconst press = \"transition-[scale,box-shadow,background-color] duration-150 ease-out active:scale-[0.97]\";\nconst cardPress = \"transition-[background-color,box-shadow,scale] duration-150 ease-out active:scale-[0.98]\";\nconst iconHit = \"after:absolute after:-inset-y-1 after:inset-x-0 transition-[scale,background-color] duration-150 ease-out active:scale-[0.94]\";\n\nfunction fileSize(bytes: number) {\n  if (bytes < 1024) return `${bytes} B`;\n  if (bytes < 1024 * 1024) return `${Math.round(bytes / 1024)} KB`;\n  return `${(bytes / 1024 / 1024).toFixed(1)} MB`;\n}\n\nfunction AttachmentChip({ file, onRemove }: { file: AssistantAttachment; onRemove?: () => void }) {\n  return (\n    <span className=\"inline-flex h-7 max-w-48 items-center gap-1.5 rounded-lg border bg-background ps-2 pe-1 text-xs dark:bg-input/32\">\n      <FileTextIcon aria-hidden className=\"size-3.5 shrink-0 text-muted-foreground\" />\n      <span className=\"truncate font-medium\">{file.name}</span>\n      {file.size ? <span className=\"shrink-0 text-muted-foreground tabular-nums\">{file.size}</span> : null}\n      {onRemove ? (\n        <button\n          aria-label={`Remove ${file.name}`}\n          className=\"relative flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground outline-none transition-colors after:absolute after:-inset-1.5 hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n          onClick={onRemove}\n          type=\"button\"\n        >\n          <XIcon className=\"size-3\" />\n        </button>\n      ) : (\n        <span className=\"w-1\" />\n      )}\n    </span>\n  );\n}\n\nconst tones: Record<AssistantTone, { dot: string; tile: string }> = {\n  1: { dot: \"bg-orange-500\", tile: \"bg-orange-500/12 text-orange-700 dark:text-orange-300\" },\n  2: { dot: \"bg-teal-500\", tile: \"bg-teal-500/12 text-teal-700 dark:text-teal-300\" },\n  3: { dot: \"bg-violet-500\", tile: \"bg-violet-500/12 text-violet-700 dark:text-violet-300\" },\n  4: { dot: \"bg-amber-500\", tile: \"bg-amber-500/14 text-amber-700 dark:text-amber-300\" },\n  5: { dot: \"bg-rose-500\", tile: \"bg-rose-500/12 text-rose-700 dark:text-rose-300\" },\n};\n\nfunction defaultReply(prompt: string, project?: AssistantProject) {\n  const where = project ? ` using what's in **${project.name}**` : \"\";\n  return `Here's a first pass${where}.\\n\\n**How I'd approach it**\\n1. Pin down the goal and who it's for.\\n2. Gather the two or three facts that matter most.\\n3. Draft, then cut anything that doesn't move the reader.\\n\\nTell me more about \"${prompt.slice(0, 60)}\" and I'll turn this into a full draft.`;\n}\n\nfunction titleFrom(prompt: string) {\n  const words = prompt.trim().replace(/\\s+/g, \" \").split(\" \");\n  const head = words.slice(0, 6).join(\" \").replace(/[.,;:!?]+$/, \"\");\n  return head.charAt(0).toUpperCase() + head.slice(1) + (words.length > 6 ? \"…\" : \"\");\n}\n\nfunction toLive(chats: AssistantChat[], defaultChatId: string | undefined, reply: AssistantAppProps[\"reply\"], projects: AssistantProject[]) {\n  return chats.map<LiveChat>((chat) => {\n    const messages: LiveMessage[] = (chat.messages ?? []).map((m) => ({ ...m, status: \"done\" }));\n    const last = messages.at(-1);\n    if (chat.id === defaultChatId && last?.role === \"user\") {\n      const project = projects.find((p) => p.id === chat.projectId);\n      messages.push({\n        id: `${chat.id}-pending`,\n        role: \"assistant\",\n        content: \"\",\n        status: \"thinking\",\n        full: (reply ?? defaultReply)(last.content, project),\n      });\n    }\n    return { ...chat, messages };\n  });\n}\n\nfunction Inline({ text }: { text: string }) {\n  const parts = text.split(/(\\*\\*[^*]+(?:\\*\\*|$)|`[^`]+`)/g).filter(Boolean);\n  return (\n    <>\n      {parts.map((part, i) =>\n        part.startsWith(\"**\") ? (\n          <strong className=\"font-medium text-foreground\" key={i}>\n            {part.replace(/\\*\\*/g, \"\")}\n          </strong>\n        ) : part.startsWith(\"`\") && part.endsWith(\"`\") && part.length > 1 ? (\n          <code className=\"rounded-md bg-muted px-1 py-0.5 font-mono text-[0.8125rem]\" key={i}>\n            {part.slice(1, -1)}\n          </code>\n        ) : (\n          <span key={i}>{part}</span>\n        ),\n      )}\n    </>\n  );\n}\n\ntype Block =\n  | { kind: \"p\"; text: string }\n  | { kind: \"ul\" | \"ol\"; items: string[] }\n  | { kind: \"code\"; text: string };\n\nfunction parse(src: string): Block[] {\n  const blocks: Block[] = [];\n  const lines = src.split(\"\\n\");\n  for (let i = 0; i < lines.length; i++) {\n    const line = lines[i];\n    if (line.startsWith(\"```\")) {\n      const body: string[] = [];\n      i++;\n      while (i < lines.length && !lines[i].startsWith(\"```\")) body.push(lines[i++]);\n      blocks.push({ kind: \"code\", text: body.join(\"\\n\") });\n      continue;\n    }\n    const ul = line.match(/^[-*] (.*)/);\n    const ol = line.match(/^\\d+\\. (.*)/);\n    const prev = blocks.at(-1);\n    if (ul || ol) {\n      const kind = ul ? \"ul\" : \"ol\";\n      const text = (ul ?? ol)?.[1] ?? \"\";\n      if (prev && prev.kind === kind) prev.items.push(text);\n      else blocks.push({ kind, items: [text] });\n    } else if (line.trim()) {\n      blocks.push({ kind: \"p\", text: line });\n    }\n  }\n  return blocks;\n}\n\nfunction Caret() {\n  return (\n    <motion.span\n      animate={{ opacity: [1, 0.25, 1] }}\n      aria-hidden\n      className=\"ms-0.5 inline-block size-2 translate-y-[-1px] rounded-full bg-foreground align-middle\"\n      transition={{ duration: 0.9, repeat: Number.POSITIVE_INFINITY }}\n    />\n  );\n}\n\nfunction Markdown({ text, caret }: { text: string; caret?: boolean }) {\n  const blocks = parse(text);\n  const lastIndex = blocks.length - 1;\n  return (\n    <div className=\"space-y-3 text-foreground/90 text-sm leading-6\">\n      {blocks.map((b, i) => {\n        const tail = caret && i === lastIndex ? <Caret /> : null;\n        if (b.kind === \"code\")\n          return (\n            <pre className=\"overflow-x-auto rounded-xl border bg-muted/60 px-3.5 py-3 font-mono text-xs leading-5\" key={i}>\n              <code>{b.text}</code>\n              {tail}\n            </pre>\n          );\n        if (b.kind === \"p\")\n          return (\n            <p key={i}>\n              <Inline text={b.text} />\n              {tail}\n            </p>\n          );\n        const List = b.kind === \"ul\" ? \"ul\" : \"ol\";\n        return (\n          <List\n            className={cn(\n              \"space-y-1.5 ps-5 marker:text-muted-foreground\",\n              b.kind === \"ul\" ? \"list-disc\" : \"list-decimal marker:tabular-nums\",\n            )}\n            key={i}\n          >\n            {b.items.map((item, j) => (\n              <li className=\"ps-1\" key={j}>\n                <Inline text={item} />\n                {j === b.items.length - 1 ? tail : null}\n              </li>\n            ))}\n          </List>\n        );\n      })}\n      {caret && blocks.length === 0 ? <Caret /> : null}\n    </div>\n  );\n}\n\nfunction AssistantMark({ className }: { className?: string }) {\n  return (\n    <span\n      aria-hidden\n      className={cn(\n        \"flex size-7 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground\",\n        className,\n      )}\n    >\n      <SparklesIcon className=\"size-3.5\" />\n    </span>\n  );\n}\n\nfunction Thinking({ reduce }: { reduce: boolean | null }) {\n  return (\n    <div className=\"flex h-7 items-center gap-2 text-muted-foreground text-sm\">\n      <span>Thinking</span>\n      <span className=\"flex gap-1\">\n        {[0, 1, 2].map((i) => (\n          <motion.span\n            animate={{ opacity: [0.25, 1, 0.25], y: [0, -2, 0] }}\n            className=\"size-1 rounded-full bg-muted-foreground\"\n            key={i}\n            transition={{ duration: 0.9, repeat: Number.POSITIVE_INFINITY, delay: i * 0.15 }}\n          />\n        ))}\n      </span>\n    </div>\n  );\n}\n\nfunction MessageActions({ text, onRetry }: { text: string; onRetry?: () => void }) {\n  const [copied, setCopied] = useState(false);\n  const [vote, setVote] = useState<\"up\" | \"down\" | null>(null);\n  useEffect(() => {\n    if (!copied) return;\n    const t = setTimeout(() => setCopied(false), 1400);\n    return () => clearTimeout(t);\n  }, [copied]);\n  const copy = () => {\n    navigator.clipboard?.writeText(text).catch(() => {});\n    setCopied(true);\n  };\n  return (\n    <motion.div\n      animate={{ opacity: 1 }}\n      className=\"-ms-1.5 mt-2 flex items-center gap-0.5 text-muted-foreground\"\n      initial={{ opacity: 0 }}\n      transition={{ duration: 0.25, delay: 0.1 }}\n    >\n      <Button aria-label={copied ? \"Copied\" : \"Copy reply\"} onClick={copy} className={iconHit} size=\"icon-xs\" variant=\"ghost\">\n        {copied ? <CheckIcon className=\"text-success-foreground\" /> : <CopyIcon />}\n      </Button>\n      <Button\n        aria-label=\"Good reply\"\n        aria-pressed={vote === \"up\"}\n        className={cn(iconHit, vote === \"up\" && \"bg-accent text-foreground\")}\n        onClick={() => setVote(vote === \"up\" ? null : \"up\")}\n        size=\"icon-xs\"\n        variant=\"ghost\"\n      >\n        <ThumbsUpIcon />\n      </Button>\n      <Button\n        aria-label=\"Bad reply\"\n        aria-pressed={vote === \"down\"}\n        className={cn(iconHit, vote === \"down\" && \"bg-accent text-foreground\")}\n        onClick={() => setVote(vote === \"down\" ? null : \"down\")}\n        size=\"icon-xs\"\n        variant=\"ghost\"\n      >\n        <ThumbsDownIcon />\n      </Button>\n      {onRetry ? (\n        <Button aria-label=\"Regenerate reply\" className={iconHit} onClick={onRetry} size=\"icon-xs\" variant=\"ghost\">\n          <RotateCcwIcon />\n        </Button>\n      ) : null}\n    </motion.div>\n  );\n}\n\nexport function AssistantApp({\n  productName = \"Assistant\",\n  user = { name: \"You\", initials: \"Y\" },\n  greeting = \"Welcome back\",\n  chats: initialChats = [],\n  projects = [],\n  suggestions = [],\n  defaultChatId,\n  reply = defaultReply,\n  className,\n}: AssistantAppProps) {\n  const reduce = useReducedMotion();\n  const uid = useId();\n  const [projectList, setProjectList] = useState(projects);\n  const [creating, setCreating] = useState(false);\n  const [newName, setNewName] = useState(\"\");\n  const [files, setFiles] = useState<(AssistantAttachment & { id: string })[]>([]);\n  const fileInput = useRef<HTMLInputElement>(null);\n  const drawerClose = useRef<HTMLButtonElement>(null);\n  const [chats, setChats] = useState<LiveChat[]>(() => toLive(initialChats, defaultChatId, reply, projects));\n  const [activeId, setActiveId] = useState<string | null>(defaultChatId ?? null);\n  const [scopeId, setScopeId] = useState<string | null>(\n    () => initialChats.find((c) => c.id === defaultChatId)?.projectId ?? null,\n  );\n  const [view, setView] = useState<\"chats\" | \"projects\">(\"chats\");\n  const [collapsed, setCollapsed] = useState(false);\n  const [drawer, setDrawer] = useState(false);\n  const [query, setQuery] = useState(\"\");\n  const [draft, setDraft] = useState<ComposerValue>([]);\n  const scrollRef = useRef<HTMLDivElement>(null);\n  const composerRef = useRef<HTMLDivElement>(null);\n  const pinned = useRef(true);\n  const focusAfterSend = useRef(false);\n\n  const active = chats.find((c) => c.id === activeId) ?? null;\n  const scope = projectList.find((p) => p.id === (active?.projectId ?? scopeId)) ?? null;\n  const live = chats.flatMap((c) => c.messages.map((m) => ({ chatId: c.id, m }))).find(({ m }) => m.status !== \"done\");\n  const busy = Boolean(live);\n\n  const patchMessage = (chatId: string, msgId: string, fn: (m: LiveMessage) => LiveMessage) =>\n    setChats((cs) =>\n      cs.map((c) => (c.id === chatId ? { ...c, messages: c.messages.map((m) => (m.id === msgId ? fn(m) : m)) } : c)),\n    );\n\n  useEffect(() => {\n    if (!live) return;\n    const { chatId, m } = live;\n    if (m.status === \"thinking\") {\n      const t = setTimeout(() => patchMessage(chatId, m.id, (x) => ({ ...x, status: \"streaming\" })), 700);\n      return () => clearTimeout(t);\n    }\n    const full = m.full ?? \"\";\n    const t = setTimeout(\n      () =>\n        patchMessage(chatId, m.id, (x) => {\n          const rest = full.slice(x.content.length);\n          const step = rest.match(/^\\s*\\S+\\s*(\\S+\\s*)?/)?.[0] ?? rest;\n          const content = x.content + step;\n          return content.length >= full.length\n            ? { id: x.id, role: x.role, content: full, status: \"done\" }\n            : { ...x, content };\n        }),\n      reduce ? 12 : 34,\n    );\n    return () => clearTimeout(t);\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [live?.m.status, live?.m.content, live?.m.id]);\n\n  const following = view === \"chats\" && Boolean(active);\n  useLayoutEffect(() => {\n    const el = scrollRef.current;\n    if (el && following && pinned.current) el.scrollTop = el.scrollHeight;\n  });\n\n  useLayoutEffect(() => {\n    pinned.current = true;\n    if (scrollRef.current) scrollRef.current.scrollTop = following ? scrollRef.current.scrollHeight : 0;\n  }, [activeId, view, following]);\n\n  useEffect(() => {\n    if (!focusAfterSend.current) return;\n    focusAfterSend.current = false;\n    composerRef.current?.querySelector<HTMLElement>(\"[data-slot=composer-input]\")?.focus({ preventScroll: true });\n  });\n\n  const send = (raw: string) => {\n    const text = raw.trim();\n    if (!text || busy) return;\n    const stamp = Date.now().toString(36);\n    const attachments = files.map(({ name, size }) => ({ name, size }));\n    const read = attachments.length\n      ? `I've read ${attachments.map((f) => `**${f.name}**`).join(\" and \")}.\\n\\n`\n      : \"\";\n    const user: LiveMessage = {\n      id: `u-${stamp}`,\n      role: \"user\",\n      content: text,\n      attachments: attachments.length ? attachments : undefined,\n      status: \"done\",\n    };\n    const answer: LiveMessage = {\n      id: `a-${stamp}`,\n      role: \"assistant\",\n      content: \"\",\n      status: \"thinking\",\n      full: read + reply(text, scope ?? undefined),\n    };\n    if (active) {\n      setChats((cs) => cs.map((c) => (c.id === active.id ? { ...c, messages: [...c.messages, user, answer] } : c)));\n    } else {\n      const id = `c-${stamp}`;\n      setChats((cs) => [\n        { id, title: titleFrom(text), group: \"Today\", projectId: scope?.id, messages: [user, answer] },\n        ...cs,\n      ]);\n      setActiveId(id);\n    }\n    setDraft([]);\n    setFiles([]);\n    pinned.current = true;\n    focusAfterSend.current = true;\n  };\n\n  const stop = () => {\n    if (!live) return;\n    patchMessage(live.chatId, live.m.id, (x) => ({\n      id: x.id,\n      role: x.role,\n      content: x.content.trim() || \"Stopped.\",\n      status: \"done\",\n    }));\n  };\n\n  const retry = (chatId: string, msgId: string) => {\n    const chat = chats.find((c) => c.id === chatId);\n    if (!chat || busy) return;\n    const index = chat.messages.findIndex((m) => m.id === msgId);\n    const prompt = chat.messages.slice(0, index).findLast((m) => m.role === \"user\")?.content ?? \"\";\n    const project = projectList.find((p) => p.id === chat.projectId);\n    patchMessage(chatId, msgId, (x) => ({ ...x, content: \"\", status: \"thinking\", full: reply(prompt, project) }));\n    pinned.current = true;\n  };\n\n  const openChat = (id: string) => {\n    setActiveId(id);\n    setScopeId(chats.find((c) => c.id === id)?.projectId ?? null);\n    setView(\"chats\");\n    setDrawer(false);\n  };\n\n  const newChat = (projectId: string | null = null) => {\n    setActiveId(null);\n    setScopeId(projectId);\n    setView(\"chats\");\n    setDrawer(false);\n  };\n\n  const filtered = useMemo(() => {\n    const q = query.trim().toLowerCase();\n    return q ? chats.filter((c) => c.title.toLowerCase().includes(q)) : chats;\n  }, [chats, query]);\n  const groups = useMemo(() => {\n    const map = new Map<string, LiveChat[]>();\n    for (const c of filtered) {\n      const g = c.group ?? \"Recent\";\n      map.set(g, [...(map.get(g) ?? []), c]);\n    }\n    return [...map.entries()];\n  }, [filtered]);\n  const chatCount = (projectId: string) => chats.filter((c) => c.projectId === projectId).length;\n\n  const attach = (list: FileList | null) => {\n    if (!list?.length) return;\n    const picked = Array.from(list).map((f, i) => ({\n      id: `${Date.now().toString(36)}-${i}-${f.name}`,\n      name: f.name,\n      size: fileSize(f.size),\n    }));\n    setFiles((prev) => [...prev, ...picked].slice(0, 5));\n  };\n\n  const createProject = () => {\n    const name = newName.trim();\n    setCreating(false);\n    setNewName(\"\");\n    if (!name) return;\n    const id = `p-${Date.now().toString(36)}`;\n    const used = (t: AssistantTone) => projectList.filter((p) => (p.tone ?? 1) === t).length;\n    const tone = ([1, 2, 3, 4, 5] as AssistantTone[]).reduce((best, t) => (used(t) < used(best) ? t : best));\n    setProjectList((list) => [...list, { id, name, tone, files: 0, updated: \"Just now\" }]);\n    newChat(id);\n  };\n\n  useEffect(() => {\n    if (drawer) drawerClose.current?.focus();\n  }, [drawer]);\n\n  const spring = reduce ? { duration: 0 } : { type: \"spring\" as const, stiffness: 420, damping: 36 };\n\n  const sidebar = (inDrawer: boolean) => (\n    <div className=\"flex h-full w-64 flex-col\">\n      <div className=\"flex h-12 shrink-0 items-center gap-2 px-3\">\n        <span className=\"flex size-6 items-center justify-center rounded-md bg-primary text-primary-foreground\">\n          <SparklesIcon className=\"size-3.5\" />\n        </span>\n        <span className=\"flex-1 truncate font-medium text-sm\">{productName}</span>\n        {inDrawer ? (\n          <Button aria-label=\"Close sidebar\" onClick={() => setDrawer(false)} ref={drawerClose} size=\"icon-sm\" variant=\"ghost\">\n            <XIcon />\n          </Button>\n        ) : (\n          <Button aria-label=\"Collapse sidebar\" onClick={() => setCollapsed(true)} size=\"icon-sm\" variant=\"ghost\">\n            <PanelLeftCloseIcon />\n          </Button>\n        )}\n      </div>\n      <div className=\"space-y-2 px-2.5 pb-2\">\n        <Button className={cn(\"w-full justify-start\", press)} onClick={() => newChat(null)} size=\"sm\" variant=\"outline\">\n          <SquarePenIcon />\n          New chat\n        </Button>\n        <InputGroup>\n          <InputGroupAddon>\n            <SearchIcon />\n          </InputGroupAddon>\n          <InputGroupInput\n            aria-label=\"Search chats\"\n            onChange={(e) => setQuery(e.target.value)}\n            placeholder=\"Search chats\"\n            size=\"sm\"\n            type=\"search\"\n            value={query}\n          />\n        </InputGroup>\n      </div>\n      <ScrollArea className=\"flex-1\" scrollFade>\n        <nav aria-label=\"Workspace\" className=\"space-y-4 px-2.5 pt-2 pb-4\">\n          {!query && projectList.length > 0 ? (\n            <section>\n              <div className=\"flex h-7 items-center justify-between ps-2\">\n                <h3 className=\"font-medium text-muted-foreground text-xs\">Projects</h3>\n                <Button\n                  aria-label=\"All projects\"\n                  className={cn(\"text-muted-foreground after:-inset-x-1\", iconHit)}\n                  onClick={() => {\n                    setView(\"projects\");\n                    setDrawer(false);\n                  }}\n                  size=\"icon-xs\"\n                  variant=\"ghost\"\n                >\n                  <ChevronRightIcon />\n                </Button>\n              </div>\n              <ul className=\"space-y-px\">\n                {projectList.map((p) => {\n                  const on = view === \"chats\" && !active && scopeId === p.id;\n                  return (\n                    <li key={p.id}>\n                      <button\n                        aria-current={on ? \"page\" : undefined}\n                        className={cn(\n                          \"relative flex h-8 w-full items-center gap-2.5 rounded-lg px-2 text-left text-sm outline-none transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring\",\n                          on ? \"font-medium text-foreground\" : \"text-foreground/80\",\n                        )}\n                        onClick={() => newChat(p.id)}\n                        type=\"button\"\n                      >\n                        {on ? (\n                          <span className=\"absolute inset-0 rounded-lg bg-card shadow-xs/5 ring-1 ring-border dark:bg-accent dark:ring-0\" />\n                        ) : null}\n                        <span className={cn(\"relative size-2 shrink-0 rounded-[calc(var(--radius)*0.3)]\", tones[p.tone ?? 1].dot)} />\n                        <span className=\"relative flex-1 truncate\">{p.name}</span>\n                        <span className=\"relative text-muted-foreground text-xs tabular-nums\">{chatCount(p.id)}</span>\n                      </button>\n                    </li>\n                  );\n                })}\n              </ul>\n            </section>\n          ) : null}\n          {groups.map(([group, list]) => (\n            <section key={group}>\n              <h3 className=\"flex h-7 items-center ps-2 font-medium text-muted-foreground text-xs\">{group}</h3>\n              <ul className=\"space-y-px\">\n                <AnimatePresence initial={false}>\n                  {list.map((c) => {\n                    const on = view === \"chats\" && c.id === activeId;\n                    const streaming = c.messages.some((m) => m.status !== \"done\");\n                    return (\n                      <motion.li\n                        animate={{ opacity: 1, height: \"auto\" }}\n                        exit={{ opacity: 0, height: 0 }}\n                        initial={{ opacity: 0, height: 0 }}\n                        key={c.id}\n                        layout={reduce ? false : \"position\"}\n                        transition={spring}\n                      >\n                        <button\n                          aria-current={on ? \"page\" : undefined}\n                          className={cn(\n                            \"relative flex h-8 w-full items-center gap-2 rounded-lg px-2 text-left text-sm outline-none transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring\",\n                            on ? \"font-medium text-foreground\" : \"text-foreground/80\",\n                          )}\n                          onClick={() => openChat(c.id)}\n                          type=\"button\"\n                        >\n                          {on ? (\n                            <span className=\"absolute inset-0 rounded-lg bg-card shadow-xs/5 ring-1 ring-border dark:bg-accent dark:ring-0\" />\n                          ) : null}\n                          <span className=\"relative flex-1 truncate\">{c.title}</span>\n                          {streaming ? (\n                            <motion.span\n                              animate={{ opacity: [0.35, 1, 0.35] }}\n                              aria-label=\"Replying\"\n                              className=\"relative size-1.5 shrink-0 rounded-full bg-info\"\n                              transition={{ duration: 1.2, repeat: Number.POSITIVE_INFINITY }}\n                            />\n                          ) : null}\n                        </button>\n                      </motion.li>\n                    );\n                  })}\n                </AnimatePresence>\n              </ul>\n            </section>\n          ))}\n          {groups.length === 0 ? (\n            <p className=\"px-2 py-6 text-center text-muted-foreground text-xs\">No chats match “{query}”.</p>\n          ) : null}\n        </nav>\n      </ScrollArea>\n      <div className=\"shrink-0 border-t p-2\">\n        <div className=\"flex w-full items-center gap-2.5 rounded-lg p-1.5\">\n          <Avatar className=\"size-7\">\n            <AvatarFallback className=\"bg-teal-500/15 text-teal-800 dark:text-teal-300 text-[11px]\">{user.initials}</AvatarFallback>\n          </Avatar>\n          <span className=\"min-w-0 flex-1\">\n            <span className=\"block truncate font-medium text-sm leading-4\">{user.name}</span>\n            {user.plan ? <span className=\"block text-muted-foreground text-xs\">{user.plan}</span> : null}\n          </span>\n        </div>\n      </div>\n    </div>\n  );\n\n  const composer = (\n    <motion.div layoutId={reduce ? undefined : `${uid}-composer`} ref={composerRef} transition={spring}>\n      <Composer\n        aria-label={`Message ${productName}`}\n        onSubmit={(v) => send(getComposerText(v))}\n        onValueChange={setDraft}\n        submitDisabled={busy}\n        value={draft}\n      >\n        <AnimatePresence initial={false}>\n          {files.length > 0 ? (\n            <motion.div\n              animate={{ opacity: 1, height: \"auto\" }}\n              className=\"overflow-hidden\"\n              exit={{ opacity: 0, height: 0 }}\n              initial={{ opacity: 0, height: 0 }}\n              transition={spring}\n            >\n              <div className=\"flex flex-wrap gap-1.5 px-2 pt-2\">\n                {files.map((f) => (\n                  <AttachmentChip\n                    file={f}\n                    key={f.id}\n                    onRemove={() => setFiles((prev) => prev.filter((x) => x.id !== f.id))}\n                  />\n                ))}\n              </div>\n            </motion.div>\n          ) : null}\n        </AnimatePresence>\n        <ComposerInput aria-label=\"Message\" placeholder={scope ? `Ask about ${scope.name}…` : `Ask ${productName} anything…`} />\n        <ComposerActions>\n          <ComposerActionGroup>\n            <Button\n              aria-label=\"Attach files\"\n              className={cn(\"text-muted-foreground\", press)}\n              disabled={files.length >= 5}\n              onClick={() => fileInput.current?.click()}\n              size=\"icon-sm\"\n              variant=\"ghost\"\n            >\n              <PaperclipIcon />\n            </Button>\n            <input\n              aria-hidden\n              className=\"hidden\"\n              multiple\n              onChange={(e) => {\n                attach(e.target.files);\n                e.target.value = \"\";\n              }}\n              ref={fileInput}\n              tabIndex={-1}\n              type=\"file\"\n            />\n            <AnimatePresence initial={false}>\n              {scope ? (\n                <motion.span\n                  animate={{ opacity: 1, scale: 1 }}\n                  className=\"inline-flex h-7 max-w-44 items-center gap-1.5 rounded-full border bg-background ps-2 pe-1 text-xs dark:bg-input/32\"\n                  exit={{ opacity: 0, scale: 0.95 }}\n                  initial={{ opacity: 0, scale: 0.95 }}\n                  transition={spring}\n                >\n                  <span className={cn(\"size-2 shrink-0 rounded-[calc(var(--radius)*0.3)]\", tones[scope.tone ?? 1].dot)} />\n                  <span className=\"truncate font-medium\">{scope.name}</span>\n                  {!active ? (\n                    <button\n                      aria-label={`Leave ${scope.name}`}\n                      className=\"relative flex size-5 items-center justify-center rounded-full text-muted-foreground outline-none after:absolute after:-inset-1.5 hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n                      onClick={() => setScopeId(null)}\n                      type=\"button\"\n                    >\n                      <XIcon className=\"size-3\" />\n                    </button>\n                  ) : (\n                    <span className=\"w-1\" />\n                  )}\n                </motion.span>\n              ) : null}\n            </AnimatePresence>\n          </ComposerActionGroup>\n          <ComposerActionGroup align=\"end\">\n            {busy ? (\n              <Button aria-label=\"Stop replying\" className={cn(\"rounded-full\", press)} onClick={stop} size=\"icon-sm\" variant=\"outline\">\n                <SquareIcon className=\"size-3 fill-current\" />\n              </Button>\n            ) : (\n              <ComposerSubmit\n                aria-label=\"Send message\"\n                className=\"inline-flex size-8 cursor-pointer items-center justify-center rounded-full bg-primary text-primary-foreground outline-none transition-[opacity,scale] duration-150 ease-out focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background active:scale-[0.94] disabled:cursor-default disabled:opacity-32 sm:size-7\"\n              >\n                <ArrowUpIcon className=\"size-4\" />\n              </ComposerSubmit>\n            )}\n          </ComposerActionGroup>\n        </ComposerActions>\n      </Composer>\n    </motion.div>\n  );\n\n  const ideas = scope?.suggestions ?? suggestions;\n  const plural = (n: number, word: string) => `${n} ${word}${n === 1 ? \"\" : \"s\"}`;\n\n  const welcome = (\n    <div className=\"flex min-h-full flex-col items-center justify-center px-4 py-10\">\n      <div className=\"w-full max-w-xl\">\n        <motion.div\n          animate={{ opacity: 1, y: 0 }}\n          className=\"mb-6 flex flex-col items-center text-center\"\n          initial={{ opacity: 0, y: 8 }}\n          key={scope?.id ?? \"none\"}\n          transition={spring}\n        >\n          {scope?.icon ? (\n            <span className={cn(\"mb-4 flex size-11 items-center justify-center rounded-xl\", tones[scope.tone ?? 1].tile)}>\n              <scope.icon className=\"size-5\" />\n            </span>\n          ) : (\n            <AssistantMark className=\"mb-4 size-11 rounded-xl [&_svg]:size-5\" />\n          )}\n          <h2 className=\"font-semibold text-xl tracking-tight\">\n            {scope ? scope.name : `${greeting}, ${user.name.split(\" \")[0]}`}\n          </h2>\n          <p className=\"mt-1 text-muted-foreground text-sm\">\n            {scope\n              ? (scope.description ?? `New chat in ${scope.name}.`)\n              : \"Start a chat, or pick up where a project left off.\"}\n          </p>\n        </motion.div>\n        {composer}\n        {ideas.length > 0 ? (\n          <div className=\"mt-4 grid grid-cols-1 gap-2 @lg:grid-cols-2\">\n            {ideas.map((s, i) => (\n              <motion.button\n                animate={{ opacity: 1, y: 0 }}\n                className={cn(\n                  \"group flex items-start gap-3 rounded-xl border bg-background p-3 text-left outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring dark:bg-input/32 dark:hover:bg-input/64\",\n                  cardPress,\n                )}\n                initial={{ opacity: 0, y: 8 }}\n                key={`${scope?.id}-${s.title}`}\n                onClick={() => send(s.prompt ?? s.title)}\n                transition={{ ...spring, delay: reduce ? 0 : 0.04 * i }}\n                type=\"button\"\n              >\n                {s.icon ? (\n                  <span className=\"flex size-7 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground transition-colors group-hover:text-foreground\">\n                    <s.icon className=\"size-3.5\" />\n                  </span>\n                ) : null}\n                <span className=\"min-w-0\">\n                  <span className=\"block font-medium text-sm\">{s.title}</span>\n                  {s.hint ? <span className=\"mt-0.5 block text-muted-foreground text-xs\">{s.hint}</span> : null}\n                </span>\n              </motion.button>\n            ))}\n          </div>\n        ) : null}\n      </div>\n    </div>\n  );\n\n  const conversation = active ? (\n    <div className=\"mx-auto w-full max-w-2xl space-y-6 px-4 py-6\">\n      {active.messages.map((m) =>\n        m.role === \"user\" ? (\n          <motion.div\n            animate={{ opacity: 1, y: 0 }}\n            className=\"flex justify-end\"\n            initial={{ opacity: 0, y: 8 }}\n            key={m.id}\n            transition={spring}\n          >\n            <div className=\"flex max-w-[85%] flex-col items-end gap-1.5\">\n              {m.attachments?.length ? (\n                <div className=\"flex flex-wrap justify-end gap-1.5\">\n                  {m.attachments.map((f) => (\n                    <AttachmentChip file={f} key={f.name} />\n                  ))}\n                </div>\n              ) : null}\n              <div className=\"whitespace-pre-wrap rounded-2xl rounded-br-md bg-muted px-3.5 py-2 text-sm leading-6\">\n                {m.content}\n              </div>\n            </div>\n          </motion.div>\n        ) : (\n          <motion.div\n            animate={{ opacity: 1, y: 0 }}\n            className=\"flex gap-3\"\n            initial={{ opacity: 0, y: 8 }}\n            key={m.id}\n            transition={spring}\n          >\n            <AssistantMark />\n            <div aria-busy={m.status !== \"done\"} aria-live=\"polite\" className=\"min-w-0 flex-1 pt-0.5\">\n              {m.status === \"thinking\" ? (\n                <Thinking reduce={reduce} />\n              ) : (\n                <>\n                  <Markdown caret={m.status === \"streaming\" && !reduce} text={m.content} />\n                  {m.status === \"done\" ? (\n                    <MessageActions onRetry={() => retry(active.id, m.id)} text={m.content} />\n                  ) : null}\n                </>\n              )}\n            </div>\n          </motion.div>\n        ),\n      )}\n    </div>\n  ) : null;\n\n  const projectsView = (\n    <div className=\"mx-auto w-full max-w-4xl px-4 py-6 @3xl:px-6\">\n      <div className=\"mb-4 flex items-end justify-between gap-3\">\n        <div>\n          <h2 className=\"font-semibold text-base\">Projects</h2>\n          <p className=\"mt-0.5 text-muted-foreground text-xs tabular-nums\">\n            {plural(projectList.length, \"project\")} · {plural(chats.filter((c) => c.projectId).length, \"chat\")}\n          </p>\n        </div>\n      </div>\n      <div className=\"grid grid-cols-1 gap-3 @lg:grid-cols-2 @4xl:grid-cols-3\">\n        {projectList.map((p, i) => {\n          const Icon = p.icon ?? FolderIcon;\n          const recent = chats.filter((c) => c.projectId === p.id).slice(0, 2);\n          return (\n            <motion.button\n              animate={{ opacity: 1, y: 0 }}\n              className={cn(\n                \"group flex flex-col rounded-xl border bg-background p-4 text-left outline-none hover:bg-accent/60 hover:shadow-xs/5 focus-visible:ring-2 focus-visible:ring-ring dark:bg-input/32 dark:hover:bg-input/64\",\n                cardPress,\n              )}\n              initial={{ opacity: 0, y: 10 }}\n              key={p.id}\n              onClick={() => newChat(p.id)}\n              transition={{ ...spring, delay: reduce ? 0 : 0.035 * i }}\n              type=\"button\"\n            >\n              <div className=\"flex items-start justify-between gap-3\">\n                <span className={cn(\"flex size-9 items-center justify-center rounded-lg\", tones[p.tone ?? 1].tile)}>\n                  <Icon className=\"size-4\" />\n                </span>\n                {p.updated ? <span className=\"text-muted-foreground text-xs\">{p.updated}</span> : null}\n              </div>\n              <span className=\"mt-3 font-medium text-sm\">{p.name}</span>\n              {p.description ? (\n                <span className=\"mt-1 line-clamp-2 text-muted-foreground text-xs leading-5\">{p.description}</span>\n              ) : null}\n              {recent.length > 0 ? (\n                <span className=\"mt-3 space-y-1 border-t pt-3\">\n                  {recent.map((c) => (\n                    <span className=\"flex items-center gap-2 text-foreground/80 text-xs\" key={c.id}>\n                      <MessageSquareIcon className=\"size-3 shrink-0 text-muted-foreground\" />\n                      <span className=\"truncate\">{c.title}</span>\n                    </span>\n                  ))}\n                </span>\n              ) : null}\n              <span className=\"mt-auto flex items-center gap-3 pt-3 text-muted-foreground text-xs tabular-nums\">\n                <span>{plural(chatCount(p.id), \"chat\")}</span>\n                {p.files !== undefined ? <span>{plural(p.files, \"file\")}</span> : null}\n              </span>\n            </motion.button>\n          );\n        })}\n        {creating ? (\n          <form\n            className=\"flex min-h-36 flex-col justify-center gap-2 rounded-xl border border-ring bg-background p-4 ring-[3px] ring-ring/24 dark:bg-input/32\"\n            onSubmit={(e) => {\n              e.preventDefault();\n              createProject();\n            }}\n          >\n            <label className=\"font-medium text-muted-foreground text-xs\" htmlFor={`${uid}-new-project`}>\n              New project\n            </label>\n            <input\n              autoFocus\n              className=\"h-8 w-full bg-transparent font-medium text-sm outline-none placeholder:text-muted-foreground/72\"\n              id={`${uid}-new-project`}\n              maxLength={48}\n              onBlur={createProject}\n              onChange={(e) => setNewName(e.target.value)}\n              onKeyDown={(e) => {\n                if (e.key === \"Escape\") {\n                  e.preventDefault();\n                  setNewName(\"\");\n                  setCreating(false);\n                }\n              }}\n              placeholder=\"Name it, e.g. Hiring plan\"\n              value={newName}\n            />\n            <p className=\"text-muted-foreground text-xs\">Enter to create · Esc to cancel</p>\n          </form>\n        ) : (\n          <motion.button\n            animate={{ opacity: 1, y: 0 }}\n            className={cn(\n              \"flex min-h-36 flex-col items-center justify-center gap-2 rounded-xl border border-dashed text-muted-foreground text-sm outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\",\n              cardPress,\n            )}\n            initial={{ opacity: 0, y: 10 }}\n            onClick={() => setCreating(true)}\n            transition={{ ...spring, delay: reduce ? 0 : 0.035 * projectList.length }}\n            type=\"button\"\n          >\n            <span className=\"flex size-9 items-center justify-center rounded-lg border border-dashed\">\n              <PlusIcon className=\"size-4\" />\n            </span>\n            New project\n          </motion.button>\n        )}\n      </div>\n    </div>\n  );\n\n  const title = view === \"projects\" ? \"Projects\" : active ? active.title : \"New chat\";\n\n  return (\n    <MotionConfig reducedMotion=\"user\">\n    <div\n      className={cn(\n        \"@container relative mx-auto flex h-[640px] w-full max-w-[1100px] overflow-hidden rounded-2xl border bg-card text-card-foreground shadow-xs/5\",\n        className,\n      )}\n    >\n      <motion.aside\n        animate={{ width: collapsed ? 0 : 256 }}\n        aria-label=\"Sidebar\"\n        className=\"hidden shrink-0 overflow-hidden border-e bg-muted @3xl:block data-[collapsed=true]:border-e-0\"\n        data-collapsed={collapsed}\n        initial={false}\n        transition={spring}\n      >\n        {sidebar(false)}\n      </motion.aside>\n\n      <AnimatePresence>\n        {drawer ? (\n          <>\n            <motion.div\n              animate={{ opacity: 1 }}\n              aria-hidden\n              className=\"absolute inset-0 z-20 bg-background/70 backdrop-blur-[2px] @3xl:hidden\"\n              exit={{ opacity: 0 }}\n              initial={{ opacity: 0 }}\n              onClick={() => setDrawer(false)}\n              transition={{ duration: 0.2 }}\n            />\n            <motion.aside\n              animate={{ x: 0 }}\n              aria-label=\"Sidebar\"\n              className=\"absolute inset-y-0 left-0 z-30 border-e bg-card shadow-lg/5 @3xl:hidden\"\n              exit={{ x: \"-100%\" }}\n              initial={{ x: \"-100%\" }}\n              onKeyDown={(e) => e.key === \"Escape\" && setDrawer(false)}\n              transition={spring}\n            >\n              <div className=\"h-full bg-muted\">{sidebar(true)}</div>\n            </motion.aside>\n          </>\n        ) : null}\n      </AnimatePresence>\n\n      <div className=\"flex min-w-0 flex-1 flex-col\">\n        <header className=\"flex h-12 shrink-0 items-center gap-1.5 border-b px-2.5\">\n          <Button aria-label=\"Open sidebar\" className=\"@3xl:hidden\" onClick={() => setDrawer(true)} size=\"icon-sm\" variant=\"ghost\">\n            <PanelLeftIcon />\n          </Button>\n          <AnimatePresence initial={false}>\n            {collapsed ? (\n              <motion.span\n                animate={{ opacity: 1, width: \"auto\" }}\n                className=\"hidden items-center gap-1.5 overflow-hidden @3xl:flex\"\n                exit={{ opacity: 0, width: 0 }}\n                initial={{ opacity: 0, width: 0 }}\n                transition={spring}\n              >\n                <Button aria-label=\"Expand sidebar\" onClick={() => setCollapsed(false)} size=\"icon-sm\" variant=\"ghost\">\n                  <PanelLeftIcon />\n                </Button>\n                <Button aria-label=\"New chat\" onClick={() => newChat(null)} size=\"icon-sm\" variant=\"ghost\">\n                  <SquarePenIcon />\n                </Button>\n              </motion.span>\n            ) : null}\n          </AnimatePresence>\n          <div className=\"flex min-w-0 flex-1 items-center gap-1.5 ps-1 text-sm\">\n            {view === \"chats\" && scope ? (\n              <>\n                <button\n                  className=\"hidden max-w-40 shrink-0 items-center gap-1.5 truncate rounded-md text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring @xl:flex\"\n                  onClick={() => newChat(scope.id)}\n                  type=\"button\"\n                >\n                  <span className={cn(\"size-2 shrink-0 rounded-[calc(var(--radius)*0.3)]\", tones[scope.tone ?? 1].dot)} />\n                  <span className=\"truncate\">{scope.name}</span>\n                </button>\n                <ChevronRightIcon className=\"hidden size-3.5 shrink-0 text-muted-foreground/70 @xl:block\" />\n              </>\n            ) : null}\n            <AnimatePresence initial={false} mode=\"popLayout\">\n              <motion.h1\n                animate={{ opacity: 1, y: 0 }}\n                className=\"min-w-0 truncate font-medium\"\n                exit={{ opacity: 0, y: -6 }}\n                initial={{ opacity: 0, y: 6 }}\n                key={title}\n                transition={{ duration: 0.18 }}\n              >\n                {title}\n              </motion.h1>\n            </AnimatePresence>\n          </div>\n          <SegmentedControl aria-label=\"View\" role=\"group\" size=\"sm\">\n            <SegmentedControlItem\n              aria-pressed={view === \"chats\"}\n              className=\"text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n              data-pressed={view === \"chats\" ? \"\" : undefined}\n              onClick={() => setView(\"chats\")}\n            >\n              <MessageSquareIcon className=\"hidden @md:block\" />\n              Chats\n            </SegmentedControlItem>\n            <SegmentedControlItem\n              aria-pressed={view === \"projects\"}\n              className=\"text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n              data-pressed={view === \"projects\" ? \"\" : undefined}\n              onClick={() => setView(\"projects\")}\n            >\n              <FolderKanbanIcon className=\"hidden @md:block\" />\n              Projects\n            </SegmentedControlItem>\n          </SegmentedControl>\n        </header>\n\n        <LayoutGroup>\n          <div\n            className=\"min-h-0 flex-1 overflow-y-auto [mask-image:linear-gradient(to_bottom,transparent,black_20px,black_calc(100%-12px),transparent)]\"\n            onScroll={(e) => {\n              const el = e.currentTarget;\n              pinned.current = el.scrollHeight - el.scrollTop - el.clientHeight < 48;\n            }}\n            ref={scrollRef}\n          >\n            <motion.div\n              animate={{ opacity: 1 }}\n              className=\"min-h-full\"\n              initial={{ opacity: 0 }}\n              key={view === \"projects\" ? \"projects\" : active ? \"chat\" : `welcome-${scope?.id}`}\n              transition={{ duration: 0.2 }}\n            >\n              {view === \"projects\" ? projectsView : active ? conversation : welcome}\n            </motion.div>\n          </div>\n          {view === \"chats\" && active ? (\n            <div className=\"shrink-0 px-4 pt-1 pb-3\">\n              <div className=\"mx-auto w-full max-w-2xl\">\n                {composer}\n                <p className=\"mt-2 text-center text-muted-foreground text-xs\">\n                  {productName} can make mistakes. Check anything important.\n                </p>\n              </div>\n            </div>\n          ) : null}\n        </LayoutGroup>\n      </div>\n    </div>\n    </MotionConfig>\n  );\n}\n\n"
    }
  ]
}