{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "review-01",
  "title": "Approval prompt",
  "description": "Requests stacked under a waiting count, the first open with its preview, where the Approve key becomes its result, a one-line trace with Undo, and the next request slides up.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/agent-run.json",
    "https://ui.ndekocode.dev/r/animated-size.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/chip.json",
    "https://ui.ndekocode.dev/r/demonstration.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/kbd.json",
    "https://ui.ndekocode.dev/r/live-duration.json",
    "https://ui.ndekocode.dev/r/live-region.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/motion-word-roll.json",
    "https://ui.ndekocode.dev/r/textarea.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/use-agent-run.json",
    "https://ui.ndekocode.dev/r/use-autoplay.json",
    "https://ui.ndekocode.dev/r/use-kept-height.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/use-timeouts.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/components/review/review-01.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion, useInView } from 'motion/react';\nimport { useId, useRef, useState } from 'react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { WordRoll, type WordRollWord } from '@/components/core/word-roll';\nimport { useNow } from '@/registry/ndeko/hooks/use-agent-run';\nimport {\n  useAutoplay,\n  type AutoplayStep,\n} from '@/registry/ndeko/hooks/use-autoplay';\nimport { useKeptHeight } from '@/registry/ndeko/hooks/use-kept-height';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport {\n  seriesColorOf,\n  type ApprovalRequest,\n  type RunAgent,\n} from '@/registry/ndeko/lib/agent-run';\nimport {\n  hold,\n  PRESS_LEAD_MS,\n  pressedSolidOf,\n  spokenUnless,\n  usePress,\n} from '@/registry/ndeko/lib/demonstration';\nimport {\n  CheckIcon,\n  CircleXIcon,\n  FileTextIcon,\n  MailIcon,\n  RotateCcwIcon,\n} from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Chip } from '@/registry/ndeko/ui/chip';\nimport { Kbd } from '@/registry/ndeko/ui/kbd';\nimport { Textarea } from '@/registry/ndeko/ui/textarea';\n\nimport { ClockGate } from '@/registry/ndeko/ui/live-duration';\nimport { LiveRegion } from '@/registry/ndeko/ui/live-region';\nimport { MorphButton, type MorphState } from '@/registry/ndeko/ui/morph-button';\nimport {\n  risePresenceOf,\n  rowPresenceOf,\n} from '@/registry/ndeko/lib/motion-presets';\nimport { useTimeouts } from '@/registry/ndeko/hooks/use-timeouts';\n\nexport type ApprovalPreview =\n  | { kind: 'email'; to: string; subject: string; body: string }\n  | { kind: 'file'; path: string; lines: string[] };\n\n/** Where a request is: waiting, being approved, approved (check shown), then folded into its trace. */\nexport type ApprovalPhase =\n  'waiting' | 'approving' | 'confirmed' | 'approved' | 'denied';\n\nexport type ApprovalEntry = {\n  request: ApprovalRequest;\n  agent: Pick<RunAgent, 'name' | 'series'>;\n  preview: ApprovalPreview;\n  /** The verb of the outcome for the trace line: \"Sent\", \"Written\". */\n  outcome: string;\n  phase: ApprovalPhase;\n  reason?: string;\n  canUndo?: boolean;\n};\n\nconst MAX_PEEKS = 2;\n\nconst RECENT_MS = 60_000;\n\nfunction isWaitingPhase(phase: ApprovalPhase) {\n  const isWaiting = phase === 'waiting';\n  const isApproving = phase === 'approving';\n  const isConfirmed = phase === 'confirmed';\n  return isWaiting || isApproving || isConfirmed;\n}\n\nfunction isDecided(entry: ApprovalEntry) {\n  return !isWaitingPhase(entry.phase);\n}\n\nfunction resolvedAtOf(entry: ApprovalEntry) {\n  return entry.request.resolvedAt ?? 0;\n}\n\nfunction byResolvedAt(first: ApprovalEntry, second: ApprovalEntry) {\n  return resolvedAtOf(first) - resolvedAtOf(second);\n}\n\nfunction approveStateOf(phase: ApprovalPhase): MorphState {\n  if (phase === 'approving') {\n    return 'busy';\n  }\n  if (phase === 'confirmed') {\n    return 'done';\n  }\n  return 'idle';\n}\n\nconst APPROVE_LABELS: Record<MorphState, string> = {\n  idle: 'Approve',\n  busy: 'Approving',\n  done: 'Approved',\n};\n\n/** Once the approval went through, the key is no longer an action: it wears the result. */\nconst APPROVED_LOOK =\n  'bg-success/15 text-success-foreground shadow-none ring-0';\n\nfunction approveLookOf(phase: ApprovalPhase, isPressed: boolean) {\n  if (phase === 'confirmed') {\n    return APPROVED_LOOK;\n  }\n  return pressedSolidOf(isPressed);\n}\n\nfunction isTypingTarget(target: EventTarget) {\n  const isElement = target instanceof HTMLElement;\n  if (!isElement) {\n    return false;\n  }\n  const isField = target.matches('input, textarea, [contenteditable=\"true\"]');\n  return isField;\n}\n\nfunction waitingWordsOf(count: number): WordRollWord[] {\n  if (count === 0) {\n    return ['Nothing', 'waiting'];\n  }\n  const countWord = {\n    key: 'count',\n    text: String(count),\n    node: <MotionNumber value={count} />,\n  };\n  return [countWord, 'waiting'];\n}\n\nfunction relativeTimeOf(resolvedAt: number, now: number) {\n  const elapsed = now - resolvedAt;\n  if (elapsed < RECENT_MS) {\n    return 'just now';\n  }\n  const minutes = Math.floor(elapsed / RECENT_MS);\n  if (minutes === 1) {\n    return '1 min ago';\n  }\n  return `${minutes} min ago`;\n}\n\nfunction RelativeTime({ resolvedAt }: { resolvedAt: number }) {\n  const ref = useRef<HTMLSpanElement>(null);\n  const isInView = useInView(ref);\n  const now = useNow(1000, isInView);\n  const label = relativeTimeOf(resolvedAt, now);\n  return (\n    <span ref={ref} className='tabular-nums'>\n      {label}\n    </span>\n  );\n}\n\nfunction traceTextOf(entry: ApprovalEntry) {\n  if (entry.phase === 'approved') {\n    return `${entry.outcome} by ${entry.agent.name}, approved by you,`;\n  }\n  return `Denied by you,`;\n}\n\nfunction TraceRow({\n  entry,\n  onUndo,\n}: {\n  entry: ApprovalEntry;\n  onUndo?: (requestId: string) => void;\n}) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const risePresence = risePresenceOf(shouldReduceMotion);\n  const isApproved = entry.phase === 'approved';\n  const hasReason = Boolean(entry.reason);\n  const canUndo = entry.canUndo === true;\n\n  return (\n    <div className='flex min-h-9 items-center gap-2.5 px-1 text-xs'>\n      {isApproved && (\n        <CheckIcon className='text-success-foreground size-3.5 shrink-0' />\n      )}\n      {!isApproved && (\n        <CircleXIcon className='text-muted-foreground size-3.5 shrink-0' />\n      )}\n      <p className='text-muted-foreground min-w-0 flex-1 leading-5'>\n        <span className='text-foreground'>{entry.request.title}.</span>{' '}\n        {traceTextOf(entry)} <RelativeTime resolvedAt={resolvedAtOf(entry)} />\n        {hasReason && <span>: &ldquo;{entry.reason}&rdquo;</span>}\n      </p>\n      <AnimatePresence initial={false}>\n        {canUndo && (\n          <motion.span key='undo' className='shrink-0' {...risePresence}>\n            <Button\n              type='button'\n              variant='ghost'\n              size='sm'\n              onClick={() => onUndo?.(entry.request.id)}\n              aria-label={`Undo the decision on ${entry.request.title}`}\n              className='relative overflow-hidden'\n            >\n              <RotateCcwIcon />\n              Undo\n              <span\n                aria-hidden='true'\n                className='bg-foreground/25 absolute inset-x-2 bottom-1 h-px origin-left scale-x-0 transition-transform duration-[5000ms] ease-linear starting:scale-x-100'\n              />\n            </Button>\n          </motion.span>\n        )}\n      </AnimatePresence>\n    </div>\n  );\n}\n\nfunction EmailPreview({\n  preview,\n}: {\n  preview: Extract<ApprovalPreview, { kind: 'email' }>;\n}) {\n  return (\n    <div className='bg-foreground/[0.03] flex flex-col gap-2 rounded-lg p-3 text-xs'>\n      <dl className='grid grid-cols-[auto_1fr] gap-x-3 gap-y-1'>\n        <dt className='text-muted-foreground'>To</dt>\n        <dd className='min-w-0 truncate'>{preview.to}</dd>\n        <dt className='text-muted-foreground'>Subject</dt>\n        <dd className='min-w-0 truncate font-medium'>{preview.subject}</dd>\n      </dl>\n      <p className='text-foreground/85 leading-5 whitespace-pre-line'>\n        {preview.body}\n      </p>\n    </div>\n  );\n}\n\nfunction FilePreview({\n  preview,\n}: {\n  preview: Extract<ApprovalPreview, { kind: 'file' }>;\n}) {\n  return (\n    <div className='bg-foreground/[0.03] flex flex-col gap-1.5 rounded-lg p-3'>\n      <p className='text-muted-foreground font-mono text-xs'>{preview.path}</p>\n      <pre className='overflow-x-auto font-mono text-xs leading-5'>\n        {preview.lines.map((line, index) => (\n          <span key={index} className='block'>\n            <span className='text-success-foreground select-none'>+ </span>\n            {line}\n          </span>\n        ))}\n      </pre>\n    </div>\n  );\n}\n\nfunction PreviewOf({ preview }: { preview: ApprovalPreview }) {\n  if (preview.kind === 'email') {\n    return <EmailPreview preview={preview} />;\n  }\n  return <FilePreview preview={preview} />;\n}\n\nfunction PreviewIcon({ preview }: { preview: ApprovalPreview }) {\n  if (preview.kind === 'email') {\n    return <MailIcon className='size-3.5' />;\n  }\n  return <FileTextIcon className='size-3.5' />;\n}\n\ntype RequestCardProps = {\n  entry: ApprovalEntry;\n  isApprovePressed: boolean;\n  onApprove?: (requestId: string) => void;\n  onDeny?: (requestId: string, reason: string) => void;\n};\n\nfunction RequestCard({\n  entry,\n  isApprovePressed,\n  onApprove,\n  onDeny,\n}: RequestCardProps) {\n  const [isDenying, setIsDenying] = useState(false);\n  const [reason, setReason] = useState('');\n  const reasonId = useId();\n  const titleId = useId();\n  const { request, agent, preview } = entry;\n  const isBusy = entry.phase !== 'waiting';\n  const chipColor = seriesColorOf(agent.series);\n\n  function approve() {\n    if (isBusy) {\n      return;\n    }\n    setIsDenying(false);\n    onApprove?.(request.id);\n  }\n\n  function openDeny() {\n    if (isBusy) {\n      return;\n    }\n    setIsDenying(true);\n  }\n\n  function closeDeny() {\n    setIsDenying(false);\n    setReason('');\n  }\n\n  function sendDeny() {\n    const trimmed = reason.trim();\n    onDeny?.(request.id, trimmed);\n  }\n\n  function skipReason() {\n    onDeny?.(request.id, '');\n  }\n\n  function changeReason(event: React.ChangeEvent<HTMLTextAreaElement>) {\n    setReason(event.target.value);\n  }\n\n  function decideFromKeys(event: React.KeyboardEvent<HTMLDivElement>) {\n    if (event.key === 'Escape' && isDenying) {\n      event.preventDefault();\n      closeDeny();\n      return;\n    }\n    if (isTypingTarget(event.target)) {\n      return;\n    }\n    const key = event.key.toLowerCase();\n    const hasCommandKey = event.metaKey || event.ctrlKey;\n    const hasModifier = hasCommandKey || event.altKey;\n    if (hasModifier) {\n      return;\n    }\n    if (key === 'a') {\n      event.preventDefault();\n      approve();\n      return;\n    }\n    if (key === 'd') {\n      event.preventDefault();\n      openDeny();\n    }\n  }\n\n  return (\n    <div\n      role='group'\n      tabIndex={0}\n      aria-labelledby={titleId}\n      aria-describedby={`${titleId}-keys`}\n      onKeyDown={decideFromKeys}\n      className='surface-raised focus-visible:ring-ring/25 @container relative flex flex-col gap-3 rounded-xl p-4 outline-none focus-visible:ring-[3px]'\n    >\n      <div className='flex items-center gap-2'>\n        <Chip color={chipColor}>{agent.name}</Chip>\n        <span className='text-muted-foreground flex items-center gap-1.5 text-xs'>\n          <PreviewIcon preview={preview} />\n          asks you first\n        </span>\n      </div>\n      <p id={titleId} className='text-sm font-medium text-balance'>\n        {request.title}\n      </p>\n      <PreviewOf preview={preview} />\n      <AnimatedSize>\n        {isDenying && (\n          <div className='flex flex-col gap-2 pb-1'>\n            <label htmlFor={reasonId} className='text-xs font-medium'>\n              Tell {agent.name} why{' '}\n              <span className='text-muted-foreground font-normal'>\n                (optional)\n              </span>\n            </label>\n            <Textarea\n              id={reasonId}\n              value={reason}\n              onChange={changeReason}\n              placeholder='Wait until Dana confirms the figures'\n              autoFocus\n            />\n            <div className='flex items-center gap-2'>\n              <Button\n                type='button'\n                size='sm'\n                variant='outline'\n                onClick={sendDeny}\n              >\n                Send and deny\n              </Button>\n              <Button\n                type='button'\n                size='sm'\n                variant='ghost'\n                onClick={skipReason}\n              >\n                Deny without a reason\n              </Button>\n              <Button\n                type='button'\n                size='sm'\n                variant='ghost'\n                onClick={closeDeny}\n                className='text-muted-foreground ms-auto'\n              >\n                Back\n              </Button>\n            </div>\n          </div>\n        )}\n        {!isDenying && (\n          <div className='flex items-center gap-2'>\n            <MorphButton\n              type='button'\n              size='sm'\n              state={approveStateOf(entry.phase)}\n              labels={APPROVE_LABELS}\n              onClick={approve}\n              className={approveLookOf(entry.phase, isApprovePressed)}\n            />\n            <Button\n              type='button'\n              size='sm'\n              variant='outline'\n              onClick={openDeny}\n              disabled={isBusy}\n            >\n              Deny\n            </Button>\n            <span\n              id={`${titleId}-keys`}\n              className='text-muted-foreground ms-auto hidden items-center gap-1 text-xs @sm:flex'\n            >\n              <Kbd>A</Kbd> approves, <Kbd>D</Kbd> denies\n            </span>\n          </div>\n        )}\n      </AnimatedSize>\n    </div>\n  );\n}\n\nfunction peekStyleOf(depth: number): React.CSSProperties {\n  const scale = 1 - depth * 0.04;\n  const offset = depth * 7;\n  return { transform: `translateY(${offset}px) scale(${scale})` };\n}\n\nfunction peekLayerStyleOf(\n  depth: number,\n  peekRoom: number\n): React.CSSProperties {\n  const placement = peekStyleOf(depth);\n  return { ...placement, bottom: peekRoom, zIndex: -depth };\n}\n\nfunction peeksOf(waitingCount: number) {\n  const behind = Math.max(0, waitingCount - 1);\n  const shown = Math.min(behind, MAX_PEEKS);\n  return Array.from({ length: shown }, (_, index) => index + 1);\n}\n\nexport type ApprovalPromptProps = {\n  entries: ApprovalEntry[];\n  onApprove?: (requestId: string) => void;\n  onDeny?: (requestId: string, reason: string) => void;\n  onUndo?: (requestId: string) => void;\n  /** Shown when nothing waits, for example to load more requests. */\n  emptyAction?: React.ReactNode;\n  /** Shows Approve held down on the request in front, for a demonstration that presses it. */\n  isApprovePressed?: boolean;\n  className?: string;\n};\n\nexport function ApprovalPrompt({\n  entries,\n  onApprove,\n  onDeny,\n  onUndo,\n  emptyAction,\n  isApprovePressed = false,\n  className,\n}: ApprovalPromptProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const rowPresence = rowPresenceOf(shouldReduceMotion);\n  const risePresence = risePresenceOf(shouldReduceMotion);\n  const titleId = useId();\n  const waiting = entries.filter((entry) => isWaitingPhase(entry.phase));\n  const decided = entries.filter(isDecided);\n  const traces = [...decided].sort(byResolvedAt);\n  const [front] = waiting;\n  const peeks = peeksOf(waiting.length);\n  const waitingWords = waitingWordsOf(waiting.length);\n  const peekRoom = peeks.length * 7;\n\n  return (\n    <section\n      aria-labelledby={titleId}\n      className={cn('flex flex-col gap-3', className)}\n    >\n      <header className='flex items-center justify-between gap-3 px-1'>\n        <h3 id={titleId} className='text-sm font-medium'>\n          Waiting for you\n        </h3>\n        <span className='text-muted-foreground text-xs'>\n          <WordRoll words={waitingWords} />\n        </span>\n      </header>\n\n      <ul aria-label='Decisions' className='flex flex-col'>\n        <AnimatePresence initial={false}>\n          {traces.map((entry) => (\n            <motion.li\n              key={entry.request.id}\n              className='overflow-hidden'\n              {...rowPresence}\n            >\n              <TraceRow entry={entry} onUndo={onUndo} />\n            </motion.li>\n          ))}\n        </AnimatePresence>\n      </ul>\n\n      <div className='relative isolate' style={{ paddingBottom: peekRoom }}>\n        <AnimatePresence initial={false}>\n          {peeks.map((depth) => (\n            <motion.span\n              key={depth}\n              aria-hidden='true'\n              initial={{ opacity: 0 }}\n              animate={{ opacity: 1 }}\n              exit={{ opacity: 0 }}\n              className='surface-raised absolute inset-x-0 top-0 rounded-xl transition-transform duration-300 ease-(--ease-out-strong)'\n              style={peekLayerStyleOf(depth, peekRoom)}\n            />\n          ))}\n        </AnimatePresence>\n        <AnimatePresence initial={false} mode='popLayout'>\n          {front && (\n            <motion.div key={front.request.id} {...risePresence}>\n              <RequestCard\n                entry={front}\n                isApprovePressed={isApprovePressed}\n                onApprove={onApprove}\n                onDeny={onDeny}\n              />\n            </motion.div>\n          )}\n          {!front && (\n            <motion.div\n              key='empty'\n              className='hairline-border border-foreground/20 flex flex-col items-center gap-3 rounded-xl border-dashed px-4 py-8 text-center'\n              {...risePresence}\n            >\n              <p className='text-muted-foreground text-[13px]'>\n                Nothing waits for you. New requests show up here.\n              </p>\n              {emptyAction}\n            </motion.div>\n          )}\n        </AnimatePresence>\n      </div>\n    </section>\n  );\n}\n\nconst WRITER: Pick<RunAgent, 'name' | 'series'> = { name: 'Writer', series: 3 };\n\nconst CODER: Pick<RunAgent, 'name' | 'series'> = { name: 'Coder', series: 5 };\n\nconst INITIAL_ENTRIES: ApprovalEntry[] = [\n  {\n    request: {\n      id: 'send-review',\n      title: 'Send the Q3 pricing review to Brightmoor accounts',\n      risk: 'medium',\n      status: 'pending',\n    },\n    agent: WRITER,\n    outcome: 'Sent',\n    phase: 'waiting',\n    preview: {\n      kind: 'email',\n      to: 'accounts@brightmoor-supply.example',\n      subject: 'Q3 pricing review: six lines above list price',\n      body: 'Hello Dana,\\nOur Q3 invoices show six lines billed above your published list price, $1,840.20 in total. The comparison is attached. Could you credit it on the next invoice?',\n    },\n  },\n  {\n    request: {\n      id: 'write-note',\n      title: 'Write the vendor note to vendors/brightmoor.md',\n      risk: 'low',\n      status: 'pending',\n    },\n    agent: CODER,\n    outcome: 'Written',\n    phase: 'waiting',\n    preview: {\n      kind: 'file',\n      path: 'vendors/brightmoor.md',\n      lines: [\n        '## Q3 review',\n        '- Six invoice lines above the list price',\n        '- Credit of $1,840.20 requested on Nov 11',\n      ],\n    },\n  },\n];\n\nconst APPROVING_MS = 700;\n\nconst CONFIRMED_MS = 500;\n\nconst UNDO_MS = 5000;\n\ntype EntryPatch = Partial<Omit<ApprovalEntry, 'request'>> & {\n  request?: Partial<ApprovalRequest>;\n};\n\nfunction patched(entry: ApprovalEntry, patch: EntryPatch): ApprovalEntry {\n  const request = { ...entry.request, ...patch.request };\n  return { ...entry, ...patch, request };\n}\n\nfunction titleOf(entries: ApprovalEntry[], requestId: string) {\n  const entry = entries.find((candidate) => candidate.request.id === requestId);\n  return entry?.request.title ?? '';\n}\n\n/** A request that waits on a person is approved by the demonstration after this long. */\nconst DECIDE_AFTER_MS = 2500;\n\ntype PressKey = 'approve';\n\nexport default function Review01() {\n  const [entries, setEntries] = useState(INITIAL_ENTRIES);\n  const [message, setMessage] = useState('');\n  const { schedule, clearAll } = useTimeouts();\n  const { pressed, press } = usePress<PressKey>();\n\n  function update(requestId: string, patch: EntryPatch) {\n    setEntries((current) =>\n      current.map((entry) => {\n        if (entry.request.id !== requestId) {\n          return entry;\n        }\n        return patched(entry, patch);\n      })\n    );\n  }\n\n  /** A decision undone and taken again keeps its own window: only the matching decision closes. */\n  function closeUndo(requestId: string, resolvedAt: number) {\n    setEntries((current) =>\n      current.map((entry) => {\n        const isTarget = entry.request.id === requestId;\n        const isSameDecision = entry.request.resolvedAt === resolvedAt;\n        if (isTarget && isSameDecision) {\n          return { ...entry, canUndo: false };\n        }\n        return entry;\n      })\n    );\n  }\n\n  function approve(requestId: string) {\n    update(requestId, { phase: 'approving' });\n    schedule(() => update(requestId, { phase: 'confirmed' }), APPROVING_MS);\n    const foldDelay = APPROVING_MS + CONFIRMED_MS;\n    schedule(() => {\n      const resolvedAt = Date.now();\n      update(requestId, {\n        phase: 'approved',\n        canUndo: true,\n        request: { status: 'approved', resolvedAt },\n      });\n      setMessage(`Approved: ${titleOf(entries, requestId)}`);\n      schedule(() => closeUndo(requestId, resolvedAt), UNDO_MS);\n    }, foldDelay);\n  }\n\n  function deny(requestId: string, reason: string) {\n    const resolvedAt = Date.now();\n    update(requestId, {\n      phase: 'denied',\n      reason,\n      canUndo: true,\n      request: { status: 'denied', resolvedAt },\n    });\n    setMessage(`Denied: ${titleOf(entries, requestId)}`);\n    schedule(() => closeUndo(requestId, resolvedAt), UNDO_MS);\n  }\n\n  function undo(requestId: string) {\n    update(requestId, {\n      phase: 'waiting',\n      reason: undefined,\n      canUndo: false,\n      request: { status: 'pending', resolvedAt: undefined },\n    });\n    setMessage(`Undone: ${titleOf(entries, requestId)} waits for you again`);\n  }\n\n  function reset() {\n    clearAll();\n    setEntries(INITIAL_ENTRIES);\n    setMessage('Two requests wait for you again');\n  }\n\n  const approveTime = APPROVING_MS + CONFIRMED_MS;\n  const nextAfter = approveTime + DECIDE_AFTER_MS;\n  const restAfter = approveTime + 2600;\n  const steps: AutoplayStep[] = [\n    { after: DECIDE_AFTER_MS, run: () => press('approve') },\n    { after: PRESS_LEAD_MS, run: () => approve('send-review') },\n    { after: nextAfter, run: () => press('approve') },\n    { after: PRESS_LEAD_MS, run: () => approve('write-note') },\n    { after: restAfter, run: hold },\n  ];\n  const { ref, isInView, isAutoplaying } = useAutoplay(steps, {\n    loopAfter: 3000,\n    onReset: reset,\n  });\n\n  useKeptHeight(ref);\n\n  return (\n    <div\n      ref={ref}\n      className='flex min-h-[27.5rem] w-full max-w-[28rem] flex-col gap-2'\n    >\n      <ClockGate isActive={isInView}>\n        <ApprovalPrompt\n          entries={entries}\n          onApprove={approve}\n          onDeny={deny}\n          onUndo={undo}\n          isApprovePressed={pressed === 'approve'}\n          emptyAction={\n            <Button type='button' variant='outline' size='sm' onClick={reset}>\n              <RotateCcwIcon />\n              Bring the requests back\n            </Button>\n          }\n        />\n      </ClockGate>\n      <LiveRegion message={spokenUnless(isAutoplaying, message)} />\n    </div>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "categories": [
    "components",
    "review"
  ],
  "type": "registry:component"
}