const CACHE = 'globinours-shell-v2';
const SHELL = ['/manifest.webmanifest','/favicon.ico','/pwa-icon-192.png','/pwa-icon-512.png','/assets/logo-globinours-64.png','/assets/mobile.css','/assets/pwa.js'];
self.addEventListener('install', event => event.waitUntil(caches.open(CACHE).then(cache => cache.addAll(SHELL)).then(() => self.skipWaiting())));
self.addEventListener('activate', event => event.waitUntil(caches.keys().then(keys => Promise.all(keys.filter(key => key !== CACHE).map(key => caches.delete(key)))).then(() => self.clients.claim())));
self.addEventListener('fetch', event => {const request=event.request;if(request.method!=='GET')return;const url=new URL(request.url);if(url.origin!==location.origin||request.mode==='navigate'||!SHELL.includes(url.pathname))return;event.respondWith(caches.match(request).then(cached=>cached||fetch(request)));});
