{"version":3,"file":"CroppableVideo.DfR5869b.mjs","names":["useRef","useMemo","useCallback","__esmMin","pe","init_npm_react_18_3_1","ne","init_ssg_sandbox_shims","window","de","init_framer_CaDWdxiz","ControlType","addPropertyControls","CroppableVideo","props","videoRef","normalizedStartTime","startTime","hasValidStop","stopTime","seekToStart","video","handleLoadedMetadata","handleTimeUpdate","loop","maybePromise","videoSource","posterImage","autoplay","init_CroppableVideo","init_jsx_runtime"],"sources":["https:/framerusercontent.com/modules/Yuv2VF1bwJcNv337bpFX/nKvurFlWzMsh3Lk8A8tv/CroppableVideo.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useCallback,useMemo,useRef}from\"react\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function CroppableVideo(props){const{videoSource=\"https://framerusercontent.com/assets/MLWPbW1dUQawJLhhun3dBwpgJak.mp4\",posterImage={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Video poster\"},startTime,stopTime,autoplay,muted,controls,loop,objectFit,borderRadius}=props;const videoRef=useRef(null);const normalizedStartTime=useMemo(()=>Math.max(0,startTime||0),[startTime]);const hasValidStop=useMemo(()=>Number.isFinite(stopTime)&&stopTime>normalizedStartTime,[normalizedStartTime,stopTime]);const seekToStart=useCallback(()=>{const video=videoRef.current;if(!video)return;video.currentTime=normalizedStartTime;},[normalizedStartTime]);const handleLoadedMetadata=useCallback(()=>{if(typeof window===\"undefined\")return;seekToStart();},[seekToStart]);const handleTimeUpdate=useCallback(()=>{if(typeof window===\"undefined\")return;const video=videoRef.current;if(!video||!hasValidStop)return;if(video.currentTime>=stopTime){if(loop){video.currentTime=normalizedStartTime;const maybePromise=video.play();if(maybePromise&&typeof maybePromise.catch===\"function\"){maybePromise.catch(()=>{});}}else{video.currentTime=stopTime;video.pause();}}},[hasValidStop,loop,normalizedStartTime,stopTime]);return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",borderRadius,background:\"#000000\"},children:videoSource?/*#__PURE__*/_jsx(\"video\",{ref:videoRef,src:videoSource,poster:posterImage?.src,autoPlay:autoplay,muted:muted,controls:controls,loop:loop&&!hasValidStop,playsInline:true,onLoadedMetadata:handleLoadedMetadata,onTimeUpdate:handleTimeUpdate,style:{width:\"100%\",height:\"100%\",objectFit,borderRadius,display:\"block\"}}):/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",color:\"#CCCCCC\",fontSize:14,lineHeight:1.3,textAlign:\"center\",padding:12},children:\"No video selected\"})});}addPropertyControls(CroppableVideo,{videoSource:{type:ControlType.File,title:\"Video\",allowedFileTypes:[\"mp4\",\"webm\",\"mov\"]},posterImage:{type:ControlType.ResponsiveImage,title:\"Poster\"},startTime:{type:ControlType.Number,title:\"Start\",defaultValue:0,min:0,step:.1},stopTime:{type:ControlType.Number,title:\"Stop\",defaultValue:0,min:0,step:.1},autoplay:{type:ControlType.Boolean,title:\"Autoplay\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},muted:{type:ControlType.Boolean,title:\"Muted\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},controls:{type:ControlType.Boolean,title:\"Controls\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},objectFit:{type:ControlType.Enum,title:\"Fit\",options:[\"cover\",\"contain\",\"fill\",\"none\",\"scale-down\"],optionTitles:[\"Cover\",\"Contain\",\"Fill\",\"None\",\"Scale Down\"],defaultValue:\"cover\"},borderRadius:{type:ControlType.BorderRadius,title:\"Radius\",defaultValue:\"0px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CroppableVideo\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CroppableVideo.map"],"mappings":"A,4LAGG,SAAwBa,EAAe,EAAM,CAAC,GAAK,CAAC,cAAY,uEAAuE,cAAY,CAAC,IAAI,sEAAsE,IAAI,cAAc,EAAE,YAAU,WAAS,WAAS,QAAM,WAAS,OAAK,YAAU,gBAAcC,EAAYC,EAASf,EAAO,IAAI,EAAQgB,EAAoBf,MAAY,KAAK,IAAI,EAAEgB,GAAW,CAAC,EAAE,CAACA,CAAS,CAAC,EAAQC,EAAajB,MAAY,OAAO,SAASkB,CAAQ,GAAGA,EAASH,EAAoB,CAACA,EAAoBG,CAAQ,CAAC,EAAQC,EAAYlB,MAAgB,CAAC,IAAMmB,EAAMN,EAAS,QAAYM,IAAa,EAAM,YAAYL,EAAoB,EAAE,CAACA,CAAmB,CAAC,EAAQM,EAAqBpB,MAAgB,CAAWM,IAAS,QAAmBY,EAAY,CAAE,EAAE,CAACA,CAAW,CAAC,EAAQG,EAAiBrB,MAAgB,CAAC,GAAUM,IAAS,OAAY,OAAO,IAAMa,EAAMN,EAAS,QAAQ,GAAIM,GAAQH,GAAuBG,EAAM,aAAaF,EAAS,CAAC,GAAGK,EAAK,CAAC,EAAM,YAAYR,EAAoB,IAAMS,EAAaJ,EAAM,KAAK,EAAKI,GAAc,OAAOA,EAAa,OAAQ,YAAYA,EAAa,UAAU,CAAC,CAAC,CAAG,KAAM,GAAM,YAAYN,EAASE,EAAM,MAAM,CAAG,CAAC,EAAE,CAACH,EAAaM,EAAKR,EAAoBG,CAAQ,CAAC,EAAE,MAAoB,gBAAK,MAAM,CAAC,MAAM,CAAC,SAAS,WAAW,MAAM,OAAO,OAAO,OAAO,SAAS,SAAS,eAAa,WAAW,SAAS,EAAE,SAASO,EAAyB,gB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