/** * Service worker registration for offline product browsing. * localhost-only gate: in dev the SW caches HTML + module responses and * serves stale graphs after files are deleted/renamed. */ if ('serviceWorker' in navigator && !['localhost', '127.0.0.1'].includes(location.hostname)) { window.addEventListener('load', () => { navigator.serviceWorker.register('/sw.js').catch(() => {}); }); }