{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "cake",
  "title": "cake",
  "description": "Animated cake icon for React",
  "type": "registry:ui",
  "registryDependencies": [],
  "dependencies": ["motion"],
  "files": [
    {
      "path": "cake.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\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface CakeIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface CakeIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst CAKE_BODY_VARIANTS: Variants = {\n  normal: {\n    translateY: 0,\n    opacity: 1,\n  },\n  animate: {\n    translateY: [8, -1, 0],\n    opacity: [0, 1, 1],\n    transition: {\n      duration: 0.4,\n      ease: \"easeOut\",\n    },\n  },\n};\n\nconst CANDLE_VARIANTS: Variants = {\n  normal: {\n    scaleY: 1,\n    opacity: 1,\n  },\n  animate: {\n    scaleY: [0, 1.2, 1],\n    opacity: [0, 1, 1],\n    transition: {\n      duration: 0.3,\n      ease: \"easeOut\",\n      delay: 0.3,\n    },\n  },\n};\n\nconst FLAME_LEFT_VARIANTS: Variants = {\n  normal: {\n    scale: 1,\n    opacity: 1,\n  },\n  animate: {\n    scale: [0, 1.3, 1],\n    opacity: [0, 1, 1],\n    transition: {\n      duration: 0.25,\n      ease: \"easeOut\",\n      delay: 0.5,\n    },\n  },\n};\n\nconst FLAME_MIDDLE_VARIANTS: Variants = {\n  normal: {\n    scale: 1,\n    opacity: 1,\n  },\n  animate: {\n    scale: [0, 1.3, 1],\n    opacity: [0, 1, 1],\n    transition: {\n      duration: 0.25,\n      ease: \"easeOut\",\n      delay: 0.65,\n    },\n  },\n};\n\nconst FLAME_RIGHT_VARIANTS: Variants = {\n  normal: {\n    scale: 1,\n    opacity: 1,\n  },\n  animate: {\n    scale: [0, 1.3, 1],\n    opacity: [0, 1, 1],\n    transition: {\n      duration: 0.25,\n      ease: \"easeOut\",\n      delay: 0.8,\n    },\n  },\n};\n\nconst CakeIcon = forwardRef<CakeIconHandle, CakeIconProps>(\n  ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {\n    const controls = useAnimation();\n    const isControlledRef = useRef(false);\n\n    useImperativeHandle(ref, () => {\n      isControlledRef.current = true;\n\n      return {\n        startAnimation: () => controls.start(\"animate\"),\n        stopAnimation: () => controls.start(\"normal\"),\n      };\n    });\n\n    const handleMouseEnter = useCallback(\n      (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseEnter?.(e);\n        } else {\n          controls.start(\"animate\");\n        }\n      },\n      [controls, onMouseEnter]\n    );\n\n    const handleMouseLeave = useCallback(\n      (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseLeave?.(e);\n        } else {\n          controls.start(\"normal\");\n        }\n      },\n      [controls, 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=\"1.5\"\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 8.25c-1.355 0-2.697.056-4.024.166C6.845 8.51 6 9.473 6 10.608v2.513m6-4.871c1.355 0 2.697.056 4.024.166C17.155 8.51 18 9.473 18 10.608v2.513m3 3.879-1.5.75a3.354 3.354 0 0 1-3 0 3.354 3.354 0 0 0-3 0 3.354 3.354 0 0 1-3 0 3.354 3.354 0 0 0-3 0 3.354 3.354 0 0 1-3 0L3 16.5m15-3.379a48.474 48.474 0 0 0-6-.371c-2.032 0-4.034.126-6 .371m12 0c.39.049.777.102 1.163.16 1.07.16 1.837 1.094 1.837 2.175v5.169c0 .621-.504 1.125-1.125 1.125H4.125A1.125 1.125 0 0 1 3 20.625v-5.17c0-1.08.768-2.014 1.837-2.174A47.78 47.78 0 0 1 6 13.12\"\n            initial=\"normal\"\n            style={{ originY: 1 }}\n            variants={CAKE_BODY_VARIANTS}\n          />\n          <motion.g\n            animate={controls}\n            initial=\"normal\"\n            style={{ originY: 1 }}\n            variants={CANDLE_VARIANTS}\n          >\n            <path d=\"M9 8.25v-1.5\" />\n            <path d=\"M12 8.25v-1.5\" />\n            <path d=\"M15 8.25v-1.5\" />\n          </motion.g>\n          <motion.path\n            animate={controls}\n            d=\"M9.265 3.11a.375.375 0 1 1-.53 0L9 2.845l.265.265Z\"\n            initial=\"normal\"\n            style={{ originX: 0.375, originY: 0.5 }}\n            variants={FLAME_LEFT_VARIANTS}\n          />\n          <motion.path\n            animate={controls}\n            d=\"M12.265 3.11a.375.375 0 1 1-.53 0L12 2.845l.265.265Z\"\n            initial=\"normal\"\n            style={{ originX: 0.5, originY: 0.5 }}\n            variants={FLAME_MIDDLE_VARIANTS}\n          />\n          <motion.path\n            animate={controls}\n            d=\"M15.265 3.11a.375.375 0 1 1-.53 0L15 2.845l.265.265Z\"\n            initial=\"normal\"\n            style={{ originX: 0.625, originY: 0.5 }}\n            variants={FLAME_RIGHT_VARIANTS}\n          />\n        </svg>\n      </div>\n    );\n  }\n);\n\nCakeIcon.displayName = \"CakeIcon\";\n\nexport { CakeIcon };\n",
      "type": "registry:ui"
    }
  ]
}
