text: this.workbox=this.workbox||{},this.workbox.expiration=function(t,s,e,i,a,n,h){"use strict";try{self["workbox:expiration:6.1.5"]&&_()}catch(t){}const r="cache-entries",c=t=>{const s=new URL(t,location.href);return s.hash="",s.href};class o{constructor(t){this.T=t,this.i=new e.DBWrapper("workbox-expiration",1,{onupgradeneeded:t=>this.M(t)})}M(t){const s=t.target.result.createObjectStore(r,{keyPath:"id"});s.createIndex("cacheName","cacheName",{unique:!1}),s.createIndex("timestamp","timestamp",{unique:!1}),i.deleteDatabase(this.T)}async setTimestamp(t,s){const e={url:t=c(t),timestamp:s,cacheName:this.T,id:this.L(t)};await this.i.put(r,e)}async getTimestamp(t){return(await this.i.get(r,this.L(t))).timestamp}async expireEntries(t,s){const e=await this.i.transaction(r,"readwrite",((e,i)=>{const a=e.objectStore(r).index("timestamp").openCursor(null,"prev"),n=[];let h=0;a.onsuccess=()=>{const e=a.result;if(e){const i=e.value;i.cacheName===this.T&&(t&&i.timestamp<t||s&&h>=s?n.push(e.value):h++),e.continue()}else i(n)}})),i=[];for(const t of e)await this.i.delete(r,t.id),i.push(t.url);return i}L(t){return this.T+"|"+c(t)}}class u{constructor(t,s={}){this.F=!1,this.H=!1,this.I=s.maxEntries,this.G=s.maxAgeSeconds,this.J=s.matchOptions,this.T=t,this.V=new o(t)}async expireEntries(){if(this.F)return void(this.H=!0);this.F=!0;const t=this.G?Date.now()-1e3*this.G:0,e=await this.V.expireEntries(t,this.I),i=await self.caches.open(this.T);for(const t of e)await i.delete(t,this.J);this.F=!1,this.H&&(this.H=!1,s.dontWaitFor(this.expireEntries()))}async updateTimestamp(t){await this.V.setTimestamp(t,Date.now())}async isURLExpired(t){if(this.G){return await this.V.getTimestamp(t)<Date.now()-1e3*this.G}return!1}async delete(){this.H=!1,await this.V.expireEntries(1/0)}}return t.CacheExpiration=u,t.ExpirationPlugin=class{constructor(t={}){this.cachedResponseWillBeUsed=async({event:t,request:e,cacheName:i,cachedResponse:a})=>{if(!a)return null;const n=this.W(a),h=this.X(i);s.dontWaitFor(h.expireEntries());const r=h.updateTimestamp(e.url);if(t)try{t.waitUntil(r)}catch(t){}return n?a:null},this.cacheDidUpdate=async({cacheName:t,request:s})=>{const e=this.X(t);await e.updateTimestamp(s.url),await e.expireEntries()},this.Y=t,this.G=t.maxAgeSeconds,this.Z=new Map,t.purgeOnQuotaError&&n.registerQuotaErrorCallback((()=>this.deleteCacheAndMetadata()))}X(t){if(t===a.cacheNames.getRuntimeName())throw new h.WorkboxError("expire-custom-caches-only");let s=this.Z.get(t);return s||(s=new u(t,this.Y),this.Z.set(t,s)),s}W(t){if(!this.G)return!0;const s=this.tt(t);if(null===s)return!0;return s>=Date.now()-1e3*this.G}tt(t){if(!t.headers.has("date"))return null;const s=t.headers.get("date"),e=new Date(s).getTime();return isNaN(e)?null:e}async deleteCacheAndMetadata(){for(const[t,s]of this.Z)await self.caches.delete(t),await s.delete();this.Z=new Map}},t}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core,workbox.core._private);
  //# sourceMappingURL=workbox-expiration.prod.js.map
  