self.__next_f.push([1,"\n // Optimized cache clearing for UI updates - minimal latency impact\n if (typeof window !== 'undefined') {\n const buildTime = document.querySelector('meta[name=\"build-time\"]')?.getAttribute('content');\n const lastBuildTime = localStorage.getItem('lastBuildTime');\n \n // Only clear caches when absolutely necessary\n const clearCachesSelectively = () =\u003e {\n console.log('Selectively clearing outdated caches...');\n \n // Only clear Service Worker caches if they exist and are outdated\n if ('caches' in window) {\n caches.keys().then(names =\u003e {\n // Only clear Next.js related caches, not all caches\n const nextCaches = names.filter(name =\u003e \n name.includes('next') || name.includes('static') || name.includes('webpack')\n );\n nextCaches.forEach(name =\u003e {\n caches.delete(name);\n });\n });\n }\n \n // Only clear specific localStorage items\n localStorage.removeItem('lastBuildTime');\n localStorage.removeItem('lastKnownBuildTime');\n };\n \n // Only clear caches on actual new build detection (not every page load)\n if (buildTime \u0026\u0026 buildTime !== lastBuildTime \u0026\u0026 lastBuildTime) {\n console.log('New UI build detected:', buildTime, 'vs', lastBuildTime);\n localStorage.setItem('lastBuildTime', buildTime);\n \n // Defer cache clearing to not block initial page load\n setTimeout(clearCachesSelectively, 1000);\n } else if (buildTime \u0026\u0026 !lastBuildTime) {\n // First visit - just store the build time\n localStorage.setItem('lastBuildTime', buildTime);\n }\n \n // Remove aggressive development cache clearing for production performance\n // Only clear on localhost during development if needed\n if (window.location.hostname === 'localhost' \u0026\u0026 \n new URLSearchParams(window.location.search).has('clearCache')) {\n clearCachesSelectively();\n }\n }\n // Enhanced chunk load error handling for production\n const handleChunkError = (error, source = 'unknown') =\u003e {\n console.error('ChunkLoadError detected from:', source, error);\n \n // Immediately clear all Next.js caches for chunk errors\n const clearAndReload = () =\u003e {\n if ('caches' in window) {\n caches.keys().then(names =\u003e {\n // Clear all Next.js and static caches\n const nextCaches = names.filter(name =\u003e \n name.includes('next') || \n name.includes('static') || \n name.includes('webpack') ||\n name.includes('chunk')\n );\n \n if (nextCaches.length \u003e 0) {\n Promise.all(nextCaches.map(name =\u003e caches.delete(name)))\n .then(() =\u003e {\n console.log('Cleared caches, reloading...');\n window.location.reload(true);\n })\n .catch(() =\u003e {\n // Fallback reload if cache clearing fails\n window.location.reload(true);\n });\n } else {\n window.location.reload(true);\n }\n }).catch(() =\u003e {\n // Fallback reload if cache access fails\n window.location.reload(true);\n });\n } else {\n window.location.reload(true);\n }\n };\n \n // Clear localStorage items that might be causing issues\n try {\n localStorage.removeItem('lastBuildTime');\n localStorage.removeItem('lastKnownBuildTime');\n } catch (e) {\n console.warn('Could not clear localStorage:', e);\n }\n \n // Immediate reload for chunk errors\n clearAndReload();\n };\n \n // Enhanced error listeners for chunk load errors\n window.addEventListener('error', function(e) {\n const errorMessage = e.message || '';\n const errorSource = e.filename || '';\n \n if (errorMessage.includes('ChunkLoadError') || \n errorMessage.includes('Loading chunk') ||\n errorMessage.includes('Loading CSS chunk') ||\n errorSource.includes('_next/static/chunks/')) {\n handleChunkError(e, 'window.error');\n }\n });\n \n window.addEventListener('unhandledrejection', function(e) {\n const reason = e.reason ? e.reason.toString() : '';\n \n if (reason.includes('ChunkLoadError') || \n reason.includes('Loading chunk') ||\n reason.includes('Loading CSS chunk')) {\n handleChunkError(e.reason, 'unhandledrejection');\n }\n });\n \n // Additional error handling for fetch failures on chunks\n const originalFetch = window.fetch;\n window.fetch = function(...args) {\n return originalFetch.apply(this, args).catch(error =\u003e {\n const url = args[0];\n if (typeof url === 'string' \u0026\u0026 \n (url.includes('_next/static/chunks/') || url.includes('.js'))) {\n console.error('Fetch failed for chunk:', url, error);\n handleChunkError(error, 'fetch.failure');\n }\n throw error;\n });\n };\n "])