{
  "version": 3,
  "sources": ["ssg:https://framer.com/m/framer/store.js@^1.0.0", "ssg:https://framer.com/m/Utils-WIyM.js", "ssg:https://framerusercontent.com/modules/bDc8SSa8O8iITvU5IOrG/uAvDZaNWK5y7a478q6RP/TableOfContent.js"],
  "sourcesContent": ["import{useState,useEffect}from\"react\";import{Data,useObserveData}from\"framer\";export function createStore(state1){// Use Data so that a Preview reload resets the state\nconst dataStore=Data({state:Object.freeze({...state1})});// Create a set function that updates the state\nconst setDataStore=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(dataStore.state);}dataStore.state=Object.freeze({...dataStore.state,...newState});};// Store the initial state, copy the object if it's an object\nlet storeState=typeof state1===\"object\"?Object.freeze({...state1}):state1;// Keep a list of all the listeners, in the form of React hook setters\nconst storeSetters=new Set();// Create a set function that updates all the listeners / setters\nconst setStoreState=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(storeState);}storeState=typeof newState===\"object\"?Object.freeze({...storeState,...newState}):newState;// Update all the listeners / setters with the new value\nstoreSetters.forEach(setter=>setter(storeState));};// Create the actual hook based on everything above\nfunction useStore(){// Create the hook we are going to use as a listener\nconst[state,setState]=useState(storeState);// If we unmount the component using this hook, we need to remove the listener\n// @ts-ignore\nuseEffect(()=>{// But right now, we need to add the listener\nstoreSetters.add(setState);return()=>storeSetters.delete(setState);},[]);// If Data context exists, use Data, otherwise use vanilla React state\nif(useObserveData()===true){useObserveData();return[dataStore.state,setDataStore];}else{// Return the state and a function to update the central store\nreturn[state,setStoreState];}}return useStore;}\nexport const __FramerMetadata__ = {\"exports\":{\"createStore\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./createStore.map", "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,useRef,Children,cloneElement}from\"react\";import{HEADINGS}from\"https://framer.com/m/Utils-WIyM.js\";// Constants\nconst HEADING_TO_DISPLAY=[\"h3\"];const SCROLL_MARGIN_TOP=160;const useStore=createStore({headings:[],activeHeading:null});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:store.activeHeading===id?`${type}-active`:type,title:heading,link:`${window.location.pathname}#${id}`,style:{marginBottom:\"24px\",width:\"100%\"}})):/*#__PURE__*/_jsx(Component,{...props})});};}export function withContent(Component){return props=>{const[store,setStore]=useStore();const[newProps,setNewProps]=useState(props);const childrenRefs=useRef([])// Array of refs for each child\n;let lastActiveId=null;// Set up Intersection Observer\nuseEffect(()=>{if(childrenRefs.current.length){const observer=new IntersectionObserver(entries=>{// Sort entries by their position in the viewport\nconst visibleEntries=entries.filter(entry=>entry.isIntersecting).sort((a,b)=>a.boundingClientRect.top-b.boundingClientRect.top);if(visibleEntries.length>0){const activeEntry=visibleEntries[0]// Topmost visible section\n;const activeId=activeEntry.target.id;if(activeId!==lastActiveId){setStore({...store,activeHeading:activeId});lastActiveId=activeId;}}},{threshold:.6,rootMargin:`-${SCROLL_MARGIN_TOP}px 0px -40% 0px`});childrenRefs.current.forEach(ref=>{if(ref)observer.observe(ref);});return()=>{childrenRefs.current.forEach(ref=>{if(ref)observer.unobserve(ref);});};}},[childrenRefs.current,store]);// Format table of content\nuseEffect(()=>{const headings=formatTableOfContent(newProps.children?.props.children||[]);setStore({headings,activeHeading:headings[0]?.id});},[newProps]);useEffect(()=>{setNewProps(formatHeadings(props));},[props]);// Render children with refs\nconst childrenWithRefs=Children.map(newProps.children.props.children,(child,index)=>{return /*#__PURE__*/cloneElement(child,{ref:el=>HEADING_TO_DISPLAY.includes(child.type)?childrenRefs.current[index]=el:null});});return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{children:`.framer-text {\n                        scroll-margin-top: ${SCROLL_MARGIN_TOP}px;\n                    }`}),/*#__PURE__*/_jsx(Component,{...newProps,children:/*#__PURE__*/cloneElement(newProps.children,{},childrenWithRefs)})]});};}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);result.push({id:formattedId,heading:formattedHeading,type:item.type,originalIndex:index});});return result;};const formatHeading=children=>{let formattedHeading=\"\";let formattedId=\"\";if(typeof children===\"string\"){formattedHeading=children;}else if(Array.isArray(children)){formattedHeading=children.map(item=>formatHeading(item).formattedHeading).join(\" \");}else if(typeof children===\"object\"){if(typeof children.props.children===\"string\"){formattedHeading=children.props.children;}else{formattedHeading=formatHeading(children.props.children).formattedHeading;}}formattedId=formattedHeading.toLowerCase().replace(/[^a-z0-9]+/g,\"-\").replace(/^-+|-+$/g,\"\").trim();return{formattedId,formattedHeading:formattedHeading.trim()};};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);const newItem={...item,props:{...item.props,id:formattedId}};newChildren.push(newItem);}else{newChildren.push(item);}});return{...props,children:{...props.children,props:{...props.children.props,children:newChildren}}};};\nexport const __FramerMetadata__ = {\"exports\":{\"withContent\":{\"type\":\"reactHoc\",\"name\":\"withContent\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withTableOfContent\":{\"type\":\"reactHoc\",\"name\":\"withTableOfContent\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"formatHeadings\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TableOfContent.map"],
  "mappings": "0IAAqF,SAASA,EAAYC,EAAO,CACjH,IAAMC,EAAUC,EAAK,CAAC,MAAM,OAAO,OAAO,CAAC,GAAGF,CAAM,CAAC,CAAC,CAAC,EACjDG,EAAaC,GAAU,CAC1B,OAAOA,GAAW,aAA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AKC,CAAO,CAAE,MAAMD,EAAY,KAAKJ,CAAI,CAAG,CAAC,EAAQ,CAAC,GAAGrC,EAAM,SAAS,CAAC,GAAGA,EAAM,SAAS,MAAM,CAAC,GAAGA,EAAM,SAAS,MAAM,SAASyC,CAAW,CAAC,CAAC,CAAE",
  "names": ["createStore", "state1", "dataStore", "Data", "setDataStore", "newState", "storeState", "storeSetters", "setStoreState", "setter", "useStore", "state", "setState", "ye", "ue", "useObserveData", "HEADINGS", "HEADING_TO_DISPLAY", "SCROLL_MARGIN_TOP", "useStore", "createStore", "withContent", "Component", "props", "store", "setStore", "useStore", "newProps", "setNewProps", "ye", "childrenRefs", "pe", "lastActiveId", "ue", "observer", "entries", "visibleEntries", "entry", "a", "b", "activeId", "SCROLL_MARGIN_TOP", "ref", "headings", "formatTableOfContent", "formatHeadings", "childrenWithRefs", "j", "child", "index", "q", "el", "HEADING_TO_DISPLAY", "u", "l", "p", "children", "result", "type", "HEADINGS", "item", "formattedId", "formattedHeading", "formatHeading", "newChildren", "newItem"]
}
