{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "eye",
  "title": "eye",
  "description": "Animated eye icon",
  "dependencies": [
    "motion"
  ],
  "files": [
    {
      "path": "icons/eye.tsx",
      "content": "'use client';\n\nimport type { Variants } from 'motion/react';\nimport { motion, useAnimation } from 'motion/react';\nimport type { HTMLAttributes } from 'react';\nimport { forwardRef, useId } from 'react';\nimport { useIconAnimation } from '@/lib/use-icon-animation';\nimport { cn } from '@/lib/utils';\n\nexport interface EyeIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface EyeIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst EYE_DURATION = 0.88;\nconst EYE_TIMES = [0, 0.18, 0.38, 0.58, 0.68, 0.74, 0.78, 0.88, 1];\nconst TOP_EYELID_OPEN =\n  'M2 14C2 13.6845 2.15201 13.4713 2.45604 13.045C3.8221 11.1294 7.31078 7 12 7C16.6892 7 20.1779 11.1294 21.544 13.045C21.848 13.4713 22 13.6845 22 14';\nconst TOP_EYELID_HALF =\n  'M2 14C2 13.85 2.15201 13.7 2.45604 13.55C5.2 11.2 8.5 10 12 10C15.5 10 18.8 11.2 21.544 13.55C21.848 13.7 22 13.85 22 14';\nconst EYELID_CLOSED =\n  'M2 14C2 14 2.15201 14 2.45604 14C3.8221 14 7.31078 14 12 14C16.6892 14 20.1779 14 21.544 14C21.848 14 22 14 22 14';\nconst BOTTOM_EYELID_OPEN =\n  'M2 14C2 14.3155 2.15201 14.5287 2.45604 14.955C3.8221 16.8706 7.31078 21 12 21C16.6892 21 20.1779 16.8706 21.544 14.955C21.848 14.5287 22 14.3155 22 14';\nconst BOTTOM_EYELID_HALF =\n  'M2 14C2 14.15 2.15201 14.3 2.45604 14.45C5.2 16.8 8.5 18 12 18C15.5 18 18.8 16.8 21.544 14.45C21.848 14.3 22 14.15 22 14';\n\n// The pupil darts first, then yields softly as the lids meet.\nconst pupilVariants: Variants = {\n  normal: { translateX: 0, scaleX: 1, scaleY: 1 },\n  animate: {\n    translateX: [0, -1.6, 1.5, 0, 0, 0, 0, 0, 0],\n    scaleX: [1, 1, 1, 1, 1.04, 1.08, 1.06, 0.98, 1],\n    scaleY: [1, 1, 1, 1, 0.92, 0.85, 0.88, 1.03, 1],\n    transition: {\n      duration: EYE_DURATION,\n      ease: 'easeInOut',\n      times: EYE_TIMES,\n    },\n  },\n};\n\nconst eyeOutlineVariants: Variants = {\n  normal: { scaleX: 1, scaleY: 1 },\n  animate: {\n    scaleX: [1, 1, 1, 1, 1.015, 1.03, 1.025, 0.99, 1],\n    scaleY: [1, 1, 1, 1, 0.91, 0.78, 0.83, 1.025, 1],\n    transition: { duration: EYE_DURATION, ease: 'easeInOut', times: EYE_TIMES },\n  },\n};\n\nconst browVariants: Variants = {\n  normal: { translateY: 0 },\n  animate: {\n    translateY: [0, 0, 0, 0, 0.25, 0.65, 0.55, -0.12, 0],\n    transition: { duration: EYE_DURATION, ease: 'easeInOut', times: EYE_TIMES },\n  },\n};\n\nconst topEyelidVariants: Variants = {\n  normal: { d: TOP_EYELID_OPEN, pathLength: 1 },\n  animate: {\n    d: [\n      TOP_EYELID_OPEN,\n      TOP_EYELID_OPEN,\n      TOP_EYELID_OPEN,\n      TOP_EYELID_OPEN,\n      TOP_EYELID_HALF,\n      EYELID_CLOSED,\n      EYELID_CLOSED,\n      TOP_EYELID_HALF,\n      TOP_EYELID_OPEN,\n    ],\n    transition: { duration: EYE_DURATION, ease: 'easeInOut', times: EYE_TIMES },\n  },\n};\n\nconst bottomEyelidVariants: Variants = {\n  normal: { d: BOTTOM_EYELID_OPEN, pathLength: 1 },\n  animate: {\n    d: [\n      BOTTOM_EYELID_OPEN,\n      BOTTOM_EYELID_OPEN,\n      BOTTOM_EYELID_OPEN,\n      BOTTOM_EYELID_OPEN,\n      BOTTOM_EYELID_HALF,\n      EYELID_CLOSED,\n      EYELID_CLOSED,\n      BOTTOM_EYELID_HALF,\n      BOTTOM_EYELID_OPEN,\n    ],\n    transition: { duration: EYE_DURATION, ease: 'easeInOut', times: EYE_TIMES },\n  },\n};\n\nconst pupilClipVariants: Variants = {\n  normal: { height: 14, y: 7 },\n  animate: {\n    height: [14, 14, 14, 14, 8, 0, 0, 8, 14],\n    y: [7, 7, 7, 7, 10, 14, 14, 10, 7],\n    transition: { duration: EYE_DURATION, ease: 'easeInOut', times: EYE_TIMES },\n  },\n};\n\nconst generatedGeometryVariants: Variants = {\n  normal: {\n    visibility: 'hidden',\n    transform: 'scaleX(1) scaleY(1)',\n    transition: { duration: 0 },\n  },\n  animate: {\n    visibility: [\n      'hidden',\n      'hidden',\n      'hidden',\n      'visible',\n      'visible',\n      'visible',\n      'visible',\n      'visible',\n      'hidden',\n    ],\n    transform: [\n      'scaleX(1) scaleY(1)',\n      'scaleX(1) scaleY(1)',\n      'scaleX(1) scaleY(1)',\n      'scaleX(1) scaleY(1)',\n      'scaleX(1.012) scaleY(0.93)',\n      'scaleX(1.025) scaleY(0.84)',\n      'scaleX(1.02) scaleY(0.88)',\n      'scaleX(0.995) scaleY(1.02)',\n      'scaleX(1) scaleY(1)',\n    ],\n    transition: { duration: EYE_DURATION, ease: 'easeInOut', times: EYE_TIMES },\n  },\n};\n\nconst EyeIcon = forwardRef<EyeIconHandle, EyeIconProps>(\n  ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {\n    const controls = useAnimation();\n    const pupilClipId = useId();\n    const { handleMouseEnter, handleMouseLeave } = useIconAnimation({\n      controls,\n      loops: false,\n      onMouseEnter,\n      onMouseLeave,\n      ref,\n    });\n\n    return (\n      <div\n        className={cn(className)}\n        onMouseEnter={handleMouseEnter}\n        onMouseLeave={handleMouseLeave}\n        {...props}\n      >\n        <svg\n          xmlns=\"http://www.w3.org/2000/svg\"\n          width={size}\n          height={size}\n          viewBox=\"0 0 24 24\"\n          fill=\"none\"\n          overflow=\"visible\"\n        >\n          <defs>\n            <clipPath id={pupilClipId} clipPathUnits=\"userSpaceOnUse\">\n              <motion.rect\n                x=\"0\"\n                width=\"24\"\n                fill=\"currentColor\"\n                variants={pupilClipVariants}\n                animate={controls}\n                initial=\"normal\"\n              />\n            </clipPath>\n          </defs>\n          <motion.path\n            d=\"M2 8C2 8 6.47715 3 12 3C17.5228 3 22 8 22 8\"\n            stroke=\"currentColor\"\n            strokeLinecap=\"round\"\n            strokeWidth=\"1.5\"\n            variants={browVariants}\n            animate={controls}\n            initial=\"normal\"\n          />\n          <motion.path\n            d=\"M21.544 13.045C21.848 13.4713 22 13.6845 22 14C22 14.3155 21.848 14.5287 21.544 14.955C20.1779 16.8706 16.6892 21 12 21C7.31078 21 3.8221 16.8706 2.45604 14.955C2.15201 14.5287 2 14.3155 2 14C2 13.6845 2.15201 13.4713 2.45604 13.045C3.8221 11.1294 7.31078 7 12 7C16.6892 7 20.1779 11.1294 21.544 13.045Z\"\n            stroke=\"currentColor\"\n            strokeWidth=\"1.5\"\n            variants={eyeOutlineVariants}\n            animate={controls}\n            initial=\"normal\"\n            style={{ transformOrigin: '12px 14px' }}\n          />\n          <motion.path\n            d=\"M15 14C15 12.3431 13.6569 11 12 11C10.3431 11 9 12.3431 9 14C9 15.6569 10.3431 17 12 17C13.6569 17 15 15.6569 15 14Z\"\n            stroke=\"currentColor\"\n            strokeWidth=\"1.5\"\n            variants={pupilVariants}\n            animate={controls}\n            initial=\"normal\"\n            clipPath={`url(#${pupilClipId})`}\n            style={{ transformOrigin: '12px 14px' }}\n          />\n          <motion.g\n            variants={generatedGeometryVariants}\n            animate={controls}\n            initial=\"normal\"\n            style={{ transformOrigin: '12px 14px' }}\n          >\n            <motion.path\n              d={TOP_EYELID_OPEN}\n              stroke=\"currentColor\"\n              strokeLinecap=\"round\"\n              strokeLinejoin=\"round\"\n              strokeWidth=\"1.5\"\n              variants={topEyelidVariants}\n              animate={controls}\n              initial=\"normal\"\n            />\n            <motion.path\n              d={BOTTOM_EYELID_OPEN}\n              stroke=\"currentColor\"\n              strokeLinecap=\"round\"\n              strokeLinejoin=\"round\"\n              strokeWidth=\"1.5\"\n              variants={bottomEyelidVariants}\n              animate={controls}\n              initial=\"normal\"\n            />\n          </motion.g>\n        </svg>\n      </div>\n    );\n  }\n);\n\nEyeIcon.displayName = 'EyeIcon';\n\nexport { EyeIcon };\n",
      "type": "registry:ui"
    },
    {
      "path": "lib/use-icon-animation.ts",
      "content": "'use client';\n\nimport type { LegacyAnimationControls } from 'motion/react';\nimport { useReducedMotion } from 'motion/react';\nimport type {\n  ForwardedRef,\n  MouseEventHandler,\n} from 'react';\nimport { useCallback, useImperativeHandle, useRef } from 'react';\n\nexport interface AnimatedIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface UseIconAnimationOptions {\n  controls: LegacyAnimationControls;\n  loops?: boolean;\n  onMouseEnter?: MouseEventHandler<HTMLDivElement>;\n  onMouseLeave?: MouseEventHandler<HTMLDivElement>;\n  ref: ForwardedRef<AnimatedIconHandle>;\n}\n\nexport function useIconAnimation({\n  controls,\n  loops = false,\n  onMouseEnter,\n  onMouseLeave,\n  ref,\n}: UseIconAnimationOptions) {\n  const shouldReduceMotion = useReducedMotion();\n  const isControlledRef = useRef(false);\n  const isPlayingRef = useRef(false);\n  const runRef = useRef(0);\n\n  const startAnimation = useCallback(() => {\n    if (shouldReduceMotion || isPlayingRef.current) return;\n\n    isPlayingRef.current = true;\n    const run = ++runRef.current;\n    controls.set('normal');\n    void controls.start('animate').then(() => {\n      if (runRef.current === run) isPlayingRef.current = false;\n    });\n  }, [controls, shouldReduceMotion]);\n\n  const stopAnimation = useCallback(() => {\n    if (!loops) return;\n\n    runRef.current++;\n    isPlayingRef.current = false;\n    void controls.start('normal');\n  }, [controls, loops]);\n\n  useImperativeHandle(\n    ref,\n    () => {\n      isControlledRef.current = true;\n      return { startAnimation, stopAnimation };\n    },\n    [startAnimation, stopAnimation]\n  );\n\n  const handleMouseEnter = useCallback<MouseEventHandler<HTMLDivElement>>(\n    (event) => {\n      onMouseEnter?.(event);\n      if (!isControlledRef.current) startAnimation();\n    },\n    [onMouseEnter, startAnimation]\n  );\n\n  const handleMouseLeave = useCallback<MouseEventHandler<HTMLDivElement>>(\n    (event) => {\n      onMouseLeave?.(event);\n      if (!isControlledRef.current) stopAnimation();\n    },\n    [onMouseLeave, stopAnimation]\n  );\n\n  return { handleMouseEnter, handleMouseLeave };\n}\n",
      "type": "registry:lib"
    }
  ],
  "type": "registry:ui"
}