{"version":3,"file":"TransparentVideo.2nTUdZCY.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/3ndM3f37w0DhNJrofOsZ/fJquE4wCOWUnsfVml3YW/TransparentVideo.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/*\n * TransparentVideo — a looping animation with a see-through background that\n * stays see-through on every device.\n *\n * Apple's browser engine (Safari, and every browser on iPhone/iPad) plays\n * WebM but throws away its transparency, so the background shows as solid.\n * Apple only keeps transparency in HEVC-with-alpha .mov files (or animated\n * WebP/PNG images). This component serves the WebM everywhere else and the\n * Apple file on Apple devices.\n */// navigator.vendor is \"Apple Computer, Inc.\" in Safari and in every iOS/iPadOS\n// browser (they all run Apple's engine), and \"Google Inc.\" in Chrome/Edge.\nconst isAppleEngine=()=>typeof navigator!==\"undefined\"&&/Apple/i.test(navigator.vendor||\"\");const isImageFile=url=>/\\.(webp|png|apng|gif)(\\?|#|$)/i.test(url||\"\");export default function TransparentVideo({webm=\"\",appleFile=\"\",fit=\"contain\"}){// Decided after mount: the server can't know the device, and rendering the\n// WebM first would flash a solid background on Apple devices.\nconst[apple,setApple]=useState(null);useEffect(()=>setApple(isAppleEngine()),[]);const box={width:\"100%\",height:\"100%\",display:\"block\",background:\"transparent\"};if(!webm&&!appleFile){return /*#__PURE__*/_jsx(\"div\",{style:{...box,background:\"rgba(136,136,136,0.15)\",color:\"#888\",fontSize:13,fontFamily:\"sans-serif\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:\"Add a WebM and an Apple file\"});}if(apple===null)return /*#__PURE__*/_jsx(\"div\",{style:box});// Fall back to whichever file exists if only one was added\nconst src=apple?appleFile||webm:webm||appleFile;if(isImageFile(src)){return /*#__PURE__*/_jsx(\"img\",{src:src,alt:\"\",draggable:false,style:{...box,objectFit:fit}});}return /*#__PURE__*/_jsx(\"video\",{src:src,autoPlay:true,loop:true,muted:true,playsInline:true,preload:\"auto\",style:{...box,objectFit:fit}},src);}addPropertyControls(TransparentVideo,{webm:{type:ControlType.File,title:\"WebM\",allowedFileTypes:[\"webm\"],description:\"Transparent WebM — used on Chrome, Edge, Firefox, Android\"},appleFile:{type:ControlType.File,title:\"Apple File\",allowedFileTypes:[\"mov\",\"mp4\",\"webp\",\"png\",\"gif\"],description:\"HEVC-with-alpha .mov (best) or animated WebP/PNG — used on iPhone, iPad, Safari\"},fit:{type:ControlType.Enum,title:\"Fit\",options:[\"contain\",\"cover\"],optionTitles:[\"Fit\",\"Fill\"],defaultValue:\"contain\",displaySegmentedControl:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TransparentVideo\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TransparentVideo.map"],"mappings":"+LAWkK,SAAwB,EAAiB,CAAC,OAAK,GAAG,YAAU,GAAG,MAAI,WAAW,CAEhP,GAAK,CAAC,EAAM,GAAUA,EAAS,IAAI,EAAE,MAAc,EAAS,EAAc,CAAC,EAAE,CAAC,CAAC,EAAE,IAAM,EAAI,CAAC,MAAM,OAAO,OAAO,OAAO,QAAQ,QAAQ,WAAW,aAAa,EAAE,GAAG,CAAC,GAAM,CAAC,EAAW,OAAoB,EAAK,MAAM,CAAC,MAAM,CAAC,GAAG,EAAI,WAAW,yBAAyB,MAAM,OAAO,SAAS,GAAG,WAAW,aAAa,QAAQ,OAAO,WAAW,SAAS,eAAe,QAAQ,EAAE,SAAS,8BAA8B,CAAC,EAAG,GAAG,IAAQ,KAAK,OAAoB,EAAK,MAAM,CAAC,MAAM,CAAG,CAAC,EAC3d,IAAM,EAAI,EAAM,GAAW,EAAK,GAAM,EAA8H,OAAjH,EAAY,CAAG,EAAuB,EAAK,MAAM,CAAK,MAAI,IAAI,GAAG,UAAU,GAAM,MAAM,CAAC,GAAG,EAAI,UAAU,CAAG,CAAC,CAA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