/* PWP register */
( function() {
const PwpSwVersion = 'pwp-d8b2a25a';
importScripts('https://www.france-banderole.com:443/wp-content/plugins/progressive-wp/assets/workbox-v3.4.1/workbox-sw.js');if(workbox){workbox.precaching.precache(["https:\/\/www.france-banderole.com:443","","https:\/\/www.france-banderole.com:443\/france-banderole\/"]);workbox.routing.registerRoute(/wp-admin(.*)|wp-json(.*)|(.*)preview=true(.*)/,workbox.strategies.networkOnly());workbox.routing.registerRoute(/(.*)fonts\.googleapis\.com(.*)/,workbox.strategies.staleWhileRevalidate({cacheName:PwpSwVersion+'-google-fonts'}));workbox.routing.registerRoute(/(.*)fonts\.gstatic\.com(.*)/,workbox.strategies.cacheFirst({cacheName:PwpSwVersion+'-google-fonts'}));workbox.routing.registerRoute(/(.*)secure\.gravatar\.com(.*)/,workbox.strategies.staleWhileRevalidate({cacheName:PwpSwVersion+'-gravatar'}));workbox.routing.registerRoute(new RegExp('https://www.france-banderole.com:443/wp-json/.*'),workbox.strategies.networkOnly({cacheName:PwpSwVersion+'-rest'}));workbox.routing.registerRoute(new RegExp('https://www.france-banderole.com:443.*\.(woff|eot|woff2|ttf|svg)'),workbox.strategies.cacheFirst({cacheName:PwpSwVersion+'-fonts'}));workbox.routing.registerRoute(new RegExp('https://www.france-banderole.com:443.*\.(png|jpg|jpeg|gif|ico)'),workbox.strategies.cacheFirst({cacheName:PwpSwVersion+'-images'}));workbox.routing.registerRoute(new RegExp('https://www.france-banderole.com:443.*\.(css|js)'),workbox.strategies.networkFirst({cacheName:PwpSwVersion+'-static'}));workbox.routing.registerRoute(new RegExp('https://www.france-banderole.com:443.*'),async(args)=>{try{const response=await workbox.strategies.networkFirst({cacheName:PwpSwVersion+'-default'}).handle(args);return response||await caches.match('https://www.france-banderole.com:443/france-banderole/')}catch(error){console.log('catch:',error);return await caches.match('https://www.france-banderole.com:443/france-banderole/')}})}
self.addEventListener('activate',(event)=>{event.waitUntil(caches.keys().then(keys=>{return Promise.all(keys.map(key=>{if(/^(workbox-precache)/.test(key)){}else if(/^(pwp-([a-zA-Z0-9]{8})-([a-z]*))/.test(key)){if(key.indexOf(PwpSwVersion)!==0){return caches.delete(key)}}}))}))})
} )();const pushLatestPush=self.registration.scope+'wp-content/pwp-latest-push.json';self.addEventListener('push',event=>{event.waitUntil(registration.pushManager.getSubscription().then(function(subscription){return fetch(pushLatestPush).then(function(response){return response.json().then(function(data){return self.registration.showNotification(data.title,{body:data.body,badge:data.badge,icon:data.icon,image:data.image})})})}))});self.addEventListener('notificationclick',event=>{const notification=event.notification;const action=event.action;if(action==='close'){notification.close()}else{event.waitUntil(fetch(pushLatestPush).then(function(response){return response.json().then(function(data){if(''!==data.redirect){clients.openWindow(data.redirect)}
notification.close()})}).catch(function(err){notification.close()}))}})