{"version":3,"file":"TableOfContents.C0-WvClb.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/wwrLgryLVtn0D9S6Pivf/BEwJKqt8WqBy8vjFA9gv/TableOfContents.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion}from\"framer-motion\";/**\n * Table of Contents\n *\n * Automatically detects H2 headings on the page and creates\n * a navigation menu with smooth scrolling to each section.\n *\n * @framerIntrinsicWidth 280\n * @framerIntrinsicHeight 300\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function TableOfContents(props){const{title=\"On this page\",showIcon=true,iconColor=\"#666666\",titleFont,titleColor=\"#000000\",itemFont,itemColor=\"#666666\",activeItemColor=\"#000000\",lineColor=\"#E5E5E5\",activeIndicatorColor=\"#000000\",spacing=16,itemSpacing=12,leftPadding=16,topPadding=16,bottomPadding=16,rightPadding=16,showActiveIndicator=true,activeIndicatorWidth=3,smoothScroll=true,offset=100}=props;const[headings,setHeadings]=useState([]);const[activeId,setActiveId]=useState(\"\");const containerRef=useRef(null);// Detect H2 headings on the page\nuseEffect(()=>{if(typeof document===\"undefined\")return;const detectHeadings=()=>{const h2Elements=document.querySelectorAll(\"h2\");const detectedHeadings=Array.from(h2Elements).filter(h2=>h2.id||h2.textContent).map((h2,index)=>{// Assign ID if not present\nif(!h2.id){h2.id=`toc-heading-${index}`;}return{id:h2.id,text:h2.textContent||`Section ${index+1}`};});startTransition(()=>setHeadings(detectedHeadings));};// Initial detection\ndetectHeadings();// Re-detect when DOM changes\nconst observer=new MutationObserver(detectHeadings);observer.observe(document.body,{childList:true,subtree:true});return()=>observer.disconnect();},[]);// Track active heading based on scroll position\nuseEffect(()=>{if(typeof window===\"undefined\"||headings.length===0)return;const handleScroll=()=>{const scrollPosition=window.scrollY+offset;for(let i=headings.length-1;i>=0;i--){const element=document.getElementById(headings[i].id);if(element){const elementTop=element.offsetTop;if(elementTop<=scrollPosition){startTransition(()=>setActiveId(headings[i].id));return;}}}if(headings.length>0){startTransition(()=>setActiveId(headings[0].id));}};window.addEventListener(\"scroll\",handleScroll,{passive:true});handleScroll();return()=>window.removeEventListener(\"scroll\",handleScroll);},[headings,offset]);const handleClick=id=>{const element=document.getElementById(id);if(element){const top=element.offsetTop-offset;window.scrollTo({top,behavior:smoothScroll?\"smooth\":\"auto\"});}};const containerStyle={width:\"100%\",height:\"100%\",display:\"flex\",flexDirection:\"column\",paddingLeft:leftPadding,paddingTop:topPadding,paddingBottom:bottomPadding,paddingRight:rightPadding,boxSizing:\"border-box\",overflow:\"auto\"};const headerStyle={display:\"flex\",alignItems:\"center\",gap:8,marginBottom:spacing,color:titleColor,...titleFont};const listStyle={display:\"flex\",flexDirection:\"column\",gap:itemSpacing,position:\"relative\",paddingLeft:showActiveIndicator?16:0};const lineStyle={position:\"absolute\",left:0,top:0,bottom:0,width:2,backgroundColor:lineColor};return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:containerStyle,children:[/*#__PURE__*/_jsxs(\"div\",{style:headerStyle,children:[showIcon&&/*#__PURE__*/_jsxs(\"svg\",{width:\"16\",height:\"16\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:iconColor,strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:[/*#__PURE__*/_jsx(\"line\",{x1:\"4\",y1:\"6\",x2:\"20\",y2:\"6\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"4\",y1:\"12\",x2:\"20\",y2:\"12\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"4\",y1:\"18\",x2:\"20\",y2:\"18\"})]}),/*#__PURE__*/_jsx(\"span\",{children:title})]}),/*#__PURE__*/_jsxs(\"div\",{style:listStyle,children:[showActiveIndicator&&/*#__PURE__*/_jsx(\"div\",{style:lineStyle}),headings.map(heading=>{const isActive=heading.id===activeId;return /*#__PURE__*/_jsxs(\"button\",{onClick:()=>handleClick(heading.id),style:{position:\"relative\",background:\"none\",border:\"none\",padding:0,textAlign:\"left\",cursor:\"pointer\",color:isActive?activeItemColor:itemColor,transition:\"color 0.2s ease\",...itemFont},children:[showActiveIndicator&&isActive&&/*#__PURE__*/_jsx(motion.div,{layoutId:\"activeIndicator\",style:{position:\"absolute\",left:-16,top:\"50%\",transform:\"translateY(-50%)\",width:activeIndicatorWidth,height:\"100%\",backgroundColor:activeIndicatorColor,borderRadius:activeIndicatorWidth/2},transition:{duration:.2}}),/*#__PURE__*/_jsx(\"span\",{children:heading.text})]},heading.id);}),headings.length===0&&/*#__PURE__*/_jsx(\"span\",{style:{color:itemColor,opacity:.5,...itemFont},children:\"No H2 headings found\"})]})]});}addPropertyControls(TableOfContents,{title:{type:ControlType.String,title:\"Title\",defaultValue:\"On this page\"},showIcon:{type:ControlType.Boolean,title:\"Show Icon\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},iconColor:{type:ControlType.Color,title:\"Icon Color\",defaultValue:\"#666666\",hidden:({showIcon})=>!showIcon},titleFont:{type:ControlType.Font,title:\"Title Font\",defaultValue:{fontSize:\"14px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.4em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},titleColor:{type:ControlType.Color,title:\"Title Color\",defaultValue:\"#000000\"},itemFont:{type:ControlType.Font,title:\"Item Font\",defaultValue:{fontSize:\"14px\",variant:\"Regular\",letterSpacing:\"-0.01em\",lineHeight:\"1.5em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},itemColor:{type:ControlType.Color,title:\"Item Color\",defaultValue:\"#666666\"},activeItemColor:{type:ControlType.Color,title:\"Active Item Color\",defaultValue:\"#000000\"},showActiveIndicator:{type:ControlType.Boolean,title:\"Active Indicator\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},activeIndicatorColor:{type:ControlType.Color,title:\"Indicator Color\",defaultValue:\"#000000\",hidden:({showActiveIndicator})=>!showActiveIndicator},activeIndicatorWidth:{type:ControlType.Number,title:\"Indicator Width\",defaultValue:3,min:1,max:10,step:1,unit:\"px\",hidden:({showActiveIndicator})=>!showActiveIndicator},lineColor:{type:ControlType.Color,title:\"Line Color\",defaultValue:\"#E5E5E5\",hidden:({showActiveIndicator})=>!showActiveIndicator},smoothScroll:{type:ControlType.Boolean,title:\"Smooth Scroll\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},offset:{type:ControlType.Number,title:\"Scroll Offset\",defaultValue:100,min:0,max:500,step:10,unit:\"px\"},spacing:{type:ControlType.Number,title:\"Title Spacing\",defaultValue:16,min:0,max:64,step:4,unit:\"px\"},itemSpacing:{type:ControlType.Number,title:\"Item Spacing\",defaultValue:12,min:0,max:48,step:4,unit:\"px\"},leftPadding:{type:ControlType.Number,title:\"Left Padding\",defaultValue:16,min:0,max:64,step:4,unit:\"px\"},topPadding:{type:ControlType.Number,title:\"Top Padding\",defaultValue:16,min:0,max:64,step:4,unit:\"px\"},bottomPadding:{type:ControlType.Number,title:\"Bottom Padding\",defaultValue:16,min:0,max:64,step:4,unit:\"px\"},rightPadding:{type:ControlType.Number,title:\"Right Padding\",defaultValue:16,min:0,max:64,step:4,unit:\"px\"}});TableOfContents.displayName=\"Table of Contents\";\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TableOfContents\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"300\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"280\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TableOfContents.map"],"mappings":"qQAWG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,QAAM,eAAe,WAAS,GAAK,YAAU,UAAU,YAAU,aAAW,UAAU,WAAS,YAAU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