{"version":3,"file":"useSlideshowSwiper.CgkDbwTH.mjs","names":["useRef","useState","useRef","__esmMin","init_npm_react_18_3_1","_e","de","useSwiperShorterDrag","enabledRef","enabled","onInit","dragStart","slideToClosest","swiper","freeMode","size","MIN_THRESHOLD","distance","start","threshold","speed","runCallbacks","internal","position","moved","snaps","index","snap","i","span","shift","biased","init_useSwiperShorterDrag","useSlideshowSwiper","slideIndex","setSlideIndex","touchStartX","touchStartY","touchStartTime","touchHandled","isDesktop","touchX","event","touchY","touch","diffX","diffY","absDiffX","absDiffY","MAX_DURATION","MIN_DISTANCE","MAX_DISTANCE","MAX_VERTICAL_DISTANCE","MIN_HORIZONTAL_DISTANCE","init_useSlideshowSwiper"],"sources":["https:/framerusercontent.com/modules/qRv6oeqPtg4k9AWFtXT1/ecPYP6xDoZbM4Jn2egQb/useSwiperShorterDrag.js","https:/framerusercontent.com/modules/Xvbdz0eTxBmZu17yBIlL/MreYMasHzUp6wFPuV4yG/useSlideshowSwiper.js"],"sourcesContent":["import{useRef}from\"react\";const MIN_THRESHOLD=.05;/**\n * A slow drag changes the slide `distance` px before it reaches half a slide. Covers free mode\n * (sticky snapping via slideToClosest) and regular long swipes. Spread the returned handler on\n * <Swiper />; it uses `onInit`, so it doesn't clash with the other swiper hooks.\n */export default function useSwiperShorterDrag({enabled,distance=100}){const enabledRef=useRef(enabled);enabledRef.current=enabled;function onInit(swiper){let dragStart=null;const slideToClosest=swiper.slideToClosest.bind(swiper);swiper.on(\"touchStart\",()=>{dragStart=swiper.translate;});// Regular mode: Swiper compares the dragged share of the slide with longSwipesRatio right\n// after this event, so the ratio is set from the current slide size\nswiper.on(\"touchEnd\",()=>{const freeMode=swiper.params.freeMode;if(typeof freeMode===\"object\"?freeMode.enabled:freeMode)return;const size=swiper.slidesSizesGrid[swiper.activeIndex];swiper.params.longSwipesRatio=enabledRef.current&&size?Math.max(MIN_THRESHOLD,.5-distance/size):.5;});// Free mode: a release without momentum snaps through slideToClosest; its threshold is\n// moved towards the slide the drag came from, so the next one is reached sooner\nswiper.slideToClosest=(speed,runCallbacks,internal,threshold)=>{const start=dragStart;dragStart=null;if(!enabledRef.current||start===null||threshold!==undefined){return slideToClosest(speed,runCallbacks,internal,threshold);}const position=-swiper.translate;const moved=position+start;const snaps=swiper.snapGrid;const index=snaps.findIndex((snap,i)=>position>=snap&&position<snaps[i+1]);if(index<0||moved===0){return slideToClosest(speed,runCallbacks,internal);}const span=snaps[index+1]-snaps[index];const shift=Math.sign(moved)*distance/span;const biased=Math.min(1-MIN_THRESHOLD,Math.max(MIN_THRESHOLD,.5-shift));return slideToClosest(speed,runCallbacks,internal,biased);};}return{onInit};}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./useSwiperShorterDrag.map","import{useState,useRef}from\"react\";import useSwiperShorterDrag from\"https://framerusercontent.com/modules/qRv6oeqPtg4k9AWFtXT1/ecPYP6xDoZbM4Jn2egQb/useSwiperShorterDrag.js\";// Tune these values to get the exact feel you want\nconst MAX_DURATION=500;const MIN_DISTANCE=0;const MAX_DISTANCE=300;const MAX_VERTICAL_DISTANCE=45;const MIN_HORIZONTAL_DISTANCE=80;/**\n * Swiper behaviour shared by v2/components/transformations/Slideshow and the card sliders:\n * free mode with momentum; on touch screens a quick flick moves one slide; on desktop a slow\n * drag changes the slide before half of it. Spread the returned props on <Swiper /> (needs\n * the FreeMode module).\n */export default function useSlideshowSwiper({isDesktop}){const[slideIndex,setSlideIndex]=useState(0);const touchStartX=useRef(0);const touchStartY=useRef(0);const touchStartTime=useRef(0);const touchHandled=useRef(false);const shorterDrag=useSwiperShorterDrag({enabled:isDesktop});return{...shorterDrag,freeMode:{minimumVelocity:isDesktop?.1:.75,momentumRatio:isDesktop?.6:1.25,enabled:true,sticky:isDesktop},speed:500,slidesPerView:\"auto\",touchEventsTarget:\"container\",grabCursor:true,shortSwipes:false,longSwipes:false,threshold:0,touchRatio:isDesktop?1:1.6,onSlideChange:swiper=>{setSlideIndex(swiper.activeIndex);},onTouchStart:(_,event)=>{const touchX=event?.x;const touchY=event?.y;if(!touchX||isDesktop)return;touchStartX.current=touchX;touchStartY.current=touchY;touchStartTime.current=Date.now();touchHandled.current=false;},onTouchEnd:(swiper,event)=>{const touch=event?.changedTouches?.length>=1?event?.changedTouches?.item(0):event?.touches?.item(0);if(!touch||touchHandled.current||isDesktop)return;const diffX=touch.clientX-touchStartX.current;const diffY=touch.clientY-touchStartY.current;const absDiffX=Math.abs(diffX);const absDiffY=Math.abs(diffY);const duration=Date.now()-touchStartTime.current;const isHorizontalShortSwipe=duration<=MAX_DURATION&&absDiffX>=MIN_DISTANCE&&absDiffX<=MAX_DISTANCE;const isVerticalSwipe=absDiffY>=MAX_VERTICAL_DISTANCE&&absDiffX<=MIN_HORIZONTAL_DISTANCE;const isVeryShortSwipe=isHorizontalShortSwipe&&!isVerticalSwipe;if(isVeryShortSwipe){touchHandled.current=true;if(diffX<0){swiper.slideTo(slideIndex+1);}else{swiper.slideTo(slideIndex-1);}}else{if(!swiper.animating)swiper.slideTo(swiper.activeIndex);}},// Snaps to the nearest stop. slideTo(activeIndex) would pull the row back from its end\n// whenever the last stop falls in the first half of a slide.\nonTransitionEnd:swiper=>{swiper.slideToClosest();}};}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./useSlideshowSwiper.map"],"mappings":"A,2GAIG,SAAwBO,EAAqB,CAAC,UAAQ,WAAS,KAAK,CAAC,IAAMC,EAAWR,EAAOS,CAAO,EAAE,EAAW,QAAQA,EAAQ,SAASC,EAAO,EAAO,CAAC,IAAIC,EAAU,KAAWC,EAAeC,EAAO,eAAe,KAAKA,CAAM,EAAEA,EAAO,GAAG,iBAAiB,CAAC,EAAUA,EAAO,SAAU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