{"version":3,"file":"DeferredVideo.B11XRY0v.mjs","names":["useState","useRef","__esmMin","init_ssg_sandbox_shims","navigator","window","_e","p","ce","init_npm_react_18_3_1","de","addPropertyControls","useIsStaticRenderer","ControlType","init_framer_B1b760uK","posterSrcSet","m","src","w","DeferredVideo","props","isStatic","setSrc","playing","setPlaying","root","playOn","file","videoPhone","video","events","timer","fallback","near","wanted","io","entries","go","cleanup","name","arm","delay","cover","fit","style","poster","posterAlt","init_DeferredVideo","init_jsx_runtime"],"sources":["https:/framerusercontent.com/modules/FEx6G3XhhpCBiEGIUFj2/RAWktz2HCv9f0yG0AUWH/DeferredVideo.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useEffect,useRef,useState}from\"react\";/**\n * Background video that paints its poster right away and starts streaming on the first interaction\n * or a few seconds after the page has loaded, so it never competes with the first paint. Phones get their own lighter file.\n * Speed (Oct 2026): nothing is downloaded while the video is far from the screen; it arms once it comes within\n * about one screen of the viewport, so visitors who never scroll to it never download it.\n *\n * @framerIntrinsicWidth 1440\n * @framerIntrinsicHeight 600\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */// Posters picked in Framer often arrive as one full-size file. The same image under /images/ can be resized by the CDN,\n// so phones download a small version of the first-screen image instead of the original.\nfunction posterSrcSet(src){const m=src&&src.match(/^https:\\/\\/framerusercontent\\.com\\/(?:assets|images)\\/([A-Za-z0-9]+\\.(?:jpe?g|png|webp))/i);if(!m)return undefined;return[640,960,1280,1920,2560].map(w=>`https://framerusercontent.com/images/${m[1]}?scale-down-to=${w} ${w}w`).join(\", \");}export default function DeferredVideo(props){const{video=\"https://framerusercontent.com/assets/W44ZbSEtUWD03NUOfs1AdJ6E8Q.mp4\",videoPhone=\"\",poster={src:\"https://framerusercontent.com/images/0Yw50zQAVD4n2yii3IMDhkm6pg.jpg\",alt:\"\"},posterAlt=\"\",fit=\"cover\",delay=6,playOn=\"all\",style}=props;const isStatic=useIsStaticRenderer();const[src,setSrc]=useState(\"\");const[playing,setPlaying]=useState(false);const root=useRef(null);useEffect(()=>{if(isStatic||typeof window===\"undefined\")return;const connection=navigator.connection;if(connection?.saveData)return;// \"Large screens only\": phones and tablets keep the still cover image and never download the video.\nif(playOn===\"large\"&&!window.matchMedia(\"(min-width: 1200px)\").matches)return;const phone=window.matchMedia(\"(max-width: 809px)\").matches;const file=phone&&videoPhone?videoPhone:video;// User-intent events only: Framer restores the scroll position after a reload, which fires \"scroll\" by itself.\nconst events=[\"pointerdown\",\"touchstart\",\"keydown\",\"wheel\"];let timer=0;let fallback=0;let near=typeof IntersectionObserver===\"undefined\";let wanted=false;const io=near?null:new IntersectionObserver(entries=>{near=entries.some(e=>e.isIntersecting);if(near&&wanted)go();},{rootMargin:\"100% 0px\"});if(io&&root.current)io.observe(root.current);const cleanup=()=>{events.forEach(name=>window.removeEventListener(name,go));window.removeEventListener(\"load\",arm);window.clearTimeout(timer);window.clearTimeout(fallback);io?.disconnect();};function go(){// Wait until the video is within about one screen of the viewport.\nif(!near){wanted=true;return;}cleanup();setSrc(file);}function arm(){window.removeEventListener(\"load\",arm);window.clearTimeout(fallback);timer=window.setTimeout(go,delay*1e3);}// The first interaction starts the video right away; otherwise it starts `delay` seconds after load,\n// once the page has settled, so its download never competes with loading and hydration.\nevents.forEach(name=>window.addEventListener(name,go,{passive:true}));if(document.readyState===\"complete\")arm();else{window.addEventListener(\"load\",arm);// A slow third-party request should not keep the video waiting forever.\nfallback=window.setTimeout(arm,6e3);}return cleanup;},[isStatic,video,videoPhone,delay,playOn]);const cover={position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:fit,objectPosition:\"50% 50%\",display:\"block\"};return /*#__PURE__*/_jsxs(\"div\",{ref:root,style:{...style,position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",background:\"#000\"},children:[poster?.src&&/*#__PURE__*/_jsx(\"img\",{src:poster.src,srcSet:poster.srcSet||posterSrcSet(poster.src),sizes:\"100vw\",alt:posterAlt||poster.alt||\"\",loading:\"eager\",decoding:\"auto\",fetchpriority:\"high\",style:cover}),src&&/*#__PURE__*/_jsx(\"video\",{src:src,muted:true,loop:true,autoPlay:true,playsInline:true,preload:\"auto\",\"aria-hidden\":\"true\",onPlaying:()=>setPlaying(true),style:{...cover,opacity:playing?1:0,transition:\"opacity .6s ease\"}})]});}addPropertyControls(DeferredVideo,{video:{type:ControlType.File,title:\"Video\",allowedFileTypes:[\"mp4\",\"webm\"]},videoPhone:{type:ControlType.File,title:\"Video (phone)\",allowedFileTypes:[\"mp4\",\"webm\"]},poster:{type:ControlType.ResponsiveImage,title:\"Poster\"},posterAlt:{type:ControlType.String,title:\"Poster alt text\",defaultValue:\"\",description:\"Describe the image if it carries meaning; leave empty if decorative.\"},fit:{type:ControlType.Enum,title:\"Fit\",options:[\"cover\",\"contain\"],optionTitles:[\"Cover\",\"Contain\"],defaultValue:\"cover\",displaySegmentedControl:true},playOn:{type:ControlType.Enum,title:\"Play on\",options:[\"all\",\"large\"],optionTitles:[\"All screens\",\"Large screens only\"],defaultValue:\"all\",description:\"Large screens only: phones and tablets show the cover image, no video download.\"},delay:{type:ControlType.Number,title:\"Start after load\",defaultValue:6,min:0,max:15,step:.1,unit:\"s\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DeferredVideo\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DeferredVideo.map"],"mappings":"A,kNAYA,SAASe,EAAa,EAAI,CAAC,IAAMC,EAAEC,GAAKA,EAAI,MAAM,2FAA2F,EAAE,GAAID,EAAmB,MAAM,CAAC,IAAI,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,IAAI,GAAG,wCAAwCA,EAAE,GAAG,iBAAiBE,EAAE,GAAGA,EAAE,EAAE,CAAC,CAAC,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