{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "application-09",
  "title": "AI app dashboard",
  "description": "A Kivuline Roasters dashboard on the app shell: a sidebar with workspaces that goes into a sheet on phones, a top bar with search and a bell, a figures band, the agents that need you with Allow and Deny, recent activity and a usage ring. Allow a request and the whole page answers at once: the row folds away, the counts roll down, a line lands at the top of the activity and the ring grows. Plug your app into onApprove, onDeny and onWorkspaceChange.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/agent-run.json",
    "https://ui.ndekocode.dev/r/avatar.json",
    "https://ui.ndekocode.dev/r/badge.json",
    "https://ui.ndekocode.dev/r/breadcrumb.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/chat-motion.json",
    "https://ui.ndekocode.dev/r/command.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/dropdown-menu.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/inline-sheet.json",
    "https://ui.ndekocode.dev/r/kbd.json",
    "https://ui.ndekocode.dev/r/live-region.json",
    "https://ui.ndekocode.dev/r/mesh-tile.json",
    "https://ui.ndekocode.dev/r/motion-number.json",
    "https://ui.ndekocode.dev/r/motion-presets.json",
    "https://ui.ndekocode.dev/r/motion-word-roll.json",
    "https://ui.ndekocode.dev/r/popover.json",
    "https://ui.ndekocode.dev/r/recipes.json",
    "https://ui.ndekocode.dev/r/replay-button.json",
    "https://ui.ndekocode.dev/r/run-session.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/use-is-narrow.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/use-session.json",
    "https://ui.ndekocode.dev/r/utils.json",
    "https://ui.ndekocode.dev/r/wash.json",
    "https://ui.ndekocode.dev/r/words.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/templates/dashboards/application-09/index.tsx",
      "content": "'use client';\n\nimport { useRef, useState } from 'react';\n\nimport { useIsNarrow } from '@/registry/ndeko/hooks/use-is-narrow';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { useSession } from '@/registry/ndeko/hooks/use-session';\nimport { spokenUnless } from '@/registry/ndeko/lib/demonstration';\nimport { InlineSheet } from '@/registry/ndeko/ui/inline-sheet';\nimport { LiveRegion } from '@/registry/ndeko/ui/live-region';\n\nimport { AppSidebar, type PageCounts } from './app-sidebar';\nimport {\n  CURRENT_PERSON,\n  EMPTY_PAGES,\n  NAV_GROUPS,\n  REQUESTS,\n  WORKSPACES,\n  type PageId,\n  type RequestId,\n  type RequestSeed,\n  type Workspace,\n} from './data';\nimport { EmptyPage } from './empty-page';\nimport { OverviewPage } from './overview-page';\nimport { SearchPalette } from './search-palette';\nimport {\n  INITIAL,\n  LOOP_AFTER_MS,\n  reducer,\n  RESTING,\n  SCRIPT,\n  type Decision,\n} from './session';\nimport { TopBar } from './top-bar';\n\nconst SESSION = {\n  reducer,\n  initial: INITIAL,\n  resting: RESTING,\n  script: SCRIPT,\n  loopAfter: LOOP_AFTER_MS,\n};\n\n/** The width of the `@3xl` container variant: under it the sidebar lives in a sheet. */\nconst SIDEBAR_SHEET_BELOW_REM = 48;\n\n/** The room left above the requests when the page jumps to them. */\nconst REVIEW_MARGIN_PX = 16;\n\nconst NAV_ITEMS = NAV_GROUPS.flatMap((group) => group.items);\n\nfunction navItemOf(pageId: PageId) {\n  const item = NAV_ITEMS.find((candidate) => candidate.id === pageId);\n  return item ?? NAV_ITEMS[0];\n}\n\nfunction emptyPageOf(pageId: PageId) {\n  if (pageId === 'overview') {\n    return null;\n  }\n  return EMPTY_PAGES[pageId];\n}\n\nfunction workspaceOf(workspaceId: string) {\n  const workspace = WORKSPACES.find(\n    (candidate) => candidate.id === workspaceId\n  );\n  return workspace ?? WORKSPACES[0];\n}\n\nfunction scrollBehaviorOf(shouldReduceMotion: boolean): ScrollBehavior {\n  if (shouldReduceMotion) {\n    return 'auto';\n  }\n  return 'smooth';\n}\n\nfunction isSearchShortcut(event: React.KeyboardEvent<HTMLElement>) {\n  const isKKey = event.key.toLowerCase() === 'k';\n  const hasModifier = event.metaKey || event.ctrlKey;\n  return isKKey && hasModifier;\n}\n\n/** Nothing calls a network. A real app plugs in here: the answer of a person to a request, and a change of workspace. */\nexport type Application09Props = {\n  onApprove?: (request: RequestSeed) => void;\n  onDeny?: (request: RequestSeed) => void;\n  onWorkspaceChange?: (workspace: Workspace) => void;\n};\n\nexport default function Application09({\n  onApprove,\n  onDeny,\n  onWorkspaceChange,\n}: Application09Props) {\n  const { ref, isAutoplaying, state, act, pressed, isFinished, restart } =\n    useSession(SESSION);\n  const scrollerRef = useRef<HTMLDivElement>(null);\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const isNarrow = useIsNarrow(ref, SIDEBAR_SHEET_BELOW_REM);\n  const [workspaceId, setWorkspaceId] = useState(WORKSPACES[0].id);\n  const [isSearchOpen, setIsSearchOpen] = useState(false);\n  const workspace = workspaceOf(workspaceId);\n  const page = navItemOf(state.pageId);\n  const isOverview = state.pageId === 'overview';\n  const emptyPage = emptyPageOf(state.pageId);\n  const isSheetShown = isNarrow && state.isNavOpen;\n  const canReplay = isFinished && !isAutoplaying;\n  const message = spokenUnless(isAutoplaying, state.spoken);\n  const counts: PageCounts = { approvals: state.pending.length };\n\n  function focusLater(selector: string) {\n    requestAnimationFrame(() => {\n      const target = ref.current?.querySelector<HTMLElement>(selector);\n      target?.focus();\n    });\n  }\n\n  /** The answered request leaves, and with it the button that was pressed: the focus goes to the card that holds the next one. */\n  function decide(requestId: RequestId, decision: Decision) {\n    act({ type: 'decided', id: requestId, decision });\n    focusLater('[data-needs-you]');\n    const request = REQUESTS[requestId];\n    if (decision === 'denied') {\n      onDeny?.(request);\n      return;\n    }\n    onApprove?.(request);\n  }\n\n  function review() {\n    const scroller = scrollerRef.current;\n    const target = ref.current?.querySelector<HTMLElement>('[data-needs-you]');\n    if (!scroller || !target) {\n      return;\n    }\n    const targetTop = target.getBoundingClientRect().top;\n    const scrollerTop = scroller.getBoundingClientRect().top;\n    const top = targetTop - scrollerTop + scroller.scrollTop - REVIEW_MARGIN_PX;\n    const behavior = scrollBehaviorOf(shouldReduceMotion);\n    scroller.scrollTo({ top, behavior });\n    target.focus({ preventScroll: true });\n  }\n\n  function showRequests() {\n    act({ type: 'page', id: 'overview' });\n    requestAnimationFrame(review);\n  }\n\n  function navigate(pageId: PageId) {\n    act({ type: 'page', id: pageId });\n    act({ type: 'nav', isOpen: false });\n  }\n\n  function changeWorkspace(nextId: string) {\n    setWorkspaceId(nextId);\n    const next = workspaceOf(nextId);\n    onWorkspaceChange?.(next);\n  }\n\n  function openNavigation() {\n    act({ type: 'nav', isOpen: true });\n    focusLater('[data-sheet-close=\"navigation\"]');\n  }\n\n  function closeNavigation() {\n    act({ type: 'nav', isOpen: false });\n    focusLater('[data-nav-open]');\n  }\n\n  function openSearchFromKeys(event: React.KeyboardEvent<HTMLElement>) {\n    if (isSearchShortcut(event)) {\n      event.preventDefault();\n      setIsSearchOpen((isOpen) => !isOpen);\n    }\n  }\n\n  const sidebar = {\n    workspaces: WORKSPACES,\n    workspace,\n    groups: NAV_GROUPS,\n    activePageId: state.pageId,\n    counts,\n    person: CURRENT_PERSON,\n    onWorkspaceChange: changeWorkspace,\n    onNavigate: navigate,\n  };\n\n  return (\n    <div\n      ref={ref}\n      onKeyDown={openSearchFromKeys}\n      className='bg-sidebar text-foreground @container/app min-h-dvh w-full'\n    >\n      <div className='relative flex h-dvh min-h-[40rem] overflow-hidden @3xl/app:p-2'>\n        <div inert={isSheetShown} className='flex min-h-0 min-w-0 flex-1'>\n          <aside\n            aria-label='Sidebar'\n            className='hidden w-60 shrink-0 pe-2 @3xl/app:block'\n          >\n            {!isNarrow && <AppSidebar {...sidebar} className='h-full' />}\n          </aside>\n          <main className='bg-background @3xl/app:hairline-ring @3xl/app:ring-border flex min-w-0 flex-1 flex-col overflow-clip @3xl/app:rounded-xl @3xl/app:shadow-[0_1px_2px_rgb(0_0_0/0.04)]'>\n            <TopBar\n              workspaceName={workspace.name}\n              page={page}\n              notifications={state.notifications}\n              onOpenNavigation={openNavigation}\n              onOpenSearch={() => setIsSearchOpen(true)}\n              onReadNotifications={() => act({ type: 'read' })}\n            />\n            <div ref={scrollerRef} className='min-h-0 flex-1 overflow-y-auto'>\n              <div className='@container/page mx-auto flex w-full max-w-6xl flex-col gap-4 px-4 py-5 @2xl/app:px-6'>\n                {isOverview && (\n                  <OverviewPage\n                    state={state}\n                    pressed={pressed}\n                    workspaceName={workspace.name}\n                    canReplay={canReplay}\n                    onReplay={restart}\n                    onReview={review}\n                    onDecide={decide}\n                  />\n                )}\n                {emptyPage && <EmptyPage item={page} page={emptyPage} />}\n              </div>\n            </div>\n          </main>\n        </div>\n        <InlineSheet\n          name='navigation'\n          label='Navigation'\n          closeLabel='Close the navigation'\n          side='start'\n          isOpen={isSheetShown}\n          className='@3xl/app:hidden'\n          panelClassName='bg-sidebar gap-1 p-2'\n          onClose={closeNavigation}\n        >\n          {isNarrow && <AppSidebar {...sidebar} className='flex-1' />}\n        </InlineSheet>\n        <SearchPalette\n          open={isSearchOpen}\n          groups={NAV_GROUPS}\n          canReview={state.pending.length > 0}\n          onOpenChange={setIsSearchOpen}\n          onNavigate={navigate}\n          onReview={showRequests}\n        />\n        <LiveRegion message={message} />\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-09/index.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-09/account-menu.tsx",
      "content": "'use client';\n\nimport {\n  ChevronsUpDownIcon,\n  CommandIcon,\n  LifeBuoyIcon,\n  LogOutIcon,\n  SettingsIcon,\n  UserIcon,\n} from '@/registry/ndeko/lib/icons';\nimport { Avatar } from '@/registry/ndeko/ui/avatar';\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuSeparator,\n  DropdownMenuTrigger,\n} from '@/registry/ndeko/ui/dropdown-menu';\nimport { Kbd } from '@/registry/ndeko/ui/kbd';\n\nimport type { Person } from './data';\n\nconst TRIGGER = [\n  'flex h-9 w-full min-w-0 items-center gap-2 rounded-md px-1.5 text-start outline-none',\n  'transition-colors duration-150 hover:bg-foreground/5 data-popup-open:bg-foreground/5 focus-visible:ring-[3px] focus-visible:ring-ring/25',\n].join(' ');\n\nexport function AccountMenu({ person }: { person: Person }) {\n  return (\n    <DropdownMenu>\n      <DropdownMenuTrigger\n        render={\n          <button\n            type='button'\n            aria-label={`Account: ${person.name}`}\n            className={TRIGGER}\n          />\n        }\n      >\n        <Avatar seed={person.name} className='size-6' />\n        <span className='min-w-0 flex-1 truncate text-[13px] font-medium'>\n          {person.name}\n        </span>\n        <ChevronsUpDownIcon className='text-muted-foreground size-3.5 shrink-0' />\n      </DropdownMenuTrigger>\n      <DropdownMenuContent side='top' align='start' className='w-60'>\n        <div className='flex items-center gap-2.5 px-2 py-2'>\n          <Avatar seed={person.name} />\n          <div className='min-w-0'>\n            <p className='truncate text-[13px] font-medium'>{person.name}</p>\n            <p className='text-muted-foreground truncate text-xs'>\n              {person.role}\n            </p>\n          </div>\n        </div>\n        <DropdownMenuSeparator />\n        <DropdownMenuItem>\n          <UserIcon />\n          Profile\n        </DropdownMenuItem>\n        <DropdownMenuItem>\n          <SettingsIcon />\n          Preferences\n        </DropdownMenuItem>\n        <DropdownMenuItem>\n          <CommandIcon />\n          Keyboard shortcuts\n          <Kbd className='ms-auto'>?</Kbd>\n        </DropdownMenuItem>\n        <DropdownMenuItem>\n          <LifeBuoyIcon />\n          Help and docs\n        </DropdownMenuItem>\n        <DropdownMenuSeparator />\n        <DropdownMenuItem variant='destructive'>\n          <LogOutIcon />\n          Log out\n        </DropdownMenuItem>\n      </DropdownMenuContent>\n    </DropdownMenu>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-09/account-menu.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-09/activity-feed.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 { CircleXIcon, LoaderIcon } from '@/registry/ndeko/lib/icons';\nimport {\n  fadePresence,\n  rowPresenceOf,\n} from '@/registry/ndeko/lib/motion-presets';\nimport { Avatar } from '@/registry/ndeko/ui/avatar';\nimport { Swap } from '@/registry/ndeko/ui/chat-motion';\nimport { DrawnCheck } from '@/registry/ndeko/ui/drawn-check';\nimport { MeshTile } from '@/registry/ndeko/ui/mesh-tile';\n\nimport { viewOfEntry, type EntryMark, type EntryView } from './activity-view';\nimport { CURRENT_PERSON } from './data';\nimport type { ActivityEntry } from './session';\n\n/** The list keeps its length: a new line arrives at the top and the oldest one leaves. */\nconst SHOWN_ENTRIES = 6;\n\nfunction MarkGlyph({ mark }: { mark: EntryMark }) {\n  if (mark === 'running') {\n    return <LoaderIcon className='text-muted-foreground size-4 animate-spin' />;\n  }\n  if (mark === 'denied') {\n    return <CircleXIcon className='text-muted-foreground size-4' />;\n  }\n  return <DrawnCheck tone='success' entrance='draw' />;\n}\n\nfunction Who({ view }: { view: EntryView }) {\n  if (view.agent === null) {\n    return <Avatar seed={CURRENT_PERSON.name} className='size-7' />;\n  }\n  return (\n    <MeshTile\n      seed={view.agent.name}\n      color={seriesColorOf(view.agent.series)}\n      size='lg'\n    />\n  );\n}\n\nfunction ActivityRow({ entry }: { entry: ActivityEntry }) {\n  const view = viewOfEntry(entry);\n  const fade = fadePresence();\n\n  return (\n    <div className='flex items-start gap-3 px-4 py-2.5'>\n      <Who view={view} />\n      <div className='relative min-w-0 flex-1'>\n        <AnimatePresence mode='popLayout' initial={false}>\n          <motion.div key={view.text} {...fade}>\n            <p className='text-[13px] leading-5 text-pretty'>{view.text}</p>\n            <p className='text-muted-foreground text-xs text-pretty'>\n              {view.detail}\n            </p>\n          </motion.div>\n        </AnimatePresence>\n      </div>\n      <span className='mt-0.5 flex size-[18px] shrink-0 items-center justify-center'>\n        <Swap swapKey={view.mark}>\n          <MarkGlyph mark={view.mark} />\n        </Swap>\n      </span>\n    </div>\n  );\n}\n\nexport function ActivityFeed({ activity }: { activity: ActivityEntry[] }) {\n  const titleId = useId();\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const rowPresence = rowPresenceOf(shouldReduceMotion);\n  const shown = activity.slice(0, SHOWN_ENTRIES);\n\n  return (\n    <section\n      aria-labelledby={titleId}\n      className='bg-card hairline-ring ring-border dark:bg-foreground/[0.03] flex flex-col rounded-xl pt-4 pb-1.5 shadow-[0_1px_2px_rgb(0_0_0/0.04)]'\n    >\n      <h2 id={titleId} className='px-4 pb-2 text-sm font-medium'>\n        Recent activity\n      </h2>\n      <ul className='flex flex-col'>\n        <AnimatePresence initial={false}>\n          {shown.map((entry) => (\n            <motion.li\n              key={entry.id}\n              className='overflow-hidden'\n              {...rowPresence}\n            >\n              <ActivityRow entry={entry} />\n            </motion.li>\n          ))}\n        </AnimatePresence>\n      </ul>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-09/activity-feed.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-09/activity-view.ts",
      "content": "import { AGENTS, REQUESTS, RUNS, type Agent } from './data';\nimport {\n  decisionTextOf,\n  type ActivityEntry,\n  type DecisionEntry,\n  type RunEntry,\n} from './session';\n\nexport type EntryMark = 'running' | 'done' | 'allowed' | 'denied';\n\nexport type EntryView = {\n  /** Who did it: an agent, or null when the person did. */\n  agent: Agent | null;\n  text: string;\n  detail: string;\n  mark: EntryMark;\n};\n\nfunction viewOfRun(entry: RunEntry): EntryView {\n  const seed = RUNS[entry.id];\n  const agent = AGENTS[seed.agentId];\n  if (entry.status === 'running') {\n    return {\n      agent,\n      text: seed.runningText,\n      detail: seed.runningDetail,\n      mark: 'running',\n    };\n  }\n  return { agent, text: seed.doneText, detail: seed.doneDetail, mark: 'done' };\n}\n\nfunction viewOfDecision(entry: DecisionEntry): EntryView {\n  const request = REQUESTS[entry.requestId];\n  const text = decisionTextOf(entry.requestId, entry.decision);\n  const detail = `Asked by ${AGENTS[request.agentId].name}, answered just now`;\n  if (entry.decision === 'approved') {\n    return { agent: null, text, detail, mark: 'allowed' };\n  }\n  return { agent: null, text, detail, mark: 'denied' };\n}\n\nexport function viewOfEntry(entry: ActivityEntry): EntryView {\n  if (entry.kind === 'run') {\n    return viewOfRun(entry);\n  }\n  return viewOfDecision(entry);\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-09/activity-view.ts"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-09/app-sidebar.tsx",
      "content": "'use client';\n\nimport { useId } from 'react';\n\nimport { cn } from '@/registry/ndeko/lib/utils';\n\nimport { AccountMenu } from './account-menu';\nimport type { NavGroup, NavItem, PageId, Person, Workspace } from './data';\nimport { NavRow } from './sidebar-parts';\nimport { WorkspaceSwitcher } from './workspace-switcher';\n\nexport type PageCounts = Partial<Record<PageId, number>>;\n\ntype AppSidebarProps = {\n  workspaces: Workspace[];\n  workspace: Workspace;\n  groups: NavGroup[];\n  activePageId: PageId;\n  counts: PageCounts;\n  person: Person;\n  className?: string;\n  onWorkspaceChange: (workspaceId: string) => void;\n  onNavigate: (pageId: PageId) => void;\n};\n\nfunction GroupLabel({ label }: { label: string }) {\n  return (\n    <p className='text-muted-foreground flex h-6 items-center px-2 text-xs font-medium'>\n      {label}\n    </p>\n  );\n}\n\nexport function AppSidebar({\n  workspaces,\n  workspace,\n  groups,\n  activePageId,\n  counts,\n  person,\n  className,\n  onWorkspaceChange,\n  onNavigate,\n}: AppSidebarProps) {\n  const indicatorId = useId();\n\n  function selectItem(item: NavItem) {\n    onNavigate(item.id);\n  }\n\n  return (\n    <div className={cn('flex min-h-0 flex-col gap-3', className)}>\n      <WorkspaceSwitcher\n        workspaces={workspaces}\n        current={workspace}\n        onSelect={onWorkspaceChange}\n      />\n      <nav\n        aria-label='Main'\n        className='-mx-2 flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-2'\n      >\n        {groups.map((group) => (\n          <div key={group.id} className='flex flex-col gap-0.5'>\n            {group.label && <GroupLabel label={group.label} />}\n            <ul className='flex flex-col gap-px'>\n              {group.items.map((item) => (\n                <NavRow\n                  key={item.id}\n                  item={item}\n                  isActive={item.id === activePageId}\n                  indicatorId={indicatorId}\n                  count={counts[item.id]}\n                  onSelect={selectItem}\n                />\n              ))}\n            </ul>\n          </div>\n        ))}\n      </nav>\n      <AccountMenu person={person} />\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-09/app-sidebar.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-09/data.ts",
      "content": "import type { SeriesSlot } from '@/registry/ndeko/lib/agent-run';\nimport {\n  BotIcon,\n  GaugeIcon,\n  LayoutGridIcon,\n  PlugIcon,\n  RouteIcon,\n  ShieldCheckIcon,\n  UsersIcon,\n  type Icon,\n} from '@/registry/ndeko/lib/icons';\n\nexport type PageId =\n  | 'overview'\n  | 'agents'\n  | 'runs'\n  | 'approvals'\n  | 'connections'\n  | 'usage'\n  | 'members';\n\nexport type NavItem = {\n  id: PageId;\n  label: string;\n  icon: Icon;\n};\n\nexport type NavGroup = {\n  id: string;\n  label?: string;\n  items: NavItem[];\n};\n\nexport type Workspace = {\n  id: string;\n  name: string;\n  memberCount: number;\n};\n\nexport type Person = {\n  name: string;\n  role: string;\n};\n\nexport const WORKSPACES: Workspace[] = [\n  { id: 'kivuline', name: 'Kivuline Roasters', memberCount: 12 },\n  { id: 'lukala', name: 'Lukala Freight', memberCount: 34 },\n  { id: 'personal', name: 'Personal', memberCount: 1 },\n];\n\nexport const CURRENT_PERSON: Person = {\n  name: 'Nadine Kabongo',\n  role: 'Operations lead',\n};\n\nexport const NAV_GROUPS: NavGroup[] = [\n  {\n    id: 'work',\n    items: [\n      { id: 'overview', label: 'Overview', icon: LayoutGridIcon },\n      { id: 'agents', label: 'Agents', icon: BotIcon },\n      { id: 'runs', label: 'Runs', icon: RouteIcon },\n      { id: 'approvals', label: 'Approvals', icon: ShieldCheckIcon },\n    ],\n  },\n  {\n    id: 'workspace',\n    label: 'Workspace',\n    items: [\n      { id: 'connections', label: 'Connections', icon: PlugIcon },\n      { id: 'usage', label: 'Usage', icon: GaugeIcon },\n      { id: 'members', label: 'Members', icon: UsersIcon },\n    ],\n  },\n];\n\nexport type EmptyPage = {\n  title: string;\n  line: string;\n};\n\n/** The template draws the overview: every other page of the sidebar says what belongs on it. */\nexport const EMPTY_PAGES: Record<Exclude<PageId, 'overview'>, EmptyPage> = {\n  agents: {\n    title: 'Every agent, with its tools',\n    line: 'A list of the agents of this workspace, the tools each one can reach and its last run, goes on this page.',\n  },\n  runs: {\n    title: 'Every run, newest first',\n    line: 'The full history of runs, with the plan and the calls of each one, goes on this page.',\n  },\n  approvals: {\n    title: 'Every request, answered or not',\n    line: 'Requests that wait and the ones already answered, with who answered, go on this page.',\n  },\n  connections: {\n    title: 'Tools your agents can reach',\n    line: 'The accounts connected to this workspace and what each agent may do with them go on this page.',\n  },\n  usage: {\n    title: 'Spend, by agent and by day',\n    line: 'The month in detail, with the budget and the agents that use it, goes on this page.',\n  },\n  members: {\n    title: 'The people of this workspace',\n    line: 'Members, their roles and the requests each one answers go on this page.',\n  },\n};\n\nexport type AgentId =\n  'reconciler' | 'writer' | 'researcher' | 'reviewer' | 'planner';\n\nexport type Agent = {\n  id: AgentId;\n  name: string;\n  series: SeriesSlot;\n};\n\nexport const AGENTS: Record<AgentId, Agent> = {\n  reconciler: { id: 'reconciler', name: 'Reconciler', series: 1 },\n  writer: { id: 'writer', name: 'Writer', series: 2 },\n  researcher: { id: 'researcher', name: 'Researcher', series: 3 },\n  reviewer: { id: 'reviewer', name: 'Reviewer', series: 4 },\n  planner: { id: 'planner', name: 'Planner', series: 5 },\n};\n\nexport const AGENT_ORDER: AgentId[] = [\n  'reconciler',\n  'writer',\n  'researcher',\n  'reviewer',\n  'planner',\n];\n\nexport type Risk = 'low' | 'medium' | 'high';\n\nexport type RequestId = 'entries' | 'refund' | 'booking' | 'digest';\n\nexport type RequestSeed = {\n  id: RequestId;\n  agentId: AgentId;\n  title: string;\n  detail: string;\n  risk: Risk;\n  waiting: string;\n};\n\n/** Invented requests and amounts. The figures are illustrative. */\nexport const REQUESTS: Record<RequestId, RequestSeed> = {\n  entries: {\n    id: 'entries',\n    agentId: 'reconciler',\n    title: 'Post 14 journal entries',\n    detail: 'March green coffee purchases, matched to 14 supplier invoices',\n    risk: 'medium',\n    waiting: 'Waiting for 6 min',\n  },\n  refund: {\n    id: 'refund',\n    agentId: 'reviewer',\n    title: 'Refund $240 to Grace Ilunga',\n    detail: 'A wholesale order that arrived a week late, over the $150 limit',\n    risk: 'high',\n    waiting: 'Waiting for 14 min',\n  },\n  booking: {\n    id: 'booking',\n    agentId: 'planner',\n    title: 'Book the Friday freight slot',\n    detail: '8 pallets from Lubumbashi to Kinshasa, $420 deposit',\n    risk: 'medium',\n    waiting: 'Waiting for 22 min',\n  },\n  digest: {\n    id: 'digest',\n    agentId: 'writer',\n    title: 'Send the supplier digest to 12 people',\n    detail: 'The draft is ready and goes out from your address',\n    risk: 'low',\n    waiting: 'Just arrived',\n  },\n};\n\nexport const INITIAL_PENDING: RequestId[] = ['entries', 'refund', 'booking'];\n\nexport type RunId =\n  'digest' | 'posting' | 'bank' | 'vendors' | 'forecast' | 'count';\n\nexport type RunSeed = {\n  id: RunId;\n  agentId: AgentId;\n  runningText: string;\n  doneText: string;\n  runningDetail: string;\n  doneDetail: string;\n  hoursSaved: number;\n  costUsd: number;\n  /** The run starts only if this request was allowed. */\n  afterApproval?: RequestId;\n};\n\nexport const RUNS: Record<RunId, RunSeed> = {\n  digest: {\n    id: 'digest',\n    agentId: 'writer',\n    runningText: 'Writer is drafting the supplier digest',\n    doneText: 'Writer finished the supplier digest',\n    runningDetail: 'Started 3 min ago',\n    doneDetail: 'Took 4 min, $0.38',\n    hoursSaved: 0.6,\n    costUsd: 0.38,\n  },\n  posting: {\n    id: 'posting',\n    agentId: 'reconciler',\n    runningText: 'Reconciler is posting the journal entries',\n    doneText: 'Reconciler posted 14 journal entries',\n    runningDetail: 'Started just now',\n    doneDetail: 'Took 1 min, $1.12',\n    hoursSaved: 1.2,\n    costUsd: 1.12,\n    afterApproval: 'entries',\n  },\n  bank: {\n    id: 'bank',\n    agentId: 'reconciler',\n    runningText: 'Reconciler is matching the bank lines',\n    doneText: 'Reconciler matched 398 of 412 bank lines',\n    runningDetail: 'Started 20 min ago',\n    doneDetail: '26 min ago, 14 lines left for you',\n    hoursSaved: 0,\n    costUsd: 0,\n  },\n  vendors: {\n    id: 'vendors',\n    agentId: 'researcher',\n    runningText: 'Researcher is checking the new suppliers',\n    doneText: 'Researcher checked 6 new suppliers against the vendor list',\n    runningDetail: 'Started 50 min ago',\n    doneDetail: '1 h ago, none flagged',\n    hoursSaved: 0,\n    costUsd: 0,\n  },\n  forecast: {\n    id: 'forecast',\n    agentId: 'reviewer',\n    runningText: 'Reviewer is reading the cash forecast',\n    doneText: 'Reviewer finished the cash forecast review',\n    runningDetail: 'Started 2 h ago',\n    doneDetail: '2 h ago, 3 comments',\n    hoursSaved: 0,\n    costUsd: 0,\n  },\n  count: {\n    id: 'count',\n    agentId: 'planner',\n    runningText: 'Planner is scheduling the stock count',\n    doneText: 'Planner scheduled the stock count for Friday',\n    runningDetail: 'Started 3 h ago',\n    doneDetail: '3 h ago, 4 people notified',\n    hoursSaved: 0,\n    costUsd: 0,\n  },\n};\n\nexport const INITIAL_RUNS: RunId[] = [\n  'digest',\n  'bank',\n  'vendors',\n  'forecast',\n  'count',\n];\n\nexport const BASE_FIGURES = {\n  runsToday: 42,\n  hoursSaved: 18.5,\n};\n\nexport const BUDGET_USD = 120;\n\nexport const BUDGET_LABEL = '$120';\n\nexport const BASE_SPEND: Record<AgentId, number> = {\n  reconciler: 14.6,\n  writer: 9.8,\n  researcher: 8.4,\n  reviewer: 3.9,\n  planner: 1.5,\n};\n\nexport const PAGE = {\n  title: 'Overview',\n  meta: 'This week',\n  note: 'Illustrative figures',\n};\n\nexport const FIGURE_LABELS = {\n  runs: 'Runs today',\n  waiting: 'Need you',\n  hours: 'Hours saved this week',\n  spend: 'Spend this month',\n};\n",
      "type": "registry:component",
      "target": "components/templates/application-09/data.ts"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-09/empty-page.tsx",
      "content": "import type { EmptyPage as EmptyPageCopy, NavItem } from './data';\n\ntype EmptyPageProps = {\n  item: NavItem;\n  page: EmptyPageCopy;\n};\n\nexport function EmptyPage({ item, page }: EmptyPageProps) {\n  const ItemIcon = item.icon;\n\n  return (\n    <div className='flex flex-col items-center gap-3 px-4 py-24 text-center'>\n      <span className='keycap-3d text-muted-foreground flex size-10 items-center justify-center rounded-lg'>\n        <ItemIcon className='size-5' />\n      </span>\n      <div className='flex flex-col gap-1'>\n        <h1 className='text-sm font-medium text-balance'>{page.title}</h1>\n        <p className='text-muted-foreground max-w-xs text-[13px] text-balance'>\n          {page.line}\n        </p>\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-09/empty-page.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-09/figures-band.tsx",
      "content": "'use client';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { WordRoll } from '@/components/core/word-roll';\nimport { cn } from '@/registry/ndeko/lib/utils';\n\nimport { BUDGET_LABEL, FIGURE_LABELS, REQUESTS, type RequestId } from './data';\n\nconst WHOLE: Intl.NumberFormatOptions = { maximumFractionDigits: 0 };\n\nconst ONE_DECIMAL: Intl.NumberFormatOptions = {\n  minimumFractionDigits: 1,\n  maximumFractionDigits: 1,\n};\n\nconst CENTS: Intl.NumberFormatOptions = {\n  style: 'currency',\n  currency: 'USD',\n  minimumFractionDigits: 2,\n  maximumFractionDigits: 2,\n};\n\nconst RUNNING_LABELS = ['None running now', '1 running now'];\n\nconst OLDEST_LABELS = [\n  'All answered',\n  'Just arrived',\n  'Waiting for 6 min',\n  'Waiting for 14 min',\n  'Waiting for 22 min',\n];\n\nfunction runningLineOf(runningNow: number) {\n  if (runningNow === 0) {\n    return 'None running now';\n  }\n  return `${runningNow} running now`;\n}\n\nfunction oldestLineOf(pending: RequestId[]) {\n  const [oldest] = pending;\n  if (oldest === undefined) {\n    return 'All answered';\n  }\n  return REQUESTS[oldest].waiting;\n}\n\ntype FigureProps = {\n  label: string;\n  hasDot?: boolean;\n  children: React.ReactNode;\n  detail: React.ReactNode;\n};\n\nfunction Figure({ label, hasDot = false, children, detail }: FigureProps) {\n  return (\n    <div className='flex min-w-0 flex-col gap-1 rounded-lg px-3 py-2.5'>\n      <span className='text-muted-foreground flex items-center gap-1.5 text-xs font-medium'>\n        <span\n          aria-hidden='true'\n          className={cn(\n            'bg-warning size-1.5 shrink-0 rounded-full transition-opacity duration-200',\n            !hasDot && 'opacity-0'\n          )}\n        />\n        {label}\n      </span>\n      <span className='flex text-2xl leading-8 font-semibold'>{children}</span>\n      <span className='text-muted-foreground flex text-xs'>{detail}</span>\n    </div>\n  );\n}\n\ntype FiguresBandProps = {\n  runsToday: number;\n  runningNow: number;\n  pending: RequestId[];\n  hoursSaved: number;\n  spendUsd: number;\n};\n\nexport function FiguresBand({\n  runsToday,\n  runningNow,\n  pending,\n  hoursSaved,\n  spendUsd,\n}: FiguresBandProps) {\n  const hasPending = pending.length > 0;\n  const runningLine = runningLineOf(runningNow);\n  const oldestLine = oldestLineOf(pending);\n\n  return (\n    <section\n      aria-label='Figures'\n      className='bg-card hairline-ring ring-border dark:bg-foreground/[0.03] grid grid-cols-2 gap-1 rounded-xl p-1.5 shadow-[0_1px_2px_rgb(0_0_0/0.04)] @3xl/page:grid-cols-4'\n    >\n      <Figure\n        label={FIGURE_LABELS.runs}\n        detail={<WordRoll text={runningLine} labels={RUNNING_LABELS} />}\n      >\n        <MotionNumber value={runsToday} format={WHOLE} />\n      </Figure>\n      <Figure\n        label={FIGURE_LABELS.waiting}\n        hasDot={hasPending}\n        detail={<WordRoll text={oldestLine} labels={OLDEST_LABELS} />}\n      >\n        <MotionNumber value={pending.length} format={WHOLE} />\n      </Figure>\n      <Figure label={FIGURE_LABELS.hours} detail='Since Monday'>\n        <MotionNumber value={hoursSaved} format={ONE_DECIMAL} suffix=' h' />\n      </Figure>\n      <Figure label={FIGURE_LABELS.spend} detail={`of ${BUDGET_LABEL} budget`}>\n        <MotionNumber value={spendUsd} format={CENTS} />\n      </Figure>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-09/figures-band.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-09/needs-you.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 { rowPresenceOf } from '@/registry/ndeko/lib/motion-presets';\nimport { Fold } from '@/registry/ndeko/ui/chat-motion';\nimport { DrawnCheck } from '@/registry/ndeko/ui/drawn-check';\nimport { Wash } from '@/registry/ndeko/ui/wash';\n\nimport { REQUESTS, type RequestId } from './data';\nimport { RequestRow } from './request-row';\nimport type { Decision } from './session';\n\ntype NeedsYouProps = {\n  pending: RequestId[];\n  pressed: string | null;\n  onDecide: (requestId: RequestId, decision: Decision) => void;\n};\n\n/** The one live surface of the page: agents that wait on a person, in the hue of waiting. */\nexport function NeedsYou({ pending, pressed, onDecide }: NeedsYouProps) {\n  const titleId = useId();\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const rowPresence = rowPresenceOf(shouldReduceMotion);\n  const hasPending = pending.length > 0;\n\n  return (\n    <section\n      data-needs-you\n      tabIndex={-1}\n      aria-labelledby={titleId}\n      className='bg-card hairline-ring ring-border dark:bg-foreground/[0.03] relative isolate flex flex-col rounded-xl pt-4 pb-1 shadow-[0_1px_2px_rgb(0_0_0/0.04)] outline-none'\n    >\n      <Wash color='var(--warning)' isShown={hasPending} />\n      <div className='flex flex-col gap-0.5 px-4 pb-2'>\n        <h2 id={titleId} className='text-sm font-medium'>\n          Needs you\n        </h2>\n        <p className='text-muted-foreground text-xs text-pretty'>\n          Agents ask here before they send, pay or delete.\n        </p>\n      </div>\n      <ul aria-labelledby={titleId} className='flex flex-col'>\n        <AnimatePresence initial={false}>\n          {pending.map((requestId) => (\n            <motion.li\n              key={requestId}\n              className='overflow-hidden'\n              {...rowPresence}\n            >\n              <RequestRow\n                request={REQUESTS[requestId]}\n                pressed={pressed}\n                onDecide={onDecide}\n              />\n            </motion.li>\n          ))}\n        </AnimatePresence>\n      </ul>\n      <Fold open={!hasPending}>\n        <p className='flex items-center gap-2.5 px-4 py-3 text-[13px]'>\n          <DrawnCheck tone='success' entrance='draw-in-view' />\n          Nothing waits on you.\n        </p>\n      </Fold>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-09/needs-you.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-09/notification-menu.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion, type Transition } from 'motion/react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { seriesColorOf } from '@/registry/ndeko/lib/agent-run';\nimport { BellIcon, CheckIcon } from '@/registry/ndeko/lib/icons';\nimport { EASE_OUT_STRONG } from '@/registry/ndeko/lib/motion-presets';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { MeshTile } from '@/registry/ndeko/ui/mesh-tile';\nimport {\n  Popover,\n  PopoverContent,\n  PopoverTitle,\n  PopoverTrigger,\n} from '@/registry/ndeko/ui/popover';\n\nimport { AGENTS } from './data';\nimport type { NotificationEntry } from './session';\n\nconst DOT_TRANSITION: Transition = { duration: 0.18, ease: EASE_OUT_STRONG };\n\nfunction dotScaleOf(shouldReduceMotion: boolean) {\n  if (shouldReduceMotion) {\n    return 1;\n  }\n  return 0.4;\n}\n\nfunction bellLabelOf(unreadCount: number) {\n  if (unreadCount === 0) {\n    return 'Notifications, nothing unread';\n  }\n  return `Notifications, ${unreadCount} unread`;\n}\n\nfunction unreadLineOf(unreadCount: number) {\n  if (unreadCount === 0) {\n    return 'All read';\n  }\n  return `${unreadCount} unread`;\n}\n\nfunction NotificationRow({ note }: { note: NotificationEntry }) {\n  const agent = AGENTS[note.agentId];\n  const color = seriesColorOf(agent.series);\n\n  return (\n    <li className='flex items-start gap-2.5 rounded-lg px-2 py-2'>\n      <MeshTile seed={agent.name} color={color} size='lg' />\n      <div className='flex min-w-0 flex-1 flex-col'>\n        <p className='text-[13px] leading-5 text-pretty'>{note.text}</p>\n        <p className='text-muted-foreground text-xs'>{note.age}</p>\n      </div>\n      {note.isUnread && (\n        <span\n          aria-hidden='true'\n          className='bg-primary mt-2 size-1.5 shrink-0 rounded-full'\n        />\n      )}\n      {note.isUnread && <span className='sr-only'>Unread</span>}\n    </li>\n  );\n}\n\ntype NotificationMenuProps = {\n  notifications: NotificationEntry[];\n  onReadAll: () => void;\n};\n\nexport function NotificationMenu({\n  notifications,\n  onReadAll,\n}: NotificationMenuProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const unreadCount = notifications.filter((note) => note.isUnread).length;\n  const hasUnread = unreadCount > 0;\n  const dotScale = dotScaleOf(shouldReduceMotion);\n\n  return (\n    <Popover>\n      <PopoverTrigger\n        render={\n          <Button\n            variant='ghost'\n            size='icon-sm'\n            aria-label={bellLabelOf(unreadCount)}\n            className='text-muted-foreground'\n          />\n        }\n      >\n        <BellIcon />\n        <AnimatePresence initial={false}>\n          {hasUnread && (\n            <motion.span\n              key='dot'\n              aria-hidden='true'\n              initial={{ opacity: 0, scale: dotScale }}\n              animate={{ opacity: 1, scale: 1 }}\n              exit={{ opacity: 0, scale: dotScale }}\n              transition={DOT_TRANSITION}\n              className='bg-primary ring-background absolute end-1 top-1 size-2 rounded-full ring-2'\n            />\n          )}\n        </AnimatePresence>\n      </PopoverTrigger>\n      <PopoverContent\n        align='end'\n        className='w-[24rem] max-w-[calc(100vw-1rem)] p-0'\n      >\n        <div className='flex h-11 items-center justify-between gap-2 ps-4 pe-2'>\n          <div className='flex items-baseline gap-2'>\n            <PopoverTitle className='text-[13px] leading-none font-semibold'>\n              Notifications\n            </PopoverTitle>\n            <span className='text-muted-foreground text-xs tabular-nums'>\n              {unreadLineOf(unreadCount)}\n            </span>\n          </div>\n          <Button\n            variant='ghost'\n            size='sm'\n            disabled={!hasUnread}\n            onClick={onReadAll}\n            className='text-muted-foreground'\n          >\n            <CheckIcon />\n            Mark all as read\n          </Button>\n        </div>\n        <ul\n          aria-label='Notifications'\n          className='max-h-[22rem] overflow-y-auto px-1.5 pb-1.5'\n        >\n          {notifications.map((note) => (\n            <NotificationRow key={note.id} note={note} />\n          ))}\n        </ul>\n      </PopoverContent>\n    </Popover>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-09/notification-menu.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-09/overview-page.tsx",
      "content": "'use client';\n\nimport { ActivityFeed } from './activity-feed';\nimport type { RequestId } from './data';\nimport { FiguresBand } from './figures-band';\nimport { NeedsYou } from './needs-you';\nimport { PageHeader } from './page-header';\nimport {\n  totalSpendOf,\n  type ActivityEntry,\n  type DashboardState,\n  type Decision,\n} from './session';\nimport { UsageCard } from './usage-card';\n\nfunction isRunning(entry: ActivityEntry) {\n  if (entry.kind !== 'run') {\n    return false;\n  }\n  return entry.status === 'running';\n}\n\ntype OverviewPageProps = {\n  state: DashboardState;\n  pressed: string | null;\n  workspaceName: string;\n  canReplay: boolean;\n  onReplay: () => void;\n  onReview: () => void;\n  onDecide: (requestId: RequestId, decision: Decision) => void;\n};\n\nexport function OverviewPage({\n  state,\n  pressed,\n  workspaceName,\n  canReplay,\n  onReplay,\n  onReview,\n  onDecide,\n}: OverviewPageProps) {\n  const runningNow = state.activity.filter(isRunning).length;\n  const spendUsd = totalSpendOf(state.spend);\n  const hasRequests = state.pending.length > 0;\n\n  return (\n    <>\n      <PageHeader\n        workspaceName={workspaceName}\n        hasRequests={hasRequests}\n        canReplay={canReplay}\n        onReplay={onReplay}\n        onReview={onReview}\n      />\n      <FiguresBand\n        runsToday={state.runsToday}\n        runningNow={runningNow}\n        pending={state.pending}\n        hoursSaved={state.hoursSaved}\n        spendUsd={spendUsd}\n      />\n      <div className='grid items-start gap-4 @4xl/page:grid-cols-[minmax(0,1fr)_19rem]'>\n        <div className='flex min-w-0 flex-col gap-4'>\n          <NeedsYou\n            pending={state.pending}\n            pressed={pressed}\n            onDecide={onDecide}\n          />\n          <ActivityFeed activity={state.activity} />\n        </div>\n        <UsageCard spend={state.spend} />\n      </div>\n    </>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-09/overview-page.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-09/page-header.tsx",
      "content": "'use client';\n\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { ReplayButton } from '@/registry/ndeko/ui/replay-button';\n\nimport { PAGE } from './data';\n\ntype PageHeaderProps = {\n  workspaceName: string;\n  hasRequests: boolean;\n  canReplay: boolean;\n  onReplay: () => void;\n  onReview: () => void;\n};\n\nexport function PageHeader({\n  workspaceName,\n  hasRequests,\n  canReplay,\n  onReplay,\n  onReview,\n}: PageHeaderProps) {\n  return (\n    <div className='flex flex-wrap items-center gap-x-3 gap-y-2'>\n      <div className='flex min-w-0 flex-1 basis-48 flex-col gap-0.5'>\n        <h1 className='truncate text-lg font-semibold text-balance'>\n          {PAGE.title}\n        </h1>\n        <p className='text-muted-foreground truncate text-xs'>\n          {workspaceName}, {PAGE.meta}\n        </p>\n      </div>\n      <div className='flex flex-wrap items-center gap-2'>\n        <Badge variant='secondary'>{PAGE.note}</Badge>\n        <ReplayButton isShown={canReplay} onReplay={onReplay} label='Replay' />\n        <Button\n          type='button'\n          size='sm'\n          disabled={!hasRequests}\n          onClick={onReview}\n        >\n          Review requests\n        </Button>\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-09/page-header.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-09/request-row.tsx",
      "content": "'use client';\n\nimport { seriesColorOf } from '@/registry/ndeko/lib/agent-run';\nimport {\n  pressedQuietOf,\n  pressedSolidOf,\n} from '@/registry/ndeko/lib/demonstration';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { MeshTile } from '@/registry/ndeko/ui/mesh-tile';\n\nimport { AGENTS, type RequestSeed, type Risk } from './data';\nimport type { Decision } from './session';\n\nconst RISK_WORD: Record<Risk, string> = {\n  low: 'Low risk',\n  medium: 'Medium risk',\n  high: 'High risk',\n};\n\nconst RISK_VARIANT = {\n  low: 'secondary',\n  medium: 'warning',\n  high: 'destructive',\n} as const;\n\ntype RequestRowProps = {\n  request: RequestSeed;\n  pressed: string | null;\n  onDecide: (requestId: RequestSeed['id'], decision: Decision) => void;\n};\n\nexport function RequestRow({ request, pressed, onDecide }: RequestRowProps) {\n  const agent = AGENTS[request.agentId];\n  const isAllowPressed = pressed === `allow-${request.id}`;\n  const isDenyPressed = pressed === `deny-${request.id}`;\n\n  function allow() {\n    onDecide(request.id, 'approved');\n  }\n\n  function deny() {\n    onDecide(request.id, 'denied');\n  }\n\n  return (\n    <div className='flex flex-wrap items-start gap-x-3 gap-y-2.5 px-4 py-3'>\n      <MeshTile\n        seed={agent.name}\n        color={seriesColorOf(agent.series)}\n        size='lg'\n      />\n      <div className='flex min-w-0 flex-1 basis-52 flex-col gap-0.5'>\n        <p className='flex flex-wrap items-center gap-x-2 gap-y-1'>\n          <span className='text-[13px] leading-5 font-medium text-pretty'>\n            {request.title}\n          </span>\n          <Badge variant={RISK_VARIANT[request.risk]}>\n            {RISK_WORD[request.risk]}\n          </Badge>\n        </p>\n        <p className='text-muted-foreground text-xs leading-5 text-pretty'>\n          {agent.name} asks. {request.detail}\n        </p>\n        <p className='text-muted-foreground text-xs'>{request.waiting}</p>\n      </div>\n      <div className='flex shrink-0 items-center gap-2'>\n        <Button\n          type='button'\n          size='sm'\n          aria-label={`Allow: ${request.title}`}\n          onClick={allow}\n          className={pressedSolidOf(isAllowPressed)}\n        >\n          Allow\n        </Button>\n        <Button\n          type='button'\n          size='sm'\n          variant='outline'\n          aria-label={`Deny: ${request.title}`}\n          onClick={deny}\n          className={pressedQuietOf(isDenyPressed)}\n        >\n          Deny\n        </Button>\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-09/request-row.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-09/search-palette.tsx",
      "content": "'use client';\n\nimport { seriesColorOf } from '@/registry/ndeko/lib/agent-run';\nimport { SearchIcon, ShieldCheckIcon } from '@/registry/ndeko/lib/icons';\nimport { CONTROL_RECIPE } from '@/registry/ndeko/lib/recipes';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport {\n  CommandDialog,\n  CommandEmpty,\n  CommandGroup,\n  CommandInput,\n  CommandItem,\n  CommandList,\n} from '@/registry/ndeko/ui/command';\nimport { Kbd } from '@/registry/ndeko/ui/kbd';\nimport { MeshTile } from '@/registry/ndeko/ui/mesh-tile';\n\nimport { AGENTS, AGENT_ORDER, type NavGroup, type PageId } from './data';\n\nexport function SearchTrigger({ onOpen }: { onOpen: () => void }) {\n  return (\n    <>\n      <Button\n        variant='ghost'\n        size='icon-sm'\n        aria-label='Search'\n        onClick={onOpen}\n        className='text-muted-foreground @2xl/app:hidden'\n      >\n        <SearchIcon />\n      </Button>\n      <button\n        type='button'\n        onClick={onOpen}\n        className={cn(\n          CONTROL_RECIPE,\n          'text-muted-foreground hidden h-8 w-56 cursor-pointer items-center gap-2 px-2.5 text-start @2xl/app:flex'\n        )}\n      >\n        <SearchIcon className='size-4 shrink-0' />\n        <span className='min-w-0 flex-1 truncate'>Search</span>\n        <Kbd>⌘K</Kbd>\n      </button>\n    </>\n  );\n}\n\ntype SearchPaletteProps = {\n  open: boolean;\n  groups: NavGroup[];\n  canReview: boolean;\n  onOpenChange: (open: boolean) => void;\n  onNavigate: (pageId: PageId) => void;\n  onReview: () => void;\n};\n\nexport function SearchPalette({\n  open,\n  groups,\n  canReview,\n  onOpenChange,\n  onNavigate,\n  onReview,\n}: SearchPaletteProps) {\n  function close() {\n    onOpenChange(false);\n  }\n\n  function review() {\n    close();\n    onReview();\n  }\n\n  function goToAgents() {\n    close();\n    onNavigate('agents');\n  }\n\n  return (\n    <CommandDialog\n      open={open}\n      onOpenChange={onOpenChange}\n      title='Search'\n      description='Go to a page, an agent or a request'\n    >\n      <CommandInput placeholder='Go to a page, an agent or a request' />\n      <CommandList>\n        <CommandEmpty>Nothing matches. Try the name of an agent.</CommandEmpty>\n        {canReview && (\n          <CommandGroup heading='Actions'>\n            <CommandItem onSelect={review}>\n              <ShieldCheckIcon />\n              Review requests\n            </CommandItem>\n          </CommandGroup>\n        )}\n        {groups.map((group) => (\n          <CommandGroup key={group.id} heading={group.label ?? 'Pages'}>\n            {group.items.map((item) => {\n              const ItemIcon = item.icon;\n\n              function goToPage() {\n                close();\n                onNavigate(item.id);\n              }\n\n              return (\n                <CommandItem\n                  key={item.id}\n                  value={`${group.id} ${item.label}`}\n                  onSelect={goToPage}\n                >\n                  <ItemIcon />\n                  {item.label}\n                </CommandItem>\n              );\n            })}\n          </CommandGroup>\n        ))}\n        <CommandGroup heading='Agents'>\n          {AGENT_ORDER.map((agentId) => {\n            const agent = AGENTS[agentId];\n\n            return (\n              <CommandItem\n                key={agent.id}\n                value={`agent ${agent.name}`}\n                onSelect={goToAgents}\n              >\n                <MeshTile\n                  seed={agent.name}\n                  color={seriesColorOf(agent.series)}\n                  size='sm'\n                />\n                {agent.name}\n              </CommandItem>\n            );\n          })}\n        </CommandGroup>\n      </CommandList>\n    </CommandDialog>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-09/search-palette.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-09/session.ts",
      "content": "import type { SessionStep } from '@/registry/ndeko/hooks/use-session';\nimport { restingOf } from '@/registry/ndeko/lib/run-session';\n\nimport {\n  AGENTS,\n  AGENT_ORDER,\n  BASE_FIGURES,\n  BASE_SPEND,\n  INITIAL_PENDING,\n  INITIAL_RUNS,\n  REQUESTS,\n  RUNS,\n  type AgentId,\n  type PageId,\n  type RequestId,\n  type RunId,\n  type RunSeed,\n} from './data';\n\nexport type Decision = 'approved' | 'denied';\n\nexport type RunEntry = {\n  kind: 'run';\n  id: RunId;\n  status: 'running' | 'done';\n};\n\nexport type DecisionEntry = {\n  kind: 'decision';\n  id: string;\n  requestId: RequestId;\n  decision: Decision;\n};\n\nexport type ActivityEntry = RunEntry | DecisionEntry;\n\nexport type NotificationEntry = {\n  id: string;\n  agentId: AgentId;\n  text: string;\n  age: string;\n  isUnread: boolean;\n};\n\nexport type DashboardState = {\n  pending: RequestId[];\n  activity: ActivityEntry[];\n  notifications: NotificationEntry[];\n  runsToday: number;\n  hoursSaved: number;\n  spend: Record<AgentId, number>;\n  pageId: PageId;\n  isNavOpen: boolean;\n  spoken: string;\n};\n\nexport type DashboardAction =\n  | { type: 'finished'; id: RunId }\n  | { type: 'ran'; id: RunId }\n  | { type: 'requested'; id: RequestId }\n  | { type: 'decided'; id: RequestId; decision: Decision }\n  | { type: 'read' }\n  | { type: 'page'; id: PageId }\n  | { type: 'nav'; isOpen: boolean };\n\ntype Step = SessionStep<DashboardState, DashboardAction>;\n\nfunction initialEntryOf(id: RunId): RunEntry {\n  if (id === 'digest') {\n    return { kind: 'run', id, status: 'running' };\n  }\n  return { kind: 'run', id, status: 'done' };\n}\n\nconst INITIAL_NOTIFICATIONS: NotificationEntry[] = [\n  {\n    id: 'note-bank',\n    agentId: 'reconciler',\n    text: RUNS.bank.doneText,\n    age: '26 min ago',\n    isUnread: false,\n  },\n  {\n    id: 'note-vendors',\n    agentId: 'researcher',\n    text: RUNS.vendors.doneText,\n    age: '1 h ago',\n    isUnread: false,\n  },\n  {\n    id: 'note-forecast',\n    agentId: 'reviewer',\n    text: RUNS.forecast.doneText,\n    age: '2 h ago',\n    isUnread: false,\n  },\n];\n\nexport const INITIAL: DashboardState = {\n  pending: INITIAL_PENDING,\n  activity: INITIAL_RUNS.map(initialEntryOf),\n  notifications: INITIAL_NOTIFICATIONS,\n  runsToday: BASE_FIGURES.runsToday,\n  hoursSaved: BASE_FIGURES.hoursSaved,\n  spend: BASE_SPEND,\n  pageId: 'overview',\n  isNavOpen: false,\n  spoken: '',\n};\n\nfunction roundedTo(value: number, places: number) {\n  const factor = 10 ** places;\n  return Math.round(value * factor) / factor;\n}\n\nexport function totalSpendOf(spend: Record<AgentId, number>) {\n  let total = 0;\n  for (const agentId of AGENT_ORDER) {\n    total += spend[agentId];\n  }\n  return roundedTo(total, 2);\n}\n\nexport function lowercasedFirst(text: string) {\n  const first = text.charAt(0).toLowerCase();\n  return `${first}${text.slice(1)}`;\n}\n\nexport function decisionTextOf(requestId: RequestId, decision: Decision) {\n  const request = REQUESTS[requestId];\n  const agent = AGENTS[request.agentId];\n  const task = lowercasedFirst(request.title);\n  if (decision === 'approved') {\n    return `You allowed ${agent.name} to ${task}`;\n  }\n  return `You denied ${agent.name} the request to ${task}`;\n}\n\nfunction completed(state: DashboardState, seed: RunSeed): DashboardState {\n  const agentSpend = state.spend[seed.agentId] + seed.costUsd;\n  const spend = { ...state.spend, [seed.agentId]: roundedTo(agentSpend, 2) };\n  const hoursSaved = roundedTo(state.hoursSaved + seed.hoursSaved, 1);\n  return { ...state, runsToday: state.runsToday + 1, hoursSaved, spend };\n}\n\nfunction isRunEntryOf(entry: ActivityEntry, id: RunId) {\n  if (entry.kind !== 'run') {\n    return false;\n  }\n  return entry.id === id;\n}\n\nfunction isRunningEntryOf(entry: ActivityEntry, id: RunId) {\n  if (entry.kind !== 'run') {\n    return false;\n  }\n  const isSameRun = entry.id === id;\n  const isRunning = entry.status === 'running';\n  return isSameRun && isRunning;\n}\n\nfunction isApprovalOf(entry: ActivityEntry, requestId: RequestId) {\n  if (entry.kind !== 'decision') {\n    return false;\n  }\n  const isSameRequest = entry.requestId === requestId;\n  const isApprovedEntry = entry.decision === 'approved';\n  return isSameRequest && isApprovedEntry;\n}\n\nfunction hasRunEntry(state: DashboardState, id: RunId) {\n  return state.activity.some((entry) => isRunEntryOf(entry, id));\n}\n\nfunction isApproved(state: DashboardState, requestId: RequestId) {\n  return state.activity.some((entry) => isApprovalOf(entry, requestId));\n}\n\nfunction withEntryDone(entry: ActivityEntry, id: RunId): ActivityEntry {\n  if (entry.kind !== 'run') {\n    return entry;\n  }\n  if (entry.id !== id) {\n    return entry;\n  }\n  return { ...entry, status: 'done' };\n}\n\nfunction notificationOfRun(seed: RunSeed): NotificationEntry {\n  return {\n    id: `note-${seed.id}`,\n    agentId: seed.agentId,\n    text: seed.doneText,\n    age: 'Just now',\n    isUnread: true,\n  };\n}\n\nfunction notificationOfRequest(requestId: RequestId): NotificationEntry {\n  const request = REQUESTS[requestId];\n  const agent = AGENTS[request.agentId];\n  return {\n    id: `note-ask-${requestId}`,\n    agentId: request.agentId,\n    text: `${agent.name} asks to ${lowercasedFirst(request.title)}`,\n    age: 'Just now',\n    isUnread: true,\n  };\n}\n\nfunction finished(state: DashboardState, id: RunId): DashboardState {\n  const isRunning = state.activity.some((entry) => isRunningEntryOf(entry, id));\n  if (!isRunning) {\n    return state;\n  }\n  const seed = RUNS[id];\n  const activity = state.activity.map((entry) => withEntryDone(entry, id));\n  const notifications = [notificationOfRun(seed), ...state.notifications];\n  const next = completed({ ...state, activity, notifications }, seed);\n  return { ...next, spoken: seed.doneText };\n}\n\nfunction ran(state: DashboardState, id: RunId): DashboardState {\n  const seed = RUNS[id];\n  const isKnown = hasRunEntry(state, id);\n  const isBlocked =\n    seed.afterApproval !== undefined && !isApproved(state, seed.afterApproval);\n  if (isKnown || isBlocked) {\n    return state;\n  }\n  const entry: RunEntry = { kind: 'run', id, status: 'done' };\n  const activity = [entry, ...state.activity];\n  const notifications = [notificationOfRun(seed), ...state.notifications];\n  const next = completed({ ...state, activity, notifications }, seed);\n  return { ...next, spoken: seed.doneText };\n}\n\nfunction requested(state: DashboardState, id: RequestId): DashboardState {\n  const isWaiting = state.pending.includes(id);\n  if (isWaiting) {\n    return state;\n  }\n  const notification = notificationOfRequest(id);\n  const notifications = [notification, ...state.notifications];\n  const pending = [...state.pending, id];\n  return { ...state, pending, notifications, spoken: notification.text };\n}\n\nfunction decided(\n  state: DashboardState,\n  id: RequestId,\n  decision: Decision\n): DashboardState {\n  const isWaiting = state.pending.includes(id);\n  if (!isWaiting) {\n    return state;\n  }\n  const pending = state.pending.filter((requestId) => requestId !== id);\n  const entry: DecisionEntry = {\n    kind: 'decision',\n    id: `decision-${id}`,\n    requestId: id,\n    decision,\n  };\n  const activity = [entry, ...state.activity];\n  return {\n    ...state,\n    pending,\n    activity,\n    spoken: decisionTextOf(id, decision),\n  };\n}\n\nfunction read(state: DashboardState): DashboardState {\n  const notifications = state.notifications.map((note) => ({\n    ...note,\n    isUnread: false,\n  }));\n  return { ...state, notifications };\n}\n\nexport function reducer(\n  state: DashboardState,\n  action: DashboardAction\n): DashboardState {\n  switch (action.type) {\n    case 'finished':\n      return finished(state, action.id);\n    case 'ran':\n      return ran(state, action.id);\n    case 'requested':\n      return requested(state, action.id);\n    case 'decided':\n      return decided(state, action.id, action.decision);\n    case 'read':\n      return read(state);\n    case 'page':\n      return { ...state, pageId: action.id };\n    case 'nav':\n      return { ...state, isNavOpen: action.isOpen };\n  }\n}\n\nexport function unreadCountOf(state: DashboardState) {\n  return state.notifications.filter((note) => note.isUnread).length;\n}\n\nfunction isAnswered(requestId: RequestId) {\n  return (state: DashboardState) => !state.pending.includes(requestId);\n}\n\nfunction decide(requestId: RequestId, decision: Decision): DashboardAction {\n  return { type: 'decided', id: requestId, decision };\n}\n\n/**\n * The Writer finishes its digest and asks to send it. A person allows the journal entries, so the\n * Reconciler posts them, then turns the refund down. The agents' steps play for everyone, the two\n * answers are the person's.\n */\nexport const SCRIPT: Step[] = [\n  { after: 2600, action: { type: 'finished', id: 'digest' } },\n  { after: 1100, action: { type: 'requested', id: 'digest' } },\n  {\n    after: 2400,\n    by: 'person',\n    press: 'allow-entries',\n    action: decide('entries', 'approved'),\n    isAnswered: isAnswered('entries'),\n  },\n  { after: 1500, action: { type: 'ran', id: 'posting' } },\n  {\n    after: 2800,\n    by: 'person',\n    press: 'deny-refund',\n    action: decide('refund', 'denied'),\n    isAnswered: isAnswered('refund'),\n  },\n];\n\nconst ENDED = restingOf(INITIAL, SCRIPT, reducer);\n\n/** Under reduced motion the round is over: the entries are posted, the refund is turned down and the digest waits. */\nexport const RESTING: DashboardState = {\n  ...ENDED,\n  isNavOpen: false,\n  spoken: '',\n};\n\nexport const LOOP_AFTER_MS = 3600;\n",
      "type": "registry:component",
      "target": "components/templates/application-09/session.ts"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-09/sidebar-parts.tsx",
      "content": "'use client';\n\nimport { motion, type Transition } from 'motion/react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport {\n  EASE_IN_OUT_STRONG,\n  INSTANT,\n} from '@/registry/ndeko/lib/motion-presets';\n\nimport type { NavItem } from './data';\n\nexport const NAV_ROW = [\n  'relative flex h-7 w-full min-w-0 items-center gap-2 rounded-md px-2 text-start text-[13px] font-medium text-foreground outline-none',\n  'transition-colors duration-150 hover:bg-foreground/5 focus-visible:ring-[3px] focus-visible:ring-ring/25',\n  \"[&_svg]:pointer-events-none [&_svg]:relative [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground\",\n].join(' ');\n\nconst INDICATOR_TRAVEL: Transition = {\n  duration: 0.25,\n  ease: EASE_IN_OUT_STRONG,\n};\n\nfunction travelOf(shouldReduceMotion: boolean) {\n  if (shouldReduceMotion) {\n    return INSTANT;\n  }\n  return INDICATOR_TRAVEL;\n}\n\nfunction ActiveRowIndicator({ layoutId }: { layoutId: string }) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n\n  return (\n    <motion.span\n      aria-hidden='true'\n      layoutId={layoutId}\n      transition={travelOf(shouldReduceMotion)}\n      className='bg-foreground/[0.07] absolute inset-0 rounded-md'\n    />\n  );\n}\n\nfunction ariaCurrentOf(isActive: boolean) {\n  if (isActive) {\n    return 'page' as const;\n  }\n  return undefined;\n}\n\ntype NavRowProps = {\n  item: NavItem;\n  isActive: boolean;\n  indicatorId: string;\n  count?: number;\n  onSelect: (item: NavItem) => void;\n};\n\nexport function NavRow({\n  item,\n  isActive,\n  indicatorId,\n  count = 0,\n  onSelect,\n}: NavRowProps) {\n  const hasCount = count > 0;\n  const ItemIcon = item.icon;\n\n  function selectItem() {\n    onSelect(item);\n  }\n\n  return (\n    <li>\n      <button\n        type='button'\n        aria-current={ariaCurrentOf(isActive)}\n        onClick={selectItem}\n        className={NAV_ROW}\n      >\n        {isActive && <ActiveRowIndicator layoutId={indicatorId} />}\n        <ItemIcon />\n        <span className='relative min-w-0 flex-1 truncate'>{item.label}</span>\n        {hasCount && (\n          <MotionNumber\n            value={count}\n            className='text-muted-foreground relative text-xs font-normal'\n          />\n        )}\n      </button>\n    </li>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-09/sidebar-parts.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-09/top-bar.tsx",
      "content": "'use client';\n\nimport { MenuIcon } from '@/registry/ndeko/lib/icons';\nimport {\n  Breadcrumb,\n  BreadcrumbItem,\n  BreadcrumbList,\n  BreadcrumbPage,\n  BreadcrumbSeparator,\n} from '@/registry/ndeko/ui/breadcrumb';\nimport { Button } from '@/registry/ndeko/ui/button';\n\nimport type { NavItem } from './data';\nimport { NotificationMenu } from './notification-menu';\nimport { SearchTrigger } from './search-palette';\nimport type { NotificationEntry } from './session';\n\ntype TopBarProps = {\n  workspaceName: string;\n  page: NavItem;\n  notifications: NotificationEntry[];\n  onOpenNavigation: () => void;\n  onOpenSearch: () => void;\n  onReadNotifications: () => void;\n};\n\nexport function TopBar({\n  workspaceName,\n  page,\n  notifications,\n  onOpenNavigation,\n  onOpenSearch,\n  onReadNotifications,\n}: TopBarProps) {\n  const PageIcon = page.icon;\n\n  return (\n    <header className='hairline-b border-border flex h-11 shrink-0 items-center gap-2 px-3 @2xl/app:px-4'>\n      <Button\n        variant='ghost'\n        size='icon-sm'\n        aria-label='Open navigation'\n        data-nav-open\n        onClick={onOpenNavigation}\n        className='text-muted-foreground @3xl/app:hidden'\n      >\n        <MenuIcon />\n      </Button>\n      <Breadcrumb className='min-w-0'>\n        <BreadcrumbList className='flex-nowrap'>\n          <li aria-hidden='true' className='flex'>\n            <PageIcon className='text-muted-foreground size-4 shrink-0' />\n          </li>\n          <BreadcrumbItem className='hidden @xl/app:inline-flex'>\n            {workspaceName}\n          </BreadcrumbItem>\n          <BreadcrumbSeparator className='hidden @xl/app:block' />\n          <BreadcrumbItem className='min-w-0'>\n            <BreadcrumbPage className='truncate'>{page.label}</BreadcrumbPage>\n          </BreadcrumbItem>\n        </BreadcrumbList>\n      </Breadcrumb>\n      <div className='ms-auto flex items-center gap-1.5'>\n        <SearchTrigger onOpen={onOpenSearch} />\n        <NotificationMenu\n          notifications={notifications}\n          onReadAll={onReadNotifications}\n        />\n      </div>\n    </header>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-09/top-bar.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-09/usage-card.tsx",
      "content": "'use client';\n\nimport { useId } from 'react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { seriesColorOf } from '@/registry/ndeko/lib/agent-run';\nimport { MeshTile } from '@/registry/ndeko/ui/mesh-tile';\n\nimport {\n  AGENTS,\n  AGENT_ORDER,\n  BUDGET_LABEL,\n  BUDGET_USD,\n  type AgentId,\n} from './data';\nimport { totalSpendOf } from './session';\n\nconst CENTS: Intl.NumberFormatOptions = {\n  style: 'currency',\n  currency: 'USD',\n  minimumFractionDigits: 2,\n  maximumFractionDigits: 2,\n};\n\nconst VIEW = 36;\n\nconst CENTRE = VIEW / 2;\n\nconst RADIUS = 15;\n\nconst CIRCUMFERENCE = 2 * Math.PI * RADIUS;\n\nfunction shareOf(amount: number) {\n  return Math.min(1, amount / BUDGET_USD);\n}\n\nfunction emptyLengthOf(share: number) {\n  return CIRCUMFERENCE * (1 - share);\n}\n\n/** The ring eases to its new length once per run, which is the only time it is painted again. */\nfunction UsageRing({ share }: { share: number }) {\n  const percent = Math.round(share * 100);\n\n  return (\n    <span className='relative inline-flex size-24 shrink-0 items-center justify-center'>\n      <svg\n        aria-hidden='true'\n        viewBox={`0 0 ${VIEW} ${VIEW}`}\n        className='absolute inset-0 size-full -rotate-90'\n      >\n        <circle\n          cx={CENTRE}\n          cy={CENTRE}\n          r={RADIUS}\n          fill='none'\n          strokeWidth={3}\n          className='stroke-foreground/10'\n        />\n        <circle\n          cx={CENTRE}\n          cy={CENTRE}\n          r={RADIUS}\n          fill='none'\n          strokeWidth={3}\n          strokeLinecap='round'\n          strokeDasharray={CIRCUMFERENCE}\n          strokeDashoffset={emptyLengthOf(share)}\n          className='stroke-primary transition-[stroke-dashoffset] duration-500 ease-(--ease-out-strong)'\n        />\n      </svg>\n      <span className='flex items-baseline text-xl font-semibold'>\n        <MotionNumber value={percent} />\n        <span className='text-muted-foreground text-xs font-normal'>%</span>\n      </span>\n    </span>\n  );\n}\n\nfunction AgentSpend({ agentId, amount }: { agentId: AgentId; amount: number }) {\n  const agent = AGENTS[agentId];\n  const color = seriesColorOf(agent.series);\n  const share = shareOf(amount);\n\n  return (\n    <li className='flex flex-col gap-1.5'>\n      <div className='flex items-center gap-2'>\n        <MeshTile seed={agent.name} color={color} size='sm' />\n        <span className='min-w-0 flex-1 truncate text-[13px]'>\n          {agent.name}\n        </span>\n        <MotionNumber value={amount} format={CENTS} className='text-xs' />\n      </div>\n      <span className='bg-foreground/[0.06] block h-1 overflow-hidden rounded-full'>\n        <span\n          style={{ backgroundColor: color, transform: `scaleX(${share})` }}\n          className='block h-full origin-left rounded-full transition-transform duration-500 ease-(--ease-out-strong)'\n        />\n      </span>\n    </li>\n  );\n}\n\ntype UsageCardProps = {\n  spend: Record<AgentId, number>;\n};\n\nexport function UsageCard({ spend }: UsageCardProps) {\n  const titleId = useId();\n  const total = totalSpendOf(spend);\n  const share = shareOf(total);\n\n  return (\n    <section\n      aria-labelledby={titleId}\n      className='bg-card hairline-ring ring-border dark:bg-foreground/[0.03] flex flex-col gap-5 rounded-xl p-4 shadow-[0_1px_2px_rgb(0_0_0/0.04)]'\n    >\n      <h2 id={titleId} className='text-sm font-medium'>\n        Usage this month\n      </h2>\n      <div className='flex items-center gap-4'>\n        <UsageRing share={share} />\n        <div className='flex min-w-0 flex-col gap-0.5'>\n          <span className='text-muted-foreground text-xs'>Spent so far</span>\n          <MotionNumber\n            value={total}\n            format={CENTS}\n            className='text-xl font-semibold'\n          />\n          <span className='text-muted-foreground text-xs'>\n            of {BUDGET_LABEL} budget\n          </span>\n        </div>\n      </div>\n      <ul aria-label='Spend by agent' className='flex flex-col gap-3.5'>\n        {AGENT_ORDER.map((agentId) => (\n          <AgentSpend key={agentId} agentId={agentId} amount={spend[agentId]} />\n        ))}\n      </ul>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-09/usage-card.tsx"
    },
    {
      "path": "registry/ndeko/templates/dashboards/application-09/workspace-switcher.tsx",
      "content": "'use client';\n\nimport {\n  ChevronsUpDownIcon,\n  PlusIcon,\n  SettingsIcon,\n} from '@/registry/ndeko/lib/icons';\nimport { nounOf } from '@/registry/ndeko/lib/words';\nimport { CompanyMark } from '@/registry/ndeko/ui/company-mark';\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuLabel,\n  DropdownMenuRadioGroup,\n  DropdownMenuRadioItem,\n  DropdownMenuSeparator,\n  DropdownMenuTrigger,\n} from '@/registry/ndeko/ui/dropdown-menu';\nimport { Kbd } from '@/registry/ndeko/ui/kbd';\n\nimport type { Workspace } from './data';\n\nconst TRIGGER = [\n  'flex h-9 min-w-0 flex-1 items-center gap-2 rounded-md px-1.5 text-start outline-none',\n  'transition-colors duration-150 hover:bg-foreground/5 data-popup-open:bg-foreground/5 focus-visible:ring-[3px] focus-visible:ring-ring/25',\n].join(' ');\n\nfunction memberLabelOf(count: number) {\n  const noun = nounOf(count, 'member');\n  return `${count} ${noun}`;\n}\n\ntype WorkspaceSwitcherProps = {\n  workspaces: Workspace[];\n  current: Workspace;\n  onSelect: (workspaceId: string) => void;\n};\n\nexport function WorkspaceSwitcher({\n  workspaces,\n  current,\n  onSelect,\n}: WorkspaceSwitcherProps) {\n  function selectWorkspace(value: unknown) {\n    if (typeof value === 'string') {\n      onSelect(value);\n    }\n  }\n\n  return (\n    <DropdownMenu>\n      <DropdownMenuTrigger\n        render={\n          <button\n            type='button'\n            aria-label={`Workspace: ${current.name}`}\n            className={TRIGGER}\n          />\n        }\n      >\n        <CompanyMark seed={current.name} className='size-6 rounded-md' />\n        <span className='min-w-0 flex-1 truncate text-[13px] font-semibold'>\n          {current.name}\n        </span>\n        <ChevronsUpDownIcon className='text-muted-foreground size-3.5 shrink-0' />\n      </DropdownMenuTrigger>\n      <DropdownMenuContent className='w-64'>\n        <DropdownMenuLabel>Workspaces</DropdownMenuLabel>\n        <DropdownMenuRadioGroup\n          value={current.id}\n          onValueChange={selectWorkspace}\n        >\n          {workspaces.map((workspace) => (\n            <DropdownMenuRadioItem\n              key={workspace.id}\n              value={workspace.id}\n              closeOnClick\n              className='h-9'\n            >\n              <CompanyMark seed={workspace.name} />\n              <span className='min-w-0 flex-1 truncate'>{workspace.name}</span>\n              <Kbd aria-hidden='true'>{workspace.memberCount}</Kbd>\n              <span className='sr-only'>\n                {memberLabelOf(workspace.memberCount)}\n              </span>\n            </DropdownMenuRadioItem>\n          ))}\n        </DropdownMenuRadioGroup>\n        <DropdownMenuSeparator />\n        <DropdownMenuItem>\n          <SettingsIcon />\n          Workspace settings\n        </DropdownMenuItem>\n        <DropdownMenuItem>\n          <PlusIcon />\n          Add workspace\n        </DropdownMenuItem>\n      </DropdownMenuContent>\n    </DropdownMenu>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-09/workspace-switcher.tsx"
    }
  ],
  "categories": [
    "templates",
    "dashboards"
  ],
  "type": "registry:block"
}