{"version":3,"file":"DynamicStepTOC.CPLX-ZRB.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/Id8ay8HL3Y6pEZBdplAY/l76AQm1E8spC12HZiZ9H/DynamicStepTOC.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{addPropertyControls}from\"framer\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function DynamicStepTOC(props){const[headings,setHeadings]=useState([]);const[activeIndex,setActiveIndex]=useState(-1);const[suppressObserver,setSuppressObserver]=useState(false);useEffect(()=>{const seen=new Set;const h3s=Array.from(document.querySelectorAll(\"h3\")).filter(h3=>{const text=h3.textContent?.trim();if(!text||seen.has(text))return false;seen.add(text);return true;}).map((h3,index)=>{const id=h3.id||h3.textContent?.trim().toLowerCase().replace(/\\s+/g,\"-\")||`heading-${index}`;h3.id=id;return{id,text:h3.textContent||\"\",index};});setHeadings(h3s);},[]);useEffect(()=>{if(headings.length===0)return;const observer=new IntersectionObserver(entries=>{if(suppressObserver)return;const visible=entries.filter(e=>e.isIntersecting).sort((a,b)=>a.boundingClientRect.top-b.boundingClientRect.top);if(visible.length>0){const topEntry=visible[0];const idx=headings.findIndex(h=>h.id===topEntry.target.id);if(idx!==-1)setActiveIndex(idx);}},{rootMargin:\"0px 0px -60% 0px\",threshold:0});headings.forEach(h=>{const el=document.getElementById(h.id);if(el)observer.observe(el);});return()=>observer.disconnect();},[headings,suppressObserver]);const scrollToHeading=id=>{const el=document.getElementById(id);const idx=headings.findIndex(h=>h.id===id);if(el&&idx!==-1){setSuppressObserver(true);setActiveIndex(idx);const yOffset=-80;const y=el.getBoundingClientRect().top+window.pageYOffset+yOffset;window.scrollTo({top:y,behavior:\"smooth\"});let scrollCheckFrame;let previousY=window.scrollY;let sameCount=0;const checkScrollEnd=()=>{const currentY=window.scrollY;if(currentY===previousY){sameCount++;if(sameCount>5){setSuppressObserver(false);cancelAnimationFrame(scrollCheckFrame);return;}}else{sameCount=0;}previousY=currentY;scrollCheckFrame=requestAnimationFrame(checkScrollEnd);};scrollCheckFrame=requestAnimationFrame(checkScrollEnd);}};return /*#__PURE__*/_jsx(\"div\",{style:{...props.style,display:\"flex\",flexDirection:\"column\",gap:16},children:headings.map((h,i)=>{const isActive=i===activeIndex;return /*#__PURE__*/_jsxs(\"div\",{onClick:()=>scrollToHeading(h.id),style:{cursor:\"pointer\",display:\"flex\",alignItems:\"center\",gap:12},children:[/*#__PURE__*/_jsx(\"div\",{style:{width:28,minWidth:28,height:28,borderRadius:\"50%\",backgroundColor:isActive?\"#603CF1\":\"#EBEBEB\",color:isActive?\"#FFFFFF\":\"#6F6F73\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",fontSize:14,fontWeight:500,fontFamily:\"Inter, sans-serif\"},children:i+1}),/*#__PURE__*/_jsx(\"div\",{style:{fontFamily:\"Inter, sans-serif\",fontWeight:500,fontSize:14,lineHeight:\"20px\",color:isActive?\"#202024\":\"#6F6F73\"},children:h.text})]},h.id);})});}DynamicStepTOC.displayName=\"Dynamic Step TOC\";addPropertyControls(DynamicStepTOC,{});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DynamicStepTOC\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DynamicStepTOC.map"],"mappings":"wSAGG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,EAAS,GAAaA,EAAS,EAAE,CAAC,CAAM,CAAC,EAAY,GAAgBA,EAAS,GAAG,CAAM,CAAC,EAAiB,GAAqBA,EAAS,GAAM,CAAC,MAAc,CAAC,IAAM,EAAK,IAAI,IAAU,EAAI,MAAM,KAAK,SAAS,iBAAiB,KAAK,CAAC,CAAC,OAAO,GAAI,CAAC,IAAM,EAA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