{"version":3,"file":"AlphaVideo.ChcjdWvc.mjs","names":["useRef","useState","startTransition"],"sources":["https:/framerusercontent.com/modules/pxvx60qxjHXdZJZjhjOd/BwDGzrjcQeG6QNVe7YPD/AlphaVideo.js"],"sourcesContent":["// See-through video for the layered RF hero (photo in Framer behind it).\n// Source of record: rf-system-motion/framer/AlphaVideo.tsx. Same picking logic\n// as lab/alpha-video.js, which was proven in Chromium and WebKit.\n//\n// Safari and every iOS browser (all WebKit) play HEVC with alpha; Chrome,\n// Firefox and Edge play VP9 WebM with alpha. Chrome on a Mac can also decode\n// HEVC but drops the alpha channel (black box), so the file is picked by\n// engine, never by <source> order.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useEffect,useRef,useState,startTransition}from\"react\";const fill={position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:\"contain\",display:\"block\"};/**\n * @framerIntrinsicWidth 784\n * @framerIntrinsicHeight 656\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function AlphaVideo(props){const{webm,hevc,poster,label}=props;const isStatic=useIsStaticRenderer();const ref=useRef(null);const videoRef=useRef(null);const[src,setSrc]=useState(null);const[playing,setPlaying]=useState(false);// Pick the file after mount (needs the browser), skip under reduced motion.\nuseEffect(()=>{if(isStatic||typeof window===\"undefined\")return;if(window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches)return;const webkit=/Apple/.test(navigator.vendor||\"\");const canHevc=!!hevc&&document.createElement(\"video\").canPlayType('video/mp4; codecs=\"hvc1\"')!==\"\";const chosen=webkit&&canHevc?hevc:webm;if(chosen)startTransition(()=>setSrc(chosen));},[isStatic,webm,hevc]);// Only play while on screen.\nuseEffect(()=>{const host=ref.current;const video=videoRef.current;if(!host||!video||!src)return;const observer=new IntersectionObserver(([entry])=>{if(entry.isIntersecting)video.play().catch(()=>{});else video.pause();});observer.observe(host);return()=>observer.disconnect();},[src]);return /*#__PURE__*/_jsxs(\"div\",{ref:ref,role:\"img\",\"aria-label\":label,style:{...props.style,position:\"relative\",overflow:\"visible\"},children:[poster?.src&&!playing?/*#__PURE__*/_jsx(\"img\",{src:poster.src,srcSet:poster.srcSet,alt:\"\",style:fill}):null,src?/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:src,muted:true,loop:true,playsInline:true,autoPlay:true,preload:\"auto\",\"aria-hidden\":\"true\",onPlaying:()=>startTransition(()=>setPlaying(true)),onError:()=>startTransition(()=>setSrc(null)),style:{...fill,opacity:playing?1:0}}):null]});}addPropertyControls(AlphaVideo,{webm:{type:ControlType.File,title:\"WebM (alpha)\",allowedFileTypes:[\"webm\"]},hevc:{type:ControlType.File,title:\"HEVC (alpha)\",allowedFileTypes:[\"mp4\",\"mov\"]},poster:{type:ControlType.ResponsiveImage,title:\"Poster\"},label:{type:ControlType.String,title:\"Label\",defaultValue:\"Animated chat with Mr. Oyster\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AlphaVideo\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"784\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"656\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AlphaVideo.map"],"mappings":"mOAcG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,OAAK,OAAK,SAAO,SAAO,EAAY,EAAS,EAAoB,EAAQ,EAAIA,EAAO,IAAI,EAAQ,EAASA,EAAO,IAAI,EAAO,CAAC,EAAI,GAAQC,EAAS,IAAI,EAAO,CAAC,EAAQ,GAAYA,EAAS,EAAK,EAE4C,OAD9R,MAAc,CAAiD,GAA7C,GAAiB,IAAS,QAAsB,EAAO,WAAW,kCAAkC,CAAC,CAAC,QAAQ,OAAO,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