{"version":3,"file":"ProgramSectionNavigation.CdmbeLqG.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/aPj4tA1vzBDrEWqUl17f/efrRZ3FwlFv5xF77sIK3/ProgramSectionNavigation.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useLayoutEffect,useRef}from\"react\";import{RenderTarget}from\"framer\";// Native Framer page links remain responsible for routing and menu behavior.\n// These overrides retain the selected section when cross-page preview metadata\n// omits its fragment. No DOM searches, polling, analytics, or external services.\nlet pending=null;const eventName=\"hiro-program-section\";const mountedTargets=new Set;function link(Component,slug){return /*#__PURE__*/forwardRef(function ProgramSectionLink(props,ref){const originalHref=typeof props.href===\"string\"?props.href.split(\"#\")[0]:\"./programs\";return /*#__PURE__*/_jsx(Component,{...props,ref:ref,href:`${originalHref}#${slug}`,onClickCapture:event=>{props.onClickCapture?.(event);if(event.defaultPrevented||event.metaKey||event.ctrlKey||event.shiftKey||event.altKey||event.button>0)return;if(mountedTargets.has(slug)){event.preventDefault();event.stopPropagation();}pending={slug,time:Date.now()};window.dispatchEvent(new Event(eventName));}});});}function target(Component,slug){return /*#__PURE__*/forwardRef(function ProgramSectionTarget(props,forwardedRef){const element=useRef(null);useLayoutEffect(()=>{if(RenderTarget.current()===RenderTarget.canvas)return;mountedTargets.add(slug);let frame=0;const jump=()=>{cancelAnimationFrame(frame);const request=pending;const hash=decodeURIComponent(window.location.hash.slice(1));if(!(request?.slug===slug&&Date.now()-request.time<1e4)&&!(request===null&&hash===slug))return;// Resolve the destination during layout, before the browser paints.\nconst position=()=>{if(request&&pending!==request)return;const node=element.current;if(!node||!node.isConnected||node.getClientRects().length===0)return;const box=node.getBoundingClientRect();if(box.width===0||box.height===0)return;window.scrollTo({top:slug===\"overview\"?0:Math.max(0,window.scrollY+box.top-120),behavior:\"instant\"});const url=new URL(window.location.href);url.hash=slug===\"overview\"?\"\":slug;window.history.replaceState(window.history.state,\"\",url);};position();// Native router restoration may run later in this React commit.\n// Reconcile once before paint; never delay or animate the jump.\nframe=requestAnimationFrame(()=>{position();if(pending===request)pending=null;});};jump();window.addEventListener(eventName,jump);window.addEventListener(\"hashchange\",jump);return()=>{mountedTargets.delete(slug);cancelAnimationFrame(frame);window.removeEventListener(eventName,jump);window.removeEventListener(\"hashchange\",jump);};},[]);return /*#__PURE__*/_jsx(Component,{...props,id:slug,style:{...props.style,scrollMarginTop:120},ref:node=>{element.current=node;if(typeof forwardedRef===\"function\")forwardedRef(node);else if(forwardedRef)forwardedRef.current=node;}});});}export function LittleHirosLink(Component){return link(Component,\"little-hiros\");}export function HiroKidsLink(Component){return link(Component,\"hiro-kids\");}export function TeensAdultsLink(Component){return link(Component,\"teens-adults\");}export function BoxingLink(Component){return link(Component,\"boxing\");}export function KravMagaLink(Component){return link(Component,\"krav-maga\");}export function LittleHirosTarget(Component){return target(Component,\"little-hiros\");}export function HiroKidsTarget(Component){return target(Component,\"hiro-kids\");}export function TeensAdultsTarget(Component){return target(Component,\"teens-adults\");}export function BoxingTarget(Component){return target(Component,\"boxing\");}export function KravMagaTarget(Component){return target(Component,\"krav-maga\");}export function ProgramsTopLink(Component){return /*#__PURE__*/forwardRef(function ProgramsTop(props,ref){return /*#__PURE__*/_jsx(Component,{...props,ref:ref,onClickCapture:event=>{props.onClickCapture?.(event);if(!event.defaultPrevented){pending={slug:\"overview\",time:Date.now()};window.dispatchEvent(new Event(eventName));}}});});}export function ProgramsTopTarget(Component){return target(Component,\"overview\");}\nexport const __FramerMetadata__ = {\"exports\":{\"TeensAdultsTarget\":{\"type\":\"reactHoc\",\"name\":\"TeensAdultsTarget\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"KravMagaLink\":{\"type\":\"reactHoc\",\"name\":\"KravMagaLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"KravMagaTarget\":{\"type\":\"reactHoc\",\"name\":\"KravMagaTarget\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"HiroKidsTarget\":{\"type\":\"reactHoc\",\"name\":\"HiroKidsTarget\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"TeensAdultsLink\":{\"type\":\"reactHoc\",\"name\":\"TeensAdultsLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"LittleHirosLink\":{\"type\":\"reactHoc\",\"name\":\"LittleHirosLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"BoxingTarget\":{\"type\":\"reactHoc\",\"name\":\"BoxingTarget\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ProgramsTopTarget\":{\"type\":\"reactHoc\",\"name\":\"ProgramsTopTarget\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"LittleHirosTarget\":{\"type\":\"reactHoc\",\"name\":\"LittleHirosTarget\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"BoxingLink\":{\"type\":\"reactHoc\",\"name\":\"BoxingLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ProgramsTopLink\":{\"type\":\"reactHoc\",\"name\":\"ProgramsTopLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"HiroKidsLink\":{\"type\":\"reactHoc\",\"name\":\"HiroKidsLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ProgramSectionNavigation.map"],"mappings":"0LAGqF,SAAS,EAAK,EAAU,EAAK,CAAC,OAAoB,EAAW,SAA4B,EAAM,EAAI,CAAC,IAAM,EAAa,OAAO,EAAM,MAAO,SAAS,EAAM,KAAK,MAAM,GAAG,CAAC,CAAC,GAAG,aAAa,OAAoB,EAAK,EAAU,CAAC,GAAG,EAAU,MAAI,KAAK,GAAG,EAAa,GAAG,IAAO,eAAe,GAAO,CAAC,EAAM,iBAAiB,CAAK,EAAK,IAAM,kBAAkB,EAAM,SAAS,EAAM,SAAS,EAAM,UAAU,EAAM,QAAQ,EAAM,OAAO,KAAY,EAAe,IAAI,CAAI,IAAG,EAAM,eAAe,EAAE,EAAM,gBAAgB,GAAG,E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