{"version":3,"file":"TableOfContents.DtpBbQLF.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/g6dFjDeCxP4ptD7fcAuH/Xsz61JnLBeHb5m6ZbWnY/TableOfContents.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion}from\"framer-motion\";export function TableOfContents(props){const[headings,setHeadings]=useState([]);const[activeId,setActiveId]=useState(\"\");const[isHovered,setIsHovered]=useState(false);useEffect(()=>{const parsedHeadings=parseHeadings(props.content);setHeadings(parsedHeadings);const handleScroll=()=>{const headingElements=headings.map(({id})=>document.getElementById(id)).filter(Boolean);const headingPositions=headingElements.map(el=>({id:el.id,top:el.getBoundingClientRect().top}));const activeHeading=headingPositions.find(({top})=>top>=0)||headingPositions[headingPositions.length-1];if(activeHeading){setActiveId(activeHeading.id);}};window.addEventListener(\"scroll\",handleScroll);return()=>window.removeEventListener(\"scroll\",handleScroll);},[props.content,headings]);const parseHeadings=content=>{const cleanContent=content.trim().replace(RegExp(\"^[\\\"'](.*)[\\\"']$\",\"s\"),\"$1\").replace(/\\\\\"/g,'\"');const lines=cleanContent.split(\"\\n\");return lines.filter(line=>line.trim().startsWith(\"## \")||line.trim().startsWith(\"# \")).map(line=>{const trimmedLine=line.trim();const level=trimmedLine.startsWith(\"## \")?2:1;const text=trimmedLine.replace(/^#+\\s/,\"\");const id=generateId(text);return{level,text,id};});};const generateId=text=>{return text.toLowerCase().replace(/[^\\w\\s-]/g,\"\").replace(/\\s+/g,\"-\").replace(/-+/g,\"-\").trim();};const handleClick=id=>{const element=document.getElementById(id);if(element){element.scrollIntoView({behavior:\"smooth\"});window.history.pushState(null,\"\",`#${id}`);}};return /*#__PURE__*/_jsxs(motion.nav,{style:tocStyle,animate:{width:isHovered?\"320px\":\"32px\",backgroundColor:isHovered?\"rgba(23, 23, 28, 0.95)\":\"rgba(23, 23, 28, 0.7)\"},transition:{duration:.3},onHoverStart:()=>setIsHovered(true),onHoverEnd:()=>setIsHovered(false),initial:false,children:[/*#__PURE__*/_jsx(motion.div,{style:tocTabStyle,animate:{opacity:isHovered?0:1},children:\"☰\"}),/*#__PURE__*/_jsxs(motion.div,{style:tocInnerStyle,animate:{opacity:isHovered?1:0,x:isHovered?0:20},children:[/*#__PURE__*/_jsx(\"h2\",{style:tocHeaderStyle,children:\"On this page\"}),/*#__PURE__*/_jsx(\"ul\",{style:tocListStyle,children:headings.map((heading,index)=>/*#__PURE__*/_jsx(\"li\",{style:{...tocItemStyle,marginLeft:`${(heading.level-1)*16}px`},children:/*#__PURE__*/_jsx(\"a\",{href:`#${heading.id}`,onClick:e=>{e.preventDefault();handleClick(heading.id);},style:{...tocLinkStyle,...activeId===heading.id?tocLinkActiveStyle:{}},children:heading.text})},index))})]})]});}// Setup for Framer\nTableOfContents.defaultProps={content:\"\"};addPropertyControls(TableOfContents,{content:{type:ControlType.String,title:\"Article Content\",displayTextArea:true}});// Styles\nconst tocStyle={// position: \"fixed\",\n// top: \"120px\", // Start below the header\n// right: \"0\",\n// height: \"auto\",\n// maxHeight: \"calc(100vh - 160px)\", // Account for top and bottom margins\nwidth:\"60px\",backgroundColor:\"rgba(23, 23, 28, 0.7)\",backdropFilter:\"blur(12px)\",WebkitBackdropFilter:\"blur(12px)\",borderRadius:\"12px 0 0 12px\",border:\"1px solid rgba(255, 255, 255, 0.08)\",boxShadow:\"0 4px 6px -1px rgba(0, 0, 0, 0.1)\",overflow:\"hidden\",zIndex:1e3,cursor:\"pointer\"};const tocTabStyle={position:\"absolute\",top:\"50%\",left:\"50%\",transform:\"translate(-50%, -50%)\",color:\"rgba(255, 255, 255, 0.8)\",fontSize:\"20px\"};const tocInnerStyle={padding:\"20px\",height:\"100%\",maxHeight:\"80vh\",overflowY:\"auto\",scrollbarWidth:\"thin\",scrollbarColor:\"rgba(255, 255, 255, 0.1) transparent\",\"&::-webkit-scrollbar\":{width:\"4px\"},\"&::-webkit-scrollbar-track\":{background:\"transparent\"},\"&::-webkit-scrollbar-thumb\":{background:\"rgba(255, 255, 255, 0.1)\",borderRadius:\"4px\"}};const tocHeaderStyle={fontSize:\"14px\",fontWeight:\"500\",color:\"rgba(255, 255, 255, 0.6)\",textTransform:\"uppercase\",letterSpacing:\"0.05em\",marginBottom:\"16px\",whiteSpace:\"nowrap\"};const tocListStyle={listStyleType:\"none\",padding:\"0\",margin:0};const tocItemStyle={margin:\"4px 0\"};const tocLinkStyle={display:\"block\",textDecoration:\"none\",color:\"rgba(255, 255, 255, 0.8)\",fontSize:\"14px\",lineHeight:\"1.4\",padding:\"6px 8px\",borderRadius:\"6px\",transition:\"all 0.2s ease\",whiteSpace:\"nowrap\",overflow:\"hidden\",textOverflow:\"ellipsis\",\"&:hover\":{backgroundColor:\"rgba(255, 255, 255, 0.06)\",color:\"rgba(255, 255, 255, 1)\"}};const tocLinkActiveStyle={backgroundColor:\"rgba(255, 255, 255, 0.1)\",color:\"rgba(255, 255, 255, 1)\",fontWeight:\"500\"};\nexport const __FramerMetadata__ = {\"exports\":{\"TableOfContents\":{\"type\":\"reactComponent\",\"name\":\"TableOfContents\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TableOfContents.map"],"mappings":"yYAAqL,SAAgB,EAAgB,EAAM,CAAC,GAAK,CAAC,EAAS,GAAaA,EAAS,EAAE,CAAC,CAAM,CAAC,EAAS,GAAaA,EAAS,GAAG,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAC,MAAc,CAAC,IAAM,EAAe,EAAc,EAAM,QAAQ,CAAC,EAAY,EAAe,CAAC,IAAM,MAAiB,CAAyF,IAAM,EAAxE,EAAS,KAAK,CAAC,QAAM,SAAS,eAAe,EAAG,CAAC,CAAC,OAAO,QAAQ,CAAwC,IAAI,IAAK,CAAC,GAAG,EAAG,GAAG,IAAI,EAAG,uBAAuB,CAAC,IAAI,EAAE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