{"version":3,"file":"CaseStudyNav.yur9AVHW.mjs","names":["forwardRef","useRef","useEffect","_jsx","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","c","J","init_jsx_runtime","ce","de","measurableEl","wrapper","rect","child","box","findAnchor","id","sectionLabels","headings","el","parent","style","a","b","ANCHOR_ATTR","scrollToSection","onImmediate","target","top","clickLocked","lockTimer","distance","duration","isAtBottom","scrollHeight","getActiveSection","sectionIds","sections","entry","readingLine","current","section","applyStyle","active","color","ACTIVE_COLOR","INACTIVE_COLOR","t","withNavList","Component","makeNavList","SECTION_IDS","withGroundworkNavList","keyboardLinks","props","ref","containerRef","container","items","cleanups","applyActive","activeId","item","isActive","i","sectionId","onClick","onKeyDown","event","update","observer","fn","makeAnchor","withAnchorOverview","withAnchorAtAGlance","withAnchorTheProblem","withAnchorUserInsights","withAnchorDeepDive","withAnchorImpactOutcome","withAnchorNextSteps","init_CaseStudyNav"],"sources":["https:/framerusercontent.com/modules/Q84ijmLvKrow6o3TwZ6d/hiu9OU5VawCS6eEMt0XD/CaseStudyNav.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,forwardRef}from\"react\";// --- STYLING CONFIGURATION ---\nconst ACTIVE_COLOR=\"rgb(0, 0, 0)\";const INACTIVE_COLOR=\"rgb(112, 111, 111)\";const ANCHOR_ATTR=\"data-cs-anchor\";// Order matters: this must match the top-to-bottom order of the nav\n// items actually rendered in the sidebar (shared across OpenDoor,\n// OnCoSpark, and Berkeleytime). Currently that's 6 items: Overview,\n// The Problem, User Insights, Designing the Solution, Impact & Outcome,\n// Reflection — \"At a Glance\" is no longer its own nav entry, so it's\n// dropped from this list. Matching is by POSITION, not by label text,\n// so the anchor ids below (\"deep-dive\", \"next-steps\") don't need to\n// literally match the visible labels (\"Designing the Solution\",\n// \"Reflection\") — they just need to stay in the same top-to-bottom\n// order as the real nav items.\nconst SECTION_IDS=[\"overview\",\"the-problem\",\"user-insights\",\"deep-dive\",\"impact-outcome\",\"next-steps\"];// --- CLICK / SCROLL-SPY COORDINATION ---\n// When a nav item is clicked we know the target section immediately —\n// no need to wait for scroll position to catch up. We set it directly\n// and \"lock\" scroll-driven updates until the smooth-scroll animation\n// has had time to finish, so the highlight doesn't flicker back to\n// whatever section you're scrolling past on the way there.\nlet clickLocked=false;let lockTimer=null;// The anchor wrapper itself is `display: contents`, so it never has its\n// own box — measuring it directly always returns ~(0,0). We measure its\n// rendered child instead, which has the real position on the page.\n// Framer renders responsive copies and display:contents wrappers.\n// Only measure visible boxes, descending through boxless wrappers.\nfunction measurableEl(wrapper){if(window.getComputedStyle(wrapper).display===\"none\")return null;const rect=wrapper.getBoundingClientRect();if(wrapper.getClientRects().length&&rect.width>0&&rect.height>0)return wrapper;for(const child of Array.from(wrapper.children)){const box=measurableEl(child);if(box)return box;}return null;}function findAnchor(id){// Impact blocks may have been moved independently of their old marker.\n// Resolve their visible heading so both clicking and tracking use the\n// actual start of the outcome section.\nconst sectionLabels={\"the-problem\":\"the problem\",\"user-insights\":\"user insights\",\"deep-dive\":\"designing the solution\",\"impact-outcome\":\"impact & outcome\"};if(sectionLabels[id]){const headings=Array.from(document.querySelectorAll(\"h1,h2,h3,h4,h5,h6,p\")).filter(el=>{if(el.textContent?.trim().toLowerCase().replace(/\\\\s+/g,\" \")!==sectionLabels[id])return false;const rect=el.getBoundingClientRect();if(!el.getClientRects().length||rect.width<=0||rect.height<=0)return false;let parent=el;while(parent){const style=window.getComputedStyle(parent);if(style.position===\"fixed\"||style.visibility===\"hidden\"||style.display===\"none\")return false;parent=parent.parentElement;}return true;}).sort((a,b)=>a.getBoundingClientRect().top-b.getBoundingClientRect().top);if(headings[0])return headings[0];}const matches=Array.from(document.querySelectorAll(`[${ANCHOR_ATTR}=\"${id}\"]`)).map(measurableEl).filter(el=>Boolean(el));return matches.sort((a,b)=>a.getBoundingClientRect().top-b.getBoundingClientRect().top)[0]??null;}function scrollToSection(id,onImmediate){const target=findAnchor(id);if(target){const top=target.getBoundingClientRect().top+window.scrollY-100;// Mark this section active right away and hold it there — the\n// scroll listener would otherwise recompute the \"wrong\" active\n// section on every intermediate scroll event fired during the\n// smooth-scroll animation.\nonImmediate(id);clickLocked=true;if(lockTimer)clearTimeout(lockTimer);const distance=Math.abs(top-window.scrollY);const duration=Math.min(1500,Math.max(500,distance*.6));window.scrollTo({top,behavior:\"smooth\"});lockTimer=setTimeout(()=>{clickLocked=false;},duration);}}// If the user has scrolled (or bounced, e.g. rubber-banding on macOS/iOS)\n// to the bottom of the page, treat the LAST section as active outright.\n// The normal anchor-position math below can never \"arrive\" at the final\n// section if there isn't enough scrollable distance past its anchor for\n// scrollY + the lookahead offset to exceed its top.\nfunction isAtBottom(){const scrollHeight=document.documentElement.scrollHeight;const viewportBottom=window.scrollY+window.innerHeight;return viewportBottom>=scrollHeight-2;}// How far down the viewport a section's top has to reach before we\n// consider it \"the one you're looking at\". A small fixed pixel value\n// (e.g. 160px) is too strict for shorter sections that never get their\n// top edge that close to the very top of the screen — they can be\n// front-and-center on screen and still fail the check. Scaling with\n// viewport height means \"about a third of the way down the screen\",\n// which matches what a person actually perceives as the current section\n// regardless of how tall any individual section is.\nfunction lookaheadPx(){return Math.max(160,window.innerHeight*.35);}function getActiveSection(sectionIds){// Position, rather than the sidebar's order, determines the current section.\nconst sections=sectionIds.map(id=>{const el=findAnchor(id);return el?{id,top:el.getBoundingClientRect().top+window.scrollY}:null;}).filter(entry=>entry!==null).sort((a,b)=>a.top-b.top);if(window.scrollY<=2)return sectionIds[0];if(isAtBottom())return sections[sections.length-1]?.id??sectionIds[0];const readingLine=window.scrollY+Math.min(180,window.innerHeight*.25);let current=sectionIds[0];for(const section of sections){if(section.top<=readingLine)current=section.id;}return current;}function applyStyle(el,active){const color=active?ACTIVE_COLOR:INACTIVE_COLOR;const targets=[el,...Array.from(el.querySelectorAll(\"*\"))];targets.forEach(t=>{t.style.setProperty(\"color\",color,\"important\");});}// ==========================================\n// ATTACH THIS ONCE — to the Stack/Frame that\n// directly wraps all 6 nav items (the sidebar\n// list container itself, not the items inside it)\n// ==========================================\nexport function withNavList(Component){return makeNavList(Component,SECTION_IDS);}export function withGroundworkNavList(Component){return makeNavList(Component,[\"overview\",\"the-problem\",\"impact-outcome\",\"next-steps\"],true);}function makeNavList(Component,sectionIds,keyboardLinks=false){return /*#__PURE__*/forwardRef((props,ref)=>{const containerRef=useRef(null);useEffect(()=>{const container=containerRef.current;if(!container)return;// Direct children of the nav container, in DOM order.\n// We match them to the supplied section IDs by position, not by text,\n// so mismatched wording (e.g. \"Impact & Outcome\" vs\n// \"Outcome & Impact\") never breaks anything.\nconst items=Array.from(container.children);const cleanups=[];const applyActive=activeId=>{items.forEach((item,i)=>{if(sectionIds[i]){const isActive=sectionIds[i]===activeId;applyStyle(item,isActive);if(keyboardLinks){if(isActive)item.setAttribute(\"aria-current\",\"location\");else item.removeAttribute(\"aria-current\");}}});};items.forEach((item,i)=>{const sectionId=sectionIds[i];if(!sectionId)return;item.style.cursor=\"pointer\";const onClick=()=>scrollToSection(sectionId,applyActive);item.addEventListener(\"click\",onClick);cleanups.push(()=>item.removeEventListener(\"click\",onClick));if(keyboardLinks){item.tabIndex=0;item.setAttribute(\"role\",\"link\");const onKeyDown=event=>{if(event.key!==\"Enter\")return;event.preventDefault();onClick();};item.addEventListener(\"keydown\",onKeyDown);cleanups.push(()=>item.removeEventListener(\"keydown\",onKeyDown));}});const update=()=>{if(clickLocked)return;applyActive(getActiveSection(sectionIds));};window.addEventListener(\"scroll\",update,{passive:true});window.addEventListener(\"resize\",update);const observer=new ResizeObserver(update);observer.observe(document.body);cleanups.push(()=>{observer.disconnect();window.removeEventListener(\"resize\",update);});update();cleanups.push(()=>window.removeEventListener(\"scroll\",update));return()=>cleanups.forEach(fn=>fn());},[]);return /*#__PURE__*/_jsx(Component,{ref:containerRef,...props});});}// ==========================================\n// ATTACH ONE OF THESE PER CONTENT SECTION —\n// to the first block/heading of each section\n// on the actual page content.\n//\n// These do NOT forward a ref into the wrapped\n// component (some Framer components don't\n// support that cleanly, which crashed the\n// published build earlier). The wrapper div is\n// `display: contents`, so it adds no layout\n// box of its own — no extra spacing, no gap\n// impact inside Stacks — it's purely a marker\n// we can query for later.\n//\n// withAnchorAtAGlance is kept exported (and its\n// anchor still queryable) even though \"At a\n// Glance\" is no longer its own nav stop, in case\n// it's still wrapping a content section on any\n// of the pages using this file — removing the\n// export would break that section if so. It just\n// no longer participates in the nav highlight\n// mapping above.\n// ==========================================\nfunction makeAnchor(id){return function(Component){return function AnchorWrapper(props){return /*#__PURE__*/_jsx(\"div\",{\"data-cs-anchor\":id,style:{display:\"contents\"},children:/*#__PURE__*/_jsx(Component,{...props})});};};}export function withAnchorOverview(Component){return makeAnchor(\"overview\")(Component);}export function withAnchorAtAGlance(Component){return makeAnchor(\"at-a-glance\")(Component);}export function withAnchorTheProblem(Component){return makeAnchor(\"the-problem\")(Component);}export function withAnchorUserInsights(Component){return makeAnchor(\"user-insights\")(Component);}export function withAnchorDeepDive(Component){return makeAnchor(\"deep-dive\")(Component);}export function withAnchorImpactOutcome(Component){return makeAnchor(\"impact-outcome\")(Component);}export function withAnchorNextSteps(Component){return makeAnchor(\"next-steps\")(Component);}\nexport const __FramerMetadata__ = {\"exports\":{\"withAnchorOverview\":{\"type\":\"reactHoc\",\"name\":\"withAnchorOverview\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withGroundworkNavList\":{\"type\":\"reactHoc\",\"name\":\"withGroundworkNavList\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAnchorNextSteps\":{\"type\":\"reactHoc\",\"name\":\"withAnchorNextSteps\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAnchorDeepDive\":{\"type\":\"reactHoc\",\"name\":\"withAnchorDeepDive\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAnchorAtAGlance\":{\"type\":\"reactHoc\",\"name\":\"withAnchorAtAGlance\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAnchorImpactOutcome\":{\"type\":\"reactHoc\",\"name\":\"withAnchorImpactOutcome\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAnchorTheProblem\":{\"type\":\"reactHoc\",\"name\":\"withAnchorTheProblem\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withNavList\":{\"type\":\"reactHoc\",\"name\":\"withNavList\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAnchorUserInsights\":{\"type\":\"reactHoc\",\"name\":\"withAnchorUserInsights\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CaseStudyNav.map"],"mappings":"A,8IAsBA,SAASa,EAAaC,EAAQ,CAAC,GAAGP,EAAO,iBAAiBO,CAAO,CAAC,CAAC,UAAU,OAAO,OAAO,KAAK,IAAMC,EAAKD,EAAQ,sBAAsB,EAAE,GAAGA,EAAQ,eAAe,CAAC,CAAC,QAAQC,EAAK,MAAM,GAAGA,EAAK,OAAO,EAAE,OAAOD,EAAQ,IAAI,IAAME,KAAS,MAAM,KAAKF,EAAQ,QAAQ,EAAE,CAAC,IAAMG,EAAIJ,EAAaG,CAAK,EAAE,GAAGC,EAAI,OAAOA,CAAI,CAAC,OAAO,IAAK,CAAC,SAASC,EAAWC,EAAG,CAGhW,IAAMC,EAAc,CAAC,cAAc,cAAc,gBAAgB,gBAAgB,YAAY,yBAAyB,iBAAiB,kBAAkB,EAAE,GAAGA,EAAcD,GAAI,CAAC,IAAME,EAAS,MAAM,KAAK,SAAS,iBAAiB,qBAAqB,CAAC,CAAC,CAAC,OAAOC,GAAI,CAAC,GAAGA,EAAG,aAAa,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,QAAQ,GAAG,IAAIF,EAAcD,GAAI,MAAO,GAAM,IAAMJ,EAAKO,EAAG,sBAAsB,EAAE,GAAG,CAACA,EAAG,eAAe,CAAC,CAAC,QAAQP,EAAK,OAAO,GAAGA,EAAK,QAAQ,EAAE,MAAO,G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