{"$schema":"https:\/\/ui.shadcn.com\/schema\/registry-item.json","name":"loader","type":"registry:component","title":"Loader","description":"Loading indicator with seventeen variants: spinner, dots, bars, dot-matrix, dither, morph, comet, scramble, metaballs, newton, helix, percent, and five terminal-style ascii spinners. Scales from one size prop, uses currentColor, and reduced-motion swaps every transform for a calm opacity pulse.","author":"Saurabh <saurabh10102@gmail.com>","dependencies":["clsx","motion","tailwind-merge"],"registryDependencies":[],"docs":"Loader: usage, props and types at https:\/\/beui.dev\/components\/motion\/loader.md","files":[{"path":"components\/motion\/loader.tsx","type":"registry:component","target":"@components\/motion\/loader.tsx","content":"\"use client\";\n\/\/ beui.dev\/components\/motion\/loader\n\nimport { motion, useReducedMotion } from \"motion\/react\";\nimport { useEffect, useId, useState } from \"react\";\nimport { EASE_IN_OUT } from \"@\/lib\/ease\";\nimport { useMessages } from \"@\/lib\/i18n\";\nimport { cn } from \"@\/lib\/utils\";\n\nexport type LoaderVariant =\n  | \"spinner\"\n  | \"dots\"\n  | \"bars\"\n  | \"dot-matrix\"\n  | \"dither\"\n  | \"ascii\"\n  | \"ascii-line\"\n  | \"ascii-braille\"\n  | \"ascii-blocks\"\n  | \"ascii-bounce\"\n  | \"morph\"\n  | \"comet\"\n  | \"scramble\"\n  | \"metaballs\"\n  | \"newton\"\n  | \"helix\"\n  | \"percent\";\n\n\/\/ Terminal-style frame sets - the loaders CLI AI agents cycle through.\nconst ASCII_SETS: Record<string, string[]> = {\n  ascii: [\"\u280b\", \"\u2819\", \"\u2839\", \"\u2838\", \"\u283c\", \"\u2834\", \"\u2826\", \"\u2827\", \"\u2807\", \"\u280f\"],\n  \"ascii-line\": [\"|\", \"\/\", \"-\", \"\\\\\"],\n  \"ascii-braille\": [\"\u28fe\", \"\u28fd\", \"\u28fb\", \"\u28bf\", \"\u287f\", \"\u28df\", \"\u28ef\", \"\u28f7\"],\n  \"ascii-blocks\": [\"\u2581\", \"\u2582\", \"\u2583\", \"\u2584\", \"\u2585\", \"\u2586\", \"\u2587\", \"\u2588\", \"\u2587\", \"\u2586\", \"\u2585\", \"\u2584\", \"\u2583\", \"\u2582\"],\n  \"ascii-bounce\": [\"\u2801\", \"\u2802\", \"\u2804\", \"\u2840\", \"\u2880\", \"\u2820\", \"\u2810\", \"\u2808\"],\n};\n\n\/** English defaults. Override per instance with `labels`, or app-wide with `LocaleProvider`. *\/\nexport const loaderMessages = {\n  label: \"Loading\",\n  \/** The word the `scramble` variant resolves to. *\/\n  scramble: \"LOADING\",\n};\n\nexport type LoaderMessages = typeof loaderMessages;\n\nexport interface LoaderProps {\n  \/** Which animation to render. *\/\n  variant?: LoaderVariant;\n  \/** Base square size in px. Everything scales from this. *\/\n  size?: number;\n  \/** Seconds per animation cycle. *\/\n  speed?: number;\n  \/** Accessible label announced to screen readers. *\/\n  label?: string;\n  \/** Override any built-in string. *\/\n  labels?: Partial<LoaderMessages>;\n  \/** Classes merged onto the root element. *\/\n  className?: string;\n}\n\n\/\/ Reduced motion keeps a calm opacity pulse and drops every transform.\nconst REDUCED = {\n  animate: { opacity: [1, 0.4, 1] },\n  transition: { duration: 1.4, ease: EASE_IN_OUT, repeat: Infinity },\n};\n\nexport function Loader({\n  variant = \"spinner\",\n  size = 32,\n  speed = 1,\n  label: labelProp,\n  labels,\n  className,\n}: LoaderProps) {\n  const t = useMessages(\"loader\", loaderMessages, labels);\n  const label = labelProp ?? t(\"label\");\n  const reduce = useReducedMotion() ?? false;\n\n  return (\n    <span\n      role=\"status\"\n      aria-label={label}\n      className={cn(\n        \"inline-flex items-center justify-center text-foreground\",\n        className,\n      )}\n    >\n      {variant === \"spinner\" && <Spinner size={size} speed={speed} reduce={reduce} \/>}\n      {variant === \"dots\" && <Dots size={size} speed={speed} reduce={reduce} \/>}\n      {variant === \"bars\" && <Bars size={size} speed={speed} reduce={reduce} \/>}\n      {variant === \"dot-matrix\" && (\n        <DotMatrix size={size} speed={speed} reduce={reduce} \/>\n      )}\n      {variant === \"dither\" && <Dither size={size} speed={speed} reduce={reduce} \/>}\n      {ASCII_SETS[variant] && (\n        <Ascii frames={ASCII_SETS[variant]} size={size} speed={speed} reduce={reduce} \/>\n      )}\n      {variant === \"morph\" && (\n        <Morph size={size} speed={speed} reduce={reduce} label={label} \/>\n      )}\n      {variant === \"comet\" && <Comet size={size} speed={speed} reduce={reduce} \/>}\n      {variant === \"scramble\" && (\n        <Scramble\n          size={size}\n          speed={speed}\n          reduce={reduce}\n          target={t(\"scramble\")}\n        \/>\n      )}\n      {variant === \"metaballs\" && (\n        <Metaballs size={size} speed={speed} reduce={reduce} label={label} \/>\n      )}\n      {variant === \"newton\" && <Newton size={size} speed={speed} reduce={reduce} \/>}\n      {variant === \"helix\" && <Helix size={size} speed={speed} reduce={reduce} \/>}\n      {variant === \"percent\" && (\n        <Percent size={size} speed={speed} reduce={reduce} \/>\n      )}\n      <span className=\"sr-only\">{label}<\/span>\n    <\/span>\n  );\n}\n\ninterface PartProps {\n  size: number;\n  speed: number;\n  reduce: boolean;\n}\n\nfunction Spinner({ size, speed, reduce }: PartProps) {\n  const stroke = Math.max(2, size * 0.09);\n  const r = (size - stroke) \/ 2;\n  return (\n    <motion.svg\n      width={size}\n      height={size}\n      viewBox={`0 0 ${size} ${size}`}\n      animate={reduce ? REDUCED.animate : { rotate: 360 }}\n      transition={\n        reduce\n          ? REDUCED.transition\n          : { duration: speed, ease: \"linear\", repeat: Infinity }\n      }\n    >\n      <circle\n        cx={size \/ 2}\n        cy={size \/ 2}\n        r={r}\n        fill=\"none\"\n        stroke=\"currentColor\"\n        strokeOpacity={0.2}\n        strokeWidth={stroke}\n      \/>\n      <path\n        d={`M ${size \/ 2} ${size \/ 2 - r} A ${r} ${r} 0 0 1 ${size \/ 2 + r} ${size \/ 2}`}\n        fill=\"none\"\n        stroke=\"currentColor\"\n        strokeWidth={stroke}\n        strokeLinecap=\"round\"\n      \/>\n    <\/motion.svg>\n  );\n}\n\nfunction Dots({ size, speed, reduce }: PartProps) {\n  const dot = size * 0.24;\n  return (\n    <span className=\"flex items-center\" style={{ gap: size * 0.14 }}>\n      {[0, 1, 2].map((i) => (\n        <motion.span\n          key={i}\n          className=\"rounded-full bg-current\"\n          style={{ width: dot, height: dot }}\n          animate={\n            reduce\n              ? { opacity: [0.4, 1, 0.4] }\n              : { y: [0, -size * 0.3, 0], opacity: [0.5, 1, 0.5] }\n          }\n          transition={{\n            duration: speed,\n            ease: EASE_IN_OUT,\n            repeat: Infinity,\n            delay: i * speed * 0.16,\n          }}\n        \/>\n      ))}\n    <\/span>\n  );\n}\n\nfunction Ascii({\n  frames,\n  size,\n  speed,\n  reduce,\n}: PartProps & { frames: string[] }) {\n  const [frame, setFrame] = useState(0);\n  useEffect(() => {\n    \/\/ Reduced motion slows the cycle rather than stopping it - it's a glyph\n    \/\/ swap, not on-screen movement.\n    const step = ((reduce ? speed * 2.5 : speed) \/ frames.length) * 1000;\n    const id = setInterval(\n      () => setFrame((f) => (f + 1) % frames.length),\n      step,\n    );\n    return () => clearInterval(id);\n  }, [frames.length, speed, reduce]);\n\n  return (\n    <span\n      className=\"font-mono leading-none tabular-nums\"\n      style={{ fontSize: size, lineHeight: 1 }}\n    >\n      {frames[frame % frames.length]}\n    <\/span>\n  );\n}\n\n\/\/ Each shape is sampled at the same number of points and emitted as an SVG\n\/\/ path with identical command structure, so framer tweens the `d` attribute\n\/\/ point-to-point - a real morph, not a snap. (clip-path polygon strings don't\n\/\/ interpolate reliably in framer, which left the shapes broken.)\nconst MORPH_POINTS = 24;\n\nfunction ngonRadius(ang: number, n: number, phase = 0) {\n  const seg = (2 * Math.PI) \/ n;\n  const a = ang - phase;\n  const local = (((a % seg) + seg) % seg) - seg \/ 2;\n  return Math.cos(Math.PI \/ n) \/ Math.cos(local);\n}\n\nfunction morphPath(radiusAt: (ang: number) => number) {\n  const parts: string[] = [];\n  for (let i = 0; i < MORPH_POINTS; i++) {\n    const ang = (i \/ MORPH_POINTS) * 2 * Math.PI - Math.PI \/ 2;\n    const r = Math.min(1.05, radiusAt(ang));\n    const x = (50 + Math.cos(ang) * 46 * r).toFixed(2);\n    const y = (50 + Math.sin(ang) * 46 * r).toFixed(2);\n    parts.push(`${i === 0 ? \"M\" : \"L\"}${x} ${y}`);\n  }\n  return `${parts.join(\" \")} Z`;\n}\n\nconst MORPH_PATHS = [\n  morphPath(() => 1), \/\/ circle\n  morphPath((a) => ngonRadius(a, 4, Math.PI \/ 4)), \/\/ square\n  morphPath((a) => ngonRadius(a, 3)), \/\/ triangle\n  morphPath((a) => ngonRadius(a, 6)), \/\/ hexagon\n  morphPath((a) => ngonRadius(a, 4)), \/\/ diamond\n];\n\n\/\/ Each shape appears twice in a row so it fully forms and HOLDS before the\n\/\/ next morph. Even keyframe spacing then alternates hold \/ morph segments.\nconst MORPH_SEQ = [...MORPH_PATHS.flatMap((p) => [p, p]), MORPH_PATHS[0]];\n\/\/ Rotation and scale only change across the morph segments, staying put on the\n\/\/ holds, so a settled shape sits still.\nconst MORPH_ROT = [0, 0, 72, 72, 144, 144, 216, 216, 288, 288, 360];\nconst MORPH_SCALE = [1, 1, 0.88, 0.88, 1, 1, 0.88, 0.88, 1, 1, 1];\n\nfunction Morph({ size, speed, reduce, label }: PartProps & { label: string }) {\n  return (\n    <motion.svg\n      width={size}\n      height={size}\n      viewBox=\"0 0 100 100\"\n      role=\"img\"\n      animate={\n        reduce\n          ? { opacity: [1, 0.4, 1] }\n          : { rotate: MORPH_ROT, scale: MORPH_SCALE }\n      }\n      transition={\n        reduce\n          ? { duration: 1.4, ease: EASE_IN_OUT, repeat: Infinity }\n          : { duration: speed * 5, ease: EASE_IN_OUT, repeat: Infinity }\n      }\n    >\n      <title>{label}<\/title>\n      <motion.path\n        fill=\"currentColor\"\n        d={MORPH_PATHS[0]}\n        \/\/ Seeds the motion value; without it motion writes d=\"undefined\"\n        \/\/ before the keyframes start.\n        initial={{ d: MORPH_PATHS[0] }}\n        animate={reduce ? undefined : { d: MORPH_SEQ }}\n        transition={\n          reduce\n            ? undefined\n            : { duration: speed * 5, ease: EASE_IN_OUT, repeat: Infinity }\n        }\n      \/>\n    <\/motion.svg>\n  );\n}\n\nconst COMET_TRAIL = [0, 1, 2, 3, 4, 5];\n\nfunction Comet({ size, speed, reduce }: PartProps) {\n  const head = size * 0.2;\n  const r = size \/ 2 - head \/ 2;\n  return (\n    <span className=\"relative\" style={{ width: size, height: size }}>\n      <motion.span\n        className=\"absolute inset-0\"\n        animate={reduce ? REDUCED.animate : { rotate: 360 }}\n        transition={\n          reduce\n            ? REDUCED.transition\n            : { duration: speed, ease: \"linear\", repeat: Infinity }\n        }\n      >\n        {COMET_TRAIL.map((i) => {\n          const scale = 1 - i * 0.13;\n          const sz = head * scale;\n          return (\n            <span\n              key={i}\n              className=\"absolute top-1\/2 left-1\/2 rounded-full bg-current\"\n              style={{\n                width: sz,\n                height: sz,\n                marginLeft: -sz \/ 2,\n                marginTop: -sz \/ 2,\n                opacity: 1 - i * 0.16,\n                transform: `rotate(${-i * 15}deg) translateY(${-r}px)`,\n              }}\n            \/>\n          );\n        })}\n      <\/motion.span>\n    <\/span>\n  );\n}\n\nconst SCRAMBLE_GLYPHS = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789<>\/*#@\";\n\nfunction Scramble({ size, speed, reduce, target }: PartProps & { target: string }) {\n  const [text, setText] = useState(target);\n  useEffect(() => {\n    if (reduce) {\n      setText(target);\n      return;\n    }\n    let tick = 0;\n    const total = target.length + 4;\n    const id = setInterval(\n      () => {\n        const reveal = tick % total;\n        let s = \"\";\n        for (let i = 0; i < target.length; i++) {\n          s +=\n            i < reveal\n              ? target[i]\n              : SCRAMBLE_GLYPHS[\n                  Math.floor(Math.random() * SCRAMBLE_GLYPHS.length)\n                ];\n        }\n        setText(s);\n        tick++;\n      },\n      (speed \/ target.length) * 1000 * 0.55,\n    );\n    return () => clearInterval(id);\n  }, [speed, reduce, target]);\n\n  return (\n    <span\n      className=\"font-mono font-medium tracking-[0.2em] tabular-nums\"\n      style={{ fontSize: size * 0.42 }}\n    >\n      {text}\n    <\/span>\n  );\n}\n\nfunction Metaballs({ size, speed, reduce, label }: PartProps & { label: string }) {\n  const id = useId().replace(\/:\/g, \"\");\n  return (\n    <svg width={size} height={size} viewBox=\"0 0 100 100\" role=\"img\">\n      <title>{label}<\/title>\n      <defs>\n        <filter id={id}>\n          <feGaussianBlur in=\"SourceGraphic\" stdDeviation=\"5\" result=\"b\" \/>\n          <feColorMatrix\n            in=\"b\"\n            values=\"1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 20 -8\"\n          \/>\n        <\/filter>\n      <\/defs>\n      <g filter={`url(#${id})`} fill=\"currentColor\">\n        <motion.circle\n          cy=\"50\"\n          r=\"15\"\n          \/\/ Seeds the motion value; without it motion writes cx=\"undefined\"\n          \/\/ before the keyframes start.\n          initial={{ cx: reduce ? 40 : 30 }}\n          animate={reduce ? { opacity: [0.4, 1, 0.4] } : { cx: [30, 70, 30] }}\n          transition={{ duration: speed * 1.6, ease: EASE_IN_OUT, repeat: Infinity }}\n        \/>\n        <motion.circle\n          cy=\"50\"\n          r=\"15\"\n          initial={{ cx: reduce ? 60 : 70 }}\n          animate={reduce ? { opacity: [0.4, 1, 0.4] } : { cx: [70, 30, 70] }}\n          transition={{ duration: speed * 1.6, ease: EASE_IN_OUT, repeat: Infinity }}\n        \/>\n      <\/g>\n    <\/svg>\n  );\n}\n\nconst NEWTON_BALLS = [0, 1, 2, 3, 4];\n\nfunction Newton({ size, speed, reduce }: PartProps) {\n  const d = size * 0.2;\n  const out = d * 1.1;\n  \/\/ Only the end balls move: the left slides out and back on the first half,\n  \/\/ then the right on the second half - the impact appears to jump the three\n  \/\/ still middle balls. Pure horizontal slide, no swing, no strings.\n  const moves: Record<number, { x: number[]; times: number[] }> = {\n    0: { x: [0, -out, 0, 0], times: [0, 0.28, 0.5, 1] },\n    4: { x: [0, 0, out, 0], times: [0, 0.5, 0.78, 1] },\n  };\n\n  return (\n    <span className=\"flex items-center justify-center\" style={{ height: d }}>\n      {NEWTON_BALLS.map((i) => {\n        const move = moves[i];\n        return (\n          <motion.span\n            key={i}\n            className=\"rounded-full bg-current\"\n            style={{ width: d, height: d }}\n            animate={reduce || !move ? undefined : { x: move.x }}\n            transition={\n              reduce || !move\n                ? undefined\n                : {\n                    duration: speed * 1.5,\n                    ease: EASE_IN_OUT,\n                    repeat: Infinity,\n                    times: move.times,\n                  }\n            }\n          \/>\n        );\n      })}\n    <\/span>\n  );\n}\n\nfunction Helix({ size, speed, reduce }: PartProps) {\n  const rows = 7;\n  const dot = size * 0.14;\n  const amp = size * 0.32;\n  return (\n    <span className=\"relative\" style={{ width: size, height: size }}>\n      {Array.from({ length: rows }, (_, r) => {\n        const top = (r \/ (rows - 1)) * (size - dot);\n        const delay = (r \/ rows) * speed;\n        return (\n          <span key={`row-${top}`}>\n            <motion.span\n              className=\"absolute rounded-full bg-current\"\n              style={{ width: dot, height: dot, left: size \/ 2 - dot \/ 2, top }}\n              animate={\n                reduce\n                  ? { opacity: [0.4, 1, 0.4] }\n                  : {\n                      x: [amp, -amp, amp],\n                      scale: [1, 0.5, 1],\n                      opacity: [1, 0.45, 1],\n                    }\n              }\n              transition={{\n                duration: speed,\n                ease: EASE_IN_OUT,\n                repeat: Infinity,\n                delay,\n              }}\n            \/>\n            <motion.span\n              className=\"absolute rounded-full bg-current\"\n              style={{ width: dot, height: dot, left: size \/ 2 - dot \/ 2, top }}\n              animate={\n                reduce\n                  ? { opacity: [0.4, 1, 0.4] }\n                  : {\n                      x: [-amp, amp, -amp],\n                      scale: [0.5, 1, 0.5],\n                      opacity: [0.45, 1, 0.45],\n                    }\n              }\n              transition={{\n                duration: speed,\n                ease: EASE_IN_OUT,\n                repeat: Infinity,\n                delay,\n              }}\n            \/>\n          <\/span>\n        );\n      })}\n    <\/span>\n  );\n}\n\nfunction Percent({ size, speed, reduce }: PartProps) {\n  const [p, setP] = useState(0);\n  useEffect(() => {\n    const dur = (reduce ? speed * 2 : speed) * 1000;\n    const start = { t: 0 };\n    const tickMs = 40;\n    const id = setInterval(() => {\n      start.t += tickMs;\n      const next = Math.min(100, Math.round((start.t \/ dur) * 100));\n      setP(next);\n      if (next >= 100) start.t = 0;\n    }, tickMs);\n    return () => clearInterval(id);\n  }, [speed, reduce]);\n\n  return (\n    <span\n      className=\"flex flex-col items-center\"\n      style={{ gap: size * 0.14, width: size * 1.4 }}\n    >\n      <span\n        className=\"font-mono font-medium tabular-nums\"\n        style={{ fontSize: size * 0.42, lineHeight: 1 }}\n      >\n        {p}%\n      <\/span>\n      <span\n        className=\"w-full overflow-hidden rounded-full bg-current\/15\"\n        style={{ height: Math.max(3, size * 0.1) }}\n      >\n        <span\n          className=\"block h-full rounded-full bg-current\"\n          style={{ width: `${p}%` }}\n        \/>\n      <\/span>\n    <\/span>\n  );\n}\n\nfunction Bars({ size, speed, reduce }: PartProps) {\n  const bar = size * 0.16;\n  return (\n    <span className=\"flex items-center\" style={{ gap: size * 0.1, height: size }}>\n      {[0, 1, 2, 3].map((i) => (\n        <motion.span\n          key={i}\n          className=\"rounded-full bg-current\"\n          style={{ width: bar, height: size, originY: 1 }}\n          animate={\n            reduce ? { opacity: [0.4, 1, 0.4] } : { scaleY: [0.3, 1, 0.3] }\n          }\n          transition={{\n            duration: speed,\n            ease: EASE_IN_OUT,\n            repeat: Infinity,\n            delay: i * speed * 0.12,\n          }}\n        \/>\n      ))}\n    <\/span>\n  );\n}\n\nfunction DotMatrix({ size, speed, reduce }: PartProps) {\n  const n = 3;\n  const gap = size * 0.14;\n  const dot = (size - gap * (n - 1)) \/ n;\n  const cells = Array.from({ length: n * n }, (_, idx) => idx);\n  return (\n    <span\n      className=\"grid\"\n      style={{\n        gap,\n        gridTemplateColumns: `repeat(${n}, ${dot}px)`,\n      }}\n    >\n      {cells.map((idx) => {\n        const x = idx % n;\n        const y = Math.floor(idx \/ n);\n        \/\/ Diagonal wave: cells light in order of their distance from the corner.\n        const delay = ((x + y) \/ (2 * (n - 1))) * speed;\n        return (\n          <motion.span\n            key={idx}\n            className=\"rounded-full bg-current\"\n            style={{ width: dot, height: dot }}\n            animate={\n              reduce\n                ? { opacity: [0.3, 1, 0.3] }\n                : { opacity: [0.2, 1, 0.2], scale: [0.7, 1, 0.7] }\n            }\n            transition={{\n              duration: speed,\n              ease: EASE_IN_OUT,\n              repeat: Infinity,\n              delay,\n            }}\n          \/>\n        );\n      })}\n    <\/span>\n  );\n}\n\n\/\/ Ordered Bayer 4x4 matrix - the classic dithering threshold pattern. Cells\n\/\/ light in this order, so the fill shimmers like a dissolving halftone.\nconst BAYER_4 = [\n  0, 8, 2, 10, 12, 4, 14, 6, 3, 11, 1, 9, 15, 7, 13, 5,\n];\n\nfunction Dither({ size, speed, reduce }: PartProps) {\n  const n = 4;\n  const gap = Math.max(1, size * 0.05);\n  const cell = (size - gap * (n - 1)) \/ n;\n  return (\n    <span\n      className=\"grid\"\n      style={{ gap, gridTemplateColumns: `repeat(${n}, ${cell}px)` }}\n    >\n      {BAYER_4.map((order, idx) => (\n        <motion.span\n          \/\/ biome-ignore lint\/suspicious\/noArrayIndexKey: fixed matrix cells, order never changes\n          key={idx}\n          className=\"bg-current\"\n          style={{ width: cell, height: cell }}\n          animate={reduce ? { opacity: [0.3, 1, 0.3] } : { opacity: [0.1, 1, 0.1] }}\n          transition={{\n            duration: speed,\n            ease: EASE_IN_OUT,\n            repeat: Infinity,\n            delay: (order \/ BAYER_4.length) * speed,\n          }}\n        \/>\n      ))}\n    <\/span>\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;\n\/** Accelerating curve for things that fall (a dropped ball, a toppled block). Not for UI entrances. *\/\nexport const EASE_IN = [0.55, 0, 1, 0.45] 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\n\/** Shared-surface morphs: a trigger growing into its panel and back on one\n * weighted spring, so opening and closing travel the same path. *\/\nexport const SPRING_MORPH = {\n  type: \"spring\",\n  duration: 0.5,\n  bounce: 0.22,\n} as const;\n"},{"path":"lib\/i18n.tsx","type":"registry:lib","target":"@lib\/i18n.tsx","content":"\"use client\";\n\nimport {\n  createContext,\n  type ReactNode,\n  useCallback,\n  useContext,\n  useMemo,\n} from \"react\";\n\n\/**\n * A component's messages. Plain strings with `{name}` placeholders, so a\n * dictionary stays JSON-serializable and can be passed from a server layout.\n * There are no plural forms: write messages that read correctly for any count.\n *\/\nexport type Messages = Record<string, string>;\n\n\/** A language file: component namespace \u2192 any subset of that component's messages. *\/\nexport type LocaleMessages = Record<string, Partial<Messages>>;\n\ntype LocaleContextValue = {\n  locale?: string;\n  messages: LocaleMessages;\n};\n\nconst NO_MESSAGES: LocaleMessages = {};\n\nconst LocaleContext = createContext<LocaleContextValue>({ messages: NO_MESSAGES });\n\n\/** Without a locale, digits stay plain so server and client render the same text. *\/\nexport function formatNumber(value: number, locale?: string) {\n  return locale ? new Intl.NumberFormat(locale).format(value) : String(value);\n}\n\nexport interface LocaleProviderProps {\n  \/** BCP 47 tag, e.g. `de`, `pt-BR`. Drives `Intl` number formatting. *\/\n  locale: string;\n  \/**\n   * Component namespace \u2192 translated strings. Missing keys fall back to English.\n   * Pass a stable object (a module constant, imported JSON or a memoized value):\n   * a new object each render gives every translated component a new `t`.\n   *\/\n  messages?: LocaleMessages;\n  children: ReactNode;\n}\n\nexport function LocaleProvider({ locale, messages = NO_MESSAGES, children }: LocaleProviderProps) {\n  const value = useMemo(() => ({ locale, messages }), [locale, messages]);\n  return <LocaleContext.Provider value={value}>{children}<\/LocaleContext.Provider>;\n}\n\nexport function useLocale(): { locale?: string } {\n  return { locale: useContext(LocaleContext).locale };\n}\n\n\/**\n * Resolves a component's strings: `labels` prop, then the provider's\n * messages for `namespace`, then the component's English `defaults`.\n * Numbers passed as values are formatted for the provider's locale.\n *\/\nexport function useMessages<T extends Messages>(\n  namespace: string,\n  defaults: T,\n  labels?: Partial<T>,\n) {\n  const { locale, messages } = useContext(LocaleContext);\n  const provided = messages[namespace];\n  \/\/ Inline `labels={{ \u2026 }}` is a new object every render. Keying it by content\n  \/\/ keeps `t` one identity until a label changes, so effects and memos that\n  \/\/ depend on `t` don't re-run per render, and render-time reads never lag.\n  const labelsKey = labels ? JSON.stringify(labels) : \"\";\n  const stableLabels = useMemo(\n    () => (labelsKey ? (JSON.parse(labelsKey) as Partial<T>) : undefined),\n    [labelsKey],\n  );\n\n  return useCallback(\n    (key: keyof T & string, values?: Record<string, string | number>) => {\n      const template = stableLabels?.[key] ?? provided?.[key] ?? defaults[key];\n      if (!values) return template;\n      return template.replace(\/\\{(\\w+)\\}\/g, (match, name: string) => {\n        const value = values[name];\n        if (value === undefined) return match;\n        return typeof value === \"number\" ? formatNumber(value, locale) : value;\n      });\n    },\n    [defaults, stableLabels, locale, provided],\n  );\n}\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"}]}