jekyll-pwa-workbox 0.0.6 → 0.0.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jekyll-pwa-workbox.rb +2 -2
  3. data/lib/vendor/workbox-v5.1.3/workbox-background-sync.dev.js +818 -0
  4. data/lib/vendor/workbox-v5.1.3/workbox-background-sync.dev.js.map +1 -0
  5. data/lib/vendor/workbox-v5.1.3/workbox-background-sync.prod.js +2 -0
  6. data/lib/vendor/workbox-v5.1.3/workbox-background-sync.prod.js.map +1 -0
  7. data/lib/vendor/workbox-v5.1.3/workbox-broadcast-update.dev.js +288 -0
  8. data/lib/vendor/workbox-v5.1.3/workbox-broadcast-update.dev.js.map +1 -0
  9. data/lib/vendor/workbox-v5.1.3/workbox-broadcast-update.prod.js +2 -0
  10. data/lib/vendor/workbox-v5.1.3/workbox-broadcast-update.prod.js.map +1 -0
  11. data/lib/vendor/workbox-v5.1.3/workbox-cacheable-response.dev.js +191 -0
  12. data/lib/vendor/workbox-v5.1.3/workbox-cacheable-response.dev.js.map +1 -0
  13. data/lib/vendor/workbox-v5.1.3/workbox-cacheable-response.prod.js +2 -0
  14. data/lib/vendor/workbox-v5.1.3/workbox-cacheable-response.prod.js.map +1 -0
  15. data/lib/vendor/workbox-v5.1.3/workbox-core.dev.js +1858 -0
  16. data/lib/vendor/workbox-v5.1.3/workbox-core.dev.js.map +1 -0
  17. data/lib/vendor/workbox-v5.1.3/workbox-core.prod.js +2 -0
  18. data/lib/vendor/workbox-v5.1.3/workbox-core.prod.js.map +1 -0
  19. data/lib/vendor/workbox-v5.1.3/workbox-expiration.dev.js +649 -0
  20. data/lib/vendor/workbox-v5.1.3/workbox-expiration.dev.js.map +1 -0
  21. data/lib/vendor/workbox-v5.1.3/workbox-expiration.prod.js +2 -0
  22. data/lib/vendor/workbox-v5.1.3/workbox-expiration.prod.js.map +1 -0
  23. data/lib/vendor/workbox-v5.1.3/workbox-navigation-preload.dev.js +102 -0
  24. data/lib/vendor/workbox-v5.1.3/workbox-navigation-preload.dev.js.map +1 -0
  25. data/lib/vendor/{workbox-v4.3.1 → workbox-v5.1.3}/workbox-navigation-preload.prod.js +1 -1
  26. data/lib/vendor/workbox-v5.1.3/workbox-navigation-preload.prod.js.map +1 -0
  27. data/lib/vendor/workbox-v5.1.3/workbox-offline-ga.dev.js +235 -0
  28. data/lib/vendor/workbox-v5.1.3/workbox-offline-ga.dev.js.map +1 -0
  29. data/lib/vendor/workbox-v5.1.3/workbox-offline-ga.prod.js +2 -0
  30. data/lib/vendor/workbox-v5.1.3/workbox-offline-ga.prod.js.map +1 -0
  31. data/lib/vendor/workbox-v5.1.3/workbox-precaching.dev.js +1210 -0
  32. data/lib/vendor/workbox-v5.1.3/workbox-precaching.dev.js.map +1 -0
  33. data/lib/vendor/workbox-v5.1.3/workbox-precaching.prod.js +2 -0
  34. data/lib/vendor/workbox-v5.1.3/workbox-precaching.prod.js.map +1 -0
  35. data/lib/vendor/workbox-v5.1.3/workbox-range-requests.dev.js +262 -0
  36. data/lib/vendor/workbox-v5.1.3/workbox-range-requests.dev.js.map +1 -0
  37. data/lib/vendor/workbox-v5.1.3/workbox-range-requests.prod.js +2 -0
  38. data/lib/vendor/workbox-v5.1.3/workbox-range-requests.prod.js.map +1 -0
  39. data/lib/vendor/workbox-v5.1.3/workbox-routing.dev.js +923 -0
  40. data/lib/vendor/workbox-v5.1.3/workbox-routing.dev.js.map +1 -0
  41. data/lib/vendor/workbox-v5.1.3/workbox-routing.prod.js +2 -0
  42. data/lib/vendor/workbox-v5.1.3/workbox-routing.prod.js.map +1 -0
  43. data/lib/vendor/workbox-v5.1.3/workbox-strategies.dev.js +923 -0
  44. data/lib/vendor/workbox-v5.1.3/workbox-strategies.dev.js.map +1 -0
  45. data/lib/vendor/workbox-v5.1.3/workbox-strategies.prod.js +2 -0
  46. data/lib/vendor/workbox-v5.1.3/workbox-strategies.prod.js.map +1 -0
  47. data/lib/vendor/workbox-v5.1.3/workbox-streams.dev.js +318 -0
  48. data/lib/vendor/workbox-v5.1.3/workbox-streams.dev.js.map +1 -0
  49. data/lib/vendor/workbox-v5.1.3/workbox-streams.prod.js +2 -0
  50. data/lib/vendor/workbox-v5.1.3/workbox-streams.prod.js.map +1 -0
  51. data/lib/vendor/workbox-v5.1.3/workbox-sw.js +2 -0
  52. data/lib/vendor/workbox-v5.1.3/workbox-sw.js.map +1 -0
  53. data/lib/vendor/workbox-v5.1.3/workbox-window.dev.es5.mjs +1094 -0
  54. data/lib/vendor/workbox-v5.1.3/workbox-window.dev.es5.mjs.map +1 -0
  55. data/lib/vendor/workbox-v5.1.3/workbox-window.dev.mjs +943 -0
  56. data/lib/vendor/workbox-v5.1.3/workbox-window.dev.mjs.map +1 -0
  57. data/lib/vendor/workbox-v5.1.3/workbox-window.dev.umd.js +1105 -0
  58. data/lib/vendor/workbox-v5.1.3/workbox-window.dev.umd.js.map +1 -0
  59. data/lib/vendor/workbox-v5.1.3/workbox-window.prod.es5.mjs +2 -0
  60. data/lib/vendor/workbox-v5.1.3/workbox-window.prod.es5.mjs.map +1 -0
  61. data/lib/vendor/workbox-v5.1.3/workbox-window.prod.mjs +2 -0
  62. data/lib/vendor/workbox-v5.1.3/workbox-window.prod.mjs.map +1 -0
  63. data/lib/vendor/workbox-v5.1.3/workbox-window.prod.umd.js +2 -0
  64. data/lib/vendor/workbox-v5.1.3/workbox-window.prod.umd.js.map +1 -0
  65. metadata +73 -78
  66. data/lib/vendor/workbox-v4.3.1/workbox-background-sync.dev.js +0 -822
  67. data/lib/vendor/workbox-v4.3.1/workbox-background-sync.dev.js.map +0 -1
  68. data/lib/vendor/workbox-v4.3.1/workbox-background-sync.prod.js +0 -2
  69. data/lib/vendor/workbox-v4.3.1/workbox-background-sync.prod.js.map +0 -1
  70. data/lib/vendor/workbox-v4.3.1/workbox-broadcast-update.dev.js +0 -496
  71. data/lib/vendor/workbox-v4.3.1/workbox-broadcast-update.dev.js.map +0 -1
  72. data/lib/vendor/workbox-v4.3.1/workbox-broadcast-update.prod.js +0 -2
  73. data/lib/vendor/workbox-v4.3.1/workbox-broadcast-update.prod.js.map +0 -1
  74. data/lib/vendor/workbox-v4.3.1/workbox-cacheable-response.dev.js +0 -200
  75. data/lib/vendor/workbox-v4.3.1/workbox-cacheable-response.dev.js.map +0 -1
  76. data/lib/vendor/workbox-v4.3.1/workbox-cacheable-response.prod.js +0 -2
  77. data/lib/vendor/workbox-v4.3.1/workbox-cacheable-response.prod.js.map +0 -1
  78. data/lib/vendor/workbox-v4.3.1/workbox-core.dev.js +0 -1712
  79. data/lib/vendor/workbox-v4.3.1/workbox-core.dev.js.map +0 -1
  80. data/lib/vendor/workbox-v4.3.1/workbox-core.prod.js +0 -2
  81. data/lib/vendor/workbox-v4.3.1/workbox-core.prod.js.map +0 -1
  82. data/lib/vendor/workbox-v4.3.1/workbox-expiration.dev.js +0 -652
  83. data/lib/vendor/workbox-v4.3.1/workbox-expiration.dev.js.map +0 -1
  84. data/lib/vendor/workbox-v4.3.1/workbox-expiration.prod.js +0 -2
  85. data/lib/vendor/workbox-v4.3.1/workbox-expiration.prod.js.map +0 -1
  86. data/lib/vendor/workbox-v4.3.1/workbox-navigation-preload.dev.js +0 -110
  87. data/lib/vendor/workbox-v4.3.1/workbox-navigation-preload.dev.js.map +0 -1
  88. data/lib/vendor/workbox-v4.3.1/workbox-navigation-preload.prod.js.map +0 -1
  89. data/lib/vendor/workbox-v4.3.1/workbox-offline-ga.dev.js +0 -243
  90. data/lib/vendor/workbox-v4.3.1/workbox-offline-ga.dev.js.map +0 -1
  91. data/lib/vendor/workbox-v4.3.1/workbox-offline-ga.prod.js +0 -2
  92. data/lib/vendor/workbox-v4.3.1/workbox-offline-ga.prod.js.map +0 -1
  93. data/lib/vendor/workbox-v4.3.1/workbox-precaching.dev.js +0 -989
  94. data/lib/vendor/workbox-v4.3.1/workbox-precaching.dev.js.map +0 -1
  95. data/lib/vendor/workbox-v4.3.1/workbox-precaching.prod.js +0 -2
  96. data/lib/vendor/workbox-v4.3.1/workbox-precaching.prod.js.map +0 -1
  97. data/lib/vendor/workbox-v4.3.1/workbox-range-requests.dev.js +0 -268
  98. data/lib/vendor/workbox-v4.3.1/workbox-range-requests.dev.js.map +0 -1
  99. data/lib/vendor/workbox-v4.3.1/workbox-range-requests.prod.js +0 -2
  100. data/lib/vendor/workbox-v4.3.1/workbox-range-requests.prod.js.map +0 -1
  101. data/lib/vendor/workbox-v4.3.1/workbox-routing.dev.js +0 -1020
  102. data/lib/vendor/workbox-v4.3.1/workbox-routing.dev.js.map +0 -1
  103. data/lib/vendor/workbox-v4.3.1/workbox-routing.prod.js +0 -2
  104. data/lib/vendor/workbox-v4.3.1/workbox-routing.prod.js.map +0 -1
  105. data/lib/vendor/workbox-v4.3.1/workbox-strategies.dev.js +0 -1138
  106. data/lib/vendor/workbox-v4.3.1/workbox-strategies.dev.js.map +0 -1
  107. data/lib/vendor/workbox-v4.3.1/workbox-strategies.prod.js +0 -2
  108. data/lib/vendor/workbox-v4.3.1/workbox-strategies.prod.js.map +0 -1
  109. data/lib/vendor/workbox-v4.3.1/workbox-streams.dev.js +0 -337
  110. data/lib/vendor/workbox-v4.3.1/workbox-streams.dev.js.map +0 -1
  111. data/lib/vendor/workbox-v4.3.1/workbox-streams.prod.js +0 -2
  112. data/lib/vendor/workbox-v4.3.1/workbox-streams.prod.js.map +0 -1
  113. data/lib/vendor/workbox-v4.3.1/workbox-sw.js +0 -2
  114. data/lib/vendor/workbox-v4.3.1/workbox-sw.js.map +0 -1
  115. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.es5.mjs +0 -885
  116. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.es5.mjs.map +0 -1
  117. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.mjs +0 -751
  118. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.mjs.map +0 -1
  119. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.umd.js +0 -896
  120. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.umd.js.map +0 -1
  121. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.es5.mjs +0 -2
  122. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.es5.mjs.map +0 -1
  123. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.mjs +0 -2
  124. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.mjs.map +0 -1
  125. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.umd.js +0 -2
  126. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.umd.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workbox-window.dev.umd.js","sources":["../_version.js","../messageSW.js","../../workbox-core/_version.js","../../workbox-core/_private/Deferred.js","../../workbox-core/_private/dontWaitFor.js","../../workbox-core/_private/logger.js","../utils/WorkboxEventTarget.js","../utils/urlsMatch.js","../utils/WorkboxEvent.js","../Workbox.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:window:5.1.3'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport './_version.js';\n/**\n * Sends a data object to a service worker via `postMessage` and resolves with\n * a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will not\n * resolve.\n *\n * @param {ServiceWorker} sw The service worker to send the message to.\n * @param {Object} data An object to send to the service worker.\n * @return {Promise<Object|undefined>}\n * @memberof module:workbox-window\n */\nfunction messageSW(sw, data) {\n return new Promise((resolve) => {\n const messageChannel = new MessageChannel();\n messageChannel.port1.onmessage = (event) => {\n resolve(event.data);\n };\n sw.postMessage(data, [messageChannel.port2]);\n });\n}\nexport { messageSW };\n","\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:core:5.1.3'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * The Deferred class composes Promises in a way that allows for them to be\n * resolved or rejected from outside the constructor. In most cases promises\n * should be used directly, but Deferreds can be necessary when the logic to\n * resolve a promise must be separate.\n *\n * @private\n */\nclass Deferred {\n /**\n * Creates a promise and exposes its resolve and reject functions as methods.\n */\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n }\n}\nexport { Deferred };\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A helper function that prevents a promise from being flagged as unused.\n *\n * @private\n **/\nexport function dontWaitFor(promise) {\n // Effective no-op.\n promise.then(() => { });\n}\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nconst logger = (process.env.NODE_ENV === 'production' ? null : (() => {\n // Don't overwrite this value if it's already set.\n // See https://github.com/GoogleChrome/workbox/pull/2284#issuecomment-560470923\n if (!('__WB_DISABLE_DEV_LOGS' in self)) {\n self.__WB_DISABLE_DEV_LOGS = false;\n }\n let inGroup = false;\n const methodToColorMap = {\n debug: `#7f8c8d`,\n log: `#2ecc71`,\n warn: `#f39c12`,\n error: `#c0392b`,\n groupCollapsed: `#3498db`,\n groupEnd: null,\n };\n const print = function (method, args) {\n if (self.__WB_DISABLE_DEV_LOGS) {\n return;\n }\n if (method === 'groupCollapsed') {\n // Safari doesn't print all console.groupCollapsed() arguments:\n // https://bugs.webkit.org/show_bug.cgi?id=182754\n if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {\n console[method](...args);\n return;\n }\n }\n const styles = [\n `background: ${methodToColorMap[method]}`,\n `border-radius: 0.5em`,\n `color: white`,\n `font-weight: bold`,\n `padding: 2px 0.5em`,\n ];\n // When in a group, the workbox prefix is not displayed.\n const logPrefix = inGroup ? [] : ['%cworkbox', styles.join(';')];\n console[method](...logPrefix, ...args);\n if (method === 'groupCollapsed') {\n inGroup = true;\n }\n if (method === 'groupEnd') {\n inGroup = false;\n }\n };\n const api = {};\n const loggerMethods = Object.keys(methodToColorMap);\n for (const key of loggerMethods) {\n const method = key;\n api[method] = (...args) => {\n print(method, args);\n };\n }\n return api;\n})());\nexport { logger };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n/**\n * A minimal `EventTarget` shim.\n * This is necessary because not all browsers support constructable\n * `EventTarget`, so using a real `EventTarget` will error.\n * @private\n */\nexport class WorkboxEventTarget {\n constructor() {\n this._eventListenerRegistry = new Map();\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n addEventListener(type, listener) {\n const foo = this._getEventListenersByType(type);\n foo.add(listener);\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n removeEventListener(type, listener) {\n this._getEventListenersByType(type).delete(listener);\n }\n /**\n * @param {Object} event\n * @private\n */\n dispatchEvent(event) {\n event.target = this;\n const listeners = this._getEventListenersByType(event.type);\n for (const listener of listeners) {\n listener(event);\n }\n }\n /**\n * Returns a Set of listeners associated with the passed event type.\n * If no handlers have been registered, an empty Set is returned.\n *\n * @param {string} type The event type.\n * @return {Set<ListenerCallback>} An array of handler functions.\n * @private\n */\n _getEventListenersByType(type) {\n if (!this._eventListenerRegistry.has(type)) {\n this._eventListenerRegistry.set(type, new Set());\n }\n return this._eventListenerRegistry.get(type);\n }\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * Returns true if two URLs have the same `.href` property. The URLS can be\n * relative, and if they are the current location href is used to resolve URLs.\n *\n * @private\n * @param {string} url1\n * @param {string} url2\n * @return {boolean}\n */\nexport function urlsMatch(url1, url2) {\n const { href } = location;\n return new URL(url1, href).href === new URL(url2, href).href;\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A minimal `Event` subclass shim.\n * This doesn't *actually* subclass `Event` because not all browsers support\n * constructable `EventTarget`, and using a real `Event` will error.\n * @private\n */\nexport class WorkboxEvent {\n constructor(type, props) {\n this.type = type;\n Object.assign(this, props);\n }\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { Deferred } from 'workbox-core/_private/Deferred.js';\nimport { dontWaitFor } from 'workbox-core/_private/dontWaitFor.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { messageSW } from './messageSW.js';\nimport { WorkboxEventTarget } from './utils/WorkboxEventTarget.js';\nimport { urlsMatch } from './utils/urlsMatch.js';\nimport { WorkboxEvent } from './utils/WorkboxEvent.js';\nimport './_version.js';\n// The time a SW must be in the waiting phase before we can conclude\n// `skipWaiting()` wasn't called. This 200 amount wasn't scientifically\n// chosen, but it seems to avoid false positives in my testing.\nconst WAITING_TIMEOUT_DURATION = 200;\n// The amount of time after a registration that we can reasonably conclude\n// that the registration didn't trigger an update.\nconst REGISTRATION_TIMEOUT_DURATION = 60000;\n/**\n * A class to aid in handling service worker registration, updates, and\n * reacting to service worker lifecycle events.\n *\n * @fires [message]{@link module:workbox-window.Workbox#message}\n * @fires [installed]{@link module:workbox-window.Workbox#installed}\n * @fires [waiting]{@link module:workbox-window.Workbox#waiting}\n * @fires [controlling]{@link module:workbox-window.Workbox#controlling}\n * @fires [activated]{@link module:workbox-window.Workbox#activated}\n * @fires [redundant]{@link module:workbox-window.Workbox#redundant}\n * @fires [externalinstalled]{@link module:workbox-window.Workbox#externalinstalled}\n * @fires [externalwaiting]{@link module:workbox-window.Workbox#externalwaiting}\n * @fires [externalactivated]{@link module:workbox-window.Workbox#externalactivated}\n * @memberof module:workbox-window\n */\nclass Workbox extends WorkboxEventTarget {\n /**\n * Creates a new Workbox instance with a script URL and service worker\n * options. The script URL and options are the same as those used when\n * calling `navigator.serviceWorker.register(scriptURL, options)`. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register\n *\n * @param {string} scriptURL The service worker script associated with this\n * instance.\n * @param {Object} [registerOptions] The service worker options associated\n * with this instance.\n */\n constructor(scriptURL, registerOptions = {}) {\n super();\n this._registerOptions = {};\n this._updateFoundCount = 0;\n // Deferreds we can resolve later.\n this._swDeferred = new Deferred();\n this._activeDeferred = new Deferred();\n this._controllingDeferred = new Deferred();\n this._registrationTime = 0;\n this._ownSWs = new Set();\n /**\n * @private\n */\n this._onUpdateFound = () => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const installingSW = registration.installing;\n // If the script URL passed to `navigator.serviceWorker.register()` is\n // different from the current controlling SW's script URL, we know any\n // successful registration calls will trigger an `updatefound` event.\n // But if the registered script URL is the same as the current controlling\n // SW's script URL, we'll only get an `updatefound` event if the file\n // changed since it was last registered. This can be a problem if the user\n // opens up the same page in a different tab, and that page registers\n // a SW that triggers an update. It's a problem because this page has no\n // good way of knowing whether the `updatefound` event came from the SW\n // script it registered or from a registration attempt made by a newer\n // version of the page running in another tab.\n // To minimize the possibility of a false positive, we use the logic here:\n const updateLikelyTriggeredExternally = \n // Since we enforce only calling `register()` once, and since we don't\n // add the `updatefound` event listener until the `register()` call, if\n // `_updateFoundCount` is > 0 then it means this method has already\n // been called, thus this SW must be external\n this._updateFoundCount > 0 ||\n // If the script URL of the installing SW is different from this\n // instance's script URL, we know it's definitely not from our\n // registration.\n !urlsMatch(installingSW.scriptURL, this._scriptURL) ||\n // If all of the above are false, then we use a time-based heuristic:\n // Any `updatefound` event that occurs long after our registration is\n // assumed to be external.\n (performance.now() >\n this._registrationTime + REGISTRATION_TIMEOUT_DURATION) ?\n // If any of the above are not true, we assume the update was\n // triggered by this instance.\n true : false;\n if (updateLikelyTriggeredExternally) {\n this._externalSW = installingSW;\n registration.removeEventListener('updatefound', this._onUpdateFound);\n }\n else {\n // If the update was not triggered externally we know the installing\n // SW is the one we registered, so we set it.\n this._sw = installingSW;\n this._ownSWs.add(installingSW);\n this._swDeferred.resolve(installingSW);\n // The `installing` state isn't something we have a dedicated\n // callback for, but we do log messages for it in development.\n if (process.env.NODE_ENV !== 'production') {\n if (navigator.serviceWorker.controller) {\n logger.log('Updated service worker found. Installing now...');\n }\n else {\n logger.log('Service worker is installing...');\n }\n }\n }\n // Increment the `updatefound` count, so future invocations of this\n // method can be sure they were triggered externally.\n ++this._updateFoundCount;\n // Add a `statechange` listener regardless of whether this update was\n // triggered externally, since we have callbacks for both.\n installingSW.addEventListener('statechange', this._onStateChange);\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onStateChange = (originalEvent) => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const sw = originalEvent.target;\n const { state } = sw;\n const isExternal = sw === this._externalSW;\n const eventPrefix = isExternal ? 'external' : '';\n const eventProps = {\n sw,\n originalEvent\n };\n if (!isExternal && this._isUpdate) {\n eventProps.isUpdate = true;\n }\n this.dispatchEvent(new WorkboxEvent(eventPrefix + state, eventProps));\n if (state === 'installed') {\n // This timeout is used to ignore cases where the service worker calls\n // `skipWaiting()` in the install event, thus moving it directly in the\n // activating state. (Since all service workers *must* go through the\n // waiting phase, the only way to detect `skipWaiting()` called in the\n // install event is to observe that the time spent in the waiting phase\n // is very short.)\n // NOTE: we don't need separate timeouts for the own and external SWs\n // since they can't go through these phases at the same time.\n this._waitingTimeout = self.setTimeout(() => {\n // Ensure the SW is still waiting (it may now be redundant).\n if (state === 'installed' && registration.waiting === sw) {\n this.dispatchEvent(new WorkboxEvent(eventPrefix + 'waiting', eventProps));\n if (process.env.NODE_ENV !== 'production') {\n if (isExternal) {\n logger.warn('An external service worker has installed but is ' +\n 'waiting for this client to close before activating...');\n }\n else {\n logger.warn('The service worker has installed but is waiting ' +\n 'for existing clients to close before activating...');\n }\n }\n }\n }, WAITING_TIMEOUT_DURATION);\n }\n else if (state === 'activating') {\n clearTimeout(this._waitingTimeout);\n if (!isExternal) {\n this._activeDeferred.resolve(sw);\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n switch (state) {\n case 'installed':\n if (isExternal) {\n logger.warn('An external service worker has installed. ' +\n 'You may want to suggest users reload this page.');\n }\n else {\n logger.log('Registered service worker installed.');\n }\n break;\n case 'activated':\n if (isExternal) {\n logger.warn('An external service worker has activated.');\n }\n else {\n logger.log('Registered service worker activated.');\n if (sw !== navigator.serviceWorker.controller) {\n logger.warn('The registered service worker is active but ' +\n 'not yet controlling the page. Reload or run ' +\n '`clients.claim()` in the service worker.');\n }\n }\n break;\n case 'redundant':\n if (sw === this._compatibleControllingSW) {\n logger.log('Previously controlling service worker now redundant!');\n }\n else if (!isExternal) {\n logger.log('Registered service worker now redundant!');\n }\n break;\n }\n }\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onControllerChange = (originalEvent) => {\n const sw = this._sw;\n if (sw === navigator.serviceWorker.controller) {\n this.dispatchEvent(new WorkboxEvent('controlling', {\n sw,\n originalEvent,\n isUpdate: this._isUpdate,\n }));\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Registered service worker now controlling this page.');\n }\n this._controllingDeferred.resolve(sw);\n }\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onMessage = async (originalEvent) => {\n const { data, source } = originalEvent;\n // Wait until there's an \"own\" service worker. This is used to buffer\n // `message` events that may be received prior to calling `register()`.\n await this.getSW();\n // If the service worker that sent the message is in the list of own\n // service workers for this instance, dispatch a `message` event.\n // NOTE: we check for all previously owned service workers rather than\n // just the current one because some messages (e.g. cache updates) use\n // a timeout when sent and may be delayed long enough for a service worker\n // update to be found.\n if (this._ownSWs.has(source)) {\n this.dispatchEvent(new WorkboxEvent('message', {\n data,\n sw: source,\n originalEvent,\n }));\n }\n };\n this._scriptURL = scriptURL;\n this._registerOptions = registerOptions;\n // Add a message listener immediately since messages received during\n // page load are buffered only until the DOMContentLoaded event:\n // https://github.com/GoogleChrome/workbox/issues/2202\n navigator.serviceWorker.addEventListener('message', this._onMessage);\n }\n /**\n * Registers a service worker for this instances script URL and service\n * worker options. By default this method delays registration until after\n * the window has loaded.\n *\n * @param {Object} [options]\n * @param {Function} [options.immediate=false] Setting this to true will\n * register the service worker immediately, even if the window has\n * not loaded (not recommended).\n */\n async register({ immediate = false } = {}) {\n if (process.env.NODE_ENV !== 'production') {\n if (this._registrationTime) {\n logger.error('Cannot re-register a Workbox instance after it has ' +\n 'been registered. Create a new instance instead.');\n return;\n }\n }\n if (!immediate && document.readyState !== 'complete') {\n await new Promise((res) => window.addEventListener('load', res));\n }\n // Set this flag to true if any service worker was controlling the page\n // at registration time.\n this._isUpdate = Boolean(navigator.serviceWorker.controller);\n // Before registering, attempt to determine if a SW is already controlling\n // the page, and if that SW script (and version, if specified) matches this\n // instance's script.\n this._compatibleControllingSW = this._getControllingSWIfCompatible();\n this._registration = await this._registerScript();\n // If we have a compatible controller, store the controller as the \"own\"\n // SW, resolve active/controlling deferreds and add necessary listeners.\n if (this._compatibleControllingSW) {\n this._sw = this._compatibleControllingSW;\n this._activeDeferred.resolve(this._compatibleControllingSW);\n this._controllingDeferred.resolve(this._compatibleControllingSW);\n this._compatibleControllingSW.addEventListener('statechange', this._onStateChange, { once: true });\n }\n // If there's a waiting service worker with a matching URL before the\n // `updatefound` event fires, it likely means that this site is open\n // in another tab, or the user refreshed the page (and thus the previous\n // page wasn't fully unloaded before this page started loading).\n // https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting\n const waitingSW = this._registration.waiting;\n if (waitingSW && urlsMatch(waitingSW.scriptURL, this._scriptURL)) {\n // Store the waiting SW as the \"own\" Sw, even if it means overwriting\n // a compatible controller.\n this._sw = waitingSW;\n // Run this in the next microtask, so any code that adds an event\n // listener after awaiting `register()` will get this event.\n dontWaitFor(Promise.resolve().then(() => {\n this.dispatchEvent(new WorkboxEvent('waiting', {\n sw: waitingSW,\n wasWaitingBeforeRegister: true,\n }));\n if (process.env.NODE_ENV !== 'production') {\n logger.warn('A service worker was already waiting to activate ' +\n 'before this script was registered...');\n }\n }));\n }\n // If an \"own\" SW is already set, resolve the deferred.\n if (this._sw) {\n this._swDeferred.resolve(this._sw);\n this._ownSWs.add(this._sw);\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Successfully registered service worker.', this._scriptURL);\n if (navigator.serviceWorker.controller) {\n if (this._compatibleControllingSW) {\n logger.debug('A service worker with the same script URL ' +\n 'is already controlling this page.');\n }\n else {\n logger.debug('A service worker with a different script URL is ' +\n 'currently controlling the page. The browser is now fetching ' +\n 'the new script now...');\n }\n }\n const currentPageIsOutOfScope = () => {\n const scopeURL = new URL(this._registerOptions.scope || this._scriptURL, document.baseURI);\n const scopeURLBasePath = new URL('./', scopeURL.href).pathname;\n return !location.pathname.startsWith(scopeURLBasePath);\n };\n if (currentPageIsOutOfScope()) {\n logger.warn('The current page is not in scope for the registered ' +\n 'service worker. Was this a mistake?');\n }\n }\n this._registration.addEventListener('updatefound', this._onUpdateFound);\n navigator.serviceWorker.addEventListener('controllerchange', this._onControllerChange, { once: true });\n return this._registration;\n }\n /**\n * Checks for updates of the registered service worker.\n */\n async update() {\n if (!this._registration) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error('Cannot update a Workbox instance without ' +\n 'being registered. Register the Workbox instance first.');\n }\n return;\n }\n // Try to update registration\n await this._registration.update();\n }\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is active. If a service worker was already controlling at registration\n * time then it will resolve to that if the script URLs (and optionally\n * script versions) match, otherwise it will wait until an update is found\n * and activates.\n *\n * @return {Promise<ServiceWorker>}\n */\n get active() {\n return this._activeDeferred.promise;\n }\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is controlling the page. If a service worker was already controlling at\n * registration time then it will resolve to that if the script URLs (and\n * optionally script versions) match, otherwise it will wait until an update\n * is found and starts controlling the page.\n * Note: the first time a service worker is installed it will active but\n * not start controlling the page unless `clients.claim()` is called in the\n * service worker.\n *\n * @return {Promise<ServiceWorker>}\n */\n get controlling() {\n return this._controllingDeferred.promise;\n }\n /**\n * Resolves with a reference to a service worker that matches the script URL\n * of this instance, as soon as it's available.\n *\n * If, at registration time, there's already an active or waiting service\n * worker with a matching script URL, it will be used (with the waiting\n * service worker taking precedence over the active service worker if both\n * match, since the waiting service worker would have been registered more\n * recently).\n * If there's no matching active or waiting service worker at registration\n * time then the promise will not resolve until an update is found and starts\n * installing, at which point the installing service worker is used.\n *\n * @return {Promise<ServiceWorker>}\n */\n async getSW() {\n // If `this._sw` is set, resolve with that as we want `getSW()` to\n // return the correct (new) service worker if an update is found.\n return this._sw !== undefined ? this._sw : this._swDeferred.promise;\n }\n /**\n * Sends the passed data object to the service worker registered by this\n * instance (via [`getSW()`]{@link module:workbox-window.Workbox#getSW}) and resolves\n * with a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will never\n * resolve.\n *\n * @param {Object} data An object to send to the service worker\n * @return {Promise<Object>}\n */\n async messageSW(data) {\n const sw = await this.getSW();\n return messageSW(sw, data);\n }\n /**\n * Checks for a service worker already controlling the page and returns\n * it if its script URL matches.\n *\n * @private\n * @return {ServiceWorker|undefined}\n */\n _getControllingSWIfCompatible() {\n const controller = navigator.serviceWorker.controller;\n if (controller && urlsMatch(controller.scriptURL, this._scriptURL)) {\n return controller;\n }\n else {\n return undefined;\n }\n }\n /**\n * Registers a service worker for this instances script URL and register\n * options and tracks the time registration was complete.\n *\n * @private\n */\n async _registerScript() {\n try {\n const reg = await navigator.serviceWorker.register(this._scriptURL, this._registerOptions);\n // Keep track of when registration happened, so it can be used in the\n // `this._onUpdateFound` heuristic. Also use the presence of this\n // property as a way to see if `.register()` has been called.\n this._registrationTime = performance.now();\n return reg;\n }\n catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error(error);\n }\n // Re-throw the error.\n throw error;\n }\n }\n}\nexport { Workbox };\n// The jsdoc comments below outline the events this instance may dispatch:\n// -----------------------------------------------------------------------\n/**\n * The `message` event is dispatched any time a `postMessage` is received.\n *\n * @event module:workbox-window.Workbox#message\n * @type {WorkboxEvent}\n * @property {*} data The `data` property from the original `message` event.\n * @property {Event} originalEvent The original [`message`]{@link https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent}\n * event.\n * @property {string} type `message`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `installed` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `installed`.\n *\n * Then can happen either the very first time a service worker is installed,\n * or after an update to the current service worker is found. In the case\n * of an update being found, the event's `isUpdate` property will be `true`.\n *\n * @event module:workbox-window.Workbox#installed\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `installed`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `waiting` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `installed` and then doesn't immediately change to `activating`.\n * It may also be dispatched if a service worker with the same\n * [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * was already waiting when the [`register()`]{@link module:workbox-window.Workbox#register}\n * method was called.\n *\n * @event module:workbox-window.Workbox#waiting\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event|undefined} originalEvent The original\n * [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event, or `undefined` in the case where the service worker was waiting\n * to before `.register()` was called.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} wasWaitingBeforeRegister True if a service worker with\n * a matching `scriptURL` was already waiting when this `Workbox`\n * instance called `register()`.\n * @property {string} type `waiting`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `controlling` event is dispatched if a\n * [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * fires on the service worker [container]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer}\n * and the [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * of the new [controller]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller}\n * matches the `scriptURL` of the `Workbox` instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}.\n *\n * @event module:workbox-window.Workbox#controlling\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this service worker was registered.\n * @property {string} type `controlling`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `activated` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `activated`.\n *\n * @event module:workbox-window.Workbox#activated\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `activated`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `redundant` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `redundant`.\n *\n * @event module:workbox-window.Workbox#redundant\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `redundant`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `externalinstalled` event is dispatched if the state of an\n * [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}\n * changes to `installed`.\n *\n * @event module:workbox-window.Workbox#externalinstalled\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {string} type `externalinstalled`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `externalwaiting` event is dispatched if the state of an\n * [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}\n * changes to `waiting`.\n *\n * @event module:workbox-window.Workbox#externalwaiting\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {string} type `externalwaiting`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `externalactivated` event is dispatched if the state of an\n * [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}\n * changes to `activated`.\n *\n * @event module:workbox-window.Workbox#externalactivated\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {string} type `externalactivated`.\n * @property {Workbox} target The `Workbox` instance.\n */\n"],"names":["self","_","e","messageSW","sw","data","Promise","resolve","messageChannel","MessageChannel","port1","onmessage","event","postMessage","port2","Deferred","promise","reject","dontWaitFor","then","logger","process","__WB_DISABLE_DEV_LOGS","inGroup","methodToColorMap","debug","log","warn","error","groupCollapsed","groupEnd","print","method","args","test","navigator","userAgent","console","styles","logPrefix","join","api","loggerMethods","Object","keys","key","WorkboxEventTarget","_eventListenerRegistry","Map","addEventListener","type","listener","foo","_getEventListenersByType","add","removeEventListener","delete","dispatchEvent","target","listeners","has","set","Set","get","urlsMatch","url1","url2","location","href","URL","WorkboxEvent","props","assign","_await","value","direct","WAITING_TIMEOUT_DURATION","_async","f","i","arguments","length","apply","REGISTRATION_TIMEOUT_DURATION","_empty","Workbox","scriptURL","registerOptions","_registerOptions","_updateFoundCount","_swDeferred","_activeDeferred","_controllingDeferred","_registrationTime","_ownSWs","_onUpdateFound","registration","_registration","installingSW","installing","updateLikelyTriggeredExternally","_scriptURL","performance","now","_externalSW","_sw","serviceWorker","controller","_onStateChange","originalEvent","state","isExternal","eventPrefix","eventProps","_isUpdate","isUpdate","_waitingTimeout","setTimeout","waiting","clearTimeout","_compatibleControllingSW","_onControllerChange","_onMessage","source","getSW","register","immediate","document","readyState","res","window","Boolean","_getControllingSWIfCompatible","_registerScript","once","waitingSW","wasWaitingBeforeRegister","currentPageIsOutOfScope","scopeURL","scope","baseURI","scopeURLBasePath","pathname","startsWith","update","undefined","reg","body","result","recover"],"mappings":";;;;;;IAEA,IAAI;IACAA,EAAAA,IAAI,CAAC,sBAAD,CAAJ,IAAgCC,CAAC,EAAjC;IACH,CAFD,CAGA,OAAOC,CAAP,EAAU;;ICLV;;;;;;;AAOA,IACA;;;;;;;;;;;;;;;IAcA,SAASC,SAAT,CAAmBC,EAAnB,EAAuBC,IAAvB,EAA6B;IACzB,SAAO,IAAIC,OAAJ,CAAY,UAACC,OAAD,EAAa;IAC5B,QAAMC,cAAc,GAAG,IAAIC,cAAJ,EAAvB;;IACAD,IAAAA,cAAc,CAACE,KAAf,CAAqBC,SAArB,GAAiC,UAACC,KAAD,EAAW;IACxCL,MAAAA,OAAO,CAACK,KAAK,CAACP,IAAP,CAAP;IACH,KAFD;;IAGAD,IAAAA,EAAE,CAACS,WAAH,CAAeR,IAAf,EAAqB,CAACG,cAAc,CAACM,KAAhB,CAArB;IACH,GANM,CAAP;IAOH;;;;;;;;;;;;;;;;;;;;;;;;IC5BD,IAAI;IACAd,EAAAA,IAAI,CAAC,oBAAD,CAAJ,IAA8BC,CAAC,EAA/B;IACH,CAFD,CAGA,OAAOC,CAAP,EAAU;;ICLV;;;;;;;AAOA,IACA;;;;;;;;;QAQMa;IACF;;;IAGA,oBAAc;IAAA;;IACV,OAAKC,OAAL,GAAe,IAAIV,OAAJ,CAAY,UAACC,OAAD,EAAUU,MAAV,EAAqB;IAC5C,IAAA,KAAI,CAACV,OAAL,GAAeA,OAAf;IACA,IAAA,KAAI,CAACU,MAAL,GAAcA,MAAd;IACH,GAHc,CAAf;IAIH;;ICzBL;;;;;;AAMA,IACA;;;;;;AAKA,IAAO,SAASC,WAAT,CAAqBF,OAArB,EAA8B;IACjC;IACAA,EAAAA,OAAO,CAACG,IAAR,CAAa,YAAM,EAAnB;IACH;;ICfD;;;;;;AAMA,IACA,IAAMC,MAAM,GAAIC,CAAgD,YAAM;I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BAAL,CAA0B5E,OAAjC;IACH;;;;MAjWiB8B;;IA0Df,uBAAuB4B,KAAvB,EAA8BC,MAA9B,EAAsC;IAC5C,MAAI,CAACA,MAAL,EAAa;IACZ,WAAOD,KAAK,IAAIA,KAAK,CAACvD,IAAf,GAAsBuD,KAAK,CAACvD,IAAN,QAAtB,GAA2Cb,OAAO,CAACC,OAAR,EAAlD;IACA;IACD;IAmXD;;IACA;;;;;;;;;;;;IAWA;;;;;;;;;;;;;;;;;;;;;IAoBA;;;;;;;;;;;;;;;;;;;;;;;;;;IAyBA;;;;;;;;;;;;;;;;;;;;IAmBA;;;;;;;;;;;;;;;;;IAgBA;;;;;;;;;;;;;;;;;IAgBA;;;;;;;;;;;;;;IAaA;;;;;;;;;;;;;;IAaA;;;;;;;;;;;;;;;IA3DO,iBAAiB4I,IAAjB,EAAuBhI,IAAvB,EAA6B;IACnC,MAAIiI,MAAM,GAAGD,IAAI,EAAjB;;IACA,MAAIC,MAAM,IAAIA,MAAM,CAACjI,IAArB,EAA2B;IAC1B,WAAOiI,MAAM,CAACjI,IAAP,CAAYA,IAAZ,CAAP;IACA;;IACD,SAAOA,IAAI,CAACiI,MAAD,CAAX;IACA;;IAWM,gBAAgBD,IAAhB,EAAsBE,OAAtB,EAA+B;IACrC,MAAI;IACH,QAAID,MAAM,GAAGD,IAAI,EAAjB;IACA,GAFD,CAEE,OAAMjJ,CAAN,EAAS;IACV,WAAOmJ,OAAO,CAACnJ,CAAD,CAAd;IACA;;IACD,MAAIkJ,MAAM,IAAIA,MAAM,CAACjI,IAArB,EAA2B;IAC1B,WAAOiI,MAAM,CAACjI,IAAP,CAAY,KAAK,CAAjB,EAAoBkI,OAApB,CAAP;IACA;;IACD,SAAOD,MAAP;IACA;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ try{self["workbox:window:5.1.3"]&&_()}catch(n){}function n(n,t){return new Promise((function(r){var i=new MessageChannel;i.port1.onmessage=function(n){r(n.data)},n.postMessage(t,[i.port2])}))}function t(n,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}}try{self["workbox:core:5.1.3"]&&_()}catch(n){}var r=function(){var n=this;this.promise=new Promise((function(t,r){n.resolve=t,n.reject=r}))};function i(n,t){var r=location.href;return new URL(n,r).href===new URL(t,r).href}var e=function(n,t){this.type=n,Object.assign(this,t)};function o(n,t,r){return r?t?t(n):n:(n&&n.then||(n=Promise.resolve(n)),t?n.then(t):n)}function u(){}var a=function(u){var a,f;function s(n,t){var a,c;return void 0===t&&(t={}),(a=u.call(this)||this).t={},a.i=0,a.o=new r,a.u=new r,a.s=new r,a.v=0,a.h=new Set,a.l=function(){var n=a.g,t=n.installing;a.i>0||!i(t.scriptURL,a.m)||performance.now()>a.v+6e4?(a.P=t,n.removeEventListener("updatefound",a.l)):(a.p=t,a.h.add(t),a.o.resolve(t)),++a.i,t.addEventListener("statechange",a.k)},a.k=function(n){var t=a.g,r=n.target,i=r.state,o=r===a.P,u=o?"external":"",c={sw:r,originalEvent:n};!o&&a.j&&(c.isUpdate=!0),a.dispatchEvent(new e(u+i,c)),"installed"===i?a.O=self.setTimeout((function(){"installed"===i&&t.waiting===r&&a.dispatchEvent(new e(u+"waiting",c))}),200):"activating"===i&&(clearTimeout(a.O),o||a.u.resolve(r))},a.R=function(n){var t=a.p;t===navigator.serviceWorker.controller&&(a.dispatchEvent(new e("controlling",{sw:t,originalEvent:n,isUpdate:a.j})),a.s.resolve(t))},a.S=(c=function(n){var t=n.data,r=n.source;return o(a.getSW(),(function(){a.h.has(r)&&a.dispatchEvent(new e("message",{data:t,sw:r,originalEvent:n}))}))},function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];try{return Promise.resolve(c.apply(this,n))}catch(n){return Promise.reject(n)}}),a.m=n,a.t=t,navigator.serviceWorker.addEventListener("message",a.S),a}f=u,(a=s).prototype=Object.create(f.prototype),a.prototype.constructor=a,a.__proto__=f;var v,h,w,l=s.prototype;return l.register=function(n){var t=(void 0===n?{}:n).immediate,r=void 0!==t&&t;try{var u=this;return function(n,t){var r=n();if(r&&r.then)return r.then(t);return t(r)}((function(){if(!r&&"complete"!==document.readyState)return c(new Promise((function(n){return window.addEventListener("load",n)})))}),(function(){return u.j=Boolean(navigator.serviceWorker.controller),u.U=u.B(),o(u.L(),(function(n){u.g=n,u.U&&(u.p=u.U,u.u.resolve(u.U),u.s.resolve(u.U),u.U.addEventListener("statechange",u.k,{once:!0}));var t=u.g.waiting;return t&&i(t.scriptURL,u.m)&&(u.p=t,Promise.resolve().then((function(){u.dispatchEvent(new e("waiting",{sw:t,wasWaitingBeforeRegister:!0}))})).then((function(){}))),u.p&&(u.o.resolve(u.p),u.h.add(u.p)),u.g.addEventListener("updatefound",u.l),navigator.serviceWorker.addEventListener("controllerchange",u.R,{once:!0}),u.g}))}))}catch(n){return Promise.reject(n)}},l.update=function(){try{return this.g?c(this.g.update()):void 0}catch(n){return Promise.reject(n)}},l.getSW=function(){try{return void 0!==this.p?this.p:this.o.promise}catch(n){return Promise.reject(n)}},l.messageSW=function(t){try{return o(this.getSW(),(function(r){return n(r,t)}))}catch(n){return Promise.reject(n)}},l.B=function(){var n=navigator.serviceWorker.controller;return n&&i(n.scriptURL,this.m)?n:void 0},l.L=function(){try{var n=this;return function(n,t){try{var r=n()}catch(n){return t(n)}if(r&&r.then)return r.then(void 0,t);return r}((function(){return o(navigator.serviceWorker.register(n.m,n.t),(function(t){return n.v=performance.now(),t}))}),(function(n){throw n}))}catch(n){return Promise.reject(n)}},v=s,(h=[{key:"active",get:function(){return this.u.promise}},{key:"controlling",get:function(){return this.s.promise}}])&&t(v.prototype,h),w&&t(v,w),s}(function(){function n(){this.M=new Map}var t=n.prototype;return t.addEventListener=function(n,t){this._(n).add(t)},t.removeEventListener=function(n,t){this._(n).delete(t)},t.dispatchEvent=function(n){n.target=this;var t=this._(n.type),r=Array.isArray(t),i=0;for(t=r?t:t[Symbol.iterator]();;){var e;if(r){if(i>=t.length)break;e=t[i++]}else{if((i=t.next()).done)break;e=i.value}e(n)}},t._=function(n){return this.M.has(n)||this.M.set(n,new Set),this.M.get(n)},n}());function c(n,t){if(!t)return n&&n.then?n.then(u):Promise.resolve()}export{a as Workbox,n as messageSW};
2
+ //# sourceMappingURL=workbox-window.prod.es5.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workbox-window.prod.es5.mjs","sources":["../_version.js","../messageSW.js","../../workbox-core/_version.js","../../workbox-core/_private/Deferred.js","../utils/urlsMatch.js","../utils/WorkboxEvent.js","../Workbox.js","../../workbox-core/_private/dontWaitFor.js","../utils/WorkboxEventTarget.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:window:5.1.3'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport './_version.js';\n/**\n * Sends a data object to a service worker via `postMessage` and resolves with\n * a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will not\n * resolve.\n *\n * @param {ServiceWorker} sw The service worker to send the message to.\n * @param {Object} data An object to send to the service worker.\n * @return {Promise<Object|undefined>}\n * @memberof module:workbox-window\n */\nfunction messageSW(sw, data) {\n return new Promise((resolve) => {\n const messageChannel = new MessageChannel();\n messageChannel.port1.onmessage = (event) => {\n resolve(event.data);\n };\n sw.postMessage(data, [messageChannel.port2]);\n });\n}\nexport { messageSW };\n","\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:core:5.1.3'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * The Deferred class composes Promises in a way that allows for them to be\n * resolved or rejected from outside the constructor. In most cases promises\n * should be used directly, but Deferreds can be necessary when the logic to\n * resolve a promise must be separate.\n *\n * @private\n */\nclass Deferred {\n /**\n * Creates a promise and exposes its resolve and reject functions as methods.\n */\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n }\n}\nexport { Deferred };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * Returns true if two URLs have the same `.href` property. The URLS can be\n * relative, and if they are the current location href is used to resolve URLs.\n *\n * @private\n * @param {string} url1\n * @param {string} url2\n * @return {boolean}\n */\nexport function urlsMatch(url1, url2) {\n const { href } = location;\n return new URL(url1, href).href === new URL(url2, href).href;\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A minimal `Event` subclass shim.\n * This doesn't *actually* subclass `Event` because not all browsers support\n * constructable `EventTarget`, and using a real `Event` will error.\n * @private\n */\nexport class WorkboxEvent {\n constructor(type, props) {\n this.type = type;\n Object.assign(this, props);\n }\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { Deferred } from 'workbox-core/_private/Deferred.js';\nimport { dontWaitFor } from 'workbox-core/_private/dontWaitFor.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { messageSW } from './messageSW.js';\nimport { WorkboxEventTarget } from './utils/WorkboxEventTarget.js';\nimport { urlsMatch } from './utils/urlsMatch.js';\nimport { WorkboxEvent } from './utils/WorkboxEvent.js';\nimport './_version.js';\n// The time a SW must be in the waiting phase before we can conclude\n// `skipWaiting()` wasn't called. This 200 amount wasn't scientifically\n// chosen, but it seems to avoid false positives in my testing.\nconst WAITING_TIMEOUT_DURATION = 200;\n// The amount of time after a registration that we can reasonably conclude\n// that the registration didn't trigger an update.\nconst REGISTRATION_TIMEOUT_DURATION = 60000;\n/**\n * A class to aid in handling service worker registration, updates, and\n * reacting to service worker lifecycle events.\n *\n * @fires [message]{@link module:workbox-window.Workbox#message}\n * @fires [installed]{@link module:workbox-window.Workbox#installed}\n * @fires [waiting]{@link module:workbox-window.Workbox#waiting}\n * @fires [controlling]{@link module:workbox-window.Workbox#controlling}\n * @fires [activated]{@link module:workbox-window.Workbox#activated}\n * @fires [redundant]{@link module:workbox-window.Workbox#redundant}\n * @fires [externalinstalled]{@link module:workbox-window.Workbox#externalinstalled}\n * @fires [externalwaiting]{@link module:workbox-window.Workbox#externalwaiting}\n * @fires [externalactivated]{@link module:workbox-window.Workbox#externalactivated}\n * @memberof module:workbox-window\n */\nclass Workbox extends WorkboxEventTarget {\n /**\n * Creates a new Workbox instance with a script URL and service worker\n * options. The script URL and options are the same as those used when\n * calling `navigator.serviceWorker.register(scriptURL, options)`. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register\n *\n * @param {string} scriptURL The service worker script associated with this\n * instance.\n * @param {Object} [registerOptions] The service worker options associated\n * with this instance.\n */\n constructor(scriptURL, registerOptions = {}) {\n super();\n this._registerOptions = {};\n this._updateFoundCount = 0;\n // Deferreds we can resolve later.\n this._swDeferred = new Deferred();\n this._activeDeferred = new Deferred();\n this._controllingDeferred = new Deferred();\n this._registrationTime = 0;\n this._ownSWs = new Set();\n /**\n * @private\n */\n this._onUpdateFound = () => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const installingSW = registration.installing;\n // If the script URL passed to `navigator.serviceWorker.register()` is\n // different from the current controlling SW's script URL, we know any\n // successful registration calls will trigger an `updatefound` event.\n // But if the registered script URL is the same as the current controlling\n // SW's script URL, we'll only get an `updatefound` event if the file\n // changed since it was last registered. This can be a problem if the user\n // opens up the same page in a different tab, and that page registers\n // a SW that triggers an update. It's a problem because this page has no\n // good way of knowing whether the `updatefound` event came from the SW\n // script it registered or from a registration attempt made by a newer\n // version of the page running in another tab.\n // To minimize the possibility of a false positive, we use the logic here:\n const updateLikelyTriggeredExternally = \n // Since we enforce only calling `register()` once, and since we don't\n // add the `updatefound` event listener until the `register()` call, if\n // `_updateFoundCount` is > 0 then it means this method has already\n // been called, thus this SW must be external\n this._updateFoundCount > 0 ||\n // If the script URL of the installing SW is different from this\n // instance's script URL, we know it's definitely not from our\n // registration.\n !urlsMatch(installingSW.scriptURL, this._scriptURL) ||\n // If all of the above are false, then we use a time-based heuristic:\n // Any `updatefound` event that occurs long after our registration is\n // assumed to be external.\n (performance.now() >\n this._registrationTime + REGISTRATION_TIMEOUT_DURATION) ?\n // If any of the above are not true, we assume the update was\n // triggered by this instance.\n true : false;\n if (updateLikelyTriggeredExternally) {\n this._externalSW = installingSW;\n registration.removeEventListener('updatefound', this._onUpdateFound);\n }\n else {\n // If the update was not triggered externally we know the installing\n // SW is the one we registered, so we set it.\n this._sw = installingSW;\n this._ownSWs.add(installingSW);\n this._swDeferred.resolve(installingSW);\n // The `installing` state isn't something we have a dedicated\n // callback for, but we do log messages for it in development.\n if (process.env.NODE_ENV !== 'production') {\n if (navigator.serviceWorker.controller) {\n logger.log('Updated service worker found. Installing now...');\n }\n else {\n logger.log('Service worker is installing...');\n }\n }\n }\n // Increment the `updatefound` count, so future invocations of this\n // method can be sure they were triggered externally.\n ++this._updateFoundCount;\n // Add a `statechange` listener regardless of whether this update was\n // triggered externally, since we have callbacks for both.\n installingSW.addEventListener('statechange', this._onStateChange);\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onStateChange = (originalEvent) => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const sw = originalEvent.target;\n const { state } = sw;\n const isExternal = sw === this._externalSW;\n const eventPrefix = isExternal ? 'external' : '';\n const eventProps = {\n sw,\n originalEvent\n };\n if (!isExternal && this._isUpdate) {\n eventProps.isUpdate = true;\n }\n this.dispatchEvent(new WorkboxEvent(eventPrefix + state, eventProps));\n if (state === 'installed') {\n // This timeout is used to ignore cases where the service worker calls\n // `skipWaiting()` in the install event, thus moving it directly in the\n // activating state. (Since all service workers *must* go through the\n // waiting phase, the only way to detect `skipWaiting()` called in the\n // install event is to observe that the time spent in the waiting phase\n // is very short.)\n // NOTE: we don't need separate timeouts for the own and external SWs\n // since they can't go through these phases at the same time.\n this._waitingTimeout = self.setTimeout(() => {\n // Ensure the SW is still waiting (it may now be redundant).\n if (state === 'installed' && registration.waiting === sw) {\n this.dispatchEvent(new WorkboxEvent(eventPrefix + 'waiting', eventProps));\n if (process.env.NODE_ENV !== 'production') {\n if (isExternal) {\n logger.warn('An external service worker has installed but is ' +\n 'waiting for this client to close before activating...');\n }\n else {\n logger.warn('The service worker has installed but is waiting ' +\n 'for existing clients to close before activating...');\n }\n }\n }\n }, WAITING_TIMEOUT_DURATION);\n }\n else if (state === 'activating') {\n clearTimeout(this._waitingTimeout);\n if (!isExternal) {\n this._activeDeferred.resolve(sw);\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n switch (state) {\n case 'installed':\n if (isExternal) {\n logger.warn('An external service worker has installed. ' +\n 'You may want to suggest users reload this page.');\n }\n else {\n logger.log('Registered service worker installed.');\n }\n break;\n case 'activated':\n if (isExternal) {\n logger.warn('An external service worker has activated.');\n }\n else {\n logger.log('Registered service worker activated.');\n if (sw !== navigator.serviceWorker.controller) {\n logger.warn('The registered service worker is active but ' +\n 'not yet controlling the page. Reload or run ' +\n '`clients.claim()` in the service worker.');\n }\n }\n break;\n case 'redundant':\n if (sw === this._compatibleControllingSW) {\n logger.log('Previously controlling service worker now redundant!');\n }\n else if (!isExternal) {\n logger.log('Registered service worker now redundant!');\n }\n break;\n }\n }\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onControllerChange = (originalEvent) => {\n const sw = this._sw;\n if (sw === navigator.serviceWorker.controller) {\n this.dispatchEvent(new WorkboxEvent('controlling', {\n sw,\n originalEvent,\n isUpdate: this._isUpdate,\n }));\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Registered service worker now controlling this page.');\n }\n this._controllingDeferred.resolve(sw);\n }\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onMessage = async (originalEvent) => {\n const { data, source } = originalEvent;\n // Wait until there's an \"own\" service worker. This is used to buffer\n // `message` events that may be received prior to calling `register()`.\n await this.getSW();\n // If the service worker that sent the message is in the list of own\n // service workers for this instance, dispatch a `message` event.\n // NOTE: we check for all previously owned service workers rather than\n // just the current one because some messages (e.g. cache updates) use\n // a timeout when sent and may be delayed long enough for a service worker\n // update to be found.\n if (this._ownSWs.has(source)) {\n this.dispatchEvent(new WorkboxEvent('message', {\n data,\n sw: source,\n originalEvent,\n }));\n }\n };\n this._scriptURL = scriptURL;\n this._registerOptions = registerOptions;\n // Add a message listener immediately since messages received during\n // page load are buffered only until the DOMContentLoaded event:\n // https://github.com/GoogleChrome/workbox/issues/2202\n navigator.serviceWorker.addEventListener('message', this._onMessage);\n }\n /**\n * Registers a service worker for this instances script URL and service\n * worker options. By default this method delays registration until after\n * the window has loaded.\n *\n * @param {Object} [options]\n * @param {Function} [options.immediate=false] Setting this to true will\n * register the service worker immediately, even if the window has\n * not loaded (not recommended).\n */\n async register({ immediate = false } = {}) {\n if (process.env.NODE_ENV !== 'production') {\n if (this._registrationTime) {\n logger.error('Cannot re-register a Workbox instance after it has ' +\n 'been registered. Create a new instance instead.');\n return;\n }\n }\n if (!immediate && document.readyState !== 'complete') {\n await new Promise((res) => window.addEventListener('load', res));\n }\n // Set this flag to true if any service worker was controlling the page\n // at registration time.\n this._isUpdate = Boolean(navigator.serviceWorker.controller);\n // Before registering, attempt to determine if a SW is already controlling\n // the page, and if that SW script (and version, if specified) matches this\n // instance's script.\n this._compatibleControllingSW = this._getControllingSWIfCompatible();\n this._registration = await this._registerScript();\n // If we have a compatible controller, store the controller as the \"own\"\n // SW, resolve active/controlling deferreds and add necessary listeners.\n if (this._compatibleControllingSW) {\n this._sw = this._compatibleControllingSW;\n this._activeDeferred.resolve(this._compatibleControllingSW);\n this._controllingDeferred.resolve(this._compatibleControllingSW);\n this._compatibleControllingSW.addEventListener('statechange', this._onStateChange, { once: true });\n }\n // If there's a waiting service worker with a matching URL before the\n // `updatefound` event fires, it likely means that this site is open\n // in another tab, or the user refreshed the page (and thus the previous\n // page wasn't fully unloaded before this page started loading).\n // https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting\n const waitingSW = this._registration.waiting;\n if (waitingSW && urlsMatch(waitingSW.scriptURL, this._scriptURL)) {\n // Store the waiting SW as the \"own\" Sw, even if it means overwriting\n // a compatible controller.\n this._sw = waitingSW;\n // Run this in the next microtask, so any code that adds an event\n // listener after awaiting `register()` will get this event.\n dontWaitFor(Promise.resolve().then(() => {\n this.dispatchEvent(new WorkboxEvent('waiting', {\n sw: waitingSW,\n wasWaitingBeforeRegister: true,\n }));\n if (process.env.NODE_ENV !== 'production') {\n logger.warn('A service worker was already waiting to activate ' +\n 'before this script was registered...');\n }\n }));\n }\n // If an \"own\" SW is already set, resolve the deferred.\n if (this._sw) {\n this._swDeferred.resolve(this._sw);\n this._ownSWs.add(this._sw);\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Successfully registered service worker.', this._scriptURL);\n if (navigator.serviceWorker.controller) {\n if (this._compatibleControllingSW) {\n logger.debug('A service worker with the same script URL ' +\n 'is already controlling this page.');\n }\n else {\n logger.debug('A service worker with a different script URL is ' +\n 'currently controlling the page. The browser is now fetching ' +\n 'the new script now...');\n }\n }\n const currentPageIsOutOfScope = () => {\n const scopeURL = new URL(this._registerOptions.scope || this._scriptURL, document.baseURI);\n const scopeURLBasePath = new URL('./', scopeURL.href).pathname;\n return !location.pathname.startsWith(scopeURLBasePath);\n };\n if (currentPageIsOutOfScope()) {\n logger.warn('The current page is not in scope for the registered ' +\n 'service worker. Was this a mistake?');\n }\n }\n this._registration.addEventListener('updatefound', this._onUpdateFound);\n navigator.serviceWorker.addEventListener('controllerchange', this._onControllerChange, { once: true });\n return this._registration;\n }\n /**\n * Checks for updates of the registered service worker.\n */\n async update() {\n if (!this._registration) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error('Cannot update a Workbox instance without ' +\n 'being registered. Register the Workbox instance first.');\n }\n return;\n }\n // Try to update registration\n await this._registration.update();\n }\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is active. If a service worker was already controlling at registration\n * time then it will resolve to that if the script URLs (and optionally\n * script versions) match, otherwise it will wait until an update is found\n * and activates.\n *\n * @return {Promise<ServiceWorker>}\n */\n get active() {\n return this._activeDeferred.promise;\n }\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is controlling the page. If a service worker was already controlling at\n * registration time then it will resolve to that if the script URLs (and\n * optionally script versions) match, otherwise it will wait until an update\n * is found and starts controlling the page.\n * Note: the first time a service worker is installed it will active but\n * not start controlling the page unless `clients.claim()` is called in the\n * service worker.\n *\n * @return {Promise<ServiceWorker>}\n */\n get controlling() {\n return this._controllingDeferred.promise;\n }\n /**\n * Resolves with a reference to a service worker that matches the script URL\n * of this instance, as soon as it's available.\n *\n * If, at registration time, there's already an active or waiting service\n * worker with a matching script URL, it will be used (with the waiting\n * service worker taking precedence over the active service worker if both\n * match, since the waiting service worker would have been registered more\n * recently).\n * If there's no matching active or waiting service worker at registration\n * time then the promise will not resolve until an update is found and starts\n * installing, at which point the installing service worker is used.\n *\n * @return {Promise<ServiceWorker>}\n */\n async getSW() {\n // If `this._sw` is set, resolve with that as we want `getSW()` to\n // return the correct (new) service worker if an update is found.\n return this._sw !== undefined ? this._sw : this._swDeferred.promise;\n }\n /**\n * Sends the passed data object to the service worker registered by this\n * instance (via [`getSW()`]{@link module:workbox-window.Workbox#getSW}) and resolves\n * with a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will never\n * resolve.\n *\n * @param {Object} data An object to send to the service worker\n * @return {Promise<Object>}\n */\n async messageSW(data) {\n const sw = await this.getSW();\n return messageSW(sw, data);\n }\n /**\n * Checks for a service worker already controlling the page and returns\n * it if its script URL matches.\n *\n * @private\n * @return {ServiceWorker|undefined}\n */\n _getControllingSWIfCompatible() {\n const controller = navigator.serviceWorker.controller;\n if (controller && urlsMatch(controller.scriptURL, this._scriptURL)) {\n return controller;\n }\n else {\n return undefined;\n }\n }\n /**\n * Registers a service worker for this instances script URL and register\n * options and tracks the time registration was complete.\n *\n * @private\n */\n async _registerScript() {\n try {\n const reg = await navigator.serviceWorker.register(this._scriptURL, this._registerOptions);\n // Keep track of when registration happened, so it can be used in the\n // `this._onUpdateFound` heuristic. Also use the presence of this\n // property as a way to see if `.register()` has been called.\n this._registrationTime = performance.now();\n return reg;\n }\n catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error(error);\n }\n // Re-throw the error.\n throw error;\n }\n }\n}\nexport { Workbox };\n// The jsdoc comments below outline the events this instance may dispatch:\n// -----------------------------------------------------------------------\n/**\n * The `message` event is dispatched any time a `postMessage` is received.\n *\n * @event module:workbox-window.Workbox#message\n * @type {WorkboxEvent}\n * @property {*} data The `data` property from the original `message` event.\n * @property {Event} originalEvent The original [`message`]{@link https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent}\n * event.\n * @property {string} type `message`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `installed` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `installed`.\n *\n * Then can happen either the very first time a service worker is installed,\n * or after an update to the current service worker is found. In the case\n * of an update being found, the event's `isUpdate` property will be `true`.\n *\n * @event module:workbox-window.Workbox#installed\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `installed`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `waiting` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `installed` and then doesn't immediately change to `activating`.\n * It may also be dispatched if a service worker with the same\n * [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * was already waiting when the [`register()`]{@link module:workbox-window.Workbox#register}\n * method was called.\n *\n * @event module:workbox-window.Workbox#waiting\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event|undefined} originalEvent The original\n * [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event, or `undefined` in the case where the service worker was waiting\n * to before `.register()` was called.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} wasWaitingBeforeRegister True if a service worker with\n * a matching `scriptURL` was already waiting when this `Workbox`\n * instance called `register()`.\n * @property {string} type `waiting`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `controlling` event is dispatched if a\n * [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * fires on the service worker [container]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer}\n * and the [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * of the new [controller]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller}\n * matches the `scriptURL` of the `Workbox` instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}.\n *\n * @event module:workbox-window.Workbox#controlling\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this service worker was registered.\n * @property {string} type `controlling`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `activated` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `activated`.\n *\n * @event module:workbox-window.Workbox#activated\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `activated`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `redundant` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `redundant`.\n *\n * @event module:workbox-window.Workbox#redundant\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `redundant`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `externalinstalled` event is dispatched if the state of an\n * [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}\n * changes to `installed`.\n *\n * @event module:workbox-window.Workbox#externalinstalled\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {string} type `externalinstalled`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `externalwaiting` event is dispatched if the state of an\n * [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}\n * changes to `waiting`.\n *\n * @event module:workbox-window.Workbox#externalwaiting\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {string} type `externalwaiting`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `externalactivated` event is dispatched if the state of an\n * [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}\n * changes to `activated`.\n *\n * @event module:workbox-window.Workbox#externalactivated\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {string} type `externalactivated`.\n * @property {Workbox} target The `Workbox` instance.\n */\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A helper function that prevents a promise from being flagged as unused.\n *\n * @private\n **/\nexport function dontWaitFor(promise) {\n // Effective no-op.\n promise.then(() => { });\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n/**\n * A minimal `EventTarget` shim.\n * This is necessary because not all browsers support constructable\n * `EventTarget`, so using a real `EventTarget` will error.\n * @private\n */\nexport class WorkboxEventTarget {\n constructor() {\n this._eventListenerRegistry = new Map();\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n addEventListener(type, listener) {\n const foo = this._getEventListenersByType(type);\n foo.add(listener);\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n removeEventListener(type, listener) {\n this._getEventListenersByType(type).delete(listener);\n }\n /**\n * @param {Object} event\n * @private\n */\n dispatchEvent(event) {\n event.target = this;\n const listeners = this._getEventListenersByType(event.type);\n for (const listener of listeners) {\n listener(event);\n }\n }\n /**\n * Returns a Set of listeners associated with the passed event type.\n * If no handlers have been registered, an empty Set is returned.\n *\n * @param {string} type The event type.\n * @return {Set<ListenerCallback>} An array of handler functions.\n * @private\n */\n _getEventListenersByType(type) {\n if (!this._eventListenerRegistry.has(type)) {\n this._eventListenerRegistry.set(type, new Set());\n }\n return this._eventListenerRegistry.get(type);\n }\n}\n"],"names":["self","_","e","messageSW","sw","data","Promise","resolve","messageChannel","MessageChannel","port1","onmessage","event","postMessage","port2","Deferred","promise","reject","_this","urlsMatch","url1","url2","href","location","URL","WorkboxEvent","type","props","Object","assign","this","_await","value","then","direct","_empty","Workbox","scriptURL","registerOptions","f","_registerOptions","_updateFoundCount","_swDeferred","_activeDeferred","_controllingDeferred","_registrationTime","_ownSWs","Set","_onUpdateFound","registration","_registration","installingSW","installing","_scriptURL","performance","now","_externalSW","removeEventListener","_sw","add","addEventListener","_onStateChange","originalEvent","target","state","isExternal","eventPrefix","eventProps","_isUpdate","isUpdate","dispatchEvent","_waitingTimeout","setTimeout","waiting","clearTimeout","_onControllerChange","navigator","serviceWorker","controller","_onMessage","source","getSW","has","args","i","arguments","length","apply","register","immediate","body","result","document","readyState","res","window","Boolean","_compatibleControllingSW","_this3","_getControllingSWIfCompatible","_registerScript","once","waitingSW","wasWaitingBeforeRegister","update","undefined","recover","_this11","reg","error","_eventListenerRegistry","Map","listener","_getEventListenersByType","delete","set","get"],"mappings":"AAEA,IACIA,KAAK,yBAA2BC,IAEpC,MAAOC,ICiBP,SAASC,EAAUC,EAAIC,UACZ,IAAIC,SAA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f,UAAUC,cAAcW,SAASmB,EAAKtD,EAAYsD,EAAKnE,aAAnEoE,YAID/D,EAAoBS,YAAYC,MAC9BqD,iBAEJC,SAKGA,qFA1FH/E,KAAKa,EAAgB3B,mDAerBc,KAAKc,EAAqB5B,wEEtX5B8F,EAAyB,IAAIC,+BAOtCnD,iBAAA,SAAiBlC,EAAMsF,GACPlF,KAAKmF,EAAyBvF,GACtCiC,IAAIqD,MAOZvD,oBAAA,SAAoB/B,EAAMsF,QACjBC,EAAyBvF,GAAMwF,OAAOF,MAM/C1C,cAAA,SAAc1D,GACVA,EAAMmD,OAASjC,WACGA,KAAKmF,EAAyBrG,EAAMc,8DACpB,uFACrBd,OAWjBqG,EAAA,SAAyBvF,UAChBI,KAAKgF,EAAuB5B,IAAIxD,SAC5BoF,EAAuBK,IAAIzF,EAAM,IAAIqB,KAEvCjB,KAAKgF,EAAuBM,IAAI1F,UFsCxC,WAAuBM,EAAOE,OAC/BA,SACGF,GAASA,EAAMC,KAAOD,EAAMC,QAAe3B,QAAQC"}
@@ -0,0 +1,2 @@
1
+ try{self["workbox:window:5.1.3"]&&_()}catch(t){}function t(t,s){return new Promise(i=>{const e=new MessageChannel;e.port1.onmessage=t=>{i(t.data)},t.postMessage(s,[e.port2])})}try{self["workbox:core:5.1.3"]&&_()}catch(t){}class s{constructor(){this.promise=new Promise((t,s)=>{this.resolve=t,this.reject=s})}}function i(t,s){const{href:i}=location;return new URL(t,i).href===new URL(s,i).href}class e{constructor(t,s){this.type=t,Object.assign(this,s)}}class h extends class{constructor(){this.t=new Map}addEventListener(t,s){this.s(t).add(s)}removeEventListener(t,s){this.s(t).delete(s)}dispatchEvent(t){t.target=this;const s=this.s(t.type);for(const i of s)i(t)}s(t){return this.t.has(t)||this.t.set(t,new Set),this.t.get(t)}}{constructor(t,h={}){super(),this.i={},this.h=0,this.o=new s,this.g=new s,this.l=new s,this.u=0,this.v=new Set,this.m=()=>{const t=this.p,s=t.installing;this.h>0||!i(s.scriptURL,this.S)||performance.now()>this.u+6e4?(this.L=s,t.removeEventListener("updatefound",this.m)):(this._=s,this.v.add(s),this.o.resolve(s)),++this.h,s.addEventListener("statechange",this.P)},this.P=t=>{const s=this.p,i=t.target,{state:h}=i,n=i===this.L,a=n?"external":"",r={sw:i,originalEvent:t};!n&&this.W&&(r.isUpdate=!0),this.dispatchEvent(new e(a+h,r)),"installed"===h?this.B=self.setTimeout(()=>{"installed"===h&&s.waiting===i&&this.dispatchEvent(new e(a+"waiting",r))},200):"activating"===h&&(clearTimeout(this.B),n||this.g.resolve(i))},this.C=t=>{const s=this._;s===navigator.serviceWorker.controller&&(this.dispatchEvent(new e("controlling",{sw:s,originalEvent:t,isUpdate:this.W})),this.l.resolve(s))},this.R=async t=>{const{data:s,source:i}=t;await this.getSW(),this.v.has(i)&&this.dispatchEvent(new e("message",{data:s,sw:i,originalEvent:t}))},this.S=t,this.i=h,navigator.serviceWorker.addEventListener("message",this.R)}async register({immediate:t=!1}={}){t||"complete"===document.readyState||await new Promise(t=>window.addEventListener("load",t)),this.W=Boolean(navigator.serviceWorker.controller),this.U=this.M(),this.p=await this.T(),this.U&&(this._=this.U,this.g.resolve(this.U),this.l.resolve(this.U),this.U.addEventListener("statechange",this.P,{once:!0}));const s=this.p.waiting;return s&&i(s.scriptURL,this.S)&&(this._=s,Promise.resolve().then(()=>{this.dispatchEvent(new e("waiting",{sw:s,wasWaitingBeforeRegister:!0}))}).then(()=>{})),this._&&(this.o.resolve(this._),this.v.add(this._)),this.p.addEventListener("updatefound",this.m),navigator.serviceWorker.addEventListener("controllerchange",this.C,{once:!0}),this.p}async update(){this.p&&await this.p.update()}get active(){return this.g.promise}get controlling(){return this.l.promise}async getSW(){return void 0!==this._?this._:this.o.promise}async messageSW(s){return t(await this.getSW(),s)}M(){const t=navigator.serviceWorker.controller;return t&&i(t.scriptURL,this.S)?t:void 0}async T(){try{const t=await navigator.serviceWorker.register(this.S,this.i);return this.u=performance.now(),t}catch(t){throw t}}}export{h as Workbox,t as messageSW};
2
+ //# sourceMappingURL=workbox-window.prod.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workbox-window.prod.mjs","sources":["../_version.js","../messageSW.js","../../workbox-core/_version.js","../../workbox-core/_private/Deferred.js","../utils/urlsMatch.js","../utils/WorkboxEvent.js","../Workbox.js","../utils/WorkboxEventTarget.js","../../workbox-core/_private/dontWaitFor.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:window:5.1.3'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport './_version.js';\n/**\n * Sends a data object to a service worker via `postMessage` and resolves with\n * a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will not\n * resolve.\n *\n * @param {ServiceWorker} sw The service worker to send the message to.\n * @param {Object} data An object to send to the service worker.\n * @return {Promise<Object|undefined>}\n * @memberof module:workbox-window\n */\nfunction messageSW(sw, data) {\n return new Promise((resolve) => {\n const messageChannel = new MessageChannel();\n messageChannel.port1.onmessage = (event) => {\n resolve(event.data);\n };\n sw.postMessage(data, [messageChannel.port2]);\n });\n}\nexport { messageSW };\n","\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:core:5.1.3'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * The Deferred class composes Promises in a way that allows for them to be\n * resolved or rejected from outside the constructor. In most cases promises\n * should be used directly, but Deferreds can be necessary when the logic to\n * resolve a promise must be separate.\n *\n * @private\n */\nclass Deferred {\n /**\n * Creates a promise and exposes its resolve and reject functions as methods.\n */\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n }\n}\nexport { Deferred };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * Returns true if two URLs have the same `.href` property. The URLS can be\n * relative, and if they are the current location href is used to resolve URLs.\n *\n * @private\n * @param {string} url1\n * @param {string} url2\n * @return {boolean}\n */\nexport function urlsMatch(url1, url2) {\n const { href } = location;\n return new URL(url1, href).href === new URL(url2, href).href;\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A minimal `Event` subclass shim.\n * This doesn't *actually* subclass `Event` because not all browsers support\n * constructable `EventTarget`, and using a real `Event` will error.\n * @private\n */\nexport class WorkboxEvent {\n constructor(type, props) {\n this.type = type;\n Object.assign(this, props);\n }\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { Deferred } from 'workbox-core/_private/Deferred.js';\nimport { dontWaitFor } from 'workbox-core/_private/dontWaitFor.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { messageSW } from './messageSW.js';\nimport { WorkboxEventTarget } from './utils/WorkboxEventTarget.js';\nimport { urlsMatch } from './utils/urlsMatch.js';\nimport { WorkboxEvent } from './utils/WorkboxEvent.js';\nimport './_version.js';\n// The time a SW must be in the waiting phase before we can conclude\n// `skipWaiting()` wasn't called. This 200 amount wasn't scientifically\n// chosen, but it seems to avoid false positives in my testing.\nconst WAITING_TIMEOUT_DURATION = 200;\n// The amount of time after a registration that we can reasonably conclude\n// that the registration didn't trigger an update.\nconst REGISTRATION_TIMEOUT_DURATION = 60000;\n/**\n * A class to aid in handling service worker registration, updates, and\n * reacting to service worker lifecycle events.\n *\n * @fires [message]{@link module:workbox-window.Workbox#message}\n * @fires [installed]{@link module:workbox-window.Workbox#installed}\n * @fires [waiting]{@link module:workbox-window.Workbox#waiting}\n * @fires [controlling]{@link module:workbox-window.Workbox#controlling}\n * @fires [activated]{@link module:workbox-window.Workbox#activated}\n * @fires [redundant]{@link module:workbox-window.Workbox#redundant}\n * @fires [externalinstalled]{@link module:workbox-window.Workbox#externalinstalled}\n * @fires [externalwaiting]{@link module:workbox-window.Workbox#externalwaiting}\n * @fires [externalactivated]{@link module:workbox-window.Workbox#externalactivated}\n * @memberof module:workbox-window\n */\nclass Workbox extends WorkboxEventTarget {\n /**\n * Creates a new Workbox instance with a script URL and service worker\n * options. The script URL and options are the same as those used when\n * calling `navigator.serviceWorker.register(scriptURL, options)`. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register\n *\n * @param {string} scriptURL The service worker script associated with this\n * instance.\n * @param {Object} [registerOptions] The service worker options associated\n * with this instance.\n */\n constructor(scriptURL, registerOptions = {}) {\n super();\n this._registerOptions = {};\n this._updateFoundCount = 0;\n // Deferreds we can resolve later.\n this._swDeferred = new Deferred();\n this._activeDeferred = new Deferred();\n this._controllingDeferred = new Deferred();\n this._registrationTime = 0;\n this._ownSWs = new Set();\n /**\n * @private\n */\n this._onUpdateFound = () => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const installingSW = registration.installing;\n // If the script URL passed to `navigator.serviceWorker.register()` is\n // different from the current controlling SW's script URL, we know any\n // successful registration calls will trigger an `updatefound` event.\n // But if the registered script URL is the same as the current controlling\n // SW's script URL, we'll only get an `updatefound` event if the file\n // changed since it was last registered. This can be a problem if the user\n // opens up the same page in a different tab, and that page registers\n // a SW that triggers an update. It's a problem because this page has no\n // good way of knowing whether the `updatefound` event came from the SW\n // script it registered or from a registration attempt made by a newer\n // version of the page running in another tab.\n // To minimize the possibility of a false positive, we use the logic here:\n const updateLikelyTriggeredExternally = \n // Since we enforce only calling `register()` once, and since we don't\n // add the `updatefound` event listener until the `register()` call, if\n // `_updateFoundCount` is > 0 then it means this method has already\n // been called, thus this SW must be external\n this._updateFoundCount > 0 ||\n // If the script URL of the installing SW is different from this\n // instance's script URL, we know it's definitely not from our\n // registration.\n !urlsMatch(installingSW.scriptURL, this._scriptURL) ||\n // If all of the above are false, then we use a time-based heuristic:\n // Any `updatefound` event that occurs long after our registration is\n // assumed to be external.\n (performance.now() >\n this._registrationTime + REGISTRATION_TIMEOUT_DURATION) ?\n // If any of the above are not true, we assume the update was\n // triggered by this instance.\n true : false;\n if (updateLikelyTriggeredExternally) {\n this._externalSW = installingSW;\n registration.removeEventListener('updatefound', this._onUpdateFound);\n }\n else {\n // If the update was not triggered externally we know the installing\n // SW is the one we registered, so we set it.\n this._sw = installingSW;\n this._ownSWs.add(installingSW);\n this._swDeferred.resolve(installingSW);\n // The `installing` state isn't something we have a dedicated\n // callback for, but we do log messages for it in development.\n if (process.env.NODE_ENV !== 'production') {\n if (navigator.serviceWorker.controller) {\n logger.log('Updated service worker found. Installing now...');\n }\n else {\n logger.log('Service worker is installing...');\n }\n }\n }\n // Increment the `updatefound` count, so future invocations of this\n // method can be sure they were triggered externally.\n ++this._updateFoundCount;\n // Add a `statechange` listener regardless of whether this update was\n // triggered externally, since we have callbacks for both.\n installingSW.addEventListener('statechange', this._onStateChange);\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onStateChange = (originalEvent) => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const sw = originalEvent.target;\n const { state } = sw;\n const isExternal = sw === this._externalSW;\n const eventPrefix = isExternal ? 'external' : '';\n const eventProps = {\n sw,\n originalEvent\n };\n if (!isExternal && this._isUpdate) {\n eventProps.isUpdate = true;\n }\n this.dispatchEvent(new WorkboxEvent(eventPrefix + state, eventProps));\n if (state === 'installed') {\n // This timeout is used to ignore cases where the service worker calls\n // `skipWaiting()` in the install event, thus moving it directly in the\n // activating state. (Since all service workers *must* go through the\n // waiting phase, the only way to detect `skipWaiting()` called in the\n // install event is to observe that the time spent in the waiting phase\n // is very short.)\n // NOTE: we don't need separate timeouts for the own and external SWs\n // since they can't go through these phases at the same time.\n this._waitingTimeout = self.setTimeout(() => {\n // Ensure the SW is still waiting (it may now be redundant).\n if (state === 'installed' && registration.waiting === sw) {\n this.dispatchEvent(new WorkboxEvent(eventPrefix + 'waiting', eventProps));\n if (process.env.NODE_ENV !== 'production') {\n if (isExternal) {\n logger.warn('An external service worker has installed but is ' +\n 'waiting for this client to close before activating...');\n }\n else {\n logger.warn('The service worker has installed but is waiting ' +\n 'for existing clients to close before activating...');\n }\n }\n }\n }, WAITING_TIMEOUT_DURATION);\n }\n else if (state === 'activating') {\n clearTimeout(this._waitingTimeout);\n if (!isExternal) {\n this._activeDeferred.resolve(sw);\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n switch (state) {\n case 'installed':\n if (isExternal) {\n logger.warn('An external service worker has installed. ' +\n 'You may want to suggest users reload this page.');\n }\n else {\n logger.log('Registered service worker installed.');\n }\n break;\n case 'activated':\n if (isExternal) {\n logger.warn('An external service worker has activated.');\n }\n else {\n logger.log('Registered service worker activated.');\n if (sw !== navigator.serviceWorker.controller) {\n logger.warn('The registered service worker is active but ' +\n 'not yet controlling the page. Reload or run ' +\n '`clients.claim()` in the service worker.');\n }\n }\n break;\n case 'redundant':\n if (sw === this._compatibleControllingSW) {\n logger.log('Previously controlling service worker now redundant!');\n }\n else if (!isExternal) {\n logger.log('Registered service worker now redundant!');\n }\n break;\n }\n }\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onControllerChange = (originalEvent) => {\n const sw = this._sw;\n if (sw === navigator.serviceWorker.controller) {\n this.dispatchEvent(new WorkboxEvent('controlling', {\n sw,\n originalEvent,\n isUpdate: this._isUpdate,\n }));\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Registered service worker now controlling this page.');\n }\n this._controllingDeferred.resolve(sw);\n }\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onMessage = async (originalEvent) => {\n const { data, source } = originalEvent;\n // Wait until there's an \"own\" service worker. This is used to buffer\n // `message` events that may be received prior to calling `register()`.\n await this.getSW();\n // If the service worker that sent the message is in the list of own\n // service workers for this instance, dispatch a `message` event.\n // NOTE: we check for all previously owned service workers rather than\n // just the current one because some messages (e.g. cache updates) use\n // a timeout when sent and may be delayed long enough for a service worker\n // update to be found.\n if (this._ownSWs.has(source)) {\n this.dispatchEvent(new WorkboxEvent('message', {\n data,\n sw: source,\n originalEvent,\n }));\n }\n };\n this._scriptURL = scriptURL;\n this._registerOptions = registerOptions;\n // Add a message listener immediately since messages received during\n // page load are buffered only until the DOMContentLoaded event:\n // https://github.com/GoogleChrome/workbox/issues/2202\n navigator.serviceWorker.addEventListener('message', this._onMessage);\n }\n /**\n * Registers a service worker for this instances script URL and service\n * worker options. By default this method delays registration until after\n * the window has loaded.\n *\n * @param {Object} [options]\n * @param {Function} [options.immediate=false] Setting this to true will\n * register the service worker immediately, even if the window has\n * not loaded (not recommended).\n */\n async register({ immediate = false } = {}) {\n if (process.env.NODE_ENV !== 'production') {\n if (this._registrationTime) {\n logger.error('Cannot re-register a Workbox instance after it has ' +\n 'been registered. Create a new instance instead.');\n return;\n }\n }\n if (!immediate && document.readyState !== 'complete') {\n await new Promise((res) => window.addEventListener('load', res));\n }\n // Set this flag to true if any service worker was controlling the page\n // at registration time.\n this._isUpdate = Boolean(navigator.serviceWorker.controller);\n // Before registering, attempt to determine if a SW is already controlling\n // the page, and if that SW script (and version, if specified) matches this\n // instance's script.\n this._compatibleControllingSW = this._getControllingSWIfCompatible();\n this._registration = await this._registerScript();\n // If we have a compatible controller, store the controller as the \"own\"\n // SW, resolve active/controlling deferreds and add necessary listeners.\n if (this._compatibleControllingSW) {\n this._sw = this._compatibleControllingSW;\n this._activeDeferred.resolve(this._compatibleControllingSW);\n this._controllingDeferred.resolve(this._compatibleControllingSW);\n this._compatibleControllingSW.addEventListener('statechange', this._onStateChange, { once: true });\n }\n // If there's a waiting service worker with a matching URL before the\n // `updatefound` event fires, it likely means that this site is open\n // in another tab, or the user refreshed the page (and thus the previous\n // page wasn't fully unloaded before this page started loading).\n // https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting\n const waitingSW = this._registration.waiting;\n if (waitingSW && urlsMatch(waitingSW.scriptURL, this._scriptURL)) {\n // Store the waiting SW as the \"own\" Sw, even if it means overwriting\n // a compatible controller.\n this._sw = waitingSW;\n // Run this in the next microtask, so any code that adds an event\n // listener after awaiting `register()` will get this event.\n dontWaitFor(Promise.resolve().then(() => {\n this.dispatchEvent(new WorkboxEvent('waiting', {\n sw: waitingSW,\n wasWaitingBeforeRegister: true,\n }));\n if (process.env.NODE_ENV !== 'production') {\n logger.warn('A service worker was already waiting to activate ' +\n 'before this script was registered...');\n }\n }));\n }\n // If an \"own\" SW is already set, resolve the deferred.\n if (this._sw) {\n this._swDeferred.resolve(this._sw);\n this._ownSWs.add(this._sw);\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Successfully registered service worker.', this._scriptURL);\n if (navigator.serviceWorker.controller) {\n if (this._compatibleControllingSW) {\n logger.debug('A service worker with the same script URL ' +\n 'is already controlling this page.');\n }\n else {\n logger.debug('A service worker with a different script URL is ' +\n 'currently controlling the page. The browser is now fetching ' +\n 'the new script now...');\n }\n }\n const currentPageIsOutOfScope = () => {\n const scopeURL = new URL(this._registerOptions.scope || this._scriptURL, document.baseURI);\n const scopeURLBasePath = new URL('./', scopeURL.href).pathname;\n return !location.pathname.startsWith(scopeURLBasePath);\n };\n if (currentPageIsOutOfScope()) {\n logger.warn('The current page is not in scope for the registered ' +\n 'service worker. Was this a mistake?');\n }\n }\n this._registration.addEventListener('updatefound', this._onUpdateFound);\n navigator.serviceWorker.addEventListener('controllerchange', this._onControllerChange, { once: true });\n return this._registration;\n }\n /**\n * Checks for updates of the registered service worker.\n */\n async update() {\n if (!this._registration) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error('Cannot update a Workbox instance without ' +\n 'being registered. Register the Workbox instance first.');\n }\n return;\n }\n // Try to update registration\n await this._registration.update();\n }\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is active. If a service worker was already controlling at registration\n * time then it will resolve to that if the script URLs (and optionally\n * script versions) match, otherwise it will wait until an update is found\n * and activates.\n *\n * @return {Promise<ServiceWorker>}\n */\n get active() {\n return this._activeDeferred.promise;\n }\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is controlling the page. If a service worker was already controlling at\n * registration time then it will resolve to that if the script URLs (and\n * optionally script versions) match, otherwise it will wait until an update\n * is found and starts controlling the page.\n * Note: the first time a service worker is installed it will active but\n * not start controlling the page unless `clients.claim()` is called in the\n * service worker.\n *\n * @return {Promise<ServiceWorker>}\n */\n get controlling() {\n return this._controllingDeferred.promise;\n }\n /**\n * Resolves with a reference to a service worker that matches the script URL\n * of this instance, as soon as it's available.\n *\n * If, at registration time, there's already an active or waiting service\n * worker with a matching script URL, it will be used (with the waiting\n * service worker taking precedence over the active service worker if both\n * match, since the waiting service worker would have been registered more\n * recently).\n * If there's no matching active or waiting service worker at registration\n * time then the promise will not resolve until an update is found and starts\n * installing, at which point the installing service worker is used.\n *\n * @return {Promise<ServiceWorker>}\n */\n async getSW() {\n // If `this._sw` is set, resolve with that as we want `getSW()` to\n // return the correct (new) service worker if an update is found.\n return this._sw !== undefined ? this._sw : this._swDeferred.promise;\n }\n /**\n * Sends the passed data object to the service worker registered by this\n * instance (via [`getSW()`]{@link module:workbox-window.Workbox#getSW}) and resolves\n * with a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will never\n * resolve.\n *\n * @param {Object} data An object to send to the service worker\n * @return {Promise<Object>}\n */\n async messageSW(data) {\n const sw = await this.getSW();\n return messageSW(sw, data);\n }\n /**\n * Checks for a service worker already controlling the page and returns\n * it if its script URL matches.\n *\n * @private\n * @return {ServiceWorker|undefined}\n */\n _getControllingSWIfCompatible() {\n const controller = navigator.serviceWorker.controller;\n if (controller && urlsMatch(controller.scriptURL, this._scriptURL)) {\n return controller;\n }\n else {\n return undefined;\n }\n }\n /**\n * Registers a service worker for this instances script URL and register\n * options and tracks the time registration was complete.\n *\n * @private\n */\n async _registerScript() {\n try {\n const reg = await navigator.serviceWorker.register(this._scriptURL, this._registerOptions);\n // Keep track of when registration happened, so it can be used in the\n // `this._onUpdateFound` heuristic. Also use the presence of this\n // property as a way to see if `.register()` has been called.\n this._registrationTime = performance.now();\n return reg;\n }\n catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error(error);\n }\n // Re-throw the error.\n throw error;\n }\n }\n}\nexport { Workbox };\n// The jsdoc comments below outline the events this instance may dispatch:\n// -----------------------------------------------------------------------\n/**\n * The `message` event is dispatched any time a `postMessage` is received.\n *\n * @event module:workbox-window.Workbox#message\n * @type {WorkboxEvent}\n * @property {*} data The `data` property from the original `message` event.\n * @property {Event} originalEvent The original [`message`]{@link https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent}\n * event.\n * @property {string} type `message`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `installed` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `installed`.\n *\n * Then can happen either the very first time a service worker is installed,\n * or after an update to the current service worker is found. In the case\n * of an update being found, the event's `isUpdate` property will be `true`.\n *\n * @event module:workbox-window.Workbox#installed\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `installed`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `waiting` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `installed` and then doesn't immediately change to `activating`.\n * It may also be dispatched if a service worker with the same\n * [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * was already waiting when the [`register()`]{@link module:workbox-window.Workbox#register}\n * method was called.\n *\n * @event module:workbox-window.Workbox#waiting\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event|undefined} originalEvent The original\n * [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event, or `undefined` in the case where the service worker was waiting\n * to before `.register()` was called.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} wasWaitingBeforeRegister True if a service worker with\n * a matching `scriptURL` was already waiting when this `Workbox`\n * instance called `register()`.\n * @property {string} type `waiting`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `controlling` event is dispatched if a\n * [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * fires on the service worker [container]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer}\n * and the [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * of the new [controller]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller}\n * matches the `scriptURL` of the `Workbox` instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}.\n *\n * @event module:workbox-window.Workbox#controlling\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this service worker was registered.\n * @property {string} type `controlling`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `activated` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `activated`.\n *\n * @event module:workbox-window.Workbox#activated\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `activated`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `redundant` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `redundant`.\n *\n * @event module:workbox-window.Workbox#redundant\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `redundant`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `externalinstalled` event is dispatched if the state of an\n * [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}\n * changes to `installed`.\n *\n * @event module:workbox-window.Workbox#externalinstalled\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {string} type `externalinstalled`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `externalwaiting` event is dispatched if the state of an\n * [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}\n * changes to `waiting`.\n *\n * @event module:workbox-window.Workbox#externalwaiting\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {string} type `externalwaiting`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `externalactivated` event is dispatched if the state of an\n * [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}\n * changes to `activated`.\n *\n * @event module:workbox-window.Workbox#externalactivated\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {string} type `externalactivated`.\n * @property {Workbox} target The `Workbox` instance.\n */\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n/**\n * A minimal `EventTarget` shim.\n * This is necessary because not all browsers support constructable\n * `EventTarget`, so using a real `EventTarget` will error.\n * @private\n */\nexport class WorkboxEventTarget {\n constructor() {\n this._eventListenerRegistry = new Map();\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n addEventListener(type, listener) {\n const foo = this._getEventListenersByType(type);\n foo.add(listener);\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n removeEventListener(type, listener) {\n this._getEventListenersByType(type).delete(listener);\n }\n /**\n * @param {Object} event\n * @private\n */\n dispatchEvent(event) {\n event.target = this;\n const listeners = this._getEventListenersByType(event.type);\n for (const listener of listeners) {\n listener(event);\n }\n }\n /**\n * Returns a Set of listeners associated with the passed event type.\n * If no handlers have been registered, an empty Set is returned.\n *\n * @param {string} type The event type.\n * @return {Set<ListenerCallback>} An array of handler functions.\n * @private\n */\n _getEventListenersByType(type) {\n if (!this._eventListenerRegistry.has(type)) {\n this._eventListenerRegistry.set(type, new Set());\n }\n return this._eventListenerRegistry.get(type);\n }\n}\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A helper function that prevents a promise from being flagged as unused.\n *\n * @private\n **/\nexport function dontWaitFor(promise) {\n // Effective no-op.\n promise.then(() => { });\n}\n"],"names":["self","_","e","messageSW","sw","data","Promise","resolve","messageChannel","MessageChannel","port1","onmessage","event","postMessage","port2","Deferred","constructor","promise","reject","urlsMatch","url1","url2","href","location","URL","WorkboxEvent","type","props","Object","assign","this","Workbox","_eventListenerRegistry","Map","addEventListener","listener","_getEventListenersByType","add","removeEventListener","delete","dispatchEvent","target","listeners","has","set","Set","get","scriptURL","registerOptions","_registerOptions","_updateFoundCount","_swDeferred","_activeDeferred","_controllingDeferred","_registrationTime","_ownSWs","_onUpdateFound","registration","_registration","installingSW","installing","_scriptURL","performance","now","_externalSW","_sw","_onStateChange","originalEvent","state","isExternal","eventPrefix","eventProps","_isUpdate","isUpdate","_waitingTimeout","setTimeout","waiting","clearTimeout","_onControllerChange","navigator","serviceWorker","controller","_onMessage","async","source","getSW","immediate","document","readyState","res","window","Boolean","_compatibleControllingSW","_getControllingSWIfCompatible","_registerScript","once","waitingSW","then","wasWaitingBeforeRegister","update","undefined","reg","register","error"],"mappings":"AAEA,IACIA,KAAK,yBAA2BC,IAEpC,MAAOC,ICiBP,SAASC,EAAUC,EAAIC,UACZ,IAAIC,QAASC,UACVC,EAAiB,IAAIC,eAC3BD,EAAeE,MAAMC,UAAaC,IAC9BL,EAAQK,EAAMP,OAElBD,EAAGS,YAAYR,EAAM,CAACG,EAAeM,UC1B7C,IACId,KAAK,uBAAyBC,IAElC,MAAOC,ICWP,MAAMa,EAIFC,mBACSC,QAAU,IAAIX,QAAQ,CAACC,EAASW,UAC5BX,QAAUA,O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,EAAckB,eACjCoB,GAAa7E,EAAU6E,EAAUjD,UAAWjB,KAAK+B,UAG5CI,EAAM+B,EAGC1F,QAAQC,UAAU0F,KAAK,UAC1BzD,cAAc,IAAIf,EAAa,UAAW,CAC3CrB,GAAI4F,EACJE,0BAA0B,OExSlCD,KAAK,SFiTLnE,KAAKmC,SACAd,EAAY5C,QAAQuB,KAAKmC,QACzBV,EAAQlB,IAAIP,KAAKmC,SAyBrBP,EAAcxB,iBAAiB,cAAeJ,KAAK0B,GACxDuB,UAAUC,cAAc9C,iBAAiB,mBAAoBJ,KAAKgD,EAAqB,CAAEiB,MAAM,IACxFjE,KAAK4B,iBAMP5B,KAAK4B,SAQJ5B,KAAK4B,EAAcyC,6BAYlBrE,KAAKsB,EAAgBnC,iCAerBa,KAAKuB,EAAqBpC,kCAoBbmF,IAAbtE,KAAKmC,EAAoBnC,KAAKmC,EAAMnC,KAAKqB,EAAYlC,wBAehDZ,UAELF,QADU2B,KAAKuD,QACDhF,GASzBwF,UACUZ,EAAaF,UAAUC,cAAcC,kBACvCA,GAAc9D,EAAU8D,EAAWlC,UAAWjB,KAAK+B,GAC5CoB,6BAcDoB,QAAYtB,UAAUC,cAAcsB,SAASxE,KAAK+B,EAAY/B,KAAKmB,eAIpEK,EAAoBQ,YAAYC,MAC9BsC,EAEX,MAAOE,SAKGA"}
@@ -0,0 +1,2 @@
1
+ !function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n=n||self).workbox={})}(this,(function(n){"use strict";try{self["workbox:window:5.1.3"]&&_()}catch(n){}function t(n,t){return new Promise((function(r){var e=new MessageChannel;e.port1.onmessage=function(n){r(n.data)},n.postMessage(t,[e.port2])}))}function r(n,t){for(var r=0;r<t.length;r++){var e=t[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,e.key,e)}}try{self["workbox:core:5.1.3"]&&_()}catch(n){}var e=function(){var n=this;this.promise=new Promise((function(t,r){n.resolve=t,n.reject=r}))};function i(n,t){var r=location.href;return new URL(n,r).href===new URL(t,r).href}var o=function(n,t){this.type=n,Object.assign(this,t)};function u(n,t,r){return r?t?t(n):n:(n&&n.then||(n=Promise.resolve(n)),t?n.then(t):n)}function c(){}var a=function(n){var c,a;function s(t,r){var c,a;return void 0===r&&(r={}),(c=n.call(this)||this).t={},c.i=0,c.o=new e,c.u=new e,c.s=new e,c.v=0,c.h=new Set,c.l=function(){var n=c.g,t=n.installing;c.i>0||!i(t.scriptURL,c.m)||performance.now()>c.v+6e4?(c.p=t,n.removeEventListener("updatefound",c.l)):(c.P=t,c.h.add(t),c.o.resolve(t)),++c.i,t.addEventListener("statechange",c.j)},c.j=function(n){var t=c.g,r=n.target,e=r.state,i=r===c.p,u=i?"external":"",a={sw:r,originalEvent:n};!i&&c.k&&(a.isUpdate=!0),c.dispatchEvent(new o(u+e,a)),"installed"===e?c.O=self.setTimeout((function(){"installed"===e&&t.waiting===r&&c.dispatchEvent(new o(u+"waiting",a))}),200):"activating"===e&&(clearTimeout(c.O),i||c.u.resolve(r))},c._=function(n){var t=c.P;t===navigator.serviceWorker.controller&&(c.dispatchEvent(new o("controlling",{sw:t,originalEvent:n,isUpdate:c.k})),c.s.resolve(t))},c.M=(a=function(n){var t=n.data,r=n.source;return u(c.getSW(),(function(){c.h.has(r)&&c.dispatchEvent(new o("message",{data:t,sw:r,originalEvent:n}))}))},function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];try{return Promise.resolve(a.apply(this,n))}catch(n){return Promise.reject(n)}}),c.m=t,c.t=r,navigator.serviceWorker.addEventListener("message",c.M),c}a=n,(c=s).prototype=Object.create(a.prototype),c.prototype.constructor=c,c.__proto__=a;var v,h,l,w=s.prototype;return w.register=function(n){var t=(void 0===n?{}:n).immediate,r=void 0!==t&&t;try{var e=this;return function(n,t){var r=n();if(r&&r.then)return r.then(t);return t(r)}((function(){if(!r&&"complete"!==document.readyState)return f(new Promise((function(n){return window.addEventListener("load",n)})))}),(function(){return e.k=Boolean(navigator.serviceWorker.controller),e.R=e.S(),u(e.U(),(function(n){e.g=n,e.R&&(e.P=e.R,e.u.resolve(e.R),e.s.resolve(e.R),e.R.addEventListener("statechange",e.j,{once:!0}));var t=e.g.waiting;return t&&i(t.scriptURL,e.m)&&(e.P=t,Promise.resolve().then((function(){e.dispatchEvent(new o("waiting",{sw:t,wasWaitingBeforeRegister:!0}))})).then((function(){}))),e.P&&(e.o.resolve(e.P),e.h.add(e.P)),e.g.addEventListener("updatefound",e.l),navigator.serviceWorker.addEventListener("controllerchange",e._,{once:!0}),e.g}))}))}catch(n){return Promise.reject(n)}},w.update=function(){try{return this.g?f(this.g.update()):void 0}catch(n){return Promise.reject(n)}},w.getSW=function(){try{return void 0!==this.P?this.P:this.o.promise}catch(n){return Promise.reject(n)}},w.messageSW=function(n){try{return u(this.getSW(),(function(r){return t(r,n)}))}catch(n){return Promise.reject(n)}},w.S=function(){var n=navigator.serviceWorker.controller;return n&&i(n.scriptURL,this.m)?n:void 0},w.U=function(){try{var n=this;return function(n,t){try{var r=n()}catch(n){return t(n)}if(r&&r.then)return r.then(void 0,t);return r}((function(){return u(navigator.serviceWorker.register(n.m,n.t),(function(t){return n.v=performance.now(),t}))}),(function(n){throw n}))}catch(n){return Promise.reject(n)}},v=s,(h=[{key:"active",get:function(){return this.u.promise}},{key:"controlling",get:function(){return this.s.promise}}])&&r(v.prototype,h),l&&r(v,l),s}(function(){function n(){this.B=new Map}var t=n.prototype;return t.addEventListener=function(n,t){this.L(n).add(t)},t.removeEventListener=function(n,t){this.L(n).delete(t)},t.dispatchEvent=function(n){n.target=this;var t=this.L(n.type),r=Array.isArray(t),e=0;for(t=r?t:t[Symbol.iterator]();;){var i;if(r){if(e>=t.length)break;i=t[e++]}else{if((e=t.next()).done)break;i=e.value}i(n)}},t.L=function(n){return this.B.has(n)||this.B.set(n,new Set),this.B.get(n)},n}());function f(n,t){if(!t)return n&&n.then?n.then(c):Promise.resolve()}n.Workbox=a,n.messageSW=t,Object.defineProperty(n,"__esModule",{value:!0})}));
2
+ //# sourceMappingURL=workbox-window.prod.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workbox-window.prod.umd.js","sources":["../_version.js","../messageSW.js","../../workbox-core/_version.js","../../workbox-core/_private/Deferred.js","../utils/urlsMatch.js","../utils/WorkboxEvent.js","../Workbox.js","../../workbox-core/_private/dontWaitFor.js","../utils/WorkboxEventTarget.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:window:5.1.3'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport './_version.js';\n/**\n * Sends a data object to a service worker via `postMessage` and resolves with\n * a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will not\n * resolve.\n *\n * @param {ServiceWorker} sw The service worker to send the message to.\n * @param {Object} data An object to send to the service worker.\n * @return {Promise<Object|undefined>}\n * @memberof module:workbox-window\n */\nfunction messageSW(sw, data) {\n return new Promise((resolve) => {\n const messageChannel = new MessageChannel();\n messageChannel.port1.onmessage = (event) => {\n resolve(event.data);\n };\n sw.postMessage(data, [messageChannel.port2]);\n });\n}\nexport { messageSW };\n","\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:core:5.1.3'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * The Deferred class composes Promises in a way that allows for them to be\n * resolved or rejected from outside the constructor. In most cases promises\n * should be used directly, but Deferreds can be necessary when the logic to\n * resolve a promise must be separate.\n *\n * @private\n */\nclass Deferred {\n /**\n * Creates a promise and exposes its resolve and reject functions as methods.\n */\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n }\n}\nexport { Deferred };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * Returns true if two URLs have the same `.href` property. The URLS can be\n * relative, and if they are the current location href is used to resolve URLs.\n *\n * @private\n * @param {string} url1\n * @param {string} url2\n * @return {boolean}\n */\nexport function urlsMatch(url1, url2) {\n const { href } = location;\n return new URL(url1, href).href === new URL(url2, href).href;\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A minimal `Event` subclass shim.\n * This doesn't *actually* subclass `Event` because not all browsers support\n * constructable `EventTarget`, and using a real `Event` will error.\n * @private\n */\nexport class WorkboxEvent {\n constructor(type, props) {\n this.type = type;\n Object.assign(this, props);\n }\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { Deferred } from 'workbox-core/_private/Deferred.js';\nimport { dontWaitFor } from 'workbox-core/_private/dontWaitFor.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { messageSW } from './messageSW.js';\nimport { WorkboxEventTarget } from './utils/WorkboxEventTarget.js';\nimport { urlsMatch } from './utils/urlsMatch.js';\nimport { WorkboxEvent } from './utils/WorkboxEvent.js';\nimport './_version.js';\n// The time a SW must be in the waiting phase before we can conclude\n// `skipWaiting()` wasn't called. This 200 amount wasn't scientifically\n// chosen, but it seems to avoid false positives in my testing.\nconst WAITING_TIMEOUT_DURATION = 200;\n// The amount of time after a registration that we can reasonably conclude\n// that the registration didn't trigger an update.\nconst REGISTRATION_TIMEOUT_DURATION = 60000;\n/**\n * A class to aid in handling service worker registration, updates, and\n * reacting to service worker lifecycle events.\n *\n * @fires [message]{@link module:workbox-window.Workbox#message}\n * @fires [installed]{@link module:workbox-window.Workbox#installed}\n * @fires [waiting]{@link module:workbox-window.Workbox#waiting}\n * @fires [controlling]{@link module:workbox-window.Workbox#controlling}\n * @fires [activated]{@link module:workbox-window.Workbox#activated}\n * @fires [redundant]{@link module:workbox-window.Workbox#redundant}\n * @fires [externalinstalled]{@link module:workbox-window.Workbox#externalinstalled}\n * @fires [externalwaiting]{@link module:workbox-window.Workbox#externalwaiting}\n * @fires [externalactivated]{@link module:workbox-window.Workbox#externalactivated}\n * @memberof module:workbox-window\n */\nclass Workbox extends WorkboxEventTarget {\n /**\n * Creates a new Workbox instance with a script URL and service worker\n * options. The script URL and options are the same as those used when\n * calling `navigator.serviceWorker.register(scriptURL, options)`. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register\n *\n * @param {string} scriptURL The service worker script associated with this\n * instance.\n * @param {Object} [registerOptions] The service worker options associated\n * with this instance.\n */\n constructor(scriptURL, registerOptions = {}) {\n super();\n this._registerOptions = {};\n this._updateFoundCount = 0;\n // Deferreds we can resolve later.\n this._swDeferred = new Deferred();\n this._activeDeferred = new Deferred();\n this._controllingDeferred = new Deferred();\n this._registrationTime = 0;\n this._ownSWs = new Set();\n /**\n * @private\n */\n this._onUpdateFound = () => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const installingSW = registration.installing;\n // If the script URL passed to `navigator.serviceWorker.register()` is\n // different from the current controlling SW's script URL, we know any\n // successful registration calls will trigger an `updatefound` event.\n // But if the registered script URL is the same as the current controlling\n // SW's script URL, we'll only get an `updatefound` event if the file\n // changed since it was last registered. This can be a problem if the user\n // opens up the same page in a different tab, and that page registers\n // a SW that triggers an update. It's a problem because this page has no\n // good way of knowing whether the `updatefound` event came from the SW\n // script it registered or from a registration attempt made by a newer\n // version of the page running in another tab.\n // To minimize the possibility of a false positive, we use the logic here:\n const updateLikelyTriggeredExternally = \n // Since we enforce only calling `register()` once, and since we don't\n // add the `updatefound` event listener until the `register()` call, if\n // `_updateFoundCount` is > 0 then it means this method has already\n // been called, thus this SW must be external\n this._updateFoundCount > 0 ||\n // If the script URL of the installing SW is different from this\n // instance's script URL, we know it's definitely not from our\n // registration.\n !urlsMatch(installingSW.scriptURL, this._scriptURL) ||\n // If all of the above are false, then we use a time-based heuristic:\n // Any `updatefound` event that occurs long after our registration is\n // assumed to be external.\n (performance.now() >\n this._registrationTime + REGISTRATION_TIMEOUT_DURATION) ?\n // If any of the above are not true, we assume the update was\n // triggered by this instance.\n true : false;\n if (updateLikelyTriggeredExternally) {\n this._externalSW = installingSW;\n registration.removeEventListener('updatefound', this._onUpdateFound);\n }\n else {\n // If the update was not triggered externally we know the installing\n // SW is the one we registered, so we set it.\n this._sw = installingSW;\n this._ownSWs.add(installingSW);\n this._swDeferred.resolve(installingSW);\n // The `installing` state isn't something we have a dedicated\n // callback for, but we do log messages for it in development.\n if (process.env.NODE_ENV !== 'production') {\n if (navigator.serviceWorker.controller) {\n logger.log('Updated service worker found. Installing now...');\n }\n else {\n logger.log('Service worker is installing...');\n }\n }\n }\n // Increment the `updatefound` count, so future invocations of this\n // method can be sure they were triggered externally.\n ++this._updateFoundCount;\n // Add a `statechange` listener regardless of whether this update was\n // triggered externally, since we have callbacks for both.\n installingSW.addEventListener('statechange', this._onStateChange);\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onStateChange = (originalEvent) => {\n // `this._registration` will never be `undefined` after an update is found.\n const registration = this._registration;\n const sw = originalEvent.target;\n const { state } = sw;\n const isExternal = sw === this._externalSW;\n const eventPrefix = isExternal ? 'external' : '';\n const eventProps = {\n sw,\n originalEvent\n };\n if (!isExternal && this._isUpdate) {\n eventProps.isUpdate = true;\n }\n this.dispatchEvent(new WorkboxEvent(eventPrefix + state, eventProps));\n if (state === 'installed') {\n // This timeout is used to ignore cases where the service worker calls\n // `skipWaiting()` in the install event, thus moving it directly in the\n // activating state. (Since all service workers *must* go through the\n // waiting phase, the only way to detect `skipWaiting()` called in the\n // install event is to observe that the time spent in the waiting phase\n // is very short.)\n // NOTE: we don't need separate timeouts for the own and external SWs\n // since they can't go through these phases at the same time.\n this._waitingTimeout = self.setTimeout(() => {\n // Ensure the SW is still waiting (it may now be redundant).\n if (state === 'installed' && registration.waiting === sw) {\n this.dispatchEvent(new WorkboxEvent(eventPrefix + 'waiting', eventProps));\n if (process.env.NODE_ENV !== 'production') {\n if (isExternal) {\n logger.warn('An external service worker has installed but is ' +\n 'waiting for this client to close before activating...');\n }\n else {\n logger.warn('The service worker has installed but is waiting ' +\n 'for existing clients to close before activating...');\n }\n }\n }\n }, WAITING_TIMEOUT_DURATION);\n }\n else if (state === 'activating') {\n clearTimeout(this._waitingTimeout);\n if (!isExternal) {\n this._activeDeferred.resolve(sw);\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n switch (state) {\n case 'installed':\n if (isExternal) {\n logger.warn('An external service worker has installed. ' +\n 'You may want to suggest users reload this page.');\n }\n else {\n logger.log('Registered service worker installed.');\n }\n break;\n case 'activated':\n if (isExternal) {\n logger.warn('An external service worker has activated.');\n }\n else {\n logger.log('Registered service worker activated.');\n if (sw !== navigator.serviceWorker.controller) {\n logger.warn('The registered service worker is active but ' +\n 'not yet controlling the page. Reload or run ' +\n '`clients.claim()` in the service worker.');\n }\n }\n break;\n case 'redundant':\n if (sw === this._compatibleControllingSW) {\n logger.log('Previously controlling service worker now redundant!');\n }\n else if (!isExternal) {\n logger.log('Registered service worker now redundant!');\n }\n break;\n }\n }\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onControllerChange = (originalEvent) => {\n const sw = this._sw;\n if (sw === navigator.serviceWorker.controller) {\n this.dispatchEvent(new WorkboxEvent('controlling', {\n sw,\n originalEvent,\n isUpdate: this._isUpdate,\n }));\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Registered service worker now controlling this page.');\n }\n this._controllingDeferred.resolve(sw);\n }\n };\n /**\n * @private\n * @param {Event} originalEvent\n */\n this._onMessage = async (originalEvent) => {\n const { data, source } = originalEvent;\n // Wait until there's an \"own\" service worker. This is used to buffer\n // `message` events that may be received prior to calling `register()`.\n await this.getSW();\n // If the service worker that sent the message is in the list of own\n // service workers for this instance, dispatch a `message` event.\n // NOTE: we check for all previously owned service workers rather than\n // just the current one because some messages (e.g. cache updates) use\n // a timeout when sent and may be delayed long enough for a service worker\n // update to be found.\n if (this._ownSWs.has(source)) {\n this.dispatchEvent(new WorkboxEvent('message', {\n data,\n sw: source,\n originalEvent,\n }));\n }\n };\n this._scriptURL = scriptURL;\n this._registerOptions = registerOptions;\n // Add a message listener immediately since messages received during\n // page load are buffered only until the DOMContentLoaded event:\n // https://github.com/GoogleChrome/workbox/issues/2202\n navigator.serviceWorker.addEventListener('message', this._onMessage);\n }\n /**\n * Registers a service worker for this instances script URL and service\n * worker options. By default this method delays registration until after\n * the window has loaded.\n *\n * @param {Object} [options]\n * @param {Function} [options.immediate=false] Setting this to true will\n * register the service worker immediately, even if the window has\n * not loaded (not recommended).\n */\n async register({ immediate = false } = {}) {\n if (process.env.NODE_ENV !== 'production') {\n if (this._registrationTime) {\n logger.error('Cannot re-register a Workbox instance after it has ' +\n 'been registered. Create a new instance instead.');\n return;\n }\n }\n if (!immediate && document.readyState !== 'complete') {\n await new Promise((res) => window.addEventListener('load', res));\n }\n // Set this flag to true if any service worker was controlling the page\n // at registration time.\n this._isUpdate = Boolean(navigator.serviceWorker.controller);\n // Before registering, attempt to determine if a SW is already controlling\n // the page, and if that SW script (and version, if specified) matches this\n // instance's script.\n this._compatibleControllingSW = this._getControllingSWIfCompatible();\n this._registration = await this._registerScript();\n // If we have a compatible controller, store the controller as the \"own\"\n // SW, resolve active/controlling deferreds and add necessary listeners.\n if (this._compatibleControllingSW) {\n this._sw = this._compatibleControllingSW;\n this._activeDeferred.resolve(this._compatibleControllingSW);\n this._controllingDeferred.resolve(this._compatibleControllingSW);\n this._compatibleControllingSW.addEventListener('statechange', this._onStateChange, { once: true });\n }\n // If there's a waiting service worker with a matching URL before the\n // `updatefound` event fires, it likely means that this site is open\n // in another tab, or the user refreshed the page (and thus the previous\n // page wasn't fully unloaded before this page started loading).\n // https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting\n const waitingSW = this._registration.waiting;\n if (waitingSW && urlsMatch(waitingSW.scriptURL, this._scriptURL)) {\n // Store the waiting SW as the \"own\" Sw, even if it means overwriting\n // a compatible controller.\n this._sw = waitingSW;\n // Run this in the next microtask, so any code that adds an event\n // listener after awaiting `register()` will get this event.\n dontWaitFor(Promise.resolve().then(() => {\n this.dispatchEvent(new WorkboxEvent('waiting', {\n sw: waitingSW,\n wasWaitingBeforeRegister: true,\n }));\n if (process.env.NODE_ENV !== 'production') {\n logger.warn('A service worker was already waiting to activate ' +\n 'before this script was registered...');\n }\n }));\n }\n // If an \"own\" SW is already set, resolve the deferred.\n if (this._sw) {\n this._swDeferred.resolve(this._sw);\n this._ownSWs.add(this._sw);\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Successfully registered service worker.', this._scriptURL);\n if (navigator.serviceWorker.controller) {\n if (this._compatibleControllingSW) {\n logger.debug('A service worker with the same script URL ' +\n 'is already controlling this page.');\n }\n else {\n logger.debug('A service worker with a different script URL is ' +\n 'currently controlling the page. The browser is now fetching ' +\n 'the new script now...');\n }\n }\n const currentPageIsOutOfScope = () => {\n const scopeURL = new URL(this._registerOptions.scope || this._scriptURL, document.baseURI);\n const scopeURLBasePath = new URL('./', scopeURL.href).pathname;\n return !location.pathname.startsWith(scopeURLBasePath);\n };\n if (currentPageIsOutOfScope()) {\n logger.warn('The current page is not in scope for the registered ' +\n 'service worker. Was this a mistake?');\n }\n }\n this._registration.addEventListener('updatefound', this._onUpdateFound);\n navigator.serviceWorker.addEventListener('controllerchange', this._onControllerChange, { once: true });\n return this._registration;\n }\n /**\n * Checks for updates of the registered service worker.\n */\n async update() {\n if (!this._registration) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error('Cannot update a Workbox instance without ' +\n 'being registered. Register the Workbox instance first.');\n }\n return;\n }\n // Try to update registration\n await this._registration.update();\n }\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is active. If a service worker was already controlling at registration\n * time then it will resolve to that if the script URLs (and optionally\n * script versions) match, otherwise it will wait until an update is found\n * and activates.\n *\n * @return {Promise<ServiceWorker>}\n */\n get active() {\n return this._activeDeferred.promise;\n }\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is controlling the page. If a service worker was already controlling at\n * registration time then it will resolve to that if the script URLs (and\n * optionally script versions) match, otherwise it will wait until an update\n * is found and starts controlling the page.\n * Note: the first time a service worker is installed it will active but\n * not start controlling the page unless `clients.claim()` is called in the\n * service worker.\n *\n * @return {Promise<ServiceWorker>}\n */\n get controlling() {\n return this._controllingDeferred.promise;\n }\n /**\n * Resolves with a reference to a service worker that matches the script URL\n * of this instance, as soon as it's available.\n *\n * If, at registration time, there's already an active or waiting service\n * worker with a matching script URL, it will be used (with the waiting\n * service worker taking precedence over the active service worker if both\n * match, since the waiting service worker would have been registered more\n * recently).\n * If there's no matching active or waiting service worker at registration\n * time then the promise will not resolve until an update is found and starts\n * installing, at which point the installing service worker is used.\n *\n * @return {Promise<ServiceWorker>}\n */\n async getSW() {\n // If `this._sw` is set, resolve with that as we want `getSW()` to\n // return the correct (new) service worker if an update is found.\n return this._sw !== undefined ? this._sw : this._swDeferred.promise;\n }\n /**\n * Sends the passed data object to the service worker registered by this\n * instance (via [`getSW()`]{@link module:workbox-window.Workbox#getSW}) and resolves\n * with a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will never\n * resolve.\n *\n * @param {Object} data An object to send to the service worker\n * @return {Promise<Object>}\n */\n async messageSW(data) {\n const sw = await this.getSW();\n return messageSW(sw, data);\n }\n /**\n * Checks for a service worker already controlling the page and returns\n * it if its script URL matches.\n *\n * @private\n * @return {ServiceWorker|undefined}\n */\n _getControllingSWIfCompatible() {\n const controller = navigator.serviceWorker.controller;\n if (controller && urlsMatch(controller.scriptURL, this._scriptURL)) {\n return controller;\n }\n else {\n return undefined;\n }\n }\n /**\n * Registers a service worker for this instances script URL and register\n * options and tracks the time registration was complete.\n *\n * @private\n */\n async _registerScript() {\n try {\n const reg = await navigator.serviceWorker.register(this._scriptURL, this._registerOptions);\n // Keep track of when registration happened, so it can be used in the\n // `this._onUpdateFound` heuristic. Also use the presence of this\n // property as a way to see if `.register()` has been called.\n this._registrationTime = performance.now();\n return reg;\n }\n catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error(error);\n }\n // Re-throw the error.\n throw error;\n }\n }\n}\nexport { Workbox };\n// The jsdoc comments below outline the events this instance may dispatch:\n// -----------------------------------------------------------------------\n/**\n * The `message` event is dispatched any time a `postMessage` is received.\n *\n * @event module:workbox-window.Workbox#message\n * @type {WorkboxEvent}\n * @property {*} data The `data` property from the original `message` event.\n * @property {Event} originalEvent The original [`message`]{@link https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent}\n * event.\n * @property {string} type `message`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `installed` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `installed`.\n *\n * Then can happen either the very first time a service worker is installed,\n * or after an update to the current service worker is found. In the case\n * of an update being found, the event's `isUpdate` property will be `true`.\n *\n * @event module:workbox-window.Workbox#installed\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `installed`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `waiting` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `installed` and then doesn't immediately change to `activating`.\n * It may also be dispatched if a service worker with the same\n * [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * was already waiting when the [`register()`]{@link module:workbox-window.Workbox#register}\n * method was called.\n *\n * @event module:workbox-window.Workbox#waiting\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event|undefined} originalEvent The original\n * [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event, or `undefined` in the case where the service worker was waiting\n * to before `.register()` was called.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} wasWaitingBeforeRegister True if a service worker with\n * a matching `scriptURL` was already waiting when this `Workbox`\n * instance called `register()`.\n * @property {string} type `waiting`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `controlling` event is dispatched if a\n * [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * fires on the service worker [container]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer}\n * and the [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * of the new [controller]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller}\n * matches the `scriptURL` of the `Workbox` instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}.\n *\n * @event module:workbox-window.Workbox#controlling\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this service worker was registered.\n * @property {string} type `controlling`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `activated` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `activated`.\n *\n * @event module:workbox-window.Workbox#activated\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `activated`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `redundant` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `redundant`.\n *\n * @event module:workbox-window.Workbox#redundant\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `redundant`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `externalinstalled` event is dispatched if the state of an\n * [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}\n * changes to `installed`.\n *\n * @event module:workbox-window.Workbox#externalinstalled\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {string} type `externalinstalled`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `externalwaiting` event is dispatched if the state of an\n * [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}\n * changes to `waiting`.\n *\n * @event module:workbox-window.Workbox#externalwaiting\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {string} type `externalwaiting`.\n * @property {Workbox} target The `Workbox` instance.\n */\n/**\n * The `externalactivated` event is dispatched if the state of an\n * [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-window#when_an_unexpected_version_of_the_service_worker_is_found}\n * changes to `activated`.\n *\n * @event module:workbox-window.Workbox#externalactivated\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {string} type `externalactivated`.\n * @property {Workbox} target The `Workbox` instance.\n */\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A helper function that prevents a promise from being flagged as unused.\n *\n * @private\n **/\nexport function dontWaitFor(promise) {\n // Effective no-op.\n promise.then(() => { });\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n/**\n * A minimal `EventTarget` shim.\n * This is necessary because not all browsers support constructable\n * `EventTarget`, so using a real `EventTarget` will error.\n * @private\n */\nexport class WorkboxEventTarget {\n constructor() {\n this._eventListenerRegistry = new Map();\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n addEventListener(type, listener) {\n const foo = this._getEventListenersByType(type);\n foo.add(listener);\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n removeEventListener(type, listener) {\n this._getEventListenersByType(type).delete(listener);\n }\n /**\n * @param {Object} event\n * @private\n */\n dispatchEvent(event) {\n event.target = this;\n const listeners = this._getEventListenersByType(event.type);\n for (const listener of listeners) {\n listener(event);\n }\n }\n /**\n * Returns a Set of listeners associated with the passed event type.\n * If no handlers have been registered, an empty Set is returned.\n *\n * @param {string} type The event type.\n * @return {Set<ListenerCallback>} An array of handler functions.\n * @private\n */\n _getEventListenersByType(type) {\n if (!this._eventListenerRegistry.has(type)) {\n this._eventListenerRegistry.set(type, new Set());\n }\n return this._eventListenerRegistry.get(type);\n }\n}\n"],"names":["self","_","e","messageSW","sw","data","Promise","resolve","messageChannel","MessageChannel","port1","onmessage","event","postMessage","port2","Deferred","promise","reject","_this","urlsMatch","url1","url2","href","location","URL","WorkboxEvent","type","props","Object","assign","this","_await","value","then","direct","_empty","Workbox","scriptURL","registerOptions","f","_registerOptions","_updateFoundCount","_swDeferred","_activeDeferred","_controllingDeferred","_registrationTime","_ownSWs","Set","_onUpdateFound","registration","_registration","installingSW","installing","_scriptURL","performance","now","_externalSW","removeEventListener","_sw","add","addEventListener","_onStateChange","originalEvent","target","state","isExternal","eventPrefix","eventProps","_isUpdate","isUpdate","dispatchEvent","_waitingTimeout","setTimeout","waiting","clearTimeout","_onControllerChange","navigator","serviceWorker","controller","_onMessage","source","getSW","has","args","i","arguments","length","apply","register","immediate","body","result","document","readyState","res","window","Boolean","_compatibleControllingSW","_this3","_getControllingSWIfCompatible","_registerScript","once","waitingSW","wasWaitingBeforeRegister","update","undefined","recover","_this11","reg","error","_eventListenerRegistry","Map","listener","_getEventListenersByType","delete","set","get"],"mappings":"qMAEA,IACIA,KAAK,yBAA2BC,IAEpC,MAAOC,ICiBP,SAASC,EAAUC,EAAIC,UACZ,IAAIC,SAAQ,SAACC,OACVC,EAAiB,IAAIC,eAC3BD,EAAeE,MAAMC,UAAY,SAACC,GAC9BL,EAAQK,EAAMP,OAElBD,EAAGS,YAAYR,EAAM,CAACG,EAAeM,iL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AerBc,KAAKc,EAAqB5B,wEEtX5B8F,EAAyB,IAAIC,+BAOtCnD,iBAAA,SAAiBlC,EAAMsF,GACPlF,KAAKmF,EAAyBvF,GACtCiC,IAAIqD,MAOZvD,oBAAA,SAAoB/B,EAAMsF,QACjBC,EAAyBvF,GAAMwF,OAAOF,MAM/C1C,cAAA,SAAc1D,GACVA,EAAMmD,OAASjC,WACGA,KAAKmF,EAAyBrG,EAAMc,8DACpB,uFACrBd,OAWjBqG,EAAA,SAAyBvF,UAChBI,KAAKgF,EAAuB5B,IAAIxD,SAC5BoF,EAAuBK,IAAIzF,EAAM,IAAIqB,KAEvCjB,KAAKgF,EAAuBM,IAAI1F,UFsCxC,WAAuBM,EAAOE,OAC/BA,SACGF,GAASA,EAAMC,KAAOD,EAAMC,QAAe3B,QAAQC"}
metadata CHANGED
@@ -1,101 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-pwa-workbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.91
5
5
  platform: ruby
