{"version":3,"file":"ProjectVideoRenderer.BQi5R6Z3.mjs","names":["useRef","useState","useMemo","useCallback","__esmMin","pe","init_npm_react_18_3_1","ne","te","_e","p","c","init_jsx_runtime","ce","de","init_framer_BWFVvmND","addPropertyControls","ControlType","ProjectVideoRenderer","props","videoRef","filmStarted","setFilmStarted","isVideoReady","setIsVideoReady","hasVideoError","setHasVideoError","didAttemptAutoplay","setDidAttemptAutoplay","resolved","raw","videoUrl","parsed","host","isDirectVideoFile","isFramerAsset","filmMode","element","cancelled","onVideoCanPlay","onVideoError","onVideoEnded","poster","filmPoster","posterUrl","style","video","init_ProjectVideoRenderer"],"sources":["https:/framerusercontent.com/modules/lLo0wpXZJTZ7SR7yf5bj/Z5xnOVHN0sSu9W1X8rcO/ProjectVideoRenderer.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useCallback,useEffect,useMemo,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function ProjectVideoRenderer(props){const{videoUrl,filmMode=false,filmPoster,posterUrl=\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",background,style}=props;const videoRef=useRef(null);const[filmStarted,setFilmStarted]=useState(false);const[isVideoReady,setIsVideoReady]=useState(false);const[hasVideoError,setHasVideoError]=useState(false);const[didAttemptAutoplay,setDidAttemptAutoplay]=useState(false);const resolved=useMemo(()=>{const raw=(videoUrl??\"\").trim();if(!raw){return{kind:\"none\",src:\"\"};}try{const parsed=new URL(raw);const host=parsed.hostname.toLowerCase();const pathname=parsed.pathname;const isDirectVideoFile=/\\.(mp4|mov|webm|m4v|ogv)(\\?.*)?$/i.test(raw);const isFramerAsset=host.endsWith(\"framerusercontent.com\");if(isDirectVideoFile||isFramerAsset){return{kind:\"direct\",src:raw};}return{kind:\"unsupported\",src:\"\"};}catch{return{kind:\"unsupported\",src:\"\"};}},[videoUrl]);useEffect(()=>{startTransition(()=>{setIsVideoReady(false);setHasVideoError(false);setDidAttemptAutoplay(false);setFilmStarted(false);});},[resolved.src]);useEffect(()=>{if(filmMode||resolved.kind!==\"direct\"||didAttemptAutoplay)return;const element=videoRef.current;if(!element)return;let cancelled=false;const attemptAutoplay=async()=>{try{await element.play();}catch{// Keep poster visible when autoplay is blocked.\n}finally{if(!cancelled){startTransition(()=>setDidAttemptAutoplay(true));}}};void attemptAutoplay();return()=>{cancelled=true;};},[resolved.kind,didAttemptAutoplay,filmMode]);const onVideoCanPlay=useCallback(()=>{startTransition(()=>setIsVideoReady(true));},[]);const onVideoError=useCallback(()=>{startTransition(()=>{setHasVideoError(true);setIsVideoReady(false);});},[]);const onVideoEnded=useCallback(()=>{const element=videoRef.current;if(!element)return;if(Number.isFinite(element.duration)&&element.duration>0){element.currentTime=Math.max(0,element.duration-.001);}element.pause();},[]);if(filmMode){const poster=filmPoster||posterUrl;return /*#__PURE__*/_jsxs(\"div\",{style:{...style,position:\"relative\",width:\"100%\",height:\"100%\",minWidth:0,minHeight:0,overflow:\"hidden\",background:\"#151512\",borderRadius:8},children:[/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:resolved.kind===\"direct\"?resolved.src:undefined,poster:poster,controls:filmStarted,playsInline:true,preload:\"none\",\"aria-label\":\"Project film\",onError:onVideoError,style:{display:\"block\",width:\"100%\",height:\"100%\",objectFit:filmStarted?\"contain\":\"cover\"}}),!filmStarted&&!hasVideoError&&/*#__PURE__*/_jsxs(\"button\",{type:\"button\",\"aria-label\":\"Watch the project film\",onClick:async()=>{const video=videoRef.current;if(!video)return;try{await video.play();setFilmStarted(true);}catch{setHasVideoError(true);}},style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",border:0,background:\"linear-gradient(0deg,rgba(0,0,0,.4),transparent 65%)\",color:\"white\",cursor:\"pointer\",display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",gap:14},children:[/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{width:68,height:68,border:\"1px solid rgba(255,255,255,.85)\",borderRadius:\"50%\",display:\"grid\",placeItems:\"center\",background:\"rgba(25,25,21,.35)\",fontSize:23},children:\"▶\"}),/*#__PURE__*/_jsx(\"span\",{style:{fontFamily:\"Inter, sans-serif\",fontSize:12,letterSpacing:2,textTransform:\"uppercase\"},children:\"Watch the Film\"})]}),hasVideoError&&/*#__PURE__*/_jsxs(\"div\",{role:\"status\",style:{position:\"absolute\",inset:0,background:\"rgba(0,0,0,.7)\",display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",gap:12,padding:24,color:\"white\",textAlign:\"center\",fontFamily:\"Inter,sans-serif\"},children:[/*#__PURE__*/_jsx(\"span\",{children:\"This film could not play in this browser.\"}),/*#__PURE__*/_jsx(\"a\",{href:resolved.src||videoUrl,target:\"_blank\",rel:\"noopener noreferrer\",style:{color:\"white\",textDecoration:\"underline\"},children:\"Open the original film\"})]})]});}if(resolved.kind===\"direct\"){return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",minWidth:0,minHeight:0,margin:0,padding:0,overflow:\"hidden\",background,...style},children:[/*#__PURE__*/_jsx(\"img\",{src:posterUrl,alt:\"\",style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\"}}),/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:resolved.src,poster:posterUrl,controls:false,autoPlay:true,muted:true,playsInline:true,preload:\"auto\",loop:false,onCanPlay:onVideoCanPlay,onError:onVideoError,onEnded:onVideoEnded,\"aria-hidden\":\"true\",style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:\"cover\",background:\"transparent\",opacity:isVideoReady&&!hasVideoError?1:0,transition:\"opacity 240ms ease\",display:\"block\"}})]});}return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",minWidth:0,minHeight:0,margin:0,padding:0,overflow:\"hidden\",background,...style},children:/*#__PURE__*/_jsx(\"img\",{src:posterUrl,alt:\"\",style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\"}})});}addPropertyControls(ProjectVideoRenderer,{filmMode:{type:ControlType.Boolean,title:\"Click to Play\",defaultValue:false},filmPoster:{type:ControlType.Image,title:\"Film Poster\"},videoUrl:{type:ControlType.String,title:\"Video URL\",defaultValue:\"\",placeholder:\"https://.../video.mp4\"},posterUrl:{type:ControlType.String,title:\"Poster URL\",defaultValue:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",placeholder:\"https://.../poster.jpg\"},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ProjectVideoRenderer\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ProjectVideoRenderer.map"],"mappings":"A,oNAGG,SAAwBkB,EAAqB,EAAM,CAAC,GAAK,CAAC,WAAS,WAAS,GAAM,aAAW,YAAU,sEAAsE,aAAW,SAAOC,EAAYC,EAASpB,EAAO,IAAI,EAAO,CAACqB,EAAYC,GAAgBrB,EAAS,EAAK,EAAO,CAACsB,EAAaC,GAAiBvB,EAAS,EAAK,EAAO,CAACwB,EAAcC,GAAkBzB,EAAS,EAAK,EAAO,CAAC0B,EAAmBC,GAAuB3B,EAAS,EAAK,EAAQ4B,EAAS3B,MAAY,CAAC,IAAM4B,GAAKC,GAAU,GAAA,CAAI,KAAK,EAAE,GAAG,CAACD,EAAK,MAAM,CAAC,KAAK,OAAO,IAAI,EAAE,EAAG,GAAG,CAAC,IAAME,EAAO,IAAI,IAAIF,CAA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