{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "sparkles",
  "type": "registry:ui",
  "registryDependencies": [],
  "dependencies": ["motion"],
  "devDependencies": [],
  "files": [
    {
      "path": "sparkles.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 SparklesIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface SparklesIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst SPARKLE_VARIANTS: Variants = {\n  initial: {\n    y: 0,\n    fill: \"none\",\n  },\n  hover: {\n    y: [0, -1, 0, 0],\n    fill: \"currentColor\",\n    transition: {\n      duration: 1,\n      bounce: 0.3,\n    },\n  },\n};\n\nconst STAR_VARIANTS: Variants = {\n  initial: {\n    opacity: 1,\n    x: 0,\n    y: 0,\n  },\n  blink: () => ({\n    opacity: [0, 1, 0, 0, 0, 0, 1],\n    transition: {\n      duration: 2,\n      type: \"spring\",\n      stiffness: 70,\n      damping: 10,\n      mass: 0.4,\n    },\n  }),\n};\n\nconst SparklesIcon = forwardRef<SparklesIconHandle, SparklesIconProps>(\n  ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {\n    const starControls = useAnimation();\n    const sparkleControls = useAnimation();\n    const isControlledRef = useRef(false);\n\n    useImperativeHandle(ref, () => {\n      isControlledRef.current = true;\n\n      return {\n        startAnimation: () => {\n          sparkleControls.start(\"hover\");\n          starControls.start(\"blink\", { delay: 1 });\n        },\n        stopAnimation: () => {\n          sparkleControls.start(\"initial\");\n          starControls.start(\"initial\");\n        },\n      };\n    });\n\n    const handleMouseEnter = useCallback(\n      (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseEnter?.(e);\n        } else {\n          sparkleControls.start(\"hover\");\n          starControls.start(\"blink\", { delay: 1 });\n        }\n      },\n      [onMouseEnter, sparkleControls, starControls]\n    );\n\n    const handleMouseLeave = useCallback(\n      (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseLeave?.(e);\n        } else {\n          sparkleControls.start(\"initial\");\n          starControls.start(\"initial\");\n        }\n      },\n      [sparkleControls, starControls, onMouseLeave]\n    );\n\n    return (\n      <div\n        className={cn(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={sparkleControls}\n            d=\"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z\"\n            variants={SPARKLE_VARIANTS}\n          />\n          <motion.path\n            animate={starControls}\n            d=\"M20 3v4\"\n            variants={STAR_VARIANTS}\n          />\n          <motion.path\n            animate={starControls}\n            d=\"M22 5h-4\"\n            variants={STAR_VARIANTS}\n          />\n          <motion.path\n            animate={starControls}\n            d=\"M4 17v2\"\n            variants={STAR_VARIANTS}\n          />\n          <motion.path\n            animate={starControls}\n            d=\"M5 18H3\"\n            variants={STAR_VARIANTS}\n          />\n        </svg>\n      </div>\n    );\n  }\n);\n\nSparklesIcon.displayName = \"SparklesIcon\";\n\nexport { SparklesIcon };\n",
      "type": "registry:ui"
    }
  ]
}
