{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "car",
  "type": "registry:ui",
  "registryDependencies": [],
  "dependencies": ["motion"],
  "devDependencies": [],
  "files": [
    {
      "path": "car.tsx",
      "content": "\"use client\";\n\nimport type { Variants } from \"motion/react\";\nimport { motion, useAnimation } from \"motion/react\";\n\nimport type { HTMLAttributes } from \"react\";\nimport { forwardRef, useCallback, useImperativeHandle, useRef } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport interface CarIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface CarIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst WHEEL_VARIANTS: Variants = {\n  normal: {\n    scaleX: 1,\n    scaleY: 1,\n    transition: {\n      duration: 0.2,\n      ease: \"easeOut\",\n    },\n  },\n  animate: {\n    scaleX: [1, 1.12, 1, 1.06, 1],\n    scaleY: [1, 0.9, 1, 0.95, 1],\n    transition: {\n      repeat: Number.POSITIVE_INFINITY,\n      duration: 0.6,\n      ease: \"easeInOut\",\n    },\n  },\n};\n\nconst BODY_VARIANTS: Variants = {\n  normal: { x: 0, y: 0 },\n  animate: {\n    y: [0, -0.6, 0, -0.4, 0],\n    transition: {\n      duration: 0.7,\n      ease: \"easeInOut\",\n      repeat: Number.POSITIVE_INFINITY,\n      repeatType: \"loop\",\n    },\n  },\n};\n\nconst SPEED_LINE_VARIANTS: Variants = {\n  normal: {\n    opacity: 0,\n    x: 0,\n    scaleX: 0,\n  },\n  animate: (custom: number) => ({\n    opacity: [0, 0.7, 0.5, 0],\n    x: [0, -4, -10, -16],\n    scaleX: [0.2, 1, 0.8, 0.3],\n    transition: {\n      duration: 0.6,\n      ease: \"easeOut\",\n      repeat: Number.POSITIVE_INFINITY,\n      delay: custom * 0.08,\n      times: [0, 0.2, 0.6, 1],\n    },\n  }),\n};\n\nconst CarIcon = forwardRef<CarIconHandle, CarIconProps>(\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      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          className=\"overflow-visible\"\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          {[\n            { y: 8, width: 5, x: 0 },\n            { y: 11, width: 7, x: -1 },\n            { y: 14, width: 4, x: 0 },\n          ].map((line, i) => (\n            <motion.line\n              animate={controls}\n              custom={i}\n              initial=\"normal\"\n              key={`speed-${i}`}\n              strokeLinecap=\"round\"\n              strokeWidth=\"2\"\n              variants={SPEED_LINE_VARIANTS}\n              x1={line.x}\n              x2={line.x + line.width}\n              y1={line.y}\n              y2={line.y}\n            />\n          ))}\n          <motion.g\n            animate={controls}\n            initial=\"normal\"\n            variants={BODY_VARIANTS}\n          >\n            <path d=\"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2\" />\n          </motion.g>\n          <motion.g\n            animate={controls}\n            initial=\"normal\"\n            style={{ transformOrigin: \"7px 19px\" }}\n            variants={WHEEL_VARIANTS}\n          >\n            <circle cx=\"7\" cy=\"17\" r=\"2\" />\n          </motion.g>\n          <motion.g\n            animate={controls}\n            initial=\"normal\"\n            variants={BODY_VARIANTS}\n          >\n            <path d=\"M9 17h6\" />\n          </motion.g>\n          <motion.g\n            animate={controls}\n            initial=\"normal\"\n            style={{ transformOrigin: \"17px 19px\" }}\n            variants={WHEEL_VARIANTS}\n          >\n            <circle cx=\"17\" cy=\"17\" r=\"2\" />\n          </motion.g>\n        </svg>\n      </div>\n    );\n  }\n);\n\nCarIcon.displayName = \"CarIcon\";\n\nexport { CarIcon };\n",
      "type": "registry:ui"
    }
  ]
}
