{"version":3,"file":"CrossfadeSlideshow.CT71TegG.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/iPksPUfpFoKkxZ6q91MM/LcX3Cvx6zTxCZshRRy16/CrossfadeSlideshow.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function CrossfadeSlideshow(props){const{interval=3e3,delay=0,imagesPerView=1,spacing=0}=props;const[currentIndex,setCurrentIndex]=useState(0);const isStatic=useIsStaticRenderer();const[isStarted,setIsStarted]=useState(false);useEffect(()=>{if(isStatic)return;// Initial delay before starting the slideshow\nconst startTimer=setTimeout(()=>{setIsStarted(true);},delay);return()=>clearTimeout(startTimer);},[delay,isStatic]);useEffect(()=>{if(isStatic||!isStarted)return;const timer=setInterval(()=>{startTransition(()=>{setCurrentIndex(current=>{const nextIndex=current+imagesPerView;return nextIndex>=props.images.length?0:nextIndex;});});},interval);return()=>clearInterval(timer);},[interval,props.images.length,isStatic,isStarted,imagesPerView]);return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",position:\"relative\",overflow:\"hidden\"},children:/*#__PURE__*/_jsx(AnimatePresence,{initial:false,children:Array.from({length:imagesPerView}).map((_,i)=>{const imageIndex=(currentIndex+i)%props.images.length;return /*#__PURE__*/_jsx(motion.img,{src:props.images[imageIndex]?.src,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.5},style:{width:`calc(${100/imagesPerView}% - ${spacing*(imagesPerView-1)/imagesPerView}px)`,height:\"100%\",position:\"absolute\",top:0,left:`calc(${i*100/imagesPerView}% + ${spacing*i}px)`,objectFit:\"cover\"}},`${imageIndex}-${i}`);})})});}addPropertyControls(CrossfadeSlideshow,{images:{type:ControlType.Array,control:{type:ControlType.ResponsiveImage},defaultValue:[{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\"},{src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\"},{src:\"https://framerusercontent.com/images/BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\"},{src:\"https://framerusercontent.com/images/2uTNEj5aTl2K3NJaEFWMbnrA.jpg\"},{src:\"https://framerusercontent.com/images/f9RiWoNpmlCMqVRIHz8l8wYfeI.jpg\"}],maxCount:10},interval:{type:ControlType.Number,title:\"Interval\",defaultValue:3e3,min:1e3,max:1e4,unit:\"ms\",step:100,displayStepper:true},delay:{type:ControlType.Number,title:\"Initial Delay\",defaultValue:0,min:0,max:1e4,unit:\"ms\",step:100,displayStepper:true},imagesPerView:{type:ControlType.Number,title:\"Images Per View\",defaultValue:1,min:1,max:4,step:1,displayStepper:true},spacing:{type:ControlType.Number,title:\"Spacing\",defaultValue:0,min:0,max:50,unit:\"px\",step:1,displayStepper:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CrossfadeSlideshow\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CrossfadeSlideshow.map"],"mappings":"+YAGG,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,WAAS,IAAI,QAAM,EAAE,gBAAc,EAAE,UAAQ,EAAE,CAAC,EAAW,CAAC,EAAa,EAAgB,CAACA,EAAS,GAAS,EAAS,IAA2B,CAAC,EAAU,EAAa,CAACA,EAAS,IAC6M,OADtM,MAAc,CAAC,GAAG,EAAS,OAC/Q,IAAM,EAAW,eAAe,CAAC,EAAa,GAAO,EAAC,GAAO,UAAU,aAAa,EAAa,EAAC,CAAC,EAAM,EAAS,EAAE,MAAc,CAAC,GAAG,GAAU,CAAC,EAAU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