{"version":3,"file":"HighlightLinesIn.C7D_1nZw.mjs","names":["useRef","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","c","J","init_jsx_runtime","ce","de","init_framer_DymZktPS","RenderTarget","withHighlightLinesIn","highlightLines","Component","withHighlightWipe","ref","root","blocks","b","rt","reduce","animate","texts","played","lastWidths","cancelled","styleBox","el","CREAM","BOX_HEIGHT","PADDING","WINE","build","block","run","words","text","s","w","i","lines","top","ml","mr","lineMargins","line","play","mode","delay","WIPE_STAGGER_S","WIPE_S","EASE","TEXT_DELAY_S","TRAVEL_PX","STAGGER_S","DURATION_S","layout","frame","ro","io","start","entries","fonts","node","forwardedRef","props","init_HighlightLinesIn","align"],"sources":["https:/framerusercontent.com/modules/tcqf2H30nRVCnHMrqLkN/wqWvoTqJ9qkcIgs6CZIv/HighlightLinesIn.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef}from\"react\";import{RenderTarget}from\"framer\";// HighlightText's cream boxes, one per wrapped line, in two entrances that pages\n// alternate between (Keith, Oct 5):\n// - withHighlightLinesIn: lines slide in from alternating sides and meet, like the\n//   homepage \"Our team brings…\" statement.\n// - withHighlightWipe: each box wipes in left to right, line after line, and the\n//   words appear once their box has passed.\n// Both play once when the heading comes into view (time-based, not scroll-scrubbed).\n// The layer keeps its own tag, so a heading stays an H1.\nconst CREAM=\"rgb(250, 247, 240)\";const WINE=\"rgb(78, 11, 18)\";// Each line is its own block, so the box is a share of the line height; 91% with\n// no vertical padding matches HighlightText's inline boxes (checked at 1440).\nconst BOX_HEIGHT=\"91%\";const PADDING=\"0 0.22em\";const TRAVEL_PX=260;const DURATION_S=.9;const STAGGER_S=.12;const EASE=\"cubic-bezier(0.22, 1, 0.36, 1)\";const WIPE_S=.75;const WIPE_STAGGER_S=.28;const TEXT_DELAY_S=.45;const lineMargins=align=>align===\"center\"?[\"auto\",\"auto\"]:align===\"right\"||align===\"end\"?[\"auto\",\"0\"]:[\"0\",\"auto\"];export function withHighlightLinesIn(Component){return highlightLines(Component,\"collide\");}export function withHighlightWipe(Component){return highlightLines(Component,\"wipe\");}function highlightLines(Component,mode){return /*#__PURE__*/forwardRef((props,forwardedRef)=>{const ref=useRef(null);const setRef=node=>{ref.current=node;if(typeof forwardedRef===\"function\")forwardedRef(node);else if(forwardedRef)forwardedRef.current=node;};useEffect(()=>{const root=ref.current;if(!root)return;const blocks=Array.from(root.querySelectorAll(\"h1, h2, h3, h4, h5, h6, p\")).filter(b=>b.dataset.highlightReady!==\"true\"&&b.textContent?.trim());if(!blocks.length)return;const rt=RenderTarget.current();const reduce=window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches;const animate=rt===RenderTarget.preview&&!reduce;const texts=blocks.map(b=>(b.textContent||\"\").replace(/\\s+/g,\" \").trim());let played=!animate;let lastWidths=blocks.map(()=>-1);let cancelled=false;blocks.forEach(b=>{b.dataset.highlightReady=\"true\";if(animate)b.style.opacity=\"0\";});const styleBox=el=>Object.assign(el.style,{backgroundImage:`linear-gradient(${CREAM}, ${CREAM})`,backgroundRepeat:\"no-repeat\",backgroundPosition:\"0 50%\",backgroundSize:`100% ${BOX_HEIGHT}`,padding:PADDING,color:WINE});// Lay the words out once as a normal wrapped run to find where the\n// browser breaks the lines, then rebuild each line as its own box.\nconst build=(block,text)=>{block.replaceChildren();const run=document.createElement(\"span\");Object.assign(run.style,{padding:PADDING,boxDecorationBreak:\"clone\"});run.style.setProperty(\"-webkit-box-decoration-break\",\"clone\");const words=text.split(\" \").map((w,i)=>{const s=document.createElement(\"span\");s.textContent=w;if(i)run.appendChild(document.createTextNode(\" \"));run.appendChild(s);return s;});block.appendChild(run);const lines=[];let top=Number.NaN;for(const w of words){const t=Math.round(w.getBoundingClientRect().top);if(Number.isNaN(top)||Math.abs(t-top)>2)lines.push([]);top=t;lines[lines.length-1].push(w.textContent||\"\");}const[ml,mr]=lineMargins(getComputedStyle(block).textAlign);block.replaceChildren();return lines.map(words=>{const line=document.createElement(\"span\");line.textContent=words.join(\" \");styleBox(line);Object.assign(line.style,{display:\"block\",width:\"fit-content\",whiteSpace:\"nowrap\",marginLeft:ml,marginRight:mr});block.appendChild(line);return line;});};const play=lines=>{if(mode===\"wipe\"){lines.forEach(line=>{line.style.backgroundSize=`0% ${BOX_HEIGHT}`;line.style.color=\"transparent\";});requestAnimationFrame(()=>requestAnimationFrame(()=>lines.forEach((line,i)=>{const delay=i*WIPE_STAGGER_S;line.style.transition=`background-size ${WIPE_S}s ${EASE} ${delay}s, color 0.35s ease ${delay+TEXT_DELAY_S}s`;line.style.backgroundSize=`100% ${BOX_HEIGHT}`;line.style.color=WINE;})));return;}lines.forEach((line,i)=>{line.style.opacity=\"0\";line.style.transform=`translate3d(${(i%2===0?-1:1)*TRAVEL_PX}px, 0, 0)`;});requestAnimationFrame(()=>requestAnimationFrame(()=>lines.forEach((line,i)=>{const delay=i*STAGGER_S;line.style.transition=`transform ${DURATION_S}s ${EASE} ${delay}s, opacity ${DURATION_S*.7}s ease ${delay}s`;line.style.opacity=\"1\";line.style.transform=\"translate3d(0, 0, 0)\";})));};const layout=()=>{if(cancelled)return;blocks.forEach((block,i)=>{const w=Math.round(block.getBoundingClientRect().width);if(w===lastWidths[i])return;lastWidths[i]=w;build(block,texts[i]);});};let frame=0;const ro=new ResizeObserver(()=>{cancelAnimationFrame(frame);frame=requestAnimationFrame(layout);});let io=null;const start=()=>{if(cancelled)return;layout();blocks.forEach(b=>ro.observe(b));if(played){blocks.forEach(b=>b.style.opacity=\"\");return;}io=new IntersectionObserver(entries=>{if(!entries.some(e=>e.isIntersecting))return;io?.disconnect();played=true;blocks.forEach(b=>{b.style.opacity=\"\";play(Array.from(b.children));});},{threshold:.2});io.observe(root);};// Line breaks depend on the display font, so wait for it.\nconst fonts=document.fonts;if(fonts?.ready)fonts.ready.then(start);else start();return()=>{cancelled=true;cancelAnimationFrame(frame);ro.disconnect();io?.disconnect();blocks.forEach(b=>b.style.opacity=\"\");};},[]);return /*#__PURE__*/_jsx(Component,{ref:setRef,...props});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withHighlightLinesIn\":{\"type\":\"reactHoc\",\"name\":\"withHighlightLinesIn\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHighlightWipe\":{\"type\":\"reactHoc\",\"name\":\"withHighlightWipe\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HighlightLinesIn.map"],"mappings":"A,gMAU4U,SAAgBY,EAAqB,EAAU,CAAC,OAAOC,EAAeC,EAAU,SAAS,CAAE,CAAC,SAAgBC,EAAkB,EAAU,CAAC,OAAOF,EAAeC,EAAU,MAAM,CAAE,CAAC,SAASD,EAAe,EAAU,EAAK,CAAC,MAAoB,iBAAY,EAAM,IAAe,CAAC,IAAMG,EAAIhB,EAAO,IAAI,EAG5Z,OAH2iBQ,MAAc,CAAC,IAAMS,EAAKD,EAAI,QAAQ,GAAG,CAACC,EAAK,OAAO,IAAMC,EAAO,MAAM,KAAKD,EAAK,iBAAiB,2BAA2B,CAAC,CAAC,CAAC,OAAO,GAAGE,EAAE,QAAQ,iBAAiB,QAAQA,EAAE,aAAa,KAAK,CAAC,EAAE,GAAG,CAACD,EAAO,OAAO,OAAO,IAAME,EAAGT,EAAa,QAAQ,EAAQU,EAAOjB,EAAO,aAAa,kCAAkC,CAAC,CAAC,QAAckB,EAAQF,IAAKT,EAAa,SAAS,CAACU,EAAaE,EAAML,EAAO,IAAI,IAAIC,EAAE,aAAa,GAAA,CAAI,QAAQ,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,EAAMK,EAAO,CAACF,EAAYG,EAAWP,EAAO,QAAQ,EAAE,EAAMQ,EAAU,GAAMR,EAAO,QAAQ,GAAG,CAAC,EAAE,QAAQ,eAAe,OAAUI,IAAQ,EAAE,MAAM,QAAQ,IAAI,CAAC,EAAE,IAAMK,EAAS,GAAI,OAAO,OAAOC,EAAG,MAAM,CAAC,gBA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