{"version":3,"file":"ProjectPreviewVideo.DoBlOCAB.mjs","names":["useRef","useMemo","useCallback","__esmMin","pe","init_npm_react_18_3_1","ne","init_ssg_sandbox_shims","window","ce","de","addPropertyControls","init_framer_DcGZRLrs","ControlType","useIsStaticRenderer","ProjectPreviewVideo","props","containerRef","videoRef","hasTriggeredRef","reducedMotionRef","isStatic","hasValidVideo","video","normalizedThreshold","threshold","pauseAtStart","node","container","observer","entries","entry","playPromise","rootStyle","style","backgroundColor","fit","init_ProjectPreviewVideo","init_jsx_runtime"],"sources":["https:/framerusercontent.com/modules/CxH4gFBkYEHcBSOMsKWD/p0AExdgRYHCoMfWoW4Gf/ProjectPreviewVideo.js"],"sourcesContent":["// User request: Create a new small self-contained component named ProjectPreviewVideo that overlays an existing native project thumbnail image, supports an optional MP4 file control (`video`), stays transparent when no valid video is provided, plays once triggered at 40% visibility (configurable threshold), respects reduced motion, forwards style/ref, uses pointer-events none, and does not recreate card layout.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{ControlType,addPropertyControls,useIsStaticRenderer}from\"framer\";import{useCallback,useEffect,useMemo,useRef}from\"react\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ProjectPreviewVideo(props){const{video=\"\",fit=\"cover\",threshold=.4,backgroundColor=\"#FFFFFF\",style,id}=props;const containerRef=useRef(null);const videoRef=useRef(null);const hasTriggeredRef=useRef(false);const reducedMotionRef=useRef(false);const isStatic=useIsStaticRenderer();const hasValidVideo=useMemo(()=>{return typeof video===\"string\"&&/\\.mp4(?:[?#].*)?$/i.test(video.trim());},[video]);const normalizedThreshold=useMemo(()=>{if(!Number.isFinite(threshold))return .4;if(threshold<0)return 0;if(threshold>1)return 1;return threshold;},[threshold]);const pauseAtStart=useCallback(()=>{const node=videoRef.current;if(!node||hasTriggeredRef.current)return;try{node.pause();node.currentTime=0;}catch{// noop\n}},[]);useEffect(()=>{if(typeof window===\"undefined\")return;reducedMotionRef.current=window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;},[]);useEffect(()=>{if(typeof window===\"undefined\")return;if(!hasValidVideo)return;if(isStatic)return;const container=containerRef.current;const node=videoRef.current;if(!container||!node)return;pauseAtStart();const observer=new IntersectionObserver(entries=>{entries.forEach(entry=>{if(hasTriggeredRef.current)return;if(!entry.isIntersecting)return;if(entry.intersectionRatio<normalizedThreshold)return;hasTriggeredRef.current=true;observer.unobserve(entry.target);if(reducedMotionRef.current)return;try{node.currentTime=0;}catch{// noop\n}const playPromise=node.play();if(playPromise&&typeof playPromise.catch===\"function\"){playPromise.catch(()=>{});}});},{threshold:normalizedThreshold});observer.observe(container);return()=>{observer.disconnect();};},[hasValidVideo,isStatic,normalizedThreshold,pauseAtStart]);const rootStyle={width:style?.width??\"100%\",height:style?.height??\"100%\",margin:0,padding:0,overflow:\"hidden\",pointerEvents:\"none\",backgroundColor:hasValidVideo?backgroundColor:\"transparent\",...style};if(!hasValidVideo){return /*#__PURE__*/_jsx(\"div\",{id:id,ref:containerRef,style:rootStyle});}return /*#__PURE__*/_jsx(\"div\",{id:id,ref:containerRef,style:rootStyle,children:/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:video,muted:true,loop:true,playsInline:true,controls:false,preload:\"metadata\",onLoadedMetadata:pauseAtStart,style:{width:\"100%\",height:\"100%\",objectFit:fit,display:\"block\"}})});}addPropertyControls(ProjectPreviewVideo,{video:{type:ControlType.File,title:\"Video\",allowedFileTypes:[\"mp4\"]},fit:{type:ControlType.Enum,title:\"Fit\",options:[\"cover\",\"contain\"],optionTitles:[\"Cover\",\"Contain\"],defaultValue:\"cover\",displaySegmentedControl:true},threshold:{type:ControlType.Number,title:\"Threshold\",defaultValue:.4,min:0,max:1,step:.05},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ProjectPreviewVideo\",\"slots\":[],\"annotations\":{\"framerSupportedLay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