{"version":3,"file":"Sidebar.CUhlv7ce.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/WK98cWZz8wNDHh3rLUwt/iX8B6owm6pJGNb61R3RF/Sidebar.js"],"sourcesContent":["// overrides/sidebarState.tsx\n//------------------------------------------------------------\n// Sidebar state HOCs for Framer / React\n//  • No first-paint flash    (visibility gate + sync localStorage)\n//  • Ref-safe                (no extra wrapper elements)\n//------------------------------------------------------------\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useLayoutEffect,useState}from\"react\";import{atom,useAtom,useAtomValue}from\"jotai\";import{atomWithStorage}from\"jotai/utils\";//------------------------------------------------------------\n// 1 ▸ Config – tweak for your design system\n//------------------------------------------------------------\nconst STORAGE_KEY=\"memoirSidebarState\"// localStorage key\n;const COLLAPSED_BREAKPOINT=1200// px\n;const COLLAPSED_VARIANT_NAME=\"Collapsed\"// sidebar variant\n;//------------------------------------------------------------\n// 2 ▸ Helpers & shared atoms\n//------------------------------------------------------------\nfunction readInitialSidebarState(){if(typeof window===\"undefined\")return false;try{const stored=window.localStorage.getItem(STORAGE_KEY);return stored?JSON.parse(stored):false;}catch{return false;}}// false ⇒ expanded · true ⇒ collapsed\nexport const sidebarStateAtom=atomWithStorage(STORAGE_KEY,readInitialSidebarState());// keep viewport width in an atom\nconst windowWidthAtom=typeof window!==\"undefined\"?atom(window.innerWidth):atom(0);//------------------------------------------------------------\n// 3 ▸ HOC #1 – writer   (attach to hamburger / minimise button)\n//------------------------------------------------------------\nexport function withSaveSidebarState(Component){return function SaveSidebarStateHOC(props){const[sidebarState,setSidebarState]=useAtom(sidebarStateAtom);const handleClick=()=>{setSidebarState(!sidebarState)// toggle + persist\n;window.dispatchEvent(new Event(\"sidebarStateChanged\"));};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}//------------------------------------------------------------\n// 4 ▸ HOC #2 – reader   (attach to the Sidebar frame)\n//------------------------------------------------------------\nexport function withSidebarState(Component){return function SidebarStateHOC(props){/* ---------- “invisible-until-hydrated” gate ---------- */const[visible,setVisible]=useState(false);useLayoutEffect(()=>setVisible(true),[])// runs before paint\n;/* ----------------------------------------------------- */const sidebarState=useAtomValue(sidebarStateAtom);const[windowWidth,setWindowWidth]=useAtom(windowWidthAtom);// keep windowWidth live\nuseEffect(()=>{const handleResize=()=>setWindowWidth(window.innerWidth);window.addEventListener(\"resize\",handleResize);return()=>window.removeEventListener(\"resize\",handleResize);},[setWindowWidth]);const shouldCollapse=sidebarState&&windowWidth>=COLLAPSED_BREAKPOINT;/* merge an inline visibility style so nothing flashes */const mergedStyle={...props.style,visibility:visible?\"visible\":\"hidden\"};return /*#__PURE__*/_jsx(Component,{...props,style:mergedStyle,variant:shouldCollapse?COLLAPSED_VARIANT_NAME:props.variant});};}\nexport const __FramerMetadata__ = {\"exports\":{\"sidebarStateAtom\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSaveSidebarState\":{\"type\":\"reactHoc\",\"name\":\"withSaveSidebarState\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSidebarState\":{\"type\":\"reactHoc\",\"name\":\"withSidebarState\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Sidebar.map"],"mappings":"8NAeA,SAAS,GAAyB,CAAC,GAAU,IAAS,OAAY,MAAO,GAAM,GAAG,CAAC,IAAM,EAAO,EAAO,aAAa,QAAQ,EAAY,CAAC,OAAO,EAAO,KAAK,MAAM,EAAO,CAAC,QAAY,CAAC,MAAO,IAS9L,SAAgB,EAAiB,EAAU,CAAC,OAAO,SAAyB,EAAM,CAA4D,GAAK,CAAC,EAAQ,GAAYA,EAAS,GAAM,CAAC,MAAoB,EAAW,GAAK,CAAC,EAAE,CAAC,CACpK,IAAM,EAAa,EAAa,EAAiB,CAAM,CAAC,EAAY,GAAgB,EAAQ,EAAgB,CACxK,MAAc,CAAC,IAAM,MAAiB,EAAe,EAAO,WAAW,CAAgD,OAA/C,EAAO,iBAAiB,SAAS,EAAa,KAAW,EAAO,oBAAoB,SAAS,EAAa,EAAG,CAAC,EAAe,CAAC,CAAC,IAAM,EAAe,GAAc,GAAa,EAAoF,EAAY,CAAC,GAAG,EAAM,MAAM,WAAW,EAAQ,UAAU,SAAS,CAAC,OAAoB,EAAK,EAAU,CAAC,GAAG,EAAM,MAAM,EAAY,QAAQ,EAAe,EAAuB,EAAM,QAAQ,CAAC,iCApB/d,IAAsD,IAA6C,IAAyC,CAGjL,EAAY,qBACX,EAAqB,KACrB,EAAuB,YAKjB,EAAiB,EAAgB,EAAY,GAAyB,CAAC,CAC9E,EAAoE,EAA7C,IAAS,OAAyC,EAAxB,EAAO,WAAmB"}