{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hourglass",
  "title": "hourglass",
  "description": "Animated hourglass icon",
  "dependencies": [
    "motion"
  ],
  "files": [
    {
      "path": "icons/hourglass.tsx",
      "content": "'use client';\n\nimport type { Variants } from 'motion/react';\nimport { motion, useAnimation } from 'motion/react';\nimport type { HTMLAttributes } from 'react';\nimport { forwardRef } from 'react';\nimport { useIconAnimation } from '@/lib/use-icon-animation';\nimport { cn } from '@/lib/utils';\n\nexport interface HourglassIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface HourglassIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\n// Time running: the top sand surface sinks into a deepening funnel and drains\n// through the neck as a falling stream while a mound builds in the bottom bulb.\n// Then the glass winds up and turns over with a small overshoot. The full\n// bottom mound turned over is exactly the full top surface, so every cycle\n// continues without a jump.\nconst SAND_CYCLE = 2.6;\nconst SAND_TIMES = [0, 0.06, 0.12, 0.4, 0.6, 0.66, 0.7, 0.76, 0.9, 0.96, 1];\n\nconst TOP_FULL = 'M17.2 4.6Q12 7 6.8 4.6';\nconst TOP_HALF = 'M15.7 8Q12 10.2 8.3 8';\nconst TOP_LOW = 'M12.8 10.4Q12 11 11.2 10.4';\nconst TOP_EMPTY = 'M12.1 11.2Q12 11.3 11.9 11.2';\nconst BOTTOM_EMPTY = 'M11 20.2Q12 20 13 20.2';\nconst BOTTOM_HALF = 'M8.2 20Q12 18.2 15.8 20';\nconst BOTTOM_FULL = 'M6.8 19.4Q12 17 17.2 19.4';\nconst STREAM_START = 'M12 12.8L12 12.8';\nconst STREAM_LONG = 'M12 12.8L12 19.6';\nconst STREAM_SHORT = 'M12 12.8L12 17.8';\nconst STREAM_END = 'M12 17.6L12 17.6';\n\nconst SAND_LOOP = {\n  duration: SAND_CYCLE,\n  ease: 'easeInOut',\n  times: SAND_TIMES,\n  repeat: Infinity,\n} as const;\n\nconst flipVariants: Variants = {\n  normal: { transform: 'rotate(0deg)', transition: { duration: 0.25 } },\n  animate: {\n    transform: [\n      ...Array(7).fill('rotate(0deg)'),\n      'rotate(-10deg)',\n      'rotate(188deg)',\n      'rotate(178.5deg)',\n      'rotate(180deg)',\n    ],\n    transition: SAND_LOOP,\n  },\n};\n\nconst topSandVariants: Variants = {\n  normal: { d: TOP_FULL },\n  animate: {\n    d: [TOP_FULL, TOP_FULL, TOP_FULL, TOP_HALF, TOP_LOW, ...Array(6).fill(TOP_EMPTY)],\n    visibility: [...Array(5).fill('visible'), ...Array(6).fill('hidden')],\n    transition: SAND_LOOP,\n  },\n};\n\nconst bottomSandVariants: Variants = {\n  normal: { d: BOTTOM_EMPTY, visibility: 'hidden' },\n  animate: {\n    d: [BOTTOM_EMPTY, BOTTOM_EMPTY, BOTTOM_EMPTY, BOTTOM_HALF, ...Array(7).fill(BOTTOM_FULL)],\n    visibility: ['hidden', 'hidden', ...Array(9).fill('visible')],\n    transition: SAND_LOOP,\n  },\n};\n\nconst streamVariants: Variants = {\n  normal: { d: STREAM_START, visibility: 'hidden' },\n  animate: {\n    d: [STREAM_START, STREAM_START, STREAM_LONG, STREAM_LONG, STREAM_SHORT, STREAM_SHORT, ...Array(5).fill(STREAM_END)],\n    visibility: ['hidden', ...Array(5).fill('visible'), ...Array(5).fill('hidden')],\n    transition: SAND_LOOP,\n  },\n};\n\n// The sand grows out of the neck once at the start instead of popping in.\nconst sandInVariants: Variants = {\n  normal: { scale: 0 },\n  animate: { scale: 1, transition: { duration: 0.3, ease: [0.23, 1, 0.32, 1] } },\n};\n\nconst generatedGeometryVariants: Variants = {\n  normal: { visibility: 'hidden', transition: { duration: 0 } },\n  animate: { visibility: 'visible', transition: { duration: 0 } },\n};\n\nconst HourglassIcon = forwardRef<HourglassIconHandle, HourglassIconProps>(\n  ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {\n    const controls = useAnimation();\n    const { handleMouseEnter, handleMouseLeave } = useIconAnimation({\n      controls,\n      loops: true,\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        <motion.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          variants={flipVariants}\n          animate={controls}\n          initial=\"normal\"\n          style={{ transformBox: 'fill-box' }}\n        >\n          <path\n            d=\"M4 3H20\"\n            stroke=\"currentColor\"\n            strokeLinecap=\"round\"\n            strokeLinejoin=\"round\"\n            strokeWidth=\"1.5\"\n          />\n          <path\n            d=\"M5.5 3V5.03039C5.5 6.27227 6.07682 7.4437 7.06116 8.20089L12 12L16.9388 8.20089C17.9232 7.44371 18.5 6.27227 18.5 5.03039V3\"\n            stroke=\"currentColor\"\n            strokeLinecap=\"round\"\n            strokeLinejoin=\"round\"\n            strokeWidth=\"1.5\"\n          />\n          <path\n            d=\"M5.5 21V18.9696C5.5 17.7277 6.07682 16.5563 7.06116 15.7991L12 12L16.9388 15.7991C17.9232 16.5563 18.5 17.7277 18.5 18.9696V21\"\n            stroke=\"currentColor\"\n            strokeLinecap=\"round\"\n            strokeLinejoin=\"round\"\n            strokeWidth=\"1.5\"\n          />\n          <path\n            d=\"M4 21H20\"\n            stroke=\"currentColor\"\n            strokeLinecap=\"round\"\n            strokeLinejoin=\"round\"\n            strokeWidth=\"1.5\"\n          />\n          <motion.g\n            variants={generatedGeometryVariants}\n            animate={controls}\n            initial=\"normal\"\n          >\n            <motion.g\n              variants={sandInVariants}\n              animate={controls}\n              initial=\"normal\"\n              style={{ transformBox: 'view-box' }}\n            >\n              <motion.path\n                d={TOP_FULL}\n                stroke=\"currentColor\"\n                strokeLinecap=\"round\"\n                strokeWidth=\"1.5\"\n                variants={topSandVariants}\n                animate={controls}\n                initial=\"normal\"\n              />\n              <motion.path\n                d={STREAM_START}\n                stroke=\"currentColor\"\n                strokeLinecap=\"round\"\n                strokeWidth=\"1.5\"\n                variants={streamVariants}\n                animate={controls}\n                initial=\"normal\"\n              />\n              <motion.path\n                d={BOTTOM_EMPTY}\n                stroke=\"currentColor\"\n                strokeLinecap=\"round\"\n                strokeWidth=\"1.5\"\n                variants={bottomSandVariants}\n                animate={controls}\n                initial=\"normal\"\n              />\n            </motion.g>\n          </motion.g>\n        </motion.svg>\n      </div>\n    );\n  }\n);\n\nHourglassIcon.displayName = 'HourglassIcon';\n\nexport { HourglassIcon };\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"
}