{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"onboarding-checklist","type":"registry:block","title":"Onboarding Checklist","description":"Getting-started card with a progress ring and bar and steps that expand to a description and an async CTA; finishing a step pops its check, strikes its title and opens the next unfinished step, and at 100% the list gives way to a confetti celebration, with a dismiss that animates the card away.","author":"kara <ztzyrant@gmail.com>","dependencies":["clsx","lucide-react","motion","tailwind-merge"],"registryDependencies":[],"files":[{"path":"components/motion/onboarding-checklist.tsx","type":"registry:component","target":"@components/motion/onboarding-checklist.tsx","content":"\"use client\";\n// karaui.kamisama-v0.my.id/components/blocks/onboarding-checklist\n\nimport { ChevronDown, PartyPopper, X } from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { type ReactNode, useEffect, useRef, useState } from \"react\";\nimport { Button, StatefulButton } from \"@/components/motion/button\";\nimport {\n  Collapsible,\n  CollapsibleContent,\n  CollapsibleTrigger,\n} from \"@/components/motion/collapsible\";\nimport { Progress, ProgressCircle } from \"@/components/motion/progress\";\nimport { EASE_OUT, SPRING_SWAP } from \"@/lib/ease\";\nimport { cn } from \"@/lib/utils\";\n\nexport type OnboardingStep = {\n  id: string;\n  title: string;\n  description?: ReactNode;\n  /** CTA label inside the expanded step. Default \"Mark as done\". */\n  actionLabel?: string;\n  /** Runs when the CTA is pressed; the step completes once it resolves. */\n  onAction?: () => void | Promise<void>;\n};\n\nexport interface OnboardingChecklistProps {\n  steps: OnboardingStep[];\n  /** Controlled completed step ids. */\n  completed?: string[];\n  defaultCompleted?: string[];\n  onCompletedChange?: (completed: string[]) => void;\n  /** Controlled visibility. Dismissing sets it to false. */\n  open?: boolean;\n  defaultOpen?: boolean;\n  onOpenChange?: (open: boolean) => void;\n  dismissible?: boolean;\n  title?: ReactNode;\n  description?: ReactNode;\n  celebrationTitle?: ReactNode;\n  celebrationDescription?: ReactNode;\n  className?: string;\n}\n\nconst NEXT_OPEN_DELAY_MS = 420;\nconst CONFETTI_COLORS = [\"bg-chart-1\", \"bg-chart-2\", \"bg-chart-3\", \"bg-chart-4\", \"bg-chart-5\"];\n// Deterministic burst: evenly spaced angles, alternating distances.\nconst CONFETTI = Array.from({ length: 16 }, (_, i) => {\n  const angle = (i / 16) * Math.PI * 2;\n  const distance = i % 2 === 0 ? 74 : 54;\n  return {\n    id: i,\n    x: Math.round(Math.cos(angle) * distance),\n    y: Math.round(Math.sin(angle) * distance),\n    color: CONFETTI_COLORS[i % CONFETTI_COLORS.length],\n    round: i % 3 === 0,\n  };\n});\n\nfunction CheckMark({ done }: { done: boolean }) {\n  const reduce = useReducedMotion();\n  return (\n    <span className=\"relative grid size-5 shrink-0 place-items-center\">\n      <span\n        className={cn(\n          \"absolute inset-0 rounded-full border-2 transition-colors duration-200\",\n          done ? \"border-primary\" : \"border-border-strong\",\n        )}\n      />\n      <motion.span\n        initial={false}\n        animate={{ scale: done ? 1 : reduce ? 1 : 0.3, opacity: done ? 1 : 0 }}\n        transition={reduce ? { duration: 0.15 } : SPRING_SWAP}\n        className=\"absolute inset-0 rounded-full bg-primary\"\n      />\n      <svg viewBox=\"0 0 20 20\" className=\"relative size-3.5 text-primary-foreground\" fill=\"none\" aria-hidden=\"true\">\n        <motion.path\n          d=\"M5 10.5l3.2 3.2L15 7\"\n          stroke=\"currentColor\"\n          strokeWidth={2.4}\n          strokeLinecap=\"round\"\n          strokeLinejoin=\"round\"\n          initial={false}\n          animate={{ pathLength: done ? 1 : 0, opacity: done ? 1 : 0 }}\n          transition={{ duration: reduce ? 0 : 0.28, delay: done && !reduce ? 0.08 : 0, ease: EASE_OUT }}\n        />\n      </svg>\n    </span>\n  );\n}\n\n/**\n * Getting-started card: a progress ring and bar, steps that expand (via\n * `Collapsible`) to show a description and CTA, a completed step pops its\n * check, strikes its title and auto-opens the next open step, an optional\n * dismiss, and a confetti celebration state once everything is done.\n */\nexport function OnboardingChecklist({\n  steps,\n  completed: completedProp,\n  defaultCompleted = [],\n  onCompletedChange,\n  open: openProp,\n  defaultOpen = true,\n  onOpenChange,\n  dismissible = true,\n  title = \"Get started\",\n  description = \"A few steps to set up your workspace.\",\n  celebrationTitle = \"You're all set!\",\n  celebrationDescription = \"Your workspace is ready. Time to build something.\",\n  className,\n}: OnboardingChecklistProps) {\n  const reduce = useReducedMotion();\n  const [internalCompleted, setInternalCompleted] = useState(defaultCompleted);\n  const completed = completedProp ?? internalCompleted;\n  const [internalOpen, setInternalOpen] = useState(defaultOpen);\n  const visible = openProp ?? internalOpen;\n\n  const [expanded, setExpanded] = useState<string | null>(\n    () => steps.find((s) => !defaultCompleted.includes(s.id))?.id ?? null,\n  );\n  const [pending, setPending] = useState<string | null>(null);\n  const timer = useRef<number | undefined>(undefined);\n  useEffect(() => () => window.clearTimeout(timer.current), []);\n\n  const doneCount = steps.filter((s) => completed.includes(s.id)).length;\n  const allDone = steps.length > 0 && doneCount === steps.length;\n  const percent = steps.length ? Math.round((doneCount / steps.length) * 100) : 0;\n\n  const commit = (next: string[]) => {\n    if (completedProp === undefined) setInternalCompleted(next);\n    onCompletedChange?.(next);\n  };\n\n  const setDone = (id: string, done: boolean) => {\n    const next = done\n      ? [...completed.filter((c) => c !== id), id]\n      : completed.filter((c) => c !== id);\n    commit(next);\n    if (!done) return;\n    window.clearTimeout(timer.current);\n    // Let the check land before the next step unfolds.\n    timer.current = window.setTimeout(() => {\n      const index = steps.findIndex((s) => s.id === id);\n      const following = [...steps.slice(index + 1), ...steps.slice(0, index)].find(\n        (s) => !next.includes(s.id),\n      );\n      setExpanded(following?.id ?? null);\n    }, NEXT_OPEN_DELAY_MS);\n  };\n\n  const runAction = async (step: OnboardingStep) => {\n    setPending(step.id);\n    try {\n      await step.onAction?.();\n      setDone(step.id, true);\n    } finally {\n      setPending(null);\n    }\n  };\n\n  const dismiss = () => {\n    if (openProp === undefined) setInternalOpen(false);\n    onOpenChange?.(false);\n  };\n\n  return (\n    <AnimatePresence initial={false}>\n      {visible ? (\n        <motion.section\n          key=\"checklist\"\n          aria-label=\"Onboarding checklist\"\n          initial={reduce ? { opacity: 0 } : { opacity: 0, y: 12, scale: 0.98 }}\n          animate={{ opacity: 1, y: 0, scale: 1 }}\n          exit={\n            reduce\n              ? { opacity: 0 }\n              : { opacity: 0, y: 8, scale: 0.96, transition: { duration: 0.18, ease: EASE_OUT } }\n          }\n          transition={{ duration: 0.28, ease: EASE_OUT }}\n          className={cn(\n            \"w-full max-w-md overflow-hidden rounded-3xl border border-border bg-card p-5\",\n            className,\n          )}\n        >\n          <header className=\"flex items-start gap-3.5\">\n            <ProgressCircle\n              value={percent}\n              size={44}\n              thickness={4}\n              aria-label=\"Onboarding progress\"\n              className=\"shrink-0 text-[11px]\"\n            />\n            <div className=\"min-w-0 flex-1\">\n              <h2 className=\"text-base font-semibold tracking-tight text-foreground\">{title}</h2>\n              <p className=\"text-sm text-muted-foreground\">\n                {allDone ? \"Everything's done.\" : description}{\" \"}\n                <span className=\"tabular-nums\">\n                  {doneCount}/{steps.length}\n                </span>\n              </p>\n            </div>\n            {dismissible ? (\n              <button\n                type=\"button\"\n                aria-label=\"Dismiss checklist\"\n                onClick={dismiss}\n                className=\"grid size-8 shrink-0 place-items-center rounded-full text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n              >\n                <X className=\"size-4\" aria-hidden />\n              </button>\n            ) : null}\n          </header>\n\n          <Progress\n            value={percent}\n            size=\"sm\"\n            aria-label=\"Steps completed\"\n            showValue={false}\n            className=\"mt-4\"\n            trackClassName=\"bg-foreground/10\"\n          />\n\n          <AnimatePresence mode=\"wait\" initial={false}>\n            {allDone ? (\n              <motion.div\n                key=\"celebrate\"\n                role=\"status\"\n                initial={reduce ? { opacity: 0 } : { opacity: 0, scale: 0.94 }}\n                animate={{ opacity: 1, scale: 1 }}\n                exit={{ opacity: 0, transition: { duration: 0.12 } }}\n                transition={{ duration: 0.3, ease: EASE_OUT }}\n                className=\"flex flex-col items-center gap-3 pt-8 pb-3 text-center\"\n              >\n                <span className=\"relative grid size-16 place-items-center\">\n                  {reduce\n                    ? null\n                    : CONFETTI.map((piece) => (\n                        <motion.span\n                          key={piece.id}\n                          aria-hidden\n                          initial={{ x: 0, y: 0, opacity: 1, scale: 0.6 }}\n                          animate={{ x: piece.x, y: piece.y, opacity: 0, scale: 1 }}\n                          transition={{ duration: 0.9, delay: 0.1, ease: EASE_OUT }}\n                          className={cn(\n                            \"absolute top-1/2 left-1/2 -mt-1 -ml-1 size-2\",\n                            piece.round ? \"rounded-full\" : \"rounded-xs\",\n                            piece.color,\n                          )}\n                        />\n                      ))}\n                  <motion.span\n                    initial={reduce ? { opacity: 0 } : { opacity: 0, scale: 0.4, rotate: -20 }}\n                    animate={{ opacity: 1, scale: 1, rotate: 0 }}\n                    transition={reduce ? { duration: 0.2 } : SPRING_SWAP}\n                    className=\"grid size-16 place-items-center rounded-full bg-muted text-foreground\"\n                  >\n                    <PartyPopper className=\"size-7\" aria-hidden />\n                  </motion.span>\n                </span>\n                <div>\n                  <p className=\"text-base font-semibold text-foreground\">{celebrationTitle}</p>\n                  <p className=\"text-sm text-muted-foreground\">{celebrationDescription}</p>\n                </div>\n                <div className=\"flex gap-2\">\n                  <Button size=\"sm\" variant=\"ghost\" onClick={() => commit([])}>\n                    Start over\n                  </Button>\n                  {dismissible ? (\n                    <Button size=\"sm\" onClick={dismiss}>\n                      Dismiss\n                    </Button>\n                  ) : null}\n                </div>\n              </motion.div>\n            ) : (\n              <motion.ul\n                key=\"steps\"\n                initial={{ opacity: 0 }}\n                animate={{ opacity: 1 }}\n                exit={{ opacity: 0, transition: { duration: 0.12 } }}\n                className=\"mt-3 flex flex-col\"\n              >\n                {steps.map((step) => {\n                  const done = completed.includes(step.id);\n                  const isOpen = expanded === step.id;\n                  return (\n                    <li key={step.id} className=\"border-b border-border last:border-b-0\">\n                      <Collapsible\n                        open={isOpen}\n                        onOpenChange={(next) => setExpanded(next ? step.id : null)}\n                      >\n                        <div className=\"flex items-center gap-3 py-2.5\">\n                          <button\n                            type=\"button\"\n                            aria-pressed={done}\n                            aria-label={`Mark \"${step.title}\" as ${done ? \"not done\" : \"done\"}`}\n                            onClick={() => setDone(step.id, !done)}\n                            className=\"rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card\"\n                          >\n                            <CheckMark done={done} />\n                          </button>\n                          <CollapsibleTrigger className=\"group flex min-w-0 flex-1 items-center justify-between gap-2 rounded-lg text-left outline-none focus-visible:ring-2 focus-visible:ring-ring\">\n                            <span className=\"relative min-w-0 truncate\">\n                              <span\n                                className={cn(\n                                  \"text-sm font-medium transition-colors duration-200\",\n                                  done ? \"text-muted-foreground\" : \"text-foreground\",\n                                )}\n                              >\n                                {step.title}\n                              </span>\n                              {/* Strike line draws left→right on an HTML span. */}\n                              <motion.span\n                                aria-hidden\n                                initial={false}\n                                animate={{ scaleX: done ? 1 : 0 }}\n                                transition={{ duration: reduce ? 0 : 0.3, ease: EASE_OUT }}\n                                className=\"absolute top-1/2 left-0 h-px w-full origin-left bg-muted-foreground\"\n                              />\n                            </span>\n                            <motion.span\n                              aria-hidden\n                              animate={{ rotate: isOpen ? 180 : 0 }}\n                              transition={reduce ? { duration: 0 } : SPRING_SWAP}\n                              className=\"shrink-0 text-muted-foreground\"\n                            >\n                              <ChevronDown className=\"size-4\" />\n                            </motion.span>\n                          </CollapsibleTrigger>\n                        </div>\n                        <CollapsibleContent innerClassName=\"pb-3 pl-8\">\n                          {step.description ? (\n                            <p className=\"text-sm text-muted-foreground\">{step.description}</p>\n                          ) : null}\n                          {done ? (\n                            <p className=\"mt-2 text-xs font-medium text-success\">Completed</p>\n                          ) : (\n                            <StatefulButton\n                              size=\"sm\"\n                              className=\"mt-2.5\"\n                              state={pending === step.id ? \"loading\" : \"idle\"}\n                              loadingText=\"Working\"\n                              onClick={() => void runAction(step)}\n                            >\n                              {step.actionLabel ?? \"Mark as done\"}\n                            </StatefulButton>\n                          )}\n                        </CollapsibleContent>\n                      </Collapsible>\n                    </li>\n                  );\n                })}\n              </motion.ul>\n            )}\n          </AnimatePresence>\n        </motion.section>\n      ) : null}\n    </AnimatePresence>\n  );\n}\n"},{"path":"components/motion/button/index.tsx","type":"registry:component","target":"@components/motion/button/index.tsx","content":"export type {\n  ButtonLinkProps,\n  ButtonProps,\n  ButtonSize,\n  ButtonVariant,\n} from \"./base\";\nexport { Button, ButtonLink } from \"./base\";\nexport type { MagneticButtonProps } from \"./magnetic\";\nexport { MagneticButton } from \"./magnetic\";\nexport type { ButtonState, StatefulButtonProps } from \"./stateful\";\nexport { StatefulButton } from \"./stateful\";\n"},{"path":"components/motion/collapsible.tsx","type":"registry:component","target":"@components/motion/collapsible.tsx","content":"\"use client\";\n\nimport { motion, useReducedMotion, type Transition } from \"motion/react\";\nimport {\n  cloneElement,\n  createContext,\n  forwardRef,\n  isValidElement,\n  useCallback,\n  useContext,\n  useId,\n  useState,\n  type ButtonHTMLAttributes,\n  type HTMLAttributes,\n  type MouseEvent,\n  type ReactElement,\n  type ReactNode,\n} from \"react\";\nimport { EASE_OUT } from \"@/lib/ease\";\nimport { cn } from \"@/lib/utils\";\n\n// Collapsible is the unstyled disclosure primitive: one trigger, one panel.\n// `Accordion` (accordion.tsx) is built from it; `BouncyAccordion` is the\n// springy, single-open icon-row variant. Reach for this when a single region\n// should show or hide in flow (\"Show 3 more\", an expandable activity row).\n\n/** Entrance is a touch longer than the exit — exits should feel faster. */\nconst OPEN_TRANSITION: Transition = { duration: 0.28, ease: EASE_OUT };\nconst CLOSE_TRANSITION: Transition = { duration: 0.2, ease: EASE_OUT };\n\ninterface CollapsibleContextValue {\n  open: boolean;\n  setOpen: (open: boolean) => void;\n  disabled: boolean;\n  triggerId: string;\n  contentId: string;\n}\n\nconst CollapsibleContext = createContext<CollapsibleContextValue | null>(null);\n\nexport function useCollapsible(component = \"useCollapsible\") {\n  const context = useContext(CollapsibleContext);\n  if (!context) {\n    throw new Error(`${component} must be used within <Collapsible>.`);\n  }\n  return context;\n}\n\nexport interface CollapsibleProps\n  extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n  /** Controlled open state. */\n  open?: boolean;\n  /** Initial open state when uncontrolled. */\n  defaultOpen?: boolean;\n  onOpenChange?: (open: boolean) => void;\n  disabled?: boolean;\n  /** Override the generated trigger id (the content is labelled by it). */\n  triggerId?: string;\n  /** Override the generated content id (the trigger controls it). */\n  contentId?: string;\n  children?: ReactNode;\n}\n\nexport const Collapsible = forwardRef<HTMLDivElement, CollapsibleProps>(\n  function Collapsible(\n    {\n      open: openProp,\n      defaultOpen = false,\n      onOpenChange,\n      disabled = false,\n      triggerId: triggerIdProp,\n      contentId: contentIdProp,\n      className,\n      children,\n      ...rest\n    },\n    ref,\n  ) {\n    const [internal, setInternal] = useState(defaultOpen);\n    const controlled = openProp !== undefined;\n    const open = controlled ? openProp : internal;\n    const setOpen = useCallback(\n      (next: boolean) => {\n        if (!controlled) setInternal(next);\n        onOpenChange?.(next);\n      },\n      [controlled, onOpenChange],\n    );\n    const baseId = useId();\n    const triggerId = triggerIdProp ?? `${baseId}-trigger`;\n    const contentId = contentIdProp ?? `${baseId}-content`;\n\n    return (\n      <CollapsibleContext.Provider\n        value={{ open, setOpen, disabled, triggerId, contentId }}\n      >\n        <div\n          ref={ref}\n          data-state={open ? \"open\" : \"closed\"}\n          data-disabled={disabled ? \"\" : undefined}\n          className={cn(className)}\n          {...rest}\n        >\n          {children}\n        </div>\n      </CollapsibleContext.Provider>\n    );\n  },\n);\n\ntype ClonableChild = ReactElement<{\n  onClick?: (event: MouseEvent<HTMLElement>) => void;\n  [key: string]: unknown;\n}>;\n\nexport interface CollapsibleTriggerProps\n  extends ButtonHTMLAttributes<HTMLButtonElement> {\n  /** Merge trigger behaviour onto the single child element instead of rendering a `<button>`. */\n  asChild?: boolean;\n}\n\n/** Toggles the nearest `Collapsible`. Unstyled `<button>` by default. */\nexport const CollapsibleTrigger = forwardRef<\n  HTMLButtonElement,\n  CollapsibleTriggerProps\n>(function CollapsibleTrigger(\n  { asChild, children, onClick, className, disabled: disabledProp, ...rest },\n  ref,\n) {\n  const context = useCollapsible(\"CollapsibleTrigger\");\n  const disabled = context.disabled || Boolean(disabledProp);\n  const shared = {\n    id: context.triggerId,\n    \"aria-expanded\": context.open,\n    \"aria-controls\": context.contentId,\n    \"data-state\": context.open ? \"open\" : \"closed\",\n    \"data-disabled\": disabled ? \"\" : undefined,\n  };\n\n  if (asChild && isValidElement(children)) {\n    const child = children as ClonableChild;\n    return cloneElement(child, {\n      ...shared,\n      onClick: (event: MouseEvent<HTMLElement>) => {\n        child.props.onClick?.(event);\n        if (!event.defaultPrevented && !disabled) context.setOpen(!context.open);\n      },\n    });\n  }\n\n  return (\n    <button\n      ref={ref}\n      type=\"button\"\n      disabled={disabled}\n      className={cn(className)}\n      {...rest}\n      {...shared}\n      onClick={(event) => {\n        onClick?.(event);\n        if (!event.defaultPrevented) context.setOpen(!context.open);\n      }}\n    >\n      {children}\n    </button>\n  );\n});\n\nexport interface CollapsibleContentProps extends HTMLAttributes<HTMLDivElement> {\n  /** Class for the inner wrapper that holds the children (padding goes here,\n   * never on the animated outer element, so the closed height is truly 0). */\n  innerClassName?: string;\n  /** Set to give the panel `role=\"region\"` labelled by its trigger. */\n  region?: boolean;\n  children?: ReactNode;\n}\n\n/** The disclosed panel. Stays mounted (inert while closed) so `aria-controls` always resolves. */\nexport function CollapsibleContent({\n  className,\n  innerClassName,\n  region = false,\n  children,\n  style,\n  ...rest\n}: CollapsibleContentProps) {\n  const { open, triggerId, contentId } = useCollapsible(\"CollapsibleContent\");\n  const reduce = useReducedMotion();\n  const fade = open ? OPEN_TRANSITION : CLOSE_TRANSITION;\n\n  return (\n    // Height is animated on purpose: disclosure is a layout job — the panel\n    // has to push the content below it down in flow, which transforms can't.\n    // Reduced motion snaps the height and keeps only the opacity fade.\n    <motion.div\n      {...(rest as Record<string, unknown>)}\n      id={contentId}\n      role={region ? \"region\" : undefined}\n      aria-labelledby={region ? triggerId : undefined}\n      data-state={open ? \"open\" : \"closed\"}\n      inert={!open}\n      initial={false}\n      animate={{ height: open ? \"auto\" : 0, opacity: open ? 1 : 0 }}\n      transition={\n        reduce ? { height: { duration: 0 }, opacity: { duration: 0.15 } } : fade\n      }\n      style={style}\n      className={cn(\"overflow-hidden\", className)}\n    >\n      <div className={innerClassName}>{children}</div>\n    </motion.div>\n  );\n}\n"},{"path":"components/motion/progress.tsx","type":"registry:component","target":"@components/motion/progress.tsx","content":"\"use client\";\n\nimport {\n  motion,\n  useReducedMotion,\n  useSpring,\n  useTransform,\n} from \"motion/react\";\nimport { type ReactNode, useEffect, useId, useRef } from \"react\";\nimport { NumberTicker } from \"@/components/motion/number-ticker\";\nimport { EASE_IN_OUT, EASE_OUT, SPRING_GLIDE } from \"@/lib/ease\";\nimport { cn } from \"@/lib/utils\";\n\nexport type ProgressSize = \"sm\" | \"md\" | \"lg\";\n\n// Reduced motion: indeterminate states drop every transform and keep a calm\n// opacity pulse (same rhythm as Loader's reduced variant).\nconst REDUCED_PULSE = {\n  animate: { opacity: [0.35, 0.85, 0.35] },\n  transition: { duration: 1.4, ease: EASE_IN_OUT, repeat: Infinity },\n};\n\nconst clamp01 = (n: number) => (Number.isFinite(n) ? Math.min(1, Math.max(0, n)) : 0);\n\n/**\n * A spring-smoothed 0..1 fraction. Uses SPRING_GLIDE (critically damped) so\n * the fill never rebounds past the true value. Reduced motion jumps instead.\n */\nfunction useFraction(fraction: number) {\n  const reduce = useReducedMotion();\n  const spring = useSpring(0, SPRING_GLIDE);\n  useEffect(() => {\n    if (reduce) spring.jump(fraction);\n    else spring.set(fraction);\n  }, [fraction, reduce, spring]);\n  return spring;\n}\n\nfunction defaultValueText(percent: number) {\n  return `${percent}%`;\n}\n\ninterface ProgressCommonProps {\n  /** Current value. Omit (or pass `null`) together with `indeterminate`. */\n  value?: number | null;\n  /** Upper bound. Defaults to 100. */\n  max?: number;\n  /** Unknown-duration mode: a sliding segment (bar) or a spinning arc (circle). */\n  indeterminate?: boolean;\n  /** Visible label. When it is not a string, also pass `aria-label`. */\n  label?: ReactNode;\n  /** Show the rolling percentage. */\n  showValue?: boolean;\n  /** Screen-reader value text. Defaults to \"42%\". */\n  getValueText?: (percent: number, value: number, max: number) => string;\n  \"aria-label\"?: string;\n  className?: string;\n}\n\nfunction useProgressState(\n  value: number | null | undefined,\n  max: number,\n  indeterminate: boolean,\n) {\n  const safeMax = max > 0 ? max : 100;\n  const isIndeterminate = indeterminate || value == null;\n  const current = isIndeterminate ? 0 : Math.min(safeMax, Math.max(0, value ?? 0));\n  const fraction = clamp01(current / safeMax);\n  const percent = Math.round(fraction * 100);\n  return { safeMax, isIndeterminate, current, fraction, percent };\n}\n\n/* -------------------------------------------------------------------------- */\n/*                                  Progress                                  */\n/* -------------------------------------------------------------------------- */\n\nconst TRACK_SIZE: Record<ProgressSize, string> = {\n  sm: \"h-1\",\n  md: \"h-2\",\n  lg: \"h-3\",\n};\n\nexport interface ProgressProps extends ProgressCommonProps {\n  size?: ProgressSize;\n  /** Classes for the fill (e.g. `bg-emerald-500`). */\n  indicatorClassName?: string;\n  /** Classes for the track. */\n  trackClassName?: string;\n}\n\n/**\n * Linear progress bar. The fill is an HTML element scaled on X from its left\n * edge (transform only), smoothed by a critically damped spring.\n */\nexport function Progress({\n  value,\n  max = 100,\n  indeterminate = false,\n  label,\n  showValue = false,\n  size = \"md\",\n  getValueText = defaultValueText,\n  indicatorClassName,\n  trackClassName,\n  className,\n  \"aria-label\": ariaLabel,\n}: ProgressProps) {\n  const reduce = useReducedMotion();\n  const labelId = useId();\n  const { safeMax, isIndeterminate, current, fraction, percent } =\n    useProgressState(value, max, indeterminate);\n  const scaleX = useFraction(fraction);\n  const hasHeader = label != null || (showValue && !isIndeterminate);\n\n  return (\n    <div\n      role=\"progressbar\"\n      aria-label={ariaLabel ?? (typeof label === \"string\" ? label : undefined)}\n      aria-labelledby={ariaLabel == null && label != null && typeof label !== \"string\" ? labelId : undefined}\n      aria-valuemin={0}\n      aria-valuemax={safeMax}\n      aria-valuenow={isIndeterminate ? undefined : current}\n      aria-valuetext={\n        isIndeterminate ? undefined : getValueText(percent, current, safeMax)\n      }\n      className={cn(\"flex w-full flex-col gap-2\", className)}\n    >\n      {hasHeader ? (\n        <div className=\"flex items-baseline justify-between gap-3 text-sm\">\n          {label != null ? (\n            <span id={labelId} className=\"min-w-0 truncate font-medium text-foreground\">\n              {label}\n            </span>\n          ) : (\n            <span />\n          )}\n          {showValue && !isIndeterminate ? (\n            <span aria-hidden=\"true\" className=\"shrink-0 text-muted-foreground\">\n              <NumberTicker\n                value={percent}\n                suffix=\"%\"\n                startOnView={false}\n                duration={0.45}\n                stagger={0}\n              />\n            </span>\n          ) : null}\n        </div>\n      ) : null}\n      <div\n        className={cn(\n          \"relative w-full overflow-hidden rounded-full bg-foreground/10\",\n          TRACK_SIZE[size],\n          trackClassName,\n        )}\n      >\n        {isIndeterminate ? (\n          reduce ? (\n            <motion.div\n              className={cn(\"absolute inset-0 rounded-full bg-primary\", indicatorClassName)}\n              animate={REDUCED_PULSE.animate}\n              transition={REDUCED_PULSE.transition}\n            />\n          ) : (\n            // A 40%-wide segment travels from fully off the left edge\n            // (-100% of itself) to fully off the right (250% of itself).\n            <motion.div\n              className={cn(\n                \"absolute inset-y-0 left-0 w-2/5 rounded-full bg-primary\",\n                indicatorClassName,\n              )}\n              initial={{ x: \"-100%\" }}\n              animate={{ x: \"250%\" }}\n              transition={{ duration: 1.4, ease: EASE_IN_OUT, repeat: Infinity }}\n            />\n          )\n        ) : (\n          <motion.div\n            className={cn(\n              \"absolute inset-0 origin-left rounded-full bg-primary\",\n              indicatorClassName,\n            )}\n            style={{ scaleX }}\n          />\n        )}\n      </div>\n    </div>\n  );\n}\n\n/* -------------------------------------------------------------------------- */\n/*                               ProgressCircle                               */\n/* -------------------------------------------------------------------------- */\n\nexport interface ProgressCircleProps extends ProgressCommonProps {\n  /** Diameter in px. */\n  size?: number;\n  /** Stroke width in px. */\n  thickness?: number;\n  /** Replace the centered percentage with custom content. */\n  children?: ReactNode;\n  /** Classes for the progress arc (stroke via `text-*`). */\n  indicatorClassName?: string;\n}\n\n/**\n * Ring progress. The arc draws with `pathLength`; the 12 o'clock start and\n * the indeterminate spin rotate whole HTML/SVG boxes with CSS transforms, so\n * no transform-origin is ever set on an inner SVG shape.\n */\nexport function ProgressCircle({\n  value,\n  max = 100,\n  indeterminate = false,\n  label,\n  showValue = true,\n  size = 64,\n  thickness,\n  getValueText = defaultValueText,\n  children,\n  indicatorClassName,\n  className,\n  \"aria-label\": ariaLabel,\n}: ProgressCircleProps) {\n  const reduce = useReducedMotion();\n  const labelId = useId();\n  const { safeMax, isIndeterminate, current, fraction, percent } =\n    useProgressState(value, max, indeterminate);\n  const stroke = thickness ?? Math.max(3, Math.round(size * 0.09));\n  const r = (size - stroke) / 2;\n  const c = size / 2;\n  const pathLength = useFraction(fraction);\n  // A round cap on a zero-length path still paints a dot; hide it at 0.\n  const arcOpacity = useTransform(pathLength, (v) => (v > 0.002 ? 1 : 0));\n  const fontSize = Math.max(10, Math.round(size * 0.22));\n\n  const center =\n    children ??\n    (showValue && !isIndeterminate ? (\n      <NumberTicker\n        value={percent}\n        suffix=\"%\"\n        startOnView={false}\n        duration={0.45}\n        stagger={0}\n        className=\"font-semibold text-foreground\"\n      />\n    ) : null);\n\n  const ring = (\n    <svg\n      width={size}\n      height={size}\n      viewBox={`0 0 ${size} ${size}`}\n      aria-hidden=\"true\"\n      focusable=\"false\"\n      // Start at 12 o'clock: rotate the whole <svg> box with CSS.\n      className=\"-rotate-90\"\n    >\n      <circle\n        cx={c}\n        cy={c}\n        r={r}\n        fill=\"none\"\n        strokeWidth={stroke}\n        className=\"stroke-foreground/10\"\n      />\n      {isIndeterminate ? (\n        <motion.circle\n          cx={c}\n          cy={c}\n          r={r}\n          fill=\"none\"\n          strokeWidth={stroke}\n          strokeLinecap=\"round\"\n          className={cn(\"stroke-current text-primary\", indicatorClassName)}\n          initial={false}\n          animate={{ pathLength: 0.28 }}\n          transition={{ duration: 0 }}\n        />\n      ) : (\n        <motion.circle\n          cx={c}\n          cy={c}\n          r={r}\n          fill=\"none\"\n          strokeWidth={stroke}\n          strokeLinecap=\"round\"\n          className={cn(\"stroke-current text-primary\", indicatorClassName)}\n          style={{ pathLength, opacity: arcOpacity }}\n        />\n      )}\n    </svg>\n  );\n\n  return (\n    <div\n      role=\"progressbar\"\n      aria-label={ariaLabel ?? (typeof label === \"string\" ? label : undefined)}\n      aria-labelledby={ariaLabel == null && label != null && typeof label !== \"string\" ? labelId : undefined}\n      aria-valuemin={0}\n      aria-valuemax={safeMax}\n      aria-valuenow={isIndeterminate ? undefined : current}\n      aria-valuetext={\n        isIndeterminate ? undefined : getValueText(percent, current, safeMax)\n      }\n      className={cn(\"inline-flex flex-col items-center gap-2\", className)}\n    >\n      <div className=\"relative\" style={{ width: size, height: size }}>\n        {isIndeterminate ? (\n          // The spin lives on an HTML wrapper, never on an SVG child.\n          <motion.div\n            className=\"size-full\"\n            animate={reduce ? REDUCED_PULSE.animate : { rotate: 360 }}\n            transition={\n              reduce\n                ? REDUCED_PULSE.transition\n                : { duration: 1, ease: \"linear\", repeat: Infinity }\n            }\n          >\n            {ring}\n          </motion.div>\n        ) : (\n          ring\n        )}\n        {center != null ? (\n          <div\n            aria-hidden=\"true\"\n            className=\"absolute inset-0 flex items-center justify-center tabular-nums\"\n            style={{ fontSize }}\n          >\n            {center}\n          </div>\n        ) : null}\n      </div>\n      {label != null ? (\n        <span id={labelId} className=\"text-xs text-muted-foreground\">\n          {label}\n        </span>\n      ) : null}\n    </div>\n  );\n}\n\n/* -------------------------------------------------------------------------- */\n/*                                ProgressSteps                               */\n/* -------------------------------------------------------------------------- */\n\nexport type ProgressStep = { label: string };\n\nexport interface ProgressStepsProps {\n  /** Number of segments, or labelled steps (labels render under segments). */\n  steps: number | ProgressStep[];\n  /**\n   * Completed steps. Fractions partially fill the next segment, e.g. `2.5`\n   * fills two segments and half of the third.\n   */\n  value: number;\n  size?: ProgressSize;\n  /** Hide the step labels even when `steps` carries them. */\n  hideLabels?: boolean;\n  \"aria-label\"?: string;\n  indicatorClassName?: string;\n  className?: string;\n}\n\n// Delay between neighbouring segments so a jump of several steps reads as a\n// sequence (stage 1 completes, then stage 2…) instead of all at once.\nconst SEGMENT_STAGGER = 0.14;\n\n/**\n * Segmented progress: N tracks that fill one after another, e.g. upload\n * stages or onboarding steps. Increases fill left→right; decreases unwind\n * right→left.\n */\nexport function ProgressSteps({\n  steps,\n  value,\n  size = \"md\",\n  hideLabels = false,\n  indicatorClassName,\n  className,\n  \"aria-label\": ariaLabel = \"Progress\",\n}: ProgressStepsProps) {\n  const reduce = useReducedMotion();\n  const list: ProgressStep[] =\n    typeof steps === \"number\"\n      ? Array.from({ length: Math.max(1, steps) }, (_, i) => ({ label: `Step ${i + 1}` }))\n      : steps;\n  const count = list.length;\n  const current = Math.min(count, Math.max(0, Number.isFinite(value) ? value : 0));\n  const showLabels = !hideLabels && typeof steps !== \"number\";\n\n  // Previous value decides the sequence direction and where it starts.\n  const prevRef = useRef(current);\n  const from = prevRef.current;\n  useEffect(() => {\n    prevRef.current = current;\n  }, [current]);\n  const growing = current >= from;\n\n  const activeIndex = Math.min(count - 1, Math.floor(current));\n  const valueText =\n    current >= count\n      ? `All ${count} steps complete`\n      : `Step ${activeIndex + 1} of ${count}: ${list[activeIndex]?.label ?? \"\"}`;\n\n  return (\n    <div\n      role=\"progressbar\"\n      aria-label={ariaLabel}\n      aria-valuemin={0}\n      aria-valuemax={count}\n      aria-valuenow={current}\n      aria-valuetext={valueText}\n      className={cn(\"flex w-full flex-col gap-2\", className)}\n    >\n      <div className=\"flex w-full gap-1.5\">\n        {list.map((_step, i) => {\n          const fill = clamp01(current - i);\n          const order = growing\n            ? Math.max(0, i - Math.floor(from))\n            : Math.max(0, Math.ceil(from) - 1 - i);\n          return (\n            <div\n              // biome-ignore lint/suspicious/noArrayIndexKey: segments are positional and never reorder\n              key={i}\n              className={cn(\n                \"relative flex-1 overflow-hidden rounded-full bg-foreground/10\",\n                TRACK_SIZE[size],\n              )}\n            >\n              <motion.div\n                className={cn(\n                  \"absolute inset-0 origin-left rounded-full bg-primary\",\n                  indicatorClassName,\n                )}\n                initial={false}\n                animate={{ scaleX: fill }}\n                transition={\n                  reduce\n                    ? { duration: 0 }\n                    : { duration: 0.32, ease: EASE_OUT, delay: order * SEGMENT_STAGGER }\n                }\n              />\n            </div>\n          );\n        })}\n      </div>\n      {showLabels ? (\n        <div aria-hidden=\"true\" className=\"flex w-full gap-1.5\">\n          {list.map((step, i) => (\n            <span\n              // biome-ignore lint/suspicious/noArrayIndexKey: segments are positional and never reorder\n              key={i}\n              className={cn(\n                \"min-w-0 flex-1 truncate text-xs transition-colors duration-200\",\n                i < current ? \"text-foreground\" : \"text-muted-foreground\",\n              )}\n            >\n              {step.label}\n            </span>\n          ))}\n        </div>\n      ) : null}\n    </div>\n  );\n}\n"},{"path":"lib/ease.ts","type":"registry:lib","target":"@lib/ease.ts","content":"// Shared motion tokens. Easing curves mirror the CSS custom properties in\n// globals.css; springs are the canonical physics used across components.\n// Strong custom variants — defaults like `ease-in`/`ease-out` feel weak.\n\nexport const EASE_OUT = [0.16, 1, 0.3, 1] as const;\nexport const EASE_IN_OUT = [0.77, 0, 0.175, 1] as const;\nexport const EASE_DRAWER = [0.32, 0.72, 0, 1] as const;\n\n/** CSS string form of EASE_OUT for inline style transitions. */\nexport const EASE_OUT_CSS = \"cubic-bezier(0.16, 1, 0.3, 1)\";\n\n/** Press feedback on buttons and other tappable surfaces. */\nexport const SPRING_PRESS = {\n  type: \"spring\",\n  stiffness: 500,\n  damping: 30,\n  mass: 0.6,\n} as const;\n\n/** Content swaps — label/icon slots trading places inside a control. */\nexport const SPRING_SWAP = {\n  type: \"spring\",\n  stiffness: 460,\n  damping: 30,\n  mass: 0.55,\n} as const;\n\n/** Overlay panel entrances — modals and sheets summoned by pointer. */\nexport const SPRING_PANEL = {\n  type: \"spring\",\n  stiffness: 420,\n  damping: 40,\n  mass: 0.5,\n} as const;\n\n/** Shared-layout glides — pills, indicators and panels morphing between positions. */\nexport const SPRING_LAYOUT = {\n  type: \"spring\",\n  stiffness: 360,\n  damping: 32,\n  mass: 0.6,\n} as const;\n\n/** Cursor-follow physics for decorative mouse tracking (magnetic, tilt, dock). */\nexport const SPRING_MOUSE = {\n  stiffness: 200,\n  damping: 15,\n  mass: 0.3,\n} as const;\n\n/** Dragged handles and fills (sliders) — critically damped `useSpring` config,\n * so the value follows the pointer butterily and never rebounds off an end. */\nexport const SPRING_GLIDE = {\n  stiffness: 700,\n  damping: 50,\n  mass: 0.5,\n} as const;\n"},{"path":"lib/utils.ts","type":"registry:lib","target":"@lib/utils.ts","content":"import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs))\n}\n"},{"path":"components/motion/button/base.tsx","type":"registry:component","target":"@components/motion/button/base.tsx","content":"\"use client\";\n\nimport {\n  AnimatePresence,\n  type HTMLMotionProps,\n  motion,\n  useReducedMotion,\n} from \"motion/react\";\nimport {\n  forwardRef,\n  type PointerEvent,\n  type ReactNode,\n  useCallback,\n  useRef,\n  useState,\n} from \"react\";\nimport { EASE_OUT, SPRING_PRESS } from \"@/lib/ease\";\nimport { useHoverCapable } from \"@/lib/hooks/use-hover-capable\";\nimport { TOUCH_TARGET_CLASS } from \"@/lib/touch\";\nimport { cn } from \"@/lib/utils\";\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"ghost\" | \"outline\";\nexport type ButtonSize = \"sm\" | \"md\" | \"lg\" | \"icon\";\n\nexport interface ButtonProps extends Omit<\n  HTMLMotionProps<\"button\">,\n  \"children\"\n> {\n  variant?: ButtonVariant;\n  size?: ButtonSize;\n  pressScale?: number;\n  /** Spawn a Material-style ripple from the press point. Off by default. */\n  ripple?: boolean;\n  children?: ReactNode;\n}\n\nexport interface ButtonLinkProps extends Omit<\n  HTMLMotionProps<\"a\">,\n  \"children\"\n> {\n  variant?: ButtonVariant;\n  size?: ButtonSize;\n  pressScale?: number;\n  children?: ReactNode;\n}\n\ntype Ripple = { id: number; x: number; y: number; size: number };\n\nconst VARIANT_CLASS: Record<ButtonVariant, string> = {\n  primary: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n  secondary: \"border border-border bg-card text-foreground hover:border-border\",\n  ghost: \"text-muted-foreground hover:text-foreground hover:bg-primary/5\",\n  outline:\n    \"border border-border bg-transparent text-foreground hover:bg-primary/5\",\n};\n\nconst SIZE_CLASS: Record<ButtonSize, string> = {\n  sm: \"h-8 px-3 text-xs gap-1.5 rounded-full\",\n  md: \"h-10 px-5 text-sm gap-2 rounded-full\",\n  lg: \"h-12 px-6 text-base gap-2 rounded-full\",\n  icon: \"h-8 w-8 rounded-lg\",\n};\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n  function Button(\n    {\n      variant = \"primary\",\n      size = \"md\",\n      pressScale = 0.93,\n      ripple = false,\n      className,\n      children,\n      onPointerDown,\n      ...rest\n    },\n    ref,\n  ) {\n    const reduce = useReducedMotion();\n    const canHover = useHoverCapable();\n    const [ripples, setRipples] = useState<Ripple[]>([]);\n    const nextId = useRef(0);\n\n    const handlePointerDown = useCallback(\n      (event: PointerEvent<HTMLButtonElement>) => {\n        if (ripple && !reduce) {\n          const rect = event.currentTarget.getBoundingClientRect();\n          const size = Math.max(rect.width, rect.height) * 2;\n          const id = nextId.current++;\n          setRipples((prev) => [\n            ...prev,\n            {\n              id,\n              x: event.clientX - rect.left,\n              y: event.clientY - rect.top,\n              size,\n            },\n          ]);\n        }\n        onPointerDown?.(event);\n      },\n      [ripple, reduce, onPointerDown],\n    );\n\n    return (\n      <motion.button\n        ref={ref}\n        type=\"button\"\n        whileTap={reduce ? undefined : { scale: pressScale }}\n        whileHover={reduce || !canHover ? undefined : { scale: 1.02 }}\n        transition={SPRING_PRESS}\n        onPointerDown={handlePointerDown}\n        className={cn(\n          \"relative inline-flex items-center justify-center font-medium select-none\",\n          \"transition-colors\",\n          \"disabled:pointer-events-none disabled:opacity-50\",\n          // The ripple layer clips itself, so on a touch screen the button can\n          // stop clipping and let its enlarged hit area overhang.\n          ripple && \"overflow-hidden pointer-coarse:overflow-visible\",\n          TOUCH_TARGET_CLASS,\n          VARIANT_CLASS[variant],\n          SIZE_CLASS[size],\n          className,\n        )}\n        {...rest}\n      >\n        {ripple && !reduce ? (\n          <span className=\"pointer-events-none absolute inset-0 overflow-hidden rounded-[inherit]\">\n            <AnimatePresence>\n              {ripples.map((r) => (\n                <motion.span\n                  key={r.id}\n                  className=\"absolute rounded-full bg-current\"\n                  style={{\n                    left: r.x,\n                    top: r.y,\n                    width: r.size,\n                    height: r.size,\n                    x: \"-50%\",\n                    y: \"-50%\",\n                  }}\n                  initial={{ scale: 0.05, opacity: 0.3 }}\n                  animate={{ scale: 1, opacity: 0 }}\n                  exit={{ opacity: 0 }}\n                  transition={{ duration: 1.6, ease: EASE_OUT }}\n                  onAnimationComplete={() =>\n                    setRipples((prev) => prev.filter((x) => x.id !== r.id))\n                  }\n                />\n              ))}\n            </AnimatePresence>\n          </span>\n        ) : null}\n        {children}\n      </motion.button>\n    );\n  },\n);\n\nexport const ButtonLink = forwardRef<HTMLAnchorElement, ButtonLinkProps>(\n  function ButtonLink(\n    {\n      variant = \"primary\",\n      size = \"md\",\n      pressScale = 0.93,\n      className,\n      children,\n      ...rest\n    },\n    ref,\n  ) {\n    const reduce = useReducedMotion();\n    const canHover = useHoverCapable();\n\n    return (\n      <motion.a\n        ref={ref}\n        whileTap={reduce ? undefined : { scale: pressScale }}\n        whileHover={reduce || !canHover ? undefined : { scale: 1.02 }}\n        transition={SPRING_PRESS}\n        className={cn(\n          \"relative inline-flex items-center justify-center font-medium select-none\",\n          \"transition-colors\",\n          TOUCH_TARGET_CLASS,\n          VARIANT_CLASS[variant],\n          SIZE_CLASS[size],\n          className,\n        )}\n        {...rest}\n      >\n        {children}\n      </motion.a>\n    );\n  },\n);\n"},{"path":"components/motion/button/magnetic.tsx","type":"registry:component","target":"@components/motion/button/magnetic.tsx","content":"\"use client\";\n\nimport { forwardRef } from \"react\";\nimport { Magnetic } from \"../magnetic\";\nimport { Button, type ButtonProps } from \"./base\";\n\nexport interface MagneticButtonProps extends ButtonProps {\n  /** Magnetic pull strength. Default 0.25. */\n  strength?: number;\n  /** Class applied to the magnetic wrapper. */\n  magneticClassName?: string;\n}\n\nexport const MagneticButton = forwardRef<HTMLButtonElement, MagneticButtonProps>(function MagneticButton(\n  { strength = 0.25, magneticClassName, children, ...rest },\n  ref,\n) {\n  return (\n    <Magnetic strength={strength} className={magneticClassName}>\n      <Button ref={ref} {...rest}>\n        {children}\n      </Button>\n    </Magnetic>\n  );\n});\n"},{"path":"components/motion/button/stateful.tsx","type":"registry:component","target":"@components/motion/button/stateful.tsx","content":"\"use client\";\n\nimport { Check, Loader2, X } from \"lucide-react\";\nimport {\n  AnimatePresence,\n  motion,\n  useReducedMotion,\n  type Variants,\n} from \"motion/react\";\nimport {\n  forwardRef,\n  type ReactNode,\n  useLayoutEffect,\n  useRef,\n  useState,\n} from \"react\";\nimport { EASE_OUT, SPRING_SWAP } from \"@/lib/ease\";\nimport { Button, type ButtonProps } from \"./base\";\n\nexport type ButtonState = \"idle\" | \"loading\" | \"success\" | \"error\";\n\nexport interface StatefulButtonProps extends Omit<ButtonProps, \"children\"> {\n  state?: ButtonState;\n  children: ReactNode;\n  loadingText?: ReactNode;\n  successText?: ReactNode;\n  errorText?: ReactNode;\n  icon?: ReactNode;\n}\n\nconst CASCADE_STAGGER = 0.025;\nconst ROLL_BLUR = \"blur(6px)\";\n\nconst CASCADE_LETTER_VARIANTS: Variants = {\n  initial: { opacity: 0, y: \"105%\", filter: ROLL_BLUR },\n  animate: (delay: number = 0) => ({\n    opacity: 1,\n    y: \"0%\",\n    filter: \"blur(0px)\",\n    transition: { ...SPRING_SWAP, delay },\n  }),\n  exit: (delay: number = 0) => ({\n    opacity: 0,\n    y: \"-105%\",\n    filter: ROLL_BLUR,\n    transition: { duration: 0.16, ease: EASE_OUT, delay: delay * 0.5 },\n  }),\n};\n\nconst ICON_VARIANTS: Variants = {\n  // Width collapses too, so the icon adds/removes its own space smoothly\n  // instead of popping the row width in a single frame.\n  initial: { opacity: 0, width: 0, scale: 0.7, filter: ROLL_BLUR },\n  animate: {\n    opacity: 1,\n    width: \"1.5rem\",\n    scale: 1,\n    filter: \"blur(0px)\",\n    transition: SPRING_SWAP,\n  },\n  exit: {\n    opacity: 0,\n    width: 0,\n    scale: 0.7,\n    filter: ROLL_BLUR,\n    transition: { duration: 0.16, ease: EASE_OUT },\n  },\n};\n\nfunction IconSlot({ keyId, children }: { keyId: string; children: ReactNode }) {\n  const reduce = useReducedMotion();\n  return (\n    <motion.span\n      key={keyId}\n      variants={ICON_VARIANTS}\n      initial={reduce ? { opacity: 0 } : \"initial\"}\n      animate={reduce ? { opacity: 1 } : \"animate\"}\n      exit={reduce ? { opacity: 0 } : \"exit\"}\n      transition={reduce ? { duration: 0.15 } : undefined}\n      className=\"inline-grid shrink-0 place-items-center overflow-hidden\"\n    >\n      {children}\n    </motion.span>\n  );\n}\n\nfunction TextSlot({\n  value,\n  children,\n}: {\n  value: string;\n  children: ReactNode;\n}) {\n  const reduce = useReducedMotion();\n  const measureRef = useRef<HTMLSpanElement>(null);\n  const [width, setWidth] = useState<number>();\n  const label = typeof children === \"string\" ? children : null;\n  const cascade = label !== null && !reduce;\n\n  // Measure strings with the same per-letter layout as the cascade. Measuring\n  // the whole string preserves kerning, which can make it narrower than the\n  // inline-block letters and clip the final glyph during the width animation.\n  useLayoutEffect(() => {\n    const nextWidth = measureRef.current?.offsetWidth;\n    if (!nextWidth) return;\n    setWidth((current) => (current === nextWidth ? current : nextWidth));\n  });\n\n  return (\n    <motion.span\n      initial={false}\n      animate={{ width }}\n      transition={reduce ? { duration: 0 } : SPRING_SWAP}\n      className=\"relative inline-block overflow-hidden whitespace-nowrap align-bottom\"\n    >\n      <span\n        ref={measureRef}\n        aria-hidden\n        className=\"invisible inline-block whitespace-nowrap\"\n      >\n        {cascade\n          ? label.split(\"\").map((char, index) => (\n              <span\n                // biome-ignore lint/suspicious/noArrayIndexKey: position is the slot identity.\n                key={index}\n                className=\"inline-block whitespace-pre\"\n              >\n                {char}\n              </span>\n            ))\n          : children}\n      </span>\n\n      {cascade ? (\n        <>\n          <span className=\"sr-only\">{label}</span>\n          <AnimatePresence initial={false}>\n            <motion.span\n              key={`cascade-${value}`}\n              aria-hidden\n              initial=\"initial\"\n              animate=\"animate\"\n              exit=\"exit\"\n              className=\"absolute left-0 top-0 inline-block whitespace-pre\"\n            >\n              {label.split(\"\").map((char, index) => (\n                <motion.span\n                  // biome-ignore lint/suspicious/noArrayIndexKey: position is the slot identity.\n                  key={index}\n                  custom={index * CASCADE_STAGGER}\n                  variants={CASCADE_LETTER_VARIANTS}\n                  className=\"inline-block whitespace-pre will-change-[opacity,filter,transform]\"\n                >\n                  {char}\n                </motion.span>\n              ))}\n            </motion.span>\n          </AnimatePresence>\n        </>\n      ) : (\n        <AnimatePresence initial={false}>\n          <motion.span\n            key={`text-${value}`}\n            initial={reduce ? { opacity: 0 } : { opacity: 0, y: 14, filter: ROLL_BLUR }}\n            animate={reduce ? { opacity: 1 } : { opacity: 1, y: 0, filter: \"blur(0px)\" }}\n            exit={reduce ? { opacity: 0 } : { opacity: 0, y: -14, filter: ROLL_BLUR }}\n            transition={reduce ? { duration: 0.15 } : SPRING_SWAP}\n            className=\"absolute left-0 top-0 inline-block will-change-[opacity,filter,transform]\"\n          >\n            {children}\n          </motion.span>\n        </AnimatePresence>\n      )}\n    </motion.span>\n  );\n}\n\nexport const StatefulButton = forwardRef<HTMLButtonElement, StatefulButtonProps>(function StatefulButton(\n  {\n    state = \"idle\",\n    children,\n    loadingText = \"Loading\",\n    successText = \"Done\",\n    errorText = \"Try again\",\n    icon,\n    disabled,\n    ...rest\n  },\n  ref,\n) {\n  const isBusy = state === \"loading\";\n  const stateText =\n    state === \"loading\"\n      ? loadingText\n      : state === \"success\"\n        ? successText\n        : state === \"error\"\n        ? errorText\n        : children;\n  const textKey =\n    typeof stateText === \"string\" ? `${state}-${stateText}` : state;\n\n  return (\n    <Button ref={ref} disabled={disabled || isBusy} aria-busy={isBusy} whileHover={undefined} {...rest}>\n      <span\n        aria-live=\"polite\"\n        className=\"relative inline-flex items-center justify-center overflow-hidden\"\n      >\n        <AnimatePresence initial={false}>\n          {state === \"loading\" ? (\n            <IconSlot keyId=\"loading-icon\">\n              <Loader2 className=\"h-4 w-4 animate-spin\" />\n            </IconSlot>\n          ) : null}\n          {state === \"success\" ? (\n            <IconSlot keyId=\"success-icon\">\n              <Check className=\"h-4 w-4\" />\n            </IconSlot>\n          ) : null}\n          {state === \"error\" ? (\n            <IconSlot keyId=\"error-icon\">\n              <X className=\"h-4 w-4\" />\n            </IconSlot>\n          ) : null}\n        </AnimatePresence>\n\n        <TextSlot value={textKey}>{stateText}</TextSlot>\n\n        <AnimatePresence initial={false}>\n          {state === \"idle\" && icon ? (\n            <IconSlot keyId=\"idle-icon\">{icon}</IconSlot>\n          ) : null}\n        </AnimatePresence>\n      </span>\n    </Button>\n  );\n});\n"},{"path":"components/motion/number-ticker.tsx","type":"registry:component","target":"@components/motion/number-ticker.tsx","content":"\"use client\";\n\nimport { animate, motion, useInView, useReducedMotion } from \"motion/react\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport { EASE_OUT } from \"@/lib/ease\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface NumberTickerProps {\n  value: number;\n  /** Digits to pad to (left). */\n  pad?: number;\n  /** Per-digit roll duration in seconds. */\n  duration?: number;\n  /** Stagger between digits. */\n  stagger?: number;\n  /** Render only after the element enters the viewport. */\n  startOnView?: boolean;\n  prefix?: string;\n  suffix?: string;\n  /** Add a small blur during digit rolls. */\n  blur?: boolean;\n  className?: string;\n  digitClassName?: string;\n  /** Insert en-US group separators (commas); fixed so server and client match. Server-component safe. */\n  locale?: boolean;\n  /** Custom formatter. Client-only — server components must use `locale` instead. */\n  format?: (value: number) => string;\n}\n\nconst DIGIT_HEIGHT_EM = 1.1;\nconst DIGITS = Array.from({ length: 10 }, (_, n) => n);\n\nexport function NumberTicker({\n  value,\n  pad,\n  duration = 0.9,\n  stagger = 0.04,\n  startOnView = true,\n  prefix,\n  suffix,\n  blur = false,\n  className,\n  digitClassName,\n  locale,\n  format,\n}: NumberTickerProps) {\n  const containerRef = useRef<HTMLSpanElement>(null);\n  const inView = useInView(containerRef, { once: true, amount: 0.6 });\n  const [armed, setArmed] = useState(!startOnView);\n\n  useEffect(() => {\n    if (startOnView && inView) setArmed(true);\n  }, [startOnView, inView]);\n\n  const text = useMemo(() => {\n    const rounded = Math.round(value);\n    const formatted = format\n      ? format(rounded)\n      : locale\n        ? rounded.toLocaleString(\"en-US\")\n        : rounded.toString();\n    return pad ? formatted.padStart(pad, \"0\") : formatted;\n  }, [value, pad, format, locale]);\n  const glyphs = useMemo(() => {\n    const chars = text.split(\"\");\n    // Key by place value (position from the right): a changing digit keeps its\n    // identity and rolls to the new value instead of remounting and replaying\n    // from 0. Growing numbers add glyphs on the left without re-keying the\n    // ones, tens, hundreds already on screen.\n    return chars.map((char, i) => ({ char, id: `g-${chars.length - 1 - i}` }));\n  }, [text]);\n  const readableText = `${prefix ?? \"\"}${text}${suffix ?? \"\"}`;\n\n  // Stagger is an entrance flourish. Once the reveal has played, value\n  // changes roll every digit immediately — a per-digit delay on live updates\n  // reads as lag.\n  const [entered, setEntered] = useState(false);\n  useEffect(() => {\n    if (!armed || entered) return;\n    const total = (duration + glyphs.length * stagger) * 1000;\n    const t = window.setTimeout(() => setEntered(true), total);\n    return () => window.clearTimeout(t);\n  }, [armed, entered, duration, stagger, glyphs.length]);\n\n  return (\n    <span\n      ref={containerRef}\n      className={cn(\"inline-flex items-center tabular-nums\", className)}\n    >\n      <span className=\"sr-only\">{readableText}</span>\n      <span aria-hidden=\"true\" className=\"inline-flex items-center\">\n        {prefix ? <span>{prefix}</span> : null}\n        {glyphs.map(({ char, id }, i) => {\n          const isDigit = /\\d/.test(char);\n          if (!isDigit) {\n            return (\n              <span key={id} className=\"inline-block\">\n                {char}\n              </span>\n            );\n          }\n          const digit = Number(char);\n          return (\n            <Digit\n              key={id}\n              digit={armed ? digit : 0}\n              delay={entered ? 0 : i * stagger}\n              duration={duration}\n              blur={blur}\n              className={digitClassName}\n            />\n          );\n        })}\n        {suffix ? <span>{suffix}</span> : null}\n      </span>\n    </span>\n  );\n}\n\nfunction Digit({\n  digit,\n  delay,\n  duration,\n  blur,\n  className,\n}: {\n  digit: number;\n  delay: number;\n  duration: number;\n  blur: boolean;\n  className?: string;\n}) {\n  const reduce = useReducedMotion();\n  const columnRef = useRef<HTMLSpanElement>(null);\n\n  useEffect(() => {\n    if (reduce || !blur || !columnRef.current || !Number.isFinite(digit)) {\n      return;\n    }\n\n    const node = columnRef.current;\n    const controls = animate(\n      node,\n      { filter: [\"blur(10px)\", \"blur(0px)\"] },\n      {\n        duration: Math.min(duration * 0.75, 0.32),\n        delay,\n        ease: EASE_OUT,\n      },\n    );\n\n    return () => {\n      controls.stop();\n      node.style.filter = \"blur(0px)\";\n    };\n  }, [blur, delay, digit, duration, reduce]);\n\n  return (\n    <span\n      className={cn(\"relative inline-block overflow-hidden\", className)}\n      style={{ height: `${DIGIT_HEIGHT_EM}em`, width: \"1ch\" }}\n    >\n      <motion.span\n        ref={columnRef}\n        initial={{ y: 0 }}\n        animate={{ y: `-${digit * DIGIT_HEIGHT_EM}em` }}\n        transition={\n          reduce\n            ? { duration: 0 }\n            : { duration, delay, ease: EASE_OUT }\n        }\n        className=\"absolute inset-x-0 top-0 flex flex-col items-center will-change-[transform,filter]\"\n      >\n        {DIGITS.map((n) => (\n          <span\n            key={n}\n            className=\"flex h-[1.1em] items-center justify-center leading-none\"\n          >\n            {n}\n          </span>\n        ))}\n      </motion.span>\n    </span>\n  );\n}\n"},{"path":"lib/hooks/use-hover-capable.ts","type":"registry:hook","target":"@lib/hooks/use-hover-capable.ts","content":"\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\n/**\n * Returns true only on devices that have a true hover (mouse / trackpad).\n * Touch devices fire phantom `:hover` on tap that sticks until tap-elsewhere\n * — gate hover-only effects (scale lifts, magnetic pulls) behind this.\n */\nexport function useHoverCapable() {\n  const [canHover, setCanHover] = useState(false);\n\n  useEffect(() => {\n    if (typeof window === \"undefined\" || !window.matchMedia) return;\n    const mq = window.matchMedia(\"(hover: hover) and (pointer: fine)\");\n    const update = () => setCanHover(mq.matches);\n    update();\n    mq.addEventListener?.(\"change\", update);\n    return () => mq.removeEventListener?.(\"change\", update);\n  }, []);\n\n  return canHover;\n}\n"},{"path":"lib/touch.ts","type":"registry:lib","target":"@lib/touch.ts","content":"// Shared touch primitives. iOS and iPadOS run their own gestures on top of the\n// page — the long-press selection callout and the selection it drags in with\n// it — and they win: once the platform claims a touch it cancels ours\n// mid-gesture, so a press-and-hold or a drag simply dies. Surfaces that own\n// their gesture have to opt out.\n//\n// What the two classes below cover, precisely:\n// - `-webkit-touch-callout: none` stops iOS's long-press callout. WebKit-only:\n//   it is not a property other engines have, so it is inert everywhere else.\n// - `user-select: none` stops the long-press selection on every engine,\n//   Android included, and stops a drag from painting a selection under the\n//   cursor. It is inherited, so it reaches every descendant — which is why the\n//   two classes differ only in whether they apply it unconditionally.\n// What neither covers:\n// - Chrome for Android's long-press menu on a link or an image. No CSS\n//   suppresses it; a gesture surface that wraps one needs its own\n//   `onContextMenu` with `preventDefault()`.\n// - The native drag of an `<img>` or `<a>` descendant. `-webkit-user-drag` is\n//   not inherited and plain divs and buttons are not drag sources, so setting\n//   it on the surface does nothing — the child itself needs `draggable={false}`.\n\n/**\n * Classes for a surface that *is* the control: a thumb, a drum, a stage, a\n * handle, a hold button. Selection is suppressed on every input, because a\n * drag that highlights the control's own label is wrong on a mouse too.\n * Compose with `touch-none` when the surface also owns the scroll axis — leave\n * it off when the page must still scroll from there.\n */\nexport const TOUCH_GESTURE_CLASS = \"select-none [-webkit-touch-callout:none]\";\n\n/**\n * The same opt-out for a gesture surface that wraps content the consumer owns:\n * a scroller, a context-menu trigger, a sheet header, a list row. Selection is\n * suppressed only where the platform runs its own press gestures — a coarse\n * pointer — so a mouse user can still select and copy that content. If the\n * gesture itself would paint a selection under the cursor, add `select-none`\n * for the duration of the gesture rather than reaching for\n * `TOUCH_GESTURE_CLASS`.\n *\n * `pointer: coarse` describes the *primary* pointer and nothing else, so a\n * hybrid machine reads it wrong in both directions: a tablet with a mouse\n * plugged in keeps touch as primary and loses mouse selection, and a laptop\n * with a touchscreen keeps the mouse as primary and leaves selection live\n * under a finger. No media query can answer per interaction — the query is\n * about the device, and the question is about the gesture in progress. The\n * default stays here because it is right on the machines that are one thing or\n * the other, and losing a selection is a nuisance; where the miss costs a\n * *gesture* instead, the surface pairs it with `holdSelection` on the press.\n */\nexport const TOUCH_GESTURE_CONTENT_CLASS =\n  \"[-webkit-touch-callout:none] pointer-coarse:select-none\";\n\n/**\n * Grow a small control's *hit area* to at least 44×44px (WCAG 2.5.5, Apple\n * HIG) on a coarse pointer, without changing what it looks like or the space\n * it takes in layout. An invisible `::after` box, centered on the control and\n * `max(100%, 2.75rem)` on each axis, catches the taps: a 32px icon button\n * reaches 6px past each edge, a wide 40px button only grows vertically, and a\n * control already 44px or larger is left as it is. Hit-testing a pseudo\n * element lands on its owner, so handlers, focus and `:active` all behave.\n *\n * Mouse and trackpad rendering is untouched — nothing here applies outside\n * `pointer: coarse`. Requirements on the element it goes on:\n * - It must be the containing block: add `relative` (and keep it mergeable, so\n *   a consumer's `absolute` still wins through `cn`).\n * - It must not clip itself (`overflow-hidden`), or the overhang is clipped\n *   away along with its hit area.\n * - It must render children: `<input>` and other void elements have no\n *   `::after`. Put it on the wrapper or label instead.\n * - It must not already use `::after` for something visible.\n *\n * Centered 44px means two 32px buttons with a 4px gap overlap by 8px; the\n * later one wins that strip, which still ends well short of the earlier\n * button's visual center. Below a ~32px pitch the later neighbour starts\n * eating into that center — use `TOUCH_TARGET_Y_CLASS` for such dense rows.\n *\n * The overhang is real geometry: inside a scroll container it counts as\n * scrollable overflow, so a control flush against a scroller's edge can add a\n * few pixels of scroll on touch screens. Give such a scroller a little padding\n * on that side.\n */\nexport const TOUCH_TARGET_CLASS =\n  \"pointer-coarse:after:absolute pointer-coarse:after:top-1/2 pointer-coarse:after:left-1/2 pointer-coarse:after:size-[max(100%,2.75rem)] pointer-coarse:after:-translate-x-1/2 pointer-coarse:after:-translate-y-1/2 pointer-coarse:after:content-['']\";\n\n/**\n * `TOUCH_TARGET_CLASS` on the vertical axis only, for controls packed tighter\n * than ~32px apart in a row (pagination dots, dense swatches), where growing\n * sideways would hand most of each control to its neighbour. Same rules.\n */\nexport const TOUCH_TARGET_Y_CLASS =\n  \"pointer-coarse:after:absolute pointer-coarse:after:inset-x-0 pointer-coarse:after:top-1/2 pointer-coarse:after:h-[max(100%,2.75rem)] pointer-coarse:after:-translate-y-1/2 pointer-coarse:after:content-['']\";\n\n/**\n * Suppress selection on `element` for as long as a gesture is running on it,\n * whatever the primary pointer of the machine happens to be. Returns the\n * release. Inline, so it wins over the class above and is gone again the\n * moment the gesture ends.\n *\n * For the press gestures a native selection would otherwise steal — a\n * long-press that opens a menu. Elsewhere prefer the classes: a surface that\n * takes selection away for the whole session is a surface whose text nobody\n * can copy.\n */\nexport function holdSelection(element: HTMLElement) {\n  element.style.setProperty(\"user-select\", \"none\");\n  element.style.setProperty(\"-webkit-user-select\", \"none\");\n  return () => {\n    element.style.removeProperty(\"user-select\");\n    element.style.removeProperty(\"-webkit-user-select\");\n  };\n}\n\n/**\n * Pointer capture, best effort. WebKit throws `NotFoundError` when the pointer\n * is already gone by the time the handler runs — routine on iOS, where the\n * system can claim the touch first — and an uncaught throw takes the rest of\n * the handler, the gesture included, down with it. Touch pointers carry\n * implicit capture anyway, so losing it is never fatal.\n */\nexport function capturePointer(element: Element, pointerId: number) {\n  try {\n    element.setPointerCapture(pointerId);\n  } catch {\n    // Pointer is no longer active — implicit capture still applies on touch.\n  }\n}\n\n/** Release a capture taken with `capturePointer`, ignoring a stale pointer. */\nexport function releasePointer(element: Element, pointerId: number) {\n  try {\n    if (element.hasPointerCapture(pointerId)) {\n      element.releasePointerCapture(pointerId);\n    }\n  } catch {\n    // Capture was already dropped by the browser.\n  }\n}\n\n/**\n * Whether this event came from a pointer that is *hovering*: not a touch, and\n * not currently pressed. Which input the user is holding right now is not\n * something a device capability can answer — a touchscreen laptop hovers and\n * taps, and iPadOS reports a fine hovering pointer for a finger — so both\n * paths stay live and each handler branches on the event it was given.\n *\n * A pen resting on the glass is making contact, not hovering: `buttons` is the\n * tell, and it sends a pen tap down the same route a finger takes.\n *\n * This answers what an *enter* asks. A leave is the other half of a pair and\n * has to be read against the enter that started it — `useHoverGesture` in\n * `lib/hooks/use-hover-gesture` does that, and hover surfaces should use it\n * rather than asking this question twice.\n */\nexport const isHoveringPointer = (event: {\n  pointerType: string;\n  buttons: number;\n}) => event.pointerType !== \"touch\" && event.buttons === 0;\n"},{"path":"components/motion/magnetic.tsx","type":"registry:component","target":"@components/motion/magnetic.tsx","content":"\"use client\";\n\nimport { motion, useMotionValue, useReducedMotion, useSpring } from \"motion/react\";\nimport { useRef, type ReactNode } from \"react\";\nimport { SPRING_MOUSE } from \"@/lib/ease\";\nimport { useHoverCapable } from \"@/lib/hooks/use-hover-capable\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface MagneticProps {\n  children: ReactNode;\n  strength?: number;\n  className?: string;\n}\n\nexport function Magnetic({ children, strength = 0.35, className }: MagneticProps) {\n  const ref = useRef<HTMLDivElement>(null);\n  const reduce = useReducedMotion();\n  const canHover = useHoverCapable();\n  // Decorative cursor-follow: skip on touch (phantom hover) and reduced motion.\n  const enabled = !reduce && canHover;\n  const x = useMotionValue(0);\n  const y = useMotionValue(0);\n  const sx = useSpring(x, SPRING_MOUSE);\n  const sy = useSpring(y, SPRING_MOUSE);\n\n  const onMove = (e: React.MouseEvent<HTMLDivElement>) => {\n    const el = ref.current;\n    if (!el || !enabled) return;\n    const rect = el.getBoundingClientRect();\n    x.set((e.clientX - rect.left - rect.width / 2) * strength);\n    y.set((e.clientY - rect.top - rect.height / 2) * strength);\n  };\n\n  const onLeave = () => {\n    x.set(0);\n    y.set(0);\n  };\n\n  return (\n    <motion.div\n      ref={ref}\n      onMouseMove={onMove}\n      onMouseLeave={onLeave}\n      style={{ x: sx, y: sy }}\n      className={cn(\"inline-block\", className)}\n    >\n      {children}\n    </motion.div>\n  );\n}\n"}]}