{"version":3,"file":"VideoPlayer.CV3S8iPy.mjs","names":["useRef","useState","useCallback"],"sources":["https:/framerusercontent.com/modules/YNh84iAQMFwTstWiFSh3/VbjOLTZeO9AKfXyXlsA9/VideoPlayer.js"],"sourcesContent":["// Lean and fast video component optimized for homepage loading speed\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useRef,useEffect,useState,useCallback}from\"react\";/**\n * Flexible Video Component (Always Autoplay, Mobile Forced)\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function VideoPlayer(props){const{videoFile=\"https://framerusercontent.com/assets/MLWPbW1dUQawJLhhun3dBwpgJak.mp4\",videoUrl=\"\",useUrl=false,posterFile=\"\",autoPoster=false,loop,controls,autoReplay,borderRadius=0,style}=props;const videoRef=useRef(null);const[poster,setPoster]=useState(posterFile);const videoSource=useUrl?videoUrl:videoFile;// Memoized poster capture function\nconst capturePoster=useCallback(()=>{if(!videoRef.current)return;try{const video=videoRef.current;const canvas=document.createElement(\"canvas\");canvas.width=video.videoWidth;canvas.height=video.videoHeight;const ctx=canvas.getContext(\"2d\");if(ctx){ctx.drawImage(video,0,0,canvas.width,canvas.height);const dataUrl=canvas.toDataURL(\"image/jpeg\",.8)// Reduced quality for speed\n;setPoster(dataUrl);}}catch{}},[]);// Optimized poster effect\nuseEffect(()=>{if(!autoPoster||posterFile){setPoster(posterFile);return;}const video=videoRef.current;if(!video)return;if(video.readyState>=2){capturePoster();}else{video.addEventListener(\"loadeddata\",capturePoster,{once:true});return()=>video.removeEventListener(\"loadeddata\",capturePoster);}},[autoPoster,posterFile,videoSource,capturePoster]);// Optimized auto replay\nuseEffect(()=>{if(!autoReplay||!videoRef.current)return;const video=videoRef.current;const handleEnded=()=>{video.currentTime=0;video.play().catch(()=>{});};video.addEventListener(\"ended\",handleEnded);return()=>video.removeEventListener(\"ended\",handleEnded);},[autoReplay]);// Single effect for all video setup - optimized for performance\nuseEffect(()=>{const video=videoRef.current;if(!video)return;// Set all attributes at once\nvideo.muted=true;video.autoplay=true;video.setAttribute(\"muted\",\"\");video.setAttribute(\"autoplay\",\"\");video.setAttribute(\"playsinline\",\"\");video.setAttribute(\"webkit-playsinline\",\"\");// Immediate play attempt\nconst playPromise=video.play();if(playPromise){playPromise.catch(()=>{});}},[videoSource]);return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",position:\"relative\",background:\"transparent\",overflow:\"hidden\",borderRadius:`${borderRadius}px`,...style},children:/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:videoSource,poster:poster||undefined,autoPlay:true,loop:loop,muted:true,playsInline:true,controls:controls,preload:\"metadata\",style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",background:\"transparent\",display:\"block\",borderRadius:`${borderRadius}px`},onLoadedMetadata:()=>{// Single optimized play attempt\nvideoRef.current?.play().catch(()=>{});}})});}addPropertyControls(VideoPlayer,{useUrl:{type:ControlType.Boolean,title:\"Video Source\",enabledTitle:\"URL\",disabledTitle:\"File\",defaultValue:false},videoFile:{type:ControlType.File,allowedFileTypes:[\"mp4\",\"webm\",\"mov\"],hidden:({useUrl})=>useUrl},videoUrl:{type:ControlType.String,title:\"Video URL\",placeholder:\"https://example.com/video.mp4\",hidden:({useUrl})=>!useUrl},posterFile:{type:ControlType.File,allowedFileTypes:[\"jpg\",\"jpeg\",\"png\",\"webp\"]},autoPoster:{type:ControlType.Boolean,title:\"Auto Poster (First Frame)\",defaultValue:false},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:false},controls:{type:ControlType.Boolean,title:\"Controls\",defaultValue:true},autoReplay:{type:ControlType.Boolean,title:\"Auto Replay\",defaultValue:false},borderRadius:{type:ControlType.Number,title:\"Corner Radius\",defaultValue:0,min:0,max:50,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"VideoPlayer\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\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