6
6
  authors:
7
7
  - souldanger
8
- - Pan Yuqi
9
- - sekiyika
10
8
  autorequire:
11
9
  bindir: bin
12
10
  cert_chain: []
13
- date: 2019-05-08 00:00:00.000000000 Z
11
+ date: 2020-07-14 00:00:00.000000000 Z
14
12
  dependencies: []
15
- description: "This Jekyll plugin makes your PWA / Website available offline and allows
16
- you to install on desktop or mobile. \n\t\t\t\t\tIt uses a Workbox v4 service
17
- worker, generates and injects a precache list into it and takes care of the registration
18
- process in a secure way."
13
+ description: "A Jekyll plugin that makes your PWA / Website available offline and
14
+ lets you install on desktop and mobile. \n\t\t\t\t\tIt generates and injects a precache
15
+ list into a Workbox v5.1.3 service worker and handles the registration process in
16
+ a secure way."
19
17
  email:
20
- - sammyoneski@outlook.com
21
- - pyqiverson@gmail.com
22
- - pengxing5501854@gmail.com
18
+ - souldanger.industries@gmail.com
23
19
  executables: []
24
20
  extensions: []
25
21
  extra_rdoc_files: []
26
22
  files:
27
23
  - lib/jekyll-pwa-workbox.rb
