{"version":3,"file":"GeneralOneImageSlider.CXJsjVl2.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/Wdcvu4etx44oFexUJfwU/1DFcEVzSdkHhrNhkANuI/GeneralOneImageSlider.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";const FOCUS_MAP={top:\"center top\",center:\"center center\",bottom:\"center bottom\",left:\"left center\",right:\"right center\",\"top-left\":\"left top\",\"top-right\":\"right top\",\"bottom-left\":\"left bottom\",\"bottom-right\":\"right bottom\"};export default function ImageSlider({images=[],autoplay=true,interval=5,transitionDuration=1.2,showArrows=true,arrowSize=48,arrowColor=\"#FFFFFF\",arrowBackground=\"rgba(0,0,0,0.4)\",arrowOffset=16,pauseOnHover=true,borderRadius=0}){const[current,setCurrent]=useState(0);const[incoming,setIncoming]=useState(null);const[direction,setDirection]=useState(1);const[isPaused,setIsPaused]=useState(false);useEffect(()=>{if(!autoplay)return;if(!images.length||incoming!==null||isPaused)return;const timer=setTimeout(()=>{setDirection(1);setIncoming((current+1)%images.length);},interval*1e3);return()=>clearTimeout(timer);},[current,incoming,images.length,interval,isPaused,autoplay]);const goNext=()=>{if(incoming!==null||images.length<2)return;setDirection(1);setIncoming((current+1)%images.length);};const goPrev=()=>{if(incoming!==null||images.length<2)return;setDirection(-1);setIncoming((current-1+images.length)%images.length);};const onComplete=()=>{if(incoming!==null){setCurrent(incoming);setIncoming(null);}};if(!images.length)return null;const fromX=direction===1?\"100%\":\"-100%\";const getImg=img=>{if(typeof img===\"string\")return{src:img,focusPoint:\"center\"};return{src:img?.src||\"\",focusPoint:img?.focusPoint||\"center\"};};const currentImg=getImg(images[current]);const incomingImg=incoming!==null?getImg(images[incoming]):null;return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",borderRadius},onMouseEnter:()=>pauseOnHover&&setIsPaused(true),onMouseLeave:()=>pauseOnHover&&setIsPaused(false),children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",inset:0,backgroundImage:`url(${currentImg.src})`,backgroundSize:\"cover\",backgroundPosition:FOCUS_MAP[currentImg.focusPoint]||\"center\"}}),incomingImg&&/*#__PURE__*/_jsx(motion.div,{initial:{x:fromX},animate:{x:\"0%\"},transition:{duration:transitionDuration,ease:[.65,0,.35,1]},onAnimationComplete:onComplete,style:{position:\"absolute\",inset:0,backgroundImage:`url(${incomingImg.src})`,backgroundSize:\"cover\",backgroundPosition:FOCUS_MAP[incomingImg.focusPoint]||\"center\",zIndex:2}}),showArrows&&images.length>1&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"button\",{onClick:goPrev,\"aria-label\":\"Previous\",style:{...arrowStyle(arrowSize,arrowColor,arrowBackground),left:arrowOffset},children:\"‹\"}),/*#__PURE__*/_jsx(\"button\",{onClick:goNext,\"aria-label\":\"Next\",style:{...arrowStyle(arrowSize,arrowColor,arrowBackground),right:arrowOffset},children:\"›\"})]})]});}function arrowStyle(size,color,bg){return{position:\"absolute\",top:\"50%\",transform:\"translateY(-50%)\",width:size,height:size,borderRadius:\"50%\",border:\"none\",background:bg,color:color,cursor:\"pointer\",zIndex:3,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",fontSize:size*.55,lineHeight:1,padding:0,userSelect:\"none\"};}addPropertyControls(ImageSlider,{images:{type:ControlType.Array,title:\"Images\",control:{type:ControlType.Object,controls:{src:{type:ControlType.Image,title:\"Image\"},focusPoint:{type:ControlType.Enum,title:\"Focus\",options:[\"top\",\"center\",\"bottom\",\"left\",\"right\",\"top-left\",\"top-right\",\"bottom-left\",\"bottom-right\"],optionTitles:[\"Top\",\"Center\",\"Bottom\",\"Left\",\"Right\",\"Top Left\",\"Top Right\",\"Bottom Left\",\"Bottom Right\"],defaultValue:\"center\"}}}},autoplay:{type:ControlType.Boolean,title:\"Autoplay\",defaultValue:true},interval:{type:ControlType.Number,title:\"Interval\",defaultValue:5,min:1,max:20,unit:\"s\"},transitionDuration:{type:ControlType.Number,title:\"Transition\",defaultValue:1.2,min:.3,max:3,step:.1,unit:\"s\"},pauseOnHover:{type:ControlType.Boolean,title:\"Pause on Hover\",defaultValue:true},showArrows:{type:ControlType.Boolean,title:\"Show Arrows\",defaultValue:true},arrowSize:{type:ControlType.Number,title:\"Arrow Size\",defaultValue:48,min:24,max:120},arrowOffset:{type:ControlType.Number,title:\"Arrow Offset\",defaultValue:16,min:0,max:80},arrowColor:{type:ControlType.Color,title:\"Arrow Color\",defaultValue:\"#FFFFFF\"},arrowBackground:{type:ControlType.Color,title:\"Arrow BG\",defaultValue:\"rgba(0,0,0,0.4)\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:0,min:0,max:100}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ImageSlider\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GeneralOneImageSlider.map"],"mappings":"gPAA4a,SAAwB,EAAY,CAAC,SAAO,EAAE,CAAC,WAAS,GAAK,WAAS,EAAE,qBAAmB,IAAI,aAAW,GAAK,YAAU,GAAG,aAAW,UAAU,kBAAgB,kBAAkB,cAAY,GAAG,eAAa,GAAK,eAAa,GAAG,CAAC,GAAK,CAAC,EAAQ,GAAYA,EAAS,EAAE,CAAM,CAAC,EAAS,GAAaA,EAAS,KAAK,CAAM,CAAC,EAAU,GAAcA,EAAS,EAAE,CAAM,CAAC,EAAS,GAAaA,EAAS,GAAM,CAAC,MAAc,CAAqB,GAAjB,CAAC,GAAmB,CAAC,EAAO,QAAQ,IAAW,MAAM,EAAS,OAAO,IAAM,EAAM,eAAe,CAAC,EAAa,EAAE,CAAC,GAAa,EAAQ,GAAG,EAAO,OAAO,EAAG,EAAS,IAAI,C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