{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "palette",
  "type": "registry:ui",
  "registryDependencies": [],
  "dependencies": ["motion"],
  "devDependencies": [],
  "files": [
    {
      "path": "palette.tsx",
      "content": "\"use client\";\n\nimport type { Variants } from \"motion/react\";\nimport { motion, useAnimation } from \"motion/react\";\nimport type { HTMLAttributes } from \"react\";\nimport { forwardRef, useCallback, useImperativeHandle, useRef } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport interface PaletteIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface PaletteIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst DASH_LENGTH = 70;\nconst DRAW_DURATION = 0.45;\nconst DOT_STAGGER = 0.08;\n\nconst DOTS = [\n  { cx: 6.5, cy: 12.5 },\n  { cx: 8.5, cy: 7.5 },\n  { cx: 13.5, cy: 6.5 },\n  { cx: 17.5, cy: 10.5 },\n];\n\nconst OUTLINE_VARIANTS: Variants = {\n  normal: {\n    strokeDashoffset: 0,\n  },\n  animate: {\n    strokeDashoffset: [DASH_LENGTH, 0],\n    transition: {\n      duration: DRAW_DURATION,\n      ease: [0.65, 0, 0.35, 1],\n    },\n  },\n};\n\nconst DOTS_GROUP_VARIANTS: Variants = {\n  normal: {},\n  animate: {\n    transition: {\n      delayChildren: DRAW_DURATION,\n      staggerChildren: DOT_STAGGER,\n    },\n  },\n};\n\nconst DOT_VARIANTS: Variants = {\n  normal: {\n    scale: 1,\n    transition: { duration: 0.2 },\n  },\n  animate: {\n    // Two keyframes only: motion rejects 3+ keyframes on a spring.\n    // Lower damping (10) = weaker restoring force = bigger, slower overshoot\n    // before it settles — closer to the ~1.25 peak / softer landing we wanted,\n    // versus damping 14 which snapped back to 1 too quickly.\n    scale: [0, 1],\n    transition: {\n      damping: 10,\n      stiffness: 300,\n      type: \"spring\",\n    },\n  },\n};\n\nconst PaletteIcon = forwardRef<PaletteIconHandle, PaletteIconProps>(\n  ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {\n    const controls = useAnimation();\n    const isControlledRef = useRef(false);\n    const isAnimatingRef = useRef(false);\n\n    const startAnimation = useCallback(async () => {\n      if (isAnimatingRef.current) return;\n      isAnimatingRef.current = true;\n      try {\n        await controls.start(\"animate\");\n      } finally {\n        isAnimatingRef.current = false;\n      }\n    }, [controls]);\n\n    const stopAnimation = useCallback(async () => {\n      isAnimatingRef.current = false;\n      await controls.start(\"normal\");\n    }, [controls]);\n\n    useImperativeHandle(ref, () => {\n      isControlledRef.current = true;\n      return { startAnimation, stopAnimation };\n    });\n\n    const handleMouseEnter = useCallback(\n      (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseEnter?.(e);\n        } else {\n          startAnimation();\n        }\n      },\n      [startAnimation, onMouseEnter]\n    );\n\n    const handleMouseLeave = useCallback(\n      (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseLeave?.(e);\n        } else {\n          stopAnimation();\n        }\n      },\n      [stopAnimation, onMouseLeave]\n    );\n\n    return (\n      <div\n        className={cn(\"inline-flex items-center justify-center\", className)}\n        onMouseEnter={handleMouseEnter}\n        onMouseLeave={handleMouseLeave}\n        {...props}\n      >\n        <svg\n          fill=\"none\"\n          height={size}\n          stroke=\"currentColor\"\n          strokeLinecap=\"round\"\n          strokeLinejoin=\"round\"\n          strokeWidth=\"2\"\n          viewBox=\"0 0 24 24\"\n          width={size}\n          xmlns=\"http://www.w3.org/2000/svg\"\n        >\n          <motion.path\n            animate={controls}\n            d=\"M12 2a1 1 0 0 0 0 20l.25 0a1.75 1.75 0 0 0 1.4-2.8l-.3-.4a1.75 1.75 0 0 1 1.4-2.8h2.25a5 5 0 0 0 5-5 10 9 0 0 0-10-9z\"\n            initial=\"normal\"\n            strokeDasharray={DASH_LENGTH}\n            variants={OUTLINE_VARIANTS}\n          />\n          <motion.g\n            animate={controls}\n            initial=\"normal\"\n            variants={DOTS_GROUP_VARIANTS}\n          >\n            {DOTS.map((dot) => (\n              <motion.circle\n                cx={dot.cx}\n                cy={dot.cy}\n                fill=\"currentColor\"\n                key={`${dot.cx}-${dot.cy}`}\n                r=\".5\"\n                style={{ transformBox: \"fill-box\", transformOrigin: \"center\" }}\n                variants={DOT_VARIANTS}\n              />\n            ))}\n          </motion.g>\n        </svg>\n      </div>\n    );\n  }\n);\n\nPaletteIcon.displayName = \"PaletteIcon\";\n\nexport { PaletteIcon };\n",
      "type": "registry:ui"
    }
  ]
}
