{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "link-2",
  "type": "registry:ui",
  "registryDependencies": [],
  "dependencies": ["motion"],
  "devDependencies": [],
  "files": [
    {
      "path": "link-2.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 Link2IconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface Link2IconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst LEFT_VARIANTS: Variants = {\n  normal: { x: 0 },\n  animate: {\n    x: [0, -0.7, 0.3, 0],\n    transition: {\n      duration: 0.6,\n      times: [0, 0.4, 0.75, 1],\n      ease: \"easeInOut\",\n    },\n  },\n};\n\nconst RIGHT_VARIANTS: Variants = {\n  normal: { x: 0 },\n  animate: {\n    x: [0, 0.7, -0.3, 0],\n    transition: {\n      duration: 0.6,\n      times: [0, 0.4, 0.75, 1],\n      ease: \"easeInOut\",\n    },\n  },\n};\n\nconst Link2Icon = forwardRef<Link2IconHandle, Link2IconProps>(\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=\"2\"\n          viewBox=\"0 0 24 24\"\n          width={size}\n          xmlns=\"http://www.w3.org/2000/svg\"\n        >\n          <motion.g animate={controls} variants={LEFT_VARIANTS}>\n            <path d=\"M9 17H7A5 5 0 0 1 7 7h2\" />\n            <line x1=\"8\" x2=\"12\" y1=\"12\" y2=\"12\" />\n          </motion.g>\n          <motion.g animate={controls} variants={RIGHT_VARIANTS}>\n            <path d=\"M15 7h2a5 5 0 1 1 0 10h-2\" />\n            <line x1=\"16\" x2=\"12\" y1=\"12\" y2=\"12\" />\n          </motion.g>\n        </svg>\n      </div>\n    );\n  }\n);\n\nLink2Icon.displayName = \"Link2Icon\";\n\nexport { Link2Icon };\n",
      "type": "registry:ui"
    }
  ]
}
