try{self["workbox:core:7.3.0"]&&_()}catch{}const se=(s,...e)=>{let t=s;return e.length>0&&(t+=` :: ${JSON.stringify(e)}`),t},ne=se;class u extends Error{constructor(e,t){const n=ne(e,t);super(n),this.name=e,this.details=t}}try{self["workbox:routing:7.3.0"]&&_()}catch{}const z="GET",T=s=>s&&typeof s=="object"?s:{handle:s};class w{constructor(e,t,n=z){this.handler=T(t),this.match=e,this.method=n}setCatchHandler(e){this.catchHandler=T(e)}}class B extends w{constructor(e,t,n){const a=({url:r})=>{const i=e.exec(r.href);if(i&&!(r.origin!==location.origin&&i.index!==0))return i.slice(1)};super(a,t,n)}}const ae=s=>new URL(String(s),location.href).href.replace(new RegExp(`^${location.origin}`),"");class ie{constructor(){this._routes=new Map,this._defaultHandlerMap=new Map}get routes(){return this._routes}addFetchListener(){self.addEventListener("fetch",(e=>{const{request:t}=e,n=this.handleRequest({request:t,event:e});n&&e.respondWith(n)}))}addCacheListener(){self.addEventListener("message",(e=>{if(e.data&&e.data.type==="CACHE_URLS"){const{payload:t}=e.data,n=Promise.all(t.urlsToCache.map(a=>{typeof a=="string"&&(a=[a]);const r=new Request(...a);return this.handleRequest({request:r,event:e})}));e.waitUntil(n),e.ports&&e.ports[0]&&n.then(()=>e.ports[0].postMessage(!0))}}))}handleRequest({request:e,event:t}){const n=new URL(e.url,location.href);if(!n.protocol.startsWith("http"))return;const a=n.origin===location.origin,{params:r,route:i}=this.findMatchingRoute({event:t,request:e,sameOrigin:a,url:n});let o=i&&i.handler;const c=e.method;if(!o&&this._defaultHandlerMap.has(c)&&(o=this._defaultHandlerMap.get(c)),!o)return;let l;try{l=o.handle({url:n,request:e,event:t,params:r})}catch(h){l=Promise.reject(h)}const d=i&&i.catchHandler;return l instanceof Promise&&(this._catchHandler||d)&&(l=l.catch(async h=>{if(d)try{return await d.handle({url:n,request:e,event:t,params:r})}catch(m){m instanceof Error&&(h=m)}if(this._catchHandler)return this._catchHandler.handle({url:n,request:e,event:t});throw h})),l}findMatchingRoute({url:e,sameOrigin:t,request:n,event:a}){const r=this._routes.get(n.method)||[];for(const i of r){let o;const c=i.match({url:e,sameOrigin:t,request:n,event:a});if(c)return o=c,(Array.isArray(o)&&o.length===0||c.constructor===Object&&Object.keys(c).length===0||typeof c=="boolean")&&(o=void 0),{route:i,params:o}}return{}}setDefaultHandler(e,t=z){this._defaultHandlerMap.set(t,T(e))}setCatchHandler(e){this._catchHandler=T(e)}registerRoute(e){this._routes.has(e.method)||this._routes.set(e.method,[]),this._routes.get(e.method).push(e)}unregisterRoute(e){if(!this._routes.has(e.method))throw new u("unregister-route-but-not-found-with-method",{method:e.method});const t=this._routes.get(e.method).indexOf(e);if(t>-1)this._routes.get(e.method).splice(t,1);else throw new u("unregister-route-route-not-registered")}}let D;const re=()=>(D||(D=new ie,D.addFetchListener(),D.addCacheListener()),D);function y(s,e,t){let n;if(typeof s=="string"){const r=new URL(s,location.href),i=({url:o})=>o.href===r.href;n=new w(i,e,t)}else if(s instanceof RegExp)n=new B(s,e,t);else if(typeof s=="function")n=new w(s,e,t);else if(s instanceof w)n=s;else throw new u("unsupported-route-type",{moduleName:"workbox-routing",funcName:"registerRoute",paramName:"capture"});return re().registerRoute(n),n}try{self["workbox:strategies:7.3.0"]&&_()}catch{}const G={cacheWillUpdate:async({response:s})=>s.status===200||s.status===0?s:null},f={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:typeof registration<"u"?registration.scope:""},A=s=>[f.prefix,s,f.suffix].filter(e=>e&&e.length>0).join("-"),oe=s=>{for(const e of Object.keys(f))s(e)},j={updateDetails:s=>{oe(e=>{typeof s[e]=="string"&&(f[e]=s[e])})},getGoogleAnalyticsName:s=>s||A(f.googleAnalytics),getPrecacheName:s=>s||A(f.precache),getPrefix:()=>f.prefix,getRuntimeName:s=>s||A(f.runtime),getSuffix:()=>f.suffix};function K(s,e){const t=new URL(s);for(const n of e)t.searchParams.delete(n);return t.href}async function ce(s,e,t,n){const a=K(e.url,t);if(e.url===a)return s.match(e,n);const r=Object.assign(Object.assign({},n),{ignoreSearch:!0}),i=await s.keys(e,r);for(const o of i){const c=K(o.url,t);if(a===c)return s.match(o,n)}}class le{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}const J=new Set;async function he(){for(const s of J)await s()}function ue(s){return new Promise(e=>setTimeout(e,s))}function P(s){return typeof s=="string"?new Request(s):s}class de{constructor(e,t){this._cacheKeys={},Object.assign(this,t),this.event=t.event,this._strategy=e,this._handlerDeferred=new le,this._extendLifetimePromises=[],this._plugins=[...e.plugins],this._pluginStateMap=new Map;for(const n of this._plugins)this._pluginStateMap.set(n,{});this.event.waitUntil(this._handlerDeferred.promise)}async fetch(e){const{event:t}=this;let n=P(e);if(n.mode==="navigate"&&t instanceof FetchEvent&&t.preloadResponse){const i=await t.preloadResponse;if(i)return i}const a=this.hasCallback("fetchDidFail")?n.clone():null;try{for(const i of this.iterateCallbacks("requestWillFetch"))n=await i({request:n.clone(),event:t})}catch(i){if(i instanceof Error)throw new u("plugin-error-request-will-fetch",{thrownErrorMessage:i.message})}const r=n.clone();try{let i;i=await fetch(n,n.mode==="navigate"?void 0:this._strategy.fetchOptions);for(const o of this.iterateCallbacks("fetchDidSucceed"))i=await o({event:t,request:r,response:i});return i}catch(i){throw a&&await this.runCallbacks("fetchDidFail",{error:i,event:t,originalRequest:a.clone(),request:r.clone()}),i}}async fetchAndCachePut(e){const t=await this.fetch(e),n=t.clone();return this.waitUntil(this.cachePut(e,n)),t}async cacheMatch(e){const t=P(e);let n;const{cacheName:a,matchOptions:r}=this._strategy,i=await this.getCacheKey(t,"read"),o=Object.assign(Object.assign({},r),{cacheName:a});n=await caches.match(i,o);for(const c of this.iterateCallbacks("cachedResponseWillBeUsed"))n=await c({cacheName:a,matchOptions:r,cachedResponse:n,request:i,event:this.event})||void 0;return n}async cachePut(e,t){const n=P(e);await ue(0);const a=await this.getCacheKey(n,"write");if(!t)throw new u("cache-put-with-no-response",{url:ae(a.url)});const r=await this._ensureResponseSafeToCache(t);if(!r)return!1;const{cacheName:i,matchOptions:o}=this._strategy,c=await self.caches.open(i),l=this.hasCallback("cacheDidUpdate"),d=l?await ce(c,a.clone(),["__WB_REVISION__"],o):null;try{await c.put(a,l?r.clone():r)}catch(h){if(h instanceof Error)throw h.name==="QuotaExceededError"&&await he(),h}for(const h of this.iterateCallbacks("cacheDidUpdate"))await h({cacheName:i,oldResponse:d,newResponse:r.clone(),request:a,event:this.event});return!0}async getCacheKey(e,t){const n=`${e.url} | ${t}`;if(!this._cacheKeys[n]){let a=e;for(const r of this.iterateCallbacks("cacheKeyWillBeUsed"))a=P(await r({mode:t,request:a,event:this.event,params:this.params}));this._cacheKeys[n]=a}return this._cacheKeys[n]}hasCallback(e){for(const t of this._strategy.plugins)if(e in t)return!0;return!1}async runCallbacks(e,t){for(const n of this.iterateCallbacks(e))await n(t)}*iterateCallbacks(e){for(const t of this._strategy.plugins)if(typeof t[e]=="function"){const n=this._pluginStateMap.get(t);yield r=>{const i=Object.assign(Object.assign({},r),{state:n});return t[e](i)}}}waitUntil(e){return this._extendLifetimePromises.push(e),e}async doneWaiting(){for(;this._extendLifetimePromises.length;){const e=this._extendLifetimePromises.splice(0),n=(await Promise.allSettled(e)).find(a=>a.status==="rejected");if(n)throw n.reason}}destroy(){this._handlerDeferred.resolve(null)}async _ensureResponseSafeToCache(e){let t=e,n=!1;for(const a of this.iterateCallbacks("cacheWillUpdate"))if(t=await a({request:this.request,response:t,event:this.event})||void 0,n=!0,!t)break;return n||t&&t.status!==200&&(t=void 0),t}}class O{constructor(e={}){this.cacheName=j.getRuntimeName(e.cacheName),this.plugins=e.plugins||[],this.fetchOptions=e.fetchOptions,this.matchOptions=e.matchOptions}handle(e){const[t]=this.handleAll(e);return t}handleAll(e){e instanceof FetchEvent&&(e={event:e,request:e.request});const t=e.event,n=typeof e.request=="string"?new Request(e.request):e.request,a="params"in e?e.params:void 0,r=new de(this,{event:t,request:n,params:a}),i=this._getResponse(r,n,t),o=this._awaitComplete(i,r,n,t);return[i,o]}async _getResponse(e,t,n){await e.runCallbacks("handlerWillStart",{event:n,request:t});let a;try{if(a=await this._handle(t,e),!a||a.type==="error")throw new u("no-response",{url:t.url})}catch(r){if(r instanceof Error){for(const i of e.iterateCallbacks("handlerDidError"))if(a=await i({error:r,event:n,request:t}),a)break}if(!a)throw r}for(const r of e.iterateCallbacks("handlerWillRespond"))a=await r({event:n,request:t,response:a});return a}async _awaitComplete(e,t,n,a){let r,i;try{r=await e}catch{}try{await t.runCallbacks("handlerDidRespond",{event:a,request:n,response:r}),await t.doneWaiting()}catch(o){o instanceof Error&&(i=o)}if(await t.runCallbacks("handlerDidComplete",{event:a,request:n,response:r,error:i}),t.destroy(),i)throw i}}class H extends O{constructor(e={}){super(e),this.plugins.some(t=>"cacheWillUpdate"in t)||this.plugins.unshift(G)}async _handle(e,t){const n=t.fetchAndCachePut(e).catch(()=>{});t.waitUntil(n);let a=await t.cacheMatch(e),r;if(!a)try{a=await n}catch(i){i instanceof Error&&(r=i)}if(!a)throw new u("no-response",{url:e.url,error:r});return a}}class Z extends O{async _handle(e,t){let n=await t.cacheMatch(e),a;if(!n)try{n=await t.fetchAndCachePut(e)}catch(r){r instanceof Error&&(a=r)}if(!n)throw new u("no-response",{url:e.url,error:a});return n}}try{self["workbox:cacheable-response:7.3.0"]&&_()}catch{}class fe{constructor(e={}){this._statuses=e.statuses,this._headers=e.headers}isResponseCacheable(e){let t=!0;return this._statuses&&(t=this._statuses.includes(e.status)),this._headers&&t&&(t=Object.keys(this._headers).some(n=>e.headers.get(n)===this._headers[n])),t}}class b{constructor(e){this.cacheWillUpdate=async({response:t})=>this._cacheableResponse.isResponseCacheable(t)?t:null,this._cacheableResponse=new fe(e)}}function X(s){s.then(()=>{})}function pe(s){J.add(s)}const me=(s,e)=>e.some(t=>s instanceof t);let q,V;function we(){return q||(q=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function ge(){return V||(V=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Y=new WeakMap,M=new WeakMap,ee=new WeakMap,S=new WeakMap,W=new WeakMap;function ye(s){const e=new Promise((t,n)=>{const a=()=>{s.removeEventListener("success",r),s.removeEventListener("error",i)},r=()=>{t(p(s.result)),a()},i=()=>{n(s.error),a()};s.addEventListener("success",r),s.addEventListener("error",i)});return e.then(t=>{t instanceof IDBCursor&&Y.set(t,s)}).catch(()=>{}),W.set(e,s),e}function _e(s){if(M.has(s))return;const e=new Promise((t,n)=>{const a=()=>{s.removeEventListener("complete",r),s.removeEventListener("error",i),s.removeEventListener("abort",i)},r=()=>{t(),a()},i=()=>{n(s.error||new DOMException("AbortError","AbortError")),a()};s.addEventListener("complete",r),s.addEventListener("error",i),s.addEventListener("abort",i)});M.set(s,e)}let U={get(s,e,t){if(s instanceof IDBTransaction){if(e==="done")return M.get(s);if(e==="objectStoreNames")return s.objectStoreNames||ee.get(s);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return p(s[e])},set(s,e,t){return s[e]=t,!0},has(s,e){return s instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in s}};function be(s){U=s(U)}function Ce(s){return s===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const n=s.call(v(this),e,...t);return ee.set(n,e.sort?e.sort():[e]),p(n)}:ge().includes(s)?function(...e){return s.apply(v(this),e),p(Y.get(this))}:function(...e){return p(s.apply(v(this),e))}}function xe(s){return typeof s=="function"?Ce(s):(s instanceof IDBTransaction&&_e(s),me(s,we())?new Proxy(s,U):s)}function p(s){if(s instanceof IDBRequest)return ye(s);if(S.has(s))return S.get(s);const e=xe(s);return e!==s&&(S.set(s,e),W.set(e,s)),e}const v=s=>W.get(s);function Re(s,e,{blocked:t,upgrade:n,blocking:a,terminated:r}={}){const i=indexedDB.open(s,e),o=p(i);return n&&i.addEventListener("upgradeneeded",c=>{n(p(i.result),c.oldVersion,c.newVersion,p(i.transaction),c)}),t&&i.addEventListener("blocked",c=>t(c.oldVersion,c.newVersion,c)),o.then(c=>{r&&c.addEventListener("close",()=>r()),a&&c.addEventListener("versionchange",l=>a(l.oldVersion,l.newVersion,l))}).catch(()=>{}),o}function Ee(s,{blocked:e}={}){const t=indexedDB.deleteDatabase(s);return e&&t.addEventListener("blocked",n=>e(n.oldVersion,n)),p(t).then(()=>{})}const De=["get","getKey","getAll","getAllKeys","count"],ke=["put","add","delete","clear"],L=new Map;function $(s,e){if(!(s instanceof IDBDatabase&&!(e in s)&&typeof e=="string"))return;if(L.get(e))return L.get(e);const t=e.replace(/FromIndex$/,""),n=e!==t,a=ke.includes(t);if(!(t in(n?IDBIndex:IDBObjectStore).prototype)||!(a||De.includes(t)))return;const r=async function(i,...o){const c=this.transaction(i,a?"readwrite":"readonly");let l=c.store;return n&&(l=l.index(o.shift())),(await Promise.all([l[t](...o),a&&c.done]))[0]};return L.set(e,r),r}be(s=>({...s,get:(e,t,n)=>$(e,t)||s.get(e,t,n),has:(e,t)=>!!$(e,t)||s.has(e,t)}));try{self["workbox:expiration:7.3.0"]&&_()}catch{}const Ne="workbox-expiration",k="cache-entries",Q=s=>{const e=new URL(s,location.href);return e.hash="",e.href};class Ie{constructor(e){this._db=null,this._cacheName=e}_upgradeDb(e){const t=e.createObjectStore(k,{keyPath:"id"});t.createIndex("cacheName","cacheName",{unique:!1}),t.createIndex("timestamp","timestamp",{unique:!1})}_upgradeDbAndDeleteOldDbs(e){this._upgradeDb(e),this._cacheName&&Ee(this._cacheName)}async setTimestamp(e,t){e=Q(e);const n={url:e,timestamp:t,cacheName:this._cacheName,id:this._getId(e)},r=(await this.getDb()).transaction(k,"readwrite",{durability:"relaxed"});await r.store.put(n),await r.done}async getTimestamp(e){const n=await(await this.getDb()).get(k,this._getId(e));return n?.timestamp}async expireEntries(e,t){const n=await this.getDb();let a=await n.transaction(k).store.index("timestamp").openCursor(null,"prev");const r=[];let i=0;for(;a;){const c=a.value;c.cacheName===this._cacheName&&(e&&c.timestamp=t?r.push(a.value):i++),a=await a.continue()}const o=[];for(const c of r)await n.delete(k,c.id),o.push(c.url);return o}_getId(e){return this._cacheName+"|"+Q(e)}async getDb(){return this._db||(this._db=await Re(Ne,1,{upgrade:this._upgradeDbAndDeleteOldDbs.bind(this)})),this._db}}class Pe{constructor(e,t={}){this._isRunning=!1,this._rerunRequested=!1,this._maxEntries=t.maxEntries,this._maxAgeSeconds=t.maxAgeSeconds,this._matchOptions=t.matchOptions,this._cacheName=e,this._timestampModel=new Ie(e)}async expireEntries(){if(this._isRunning){this._rerunRequested=!0;return}this._isRunning=!0;const e=this._maxAgeSeconds?Date.now()-this._maxAgeSeconds*1e3:0,t=await this._timestampModel.expireEntries(e,this._maxEntries),n=await self.caches.open(this._cacheName);for(const a of t)await n.delete(a,this._matchOptions);this._isRunning=!1,this._rerunRequested&&(this._rerunRequested=!1,X(this.expireEntries()))}async updateTimestamp(e){await this._timestampModel.setTimestamp(e,Date.now())}async isURLExpired(e){if(this._maxAgeSeconds){const t=await this._timestampModel.getTimestamp(e),n=Date.now()-this._maxAgeSeconds*1e3;return t!==void 0?t{if(!r)return null;const i=this._isResponseDateFresh(r),o=this._getCacheExpiration(a);X(o.expireEntries());const c=o.updateTimestamp(n.url);if(t)try{t.waitUntil(c)}catch{}return i?r:null},this.cacheDidUpdate=async({cacheName:t,request:n})=>{const a=this._getCacheExpiration(t);await a.updateTimestamp(n.url),await a.expireEntries()},this._config=e,this._maxAgeSeconds=e.maxAgeSeconds,this._cacheExpirations=new Map,e.purgeOnQuotaError&&pe(()=>this.deleteCacheAndMetadata())}_getCacheExpiration(e){if(e===j.getRuntimeName())throw new u("expire-custom-caches-only");let t=this._cacheExpirations.get(e);return t||(t=new Pe(e,this._config),this._cacheExpirations.set(e,t)),t}_isResponseDateFresh(e){if(!this._maxAgeSeconds)return!0;const t=this._getDateHeaderTimestamp(e);if(t===null)return!0;const n=Date.now();return t>=n-this._maxAgeSeconds*1e3}_getDateHeaderTimestamp(e){if(!e.headers.has("date"))return null;const t=e.headers.get("date"),a=new Date(t).getTime();return isNaN(a)?null:a}async deleteCacheAndMetadata(){for(const[e,t]of this._cacheExpirations)await self.caches.delete(e),await t.delete();this._cacheExpirations=new Map}}try{self["workbox:recipes:7.3.0"]&&_()}catch{}function Te(s){self.addEventListener("install",e=>{const t=s.urls.map(n=>s.strategy.handleAll({event:e,request:new Request(n)})[1]);e.waitUntil(Promise.all(t))})}class te extends O{constructor(e={}){super(e),this.plugins.some(t=>"cacheWillUpdate"in t)||this.plugins.unshift(G),this._networkTimeoutSeconds=e.networkTimeoutSeconds||0}async _handle(e,t){const n=[],a=[];let r;if(this._networkTimeoutSeconds){const{id:c,promise:l}=this._getTimeoutPromise({request:e,logs:n,handler:t});r=c,a.push(l)}const i=this._getNetworkPromise({timeoutId:r,request:e,logs:n,handler:t});a.push(i);const o=await t.waitUntil((async()=>await t.waitUntil(Promise.race(a))||await i)());if(!o)throw new u("no-response",{url:e.url});return o}_getTimeoutPromise({request:e,logs:t,handler:n}){let a;return{promise:new Promise(i=>{a=setTimeout(async()=>{i(await n.cacheMatch(e))},this._networkTimeoutSeconds*1e3)}),id:a}}async _getNetworkPromise({timeoutId:e,request:t,logs:n,handler:a}){let r,i;try{i=await a.fetchAndCachePut(t)}catch(o){o instanceof Error&&(r=o)}return e&&clearTimeout(e),(r||!i)&&(i=await a.cacheMatch(t)),i}}function Oe(s={}){const e=({request:o})=>o.mode==="navigate",t=s.cacheName||"pages",n=s.matchCallback||e,a=s.networkTimeoutSeconds||3,r=s.plugins||[];r.push(new b({statuses:[0,200]}));const i=new te({networkTimeoutSeconds:a,cacheName:t,plugins:r});y(n,i),s.warmCache&&Te({urls:s.warmCache,strategy:i})}try{self["workbox:precaching:7.3.0"]&&_()}catch{}let N;function Ae(){if(N===void 0){const s=new Response("");if("body"in s)try{new Response(s.body),N=!0}catch{N=!1}N=!1}return N}async function Se(s,e){let t=null;if(s.url&&(t=new URL(s.url).origin),t!==self.location.origin)throw new u("cross-origin-copy-response",{origin:t});const n=s.clone(),r={headers:new Headers(n.headers),status:n.status,statusText:n.statusText},i=Ae()?n.body:await n.blob();return new Response(i,r)}class g extends O{constructor(e={}){e.cacheName=j.getPrecacheName(e.cacheName),super(e),this._fallbackToNetwork=e.fallbackToNetwork!==!1,this.plugins.push(g.copyRedirectedCacheableResponsesPlugin)}async _handle(e,t){const n=await t.cacheMatch(e);return n||(t.event&&t.event.type==="install"?await this._handleInstall(e,t):await this._handleFetch(e,t))}async _handleFetch(e,t){let n;const a=t.params||{};if(this._fallbackToNetwork){const r=a.integrity,i=e.integrity,o=!i||i===r;n=await t.fetch(new Request(e,{integrity:e.mode!=="no-cors"?i||r:void 0})),r&&o&&e.mode!=="no-cors"&&(this._useDefaultCacheabilityPluginIfNeeded(),await t.cachePut(e,n.clone()))}else throw new u("missing-precache-entry",{cacheName:this.cacheName,url:e.url});return n}async _handleInstall(e,t){this._useDefaultCacheabilityPluginIfNeeded();const n=await t.fetch(e);if(!await t.cachePut(e,n.clone()))throw new u("bad-precaching-response",{url:e.url,status:n.status});return n}_useDefaultCacheabilityPluginIfNeeded(){let e=null,t=0;for(const[n,a]of this.plugins.entries())a!==g.copyRedirectedCacheableResponsesPlugin&&(a===g.defaultPrecacheCacheabilityPlugin&&(e=n),a.cacheWillUpdate&&t++);t===0?this.plugins.push(g.defaultPrecacheCacheabilityPlugin):t>1&&e!==null&&this.plugins.splice(e,1)}}g.defaultPrecacheCacheabilityPlugin={async cacheWillUpdate({response:s}){return!s||s.status>=400?null:s}};g.copyRedirectedCacheableResponsesPlugin={async cacheWillUpdate({response:s}){return s.redirected?await Se(s):s}};try{self["workbox:navigation-preload:7.3.0"]&&_()}catch{}function ve(){return!!(self.registration&&self.registration.navigationPreload)}function Le(s){ve()&&self.addEventListener("activate",e=>{e.waitUntil(self.registration.navigationPreload.enable().then(()=>{}))})}Le();self.__WB_DISABLE_DEV_LOGS=!0;Oe({warmCache:["./compose/"]});class Me{constructor(e={}){this.maxHashes=e.maxHashes||2,this.dbName="workbox-expiration",this.storeName="cache-entries"}_getBaseName(e){const r=new URL(e).pathname.split("/").pop().match(/^(.+?)-[A-Za-z0-9_-]{8,}\.(js|css)$/);return r?r[1]:null}async _getTimestampsFromDB(e,t){try{const n=await new Promise((o,c)=>{const l=indexedDB.open(this.dbName);l.onsuccess=()=>o(l.result),l.onerror=()=>c(l.error)}),r=n.transaction(this.storeName,"readonly").objectStore(this.storeName),i=await Promise.all(t.map(o=>{const c=`${e}|${o}`;return new Promise(l=>{const d=r.get(c);d.onsuccess=()=>l(d.result?.timestamp||Date.now()),d.onerror=()=>l(Date.now())})}));return n.close(),i}catch(n){return console.warn("[AssetHashPlugin] Error reading timestamps from IndexedDB:",n),t.map(()=>Date.now())}}cacheDidUpdate({cacheName:e,request:t}){this._cleanupOldHashes(e,t.url)}async _cleanupOldHashes(e,t){try{const n=this._getBaseName(t);if(!n)return;const a=await caches.open(e),r=await a.keys(),i=[];for(const h of r)this._getBaseName(h.url)===n&&await a.match(h)&&i.push(h);if(i.length<=this.maxHashes)return;const o=i.map(h=>h.url),c=await this._getTimestampsFromDB(e,o),l=i.map((h,m)=>({request:h,url:h.url,timestamp:c[m]}));l.sort((h,m)=>m.timestamp-h.timestamp);const d=l.slice(this.maxHashes);for(const h of d)await a.delete(h.request),console.log(`[AssetHashPlugin] Deleted old hash: ${h.url}`)}catch(n){console.warn("[AssetHashPlugin] Error during cleanup:",n)}}}const E={purgeOnQuotaError:!0,matchOptions:{ignoreVary:!0}},Ue=new w(({request:s,sameOrigin:e})=>{const t=s.url.includes("/icons/");return e&&t},new Z({cacheName:"icons",plugins:[new R({maxEntries:300,maxAgeSeconds:4320*60,...E}),new b({statuses:[0,200]})]}));y(Ue);const Be=new w(({request:s,sameOrigin:e})=>{const t=s.destination==="style"||s.destination==="script",n=/-[0-9a-z-]{4,}\./i.test(s.url);return e&&t&&n},new H({cacheName:"assets",plugins:[new Me({maxHashes:2}),new R({maxEntries:40,...E}),new b({statuses:[0,200]})]}));y(Be);const je=new w(({request:s,sameOrigin:e})=>{const t=!e,n=s.destination==="image",a=s.url.includes("/avatars/"),r=s.url.includes("/custom/_emojis"),i=s.url.includes("/emoji/");return t&&n&&(a||r||i)},new Z({cacheName:"remote-images",plugins:[new R({maxEntries:30,...E}),new b({statuses:[0,200]})]}));y(je);const He=new B(/^https?:\/\/[^\/]+\/api\/v\d+\/(custom_emojis|lists\/\d+|announcements)$/,new H({cacheName:"api-extended",plugins:[new R({maxAgeSeconds:720*60,...E}),new b({statuses:[0,200]})]}));y(He);const We=new w(({request:s})=>s.headers.get("accept")?.includes("application/activity+json"),new H({cacheName:"activity-json",plugins:[new R({maxEntries:30,maxAgeSeconds:3600,...E}),new b({statuses:[0,200]})]}));y(We);const Fe=new B(/^https?:\/\/[^\/]+\/api\/v\d+\/(statuses\/\d+\/context)/,new te({cacheName:"api",networkTimeoutSeconds:5,plugins:[new R({maxEntries:30,maxAgeSeconds:300,...E}),new b({statuses:[0,200]})]}));y(Fe);self.addEventListener("push",s=>{const{data:e}=s;if(e){const t=e.json();console.log("PUSH payload",t);const{access_token:n,title:a,body:r,icon:i,notification_id:o,notification_type:c,preferred_locale:l}=t;navigator.setAppBadge&&c==="mention"&&navigator.setAppBadge(1),s.waitUntil(self.registration.showNotification(a,{body:r,icon:i,dir:"auto",badge:"/logo-badge-72.png",lang:l,tag:o,timestamp:Date.now(),data:{access_token:n,notification_type:c}}))}});self.addEventListener("notificationclick",s=>{const e=s.notification;console.log("NOTIFICATION CLICK payload",e);const{badge:t,body:n,data:a,dir:r,icon:i,lang:o,tag:c,timestamp:l,title:d}=e,{access_token:h,notification_type:m}=a,C=`/#/notifications?id=${c}&access_token=${btoa(h)}`;s.waitUntil((async()=>{const x=await self.clients.matchAll({type:"window",includeUncontrolled:!0});if(console.log("NOTIFICATION CLICK clients 1",x),x.length&&"navigate"in x[0]){console.log("NOTIFICATION CLICK clients 2",x);const I=x.find(F=>F.focused||F.visibilityState==="visible")||x[0];console.log("NOTIFICATION CLICK navigate",C),I?(console.log("NOTIFICATION CLICK postMessage",I),I.focus(),I.postMessage?.({type:"notification",id:c,accessToken:h})):(console.log("NOTIFICATION CLICK openWindow",C),await self.clients.openWindow(C))}else console.log("NOTIFICATION CLICK openWindow",C),await self.clients.openWindow(C);await s.notification.close()})())}); //# sourceMappingURL=sw.js.map