{"version":3,"file":"TableOfContents.B0cO9zbT.mjs","names":["useState","__esmMin","init_ssg_sandbox_shims","init_npm_react_18_3_1","te","window","ce","init_jsx_runtime","p","_e","addPropertyControls","init_framer_BWFVvmND","ControlType","TableOfContents","props","activeId","setActiveId","tocItems","setTocItems","scanHeadings","contentContainer","headings","items","level","heading","text","id","index","timer","observer","contentLayer","headingElements","item","entries","entry","handleClick","element","minLevel","showBorder","borderColor","textColor","titleFont","title","indentSize","e","activeColor","itemFont","init_TableOfContents"],"sources":["https:/framerusercontent.com/modules/izkketfJTCCUNzzn0aT0/C7pK0dmdjyhEFbWNCyRk/TableOfContents.js"],"sourcesContent":["// Table of Contents component for blog posts - automatically generates navigation from headings\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Table of Contents\n *\n * @framerIntrinsicWidth 300\n * @framerIntrinsicHeight 400\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function TableOfContents(props){const{contentLayer,title,backgroundColor,textColor,activeColor,borderRadius,padding,showBorder,borderColor,titleFont,itemFont,indentSize}=props;const[activeId,setActiveId]=useState(\"\");const[tocItems,setTocItems]=useState([]);// Scan for headings in the rendered content\nuseEffect(()=>{if(typeof window===\"undefined\")return;const scanHeadings=()=>{// Find the TOC component first\nconst tocComponent=document.querySelector(\"[data-toc-component]\");if(!tocComponent)return;// Find the contentLayer within the TOC component\n// It should be a direct child or nearby sibling that was passed as contentLayer prop\nlet contentContainer=null;// Try to find a container with data-framer-name=\"Blog Content\" or similar\nconst blogContent=document.querySelector('[data-framer-name=\"Blog Content\"]');if(blogContent){contentContainer=blogContent;}else{// Fallback: look for the Content layer\ncontentContainer=document.querySelector('[data-framer-name=\"Content\"]');}if(!contentContainer)return;const headings=contentContainer.querySelectorAll(\"h1, h2, h3, h4, h5, h6\");const items=[];headings.forEach((heading,index)=>{const level=parseInt(heading.tagName.substring(1));const text=heading.textContent||\"\";const id=heading.id||`heading-${index}`;// Assign ID if not present\nif(!heading.id){heading.id=id;}items.push({id,text,level});});startTransition(()=>setTocItems(items));};// Initial scan\nscanHeadings();// Rescan after a short delay to catch dynamically loaded content\nconst timer=setTimeout(scanHeadings,500);// Set up a MutationObserver to detect content changes\nconst observer=new MutationObserver(scanHeadings);observer.observe(document.body,{childList:true,subtree:true});return()=>{clearTimeout(timer);observer.disconnect();};},[contentLayer]);useEffect(()=>{if(typeof window===\"undefined\"||tocItems.length===0)return;const headingElements=tocItems.map(item=>document.getElementById(item.id)).filter(Boolean);const observer=new IntersectionObserver(entries=>{entries.forEach(entry=>{if(entry.isIntersecting){startTransition(()=>setActiveId(entry.target.id));}});},{rootMargin:\"-20% 0px -80% 0px\"});headingElements.forEach(heading=>{if(heading)observer.observe(heading);});return()=>observer.disconnect();},[tocItems]);const handleClick=id=>{if(typeof window===\"undefined\")return;const element=document.getElementById(id);if(element){element.scrollIntoView({behavior:\"smooth\",block:\"start\"});}};const minLevel=tocItems.length>0?Math.min(...tocItems.map(item=>item.level)):1;return /*#__PURE__*/_jsxs(\"div\",{\"data-toc-component\":true,style:{...props.style,position:\"relative\",backgroundColor,borderRadius,padding,border:showBorder?`1px solid ${borderColor}`:\"none\",overflow:\"auto\"},children:[/*#__PURE__*/_jsx(\"h3\",{style:{margin:0,marginBottom:16,color:textColor,...titleFont},children:title}),/*#__PURE__*/_jsx(\"nav\",{children:/*#__PURE__*/_jsx(\"ul\",{style:{listStyle:\"none\",margin:0,padding:0},children:tocItems.map(item=>/*#__PURE__*/_jsx(\"li\",{style:{marginBottom:8,paddingLeft:(item.level-minLevel)*indentSize},children:/*#__PURE__*/_jsx(\"a\",{href:`#${item.id}`,onClick:e=>{e.preventDefault();handleClick(item.id);},style:{color:activeId===item.id?activeColor:textColor,textDecoration:\"none\",cursor:\"pointer\",display:\"block\",transition:\"color 0.2s ease\",opacity:activeId===item.id?1:.7,fontWeight:activeId===item.id?600:400,...itemFont},onMouseEnter:e=>{e.currentTarget.style.color=activeColor;},onMouseLeave:e=>{e.currentTarget.style.color=activeId===item.id?activeColor:textColor;},children:item.text})},item.id))})})]});}addPropertyControls(TableOfContents,{contentLayer:{type:ControlType.ComponentInstance,title:\"Content Layer\"},title:{type:ControlType.String,title:\"Title\",defaultValue:\"Table of Contents\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#F5F5F5\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},activeColor:{type:ControlType.Color,title:\"Active Color\",defaultValue:\"#0099FF\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:32,step:1,unit:\"px\"},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:20,min:0,max:60,step:4,unit:\"px\"},showBorder:{type:ControlType.Boolean,title:\"Border\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#EEEEEE\",hidden:({showBorder})=>!showBorder},titleFont:{type:ControlType.Font,title:\"Title Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"22px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"}},itemFont:{type:ControlType.Font,title:\"Item Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"}},indentSize:{type:ControlType.Number,title:\"Indent Size\",defaultValue:16,min:0,max:40,step:4,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TableOfContents\",\"slots\":[\"contentLayer\"],\"annotations\":{\"framerIntrinsicHeight\":\"400\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\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