{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "assistant-start",
  "type": "registry:block",
  "title": "Assistant Start",
  "description": "The first screen of an AI assistant, with chats and projects down the side, a gooey orb that says hello and a prompt box that gathers tools and connected apps as context, then glides down into the conversation when you send.",
  "categories": [
    "screen",
    "AI"
  ],
  "dependencies": [
    "motion",
    "lucide-react"
  ],
  "registryDependencies": [
    "utils",
    "https://coss.com/ui/r/avatar.json",
    "https://coss.com/ui/r/badge.json",
    "https://coss.com/ui/r/button.json",
    "https://coss.com/ui/r/input-group.json",
    "https://coss.com/ui/r/kbd.json",
    "https://coss.com/ui/r/menu.json",
    "https://coss.com/ui/r/select.json",
    "https://coss.com/ui/r/tooltip.json"
  ],
  "files": [
    {
      "path": "registry/devl/assistant-start.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport { AnimatePresence, LayoutGroup, MotionConfig, motion, useReducedMotion } from \"motion/react\";\nimport {\n  ArrowLeftIcon,\n  ArrowUpIcon,\n  ArrowUpRightIcon,\n  BotIcon,\n  CalendarDaysIcon,\n  CheckIcon,\n  CodeXmlIcon,\n  CopyIcon,\n  EllipsisIcon,\n  FeatherIcon,\n  FileSpreadsheetIcon,\n  GlobeIcon,\n  HardDriveIcon,\n  HouseIcon,\n  LibraryIcon,\n  LoaderCircleIcon,\n  LogOutIcon,\n  type LucideIcon,\n  MailIcon,\n  MenuIcon,\n  NotebookPenIcon,\n  PanelsTopLeftIcon,\n  PaperclipIcon,\n  PlusIcon,\n  ReceiptTextIcon,\n  RotateCcwIcon,\n  SearchIcon,\n  SquareIcon,\n  SettingsIcon,\n  SparklesIcon,\n  SquareKanbanIcon,\n  SquarePenIcon,\n  TelescopeIcon,\n  ThumbsUpIcon,\n  XIcon,\n} from \"lucide-react\";\nimport {\n  type KeyboardEvent,\n  type ReactNode,\n  type RefObject,\n  useEffect,\n  useId,\n  useMemo,\n  useRef,\n  useState,\n} from \"react\";\nimport { Avatar, AvatarFallback } from \"@/components/ui/avatar\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Button } from \"@/components/ui/button\";\nimport { InputGroup, InputGroupAddon, InputGroupInput } from \"@/components/ui/input-group\";\nimport { Kbd } from \"@/components/ui/kbd\";\nimport { Menu, MenuItem, MenuPopup, MenuSeparator, MenuTrigger } from \"@/components/ui/menu\";\nimport { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from \"@/components/ui/select\";\nimport { Tooltip, TooltipPopup, TooltipTrigger } from \"@/components/ui/tooltip\";\nimport { cn } from \"@/lib/utils\";\n\nexport type AssistantTone = \"orange\" | \"teal\" | \"violet\" | \"amber\" | \"info\" | \"success\" | \"warning\";\n\nexport interface AssistantChat {\n  id: string;\n  title: string;\n  time: string;\n  projectId?: string;\n}\n\nexport interface AssistantProject {\n  id: string;\n  name: string;\n  tone: AssistantTone;\n}\n\nexport interface AssistantApp {\n  id: string;\n  name: string;\n  detail: string;\n  icon: LucideIcon;\n  tone: AssistantTone;\n  connected: boolean;\n}\n\nexport interface AssistantSuggestion {\n  id: string;\n  title: string;\n  description: string;\n  prompt: string;\n  icon: LucideIcon;\n  tone: AssistantTone;\n}\n\nexport interface AssistantTool {\n  id: string;\n  label: string;\n  icon: LucideIcon;\n}\n\nexport interface AssistantModel {\n  value: string;\n  label: string;\n}\n\nexport interface AssistantStartProps {\n  productName?: string;\n  userName?: string;\n  userInitials?: string;\n  plan?: string;\n  greeting?: string;\n  chats?: AssistantChat[];\n  projects?: AssistantProject[];\n  apps?: AssistantApp[];\n  suggestions?: AssistantSuggestion[];\n  tools?: AssistantTool[];\n  models?: AssistantModel[];\n  placeholders?: string[];\n  className?: string;\n}\n\nconst tileTone: Record<AssistantTone, string> = {\n  orange: \"bg-orange-500/12 text-orange-700 dark:bg-orange-400/14 dark:text-orange-300\",\n  teal: \"bg-teal-500/12 text-teal-700 dark:bg-teal-400/14 dark:text-teal-300\",\n  violet: \"bg-violet-500/12 text-violet-700 dark:bg-violet-400/14 dark:text-violet-300\",\n  amber: \"bg-amber-500/12 text-amber-700 dark:bg-amber-400/14 dark:text-amber-300\",\n  info: \"bg-info/12 text-info-foreground\",\n  success: \"bg-success/12 text-success-foreground\",\n  warning: \"bg-warning/16 text-warning-foreground\",\n};\n\nconst dotTone: Record<AssistantTone, string> = {\n  orange: \"bg-orange-500\",\n  teal: \"bg-teal-500\",\n  violet: \"bg-violet-500\",\n  amber: \"bg-amber-500\",\n  info: \"bg-info\",\n  success: \"bg-success\",\n  warning: \"bg-warning\",\n};\n\nconst easeOut = [0.23, 1, 0.32, 1] as const;\nconst spring = { type: \"spring\", duration: 0.3, bounce: 0 } as const;\nconst softSpring = { type: \"spring\", duration: 0.4, bounce: 0 } as const;\nconst fade = { duration: 0.2, ease: easeOut } as const;\n\nconst defaultProjects: AssistantProject[] = [\n  { id: \"launch\", name: \"Aurora launch\", tone: \"orange\" },\n  { id: \"renewals\", name: \"Q3 renewals\", tone: \"teal\" },\n  { id: \"hiring\", name: \"Design hiring\", tone: \"info\" },\n];\n\nconst defaultChats: AssistantChat[] = [\n  { id: \"c1\", title: \"Summarise the pricing page feedback\", time: \"2m\", projectId: \"launch\" },\n  { id: \"c2\", title: \"Which renewals slip past October?\", time: \"1h\", projectId: \"renewals\" },\n  { id: \"c3\", title: \"Draft the Aurora press note\", time: \"3h\", projectId: \"launch\" },\n  { id: \"c4\", title: \"Portfolio review rubric for juniors\", time: \"Yesterday\", projectId: \"hiring\" },\n  { id: \"c5\", title: \"Rewrite onboarding email in a warmer tone\", time: \"Mon\" },\n  { id: \"c6\", title: \"Compare churn by plan tier\", time: \"Sep 28\", projectId: \"renewals\" },\n];\n\nconst defaultApps: AssistantApp[] = [\n  { id: \"mail\", name: \"Postbox\", detail: \"1,204 threads\", icon: MailIcon, tone: \"info\", connected: true },\n  { id: \"cal\", name: \"Daybook\", detail: \"This week\", icon: CalendarDaysIcon, tone: \"orange\", connected: true },\n  { id: \"drive\", name: \"Vault\", detail: \"382 files\", icon: HardDriveIcon, tone: \"teal\", connected: true },\n  { id: \"tracker\", name: \"Linewise\", detail: \"64 open issues\", icon: SquareKanbanIcon, tone: \"amber\", connected: true },\n  { id: \"ledger\", name: \"Tally\", detail: \"Not connected\", icon: ReceiptTextIcon, tone: \"success\", connected: false },\n];\n\nconst defaultSuggestions: AssistantSuggestion[] = [\n  {\n    id: \"s1\",\n    title: \"Catch me up on this week\",\n    description: \"Threads, meetings and decisions you missed\",\n    prompt: \"Catch me up on everything that happened this week across mail and calendar, grouped by project.\",\n    icon: NotebookPenIcon,\n    tone: \"orange\",\n  },\n  {\n    id: \"s2\",\n    title: \"Find renewals at risk\",\n    description: \"Cross-check the tracker with recent emails\",\n    prompt: \"Which Q3 renewals look at risk? Cross-check open issues in Linewise with the latest customer emails.\",\n    icon: TelescopeIcon,\n    tone: \"teal\",\n  },\n  {\n    id: \"s3\",\n    title: \"Brief from a spreadsheet\",\n    description: \"Upload a CSV and get a one-page summary\",\n    prompt: \"Turn the attached spreadsheet into a one-page brief with the three numbers leadership should care about.\",\n    icon: FileSpreadsheetIcon,\n    tone: \"info\",\n  },\n  {\n    id: \"s4\",\n    title: \"Prototype a landing hero\",\n    description: \"Open a canvas with copy and layout ideas\",\n    prompt: \"Sketch three hero sections for the Aurora launch page, each with a headline, subline and CTA.\",\n    icon: PanelsTopLeftIcon,\n    tone: \"amber\",\n  },\n];\n\nconst defaultTools: AssistantTool[] = [\n  { id: \"web\", label: \"Search\", icon: GlobeIcon },\n  { id: \"research\", label: \"Deep research\", icon: TelescopeIcon },\n  { id: \"code\", label: \"Code\", icon: CodeXmlIcon },\n  { id: \"canvas\", label: \"Canvas\", icon: PanelsTopLeftIcon },\n];\n\nconst defaultModels: AssistantModel[] = [\n  { value: \"wren-pro\", label: \"Wren 3 Pro\" },\n  { value: \"wren-flash\", label: \"Wren 3 Flash\" },\n  { value: \"wren-reason\", label: \"Wren 3 Reason\" },\n];\n\nconst defaultPlaceholders = [\n  \"Ask anything, or @mention an app…\",\n  \"Plan my Thursday around the launch review\",\n  \"What did customers say about the new pricing?\",\n  \"Draft a reply to the Halcyon contract thread\",\n];\n\ninterface Message {\n  id: string;\n  role: \"user\" | \"assistant\";\n  text: string;\n  full?: string;\n  steps?: string[];\n  stopped?: boolean;\n}\n\nfunction buildReply(apps: AssistantApp[], files: string[], tools: string[]): { text: string; steps: string[] } {\n  const steps: string[] = [];\n  for (const app of apps) steps.push(`Read ${app.name} · ${app.detail.toLowerCase()}`);\n  if (tools.includes(\"web\")) steps.push(\"Searched the web · 6 sources\");\n  if (tools.includes(\"research\")) steps.push(\"Ran deep research · 4 passes\");\n  for (const file of files) steps.push(`Opened ${file}`);\n  if (steps.length === 0) steps.push(\"Thought for 3 seconds\");\n  const sources = [...apps.map((a) => a.name), ...files];\n  const from =\n    sources.length === 0\n      ? \"\"\n      : ` from ${sources.length === 1 ? sources[0] : `${sources.slice(0, -1).join(\", \")} and ${sources.at(-1)}`}`;\n  const text = [\n    `Here's a first pass${from}.`,\n    \"Three things stand out. The Halcyon and Brightwater threads both mention the October price change, so I'd treat those as one conversation. The launch review moved to Thursday, which leaves a single day to land the press note. And two open Linewise issues are blocking the same customer, which is worth a direct reply rather than a ticket update.\",\n    \"Want me to draft the replies, block time on Thursday, or turn this into a checklist for the team?\",\n  ].join(\"\\n\\n\");\n  return { text, steps };\n}\n\nfunction OrbFilter({ id, blur }: { id: string; blur: number }) {\n  return (\n    <svg aria-hidden className=\"absolute size-0\">\n      <filter colorInterpolationFilters=\"sRGB\" height=\"300%\" id={id} width=\"300%\" x=\"-100%\" y=\"-100%\">\n        <feGaussianBlur in=\"SourceGraphic\" result=\"shape-blur\" stdDeviation={blur} />\n        <feColorMatrix in=\"shape-blur\" result=\"shape\" values=\"1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 24 -11\" />\n        <feGaussianBlur in=\"SourceGraphic\" result=\"tint-blur\" stdDeviation={blur * 1.6} />\n        <feColorMatrix in=\"tint-blur\" result=\"tint\" values=\"1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 60 0\" />\n        <feComposite in=\"tint\" in2=\"shape\" operator=\"in\" />\n      </filter>\n    </svg>\n  );\n}\n\nfunction GooOrb({ className, busy = false, size = 48 }: { className?: string; busy?: boolean; size?: number }) {\n  const id = `orb-${useId().replace(/:/g, \"\")}`;\n  const reduce = useReducedMotion();\n  const k = size / 48;\n  const loop = (duration: number, x: number[], y: number[]) =>\n    reduce\n      ? undefined\n      : {\n          x: x.map((v) => v * k),\n          y: y.map((v) => v * k),\n          transition: { duration, repeat: Infinity, ease: \"easeInOut\" as const },\n        };\n  const blob = \"absolute rounded-full\";\n  return (\n    <span aria-hidden className={cn(\"relative inline-block shrink-0\", className)} style={{ width: size, height: size }}>\n      <OrbFilter blur={3.5 * k} id={id} />\n      <span className=\"absolute inset-0\" style={{ filter: `url(#${id})` }}>\n        <span className={cn(blob, \"inset-[12%] bg-info\")} />\n        <motion.span\n          animate={loop(busy ? 3 : 7, [0, 5, 3, -1, 0], [0, 2, 6, 3, 0])}\n          className={cn(blob, \"top-[20%] left-[20%] size-[38%] bg-success\")}\n        />\n        <motion.span\n          animate={loop(busy ? 3.4 : 8, [0, -4, -6, -1, 0], [0, -5, -1, 2, 0])}\n          className={cn(blob, \"right-[22%] bottom-[22%] size-[34%] bg-info-foreground\")}\n        />\n        <motion.span\n          animate={busy ? loop(2.2, [0, 13, 0], [0, -13, 0]) : loop(6, [0, 2, 0], [0, -2, 0])}\n          className={cn(blob, \"top-[28%] right-[28%] size-[26%] bg-info\")}\n        />\n      </span>\n    </span>\n  );\n}\n\nfunction SendButton({\n  disabled,\n  streaming,\n  onSend,\n  onStop,\n}: {\n  disabled: boolean;\n  streaming: boolean;\n  onSend: () => void;\n  onStop: () => void;\n}) {\n  return (\n    <Button\n      aria-label={streaming ? \"Stop generating\" : \"Send message\"}\n      className=\"rounded-full transition-[box-shadow,scale,opacity] duration-150 ease-out active:scale-[0.97] sm:size-8\"\n      disabled={!streaming && disabled}\n      onClick={streaming ? onStop : onSend}\n      size=\"icon-sm\"\n    >\n      <AnimatePresence initial={false} mode=\"popLayout\">\n        <motion.span\n          animate={{ opacity: 1, scale: 1 }}\n          className=\"flex\"\n          exit={{ opacity: 0, scale: 0.95 }}\n          initial={{ opacity: 0, scale: 0.95 }}\n          key={streaming ? \"stop\" : \"send\"}\n          transition={fade}\n        >\n          {streaming ? <SquareIcon className=\"size-3 fill-current\" /> : <ArrowUpIcon />}\n        </motion.span>\n      </AnimatePresence>\n    </Button>\n  );\n}\n\ninterface PromptBoxProps {\n  value: string;\n  onChange: (v: string) => void;\n  onSubmit: () => void;\n  streaming: boolean;\n  onStop: () => void;\n  tools: AssistantTool[];\n  activeTools: string[];\n  onToggleTool: (id: string) => void;\n  context: AssistantApp[];\n  onRemoveContext: (id: string) => void;\n  files: string[];\n  onAttach: () => void;\n  onRemoveFile: (name: string) => void;\n  models: AssistantModel[];\n  model: string;\n  onModel: (v: string) => void;\n  placeholders: string[];\n  compact?: boolean;\n  textareaRef: RefObject<HTMLTextAreaElement | null>;\n}\n\nfunction PromptBox({\n  value,\n  onChange,\n  onSubmit,\n  streaming,\n  onStop,\n  tools,\n  activeTools,\n  onToggleTool,\n  context,\n  onRemoveContext,\n  files,\n  onAttach,\n  onRemoveFile,\n  models,\n  model,\n  onModel,\n  placeholders,\n  compact,\n  textareaRef,\n}: PromptBoxProps) {\n  const reduce = useReducedMotion();\n  const [ph, setPh] = useState(0);\n  const inputId = useId();\n\n  useEffect(() => {\n    if (reduce || value || placeholders.length < 2) return;\n    const t = setInterval(() => setPh((p) => (p + 1) % placeholders.length), 3200);\n    return () => clearInterval(t);\n  }, [reduce, value, placeholders.length]);\n\n  const onKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {\n    if (e.key === \"Enter\" && !e.shiftKey && !e.nativeEvent.isComposing) {\n      e.preventDefault();\n      if (value.trim()) onSubmit();\n    }\n  };\n\n  const chips = [\n    ...context.map((app) => ({ key: `app-${app.id}`, label: app.name, icon: app.icon, tone: app.tone, remove: () => onRemoveContext(app.id) })),\n    ...files.map((f) => ({ key: `file-${f}`, label: f, icon: FileSpreadsheetIcon, tone: \"success\" as AssistantTone, remove: () => onRemoveFile(f) })),\n  ];\n\n  return (\n    <motion.div\n      className=\"@container relative rounded-2xl border bg-card shadow-xs/5 transition-[border-color,box-shadow] focus-within:border-ring/64 focus-within:ring-[3px] focus-within:ring-ring/16\"\n      layoutId=\"assistant-prompt\"\n      transition={softSpring}\n    >\n      <AnimatePresence initial={false}>\n        {chips.length > 0 && (\n          <motion.div\n            animate={{ height: \"auto\", opacity: 1 }}\n            className=\"overflow-hidden\"\n            exit={{ height: 0, opacity: 0 }}\n            initial={{ height: 0, opacity: 0 }}\n            transition={spring}\n          >\n            <div className=\"flex flex-wrap gap-1.5 px-3 pt-3\">\n              <AnimatePresence mode=\"popLayout\" initial={false}>\n                {chips.map((c) => (\n                  <motion.span\n                    animate={{ opacity: 1, scale: 1 }}\n                    className=\"inline-flex h-6 items-center gap-1.5 rounded-full border bg-background ps-0.5 pe-1 text-xs\"\n                    exit={{ opacity: 0, scale: 0.95 }}\n                    initial={{ opacity: 0, scale: 0.95 }}\n                    key={c.key}\n                    layout\n                    transition={spring}\n                  >\n                    <span className={cn(\"flex size-5 items-center justify-center rounded-full\", tileTone[c.tone])}>\n                      <c.icon className=\"size-3\" />\n                    </span>\n                    <span className=\"max-w-36 truncate font-medium\">{c.label}</span>\n                    <button\n                      aria-label={`Remove ${c.label}`}\n                      className=\"relative flex size-4 cursor-pointer items-center justify-center rounded-full text-muted-foreground outline-none after:absolute after:-inset-2 hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n                      onClick={c.remove}\n                      type=\"button\"\n                    >\n                      <XIcon className=\"size-3\" />\n                    </button>\n                  </motion.span>\n                ))}\n              </AnimatePresence>\n            </div>\n          </motion.div>\n        )}\n      </AnimatePresence>\n\n      <div className=\"relative\">\n        <label className=\"sr-only\" htmlFor={inputId}>\n          Message\n        </label>\n        <textarea\n          className={cn(\n            \"field-sizing-content block max-h-44 w-full resize-none bg-transparent px-4 pt-3.5 text-foreground text-sm/6 outline-none\",\n            compact ? \"min-h-12\" : \"min-h-22\",\n          )}\n          id={inputId}\n          onChange={(e) => onChange(e.target.value)}\n          onKeyDown={onKeyDown}\n          ref={textareaRef}\n          rows={1}\n          value={value}\n        />\n        {!value && (\n          <div aria-hidden className=\"pointer-events-none absolute inset-x-4 top-3.5 overflow-hidden text-muted-foreground/72 text-sm/6\">\n            <AnimatePresence initial={false} mode=\"wait\">\n              <motion.span\n                animate={{ opacity: 1, y: 0, filter: \"blur(0px)\" }}\n                className=\"block truncate\"\n                exit={{ opacity: 0, y: -6, filter: \"blur(2px)\" }}\n                initial={{ opacity: 0, y: 6, filter: \"blur(2px)\" }}\n                key={ph}\n                transition={fade}\n              >\n                {placeholders[ph] ?? \"\"}\n              </motion.span>\n            </AnimatePresence>\n          </div>\n        )}\n      </div>\n\n      <div className=\"flex items-center gap-1 p-2 ps-2.5\">\n        <Tooltip>\n          <TooltipTrigger\n            render={<Button aria-label=\"Attach a file\" className=\"sm:size-8\" onClick={onAttach} size=\"icon-sm\" variant=\"ghost\" />}\n          >\n            <PaperclipIcon />\n          </TooltipTrigger>\n          <TooltipPopup>Attach a file</TooltipPopup>\n        </Tooltip>\n        <div className=\"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto [scrollbar-width:none]\">\n          {tools.map((t) => {\n            const on = activeTools.includes(t.id);\n            return (\n              <motion.button\n                aria-label={t.label}\n                aria-pressed={on}\n                className={cn(\n                  \"inline-flex h-8 min-w-8 shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-full border px-2 font-medium @lg:px-2.5 text-xs outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring\",\n                  on\n                    ? \"border-info/32 bg-info/10 text-info-foreground\"\n                    : \"border-transparent text-muted-foreground hover:bg-accent hover:text-foreground\",\n                )}\n                key={t.id}\n                layout\n                onClick={() => onToggleTool(t.id)}\n                transition={spring}\n                type=\"button\"\n                whileTap={{ scale: 0.97 }}\n              >\n                <t.icon className=\"size-3.5 shrink-0\" />\n                <span className=\"hidden @lg:inline\">{t.label}</span>\n              </motion.button>\n            );\n          })}\n        </div>\n        <Select items={models} onValueChange={(v) => v && onModel(v as string)} value={model}>\n          <SelectTrigger\n            aria-label=\"Model\"\n            className=\"w-auto min-w-0 shrink-0 border-transparent bg-transparent text-sm shadow-none before:hidden hover:bg-accent dark:bg-transparent\"\n            size=\"sm\"\n          >\n            <SelectValue />\n          </SelectTrigger>\n          <SelectPopup align=\"end\">\n            {models.map((m) => (\n              <SelectItem key={m.value} value={m.value}>\n                {m.label}\n              </SelectItem>\n            ))}\n          </SelectPopup>\n        </Select>\n        <SendButton disabled={!value.trim()} onSend={onSubmit} onStop={onStop} streaming={streaming} />\n      </div>\n    </motion.div>\n  );\n}\n\ninterface SidebarBodyProps {\n  productName: string;\n  userName: string;\n  userInitials: string;\n  plan: string;\n  chats: AssistantChat[];\n  projects: AssistantProject[];\n  activeChat: string | null;\n  onOpenChat: (chat: AssistantChat) => void;\n  onNewChat: () => void;\n  onClose?: () => void;\n}\n\nfunction SidebarBody({\n  productName,\n  userName,\n  userInitials,\n  plan,\n  chats,\n  projects,\n  activeChat,\n  onOpenChat,\n  onNewChat,\n  onClose,\n}: SidebarBodyProps) {\n  const [query, setQuery] = useState(\"\");\n  const [project, setProject] = useState<string | null>(null);\n  const [nav, setNav] = useState(\"home\");\n  const groupId = useId();\n\n  const visible = chats.filter(\n    (c) => (!project || c.projectId === project) && c.title.toLowerCase().includes(query.trim().toLowerCase()),\n  );\n  const navItems = [\n    { id: \"home\", label: \"Home\", icon: HouseIcon },\n    { id: \"agents\", label: \"Agents\", icon: BotIcon },\n    { id: \"library\", label: \"Library\", icon: LibraryIcon },\n  ];\n\n  return (\n    <LayoutGroup id={groupId}>\n      <div className=\"flex h-full min-h-0 flex-col\">\n        <div className=\"flex items-center gap-2 px-3 pt-3 pb-2\">\n          <span className=\"flex size-7 items-center justify-center rounded-lg bg-primary text-primary-foreground\">\n            <FeatherIcon className=\"size-4\" />\n          </span>\n          <span className=\"font-heading font-semibold\">{productName}</span>\n          {onClose ? (\n            <Button aria-label=\"Close sidebar\" className=\"ms-auto sm:size-8\" onClick={onClose} size=\"icon-sm\" variant=\"ghost\">\n              <XIcon />\n            </Button>\n          ) : (\n            <Badge className=\"ms-auto\" variant=\"outline\">\n              {plan}\n            </Badge>\n          )}\n        </div>\n\n        <div className=\"flex flex-col gap-2 px-3 pb-2\">\n          <Button className=\"justify-start\" onClick={onNewChat} variant=\"outline\">\n            <SquarePenIcon />\n            New chat\n            <Kbd className=\"ms-auto dark:text-foreground\">⌘ N</Kbd>\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              value={query}\n            />\n          </InputGroup>\n        </div>\n\n        <nav aria-label=\"Main\" className=\"flex flex-col gap-0.5 px-2 py-1\">\n          {navItems.map((n) => (\n            <button\n              aria-current={nav === n.id ? \"page\" : undefined}\n              className={cn(\n                \"relative flex h-8 cursor-pointer items-center gap-2.5 rounded-lg px-2.5 font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n                nav === n.id ? \"text-foreground\" : \"text-muted-foreground hover:text-foreground\",\n              )}\n              key={n.id}\n              onClick={() => setNav(n.id)}\n              type=\"button\"\n            >\n              {nav === n.id && (\n                <motion.span className=\"absolute inset-0 -z-0 rounded-lg bg-accent\" layoutId=\"nav-pill\" transition={spring} />\n              )}\n              <n.icon className=\"relative size-4\" />\n              <span className=\"relative\">{n.label}</span>\n            </button>\n          ))}\n        </nav>\n\n        <div className=\"min-h-0 flex-1 overflow-y-auto px-2 pb-2\">\n          <div className=\"flex items-center justify-between px-2.5 pt-4 pb-1.5\">\n            <span className=\"font-medium text-muted-foreground text-xs\">Projects</span>\n            <Button aria-label=\"New project\" className=\"after:absolute after:-inset-1\" size=\"icon-xs\" variant=\"ghost\">\n              <PlusIcon />\n            </Button>\n          </div>\n          <div className=\"flex flex-col gap-0.5\">\n            {projects.map((p) => {\n              const on = project === p.id;\n              return (\n                <button\n                  aria-pressed={on}\n                  className={cn(\n                    \"relative flex h-8 cursor-pointer items-center gap-2.5 rounded-lg px-2.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n                    on ? \"text-foreground\" : \"text-muted-foreground hover:bg-accent/60 hover:text-foreground\",\n                  )}\n                  key={p.id}\n                  onClick={() => setProject(on ? null : p.id)}\n                  type=\"button\"\n                >\n                  {on && <motion.span className=\"absolute inset-0 rounded-lg bg-accent\" layoutId=\"project-pill\" transition={spring} />}\n                  <motion.span\n                    animate={{ scale: on ? 1.35 : 1 }}\n                    className={cn(\"relative size-2 rounded-full\", dotTone[p.tone])}\n                    transition={spring}\n                  />\n                  <span className=\"relative truncate\">{p.name}</span>\n                  <span className=\"relative ms-auto text-muted-foreground text-xs tabular-nums\">\n                    {chats.filter((c) => c.projectId === p.id).length}\n                  </span>\n                </button>\n              );\n            })}\n          </div>\n\n          <div className=\"flex items-center justify-between px-2.5 pt-4 pb-1.5\">\n            <span className=\"font-medium text-muted-foreground text-xs\">\n              {project ? projects.find((p) => p.id === project)?.name : \"Recent\"}\n            </span>\n            {project && (\n              <button\n                className=\"relative -my-1 cursor-pointer rounded-md px-1.5 py-1 text-muted-foreground text-xs outline-none after:absolute after:-inset-y-1 after:inset-x-0 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n                onClick={() => setProject(null)}\n                type=\"button\"\n              >\n                Show all\n              </button>\n            )}\n          </div>\n          <ul className=\"flex flex-col gap-0.5\">\n            <AnimatePresence initial={false} mode=\"popLayout\">\n              {visible.map((c) => (\n                <motion.li\n                  animate={{ opacity: 1, x: 0 }}\n                  exit={{ opacity: 0, x: -6 }}\n                  initial={{ opacity: 0, x: -6 }}\n                  key={c.id}\n                  layout\n                  transition={spring}\n                >\n                  <button\n                    aria-current={activeChat === c.id ? \"true\" : undefined}\n                    className={cn(\n                      \"group/chat flex h-8 w-full cursor-pointer items-center gap-2 rounded-lg px-2.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n                      activeChat === c.id ? \"bg-accent text-foreground\" : \"text-muted-foreground hover:bg-accent/60 hover:text-foreground\",\n                    )}\n                    onClick={() => onOpenChat(c)}\n                    type=\"button\"\n                  >\n                    <span className=\"min-w-0 flex-1 truncate\">{c.title}</span>\n                    <span className=\"shrink-0 text-muted-foreground text-xs tabular-nums\">{c.time}</span>\n                  </button>\n                </motion.li>\n              ))}\n            </AnimatePresence>\n            {visible.length === 0 && <li className=\"px-2.5 py-2 text-muted-foreground text-xs\">No chats match.</li>}\n          </ul>\n        </div>\n\n        <div className=\"flex items-center gap-2.5 border-t p-3\">\n          <Avatar className=\"size-8\">\n            <AvatarFallback className=\"bg-teal-500/12 text-teal-700 dark:bg-teal-400/14 dark:text-teal-300 text-xs\">{userInitials}</AvatarFallback>\n          </Avatar>\n          <div className=\"min-w-0 flex-1\">\n            <div className=\"truncate font-medium\">{userName}</div>\n            <div className=\"truncate text-muted-foreground text-xs\">Northlight Studio</div>\n          </div>\n          <Menu>\n            <MenuTrigger render={<Button aria-label=\"Account menu\" className=\"sm:size-8\" size=\"icon-sm\" variant=\"ghost\" />}>\n              <EllipsisIcon />\n            </MenuTrigger>\n            <MenuPopup align=\"end\" side=\"top\">\n              <MenuItem>\n                <SettingsIcon />\n                Settings\n              </MenuItem>\n              <MenuItem>\n                <SparklesIcon />\n                Upgrade plan\n              </MenuItem>\n              <MenuSeparator />\n              <MenuItem>\n                <LogOutIcon />\n                Sign out\n              </MenuItem>\n            </MenuPopup>\n          </Menu>\n        </div>\n      </div>\n    </LayoutGroup>\n  );\n}\n\nfunction FadeScroller({ children, className }: { children: ReactNode; className?: string }) {\n  const ref = useRef<HTMLDivElement>(null);\n  const [edges, setEdges] = useState({ start: false, end: false });\n\n  useEffect(() => {\n    const el = ref.current;\n    if (!el) return;\n    const measure = () => {\n      const max = el.scrollWidth - el.clientWidth;\n      setEdges({ start: el.scrollLeft > 1, end: el.scrollLeft < max - 1 });\n    };\n    measure();\n    el.addEventListener(\"scroll\", measure, { passive: true });\n    const observer = new ResizeObserver(measure);\n    observer.observe(el);\n    for (const child of el.children) observer.observe(child);\n    return () => {\n      el.removeEventListener(\"scroll\", measure);\n      observer.disconnect();\n    };\n  }, []);\n\n  return (\n    <div\n      className={cn(\"overflow-x-auto [scrollbar-width:none]\", className)}\n      ref={ref}\n      style={{\n        maskImage: `linear-gradient(to right, ${edges.start ? \"transparent, black 1.5rem\" : \"black, black\"}, ${edges.end ? \"black calc(100% - 1.5rem), transparent\" : \"black, black\"})`,\n      }}\n    >\n      {children}\n    </div>\n  );\n}\n\nfunction AppPill({\n  app,\n  selected,\n  connecting,\n  onClick,\n}: {\n  app: AssistantApp;\n  selected: boolean;\n  connecting: boolean;\n  onClick: () => void;\n}) {\n  return (\n    <motion.button\n      aria-pressed={app.connected ? selected : undefined}\n      className={cn(\n        \"inline-flex h-7 shrink-0 cursor-pointer items-center gap-1.5 rounded-full border ps-1 pe-2.5 font-medium text-xs outline-none transition-[background-color,border-color,color] duration-150 ease-out focus-visible:ring-2 focus-visible:ring-ring\",\n        selected\n          ? \"border-info/40 bg-info/10 text-info-foreground\"\n          : app.connected\n            ? \"border-border bg-background text-foreground/80 hover:border-input hover:text-foreground\"\n            : \"border-dashed bg-transparent text-muted-foreground hover:bg-background hover:text-foreground\",\n      )}\n      layout\n      onClick={onClick}\n      transition={spring}\n      type=\"button\"\n      whileTap={{ scale: 0.97 }}\n    >\n      <span className={cn(\"relative flex size-5 items-center justify-center rounded-full\", tileTone[app.tone], !app.connected && !connecting && \"opacity-64\")}>\n        <AnimatePresence initial={false} mode=\"popLayout\">\n          {connecting ? (\n            <motion.span animate={{ opacity: 1 }} className=\"flex\" exit={{ opacity: 0 }} initial={{ opacity: 0 }} key=\"spin\">\n              <LoaderCircleIcon className=\"size-3 animate-spin\" />\n            </motion.span>\n          ) : selected ? (\n            <motion.span\n              animate={{ opacity: 1, scale: 1 }}\n              className=\"flex\"\n              exit={{ opacity: 0, scale: 0.9 }}\n              initial={{ opacity: 0, scale: 0.9 }}\n              key=\"on\"\n              transition={spring}\n            >\n              <CheckIcon className=\"size-3\" strokeWidth={3} />\n            </motion.span>\n          ) : (\n            <motion.span animate={{ opacity: 1 }} className=\"flex\" exit={{ opacity: 0 }} initial={{ opacity: 0 }} key=\"icon\">\n              <app.icon className=\"size-3\" />\n            </motion.span>\n          )}\n        </AnimatePresence>\n      </span>\n      {connecting ? \"Connecting…\" : app.name}\n      {!app.connected && !connecting && <PlusIcon className=\"-me-0.5 size-3\" />}\n    </motion.button>\n  );\n}\n\nexport function AssistantStart({\n  productName = \"Wren\",\n  userName = \"Mara Okafor\",\n  userInitials = \"MO\",\n  plan = \"Pro\",\n  greeting = \"Good afternoon\",\n  chats: chatsProp = defaultChats,\n  projects = defaultProjects,\n  apps: appsProp = defaultApps,\n  suggestions = defaultSuggestions,\n  tools = defaultTools,\n  models = defaultModels,\n  placeholders = defaultPlaceholders,\n  className,\n}: AssistantStartProps) {\n  const reduce = useReducedMotion();\n  const mainGroup = useId();\n  const [drawer, setDrawer] = useState(false);\n  const [chats, setChats] = useState(chatsProp);\n  const [apps, setApps] = useState(appsProp);\n  const [prompt, setPrompt] = useState(\"\");\n  const [activeTools, setActiveTools] = useState<string[]>([\"web\"]);\n  const [contextIds, setContextIds] = useState<string[]>([]);\n  const [files, setFiles] = useState<string[]>([]);\n  const [model, setModel] = useState(models[0]?.value ?? \"\");\n  const [connecting, setConnecting] = useState<string | null>(null);\n  const [messages, setMessages] = useState<Message[]>([]);\n  const [stream, setStream] = useState<{ id: string; words: number } | null>(null);\n  const [activeChat, setActiveChat] = useState<string | null>(null);\n  const textareaRef = useRef<HTMLTextAreaElement>(null);\n  const drawerRef = useRef<HTMLDivElement>(null);\n  const scrollRef = useRef<HTMLDivElement>(null);\n  const typeTimer = useRef<ReturnType<typeof setInterval> | null>(null);\n  const connectTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n  const context = useMemo(() => apps.filter((a) => contextIds.includes(a.id)), [apps, contextIds]);\n  const firstName = userName.split(\" \")[0];\n\n  useEffect(() => {\n    if (drawer) drawerRef.current?.focus();\n  }, [drawer]);\n\n  useEffect(\n    () => () => {\n      if (typeTimer.current) clearInterval(typeTimer.current);\n      if (connectTimer.current) clearTimeout(connectTimer.current);\n    },\n    [],\n  );\n\n  const streamingMessage = stream ? messages.find((m) => m.id === stream.id) : undefined;\n  const totalWords = streamingMessage ? streamingMessage.text.split(\" \").length : 0;\n\n  useEffect(() => {\n    if (!stream) return;\n    if (stream.words >= totalWords) {\n      setStream(null);\n      return;\n    }\n    const t = setTimeout(\n      () => setStream((s) => (s ? { ...s, words: s.words + (reduce ? totalWords : 2) } : s)),\n      stream.words === 0 ? 900 : 45,\n    );\n    return () => clearTimeout(t);\n  }, [stream, totalWords, reduce]);\n\n  useEffect(() => {\n    if (!messages.length) return;\n    const el = scrollRef.current;\n    if (!el) return;\n    const raf = requestAnimationFrame(() => {\n      el.scrollTop = el.scrollHeight;\n    });\n    return () => cancelAnimationFrame(raf);\n  }, [stream, messages]);\n\n  const ask = (text: string, chatId?: string) => {\n    const reply = buildReply(context, files, activeTools);\n    const now = Date.now().toString(36);\n    const assistantId = `a-${now}`;\n    const pair: Message[] = [\n      { id: `u-${now}`, role: \"user\", text },\n      { id: assistantId, role: \"assistant\", text: reply.text, full: reply.text, steps: reply.steps },\n    ];\n    setMessages((m) => (chatId ? pair : [...m, ...pair]));\n    setStream({ id: assistantId, words: 0 });\n    if (chatId) {\n      setActiveChat(chatId);\n    } else if (messages.length === 0) {\n      const id = `new-${now}`;\n      const title = text.length > 48 ? `${text.slice(0, 46).trimEnd()}…` : text;\n      setChats((c) => [{ id, title, time: \"now\" }, ...c]);\n      setActiveChat(id);\n    }\n  };\n\n  const submit = () => {\n    const text = prompt.trim();\n    if (!text || stream) return;\n    if (typeTimer.current) clearInterval(typeTimer.current);\n    setPrompt(\"\");\n    ask(text);\n  };\n\n  const stop = () => {\n    if (!stream) return;\n    const { id, words } = stream;\n    setMessages((ms) =>\n      ms.map((m) => {\n        if (m.id !== id) return m;\n        const kept = m.text.split(\" \").slice(0, words).join(\" \").replace(/[\\s,.;:]+$/, \"\");\n        return { ...m, text: kept ? `${kept}…` : \"\", stopped: true };\n      }),\n    );\n    setStream(null);\n  };\n\n  const regenerate = (id: string) => {\n    if (stream) return;\n    setMessages((ms) => ms.map((m) => (m.id === id ? { ...m, text: m.full ?? m.text, stopped: false } : m)));\n    setStream({ id, words: 0 });\n  };\n\n  const newChat = () => {\n    setMessages([]);\n    setStream(null);\n    setActiveChat(null);\n    setPrompt(\"\");\n    setDrawer(false);\n    requestAnimationFrame(() => textareaRef.current?.focus());\n  };\n\n  const openChat = (chat: AssistantChat) => {\n    setDrawer(false);\n    ask(chat.title, chat.id);\n  };\n\n  const fillPrompt = (text: string) => {\n    if (typeTimer.current) clearInterval(typeTimer.current);\n    textareaRef.current?.focus();\n    if (reduce) {\n      setPrompt(text);\n      return;\n    }\n    let i = 0;\n    typeTimer.current = setInterval(() => {\n      i = Math.min(text.length, i + 6);\n      setPrompt(text.slice(0, i));\n      if (i >= text.length && typeTimer.current) clearInterval(typeTimer.current);\n    }, 16);\n  };\n\n  const onAppClick = (app: AssistantApp) => {\n    if (connecting) return;\n    if (!app.connected) {\n      setConnecting(app.id);\n      connectTimer.current = setTimeout(() => {\n        setApps((all) => all.map((a) => (a.id === app.id ? { ...a, connected: true, detail: \"Last 90 days\" } : a)));\n        setContextIds((ids) => [...ids, app.id]);\n        setConnecting(null);\n      }, 1400);\n      return;\n    }\n    setContextIds((ids) => (ids.includes(app.id) ? ids.filter((x) => x !== app.id) : [...ids, app.id]));\n  };\n\n  const promptBox = (compact: boolean) => (\n    <PromptBox\n      activeTools={activeTools}\n      compact={compact}\n      context={context}\n      files={files}\n      model={model}\n      models={models}\n      onAttach={() =>\n        setFiles((f) => (f.includes(\"q3-renewals.csv\") ? [...f, `notes-${f.length}.pdf`] : [...f, \"q3-renewals.csv\"]))\n      }\n      onChange={(v) => {\n        if (typeTimer.current) clearInterval(typeTimer.current);\n        setPrompt(v);\n      }}\n      onModel={setModel}\n      onRemoveContext={(id) => setContextIds((ids) => ids.filter((x) => x !== id))}\n      onRemoveFile={(name) => setFiles((f) => f.filter((x) => x !== name))}\n      onStop={stop}\n      onSubmit={submit}\n      streaming={stream !== null}\n      onToggleTool={(id) => setActiveTools((t) => (t.includes(id) ? t.filter((x) => x !== id) : [...t, id]))}\n      placeholders={compact ? [\"Reply to Wren…\"] : placeholders}\n      textareaRef={textareaRef}\n      tools={tools}\n      value={prompt}\n    />\n  );\n\n  const sidebarProps: SidebarBodyProps = {\n    productName,\n    userName,\n    userInitials,\n    plan,\n    chats,\n    projects,\n    activeChat,\n    onOpenChat: openChat,\n    onNewChat: newChat,\n  };\n\n  const inChat = messages.length > 0;\n  const chatTitle = chats.find((c) => c.id === activeChat)?.title ?? \"New chat\";\n\n  return (\n    <MotionConfig reducedMotion=\"user\">\n      <div\n        className={cn(\n          \"@container relative isolate flex h-[760px] w-full overflow-hidden bg-background text-foreground text-sm\",\n          className,\n        )}\n        onKeyDown={(e) => {\n          if (e.key === \"Escape\" && drawer) setDrawer(false);\n        }}\n      >\n        <aside className=\"hidden w-64 shrink-0 border-e bg-muted/40 @3xl:block\">\n          <SidebarBody {...sidebarProps} />\n        </aside>\n\n        <AnimatePresence>\n          {drawer && (\n            <>\n              <motion.div\n                animate={{ opacity: 1 }}\n                aria-hidden\n                className=\"absolute inset-0 z-40 bg-black/32 @3xl:hidden\"\n                exit={{ opacity: 0 }}\n                initial={{ opacity: 0 }}\n                onClick={() => setDrawer(false)}\n              />\n              <motion.div\n                animate={{ x: 0 }}\n                aria-label=\"Navigation\"\n                aria-modal=\"true\"\n                className=\"absolute inset-y-0 left-0 z-50 w-72 max-w-[85%] border-e bg-background shadow-xs/5 outline-none @3xl:hidden\"\n                exit={{ x: \"-104%\" }}\n                initial={{ x: \"-104%\" }}\n                ref={drawerRef}\n                role=\"dialog\"\n                tabIndex={-1}\n                transition={spring}\n              >\n                <SidebarBody {...sidebarProps} onClose={() => setDrawer(false)} />\n              </motion.div>\n            </>\n          )}\n        </AnimatePresence>\n\n        <LayoutGroup id={mainGroup}>\n          <main className=\"flex min-w-0 flex-1 flex-col\">\n            <header className=\"flex h-12 shrink-0 items-center gap-2 border-b px-2 @3xl:hidden\">\n              <Button aria-label=\"Open sidebar\" className=\"sm:size-8\" onClick={() => setDrawer(true)} size=\"icon-sm\" variant=\"ghost\">\n                <MenuIcon />\n              </Button>\n              <span className=\"flex items-center gap-1.5 font-heading font-semibold\">\n                <FeatherIcon className=\"size-4\" />\n                {productName}\n              </span>\n              <Button aria-label=\"New chat\" className=\"ms-auto sm:size-8\" onClick={newChat} size=\"icon-sm\" variant=\"ghost\">\n                <SquarePenIcon />\n              </Button>\n            </header>\n\n            {inChat ? (\n              <>\n                <div className=\"flex h-12 shrink-0 items-center gap-2 border-b px-3 @3xl:px-5\">\n                  <Button aria-label=\"Back to home\" className=\"sm:size-8\" onClick={newChat} size=\"icon-sm\" variant=\"ghost\">\n                    <ArrowLeftIcon />\n                  </Button>\n                  <span className=\"min-w-0 flex-1 truncate font-medium\">{chatTitle}</span>\n                  <Badge className=\"hidden @md:inline-flex\" variant=\"outline\">\n                    {models.find((m) => m.value === model)?.label}\n                  </Badge>\n                </div>\n                <motion.div className=\"min-h-0 flex-1 overflow-y-auto\" layoutScroll ref={scrollRef}>\n                  <div className=\"mx-auto flex max-w-2xl flex-col gap-6 px-4 py-6 @3xl:px-8\">\n                    {messages.map((m) =>\n                      m.role === \"user\" ? (\n                        <motion.div\n                          animate={{ opacity: 1, y: 0 }}\n                          className=\"ms-auto max-w-[85%] text-pretty rounded-2xl rounded-br-md bg-muted px-4 py-2.5\"\n                          initial={{ opacity: 0, y: 8 }}\n                          key={m.id}\n                          transition={softSpring}\n                        >\n                          {m.text}\n                        </motion.div>\n                      ) : (\n                        <AssistantMessage\n                          key={m.id}\n                          message={m}\n                          onRegenerate={stream ? undefined : () => regenerate(m.id)}\n                          productName={productName}\n                          words={stream?.id === m.id ? stream.words : undefined}\n                        />\n                      ),\n                    )}\n                  </div>\n                </motion.div>\n                <div className=\"mx-auto w-full max-w-2xl shrink-0 px-3 @3xl:px-8\">{promptBox(true)}</div>\n                <p className=\"shrink-0 px-4 py-2.5 text-center text-muted-foreground text-xs\">\n                  {productName} can make mistakes. Check what matters.\n                </p>\n              </>\n            ) : (\n              <motion.div className=\"flex min-h-0 flex-1 flex-col overflow-y-auto\" layoutScroll>\n                <div className=\"m-auto flex w-full max-w-2xl flex-col px-4 py-10 @3xl:px-8\">\n                  <motion.div\n                    animate={{ opacity: 1, y: 0 }}\n                    className=\"mb-8 flex flex-col items-center gap-5 text-center\"\n                    initial={{ opacity: 0, y: 8 }}\n                    transition={softSpring}\n                  >\n                    <GooOrb size={48} />\n                    <h1 className=\"text-balance font-medium text-2xl tracking-tight @3xl:text-[1.875rem] @3xl:leading-tight\">\n                      {greeting}, {firstName}\n                    </h1>\n                  </motion.div>\n\n                  <div className=\"relative z-10\">{promptBox(false)}</div>\n\n                  <div className=\"-mt-3 rounded-b-2xl border border-t-0 bg-muted/48 px-3 pt-5.5 pb-2.5\">\n                    <div className=\"flex items-center gap-2\">\n                      <span className=\"shrink-0 text-muted-foreground text-xs\">Context</span>\n                      <FadeScroller className=\"-my-1 flex min-w-0 flex-1 items-center gap-1.5 py-1\">\n                        {apps.map((a) => (\n                          <AppPill\n                            app={a}\n                            connecting={connecting === a.id}\n                            key={a.id}\n                            onClick={() => onAppClick(a)}\n                            selected={contextIds.includes(a.id)}\n                          />\n                        ))}\n                        <button\n                          className=\"inline-flex h-7 shrink-0 cursor-pointer items-center gap-1 rounded-full px-2 text-muted-foreground text-xs outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n                          type=\"button\"\n                        >\n                          40+ apps\n                          <ArrowUpRightIcon className=\"size-3\" />\n                        </button>\n                      </FadeScroller>\n                    </div>\n                  </div>\n\n                  <div className=\"mt-6 flex flex-wrap justify-center gap-2\">\n                    {suggestions.map((s, i) => (\n                      <motion.button\n                        animate={{ opacity: 1, y: 0 }}\n                        className=\"inline-flex h-8 cursor-pointer items-center gap-2 rounded-full border bg-background px-3 text-muted-foreground text-xs outline-none transition-[background-color,border-color,color] duration-150 ease-out hover:border-input hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring @3xl:text-sm\"\n                        initial={{ opacity: 0, y: 6 }}\n                        key={s.id}\n                        onClick={() => fillPrompt(s.prompt)}\n                        title={s.description}\n                        transition={{ ...softSpring, delay: 0.04 + 0.03 * Math.min(i, 6) }}\n                        type=\"button\"\n                        whileTap={{ scale: 0.97 }}\n                      >\n                        <s.icon className={cn(\"size-3.5 shrink-0 rounded-sm\", tileTone[s.tone], \"bg-transparent dark:bg-transparent\")} />\n                        {s.title}\n                      </motion.button>\n                    ))}\n                  </div>\n                </div>\n                <p className=\"mt-auto shrink-0 px-4 py-2.5 text-center text-muted-foreground text-xs\">\n                  {productName} can make mistakes. Check what matters.\n                </p>\n              </motion.div>\n            )}\n          </main>\n        </LayoutGroup>\n      </div>\n    </MotionConfig>\n  );\n}\n\nfunction AssistantMessage({\n  message,\n  productName,\n  words,\n  onRegenerate,\n}: {\n  message: Message;\n  productName: string;\n  words?: number;\n  onRegenerate?: () => void;\n}) {\n  const streaming = words !== undefined;\n  const all = message.text.split(\" \");\n  const shown = streaming ? all.slice(0, words).join(\" \") : message.text;\n  const thinking = streaming && words === 0;\n  const paragraphs = shown.split(\"\\n\\n\").filter((p) => p.trim());\n  const [copied, setCopied] = useState(false);\n  const [liked, setLiked] = useState(false);\n\n  useEffect(() => {\n    if (!copied) return;\n    const t = setTimeout(() => setCopied(false), 1400);\n    return () => clearTimeout(t);\n  }, [copied]);\n\n  const action = \"text-muted-foreground transition-[scale,background-color,color] duration-150 ease-out active:scale-[0.97] sm:size-8\";\n\n  return (\n    <motion.div animate={{ opacity: 1 }} className=\"flex gap-3\" initial={{ opacity: 0 }} transition={fade}>\n      <GooOrb busy={streaming} className=\"mt-px\" size={28} />\n      <div className=\"min-w-0 flex-1\">\n        <div className=\"mb-2 flex h-7 items-center gap-2\">\n          <span className=\"font-medium\">{productName}</span>\n          <AnimatePresence initial={false}>\n            {thinking && (\n              <motion.span\n                animate={{ opacity: 1 }}\n                className=\"text-muted-foreground text-xs\"\n                exit={{ opacity: 0 }}\n                initial={{ opacity: 0 }}\n                transition={fade}\n              >\n                Thinking…\n              </motion.span>\n            )}\n          </AnimatePresence>\n        </div>\n        {message.steps && (\n          <ul aria-label=\"Steps\" className=\"mb-3 flex flex-wrap gap-1.5\">\n            {message.steps.map((s, i) => (\n              <motion.li\n                animate={{ opacity: 1, scale: 1 }}\n                className=\"inline-flex h-6 items-center gap-1.5 rounded-full border bg-card px-2 text-muted-foreground text-xs\"\n                initial={{ opacity: 0, scale: 0.95 }}\n                key={s}\n                transition={{ ...fade, delay: 0.04 * Math.min(i, 5) }}\n              >\n                {thinking ? (\n                  <LoaderCircleIcon className=\"size-3 animate-spin\" />\n                ) : (\n                  <CheckIcon className=\"size-3 text-success-foreground\" />\n                )}\n                {s}\n              </motion.li>\n            ))}\n          </ul>\n        )}\n        <div aria-live=\"polite\" className=\"flex flex-col gap-3 text-pretty text-sm/6\">\n          {paragraphs.map((p, i) => (\n            <p key={`${message.id}-${i}`}>\n              {p}\n              {streaming && !thinking && i === paragraphs.length - 1 && (\n                <motion.span\n                  animate={{ opacity: [1, 0.25, 1] }}\n                  aria-hidden\n                  className=\"ms-0.5 inline-block h-4 w-1.5 translate-y-0.5 rounded-full bg-foreground/60\"\n                  transition={{ duration: 1, repeat: Infinity, ease: \"easeInOut\" }}\n                />\n              )}\n            </p>\n          ))}\n        </div>\n        {message.stopped && (\n          <p className=\"mt-2 text-muted-foreground text-xs\">\n            {paragraphs.length ? \"Stopped early.\" : \"Stopped before replying.\"}\n          </p>\n        )}\n        {!streaming && (\n          <motion.div animate={{ opacity: 1 }} className=\"mt-2 -ms-1.5 flex gap-0.5\" initial={{ opacity: 0 }} transition={fade}>\n            <Button\n              aria-label={copied ? \"Copied\" : \"Copy reply\"}\n              className={action}\n              disabled={!paragraphs.length}\n              onClick={() => {\n                navigator.clipboard?.writeText(message.text).catch(() => {});\n                setCopied(true);\n              }}\n              size=\"icon-sm\"\n              variant=\"ghost\"\n            >\n              {copied ? <CheckIcon /> : <CopyIcon />}\n            </Button>\n            <Button\n              aria-label=\"Good reply\"\n              aria-pressed={liked}\n              className={cn(action, liked && \"text-info-foreground\")}\n              onClick={() => setLiked((v) => !v)}\n              size=\"icon-sm\"\n              variant=\"ghost\"\n            >\n              <ThumbsUpIcon className={cn(liked && \"fill-current/20\")} />\n            </Button>\n            <Button\n              aria-label=\"Regenerate\"\n              className={action}\n              disabled={!onRegenerate}\n              onClick={onRegenerate}\n              size=\"icon-sm\"\n              variant=\"ghost\"\n            >\n              <RotateCcwIcon />\n            </Button>\n          </motion.div>\n        )}\n      </div>\n    </motion.div>\n  );\n}\n"
    }
  ]
}