@nypl/web-reader 0.3.3 → 1.1.0-1
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/README.md +1 -1
- package/dist/cjs/ServiceWorker/sw.js +1 -1
- package/dist/cjs/ServiceWorker/sw.js.map +2 -2
- package/dist/cjs/index.css +1 -1
- package/dist/cjs/index.css.map +3 -3
- package/dist/cjs/index.js +26 -160
- package/dist/cjs/index.js.map +3 -3
- package/dist/esm/ServiceWorker/sw.js +14 -21
- package/dist/esm/ServiceWorker/sw.js.map +2 -2
- package/dist/esm/index.css +0 -1124
- package/dist/esm/index.css.map +3 -3
- package/dist/esm/index.js +2658 -60852
- package/dist/esm/index.js.map +3 -3
- package/dist/injectable-html-styles.css +1 -1
- package/dist/injectable-html-styles.css.map +3 -3
- package/dist/types/HtmlReader/effects.d.ts +17 -0
- package/dist/types/HtmlReader/index.d.ts +16 -30
- package/dist/types/HtmlReader/lib.d.ts +112 -0
- package/dist/types/HtmlReader/reducer.d.ts +8 -0
- package/dist/types/HtmlReader/types.d.ts +109 -0
- package/dist/types/HtmlReader/useIframeLinkClick.d.ts +3 -0
- package/dist/types/HtmlReader/useLocationQuery.d.ts +8 -0
- package/dist/types/HtmlReader/useResource.d.ts +13 -0
- package/dist/types/HtmlReader/useUpdateCSS.d.ts +7 -0
- package/dist/types/HtmlReader/useUpdateScroll.d.ts +6 -0
- package/dist/types/HtmlReader/useWindowResize.d.ts +6 -0
- package/dist/types/Readium/Injectable.d.ts +11 -0
- package/dist/types/Readium/Locator.d.ts +20 -0
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/types.d.ts +21 -1
- package/dist/types/ui/LoadingSkeleton.d.ts +4 -0
- package/package.json +8 -7
- package/dist/types/HtmlReader/HtmlReaderContent.d.ts +0 -7
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ A big thanks to [R2D2BC](https://github.com/d-i-t-a/R2D2BC) for providing the un
|
|
|
26
26
|
- [x] Offline support (prefetch and cache desired content via Service Worker, along with host app shell.
|
|
27
27
|
- [ ] Saving bookmarks / highlights
|
|
28
28
|
- [x] WAI-ARIA compliant accessibility
|
|
29
|
-
- [
|
|
29
|
+
- [x] Integration tested
|
|
30
30
|
|
|
31
31
|
## Example
|
|
32
32
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var K=Object.defineProperty,Ce=Object.defineProperties;var De=Object.getOwnPropertyDescriptors;var ce=Object.getOwnPropertySymbols;var Oe=Object.prototype.hasOwnProperty,Te=Object.prototype.propertyIsEnumerable;var ue=(t,e,r)=>e in t?K(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v=(t,e)=>{for(var r in e||(e={}))Oe.call(e,r)&&ue(t,r,e[r]);if(ce)for(var r of ce(e))Te.call(e,r)&&ue(t,r,e[r]);return t},k=(t,e)=>Ce(t,De(e)),Se=t=>K(t,"__esModule",{value:!0});var tr=typeof require!="undefined"?require:t=>{throw new Error('Dynamic require of "'+t+'" is not supported')};var $e=(t,e)=>{Se(t);for(var r in e)K(t,r,{get:e[r],enumerable:!0})};var i=(t,e,r)=>new Promise((o,s)=>{var a=u=>{try{c(r.next(u))}catch(l){s(l)}},n=u=>{try{c(r.throw(u))}catch(l){s(l)}},c=u=>u.done?o(u.value):Promise.resolve(u.value).then(a,n);c((r=r.apply(t,e)).next())});$e(exports,{default:()=>ve});"use strict";try{self["workbox:core:6.2.4"]&&_()}catch(t){}var Ue=(t,...e)=>{let r=t;return e.length>0&&(r+=` :: ${JSON.stringify(e)}`),r};var le=Ue;var p=class extends Error{constructor(e,r){let o=le(e,r);super(o);this.name=e,this.details=r}};var S=new Set;function Q(t){S.add(t)}var g={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:typeof registration!="undefined"?registration.scope:""},J=t=>[g.prefix,t,g.suffix].filter(e=>e&&e.length>0).join("-"),We=t=>{for(let e of Object.keys(g))t(e)},b={updateDetails:t=>{We(e=>{typeof t[e]=="string"&&(g[e]=t[e])})},getGoogleAnalyticsName:t=>t||J(g.googleAnalytics),getPrecacheName:t=>t||J(g.precache),getPrefix:()=>g.prefix,getRuntimeName:t=>t||J(g.runtime),getSuffix:()=>g.suffix};function pe(t,e){let r=new URL(t);for(let o of e)r.searchParams.delete(o);return r.href}function Y(t,e,r,o){return i(this,null,function*(){let s=pe(e.url,r);if(e.url===s)return t.match(e,o);let a=Object.assign(Object.assign({},o),{ignoreSearch:!0}),n=yield t.keys(e,a);for(let c of n){let u=pe(c.url,r);if(s===u)return t.match(c,o)}})}function R(t){t.then(()=>{})}var $=class{constructor(){this.promise=new Promise((e,r)=>{this.resolve=e,this.reject=r})}};function z(){return i(this,null,function*(){for(let t of S)yield t()})}var U=t=>new URL(String(t),location.href).href.replace(new RegExp(`^${location.origin}`),"");function j(t){return new Promise(e=>setTimeout(e,t))}function X(){self.addEventListener("activate",()=>self.clients.claim())}var qe=(t,e)=>e.some(r=>t instanceof r),me,he;function Me(){return me||(me=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Ie(){return he||(he=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var de=new WeakMap,Z=new WeakMap,fe=new WeakMap,ee=new WeakMap,re=new WeakMap;function Ve(t){let e=new Promise((r,o)=>{let s=()=>{t.removeEventListener("success",a),t.removeEventListener("error",n)},a=()=>{r(f(t.result)),s()},n=()=>{o(t.error),s()};t.addEventListener("success",a),t.addEventListener("error",n)});return e.then(r=>{r instanceof IDBCursor&&de.set(r,t)}).catch(()=>{}),re.set(e,t),e}function Fe(t){if(Z.has(t))return;let e=new Promise((r,o)=>{let s=()=>{t.removeEventListener("complete",a),t.removeEventListener("error",n),t.removeEventListener("abort",n)},a=()=>{r(),s()},n=()=>{o(t.error||new DOMException("AbortError","AbortError")),s()};t.addEventListener("complete",a),t.addEventListener("error",n),t.addEventListener("abort",n)});Z.set(t,e)}var te={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return Z.get(t);if(e==="objectStoreNames")return t.objectStoreNames||fe.get(t);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return f(t[e])},set(t,e,r){return t[e]=r,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function ge(t){te=t(te)}function He(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...r){let o=t.call(W(this),e,...r);return fe.set(o,e.sort?e.sort():[e]),f(o)}:Ie().includes(t)?function(...e){return t.apply(W(this),e),f(de.get(this))}:function(...e){return f(t.apply(W(this),e))}}function Be(t){return typeof t=="function"?He(t):(t instanceof IDBTransaction&&Fe(t),qe(t,Me())?new Proxy(t,te):t)}function f(t){if(t instanceof IDBRequest)return Ve(t);if(ee.has(t))return ee.get(t);let e=Be(t);return e!==t&&(ee.set(t,e),re.set(e,t)),e}var W=t=>re.get(t);function we(t,e,{blocked:r,upgrade:o,blocking:s,terminated:a}={}){let n=indexedDB.open(t,e),c=f(n);return o&&n.addEventListener("upgradeneeded",u=>{o(f(n.result),u.oldVersion,u.newVersion,f(n.transaction))}),r&&n.addEventListener("blocked",()=>r()),c.then(u=>{a&&u.addEventListener("close",()=>a()),s&&u.addEventListener("versionchange",()=>s())}).catch(()=>{}),c}function xe(t,{blocked:e}={}){let r=indexedDB.deleteDatabase(t);return e&&r.addEventListener("blocked",()=>e()),f(r).then(()=>{})}var Ge=["get","getKey","getAll","getAllKeys","count"],Ke=["put","add","delete","clear"],oe=new Map;function Ee(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(oe.get(e))return oe.get(e);let r=e.replace(/FromIndex$/,""),o=e!==r,s=Ke.includes(r);if(!(r in(o?IDBIndex:IDBObjectStore).prototype)||!(s||Ge.includes(r)))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[r](...c),s&&u.done]))[0]})};return oe.set(e,a),a}ge(t=>k(v({},t),{get:(e,r,o)=>Ee(e,r)||t.get(e,r,o),has:(e,r)=>!!Ee(e,r)||t.has(e,r)}));"use strict";try{self["workbox:expiration:6.2.4"]&&_()}catch(t){}var Qe="workbox-expiration",C="cache-entries",be=t=>{let e=new URL(t,location.href);return e.hash="",e.href},se=class{constructor(e){this._db=null,this._cacheName=e}_upgradeDb(e){let r=e.createObjectStore(C,{keyPath:"id"});r.createIndex("cacheName","cacheName",{unique:!1}),r.createIndex("timestamp","timestamp",{unique:!1})}_upgradeDbAndDeleteOldDbs(e){this._upgradeDb(e),this._cacheName&&xe(this._cacheName)}setTimestamp(e,r){return i(this,null,function*(){e=be(e);let o={url:e,timestamp:r,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,r){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||r&&n>=r?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+"|"+be(e)}getDb(){return i(this,null,function*(){return this._db||(this._db=yield we(Qe,1,{upgrade:this._upgradeDbAndDeleteOldDbs.bind(this)})),this._db})}};var A=class{constructor(e,r={}){this._isRunning=!1,this._rerunRequested=!1,this._maxEntries=r.maxEntries,this._maxAgeSeconds=r.maxAgeSeconds,this._matchOptions=r.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,r=yield this._timestampModel.expireEntries(e,this._maxEntries),o=yield self.caches.open(this._cacheName);for(let s of r)yield o.delete(s,this._matchOptions);this._isRunning=!1,this._rerunRequested&&(this._rerunRequested=!1,R(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 r=yield this._timestampModel.getTimestamp(e),o=Date.now()-this._maxAgeSeconds*1e3;return r!==void 0?r<o:!0}else return!1})}delete(){return i(this,null,function*(){this._rerunRequested=!1,yield this._timestampModel.expireEntries(1/0)})}};var L=class{constructor(e={}){this.cachedResponseWillBeUsed=n=>i(this,[n],function*({event:r,request:o,cacheName:s,cachedResponse:a}){if(!a)return null;let c=this._isResponseDateFresh(a),u=this._getCacheExpiration(s);R(u.expireEntries());let l=u.updateTimestamp(o.url);if(r)try{r.waitUntil(l)}catch(m){}return c?a:null}),this.cacheDidUpdate=s=>i(this,[s],function*({cacheName:r,request:o}){let a=this._getCacheExpiration(r);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===b.getRuntimeName())throw new p("expire-custom-caches-only");let r=this._cacheExpirations.get(e);return r||(r=new A(e,this._config),this._cacheExpirations.set(e,r)),r}_isResponseDateFresh(e){if(!this._maxAgeSeconds)return!0;let r=this._getDateHeaderTimestamp(e);if(r===null)return!0;let o=Date.now();return r>=o-this._maxAgeSeconds*1e3}_getDateHeaderTimestamp(e){if(!e.headers.has("date"))return null;let r=e.headers.get("date"),s=new Date(r).getTime();return isNaN(s)?null:s}deleteCacheAndMetadata(){return i(this,null,function*(){for(let[e,r]of this._cacheExpirations)yield self.caches.delete(e),yield r.delete();this._cacheExpirations=new Map})}};"use strict";try{self["workbox:strategies:6.2.4"]&&_()}catch(t){}function P(t){return typeof t=="string"?new Request(t):t}var q=class{constructor(e,r){this._cacheKeys={},Object.assign(this,r),this.event=r.event,this._strategy=e,this._handlerDeferred=new $,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:r}=this,o=P(e);if(o.mode==="navigate"&&r instanceof FetchEvent&&r.preloadResponse){let n=yield r.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:r})}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:r,request:a,response:n});return n}catch(n){throw s&&(yield this.runCallbacks("fetchDidFail",{error:n,event:r,originalRequest:s.clone(),request:a.clone()})),n}})}fetchAndCachePut(e){return i(this,null,function*(){let r=yield this.fetch(e),o=r.clone();return this.waitUntil(this.cachePut(e,o)),r})}cacheMatch(e){return i(this,null,function*(){let r=P(e),o,{cacheName:s,matchOptions:a}=this._strategy,n=yield this.getCacheKey(r,"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,r){return i(this,null,function*(){let o=P(e);yield j(0);let s=yield this.getCacheKey(o,"write");if(!r)throw new p("cache-put-with-no-response",{url:U(s.url)});let a=yield this._ensureResponseSafeToCache(r);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,r){return i(this,null,function*(){if(!this._cacheKeys[r]){let o=e;for(let s of this.iterateCallbacks("cacheKeyWillBeUsed"))o=P(yield s({mode:r,request:o,event:this.event,params:this.params}));this._cacheKeys[r]=o}return this._cacheKeys[r]})}hasCallback(e){for(let r of this._strategy.plugins)if(e in r)return!0;return!1}runCallbacks(e,r){return i(this,null,function*(){for(let o of this.iterateCallbacks(e))yield o(r)})}*iterateCallbacks(e){for(let r of this._strategy.plugins)if(typeof r[e]=="function"){let o=this._pluginStateMap.get(r);yield a=>{let n=Object.assign(Object.assign({},a),{state:o});return r[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 r=e,o=!1;for(let s of this.iterateCallbacks("cacheWillUpdate"))if(r=(yield s({request:this.request,response:r,event:this.event}))||void 0,o=!0,!r)break;return o||r&&r.status!==200&&(r=void 0),r})}};var w=class{constructor(e={}){this.cacheName=b.getRuntimeName(e.cacheName),this.plugins=e.plugins||[],this.fetchOptions=e.fetchOptions,this.matchOptions=e.matchOptions}handle(e){let[r]=this.handleAll(e);return r}handleAll(e){e instanceof FetchEvent&&(e={event:e,request:e.request});let r=e.event,o=typeof e.request=="string"?new Request(e.request):e.request,s="params"in e?e.params:void 0,a=new q(this,{event:r,request:o,params:s}),n=this._getResponse(a,o,r),c=this._awaitComplete(n,a,o,r);return[n,c]}_getResponse(e,r,o){return i(this,null,function*(){yield e.runCallbacks("handlerWillStart",{event:o,request:r});let s;try{if(s=yield this._handle(r,e),!s||s.type==="error")throw new p("no-response",{url:r.url})}catch(a){if(a instanceof Error){for(let n of e.iterateCallbacks("handlerDidError"))if(s=yield n({error:a,event:o,request:r}),s)break}if(!s)throw a}for(let a of e.iterateCallbacks("handlerWillRespond"))s=yield a({event:o,request:r,response:s});return s})}_awaitComplete(e,r,o,s){return i(this,null,function*(){let a,n;try{a=yield e}catch(c){}try{yield r.runCallbacks("handlerDidRespond",{event:s,request:o,response:a}),yield r.doneWaiting()}catch(c){c instanceof Error&&(n=c)}if(yield r.runCallbacks("handlerDidComplete",{event:s,request:o,response:a,error:n}),r.destroy(),n)throw n})}};var M=class extends w{_handle(e,r){return i(this,null,function*(){let o=[],s=yield r.cacheMatch(e),a;if(!s)try{s=yield r.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:t}){return t.status===200||t.status===0?t:null})};var I=class extends w{constructor(e={}){super(e);this.plugins.some(r=>"cacheWillUpdate"in r)||this.plugins.unshift(ne)}_handle(e,r){return i(this,null,function*(){let o=[],s=r.fetchAndCachePut(e).catch(()=>{}),a=yield r.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 _e=!1,Je=48,Ye=48,ze=Je+Ye,Nn=`calc(100vh - ${ze}px)`;var V="webpub-cache";var Ne="PRECACHE_PUBLICATIONS",ye=7*24*60*60;"use strict";try{self["workbox:routing:6.2.4"]&&_()}catch(t){}var F="GET";var N=t=>t&&typeof t=="object"?t:{handle:t};var x=class{constructor(e,r,o=F){this.handler=N(r),this.match=e,this.method=o}setCatchHandler(e){this.catchHandler=N(e)}};var H=class extends x{constructor(e,r,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,r,o)}};var B=class{constructor(){this._routes=new Map,this._defaultHandlerMap=new Map}get routes(){return this._routes}addFetchListener(){self.addEventListener("fetch",e=>{let{request:r}=e,o=this.handleRequest({request:r,event:e});o&&e.respondWith(o)})}addCacheListener(){self.addEventListener("message",e=>{if(e.data&&e.data.type==="CACHE_URLS"){let{payload:r}=e.data,o=Promise.all(r.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:r}){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:r,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:r,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:r,params:a})}catch(E){E instanceof Error&&(d=E)}if(this._catchHandler)return this._catchHandler.handle({url:o,request:e,event:r});throw d}))),m}findMatchingRoute({url:e,sameOrigin:r,request:o,event:s}){let a=this._routes.get(o.method)||[];for(let n of a){let c,u=n.match({url:e,sameOrigin:r,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,r=F){this._defaultHandlerMap.set(r,N(e))}setCatchHandler(e){this._catchHandler=N(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 r=this._routes.get(e.method).indexOf(e);if(r>-1)this._routes.get(e.method).splice(r,1);else throw new p("unregister-route-route-not-registered")}};var D,G=()=>(D||(D=new B,D.addFetchListener(),D.addCacheListener()),D);function O(t,e,r){let o;if(typeof t=="string"){let a=new URL(t,location.href),n=({url:c})=>c.href===a.href;o=new x(n,e,r)}else if(t instanceof RegExp)o=new H(t,e,r);else if(typeof t=="function")o=new x(t,e,r);else if(t instanceof x)o=t;else throw new p("unsupported-route-type",{moduleName:"workbox-routing",funcName:"registerRoute",paramName:"capture"});return G().registerRoute(o),o}var Xe="v2";X();function ve({cacheExpirationSeconds:t=ye}={}){T("INITIALIZING"),self.addEventListener("install",o=>{T("INSTALLING ");function s(){return i(this,null,function*(){yield self.skipWaiting(),T("INSTALLED")})}o.waitUntil(s)}),self.addEventListener("message",o=>i(this,null,function*(){if(o.data.type===Ne){if(T("Precaching publications"),typeof o.data.publications!="object"){console.error("Precache event missing publications");return}yield r(o.data.publications)}}));let e=new M({cacheName:V,plugins:[new L({maxAgeSeconds:t})]});function r(o){return i(this,null,function*(){var u;let s=yield caches.open(V);for(let l of o)for(let m of(u=l.swrUrls)!=null?u:[])T(`Routing ${m}`),O(m,new I({cacheName:V}));let c=(yield Promise.allSettled(o.map(l=>i(this,null,function*(){let m=Re(l.manifestUrl,l.proxyUrl);O(m,e);let h=yield s.match(m);if(h)return k(v({},l),{manifest:yield h.json()});let d=yield fetch(m);ke(m,d),yield s.put(m,d.clone());let E=yield d.json();return k(v({},l),{manifest:E})})))).map(l=>l.status==="fulfilled"?l.value:void 0).filter(Ze).map(l=>i(this,null,function*(){var E,ae;let m=je((E=l.manifest.resources)!=null?E:[],l.manifestUrl,l.proxyUrl),h=je((ae=l.manifest.readingOrder)!=null?ae:[],l.manifestUrl,l.proxyUrl),d=Array.from(new Set([...m,...h]));yield Promise.all(d.map(y=>i(this,null,function*(){if(O(y,e),yield s.match(y))return;let ie=yield fetch(y);return ke(y,ie),yield s.put(y,ie)})))}));return yield Promise.allSettled(c)})}}function Ze(t){return!!t}function ke(t,e){if(!e.ok){let r=`Bad response status for: ${t}. Status: ${e.status}`;throw console.warn(r),new Error(r)}}function Re(t,e){return e?`${e}${encodeURIComponent(t)}`:t}function er(t,e,r){return Re(new URL(t,e).toString(),r)}function je(t,e,r){return t.map(o=>er(o.href,e,r))}function T(t){_e&&console.log(`SW (${Xe}) -`,t)}
|
|
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 nt={};Ue(nt,{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 Me=(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),Me(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 V(r){return typeof r=="string"?new Request(r):r}var I=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=V(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=V(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=V(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=V(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 I(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 M=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 Xe=48,ze=48,Ze=Xe+ze,bn=`calc(100vh - ${Ze}px)`;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 rt="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 M({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(ot).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 ot(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 st(r,e,t){return ve(new URL(r,e).toString(),t)}function Re(r,e,t){return r.map(o=>st(o.href,e,t))}function $(r){!1&&console.log(`SW (${rt}) -`,r)}module.exports=Pe(nt);
|
|
2
2
|
//# sourceMappingURL=sw.js.map
|