{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/p7xgmWsv4GfiypfEKvAZ/GMYxSnh6jJI9ZxA0GT5D/Table_Of_Contents.js"],
  "sourcesContent": ["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{useEffect,useState}from\"react\";const HEADING_TO_DISPLAY=[\"h3\",\"h2\",\"h1\"];const SCROLL_MARGIN_TOP=120;// \u2705 ADJUSTABLE GAPS:\nconst H2_GAP=16// <---- Gap after H2\n;const H3_GAP=0// <---- Gap after H3\n;const H2_AFTER_H3_GAP=H2_GAP// <---- Gap if H3 followed by H2\n;const useStore=createStore({headings:[]});// \uD83D\uDFE1 OVERRIDE 1: TABLE OF CONTENTS\nexport function withTableOfContent(Component){return props=>{const[store]=useStore();const[activeSection,setActiveSection]=useState(\"\");const scrollToId=id=>{const element=document.getElementById(id);if(element){element.scrollIntoView({behavior:\"smooth\"});}};useEffect(()=>{const handleScroll=()=>{const sections=store.headings.map(heading=>document.getElementById(heading.id));const scrollPosition=window.scrollY-660;for(let i=sections.length-1;i>=0;i--){if(sections[i].offsetTop<=scrollPosition){setActiveSection(store.headings[i].id);break;}}};window.addEventListener(\"scroll\",handleScroll);return()=>{window.removeEventListener(\"scroll\",handleScroll);};},[store.headings]);return /*#__PURE__*/_jsx(_Fragment,{children:store.headings.length>0&&window?store.headings.sort((a,b)=>a.originalIndex-b.originalIndex).filter(({type})=>HEADING_TO_DISPLAY.includes(type)).map(({id,heading,type},index)=>{const nextHeading=store.headings[index+1];// \uD83E\uDDE0 NEW RULE: Special gap if h3 is followed by h2\nlet gap=type===\"h3\"&&nextHeading?.type===\"h2\"?H2_AFTER_H3_GAP:type===\"h3\"?H3_GAP:H2_GAP;return /*#__PURE__*/_jsx(\"div\",{style:{marginBottom:index!==store.headings.length-1?`${gap}px`:\"0px\"},children:/*#__PURE__*/_jsx(Component,{...props,variant:activeSection===id?`${type}-active`:type,title:heading,onClick:()=>scrollToId(id)})},id);}):/*#__PURE__*/_jsx(Component,{...props})});};}// \uD83D\uDFE0 OVERRIDE 2: CONTENT\nexport function withContent(Component){return props=>{const[store,setStore]=useStore();const[newProps,setNewProps]=useState(props);useEffect(()=>{setStore({headings:formatTableOfContent(newProps.children.props.children)});},[newProps]);useEffect(()=>{const formatHeadings=()=>{const newChildren=[];props.children.props.children.length>0&&props.children.props.children.forEach((item,index)=>{const children=item.props.children;if([\"h3\",\"h2\",\"h1\"].includes(item.type)){const{formattedId}=formatHeading(children,index);// Create a new object for the modified item\nconst newItem={...item,props:{...item.props,id:formattedId}};newChildren.push(newItem);}else{newChildren.push(item);}});// Return a new props object with the modified children\nreturn{...props,children:{...props.children,props:{...props.children.props,children:newChildren}}};};setNewProps(formatHeadings());},[props]);return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{children:`.framer-text {\n                    scroll-margin-top: ${SCROLL_MARGIN_TOP}px;\n                }`}),/*#__PURE__*/_jsx(Component,{...newProps})]});};}// \uD83D\uDFE2 HELPER FUNCTIONS\nconst formatTableOfContent=children=>{const result=[];children.length>0&&children.filter(({type})=>[\"h3\",\"h2\",\"h1\"].includes(type)).map((item,index)=>{const children=item.props.children;const{formattedId,formattedHeading}=formatHeading(children,index);result.push({id:formattedId,heading:formattedHeading,type:item.type,originalIndex:index});});return result;};const formatHeading=(children,index)=>{let formattedHeading=\"\";let formattedId=\"\";if(typeof children===\"string\"){formattedHeading=children;}else if(Array.isArray(children)){formattedHeading=children.map(item=>{console.log(\"item\",item);if(typeof item===\"string\")return item.trim();if(item.type===\"br\")return\"\";return item.props.children.trim();}).join(\" \");}else if(typeof children===\"object\"){if(typeof children.props.children===\"string\"){formattedHeading=children.props.children;}}else{formattedHeading=index.toString();}formattedId=formattedHeading.trim().toLowerCase().replace(/[^a-z]+/g,\"-\").replace(/^-+|-+$/g,\"\");return{formattedId,formattedHeading};};\nexport const __FramerMetadata__ = {\"exports\":{\"withContent\":{\"type\":\"reactHoc\",\"name\":\"withContent\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withTableOfContent\":{\"type\":\"reactHoc\",\"name\":\"withTableOfContent\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Table_Of_Contents.map"],
  "mappings": "uJAA0L,IAAMA,EAAmB,CAAC,KAAK,KAAK,IAAI,EAAQC,EAAkB,IACtPC,EAAO,GACNC,EAAO,EACPC,EAAgBF,EAChBG,EAASC,EAAY,CAAC,SAAS,CAAC,CAAC,CAAC,EAClC,SAASC,EAAmBC,EAAU,CAAC,OAAOC,GAAO,CAAC,GAAK,CAACC,CAAK,EAAEL,EAAS,EAAO,CAACM,EAAcC,CAAgB,EAAEC,EAAS,EAAE,EAAQC,EAAWC,GAAI,CAAC,IAAMC,EAAQ,SAAS,eAAeD,CAAE,EAAKC,GAASA,EAAQ,eAAe,CAAC,SAAS,QAAQ,CAAC,CAAG,EAAE,OAAAC,EAAU,IAAI,CAAC,IAAMC,EAAa,IAAI,CAAC,IAAMC,EAAST,EAAM,SAAS,IAAIU,GAAS,SAAS,eAAeA,EAAQ,EAAE,CAAC,EAAQC,EAAeC,EAAO,QAAQ,IAAI,QAAQC,EAAEJ,EAAS,OAAO,EAAEI,GAAG,EAAEA,IAAK,GAAGJ,EAASI,CAAC,EAAE,WAAWF,EAAe,CAACT,EAAiBF,EAAM,SAASa,CAAC,EAAE,EAAE,EAAE,KAAM,CAAE,EAAE,OAAAD,EAAO,iBAAiB,SAASJ,CAAY,EAAQ,IAAI,CAACI,EAAO,oBAAoB,SAASJ,CAAY,CAAE,CAAE,EAAE,CAACR,EAAM,QAAQ,CAAC,EAAsBc,EAAKC,EAAU,CAAC,SAASf,EAAM,SAAS,OAAO,GAAGY,EAAOZ,EAAM,SAAS,KAAK,CAACgB,EAAEC,IAAID,EAAE,cAAcC,EAAE,aAAa,EAAE,OAAO,C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AAK,EAAG,EAAE,KAAK,GAAG,EAAW,OAAOC,GAAW,SAAa,OAAOA,EAAS,MAAM,UAAW,WAAUM,EAAiBN,EAAS,MAAM,UAAgBM,EAAiBhB,EAAM,SAAS,EAAGW,EAAYK,EAAiB,KAAK,EAAE,YAAY,EAAE,QAAQ,WAAW,GAAG,EAAE,QAAQ,WAAW,EAAE,EAAQ,CAAC,YAAAL,EAAY,iBAAAK,CAAgB,CAAE",
  "names": ["HEADING_TO_DISPLAY", "SCROLL_MARGIN_TOP", "H2_GAP", "H3_GAP", "H2_AFTER_H3_GAP", "useStore", "createStore", "withTableOfContent", "Component", "props", "store", "activeSection", "setActiveSection", "ye", "scrollToId", "id", "element", "ue", "handleScroll", "sections", "heading", "scrollPosition", "window", "i", "p", "l", "a", "b", "type", "index", "nextHeading", "gap", "withContent", "setStore", "newProps", "setNewProps", "formatTableOfContent", "newChildren", "item", "children", "formattedId", "formatHeading", "newItem", "u", "result", "formattedHeading"]
}
