{"version":3,"file":"DragSnap.CCgJ-BGS.mjs","names":["useState","useCallback","_Fragment","__esmMin","window","init_ssg_sandbox_shims","init_npm_react_18_3_1","_e","l","ne","p","J","init_jsx_runtime","ce","useDragSnap","el","reduced","pad","ro","gsap","onReady","ratio","maxScroll","clamp","x","snapPoints","first","max","all","c","a","b","nearestIndex","points","best","aim","gliding","moveTo","EASE","settleOn","GLIDE_S","onScroll","drag","onDown","e","onMove","dx","FOLLOW_S","onUp","d","v","from","to","PROJECT_MS","MAX_CARDS","settle","onWheel","WHEEL_S","onKey","i","noDrag","withDragSnap","rest","props","setEl","setRef","n","ref","CSS","Component","className","init_DragSnap"],"sources":["https:/framerusercontent.com/modules/pLTmzyWXlGl02ogG0eDo/rKPZoTVimYtM1joHJlEu/DragSnap.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{forwardRef,useCallback,useEffect,useState}from\"react\";// Riverbend drag + snap row (Amenities cards). Put it on a horizontal stack: the stack scrolls sideways and each child snaps\n// its left edge to the stack's left padding.\n// Mouse and trackpad: GSAP moves the row (scrollLeft tweens on GSAP's ticker, our rb-out curve). A drag follows the cursor 1:1,\n// smoothed by a short tween; on release the row glides to a card (a flick goes up to two cards on) and lands exactly on it.\n// Sideways trackpad swipes are smoothed the same way, then settle on a card. Arrow keys move card by card.\n// Touch screens: native swipe with CSS scroll snap. If GSAP never loads, mouse dragging is direct and the row snaps natively.\n// Drag distance is matched to the cursor under the Fluid scale zoom. Reduced motion: no glide, the row moves straight to the card.\nconst CSS=\".rb-snap{overflow-x:auto!important;overflow-y:hidden!important;overscroll-behavior-x:contain;scrollbar-width:none;scroll-behavior:auto!important}\"+\".rb-snap::-webkit-scrollbar{display:none}\"+\".rb-snap>*{scroll-snap-align:start;flex-shrink:0!important}\"+\".rb-snap:focus-visible{outline:2px solid #54B8FF;outline-offset:4px}\"+\"@media (pointer:coarse){.rb-snap{scroll-snap-type:x mandatory}}\"+\".rb-snap.rb-snap-native{scroll-snap-type:x mandatory}\"+\"@media (hover:hover) and (pointer:fine){.rb-snap{cursor:grab}.rb-snap,.rb-snap *{user-select:none;-webkit-user-select:none}}\"+\".rb-snap img{-webkit-user-drag:none;user-drag:none}\"+\".rb-snap.rb-snap-drag{cursor:grabbing}\"+\".rb-snap.rb-snap-drag *{pointer-events:none}\";// Motion (animation.md): rb-out everywhere; the glide is the long step (1s).\nconst EASE=\"rb-out\";const FOLLOW_S=.35// drag smoothing\n;const WHEEL_S=.5// trackpad smoothing\n;const GLIDE_S=1// release / settle / arrow keys\n;// How far a release's speed carries the aim (ms), and how many cards a fling may move past where it was let go.\nconst PROJECT_MS=250;const MAX_CARDS=2;function useDragSnap(el){useEffect(()=>{if(!el||typeof window===\"undefined\")return;const reduced=window.matchMedia(\"(prefers-reduced-motion: reduce)\");// Snap to the cards' left edges at the row's own left padding (native snap uses this too).\nconst pad=()=>el.style.scrollPaddingLeft=getComputedStyle(el).paddingLeft;pad();const ro=new ResizeObserver(pad);ro.observe(el);if(!el.hasAttribute(\"tabindex\"))el.tabIndex=0;if(!el.hasAttribute(\"aria-label\"))el.setAttribute(\"aria-label\",(el.getAttribute(\"data-framer-name\")||\"Cards\")+\", scrolls sideways\");el.setAttribute(\"role\",\"region\");// GSAP arrives with the site's motion entry; wait for its ready signal (framer/README.md › Ready signal).\nlet gsap=null;const onReady=()=>{gsap=window.gsap||null;if(!gsap)el.classList.add(\"rb-snap-native\");};if(window.rbMotionReady)onReady();else window.addEventListener(\"rb:motion-ready\",onReady,{once:true});// Screen px per scroll px: the row sits inside the zoomed page.\nconst ratio=()=>el.getBoundingClientRect().width/el.clientWidth||1;const maxScroll=()=>el.scrollWidth-el.clientWidth;const clamp=x=>Math.max(0,Math.min(maxScroll(),x));const snapPoints=()=>{const first=el.firstElementChild;if(!first)return[0];const max=maxScroll();const all=Array.from(el.children).map(c=>Math.min(max,c.offsetLeft-first.offsetLeft)).concat(max);return Array.from(new Set(all.map(Math.round))).sort((a,b)=>a-b);};const nearestIndex=(points,x)=>points.reduce((best,p,i)=>Math.abs(p-x)<Math.abs(points[best]-x)?i:best,0);// Where the row is heading. Every move goes through here. `gliding` is ours, not gsap.isTweening: a tween that has\n// just replaced another isn't \"active\" until its first frame, and a scroll event in that gap would reset the aim.\nlet aim=el.scrollLeft;let gliding=false;const moveTo=(x,duration)=>{aim=clamp(x);if(!gsap||reduced.matches){gsap?.killTweensOf(el);gliding=false;el.scrollLeft=aim;return;}gliding=true;gsap.to(el,{scrollLeft:aim,duration,ease:EASE,overwrite:true,onComplete:()=>gliding=false});};const settleOn=x=>{const points=snapPoints();moveTo(points[nearestIndex(points,x)],GLIDE_S);};// If something else scrolled the row (keyboard focus, a hybrid touch screen), carry on from where it really is.\nconst onScroll=()=>{if(!drag&&!gliding)aim=el.scrollLeft;};// Mouse drag.\nlet drag=null;const onDown=e=>{if(e.pointerType!==\"mouse\"||e.button!==0)return;// Stop the browser starting its own image drag or a text selection.\ne.preventDefault();// Grabbing a gliding row catches it where it is.\ngsap?.killTweensOf(el);gliding=false;aim=el.scrollLeft;drag={id:e.pointerId,x:e.clientX,left:aim,moved:false,samples:[{t:e.timeStamp,x:e.clientX}]};};const onMove=e=>{if(!drag||e.pointerId!==drag.id)return;const dx=e.clientX-drag.x;if(!drag.moved){if(Math.abs(dx)<4)return;drag.moved=true;el.setPointerCapture(e.pointerId);el.classList.add(\"rb-snap-drag\");}e.preventDefault();moveTo(drag.left-dx/ratio(),FOLLOW_S);drag.samples.push({t:e.timeStamp,x:e.clientX});// Keep the last ~100ms for the release speed.\nwhile(drag.samples.length>2&&e.timeStamp-drag.samples[0].t>100)drag.samples.shift();};const onUp=e=>{if(!drag||e.pointerId!==drag.id)return;const d=drag;drag=null;el.classList.remove(\"rb-snap-drag\");if(!d.moved)return;// A drag isn't a click: swallow the click that follows it.\nel.addEventListener(\"click\",c=>(c.preventDefault(),c.stopPropagation()),{capture:true,once:true});const a=d.samples[0];const b=d.samples[d.samples.length-1];// Release speed in screen px per ms; 0 if the pointer had stopped before letting go.\nconst v=b.t>a.t&&e.timeStamp-b.t<80?(b.x-a.x)/(b.t-a.t):0;const points=snapPoints();const from=nearestIndex(points,aim);const to=nearestIndex(points,aim-v*PROJECT_MS/ratio());moveTo(points[Math.max(from-MAX_CARDS,Math.min(from+MAX_CARDS,to))],GLIDE_S);};// Sideways trackpad swipes. Lenis takes wheel events before the row can scroll natively, so GSAP moves it, then it\n// settles on the nearest card once the swipe (and its momentum) stops. Vertical wheel is left to Lenis.\nlet settle=0;const onWheel=e=>{if(Math.abs(e.deltaX)<=Math.abs(e.deltaY))return;e.preventDefault();moveTo(aim+e.deltaX,WHEEL_S);window.clearTimeout(settle);settle=window.setTimeout(()=>settleOn(aim),160);};// Arrow keys: card by card.\nconst onKey=e=>{if(e.key!==\"ArrowRight\"&&e.key!==\"ArrowLeft\")return;e.preventDefault();const points=snapPoints();const i=nearestIndex(points,aim)+(e.key===\"ArrowRight\"?1:-1);moveTo(points[Math.max(0,Math.min(points.length-1,i))],GLIDE_S);};// Images inside shouldn't start a native drag.\nconst noDrag=e=>e.preventDefault();el.addEventListener(\"pointerdown\",onDown);el.addEventListener(\"pointermove\",onMove);el.addEventListener(\"pointerup\",onUp);el.addEventListener(\"pointercancel\",onUp);el.addEventListener(\"dragstart\",noDrag);el.addEventListener(\"wheel\",onWheel,{passive:false});el.addEventListener(\"keydown\",onKey);el.addEventListener(\"scroll\",onScroll,{passive:true});return()=>{gsap?.killTweensOf(el);window.clearTimeout(settle);window.removeEventListener(\"rb:motion-ready\",onReady);ro.disconnect();el.removeEventListener(\"pointerdown\",onDown);el.removeEventListener(\"pointermove\",onMove);el.removeEventListener(\"pointerup\",onUp);el.removeEventListener(\"pointercancel\",onUp);el.removeEventListener(\"dragstart\",noDrag);el.removeEventListener(\"wheel\",onWheel);el.removeEventListener(\"keydown\",onKey);el.removeEventListener(\"scroll\",onScroll);};},[el]);}export function withDragSnap(Component){return /*#__PURE__*/forwardRef(function DragSnap(props,ref){const{className,...rest}=props;// The node is kept in state so the effect runs once it exists; the forwarded ref still gets it.\nconst[el,setEl]=useState(null);const setRef=useCallback(n=>{setEl(n);if(typeof ref===\"function\")ref(n);else if(ref)ref.current=n;},[ref]);useDragSnap(el);return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{\"data-rb-snap\":\"\",children:CSS}),/*#__PURE__*/_jsx(Component,{...rest,ref:setRef,className:className?className+\" rb-snap\":\"rb-snap\"})]});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withDragSnap\":{\"type\":\"reactHoc\",\"name\":\"withDragSnap\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DragSnap.map"],"mappings":"A,mKAYuC,SAASc,EAAY,EAAG,CAACD,MAAc,CAAC,GAAG,CAACE,GAAWX,IAAS,OAAY,OAAO,IAAMY,EAAQZ,EAAO,WAAW,kCAAkC,EACtLa,MAAQ,EAAG,MAAM,kBAAkB,iBAAiBF,CAAE,CAAC,CAAC,YAAYE,EAAI,EAAE,IAAMC,EAAG,IAAI,eAAeD,CAAG,EAAEC,EAAG,QAAQH,CAAE,EAAMA,EAAG,aAAa,UAAU,IAAE,EAAG,SAAS,GAAMA,EAAG,aAAa,YAAY,GAAEA,EAAG,aAAa,cAAcA,EAAG,aAAa,kBAAkB,GAAG,SAAS,oBAAoB,EAAEA,EAAG,aAAa,OAAO,QAAQ,EACjV,IAAII,EAAK,KAAWC,MAAY,CAAC,EAAKhB,EAAO,MAAM,KAASe,GAAKJ,EAAG,UAAU,IAAI,gBAAgB,CAAE,EAAKX,EAAO,cAAcgB,EAAQ,EAAOhB,EAAO,iBAAiB,kBAAkBgB,EAAQ,CAAC,KAAK,EAAI,CAAC,EAC1M,IAAMC,MAAUN,EAAG,sBAAsB,CAAC,CAAC,MAAMA,EAAG,aAAa,EAAQO,MAAcP,EAAG,YAAYA,EAAG,YAAkBQ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