{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"models","title":"Model & effort","description":"Pick a model and how hard it thinks. Effort is a real detent you drag and flick, with the time and cost of every model running with your finger, so you feel what thinking harder costs before you choose.","type":"registry:component","author":"Detent","dependencies":["motion"],"registryDependencies":["https://detentui.com/r/theme.json"],"files":[{"path":"components/detent/components/models/ModelPicker.tsx","target":"components/detent/components/models/ModelPicker.tsx","type":"registry:component","content":"'use client'\n\nimport { useEffect, useId, useImperativeHandle, useLayoutEffect, useRef, useState } from 'react'\nimport type { KeyboardEvent, Ref } from 'react'\nimport { AnimatePresence, motion, useReducedMotion } from 'motion/react'\nimport { Check, ChevronDown } from '@/components/detent/icons'\nimport { at, clamp, dragProps, glide, stepKey, useDetent, write } from '@/components/detent/lib/detent'\nimport { ease, spring, press } from '@/components/detent/lib/motion'\n\nexport type Model = {\n  id: string\n  name: string\n  blurb: string\n  time: number\n  cost: number\n  reasons?: boolean\n}\nexport type Effort = { label: string; time: number; cost: number }\nexport type ModelValue = { model: string; effort: number }\nexport type PickerHandle = { open(): void; close(): void; effort(i: number): void; choose(id: string): void }\n\nconst EFFORTS: Effort[] = [\n  { label: 'Low', time: 0.5, cost: 0.55 },\n  { label: 'Medium', time: 1, cost: 1 },\n  { label: 'High', time: 2, cost: 1.9 },\n  { label: 'Max', time: 3.5, cost: 3.4 },\n]\nconst secs = (n: number) => `${n < 10 ? n.toFixed(1) : Math.round(n)}s`\nconst price = (n: number) => (n < 1 ? `${(n * 100).toFixed(1)}¢` : `$${n.toFixed(2)}`)\n\nexport function ModelPicker({ models, value, onChange, efforts = EFFORTS, defaultOpen = false, lift = 10, muted, ref }: {\n  models: Model[]\n  value: ModelValue\n  onChange: (v: ModelValue) => void\n  efforts?: Effort[]\n  defaultOpen?: boolean\n  lift?: number\n  muted?: boolean\n  ref?: Ref<PickerHandle>\n}) {\n  const uid = useId()\n  const reduce = useReducedMotion()\n  const [open, setOpen] = useState(defaultOpen)\n  const [cursor, setCursor] = useState(-1)\n  const box = useRef<HTMLDivElement>(null)\n  const panel = useRef<HTMLDivElement>(null)\n  const current = models.find((m) => m.id === value.model) ?? models[0]\n  const ofEffort = (m: Model) => (m.reasons === false ? efforts[1] ?? efforts[0] : efforts[value.effort])\n  const say = (v: ModelValue) => onChange(v)\n\n  const n = efforts.length\n  const stops = useRef(Array.from({ length: n }, (_, i) => i))\n  if (stops.current.length !== n) stops.current = Array.from({ length: n }, (_, i) => i)\n  const [first] = useState(value.effort)\n  const plate = useRef<HTMLSpanElement>(null)\n  const track = useRef<HTMLDivElement>(null)\n  const names = useRef<(HTMLSpanElement | null)[]>([])\n  const figures = useRef<{ time: HTMLElement | null; cost: HTMLElement | null }[]>([])\n  const latest = useRef({ value, models, efforts, onChange })\n  useLayoutEffect(() => {\n    latest.current = { value, models, efforts, onChange }\n  })\n  const told = useRef(value.effort)\n  const byHand = useRef(false)\n  const tell = (i: number) => {\n    if (i === told.current) return\n    told.current = i\n    latest.current.onChange({ ...latest.current.value, effort: i })\n  }\n  const paint = (x: number, v = 0) => {\n    const { models, efforts } = latest.current\n    const e = clamp(x, 0, efforts.length - 1)\n    if (plate.current) {\n      const over = x - e\n      const stretch = Math.min(0.12, Math.abs(v) * 0.022, 2 * Math.min(e, efforts.length - 1 - e))\n      plate.current.style.transformOrigin = over > 0 ? '100% 50%' : over < 0 ? '0% 50%' : '50% 50%'\n      plate.current.style.transform = `translate3d(${e * 100}%,0,0) scaleX(${1 + stretch - Math.min(0.16, Math.abs(over) * 0.6)})`\n    }\n    names.current.forEach((el, i) => {\n      if (el) el.style.opacity = String(0.56 + 0.44 * clamp(1 - Math.abs(x - i), 0, 1))\n    })\n    const time = at(efforts.map((f) => f.time), e, glide)\n    const cost = at(efforts.map((f) => f.cost), e, glide)\n    models.forEach((m, k) => {\n      if (m.reasons === false) return\n      write(figures.current[k]?.time as HTMLElement, secs(m.time * time))\n      write(figures.current[k]?.cost as HTMLElement, price(m.cost * cost))\n    })\n  }\n  const dial = useDetent({\n    value: value.effort,\n    stops: stops.current,\n    magnet: 0.42,\n    reach: 0.08,\n    throw: 0.14,\n    spring: { w: 19, z: 0.86 },\n    muted,\n    onFrame: (x, v) => paint(x, v),\n    onStop: (i) => byHand.current && tell(i),\n    onRest: (_, i) => {\n      if (byHand.current) tell(i)\n      byHand.current = false\n    },\n  })\n  useEffect(() => {\n    if (value.effort === told.current || dial.mode() === 'held') return\n    told.current = value.effort\n    dial.to(value.effort)\n  }, [value.effort, dial])\n  useLayoutEffect(() => {\n    if (open) paint(dial.get())\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [open, models, efforts])\n  const [drag] = useState(() =>\n    dragProps(dial, () => ({\n      box: () => track.current,\n      units: latest.current.efforts.length,\n      muted,\n      onGrab: () => (byHand.current = true),\n      onTap: (f) => {\n        const i = clamp(Math.floor(f * latest.current.efforts.length), 0, latest.current.efforts.length - 1)\n        byHand.current = false\n        dial.to(i, { feel: true })\n        tell(i)\n      },\n    })),\n  )\n\n  useImperativeHandle(ref, () => ({\n    open: () => setOpen(true),\n    close: () => setOpen(false),\n    effort: (i) => say({ ...value, effort: i }),\n    choose: (id) => say({ ...value, model: id }),\n  }))\n\n  useEffect(() => {\n    if (!open) return\n    const away = (e: globalThis.PointerEvent) => {\n      if (!box.current?.contains(e.target as Node)) setOpen(false)\n    }\n    document.addEventListener('pointerdown', away)\n    return () => document.removeEventListener('pointerdown', away)\n  }, [open])\n\n  const onKey = (e: KeyboardEvent) => {\n    if (e.key === 'ArrowDown') setCursor((c) => (c + 1) % models.length)\n    else if (e.key === 'ArrowUp') setCursor((c) => (c <= 0 ? models.length : c) - 1)\n    else if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {\n      stepKey(dial, e)\n      tell(dial.target())\n    } else if (e.key === 'Escape') setOpen(false)\n    else if (e.key === 'Enter' && cursor >= 0) {\n      say({ ...value, model: models[cursor].id })\n      setOpen(false)\n    } else return\n    e.preventDefault()\n  }\n  return (\n    <div ref={box} className=\"relative inline-flex\" onKeyDown={onKey}>\n      <motion.button whileTap={press} type=\"button\" aria-expanded={open} aria-haspopup=\"listbox\" onClick={() => setOpen((o) => !o)} className=\"ring-focus flex h-8 items-center gap-1.5 rounded-full bg-surface-2 pl-3 pr-2 text-[13px] text-ink transition-colors ease-detent hover:bg-[color-mix(in_oklch,var(--ink)_9%,transparent)]\">\n        {current.name}\n        {current.reasons !== false && <span className=\"text-ink-3\">{efforts[value.effort].label}</span>}\n        <ChevronDown size={14} className={`text-ink-3 transition-transform ease-detent duration-200 ${open ? 'rotate-180' : ''}`} />\n      </motion.button>\n      <AnimatePresence>\n        {open && (\n          <motion.div\n            ref={panel}\n            style={{ bottom: `calc(100% + ${lift}px)` }}\n            className=\"absolute left-0 z-20 w-[444px] max-w-[calc(100vw-64px)] rounded-[20px] bg-surface p-2 shadow-float\"\n            initial={{ opacity: 0, y: 6 }}\n            animate={{ opacity: 1, y: 0 }}\n            exit={{ opacity: 0, y: 4 }}\n            transition={{ duration: 0.2, ease: ease.out }}\n          >\n            <div className=\"flex items-center gap-3 pb-2 pl-3\">\n              <span className=\"text-[13px] text-ink-3\">Effort</span>\n              <div ref={track} {...drag} className=\"relative grid min-w-0 flex-1 cursor-grab touch-pan-y select-none rounded-full bg-surface-2 p-0.5 active:cursor-grabbing\" style={{ gridTemplateColumns: `repeat(${n}, minmax(0, 1fr))` }}>\n                <span ref={plate} aria-hidden className=\"pointer-events-none absolute inset-y-0.5 left-0.5 rounded-full bg-surface shadow-[0_0_0_1px_var(--line),0_1px_3px_rgb(0_0_0/0.08)] will-change-transform dark:bg-[#2c2c2e]\" style={{ width: `calc((100% - 4px) / ${n})`, transform: `translate3d(${first * 100}%,0,0)` }} />\n                {efforts.map((e, i) => (\n                  <button key={e.label} type=\"button\" aria-pressed={i === value.effort} onClick={() => dial.mode() === 'rest' && dial.target() !== i && (dial.to(i), tell(i))} className=\"ring-focus relative h-9 cursor-[inherit] rounded-full text-[13px] text-ink\">\n                    <span\n                      ref={(el) => {\n                        names.current[i] = el\n                      }}\n                      className=\"relative\"\n                      style={{ opacity: i === first ? 1 : 0.56 }}\n                    >\n                      {e.label}\n                    </span>\n                  </button>\n                ))}\n              </div>\n            </div>\n            <div role=\"listbox\" aria-label=\"Model\" className=\"flex flex-col\">\n              {models.map((m, k) => {\n                const on = m.id === current.id\n                const e = ofEffort(m)\n                const time = m.time * e.time\n                const cost = m.cost * e.cost\n                const from = m.reasons === false ? e : efforts[first]\n                return (\n                  <button\n                    key={m.id}\n                    type=\"button\"\n                    role=\"option\"\n                    aria-selected={on}\n                    aria-label={`${m.name}, ${m.blurb}, about ${secs(time)} and ${price(cost)} a reply`}\n                    onClick={() => {\n                      say({ ...value, model: m.id })\n                      setOpen(false)\n                    }}\n                    onPointerEnter={() => setCursor(k)}\n                    onPointerLeave={() => setCursor(-1)}\n                    className=\"ring-focus relative flex h-[60px] w-full items-center gap-3 rounded-[14px] px-3 text-left\"\n                  >\n                    {k === cursor && !on && <span aria-hidden className=\"absolute inset-0 rounded-[14px] bg-[color-mix(in_oklch,var(--ink)_4%,transparent)]\" />}\n                    {on && <motion.span aria-hidden layoutId={`${uid}model`} transition={reduce ? { duration: 0 } : spring.smooth} className=\"absolute inset-0 rounded-[14px] bg-[color-mix(in_oklch,var(--dt-accent)_10%,transparent)] dark:bg-[color-mix(in_oklch,var(--dt-accent)_20%,transparent)]\" />}\n                    <span className=\"relative min-w-0 flex-1\">\n                      <span className=\"flex items-center gap-1.5 text-[15px] leading-[21px] text-ink\">\n                        {m.name}\n                        {on && <Check size={14} className=\"text-[var(--dt-accent-ink)] dark:text-[var(--dt-accent)]\" />}\n                      </span>\n                      <span className=\"block truncate text-[13px] leading-[18px] text-ink-3\">{m.blurb}</span>\n                    </span>\n                    <span aria-hidden className=\"tnum relative flex shrink-0 gap-3 text-[13px] text-ink-2\">\n                      <span\n                        ref={(el) => {\n                          ;(figures.current[k] ??= { time: null, cost: null }).time = el\n                        }}\n                        className=\"w-[4.5ch] text-right [contain:layout_paint]\"\n                      >\n                        {secs(m.time * from.time)}\n                      </span>\n                      <span\n                        ref={(el) => {\n                          ;(figures.current[k] ??= { time: null, cost: null }).cost = el\n                        }}\n                        className=\"w-[6ch] text-right text-ink-3 [contain:layout_paint]\"\n                      >\n                        {price(m.cost * from.cost)}\n                      </span>\n                    </span>\n                  </button>\n                )\n              })}\n            </div>\n          </motion.div>\n        )}\n      </AnimatePresence>\n    </div>\n  )\n}\n"},{"path":"components/detent/lib/detent.ts","target":"components/detent/lib/detent.ts","type":"registry:component","content":"import { useLayoutEffect, useRef, 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\nexport type DetentOptions = {\n  value: number\n  stops?: 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?: 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 o = read()\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  const latest = useRef<DetentOptions>({ ...options, reduce })\n  useLayoutEffect(() => {\n    latest.current = { ...options, reduce }\n  })\n  const [d] = useState(() => createDetent(() => latest.current))\n  useLayoutEffect(() => () => d.dispose(), [d])\n  return d\n}\n\nexport type DragConfig = {\n  axis?: 'x' | 'y'\n  box: () => HTMLElement | null\n  units: 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 / 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/icons/index.tsx","target":"components/detent/icons/index.tsx","type":"registry:component","content":"import type { SVGProps } from 'react'\n\ntype P = SVGProps<SVGSVGElement> & { size?: number }\n\nfunction Svg({ size = 20, children, ...rest }: P) {\n  return (\n    <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden {...rest}>\n      {children}\n    </svg>\n  )\n}\n\nexport const Close = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M7 7l10 10M17 7 7 17\" />\n  </Svg>\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 Plus = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M12 5v14M5 12h14\" />\n  </Svg>\n)\n\nexport const Bin = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"4\" y=\"4.5\" width=\"16\" height=\"3.6\" rx=\"1.8\" fill=\"currentColor\" stroke=\"none\" />\n    <path d=\"M9.5 4.5V3.8a1.3 1.3 0 0 1 1.3-1.3h2.4a1.3 1.3 0 0 1 1.3 1.3v.7\" />\n    <path d=\"M6 10.5l.8 8.4A2.2 2.2 0 0 0 9 21h6a2.2 2.2 0 0 0 2.2-2.1l.8-8.4\" />\n    <path d=\"M10.3 13v4.5M13.7 13v4.5\" />\n  </Svg>\n)\n\nexport const Undo = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M9 9h6.5a4.5 4.5 0 0 1 0 9H10\" />\n    <path d=\"M9.6 4.6 4.6 9l5 4.4z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const Pause = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"6\" y=\"5\" width=\"4\" height=\"14\" rx=\"1.6\" fill=\"currentColor\" stroke=\"none\" />\n    <rect x=\"14\" y=\"5\" width=\"4\" height=\"14\" rx=\"1.6\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Upload = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M4 14.5v2.3A3.2 3.2 0 0 0 7.2 20h9.6a3.2 3.2 0 0 0 3.2-3.2v-2.3\" />\n    <path d=\"M12 15V7\" />\n    <path d=\"M12 3.2 7.6 8.2h8.8z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const FilePage = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M13.5 3H8a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3V8.5\" />\n    <path d=\"M13.5 3v3.5a2 2 0 0 0 2 2H19z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const Picture = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"3.5\" y=\"4.5\" width=\"17\" height=\"15\" rx=\"4\" />\n    <path d=\"M3.8 16.5 9 11.6a1.5 1.5 0 0 1 2.1 0l3.2 3 1.6-1.5a1.5 1.5 0 0 1 2.1 0l2.2 2.1V16a3.5 3.5 0 0 1-3.5 3.5H8A4 4 0 0 1 3.8 16.5z\" fill=\"currentColor\" stroke=\"none\" />\n    <circle cx=\"15.5\" cy=\"8.8\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Film = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"3.5\" y=\"4.5\" width=\"17\" height=\"15\" rx=\"4\" />\n    <path d=\"M10.2 9.2v5.6a.7.7 0 0 0 1 .6l4.4-2.8a.7.7 0 0 0 0-1.2l-4.4-2.8a.7.7 0 0 0-1 .6z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Bubble = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M12 4c4.7 0 8.5 3.1 8.5 7s-3.8 7-8.5 7c-1 0-2-.1-2.9-.4L5 19.5l1.1-3.6C4.6 14.6 3.5 12.9 3.5 11c0-3.9 3.8-7 8.5-7z\" />\n    <circle cx=\"8.6\" cy=\"11\" r=\"1.15\" fill=\"currentColor\" stroke=\"none\" />\n    <circle cx=\"12\" cy=\"11\" r=\"1.15\" fill=\"currentColor\" stroke=\"none\" />\n    <circle cx=\"15.4\" cy=\"11\" r=\"1.15\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Card = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"3\" y=\"5.5\" width=\"18\" height=\"13\" rx=\"3.5\" />\n    <rect x=\"3\" y=\"8.6\" width=\"18\" height=\"3\" fill=\"currentColor\" stroke=\"none\" />\n    <path d=\"M7 15h3\" />\n  </Svg>\n)\n\nexport const Bell = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M6 15.5V11a6 6 0 1 1 12 0v4.5l1.5 2H4.5z\" />\n    <path d=\"M9.6 19.5a2.6 2.6 0 0 0 4.8 0z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const Ship = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M5 20h14\" />\n    <path d=\"M12 16V9\" />\n    <path d=\"M12 3.5 7 9.2h10z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const Mention = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"12\" cy=\"12\" r=\"3.4\" fill=\"currentColor\" stroke=\"none\" />\n    <path d=\"M15.4 12v1.4a2.6 2.6 0 0 0 5.1.7A8.5 8.5 0 1 0 16 19.5\" />\n  </Svg>\n)\n\nexport const Calendar = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"3.5\" y=\"5\" width=\"17\" height=\"15.5\" rx=\"4\" />\n    <path d=\"M3.5 9A4 4 0 0 1 7.5 5h9a4 4 0 0 1 4 4v1H3.5z\" fill=\"currentColor\" stroke=\"none\" />\n    <path d=\"M8 3v3M16 3v3\" />\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 ArrowUpRight = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M8 16 16 8\" />\n    <path d=\"M9.5 6.8h7.7v7.7z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const Sun = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"12\" cy=\"12\" r=\"4.2\" fill=\"currentColor\" stroke=\"none\" />\n    {[0, 45, 90, 135, 180, 225, 270, 315].map((a) => {\n      const r = (a * Math.PI) / 180\n      return <circle key={a} cx={12 + Math.cos(r) * 8.4} cy={12 + Math.sin(r) * 8.4} r=\"1.1\" fill=\"currentColor\" stroke=\"none\" />\n    })}\n  </Svg>\n)\n\nexport const Moon = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M19.5 14.6A8 8 0 0 1 9.4 4.5a8 8 0 1 0 10.1 10.1z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Expand = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M14 4h6v6M10 20H4v-6\" />\n    <path d=\"M20 4l-6 6M4 20l6-6\" />\n  </Svg>\n)\n\nexport const Inspect = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M4 9V6.5A2.5 2.5 0 0 1 6.5 4H9M15 4h2.5A2.5 2.5 0 0 1 20 6.5V9M4 15v2.5A2.5 2.5 0 0 0 6.5 20H9\" />\n    <path d=\"M13.2 13.2l7.3 2.5-3.1 1.3-1.3 3.1z\" fill=\"currentColor\" strokeWidth={1.5} />\n  </Svg>\n)\n\nexport const Folder = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M3.5 9.5V17a3 3 0 0 0 3 3h11a3 3 0 0 0 3-3v-6.5a3 3 0 0 0-3-3h-6\" />\n    <path d=\"M3.5 7A2.5 2.5 0 0 1 6 4.5h3.2a2 2 0 0 1 1.6.8l1.5 2.2H3.5z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Copy = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"4\" y=\"4\" width=\"11\" height=\"11\" rx=\"3\" fill=\"currentColor\" stroke=\"none\" />\n    <rect x=\"9\" y=\"9\" width=\"11\" height=\"11\" rx=\"3\" fill=\"var(--icon-cutout, white)\" />\n  </Svg>\n)\n\nexport const Cookie = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M20.6 12.6a8.6 8.6 0 1 1-9.2-9.2 3 3 0 0 0 3.6 3.6 3 3 0 0 0 5.6 5.6z\" />\n    <circle cx=\"9.2\" cy=\"10.4\" r=\"1.7\" fill=\"currentColor\" stroke=\"none\" />\n    <circle cx=\"14.5\" cy=\"15.3\" r=\"1.1\" fill=\"currentColor\" stroke=\"none\" />\n    <circle cx=\"8.8\" cy=\"15.6\" r=\"0.9\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Clock = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"12\" cy=\"12\" r=\"8.5\" />\n    <path d=\"M12 7.2v5.2l3.4 2.1\" strokeWidth={2.4} />\n  </Svg>\n)\n\nexport const ArrowLeft = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M19 12H7\" />\n    <path d=\"M10.5 6.5 4.5 12l6 5.5z\" fill=\"currentColor\" />\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=\"3.5\" />\n    <path d=\"M4.4 7.6A3.5 3.5 0 0 1 7 5.5h10a3.5 3.5 0 0 1 2.6 2.1L12 13z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const ArrowUp = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M12 20v-9\" />\n    <path d=\"M12 3.8 6.6 10.2h10.8z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const Stop = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"6.5\" y=\"6.5\" width=\"11\" height=\"11\" rx=\"3\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Bolt = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M13.2 3.2 5.8 13h5.6l-.6 7.8 7.4-9.8h-5.6z\" fill=\"currentColor\" strokeWidth={1.6} />\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=\"2.1\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Search = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"10.5\" cy=\"10.5\" r=\"6.2\" />\n    <path d=\"M14.9 17.1a1.55 1.55 0 0 1 2.2-2.2l3 3a1.55 1.55 0 0 1-2.2 2.2z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Minus = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M5 12h14\" />\n  </Svg>\n)\n\nexport const Chevrons = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M8 9.5 12 5.5l4 4M8 14.5l4 4 4-4\" />\n  </Svg>\n)\n\nexport const Pencil = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M14.5 5.5 18.5 9.5 9 19H5v-4z\" />\n    <path d=\"M16.2 3.8a2 2 0 0 1 2.8 0l1.2 1.2a2 2 0 0 1 0 2.8l-1.4 1.4-4-4z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const ArrowRight = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M5 12h12\" />\n    <path d=\"M13.5 6.5 19.5 12l-6 5.5z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const Cup = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M5 8h11v6a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5z\" />\n    <path d=\"M16 10h1.5a2.5 2.5 0 0 1 0 5H16\" />\n    <path d=\"M5 8h11v3H5z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Bag = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M5.5 8h13l-1 11.2a2 2 0 0 1-2 1.8h-7a2 2 0 0 1-2-1.8z\" />\n    <path d=\"M9 11V7a3 3 0 0 1 6 0v4\" />\n    <path d=\"M5.6 8h12.8l-.25 3H5.85z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Note = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"3\" y=\"6\" width=\"18\" height=\"12\" rx=\"3\" />\n    <circle cx=\"12\" cy=\"12\" r=\"2.6\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Plane = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M20.5 3.5 3.5 10.6l6.3 2.9 2.9 6.3z\" />\n    <path d=\"M20.5 3.5 9.8 13.5l2.9 6.3z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const Building = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M5 21V6a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v15M16 10h2a2 2 0 0 1 2 2v9M3 21h18\" />\n    <rect x=\"8.5\" y=\"15.5\" width=\"4\" height=\"5.5\" rx=\"1\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const FolderOpen = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M3.5 16.5V7A2.5 2.5 0 0 1 6 4.5h3.2a2 2 0 0 1 1.6.8l1.5 2.2H17a2.5 2.5 0 0 1 2.5 2.5v1\" />\n    <path d=\"M3.5 7A2.5 2.5 0 0 1 6 4.5h3.2a2 2 0 0 1 1.6.8l1.5 2.2H3.5z\" fill=\"currentColor\" stroke=\"none\" />\n    <path d=\"M5.6 11.5h15a1 1 0 0 1 .96 1.27l-1.55 5.6A2.2 2.2 0 0 1 17.9 20H6.1a2.6 2.6 0 0 1-2.6-2.6v-3.8a2.1 2.1 0 0 1 2.1-2.1z\" />\n  </Svg>\n)\n\nexport const Code = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M8 7.5 3.5 12 8 16.5M16 7.5l4.5 4.5-4.5 4.5\" />\n    <path d=\"M13.2 4.6a1 1 0 0 1 1.9.6l-4.3 14.2a1 1 0 0 1-1.9-.6z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Wrench = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M15.4 3.6a4.6 4.6 0 0 0-4.3 6.1l-6.6 6.6a2.2 2.2 0 1 0 3.1 3.1l6.6-6.6a4.6 4.6 0 0 0 6.1-4.3l-2.9 2.9-2.6-.6-.6-2.6z\" />\n    <circle cx=\"6\" cy=\"17.9\" r=\"1.1\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Prompt = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M5 7.5 9.5 12 5 16.5\" />\n    <rect x=\"11.5\" y=\"15\" width=\"8\" height=\"2.4\" rx=\"1.2\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Node = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"12\" cy=\"12\" r=\"8\" />\n    <circle cx=\"12\" cy=\"12\" r=\"3.2\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Refresh = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M19.2 13.2A7.4 7.4 0 1 1 16.8 6\" />\n    <path d=\"M19.6 3.4v6.2h-6.2z\" fill=\"currentColor\" />\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=\"M8 10.5 11.5 4a1.7 1.7 0 0 1 3.1 1.2l-.7 4h5a2 2 0 0 1 2 2.4l-1.2 6.3A2 2 0 0 1 17.7 19.5H8\" />\n    <rect x=\"3\" y=\"10.5\" width=\"5\" height=\"9\" rx=\"1.6\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Chart = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M3.5 17.5 8.5 12l3.5 3.5 5-6\" />\n    <circle cx=\"19.2\" cy=\"7\" r=\"2.6\" fill=\"currentColor\" stroke=\"none\" />\n    <path d=\"M3.5 20.5h17\" />\n  </Svg>\n)\n\nexport const Table = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"3.5\" y=\"4.5\" width=\"17\" height=\"15\" rx=\"3.5\" />\n    <path d=\"M3.5 8a3.5 3.5 0 0 1 3.5-3.5h10A3.5 3.5 0 0 1 20.5 8v1.5h-17z\" fill=\"currentColor\" stroke=\"none\" />\n    <path d=\"M10 9.5v10M3.5 14.5h17\" />\n  </Svg>\n)\n\nexport const Play = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M8 5.8v12.4l9.6-6.2z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const Grip = (p: P) => (\n  <Svg {...p} strokeWidth={3.2}>\n    <path d=\"M9 6.5h.01M15 6.5h.01M9 12h.01M15 12h.01M9 17.5h.01M15 17.5h.01\" />\n  </Svg>\n)\n\nexport const Mic = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"9\" y=\"3\" width=\"6\" height=\"11.5\" rx=\"3\" fill=\"currentColor\" stroke=\"none\" />\n    <path d=\"M5.5 11.5a6.5 6.5 0 0 0 13 0M12 18v3\" />\n  </Svg>\n)\n\nexport const Speaker = ({ muted, ...p }: P & { muted?: boolean }) => (\n  <Svg {...p}>\n    <path d=\"M4 9.5h3.2L12 5.5v13l-4.8-4H4z\" fill=\"currentColor\" />\n    {muted ? <path d=\"M16 9.5l4.5 5M20.5 9.5l-4.5 5\" /> : <path d=\"M15.5 9a4.2 4.2 0 0 1 0 6M18.2 6.5a8 8 0 0 1 0 11\" />}\n  </Svg>\n)\n\nexport const ChevronRight = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M10 6.5l5.5 5.5-5.5 5.5\" />\n  </Svg>\n)\n\nexport const Layers = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M8 4.5h9.5A2.5 2.5 0 0 1 20 7v9.5\" />\n    <rect x=\"4\" y=\"8\" width=\"12\" height=\"12\" rx=\"2.5\" fill=\"currentColor\" stroke=\"none\" />\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-.8.8\" />\n    <path d=\"M13.5 10.5a3.5 3.5 0 0 0-5 0l-3 3a3.5 3.5 0 0 0 5 5l.8-.8\" />\n    <circle cx=\"12\" cy=\"12\" r=\"1.4\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const More = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"6\" cy=\"12\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\" />\n    <circle cx=\"12\" cy=\"12\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\" />\n    <circle cx=\"18\" cy=\"12\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Eye = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z\" />\n    <circle cx=\"12\" cy=\"12\" r=\"3\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const EyeOff = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M6.6 7.2C4 8.9 2.5 12 2.5 12S6 18.5 12 18.5c1.9 0 3.5-.6 4.9-1.5M10 5.7c.6-.1 1.3-.2 2-.2 6 0 9.5 6.5 9.5 6.5s-.8 1.5-2.3 3.1\" />\n    <path d=\"M4 4l16 16\" strokeWidth={2.4} />\n  </Svg>\n)\n\nexport const Alert = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"12\" cy=\"12\" r=\"9\" />\n    <path d=\"M12 7.5v5.5\" />\n    <circle cx=\"12\" cy=\"16.4\" r=\"1.25\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Spark = (p: P) => (\n  <Svg {...p}>\n    <circle cx=\"12\" cy=\"12\" r=\"9\" />\n    <path d=\"M12.8 6.5 8.6 12.6h3.1l-.6 4.9 4.3-6.2h-3.1z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Cube = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M12 3.2 19.6 7.4v9.2L12 20.8l-7.6-4.2V7.4z\" />\n    <path d=\"M12 3.2 19.6 7.4 12 11.6 4.4 7.4z\" fill=\"currentColor\" stroke=\"none\" />\n    <path d=\"M12 11.6v9.2\" />\n  </Svg>\n)\n\nexport const Plug = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M6.5 9.5h11v2.5a5.5 5.5 0 0 1-11 0z\" />\n    <path d=\"M12 17.5V21\" />\n    <rect x=\"8.2\" y=\"3\" width=\"2.2\" height=\"6\" rx=\"1.1\" fill=\"currentColor\" stroke=\"none\" />\n    <rect x=\"13.6\" y=\"3\" width=\"2.2\" height=\"6\" rx=\"1.1\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Fork = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M4 12h6\" />\n    <path d=\"M10 12c3 0 4-5.5 8.5-5.5M10 12c3 0 4 5.5 8.5 5.5\" />\n    <path d=\"M16.5 4.5l2.2 2-2.2 2M16.5 15.5l2.2 2-2.2 2\" />\n    <circle cx=\"10\" cy=\"12\" r=\"2.2\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Shield = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M12 3 19 5.8v5.4c0 4.4-3 7.9-7 9.8-4-1.9-7-5.4-7-9.8V5.8z\" />\n    <path d=\"m8.6 11.8 2.4 2.4 4.6-4.8\" strokeWidth={2.4} />\n  </Svg>\n)\n\nexport const Send = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M20.5 3.5 3.5 10.3l6.6 2.9 2.9 6.6z\" />\n    <path d=\"M20.5 3.5 10.1 13.2l2.9 6.6z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Redo = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M15 9H8.5a4.5 4.5 0 0 0 0 9H14\" />\n    <path d=\"M14.4 4.6 19.4 9l-5 4.4z\" fill=\"currentColor\" />\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.5\" />\n    <path d=\"M7.6 11.2h4.2a1.2 1.2 0 0 1 0 2.4H7.6a1.2 1.2 0 0 1 0-2.4zM7.6 14.6h8.8a1.2 1.2 0 0 1 0 2.4H7.6a1.2 1.2 0 0 1 0-2.4z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Sliders = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M4 8h16M4 16h16\" />\n    <path d=\"M9 5.2a2.8 2.8 0 1 1 0 5.6 2.8 2.8 0 0 1 0-5.6zM15 13.2a2.8 2.8 0 1 1 0 5.6 2.8 2.8 0 0 1 0-5.6z\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Pip = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"3.5\" y=\"5.5\" width=\"17\" height=\"13\" rx=\"3.5\" />\n    <rect x=\"11.5\" y=\"11\" width=\"6.5\" height=\"5\" rx=\"1.4\" fill=\"currentColor\" stroke=\"none\" />\n  </Svg>\n)\n\nexport const Shrink = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M10 4v6H4M14 20v-6h6\" />\n    <path d=\"M4 4l6 6M20 20l-6-6\" />\n  </Svg>\n)\n\nexport const RotateLeft = (p: P) => (\n  <Svg {...p}>\n    <rect x=\"9\" y=\"9.5\" width=\"11\" height=\"10.5\" rx=\"2.4\" />\n    <path d=\"M12.5 5.5H9a5 5 0 0 0-5 5v2\" />\n    <path d=\"M12.2 2.6 15.6 5.5l-3.4 2.9z\" fill=\"currentColor\" />\n  </Svg>\n)\n\nexport const FlipH = (p: P) => (\n  <Svg {...p}>\n    <path d=\"M12 3.5v17\" strokeDasharray=\"2 2.6\" />\n    <path d=\"M9 7.5 3.5 17H9z\" />\n    <path d=\"M15 7.5 20.5 17H15z\" fill=\"currentColor\" />\n  </Svg>\n)\n"},{"path":"components/detent/lib/motion.ts","target":"components/detent/lib/motion.ts","type":"registry:component","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"}]}