{"version":3,"file":"AutoImageSlideshow.DHAd0KWa.mjs","names":["useState","useMemo","useCallback","_Fragment"],"sources":["https:/framerusercontent.com/modules/kDidxERT6RQofTbwpK1C/XamWka1V82LOof6mRysX/AutoImageSlideshow.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useMemo,useState,useCallback,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{AnimatePresence,motion}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function AutoImageSlideshow(props){const{images=[{src:\"https://framerusercontent.com/images/I2AYOzrsfhatwsEkTRKIwdd2yPY.png\",alt:\"Slideshow Image 1\"}],autoplay,intervalSeconds,fadeDuration,enableFade,fit,position,radius,backgroundColor,backgroundOpacity,showControls,buttonColor,buttonIconColor,buttonSize,buttonInset,style}=props;const isStatic=useIsStaticRenderer();const[prefersReducedMotion,setPrefersReducedMotion]=useState(false);const[currentIndex,setCurrentIndex]=useState(0);const validImages=useMemo(()=>images.filter(image=>Boolean(image?.src)),[images]);const imageCount=validImages.length;const disableMotion=isStatic||prefersReducedMotion;const canCycle=autoplay&&imageCount>1&&!disableMotion;const safeIntervalSeconds=Math.max(.2,Math.min(10,intervalSeconds));const safeFadeDuration=Math.max(0,fadeDuration);const safeRadius=Math.max(0,radius);const safeBackgroundOpacity=Math.max(0,Math.min(1,backgroundOpacity));const safeButtonSize=Math.max(24,Math.min(72,buttonSize));const safeButtonInset=Math.max(0,Math.min(48,buttonInset));useEffect(()=>{if(typeof window!==\"undefined\"&&typeof window.matchMedia!==\"undefined\"){const media=window.matchMedia(\"(prefers-reduced-motion: reduce)\");const update=()=>{startTransition(()=>setPrefersReducedMotion(media.matches));};update();if(typeof media.addEventListener===\"function\"){media.addEventListener(\"change\",update);return()=>media.removeEventListener(\"change\",update);}media.addListener(update);return()=>media.removeListener(update);}startTransition(()=>setPrefersReducedMotion(false));},[]);useEffect(()=>{if(imageCount<1){startTransition(()=>setCurrentIndex(0));return;}if(currentIndex>imageCount-1){startTransition(()=>setCurrentIndex(0));}},[imageCount,currentIndex]);useEffect(()=>{if(!canCycle)return;const timer=window.setInterval(()=>{startTransition(()=>{setCurrentIndex(prev=>(prev+1)%imageCount);});},safeIntervalSeconds*1e3);return()=>{window.clearInterval(timer);};},[canCycle,imageCount,safeIntervalSeconds]);useEffect(()=>{if(typeof window===\"undefined\")return;validImages.forEach(image=>{if(!image?.src)return;const preloadImage=new Image;preloadImage.src=image.src;if(image.srcSet){preloadImage.srcset=image.srcSet;}});},[validImages]);const goToPrevious=useCallback(()=>{startTransition(()=>{if(imageCount<1){setCurrentIndex(0);return;}setCurrentIndex(prev=>(prev-1+imageCount)%imageCount);});},[imageCount]);const goToNext=useCallback(()=>{startTransition(()=>{if(imageCount<1){setCurrentIndex(0);return;}setCurrentIndex(prev=>(prev+1)%imageCount);});},[imageCount]);const activeImage=validImages[currentIndex]??validImages[0];const shouldFade=enableFade&&!disableMotion;return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",borderRadius:safeRadius,...style},children:[/*#__PURE__*/_jsx(\"div\",{\"aria-hidden\":\"true\",style:{position:\"absolute\",inset:0,background:backgroundColor,opacity:safeBackgroundOpacity,pointerEvents:\"none\"}}),activeImage?shouldFade?/*#__PURE__*/_jsx(AnimatePresence,{initial:false,mode:\"wait\",children:/*#__PURE__*/_jsx(motion.img,{src:activeImage.src,srcSet:activeImage.srcSet,alt:activeImage.alt||\"Slideshow image\",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:safeFadeDuration,ease:\"easeInOut\"},style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:fit,objectPosition:position,pointerEvents:\"none\"}},`slide-${currentIndex}-${activeImage.src}`)}):/*#__PURE__*/_jsx(_Fragment,{children:validImages.map((image,index)=>{const isActive=index===currentIndex;return /*#__PURE__*/_jsx(\"img\",{src:image.src,srcSet:image.srcSet,alt:image.alt||\"Slideshow image\",style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",objectFit:fit,objectPosition:position,pointerEvents:\"none\",opacity:isActive?1:0,visibility:isActive?\"visible\":\"hidden\",display:\"block\"}},`stack-${index}-${image.src}`);})}):null,showControls?/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":\"Previous image\",onClick:goToPrevious,style:{position:\"absolute\",left:safeButtonInset,top:\"50%\",transform:\"translateY(-50%)\",width:safeButtonSize,height:safeButtonSize,border:\"none\",borderRadius:\"999px\",background:buttonColor,color:buttonIconColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",padding:0,cursor:\"pointer\",zIndex:2},children:/*#__PURE__*/_jsx(\"svg\",{width:Math.max(12,safeButtonSize*.45),height:Math.max(12,safeButtonSize*.45),viewBox:\"0 0 24 24\",\"aria-hidden\":\"true\",style:{display:\"block\"},children:/*#__PURE__*/_jsx(\"path\",{d:\"M15 4L7 12L15 20\",fill:\"none\",stroke:buttonIconColor,strokeWidth:\"2.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})})}),/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":\"Next image\",onClick:goToNext,style:{position:\"absolute\",right:safeButtonInset,top:\"50%\",transform:\"translateY(-50%)\",width:safeButtonSize,height:safeButtonSize,border:\"none\",borderRadius:\"999px\",background:buttonColor,color:buttonIconColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",padding:0,cursor:\"pointer\",zIndex:2},children:/*#__PURE__*/_jsx(\"svg\",{width:Math.max(12,safeButtonSize*.45),height:Math.max(12,safeButtonSize*.45),viewBox:\"0 0 24 24\",\"aria-hidden\":\"true\",style:{display:\"block\"},children:/*#__PURE__*/_jsx(\"path\",{d:\"M9 4L17 12L9 20\",fill:\"none\",stroke:buttonIconColor,strokeWidth:\"2.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})})})]}):null]});}AutoImageSlideshow.displayName=\"AutoImageSlideshow\";addPropertyControls(AutoImageSlideshow,{images:{type:ControlType.Array,title:\"Images\",control:{type:ControlType.ResponsiveImage},maxCount:20,defaultValue:[{src:\"https://framerusercontent.com/images/I2AYOzrsfhatwsEkTRKIwdd2yPY.png\",alt:\"Slideshow Image 1\"}]},autoplay:{type:ControlType.Boolean,title:\"Autoplay\",defaultValue:true},intervalSeconds:{type:ControlType.Number,title:\"Interval\",defaultValue:1,min:.2,max:10,step:.1,unit:\"s\"},fadeDuration:{type:ControlType.Number,title:\"Fade\",defaultValue:.25,min:0,max:3,step:.01,unit:\"s\"},enableFade:{type:ControlType.Boolean,title:\"Enable Fade\",defaultValue:true},fit:{type:ControlType.Enum,title:\"Fit\",defaultValue:\"cover\",options:[\"cover\",\"contain\",\"fill\"],optionTitles:[\"Cover\",\"Contain\",\"Fill\"],displaySegmentedControl:true},position:{type:ControlType.Enum,title:\"Position\",defaultValue:\"center\",options:[\"center\",\"top\",\"bottom\",\"left\",\"right\"],optionTitles:[\"Center\",\"Top\",\"Bottom\",\"Left\",\"Right\"]},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:0,min:0,max:200,step:1},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#111111\"},backgroundOpacity:{type:ControlType.Number,title:\"Bg Opacity\",defaultValue:1,min:0,max:1,step:.01},showControls:{type:ControlType.Boolean,title:\"Controls\",defaultValue:false},buttonColor:{type:ControlType.Color,title:\"Button\",defaultValue:\"rgba(0,0,0,0.45)\"},buttonIconColor:{type:ControlType.Color,title:\"Icon\",defaultValue:\"#ffffff\"},buttonSize:{type:ControlType.Number,title:\"Button Size\",defaultValue:36,min:24,max:72,step:1},buttonInset:{type:ControlType.Number,title:\"Button Inset\",defaultValue:12,min:0,max:48,step:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AutoImageSlideshow\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AutoImageSlideshow.map"],"mappings":"8RAGG,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,SAAO,CAAC,CAAC,IAAI,uEAAuE,IAAI,mBAAmB,CAAC,EAAE,WAAS,kBAAgB,eAAa,aAAW,MAAI,WAAS,SAAO,kBAAgB,oBAAkB,eAAa,cAAY,kBAAgB,aAAW,cAAY,SAAO,EAAY,EAAS,EAAoB,EAAO,CAAC,EAAqB,GAAyBA,EAAS,EAAK,EAAO,CAAC,EAAa,GAAiBA,EAAS,CAAC,EAAQ,EAAYC,MAAY,EAAO,OAAO,GAAO,EAAQ,GAAO,GAAI,EAAE,CAAC,CAAM,CAAC,EAAQ,EAAW,EAAY,OAAa,EAAc,GAAU,EAA2B,EAAS,GAAU,EAAW,GAAG,CAAC,EAAoB,EAAoB,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,CAAe,CAAC,EAAQ,EAAiB,KAAK,IAAI,EAAE,CAAY,EAAQ,EAAW,KAAK,IAAI,EAAE,CAAM,EAAQ,EAAsB,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,CAAiB,CAAC,EAAQ,EAAe,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,CAAU,CAAC,EAAQ,EAAgB,KAAK,IAAI,EAAE,KAAK,IAAI,GAAG,CAAW,CAAC,EAAE,MAAc,CAAC,GAAU,IAAS,QAAoB,EAAO,aAAa,OAAY,CAAC,IAAM,EAAM,EAAO,WAAW,kCAAkC,EAAQ,MAAW,CAAC,MAAoB,EAAwB,EAAM,OAAO,CAAC,CAAE,EAAkL,OAAhL,EAAO,EAAK,OAAO,EAAM,kBAAmB,YAAY,EAAM,iBAAiB,SAAS,CAAM,MAAY,EAAM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