28
- - lib/vendor/workbox-v4.3.1/workbox-background-sync.dev.js
29
- - lib/vendor/workbox-v4.3.1/workbox-background-sync.dev.js.map
30
- - lib/vendor/workbox-v4.3.1/workbox-background-sync.prod.js
31
- - lib/vendor/workbox-v4.3.1/workbox-background-sync.prod.js.map
32
- - lib/vendor/workbox-v4.3.1/workbox-broadcast-update.dev.js
33
- - lib/vendor/workbox-v4.3.1/workbox-broadcast-update.dev.js.map
34
- - lib/vendor/workbox-v4.3.1/workbox-broadcast-update.prod.js
35
- - lib/vendor/workbox-v4.3.1/workbox-broadcast-update.prod.js.map
36
- - lib/vendor/workbox-v4.3.1/workbox-cacheable-response.dev.js
37
- - lib/vendor/workbox-v4.3.1/workbox-cacheable-response.dev.js.map
38
- - lib/vendor/workbox-v4.3.1/workbox-cacheable-response.prod.js
39
- - lib/vendor/workbox-v4.3.1/workbox-cacheable-response.prod.js.map
40
- - lib/vendor/workbox-v4.3.1/workbox-core.dev.js
41
- - lib/vendor/workbox-v4.3.1/workbox-core.dev.js.map
42
- - lib/vendor/workbox-v4.3.1/workbox-core.prod.js
43
- - lib/vendor/workbox-v4.3.1/workbox-core.prod.js.map
44
- - lib/vendor/workbox-v4.3.1/workbox-expiration.dev.js
45
- - lib/vendor/workbox-v4.3.1/workbox-expiration.dev.js.map
46
- - lib/vendor/workbox-v4.3.1/workbox-expiration.prod.js
47
- - lib/vendor/workbox-v4.3.1/workbox-expiration.prod.js.map
48
- - lib/vendor/workbox-v4.3.1/workbox-navigation-preload.dev.js
49
- - lib/vendor/workbox-v4.3.1/workbox-navigation-preload.dev.js.map
50
- - lib/vendor/workbox-v4.3.1/workbox-navigation-preload.prod.js
51
- - lib/vendor/workbox-v4.3.1/workbox-navigation-preload.prod.js.map
52
- - lib/vendor/workbox-v4.3.1/workbox-offline-ga.dev.js
53
- - lib/vendor/workbox-v4.3.1/workbox-offline-ga.dev.js.map
54
- - lib/vendor/workbox-v4.3.1/workbox-offline-ga.prod.js
55
- - lib/vendor/workbox-v4.3.1/workbox-offline-ga.prod.js.map
56
- - lib/vendor/workbox-v4.3.1/workbox-precaching.dev.js
57
- - lib/vendor/workbox-v4.3.1/workbox-precaching.dev.js.map
58
- - lib/vendor/workbox-v4.3.1/workbox-precaching.prod.js
59
- - lib/vendor/workbox-v4.3.1/workbox-precaching.prod.js.map
60
- - lib/vendor/workbox-v4.3.1/workbox-range-requests.dev.js
61
- - lib/vendor/workbox-v4.3.1/workbox-range-requests.dev.js.map
62
- - lib/vendor/workbox-v4.3.1/workbox-range-requests.prod.js
63
- - lib/vendor/workbox-v4.3.1/workbox-range-requests.prod.js.map
64
- - lib/vendor/workbox-v4.3.1/workbox-routing.dev.js
65
- - lib/vendor/workbox-v4.3.1/workbox-routing.dev.js.map
66
- - lib/vendor/workbox-v4.3.1/workbox-routing.prod.js
67
- - lib/vendor/workbox-v4.3.1/workbox-routing.prod.js.map
68
- - lib/vendor/workbox-v4.3.1/workbox-strategies.dev.js
69
- - lib/vendor/workbox-v4.3.1/workbox-strategies.dev.js.map
70
- - lib/vendor/workbox-v4.3.1/workbox-strategies.prod.js
71
- - lib/vendor/workbox-v4.3.1/workbox-strategies.prod.js.map
72
- - lib/vendor/workbox-v4.3.1/workbox-streams.dev.js
73
- - lib/vendor/workbox-v4.3.1/workbox-streams.dev.js.map
74
- - lib/vendor/workbox-v4.3.1/workbox-streams.prod.js
75
- - lib/vendor/workbox-v4.3.1/workbox-streams.prod.js.map
76
- - lib/vendor/workbox-v4.3.1/workbox-sw.js
77
- - lib/vendor/workbox-v4.3.1/workbox-sw.js.map
78
- - lib/vendor/workbox-v4.3.1/workbox-window.dev.es5.mjs
79
- - lib/vendor/workbox-v4.3.1/workbox-window.dev.es5.mjs.map
80
- - lib/vendor/workbox-v4.3.1/workbox-window.dev.mjs
81
- - lib/vendor/workbox-v4.3.1/workbox-window.dev.mjs.map
82
- - lib/vendor/workbox-v4.3.1/workbox-window.dev.umd.js
83
- - lib/vendor/workbox-v4.3.1/workbox-window.dev.umd.js.map
84
- - lib/vendor/workbox-v4.3.1/workbox-window.prod.es5.mjs
85
- - lib/vendor/workbox-v4.3.1/workbox-window.prod.es5.mjs.map
86
- - lib/vendor/workbox-v4.3.1/workbox-window.prod.mjs
87
- - lib/vendor/workbox-v4.3.1/workbox-window.prod.mjs.map
88
- - lib/vendor/workbox-v4.3.1/workbox-window.prod.umd.js
89
- - lib/vendor/workbox-v4.3.1/workbox-window.prod.umd.js.map
24
+ - lib/vendor/workbox-v5.1.3/workbox-background-sync.dev.js
25
+ - lib/vendor/workbox-v5.1.3/workbox-background-sync.dev.js.map
26
+ - lib/vendor/workbox-v5.1.3/workbox-background-sync.prod.js
27
+ - lib/vendor/workbox-v5.1.3/workbox-background-sync.prod.js.map
28
+ - lib/vendor/workbox-v5.1.3/workbox-broadcast-update.dev.js
29
+ - lib/vendor/workbox-v5.1.3/workbox-broadcast-update.dev.js.map
30
+ - lib/vendor/workbox-v5.1.3/workbox-broadcast-update.prod.js
31
+ - lib/vendor/workbox-v5.1.3/workbox-broadcast-update.prod.js.map
32
+ - lib/vendor/workbox-v5.1.3/workbox-cacheable-response.dev.js
33
+ - lib/vendor/workbox-v5.1.3/workbox-cacheable-response.dev.js.map
34
+ - lib/vendor/workbox-v5.1.3/workbox-cacheable-response.prod.js
35
+ - lib/vendor/workbox-v5.1.3/workbox-cacheable-response.prod.js.map
36
+ - lib/vendor/workbox-v5.1.3/workbox-core.dev.js
37
+ - lib/vendor/workbox-v5.1.3/workbox-core.dev.js.map
38
+ - lib/vendor/workbox-v5.1.3/workbox-core.prod.js
39
+ - lib/vendor/workbox-v5.1.3/workbox-core.prod.js.map
40
+ - lib/vendor/workbox-v5.1.3/workbox-expiration.dev.js
41
+ - lib/vendor/workbox-v5.1.3/workbox-expiration.dev.js.map
42
+ - lib/vendor/workbox-v5.1.3/workbox-expiration.prod.js
43
+ - lib/vendor/workbox-v5.1.3/workbox-expiration.prod.js.map
44
+ - lib/vendor/workbox-v5.1.3/workbox-navigation-preload.dev.js
45
+ - lib/vendor/workbox-v5.1.3/workbox-navigation-preload.dev.js.map
46
+ - lib/vendor/workbox-v5.1.3/workbox-navigation-preload.prod.js
47
+ - lib/vendor/workbox-v5.1.3/workbox-navigation-preload.prod.js.map
48
+ - lib/vendor/workbox-v5.1.3/workbox-offline-ga.dev.js
49
+ - lib/vendor/workbox-v5.1.3/workbox-offline-ga.dev.js.map
50
+ - lib/vendor/workbox-v5.1.3/workbox-offline-ga.prod.js
51
+ - lib/vendor/workbox-v5.1.3/workbox-offline-ga.prod.js.map
52
+ - lib/vendor/workbox-v5.1.3/workbox-precaching.dev.js
53
+ - lib/vendor/workbox-v5.1.3/workbox-precaching.dev.js.map
54
+ - lib/vendor/workbox-v5.1.3/workbox-precaching.prod.js
55
+ - lib/vendor/workbox-v5.1.3/workbox-precaching.prod.js.map
56
+ - lib/vendor/workbox-v5.1.3/workbox-range-requests.dev.js
57
+ - lib/vendor/workbox-v5.1.3/workbox-range-requests.dev.js.map
58
+ - lib/vendor/workbox-v5.1.3/workbox-range-requests.prod.js
59
+ - lib/vendor/workbox-v5.1.3/workbox-range-requests.prod.js.map
60
+ - lib/vendor/workbox-v5.1.3/workbox-routing.dev.js
61
+ - lib/vendor/workbox-v5.1.3/workbox-routing.dev.js.map
62
+ - lib/vendor/workbox-v5.1.3/workbox-routing.prod.js
63
+ - lib/vendor/workbox-v5.1.3/workbox-routing.prod.js.map
64
+ - lib/vendor/workbox-v5.1.3/workbox-strategies.dev.js
65
+ - lib/vendor/workbox-v5.1.3/workbox-strategies.dev.js.map
66
+ - lib/vendor/workbox-v5.1.3/workbox-strategies.prod.js
67
+ - lib/vendor/workbox-v5.1.3/workbox-strategies.prod.js.map
68
+ - lib/vendor/workbox-v5.1.3/workbox-streams.dev.js
69
+ - lib/vendor/workbox-v5.1.3/workbox-streams.dev.js.map
70
+ - lib/vendor/workbox-v5.1.3/workbox-streams.prod.js
71
+ - lib/vendor/workbox-v5.1.3/workbox-streams.prod.js.map
72
+ - lib/vendor/workbox-v5.1.3/workbox-sw.js
73
+ - lib/vendor/workbox-v5.1.3/workbox-sw.js.map
74
+ - lib/vendor/workbox-v5.1.3/workbox-window.dev.es5.mjs
75
+ - lib/vendor/workbox-v5.1.3/workbox-window.dev.es5.mjs.map
76
+ - lib/vendor/workbox-v5.1.3/workbox-window.dev.mjs
77
+ - lib/vendor/workbox-v5.1.3/workbox-window.dev.mjs.map
78
+ - lib/vendor/workbox-v5.1.3/workbox-window.dev.umd.js
79
+ - lib/vendor/workbox-v5.1.3/workbox-window.dev.umd.js.map
80
+ - lib/vendor/workbox-v5.1.3/workbox-window.prod.es5.mjs
81
+ - lib/vendor/workbox-v5.1.3/workbox-window.prod.es5.mjs.map
82
+ - lib/vendor/workbox-v5.1.3/workbox-window.prod.mjs
83
+ - lib/vendor/workbox-v5.1.3/workbox-window.prod.mjs.map
84
+ - lib/vendor/workbox-v5.1.3/workbox-window.prod.umd.js
85
+ - lib/vendor/workbox-v5.1.3/workbox-window.prod.umd.js.map
90
86
  homepage: https://github.com/souldanger/jekyll-pwa-workbox
