{"version":3,"file":"BlogScroller.CSqnpKWM.mjs","names":["React.useRef","React.useState"],"sources":["https:/framerusercontent.com/modules/oAmX30eQPNnLYyyXE7l9/6w3pPAapj3IhOqoy9f9d/BlogScroller.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";/**\n * Horizontal scroller for the homepage blog row.\n *\n * Applied as a code override to the CMS Collection List rather than built as a\n * component. A Framer component cannot read the CMS — which is exactly why the\n * old hand-built slider never picked up JoAnne's posts. Keeping the list a real\n * Collection List and layering behaviour on top means the row stays CMS-driven:\n * publish a post and it appears here, no developer.\n *\n * The scroll container is Framer's own node, found at runtime by looking for the\n * descendant that actually scrolls horizontally. Nothing is re-parented, so the\n * page layout is untouched.\n *\n * Arrows only appear when there is somewhere to scroll. With three posts on a\n * wide screen nothing overflows, so it degrades to a plain row until the blog\n * grows — which is the point of building it now.\n */const GAP=30;const SIZE=48;const FALLBACK_TOP=140// used only until the first photo has laid out\n;function hideScrollbar(el){const id=\"seaside-no-scrollbar\";if(!document.getElementById(id)){const st=document.createElement(\"style\");st.id=id;st.textContent=\"[data-seaside-scroller]::-webkit-scrollbar{display:none;width:0;height:0}\"+\"[data-seaside-scroller]>*{flex:0 0 auto;scroll-snap-align:start}\";document.head.appendChild(st);}el.setAttribute(\"data-seaside-scroller\",\"\");}function findScroller(root){if(!root)return null;const stack=[root];while(stack.length){const el=stack.shift();const ox=getComputedStyle(el).overflowX;if((ox===\"auto\"||ox===\"scroll\")&&el.children.length>0)return el;for(const c of Array.from(el.children))stack.push(c);}return null;}export function withBlogScroller(Component){return props=>{const wrap=React.useRef(null);const[atStart,setAtStart]=React.useState(true);const[atEnd,setAtEnd]=React.useState(true);const[arrowTop,setArrowTop]=React.useState(FALLBACK_TOP);React.useEffect(()=>{const el=findScroller(wrap.current);if(!el)return;el.style.scrollSnapType=\"x mandatory\";el.style.scrollBehavior=\"smooth\";el.style.scrollbarWidth=\"none\";el.style.msOverflowStyle=\"none\";hideScrollbar(el);const placeArrows=()=>{const card=el.children[0];if(!card)return;let photo=null;const walk=node=>{const bg=getComputedStyle(node).backgroundImage;if((node.tagName===\"IMG\"||bg&&bg!==\"none\")&&node.offsetHeight>80){if(!photo||node.offsetHeight>photo.offsetHeight)photo=node;}for(const c of Array.from(node.children))walk(c);};walk(card);if(!photo)return;const top=photo.getBoundingClientRect().top-el.getBoundingClientRect().top;setArrowTop(top+photo.offsetHeight/2);};const measure=()=>{const max=el.scrollWidth-el.clientWidth;setAtStart(el.scrollLeft<=1);setAtEnd(max<=1||el.scrollLeft>=max-1);};measure();placeArrows();const t=setTimeout(placeArrows,300);el.addEventListener(\"scroll\",measure,{passive:true});const ro=new ResizeObserver(()=>{measure();placeArrows();});ro.observe(el);// Drag to scroll, for desktops without a trackpad.\nlet down=false;let startX=0;let startLeft=0;let moved=0;const onDown=e=>{down=true;moved=0;startX=e.clientX;startLeft=el.scrollLeft;el.style.scrollBehavior=\"auto\";};const onMove=e=>{if(!down)return;const dx=e.clientX-startX;moved=Math.max(moved,Math.abs(dx));el.scrollLeft=startLeft-dx;};const onUp=()=>{down=false;el.style.scrollBehavior=\"smooth\";};// A drag that travelled is not a click — don't open the article.\nconst onClick=e=>{if(moved>4){e.preventDefault();e.stopPropagation();}};el.addEventListener(\"pointerdown\",onDown);el.addEventListener(\"pointermove\",onMove);window.addEventListener(\"pointerup\",onUp);el.addEventListener(\"click\",onClick,true);return()=>{el.removeEventListener(\"scroll\",measure);el.removeEventListener(\"pointerdown\",onDown);el.removeEventListener(\"pointermove\",onMove);window.removeEventListener(\"pointerup\",onUp);el.removeEventListener(\"click\",onClick,true);clearTimeout(t);ro.disconnect();};},[]);const nudge=dir=>{const el=findScroller(wrap.current);if(!el)return;const card=el.children[0];const step=card?card.offsetWidth+GAP:el.clientWidth*.8;el.scrollBy({left:step*dir,behavior:\"smooth\"});};const arrow=(side,hidden)=>({position:\"absolute\",top:arrowTop,[side]:-14,transform:\"translateY(-50%)\",width:SIZE,height:SIZE,borderRadius:\"50%\",border:\"none\",background:\"rgb(20,71,80)\",color:\"#FFFFFF\",fontSize:19,lineHeight:1,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",cursor:\"pointer\",zIndex:3,opacity:hidden?0:1,pointerEvents:hidden?\"none\":\"auto\",transition:\"opacity .2s ease\",boxShadow:\"0 2px 10px rgba(20,71,80,.22)\"});return /*#__PURE__*/_jsxs(\"div\",{ref:wrap,style:{position:\"relative\",width:\"100%\",maxWidth:\"100%\"},children:[/*#__PURE__*/_jsx(Component,{...props}),/*#__PURE__*/_jsx(\"button\",{\"aria-label\":\"Previous articles\",style:arrow(\"left\",atStart),onClick:()=>nudge(-1),children:\"←\"}),/*#__PURE__*/_jsx(\"button\",{\"aria-label\":\"Next articles\",style:arrow(\"right\",atEnd),onClick:()=>nudge(1),children:\"→\"})]});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withBlogScroller\":{\"type\":\"reactHoc\",\"name\":\"withBlogScroller\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./BlogScroller.map"],"mappings":"qJAiBC,SAAS,EAAc,EAAG,CAAC,IAAM,EAAG,uBAAuB,GAAG,CAAC,SAAS,eAAe,CAAE,EAAE,CAAC,IAAM,EAAG,SAAS,cAAc,OAAO,EAAE,EAAG,GAAG,EAAG,EAAG,YAAY,4IAA+I,SAAS,KAAK,YAAY,CAAE,CAAE,CAAC,EAAG,aAAa,wBAAwB,EAAE,CAAE,CAAC,SAAS,EAAa,EAAK,CAAC,GAAG,CAAC,EAAK,OAAO,KAAK,IAAM,EAAM,CAAC,CAAI,EAAE,KAAM,EAAM,QAAO,CAAC,IAAM,EAAG,EAAM,MAAM,EAAQ,EAAG,iBAAiB,CAAE,CAAC,CAAC,UAAU,IAAI,IAAK,QAAQ,IAAK,WAAW,EAAG,SAAS,OAAO,EAAE,OAAO,EAAG,IAAI,IAAM,KAAK,MAAM,KAAK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