{
  "version": 3,
  "sources": ["ssg:https://framer.com/m/Utils-WIyM.js", "ssg:https://framerusercontent.com/modules/nu5Ub3V85m9axxdr6AD1/HeAzX5LHv3m4sAFvOhyp/TableOfContents.js"],
  "sourcesContent": ["export const HEADINGS=[\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"];const formatHeading=(children,index)=>{let formattedHeading=\"\";let formattedId=\"\";if(typeof children===\"string\"){formattedHeading=children;}else if(Array.isArray(children)){formattedHeading=children.map(item=>{var _item_props;if(typeof item===\"string\")return item.trim();if(typeof((_item_props=item.props)===null||_item_props===void 0?void 0:_item_props.children)===\"string\")return item.props.children.trim();}).join(\" \");}else if(typeof children===\"object\"){if(typeof children.props.children===\"string\"){formattedHeading=children.props.children;}else{formattedHeading=children.type;}}else{formattedHeading=index.toString();}formattedId=formattedHeading.toLowerCase().replace(/[^a-z0-9]+/g,\"-\").replace(/^-+|-+$/g,\"\").trim();return{formattedId,formattedHeading};};export const formatTableOfContent=children=>{const result=[];children.length>0&&children.filter(({type})=>HEADINGS.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;};export const formatHeadings=props=>{const newChildren=[];props.children.props.children.forEach((item,index)=>{const children=item.props.children;if(HEADINGS.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}}};};\nexport const __FramerMetadata__ = {\"exports\":{\"formatTableOfContent\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"HEADINGS\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"formatHeadings\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Utils.map", "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\";import{formatHeadings,formatTableOfContent}from\"https://framer.com/m/Utils-WIyM.js\";// Made with love by Cl\u00E9ment: https://lionneclement.com/\n// Full tutorial: https://framermart.com/tutorial/how-to-create-table-of-contents-cms-collections-framer\nconst HEADING_TO_DISPLAY=[\"h2\",\"h3\"];const SCROLL_MARGIN_TOP=160;const useStore=createStore({headings:[]});export function withTableOfContent(Component){return props=>{const[store]=useStore();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)=>/*#__PURE__*/_jsx(Component,{...props,variant:type,title:heading,link:`${window.location.pathname}#${id}`})):/*#__PURE__*/_jsx(Component,{...props})});};}export function withContent(Component){return props=>{const[store,setStore]=useStore();const[newProps,setNewProps]=useState(props);useEffect(()=>{setStore({headings:formatTableOfContent(newProps.children.props.children)});},[newProps]);useEffect(()=>{setNewProps(formatHeadings(props));},[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})]});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withTableOfContent\":{\"type\":\"reactHoc\",\"name\":\"withTableOfContent\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withContent\":{\"type\":\"reactHoc\",\"name\":\"withContent\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TableOfContents.map"],
  "mappings": "uJAAO,IAAMA,EAAS,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,IAAI,EAAQC,EA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,CAACA,CAAQ,CAAC,EAAEG,EAAU,IAAI,CAACF,EAAYI,EAAejB,CAAK,CAAC,CAAE,EAAE,CAACA,CAAK,CAAC,EAAsBkB,EAAM,EAAU,CAAC,SAAS,CAAchB,EAAK,QAAQ,CAAC,SAAS;AAAA,yCACz4BP,CAAiB;AAAA,kBACxC,CAAC,EAAeO,EAAKH,EAAU,CAAC,GAAGa,CAAQ,CAAC,CAAC,CAAC,CAAC,CAAE,CAAE",
  "names": ["HEADINGS", "formatHeading", "children", "index", "formattedHeading", "formattedId", "item", "_item_props", "formatTableOfContent", "result", "type", "formatHeadings", "props", "newChildren", "newItem", "HEADING_TO_DISPLAY", "SCROLL_MARGIN_TOP", "useStore", "createStore", "withTableOfContent", "Component", "props", "store", "p", "window", "a", "b", "type", "id", "heading", "index", "withContent", "setStore", "newProps", "setNewProps", "ye", "ue", "formatTableOfContent", "formatHeadings", "u"]
}
