{"version":3,"file":"FormCache.DAIwFFPI.mjs","names":[],"sources":["https:/framerusercontent.com/modules/W3TyEKZ2liIsoWjAH9M9/B8UIML6fFkg97XpVyds3/FormCache.js"],"sourcesContent":["/**\n * FormCache – shared browser localStorage cache for repeating form entries.\n *\n * Stores user-submitted form data (name, company, email, country) so that\n * subsequent download tiles can skip the form gate when valid cached data exists.\n *\n * Cache key: \"impaqt_form_cache\"\n * Cache schema version: 1  (bump CACHE_VERSION to force-invalidate old entries)\n */const CACHE_KEY=\"impaqt_form_cache\";const CACHE_VERSION=1;/** How long the cache is considered valid (7 days in ms) */const CACHE_TTL_MS=7*24*60*60*1e3;function isValidCache(data){if(!data||typeof data!==\"object\")return false;const d=data;return d.version===CACHE_VERSION&&typeof d.fname===\"string\"&&typeof d.lname===\"string\"&&typeof d.company===\"string\"&&typeof d.email===\"string\"&&typeof d.country===\"string\"&&typeof d.savedAt===\"number\"&&(d.phone===undefined||typeof d.phone===\"string\");}/** Returns cached form data if it exists and is still valid; otherwise null. */export function readFormCache(){if(typeof window===\"undefined\")return null;try{const raw=window.localStorage.getItem(CACHE_KEY);if(!raw)return null;const parsed=JSON.parse(raw);if(!isValidCache(parsed))return null;if(Date.now()-parsed.savedAt>CACHE_TTL_MS){window.localStorage.removeItem(CACHE_KEY);return null;}return parsed;}catch{return null;}}/** Writes form data to the browser cache, merging with existing data. */export function writeFormCache(data){if(typeof window===\"undefined\")return;try{const existing=readFormCache()||{};const entry={fname:data.fname??existing.fname??\"\",lname:data.lname??existing.lname??\"\",company:data.company??existing.company??\"\",email:data.email??existing.email??\"\",country:data.country??existing.country??\"\",phone:data.phone??existing.phone??\"\",version:CACHE_VERSION,savedAt:Date.now()};window.localStorage.setItem(CACHE_KEY,JSON.stringify(entry));}catch{// localStorage may be unavailable (private mode, quota exceeded, etc.)\n}}/** Clears the cached form data. */export function clearFormCache(){if(typeof window===\"undefined\")return;try{window.localStorage.removeItem(CACHE_KEY);}catch{// noop\n}}/**\n * Returns true when cached data contains all required fields and a valid email.\n */export function isCacheComplete(cache){if(!cache)return false;const emailRegex=/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;return cache.fname.trim()!==\"\"&&cache.lname.trim()!==\"\"&&cache.company.trim()!==\"\"&&emailRegex.test(cache.email)&&cache.country.trim()!==\"\";}\nexport const __FramerMetadata__ = {\"exports\":{\"isCacheComplete\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"writeFormCache\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"readFormCache\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"FormCacheData\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"clearFormCache\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FormCache.map"],"mappings":"oGAQ2J,SAAS,EAAa,EAAK,CAAC,GAAG,CAAC,GAAM,OAAO,GAAO,SAAS,MAAO,GAAM,IAAM,EAAE,EAAK,OAAO,EAAE,UAAU,GAAe,OAAO,EAAE,OAAQ,UAAU,OAAO,EAAE,OAAQ,UAAU,OAAO,EAAE,SAAU,UAAU,OAAO,EAAE,OAAQ,UAAU,OAAO,EAAE,SAAU,UAAU,OAAO,EAAE,SAAU,WAAW,EAAE,QAAQ,IAAA,IAAW,OAAO,EAAE,OAAQ,UAA2F,SAAgB,GAAe,CAAC,GAAU,IAAS,OAAY,OAAO,KAAK,GAAG,CAAC,IAAM,EAAI,EAAO,aAAa,QAAQ,EAAU,CAAC,GAAG,CAAC,EAAI,OAAO,KAAK,IAAM,EAAO,KAAK,MAAM,EAAI,CAAwI,OAAnI,EAAa,EAAO,CAAgB,KAAK,KAAK,CAAC,EAAO,QAAQ,GAAc,EAAO,aAAa,WAAW,EAAU,CAAQ,MAAa,EAA9G,UAA2H,CAAC,OAAO,MAAgF,SAAgB,EAAe,EAAK,CAAI,GAAO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