{"version":3,"file":"TransparentVideo.KSThhLcA.mjs","names":["useState","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","navigator","_e","c","init_jsx_runtime","ce","init_framer_BWFVvmND","ControlType","addPropertyControls","TransparentVideo","apple","setApple","isAppleEngine","box","webm","appleFile","src","isImageFile","fit","init_TransparentVideo","url"],"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":"A,+LAWkK,SAAwBY,EAAiB,CAAC,OAAK,GAAG,YAAU,GAAG,MAAI,WAAW,CAEhP,GAAK,CAACC,EAAMC,GAAUd,EAAS,IAAI,EAAEQ,MAAcM,EAASC,EAAc,CAAC,EAAE,CAAC,CAAC,EAAE,IAAMC,EAAI,CAAC,MAAM,OAAO,OAAO,OAAO,QAAQ,QAAQ,WAAW,aAAa,EAAE,GAAG,CAACC,GAAM,CAACC,EAAW,MAAoB,gBAAK,MAAM,CAAC,MAAM,CAAC,GAAGF,EAAI,WAAW,yBAAyB,MAAM,OAAO,SAAS,GAAG,WAAW,aAAa,QAAQ,OAAO,WAAW,SAAS,eAAe,QAAQ,EAAE,SAAS,8BAA8B,CAAC,EAAG,GAAGH,IAAQ,KAAK,MAAoB,gBAAK,MAAM,CAAC,MAAMG,CAA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