"use strict";importScripts("https://doy2mn9upadnk.cloudfront.net/javascripts/workbox/workbox-sw.js"),workbox.setConfig({modulePathPrefix:"https://doy2mn9upadnk.cloudfront.net/javascripts/workbox",debug:!1});var authUrls=["auth","session/sso_login"].map((t=>`/${t}`)),cacheVersion="1",discourseCacheName="discourse-"+cacheVersion,externalCacheName="external-"+cacheVersion;workbox.routing.registerRoute((function(t){return t.url.origin===location.origin&&!authUrls.some((e=>t.url.pathname.startsWith(e)))}),new workbox.strategies.NetworkFirst({cacheName:discourseCacheName,plugins:[new workbox.cacheableResponse.Plugin({statuses:[200]}),new workbox.expiration.Plugin({maxAgeSeconds:604800,maxEntries:250,purgeOnQuotaError:!0})]}));var cdnUrls=[];workbox.routing.registerRoute((function(t){return t.url.origin!==location.origin&&0===cdnUrls.filter((function(e){return t.url.href.startsWith(e)})).length}),new workbox.strategies.NetworkFirst({cacheName:externalCacheName,plugins:[new workbox.cacheableResponse.Plugin({statuses:[200]}),new workbox.expiration.Plugin({maxAgeSeconds:604800,maxEntries:250,purgeOnQuotaError:!0})]}));var idleThresholdTime=1e4,lastAction=-1;function isIdle(){return lastAction+idleThresholdTime<Date.now()}function showNotification(t,e,o,n,i,s,r){var a={body:e,icon:o,badge:n,data:{url:r,baseUrl:s},tag:i};return self.registration.showNotification(t,a)}self.addEventListener("push",(function(t){var e=t.data.json();if(!isIdle()&&e.hide_when_active)return!1;t.waitUntil(self.registration.getNotifications({tag:e.tag}).then((function(t){return t&&t.length>0&&t.forEach((function(t){t.close()})),showNotification(e.title,e.body,e.icon,e.badge,e.tag,e.base_url,e.url)})))})),self.addEventListener("notificationclick",(function(t){t.notification.close();var e=t.notification.data.url,o=t.notification.data.baseUrl;t.waitUntil(clients.matchAll({type:"window"}).then((function(t){if(!t.some((function(t){return t.url===o+e&&"focus"in t?(t.focus(),!0):"postMessage"in t&&"focus"in t&&(t.focus(),t.postMessage({url:e}),!0)}))&&clients.openWindow)return clients.openWindow(o+e)})))})),self.addEventListener("message",(function(t){"lastAction"in t.data&&(lastAction=t.data.lastAction)})),self.addEventListener("pushsubscriptionchange",(function(t){t.waitUntil(Promise.all(fetch("https://devforum.roblox.com/push_notifications/subscribe",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:new URLSearchParams({"subscription[endpoint]":t.newSubscription.endpoint,"subscription[keys][auth]":t.newSubscription.toJSON().keys.auth,"subscription[keys][p256dh]":t.newSubscription.toJSON().keys.p256dh,send_confirmation:!1})}),fetch("https://devforum.roblox.com/push_notifications/unsubscribe",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:new URLSearchParams({"subscription[endpoint]":t.oldSubscription.endpoint,"subscription[keys][auth]":t.oldSubscription.toJSON().keys.auth,"subscription[keys][p256dh]":t.oldSubscription.toJSON().keys.p256dh})})))}));
//# sourceMappingURL=https://doy2mn9upadnk.cloudfront.net/assets/service-worker-4e087ccca6f85f1b4857cf68ac0e5ca4aea145f432f063787e8390d9d11792fc.js.map