jekyll-pwa-plugin 2.2.1 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jekyll-pwa-plugin.rb +1 -1
  3. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-background-sync.dev.js +1 -1
  4. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-background-sync.dev.js.map +1 -1
  5. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-background-sync.prod.js +1 -1
  6. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-background-sync.prod.js.map +1 -1
  7. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-broadcast-cache-update.dev.js +1 -1
  8. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-broadcast-cache-update.dev.js.map +1 -1
  9. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-broadcast-cache-update.prod.js +1 -1
  10. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-broadcast-cache-update.prod.js.map +1 -1
  11. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-cache-expiration.dev.js +1 -1
  12. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-cache-expiration.dev.js.map +1 -1
  13. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-cache-expiration.prod.js +1 -1
  14. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-cache-expiration.prod.js.map +1 -1
  15. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-cacheable-response.dev.js +1 -1
  16. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-cacheable-response.dev.js.map +1 -1
  17. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-cacheable-response.prod.js +1 -1
  18. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-cacheable-response.prod.js.map +1 -1
  19. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-core.dev.js +1 -1
  20. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-core.dev.js.map +1 -1
  21. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-core.prod.js +1 -1
  22. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-core.prod.js.map +1 -1
  23. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-google-analytics.dev.js +1 -1
  24. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-google-analytics.dev.js.map +1 -1
  25. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-google-analytics.prod.js +1 -1
  26. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-google-analytics.prod.js.map +1 -1
  27. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-navigation-preload.dev.js +1 -1
  28. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-navigation-preload.dev.js.map +1 -1
  29. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-navigation-preload.prod.js +1 -1
  30. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-navigation-preload.prod.js.map +1 -1
  31. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-precaching.dev.js +7 -5
  32. data/lib/vendor/workbox-v3.6.3/workbox-precaching.dev.js.map +1 -0
  33. data/lib/vendor/workbox-v3.6.3/workbox-precaching.prod.js +3 -0
  34. data/lib/vendor/workbox-v3.6.3/workbox-precaching.prod.js.map +1 -0
  35. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-range-requests.dev.js +1 -1
  36. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-range-requests.dev.js.map +1 -1
  37. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-range-requests.prod.js +1 -1
  38. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-range-requests.prod.js.map +1 -1
  39. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-routing.dev.js +1 -1
  40. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-routing.dev.js.map +1 -1
  41. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-routing.prod.js +1 -1
  42. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-routing.prod.js.map +1 -1
  43. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-strategies.dev.js +1 -1
  44. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-strategies.dev.js.map +1 -1
  45. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-strategies.prod.js +1 -1
  46. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-strategies.prod.js.map +1 -1
  47. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-streams.dev.js +1 -1
  48. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-streams.dev.js.map +1 -1
  49. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-streams.prod.js +1 -1
  50. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-streams.prod.js.map +1 -1
  51. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-sw.js +1 -1
  52. data/lib/vendor/{workbox-v3.6.2 → workbox-v3.6.3}/workbox-sw.js.map +1 -1
  53. metadata +53 -53
  54. data/lib/vendor/workbox-v3.6.2/workbox-precaching.dev.js.map +0 -1
  55. data/lib/vendor/workbox-v3.6.2/workbox-precaching.prod.js +0 -3
  56. data/lib/vendor/workbox-v3.6.2/workbox-precaching.prod.js.map +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c5407c4c53b372eb10d93be0efcaa326f4eb0d79
4
- data.tar.gz: 16aabca2ebb56fdbe613743a7b21d9323601f103
3
+ metadata.gz: 692f371733eaf92038db1c47d8682f43757dd306
4
+ data.tar.gz: 0b433d9067842365a5a34ae4d0570197343738ea
5
5
  SHA512:
6
- metadata.gz: ca836c9a306622233c22bc8e33e4eb9a1d0b0aa973e456aa42656c090eb8d25567a19303feafea659d53d46b3179ea772617b79eba8f9a2086b6b3cec5bd932e
7
- data.tar.gz: 74a3b9c2d80f4ec9e9365c775dc8a93b08959499e2afdff35b4c30d2cde6a01c4f516029a7679d04ff50d72499bb2194a4c1d3fb2074d97605758453c19540a6
6
+ metadata.gz: 50de49bc92959f5b02f8c8ab47fe104b2ed6dc1b8385817d28b44106c157b9ddac8e7c5c256e359bbaca9c090acff5ba916293887351ad5dc30fae81e4d5e170
7
+ data.tar.gz: 4bd7a2f7e2bfa6bdd3219bace9216e5779031d8a60d62d7a45c57052e7d6b0e178d1ae8bb587854909383e08925c23561882f8db2f8502871547e04963ae2ad9
@@ -112,7 +112,7 @@ class SWHelper
112
112
  # write service-worker.js
113
113
  sw_src_file_str = File.read(@site.in_source_dir(@sw_src_filepath))
114
114
  workbox_dir = File.join(@site.baseurl.to_s, dest_js_directory, "workbox-#{SWHelper::WORKBOX_VERSION}")
115
- import_scripts_str =
115
+ import_scripts_str =
116
116
  <<-SCRIPT
117
117
  importScripts("#{workbox_dir}/workbox-sw.js");
118
118
  workbox.setConfig({modulePathPrefix: "#{workbox_dir}"});
@@ -3,7 +3,7 @@ this.workbox.backgroundSync = (function (DBWrapper_mjs,WorkboxError_mjs,logger_m
3
3
  'use strict';
4
4
 
5
5
  try {
6
- self.workbox.v['workbox:background-sync:3.6.2'] = 1;
6
+ self.workbox.v['workbox:background-sync:3.6.3'] = 1;
7
7
  } catch (e) {} // eslint-disable-line
8
8
 
9
9
  /*
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-background-sync/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.backgroundSync = (function (DBWrapper_mjs,WorkboxError_mjs,logger_mjs,assert_mjs,getFriendlyURL_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:background-sync:3.6.2'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const serializableProperties = ['method', 'referrer', 'referrerPolicy', 'mode', 'credentials', 'cache', 'redirect', 'integrity', 'keepalive'];\n\n /**\n * A class to make it easier to serialize and de-serialize requests so they\n * can be stored in IndexedDB.\n *\n * @private\n */\n class StorableRequest {\n /**\n * Converts a Request object to a plain object that can be structured\n * cloned or JSON-stringified.\n *\n * @param {Request} request\n * @return {Promise<StorableRequest>}\n *\n * @private\n */\n static fromRequest(request) {\n return babelHelpers.asyncToGenerator(function* () {\n const requestInit = { headers: {} };\n\n // Set the body if present.\n if (request.method !== 'GET') {\n // Use blob to support non-text request bodies,\n // and clone first in case the caller still needs the request.\n requestInit.body = yield request.clone().blob();\n }\n\n // Convert the headers from an iterable to an object.\n for (const [key, value] of request.headers.entries()) {\n requestInit.headers[key] = value;\n }\n\n // Add all other serializable request properties\n for (const prop of serializableProperties) {\n if (request[prop] !== undefined) {\n requestInit[prop] = request[prop];\n }\n }\n\n return new StorableRequest({ url: request.url, requestInit });\n })();\n }\n\n /**\n * Accepts a URL and RequestInit dictionary that can be used to create a\n * new Request object. A timestamp is also generated so consumers can\n * reference when the object was created.\n *\n * @param {Object} param1\n * @param {string} param1.url\n * @param {Object} param1.requestInit\n * See: https://fetch.spec.whatwg.org/#requestinit\n * @param {number} param1.timestamp The time the request was created,\n * defaulting to the current time if not specified.\n *\n * @private\n */\n constructor({ url, requestInit, timestamp = Date.now() }) {\n this.url = url;\n this.requestInit = requestInit;\n\n // \"Private\"\n this._timestamp = timestamp;\n }\n\n /**\n * Gets the private _timestamp property.\n *\n * @return {number}\n *\n * @private\n */\n get timestamp() {\n return this._timestamp;\n }\n\n /**\n * Coverts this instance to a plain Object.\n *\n * @return {Object}\n *\n * @private\n */\n toObject() {\n return {\n url: this.url,\n timestamp: this.timestamp,\n requestInit: this.requestInit\n };\n }\n\n /**\n * Converts this instance to a Request.\n *\n * @return {Request}\n *\n * @private\n */\n toRequest() {\n return new Request(this.url, this.requestInit);\n }\n\n /**\n * Creates and returns a deep clone of the instance.\n *\n * @return {StorableRequest}\n *\n * @private\n */\n clone() {\n const requestInit = Object.assign({}, this.requestInit);\n requestInit.headers = Object.assign({}, this.requestInit.headers);\n if (this.requestInit.body) {\n requestInit.body = this.requestInit.body.slice();\n }\n\n return new StorableRequest({\n url: this.url,\n timestamp: this.timestamp,\n requestInit\n });\n }\n }\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const DB_NAME = 'workbox-background-sync';\n const OBJECT_STORE_NAME = 'requests';\n const INDEXED_PROP = 'queueName';\n const TAG_PREFIX = 'workbox-background-sync';\n const MAX_RETENTION_TIME = 60 * 24 * 7; // 7 days in minutes\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * A class to manage storing requests from a Queue in IndexedbDB,\n * indexed by their queue name for easier access.\n *\n * @private\n */\n class QueueStore {\n /**\n * Associates this instance with a Queue instance, so entries added can be\n * identified by their queue name.\n *\n * @param {Queue} queue\n *\n * @private\n */\n constructor(queue) {\n this._queue = queue;\n this._db = new DBWrapper_mjs.DBWrapper(DB_NAME, 1, {\n onupgradeneeded: evt => evt.target.result.createObjectStore(OBJECT_STORE_NAME, { autoIncrement: true }).createIndex(INDEXED_PROP, INDEXED_PROP, { unique: false })\n });\n }\n\n /**\n * Takes a StorableRequest instance, converts it to an object and adds it\n * as an entry in the object store.\n *\n * @param {StorableRequest} storableRequest\n *\n * @private\n */\n addEntry(storableRequest) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this._db.add(OBJECT_STORE_NAME, {\n queueName: _this._queue.name,\n storableRequest: storableRequest.toObject()\n });\n })();\n }\n\n /**\n * Gets the oldest entry in the object store, removes it, and returns the\n * value as a StorableRequest instance. If no entry exists, it returns\n * undefined.\n *\n * @return {StorableRequest|undefined}\n *\n * @private\n */\n getAndRemoveOldestEntry() {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const [entry] = yield _this2._db.getAllMatching(OBJECT_STORE_NAME, {\n index: INDEXED_PROP,\n query: IDBKeyRange.only(_this2._queue.name),\n count: 1,\n includeKeys: true\n });\n\n if (entry) {\n yield _this2._db.delete(OBJECT_STORE_NAME, entry.primaryKey);\n return new StorableRequest(entry.value.storableRequest);\n }\n })();\n }\n }\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const queueNames = new Set();\n\n /**\n * A class to manage storing failed requests in IndexedDB and retrying them\n * later. All parts of the storing and replaying process are observable via\n * callbacks.\n *\n * @memberof workbox.backgroundSync\n */\n class Queue {\n /**\n * Creates an instance of Queue with the given options\n *\n * @param {string} name The unique name for this queue. This name must be\n * unique as it's used to register sync events and store requests\n * in IndexedDB specific to this instance. An error will be thrown if\n * a duplicate name is detected.\n * @param {Object} [options]\n * @param {Object} [options.callbacks] Callbacks to observe the lifecycle of\n * queued requests. Use these to respond to or modify the requests\n * during the replay process.\n * @param {function(StorableRequest):undefined}\n * [options.callbacks.requestWillEnqueue]\n * Invoked immediately before the request is stored to IndexedDB. Use\n * this callback to modify request data at store time.\n * @param {function(StorableRequest):undefined}\n * [options.callbacks.requestWillReplay]\n * Invoked immediately before the request is re-fetched. Use this\n * callback to modify request data at fetch time.\n * @param {function(Array<StorableRequest>):undefined}\n * [options.callbacks.queueDidReplay]\n * Invoked after all requests in the queue have successfully replayed.\n * @param {number} [options.maxRetentionTime = 7 days] The amount of time (in\n * minutes) a request may be retried. After this amount of time has\n * passed, the request will be deleted from the queue.\n */\n constructor(name, {\n callbacks = {},\n maxRetentionTime = MAX_RETENTION_TIME\n } = {}) {\n // Ensure the store name is not already being used\n if (queueNames.has(name)) {\n throw new WorkboxError_mjs.WorkboxError('duplicate-queue-name', { name });\n } else {\n queueNames.add(name);\n }\n\n this._name = name;\n this._callbacks = callbacks;\n this._maxRetentionTime = maxRetentionTime;\n this._queueStore = new QueueStore(this);\n\n this._addSyncListener();\n }\n\n /**\n * @return {string}\n */\n get name() {\n return this._name;\n }\n\n /**\n * Stores the passed request into IndexedDB. The database used is\n * `workbox-background-sync` and the object store name is the same as\n * the name this instance was created with (to guarantee it's unique).\n *\n * @param {Request} request The request object to store.\n */\n addRequest(request) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-background-sync',\n className: 'Queue',\n funcName: 'addRequest',\n paramName: 'request'\n });\n }\n\n const storableRequest = yield StorableRequest.fromRequest(request.clone());\n yield _this._runCallback('requestWillEnqueue', storableRequest);\n yield _this._queueStore.addEntry(storableRequest);\n yield _this._registerSync();\n {\n logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(storableRequest.url)}' has been\n added to background sync queue '${_this._name}'.`);\n }\n })();\n }\n\n /**\n * Retrieves all stored requests in IndexedDB and retries them. If the\n * queue contained requests that were successfully replayed, the\n * `queueDidReplay` callback is invoked (which implies the queue is\n * now empty). If any of the requests fail, a new sync registration is\n * created to retry again later.\n */\n replayRequests() {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const now = Date.now();\n const replayedRequests = [];\n const failedRequests = [];\n\n let storableRequest;\n while (storableRequest = yield _this2._queueStore.getAndRemoveOldestEntry()) {\n // Make a copy so the unmodified request can be stored\n // in the event of a replay failure.\n const storableRequestClone = storableRequest.clone();\n\n // Ignore requests older than maxRetentionTime.\n const maxRetentionTimeInMs = _this2._maxRetentionTime * 60 * 1000;\n if (now - storableRequest.timestamp > maxRetentionTimeInMs) {\n continue;\n }\n\n yield _this2._runCallback('requestWillReplay', storableRequest);\n\n const replay = { request: storableRequest.toRequest() };\n\n try {\n // Clone the request before fetching so callbacks get an unused one.\n replay.response = yield fetch(replay.request.clone());\n {\n logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(storableRequest.url)}'\n has been replayed`);\n }\n } catch (err) {\n {\n logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(storableRequest.url)}'\n failed to replay`);\n }\n replay.error = err;\n failedRequests.push(storableRequestClone);\n }\n\n replayedRequests.push(replay);\n }\n\n yield _this2._runCallback('queueDidReplay', replayedRequests);\n\n // If any requests failed, put the failed requests back in the queue\n // and rethrow the failed requests count.\n if (failedRequests.length) {\n yield Promise.all(failedRequests.map(function (storableRequest) {\n return _this2._queueStore.addEntry(storableRequest);\n }));\n\n throw new WorkboxError_mjs.WorkboxError('queue-replay-failed', { name: _this2._name, count: failedRequests.length });\n }\n })();\n }\n\n /**\n * Runs the passed callback if it exists.\n *\n * @private\n * @param {string} name The name of the callback on this._callbacks.\n * @param {...*} args The arguments to invoke the callback with.\n */\n _runCallback(name, ...args) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (typeof _this3._callbacks[name] === 'function') {\n yield _this3._callbacks[name].apply(null, args);\n }\n })();\n }\n\n /**\n * In sync-supporting browsers, this adds a listener for the sync event.\n * In non-sync-supporting browsers, this will retry the queue on service\n * worker startup.\n *\n * @private\n */\n _addSyncListener() {\n if ('sync' in registration) {\n self.addEventListener('sync', event => {\n if (event.tag === `${TAG_PREFIX}:${this._name}`) {\n {\n logger_mjs.logger.log(`Background sync for tag '${event.tag}'\n has been received, starting replay now`);\n }\n event.waitUntil(this.replayRequests());\n }\n });\n } else {\n {\n logger_mjs.logger.log(`Background sync replaying without background sync event`);\n }\n // If the browser doesn't support background sync, retry\n // every time the service worker starts up as a fallback.\n this.replayRequests();\n }\n }\n\n /**\n * Registers a sync event with a tag unique to this instance.\n *\n * @private\n */\n _registerSync() {\n var _this4 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if ('sync' in registration) {\n try {\n yield registration.sync.register(`${TAG_PREFIX}:${_this4._name}`);\n } catch (err) {\n // This means the registration failed for some reason, possibly due to\n // the user disabling it.\n {\n logger_mjs.logger.warn(`Unable to register sync event for '${_this4._name}'.`, err);\n }\n }\n }\n })();\n }\n\n /**\n * Returns the set of queue names. This is primarily used to reset the list\n * of queue names in tests.\n *\n * @return {Set}\n *\n * @private\n */\n static get _queueNames() {\n return queueNames;\n }\n }\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * A class implementing the `fetchDidFail` lifecycle callback. This makes it\n * easier to add failed requests to a background sync Queue.\n *\n * @memberof workbox.backgroundSync\n */\n class Plugin {\n /**\n * @param {...*} queueArgs Args to forward to the composed Queue instance.\n * See the [Queue]{@link workbox.backgroundSync.Queue} documentation for\n * parameter details.\n */\n constructor(...queueArgs) {\n this._queue = new Queue(...queueArgs);\n this.fetchDidFail = this.fetchDidFail.bind(this);\n }\n\n /**\n * @param {Object} options\n * @param {Request} options.request\n * @private\n */\n fetchDidFail({ request }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this._queue.addRequest(request);\n })();\n }\n }\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var publicAPI = /*#__PURE__*/Object.freeze({\n Queue: Queue,\n Plugin: Plugin\n });\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n return publicAPI;\n\n}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));\n"],"file":"workbox-background-sync.dev.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-background-sync/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.backgroundSync = (function (DBWrapper_mjs,WorkboxError_mjs,logger_mjs,assert_mjs,getFriendlyURL_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:background-sync:3.6.3'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const serializableProperties = ['method', 'referrer', 'referrerPolicy', 'mode', 'credentials', 'cache', 'redirect', 'integrity', 'keepalive'];\n\n /**\n * A class to make it easier to serialize and de-serialize requests so they\n * can be stored in IndexedDB.\n *\n * @private\n */\n class StorableRequest {\n /**\n * Converts a Request object to a plain object that can be structured\n * cloned or JSON-stringified.\n *\n * @param {Request} request\n * @return {Promise<StorableRequest>}\n *\n * @private\n */\n static fromRequest(request) {\n return babelHelpers.asyncToGenerator(function* () {\n const requestInit = { headers: {} };\n\n // Set the body if present.\n if (request.method !== 'GET') {\n // Use blob to support non-text request bodies,\n // and clone first in case the caller still needs the request.\n requestInit.body = yield request.clone().blob();\n }\n\n // Convert the headers from an iterable to an object.\n for (const [key, value] of request.headers.entries()) {\n requestInit.headers[key] = value;\n }\n\n // Add all other serializable request properties\n for (const prop of serializableProperties) {\n if (request[prop] !== undefined) {\n requestInit[prop] = request[prop];\n }\n }\n\n return new StorableRequest({ url: request.url, requestInit });\n })();\n }\n\n /**\n * Accepts a URL and RequestInit dictionary that can be used to create a\n * new Request object. A timestamp is also generated so consumers can\n * reference when the object was created.\n *\n * @param {Object} param1\n * @param {string} param1.url\n * @param {Object} param1.requestInit\n * See: https://fetch.spec.whatwg.org/#requestinit\n * @param {number} param1.timestamp The time the request was created,\n * defaulting to the current time if not specified.\n *\n * @private\n */\n constructor({ url, requestInit, timestamp = Date.now() }) {\n this.url = url;\n this.requestInit = requestInit;\n\n // \"Private\"\n this._timestamp = timestamp;\n }\n\n /**\n * Gets the private _timestamp property.\n *\n * @return {number}\n *\n * @private\n */\n get timestamp() {\n return this._timestamp;\n }\n\n /**\n * Coverts this instance to a plain Object.\n *\n * @return {Object}\n *\n * @private\n */\n toObject() {\n return {\n url: this.url,\n timestamp: this.timestamp,\n requestInit: this.requestInit\n };\n }\n\n /**\n * Converts this instance to a Request.\n *\n * @return {Request}\n *\n * @private\n */\n toRequest() {\n return new Request(this.url, this.requestInit);\n }\n\n /**\n * Creates and returns a deep clone of the instance.\n *\n * @return {StorableRequest}\n *\n * @private\n */\n clone() {\n const requestInit = Object.assign({}, this.requestInit);\n requestInit.headers = Object.assign({}, this.requestInit.headers);\n if (this.requestInit.body) {\n requestInit.body = this.requestInit.body.slice();\n }\n\n return new StorableRequest({\n url: this.url,\n timestamp: this.timestamp,\n requestInit\n });\n }\n }\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const DB_NAME = 'workbox-background-sync';\n const OBJECT_STORE_NAME = 'requests';\n const INDEXED_PROP = 'queueName';\n const TAG_PREFIX = 'workbox-background-sync';\n const MAX_RETENTION_TIME = 60 * 24 * 7; // 7 days in minutes\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * A class to manage storing requests from a Queue in IndexedbDB,\n * indexed by their queue name for easier access.\n *\n * @private\n */\n class QueueStore {\n /**\n * Associates this instance with a Queue instance, so entries added can be\n * identified by their queue name.\n *\n * @param {Queue} queue\n *\n * @private\n */\n constructor(queue) {\n this._queue = queue;\n this._db = new DBWrapper_mjs.DBWrapper(DB_NAME, 1, {\n onupgradeneeded: evt => evt.target.result.createObjectStore(OBJECT_STORE_NAME, { autoIncrement: true }).createIndex(INDEXED_PROP, INDEXED_PROP, { unique: false })\n });\n }\n\n /**\n * Takes a StorableRequest instance, converts it to an object and adds it\n * as an entry in the object store.\n *\n * @param {StorableRequest} storableRequest\n *\n * @private\n */\n addEntry(storableRequest) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this._db.add(OBJECT_STORE_NAME, {\n queueName: _this._queue.name,\n storableRequest: storableRequest.toObject()\n });\n })();\n }\n\n /**\n * Gets the oldest entry in the object store, removes it, and returns the\n * value as a StorableRequest instance. If no entry exists, it returns\n * undefined.\n *\n * @return {StorableRequest|undefined}\n *\n * @private\n */\n getAndRemoveOldestEntry() {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const [entry] = yield _this2._db.getAllMatching(OBJECT_STORE_NAME, {\n index: INDEXED_PROP,\n query: IDBKeyRange.only(_this2._queue.name),\n count: 1,\n includeKeys: true\n });\n\n if (entry) {\n yield _this2._db.delete(OBJECT_STORE_NAME, entry.primaryKey);\n return new StorableRequest(entry.value.storableRequest);\n }\n })();\n }\n }\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const queueNames = new Set();\n\n /**\n * A class to manage storing failed requests in IndexedDB and retrying them\n * later. All parts of the storing and replaying process are observable via\n * callbacks.\n *\n * @memberof workbox.backgroundSync\n */\n class Queue {\n /**\n * Creates an instance of Queue with the given options\n *\n * @param {string} name The unique name for this queue. This name must be\n * unique as it's used to register sync events and store requests\n * in IndexedDB specific to this instance. An error will be thrown if\n * a duplicate name is detected.\n * @param {Object} [options]\n * @param {Object} [options.callbacks] Callbacks to observe the lifecycle of\n * queued requests. Use these to respond to or modify the requests\n * during the replay process.\n * @param {function(StorableRequest):undefined}\n * [options.callbacks.requestWillEnqueue]\n * Invoked immediately before the request is stored to IndexedDB. Use\n * this callback to modify request data at store time.\n * @param {function(StorableRequest):undefined}\n * [options.callbacks.requestWillReplay]\n * Invoked immediately before the request is re-fetched. Use this\n * callback to modify request data at fetch time.\n * @param {function(Array<StorableRequest>):undefined}\n * [options.callbacks.queueDidReplay]\n * Invoked after all requests in the queue have successfully replayed.\n * @param {number} [options.maxRetentionTime = 7 days] The amount of time (in\n * minutes) a request may be retried. After this amount of time has\n * passed, the request will be deleted from the queue.\n */\n constructor(name, {\n callbacks = {},\n maxRetentionTime = MAX_RETENTION_TIME\n } = {}) {\n // Ensure the store name is not already being used\n if (queueNames.has(name)) {\n throw new WorkboxError_mjs.WorkboxError('duplicate-queue-name', { name });\n } else {\n queueNames.add(name);\n }\n\n this._name = name;\n this._callbacks = callbacks;\n this._maxRetentionTime = maxRetentionTime;\n this._queueStore = new QueueStore(this);\n\n this._addSyncListener();\n }\n\n /**\n * @return {string}\n */\n get name() {\n return this._name;\n }\n\n /**\n * Stores the passed request into IndexedDB. The database used is\n * `workbox-background-sync` and the object store name is the same as\n * the name this instance was created with (to guarantee it's unique).\n *\n * @param {Request} request The request object to store.\n */\n addRequest(request) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-background-sync',\n className: 'Queue',\n funcName: 'addRequest',\n paramName: 'request'\n });\n }\n\n const storableRequest = yield StorableRequest.fromRequest(request.clone());\n yield _this._runCallback('requestWillEnqueue', storableRequest);\n yield _this._queueStore.addEntry(storableRequest);\n yield _this._registerSync();\n {\n logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(storableRequest.url)}' has been\n added to background sync queue '${_this._name}'.`);\n }\n })();\n }\n\n /**\n * Retrieves all stored requests in IndexedDB and retries them. If the\n * queue contained requests that were successfully replayed, the\n * `queueDidReplay` callback is invoked (which implies the queue is\n * now empty). If any of the requests fail, a new sync registration is\n * created to retry again later.\n */\n replayRequests() {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const now = Date.now();\n const replayedRequests = [];\n const failedRequests = [];\n\n let storableRequest;\n while (storableRequest = yield _this2._queueStore.getAndRemoveOldestEntry()) {\n // Make a copy so the unmodified request can be stored\n // in the event of a replay failure.\n const storableRequestClone = storableRequest.clone();\n\n // Ignore requests older than maxRetentionTime.\n const maxRetentionTimeInMs = _this2._maxRetentionTime * 60 * 1000;\n if (now - storableRequest.timestamp > maxRetentionTimeInMs) {\n continue;\n }\n\n yield _this2._runCallback('requestWillReplay', storableRequest);\n\n const replay = { request: storableRequest.toRequest() };\n\n try {\n // Clone the request before fetching so callbacks get an unused one.\n replay.response = yield fetch(replay.request.clone());\n {\n logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(storableRequest.url)}'\n has been replayed`);\n }\n } catch (err) {\n {\n logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(storableRequest.url)}'\n failed to replay`);\n }\n replay.error = err;\n failedRequests.push(storableRequestClone);\n }\n\n replayedRequests.push(replay);\n }\n\n yield _this2._runCallback('queueDidReplay', replayedRequests);\n\n // If any requests failed, put the failed requests back in the queue\n // and rethrow the failed requests count.\n if (failedRequests.length) {\n yield Promise.all(failedRequests.map(function (storableRequest) {\n return _this2._queueStore.addEntry(storableRequest);\n }));\n\n throw new WorkboxError_mjs.WorkboxError('queue-replay-failed', { name: _this2._name, count: failedRequests.length });\n }\n })();\n }\n\n /**\n * Runs the passed callback if it exists.\n *\n * @private\n * @param {string} name The name of the callback on this._callbacks.\n * @param {...*} args The arguments to invoke the callback with.\n */\n _runCallback(name, ...args) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (typeof _this3._callbacks[name] === 'function') {\n yield _this3._callbacks[name].apply(null, args);\n }\n })();\n }\n\n /**\n * In sync-supporting browsers, this adds a listener for the sync event.\n * In non-sync-supporting browsers, this will retry the queue on service\n * worker startup.\n *\n * @private\n */\n _addSyncListener() {\n if ('sync' in registration) {\n self.addEventListener('sync', event => {\n if (event.tag === `${TAG_PREFIX}:${this._name}`) {\n {\n logger_mjs.logger.log(`Background sync for tag '${event.tag}'\n has been received, starting replay now`);\n }\n event.waitUntil(this.replayRequests());\n }\n });\n } else {\n {\n logger_mjs.logger.log(`Background sync replaying without background sync event`);\n }\n // If the browser doesn't support background sync, retry\n // every time the service worker starts up as a fallback.\n this.replayRequests();\n }\n }\n\n /**\n * Registers a sync event with a tag unique to this instance.\n *\n * @private\n */\n _registerSync() {\n var _this4 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if ('sync' in registration) {\n try {\n yield registration.sync.register(`${TAG_PREFIX}:${_this4._name}`);\n } catch (err) {\n // This means the registration failed for some reason, possibly due to\n // the user disabling it.\n {\n logger_mjs.logger.warn(`Unable to register sync event for '${_this4._name}'.`, err);\n }\n }\n }\n })();\n }\n\n /**\n * Returns the set of queue names. This is primarily used to reset the list\n * of queue names in tests.\n *\n * @return {Set}\n *\n * @private\n */\n static get _queueNames() {\n return queueNames;\n }\n }\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * A class implementing the `fetchDidFail` lifecycle callback. This makes it\n * easier to add failed requests to a background sync Queue.\n *\n * @memberof workbox.backgroundSync\n */\n class Plugin {\n /**\n * @param {...*} queueArgs Args to forward to the composed Queue instance.\n * See the [Queue]{@link workbox.backgroundSync.Queue} documentation for\n * parameter details.\n */\n constructor(...queueArgs) {\n this._queue = new Queue(...queueArgs);\n this.fetchDidFail = this.fetchDidFail.bind(this);\n }\n\n /**\n * @param {Object} options\n * @param {Request} options.request\n * @private\n */\n fetchDidFail({ request }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this._queue.addRequest(request);\n })();\n }\n }\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var publicAPI = /*#__PURE__*/Object.freeze({\n Queue: Queue,\n Plugin: Plugin\n });\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n return publicAPI;\n\n}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));\n"],"file":"workbox-background-sync.dev.js"}
@@ -1,3 +1,3 @@
1
- this.workbox=this.workbox||{},this.workbox.backgroundSync=function(e,t){"use strict";try{self.workbox.v["workbox:background-sync:3.6.2"]=1}catch(e){}const r=["method","referrer","referrerPolicy","mode","credentials","cache","redirect","integrity","keepalive"];class s{static fromRequest(e){return babelHelpers.asyncToGenerator(function*(){const t={headers:{}};"GET"!==e.method&&(t.body=yield e.clone().blob());for(const[r,s]of e.headers.entries())t.headers[r]=s;for(const s of r)void 0!==e[s]&&(t[s]=e[s]);return new s({url:e.url,requestInit:t})})()}constructor({url:e,requestInit:t,timestamp:r=Date.now()}){this.url=e,this.requestInit=t,this.e=r}get timestamp(){return this.e}toObject(){return{url:this.url,timestamp:this.timestamp,requestInit:this.requestInit}}toRequest(){return new Request(this.url,this.requestInit)}clone(){const e=Object.assign({},this.requestInit);return e.headers=Object.assign({},this.requestInit.headers),this.requestInit.body&&(e.body=this.requestInit.body.slice()),new s({url:this.url,timestamp:this.timestamp,requestInit:e})}}const i="workbox-background-sync",n="requests",u="queueName",c="workbox-background-sync",o=10080;class l{constructor(t){this.t=t,this.r=new e.DBWrapper(i,1,{onupgradeneeded:e=>e.target.result.createObjectStore(n,{autoIncrement:!0}).createIndex(u,u,{unique:!1})})}addEntry(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.r.add(n,{queueName:t.t.name,storableRequest:e.toObject()})})()}getAndRemoveOldestEntry(){var e=this;return babelHelpers.asyncToGenerator(function*(){const[t]=yield e.r.getAllMatching(n,{index:u,query:IDBKeyRange.only(e.t.name),count:1,includeKeys:!0});if(t)return yield e.r.delete(n,t.primaryKey),new s(t.value.storableRequest)})()}}const a=new Set;class h{constructor(e,{callbacks:r={},maxRetentionTime:s=o}={}){if(a.has(e))throw new t.WorkboxError("duplicate-queue-name",{name:e});a.add(e),this.s=e,this.i=r,this.n=s,this.u=new l(this),this.c()}get name(){return this.s}addRequest(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=yield s.fromRequest(e.clone());yield t.o("requestWillEnqueue",r),yield t.u.addEntry(r),yield t.l()})()}replayRequests(){var e=this;return babelHelpers.asyncToGenerator(function*(){const r=Date.now(),s=[],i=[];let n;for(;n=yield e.u.getAndRemoveOldestEntry();){const t=n.clone(),u=60*e.n*1e3;if(r-n.timestamp>u)continue;yield e.o("requestWillReplay",n);const c={request:n.toRequest()};try{c.response=yield fetch(c.request.clone())}catch(e){c.error=e,i.push(t)}s.push(c)}if(yield e.o("queueDidReplay",s),i.length)throw yield Promise.all(i.map(function(t){return e.u.addEntry(t)})),new t.WorkboxError("queue-replay-failed",{name:e.s,count:i.length})})()}o(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){"function"==typeof r.i[e]&&(yield r.i[e].apply(null,t))})()}c(){"sync"in registration?self.addEventListener("sync",e=>{e.tag===`${c}:${this.s}`&&e.waitUntil(this.replayRequests())}):this.replayRequests()}l(){var e=this;return babelHelpers.asyncToGenerator(function*(){if("sync"in registration)try{yield registration.sync.register(`${c}:${e.s}`)}catch(e){}})()}static get a(){return a}}return Object.freeze({Queue:h,Plugin:class{constructor(...e){this.t=new h(...e),this.fetchDidFail=this.fetchDidFail.bind(this)}fetchDidFail({request:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.t.addRequest(e)})()}}})}(workbox.core._private,workbox.core._private);
1
+ this.workbox=this.workbox||{},this.workbox.backgroundSync=function(e,t){"use strict";try{self.workbox.v["workbox:background-sync:3.6.3"]=1}catch(e){}const r=["method","referrer","referrerPolicy","mode","credentials","cache","redirect","integrity","keepalive"];class s{static fromRequest(e){return babelHelpers.asyncToGenerator(function*(){const t={headers:{}};"GET"!==e.method&&(t.body=yield e.clone().blob());for(const[r,s]of e.headers.entries())t.headers[r]=s;for(const s of r)void 0!==e[s]&&(t[s]=e[s]);return new s({url:e.url,requestInit:t})})()}constructor({url:e,requestInit:t,timestamp:r=Date.now()}){this.url=e,this.requestInit=t,this.e=r}get timestamp(){return this.e}toObject(){return{url:this.url,timestamp:this.timestamp,requestInit:this.requestInit}}toRequest(){return new Request(this.url,this.requestInit)}clone(){const e=Object.assign({},this.requestInit);return e.headers=Object.assign({},this.requestInit.headers),this.requestInit.body&&(e.body=this.requestInit.body.slice()),new s({url:this.url,timestamp:this.timestamp,requestInit:e})}}const i="workbox-background-sync",n="requests",u="queueName",c="workbox-background-sync",o=10080;class l{constructor(t){this.t=t,this.r=new e.DBWrapper(i,1,{onupgradeneeded:e=>e.target.result.createObjectStore(n,{autoIncrement:!0}).createIndex(u,u,{unique:!1})})}addEntry(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.r.add(n,{queueName:t.t.name,storableRequest:e.toObject()})})()}getAndRemoveOldestEntry(){var e=this;return babelHelpers.asyncToGenerator(function*(){const[t]=yield e.r.getAllMatching(n,{index:u,query:IDBKeyRange.only(e.t.name),count:1,includeKeys:!0});if(t)return yield e.r.delete(n,t.primaryKey),new s(t.value.storableRequest)})()}}const a=new Set;class h{constructor(e,{callbacks:r={},maxRetentionTime:s=o}={}){if(a.has(e))throw new t.WorkboxError("duplicate-queue-name",{name:e});a.add(e),this.s=e,this.i=r,this.n=s,this.u=new l(this),this.c()}get name(){return this.s}addRequest(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=yield s.fromRequest(e.clone());yield t.o("requestWillEnqueue",r),yield t.u.addEntry(r),yield t.l()})()}replayRequests(){var e=this;return babelHelpers.asyncToGenerator(function*(){const r=Date.now(),s=[],i=[];let n;for(;n=yield e.u.getAndRemoveOldestEntry();){const t=n.clone(),u=60*e.n*1e3;if(r-n.timestamp>u)continue;yield e.o("requestWillReplay",n);const c={request:n.toRequest()};try{c.response=yield fetch(c.request.clone())}catch(e){c.error=e,i.push(t)}s.push(c)}if(yield e.o("queueDidReplay",s),i.length)throw yield Promise.all(i.map(function(t){return e.u.addEntry(t)})),new t.WorkboxError("queue-replay-failed",{name:e.s,count:i.length})})()}o(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){"function"==typeof r.i[e]&&(yield r.i[e].apply(null,t))})()}c(){"sync"in registration?self.addEventListener("sync",e=>{e.tag===`${c}:${this.s}`&&e.waitUntil(this.replayRequests())}):this.replayRequests()}l(){var e=this;return babelHelpers.asyncToGenerator(function*(){if("sync"in registration)try{yield registration.sync.register(`${c}:${e.s}`)}catch(e){}})()}static get a(){return a}}return Object.freeze({Queue:h,Plugin:class{constructor(...e){this.t=new h(...e),this.fetchDidFail=this.fetchDidFail.bind(this)}fetchDidFail({request:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.t.addRequest(e)})()}}})}(workbox.core._private,workbox.core._private);
2
2
 
3
3
  //# sourceMappingURL=workbox-background-sync.prod.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-background-sync/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.backgroundSync=function(e,t){\"use strict\";try{self.workbox.v[\"workbox:background-sync:3.6.2\"]=1}catch(e){}const r=[\"method\",\"referrer\",\"referrerPolicy\",\"mode\",\"credentials\",\"cache\",\"redirect\",\"integrity\",\"keepalive\"];class s{static fromRequest(e){return babelHelpers.asyncToGenerator(function*(){const t={headers:{}};\"GET\"!==e.method&&(t.body=yield e.clone().blob());for(const[r,s]of e.headers.entries())t.headers[r]=s;for(const s of r)void 0!==e[s]&&(t[s]=e[s]);return new s({url:e.url,requestInit:t})})()}constructor({url:e,requestInit:t,timestamp:r=Date.now()}){this.url=e,this.requestInit=t,this.e=r}get timestamp(){return this.e}toObject(){return{url:this.url,timestamp:this.timestamp,requestInit:this.requestInit}}toRequest(){return new Request(this.url,this.requestInit)}clone(){const e=Object.assign({},this.requestInit);return e.headers=Object.assign({},this.requestInit.headers),this.requestInit.body&&(e.body=this.requestInit.body.slice()),new s({url:this.url,timestamp:this.timestamp,requestInit:e})}}const i=\"workbox-background-sync\",n=\"requests\",u=\"queueName\",c=\"workbox-background-sync\",o=10080;class l{constructor(t){this.t=t,this.r=new e.DBWrapper(i,1,{onupgradeneeded:e=>e.target.result.createObjectStore(n,{autoIncrement:!0}).createIndex(u,u,{unique:!1})})}addEntry(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.r.add(n,{queueName:t.t.name,storableRequest:e.toObject()})})()}getAndRemoveOldestEntry(){var e=this;return babelHelpers.asyncToGenerator(function*(){const[t]=yield e.r.getAllMatching(n,{index:u,query:IDBKeyRange.only(e.t.name),count:1,includeKeys:!0});if(t)return yield e.r.delete(n,t.primaryKey),new s(t.value.storableRequest)})()}}const a=new Set;class h{constructor(e,{callbacks:r={},maxRetentionTime:s=o}={}){if(a.has(e))throw new t.WorkboxError(\"duplicate-queue-name\",{name:e});a.add(e),this.s=e,this.i=r,this.n=s,this.u=new l(this),this.c()}get name(){return this.s}addRequest(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=yield s.fromRequest(e.clone());yield t.o(\"requestWillEnqueue\",r),yield t.u.addEntry(r),yield t.l()})()}replayRequests(){var e=this;return babelHelpers.asyncToGenerator(function*(){const r=Date.now(),s=[],i=[];let n;for(;n=yield e.u.getAndRemoveOldestEntry();){const t=n.clone(),u=60*e.n*1e3;if(r-n.timestamp>u)continue;yield e.o(\"requestWillReplay\",n);const c={request:n.toRequest()};try{c.response=yield fetch(c.request.clone())}catch(e){c.error=e,i.push(t)}s.push(c)}if(yield e.o(\"queueDidReplay\",s),i.length)throw yield Promise.all(i.map(function(t){return e.u.addEntry(t)})),new t.WorkboxError(\"queue-replay-failed\",{name:e.s,count:i.length})})()}o(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){\"function\"==typeof r.i[e]&&(yield r.i[e].apply(null,t))})()}c(){\"sync\"in registration?self.addEventListener(\"sync\",e=>{e.tag===`${c}:${this.s}`&&e.waitUntil(this.replayRequests())}):this.replayRequests()}l(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(\"sync\"in registration)try{yield registration.sync.register(`${c}:${e.s}`)}catch(e){}})()}static get a(){return a}}return Object.freeze({Queue:h,Plugin:class{constructor(...e){this.t=new h(...e),this.fetchDidFail=this.fetchDidFail.bind(this)}fetchDidFail({request:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.t.addRequest(e)})()}}})}(workbox.core._private,workbox.core._private);\n"],"file":"workbox-background-sync.prod.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-background-sync/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.backgroundSync=function(e,t){\"use strict\";try{self.workbox.v[\"workbox:background-sync:3.6.3\"]=1}catch(e){}const r=[\"method\",\"referrer\",\"referrerPolicy\",\"mode\",\"credentials\",\"cache\",\"redirect\",\"integrity\",\"keepalive\"];class s{static fromRequest(e){return babelHelpers.asyncToGenerator(function*(){const t={headers:{}};\"GET\"!==e.method&&(t.body=yield e.clone().blob());for(const[r,s]of e.headers.entries())t.headers[r]=s;for(const s of r)void 0!==e[s]&&(t[s]=e[s]);return new s({url:e.url,requestInit:t})})()}constructor({url:e,requestInit:t,timestamp:r=Date.now()}){this.url=e,this.requestInit=t,this.e=r}get timestamp(){return this.e}toObject(){return{url:this.url,timestamp:this.timestamp,requestInit:this.requestInit}}toRequest(){return new Request(this.url,this.requestInit)}clone(){const e=Object.assign({},this.requestInit);return e.headers=Object.assign({},this.requestInit.headers),this.requestInit.body&&(e.body=this.requestInit.body.slice()),new s({url:this.url,timestamp:this.timestamp,requestInit:e})}}const i=\"workbox-background-sync\",n=\"requests\",u=\"queueName\",c=\"workbox-background-sync\",o=10080;class l{constructor(t){this.t=t,this.r=new e.DBWrapper(i,1,{onupgradeneeded:e=>e.target.result.createObjectStore(n,{autoIncrement:!0}).createIndex(u,u,{unique:!1})})}addEntry(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.r.add(n,{queueName:t.t.name,storableRequest:e.toObject()})})()}getAndRemoveOldestEntry(){var e=this;return babelHelpers.asyncToGenerator(function*(){const[t]=yield e.r.getAllMatching(n,{index:u,query:IDBKeyRange.only(e.t.name),count:1,includeKeys:!0});if(t)return yield e.r.delete(n,t.primaryKey),new s(t.value.storableRequest)})()}}const a=new Set;class h{constructor(e,{callbacks:r={},maxRetentionTime:s=o}={}){if(a.has(e))throw new t.WorkboxError(\"duplicate-queue-name\",{name:e});a.add(e),this.s=e,this.i=r,this.n=s,this.u=new l(this),this.c()}get name(){return this.s}addRequest(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=yield s.fromRequest(e.clone());yield t.o(\"requestWillEnqueue\",r),yield t.u.addEntry(r),yield t.l()})()}replayRequests(){var e=this;return babelHelpers.asyncToGenerator(function*(){const r=Date.now(),s=[],i=[];let n;for(;n=yield e.u.getAndRemoveOldestEntry();){const t=n.clone(),u=60*e.n*1e3;if(r-n.timestamp>u)continue;yield e.o(\"requestWillReplay\",n);const c={request:n.toRequest()};try{c.response=yield fetch(c.request.clone())}catch(e){c.error=e,i.push(t)}s.push(c)}if(yield e.o(\"queueDidReplay\",s),i.length)throw yield Promise.all(i.map(function(t){return e.u.addEntry(t)})),new t.WorkboxError(\"queue-replay-failed\",{name:e.s,count:i.length})})()}o(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){\"function\"==typeof r.i[e]&&(yield r.i[e].apply(null,t))})()}c(){\"sync\"in registration?self.addEventListener(\"sync\",e=>{e.tag===`${c}:${this.s}`&&e.waitUntil(this.replayRequests())}):this.replayRequests()}l(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(\"sync\"in registration)try{yield registration.sync.register(`${c}:${e.s}`)}catch(e){}})()}static get a(){return a}}return Object.freeze({Queue:h,Plugin:class{constructor(...e){this.t=new h(...e),this.fetchDidFail=this.fetchDidFail.bind(this)}fetchDidFail({request:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.t.addRequest(e)})()}}})}(workbox.core._private,workbox.core._private);\n"],"file":"workbox-background-sync.prod.js"}
@@ -3,7 +3,7 @@ this.workbox.broadcastUpdate = (function (exports,WorkboxError_mjs,logger_mjs,as
3
3
  'use strict';
4
4
 
5
5
  try {
6
- self.workbox.v['workbox:broadcast-cache-update:3.6.2'] = 1;
6
+ self.workbox.v['workbox:broadcast-cache-update:3.6.3'] = 1;
7
7
  } catch (e) {} // eslint-disable-line
8
8
 
9
9
  /*
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-broadcast-cache-update/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.broadcastUpdate = (function (exports,WorkboxError_mjs,logger_mjs,assert_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:broadcast-cache-update:3.6.2'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Given two `Response's`, compares several header values to see if they are\n * the same or not.\n *\n * @param {Response} firstResponse\n * @param {Response} secondResponse\n * @param {Array<string>} headersToCheck\n * @return {boolean}\n *\n * @memberof workbox.broadcastUpdate\n * @private\n */\n const responsesAreSame = (firstResponse, secondResponse, headersToCheck) => {\n {\n if (!(firstResponse instanceof Response && secondResponse instanceof Response)) {\n throw new WorkboxError_mjs.WorkboxError('invalid-responses-are-same-args');\n }\n }\n\n const atLeastOneHeaderAvailable = headersToCheck.some(header => {\n return firstResponse.headers.has(header) && secondResponse.headers.has(header);\n });\n\n if (!atLeastOneHeaderAvailable) {\n {\n logger_mjs.logger.warn(`Unable to determine where the response has been updated ` + `because none of the headers that would be checked are present.`);\n logger_mjs.logger.debug(`Attempting to compare the following: `, firstResponse, secondResponse, headersToCheck);\n }\n\n // Just return true, indicating the that responses are the same, since we\n // can't determine otherwise.\n return true;\n }\n\n return headersToCheck.every(header => {\n const headerStateComparison = firstResponse.headers.has(header) === secondResponse.headers.has(header);\n const headerValueComparison = firstResponse.headers.get(header) === secondResponse.headers.get(header);\n\n return headerStateComparison && headerValueComparison;\n });\n };\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var messageTypes = {\n CACHE_UPDATED: 'CACHE_UPDATED'\n };\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * You would not normally call this method directly; it's called automatically\n * by an instance of the {@link BroadcastCacheUpdate} class. It's exposed here\n * for the benefit of developers who would rather not use the full\n * `BroadcastCacheUpdate` implementation.\n *\n * Calling this will dispatch a message on the provided\n * {@link https://developers.google.com/web/updates/2016/09/broadcastchannel|Broadcast Channel}\n * to notify interested subscribers about a change to a cached resource.\n *\n * The message that's posted has a formation inspired by the\n * [Flux standard action](https://github.com/acdlite/flux-standard-action#introduction)\n * format like so:\n *\n * ```\n * {\n * type: 'CACHE_UPDATED',\n * meta: 'workbox-broadcast-cache-update',\n * payload: {\n * cacheName: 'the-cache-name',\n * updatedUrl: 'https://example.com/'\n * }\n * }\n * ```\n *\n * (Usage of [Flux](https://facebook.github.io/flux/) itself is not at\n * all required.)\n *\n * @param {BroadcastChannel} channel The `BroadcastChannel` to use.\n * @param {string} cacheName The name of the cache in which the updated\n * `Response` was stored.\n * @param {string} url The URL associated with the updated `Response`.\n * @param {string} source A string identifying this library as the source\n * of the update message.\n *\n * @memberof workbox.broadcastUpdate\n */\n const broadcastUpdate = (channel, cacheName, url, source) => {\n // There are browsers which support service workers but don't support the\n // Broadcast Channel API.\n // See https://github.com/GoogleChrome/workbox/issues/1304\n if (!('BroadcastChannel' in self && channel)) {\n {\n logger_mjs.logger.debug(`${url} was updated, but the Broadcast Channel API is not ` + `available in the current browser.`);\n }\n return;\n }\n\n {\n assert_mjs.assert.isInstance(channel, BroadcastChannel, {\n moduleName: 'workbox-broadcast-cache-update',\n className: '~',\n funcName: 'broadcastUpdate',\n paramName: 'channel'\n });\n assert_mjs.assert.isType(cacheName, 'string', {\n moduleName: 'workbox-broadcast-cache-update',\n className: '~',\n funcName: 'broadcastUpdate',\n paramName: 'cacheName'\n });\n assert_mjs.assert.isType(url, 'string', {\n moduleName: 'workbox-broadcast-cache-update',\n className: '~',\n funcName: 'broadcastUpdate',\n paramName: 'url'\n });\n assert_mjs.assert.isType(source, 'string', {\n moduleName: 'workbox-broadcast-cache-update',\n className: '~',\n funcName: 'broadcastUpdate',\n paramName: 'source'\n });\n }\n\n channel.postMessage({\n type: messageTypes.CACHE_UPDATED,\n meta: source,\n payload: {\n cacheName: cacheName,\n updatedUrl: url\n }\n });\n };\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Uses the [Broadcast Channel API]{@link https://developers.google.com/web/updates/2016/09/broadcastchannel}\n * to notify interested parties when a cached response has been updated.\n *\n * For efficiency's sake, the underlying response bodies are not compared;\n * only specific response headers are checked.\n *\n * @memberof workbox.broadcastUpdate\n */\n class BroadcastCacheUpdate {\n /**\n * Construct a BroadcastCacheUpdate instance with a specific `channelName` to\n * broadcast messages on\n *\n * @param {string} channelName The name that will be used when creating\n * the `BroadcastChannel`.\n * @param {Object} options\n * @param {Array<string>}\n * [options.headersToCheck=['content-length', 'etag', 'last-modified']] A\n * list of headers that will be used to determine whether the responses\n * differ.\n * @param {string} [options.source='workbox-broadcast-cache-update'] An\n * attribution value that indicates where the update originated.\n */\n constructor(channelName, { headersToCheck, source } = {}) {\n {\n if (typeof channelName !== 'string' || channelName.length === 0) {\n throw new WorkboxError_mjs.WorkboxError('channel-name-required');\n }\n }\n\n this._channelName = channelName;\n this._headersToCheck = headersToCheck || ['content-length', 'etag', 'last-modified'];\n this._source = source || 'workbox-broadcast-cache-update';\n\n // TODO assert typeof headersToCheck instanceof Array\n }\n\n /**\n * @return {BroadcastChannel|undefined} The BroadcastChannel instance used for\n * broadcasting updates, or undefined if the browser doesn't support the\n * Broadcast Channel API.\n *\n * @private\n */\n _getChannel() {\n if ('BroadcastChannel' in self && !this._channel) {\n this._channel = new BroadcastChannel(this._channelName);\n }\n return this._channel;\n }\n\n /**\n * Compare two [Responses](https://developer.mozilla.org/en-US/docs/Web/API/Response)\n * and send a message via the\n * {@link https://developers.google.com/web/updates/2016/09/broadcastchannel|Broadcast Channel API}\n * if they differ.\n *\n * Neither of the Responses can be {@link http://stackoverflow.com/questions/39109789|opaque}.\n *\n * @param {Response} firstResponse First responses to compare.\n * @param {Response} secondResponse Second responses to compare.\n * @param {string} url The URL of the updated request.\n * @param {string} cacheName Name of the cache the responses belong to.\n * This is included in the message posted on the broadcast channel.\n */\n notifyIfUpdated(firstResponse, secondResponse, url, cacheName) {\n if (!responsesAreSame(firstResponse, secondResponse, this._headersToCheck)) {\n broadcastUpdate(this._getChannel(), cacheName, url, this._source);\n }\n }\n }\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * This plugin will automatically broadcast a message whenever a cached response\n * is updated.\n *\n * @memberof workbox.broadcastUpdate\n */\n class Plugin {\n /**\n * Construct a new instance with a specific `channelName` to\n * broadcast messages on\n *\n * @param {string} channelName The name that will be used when creating\n * the `BroadcastChannel`.\n * @param {Object} options\n * @param {Array<string>}\n * [options.headersToCheck=['content-length', 'etag', 'last-modified']] A\n * list of headers that will be used to determine whether the responses\n * differ.\n * @param {string} [options.source='workbox-broadcast-cache-update'] An\n * attribution value that indicates where the update originated.\n */\n constructor(channelName, options) {\n this._broadcastUpdate = new BroadcastCacheUpdate(channelName, options);\n }\n /**\n * A \"lifecycle\" callback that will be triggered automatically by the\n * `workbox-sw` and `workbox-runtime-caching` handlers when an entry is\n * added to a cache.\n *\n * @private\n * @param {Object} options The input object to this function.\n * @param {string} options.cacheName Name of the cache being updated.\n * @param {Response} [options.oldResponse] The previous cached value, if any.\n * @param {Response} options.newResponse The new value in the cache.\n */\n cacheDidUpdate({ cacheName, oldResponse, newResponse, request }) {\n {\n assert_mjs.assert.isType(cacheName, 'string', {\n moduleName: 'workbox-broadcast-cache-update',\n className: 'Plugin',\n funcName: 'cacheDidUpdate',\n paramName: 'cacheName'\n });\n assert_mjs.assert.isInstance(newResponse, Response, {\n moduleName: 'workbox-broadcast-cache-update',\n className: 'Plugin',\n funcName: 'cacheDidUpdate',\n paramName: 'newResponse'\n });\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-broadcast-cache-update',\n className: 'Plugin',\n funcName: 'cacheDidUpdate',\n paramName: 'request'\n });\n }\n\n if (!oldResponse) {\n // Without a two responses there is nothing to compare.\n return;\n }\n\n this._broadcastUpdate.notifyIfUpdated(oldResponse, newResponse, request.url, cacheName);\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.BroadcastCacheUpdate = BroadcastCacheUpdate;\n exports.Plugin = Plugin;\n exports.broadcastUpdate = broadcastUpdate;\n exports.messageTypes = messageTypes;\n\n return exports;\n\n}({},workbox.core._private,workbox.core._private,workbox.core._private));\n"],"file":"workbox-broadcast-cache-update.dev.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-broadcast-cache-update/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.broadcastUpdate = (function (exports,WorkboxError_mjs,logger_mjs,assert_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:broadcast-cache-update:3.6.3'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Given two `Response's`, compares several header values to see if they are\n * the same or not.\n *\n * @param {Response} firstResponse\n * @param {Response} secondResponse\n * @param {Array<string>} headersToCheck\n * @return {boolean}\n *\n * @memberof workbox.broadcastUpdate\n * @private\n */\n const responsesAreSame = (firstResponse, secondResponse, headersToCheck) => {\n {\n if (!(firstResponse instanceof Response && secondResponse instanceof Response)) {\n throw new WorkboxError_mjs.WorkboxError('invalid-responses-are-same-args');\n }\n }\n\n const atLeastOneHeaderAvailable = headersToCheck.some(header => {\n return firstResponse.headers.has(header) && secondResponse.headers.has(header);\n });\n\n if (!atLeastOneHeaderAvailable) {\n {\n logger_mjs.logger.warn(`Unable to determine where the response has been updated ` + `because none of the headers that would be checked are present.`);\n logger_mjs.logger.debug(`Attempting to compare the following: `, firstResponse, secondResponse, headersToCheck);\n }\n\n // Just return true, indicating the that responses are the same, since we\n // can't determine otherwise.\n return true;\n }\n\n return headersToCheck.every(header => {\n const headerStateComparison = firstResponse.headers.has(header) === secondResponse.headers.has(header);\n const headerValueComparison = firstResponse.headers.get(header) === secondResponse.headers.get(header);\n\n return headerStateComparison && headerValueComparison;\n });\n };\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var messageTypes = {\n CACHE_UPDATED: 'CACHE_UPDATED'\n };\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * You would not normally call this method directly; it's called automatically\n * by an instance of the {@link BroadcastCacheUpdate} class. It's exposed here\n * for the benefit of developers who would rather not use the full\n * `BroadcastCacheUpdate` implementation.\n *\n * Calling this will dispatch a message on the provided\n * {@link https://developers.google.com/web/updates/2016/09/broadcastchannel|Broadcast Channel}\n * to notify interested subscribers about a change to a cached resource.\n *\n * The message that's posted has a formation inspired by the\n * [Flux standard action](https://github.com/acdlite/flux-standard-action#introduction)\n * format like so:\n *\n * ```\n * {\n * type: 'CACHE_UPDATED',\n * meta: 'workbox-broadcast-cache-update',\n * payload: {\n * cacheName: 'the-cache-name',\n * updatedUrl: 'https://example.com/'\n * }\n * }\n * ```\n *\n * (Usage of [Flux](https://facebook.github.io/flux/) itself is not at\n * all required.)\n *\n * @param {BroadcastChannel} channel The `BroadcastChannel` to use.\n * @param {string} cacheName The name of the cache in which the updated\n * `Response` was stored.\n * @param {string} url The URL associated with the updated `Response`.\n * @param {string} source A string identifying this library as the source\n * of the update message.\n *\n * @memberof workbox.broadcastUpdate\n */\n const broadcastUpdate = (channel, cacheName, url, source) => {\n // There are browsers which support service workers but don't support the\n // Broadcast Channel API.\n // See https://github.com/GoogleChrome/workbox/issues/1304\n if (!('BroadcastChannel' in self && channel)) {\n {\n logger_mjs.logger.debug(`${url} was updated, but the Broadcast Channel API is not ` + `available in the current browser.`);\n }\n return;\n }\n\n {\n assert_mjs.assert.isInstance(channel, BroadcastChannel, {\n moduleName: 'workbox-broadcast-cache-update',\n className: '~',\n funcName: 'broadcastUpdate',\n paramName: 'channel'\n });\n assert_mjs.assert.isType(cacheName, 'string', {\n moduleName: 'workbox-broadcast-cache-update',\n className: '~',\n funcName: 'broadcastUpdate',\n paramName: 'cacheName'\n });\n assert_mjs.assert.isType(url, 'string', {\n moduleName: 'workbox-broadcast-cache-update',\n className: '~',\n funcName: 'broadcastUpdate',\n paramName: 'url'\n });\n assert_mjs.assert.isType(source, 'string', {\n moduleName: 'workbox-broadcast-cache-update',\n className: '~',\n funcName: 'broadcastUpdate',\n paramName: 'source'\n });\n }\n\n channel.postMessage({\n type: messageTypes.CACHE_UPDATED,\n meta: source,\n payload: {\n cacheName: cacheName,\n updatedUrl: url\n }\n });\n };\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Uses the [Broadcast Channel API]{@link https://developers.google.com/web/updates/2016/09/broadcastchannel}\n * to notify interested parties when a cached response has been updated.\n *\n * For efficiency's sake, the underlying response bodies are not compared;\n * only specific response headers are checked.\n *\n * @memberof workbox.broadcastUpdate\n */\n class BroadcastCacheUpdate {\n /**\n * Construct a BroadcastCacheUpdate instance with a specific `channelName` to\n * broadcast messages on\n *\n * @param {string} channelName The name that will be used when creating\n * the `BroadcastChannel`.\n * @param {Object} options\n * @param {Array<string>}\n * [options.headersToCheck=['content-length', 'etag', 'last-modified']] A\n * list of headers that will be used to determine whether the responses\n * differ.\n * @param {string} [options.source='workbox-broadcast-cache-update'] An\n * attribution value that indicates where the update originated.\n */\n constructor(channelName, { headersToCheck, source } = {}) {\n {\n if (typeof channelName !== 'string' || channelName.length === 0) {\n throw new WorkboxError_mjs.WorkboxError('channel-name-required');\n }\n }\n\n this._channelName = channelName;\n this._headersToCheck = headersToCheck || ['content-length', 'etag', 'last-modified'];\n this._source = source || 'workbox-broadcast-cache-update';\n\n // TODO assert typeof headersToCheck instanceof Array\n }\n\n /**\n * @return {BroadcastChannel|undefined} The BroadcastChannel instance used for\n * broadcasting updates, or undefined if the browser doesn't support the\n * Broadcast Channel API.\n *\n * @private\n */\n _getChannel() {\n if ('BroadcastChannel' in self && !this._channel) {\n this._channel = new BroadcastChannel(this._channelName);\n }\n return this._channel;\n }\n\n /**\n * Compare two [Responses](https://developer.mozilla.org/en-US/docs/Web/API/Response)\n * and send a message via the\n * {@link https://developers.google.com/web/updates/2016/09/broadcastchannel|Broadcast Channel API}\n * if they differ.\n *\n * Neither of the Responses can be {@link http://stackoverflow.com/questions/39109789|opaque}.\n *\n * @param {Response} firstResponse First responses to compare.\n * @param {Response} secondResponse Second responses to compare.\n * @param {string} url The URL of the updated request.\n * @param {string} cacheName Name of the cache the responses belong to.\n * This is included in the message posted on the broadcast channel.\n */\n notifyIfUpdated(firstResponse, secondResponse, url, cacheName) {\n if (!responsesAreSame(firstResponse, secondResponse, this._headersToCheck)) {\n broadcastUpdate(this._getChannel(), cacheName, url, this._source);\n }\n }\n }\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * This plugin will automatically broadcast a message whenever a cached response\n * is updated.\n *\n * @memberof workbox.broadcastUpdate\n */\n class Plugin {\n /**\n * Construct a new instance with a specific `channelName` to\n * broadcast messages on\n *\n * @param {string} channelName The name that will be used when creating\n * the `BroadcastChannel`.\n * @param {Object} options\n * @param {Array<string>}\n * [options.headersToCheck=['content-length', 'etag', 'last-modified']] A\n * list of headers that will be used to determine whether the responses\n * differ.\n * @param {string} [options.source='workbox-broadcast-cache-update'] An\n * attribution value that indicates where the update originated.\n */\n constructor(channelName, options) {\n this._broadcastUpdate = new BroadcastCacheUpdate(channelName, options);\n }\n /**\n * A \"lifecycle\" callback that will be triggered automatically by the\n * `workbox-sw` and `workbox-runtime-caching` handlers when an entry is\n * added to a cache.\n *\n * @private\n * @param {Object} options The input object to this function.\n * @param {string} options.cacheName Name of the cache being updated.\n * @param {Response} [options.oldResponse] The previous cached value, if any.\n * @param {Response} options.newResponse The new value in the cache.\n */\n cacheDidUpdate({ cacheName, oldResponse, newResponse, request }) {\n {\n assert_mjs.assert.isType(cacheName, 'string', {\n moduleName: 'workbox-broadcast-cache-update',\n className: 'Plugin',\n funcName: 'cacheDidUpdate',\n paramName: 'cacheName'\n });\n assert_mjs.assert.isInstance(newResponse, Response, {\n moduleName: 'workbox-broadcast-cache-update',\n className: 'Plugin',\n funcName: 'cacheDidUpdate',\n paramName: 'newResponse'\n });\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-broadcast-cache-update',\n className: 'Plugin',\n funcName: 'cacheDidUpdate',\n paramName: 'request'\n });\n }\n\n if (!oldResponse) {\n // Without a two responses there is nothing to compare.\n return;\n }\n\n this._broadcastUpdate.notifyIfUpdated(oldResponse, newResponse, request.url, cacheName);\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.BroadcastCacheUpdate = BroadcastCacheUpdate;\n exports.Plugin = Plugin;\n exports.broadcastUpdate = broadcastUpdate;\n exports.messageTypes = messageTypes;\n\n return exports;\n\n}({},workbox.core._private,workbox.core._private,workbox.core._private));\n"],"file":"workbox-broadcast-cache-update.dev.js"}
@@ -1,3 +1,3 @@
1
- this.workbox=this.workbox||{},this.workbox.broadcastUpdate=function(t){"use strict";try{self.workbox.v["workbox:broadcast-cache-update:3.6.2"]=1}catch(t){}const e=(t,e,s)=>{return!s.some(s=>t.headers.has(s)&&e.headers.has(s))||s.every(s=>{const a=t.headers.has(s)===e.headers.has(s),n=t.headers.get(s)===e.headers.get(s);return a&&n})};var s={CACHE_UPDATED:"CACHE_UPDATED"};const a=(t,e,a,n)=>{"BroadcastChannel"in self&&t&&t.postMessage({type:s.CACHE_UPDATED,meta:n,payload:{cacheName:e,updatedUrl:a}})};class n{constructor(t,{headersToCheck:e,source:s}={}){this.t=t,this.e=e||["content-length","etag","last-modified"],this.s=s||"workbox-broadcast-cache-update"}a(){return"BroadcastChannel"in self&&!this.n&&(this.n=new BroadcastChannel(this.t)),this.n}notifyIfUpdated(t,s,n,c){e(t,s,this.e)||a(this.a(),c,n,this.s)}}return t.BroadcastCacheUpdate=n,t.Plugin=class{constructor(t,e){this.c=new n(t,e)}cacheDidUpdate({cacheName:t,oldResponse:e,newResponse:s,request:a}){e&&this.c.notifyIfUpdated(e,s,a.url,t)}},t.broadcastUpdate=a,t.messageTypes=s,t}({});
1
+ this.workbox=this.workbox||{},this.workbox.broadcastUpdate=function(t){"use strict";try{self.workbox.v["workbox:broadcast-cache-update:3.6.3"]=1}catch(t){}const e=(t,e,s)=>{return!s.some(s=>t.headers.has(s)&&e.headers.has(s))||s.every(s=>{const a=t.headers.has(s)===e.headers.has(s),n=t.headers.get(s)===e.headers.get(s);return a&&n})};var s={CACHE_UPDATED:"CACHE_UPDATED"};const a=(t,e,a,n)=>{"BroadcastChannel"in self&&t&&t.postMessage({type:s.CACHE_UPDATED,meta:n,payload:{cacheName:e,updatedUrl:a}})};class n{constructor(t,{headersToCheck:e,source:s}={}){this.t=t,this.e=e||["content-length","etag","last-modified"],this.s=s||"workbox-broadcast-cache-update"}a(){return"BroadcastChannel"in self&&!this.n&&(this.n=new BroadcastChannel(this.t)),this.n}notifyIfUpdated(t,s,n,c){e(t,s,this.e)||a(this.a(),c,n,this.s)}}return t.BroadcastCacheUpdate=n,t.Plugin=class{constructor(t,e){this.c=new n(t,e)}cacheDidUpdate({cacheName:t,oldResponse:e,newResponse:s,request:a}){e&&this.c.notifyIfUpdated(e,s,a.url,t)}},t.broadcastUpdate=a,t.messageTypes=s,t}({});
2
2
 
3
3
  //# sourceMappingURL=workbox-broadcast-cache-update.prod.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-broadcast-cache-update/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.broadcastUpdate=function(t){\"use strict\";try{self.workbox.v[\"workbox:broadcast-cache-update:3.6.2\"]=1}catch(t){}const e=(t,e,s)=>{return!s.some(s=>t.headers.has(s)&&e.headers.has(s))||s.every(s=>{const a=t.headers.has(s)===e.headers.has(s),n=t.headers.get(s)===e.headers.get(s);return a&&n})};var s={CACHE_UPDATED:\"CACHE_UPDATED\"};const a=(t,e,a,n)=>{\"BroadcastChannel\"in self&&t&&t.postMessage({type:s.CACHE_UPDATED,meta:n,payload:{cacheName:e,updatedUrl:a}})};class n{constructor(t,{headersToCheck:e,source:s}={}){this.t=t,this.e=e||[\"content-length\",\"etag\",\"last-modified\"],this.s=s||\"workbox-broadcast-cache-update\"}a(){return\"BroadcastChannel\"in self&&!this.n&&(this.n=new BroadcastChannel(this.t)),this.n}notifyIfUpdated(t,s,n,c){e(t,s,this.e)||a(this.a(),c,n,this.s)}}return t.BroadcastCacheUpdate=n,t.Plugin=class{constructor(t,e){this.c=new n(t,e)}cacheDidUpdate({cacheName:t,oldResponse:e,newResponse:s,request:a}){e&&this.c.notifyIfUpdated(e,s,a.url,t)}},t.broadcastUpdate=a,t.messageTypes=s,t}({});\n"],"file":"workbox-broadcast-cache-update.prod.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-broadcast-cache-update/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.broadcastUpdate=function(t){\"use strict\";try{self.workbox.v[\"workbox:broadcast-cache-update:3.6.3\"]=1}catch(t){}const e=(t,e,s)=>{return!s.some(s=>t.headers.has(s)&&e.headers.has(s))||s.every(s=>{const a=t.headers.has(s)===e.headers.has(s),n=t.headers.get(s)===e.headers.get(s);return a&&n})};var s={CACHE_UPDATED:\"CACHE_UPDATED\"};const a=(t,e,a,n)=>{\"BroadcastChannel\"in self&&t&&t.postMessage({type:s.CACHE_UPDATED,meta:n,payload:{cacheName:e,updatedUrl:a}})};class n{constructor(t,{headersToCheck:e,source:s}={}){this.t=t,this.e=e||[\"content-length\",\"etag\",\"last-modified\"],this.s=s||\"workbox-broadcast-cache-update\"}a(){return\"BroadcastChannel\"in self&&!this.n&&(this.n=new BroadcastChannel(this.t)),this.n}notifyIfUpdated(t,s,n,c){e(t,s,this.e)||a(this.a(),c,n,this.s)}}return t.BroadcastCacheUpdate=n,t.Plugin=class{constructor(t,e){this.c=new n(t,e)}cacheDidUpdate({cacheName:t,oldResponse:e,newResponse:s,request:a}){e&&this.c.notifyIfUpdated(e,s,a.url,t)}},t.broadcastUpdate=a,t.messageTypes=s,t}({});\n"],"file":"workbox-broadcast-cache-update.prod.js"}
@@ -3,7 +3,7 @@ this.workbox.expiration = (function (exports,DBWrapper_mjs,WorkboxError_mjs,asse
3
3
  'use strict';
4
4
 
5
5
  try {
6
- self.workbox.v['workbox:cache-expiration:3.6.2'] = 1;
6
+ self.workbox.v['workbox:cache-expiration:3.6.3'] = 1;
7
7
  } catch (e) {} // eslint-disable-line
8
8
 
9
9
  /*
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-cache-expiration/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.expiration = (function (exports,DBWrapper_mjs,WorkboxError_mjs,assert_mjs,logger_mjs,cacheNames_mjs,index_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:cache-expiration:3.6.2'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const URL_KEY = 'url';\n const TIMESTAMP_KEY = 'timestamp';\n\n /**\n * Returns the timestamp model.\n *\n * @private\n */\n class CacheTimestampsModel {\n /**\n *\n * @param {string} cacheName\n *\n * @private\n */\n constructor(cacheName) {\n // TODO Check cacheName\n\n this._cacheName = cacheName;\n this._storeName = cacheName;\n\n this._db = new DBWrapper_mjs.DBWrapper(this._cacheName, 2, {\n onupgradeneeded: evt => this._handleUpgrade(evt)\n });\n }\n\n /**\n * Should perform an upgrade of indexedDB.\n *\n * @param {Event} evt\n *\n * @private\n */\n _handleUpgrade(evt) {\n const db = evt.target.result;\n if (evt.oldVersion < 2) {\n // Remove old databases.\n if (db.objectStoreNames.contains('workbox-cache-expiration')) {\n db.deleteObjectStore('workbox-cache-expiration');\n }\n }\n\n db.createObjectStore(this._storeName, { keyPath: URL_KEY }).createIndex(TIMESTAMP_KEY, TIMESTAMP_KEY, { unique: false });\n }\n\n /**\n * @param {string} url\n * @param {number} timestamp\n *\n * @private\n */\n setTimestamp(url, timestamp) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this._db.put(_this._storeName, {\n [URL_KEY]: new URL(url, location).href,\n [TIMESTAMP_KEY]: timestamp\n });\n })();\n }\n\n /**\n * Get all of the timestamps in the indexedDB.\n *\n * @return {Array<Objects>}\n *\n * @private\n */\n getAllTimestamps() {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this2._db.getAllMatching(_this2._storeName, {\n index: TIMESTAMP_KEY\n });\n })();\n }\n\n /**\n * Returns the timestamp stored for a given URL.\n *\n * @param {string} url\n * @return {number}\n *\n * @private\n */\n getTimestamp(url) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const timestampObject = yield _this3._db.get(_this3._storeName, url);\n return timestampObject.timestamp;\n })();\n }\n\n /**\n * @param {string} url\n *\n * @private\n */\n deleteUrl(url) {\n var _this4 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this4._db.delete(_this4._storeName, new URL(url, location).href);\n })();\n }\n\n /**\n * Removes the underlying IndexedDB object store entirely.\n */\n delete() {\n var _this5 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this5._db.deleteDatabase();\n _this5._db = null;\n })();\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * The `CacheExpiration` class allows you define an expiration and / or\n * limit on the number of responses stored in a\n * [`Cache`](https://developer.mozilla.org/en-US/docs/Web/API/Cache).\n *\n * @memberof workbox.expiration\n */\n class CacheExpiration {\n /**\n * To construct a new CacheExpiration instance you must provide at least\n * one of the `config` properties.\n *\n * @param {string} cacheName Name of the cache to apply restrictions to.\n * @param {Object} config\n * @param {number} [config.maxEntries] The maximum number of entries to cache.\n * Entries used the least will be removed as the maximum is reached.\n * @param {number} [config.maxAgeSeconds] The maximum age of an entry before\n * it's treated as stale and removed.\n */\n constructor(cacheName, config = {}) {\n {\n assert_mjs.assert.isType(cacheName, 'string', {\n moduleName: 'workbox-cache-expiration',\n className: 'CacheExpiration',\n funcName: 'constructor',\n paramName: 'cacheName'\n });\n\n if (!(config.maxEntries || config.maxAgeSeconds)) {\n throw new WorkboxError_mjs.WorkboxError('max-entries-or-age-required', {\n moduleName: 'workbox-cache-expiration',\n className: 'CacheExpiration',\n funcName: 'constructor'\n });\n }\n\n if (config.maxEntries) {\n assert_mjs.assert.isType(config.maxEntries, 'number', {\n moduleName: 'workbox-cache-expiration',\n className: 'CacheExpiration',\n funcName: 'constructor',\n paramName: 'config.maxEntries'\n });\n\n // TODO: Assert is positive\n }\n\n if (config.maxAgeSeconds) {\n assert_mjs.assert.isType(config.maxAgeSeconds, 'number', {\n moduleName: 'workbox-cache-expiration',\n className: 'CacheExpiration',\n funcName: 'constructor',\n paramName: 'config.maxAgeSeconds'\n });\n\n // TODO: Assert is positive\n }\n }\n\n this._isRunning = false;\n this._rerunRequested = false;\n this._maxEntries = config.maxEntries;\n this._maxAgeSeconds = config.maxAgeSeconds;\n this._cacheName = cacheName;\n this._timestampModel = new CacheTimestampsModel(cacheName);\n }\n\n /**\n * Expires entries for the given cache and given criteria.\n */\n expireEntries() {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (_this._isRunning) {\n _this._rerunRequested = true;\n return;\n }\n _this._isRunning = true;\n\n const now = Date.now();\n\n // First, expire old entries, if maxAgeSeconds is set.\n const oldEntries = yield _this._findOldEntries(now);\n\n // Once that's done, check for the maximum size.\n const extraEntries = yield _this._findExtraEntries();\n\n // Use a Set to remove any duplicates following the concatenation, then\n // convert back into an array.\n const allUrls = [...new Set(oldEntries.concat(extraEntries))];\n\n yield Promise.all([_this._deleteFromCache(allUrls), _this._deleteFromIDB(allUrls)]);\n\n {\n // TODO: break apart entries deleted due to expiration vs size restraints\n if (allUrls.length > 0) {\n logger_mjs.logger.groupCollapsed(`Expired ${allUrls.length} ` + `${allUrls.length === 1 ? 'entry' : 'entries'} and removed ` + `${allUrls.length === 1 ? 'it' : 'them'} from the ` + `'${_this._cacheName}' cache.`);\n logger_mjs.logger.log(`Expired the following ${allUrls.length === 1 ? 'URL' : 'URLs'}:`);\n allUrls.forEach(function (url) {\n return logger_mjs.logger.log(` ${url}`);\n });\n logger_mjs.logger.groupEnd();\n } else {\n logger_mjs.logger.debug(`Cache expiration ran and found no entries to remove.`);\n }\n }\n\n _this._isRunning = false;\n if (_this._rerunRequested) {\n _this._rerunRequested = false;\n _this.expireEntries();\n }\n })();\n }\n\n /**\n * Expires entries based on the maximum age.\n *\n * @param {number} expireFromTimestamp A timestamp.\n * @return {Promise<Array<string>>} A list of the URLs that were expired.\n *\n * @private\n */\n _findOldEntries(expireFromTimestamp) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isType(expireFromTimestamp, 'number', {\n moduleName: 'workbox-cache-expiration',\n className: 'CacheExpiration',\n funcName: '_findOldEntries',\n paramName: 'expireFromTimestamp'\n });\n }\n\n if (!_this2._maxAgeSeconds) {\n return [];\n }\n\n const expireOlderThan = expireFromTimestamp - _this2._maxAgeSeconds * 1000;\n const timestamps = yield _this2._timestampModel.getAllTimestamps();\n const expiredUrls = [];\n timestamps.forEach(function (timestampDetails) {\n if (timestampDetails.timestamp < expireOlderThan) {\n expiredUrls.push(timestampDetails.url);\n }\n });\n\n return expiredUrls;\n })();\n }\n\n /**\n * @return {Promise<Array>}\n *\n * @private\n */\n _findExtraEntries() {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const extraUrls = [];\n\n if (!_this3._maxEntries) {\n return [];\n }\n\n const timestamps = yield _this3._timestampModel.getAllTimestamps();\n while (timestamps.length > _this3._maxEntries) {\n const lastUsed = timestamps.shift();\n extraUrls.push(lastUsed.url);\n }\n\n return extraUrls;\n })();\n }\n\n /**\n * @param {Array<string>} urls Array of URLs to delete from cache.\n *\n * @private\n */\n _deleteFromCache(urls) {\n var _this4 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const cache = yield caches.open(_this4._cacheName);\n for (const url of urls) {\n yield cache.delete(url);\n }\n })();\n }\n\n /**\n * @param {Array<string>} urls Array of URLs to delete from IDB\n *\n * @private\n */\n _deleteFromIDB(urls) {\n var _this5 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n for (const url of urls) {\n yield _this5._timestampModel.deleteUrl(url);\n }\n })();\n }\n\n /**\n * Update the timestamp for the given URL. This ensures the when\n * removing entries based on maximum entries, most recently used\n * is accurate or when expiring, the timestamp is up-to-date.\n *\n * @param {string} url\n */\n updateTimestamp(url) {\n var _this6 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isType(url, 'string', {\n moduleName: 'workbox-cache-expiration',\n className: 'CacheExpiration',\n funcName: 'updateTimestamp',\n paramName: 'url'\n });\n }\n\n const urlObject = new URL(url, location);\n urlObject.hash = '';\n\n yield _this6._timestampModel.setTimestamp(urlObject.href, Date.now());\n })();\n }\n\n /**\n * Can be used to check if a URL has expired or not before it's used.\n *\n * This requires a look up from IndexedDB, so can be slow.\n *\n * Note: This method will not remove the cached entry, call\n * `expireEntries()` to remove indexedDB and Cache entries.\n *\n * @param {string} url\n * @return {boolean}\n */\n isURLExpired(url) {\n var _this7 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (!_this7._maxAgeSeconds) {\n throw new WorkboxError_mjs.WorkboxError(`expired-test-without-max-age`, {\n methodName: 'isURLExpired',\n paramName: 'maxAgeSeconds'\n });\n }\n const urlObject = new URL(url, location);\n urlObject.hash = '';\n\n const timestamp = yield _this7._timestampModel.getTimestamp(urlObject.href);\n const expireOlderThan = Date.now() - _this7._maxAgeSeconds * 1000;\n return timestamp < expireOlderThan;\n })();\n }\n\n /**\n * Removes the IndexedDB object store used to keep track of cache expiration\n * metadata.\n */\n delete() {\n var _this8 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n // Make sure we don't attempt another rerun if we're called in the middle of\n // a cache expiration.\n _this8._rerunRequested = false;\n yield _this8._timestampModel.delete();\n })();\n }\n }\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * This plugin can be used in the Workbox APIs to regularly enforce a\n * limit on the age and / or the number of cached requests.\n *\n * Whenever a cached request is used or updated, this plugin will look\n * at the used Cache and remove any old or extra requests.\n *\n * When using `maxAgeSeconds`, requests may be used *once* after expiring\n * because the expiration clean up will not have occurred until *after* the\n * cached request has been used. If the request has a \"Date\" header, then\n * a light weight expiration check is performed and the request will not be\n * used immediately.\n *\n * When using `maxEntries`, the last request to be used will be the request\n * that is removed from the Cache.\n *\n * @memberof workbox.expiration\n */\n class Plugin {\n /**\n * @param {Object} config\n * @param {number} [config.maxEntries] The maximum number of entries to cache.\n * Entries used the least will be removed as the maximum is reached.\n * @param {number} [config.maxAgeSeconds] The maximum age of an entry before\n * it's treated as stale and removed.\n * @param {boolean} [config.purgeOnQuotaError] Whether to opt this cache in to\n * automatic deletion if the available storage quota has been exceeded.\n */\n constructor(config = {}) {\n {\n if (!(config.maxEntries || config.maxAgeSeconds)) {\n throw new WorkboxError_mjs.WorkboxError('max-entries-or-age-required', {\n moduleName: 'workbox-cache-expiration',\n className: 'Plugin',\n funcName: 'constructor'\n });\n }\n\n if (config.maxEntries) {\n assert_mjs.assert.isType(config.maxEntries, 'number', {\n moduleName: 'workbox-cache-expiration',\n className: 'Plugin',\n funcName: 'constructor',\n paramName: 'config.maxEntries'\n });\n }\n\n if (config.maxAgeSeconds) {\n assert_mjs.assert.isType(config.maxAgeSeconds, 'number', {\n moduleName: 'workbox-cache-expiration',\n className: 'Plugin',\n funcName: 'constructor',\n paramName: 'config.maxAgeSeconds'\n });\n }\n }\n\n this._config = config;\n this._maxAgeSeconds = config.maxAgeSeconds;\n this._cacheExpirations = new Map();\n\n if (config.purgeOnQuotaError) {\n index_mjs.registerQuotaErrorCallback(() => this.deleteCacheAndMetadata());\n }\n }\n\n /**\n * A simple helper method to return a CacheExpiration instance for a given\n * cache name.\n *\n * @param {string} cacheName\n * @return {CacheExpiration}\n *\n * @private\n */\n _getCacheExpiration(cacheName) {\n if (cacheName === cacheNames_mjs.cacheNames.getRuntimeName()) {\n throw new WorkboxError_mjs.WorkboxError('expire-custom-caches-only');\n }\n\n let cacheExpiration = this._cacheExpirations.get(cacheName);\n if (!cacheExpiration) {\n cacheExpiration = new CacheExpiration(cacheName, this._config);\n this._cacheExpirations.set(cacheName, cacheExpiration);\n }\n return cacheExpiration;\n }\n\n /**\n * A \"lifecycle\" callback that will be triggered automatically by the\n * `workbox.runtimeCaching` handlers when a `Response` is about to be returned\n * from a [Cache](https://developer.mozilla.org/en-US/docs/Web/API/Cache) to\n * the handler. It allows the `Response` to be inspected for freshness and\n * prevents it from being used if the `Response`'s `Date` header value is\n * older than the configured `maxAgeSeconds`.\n *\n * @param {Object} options\n * @param {string} options.cacheName Name of the cache the response is in.\n * @param {Response} options.cachedResponse The `Response` object that's been\n * read from a cache and whose freshness should be checked.\n * @return {Response} Either the `cachedResponse`, if it's\n * fresh, or `null` if the `Response` is older than `maxAgeSeconds`.\n *\n * @private\n */\n cachedResponseWillBeUsed({ cacheName, cachedResponse }) {\n if (!cachedResponse) {\n return null;\n }\n\n let isFresh = this._isResponseDateFresh(cachedResponse);\n\n // Expire entries to ensure that even if the expiration date has\n // expired, it'll only be used once.\n const cacheExpiration = this._getCacheExpiration(cacheName);\n cacheExpiration.expireEntries();\n\n return isFresh ? cachedResponse : null;\n }\n\n /**\n * @param {Response} cachedResponse\n * @return {boolean}\n *\n * @private\n */\n _isResponseDateFresh(cachedResponse) {\n if (!this._maxAgeSeconds) {\n // We aren't expiring by age, so return true, it's fresh\n return true;\n }\n\n // Check if the 'date' header will suffice a quick expiration check.\n // See https://github.com/GoogleChromeLabs/sw-toolbox/issues/164 for\n // discussion.\n const dateHeaderTimestamp = this._getDateHeaderTimestamp(cachedResponse);\n if (dateHeaderTimestamp === null) {\n // Unable to parse date, so assume it's fresh.\n return true;\n }\n\n // If we have a valid headerTime, then our response is fresh iff the\n // headerTime plus maxAgeSeconds is greater than the current time.\n const now = Date.now();\n return dateHeaderTimestamp >= now - this._maxAgeSeconds * 1000;\n }\n\n /**\n * This method will extract the data header and parse it into a useful\n * value.\n *\n * @param {Response} cachedResponse\n * @return {number}\n *\n * @private\n */\n _getDateHeaderTimestamp(cachedResponse) {\n if (!cachedResponse.headers.has('date')) {\n return null;\n }\n\n const dateHeader = cachedResponse.headers.get('date');\n const parsedDate = new Date(dateHeader);\n const headerTime = parsedDate.getTime();\n\n // If the Date header was invalid for some reason, parsedDate.getTime()\n // will return NaN.\n if (isNaN(headerTime)) {\n return null;\n }\n\n return headerTime;\n }\n\n /**\n * A \"lifecycle\" callback that will be triggered automatically by the\n * `workbox.runtimeCaching` handlers when an entry is added to a cache.\n *\n * @param {Object} options\n * @param {string} options.cacheName Name of the cache that was updated.\n * @param {string} options.request The Request for the cached entry.\n *\n * @private\n */\n cacheDidUpdate({ cacheName, request }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isType(cacheName, 'string', {\n moduleName: 'workbox-cache-expiration',\n className: 'Plugin',\n funcName: 'cacheDidUpdate',\n paramName: 'cacheName'\n });\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-cache-expiration',\n className: 'Plugin',\n funcName: 'cacheDidUpdate',\n paramName: 'request'\n });\n }\n\n const cacheExpiration = _this._getCacheExpiration(cacheName);\n yield cacheExpiration.updateTimestamp(request.url);\n yield cacheExpiration.expireEntries();\n })();\n }\n\n /**\n * This is a helper method that performs two operations:\n *\n * - Deletes *all* the underlying Cache instances associated with this plugin\n * instance, by calling caches.delete() on you behalf.\n * - Deletes the metadata from IndexedDB used to keep track of expiration\n * details for each Cache instance.\n *\n * When using cache expiration, calling this method is preferable to calling\n * `caches.delete()` directly, since this will ensure that the IndexedDB\n * metadata is also cleanly removed and open IndexedDB instances are deleted.\n *\n * Note that if you're *not* using cache expiration for a given cache, calling\n * `caches.delete()` and passing in the cache's name should be sufficient.\n * There is no Workbox-specific method needed for cleanup in that case.\n */\n deleteCacheAndMetadata() {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n // Do this one at a time instead of all at once via `Promise.all()` to\n // reduce the chance of inconsistency if a promise rejects.\n for (const [cacheName, cacheExpiration] of _this2._cacheExpirations) {\n yield caches.delete(cacheName);\n yield cacheExpiration.delete();\n }\n\n // Reset this._cacheExpirations to its initial state.\n _this2._cacheExpirations = new Map();\n })();\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.CacheExpiration = CacheExpiration;\n exports.Plugin = Plugin;\n\n return exports;\n\n}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core));\n"],"file":"workbox-cache-expiration.dev.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-cache-expiration/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.expiration = (function (exports,DBWrapper_mjs,WorkboxError_mjs,assert_mjs,logger_mjs,cacheNames_mjs,index_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:cache-expiration:3.6.3'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const URL_KEY = 'url';\n const TIMESTAMP_KEY = 'timestamp';\n\n /**\n * Returns the timestamp model.\n *\n * @private\n */\n class CacheTimestampsModel {\n /**\n *\n * @param {string} cacheName\n *\n * @private\n */\n constructor(cacheName) {\n // TODO Check cacheName\n\n this._cacheName = cacheName;\n this._storeName = cacheName;\n\n this._db = new DBWrapper_mjs.DBWrapper(this._cacheName, 2, {\n onupgradeneeded: evt => this._handleUpgrade(evt)\n });\n }\n\n /**\n * Should perform an upgrade of indexedDB.\n *\n * @param {Event} evt\n *\n * @private\n */\n _handleUpgrade(evt) {\n const db = evt.target.result;\n if (evt.oldVersion < 2) {\n // Remove old databases.\n if (db.objectStoreNames.contains('workbox-cache-expiration')) {\n db.deleteObjectStore('workbox-cache-expiration');\n }\n }\n\n db.createObjectStore(this._storeName, { keyPath: URL_KEY }).createIndex(TIMESTAMP_KEY, TIMESTAMP_KEY, { unique: false });\n }\n\n /**\n * @param {string} url\n * @param {number} timestamp\n *\n * @private\n */\n setTimestamp(url, timestamp) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this._db.put(_this._storeName, {\n [URL_KEY]: new URL(url, location).href,\n [TIMESTAMP_KEY]: timestamp\n });\n })();\n }\n\n /**\n * Get all of the timestamps in the indexedDB.\n *\n * @return {Array<Objects>}\n *\n * @private\n */\n getAllTimestamps() {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this2._db.getAllMatching(_this2._storeName, {\n index: TIMESTAMP_KEY\n });\n })();\n }\n\n /**\n * Returns the timestamp stored for a given URL.\n *\n * @param {string} url\n * @return {number}\n *\n * @private\n */\n getTimestamp(url) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const timestampObject = yield _this3._db.get(_this3._storeName, url);\n return timestampObject.timestamp;\n })();\n }\n\n /**\n * @param {string} url\n *\n * @private\n */\n deleteUrl(url) {\n var _this4 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this4._db.delete(_this4._storeName, new URL(url, location).href);\n })();\n }\n\n /**\n * Removes the underlying IndexedDB object store entirely.\n */\n delete() {\n var _this5 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this5._db.deleteDatabase();\n _this5._db = null;\n })();\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * The `CacheExpiration` class allows you define an expiration and / or\n * limit on the number of responses stored in a\n * [`Cache`](https://developer.mozilla.org/en-US/docs/Web/API/Cache).\n *\n * @memberof workbox.expiration\n */\n class CacheExpiration {\n /**\n * To construct a new CacheExpiration instance you must provide at least\n * one of the `config` properties.\n *\n * @param {string} cacheName Name of the cache to apply restrictions to.\n * @param {Object} config\n * @param {number} [config.maxEntries] The maximum number of entries to cache.\n * Entries used the least will be removed as the maximum is reached.\n * @param {number} [config.maxAgeSeconds] The maximum age of an entry before\n * it's treated as stale and removed.\n */\n constructor(cacheName, config = {}) {\n {\n assert_mjs.assert.isType(cacheName, 'string', {\n moduleName: 'workbox-cache-expiration',\n className: 'CacheExpiration',\n funcName: 'constructor',\n paramName: 'cacheName'\n });\n\n if (!(config.maxEntries || config.maxAgeSeconds)) {\n throw new WorkboxError_mjs.WorkboxError('max-entries-or-age-required', {\n moduleName: 'workbox-cache-expiration',\n className: 'CacheExpiration',\n funcName: 'constructor'\n });\n }\n\n if (config.maxEntries) {\n assert_mjs.assert.isType(config.maxEntries, 'number', {\n moduleName: 'workbox-cache-expiration',\n className: 'CacheExpiration',\n funcName: 'constructor',\n paramName: 'config.maxEntries'\n });\n\n // TODO: Assert is positive\n }\n\n if (config.maxAgeSeconds) {\n assert_mjs.assert.isType(config.maxAgeSeconds, 'number', {\n moduleName: 'workbox-cache-expiration',\n className: 'CacheExpiration',\n funcName: 'constructor',\n paramName: 'config.maxAgeSeconds'\n });\n\n // TODO: Assert is positive\n }\n }\n\n this._isRunning = false;\n this._rerunRequested = false;\n this._maxEntries = config.maxEntries;\n this._maxAgeSeconds = config.maxAgeSeconds;\n this._cacheName = cacheName;\n this._timestampModel = new CacheTimestampsModel(cacheName);\n }\n\n /**\n * Expires entries for the given cache and given criteria.\n */\n expireEntries() {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (_this._isRunning) {\n _this._rerunRequested = true;\n return;\n }\n _this._isRunning = true;\n\n const now = Date.now();\n\n // First, expire old entries, if maxAgeSeconds is set.\n const oldEntries = yield _this._findOldEntries(now);\n\n // Once that's done, check for the maximum size.\n const extraEntries = yield _this._findExtraEntries();\n\n // Use a Set to remove any duplicates following the concatenation, then\n // convert back into an array.\n const allUrls = [...new Set(oldEntries.concat(extraEntries))];\n\n yield Promise.all([_this._deleteFromCache(allUrls), _this._deleteFromIDB(allUrls)]);\n\n {\n // TODO: break apart entries deleted due to expiration vs size restraints\n if (allUrls.length > 0) {\n logger_mjs.logger.groupCollapsed(`Expired ${allUrls.length} ` + `${allUrls.length === 1 ? 'entry' : 'entries'} and removed ` + `${allUrls.length === 1 ? 'it' : 'them'} from the ` + `'${_this._cacheName}' cache.`);\n logger_mjs.logger.log(`Expired the following ${allUrls.length === 1 ? 'URL' : 'URLs'}:`);\n allUrls.forEach(function (url) {\n return logger_mjs.logger.log(` ${url}`);\n });\n logger_mjs.logger.groupEnd();\n } else {\n logger_mjs.logger.debug(`Cache expiration ran and found no entries to remove.`);\n }\n }\n\n _this._isRunning = false;\n if (_this._rerunRequested) {\n _this._rerunRequested = false;\n _this.expireEntries();\n }\n })();\n }\n\n /**\n * Expires entries based on the maximum age.\n *\n * @param {number} expireFromTimestamp A timestamp.\n * @return {Promise<Array<string>>} A list of the URLs that were expired.\n *\n * @private\n */\n _findOldEntries(expireFromTimestamp) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isType(expireFromTimestamp, 'number', {\n moduleName: 'workbox-cache-expiration',\n className: 'CacheExpiration',\n funcName: '_findOldEntries',\n paramName: 'expireFromTimestamp'\n });\n }\n\n if (!_this2._maxAgeSeconds) {\n return [];\n }\n\n const expireOlderThan = expireFromTimestamp - _this2._maxAgeSeconds * 1000;\n const timestamps = yield _this2._timestampModel.getAllTimestamps();\n const expiredUrls = [];\n timestamps.forEach(function (timestampDetails) {\n if (timestampDetails.timestamp < expireOlderThan) {\n expiredUrls.push(timestampDetails.url);\n }\n });\n\n return expiredUrls;\n })();\n }\n\n /**\n * @return {Promise<Array>}\n *\n * @private\n */\n _findExtraEntries() {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const extraUrls = [];\n\n if (!_this3._maxEntries) {\n return [];\n }\n\n const timestamps = yield _this3._timestampModel.getAllTimestamps();\n while (timestamps.length > _this3._maxEntries) {\n const lastUsed = timestamps.shift();\n extraUrls.push(lastUsed.url);\n }\n\n return extraUrls;\n })();\n }\n\n /**\n * @param {Array<string>} urls Array of URLs to delete from cache.\n *\n * @private\n */\n _deleteFromCache(urls) {\n var _this4 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const cache = yield caches.open(_this4._cacheName);\n for (const url of urls) {\n yield cache.delete(url);\n }\n })();\n }\n\n /**\n * @param {Array<string>} urls Array of URLs to delete from IDB\n *\n * @private\n */\n _deleteFromIDB(urls) {\n var _this5 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n for (const url of urls) {\n yield _this5._timestampModel.deleteUrl(url);\n }\n })();\n }\n\n /**\n * Update the timestamp for the given URL. This ensures the when\n * removing entries based on maximum entries, most recently used\n * is accurate or when expiring, the timestamp is up-to-date.\n *\n * @param {string} url\n */\n updateTimestamp(url) {\n var _this6 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isType(url, 'string', {\n moduleName: 'workbox-cache-expiration',\n className: 'CacheExpiration',\n funcName: 'updateTimestamp',\n paramName: 'url'\n });\n }\n\n const urlObject = new URL(url, location);\n urlObject.hash = '';\n\n yield _this6._timestampModel.setTimestamp(urlObject.href, Date.now());\n })();\n }\n\n /**\n * Can be used to check if a URL has expired or not before it's used.\n *\n * This requires a look up from IndexedDB, so can be slow.\n *\n * Note: This method will not remove the cached entry, call\n * `expireEntries()` to remove indexedDB and Cache entries.\n *\n * @param {string} url\n * @return {boolean}\n */\n isURLExpired(url) {\n var _this7 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (!_this7._maxAgeSeconds) {\n throw new WorkboxError_mjs.WorkboxError(`expired-test-without-max-age`, {\n methodName: 'isURLExpired',\n paramName: 'maxAgeSeconds'\n });\n }\n const urlObject = new URL(url, location);\n urlObject.hash = '';\n\n const timestamp = yield _this7._timestampModel.getTimestamp(urlObject.href);\n const expireOlderThan = Date.now() - _this7._maxAgeSeconds * 1000;\n return timestamp < expireOlderThan;\n })();\n }\n\n /**\n * Removes the IndexedDB object store used to keep track of cache expiration\n * metadata.\n */\n delete() {\n var _this8 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n // Make sure we don't attempt another rerun if we're called in the middle of\n // a cache expiration.\n _this8._rerunRequested = false;\n yield _this8._timestampModel.delete();\n })();\n }\n }\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * This plugin can be used in the Workbox APIs to regularly enforce a\n * limit on the age and / or the number of cached requests.\n *\n * Whenever a cached request is used or updated, this plugin will look\n * at the used Cache and remove any old or extra requests.\n *\n * When using `maxAgeSeconds`, requests may be used *once* after expiring\n * because the expiration clean up will not have occurred until *after* the\n * cached request has been used. If the request has a \"Date\" header, then\n * a light weight expiration check is performed and the request will not be\n * used immediately.\n *\n * When using `maxEntries`, the last request to be used will be the request\n * that is removed from the Cache.\n *\n * @memberof workbox.expiration\n */\n class Plugin {\n /**\n * @param {Object} config\n * @param {number} [config.maxEntries] The maximum number of entries to cache.\n * Entries used the least will be removed as the maximum is reached.\n * @param {number} [config.maxAgeSeconds] The maximum age of an entry before\n * it's treated as stale and removed.\n * @param {boolean} [config.purgeOnQuotaError] Whether to opt this cache in to\n * automatic deletion if the available storage quota has been exceeded.\n */\n constructor(config = {}) {\n {\n if (!(config.maxEntries || config.maxAgeSeconds)) {\n throw new WorkboxError_mjs.WorkboxError('max-entries-or-age-required', {\n moduleName: 'workbox-cache-expiration',\n className: 'Plugin',\n funcName: 'constructor'\n });\n }\n\n if (config.maxEntries) {\n assert_mjs.assert.isType(config.maxEntries, 'number', {\n moduleName: 'workbox-cache-expiration',\n className: 'Plugin',\n funcName: 'constructor',\n paramName: 'config.maxEntries'\n });\n }\n\n if (config.maxAgeSeconds) {\n assert_mjs.assert.isType(config.maxAgeSeconds, 'number', {\n moduleName: 'workbox-cache-expiration',\n className: 'Plugin',\n funcName: 'constructor',\n paramName: 'config.maxAgeSeconds'\n });\n }\n }\n\n this._config = config;\n this._maxAgeSeconds = config.maxAgeSeconds;\n this._cacheExpirations = new Map();\n\n if (config.purgeOnQuotaError) {\n index_mjs.registerQuotaErrorCallback(() => this.deleteCacheAndMetadata());\n }\n }\n\n /**\n * A simple helper method to return a CacheExpiration instance for a given\n * cache name.\n *\n * @param {string} cacheName\n * @return {CacheExpiration}\n *\n * @private\n */\n _getCacheExpiration(cacheName) {\n if (cacheName === cacheNames_mjs.cacheNames.getRuntimeName()) {\n throw new WorkboxError_mjs.WorkboxError('expire-custom-caches-only');\n }\n\n let cacheExpiration = this._cacheExpirations.get(cacheName);\n if (!cacheExpiration) {\n cacheExpiration = new CacheExpiration(cacheName, this._config);\n this._cacheExpirations.set(cacheName, cacheExpiration);\n }\n return cacheExpiration;\n }\n\n /**\n * A \"lifecycle\" callback that will be triggered automatically by the\n * `workbox.runtimeCaching` handlers when a `Response` is about to be returned\n * from a [Cache](https://developer.mozilla.org/en-US/docs/Web/API/Cache) to\n * the handler. It allows the `Response` to be inspected for freshness and\n * prevents it from being used if the `Response`'s `Date` header value is\n * older than the configured `maxAgeSeconds`.\n *\n * @param {Object} options\n * @param {string} options.cacheName Name of the cache the response is in.\n * @param {Response} options.cachedResponse The `Response` object that's been\n * read from a cache and whose freshness should be checked.\n * @return {Response} Either the `cachedResponse`, if it's\n * fresh, or `null` if the `Response` is older than `maxAgeSeconds`.\n *\n * @private\n */\n cachedResponseWillBeUsed({ cacheName, cachedResponse }) {\n if (!cachedResponse) {\n return null;\n }\n\n let isFresh = this._isResponseDateFresh(cachedResponse);\n\n // Expire entries to ensure that even if the expiration date has\n // expired, it'll only be used once.\n const cacheExpiration = this._getCacheExpiration(cacheName);\n cacheExpiration.expireEntries();\n\n return isFresh ? cachedResponse : null;\n }\n\n /**\n * @param {Response} cachedResponse\n * @return {boolean}\n *\n * @private\n */\n _isResponseDateFresh(cachedResponse) {\n if (!this._maxAgeSeconds) {\n // We aren't expiring by age, so return true, it's fresh\n return true;\n }\n\n // Check if the 'date' header will suffice a quick expiration check.\n // See https://github.com/GoogleChromeLabs/sw-toolbox/issues/164 for\n // discussion.\n const dateHeaderTimestamp = this._getDateHeaderTimestamp(cachedResponse);\n if (dateHeaderTimestamp === null) {\n // Unable to parse date, so assume it's fresh.\n return true;\n }\n\n // If we have a valid headerTime, then our response is fresh iff the\n // headerTime plus maxAgeSeconds is greater than the current time.\n const now = Date.now();\n return dateHeaderTimestamp >= now - this._maxAgeSeconds * 1000;\n }\n\n /**\n * This method will extract the data header and parse it into a useful\n * value.\n *\n * @param {Response} cachedResponse\n * @return {number}\n *\n * @private\n */\n _getDateHeaderTimestamp(cachedResponse) {\n if (!cachedResponse.headers.has('date')) {\n return null;\n }\n\n const dateHeader = cachedResponse.headers.get('date');\n const parsedDate = new Date(dateHeader);\n const headerTime = parsedDate.getTime();\n\n // If the Date header was invalid for some reason, parsedDate.getTime()\n // will return NaN.\n if (isNaN(headerTime)) {\n return null;\n }\n\n return headerTime;\n }\n\n /**\n * A \"lifecycle\" callback that will be triggered automatically by the\n * `workbox.runtimeCaching` handlers when an entry is added to a cache.\n *\n * @param {Object} options\n * @param {string} options.cacheName Name of the cache that was updated.\n * @param {string} options.request The Request for the cached entry.\n *\n * @private\n */\n cacheDidUpdate({ cacheName, request }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isType(cacheName, 'string', {\n moduleName: 'workbox-cache-expiration',\n className: 'Plugin',\n funcName: 'cacheDidUpdate',\n paramName: 'cacheName'\n });\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-cache-expiration',\n className: 'Plugin',\n funcName: 'cacheDidUpdate',\n paramName: 'request'\n });\n }\n\n const cacheExpiration = _this._getCacheExpiration(cacheName);\n yield cacheExpiration.updateTimestamp(request.url);\n yield cacheExpiration.expireEntries();\n })();\n }\n\n /**\n * This is a helper method that performs two operations:\n *\n * - Deletes *all* the underlying Cache instances associated with this plugin\n * instance, by calling caches.delete() on you behalf.\n * - Deletes the metadata from IndexedDB used to keep track of expiration\n * details for each Cache instance.\n *\n * When using cache expiration, calling this method is preferable to calling\n * `caches.delete()` directly, since this will ensure that the IndexedDB\n * metadata is also cleanly removed and open IndexedDB instances are deleted.\n *\n * Note that if you're *not* using cache expiration for a given cache, calling\n * `caches.delete()` and passing in the cache's name should be sufficient.\n * There is no Workbox-specific method needed for cleanup in that case.\n */\n deleteCacheAndMetadata() {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n // Do this one at a time instead of all at once via `Promise.all()` to\n // reduce the chance of inconsistency if a promise rejects.\n for (const [cacheName, cacheExpiration] of _this2._cacheExpirations) {\n yield caches.delete(cacheName);\n yield cacheExpiration.delete();\n }\n\n // Reset this._cacheExpirations to its initial state.\n _this2._cacheExpirations = new Map();\n })();\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.CacheExpiration = CacheExpiration;\n exports.Plugin = Plugin;\n\n return exports;\n\n}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core));\n"],"file":"workbox-cache-expiration.dev.js"}
@@ -1,3 +1,3 @@
1
- this.workbox=this.workbox||{},this.workbox.expiration=function(e,t,r,n,i){"use strict";try{self.workbox.v["workbox:cache-expiration:3.6.2"]=1}catch(e){}const s="url",a="timestamp";class l{constructor(e){this.e=e,this.t=e,this.r=new t.DBWrapper(this.e,2,{onupgradeneeded:e=>this.n(e)})}n(e){const t=e.target.result;e.oldVersion<2&&t.objectStoreNames.contains("workbox-cache-expiration")&&t.deleteObjectStore("workbox-cache-expiration"),t.createObjectStore(this.t,{keyPath:s}).createIndex(a,a,{unique:!1})}setTimestamp(e,t){var r=this;return babelHelpers.asyncToGenerator(function*(){yield r.r.put(r.t,{[s]:new URL(e,location).href,[a]:t})})()}getAllTimestamps(){var e=this;return babelHelpers.asyncToGenerator(function*(){return yield e.r.getAllMatching(e.t,{index:a})})()}getTimestamp(e){var t=this;return babelHelpers.asyncToGenerator(function*(){return(yield t.r.get(t.t,e)).timestamp})()}deleteUrl(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.r.delete(t.t,new URL(e,location).href)})()}delete(){var e=this;return babelHelpers.asyncToGenerator(function*(){yield e.r.deleteDatabase(),e.r=null})()}}class o{constructor(e,t={}){this.i=!1,this.s=!1,this.a=t.maxEntries,this.l=t.maxAgeSeconds,this.e=e,this.o=new l(e)}expireEntries(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(e.i)return void(e.s=!0);e.i=!0;const t=Date.now(),r=yield e.c(t),n=yield e.u(),i=[...new Set(r.concat(n))];yield Promise.all([e.h(i),e.d(i)]),e.i=!1,e.s&&(e.s=!1,e.expireEntries())})()}c(e){var t=this;return babelHelpers.asyncToGenerator(function*(){if(!t.l)return[];const r=e-1e3*t.l,n=[];return(yield t.o.getAllTimestamps()).forEach(function(e){e.timestamp<r&&n.push(e.url)}),n})()}u(){var e=this;return babelHelpers.asyncToGenerator(function*(){const t=[];if(!e.a)return[];const r=yield e.o.getAllTimestamps();for(;r.length>e.a;){const e=r.shift();t.push(e.url)}return t})()}h(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=yield caches.open(t.e);for(const t of e)yield r.delete(t)})()}d(e){var t=this;return babelHelpers.asyncToGenerator(function*(){for(const r of e)yield t.o.deleteUrl(r)})()}updateTimestamp(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=new URL(e,location);r.hash="",yield t.o.setTimestamp(r.href,Date.now())})()}isURLExpired(e){var t=this;return babelHelpers.asyncToGenerator(function*(){if(!t.l)throw new r.WorkboxError("expired-test-without-max-age",{methodName:"isURLExpired",paramName:"maxAgeSeconds"});const n=new URL(e,location);return n.hash="",(yield t.o.getTimestamp(n.href))<Date.now()-1e3*t.l})()}delete(){var e=this;return babelHelpers.asyncToGenerator(function*(){e.s=!1,yield e.o.delete()})()}}return e.CacheExpiration=o,e.Plugin=class{constructor(e={}){this.p=e,this.l=e.maxAgeSeconds,this.b=new Map,e.purgeOnQuotaError&&i.registerQuotaErrorCallback(()=>this.deleteCacheAndMetadata())}f(e){if(e===n.cacheNames.getRuntimeName())throw new r.WorkboxError("expire-custom-caches-only");let t=this.b.get(e);return t||(t=new o(e,this.p),this.b.set(e,t)),t}cachedResponseWillBeUsed({cacheName:e,cachedResponse:t}){if(!t)return null;let r=this.m(t);return this.f(e).expireEntries(),r?t:null}m(e){if(!this.l)return!0;const t=this.y(e);return null===t||t>=Date.now()-1e3*this.l}y(e){if(!e.headers.has("date"))return null;const t=e.headers.get("date"),r=new Date(t).getTime();return isNaN(r)?null:r}cacheDidUpdate({cacheName:e,request:t}){var r=this;return babelHelpers.asyncToGenerator(function*(){const n=r.f(e);yield n.updateTimestamp(t.url),yield n.expireEntries()})()}deleteCacheAndMetadata(){var e=this;return babelHelpers.asyncToGenerator(function*(){for(const[t,r]of e.b)yield caches.delete(t),yield r.delete();e.b=new Map})()}},e}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core);
1
+ this.workbox=this.workbox||{},this.workbox.expiration=function(e,t,r,n,i){"use strict";try{self.workbox.v["workbox:cache-expiration:3.6.3"]=1}catch(e){}const s="url",a="timestamp";class l{constructor(e){this.e=e,this.t=e,this.r=new t.DBWrapper(this.e,2,{onupgradeneeded:e=>this.n(e)})}n(e){const t=e.target.result;e.oldVersion<2&&t.objectStoreNames.contains("workbox-cache-expiration")&&t.deleteObjectStore("workbox-cache-expiration"),t.createObjectStore(this.t,{keyPath:s}).createIndex(a,a,{unique:!1})}setTimestamp(e,t){var r=this;return babelHelpers.asyncToGenerator(function*(){yield r.r.put(r.t,{[s]:new URL(e,location).href,[a]:t})})()}getAllTimestamps(){var e=this;return babelHelpers.asyncToGenerator(function*(){return yield e.r.getAllMatching(e.t,{index:a})})()}getTimestamp(e){var t=this;return babelHelpers.asyncToGenerator(function*(){return(yield t.r.get(t.t,e)).timestamp})()}deleteUrl(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.r.delete(t.t,new URL(e,location).href)})()}delete(){var e=this;return babelHelpers.asyncToGenerator(function*(){yield e.r.deleteDatabase(),e.r=null})()}}class o{constructor(e,t={}){this.i=!1,this.s=!1,this.a=t.maxEntries,this.l=t.maxAgeSeconds,this.e=e,this.o=new l(e)}expireEntries(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(e.i)return void(e.s=!0);e.i=!0;const t=Date.now(),r=yield e.c(t),n=yield e.u(),i=[...new Set(r.concat(n))];yield Promise.all([e.h(i),e.d(i)]),e.i=!1,e.s&&(e.s=!1,e.expireEntries())})()}c(e){var t=this;return babelHelpers.asyncToGenerator(function*(){if(!t.l)return[];const r=e-1e3*t.l,n=[];return(yield t.o.getAllTimestamps()).forEach(function(e){e.timestamp<r&&n.push(e.url)}),n})()}u(){var e=this;return babelHelpers.asyncToGenerator(function*(){const t=[];if(!e.a)return[];const r=yield e.o.getAllTimestamps();for(;r.length>e.a;){const e=r.shift();t.push(e.url)}return t})()}h(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=yield caches.open(t.e);for(const t of e)yield r.delete(t)})()}d(e){var t=this;return babelHelpers.asyncToGenerator(function*(){for(const r of e)yield t.o.deleteUrl(r)})()}updateTimestamp(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=new URL(e,location);r.hash="",yield t.o.setTimestamp(r.href,Date.now())})()}isURLExpired(e){var t=this;return babelHelpers.asyncToGenerator(function*(){if(!t.l)throw new r.WorkboxError("expired-test-without-max-age",{methodName:"isURLExpired",paramName:"maxAgeSeconds"});const n=new URL(e,location);return n.hash="",(yield t.o.getTimestamp(n.href))<Date.now()-1e3*t.l})()}delete(){var e=this;return babelHelpers.asyncToGenerator(function*(){e.s=!1,yield e.o.delete()})()}}return e.CacheExpiration=o,e.Plugin=class{constructor(e={}){this.p=e,this.l=e.maxAgeSeconds,this.b=new Map,e.purgeOnQuotaError&&i.registerQuotaErrorCallback(()=>this.deleteCacheAndMetadata())}f(e){if(e===n.cacheNames.getRuntimeName())throw new r.WorkboxError("expire-custom-caches-only");let t=this.b.get(e);return t||(t=new o(e,this.p),this.b.set(e,t)),t}cachedResponseWillBeUsed({cacheName:e,cachedResponse:t}){if(!t)return null;let r=this.m(t);return this.f(e).expireEntries(),r?t:null}m(e){if(!this.l)return!0;const t=this.y(e);return null===t||t>=Date.now()-1e3*this.l}y(e){if(!e.headers.has("date"))return null;const t=e.headers.get("date"),r=new Date(t).getTime();return isNaN(r)?null:r}cacheDidUpdate({cacheName:e,request:t}){var r=this;return babelHelpers.asyncToGenerator(function*(){const n=r.f(e);yield n.updateTimestamp(t.url),yield n.expireEntries()})()}deleteCacheAndMetadata(){var e=this;return babelHelpers.asyncToGenerator(function*(){for(const[t,r]of e.b)yield caches.delete(t),yield r.delete();e.b=new Map})()}},e}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core);
2
2
 
3
3
  //# sourceMappingURL=workbox-cache-expiration.prod.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-cache-expiration/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.expiration=function(e,t,r,n,i){\"use strict\";try{self.workbox.v[\"workbox:cache-expiration:3.6.2\"]=1}catch(e){}const s=\"url\",a=\"timestamp\";class l{constructor(e){this.e=e,this.t=e,this.r=new t.DBWrapper(this.e,2,{onupgradeneeded:e=>this.n(e)})}n(e){const t=e.target.result;e.oldVersion<2&&t.objectStoreNames.contains(\"workbox-cache-expiration\")&&t.deleteObjectStore(\"workbox-cache-expiration\"),t.createObjectStore(this.t,{keyPath:s}).createIndex(a,a,{unique:!1})}setTimestamp(e,t){var r=this;return babelHelpers.asyncToGenerator(function*(){yield r.r.put(r.t,{[s]:new URL(e,location).href,[a]:t})})()}getAllTimestamps(){var e=this;return babelHelpers.asyncToGenerator(function*(){return yield e.r.getAllMatching(e.t,{index:a})})()}getTimestamp(e){var t=this;return babelHelpers.asyncToGenerator(function*(){return(yield t.r.get(t.t,e)).timestamp})()}deleteUrl(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.r.delete(t.t,new URL(e,location).href)})()}delete(){var e=this;return babelHelpers.asyncToGenerator(function*(){yield e.r.deleteDatabase(),e.r=null})()}}class o{constructor(e,t={}){this.i=!1,this.s=!1,this.a=t.maxEntries,this.l=t.maxAgeSeconds,this.e=e,this.o=new l(e)}expireEntries(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(e.i)return void(e.s=!0);e.i=!0;const t=Date.now(),r=yield e.c(t),n=yield e.u(),i=[...new Set(r.concat(n))];yield Promise.all([e.h(i),e.d(i)]),e.i=!1,e.s&&(e.s=!1,e.expireEntries())})()}c(e){var t=this;return babelHelpers.asyncToGenerator(function*(){if(!t.l)return[];const r=e-1e3*t.l,n=[];return(yield t.o.getAllTimestamps()).forEach(function(e){e.timestamp<r&&n.push(e.url)}),n})()}u(){var e=this;return babelHelpers.asyncToGenerator(function*(){const t=[];if(!e.a)return[];const r=yield e.o.getAllTimestamps();for(;r.length>e.a;){const e=r.shift();t.push(e.url)}return t})()}h(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=yield caches.open(t.e);for(const t of e)yield r.delete(t)})()}d(e){var t=this;return babelHelpers.asyncToGenerator(function*(){for(const r of e)yield t.o.deleteUrl(r)})()}updateTimestamp(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=new URL(e,location);r.hash=\"\",yield t.o.setTimestamp(r.href,Date.now())})()}isURLExpired(e){var t=this;return babelHelpers.asyncToGenerator(function*(){if(!t.l)throw new r.WorkboxError(\"expired-test-without-max-age\",{methodName:\"isURLExpired\",paramName:\"maxAgeSeconds\"});const n=new URL(e,location);return n.hash=\"\",(yield t.o.getTimestamp(n.href))<Date.now()-1e3*t.l})()}delete(){var e=this;return babelHelpers.asyncToGenerator(function*(){e.s=!1,yield e.o.delete()})()}}return e.CacheExpiration=o,e.Plugin=class{constructor(e={}){this.p=e,this.l=e.maxAgeSeconds,this.b=new Map,e.purgeOnQuotaError&&i.registerQuotaErrorCallback(()=>this.deleteCacheAndMetadata())}f(e){if(e===n.cacheNames.getRuntimeName())throw new r.WorkboxError(\"expire-custom-caches-only\");let t=this.b.get(e);return t||(t=new o(e,this.p),this.b.set(e,t)),t}cachedResponseWillBeUsed({cacheName:e,cachedResponse:t}){if(!t)return null;let r=this.m(t);return this.f(e).expireEntries(),r?t:null}m(e){if(!this.l)return!0;const t=this.y(e);return null===t||t>=Date.now()-1e3*this.l}y(e){if(!e.headers.has(\"date\"))return null;const t=e.headers.get(\"date\"),r=new Date(t).getTime();return isNaN(r)?null:r}cacheDidUpdate({cacheName:e,request:t}){var r=this;return babelHelpers.asyncToGenerator(function*(){const n=r.f(e);yield n.updateTimestamp(t.url),yield n.expireEntries()})()}deleteCacheAndMetadata(){var e=this;return babelHelpers.asyncToGenerator(function*(){for(const[t,r]of e.b)yield caches.delete(t),yield r.delete();e.b=new Map})()}},e}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core);\n"],"file":"workbox-cache-expiration.prod.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-cache-expiration/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.expiration=function(e,t,r,n,i){\"use strict\";try{self.workbox.v[\"workbox:cache-expiration:3.6.3\"]=1}catch(e){}const s=\"url\",a=\"timestamp\";class l{constructor(e){this.e=e,this.t=e,this.r=new t.DBWrapper(this.e,2,{onupgradeneeded:e=>this.n(e)})}n(e){const t=e.target.result;e.oldVersion<2&&t.objectStoreNames.contains(\"workbox-cache-expiration\")&&t.deleteObjectStore(\"workbox-cache-expiration\"),t.createObjectStore(this.t,{keyPath:s}).createIndex(a,a,{unique:!1})}setTimestamp(e,t){var r=this;return babelHelpers.asyncToGenerator(function*(){yield r.r.put(r.t,{[s]:new URL(e,location).href,[a]:t})})()}getAllTimestamps(){var e=this;return babelHelpers.asyncToGenerator(function*(){return yield e.r.getAllMatching(e.t,{index:a})})()}getTimestamp(e){var t=this;return babelHelpers.asyncToGenerator(function*(){return(yield t.r.get(t.t,e)).timestamp})()}deleteUrl(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.r.delete(t.t,new URL(e,location).href)})()}delete(){var e=this;return babelHelpers.asyncToGenerator(function*(){yield e.r.deleteDatabase(),e.r=null})()}}class o{constructor(e,t={}){this.i=!1,this.s=!1,this.a=t.maxEntries,this.l=t.maxAgeSeconds,this.e=e,this.o=new l(e)}expireEntries(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(e.i)return void(e.s=!0);e.i=!0;const t=Date.now(),r=yield e.c(t),n=yield e.u(),i=[...new Set(r.concat(n))];yield Promise.all([e.h(i),e.d(i)]),e.i=!1,e.s&&(e.s=!1,e.expireEntries())})()}c(e){var t=this;return babelHelpers.asyncToGenerator(function*(){if(!t.l)return[];const r=e-1e3*t.l,n=[];return(yield t.o.getAllTimestamps()).forEach(function(e){e.timestamp<r&&n.push(e.url)}),n})()}u(){var e=this;return babelHelpers.asyncToGenerator(function*(){const t=[];if(!e.a)return[];const r=yield e.o.getAllTimestamps();for(;r.length>e.a;){const e=r.shift();t.push(e.url)}return t})()}h(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=yield caches.open(t.e);for(const t of e)yield r.delete(t)})()}d(e){var t=this;return babelHelpers.asyncToGenerator(function*(){for(const r of e)yield t.o.deleteUrl(r)})()}updateTimestamp(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=new URL(e,location);r.hash=\"\",yield t.o.setTimestamp(r.href,Date.now())})()}isURLExpired(e){var t=this;return babelHelpers.asyncToGenerator(function*(){if(!t.l)throw new r.WorkboxError(\"expired-test-without-max-age\",{methodName:\"isURLExpired\",paramName:\"maxAgeSeconds\"});const n=new URL(e,location);return n.hash=\"\",(yield t.o.getTimestamp(n.href))<Date.now()-1e3*t.l})()}delete(){var e=this;return babelHelpers.asyncToGenerator(function*(){e.s=!1,yield e.o.delete()})()}}return e.CacheExpiration=o,e.Plugin=class{constructor(e={}){this.p=e,this.l=e.maxAgeSeconds,this.b=new Map,e.purgeOnQuotaError&&i.registerQuotaErrorCallback(()=>this.deleteCacheAndMetadata())}f(e){if(e===n.cacheNames.getRuntimeName())throw new r.WorkboxError(\"expire-custom-caches-only\");let t=this.b.get(e);return t||(t=new o(e,this.p),this.b.set(e,t)),t}cachedResponseWillBeUsed({cacheName:e,cachedResponse:t}){if(!t)return null;let r=this.m(t);return this.f(e).expireEntries(),r?t:null}m(e){if(!this.l)return!0;const t=this.y(e);return null===t||t>=Date.now()-1e3*this.l}y(e){if(!e.headers.has(\"date\"))return null;const t=e.headers.get(\"date\"),r=new Date(t).getTime();return isNaN(r)?null:r}cacheDidUpdate({cacheName:e,request:t}){var r=this;return babelHelpers.asyncToGenerator(function*(){const n=r.f(e);yield n.updateTimestamp(t.url),yield n.expireEntries()})()}deleteCacheAndMetadata(){var e=this;return babelHelpers.asyncToGenerator(function*(){for(const[t,r]of e.b)yield caches.delete(t),yield r.delete();e.b=new Map})()}},e}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core);\n"],"file":"workbox-cache-expiration.prod.js"}
@@ -3,7 +3,7 @@ this.workbox.cacheableResponse = (function (exports,WorkboxError_mjs,assert_mjs,
3
3
  'use strict';
4
4
 
5
5
  try {
6
- self.workbox.v['workbox:cacheable-response:3.6.2'] = 1;
6
+ self.workbox.v['workbox:cacheable-response:3.6.3'] = 1;
7
7
  } catch (e) {} // eslint-disable-line
8
8
 
9
9
  /*
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-cacheable-response/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.cacheableResponse = (function (exports,WorkboxError_mjs,assert_mjs,getFriendlyURL_mjs,logger_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:cacheable-response:3.6.2'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * This class allows you to set up rules determining what\n * status codes and/or headers need to be present in order for a\n * [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)\n * to be considered cacheable.\n *\n * @memberof workbox.cacheableResponse\n */\n class CacheableResponse {\n /**\n * To construct a new CacheableResponse instance you must provide at least\n * one of the `config` properties.\n *\n * If both `statuses` and `headers` are specified, then both conditions must\n * be met for the `Response` to be considered cacheable.\n *\n * @param {Object} config\n * @param {Array<number>} [config.statuses] One or more status codes that a\n * `Response` can have and be considered cacheable.\n * @param {Object<string,string>} [config.headers] A mapping of header names\n * and expected values that a `Response` can have and be considered cacheable.\n * If multiple headers are provided, only one needs to be present.\n */\n constructor(config = {}) {\n {\n if (!(config.statuses || config.headers)) {\n throw new WorkboxError_mjs.WorkboxError('statuses-or-headers-required', {\n moduleName: 'workbox-cacheable-response',\n className: 'CacheableResponse',\n funcName: 'constructor'\n });\n }\n\n if (config.statuses) {\n assert_mjs.assert.isArray(config.statuses, {\n moduleName: 'workbox-cacheable-response',\n className: 'CacheableResponse',\n funcName: 'constructor',\n paramName: 'config.statuses'\n });\n }\n\n if (config.headers) {\n assert_mjs.assert.isType(config.headers, 'object', {\n moduleName: 'workbox-cacheable-response',\n className: 'CacheableResponse',\n funcName: 'constructor',\n paramName: 'config.headers'\n });\n }\n }\n\n this._statuses = config.statuses;\n this._headers = config.headers;\n }\n\n /**\n * Checks a response to see whether it's cacheable or not, based on this\n * object's configuration.\n *\n * @param {Response} response The response whose cacheability is being\n * checked.\n * @return {boolean} `true` if the `Response` is cacheable, and `false`\n * otherwise.\n */\n isResponseCacheable(response) {\n {\n assert_mjs.assert.isInstance(response, Response, {\n moduleName: 'workbox-cacheable-response',\n className: 'CacheableResponse',\n funcName: 'isResponseCacheable',\n paramName: 'response'\n });\n }\n\n let cacheable = true;\n\n if (this._statuses) {\n cacheable = this._statuses.includes(response.status);\n }\n\n if (this._headers && cacheable) {\n cacheable = Object.keys(this._headers).some(headerName => {\n return response.headers.get(headerName) === this._headers[headerName];\n });\n }\n\n {\n if (!cacheable) {\n logger_mjs.logger.groupCollapsed(`The request for ` + `'${getFriendlyURL_mjs.getFriendlyURL(response.url)}' returned a response that does ` + `not meet the criteria for being cached.`);\n\n logger_mjs.logger.groupCollapsed(`View cacheability criteria here.`);\n logger_mjs.logger.unprefixed.log(`Cacheable statuses: ` + JSON.stringify(this._statuses));\n logger_mjs.logger.unprefixed.log(`Cacheable headers: ` + JSON.stringify(this._headers, null, 2));\n logger_mjs.logger.groupEnd();\n\n const logFriendlyHeaders = {};\n response.headers.forEach((value, key) => {\n logFriendlyHeaders[key] = value;\n });\n\n logger_mjs.logger.groupCollapsed(`View response status and headers here.`);\n logger_mjs.logger.unprefixed.log(`Response status: ` + response.status);\n logger_mjs.logger.unprefixed.log(`Response headers: ` + JSON.stringify(logFriendlyHeaders, null, 2));\n logger_mjs.logger.groupEnd();\n\n logger_mjs.logger.groupCollapsed(`View full response details here.`);\n logger_mjs.logger.unprefixed.log(response.headers);\n logger_mjs.logger.unprefixed.log(response);\n logger_mjs.logger.groupEnd();\n\n logger_mjs.logger.groupEnd();\n }\n }\n\n return cacheable;\n }\n }\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * A class implementing the `cacheWillUpdate` lifecycle callback. This makes it\n * easier to add in cacheability checks to requests made via Workbox's built-in\n * strategies.\n *\n * @memberof workbox.cacheableResponse\n */\n class Plugin {\n /**\n * To construct a new cacheable response Plugin instance you must provide at\n * least one of the `config` properties.\n *\n * If both `statuses` and `headers` are specified, then both conditions must\n * be met for the `Response` to be considered cacheable.\n *\n * @param {Object} config\n * @param {Array<number>} [config.statuses] One or more status codes that a\n * `Response` can have and be considered cacheable.\n * @param {Object<string,string>} [config.headers] A mapping of header names\n * and expected values that a `Response` can have and be considered cacheable.\n * If multiple headers are provided, only one needs to be present.\n */\n constructor(config) {\n this._cacheableResponse = new CacheableResponse(config);\n }\n\n /**\n * @param {Object} options\n * @param {Response} options.response\n * @return {boolean}\n * @private\n */\n cacheWillUpdate({ response }) {\n if (this._cacheableResponse.isResponseCacheable(response)) {\n return response;\n }\n return null;\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.CacheableResponse = CacheableResponse;\n exports.Plugin = Plugin;\n\n return exports;\n\n}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));\n"],"file":"workbox-cacheable-response.dev.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-cacheable-response/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.cacheableResponse = (function (exports,WorkboxError_mjs,assert_mjs,getFriendlyURL_mjs,logger_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:cacheable-response:3.6.3'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * This class allows you to set up rules determining what\n * status codes and/or headers need to be present in order for a\n * [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)\n * to be considered cacheable.\n *\n * @memberof workbox.cacheableResponse\n */\n class CacheableResponse {\n /**\n * To construct a new CacheableResponse instance you must provide at least\n * one of the `config` properties.\n *\n * If both `statuses` and `headers` are specified, then both conditions must\n * be met for the `Response` to be considered cacheable.\n *\n * @param {Object} config\n * @param {Array<number>} [config.statuses] One or more status codes that a\n * `Response` can have and be considered cacheable.\n * @param {Object<string,string>} [config.headers] A mapping of header names\n * and expected values that a `Response` can have and be considered cacheable.\n * If multiple headers are provided, only one needs to be present.\n */\n constructor(config = {}) {\n {\n if (!(config.statuses || config.headers)) {\n throw new WorkboxError_mjs.WorkboxError('statuses-or-headers-required', {\n moduleName: 'workbox-cacheable-response',\n className: 'CacheableResponse',\n funcName: 'constructor'\n });\n }\n\n if (config.statuses) {\n assert_mjs.assert.isArray(config.statuses, {\n moduleName: 'workbox-cacheable-response',\n className: 'CacheableResponse',\n funcName: 'constructor',\n paramName: 'config.statuses'\n });\n }\n\n if (config.headers) {\n assert_mjs.assert.isType(config.headers, 'object', {\n moduleName: 'workbox-cacheable-response',\n className: 'CacheableResponse',\n funcName: 'constructor',\n paramName: 'config.headers'\n });\n }\n }\n\n this._statuses = config.statuses;\n this._headers = config.headers;\n }\n\n /**\n * Checks a response to see whether it's cacheable or not, based on this\n * object's configuration.\n *\n * @param {Response} response The response whose cacheability is being\n * checked.\n * @return {boolean} `true` if the `Response` is cacheable, and `false`\n * otherwise.\n */\n isResponseCacheable(response) {\n {\n assert_mjs.assert.isInstance(response, Response, {\n moduleName: 'workbox-cacheable-response',\n className: 'CacheableResponse',\n funcName: 'isResponseCacheable',\n paramName: 'response'\n });\n }\n\n let cacheable = true;\n\n if (this._statuses) {\n cacheable = this._statuses.includes(response.status);\n }\n\n if (this._headers && cacheable) {\n cacheable = Object.keys(this._headers).some(headerName => {\n return response.headers.get(headerName) === this._headers[headerName];\n });\n }\n\n {\n if (!cacheable) {\n logger_mjs.logger.groupCollapsed(`The request for ` + `'${getFriendlyURL_mjs.getFriendlyURL(response.url)}' returned a response that does ` + `not meet the criteria for being cached.`);\n\n logger_mjs.logger.groupCollapsed(`View cacheability criteria here.`);\n logger_mjs.logger.unprefixed.log(`Cacheable statuses: ` + JSON.stringify(this._statuses));\n logger_mjs.logger.unprefixed.log(`Cacheable headers: ` + JSON.stringify(this._headers, null, 2));\n logger_mjs.logger.groupEnd();\n\n const logFriendlyHeaders = {};\n response.headers.forEach((value, key) => {\n logFriendlyHeaders[key] = value;\n });\n\n logger_mjs.logger.groupCollapsed(`View response status and headers here.`);\n logger_mjs.logger.unprefixed.log(`Response status: ` + response.status);\n logger_mjs.logger.unprefixed.log(`Response headers: ` + JSON.stringify(logFriendlyHeaders, null, 2));\n logger_mjs.logger.groupEnd();\n\n logger_mjs.logger.groupCollapsed(`View full response details here.`);\n logger_mjs.logger.unprefixed.log(response.headers);\n logger_mjs.logger.unprefixed.log(response);\n logger_mjs.logger.groupEnd();\n\n logger_mjs.logger.groupEnd();\n }\n }\n\n return cacheable;\n }\n }\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * A class implementing the `cacheWillUpdate` lifecycle callback. This makes it\n * easier to add in cacheability checks to requests made via Workbox's built-in\n * strategies.\n *\n * @memberof workbox.cacheableResponse\n */\n class Plugin {\n /**\n * To construct a new cacheable response Plugin instance you must provide at\n * least one of the `config` properties.\n *\n * If both `statuses` and `headers` are specified, then both conditions must\n * be met for the `Response` to be considered cacheable.\n *\n * @param {Object} config\n * @param {Array<number>} [config.statuses] One or more status codes that a\n * `Response` can have and be considered cacheable.\n * @param {Object<string,string>} [config.headers] A mapping of header names\n * and expected values that a `Response` can have and be considered cacheable.\n * If multiple headers are provided, only one needs to be present.\n */\n constructor(config) {\n this._cacheableResponse = new CacheableResponse(config);\n }\n\n /**\n * @param {Object} options\n * @param {Response} options.response\n * @return {boolean}\n * @private\n */\n cacheWillUpdate({ response }) {\n if (this._cacheableResponse.isResponseCacheable(response)) {\n return response;\n }\n return null;\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.CacheableResponse = CacheableResponse;\n exports.Plugin = Plugin;\n\n return exports;\n\n}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));\n"],"file":"workbox-cacheable-response.dev.js"}
@@ -1,3 +1,3 @@
1
- this.workbox=this.workbox||{},this.workbox.cacheableResponse=function(t){"use strict";try{self.workbox.v["workbox:cacheable-response:3.6.2"]=1}catch(t){}class s{constructor(t={}){this.t=t.statuses,this.s=t.headers}isResponseCacheable(t){let s=!0;return this.t&&(s=this.t.includes(t.status)),this.s&&s&&(s=Object.keys(this.s).some(s=>t.headers.get(s)===this.s[s])),s}}return t.CacheableResponse=s,t.Plugin=class{constructor(t){this.e=new s(t)}cacheWillUpdate({response:t}){return this.e.isResponseCacheable(t)?t:null}},t}({});
1
+ this.workbox=this.workbox||{},this.workbox.cacheableResponse=function(t){"use strict";try{self.workbox.v["workbox:cacheable-response:3.6.3"]=1}catch(t){}class s{constructor(t={}){this.t=t.statuses,this.s=t.headers}isResponseCacheable(t){let s=!0;return this.t&&(s=this.t.includes(t.status)),this.s&&s&&(s=Object.keys(this.s).some(s=>t.headers.get(s)===this.s[s])),s}}return t.CacheableResponse=s,t.Plugin=class{constructor(t){this.e=new s(t)}cacheWillUpdate({response:t}){return this.e.isResponseCacheable(t)?t:null}},t}({});
2
2
 
3
3
  //# sourceMappingURL=workbox-cacheable-response.prod.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-cacheable-response/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.cacheableResponse=function(t){\"use strict\";try{self.workbox.v[\"workbox:cacheable-response:3.6.2\"]=1}catch(t){}class s{constructor(t={}){this.t=t.statuses,this.s=t.headers}isResponseCacheable(t){let s=!0;return this.t&&(s=this.t.includes(t.status)),this.s&&s&&(s=Object.keys(this.s).some(s=>t.headers.get(s)===this.s[s])),s}}return t.CacheableResponse=s,t.Plugin=class{constructor(t){this.e=new s(t)}cacheWillUpdate({response:t}){return this.e.isResponseCacheable(t)?t:null}},t}({});\n"],"file":"workbox-cacheable-response.prod.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-cacheable-response/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.cacheableResponse=function(t){\"use strict\";try{self.workbox.v[\"workbox:cacheable-response:3.6.3\"]=1}catch(t){}class s{constructor(t={}){this.t=t.statuses,this.s=t.headers}isResponseCacheable(t){let s=!0;return this.t&&(s=this.t.includes(t.status)),this.s&&s&&(s=Object.keys(this.s).some(s=>t.headers.get(s)===this.s[s])),s}}return t.CacheableResponse=s,t.Plugin=class{constructor(t){this.e=new s(t)}cacheWillUpdate({response:t}){return this.e.isResponseCacheable(t)?t:null}},t}({});\n"],"file":"workbox-cacheable-response.prod.js"}
@@ -40,7 +40,7 @@ this.workbox.core = (function () {
40
40
  'use strict';
41
41
 
42
42
  try {
43
- self.workbox.v['workbox:core:3.6.2'] = 1;
43
+ self.workbox.v['workbox:core:3.6.3'] = 1;
44
44
  } catch (e) {} // eslint-disable-line
45
45
 
46
46
  /*
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-core/browser.mjs"],"sourcesContent":["/* eslint-disable */\n// This is extracted from the Babel runtime (original source: https://github.com/babel/babel/blob/9e0f5235b1ca5167c368a576ad7c5af62d20b0e3/packages/babel-helpers/src/helpers.js#L240).\n// As part of the Rollup bundling process, it's injected once into workbox-core\n// and reused throughout all of the other modules, avoiding code duplication.\n// See https://github.com/GoogleChrome/workbox/pull/1048#issuecomment-344698046\n// for further background.\nself.babelHelpers = {\n asyncToGenerator: function(fn) {\n return function() {\n var gen = fn.apply(this, arguments);\n return new Promise(function(resolve, reject) {\n function step(key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n return Promise.resolve(value).then(function(value) {\n step('next', value);\n }, function(err) {\n step('throw', err);\n });\n }\n }\n\n return step('next');\n });\n };\n },\n};\n\nthis.workbox = this.workbox || {};\nthis.workbox.core = (function () {\n 'use strict';\n\n try {\n self.workbox.v['workbox:core:3.6.2'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * The available log levels in Workbox: debug, log, warn, error and silent.\n *\n * @property {int} debug Prints all logs from Workbox. Useful for debugging.\n * @property {int} log Prints console log, warn, error and groups. Default for\n * debug builds.\n * @property {int} warn Prints console warn, error and groups. Default for\n * non-debug builds.\n * @property {int} error Print console error and groups.\n * @property {int} silent Force no logging from Workbox.\n *\n * @alias workbox.core.LOG_LEVELS\n */\n\n var LOG_LEVELS = {\n debug: 0,\n log: 1,\n warn: 2,\n error: 3,\n silent: 4\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n // Safari doesn't print all console.groupCollapsed() arguments.\n // Related bug: https://bugs.webkit.org/show_bug.cgi?id=182754\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n\n const GREY = `#7f8c8d`;\n const GREEN = `#2ecc71`;\n const YELLOW = `#f39c12`;\n const RED = `#c0392b`;\n const BLUE = `#3498db`;\n\n const getDefaultLogLevel = () => LOG_LEVELS.log;\n\n let logLevel = getDefaultLogLevel();\n const shouldPrint = minLevel => logLevel <= minLevel;\n const setLoggerLevel = newLogLevel => logLevel = newLogLevel;\n const getLoggerLevel = () => logLevel;\n\n // We always want groups to be logged unless logLevel is silent.\n const groupLevel = LOG_LEVELS.error;\n\n const _print = function (keyName, logArgs, levelColor) {\n const logLevel = keyName.indexOf('group') === 0 ? groupLevel : LOG_LEVELS[keyName];\n if (!shouldPrint(logLevel)) {\n return;\n }\n\n if (!levelColor || keyName === 'groupCollapsed' && isSafari) {\n console[keyName](...logArgs);\n return;\n }\n\n const logPrefix = ['%cworkbox', `background: ${levelColor}; color: white; padding: 2px 0.5em; ` + `border-radius: 0.5em;`];\n console[keyName](...logPrefix, ...logArgs);\n };\n\n const groupEnd = () => {\n if (shouldPrint(groupLevel)) {\n console.groupEnd();\n }\n };\n\n const defaultExport = {\n groupEnd,\n unprefixed: {\n groupEnd\n }\n };\n\n const setupLogs = (keyName, color) => {\n defaultExport[keyName] = (...args) => _print(keyName, args, color);\n defaultExport.unprefixed[keyName] = (...args) => _print(keyName, args);\n };\n\n const levelToColor = {\n debug: GREY,\n log: GREEN,\n warn: YELLOW,\n error: RED,\n groupCollapsed: BLUE\n };\n Object.keys(levelToColor).forEach(keyName => setupLogs(keyName, levelToColor[keyName]));\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var messages = {\n 'invalid-value': ({ paramName, validValueDescription, value }) => {\n if (!paramName || !validValueDescription) {\n throw new Error(`Unexpected input to 'invalid-value' error.`);\n }\n return `The '${paramName}' parameter was given a value with an ` + `unexpected value. ${validValueDescription} Received a value of ` + `${JSON.stringify(value)}.`;\n },\n\n 'not-in-sw': ({ moduleName }) => {\n if (!moduleName) {\n throw new Error(`Unexpected input to 'not-in-sw' error.`);\n }\n return `The '${moduleName}' must be used in a service worker.`;\n },\n\n 'not-an-array': ({ moduleName, className, funcName, paramName }) => {\n if (!moduleName || !className || !funcName || !paramName) {\n throw new Error(`Unexpected input to 'not-an-array' error.`);\n }\n return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className}.${funcName}()' must be an array.`;\n },\n\n 'incorrect-type': ({ expectedType, paramName, moduleName, className,\n funcName }) => {\n if (!expectedType || !paramName || !moduleName || !funcName) {\n throw new Error(`Unexpected input to 'incorrect-type' error.`);\n }\n return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className ? className + '.' : ''}` + `${funcName}()' must be of type ${expectedType}.`;\n },\n\n 'incorrect-class': ({ expectedClass, paramName, moduleName, className,\n funcName, isReturnValueProblem }) => {\n if (!expectedClass || !moduleName || !funcName) {\n throw new Error(`Unexpected input to 'incorrect-class' error.`);\n }\n\n if (isReturnValueProblem) {\n return `The return value from ` + `'${moduleName}.${className ? className + '.' : ''}${funcName}()' ` + `must be an instance of class ${expectedClass.name}.`;\n }\n\n return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className ? className + '.' : ''}${funcName}()' ` + `must be an instance of class ${expectedClass.name}.`;\n },\n\n 'missing-a-method': ({ expectedMethod, paramName, moduleName, className,\n funcName }) => {\n if (!expectedMethod || !paramName || !moduleName || !className || !funcName) {\n throw new Error(`Unexpected input to 'missing-a-method' error.`);\n }\n return `${moduleName}.${className}.${funcName}() expected the ` + `'${paramName}' parameter to expose a '${expectedMethod}' method.`;\n },\n\n 'add-to-cache-list-unexpected-type': ({ entry }) => {\n return `An unexpected entry was passed to ` + `'workbox-precaching.PrecacheController.addToCacheList()' The entry ` + `'${JSON.stringify(entry)}' isn't supported. You must supply an array of ` + `strings with one or more characters, objects with a url property or ` + `Request objects.`;\n },\n\n 'add-to-cache-list-conflicting-entries': ({ firstEntry, secondEntry }) => {\n if (!firstEntry || !secondEntry) {\n throw new Error(`Unexpected input to ` + `'add-to-cache-list-duplicate-entries' error.`);\n }\n\n return `Two of the entries passed to ` + `'workbox-precaching.PrecacheController.addToCacheList()' had matching ` + `URLs but different revision details. This means workbox-precaching ` + `is unable to determine cache the asset correctly. Please remove one ` + `of the entries.`;\n },\n\n 'plugin-error-request-will-fetch': ({ thrownError }) => {\n if (!thrownError) {\n throw new Error(`Unexpected input to ` + `'plugin-error-request-will-fetch', error.`);\n }\n\n return `An error was thrown by a plugins 'requestWillFetch()' method. ` + `The thrown error message was: '${thrownError.message}'.`;\n },\n\n 'invalid-cache-name': ({ cacheNameId, value }) => {\n if (!cacheNameId) {\n throw new Error(`Expected a 'cacheNameId' for error 'invalid-cache-name'`);\n }\n\n return `You must provide a name containing at least one character for ` + `setCacheDeatils({${cacheNameId}: '...'}). Received a value of ` + `'${JSON.stringify(value)}'`;\n },\n\n 'unregister-route-but-not-found-with-method': ({ method }) => {\n if (!method) {\n throw new Error(`Unexpected input to ` + `'unregister-route-but-not-found-with-method' error.`);\n }\n\n return `The route you're trying to unregister was not previously ` + `registered for the method type '${method}'.`;\n },\n\n 'unregister-route-route-not-registered': () => {\n return `The route you're trying to unregister was not previously ` + `registered.`;\n },\n\n 'queue-replay-failed': ({ name, count }) => {\n return `${count} requests failed, while trying to replay Queue: ${name}.`;\n },\n\n 'duplicate-queue-name': ({ name }) => {\n return `The Queue name '${name}' is already being used. ` + `All instances of backgroundSync.Queue must be given unique names.`;\n },\n\n 'expired-test-without-max-age': ({ methodName, paramName }) => {\n return `The '${methodName}()' method can only be used when the ` + `'${paramName}' is used in the constructor.`;\n },\n\n 'unsupported-route-type': ({ moduleName, className, funcName, paramName }) => {\n return `The supplied '${paramName}' parameter was an unsupported type. ` + `Please check the docs for ${moduleName}.${className}.${funcName} for ` + `valid input types.`;\n },\n\n 'not-array-of-class': ({ value, expectedClass,\n moduleName, className, funcName, paramName }) => {\n return `The supplied '${paramName}' parameter must be an array of ` + `'${expectedClass}' objects. Received '${JSON.stringify(value)},'. ` + `Please check the call to ${moduleName}.${className}.${funcName}() ` + `to fix the issue.`;\n },\n\n 'max-entries-or-age-required': ({ moduleName, className, funcName }) => {\n return `You must define either config.maxEntries or config.maxAgeSeconds` + `in ${moduleName}.${className}.${funcName}`;\n },\n\n 'statuses-or-headers-required': ({ moduleName, className, funcName }) => {\n return `You must define either config.statuses or config.headers` + `in ${moduleName}.${className}.${funcName}`;\n },\n\n 'invalid-string': ({ moduleName, className, funcName, paramName }) => {\n if (!paramName || !moduleName || !className || !funcName) {\n throw new Error(`Unexpected input to 'invalid-string' error.`);\n }\n return `When using strings, the '${paramName}' parameter must start with ` + `'http' (for cross-origin matches) or '/' (for same-origin matches). ` + `Please see the docs for ${moduleName}.${className}.${funcName}() for ` + `more info.`;\n },\n 'channel-name-required': () => {\n return `You must provide a channelName to construct a ` + `BroadcastCacheUpdate instance.`;\n },\n 'invalid-responses-are-same-args': () => {\n return `The arguments passed into responsesAreSame() appear to be ` + `invalid. Please ensure valid Responses are used.`;\n },\n 'expire-custom-caches-only': () => {\n return `You must provide a 'cacheName' property when using the ` + `expiration plugin with a runtime caching strategy.`;\n },\n 'unit-must-be-bytes': ({ normalizedRangeHeader }) => {\n if (!normalizedRangeHeader) {\n throw new Error(`Unexpected input to 'unit-must-be-bytes' error.`);\n }\n return `The 'unit' portion of the Range header must be set to 'bytes'. ` + `The Range header provided was \"${normalizedRangeHeader}\"`;\n },\n 'single-range-only': ({ normalizedRangeHeader }) => {\n if (!normalizedRangeHeader) {\n throw new Error(`Unexpected input to 'single-range-only' error.`);\n }\n return `Multiple ranges are not supported. Please use a single start ` + `value, and optional end value. The Range header provided was ` + `\"${normalizedRangeHeader}\"`;\n },\n 'invalid-range-values': ({ normalizedRangeHeader }) => {\n if (!normalizedRangeHeader) {\n throw new Error(`Unexpected input to 'invalid-range-values' error.`);\n }\n return `The Range header is missing both start and end values. At least ` + `one of those values is needed. The Range header provided was ` + `\"${normalizedRangeHeader}\"`;\n },\n 'no-range-header': () => {\n return `No Range header was found in the Request provided.`;\n },\n 'range-not-satisfiable': ({ size, start, end }) => {\n return `The start (${start}) and end (${end}) values in the Range are ` + `not satisfiable by the cached response, which is ${size} bytes.`;\n },\n 'attempt-to-cache-non-get-request': ({ url, method }) => {\n return `Unable to cache '${url}' because it is a '${method}' request and ` + `only 'GET' requests can be cached.`;\n },\n 'cache-put-with-no-response': ({ url }) => {\n return `There was an attempt to cache '${url}' but the response was not ` + `defined.`;\n }\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const generatorFunction = (code, ...args) => {\n const message = messages[code];\n if (!message) {\n throw new Error(`Unable to find message for code '${code}'.`);\n }\n\n return message(...args);\n };\n\n const exportedValue = generatorFunction;\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Workbox errors should be thrown with this class.\n * This allows use to ensure the type easily in tests,\n * helps developers identify errors from workbox\n * easily and allows use to optimise error\n * messages correctly.\n *\n * @private\n */\n class WorkboxError extends Error {\n /**\n *\n * @param {string} errorCode The error code that\n * identifies this particular error.\n * @param {Object=} details Any relevant arguments\n * that will help developers identify issues should\n * be added as a key on the context object.\n */\n constructor(errorCode, details) {\n let message = exportedValue(errorCode, details);\n\n super(message);\n\n this.name = errorCode;\n this.details = details;\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n * This method returns true if the current context is a service worker.\n */\n const isSwEnv = moduleName => {\n if (!('ServiceWorkerGlobalScope' in self)) {\n throw new WorkboxError('not-in-sw', { moduleName });\n }\n };\n\n /*\n * This method throws if the supplied value is not an array.\n * The destructed values are required to produce a meaningful error for users.\n * The destructed and restructured object is so it's clear what is\n * needed.\n */\n const isArray = (value, { moduleName, className, funcName, paramName }) => {\n if (!Array.isArray(value)) {\n throw new WorkboxError('not-an-array', {\n moduleName,\n className,\n funcName,\n paramName\n });\n }\n };\n\n const hasMethod = (object, expectedMethod, { moduleName, className, funcName, paramName }) => {\n const type = typeof object[expectedMethod];\n if (type !== 'function') {\n throw new WorkboxError('missing-a-method', { paramName, expectedMethod,\n moduleName, className, funcName });\n }\n };\n\n const isType = (object, expectedType, { moduleName, className, funcName, paramName }) => {\n if (typeof object !== expectedType) {\n throw new WorkboxError('incorrect-type', { paramName, expectedType,\n moduleName, className, funcName });\n }\n };\n\n const isInstance = (object, expectedClass, { moduleName, className, funcName,\n paramName, isReturnValueProblem }) => {\n if (!(object instanceof expectedClass)) {\n throw new WorkboxError('incorrect-class', { paramName, expectedClass,\n moduleName, className, funcName, isReturnValueProblem });\n }\n };\n\n const isOneOf = (value, validValues, { paramName }) => {\n if (!validValues.includes(value)) {\n throw new WorkboxError('invalid-value', {\n paramName,\n value,\n validValueDescription: `Valid values are ${JSON.stringify(validValues)}.`\n });\n }\n };\n\n const isArrayOfClass = (value, expectedClass, { moduleName, className, funcName, paramName }) => {\n const error = new WorkboxError('not-array-of-class', {\n value, expectedClass,\n moduleName, className, funcName, paramName\n });\n if (!Array.isArray(value)) {\n throw error;\n }\n\n for (let item of value) {\n if (!(item instanceof expectedClass)) {\n throw error;\n }\n }\n };\n\n const finalAssertExports = {\n hasMethod,\n isArray,\n isInstance,\n isOneOf,\n isSwEnv,\n isType,\n isArrayOfClass\n };\n\n /**\n * Runs all of the callback functions, one at a time sequentially, in the order\n * in which they were registered.\n *\n * @memberof workbox.core\n * @private\n */\n let executeQuotaErrorCallbacks = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* () {\n {\n defaultExport.log(`About to run ${callbacks.size} callbacks to clean up caches.`);\n }\n\n for (const callback of callbacks) {\n yield callback();\n {\n defaultExport.log(callback, 'is complete.');\n }\n }\n\n {\n defaultExport.log('Finished running callbacks.');\n }\n });\n\n return function executeQuotaErrorCallbacks() {\n return _ref.apply(this, arguments);\n };\n })();\n\n const callbacks = new Set();\n\n /**\n * Adds a function to the set of callbacks that will be executed when there's\n * a quota error.\n *\n * @param {Function} callback\n * @memberof workbox.core\n */\n function registerQuotaErrorCallback(callback) {\n {\n finalAssertExports.isType(callback, 'function', {\n moduleName: 'workbox-core',\n funcName: 'register',\n paramName: 'callback'\n });\n }\n\n callbacks.add(callback);\n\n {\n defaultExport.log('Registered a callback to respond to quota errors.', callback);\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * A class that wraps common IndexedDB functionality in a promise-based API.\n * It exposes all the underlying power and functionality of IndexedDB, but\n * wraps the most commonly used features in a way that's much simpler to use.\n *\n * @private\n */\n class DBWrapper {\n /**\n * @param {string} name\n * @param {number} version\n * @param {Object=} [callback]\n * @param {function(this:DBWrapper, Event)} [callbacks.onupgradeneeded]\n * @param {function(this:DBWrapper, Event)} [callbacks.onversionchange]\n * Defaults to DBWrapper.prototype._onversionchange when not specified.\n */\n constructor(name, version, {\n onupgradeneeded,\n onversionchange = this._onversionchange\n } = {}) {\n this._name = name;\n this._version = version;\n this._onupgradeneeded = onupgradeneeded;\n this._onversionchange = onversionchange;\n\n // If this is null, it means the database isn't open.\n this._db = null;\n }\n\n /**\n * Opens a connected to an IDBDatabase, invokes any onupgradedneeded\n * callback, and added an onversionchange callback to the database.\n *\n * @return {IDBDatabase}\n *\n * @private\n */\n open() {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (_this._db) return;\n\n _this._db = yield new Promise(function (resolve, reject) {\n // This flag is flipped to true if the timeout callback runs prior\n // to the request failing or succeeding. Note: we use a timeout instead\n // of an onblocked handler since there are cases where onblocked will\n // never never run. A timeout better handles all possible scenarios:\n // https://github.com/w3c/IndexedDB/issues/223\n let openRequestTimedOut = false;\n setTimeout(function () {\n openRequestTimedOut = true;\n reject(new Error('The open request was blocked and timed out'));\n }, _this.OPEN_TIMEOUT);\n\n const openRequest = indexedDB.open(_this._name, _this._version);\n openRequest.onerror = function (evt) {\n return reject(openRequest.error);\n };\n openRequest.onupgradeneeded = function (evt) {\n if (openRequestTimedOut) {\n openRequest.transaction.abort();\n evt.target.result.close();\n } else if (_this._onupgradeneeded) {\n _this._onupgradeneeded(evt);\n }\n };\n openRequest.onsuccess = function (evt) {\n const db = evt.target.result;\n if (openRequestTimedOut) {\n db.close();\n } else {\n db.onversionchange = _this._onversionchange;\n resolve(db);\n }\n };\n });\n\n return _this;\n })();\n }\n\n /**\n * Delegates to the native `get()` method for the object store.\n *\n * @param {string} storeName The name of the object store to put the value.\n * @param {...*} args The values passed to the delegated method.\n * @return {*} The key of the entry.\n *\n * @private\n */\n get(storeName, ...args) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this2._call('get', storeName, 'readonly', ...args);\n })();\n }\n\n /**\n * Delegates to the native `add()` method for the object store.\n *\n * @param {string} storeName The name of the object store to put the value.\n * @param {...*} args The values passed to the delegated method.\n * @return {*} The key of the entry.\n *\n * @private\n */\n add(storeName, ...args) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this3._call('add', storeName, 'readwrite', ...args);\n })();\n }\n\n /**\n * Delegates to the native `put()` method for the object store.\n *\n * @param {string} storeName The name of the object store to put the value.\n * @param {...*} args The values passed to the delegated method.\n * @return {*} The key of the entry.\n *\n * @private\n */\n put(storeName, ...args) {\n var _this4 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this4._call('put', storeName, 'readwrite', ...args);\n })();\n }\n\n /**\n * Delegates to the native `delete()` method for the object store.\n *\n * @param {string} storeName\n * @param {...*} args The values passed to the delegated method.\n *\n * @private\n */\n delete(storeName, ...args) {\n var _this5 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this5._call('delete', storeName, 'readwrite', ...args);\n })();\n }\n\n /**\n * Deletes the underlying database, ensuring that any open connections are\n * closed first.\n *\n * @private\n */\n deleteDatabase() {\n var _this6 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n _this6.close();\n _this6._db = null;\n yield new Promise(function (resolve, reject) {\n const request = indexedDB.deleteDatabase(_this6._name);\n request.onerror = function (evt) {\n return reject(evt.target.error);\n };\n request.onblocked = function () {\n return reject(new Error('Deletion was blocked.'));\n };\n request.onsuccess = function () {\n return resolve();\n };\n });\n })();\n }\n\n /**\n * Delegates to the native `getAll()` or polyfills it via the `find()`\n * method in older browsers.\n *\n * @param {string} storeName\n * @param {*} query\n * @param {number} count\n * @return {Array}\n *\n * @private\n */\n getAll(storeName, query, count) {\n var _this7 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if ('getAll' in IDBObjectStore.prototype) {\n return yield _this7._call('getAll', storeName, 'readonly', query, count);\n } else {\n return yield _this7.getAllMatching(storeName, { query, count });\n }\n })();\n }\n\n /**\n * Supports flexible lookup in an object store by specifying an index,\n * query, direction, and count. This method returns an array of objects\n * with the signature .\n *\n * @param {string} storeName\n * @param {Object} [opts]\n * @param {IDBCursorDirection} [opts.direction]\n * @param {*} [opts.query]\n * @param {string} [opts.index] The index to use (if specified).\n * @param {number} [opts.count] The max number of results to return.\n * @param {boolean} [opts.includeKeys] When true, the structure of the\n * returned objects is changed from an array of values to an array of\n * objects in the form {key, primaryKey, value}.\n * @return {Array}\n *\n * @private\n */\n getAllMatching(storeName, opts = {}) {\n var _this8 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this8.transaction([storeName], 'readonly', function (stores, done) {\n const store = stores[storeName];\n const target = opts.index ? store.index(opts.index) : store;\n const results = [];\n\n // Passing `undefined` arguments to Edge's `openCursor(...)` causes\n // 'DOMException: DataError'\n // Details in issue: https://github.com/GoogleChrome/workbox/issues/1509\n const query = opts.query || null;\n const direction = opts.direction || 'next';\n target.openCursor(query, direction).onsuccess = function (evt) {\n const cursor = evt.target.result;\n if (cursor) {\n const { primaryKey, key, value } = cursor;\n results.push(opts.includeKeys ? { primaryKey, key, value } : value);\n if (opts.count && results.length >= opts.count) {\n done(results);\n } else {\n cursor.continue();\n }\n } else {\n done(results);\n }\n };\n });\n })();\n }\n\n /**\n * Accepts a list of stores, a transaction type, and a callback and\n * performs a transaction. A promise is returned that resolves to whatever\n * value the callback chooses. The callback holds all the transaction logic\n * and is invoked with three arguments:\n * 1. An object mapping object store names to IDBObjectStore values.\n * 2. A `done` function, that's used to resolve the promise when\n * when the transaction is done.\n * 3. An `abort` function that can be called to abort the transaction\n * at any time.\n *\n * @param {Array<string>} storeNames An array of object store names\n * involved in the transaction.\n * @param {string} type Can be `readonly` or `readwrite`.\n * @param {function(Object, function(), function(*)):?IDBRequest} callback\n * @return {*} The result of the transaction ran by the callback.\n *\n * @private\n */\n transaction(storeNames, type, callback) {\n var _this9 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this9.open();\n const result = yield new Promise(function (resolve, reject) {\n const txn = _this9._db.transaction(storeNames, type);\n const done = function (value) {\n return resolve(value);\n };\n const abort = function () {\n reject(new Error('The transaction was manually aborted'));\n txn.abort();\n };\n txn.onerror = function (evt) {\n return reject(evt.target.error);\n };\n txn.onabort = function (evt) {\n return reject(evt.target.error);\n };\n txn.oncomplete = function () {\n return resolve();\n };\n\n const stores = {};\n for (const storeName of storeNames) {\n stores[storeName] = txn.objectStore(storeName);\n }\n callback(stores, done, abort);\n });\n return result;\n })();\n }\n\n /**\n * Delegates async to a native IDBObjectStore method.\n *\n * @param {string} method The method name.\n * @param {string} storeName The object store name.\n * @param {string} type Can be `readonly` or `readwrite`.\n * @param {...*} args The list of args to pass to the native method.\n * @return {*} The result of the transaction.\n *\n * @private\n */\n _call(method, storeName, type, ...args) {\n var _this10 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this10.open();\n const callback = function (stores, done) {\n stores[storeName][method](...args).onsuccess = function (evt) {\n done(evt.target.result);\n };\n };\n\n return yield _this10.transaction([storeName], type, callback);\n })();\n }\n\n /**\n * The default onversionchange handler, which closes the database so other\n * connections can open without being blocked.\n *\n * @param {Event} evt\n *\n * @private\n */\n _onversionchange(evt) {\n this.close();\n }\n\n /**\n * Closes the connection opened by `DBWrapper.open()`. Generally this method\n * doesn't need to be called since:\n * 1. It's usually better to keep a connection open since opening\n * a new connection is somewhat slow.\n * 2. Connections are automatically closed when the reference is\n * garbage collected.\n * The primary use case for needing to close a connection is when another\n * reference (typically in another tab) needs to upgrade it and would be\n * blocked by the current, open connection.\n *\n * @private\n */\n close() {\n if (this._db) this._db.close();\n }\n }\n\n // Exposed to let users modify the default timeout on a per-instance\n // or global basis.\n DBWrapper.prototype.OPEN_TIMEOUT = 2000;\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const _cacheNameDetails = {\n prefix: 'workbox',\n suffix: self.registration.scope,\n googleAnalytics: 'googleAnalytics',\n precache: 'precache',\n runtime: 'runtime'\n };\n\n const _createCacheName = cacheName => {\n return [_cacheNameDetails.prefix, cacheName, _cacheNameDetails.suffix].filter(value => value.length > 0).join('-');\n };\n\n const cacheNames = {\n updateDetails: details => {\n Object.keys(_cacheNameDetails).forEach(key => {\n if (typeof details[key] !== 'undefined') {\n _cacheNameDetails[key] = details[key];\n }\n });\n },\n getGoogleAnalyticsName: userCacheName => {\n return userCacheName || _createCacheName(_cacheNameDetails.googleAnalytics);\n },\n getPrecacheName: userCacheName => {\n return userCacheName || _createCacheName(_cacheNameDetails.precache);\n },\n getRuntimeName: userCacheName => {\n return userCacheName || _createCacheName(_cacheNameDetails.runtime);\n }\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var pluginEvents = {\n CACHE_DID_UPDATE: 'cacheDidUpdate',\n CACHE_WILL_UPDATE: 'cacheWillUpdate',\n CACHED_RESPONSE_WILL_BE_USED: 'cachedResponseWillBeUsed',\n FETCH_DID_FAIL: 'fetchDidFail',\n REQUEST_WILL_FETCH: 'requestWillFetch'\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var pluginUtils = {\n filter: (plugins, callbackname) => {\n return plugins.filter(plugin => callbackname in plugin);\n }\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const getFriendlyURL = url => {\n const urlObj = new URL(url, location);\n if (urlObj.origin === location.origin) {\n return urlObj.pathname;\n }\n return urlObj.href;\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Wrapper around cache.put().\n *\n * Will call `cacheDidUpdate` on plugins if the cache was updated.\n *\n * @param {Object} options\n * @param {string} options.cacheName\n * @param {Request} options.request\n * @param {Response} options.response\n * @param {Event} [options.event]\n * @param {Array<Object>} [options.plugins=[]]\n *\n * @private\n * @memberof module:workbox-core\n */\n const putWrapper = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* ({\n cacheName,\n request,\n response,\n event,\n plugins = []\n } = {}) {\n if (!response) {\n {\n defaultExport.error(`Cannot cache non-existent response for ` + `'${getFriendlyURL(request.url)}'.`);\n }\n\n throw new WorkboxError('cache-put-with-no-response', {\n url: getFriendlyURL(request.url)\n });\n }\n\n let responseToCache = yield _isResponseSafeToCache({ request, response, event, plugins });\n\n if (!responseToCache) {\n {\n defaultExport.debug(`Response '${getFriendlyURL(request.url)}' will not be ` + `cached.`, responseToCache);\n }\n return;\n }\n\n {\n if (responseToCache.method && responseToCache.method !== 'GET') {\n throw new WorkboxError('attempt-to-cache-non-get-request', {\n url: getFriendlyURL(request.url),\n method: responseToCache.method\n });\n }\n }\n\n const cache = yield caches.open(cacheName);\n\n const updatePlugins = pluginUtils.filter(plugins, pluginEvents.CACHE_DID_UPDATE);\n\n let oldResponse = updatePlugins.length > 0 ? yield matchWrapper({ cacheName, request }) : null;\n\n {\n defaultExport.debug(`Updating the '${cacheName}' cache with a new Response for ` + `${getFriendlyURL(request.url)}.`);\n }\n\n try {\n yield cache.put(request, responseToCache);\n } catch (error) {\n // See https://developer.mozilla.org/en-US/docs/Web/API/DOMException#exception-QuotaExceededError\n if (error.name === 'QuotaExceededError') {\n yield executeQuotaErrorCallbacks();\n }\n throw error;\n }\n\n for (let plugin of updatePlugins) {\n yield plugin[pluginEvents.CACHE_DID_UPDATE].call(plugin, {\n cacheName,\n request,\n event,\n oldResponse,\n newResponse: responseToCache\n });\n }\n });\n\n return function putWrapper() {\n return _ref.apply(this, arguments);\n };\n })();\n\n /**\n * This is a wrapper around cache.match().\n *\n * @param {Object} options\n * @param {string} options.cacheName Name of the cache to match against.\n * @param {Request} options.request The Request that will be used to look up\n *. cache entries.\n * @param {Event} [options.event] The event that propted the action.\n * @param {Object} [options.matchOptions] Options passed to cache.match().\n * @param {Array<Object>} [options.plugins=[]] Array of plugins.\n * @return {Response} A cached response if available.\n *\n * @private\n * @memberof module:workbox-core\n */\n const matchWrapper = (() => {\n var _ref2 = babelHelpers.asyncToGenerator(function* ({\n cacheName,\n request,\n event,\n matchOptions,\n plugins = [] }) {\n const cache = yield caches.open(cacheName);\n let cachedResponse = yield cache.match(request, matchOptions);\n {\n if (cachedResponse) {\n defaultExport.debug(`Found a cached response in '${cacheName}'.`);\n } else {\n defaultExport.debug(`No cached response found in '${cacheName}'.`);\n }\n }\n for (let plugin of plugins) {\n if (pluginEvents.CACHED_RESPONSE_WILL_BE_USED in plugin) {\n cachedResponse = yield plugin[pluginEvents.CACHED_RESPONSE_WILL_BE_USED].call(plugin, {\n cacheName,\n request,\n event,\n matchOptions,\n cachedResponse\n });\n {\n if (cachedResponse) {\n finalAssertExports.isInstance(cachedResponse, Response, {\n moduleName: 'Plugin',\n funcName: pluginEvents.CACHED_RESPONSE_WILL_BE_USED,\n isReturnValueProblem: true\n });\n }\n }\n }\n }\n return cachedResponse;\n });\n\n return function matchWrapper(_x) {\n return _ref2.apply(this, arguments);\n };\n })();\n\n /**\n * This method will call cacheWillUpdate on the available plugins (or use\n * response.ok) to determine if the Response is safe and valid to cache.\n *\n * @param {Object} options\n * @param {Request} options.request\n * @param {Response} options.response\n * @param {Event} [options.event]\n * @param {Array<Object>} [options.plugins=[]]\n * @return {Promise<Response>}\n *\n * @private\n * @memberof module:workbox-core\n */\n const _isResponseSafeToCache = (() => {\n var _ref3 = babelHelpers.asyncToGenerator(function* ({ request, response, event, plugins }) {\n let responseToCache = response;\n let pluginsUsed = false;\n for (let plugin of plugins) {\n if (pluginEvents.CACHE_WILL_UPDATE in plugin) {\n pluginsUsed = true;\n responseToCache = yield plugin[pluginEvents.CACHE_WILL_UPDATE].call(plugin, {\n request,\n response: responseToCache,\n event\n });\n\n {\n if (responseToCache) {\n finalAssertExports.isInstance(responseToCache, Response, {\n moduleName: 'Plugin',\n funcName: pluginEvents.CACHE_WILL_UPDATE,\n isReturnValueProblem: true\n });\n }\n }\n\n if (!responseToCache) {\n break;\n }\n }\n }\n\n if (!pluginsUsed) {\n {\n if (!responseToCache.ok) {\n if (responseToCache.status === 0) {\n defaultExport.warn(`The response for '${request.url}' is an opaque ` + `response. The caching strategy that you're using will not ` + `cache opaque responses by default.`);\n } else {\n defaultExport.debug(`The response for '${request.url}' returned ` + `a status code of '${response.status}' and won't be cached as a ` + `result.`);\n }\n }\n }\n responseToCache = responseToCache.ok ? responseToCache : null;\n }\n\n return responseToCache ? responseToCache : null;\n });\n\n return function _isResponseSafeToCache(_x2) {\n return _ref3.apply(this, arguments);\n };\n })();\n\n const cacheWrapper = {\n put: putWrapper,\n match: matchWrapper\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Wrapper around the fetch API.\n *\n * Will call requestWillFetch on available plugins.\n *\n * @param {Object} options\n * @param {Request|string} options.request\n * @param {Object} [options.fetchOptions]\n * @param {Event} [options.event]\n * @param {Array<Object>} [options.plugins=[]]\n * @return {Promise<Response>}\n *\n * @private\n * @memberof module:workbox-core\n */\n const wrappedFetch = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* ({\n request,\n fetchOptions,\n event,\n plugins = [] }) {\n // We *should* be able to call `await event.preloadResponse` even if it's\n // undefined, but for some reason, doing so leads to errors in our Node unit\n // tests. To work around that, explicitly check preloadResponse's value first.\n if (event && event.preloadResponse) {\n const possiblePreloadResponse = yield event.preloadResponse;\n if (possiblePreloadResponse) {\n {\n defaultExport.log(`Using a preloaded navigation response for ` + `'${getFriendlyURL(request.url)}'`);\n }\n return possiblePreloadResponse;\n }\n }\n\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n finalAssertExports.isInstance(request, Request, {\n paramName: request,\n expectedClass: 'Request',\n moduleName: 'workbox-core',\n className: 'fetchWrapper',\n funcName: 'wrappedFetch'\n });\n }\n\n const failedFetchPlugins = pluginUtils.filter(plugins, pluginEvents.FETCH_DID_FAIL);\n\n // If there is a fetchDidFail plugin, we need to save a clone of the\n // original request before it's either modified by a requestWillFetch\n // plugin or before the original request's body is consumed via fetch().\n const originalRequest = failedFetchPlugins.length > 0 ? request.clone() : null;\n\n try {\n for (let plugin of plugins) {\n if (pluginEvents.REQUEST_WILL_FETCH in plugin) {\n request = yield plugin[pluginEvents.REQUEST_WILL_FETCH].call(plugin, {\n request: request.clone(),\n event\n });\n\n {\n if (request) {\n finalAssertExports.isInstance(request, Request, {\n moduleName: 'Plugin',\n funcName: pluginEvents.CACHED_RESPONSE_WILL_BE_USED,\n isReturnValueProblem: true\n });\n }\n }\n }\n }\n } catch (err) {\n throw new WorkboxError('plugin-error-request-will-fetch', {\n thrownError: err\n });\n }\n\n // The request can be altered by plugins with `requestWillFetch` making\n // the original request (Most likely from a `fetch` event) to be different\n // to the Request we make. Pass both to `fetchDidFail` to aid debugging.\n const pluginFilteredRequest = request.clone();\n\n try {\n const fetchResponse = yield fetch(request, fetchOptions);\n {\n defaultExport.debug(`Network request for ` + `'${getFriendlyURL(request.url)}' returned a response with ` + `status '${fetchResponse.status}'.`);\n }\n return fetchResponse;\n } catch (error) {\n {\n defaultExport.error(`Network request for ` + `'${getFriendlyURL(request.url)}' threw an error.`, error);\n }\n\n for (let plugin of failedFetchPlugins) {\n yield plugin[pluginEvents.FETCH_DID_FAIL].call(plugin, {\n error,\n event,\n originalRequest: originalRequest.clone(),\n request: pluginFilteredRequest.clone()\n });\n }\n\n throw error;\n }\n });\n\n return function wrappedFetch(_x) {\n return _ref.apply(this, arguments);\n };\n })();\n\n const fetchWrapper = {\n fetch: wrappedFetch\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var _private = /*#__PURE__*/Object.freeze({\n DBWrapper: DBWrapper,\n WorkboxError: WorkboxError,\n assert: finalAssertExports,\n cacheNames: cacheNames,\n cacheWrapper: cacheWrapper,\n fetchWrapper: fetchWrapper,\n getFriendlyURL: getFriendlyURL,\n logger: defaultExport\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Logs a warning to the user recommending changing\n * to max-age=0 or no-cache.\n *\n * @param {string} cacheControlHeader\n *\n * @private\n */\n function showWarning(cacheControlHeader) {\n const docsUrl = 'https://developers.google.com/web/tools/workbox/guides/service-worker-checklist#cache-control_of_your_service_worker_file';\n defaultExport.warn(`You are setting a 'cache-control' header of ` + `'${cacheControlHeader}' on your service worker file. This should be ` + `set to 'max-age=0' or 'no-cache' to ensure the latest service worker ` + `is served to your users. Learn more here: ${docsUrl}`);\n }\n\n /**\n * Checks for cache-control header on SW file and\n * warns the developer if it exists with a value\n * other than max-age=0 or no-cache.\n *\n * @return {Promise}\n * @private\n */\n function checkSWFileCacheHeaders() {\n // This is wrapped as an iife to allow async/await while making\n // rollup exclude it in builds.\n return babelHelpers.asyncToGenerator(function* () {\n try {\n const swFile = self.location.href;\n const response = yield fetch(swFile);\n if (!response.ok) {\n // Response failed so nothing we can check;\n return;\n }\n\n if (!response.headers.has('cache-control')) {\n // No cache control header.\n return;\n }\n\n const cacheControlHeader = response.headers.get('cache-control');\n const maxAgeResult = /max-age\\s*=\\s*(\\d*)/g.exec(cacheControlHeader);\n if (maxAgeResult) {\n if (parseInt(maxAgeResult[1], 10) === 0) {\n return;\n }\n }\n\n if (cacheControlHeader.indexOf('no-cache') !== -1) {\n return;\n }\n\n if (cacheControlHeader.indexOf('no-store') !== -1) {\n return;\n }\n\n showWarning(cacheControlHeader);\n } catch (err) {\n // NOOP\n }\n })();\n }\n\n const finalCheckSWFileCacheHeaders = checkSWFileCacheHeaders;\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * This class is never exposed publicly. Inidividual methods are exposed\n * using jsdoc alias commands.\n *\n * @memberof workbox.core\n * @private\n */\n class WorkboxCore {\n /**\n * You should not instantiate this object directly.\n *\n * @private\n */\n constructor() {\n // Give our version strings something to hang off of.\n try {\n self.workbox.v = self.workbox.v || {};\n } catch (err) {}\n // NOOP\n\n\n // A WorkboxCore instance must be exported before we can use the logger.\n // This is so it can get the current log level.\n {\n const padding = ' ';\n defaultExport.groupCollapsed('Welcome to Workbox!');\n defaultExport.unprefixed.log(`You are currently using a development build. ` + `By default this will switch to prod builds when not on localhost. ` + `You can force this with workbox.setConfig({debug: true|false}).`);\n defaultExport.unprefixed.log(`📖 Read the guides and documentation\\n` + `${padding}https://developers.google.com/web/tools/workbox/`);\n defaultExport.unprefixed.log(`❓ Use the [workbox] tag on Stack Overflow to ask questions\\n` + `${padding}https://stackoverflow.com/questions/ask?tags=workbox`);\n defaultExport.unprefixed.log(`🐛 Found a bug? Report it on GitHub\\n` + `${padding}https://github.com/GoogleChrome/workbox/issues/new`);\n defaultExport.groupEnd();\n\n if (typeof finalCheckSWFileCacheHeaders === 'function') {\n finalCheckSWFileCacheHeaders();\n }\n }\n }\n\n /**\n * Get the current cache names used by Workbox.\n *\n * `cacheNames.precache` is used for precached assets,\n * `cacheNames.googleAnalytics` is used by `workbox-google-analytics` to\n * store `analytics.js`,\n * and `cacheNames.runtime` is used for everything else.\n *\n * @return {Object} An object with `precache` and `runtime` cache names.\n *\n * @alias workbox.core.cacheNames\n */\n get cacheNames() {\n return {\n googleAnalytics: cacheNames.getGoogleAnalyticsName(),\n precache: cacheNames.getPrecacheName(),\n runtime: cacheNames.getRuntimeName()\n };\n }\n\n /**\n * You can alter the default cache names used by the Workbox modules by\n * changing the cache name details.\n *\n * Cache names are generated as `<prefix>-<Cache Name>-<suffix>`.\n *\n * @param {Object} details\n * @param {Object} details.prefix The string to add to the beginning of\n * the precache and runtime cache names.\n * @param {Object} details.suffix The string to add to the end of\n * the precache and runtime cache names.\n * @param {Object} details.precache The cache name to use for precache\n * caching.\n * @param {Object} details.runtime The cache name to use for runtime caching.\n * @param {Object} details.googleAnalytics The cache name to use for\n * `workbox-google-analytics` caching.\n *\n * @alias workbox.core.setCacheNameDetails\n */\n setCacheNameDetails(details) {\n {\n Object.keys(details).forEach(key => {\n finalAssertExports.isType(details[key], 'string', {\n moduleName: 'workbox-core',\n className: 'WorkboxCore',\n funcName: 'setCacheNameDetails',\n paramName: `details.${key}`\n });\n });\n\n if ('precache' in details && details.precache.length === 0) {\n throw new WorkboxError('invalid-cache-name', {\n cacheNameId: 'precache',\n value: details.precache\n });\n }\n\n if ('runtime' in details && details.runtime.length === 0) {\n throw new WorkboxError('invalid-cache-name', {\n cacheNameId: 'runtime',\n value: details.runtime\n });\n }\n\n if ('googleAnalytics' in details && details.googleAnalytics.length === 0) {\n throw new WorkboxError('invalid-cache-name', {\n cacheNameId: 'googleAnalytics',\n value: details.googleAnalytics\n });\n }\n }\n\n cacheNames.updateDetails(details);\n }\n\n /**\n * Get the current log level.\n *\n * @return {number}.\n *\n * @alias workbox.core.logLevel\n */\n get logLevel() {\n return getLoggerLevel();\n }\n\n /**\n * Set the current log level passing in one of the values from\n * [LOG_LEVELS]{@link module:workbox-core.LOG_LEVELS}.\n *\n * @param {number} newLevel The new log level to use.\n *\n * @alias workbox.core.setLogLevel\n */\n setLogLevel(newLevel) {\n {\n finalAssertExports.isType(newLevel, 'number', {\n moduleName: 'workbox-core',\n className: 'WorkboxCore',\n funcName: 'logLevel [setter]',\n paramName: `logLevel`\n });\n }\n\n if (newLevel > LOG_LEVELS.silent || newLevel < LOG_LEVELS.debug) {\n throw new WorkboxError('invalid-value', {\n paramName: 'logLevel',\n validValueDescription: `Please use a value from LOG_LEVELS, i.e ` + `'logLevel = workbox.core.LOG_LEVELS.debug'.`,\n value: newLevel\n });\n }\n\n setLoggerLevel(newLevel);\n }\n }\n\n var defaultExport$1 = new WorkboxCore();\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const finalExports = Object.assign(defaultExport$1, {\n _private,\n LOG_LEVELS,\n registerQuotaErrorCallback\n });\n\n return finalExports;\n\n}());\n"],"file":"workbox-core.dev.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-core/browser.mjs"],"sourcesContent":["/* eslint-disable */\n// This is extracted from the Babel runtime (original source: https://github.com/babel/babel/blob/9e0f5235b1ca5167c368a576ad7c5af62d20b0e3/packages/babel-helpers/src/helpers.js#L240).\n// As part of the Rollup bundling process, it's injected once into workbox-core\n// and reused throughout all of the other modules, avoiding code duplication.\n// See https://github.com/GoogleChrome/workbox/pull/1048#issuecomment-344698046\n// for further background.\nself.babelHelpers = {\n asyncToGenerator: function(fn) {\n return function() {\n var gen = fn.apply(this, arguments);\n return new Promise(function(resolve, reject) {\n function step(key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n return Promise.resolve(value).then(function(value) {\n step('next', value);\n }, function(err) {\n step('throw', err);\n });\n }\n }\n\n return step('next');\n });\n };\n },\n};\n\nthis.workbox = this.workbox || {};\nthis.workbox.core = (function () {\n 'use strict';\n\n try {\n self.workbox.v['workbox:core:3.6.3'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * The available log levels in Workbox: debug, log, warn, error and silent.\n *\n * @property {int} debug Prints all logs from Workbox. Useful for debugging.\n * @property {int} log Prints console log, warn, error and groups. Default for\n * debug builds.\n * @property {int} warn Prints console warn, error and groups. Default for\n * non-debug builds.\n * @property {int} error Print console error and groups.\n * @property {int} silent Force no logging from Workbox.\n *\n * @alias workbox.core.LOG_LEVELS\n */\n\n var LOG_LEVELS = {\n debug: 0,\n log: 1,\n warn: 2,\n error: 3,\n silent: 4\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n // Safari doesn't print all console.groupCollapsed() arguments.\n // Related bug: https://bugs.webkit.org/show_bug.cgi?id=182754\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n\n const GREY = `#7f8c8d`;\n const GREEN = `#2ecc71`;\n const YELLOW = `#f39c12`;\n const RED = `#c0392b`;\n const BLUE = `#3498db`;\n\n const getDefaultLogLevel = () => LOG_LEVELS.log;\n\n let logLevel = getDefaultLogLevel();\n const shouldPrint = minLevel => logLevel <= minLevel;\n const setLoggerLevel = newLogLevel => logLevel = newLogLevel;\n const getLoggerLevel = () => logLevel;\n\n // We always want groups to be logged unless logLevel is silent.\n const groupLevel = LOG_LEVELS.error;\n\n const _print = function (keyName, logArgs, levelColor) {\n const logLevel = keyName.indexOf('group') === 0 ? groupLevel : LOG_LEVELS[keyName];\n if (!shouldPrint(logLevel)) {\n return;\n }\n\n if (!levelColor || keyName === 'groupCollapsed' && isSafari) {\n console[keyName](...logArgs);\n return;\n }\n\n const logPrefix = ['%cworkbox', `background: ${levelColor}; color: white; padding: 2px 0.5em; ` + `border-radius: 0.5em;`];\n console[keyName](...logPrefix, ...logArgs);\n };\n\n const groupEnd = () => {\n if (shouldPrint(groupLevel)) {\n console.groupEnd();\n }\n };\n\n const defaultExport = {\n groupEnd,\n unprefixed: {\n groupEnd\n }\n };\n\n const setupLogs = (keyName, color) => {\n defaultExport[keyName] = (...args) => _print(keyName, args, color);\n defaultExport.unprefixed[keyName] = (...args) => _print(keyName, args);\n };\n\n const levelToColor = {\n debug: GREY,\n log: GREEN,\n warn: YELLOW,\n error: RED,\n groupCollapsed: BLUE\n };\n Object.keys(levelToColor).forEach(keyName => setupLogs(keyName, levelToColor[keyName]));\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var messages = {\n 'invalid-value': ({ paramName, validValueDescription, value }) => {\n if (!paramName || !validValueDescription) {\n throw new Error(`Unexpected input to 'invalid-value' error.`);\n }\n return `The '${paramName}' parameter was given a value with an ` + `unexpected value. ${validValueDescription} Received a value of ` + `${JSON.stringify(value)}.`;\n },\n\n 'not-in-sw': ({ moduleName }) => {\n if (!moduleName) {\n throw new Error(`Unexpected input to 'not-in-sw' error.`);\n }\n return `The '${moduleName}' must be used in a service worker.`;\n },\n\n 'not-an-array': ({ moduleName, className, funcName, paramName }) => {\n if (!moduleName || !className || !funcName || !paramName) {\n throw new Error(`Unexpected input to 'not-an-array' error.`);\n }\n return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className}.${funcName}()' must be an array.`;\n },\n\n 'incorrect-type': ({ expectedType, paramName, moduleName, className,\n funcName }) => {\n if (!expectedType || !paramName || !moduleName || !funcName) {\n throw new Error(`Unexpected input to 'incorrect-type' error.`);\n }\n return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className ? className + '.' : ''}` + `${funcName}()' must be of type ${expectedType}.`;\n },\n\n 'incorrect-class': ({ expectedClass, paramName, moduleName, className,\n funcName, isReturnValueProblem }) => {\n if (!expectedClass || !moduleName || !funcName) {\n throw new Error(`Unexpected input to 'incorrect-class' error.`);\n }\n\n if (isReturnValueProblem) {\n return `The return value from ` + `'${moduleName}.${className ? className + '.' : ''}${funcName}()' ` + `must be an instance of class ${expectedClass.name}.`;\n }\n\n return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className ? className + '.' : ''}${funcName}()' ` + `must be an instance of class ${expectedClass.name}.`;\n },\n\n 'missing-a-method': ({ expectedMethod, paramName, moduleName, className,\n funcName }) => {\n if (!expectedMethod || !paramName || !moduleName || !className || !funcName) {\n throw new Error(`Unexpected input to 'missing-a-method' error.`);\n }\n return `${moduleName}.${className}.${funcName}() expected the ` + `'${paramName}' parameter to expose a '${expectedMethod}' method.`;\n },\n\n 'add-to-cache-list-unexpected-type': ({ entry }) => {\n return `An unexpected entry was passed to ` + `'workbox-precaching.PrecacheController.addToCacheList()' The entry ` + `'${JSON.stringify(entry)}' isn't supported. You must supply an array of ` + `strings with one or more characters, objects with a url property or ` + `Request objects.`;\n },\n\n 'add-to-cache-list-conflicting-entries': ({ firstEntry, secondEntry }) => {\n if (!firstEntry || !secondEntry) {\n throw new Error(`Unexpected input to ` + `'add-to-cache-list-duplicate-entries' error.`);\n }\n\n return `Two of the entries passed to ` + `'workbox-precaching.PrecacheController.addToCacheList()' had matching ` + `URLs but different revision details. This means workbox-precaching ` + `is unable to determine cache the asset correctly. Please remove one ` + `of the entries.`;\n },\n\n 'plugin-error-request-will-fetch': ({ thrownError }) => {\n if (!thrownError) {\n throw new Error(`Unexpected input to ` + `'plugin-error-request-will-fetch', error.`);\n }\n\n return `An error was thrown by a plugins 'requestWillFetch()' method. ` + `The thrown error message was: '${thrownError.message}'.`;\n },\n\n 'invalid-cache-name': ({ cacheNameId, value }) => {\n if (!cacheNameId) {\n throw new Error(`Expected a 'cacheNameId' for error 'invalid-cache-name'`);\n }\n\n return `You must provide a name containing at least one character for ` + `setCacheDeatils({${cacheNameId}: '...'}). Received a value of ` + `'${JSON.stringify(value)}'`;\n },\n\n 'unregister-route-but-not-found-with-method': ({ method }) => {\n if (!method) {\n throw new Error(`Unexpected input to ` + `'unregister-route-but-not-found-with-method' error.`);\n }\n\n return `The route you're trying to unregister was not previously ` + `registered for the method type '${method}'.`;\n },\n\n 'unregister-route-route-not-registered': () => {\n return `The route you're trying to unregister was not previously ` + `registered.`;\n },\n\n 'queue-replay-failed': ({ name, count }) => {\n return `${count} requests failed, while trying to replay Queue: ${name}.`;\n },\n\n 'duplicate-queue-name': ({ name }) => {\n return `The Queue name '${name}' is already being used. ` + `All instances of backgroundSync.Queue must be given unique names.`;\n },\n\n 'expired-test-without-max-age': ({ methodName, paramName }) => {\n return `The '${methodName}()' method can only be used when the ` + `'${paramName}' is used in the constructor.`;\n },\n\n 'unsupported-route-type': ({ moduleName, className, funcName, paramName }) => {\n return `The supplied '${paramName}' parameter was an unsupported type. ` + `Please check the docs for ${moduleName}.${className}.${funcName} for ` + `valid input types.`;\n },\n\n 'not-array-of-class': ({ value, expectedClass,\n moduleName, className, funcName, paramName }) => {\n return `The supplied '${paramName}' parameter must be an array of ` + `'${expectedClass}' objects. Received '${JSON.stringify(value)},'. ` + `Please check the call to ${moduleName}.${className}.${funcName}() ` + `to fix the issue.`;\n },\n\n 'max-entries-or-age-required': ({ moduleName, className, funcName }) => {\n return `You must define either config.maxEntries or config.maxAgeSeconds` + `in ${moduleName}.${className}.${funcName}`;\n },\n\n 'statuses-or-headers-required': ({ moduleName, className, funcName }) => {\n return `You must define either config.statuses or config.headers` + `in ${moduleName}.${className}.${funcName}`;\n },\n\n 'invalid-string': ({ moduleName, className, funcName, paramName }) => {\n if (!paramName || !moduleName || !className || !funcName) {\n throw new Error(`Unexpected input to 'invalid-string' error.`);\n }\n return `When using strings, the '${paramName}' parameter must start with ` + `'http' (for cross-origin matches) or '/' (for same-origin matches). ` + `Please see the docs for ${moduleName}.${className}.${funcName}() for ` + `more info.`;\n },\n 'channel-name-required': () => {\n return `You must provide a channelName to construct a ` + `BroadcastCacheUpdate instance.`;\n },\n 'invalid-responses-are-same-args': () => {\n return `The arguments passed into responsesAreSame() appear to be ` + `invalid. Please ensure valid Responses are used.`;\n },\n 'expire-custom-caches-only': () => {\n return `You must provide a 'cacheName' property when using the ` + `expiration plugin with a runtime caching strategy.`;\n },\n 'unit-must-be-bytes': ({ normalizedRangeHeader }) => {\n if (!normalizedRangeHeader) {\n throw new Error(`Unexpected input to 'unit-must-be-bytes' error.`);\n }\n return `The 'unit' portion of the Range header must be set to 'bytes'. ` + `The Range header provided was \"${normalizedRangeHeader}\"`;\n },\n 'single-range-only': ({ normalizedRangeHeader }) => {\n if (!normalizedRangeHeader) {\n throw new Error(`Unexpected input to 'single-range-only' error.`);\n }\n return `Multiple ranges are not supported. Please use a single start ` + `value, and optional end value. The Range header provided was ` + `\"${normalizedRangeHeader}\"`;\n },\n 'invalid-range-values': ({ normalizedRangeHeader }) => {\n if (!normalizedRangeHeader) {\n throw new Error(`Unexpected input to 'invalid-range-values' error.`);\n }\n return `The Range header is missing both start and end values. At least ` + `one of those values is needed. The Range header provided was ` + `\"${normalizedRangeHeader}\"`;\n },\n 'no-range-header': () => {\n return `No Range header was found in the Request provided.`;\n },\n 'range-not-satisfiable': ({ size, start, end }) => {\n return `The start (${start}) and end (${end}) values in the Range are ` + `not satisfiable by the cached response, which is ${size} bytes.`;\n },\n 'attempt-to-cache-non-get-request': ({ url, method }) => {\n return `Unable to cache '${url}' because it is a '${method}' request and ` + `only 'GET' requests can be cached.`;\n },\n 'cache-put-with-no-response': ({ url }) => {\n return `There was an attempt to cache '${url}' but the response was not ` + `defined.`;\n }\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const generatorFunction = (code, ...args) => {\n const message = messages[code];\n if (!message) {\n throw new Error(`Unable to find message for code '${code}'.`);\n }\n\n return message(...args);\n };\n\n const exportedValue = generatorFunction;\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Workbox errors should be thrown with this class.\n * This allows use to ensure the type easily in tests,\n * helps developers identify errors from workbox\n * easily and allows use to optimise error\n * messages correctly.\n *\n * @private\n */\n class WorkboxError extends Error {\n /**\n *\n * @param {string} errorCode The error code that\n * identifies this particular error.\n * @param {Object=} details Any relevant arguments\n * that will help developers identify issues should\n * be added as a key on the context object.\n */\n constructor(errorCode, details) {\n let message = exportedValue(errorCode, details);\n\n super(message);\n\n this.name = errorCode;\n this.details = details;\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n * This method returns true if the current context is a service worker.\n */\n const isSwEnv = moduleName => {\n if (!('ServiceWorkerGlobalScope' in self)) {\n throw new WorkboxError('not-in-sw', { moduleName });\n }\n };\n\n /*\n * This method throws if the supplied value is not an array.\n * The destructed values are required to produce a meaningful error for users.\n * The destructed and restructured object is so it's clear what is\n * needed.\n */\n const isArray = (value, { moduleName, className, funcName, paramName }) => {\n if (!Array.isArray(value)) {\n throw new WorkboxError('not-an-array', {\n moduleName,\n className,\n funcName,\n paramName\n });\n }\n };\n\n const hasMethod = (object, expectedMethod, { moduleName, className, funcName, paramName }) => {\n const type = typeof object[expectedMethod];\n if (type !== 'function') {\n throw new WorkboxError('missing-a-method', { paramName, expectedMethod,\n moduleName, className, funcName });\n }\n };\n\n const isType = (object, expectedType, { moduleName, className, funcName, paramName }) => {\n if (typeof object !== expectedType) {\n throw new WorkboxError('incorrect-type', { paramName, expectedType,\n moduleName, className, funcName });\n }\n };\n\n const isInstance = (object, expectedClass, { moduleName, className, funcName,\n paramName, isReturnValueProblem }) => {\n if (!(object instanceof expectedClass)) {\n throw new WorkboxError('incorrect-class', { paramName, expectedClass,\n moduleName, className, funcName, isReturnValueProblem });\n }\n };\n\n const isOneOf = (value, validValues, { paramName }) => {\n if (!validValues.includes(value)) {\n throw new WorkboxError('invalid-value', {\n paramName,\n value,\n validValueDescription: `Valid values are ${JSON.stringify(validValues)}.`\n });\n }\n };\n\n const isArrayOfClass = (value, expectedClass, { moduleName, className, funcName, paramName }) => {\n const error = new WorkboxError('not-array-of-class', {\n value, expectedClass,\n moduleName, className, funcName, paramName\n });\n if (!Array.isArray(value)) {\n throw error;\n }\n\n for (let item of value) {\n if (!(item instanceof expectedClass)) {\n throw error;\n }\n }\n };\n\n const finalAssertExports = {\n hasMethod,\n isArray,\n isInstance,\n isOneOf,\n isSwEnv,\n isType,\n isArrayOfClass\n };\n\n /**\n * Runs all of the callback functions, one at a time sequentially, in the order\n * in which they were registered.\n *\n * @memberof workbox.core\n * @private\n */\n let executeQuotaErrorCallbacks = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* () {\n {\n defaultExport.log(`About to run ${callbacks.size} callbacks to clean up caches.`);\n }\n\n for (const callback of callbacks) {\n yield callback();\n {\n defaultExport.log(callback, 'is complete.');\n }\n }\n\n {\n defaultExport.log('Finished running callbacks.');\n }\n });\n\n return function executeQuotaErrorCallbacks() {\n return _ref.apply(this, arguments);\n };\n })();\n\n const callbacks = new Set();\n\n /**\n * Adds a function to the set of callbacks that will be executed when there's\n * a quota error.\n *\n * @param {Function} callback\n * @memberof workbox.core\n */\n function registerQuotaErrorCallback(callback) {\n {\n finalAssertExports.isType(callback, 'function', {\n moduleName: 'workbox-core',\n funcName: 'register',\n paramName: 'callback'\n });\n }\n\n callbacks.add(callback);\n\n {\n defaultExport.log('Registered a callback to respond to quota errors.', callback);\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * A class that wraps common IndexedDB functionality in a promise-based API.\n * It exposes all the underlying power and functionality of IndexedDB, but\n * wraps the most commonly used features in a way that's much simpler to use.\n *\n * @private\n */\n class DBWrapper {\n /**\n * @param {string} name\n * @param {number} version\n * @param {Object=} [callback]\n * @param {function(this:DBWrapper, Event)} [callbacks.onupgradeneeded]\n * @param {function(this:DBWrapper, Event)} [callbacks.onversionchange]\n * Defaults to DBWrapper.prototype._onversionchange when not specified.\n */\n constructor(name, version, {\n onupgradeneeded,\n onversionchange = this._onversionchange\n } = {}) {\n this._name = name;\n this._version = version;\n this._onupgradeneeded = onupgradeneeded;\n this._onversionchange = onversionchange;\n\n // If this is null, it means the database isn't open.\n this._db = null;\n }\n\n /**\n * Opens a connected to an IDBDatabase, invokes any onupgradedneeded\n * callback, and added an onversionchange callback to the database.\n *\n * @return {IDBDatabase}\n *\n * @private\n */\n open() {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (_this._db) return;\n\n _this._db = yield new Promise(function (resolve, reject) {\n // This flag is flipped to true if the timeout callback runs prior\n // to the request failing or succeeding. Note: we use a timeout instead\n // of an onblocked handler since there are cases where onblocked will\n // never never run. A timeout better handles all possible scenarios:\n // https://github.com/w3c/IndexedDB/issues/223\n let openRequestTimedOut = false;\n setTimeout(function () {\n openRequestTimedOut = true;\n reject(new Error('The open request was blocked and timed out'));\n }, _this.OPEN_TIMEOUT);\n\n const openRequest = indexedDB.open(_this._name, _this._version);\n openRequest.onerror = function (evt) {\n return reject(openRequest.error);\n };\n openRequest.onupgradeneeded = function (evt) {\n if (openRequestTimedOut) {\n openRequest.transaction.abort();\n evt.target.result.close();\n } else if (_this._onupgradeneeded) {\n _this._onupgradeneeded(evt);\n }\n };\n openRequest.onsuccess = function (evt) {\n const db = evt.target.result;\n if (openRequestTimedOut) {\n db.close();\n } else {\n db.onversionchange = _this._onversionchange;\n resolve(db);\n }\n };\n });\n\n return _this;\n })();\n }\n\n /**\n * Delegates to the native `get()` method for the object store.\n *\n * @param {string} storeName The name of the object store to put the value.\n * @param {...*} args The values passed to the delegated method.\n * @return {*} The key of the entry.\n *\n * @private\n */\n get(storeName, ...args) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this2._call('get', storeName, 'readonly', ...args);\n })();\n }\n\n /**\n * Delegates to the native `add()` method for the object store.\n *\n * @param {string} storeName The name of the object store to put the value.\n * @param {...*} args The values passed to the delegated method.\n * @return {*} The key of the entry.\n *\n * @private\n */\n add(storeName, ...args) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this3._call('add', storeName, 'readwrite', ...args);\n })();\n }\n\n /**\n * Delegates to the native `put()` method for the object store.\n *\n * @param {string} storeName The name of the object store to put the value.\n * @param {...*} args The values passed to the delegated method.\n * @return {*} The key of the entry.\n *\n * @private\n */\n put(storeName, ...args) {\n var _this4 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this4._call('put', storeName, 'readwrite', ...args);\n })();\n }\n\n /**\n * Delegates to the native `delete()` method for the object store.\n *\n * @param {string} storeName\n * @param {...*} args The values passed to the delegated method.\n *\n * @private\n */\n delete(storeName, ...args) {\n var _this5 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this5._call('delete', storeName, 'readwrite', ...args);\n })();\n }\n\n /**\n * Deletes the underlying database, ensuring that any open connections are\n * closed first.\n *\n * @private\n */\n deleteDatabase() {\n var _this6 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n _this6.close();\n _this6._db = null;\n yield new Promise(function (resolve, reject) {\n const request = indexedDB.deleteDatabase(_this6._name);\n request.onerror = function (evt) {\n return reject(evt.target.error);\n };\n request.onblocked = function () {\n return reject(new Error('Deletion was blocked.'));\n };\n request.onsuccess = function () {\n return resolve();\n };\n });\n })();\n }\n\n /**\n * Delegates to the native `getAll()` or polyfills it via the `find()`\n * method in older browsers.\n *\n * @param {string} storeName\n * @param {*} query\n * @param {number} count\n * @return {Array}\n *\n * @private\n */\n getAll(storeName, query, count) {\n var _this7 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if ('getAll' in IDBObjectStore.prototype) {\n return yield _this7._call('getAll', storeName, 'readonly', query, count);\n } else {\n return yield _this7.getAllMatching(storeName, { query, count });\n }\n })();\n }\n\n /**\n * Supports flexible lookup in an object store by specifying an index,\n * query, direction, and count. This method returns an array of objects\n * with the signature .\n *\n * @param {string} storeName\n * @param {Object} [opts]\n * @param {IDBCursorDirection} [opts.direction]\n * @param {*} [opts.query]\n * @param {string} [opts.index] The index to use (if specified).\n * @param {number} [opts.count] The max number of results to return.\n * @param {boolean} [opts.includeKeys] When true, the structure of the\n * returned objects is changed from an array of values to an array of\n * objects in the form {key, primaryKey, value}.\n * @return {Array}\n *\n * @private\n */\n getAllMatching(storeName, opts = {}) {\n var _this8 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this8.transaction([storeName], 'readonly', function (stores, done) {\n const store = stores[storeName];\n const target = opts.index ? store.index(opts.index) : store;\n const results = [];\n\n // Passing `undefined` arguments to Edge's `openCursor(...)` causes\n // 'DOMException: DataError'\n // Details in issue: https://github.com/GoogleChrome/workbox/issues/1509\n const query = opts.query || null;\n const direction = opts.direction || 'next';\n target.openCursor(query, direction).onsuccess = function (evt) {\n const cursor = evt.target.result;\n if (cursor) {\n const { primaryKey, key, value } = cursor;\n results.push(opts.includeKeys ? { primaryKey, key, value } : value);\n if (opts.count && results.length >= opts.count) {\n done(results);\n } else {\n cursor.continue();\n }\n } else {\n done(results);\n }\n };\n });\n })();\n }\n\n /**\n * Accepts a list of stores, a transaction type, and a callback and\n * performs a transaction. A promise is returned that resolves to whatever\n * value the callback chooses. The callback holds all the transaction logic\n * and is invoked with three arguments:\n * 1. An object mapping object store names to IDBObjectStore values.\n * 2. A `done` function, that's used to resolve the promise when\n * when the transaction is done.\n * 3. An `abort` function that can be called to abort the transaction\n * at any time.\n *\n * @param {Array<string>} storeNames An array of object store names\n * involved in the transaction.\n * @param {string} type Can be `readonly` or `readwrite`.\n * @param {function(Object, function(), function(*)):?IDBRequest} callback\n * @return {*} The result of the transaction ran by the callback.\n *\n * @private\n */\n transaction(storeNames, type, callback) {\n var _this9 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this9.open();\n const result = yield new Promise(function (resolve, reject) {\n const txn = _this9._db.transaction(storeNames, type);\n const done = function (value) {\n return resolve(value);\n };\n const abort = function () {\n reject(new Error('The transaction was manually aborted'));\n txn.abort();\n };\n txn.onerror = function (evt) {\n return reject(evt.target.error);\n };\n txn.onabort = function (evt) {\n return reject(evt.target.error);\n };\n txn.oncomplete = function () {\n return resolve();\n };\n\n const stores = {};\n for (const storeName of storeNames) {\n stores[storeName] = txn.objectStore(storeName);\n }\n callback(stores, done, abort);\n });\n return result;\n })();\n }\n\n /**\n * Delegates async to a native IDBObjectStore method.\n *\n * @param {string} method The method name.\n * @param {string} storeName The object store name.\n * @param {string} type Can be `readonly` or `readwrite`.\n * @param {...*} args The list of args to pass to the native method.\n * @return {*} The result of the transaction.\n *\n * @private\n */\n _call(method, storeName, type, ...args) {\n var _this10 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this10.open();\n const callback = function (stores, done) {\n stores[storeName][method](...args).onsuccess = function (evt) {\n done(evt.target.result);\n };\n };\n\n return yield _this10.transaction([storeName], type, callback);\n })();\n }\n\n /**\n * The default onversionchange handler, which closes the database so other\n * connections can open without being blocked.\n *\n * @param {Event} evt\n *\n * @private\n */\n _onversionchange(evt) {\n this.close();\n }\n\n /**\n * Closes the connection opened by `DBWrapper.open()`. Generally this method\n * doesn't need to be called since:\n * 1. It's usually better to keep a connection open since opening\n * a new connection is somewhat slow.\n * 2. Connections are automatically closed when the reference is\n * garbage collected.\n * The primary use case for needing to close a connection is when another\n * reference (typically in another tab) needs to upgrade it and would be\n * blocked by the current, open connection.\n *\n * @private\n */\n close() {\n if (this._db) this._db.close();\n }\n }\n\n // Exposed to let users modify the default timeout on a per-instance\n // or global basis.\n DBWrapper.prototype.OPEN_TIMEOUT = 2000;\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const _cacheNameDetails = {\n prefix: 'workbox',\n suffix: self.registration.scope,\n googleAnalytics: 'googleAnalytics',\n precache: 'precache',\n runtime: 'runtime'\n };\n\n const _createCacheName = cacheName => {\n return [_cacheNameDetails.prefix, cacheName, _cacheNameDetails.suffix].filter(value => value.length > 0).join('-');\n };\n\n const cacheNames = {\n updateDetails: details => {\n Object.keys(_cacheNameDetails).forEach(key => {\n if (typeof details[key] !== 'undefined') {\n _cacheNameDetails[key] = details[key];\n }\n });\n },\n getGoogleAnalyticsName: userCacheName => {\n return userCacheName || _createCacheName(_cacheNameDetails.googleAnalytics);\n },\n getPrecacheName: userCacheName => {\n return userCacheName || _createCacheName(_cacheNameDetails.precache);\n },\n getRuntimeName: userCacheName => {\n return userCacheName || _createCacheName(_cacheNameDetails.runtime);\n }\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var pluginEvents = {\n CACHE_DID_UPDATE: 'cacheDidUpdate',\n CACHE_WILL_UPDATE: 'cacheWillUpdate',\n CACHED_RESPONSE_WILL_BE_USED: 'cachedResponseWillBeUsed',\n FETCH_DID_FAIL: 'fetchDidFail',\n REQUEST_WILL_FETCH: 'requestWillFetch'\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var pluginUtils = {\n filter: (plugins, callbackname) => {\n return plugins.filter(plugin => callbackname in plugin);\n }\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const getFriendlyURL = url => {\n const urlObj = new URL(url, location);\n if (urlObj.origin === location.origin) {\n return urlObj.pathname;\n }\n return urlObj.href;\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Wrapper around cache.put().\n *\n * Will call `cacheDidUpdate` on plugins if the cache was updated.\n *\n * @param {Object} options\n * @param {string} options.cacheName\n * @param {Request} options.request\n * @param {Response} options.response\n * @param {Event} [options.event]\n * @param {Array<Object>} [options.plugins=[]]\n *\n * @private\n * @memberof module:workbox-core\n */\n const putWrapper = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* ({\n cacheName,\n request,\n response,\n event,\n plugins = []\n } = {}) {\n if (!response) {\n {\n defaultExport.error(`Cannot cache non-existent response for ` + `'${getFriendlyURL(request.url)}'.`);\n }\n\n throw new WorkboxError('cache-put-with-no-response', {\n url: getFriendlyURL(request.url)\n });\n }\n\n let responseToCache = yield _isResponseSafeToCache({ request, response, event, plugins });\n\n if (!responseToCache) {\n {\n defaultExport.debug(`Response '${getFriendlyURL(request.url)}' will not be ` + `cached.`, responseToCache);\n }\n return;\n }\n\n {\n if (responseToCache.method && responseToCache.method !== 'GET') {\n throw new WorkboxError('attempt-to-cache-non-get-request', {\n url: getFriendlyURL(request.url),\n method: responseToCache.method\n });\n }\n }\n\n const cache = yield caches.open(cacheName);\n\n const updatePlugins = pluginUtils.filter(plugins, pluginEvents.CACHE_DID_UPDATE);\n\n let oldResponse = updatePlugins.length > 0 ? yield matchWrapper({ cacheName, request }) : null;\n\n {\n defaultExport.debug(`Updating the '${cacheName}' cache with a new Response for ` + `${getFriendlyURL(request.url)}.`);\n }\n\n try {\n yield cache.put(request, responseToCache);\n } catch (error) {\n // See https://developer.mozilla.org/en-US/docs/Web/API/DOMException#exception-QuotaExceededError\n if (error.name === 'QuotaExceededError') {\n yield executeQuotaErrorCallbacks();\n }\n throw error;\n }\n\n for (let plugin of updatePlugins) {\n yield plugin[pluginEvents.CACHE_DID_UPDATE].call(plugin, {\n cacheName,\n request,\n event,\n oldResponse,\n newResponse: responseToCache\n });\n }\n });\n\n return function putWrapper() {\n return _ref.apply(this, arguments);\n };\n })();\n\n /**\n * This is a wrapper around cache.match().\n *\n * @param {Object} options\n * @param {string} options.cacheName Name of the cache to match against.\n * @param {Request} options.request The Request that will be used to look up\n *. cache entries.\n * @param {Event} [options.event] The event that propted the action.\n * @param {Object} [options.matchOptions] Options passed to cache.match().\n * @param {Array<Object>} [options.plugins=[]] Array of plugins.\n * @return {Response} A cached response if available.\n *\n * @private\n * @memberof module:workbox-core\n */\n const matchWrapper = (() => {\n var _ref2 = babelHelpers.asyncToGenerator(function* ({\n cacheName,\n request,\n event,\n matchOptions,\n plugins = [] }) {\n const cache = yield caches.open(cacheName);\n let cachedResponse = yield cache.match(request, matchOptions);\n {\n if (cachedResponse) {\n defaultExport.debug(`Found a cached response in '${cacheName}'.`);\n } else {\n defaultExport.debug(`No cached response found in '${cacheName}'.`);\n }\n }\n for (let plugin of plugins) {\n if (pluginEvents.CACHED_RESPONSE_WILL_BE_USED in plugin) {\n cachedResponse = yield plugin[pluginEvents.CACHED_RESPONSE_WILL_BE_USED].call(plugin, {\n cacheName,\n request,\n event,\n matchOptions,\n cachedResponse\n });\n {\n if (cachedResponse) {\n finalAssertExports.isInstance(cachedResponse, Response, {\n moduleName: 'Plugin',\n funcName: pluginEvents.CACHED_RESPONSE_WILL_BE_USED,\n isReturnValueProblem: true\n });\n }\n }\n }\n }\n return cachedResponse;\n });\n\n return function matchWrapper(_x) {\n return _ref2.apply(this, arguments);\n };\n })();\n\n /**\n * This method will call cacheWillUpdate on the available plugins (or use\n * response.ok) to determine if the Response is safe and valid to cache.\n *\n * @param {Object} options\n * @param {Request} options.request\n * @param {Response} options.response\n * @param {Event} [options.event]\n * @param {Array<Object>} [options.plugins=[]]\n * @return {Promise<Response>}\n *\n * @private\n * @memberof module:workbox-core\n */\n const _isResponseSafeToCache = (() => {\n var _ref3 = babelHelpers.asyncToGenerator(function* ({ request, response, event, plugins }) {\n let responseToCache = response;\n let pluginsUsed = false;\n for (let plugin of plugins) {\n if (pluginEvents.CACHE_WILL_UPDATE in plugin) {\n pluginsUsed = true;\n responseToCache = yield plugin[pluginEvents.CACHE_WILL_UPDATE].call(plugin, {\n request,\n response: responseToCache,\n event\n });\n\n {\n if (responseToCache) {\n finalAssertExports.isInstance(responseToCache, Response, {\n moduleName: 'Plugin',\n funcName: pluginEvents.CACHE_WILL_UPDATE,\n isReturnValueProblem: true\n });\n }\n }\n\n if (!responseToCache) {\n break;\n }\n }\n }\n\n if (!pluginsUsed) {\n {\n if (!responseToCache.ok) {\n if (responseToCache.status === 0) {\n defaultExport.warn(`The response for '${request.url}' is an opaque ` + `response. The caching strategy that you're using will not ` + `cache opaque responses by default.`);\n } else {\n defaultExport.debug(`The response for '${request.url}' returned ` + `a status code of '${response.status}' and won't be cached as a ` + `result.`);\n }\n }\n }\n responseToCache = responseToCache.ok ? responseToCache : null;\n }\n\n return responseToCache ? responseToCache : null;\n });\n\n return function _isResponseSafeToCache(_x2) {\n return _ref3.apply(this, arguments);\n };\n })();\n\n const cacheWrapper = {\n put: putWrapper,\n match: matchWrapper\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Wrapper around the fetch API.\n *\n * Will call requestWillFetch on available plugins.\n *\n * @param {Object} options\n * @param {Request|string} options.request\n * @param {Object} [options.fetchOptions]\n * @param {Event} [options.event]\n * @param {Array<Object>} [options.plugins=[]]\n * @return {Promise<Response>}\n *\n * @private\n * @memberof module:workbox-core\n */\n const wrappedFetch = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* ({\n request,\n fetchOptions,\n event,\n plugins = [] }) {\n // We *should* be able to call `await event.preloadResponse` even if it's\n // undefined, but for some reason, doing so leads to errors in our Node unit\n // tests. To work around that, explicitly check preloadResponse's value first.\n if (event && event.preloadResponse) {\n const possiblePreloadResponse = yield event.preloadResponse;\n if (possiblePreloadResponse) {\n {\n defaultExport.log(`Using a preloaded navigation response for ` + `'${getFriendlyURL(request.url)}'`);\n }\n return possiblePreloadResponse;\n }\n }\n\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n finalAssertExports.isInstance(request, Request, {\n paramName: request,\n expectedClass: 'Request',\n moduleName: 'workbox-core',\n className: 'fetchWrapper',\n funcName: 'wrappedFetch'\n });\n }\n\n const failedFetchPlugins = pluginUtils.filter(plugins, pluginEvents.FETCH_DID_FAIL);\n\n // If there is a fetchDidFail plugin, we need to save a clone of the\n // original request before it's either modified by a requestWillFetch\n // plugin or before the original request's body is consumed via fetch().\n const originalRequest = failedFetchPlugins.length > 0 ? request.clone() : null;\n\n try {\n for (let plugin of plugins) {\n if (pluginEvents.REQUEST_WILL_FETCH in plugin) {\n request = yield plugin[pluginEvents.REQUEST_WILL_FETCH].call(plugin, {\n request: request.clone(),\n event\n });\n\n {\n if (request) {\n finalAssertExports.isInstance(request, Request, {\n moduleName: 'Plugin',\n funcName: pluginEvents.CACHED_RESPONSE_WILL_BE_USED,\n isReturnValueProblem: true\n });\n }\n }\n }\n }\n } catch (err) {\n throw new WorkboxError('plugin-error-request-will-fetch', {\n thrownError: err\n });\n }\n\n // The request can be altered by plugins with `requestWillFetch` making\n // the original request (Most likely from a `fetch` event) to be different\n // to the Request we make. Pass both to `fetchDidFail` to aid debugging.\n const pluginFilteredRequest = request.clone();\n\n try {\n const fetchResponse = yield fetch(request, fetchOptions);\n {\n defaultExport.debug(`Network request for ` + `'${getFriendlyURL(request.url)}' returned a response with ` + `status '${fetchResponse.status}'.`);\n }\n return fetchResponse;\n } catch (error) {\n {\n defaultExport.error(`Network request for ` + `'${getFriendlyURL(request.url)}' threw an error.`, error);\n }\n\n for (let plugin of failedFetchPlugins) {\n yield plugin[pluginEvents.FETCH_DID_FAIL].call(plugin, {\n error,\n event,\n originalRequest: originalRequest.clone(),\n request: pluginFilteredRequest.clone()\n });\n }\n\n throw error;\n }\n });\n\n return function wrappedFetch(_x) {\n return _ref.apply(this, arguments);\n };\n })();\n\n const fetchWrapper = {\n fetch: wrappedFetch\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var _private = /*#__PURE__*/Object.freeze({\n DBWrapper: DBWrapper,\n WorkboxError: WorkboxError,\n assert: finalAssertExports,\n cacheNames: cacheNames,\n cacheWrapper: cacheWrapper,\n fetchWrapper: fetchWrapper,\n getFriendlyURL: getFriendlyURL,\n logger: defaultExport\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Logs a warning to the user recommending changing\n * to max-age=0 or no-cache.\n *\n * @param {string} cacheControlHeader\n *\n * @private\n */\n function showWarning(cacheControlHeader) {\n const docsUrl = 'https://developers.google.com/web/tools/workbox/guides/service-worker-checklist#cache-control_of_your_service_worker_file';\n defaultExport.warn(`You are setting a 'cache-control' header of ` + `'${cacheControlHeader}' on your service worker file. This should be ` + `set to 'max-age=0' or 'no-cache' to ensure the latest service worker ` + `is served to your users. Learn more here: ${docsUrl}`);\n }\n\n /**\n * Checks for cache-control header on SW file and\n * warns the developer if it exists with a value\n * other than max-age=0 or no-cache.\n *\n * @return {Promise}\n * @private\n */\n function checkSWFileCacheHeaders() {\n // This is wrapped as an iife to allow async/await while making\n // rollup exclude it in builds.\n return babelHelpers.asyncToGenerator(function* () {\n try {\n const swFile = self.location.href;\n const response = yield fetch(swFile);\n if (!response.ok) {\n // Response failed so nothing we can check;\n return;\n }\n\n if (!response.headers.has('cache-control')) {\n // No cache control header.\n return;\n }\n\n const cacheControlHeader = response.headers.get('cache-control');\n const maxAgeResult = /max-age\\s*=\\s*(\\d*)/g.exec(cacheControlHeader);\n if (maxAgeResult) {\n if (parseInt(maxAgeResult[1], 10) === 0) {\n return;\n }\n }\n\n if (cacheControlHeader.indexOf('no-cache') !== -1) {\n return;\n }\n\n if (cacheControlHeader.indexOf('no-store') !== -1) {\n return;\n }\n\n showWarning(cacheControlHeader);\n } catch (err) {\n // NOOP\n }\n })();\n }\n\n const finalCheckSWFileCacheHeaders = checkSWFileCacheHeaders;\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * This class is never exposed publicly. Inidividual methods are exposed\n * using jsdoc alias commands.\n *\n * @memberof workbox.core\n * @private\n */\n class WorkboxCore {\n /**\n * You should not instantiate this object directly.\n *\n * @private\n */\n constructor() {\n // Give our version strings something to hang off of.\n try {\n self.workbox.v = self.workbox.v || {};\n } catch (err) {}\n // NOOP\n\n\n // A WorkboxCore instance must be exported before we can use the logger.\n // This is so it can get the current log level.\n {\n const padding = ' ';\n defaultExport.groupCollapsed('Welcome to Workbox!');\n defaultExport.unprefixed.log(`You are currently using a development build. ` + `By default this will switch to prod builds when not on localhost. ` + `You can force this with workbox.setConfig({debug: true|false}).`);\n defaultExport.unprefixed.log(`📖 Read the guides and documentation\\n` + `${padding}https://developers.google.com/web/tools/workbox/`);\n defaultExport.unprefixed.log(`❓ Use the [workbox] tag on Stack Overflow to ask questions\\n` + `${padding}https://stackoverflow.com/questions/ask?tags=workbox`);\n defaultExport.unprefixed.log(`🐛 Found a bug? Report it on GitHub\\n` + `${padding}https://github.com/GoogleChrome/workbox/issues/new`);\n defaultExport.groupEnd();\n\n if (typeof finalCheckSWFileCacheHeaders === 'function') {\n finalCheckSWFileCacheHeaders();\n }\n }\n }\n\n /**\n * Get the current cache names used by Workbox.\n *\n * `cacheNames.precache` is used for precached assets,\n * `cacheNames.googleAnalytics` is used by `workbox-google-analytics` to\n * store `analytics.js`,\n * and `cacheNames.runtime` is used for everything else.\n *\n * @return {Object} An object with `precache` and `runtime` cache names.\n *\n * @alias workbox.core.cacheNames\n */\n get cacheNames() {\n return {\n googleAnalytics: cacheNames.getGoogleAnalyticsName(),\n precache: cacheNames.getPrecacheName(),\n runtime: cacheNames.getRuntimeName()\n };\n }\n\n /**\n * You can alter the default cache names used by the Workbox modules by\n * changing the cache name details.\n *\n * Cache names are generated as `<prefix>-<Cache Name>-<suffix>`.\n *\n * @param {Object} details\n * @param {Object} details.prefix The string to add to the beginning of\n * the precache and runtime cache names.\n * @param {Object} details.suffix The string to add to the end of\n * the precache and runtime cache names.\n * @param {Object} details.precache The cache name to use for precache\n * caching.\n * @param {Object} details.runtime The cache name to use for runtime caching.\n * @param {Object} details.googleAnalytics The cache name to use for\n * `workbox-google-analytics` caching.\n *\n * @alias workbox.core.setCacheNameDetails\n */\n setCacheNameDetails(details) {\n {\n Object.keys(details).forEach(key => {\n finalAssertExports.isType(details[key], 'string', {\n moduleName: 'workbox-core',\n className: 'WorkboxCore',\n funcName: 'setCacheNameDetails',\n paramName: `details.${key}`\n });\n });\n\n if ('precache' in details && details.precache.length === 0) {\n throw new WorkboxError('invalid-cache-name', {\n cacheNameId: 'precache',\n value: details.precache\n });\n }\n\n if ('runtime' in details && details.runtime.length === 0) {\n throw new WorkboxError('invalid-cache-name', {\n cacheNameId: 'runtime',\n value: details.runtime\n });\n }\n\n if ('googleAnalytics' in details && details.googleAnalytics.length === 0) {\n throw new WorkboxError('invalid-cache-name', {\n cacheNameId: 'googleAnalytics',\n value: details.googleAnalytics\n });\n }\n }\n\n cacheNames.updateDetails(details);\n }\n\n /**\n * Get the current log level.\n *\n * @return {number}.\n *\n * @alias workbox.core.logLevel\n */\n get logLevel() {\n return getLoggerLevel();\n }\n\n /**\n * Set the current log level passing in one of the values from\n * [LOG_LEVELS]{@link module:workbox-core.LOG_LEVELS}.\n *\n * @param {number} newLevel The new log level to use.\n *\n * @alias workbox.core.setLogLevel\n */\n setLogLevel(newLevel) {\n {\n finalAssertExports.isType(newLevel, 'number', {\n moduleName: 'workbox-core',\n className: 'WorkboxCore',\n funcName: 'logLevel [setter]',\n paramName: `logLevel`\n });\n }\n\n if (newLevel > LOG_LEVELS.silent || newLevel < LOG_LEVELS.debug) {\n throw new WorkboxError('invalid-value', {\n paramName: 'logLevel',\n validValueDescription: `Please use a value from LOG_LEVELS, i.e ` + `'logLevel = workbox.core.LOG_LEVELS.debug'.`,\n value: newLevel\n });\n }\n\n setLoggerLevel(newLevel);\n }\n }\n\n var defaultExport$1 = new WorkboxCore();\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const finalExports = Object.assign(defaultExport$1, {\n _private,\n LOG_LEVELS,\n registerQuotaErrorCallback\n });\n\n return finalExports;\n\n}());\n"],"file":"workbox-core.dev.js"}
@@ -1,3 +1,3 @@
1
- self.babelHelpers={asyncToGenerator:function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(o,i){try{var c=t[o](i),l=c.value}catch(e){return void r(e)}if(!c.done)return Promise.resolve(l).then(function(e){n("next",e)},function(e){n("throw",e)});e(l)}("next")})}}},this.workbox=this.workbox||{},this.workbox.core=function(){"use strict";try{self.workbox.v["workbox:core:3.6.2"]=1}catch(e){}var e={debug:0,log:1,warn:2,error:3,silent:4};const t=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);let r=(()=>e.warn)();const n=e=>r<=e,o=e=>r=e,i=()=>r,c=e.error,l=function(r,o,i){const l=0===r.indexOf("group")?c:e[r];if(!n(l))return;if(!i||"groupCollapsed"===r&&t)return void console[r](...o);const s=["%cworkbox",`background: ${i}; color: white; padding: 2px 0.5em; `+"border-radius: 0.5em;"];console[r](...s,...o)},s=()=>{n(c)&&console.groupEnd()},u={groupEnd:s,unprefixed:{groupEnd:s}},a={debug:"#7f8c8d",log:"#2ecc71",warn:"#f39c12",error:"#c0392b",groupCollapsed:"#3498db"};var f,d;Object.keys(a).forEach(e=>(e=e,d=a[e],u[e]=((...t)=>l(e,t,d)),void(u.unprefixed[e]=((...t)=>l(e,t)))));const h=(e,...t)=>{let r=e;return t.length>0&&(r+=` :: ${JSON.stringify(t)}`),r};class p extends Error{constructor(e,t){super(h(e,t)),this.name=e,this.details=t}}let b=(y=babelHelpers.asyncToGenerator(function*(){for(const e of g)yield e()}),function(){return y.apply(this,arguments)});var y;const g=new Set;class v{constructor(e,t,{onupgradeneeded:r,onversionchange:n=this.e}={}){this.t=e,this.r=t,this.n=r,this.e=n,this.o=null}open(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(!e.o)return e.o=yield new Promise(function(t,r){let n=!1;setTimeout(function(){n=!0,r(new Error("The open request was blocked and timed out"))},e.OPEN_TIMEOUT);const o=indexedDB.open(e.t,e.r);o.onerror=function(e){return r(o.error)},o.onupgradeneeded=function(t){n?(o.transaction.abort(),t.target.result.close()):e.n&&e.n(t)},o.onsuccess=function(r){const o=r.target.result;n?o.close():(o.onversionchange=e.e,t(o))}}),e})()}get(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i("get",e,"readonly",...t)})()}add(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i("add",e,"readwrite",...t)})()}put(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i("put",e,"readwrite",...t)})()}delete(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){yield r.i("delete",e,"readwrite",...t)})()}deleteDatabase(){var e=this;return babelHelpers.asyncToGenerator(function*(){e.close(),e.o=null,yield new Promise(function(t,r){const n=indexedDB.deleteDatabase(e.t);n.onerror=function(e){return r(e.target.error)},n.onblocked=function(){return r(new Error("Deletion was blocked."))},n.onsuccess=function(){return t()}})})()}getAll(e,t,r){var n=this;return babelHelpers.asyncToGenerator(function*(){return"getAll"in IDBObjectStore.prototype?yield n.i("getAll",e,"readonly",t,r):yield n.getAllMatching(e,{query:t,count:r})})()}getAllMatching(e,t={}){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.transaction([e],"readonly",function(r,n){const o=r[e],i=t.index?o.index(t.index):o,c=[],l=t.query||null,s=t.direction||"next";i.openCursor(l,s).onsuccess=function(e){const r=e.target.result;if(r){const{primaryKey:e,key:o,value:i}=r;c.push(t.includeKeys?{primaryKey:e,key:o,value:i}:i),t.count&&c.length>=t.count?n(c):r.continue()}else n(c)}})})()}transaction(e,t,r){var n=this;return babelHelpers.asyncToGenerator(function*(){return yield n.open(),yield new Promise(function(o,i){const c=n.o.transaction(e,t);c.onerror=function(e){return i(e.target.error)},c.onabort=function(e){return i(e.target.error)},c.oncomplete=function(){return o()};const l={};for(const t of e)l[t]=c.objectStore(t);r(l,function(e){return o(e)},function(){i(new Error("The transaction was manually aborted")),c.abort()})})})()}i(e,t,r,...n){var o=this;return babelHelpers.asyncToGenerator(function*(){yield o.open();return yield o.transaction([t],r,function(r,o){r[t][e](...n).onsuccess=function(e){o(e.target.result)}})})()}e(e){this.close()}close(){this.o&&this.o.close()}}v.prototype.OPEN_TIMEOUT=2e3;const w={prefix:"workbox",suffix:self.registration.scope,googleAnalytics:"googleAnalytics",precache:"precache",runtime:"runtime"},m=e=>[w.prefix,e,w.suffix].filter(e=>e.length>0).join("-"),q={updateDetails:e=>{Object.keys(w).forEach(t=>{void 0!==e[t]&&(w[t]=e[t])})},getGoogleAnalyticsName:e=>e||m(w.googleAnalytics),getPrecacheName:e=>e||m(w.precache),getRuntimeName:e=>e||m(w.runtime)};var E="cacheDidUpdate",L="cacheWillUpdate",x="cachedResponseWillBeUsed",H="fetchDidFail",N="requestWillFetch",O=(e,t)=>e.filter(e=>t in e);const k=e=>{const t=new URL(e,location);return t.origin===location.origin?t.pathname:t.href},D=(()=>{var e=babelHelpers.asyncToGenerator(function*({cacheName:e,request:t,response:r,event:n,plugins:o=[]}={}){if(!r)throw new p("cache-put-with-no-response",{url:k(t.url)});let i=yield P({request:t,response:r,event:n,plugins:o});if(!i)return;const c=yield caches.open(e),l=O(o,E);let s=l.length>0?yield R({cacheName:e,request:t}):null;try{yield c.put(t,i)}catch(e){throw"QuotaExceededError"===e.name&&(yield b()),e}for(let r of l)yield r[E].call(r,{cacheName:e,request:t,event:n,oldResponse:s,newResponse:i})});return function(){return e.apply(this,arguments)}})(),R=(A=babelHelpers.asyncToGenerator(function*({cacheName:e,request:t,event:r,matchOptions:n,plugins:o=[]}){let i=yield(yield caches.open(e)).match(t,n);for(let c of o)x in c&&(i=yield c[x].call(c,{cacheName:e,request:t,event:r,matchOptions:n,cachedResponse:i}));return i}),function(e){return A.apply(this,arguments)});var A;const P=(W=babelHelpers.asyncToGenerator(function*({request:e,response:t,event:r,plugins:n}){let o=t,i=!1;for(let t of n)if(L in t&&(i=!0,!(o=yield t[L].call(t,{request:e,response:o,event:r}))))break;return i||(o=o.ok?o:null),o||null}),function(e){return W.apply(this,arguments)});var W;const S={put:D,match:R},_={fetch:(()=>{var e=babelHelpers.asyncToGenerator(function*({request:e,fetchOptions:t,event:r,plugins:n=[]}){if(r&&r.preloadResponse){const e=yield r.preloadResponse;if(e)return e}"string"==typeof e&&(e=new Request(e));const o=O(n,H),i=o.length>0?e.clone():null;try{for(let t of n)N in t&&(e=yield t[N].call(t,{request:e.clone(),event:r}))}catch(e){throw new p("plugin-error-request-will-fetch",{thrownError:e})}const c=e.clone();try{return yield fetch(e,t)}catch(e){for(let t of o)yield t[H].call(t,{error:e,event:r,originalRequest:i.clone(),request:c.clone()});throw e}});return function(t){return e.apply(this,arguments)}})()};var j=Object.freeze({DBWrapper:v,WorkboxError:p,assert:null,cacheNames:q,cacheWrapper:S,fetchWrapper:_,getFriendlyURL:k,logger:u});var B=new class{constructor(){try{self.workbox.v=self.workbox.v||{}}catch(e){}}get cacheNames(){return{googleAnalytics:q.getGoogleAnalyticsName(),precache:q.getPrecacheName(),runtime:q.getRuntimeName()}}setCacheNameDetails(e){q.updateDetails(e)}get logLevel(){return i()}setLogLevel(t){if(t>e.silent||t<e.debug)throw new p("invalid-value",{paramName:"logLevel",validValueDescription:"Please use a value from LOG_LEVELS, i.e 'logLevel = workbox.core.LOG_LEVELS.debug'.",value:t});o(t)}};return Object.assign(B,{_private:j,LOG_LEVELS:e,registerQuotaErrorCallback:function(e){g.add(e)}})}();
1
+ self.babelHelpers={asyncToGenerator:function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(o,i){try{var c=t[o](i),l=c.value}catch(e){return void r(e)}if(!c.done)return Promise.resolve(l).then(function(e){n("next",e)},function(e){n("throw",e)});e(l)}("next")})}}},this.workbox=this.workbox||{},this.workbox.core=function(){"use strict";try{self.workbox.v["workbox:core:3.6.3"]=1}catch(e){}var e={debug:0,log:1,warn:2,error:3,silent:4};const t=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);let r=(()=>e.warn)();const n=e=>r<=e,o=e=>r=e,i=()=>r,c=e.error,l=function(r,o,i){const l=0===r.indexOf("group")?c:e[r];if(!n(l))return;if(!i||"groupCollapsed"===r&&t)return void console[r](...o);const s=["%cworkbox",`background: ${i}; color: white; padding: 2px 0.5em; `+"border-radius: 0.5em;"];console[r](...s,...o)},s=()=>{n(c)&&console.groupEnd()},u={groupEnd:s,unprefixed:{groupEnd:s}},a={debug:"#7f8c8d",log:"#2ecc71",warn:"#f39c12",error:"#c0392b",groupCollapsed:"#3498db"};var f,d;Object.keys(a).forEach(e=>(e=e,d=a[e],u[e]=((...t)=>l(e,t,d)),void(u.unprefixed[e]=((...t)=>l(e,t)))));const h=(e,...t)=>{let r=e;return t.length>0&&(r+=` :: ${JSON.stringify(t)}`),r};class p extends Error{constructor(e,t){super(h(e,t)),this.name=e,this.details=t}}let b=(y=babelHelpers.asyncToGenerator(function*(){for(const e of g)yield e()}),function(){return y.apply(this,arguments)});var y;const g=new Set;class v{constructor(e,t,{onupgradeneeded:r,onversionchange:n=this.e}={}){this.t=e,this.r=t,this.n=r,this.e=n,this.o=null}open(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(!e.o)return e.o=yield new Promise(function(t,r){let n=!1;setTimeout(function(){n=!0,r(new Error("The open request was blocked and timed out"))},e.OPEN_TIMEOUT);const o=indexedDB.open(e.t,e.r);o.onerror=function(e){return r(o.error)},o.onupgradeneeded=function(t){n?(o.transaction.abort(),t.target.result.close()):e.n&&e.n(t)},o.onsuccess=function(r){const o=r.target.result;n?o.close():(o.onversionchange=e.e,t(o))}}),e})()}get(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i("get",e,"readonly",...t)})()}add(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i("add",e,"readwrite",...t)})()}put(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i("put",e,"readwrite",...t)})()}delete(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){yield r.i("delete",e,"readwrite",...t)})()}deleteDatabase(){var e=this;return babelHelpers.asyncToGenerator(function*(){e.close(),e.o=null,yield new Promise(function(t,r){const n=indexedDB.deleteDatabase(e.t);n.onerror=function(e){return r(e.target.error)},n.onblocked=function(){return r(new Error("Deletion was blocked."))},n.onsuccess=function(){return t()}})})()}getAll(e,t,r){var n=this;return babelHelpers.asyncToGenerator(function*(){return"getAll"in IDBObjectStore.prototype?yield n.i("getAll",e,"readonly",t,r):yield n.getAllMatching(e,{query:t,count:r})})()}getAllMatching(e,t={}){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.transaction([e],"readonly",function(r,n){const o=r[e],i=t.index?o.index(t.index):o,c=[],l=t.query||null,s=t.direction||"next";i.openCursor(l,s).onsuccess=function(e){const r=e.target.result;if(r){const{primaryKey:e,key:o,value:i}=r;c.push(t.includeKeys?{primaryKey:e,key:o,value:i}:i),t.count&&c.length>=t.count?n(c):r.continue()}else n(c)}})})()}transaction(e,t,r){var n=this;return babelHelpers.asyncToGenerator(function*(){return yield n.open(),yield new Promise(function(o,i){const c=n.o.transaction(e,t);c.onerror=function(e){return i(e.target.error)},c.onabort=function(e){return i(e.target.error)},c.oncomplete=function(){return o()};const l={};for(const t of e)l[t]=c.objectStore(t);r(l,function(e){return o(e)},function(){i(new Error("The transaction was manually aborted")),c.abort()})})})()}i(e,t,r,...n){var o=this;return babelHelpers.asyncToGenerator(function*(){yield o.open();return yield o.transaction([t],r,function(r,o){r[t][e](...n).onsuccess=function(e){o(e.target.result)}})})()}e(e){this.close()}close(){this.o&&this.o.close()}}v.prototype.OPEN_TIMEOUT=2e3;const w={prefix:"workbox",suffix:self.registration.scope,googleAnalytics:"googleAnalytics",precache:"precache",runtime:"runtime"},m=e=>[w.prefix,e,w.suffix].filter(e=>e.length>0).join("-"),q={updateDetails:e=>{Object.keys(w).forEach(t=>{void 0!==e[t]&&(w[t]=e[t])})},getGoogleAnalyticsName:e=>e||m(w.googleAnalytics),getPrecacheName:e=>e||m(w.precache),getRuntimeName:e=>e||m(w.runtime)};var E="cacheDidUpdate",L="cacheWillUpdate",x="cachedResponseWillBeUsed",H="fetchDidFail",N="requestWillFetch",O=(e,t)=>e.filter(e=>t in e);const k=e=>{const t=new URL(e,location);return t.origin===location.origin?t.pathname:t.href},D=(()=>{var e=babelHelpers.asyncToGenerator(function*({cacheName:e,request:t,response:r,event:n,plugins:o=[]}={}){if(!r)throw new p("cache-put-with-no-response",{url:k(t.url)});let i=yield P({request:t,response:r,event:n,plugins:o});if(!i)return;const c=yield caches.open(e),l=O(o,E);let s=l.length>0?yield R({cacheName:e,request:t}):null;try{yield c.put(t,i)}catch(e){throw"QuotaExceededError"===e.name&&(yield b()),e}for(let r of l)yield r[E].call(r,{cacheName:e,request:t,event:n,oldResponse:s,newResponse:i})});return function(){return e.apply(this,arguments)}})(),R=(A=babelHelpers.asyncToGenerator(function*({cacheName:e,request:t,event:r,matchOptions:n,plugins:o=[]}){let i=yield(yield caches.open(e)).match(t,n);for(let c of o)x in c&&(i=yield c[x].call(c,{cacheName:e,request:t,event:r,matchOptions:n,cachedResponse:i}));return i}),function(e){return A.apply(this,arguments)});var A;const P=(W=babelHelpers.asyncToGenerator(function*({request:e,response:t,event:r,plugins:n}){let o=t,i=!1;for(let t of n)if(L in t&&(i=!0,!(o=yield t[L].call(t,{request:e,response:o,event:r}))))break;return i||(o=o.ok?o:null),o||null}),function(e){return W.apply(this,arguments)});var W;const S={put:D,match:R},_={fetch:(()=>{var e=babelHelpers.asyncToGenerator(function*({request:e,fetchOptions:t,event:r,plugins:n=[]}){if(r&&r.preloadResponse){const e=yield r.preloadResponse;if(e)return e}"string"==typeof e&&(e=new Request(e));const o=O(n,H),i=o.length>0?e.clone():null;try{for(let t of n)N in t&&(e=yield t[N].call(t,{request:e.clone(),event:r}))}catch(e){throw new p("plugin-error-request-will-fetch",{thrownError:e})}const c=e.clone();try{return yield fetch(e,t)}catch(e){for(let t of o)yield t[H].call(t,{error:e,event:r,originalRequest:i.clone(),request:c.clone()});throw e}});return function(t){return e.apply(this,arguments)}})()};var j=Object.freeze({DBWrapper:v,WorkboxError:p,assert:null,cacheNames:q,cacheWrapper:S,fetchWrapper:_,getFriendlyURL:k,logger:u});var B=new class{constructor(){try{self.workbox.v=self.workbox.v||{}}catch(e){}}get cacheNames(){return{googleAnalytics:q.getGoogleAnalyticsName(),precache:q.getPrecacheName(),runtime:q.getRuntimeName()}}setCacheNameDetails(e){q.updateDetails(e)}get logLevel(){return i()}setLogLevel(t){if(t>e.silent||t<e.debug)throw new p("invalid-value",{paramName:"logLevel",validValueDescription:"Please use a value from LOG_LEVELS, i.e 'logLevel = workbox.core.LOG_LEVELS.debug'.",value:t});o(t)}};return Object.assign(B,{_private:j,LOG_LEVELS:e,registerQuotaErrorCallback:function(e){g.add(e)}})}();
2
2
 
3
3
  //# sourceMappingURL=workbox-core.prod.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-core/browser.mjs"],"sourcesContent":["self.babelHelpers={asyncToGenerator:function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(o,i){try{var c=t[o](i),l=c.value}catch(e){return void r(e)}if(!c.done)return Promise.resolve(l).then(function(e){n(\"next\",e)},function(e){n(\"throw\",e)});e(l)}(\"next\")})}}},this.workbox=this.workbox||{},this.workbox.core=function(){\"use strict\";try{self.workbox.v[\"workbox:core:3.6.2\"]=1}catch(e){}var e={debug:0,log:1,warn:2,error:3,silent:4};const t=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);let r=(()=>e.warn)();const n=e=>r<=e,o=e=>r=e,i=()=>r,c=e.error,l=function(r,o,i){const l=0===r.indexOf(\"group\")?c:e[r];if(!n(l))return;if(!i||\"groupCollapsed\"===r&&t)return void console[r](...o);const s=[\"%cworkbox\",`background: ${i}; color: white; padding: 2px 0.5em; `+\"border-radius: 0.5em;\"];console[r](...s,...o)},s=()=>{n(c)&&console.groupEnd()},u={groupEnd:s,unprefixed:{groupEnd:s}},a={debug:\"#7f8c8d\",log:\"#2ecc71\",warn:\"#f39c12\",error:\"#c0392b\",groupCollapsed:\"#3498db\"};var f,d;Object.keys(a).forEach(e=>(e=e,d=a[e],u[e]=((...t)=>l(e,t,d)),void(u.unprefixed[e]=((...t)=>l(e,t)))));const h=(e,...t)=>{let r=e;return t.length>0&&(r+=` :: ${JSON.stringify(t)}`),r};class p extends Error{constructor(e,t){super(h(e,t)),this.name=e,this.details=t}}let b=(y=babelHelpers.asyncToGenerator(function*(){for(const e of g)yield e()}),function(){return y.apply(this,arguments)});var y;const g=new Set;class v{constructor(e,t,{onupgradeneeded:r,onversionchange:n=this.e}={}){this.t=e,this.r=t,this.n=r,this.e=n,this.o=null}open(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(!e.o)return e.o=yield new Promise(function(t,r){let n=!1;setTimeout(function(){n=!0,r(new Error(\"The open request was blocked and timed out\"))},e.OPEN_TIMEOUT);const o=indexedDB.open(e.t,e.r);o.onerror=function(e){return r(o.error)},o.onupgradeneeded=function(t){n?(o.transaction.abort(),t.target.result.close()):e.n&&e.n(t)},o.onsuccess=function(r){const o=r.target.result;n?o.close():(o.onversionchange=e.e,t(o))}}),e})()}get(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i(\"get\",e,\"readonly\",...t)})()}add(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i(\"add\",e,\"readwrite\",...t)})()}put(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i(\"put\",e,\"readwrite\",...t)})()}delete(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){yield r.i(\"delete\",e,\"readwrite\",...t)})()}deleteDatabase(){var e=this;return babelHelpers.asyncToGenerator(function*(){e.close(),e.o=null,yield new Promise(function(t,r){const n=indexedDB.deleteDatabase(e.t);n.onerror=function(e){return r(e.target.error)},n.onblocked=function(){return r(new Error(\"Deletion was blocked.\"))},n.onsuccess=function(){return t()}})})()}getAll(e,t,r){var n=this;return babelHelpers.asyncToGenerator(function*(){return\"getAll\"in IDBObjectStore.prototype?yield n.i(\"getAll\",e,\"readonly\",t,r):yield n.getAllMatching(e,{query:t,count:r})})()}getAllMatching(e,t={}){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.transaction([e],\"readonly\",function(r,n){const o=r[e],i=t.index?o.index(t.index):o,c=[],l=t.query||null,s=t.direction||\"next\";i.openCursor(l,s).onsuccess=function(e){const r=e.target.result;if(r){const{primaryKey:e,key:o,value:i}=r;c.push(t.includeKeys?{primaryKey:e,key:o,value:i}:i),t.count&&c.length>=t.count?n(c):r.continue()}else n(c)}})})()}transaction(e,t,r){var n=this;return babelHelpers.asyncToGenerator(function*(){return yield n.open(),yield new Promise(function(o,i){const c=n.o.transaction(e,t);c.onerror=function(e){return i(e.target.error)},c.onabort=function(e){return i(e.target.error)},c.oncomplete=function(){return o()};const l={};for(const t of e)l[t]=c.objectStore(t);r(l,function(e){return o(e)},function(){i(new Error(\"The transaction was manually aborted\")),c.abort()})})})()}i(e,t,r,...n){var o=this;return babelHelpers.asyncToGenerator(function*(){yield o.open();return yield o.transaction([t],r,function(r,o){r[t][e](...n).onsuccess=function(e){o(e.target.result)}})})()}e(e){this.close()}close(){this.o&&this.o.close()}}v.prototype.OPEN_TIMEOUT=2e3;const w={prefix:\"workbox\",suffix:self.registration.scope,googleAnalytics:\"googleAnalytics\",precache:\"precache\",runtime:\"runtime\"},m=e=>[w.prefix,e,w.suffix].filter(e=>e.length>0).join(\"-\"),q={updateDetails:e=>{Object.keys(w).forEach(t=>{void 0!==e[t]&&(w[t]=e[t])})},getGoogleAnalyticsName:e=>e||m(w.googleAnalytics),getPrecacheName:e=>e||m(w.precache),getRuntimeName:e=>e||m(w.runtime)};var E=\"cacheDidUpdate\",L=\"cacheWillUpdate\",x=\"cachedResponseWillBeUsed\",H=\"fetchDidFail\",N=\"requestWillFetch\",O=(e,t)=>e.filter(e=>t in e);const k=e=>{const t=new URL(e,location);return t.origin===location.origin?t.pathname:t.href},D=(()=>{var e=babelHelpers.asyncToGenerator(function*({cacheName:e,request:t,response:r,event:n,plugins:o=[]}={}){if(!r)throw new p(\"cache-put-with-no-response\",{url:k(t.url)});let i=yield P({request:t,response:r,event:n,plugins:o});if(!i)return;const c=yield caches.open(e),l=O(o,E);let s=l.length>0?yield R({cacheName:e,request:t}):null;try{yield c.put(t,i)}catch(e){throw\"QuotaExceededError\"===e.name&&(yield b()),e}for(let r of l)yield r[E].call(r,{cacheName:e,request:t,event:n,oldResponse:s,newResponse:i})});return function(){return e.apply(this,arguments)}})(),R=(A=babelHelpers.asyncToGenerator(function*({cacheName:e,request:t,event:r,matchOptions:n,plugins:o=[]}){let i=yield(yield caches.open(e)).match(t,n);for(let c of o)x in c&&(i=yield c[x].call(c,{cacheName:e,request:t,event:r,matchOptions:n,cachedResponse:i}));return i}),function(e){return A.apply(this,arguments)});var A;const P=(W=babelHelpers.asyncToGenerator(function*({request:e,response:t,event:r,plugins:n}){let o=t,i=!1;for(let t of n)if(L in t&&(i=!0,!(o=yield t[L].call(t,{request:e,response:o,event:r}))))break;return i||(o=o.ok?o:null),o||null}),function(e){return W.apply(this,arguments)});var W;const S={put:D,match:R},_={fetch:(()=>{var e=babelHelpers.asyncToGenerator(function*({request:e,fetchOptions:t,event:r,plugins:n=[]}){if(r&&r.preloadResponse){const e=yield r.preloadResponse;if(e)return e}\"string\"==typeof e&&(e=new Request(e));const o=O(n,H),i=o.length>0?e.clone():null;try{for(let t of n)N in t&&(e=yield t[N].call(t,{request:e.clone(),event:r}))}catch(e){throw new p(\"plugin-error-request-will-fetch\",{thrownError:e})}const c=e.clone();try{return yield fetch(e,t)}catch(e){for(let t of o)yield t[H].call(t,{error:e,event:r,originalRequest:i.clone(),request:c.clone()});throw e}});return function(t){return e.apply(this,arguments)}})()};var j=Object.freeze({DBWrapper:v,WorkboxError:p,assert:null,cacheNames:q,cacheWrapper:S,fetchWrapper:_,getFriendlyURL:k,logger:u});var B=new class{constructor(){try{self.workbox.v=self.workbox.v||{}}catch(e){}}get cacheNames(){return{googleAnalytics:q.getGoogleAnalyticsName(),precache:q.getPrecacheName(),runtime:q.getRuntimeName()}}setCacheNameDetails(e){q.updateDetails(e)}get logLevel(){return i()}setLogLevel(t){if(t>e.silent||t<e.debug)throw new p(\"invalid-value\",{paramName:\"logLevel\",validValueDescription:\"Please use a value from LOG_LEVELS, i.e 'logLevel = workbox.core.LOG_LEVELS.debug'.\",value:t});o(t)}};return Object.assign(B,{_private:j,LOG_LEVELS:e,registerQuotaErrorCallback:function(e){g.add(e)}})}();\n"],"file":"workbox-core.prod.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-core/browser.mjs"],"sourcesContent":["self.babelHelpers={asyncToGenerator:function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(o,i){try{var c=t[o](i),l=c.value}catch(e){return void r(e)}if(!c.done)return Promise.resolve(l).then(function(e){n(\"next\",e)},function(e){n(\"throw\",e)});e(l)}(\"next\")})}}},this.workbox=this.workbox||{},this.workbox.core=function(){\"use strict\";try{self.workbox.v[\"workbox:core:3.6.3\"]=1}catch(e){}var e={debug:0,log:1,warn:2,error:3,silent:4};const t=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);let r=(()=>e.warn)();const n=e=>r<=e,o=e=>r=e,i=()=>r,c=e.error,l=function(r,o,i){const l=0===r.indexOf(\"group\")?c:e[r];if(!n(l))return;if(!i||\"groupCollapsed\"===r&&t)return void console[r](...o);const s=[\"%cworkbox\",`background: ${i}; color: white; padding: 2px 0.5em; `+\"border-radius: 0.5em;\"];console[r](...s,...o)},s=()=>{n(c)&&console.groupEnd()},u={groupEnd:s,unprefixed:{groupEnd:s}},a={debug:\"#7f8c8d\",log:\"#2ecc71\",warn:\"#f39c12\",error:\"#c0392b\",groupCollapsed:\"#3498db\"};var f,d;Object.keys(a).forEach(e=>(e=e,d=a[e],u[e]=((...t)=>l(e,t,d)),void(u.unprefixed[e]=((...t)=>l(e,t)))));const h=(e,...t)=>{let r=e;return t.length>0&&(r+=` :: ${JSON.stringify(t)}`),r};class p extends Error{constructor(e,t){super(h(e,t)),this.name=e,this.details=t}}let b=(y=babelHelpers.asyncToGenerator(function*(){for(const e of g)yield e()}),function(){return y.apply(this,arguments)});var y;const g=new Set;class v{constructor(e,t,{onupgradeneeded:r,onversionchange:n=this.e}={}){this.t=e,this.r=t,this.n=r,this.e=n,this.o=null}open(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(!e.o)return e.o=yield new Promise(function(t,r){let n=!1;setTimeout(function(){n=!0,r(new Error(\"The open request was blocked and timed out\"))},e.OPEN_TIMEOUT);const o=indexedDB.open(e.t,e.r);o.onerror=function(e){return r(o.error)},o.onupgradeneeded=function(t){n?(o.transaction.abort(),t.target.result.close()):e.n&&e.n(t)},o.onsuccess=function(r){const o=r.target.result;n?o.close():(o.onversionchange=e.e,t(o))}}),e})()}get(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i(\"get\",e,\"readonly\",...t)})()}add(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i(\"add\",e,\"readwrite\",...t)})()}put(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i(\"put\",e,\"readwrite\",...t)})()}delete(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){yield r.i(\"delete\",e,\"readwrite\",...t)})()}deleteDatabase(){var e=this;return babelHelpers.asyncToGenerator(function*(){e.close(),e.o=null,yield new Promise(function(t,r){const n=indexedDB.deleteDatabase(e.t);n.onerror=function(e){return r(e.target.error)},n.onblocked=function(){return r(new Error(\"Deletion was blocked.\"))},n.onsuccess=function(){return t()}})})()}getAll(e,t,r){var n=this;return babelHelpers.asyncToGenerator(function*(){return\"getAll\"in IDBObjectStore.prototype?yield n.i(\"getAll\",e,\"readonly\",t,r):yield n.getAllMatching(e,{query:t,count:r})})()}getAllMatching(e,t={}){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.transaction([e],\"readonly\",function(r,n){const o=r[e],i=t.index?o.index(t.index):o,c=[],l=t.query||null,s=t.direction||\"next\";i.openCursor(l,s).onsuccess=function(e){const r=e.target.result;if(r){const{primaryKey:e,key:o,value:i}=r;c.push(t.includeKeys?{primaryKey:e,key:o,value:i}:i),t.count&&c.length>=t.count?n(c):r.continue()}else n(c)}})})()}transaction(e,t,r){var n=this;return babelHelpers.asyncToGenerator(function*(){return yield n.open(),yield new Promise(function(o,i){const c=n.o.transaction(e,t);c.onerror=function(e){return i(e.target.error)},c.onabort=function(e){return i(e.target.error)},c.oncomplete=function(){return o()};const l={};for(const t of e)l[t]=c.objectStore(t);r(l,function(e){return o(e)},function(){i(new Error(\"The transaction was manually aborted\")),c.abort()})})})()}i(e,t,r,...n){var o=this;return babelHelpers.asyncToGenerator(function*(){yield o.open();return yield o.transaction([t],r,function(r,o){r[t][e](...n).onsuccess=function(e){o(e.target.result)}})})()}e(e){this.close()}close(){this.o&&this.o.close()}}v.prototype.OPEN_TIMEOUT=2e3;const w={prefix:\"workbox\",suffix:self.registration.scope,googleAnalytics:\"googleAnalytics\",precache:\"precache\",runtime:\"runtime\"},m=e=>[w.prefix,e,w.suffix].filter(e=>e.length>0).join(\"-\"),q={updateDetails:e=>{Object.keys(w).forEach(t=>{void 0!==e[t]&&(w[t]=e[t])})},getGoogleAnalyticsName:e=>e||m(w.googleAnalytics),getPrecacheName:e=>e||m(w.precache),getRuntimeName:e=>e||m(w.runtime)};var E=\"cacheDidUpdate\",L=\"cacheWillUpdate\",x=\"cachedResponseWillBeUsed\",H=\"fetchDidFail\",N=\"requestWillFetch\",O=(e,t)=>e.filter(e=>t in e);const k=e=>{const t=new URL(e,location);return t.origin===location.origin?t.pathname:t.href},D=(()=>{var e=babelHelpers.asyncToGenerator(function*({cacheName:e,request:t,response:r,event:n,plugins:o=[]}={}){if(!r)throw new p(\"cache-put-with-no-response\",{url:k(t.url)});let i=yield P({request:t,response:r,event:n,plugins:o});if(!i)return;const c=yield caches.open(e),l=O(o,E);let s=l.length>0?yield R({cacheName:e,request:t}):null;try{yield c.put(t,i)}catch(e){throw\"QuotaExceededError\"===e.name&&(yield b()),e}for(let r of l)yield r[E].call(r,{cacheName:e,request:t,event:n,oldResponse:s,newResponse:i})});return function(){return e.apply(this,arguments)}})(),R=(A=babelHelpers.asyncToGenerator(function*({cacheName:e,request:t,event:r,matchOptions:n,plugins:o=[]}){let i=yield(yield caches.open(e)).match(t,n);for(let c of o)x in c&&(i=yield c[x].call(c,{cacheName:e,request:t,event:r,matchOptions:n,cachedResponse:i}));return i}),function(e){return A.apply(this,arguments)});var A;const P=(W=babelHelpers.asyncToGenerator(function*({request:e,response:t,event:r,plugins:n}){let o=t,i=!1;for(let t of n)if(L in t&&(i=!0,!(o=yield t[L].call(t,{request:e,response:o,event:r}))))break;return i||(o=o.ok?o:null),o||null}),function(e){return W.apply(this,arguments)});var W;const S={put:D,match:R},_={fetch:(()=>{var e=babelHelpers.asyncToGenerator(function*({request:e,fetchOptions:t,event:r,plugins:n=[]}){if(r&&r.preloadResponse){const e=yield r.preloadResponse;if(e)return e}\"string\"==typeof e&&(e=new Request(e));const o=O(n,H),i=o.length>0?e.clone():null;try{for(let t of n)N in t&&(e=yield t[N].call(t,{request:e.clone(),event:r}))}catch(e){throw new p(\"plugin-error-request-will-fetch\",{thrownError:e})}const c=e.clone();try{return yield fetch(e,t)}catch(e){for(let t of o)yield t[H].call(t,{error:e,event:r,originalRequest:i.clone(),request:c.clone()});throw e}});return function(t){return e.apply(this,arguments)}})()};var j=Object.freeze({DBWrapper:v,WorkboxError:p,assert:null,cacheNames:q,cacheWrapper:S,fetchWrapper:_,getFriendlyURL:k,logger:u});var B=new class{constructor(){try{self.workbox.v=self.workbox.v||{}}catch(e){}}get cacheNames(){return{googleAnalytics:q.getGoogleAnalyticsName(),precache:q.getPrecacheName(),runtime:q.getRuntimeName()}}setCacheNameDetails(e){q.updateDetails(e)}get logLevel(){return i()}setLogLevel(t){if(t>e.silent||t<e.debug)throw new p(\"invalid-value\",{paramName:\"logLevel\",validValueDescription:\"Please use a value from LOG_LEVELS, i.e 'logLevel = workbox.core.LOG_LEVELS.debug'.\",value:t});o(t)}};return Object.assign(B,{_private:j,LOG_LEVELS:e,registerQuotaErrorCallback:function(e){g.add(e)}})}();\n"],"file":"workbox-core.prod.js"}
@@ -3,7 +3,7 @@ this.workbox.googleAnalytics = (function (exports,Plugin_mjs,cacheNames_mjs,Rout
3
3
  'use strict';
4
4
 
5
5
  try {
6
- self.workbox.v['workbox:google-analytics:3.6.2'] = 1;
6
+ self.workbox.v['workbox:google-analytics:3.6.3'] = 1;
7
7
  } catch (e) {} // eslint-disable-line
8
8
 
9
9
  /*
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-google-analytics/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.googleAnalytics = (function (exports,Plugin_mjs,cacheNames_mjs,Route_mjs,Router_mjs,NetworkFirst_mjs,NetworkOnly_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:google-analytics:3.6.2'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const QUEUE_NAME = 'workbox-google-analytics';\n const MAX_RETENTION_TIME = 60 * 48; // Two days in minutes\n const GOOGLE_ANALYTICS_HOST = 'www.google-analytics.com';\n const GTM_HOST = 'www.googletagmanager.com';\n const ANALYTICS_JS_PATH = '/analytics.js';\n const GTAG_JS_PATH = '/gtag/js';\n\n // This RegExp matches all known Measurement Protocol single-hit collect\n // endpoints. Most of the time the default path (/collect) is used, but\n // occasionally an experimental endpoint is used when testing new features,\n // (e.g. /r/collect or /j/collect)\n const COLLECT_PATHS_REGEX = /^\\/(\\w+\\/)?collect/;\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Promisifies the FileReader API to await a text response from a Blob.\n *\n * @param {Blob} blob\n * @return {Promise<string>}\n *\n * @private\n */\n const getTextFromBlob = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* (blob) {\n // This usage of `return await new Promise...` is intentional to work around\n // a bug in the transpiled/minified output.\n // See https://github.com/GoogleChrome/workbox/issues/1186\n return yield new Promise(function (resolve, reject) {\n const reader = new FileReader();\n reader.onloadend = function () {\n return resolve(reader.result);\n };\n reader.onerror = function () {\n return reject(reader.error);\n };\n reader.readAsText(blob);\n });\n });\n\n return function getTextFromBlob(_x) {\n return _ref.apply(this, arguments);\n };\n })();\n\n /**\n * Creates the requestWillDequeue callback to be used with the background\n * sync queue plugin. The callback takes the failed request and adds the\n * `qt` param based on the current time, as well as applies any other\n * user-defined hit modifications.\n *\n * @param {Object} config See workbox.googleAnalytics.initialize.\n * @return {Function} The requestWillDequeu callback function.\n *\n * @private\n */\n const createRequestWillReplayCallback = config => {\n return (() => {\n var _ref2 = babelHelpers.asyncToGenerator(function* (storableRequest) {\n let { url, requestInit, timestamp } = storableRequest;\n url = new URL(url);\n\n // Measurement protocol requests can set their payload parameters in either\n // the URL query string (for GET requests) or the POST body.\n let params;\n if (requestInit.body) {\n const payload = requestInit.body instanceof Blob ? yield getTextFromBlob(requestInit.body) : requestInit.body;\n\n params = new URLSearchParams(payload);\n } else {\n params = url.searchParams;\n }\n\n // Calculate the qt param, accounting for the fact that an existing\n // qt param may be present and should be updated rather than replaced.\n const originalHitTime = timestamp - (Number(params.get('qt')) || 0);\n const queueTime = Date.now() - originalHitTime;\n\n // Set the qt param prior to applying the hitFilter or parameterOverrides.\n params.set('qt', queueTime);\n\n if (config.parameterOverrides) {\n for (const param of Object.keys(config.parameterOverrides)) {\n const value = config.parameterOverrides[param];\n params.set(param, value);\n }\n }\n\n if (typeof config.hitFilter === 'function') {\n config.hitFilter.call(null, params);\n }\n\n requestInit.body = params.toString();\n requestInit.method = 'POST';\n requestInit.mode = 'cors';\n requestInit.credentials = 'omit';\n requestInit.headers = { 'Content-Type': 'text/plain' };\n\n // Ignore URL search params as they're now in the post body.\n storableRequest.url = `${url.origin}${url.pathname}`;\n });\n\n return function (_x2) {\n return _ref2.apply(this, arguments);\n };\n })();\n };\n\n /**\n * Creates GET and POST routes to catch failed Measurement Protocol hits.\n *\n * @param {Plugin} queuePlugin\n * @return {Array<Route>} The created routes.\n *\n * @private\n */\n const createCollectRoutes = queuePlugin => {\n const match = ({ url }) => url.hostname === GOOGLE_ANALYTICS_HOST && COLLECT_PATHS_REGEX.test(url.pathname);\n\n const handler = new NetworkOnly_mjs.NetworkOnly({\n plugins: [queuePlugin]\n });\n\n return [new Route_mjs.Route(match, handler, 'GET'), new Route_mjs.Route(match, handler, 'POST')];\n };\n\n /**\n * Creates a route with a network first strategy for the analytics.js script.\n *\n * @param {string} cacheName\n * @return {Route} The created route.\n *\n * @private\n */\n const createAnalyticsJsRoute = cacheName => {\n const match = ({ url }) => url.hostname === GOOGLE_ANALYTICS_HOST && url.pathname === ANALYTICS_JS_PATH;\n const handler = new NetworkFirst_mjs.NetworkFirst({ cacheName });\n\n return new Route_mjs.Route(match, handler, 'GET');\n };\n\n /**\n * Creates a route with a network first strategy for the gtag.js script.\n *\n * @param {string} cacheName\n * @return {Route} The created route.\n *\n * @private\n */\n const createGtagJsRoute = cacheName => {\n const match = ({ url }) => url.hostname === GTM_HOST && url.pathname === GTAG_JS_PATH;\n const handler = new NetworkFirst_mjs.NetworkFirst({ cacheName });\n\n return new Route_mjs.Route(match, handler, 'GET');\n };\n\n /**\n * @param {Object=} [options]\n * @param {Object} [options.cacheName] The cache name to store and retrieve\n * analytics.js. Defaults to the cache names provided by `workbox-core`.\n * @param {Object} [options.parameterOverrides]\n * [Measurement Protocol parameters](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters),\n * expressed as key/value pairs, to be added to replayed Google Analytics\n * requests. This can be used to, e.g., set a custom dimension indicating\n * that the request was replayed.\n * @param {Function} [options.hitFilter] A function that allows you to modify\n * the hit parameters prior to replaying\n * the hit. The function is invoked with the original hit's URLSearchParams\n * object as its only argument.\n *\n * @memberof workbox.googleAnalytics\n */\n const initialize = (options = {}) => {\n const cacheName = cacheNames_mjs.cacheNames.getGoogleAnalyticsName(options.cacheName);\n\n const queuePlugin = new Plugin_mjs.Plugin(QUEUE_NAME, {\n maxRetentionTime: MAX_RETENTION_TIME,\n callbacks: {\n requestWillReplay: createRequestWillReplayCallback(options)\n }\n });\n\n const routes = [createAnalyticsJsRoute(cacheName), createGtagJsRoute(cacheName), ...createCollectRoutes(queuePlugin)];\n\n const router = new Router_mjs.Router();\n for (const route of routes) {\n router.registerRoute(route);\n }\n\n self.addEventListener('fetch', evt => {\n const responsePromise = router.handleRequest(evt);\n if (responsePromise) {\n evt.respondWith(responsePromise);\n }\n });\n };\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.initialize = initialize;\n\n return exports;\n\n}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies));\n"],"file":"workbox-google-analytics.dev.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-google-analytics/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.googleAnalytics = (function (exports,Plugin_mjs,cacheNames_mjs,Route_mjs,Router_mjs,NetworkFirst_mjs,NetworkOnly_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:google-analytics:3.6.3'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const QUEUE_NAME = 'workbox-google-analytics';\n const MAX_RETENTION_TIME = 60 * 48; // Two days in minutes\n const GOOGLE_ANALYTICS_HOST = 'www.google-analytics.com';\n const GTM_HOST = 'www.googletagmanager.com';\n const ANALYTICS_JS_PATH = '/analytics.js';\n const GTAG_JS_PATH = '/gtag/js';\n\n // This RegExp matches all known Measurement Protocol single-hit collect\n // endpoints. Most of the time the default path (/collect) is used, but\n // occasionally an experimental endpoint is used when testing new features,\n // (e.g. /r/collect or /j/collect)\n const COLLECT_PATHS_REGEX = /^\\/(\\w+\\/)?collect/;\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Promisifies the FileReader API to await a text response from a Blob.\n *\n * @param {Blob} blob\n * @return {Promise<string>}\n *\n * @private\n */\n const getTextFromBlob = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* (blob) {\n // This usage of `return await new Promise...` is intentional to work around\n // a bug in the transpiled/minified output.\n // See https://github.com/GoogleChrome/workbox/issues/1186\n return yield new Promise(function (resolve, reject) {\n const reader = new FileReader();\n reader.onloadend = function () {\n return resolve(reader.result);\n };\n reader.onerror = function () {\n return reject(reader.error);\n };\n reader.readAsText(blob);\n });\n });\n\n return function getTextFromBlob(_x) {\n return _ref.apply(this, arguments);\n };\n })();\n\n /**\n * Creates the requestWillDequeue callback to be used with the background\n * sync queue plugin. The callback takes the failed request and adds the\n * `qt` param based on the current time, as well as applies any other\n * user-defined hit modifications.\n *\n * @param {Object} config See workbox.googleAnalytics.initialize.\n * @return {Function} The requestWillDequeu callback function.\n *\n * @private\n */\n const createRequestWillReplayCallback = config => {\n return (() => {\n var _ref2 = babelHelpers.asyncToGenerator(function* (storableRequest) {\n let { url, requestInit, timestamp } = storableRequest;\n url = new URL(url);\n\n // Measurement protocol requests can set their payload parameters in either\n // the URL query string (for GET requests) or the POST body.\n let params;\n if (requestInit.body) {\n const payload = requestInit.body instanceof Blob ? yield getTextFromBlob(requestInit.body) : requestInit.body;\n\n params = new URLSearchParams(payload);\n } else {\n params = url.searchParams;\n }\n\n // Calculate the qt param, accounting for the fact that an existing\n // qt param may be present and should be updated rather than replaced.\n const originalHitTime = timestamp - (Number(params.get('qt')) || 0);\n const queueTime = Date.now() - originalHitTime;\n\n // Set the qt param prior to applying the hitFilter or parameterOverrides.\n params.set('qt', queueTime);\n\n if (config.parameterOverrides) {\n for (const param of Object.keys(config.parameterOverrides)) {\n const value = config.parameterOverrides[param];\n params.set(param, value);\n }\n }\n\n if (typeof config.hitFilter === 'function') {\n config.hitFilter.call(null, params);\n }\n\n requestInit.body = params.toString();\n requestInit.method = 'POST';\n requestInit.mode = 'cors';\n requestInit.credentials = 'omit';\n requestInit.headers = { 'Content-Type': 'text/plain' };\n\n // Ignore URL search params as they're now in the post body.\n storableRequest.url = `${url.origin}${url.pathname}`;\n });\n\n return function (_x2) {\n return _ref2.apply(this, arguments);\n };\n })();\n };\n\n /**\n * Creates GET and POST routes to catch failed Measurement Protocol hits.\n *\n * @param {Plugin} queuePlugin\n * @return {Array<Route>} The created routes.\n *\n * @private\n */\n const createCollectRoutes = queuePlugin => {\n const match = ({ url }) => url.hostname === GOOGLE_ANALYTICS_HOST && COLLECT_PATHS_REGEX.test(url.pathname);\n\n const handler = new NetworkOnly_mjs.NetworkOnly({\n plugins: [queuePlugin]\n });\n\n return [new Route_mjs.Route(match, handler, 'GET'), new Route_mjs.Route(match, handler, 'POST')];\n };\n\n /**\n * Creates a route with a network first strategy for the analytics.js script.\n *\n * @param {string} cacheName\n * @return {Route} The created route.\n *\n * @private\n */\n const createAnalyticsJsRoute = cacheName => {\n const match = ({ url }) => url.hostname === GOOGLE_ANALYTICS_HOST && url.pathname === ANALYTICS_JS_PATH;\n const handler = new NetworkFirst_mjs.NetworkFirst({ cacheName });\n\n return new Route_mjs.Route(match, handler, 'GET');\n };\n\n /**\n * Creates a route with a network first strategy for the gtag.js script.\n *\n * @param {string} cacheName\n * @return {Route} The created route.\n *\n * @private\n */\n const createGtagJsRoute = cacheName => {\n const match = ({ url }) => url.hostname === GTM_HOST && url.pathname === GTAG_JS_PATH;\n const handler = new NetworkFirst_mjs.NetworkFirst({ cacheName });\n\n return new Route_mjs.Route(match, handler, 'GET');\n };\n\n /**\n * @param {Object=} [options]\n * @param {Object} [options.cacheName] The cache name to store and retrieve\n * analytics.js. Defaults to the cache names provided by `workbox-core`.\n * @param {Object} [options.parameterOverrides]\n * [Measurement Protocol parameters](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters),\n * expressed as key/value pairs, to be added to replayed Google Analytics\n * requests. This can be used to, e.g., set a custom dimension indicating\n * that the request was replayed.\n * @param {Function} [options.hitFilter] A function that allows you to modify\n * the hit parameters prior to replaying\n * the hit. The function is invoked with the original hit's URLSearchParams\n * object as its only argument.\n *\n * @memberof workbox.googleAnalytics\n */\n const initialize = (options = {}) => {\n const cacheName = cacheNames_mjs.cacheNames.getGoogleAnalyticsName(options.cacheName);\n\n const queuePlugin = new Plugin_mjs.Plugin(QUEUE_NAME, {\n maxRetentionTime: MAX_RETENTION_TIME,\n callbacks: {\n requestWillReplay: createRequestWillReplayCallback(options)\n }\n });\n\n const routes = [createAnalyticsJsRoute(cacheName), createGtagJsRoute(cacheName), ...createCollectRoutes(queuePlugin)];\n\n const router = new Router_mjs.Router();\n for (const route of routes) {\n router.registerRoute(route);\n }\n\n self.addEventListener('fetch', evt => {\n const responsePromise = router.handleRequest(evt);\n if (responsePromise) {\n evt.respondWith(responsePromise);\n }\n });\n };\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.initialize = initialize;\n\n return exports;\n\n}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies));\n"],"file":"workbox-google-analytics.dev.js"}
@@ -1,3 +1,3 @@
1
- this.workbox=this.workbox||{},this.workbox.googleAnalytics=function(e,n,t,o,r,c,s){"use strict";try{self.workbox.v["workbox:google-analytics:3.6.2"]=1}catch(e){}const l=/^\/(\w+\/)?collect/,i=(a=babelHelpers.asyncToGenerator(function*(e){return yield new Promise(function(n,t){const o=new FileReader;o.onloadend=function(){return n(o.result)},o.onerror=function(){return t(o.error)},o.readAsText(e)})}),function(e){return a.apply(this,arguments)});var a;const w=e=>(u=babelHelpers.asyncToGenerator(function*(n){let t,{url:o,requestInit:r,timestamp:c}=n;if(o=new URL(o),r.body){const e=r.body instanceof Blob?yield i(r.body):r.body;t=new URLSearchParams(e)}else t=o.searchParams;const s=c-(Number(t.get("qt"))||0),l=Date.now()-s;if(t.set("qt",l),e.parameterOverrides)for(const n of Object.keys(e.parameterOverrides)){const o=e.parameterOverrides[n];t.set(n,o)}"function"==typeof e.hitFilter&&e.hitFilter.call(null,t),r.body=t.toString(),r.method="POST",r.mode="cors",r.credentials="omit",r.headers={"Content-Type":"text/plain"},n.url=`${o.origin}${o.pathname}`}),function(e){return u.apply(this,arguments)});var u;return e.initialize=((e={})=>{const i=t.cacheNames.getGoogleAnalyticsName(e.cacheName),a=new n.Plugin("workbox-google-analytics",{maxRetentionTime:2880,callbacks:{requestWillReplay:w(e)}}),u=[(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>"www.google-analytics.com"===e.hostname&&"/analytics.js"===e.pathname,n,"GET")})(i),(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>"www.googletagmanager.com"===e.hostname&&"/gtag/js"===e.pathname,n,"GET")})(i),...(e=>{const n=({url:e})=>"www.google-analytics.com"===e.hostname&&l.test(e.pathname),t=new s.NetworkOnly({plugins:[e]});return[new o.Route(n,t,"GET"),new o.Route(n,t,"POST")]})(a)],f=new r.Router;for(const e of u)f.registerRoute(e);self.addEventListener("fetch",e=>{const n=f.handleRequest(e);n&&e.respondWith(n)})}),e}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies);
1
+ this.workbox=this.workbox||{},this.workbox.googleAnalytics=function(e,n,t,o,r,c,s){"use strict";try{self.workbox.v["workbox:google-analytics:3.6.3"]=1}catch(e){}const l=/^\/(\w+\/)?collect/,i=(a=babelHelpers.asyncToGenerator(function*(e){return yield new Promise(function(n,t){const o=new FileReader;o.onloadend=function(){return n(o.result)},o.onerror=function(){return t(o.error)},o.readAsText(e)})}),function(e){return a.apply(this,arguments)});var a;const w=e=>(u=babelHelpers.asyncToGenerator(function*(n){let t,{url:o,requestInit:r,timestamp:c}=n;if(o=new URL(o),r.body){const e=r.body instanceof Blob?yield i(r.body):r.body;t=new URLSearchParams(e)}else t=o.searchParams;const s=c-(Number(t.get("qt"))||0),l=Date.now()-s;if(t.set("qt",l),e.parameterOverrides)for(const n of Object.keys(e.parameterOverrides)){const o=e.parameterOverrides[n];t.set(n,o)}"function"==typeof e.hitFilter&&e.hitFilter.call(null,t),r.body=t.toString(),r.method="POST",r.mode="cors",r.credentials="omit",r.headers={"Content-Type":"text/plain"},n.url=`${o.origin}${o.pathname}`}),function(e){return u.apply(this,arguments)});var u;return e.initialize=((e={})=>{const i=t.cacheNames.getGoogleAnalyticsName(e.cacheName),a=new n.Plugin("workbox-google-analytics",{maxRetentionTime:2880,callbacks:{requestWillReplay:w(e)}}),u=[(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>"www.google-analytics.com"===e.hostname&&"/analytics.js"===e.pathname,n,"GET")})(i),(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>"www.googletagmanager.com"===e.hostname&&"/gtag/js"===e.pathname,n,"GET")})(i),...(e=>{const n=({url:e})=>"www.google-analytics.com"===e.hostname&&l.test(e.pathname),t=new s.NetworkOnly({plugins:[e]});return[new o.Route(n,t,"GET"),new o.Route(n,t,"POST")]})(a)],f=new r.Router;for(const e of u)f.registerRoute(e);self.addEventListener("fetch",e=>{const n=f.handleRequest(e);n&&e.respondWith(n)})}),e}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies);
2
2
 
3
3
  //# sourceMappingURL=workbox-google-analytics.prod.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-google-analytics/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.googleAnalytics=function(e,n,t,o,r,c,s){\"use strict\";try{self.workbox.v[\"workbox:google-analytics:3.6.2\"]=1}catch(e){}const l=/^\\/(\\w+\\/)?collect/,i=(a=babelHelpers.asyncToGenerator(function*(e){return yield new Promise(function(n,t){const o=new FileReader;o.onloadend=function(){return n(o.result)},o.onerror=function(){return t(o.error)},o.readAsText(e)})}),function(e){return a.apply(this,arguments)});var a;const w=e=>(u=babelHelpers.asyncToGenerator(function*(n){let t,{url:o,requestInit:r,timestamp:c}=n;if(o=new URL(o),r.body){const e=r.body instanceof Blob?yield i(r.body):r.body;t=new URLSearchParams(e)}else t=o.searchParams;const s=c-(Number(t.get(\"qt\"))||0),l=Date.now()-s;if(t.set(\"qt\",l),e.parameterOverrides)for(const n of Object.keys(e.parameterOverrides)){const o=e.parameterOverrides[n];t.set(n,o)}\"function\"==typeof e.hitFilter&&e.hitFilter.call(null,t),r.body=t.toString(),r.method=\"POST\",r.mode=\"cors\",r.credentials=\"omit\",r.headers={\"Content-Type\":\"text/plain\"},n.url=`${o.origin}${o.pathname}`}),function(e){return u.apply(this,arguments)});var u;return e.initialize=((e={})=>{const i=t.cacheNames.getGoogleAnalyticsName(e.cacheName),a=new n.Plugin(\"workbox-google-analytics\",{maxRetentionTime:2880,callbacks:{requestWillReplay:w(e)}}),u=[(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>\"www.google-analytics.com\"===e.hostname&&\"/analytics.js\"===e.pathname,n,\"GET\")})(i),(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>\"www.googletagmanager.com\"===e.hostname&&\"/gtag/js\"===e.pathname,n,\"GET\")})(i),...(e=>{const n=({url:e})=>\"www.google-analytics.com\"===e.hostname&&l.test(e.pathname),t=new s.NetworkOnly({plugins:[e]});return[new o.Route(n,t,\"GET\"),new o.Route(n,t,\"POST\")]})(a)],f=new r.Router;for(const e of u)f.registerRoute(e);self.addEventListener(\"fetch\",e=>{const n=f.handleRequest(e);n&&e.respondWith(n)})}),e}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies);\n"],"file":"workbox-google-analytics.prod.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-google-analytics/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.googleAnalytics=function(e,n,t,o,r,c,s){\"use strict\";try{self.workbox.v[\"workbox:google-analytics:3.6.3\"]=1}catch(e){}const l=/^\\/(\\w+\\/)?collect/,i=(a=babelHelpers.asyncToGenerator(function*(e){return yield new Promise(function(n,t){const o=new FileReader;o.onloadend=function(){return n(o.result)},o.onerror=function(){return t(o.error)},o.readAsText(e)})}),function(e){return a.apply(this,arguments)});var a;const w=e=>(u=babelHelpers.asyncToGenerator(function*(n){let t,{url:o,requestInit:r,timestamp:c}=n;if(o=new URL(o),r.body){const e=r.body instanceof Blob?yield i(r.body):r.body;t=new URLSearchParams(e)}else t=o.searchParams;const s=c-(Number(t.get(\"qt\"))||0),l=Date.now()-s;if(t.set(\"qt\",l),e.parameterOverrides)for(const n of Object.keys(e.parameterOverrides)){const o=e.parameterOverrides[n];t.set(n,o)}\"function\"==typeof e.hitFilter&&e.hitFilter.call(null,t),r.body=t.toString(),r.method=\"POST\",r.mode=\"cors\",r.credentials=\"omit\",r.headers={\"Content-Type\":\"text/plain\"},n.url=`${o.origin}${o.pathname}`}),function(e){return u.apply(this,arguments)});var u;return e.initialize=((e={})=>{const i=t.cacheNames.getGoogleAnalyticsName(e.cacheName),a=new n.Plugin(\"workbox-google-analytics\",{maxRetentionTime:2880,callbacks:{requestWillReplay:w(e)}}),u=[(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>\"www.google-analytics.com\"===e.hostname&&\"/analytics.js\"===e.pathname,n,\"GET\")})(i),(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>\"www.googletagmanager.com\"===e.hostname&&\"/gtag/js\"===e.pathname,n,\"GET\")})(i),...(e=>{const n=({url:e})=>\"www.google-analytics.com\"===e.hostname&&l.test(e.pathname),t=new s.NetworkOnly({plugins:[e]});return[new o.Route(n,t,\"GET\"),new o.Route(n,t,\"POST\")]})(a)],f=new r.Router;for(const e of u)f.registerRoute(e);self.addEventListener(\"fetch\",e=>{const n=f.handleRequest(e);n&&e.respondWith(n)})}),e}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies);\n"],"file":"workbox-google-analytics.prod.js"}
@@ -3,7 +3,7 @@ this.workbox.navigationPreload = (function (exports,logger_mjs) {
3
3
  'use strict';
4
4
 
5
5
  try {
6
- self.workbox.v['workbox:navigation-preload:3.6.2'] = 1;
6
+ self.workbox.v['workbox:navigation-preload:3.6.3'] = 1;
7
7
  } catch (e) {} // eslint-disable-line
8
8
 
9
9
  /*
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-navigation-preload/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.navigationPreload = (function (exports,logger_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:navigation-preload:3.6.2'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2018 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @return {boolean} Whether or not the current browser supports enabling\n * navigation preload.\n *\n * @memberof workbox.navigationPreload\n */\n function isSupported() {\n return Boolean(self.registration && self.registration.navigationPreload);\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * If the browser supports Navigation Preload, then this will disable it.\n *\n * @memberof workbox.navigationPreload\n */\n function disable() {\n if (isSupported()) {\n self.addEventListener('activate', event => {\n event.waitUntil(self.registration.navigationPreload.disable().then(() => {\n {\n logger_mjs.logger.log(`Navigation preload is disabled.`);\n }\n }));\n });\n } else {\n {\n logger_mjs.logger.log(`Navigation preload is not supported in this browser.`);\n }\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * If the browser supports Navigation Preload, then this will enable it.\n *\n * @param {string} [headerValue] Optionally, allows developers to\n * [override](https://developers.google.com/web/updates/2017/02/navigation-preload#changing_the_header)\n * the value of the `Service-Worker-Navigation-Preload` header which will be\n * sent to the server when making the navigation request.\n *\n * @memberof workbox.navigationPreload\n */\n function enable(headerValue) {\n if (isSupported()) {\n self.addEventListener('activate', event => {\n event.waitUntil(self.registration.navigationPreload.enable().then(() => {\n // Defaults to Service-Worker-Navigation-Preload: true if not set.\n if (headerValue) {\n self.registration.navigationPreload.setHeaderValue(headerValue);\n }\n\n {\n logger_mjs.logger.log(`Navigation preload is enabled.`);\n }\n }));\n });\n } else {\n {\n logger_mjs.logger.log(`Navigation preload is not supported in this browser.`);\n }\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.disable = disable;\n exports.enable = enable;\n exports.isSupported = isSupported;\n\n return exports;\n\n}({},workbox.core._private));\n"],"file":"workbox-navigation-preload.dev.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-navigation-preload/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.navigationPreload = (function (exports,logger_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:navigation-preload:3.6.3'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2018 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @return {boolean} Whether or not the current browser supports enabling\n * navigation preload.\n *\n * @memberof workbox.navigationPreload\n */\n function isSupported() {\n return Boolean(self.registration && self.registration.navigationPreload);\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * If the browser supports Navigation Preload, then this will disable it.\n *\n * @memberof workbox.navigationPreload\n */\n function disable() {\n if (isSupported()) {\n self.addEventListener('activate', event => {\n event.waitUntil(self.registration.navigationPreload.disable().then(() => {\n {\n logger_mjs.logger.log(`Navigation preload is disabled.`);\n }\n }));\n });\n } else {\n {\n logger_mjs.logger.log(`Navigation preload is not supported in this browser.`);\n }\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * If the browser supports Navigation Preload, then this will enable it.\n *\n * @param {string} [headerValue] Optionally, allows developers to\n * [override](https://developers.google.com/web/updates/2017/02/navigation-preload#changing_the_header)\n * the value of the `Service-Worker-Navigation-Preload` header which will be\n * sent to the server when making the navigation request.\n *\n * @memberof workbox.navigationPreload\n */\n function enable(headerValue) {\n if (isSupported()) {\n self.addEventListener('activate', event => {\n event.waitUntil(self.registration.navigationPreload.enable().then(() => {\n // Defaults to Service-Worker-Navigation-Preload: true if not set.\n if (headerValue) {\n self.registration.navigationPreload.setHeaderValue(headerValue);\n }\n\n {\n logger_mjs.logger.log(`Navigation preload is enabled.`);\n }\n }));\n });\n } else {\n {\n logger_mjs.logger.log(`Navigation preload is not supported in this browser.`);\n }\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.disable = disable;\n exports.enable = enable;\n exports.isSupported = isSupported;\n\n return exports;\n\n}({},workbox.core._private));\n"],"file":"workbox-navigation-preload.dev.js"}
@@ -1,3 +1,3 @@
1
- this.workbox=this.workbox||{},this.workbox.navigationPreload=function(t){"use strict";try{self.workbox.v["workbox:navigation-preload:3.6.2"]=1}catch(t){}function e(){return Boolean(self.registration&&self.registration.navigationPreload)}return t.disable=function(){e()&&self.addEventListener("activate",t=>{t.waitUntil(self.registration.navigationPreload.disable().then(()=>{}))})},t.enable=function(t){e()&&self.addEventListener("activate",e=>{e.waitUntil(self.registration.navigationPreload.enable().then(()=>{t&&self.registration.navigationPreload.setHeaderValue(t)}))})},t.isSupported=e,t}({});
1
+ this.workbox=this.workbox||{},this.workbox.navigationPreload=function(t){"use strict";try{self.workbox.v["workbox:navigation-preload:3.6.3"]=1}catch(t){}function e(){return Boolean(self.registration&&self.registration.navigationPreload)}return t.disable=function(){e()&&self.addEventListener("activate",t=>{t.waitUntil(self.registration.navigationPreload.disable().then(()=>{}))})},t.enable=function(t){e()&&self.addEventListener("activate",e=>{e.waitUntil(self.registration.navigationPreload.enable().then(()=>{t&&self.registration.navigationPreload.setHeaderValue(t)}))})},t.isSupported=e,t}({});
2
2
 
3
3
  //# sourceMappingURL=workbox-navigation-preload.prod.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-navigation-preload/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.navigationPreload=function(t){\"use strict\";try{self.workbox.v[\"workbox:navigation-preload:3.6.2\"]=1}catch(t){}function e(){return Boolean(self.registration&&self.registration.navigationPreload)}return t.disable=function(){e()&&self.addEventListener(\"activate\",t=>{t.waitUntil(self.registration.navigationPreload.disable().then(()=>{}))})},t.enable=function(t){e()&&self.addEventListener(\"activate\",e=>{e.waitUntil(self.registration.navigationPreload.enable().then(()=>{t&&self.registration.navigationPreload.setHeaderValue(t)}))})},t.isSupported=e,t}({});\n"],"file":"workbox-navigation-preload.prod.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-navigation-preload/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.navigationPreload=function(t){\"use strict\";try{self.workbox.v[\"workbox:navigation-preload:3.6.3\"]=1}catch(t){}function e(){return Boolean(self.registration&&self.registration.navigationPreload)}return t.disable=function(){e()&&self.addEventListener(\"activate\",t=>{t.waitUntil(self.registration.navigationPreload.disable().then(()=>{}))})},t.enable=function(t){e()&&self.addEventListener(\"activate\",e=>{e.waitUntil(self.registration.navigationPreload.enable().then(()=>{t&&self.registration.navigationPreload.setHeaderValue(t)}))})},t.isSupported=e,t}({});\n"],"file":"workbox-navigation-preload.prod.js"}
@@ -3,7 +3,7 @@ this.workbox.precaching = (function (DBWrapper_mjs,logger_mjs,cacheNames_mjs,Wor
3
3
  'use strict';
4
4
 
5
5
  try {
6
- self.workbox.v['workbox:precaching:3.6.2'] = 1;
6
+ self.workbox.v['workbox:precaching:3.6.3'] = 1;
7
7
  } catch (e) {} // eslint-disable-line
8
8
 
9
9
  /*
@@ -424,7 +424,7 @@ this.workbox.precaching = (function (DBWrapper_mjs,logger_mjs,cacheNames_mjs,Wor
424
424
  * @return {Response}
425
425
  *
426
426
  * @private
427
- * @memberof module:workbox-precachig
427
+ * @memberof module:workbox-precaching
428
428
  */
429
429
  const cleanRedirect = (() => {
430
430
  var _ref = babelHelpers.asyncToGenerator(function* (response) {
@@ -437,9 +437,11 @@ this.workbox.precaching = (function (DBWrapper_mjs,logger_mjs,cacheNames_mjs,Wor
437
437
  const body = yield bodyPromise;
438
438
 
439
439
  // new Response() is happy when passed either a stream or a Blob.
440
- return new Response(body, ['headers', 'status', 'statusText'].map(function (key) {
441
- return clonedResponse[key];
442
- }));
440
+ return new Response(body, {
441
+ headers: clonedResponse.headers,
442
+ status: clonedResponse.status,
443
+ statusText: clonedResponse.statusText
444
+ });
443
445
  });
444
446
 
445
447
  return function cleanRedirect(_x) {
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-precaching/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.precaching = (function (DBWrapper_mjs,logger_mjs,cacheNames_mjs,WorkboxError_mjs,fetchWrapper_mjs,cacheWrapper_mjs,assert_mjs,getFriendlyURL_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:precaching:3.6.3'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Used as a consistent way of referencing a URL to precache.\n *\n * @private\n * @memberof module:workbox-precaching\n */\n class PrecacheEntry {\n /**\n * This class ensures all cache list entries are consistent and\n * adds cache busting if required.\n *\n * @param {*} originalInput\n * @param {string} url\n * @param {string} revision\n * @param {boolean} shouldCacheBust\n */\n constructor(originalInput, url, revision, shouldCacheBust) {\n this._originalInput = originalInput;\n this._entryId = url;\n this._revision = revision;\n const requestAsCacheKey = new Request(url, { credentials: 'same-origin' });\n this._cacheRequest = requestAsCacheKey;\n this._networkRequest = shouldCacheBust ? this._cacheBustRequest(requestAsCacheKey) : requestAsCacheKey;\n }\n\n /**\n * This method will either use Request.cache option OR append a cache\n * busting parameter to the URL.\n *\n * @param {Request} request The request to cache bust\n * @return {Request} A cachebusted Request\n *\n * @private\n */\n _cacheBustRequest(request) {\n let url = request.url;\n const requestOptions = {\n credentials: 'same-origin'\n };\n if ('cache' in Request.prototype) {\n // Make use of the Request cache mode where we can.\n // Reload skips the HTTP cache for outgoing requests and updates\n // the cache with the returned response.\n requestOptions.cache = 'reload';\n } else {\n const parsedURL = new URL(url, location);\n\n // This is done so the minifier can mangle 'global.encodeURIComponent'\n const _encodeURIComponent = encodeURIComponent;\n\n parsedURL.search += (parsedURL.search ? '&' : '') + _encodeURIComponent(`_workbox-cache-bust`) + '=' + _encodeURIComponent(this._revision);\n url = parsedURL.toString();\n }\n\n return new Request(url, requestOptions);\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n // Allows minifier to mangle this name\n const REVISON_IDB_FIELD = 'revision';\n const URL_IDB_FIELD = 'url';\n const DB_STORE_NAME = 'precached-details-models';\n /**\n * This model will track the relevant information of entries that\n * are cached and their matching revision details.\n *\n * @private\n */\n class PrecachedDetailsModel {\n /**\n * Construct a new model for a specific cache.\n *\n * @param {string} dbName\n * @private\n */\n constructor(dbName) {\n // This ensures the db name contains only letters, numbers, '-', '_' and '$'\n const filteredDBName = dbName.replace(/[^\\w-]/g, '_');\n this._db = new DBWrapper_mjs.DBWrapper(filteredDBName, 2, {\n onupgradeneeded: this._handleUpgrade\n });\n }\n\n /**\n * Should perform an upgrade of indexedDB.\n *\n * @param {Event} evt\n *\n * @private\n */\n _handleUpgrade(evt) {\n const db = evt.target.result;\n if (evt.oldVersion < 2) {\n // IndexedDB version 1 used both 'workbox-precaching' and\n // 'precached-details-model' before upgrading to version 2.\n // Delete them and create a new store with latest schema.\n if (db.objectStoreNames.contains('workbox-precaching')) {\n db.deleteObjectStore('workbox-precaching');\n }\n if (db.objectStoreNames.contains(DB_STORE_NAME)) {\n db.deleteObjectStore(DB_STORE_NAME);\n }\n }\n db.createObjectStore(DB_STORE_NAME);\n }\n\n /**\n * Check if an entry is already cached. Returns false if\n * the entry isn't cached or the revision has changed.\n *\n * @param {string} cacheName\n * @param {PrecacheEntry} precacheEntry\n * @return {boolean}\n *\n * @private\n */\n _isEntryCached(cacheName, precacheEntry) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const revisionDetails = yield _this._getRevision(precacheEntry._entryId);\n if (revisionDetails !== precacheEntry._revision) {\n return false;\n }\n\n const openCache = yield caches.open(cacheName);\n const cachedResponse = yield openCache.match(precacheEntry._cacheRequest);\n return !!cachedResponse;\n })();\n }\n\n /**\n * @return {Promise<Array>}\n *\n * @private\n */\n _getAllEntries() {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this2._db.getAllMatching(DB_STORE_NAME, {\n includeKeys: true\n });\n })();\n }\n\n /**\n * Get the current revision details.\n *\n * @param {Object} entryId\n * @return {Promise<string|null>}\n *\n * @private\n */\n _getRevision(entryId) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const data = yield _this3._db.get(DB_STORE_NAME, entryId);\n return data ? data[REVISON_IDB_FIELD] : null;\n })();\n }\n\n /**\n * Add an entry to the details model.\n *\n * @param {PrecacheEntry} precacheEntry\n *\n * @private\n */\n _addEntry(precacheEntry) {\n var _this4 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this4._db.put(DB_STORE_NAME, {\n [REVISON_IDB_FIELD]: precacheEntry._revision,\n [URL_IDB_FIELD]: precacheEntry._cacheRequest.url\n }, precacheEntry._entryId);\n })();\n }\n\n /**\n * Delete entry from details model.\n *\n * @param {string} entryId\n *\n * @private\n */\n _deleteEntry(entryId) {\n var _this5 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this5._db.delete(DB_STORE_NAME, entryId);\n })();\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * This method will print out a warning if a precache entry doesn't have\n * a `revision` value.\n *\n * This is common if the asset if revisioned in the url like `index.1234.css`.\n *\n * @param {Map} entriesMap\n *\n * @private\n * @memberof module:workbox-preaching\n */\n var showWarningsIfNeeded = (entriesMap => {\n const urlOnlyEntries = [];\n entriesMap.forEach(entry => {\n if (typeof entry === 'string' || !entry._originalInput.revision) {\n urlOnlyEntries.push(entry._originalInput);\n }\n });\n\n if (urlOnlyEntries.length === 0) {\n // No warnings needed.\n return;\n }\n\n logger_mjs.logger.groupCollapsed('Are your precached assets revisioned?');\n\n const urlsList = urlOnlyEntries.map(urlOnlyEntry => {\n return ` - ${JSON.stringify(urlOnlyEntry)}`;\n }).join(`\\n`);\n\n logger_mjs.logger.warn(`The following precache entries might not be revisioned:` + `\\n\\n` + urlsList + `\\n\\n`);\n\n logger_mjs.logger.unprefixed.warn(`You can learn more about why this might be a ` + `problem here: https://developers.google.com/web/tools/workbox/modules/workbox-precaching`);\n\n logger_mjs.logger.groupEnd();\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @param {string} groupTitle\n * @param {Array<PrecacheEntry>} entries\n *\n * @private\n */\n const _nestedGroup = (groupTitle, entries) => {\n if (entries.length === 0) {\n return;\n }\n\n logger_mjs.logger.groupCollapsed(groupTitle);\n\n entries.forEach(entry => {\n logger_mjs.logger.log(entry._originalInput);\n });\n\n logger_mjs.logger.groupEnd();\n };\n\n /**\n * @param {Array<Object>} entriesToPrecache\n * @param {Array<Object>} alreadyPrecachedEntries\n *\n * @private\n * @memberof module:workbox-precachig\n */\n var printInstallDetails = ((entriesToPrecache, alreadyPrecachedEntries) => {\n // Goal is to print the message:\n // Precaching X files.\n // Or:\n // Precaching X files. Y files were cached and up-to-date.\n\n const precachedCount = entriesToPrecache.length;\n const alreadyPrecachedCount = alreadyPrecachedEntries.length;\n let printText = `Precaching ${precachedCount} file${precachedCount === 1 ? '' : 's'}.`;\n if (alreadyPrecachedCount > 0) {\n printText += ` ${alreadyPrecachedCount} ` + `file${alreadyPrecachedCount === 1 ? ' is' : 's are'} already cached.`;\n }\n\n logger_mjs.logger.groupCollapsed(printText);\n\n _nestedGroup(`View precached URLs.`, entriesToPrecache);\n _nestedGroup(`View URLs that were already precached.`, alreadyPrecachedEntries);\n logger_mjs.logger.groupEnd();\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const logGroup = (groupTitle, urls) => {\n logger_mjs.logger.groupCollapsed(groupTitle);\n\n urls.forEach(url => {\n logger_mjs.logger.log(url);\n });\n\n logger_mjs.logger.groupEnd();\n };\n\n /**\n * @param {Array<string>} deletedCacheRequests\n * @param {Array<string>} deletedRevisionDetails\n *\n * @private\n * @memberof module:workbox-precachig\n */\n var printCleanupDetails = ((deletedCacheRequests, deletedRevisionDetails) => {\n if (deletedCacheRequests.length === 0 && deletedRevisionDetails.length === 0) {\n return;\n }\n\n const cacheDeleteCount = deletedCacheRequests.length;\n const revisionDeleteCount = deletedRevisionDetails.length;\n\n const cacheDeleteText = `${cacheDeleteCount} cached ` + `request${cacheDeleteCount === 1 ? ' was' : 's were'} deleted`;\n const revisionDeleteText = `${revisionDeleteCount} ` + `${revisionDeleteCount === 1 ? 'entry' : 'entries'} ` + `${revisionDeleteCount === 1 ? 'was' : 'were'} deleted from IndexedDB.`;\n\n logger_mjs.logger.groupCollapsed(`During precaching cleanup, ${cacheDeleteText} and ${revisionDeleteText}`);\n\n logGroup('Deleted Cache Requests', deletedCacheRequests);\n logGroup('Revision Details Deleted from DB', deletedRevisionDetails);\n\n logger_mjs.logger.groupEnd();\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @param {Response} response\n * @return {Response}\n *\n * @private\n * @memberof module:workbox-precaching\n */\n const cleanRedirect = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* (response) {\n const clonedResponse = response.clone();\n\n // Not all browsers support the Response.body stream, so fall back\n // to reading the entire body into memory as a blob.\n const bodyPromise = 'body' in clonedResponse ? Promise.resolve(clonedResponse.body) : clonedResponse.blob();\n\n const body = yield bodyPromise;\n\n // new Response() is happy when passed either a stream or a Blob.\n return new Response(body, {\n headers: clonedResponse.headers,\n status: clonedResponse.status,\n statusText: clonedResponse.statusText\n });\n });\n\n return function cleanRedirect(_x) {\n return _ref.apply(this, arguments);\n };\n })();\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Performs efficient precaching of assets.\n *\n * @memberof workbox.precaching\n */\n class PrecacheController {\n /**\n * Create a new PrecacheController.\n *\n * @param {string} cacheName\n */\n constructor(cacheName) {\n this._cacheName = cacheNames_mjs.cacheNames.getPrecacheName(cacheName);\n this._entriesToCacheMap = new Map();\n this._precacheDetailsModel = new PrecachedDetailsModel(this._cacheName);\n }\n\n /**\n * This method will add items to the precache list, removing duplicates\n * and ensuring the information is valid.\n *\n * @param {\n * Array<module:workbox-precaching.PrecacheController.PrecacheEntry|string>\n * } entries Array of entries to\n * precache.\n */\n addToCacheList(entries) {\n {\n assert_mjs.assert.isArray(entries, {\n moduleName: 'workbox-precaching',\n className: 'PrecacheController',\n funcName: 'addToCacheList',\n paramName: 'entries'\n });\n }\n\n entries.map(userEntry => {\n this._addEntryToCacheList(this._parseEntry(userEntry));\n });\n }\n\n /**\n * This method returns a precache entry.\n *\n * @private\n * @param {string|Object} input\n * @return {PrecacheEntry}\n */\n _parseEntry(input) {\n switch (typeof input) {\n case 'string':\n {\n {\n if (input.length === 0) {\n throw new WorkboxError_mjs.WorkboxError('add-to-cache-list-unexpected-type', {\n entry: input\n });\n }\n }\n\n return new PrecacheEntry(input, input, input);\n }\n case 'object':\n {\n {\n if (!input || !input.url) {\n throw new WorkboxError_mjs.WorkboxError('add-to-cache-list-unexpected-type', {\n entry: input\n });\n }\n }\n\n return new PrecacheEntry(input, input.url, input.revision || input.url, !!input.revision);\n }\n default:\n throw new WorkboxError_mjs.WorkboxError('add-to-cache-list-unexpected-type', {\n entry: input\n });\n }\n }\n\n /**\n * Adds an entry to the precache list, accounting for possible duplicates.\n *\n * @private\n * @param {PrecacheEntry} entryToAdd\n */\n _addEntryToCacheList(entryToAdd) {\n // Check if the entry is already part of the map\n const existingEntry = this._entriesToCacheMap.get(entryToAdd._entryId);\n if (!existingEntry) {\n this._entriesToCacheMap.set(entryToAdd._entryId, entryToAdd);\n return;\n }\n\n // Duplicates are fine, but make sure the revision information\n // is the same.\n if (existingEntry._revision !== entryToAdd._revision) {\n throw new WorkboxError_mjs.WorkboxError('add-to-cache-list-conflicting-entries', {\n firstEntry: existingEntry._originalInput,\n secondEntry: entryToAdd._originalInput\n });\n }\n }\n\n /**\n * Call this method from a service work install event to start\n * precaching assets.\n *\n * @param {Object} options\n * @param {boolean} [options.suppressWarnings] Suppress warning messages.\n * @param {Event} [options.event] The install event (if needed).\n * @param {Array<Object>} [options.plugins] Plugins to be used for fetching\n * and caching during install.\n * @return {Promise<workbox.precaching.InstallResult>}\n */\n install({ suppressWarnings = false, event, plugins } = {}) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n if (suppressWarnings !== true) {\n showWarningsIfNeeded(_this._entriesToCacheMap);\n }\n\n if (plugins) {\n assert_mjs.assert.isArray(plugins, {\n moduleName: 'workbox-precaching',\n className: 'PrecacheController',\n funcName: 'install',\n paramName: 'plugins'\n });\n }\n }\n\n // Empty the temporary cache.\n // NOTE: We remove all entries instead of deleting the cache as the cache\n // may be marked for deletion but still exist until a later stage\n // resulting in unexpected behavior of being deletect when all references\n // are dropped.\n // https://github.com/GoogleChrome/workbox/issues/1368\n const tempCache = yield caches.open(_this._getTempCacheName());\n const requests = yield tempCache.keys();\n yield Promise.all(requests.map(function (request) {\n return tempCache.delete(request);\n }));\n\n const entriesToPrecache = [];\n const entriesAlreadyPrecached = [];\n\n for (const precacheEntry of _this._entriesToCacheMap.values()) {\n if (yield _this._precacheDetailsModel._isEntryCached(_this._cacheName, precacheEntry)) {\n entriesAlreadyPrecached.push(precacheEntry);\n } else {\n entriesToPrecache.push(precacheEntry);\n }\n }\n\n // Wait for all requests to be cached.\n yield Promise.all(entriesToPrecache.map(function (precacheEntry) {\n return _this._cacheEntryInTemp({ event, plugins, precacheEntry });\n }));\n\n {\n printInstallDetails(entriesToPrecache, entriesAlreadyPrecached);\n }\n\n return {\n updatedEntries: entriesToPrecache,\n notUpdatedEntries: entriesAlreadyPrecached\n };\n })();\n }\n\n /**\n * Takes the current set of temporary files and moves them to the final\n * cache, deleting the temporary cache once copying is complete.\n *\n * @param {Object} options\n * @param {Array<Object>} options.plugins Plugins to be used for fetching\n * and caching during install.\n * @return {\n * Promise<workbox.precaching.CleanupResult>}\n * Resolves with an object containing details of the deleted cache requests\n * and precache revision details.\n */\n activate(options = {}) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const tempCache = yield caches.open(_this2._getTempCacheName());\n\n const requests = yield tempCache.keys();\n // Process each request/response one at a time, deleting the temporary entry\n // when done, to help avoid triggering quota errors.\n for (const request of requests) {\n const response = yield tempCache.match(request);\n yield cacheWrapper_mjs.cacheWrapper.put({\n cacheName: _this2._cacheName,\n request,\n response,\n plugins: options.plugins\n });\n yield tempCache.delete(request);\n }\n\n return _this2._cleanup();\n })();\n }\n\n /**\n * Returns the name of the temporary cache.\n *\n * @return {string}\n *\n * @private\n */\n _getTempCacheName() {\n return `${this._cacheName}-temp`;\n }\n\n /**\n * Requests the entry and saves it to the cache if the response\n * is valid.\n *\n * @private\n * @param {Object} options\n * @param {BaseCacheEntry} options.precacheEntry The entry to fetch and cache.\n * @param {Event} [options.event] The install event (if passed).\n * @param {Array<Object>} [options.plugins] An array of plugins to apply to\n * fetch and caching.\n * @return {Promise<boolean>} Returns a promise that resolves once the entry\n * has been fetched and cached or skipped if no update is needed. The\n * promise resolves with true if the entry was cached / updated and\n * false if the entry is already cached and up-to-date.\n */\n _cacheEntryInTemp({ precacheEntry, event, plugins }) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n let response = yield fetchWrapper_mjs.fetchWrapper.fetch({\n request: precacheEntry._networkRequest,\n event,\n fetchOptions: null,\n plugins\n });\n\n if (response.redirected) {\n response = yield cleanRedirect(response);\n }\n\n yield cacheWrapper_mjs.cacheWrapper.put({\n cacheName: _this3._getTempCacheName(),\n request: precacheEntry._cacheRequest,\n response,\n event,\n plugins\n });\n\n yield _this3._precacheDetailsModel._addEntry(precacheEntry);\n\n return true;\n })();\n }\n\n /**\n * Compare the URLs and determines which assets are no longer required\n * in the cache.\n *\n * This should be called in the service worker activate event.\n *\n * @return {\n * Promise<workbox.precaching.CleanupResult>}\n * Resolves with an object containing details of the deleted cache requests\n * and precache revision details.\n *\n * @private\n */\n _cleanup() {\n var _this4 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const expectedCacheUrls = [];\n _this4._entriesToCacheMap.forEach(function (entry) {\n const fullUrl = new URL(entry._cacheRequest.url, location).toString();\n expectedCacheUrls.push(fullUrl);\n });\n\n const [deletedCacheRequests, deletedRevisionDetails] = yield Promise.all([_this4._cleanupCache(expectedCacheUrls), _this4._cleanupDetailsModel(expectedCacheUrls)]);\n\n {\n printCleanupDetails(deletedCacheRequests, deletedRevisionDetails);\n }\n\n return {\n deletedCacheRequests,\n deletedRevisionDetails\n };\n })();\n }\n\n /**\n * Goes through all the cache entries and removes any that are\n * outdated.\n *\n * @private\n * @param {Array<string>} expectedCacheUrls Array of URLs that are\n * expected to be cached.\n * @return {Promise<Array<string>>} Resolves to an array of URLs\n * of cached requests that were deleted.\n */\n _cleanupCache(expectedCacheUrls) {\n var _this5 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (!(yield caches.has(_this5._cacheName))) {\n // Cache doesn't exist, so nothing to delete\n return [];\n }\n\n const cache = yield caches.open(_this5._cacheName);\n const cachedRequests = yield cache.keys();\n const cachedRequestsToDelete = cachedRequests.filter(function (cachedRequest) {\n return !expectedCacheUrls.includes(new URL(cachedRequest.url, location).toString());\n });\n\n yield Promise.all(cachedRequestsToDelete.map(function (cacheUrl) {\n return cache.delete(cacheUrl);\n }));\n\n return cachedRequestsToDelete.map(function (request) {\n return request.url;\n });\n })();\n }\n\n /**\n * Goes through all entries in indexedDB and removes any that are outdated.\n *\n * @private\n * @param {Array<string>} expectedCacheUrls Array of URLs that are\n * expected to be cached.\n * @return {Promise<Array<string>>} Resolves to an array of URLs removed\n * from indexedDB.\n */\n _cleanupDetailsModel(expectedCacheUrls) {\n var _this6 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const revisionedEntries = yield _this6._precacheDetailsModel._getAllEntries();\n const detailsToDelete = revisionedEntries.filter(function (entry) {\n const fullUrl = new URL(entry.value.url, location).toString();\n return !expectedCacheUrls.includes(fullUrl);\n });\n\n yield Promise.all(detailsToDelete.map(function (entry) {\n return _this6._precacheDetailsModel._deleteEntry(entry.primaryKey);\n }));\n return detailsToDelete.map(function (entry) {\n return entry.value.url;\n });\n })();\n }\n\n /**\n * Returns an array of fully qualified URL's that will be precached.\n *\n * @return {Array<string>} An array of URLs.\n */\n getCachedUrls() {\n return Array.from(this._entriesToCacheMap.keys()).map(url => new URL(url, location).href);\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var publicAPI = /*#__PURE__*/Object.freeze({\n PrecacheController: PrecacheController\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n {\n assert_mjs.assert.isSwEnv('workbox-precaching');\n }\n\n let installActivateListenersAdded = false;\n let fetchListenersAdded = false;\n let suppressWarnings = false;\n let plugins = [];\n\n const cacheName = cacheNames_mjs.cacheNames.getPrecacheName();\n const precacheController = new PrecacheController(cacheName);\n\n const _removeIgnoreUrlParams = (origUrlObject, ignoreUrlParametersMatching) => {\n // Exclude initial '?'\n const searchString = origUrlObject.search.slice(1);\n\n // Split into an array of 'key=value' strings\n const keyValueStrings = searchString.split('&');\n const keyValuePairs = keyValueStrings.map(keyValueString => {\n // Split each 'key=value' string into a [key, value] array\n return keyValueString.split('=');\n });\n const filteredKeyValuesPairs = keyValuePairs.filter(keyValuePair => {\n return ignoreUrlParametersMatching.every(ignoredRegex => {\n // Return true iff the key doesn't match any of the regexes.\n return !ignoredRegex.test(keyValuePair[0]);\n });\n });\n const filteredStrings = filteredKeyValuesPairs.map(keyValuePair => {\n // Join each [key, value] array into a 'key=value' string\n return keyValuePair.join('=');\n });\n\n // Join the array of 'key=value' strings into a string with '&' in\n // between each\n const urlClone = new URL(origUrlObject);\n urlClone.search = filteredStrings.join('&');\n return urlClone;\n };\n\n /**\n * This function will take the request URL and manipulate it based on the\n * configuration options.\n *\n * @param {string} url\n * @param {Object} options\n * @return {string|null} Returns the URL in the cache that matches the request\n * if available, other null.\n *\n * @private\n */\n const _getPrecachedUrl = (url, {\n ignoreUrlParametersMatching = [/^utm_/],\n directoryIndex = 'index.html',\n cleanUrls = true,\n urlManipulation = null\n } = {}) => {\n const urlObject = new URL(url, location);\n\n // Change '/some-url#123' => '/some-url'\n urlObject.hash = '';\n\n const urlWithoutIgnoredParams = _removeIgnoreUrlParams(urlObject, ignoreUrlParametersMatching);\n\n let urlsToAttempt = [\n // Test the URL that was fetched\n urlObject,\n // Test the URL without search params\n urlWithoutIgnoredParams];\n\n // Test the URL with a directory index\n if (directoryIndex && urlWithoutIgnoredParams.pathname.endsWith('/')) {\n const directoryUrl = new URL(urlWithoutIgnoredParams);\n directoryUrl.pathname += directoryIndex;\n urlsToAttempt.push(directoryUrl);\n }\n\n // Test the URL with a '.html' extension\n if (cleanUrls) {\n const cleanUrl = new URL(urlWithoutIgnoredParams);\n cleanUrl.pathname += '.html';\n urlsToAttempt.push(cleanUrl);\n }\n\n if (urlManipulation) {\n const additionalUrls = urlManipulation({ url: urlObject });\n urlsToAttempt = urlsToAttempt.concat(additionalUrls);\n }\n\n const cachedUrls = precacheController.getCachedUrls();\n for (const possibleUrl of urlsToAttempt) {\n if (cachedUrls.indexOf(possibleUrl.href) !== -1) {\n // It's a perfect match\n {\n logger_mjs.logger.debug(`Precaching found a match for ` + getFriendlyURL_mjs.getFriendlyURL(possibleUrl.toString()));\n }\n return possibleUrl.href;\n }\n }\n\n return null;\n };\n\n const moduleExports = {};\n\n /**\n * Add items to the precache list, removing any duplicates and\n * store the files in the\n * [\"precache cache\"]{@link module:workbox-core.cacheNames} when the service\n * worker installs.\n *\n * This method can be called multiple times.\n *\n * Please note: This method **will not** serve any of the cached files for you,\n * it only precaches files. To respond to a network request you call\n * [addRoute()]{@link module:workbox-precaching.addRoute}.\n *\n * If you have a single array of files to precache, you can just call\n * [precacheAndRoute()]{@link module:workbox-precaching.precacheAndRoute}.\n *\n * @param {Array<Object|string>} entries Array of entries to precache.\n *\n * @alias workbox.precaching.precache\n */\n moduleExports.precache = entries => {\n precacheController.addToCacheList(entries);\n\n if (installActivateListenersAdded || entries.length <= 0) {\n return;\n }\n\n installActivateListenersAdded = true;\n self.addEventListener('install', event => {\n event.waitUntil(precacheController.install({\n event,\n plugins,\n suppressWarnings\n }));\n });\n self.addEventListener('activate', event => {\n event.waitUntil(precacheController.activate({\n event,\n plugins\n }));\n });\n };\n\n /**\n * Add a `fetch` listener to the service worker that will\n * respond to\n * [network requests]{@link https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers#Custom_responses_to_requests}\n * with precached assets.\n *\n * Requests for assets that aren't precached, the `FetchEvent` will not be\n * responded to, allowing the event to fall through to other `fetch` event\n * listeners.\n *\n * @param {Object} options\n * @param {string} [options.directoryIndex=index.html] The `directoryIndex` will\n * check cache entries for a URLs ending with '/' to see if there is a hit when\n * appending the `directoryIndex` value.\n * @param {Array<RegExp>} [options.ignoreUrlParametersMatching=[/^utm_/]] An\n * array of regex's to remove search params when looking for a cache match.\n * @param {boolean} [options.cleanUrls=true] The `cleanUrls` option will\n * check the cache for the URL with a `.html` added to the end of the end.\n * @param {workbox.precaching~urlManipulation} [options.urlManipulation]\n * This is a function that should take a URL and return an array of\n * alternative URL's that should be checked for precache matches.\n *\n * @alias workbox.precaching.addRoute\n */\n moduleExports.addRoute = options => {\n if (fetchListenersAdded) {\n // TODO: Throw error here.\n return;\n }\n\n fetchListenersAdded = true;\n self.addEventListener('fetch', event => {\n const precachedUrl = _getPrecachedUrl(event.request.url, options);\n if (!precachedUrl) {\n {\n logger_mjs.logger.debug(`Precaching found no match for ` + getFriendlyURL_mjs.getFriendlyURL(event.request.url));\n }\n return;\n }\n\n let responsePromise = caches.open(cacheName).then(cache => {\n return cache.match(precachedUrl);\n }).then(cachedResponse => {\n if (cachedResponse) {\n return cachedResponse;\n }\n\n // Fall back to the network if we don't have a cached response (perhaps\n // due to manual cache cleanup).\n {\n logger_mjs.logger.debug(`The precached response for ` + `${getFriendlyURL_mjs.getFriendlyURL(precachedUrl)} in ${cacheName} was not found. ` + `Falling back to the network instead.`);\n }\n\n return fetch(precachedUrl);\n });\n\n {\n responsePromise = responsePromise.then(response => {\n // Workbox is going to handle the route.\n // print the routing details to the console.\n logger_mjs.logger.groupCollapsed(`Precaching is responding to: ` + getFriendlyURL_mjs.getFriendlyURL(event.request.url));\n logger_mjs.logger.log(`Serving the precached url: ${precachedUrl}`);\n\n // The Request and Response objects contains a great deal of\n // information, hide it under a group in case developers want to see it.\n logger_mjs.logger.groupCollapsed(`View request details here.`);\n logger_mjs.logger.unprefixed.log(event.request);\n logger_mjs.logger.groupEnd();\n\n logger_mjs.logger.groupCollapsed(`View response details here.`);\n logger_mjs.logger.unprefixed.log(response);\n logger_mjs.logger.groupEnd();\n\n logger_mjs.logger.groupEnd();\n return response;\n });\n }\n event.respondWith(responsePromise);\n });\n };\n\n /**\n * This method will add entries to the precache list and add a route to\n * respond to fetch events.\n *\n * This is a convenience method that will call\n * [precache()]{@link module:workbox-precaching.precache} and\n * [addRoute()]{@link module:workbox-precaching.addRoute} in a single call.\n *\n * @param {Array<Object|string>} entries Array of entries to precache.\n * @param {Object} options See\n * [addRoute() options]{@link module:workbox-precaching.addRoute}.\n *\n * @alias workbox.precaching.precacheAndRoute\n */\n moduleExports.precacheAndRoute = (entries, options) => {\n moduleExports.precache(entries);\n moduleExports.addRoute(options);\n };\n\n /**\n * Warnings will be logged if any of the precached assets are entered without\n * a `revision` property. This is extremely dangerous if the URL's aren't\n * revisioned. However, the warnings can be supressed with this method.\n *\n * @param {boolean} suppress\n *\n * @alias workbox.precaching.suppressWarnings\n */\n moduleExports.suppressWarnings = suppress => {\n suppressWarnings = suppress;\n };\n\n /**\n * Add plugins to precaching.\n *\n * @param {Array<Object>} newPlugins\n *\n * @alias workbox.precaching.addPlugins\n */\n moduleExports.addPlugins = newPlugins => {\n plugins = plugins.concat(newPlugins);\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const finalExport = Object.assign(moduleExports, publicAPI);\n\n return finalExport;\n\n}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));\n"],"file":"workbox-precaching.dev.js"}
@@ -0,0 +1,3 @@
1
+ this.workbox=this.workbox||{},this.workbox.precaching=function(e,t,n,r,s){"use strict";try{self.workbox.v["workbox:precaching:3.6.3"]=1}catch(e){}class i{constructor(e,t,n,r){this.e=e,this.t=t,this.n=n;const s=new Request(t,{credentials:"same-origin"});this.r=s,this.s=r?this.i(s):s}i(e){let t=e.url;const n={credentials:"same-origin"};if("cache"in Request.prototype)n.cache="reload";else{const e=new URL(t,location),n=encodeURIComponent;e.search+=(e.search?"&":"")+n("_workbox-cache-bust")+"="+n(this.n),t=e.toString()}return new Request(t,n)}}const c="revision",o="url",l="precached-details-models";class a{constructor(t){const n=t.replace(/[^\w-]/g,"_");this.c=new e.DBWrapper(n,2,{onupgradeneeded:this.o})}o(e){const t=e.target.result;e.oldVersion<2&&(t.objectStoreNames.contains("workbox-precaching")&&t.deleteObjectStore("workbox-precaching"),t.objectStoreNames.contains(l)&&t.deleteObjectStore(l)),t.createObjectStore(l)}l(e,t){var n=this;return babelHelpers.asyncToGenerator(function*(){return(yield n.a(t.t))===t.n&&!!(yield(yield caches.open(e)).match(t.r))})()}u(){var e=this;return babelHelpers.asyncToGenerator(function*(){return yield e.c.getAllMatching(l,{includeKeys:!0})})()}a(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=yield t.c.get(l,e);return n?n[c]:null})()}d(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.c.put(l,{[c]:e.n,[o]:e.r.url},e.t)})()}h(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.c.delete(l,e)})()}}const u=(d=babelHelpers.asyncToGenerator(function*(e){const t=e.clone(),n=yield"body"in t?Promise.resolve(t.body):t.blob();return new Response(n,{headers:t.headers,status:t.status,statusText:t.statusText})}),function(e){return d.apply(this,arguments)});var d;class h{constructor(e){this.p=t.cacheNames.getPrecacheName(e),this.f=new Map,this.y=new a(this.p)}addToCacheList(e){e.map(e=>{this.b(this.w(e))})}w(e){switch(typeof e){case"string":return new i(e,e,e);case"object":return new i(e,e.url,e.revision||e.url,!!e.revision);default:throw new n.WorkboxError("add-to-cache-list-unexpected-type",{entry:e})}}b(e){const t=this.f.get(e.t);if(t){if(t.n!==e.n)throw new n.WorkboxError("add-to-cache-list-conflicting-entries",{firstEntry:t.e,secondEntry:e.e})}else this.f.set(e.t,e)}install({suppressWarnings:e=!1,event:t,plugins:n}={}){var r=this;return babelHelpers.asyncToGenerator(function*(){const e=yield caches.open(r.g()),s=yield e.keys();yield Promise.all(s.map(function(t){return e.delete(t)}));const i=[],c=[];for(const e of r.f.values())(yield r.y.l(r.p,e))?c.push(e):i.push(e);return yield Promise.all(i.map(function(e){return r.m({event:t,plugins:n,precacheEntry:e})})),{updatedEntries:i,notUpdatedEntries:c}})()}activate(e={}){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=yield caches.open(t.g()),r=yield n.keys();for(const i of r){const r=yield n.match(i);yield s.cacheWrapper.put({cacheName:t.p,request:i,response:r,plugins:e.plugins}),yield n.delete(i)}return t.R()})()}g(){return`${this.p}-temp`}m({precacheEntry:e,event:t,plugins:n}){var i=this;return babelHelpers.asyncToGenerator(function*(){let c=yield r.fetchWrapper.fetch({request:e.s,event:t,fetchOptions:null,plugins:n});return c.redirected&&(c=yield u(c)),yield s.cacheWrapper.put({cacheName:i.g(),request:e.r,response:c,event:t,plugins:n}),yield i.y.d(e),!0})()}R(){var e=this;return babelHelpers.asyncToGenerator(function*(){const t=[];e.f.forEach(function(e){const n=new URL(e.r.url,location).toString();t.push(n)});const[n,r]=yield Promise.all([e._(t),e.U(t)]);return{deletedCacheRequests:n,deletedRevisionDetails:r}})()}_(e){var t=this;return babelHelpers.asyncToGenerator(function*(){if(!(yield caches.has(t.p)))return[];const n=yield caches.open(t.p),r=(yield n.keys()).filter(function(t){return!e.includes(new URL(t.url,location).toString())});return yield Promise.all(r.map(function(e){return n.delete(e)})),r.map(function(e){return e.url})})()}U(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=(yield t.y.u()).filter(function(t){const n=new URL(t.value.url,location).toString();return!e.includes(n)});return yield Promise.all(n.map(function(e){return t.y.h(e.primaryKey)})),n.map(function(e){return e.value.url})})()}getCachedUrls(){return Array.from(this.f.keys()).map(e=>new URL(e,location).href)}}var p=Object.freeze({PrecacheController:h});let f=!1,y=!1,b=!1,w=[];const g=t.cacheNames.getPrecacheName(),v=new h(g),m=(e,{ignoreUrlParametersMatching:t=[/^utm_/],directoryIndex:n="index.html",cleanUrls:r=!0,urlManipulation:s=null}={})=>{const i=new URL(e,location);i.hash="";const c=((e,t)=>{const n=e.search.slice(1).split("&").map(e=>e.split("=")).filter(e=>t.every(t=>!t.test(e[0]))).map(e=>e.join("=")),r=new URL(e);return r.search=n.join("&"),r})(i,t);let o=[i,c];if(n&&c.pathname.endsWith("/")){const e=new URL(c);e.pathname+=n,o.push(e)}if(r){const e=new URL(c);e.pathname+=".html",o.push(e)}if(s){const e=s({url:i});o=o.concat(e)}const l=v.getCachedUrls();for(const e of o)if(-1!==l.indexOf(e.href))return e.href;return null},R={precache:e=>{v.addToCacheList(e),f||e.length<=0||(f=!0,self.addEventListener("install",e=>{e.waitUntil(v.install({event:e,plugins:w,suppressWarnings:b}))}),self.addEventListener("activate",e=>{e.waitUntil(v.activate({event:e,plugins:w}))}))},addRoute:e=>{y||(y=!0,self.addEventListener("fetch",t=>{const n=m(t.request.url,e);if(!n)return;let r=caches.open(g).then(e=>e.match(n)).then(e=>e||fetch(n));t.respondWith(r)}))},precacheAndRoute:(e,t)=>{R.precache(e),R.addRoute(t)},suppressWarnings:e=>{b=e},addPlugins:e=>{w=w.concat(e)}};return Object.assign(R,p)}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private);
2
+
3
+ //# sourceMappingURL=workbox-precaching.prod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-precaching/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.precaching=function(e,t,n,r,s){\"use strict\";try{self.workbox.v[\"workbox:precaching:3.6.3\"]=1}catch(e){}class i{constructor(e,t,n,r){this.e=e,this.t=t,this.n=n;const s=new Request(t,{credentials:\"same-origin\"});this.r=s,this.s=r?this.i(s):s}i(e){let t=e.url;const n={credentials:\"same-origin\"};if(\"cache\"in Request.prototype)n.cache=\"reload\";else{const e=new URL(t,location),n=encodeURIComponent;e.search+=(e.search?\"&\":\"\")+n(\"_workbox-cache-bust\")+\"=\"+n(this.n),t=e.toString()}return new Request(t,n)}}const c=\"revision\",o=\"url\",l=\"precached-details-models\";class a{constructor(t){const n=t.replace(/[^\\w-]/g,\"_\");this.c=new e.DBWrapper(n,2,{onupgradeneeded:this.o})}o(e){const t=e.target.result;e.oldVersion<2&&(t.objectStoreNames.contains(\"workbox-precaching\")&&t.deleteObjectStore(\"workbox-precaching\"),t.objectStoreNames.contains(l)&&t.deleteObjectStore(l)),t.createObjectStore(l)}l(e,t){var n=this;return babelHelpers.asyncToGenerator(function*(){return(yield n.a(t.t))===t.n&&!!(yield(yield caches.open(e)).match(t.r))})()}u(){var e=this;return babelHelpers.asyncToGenerator(function*(){return yield e.c.getAllMatching(l,{includeKeys:!0})})()}a(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=yield t.c.get(l,e);return n?n[c]:null})()}d(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.c.put(l,{[c]:e.n,[o]:e.r.url},e.t)})()}h(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.c.delete(l,e)})()}}const u=(d=babelHelpers.asyncToGenerator(function*(e){const t=e.clone(),n=yield\"body\"in t?Promise.resolve(t.body):t.blob();return new Response(n,{headers:t.headers,status:t.status,statusText:t.statusText})}),function(e){return d.apply(this,arguments)});var d;class h{constructor(e){this.p=t.cacheNames.getPrecacheName(e),this.f=new Map,this.y=new a(this.p)}addToCacheList(e){e.map(e=>{this.b(this.w(e))})}w(e){switch(typeof e){case\"string\":return new i(e,e,e);case\"object\":return new i(e,e.url,e.revision||e.url,!!e.revision);default:throw new n.WorkboxError(\"add-to-cache-list-unexpected-type\",{entry:e})}}b(e){const t=this.f.get(e.t);if(t){if(t.n!==e.n)throw new n.WorkboxError(\"add-to-cache-list-conflicting-entries\",{firstEntry:t.e,secondEntry:e.e})}else this.f.set(e.t,e)}install({suppressWarnings:e=!1,event:t,plugins:n}={}){var r=this;return babelHelpers.asyncToGenerator(function*(){const e=yield caches.open(r.g()),s=yield e.keys();yield Promise.all(s.map(function(t){return e.delete(t)}));const i=[],c=[];for(const e of r.f.values())(yield r.y.l(r.p,e))?c.push(e):i.push(e);return yield Promise.all(i.map(function(e){return r.m({event:t,plugins:n,precacheEntry:e})})),{updatedEntries:i,notUpdatedEntries:c}})()}activate(e={}){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=yield caches.open(t.g()),r=yield n.keys();for(const i of r){const r=yield n.match(i);yield s.cacheWrapper.put({cacheName:t.p,request:i,response:r,plugins:e.plugins}),yield n.delete(i)}return t.R()})()}g(){return`${this.p}-temp`}m({precacheEntry:e,event:t,plugins:n}){var i=this;return babelHelpers.asyncToGenerator(function*(){let c=yield r.fetchWrapper.fetch({request:e.s,event:t,fetchOptions:null,plugins:n});return c.redirected&&(c=yield u(c)),yield s.cacheWrapper.put({cacheName:i.g(),request:e.r,response:c,event:t,plugins:n}),yield i.y.d(e),!0})()}R(){var e=this;return babelHelpers.asyncToGenerator(function*(){const t=[];e.f.forEach(function(e){const n=new URL(e.r.url,location).toString();t.push(n)});const[n,r]=yield Promise.all([e._(t),e.U(t)]);return{deletedCacheRequests:n,deletedRevisionDetails:r}})()}_(e){var t=this;return babelHelpers.asyncToGenerator(function*(){if(!(yield caches.has(t.p)))return[];const n=yield caches.open(t.p),r=(yield n.keys()).filter(function(t){return!e.includes(new URL(t.url,location).toString())});return yield Promise.all(r.map(function(e){return n.delete(e)})),r.map(function(e){return e.url})})()}U(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=(yield t.y.u()).filter(function(t){const n=new URL(t.value.url,location).toString();return!e.includes(n)});return yield Promise.all(n.map(function(e){return t.y.h(e.primaryKey)})),n.map(function(e){return e.value.url})})()}getCachedUrls(){return Array.from(this.f.keys()).map(e=>new URL(e,location).href)}}var p=Object.freeze({PrecacheController:h});let f=!1,y=!1,b=!1,w=[];const g=t.cacheNames.getPrecacheName(),v=new h(g),m=(e,{ignoreUrlParametersMatching:t=[/^utm_/],directoryIndex:n=\"index.html\",cleanUrls:r=!0,urlManipulation:s=null}={})=>{const i=new URL(e,location);i.hash=\"\";const c=((e,t)=>{const n=e.search.slice(1).split(\"&\").map(e=>e.split(\"=\")).filter(e=>t.every(t=>!t.test(e[0]))).map(e=>e.join(\"=\")),r=new URL(e);return r.search=n.join(\"&\"),r})(i,t);let o=[i,c];if(n&&c.pathname.endsWith(\"/\")){const e=new URL(c);e.pathname+=n,o.push(e)}if(r){const e=new URL(c);e.pathname+=\".html\",o.push(e)}if(s){const e=s({url:i});o=o.concat(e)}const l=v.getCachedUrls();for(const e of o)if(-1!==l.indexOf(e.href))return e.href;return null},R={precache:e=>{v.addToCacheList(e),f||e.length<=0||(f=!0,self.addEventListener(\"install\",e=>{e.waitUntil(v.install({event:e,plugins:w,suppressWarnings:b}))}),self.addEventListener(\"activate\",e=>{e.waitUntil(v.activate({event:e,plugins:w}))}))},addRoute:e=>{y||(y=!0,self.addEventListener(\"fetch\",t=>{const n=m(t.request.url,e);if(!n)return;let r=caches.open(g).then(e=>e.match(n)).then(e=>e||fetch(n));t.respondWith(r)}))},precacheAndRoute:(e,t)=>{R.precache(e),R.addRoute(t)},suppressWarnings:e=>{b=e},addPlugins:e=>{w=w.concat(e)}};return Object.assign(R,p)}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private);\n"],"file":"workbox-precaching.prod.js"}
@@ -3,7 +3,7 @@ this.workbox.rangeRequests = (function (exports,WorkboxError_mjs,assert_mjs,logg
3
3
  'use strict';
4
4
 
5
5
  try {
6
- self.workbox.v['workbox:range-requests:3.6.2'] = 1;
6
+ self.workbox.v['workbox:range-requests:3.6.3'] = 1;
7
7
  } catch (e) {} // eslint-disable-line
8
8
 
9
9
  /*
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-range-requests/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.rangeRequests = (function (exports,WorkboxError_mjs,assert_mjs,logger_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:range-requests:3.6.2'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @param {Blob} blob A source blob.\n * @param {number|null} start The offset to use as the start of the\n * slice.\n * @param {number|null} end The offset to use as the end of the slice.\n * @return {Object} An object with `start` and `end` properties, reflecting\n * the effective boundaries to use given the size of the blob.\n *\n * @private\n */\n function calculateEffectiveBoundaries(blob, start, end) {\n {\n assert_mjs.assert.isInstance(blob, Blob, {\n moduleName: 'workbox-range-requests',\n funcName: 'calculateEffectiveBoundaries',\n paramName: 'blob'\n });\n }\n\n const blobSize = blob.size;\n\n if (end > blobSize || start < 0) {\n throw new WorkboxError_mjs.WorkboxError('range-not-satisfiable', {\n size: blobSize,\n end,\n start\n });\n }\n\n let effectiveStart;\n let effectiveEnd;\n\n if (start === null) {\n effectiveStart = blobSize - end;\n effectiveEnd = blobSize;\n } else if (end === null) {\n effectiveStart = start;\n effectiveEnd = blobSize;\n } else {\n effectiveStart = start;\n // Range values are inclusive, so add 1 to the value.\n effectiveEnd = end + 1;\n }\n\n return {\n start: effectiveStart,\n end: effectiveEnd\n };\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @param {string} rangeHeader A Range: header value.\n * @return {Object} An object with `start` and `end` properties, reflecting\n * the parsed value of the Range: header. If either the `start` or `end` are\n * omitted, then `null` will be returned.\n *\n * @private\n */\n function parseRangeHeader(rangeHeader) {\n {\n assert_mjs.assert.isType(rangeHeader, 'string', {\n moduleName: 'workbox-range-requests',\n funcName: 'parseRangeHeader',\n paramName: 'rangeHeader'\n });\n }\n\n const normalizedRangeHeader = rangeHeader.trim().toLowerCase();\n if (!normalizedRangeHeader.startsWith('bytes=')) {\n throw new WorkboxError_mjs.WorkboxError('unit-must-be-bytes', { normalizedRangeHeader });\n }\n\n // Specifying multiple ranges separate by commas is valid syntax, but this\n // library only attempts to handle a single, contiguous sequence of bytes.\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range#Syntax\n if (normalizedRangeHeader.includes(',')) {\n throw new WorkboxError_mjs.WorkboxError('single-range-only', { normalizedRangeHeader });\n }\n\n const rangeParts = /(\\d*)-(\\d*)/.exec(normalizedRangeHeader);\n // We need either at least one of the start or end values.\n if (rangeParts === null || !(rangeParts[1] || rangeParts[2])) {\n throw new WorkboxError_mjs.WorkboxError('invalid-range-values', { normalizedRangeHeader });\n }\n\n return {\n start: rangeParts[1] === '' ? null : Number(rangeParts[1]),\n end: rangeParts[2] === '' ? null : Number(rangeParts[2])\n };\n }\n\n /**\n * Given a `Request` and `Response` objects as input, this will return a\n * promise for a new `Response`.\n *\n * @param {Request} request A request, which should contain a Range:\n * header.\n * @param {Response} originalResponse An original response containing the full\n * content.\n * @return {Promise<Response>} Either a `206 Partial Content` response, with\n * the response body set to the slice of content specified by the request's\n * `Range:` header, or a `416 Range Not Satisfiable` response if the\n * conditions of the `Range:` header can't be met.\n *\n * @memberof workbox.rangeRequests\n */\n let createPartialResponse = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* (request, originalResponse) {\n try {\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-range-requests',\n funcName: 'createPartialResponse',\n paramName: 'request'\n });\n\n assert_mjs.assert.isInstance(originalResponse, Response, {\n moduleName: 'workbox-range-requests',\n funcName: 'createPartialResponse',\n paramName: 'originalResponse'\n });\n }\n\n const rangeHeader = request.headers.get('range');\n if (!rangeHeader) {\n throw new WorkboxError_mjs.WorkboxError('no-range-header');\n }\n\n const boundaries = parseRangeHeader(rangeHeader);\n const originalBlob = yield originalResponse.blob();\n\n const effectiveBoundaries = calculateEffectiveBoundaries(originalBlob, boundaries.start, boundaries.end);\n\n const slicedBlob = originalBlob.slice(effectiveBoundaries.start, effectiveBoundaries.end);\n const slicedBlobSize = slicedBlob.size;\n\n const slicedResponse = new Response(slicedBlob, {\n // Status code 206 is for a Partial Content response.\n // See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/206\n status: 206,\n statusText: 'Partial Content',\n headers: originalResponse.headers\n });\n\n slicedResponse.headers.set('Content-Length', slicedBlobSize);\n slicedResponse.headers.set('Content-Range', `bytes ${effectiveBoundaries.start}-${effectiveBoundaries.end - 1}/` + originalBlob.size);\n\n return slicedResponse;\n } catch (error) {\n {\n logger_mjs.logger.warn(`Unable to construct a partial response; returning a ` + `416 Range Not Satisfiable response instead.`);\n logger_mjs.logger.groupCollapsed(`View details here.`);\n logger_mjs.logger.unprefixed.log(error);\n logger_mjs.logger.unprefixed.log(request);\n logger_mjs.logger.unprefixed.log(originalResponse);\n logger_mjs.logger.groupEnd();\n }\n\n return new Response('', {\n status: 416,\n statusText: 'Range Not Satisfiable'\n });\n }\n });\n\n return function createPartialResponse(_x, _x2) {\n return _ref.apply(this, arguments);\n };\n })();\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * The range request plugin makes it easy for a request with a 'Range' header to\n * be fulfilled by a cached response.\n *\n * It does this by intercepting the `cachedResponseWillBeUsed` plugin callback\n * and returning the appropriate subset of the cached response body.\n *\n * @memberof workbox.rangeRequests\n */\n class Plugin {\n /**\n * @param {Object} options\n * @param {Request} options.request The original request, which may or may not\n * contain a Range: header.\n * @param {Response} options.cachedResponse The complete cached response.\n * @return {Promise<Response>} If request contains a 'Range' header, then a\n * new response with status 206 whose body is a subset of `cachedResponse` is\n * returned. Otherwise, `cachedResponse` is returned as-is.\n *\n * @private\n */\n cachedResponseWillBeUsed({ request, cachedResponse }) {\n return babelHelpers.asyncToGenerator(function* () {\n // Only return a sliced response if there's something valid in the cache,\n // and there's a Range: header in the request.\n if (cachedResponse && request.headers.has('range')) {\n return yield createPartialResponse(request, cachedResponse);\n }\n\n // If there was no Range: header, or if cachedResponse wasn't valid, just\n // pass it through as-is.\n return cachedResponse;\n })();\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.createPartialResponse = createPartialResponse;\n exports.Plugin = Plugin;\n\n return exports;\n\n}({},workbox.core._private,workbox.core._private,workbox.core._private));\n"],"file":"workbox-range-requests.dev.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-range-requests/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.rangeRequests = (function (exports,WorkboxError_mjs,assert_mjs,logger_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:range-requests:3.6.3'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @param {Blob} blob A source blob.\n * @param {number|null} start The offset to use as the start of the\n * slice.\n * @param {number|null} end The offset to use as the end of the slice.\n * @return {Object} An object with `start` and `end` properties, reflecting\n * the effective boundaries to use given the size of the blob.\n *\n * @private\n */\n function calculateEffectiveBoundaries(blob, start, end) {\n {\n assert_mjs.assert.isInstance(blob, Blob, {\n moduleName: 'workbox-range-requests',\n funcName: 'calculateEffectiveBoundaries',\n paramName: 'blob'\n });\n }\n\n const blobSize = blob.size;\n\n if (end > blobSize || start < 0) {\n throw new WorkboxError_mjs.WorkboxError('range-not-satisfiable', {\n size: blobSize,\n end,\n start\n });\n }\n\n let effectiveStart;\n let effectiveEnd;\n\n if (start === null) {\n effectiveStart = blobSize - end;\n effectiveEnd = blobSize;\n } else if (end === null) {\n effectiveStart = start;\n effectiveEnd = blobSize;\n } else {\n effectiveStart = start;\n // Range values are inclusive, so add 1 to the value.\n effectiveEnd = end + 1;\n }\n\n return {\n start: effectiveStart,\n end: effectiveEnd\n };\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @param {string} rangeHeader A Range: header value.\n * @return {Object} An object with `start` and `end` properties, reflecting\n * the parsed value of the Range: header. If either the `start` or `end` are\n * omitted, then `null` will be returned.\n *\n * @private\n */\n function parseRangeHeader(rangeHeader) {\n {\n assert_mjs.assert.isType(rangeHeader, 'string', {\n moduleName: 'workbox-range-requests',\n funcName: 'parseRangeHeader',\n paramName: 'rangeHeader'\n });\n }\n\n const normalizedRangeHeader = rangeHeader.trim().toLowerCase();\n if (!normalizedRangeHeader.startsWith('bytes=')) {\n throw new WorkboxError_mjs.WorkboxError('unit-must-be-bytes', { normalizedRangeHeader });\n }\n\n // Specifying multiple ranges separate by commas is valid syntax, but this\n // library only attempts to handle a single, contiguous sequence of bytes.\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range#Syntax\n if (normalizedRangeHeader.includes(',')) {\n throw new WorkboxError_mjs.WorkboxError('single-range-only', { normalizedRangeHeader });\n }\n\n const rangeParts = /(\\d*)-(\\d*)/.exec(normalizedRangeHeader);\n // We need either at least one of the start or end values.\n if (rangeParts === null || !(rangeParts[1] || rangeParts[2])) {\n throw new WorkboxError_mjs.WorkboxError('invalid-range-values', { normalizedRangeHeader });\n }\n\n return {\n start: rangeParts[1] === '' ? null : Number(rangeParts[1]),\n end: rangeParts[2] === '' ? null : Number(rangeParts[2])\n };\n }\n\n /**\n * Given a `Request` and `Response` objects as input, this will return a\n * promise for a new `Response`.\n *\n * @param {Request} request A request, which should contain a Range:\n * header.\n * @param {Response} originalResponse An original response containing the full\n * content.\n * @return {Promise<Response>} Either a `206 Partial Content` response, with\n * the response body set to the slice of content specified by the request's\n * `Range:` header, or a `416 Range Not Satisfiable` response if the\n * conditions of the `Range:` header can't be met.\n *\n * @memberof workbox.rangeRequests\n */\n let createPartialResponse = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* (request, originalResponse) {\n try {\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-range-requests',\n funcName: 'createPartialResponse',\n paramName: 'request'\n });\n\n assert_mjs.assert.isInstance(originalResponse, Response, {\n moduleName: 'workbox-range-requests',\n funcName: 'createPartialResponse',\n paramName: 'originalResponse'\n });\n }\n\n const rangeHeader = request.headers.get('range');\n if (!rangeHeader) {\n throw new WorkboxError_mjs.WorkboxError('no-range-header');\n }\n\n const boundaries = parseRangeHeader(rangeHeader);\n const originalBlob = yield originalResponse.blob();\n\n const effectiveBoundaries = calculateEffectiveBoundaries(originalBlob, boundaries.start, boundaries.end);\n\n const slicedBlob = originalBlob.slice(effectiveBoundaries.start, effectiveBoundaries.end);\n const slicedBlobSize = slicedBlob.size;\n\n const slicedResponse = new Response(slicedBlob, {\n // Status code 206 is for a Partial Content response.\n // See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/206\n status: 206,\n statusText: 'Partial Content',\n headers: originalResponse.headers\n });\n\n slicedResponse.headers.set('Content-Length', slicedBlobSize);\n slicedResponse.headers.set('Content-Range', `bytes ${effectiveBoundaries.start}-${effectiveBoundaries.end - 1}/` + originalBlob.size);\n\n return slicedResponse;\n } catch (error) {\n {\n logger_mjs.logger.warn(`Unable to construct a partial response; returning a ` + `416 Range Not Satisfiable response instead.`);\n logger_mjs.logger.groupCollapsed(`View details here.`);\n logger_mjs.logger.unprefixed.log(error);\n logger_mjs.logger.unprefixed.log(request);\n logger_mjs.logger.unprefixed.log(originalResponse);\n logger_mjs.logger.groupEnd();\n }\n\n return new Response('', {\n status: 416,\n statusText: 'Range Not Satisfiable'\n });\n }\n });\n\n return function createPartialResponse(_x, _x2) {\n return _ref.apply(this, arguments);\n };\n })();\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * The range request plugin makes it easy for a request with a 'Range' header to\n * be fulfilled by a cached response.\n *\n * It does this by intercepting the `cachedResponseWillBeUsed` plugin callback\n * and returning the appropriate subset of the cached response body.\n *\n * @memberof workbox.rangeRequests\n */\n class Plugin {\n /**\n * @param {Object} options\n * @param {Request} options.request The original request, which may or may not\n * contain a Range: header.\n * @param {Response} options.cachedResponse The complete cached response.\n * @return {Promise<Response>} If request contains a 'Range' header, then a\n * new response with status 206 whose body is a subset of `cachedResponse` is\n * returned. Otherwise, `cachedResponse` is returned as-is.\n *\n * @private\n */\n cachedResponseWillBeUsed({ request, cachedResponse }) {\n return babelHelpers.asyncToGenerator(function* () {\n // Only return a sliced response if there's something valid in the cache,\n // and there's a Range: header in the request.\n if (cachedResponse && request.headers.has('range')) {\n return yield createPartialResponse(request, cachedResponse);\n }\n\n // If there was no Range: header, or if cachedResponse wasn't valid, just\n // pass it through as-is.\n return cachedResponse;\n })();\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.createPartialResponse = createPartialResponse;\n exports.Plugin = Plugin;\n\n return exports;\n\n}({},workbox.core._private,workbox.core._private,workbox.core._private));\n"],"file":"workbox-range-requests.dev.js"}
@@ -1,3 +1,3 @@
1
- this.workbox=this.workbox||{},this.workbox.rangeRequests=function(e,n){"use strict";try{self.workbox.v["workbox:range-requests:3.6.2"]=1}catch(e){}let t=(r=babelHelpers.asyncToGenerator(function*(e,t){try{const r=e.headers.get("range");if(!r)throw new n.WorkboxError("no-range-header");const s=function(e){const t=e.trim().toLowerCase();if(!t.startsWith("bytes="))throw new n.WorkboxError("unit-must-be-bytes",{normalizedRangeHeader:t});if(t.includes(","))throw new n.WorkboxError("single-range-only",{normalizedRangeHeader:t});const r=/(\d*)-(\d*)/.exec(t);if(null===r||!r[1]&&!r[2])throw new n.WorkboxError("invalid-range-values",{normalizedRangeHeader:t});return{start:""===r[1]?null:Number(r[1]),end:""===r[2]?null:Number(r[2])}}(r),a=yield t.blob(),i=function(e,t,r){const s=e.size;if(r>s||t<0)throw new n.WorkboxError("range-not-satisfiable",{size:s,end:r,start:t});let a,i;return null===t?(a=s-r,i=s):null===r?(a=t,i=s):(a=t,i=r+1),{start:a,end:i}}(a,s.start,s.end),l=a.slice(i.start,i.end),o=l.size,u=new Response(l,{status:206,statusText:"Partial Content",headers:t.headers});return u.headers.set("Content-Length",o),u.headers.set("Content-Range",`bytes ${i.start}-${i.end-1}/`+a.size),u}catch(e){return new Response("",{status:416,statusText:"Range Not Satisfiable"})}}),function(e,n){return r.apply(this,arguments)});var r;return e.createPartialResponse=t,e.Plugin=class{cachedResponseWillBeUsed({request:e,cachedResponse:n}){return babelHelpers.asyncToGenerator(function*(){return n&&e.headers.has("range")?yield t(e,n):n})()}},e}({},workbox.core._private);
1
+ this.workbox=this.workbox||{},this.workbox.rangeRequests=function(e,n){"use strict";try{self.workbox.v["workbox:range-requests:3.6.3"]=1}catch(e){}let t=(r=babelHelpers.asyncToGenerator(function*(e,t){try{const r=e.headers.get("range");if(!r)throw new n.WorkboxError("no-range-header");const s=function(e){const t=e.trim().toLowerCase();if(!t.startsWith("bytes="))throw new n.WorkboxError("unit-must-be-bytes",{normalizedRangeHeader:t});if(t.includes(","))throw new n.WorkboxError("single-range-only",{normalizedRangeHeader:t});const r=/(\d*)-(\d*)/.exec(t);if(null===r||!r[1]&&!r[2])throw new n.WorkboxError("invalid-range-values",{normalizedRangeHeader:t});return{start:""===r[1]?null:Number(r[1]),end:""===r[2]?null:Number(r[2])}}(r),a=yield t.blob(),i=function(e,t,r){const s=e.size;if(r>s||t<0)throw new n.WorkboxError("range-not-satisfiable",{size:s,end:r,start:t});let a,i;return null===t?(a=s-r,i=s):null===r?(a=t,i=s):(a=t,i=r+1),{start:a,end:i}}(a,s.start,s.end),l=a.slice(i.start,i.end),o=l.size,u=new Response(l,{status:206,statusText:"Partial Content",headers:t.headers});return u.headers.set("Content-Length",o),u.headers.set("Content-Range",`bytes ${i.start}-${i.end-1}/`+a.size),u}catch(e){return new Response("",{status:416,statusText:"Range Not Satisfiable"})}}),function(e,n){return r.apply(this,arguments)});var r;return e.createPartialResponse=t,e.Plugin=class{cachedResponseWillBeUsed({request:e,cachedResponse:n}){return babelHelpers.asyncToGenerator(function*(){return n&&e.headers.has("range")?yield t(e,n):n})()}},e}({},workbox.core._private);
2
2
 
3
3
  //# sourceMappingURL=workbox-range-requests.prod.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-range-requests/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.rangeRequests=function(e,n){\"use strict\";try{self.workbox.v[\"workbox:range-requests:3.6.2\"]=1}catch(e){}let t=(r=babelHelpers.asyncToGenerator(function*(e,t){try{const r=e.headers.get(\"range\");if(!r)throw new n.WorkboxError(\"no-range-header\");const s=function(e){const t=e.trim().toLowerCase();if(!t.startsWith(\"bytes=\"))throw new n.WorkboxError(\"unit-must-be-bytes\",{normalizedRangeHeader:t});if(t.includes(\",\"))throw new n.WorkboxError(\"single-range-only\",{normalizedRangeHeader:t});const r=/(\\d*)-(\\d*)/.exec(t);if(null===r||!r[1]&&!r[2])throw new n.WorkboxError(\"invalid-range-values\",{normalizedRangeHeader:t});return{start:\"\"===r[1]?null:Number(r[1]),end:\"\"===r[2]?null:Number(r[2])}}(r),a=yield t.blob(),i=function(e,t,r){const s=e.size;if(r>s||t<0)throw new n.WorkboxError(\"range-not-satisfiable\",{size:s,end:r,start:t});let a,i;return null===t?(a=s-r,i=s):null===r?(a=t,i=s):(a=t,i=r+1),{start:a,end:i}}(a,s.start,s.end),l=a.slice(i.start,i.end),o=l.size,u=new Response(l,{status:206,statusText:\"Partial Content\",headers:t.headers});return u.headers.set(\"Content-Length\",o),u.headers.set(\"Content-Range\",`bytes ${i.start}-${i.end-1}/`+a.size),u}catch(e){return new Response(\"\",{status:416,statusText:\"Range Not Satisfiable\"})}}),function(e,n){return r.apply(this,arguments)});var r;return e.createPartialResponse=t,e.Plugin=class{cachedResponseWillBeUsed({request:e,cachedResponse:n}){return babelHelpers.asyncToGenerator(function*(){return n&&e.headers.has(\"range\")?yield t(e,n):n})()}},e}({},workbox.core._private);\n"],"file":"workbox-range-requests.prod.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-range-requests/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.rangeRequests=function(e,n){\"use strict\";try{self.workbox.v[\"workbox:range-requests:3.6.3\"]=1}catch(e){}let t=(r=babelHelpers.asyncToGenerator(function*(e,t){try{const r=e.headers.get(\"range\");if(!r)throw new n.WorkboxError(\"no-range-header\");const s=function(e){const t=e.trim().toLowerCase();if(!t.startsWith(\"bytes=\"))throw new n.WorkboxError(\"unit-must-be-bytes\",{normalizedRangeHeader:t});if(t.includes(\",\"))throw new n.WorkboxError(\"single-range-only\",{normalizedRangeHeader:t});const r=/(\\d*)-(\\d*)/.exec(t);if(null===r||!r[1]&&!r[2])throw new n.WorkboxError(\"invalid-range-values\",{normalizedRangeHeader:t});return{start:\"\"===r[1]?null:Number(r[1]),end:\"\"===r[2]?null:Number(r[2])}}(r),a=yield t.blob(),i=function(e,t,r){const s=e.size;if(r>s||t<0)throw new n.WorkboxError(\"range-not-satisfiable\",{size:s,end:r,start:t});let a,i;return null===t?(a=s-r,i=s):null===r?(a=t,i=s):(a=t,i=r+1),{start:a,end:i}}(a,s.start,s.end),l=a.slice(i.start,i.end),o=l.size,u=new Response(l,{status:206,statusText:\"Partial Content\",headers:t.headers});return u.headers.set(\"Content-Length\",o),u.headers.set(\"Content-Range\",`bytes ${i.start}-${i.end-1}/`+a.size),u}catch(e){return new Response(\"\",{status:416,statusText:\"Range Not Satisfiable\"})}}),function(e,n){return r.apply(this,arguments)});var r;return e.createPartialResponse=t,e.Plugin=class{cachedResponseWillBeUsed({request:e,cachedResponse:n}){return babelHelpers.asyncToGenerator(function*(){return n&&e.headers.has(\"range\")?yield t(e,n):n})()}},e}({},workbox.core._private);\n"],"file":"workbox-range-requests.prod.js"}
@@ -3,7 +3,7 @@ this.workbox.routing = (function (assert_mjs,logger_mjs,WorkboxError_mjs,getFrie
3
3
  'use strict';
4
4
 
5
5
  try {
6
- self.workbox.v['workbox:routing:3.6.2'] = 1;
6
+ self.workbox.v['workbox:routing:3.6.3'] = 1;
7
7
  } catch (e) {} // eslint-disable-line
8
8
 
9
9
  /*
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-routing/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.routing = (function (assert_mjs,logger_mjs,WorkboxError_mjs,getFriendlyURL_mjs,cacheNames_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:routing:3.6.2'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * The default HTTP method, 'GET', used when there's no specific method\n * configured for a route.\n *\n * @type {string}\n *\n * @private\n */\n const defaultMethod = 'GET';\n\n /**\n * The list of valid HTTP methods associated with requests that could be routed.\n *\n * @type {Array<string>}\n *\n * @private\n */\n const validMethods = ['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'];\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @param {function()|Object} handler Either a function, or an object with a\n * 'handle' method.\n * @return {Object} An object with a handle method.\n *\n * @private\n */\n var normalizeHandler = (handler => {\n if (handler && typeof handler === 'object') {\n {\n assert_mjs.assert.hasMethod(handler, 'handle', {\n moduleName: 'workbox-routing',\n className: 'Route',\n funcName: 'constructor',\n paramName: 'handler'\n });\n }\n return handler;\n } else {\n {\n assert_mjs.assert.isType(handler, 'function', {\n moduleName: 'workbox-routing',\n className: 'Route',\n funcName: 'constructor',\n paramName: 'handler'\n });\n }\n return { handle: handler };\n }\n });\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * A `Route` consists of a pair of callback functions, \"match\" and \"handler\".\n * The \"match\" callback determine if a route should be used to \"handle\" a\n * request by returning a non-falsy value if it can. The \"handler\" callback\n * is called when there is a match and should return a Promise that resolves\n * to a `Response`.\n *\n * @memberof workbox.routing\n */\n class Route {\n /**\n * Constructor for Route class.\n *\n * @param {workbox.routing.Route~matchCallback} match\n * A callback function that determines whether the route matches a given\n * `fetch` event by returning a non-falsy value.\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resolving to a Response.\n * @param {string} [method='GET'] The HTTP method to match the Route\n * against.\n */\n constructor(match, handler, method) {\n {\n assert_mjs.assert.isType(match, 'function', {\n moduleName: 'workbox-routing',\n className: 'Route',\n funcName: 'constructor',\n paramName: 'match'\n });\n\n if (method) {\n assert_mjs.assert.isOneOf(method, validMethods, { paramName: 'method' });\n }\n }\n\n // These values are referenced directly by Router so cannot be\n // altered by minifification.\n this.handler = normalizeHandler(handler);\n this.match = match;\n this.method = method || defaultMethod;\n }\n }\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * RegExpRoute makes it easy to create a regular expression based\n * [Route]{@link workbox.routing.Route}.\n *\n * For same-origin requests the RegExp only needs to match part of the URL. For\n * requests against third-party servers, you must define a RegExp that matches\n * the start of the URL.\n *\n * [See the module docs for info.]{@link https://developers.google.com/web/tools/workbox/modules/workbox-routing}\n *\n * @memberof workbox.routing\n * @extends workbox.routing.Route\n */\n class RegExpRoute extends Route {\n /**\n * If the regulard expression contains\n * [capture groups]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#grouping-back-references},\n * th ecaptured values will be passed to the\n * [handler's]{@link workbox.routing.Route~handlerCallback} `params`\n * argument.\n *\n * @param {RegExp} regExp The regular expression to match against URLs.\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n * @param {string} [method='GET'] The HTTP method to match the Route\n * against.\n */\n constructor(regExp, handler, method) {\n {\n assert_mjs.assert.isInstance(regExp, RegExp, {\n moduleName: 'workbox-routing',\n className: 'RegExpRoute',\n funcName: 'constructor',\n paramName: 'pattern'\n });\n }\n\n const match = ({ url }) => {\n const result = regExp.exec(url.href);\n\n // Return null immediately if there's no match.\n if (!result) {\n return null;\n }\n\n // Require that the match start at the first character in the URL string\n // if it's a cross-origin request.\n // See https://github.com/GoogleChrome/workbox/issues/281 for the context\n // behind this behavior.\n if (url.origin !== location.origin && result.index !== 0) {\n {\n logger_mjs.logger.debug(`The regular expression '${regExp}' only partially matched ` + `against the cross-origin URL '${url}'. RegExpRoute's will only ` + `handle cross-origin requests if they match the entire URL.`);\n }\n\n return null;\n }\n\n // If the route matches, but there aren't any capture groups defined, then\n // this will return [], which is truthy and therefore sufficient to\n // indicate a match.\n // If there are capture groups, then it will return their values.\n return result.slice(1);\n };\n\n super(match, handler, method);\n }\n }\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * The Router can be used to process a FetchEvent through one or more\n * [Routes]{@link workbox.routing.Route} responding with a Request if\n * a matching route exists.\n *\n * If no route matches a given a request, the Router will use a \"default\"\n * handler if one is defined.\n *\n * Should the matching Route throw an error, the Router will use a \"catch\"\n * handler if one is defined to gracefully deal with issues and respond with a\n * Request.\n *\n * If a request matches multiple routes, the **earliest** registered route will\n * be used to respond to the request.\n *\n * @memberof workbox.routing\n */\n class Router {\n /**\n * Initializes a new Router.\n */\n constructor() {\n // _routes will contain a mapping of HTTP method name ('GET', etc.) to an\n // array of all the corresponding Route instances that are registered.\n this._routes = new Map();\n }\n\n /**\n * Apply the routing rules to a FetchEvent object to get a Response from an\n * appropriate Route's handler.\n *\n * @param {FetchEvent} event The event from a service worker's 'fetch' event\n * listener.\n * @return {Promise<Response>|undefined} A promise is returned if a\n * registered route can handle the FetchEvent's request. If there is no\n * matching route and there's no `defaultHandler`, `undefined` is returned.\n */\n handleRequest(event) {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'handleRequest',\n paramName: 'event'\n });\n }\n\n const url = new URL(event.request.url);\n if (!url.protocol.startsWith('http')) {\n {\n logger_mjs.logger.debug(`Workbox Router only supports URLs that start with 'http'.`);\n }\n return;\n }\n\n let route = null;\n let handler = null;\n let params = null;\n let debugMessages = [];\n\n const result = this._findHandlerAndParams(event, url);\n handler = result.handler;\n params = result.params;\n route = result.route;\n {\n if (handler) {\n debugMessages.push([`Found a route to handle this request:`, route]);\n\n if (params) {\n debugMessages.push([`Passing the following params to the route's handler:`, params]);\n }\n }\n }\n\n // If we don't have a handler because there was no matching route, then\n // fall back to defaultHandler if that's defined.\n if (!handler && this._defaultHandler) {\n {\n debugMessages.push(`Failed to find a matching route. Falling ` + `back to the default handler.`);\n\n // This is used for debugging in logs in the case of an error.\n route = '[Default Handler]';\n }\n handler = this._defaultHandler;\n }\n\n if (!handler) {\n {\n // No handler so Workbox will do nothing. If logs is set of debug\n // i.e. verbose, we should print out this information.\n logger_mjs.logger.debug(`No route found for: ${getFriendlyURL_mjs.getFriendlyURL(url)}`);\n }\n return;\n }\n\n {\n // We have a handler, meaning Workbox is going to handle the route.\n // print the routing details to the console.\n logger_mjs.logger.groupCollapsed(`Router is responding to: ${getFriendlyURL_mjs.getFriendlyURL(url)}`);\n debugMessages.forEach(msg => {\n if (Array.isArray(msg)) {\n logger_mjs.logger.log(...msg);\n } else {\n logger_mjs.logger.log(msg);\n }\n });\n\n // The Request and Response objects contains a great deal of information,\n // hide it under a group in case developers want to see it.\n logger_mjs.logger.groupCollapsed(`View request details here.`);\n logger_mjs.logger.unprefixed.log(event.request);\n logger_mjs.logger.groupEnd();\n\n logger_mjs.logger.groupEnd();\n }\n\n // Wrap in try and catch in case the handle method throws a synchronous\n // error. It should still callback to the catch handler.\n let responsePromise;\n try {\n responsePromise = handler.handle({ url, event, params });\n } catch (err) {\n responsePromise = Promise.reject(err);\n }\n\n if (responsePromise && this._catchHandler) {\n responsePromise = responsePromise.catch(err => {\n {\n // Still include URL here as it will be async from the console group\n // and may not make sense without the URL\n logger_mjs.logger.groupCollapsed(`Error thrown when responding to: ` + ` ${getFriendlyURL_mjs.getFriendlyURL(url)}. Falling back to Catch Handler.`);\n logger_mjs.logger.unprefixed.error(`Error thrown by:`, route);\n logger_mjs.logger.unprefixed.error(err);\n logger_mjs.logger.groupEnd();\n }\n return this._catchHandler.handle({ url, event, err });\n });\n }\n\n return responsePromise;\n }\n\n /**\n * Checks the incoming `event.request` against the registered routes, and if\n * there's a match, returns the corresponding handler along with any params\n * generated by the match.\n *\n * @param {FetchEvent} event\n * @param {URL} url\n * @return {Object} Returns an object with `handler` and `params` properties.\n * They are populated if a matching route was found or `undefined` otherwise.\n *\n * @private\n */\n _findHandlerAndParams(event, url) {\n const routes = this._routes.get(event.request.method) || [];\n for (const route of routes) {\n let matchResult = route.match({ url, event });\n if (matchResult) {\n if (Array.isArray(matchResult) && matchResult.length === 0) {\n // Instead of passing an empty array in as params, use undefined.\n matchResult = undefined;\n } else if (matchResult.constructor === Object && Object.keys(matchResult).length === 0 || matchResult === true) {\n // Instead of passing an empty object in as params, use undefined.\n matchResult = undefined;\n }\n\n // Break out of the loop and return the appropriate values as soon as\n // we have a match.\n return {\n route,\n params: matchResult,\n handler: route.handler\n };\n }\n }\n\n // If we didn't have a match, then return undefined values.\n return { handler: undefined, params: undefined };\n }\n\n /**\n * Define a default `handler` that's called when no routes explicitly\n * match the incoming request.\n *\n * Without a default handler, unmatched requests will go against the\n * network as if there were no service worker present.\n *\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n */\n setDefaultHandler(handler) {\n this._defaultHandler = normalizeHandler(handler);\n }\n\n /**\n * If a Route throws an error while handling a request, this `handler`\n * will be called and given a chance to provide a response.\n *\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n */\n setCatchHandler(handler) {\n this._catchHandler = normalizeHandler(handler);\n }\n\n /**\n * Registers a route with the router.\n *\n * @param {workbox.routing.Route} route The route to register.\n */\n registerRoute(route) {\n {\n assert_mjs.assert.isType(route, 'object', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route'\n });\n\n assert_mjs.assert.hasMethod(route, 'match', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route'\n });\n\n assert_mjs.assert.isType(route.handler, 'object', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route'\n });\n\n assert_mjs.assert.hasMethod(route.handler, 'handle', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route.handler'\n });\n\n assert_mjs.assert.isType(route.method, 'string', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route.method'\n });\n }\n\n if (!this._routes.has(route.method)) {\n this._routes.set(route.method, []);\n }\n\n // Give precedence to all of the earlier routes by adding this additional\n // route to the end of the array.\n this._routes.get(route.method).push(route);\n }\n\n /**\n * Unregisters a route with the router.\n *\n * @param {workbox.routing.Route} route The route to unregister.\n */\n unregisterRoute(route) {\n if (!this._routes.has(route.method)) {\n throw new WorkboxError_mjs.WorkboxError('unregister-route-but-not-found-with-method', {\n method: route.method\n });\n }\n\n const routeIndex = this._routes.get(route.method).indexOf(route);\n if (routeIndex > -1) {\n this._routes.get(route.method).splice(routeIndex, 1);\n } else {\n throw new WorkboxError_mjs.WorkboxError('unregister-route-route-not-registered');\n }\n }\n }\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * NavigationRoute makes it easy to create a [Route]{@link\n * workbox.routing.Route} that matches for browser\n * [navigation requests]{@link https://developers.google.com/web/fundamentals/primers/service-workers/high-performance-loading#first_what_are_navigation_requests}.\n *\n * It will only match incoming Requests whose\n * [`mode`]{@link https://fetch.spec.whatwg.org/#concept-request-mode}\n * is set to `navigate`.\n *\n * You can optionally only apply this route to a subset of navigation requests\n * by using one or both of the `blacklist` and `whitelist` parameters.\n *\n * @memberof workbox.routing\n * @extends workbox.routing.Route\n */\n class NavigationRoute extends Route {\n /**\n * If both `blacklist` and `whiltelist` are provided, the `blacklist` will\n * take precedence and the request will not match this route.\n *\n * The regular expressions in `whitelist` and `blacklist`\n * are matched against the concatenated\n * [`pathname`]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/pathname}\n * and [`search`]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/search}\n * portions of the requested URL.\n *\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n * @param {Object} options\n * @param {Array<RegExp>} [options.blacklist] If any of these patterns match,\n * the route will not handle the request (even if a whitelist RegExp matches).\n * @param {Array<RegExp>} [options.whitelist=[/./]] If any of these patterns\n * match the URL's pathname and search parameter, the route will handle the\n * request (assuming the blacklist doesn't match).\n */\n constructor(handler, { whitelist = [/./], blacklist = [] } = {}) {\n {\n assert_mjs.assert.isArrayOfClass(whitelist, RegExp, {\n moduleName: 'workbox-routing',\n className: 'NavigationRoute',\n funcName: 'constructor',\n paramName: 'options.whitelist'\n });\n assert_mjs.assert.isArrayOfClass(blacklist, RegExp, {\n moduleName: 'workbox-routing',\n className: 'NavigationRoute',\n funcName: 'constructor',\n paramName: 'options.blacklist'\n });\n }\n\n super((...args) => this._match(...args), handler);\n\n this._whitelist = whitelist;\n this._blacklist = blacklist;\n }\n\n /**\n * Routes match handler.\n *\n * @param {Object} options\n * @param {FetchEvent} options.event\n * @param {URL} options.url\n * @return {boolean}\n *\n * @private\n */\n _match({ event, url }) {\n if (event.request.mode !== 'navigate') {\n return false;\n }\n\n const pathnameAndSearch = url.pathname + url.search;\n\n if (this._blacklist.some(regExp => regExp.test(pathnameAndSearch))) {\n {\n logger_mjs.logger.debug(`The navigation route is not being used, since the ` + `request URL matches both the whitelist and blacklist.`);\n }\n return false;\n }\n\n if (this._whitelist.some(regExp => regExp.test(pathnameAndSearch))) {\n {\n logger_mjs.logger.debug(`The navigation route is being used.`);\n }\n return true;\n } else {\n {\n logger_mjs.logger.debug(`The navigation route is not being used, since the ` + `URL being navigated to doesn't match the whitelist.`);\n }\n }\n\n return false;\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var publicAPI = /*#__PURE__*/Object.freeze({\n RegExpRoute: RegExpRoute,\n Route: Route,\n Router: Router,\n NavigationRoute: NavigationRoute\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n {\n assert_mjs.assert.isSwEnv('workbox-routing');\n }\n\n /**\n * @private\n */\n class DefaultRouter extends Router {\n /**\n * Easily register a RegExp, string, or function with a caching\n * strategy to the Router.\n *\n * This method will generate a Route for you if needed and\n * call [Router.registerRoute()]{@link\n * workbox.routing.Router#registerRoute}.\n *\n * @param {\n * RegExp|\n * string|\n * workbox.routing.Route~matchCallback|\n * workbox.routing.Route\n * } capture\n * If the capture param is a `Route`, all other arguments will be ignored.\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n * @param {string} [method='GET'] The HTTP method to match the Route\n * against.\n * @return {workbox.routing.Route} The generated `Route`(Useful for\n * unregistering).\n *\n * @alias workbox.routing.registerRoute\n */\n registerRoute(capture, handler, method = 'GET') {\n let route;\n\n if (typeof capture === 'string') {\n const captureUrl = new URL(capture, location);\n\n {\n if (!(capture.startsWith('/') || capture.startsWith('http'))) {\n throw new WorkboxError_mjs.WorkboxError('invalid-string', {\n moduleName: 'workbox-routing',\n className: 'DefaultRouter',\n funcName: 'registerRoute',\n paramName: 'capture'\n });\n }\n\n // We want to check if Express-style wildcards are in the pathname only.\n // TODO: Remove this log message in v4.\n const valueToCheck = capture.startsWith('http') ? captureUrl.pathname : capture;\n // See https://github.com/pillarjs/path-to-regexp#parameters\n const wildcards = '[*:?+]';\n if (valueToCheck.match(new RegExp(`${wildcards}`))) {\n logger_mjs.logger.debug(`The '$capture' parameter contains an Express-style wildcard ` + `character (${wildcards}). Strings are now always interpreted as ` + `exact matches; use a RegExp for partial or wildcard matches.`);\n }\n }\n\n const matchCallback = ({ url }) => {\n {\n if (url.pathname === captureUrl.pathname && url.origin !== captureUrl.origin) {\n logger_mjs.logger.debug(`${capture} only partially matches the cross-origin URL ` + `${url}. This route will only handle cross-origin requests ` + `if they match the entire URL.`);\n }\n }\n\n return url.href === captureUrl.href;\n };\n\n route = new Route(matchCallback, handler, method);\n } else if (capture instanceof RegExp) {\n route = new RegExpRoute(capture, handler, method);\n } else if (typeof capture === 'function') {\n route = new Route(capture, handler, method);\n } else if (capture instanceof Route) {\n route = capture;\n } else {\n throw new WorkboxError_mjs.WorkboxError('unsupported-route-type', {\n moduleName: 'workbox-routing',\n className: 'DefaultRouter',\n funcName: 'registerRoute',\n paramName: 'capture'\n });\n }\n\n super.registerRoute(route);\n return route;\n }\n\n /**\n * Register a route that will return a precached file for a navigation\n * request. This is useful for the\n * [application shell pattern]{@link https://developers.google.com/web/fundamentals/architecture/app-shell}.\n *\n * This method will generate a\n * [NavigationRoute]{@link workbox.routing.NavigationRoute}\n * and call\n * [Router.registerRoute()]{@link workbox.routing.Router#registerRoute}\n * .\n *\n * @param {string} cachedAssetUrl\n * @param {Object} [options]\n * @param {string} [options.cacheName] Cache name to store and retrieve\n * requests. Defaults to precache cache name provided by\n * [workbox-core.cacheNames]{@link workbox.core.cacheNames}.\n * @param {Array<RegExp>} [options.blacklist=[]] If any of these patterns\n * match, the route will not handle the request (even if a whitelist entry\n * matches).\n * @param {Array<RegExp>} [options.whitelist=[/./]] If any of these patterns\n * match the URL's pathname and search parameter, the route will handle the\n * request (assuming the blacklist doesn't match).\n * @return {workbox.routing.NavigationRoute} Returns the generated\n * Route.\n *\n * @alias workbox.routing.registerNavigationRoute\n */\n registerNavigationRoute(cachedAssetUrl, options = {}) {\n {\n assert_mjs.assert.isType(cachedAssetUrl, 'string', {\n moduleName: 'workbox-routing',\n className: '[default export]',\n funcName: 'registerNavigationRoute',\n paramName: 'cachedAssetUrl'\n });\n }\n\n const cacheName = cacheNames_mjs.cacheNames.getPrecacheName(options.cacheName);\n const handler = () => caches.match(cachedAssetUrl, { cacheName }).then(response => {\n if (response) {\n return response;\n }\n // This shouldn't normally happen, but there are edge cases:\n // https://github.com/GoogleChrome/workbox/issues/1441\n throw new Error(`The cache ${cacheName} did not have an entry for ` + `${cachedAssetUrl}.`);\n }).catch(error => {\n // If there's either a cache miss, or the caches.match() call threw\n // an exception, then attempt to fulfill the navigation request with\n // a response from the network rather than leaving the user with a\n // failed navigation.\n {\n logger_mjs.logger.debug(`Unable to respond to navigation request with cached ` + `response: ${error.message}. Falling back to network.`);\n }\n\n // This might still fail if the browser is offline...\n return fetch(cachedAssetUrl);\n });\n\n const route = new NavigationRoute(handler, {\n whitelist: options.whitelist,\n blacklist: options.blacklist\n });\n super.registerRoute(route);\n\n return route;\n }\n }\n\n const router = new DefaultRouter();\n\n // By default, register a fetch event listener that will respond to a request\n // only if there's a matching route.\n self.addEventListener('fetch', event => {\n const responsePromise = router.handleRequest(event);\n if (responsePromise) {\n event.respondWith(responsePromise);\n }\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const finalExport = Object.assign(router, publicAPI);\n\n return finalExport;\n\n}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));\n"],"file":"workbox-routing.dev.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-routing/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.routing = (function (assert_mjs,logger_mjs,WorkboxError_mjs,getFriendlyURL_mjs,cacheNames_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:routing:3.6.3'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * The default HTTP method, 'GET', used when there's no specific method\n * configured for a route.\n *\n * @type {string}\n *\n * @private\n */\n const defaultMethod = 'GET';\n\n /**\n * The list of valid HTTP methods associated with requests that could be routed.\n *\n * @type {Array<string>}\n *\n * @private\n */\n const validMethods = ['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'];\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @param {function()|Object} handler Either a function, or an object with a\n * 'handle' method.\n * @return {Object} An object with a handle method.\n *\n * @private\n */\n var normalizeHandler = (handler => {\n if (handler && typeof handler === 'object') {\n {\n assert_mjs.assert.hasMethod(handler, 'handle', {\n moduleName: 'workbox-routing',\n className: 'Route',\n funcName: 'constructor',\n paramName: 'handler'\n });\n }\n return handler;\n } else {\n {\n assert_mjs.assert.isType(handler, 'function', {\n moduleName: 'workbox-routing',\n className: 'Route',\n funcName: 'constructor',\n paramName: 'handler'\n });\n }\n return { handle: handler };\n }\n });\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * A `Route` consists of a pair of callback functions, \"match\" and \"handler\".\n * The \"match\" callback determine if a route should be used to \"handle\" a\n * request by returning a non-falsy value if it can. The \"handler\" callback\n * is called when there is a match and should return a Promise that resolves\n * to a `Response`.\n *\n * @memberof workbox.routing\n */\n class Route {\n /**\n * Constructor for Route class.\n *\n * @param {workbox.routing.Route~matchCallback} match\n * A callback function that determines whether the route matches a given\n * `fetch` event by returning a non-falsy value.\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resolving to a Response.\n * @param {string} [method='GET'] The HTTP method to match the Route\n * against.\n */\n constructor(match, handler, method) {\n {\n assert_mjs.assert.isType(match, 'function', {\n moduleName: 'workbox-routing',\n className: 'Route',\n funcName: 'constructor',\n paramName: 'match'\n });\n\n if (method) {\n assert_mjs.assert.isOneOf(method, validMethods, { paramName: 'method' });\n }\n }\n\n // These values are referenced directly by Router so cannot be\n // altered by minifification.\n this.handler = normalizeHandler(handler);\n this.match = match;\n this.method = method || defaultMethod;\n }\n }\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * RegExpRoute makes it easy to create a regular expression based\n * [Route]{@link workbox.routing.Route}.\n *\n * For same-origin requests the RegExp only needs to match part of the URL. For\n * requests against third-party servers, you must define a RegExp that matches\n * the start of the URL.\n *\n * [See the module docs for info.]{@link https://developers.google.com/web/tools/workbox/modules/workbox-routing}\n *\n * @memberof workbox.routing\n * @extends workbox.routing.Route\n */\n class RegExpRoute extends Route {\n /**\n * If the regulard expression contains\n * [capture groups]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#grouping-back-references},\n * th ecaptured values will be passed to the\n * [handler's]{@link workbox.routing.Route~handlerCallback} `params`\n * argument.\n *\n * @param {RegExp} regExp The regular expression to match against URLs.\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n * @param {string} [method='GET'] The HTTP method to match the Route\n * against.\n */\n constructor(regExp, handler, method) {\n {\n assert_mjs.assert.isInstance(regExp, RegExp, {\n moduleName: 'workbox-routing',\n className: 'RegExpRoute',\n funcName: 'constructor',\n paramName: 'pattern'\n });\n }\n\n const match = ({ url }) => {\n const result = regExp.exec(url.href);\n\n // Return null immediately if there's no match.\n if (!result) {\n return null;\n }\n\n // Require that the match start at the first character in the URL string\n // if it's a cross-origin request.\n // See https://github.com/GoogleChrome/workbox/issues/281 for the context\n // behind this behavior.\n if (url.origin !== location.origin && result.index !== 0) {\n {\n logger_mjs.logger.debug(`The regular expression '${regExp}' only partially matched ` + `against the cross-origin URL '${url}'. RegExpRoute's will only ` + `handle cross-origin requests if they match the entire URL.`);\n }\n\n return null;\n }\n\n // If the route matches, but there aren't any capture groups defined, then\n // this will return [], which is truthy and therefore sufficient to\n // indicate a match.\n // If there are capture groups, then it will return their values.\n return result.slice(1);\n };\n\n super(match, handler, method);\n }\n }\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * The Router can be used to process a FetchEvent through one or more\n * [Routes]{@link workbox.routing.Route} responding with a Request if\n * a matching route exists.\n *\n * If no route matches a given a request, the Router will use a \"default\"\n * handler if one is defined.\n *\n * Should the matching Route throw an error, the Router will use a \"catch\"\n * handler if one is defined to gracefully deal with issues and respond with a\n * Request.\n *\n * If a request matches multiple routes, the **earliest** registered route will\n * be used to respond to the request.\n *\n * @memberof workbox.routing\n */\n class Router {\n /**\n * Initializes a new Router.\n */\n constructor() {\n // _routes will contain a mapping of HTTP method name ('GET', etc.) to an\n // array of all the corresponding Route instances that are registered.\n this._routes = new Map();\n }\n\n /**\n * Apply the routing rules to a FetchEvent object to get a Response from an\n * appropriate Route's handler.\n *\n * @param {FetchEvent} event The event from a service worker's 'fetch' event\n * listener.\n * @return {Promise<Response>|undefined} A promise is returned if a\n * registered route can handle the FetchEvent's request. If there is no\n * matching route and there's no `defaultHandler`, `undefined` is returned.\n */\n handleRequest(event) {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'handleRequest',\n paramName: 'event'\n });\n }\n\n const url = new URL(event.request.url);\n if (!url.protocol.startsWith('http')) {\n {\n logger_mjs.logger.debug(`Workbox Router only supports URLs that start with 'http'.`);\n }\n return;\n }\n\n let route = null;\n let handler = null;\n let params = null;\n let debugMessages = [];\n\n const result = this._findHandlerAndParams(event, url);\n handler = result.handler;\n params = result.params;\n route = result.route;\n {\n if (handler) {\n debugMessages.push([`Found a route to handle this request:`, route]);\n\n if (params) {\n debugMessages.push([`Passing the following params to the route's handler:`, params]);\n }\n }\n }\n\n // If we don't have a handler because there was no matching route, then\n // fall back to defaultHandler if that's defined.\n if (!handler && this._defaultHandler) {\n {\n debugMessages.push(`Failed to find a matching route. Falling ` + `back to the default handler.`);\n\n // This is used for debugging in logs in the case of an error.\n route = '[Default Handler]';\n }\n handler = this._defaultHandler;\n }\n\n if (!handler) {\n {\n // No handler so Workbox will do nothing. If logs is set of debug\n // i.e. verbose, we should print out this information.\n logger_mjs.logger.debug(`No route found for: ${getFriendlyURL_mjs.getFriendlyURL(url)}`);\n }\n return;\n }\n\n {\n // We have a handler, meaning Workbox is going to handle the route.\n // print the routing details to the console.\n logger_mjs.logger.groupCollapsed(`Router is responding to: ${getFriendlyURL_mjs.getFriendlyURL(url)}`);\n debugMessages.forEach(msg => {\n if (Array.isArray(msg)) {\n logger_mjs.logger.log(...msg);\n } else {\n logger_mjs.logger.log(msg);\n }\n });\n\n // The Request and Response objects contains a great deal of information,\n // hide it under a group in case developers want to see it.\n logger_mjs.logger.groupCollapsed(`View request details here.`);\n logger_mjs.logger.unprefixed.log(event.request);\n logger_mjs.logger.groupEnd();\n\n logger_mjs.logger.groupEnd();\n }\n\n // Wrap in try and catch in case the handle method throws a synchronous\n // error. It should still callback to the catch handler.\n let responsePromise;\n try {\n responsePromise = handler.handle({ url, event, params });\n } catch (err) {\n responsePromise = Promise.reject(err);\n }\n\n if (responsePromise && this._catchHandler) {\n responsePromise = responsePromise.catch(err => {\n {\n // Still include URL here as it will be async from the console group\n // and may not make sense without the URL\n logger_mjs.logger.groupCollapsed(`Error thrown when responding to: ` + ` ${getFriendlyURL_mjs.getFriendlyURL(url)}. Falling back to Catch Handler.`);\n logger_mjs.logger.unprefixed.error(`Error thrown by:`, route);\n logger_mjs.logger.unprefixed.error(err);\n logger_mjs.logger.groupEnd();\n }\n return this._catchHandler.handle({ url, event, err });\n });\n }\n\n return responsePromise;\n }\n\n /**\n * Checks the incoming `event.request` against the registered routes, and if\n * there's a match, returns the corresponding handler along with any params\n * generated by the match.\n *\n * @param {FetchEvent} event\n * @param {URL} url\n * @return {Object} Returns an object with `handler` and `params` properties.\n * They are populated if a matching route was found or `undefined` otherwise.\n *\n * @private\n */\n _findHandlerAndParams(event, url) {\n const routes = this._routes.get(event.request.method) || [];\n for (const route of routes) {\n let matchResult = route.match({ url, event });\n if (matchResult) {\n if (Array.isArray(matchResult) && matchResult.length === 0) {\n // Instead of passing an empty array in as params, use undefined.\n matchResult = undefined;\n } else if (matchResult.constructor === Object && Object.keys(matchResult).length === 0 || matchResult === true) {\n // Instead of passing an empty object in as params, use undefined.\n matchResult = undefined;\n }\n\n // Break out of the loop and return the appropriate values as soon as\n // we have a match.\n return {\n route,\n params: matchResult,\n handler: route.handler\n };\n }\n }\n\n // If we didn't have a match, then return undefined values.\n return { handler: undefined, params: undefined };\n }\n\n /**\n * Define a default `handler` that's called when no routes explicitly\n * match the incoming request.\n *\n * Without a default handler, unmatched requests will go against the\n * network as if there were no service worker present.\n *\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n */\n setDefaultHandler(handler) {\n this._defaultHandler = normalizeHandler(handler);\n }\n\n /**\n * If a Route throws an error while handling a request, this `handler`\n * will be called and given a chance to provide a response.\n *\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n */\n setCatchHandler(handler) {\n this._catchHandler = normalizeHandler(handler);\n }\n\n /**\n * Registers a route with the router.\n *\n * @param {workbox.routing.Route} route The route to register.\n */\n registerRoute(route) {\n {\n assert_mjs.assert.isType(route, 'object', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route'\n });\n\n assert_mjs.assert.hasMethod(route, 'match', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route'\n });\n\n assert_mjs.assert.isType(route.handler, 'object', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route'\n });\n\n assert_mjs.assert.hasMethod(route.handler, 'handle', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route.handler'\n });\n\n assert_mjs.assert.isType(route.method, 'string', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route.method'\n });\n }\n\n if (!this._routes.has(route.method)) {\n this._routes.set(route.method, []);\n }\n\n // Give precedence to all of the earlier routes by adding this additional\n // route to the end of the array.\n this._routes.get(route.method).push(route);\n }\n\n /**\n * Unregisters a route with the router.\n *\n * @param {workbox.routing.Route} route The route to unregister.\n */\n unregisterRoute(route) {\n if (!this._routes.has(route.method)) {\n throw new WorkboxError_mjs.WorkboxError('unregister-route-but-not-found-with-method', {\n method: route.method\n });\n }\n\n const routeIndex = this._routes.get(route.method).indexOf(route);\n if (routeIndex > -1) {\n this._routes.get(route.method).splice(routeIndex, 1);\n } else {\n throw new WorkboxError_mjs.WorkboxError('unregister-route-route-not-registered');\n }\n }\n }\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * NavigationRoute makes it easy to create a [Route]{@link\n * workbox.routing.Route} that matches for browser\n * [navigation requests]{@link https://developers.google.com/web/fundamentals/primers/service-workers/high-performance-loading#first_what_are_navigation_requests}.\n *\n * It will only match incoming Requests whose\n * [`mode`]{@link https://fetch.spec.whatwg.org/#concept-request-mode}\n * is set to `navigate`.\n *\n * You can optionally only apply this route to a subset of navigation requests\n * by using one or both of the `blacklist` and `whitelist` parameters.\n *\n * @memberof workbox.routing\n * @extends workbox.routing.Route\n */\n class NavigationRoute extends Route {\n /**\n * If both `blacklist` and `whiltelist` are provided, the `blacklist` will\n * take precedence and the request will not match this route.\n *\n * The regular expressions in `whitelist` and `blacklist`\n * are matched against the concatenated\n * [`pathname`]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/pathname}\n * and [`search`]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/search}\n * portions of the requested URL.\n *\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n * @param {Object} options\n * @param {Array<RegExp>} [options.blacklist] If any of these patterns match,\n * the route will not handle the request (even if a whitelist RegExp matches).\n * @param {Array<RegExp>} [options.whitelist=[/./]] If any of these patterns\n * match the URL's pathname and search parameter, the route will handle the\n * request (assuming the blacklist doesn't match).\n */\n constructor(handler, { whitelist = [/./], blacklist = [] } = {}) {\n {\n assert_mjs.assert.isArrayOfClass(whitelist, RegExp, {\n moduleName: 'workbox-routing',\n className: 'NavigationRoute',\n funcName: 'constructor',\n paramName: 'options.whitelist'\n });\n assert_mjs.assert.isArrayOfClass(blacklist, RegExp, {\n moduleName: 'workbox-routing',\n className: 'NavigationRoute',\n funcName: 'constructor',\n paramName: 'options.blacklist'\n });\n }\n\n super((...args) => this._match(...args), handler);\n\n this._whitelist = whitelist;\n this._blacklist = blacklist;\n }\n\n /**\n * Routes match handler.\n *\n * @param {Object} options\n * @param {FetchEvent} options.event\n * @param {URL} options.url\n * @return {boolean}\n *\n * @private\n */\n _match({ event, url }) {\n if (event.request.mode !== 'navigate') {\n return false;\n }\n\n const pathnameAndSearch = url.pathname + url.search;\n\n if (this._blacklist.some(regExp => regExp.test(pathnameAndSearch))) {\n {\n logger_mjs.logger.debug(`The navigation route is not being used, since the ` + `request URL matches both the whitelist and blacklist.`);\n }\n return false;\n }\n\n if (this._whitelist.some(regExp => regExp.test(pathnameAndSearch))) {\n {\n logger_mjs.logger.debug(`The navigation route is being used.`);\n }\n return true;\n } else {\n {\n logger_mjs.logger.debug(`The navigation route is not being used, since the ` + `URL being navigated to doesn't match the whitelist.`);\n }\n }\n\n return false;\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var publicAPI = /*#__PURE__*/Object.freeze({\n RegExpRoute: RegExpRoute,\n Route: Route,\n Router: Router,\n NavigationRoute: NavigationRoute\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n {\n assert_mjs.assert.isSwEnv('workbox-routing');\n }\n\n /**\n * @private\n */\n class DefaultRouter extends Router {\n /**\n * Easily register a RegExp, string, or function with a caching\n * strategy to the Router.\n *\n * This method will generate a Route for you if needed and\n * call [Router.registerRoute()]{@link\n * workbox.routing.Router#registerRoute}.\n *\n * @param {\n * RegExp|\n * string|\n * workbox.routing.Route~matchCallback|\n * workbox.routing.Route\n * } capture\n * If the capture param is a `Route`, all other arguments will be ignored.\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n * @param {string} [method='GET'] The HTTP method to match the Route\n * against.\n * @return {workbox.routing.Route} The generated `Route`(Useful for\n * unregistering).\n *\n * @alias workbox.routing.registerRoute\n */\n registerRoute(capture, handler, method = 'GET') {\n let route;\n\n if (typeof capture === 'string') {\n const captureUrl = new URL(capture, location);\n\n {\n if (!(capture.startsWith('/') || capture.startsWith('http'))) {\n throw new WorkboxError_mjs.WorkboxError('invalid-string', {\n moduleName: 'workbox-routing',\n className: 'DefaultRouter',\n funcName: 'registerRoute',\n paramName: 'capture'\n });\n }\n\n // We want to check if Express-style wildcards are in the pathname only.\n // TODO: Remove this log message in v4.\n const valueToCheck = capture.startsWith('http') ? captureUrl.pathname : capture;\n // See https://github.com/pillarjs/path-to-regexp#parameters\n const wildcards = '[*:?+]';\n if (valueToCheck.match(new RegExp(`${wildcards}`))) {\n logger_mjs.logger.debug(`The '$capture' parameter contains an Express-style wildcard ` + `character (${wildcards}). Strings are now always interpreted as ` + `exact matches; use a RegExp for partial or wildcard matches.`);\n }\n }\n\n const matchCallback = ({ url }) => {\n {\n if (url.pathname === captureUrl.pathname && url.origin !== captureUrl.origin) {\n logger_mjs.logger.debug(`${capture} only partially matches the cross-origin URL ` + `${url}. This route will only handle cross-origin requests ` + `if they match the entire URL.`);\n }\n }\n\n return url.href === captureUrl.href;\n };\n\n route = new Route(matchCallback, handler, method);\n } else if (capture instanceof RegExp) {\n route = new RegExpRoute(capture, handler, method);\n } else if (typeof capture === 'function') {\n route = new Route(capture, handler, method);\n } else if (capture instanceof Route) {\n route = capture;\n } else {\n throw new WorkboxError_mjs.WorkboxError('unsupported-route-type', {\n moduleName: 'workbox-routing',\n className: 'DefaultRouter',\n funcName: 'registerRoute',\n paramName: 'capture'\n });\n }\n\n super.registerRoute(route);\n return route;\n }\n\n /**\n * Register a route that will return a precached file for a navigation\n * request. This is useful for the\n * [application shell pattern]{@link https://developers.google.com/web/fundamentals/architecture/app-shell}.\n *\n * This method will generate a\n * [NavigationRoute]{@link workbox.routing.NavigationRoute}\n * and call\n * [Router.registerRoute()]{@link workbox.routing.Router#registerRoute}\n * .\n *\n * @param {string} cachedAssetUrl\n * @param {Object} [options]\n * @param {string} [options.cacheName] Cache name to store and retrieve\n * requests. Defaults to precache cache name provided by\n * [workbox-core.cacheNames]{@link workbox.core.cacheNames}.\n * @param {Array<RegExp>} [options.blacklist=[]] If any of these patterns\n * match, the route will not handle the request (even if a whitelist entry\n * matches).\n * @param {Array<RegExp>} [options.whitelist=[/./]] If any of these patterns\n * match the URL's pathname and search parameter, the route will handle the\n * request (assuming the blacklist doesn't match).\n * @return {workbox.routing.NavigationRoute} Returns the generated\n * Route.\n *\n * @alias workbox.routing.registerNavigationRoute\n */\n registerNavigationRoute(cachedAssetUrl, options = {}) {\n {\n assert_mjs.assert.isType(cachedAssetUrl, 'string', {\n moduleName: 'workbox-routing',\n className: '[default export]',\n funcName: 'registerNavigationRoute',\n paramName: 'cachedAssetUrl'\n });\n }\n\n const cacheName = cacheNames_mjs.cacheNames.getPrecacheName(options.cacheName);\n const handler = () => caches.match(cachedAssetUrl, { cacheName }).then(response => {\n if (response) {\n return response;\n }\n // This shouldn't normally happen, but there are edge cases:\n // https://github.com/GoogleChrome/workbox/issues/1441\n throw new Error(`The cache ${cacheName} did not have an entry for ` + `${cachedAssetUrl}.`);\n }).catch(error => {\n // If there's either a cache miss, or the caches.match() call threw\n // an exception, then attempt to fulfill the navigation request with\n // a response from the network rather than leaving the user with a\n // failed navigation.\n {\n logger_mjs.logger.debug(`Unable to respond to navigation request with cached ` + `response: ${error.message}. Falling back to network.`);\n }\n\n // This might still fail if the browser is offline...\n return fetch(cachedAssetUrl);\n });\n\n const route = new NavigationRoute(handler, {\n whitelist: options.whitelist,\n blacklist: options.blacklist\n });\n super.registerRoute(route);\n\n return route;\n }\n }\n\n const router = new DefaultRouter();\n\n // By default, register a fetch event listener that will respond to a request\n // only if there's a matching route.\n self.addEventListener('fetch', event => {\n const responsePromise = router.handleRequest(event);\n if (responsePromise) {\n event.respondWith(responsePromise);\n }\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const finalExport = Object.assign(router, publicAPI);\n\n return finalExport;\n\n}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));\n"],"file":"workbox-routing.dev.js"}
@@ -1,3 +1,3 @@
1
- this.workbox=this.workbox||{},this.workbox.routing=function(t,e){"use strict";try{self.workbox.v["workbox:routing:3.6.2"]=1}catch(t){}const r="GET";var s=t=>t&&"object"==typeof t?t:{handle:t};class n{constructor(t,e,n){this.handler=s(e),this.match=t,this.method=n||r}}class o extends n{constructor(t,e,r){super(({url:e})=>{const r=t.exec(e.href);return r?e.origin!==location.origin&&0!==r.index?null:r.slice(1):null},e,r)}}class i{constructor(){this.t=new Map}handleRequest(t){const e=new URL(t.request.url);if(!e.protocol.startsWith("http"))return;let r=null,s=null,n=null;const o=this.e(t,e);if(s=o.handler,n=o.params,r=o.route,!s&&this.r&&(s=this.r),!s)return;let i;try{i=s.handle({url:e,event:t,params:n})}catch(t){i=Promise.reject(t)}return i&&this.s&&(i=i.catch(r=>this.s.handle({url:e,event:t,err:r}))),i}e(t,e){const r=this.t.get(t.request.method)||[];for(const s of r){let r=s.match({url:e,event:t});if(r)return Array.isArray(r)&&0===r.length?r=void 0:(r.constructor===Object&&0===Object.keys(r).length||!0===r)&&(r=void 0),{route:s,params:r,handler:s.handler}}return{handler:void 0,params:void 0}}setDefaultHandler(t){this.r=s(t)}setCatchHandler(t){this.s=s(t)}registerRoute(t){this.t.has(t.method)||this.t.set(t.method,[]),this.t.get(t.method).push(t)}unregisterRoute(e){if(!this.t.has(e.method))throw new t.WorkboxError("unregister-route-but-not-found-with-method",{method:e.method});const r=this.t.get(e.method).indexOf(e);if(!(r>-1))throw new t.WorkboxError("unregister-route-route-not-registered");this.t.get(e.method).splice(r,1)}}class u extends n{constructor(t,{whitelist:e=[/./],blacklist:r=[]}={}){super((...t)=>this.n(...t),t),this.o=e,this.i=r}n({event:t,url:e}){if("navigate"!==t.request.mode)return!1;const r=e.pathname+e.search;return!this.i.some(t=>t.test(r))&&!!this.o.some(t=>t.test(r))}}var a=Object.freeze({RegExpRoute:o,Route:n,Router:i,NavigationRoute:u});const c=new class extends i{registerRoute(e,r,s="GET"){let i;if("string"==typeof e){const t=new URL(e,location);i=new n(({url:e})=>e.href===t.href,r,s)}else if(e instanceof RegExp)i=new o(e,r,s);else if("function"==typeof e)i=new n(e,r,s);else{if(!(e instanceof n))throw new t.WorkboxError("unsupported-route-type",{moduleName:"workbox-routing",className:"DefaultRouter",funcName:"registerRoute",paramName:"capture"});i=e}return super.registerRoute(i),i}registerNavigationRoute(t,r={}){const s=e.cacheNames.getPrecacheName(r.cacheName),n=new u(()=>caches.match(t,{cacheName:s}).then(e=>{if(e)return e;throw new Error(`The cache ${s} did not have an entry for `+`${t}.`)}).catch(e=>fetch(t)),{whitelist:r.whitelist,blacklist:r.blacklist});return super.registerRoute(n),n}};return self.addEventListener("fetch",t=>{const e=c.handleRequest(t);e&&t.respondWith(e)}),Object.assign(c,a)}(workbox.core._private,workbox.core._private);
1
+ this.workbox=this.workbox||{},this.workbox.routing=function(t,e){"use strict";try{self.workbox.v["workbox:routing:3.6.3"]=1}catch(t){}const r="GET";var s=t=>t&&"object"==typeof t?t:{handle:t};class n{constructor(t,e,n){this.handler=s(e),this.match=t,this.method=n||r}}class o extends n{constructor(t,e,r){super(({url:e})=>{const r=t.exec(e.href);return r?e.origin!==location.origin&&0!==r.index?null:r.slice(1):null},e,r)}}class i{constructor(){this.t=new Map}handleRequest(t){const e=new URL(t.request.url);if(!e.protocol.startsWith("http"))return;let r=null,s=null,n=null;const o=this.e(t,e);if(s=o.handler,n=o.params,r=o.route,!s&&this.r&&(s=this.r),!s)return;let i;try{i=s.handle({url:e,event:t,params:n})}catch(t){i=Promise.reject(t)}return i&&this.s&&(i=i.catch(r=>this.s.handle({url:e,event:t,err:r}))),i}e(t,e){const r=this.t.get(t.request.method)||[];for(const s of r){let r=s.match({url:e,event:t});if(r)return Array.isArray(r)&&0===r.length?r=void 0:(r.constructor===Object&&0===Object.keys(r).length||!0===r)&&(r=void 0),{route:s,params:r,handler:s.handler}}return{handler:void 0,params:void 0}}setDefaultHandler(t){this.r=s(t)}setCatchHandler(t){this.s=s(t)}registerRoute(t){this.t.has(t.method)||this.t.set(t.method,[]),this.t.get(t.method).push(t)}unregisterRoute(e){if(!this.t.has(e.method))throw new t.WorkboxError("unregister-route-but-not-found-with-method",{method:e.method});const r=this.t.get(e.method).indexOf(e);if(!(r>-1))throw new t.WorkboxError("unregister-route-route-not-registered");this.t.get(e.method).splice(r,1)}}class u extends n{constructor(t,{whitelist:e=[/./],blacklist:r=[]}={}){super((...t)=>this.n(...t),t),this.o=e,this.i=r}n({event:t,url:e}){if("navigate"!==t.request.mode)return!1;const r=e.pathname+e.search;return!this.i.some(t=>t.test(r))&&!!this.o.some(t=>t.test(r))}}var a=Object.freeze({RegExpRoute:o,Route:n,Router:i,NavigationRoute:u});const c=new class extends i{registerRoute(e,r,s="GET"){let i;if("string"==typeof e){const t=new URL(e,location);i=new n(({url:e})=>e.href===t.href,r,s)}else if(e instanceof RegExp)i=new o(e,r,s);else if("function"==typeof e)i=new n(e,r,s);else{if(!(e instanceof n))throw new t.WorkboxError("unsupported-route-type",{moduleName:"workbox-routing",className:"DefaultRouter",funcName:"registerRoute",paramName:"capture"});i=e}return super.registerRoute(i),i}registerNavigationRoute(t,r={}){const s=e.cacheNames.getPrecacheName(r.cacheName),n=new u(()=>caches.match(t,{cacheName:s}).then(e=>{if(e)return e;throw new Error(`The cache ${s} did not have an entry for `+`${t}.`)}).catch(e=>fetch(t)),{whitelist:r.whitelist,blacklist:r.blacklist});return super.registerRoute(n),n}};return self.addEventListener("fetch",t=>{const e=c.handleRequest(t);e&&t.respondWith(e)}),Object.assign(c,a)}(workbox.core._private,workbox.core._private);
2
2
 
3
3
  //# sourceMappingURL=workbox-routing.prod.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-routing/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.routing=function(t,e){\"use strict\";try{self.workbox.v[\"workbox:routing:3.6.2\"]=1}catch(t){}const r=\"GET\";var s=t=>t&&\"object\"==typeof t?t:{handle:t};class n{constructor(t,e,n){this.handler=s(e),this.match=t,this.method=n||r}}class o extends n{constructor(t,e,r){super(({url:e})=>{const r=t.exec(e.href);return r?e.origin!==location.origin&&0!==r.index?null:r.slice(1):null},e,r)}}class i{constructor(){this.t=new Map}handleRequest(t){const e=new URL(t.request.url);if(!e.protocol.startsWith(\"http\"))return;let r=null,s=null,n=null;const o=this.e(t,e);if(s=o.handler,n=o.params,r=o.route,!s&&this.r&&(s=this.r),!s)return;let i;try{i=s.handle({url:e,event:t,params:n})}catch(t){i=Promise.reject(t)}return i&&this.s&&(i=i.catch(r=>this.s.handle({url:e,event:t,err:r}))),i}e(t,e){const r=this.t.get(t.request.method)||[];for(const s of r){let r=s.match({url:e,event:t});if(r)return Array.isArray(r)&&0===r.length?r=void 0:(r.constructor===Object&&0===Object.keys(r).length||!0===r)&&(r=void 0),{route:s,params:r,handler:s.handler}}return{handler:void 0,params:void 0}}setDefaultHandler(t){this.r=s(t)}setCatchHandler(t){this.s=s(t)}registerRoute(t){this.t.has(t.method)||this.t.set(t.method,[]),this.t.get(t.method).push(t)}unregisterRoute(e){if(!this.t.has(e.method))throw new t.WorkboxError(\"unregister-route-but-not-found-with-method\",{method:e.method});const r=this.t.get(e.method).indexOf(e);if(!(r>-1))throw new t.WorkboxError(\"unregister-route-route-not-registered\");this.t.get(e.method).splice(r,1)}}class u extends n{constructor(t,{whitelist:e=[/./],blacklist:r=[]}={}){super((...t)=>this.n(...t),t),this.o=e,this.i=r}n({event:t,url:e}){if(\"navigate\"!==t.request.mode)return!1;const r=e.pathname+e.search;return!this.i.some(t=>t.test(r))&&!!this.o.some(t=>t.test(r))}}var a=Object.freeze({RegExpRoute:o,Route:n,Router:i,NavigationRoute:u});const c=new class extends i{registerRoute(e,r,s=\"GET\"){let i;if(\"string\"==typeof e){const t=new URL(e,location);i=new n(({url:e})=>e.href===t.href,r,s)}else if(e instanceof RegExp)i=new o(e,r,s);else if(\"function\"==typeof e)i=new n(e,r,s);else{if(!(e instanceof n))throw new t.WorkboxError(\"unsupported-route-type\",{moduleName:\"workbox-routing\",className:\"DefaultRouter\",funcName:\"registerRoute\",paramName:\"capture\"});i=e}return super.registerRoute(i),i}registerNavigationRoute(t,r={}){const s=e.cacheNames.getPrecacheName(r.cacheName),n=new u(()=>caches.match(t,{cacheName:s}).then(e=>{if(e)return e;throw new Error(`The cache ${s} did not have an entry for `+`${t}.`)}).catch(e=>fetch(t)),{whitelist:r.whitelist,blacklist:r.blacklist});return super.registerRoute(n),n}};return self.addEventListener(\"fetch\",t=>{const e=c.handleRequest(t);e&&t.respondWith(e)}),Object.assign(c,a)}(workbox.core._private,workbox.core._private);\n"],"file":"workbox-routing.prod.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-routing/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.routing=function(t,e){\"use strict\";try{self.workbox.v[\"workbox:routing:3.6.3\"]=1}catch(t){}const r=\"GET\";var s=t=>t&&\"object\"==typeof t?t:{handle:t};class n{constructor(t,e,n){this.handler=s(e),this.match=t,this.method=n||r}}class o extends n{constructor(t,e,r){super(({url:e})=>{const r=t.exec(e.href);return r?e.origin!==location.origin&&0!==r.index?null:r.slice(1):null},e,r)}}class i{constructor(){this.t=new Map}handleRequest(t){const e=new URL(t.request.url);if(!e.protocol.startsWith(\"http\"))return;let r=null,s=null,n=null;const o=this.e(t,e);if(s=o.handler,n=o.params,r=o.route,!s&&this.r&&(s=this.r),!s)return;let i;try{i=s.handle({url:e,event:t,params:n})}catch(t){i=Promise.reject(t)}return i&&this.s&&(i=i.catch(r=>this.s.handle({url:e,event:t,err:r}))),i}e(t,e){const r=this.t.get(t.request.method)||[];for(const s of r){let r=s.match({url:e,event:t});if(r)return Array.isArray(r)&&0===r.length?r=void 0:(r.constructor===Object&&0===Object.keys(r).length||!0===r)&&(r=void 0),{route:s,params:r,handler:s.handler}}return{handler:void 0,params:void 0}}setDefaultHandler(t){this.r=s(t)}setCatchHandler(t){this.s=s(t)}registerRoute(t){this.t.has(t.method)||this.t.set(t.method,[]),this.t.get(t.method).push(t)}unregisterRoute(e){if(!this.t.has(e.method))throw new t.WorkboxError(\"unregister-route-but-not-found-with-method\",{method:e.method});const r=this.t.get(e.method).indexOf(e);if(!(r>-1))throw new t.WorkboxError(\"unregister-route-route-not-registered\");this.t.get(e.method).splice(r,1)}}class u extends n{constructor(t,{whitelist:e=[/./],blacklist:r=[]}={}){super((...t)=>this.n(...t),t),this.o=e,this.i=r}n({event:t,url:e}){if(\"navigate\"!==t.request.mode)return!1;const r=e.pathname+e.search;return!this.i.some(t=>t.test(r))&&!!this.o.some(t=>t.test(r))}}var a=Object.freeze({RegExpRoute:o,Route:n,Router:i,NavigationRoute:u});const c=new class extends i{registerRoute(e,r,s=\"GET\"){let i;if(\"string\"==typeof e){const t=new URL(e,location);i=new n(({url:e})=>e.href===t.href,r,s)}else if(e instanceof RegExp)i=new o(e,r,s);else if(\"function\"==typeof e)i=new n(e,r,s);else{if(!(e instanceof n))throw new t.WorkboxError(\"unsupported-route-type\",{moduleName:\"workbox-routing\",className:\"DefaultRouter\",funcName:\"registerRoute\",paramName:\"capture\"});i=e}return super.registerRoute(i),i}registerNavigationRoute(t,r={}){const s=e.cacheNames.getPrecacheName(r.cacheName),n=new u(()=>caches.match(t,{cacheName:s}).then(e=>{if(e)return e;throw new Error(`The cache ${s} did not have an entry for `+`${t}.`)}).catch(e=>fetch(t)),{whitelist:r.whitelist,blacklist:r.blacklist});return super.registerRoute(n),n}};return self.addEventListener(\"fetch\",t=>{const e=c.handleRequest(t);e&&t.respondWith(e)}),Object.assign(c,a)}(workbox.core._private,workbox.core._private);\n"],"file":"workbox-routing.prod.js"}
@@ -3,7 +3,7 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
3
3
  'use strict';
4
4
 
5
5
  try {
6
- self.workbox.v['workbox:strategies:3.6.2'] = 1;
6
+ self.workbox.v['workbox:strategies:3.6.3'] = 1;
7
7
  } catch (e) {} // eslint-disable-line
8
8
 
9
9
  /*
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-strategies/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheWrapper_mjs,fetchWrapper_mjs,getFriendlyURL_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:strategies:3.6.2'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const getFriendlyURL = url => {\n const urlObj = new URL(url, location);\n if (urlObj.origin === location.origin) {\n return urlObj.pathname;\n }\n return urlObj.href;\n };\n\n var messages = {\n strategyStart: (strategyName, request) => `Using ${strategyName} to ` + `respond to '${getFriendlyURL(request.url)}'`,\n printFinalResponse: response => {\n if (response) {\n logger_mjs.logger.groupCollapsed(`View the final response here.`);\n logger_mjs.logger.unprefixed.log(response);\n logger_mjs.logger.groupEnd();\n }\n }\n };\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * An implementation of a [cache-first]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#cache-falling-back-to-network}\n * request strategy.\n *\n * A cache first strategy is useful for assets that have been revisioned,\n * such as URLs like `/styles/example.a8f5f1.css`, since they\n * can be cached for long periods of time.\n *\n * @memberof workbox.strategies\n */\n class CacheFirst {\n /**\n * @param {Object} options\n * @param {string} options.cacheName Cache name to store and retrieve\n * requests. Defaults to cache names provided by\n * [workbox-core]{@link workbox.core.cacheNames}.\n * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n * to use in conjunction with this caching strategy.\n * @param {Object} options.fetchOptions Values passed along to the\n * [`init`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)\n * of all fetch() requests made by this strategy.\n * @param {Object} options.matchOptions [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)\n */\n constructor(options = {}) {\n this._cacheName = cacheNames_mjs.cacheNames.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n this._fetchOptions = options.fetchOptions || null;\n this._matchOptions = options.matchOptions || null;\n }\n\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link workbox.routing.Router}.\n *\n * @param {Object} options\n * @param {FetchEvent} options.event The fetch event to run this strategy\n * against.\n * @return {Promise<Response>}\n */\n handle({ event }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-strategies',\n className: 'CacheFirst',\n funcName: 'handle',\n paramName: 'event'\n });\n }\n\n return _this.makeRequest({\n event,\n request: event.request\n });\n })();\n }\n\n /**\n * This method can be used to perform a make a standalone request outside the\n * context of the [Workbox Router]{@link workbox.routing.Router}.\n *\n * See \"[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)\"\n * for more usage information.\n *\n * @param {Object} options\n * @param {Request|string} options.request Either a\n * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}\n * object, or a string URL, corresponding to the request to be made.\n * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will\n be called automatically to extend the service worker's lifetime.\n * @return {Promise<Response>}\n */\n makeRequest({ event, request }) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const logs = [];\n\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'CacheFirst',\n funcName: 'makeRequest',\n paramName: 'request'\n });\n }\n\n let response = yield cacheWrapper_mjs.cacheWrapper.match({\n cacheName: _this2._cacheName,\n request,\n event,\n matchOptions: _this2._matchOptions,\n plugins: _this2._plugins\n });\n\n let error;\n if (!response) {\n {\n logs.push(`No response found in the '${_this2._cacheName}' cache. ` + `Will respond with a network request.`);\n }\n try {\n response = yield _this2._getFromNetwork(request, event);\n } catch (err) {\n error = err;\n }\n\n {\n if (response) {\n logs.push(`Got response from network.`);\n } else {\n logs.push(`Unable to get a response from the network.`);\n }\n }\n } else {\n {\n logs.push(`Found a cached response in the '${_this2._cacheName}' cache.`);\n }\n }\n\n {\n logger_mjs.logger.groupCollapsed(messages.strategyStart('CacheFirst', request));\n for (let log of logs) {\n logger_mjs.logger.log(log);\n }\n messages.printFinalResponse(response);\n logger_mjs.logger.groupEnd();\n }\n\n if (error) {\n // Don't swallow error as we'll want it to throw and enable catch\n // handlers in router.\n throw error;\n }\n\n return response;\n })();\n }\n\n /**\n * Handles the network and cache part of CacheFirst.\n *\n * @param {Request} request\n * @param {FetchEvent} [event]\n * @return {Promise<Response>}\n *\n * @private\n */\n _getFromNetwork(request, event) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const response = yield fetchWrapper_mjs.fetchWrapper.fetch({\n request,\n event,\n fetchOptions: _this3._fetchOptions,\n plugins: _this3._plugins\n });\n\n // Keep the service worker while we put the request to the cache\n const responseClone = response.clone();\n const cachePutPromise = cacheWrapper_mjs.cacheWrapper.put({\n cacheName: _this3._cacheName,\n request,\n response: responseClone,\n event,\n plugins: _this3._plugins\n });\n\n if (event) {\n try {\n event.waitUntil(cachePutPromise);\n } catch (error) {\n {\n logger_mjs.logger.warn(`Unable to ensure service worker stays alive when ` + `updating cache for '${getFriendlyURL_mjs.getFriendlyURL(event.request.url)}'.`);\n }\n }\n }\n\n return response;\n })();\n }\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * An implementation of a\n * [cache-only]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#cache-only}\n * request strategy.\n *\n * This class is useful if you want to take advantage of any [Workbox plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}.\n *\n * @memberof workbox.strategies\n */\n class CacheOnly {\n /**\n * @param {Object} options\n * @param {string} options.cacheName Cache name to store and retrieve\n * requests. Defaults to cache names provided by\n * [workbox-core]{@link workbox.core.cacheNames}.\n * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n * to use in conjunction with this caching strategy.\n * @param {Object} options.matchOptions [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)\n */\n constructor(options = {}) {\n this._cacheName = cacheNames_mjs.cacheNames.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n this._matchOptions = options.matchOptions || null;\n }\n\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link workbox.routing.Router}.\n *\n * @param {Object} options\n * @param {FetchEvent} options.event The fetch event to run this strategy\n * against.\n * @return {Promise<Response>}\n */\n handle({ event }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-strategies',\n className: 'CacheOnly',\n funcName: 'handle',\n paramName: 'event'\n });\n }\n\n return _this.makeRequest({\n event,\n request: event.request\n });\n })();\n }\n\n /**\n * This method can be used to perform a make a standalone request outside the\n * context of the [Workbox Router]{@link workbox.routing.Router}.\n *\n * See \"[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)\"\n * for more usage information.\n *\n * @param {Object} options\n * @param {Request|string} options.request Either a\n * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}\n * object, or a string URL, corresponding to the request to be made.\n * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will\n * be called automatically to extend the service worker's lifetime.\n * @return {Promise<Response>}\n */\n makeRequest({ event, request }) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'CacheOnly',\n funcName: 'makeRequest',\n paramName: 'request'\n });\n }\n\n const response = yield cacheWrapper_mjs.cacheWrapper.match({\n cacheName: _this2._cacheName,\n request,\n event,\n matchOptions: _this2._matchOptions,\n plugins: _this2._plugins\n });\n\n {\n logger_mjs.logger.groupCollapsed(messages.strategyStart('CacheOnly', request));\n if (response) {\n logger_mjs.logger.log(`Found a cached response in the '${_this2._cacheName}'` + ` cache.`);\n messages.printFinalResponse(response);\n } else {\n logger_mjs.logger.log(`No response found in the '${_this2._cacheName}' cache.`);\n }\n logger_mjs.logger.groupEnd();\n }\n\n return response;\n })();\n }\n }\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var cacheOkAndOpaquePlugin = {\n /**\n * Return return a response (i.e. allow caching) if the\n * response is ok (i.e. 200) or is opaque.\n *\n * @param {Object} options\n * @param {Response} options.response\n * @return {Response|null}\n *\n * @private\n */\n cacheWillUpdate: ({ response }) => {\n if (response.ok || response.status === 0) {\n return response;\n }\n return null;\n }\n };\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * An implementation of a\n * [network first]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#network-falling-back-to-cache}\n * request strategy.\n *\n * By default, this strategy will cache responses with a 200 status code as\n * well as [opaque responses]{@link https://developers.google.com/web/tools/workbox/guides/handle-third-party-requests}.\n * Opaque responses are are cross-origin requests where the response doesn't\n * support [CORS]{@link https://enable-cors.org/}.\n *\n * @memberof workbox.strategies\n */\n class NetworkFirst {\n /**\n * @param {Object} options\n * @param {string} options.cacheName Cache name to store and retrieve\n * requests. Defaults to cache names provided by\n * [workbox-core]{@link workbox.core.cacheNames}.\n * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n * to use in conjunction with this caching strategy.\n * @param {Object} options.fetchOptions Values passed along to the\n * [`init`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)\n * of all fetch() requests made by this strategy.\n * @param {Object} options.matchOptions [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)\n * @param {number} options.networkTimeoutSeconds If set, any network requests\n * that fail to respond within the timeout will fallback to the cache.\n *\n * This option can be used to combat\n * \"[lie-fi]{@link https://developers.google.com/web/fundamentals/performance/poor-connectivity/#lie-fi}\"\n * scenarios.\n */\n constructor(options = {}) {\n this._cacheName = cacheNames_mjs.cacheNames.getRuntimeName(options.cacheName);\n\n if (options.plugins) {\n let isUsingCacheWillUpdate = options.plugins.some(plugin => !!plugin.cacheWillUpdate);\n this._plugins = isUsingCacheWillUpdate ? options.plugins : [cacheOkAndOpaquePlugin, ...options.plugins];\n } else {\n // No plugins passed in, use the default plugin.\n this._plugins = [cacheOkAndOpaquePlugin];\n }\n\n this._networkTimeoutSeconds = options.networkTimeoutSeconds;\n {\n if (this._networkTimeoutSeconds) {\n assert_mjs.assert.isType(this._networkTimeoutSeconds, 'number', {\n moduleName: 'workbox-strategies',\n className: 'NetworkFirst',\n funcName: 'constructor',\n paramName: 'networkTimeoutSeconds'\n });\n }\n }\n\n this._fetchOptions = options.fetchOptions || null;\n this._matchOptions = options.matchOptions || null;\n }\n\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link workbox.routing.Router}.\n *\n * @param {Object} options\n * @param {FetchEvent} options.event The fetch event to run this strategy\n * against.\n * @return {Promise<Response>}\n */\n handle({ event }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-strategies',\n className: 'NetworkFirst',\n funcName: 'handle',\n paramName: 'event'\n });\n }\n\n return _this.makeRequest({\n event,\n request: event.request\n });\n })();\n }\n\n /**\n * This method can be used to perform a make a standalone request outside the\n * context of the [Workbox Router]{@link workbox.routing.Router}.\n *\n * See \"[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)\"\n * for more usage information.\n *\n * @param {Object} options\n * @param {Request|string} options.request Either a\n * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}\n * object, or a string URL, corresponding to the request to be made.\n * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will\n * be called automatically to extend the service worker's lifetime.\n * @return {Promise<Response>}\n */\n makeRequest({ event, request }) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const logs = [];\n\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'NetworkFirst',\n funcName: 'handle',\n paramName: 'makeRequest'\n });\n }\n\n const promises = [];\n let timeoutId;\n\n if (_this2._networkTimeoutSeconds) {\n const { id, promise } = _this2._getTimeoutPromise({ request, event, logs });\n timeoutId = id;\n promises.push(promise);\n }\n\n const networkPromise = _this2._getNetworkPromise({ timeoutId, request, event, logs });\n promises.push(networkPromise);\n\n // Promise.race() will resolve as soon as the first promise resolves.\n let response = yield Promise.race(promises);\n // If Promise.race() resolved with null, it might be due to a network\n // timeout + a cache miss. If that were to happen, we'd rather wait until\n // the networkPromise resolves instead of returning null.\n // Note that it's fine to await an already-resolved promise, so we don't\n // have to check to see if it's still \"in flight\".\n if (!response) {\n response = yield networkPromise;\n }\n\n {\n logger_mjs.logger.groupCollapsed(messages.strategyStart('NetworkFirst', request));\n for (let log of logs) {\n logger_mjs.logger.log(log);\n }\n messages.printFinalResponse(response);\n logger_mjs.logger.groupEnd();\n }\n\n return response;\n })();\n }\n\n /**\n * @param {Object} options\n * @param {Request} options.request\n * @param {Array} options.logs A reference to the logs array\n * @param {Event} [options.event]\n * @return {Promise<Response>}\n *\n * @private\n */\n _getTimeoutPromise({ request, logs, event }) {\n var _this3 = this;\n\n let timeoutId;\n const timeoutPromise = new Promise(resolve => {\n const onNetworkTimeout = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* () {\n {\n logs.push(`Timing out the network response at ` + `${_this3._networkTimeoutSeconds} seconds.`);\n }\n\n resolve((yield _this3._respondFromCache({ request, event })));\n });\n\n return function onNetworkTimeout() {\n return _ref.apply(this, arguments);\n };\n })();\n\n timeoutId = setTimeout(onNetworkTimeout, this._networkTimeoutSeconds * 1000);\n });\n\n return {\n promise: timeoutPromise,\n id: timeoutId\n };\n }\n\n /**\n * @param {Object} options\n * @param {number|undefined} options.timeoutId\n * @param {Request} options.request\n * @param {Array} options.logs A reference to the logs Array.\n * @param {Event} [options.event]\n * @return {Promise<Response>}\n *\n * @private\n */\n _getNetworkPromise({ timeoutId, request, logs, event }) {\n var _this4 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n let error;\n let response;\n try {\n response = yield fetchWrapper_mjs.fetchWrapper.fetch({\n request,\n event,\n fetchOptions: _this4._fetchOptions,\n plugins: _this4._plugins\n });\n } catch (err) {\n error = err;\n }\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n\n {\n if (response) {\n logs.push(`Got response from network.`);\n } else {\n logs.push(`Unable to get a response from the network. Will respond ` + `with a cached response.`);\n }\n }\n\n if (error || !response) {\n response = yield _this4._respondFromCache({ request, event });\n {\n if (response) {\n logs.push(`Found a cached response in the '${_this4._cacheName}'` + ` cache.`);\n } else {\n logs.push(`No response found in the '${_this4._cacheName}' cache.`);\n }\n }\n } else {\n // Keep the service worker alive while we put the request in the cache\n const responseClone = response.clone();\n const cachePut = cacheWrapper_mjs.cacheWrapper.put({\n cacheName: _this4._cacheName,\n request,\n response: responseClone,\n event,\n plugins: _this4._plugins\n });\n\n if (event) {\n try {\n // The event has been responded to so we can keep the SW alive to\n // respond to the request\n event.waitUntil(cachePut);\n } catch (err) {\n {\n logger_mjs.logger.warn(`Unable to ensure service worker stays alive when ` + `updating cache for '${getFriendlyURL_mjs.getFriendlyURL(event.request.url)}'.`);\n }\n }\n }\n }\n\n return response;\n })();\n }\n\n /**\n * Used if the network timeouts or fails to make the request.\n *\n * @param {Object} options\n * @param {Request} request The request to match in the cache\n * @param {Event} [options.event]\n * @return {Promise<Object>}\n *\n * @private\n */\n _respondFromCache({ event, request }) {\n return cacheWrapper_mjs.cacheWrapper.match({\n cacheName: this._cacheName,\n request,\n event,\n matchOptions: this._matchOptions,\n plugins: this._plugins\n });\n }\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * An implementation of a\n * [network-only]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#network-only}\n * request strategy.\n *\n * This class is useful if you want to take advantage of any [Workbox plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}.\n *\n * @memberof workbox.strategies\n */\n class NetworkOnly {\n /**\n * @param {Object} options\n * @param {string} options.cacheName Cache name to store and retrieve\n * requests. Defaults to cache names provided by\n * [workbox-core]{@link workbox.core.cacheNames}.\n * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n * to use in conjunction with this caching strategy.\n * @param {Object} options.fetchOptions Values passed along to the\n * [`init`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)\n * of all fetch() requests made by this strategy.\n */\n constructor(options = {}) {\n this._cacheName = cacheNames_mjs.cacheNames.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n this._fetchOptions = options.fetchOptions || null;\n }\n\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link workbox.routing.Router}.\n *\n * @param {Object} options\n * @param {FetchEvent} options.event The fetch event to run this strategy\n * against.\n * @return {Promise<Response>}\n */\n handle({ event }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-strategies',\n className: 'NetworkOnly',\n funcName: 'handle',\n paramName: 'event'\n });\n }\n\n return _this.makeRequest({\n event,\n request: event.request\n });\n })();\n }\n\n /**\n * This method can be used to perform a make a standalone request outside the\n * context of the [Workbox Router]{@link workbox.routing.Router}.\n *\n * See \"[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)\"\n * for more usage information.\n *\n * @param {Object} options\n * @param {Request|string} options.request Either a\n * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}\n * object, or a string URL, corresponding to the request to be made.\n * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will\n * be called automatically to extend the service worker's lifetime.\n * @return {Promise<Response>}\n */\n makeRequest({ event, request }) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'NetworkOnly',\n funcName: 'handle',\n paramName: 'request'\n });\n }\n\n let error;\n let response;\n try {\n response = yield fetchWrapper_mjs.fetchWrapper.fetch({\n request,\n event,\n fetchOptions: _this2._fetchOptions,\n plugins: _this2._plugins\n });\n } catch (err) {\n error = err;\n }\n\n {\n logger_mjs.logger.groupCollapsed(messages.strategyStart('NetworkOnly', request));\n if (response) {\n logger_mjs.logger.log(`Got response from network.`);\n } else {\n logger_mjs.logger.log(`Unable to get a response from the network.`);\n }\n messages.printFinalResponse(response);\n logger_mjs.logger.groupEnd();\n }\n\n // If there was an error thrown, re-throw it to ensure the Routers\n // catch handler is triggered.\n if (error) {\n throw error;\n }\n\n return response;\n })();\n }\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * An implementation of a\n * [stale-while-revalidate]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#stale-while-revalidate}\n * request strategy.\n *\n * Resources are requested from both the cache and the network in parallel.\n * The strategy will respond with the cached version if available, otherwise\n * wait for the network response. The cache is updated with the network response\n * with each successful request.\n *\n * By default, this strategy will cache responses with a 200 status code as\n * well as [opaque responses]{@link https://developers.google.com/web/tools/workbox/guides/handle-third-party-requests}.\n * Opaque responses are are cross-origin requests where the response doesn't\n * support [CORS]{@link https://enable-cors.org/}.\n *\n * @memberof workbox.strategies\n */\n class StaleWhileRevalidate {\n /**\n * @param {Object} options\n * @param {string} options.cacheName Cache name to store and retrieve\n * requests. Defaults to cache names provided by\n * [workbox-core]{@link workbox.core.cacheNames}.\n * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n * to use in conjunction with this caching strategy.\n * @param {Object} options.fetchOptions Values passed along to the\n * [`init`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)\n * of all fetch() requests made by this strategy.\n * @param {Object} options.matchOptions [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)\n */\n constructor(options = {}) {\n this._cacheName = cacheNames_mjs.cacheNames.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n\n if (options.plugins) {\n let isUsingCacheWillUpdate = options.plugins.some(plugin => !!plugin.cacheWillUpdate);\n this._plugins = isUsingCacheWillUpdate ? options.plugins : [cacheOkAndOpaquePlugin, ...options.plugins];\n } else {\n // No plugins passed in, use the default plugin.\n this._plugins = [cacheOkAndOpaquePlugin];\n }\n\n this._fetchOptions = options.fetchOptions || null;\n this._matchOptions = options.matchOptions || null;\n }\n\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link workbox.routing.Router}.\n *\n * @param {Object} options\n * @param {FetchEvent} options.event The fetch event to run this strategy\n * against.\n * @return {Promise<Response>}\n */\n handle({ event }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-strategies',\n className: 'StaleWhileRevalidate',\n funcName: 'handle',\n paramName: 'event'\n });\n }\n\n return _this.makeRequest({\n event,\n request: event.request\n });\n })();\n }\n\n /**\n * This method can be used to perform a make a standalone request outside the\n * context of the [Workbox Router]{@link workbox.routing.Router}.\n *\n * See \"[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)\"\n * for more usage information.\n *\n * @param {Object} options\n * @param {Request|string} options.request Either a\n * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}\n * object, or a string URL, corresponding to the request to be made.\n * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will\n * be called automatically to extend the service worker's lifetime.\n * @return {Promise<Response>}\n */\n makeRequest({ event, request }) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const logs = [];\n\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'StaleWhileRevalidate',\n funcName: 'handle',\n paramName: 'request'\n });\n }\n\n const fetchAndCachePromise = _this2._getFromNetwork({ request, event });\n\n let response = yield cacheWrapper_mjs.cacheWrapper.match({\n cacheName: _this2._cacheName,\n request,\n event,\n matchOptions: _this2._matchOptions,\n plugins: _this2._plugins\n });\n\n if (response) {\n {\n logs.push(`Found a cached response in the '${_this2._cacheName}'` + ` cache. Will update with the network response in the background.`);\n }\n\n if (event) {\n try {\n event.waitUntil(fetchAndCachePromise);\n } catch (error) {\n {\n logger_mjs.logger.warn(`Unable to ensure service worker stays alive when ` + `updating cache for '${getFriendlyURL_mjs.getFriendlyURL(event.request.url)}'.`);\n }\n }\n }\n } else {\n {\n logs.push(`No response found in the '${_this2._cacheName}' cache. ` + `Will wait for the network response.`);\n }\n response = yield fetchAndCachePromise;\n }\n\n {\n logger_mjs.logger.groupCollapsed(messages.strategyStart('StaleWhileRevalidate', request));\n for (let log of logs) {\n logger_mjs.logger.log(log);\n }\n messages.printFinalResponse(response);\n logger_mjs.logger.groupEnd();\n }\n\n return response;\n })();\n }\n\n /**\n * @param {Object} options\n * @param {Request} options.request\n * @param {Event} [options.event]\n * @return {Promise<Response>}\n *\n * @private\n */\n _getFromNetwork({ request, event }) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const response = yield fetchWrapper_mjs.fetchWrapper.fetch({\n request,\n event,\n fetchOptions: _this3._fetchOptions,\n plugins: _this3._plugins\n });\n\n const cachePutPromise = cacheWrapper_mjs.cacheWrapper.put({\n cacheName: _this3._cacheName,\n request,\n response: response.clone(),\n event,\n plugins: _this3._plugins\n });\n\n if (event) {\n try {\n event.waitUntil(cachePutPromise);\n } catch (error) {\n {\n logger_mjs.logger.warn(`Unable to ensure service worker stays alive when ` + `updating cache for '${getFriendlyURL_mjs.getFriendlyURL(event.request.url)}'.`);\n }\n }\n }\n\n return response;\n })();\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var publicAPI = /*#__PURE__*/Object.freeze({\n CacheFirst: CacheFirst,\n CacheOnly: CacheOnly,\n NetworkFirst: NetworkFirst,\n NetworkOnly: NetworkOnly,\n StaleWhileRevalidate: StaleWhileRevalidate\n });\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @function workbox.strategies.cacheFirst\n * @param {Object} options See the {@link workbox.strategies.CacheFirst}\n * constructor for more info.\n */\n\n /**\n * @function workbox.strategies.cacheOnly\n * @param {Object} options See the {@link workbox.strategies.CacheOnly}\n * constructor for more info.\n */\n\n /**\n * @function workbox.strategies.networkFirst\n * @param {Object} options See the {@link workbox.strategies.NetworkFirst}\n * constructor for more info.\n */\n\n /**\n * @function workbox.strategies.networkOnly\n * @param {Object} options See the {@link workbox.strategies.NetworkOnly}\n * constructor for more info.\n */\n\n /**\n * @function workbox.strategies.staleWhileRevalidate\n * @param {Object} options See the\n * {@link workbox.strategies.StaleWhileRevalidate} constructor for more info.\n */\n\n const mapping = {\n cacheFirst: CacheFirst,\n cacheOnly: CacheOnly,\n networkFirst: NetworkFirst,\n networkOnly: NetworkOnly,\n staleWhileRevalidate: StaleWhileRevalidate\n };\n\n const defaultExport = {};\n Object.keys(mapping).forEach(keyName => {\n defaultExport[keyName] = (options = {}) => {\n const StrategyClass = mapping[keyName];\n return new StrategyClass(Object.assign(options));\n };\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const finalExport = Object.assign(defaultExport, publicAPI);\n\n return finalExport;\n\n}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));\n"],"file":"workbox-strategies.dev.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-strategies/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheWrapper_mjs,fetchWrapper_mjs,getFriendlyURL_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:strategies:3.6.3'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const getFriendlyURL = url => {\n const urlObj = new URL(url, location);\n if (urlObj.origin === location.origin) {\n return urlObj.pathname;\n }\n return urlObj.href;\n };\n\n var messages = {\n strategyStart: (strategyName, request) => `Using ${strategyName} to ` + `respond to '${getFriendlyURL(request.url)}'`,\n printFinalResponse: response => {\n if (response) {\n logger_mjs.logger.groupCollapsed(`View the final response here.`);\n logger_mjs.logger.unprefixed.log(response);\n logger_mjs.logger.groupEnd();\n }\n }\n };\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * An implementation of a [cache-first]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#cache-falling-back-to-network}\n * request strategy.\n *\n * A cache first strategy is useful for assets that have been revisioned,\n * such as URLs like `/styles/example.a8f5f1.css`, since they\n * can be cached for long periods of time.\n *\n * @memberof workbox.strategies\n */\n class CacheFirst {\n /**\n * @param {Object} options\n * @param {string} options.cacheName Cache name to store and retrieve\n * requests. Defaults to cache names provided by\n * [workbox-core]{@link workbox.core.cacheNames}.\n * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n * to use in conjunction with this caching strategy.\n * @param {Object} options.fetchOptions Values passed along to the\n * [`init`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)\n * of all fetch() requests made by this strategy.\n * @param {Object} options.matchOptions [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)\n */\n constructor(options = {}) {\n this._cacheName = cacheNames_mjs.cacheNames.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n this._fetchOptions = options.fetchOptions || null;\n this._matchOptions = options.matchOptions || null;\n }\n\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link workbox.routing.Router}.\n *\n * @param {Object} options\n * @param {FetchEvent} options.event The fetch event to run this strategy\n * against.\n * @return {Promise<Response>}\n */\n handle({ event }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-strategies',\n className: 'CacheFirst',\n funcName: 'handle',\n paramName: 'event'\n });\n }\n\n return _this.makeRequest({\n event,\n request: event.request\n });\n })();\n }\n\n /**\n * This method can be used to perform a make a standalone request outside the\n * context of the [Workbox Router]{@link workbox.routing.Router}.\n *\n * See \"[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)\"\n * for more usage information.\n *\n * @param {Object} options\n * @param {Request|string} options.request Either a\n * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}\n * object, or a string URL, corresponding to the request to be made.\n * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will\n be called automatically to extend the service worker's lifetime.\n * @return {Promise<Response>}\n */\n makeRequest({ event, request }) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const logs = [];\n\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'CacheFirst',\n funcName: 'makeRequest',\n paramName: 'request'\n });\n }\n\n let response = yield cacheWrapper_mjs.cacheWrapper.match({\n cacheName: _this2._cacheName,\n request,\n event,\n matchOptions: _this2._matchOptions,\n plugins: _this2._plugins\n });\n\n let error;\n if (!response) {\n {\n logs.push(`No response found in the '${_this2._cacheName}' cache. ` + `Will respond with a network request.`);\n }\n try {\n response = yield _this2._getFromNetwork(request, event);\n } catch (err) {\n error = err;\n }\n\n {\n if (response) {\n logs.push(`Got response from network.`);\n } else {\n logs.push(`Unable to get a response from the network.`);\n }\n }\n } else {\n {\n logs.push(`Found a cached response in the '${_this2._cacheName}' cache.`);\n }\n }\n\n {\n logger_mjs.logger.groupCollapsed(messages.strategyStart('CacheFirst', request));\n for (let log of logs) {\n logger_mjs.logger.log(log);\n }\n messages.printFinalResponse(response);\n logger_mjs.logger.groupEnd();\n }\n\n if (error) {\n // Don't swallow error as we'll want it to throw and enable catch\n // handlers in router.\n throw error;\n }\n\n return response;\n })();\n }\n\n /**\n * Handles the network and cache part of CacheFirst.\n *\n * @param {Request} request\n * @param {FetchEvent} [event]\n * @return {Promise<Response>}\n *\n * @private\n */\n _getFromNetwork(request, event) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const response = yield fetchWrapper_mjs.fetchWrapper.fetch({\n request,\n event,\n fetchOptions: _this3._fetchOptions,\n plugins: _this3._plugins\n });\n\n // Keep the service worker while we put the request to the cache\n const responseClone = response.clone();\n const cachePutPromise = cacheWrapper_mjs.cacheWrapper.put({\n cacheName: _this3._cacheName,\n request,\n response: responseClone,\n event,\n plugins: _this3._plugins\n });\n\n if (event) {\n try {\n event.waitUntil(cachePutPromise);\n } catch (error) {\n {\n logger_mjs.logger.warn(`Unable to ensure service worker stays alive when ` + `updating cache for '${getFriendlyURL_mjs.getFriendlyURL(event.request.url)}'.`);\n }\n }\n }\n\n return response;\n })();\n }\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * An implementation of a\n * [cache-only]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#cache-only}\n * request strategy.\n *\n * This class is useful if you want to take advantage of any [Workbox plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}.\n *\n * @memberof workbox.strategies\n */\n class CacheOnly {\n /**\n * @param {Object} options\n * @param {string} options.cacheName Cache name to store and retrieve\n * requests. Defaults to cache names provided by\n * [workbox-core]{@link workbox.core.cacheNames}.\n * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n * to use in conjunction with this caching strategy.\n * @param {Object} options.matchOptions [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)\n */\n constructor(options = {}) {\n this._cacheName = cacheNames_mjs.cacheNames.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n this._matchOptions = options.matchOptions || null;\n }\n\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link workbox.routing.Router}.\n *\n * @param {Object} options\n * @param {FetchEvent} options.event The fetch event to run this strategy\n * against.\n * @return {Promise<Response>}\n */\n handle({ event }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-strategies',\n className: 'CacheOnly',\n funcName: 'handle',\n paramName: 'event'\n });\n }\n\n return _this.makeRequest({\n event,\n request: event.request\n });\n })();\n }\n\n /**\n * This method can be used to perform a make a standalone request outside the\n * context of the [Workbox Router]{@link workbox.routing.Router}.\n *\n * See \"[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)\"\n * for more usage information.\n *\n * @param {Object} options\n * @param {Request|string} options.request Either a\n * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}\n * object, or a string URL, corresponding to the request to be made.\n * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will\n * be called automatically to extend the service worker's lifetime.\n * @return {Promise<Response>}\n */\n makeRequest({ event, request }) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'CacheOnly',\n funcName: 'makeRequest',\n paramName: 'request'\n });\n }\n\n const response = yield cacheWrapper_mjs.cacheWrapper.match({\n cacheName: _this2._cacheName,\n request,\n event,\n matchOptions: _this2._matchOptions,\n plugins: _this2._plugins\n });\n\n {\n logger_mjs.logger.groupCollapsed(messages.strategyStart('CacheOnly', request));\n if (response) {\n logger_mjs.logger.log(`Found a cached response in the '${_this2._cacheName}'` + ` cache.`);\n messages.printFinalResponse(response);\n } else {\n logger_mjs.logger.log(`No response found in the '${_this2._cacheName}' cache.`);\n }\n logger_mjs.logger.groupEnd();\n }\n\n return response;\n })();\n }\n }\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var cacheOkAndOpaquePlugin = {\n /**\n * Return return a response (i.e. allow caching) if the\n * response is ok (i.e. 200) or is opaque.\n *\n * @param {Object} options\n * @param {Response} options.response\n * @return {Response|null}\n *\n * @private\n */\n cacheWillUpdate: ({ response }) => {\n if (response.ok || response.status === 0) {\n return response;\n }\n return null;\n }\n };\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * An implementation of a\n * [network first]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#network-falling-back-to-cache}\n * request strategy.\n *\n * By default, this strategy will cache responses with a 200 status code as\n * well as [opaque responses]{@link https://developers.google.com/web/tools/workbox/guides/handle-third-party-requests}.\n * Opaque responses are are cross-origin requests where the response doesn't\n * support [CORS]{@link https://enable-cors.org/}.\n *\n * @memberof workbox.strategies\n */\n class NetworkFirst {\n /**\n * @param {Object} options\n * @param {string} options.cacheName Cache name to store and retrieve\n * requests. Defaults to cache names provided by\n * [workbox-core]{@link workbox.core.cacheNames}.\n * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n * to use in conjunction with this caching strategy.\n * @param {Object} options.fetchOptions Values passed along to the\n * [`init`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)\n * of all fetch() requests made by this strategy.\n * @param {Object} options.matchOptions [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)\n * @param {number} options.networkTimeoutSeconds If set, any network requests\n * that fail to respond within the timeout will fallback to the cache.\n *\n * This option can be used to combat\n * \"[lie-fi]{@link https://developers.google.com/web/fundamentals/performance/poor-connectivity/#lie-fi}\"\n * scenarios.\n */\n constructor(options = {}) {\n this._cacheName = cacheNames_mjs.cacheNames.getRuntimeName(options.cacheName);\n\n if (options.plugins) {\n let isUsingCacheWillUpdate = options.plugins.some(plugin => !!plugin.cacheWillUpdate);\n this._plugins = isUsingCacheWillUpdate ? options.plugins : [cacheOkAndOpaquePlugin, ...options.plugins];\n } else {\n // No plugins passed in, use the default plugin.\n this._plugins = [cacheOkAndOpaquePlugin];\n }\n\n this._networkTimeoutSeconds = options.networkTimeoutSeconds;\n {\n if (this._networkTimeoutSeconds) {\n assert_mjs.assert.isType(this._networkTimeoutSeconds, 'number', {\n moduleName: 'workbox-strategies',\n className: 'NetworkFirst',\n funcName: 'constructor',\n paramName: 'networkTimeoutSeconds'\n });\n }\n }\n\n this._fetchOptions = options.fetchOptions || null;\n this._matchOptions = options.matchOptions || null;\n }\n\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link workbox.routing.Router}.\n *\n * @param {Object} options\n * @param {FetchEvent} options.event The fetch event to run this strategy\n * against.\n * @return {Promise<Response>}\n */\n handle({ event }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-strategies',\n className: 'NetworkFirst',\n funcName: 'handle',\n paramName: 'event'\n });\n }\n\n return _this.makeRequest({\n event,\n request: event.request\n });\n })();\n }\n\n /**\n * This method can be used to perform a make a standalone request outside the\n * context of the [Workbox Router]{@link workbox.routing.Router}.\n *\n * See \"[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)\"\n * for more usage information.\n *\n * @param {Object} options\n * @param {Request|string} options.request Either a\n * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}\n * object, or a string URL, corresponding to the request to be made.\n * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will\n * be called automatically to extend the service worker's lifetime.\n * @return {Promise<Response>}\n */\n makeRequest({ event, request }) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const logs = [];\n\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'NetworkFirst',\n funcName: 'handle',\n paramName: 'makeRequest'\n });\n }\n\n const promises = [];\n let timeoutId;\n\n if (_this2._networkTimeoutSeconds) {\n const { id, promise } = _this2._getTimeoutPromise({ request, event, logs });\n timeoutId = id;\n promises.push(promise);\n }\n\n const networkPromise = _this2._getNetworkPromise({ timeoutId, request, event, logs });\n promises.push(networkPromise);\n\n // Promise.race() will resolve as soon as the first promise resolves.\n let response = yield Promise.race(promises);\n // If Promise.race() resolved with null, it might be due to a network\n // timeout + a cache miss. If that were to happen, we'd rather wait until\n // the networkPromise resolves instead of returning null.\n // Note that it's fine to await an already-resolved promise, so we don't\n // have to check to see if it's still \"in flight\".\n if (!response) {\n response = yield networkPromise;\n }\n\n {\n logger_mjs.logger.groupCollapsed(messages.strategyStart('NetworkFirst', request));\n for (let log of logs) {\n logger_mjs.logger.log(log);\n }\n messages.printFinalResponse(response);\n logger_mjs.logger.groupEnd();\n }\n\n return response;\n })();\n }\n\n /**\n * @param {Object} options\n * @param {Request} options.request\n * @param {Array} options.logs A reference to the logs array\n * @param {Event} [options.event]\n * @return {Promise<Response>}\n *\n * @private\n */\n _getTimeoutPromise({ request, logs, event }) {\n var _this3 = this;\n\n let timeoutId;\n const timeoutPromise = new Promise(resolve => {\n const onNetworkTimeout = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* () {\n {\n logs.push(`Timing out the network response at ` + `${_this3._networkTimeoutSeconds} seconds.`);\n }\n\n resolve((yield _this3._respondFromCache({ request, event })));\n });\n\n return function onNetworkTimeout() {\n return _ref.apply(this, arguments);\n };\n })();\n\n timeoutId = setTimeout(onNetworkTimeout, this._networkTimeoutSeconds * 1000);\n });\n\n return {\n promise: timeoutPromise,\n id: timeoutId\n };\n }\n\n /**\n * @param {Object} options\n * @param {number|undefined} options.timeoutId\n * @param {Request} options.request\n * @param {Array} options.logs A reference to the logs Array.\n * @param {Event} [options.event]\n * @return {Promise<Response>}\n *\n * @private\n */\n _getNetworkPromise({ timeoutId, request, logs, event }) {\n var _this4 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n let error;\n let response;\n try {\n response = yield fetchWrapper_mjs.fetchWrapper.fetch({\n request,\n event,\n fetchOptions: _this4._fetchOptions,\n plugins: _this4._plugins\n });\n } catch (err) {\n error = err;\n }\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n\n {\n if (response) {\n logs.push(`Got response from network.`);\n } else {\n logs.push(`Unable to get a response from the network. Will respond ` + `with a cached response.`);\n }\n }\n\n if (error || !response) {\n response = yield _this4._respondFromCache({ request, event });\n {\n if (response) {\n logs.push(`Found a cached response in the '${_this4._cacheName}'` + ` cache.`);\n } else {\n logs.push(`No response found in the '${_this4._cacheName}' cache.`);\n }\n }\n } else {\n // Keep the service worker alive while we put the request in the cache\n const responseClone = response.clone();\n const cachePut = cacheWrapper_mjs.cacheWrapper.put({\n cacheName: _this4._cacheName,\n request,\n response: responseClone,\n event,\n plugins: _this4._plugins\n });\n\n if (event) {\n try {\n // The event has been responded to so we can keep the SW alive to\n // respond to the request\n event.waitUntil(cachePut);\n } catch (err) {\n {\n logger_mjs.logger.warn(`Unable to ensure service worker stays alive when ` + `updating cache for '${getFriendlyURL_mjs.getFriendlyURL(event.request.url)}'.`);\n }\n }\n }\n }\n\n return response;\n })();\n }\n\n /**\n * Used if the network timeouts or fails to make the request.\n *\n * @param {Object} options\n * @param {Request} request The request to match in the cache\n * @param {Event} [options.event]\n * @return {Promise<Object>}\n *\n * @private\n */\n _respondFromCache({ event, request }) {\n return cacheWrapper_mjs.cacheWrapper.match({\n cacheName: this._cacheName,\n request,\n event,\n matchOptions: this._matchOptions,\n plugins: this._plugins\n });\n }\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * An implementation of a\n * [network-only]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#network-only}\n * request strategy.\n *\n * This class is useful if you want to take advantage of any [Workbox plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}.\n *\n * @memberof workbox.strategies\n */\n class NetworkOnly {\n /**\n * @param {Object} options\n * @param {string} options.cacheName Cache name to store and retrieve\n * requests. Defaults to cache names provided by\n * [workbox-core]{@link workbox.core.cacheNames}.\n * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n * to use in conjunction with this caching strategy.\n * @param {Object} options.fetchOptions Values passed along to the\n * [`init`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)\n * of all fetch() requests made by this strategy.\n */\n constructor(options = {}) {\n this._cacheName = cacheNames_mjs.cacheNames.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n this._fetchOptions = options.fetchOptions || null;\n }\n\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link workbox.routing.Router}.\n *\n * @param {Object} options\n * @param {FetchEvent} options.event The fetch event to run this strategy\n * against.\n * @return {Promise<Response>}\n */\n handle({ event }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-strategies',\n className: 'NetworkOnly',\n funcName: 'handle',\n paramName: 'event'\n });\n }\n\n return _this.makeRequest({\n event,\n request: event.request\n });\n })();\n }\n\n /**\n * This method can be used to perform a make a standalone request outside the\n * context of the [Workbox Router]{@link workbox.routing.Router}.\n *\n * See \"[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)\"\n * for more usage information.\n *\n * @param {Object} options\n * @param {Request|string} options.request Either a\n * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}\n * object, or a string URL, corresponding to the request to be made.\n * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will\n * be called automatically to extend the service worker's lifetime.\n * @return {Promise<Response>}\n */\n makeRequest({ event, request }) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'NetworkOnly',\n funcName: 'handle',\n paramName: 'request'\n });\n }\n\n let error;\n let response;\n try {\n response = yield fetchWrapper_mjs.fetchWrapper.fetch({\n request,\n event,\n fetchOptions: _this2._fetchOptions,\n plugins: _this2._plugins\n });\n } catch (err) {\n error = err;\n }\n\n {\n logger_mjs.logger.groupCollapsed(messages.strategyStart('NetworkOnly', request));\n if (response) {\n logger_mjs.logger.log(`Got response from network.`);\n } else {\n logger_mjs.logger.log(`Unable to get a response from the network.`);\n }\n messages.printFinalResponse(response);\n logger_mjs.logger.groupEnd();\n }\n\n // If there was an error thrown, re-throw it to ensure the Routers\n // catch handler is triggered.\n if (error) {\n throw error;\n }\n\n return response;\n })();\n }\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * An implementation of a\n * [stale-while-revalidate]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#stale-while-revalidate}\n * request strategy.\n *\n * Resources are requested from both the cache and the network in parallel.\n * The strategy will respond with the cached version if available, otherwise\n * wait for the network response. The cache is updated with the network response\n * with each successful request.\n *\n * By default, this strategy will cache responses with a 200 status code as\n * well as [opaque responses]{@link https://developers.google.com/web/tools/workbox/guides/handle-third-party-requests}.\n * Opaque responses are are cross-origin requests where the response doesn't\n * support [CORS]{@link https://enable-cors.org/}.\n *\n * @memberof workbox.strategies\n */\n class StaleWhileRevalidate {\n /**\n * @param {Object} options\n * @param {string} options.cacheName Cache name to store and retrieve\n * requests. Defaults to cache names provided by\n * [workbox-core]{@link workbox.core.cacheNames}.\n * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n * to use in conjunction with this caching strategy.\n * @param {Object} options.fetchOptions Values passed along to the\n * [`init`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)\n * of all fetch() requests made by this strategy.\n * @param {Object} options.matchOptions [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)\n */\n constructor(options = {}) {\n this._cacheName = cacheNames_mjs.cacheNames.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n\n if (options.plugins) {\n let isUsingCacheWillUpdate = options.plugins.some(plugin => !!plugin.cacheWillUpdate);\n this._plugins = isUsingCacheWillUpdate ? options.plugins : [cacheOkAndOpaquePlugin, ...options.plugins];\n } else {\n // No plugins passed in, use the default plugin.\n this._plugins = [cacheOkAndOpaquePlugin];\n }\n\n this._fetchOptions = options.fetchOptions || null;\n this._matchOptions = options.matchOptions || null;\n }\n\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link workbox.routing.Router}.\n *\n * @param {Object} options\n * @param {FetchEvent} options.event The fetch event to run this strategy\n * against.\n * @return {Promise<Response>}\n */\n handle({ event }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-strategies',\n className: 'StaleWhileRevalidate',\n funcName: 'handle',\n paramName: 'event'\n });\n }\n\n return _this.makeRequest({\n event,\n request: event.request\n });\n })();\n }\n\n /**\n * This method can be used to perform a make a standalone request outside the\n * context of the [Workbox Router]{@link workbox.routing.Router}.\n *\n * See \"[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)\"\n * for more usage information.\n *\n * @param {Object} options\n * @param {Request|string} options.request Either a\n * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}\n * object, or a string URL, corresponding to the request to be made.\n * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will\n * be called automatically to extend the service worker's lifetime.\n * @return {Promise<Response>}\n */\n makeRequest({ event, request }) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const logs = [];\n\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'StaleWhileRevalidate',\n funcName: 'handle',\n paramName: 'request'\n });\n }\n\n const fetchAndCachePromise = _this2._getFromNetwork({ request, event });\n\n let response = yield cacheWrapper_mjs.cacheWrapper.match({\n cacheName: _this2._cacheName,\n request,\n event,\n matchOptions: _this2._matchOptions,\n plugins: _this2._plugins\n });\n\n if (response) {\n {\n logs.push(`Found a cached response in the '${_this2._cacheName}'` + ` cache. Will update with the network response in the background.`);\n }\n\n if (event) {\n try {\n event.waitUntil(fetchAndCachePromise);\n } catch (error) {\n {\n logger_mjs.logger.warn(`Unable to ensure service worker stays alive when ` + `updating cache for '${getFriendlyURL_mjs.getFriendlyURL(event.request.url)}'.`);\n }\n }\n }\n } else {\n {\n logs.push(`No response found in the '${_this2._cacheName}' cache. ` + `Will wait for the network response.`);\n }\n response = yield fetchAndCachePromise;\n }\n\n {\n logger_mjs.logger.groupCollapsed(messages.strategyStart('StaleWhileRevalidate', request));\n for (let log of logs) {\n logger_mjs.logger.log(log);\n }\n messages.printFinalResponse(response);\n logger_mjs.logger.groupEnd();\n }\n\n return response;\n })();\n }\n\n /**\n * @param {Object} options\n * @param {Request} options.request\n * @param {Event} [options.event]\n * @return {Promise<Response>}\n *\n * @private\n */\n _getFromNetwork({ request, event }) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const response = yield fetchWrapper_mjs.fetchWrapper.fetch({\n request,\n event,\n fetchOptions: _this3._fetchOptions,\n plugins: _this3._plugins\n });\n\n const cachePutPromise = cacheWrapper_mjs.cacheWrapper.put({\n cacheName: _this3._cacheName,\n request,\n response: response.clone(),\n event,\n plugins: _this3._plugins\n });\n\n if (event) {\n try {\n event.waitUntil(cachePutPromise);\n } catch (error) {\n {\n logger_mjs.logger.warn(`Unable to ensure service worker stays alive when ` + `updating cache for '${getFriendlyURL_mjs.getFriendlyURL(event.request.url)}'.`);\n }\n }\n }\n\n return response;\n })();\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var publicAPI = /*#__PURE__*/Object.freeze({\n CacheFirst: CacheFirst,\n CacheOnly: CacheOnly,\n NetworkFirst: NetworkFirst,\n NetworkOnly: NetworkOnly,\n StaleWhileRevalidate: StaleWhileRevalidate\n });\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @function workbox.strategies.cacheFirst\n * @param {Object} options See the {@link workbox.strategies.CacheFirst}\n * constructor for more info.\n */\n\n /**\n * @function workbox.strategies.cacheOnly\n * @param {Object} options See the {@link workbox.strategies.CacheOnly}\n * constructor for more info.\n */\n\n /**\n * @function workbox.strategies.networkFirst\n * @param {Object} options See the {@link workbox.strategies.NetworkFirst}\n * constructor for more info.\n */\n\n /**\n * @function workbox.strategies.networkOnly\n * @param {Object} options See the {@link workbox.strategies.NetworkOnly}\n * constructor for more info.\n */\n\n /**\n * @function workbox.strategies.staleWhileRevalidate\n * @param {Object} options See the\n * {@link workbox.strategies.StaleWhileRevalidate} constructor for more info.\n */\n\n const mapping = {\n cacheFirst: CacheFirst,\n cacheOnly: CacheOnly,\n networkFirst: NetworkFirst,\n networkOnly: NetworkOnly,\n staleWhileRevalidate: StaleWhileRevalidate\n };\n\n const defaultExport = {};\n Object.keys(mapping).forEach(keyName => {\n defaultExport[keyName] = (options = {}) => {\n const StrategyClass = mapping[keyName];\n return new StrategyClass(Object.assign(options));\n };\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const finalExport = Object.assign(defaultExport, publicAPI);\n\n return finalExport;\n\n}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));\n"],"file":"workbox-strategies.dev.js"}
@@ -1,3 +1,3 @@
1
- this.workbox=this.workbox||{},this.workbox.strategies=function(e,t,s){"use strict";try{self.workbox.v["workbox:strategies:3.6.2"]=1}catch(e){}class r{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.s=t.fetchOptions||null,this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:s}){var r=this;return babelHelpers.asyncToGenerator(function*(){"string"==typeof s&&(s=new Request(s));let n,i=yield t.cacheWrapper.match({cacheName:r.e,request:s,event:e,matchOptions:r.r,plugins:r.t});if(!i)try{i=yield r.n(s,e)}catch(e){n=e}if(n)throw n;return i})()}n(e,r){var n=this;return babelHelpers.asyncToGenerator(function*(){const i=yield s.fetchWrapper.fetch({request:e,event:r,fetchOptions:n.s,plugins:n.t}),u=i.clone(),l=t.cacheWrapper.put({cacheName:n.e,request:e,response:u,event:r,plugins:n.t});if(r)try{r.waitUntil(l)}catch(e){}return i})()}}class n{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:s}){var r=this;return babelHelpers.asyncToGenerator(function*(){return"string"==typeof s&&(s=new Request(s)),yield t.cacheWrapper.match({cacheName:r.e,request:s,event:e,matchOptions:r.r,plugins:r.t})})()}}var i={cacheWillUpdate:({response:e})=>e.ok||0===e.status?e:null};class u{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[i,...t.plugins]}else this.t=[i];this.i=t.networkTimeoutSeconds,this.s=t.fetchOptions||null,this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var s=this;return babelHelpers.asyncToGenerator(function*(){const r=[];"string"==typeof t&&(t=new Request(t));const n=[];let i;if(s.i){const{id:u,promise:l}=s.u({request:t,event:e,logs:r});i=u,n.push(l)}const u=s.l({timeoutId:i,request:t,event:e,logs:r});n.push(u);let l=yield Promise.race(n);return l||(l=yield u),l})()}u({request:e,logs:t,event:s}){var r=this;let n;var i;return{promise:new Promise(t=>{const u=(i=babelHelpers.asyncToGenerator(function*(){t(yield r.c({request:e,event:s}))}),function(){return i.apply(this,arguments)});n=setTimeout(u,1e3*this.i)}),id:n}}l({timeoutId:e,request:r,logs:n,event:i}){var u=this;return babelHelpers.asyncToGenerator(function*(){let n,l;try{l=yield s.fetchWrapper.fetch({request:r,event:i,fetchOptions:u.s,plugins:u.t})}catch(e){n=e}if(e&&clearTimeout(e),n||!l)l=yield u.c({request:r,event:i});else{const e=l.clone(),s=t.cacheWrapper.put({cacheName:u.e,request:r,response:e,event:i,plugins:u.t});if(i)try{i.waitUntil(s)}catch(e){}}return l})()}c({event:e,request:s}){return t.cacheWrapper.match({cacheName:this.e,request:s,event:e,matchOptions:this.r,plugins:this.t})}}class l{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.s=t.fetchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var r=this;return babelHelpers.asyncToGenerator(function*(){let n,i;"string"==typeof t&&(t=new Request(t));try{i=yield s.fetchWrapper.fetch({request:t,event:e,fetchOptions:r.s,plugins:r.t})}catch(e){n=e}if(n)throw n;return i})()}}class c{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[i,...t.plugins]}else this.t=[i];this.s=t.fetchOptions||null,this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:s}){var r=this;return babelHelpers.asyncToGenerator(function*(){"string"==typeof s&&(s=new Request(s));const n=r.n({request:s,event:e});let i=yield t.cacheWrapper.match({cacheName:r.e,request:s,event:e,matchOptions:r.r,plugins:r.t});if(i){if(e)try{e.waitUntil(n)}catch(e){}}else i=yield n;return i})()}n({request:e,event:r}){var n=this;return babelHelpers.asyncToGenerator(function*(){const i=yield s.fetchWrapper.fetch({request:e,event:r,fetchOptions:n.s,plugins:n.t}),u=t.cacheWrapper.put({cacheName:n.e,request:e,response:i.clone(),event:r,plugins:n.t});if(r)try{r.waitUntil(u)}catch(e){}return i})()}}var o=Object.freeze({CacheFirst:r,CacheOnly:n,NetworkFirst:u,NetworkOnly:l,StaleWhileRevalidate:c});const a={cacheFirst:r,cacheOnly:n,networkFirst:u,networkOnly:l,staleWhileRevalidate:c},h={};return Object.keys(a).forEach(e=>{h[e]=((t={})=>{return new(0,a[e])(Object.assign(t))})}),Object.assign(h,o)}(workbox.core._private,workbox.core._private,workbox.core._private);
1
+ this.workbox=this.workbox||{},this.workbox.strategies=function(e,t,s){"use strict";try{self.workbox.v["workbox:strategies:3.6.3"]=1}catch(e){}class r{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.s=t.fetchOptions||null,this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:s}){var r=this;return babelHelpers.asyncToGenerator(function*(){"string"==typeof s&&(s=new Request(s));let n,i=yield t.cacheWrapper.match({cacheName:r.e,request:s,event:e,matchOptions:r.r,plugins:r.t});if(!i)try{i=yield r.n(s,e)}catch(e){n=e}if(n)throw n;return i})()}n(e,r){var n=this;return babelHelpers.asyncToGenerator(function*(){const i=yield s.fetchWrapper.fetch({request:e,event:r,fetchOptions:n.s,plugins:n.t}),u=i.clone(),l=t.cacheWrapper.put({cacheName:n.e,request:e,response:u,event:r,plugins:n.t});if(r)try{r.waitUntil(l)}catch(e){}return i})()}}class n{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:s}){var r=this;return babelHelpers.asyncToGenerator(function*(){return"string"==typeof s&&(s=new Request(s)),yield t.cacheWrapper.match({cacheName:r.e,request:s,event:e,matchOptions:r.r,plugins:r.t})})()}}var i={cacheWillUpdate:({response:e})=>e.ok||0===e.status?e:null};class u{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[i,...t.plugins]}else this.t=[i];this.i=t.networkTimeoutSeconds,this.s=t.fetchOptions||null,this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var s=this;return babelHelpers.asyncToGenerator(function*(){const r=[];"string"==typeof t&&(t=new Request(t));const n=[];let i;if(s.i){const{id:u,promise:l}=s.u({request:t,event:e,logs:r});i=u,n.push(l)}const u=s.l({timeoutId:i,request:t,event:e,logs:r});n.push(u);let l=yield Promise.race(n);return l||(l=yield u),l})()}u({request:e,logs:t,event:s}){var r=this;let n;var i;return{promise:new Promise(t=>{const u=(i=babelHelpers.asyncToGenerator(function*(){t(yield r.c({request:e,event:s}))}),function(){return i.apply(this,arguments)});n=setTimeout(u,1e3*this.i)}),id:n}}l({timeoutId:e,request:r,logs:n,event:i}){var u=this;return babelHelpers.asyncToGenerator(function*(){let n,l;try{l=yield s.fetchWrapper.fetch({request:r,event:i,fetchOptions:u.s,plugins:u.t})}catch(e){n=e}if(e&&clearTimeout(e),n||!l)l=yield u.c({request:r,event:i});else{const e=l.clone(),s=t.cacheWrapper.put({cacheName:u.e,request:r,response:e,event:i,plugins:u.t});if(i)try{i.waitUntil(s)}catch(e){}}return l})()}c({event:e,request:s}){return t.cacheWrapper.match({cacheName:this.e,request:s,event:e,matchOptions:this.r,plugins:this.t})}}class l{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.s=t.fetchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var r=this;return babelHelpers.asyncToGenerator(function*(){let n,i;"string"==typeof t&&(t=new Request(t));try{i=yield s.fetchWrapper.fetch({request:t,event:e,fetchOptions:r.s,plugins:r.t})}catch(e){n=e}if(n)throw n;return i})()}}class c{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[i,...t.plugins]}else this.t=[i];this.s=t.fetchOptions||null,this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:s}){var r=this;return babelHelpers.asyncToGenerator(function*(){"string"==typeof s&&(s=new Request(s));const n=r.n({request:s,event:e});let i=yield t.cacheWrapper.match({cacheName:r.e,request:s,event:e,matchOptions:r.r,plugins:r.t});if(i){if(e)try{e.waitUntil(n)}catch(e){}}else i=yield n;return i})()}n({request:e,event:r}){var n=this;return babelHelpers.asyncToGenerator(function*(){const i=yield s.fetchWrapper.fetch({request:e,event:r,fetchOptions:n.s,plugins:n.t}),u=t.cacheWrapper.put({cacheName:n.e,request:e,response:i.clone(),event:r,plugins:n.t});if(r)try{r.waitUntil(u)}catch(e){}return i})()}}var o=Object.freeze({CacheFirst:r,CacheOnly:n,NetworkFirst:u,NetworkOnly:l,StaleWhileRevalidate:c});const a={cacheFirst:r,cacheOnly:n,networkFirst:u,networkOnly:l,staleWhileRevalidate:c},h={};return Object.keys(a).forEach(e=>{h[e]=((t={})=>{return new(0,a[e])(Object.assign(t))})}),Object.assign(h,o)}(workbox.core._private,workbox.core._private,workbox.core._private);
2
2
 
3
3
  //# sourceMappingURL=workbox-strategies.prod.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-strategies/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.strategies=function(e,t,s){\"use strict\";try{self.workbox.v[\"workbox:strategies:3.6.2\"]=1}catch(e){}class r{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.s=t.fetchOptions||null,this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:s}){var r=this;return babelHelpers.asyncToGenerator(function*(){\"string\"==typeof s&&(s=new Request(s));let n,i=yield t.cacheWrapper.match({cacheName:r.e,request:s,event:e,matchOptions:r.r,plugins:r.t});if(!i)try{i=yield r.n(s,e)}catch(e){n=e}if(n)throw n;return i})()}n(e,r){var n=this;return babelHelpers.asyncToGenerator(function*(){const i=yield s.fetchWrapper.fetch({request:e,event:r,fetchOptions:n.s,plugins:n.t}),u=i.clone(),l=t.cacheWrapper.put({cacheName:n.e,request:e,response:u,event:r,plugins:n.t});if(r)try{r.waitUntil(l)}catch(e){}return i})()}}class n{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:s}){var r=this;return babelHelpers.asyncToGenerator(function*(){return\"string\"==typeof s&&(s=new Request(s)),yield t.cacheWrapper.match({cacheName:r.e,request:s,event:e,matchOptions:r.r,plugins:r.t})})()}}var i={cacheWillUpdate:({response:e})=>e.ok||0===e.status?e:null};class u{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[i,...t.plugins]}else this.t=[i];this.i=t.networkTimeoutSeconds,this.s=t.fetchOptions||null,this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var s=this;return babelHelpers.asyncToGenerator(function*(){const r=[];\"string\"==typeof t&&(t=new Request(t));const n=[];let i;if(s.i){const{id:u,promise:l}=s.u({request:t,event:e,logs:r});i=u,n.push(l)}const u=s.l({timeoutId:i,request:t,event:e,logs:r});n.push(u);let l=yield Promise.race(n);return l||(l=yield u),l})()}u({request:e,logs:t,event:s}){var r=this;let n;var i;return{promise:new Promise(t=>{const u=(i=babelHelpers.asyncToGenerator(function*(){t(yield r.c({request:e,event:s}))}),function(){return i.apply(this,arguments)});n=setTimeout(u,1e3*this.i)}),id:n}}l({timeoutId:e,request:r,logs:n,event:i}){var u=this;return babelHelpers.asyncToGenerator(function*(){let n,l;try{l=yield s.fetchWrapper.fetch({request:r,event:i,fetchOptions:u.s,plugins:u.t})}catch(e){n=e}if(e&&clearTimeout(e),n||!l)l=yield u.c({request:r,event:i});else{const e=l.clone(),s=t.cacheWrapper.put({cacheName:u.e,request:r,response:e,event:i,plugins:u.t});if(i)try{i.waitUntil(s)}catch(e){}}return l})()}c({event:e,request:s}){return t.cacheWrapper.match({cacheName:this.e,request:s,event:e,matchOptions:this.r,plugins:this.t})}}class l{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.s=t.fetchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var r=this;return babelHelpers.asyncToGenerator(function*(){let n,i;\"string\"==typeof t&&(t=new Request(t));try{i=yield s.fetchWrapper.fetch({request:t,event:e,fetchOptions:r.s,plugins:r.t})}catch(e){n=e}if(n)throw n;return i})()}}class c{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[i,...t.plugins]}else this.t=[i];this.s=t.fetchOptions||null,this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:s}){var r=this;return babelHelpers.asyncToGenerator(function*(){\"string\"==typeof s&&(s=new Request(s));const n=r.n({request:s,event:e});let i=yield t.cacheWrapper.match({cacheName:r.e,request:s,event:e,matchOptions:r.r,plugins:r.t});if(i){if(e)try{e.waitUntil(n)}catch(e){}}else i=yield n;return i})()}n({request:e,event:r}){var n=this;return babelHelpers.asyncToGenerator(function*(){const i=yield s.fetchWrapper.fetch({request:e,event:r,fetchOptions:n.s,plugins:n.t}),u=t.cacheWrapper.put({cacheName:n.e,request:e,response:i.clone(),event:r,plugins:n.t});if(r)try{r.waitUntil(u)}catch(e){}return i})()}}var o=Object.freeze({CacheFirst:r,CacheOnly:n,NetworkFirst:u,NetworkOnly:l,StaleWhileRevalidate:c});const a={cacheFirst:r,cacheOnly:n,networkFirst:u,networkOnly:l,staleWhileRevalidate:c},h={};return Object.keys(a).forEach(e=>{h[e]=((t={})=>{return new(0,a[e])(Object.assign(t))})}),Object.assign(h,o)}(workbox.core._private,workbox.core._private,workbox.core._private);\n"],"file":"workbox-strategies.prod.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-strategies/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.strategies=function(e,t,s){\"use strict\";try{self.workbox.v[\"workbox:strategies:3.6.3\"]=1}catch(e){}class r{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.s=t.fetchOptions||null,this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:s}){var r=this;return babelHelpers.asyncToGenerator(function*(){\"string\"==typeof s&&(s=new Request(s));let n,i=yield t.cacheWrapper.match({cacheName:r.e,request:s,event:e,matchOptions:r.r,plugins:r.t});if(!i)try{i=yield r.n(s,e)}catch(e){n=e}if(n)throw n;return i})()}n(e,r){var n=this;return babelHelpers.asyncToGenerator(function*(){const i=yield s.fetchWrapper.fetch({request:e,event:r,fetchOptions:n.s,plugins:n.t}),u=i.clone(),l=t.cacheWrapper.put({cacheName:n.e,request:e,response:u,event:r,plugins:n.t});if(r)try{r.waitUntil(l)}catch(e){}return i})()}}class n{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:s}){var r=this;return babelHelpers.asyncToGenerator(function*(){return\"string\"==typeof s&&(s=new Request(s)),yield t.cacheWrapper.match({cacheName:r.e,request:s,event:e,matchOptions:r.r,plugins:r.t})})()}}var i={cacheWillUpdate:({response:e})=>e.ok||0===e.status?e:null};class u{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[i,...t.plugins]}else this.t=[i];this.i=t.networkTimeoutSeconds,this.s=t.fetchOptions||null,this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var s=this;return babelHelpers.asyncToGenerator(function*(){const r=[];\"string\"==typeof t&&(t=new Request(t));const n=[];let i;if(s.i){const{id:u,promise:l}=s.u({request:t,event:e,logs:r});i=u,n.push(l)}const u=s.l({timeoutId:i,request:t,event:e,logs:r});n.push(u);let l=yield Promise.race(n);return l||(l=yield u),l})()}u({request:e,logs:t,event:s}){var r=this;let n;var i;return{promise:new Promise(t=>{const u=(i=babelHelpers.asyncToGenerator(function*(){t(yield r.c({request:e,event:s}))}),function(){return i.apply(this,arguments)});n=setTimeout(u,1e3*this.i)}),id:n}}l({timeoutId:e,request:r,logs:n,event:i}){var u=this;return babelHelpers.asyncToGenerator(function*(){let n,l;try{l=yield s.fetchWrapper.fetch({request:r,event:i,fetchOptions:u.s,plugins:u.t})}catch(e){n=e}if(e&&clearTimeout(e),n||!l)l=yield u.c({request:r,event:i});else{const e=l.clone(),s=t.cacheWrapper.put({cacheName:u.e,request:r,response:e,event:i,plugins:u.t});if(i)try{i.waitUntil(s)}catch(e){}}return l})()}c({event:e,request:s}){return t.cacheWrapper.match({cacheName:this.e,request:s,event:e,matchOptions:this.r,plugins:this.t})}}class l{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.s=t.fetchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var r=this;return babelHelpers.asyncToGenerator(function*(){let n,i;\"string\"==typeof t&&(t=new Request(t));try{i=yield s.fetchWrapper.fetch({request:t,event:e,fetchOptions:r.s,plugins:r.t})}catch(e){n=e}if(n)throw n;return i})()}}class c{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[i,...t.plugins]}else this.t=[i];this.s=t.fetchOptions||null,this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:s}){var r=this;return babelHelpers.asyncToGenerator(function*(){\"string\"==typeof s&&(s=new Request(s));const n=r.n({request:s,event:e});let i=yield t.cacheWrapper.match({cacheName:r.e,request:s,event:e,matchOptions:r.r,plugins:r.t});if(i){if(e)try{e.waitUntil(n)}catch(e){}}else i=yield n;return i})()}n({request:e,event:r}){var n=this;return babelHelpers.asyncToGenerator(function*(){const i=yield s.fetchWrapper.fetch({request:e,event:r,fetchOptions:n.s,plugins:n.t}),u=t.cacheWrapper.put({cacheName:n.e,request:e,response:i.clone(),event:r,plugins:n.t});if(r)try{r.waitUntil(u)}catch(e){}return i})()}}var o=Object.freeze({CacheFirst:r,CacheOnly:n,NetworkFirst:u,NetworkOnly:l,StaleWhileRevalidate:c});const a={cacheFirst:r,cacheOnly:n,networkFirst:u,networkOnly:l,staleWhileRevalidate:c},h={};return Object.keys(a).forEach(e=>{h[e]=((t={})=>{return new(0,a[e])(Object.assign(t))})}),Object.assign(h,o)}(workbox.core._private,workbox.core._private,workbox.core._private);\n"],"file":"workbox-strategies.prod.js"}
@@ -3,7 +3,7 @@ this.workbox.streams = (function (exports,logger_mjs,assert_mjs) {
3
3
  'use strict';
4
4
 
5
5
  try {
6
- self.workbox.v['workbox:streams:3.6.2'] = 1;
6
+ self.workbox.v['workbox:streams:3.6.3'] = 1;
7
7
  } catch (e) {} // eslint-disable-line
8
8
 
9
9
  /*
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-streams/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.streams = (function (exports,logger_mjs,assert_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:streams:3.6.2'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Takes either a Response, a ReadableStream, or a\n * [BodyInit](https://fetch.spec.whatwg.org/#bodyinit) and returns the\n * ReadableStreamReader object associated with it.\n *\n * @param {workbox.streams.StreamSource} source\n * @return {ReadableStreamReader}\n * @private\n */\n function _getReaderFromSource(source) {\n if (source.body && source.body.getReader) {\n return source.body.getReader();\n }\n\n if (source.getReader) {\n return source.getReader();\n }\n\n // TODO: This should be possible to do by constructing a ReadableStream, but\n // I can't get it to work. As a hack, construct a new Response, and use the\n // reader associated with its body.\n return new Response(source).body.getReader();\n }\n\n /**\n * Takes multiple source Promises, each of which could resolve to a Response, a\n * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit).\n *\n * Returns an object exposing a ReadableStream with each individual stream's\n * data returned in sequence, along with a Promise which signals when the\n * stream is finished (useful for passing to a FetchEvent's waitUntil()).\n *\n * @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises\n * @return {Object<{done: Promise, stream: ReadableStream}>}\n *\n * @memberof workbox.streams\n */\n function concatenate(sourcePromises) {\n {\n assert_mjs.assert.isArray(sourcePromises, {\n moduleName: 'workbox-streams',\n funcName: 'concatenate',\n paramName: 'sourcePromises'\n });\n }\n\n const readerPromises = sourcePromises.map(sourcePromise => {\n return Promise.resolve(sourcePromise).then(source => {\n return _getReaderFromSource(source);\n });\n });\n\n let fullyStreamedResolve;\n let fullyStreamedReject;\n const done = new Promise((resolve, reject) => {\n fullyStreamedResolve = resolve;\n fullyStreamedReject = reject;\n });\n\n let i = 0;\n const logMessages = [];\n const stream = new ReadableStream({\n pull(controller) {\n return readerPromises[i].then(reader => reader.read()).then(result => {\n if (result.done) {\n {\n logMessages.push(['Reached the end of source:', sourcePromises[i]]);\n }\n\n i++;\n if (i >= readerPromises.length) {\n // Log all the messages in the group at once in a single group.\n {\n logger_mjs.logger.groupCollapsed(`Concatenating ${readerPromises.length} sources.`);\n for (const message of logMessages) {\n if (Array.isArray(message)) {\n logger_mjs.logger.log(...message);\n } else {\n logger_mjs.logger.log(message);\n }\n }\n logger_mjs.logger.log('Finished reading all sources.');\n logger_mjs.logger.groupEnd();\n }\n\n controller.close();\n fullyStreamedResolve();\n return;\n }\n\n return this.pull(controller);\n } else {\n controller.enqueue(result.value);\n }\n }).catch(error => {\n {\n logger_mjs.logger.error('An error occurred:', error);\n }\n fullyStreamedReject(error);\n throw error;\n });\n },\n\n cancel() {\n {\n logger_mjs.logger.warn('The ReadableStream was cancelled.');\n }\n\n fullyStreamedResolve();\n }\n });\n\n return { done, stream };\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * This is a utility method that determines whether the current browser supports\n * the features required to create streamed responses. Currently, it checks if\n * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)\n * is available.\n *\n * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,\n * `'text/html'` will be used by default.\n * @return {boolean} `true`, if the current browser meets the requirements for\n * streaming responses, and `false` otherwise.\n *\n * @memberof workbox.streams\n */\n function createHeaders(headersInit = {}) {\n // See https://github.com/GoogleChrome/workbox/issues/1461\n const headers = new Headers(headersInit);\n if (!headers.has('content-type')) {\n headers.set('content-type', 'text/html');\n }\n return headers;\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Takes multiple source Promises, each of which could resolve to a Response, a\n * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit),\n * along with a\n * [HeadersInit](https://fetch.spec.whatwg.org/#typedefdef-headersinit).\n *\n * Returns an object exposing a Response whose body consists of each individual\n * stream's data returned in sequence, along with a Promise which signals when\n * the stream is finished (useful for passing to a FetchEvent's waitUntil()).\n *\n * @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises\n * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,\n * `'text/html'` will be used by default.\n * @return {Object<{done: Promise, response: Response}>}\n *\n * @memberof workbox.streams\n */\n function concatenateToResponse(sourcePromises, headersInit) {\n const { done, stream } = concatenate(sourcePromises);\n\n const headers = createHeaders(headersInit);\n const response = new Response(stream, { headers });\n\n return { done, response };\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n let cachedIsSupported = undefined;\n\n /**\n * This is a utility method that determines whether the current browser supports\n * the features required to create streamed responses. Currently, it checks if\n * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)\n * can be created.\n *\n * @return {boolean} `true`, if the current browser meets the requirements for\n * streaming responses, and `false` otherwise.\n *\n * @memberof workbox.streams\n */\n function isSupported() {\n if (cachedIsSupported === undefined) {\n // See https://github.com/GoogleChrome/workbox/issues/1473\n try {\n new ReadableStream({ start() {} });\n cachedIsSupported = true;\n } catch (error) {\n cachedIsSupported = false;\n }\n }\n\n return cachedIsSupported;\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * A shortcut to create a strategy that could be dropped-in to Workbox's router.\n *\n * On browsers that do not support constructing new `ReadableStream`s, this\n * strategy will automatically wait for all the `sourceFunctions` to complete,\n * and create a final response that concatenates their values together.\n *\n * @param {\n * Array<function(workbox.routing.Route~handlerCallback)>} sourceFunctions\n * Each function should return a {@link workbox.streams.StreamSource} (or a\n * Promise which resolves to one).\n * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,\n * `'text/html'` will be used by default.\n * @return {workbox.routing.Route~handlerCallback}\n *\n * @memberof workbox.streams\n */\n function strategy(sourceFunctions, headersInit) {\n return (() => {\n var _ref = babelHelpers.asyncToGenerator(function* ({ event, url, params }) {\n if (isSupported()) {\n const { done, response } = concatenateToResponse(sourceFunctions.map(function (sourceFunction) {\n return sourceFunction({ event, url, params });\n }), headersInit);\n event.waitUntil(done);\n return response;\n }\n\n {\n logger_mjs.logger.log(`The current browser doesn't support creating response ` + `streams. Falling back to non-streaming response instead.`);\n }\n\n // Fallback to waiting for everything to finish, and concatenating the\n // responses.\n const parts = yield Promise.all(sourceFunctions.map(function (sourceFunction) {\n return sourceFunction({ event, url, params });\n }).map((() => {\n var _ref2 = babelHelpers.asyncToGenerator(function* (responsePromise) {\n const response = yield responsePromise;\n if (response instanceof Response) {\n return response.blob();\n }\n\n // Otherwise, assume it's something like a string which can be used\n // as-is when constructing the final composite blob.\n return response;\n });\n\n return function (_x2) {\n return _ref2.apply(this, arguments);\n };\n })()));\n\n const headers = createHeaders(headersInit);\n // Constructing a new Response from a Blob source is well-supported.\n // So is constructing a new Blob from multiple source Blobs or strings.\n return new Response(new Blob(parts), { headers });\n });\n\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n })();\n }\n\n /*\n Copyright 2018 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n Copyright 2018 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.concatenate = concatenate;\n exports.concatenateToResponse = concatenateToResponse;\n exports.isSupported = isSupported;\n exports.strategy = strategy;\n\n return exports;\n\n}({},workbox.core._private,workbox.core._private));\n"],"file":"workbox-streams.dev.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-streams/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.streams = (function (exports,logger_mjs,assert_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:streams:3.6.3'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Takes either a Response, a ReadableStream, or a\n * [BodyInit](https://fetch.spec.whatwg.org/#bodyinit) and returns the\n * ReadableStreamReader object associated with it.\n *\n * @param {workbox.streams.StreamSource} source\n * @return {ReadableStreamReader}\n * @private\n */\n function _getReaderFromSource(source) {\n if (source.body && source.body.getReader) {\n return source.body.getReader();\n }\n\n if (source.getReader) {\n return source.getReader();\n }\n\n // TODO: This should be possible to do by constructing a ReadableStream, but\n // I can't get it to work. As a hack, construct a new Response, and use the\n // reader associated with its body.\n return new Response(source).body.getReader();\n }\n\n /**\n * Takes multiple source Promises, each of which could resolve to a Response, a\n * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit).\n *\n * Returns an object exposing a ReadableStream with each individual stream's\n * data returned in sequence, along with a Promise which signals when the\n * stream is finished (useful for passing to a FetchEvent's waitUntil()).\n *\n * @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises\n * @return {Object<{done: Promise, stream: ReadableStream}>}\n *\n * @memberof workbox.streams\n */\n function concatenate(sourcePromises) {\n {\n assert_mjs.assert.isArray(sourcePromises, {\n moduleName: 'workbox-streams',\n funcName: 'concatenate',\n paramName: 'sourcePromises'\n });\n }\n\n const readerPromises = sourcePromises.map(sourcePromise => {\n return Promise.resolve(sourcePromise).then(source => {\n return _getReaderFromSource(source);\n });\n });\n\n let fullyStreamedResolve;\n let fullyStreamedReject;\n const done = new Promise((resolve, reject) => {\n fullyStreamedResolve = resolve;\n fullyStreamedReject = reject;\n });\n\n let i = 0;\n const logMessages = [];\n const stream = new ReadableStream({\n pull(controller) {\n return readerPromises[i].then(reader => reader.read()).then(result => {\n if (result.done) {\n {\n logMessages.push(['Reached the end of source:', sourcePromises[i]]);\n }\n\n i++;\n if (i >= readerPromises.length) {\n // Log all the messages in the group at once in a single group.\n {\n logger_mjs.logger.groupCollapsed(`Concatenating ${readerPromises.length} sources.`);\n for (const message of logMessages) {\n if (Array.isArray(message)) {\n logger_mjs.logger.log(...message);\n } else {\n logger_mjs.logger.log(message);\n }\n }\n logger_mjs.logger.log('Finished reading all sources.');\n logger_mjs.logger.groupEnd();\n }\n\n controller.close();\n fullyStreamedResolve();\n return;\n }\n\n return this.pull(controller);\n } else {\n controller.enqueue(result.value);\n }\n }).catch(error => {\n {\n logger_mjs.logger.error('An error occurred:', error);\n }\n fullyStreamedReject(error);\n throw error;\n });\n },\n\n cancel() {\n {\n logger_mjs.logger.warn('The ReadableStream was cancelled.');\n }\n\n fullyStreamedResolve();\n }\n });\n\n return { done, stream };\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * This is a utility method that determines whether the current browser supports\n * the features required to create streamed responses. Currently, it checks if\n * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)\n * is available.\n *\n * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,\n * `'text/html'` will be used by default.\n * @return {boolean} `true`, if the current browser meets the requirements for\n * streaming responses, and `false` otherwise.\n *\n * @memberof workbox.streams\n */\n function createHeaders(headersInit = {}) {\n // See https://github.com/GoogleChrome/workbox/issues/1461\n const headers = new Headers(headersInit);\n if (!headers.has('content-type')) {\n headers.set('content-type', 'text/html');\n }\n return headers;\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Takes multiple source Promises, each of which could resolve to a Response, a\n * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit),\n * along with a\n * [HeadersInit](https://fetch.spec.whatwg.org/#typedefdef-headersinit).\n *\n * Returns an object exposing a Response whose body consists of each individual\n * stream's data returned in sequence, along with a Promise which signals when\n * the stream is finished (useful for passing to a FetchEvent's waitUntil()).\n *\n * @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises\n * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,\n * `'text/html'` will be used by default.\n * @return {Object<{done: Promise, response: Response}>}\n *\n * @memberof workbox.streams\n */\n function concatenateToResponse(sourcePromises, headersInit) {\n const { done, stream } = concatenate(sourcePromises);\n\n const headers = createHeaders(headersInit);\n const response = new Response(stream, { headers });\n\n return { done, response };\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n let cachedIsSupported = undefined;\n\n /**\n * This is a utility method that determines whether the current browser supports\n * the features required to create streamed responses. Currently, it checks if\n * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)\n * can be created.\n *\n * @return {boolean} `true`, if the current browser meets the requirements for\n * streaming responses, and `false` otherwise.\n *\n * @memberof workbox.streams\n */\n function isSupported() {\n if (cachedIsSupported === undefined) {\n // See https://github.com/GoogleChrome/workbox/issues/1473\n try {\n new ReadableStream({ start() {} });\n cachedIsSupported = true;\n } catch (error) {\n cachedIsSupported = false;\n }\n }\n\n return cachedIsSupported;\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * A shortcut to create a strategy that could be dropped-in to Workbox's router.\n *\n * On browsers that do not support constructing new `ReadableStream`s, this\n * strategy will automatically wait for all the `sourceFunctions` to complete,\n * and create a final response that concatenates their values together.\n *\n * @param {\n * Array<function(workbox.routing.Route~handlerCallback)>} sourceFunctions\n * Each function should return a {@link workbox.streams.StreamSource} (or a\n * Promise which resolves to one).\n * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,\n * `'text/html'` will be used by default.\n * @return {workbox.routing.Route~handlerCallback}\n *\n * @memberof workbox.streams\n */\n function strategy(sourceFunctions, headersInit) {\n return (() => {\n var _ref = babelHelpers.asyncToGenerator(function* ({ event, url, params }) {\n if (isSupported()) {\n const { done, response } = concatenateToResponse(sourceFunctions.map(function (sourceFunction) {\n return sourceFunction({ event, url, params });\n }), headersInit);\n event.waitUntil(done);\n return response;\n }\n\n {\n logger_mjs.logger.log(`The current browser doesn't support creating response ` + `streams. Falling back to non-streaming response instead.`);\n }\n\n // Fallback to waiting for everything to finish, and concatenating the\n // responses.\n const parts = yield Promise.all(sourceFunctions.map(function (sourceFunction) {\n return sourceFunction({ event, url, params });\n }).map((() => {\n var _ref2 = babelHelpers.asyncToGenerator(function* (responsePromise) {\n const response = yield responsePromise;\n if (response instanceof Response) {\n return response.blob();\n }\n\n // Otherwise, assume it's something like a string which can be used\n // as-is when constructing the final composite blob.\n return response;\n });\n\n return function (_x2) {\n return _ref2.apply(this, arguments);\n };\n })()));\n\n const headers = createHeaders(headersInit);\n // Constructing a new Response from a Blob source is well-supported.\n // So is constructing a new Blob from multiple source Blobs or strings.\n return new Response(new Blob(parts), { headers });\n });\n\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n })();\n }\n\n /*\n Copyright 2018 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n Copyright 2018 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.concatenate = concatenate;\n exports.concatenateToResponse = concatenateToResponse;\n exports.isSupported = isSupported;\n exports.strategy = strategy;\n\n return exports;\n\n}({},workbox.core._private,workbox.core._private));\n"],"file":"workbox-streams.dev.js"}
@@ -1,3 +1,3 @@
1
- this.workbox=this.workbox||{},this.workbox.streams=function(e){"use strict";try{self.workbox.v["workbox:streams:3.6.2"]=1}catch(e){}function n(e){const n=e.map(e=>Promise.resolve(e).then(e=>(e=e).body&&e.body.getReader?e.body.getReader():e.getReader?e.getReader():new Response(e).body.getReader()));var t;let r,s;let o=0;return{done:new Promise((e,n)=>{r=e,s=n}),stream:new ReadableStream({pull(e){return n[o].then(e=>e.read()).then(t=>{if(t.done)return++o>=n.length?(e.close(),void r()):this.pull(e);e.enqueue(t.value)}).catch(e=>{throw s(e),e})},cancel(){r()}})}}function t(e={}){const n=new Headers(e);return n.has("content-type")||n.set("content-type","text/html"),n}function r(e,r){const{done:s,stream:o}=n(e),u=t(r);return{done:s,response:new Response(o,{headers:u})}}let s=void 0;function o(){if(void 0===s)try{new ReadableStream({start(){}}),s=!0}catch(e){s=!1}return s}return e.concatenate=n,e.concatenateToResponse=r,e.isSupported=o,e.strategy=function(e,n){return s=babelHelpers.asyncToGenerator(function*({event:s,url:u,params:i}){if(o()){const{done:t,response:o}=r(e.map(function(e){return e({event:s,url:u,params:i})}),n);return s.waitUntil(t),o}const c=yield Promise.all(e.map(function(e){return e({event:s,url:u,params:i})}).map((a=babelHelpers.asyncToGenerator(function*(e){const n=yield e;return n instanceof Response?n.blob():n}),function(e){return a.apply(this,arguments)})));var a;const l=t(n);return new Response(new Blob(c),{headers:l})}),function(e){return s.apply(this,arguments)};var s},e}({});
1
+ this.workbox=this.workbox||{},this.workbox.streams=function(e){"use strict";try{self.workbox.v["workbox:streams:3.6.3"]=1}catch(e){}function n(e){const n=e.map(e=>Promise.resolve(e).then(e=>(e=e).body&&e.body.getReader?e.body.getReader():e.getReader?e.getReader():new Response(e).body.getReader()));var t;let r,s;let o=0;return{done:new Promise((e,n)=>{r=e,s=n}),stream:new ReadableStream({pull(e){return n[o].then(e=>e.read()).then(t=>{if(t.done)return++o>=n.length?(e.close(),void r()):this.pull(e);e.enqueue(t.value)}).catch(e=>{throw s(e),e})},cancel(){r()}})}}function t(e={}){const n=new Headers(e);return n.has("content-type")||n.set("content-type","text/html"),n}function r(e,r){const{done:s,stream:o}=n(e),u=t(r);return{done:s,response:new Response(o,{headers:u})}}let s=void 0;function o(){if(void 0===s)try{new ReadableStream({start(){}}),s=!0}catch(e){s=!1}return s}return e.concatenate=n,e.concatenateToResponse=r,e.isSupported=o,e.strategy=function(e,n){return s=babelHelpers.asyncToGenerator(function*({event:s,url:u,params:i}){if(o()){const{done:t,response:o}=r(e.map(function(e){return e({event:s,url:u,params:i})}),n);return s.waitUntil(t),o}const c=yield Promise.all(e.map(function(e){return e({event:s,url:u,params:i})}).map((a=babelHelpers.asyncToGenerator(function*(e){const n=yield e;return n instanceof Response?n.blob():n}),function(e){return a.apply(this,arguments)})));var a;const l=t(n);return new Response(new Blob(c),{headers:l})}),function(e){return s.apply(this,arguments)};var s},e}({});
2
2
 
3
3
  //# sourceMappingURL=workbox-streams.prod.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-streams/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.streams=function(e){\"use strict\";try{self.workbox.v[\"workbox:streams:3.6.2\"]=1}catch(e){}function n(e){const n=e.map(e=>Promise.resolve(e).then(e=>(e=e).body&&e.body.getReader?e.body.getReader():e.getReader?e.getReader():new Response(e).body.getReader()));var t;let r,s;let o=0;return{done:new Promise((e,n)=>{r=e,s=n}),stream:new ReadableStream({pull(e){return n[o].then(e=>e.read()).then(t=>{if(t.done)return++o>=n.length?(e.close(),void r()):this.pull(e);e.enqueue(t.value)}).catch(e=>{throw s(e),e})},cancel(){r()}})}}function t(e={}){const n=new Headers(e);return n.has(\"content-type\")||n.set(\"content-type\",\"text/html\"),n}function r(e,r){const{done:s,stream:o}=n(e),u=t(r);return{done:s,response:new Response(o,{headers:u})}}let s=void 0;function o(){if(void 0===s)try{new ReadableStream({start(){}}),s=!0}catch(e){s=!1}return s}return e.concatenate=n,e.concatenateToResponse=r,e.isSupported=o,e.strategy=function(e,n){return s=babelHelpers.asyncToGenerator(function*({event:s,url:u,params:i}){if(o()){const{done:t,response:o}=r(e.map(function(e){return e({event:s,url:u,params:i})}),n);return s.waitUntil(t),o}const c=yield Promise.all(e.map(function(e){return e({event:s,url:u,params:i})}).map((a=babelHelpers.asyncToGenerator(function*(e){const n=yield e;return n instanceof Response?n.blob():n}),function(e){return a.apply(this,arguments)})));var a;const l=t(n);return new Response(new Blob(c),{headers:l})}),function(e){return s.apply(this,arguments)};var s},e}({});\n"],"file":"workbox-streams.prod.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-streams/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.streams=function(e){\"use strict\";try{self.workbox.v[\"workbox:streams:3.6.3\"]=1}catch(e){}function n(e){const n=e.map(e=>Promise.resolve(e).then(e=>(e=e).body&&e.body.getReader?e.body.getReader():e.getReader?e.getReader():new Response(e).body.getReader()));var t;let r,s;let o=0;return{done:new Promise((e,n)=>{r=e,s=n}),stream:new ReadableStream({pull(e){return n[o].then(e=>e.read()).then(t=>{if(t.done)return++o>=n.length?(e.close(),void r()):this.pull(e);e.enqueue(t.value)}).catch(e=>{throw s(e),e})},cancel(){r()}})}}function t(e={}){const n=new Headers(e);return n.has(\"content-type\")||n.set(\"content-type\",\"text/html\"),n}function r(e,r){const{done:s,stream:o}=n(e),u=t(r);return{done:s,response:new Response(o,{headers:u})}}let s=void 0;function o(){if(void 0===s)try{new ReadableStream({start(){}}),s=!0}catch(e){s=!1}return s}return e.concatenate=n,e.concatenateToResponse=r,e.isSupported=o,e.strategy=function(e,n){return s=babelHelpers.asyncToGenerator(function*({event:s,url:u,params:i}){if(o()){const{done:t,response:o}=r(e.map(function(e){return e({event:s,url:u,params:i})}),n);return s.waitUntil(t),o}const c=yield Promise.all(e.map(function(e){return e({event:s,url:u,params:i})}).map((a=babelHelpers.asyncToGenerator(function*(e){const n=yield e;return n instanceof Response?n.blob():n}),function(e){return a.apply(this,arguments)})));var a;const l=t(n);return new Response(new Blob(c),{headers:l})}),function(e){return s.apply(this,arguments)};var s},e}({});\n"],"file":"workbox-streams.prod.js"}
@@ -1,3 +1,3 @@
1
- var workbox=function(){"use strict";try{self.workbox.v["workbox:sw:3.6.2"]=1}catch(t){}const t="https://storage.googleapis.com/workbox-cdn/releases/3.6.2",e={backgroundSync:"background-sync",broadcastUpdate:"broadcast-cache-update",cacheableResponse:"cacheable-response",core:"core",expiration:"cache-expiration",googleAnalytics:"google-analytics",navigationPreload:"navigation-preload",precaching:"precaching",rangeRequests:"range-requests",routing:"routing",strategies:"strategies",streams:"streams"};return new class{constructor(){return this.v={},this.t={debug:"localhost"===self.location.hostname,modulePathPrefix:null,modulePathCb:null},this.e=this.t.debug?"dev":"prod",this.s=!1,new Proxy(this,{get(t,s){if(t[s])return t[s];const o=e[s];return o&&t.loadModule(`workbox-${o}`),t[s]}})}setConfig(t={}){if(this.s)throw new Error("Config must be set before accessing workbox.* modules");Object.assign(this.t,t),this.e=this.t.debug?"dev":"prod"}skipWaiting(){self.addEventListener("install",()=>self.skipWaiting())}clientsClaim(){self.addEventListener("activate",()=>self.clients.claim())}loadModule(t){const e=this.o(t);try{importScripts(e),this.s=!0}catch(s){throw console.error(`Unable to import module '${t}' from '${e}'.`),s}}o(e){if(this.t.modulePathCb)return this.t.modulePathCb(e,this.t.debug);let s=[t];const o=`${e}.${this.e}.js`,r=this.t.modulePathPrefix;return r&&""===(s=r.split("/"))[s.length-1]&&s.splice(s.length-1,1),s.push(o),s.join("/")}}}();
1
+ var workbox=function(){"use strict";try{self.workbox.v["workbox:sw:3.6.3"]=1}catch(t){}const t="https://storage.googleapis.com/workbox-cdn/releases/3.6.3",e={backgroundSync:"background-sync",broadcastUpdate:"broadcast-cache-update",cacheableResponse:"cacheable-response",core:"core",expiration:"cache-expiration",googleAnalytics:"google-analytics",navigationPreload:"navigation-preload",precaching:"precaching",rangeRequests:"range-requests",routing:"routing",strategies:"strategies",streams:"streams"};return new class{constructor(){return this.v={},this.t={debug:"localhost"===self.location.hostname,modulePathPrefix:null,modulePathCb:null},this.e=this.t.debug?"dev":"prod",this.s=!1,new Proxy(this,{get(t,s){if(t[s])return t[s];const o=e[s];return o&&t.loadModule(`workbox-${o}`),t[s]}})}setConfig(t={}){if(this.s)throw new Error("Config must be set before accessing workbox.* modules");Object.assign(this.t,t),this.e=this.t.debug?"dev":"prod"}skipWaiting(){self.addEventListener("install",()=>self.skipWaiting())}clientsClaim(){self.addEventListener("activate",()=>self.clients.claim())}loadModule(t){const e=this.o(t);try{importScripts(e),this.s=!0}catch(s){throw console.error(`Unable to import module '${t}' from '${e}'.`),s}}o(e){if(this.t.modulePathCb)return this.t.modulePathCb(e,this.t.debug);let s=[t];const o=`${e}.${this.e}.js`,r=this.t.modulePathPrefix;return r&&""===(s=r.split("/"))[s.length-1]&&s.splice(s.length-1,1),s.push(o),s.join("/")}}}();
2
2
 
3
3
  //# sourceMappingURL=workbox-sw.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-sw/browser.mjs"],"sourcesContent":["var workbox=function(){\"use strict\";try{self.workbox.v[\"workbox:sw:3.6.2\"]=1}catch(t){}const t=\"https://storage.googleapis.com/workbox-cdn/releases/3.6.2\",e={backgroundSync:\"background-sync\",broadcastUpdate:\"broadcast-cache-update\",cacheableResponse:\"cacheable-response\",core:\"core\",expiration:\"cache-expiration\",googleAnalytics:\"google-analytics\",navigationPreload:\"navigation-preload\",precaching:\"precaching\",rangeRequests:\"range-requests\",routing:\"routing\",strategies:\"strategies\",streams:\"streams\"};return new class{constructor(){return this.v={},this.t={debug:\"localhost\"===self.location.hostname,modulePathPrefix:null,modulePathCb:null},this.e=this.t.debug?\"dev\":\"prod\",this.s=!1,new Proxy(this,{get(t,s){if(t[s])return t[s];const o=e[s];return o&&t.loadModule(`workbox-${o}`),t[s]}})}setConfig(t={}){if(this.s)throw new Error(\"Config must be set before accessing workbox.* modules\");Object.assign(this.t,t),this.e=this.t.debug?\"dev\":\"prod\"}skipWaiting(){self.addEventListener(\"install\",()=>self.skipWaiting())}clientsClaim(){self.addEventListener(\"activate\",()=>self.clients.claim())}loadModule(t){const e=this.o(t);try{importScripts(e),this.s=!0}catch(s){throw console.error(`Unable to import module '${t}' from '${e}'.`),s}}o(e){if(this.t.modulePathCb)return this.t.modulePathCb(e,this.t.debug);let s=[t];const o=`${e}.${this.e}.js`,r=this.t.modulePathPrefix;return r&&\"\"===(s=r.split(\"/\"))[s.length-1]&&s.splice(s.length-1,1),s.push(o),s.join(\"/\")}}}();\n"],"file":"workbox-sw.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-sw/browser.mjs"],"sourcesContent":["var workbox=function(){\"use strict\";try{self.workbox.v[\"workbox:sw:3.6.3\"]=1}catch(t){}const t=\"https://storage.googleapis.com/workbox-cdn/releases/3.6.3\",e={backgroundSync:\"background-sync\",broadcastUpdate:\"broadcast-cache-update\",cacheableResponse:\"cacheable-response\",core:\"core\",expiration:\"cache-expiration\",googleAnalytics:\"google-analytics\",navigationPreload:\"navigation-preload\",precaching:\"precaching\",rangeRequests:\"range-requests\",routing:\"routing\",strategies:\"strategies\",streams:\"streams\"};return new class{constructor(){return this.v={},this.t={debug:\"localhost\"===self.location.hostname,modulePathPrefix:null,modulePathCb:null},this.e=this.t.debug?\"dev\":\"prod\",this.s=!1,new Proxy(this,{get(t,s){if(t[s])return t[s];const o=e[s];return o&&t.loadModule(`workbox-${o}`),t[s]}})}setConfig(t={}){if(this.s)throw new Error(\"Config must be set before accessing workbox.* modules\");Object.assign(this.t,t),this.e=this.t.debug?\"dev\":\"prod\"}skipWaiting(){self.addEventListener(\"install\",()=>self.skipWaiting())}clientsClaim(){self.addEventListener(\"activate\",()=>self.clients.claim())}loadModule(t){const e=this.o(t);try{importScripts(e),this.s=!0}catch(s){throw console.error(`Unable to import module '${t}' from '${e}'.`),s}}o(e){if(this.t.modulePathCb)return this.t.modulePathCb(e,this.t.debug);let s=[t];const o=`${e}.${this.e}.js`,r=this.t.modulePathPrefix;return r&&\"\"===(s=r.split(\"/\"))[s.length-1]&&s.splice(s.length-1,1),s.push(o),s.join(\"/\")}}}();\n"],"file":"workbox-sw.js"}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-pwa-plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pan Yuqi
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-10-18 00:00:00.000000000 Z
12
+ date: 2019-01-21 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: This plugin provides PWA support for Jekyll. Generate a service worker
15
15
  and provides precache with Google Workbox.
@@ -19,56 +19,56 @@ extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
21
  - lib/jekyll-pwa-plugin.rb
22
- - lib/vendor/workbox-v3.6.2/workbox-background-sync.dev.js
23
- - lib/vendor/workbox-v3.6.2/workbox-background-sync.dev.js.map
24
- - lib/vendor/workbox-v3.6.2/workbox-background-sync.prod.js
25
- - lib/vendor/workbox-v3.6.2/workbox-background-sync.prod.js.map
26
- - lib/vendor/workbox-v3.6.2/workbox-broadcast-cache-update.dev.js
27
- - lib/vendor/workbox-v3.6.2/workbox-broadcast-cache-update.dev.js.map
28
- - lib/vendor/workbox-v3.6.2/workbox-broadcast-cache-update.prod.js
29
- - lib/vendor/workbox-v3.6.2/workbox-broadcast-cache-update.prod.js.map
30
- - lib/vendor/workbox-v3.6.2/workbox-cache-expiration.dev.js
31
- - lib/vendor/workbox-v3.6.2/workbox-cache-expiration.dev.js.map
32
- - lib/vendor/workbox-v3.6.2/workbox-cache-expiration.prod.js
33
- - lib/vendor/workbox-v3.6.2/workbox-cache-expiration.prod.js.map
34
- - lib/vendor/workbox-v3.6.2/workbox-cacheable-response.dev.js
35
- - lib/vendor/workbox-v3.6.2/workbox-cacheable-response.dev.js.map
36
- - lib/vendor/workbox-v3.6.2/workbox-cacheable-response.prod.js
37
- - lib/vendor/workbox-v3.6.2/workbox-cacheable-response.prod.js.map
38
- - lib/vendor/workbox-v3.6.2/workbox-core.dev.js
39
- - lib/vendor/workbox-v3.6.2/workbox-core.dev.js.map
40
- - lib/vendor/workbox-v3.6.2/workbox-core.prod.js
41
- - lib/vendor/workbox-v3.6.2/workbox-core.prod.js.map
42
- - lib/vendor/workbox-v3.6.2/workbox-google-analytics.dev.js
43
- - lib/vendor/workbox-v3.6.2/workbox-google-analytics.dev.js.map
44
- - lib/vendor/workbox-v3.6.2/workbox-google-analytics.prod.js
45
- - lib/vendor/workbox-v3.6.2/workbox-google-analytics.prod.js.map
46
- - lib/vendor/workbox-v3.6.2/workbox-navigation-preload.dev.js
47
- - lib/vendor/workbox-v3.6.2/workbox-navigation-preload.dev.js.map
48
- - lib/vendor/workbox-v3.6.2/workbox-navigation-preload.prod.js
49
- - lib/vendor/workbox-v3.6.2/workbox-navigation-preload.prod.js.map
50
- - lib/vendor/workbox-v3.6.2/workbox-precaching.dev.js
51
- - lib/vendor/workbox-v3.6.2/workbox-precaching.dev.js.map
52
- - lib/vendor/workbox-v3.6.2/workbox-precaching.prod.js
53
- - lib/vendor/workbox-v3.6.2/workbox-precaching.prod.js.map
54
- - lib/vendor/workbox-v3.6.2/workbox-range-requests.dev.js
55
- - lib/vendor/workbox-v3.6.2/workbox-range-requests.dev.js.map
56
- - lib/vendor/workbox-v3.6.2/workbox-range-requests.prod.js
57
- - lib/vendor/workbox-v3.6.2/workbox-range-requests.prod.js.map
58
- - lib/vendor/workbox-v3.6.2/workbox-routing.dev.js
59
- - lib/vendor/workbox-v3.6.2/workbox-routing.dev.js.map
60
- - lib/vendor/workbox-v3.6.2/workbox-routing.prod.js
61
- - lib/vendor/workbox-v3.6.2/workbox-routing.prod.js.map
62
- - lib/vendor/workbox-v3.6.2/workbox-strategies.dev.js
63
- - lib/vendor/workbox-v3.6.2/workbox-strategies.dev.js.map
64
- - lib/vendor/workbox-v3.6.2/workbox-strategies.prod.js
65
- - lib/vendor/workbox-v3.6.2/workbox-strategies.prod.js.map
66
- - lib/vendor/workbox-v3.6.2/workbox-streams.dev.js
67
- - lib/vendor/workbox-v3.6.2/workbox-streams.dev.js.map
68
- - lib/vendor/workbox-v3.6.2/workbox-streams.prod.js
69
- - lib/vendor/workbox-v3.6.2/workbox-streams.prod.js.map
70
- - lib/vendor/workbox-v3.6.2/workbox-sw.js
71
- - lib/vendor/workbox-v3.6.2/workbox-sw.js.map
22
+ - lib/vendor/workbox-v3.6.3/workbox-background-sync.dev.js
23
+ - lib/vendor/workbox-v3.6.3/workbox-background-sync.dev.js.map
24
+ - lib/vendor/workbox-v3.6.3/workbox-background-sync.prod.js
25
+ - lib/vendor/workbox-v3.6.3/workbox-background-sync.prod.js.map
26
+ - lib/vendor/workbox-v3.6.3/workbox-broadcast-cache-update.dev.js
27
+ - lib/vendor/workbox-v3.6.3/workbox-broadcast-cache-update.dev.js.map
28
+ - lib/vendor/workbox-v3.6.3/workbox-broadcast-cache-update.prod.js
29
+ - lib/vendor/workbox-v3.6.3/workbox-broadcast-cache-update.prod.js.map
30
+ - lib/vendor/workbox-v3.6.3/workbox-cache-expiration.dev.js
31
+ - lib/vendor/workbox-v3.6.3/workbox-cache-expiration.dev.js.map
32
+ - lib/vendor/workbox-v3.6.3/workbox-cache-expiration.prod.js
33
+ - lib/vendor/workbox-v3.6.3/workbox-cache-expiration.prod.js.map
34
+ - lib/vendor/workbox-v3.6.3/workbox-cacheable-response.dev.js
35
+ - lib/vendor/workbox-v3.6.3/workbox-cacheable-response.dev.js.map
36
+ - lib/vendor/workbox-v3.6.3/workbox-cacheable-response.prod.js
37
+ - lib/vendor/workbox-v3.6.3/workbox-cacheable-response.prod.js.map
38
+ - lib/vendor/workbox-v3.6.3/workbox-core.dev.js
39
+ - lib/vendor/workbox-v3.6.3/workbox-core.dev.js.map
40
+ - lib/vendor/workbox-v3.6.3/workbox-core.prod.js
41
+ - lib/vendor/workbox-v3.6.3/workbox-core.prod.js.map
42
+ - lib/vendor/workbox-v3.6.3/workbox-google-analytics.dev.js
43
+ - lib/vendor/workbox-v3.6.3/workbox-google-analytics.dev.js.map
44
+ - lib/vendor/workbox-v3.6.3/workbox-google-analytics.prod.js
45
+ - lib/vendor/workbox-v3.6.3/workbox-google-analytics.prod.js.map
46
+ - lib/vendor/workbox-v3.6.3/workbox-navigation-preload.dev.js
47
+ - lib/vendor/workbox-v3.6.3/workbox-navigation-preload.dev.js.map
48
+ - lib/vendor/workbox-v3.6.3/workbox-navigation-preload.prod.js
49
+ - lib/vendor/workbox-v3.6.3/workbox-navigation-preload.prod.js.map
50
+ - lib/vendor/workbox-v3.6.3/workbox-precaching.dev.js
51
+ - lib/vendor/workbox-v3.6.3/workbox-precaching.dev.js.map
52
+ - lib/vendor/workbox-v3.6.3/workbox-precaching.prod.js
53
+ - lib/vendor/workbox-v3.6.3/workbox-precaching.prod.js.map
54
+ - lib/vendor/workbox-v3.6.3/workbox-range-requests.dev.js
55
+ - lib/vendor/workbox-v3.6.3/workbox-range-requests.dev.js.map
56
+ - lib/vendor/workbox-v3.6.3/workbox-range-requests.prod.js
57
+ - lib/vendor/workbox-v3.6.3/workbox-range-requests.prod.js.map
58
+ - lib/vendor/workbox-v3.6.3/workbox-routing.dev.js
59
+ - lib/vendor/workbox-v3.6.3/workbox-routing.dev.js.map
60
+ - lib/vendor/workbox-v3.6.3/workbox-routing.prod.js
61
+ - lib/vendor/workbox-v3.6.3/workbox-routing.prod.js.map
62
+ - lib/vendor/workbox-v3.6.3/workbox-strategies.dev.js
63
+ - lib/vendor/workbox-v3.6.3/workbox-strategies.dev.js.map
64
+ - lib/vendor/workbox-v3.6.3/workbox-strategies.prod.js
65
+ - lib/vendor/workbox-v3.6.3/workbox-strategies.prod.js.map
66
+ - lib/vendor/workbox-v3.6.3/workbox-streams.dev.js
67
+ - lib/vendor/workbox-v3.6.3/workbox-streams.dev.js.map
68
+ - lib/vendor/workbox-v3.6.3/workbox-streams.prod.js
69
+ - lib/vendor/workbox-v3.6.3/workbox-streams.prod.js.map
70
+ - lib/vendor/workbox-v3.6.3/workbox-sw.js
71
+ - lib/vendor/workbox-v3.6.3/workbox-sw.js.map
72
72
  homepage: https://github.com/lavas-project/jekyll-pwa
73
73
  licenses:
74
74
  - MIT
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  version: '0'
90
90
  requirements: []
91
91
  rubyforge_project:
92
- rubygems_version: 2.5.2
92
+ rubygems_version: 2.5.2.3
93
93
  signing_key:
94
94
  specification_version: 4
95
95
  summary: PWA support for Jekyll.