const CACHE='accounting-static-v16-2'; const ASSETS=[ './assets/css/style-custom.css','./assets/css/app-responsive.min.css','./assets/css/app-final.css', './assets/js/app-ui.min.js','./assets/js/app-network.js', './assets/vendor/bootstrap.min.css','./assets/vendor/bootstrap.bundle.min.js','./assets/vendor/jquery.min.js', './assets/img/pwa-192.png','./assets/img/pwa-512.png' ]; self.addEventListener('install',e=>e.waitUntil(caches.open(CACHE).then(c=>c.addAll(ASSETS)).then(()=>self.skipWaiting()))); self.addEventListener('activate',e=>e.waitUntil(caches.keys().then(keys=>Promise.all(keys.filter(key=>key!==CACHE).map(key=>caches.delete(key)))).then(()=>self.clients.claim()))); self.addEventListener('fetch',e=>{if(e.request.method!=='GET')return;const u=new URL(e.request.url);if(u.origin!==location.origin||!u.pathname.includes('/assets/'))return;e.respondWith(caches.match(e.request).then(cached=>cached||fetch(e.request).then(response=>{if(response.ok){const copy=response.clone();caches.open(CACHE).then(cache=>cache.put(e.request,copy));}return response;})));});