{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"upload","title":"Upload","description":"Files hovering tip the folder open; dropped files fall in as sheets.","type":"registry:component","author":"Detent","dependencies":["motion"],"registryDependencies":["https://detentui.com/r/theme.json"],"files":[{"path":"components/detent/components/upload/Upload.tsx","target":"components/detent/components/upload/Upload.tsx","type":"registry:component","content":"'use client'\n\nimport { useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from 'react'\nimport type { ReactNode, Ref } from 'react'\nimport { AnimatePresence, motion } from 'motion/react'\nimport { Check, Close, Upload as UploadIcon } from '@/components/detent/icons'\nimport { ease, spring, dur } from '@/components/detent/lib/motion'\nimport { Button } from '@/components/detent/ui/Button'\nimport { FileGlyph } from '@/components/detent/ui/FileGlyph'\nimport { RollingText } from '@/components/detent/ui/RollingText'\n\ntype Kind = 'image' | 'pdf' | 'video' | 'zip' | 'doc'\ntype Item = { id: string; name: string; size: number; kind: Kind; preview?: string; url?: string; progress: number; done: boolean; speed: number }\n\nexport type UploadHandle = { hover(n: number): void; drop(): void; clear(): void }\n\nconst kindOf = (f: File): Kind => (f.type.startsWith('image/') ? 'image' : f.type === 'application/pdf' ? 'pdf' : f.type.startsWith('video/') ? 'video' : /zip|compressed/.test(f.type) ? 'zip' : 'doc')\nconst fmtSize = (b: number) => (b < 1024 * 1024 ? `${Math.max(1, Math.round(b / 1024))} KB` : `${(b / 1024 / 1024).toFixed(1)} MB`)\nconst hash = (s: string) => Math.abs([...s].reduce((h, c) => (h * 31 + c.charCodeAt(0)) | 0, 7))\n\nlet seq = 0\nconst SAMPLES: Omit<Item, 'id' | 'progress' | 'done' | 'speed'>[] = [\n  { name: 'hero-shot.png', size: 2.4e6, kind: 'image', preview: 'linear-gradient(180deg, #c7d3e6 0%, #e9ddcc 54%, #8e9c7c 55%, #6a7a5c 100%)' },\n  { name: 'Q3 board update.pdf', size: 1.1e6, kind: 'pdf' },\n  { name: 'launch-film.mp4', size: 18.2e6, kind: 'video' },\n]\n\nconst ROW = 56\nconst VISIBLE_ROWS = 3\n\nexport function Upload({\n  accept = 'PNG, JPG, PDF or MP4',\n  onFiles,\n  ref,\n}: {\n  accept?: string\n  onFiles?: (files: File[]) => void\n  ref?: Ref<UploadHandle>\n}) {\n  const filesTo = useRef(onFiles)\n  useLayoutEffect(() => {\n    filesTo.current = onFiles\n  })\n  const [items, setItems] = useState<Item[]>([])\n  const [over, setOver] = useState(0)\n  const depth = useRef(0)\n  const picker = useRef<HTMLInputElement>(null)\n  const itemsRef = useRef(items)\n  itemsRef.current = items\n\n  useEffect(() => {\n    const t = setInterval(() => {\n      if (!itemsRef.current.some((i) => !i.done)) return\n      setItems((list) =>\n        list.map((i) => {\n          if (i.done) return i\n          const p = Math.min(1, i.progress + i.speed * (0.5 + Math.random()))\n          return { ...i, progress: p, done: p >= 1 }\n        }),\n      )\n    }, 140)\n    return () => clearInterval(t)\n  }, [])\n\n  useEffect(() => () => itemsRef.current.forEach((i) => i.url && URL.revokeObjectURL(i.url)), [])\n\n  const add = (list: Omit<Item, 'id' | 'progress' | 'done' | 'speed'>[]) =>\n    setItems((cur) => [...list.map((f, k) => ({ ...f, id: `f${++seq}`, progress: 0, done: false, speed: Math.min(0.12, 0.9 / Math.max(6, f.size / 1e5)) * (1 - k * 0.12) })), ...cur])\n\n  const addFiles = (files: File[]) => {\n    filesTo.current?.(files)\n    return add(\n      files.map((f) => {\n        const kind = kindOf(f)\n        const url = kind === 'image' ? URL.createObjectURL(f) : undefined\n        return { name: f.name, size: f.size, kind, url, preview: url ? `center / cover no-repeat url(\"${url}\")` : undefined }\n      }),\n    )\n  }\n\n  useImperativeHandle(ref, () => ({\n    hover: setOver,\n    drop: () => {\n      setOver(0)\n      add(SAMPLES)\n    },\n    clear: () => setItems([]),\n  }))\n\n  const remove = (id: string) =>\n    setItems((list) => {\n      const gone = list.find((i) => i.id === id)\n      if (gone?.url) URL.revokeObjectURL(gone.url)\n      return list.filter((i) => i.id !== id)\n    })\n\n  const total = items.reduce((n, i) => n + i.size, 0)\n  const sent = items.reduce((n, i) => n + i.size * i.progress, 0)\n  const pct = total ? Math.round((sent / total) * 100) : 0\n  const busy = items.some((i) => !i.done)\n\n  const headline = over ? `Release to add ${over} ${over === 1 ? 'file' : 'files'}` : items.length ? (busy ? 'Uploading' : 'All files uploaded') : 'Drop files into the folder'\n\n  return (\n    <div className=\"w-[440px] max-w-full\">\n      <div\n        role=\"button\"\n        data-invite\n        tabIndex={0}\n        onClick={() => picker.current?.click()}\n        onKeyDown={(e) => (e.key === 'Enter' || e.key === ' ') && (e.preventDefault(), picker.current?.click())}\n        onDragEnter={(e) => {\n          e.preventDefault()\n          depth.current++\n          setOver(e.dataTransfer.items.length || 1)\n        }}\n        onDragOver={(e) => e.preventDefault()}\n        onDragLeave={() => {\n          if (--depth.current <= 0) setOver(0)\n        }}\n        onDrop={(e) => {\n          e.preventDefault()\n          depth.current = 0\n          setOver(0)\n          if (e.dataTransfer.files.length) addFiles(Array.from(e.dataTransfer.files))\n        }}\n        className=\"ring-focus group relative flex h-[292px] cursor-pointer flex-col items-center justify-center rounded-panel bg-surface transition-shadow ease-detent duration-300\"\n        style={{ boxShadow: over ? '0 0 0 2px color-mix(in oklch, var(--ink) 14%, transparent), var(--elev-float)' : 'var(--elev-raised)' }}\n      >\n        <Folder open={!!over} items={items} pct={pct} busy={busy} />\n\n        <div className=\"mt-6 flex h-[42px] flex-col items-center\">\n          <Swap k={headline} className=\"w-[300px] text-headline\">\n            {items.length && !over ? (\n              <span className=\"inline-flex items-center justify-center gap-1.5\">\n                {headline}\n                {busy && <RollingText text={`${pct}%`} className=\"tnum text-ink-2\" />}\n              </span>\n            ) : (\n              headline\n            )}\n          </Swap>\n          <p className=\"mt-0.5 text-footnote text-ink-3\">\n            or <span className=\"text-ink-2 underline decoration-line-strong underline-offset-[3px]\">browse</span> · {accept}\n          </p>\n        </div>\n\n        <input\n          ref={picker}\n          type=\"file\"\n          multiple\n          hidden\n          onChange={(e) => {\n            if (e.target.files?.length) addFiles(Array.from(e.target.files))\n            e.target.value = ''\n          }}\n        />\n      </div>\n\n      <div className=\"relative mt-3\" style={{ height: ROW * VISIBLE_ROWS + 8 }}>\n        <ul className=\"h-full overflow-y-auto pb-2 [scrollbar-width:none]\" style={{ maskImage: items.length > VISIBLE_ROWS ? 'linear-gradient(to bottom, black 80%, transparent)' : undefined }}>\n          <AnimatePresence initial={false}>\n            {items.map((i) => (\n              <motion.li\n                key={i.id}\n                layout=\"position\"\n                initial={{ opacity: 0, y: -8 }}\n                animate={{ opacity: 1, y: 0 }}\n                exit={{ opacity: 0, transition: { duration: dur.exit, ease: ease.out } }}\n                transition={{ duration: 0.3, ease: ease.out }}\n                className=\"flex items-center gap-3 rounded-row px-2.5\"\n                style={{ height: ROW }}\n              >\n                <FileGlyph name={i.name} preview={i.preview} size={34} />\n                <span className=\"min-w-0 flex-1\">\n                  <span className=\"block truncate text-callout font-medium\">{i.name}</span>\n                  <span className=\"relative mt-1.5 block h-[3px] overflow-hidden rounded-full bg-surface-2\">\n                    <motion.span\n                      className=\"absolute inset-y-0 left-0 rounded-full\"\n                      initial={false}\n                      animate={{ width: `${i.progress * 100}%`, backgroundColor: i.done ? 'var(--ok)' : 'var(--ink)' }}\n                      transition={spring.release}\n                    />\n                  </span>\n                </span>\n                <span className=\"tnum w-[64px] shrink-0 text-right text-caption text-ink-3\">{fmtSize(i.size)}</span>\n                <span className=\"relative flex size-7 shrink-0 items-center justify-center\">\n                  <AnimatePresence initial={false}>\n                    {i.done ? (\n                      <motion.span\n                        key=\"ok\"\n                        initial={{ scale: 0.3, opacity: 0 }}\n                        animate={{ scale: 1, opacity: 1 }}\n                        transition={spring.pop}\n                        className=\"absolute flex size-6 items-center justify-center rounded-full bg-ok text-white\"\n                      >\n                        <Check size={14} strokeWidth={2.8} />\n                      </motion.span>\n                    ) : (\n                      <motion.button\n                        key=\"x\"\n                        exit={{ scale: 0.8, opacity: 0 }}\n                        aria-label={`Cancel ${i.name}`}\n                        onClick={() => remove(i.id)}\n                        className=\"ring-focus absolute flex size-7 pointer-coarse:before:absolute pointer-coarse:before:-inset-1 pointer-coarse:before:content-[''] items-center justify-center rounded-full text-ink-3 transition-colors ease-detent duration-150 hover:bg-surface-2 hover:text-ink\" transition={{ duration: dur.enter, ease: ease.out }}\n                      >\n                        <Close size={15} />\n                      </motion.button>\n                    )}\n                  </AnimatePresence>\n                </span>\n              </motion.li>\n            ))}\n          </AnimatePresence>\n        </ul>\n        <AnimatePresence>\n          {!items.length && (\n            <motion.div\n              initial={{ opacity: 0 }}\n              animate={{ opacity: 1 }}\n              exit={{ opacity: 0 }}\n              className=\"pointer-events-none absolute inset-0 flex items-center justify-center rounded-card text-footnote text-ink-3\"\n              style={{ boxShadow: 'inset 0 0 0 1.5px var(--line)' }} transition={{ duration: dur.enter, ease: ease.out }}\n            >\n              Files you add will appear here\n            </motion.div>\n          )}\n        </AnimatePresence>\n      </div>\n\n      <Button variant=\"ghost\" size=\"sm\" onClick={() => add(SAMPLES)} className=\"mt-1 w-full text-ink-3\">\n        Try with sample files\n      </Button>\n    </div>\n  )\n}\n\nconst FW = 224\nconst FH = 168\nconst PLACEHOLDERS = ['p1', 'p2']\n\nfunction Folder({ open, items, pct, busy }: { open: boolean; items: Item[]; pct: number; busy: boolean }) {\n  const sheets = items.slice(0, 4).reverse()\n  const papers: { id: string; item?: Item }[] = sheets.length ? sheets.map((s) => ({ id: s.id, item: s })) : PLACEHOLDERS.map((id) => ({ id }))\n  return (\n    <div className=\"relative\" style={{ width: FW, height: FH, perspective: 720 }}>\n      <div className=\"absolute left-0 top-0 h-[30px] w-[96px] bg-[var(--folder-back)]\" style={{ borderRadius: '14px 14px 0 0', clipPath: 'polygon(0 0, 78% 0, 100% 100%, 0 100%)' }} />\n      <div className=\"absolute inset-x-0 bottom-0 top-[22px] rounded-[18px] bg-[var(--folder-back)]\" style={{ boxShadow: 'inset 0 -12px 24px -16px rgb(0 0 0 / 0.25)' }} />\n\n      <AnimatePresence initial={false}>\n        {papers.map((p, k) => {\n          const h = hash(p.id)\n          const rot = ((h % 7) - 3) * 1.4\n          const dx = ((h % 5) - 2) * 3\n          const depth = papers.length - 1 - k\n          return (\n            <motion.div\n              key={p.id}\n              className=\"absolute left-1/2 top-[36px] flex flex-col overflow-hidden rounded-[10px] bg-[var(--sheet)] p-1.5\"\n              style={{ width: 172, height: 112, marginLeft: -86, boxShadow: 'inset 0 1px 0 rgb(255 255 255 / 0.6), 0 4px 10px -4px rgb(0 0 0 / 0.22)' }}\n              initial={p.item ? { y: -150, rotate: rot * 3, opacity: 0, scale: 0.92 } : false}\n              animate={{ y: (open ? -16 : 0) - depth * 6, x: dx, rotate: rot, opacity: 1, scale: 1 }}\n              exit={{ opacity: 0, y: -20, transition: { duration: dur.exit, ease: ease.out } }}\n              transition={{ ...spring.soft, delay: p.item ? k * 0.08 : 0 }}\n            >\n              {p.item ? <SheetFace item={p.item} /> : <span className=\"flex-1 rounded-[7px] bg-[var(--sheet-line)] opacity-60\" />}\n            </motion.div>\n          )\n        })}\n      </AnimatePresence>\n\n      <motion.div\n        className=\"absolute inset-x-0 bottom-0 h-[112px] rounded-[18px] bg-[var(--folder-front)]\"\n        style={{ transformOrigin: '50% 100%', boxShadow: 'inset 0 1px 0 light-dark(rgb(255 255 255 / 0.55), transparent), inset 0 0 0 1px light-dark(transparent, rgb(255 255 255 / 0.145)), 0 -8px 20px -12px rgb(0 0 0 / 0.25)' }}\n        animate={{ rotateX: open ? -30 : 0 }}\n        transition={open ? spring.soft : spring.pop}\n      >\n        <motion.div className=\"pointer-events-none absolute inset-0 rounded-[18px] bg-black\" initial={false} animate={{ opacity: open ? 0.08 : 0 }} transition={{ duration: 0.3, ease: ease.out }} />\n        <div className=\"absolute inset-x-0 top-[34px] flex justify-center text-[var(--folder-ink)]\">\n          <motion.span animate={{ y: open ? -3 : 0 }} transition={spring.snappy}>\n            <UploadIcon size={26} />\n          </motion.span>\n        </div>\n        <AnimatePresence>\n          {busy && (\n            <motion.div\n              initial={{ opacity: 0 }}\n              animate={{ opacity: 1 }}\n              exit={{ opacity: 0, transition: { duration: dur.exit, ease: ease.out, delay: dur.enter } }}\n              className=\"absolute inset-x-6 bottom-5 h-[4px] overflow-hidden rounded-full bg-black/[0.08] dark:bg-white/[0.1]\" transition={{ duration: dur.enter, ease: ease.out }}\n            >\n              <motion.div className=\"h-full rounded-full bg-[var(--folder-ink)]\" initial={false} animate={{ width: `${pct}%` }} transition={spring.release} />\n            </motion.div>\n          )}\n        </AnimatePresence>\n      </motion.div>\n    </div>\n  )\n}\n\nfunction SheetFace({ item }: { item: Item }) {\n  return (\n    <>\n      <span\n        className=\"flex h-[62px] items-center justify-center rounded-[7px] text-[10px] font-semibold tracking-[0.06em] text-[var(--folder-ink)]\"\n        style={{ background: item.preview ?? 'color-mix(in oklch, var(--sheet-line) 55%, var(--sheet))' }}\n      >\n        {!item.preview && (item.name.split('.').pop() ?? '').toUpperCase()}\n      </span>\n      <span className=\"mt-1.5 truncate px-0.5 text-caption font-medium text-[#3a3a3f]\">{item.name}</span>\n      <span className=\"mt-1 h-[3px] w-1/2 rounded-full bg-[var(--sheet-line)]\" />\n    </>\n  )\n}\n\nfunction Swap({ k, className, children }: { k: string; className: string; children: ReactNode }) {\n  return (\n    <span className={`relative block h-[22px] overflow-hidden ${className}`}>\n      <AnimatePresence initial={false}>\n        <motion.span\n          key={k}\n          className=\"absolute inset-0 flex items-center justify-center whitespace-nowrap\"\n          initial={{ opacity: 0, y: 8 }}\n          animate={{ opacity: 1, y: 0 }}\n          exit={{ opacity: 0, y: -8 }}\n          transition={{ duration: 0.22, ease: ease.out }}\n        >\n          {children}\n        </motion.span>\n      </AnimatePresence>\n    </span>\n  )\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"},{"path":"components/detent/ui/Button.tsx","target":"components/detent/ui/Button.tsx","type":"registry:component","content":"'use client'\n\nimport type { ComponentProps, ReactNode } from 'react'\nimport { AnimatePresence, motion } from 'motion/react'\nimport { ease, press } from '@/components/detent/lib/motion'\nimport { Spinner } from '@/components/detent/ui/Spinner'\nimport { tap } from '@/components/detent/lib/feel'\n\nexport type Variant = 'primary' | 'secondary' | 'ghost' | 'danger'\nexport type Size = 'sm' | 'md' | 'lg'\n\nconst SIZE: Record<Size, string> = {\n  sm: 'h-8 pointer-coarse:h-9 gap-1.5 rounded-[9px] px-3 text-footnote',\n  md: 'h-9 gap-2 rounded-control px-3.5 text-callout',\n  lg: 'h-11 gap-2 rounded-row px-5 text-body',\n}\nconst ICON: Record<Size, string> = { sm: 'size-8 pointer-coarse:size-9 rounded-[9px]', md: 'size-9 rounded-control', lg: 'size-11 rounded-row' }\n\nconst VARIANT: Record<Variant, string> = {\n  primary: 'bg-ink text-surface shadow-[inset_0_1px_0_rgb(255_255_255/0.14),0_1px_2px_rgb(0_0_0/0.16)] hover:bg-[color-mix(in_oklch,var(--ink),var(--surface)_14%)]',\n  secondary: 'bg-surface text-ink shadow-raised hover:shadow-[var(--elev-raised-hover)]',\n  ghost: 'text-ink-2 hover:bg-surface-2 hover:text-ink active:bg-surface-3',\n  danger: 'chip text-danger [--chip-wash:11%] [--chip:var(--danger)] hover:[--chip-wash:17%]',\n}\n\nexport const buttonClass = (variant: Variant = 'secondary', size: Size = 'md', icon = false) =>\n  `sink ring-focus relative inline-flex shrink-0 select-none items-center justify-center font-medium transition-[background-color,color,box-shadow] ease-detent duration-150 disabled:pointer-events-none disabled:opacity-45 ${icon ? ICON[size] : SIZE[size]} ${VARIANT[variant]}`\n\nexport function Button({\n  variant = 'secondary',\n  size = 'md',\n  icon,\n  loading = false,\n  done,\n  children,\n  className = '',\n  onPointerDown,\n  ...rest\n}: Omit<ComponentProps<typeof motion.button>, 'children'> & {\n  variant?: Variant\n  size?: Size\n  icon?: boolean\n  loading?: boolean\n  done?: ReactNode\n  children?: ReactNode\n}) {\n  const hidden = loading || !!done\n  return (\n    <motion.button\n      type=\"button\"\n      whileTap={rest.disabled || loading ? undefined : press}\n      aria-busy={loading || undefined}\n      onPointerDown={(e) => {\n        if (!rest.disabled && !loading) tap()\n        onPointerDown?.(e)\n      }}\n      className={`${buttonClass(variant, size, icon)} ${className}`}\n      {...rest}\n    >\n      <motion.span\n        className=\"inline-flex items-center gap-[inherit]\"\n        initial={false}\n        animate={{ opacity: hidden ? 0 : 1, y: done && !loading ? -6 : 0 }}\n        transition={{ duration: 0.16, ease: ease.out }}\n      >\n        {children}\n      </motion.span>\n      <AnimatePresence>\n        {loading && (\n          <motion.span\n            className=\"absolute inset-0 flex items-center justify-center\"\n            initial={{ opacity: 0 }}\n            animate={{ opacity: 1 }}\n            exit={{ opacity: 0 }}\n            transition={{ duration: 0.16, ease: ease.out }}\n          >\n            <Spinner size={size === 'lg' ? 18 : 16} />\n          </motion.span>\n        )}\n        {done && !loading && (\n          <motion.span\n            key=\"done\"\n            className=\"absolute inset-0 flex items-center justify-center gap-[inherit]\"\n            initial={{ opacity: 0, y: 6 }}\n            animate={{ opacity: 1, y: 0 }}\n            exit={{ opacity: 0 }}\n            transition={{ duration: 0.2, ease: ease.out }}\n          >\n            {done}\n          </motion.span>\n        )}\n      </AnimatePresence>\n    </motion.button>\n  )\n}\n"},{"path":"components/detent/ui/FileGlyph.tsx","target":"components/detent/ui/FileGlyph.tsx","type":"registry:component","content":"'use client'\n\nconst KIND: [RegExp, string][] = [\n  [/^pdf$/, 'light-dark(oklch(0.57 0.17 18), oklch(0.74 0.14 18))'],\n  [/^(fig|sketch|xd)$/, 'light-dark(oklch(0.55 0.2 300), oklch(0.74 0.15 300))'],\n  [/^(mp4|mov|webm)$/, 'light-dark(oklch(0.55 0.19 268), oklch(0.74 0.13 268))'],\n  [/^(png|jpe?g|gif|webp|svg)$/, 'light-dark(oklch(0.56 0.13 160), oklch(0.76 0.12 160))'],\n  [/^(ts|tsx|js|jsx|json)$/, 'light-dark(oklch(0.56 0.14 238), oklch(0.76 0.11 238))'],\n  [/^(csv|xlsx?)$/, 'light-dark(oklch(0.56 0.13 150), oklch(0.76 0.12 150))'],\n  [/^(zip|tar|gz)$/, 'light-dark(oklch(0.6 0.13 70), oklch(0.8 0.12 75))'],\n]\n\nexport const fileTint = (name: string) => {\n  const ext = (name.includes('.') ? name.split('.').pop()! : '').toLowerCase()\n  return KIND.find(([re]) => re.test(ext))?.[1] ?? null\n}\n\nexport function FileGlyph({ name, size = 34, preview, className = '' }: { name: string; size?: number; preview?: string; className?: string }) {\n  const ext = (name.includes('.') ? name.split('.').pop()! : '').slice(0, 4).toUpperCase()\n  const tint = fileTint(name)\n  const width = Math.round(size * (28 / 34))\n  if (preview)\n    return (\n      <span\n        aria-hidden\n        className={`block shrink-0 rounded-[6px] ${className}`}\n        style={{ width, height: size, background: preview, boxShadow: 'inset 0 0 0 1px rgb(0 0 0 / 0.08)' }}\n      />\n    )\n  return (\n    <svg aria-hidden width={width} height={size} viewBox=\"0 0 28 34\" fill=\"none\" className={`shrink-0 ${className}`}>\n      <path d=\"M5 .5h12.4c.8 0 1.5.3 2.1.9l7.1 7.1c.6.6.9 1.3.9 2.1V29a4.5 4.5 0 0 1-4.5 4.5H5A4.5 4.5 0 0 1 .5 29V5A4.5 4.5 0 0 1 5 .5Z\" fill=\"var(--surface)\" stroke=\"var(--line-strong)\" />\n      <path\n        d=\"M17.5.8V6A3.5 3.5 0 0 0 21 9.5h6.2Z\"\n        strokeLinejoin=\"round\"\n        style={{ fill: tint ? `color-mix(in oklch, ${tint} 22%, var(--surface))` : 'var(--surface-2)', stroke: tint ? `color-mix(in oklch, ${tint} 55%, var(--line-strong))` : 'var(--line-strong)' }}\n      />\n      {ext && (\n        <text x=\"14\" y=\"27.5\" textAnchor=\"middle\" fontSize=\"6.4\" fontWeight=\"650\" letterSpacing=\"0.3\" style={{ fontFamily: 'var(--font-sans)', fill: tint ?? 'var(--ink-3)' }}>\n          {ext}\n        </text>\n      )}\n    </svg>\n  )\n}\n"},{"path":"components/detent/ui/RollingText.tsx","target":"components/detent/ui/RollingText.tsx","type":"registry:component","content":"'use client'\n\nimport { useLayoutEffect, useRef, useState } from 'react'\nimport { animate, motion, useMotionValue } from 'motion/react'\n\nconst roll = { type: 'spring', stiffness: 380, damping: 34, mass: 0.8 } as const\n\nexport function RollingText({ text, className = '', proportional = false, still = false }: { text: string; className?: string; proportional?: boolean; still?: boolean }) {\n  const chars = [...text]\n  const probe = useRef<HTMLSpanElement>(null)\n  const [widths, setWidths] = useState<number[] | null>(null)\n\n  useLayoutEffect(() => {\n    if (!proportional || !probe.current) return\n    const read = () => {\n      const box = probe.current!\n      const z = box.offsetWidth ? box.getBoundingClientRect().width / box.offsetWidth : 1\n      const em = parseFloat(getComputedStyle(box).fontSize) || 16\n      setWidths([...box.children].map((c) => (c as HTMLElement).getBoundingClientRect().width / z / em))\n    }\n    read()\n    document.fonts?.ready.then(read)\n  }, [proportional])\n\n  return (\n    <span className={`relative inline-flex ${proportional ? '' : 'tnum'} ${className}`} style={{ lineHeight: '1.25em', height: '1.25em' }}>\n      <span className=\"sr-only\">{text}</span>\n      {proportional && (\n        <span aria-hidden className=\"pointer-events-none absolute left-0 top-0 size-0 overflow-hidden\">\n          <span ref={probe} className=\"invisible flex w-max whitespace-pre\">\n            {Array.from({ length: 10 }, (_, n) => (\n              <span key={n}>{n}</span>\n            ))}\n          </span>\n        </span>\n      )}\n      {chars.map((c, i) => {\n        const key = chars.length - i\n        return /\\d/.test(c) ? (\n          <Digit key={key} d={+c} width={proportional && widths ? widths[+c] : undefined} still={still} />\n        ) : (\n          <span key={`${key}${c}`} aria-hidden className=\"whitespace-pre\">\n            {c}\n          </span>\n        )\n      })}\n    </span>\n  )\n}\n\nfunction Digit({ d, width, still }: { d: number; width?: number; still: boolean }) {\n  const w = useMotionValue<string>(width === undefined ? '1ch' : `${width}em`)\n  const had = useRef(width !== undefined)\n  useLayoutEffect(() => {\n    if (width === undefined) return\n    if (!had.current) {\n      had.current = true\n      w.set(`${width}em`)\n      return\n    }\n    const ctl = animate(w, `${width}em`, roll)\n    return () => ctl.stop()\n  }, [width, w])\n\n  return (\n    <motion.span aria-hidden className=\"relative inline-block overflow-hidden\" style={{ height: '1.25em', width: w }}>\n      <motion.span className=\"absolute inset-x-0 top-0 flex flex-col items-center\" initial={false} animate={{ y: `${-d * 10}%` }} transition={still ? { duration: 0 } : roll}>\n        {Array.from({ length: 10 }, (_, n) => (\n          <span key={n} className=\"block\" style={{ height: '1.25em' }}>\n            {n}\n          </span>\n        ))}\n      </motion.span>\n    </motion.span>\n  )\n}\n"},{"path":"components/detent/ui/Spinner.tsx","target":"components/detent/ui/Spinner.tsx","type":"registry:component","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/lib/feel.ts","target":"components/detent/lib/feel.ts","type":"registry:component","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"}]}