{"version":3,"file":"TemplateID.CTqZ43Fi.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/y8ko3Kyby8Do4Pal5PCE/ZR1OwnD0AmrVIafee76s/TemplateID.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";// Localstorage key\nconst WEBSITE_CONTEXT_KEY=\"websiteContext\";export const withSaveIdToLocalstorage=Component=>{return props=>{// Create a ref to get the rendered element\nconst ref=useRef(null);useEffect(()=>{var _ref_current;// Ensure we're in a browser environment\nif(typeof window===\"undefined\")return;// Get the text content (ID) from the rendered element\nconst id=(_ref_current=ref.current)===null||_ref_current===void 0?void 0:_ref_current.textContent;// Get existing data from localStorage\nconst existingData=localStorage.getItem(WEBSITE_CONTEXT_KEY);let websiteContext={};if(existingData){try{websiteContext=JSON.parse(existingData);}catch(error){console.error(\"Error parsing localStorage data:\",error);}}// Initialize the lastVisitedUseCaseTemplates array if it doesn't exist\nif(!websiteContext.lastVisitedUseCaseTemplates){websiteContext.lastVisitedUseCaseTemplates=[];}// Add the ID & page url to the lastVisitedUseCaseTemplates array if it's not already\nif(id&&!websiteContext.lastVisitedUseCaseTemplates.includes(id)){websiteContext.lastVisitedUseCaseTemplates=[...websiteContext.lastVisitedUseCaseTemplates||[],id];}// Update the pageUrl every time the component is rendered\ntry{websiteContext.pageUrl=new URL(window.location.href).pathname;}catch(error){console.error(\"Error updating pageUrl\",error);}// Save to localStorage\nlocalStorage.setItem(WEBSITE_CONTEXT_KEY,JSON.stringify(websiteContext));},[]);// Return the component with its original props\nreturn /*#__PURE__*/_jsx(Component,{...props,ref:ref});};};\nexport const __FramerMetadata__ = {\"exports\":{\"withSaveIdToLocalstorage\":{\"type\":\"reactHoc\",\"name\":\"withSaveIdToLocalstorage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TemplateID.map"],"mappings":"+JAA0C,IAAoC,EACxE,EAAoB,iBAA8B,EAAyB,GAAmB,GAAO,CAC3G,IAAM,EAAIA,EAAO,IAAI,EAQrB,OARuB,MAAc,CACrC,GAAU,IAAS,OAAY,OAC/B,IAAM,EAAiB,EAAI,SAA2D,YAChF,EAAa,aAAa,QAAQ,CAAmB,EAAM,EAAe,CAAC,EAAE,GAAG,EAAc,GAAG,CAAC,EAAe,KAAK,MAAM,CAAY,CAAE,OAAO,EAAM,CAAC,QAAQ,MAAM,mCAAmC,CAAK,CAAE,CACtN,AAAgD,EAAe,8BAA4B,CAAC,EACzF,GAAI,CAAC,EAAe,4BAA4B,SAAS,CAAE,IAAG,EAAe,4BAA4B,CAAC,GAAG,EAAe,6BAA6B,CAAC,EAAE,CAAE,GACjK,GAAG,CAAC,EAAe,QAAQ,IAAI,IAAI,EAAO,SAAS,IAAI,CAAC,CAAC,QAAS,OAAO,EAAM,CAAC,QAAQ,MAAM,yBAAyB,CAAK,CAAE,CAC9H,aAAa,QAAQ,EAAoB,KAAK,UAAU,CAAc,CAAC,CAAE,EAAE,CAAC,CAAC,EACzD,EAAK,EAAU,CAAC,GAAG,EAAU,KAAG,CAAC,CAAE"}