{"version":3,"file":"WhyScrollCards.TMFuq1fI.mjs","names":["useRef","_Fragment"],"sources":["https:/framerusercontent.com/modules/cK2VWkjXefiVHNLJGEb2/2egaIKgaRR0iN3tdcvoS/WhyScrollCards.js"],"sourcesContent":["// Scroll choreography for the Champions page \"Why share your journey\" photo.\n//\n// \"Why Photo Track\" is a tall frame. Its first child, \"Why Stage\", is sticky, so\n// the photo stays pinned while the rest of the track (\"Scroll Length\") scrolls\n// past. withWhyTrack turns that pinned distance into a 0–1 progress value, and\n// the card overrides use it to rise the three cards in one after another. Once\n// the last card has settled the stage unpins and scrolls away normally.\n//\n// The track is found through the element right after this override's own\n// <style> tag, the same trick FillViewport.tsx uses. On the canvas every\n// override renders its layer unchanged so the section stays editable.\nimport{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{useIsStaticRenderer}from\"framer\";import{motionValue,useSpring,useTransform}from\"framer-motion\";const progress=motionValue(0);// Progress ranges (0–1 of the pinned scroll distance)\nconst CARD_STEPS=[[.05,.28],[.3,.53],[.55,.78]];const CARD_RISE=120// px the cards travel up while fading in\n;const SPRING={stiffness:140,damping:30,mass:.6};function useSmoothProgress(){return useSpring(progress,SPRING);}export function withWhyTrack(Component){return function WhyTrack(props){const styleRef=useRef(null);useEffect(()=>{let frame=0;const update=()=>{frame=0;const track=styleRef.current?.nextElementSibling;if(!track)return;const rect=track.getBoundingClientRect();// Breakpoints that aren't showing render with no height; ignore them\nif(rect.height===0)return;const stage=track.firstElementChild;const pinned=rect.height-(stage?.offsetHeight??0);// The stage may pin below the top of the screen (its sticky top)\nconst stickyTop=stage?parseFloat(getComputedStyle(stage).top)||0:0;const value=pinned>0?Math.min(1,Math.max(0,(stickyTop-rect.top)/pinned)):0;progress.set(value);};const schedule=()=>{if(!frame)frame=window.requestAnimationFrame(update);};update();window.addEventListener(\"scroll\",schedule,{passive:true});window.addEventListener(\"resize\",schedule);return()=>{window.cancelAnimationFrame(frame);window.removeEventListener(\"scroll\",schedule);window.removeEventListener(\"resize\",schedule);};},[]);return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{ref:styleRef,\"data-why-track\":\"\"}),/*#__PURE__*/_jsx(Component,{...props})]});};}function withCard(Component,step){const[start,end]=CARD_STEPS[step];return function WhyCard(props){const isStatic=useIsStaticRenderer();const p=useSmoothProgress();const y=useTransform(p,[start,end],[CARD_RISE,0]);const opacity=useTransform(p,[start,start+(end-start)*.7],[0,1]);if(isStatic)return /*#__PURE__*/_jsx(Component,{...props});return /*#__PURE__*/_jsx(Component,{...props,style:{...props.style,y,opacity}});};}export function withWhyCard1(Component){return withCard(Component,0);}export function withWhyCard2(Component){return withCard(Component,1);}export function withWhyCard3(Component){return withCard(Component,2);}\nexport const __FramerMetadata__ = {\"exports\":{\"withWhyCard1\":{\"type\":\"reactHoc\",\"name\":\"withWhyCard1\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withWhyTrack\":{\"type\":\"reactHoc\",\"name\":\"withWhyTrack\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withWhyCard3\":{\"type\":\"reactHoc\",\"name\":\"withWhyCard3\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withWhyCard2\":{\"type\":\"reactHoc\",\"name\":\"withWhyCard2\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WhyScrollCards.map"],"mappings":"wQAaiD,SAAS,GAAmB,CAAC,OAAO,EAAU,EAAS,CAAM,CAAE,CAAC,SAAgB,EAAa,EAAU,CAAC,OAAO,SAAkB,EAAM,CAAC,IAAM,EAASA,EAAO,IAAI,EAE4R,OAF1R,MAAc,CAAC,IAAI,EAAM,EAAQ,MAAW,CAAC,EAAM,EAAE,IAAM,EAAM,EAAS,SAAS,mBAAmB,GAAG,CAAC,EAAM,OAAO,IAAM,EAAK,EAAM,sBAAsB,EACnX,GAAG,EAAK,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