{"version":3,"file":"EditorialCarouselControls.B5vGc0GU.mjs","names":["__esmMin","init_ssg_sandbox_shims","init_npm_react_18_3_1","c","J","init_jsx_runtime","window","scrollEditorialCarousel","familyCarousel","slides","node","left","positions","slide","current","i","next","direction","reduced","carousel","children","carouselRect","cardWidth","rect","child","FALLBACK_CARD_WIDTH","computed","columnGapValue","amount","delta","prefersReducedMotion","createCarouselButtonOverride","onActivate","Component","props","ariaLabel","event","withCarouselPrevious","withCarouselNext","init_EditorialCarouselControls"],"sources":["https:/framerusercontent.com/modules/vqyHtNXD4grsBydKRYq3/gYYyzlnpy5pCeMjjsT4d/EditorialCarouselControls.js"],"sourcesContent":["// Request: Create a code override file with `withCarouselPrevious` and `withCarouselNext` HOCs for native canvas arrow buttons; preserve styling/children/props; on click/tap scroll the existing `#editorial-carousel` horizontal list by one card width + column gap; respect reduced motion; browser globals only inside event callbacks; add aria-labels and Enter/Space keyboard support without double invocation; do not rebuild carousel.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef}from\"react\";const FALLBACK_CARD_WIDTH=320;function scrollEditorialCarousel(direction){const familyCarousel=document.getElementById(\"family-legacy-carousel\");if(familyCarousel){const slides=Array.from(familyCarousel.children).filter(node=>node instanceof HTMLElement);if(!slides.length)return;const left=familyCarousel.getBoundingClientRect().left;const positions=slides.map(slide=>slide.getBoundingClientRect().left-left+familyCarousel.scrollLeft);let current=0;for(let i=1;i<positions.length;i++){if(Math.abs(positions[i]-familyCarousel.scrollLeft)<Math.abs(positions[current]-familyCarousel.scrollLeft))current=i;}const next=Math.max(0,Math.min(slides.length-1,current+(direction===\"next\"?1:-1)));const reduced=window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;familyCarousel.scrollTo({left:positions[next],behavior:reduced?\"auto\":\"smooth\"});return;}const carousel=document.getElementById(\"editorial-carousel\");if(!carousel)return;const children=Array.from(carousel.children).filter(node=>node instanceof HTMLElement);if(children.length===0)return;const carouselRect=carousel.getBoundingClientRect();const firstVisibleChild=children.find(child=>{const rect=child.getBoundingClientRect();return rect.right>carouselRect.left&&rect.left<carouselRect.right;})??children[0];const childRect=firstVisibleChild.getBoundingClientRect();const cardWidth=childRect.width||FALLBACK_CARD_WIDTH;const computed=window.getComputedStyle(carousel);const columnGapValue=computed.columnGap&&computed.columnGap!==\"normal\"?parseFloat(computed.columnGap):parseFloat(computed.gap||\"0\");const columnGap=Number.isFinite(columnGapValue)?columnGapValue:0;const amount=cardWidth+columnGap;const delta=direction===\"next\"?amount:-amount;const prefersReducedMotion=window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;carousel.scrollBy({left:delta,behavior:prefersReducedMotion?\"auto\":\"smooth\"});}function createCarouselButtonOverride(direction,ariaLabel){return function withCarouselControl(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const onActivate=()=>{if(typeof window===\"undefined\"||typeof document===\"undefined\")return;scrollEditorialCarousel(direction);};return /*#__PURE__*/_jsx(Component,{...props,ref:ref,\"aria-label\":props[\"aria-label\"]??ariaLabel,role:props.role??\"button\",tabIndex:props.tabIndex??0,onClick:event=>{props.onClick?.(event);if(event.defaultPrevented)return;onActivate();},onKeyDown:event=>{props.onKeyDown?.(event);if(event.defaultPrevented)return;const isNativeButton=event.currentTarget instanceof HTMLElement&&event.currentTarget.tagName===\"BUTTON\";if(isNativeButton)return;if(event.key===\"Enter\"||event.key===\" \"||event.key===\"Spacebar\"){event.preventDefault();onActivate();}}});});};}export function withCarouselPrevious(Component){return createCarouselButtonOverride(\"previous\",\"Previous articles\")(Component);}export function withCarouselNext(Component){return createCarouselButtonOverride(\"next\",\"Next articles\")(Component);}\nexport const __FramerMetadata__ = {\"exports\":{\"withCarouselPrevious\":{\"type\":\"reactHoc\",\"name\":\"withCarouselPrevious\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCarouselNext\":{\"type\":\"reactHoc\",\"name\":\"withCarouselNext\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n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