91
87
  licenses:
92
88
  - MIT
93
89
  metadata:
94
90
  bug_tracker_uri: https://github.com/souldanger/jekyll-pwa-workbox/issues
95
- changelog_uri: https://github.com/souldanger/jekyll-pwa-workbox/blob/master/changelog.md
96
- documentation_uri: https://github.com/souldanger/jekyll-pwa-workbox
91
+ changelog_uri: https://github.com/souldanger/jekyll-pwa-workbox/blob/master/CHANGELOG.md
92
+ documentation_uri: https://github.com/souldanger/jekyll-pwa-workbox/blob/master/README.md
97
93
  homepage_uri: https://github.com/souldanger/jekyll-pwa-workbox
98
- source_code_uri: https://github.com/souldanger/jekyll-pwa-workbox
94
+ source_code_uri: https://github.com/souldanger/jekyll-pwa-workbox/releases
99
95
  post_install_message:
100
96
  rdoc_options: []
101
97
  require_paths:
@@ -111,8 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
107
  - !ruby/object:Gem::Version
112
108
  version: '0'
113
109
  requirements: []
114
- rubyforge_project:
115
- rubygems_version: 2.7.6
110
+ rubygems_version: 3.1.2
116
111
  signing_key:
117
112
  specification_version: 4
118
113
  summary: PWA Workbox Service Worker for Jekyll.
