{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "heroes-13",
  "title": "Cloud of points that follows the page",
  "description": "A hero, a chat that plays a sample exchange with its tool lines and three abilities that each run on sample data, over one cloud of points that follows the scroll: a sphere behind the hero, a ring around the chat and a wave under the abilities.",
  "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/brand-logos.json",
    "https://ui.ndekocode.dev/r/brand-tile.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/call-status.json",
    "https://ui.ndekocode.dev/r/chat-motion.json",
    "https://ui.ndekocode.dev/r/chip.json",
    "https://ui.ndekocode.dev/r/demonstration.json",
    "https://ui.ndekocode.dev/r/drawn-check.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/live-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/replay-button.json",
    "https://ui.ndekocode.dev/r/settle.json",
    "https://ui.ndekocode.dev/r/status-orb.json",
    "https://ui.ndekocode.dev/r/streamed-text.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-follow-bottom.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-session.json",
    "https://ui.ndekocode.dev/r/utils.json",
    "https://ui.ndekocode.dev/r/words.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/blocks/heroes/heroes-13/index.tsx",
      "content": "import { Abilities } from './abilities';\nimport { Chat } from './chat';\nimport { Hero } from './hero';\nimport { PointBackdrop } from './point-backdrop';\nimport { POINT_STOPS } from './point-stops';\n\nexport default function Heroes13() {\n  return (\n    <div className='relative isolate flex min-h-screen flex-col'>\n      <PointBackdrop stops={POINT_STOPS} />\n      <main className='relative z-10 flex-1'>\n        <Hero />\n        <Chat />\n        <Abilities />\n      </main>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-13/index.tsx"
    },
    {
      "path": "registry/ndeko/blocks/heroes/heroes-13/abilities.tsx",
      "content": "import { ArrowRightIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Button } from '@/registry/ndeko/ui/button';\n\nimport { DraftDemo } from './ability-draft';\nimport { NotesDemo } from './ability-notes';\nimport { PlanDemo } from './ability-plan';\nimport {\n  ABILITIES,\n  ABILITIES_ANCHOR,\n  ABILITIES_SECTION,\n  type AbilityId,\n} from './data';\n\nconst DEMOS: Record<AbilityId, () => React.ReactNode> = {\n  plan: PlanDemo,\n  draft: DraftDemo,\n  promises: NotesDemo,\n};\n\nfunction isMediaFirst(index: number) {\n  return index % 2 === 1;\n}\n\nfunction AbilityDemo({ id }: { id: AbilityId }) {\n  const Demo = DEMOS[id];\n\n  return (\n    <div className='bg-foreground/[0.03] flex min-h-72 items-center justify-center rounded-2xl p-4 sm:p-10'>\n      <Demo />\n    </div>\n  );\n}\n\nexport function Abilities() {\n  return (\n    <section\n      id={ABILITIES_ANCHOR}\n      className='px-4 py-16 sm:px-6 sm:py-24 lg:px-8'\n    >\n      <div className='mx-auto flex max-w-6xl flex-col gap-14 sm:gap-20'>\n        <div className='flex max-w-2xl flex-col gap-3'>\n          <h2 className='text-2xl font-semibold text-balance sm:text-3xl'>\n            {ABILITIES_SECTION.title}\n          </h2>\n          <p className='text-muted-foreground text-base text-pretty'>\n            {ABILITIES_SECTION.description}\n          </p>\n        </div>\n        <ul className='flex flex-col gap-16 sm:gap-24'>\n          {ABILITIES.map((ability, index) => (\n            <li\n              key={ability.id}\n              className='grid grid-cols-1 items-center gap-8 lg:grid-cols-2 lg:gap-16'\n            >\n              <div className='flex flex-col items-start gap-4'>\n                <h3 className='text-xl font-semibold text-balance'>\n                  {ability.title}\n                </h3>\n                <p className='text-muted-foreground max-w-md text-sm leading-relaxed text-pretty'>\n                  {ability.description}\n                </p>\n                <Button\n                  variant='link'\n                  className='h-auto px-0'\n                  nativeButton={false}\n                  render={<a href='#' />}\n                >\n                  {ability.linkLabel}\n                  <ArrowRightIcon className='size-3.5' />\n                </Button>\n              </div>\n              <div className={cn(isMediaFirst(index) && 'lg:order-first')}>\n                <AbilityDemo id={ability.id} />\n              </div>\n            </li>\n          ))}\n        </ul>\n      </div>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-13/abilities.tsx"
    },
    {
      "path": "registry/ndeko/blocks/heroes/heroes-13/ability-draft.tsx",
      "content": "'use client';\n\nimport { useEffect, useState } from 'react';\n\nimport { useAutoplay } 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  hold,\n  pressedSolidOf,\n  usePress,\n} from '@/registry/ndeko/lib/demonstration';\nimport { RotateCcwIcon } from '@/registry/ndeko/lib/icons';\nimport { wordsOf } from '@/registry/ndeko/lib/words';\nimport { Avatar } from '@/registry/ndeko/ui/avatar';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Swap } from '@/registry/ndeko/ui/chat-motion';\nimport { DrawnCheck } from '@/registry/ndeko/ui/drawn-check';\nimport { MeshTile } from '@/registry/ndeko/ui/mesh-tile';\nimport { StreamedText, StreamedWords } from '@/registry/ndeko/ui/streamed-text';\n\nimport { ASSISTANT, DRAFT_REPLY, INCOMING } from './data';\nimport { useRestingState } from './use-resting-state';\n\ntype DraftStage = 'reading' | 'drafting' | 'ready' | 'sent';\n\nconst WORD_MS = 45;\n\nconst READING_MS = 1300;\n\nconst DRAFT_WORDS = wordsOf(DRAFT_REPLY);\n\nconst DRAFT_MS = DRAFT_WORDS.length * WORD_MS + 500;\n\nconst SEND_AFTER_MS = READING_MS + DRAFT_MS + 1200;\n\nfunction statusWordOf(stage: DraftStage) {\n  if (stage === 'reading') {\n    return 'Reading the message';\n  }\n  if (stage === 'drafting') {\n    return 'Drafting';\n  }\n  if (stage === 'ready') {\n    return 'Waiting for your yes';\n  }\n  return 'Sent';\n}\n\nfunction sendLabelOf(stage: DraftStage) {\n  if (stage === 'sent') {\n    return 'Sent';\n  }\n  return 'Send reply';\n}\n\nfunction waitOf(stage: DraftStage) {\n  if (stage === 'reading') {\n    return READING_MS;\n  }\n  if (stage === 'drafting') {\n    return DRAFT_MS;\n  }\n  return null;\n}\n\nfunction nextStageOf(stage: DraftStage): DraftStage {\n  if (stage === 'reading') {\n    return 'drafting';\n  }\n  return 'ready';\n}\n\ntype DraftBodyProps = {\n  stage: DraftStage;\n  round: number;\n  isActive: boolean;\n};\n\nfunction DraftBody({ stage, round, isActive }: DraftBodyProps) {\n  if (stage === 'reading') {\n    return (\n      <p className='text-sm leading-relaxed text-pretty'>\n        <StreamedWords words={DRAFT_WORDS} shown={0} isStreaming />\n      </p>\n    );\n  }\n  const isStreaming = stage === 'drafting';\n\n  return (\n    <p className='text-sm leading-relaxed text-pretty'>\n      <StreamedText\n        key={round}\n        text={DRAFT_REPLY}\n        isStreaming={isStreaming}\n        isActive={isActive}\n        wordMs={WORD_MS}\n      />\n    </p>\n  );\n}\n\nexport function DraftDemo() {\n  const [stage, setStage] = useState<DraftStage>('reading');\n  const [round, setRound] = useState(0);\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const { pressed, press } = usePress<'send'>();\n  const steps = [\n    { after: SEND_AFTER_MS, run: () => press('send') },\n    { after: 240, run: () => setStage('sent') },\n    { after: 3200, run: hold },\n  ];\n  const { ref, isInView } = useAutoplay(steps, {\n    loopAfter: 1000,\n    onReset: () => setStage('reading'),\n  });\n  const canSend = stage === 'ready';\n  const canRedraft = stage === 'ready' || stage === 'sent';\n  const statusWord = statusWordOf(stage);\n  const sendLabel = sendLabelOf(stage);\n  const hasSent = stage === 'sent';\n\n  useKeptHeight(ref);\n  useRestingState<DraftStage>(shouldReduceMotion, 'ready', setStage);\n\n  useEffect(() => {\n    const wait = waitOf(stage);\n    if (wait === null || !isInView) {\n      return;\n    }\n    const next = nextStageOf(stage);\n    const timer = setTimeout(() => setStage(next), wait);\n    return () => clearTimeout(timer);\n  }, [stage, round, isInView]);\n\n  function redraft() {\n    setRound((current) => current + 1);\n    setStage('drafting');\n  }\n\n  return (\n    <div\n      ref={ref}\n      className='bg-card hairline-ring ring-border flex w-full max-w-sm flex-col gap-3 rounded-xl p-3 shadow-[0_1px_2px_rgb(0_0_0/0.04),0_12px_32px_-16px_rgb(0_0_0/0.12)]'\n    >\n      <div className='bg-foreground/[0.04] flex flex-col gap-2 rounded-lg p-3'>\n        <div className='flex items-center gap-2.5'>\n          <Avatar\n            className='size-6'\n            seed={INCOMING.from}\n            role='img'\n            aria-label={INCOMING.from}\n          />\n          <p className='text-[13px] font-medium'>{INCOMING.from}</p>\n          <p className='text-muted-foreground ms-auto text-xs tabular-nums'>\n            {INCOMING.time}\n          </p>\n        </div>\n        <p className='text-[13px] leading-relaxed text-pretty'>\n          {INCOMING.text}\n        </p>\n      </div>\n      <div className='flex flex-col gap-2 px-1'>\n        <div className='flex items-center gap-2'>\n          <MeshTile seed={ASSISTANT.name} size='md' />\n          <p className='text-muted-foreground text-xs font-medium'>\n            Draft reply\n          </p>\n          <p\n            aria-live='polite'\n            className='text-muted-foreground ms-auto flex items-center gap-1.5 text-xs'\n          >\n            {hasSent && <DrawnCheck tone='success' entrance='pop' />}\n            <Swap swapKey={statusWord}>{statusWord}</Swap>\n          </p>\n        </div>\n        <DraftBody stage={stage} round={round} isActive={isInView} />\n      </div>\n      <div className='flex items-center justify-end gap-2'>\n        <Button\n          type='button'\n          variant='ghost'\n          size='sm'\n          disabled={!canRedraft}\n          focusableWhenDisabled\n          onClick={redraft}\n        >\n          <RotateCcwIcon />\n          Redraft\n        </Button>\n        <Button\n          type='button'\n          size='sm'\n          disabled={!canSend}\n          focusableWhenDisabled\n          onClick={() => setStage('sent')}\n          className={pressedSolidOf(pressed === 'send')}\n        >\n          <Swap swapKey={sendLabel}>{sendLabel}</Swap>\n        </Button>\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-13/ability-draft.tsx"
    },
    {
      "path": "registry/ndeko/blocks/heroes/heroes-13/ability-notes.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion } from 'motion/react';\nimport { useState } from 'react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { useAutoplay } 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 { hold } from '@/registry/ndeko/lib/demonstration';\nimport { rowPresenceOf } from '@/registry/ndeko/lib/motion-presets';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { DrawnCheck } from '@/registry/ndeko/ui/drawn-check';\n\nimport { type Commitment, COMMITMENTS, NEW_COMMITMENT } from './data';\nimport { useRestingState } from './use-resting-state';\n\ntype NotesState = {\n  hasNew: boolean;\n  doneIds: string[];\n};\n\nconst FIRST: NotesState = { hasNew: false, doneIds: [] };\n\nconst RESTING: NotesState = {\n  hasNew: true,\n  doneIds: ['quote', 'contract'],\n};\n\nfunction listOf(state: NotesState) {\n  if (state.hasNew) {\n    return [NEW_COMMITMENT, ...COMMITMENTS];\n  }\n  return COMMITMENTS;\n}\n\nfunction isDoneIn(state: NotesState, id: string) {\n  return state.doneIds.includes(id);\n}\n\nfunction toggled(state: NotesState, id: string): NotesState {\n  if (isDoneIn(state, id)) {\n    const remaining = state.doneIds.filter((doneId) => doneId !== id);\n    return { ...state, doneIds: remaining };\n  }\n  return { ...state, doneIds: [...state.doneIds, id] };\n}\n\nfunction openCountOf(state: NotesState) {\n  const list = listOf(state);\n  const open = list.filter((item) => !isDoneIn(state, item.id));\n  return open.length;\n}\n\ntype PromiseRowProps = {\n  item: Commitment;\n  isDone: boolean;\n  onToggle: () => void;\n};\n\nfunction PromiseRow({ item, isDone, onToggle }: PromiseRowProps) {\n  return (\n    <div className='flex items-center gap-3 px-2.5 py-2.5'>\n      <button\n        type='button'\n        role='checkbox'\n        aria-checked={isDone}\n        aria-label={`Mark \"${item.text}\" as done`}\n        onClick={onToggle}\n        className='focus-visible:ring-ring relative flex size-5 shrink-0 items-center justify-center rounded-full outline-none focus-visible:ring-2 focus-visible:ring-offset-2'\n      >\n        <span\n          aria-hidden='true'\n          className='hairline-ring ring-foreground/25 absolute size-[18px] rounded-full'\n        />\n        <AnimatePresence initial={false}>\n          {isDone && (\n            <DrawnCheck key='check' tone='success' className='absolute' />\n          )}\n        </AnimatePresence>\n      </button>\n      <span\n        className={cn(\n          'min-w-0 flex-1 truncate text-[13px] transition-colors duration-200',\n          isDone && 'text-muted-foreground line-through'\n        )}\n      >\n        {item.text}\n      </span>\n      <Badge variant='secondary' className='text-muted-foreground'>\n        {item.due}\n      </Badge>\n    </div>\n  );\n}\n\nexport function NotesDemo() {\n  const [state, setState] = useState<NotesState>(FIRST);\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const presence = rowPresenceOf(shouldReduceMotion);\n  const steps = [\n    { after: 1500, run: () => setState({ ...FIRST, hasNew: true }) },\n    {\n      after: 1700,\n      run: () => setState((current) => toggled(current, 'quote')),\n    },\n    {\n      after: 1500,\n      run: () => setState((current) => toggled(current, 'contract')),\n    },\n    { after: 3400, run: hold },\n  ];\n  const { ref } = useAutoplay(steps, {\n    loopAfter: 1200,\n    onReset: () => setState(FIRST),\n  });\n  const list = listOf(state);\n  const openCount = openCountOf(state);\n\n  useKeptHeight(ref);\n  useRestingState<NotesState>(shouldReduceMotion, RESTING, setState);\n\n  return (\n    <div\n      ref={ref}\n      className='bg-card hairline-ring ring-border flex w-full max-w-sm flex-col gap-3 rounded-xl p-3 shadow-[0_1px_2px_rgb(0_0_0/0.04),0_12px_32px_-16px_rgb(0_0_0/0.12)]'\n    >\n      <div className='flex items-center justify-between gap-3 px-1 pt-1'>\n        <p className='text-muted-foreground text-xs font-medium'>\n          Promises this week\n        </p>\n        <p\n          aria-live='polite'\n          className='text-muted-foreground flex items-center gap-1 text-xs'\n        >\n          <MotionNumber\n            value={openCount}\n            className='text-foreground font-medium'\n          />\n          open\n        </p>\n      </div>\n      <ul className='bg-foreground/[0.04] flex flex-col rounded-lg'>\n        <AnimatePresence initial={false}>\n          {list.map((item) => (\n            <motion.li key={item.id} {...presence} className='overflow-hidden'>\n              <PromiseRow\n                item={item}\n                isDone={isDoneIn(state, item.id)}\n                onToggle={() =>\n                  setState((current) => toggled(current, item.id))\n                }\n              />\n            </motion.li>\n          ))}\n        </AnimatePresence>\n      </ul>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-13/ability-notes.tsx"
    },
    {
      "path": "registry/ndeko/blocks/heroes/heroes-13/ability-plan.tsx",
      "content": "'use client';\n\nimport { useState } from 'react';\n\nimport { useAutoplay } from '@/registry/ndeko/hooks/use-autoplay';\nimport { useKeptHeight } from '@/registry/ndeko/hooks/use-kept-height';\nimport { hold } from '@/registry/ndeko/lib/demonstration';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Swap } from '@/registry/ndeko/ui/chat-motion';\nimport { Chip } from '@/registry/ndeko/ui/chip';\nimport { StatusOrb, type StatusOrbTone } from '@/registry/ndeko/ui/status-orb';\n\nimport {\n  DAY_EVENTS,\n  DAY_HOURS,\n  DAY_START_HOUR,\n  type DayEvent,\n  MOVED_REVIEW_START,\n  NEW_EVENT,\n  PLAN_NOTES,\n} from './data';\nimport { useRestingState } from './use-resting-state';\n\ntype PlanStage = 'calm' | 'clash' | 'moved';\n\nconst HOUR_LABELS = Array.from(\n  { length: DAY_HOURS },\n  (_, index) => `${DAY_START_HOUR + index}:00`\n);\n\nconst BLOCK =\n  'absolute flex flex-col justify-center rounded-lg px-2.5 text-xs transition-[translate,opacity] duration-500 ease-(--ease-out-strong) translate-y-[calc(var(--start)*3rem+0.125rem)] h-[calc(var(--hours)*3rem-0.25rem)]';\n\nconst BLOCK_ARRIVAL =\n  'starting:opacity-0 motion-safe:starting:translate-x-6 motion-safe:starting:translate-y-[calc(var(--start)*3rem+0.125rem)]';\n\ntype BlockStyle = React.CSSProperties & {\n  '--start': number;\n  '--hours': number;\n};\n\nfunction blockStyleOf(start: number, hours: number): BlockStyle {\n  return { '--start': start, '--hours': hours };\n}\n\nfunction startOf(event: DayEvent, stage: PlanStage) {\n  const isReview = event.id === 'review';\n  const hasMoved = stage === 'moved';\n  if (isReview && hasMoved) {\n    return MOVED_REVIEW_START;\n  }\n  return event.start;\n}\n\nfunction toneOfStage(stage: PlanStage): StatusOrbTone {\n  if (stage === 'clash') {\n    return 'warning';\n  }\n  return 'success';\n}\n\nfunction noteOfStage(stage: PlanStage) {\n  if (stage === 'clash') {\n    return PLAN_NOTES.overlap;\n  }\n  if (stage === 'moved') {\n    return PLAN_NOTES.moved;\n  }\n  return PLAN_NOTES.calm;\n}\n\nfunction isClashing(event: DayEvent, stage: PlanStage) {\n  const isReview = event.id === 'review';\n  return isReview && stage === 'clash';\n}\n\nfunction EventBlock({ event, stage }: { event: DayEvent; stage: PlanStage }) {\n  const start = startOf(event, stage);\n  const hasClash = isClashing(event, stage);\n\n  return (\n    <li\n      style={blockStyleOf(start, event.hours)}\n      className={cn(\n        BLOCK,\n        'bg-foreground/[0.06] inset-x-0',\n        hasClash && 'bg-warning/10 text-warning-foreground'\n      )}\n    >\n      <span className='truncate font-medium'>{event.title}</span>\n      <span className='text-muted-foreground tabular-nums'>\n        {event.timeLabel}\n      </span>\n    </li>\n  );\n}\n\nfunction NewEventBlock() {\n  return (\n    <li\n      style={blockStyleOf(NEW_EVENT.start, NEW_EVENT.hours)}\n      className={cn(\n        BLOCK,\n        BLOCK_ARRIVAL,\n        'bg-info/10 text-info-foreground start-6 end-0 z-10 shadow-[0_1px_2px_rgb(0_0_0/0.06)]'\n      )}\n    >\n      <span className='truncate font-medium'>{NEW_EVENT.title}</span>\n      <span className='tabular-nums'>{NEW_EVENT.timeLabel}</span>\n    </li>\n  );\n}\n\nconst STEPS_DELAYS = { clash: 1500, moved: 1900 };\n\nexport function PlanDemo() {\n  const [stage, setStage] = useState<PlanStage>('calm');\n  const steps = [\n    { after: STEPS_DELAYS.clash, run: () => setStage('clash') },\n    { after: STEPS_DELAYS.moved, run: () => setStage('moved') },\n    { after: 3600, run: hold },\n  ];\n  const { ref, isAutoplaying } = useAutoplay(steps, {\n    loopAfter: 1200,\n    onReset: () => setStage('calm'),\n  });\n  useRestingState<PlanStage>(!isAutoplaying, 'moved', setStage);\n  const hasNewEvent = stage !== 'calm';\n  const note = noteOfStage(stage);\n  const tone = toneOfStage(stage);\n  const hasClash = stage === 'clash';\n\n  useKeptHeight(ref);\n\n  return (\n    <div\n      ref={ref}\n      role='img'\n      aria-label='A sample day where a new event lands on top of another one and Murmura moves the one that can move'\n      className='bg-card hairline-ring ring-border flex w-full max-w-sm flex-col gap-3 rounded-xl p-3 shadow-[0_1px_2px_rgb(0_0_0/0.04),0_12px_32px_-16px_rgb(0_0_0/0.12)]'\n    >\n      <div className='flex items-center justify-between gap-3 px-1 pt-1'>\n        <p className='text-muted-foreground text-xs font-medium'>Thursday</p>\n        {hasClash && <Chip color='var(--warning)'>Overlap</Chip>}\n      </div>\n      <div className='flex gap-3'>\n        <ol className='text-muted-foreground flex w-9 shrink-0 flex-col text-xs tabular-nums'>\n          {HOUR_LABELS.map((label) => (\n            <li key={label} className='h-12'>\n              {label}\n            </li>\n          ))}\n        </ol>\n        <ul\n          style={{ height: `${DAY_HOURS * 3}rem` }}\n          className='relative min-w-0 flex-1'\n        >\n          {DAY_EVENTS.map((event) => (\n            <EventBlock key={event.id} event={event} stage={stage} />\n          ))}\n          {hasNewEvent && <NewEventBlock />}\n        </ul>\n      </div>\n      <p className='bg-foreground/[0.04] flex min-h-10 items-center gap-2.5 rounded-lg px-2.5 py-2 text-[13px]'>\n        <StatusOrb tone={tone} size='sm' />\n        <Swap swapKey={note} className='min-w-0 text-start'>\n          {note}\n        </Swap>\n      </p>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-13/ability-plan.tsx"
    },
    {
      "path": "registry/ndeko/blocks/heroes/heroes-13/canvas-stage.ts",
      "content": "/** A backing store above two device pixels costs four times the fill for a picture nobody sees sharper. */\nconst MAX_PIXEL_RATIO = 2;\n\nconst FRAMES_PER_SECOND = 24;\n\nconst FRAME_MS = 1000 / FRAMES_PER_SECOND;\n\n/** The timer between two frames ends this long before the next one is due, so the frame lands on the refresh that is due. */\nconst REFRESH_LEAD_MS = 5;\n\nconst TIMER_MS = FRAME_MS - REFRESH_LEAD_MS;\n\n/** A frame that comes late, after a long task, moves the picture no further than this long would. */\nconst MAX_STEP_S = 0.05;\n\nconst THEME_WATCH = {\n  attributes: true,\n  attributeFilter: ['class', 'data-theme'],\n};\n\nconst DARK_SCHEME = '(prefers-color-scheme: dark)';\n\nexport const NEXT_FRAME = 0;\n\nexport const AT_REST = Number.POSITIVE_INFINITY;\n\nexport type Surface = {\n  canvas: HTMLCanvasElement;\n  pen: CanvasRenderingContext2D;\n  width: number;\n  height: number;\n  pixelRatio: number;\n};\n\nexport type Inks = {\n  hue: string;\n  neutral: string;\n};\n\nexport type Scene = {\n  ink: (inks: Inks) => void;\n  fit: (surface: Surface, isStill: boolean) => void;\n  draw: (surface: Surface) => void;\n  step: (surface: Surface, seconds: number) => number;\n};\n\nexport type Stage = {\n  dispose: () => void;\n};\n\nexport type StageOptions = {\n  isStill: boolean;\n};\n\nfunction pixelRatioOf() {\n  const screenRatio = window.devicePixelRatio || 1;\n  return Math.min(screenRatio, MAX_PIXEL_RATIO);\n}\n\nfunction createSurface(canvas: HTMLCanvasElement): Surface | null {\n  const pen = canvas.getContext('2d');\n  if (!pen) {\n    return null;\n  }\n  return { canvas, pen, width: 0, height: 0, pixelRatio: 1 };\n}\n\nfunction fitSurface(surface: Surface) {\n  const { canvas, pen } = surface;\n  const pixelRatio = pixelRatioOf();\n  const width = canvas.clientWidth;\n  const height = canvas.clientHeight;\n  surface.width = width;\n  surface.height = height;\n  surface.pixelRatio = pixelRatio;\n  canvas.width = Math.round(width * pixelRatio);\n  canvas.height = Math.round(height * pixelRatio);\n  pen.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\n}\n\nfunction isFitted(surface: Surface) {\n  const { canvas } = surface;\n  const hasWidth = surface.width === canvas.clientWidth;\n  const hasHeight = surface.height === canvas.clientHeight;\n  const hasRatio = surface.pixelRatio === pixelRatioOf();\n  const hasSize = hasWidth && hasHeight;\n  return hasSize && hasRatio;\n}\n\nexport function wipeSurface(surface: Surface) {\n  surface.pen.globalAlpha = 1;\n  surface.pen.clearRect(0, 0, surface.width, surface.height);\n}\n\n/**\n * A canvas cannot take a colour from a class, so it reads its colours from its own computed style,\n * where the browser has already resolved the tokens for the current theme: the hue rides on\n * `color`, the neutral on `text-decoration-color`, which paints nothing on a canvas.\n */\nfunction inksOf(canvas: HTMLCanvasElement): Inks {\n  const style = getComputedStyle(canvas);\n  return { hue: style.color, neutral: style.textDecorationColor };\n}\n\nfunction hasSameInks(first: Inks, second: Inks) {\n  const hasSameHue = first.hue === second.hue;\n  const hasSameNeutral = first.neutral === second.neutral;\n  return hasSameHue && hasSameNeutral;\n}\n\nfunction densityQueryOf() {\n  return `(resolution: ${window.devicePixelRatio}dppx)`;\n}\n\nfunction watchSurface(\n  canvas: HTMLCanvasElement,\n  onResize: () => void,\n  onTheme: () => void\n) {\n  const sizeObserver = new ResizeObserver(() => onResize());\n  const themeObserver = new MutationObserver(() => onTheme());\n  const scheme = window.matchMedia(DARK_SCHEME);\n  let density = window.matchMedia(densityQueryOf());\n\n  function onScheme() {\n    onTheme();\n  }\n\n  /** The query names one density: once the screen has left it, a new query watches the next one. */\n  function onDensity() {\n    density.removeEventListener('change', onDensity);\n    density = window.matchMedia(densityQueryOf());\n    density.addEventListener('change', onDensity);\n    onResize();\n  }\n\n  sizeObserver.observe(canvas);\n  themeObserver.observe(document.documentElement, THEME_WATCH);\n  themeObserver.observe(document.body, THEME_WATCH);\n  scheme.addEventListener('change', onScheme);\n  density.addEventListener('change', onDensity);\n\n  return () => {\n    sizeObserver.disconnect();\n    themeObserver.disconnect();\n    scheme.removeEventListener('change', onScheme);\n    density.removeEventListener('change', onDensity);\n  };\n}\n\nfunction watchShowing(\n  element: Element,\n  onChange: (isShowing: boolean) => void\n) {\n  let isOnScreen = false;\n  let wasShowing = false;\n\n  function report() {\n    const isTabShown = document.visibilityState === 'visible';\n    const isShowing = isOnScreen && isTabShown;\n    if (isShowing === wasShowing) {\n      return;\n    }\n    wasShowing = isShowing;\n    onChange(isShowing);\n  }\n\n  function onCrossing(entries: IntersectionObserverEntry[]) {\n    const latest = entries.at(-1);\n    if (!latest) {\n      return;\n    }\n    isOnScreen = latest.isIntersecting;\n    report();\n  }\n\n  const observer = new IntersectionObserver(onCrossing);\n  observer.observe(element);\n  document.addEventListener('visibilitychange', report);\n\n  return () => {\n    observer.disconnect();\n    document.removeEventListener('visibilitychange', report);\n  };\n}\n\ntype FrameHandler = (seconds: number) => number;\n\ntype FrameLoop = {\n  start: () => void;\n  stop: () => void;\n  wake: () => void;\n};\n\n/**\n * Frames at twenty-four a second at most. Between two frames there is one timer and no animation\n * frame, so a fast screen does not run extra rounds of main-thread work. Stopped or at rest, the\n * loop holds no timer and asks for no frame.\n */\nfunction createFrameLoop(onFrame: FrameHandler): FrameLoop {\n  let frame = 0;\n  let timer: ReturnType<typeof setTimeout> | undefined;\n  let isStarted = false;\n  let lastFrameAt = 0;\n\n  function clearPending() {\n    cancelAnimationFrame(frame);\n    clearTimeout(timer);\n    frame = 0;\n    timer = undefined;\n  }\n\n  function askForFrame() {\n    timer = undefined;\n    frame = requestAnimationFrame(tick);\n  }\n\n  function schedule(wait: number) {\n    clearPending();\n    const now = performance.now();\n    const sinceFrame = now - lastFrameAt;\n    const untilCap = TIMER_MS - sinceFrame;\n    const delay = Math.max(wait, untilCap);\n    if (delay <= 0) {\n      askForFrame();\n      return;\n    }\n    timer = setTimeout(askForFrame, delay);\n  }\n\n  function tick(now: number) {\n    frame = 0;\n    const elapsedMs = now - lastFrameAt;\n    const elapsed = elapsedMs / 1000;\n    const forward = Math.max(0, elapsed);\n    const seconds = Math.min(forward, MAX_STEP_S);\n    lastFrameAt = now;\n    const wait = onFrame(seconds);\n    const isResting = wait === AT_REST;\n    if (isResting || !isStarted) {\n      return;\n    }\n    schedule(wait);\n  }\n\n  function start() {\n    if (isStarted) {\n      return;\n    }\n    isStarted = true;\n    lastFrameAt = performance.now() - FRAME_MS;\n    schedule(NEXT_FRAME);\n  }\n\n  function stop() {\n    isStarted = false;\n    clearPending();\n  }\n\n  function wake() {\n    const isFrameComing = frame !== 0;\n    if (!isStarted || isFrameComing) {\n      return;\n    }\n    schedule(NEXT_FRAME);\n  }\n\n  return { start, stop, wake };\n}\n\nfunction stageOf(\n  surface: Surface,\n  scene: Scene,\n  { isStill }: StageOptions\n): Stage {\n  const { canvas } = surface;\n  let inks = inksOf(canvas);\n\n  const loop = createFrameLoop((seconds) => scene.step(surface, seconds));\n\n  function lay() {\n    fitSurface(surface);\n    scene.fit(surface, isStill);\n    scene.draw(surface);\n  }\n\n  function onResize() {\n    if (isFitted(surface)) {\n      return;\n    }\n    lay();\n    loop.wake();\n  }\n\n  function onTheme() {\n    const latest = inksOf(canvas);\n    if (hasSameInks(inks, latest)) {\n      return;\n    }\n    inks = latest;\n    scene.ink(inks);\n    scene.draw(surface);\n    loop.wake();\n  }\n\n  function onScroll() {\n    loop.wake();\n  }\n\n  function onShowing(isShowing: boolean) {\n    if (isShowing && !isStill) {\n      window.addEventListener('scroll', onScroll, { passive: true });\n      loop.start();\n      return;\n    }\n    window.removeEventListener('scroll', onScroll);\n    loop.stop();\n  }\n\n  scene.ink(inks);\n  lay();\n  const stopSurface = watchSurface(canvas, onResize, onTheme);\n  const stopShowing = watchShowing(canvas, onShowing);\n\n  return {\n    dispose() {\n      stopShowing();\n      stopSurface();\n      window.removeEventListener('scroll', onScroll);\n      loop.stop();\n    },\n  };\n}\n\nexport function mountStage(\n  canvas: HTMLCanvasElement,\n  scene: Scene,\n  options: StageOptions\n) {\n  const surface = createSurface(canvas);\n  if (!surface) {\n    return null;\n  }\n  return stageOf(surface, scene, options);\n}\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-13/canvas-stage.ts"
    },
    {
      "path": "registry/ndeko/blocks/heroes/heroes-13/chat-parts.tsx",
      "content": "'use client';\n\nimport { type CallStatus } from '@/registry/ndeko/lib/agent-run';\nimport { pressedSolidOf } from '@/registry/ndeko/lib/demonstration';\nimport { ArrowUpIcon, MessageCircleIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { wordsOf } from '@/registry/ndeko/lib/words';\nimport { Avatar } from '@/registry/ndeko/ui/avatar';\nimport { BrandTile } from '@/registry/ndeko/ui/brand-tile';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { CallStatusMark } from '@/registry/ndeko/ui/call-status';\nimport { Swap } from '@/registry/ndeko/ui/chat-motion';\nimport { MeshTile } from '@/registry/ndeko/ui/mesh-tile';\nimport {\n  shownCountOf,\n  StreamedWords,\n  useRevealedCount,\n} from '@/registry/ndeko/ui/streamed-text';\n\nimport {\n  ASSISTANT,\n  EXCHANGES,\n  PERSON,\n  type Suggestion,\n  type ToolLine,\n} from './data';\nimport { isAnswering, WORD_MS, type Phase, type Turn } from './chat-session';\n\nconst FIELD_SHELL =\n  'bg-card hairline-ring ring-foreground/12 rounded-xl shadow-[0_1px_2px_rgb(0_0_0/0.05)] dark:bg-foreground/[0.04] dark:ring-foreground/15';\n\nconst TOOL_ARRIVAL =\n  'transition-[opacity] duration-300 ease-(--ease-out-strong) starting:opacity-0 motion-safe:starting:translate-y-1';\n\nfunction statusWordOf(phase: Phase) {\n  if (phase === 'thinking') {\n    return 'Thinking';\n  }\n  if (phase === 'reading') {\n    return 'Reading your apps';\n  }\n  return null;\n}\n\nfunction toolStatusOf(index: number, toolsShown: number): CallStatus {\n  if (index < toolsShown) {\n    return 'done';\n  }\n  return 'running';\n}\n\nexport function EmptyThread() {\n  return (\n    <div className='text-muted-foreground m-auto flex flex-col items-center gap-3 p-6 text-center text-[13px]'>\n      <span className='keycap-3d flex size-9 items-center justify-center rounded-lg'>\n        <MessageCircleIcon />\n      </span>\n      <p className='max-w-56 text-pretty'>\n        Ask about your calendar, your mail or your notes\n      </p>\n    </div>\n  );\n}\n\nexport function PersonMessage({ text }: { text: string }) {\n  return (\n    <div className='flex items-end justify-end gap-2'>\n      <p className='bg-foreground/[0.06] max-w-[85%] rounded-2xl rounded-ee-md px-3.5 py-2 text-sm leading-relaxed text-pretty'>\n        {text}\n      </p>\n      <Avatar\n        className='size-7 shrink-0'\n        seed={PERSON.name}\n        role='img'\n        aria-label={PERSON.name}\n      />\n    </div>\n  );\n}\n\nfunction StatusLine({ word }: { word: string }) {\n  return (\n    <p className='text-muted-foreground flex h-6 items-center gap-2 text-[13px]'>\n      <span\n        aria-hidden='true'\n        className='bg-primary size-1.5 animate-pulse rounded-full'\n      />\n      <Swap swapKey={word}>{word}</Swap>\n    </p>\n  );\n}\n\nfunction ToolRow({ tool, status }: { tool: ToolLine; status: CallStatus }) {\n  return (\n    <li\n      className={cn(\n        'bg-foreground/[0.04] flex h-9 items-center gap-2 rounded-lg ps-1 pe-2.5 text-xs',\n        TOOL_ARRIVAL\n      )}\n    >\n      <BrandTile brand={tool.brand} size='lg' />\n      <span className='min-w-0 flex-1 truncate'>{tool.label}</span>\n      <CallStatusMark status={status} />\n    </li>\n  );\n}\n\ntype ToolListProps = {\n  tools: ToolLine[];\n  toolsShown: number;\n  phase: Phase;\n};\n\nfunction ToolList({ tools, toolsShown, phase }: ToolListProps) {\n  const hasTools = tools.length > 0;\n  if (!hasTools) {\n    return null;\n  }\n  const isReading = phase === 'reading';\n  let shownTools = tools;\n  if (isReading) {\n    shownTools = tools.slice(0, toolsShown + 1);\n  }\n\n  return (\n    <ul aria-label='Apps read' className='flex flex-col gap-1.5'>\n      {shownTools.map((tool, index) => (\n        <ToolRow\n          key={tool.label}\n          tool={tool}\n          status={toolStatusOf(index, toolsShown)}\n        />\n      ))}\n    </ul>\n  );\n}\n\ntype AnswerProps = {\n  text: string;\n  phase: Phase;\n  isActive: boolean;\n};\n\nfunction Answer({ text, phase, isActive }: AnswerProps) {\n  const words = wordsOf(text);\n  const isStreaming = phase === 'streaming';\n  const isRunning = isStreaming && isActive;\n  const count = useRevealedCount(words.length, isRunning, WORD_MS);\n  const shown = shownCountOf(isStreaming, count, words.length);\n\n  return (\n    <p className='text-sm leading-relaxed text-pretty'>\n      <StreamedWords words={words} shown={shown} isStreaming={isStreaming} />\n    </p>\n  );\n}\n\ntype AssistantTurnProps = {\n  turn: Turn;\n  phase: Phase;\n  toolsShown: number;\n  isActive: boolean;\n};\n\nexport function AssistantTurn({\n  turn,\n  phase,\n  toolsShown,\n  isActive,\n}: AssistantTurnProps) {\n  const exchange = EXCHANGES[turn.exchangeId];\n  const statusWord = statusWordOf(phase);\n  const hasAnswer = phase === 'streaming' || phase === 'done';\n\n  return (\n    <div className='flex items-start gap-2.5'>\n      <MeshTile seed={ASSISTANT.name} size='lg' className='mt-0.5' />\n      <div className='flex min-w-0 flex-1 flex-col gap-2'>\n        <p className='text-xs font-medium'>{ASSISTANT.name}</p>\n        {statusWord && <StatusLine word={statusWord} />}\n        <ToolList\n          tools={exchange.tools}\n          toolsShown={toolsShown}\n          phase={phase}\n        />\n        {hasAnswer && (\n          <Answer text={exchange.answer} phase={phase} isActive={isActive} />\n        )}\n      </div>\n    </div>\n  );\n}\n\ntype SuggestionsProps = {\n  suggestions: Suggestion[];\n  phase: Phase;\n  onAsk: (suggestion: Suggestion) => void;\n};\n\nexport function Suggestions({ suggestions, phase, onAsk }: SuggestionsProps) {\n  const isBusy = isAnswering(phase);\n\n  return (\n    <ul aria-label='Questions to try' className='flex flex-wrap gap-1.5'>\n      {suggestions.map((suggestion) => (\n        <li key={suggestion.exchangeId}>\n          <Button\n            type='button'\n            variant='outline'\n            size='sm'\n            disabled={isBusy}\n            focusableWhenDisabled\n            onClick={() => onAsk(suggestion)}\n            className='h-7 text-xs'\n          >\n            {suggestion.label}\n          </Button>\n        </li>\n      ))}\n    </ul>\n  );\n}\n\nfunction isSendKey(event: React.KeyboardEvent<HTMLTextAreaElement>) {\n  const isPlainEnter = event.key === 'Enter' && !event.shiftKey;\n  return isPlainEnter && !event.nativeEvent.isComposing;\n}\n\ntype ComposerProps = {\n  draft: string;\n  canSend: boolean;\n  isDemonstrating: boolean;\n  pressed: string | null;\n  onDraftChange: (text: string) => void;\n  onSend: () => void;\n};\n\nexport function Composer({\n  draft,\n  canSend,\n  isDemonstrating,\n  pressed,\n  onDraftChange,\n  onSend,\n}: ComposerProps) {\n  function handleKeys(event: React.KeyboardEvent<HTMLTextAreaElement>) {\n    if (!isSendKey(event)) {\n      return;\n    }\n    event.preventDefault();\n    if (canSend) {\n      onSend();\n    }\n  }\n\n  return (\n    <div\n      className={cn(\n        FIELD_SHELL,\n        'has-[textarea:focus-visible]:ring-ring/25 flex items-end gap-2 p-2 transition-[box-shadow] duration-150 has-[textarea:focus-visible]:ring-[3px]'\n      )}\n    >\n      <textarea\n        value={draft}\n        rows={2}\n        readOnly={isDemonstrating}\n        aria-label='Message to Murmura'\n        placeholder='Ask about your day'\n        onChange={(event) => onDraftChange(event.target.value)}\n        onKeyDown={handleKeys}\n        className='placeholder:text-muted-foreground/75 min-h-12 flex-1 resize-none bg-transparent px-1.5 py-1 text-base leading-normal outline-none md:text-[13px]'\n      />\n      <Button\n        type='button'\n        size='icon'\n        aria-label='Send the message'\n        disabled={!canSend}\n        onClick={onSend}\n        className={pressedSolidOf(pressed === 'send')}\n      >\n        <ArrowUpIcon />\n      </Button>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-13/chat-parts.tsx"
    },
    {
      "path": "registry/ndeko/blocks/heroes/heroes-13/chat-session.ts",
      "content": "import type { SessionStep } from '@/registry/ndeko/hooks/use-session';\nimport { wordsOf } from '@/registry/ndeko/lib/words';\n\nimport { DEMO_EXCHANGE_ID, EXCHANGES, type ExchangeId } from './data';\n\nexport type Phase = 'idle' | 'thinking' | 'reading' | 'streaming' | 'done';\n\nexport type Turn = {\n  id: number;\n  exchangeId: ExchangeId;\n  question: string;\n};\n\nexport type ChatState = {\n  draft: string;\n  turns: Turn[];\n  phase: Phase;\n  toolsShown: number;\n};\n\nexport type ChatAction =\n  | { type: 'typed'; text: string }\n  | { type: 'sent' }\n  | { type: 'asked'; exchangeId: ExchangeId; question: string }\n  | { type: 'tick' }\n  | { type: 'wait' };\n\ntype Step = SessionStep<ChatState, ChatAction>;\n\nconst MAX_TURNS = 3;\n\nexport const THINK_MS = 800;\n\nexport const TOOL_MS = 700;\n\nexport const STREAM_LEAD_MS = 450;\n\nexport const WORD_MS = 48;\n\nconst STREAM_SETTLE_MS = 500;\n\nconst LINGER_MS = 3600;\n\nconst FIRST_KEY_MS = 1300;\n\nconst KEY_MS = 64;\n\nconst KEYS_PER_STEP = 3;\n\nconst SEND_AFTER_MS = 650;\n\nconst DEMO_EXCHANGE = EXCHANGES[DEMO_EXCHANGE_ID];\n\nexport const INITIAL: ChatState = {\n  draft: '',\n  turns: [],\n  phase: 'idle',\n  toolsShown: 0,\n};\n\nexport function lastTurnOf(state: ChatState) {\n  return state.turns.at(-1);\n}\n\nexport function isAnswering(phase: Phase) {\n  const isIdle = phase === 'idle';\n  const isDone = phase === 'done';\n  return !isIdle && !isDone;\n}\n\nexport function exchangeOfText(text: string): ExchangeId {\n  const lowered = text.toLowerCase();\n  if (lowered.includes('move')) {\n    return 'move';\n  }\n  if (lowered.includes('promise')) {\n    return 'promises';\n  }\n  if (lowered.includes('friday') || lowered.includes('plate')) {\n    return 'friday';\n  }\n  return 'fallback';\n}\n\nfunction asked(\n  state: ChatState,\n  exchangeId: ExchangeId,\n  question: string\n): ChatState {\n  if (isAnswering(state.phase)) {\n    return state;\n  }\n  const lastId = lastTurnOf(state)?.id ?? 0;\n  const turn: Turn = { id: lastId + 1, exchangeId, question };\n  const turns = [...state.turns, turn].slice(-MAX_TURNS);\n  return { draft: '', turns, phase: 'thinking', toolsShown: 0 };\n}\n\nfunction sent(state: ChatState): ChatState {\n  const question = state.draft.trim();\n  if (question === '') {\n    return state;\n  }\n  const exchangeId = exchangeOfText(question);\n  return asked(state, exchangeId, question);\n}\n\nfunction ticked(state: ChatState): ChatState {\n  const turn = lastTurnOf(state);\n  if (!turn) {\n    return state;\n  }\n  const toolCount = EXCHANGES[turn.exchangeId].tools.length;\n  if (state.phase === 'thinking') {\n    return { ...state, phase: 'reading' };\n  }\n  if (state.phase === 'reading') {\n    const hasMoreTools = state.toolsShown < toolCount;\n    if (hasMoreTools) {\n      return { ...state, toolsShown: state.toolsShown + 1 };\n    }\n    return { ...state, phase: 'streaming' };\n  }\n  if (state.phase === 'streaming') {\n    return { ...state, phase: 'done' };\n  }\n  return state;\n}\n\nexport function reducer(state: ChatState, action: ChatAction): ChatState {\n  switch (action.type) {\n    case 'typed':\n      return { ...state, draft: action.text };\n    case 'sent':\n      return sent(state);\n    case 'asked':\n      return asked(state, action.exchangeId, action.question);\n    case 'tick':\n      return ticked(state);\n    case 'wait':\n      return state;\n  }\n}\n\nexport function tickDelayOf(state: ChatState) {\n  const turn = lastTurnOf(state);\n  if (!turn) {\n    return null;\n  }\n  const exchange = EXCHANGES[turn.exchangeId];\n  if (state.phase === 'thinking') {\n    return THINK_MS;\n  }\n  if (state.phase === 'reading') {\n    const hasMoreTools = state.toolsShown < exchange.tools.length;\n    if (hasMoreTools) {\n      return TOOL_MS;\n    }\n    return STREAM_LEAD_MS;\n  }\n  if (state.phase === 'streaming') {\n    const wordCount = wordsOf(exchange.answer).length;\n    return wordCount * WORD_MS + STREAM_SETTLE_MS;\n  }\n  return null;\n}\n\nfunction answerMsOf(exchangeId: ExchangeId) {\n  const exchange = EXCHANGES[exchangeId];\n  const wordCount = wordsOf(exchange.answer).length;\n  const toolsMs = exchange.tools.length * TOOL_MS;\n  const streamMs = wordCount * WORD_MS + STREAM_SETTLE_MS;\n  return THINK_MS + toolsMs + STREAM_LEAD_MS + streamMs;\n}\n\nfunction typingSteps(): Step[] {\n  const prompt = DEMO_EXCHANGE.prompt;\n  const steps: Step[] = [];\n  const last = prompt.length + KEYS_PER_STEP;\n  for (let end = KEYS_PER_STEP; end < last; end += KEYS_PER_STEP) {\n    const text = prompt.slice(0, end);\n    let after = KEY_MS;\n    if (steps.length === 0) {\n      after = FIRST_KEY_MS;\n    }\n    steps.push({ after, by: 'demo', action: { type: 'typed', text } });\n  }\n  return steps;\n}\n\nfunction hasAsked(state: ChatState) {\n  return state.turns.length > 0;\n}\n\nexport const SCRIPT: Step[] = [\n  ...typingSteps(),\n  {\n    after: SEND_AFTER_MS,\n    by: 'person',\n    press: 'send',\n    action: { type: 'sent' },\n    isAnswered: hasAsked,\n  },\n  { after: answerMsOf(DEMO_EXCHANGE_ID) + LINGER_MS, action: { type: 'wait' } },\n];\n\nexport const RESTING: ChatState = {\n  draft: '',\n  turns: [\n    { id: 1, exchangeId: DEMO_EXCHANGE_ID, question: DEMO_EXCHANGE.prompt },\n  ],\n  phase: 'done',\n  toolsShown: DEMO_EXCHANGE.tools.length,\n};\n\nexport const LOOP_AFTER_MS = 1800;\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-13/chat-session.ts"
    },
    {
      "path": "registry/ndeko/blocks/heroes/heroes-13/chat.tsx",
      "content": "'use client';\n\nimport { useEffect } from 'react';\n\nimport { useDocumentVisible } from '@/registry/ndeko/hooks/use-agent-run';\nimport { useFollowBottom } from '@/registry/ndeko/hooks/use-follow-bottom';\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 { cn } from '@/registry/ndeko/lib/utils';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { LiveRegion } from '@/registry/ndeko/ui/live-region';\nimport { MeshTile } from '@/registry/ndeko/ui/mesh-tile';\nimport { ReplayButton } from '@/registry/ndeko/ui/replay-button';\n\nimport {\n  AssistantTurn,\n  Composer,\n  EmptyThread,\n  PersonMessage,\n  Suggestions,\n} from './chat-parts';\nimport {\n  INITIAL,\n  isAnswering,\n  LOOP_AFTER_MS,\n  reducer,\n  RESTING,\n  SCRIPT,\n  tickDelayOf,\n} from './chat-session';\nimport {\n  ASSISTANT,\n  CHAT_ANCHOR,\n  CHAT_SECTION,\n  EXCHANGES,\n  SUGGESTIONS,\n  type Suggestion,\n} from './data';\n\nconst SESSION = {\n  reducer,\n  initial: INITIAL,\n  resting: RESTING,\n  script: SCRIPT,\n  loopAfter: LOOP_AFTER_MS,\n};\n\nconst THREAD =\n  'bg-foreground/[0.03] flex h-80 flex-col overflow-y-auto overscroll-contain rounded-xl [scrollbar-width:thin] sm:h-96';\n\nconst THREAD_MASK =\n  '[mask-image:linear-gradient(to_bottom,transparent,black_1.75rem)]';\n\nexport function Chat() {\n  const {\n    ref,\n    isInView,\n    isAutoplaying,\n    state,\n    act,\n    pressed,\n    isFinished,\n    restart,\n  } = useSession(SESSION);\n  const isVisible = useDocumentVisible();\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const { scrollerRef, contentRef, updatePinned } = useFollowBottom();\n  const isActive = isInView && isVisible;\n  const lastTurn = state.turns.at(-1);\n  const delay = tickDelayOf(state);\n  const isIdleOrDone = !isAnswering(state.phase);\n  const hasDraft = state.draft.trim() !== '';\n  const hasTurns = state.turns.length > 0;\n  const canSend = isIdleOrDone && hasDraft;\n  const isHandedOver = !isAutoplaying;\n  const canPlayAgain = !shouldReduceMotion;\n  const canReplay = isFinished && isHandedOver && canPlayAgain;\n  let answerLine = '';\n  if (lastTurn && state.phase === 'done') {\n    answerLine = EXCHANGES[lastTurn.exchangeId].answer;\n  }\n  const message = spokenUnless(isAutoplaying, answerLine);\n\n  useEffect(() => {\n    if (!isActive || delay === null) {\n      return;\n    }\n    let wait = delay;\n    if (shouldReduceMotion) {\n      wait = 0;\n    }\n    const timer = setTimeout(() => act({ type: 'tick' }), wait);\n    return () => clearTimeout(timer);\n  }, [isActive, delay, state.phase, state.toolsShown, shouldReduceMotion, act]);\n\n  function changeDraft(text: string) {\n    act({ type: 'typed', text });\n  }\n\n  function send() {\n    act({ type: 'sent' });\n  }\n\n  function ask(suggestion: Suggestion) {\n    const exchange = EXCHANGES[suggestion.exchangeId];\n    const question = exchange.prompt;\n    act({ type: 'asked', exchangeId: suggestion.exchangeId, question });\n  }\n\n  return (\n    <section id={CHAT_ANCHOR} className='px-4 py-16 sm:px-6 sm:py-24 lg:px-8'>\n      <div className='mx-auto flex max-w-2xl flex-col items-center gap-10'>\n        <div className='flex flex-col items-center gap-3 text-center'>\n          <h2 className='text-2xl font-semibold text-balance sm:text-3xl'>\n            {CHAT_SECTION.title}\n          </h2>\n          <p className='text-muted-foreground max-w-lg text-base text-pretty'>\n            {CHAT_SECTION.description}\n          </p>\n        </div>\n        <div\n          id='chat-card'\n          ref={ref}\n          className='bg-card hairline-ring ring-border flex w-full flex-col gap-3 rounded-2xl p-3 shadow-[0_1px_2px_rgb(0_0_0/0.04),0_16px_40px_-20px_rgb(0_0_0/0.18)] sm:p-4'\n        >\n          <header className='flex flex-wrap items-center gap-x-2.5 gap-y-1 px-1 pt-1'>\n            <MeshTile seed={ASSISTANT.name} size='lg' />\n            <h3 className='text-sm font-medium'>{ASSISTANT.name}</h3>\n            <Badge variant='secondary' className='text-muted-foreground'>\n              Sample conversation\n            </Badge>\n            <div className='ms-auto'>\n              <ReplayButton\n                isShown={canReplay}\n                onReplay={restart}\n                label='Replay the sample'\n              />\n            </div>\n          </header>\n          <div\n            ref={scrollerRef}\n            onScroll={updatePinned}\n            className={cn(THREAD, hasTurns && THREAD_MASK)}\n          >\n            <div\n              ref={contentRef}\n              className='flex min-h-full flex-col gap-5 p-3 sm:p-4'\n            >\n              {!hasTurns && <EmptyThread />}\n              {state.turns.map((turn, index) => {\n                const isLast = index === state.turns.length - 1;\n                let phase = state.phase;\n                let toolsShown = state.toolsShown;\n                if (!isLast) {\n                  phase = 'done';\n                  toolsShown = EXCHANGES[turn.exchangeId].tools.length;\n                }\n\n                return (\n                  <div key={turn.id} className='flex flex-col gap-4'>\n                    <PersonMessage text={turn.question} />\n                    <AssistantTurn\n                      turn={turn}\n                      phase={phase}\n                      toolsShown={toolsShown}\n                      isActive={isActive}\n                    />\n                  </div>\n                );\n              })}\n            </div>\n          </div>\n          <Suggestions\n            suggestions={SUGGESTIONS}\n            phase={state.phase}\n            onAsk={ask}\n          />\n          <Composer\n            draft={state.draft}\n            canSend={canSend}\n            isDemonstrating={isAutoplaying}\n            pressed={pressed}\n            onDraftChange={changeDraft}\n            onSend={send}\n          />\n        </div>\n      </div>\n      <LiveRegion message={message} />\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-13/chat.tsx"
    },
    {
      "path": "registry/ndeko/blocks/heroes/heroes-13/data.ts",
      "content": "import type { BrandSlug } from '@/registry/ndeko/lib/brand-logos';\n\nexport const CHAT_ANCHOR = 'chat';\n\nexport const ABILITIES_ANCHOR = 'abilities';\n\nexport const HERO = {\n  eyebrow: 'An assistant for your day',\n  title: 'Your day in one thread, handled by an assistant that asks first',\n  description:\n    'Tell Murmura what you need in plain words. It reads your calendar, mail and notes, does the small things, and waits for your yes before anything leaves your account.',\n  primaryAction: 'Start free',\n  primaryHref: `#${CHAT_ANCHOR}`,\n  secondaryAction: 'Watch it work',\n  secondaryHref: `#${ABILITIES_ANCHOR}`,\n};\n\nexport const CHAT_SECTION = {\n  title: 'Ask it the way you would ask a colleague',\n  description:\n    'Move a meeting, find a number, check what you promised. This sample plays on its own, and a click or a key hands it to you.',\n};\n\nexport const PERSON = { name: 'Naomi Kabeya' };\n\nexport const ASSISTANT = { name: 'Murmura' };\n\nexport type ExchangeId = 'move' | 'friday' | 'promises' | 'fallback';\n\nexport type ToolLine = {\n  brand: BrandSlug;\n  label: string;\n};\n\nexport type Exchange = {\n  id: ExchangeId;\n  prompt: string;\n  tools: ToolLine[];\n  answer: string;\n};\n\nexport const EXCHANGES: Record<ExchangeId, Exchange> = {\n  move: {\n    id: 'move',\n    prompt:\n      'Move my Thursday call with Lisanga to Friday and let Dieudonné know',\n    tools: [\n      { brand: 'googlecalendar', label: 'Checked Thursday and Friday' },\n      { brand: 'gmail', label: 'Wrote a note to Dieudonné' },\n    ],\n    answer:\n      'Done. The call with Lisanga now starts Friday at 10:00, when you are both free. I wrote a short note to Dieudonné and left it in your drafts, so nothing has been sent.',\n  },\n  friday: {\n    id: 'friday',\n    prompt: 'What is on my plate on Friday?',\n    tools: [\n      { brand: 'googlecalendar', label: 'Read Friday' },\n      { brand: 'notion', label: 'Opened your task list' },\n    ],\n    answer:\n      'Three things. The call with Lisanga at 10:00, the quote for Ines Okafor due at noon, and the school pickup at 16:30. The quote fits between the call and lunch.',\n  },\n  promises: {\n    id: 'promises',\n    prompt: 'What did I promise this week?',\n    tools: [\n      { brand: 'gmail', label: 'Read your sent mail' },\n      { brand: 'googledrive', label: 'Found the contract' },\n    ],\n    answer:\n      'Four promises. The quote to Ines by Friday, a review of the contract for Dieudonné, a call to your sister on Sunday, and the weekly report on Wednesday. Two are done and two are still open.',\n  },\n  fallback: {\n    id: 'fallback',\n    prompt: '',\n    tools: [],\n    answer:\n      'This is a sample conversation, so I only know the three questions on the chips below. Pick one and watch what I do.',\n  },\n};\n\nexport const DEMO_EXCHANGE_ID: ExchangeId = 'move';\n\nexport type Suggestion = {\n  exchangeId: ExchangeId;\n  label: string;\n};\n\nexport const SUGGESTIONS: Suggestion[] = [\n  { exchangeId: 'friday', label: 'What is on my plate on Friday?' },\n  { exchangeId: 'promises', label: 'What did I promise this week?' },\n  { exchangeId: 'move', label: 'Move my Thursday call to Friday' },\n];\n\nexport const ABILITIES_SECTION = {\n  title: 'Three things it does while you do something else',\n  description:\n    'Each one runs below on sample data, so you see what happens before you hand it anything real.',\n};\n\nexport type AbilityId = 'plan' | 'draft' | 'promises';\n\nexport type Ability = {\n  id: AbilityId;\n  title: string;\n  description: string;\n  linkLabel: string;\n};\n\nexport const ABILITIES: Ability[] = [\n  {\n    id: 'plan',\n    title: 'Keeps the day from colliding',\n    description:\n      'When a new event lands on top of another one, Murmura looks for a free slot for the one that can move, checks the other person’s calendar, and tells you what it changed.',\n    linkLabel: 'How planning works',\n  },\n  {\n    id: 'draft',\n    title: 'Drafts the reply, you press send',\n    description:\n      'It reads the message, writes an answer in your voice and leaves it for you. Nothing goes out of your outbox until you say so.',\n    linkLabel: 'How drafts are kept',\n  },\n  {\n    id: 'promises',\n    title: 'Remembers what you promised',\n    description:\n      'Say you will send the quote by Friday anywhere in your day and it lands on one short list with a date. It ticks the promise off when it sees the work done.',\n    linkLabel: 'How the list is built',\n  },\n];\n\nexport type DayEvent = {\n  id: string;\n  title: string;\n  /** Hours after 9:00, so 1.5 is 10:30. */\n  start: number;\n  hours: number;\n  timeLabel: string;\n};\n\nexport const DAY_START_HOUR = 9;\n\nexport const DAY_HOURS = 7;\n\nexport const DAY_EVENTS: DayEvent[] = [\n  {\n    id: 'standup',\n    title: 'Team standup',\n    start: 0,\n    hours: 0.5,\n    timeLabel: '9:00',\n  },\n  {\n    id: 'review',\n    title: 'Design review',\n    start: 1.5,\n    hours: 1,\n    timeLabel: '10:30',\n  },\n  {\n    id: 'lunch',\n    title: 'Lunch with Dieudonné',\n    start: 3.5,\n    hours: 1,\n    timeLabel: '12:30',\n  },\n  {\n    id: 'lisanga',\n    title: 'Call with Lisanga',\n    start: 6,\n    hours: 1,\n    timeLabel: '15:00',\n  },\n];\n\nexport const NEW_EVENT: DayEvent = {\n  id: 'clinic',\n  title: 'Clinic visit',\n  start: 1.5,\n  hours: 1,\n  timeLabel: '10:30',\n};\n\nexport const MOVED_REVIEW_START = 5;\n\nexport const PLAN_NOTES = {\n  overlap: 'Clinic visit overlaps Design review',\n  moved: 'Moved Design review to 14:00, when everyone invited is free',\n  calm: 'Nothing overlaps today',\n};\n\nexport const INCOMING = {\n  from: 'Ines Okafor',\n  time: '08:42',\n  text: 'Can you send the quote before Friday? We would like to sign next week.',\n};\n\nexport const DRAFT_REPLY =\n  'Hello Ines, thank you for waiting. The quote covers the three phases we discussed and the price holds until the 28th. If it works for you, I can send the contract on Monday morning. Naomi';\n\nexport type Commitment = {\n  id: string;\n  text: string;\n  due: string;\n};\n\nexport const COMMITMENTS: Commitment[] = [\n  { id: 'quote', text: 'Send the quote to Ines', due: 'Fri' },\n  { id: 'contract', text: 'Review the contract for Dieudonné', due: 'Mon' },\n  { id: 'sister', text: 'Call my sister', due: 'Sun' },\n];\n\nexport const NEW_COMMITMENT: Commitment = {\n  id: 'report',\n  text: 'Ship the weekly report',\n  due: 'Wed',\n};\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-13/data.ts"
    },
    {
      "path": "registry/ndeko/blocks/heroes/heroes-13/hero.tsx",
      "content": "'use client';\n\nimport { useInView } from 'motion/react';\nimport { useRef } from 'react';\n\nimport { ArrowRightIcon } from '@/registry/ndeko/lib/icons';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Settle, SettleItem } from '@/registry/ndeko/ui/settle';\n\nimport { HERO } from './data';\n\nexport function Hero() {\n  const ref = useRef<HTMLDivElement>(null);\n  const isShown = useInView(ref, { once: true });\n\n  return (\n    <section\n      id='hero'\n      className='flex min-h-[calc(100svh-5.5rem)] items-center px-4 py-16 sm:px-6 sm:py-24 lg:px-8'\n    >\n      <div ref={ref} className='mx-auto w-full max-w-3xl'>\n        <Settle\n          isShown={isShown}\n          className='flex flex-col items-center gap-6 text-center'\n        >\n          <SettleItem>\n            <Badge\n              variant='secondary'\n              className='text-muted-foreground h-6 px-2'\n            >\n              {HERO.eyebrow}\n            </Badge>\n          </SettleItem>\n          <SettleItem>\n            <h1 className='text-4xl font-semibold text-balance sm:text-5xl lg:text-6xl'>\n              {HERO.title}\n            </h1>\n          </SettleItem>\n          <SettleItem>\n            <p className='text-muted-foreground mx-auto max-w-xl text-base text-pretty'>\n              {HERO.description}\n            </p>\n          </SettleItem>\n          <SettleItem className='flex flex-wrap justify-center gap-2 pt-1'>\n            <Button\n              size='lg'\n              nativeButton={false}\n              render={<a href={HERO.primaryHref} />}\n            >\n              {HERO.primaryAction}\n              <ArrowRightIcon />\n            </Button>\n            <Button\n              size='lg'\n              variant='outline'\n              nativeButton={false}\n              render={<a href={HERO.secondaryHref} />}\n            >\n              {HERO.secondaryAction}\n            </Button>\n          </SettleItem>\n        </Settle>\n      </div>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-13/hero.tsx"
    },
    {
      "path": "registry/ndeko/blocks/heroes/heroes-13/point-backdrop.tsx",
      "content": "'use client';\n\nimport { useEffect, useRef } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\n\nimport { mountStage } from './canvas-stage';\nimport { createPointScene, type StopSpec } from './point-field';\n\ntype PointBackdropProps = {\n  stops: readonly StopSpec[];\n};\n\nexport function PointBackdrop({ stops }: PointBackdropProps) {\n  const canvasRef = useRef<HTMLCanvasElement>(null);\n  const shouldReduceMotion = usePrefersReducedMotion();\n\n  useEffect(() => {\n    const canvas = canvasRef.current;\n    if (!canvas) {\n      return;\n    }\n    const scene = createPointScene(stops);\n    const stage = mountStage(canvas, scene, { isStill: shouldReduceMotion });\n    return () => stage?.dispose();\n  }, [stops, shouldReduceMotion]);\n\n  return (\n    <canvas\n      ref={canvasRef}\n      aria-hidden='true'\n      style={{ color: 'var(--primary)' }}\n      className='decoration-foreground pointer-events-none fixed inset-0 z-0 size-full'\n    />\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-13/point-backdrop.tsx"
    },
    {
      "path": "registry/ndeko/blocks/heroes/heroes-13/point-field.ts",
      "content": "import {\n  AT_REST,\n  NEXT_FRAME,\n  wipeSurface,\n  type Inks,\n  type Scene,\n  type Surface,\n} from './canvas-stage';\nimport {\n  randomOf,\n  ringCloud,\n  scatterCloud,\n  sphereCloud,\n  waveCloud,\n  type Cloud,\n  type ShapeId,\n} from './point-shapes';\n\nexport type StopSpec = {\n  anchorId: string;\n  at: number;\n  until?: number;\n  shape: ShapeId;\n  centreX: number;\n  centreY: number;\n  follow: number;\n  size: number;\n  wrapsId?: string;\n};\n\ntype Stop = {\n  element: HTMLElement | null;\n  at: number;\n  until: number;\n  follow: number;\n  baseX: number;\n  baseY: number;\n  anchorY: number;\n  holdY: number;\n  cloud: Cloud;\n  slots: Uint16Array;\n};\n\ntype Field = {\n  inks: Inks;\n  isStill: boolean;\n  specs: readonly StopSpec[];\n  width: number;\n  height: number;\n  count: number;\n  stops: Stop[];\n  time: number;\n  smoothMid: number;\n  delay: Float32Array;\n  burstX: Float32Array;\n  burstY: Float32Array;\n  size: Float32Array;\n  hue: Uint8Array;\n  x: Float32Array;\n  y: Float32Array;\n  light: Float32Array;\n  buckets: Uint16Array[];\n  fills: Uint16Array;\n};\n\nconst SEED = 8;\n\nconst AREA_PER_POINT = 300;\n\nconst MIN_POINTS = 700;\n\nconst MAX_POINTS = 2600;\n\nconst LIGHT_LEVELS = 4;\n\nconst LEVEL_ALPHA = [0.1, 0.2, 0.34, 0.55];\n\nconst BUCKET_COUNT = LIGHT_LEVELS * 2;\n\nconst HUE_SHARE = 0.1;\n\nconst STAGGER_SPAN = 0.55;\n\nconst HOLD_SHARE = 0.12;\n\nconst MID_EASE_S = 0.16;\n\nconst BURST_SHARE = 0.14;\n\nconst EDGE_PX = 6;\n\nconst RING_GAP_SHARE = 0.04;\n\n/** The ring passes behind the corners of the card it goes round, so it hugs the sides instead of clearing the corners. */\nconst RING_REACH_X = 1.22;\n\nconst RING_REACH_Y = 1.2;\n\nconst RING_MAX_SHARE_X = 0.58;\n\nconst RING_MAX_SHARE_Y = 0.46;\n\nconst NO_INKS: Inks = { hue: 'transparent', neutral: 'transparent' };\n\nfunction clamp(value: number, low: number, high: number) {\n  const raised = Math.max(low, value);\n  return Math.min(high, raised);\n}\n\nfunction smoothstep(low: number, high: number, value: number) {\n  const span = high - low;\n  const raw = (value - low) / span;\n  const share = clamp(raw, 0, 1);\n  return share * share * (3 - 2 * share);\n}\n\nfunction shareOf(seconds: number, easeSeconds: number) {\n  const ratio = seconds / easeSeconds;\n  return 1 - Math.exp(-ratio);\n}\n\nfunction countOf(width: number, height: number) {\n  const area = width * height;\n  const roomy = Math.round(area / AREA_PER_POINT);\n  return clamp(roomy, MIN_POINTS, MAX_POINTS);\n}\n\nfunction fieldOf(specs: readonly StopSpec[]): Field {\n  return {\n    inks: NO_INKS,\n    isStill: false,\n    specs,\n    width: 0,\n    height: 0,\n    count: 0,\n    stops: [],\n    time: 0,\n    smoothMid: 0,\n    delay: new Float32Array(0),\n    burstX: new Float32Array(0),\n    burstY: new Float32Array(0),\n    size: new Float32Array(0),\n    hue: new Uint8Array(0),\n    x: new Float32Array(0),\n    y: new Float32Array(0),\n    light: new Float32Array(0),\n    buckets: [],\n    fills: new Uint16Array(BUCKET_COUNT),\n  };\n}\n\nfunction seedParticles(field: Field, count: number) {\n  const random = randomOf(SEED);\n  field.count = count;\n  field.delay = new Float32Array(count);\n  field.burstX = new Float32Array(count);\n  field.burstY = new Float32Array(count);\n  field.size = new Float32Array(count);\n  field.hue = new Uint8Array(count);\n  field.x = new Float32Array(count);\n  field.y = new Float32Array(count);\n  field.light = new Float32Array(count);\n  field.buckets = Array.from(\n    { length: BUCKET_COUNT },\n    () => new Uint16Array(count)\n  );\n  for (let index = 0; index < count; index += 1) {\n    const angle = random() * Math.PI * 2;\n    const reach = Math.sqrt(random());\n    const sizeStep = Math.floor(random() * 3);\n    field.delay[index] = random() * (1 - STAGGER_SPAN);\n    field.burstX[index] = Math.cos(angle) * reach;\n    field.burstY[index] = Math.sin(angle) * reach;\n    field.size[index] = 1.2 + sizeStep * 0.5;\n    field.hue[index] = Number(random() < HUE_SHARE);\n  }\n}\n\nfunction cloudOf(\n  spec: StopSpec,\n  field: Field,\n  element: HTMLElement | null,\n  random: () => number\n) {\n  const { width, height, count } = field;\n  const side = Math.min(width, height);\n  if (spec.shape === 'sphere') {\n    return sphereCloud(count, spec.size * side);\n  }\n  if (spec.shape === 'wave') {\n    return waveCloud(count, width, height);\n  }\n  if (spec.shape === 'scatter') {\n    return scatterCloud(count, width, height, random);\n  }\n  const box = element?.getBoundingClientRect();\n  const boxWidth = box?.width ?? side;\n  const boxHeight = box?.height ?? side;\n  const gap = side * RING_GAP_SHARE;\n  const reachX = (boxWidth / 2) * RING_REACH_X + gap;\n  const reachY = (boxHeight / 2) * RING_REACH_Y + gap;\n  const radiusX = Math.min(reachX, width * RING_MAX_SHARE_X);\n  const radiusY = Math.min(reachY, height * RING_MAX_SHARE_Y);\n  return ringCloud(count, radiusX, radiusY, random);\n}\n\nfunction centreXOf(spec: StopSpec, field: Field, element: HTMLElement | null) {\n  const windowX = spec.centreX * field.width;\n  if (spec.wrapsId === undefined) {\n    return windowX;\n  }\n  if (!element) {\n    return windowX;\n  }\n  const box = element.getBoundingClientRect();\n  return box.left + box.width / 2;\n}\n\nfunction wrappedElementOf(spec: StopSpec, anchor: HTMLElement | null) {\n  if (spec.wrapsId === undefined) {\n    return anchor;\n  }\n  return document.getElementById(spec.wrapsId);\n}\n\nfunction rankKeysOf(stop: Stop, count: number) {\n  const keys = new Float32Array(count);\n  for (let index = 0; index < count; index += 1) {\n    const across = stop.baseX + stop.cloud.x[index];\n    const down = stop.baseY + stop.cloud.y[index];\n    keys[index] = across + down * 0.35;\n  }\n  return keys;\n}\n\nfunction orderOf(keys: Float32Array) {\n  const order = Array.from(keys.keys());\n  order.sort((first, second) => keys[first] - keys[second]);\n  return Uint16Array.from(order);\n}\n\n/** Pairs the points of two shapes from left to right, so a shape flows into the next one without crossing itself. */\nfunction slotsAfter(previous: Stop, next: Stop, count: number) {\n  const fromOrder = orderOf(rankKeysOf(previous, count));\n  const toOrder = orderOf(rankKeysOf(next, count));\n  const pairing = new Uint16Array(count);\n  for (let rank = 0; rank < count; rank += 1) {\n    pairing[fromOrder[rank]] = toOrder[rank];\n  }\n  const slots = new Uint16Array(count);\n  for (let index = 0; index < count; index += 1) {\n    slots[index] = pairing[previous.slots[index]];\n  }\n  return slots;\n}\n\nfunction identitySlots(count: number) {\n  const slots = new Uint16Array(count);\n  for (let index = 0; index < count; index += 1) {\n    slots[index] = index;\n  }\n  return slots;\n}\n\nfunction stopOf(spec: StopSpec, field: Field, random: () => number): Stop {\n  const anchor = document.getElementById(spec.anchorId);\n  const wrapped = wrappedElementOf(spec, anchor);\n  return {\n    element: anchor,\n    at: spec.at,\n    until: spec.until ?? spec.at,\n    follow: spec.follow,\n    baseX: centreXOf(spec, field, wrapped),\n    baseY: spec.centreY * field.height,\n    anchorY: 0,\n    holdY: 0,\n    cloud: cloudOf(spec, field, wrapped, random),\n    slots: identitySlots(field.count),\n  };\n}\n\nfunction hasElement(stop: Stop) {\n  return stop.element !== null;\n}\n\nfunction layField(field: Field, surface: Surface, isStill: boolean) {\n  field.width = surface.width;\n  field.height = surface.height;\n  field.isStill = isStill;\n  const count = countOf(surface.width, surface.height);\n  seedParticles(field, count);\n  const random = randomOf(SEED + 1);\n  const built = field.specs.map((spec) => stopOf(spec, field, random));\n  const placed = built.filter(hasElement);\n  for (let index = 1; index < placed.length; index += 1) {\n    placed[index].slots = slotsAfter(placed[index - 1], placed[index], count);\n  }\n  field.stops = placed;\n  field.time = 0;\n  field.smoothMid = window.scrollY + surface.height / 2;\n}\n\nfunction measureAnchors(field: Field, scrollY: number) {\n  for (const stop of field.stops) {\n    const box = stop.element?.getBoundingClientRect();\n    if (box) {\n      const top = box.top + scrollY;\n      stop.anchorY = top + box.height * stop.at;\n      stop.holdY = top + box.height * stop.until;\n    }\n  }\n}\n\ntype Segment = {\n  index: number;\n  mix: number;\n};\n\nfunction segmentOf(field: Field, mid: number): Segment {\n  const { stops } = field;\n  const last = stops.length - 1;\n  if (last < 1) {\n    return { index: 0, mix: 0 };\n  }\n  for (let index = 0; index < last; index += 1) {\n    const start = stops[index].holdY;\n    const end = stops[index + 1].anchorY;\n    if (mid < end) {\n      const span = Math.max(1, end - start);\n      const share = clamp((mid - start) / span, 0, 1);\n      const mix = smoothstep(HOLD_SHARE, 1 - HOLD_SHARE, share);\n      return { index, mix };\n    }\n  }\n  return { index: last, mix: 0 };\n}\n\nfunction centreYOf(stop: Stop, scrollY: number, height: number) {\n  const mid = scrollY + height / 2;\n  return stop.baseY + stop.follow * (stop.anchorY - mid);\n}\n\nfunction levelOf(light: number) {\n  if (!Number.isFinite(light)) {\n    return 0;\n  }\n  const scaled = Math.floor(light * LIGHT_LEVELS);\n  return clamp(scaled, 0, LIGHT_LEVELS - 1);\n}\n\nfunction placeParticles(field: Field, scrollY: number, segment: Segment) {\n  const { stops, count, height, width } = field;\n  const from = stops[segment.index];\n  const to = stops[segment.index + 1] ?? from;\n  const { mix } = segment;\n  const fromX = from.baseX;\n  const fromY = centreYOf(from, scrollY, height);\n  const toX = to.baseX;\n  const toY = centreYOf(to, scrollY, height);\n  const burst = Math.min(width, height) * BURST_SHARE;\n  const isBlending = mix > 0 && to !== from;\n  if (from.cloud.isMoving) {\n    from.cloud.advance(field.time);\n  }\n  if (isBlending && to.cloud.isMoving) {\n    to.cloud.advance(field.time);\n  }\n  field.fills.fill(0);\n  for (let index = 0; index < count; index += 1) {\n    const slotA = from.slots[index];\n    let x = fromX + from.cloud.x[slotA];\n    let y = fromY + from.cloud.y[slotA];\n    let light = from.cloud.light[slotA];\n    if (isBlending) {\n      const slotB = to.slots[index];\n      const delay = field.delay[index];\n      const local = smoothstep(delay, delay + STAGGER_SPAN, mix);\n      const arc = Math.sin(local * Math.PI);\n      const bump = arc * arc * burst;\n      const targetX = toX + to.cloud.x[slotB];\n      const targetY = toY + to.cloud.y[slotB];\n      x += (targetX - x) * local + field.burstX[index] * bump;\n      y += (targetY - y) * local + field.burstY[index] * bump;\n      light += (to.cloud.light[slotB] - light) * local;\n    }\n    field.x[index] = x;\n    field.y[index] = y;\n    field.light[index] = light;\n    const isOutside =\n      x < -EDGE_PX ||\n      x > width + EDGE_PX ||\n      y < -EDGE_PX ||\n      y > height + EDGE_PX;\n    if (!isOutside) {\n      const bucket = field.hue[index] * LIGHT_LEVELS + levelOf(light);\n      const filled = field.fills[bucket];\n      field.buckets[bucket][filled] = index;\n      field.fills[bucket] = filled + 1;\n    }\n  }\n}\n\nfunction paintBucket(\n  field: Field,\n  surface: Surface,\n  bucket: number,\n  ink: string\n) {\n  const { pen } = surface;\n  const filled = field.fills[bucket];\n  if (filled === 0) {\n    return;\n  }\n  const level = bucket % LIGHT_LEVELS;\n  const members = field.buckets[bucket];\n  pen.globalAlpha = LEVEL_ALPHA[level];\n  pen.fillStyle = ink;\n  pen.beginPath();\n  for (let slot = 0; slot < filled; slot += 1) {\n    const index = members[slot];\n    const side = field.size[index];\n    pen.rect(field.x[index] - side / 2, field.y[index] - side / 2, side, side);\n  }\n  pen.fill();\n}\n\nfunction paintField(field: Field, surface: Surface) {\n  wipeSurface(surface);\n  for (let bucket = 0; bucket < BUCKET_COUNT; bucket += 1) {\n    const isHue = bucket >= LIGHT_LEVELS;\n    let ink = field.inks.neutral;\n    if (isHue) {\n      ink = field.inks.hue;\n    }\n    paintBucket(field, surface, bucket, ink);\n  }\n}\n\nfunction drawField(field: Field, surface: Surface) {\n  if (field.stops.length === 0) {\n    wipeSurface(surface);\n    return;\n  }\n  const scrollY = window.scrollY;\n  measureAnchors(field, scrollY);\n  let segment: Segment = { index: 0, mix: 0 };\n  if (!field.isStill) {\n    segment = segmentOf(field, field.smoothMid);\n  }\n  placeParticles(field, scrollY, segment);\n  paintField(field, surface);\n}\n\nfunction stepField(field: Field, surface: Surface, seconds: number) {\n  if (field.isStill || field.stops.length === 0) {\n    return AT_REST;\n  }\n  field.time += seconds;\n  const mid = window.scrollY + field.height / 2;\n  const share = shareOf(seconds, MID_EASE_S);\n  field.smoothMid += (mid - field.smoothMid) * share;\n  drawField(field, surface);\n  return NEXT_FRAME;\n}\n\nexport function createPointScene(specs: readonly StopSpec[]): Scene {\n  const field = fieldOf(specs);\n  return {\n    ink(inks) {\n      field.inks = inks;\n    },\n    fit(surface, isStill) {\n      layField(field, surface, isStill);\n    },\n    draw(surface) {\n      drawField(field, surface);\n    },\n    step(surface, seconds) {\n      return stepField(field, surface, seconds);\n    },\n  };\n}\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-13/point-field.ts"
    },
    {
      "path": "registry/ndeko/blocks/heroes/heroes-13/point-shapes.ts",
      "content": "export type ShapeId = 'sphere' | 'ring' | 'wave' | 'scatter';\n\nexport type Cloud = {\n  x: Float32Array;\n  y: Float32Array;\n  light: Float32Array;\n  isMoving: boolean;\n  advance: (time: number) => void;\n};\n\nconst FULL_TURN = Math.PI * 2;\n\nconst GOLDEN_ANGLE = Math.PI * (3 - Math.sqrt(5));\n\nconst GOLDEN_SHARE = 0.6180339887;\n\nconst SPHERE_SPIN = 0.1;\n\nconst SPHERE_TILT = 0.38;\n\nconst RING_SPIN = 0.16;\n\nconst RING_TILT = -0.2;\n\nconst RING_BANDS = 3;\n\nconst WAVE_ROWS = 18;\n\nconst WAVE_SPEED = 0.55;\n\nconst STILL = () => {};\n\n/** The same stream of numbers from 0 to 1 for the same seed, so a shape never changes between two renders. */\nexport function randomOf(seed: number) {\n  let state = seed >>> 0;\n\n  return function next() {\n    state = (state + 0x6d2b79f5) >>> 0;\n    const shifted = state >>> 15;\n    const folded = state ^ shifted;\n    const odd = state | 1;\n    const first = Math.imul(folded, odd);\n    const reshifted = first >>> 7;\n    const refolded = first ^ reshifted;\n    const salted = first | 61;\n    const second = Math.imul(refolded, salted);\n    const summed = first + second;\n    const mixed = first ^ summed;\n    const lastShift = mixed >>> 14;\n    const settled = mixed ^ lastShift;\n    return (settled >>> 0) / 4294967296;\n  };\n}\n\nfunction lightOfDepth(depth: number) {\n  const front = depth * 0.5 + 0.5;\n  return front ** 1.6;\n}\n\nexport function sphereCloud(count: number, radius: number): Cloud {\n  const x = new Float32Array(count);\n  const y = new Float32Array(count);\n  const light = new Float32Array(count);\n  const baseX = new Float32Array(count);\n  const baseY = new Float32Array(count);\n  const baseZ = new Float32Array(count);\n  const cosTilt = Math.cos(SPHERE_TILT);\n  const sinTilt = Math.sin(SPHERE_TILT);\n\n  for (let index = 0; index < count; index += 1) {\n    const share = (index + 0.5) / count;\n    const height = 1 - 2 * share;\n    const ringRadius = Math.sqrt(1 - height * height);\n    const turn = index * GOLDEN_ANGLE;\n    baseX[index] = Math.cos(turn) * ringRadius;\n    baseY[index] = height;\n    baseZ[index] = Math.sin(turn) * ringRadius;\n  }\n\n  function advance(time: number) {\n    const yaw = time * SPHERE_SPIN;\n    const cosYaw = Math.cos(yaw);\n    const sinYaw = Math.sin(yaw);\n    for (let index = 0; index < count; index += 1) {\n      const turnedX = baseX[index] * cosYaw + baseZ[index] * sinYaw;\n      const turnedZ = baseZ[index] * cosYaw - baseX[index] * sinYaw;\n      const tiltedY = baseY[index] * cosTilt - turnedZ * sinTilt;\n      const tiltedZ = baseY[index] * sinTilt + turnedZ * cosTilt;\n      x[index] = turnedX * radius;\n      y[index] = tiltedY * radius;\n      light[index] = lightOfDepth(tiltedZ);\n    }\n  }\n\n  advance(0);\n  return { x, y, light, isMoving: true, advance };\n}\n\nexport function ringCloud(\n  count: number,\n  radiusX: number,\n  radiusY: number,\n  random: () => number\n): Cloud {\n  const x = new Float32Array(count);\n  const y = new Float32Array(count);\n  const light = new Float32Array(count);\n  const turns = new Float32Array(count);\n  const reach = new Float32Array(count);\n  const lift = new Float32Array(count);\n  const cosTilt = Math.cos(RING_TILT);\n  const sinTilt = Math.sin(RING_TILT);\n\n  for (let index = 0; index < count; index += 1) {\n    const share = (index * GOLDEN_SHARE) % 1;\n    const band = index % RING_BANDS;\n    const bandReach = 0.93 + band * 0.07;\n    const wobble = (random() - 0.5) * 0.03;\n    turns[index] = share * FULL_TURN;\n    reach[index] = bandReach + wobble;\n    lift[index] = (random() - 0.5) * radiusY * 0.08;\n  }\n\n  function advance(time: number) {\n    const drift = time * RING_SPIN;\n    for (let index = 0; index < count; index += 1) {\n      const angle = turns[index] + drift;\n      const cosAngle = Math.cos(angle);\n      const sinAngle = Math.sin(angle);\n      const ellipseX = cosAngle * radiusX * reach[index];\n      const ellipseY = sinAngle * radiusY * reach[index] + lift[index];\n      x[index] = ellipseX * cosTilt - ellipseY * sinTilt;\n      y[index] = ellipseX * sinTilt + ellipseY * cosTilt;\n      light[index] = lightOfDepth(sinAngle);\n    }\n  }\n\n  advance(0);\n  return { x, y, light, isMoving: true, advance };\n}\n\nexport function waveCloud(count: number, width: number, height: number): Cloud {\n  const x = new Float32Array(count);\n  const y = new Float32Array(count);\n  const light = new Float32Array(count);\n  const rowOf = new Float32Array(count);\n  const columns = Math.ceil(count / WAVE_ROWS);\n  const wavelength = width * 0.5;\n  const band = height * 0.36;\n  const amplitude = height * 0.11;\n  const lastRow = WAVE_ROWS - 1;\n\n  for (let index = 0; index < count; index += 1) {\n    const column = Math.floor(index / WAVE_ROWS);\n    const row = index % WAVE_ROWS;\n    const across = column / (columns - 1);\n    x[index] = (across - 0.5) * width * 1.08;\n    rowOf[index] = row / lastRow;\n  }\n\n  function advance(time: number) {\n    const phase = time * WAVE_SPEED;\n    for (let index = 0; index < count; index += 1) {\n      const depth = rowOf[index];\n      const swell = Math.sin(\n        (x[index] / wavelength) * FULL_TURN + phase + depth * 2.4\n      );\n      const baseline = (depth - 0.5) * band;\n      const reachOfRow = 0.45 + depth * 0.75;\n      y[index] = baseline + swell * amplitude * reachOfRow;\n      const crest = swell * 0.5 + 0.5;\n      light[index] = 0.1 + depth * 0.62 + crest * 0.28;\n    }\n  }\n\n  advance(0);\n  return { x, y, light, isMoving: true, advance };\n}\n\nexport function scatterCloud(\n  count: number,\n  width: number,\n  height: number,\n  random: () => number\n): Cloud {\n  const x = new Float32Array(count);\n  const y = new Float32Array(count);\n  const light = new Float32Array(count);\n\n  for (let index = 0; index < count; index += 1) {\n    x[index] = (random() - 0.5) * width;\n    y[index] = (random() - 0.5) * height;\n    light[index] = 0.06 + random() * 0.4;\n  }\n\n  return { x, y, light, isMoving: false, advance: STILL };\n}\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-13/point-shapes.ts"
    },
    {
      "path": "registry/ndeko/blocks/heroes/heroes-13/point-stops.ts",
      "content": "import type { StopSpec } from './point-field';\n\nexport const POINT_STOPS: readonly StopSpec[] = [\n  {\n    anchorId: 'hero',\n    at: 0.5,\n    shape: 'sphere',\n    centreX: 0.5,\n    centreY: 0.5,\n    follow: 0.45,\n    size: 0.46,\n  },\n  {\n    anchorId: 'chat',\n    at: 0,\n    shape: 'sphere',\n    centreX: 0.14,\n    centreY: 0.5,\n    follow: 0.6,\n    size: 0.24,\n  },\n  {\n    anchorId: 'chat',\n    at: 0.55,\n    shape: 'ring',\n    centreX: 0.5,\n    centreY: 0.5,\n    follow: 1,\n    size: 0.3,\n    wrapsId: 'chat-card',\n  },\n  {\n    anchorId: 'abilities',\n    at: 0.25,\n    until: 0.85,\n    shape: 'wave',\n    centreX: 0.5,\n    centreY: 0.76,\n    follow: 0,\n    size: 0.3,\n  },\n];\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-13/point-stops.ts"
    },
    {
      "path": "registry/ndeko/blocks/heroes/heroes-13/use-resting-state.ts",
      "content": "'use client';\n\nimport { useEffect } from 'react';\n\n/**\n * A demonstration that will not play, because of reduced motion or because a person took over, ends\n * on the state that shows best what it does. The state is applied from a timer, as the session hook\n * does, so the first render still matches the server.\n */\nexport function useRestingState<State>(\n  isResting: boolean,\n  restingState: State,\n  apply: (state: State) => void\n) {\n  useEffect(() => {\n    if (!isResting) {\n      return;\n    }\n    const timer = setTimeout(() => apply(restingState), 0);\n    return () => clearTimeout(timer);\n  }, [isResting, restingState, apply]);\n}\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-13/use-resting-state.ts"
    }
  ],
  "categories": [
    "blocks",
    "heroes"
  ],
  "type": "registry:block"
}