{"version":3,"file":"autoCarouselWithPagination.DRMMEv6a.mjs","names":["useRef","useMemo","useCallback","__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/tCYrUm1v2Hisj5wc36B3/nxUwKPR650nab69Ol2ym/autoCarouselWithPagination.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useCallback,useEffect,useMemo,useRef}from\"react\";import{animate}from\"framer-motion\";export function autoCarouselWithPagination(){const ref=useRef(null);useEffect(()=>{const root=ref.current;if(!root)return;const slider=root.querySelector(\"[data-framer-name='Slider']\");const carousel=slider?.querySelector(\"[data-framer-name='Carousel']\");const pagination=root.querySelector(\"[data-framer-name='Pagination']\");if(!carousel||!pagination)return;const slides=Array.from(carousel.children);const dots=Array.from(pagination.children);const slideWidth=398;const interval=3500;const pauseAfterSwipe=5e3// ms\n;let index=0;let isSwiping=false;let startX=0;let deltaX=0;let lastInteractionTime=Date.now();const updateSlide=async newIndex=>{index=Math.max(0,Math.min(newIndex,slides.length-1));await animate(carousel,{x:-index*slideWidth},{duration:.6,ease:\"easeInOut\"});// Update dots\ndots.forEach((dot,i)=>{const el=dot;el.style.opacity=i===index?\"1\":\"0.3\";//el.style.scale = i === index ? \"1.2\" : \"1\"\n});};const loop=async()=>{while(true){const now=Date.now();const timeSinceLastInteraction=now-lastInteractionTime;if(!isSwiping&&timeSinceLastInteraction>pauseAfterSwipe){await updateSlide((index+1)%slides.length);}await new Promise(res=>setTimeout(res,interval));}};loop();// Swipe detection\nconst onPointerDown=e=>{isSwiping=true;startX=e.clientX;};const onPointerMove=e=>{if(!isSwiping)return;deltaX=e.clientX-startX;};const onPointerUp=()=>{if(!isSwiping)return;const threshold=50;if(deltaX<-threshold){updateSlide(index+1);}else if(deltaX>threshold){updateSlide(index-1);}isSwiping=false;deltaX=0;lastInteractionTime=Date.now();};carousel.addEventListener(\"pointerdown\",onPointerDown);carousel.addEventListener(\"pointermove\",onPointerMove);carousel.addEventListener(\"pointerup\",onPointerUp);carousel.addEventListener(\"pointerleave\",onPointerUp);return()=>{carousel.removeEventListener(\"pointerdown\",onPointerDown);carousel.removeEventListener(\"pointermove\",onPointerMove);carousel.removeEventListener(\"pointerup\",onPointerUp);carousel.removeEventListener(\"pointerleave\",onPointerUp);};},[]);return{ref};}export function ContinuousHorizontalCarousel(props){const{speed=40,pauseOnHover=true}=props;const ref=useRef(null);const isStatic=useIsStaticRenderer();const resolvedSpeed=useMemo(()=>Math.max(1,speed),[speed]);const markCloneSubtree=useCallback(node=>{node.setAttribute(\"aria-hidden\",\"true\");node.setAttribute(\"data-marquee-clone\",\"true\");node.style.pointerEvents=\"none\";if(\"inert\"in node){node.inert=true;}const focusable=node.querySelectorAll(\"a, button, input, select, textarea, [tabindex], [contenteditable='true']\");focusable.forEach(el=>{el.setAttribute(\"tabindex\",\"-1\");el.setAttribute(\"aria-hidden\",\"true\");if(\"inert\"in el){el.inert=true;}});},[]);useEffect(()=>{const root=ref.current;if(!root)return;if(typeof window===\"undefined\")return;const track=root.firstElementChild;if(!track)return;const mediaQuery=window.matchMedia(\"(prefers-reduced-motion: reduce)\");const reducedMotion=mediaQuery.matches;const originalWidth=track.scrollWidth;if(!Number.isFinite(originalWidth)||originalWidth<=0)return;const originalChildren=Array.from(track.children);const clones=originalChildren.map(child=>{const clone=child.cloneNode(true);markCloneSubtree(clone);return clone;});clones.forEach(clone=>track.appendChild(clone));const dragThreshold=6;let hovered=false;let isDragging=false;let dragStartX=0;let dragStartOffset=0;let didDrag=false;let suppressClick=false;let rafId=0;let offset=0;let lastTime=0;const onPointerEnter=()=>{hovered=true;};const onPointerLeave=()=>{hovered=false;};if(pauseOnHover){root.addEventListener(\"pointerenter\",onPointerEnter);root.addEventListener(\"pointerleave\",onPointerLeave);}const normalizeOffset=value=>{if(!Number.isFinite(value))return 0;const mod=value%originalWidth;return mod<0?mod+originalWidth:mod;};const applyOffset=()=>{track.style.transform=`translate3d(${-offset}px, 0, 0)`;};const onPointerDown=event=>{if(event.button!==0&&event.pointerType!==\"touch\")return;isDragging=true;didDrag=false;dragStartX=event.clientX;dragStartOffset=offset;if(track.setPointerCapture){track.setPointerCapture(event.pointerId);}};const onPointerMove=event=>{if(!isDragging)return;const deltaX=event.clientX-dragStartX;if(!didDrag&&Math.abs(deltaX)>=dragThreshold){didDrag=true;}offset=normalizeOffset(dragStartOffset-deltaX);applyOffset();};const endDrag=event=>{if(!isDragging)return;isDragging=false;offset=normalizeOffset(offset);applyOffset();suppressClick=didDrag;didDrag=false;if(track.releasePointerCapture&&track.hasPointerCapture(event.pointerId)){track.releasePointerCapture(event.pointerId);}};const onClickCapture=event=>{if(!suppressClick)return;event.preventDefault();event.stopPropagation();suppressClick=false;};const previousTouchAction=root.style.touchAction;root.style.touchAction=\"pan-y\";track.addEventListener(\"pointerdown\",onPointerDown);track.addEventListener(\"pointermove\",onPointerMove);track.addEventListener(\"pointerup\",endDrag);track.addEventListener(\"pointercancel\",endDrag);track.addEventListener(\"pointerleave\",endDrag);root.addEventListener(\"click\",onClickCapture,true);const shouldAnimate=!isStatic&&!reducedMotion;const frame=time=>{if(lastTime===0)lastTime=time;const dt=(time-lastTime)/1e3;lastTime=time;const paused=isDragging||pauseOnHover&&hovered;if(!paused&&shouldAnimate){offset+=resolvedSpeed*dt;offset=normalizeOffset(offset);applyOffset();}rafId=window.requestAnimationFrame(frame);};rafId=window.requestAnimationFrame(frame);return()=>{window.cancelAnimationFrame(rafId);if(pauseOnHover){root.removeEventListener(\"pointerenter\",onPointerEnter);root.removeEventListener(\"pointerleave\",onPointerLeave);}track.removeEventListener(\"pointerdown\",onPointerDown);track.removeEventListener(\"pointermove\",onPointerMove);track.removeEventListener(\"pointerup\",endDrag);track.removeEventListener(\"pointercancel\",endDrag);track.removeEventListener(\"pointerleave\",endDrag);root.removeEventListener(\"click\",onClickCapture,true);root.style.touchAction=previousTouchAction;track.style.transform=\"\";clones.forEach(clone=>clone.remove());};},[isStatic,markCloneSubtree,pauseOnHover,resolvedSpeed]);return{ref};}addPropertyControls(ContinuousHorizontalCarousel,{speed:{type:ControlType.Number,title:\"Speed\",defaultValue:40,min:1,max:300,step:1,unit:\"px/s\"},pauseOnHover:{type:ControlType.Boolean,title:\"Pause Hover\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"}});import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withautoCarouselWithPagination(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...autoCarouselWithPagination(props)});};}withautoCarouselWithPagination.displayName=\"autoCarouselWithPagination\";export function withContinuousHorizontalCarousel(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...ContinuousHorizontalCarousel(props)});};}withContinuousHorizontalCarousel.displayName=\"ContinuousHorizontalCarousel\";\nexport const __FramerMetadata__ = {\"exports\":{\"ContinuousHorizontalCarousel\":{\"type\":\"override\",\"name\":\"ContinuousHorizontalCarousel\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withContinuousHorizontalCarousel\":{\"type\":\"reactHoc\",\"name\":\"withContinuousHorizontalCarousel\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withautoCarouselWithPagination\":{\"type\":\"reactHoc\",\"name\":\"withautoCarouselWithPagination\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"autoCarouselWithPagination\":{\"type\":\"override\",\"name\":\"autoCarouselWithPagination\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./autoCarouselWithPagination.map"],"mappings":"oRAA8M,SAAgB,GAA4B,CAAC,IAAM,EAAIA,EAAO,IAAI,EAImhB,OAJjhB,MAAc,CAAC,IAAM,EAAK,EAAI,QAAQ,GAAG,CAAC,EAAK,OAAsE,IAAM,EAAxD,EAAK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