{"version":3,"file":"CMSVideo.DVsepgod.mjs","names":["useState","useRef","useCallback"],"sources":["https:/framerusercontent.com/modules/ayRjMMvWm8JBSJwFGKFt/XQ6jk2aL3UajVlMdRzdO/CMSVideo.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useCallback,useRef,useState}from\"react\";const FALLBACK_RATIO=\"16 / 9\";/**\n * A self-sizing video for CMS rich text. Reads the file's real width and\n * height once it loads and matches its own box to that ratio, so it never\n * needs a size guess up front and never crops the source.\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function CMSVideo(props){const{file,url=\"\",autoPlay=true,loop=true,muted=true,controls=false,radius=10}=props;const[ratio,setRatio]=useState(FALLBACK_RATIO);const videoRef=useRef(null);const handleLoadedMetadata=useCallback(()=>{const v=videoRef.current;if(v&&v.videoWidth&&v.videoHeight){setRatio(`${v.videoWidth} / ${v.videoHeight}`);}},[]);const src=file||url;return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",aspectRatio:ratio,borderRadius:radius,overflow:\"hidden\",backgroundColor:\"rgb(230, 228, 223)\"},children:src&&/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:src,autoPlay:autoPlay,loop:loop,muted:muted,controls:controls,playsInline:true,onLoadedMetadata:handleLoadedMetadata,style:{display:\"block\",width:\"100%\",height:\"100%\",objectFit:\"cover\"}})});}addPropertyControls(CMSVideo,{file:{type:ControlType.File,title:\"Upload\",allowedFileTypes:[\"mp4\",\"webm\",\"mov\"]},url:{type:ControlType.String,title:\"or URL\",placeholder:\"https://…mp4\"},autoPlay:{type:ControlType.Boolean,title:\"Autoplay\",defaultValue:true},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:true},muted:{type:ControlType.Boolean,title:\"Muted\",defaultValue:true},controls:{type:ControlType.Boolean,title:\"Show Controls\",defaultValue:false},radius:{type:ControlType.Number,title:\"Radius\",min:0,max:40,defaultValue:10,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CMSVideo\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CMSVideo.map"],"mappings":"mLAOG,SAAwB,EAAS,EAAM,CAAC,GAAK,CAAC,OAAK,MAAI,GAAG,WAAS,GAAK,OAAK,GAAK,QAAM,GAAK,WAAS,GAAM,SAAO,IAAI,EAAW,CAAC,EAAM,GAAUA,EAAS,CAAc,EAAQ,EAASC,EAAO,IAAI,EAAQ,EAAqBC,MAAgB,CAAC,IAAM,EAAE,EAAS,QAAW,GAAG,EAAE,YAAY,EAAE,aAAa,EAAS,GAAG,EAAE,WAAW,KAAK,EAAE,aAAa,CAAG,EAAE,CAAC,CAAC,EAAQ,EAAI,GAAM,EAAI,OAAoB,EAAK,MAAM,CAAC,MAAM,CAAC,MAAM,OAAO,YAAY,EAAM,aAAa,EAAO,SAAS,SAAS,gBAAgB,oBAAoB,EAAE,SAAS,GAAkB,EAAK,QAAQ,CAAC,IAAI,EAAa,MAAa,WAAc,OAAW,QAAe,WAAS,YAAY,GAAK,iBAAiB,EAAqB,MAAM,CAAC,QAAQ,QAAQ,MAAM,OAAO,OAAO,OAAO,UAAU,OAAO,CAAC,CAAC,CAAC,CAAC,CAAE,mBAP7tB,IAAoD,IAA+C,EAAO,EAAe,SAOqmB,EAAoB,EAAS,CAAC,KAAK,CAAC,KAAK,EAAY,KAAK,MAAM,SAAS,iBAAiB,CAAC,MAAM,OAAO,KAAK,CAAC,EAAE,IAAI,CAAC,KAAK,EAAY,OAAO,MAAM,SAAS,YAAY,cAAc,EAAE,SAAS,CAAC,KAAK,EAAY,QAAQ,MAAM,WAAW,aAAa,EAAI,EAAE,KAAK,CAAC,KAAK,EAAY,QAAQ,MAAM,OAAO,aAAa,EAAI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