{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "router",
  "type": "registry:ui",
  "registryDependencies": [],
  "dependencies": ["motion"],
  "devDependencies": [],
  "files": [
    {
      "path": "router.tsx",
      "content": "\"use client\";\n\nimport { motion, useAnimation, type Variants } from \"motion/react\";\nimport type { HTMLAttributes } from \"react\";\nimport { forwardRef, useCallback, useImperativeHandle, useRef } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface RouterIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface RouterIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst PATH_VARIANTS: Variants = {\n  normal: {\n    opacity: 1,\n    transition: {\n      duration: 0.4,\n    },\n  },\n  fadeOut: {\n    opacity: 0,\n    transition: { duration: 0.3 },\n  },\n  fadeIn: (i: number) => ({\n    opacity: 1,\n    transition: {\n      type: \"spring\",\n      stiffness: 300,\n      damping: 20,\n      delay: i * 0.1,\n    },\n  }),\n};\n\nconst RouterIcon = forwardRef<RouterIconHandle, RouterIconProps>(\n  ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {\n    const pathControls = useAnimation();\n    const isControlledRef = useRef(false);\n\n    const runPathIntro = useCallback(async () => {\n      await pathControls.start(\"fadeOut\");\n      pathControls.start(\"fadeIn\");\n    }, [pathControls]);\n\n    useImperativeHandle(ref, () => {\n      isControlledRef.current = ref != null;\n      return {\n        startAnimation: async () => {\n          await runPathIntro();\n        },\n        stopAnimation: () => {\n          pathControls.start(\"normal\");\n        },\n      };\n    }, [pathControls, ref, runPathIntro]);\n\n    const handleMouseEnter = useCallback(\n      async (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseEnter?.(e);\n        } else {\n          await runPathIntro();\n        }\n      },\n      [onMouseEnter, runPathIntro]\n    );\n\n    const handleMouseLeave = useCallback(\n      (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseLeave?.(e);\n        } else {\n          pathControls.start(\"normal\");\n        }\n      },\n      [onMouseLeave, pathControls]\n    );\n\n    return (\n      <div\n        className={cn(className)}\n        onMouseEnter={handleMouseEnter}\n        onMouseLeave={handleMouseLeave}\n        {...props}\n      >\n        <motion.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          <rect height=\"8\" rx=\"2\" width=\"20\" x=\"2\" y=\"14\" />\n          <path d=\"M6.01 18H6\" />\n          <path d=\"M10.01 18H10\" />\n          <path d=\"M15 10v4\" />\n          <motion.path\n            animate={pathControls}\n            custom={1}\n            d=\"M17.84 7.17a4 4 0 0 0-5.66 0\"\n            initial={{ opacity: 1 }}\n            variants={PATH_VARIANTS}\n          />\n          <motion.path\n            animate={pathControls}\n            custom={2}\n            d=\"M20.66 4.34a8 8 0 0 0-11.31 0\"\n            initial={{ opacity: 1 }}\n            variants={PATH_VARIANTS}\n          />\n        </motion.svg>\n      </div>\n    );\n  }\n);\n\nRouterIcon.displayName = \"RouterIcon\";\n\nexport { RouterIcon };\n",
      "type": "registry:ui"
    }
  ]
}
