{“version”:3,“file”:“workbox-window.prod.mjs”,“sources”:,“sourcesContent”:[“"use strict";n// @ts-ignorentry {n self && _();n}ncatch (e) { }n”,“/*n Copyright 2019 Google LLCnn Use of this source code is governed by an MIT-stylen license that can be found in the LICENSE file or atn opensource.org/licenses/MIT.n*/nimport './_version.js';n/**n * Sends a data object to a service worker via `postMessage` and resolves withn * a response (if any).n *n * A response can be set in a message handler in the service worker byn * calling `event.ports.postMessage(…)`, which will resolve the promisen * returned by `messageSW()`. If no response is set, the promise will notn * 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-windown */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-ignorentry {n self && _();n}ncatch (e) { }n”,“/*n Copyright 2018 Google LLCnn Use of this source code is governed by an MIT-stylen license that can be found in the LICENSE file or atn opensource.org/licenses/MIT.n*/nimport '../_version.js';n/**n * The Deferred class composes Promises in a way that allows for them to ben * resolved or rejected from outside the constructor. In most cases promisesn * should be used directly, but Deferreds can be necessary when the logic ton * resolve a promise must be separate.n *n * @privaten */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 LLCnn Use of this source code is governed by an MIT-stylen license that can be found in the LICENSE file or atn opensource.org/licenses/MIT.n*/nimport '../_version.js';n/**n * Returns true if two URLs have the same `.href` property. The URLS can ben * relative, and if they are the current location href is used to resolve URLs.n *n * @privaten * @param {string} url1n * @param {string} url2n * @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 LLCnn Use of this source code is governed by an MIT-stylen license that can be found in the LICENSE file or atn 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 supportn * constructable `EventTarget`, and using a real `Event` will error.n * @privaten */nexport class WorkboxEvent {n constructor(type, props) {n this.type = type;n Object.assign(this, props);n }n}n”,“/*n Copyright 2019 Google LLCnn Use of this source code is governed by an MIT-stylen license that can be found in the LICENSE file or atn 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 concluden// `skipWaiting()` wasn't called. This 200 amount wasn't scientificallyn// 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 concluden// 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, andn * 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-windown */nclass Workbox extends WorkboxEventTarget {n /**n * Creates a new Workbox instance with a script URL and service workern * options. The script URL and options are the same as those used whenn * calling `navigator.serviceWorker.register(scriptURL, options)`. See:n * developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/registern *n * @param {string} scriptURL The service worker script associated with thisn * instance.n * @param {Object} [registerOptions] The service worker options associatedn * 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 * @privaten */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()` isn // different from the current controlling SW's script URL, we know anyn // successful registration calls will trigger an `updatefound` event.n // But if the registered script URL is the same as the current controllingn // SW's script URL, we'll only get an `updatefound` event if the filen // changed since it was last registered. This can be a problem if the usern // opens up the same page in a different tab, and that page registersn // a SW that triggers an update. It's a problem because this page has non // good way of knowing whether the `updatefound` event came from the SWn // script it registered or from a registration attempt made by a newern // 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'tn // add the `updatefound` event listener until the `register()` call, ifn // `_updateFoundCount` is > 0 then it means this method has alreadyn // been called, thus this SW must be externaln this._updateFoundCount > 0 ||n // If the script URL of the installing SW is different from thisn // instance's script URL, we know it's definitely not from ourn // 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 isn // 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 wasn // 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 installingn // 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 dedicatedn // 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 thisn // method can be sure they were triggered externally.n ++this._updateFoundCount;n // Add a `statechange` listener regardless of whether this update wasn // triggered externally, since we have callbacks for both.n installingSW.addEventListener('statechange', this._onStateChange);n };n /**n * @privaten * @param {Event} originalEventn */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 originalEventn };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 callsn // `skipWaiting()` in the install event, thus moving it directly in then // activating state. (Since all service workers must go through then // waiting phase, the only way to detect `skipWaiting()` called in then // install event is to observe that the time spent in the waiting phasen // is very short.)n // NOTE: we don't need separate timeouts for the own and external SWsn // 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 * @privaten * @param {Event} originalEventn */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 * @privaten * @param {Event} originalEventn */n this._onMessage = async (originalEvent) => {n const { data, source } = originalEvent;n // Wait until there's an "own" service worker. This is used to buffern // `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 ownn // service workers for this instance, dispatch a `message` event.n // NOTE: we check for all previously owned service workers rather thann // just the current one because some messages (e.g. cache updates) usen // a timeout when sent and may be delayed long enough for a service workern // 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 duringn // page load are buffered only until the DOMContentLoaded event:n // github.com/GoogleChrome/workbox/issues/2202n navigator.serviceWorker.addEventListener('message', this._onMessage);n }n /**n * Registers a service worker for this instances script URL and servicen * worker options. By default this method delays registration until aftern * the window has loaded.n *n * @param {Object} [options]n * @param {Function} [options.immediate=false] Setting this to true willn * register the service worker immediately, even if the window hasn * 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 pagen // at registration time.n this._isUpdate = Boolean(navigator.serviceWorker.controller);n // Before registering, attempt to determine if a SW is already controllingn // the page, and if that SW script (and version, if specified) matches thisn // 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 then // `updatefound` event fires, it likely means that this site is openn // in another tab, or the user refreshed the page (and thus the previousn // page wasn't fully unloaded before this page started loading).n // developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waitingn 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 overwritingn // a compatible controller.n this._sw = waitingSW;n // Run this in the next microtask, so any code that adds an eventn // 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 registrationn await this._registration.update();n }n /**n * Resolves to the service worker registered by this instance as soon as itn * is active. If a service worker was already controlling at registrationn * time then it will resolve to that if the script URLs (and optionallyn * script versions) match, otherwise it will wait until an update is foundn * 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 itn * is controlling the page. If a service worker was already controlling atn * registration time then it will resolve to that if the script URLs (andn * optionally script versions) match, otherwise it will wait until an updaten * is found and starts controlling the page.n * Note: the first time a service worker is installed it will active butn * not start controlling the page unless `clients.claim()` is called in then * 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 URLn * of this instance, as soon as it's available.n *n * If, at registration time, there's already an active or waiting servicen * worker with a matching script URL, it will be used (with the waitingn * service worker taking precedence over the active service worker if bothn * match, since the waiting service worker would have been registered moren * recently).n * If there's no matching active or waiting service worker at registrationn * time then the promise will not resolve until an update is found and startsn * 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()` ton // 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 thisn * instance (via [`getSW()`]{@link module:workbox-window.Workbox#getSW}) and resolvesn * with a response (if any).n *n * A response can be set in a message handler in the service worker byn * calling `event.ports.postMessage(…)`, which will resolve the promisen * returned by `messageSW()`. If no response is set, the promise will nevern * resolve.n *n * @param {Object} data An object to send to the service workern * @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 returnsn * it if its script URL matches.n *n * @privaten * @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 registern * options and tracks the time registration was complete.n *n * @privaten */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 then // `this._onUpdateFound` heuristic. Also use the presence of thisn // 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#messagen * @type {WorkboxEvent}n * @property {*} data The `data` property from the original `message` event.n * @property {Event} originalEvent The original [`message`]{@link 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 an * [`Workbox`]{@link module:workbox-window.Workbox} instance'sn * [registered service worker]{@link 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 casen * of an update being found, the event's `isUpdate` property will be `true`.n *n * @event module:workbox-window.Workbox#installedn * @type {WorkboxEvent}n * @property {ServiceWorker} sw The service worker instance.n * @property {Event} originalEvent The original [`statechange`]{@link developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}n * event.n * @property {boolean|undefined} isUpdate True if a service worker was alreadyn * 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 an * [`Workbox`]{@link module:workbox-window.Workbox} instance'sn * [registered service worker]{@link 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 samen * [`scriptURL`]{@link 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#waitingn * @type {WorkboxEvent}n * @property {ServiceWorker} sw The service worker instance.n * @property {Event|undefined} originalEvent The originaln * [`statechange`]{@link developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}n * event, or `undefined` in the case where the service worker was waitingn * to before `.register()` was called.n * @property {boolean|undefined} isUpdate True if a service worker was alreadyn * controlling when this `Workbox` instance called `register()`.n * @property {boolean|undefined} wasWaitingBeforeRegister True if a service worker withn * 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 an * [`controllerchange`]{@link developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}n * fires on the service worker [container]{@link developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer}n * and the [`scriptURL`]{@link developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}n * of the new [controller]{@link developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller}n * matches the `scriptURL` of the `Workbox` instance'sn * [registered service worker]{@link developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}.n *n * @event module:workbox-window.Workbox#controllingn * @type {WorkboxEvent}n * @property {ServiceWorker} sw The service worker instance.n * @property {Event} originalEvent The original [`controllerchange`]{@link developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}n * event.n * @property {boolean|undefined} isUpdate True if a service worker was alreadyn * 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 an * [`Workbox`]{@link module:workbox-window.Workbox} instance'sn * [registered service worker]{@link developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}n * changes to `activated`.n *n * @event module:workbox-window.Workbox#activatedn * @type {WorkboxEvent}n * @property {ServiceWorker} sw The service worker instance.n * @property {Event} originalEvent The original [`statechange`]{@link developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}n * event.n * @property {boolean|undefined} isUpdate True if a service worker was alreadyn * 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 an * [`Workbox`]{@link module:workbox-window.Workbox} instance'sn * [registered service worker]{@link developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}n * changes to `redundant`.n *n * @event module:workbox-window.Workbox#redundantn * @type {WorkboxEvent}n * @property {ServiceWorker} sw The service worker instance.n * @property {Event} originalEvent The original [`statechange`]{@link developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}n * event.n * @property {boolean|undefined} isUpdate True if a service worker was alreadyn * 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 ann * [external service worker]{@link 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#externalinstalledn * @type {WorkboxEvent}n * @property {ServiceWorker} sw The service worker instance.n * @property {Event} originalEvent The original [`statechange`]{@link 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 ann * [external service worker]{@link 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#externalwaitingn * @type {WorkboxEvent}n * @property {ServiceWorker} sw The service worker instance.n * @property {Event} originalEvent The original [`statechange`]{@link 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 ann * [external service worker]{@link 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#externalactivatedn * @type {WorkboxEvent}n * @property {ServiceWorker} sw The service worker instance.n * @property {Event} originalEvent The original [`statechange`]{@link 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 LLCnn Use of this source code is governed by an MIT-stylen license that can be found in the LICENSE file or atn opensource.org/licenses/MIT.n*/n/**n * A minimal `EventTarget` shim.n * This is necessary because not all browsers support constructablen * `EventTarget`, so using a real `EventTarget` will error.n * @privaten */nexport class WorkboxEventTarget {n constructor() {n this._eventListenerRegistry = new Map();n }n /**n * @param {string} typen * @param {Function} listenern * @privaten */n addEventListener(type, listener) {n const foo = this._getEventListenersByType(type);n foo.add(listener);n }n /**n * @param {string} typen * @param {Function} listenern * @privaten */n removeEventListener(type, listener) {n this._getEventListenersByType(type).delete(listener);n }n /**n * @param {Object} eventn * @privaten */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 * @privaten */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 LLCn Use of this source code is governed by an MIT-stylen license that can be found in the LICENSE file or atn opensource.org/licenses/MIT.n*/nimport '../_version.js';n/**n * A helper function that prevents a promise from being flagged as unused.n *n * @privaten **/nexport function dontWaitFor(promise) {n // Effective no-op.n promise.then(() => { });n}n”],“names”:,“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,OACVW,OAASA,KCNnB,SAASC,EAAUC,EAAMC,SACtBC,KAAEA,GAASC,gBACV,IAAIC,IAAIJ,EAAME,GAAMA,OAAS,IAAIE,IAAIH,EAAMC,GAAMA,KCL5D,MAAaG,EACTT,YAAYU,EAAMC,QACTD,KAAOA,EACZE,OAAOC,OAAOC,KAAMH,ICoB5B,MAAMI,UCxBN,MACIf,mBACSgB,EAAyB,IAAIC,IAOtCC,iBAAiBR,EAAMS,GACPL,KAAKM,EAAyBV,GACtCW,IAAIF,GAOZG,oBAAoBZ,EAAMS,QACjBC,EAAyBV,GAAMa,OAAOJ,GAM/CK,cAAc5B,GACVA,EAAM6B,OAASX,WACTY,EAAYZ,KAAKM,EAAyBxB,EAAMc,UACjD,MAAMS,KAAYO,EACnBP,EAASvB,GAWjBwB,EAAyBV,UAChBI,KAAKE,EAAuBW,IAAIjB,SAC5BM,EAAuBY,IAAIlB,EAAM,IAAImB,KA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