{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "copy-02",
  "title": "copy-02",
  "description": "Animated copy icon",
  "dependencies": [
    "motion"
  ],
  "files": [
    {
      "path": "icons/copy-02.tsx",
      "content": "'use client';\n\nimport type { Easing, 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 Copy02IconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface Copy02IconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst COPY_DURATION = 0.86;\nconst COPY_TIMES = [0, 0.1, 0.34, 0.46, 0.56, 0.76, 0.88, 1];\nconst COPY_EASING: Easing[] = [\n  [0.23, 1, 0.32, 1],\n  [0.77, 0, 0.175, 1],\n  [0.23, 1, 0.32, 1],\n  'linear',\n  [0.77, 0, 0.175, 1],\n  [0.23, 1, 0.32, 1],\n  [0.23, 1, 0.32, 1],\n];\n\n// The dashed front sheet grows to cover the rear panel, pauses, then returns.\nconst frontVariants: Variants = {\n  normal: { transform: 'translate(0px, 0px) scale(1)', strokeWidth: 1.5 },\n  animate: {\n    transform: [\n      'translate(0px, 0px) scale(1)',\n      'translate(0.45px, 0.45px) scale(0.97)',\n      'translate(-6.2px, -6.2px) scale(1.2)',\n      'translate(-6px, -6px) scale(1.14)',\n      'translate(-6px, -6px) scale(1.14)',\n      'translate(0.65px, 0.65px) scale(0.96)',\n      'translate(-0.25px, -0.25px) scale(1.03)',\n      'translate(0px, 0px) scale(1)',\n    ],\n    strokeWidth: [1.5, 1.5 / 0.97, 1.5 / 1.2, 1.5 / 1.14, 1.5 / 1.14, 1.5 / 0.96, 1.5 / 1.03, 1.5],\n    transition: { duration: COPY_DURATION, ease: COPY_EASING, times: COPY_TIMES },\n  },\n};\n\n// The invisible mask grows during the overlap so the rear panel is fully hidden.\n// Mask content moves through its attributes, not CSS transforms.\nconst occlusionVariants: Variants = {\n  normal: { attrX: 9, attrY: 9, width: 13, height: 13, rx: 2.5 },\n  animate: {\n    attrX: [9, 9.645, 1.24, 1.83, 1.83, 9.26, 8.555, 9],\n    attrY: [9, 9.645, 1.24, 1.83, 1.83, 9.26, 8.555, 9],\n    width: [13, 12.61, 16.12, 15.34, 15.34, 13.78, 13.39, 13],\n    height: [13, 12.61, 16.12, 15.34, 15.34, 13.78, 13.39, 13],\n    rx: [2.5, 2.425, 3.1, 2.95, 2.95, 2.65, 2.575, 2.5],\n    transition: { duration: COPY_DURATION, ease: COPY_EASING, times: COPY_TIMES },\n  },\n};\n\n// The occlusion mask is only active while the sheets overlap; at rest it would\n// trim the ends of the rear panel.\nconst generatedGeometryVariants: Variants = {\n  normal: { visibility: 'hidden', transition: { duration: 0.08 } },\n  animate: {\n    visibility: ['visible', 'visible', 'hidden'],\n    transition: { duration: COPY_DURATION, times: [0, 0.999, 1] },\n  },\n};\n\nconst Copy02Icon = forwardRef<Copy02IconHandle, Copy02IconProps>(\n  ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {\n    const occlusionMaskId = useId();\n    const controls = useAnimation();\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            <mask\n              id={occlusionMaskId}\n              maskUnits=\"userSpaceOnUse\"\n              x=\"-4\"\n              y=\"-4\"\n              width=\"32\"\n              height=\"32\"\n            >\n              <rect x=\"-4\" y=\"-4\" width=\"32\" height=\"32\" fill=\"white\" />\n              <motion.g\n                variants={generatedGeometryVariants}\n                animate={controls}\n                initial=\"normal\"\n              >\n                <motion.rect\n                  x=\"9\"\n                  y=\"9\"\n                  width=\"13\"\n                  height=\"13\"\n                  rx=\"2.5\"\n                  fill=\"black\"\n                  stroke=\"black\"\n                  strokeWidth=\"2.5\"\n                  variants={occlusionVariants}\n                  animate={controls}\n                  initial=\"normal\"\n                />\n              </motion.g>\n            </mask>\n          </defs>\n          <motion.path\n            d=\"M14.0283 9.02455L16.994 8.98193M14.0143 22.0013L16.9799 21.9586M21.9716 14.0221L21.9436 16.9818M9.01033 14.0357L8.98236 16.9953M11.4873 9.02455C10.6545 9.17371 9.31781 9.32713 9.01033 11.0488M19.4946 21.9586C20.3296 21.8223 21.6685 21.6894 22.0025 19.9726M19.4946 9.02455C20.3274 9.17371 21.6641 9.32713 21.9716 11.0488M11.5 21.9573C10.6672 21.8086 9.33039 21.6559 9.02197 19.9344\"\n            stroke=\"currentColor\"\n            strokeLinecap=\"round\"\n            strokeLinejoin=\"round\"\n            strokeWidth=\"1.5\"\n            variants={frontVariants}\n            animate={controls}\n            initial=\"normal\"\n            style={{ transformBox: 'view-box', originX: 15.5 / 24, originY: 15.5 / 24 }}\n          />\n          <path\n            d=\"M16.9637 8.98209C16.9613 6.03194 16.9167 4.50384 16.0578 3.45753C15.892 3.25546 15.7067 3.07019 15.5047 2.90436C14.4008 1.99854 12.7609 1.99854 9.48087 1.99854C6.20089 1.99854 4.5609 1.99854 3.45708 2.90436C3.255 3.07018 3.06971 3.25546 2.90387 3.45753C1.99799 4.56128 1.99799 6.20116 1.99799 9.48091C1.99799 12.7607 1.99799 14.4005 2.90387 15.5043C3.0697 15.7063 3.255 15.8916 3.45708 16.0574C4.50346 16.9162 6.03167 16.9608 8.98201 16.9632\"\n            stroke=\"currentColor\"\n            strokeLinecap=\"round\"\n            strokeLinejoin=\"round\"\n            strokeWidth=\"1.5\"\n            mask={`url(#${occlusionMaskId})`}\n          />\n        </svg>\n      </div>\n    );\n  }\n);\n\nCopy02Icon.displayName = 'Copy02Icon';\n\nexport { Copy02Icon };\n",
      "type": "registry:ui"
    },
    {
      "path": "lib/use-icon-animation.ts",
      "content": "'use client';\n\nimport type { LegacyAnimationControls } from 'motion/react';\nimport { spring, useReducedMotion } from 'motion/react';\nimport type {\n  ForwardedRef,\n  MouseEventHandler,\n} from 'react';\nimport { useCallback, useImperativeHandle, useRef } from 'react';\n\n/**\n * A damped spring as the easing of one keyframe segment: the value overshoots\n * its target and settles on it. Use it for landings so every icon shares the\n * same physical bounce. Higher `bounce` gives more oscillation.\n */\nexport function springEase(bounce = 0.45, visualDuration = 0.35) {\n  const generator = spring({ keyframes: [0, 1], bounce, visualDuration });\n  let settle = 0;\n  while (!generator.next(settle).done && settle < 5000) settle += 10;\n  return (progress: number) =>\n    progress >= 1 ? 1 : generator.next(progress * settle).value;\n}\n\nconst NUMBER = /-?\\d*\\.?\\d+/g;\n\n/**\n * The path at position `t` along a row of poses that share the same path\n * commands: `t = 1` is the second pose, `t = 1.5` is halfway to the third.\n * Waves use it to move along their own curvature instead of scaling, so the\n * stroke keeps its width.\n */\nexport function pathAt(poses: string[], t: number) {\n  const i = Math.min(Math.max(Math.floor(t), 0), poses.length - 2);\n  const to = poses[i + 1].match(NUMBER) ?? [];\n  let k = 0;\n  return poses[i].replace(NUMBER, (from) => {\n    const value = Number(from) + (Number(to[k++]) - Number(from)) * (t - i);\n    return String(Math.round(value * 10000) / 10000);\n  });\n}\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"
}