{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "mobile-video-player",
  "dependencies": [
    "framer-motion",
    "lucide-react",
    "motion"
  ],
  "files": [
    {
      "path": "src/components/watermelon-ui/mobile-video-player.tsx",
      "content": "\"use client\";\n\nimport React, { useState, useRef, useEffect, useCallback, type ChangeEvent, type MouseEvent } from 'react';\nimport { motion, AnimatePresence } from 'framer-motion';\nimport { Play, Pause } from 'lucide-react';\n\ninterface ModernVideoPlayerProps {\n  src: string;\n  loop?: boolean;\n  autoPlay?: boolean;\n  poster?: string;\n  className?: string;\n}\n\nexport const MobileVideoPlayer: React.FC<ModernVideoPlayerProps> = ({\n  src,\n  loop = true,\n  autoPlay = false,\n  poster,\n  className = '',\n}) => {\n  const [isPlaying, setIsPlaying] = useState(autoPlay);\n  const [progress, setProgress] = useState(0);\n  const [isHovered, setIsHovered] = useState(false);\n  const [hoverProgress, setHoverProgress] = useState<number | null>(null);\n  const [hoverX, setHoverX] = useState(0);\n  const [duration, setDuration] = useState(0);\n\n  const videoRef = useRef<HTMLVideoElement | null>(null);\n  const seekBarRef = useRef<HTMLDivElement | null>(null);\n\n  const togglePlay = useCallback(() => {\n    if (videoRef.current) {\n      if (isPlaying) {\n        videoRef.current.pause();\n      } else {\n        videoRef.current.play().catch(() => { });\n      }\n      setIsPlaying(!isPlaying);\n    }\n  }, [isPlaying]);\n\n  useEffect(() => {\n    const handleKeyDown = (e: KeyboardEvent) => {\n      if (e.code === 'Space') {\n        e.preventDefault();\n        togglePlay();\n      }\n    };\n    window.addEventListener('keydown', handleKeyDown);\n    return () => window.removeEventListener('keydown', handleKeyDown);\n  }, [togglePlay]);\n\n  const handleTimeUpdate = () => {\n    if (videoRef.current && videoRef.current.duration) {\n      setProgress((videoRef.current.currentTime / videoRef.current.duration) * 100);\n    }\n  };\n\n  const handleLoadedMetadata = () => {\n    if (videoRef.current && videoRef.current.duration) {\n      setDuration(videoRef.current.duration);\n    }\n  };\n\n  const handleSeek = (e: ChangeEvent<HTMLInputElement>) => {\n    const val = Number(e.target.value);\n    if (videoRef.current && videoRef.current.duration) {\n      videoRef.current.currentTime = (val / 100) * videoRef.current.duration;\n      setProgress(val);\n    }\n  };\n\n  const handleMouseMove = (e: MouseEvent<HTMLDivElement>) => {\n    if (seekBarRef.current) {\n      const rect = seekBarRef.current.getBoundingClientRect();\n      const x = e.clientX - rect.left;\n      const percentage = Math.max(0, Math.min(100, (x / rect.width) * 100));\n      setHoverProgress(percentage);\n      setHoverX(x);\n    }\n  };\n\n  const formatTime = (timeInSeconds?: number) => {\n    const total = timeInSeconds || 0;\n    const mins = Math.floor(total / 60);\n    const secs = Math.floor(total % 60);\n    return `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;\n  };\n\n  const formatHoverTime = (percent: number) => {\n    const total = duration || 0;\n    const seconds = (percent / 100) * total;\n    return formatTime(seconds);\n  };\n\n  return (\n    <div className={`min-h-screen w-full flex flex-col items-center justify-center p-6 select-none font-sans transition-colors duration-300 bg-transparent text-[#1a1a1a]  dark:text-white ${className}`}>\n\n      <div className=\"relative scale-[0.85] sm:scale-100 transition-transform duration-500\">\n        <div className=\"relative w-70 h-145 sm:w-75 sm:h-150 bg-gray-100 dark:bg-[#1a1a1a] rounded-[55px] p-3 shadow-xl border border-black/5 dark:border-white/10 transition-colors\">\n\n          {/* Screen */}\n          <div\n            className=\"relative w-full h-full bg-black rounded-[43px] overflow-hidden cursor-pointer\"\n            onClick={togglePlay}\n          >\n            {/* Notch */}\n            <div className=\"absolute top-0 left-1/2 -translate-x-1/2 w-27.5 sm:w-30 h-6.25 sm:h-7.5 bg-[#1a1a1a] dark:bg-[#0a0a0a] z-50 rounded-b-4xl\" />\n\n            <video\n              ref={videoRef}\n              onTimeUpdate={handleTimeUpdate}\n              onLoadedMetadata={handleLoadedMetadata}\n              className=\"w-full h-full object-cover\"\n              src={src}\n              loop={loop}\n              autoPlay={autoPlay}\n              poster={poster}\n              playsInline\n            />\n\n            {/* Play/Pause Overlay */}\n            <div className=\"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-none z-50\">\n              <AnimatePresence mode=\"wait\">\n                {!isPlaying ? (\n                  <motion.div\n                    key=\"play\"\n                    initial={{ scale: 0.8, opacity: 0 }}\n                    animate={{ scale: 1, opacity: 1 }}\n                    exit={{ scale: 1.2, opacity: 0 }}\n                    className=\"flex items-center justify-center backdrop-blur-xl p-6 rounded-full border border-white/20 bg-white/10\"\n                  >\n                    <Play size={36} className=\"fill-white text-white \" />\n                  </motion.div>\n                ) : (\n                  <motion.div\n                    key=\"pause\"\n                    initial={{ opacity: 0 }}\n                    whileHover={{ opacity: 1 }}\n                    className=\"flex items-center justify-center backdrop-blur-xl p-6 rounded-full opacity-0 transition-opacity duration-300 border border-white/20 bg-white/10\"\n                  >\n                    <Pause size={36} className=\"fill-white text-white\" />\n                  </motion.div>\n                )}\n              </AnimatePresence>\n            </div>\n          </div>\n        </div>\n      </div>\n\n      {/* External Controls Area */}\n      <div className=\"w-full max-w-100 sm:max-w-112.5 mt-8 sm:mt-12 space-y-6\">\n        <div\n          className=\"relative px-1\"\n          onMouseMove={handleMouseMove}\n          onMouseEnter={() => setIsHovered(true)}\n          onMouseLeave={() => {\n            setIsHovered(false);\n            setHoverProgress(null);\n          }}\n        >\n          {/* Seek Preview Tooltip */}\n          <AnimatePresence>\n            {isHovered && hoverProgress !== null && (\n              <motion.div\n                initial={{ opacity: 0, y: 5 }}\n                animate={{ opacity: 1, y: 0 }}\n                exit={{ opacity: 0 }}\n                className=\"absolute z-30 pointer-events-none\"\n                style={{ left: hoverX }}\n              >\n                <div className=\"absolute bottom-12 -translate-x-1/2 bg-[#1a1a1a] dark:bg-white text-white dark:text-black px-2 py-1 rounded text-[10px] font-bold font-mono shadow-xl transition-colors\">\n                  {formatHoverTime(hoverProgress)}\n                </div>\n                <div className=\"absolute -bottom-2] -translate-x-1/2 w-0.5 h-12 bg-[#ff6b00]\" />\n              </motion.div>\n            )}\n          </AnimatePresence>\n\n          {/* Progress Bar Container */}\n          <motion.div\n            ref={seekBarRef}\n            animate={{ height: isHovered ? 24 : 6 }}\n            className=\"relative w-full bg-black/10 dark:bg-white/10 rounded-lg overflow-hidden flex items-center transition-colors\"\n          >\n            <motion.div\n              className=\"absolute h-full bg-[#1a1a1a] dark:bg-[#C1C1C1]\"\n              style={{ width: `${progress}%` }}\n            />\n            <input\n              title=\"seek\"\n              type=\"range\"\n              min=\"0\"\n              max=\"100\"\n              step=\"0.1\"\n              value={progress}\n              onChange={handleSeek}\n              className=\"absolute inset-0 w-full h-full opacity-0 cursor-pointer z-40\"\n            />\n          </motion.div>\n\n          {/* Time Displays */}\n          <div className=\"flex justify-between mt-4 text-[10px] sm:text-xs font-mono tracking-widest text-[#1a1a1a]/60 dark:text-white/60\">\n            <span>{formatTime((progress / 100) * duration)}</span>\n            <span>{formatTime(duration)}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n};",
      "type": "registry:ui",
      "target": "components/ui/mobile-video-player.tsx"
    }
  ],
  "type": "registry:ui"
}
