{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/PF1dXvUypVpfq84CrORY/9pZ5lz6KGB8Xleu5B5ci/TableOFContent.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=[\"h2\",\"h4\"];const SCROLL_MARGIN_TOP=110;const useStore=createStore({headings:[]});export function withTableOfContent(Component){return props=>{const[store]=useStore();const[activeSection,setActiveSection]=useState(\"\");const[isClickActive,setIsClickActive]=useState(false);const scrollToId=id=>{const element=document.getElementById(id);if(element){element.scrollIntoView({behavior:\"smooth\"});setActiveSection(id);setIsClickActive(true);setTimeout(()=>{setIsClickActive(false);},500);}};useEffect(()=>{const handleScroll=()=>{if(isClickActive)return;const sections=store.headings.map(heading=>document.getElementById(heading.id));const scrollPosition=window.scrollY-60;for(let i=sections.length-1;i>=0;i--){if(sections[i]&&sections[i].offsetTop<=scrollPosition){setActiveSection(store.headings[i].id);break;}}};window.addEventListener(\"scroll\",handleScroll);return()=>{window.removeEventListener(\"scroll\",handleScroll);};},[store.headings,isClickActive]);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:activeSection===id?`${type}-active`:type,title:heading,onClick:()=>scrollToId(id)})):/*#__PURE__*/_jsx(Component,{...props})});};}export function withContent(Component){return props=>{const[store,setStore]=useStore();const[newProps,setNewProps]=useState(props);useEffect(()=>{var _newProps_children_props,_newProps_children;setStore({headings:formatTableOfContent(((_newProps_children=newProps.children)===null||_newProps_children===void 0?void 0:(_newProps_children_props=_newProps_children.props)===null||_newProps_children_props===void 0?void 0:_newProps_children_props.children)||[])});},[newProps]);useEffect(()=>{const formatHeadings=()=>{var _props_children_props,_props_children,_props_children_props1,_props_children1;const newChildren=[];const children=Array.isArray((_props_children=props.children)===null||_props_children===void 0?void 0:(_props_children_props=_props_children.props)===null||_props_children_props===void 0?void 0:_props_children_props.children)?props.children.props.children:[(_props_children1=props.children)===null||_props_children1===void 0?void 0:(_props_children_props1=_props_children1.props)===null||_props_children_props1===void 0?void 0:_props_children_props1.children].filter(Boolean);children.forEach((item,index)=>{if(item&&[\"h2\",\"h4\"].includes(item.type)){const{formattedId}=formatHeading(item.props.children,index);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}}};};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})]});};}const formatTableOfContent=children=>{const result=[];(Array.isArray(children)?children:[children]).filter(Boolean).filter(({type})=>[\"h2\",\"h4\"].includes(type)).forEach((item,index)=>{const{formattedId,formattedHeading}=formatHeading(item.props.children,index);result.push({id:formattedId,heading:formattedHeading,type:item.type,originalIndex:index});});return result;};const formatHeading=(children,index)=>{var _children_props;let formattedHeading=\"\";let formattedId=\"\";if(typeof children===\"string\"){formattedHeading=children.trim();}else if(Array.isArray(children)){formattedHeading=children.map(item=>{var _item_props_children;if(typeof item===\"string\")return item.trim();if(item.type===\"br\")return\"\";return((_item_props_children=item.props.children)===null||_item_props_children===void 0?void 0:_item_props_children.trim())||\"\";}).join(\" \");}else if(children===null||children===void 0?void 0:(_children_props=children.props)===null||_children_props===void 0?void 0:_children_props.children){formattedHeading=children.props.children.trim();}else{formattedHeading=`heading-${index}`;}formattedId=formattedHeading.toLowerCase().replace(/[^a-z0-9]+/g,\"-\").replace(/^-+|-+$/g,\"\");return{formattedId,formattedHeading};};\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=./TableOFContent.map"],
  "mappings": "kJAA0L,IAAMA,EAAmB,CAAC,KAAK,IAAI,EAAQC,EAAkB,IAAUC,EAASC,EAAY,CAAC,SAAS,CAAC,CAAC,CAAC,EAAS,SAASC,EAAmBC,EAAU,CAAC,OAAOC,GAAO,CAAC,GAAK,CAACC,CAAK,EAAEL,EAAS,EAAO,CAACM,EAAcC,CAAgB,EAAEC,EAAS,EAAE,EAAO,CAACC,EAAcC,CAAgB,EAAEF,EAAS,EAAK,EAAQG,EAAWC,GAAI,CAAC,IAAMC,EAAQ,SAAS,eAAeD,CAAE,EAAKC,IAASA,EAAQ,eAAe,CAAC,SAAS,QAAQ,CAAC,EAAEN,EAAiBK,CAAE,EAAEF,EAAiB,EAAI,EAAE,WAAW,IAAI,CAACA,EAAiB,EAAK,CAAE,EAAE,GAAG,EAAG,EAAE,OAAAI,EAAU,IAAI,CAAC,IAAMC,EAAa,IAAI,CAAC,GAAGN,EAAc,OAAO,IAAMO,EAASX,EAAM,SAAS,IAAIY,GAAS,SAAS,eAAeA,EAAQ,EAAE,CAAC,EAAQC,EAAeC,EAAO,QAAQ,GAAG,QAAQC,EAAEJ,EAAS,OAAO,EAAEI,GAAG,EAAEA,IAAK,GAAGJ,EAASI,CAAC,GAAGJ,EAASI,CAAC,EAAE,WAAWF,EAAe,CAACX,EAAiBF,EAAM,SAASe,CAAC,EAAE,EAAE,EAAE,MAAQ,EAAE,OAAAD,EAAO,iBAAiB,SAASJ,CAAY,EAAQ,IAAI,CAACI,EAAO,oBAAoB,SAASJ,CAAY,CAAE,CAAE,EAAE,CAACV,EAAM,SAASI,CAAa,CAAC,EAAsBY,EAAKC,EAAU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,IAAID,EAAiB,GAAON,EAAY,GAAG,OAAG,OAAOI,GAAW,SAAUE,EAAiBF,EAAS,KAAK,EAAW,MAAM,QAAQA,CAAQ,EAAGE,EAAiBF,EAAS,IAAIL,GAAM,CAAC,IAAIS,EAAqB,OAAG,OAAOT,GAAO,SAAgBA,EAAK,KAAK,EAAKA,EAAK,OAAO,KAAW,KAAWS,EAAqBT,EAAK,MAAM,YAAY,MAAMS,IAAuB,OAAO,OAAOA,EAAqB,KAAK,IAAI,EAAG,CAAC,EAAE,KAAK,GAAG,EAAW,EAAAJ,GAAW,OAAgCG,EAAgBH,EAAS,SAAS,MAAMG,IAAkB,SAAcA,EAAgB,SAAUD,EAAiBF,EAAS,MAAM,SAAS,KAAK,EAAQE,EAAiB,WAAWpB,IAASc,EAAYM,EAAiB,YAAY,EAAE,QAAQ,cAAc,GAAG,EAAE,QAAQ,WAAW,EAAE,EAAQ,CAAC,YAAAN,EAAY,iBAAAM,CAAgB,CAAE",
  "names": ["HEADING_TO_DISPLAY", "SCROLL_MARGIN_TOP", "useStore", "createStore", "withTableOfContent", "Component", "props", "store", "activeSection", "setActiveSection", "ye", "isClickActive", "setIsClickActive", "scrollToId", "id", "element", "ue", "handleScroll", "sections", "heading", "scrollPosition", "window", "i", "p", "l", "a", "b", "type", "index", "withContent", "setStore", "newProps", "setNewProps", "_newProps_children_props", "_newProps_children", "formatTableOfContent", "_props_children_props", "_props_children", "_props_children_props1", "_props_children1", "newChildren", "item", "formattedId", "formatHeading", "newItem", "u", "children", "result", "formattedHeading", "_children_props", "_item_props_children"]
}