@@ -1,822 +0,0 @@
1
- this.workbox = this.workbox || {};
2
- this.workbox.backgroundSync = (function (exports, WorkboxError_mjs, logger_mjs, assert_mjs, getFriendlyURL_mjs, DBWrapper_mjs) {
3
- 'use strict';
4
-
5
- try {
6
- self['workbox:background-sync:4.3.1'] && _();
7
- } catch (e) {} // eslint-disable-line
8
-
9
- /*
10
- Copyright 2018 Google LLC
11
-
12
- Use of this source code is governed by an MIT-style
13
- license that can be found in the LICENSE file or at
14
- https://opensource.org/licenses/MIT.
15
- */
16
- const DB_VERSION = 3;
17
- const DB_NAME = 'workbox-background-sync';
18
- const OBJECT_STORE_NAME = 'requests';
19
- const INDEXED_PROP = 'queueName';
20
- /**
21
- * A class to manage storing requests from a Queue in IndexedbDB,
22
- * indexed by their queue name for easier access.
23
- *
24
- * @private
25
- */
26
-
27
- class QueueStore {
28
- /**
29
- * Associates this instance with a Queue instance, so entries added can be
30
- * identified by their queue name.
31
- *
32
- * @param {string} queueName
33
- * @private
34
- */
35
- constructor(queueName) {
36
- this._queueName = queueName;
37
- this._db = new DBWrapper_mjs.DBWrapper(DB_NAME, DB_VERSION, {
38
- onupgradeneeded: this._upgradeDb
39
- });
40
- }
41
- /**
42
- * Append an entry last in the queue.
43
- *
44
- * @param {Object} entry
45
- * @param {Object} entry.requestData
46
- * @param {number} [entry.timestamp]
47
- * @param {Object} [entry.metadata]
48
- * @private
49
- */
50
-
51
-
52
- async pushEntry(entry) {
53
- {
54
- assert_mjs.assert.isType(entry, 'object', {
55
- moduleName: 'workbox-background-sync',
56
- className: 'QueueStore',
57
- funcName: 'pushEntry',
58
- paramName: 'entry'
59
- });
60
- assert_mjs.assert.isType(entry.requestData, 'object', {
61
- moduleName: 'workbox-background-sync',
62
- className: 'QueueStore',
63
- funcName: 'pushEntry',
64
- paramName: 'entry.requestData'
65
- });
66
- } // Don't specify an ID since one is automatically generated.
67
-
68
-
69
- delete entry.id;
70
- entry.queueName = this._queueName;
71
- await this._db.add(OBJECT_STORE_NAME, entry);
72
- }
73
- /**
74
- * Preppend an entry first in the queue.
75
- *
76
- * @param {Object} entry
77
- * @param {Object} entry.requestData
78
- * @param {number} [entry.timestamp]
79
- * @param {Object} [entry.metadata]
80
- * @private
81
- */
82
-
83
-
84
- async unshiftEntry(entry) {
85
- {
86
- assert_mjs.assert.isType(entry, 'object', {
87
- moduleName: 'workbox-background-sync',
88
- className: 'QueueStore',
89
- funcName: 'unshiftEntry',
90
- paramName: 'entry'
91
- });
92
- assert_mjs.assert.isType(entry.requestData, 'object', {
93
- moduleName: 'workbox-background-sync',
94
- className: 'QueueStore',
95
- funcName: 'unshiftEntry',
96
- paramName: 'entry.requestData'
97
- });
98
- }
99
-
100
- const [firstEntry] = await this._db.getAllMatching(OBJECT_STORE_NAME, {
101
- count: 1
102
- });
103
-
104
- if (firstEntry) {
105
- // Pick an ID one less than the lowest ID in the object store.
106
- entry.id = firstEntry.id - 1;
107
- } else {
108
- // Otherwise let the auto-incrementor assign the ID.
109
- delete entry.id;
110
- }
111
-
112
- entry.queueName = this._queueName;
113
- await this._db.add(OBJECT_STORE_NAME, entry);
114
- }
115
- /**
116
- * Removes and returns the last entry in the queue matching the `queueName`.
117
- *
118
- * @return {Promise<Object>}
119
- * @private
120
- */
121
-
122
-
123
- async popEntry() {
124
- return this._removeEntry({
125
- direction: 'prev'
126
- });
127
- }
128
- /**
129
- * Removes and returns the first entry in the queue matching the `queueName`.
130
- *
131
- * @return {Promise<Object>}
132
- * @private
133
- */
134
-
135
-
136
- async shiftEntry() {
137
- return this._removeEntry({
138
- direction: 'next'
139
- });
140
- }
141
- /**
142
- * Returns all entries in the store matching the `queueName`.
143
- *
144
- * @param {Object} options See workbox.backgroundSync.Queue~getAll}
145
- * @return {Promise<Array<Object>>}
146
- * @private
147
- */
148
-
149
-
150
- async getAll() {
151
- return await this._db.getAllMatching(OBJECT_STORE_NAME, {
152
- index: INDEXED_PROP,
153
- query: IDBKeyRange.only(this._queueName)
154
- });
155
- }
156
- /**
157
- * Deletes the entry for the given ID.
158
- *
159
- * WARNING: this method does not ensure the deleted enry belongs to this
160
- * queue (i.e. matches the `queueName`). But this limitation is acceptable
161
- * as this class is not publicly exposed. An additional check would make
162
- * this method slower than it needs to be.
163
- *
164
- * @private
165
- * @param {number} id
166
- */
167
-
168
-
169
- async deleteEntry(id) {
170
- await this._db.delete(OBJECT_STORE_NAME, id);
171
- }
172
- /**
173
- * Removes and returns the first or last entry in the queue (based on the
174
- * `direction` argument) matching the `queueName`.
175
- *
176
- * @return {Promise<Object>}
177
- * @private
178
- */
179
-
180
-
181
- async _removeEntry({
182
- direction
183
- }) {
184
- const [entry] = await this._db.getAllMatching(OBJECT_STORE_NAME, {
185
- direction,
186
- index: INDEXED_PROP,
187
- query: IDBKeyRange.only(this._queueName),
188
- count: 1
189
- });
190
-
191
- if (entry) {
192
- await this.deleteEntry(entry.id);
193
- return entry;
194
- }
195
- }
196
- /**
197
- * Upgrades the database given an `upgradeneeded` event.
198
- *
199
- * @param {Event} event
200
- * @private
201
- */
202
-
203
-
204
- _upgradeDb(event) {
205
- const db = event.target.result;
206
-
207
- if (event.oldVersion > 0 && event.oldVersion < DB_VERSION) {
208
- if (db.objectStoreNames.contains(OBJECT_STORE_NAME)) {
209
- db.deleteObjectStore(OBJECT_STORE_NAME);
210
- }
211
- }
212
-
213
- const objStore = db.createObjectStore(OBJECT_STORE_NAME, {
214
- autoIncrement: true,
215
- keyPath: 'id'
216
- });
217
- objStore.createIndex(INDEXED_PROP, INDEXED_PROP, {
218
- unique: false
219
- });
220
- }
221
-
222
- }
223
-
224
- /*
225
- Copyright 2018 Google LLC
226
-
227
- Use of this source code is governed by an MIT-style
228
- license that can be found in the LICENSE file or at
229
- https://opensource.org/licenses/MIT.
230
- */
231
- const serializableProperties = ['method', 'referrer', 'referrerPolicy', 'mode', 'credentials', 'cache', 'redirect', 'integrity', 'keepalive'];
232
- /**
233
- * A class to make it easier to serialize and de-serialize requests so they
234
- * can be stored in IndexedDB.
235
- *
236
- * @private
237
- */
238
-
239
- class StorableRequest {
240
- /**
241
- * Converts a Request object to a plain object that can be structured
242
- * cloned or JSON-stringified.
243
- *
244
- * @param {Request} request
245
- * @return {Promise<StorableRequest>}
246
- *
247
- * @private
248
- */
249
- static async fromRequest(request) {
250
- const requestData = {
251
- url: request.url,
252
- headers: {}
253
- }; // Set the body if present.
254
-
255
- if (request.method !== 'GET') {
256
- // Use ArrayBuffer to support non-text request bodies.
257
- // NOTE: we can't use Blobs becuse Safari doesn't support storing
258
- // Blobs in IndexedDB in some cases:
259
- // https://github.com/dfahlander/Dexie.js/issues/618#issuecomment-398348457
260
- requestData.body = await request.clone().arrayBuffer();
261
- } // Convert the headers from an iterable to an object.
262
-
263
-
264
- for (const [key, value] of request.headers.entries()) {
265
- requestData.headers[key] = value;
266
- } // Add all other serializable request properties
267
-
268
-
269
- for (const prop of serializableProperties) {
270
- if (request[prop] !== undefined) {
271
- requestData[prop] = request[prop];
272
- }
273
- }
274
-
275
- return new StorableRequest(requestData);
276
- }
277
- /**
278
- * Accepts an object of request data that can be used to construct a
279
- * `Request` but can also be stored in IndexedDB.
280
- *
281
- * @param {Object} requestData An object of request data that includes the
282
- * `url` plus any relevant properties of
283
- * [requestInit]{@link https://fetch.spec.whatwg.org/#requestinit}.
284
- * @private
285
- */
286
-
287
-
288
- constructor(requestData) {
289
- {
290
- assert_mjs.assert.isType(requestData, 'object', {
291
- moduleName: 'workbox-background-sync',
292
- className: 'StorableRequest',
293
- funcName: 'constructor',
294
- paramName: 'requestData'
295
- });
296
- assert_mjs.assert.isType(requestData.url, 'string', {
297
- moduleName: 'workbox-background-sync',
298
- className: 'StorableRequest',
299
- funcName: 'constructor',
300
- paramName: 'requestData.url'
301
- });
302
- } // If the request's mode is `navigate`, convert it to `same-origin` since
303
- // navigation requests can't be constructed via script.
304
-
305
-
306
- if (requestData.mode === 'navigate') {
307
- requestData.mode = 'same-origin';
308
- }
309
-
310
- this._requestData = requestData;
311
- }
312
- /**
313
- * Returns a deep clone of the instances `_requestData` object.
314
- *
315
- * @return {Object}
316
- *
317
- * @private
318
- */
319
-
320
-
321
- toObject() {
322
- const requestData = Object.assign({}, this._requestData);
323
- requestData.headers = Object.assign({}, this._requestData.headers);
324
-
325
- if (requestData.body) {
326
- requestData.body = requestData.body.slice(0);
327
- }
328
-
329
- return requestData;
330
- }
331
- /**
332
- * Converts this instance to a Request.
333
- *
334
- * @return {Request}
335
- *
336
- * @private
337
- */
338
-
339
-
340
- toRequest() {
341
- return new Request(this._requestData.url, this._requestData);
342
- }
343
- /**
344
- * Creates and returns a deep clone of the instance.
345
- *
346
- * @return {StorableRequest}
347
- *
348
- * @private
349
- */
350
-
351
-
352
- clone() {
353
- return new StorableRequest(this.toObject());
354
- }
355
-
356
- }
357
-
358
- /*
359
- Copyright 2018 Google LLC
360
-
361
- Use of this source code is governed by an MIT-style
362
- license that can be found in the LICENSE file or at
363
- https://opensource.org/licenses/MIT.
364
- */
365
- const TAG_PREFIX = 'workbox-background-sync';
366
- const MAX_RETENTION_TIME = 60 * 24 * 7; // 7 days in minutes
367
-
368
- const queueNames = new Set();
369
- /**
370
- * A class to manage storing failed requests in IndexedDB and retrying them
371
- * later. All parts of the storing and replaying process are observable via
372
- * callbacks.
373
- *
374
- * @memberof workbox.backgroundSync
375
- */
376
-
377
- class Queue {
378
- /**
379
- * Creates an instance of Queue with the given options
380
- *
381
- * @param {string} name The unique name for this queue. This name must be
382
- * unique as it's used to register sync events and store requests
383
- * in IndexedDB specific to this instance. An error will be thrown if
384
- * a duplicate name is detected.
385
- * @param {Object} [options]
386
- * @param {Function} [options.onSync] A function that gets invoked whenever
387
- * the 'sync' event fires. The function is invoked with an object
388
- * containing the `queue` property (referencing this instance), and you
389
- * can use the callback to customize the replay behavior of the queue.
390
- * When not set the `replayRequests()` method is called.
391
- * Note: if the replay fails after a sync event, make sure you throw an
392
- * error, so the browser knows to retry the sync event later.
393
- * @param {number} [options.maxRetentionTime=7 days] The amount of time (in
394
- * minutes) a request may be retried. After this amount of time has
395
- * passed, the request will be deleted from the queue.
396
- */
397
- constructor(name, {
398
- onSync,
399
- maxRetentionTime
400
- } = {}) {
401
- // Ensure the store name is not already being used
402
- if (queueNames.has(name)) {
403
- throw new WorkboxError_mjs.WorkboxError('duplicate-queue-name', {
404
- name
405
- });
406
- } else {
407
- queueNames.add(name);
408
- }
409
-
410
- this._name = name;
411
- this._onSync = onSync || this.replayRequests;
412
- this._maxRetentionTime = maxRetentionTime || MAX_RETENTION_TIME;
413
- this._queueStore = new QueueStore(this._name);
414
-
415
- this._addSyncListener();
416
- }
417
- /**
418
- * @return {string}
419
- */
420
-
421
-
422
- get name() {
423
- return this._name;
424
- }
425
- /**
426
- * Stores the passed request in IndexedDB (with its timestamp and any
427
- * metadata) at the end of the queue.
428
- *
429
- * @param {Object} entry
430
- * @param {Request} entry.request The request to store in the queue.
431
- * @param {Object} [entry.metadata] Any metadata you want associated with the
432
- * stored request. When requests are replayed you'll have access to this
433
- * metadata object in case you need to modify the request beforehand.
434
- * @param {number} [entry.timestamp] The timestamp (Epoch time in
435
- * milliseconds) when the request was first added to the queue. This is
436
- * used along with `maxRetentionTime` to remove outdated requests. In
437
- * general you don't need to set this value, as it's automatically set
438
- * for you (defaulting to `Date.now()`), but you can update it if you
439
- * don't want particular requests to expire.
440
- */
441
-
442
-
443
- async pushRequest(entry) {
444
- {
445
- assert_mjs.assert.isType(entry, 'object', {
446
- moduleName: 'workbox-background-sync',
447
- className: 'Queue',
448
- funcName: 'pushRequest',
449
- paramName: 'entry'
450
- });
451
- assert_mjs.assert.isInstance(entry.request, Request, {
452
- moduleName: 'workbox-background-sync',
453
- className: 'Queue',
454
- funcName: 'pushRequest',
455
- paramName: 'entry.request'
456
- });
457
- }
458
-
459
- await this._addRequest(entry, 'push');
460
- }
461
- /**
462
- * Stores the passed request in IndexedDB (with its timestamp and any
463
- * metadata) at the beginning of the queue.
464
- *
465
- * @param {Object} entry
466
- * @param {Request} entry.request The request to store in the queue.
467
- * @param {Object} [entry.metadata] Any metadata you want associated with the
468
- * stored request. When requests are replayed you'll have access to this
469
- * metadata object in case you need to modify the request beforehand.
470
- * @param {number} [entry.timestamp] The timestamp (Epoch time in
471
- * milliseconds) when the request was first added to the queue. This is
472
- * used along with `maxRetentionTime` to remove outdated requests. In
473
- * general you don't need to set this value, as it's automatically set
474
- * for you (defaulting to `Date.now()`), but you can update it if you
475
- * don't want particular requests to expire.
476
- */
477
-
478
-
479
- async unshiftRequest(entry) {
480
- {
481
- assert_mjs.assert.isType(entry, 'object', {
482
- moduleName: 'workbox-background-sync',
483
- className: 'Queue',
484
- funcName: 'unshiftRequest',
485
- paramName: 'entry'
486
- });
487
- assert_mjs.assert.isInstance(entry.request, Request, {
488
- moduleName: 'workbox-background-sync',
489
- className: 'Queue',
490
- funcName: 'unshiftRequest',
491
- paramName: 'entry.request'
492
- });
493
- }
494
-
495
- await this._addRequest(entry, 'unshift');
496
- }
497
- /**
498
- * Removes and returns the last request in the queue (along with its
499
- * timestamp and any metadata). The returned object takes the form:
500
- * `{request, timestamp, metadata}`.
501
- *
502
- * @return {Promise<Object>}
503
- */
504
-
505
-
506
- async popRequest() {
507
- return this._removeRequest('pop');
508
- }
509
- /**
510
- * Removes and returns the first request in the queue (along with its
511
- * timestamp and any metadata). The returned object takes the form:
512
- * `{request, timestamp, metadata}`.
513
- *
514
- * @return {Promise<Object>}
515
- */
516
-
517
-
518
- async shiftRequest() {
519
- return this._removeRequest('shift');
520
- }
521
- /**
522
- * Returns all the entries that have not expired (per `maxRetentionTime`).
523
- * Any expired entries are removed from the queue.
524
- *
525
- * @return {Promise<Array<Object>>}
526
- */
527
-
528
-
529
- async getAll() {
530
- const allEntries = await this._queueStore.getAll();
531
- const now = Date.now();
532
- const unexpiredEntries = [];
533
-
534
- for (const entry of allEntries) {
535
- // Ignore requests older than maxRetentionTime. Call this function
536
- // recursively until an unexpired request is found.
537
- const maxRetentionTimeInMs = this._maxRetentionTime * 60 * 1000;
538
-
539
- if (now - entry.timestamp > maxRetentionTimeInMs) {
540
- await this._queueStore.deleteEntry(entry.id);
541
- } else {
542
- unexpiredEntries.push(convertEntry(entry));
543
- }
544
- }
545
-
546
- return unexpiredEntries;
547
- }
548
- /**
549
- * Adds the entry to the QueueStore and registers for a sync event.
550
- *
551
- * @param {Object} entry
552
- * @param {Request} entry.request
553
- * @param {Object} [entry.metadata]
554
- * @param {number} [entry.timestamp=Date.now()]
555
- * @param {string} operation ('push' or 'unshift')
556
- * @private
557
- */
558
-
559
-
560
- async _addRequest({
561
- request,
562
- metadata,
563
- timestamp = Date.now()
564
- }, operation) {
565
- const storableRequest = await StorableRequest.fromRequest(request.clone());
566
- const entry = {
567
- requestData: storableRequest.toObject(),
568
- timestamp
569
- }; // Only include metadata if it's present.
570
-
571
- if (metadata) {
572
- entry.metadata = metadata;
573
- }
574
-
575
- await this._queueStore[`${operation}Entry`](entry);
576
-
577
- {
578
- logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(request.url)}' has ` + `been added to background sync queue '${this._name}'.`);
579
- } // Don't register for a sync if we're in the middle of a sync. Instead,
580
- // we wait until the sync is complete and call register if
581
- // `this._requestsAddedDuringSync` is true.
582
-
583
-
584
- if (this._syncInProgress) {
585
- this._requestsAddedDuringSync = true;
586
- } else {
587
- await this.registerSync();
588
- }
589
- }
590
- /**
591
- * Removes and returns the first or last (depending on `operation`) entry
592
- * from the QueueStore that's not older than the `maxRetentionTime`.
593
- *
594
- * @param {string} operation ('pop' or 'shift')
595
- * @return {Object|undefined}
596
- * @private
597
- */
598
-
599
-
600
- async _removeRequest(operation) {
601
- const now = Date.now();
602
- const entry = await this._queueStore[`${operation}Entry`]();
603
-
604
- if (entry) {
605
- // Ignore requests older than maxRetentionTime. Call this function
606
- // recursively until an unexpired request is found.
607
- const maxRetentionTimeInMs = this._maxRetentionTime * 60 * 1000;
608
-
609
- if (now - entry.timestamp > maxRetentionTimeInMs) {
610
- return this._removeRequest(operation);
611
- }
612
-
613
- return convertEntry(entry);
614
- }
615
- }
616
- /**
617
- * Loops through each request in the queue and attempts to re-fetch it.
618
- * If any request fails to re-fetch, it's put back in the same position in
619
- * the queue (which registers a retry for the next sync event).
620
- */
621
-
622
-
623
- async replayRequests() {
624
- let entry;
625
-
626
- while (entry = await this.shiftRequest()) {
627
- try {
628
- await fetch(entry.request.clone());
629
-
630
- {
631
- logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(entry.request.url)}'` + `has been replayed in queue '${this._name}'`);
632
- }
633
- } catch (error) {
634
- await this.unshiftRequest(entry);
635
-
636
- {
637
- logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(entry.request.url)}'` + `failed to replay, putting it back in queue '${this._name}'`);
638
- }
639
-
640
- throw new WorkboxError_mjs.WorkboxError('queue-replay-failed', {
641
- name: this._name
642
- });
643
- }
644
- }
645
-
646
- {
647
- logger_mjs.logger.log(`All requests in queue '${this.name}' have successfully ` + `replayed; the queue is now empty!`);
648
- }
649
- }
650
- /**
651
- * Registers a sync event with a tag unique to this instance.
652
- */
653
-
654
-
655
- async registerSync() {
656
- if ('sync' in registration) {
657
- try {
658
- await registration.sync.register(`${TAG_PREFIX}:${this._name}`);
659
- } catch (err) {
660
- // This means the registration failed for some reason, possibly due to
661
- // the user disabling it.
662
- {
663
- logger_mjs.logger.warn(`Unable to register sync event for '${this._name}'.`, err);
664
- }
665
- }
666
- }
667
- }
668
- /**
669
- * In sync-supporting browsers, this adds a listener for the sync event.
670
- * In non-sync-supporting browsers, this will retry the queue on service
671
- * worker startup.
672
- *
673
- * @private
674
- */
675
-
676
-
677
- _addSyncListener() {
678
- if ('sync' in registration) {
679
- self.addEventListener('sync', event => {
680
- if (event.tag === `${TAG_PREFIX}:${this._name}`) {
681
- {
682
- logger_mjs.logger.log(`Background sync for tag '${event.tag}'` + `has been received`);
683
- }
684
-
685
- const syncComplete = async () => {
686
- this._syncInProgress = true;
687
- let syncError;
688
-
689
- try {
690
- await this._onSync({
691
- queue: this
692
- });
693
- } catch (error) {
694
- syncError = error; // Rethrow the error. Note: the logic in the finally clause
695
- // will run before this gets rethrown.
696
-
697
- throw syncError;
698
- } finally {
699
- // New items may have been added to the queue during the sync,
700
- // so we need to register for a new sync if that's happened...
701
- // Unless there was an error during the sync, in which
702
- // case the browser will automatically retry later, as long
703
- // as `event.lastChance` is not true.
704
- if (this._requestsAddedDuringSync && !(syncError && !event.lastChance)) {
705
- await this.registerSync();
706
- }
707
-
708
- this._syncInProgress = false;
709
- this._requestsAddedDuringSync = false;
710
- }
711
- };
712
-
713
- event.waitUntil(syncComplete());
714
- }
715
- });
716
- } else {
717
- {
718
- logger_mjs.logger.log(`Background sync replaying without background sync event`);
719
- } // If the browser doesn't support background sync, retry
720
- // every time the service worker starts up as a fallback.
721
-
722
-
723
- this._onSync({
724
- queue: this
725
- });
726
- }
727
- }
728
- /**
729
- * Returns the set of queue names. This is primarily used to reset the list
730
- * of queue names in tests.
731
- *
732
- * @return {Set}
733
- *
734
- * @private
735
- */
736
-
737
-
738
- static get _queueNames() {
739
- return queueNames;
740
- }
741
-
742
- }
743
- /**
744
- * Converts a QueueStore entry into the format exposed by Queue. This entails
745
- * converting the request data into a real request and omitting the `id` and
746
- * `queueName` properties.
747
- *
748
- * @param {Object} queueStoreEntry
749
- * @return {Object}
750
- * @private
751
- */
752
-
753
-
754
- const convertEntry = queueStoreEntry => {
755
- const queueEntry = {
756
- request: new StorableRequest(queueStoreEntry.requestData).toRequest(),
757
- timestamp: queueStoreEntry.timestamp
758
- };
759
-
760
- if (queueStoreEntry.metadata) {
761
- queueEntry.metadata = queueStoreEntry.metadata;
762
- }
763
-
764
- return queueEntry;
765
- };
766
-
767
- /*
768
- Copyright 2018 Google LLC
769
-
770
- Use of this source code is governed by an MIT-style
771
- license that can be found in the LICENSE file or at
772
- https://opensource.org/licenses/MIT.
773
- */
774
- /**
775
- * A class implementing the `fetchDidFail` lifecycle callback. This makes it
776
- * easier to add failed requests to a background sync Queue.
777
- *
778
- * @memberof workbox.backgroundSync
779
- */
780
-
781
- class Plugin {
782
- /**
783
- * @param {...*} queueArgs Args to forward to the composed Queue instance.
784
- * See the [Queue]{@link workbox.backgroundSync.Queue} documentation for
785
- * parameter details.
786
- */
787
- constructor(...queueArgs) {
788
- this._queue = new Queue(...queueArgs);
789
- this.fetchDidFail = this.fetchDidFail.bind(this);
790
- }
791
- /**
792
- * @param {Object} options
793
- * @param {Request} options.request
794
- * @private
795
- */
796
-
797
-
798
- async fetchDidFail({
799
- request
800
- }) {
801
- await this._queue.pushRequest({
802
- request
803
- });
804
- }
805
-
806
- }
807
-
808
- /*
809
- Copyright 2018 Google LLC
810
-
811
- Use of this source code is governed by an MIT-style
812
- license that can be found in the LICENSE file or at
813
- https://opensource.org/licenses/MIT.
814
- */
815
-
816
- exports.Queue = Queue;
817
- exports.Plugin = Plugin;
818
-
819
- return exports;
820
-
821
- }({}, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private));
822
- //# sourceMappingURL=workbox-background-sync.dev.js.map