/* PWP register */
( function() {
const PwpSwVersion = 'pwp-21bffcf8';
importScripts('https://news.mongabay.com/wp-content/plugins/progressive-wp/assets/workbox-v3.4.1/workbox-sw.js');if(workbox){workbox.precaching.precache(["https:\/\/news.mongabay.com","","https:\/\/news.mongabay.com\/about\/","https:\/\/cdn.ampproject.org\/v0.js","https:\/\/cdn.ampproject.org\/v0\/amp-install-serviceworker-0.1.js","https:\/\/cdn.ampproject.org\/shadow-v0.js"]);workbox.routing.registerRoute(/wp-admin(.*)|(.*)preview=true(.*)/,workbox.strategies.networkOnly());workbox.routing.registerRoute(/(.*)cdn\.ampproject\.org(.*)/,workbox.strategies.staleWhileRevalidate({cacheName:PwpSwVersion+'-amp'}));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://news.mongabay.com/wp-json/.*'),workbox.strategies.networkOnly({cacheName:PwpSwVersion+'-rest'}));workbox.routing.registerRoute(new RegExp('https://news.mongabay.com.*\.(woff|eot|woff2|ttf|svg)'),workbox.strategies.cacheFirst({cacheName:PwpSwVersion+'-fonts'}));workbox.routing.registerRoute(new RegExp('https://news.mongabay.com.*\.(png|jpg|jpeg|gif|ico)'),workbox.strategies.cacheFirst({cacheName:PwpSwVersion+'-images'}));workbox.routing.registerRoute(new RegExp('https://news.mongabay.com.*\.(css|js)'),workbox.strategies.staleWhileRevalidate({cacheName:PwpSwVersion+'-static'}));workbox.routing.registerRoute(new RegExp('https://news.mongabay.com.*'),async(args)=>{try{const response=await workbox.strategies.networkFirst({cacheName:PwpSwVersion+'-default'}).handle(args);return response||await caches.match('https://news.mongabay.com/about/')}catch(error){console.log('catch:',error);return await caches.match('https://news.mongabay.com/about/')}})}
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)}}}))}))})
} )();importScripts('https://cdn.onesignal.com/sdks/OneSignalSDKWorker.js');