{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ai-data-03",
  "title": "Sorted support inbox",
  "description": "An inbox an agent has already been through: conversations sorted by topic with the reason for each, a drafted reply with its sources that you send, edit or rewrite, and on Send a check draws itself on the row, which dims where it stands and never moves.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/agent-run.json",
    "https://ui.ndekocode.dev/r/animated-size.json",
    "https://ui.ndekocode.dev/r/avatar.json",
    "https://ui.ndekocode.dev/r/badge.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/chat-motion.json",
    "https://ui.ndekocode.dev/r/company-mark.json",
    "https://ui.ndekocode.dev/r/demonstration.json",
    "https://ui.ndekocode.dev/r/drawn-check.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/live-duration.json",
    "https://ui.ndekocode.dev/r/live-region.json",
    "https://ui.ndekocode.dev/r/mesh-tile.json",
    "https://ui.ndekocode.dev/r/morph-button.json",
    "https://ui.ndekocode.dev/r/motion-number.json",
    "https://ui.ndekocode.dev/r/motion-presets.json",
    "https://ui.ndekocode.dev/r/replay-button.json",
    "https://ui.ndekocode.dev/r/streamed-text.json",
    "https://ui.ndekocode.dev/r/textarea.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/use-session.json",
    "https://ui.ndekocode.dev/r/use-timeouts.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/blocks/ai-data/ai-data-03/index.tsx",
      "content": "'use client';\n\nimport { useCallback } from 'react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { useSession } from '@/registry/ndeko/hooks/use-session';\nimport { useTimeouts } from '@/registry/ndeko/hooks/use-timeouts';\nimport { seriesColorOf } from '@/registry/ndeko/lib/agent-run';\nimport { spokenUnless } from '@/registry/ndeko/lib/demonstration';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { ClockGate } from '@/registry/ndeko/ui/live-duration';\nimport { LiveRegion } from '@/registry/ndeko/ui/live-region';\nimport { MeshTile } from '@/registry/ndeko/ui/mesh-tile';\nimport { ReplayButton } from '@/registry/ndeko/ui/replay-button';\n\nimport { conversationOf, CONVERSATIONS, WRITER } from './data';\nimport { InboxList } from './inbox-list';\nimport { ReadingPane } from './reading-pane';\nimport {\n  handledCountOf,\n  INITIAL,\n  LOOP_AFTER_MS,\n  nextOpenAfter,\n  reducer,\n  RESTING,\n  SCRIPT,\n  SEND_MS,\n} from './session';\n\nconst SESSION = {\n  reducer,\n  initial: INITIAL,\n  resting: RESTING,\n  script: SCRIPT,\n  loopAfter: LOOP_AFTER_MS,\n};\n\nconst TOTAL = CONVERSATIONS.length;\n\n/** A narrow page shows the list until a conversation is opened. A wide one shows both. */\nfunction listVisibilityOf(isReading: boolean) {\n  if (isReading) {\n    return 'hidden';\n  }\n  return 'flex';\n}\n\nfunction paneVisibilityOf(isReading: boolean) {\n  if (isReading) {\n    return 'flex';\n  }\n  return 'hidden';\n}\n\nexport default function AiData03() {\n  const {\n    ref,\n    isInView,\n    isAutoplaying,\n    state,\n    act,\n    pressed,\n    isFinished,\n    restart,\n  } = useSession(SESSION);\n  const { schedule, clearAll } = useTimeouts();\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const { selectedId } = state;\n  const conversation = conversationOf(selectedId);\n  const live = state.live[selectedId];\n  const handled = handledCountOf(state);\n  const next = nextOpenAfter(state, selectedId);\n  const isStreaming = state.streamingId === selectedId && !shouldReduceMotion;\n  const message = spokenUnless(isAutoplaying, state.spoken);\n  const canReplay = isFinished && !isAutoplaying;\n\n  const focusLater = useCallback(\n    (selector: string) => {\n      requestAnimationFrame(() => {\n        const target = ref.current?.querySelector<HTMLElement>(selector);\n        target?.focus();\n      });\n    },\n    [ref]\n  );\n\n  /**\n   * On a narrow page the list leaves when a conversation opens and takes the pressed row with it:\n   * the focus then goes to the heading of the conversation. On a wide page the row keeps it.\n   */\n  const open = useCallback(\n    (id: string) => {\n      act({ type: 'opened', id });\n      requestAnimationFrame(() => {\n        const row = ref.current?.querySelector<HTMLElement>(\n          `[data-row=\"${id}\"]`\n        );\n        const isRowHidden = row?.offsetParent === null;\n        if (isRowHidden) {\n          focusLater('[data-pane-heading]');\n        }\n      });\n    },\n    [act, ref, focusLater]\n  );\n\n  function back() {\n    act({ type: 'closed' });\n    focusLater(`[data-row=\"${selectedId}\"]`);\n  }\n\n  function focusWhatComesNext() {\n    requestAnimationFrame(() => {\n      const root = ref.current;\n      const next = root?.querySelector<HTMLElement>('[data-next]');\n      const reopen = root?.querySelector<HTMLElement>('[data-reopen]');\n      const target = next ?? reopen;\n      target?.focus();\n    });\n  }\n\n  /** Send leaves with the draft once the reply is gone: a focus that sat on it goes to what can be done next. */\n  function deliver(id: string) {\n    const sendButton = ref.current?.querySelector('[data-send]');\n    const hadFocus = sendButton === document.activeElement;\n    act({ type: 'delivered', id });\n    if (sendButton && hadFocus) {\n      focusWhatComesNext();\n    }\n  }\n\n  function send() {\n    act({ type: 'sendPressed', id: selectedId });\n    schedule(() => deliver(selectedId), SEND_MS);\n  }\n\n  function edit() {\n    act({ type: 'editStarted', id: selectedId });\n    requestAnimationFrame(() => {\n      const field =\n        ref.current?.querySelector<HTMLTextAreaElement>('[data-draft-field]');\n      if (!field) {\n        return;\n      }\n      const end = field.value.length;\n      field.focus();\n      field.setSelectionRange(end, end);\n    });\n  }\n\n  function save() {\n    act({ type: 'editSaved', id: selectedId });\n    focusLater('[data-edit]');\n  }\n\n  function cancel() {\n    act({ type: 'editCancelled', id: selectedId });\n    focusLater('[data-edit]');\n  }\n\n  function reopen() {\n    act({ type: 'reopened', id: selectedId });\n    focusLater('[data-send]');\n  }\n\n  function openNext() {\n    if (!next) {\n      return;\n    }\n    act({ type: 'opened', id: next.id });\n    focusLater('[data-pane-heading]');\n  }\n\n  /** A reply on its way belongs to the round it was sent in. */\n  function replay() {\n    clearAll();\n    restart();\n  }\n\n  return (\n    <ClockGate isActive={isInView}>\n      <div\n        ref={ref}\n        className='bg-background text-foreground @container min-h-dvh w-full'\n      >\n        <div className='mx-auto flex max-w-6xl flex-col gap-5 p-4 @3xl:gap-6 @3xl:p-8'>\n          <header className='flex flex-wrap items-center gap-x-3 gap-y-2'>\n            <div className='flex min-w-0 flex-1 flex-col gap-0.5'>\n              <h1 className='text-lg font-semibold text-balance'>Inbox</h1>\n              <p className='text-muted-foreground flex flex-wrap items-center gap-x-2 gap-y-1 text-xs'>\n                <span className='flex items-center gap-1.5'>\n                  <MeshTile\n                    seed={WRITER.name}\n                    size='sm'\n                    color={seriesColorOf(WRITER.series)}\n                  />\n                  Sorted and drafted by {WRITER.name}\n                </span>\n                <Badge variant='secondary'>Illustrative</Badge>\n              </p>\n            </div>\n            <ReplayButton\n              isShown={canReplay}\n              onReplay={replay}\n              label='Replay'\n            />\n            <p className='flex items-baseline gap-1.5'>\n              <MotionNumber\n                value={handled}\n                className='text-2xl leading-8 font-semibold'\n              />\n              <span className='text-muted-foreground text-xs tabular-nums'>\n                of {TOTAL} handled\n              </span>\n            </p>\n          </header>\n\n          <div className='flex gap-6'>\n            <div\n              className={cn(\n                'w-full @3xl:flex @3xl:w-80 @3xl:shrink-0',\n                listVisibilityOf(state.isReading)\n              )}\n            >\n              <InboxList\n                live={state.live}\n                selectedId={selectedId}\n                pressed={pressed}\n                onOpen={open}\n              />\n            </div>\n            <div\n              className={cn(\n                'min-w-0 flex-1 @3xl:sticky @3xl:top-8 @3xl:flex @3xl:self-start',\n                paneVisibilityOf(state.isReading)\n              )}\n            >\n              <ReadingPane\n                key={selectedId}\n                conversation={conversation}\n                live={live}\n                isStreaming={isStreaming}\n                hasNext={next !== null}\n                pressed={pressed}\n                onBack={back}\n                onSend={send}\n                onEdit={edit}\n                onType={(text) =>\n                  act({ type: 'draftTyped', id: selectedId, text })\n                }\n                onSave={save}\n                onCancel={cancel}\n                onRegenerate={() =>\n                  act({ type: 'regenerated', id: selectedId })\n                }\n                onReopen={reopen}\n                onNext={openNext}\n              />\n            </div>\n          </div>\n        </div>\n        <LiveRegion message={message} />\n      </div>\n    </ClockGate>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/ai-data-03/index.tsx"
    },
    {
      "path": "registry/ndeko/blocks/ai-data/ai-data-03/inbox-list.tsx",
      "content": "'use client';\n\nimport { memo } from 'react';\n\nimport { pressedQuietOf } from '@/registry/ndeko/lib/demonstration';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Avatar } from '@/registry/ndeko/ui/avatar';\nimport { DrawnCheck } from '@/registry/ndeko/ui/drawn-check';\n\nimport { CONVERSATIONS, TOPICS, type Conversation, type TopicId } from './data';\nimport type { ConversationLive } from './session';\n\nconst ROW =\n  'focus-visible:ring-ring/25 flex w-full cursor-pointer items-start gap-2.5 rounded-lg px-2.5 py-2 text-start transition-[background-color,scale] duration-150 outline-none focus-visible:ring-[3px]';\n\nfunction rowToneOf(isSelected: boolean) {\n  if (isSelected) {\n    return 'bg-foreground/[0.07]';\n  }\n  return 'hover:bg-foreground/[0.04]';\n}\n\nfunction currentOf(isSelected: boolean): 'true' | undefined {\n  if (isSelected) {\n    return 'true';\n  }\n  return undefined;\n}\n\n/** A handled row steps back where it stands. It never leaves its place in the list. */\nfunction dimOf(isHandled: boolean) {\n  if (isHandled) {\n    return 'opacity-55';\n  }\n  return 'opacity-100';\n}\n\n/** Only what is urgent wears a colour: the other topics are told apart by their name. */\nfunction topicDotOf(topic: TopicId) {\n  if (topic === 'urgent') {\n    return 'bg-destructive';\n  }\n  return 'bg-foreground/25';\n}\n\nfunction conversationsWordOf(count: number) {\n  if (count === 1) {\n    return 'conversation';\n  }\n  return 'conversations';\n}\n\ntype ConversationRowProps = {\n  conversation: Conversation;\n  live: ConversationLive;\n  isSelected: boolean;\n  isPressed: boolean;\n  onOpen: (id: string) => void;\n};\n\n/** Memoised: a key typed in the draft of one conversation draws its own row again, not the nine others. */\nconst ConversationRow = memo(function ConversationRow({\n  conversation,\n  live,\n  isSelected,\n  isPressed,\n  onOpen,\n}: ConversationRowProps) {\n  const isHandled = live.status === 'handled';\n\n  return (\n    <li className={cn('transition-opacity duration-300', dimOf(isHandled))}>\n      <button\n        type='button'\n        data-row={conversation.id}\n        aria-current={currentOf(isSelected)}\n        onClick={() => onOpen(conversation.id)}\n        className={cn(ROW, rowToneOf(isSelected), pressedQuietOf(isPressed))}\n      >\n        <Avatar seed={conversation.customer} className='mt-0.5 size-7' />\n        <span className='flex min-w-0 flex-1 flex-col'>\n          <span className='flex items-center gap-2'>\n            <span className='min-w-0 flex-1 truncate text-[13px] leading-5 font-medium'>\n              {conversation.customer}\n            </span>\n            <span className='text-muted-foreground shrink-0 text-xs tabular-nums'>\n              {conversation.receivedAgo}\n            </span>\n          </span>\n          <span className='truncate text-[13px] leading-5'>\n            {conversation.subject}\n          </span>\n          <span className='text-muted-foreground truncate text-xs'>\n            {conversation.reason}\n          </span>\n        </span>\n        <span className='flex size-[18px] shrink-0 items-center justify-center self-center'>\n          {isHandled && (\n            <DrawnCheck tone='success' entrance='draw-in-view' pace='calm' />\n          )}\n        </span>\n        {isHandled && <span className='sr-only'>Handled</span>}\n      </button>\n    </li>\n  );\n});\n\nconst ARROW_STEP: Partial<Record<string, number>> = {\n  ArrowDown: 1,\n  ArrowUp: -1,\n};\n\n/** Up and Down walk the rows across the topics, as one list. */\nfunction moveBetweenRows(event: React.KeyboardEvent<HTMLElement>) {\n  const step = ARROW_STEP[event.key];\n  if (step === undefined) {\n    return;\n  }\n  const rows = event.currentTarget.querySelectorAll<HTMLElement>('[data-row]');\n  const buttons = Array.from(rows);\n  const index = buttons.findIndex((row) => row === document.activeElement);\n  if (index === -1) {\n    return;\n  }\n  const target = buttons[index + step];\n  if (!target) {\n    return;\n  }\n  event.preventDefault();\n  target.focus();\n}\n\nexport type InboxListProps = {\n  live: Record<string, ConversationLive>;\n  selectedId: string;\n  pressed: string | null;\n  onOpen: (id: string) => void;\n};\n\nexport function InboxList({\n  live,\n  selectedId,\n  pressed,\n  onOpen,\n}: InboxListProps) {\n  return (\n    <nav\n      aria-label='Conversations'\n      onKeyDown={moveBetweenRows}\n      className='flex w-full flex-col gap-4'\n    >\n      {TOPICS.map((topic) => {\n        const conversations = CONVERSATIONS.filter(\n          (conversation) => conversation.topic === topic.id\n        );\n        const count = conversations.length;\n        return (\n          <section key={topic.id} className='flex flex-col gap-0.5'>\n            <h2 className='text-muted-foreground flex h-6 items-center gap-2 px-2.5 text-xs font-medium'>\n              <span\n                aria-hidden='true'\n                className={cn(\n                  'size-1.5 shrink-0 rounded-full',\n                  topicDotOf(topic.id)\n                )}\n              />\n              {topic.label}\n              <span className='tabular-nums'>\n                {count}\n                <span className='sr-only'> {conversationsWordOf(count)}</span>\n              </span>\n            </h2>\n            <ul className='flex flex-col gap-px'>\n              {conversations.map((conversation) => (\n                <ConversationRow\n                  key={conversation.id}\n                  conversation={conversation}\n                  live={live[conversation.id]}\n                  isSelected={conversation.id === selectedId}\n                  isPressed={pressed === `row-${conversation.id}`}\n                  onOpen={onOpen}\n                />\n              ))}\n            </ul>\n          </section>\n        );\n      })}\n    </nav>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/ai-data-03/inbox-list.tsx"
    },
    {
      "path": "registry/ndeko/blocks/ai-data/ai-data-03/reading-pane.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion } from 'motion/react';\nimport { useId } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { seriesColorOf } from '@/registry/ndeko/lib/agent-run';\nimport {\n  pressedQuietOf,\n  pressedSolidOf,\n} from '@/registry/ndeko/lib/demonstration';\nimport {\n  ArrowLeftIcon,\n  ArrowRightIcon,\n  BookOpenIcon,\n  CheckIcon,\n  RefreshCwIcon,\n  SendIcon,\n  UndoIcon,\n} from '@/registry/ndeko/lib/icons';\nimport { rowPresenceOf } from '@/registry/ndeko/lib/motion-presets';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\nimport { Avatar } from '@/registry/ndeko/ui/avatar';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Swap } from '@/registry/ndeko/ui/chat-motion';\nimport { CompanyMark } from '@/registry/ndeko/ui/company-mark';\nimport { MeshTile } from '@/registry/ndeko/ui/mesh-tile';\nimport { MorphButton, type MorphState } from '@/registry/ndeko/ui/morph-button';\nimport { StreamedInk } from '@/registry/ndeko/ui/streamed-text';\nimport { Textarea } from '@/registry/ndeko/ui/textarea';\n\nimport {\n  articlesOf,\n  ME,\n  topicLabelOf,\n  WRITER,\n  type Conversation,\n  type TopicId,\n} from './data';\nimport { draftOf, type ConversationLive, type SendStatus } from './session';\n\n/** How long one word of a rewritten draft takes to follow the one before it. */\nconst WORD_MS = 40;\n\nconst SEND_STATE: Record<SendStatus, MorphState> = {\n  open: 'idle',\n  sending: 'busy',\n  handled: 'done',\n};\n\nconst SEND_LABELS: Record<MorphState, string> = {\n  idle: 'Send',\n  busy: 'Sending',\n  done: 'Sent',\n};\n\nfunction topicVariantOf(topic: TopicId) {\n  if (topic === 'urgent') {\n    return 'destructive';\n  }\n  return 'secondary';\n}\n\n/** Draft 2 of 2 while the words are the agent's, and whose they are once a person changed them. */\nfunction versionLineOf(conversation: Conversation, live: ConversationLive) {\n  if (live.edited !== null) {\n    return 'Edited by you';\n  }\n  return `Draft ${live.variant + 1} of ${conversation.drafts.length}`;\n}\n\ntype DraftCardProps = {\n  conversation: Conversation;\n  live: ConversationLive;\n  isStreaming: boolean;\n  pressed: string | null;\n  onSend: () => void;\n  onEdit: () => void;\n  onType: (text: string) => void;\n  onSave: () => void;\n  onCancel: () => void;\n  onRegenerate: () => void;\n};\n\nfunction DraftCard({\n  conversation,\n  live,\n  isStreaming,\n  pressed,\n  onSend,\n  onEdit,\n  onType,\n  onSave,\n  onCancel,\n  onRegenerate,\n}: DraftCardProps) {\n  const fieldId = useId();\n  const isEditing = live.editing !== null;\n  const isSending = live.status === 'sending';\n  const editingText = live.editing ?? '';\n  const isEmpty = editingText.trim() === '';\n  const versionLine = versionLineOf(conversation, live);\n  const sources = articlesOf(conversation);\n\n  return (\n    <section\n      aria-label='Draft reply'\n      className='bg-foreground/[0.04] flex flex-col gap-3 rounded-xl p-3.5'\n    >\n      <header className='flex items-center gap-2'>\n        <MeshTile seed={WRITER.name} color={seriesColorOf(WRITER.series)} />\n        <h3 className='min-w-0 flex-1 truncate text-[13px] font-medium'>\n          Draft by {WRITER.name}\n        </h3>\n        <Swap\n          swapKey={versionLine}\n          className='text-muted-foreground text-xs tabular-nums'\n        >\n          {versionLine}\n        </Swap>\n      </header>\n      {!isEditing && (\n        <p\n          key={live.rewrites}\n          className='text-[13px] leading-relaxed whitespace-pre-line'\n        >\n          <StreamedInk\n            text={draftOf(conversation, live)}\n            isStreaming={isStreaming}\n            wordMs={WORD_MS}\n          />\n        </p>\n      )}\n      {isEditing && (\n        <div className='flex flex-col gap-1.5'>\n          <label htmlFor={fieldId} className='sr-only'>\n            Reply to {conversation.customer}\n          </label>\n          <Textarea\n            id={fieldId}\n            data-draft-field\n            value={editingText}\n            onChange={(event) => onType(event.target.value)}\n          />\n        </div>\n      )}\n      <ul aria-label='Sources' className='flex flex-wrap gap-1.5'>\n        {sources.map((article) => (\n          <li\n            key={article.id}\n            className='bg-card dark:bg-foreground/[0.06] flex h-6 max-w-full items-center gap-1.5 rounded-full ps-2 pe-2.5 text-xs'\n          >\n            <BookOpenIcon className='text-muted-foreground size-3.5 shrink-0' />\n            <span className='min-w-0 truncate'>{article.title}</span>\n          </li>\n        ))}\n      </ul>\n      {!isEditing && (\n        <div className='flex flex-wrap items-center gap-2'>\n          <MorphButton\n            type='button'\n            size='sm'\n            data-send\n            state={SEND_STATE[live.status]}\n            labels={SEND_LABELS}\n            idleIcon={<SendIcon />}\n            onClick={onSend}\n            className={pressedSolidOf(pressed === 'send')}\n          />\n          <Button\n            type='button'\n            size='sm'\n            variant='outline'\n            data-edit\n            disabled={isSending}\n            onClick={onEdit}\n            className={pressedQuietOf(pressed === 'edit')}\n          >\n            Edit\n          </Button>\n          <Button\n            type='button'\n            size='sm'\n            variant='ghost'\n            disabled={isSending}\n            onClick={onRegenerate}\n            className={cn(\n              'text-muted-foreground',\n              pressedQuietOf(pressed === 'regenerate')\n            )}\n          >\n            <RefreshCwIcon />\n            Regenerate\n          </Button>\n        </div>\n      )}\n      {isEditing && (\n        <div className='flex flex-wrap items-center gap-2'>\n          <Button\n            type='button'\n            size='sm'\n            disabled={isEmpty}\n            focusableWhenDisabled\n            onClick={onSave}\n            className={pressedSolidOf(pressed === 'save')}\n          >\n            Save draft\n          </Button>\n          <Button type='button' size='sm' variant='ghost' onClick={onCancel}>\n            Cancel\n          </Button>\n        </div>\n      )}\n    </section>\n  );\n}\n\ntype HandledProps = {\n  hasNext: boolean;\n  onReopen: () => void;\n  onNext: () => void;\n};\n\nfunction Handled({ hasNext, onReopen, onNext }: HandledProps) {\n  return (\n    <div className='flex flex-wrap items-center gap-2'>\n      <p className='text-muted-foreground flex min-w-0 flex-1 items-center gap-1.5 text-xs'>\n        <CheckIcon className='text-success-foreground size-3.5 shrink-0' />\n        Handled. Your reply is in the thread\n      </p>\n      <Button\n        type='button'\n        variant='ghost'\n        size='sm'\n        data-reopen\n        onClick={onReopen}\n        className='text-muted-foreground'\n      >\n        <UndoIcon />\n        Reopen\n      </Button>\n      {hasNext && (\n        <Button type='button' size='sm' data-next onClick={onNext}>\n          Next conversation\n          <ArrowRightIcon />\n        </Button>\n      )}\n    </div>\n  );\n}\n\nexport type ReadingPaneProps = DraftCardProps &\n  HandledProps & {\n    onBack: () => void;\n  };\n\n/** The conversation on one side of the thread, the reply on the other, and under them what is left to do. */\nexport function ReadingPane({\n  conversation,\n  live,\n  hasNext,\n  pressed,\n  onBack,\n  onReopen,\n  onNext,\n  ...draft\n}: ReadingPaneProps) {\n  const headingId = useId();\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const rowPresence = rowPresenceOf(shouldReduceMotion);\n  const isHandled = live.status === 'handled';\n\n  return (\n    <section\n      aria-labelledby={headingId}\n      className='flex min-w-0 flex-1 flex-col gap-4'\n    >\n      <header className='flex items-start gap-2'>\n        <Button\n          type='button'\n          variant='ghost'\n          size='icon-sm'\n          data-back\n          aria-label='Back to the conversations'\n          onClick={onBack}\n          className={cn(\n            'text-muted-foreground -ms-1.5 shrink-0 @3xl:hidden',\n            pressedQuietOf(pressed === 'back')\n          )}\n        >\n          <ArrowLeftIcon />\n        </Button>\n        <div className='flex min-w-0 flex-1 flex-col gap-0.5'>\n          <h2\n            id={headingId}\n            data-pane-heading\n            tabIndex={-1}\n            className='focus-visible:ring-ring/25 rounded-sm text-sm leading-7 font-medium text-balance outline-none focus-visible:ring-[3px]'\n          >\n            {conversation.subject}\n          </h2>\n          <p className='text-muted-foreground flex min-w-0 items-center gap-1.5 text-xs'>\n            <CompanyMark seed={conversation.company} size='sm' />\n            <span className='truncate'>\n              {conversation.customer}, {conversation.company}\n            </span>\n          </p>\n        </div>\n        <Badge variant={topicVariantOf(conversation.topic)} className='mt-1'>\n          {topicLabelOf(conversation.topic)}\n        </Badge>\n      </header>\n\n      <div className='flex flex-col'>\n        <div className='flex items-end gap-2 pb-3'>\n          <Avatar seed={conversation.customer} className='size-7' />\n          <div className='flex max-w-[85%] flex-col gap-1'>\n            <p className='bg-foreground/[0.06] rounded-2xl rounded-es-md px-3.5 py-2 text-[13px] leading-relaxed'>\n              {conversation.message}\n            </p>\n            <p className='text-muted-foreground ps-1 text-xs tabular-nums'>\n              {conversation.receivedAgo} ago\n            </p>\n          </div>\n        </div>\n        <AnimatePresence initial={false}>\n          {live.sent !== null && (\n            <motion.div\n              key='sent'\n              className='-mx-1 overflow-hidden px-1'\n              {...rowPresence}\n            >\n              <div className='flex items-end justify-end gap-2 pb-3'>\n                <p className='bg-card hairline-ring ring-border dark:bg-foreground/[0.04] max-w-[85%] rounded-2xl rounded-ee-md px-3.5 py-2 text-[13px] leading-relaxed whitespace-pre-line shadow-[0_1px_2px_rgb(0_0_0/0.04)]'>\n                  {live.sent}\n                </p>\n                <Avatar seed={ME.name} className='size-7' />\n              </div>\n            </motion.div>\n          )}\n        </AnimatePresence>\n      </div>\n\n      <AnimatedSize>\n        {!isHandled && (\n          <DraftCard\n            conversation={conversation}\n            live={live}\n            pressed={pressed}\n            {...draft}\n          />\n        )}\n        {isHandled && (\n          <Handled hasNext={hasNext} onReopen={onReopen} onNext={onNext} />\n        )}\n      </AnimatedSize>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/ai-data-03/reading-pane.tsx"
    },
    {
      "path": "registry/ndeko/blocks/ai-data/ai-data-03/session.ts",
      "content": "import type { SessionStep } from '@/registry/ndeko/hooks/use-session';\nimport { keyDelayOf, prefixesOf } from '@/registry/ndeko/lib/demonstration';\n\nimport { conversationOf, CONVERSATIONS, type Conversation } from './data';\n\nexport type SendStatus = 'open' | 'sending' | 'handled';\n\nexport type ConversationLive = {\n  status: SendStatus;\n  /** Which of the agent's drafts shows. */\n  variant: number;\n  /** The draft as a person saved it, once they changed it. */\n  edited: string | null;\n  /** What the editing field holds while the draft is being changed. */\n  editing: string | null;\n  /** Counts the rewrites, so a rewritten draft arrives as a new text. */\n  rewrites: number;\n  /** The reply that was sent. */\n  sent: string | null;\n};\n\nexport type InboxState = {\n  selectedId: string;\n  /** A narrow page shows the list or the conversation, never both. */\n  isReading: boolean;\n  live: Record<string, ConversationLive>;\n  /** The conversation whose draft is arriving word by word. */\n  streamingId: string | null;\n  spoken: string;\n};\n\nexport type InboxAction =\n  | { type: 'opened'; id: string }\n  | { type: 'closed' }\n  | { type: 'regenerated'; id: string }\n  | { type: 'editStarted'; id: string }\n  | { type: 'draftTyped'; id: string; text: string }\n  | { type: 'editSaved'; id: string }\n  | { type: 'editCancelled'; id: string }\n  | { type: 'sendPressed'; id: string }\n  | { type: 'delivered'; id: string }\n  | { type: 'reopened'; id: string };\n\ntype Step = SessionStep<InboxState, InboxAction>;\n\nconst FRESH: ConversationLive = {\n  status: 'open',\n  variant: 0,\n  edited: null,\n  editing: null,\n  rewrites: 0,\n  sent: null,\n};\n\nfunction initialLiveOf() {\n  const live: Record<string, ConversationLive> = {};\n  for (const conversation of CONVERSATIONS) {\n    live[conversation.id] = FRESH;\n  }\n  return live;\n}\n\nconst [FIRST, SECOND] = CONVERSATIONS;\n\nexport const INITIAL: InboxState = {\n  selectedId: FIRST.id,\n  isReading: false,\n  live: initialLiveOf(),\n  streamingId: null,\n  spoken: '',\n};\n\n/** The reply as it would be sent: what a person saved, or the draft of the agent. */\nexport function draftOf(conversation: Conversation, live: ConversationLive) {\n  return live.edited ?? conversation.drafts[live.variant];\n}\n\nexport function handledCountOf(state: InboxState) {\n  const handled = CONVERSATIONS.filter(\n    (conversation) => state.live[conversation.id].status === 'handled'\n  );\n  return handled.length;\n}\n\n/** The next conversation down the list that still waits for a reply, starting again from the top. */\nexport function nextOpenAfter(state: InboxState, id: string) {\n  const index = CONVERSATIONS.findIndex((candidate) => candidate.id === id);\n  const after = CONVERSATIONS.slice(index + 1);\n  const before = CONVERSATIONS.slice(0, index);\n  const others = [...after, ...before];\n  const next = others.find(\n    (candidate) => state.live[candidate.id].status === 'open'\n  );\n  return next ?? null;\n}\n\nfunction patched(\n  state: InboxState,\n  id: string,\n  patch: Partial<ConversationLive>\n): InboxState {\n  const live = { ...state.live[id], ...patch };\n  return { ...state, live: { ...state.live, [id]: live } };\n}\n\nfunction isKnown(state: InboxState, id: string) {\n  return state.live[id] !== undefined;\n}\n\nfunction opened(state: InboxState, id: string): InboxState {\n  if (!isKnown(state, id)) {\n    return state;\n  }\n  const conversation = conversationOf(id);\n  const spoken = `${conversation.customer}: ${conversation.subject}`;\n  return {\n    ...state,\n    selectedId: id,\n    isReading: true,\n    streamingId: null,\n    spoken,\n  };\n}\n\n/** A draft can be rewritten or sent while it is open and nobody is changing it. */\nfunction isReady(live: ConversationLive | undefined) {\n  if (!live) {\n    return false;\n  }\n  const isOpen = live.status === 'open';\n  const isBeingEdited = live.editing !== null;\n  return isOpen && !isBeingEdited;\n}\n\nfunction regenerated(state: InboxState, id: string): InboxState {\n  const live = state.live[id];\n  if (!isReady(live)) {\n    return state;\n  }\n  const conversation = conversationOf(id);\n  const variant = (live.variant + 1) % conversation.drafts.length;\n  const rewrites = live.rewrites + 1;\n  const next = patched(state, id, { variant, edited: null, rewrites });\n  return { ...next, streamingId: id, spoken: 'Draft rewritten' };\n}\n\nfunction editStarted(state: InboxState, id: string): InboxState {\n  const live = state.live[id];\n  if (!isReady(live)) {\n    return state;\n  }\n  const editing = draftOf(conversationOf(id), live);\n  const next = patched(state, id, { editing });\n  return { ...next, streamingId: null };\n}\n\nfunction isEditing(state: InboxState, id: string) {\n  const live = state.live[id];\n  return live !== undefined && live.editing !== null;\n}\n\nfunction draftTyped(state: InboxState, id: string, text: string): InboxState {\n  if (!isEditing(state, id)) {\n    return state;\n  }\n  return patched(state, id, { editing: text });\n}\n\n/** An empty reply cannot be saved: the button that saves it is off while the field is empty. */\nfunction editSaved(state: InboxState, id: string): InboxState {\n  const editing = state.live[id]?.editing ?? null;\n  if (editing === null) {\n    return state;\n  }\n  const text = editing.trim();\n  if (text === '') {\n    return state;\n  }\n  const next = patched(state, id, { edited: text, editing: null });\n  return { ...next, spoken: 'Draft saved' };\n}\n\nfunction editCancelled(state: InboxState, id: string): InboxState {\n  if (!isEditing(state, id)) {\n    return state;\n  }\n  return patched(state, id, { editing: null });\n}\n\nfunction sendPressed(state: InboxState, id: string): InboxState {\n  if (!isReady(state.live[id])) {\n    return state;\n  }\n  const next = patched(state, id, { status: 'sending' });\n  return { ...next, streamingId: null };\n}\n\nfunction delivered(state: InboxState, id: string): InboxState {\n  const live = state.live[id];\n  if (live?.status !== 'sending') {\n    return state;\n  }\n  const conversation = conversationOf(id);\n  const sent = draftOf(conversation, live);\n  const next = patched(state, id, { status: 'handled', sent });\n  const handled = handledCountOf(next);\n  const total = CONVERSATIONS.length;\n  const spoken = `Reply sent to ${conversation.customer}. ${handled} of ${total} handled`;\n  return { ...next, spoken };\n}\n\nfunction reopened(state: InboxState, id: string): InboxState {\n  if (state.live[id]?.status !== 'handled') {\n    return state;\n  }\n  const next = patched(state, id, { status: 'open', sent: null });\n  return { ...next, spoken: 'Conversation reopened' };\n}\n\nexport function reducer(state: InboxState, action: InboxAction): InboxState {\n  switch (action.type) {\n    case 'opened':\n      return opened(state, action.id);\n    case 'closed':\n      return { ...state, isReading: false };\n    case 'regenerated':\n      return regenerated(state, action.id);\n    case 'editStarted':\n      return editStarted(state, action.id);\n    case 'draftTyped':\n      return draftTyped(state, action.id, action.text);\n    case 'editSaved':\n      return editSaved(state, action.id);\n    case 'editCancelled':\n      return editCancelled(state, action.id);\n    case 'sendPressed':\n      return sendPressed(state, action.id);\n    case 'delivered':\n      return delivered(state, action.id);\n    case 'reopened':\n      return reopened(state, action.id);\n  }\n}\n\n/** How long a reply takes to leave. */\nexport const SEND_MS = 900;\n\nconst KEY_MS = 40;\n\n/** What the demonstration adds to the second draft before it saves it. */\nconst ADDED_SENTENCE = ' Thank you for flagging it so quickly.';\n\nconst [SECOND_DRAFT] = SECOND.drafts;\n\nfunction typingSteps(startAfter: number): Step[] {\n  const prefixes = prefixesOf(ADDED_SENTENCE);\n  return prefixes.map((typed, index) => ({\n    after: keyDelayOf(index, startAfter, KEY_MS),\n    by: 'demo',\n    action: {\n      type: 'draftTyped',\n      id: SECOND.id,\n      text: `${SECOND_DRAFT}${typed}`,\n    },\n  }));\n}\n\n/**\n * The inbox is already sorted and drafted, so a person does everything from here and every step\n * is the demonstration's, except the reply that leaves on its own once Send is pressed. The first\n * draft is rewritten and sent, then the second one is edited and saved.\n */\nexport const SCRIPT: Step[] = [\n  {\n    after: 1500,\n    by: 'demo',\n    press: `row-${FIRST.id}`,\n    action: { type: 'opened', id: FIRST.id },\n  },\n  {\n    after: 1900,\n    by: 'demo',\n    press: 'regenerate',\n    action: { type: 'regenerated', id: FIRST.id },\n  },\n  {\n    after: 3400,\n    by: 'demo',\n    press: 'send',\n    action: { type: 'sendPressed', id: FIRST.id },\n  },\n  { after: SEND_MS, action: { type: 'delivered', id: FIRST.id } },\n  { after: 1700, by: 'demo', press: 'back', action: { type: 'closed' } },\n  {\n    after: 1400,\n    by: 'demo',\n    press: `row-${SECOND.id}`,\n    action: { type: 'opened', id: SECOND.id },\n  },\n  {\n    after: 1700,\n    by: 'demo',\n    press: 'edit',\n    action: { type: 'editStarted', id: SECOND.id },\n  },\n  ...typingSteps(900),\n  {\n    after: 800,\n    by: 'demo',\n    press: 'save',\n    action: { type: 'editSaved', id: SECOND.id },\n  },\n];\n\nfunction endOf(script: Step[]) {\n  let state = INITIAL;\n  for (const step of script) {\n    state = reducer(state, step.action);\n  }\n  return state;\n}\n\n/**\n * Under reduced motion the inbox rests where the script ends: the first conversation is handled in\n * its place, and the second one is open with the draft a person just changed.\n */\nexport const RESTING: InboxState = { ...endOf(SCRIPT), spoken: '' };\n\nexport const LOOP_AFTER_MS = 4200;\n",
      "type": "registry:component",
      "target": "components/blocks/ai-data-03/session.ts"
    },
    {
      "path": "registry/ndeko/blocks/ai-data/ai-data-03/data.ts",
      "content": "import type { SeriesSlot } from '@/registry/ndeko/lib/agent-run';\n\n/** The person answering the inbox. */\nexport const ME = { name: 'Lena Brandt' };\n\nexport type Agent = {\n  name: string;\n  series: SeriesSlot;\n};\n\n/** The agent that sorted the inbox and wrote the drafts. */\nexport const WRITER: Agent = { name: 'Writer', series: 3 };\n\nexport type TopicId = 'urgent' | 'billing' | 'bugs' | 'questions';\n\nexport type Topic = {\n  id: TopicId;\n  label: string;\n};\n\nexport const TOPICS: Topic[] = [\n  { id: 'urgent', label: 'Urgent' },\n  { id: 'billing', label: 'Billing' },\n  { id: 'bugs', label: 'Bugs' },\n  { id: 'questions', label: 'Questions' },\n];\n\nexport type Article = {\n  id: number;\n  title: string;\n};\n\n/** Invented help center articles. */\nexport const ARTICLES: Article[] = [\n  { id: 1, title: 'Renew a single sign-on certificate' },\n  { id: 2, title: 'When sign-in says session expired' },\n  { id: 3, title: 'Why a payment can be taken twice' },\n  { id: 4, title: 'When a refund reaches your card' },\n  { id: 5, title: 'Change your invoice details' },\n  { id: 6, title: 'Monthly or yearly billing' },\n  { id: 7, title: 'What happens when a payment fails' },\n  { id: 8, title: 'Known issues this week' },\n  { id: 9, title: 'Guests and what they can see' },\n  { id: 10, title: 'API rate limits' },\n  { id: 11, title: 'Export your workspace' },\n];\n\nexport type Conversation = {\n  id: string;\n  topic: TopicId;\n  customer: string;\n  company: string;\n  subject: string;\n  receivedAgo: string;\n  /** Why the agent sorted it under its topic, in a few words. */\n  reason: string;\n  message: string;\n  /** The replies the agent wrote. Regenerate goes from one to the next. */\n  drafts: string[];\n  /** The help articles the replies are drawn from. */\n  sources: number[];\n};\n\n/** Invented customers, companies and messages. */\nexport const CONVERSATIONS: Conversation[] = [\n  {\n    id: 'locked-out',\n    topic: 'urgent',\n    customer: 'Ines Marchetti',\n    company: 'Halden Works',\n    subject: 'Whole team locked out since this morning',\n    receivedAgo: '6 min',\n    reason: 'Nobody on the team can sign in',\n    message:\n      'Since 8 this morning none of us can sign in. We get \"session expired\" right after the password. We have a client demo at 2.',\n    drafts: [\n      'Hi Ines, sorry for the scare. \"Session expired\" right after the password means the single sign-on certificate of your workspace has run out. Any admin can renew it under Settings, Security in about a minute. If someone is still kept out after that, clearing the cookie of the app once is enough. Write back if the renewal is greyed out and I will do it from our side.',\n      'Hi Ines, this is an expired single sign-on certificate. An admin renews it under Settings, Security and everyone can sign in again right away. One or two people may still see the message because of an old cookie: clearing it once fixes that. I am staying on this thread until your demo is over.',\n    ],\n    sources: [1, 2],\n  },\n  {\n    id: 'double-charge',\n    topic: 'urgent',\n    customer: 'Aiko Tanaka',\n    company: 'Pallas Robotics',\n    subject: 'Charged twice for November',\n    receivedAgo: '14 min',\n    reason: 'Two charges of the same amount, month end tomorrow',\n    message:\n      'We were charged twice for November, two payments of $480 on the same card. Please refund one of them today, finance closes the month tomorrow.',\n    drafts: [\n      'Hi Aiko, you are right: two payments of $480.00 went through for the November invoice. The first attempt timed out at the bank and was sent again, and both were accepted. I am refunding the second one now. It reaches the card in 3 to 5 working days, and a corrected receipt for your finance team is attached.',\n      'Hi Aiko, I can see both payments of $480.00 on the November invoice. The bank accepted a retry of a payment it had already taken. The second payment is refunded today and a corrected receipt is attached, so your finance team can close the month with one charge.',\n    ],\n    sources: [3, 4],\n  },\n  {\n    id: 'vat-number',\n    topic: 'billing',\n    customer: 'Clara Jensen',\n    company: 'Solway Books',\n    subject: 'VAT number missing on invoices',\n    receivedAgo: '32 min',\n    reason: 'Asks to change what the invoices show',\n    message:\n      'Our invoices do not show our VAT number. Can you add it and send October again?',\n    drafts: [\n      'Hi Clara, you can add the VAT number under Billing, Invoice details. Every invoice issued after that carries it. For October, open the invoice and choose Reissue: the new copy replaces the old one and keeps the same number.',\n      'Hi Clara, the VAT number goes under Billing, Invoice details and shows on every invoice from then on. October can be reissued from the invoice itself, with the same invoice number, so nothing changes for your accountant.',\n    ],\n    sources: [5],\n  },\n  {\n    id: 'yearly-billing',\n    topic: 'billing',\n    customer: 'Samuel Okoye',\n    company: 'Ironbridge Tools',\n    subject: 'Switch to yearly billing',\n    receivedAgo: '1 h',\n    reason: 'Wants to change the billing period',\n    message:\n      'We would like to pay yearly from January. Is there a discount, and what happens to the month we already paid?',\n    drafts: [\n      'Hi Samuel, paying yearly costs ten months instead of twelve. You can switch under Billing, Plan at any time: the days already paid this month are credited against the first yearly invoice, so nothing is paid twice.',\n      'Hi Samuel, yes: a year costs the price of ten months. Switch under Billing, Plan when you are ready. What is left of the month you paid comes off the first yearly invoice.',\n    ],\n    sources: [6],\n  },\n  {\n    id: 'card-declined',\n    topic: 'billing',\n    customer: 'Rosa Delgado',\n    company: 'Verano Foods',\n    subject: 'Card declined, are we cut off?',\n    receivedAgo: '2 h',\n    reason: 'A payment failed twice',\n    message:\n      'I got two emails saying our card was declined. Are we going to lose access?',\n    drafts: [\n      'Hi Rosa, nothing is cut off: a workspace stays active for 14 days after a failed payment. The card on file expired last month. Once a new one is saved under Billing, Payment method, the open invoice is paid on its own.',\n      'Hi Rosa, you keep full access for 14 days after a failed payment. The reason is simple: the card on file expired last month. Save a new one under Billing, Payment method and the open invoice settles itself.',\n    ],\n    sources: [7],\n  },\n  {\n    id: 'empty-export',\n    topic: 'bugs',\n    customer: 'Henrik Aalto',\n    company: 'Tidemark Energy',\n    subject: 'CSV export comes out empty',\n    receivedAgo: '47 min',\n    reason: 'A feature that worked until yesterday',\n    message:\n      'Since yesterday the CSV export of the report page downloads a file with only the header row. The spreadsheet export still works.',\n    drafts: [\n      'Hi Henrik, thank you for the clear report. Exports whose date range ends today come out empty since yesterday: the fault is on our side and a fix ships tomorrow. Until then, ending the range a day earlier gives the full file.',\n      'Hi Henrik, you found a bug of ours: since yesterday a CSV export whose range ends today only holds the header. The fix ships tomorrow. For now, end the range yesterday or use the spreadsheet export.',\n    ],\n    sources: [8],\n  },\n  {\n    id: 'photo-crash',\n    topic: 'bugs',\n    customer: 'Greta Lindqvist',\n    company: 'Rowan Clinics',\n    subject: 'App closes when I attach a photo',\n    receivedAgo: '3 h',\n    reason: 'A crash with the steps to reproduce it',\n    message:\n      'On my phone the app closes every time I attach a photo to a note. It started with version 4.2.',\n    drafts: [\n      'Hi Greta, sorry about that. Version 4.2 closes when a photo is larger than 10 MB. Version 4.2.1 fixes it and reaches every phone this week. Until then, the Medium photo size in the camera settings avoids the problem.',\n      'Hi Greta, this is a fault of version 4.2 with photos over 10 MB. The fix is in 4.2.1, out this week. Choosing the Medium photo size in the camera settings keeps you going until it arrives.',\n    ],\n    sources: [8],\n  },\n  {\n    id: 'client-guest',\n    topic: 'questions',\n    customer: 'Nadia Rahman',\n    company: 'Aster Studio',\n    subject: 'Can a client see only one project?',\n    receivedAgo: '1 h',\n    reason: 'A how-to question about access',\n    message:\n      'Can I invite a client so they only see one project and nothing else?',\n    drafts: [\n      'Hi Nadia, yes. Invite them as a guest and pick the project when you send the invitation. A guest sees that project only, cannot see who works on the others, and does not count as a paid seat.',\n      'Hi Nadia, that is what guests are for. Choose Guest when you invite the client and pick the one project. They see nothing else, and guests are free.',\n    ],\n    sources: [9],\n  },\n  {\n    id: 'rate-limits',\n    topic: 'questions',\n    customer: 'Felix Hartmann',\n    company: 'Corvid Security',\n    subject: 'What are the API rate limits?',\n    receivedAgo: '4 h',\n    reason: 'Asks for a figure from the docs',\n    message:\n      'What are the rate limits of the API? We plan a nightly sync of about 40,000 records.',\n    drafts: [\n      'Hi Felix, the limit is 600 requests a minute for a workspace, and a bulk request counts as 10. Above it the API answers 429 with a Retry-After header. A nightly sync of 40,000 records fits well inside it with the bulk endpoints.',\n      'Hi Felix, 600 requests a minute per workspace, a bulk request counting as 10. With the bulk endpoints your 40,000 records take a few minutes. When the limit is reached the answer is a 429 that says how long to wait.',\n    ],\n    sources: [10],\n  },\n  {\n    id: 'full-export',\n    topic: 'questions',\n    customer: 'Elena Petrova',\n    company: 'Larkspur Media',\n    subject: 'How do I export everything?',\n    receivedAgo: '5 h',\n    reason: 'A how-to question about exports',\n    message:\n      'How do I export everything we have in the workspace, files included?',\n    drafts: [\n      'Hi Elena, an owner can export the whole workspace under Settings, Data, Export. You receive one archive with every project as CSV and the files in folders, usually within the hour.',\n      'Hi Elena, go to Settings, Data, Export as an owner of the workspace. The archive holds every project as CSV with its files beside it, and a link reaches you by email when it is ready.',\n    ],\n    sources: [11],\n  },\n];\n\nconst FALLBACK_CONVERSATION = CONVERSATIONS[0];\n\nexport function conversationOf(id: string) {\n  const conversation = CONVERSATIONS.find((candidate) => candidate.id === id);\n  return conversation ?? FALLBACK_CONVERSATION;\n}\n\nexport function articlesOf(conversation: Conversation) {\n  return ARTICLES.filter((article) =>\n    conversation.sources.includes(article.id)\n  );\n}\n\nexport function topicLabelOf(id: TopicId) {\n  const topic = TOPICS.find((candidate) => candidate.id === id);\n  return topic?.label ?? '';\n}\n",
      "type": "registry:component",
      "target": "components/blocks/ai-data-03/data.ts"
    }
  ],
  "categories": [
    "blocks",
    "ai-data"
  ],
  "type": "registry:block"
}