@nypl/web-reader 1.1.1 → 1.2.0
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 +13 -15
- package/dist/cjs/index.js.map +3 -3
- package/dist/esm/ServiceWorker/sw.js.map +2 -2
- package/dist/esm/index.js +19917 -24734
- package/dist/esm/index.js.map +3 -3
- package/dist/types/HtmlReader/effects.d.ts +2 -2
- package/dist/types/HtmlReader/types.d.ts +13 -8
- package/dist/types/constants.d.ts +2 -0
- package/dist/types/types.d.ts +12 -9
- package/dist/types/ui/Button.d.ts +2 -2
- package/dist/types/ui/Header.d.ts +2 -2
- package/dist/types/ui/HtmlSettings.d.ts +3 -3
- package/dist/types/ui/PdfSettings.d.ts +2 -2
- package/dist/types/ui/menu/use-menu.d.ts +629 -641
- package/dist/types/ui/nypl-base-theme/index.d.ts +6 -0
- package/dist/types/utils/localstorage.d.ts +10 -0
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var S=Object.defineProperty,De=Object.defineProperties,Ce=Object.getOwnPropertyDescriptor,Oe=Object.getOwnPropertyDescriptors,Te=Object.getOwnPropertyNames,ce=Object.getOwnPropertySymbols;var le=Object.prototype.hasOwnProperty,$e=Object.prototype.propertyIsEnumerable;var ue=(r,e,t)=>e in r?S(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)=>De(r,Oe(e)),Se=r=>S(r,"__esModule",{value:!0});var Ue=(r,e)=>{for(var t in e)S(r,t,{get:e[t],enumerable:!0})},Ae=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Te(e))!le.call(r,s)&&(t||s!=="default")&&S(r,s,{get:()=>e[s],enumerable:!(o=Ce(e,s))||o.enumerable});return r};var Pe=(r=>(e,t)=>r&&r.get(e)||(t=Ae(Se({}),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 rt={};Ue(rt,{default:()=>ke});try{self["workbox:core:6.2.4"]&&_()}catch(r){}var Le=(r,...e)=>{let t=r;return e.length>0&&(t+=` :: ${JSON.stringify(e)}`),t};var pe=Le;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:""},J=r=>[g.prefix,r,g.suffix].filter(e=>e&&e.length>0).join("-"),qe=r=>{for(let e of Object.keys(g))r(e)},y={updateDetails:r=>{qe(e=>{typeof r[e]=="string"&&(g[e]=r[e])})},getGoogleAnalyticsName:r=>r||J(g.googleAnalytics),getPrecacheName:r=>r||J(g.precache),getPrefix:()=>g.prefix,getRuntimeName:r=>r||J(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 Y(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 X(){return i(this,null,function*(){for(let r of U)yield r()})}var P=r=>new URL(String(r),location.href).href.replace(new RegExp(`^${location.origin}`),"");function D(r){return new Promise(e=>setTimeout(e,r))}function z(){self.addEventListener("activate",()=>self.clients.claim())}var Ve=(r,e)=>e.some(t=>r instanceof t),he,de;function Fe(){return he||(he=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function He(){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 Be(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 je(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 Ge(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){let o=r.call(L(this),e,...t);return ge.set(o,e.sort?e.sort():[e]),f(o)}:He().includes(r)?function(...e){return r.apply(L(this),e),f(fe.get(this))}:function(...e){return f(r.apply(L(this),e))}}function Ke(r){return typeof r=="function"?Ge(r):(r instanceof IDBTransaction&&je(r),Ve(r,Fe())?new Proxy(r,te):r)}function f(r){if(r instanceof IDBRequest)return Be(r);if(Z.has(r))return Z.get(r);let e=Ke(r);return e!==r&&(Z.set(r,e),re.set(e,r)),e}var L=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 ye(r,{blocked:e}={}){let t=indexedDB.deleteDatabase(r);return e&&t.addEventListener("blocked",()=>e()),f(t).then(()=>{})}var Qe=["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||Qe.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 Ye="workbox-expiration",C="cache-entries",xe=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&&ye(this._cacheName)}setTimestamp(e,t){return i(this,null,function*(){e=xe(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+"|"+xe(e)}getDb(){return i(this,null,function*(){return this._db||(this._db=yield Ne(Ye,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===y.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:P(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 Y(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 X()),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=y.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 H="webpub-cache";var be="PRECACHE_PUBLICATIONS";try{self["workbox:routing:6.2.4"]&&_()}catch(r){}var B="GET";var x=r=>r&&typeof r=="object"?r:{handle:r};var E=class{constructor(e,t,o=B){this.handler=x(t),this.match=e,this.method=o}setCatchHandler(e){this.catchHandler=x(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,x(e))}setCatchHandler(e){this._catchHandler=x(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 Ze="v2";z();function ke({cacheExpirationSeconds:r=604800}={}){$("INITIALIZING"),self.addEventListener("install",o=>{$("INSTALLING ");function s(){return i(this,null,function*(){yield self.skipWaiting(),$("INSTALLED")})}o.waitUntil(s())}),self.addEventListener("message",o=>i(this,null,function*(){if(o.data.type===be){if($("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:[])$(`Routing ${m}`),T(m,new F({cacheName:H}));let c=(yield Promise.allSettled(o.map(l=>i(this,null,function*(){let m=ve(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);_e(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(et).map(l=>i(this,null,function*(){var N,ae;let m=Re((N=l.manifest.resources)!=null?N:[],l.manifestUrl,l.proxyUrl),h=Re((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 _e(b,ie),yield s.put(b,ie)})))}));return yield Promise.allSettled(c)})}}function et(r){return!!r}function _e(r,e){if(!e.ok){let t=`Bad response status for: ${r}. Status: ${e.status}`;throw console.warn(t),new Error(t)}}function ve(r,e){return e?`${e}${encodeURIComponent(r)}`:r}function tt(r,e,t){return ve(new URL(r,e).toString(),t)}function Re(r,e,t){return r.map(o=>tt(o.href,e,t))}function $(r){!1&&console.log(`SW (${Ze}) -`,r)}module.exports=Pe(rt);
|
|
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})},Pe=(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 Le=(r=>(e,t)=>r&&r.get(e)||(t=Pe(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:""},J=r=>[g.prefix,r,g.suffix].filter(e=>e&&e.length>0).join("-"),We=r=>{for(let e of Object.keys(g))r(e)},y={updateDetails:r=>{We(e=>{typeof r[e]=="string"&&(g[e]=r[e])})},getGoogleAnalyticsName:r=>r||J(g.googleAnalytics),getPrecacheName:r=>r||J(g.precache),getPrefix:()=>g.prefix,getRuntimeName:r=>r||J(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 Y(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 P=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(L(this),e,...t);return ge.set(o,e.sort?e.sort():[e]),f(o)}:Be().includes(r)?function(...e){return r.apply(L(this),e),f(fe.get(this))}:function(...e){return f(r.apply(L(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 L=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 ye(r,{blocked:e}={}){let t=indexedDB.deleteDatabase(r);return e&&t.addEventListener("blocked",()=>e()),f(t).then(()=>{})}var Je=["get","getKey","getAll","getAllKeys","count"],Ye=["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=Ye.includes(t);if(!(t in(o?IDBIndex:IDBObjectStore).prototype)||!(s||Je.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",xe=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&&ye(this._cacheName)}setTimestamp(e,t){return i(this,null,function*(){e=xe(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+"|"+xe(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===y.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 M(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 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=M(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=M(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=M(e);yield D(0);let s=yield this.getCacheKey(o,"write");if(!t)throw new p("cache-put-with-no-response",{url:P(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 Y(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=M(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=y.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 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 I=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 x=r=>r&&typeof r=="object"?r:{handle:r};var E=class{constructor(e,t,o=B){this.handler=x(t),this.match=e,this.method=o}setCatchHandler(e){this.catchHandler=x(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,x(e))}setCatchHandler(e){this._catchHandler=x(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 I({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=Le(nt);
|
|
2
2
|
//# sourceMappingURL=sw.js.map
|