{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"integrations","title":"Integrations","description":"Integrations Section Block for React. The tools a product connects to, drifting in rows under a capsule of glass that shows each in its own colour. Press one and the glass opens into a panel to connect it; connected tools keep their colour, so the rows fill in as the stack comes together.","type":"registry:block","author":"Detent","dependencies":["motion","simple-icons"],"registryDependencies":["https://detentui.com/r/theme.json"],"files":[{"path":"components/detent/blocks/integrations/Integrations.tsx","target":"components/detent/blocks/integrations/Integrations.tsx","type":"registry:block","content":"'use client'\n\nimport { useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from 'react'\nimport type { KeyboardEvent as ReactKeyboardEvent, PointerEvent as ReactPointerEvent } from 'react'\nimport { AnimatePresence, motion, useAnimationFrame, useInView, useReducedMotion } from 'motion/react'\nimport { dragProps, useDetent } from '@/components/detent/lib/detent'\nimport { tap } from '@/components/detent/lib/feel'\nimport { Count } from '@/components/detent/ui/Count'\nimport { DrawnCheck } from '@/components/detent/ui/Outcome'\nimport { Spinner } from '@/components/detent/ui/Spinner'\nimport { ArrowRight, Check } from '@/components/detent/blocks/kit/icons'\nimport { btn } from '@/components/detent/blocks/kit/primitives'\nimport { InPlay, useDirector } from '@/components/detent/blocks/kit/director'\nimport { accentVars } from '@/components/detent/blocks/kit/props'\nimport type { BlockProps } from '@/components/detent/blocks/kit/props'\nimport { ACCESS, INTEGRATIONS } from '@/components/detent/blocks/integrations/content'\nimport type { Integration } from '@/components/detent/blocks/integrations/content'\nimport { ease, dur, spring } from '@/components/detent/lib/motion'\n\nconst takeFocus = (el: HTMLButtonElement | null) => el?.focus({ preventScroll: true })\n\nexport type IntegrationsProps = BlockProps & {\n  product?: string\n  title?: [string, string]\n  subline?: string\n  integrations?: Integration[]\n  more?: { label: string; href: string }\n  speed?: number\n  onConnect?: (id: string) => Promise<void> | void\n}\n\nconst mod = (a: number, n: number) => ((a % n) + n) % n\nconst COAST = 0.31\nconst GLIDE = { w: 13, z: 1 }\n\nfunction markFill(hex: string) {\n  const c = hex.replace('#', '')\n  const [r, g, b] = [0, 2, 4].map((i) => parseInt(c.slice(i, i + 2), 16) / 255)\n  const lum = 0.2126 * r + 0.7152 * g + 0.0722 * b\n  return `light-dark(${lum > 0.78 ? 'var(--ink)' : hex}, ${lum < 0.22 ? 'var(--ink)' : hex})`\n}\n\nfunction capsuleMap(w: number, h: number, pad: number, density: number) {\n  const W = Math.round((w + pad * 2) * density)\n  const H = Math.round((h + pad * 2) * density)\n  const c = document.createElement('canvas')\n  c.width = W\n  c.height = H\n  const ctx = c.getContext('2d')\n  if (!ctx) return ''\n  const img = ctx.createImageData(W, H)\n  const r = h / 2\n  const a = w / 2 - r\n  const bevel = r * 0.46\n  for (let py = 0; py < H; py++)\n    for (let px = 0; px < W; px++) {\n      const x = (px + 0.5) / density - pad - w / 2\n      const y = (py + 0.5) / density - pad - h / 2\n      const cx = Math.max(-a, Math.min(a, x))\n      const dx = x - cx\n      const len = Math.hypot(dx, y) || 1\n      const d = len - r\n      let k = 0\n      if (d <= 0) k = -d < bevel ? Math.pow(1 - -d / bevel, 2.6) : 0\n      else if (d < pad * 0.8) {\n        const t = d / (pad * 0.8)\n        k = 1 - t * t * (3 - 2 * t)\n      }\n      const i = (py * W + px) * 4\n      img.data[i] = Math.round(128 - (dx / len) * k * 127)\n      img.data[i + 1] = Math.round(128 - (y / len) * k * 127)\n      img.data[i + 2] = 128\n      img.data[i + 3] = 255\n    }\n  ctx.putImageData(img, 0, 0)\n  return c.toDataURL()\n}\n\nfunction useSize<T extends HTMLElement>(fallback: number) {\n  const ref = useRef<T>(null)\n  const [w, setW] = useState(fallback)\n  useLayoutEffect(() => {\n    const el = ref.current\n    if (!el) return\n    const read = () => setW(Math.max(280, Math.round(el.clientWidth)))\n    read()\n    const ro = new ResizeObserver(read)\n    ro.observe(el)\n    return () => ro.disconnect()\n  }, [])\n  return [ref, w] as const\n}\n\nfunction Mark({ path, size, color }: { path: string; size: number; color: string }) {\n  return (\n    <svg aria-hidden width={size} height={size} viewBox=\"0 0 24 24\" className=\"block\" style={{ fill: markFill(color) }}>\n      <path d={path} />\n    </svg>\n  )\n}\n\nexport function Integrations({\n  autoplay = true,\n  accent,\n  product = 'Detent',\n  title = ['Plugs into the tools', 'your team lives in.'],\n  subline = 'It reads from them, writes to them, and knows when to hand over to a person. Press any of them to connect it.',\n  integrations = INTEGRATIONS,\n  more = { label: 'See all 40 integrations', href: '#integrations' },\n  speed = 22,\n  onConnect,\n  className = '',\n}: IntegrationsProps) {\n  const calls = useRef({ onConnect })\n  useLayoutEffect(() => {\n    calls.current = { onConnect }\n  })\n  const reduce = useReducedMotion()\n  const inPlay = useContext(InPlay)\n  const id = `glass${useId().replace(/[^a-zA-Z0-9]/g, '')}`\n  const handed = useRef(!autoplay)\n\n  const [box, W] = useSize<HTMLDivElement>(1100)\n  const seen = useInView(box)\n  const rowH = Math.round(Math.min(76, Math.max(56, W * 0.066)))\n  const chipW = Math.round(rowH * 1.38)\n  const gap = Math.round(rowH * 0.2)\n  const step = chipW + gap\n  const rowGap = Math.round(rowH * 0.26)\n  const padY = Math.round(rowH * 0.6)\n  const H = rowH * 3 + rowGap * 2 + padY * 2\n  const rows = [0, 1, 2].map((r) => integrations.filter((_, i) => i % 3 === r))\n  const rowY = (r: number) => padY + r * (rowH + rowGap)\n  const Gh = Math.round(rowH * 1.9)\n  const Gw = Math.round(Math.min(W * 0.46, Gh * 2.6))\n  const pad = Math.round(Gh * 0.16)\n  const M = 1.22\n  const mark = Math.round(rowH * 0.38)\n  const map = useMemo(() => (typeof document === 'undefined' ? '' : capsuleMap(Gw, Gh, pad, 1.5)), [Gw, Gh, pad])\n  const drift = [-1, 0.8, -1.15]\n\n  const [connected, setConnected] = useState(() => new Set(integrations.filter((t) => t.connected).map((t) => t.id)))\n  const [open, setOpen] = useState<{ id: string; phase: 'ask' | 'busy' | 'done' } | null>(null)\n\n  const travel = useRef(0)\n  const scrub = useRef({ at: 0 })\n  const pace = useRef(1)\n  const hover = useRef(false)\n  const held = useRef(false)\n  const pressed = useRef({ x: 0, y: 0, t: 0 })\n  const width = useRef(W)\n  const pick = useRef(() => {})\n  const light = useRef({ x: 0, y: 0, tx: 0, ty: 0 })\n  const [focus, setFocus] = useState(rows[1][0]?.id ?? integrations[0].id)\n  const focused = useRef(focus)\n\n  const base = useRef<(SVGGElement | null)[]>([])\n  const lit = useRef<(SVGGElement | null)[]>([])\n  const lens = useRef<SVGGElement>(null)\n  const copy = useRef<SVGGElement>(null)\n  const rim = useRef<SVGLinearGradientElement>(null)\n  const glint = useRef<SVGEllipseElement>(null)\n\n  const offset = (r: number) => {\n    const len = rows[r].length * step\n    return mod(drift[r] * travel.current + scrub.current.at, len) - len\n  }\n  const paint = () => {\n    const l = light.current\n    const gx = W / 2 + l.x * 10\n    const gy = H / 2 + l.y * 6\n    for (let r = 0; r < 3; r++) {\n      const t = `translate(${offset(r)} ${rowY(r)})`\n      base.current[r]?.setAttribute('transform', t)\n      lit.current[r]?.setAttribute('transform', t)\n    }\n    lens.current?.setAttribute('transform', `translate(${gx} ${gy})`)\n    copy.current?.setAttribute('transform', `scale(${M}) translate(${-gx} ${-gy})`)\n    rim.current?.setAttribute('gradientTransform', `rotate(${(Math.atan2(l.y, l.x || 0.0001) * 180) / Math.PI + 135} 0.5 0.5)`)\n    glint.current?.setAttribute('transform', `translate(${l.x * Gw * 0.12} 0)`)\n  }\n  const name = () => {\n    const row = rows[1]\n    const j = Math.round((W / 2 + light.current.x * 10 - offset(1) - chipW / 2) / step)\n    const t = row[mod(j, row.length)]\n    if (t && t.id !== focused.current) {\n      focused.current = t.id\n      setFocus(t.id)\n    }\n  }\n  const latest = useRef({ paint, name })\n  useLayoutEffect(() => {\n    latest.current = { paint, name }\n    paint()\n  })\n\n  const dial = useDetent({\n    value: 0,\n    throw: COAST,\n    spring: GLIDE,\n    muted: true,\n    onFrame: (x) => {\n      scrub.current.at = x\n      latest.current.paint()\n      latest.current.name()\n    },\n  })\n  const [drag] = useState(() =>\n    dragProps(dial, () => ({\n      box: () => box.current,\n      units: () => width.current,\n      muted: true,\n      release: () => ({ flick: !reduce }),\n      onTap: () => pick.current(),\n    })),\n  )\n\n  useAnimationFrame((_, delta) => {\n    if (!seen || !inPlay) return\n    const dt = Math.min(delta, 64) / 1000\n    pace.current += ((held.current ? 0 : hover.current ? 0.22 : 1) - pace.current) * Math.min(1, dt * 4)\n    if (autoplay && !reduce && dial.mode() !== 'held') travel.current += speed * pace.current * dt\n    const l = light.current\n    l.x += (l.tx - l.x) * Math.min(1, dt * (reduce ? 60 : 6))\n    l.y += (l.ty - l.y) * Math.min(1, dt * (reduce ? 60 : 6))\n    latest.current.paint()\n    latest.current.name()\n  })\n\n  const bring = (cx: number) => {\n    dial.to(dial.get() + (W / 2 - cx))\n  }\n  const where = (tid: string) => {\n    const r = rows.findIndex((row) => row.some((t) => t.id === tid))\n    const i = rows[r].findIndex((t) => t.id === tid)\n    const len = rows[r].length * step\n    const x0 = offset(r) + i * step + chipW / 2\n    const k = Math.round((W / 2 - x0) / len)\n    return x0 + k * len\n  }\n\n  const ask = (tid: string) => {\n    held.current = true\n    bring(where(tid))\n    setOpen({ id: tid, phase: 'ask' })\n  }\n  const close = () => {\n    held.current = false\n    setOpen(null)\n    box.current?.focus({ preventScroll: true })\n  }\n  const connect = async () => {\n    if (!open || open.phase !== 'ask') return\n    const tid = open.id\n    setOpen({ id: tid, phase: 'busy' })\n    await Promise.all([handed.current ? calls.current.onConnect?.(tid) : undefined, new Promise((r) => setTimeout(r, 1000))])\n    setConnected((s) => new Set(s).add(tid))\n    setOpen({ id: tid, phase: 'done' })\n  }\n  useEffect(() => {\n    if (open?.phase !== 'done') return\n    const t = setTimeout(() => {\n      held.current = false\n      setOpen(null)\n    }, 1300)\n    return () => clearTimeout(t)\n  }, [open])\n\n  const latestConnect = useRef(connect)\n  useLayoutEffect(() => {\n    latestConnect.current = connect\n  })\n  const director = useDirector(\n    async (wait, pass) => {\n      if (pass > 0) setConnected(new Set(integrations.filter((t) => t.connected).map((t) => t.id)))\n      await wait(3200)\n      for (const tid of ['intercom', 'hubspot']) {\n        if (!integrations.some((t) => t.id === tid)) continue\n        ask(tid)\n        await wait(1900)\n        await latestConnect.current()\n        await wait(4600)\n      }\n      await wait(4000)\n    },\n    autoplay,\n    () => {\n      handed.current = true\n    },\n  )\n  const local = (e: { clientX: number; clientY: number }) => {\n    const r = box.current!.getBoundingClientRect()\n    const k = r.width / W\n    return { x: (e.clientX - r.left) / k, y: (e.clientY - r.top) / k }\n  }\n  const chipAt = (p: { x: number; y: number }) => {\n    const r = [0, 1, 2].find((q) => p.y >= rowY(q) && p.y <= rowY(q) + rowH)\n    if (r === undefined) return null\n    const rel = p.x - offset(r)\n    if (mod(rel, step) > chipW) return null\n    return rows[r][mod(Math.floor(rel / step), rows[r].length)]\n  }\n  useLayoutEffect(() => {\n    width.current = W\n    pick.current = () => {\n      if (performance.now() - pressed.current.t >= 500) return\n      const t = chipAt(pressed.current)\n      if (t) {\n        tap()\n        ask(t.id)\n      }\n    }\n  })\n  const down = (e: ReactPointerEvent<HTMLDivElement>) => {\n    if (e.button !== 0) return\n    if (open) {\n      if (open.phase !== 'busy') close()\n      return\n    }\n    pressed.current = { ...local(e), t: performance.now() }\n    drag.onPointerDown(e)\n  }\n  const move = (e: ReactPointerEvent<HTMLDivElement>) => {\n    const p = local(e)\n    light.current.tx = Math.max(-1, Math.min(1, (p.x - W / 2) / (W / 2)))\n    light.current.ty = Math.max(-1, Math.min(1, (p.y - H / 2) / (H / 2)))\n    drag.onPointerMove(e)\n  }\n  const up = (e: ReactPointerEvent<HTMLDivElement>) => {\n    pressed.current = { ...pressed.current, ...local(e) }\n    drag.onPointerUp(e)\n  }\n  const key = (e: ReactKeyboardEvent) => {\n    if (open) {\n      if (e.key === 'Escape') {\n        e.preventDefault()\n        close()\n      }\n      return\n    }\n    if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {\n      e.preventDefault()\n      bring(W / 2 + (e.key === 'ArrowRight' ? step : -step))\n    } else if (e.key === 'Enter' || e.key === ' ') {\n      e.preventDefault()\n      ask(focused.current)\n    }\n  }\n\n  const asked = open ? integrations.find((t) => t.id === open.id) : null\n  const tool = asked ?? integrations.find((t) => t.id === focus) ?? integrations[0]\n  const swap = {\n    initial: { opacity: 0, y: reduce ? 0 : 6 },\n    animate: { opacity: 1, y: 0 },\n    exit: { opacity: 0, y: reduce ? 0 : -6, transition: { duration: dur.exit, ease: ease.out } },\n  }\n  const pw = Math.min(400, W - 32)\n\n  const row = (r: number, glass: boolean) => {\n    const list = rows[r]\n    const len = list.length * step\n    const times = Math.ceil((W + len * 2) / len)\n    return Array.from({ length: times }, (_, k) =>\n      list.map((t, i) => {\n        const x = k * len + i * step\n        const up = glass ? -rowH * 0.1 : 0\n        const on = connected.has(t.id)\n        return (\n          <g key={`${k}-${t.id}`} transform={`translate(${x} 0)`}>\n            <rect x={0.5} y={0.5} width={chipW - 1} height={rowH - 1} rx={rowH * 0.24} fill=\"var(--dt-card)\" stroke=\"var(--line)\" />\n            <path d={t.mark} transform={`translate(${chipW / 2 - mark / 2} ${rowH / 2 - mark / 2 + up}) scale(${mark / 24})`} style={{ fill: glass || on ? markFill(t.color) : 'var(--ink)' }} opacity={glass || on ? 1 : 0.36} />\n            {glass && (\n              <text x={chipW / 2} y={rowH / 2 + mark / 2 + up + rowH * 0.2} textAnchor=\"middle\" fontSize={rowH * 0.145} fontWeight={500} fill=\"var(--ink)\" fillOpacity={0.78} letterSpacing=\"-0.01em\">\n                {t.name}\n              </text>\n            )}\n            {on && (\n              <g transform={`translate(${chipW - rowH * 0.2} ${rowH * 0.2})`}>\n                <circle r={rowH * 0.085} fill=\"var(--ok)\" />\n                <path d=\"M -2.6 0.1 L -0.8 1.9 L 2.7 -1.7\" fill=\"none\" stroke=\"white\" strokeWidth={1.5} strokeLinecap=\"round\" strokeLinejoin=\"round\" transform={`scale(${rowH / 70})`} />\n              </g>\n            )}\n          </g>\n        )\n      }),\n    )\n  }\n\n  return (\n    <div className={`pro-app @container h-full w-full overflow-y-auto overflow-x-hidden bg-surface text-ink [scrollbar-width:thin] ${className}`} style={accentVars(accent)} onPointerDownCapture={director.onPointerDownCapture} onPointerUpCapture={director.onPointerUpCapture} onKeyDownCapture={director.onKeyDownCapture}>\n      <div className=\"flex min-h-full items-center\">\n        <section className=\"mx-auto w-full max-w-[1180px] px-5 py-14 text-center @3xl:px-8 @3xl:py-20\">\n          <h2 className=\"text-[clamp(30px,4.6cqi,52px)] font-normal leading-[1.04] tracking-[-0.045em] text-ink\">\n            {title[0]}\n            <span className=\"block text-[color-mix(in_oklch,var(--ink)_42%,transparent)]\">{title[1]}</span>\n          </h2>\n          <p className=\"mx-auto mt-5 max-w-[480px] text-callout leading-[1.55] text-ink-2\">{subline}</p>\n          <p className=\"mt-5 inline-flex h-7 items-center gap-2 rounded-full bg-surface-2 px-3 text-footnote text-ink-2 shadow-[inset_0_0_0_1px_var(--line)]\">\n            <span className=\"size-1.5 rounded-full bg-[var(--ok)]\" />\n            <span className=\"tnum font-medium text-ink\">\n              <Count value={connected.size} duration={0.5} />\n            </span>\n            of {integrations.length} connected\n          </p>\n\n          <div\n            ref={box}\n            tabIndex={0}\n            role=\"group\"\n            aria-label={`Integrations. ${tool.name} is under the glass. Arrow keys move the rows, Enter connects.`}\n            onKeyDown={key}\n            onPointerDown={down}\n            onPointerMove={move}\n            onPointerUp={up}\n            onPointerCancel={drag.onPointerCancel}\n            onFocus={() => (hover.current = true)}\n            onBlur={() => (hover.current = false)}\n            onPointerEnter={() => (hover.current = true)}\n            onPointerLeave={(e) => {\n              hover.current = false\n              light.current.tx = 0\n              light.current.ty = 0\n              up(e)\n            }}\n            className={`ring-focus relative -mx-5 mt-8 touch-pan-y select-none rounded-[20px] @3xl:mx-0 @3xl:mt-10 ${open ? '' : 'cursor-grab active:cursor-grabbing'}`}\n            style={{ height: H }}\n          >\n            <svg aria-hidden width={W} height={H} viewBox={`0 0 ${W} ${H}`} className=\"absolute inset-0 block\" style={{ maskImage: 'linear-gradient(to right, transparent, black 12%, black 88%, transparent)', WebkitMaskImage: 'linear-gradient(to right, transparent, black 12%, black 88%, transparent)' }}>\n              <defs>\n                <clipPath id={`${id}-clip`}>\n                  <rect x={-Gw / 2} y={-Gh / 2} width={Gw} height={Gh} rx={Gh / 2} />\n                </clipPath>\n                <filter id={`${id}-soft`} x=\"-50%\" y=\"-50%\" width=\"200%\" height=\"200%\">\n                  <feGaussianBlur stdDeviation={Math.max(3, Gh * 0.1)} />\n                </filter>\n                <filter id={`${id}-edge`} x=\"-50%\" y=\"-50%\" width=\"200%\" height=\"200%\">\n                  <feGaussianBlur stdDeviation={1.6} />\n                </filter>\n                <filter id={`${id}-glass`} filterUnits=\"userSpaceOnUse\" primitiveUnits=\"userSpaceOnUse\" x={-Gw / 2 - pad} y={-Gh / 2 - pad} width={Gw + pad * 2} height={Gh + pad * 2} colorInterpolationFilters=\"sRGB\">\n                  <feImage href={map} x={-Gw / 2 - pad} y={-Gh / 2 - pad} width={Gw + pad * 2} height={Gh + pad * 2} preserveAspectRatio=\"none\" result=\"map\" />\n                  <feDisplacementMap in=\"SourceGraphic\" in2=\"map\" scale={Gh * 0.27} xChannelSelector=\"R\" yChannelSelector=\"G\" result=\"r0\" />\n                  <feDisplacementMap in=\"SourceGraphic\" in2=\"map\" scale={Gh * 0.278} xChannelSelector=\"R\" yChannelSelector=\"G\" result=\"g0\" />\n                  <feDisplacementMap in=\"SourceGraphic\" in2=\"map\" scale={Gh * 0.286} xChannelSelector=\"R\" yChannelSelector=\"G\" result=\"b0\" />\n                  <feColorMatrix in=\"r0\" type=\"matrix\" values=\"1 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1 0\" result=\"r\" />\n                  <feColorMatrix in=\"g0\" type=\"matrix\" values=\"0 0 0 0 0  0 1 0 0 0  0 0 0 0 0  0 0 0 1 0\" result=\"g\" />\n                  <feColorMatrix in=\"b0\" type=\"matrix\" values=\"0 0 0 0 0  0 0 0 0 0  0 0 1 0 0  0 0 0 1 0\" result=\"b\" />\n                  <feBlend in=\"r\" in2=\"g\" mode=\"screen\" result=\"rg\" />\n                  <feBlend in=\"rg\" in2=\"b\" mode=\"screen\" />\n                </filter>\n                <radialGradient id={`${id}-glint`} cx=\"0.5\" cy=\"0\" r=\"0.8\">\n                  <stop offset=\"0\" stopColor=\"white\" stopOpacity={0.8} />\n                  <stop offset=\"1\" stopColor=\"white\" stopOpacity={0} />\n                </radialGradient>\n                <linearGradient id={`${id}-rim`} ref={rim} x1=\"0\" y1=\"0.5\" x2=\"1\" y2=\"0.5\">\n                  <stop offset=\"0\" stopColor=\"white\" stopOpacity={0.95} />\n                  <stop offset=\"0.35\" stopColor=\"white\" stopOpacity={0.06} />\n                  <stop offset=\"0.65\" stopColor=\"white\" stopOpacity={0.06} />\n                  <stop offset=\"1\" stopColor=\"white\" stopOpacity={0.55} />\n                </linearGradient>\n              </defs>\n\n              {[0, 1, 2].map((r) => (\n                <g\n                  key={r}\n                  transform={`translate(${-rows[r].length * step} ${rowY(r)})`}\n                  ref={(el) => {\n                    base.current[r] = el\n                  }}\n                >\n                  {row(r, false)}\n                </g>\n              ))}\n\n              <g ref={lens} transform={`translate(${W / 2} ${H / 2})`} className=\"transition-opacity ease-detent duration-300\" opacity={open ? 0 : 1}>\n                <rect x={-Gw / 2 + Gh * 0.08} y={-Gh / 2 + Gh * 0.16} width={Gw - Gh * 0.16} height={Gh} rx={Gh / 2} fill=\"black\" opacity={0.17} filter={`url(#${id}-soft)`} />\n                <g clipPath={`url(#${id}-clip)`}>\n                  <g filter={`url(#${id}-glass)`}>\n                    <rect x={-Gw / 2 - pad} y={-Gh / 2 - pad} width={Gw + pad * 2} height={Gh + pad * 2} fill=\"var(--surface)\" />\n                    <g ref={copy} transform={`scale(${M}) translate(${-W / 2} ${-H / 2})`}>\n                      {[0, 1, 2].map((r) => (\n                        <g\n                          key={r}\n                          transform={`translate(${-rows[r].length * step} ${rowY(r)})`}\n                          ref={(el) => {\n                            lit.current[r] = el\n                          }}\n                        >\n                          {row(r, true)}\n                        </g>\n                      ))}\n                    </g>\n                  </g>\n                  <rect x={-Gw / 2} y={-Gh / 2} width={Gw} height={Gh} rx={Gh / 2} fill=\"white\" opacity={0.05} />\n                  <ellipse ref={glint} cy={-Gh * 0.36} rx={Gw * 0.4} ry={Gh * 0.24} fill={`url(#${id}-glint)`} className=\"opacity-55 dark:opacity-15\" />\n                  <rect x={-Gw / 2 + 1.5} y={-Gh / 2 + 1.5} width={Gw - 3} height={Gh - 3} rx={Gh / 2 - 1.5} fill=\"none\" stroke=\"black\" strokeOpacity={0.1} strokeWidth={3} filter={`url(#${id}-edge)`} />\n                </g>\n                <rect x={-Gw / 2 + 0.75} y={-Gh / 2 + 0.75} width={Gw - 1.5} height={Gh - 1.5} rx={Gh / 2 - 0.75} fill=\"none\" stroke={`url(#${id}-rim)`} strokeWidth={1.5} />\n                <rect x={-Gw / 2 - 0.5} y={-Gh / 2 - 0.5} width={Gw + 1} height={Gh + 1} rx={Gh / 2 + 0.5} fill=\"none\" stroke=\"var(--ink)\" strokeOpacity={0.13} />\n              </g>\n            </svg>\n\n            <AnimatePresence>\n              {asked && open && (\n                <motion.div\n                  key=\"panel\"\n                  role=\"dialog\"\n                  aria-label={`Connect ${asked.name}`}\n                  onPointerDown={(e) => e.stopPropagation()}\n                  className=\"absolute left-1/2 top-1/2 z-10 overflow-hidden text-left shadow-[0_0_0_1px_var(--line),inset_0_1px_0_light-dark(rgb(255_255_255/0.85),rgb(255_255_255/0.08)),0_30px_60px_-28px_rgb(0_0_0/0.4)] [-webkit-backdrop-filter:blur(18px)_saturate(1.6)] [backdrop-filter:blur(18px)_saturate(1.6)]\"\n                  style={{ x: '-50%', y: '-50%', background: 'color-mix(in oklch, var(--surface) 62%, transparent)' }}\n                  initial={{ width: Gw, height: Gh, borderRadius: Gh / 2, opacity: 0.4 }}\n                  animate={{ width: pw, height: 'auto', borderRadius: 26, opacity: 1 }}\n                  exit={{ width: Gw, height: Gh, borderRadius: Gh / 2, opacity: 0, transition: spring.move }}\n                  transition={spring.move}\n                >\n                  <motion.div initial={{ opacity: 0 }} animate={{ opacity: 1, transition: { duration: dur.enter, ease: ease.out, delay: 0.12 } }} exit={{ opacity: 0, transition: { duration: dur.exit, ease: ease.out } }} className=\"p-5\" style={{ width: pw }}>\n                    <div className=\"flex items-center gap-3\">\n                      <span className=\"flex size-11 shrink-0 items-center justify-center rounded-[12px] bg-[var(--dt-card)] shadow-[0_0_0_1px_var(--line),0_1px_2px_rgb(0_0_0/0.06)]\">\n                        <Mark path={asked.mark} size={21} color={asked.color} />\n                      </span>\n                      <div className=\"min-w-0\">\n                        <p className=\"truncate text-callout font-medium leading-5 text-ink\">{asked.name}</p>\n                        <p className=\"truncate text-footnote text-ink-3\">{asked.kind}</p>\n                      </div>\n                    </div>\n                    <p className=\"mt-4 text-footnote leading-[1.55] text-ink-2\">\n                      <span className=\"font-medium text-ink\">{product}</span> {asked.does}\n                    </p>\n                    <ul className=\"mt-4 flex flex-col gap-2 border-t border-[var(--line)] pt-4\">\n                      {(asked.access ?? ACCESS[asked.kind] ?? []).map((a) => (\n                        <li key={a} className=\"flex items-center gap-2 text-footnote text-ink-2\">\n                          <Check size={13} className=\"shrink-0 text-ink-3\" />\n                          {a}\n                        </li>\n                      ))}\n                    </ul>\n                    <div className=\"mt-5 flex h-9 items-center justify-end gap-2\">\n                      {open.phase === 'done' ? (\n                        <span className=\"flex items-center gap-1.5 text-footnote font-medium text-[color-mix(in_oklch,var(--ok)_72%,var(--ink))]\">\n                          <DrawnCheck size={13} />\n                          {asked.name} is connected\n                        </span>\n                      ) : connected.has(asked.id) ? (\n                        <>\n                          <span className=\"mr-auto flex items-center gap-1.5 text-footnote text-[color-mix(in_oklch,var(--ok)_72%,var(--ink))]\">\n                            <Check size={13} /> Connected\n                          </span>\n                          <button type=\"button\" onClick={close} className={btn.secondary} ref={takeFocus}>\n                            Done\n                          </button>\n                        </>\n                      ) : (\n                        <>\n                          <button type=\"button\" onClick={close} className={btn.ghost} disabled={open.phase === 'busy'}>\n                            Not now\n                          </button>\n                          <button type=\"button\" onClick={() => void connect()} className={`${btn.primary} min-w-[104px]`} disabled={open.phase === 'busy'} ref={takeFocus}>\n                            {open.phase === 'busy' ? <Spinner size={13} /> : `Connect ${asked.name.split(' ')[0]}`}\n                          </button>\n                        </>\n                      )}\n                    </div>\n                  </motion.div>\n                </motion.div>\n              )}\n            </AnimatePresence>\n          </div>\n\n          <div className=\"mx-auto mt-8 grid min-h-[48px] max-w-[540px] @3xl:mt-10\" aria-live=\"polite\">\n            <AnimatePresence initial={false} mode=\"popLayout\">\n              <motion.p key={tool.id} {...swap} transition={spring.snappy} className=\"col-start-1 row-start-1 text-footnote leading-[1.6] text-ink-2\">\n                <span className=\"font-medium text-ink\">{tool.name}</span>\n                <span className=\"text-ink-3\"> · {connected.has(tool.id) ? 'Connected' : tool.kind} · </span>\n                {product} {tool.does}\n              </motion.p>\n            </AnimatePresence>\n          </div>\n\n          <a href={more.href} className=\"ring-focus group mt-6 inline-flex items-center gap-1.5 rounded-[6px] text-footnote font-medium text-[var(--dt-accent-ink)]\">\n            {more.label}\n            <ArrowRight size={13} className=\"transition-transform ease-detent group-hover:translate-x-0.5\" />\n          </a>\n        </section>\n      </div>\n    </div>\n  )\n}\n"},{"path":"components/detent/blocks/integrations/content.ts","target":"components/detent/blocks/integrations/content.ts","type":"registry:block","content":"import {\n  siAirtable,\n  siBigcommerce,\n  siCalendly,\n  siConfluence,\n  siDiscord,\n  siGithub,\n  siGmail,\n  siGooglemeet,\n  siGoogledrive,\n  siGooglesheets,\n  siHelpscout,\n  siHubspot,\n  siIntercom,\n  siJira,\n  siLinear,\n  siMailchimp,\n  siMessenger,\n  siNotion,\n  siPaypal,\n  siShopify,\n  siStripe,\n  siTelegram,\n  siWhatsapp,\n  siZendesk,\n} from 'simple-icons'\n\nexport type Integration = {\n  id: string\n  name: string\n  kind: string\n  does: string\n  mark: string\n  color: string\n  access?: string[]\n  connected?: boolean\n}\n\nexport const ACCESS: Record<string, string[]> = {\n  'Help desk': ['Read tickets, macros and customers', 'Reply, tag and hand over to your team'],\n  'Live chat': ['Read conversations in Messenger', 'Reply and pass threads to your team'],\n  Messaging: ['Read messages sent to your account', 'Reply as your business'],\n  Email: ['Read your support inbox', 'Draft replies, and send the ones you allow'],\n  Community: ['Read the help channels you choose', 'Reply and open threads'],\n  Calls: ['Join calls it’s invited to', 'Write up notes and next steps'],\n  Scheduling: ['See your team’s availability', 'Book calls on their calendars'],\n  'Email marketing': ['Look up subscribers', 'Change their subscriptions'],\n  Database: ['Read the bases you share with it', 'Add and update rows'],\n  Store: ['Read orders, products and customers', 'Change addresses and start returns'],\n  Payments: ['Read charges and customers', 'Refund up to the limit you set'],\n  CRM: ['Read contacts and deals', 'Log conversations and notes'],\n  Spreadsheets: ['Open the sheets you share with it', 'Add rows'],\n  Docs: ['Read the pages you share with it', 'Comment when one looks out of date'],\n  Files: ['Read the folders you share with it'],\n  Issues: ['Read issues and where they stand', 'File and update issues'],\n  Code: ['Read issues and releases'],\n}\n\nconst hex = (s: { hex: string }) => `#${s.hex}`\n\nexport const INTEGRATIONS: Integration[] = [\n  {\n    id: 'zendesk',\n    name: 'Zendesk',\n    kind: 'Help desk',\n    does: 'answers new tickets in your macros’ voice, and hands the hard ones to a person with the thread summed up.',\n    mark: siZendesk.path,\n    color: hex(siZendesk),\n    connected: true,\n  },\n  {\n    id: 'intercom',\n    name: 'Intercom',\n    kind: 'Live chat',\n    does: 'takes the first reply in Messenger, and passes the conversation on already summarised.',\n    mark: siIntercom.path,\n    color: '#1f8ded',\n  },\n  {\n    id: 'helpscout',\n    name: 'Help Scout',\n    kind: 'Help desk',\n    does: 'replies in your shared inbox the way your team would, and leaves a note when it hands one over.',\n    mark: siHelpscout.path,\n    color: hex(siHelpscout),\n  },\n  {\n    id: 'whatsapp',\n    name: 'WhatsApp',\n    kind: 'Messaging',\n    does: 'answers customers where they already message you, in the language they wrote in.',\n    mark: siWhatsapp.path,\n    color: hex(siWhatsapp),\n  },\n  {\n    id: 'messenger',\n    name: 'Messenger',\n    kind: 'Messaging',\n    does: 'picks up messages to your page within seconds, at three in the morning as much as at noon.',\n    mark: siMessenger.path,\n    color: hex(siMessenger),\n  },\n  {\n    id: 'telegram',\n    name: 'Telegram',\n    kind: 'Messaging',\n    does: 'runs your support bot, with the same answers and the same limits as everywhere else.',\n    mark: siTelegram.path,\n    color: hex(siTelegram),\n  },\n  {\n    id: 'gmail',\n    name: 'Gmail',\n    kind: 'Email',\n    does: 'drafts replies in your support inbox for a person to send, and sends the easy ones itself.',\n    mark: siGmail.path,\n    color: hex(siGmail),\n  },\n  {\n    id: 'discord',\n    name: 'Discord',\n    kind: 'Community',\n    does: 'answers in your community’s help channel, and pulls in a person when it turns out to be a bug.',\n    mark: siDiscord.path,\n    color: hex(siDiscord),\n  },\n  {\n    id: 'googlemeet',\n    name: 'Google Meet',\n    kind: 'Calls',\n    does: 'sits in on support calls to take notes, and writes up what was agreed before the call ends.',\n    mark: siGooglemeet.path,\n    color: hex(siGooglemeet),\n  },\n  {\n    id: 'calendly',\n    name: 'Calendly',\n    kind: 'Scheduling',\n    does: 'books time with the right person when a conversation needs a call, not another message.',\n    mark: siCalendly.path,\n    color: hex(siCalendly),\n  },\n  {\n    id: 'mailchimp',\n    name: 'Mailchimp',\n    kind: 'Email marketing',\n    does: 'unsubscribes, resubscribes and fixes preferences the moment a customer asks.',\n    mark: siMailchimp.path,\n    color: hex(siMailchimp),\n  },\n  {\n    id: 'airtable',\n    name: 'Airtable',\n    kind: 'Database',\n    does: 'reads and updates the tables your team already runs on, like claims and replacements.',\n    mark: siAirtable.path,\n    color: hex(siAirtable),\n  },\n  {\n    id: 'shopify',\n    name: 'Shopify',\n    kind: 'Store',\n    does: 'looks up orders, changes an address before it ships, and starts a return without a form.',\n    mark: siShopify.path,\n    color: hex(siShopify),\n    connected: true,\n  },\n  {\n    id: 'bigcommerce',\n    name: 'BigCommerce',\n    kind: 'Store',\n    does: 'finds orders, tracks parcels and starts exchanges on BigCommerce stores.',\n    mark: siBigcommerce.path,\n    color: hex(siBigcommerce),\n  },\n  {\n    id: 'stripe',\n    name: 'Stripe',\n    kind: 'Payments',\n    does: 'refunds inside the limits you set, and says why on the customer’s receipt.',\n    mark: siStripe.path,\n    color: hex(siStripe),\n    connected: true,\n  },\n  {\n    id: 'paypal',\n    name: 'PayPal',\n    kind: 'Payments',\n    does: 'issues PayPal refunds inside your limits, and tells the customer when to expect them.',\n    mark: siPaypal.path,\n    color: hex(siPaypal),\n  },\n  {\n    id: 'hubspot',\n    name: 'HubSpot',\n    kind: 'CRM',\n    does: 'logs every conversation to the contact, along with anything that was promised.',\n    mark: siHubspot.path,\n    color: hex(siHubspot),\n  },\n  {\n    id: 'googlesheets',\n    name: 'Google Sheets',\n    kind: 'Spreadsheets',\n    does: 'keeps a running sheet of what it did, for the people who reconcile it.',\n    mark: siGooglesheets.path,\n    color: hex(siGooglesheets),\n  },\n  {\n    id: 'notion',\n    name: 'Notion',\n    kind: 'Docs',\n    does: 'learns from your help pages and policies, and flags the ones that have gone out of date.',\n    mark: siNotion.path,\n    color: hex(siNotion),\n  },\n  {\n    id: 'confluence',\n    name: 'Confluence',\n    kind: 'Docs',\n    does: 'answers from your Confluence pages, and says which page every answer came from.',\n    mark: siConfluence.path,\n    color: hex(siConfluence),\n  },\n  {\n    id: 'googledrive',\n    name: 'Google Drive',\n    kind: 'Files',\n    does: 'reads the manuals, price lists and PDFs in your shared drive.',\n    mark: siGoogledrive.path,\n    color: hex(siGoogledrive),\n  },\n  {\n    id: 'linear',\n    name: 'Linear',\n    kind: 'Issues',\n    does: 'files the bugs customers run into, with their own words and how many it affects.',\n    mark: siLinear.path,\n    color: hex(siLinear),\n  },\n  {\n    id: 'jira',\n    name: 'Jira',\n    kind: 'Issues',\n    does: 'files bugs for teams on Jira: one issue for each bug, not one for every complaint.',\n    mark: siJira.path,\n    color: hex(siJira),\n  },\n  {\n    id: 'github',\n    name: 'GitHub',\n    kind: 'Code',\n    does: 'checks that a fix has actually shipped before telling anyone it’s fixed.',\n    mark: siGithub.path,\n    color: hex(siGithub),\n  },\n]\n"},{"path":"components/detent/ui/Count.tsx","target":"components/detent/ui/Count.tsx","type":"registry:block","content":"'use client'\n\nimport { useEffect, useState } from 'react'\nimport { animate, useMotionValue, useMotionValueEvent } from 'motion/react'\nimport { ease } from '@/components/detent/lib/motion'\n\nexport function Count({ value, format = (n) => String(Math.round(n)), duration = 0.7 }: { value: number; format?: (n: number) => string; duration?: number }) {\n  const mv = useMotionValue(value)\n  const [text, setText] = useState(() => format(value))\n  useMotionValueEvent(mv, 'change', (v) => setText(format(v)))\n  useEffect(() => {\n    const c = animate(mv, value, { duration, ease: ease.out })\n    return () => c.stop()\n  }, [value, mv, duration])\n  return <span className=\"tnum\">{text}</span>\n}\n"},{"path":"components/detent/blocks/kit/props.tsx","target":"components/detent/blocks/kit/props.tsx","type":"registry:block","content":"'use client'\n\nimport { createContext, useContext } from 'react'\nimport type { CSSProperties } from 'react'\n\nexport type BlockProps = {\n  autoplay?: boolean\n  accent?: string\n  className?: string\n}\n\nexport const Names = createContext({ assistant: 'Detent', product: 'Detent' })\nexport const useNames = () => useContext(Names)\n\nexport const handle = (s: string) => s.toLowerCase().replace(/[^a-z0-9]+/g, '-')\n\nexport function accentVars(accent?: string): CSSProperties | undefined {\n  if (!accent) return undefined\n  return {\n    ['--dt-accent' as string]: accent,\n    ['--dt-accent-ink' as string]: `light-dark(color-mix(in oklch, ${accent} 82%, black), color-mix(in oklch, ${accent} 60%, white))`,\n  }\n}\n"},{"path":"components/detent/lib/detent.ts","target":"components/detent/lib/detent.ts","type":"registry:block","content":"import { useLayoutEffect, useState } from 'react'\nimport type { KeyboardEvent, PointerEvent as ReactPointerEvent } from 'react'\nimport { useReducedMotion } from 'motion/react'\n\nexport const clamp = (n: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, n))\nexport const lerp = (a: number, b: number, t: number) => a + (b - a) * t\nexport const glide = (a: number, b: number, t: number) => (a > 0 && b > 0 ? a * Math.pow(b / a, t) : lerp(a, b, t))\n\nexport const notched = (x: number, centres: number[], reach: number, hold = 0.7) => {\n  for (const c of centres) {\n    const d = (x - c) / reach\n    if (Math.abs(d) < 1) return x - ((hold * reach) / Math.PI) * Math.sin(Math.PI * d) * ((1 + Math.cos(Math.PI * d)) / 2)\n  }\n  return x\n}\n\nexport const at = (list: number[], i: number, mix = lerp) => {\n  const a = clamp(Math.floor(i), 0, list.length - 1)\n  return mix(list[a], list[Math.min(list.length - 1, a + 1)], clamp(i - a, 0, 1))\n}\n\nexport type Spring = { w: number; z: number }\nexport type Body = { x: number; v: number }\n\nexport function springStep(b: Body, target: number, { w, z }: Spring, dt: number) {\n  const a = b.x - target\n  if (z >= 1) {\n    const e = Math.exp(-w * dt)\n    const k = b.v + w * a\n    b.x = target + (a + k * dt) * e\n    b.v = (b.v - k * w * dt) * e\n    return b\n  }\n  const wd = w * Math.sqrt(1 - z * z)\n  const e = Math.exp(-z * w * dt)\n  const c = Math.cos(wd * dt)\n  const s = Math.sin(wd * dt)\n  const B = (b.v + z * w * a) / wd\n  b.x = target + e * (a * c + B * s)\n  b.v = e * ((B * wd - z * w * a) * c - (a * wd + z * w * B) * s)\n  return b\n}\n\nconst still = (b: Body, target: number, eps: number) => Math.abs(b.x - target) < eps && Math.abs(b.v) < eps * 12\n\nconst rubber = (d: number, reach: number, s: number) => reach * (1 - 1 / (1 + (s * d) / reach))\n\nfunction tracker(window = 90) {\n  const samples: [number, number][] = []\n  return {\n    clear: () => (samples.length = 0),\n    add(t: number, x: number) {\n      samples.push([t, x])\n      while (samples.length > 2 && t - samples[0][0] > window) samples.shift()\n    },\n    read(now: number) {\n      const n = samples.length\n      if (n < 2 || now - samples[n - 1][0] > 60) return 0\n      const mt = samples.reduce((s, p) => s + p[0], 0) / n\n      const mx = samples.reduce((s, p) => s + p[1], 0) / n\n      const num = samples.reduce((s, p) => s + (p[0] - mt) * (p[1] - mx), 0)\n      const den = samples.reduce((s, p) => s + (p[0] - mt) ** 2, 0)\n      return den > 0 ? (num / den) * 1000 : 0\n    },\n  }\n}\n\nexport const feedback = (() => {\n  let audio: AudioContext | null = null\n  let last = 0\n  let asked = false\n  let on = true\n  let cancel: (() => void) | null = null\n  let holding = false\n  const open = () => {\n    cancel = null\n    audio ??= new AudioContext()\n    if (asked && audio.state === 'suspended') void audio.resume()\n  }\n  const warm = () => {\n    if (!on || audio || cancel || holding || typeof AudioContext === 'undefined') return\n    if (typeof requestIdleCallback === 'function') {\n      const id = requestIdleCallback(open, { timeout: 300 })\n      cancel = () => cancelIdleCallback(id)\n    } else {\n      const id = setTimeout(open, 60)\n      cancel = () => clearTimeout(id)\n    }\n  }\n  const letGo = () => {\n    holding = false\n    removeEventListener('pointerup', letGo)\n    removeEventListener('pointercancel', letGo)\n    warm()\n  }\n  const play = (heavy: boolean, loud: number) => {\n    if (!audio) return\n    const t = audio.currentTime\n    const tone = audio.createOscillator()\n    const gain = audio.createGain()\n    tone.frequency.setValueAtTime(heavy ? 900 : 1500, t)\n    tone.frequency.exponentialRampToValueAtTime(heavy ? 240 : 420, t + 0.014)\n    gain.gain.setValueAtTime((heavy ? 0.034 : 0.02) * loud, t)\n    gain.gain.exponentialRampToValueAtTime(0.0001, t + (heavy ? 0.03 : 0.016))\n    tone.connect(gain).connect(audio.destination)\n    tone.start(t)\n    tone.stop(t + 0.034)\n  }\n  return {\n    set(next: boolean) {\n      on = next\n      if (on) return\n      cancel?.()\n      cancel = null\n      void audio?.suspend()\n    },\n    warm,\n    wake(grab = false) {\n      if (!on) return\n      asked = true\n      if (audio) {\n        if (audio.state === 'suspended') void audio.resume()\n      } else if (!grab) warm()\n      else if (!holding && typeof AudioContext !== 'undefined') {\n        cancel?.()\n        cancel = null\n        holding = true\n        addEventListener('pointerup', letGo)\n        addEventListener('pointercancel', letGo)\n      }\n    },\n    tick(heavy = false, speed = 1) {\n      if (!on || !asked) return\n      const now = performance.now()\n      if (now - last < 34) return\n      last = now\n      if (typeof navigator !== 'undefined' && 'vibrate' in navigator) navigator.vibrate(heavy ? 10 : 4)\n      if (!audio) return\n      const loud = 0.45 + 0.55 * clamp(speed, 0, 1)\n      if (audio.state === 'running') play(heavy, loud)\n      else void audio.resume().then(() => on && play(heavy, loud))\n    },\n  }\n})()\n\nexport type FrameInfo = {\n  dt: number\n  mode: Mode\n  live: boolean\n}\nexport type Mode = 'rest' | 'held' | 'coast' | 'settle' | 'sweep'\n\n/* a value, or a function read when the detent needs it, for values that live in a ref */\ntype Live<T> = T | (() => T)\nconst now = <T,>(v: Live<T>): T => (typeof v === 'function' ? (v as () => T)() : v)\n\nexport type DetentOptions = {\n  value: number\n  stops?: Live<number[]>\n  min?: number\n  max?: number\n  magnet?: number\n  reach?: number\n  throw?: number\n  spring?: Spring\n  catch?: Spring\n  muted?: boolean\n  reduce?: Live<boolean>\n  onFrame: (x: number, v: number, info: FrameInfo) => boolean | void\n  onStop?: (i: number) => void\n  onRest?: (x: number, i: number) => void\n}\n\nexport type Detent = ReturnType<typeof createDetent>\n\nconst SPRING: Spring = { w: 17, z: 0.92 }\nconst CATCH: Spring = { w: 24, z: 1 }\nconst MOMENTUM = 1\nconst SWIFT = 8\n\nexport function createDetent(read: () => DetentOptions) {\n  const init = read()\n  const body: Body = { x: init.value, v: 0 }\n  const residual: Body = { x: 0, v: 0 }\n  const track = tracker()\n  let mode: Mode = 'rest'\n  let hand = init.value\n  let target = init.value\n  let spring = SPRING\n  let friction = 4\n  let frame = 0\n  let then = 0\n  let feel = false\n  let stop = -1\n  let shown = init.value\n  let sweep = { from: 0, to: 0, t: 0, T: 1 }\n  let keyAt = 0\n\n  const span = () => {\n    const given = read()\n    const o = { ...given, stops: given.stops === undefined ? undefined : now(given.stops), reduce: given.reduce === undefined ? undefined : now(given.reduce) }\n    const s = o.stops\n    return { o, s, lo: o.min ?? s?.[0] ?? -Infinity, hi: o.max ?? s?.[s.length - 1] ?? Infinity, m: o.reduce ? 0 : o.magnet ?? 0, reach: o.reach ?? ((s && s.length > 1 ? s[1] - s[0] : 1) * 0.5) }\n  }\n\n  const out = (u: number) => {\n    const { s, lo, hi, m, reach } = span()\n    if (u < lo) return lo - rubber(lo - u, reach, 1 - m)\n    if (u > hi) return hi + rubber(u - hi, reach, 1 - m)\n    if (!s || s.length < 2 || !m) return u\n    let i = 0\n    while (i < s.length - 2 && u > s[i + 1]) i++\n    const t = (u - s[i]) / (s[i + 1] - s[i])\n    return s[i] + (s[i + 1] - s[i]) * (t - (m * Math.sin(2 * Math.PI * t)) / (2 * Math.PI))\n  }\n  const slope = (u: number) => {\n    const e = 1e-4\n    return (out(u + e) - out(u - e)) / (2 * e)\n  }\n  const nearest = (x: number) => {\n    const { s, lo, hi } = span()\n    if (!s?.length) return { i: -1, value: clamp(x, lo, hi) }\n    let i = 0\n    for (let k = 1; k < s.length; k++) if (Math.abs(s[k] - x) < Math.abs(s[i] - x)) i = k\n    return { i, value: s[i] }\n  }\n\n  const start = () => {\n    if (frame || typeof requestAnimationFrame === 'undefined') return\n    then = performance.now()\n    frame = requestAnimationFrame(loop)\n  }\n\n  const land = () => {\n    mode = 'rest'\n    body.x = target\n    body.v = 0\n    feel = false\n  }\n\n  const emit = (dt: number) => {\n    const { o } = span()\n    const x = out(body.x)\n    const v = slope(body.x) * body.v\n    shown = x\n    const n = nearest(x).i\n    if (n !== stop) {\n      if (stop >= 0) {\n        o.onStop?.(n)\n        if (feel && !o.muted) feedback.tick(false, Math.abs(v) / (gap() * SWIFT))\n      }\n      stop = n\n    }\n    return o.onFrame(x, v, { dt, mode, live: mode === 'held' || mode === 'coast' })\n  }\n\n  function advance(dt: number, now: number) {\n    const { o } = span()\n    if (mode === 'held' || mode === 'sweep') {\n      if (mode === 'sweep') {\n        sweep.t = Math.min(sweep.T, sweep.t + dt)\n        const p = sweep.t / sweep.T\n        const next = lerp(sweep.from, sweep.to, p * p * p * (p * (6 * p - 15) + 10))\n        body.v = dt > 0 ? (next - hand) / dt + residual.v : body.v\n        hand = next\n      }\n      springStep(residual, 0, o.catch ?? CATCH, dt)\n      body.x = hand + residual.x\n      if (mode === 'held') body.v = track.read(now) + residual.v\n      if (mode === 'sweep' && sweep.t >= sweep.T && still(residual, 0, 1e-3)) {\n        target = sweep.to\n        land()\n        return true\n      }\n      return false\n    }\n    if (mode === 'coast') {\n      const e = Math.exp(-friction * dt)\n      body.x += (body.v / friction) * (1 - e)\n      body.v *= e\n      const left = Math.abs(target - body.x)\n      if (left < coastEnd() || Math.abs(body.v) < 0.5 * coastEnd() || Math.sign(target - body.x) !== Math.sign(body.v)) mode = 'settle'\n      return false\n    }\n    if (mode === 'settle') {\n      springStep(body, target, spring, dt)\n      if (still(body, target, settleEps())) {\n        land()\n        return true\n      }\n    }\n    return false\n  }\n  const gap = () => {\n    const { s } = span()\n    return s && s.length > 1 ? (s[s.length - 1] - s[0]) / (s.length - 1) : 1\n  }\n  const landing = (s: Spring, v: number): Spring => (Math.abs(v) > gap() * MOMENTUM ? s : { ...s, z: 1 })\n  const coastEnd = () => gap() * 0.7\n  const settleEps = () => gap() * 0.0015\n\n  function loop(now: number) {\n    frame = 0\n    const dt = clamp((now - then) / 1000, 1 / 240, 0.05)\n    then = now\n    const was = mode\n    const landed = was !== 'rest' && advance(dt, now)\n    const more = emit(dt)\n    if (landed) {\n      const { o } = span()\n      o.onRest?.(out(body.x), nearest(out(body.x)).i)\n    }\n    if (mode !== 'rest' || more) frame = requestAnimationFrame(loop)\n  }\n\n  const launch = () => {\n    const away = target - body.x\n    if (Math.abs(away) > gap() * 1.6 && Math.sign(away) === Math.sign(body.v)) {\n      friction = clamp(Math.abs(body.v / away), 2.5, 9)\n      mode = 'coast'\n    } else mode = 'settle'\n    start()\n  }\n\n  const to = (value: number, opts: { spring?: Spring; instant?: boolean; velocity?: number; feel?: boolean } = {}) => {\n    const { o, lo, hi } = span()\n    target = clamp(value, lo, hi)\n    if (opts.velocity !== undefined) body.v = opts.velocity\n    feel = !!opts.feel\n    if (opts.instant || o.reduce) {\n      land()\n      emit(0)\n      o.onRest?.(target, nearest(target).i)\n      return\n    }\n    if (mode === 'held') {\n      body.x = hand + residual.x\n      residual.x = residual.v = 0\n    }\n    spring = opts.spring ?? landing(o.spring ?? SPRING, opts.velocity ?? 0)\n    mode = 'settle'\n    start()\n  }\n\n  const api = {\n    get: () => shown,\n    place: () => body.x + (mode === 'rest' ? 0 : body.v / (span().o.catch ?? CATCH).w),\n    velocity: () => slope(body.x) * body.v,\n    mode: () => mode,\n    target: () => target,\n    nearest,\n\n    set(value: number) {\n      body.x = target = hand = value\n      body.v = residual.x = residual.v = 0\n      mode = 'rest'\n      feel = false\n      stop = -1\n      emit(0)\n      stop = nearest(shown).i\n    },\n    to,\n\n    grab(place: number, { feel: touching = true }: { feel?: boolean } = {}) {\n      const { o } = span()\n      residual.x = o.reduce ? 0 : body.x - place\n      residual.v = o.reduce ? 0 : body.v\n      hand = place\n      track.clear()\n      track.add(performance.now(), place)\n      feel = touching\n      mode = 'held'\n      start()\n    },\n    drag(place: number) {\n      if (mode !== 'held') return\n      hand = place\n      track.add(performance.now(), place)\n    },\n    release({ flick = true, home }: { flick?: boolean; home?: number } = {}) {\n      if (mode !== 'held') return\n      const { o, lo, hi } = span()\n      const flung = flick ? track.read(performance.now()) : 0\n      body.x = hand + residual.x\n      body.v = flung + residual.v\n      residual.x = residual.v = 0\n      const rest = home ?? nearest(clamp(body.x + flung * (o.throw ?? 0.16), lo, hi)).value\n      target = rest\n      spring = landing(o.spring ?? SPRING, body.v)\n      if (o.reduce) {\n        to(rest)\n        return\n      }\n      launch()\n    },\n    fling(velocity: number) {\n      const { o, lo, hi } = span()\n      const rest = nearest(clamp(body.x + velocity * (o.throw ?? 0.16), lo, hi)).value\n      if (o.reduce) return to(rest)\n      residual.x = residual.v = 0\n      body.v = velocity\n      feel = false\n      target = rest\n      spring = o.spring ?? SPRING\n      launch()\n    },\n    sweep(value: number, ms: number) {\n      const { o } = span()\n      if (o.reduce) return to(value)\n      residual.x = 0\n      residual.v = body.v\n      hand = body.x\n      sweep = { from: body.x, to: value, t: 0, T: Math.max(0.05, ms / 1000) }\n      feel = false\n      mode = 'sweep'\n      start()\n    },\n    step(by: number, repeat = false) {\n      const { o, s, lo, hi } = span()\n      const now = performance.now()\n      const quick = repeat || now - keyAt < 110\n      keyAt = now\n      if (!o.muted) feedback.wake()\n      const from = mode === 'rest' ? body.x : target\n      const next = s ? s[clamp(nearest(from).i + by, 0, s.length - 1)] : clamp(from + by, lo, hi)\n      to(next, { instant: quick, feel: !quick })\n      return next\n    },\n    wake: start,\n    dispose() {\n      cancelAnimationFrame(frame)\n      frame = 0\n    },\n  }\n  return api\n}\n\nexport function useDetent(options: Omit<DetentOptions, 'reduce'>) {\n  const reduce = !!useReducedMotion()\n  // The detent reads options through a closure, refreshed after each commit.\n  const [[d, update]] = useState(() => {\n    let latest: DetentOptions = { ...options, reduce }\n    return [createDetent(() => latest), (next: DetentOptions) => (latest = next)] as const\n  })\n  useLayoutEffect(() => {\n    update({ ...options, reduce })\n  })\n  useLayoutEffect(() => () => d.dispose(), [d])\n  return d\n}\n\nexport type DragConfig = {\n  axis?: 'x' | 'y'\n  box: () => HTMLElement | null\n  units: Live<number>\n  absolute?: (fraction: number) => number\n  hover?: boolean\n  follow?: boolean\n  onTap?: (fraction: number) => void\n  onLeave?: () => void\n  onGrab?: () => void\n  release?: () => { flick?: boolean; home?: number }\n  muted?: boolean\n}\n\nconst SLOP = { mouse: 5, touch: 10 }\n\nexport function dragProps(d: Detent, read: () => DragConfig) {\n  let press: { id: number; px: number; py: number; from: number; moved: boolean; held: boolean; caught: boolean } | null = null\n  const place = (e: ReactPointerEvent) => {\n    const c = read()\n    const r = c.box()?.getBoundingClientRect()\n    if (!r) return null\n    const horizontal = (c.axis ?? 'x') === 'x'\n    const size = (horizontal ? r.width : r.height) || 1\n    const px = horizontal ? e.clientX : e.clientY\n    return { fraction: (px - (horizontal ? r.left : r.top)) / size, px, unit: size / now(c.units), c }\n  }\n  const hand = (e: ReactPointerEvent) => {\n    const p = place(e)\n    if (!p || !press) return null\n    return p.c.absolute && !press.caught ? p.c.absolute(p.fraction) : press.from + (p.px - ((p.c.axis ?? 'x') === 'x' ? press.px : press.py)) / p.unit\n  }\n  const take = (e: ReactPointerEvent) => {\n    if (!press) return\n    const at = hand(e)\n    if (at === null) return\n    press.held = true\n    read().onGrab?.()\n    d.grab(at)\n  }\n  const inFlight = () => d.mode() !== 'rest' && d.mode() !== 'held' && d.mode() !== 'sweep'\n  return {\n    onPointerDown(e: ReactPointerEvent) {\n      if (e.button) return\n      const c = read()\n      if (!c.muted) feedback.wake(true)\n      e.currentTarget.setPointerCapture?.(e.pointerId)\n      press = { id: e.pointerId, px: e.clientX, py: e.clientY, from: d.place(), moved: false, held: false, caught: inFlight() && !c.follow }\n      if (e.pointerType !== 'touch' || press.caught || !c.absolute) take(e)\n    },\n    onPointerMove(e: ReactPointerEvent) {\n      const c = read()\n      if (!c.muted && e.pointerType === 'mouse') feedback.warm()\n      if (press) {\n        if (e.pointerId !== press.id) return\n        if (!press.moved && Math.hypot(e.clientX - press.px, e.clientY - press.py) > (e.pointerType === 'touch' ? SLOP.touch : SLOP.mouse)) press.moved = true\n        if (!press.held && press.moved) take(e)\n        const at = hand(e)\n        if (at !== null && press.held) d.drag(at)\n        return\n      }\n      if (!c.hover || e.pointerType !== 'mouse' || (inFlight() && !c.follow)) return\n      const p = place(e)\n      if (!p || !c.absolute) return\n      const at = c.absolute(p.fraction)\n      if (d.mode() === 'held') d.drag(at)\n      else {\n        c.onGrab?.()\n        d.grab(at, { feel: false })\n      }\n    },\n    onPointerUp(e: ReactPointerEvent) {\n      if (!press || e.pointerId !== press.id) return\n      const { moved, held } = press\n      const p = place(e)\n      const c = read()\n      press = null\n      if (!moved && c.onTap && p) {\n        if (held) d.release({ flick: false, home: d.get() })\n        c.onTap(p.fraction)\n      } else if (held) d.release(c.release?.())\n    },\n    onPointerCancel(e: ReactPointerEvent) {\n      if (!press || e.pointerId !== press.id) return\n      const { held } = press\n      press = null\n      if (held) d.release({ flick: false })\n      read().onLeave?.()\n    },\n    onPointerLeave(e: ReactPointerEvent) {\n      if (press || e.pointerType !== 'mouse') return\n      const c = read()\n      if (!c.hover) return\n      if (d.mode() === 'held') d.release({ flick: false, home: d.get() })\n      c.onLeave?.()\n    },\n  }\n}\n\nexport const stepKey = (d: Detent, e: KeyboardEvent, keys: Record<string, number> = { ArrowLeft: -1, ArrowRight: 1 }) => {\n  const by = keys[e.key]\n  if (!by) return false\n  e.preventDefault()\n  d.step(by, e.repeat)\n  return true\n}\n\nconst COLUMN = 'display:inline-block;height:1.25em;overflow:hidden;vertical-align:top'\nconst STRIP = '0123456789'\n\nexport function createRoller(el: HTMLElement, format: (n: number) => string, pad = 0, built?: (columns: HTMLElement[]) => void) {\n  let shape = ''\n  let wheels: { strip: HTMLElement; col: HTMLElement }[] = []\n  let scale = 1\n\n  const build = (s: string, digits: number) => {\n    el.textContent = ''\n    wheels = []\n    const col = () => {\n      const c = document.createElement('span')\n      c.style.cssText = COLUMN\n      const strip = document.createElement('span')\n      strip.style.cssText = 'display:block;will-change:transform'\n      strip.innerHTML = [...STRIP, '0'].map((n) => `<span style=\"display:block;height:1.25em\">${n}</span>`).join('')\n      c.append(strip)\n      el.append(c)\n      wheels.push({ strip, col: c })\n    }\n    let padded = Math.max(0, pad - digits)\n    let leading = true\n    for (const ch of s) {\n      if (/\\d/.test(ch)) {\n        if (leading) for (; padded > 0; padded--) col()\n        leading = false\n        col()\n      } else {\n        const c = document.createElement('span')\n        c.textContent = ch\n        c.style.whiteSpace = 'pre'\n        el.append(c)\n      }\n    }\n    built?.([...el.children] as HTMLElement[])\n  }\n\n  return (value: number, speed = 0) => {\n    const s = format(value)\n    const digits = s.replace(/\\D/g, '')\n    const next = s.replace(/\\d/g, '0')\n    if (next !== shape) {\n      shape = next\n      build(s, digits.length)\n    }\n    const numeric = s.replace(/[^\\d.]/g, '').replace(/\\.$/, '')\n    const shownNumber = parseFloat(numeric)\n    const decimals = numeric.includes('.') ? numeric.length - numeric.indexOf('.') - 1 : 0\n    if (shownNumber > 0) scale = Math.abs(value) / shownNumber\n    const place = Math.pow(10, -decimals) * (scale || 1)\n    const q = Math.abs(value) / place\n    const free = clamp(Math.abs(speed) / (place * 6), 0, 1)\n    const count = wheels.length\n    const whole = digits.padStart(count, '0')\n    for (let k = 0; k < count; k++) {\n      const { strip, col } = wheels[count - 1 - k]\n      const unit = Math.pow(10, k)\n      const lower = q % unit\n      const carry = k === 0 ? q - Math.floor(q) : clamp(lower - (unit - 1), 0, 1)\n      const running = (Math.floor(q / unit) % 10) + carry\n      const digit = +whole[count - 1 - k]\n      const off = ((digit - running + 15) % 10) - 5\n      const pos = (running + off * (1 - free) + 10) % 10\n      strip.style.transform = `translateY(${(-pos * 100) / 11}%)`\n      if (pad) {\n        const higher = Math.floor(q / unit)\n        const fade = k === 0 ? 1 : higher > 0 ? 1 : clamp(lower - (unit - 1), 0, 1)\n        col.style.opacity = String(fade)\n      }\n    }\n  }\n}\n\nexport const write = (el: HTMLElement | null | undefined, text: string) => {\n  if (el && el.textContent !== text) el.textContent = text\n}\n"},{"path":"components/detent/lib/feel.ts","target":"components/detent/lib/feel.ts","type":"registry:block","content":"export const tap = () => {\n  if (typeof window !== 'undefined') window.dispatchEvent(new Event('detent:tap'))\n}\n\nlet keyed = true\nif (typeof window !== 'undefined') {\n  window.addEventListener('keydown', () => void (keyed = true), true)\n  window.addEventListener('pointerdown', () => void (keyed = false), true)\n}\nexport const byKey = () => keyed\n"},{"path":"components/detent/ui/Outcome.tsx","target":"components/detent/ui/Outcome.tsx","type":"registry:block","content":"'use client'\n\nimport { AnimatePresence, motion } from 'motion/react'\nimport { ease } from '@/components/detent/lib/motion'\n\nexport function Bloom({ k, color = 'var(--ok)', radius, spread = 12, delay = 0 }: { k: string | number | null; color?: string; radius: number | string; spread?: number; delay?: number }) {\n  if (k === null) return null\n  return <span key={k} aria-hidden className=\"bloom pointer-events-none absolute inset-0\" style={{ borderRadius: radius, animationDelay: `${delay}s`, ['--bloom' as string]: color, ['--bloom-spread' as string]: `${spread}px` }} />\n}\n\nexport function DrawnCheck({ size = 13, delay = 0.12, strokeWidth = 3 }: { size?: number; delay?: number; strokeWidth?: number }) {\n  return (\n    <svg aria-hidden width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={strokeWidth} strokeLinecap=\"round\" strokeLinejoin=\"round\">\n      <motion.path d=\"M5 12.5l4.5 4.5L19 7.5\" initial={{ pathLength: 0 }} animate={{ pathLength: 1 }} transition={{ duration: 0.32, ease: ease.out, delay }} />\n    </svg>\n  )\n}\n\nexport function Sweep({ k, color = 'var(--ok)', delay = 0, axis = 'x' }: { k: string | number | null; color?: string; delay?: number; axis?: 'x' | 'y' }) {\n  const across = axis === 'x'\n  const band = (deg: number) => `linear-gradient(${deg}deg, transparent 15%, color-mix(in oklch, ${color} 26%, transparent) 42%, color-mix(in oklch, ${color} 40%, rgb(255 255 255 / 0.5)) 50%, color-mix(in oklch, ${color} 26%, transparent) 58%, transparent 85%)`\n  return (\n    <span aria-hidden className=\"pointer-events-none absolute inset-0 overflow-hidden motion-reduce:hidden\" style={{ borderRadius: 'inherit' }}>\n      <AnimatePresence>\n        {k !== null && (\n          <motion.span\n            key={k}\n            className={across ? 'absolute inset-y-0 left-0 w-1/2' : 'absolute inset-x-0 top-0 h-1/2'}\n            style={{ background: band(across ? 100 : 180) }}\n            initial={across ? { x: '-110%' } : { y: '-110%' }}\n            animate={across ? { x: '230%' } : { y: '230%' }}\n            exit={{ opacity: 0 }}\n            transition={{ duration: across ? 0.85 : 0.9, ease: ease.inOut, delay }}\n          />\n        )}\n      </AnimatePresence>\n    </span>\n  )\n}\n"},{"path":"components/detent/ui/Spinner.tsx","target":"components/detent/ui/Spinner.tsx","type":"registry:block","content":"'use client'\n\nexport function Spinner({ size = 16, className = '' }: { size?: number; className?: string }) {\n  return (\n    <svg width={size} height={size} viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden className={`motion-safe:animate-spin ${className}`} style={{ animationDuration: '0.7s' }}>\n      <circle cx=\"8\" cy=\"8\" r=\"6.25\" stroke=\"currentColor\" strokeOpacity=\"0.22\" strokeWidth=\"1.75\" />\n      <path d=\"M14.25 8A6.25 6.25 0 0 0 8 1.75\" stroke=\"currentColor\" strokeWidth=\"1.75\" strokeLinecap=\"round\" />\n    </svg>\n  )\n}\n"},{"path":"components/detent/blocks/kit/icons.tsx","target":"components/detent/blocks/kit/icons.tsx","type":"registry:block","content":"import { useId } from 'react'\nimport type { SVGProps } from 'react'\n\ntype P = SVGProps<SVGSVGElement> & { size?: number }\n\nfunction Svg({ size = 18, children, ...rest }: P) {\n  return (\n    <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={1.5} strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden {...rest}>\n      {children}\n    </svg>\n  )\n}\n\nexport const Check = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M5 12.5l4.5 4.5L19 7.5\" />\n  </Svg>\n)\n\nexport const ChevronDown = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M6.5 9.5 12 15l5.5-5.5\" />\n  </Svg>\n)\n\nexport const ChevronRight = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M9.5 6.5 15 12l-5.5 5.5\" />\n  </Svg>\n)\n\nexport const ChevronLeft = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M14.5 6.5 9 12l5.5 5.5\" />\n  </Svg>\n)\n\nexport const Reset = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M4.5 12a7.5 7.5 0 1 0 2.2-5.3\" />\n    <path d=\"M4.5 4.5v4h4\" />\n  </Svg>\n)\n\nexport const Close = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M6.5 6.5l11 11M17.5 6.5l-11 11\" />\n  </Svg>\n)\n\nexport const Plus = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M12 5.5v13M5.5 12h13\" />\n  </Svg>\n)\n\nexport const Search = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"11\" cy=\"11\" r=\"6.25\" />\n    <path d=\"m15.75 15.75 3.75 3.75\" />\n  </Svg>\n)\n\nexport const Orbit = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M18.06 8.5A7 7 0 1 1 15.5 5.94\" />\n    <circle cx=\"16.95\" cy=\"7.05\" r=\"1.9\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Refresh = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M19.5 12a7.5 7.5 0 1 1-2.2-5.3\" />\n    <path d=\"M19.5 4.5v4h-4\" />\n  </Svg>\n)\n\nexport const Note = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"5\" y=\"3.5\" width=\"14\" height=\"17\" rx=\"2.5\" />\n    <path d=\"M8.75 8.5h6.5M8.75 12h6.5M8.75 15.5h3.5\" />\n  </Svg>\n)\n\nexport const FilePage = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M13.5 3.5H8A2.5 2.5 0 0 0 5.5 6v12A2.5 2.5 0 0 0 8 20.5h8a2.5 2.5 0 0 0 2.5-2.5V8.5Z\" />\n    <path d=\"M13.5 3.5v5h5\" />\n  </Svg>\n)\n\nexport const Copy = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"8.5\" y=\"8.5\" width=\"11\" height=\"11\" rx=\"2.5\" />\n    <path d=\"M15.5 8.5v-2a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h2\" />\n  </Svg>\n)\n\nexport const ArrowUp = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M12 19V5.5M6.5 11 12 5.5l5.5 5.5\" />\n  </Svg>\n)\n\nexport const ArrowRight = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M5 12h13.5M13 6.5l5.5 5.5-5.5 5.5\" />\n  </Svg>\n)\n\nexport const ArrowLeft = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M19 12H5.5M11 6.5 5.5 12l5.5 5.5\" />\n  </Svg>\n)\n\nexport const Return = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M18.5 5.5V11a3 3 0 0 1-3 3H5.5M10 9.5 5.5 14l4.5 4.5\" />\n  </Svg>\n)\n\nexport const ArrowUpRight = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M7.5 16.5l9-9M9 7.5h7.5V15\" />\n  </Svg>\n)\n\nexport const Pencil = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M11.5 4.5H7A2.5 2.5 0 0 0 4.5 7v10A2.5 2.5 0 0 0 7 19.5h10a2.5 2.5 0 0 0 2.5-2.5v-4.5\" />\n    <path d=\"M17.6 3.9a1.9 1.9 0 0 1 2.7 2.7l-7.8 7.8-3.5.8.8-3.5Z\" />\n  </Svg>\n)\n\nexport const Folder = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M3.5 7.5A2.5 2.5 0 0 1 6 5h3.4c.6 0 1.1.2 1.5.6l1.2 1.2c.4.4.9.6 1.5.6H18a2.5 2.5 0 0 1 2.5 2.5v6.6A2.5 2.5 0 0 1 18 19H6a2.5 2.5 0 0 1-2.5-2.5Z\" />\n  </Svg>\n)\n\nexport const Code = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M8.5 7.5 4 12l4.5 4.5M15.5 7.5 20 12l-4.5 4.5\" />\n  </Svg>\n)\n\nexport const Download = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M12 4.5v11M7.5 11l4.5 4.5 4.5-4.5M5 19.5h14\" />\n  </Svg>\n)\n\nexport const Upload = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M12 15.5v-11M7.5 9 12 4.5 16.5 9M5 19.5h14\" />\n  </Svg>\n)\n\nexport const Thumb = ({ down, ...p }: P & { down?: boolean }) => (\n  <Svg {...p} style={{ transform: down ? 'scale(1, -1)' : undefined, ...p.style }}>\n    <path d=\"M7.5 10.5 11 4a1.8 1.8 0 0 1 3.3 1.3l-.8 3.7h4.9a2 2 0 0 1 2 2.4l-1.2 6.4a2 2 0 0 1-2 1.7H7.5Z\" />\n    <path d=\"M4.5 10.5h3v9h-3a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1Z\" />\n  </Svg>\n)\n\nexport const Sun = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"12\" cy=\"12\" r=\"4\" />\n    <path d=\"M12 3v1.5M12 19.5V21M3 12h1.5M19.5 12H21M5.6 5.6l1.1 1.1M17.3 17.3l1.1 1.1M5.6 18.4l1.1-1.1M17.3 6.7l1.1-1.1\" />\n  </Svg>\n)\n\nexport const Moon = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M19.5 14.5A7.5 7.5 0 0 1 9.5 4.5a7.5 7.5 0 1 0 10 10Z\" />\n  </Svg>\n)\n\nexport const Stop = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"7\" y=\"7\" width=\"10\" height=\"10\" rx=\"2.25\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Pause = (p: P) => (\n  <Svg {...p} strokeWidth={p.strokeWidth ?? 2}>\n    <path d=\"M9 7v10M15 7v10\" />\n  </Svg>\n)\n\nexport const Mail = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"3.5\" y=\"5.5\" width=\"17\" height=\"13\" rx=\"2.5\" />\n    <path d=\"m4.5 7.5 7.5 5.25 7.5-5.25\" />\n  </Svg>\n)\n\nexport const Expand = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M14.5 4.5h5v5M9.5 19.5h-5v-5M19.5 4.5l-6 6M4.5 19.5l6-6\" />\n  </Svg>\n)\n\nexport const Card = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"3.5\" y=\"5.5\" width=\"17\" height=\"13\" rx=\"2.5\" />\n    <path d=\"M3.5 10h17M7 15h3\" />\n  </Svg>\n)\n\nexport const Bolt = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M13 3.5 5.5 13.5h6l-1 7 7.5-10h-6Z\" />\n  </Svg>\n)\n\nexport const People = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"9\" cy=\"8.5\" r=\"3\" />\n    <path d=\"M3.5 19a5.5 5.5 0 0 1 11 0\" />\n    <path d=\"M15.5 5.6a3 3 0 0 1 0 5.8M17.5 14.3a5.5 5.5 0 0 1 3 4.7\" />\n  </Svg>\n)\n\nexport const Person = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"12\" cy=\"8\" r=\"3.5\" />\n    <path d=\"M5 19.5a7 7 0 0 1 14 0\" />\n  </Svg>\n)\n\nexport const Sliders = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M4.5 7.5h8.5M17 7.5h2.5M4.5 16.5H7M11 16.5h8.5\" />\n    <circle cx=\"15\" cy=\"7.5\" r=\"2\" />\n    <circle cx=\"9\" cy=\"16.5\" r=\"2\" />\n  </Svg>\n)\n\nexport const Key = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"8\" cy=\"15.5\" r=\"3.75\" />\n    <path d=\"M10.7 12.8 19 4.5M16 7.5l2.5 2.5M13.75 9.75l2 2\" />\n  </Svg>\n)\n\nexport const Shield = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M12 3.5 5 6.5v5c0 4.3 3 7.6 7 9 4-1.4 7-4.7 7-9v-5Z\" />\n    <path d=\"m9.25 12 2 2 3.5-3.75\" />\n  </Svg>\n)\n\nexport const Lock = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"5.5\" y=\"10.5\" width=\"13\" height=\"9.5\" rx=\"2.5\" />\n    <path d=\"M8.5 10.5V8a3.5 3.5 0 0 1 7 0v2.5\" />\n  </Svg>\n)\n\nexport const Sidebar = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"3.5\" y=\"4.5\" width=\"17\" height=\"15\" rx=\"3\" />\n    <path d=\"M9.5 4.5v15\" />\n  </Svg>\n)\n\nexport const PullRequest = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"6.5\" cy=\"6\" r=\"2\" />\n    <circle cx=\"6.5\" cy=\"18\" r=\"2\" />\n    <circle cx=\"17.5\" cy=\"18\" r=\"2\" />\n    <path d=\"M6.5 8v8M17.5 16v-6.5a3 3 0 0 0-3-3H11\" />\n    <path d=\"m13 4.5-2 2 2 2\" />\n  </Svg>\n)\n\nexport const Clock = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"12\" cy=\"12\" r=\"8\" />\n    <path d=\"M12 7.5V12l3 2\" />\n  </Svg>\n)\n\nexport const Terminal = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"3.5\" y=\"4.5\" width=\"17\" height=\"15\" rx=\"3\" />\n    <path d=\"m7.5 9.5 2.5 2.5-2.5 2.5M12.5 14.5h4\" />\n  </Svg>\n)\n\nexport const Filter = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M4.5 7h15M7.5 12h9M10.5 17h3\" />\n  </Svg>\n)\n\nexport const Mic = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"9\" y=\"3.5\" width=\"6\" height=\"11\" rx=\"3\" />\n    <path d=\"M5.5 11.5a6.5 6.5 0 0 0 13 0M12 18v2.5\" />\n  </Svg>\n)\n\nexport const MicOff = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M15 9.5V6.5a3 3 0 0 0-5.6-1.5M9 9v2.5a3 3 0 0 0 4.9 2.3\" />\n    <path d=\"M5.5 11.5a6.5 6.5 0 0 0 10.6 5M18.4 13a6.5 6.5 0 0 0 .1-1.5M12 18v2.5M4 4l16 16\" />\n  </Svg>\n)\n\nexport const Captions = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"3.5\" y=\"5.5\" width=\"17\" height=\"13\" rx=\"3\" />\n    <path d=\"M7.5 13.5h5M14.5 13.5h2M7.5 10.5h2M11.5 10.5h5\" />\n  </Svg>\n)\n\nfunction Solid({ size = 22, children, ...rest }: P) {\n  return (\n    <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden {...rest}>\n      {children}\n    </svg>\n  )\n}\n\nconst HANDSET = 'M2.75 12.9C2.75 9.55 6.9 7.6 12 7.6S21.25 9.55 21.25 12.9v1.55c0 .95-.8 1.65-1.75 1.5l-2.6-.4a1.6 1.6 0 0 1-1.35-1.58v-1.4A12.6 12.6 0 0 0 12 11.9c-1.25 0-2.4.18-3.55.67v1.4a1.6 1.6 0 0 1-1.35 1.58l-2.6.4c-.95.15-1.75-.55-1.75-1.5Z'\n\nexport const MicSolid = (p: P) => (\n  <Solid {...p}>\n    <rect x=\"8.25\" y=\"2.5\" width=\"7.5\" height=\"12.5\" rx=\"3.75\" />\n    <path d=\"M5.25 11.25a6.75 6.75 0 0 0 13.5 0M12 18v3.25\" fill=\"none\" stroke=\"currentColor\" strokeWidth={1.9} strokeLinecap=\"round\" />\n  </Solid>\n)\n\nexport function MicOffSolid(p: P) {\n  const id = useId()\n  return (\n    <Solid {...p}>\n      <mask id={id}>\n        <rect width=\"24\" height=\"24\" fill=\"#fff\" />\n        <path d=\"M4.5 3.5 19.5 20.5\" stroke=\"#000\" strokeWidth={5} strokeLinecap=\"round\" />\n      </mask>\n      <g mask={`url(#${id})`}>\n        <rect x=\"8.25\" y=\"2.5\" width=\"7.5\" height=\"12.5\" rx=\"3.75\" />\n        <path d=\"M5.25 11.25a6.75 6.75 0 0 0 13.5 0M12 18v3.25\" fill=\"none\" stroke=\"currentColor\" strokeWidth={1.9} strokeLinecap=\"round\" />\n      </g>\n      <path d=\"M4.5 3.5 19.5 20.5\" stroke=\"currentColor\" strokeWidth={1.9} strokeLinecap=\"round\" />\n    </Solid>\n  )\n}\n\nexport const Handset = (p: P) => (\n  <Solid {...p}>\n    <path d={HANDSET} />\n  </Solid>\n)\n\nexport function CaptionsSolid(p: P) {\n  const id = useId()\n  return (\n    <Solid {...p}>\n      <mask id={id}>\n        <rect width=\"24\" height=\"24\" fill=\"#fff\" />\n        <path d=\"M6.75 10.25h3.5M12.25 10.25h5M6.75 13.75h7.5M16.25 13.75h1\" stroke=\"#000\" strokeWidth={1.9} strokeLinecap=\"round\" />\n      </mask>\n      <rect x=\"3\" y=\"5.5\" width=\"18\" height=\"13\" rx=\"3.75\" mask={`url(#${id})`} />\n    </Solid>\n  )\n}\n\nexport const Calendar = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"4\" y=\"5.5\" width=\"16\" height=\"14.5\" rx=\"3\" />\n    <path d=\"M4 10h16M8.5 3.5v4M15.5 3.5v4\" />\n  </Svg>\n)\n\nexport const Undo = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M9 14 4.5 9.5 9 5\" />\n    <path d=\"M4.5 9.5H14a5.5 5.5 0 0 1 0 11h-3\" />\n  </Svg>\n)\n\nexport const Chart = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M5 19.5v-7M10 19.5v-15M15 19.5v-9M20 19.5v-12\" />\n  </Svg>\n)\n\nexport const Chats = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M7.5 4.5h9A2.5 2.5 0 0 1 19 7v6.5a2.5 2.5 0 0 1-2.5 2.5H10.5L6.5 19.5V16A2.5 2.5 0 0 1 5 13.5V7a2.5 2.5 0 0 1 2.5-2.5Z\" />\n  </Svg>\n)\n\nexport const Share = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M12 14V3.5M8.25 7.25 12 3.5l3.75 3.75\" />\n    <path d=\"M8.5 10.5h-1A2.5 2.5 0 0 0 5 13v4.5A2.5 2.5 0 0 0 7.5 20h9a2.5 2.5 0 0 0 2.5-2.5V13a2.5 2.5 0 0 0-2.5-2.5h-1\" />\n  </Svg>\n)\n\nexport const Link = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M10.5 13.5a3.5 3.5 0 0 0 5 0l3-3a3.5 3.5 0 0 0-5-5l-1 1\" />\n    <path d=\"M13.5 10.5a3.5 3.5 0 0 0-5 0l-3 3a3.5 3.5 0 0 0 5 5l1-1\" />\n  </Svg>\n)\n\nexport const Trash = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M4.5 7h15M9.5 7V5.5a1.5 1.5 0 0 1 1.5-1.5h2a1.5 1.5 0 0 1 1.5 1.5V7M6.5 7l.8 11a2 2 0 0 0 2 1.9h5.4a2 2 0 0 0 2-1.9l.8-11\" />\n  </Svg>\n)\n\nexport const LogOut = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M14 4.5H7A2.5 2.5 0 0 0 4.5 7v10A2.5 2.5 0 0 0 7 19.5h7M10.5 12h9M16.5 8.5 20 12l-3.5 3.5\" />\n  </Svg>\n)\n\nexport const Help = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"12\" cy=\"12\" r=\"8\" />\n    <path d=\"M9.75 9.75a2.25 2.25 0 1 1 3.1 2.08c-.5.2-.85.68-.85 1.22v.45\" />\n    <path d=\"M12 16.5h.01\" strokeWidth={2.2} />\n  </Svg>\n)\n\nexport const Grid = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"4.5\" y=\"4.5\" width=\"6\" height=\"6\" rx=\"1.75\" />\n    <rect x=\"13.5\" y=\"4.5\" width=\"6\" height=\"6\" rx=\"1.75\" />\n    <rect x=\"4.5\" y=\"13.5\" width=\"6\" height=\"6\" rx=\"1.75\" />\n    <rect x=\"13.5\" y=\"13.5\" width=\"6\" height=\"6\" rx=\"1.75\" />\n  </Svg>\n)\n\nexport const Paperclip = (p: P) => (\n  <Svg {...p}>\n    <path d=\"m19 11.5-7.1 7.1a4.5 4.5 0 0 1-6.4-6.4l7.6-7.6a3 3 0 0 1 4.25 4.25l-7.4 7.4a1.5 1.5 0 0 1-2.1-2.1l6.7-6.7\" />\n  </Svg>\n)\n\nexport const Photo = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"4\" y=\"5\" width=\"16\" height=\"14\" rx=\"3\" />\n    <circle cx=\"9\" cy=\"10\" r=\"1.5\" />\n    <path d=\"m20 15.5-4.2-4.2a1.5 1.5 0 0 0-2.1 0L6 19\" />\n  </Svg>\n)\n\nexport const Plan = (p: P) => (\n  <Svg {...p}>\n    <path d=\"m4.5 7 1.5 1.5L8.75 5.75M4.5 15l1.5 1.5 2.75-2.75M11.5 7.5h8M11.5 15.5h8\" />\n  </Svg>\n)\n\nexport const At = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"12\" cy=\"12\" r=\"3.25\" />\n    <path d=\"M15.25 12v1.5a2.25 2.25 0 0 0 4.5 0V12a7.75 7.75 0 1 0-3.1 6.2\" />\n  </Svg>\n)\n\nexport const Slash = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"4\" y=\"4\" width=\"16\" height=\"16\" rx=\"4.5\" />\n    <path d=\"m14 8-4 8\" />\n  </Svg>\n)\n"},{"path":"components/detent/blocks/kit/primitives.tsx","target":"components/detent/blocks/kit/primitives.tsx","type":"registry:block","content":"'use client'\n\nimport { useEffect, useLayoutEffect, useRef, useState } from 'react'\nimport type { ReactNode } from 'react'\nimport { motion, useReducedMotion } from 'motion/react'\nimport type { Tone } from '@/components/detent/ui/Intelligence'\nimport { ease, press, spring } from '@/components/detent/lib/motion'\n\nexport { Hover } from '@/components/detent/ui/Hover'\n\nexport const wash = (hue: number) => ({\n  background: `light-dark(oklch(0.94 0.04 ${hue}), oklch(0.26 0.065 ${hue}))`,\n  color: `light-dark(oklch(0.47 0.13 ${hue}), oklch(0.86 0.08 ${hue}))`,\n  boxShadow: `inset 0 0 0 1px light-dark(transparent, oklch(0.75 0.12 ${hue} / 0.38))`,\n})\n\nexport function Name({ title, tone = 'loud' }: { title: string | null; tone?: Tone }) {\n  const [born] = useState(title)\n  const reduce = useReducedMotion()\n  if (!title) return <span className=\"text-ink-3\">New chat</span>\n  if (born !== null || reduce) return <>{title}</>\n  const letters = [...title]\n  const settle = 0.25 + letters.length * 0.022\n  return (\n    <span className=\"relative inline-block max-w-full truncate align-bottom\">\n      <span className=\"sr-only\">{title}</span>\n      <motion.span aria-hidden className=\"block truncate\" initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ delay: settle, duration: 0.7, ease: ease.out }}>\n        {title}\n      </motion.span>\n      <motion.span aria-hidden className={`absolute inset-0 block truncate ${tone === 'loud' ? 'ai-text' : 'text-ink-3'}`} initial={{ opacity: 1 }} animate={{ opacity: 0 }} transition={{ delay: settle, duration: 0.7, ease: ease.out }}>\n        {letters.map((c, i) => (\n          <motion.span key={i} initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ delay: i * 0.022, duration: 0.18, ease: ease.out }}>\n            {c}\n          </motion.span>\n        ))}\n      </motion.span>\n    </span>\n  )\n}\n\nexport function Caret({ tone, small = false }: { tone: Tone; small?: boolean }) {\n  return (\n    <span\n      aria-hidden\n      className={`ml-[3px] inline-block w-[2px] translate-y-[3px] rounded-full motion-safe:animate-[caret_1.05s_infinite] ${small ? 'h-[15px]' : 'h-[17px]'} ${tone === 'loud' ? 'bg-[linear-gradient(to_bottom,var(--ai-ink-1),var(--ai-ink-3))] shadow-[0_0_10px_var(--ai-2)]' : 'bg-ink-2'}`}\n    />\n  )\n}\n\nexport function LiveDot({ tone, label }: { tone: Tone; label?: string }) {\n  return <span aria-label={label} className={`size-1.5 shrink-0 rounded-full motion-safe:animate-pulse ${tone === 'loud' ? 'bg-[linear-gradient(135deg,var(--ai-1),var(--ai-3))] shadow-[0_0_8px_var(--ai-2)]' : 'bg-ink-3'}`} />\n}\n\nexport function Bars({ hue, level = 2, small = true }: { hue: number; level?: number; small?: boolean }) {\n  const h = small ? [4, 6, 8, 10] : [7, 11, 15, 19]\n  return (\n    <span aria-hidden className={`flex items-end ${small ? 'h-2.5 gap-[1.5px]' : 'h-[19px] gap-[3px]'}`}>\n      {h.map((px, i) => (\n        <span key={i} className={`rounded-full ${small ? 'w-[2.5px]' : 'w-[5px]'}`} style={{ height: px, background: i <= level ? `light-dark(oklch(0.56 0.16 ${hue}), oklch(0.76 0.12 ${hue}))` : 'var(--surface-3)' }} />\n      ))}\n    </span>\n  )\n}\n\nexport type MenuItem = { id: string; label: string; note?: string; icon?: ReactNode; trail?: ReactNode }\n\nexport function Menu({ items, active, onActive, onPick, title, className = '', plate }: { items: MenuItem[]; active: number; onActive: (i: number) => void; onPick: (i: number) => void; title?: string; className?: string; plate: string }) {\n  const [via, setVia] = useState<'pointer' | 'keys'>('keys')\n  useEffect(() => {\n    const keys = () => setVia('keys')\n    window.addEventListener('keydown', keys, true)\n    return () => window.removeEventListener('keydown', keys, true)\n  }, [])\n  return (\n    <motion.div\n      role=\"listbox\"\n      className={`absolute z-30 origin-bottom-left rounded-[11px] bg-surface p-1.5 shadow-modal ${className}`}\n      initial={{ opacity: 0, y: 6, scale: 0.98 }}\n      animate={{ opacity: 1, y: 0, scale: 1 }}\n      exit={{ opacity: 0, y: 4, scale: 0.98, transition: { duration: 0.12, ease: ease.out } }}\n      transition={spring.snappy}\n      onPointerDown={(e) => e.preventDefault()}\n    >\n      {title && <p className=\"px-2.5 pb-1 pt-1.5 text-caption text-ink-3\">{title}</p>}\n      {items.length === 0 && <p className=\"px-2.5 py-2 text-footnote text-ink-3\">Nothing matches</p>}\n      {items.map((it, i) => (\n        <button key={it.id} type=\"button\" role=\"option\" aria-selected={i === active} onPointerEnter={() => (setVia('pointer'), onActive(i))} onClick={() => onPick(i)} className=\"relative flex w-full items-center gap-2.5 rounded-[7px] px-2.5 py-2 text-left\">\n          {i === active && <motion.span layoutId={plate} className=\"absolute inset-0 rounded-[7px] bg-surface-2\" transition={via === 'pointer' ? spring.snappy : { duration: 0 }} />}\n          {it.icon && <span className=\"relative flex shrink-0\">{it.icon}</span>}\n          <span className=\"relative min-w-0 flex-1\">\n            <span className=\"block truncate text-callout text-ink\">{it.label}</span>\n            {it.note && <span className=\"block truncate text-caption text-ink-3\">{it.note}</span>}\n          </span>\n          {it.trail && <span className=\"relative shrink-0\">{it.trail}</span>}\n        </button>\n      ))}\n    </motion.div>\n  )\n}\n\nexport function Popover({ onClose, children }: { onClose: () => void; children: ReactNode }) {\n  const box = useRef<HTMLDivElement>(null)\n  useEffect(() => {\n    const down = (e: PointerEvent) => !box.current?.parentElement?.contains(e.target as Node) && onClose()\n    const key = (e: KeyboardEvent) => e.key === 'Escape' && onClose()\n    window.addEventListener('pointerdown', down)\n    window.addEventListener('keydown', key)\n    return () => {\n      window.removeEventListener('pointerdown', down)\n      window.removeEventListener('keydown', key)\n    }\n  }, [onClose])\n  return <div ref={box}>{children}</div>\n}\n\nexport function Act({ label, on, onClick, children, className = '' }: { label: string; on?: boolean; onClick: () => void; children: ReactNode; className?: string }) {\n  return (\n    <motion.button type=\"button\" whileTap={press} aria-label={label} aria-pressed={on} title={label} onClick={onClick} className={`ring-focus flex size-8 items-center justify-center rounded-full transition-colors ease-detent duration-150 hover:bg-surface-2 hover:text-ink ${on ? 'text-ink' : ''} ${className}`}>\n      {children}\n    </motion.button>\n  )\n}\n\nexport function Status({ tone, children, live }: { tone: 'ok' | 'warn' | 'danger' | 'ink' | 'ai'; children: ReactNode; live?: Tone }) {\n  const c = tone === 'ok' ? 'var(--ok)' : tone === 'warn' ? 'var(--warn-ink)' : tone === 'danger' ? 'var(--danger)' : 'var(--ink-2)'\n  const bg = tone === 'ok' ? 'var(--ok)' : tone === 'warn' ? 'var(--warn)' : tone === 'danger' ? 'var(--danger)' : 'var(--ink)'\n  return (\n    <span className={`chip inline-flex h-6 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-2 text-caption font-medium ${tone === 'ai' ? 'chip-plain' : ''}`} style={{ color: tone === 'ai' ? 'var(--ink-2)' : c, ['--chip' as string]: bg }}>\n      {tone === 'ai' ? <LiveDot tone={live ?? 'quiet'} /> : <span className=\"size-1.5 rounded-full\" style={{ background: bg }} />}\n      {children}\n    </span>\n  )\n}\n\nexport function useLatest<T>(v: T) {\n  const r = useRef(v)\n  useLayoutEffect(() => {\n    r.current = v\n  })\n  return r\n}\n\nexport const btn = {\n  primary: 'ring-focus inline-flex h-8 pointer-coarse:h-9 items-center justify-center gap-1.5 rounded-[7px] bg-ink px-3 text-footnote font-medium text-surface shadow-[inset_0_1px_0_rgb(255_255_255/0.14),0_1px_2px_rgb(0_0_0/0.18)] transition-opacity ease-detent hover:opacity-90 disabled:opacity-40',\n  secondary: 'lit ring-focus inline-flex h-8 pointer-coarse:h-9 items-center justify-center gap-1.5 rounded-[7px] bg-[color-mix(in_oklch,var(--ink)_5.5%,transparent)] px-3 text-footnote font-medium text-ink transition-colors ease-detent hover:bg-[color-mix(in_oklch,var(--ink)_9%,transparent)] disabled:text-ink-3',\n  ghost: 'ring-focus inline-flex h-8 pointer-coarse:h-9 items-center justify-center gap-1.5 rounded-[7px] px-2.5 text-footnote font-medium text-ink-2 transition-colors ease-detent hover:bg-surface-2 hover:text-ink',\n}\n\nexport const selectedRow = 'lit bg-[color-mix(in_oklch,var(--dt-accent)_11%,transparent)]'\nexport const selectedText = 'text-[var(--dt-accent-ink)]'\n"},{"path":"components/detent/blocks/kit/director.ts","target":"components/detent/blocks/kit/director.ts","type":"registry:block","content":"'use client'\n\nimport { createContext, useContext, useEffect, useLayoutEffect, useRef, useState } from 'react'\nimport type { PointerEvent } from 'react'\nimport { pressed } from '@/components/detent/lib/hand'\n\nexport const STOP = Symbol('stop')\nexport type Wait = (ms: number) => Promise<void>\n\nexport const InPlay = createContext(true)\n\nexport function useDirector(script: (wait: Wait, pass: number) => Promise<void>, autoplay = true, onTakeOver?: () => void) {\n  const play = useContext(InPlay)\n  const touched = useRef(!autoplay)\n  const latest = useRef(script)\n  useLayoutEffect(() => {\n    latest.current = script\n  })\n  const [begun, setBegun] = useState(play)\n  if (play && !begun) setBegun(true)\n  const gate = useRef(play)\n  const held = useRef<(() => void)[]>([])\n  useLayoutEffect(() => {\n    gate.current = play\n    if (!play) return\n    const resume = held.current\n    held.current = []\n    resume.forEach((go) => go())\n  }, [play])\n  useEffect(() => {\n    if (!autoplay || !begun) return\n    let on = true\n    const wait: Wait = (ms) =>\n      new Promise((r, x) => {\n        const go = () => (!on || touched.current ? x(STOP) : gate.current ? r() : held.current.push(go))\n        setTimeout(go, ms)\n      })\n    ;(async () => {\n      for (let pass = 0; ; pass++) await latest.current(wait, pass)\n    })().catch(() => {})\n    return () => {\n      on = false\n    }\n  }, [autoplay, begun])\n  const takeOver = () => {\n    if (!touched.current) onTakeOver?.()\n    touched.current = true\n  }\n  // Build the press handlers per event so takeOver is only handed over outside render.\n  const onPointerDownCapture = (e?: PointerEvent) => pressed(takeOver).onPointerDownCapture(e)\n  const onPointerUpCapture = (e?: PointerEvent) => pressed(takeOver).onPointerUpCapture(e)\n  return { onPointerDownCapture, onPointerUpCapture, onKeyDownCapture: takeOver, touched }\n}\n\nexport const sleeper = (ok: () => boolean) => (ms: number) => new Promise<void>((r, x) => setTimeout(() => (ok() ? r() : x(STOP)), ms))\n"},{"path":"components/detent/lib/motion.ts","target":"components/detent/lib/motion.ts","type":"registry:block","content":"export const ease = {\n  out: [0.2, 0.9, 0.25, 1] as const,\n  inOut: [0.6, 0, 0.3, 1] as const,\n}\n\nexport const dur = {\n  exit: 0.12,\n  hover: 0.15,\n  enter: 0.2,\n  swap: 0.24,\n  panel: 0.34,\n}\n\nexport const spring = {\n  snappy: { type: 'spring', stiffness: 560, damping: 42, mass: 0.6 } as const,\n  smooth: { type: 'spring', bounce: 0, duration: 0.36 } as const,\n  soft: { type: 'spring', bounce: 0.12, duration: 0.5 } as const,\n  release: { type: 'spring', stiffness: 320, damping: 32 } as const,\n  move: { type: 'spring', stiffness: 420, damping: 38 } as const,\n  data: { type: 'spring', stiffness: 170, damping: 26 } as const,\n  pop: { type: 'spring', bounce: 0.3, duration: 0.4 } as const,\n}\n\nexport const appear = {\n  initial: { opacity: 0, scale: 0.96 },\n  animate: { opacity: 1, scale: 1, transition: { duration: dur.swap, ease: ease.out } },\n  exit: { opacity: 0, scale: 0.97, transition: { duration: dur.exit, ease: ease.out } },\n}\n\nexport const slide = {\n  enter: (dir: number) => ({ x: dir * 24, opacity: 0 }),\n  center: { x: 0, opacity: 1 },\n  exit: (dir: number) => ({ x: dir * -24, opacity: 0 }),\n}\n\nexport const press = { scale: 0.97 }\n\nexport const staggerFor = (count: number) => Math.min(0.04, 0.2 / Math.max(1, count))\n"},{"path":"components/detent/ui/Intelligence.tsx","target":"components/detent/ui/Intelligence.tsx","type":"registry:block","content":"'use client'\n\nimport { useLayoutEffect, useRef, useState } from 'react'\nimport { AnimatePresence, motion } from 'motion/react'\nimport type { MotionStyle } from 'motion/react'\nimport { ease } from '@/components/detent/lib/motion'\n\nexport type Tone = 'loud' | 'quiet'\n\nconst ended = new Map<string, number>()\n\nexport function useTone(on: boolean, surface: string, rest = 120_000): Tone {\n  const [tone, setTone] = useState<Tone>('loud')\n  const was = useRef(false)\n  useLayoutEffect(() => {\n    if (on && !was.current) {\n      const last = ended.get(surface)\n      setTone(last === undefined || performance.now() - last > rest ? 'loud' : 'quiet')\n    }\n    if (!on && was.current) ended.set(surface, performance.now())\n    was.current = on\n    return () => {\n      if (was.current) ended.set(surface, performance.now())\n    }\n  }, [on, surface, rest])\n  return tone\n}\n\nexport function Glow({\n  on,\n  layer,\n  radius,\n  style,\n  className = '',\n  tone = 'loud',\n}: {\n  on: boolean\n  layer: 'halo' | 'ring'\n  radius: number | string\n  style?: MotionStyle\n  className?: string\n  tone?: Tone\n}) {\n  return (\n    <AnimatePresence>\n      {on && !(layer === 'halo' && tone === 'quiet') && (\n        <motion.span\n          aria-hidden\n          className={`${layer === 'halo' ? 'ai-halo' : 'ai-ring'} ${tone === 'quiet' ? 'ai-quiet' : ''} ${className}`}\n          style={{ borderRadius: radius, ...style }}\n          initial={{ opacity: 0 }}\n          animate={{ opacity: 1, transition: { duration: 0.5, ease: ease.out } }}\n          exit={{ opacity: 0, transition: { duration: 0.9, ease: [0.4, 0, 0.2, 1] } }}\n        />\n      )}\n    </AnimatePresence>\n  )\n}\n\nconst INKS = ['var(--ai-ink-1)', 'var(--ai-ink-2)', 'var(--ai-ink-3)', 'var(--ai-ink-4)']\n\nexport const aiInk = (t: number) => {\n  const x = Math.min(0.9999, Math.max(0, t)) * (INKS.length - 1)\n  const k = Math.floor(x)\n  const f = Math.round((x - k) * 100)\n  return `color-mix(in oklch, ${INKS[k]} ${100 - f}%, ${INKS[k + 1]})`\n}\n\nexport const aiWord = (n: number) => INKS[n % INKS.length]\n\nexport const aiText = (tone: Tone) => (tone === 'loud' ? 'ai-text' : 'ai-text ai-quiet')\nexport const aiWords = (tone: Tone) => (tone === 'loud' ? 'word-in ai-warm' : 'word-in')\n"},{"path":"components/detent/ui/Hover.tsx","target":"components/detent/ui/Hover.tsx","type":"registry:block","content":"'use client'\n\nimport { useRef, useState } from 'react'\nimport type { ReactNode } from 'react'\nimport { motion } from 'motion/react'\nimport { ease } from '@/components/detent/lib/motion'\n\nexport function Hover({ children, className = '', radius = 7, as: Tag = 'div', label }: { children: ReactNode; className?: string; radius?: number; as?: 'div' | 'nav' | 'ul'; label?: string }) {\n  const box = useRef<HTMLElement>(null)\n  const [at, setAt] = useState<{ x: number; y: number; w: number; h: number; jump: boolean } | null>(null)\n  const move = (e: React.PointerEvent) => {\n    const el = box.current\n    const row = (e.target as HTMLElement).closest('[data-row]') as HTMLElement | null\n    if (!el || !row || !el.contains(row)) return\n    const b = el.getBoundingClientRect()\n    const r = row.getBoundingClientRect()\n    const s = b.width / (el.offsetWidth || b.width || 1)\n    const next = { x: (r.left - b.left) / s + el.scrollLeft, y: (r.top - b.top) / s + el.scrollTop, w: r.width / s, h: r.height / s }\n    setAt((a) => (a && a.x === next.x && a.y === next.y && a.w === next.w && a.h === next.h ? a : { ...next, jump: !a }))\n  }\n  const leave = () => setAt(null)\n  const instant = !at || at.jump\n  return (\n    <Tag ref={box as never} aria-label={label} className={`relative ${className}`} onPointerMove={move} onPointerLeave={leave}>\n      <motion.span\n        aria-hidden\n        className=\"pointer-events-none absolute left-0 top-0 bg-[color-mix(in_oklch,var(--ink)_5%,transparent)]\"\n        style={{ borderRadius: radius }}\n        initial={false}\n        animate={at ? { x: at.x, y: at.y, width: at.w, height: at.h, opacity: 1 } : { opacity: 0 }}\n        transition={instant ? { duration: 0, opacity: { duration: 0.12, ease: ease.out } } : { type: 'spring', stiffness: 620, damping: 46, opacity: { duration: 0.12, ease: ease.out } }}\n      />\n      {children}\n    </Tag>\n  )\n}\n"},{"path":"components/detent/lib/hand.ts","target":"components/detent/lib/hand.ts","type":"registry:block","content":"import type { PointerEvent, RefObject } from 'react'\n\nconst HOLD = 3000\nconst CONTROL = 'button,a,input,textarea,select,label,[role=\"button\"],[role=\"tab\"],[role=\"option\"],[role=\"slider\"],[role=\"switch\"],[contenteditable],[draggable]'\nconst timers = new WeakMap<object, ReturnType<typeof setTimeout>>()\nlet downAt: [number, number] | null = null\n\nexport const hover = (held: RefObject<boolean>) => ({\n  onPointerEnter: (e: PointerEvent) => {\n    if (e.pointerType === 'touch') return\n    held.current = true\n    clearTimeout(timers.get(held))\n    timers.set(held, setTimeout(() => (held.current = false), HOLD))\n  },\n  onPointerLeave: () => {\n    clearTimeout(timers.get(held))\n    held.current = false\n  },\n})\n\nexport const pressed = (take: () => void) => ({\n  onPointerDownCapture: (e?: PointerEvent) => {\n    if (e?.pointerType === 'touch') downAt = [e.clientX, e.clientY]\n    else take()\n  },\n  onPointerUpCapture: (e?: PointerEvent) => {\n    if (e?.pointerType !== 'touch' || !downAt) return\n    const moved = Math.hypot(e.clientX - downAt[0], e.clientY - downAt[1]) > 10\n    downAt = null\n    if (moved || (e.target as Element).closest?.(CONTROL)) take()\n  },\n})\n"}],"docs":"Usage, props and when to use it: https://detentui.com/blocks/integrations.md . Wrap your root layout once in <MotionConfig reducedMotion=\"user\"> from motion/react so the motion respects reduced-motion settings.","meta":{"tier":"free","docs":"https://detentui.com/blocks/integrations.md"}}