@nypl/web-reader 3.2.4 → 3.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ServiceWorker/sw.js +1 -1
- package/dist/cjs/ServiceWorker/sw.js.map +3 -3
- package/dist/cjs/index.js +15 -15
- package/dist/cjs/index.js.map +3 -3
- package/dist/esm/ServiceWorker/sw.js +147 -344
- package/dist/esm/ServiceWorker/sw.js.map +3 -3
- package/dist/esm/index.js +2958 -3677
- package/dist/esm/index.js.map +3 -3
- package/package.json +8 -8
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var A=Object.defineProperty,Pe=Object.defineProperties,qe=Object.getOwnPropertyDescriptor,We=Object.getOwnPropertyDescriptors,Ve=Object.getOwnPropertyNames,le=Object.getOwnPropertySymbols;var he=Object.prototype.hasOwnProperty,Ie=Object.prototype.propertyIsEnumerable;var pe=(r,e,t)=>e in r?A(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,R=(r,e)=>{for(var t in e||(e={}))he.call(e,t)&&pe(r,t,e[t]);if(le)for(var t of le(e))Ie.call(e,t)&&pe(r,t,e[t]);return r},k=(r,e)=>Pe(r,We(e)),Me=r=>A(r,"__esModule",{value:!0});var Fe=(r,e)=>{for(var t in e)A(r,t,{get:e[t],enumerable:!0})},Be=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Ve(e))!he.call(r,s)&&(t||s!=="default")&&A(r,s,{get:()=>e[s],enumerable:!(o=qe(e,s))||o.enumerable});return r};var je=(r=>(e,t)=>r&&r.get(e)||(t=Be(Me({}),e,1),r&&r.set(e,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var i=(r,e,t)=>new Promise((o,s)=>{var a=u=>{try{c(t.next(u))}catch(l){s(l)}},n=u=>{try{c(t.throw(u))}catch(l){s(l)}},c=u=>u.done?o(u.value):Promise.resolve(u.value).then(a,n);c((t=t.apply(r,e)).next())});var gt={};Fe(gt,{default:()=>Ae});try{self["workbox:core:6.2.4"]&&_()}catch(r){}var He=(r,...e)=>{let t=r;return e.length>0&&(t+=` :: ${JSON.stringify(e)}`),t};var de=He;var N=class extends Error{constructor(e,t){let o=de(e,t);super(o);this.name=e,this.details=t}};var Y=new Set;function J(r){Y.add(r)}var g={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:typeof registration!="undefined"?registration.scope:""},K=r=>[g.prefix,r,g.suffix].filter(e=>e&&e.length>0).join("-"),Ge=r=>{for(let e of Object.keys(g))r(e)},T={updateDetails:r=>{Ge(e=>{typeof r[e]=="string"&&(g[e]=r[e])})},getGoogleAnalyticsName:r=>r||K(g.googleAnalytics),getPrecacheName:r=>r||K(g.precache),getPrefix:()=>g.prefix,getRuntimeName:r=>r||K(g.runtime),getSuffix:()=>g.suffix};function C(r){r.then(()=>{})}function Q(){self.addEventListener("activate",()=>self.clients.claim())}var Qe=(r,e)=>e.some(t=>r instanceof t),me,fe;function Xe(){return me||(me=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Ze(){return fe||(fe=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var ge=new WeakMap,Z=new WeakMap,we=new WeakMap,X=new WeakMap,ee=new WeakMap;function ze(r){let e=new Promise((t,o)=>{let s=()=>{r.removeEventListener("success",a),r.removeEventListener("error",n)},a=()=>{t(f(r.result)),s()},n=()=>{o(r.error),s()};r.addEventListener("success",a),r.addEventListener("error",n)});return e.then(t=>{t instanceof IDBCursor&&ge.set(t,r)}).catch(()=>{}),ee.set(e,r),e}function et(r){if(Z.has(r))return;let e=new Promise((t,o)=>{let s=()=>{r.removeEventListener("complete",a),r.removeEventListener("error",n),r.removeEventListener("abort",n)},a=()=>{t(),s()},n=()=>{o(r.error||new DOMException("AbortError","AbortError")),s()};r.addEventListener("complete",a),r.addEventListener("error",n),r.addEventListener("abort",n)});Z.set(r,e)}var z={get(r,e,t){if(r instanceof IDBTransaction){if(e==="done")return Z.get(r);if(e==="objectStoreNames")return r.objectStoreNames||we.get(r);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return f(r[e])},set(r,e,t){return r[e]=t,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function ye(r){z=r(z)}function tt(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){let o=r.call(L(this),e,...t);return we.set(o,e.sort?e.sort():[e]),f(o)}:Ze().includes(r)?function(...e){return r.apply(L(this),e),f(ge.get(this))}:function(...e){return f(r.apply(L(this),e))}}function rt(r){return typeof r=="function"?tt(r):(r instanceof IDBTransaction&&et(r),Qe(r,Xe())?new Proxy(r,z):r)}function f(r){if(r instanceof IDBRequest)return ze(r);if(X.has(r))return X.get(r);let e=rt(r);return e!==r&&(X.set(r,e),ee.set(e,r)),e}var L=r=>ee.get(r);function be(r,e,{blocked:t,upgrade:o,blocking:s,terminated:a}={}){let n=indexedDB.open(r,e),c=f(n);return o&&n.addEventListener("upgradeneeded",u=>{o(f(n.result),u.oldVersion,u.newVersion,f(n.transaction))}),t&&n.addEventListener("blocked",()=>t()),c.then(u=>{a&&u.addEventListener("close",()=>a()),s&&u.addEventListener("versionchange",()=>s())}).catch(()=>{}),c}function xe(r,{blocked:e}={}){let t=indexedDB.deleteDatabase(r);return e&&t.addEventListener("blocked",()=>e()),f(t).then(()=>{})}var ot=["get","getKey","getAll","getAllKeys","count"],st=["put","add","delete","clear"],te=new Map;function Ee(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(te.get(e))return te.get(e);let t=e.replace(/FromIndex$/,""),o=e!==t,s=st.includes(t);if(!(t in(o?IDBIndex:IDBObjectStore).prototype)||!(s||ot.includes(t)))return;let a=function(n,...c){return i(this,null,function*(){let u=this.transaction(n,s?"readwrite":"readonly"),l=u.store;return o&&(l=l.index(c.shift())),(yield Promise.all([l[t](...c),s&&u.done]))[0]})};return te.set(e,a),a}ye(r=>k(R({},r),{get:(e,t,o)=>Ee(e,t)||r.get(e,t,o),has:(e,t)=>!!Ee(e,t)||r.has(e,t)}));try{self["workbox:expiration:6.2.4"]&&_()}catch(r){}var nt="workbox-expiration",O="cache-entries",Ne=r=>{let e=new URL(r,location.href);return e.hash="",e.href},re=class{constructor(e){this._db=null,this._cacheName=e}_upgradeDb(e){let t=e.createObjectStore(O,{keyPath:"id"});t.createIndex("cacheName","cacheName",{unique:!1}),t.createIndex("timestamp","timestamp",{unique:!1})}_upgradeDbAndDeleteOldDbs(e){this._upgradeDb(e),this._cacheName&&xe(this._cacheName)}setTimestamp(e,t){return i(this,null,function*(){e=Ne(e);let o={url:e,timestamp:t,cacheName:this._cacheName,id:this._getId(e)};yield(yield this.getDb()).put(O,o)})}getTimestamp(e){return i(this,null,function*(){let o=yield(yield this.getDb()).get(O,this._getId(e));return o==null?void 0:o.timestamp})}expireEntries(e,t){return i(this,null,function*(){let o=yield this.getDb(),s=yield o.transaction(O).store.index("timestamp").openCursor(null,"prev"),a=[],n=0;for(;s;){let u=s.value;u.cacheName===this._cacheName&&(e&&u.timestamp<e||t&&n>=t?a.push(s.value):n++),s=yield s.continue()}let c=[];for(let u of a)yield o.delete(O,u.id),c.push(u.url);return c})}_getId(e){return this._cacheName+"|"+Ne(e)}getDb(){return i(this,null,function*(){return this._db||(this._db=yield be(nt,1,{upgrade:this._upgradeDbAndDeleteOldDbs.bind(this)})),this._db})}};var P=class{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 re(e)}expireEntries(){return i(this,null,function*(){if(this._isRunning){this._rerunRequested=!0;return}this._isRunning=!0;let e=this._maxAgeSeconds?Date.now()-this._maxAgeSeconds*1e3:0,t=yield this._timestampModel.expireEntries(e,this._maxEntries),o=yield self.caches.open(this._cacheName);for(let s of t)yield o.delete(s,this._matchOptions);this._isRunning=!1,this._rerunRequested&&(this._rerunRequested=!1,C(this.expireEntries()))})}updateTimestamp(e){return i(this,null,function*(){yield this._timestampModel.setTimestamp(e,Date.now())})}isURLExpired(e){return i(this,null,function*(){if(this._maxAgeSeconds){let t=yield this._timestampModel.getTimestamp(e),o=Date.now()-this._maxAgeSeconds*1e3;return t!==void 0?t<o:!0}else return!1})}delete(){return i(this,null,function*(){this._rerunRequested=!1,yield this._timestampModel.expireEntries(1/0)})}};var q=class{constructor(e={}){this.cachedResponseWillBeUsed=n=>i(this,[n],function*({event:t,request:o,cacheName:s,cachedResponse:a}){if(!a)return null;let c=this._isResponseDateFresh(a),u=this._getCacheExpiration(s);C(u.expireEntries());let l=u.updateTimestamp(o.url);if(t)try{t.waitUntil(l)}catch(p){}return c?a:null}),this.cacheDidUpdate=s=>i(this,[s],function*({cacheName:t,request:o}){let a=this._getCacheExpiration(t);yield a.updateTimestamp(o.url),yield a.expireEntries()}),this._config=e,this._maxAgeSeconds=e.maxAgeSeconds,this._cacheExpirations=new Map,e.purgeOnQuotaError&&J(()=>this.deleteCacheAndMetadata())}_getCacheExpiration(e){if(e===T.getRuntimeName())throw new N("expire-custom-caches-only");let t=this._cacheExpirations.get(e);return t||(t=new P(e,this._config),this._cacheExpirations.set(e,t)),t}_isResponseDateFresh(e){if(!this._maxAgeSeconds)return!0;let t=this._getDateHeaderTimestamp(e);if(t===null)return!0;let o=Date.now();return t>=o-this._maxAgeSeconds*1e3}_getDateHeaderTimestamp(e){if(!e.headers.has("date"))return null;let t=e.headers.get("date"),s=new Date(t).getTime();return isNaN(s)?null:s}deleteCacheAndMetadata(){return i(this,null,function*(){for(let[e,t]of this._cacheExpirations)yield self.caches.delete(e),yield t.delete();this._cacheExpirations=new Map})}};try{self["workbox:core:6.5.3"]&&_()}catch(r){}var at=(r,...e)=>{let t=r;return e.length>0&&(t+=` :: ${JSON.stringify(e)}`),t};var $e=at;var d=class extends Error{constructor(e,t){let o=$e(e,t);super(o);this.name=e,this.details=t}};var w={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:typeof registration!="undefined"?registration.scope:""},oe=r=>[w.prefix,r,w.suffix].filter(e=>e&&e.length>0).join("-"),it=r=>{for(let e of Object.keys(w))r(e)},ve={updateDetails:r=>{it(e=>{typeof r[e]=="string"&&(w[e]=r[e])})},getGoogleAnalyticsName:r=>r||oe(w.googleAnalytics),getPrecacheName:r=>r||oe(w.precache),getPrefix:()=>w.prefix,getRuntimeName:r=>r||oe(w.runtime),getSuffix:()=>w.suffix};var se=r=>new URL(String(r),location.href).href.replace(new RegExp(`^${location.origin}`),"");function _e(r,e){let t=new URL(r);for(let o of e)t.searchParams.delete(o);return t.href}function Re(r,e,t,o){return i(this,null,function*(){let s=_e(e.url,t);if(e.url===s)return r.match(e,o);let a=Object.assign(Object.assign({},o),{ignoreSearch:!0}),n=yield r.keys(e,a);for(let c of n){let u=_e(c.url,t);if(s===u)return r.match(c,o)}})}var ne=class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}};var ke=new Set;function Te(){return i(this,null,function*(){for(let r of ke)yield r()})}function ae(r){return new Promise(e=>setTimeout(e,r))}try{self["workbox:strategies:6.5.3"]&&_()}catch(r){}function W(r){return typeof r=="string"?new Request(r):r}var V=class{constructor(e,t){this._cacheKeys={},Object.assign(this,t),this.event=t.event,this._strategy=e,this._handlerDeferred=new ne,this._extendLifetimePromises=[],this._plugins=[...e.plugins],this._pluginStateMap=new Map;for(let o of this._plugins)this._pluginStateMap.set(o,{});this.event.waitUntil(this._handlerDeferred.promise)}fetch(e){return i(this,null,function*(){let{event:t}=this,o=W(e);if(o.mode==="navigate"&&t instanceof FetchEvent&&t.preloadResponse){let n=yield t.preloadResponse;if(n)return n}let s=this.hasCallback("fetchDidFail")?o.clone():null;try{for(let n of this.iterateCallbacks("requestWillFetch"))o=yield n({request:o.clone(),event:t})}catch(n){if(n instanceof Error)throw new d("plugin-error-request-will-fetch",{thrownErrorMessage:n.message})}let a=o.clone();try{let n;n=yield fetch(o,o.mode==="navigate"?void 0:this._strategy.fetchOptions);for(let c of this.iterateCallbacks("fetchDidSucceed"))n=yield c({event:t,request:a,response:n});return n}catch(n){throw s&&(yield this.runCallbacks("fetchDidFail",{error:n,event:t,originalRequest:s.clone(),request:a.clone()})),n}})}fetchAndCachePut(e){return i(this,null,function*(){let t=yield this.fetch(e),o=t.clone();return this.waitUntil(this.cachePut(e,o)),t})}cacheMatch(e){return i(this,null,function*(){let t=W(e),o,{cacheName:s,matchOptions:a}=this._strategy,n=yield this.getCacheKey(t,"read"),c=Object.assign(Object.assign({},a),{cacheName:s});o=yield caches.match(n,c);for(let u of this.iterateCallbacks("cachedResponseWillBeUsed"))o=(yield u({cacheName:s,matchOptions:a,cachedResponse:o,request:n,event:this.event}))||void 0;return o})}cachePut(e,t){return i(this,null,function*(){let o=W(e);yield ae(0);let s=yield this.getCacheKey(o,"write");if(!t)throw new d("cache-put-with-no-response",{url:se(s.url)});let a=yield this._ensureResponseSafeToCache(t);if(!a)return!1;let{cacheName:n,matchOptions:c}=this._strategy,u=yield self.caches.open(n),l=this.hasCallback("cacheDidUpdate"),p=l?yield Re(u,s.clone(),["__WB_REVISION__"],c):null;try{yield u.put(s,l?a.clone():a)}catch(h){if(h instanceof Error)throw h.name==="QuotaExceededError"&&(yield Te()),h}for(let h of this.iterateCallbacks("cacheDidUpdate"))yield h({cacheName:n,oldResponse:p,newResponse:a.clone(),request:s,event:this.event});return!0})}getCacheKey(e,t){return i(this,null,function*(){let o=`${e.url} | ${t}`;if(!this._cacheKeys[o]){let s=e;for(let a of this.iterateCallbacks("cacheKeyWillBeUsed"))s=W(yield a({mode:t,request:s,event:this.event,params:this.params}));this._cacheKeys[o]=s}return this._cacheKeys[o]})}hasCallback(e){for(let t of this._strategy.plugins)if(e in t)return!0;return!1}runCallbacks(e,t){return i(this,null,function*(){for(let o of this.iterateCallbacks(e))yield o(t)})}*iterateCallbacks(e){for(let t of this._strategy.plugins)if(typeof t[e]=="function"){let o=this._pluginStateMap.get(t);yield a=>{let n=Object.assign(Object.assign({},a),{state:o});return t[e](n)}}}waitUntil(e){return this._extendLifetimePromises.push(e),e}doneWaiting(){return i(this,null,function*(){let e;for(;e=this._extendLifetimePromises.shift();)yield e})}destroy(){this._handlerDeferred.resolve(null)}_ensureResponseSafeToCache(e){return i(this,null,function*(){let t=e,o=!1;for(let s of this.iterateCallbacks("cacheWillUpdate"))if(t=(yield s({request:this.request,response:t,event:this.event}))||void 0,o=!0,!t)break;return o||t&&t.status!==200&&(t=void 0),t})}};var y=class{constructor(e={}){this.cacheName=ve.getRuntimeName(e.cacheName),this.plugins=e.plugins||[],this.fetchOptions=e.fetchOptions,this.matchOptions=e.matchOptions}handle(e){let[t]=this.handleAll(e);return t}handleAll(e){e instanceof FetchEvent&&(e={event:e,request:e.request});let t=e.event,o=typeof e.request=="string"?new Request(e.request):e.request,s="params"in e?e.params:void 0,a=new V(this,{event:t,request:o,params:s}),n=this._getResponse(a,o,t),c=this._awaitComplete(n,a,o,t);return[n,c]}_getResponse(e,t,o){return i(this,null,function*(){yield e.runCallbacks("handlerWillStart",{event:o,request:t});let s;try{if(s=yield this._handle(t,e),!s||s.type==="error")throw new d("no-response",{url:t.url})}catch(a){if(a instanceof Error){for(let n of e.iterateCallbacks("handlerDidError"))if(s=yield n({error:a,event:o,request:t}),s)break}if(!s)throw a}for(let a of e.iterateCallbacks("handlerWillRespond"))s=yield a({event:o,request:t,response:s});return s})}_awaitComplete(e,t,o,s){return i(this,null,function*(){let a,n;try{a=yield e}catch(c){}try{yield t.runCallbacks("handlerDidRespond",{event:s,request:o,response:a}),yield t.doneWaiting()}catch(c){c instanceof Error&&(n=c)}if(yield t.runCallbacks("handlerDidComplete",{event:s,request:o,response:a,error:n}),t.destroy(),n)throw n})}};var I=class extends y{_handle(e,t){return i(this,null,function*(){let o=[],s=yield t.cacheMatch(e),a;if(!s)try{s=yield t.fetchAndCachePut(e)}catch(n){n instanceof Error&&(a=n)}if(!s)throw new d("no-response",{url:e.url,error:a});return s})}};var ie={cacheWillUpdate:e=>i(void 0,[e],function*({response:r}){return r.status===200||r.status===0?r:null})};var M=class extends y{constructor(e={}){super(e);this.plugins.some(t=>"cacheWillUpdate"in t)||this.plugins.unshift(ie)}_handle(e,t){return i(this,null,function*(){let o=[],s=t.fetchAndCachePut(e).catch(()=>{});t.waitUntil(s);let a=yield t.cacheMatch(e),n;if(!a)try{a=yield s}catch(c){c instanceof Error&&(n=c)}if(!a)throw new d("no-response",{url:e.url,error:n});return a})}};var Ce=!1,ct=48,ut=48,lt=ct+ut,ga=`calc(100vh - ${lt}px)`;var F="webpub-cache";var Oe="PRECACHE_PUBLICATIONS";try{self["workbox:core:6.5.3"]&&_()}catch(r){}var pt=(r,...e)=>{let t=r;return e.length>0&&(t+=` :: ${JSON.stringify(e)}`),t};var De=pt;var x=class extends Error{constructor(e,t){let o=De(e,t);super(o);this.name=e,this.details=t}};try{self["workbox:routing:6.5.3"]&&_()}catch(r){}var B="GET";var $=r=>r&&typeof r=="object"?r:{handle:r};var E=class{constructor(e,t,o=B){this.handler=$(t),this.match=e,this.method=o}setCatchHandler(e){this.catchHandler=$(e)}};var j=class extends E{constructor(e,t,o){let s=({url:a})=>{let n=e.exec(a.href);if(!!n&&!(a.origin!==location.origin&&n.index!==0))return n.slice(1)};super(s,t,o)}};var H=class{constructor(){this._routes=new Map,this._defaultHandlerMap=new Map}get routes(){return this._routes}addFetchListener(){self.addEventListener("fetch",e=>{let{request:t}=e,o=this.handleRequest({request:t,event:e});o&&e.respondWith(o)})}addCacheListener(){self.addEventListener("message",e=>{if(e.data&&e.data.type==="CACHE_URLS"){let{payload:t}=e.data,o=Promise.all(t.urlsToCache.map(s=>{typeof s=="string"&&(s=[s]);let a=new Request(...s);return this.handleRequest({request:a,event:e})}));e.waitUntil(o),e.ports&&e.ports[0]&&o.then(()=>e.ports[0].postMessage(!0))}})}handleRequest({request:e,event:t}){let o=new URL(e.url,location.href);if(!o.protocol.startsWith("http"))return;let s=o.origin===location.origin,{params:a,route:n}=this.findMatchingRoute({event:t,request:e,sameOrigin:s,url:o}),c=n&&n.handler,u=[],l=e.method;if(!c&&this._defaultHandlerMap.has(l)&&(c=this._defaultHandlerMap.get(l)),!c)return;let p;try{p=c.handle({url:o,request:e,event:t,params:a})}catch(m){p=Promise.reject(m)}let h=n&&n.catchHandler;return p instanceof Promise&&(this._catchHandler||h)&&(p=p.catch(m=>i(this,null,function*(){if(h)try{return yield h.handle({url:o,request:e,event:t,params:a})}catch(b){b instanceof Error&&(m=b)}if(this._catchHandler)return this._catchHandler.handle({url:o,request:e,event:t});throw m}))),p}findMatchingRoute({url:e,sameOrigin:t,request:o,event:s}){let a=this._routes.get(o.method)||[];for(let n of a){let c,u=n.match({url:e,sameOrigin:t,request:o,event:s});if(u)return c=u,(Array.isArray(c)&&c.length===0||u.constructor===Object&&Object.keys(u).length===0||typeof u=="boolean")&&(c=void 0),{route:n,params:c}}return{}}setDefaultHandler(e,t=B){this._defaultHandlerMap.set(t,$(e))}setCatchHandler(e){this._catchHandler=$(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 x("unregister-route-but-not-found-with-method",{method:e.method});let t=this._routes.get(e.method).indexOf(e);if(t>-1)this._routes.get(e.method).splice(t,1);else throw new x("unregister-route-route-not-registered")}};var D,G=()=>(D||(D=new H,D.addFetchListener(),D.addCacheListener()),D);function S(r,e,t){let o;if(typeof r=="string"){let a=new URL(r,location.href),n=({url:c})=>c.href===a.href;o=new E(n,e,t)}else if(r instanceof RegExp)o=new j(r,e,t);else if(typeof r=="function")o=new E(r,e,t);else if(r instanceof E)o=r;else throw new x("unsupported-route-type",{moduleName:"workbox-routing",funcName:"registerRoute",paramName:"capture"});return G().registerRoute(o),o}var dt="v2";Q();function Ae({cacheExpirationSeconds:r=604800}={}){U("INITIALIZING"),self.addEventListener("install",o=>{U("INSTALLING ");function s(){return i(this,null,function*(){yield self.skipWaiting(),U("INSTALLED")})}o.waitUntil(s())}),self.addEventListener("message",o=>i(this,null,function*(){if(o.data.type===Oe){if(U("Precaching publications"),typeof o.data.publications!="object"){console.error("Precache event missing publications");return}yield t(o.data.publications)}}));let e=new I({cacheName:F,plugins:[new q({maxAgeSeconds:r})]});function t(o){return i(this,null,function*(){var u;let s=yield caches.open(F);for(let l of o)for(let p of(u=l.swrUrls)!=null?u:[])U(`Routing ${p}`),S(p,new M({cacheName:F}));let c=(yield Promise.allSettled(o.map(l=>i(this,null,function*(){let p=Le(l.manifestUrl,l.proxyUrl);S(p,e);let h=yield s.match(p);if(h)return k(R({},l),{manifest:yield h.json()});let m=yield fetch(p);Se(p,m),yield s.put(p,m.clone());let b=yield m.json();return k(R({},l),{manifest:b})})))).map(l=>l.status==="fulfilled"?l.value:void 0).filter(mt).map(l=>i(this,null,function*(){var b,ce;let p=Ue((b=l.manifest.resources)!=null?b:[],l.manifestUrl,l.proxyUrl),h=Ue((ce=l.manifest.readingOrder)!=null?ce:[],l.manifestUrl,l.proxyUrl),m=Array.from(new Set([...p,...h]));yield Promise.all(m.map(v=>i(this,null,function*(){if(S(v,e),yield s.match(v))return;let ue=yield fetch(v);return Se(v,ue),yield s.put(v,ue)})))}));return yield Promise.allSettled(c)})}}function mt(r){return!!r}function Se(r,e){if(!e.ok){let t=`Bad response status for: ${r}. Status: ${e.status}`;throw console.warn(t),new Error(t)}}function Le(r,e){return e?`${e}${encodeURIComponent(r)}`:r}function ft(r,e,t){return Le(new URL(r,e).toString(),t)}function Ue(r,e,t){return r.map(o=>ft(o.href,e,t))}function U(r){Ce&&console.log(`SW (${dt}) -`,r)}module.exports=je(gt);
|
|
1
|
+
var $=Object.defineProperty,Ce=Object.defineProperties,Oe=Object.getOwnPropertyDescriptor,Te=Object.getOwnPropertyDescriptors,Se=Object.getOwnPropertyNames,ce=Object.getOwnPropertySymbols;var le=Object.prototype.hasOwnProperty,$e=Object.prototype.propertyIsEnumerable;var ue=(r,e,t)=>e in r?$(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,R=(r,e)=>{for(var t in e||(e={}))le.call(e,t)&&ue(r,t,e[t]);if(ce)for(var t of ce(e))$e.call(e,t)&&ue(r,t,e[t]);return r},k=(r,e)=>Ce(r,Te(e)),Ue=r=>$(r,"__esModule",{value:!0});var Ae=(r,e)=>{for(var t in e)$(r,t,{get:e[t],enumerable:!0})},Le=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Se(e))!le.call(r,s)&&(t||s!=="default")&&$(r,s,{get:()=>e[s],enumerable:!(o=Oe(e,s))||o.enumerable});return r};var Pe=(r=>(e,t)=>r&&r.get(e)||(t=Le(Ue({}),e,1),r&&r.set(e,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var i=(r,e,t)=>new Promise((o,s)=>{var a=u=>{try{c(t.next(u))}catch(l){s(l)}},n=u=>{try{c(t.throw(u))}catch(l){s(l)}},c=u=>u.done?o(u.value):Promise.resolve(u.value).then(a,n);c((t=t.apply(r,e)).next())});var nt={};Ae(nt,{default:()=>ve});try{self["workbox:core:6.2.4"]&&_()}catch(r){}var qe=(r,...e)=>{let t=r;return e.length>0&&(t+=` :: ${JSON.stringify(e)}`),t};var pe=qe;var p=class extends Error{constructor(e,t){let o=pe(e,t);super(o);this.name=e,this.details=t}};var U=new Set;function Q(r){U.add(r)}var g={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:typeof registration!="undefined"?registration.scope:""},Y=r=>[g.prefix,r,g.suffix].filter(e=>e&&e.length>0).join("-"),We=r=>{for(let e of Object.keys(g))r(e)},x={updateDetails:r=>{We(e=>{typeof r[e]=="string"&&(g[e]=r[e])})},getGoogleAnalyticsName:r=>r||Y(g.googleAnalytics),getPrecacheName:r=>r||Y(g.precache),getPrefix:()=>g.prefix,getRuntimeName:r=>r||Y(g.runtime),getSuffix:()=>g.suffix};function me(r,e){let t=new URL(r);for(let o of e)t.searchParams.delete(o);return t.href}function J(r,e,t,o){return i(this,null,function*(){let s=me(e.url,t);if(e.url===s)return r.match(e,o);let a=Object.assign(Object.assign({},o),{ignoreSearch:!0}),n=yield r.keys(e,a);for(let c of n){let u=me(c.url,t);if(s===u)return r.match(c,o)}})}function v(r){r.then(()=>{})}var A=class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}};function z(){return i(this,null,function*(){for(let r of U)yield r()})}var L=r=>new URL(String(r),location.href).href.replace(new RegExp(`^${location.origin}`),"");function D(r){return new Promise(e=>setTimeout(e,r))}function X(){self.addEventListener("activate",()=>self.clients.claim())}var Fe=(r,e)=>e.some(t=>r instanceof t),he,de;function He(){return he||(he=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Be(){return de||(de=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var fe=new WeakMap,ee=new WeakMap,ge=new WeakMap,Z=new WeakMap,re=new WeakMap;function je(r){let e=new Promise((t,o)=>{let s=()=>{r.removeEventListener("success",a),r.removeEventListener("error",n)},a=()=>{t(f(r.result)),s()},n=()=>{o(r.error),s()};r.addEventListener("success",a),r.addEventListener("error",n)});return e.then(t=>{t instanceof IDBCursor&&fe.set(t,r)}).catch(()=>{}),re.set(e,r),e}function Ge(r){if(ee.has(r))return;let e=new Promise((t,o)=>{let s=()=>{r.removeEventListener("complete",a),r.removeEventListener("error",n),r.removeEventListener("abort",n)},a=()=>{t(),s()},n=()=>{o(r.error||new DOMException("AbortError","AbortError")),s()};r.addEventListener("complete",a),r.addEventListener("error",n),r.addEventListener("abort",n)});ee.set(r,e)}var te={get(r,e,t){if(r instanceof IDBTransaction){if(e==="done")return ee.get(r);if(e==="objectStoreNames")return r.objectStoreNames||ge.get(r);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return f(r[e])},set(r,e,t){return r[e]=t,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function we(r){te=r(te)}function Ke(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){let o=r.call(P(this),e,...t);return ge.set(o,e.sort?e.sort():[e]),f(o)}:Be().includes(r)?function(...e){return r.apply(P(this),e),f(fe.get(this))}:function(...e){return f(r.apply(P(this),e))}}function Qe(r){return typeof r=="function"?Ke(r):(r instanceof IDBTransaction&&Ge(r),Fe(r,He())?new Proxy(r,te):r)}function f(r){if(r instanceof IDBRequest)return je(r);if(Z.has(r))return Z.get(r);let e=Qe(r);return e!==r&&(Z.set(r,e),re.set(e,r)),e}var P=r=>re.get(r);function Ne(r,e,{blocked:t,upgrade:o,blocking:s,terminated:a}={}){let n=indexedDB.open(r,e),c=f(n);return o&&n.addEventListener("upgradeneeded",u=>{o(f(n.result),u.oldVersion,u.newVersion,f(n.transaction))}),t&&n.addEventListener("blocked",()=>t()),c.then(u=>{a&&u.addEventListener("close",()=>a()),s&&u.addEventListener("versionchange",()=>s())}).catch(()=>{}),c}function xe(r,{blocked:e}={}){let t=indexedDB.deleteDatabase(r);return e&&t.addEventListener("blocked",()=>e()),f(t).then(()=>{})}var Ye=["get","getKey","getAll","getAllKeys","count"],Je=["put","add","delete","clear"],oe=new Map;function Ee(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(oe.get(e))return oe.get(e);let t=e.replace(/FromIndex$/,""),o=e!==t,s=Je.includes(t);if(!(t in(o?IDBIndex:IDBObjectStore).prototype)||!(s||Ye.includes(t)))return;let a=function(n,...c){return i(this,null,function*(){let u=this.transaction(n,s?"readwrite":"readonly"),l=u.store;return o&&(l=l.index(c.shift())),(yield Promise.all([l[t](...c),s&&u.done]))[0]})};return oe.set(e,a),a}we(r=>k(R({},r),{get:(e,t,o)=>Ee(e,t)||r.get(e,t,o),has:(e,t)=>!!Ee(e,t)||r.has(e,t)}));try{self["workbox:expiration:6.2.4"]&&_()}catch(r){}var ze="workbox-expiration",C="cache-entries",ye=r=>{let e=new URL(r,location.href);return e.hash="",e.href},se=class{constructor(e){this._db=null,this._cacheName=e}_upgradeDb(e){let t=e.createObjectStore(C,{keyPath:"id"});t.createIndex("cacheName","cacheName",{unique:!1}),t.createIndex("timestamp","timestamp",{unique:!1})}_upgradeDbAndDeleteOldDbs(e){this._upgradeDb(e),this._cacheName&&xe(this._cacheName)}setTimestamp(e,t){return i(this,null,function*(){e=ye(e);let o={url:e,timestamp:t,cacheName:this._cacheName,id:this._getId(e)},a=(yield this.getDb()).transaction(C,"readwrite",{durability:"relaxed"});yield a.store.put(o),yield a.done})}getTimestamp(e){return i(this,null,function*(){let o=yield(yield this.getDb()).get(C,this._getId(e));return o==null?void 0:o.timestamp})}expireEntries(e,t){return i(this,null,function*(){let o=yield this.getDb(),s=yield o.transaction(C).store.index("timestamp").openCursor(null,"prev"),a=[],n=0;for(;s;){let u=s.value;u.cacheName===this._cacheName&&(e&&u.timestamp<e||t&&n>=t?a.push(s.value):n++),s=yield s.continue()}let c=[];for(let u of a)yield o.delete(C,u.id),c.push(u.url);return c})}_getId(e){return this._cacheName+"|"+ye(e)}getDb(){return i(this,null,function*(){return this._db||(this._db=yield Ne(ze,1,{upgrade:this._upgradeDbAndDeleteOldDbs.bind(this)})),this._db})}};var q=class{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 se(e)}expireEntries(){return i(this,null,function*(){if(this._isRunning){this._rerunRequested=!0;return}this._isRunning=!0;let e=this._maxAgeSeconds?Date.now()-this._maxAgeSeconds*1e3:0,t=yield this._timestampModel.expireEntries(e,this._maxEntries),o=yield self.caches.open(this._cacheName);for(let s of t)yield o.delete(s,this._matchOptions);this._isRunning=!1,this._rerunRequested&&(this._rerunRequested=!1,v(this.expireEntries()))})}updateTimestamp(e){return i(this,null,function*(){yield this._timestampModel.setTimestamp(e,Date.now())})}isURLExpired(e){return i(this,null,function*(){if(this._maxAgeSeconds){let t=yield this._timestampModel.getTimestamp(e),o=Date.now()-this._maxAgeSeconds*1e3;return t!==void 0?t<o:!0}else return!1})}delete(){return i(this,null,function*(){this._rerunRequested=!1,yield this._timestampModel.expireEntries(1/0)})}};var W=class{constructor(e={}){this.cachedResponseWillBeUsed=n=>i(this,[n],function*({event:t,request:o,cacheName:s,cachedResponse:a}){if(!a)return null;let c=this._isResponseDateFresh(a),u=this._getCacheExpiration(s);v(u.expireEntries());let l=u.updateTimestamp(o.url);if(t)try{t.waitUntil(l)}catch(m){}return c?a:null}),this.cacheDidUpdate=s=>i(this,[s],function*({cacheName:t,request:o}){let a=this._getCacheExpiration(t);yield a.updateTimestamp(o.url),yield a.expireEntries()}),this._config=e,this._maxAgeSeconds=e.maxAgeSeconds,this._cacheExpirations=new Map,e.purgeOnQuotaError&&Q(()=>this.deleteCacheAndMetadata())}_getCacheExpiration(e){if(e===x.getRuntimeName())throw new p("expire-custom-caches-only");let t=this._cacheExpirations.get(e);return t||(t=new q(e,this._config),this._cacheExpirations.set(e,t)),t}_isResponseDateFresh(e){if(!this._maxAgeSeconds)return!0;let t=this._getDateHeaderTimestamp(e);if(t===null)return!0;let o=Date.now();return t>=o-this._maxAgeSeconds*1e3}_getDateHeaderTimestamp(e){if(!e.headers.has("date"))return null;let t=e.headers.get("date"),s=new Date(t).getTime();return isNaN(s)?null:s}deleteCacheAndMetadata(){return i(this,null,function*(){for(let[e,t]of this._cacheExpirations)yield self.caches.delete(e),yield t.delete();this._cacheExpirations=new Map})}};try{self["workbox:strategies:6.2.4"]&&_()}catch(r){}function I(r){return typeof r=="string"?new Request(r):r}var M=class{constructor(e,t){this._cacheKeys={},Object.assign(this,t),this.event=t.event,this._strategy=e,this._handlerDeferred=new A,this._extendLifetimePromises=[],this._plugins=[...e.plugins],this._pluginStateMap=new Map;for(let o of this._plugins)this._pluginStateMap.set(o,{});this.event.waitUntil(this._handlerDeferred.promise)}fetch(e){return i(this,null,function*(){let{event:t}=this,o=I(e);if(o.mode==="navigate"&&t instanceof FetchEvent&&t.preloadResponse){let n=yield t.preloadResponse;if(n)return n}let s=this.hasCallback("fetchDidFail")?o.clone():null;try{for(let n of this.iterateCallbacks("requestWillFetch"))o=yield n({request:o.clone(),event:t})}catch(n){if(n instanceof Error)throw new p("plugin-error-request-will-fetch",{thrownErrorMessage:n.message})}let a=o.clone();try{let n;n=yield fetch(o,o.mode==="navigate"?void 0:this._strategy.fetchOptions);for(let c of this.iterateCallbacks("fetchDidSucceed"))n=yield c({event:t,request:a,response:n});return n}catch(n){throw s&&(yield this.runCallbacks("fetchDidFail",{error:n,event:t,originalRequest:s.clone(),request:a.clone()})),n}})}fetchAndCachePut(e){return i(this,null,function*(){let t=yield this.fetch(e),o=t.clone();return this.waitUntil(this.cachePut(e,o)),t})}cacheMatch(e){return i(this,null,function*(){let t=I(e),o,{cacheName:s,matchOptions:a}=this._strategy,n=yield this.getCacheKey(t,"read"),c=Object.assign(Object.assign({},a),{cacheName:s});o=yield caches.match(n,c);for(let u of this.iterateCallbacks("cachedResponseWillBeUsed"))o=(yield u({cacheName:s,matchOptions:a,cachedResponse:o,request:n,event:this.event}))||void 0;return o})}cachePut(e,t){return i(this,null,function*(){let o=I(e);yield D(0);let s=yield this.getCacheKey(o,"write");if(!t)throw new p("cache-put-with-no-response",{url:L(s.url)});let a=yield this._ensureResponseSafeToCache(t);if(!a)return!1;let{cacheName:n,matchOptions:c}=this._strategy,u=yield self.caches.open(n),l=this.hasCallback("cacheDidUpdate"),m=l?yield J(u,s.clone(),["__WB_REVISION__"],c):null;try{yield u.put(s,l?a.clone():a)}catch(h){if(h instanceof Error)throw h.name==="QuotaExceededError"&&(yield z()),h}for(let h of this.iterateCallbacks("cacheDidUpdate"))yield h({cacheName:n,oldResponse:m,newResponse:a.clone(),request:s,event:this.event});return!0})}getCacheKey(e,t){return i(this,null,function*(){if(!this._cacheKeys[t]){let o=e;for(let s of this.iterateCallbacks("cacheKeyWillBeUsed"))o=I(yield s({mode:t,request:o,event:this.event,params:this.params}));this._cacheKeys[t]=o}return this._cacheKeys[t]})}hasCallback(e){for(let t of this._strategy.plugins)if(e in t)return!0;return!1}runCallbacks(e,t){return i(this,null,function*(){for(let o of this.iterateCallbacks(e))yield o(t)})}*iterateCallbacks(e){for(let t of this._strategy.plugins)if(typeof t[e]=="function"){let o=this._pluginStateMap.get(t);yield a=>{let n=Object.assign(Object.assign({},a),{state:o});return t[e](n)}}}waitUntil(e){return this._extendLifetimePromises.push(e),e}doneWaiting(){return i(this,null,function*(){let e;for(;e=this._extendLifetimePromises.shift();)yield e})}destroy(){this._handlerDeferred.resolve(null)}_ensureResponseSafeToCache(e){return i(this,null,function*(){let t=e,o=!1;for(let s of this.iterateCallbacks("cacheWillUpdate"))if(t=(yield s({request:this.request,response:t,event:this.event}))||void 0,o=!0,!t)break;return o||t&&t.status!==200&&(t=void 0),t})}};var w=class{constructor(e={}){this.cacheName=x.getRuntimeName(e.cacheName),this.plugins=e.plugins||[],this.fetchOptions=e.fetchOptions,this.matchOptions=e.matchOptions}handle(e){let[t]=this.handleAll(e);return t}handleAll(e){e instanceof FetchEvent&&(e={event:e,request:e.request});let t=e.event,o=typeof e.request=="string"?new Request(e.request):e.request,s="params"in e?e.params:void 0,a=new M(this,{event:t,request:o,params:s}),n=this._getResponse(a,o,t),c=this._awaitComplete(n,a,o,t);return[n,c]}_getResponse(e,t,o){return i(this,null,function*(){yield e.runCallbacks("handlerWillStart",{event:o,request:t});let s;try{if(s=yield this._handle(t,e),!s||s.type==="error")throw new p("no-response",{url:t.url})}catch(a){if(a instanceof Error){for(let n of e.iterateCallbacks("handlerDidError"))if(s=yield n({error:a,event:o,request:t}),s)break}if(!s)throw a}for(let a of e.iterateCallbacks("handlerWillRespond"))s=yield a({event:o,request:t,response:s});return s})}_awaitComplete(e,t,o,s){return i(this,null,function*(){let a,n;try{a=yield e}catch(c){}try{yield t.runCallbacks("handlerDidRespond",{event:s,request:o,response:a}),yield t.doneWaiting()}catch(c){c instanceof Error&&(n=c)}if(yield t.runCallbacks("handlerDidComplete",{event:s,request:o,response:a,error:n}),t.destroy(),n)throw n})}};var V=class extends w{_handle(e,t){return i(this,null,function*(){let o=[],s=yield t.cacheMatch(e),a;if(!s)try{s=yield t.fetchAndCachePut(e)}catch(n){n instanceof Error&&(a=n)}if(!s)throw new p("no-response",{url:e.url,error:a});return s})}};var ne={cacheWillUpdate:e=>i(void 0,[e],function*({response:r}){return r.status===200||r.status===0?r:null})};var F=class extends w{constructor(e={}){super(e);this.plugins.some(t=>"cacheWillUpdate"in t)||this.plugins.unshift(ne)}_handle(e,t){return i(this,null,function*(){let o=[],s=t.fetchAndCachePut(e).catch(()=>{}),a=yield t.cacheMatch(e),n;if(!a)try{a=yield s}catch(c){c instanceof Error&&(n=c)}if(!a)throw new p("no-response",{url:e.url,error:n});return a})}};var be=!1,Xe=48,Ze=48,et=Xe+Ze,bn=`calc(100vh - ${et}px)`;var H="webpub-cache";var _e="PRECACHE_PUBLICATIONS";try{self["workbox:routing:6.2.4"]&&_()}catch(r){}var B="GET";var y=r=>r&&typeof r=="object"?r:{handle:r};var E=class{constructor(e,t,o=B){this.handler=y(t),this.match=e,this.method=o}setCatchHandler(e){this.catchHandler=y(e)}};var j=class extends E{constructor(e,t,o){let s=({url:a})=>{let n=e.exec(a.href);if(!!n&&!(a.origin!==location.origin&&n.index!==0))return n.slice(1)};super(s,t,o)}};var G=class{constructor(){this._routes=new Map,this._defaultHandlerMap=new Map}get routes(){return this._routes}addFetchListener(){self.addEventListener("fetch",e=>{let{request:t}=e,o=this.handleRequest({request:t,event:e});o&&e.respondWith(o)})}addCacheListener(){self.addEventListener("message",e=>{if(e.data&&e.data.type==="CACHE_URLS"){let{payload:t}=e.data,o=Promise.all(t.urlsToCache.map(s=>{typeof s=="string"&&(s=[s]);let a=new Request(...s);return this.handleRequest({request:a,event:e})}));e.waitUntil(o),e.ports&&e.ports[0]&&o.then(()=>e.ports[0].postMessage(!0))}})}handleRequest({request:e,event:t}){let o=new URL(e.url,location.href);if(!o.protocol.startsWith("http"))return;let s=o.origin===location.origin,{params:a,route:n}=this.findMatchingRoute({event:t,request:e,sameOrigin:s,url:o}),c=n&&n.handler,u=[],l=e.method;if(!c&&this._defaultHandlerMap.has(l)&&(c=this._defaultHandlerMap.get(l)),!c)return;let m;try{m=c.handle({url:o,request:e,event:t,params:a})}catch(d){m=Promise.reject(d)}let h=n&&n.catchHandler;return m instanceof Promise&&(this._catchHandler||h)&&(m=m.catch(d=>i(this,null,function*(){if(h)try{return yield h.handle({url:o,request:e,event:t,params:a})}catch(N){N instanceof Error&&(d=N)}if(this._catchHandler)return this._catchHandler.handle({url:o,request:e,event:t});throw d}))),m}findMatchingRoute({url:e,sameOrigin:t,request:o,event:s}){let a=this._routes.get(o.method)||[];for(let n of a){let c,u=n.match({url:e,sameOrigin:t,request:o,event:s});if(u)return c=u,(Array.isArray(c)&&c.length===0||u.constructor===Object&&Object.keys(u).length===0||typeof u=="boolean")&&(c=void 0),{route:n,params:c}}return{}}setDefaultHandler(e,t=B){this._defaultHandlerMap.set(t,y(e))}setCatchHandler(e){this._catchHandler=y(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 p("unregister-route-but-not-found-with-method",{method:e.method});let t=this._routes.get(e.method).indexOf(e);if(t>-1)this._routes.get(e.method).splice(t,1);else throw new p("unregister-route-route-not-registered")}};var O,K=()=>(O||(O=new G,O.addFetchListener(),O.addCacheListener()),O);function T(r,e,t){let o;if(typeof r=="string"){let a=new URL(r,location.href),n=({url:c})=>c.href===a.href;o=new E(n,e,t)}else if(r instanceof RegExp)o=new j(r,e,t);else if(typeof r=="function")o=new E(r,e,t);else if(r instanceof E)o=r;else throw new p("unsupported-route-type",{moduleName:"workbox-routing",funcName:"registerRoute",paramName:"capture"});return K().registerRoute(o),o}var rt="v2";X();function ve({cacheExpirationSeconds:r=604800}={}){S("INITIALIZING"),self.addEventListener("install",o=>{S("INSTALLING ");function s(){return i(this,null,function*(){yield self.skipWaiting(),S("INSTALLED")})}o.waitUntil(s())}),self.addEventListener("message",o=>i(this,null,function*(){if(o.data.type===_e){if(S("Precaching publications"),typeof o.data.publications!="object"){console.error("Precache event missing publications");return}yield t(o.data.publications)}}));let e=new V({cacheName:H,plugins:[new W({maxAgeSeconds:r})]});function t(o){return i(this,null,function*(){var u;let s=yield caches.open(H);for(let l of o)for(let m of(u=l.swrUrls)!=null?u:[])S(`Routing ${m}`),T(m,new F({cacheName:H}));let c=(yield Promise.allSettled(o.map(l=>i(this,null,function*(){let m=De(l.manifestUrl,l.proxyUrl);T(m,e);let h=yield s.match(m);if(h)return k(R({},l),{manifest:yield h.json()});let d=yield fetch(m);Re(m,d),yield s.put(m,d.clone());let N=yield d.json();return k(R({},l),{manifest:N})})))).map(l=>l.status==="fulfilled"?l.value:void 0).filter(ot).map(l=>i(this,null,function*(){var N,ae;let m=ke((N=l.manifest.resources)!=null?N:[],l.manifestUrl,l.proxyUrl),h=ke((ae=l.manifest.readingOrder)!=null?ae:[],l.manifestUrl,l.proxyUrl),d=Array.from(new Set([...m,...h]));yield Promise.all(d.map(b=>i(this,null,function*(){if(T(b,e),yield s.match(b))return;let ie=yield fetch(b);return Re(b,ie),yield s.put(b,ie)})))}));return yield Promise.allSettled(c)})}}function ot(r){return!!r}function Re(r,e){if(!e.ok){let t=`Bad response status for: ${r}. Status: ${e.status}`;throw console.warn(t),new Error(t)}}function De(r,e){return e?`${e}${encodeURIComponent(r)}`:r}function st(r,e,t){return De(new URL(r,e).toString(),t)}function ke(r,e,t){return r.map(o=>st(o.href,e,t))}function S(r){be&&console.log(`SW (${rt}) -`,r)}module.exports=Pe(nt);
|
|
2
2
|
//# sourceMappingURL=sw.js.map
|