{"version":3,"file":"HideFromReferrer.BBarOo7i.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/NFfgGUx83teiaXrAFXpa/PUPWzZtcKaoZbbcUcLjL/HideFromReferrer.js"],"sourcesContent":["// Code file handling the dynamic state of back buttons in the BLOG section\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";const DEBUG=0// Set to 0 to disable all logs\n;// Helper to manage URL history (now using sessionStorage)\nconst updateUrlHistory=()=>{if(typeof window===\"undefined\")return;const currentUrl=window.location.pathname;const history=JSON.parse(sessionStorage.getItem(\"urlHistory\")||\"[]\");// Don't add if it's the same as the last entry\nif(history.length===0||history[history.length-1]!==currentUrl){history.push(currentUrl);// Keep only last 10 URLs\nif(history.length>10){history.shift();}sessionStorage.setItem(\"urlHistory\",JSON.stringify(history));if(DEBUG){console.log(\"Updated URL history:\",history);}}};export function withTrackUrl(Component){return props=>{useEffect(()=>{updateUrlHistory();},[]);return /*#__PURE__*/_jsx(Component,{...props});};}export function withHideFromCategory(Component){return props=>{const[shouldHide,setShouldHide]=useState(false);useEffect(()=>{updateUrlHistory();if(typeof window!==\"undefined\"){const history=JSON.parse(sessionStorage.getItem(\"urlHistory\")||\"[]\");const previousUrl=history[history.length-2];const fromCategory=previousUrl&&previousUrl.includes(\"/blog/category/\");if(DEBUG){console.log(\"withHideFromCategory - URL history:\",history);console.log(\"withHideFromCategory - Previous URL:\",previousUrl);console.log(\"withHideFromCategory - From category:\",fromCategory);}setShouldHide(Boolean(fromCategory));}},[]);if(shouldHide){return null;}return /*#__PURE__*/_jsx(Component,{...props});};}export function withHideFromIndex(Component){return props=>{const[shouldHide,setShouldHide]=useState(false);useEffect(()=>{updateUrlHistory();if(typeof window!==\"undefined\"){const history=JSON.parse(sessionStorage.getItem(\"urlHistory\")||\"[]\");const previousUrl=history[history.length-2];const fromCategory=previousUrl&&previousUrl.includes(\"/blog/category/\");if(DEBUG){console.log(\"withHideFromIndex - URL history:\",history);console.log(\"withHideFromIndex - Previous URL:\",previousUrl);console.log(\"withHideFromIndex - From category:\",fromCategory);}setShouldHide(!Boolean(fromCategory));}},[]);if(shouldHide){return null;}return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withHideFromIndex\":{\"type\":\"reactHoc\",\"name\":\"withHideFromIndex\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withTrackUrl\":{\"type\":\"reactHoc\",\"name\":\"withTrackUrl\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHideFromCategory\":{\"type\":\"reactHoc\",\"name\":\"withHideFromCategory\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HideFromReferrer.map"],"mappings":"kIAK8J,SAAgB,EAAa,EAAU,CAAC,MAAO,KAAQ,MAAc,CAAC,GAAkB,EAAG,EAAE,CAAC,CAAqB,EAAK,EAAU,CAAC,GAAG,EAAM,CAAC,EAAI,SAAgB,EAAqB,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,EAAW,GAAeA,EAAS,GAAM,CAA4gB,OAA3gB,MAAc,CAAoB,GAAnB,GAAkB,CAAW,IAAS,OAAY,CAAC,IAAM,EAAQ,KAAK,MAAM,eAAe,QAAQ,aAAa,EAAE,KAAK,CAAO,EAAY,EAAQ,EAAQ,OAAO,GAAmR,EAAc,GAA3Q,GAAa,EAAY,SAAS,kBAAkB,EAA6O,GAAI,EAAE,CAAC,CAAI,EAAmB,KAA0B,EAAK,EAAU,CAAC,GAAG,EAAM,CAAC,EAAI,SAAgB,EAAkB,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,EAAW,GAAeA,EAAS,GAAM,CAAogB,OAAngB,MAAc,CAAoB,GAAnB,GAAkB,CAAW,IAAS,OAAY,CAAC,IAAM,EAAQ,KAAK,MAAM,eAAe,QAAQ,aAAa,EAAE,KAAK,CAAO,EAAY,EAAQ,EAAQ,OAAO,GAA0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