{"version":3,"file":"AutoScroll.DfVSOCet.mjs","names":["useRef","useState","Children","__esmMin","init_npm_react_18_3_1","z","init_ssg_sandbox_shims","window","_e","K","c","J","init_jsx_runtime","ce","j","de","useAnimationFrame","init_framer_motion_DhsWWWsN","init_framer_CaDWdxiz","RenderTarget","withAutoScroll","rest","props","node","offset","velocity","SPEED","hovering","pressed","dragging","startX","lastX","lastT","pointerId","suppressClick","grabbing","setGrabbing","reduced","setReduced","isCanvas","mq","autoSpeed","HOVER_SPEED_FACTOR","wrap","half","el","onEnter","onLeave","onDown","onMove","e","DRAG_THRESHOLD","now","dx","dt","onUp","onClick","onWheel","onDragStart","delta","target","EASE_BACK","items","children","looped","i","setRef","ref","Component","style","init_AutoScroll"],"sources":["https:/framerusercontent.com/modules/qLpYJAiwmkoyRv6rnaWu/9TQOZn41ep2sDs7aDRO4/AutoScroll.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useRef,useState,useEffect,Children,cloneElement,isValidElement}from\"react\";import{useAnimationFrame}from\"framer-motion\";import{RenderTarget}from\"framer\";const SPEED=60// auto-scroll speed, pixels per second\n;const HOVER_SPEED_FACTOR=.25// slows to a quarter speed while the mouse is over the strip\n;const DRAG_THRESHOLD=6// pixels moved before a press counts as a drag (keeps clicks working)\n;const EASE_BACK=2.5// how quickly a fling settles back to the normal auto speed\n;export function withAutoScroll(Component){return /*#__PURE__*/forwardRef(function AutoScroll(props,ref){const{style,children,...rest}=props;const node=useRef(null);const offset=useRef(0);const velocity=useRef(SPEED);const hovering=useRef(false);const pressed=useRef(false);const dragging=useRef(false);const startX=useRef(0);const lastX=useRef(0);const lastT=useRef(0);const pointerId=useRef(null);const suppressClick=useRef(false);const[grabbing,setGrabbing]=useState(false);const[reduced,setReduced]=useState(false);const isCanvas=RenderTarget.current()===RenderTarget.canvas;useEffect(()=>{if(typeof window===\"undefined\"||!window.matchMedia)return;const mq=window.matchMedia(\"(prefers-reduced-motion: reduce)\");setReduced(mq.matches);},[]);const autoSpeed=()=>reduced?0:hovering.current?SPEED*HOVER_SPEED_FACTOR:SPEED;const wrap=el=>{const half=el.scrollWidth/2;if(half<=0)return;offset.current=(offset.current%half+half)%half;el.style.transform=\"translateX(\"+-offset.current+\"px)\";};useEffect(()=>{const el=node.current;if(!el||isCanvas)return;const onEnter=e=>{if(e.pointerType===\"mouse\")hovering.current=true;};const onLeave=e=>{if(e.pointerType===\"mouse\")hovering.current=false;};const onDown=e=>{if(e.pointerType===\"mouse\"&&e.button!==0)return;pressed.current=true;dragging.current=false;pointerId.current=e.pointerId;startX.current=e.clientX;lastX.current=e.clientX;lastT.current=performance.now();};const onMove=e=>{if(!pressed.current||e.pointerId!==pointerId.current)return;if(!dragging.current){if(Math.abs(e.clientX-startX.current)<DRAG_THRESHOLD)return;dragging.current=true;setGrabbing(true);try{el.setPointerCapture(e.pointerId);}catch(_){}}const now=performance.now();const dx=e.clientX-lastX.current;const dt=Math.max(1,now-lastT.current);offset.current-=dx;velocity.current=-dx/dt*1e3;lastX.current=e.clientX;lastT.current=now;wrap(el);};const onUp=e=>{if(e.pointerId!==pointerId.current)return;if(dragging.current){suppressClick.current=true;// Ignore a stale velocity if the pointer paused before release\nif(performance.now()-lastT.current>80)velocity.current=autoSpeed();velocity.current=Math.max(-3e3,Math.min(3e3,velocity.current));}pressed.current=false;dragging.current=false;pointerId.current=null;setGrabbing(false);};const onClick=e=>{if(suppressClick.current){e.preventDefault();e.stopPropagation();suppressClick.current=false;}};const onWheel=e=>{// Only take over sideways trackpad / shift+wheel scrolling; normal page scrolling is untouched\nconst dx=Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.shiftKey?e.deltaY:0;if(!dx)return;e.preventDefault();offset.current+=dx;velocity.current=autoSpeed();wrap(el);};const onDragStart=e=>e.preventDefault();el.addEventListener(\"pointerenter\",onEnter);el.addEventListener(\"pointerleave\",onLeave);el.addEventListener(\"pointerdown\",onDown);el.addEventListener(\"pointermove\",onMove);el.addEventListener(\"pointerup\",onUp);el.addEventListener(\"pointercancel\",onUp);el.addEventListener(\"click\",onClick,true);el.addEventListener(\"wheel\",onWheel,{passive:false});el.addEventListener(\"dragstart\",onDragStart);return()=>{el.removeEventListener(\"pointerenter\",onEnter);el.removeEventListener(\"pointerleave\",onLeave);el.removeEventListener(\"pointerdown\",onDown);el.removeEventListener(\"pointermove\",onMove);el.removeEventListener(\"pointerup\",onUp);el.removeEventListener(\"pointercancel\",onUp);el.removeEventListener(\"click\",onClick,true);el.removeEventListener(\"wheel\",onWheel);el.removeEventListener(\"dragstart\",onDragStart);};},[isCanvas,reduced]);useAnimationFrame((_,delta)=>{const el=node.current;if(!el||isCanvas||dragging.current)return;const dt=Math.min(delta,100)/1e3;const target=autoSpeed();velocity.current+=(target-velocity.current)*Math.min(1,dt*EASE_BACK);offset.current+=velocity.current*dt;wrap(el);});const items=Children.toArray(children);const looped=isCanvas?items:[...items,...items.map((c,i)=>/*#__PURE__*/isValidElement(c)?/*#__PURE__*/cloneElement(c,{key:\"loop-\"+i,\"aria-hidden\":true}):c)];const setRef=el=>{node.current=el;if(typeof ref===\"function\")ref(el);else if(ref)ref.current=el;};return /*#__PURE__*/_jsx(Component,{...rest,ref:setRef,style:{...style,willChange:\"transform\",cursor:isCanvas?style?.cursor:grabbing?\"grabbing\":\"grab\",touchAction:\"pan-y\",userSelect:\"none\",WebkitUserSelect:\"none\"},children:looped});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withAutoScroll\":{\"type\":\"reactHoc\",\"name\":\"withAutoScroll\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AutoScroll.map"],"mappings":"A,6QAIC,SAAgBoB,EAAe,EAAU,CAAC,MAAoB,gBAAW,SAAoB,EAAM,EAAI,CAAC,GAAK,CAAC,QAAM,WAAS,GAAGC,GAAMC,EAAYC,EAAKvB,EAAO,IAAI,EAAQwB,EAAOxB,EAAO,CAAC,EAAQy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