zwave-js-ui 9.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +48 -0
- package/dev-dist/registerSW.js +5 -0
- package/dist/apple-touch-icon-180x180.png +0 -0
- package/dist/assets/AssociationGroups-474358b5.js +1 -0
- package/dist/assets/BgRssiChart-3e7d7555.css +1 -0
- package/dist/assets/BgRssiChart-554c89ef.js +3 -0
- package/dist/assets/BlinkIcon-5407e2e0.js +1 -0
- package/dist/assets/ColumnFilter-378ec338.js +1 -0
- package/dist/assets/ColumnFilterBoolean-e0ff8ce6.js +1 -0
- package/dist/assets/ColumnFilterDate-b17871ea.js +1 -0
- package/dist/assets/ColumnFilterNumber-c07930a6.js +1 -0
- package/dist/assets/ColumnFilterString-079ac562.js +1 -0
- package/dist/assets/ControlPanel-3c3168d8.js +7 -0
- package/dist/assets/ControllerChart-f2fbb771.js +1 -0
- package/dist/assets/Debug-ea34e06e.js +98 -0
- package/dist/assets/DialogAdvanced-5f8c36c7.js +1 -0
- package/dist/assets/DialogAdvanced-eaabda04.css +1 -0
- package/dist/assets/DialogAssociation-6da4cd66.js +1 -0
- package/dist/assets/DialogGatewayValue-501b7bbe.js +1 -0
- package/dist/assets/DialogGatewayValue-911dd212.css +1 -0
- package/dist/assets/DialogHealthCheck-2228ed6c.css +1 -0
- package/dist/assets/DialogHealthCheck-9e90523a.js +1 -0
- package/dist/assets/DialogSceneValue-ff3081b9.js +1 -0
- package/dist/assets/ErrorPage-a4f837c6.js +1 -0
- package/dist/assets/ExpandedNode-9f727a42.css +1 -0
- package/dist/assets/ExpandedNode-a0bff765.js +3 -0
- package/dist/assets/HomeAssistant-974143e2.js +1 -0
- package/dist/assets/ListInput-d8c678f2.js +1 -0
- package/dist/assets/Login-1826b0a1.css +1 -0
- package/dist/assets/Login-5424b4df.js +1 -0
- package/dist/assets/MaterialIcons-Regular-11ec382a.woff +0 -0
- package/dist/assets/MaterialIcons-Regular-29c11fa5.ttf +0 -0
- package/dist/assets/MaterialIcons-Regular-5743ed3d.woff2 +0 -0
- package/dist/assets/MaterialIcons-Regular-e69d687a.eot +0 -0
- package/dist/assets/Mesh-1b8d31eb.css +1 -0
- package/dist/assets/Mesh-25b19dfe.js +1 -0
- package/dist/assets/NodeDetails-da00c417.css +1 -0
- package/dist/assets/NodeDetails-e9d8d566.js +5 -0
- package/dist/assets/NodePanel-3639f227.css +1 -0
- package/dist/assets/NodePanel-5cdb1b4a.js +1 -0
- package/dist/assets/NodeScheduler-e91e411b.js +1 -0
- package/dist/assets/OTAUpdates-066cbfed.js +7 -0
- package/dist/assets/QrReader-00dee3fb.css +1 -0
- package/dist/assets/QrReader-c320584c.js +1 -0
- package/dist/assets/ReinterviewBadge-a40fb19f.js +1 -0
- package/dist/assets/RichValue-3ea76a33.css +1 -0
- package/dist/assets/RichValue-3f78fa98.js +1 -0
- package/dist/assets/Scenes-4aea74b8.js +1 -0
- package/dist/assets/Settings-ac079344.css +1 -0
- package/dist/assets/Settings-d8e203ed.js +44 -0
- package/dist/assets/SmartStart-63c21be6.js +2 -0
- package/dist/assets/SmartView-f9259d20.js +1 -0
- package/dist/assets/StatisticsArrows-40c56587.js +1 -0
- package/dist/assets/StatisticsCard-a91596c0.js +1 -0
- package/dist/assets/Store-701d51c8.js +1 -0
- package/dist/assets/Store-a58f7130.css +1 -0
- package/dist/assets/UserCodeTable-c397703b.js +1 -0
- package/dist/assets/ValueId-b8e1e4a2.js +1 -0
- package/dist/assets/ValueId-ea679e64.css +1 -0
- package/dist/assets/ZwaveGraph-4fa851e3.js +98 -0
- package/dist/assets/ZwaveGraph-fe07d4ee.css +1 -0
- package/dist/assets/file-input-064e7979.js +1 -0
- package/dist/assets/index-058391ec.js +17 -0
- package/dist/assets/index-3c63af0b.js +112 -0
- package/dist/assets/index-468a52af.js +2 -0
- package/dist/assets/index-be785cef.css +9 -0
- package/dist/assets/index-d98f5afd.css +1 -0
- package/dist/assets/items-45b4c1f5.js +1 -0
- package/dist/assets/mdi-4fe99e39.js +1 -0
- package/dist/assets/prismeditor.esm-3002a813.js +7 -0
- package/dist/assets/qr-scanner-worker.min-5f44a019.js +98 -0
- package/dist/assets/vuedraggable.umd-441070b9.js +8 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.html +47 -0
- package/dist/logo.png +0 -0
- package/dist/logo.svg +32 -0
- package/dist/manifest.webmanifest +1 -0
- package/dist/maskable-icon-512x512.png +0 -0
- package/dist/pwa-192x192.png +0 -0
- package/dist/pwa-512x512.png +0 -0
- package/dist/pwa-64x64.png +0 -0
- package/dist/registerSW.js +1 -0
- package/dist/star.svg +3 -0
- package/dist/sw.js +1232 -0
- package/package.json +217 -0
- package/public/apple-touch-icon-180x180.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/logo.png +0 -0
- package/public/logo.svg +32 -0
- package/public/maskable-icon-512x512.png +0 -0
- package/public/pwa-192x192.png +0 -0
- package/public/pwa-512x512.png +0 -0
- package/public/pwa-64x64.png +0 -0
- package/public/star.svg +3 -0
- package/server/app.js +1201 -0
- package/server/bin/www.js +70 -0
- package/server/config/app.js +22 -0
- package/server/config/store.js +19 -0
- package/server/hass/configurations.js +195 -0
- package/server/hass/devices.js +397 -0
- package/server/lib/BackupManager.js +134 -0
- package/server/lib/Constants.js +705 -0
- package/server/lib/CustomPlugin.js +9 -0
- package/server/lib/EventEmitter.js +14 -0
- package/server/lib/Gateway.js +1986 -0
- package/server/lib/MqttClient.js +418 -0
- package/server/lib/SocketEvents.js +34 -0
- package/server/lib/SocketManager.js +71 -0
- package/server/lib/ZwaveClient.js +4261 -0
- package/server/lib/jsonStore.js +139 -0
- package/server/lib/logger.js +169 -0
- package/server/lib/utils.js +283 -0
- package/snippets/access-store-dir.js +12 -0
- package/snippets/clone-config.js +17 -0
- package/snippets/pingNodes.js +14 -0
- package/snippets/reinterview-nodes.js +64 -0
package/dist/sw.js
ADDED
|
@@ -0,0 +1,1232 @@
|
|
|
1
|
+
try {
|
|
2
|
+
self["workbox:core:7.0.0"] && _();
|
|
3
|
+
} catch {
|
|
4
|
+
}
|
|
5
|
+
const N = (a, ...e) => {
|
|
6
|
+
let t = a;
|
|
7
|
+
return e.length > 0 && (t += ` :: ${JSON.stringify(e)}`), t;
|
|
8
|
+
}, x = N;
|
|
9
|
+
class l extends Error {
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {string} errorCode The error code that
|
|
13
|
+
* identifies this particular error.
|
|
14
|
+
* @param {Object=} details Any relevant arguments
|
|
15
|
+
* that will help developers identify issues should
|
|
16
|
+
* be added as a key on the context object.
|
|
17
|
+
*/
|
|
18
|
+
constructor(e, t) {
|
|
19
|
+
const s = x(e, t);
|
|
20
|
+
super(s), this.name = e, this.details = t;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const f = {
|
|
24
|
+
googleAnalytics: "googleAnalytics",
|
|
25
|
+
precache: "precache-v2",
|
|
26
|
+
prefix: "workbox",
|
|
27
|
+
runtime: "runtime",
|
|
28
|
+
suffix: typeof registration < "u" ? registration.scope : ""
|
|
29
|
+
}, b = (a) => [f.prefix, a, f.suffix].filter((e) => e && e.length > 0).join("-"), v = (a) => {
|
|
30
|
+
for (const e of Object.keys(f))
|
|
31
|
+
a(e);
|
|
32
|
+
}, C = {
|
|
33
|
+
updateDetails: (a) => {
|
|
34
|
+
v((e) => {
|
|
35
|
+
typeof a[e] == "string" && (f[e] = a[e]);
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
getGoogleAnalyticsName: (a) => a || b(f.googleAnalytics),
|
|
39
|
+
getPrecacheName: (a) => a || b(f.precache),
|
|
40
|
+
getPrefix: () => f.prefix,
|
|
41
|
+
getRuntimeName: (a) => a || b(f.runtime),
|
|
42
|
+
getSuffix: () => f.suffix
|
|
43
|
+
};
|
|
44
|
+
function k(a, e) {
|
|
45
|
+
const t = e();
|
|
46
|
+
return a.waitUntil(t), t;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
self["workbox:precaching:7.0.0"] && _();
|
|
50
|
+
} catch {
|
|
51
|
+
}
|
|
52
|
+
const E = "__WB_REVISION__";
|
|
53
|
+
function O(a) {
|
|
54
|
+
if (!a)
|
|
55
|
+
throw new l("add-to-cache-list-unexpected-type", { entry: a });
|
|
56
|
+
if (typeof a == "string") {
|
|
57
|
+
const r = new URL(a, location.href);
|
|
58
|
+
return {
|
|
59
|
+
cacheKey: r.href,
|
|
60
|
+
url: r.href
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const { revision: e, url: t } = a;
|
|
64
|
+
if (!t)
|
|
65
|
+
throw new l("add-to-cache-list-unexpected-type", { entry: a });
|
|
66
|
+
if (!e) {
|
|
67
|
+
const r = new URL(t, location.href);
|
|
68
|
+
return {
|
|
69
|
+
cacheKey: r.href,
|
|
70
|
+
url: r.href
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const s = new URL(t, location.href), n = new URL(t, location.href);
|
|
74
|
+
return s.searchParams.set(E, e), {
|
|
75
|
+
cacheKey: s.href,
|
|
76
|
+
url: n.href
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
class I {
|
|
80
|
+
constructor() {
|
|
81
|
+
this.updatedURLs = [], this.notUpdatedURLs = [], this.handlerWillStart = async ({ request: e, state: t }) => {
|
|
82
|
+
t && (t.originalRequest = e);
|
|
83
|
+
}, this.cachedResponseWillBeUsed = async ({ event: e, state: t, cachedResponse: s }) => {
|
|
84
|
+
if (e.type === "install" && t && t.originalRequest && t.originalRequest instanceof Request) {
|
|
85
|
+
const n = t.originalRequest.url;
|
|
86
|
+
s ? this.notUpdatedURLs.push(n) : this.updatedURLs.push(n);
|
|
87
|
+
}
|
|
88
|
+
return s;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
class M {
|
|
93
|
+
constructor({ precacheController: e }) {
|
|
94
|
+
this.cacheKeyWillBeUsed = async ({ request: t, params: s }) => {
|
|
95
|
+
const n = (s == null ? void 0 : s.cacheKey) || this._precacheController.getCacheKeyForURL(t.url);
|
|
96
|
+
return n ? new Request(n, { headers: t.headers }) : t;
|
|
97
|
+
}, this._precacheController = e;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
let p;
|
|
101
|
+
function D() {
|
|
102
|
+
if (p === void 0) {
|
|
103
|
+
const a = new Response("");
|
|
104
|
+
if ("body" in a)
|
|
105
|
+
try {
|
|
106
|
+
new Response(a.body), p = !0;
|
|
107
|
+
} catch {
|
|
108
|
+
p = !1;
|
|
109
|
+
}
|
|
110
|
+
p = !1;
|
|
111
|
+
}
|
|
112
|
+
return p;
|
|
113
|
+
}
|
|
114
|
+
async function W(a, e) {
|
|
115
|
+
let t = null;
|
|
116
|
+
if (a.url && (t = new URL(a.url).origin), t !== self.location.origin)
|
|
117
|
+
throw new l("cross-origin-copy-response", { origin: t });
|
|
118
|
+
const s = a.clone(), n = {
|
|
119
|
+
headers: new Headers(s.headers),
|
|
120
|
+
status: s.status,
|
|
121
|
+
statusText: s.statusText
|
|
122
|
+
}, r = e ? e(n) : n, c = D() ? s.body : await s.blob();
|
|
123
|
+
return new Response(c, r);
|
|
124
|
+
}
|
|
125
|
+
const q = (a) => new URL(String(a), location.href).href.replace(new RegExp(`^${location.origin}`), "");
|
|
126
|
+
function P(a, e) {
|
|
127
|
+
const t = new URL(a);
|
|
128
|
+
for (const s of e)
|
|
129
|
+
t.searchParams.delete(s);
|
|
130
|
+
return t.href;
|
|
131
|
+
}
|
|
132
|
+
async function A(a, e, t, s) {
|
|
133
|
+
const n = P(e.url, t);
|
|
134
|
+
if (e.url === n)
|
|
135
|
+
return a.match(e, s);
|
|
136
|
+
const r = Object.assign(Object.assign({}, s), { ignoreSearch: !0 }), c = await a.keys(e, r);
|
|
137
|
+
for (const i of c) {
|
|
138
|
+
const o = P(i.url, t);
|
|
139
|
+
if (n === o)
|
|
140
|
+
return a.match(i, s);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
class S {
|
|
144
|
+
/**
|
|
145
|
+
* Creates a promise and exposes its resolve and reject functions as methods.
|
|
146
|
+
*/
|
|
147
|
+
constructor() {
|
|
148
|
+
this.promise = new Promise((e, t) => {
|
|
149
|
+
this.resolve = e, this.reject = t;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const j = /* @__PURE__ */ new Set();
|
|
154
|
+
async function F() {
|
|
155
|
+
for (const a of j)
|
|
156
|
+
await a();
|
|
157
|
+
}
|
|
158
|
+
function H(a) {
|
|
159
|
+
return new Promise((e) => setTimeout(e, a));
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
self["workbox:strategies:7.0.0"] && _();
|
|
163
|
+
} catch {
|
|
164
|
+
}
|
|
165
|
+
function m(a) {
|
|
166
|
+
return typeof a == "string" ? new Request(a) : a;
|
|
167
|
+
}
|
|
168
|
+
class B {
|
|
169
|
+
/**
|
|
170
|
+
* Creates a new instance associated with the passed strategy and event
|
|
171
|
+
* that's handling the request.
|
|
172
|
+
*
|
|
173
|
+
* The constructor also initializes the state that will be passed to each of
|
|
174
|
+
* the plugins handling this request.
|
|
175
|
+
*
|
|
176
|
+
* @param {workbox-strategies.Strategy} strategy
|
|
177
|
+
* @param {Object} options
|
|
178
|
+
* @param {Request|string} options.request A request to run this strategy for.
|
|
179
|
+
* @param {ExtendableEvent} options.event The event associated with the
|
|
180
|
+
* request.
|
|
181
|
+
* @param {URL} [options.url]
|
|
182
|
+
* @param {*} [options.params] The return value from the
|
|
183
|
+
* {@link workbox-routing~matchCallback} (if applicable).
|
|
184
|
+
*/
|
|
185
|
+
constructor(e, t) {
|
|
186
|
+
this._cacheKeys = {}, Object.assign(this, t), this.event = t.event, this._strategy = e, this._handlerDeferred = new S(), this._extendLifetimePromises = [], this._plugins = [...e.plugins], this._pluginStateMap = /* @__PURE__ */ new Map();
|
|
187
|
+
for (const s of this._plugins)
|
|
188
|
+
this._pluginStateMap.set(s, {});
|
|
189
|
+
this.event.waitUntil(this._handlerDeferred.promise);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Fetches a given request (and invokes any applicable plugin callback
|
|
193
|
+
* methods) using the `fetchOptions` (for non-navigation requests) and
|
|
194
|
+
* `plugins` defined on the `Strategy` object.
|
|
195
|
+
*
|
|
196
|
+
* The following plugin lifecycle methods are invoked when using this method:
|
|
197
|
+
* - `requestWillFetch()`
|
|
198
|
+
* - `fetchDidSucceed()`
|
|
199
|
+
* - `fetchDidFail()`
|
|
200
|
+
*
|
|
201
|
+
* @param {Request|string} input The URL or request to fetch.
|
|
202
|
+
* @return {Promise<Response>}
|
|
203
|
+
*/
|
|
204
|
+
async fetch(e) {
|
|
205
|
+
const { event: t } = this;
|
|
206
|
+
let s = m(e);
|
|
207
|
+
if (s.mode === "navigate" && t instanceof FetchEvent && t.preloadResponse) {
|
|
208
|
+
const c = await t.preloadResponse;
|
|
209
|
+
if (c)
|
|
210
|
+
return c;
|
|
211
|
+
}
|
|
212
|
+
const n = this.hasCallback("fetchDidFail") ? s.clone() : null;
|
|
213
|
+
try {
|
|
214
|
+
for (const c of this.iterateCallbacks("requestWillFetch"))
|
|
215
|
+
s = await c({ request: s.clone(), event: t });
|
|
216
|
+
} catch (c) {
|
|
217
|
+
if (c instanceof Error)
|
|
218
|
+
throw new l("plugin-error-request-will-fetch", {
|
|
219
|
+
thrownErrorMessage: c.message
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
const r = s.clone();
|
|
223
|
+
try {
|
|
224
|
+
let c;
|
|
225
|
+
c = await fetch(s, s.mode === "navigate" ? void 0 : this._strategy.fetchOptions);
|
|
226
|
+
for (const i of this.iterateCallbacks("fetchDidSucceed"))
|
|
227
|
+
c = await i({
|
|
228
|
+
event: t,
|
|
229
|
+
request: r,
|
|
230
|
+
response: c
|
|
231
|
+
});
|
|
232
|
+
return c;
|
|
233
|
+
} catch (c) {
|
|
234
|
+
throw n && await this.runCallbacks("fetchDidFail", {
|
|
235
|
+
error: c,
|
|
236
|
+
event: t,
|
|
237
|
+
originalRequest: n.clone(),
|
|
238
|
+
request: r.clone()
|
|
239
|
+
}), c;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Calls `this.fetch()` and (in the background) runs `this.cachePut()` on
|
|
244
|
+
* the response generated by `this.fetch()`.
|
|
245
|
+
*
|
|
246
|
+
* The call to `this.cachePut()` automatically invokes `this.waitUntil()`,
|
|
247
|
+
* so you do not have to manually call `waitUntil()` on the event.
|
|
248
|
+
*
|
|
249
|
+
* @param {Request|string} input The request or URL to fetch and cache.
|
|
250
|
+
* @return {Promise<Response>}
|
|
251
|
+
*/
|
|
252
|
+
async fetchAndCachePut(e) {
|
|
253
|
+
const t = await this.fetch(e), s = t.clone();
|
|
254
|
+
return this.waitUntil(this.cachePut(e, s)), t;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Matches a request from the cache (and invokes any applicable plugin
|
|
258
|
+
* callback methods) using the `cacheName`, `matchOptions`, and `plugins`
|
|
259
|
+
* defined on the strategy object.
|
|
260
|
+
*
|
|
261
|
+
* The following plugin lifecycle methods are invoked when using this method:
|
|
262
|
+
* - cacheKeyWillByUsed()
|
|
263
|
+
* - cachedResponseWillByUsed()
|
|
264
|
+
*
|
|
265
|
+
* @param {Request|string} key The Request or URL to use as the cache key.
|
|
266
|
+
* @return {Promise<Response|undefined>} A matching response, if found.
|
|
267
|
+
*/
|
|
268
|
+
async cacheMatch(e) {
|
|
269
|
+
const t = m(e);
|
|
270
|
+
let s;
|
|
271
|
+
const { cacheName: n, matchOptions: r } = this._strategy, c = await this.getCacheKey(t, "read"), i = Object.assign(Object.assign({}, r), { cacheName: n });
|
|
272
|
+
s = await caches.match(c, i);
|
|
273
|
+
for (const o of this.iterateCallbacks("cachedResponseWillBeUsed"))
|
|
274
|
+
s = await o({
|
|
275
|
+
cacheName: n,
|
|
276
|
+
matchOptions: r,
|
|
277
|
+
cachedResponse: s,
|
|
278
|
+
request: c,
|
|
279
|
+
event: this.event
|
|
280
|
+
}) || void 0;
|
|
281
|
+
return s;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Puts a request/response pair in the cache (and invokes any applicable
|
|
285
|
+
* plugin callback methods) using the `cacheName` and `plugins` defined on
|
|
286
|
+
* the strategy object.
|
|
287
|
+
*
|
|
288
|
+
* The following plugin lifecycle methods are invoked when using this method:
|
|
289
|
+
* - cacheKeyWillByUsed()
|
|
290
|
+
* - cacheWillUpdate()
|
|
291
|
+
* - cacheDidUpdate()
|
|
292
|
+
*
|
|
293
|
+
* @param {Request|string} key The request or URL to use as the cache key.
|
|
294
|
+
* @param {Response} response The response to cache.
|
|
295
|
+
* @return {Promise<boolean>} `false` if a cacheWillUpdate caused the response
|
|
296
|
+
* not be cached, and `true` otherwise.
|
|
297
|
+
*/
|
|
298
|
+
async cachePut(e, t) {
|
|
299
|
+
const s = m(e);
|
|
300
|
+
await H(0);
|
|
301
|
+
const n = await this.getCacheKey(s, "write");
|
|
302
|
+
if (!t)
|
|
303
|
+
throw new l("cache-put-with-no-response", {
|
|
304
|
+
url: q(n.url)
|
|
305
|
+
});
|
|
306
|
+
const r = await this._ensureResponseSafeToCache(t);
|
|
307
|
+
if (!r)
|
|
308
|
+
return !1;
|
|
309
|
+
const { cacheName: c, matchOptions: i } = this._strategy, o = await self.caches.open(c), h = this.hasCallback("cacheDidUpdate"), g = h ? await A(
|
|
310
|
+
// TODO(philipwalton): the `__WB_REVISION__` param is a precaching
|
|
311
|
+
// feature. Consider into ways to only add this behavior if using
|
|
312
|
+
// precaching.
|
|
313
|
+
o,
|
|
314
|
+
n.clone(),
|
|
315
|
+
["__WB_REVISION__"],
|
|
316
|
+
i
|
|
317
|
+
) : null;
|
|
318
|
+
try {
|
|
319
|
+
await o.put(n, h ? r.clone() : r);
|
|
320
|
+
} catch (u) {
|
|
321
|
+
if (u instanceof Error)
|
|
322
|
+
throw u.name === "QuotaExceededError" && await F(), u;
|
|
323
|
+
}
|
|
324
|
+
for (const u of this.iterateCallbacks("cacheDidUpdate"))
|
|
325
|
+
await u({
|
|
326
|
+
cacheName: c,
|
|
327
|
+
oldResponse: g,
|
|
328
|
+
newResponse: r.clone(),
|
|
329
|
+
request: n,
|
|
330
|
+
event: this.event
|
|
331
|
+
});
|
|
332
|
+
return !0;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Checks the list of plugins for the `cacheKeyWillBeUsed` callback, and
|
|
336
|
+
* executes any of those callbacks found in sequence. The final `Request`
|
|
337
|
+
* object returned by the last plugin is treated as the cache key for cache
|
|
338
|
+
* reads and/or writes. If no `cacheKeyWillBeUsed` plugin callbacks have
|
|
339
|
+
* been registered, the passed request is returned unmodified
|
|
340
|
+
*
|
|
341
|
+
* @param {Request} request
|
|
342
|
+
* @param {string} mode
|
|
343
|
+
* @return {Promise<Request>}
|
|
344
|
+
*/
|
|
345
|
+
async getCacheKey(e, t) {
|
|
346
|
+
const s = `${e.url} | ${t}`;
|
|
347
|
+
if (!this._cacheKeys[s]) {
|
|
348
|
+
let n = e;
|
|
349
|
+
for (const r of this.iterateCallbacks("cacheKeyWillBeUsed"))
|
|
350
|
+
n = m(await r({
|
|
351
|
+
mode: t,
|
|
352
|
+
request: n,
|
|
353
|
+
event: this.event,
|
|
354
|
+
// params has a type any can't change right now.
|
|
355
|
+
params: this.params
|
|
356
|
+
// eslint-disable-line
|
|
357
|
+
}));
|
|
358
|
+
this._cacheKeys[s] = n;
|
|
359
|
+
}
|
|
360
|
+
return this._cacheKeys[s];
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Returns true if the strategy has at least one plugin with the given
|
|
364
|
+
* callback.
|
|
365
|
+
*
|
|
366
|
+
* @param {string} name The name of the callback to check for.
|
|
367
|
+
* @return {boolean}
|
|
368
|
+
*/
|
|
369
|
+
hasCallback(e) {
|
|
370
|
+
for (const t of this._strategy.plugins)
|
|
371
|
+
if (e in t)
|
|
372
|
+
return !0;
|
|
373
|
+
return !1;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Runs all plugin callbacks matching the given name, in order, passing the
|
|
377
|
+
* given param object (merged ith the current plugin state) as the only
|
|
378
|
+
* argument.
|
|
379
|
+
*
|
|
380
|
+
* Note: since this method runs all plugins, it's not suitable for cases
|
|
381
|
+
* where the return value of a callback needs to be applied prior to calling
|
|
382
|
+
* the next callback. See
|
|
383
|
+
* {@link workbox-strategies.StrategyHandler#iterateCallbacks}
|
|
384
|
+
* below for how to handle that case.
|
|
385
|
+
*
|
|
386
|
+
* @param {string} name The name of the callback to run within each plugin.
|
|
387
|
+
* @param {Object} param The object to pass as the first (and only) param
|
|
388
|
+
* when executing each callback. This object will be merged with the
|
|
389
|
+
* current plugin state prior to callback execution.
|
|
390
|
+
*/
|
|
391
|
+
async runCallbacks(e, t) {
|
|
392
|
+
for (const s of this.iterateCallbacks(e))
|
|
393
|
+
await s(t);
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Accepts a callback and returns an iterable of matching plugin callbacks,
|
|
397
|
+
* where each callback is wrapped with the current handler state (i.e. when
|
|
398
|
+
* you call each callback, whatever object parameter you pass it will
|
|
399
|
+
* be merged with the plugin's current state).
|
|
400
|
+
*
|
|
401
|
+
* @param {string} name The name fo the callback to run
|
|
402
|
+
* @return {Array<Function>}
|
|
403
|
+
*/
|
|
404
|
+
*iterateCallbacks(e) {
|
|
405
|
+
for (const t of this._strategy.plugins)
|
|
406
|
+
if (typeof t[e] == "function") {
|
|
407
|
+
const s = this._pluginStateMap.get(t);
|
|
408
|
+
yield (r) => {
|
|
409
|
+
const c = Object.assign(Object.assign({}, r), { state: s });
|
|
410
|
+
return t[e](c);
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Adds a promise to the
|
|
416
|
+
* [extend lifetime promises]{@link https://w3c.github.io/ServiceWorker/#extendableevent-extend-lifetime-promises}
|
|
417
|
+
* of the event event associated with the request being handled (usually a
|
|
418
|
+
* `FetchEvent`).
|
|
419
|
+
*
|
|
420
|
+
* Note: you can await
|
|
421
|
+
* {@link workbox-strategies.StrategyHandler~doneWaiting}
|
|
422
|
+
* to know when all added promises have settled.
|
|
423
|
+
*
|
|
424
|
+
* @param {Promise} promise A promise to add to the extend lifetime promises
|
|
425
|
+
* of the event that triggered the request.
|
|
426
|
+
*/
|
|
427
|
+
waitUntil(e) {
|
|
428
|
+
return this._extendLifetimePromises.push(e), e;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Returns a promise that resolves once all promises passed to
|
|
432
|
+
* {@link workbox-strategies.StrategyHandler~waitUntil}
|
|
433
|
+
* have settled.
|
|
434
|
+
*
|
|
435
|
+
* Note: any work done after `doneWaiting()` settles should be manually
|
|
436
|
+
* passed to an event's `waitUntil()` method (not this handler's
|
|
437
|
+
* `waitUntil()` method), otherwise the service worker thread my be killed
|
|
438
|
+
* prior to your work completing.
|
|
439
|
+
*/
|
|
440
|
+
async doneWaiting() {
|
|
441
|
+
let e;
|
|
442
|
+
for (; e = this._extendLifetimePromises.shift(); )
|
|
443
|
+
await e;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Stops running the strategy and immediately resolves any pending
|
|
447
|
+
* `waitUntil()` promises.
|
|
448
|
+
*/
|
|
449
|
+
destroy() {
|
|
450
|
+
this._handlerDeferred.resolve(null);
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* This method will call cacheWillUpdate on the available plugins (or use
|
|
454
|
+
* status === 200) to determine if the Response is safe and valid to cache.
|
|
455
|
+
*
|
|
456
|
+
* @param {Request} options.request
|
|
457
|
+
* @param {Response} options.response
|
|
458
|
+
* @return {Promise<Response|undefined>}
|
|
459
|
+
*
|
|
460
|
+
* @private
|
|
461
|
+
*/
|
|
462
|
+
async _ensureResponseSafeToCache(e) {
|
|
463
|
+
let t = e, s = !1;
|
|
464
|
+
for (const n of this.iterateCallbacks("cacheWillUpdate"))
|
|
465
|
+
if (t = await n({
|
|
466
|
+
request: this.request,
|
|
467
|
+
response: t,
|
|
468
|
+
event: this.event
|
|
469
|
+
}) || void 0, s = !0, !t)
|
|
470
|
+
break;
|
|
471
|
+
return s || t && t.status !== 200 && (t = void 0), t;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
class $ {
|
|
475
|
+
/**
|
|
476
|
+
* Creates a new instance of the strategy and sets all documented option
|
|
477
|
+
* properties as public instance properties.
|
|
478
|
+
*
|
|
479
|
+
* Note: if a custom strategy class extends the base Strategy class and does
|
|
480
|
+
* not need more than these properties, it does not need to define its own
|
|
481
|
+
* constructor.
|
|
482
|
+
*
|
|
483
|
+
* @param {Object} [options]
|
|
484
|
+
* @param {string} [options.cacheName] Cache name to store and retrieve
|
|
485
|
+
* requests. Defaults to the cache names provided by
|
|
486
|
+
* {@link workbox-core.cacheNames}.
|
|
487
|
+
* @param {Array<Object>} [options.plugins] [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}
|
|
488
|
+
* to use in conjunction with this caching strategy.
|
|
489
|
+
* @param {Object} [options.fetchOptions] Values passed along to the
|
|
490
|
+
* [`init`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)
|
|
491
|
+
* of [non-navigation](https://github.com/GoogleChrome/workbox/issues/1796)
|
|
492
|
+
* `fetch()` requests made by this strategy.
|
|
493
|
+
* @param {Object} [options.matchOptions] The
|
|
494
|
+
* [`CacheQueryOptions`]{@link https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions}
|
|
495
|
+
* for any `cache.match()` or `cache.put()` calls made by this strategy.
|
|
496
|
+
*/
|
|
497
|
+
constructor(e = {}) {
|
|
498
|
+
this.cacheName = C.getRuntimeName(e.cacheName), this.plugins = e.plugins || [], this.fetchOptions = e.fetchOptions, this.matchOptions = e.matchOptions;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Perform a request strategy and returns a `Promise` that will resolve with
|
|
502
|
+
* a `Response`, invoking all relevant plugin callbacks.
|
|
503
|
+
*
|
|
504
|
+
* When a strategy instance is registered with a Workbox
|
|
505
|
+
* {@link workbox-routing.Route}, this method is automatically
|
|
506
|
+
* called when the route matches.
|
|
507
|
+
*
|
|
508
|
+
* Alternatively, this method can be used in a standalone `FetchEvent`
|
|
509
|
+
* listener by passing it to `event.respondWith()`.
|
|
510
|
+
*
|
|
511
|
+
* @param {FetchEvent|Object} options A `FetchEvent` or an object with the
|
|
512
|
+
* properties listed below.
|
|
513
|
+
* @param {Request|string} options.request A request to run this strategy for.
|
|
514
|
+
* @param {ExtendableEvent} options.event The event associated with the
|
|
515
|
+
* request.
|
|
516
|
+
* @param {URL} [options.url]
|
|
517
|
+
* @param {*} [options.params]
|
|
518
|
+
*/
|
|
519
|
+
handle(e) {
|
|
520
|
+
const [t] = this.handleAll(e);
|
|
521
|
+
return t;
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Similar to {@link workbox-strategies.Strategy~handle}, but
|
|
525
|
+
* instead of just returning a `Promise` that resolves to a `Response` it
|
|
526
|
+
* it will return an tuple of `[response, done]` promises, where the former
|
|
527
|
+
* (`response`) is equivalent to what `handle()` returns, and the latter is a
|
|
528
|
+
* Promise that will resolve once any promises that were added to
|
|
529
|
+
* `event.waitUntil()` as part of performing the strategy have completed.
|
|
530
|
+
*
|
|
531
|
+
* You can await the `done` promise to ensure any extra work performed by
|
|
532
|
+
* the strategy (usually caching responses) completes successfully.
|
|
533
|
+
*
|
|
534
|
+
* @param {FetchEvent|Object} options A `FetchEvent` or an object with the
|
|
535
|
+
* properties listed below.
|
|
536
|
+
* @param {Request|string} options.request A request to run this strategy for.
|
|
537
|
+
* @param {ExtendableEvent} options.event The event associated with the
|
|
538
|
+
* request.
|
|
539
|
+
* @param {URL} [options.url]
|
|
540
|
+
* @param {*} [options.params]
|
|
541
|
+
* @return {Array<Promise>} A tuple of [response, done]
|
|
542
|
+
* promises that can be used to determine when the response resolves as
|
|
543
|
+
* well as when the handler has completed all its work.
|
|
544
|
+
*/
|
|
545
|
+
handleAll(e) {
|
|
546
|
+
e instanceof FetchEvent && (e = {
|
|
547
|
+
event: e,
|
|
548
|
+
request: e.request
|
|
549
|
+
});
|
|
550
|
+
const t = e.event, s = typeof e.request == "string" ? new Request(e.request) : e.request, n = "params" in e ? e.params : void 0, r = new B(this, { event: t, request: s, params: n }), c = this._getResponse(r, s, t), i = this._awaitComplete(c, r, s, t);
|
|
551
|
+
return [c, i];
|
|
552
|
+
}
|
|
553
|
+
async _getResponse(e, t, s) {
|
|
554
|
+
await e.runCallbacks("handlerWillStart", { event: s, request: t });
|
|
555
|
+
let n;
|
|
556
|
+
try {
|
|
557
|
+
if (n = await this._handle(t, e), !n || n.type === "error")
|
|
558
|
+
throw new l("no-response", { url: t.url });
|
|
559
|
+
} catch (r) {
|
|
560
|
+
if (r instanceof Error) {
|
|
561
|
+
for (const c of e.iterateCallbacks("handlerDidError"))
|
|
562
|
+
if (n = await c({ error: r, event: s, request: t }), n)
|
|
563
|
+
break;
|
|
564
|
+
}
|
|
565
|
+
if (!n)
|
|
566
|
+
throw r;
|
|
567
|
+
}
|
|
568
|
+
for (const r of e.iterateCallbacks("handlerWillRespond"))
|
|
569
|
+
n = await r({ event: s, request: t, response: n });
|
|
570
|
+
return n;
|
|
571
|
+
}
|
|
572
|
+
async _awaitComplete(e, t, s, n) {
|
|
573
|
+
let r, c;
|
|
574
|
+
try {
|
|
575
|
+
r = await e;
|
|
576
|
+
} catch {
|
|
577
|
+
}
|
|
578
|
+
try {
|
|
579
|
+
await t.runCallbacks("handlerDidRespond", {
|
|
580
|
+
event: n,
|
|
581
|
+
request: s,
|
|
582
|
+
response: r
|
|
583
|
+
}), await t.doneWaiting();
|
|
584
|
+
} catch (i) {
|
|
585
|
+
i instanceof Error && (c = i);
|
|
586
|
+
}
|
|
587
|
+
if (await t.runCallbacks("handlerDidComplete", {
|
|
588
|
+
event: n,
|
|
589
|
+
request: s,
|
|
590
|
+
response: r,
|
|
591
|
+
error: c
|
|
592
|
+
}), t.destroy(), c)
|
|
593
|
+
throw c;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
class d extends $ {
|
|
597
|
+
/**
|
|
598
|
+
*
|
|
599
|
+
* @param {Object} [options]
|
|
600
|
+
* @param {string} [options.cacheName] Cache name to store and retrieve
|
|
601
|
+
* requests. Defaults to the cache names provided by
|
|
602
|
+
* {@link workbox-core.cacheNames}.
|
|
603
|
+
* @param {Array<Object>} [options.plugins] {@link https://developers.google.com/web/tools/workbox/guides/using-plugins|Plugins}
|
|
604
|
+
* to use in conjunction with this caching strategy.
|
|
605
|
+
* @param {Object} [options.fetchOptions] Values passed along to the
|
|
606
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters|init}
|
|
607
|
+
* of all fetch() requests made by this strategy.
|
|
608
|
+
* @param {Object} [options.matchOptions] The
|
|
609
|
+
* {@link https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions|CacheQueryOptions}
|
|
610
|
+
* for any `cache.match()` or `cache.put()` calls made by this strategy.
|
|
611
|
+
* @param {boolean} [options.fallbackToNetwork=true] Whether to attempt to
|
|
612
|
+
* get the response from the network if there's a precache miss.
|
|
613
|
+
*/
|
|
614
|
+
constructor(e = {}) {
|
|
615
|
+
e.cacheName = C.getPrecacheName(e.cacheName), super(e), this._fallbackToNetwork = e.fallbackToNetwork !== !1, this.plugins.push(d.copyRedirectedCacheableResponsesPlugin);
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* @private
|
|
619
|
+
* @param {Request|string} request A request to run this strategy for.
|
|
620
|
+
* @param {workbox-strategies.StrategyHandler} handler The event that
|
|
621
|
+
* triggered the request.
|
|
622
|
+
* @return {Promise<Response>}
|
|
623
|
+
*/
|
|
624
|
+
async _handle(e, t) {
|
|
625
|
+
const s = await t.cacheMatch(e);
|
|
626
|
+
return s || (t.event && t.event.type === "install" ? await this._handleInstall(e, t) : await this._handleFetch(e, t));
|
|
627
|
+
}
|
|
628
|
+
async _handleFetch(e, t) {
|
|
629
|
+
let s;
|
|
630
|
+
const n = t.params || {};
|
|
631
|
+
if (this._fallbackToNetwork) {
|
|
632
|
+
const r = n.integrity, c = e.integrity, i = !c || c === r;
|
|
633
|
+
s = await t.fetch(new Request(e, {
|
|
634
|
+
integrity: e.mode !== "no-cors" ? c || r : void 0
|
|
635
|
+
})), r && i && e.mode !== "no-cors" && (this._useDefaultCacheabilityPluginIfNeeded(), await t.cachePut(e, s.clone()));
|
|
636
|
+
} else
|
|
637
|
+
throw new l("missing-precache-entry", {
|
|
638
|
+
cacheName: this.cacheName,
|
|
639
|
+
url: e.url
|
|
640
|
+
});
|
|
641
|
+
return s;
|
|
642
|
+
}
|
|
643
|
+
async _handleInstall(e, t) {
|
|
644
|
+
this._useDefaultCacheabilityPluginIfNeeded();
|
|
645
|
+
const s = await t.fetch(e);
|
|
646
|
+
if (!await t.cachePut(e, s.clone()))
|
|
647
|
+
throw new l("bad-precaching-response", {
|
|
648
|
+
url: e.url,
|
|
649
|
+
status: s.status
|
|
650
|
+
});
|
|
651
|
+
return s;
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* This method is complex, as there a number of things to account for:
|
|
655
|
+
*
|
|
656
|
+
* The `plugins` array can be set at construction, and/or it might be added to
|
|
657
|
+
* to at any time before the strategy is used.
|
|
658
|
+
*
|
|
659
|
+
* At the time the strategy is used (i.e. during an `install` event), there
|
|
660
|
+
* needs to be at least one plugin that implements `cacheWillUpdate` in the
|
|
661
|
+
* array, other than `copyRedirectedCacheableResponsesPlugin`.
|
|
662
|
+
*
|
|
663
|
+
* - If this method is called and there are no suitable `cacheWillUpdate`
|
|
664
|
+
* plugins, we need to add `defaultPrecacheCacheabilityPlugin`.
|
|
665
|
+
*
|
|
666
|
+
* - If this method is called and there is exactly one `cacheWillUpdate`, then
|
|
667
|
+
* we don't have to do anything (this might be a previously added
|
|
668
|
+
* `defaultPrecacheCacheabilityPlugin`, or it might be a custom plugin).
|
|
669
|
+
*
|
|
670
|
+
* - If this method is called and there is more than one `cacheWillUpdate`,
|
|
671
|
+
* then we need to check if one is `defaultPrecacheCacheabilityPlugin`. If so,
|
|
672
|
+
* we need to remove it. (This situation is unlikely, but it could happen if
|
|
673
|
+
* the strategy is used multiple times, the first without a `cacheWillUpdate`,
|
|
674
|
+
* and then later on after manually adding a custom `cacheWillUpdate`.)
|
|
675
|
+
*
|
|
676
|
+
* See https://github.com/GoogleChrome/workbox/issues/2737 for more context.
|
|
677
|
+
*
|
|
678
|
+
* @private
|
|
679
|
+
*/
|
|
680
|
+
_useDefaultCacheabilityPluginIfNeeded() {
|
|
681
|
+
let e = null, t = 0;
|
|
682
|
+
for (const [s, n] of this.plugins.entries())
|
|
683
|
+
n !== d.copyRedirectedCacheableResponsesPlugin && (n === d.defaultPrecacheCacheabilityPlugin && (e = s), n.cacheWillUpdate && t++);
|
|
684
|
+
t === 0 ? this.plugins.push(d.defaultPrecacheCacheabilityPlugin) : t > 1 && e !== null && this.plugins.splice(e, 1);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
d.defaultPrecacheCacheabilityPlugin = {
|
|
688
|
+
async cacheWillUpdate({ response: a }) {
|
|
689
|
+
return !a || a.status >= 400 ? null : a;
|
|
690
|
+
}
|
|
691
|
+
};
|
|
692
|
+
d.copyRedirectedCacheableResponsesPlugin = {
|
|
693
|
+
async cacheWillUpdate({ response: a }) {
|
|
694
|
+
return a.redirected ? await W(a) : a;
|
|
695
|
+
}
|
|
696
|
+
};
|
|
697
|
+
class G {
|
|
698
|
+
/**
|
|
699
|
+
* Create a new PrecacheController.
|
|
700
|
+
*
|
|
701
|
+
* @param {Object} [options]
|
|
702
|
+
* @param {string} [options.cacheName] The cache to use for precaching.
|
|
703
|
+
* @param {string} [options.plugins] Plugins to use when precaching as well
|
|
704
|
+
* as responding to fetch events for precached assets.
|
|
705
|
+
* @param {boolean} [options.fallbackToNetwork=true] Whether to attempt to
|
|
706
|
+
* get the response from the network if there's a precache miss.
|
|
707
|
+
*/
|
|
708
|
+
constructor({ cacheName: e, plugins: t = [], fallbackToNetwork: s = !0 } = {}) {
|
|
709
|
+
this._urlsToCacheKeys = /* @__PURE__ */ new Map(), this._urlsToCacheModes = /* @__PURE__ */ new Map(), this._cacheKeysToIntegrities = /* @__PURE__ */ new Map(), this._strategy = new d({
|
|
710
|
+
cacheName: C.getPrecacheName(e),
|
|
711
|
+
plugins: [
|
|
712
|
+
...t,
|
|
713
|
+
new M({ precacheController: this })
|
|
714
|
+
],
|
|
715
|
+
fallbackToNetwork: s
|
|
716
|
+
}), this.install = this.install.bind(this), this.activate = this.activate.bind(this);
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* @type {workbox-precaching.PrecacheStrategy} The strategy created by this controller and
|
|
720
|
+
* used to cache assets and respond to fetch events.
|
|
721
|
+
*/
|
|
722
|
+
get strategy() {
|
|
723
|
+
return this._strategy;
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Adds items to the precache list, removing any duplicates and
|
|
727
|
+
* stores the files in the
|
|
728
|
+
* {@link workbox-core.cacheNames|"precache cache"} when the service
|
|
729
|
+
* worker installs.
|
|
730
|
+
*
|
|
731
|
+
* This method can be called multiple times.
|
|
732
|
+
*
|
|
733
|
+
* @param {Array<Object|string>} [entries=[]] Array of entries to precache.
|
|
734
|
+
*/
|
|
735
|
+
precache(e) {
|
|
736
|
+
this.addToCacheList(e), this._installAndActiveListenersAdded || (self.addEventListener("install", this.install), self.addEventListener("activate", this.activate), this._installAndActiveListenersAdded = !0);
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* This method will add items to the precache list, removing duplicates
|
|
740
|
+
* and ensuring the information is valid.
|
|
741
|
+
*
|
|
742
|
+
* @param {Array<workbox-precaching.PrecacheController.PrecacheEntry|string>} entries
|
|
743
|
+
* Array of entries to precache.
|
|
744
|
+
*/
|
|
745
|
+
addToCacheList(e) {
|
|
746
|
+
const t = [];
|
|
747
|
+
for (const s of e) {
|
|
748
|
+
typeof s == "string" ? t.push(s) : s && s.revision === void 0 && t.push(s.url);
|
|
749
|
+
const { cacheKey: n, url: r } = O(s), c = typeof s != "string" && s.revision ? "reload" : "default";
|
|
750
|
+
if (this._urlsToCacheKeys.has(r) && this._urlsToCacheKeys.get(r) !== n)
|
|
751
|
+
throw new l("add-to-cache-list-conflicting-entries", {
|
|
752
|
+
firstEntry: this._urlsToCacheKeys.get(r),
|
|
753
|
+
secondEntry: n
|
|
754
|
+
});
|
|
755
|
+
if (typeof s != "string" && s.integrity) {
|
|
756
|
+
if (this._cacheKeysToIntegrities.has(n) && this._cacheKeysToIntegrities.get(n) !== s.integrity)
|
|
757
|
+
throw new l("add-to-cache-list-conflicting-integrities", {
|
|
758
|
+
url: r
|
|
759
|
+
});
|
|
760
|
+
this._cacheKeysToIntegrities.set(n, s.integrity);
|
|
761
|
+
}
|
|
762
|
+
if (this._urlsToCacheKeys.set(r, n), this._urlsToCacheModes.set(r, c), t.length > 0) {
|
|
763
|
+
const i = `Workbox is precaching URLs without revision info: ${t.join(", ")}
|
|
764
|
+
This is generally NOT safe. Learn more at https://bit.ly/wb-precache`;
|
|
765
|
+
console.warn(i);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Precaches new and updated assets. Call this method from the service worker
|
|
771
|
+
* install event.
|
|
772
|
+
*
|
|
773
|
+
* Note: this method calls `event.waitUntil()` for you, so you do not need
|
|
774
|
+
* to call it yourself in your event handlers.
|
|
775
|
+
*
|
|
776
|
+
* @param {ExtendableEvent} event
|
|
777
|
+
* @return {Promise<workbox-precaching.InstallResult>}
|
|
778
|
+
*/
|
|
779
|
+
install(e) {
|
|
780
|
+
return k(e, async () => {
|
|
781
|
+
const t = new I();
|
|
782
|
+
this.strategy.plugins.push(t);
|
|
783
|
+
for (const [r, c] of this._urlsToCacheKeys) {
|
|
784
|
+
const i = this._cacheKeysToIntegrities.get(c), o = this._urlsToCacheModes.get(r), h = new Request(r, {
|
|
785
|
+
integrity: i,
|
|
786
|
+
cache: o,
|
|
787
|
+
credentials: "same-origin"
|
|
788
|
+
});
|
|
789
|
+
await Promise.all(this.strategy.handleAll({
|
|
790
|
+
params: { cacheKey: c },
|
|
791
|
+
request: h,
|
|
792
|
+
event: e
|
|
793
|
+
}));
|
|
794
|
+
}
|
|
795
|
+
const { updatedURLs: s, notUpdatedURLs: n } = t;
|
|
796
|
+
return { updatedURLs: s, notUpdatedURLs: n };
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Deletes assets that are no longer present in the current precache manifest.
|
|
801
|
+
* Call this method from the service worker activate event.
|
|
802
|
+
*
|
|
803
|
+
* Note: this method calls `event.waitUntil()` for you, so you do not need
|
|
804
|
+
* to call it yourself in your event handlers.
|
|
805
|
+
*
|
|
806
|
+
* @param {ExtendableEvent} event
|
|
807
|
+
* @return {Promise<workbox-precaching.CleanupResult>}
|
|
808
|
+
*/
|
|
809
|
+
activate(e) {
|
|
810
|
+
return k(e, async () => {
|
|
811
|
+
const t = await self.caches.open(this.strategy.cacheName), s = await t.keys(), n = new Set(this._urlsToCacheKeys.values()), r = [];
|
|
812
|
+
for (const c of s)
|
|
813
|
+
n.has(c.url) || (await t.delete(c), r.push(c.url));
|
|
814
|
+
return { deletedURLs: r };
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* Returns a mapping of a precached URL to the corresponding cache key, taking
|
|
819
|
+
* into account the revision information for the URL.
|
|
820
|
+
*
|
|
821
|
+
* @return {Map<string, string>} A URL to cache key mapping.
|
|
822
|
+
*/
|
|
823
|
+
getURLsToCacheKeys() {
|
|
824
|
+
return this._urlsToCacheKeys;
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* Returns a list of all the URLs that have been precached by the current
|
|
828
|
+
* service worker.
|
|
829
|
+
*
|
|
830
|
+
* @return {Array<string>} The precached URLs.
|
|
831
|
+
*/
|
|
832
|
+
getCachedURLs() {
|
|
833
|
+
return [...this._urlsToCacheKeys.keys()];
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* Returns the cache key used for storing a given URL. If that URL is
|
|
837
|
+
* unversioned, like `/index.html', then the cache key will be the original
|
|
838
|
+
* URL with a search parameter appended to it.
|
|
839
|
+
*
|
|
840
|
+
* @param {string} url A URL whose cache key you want to look up.
|
|
841
|
+
* @return {string} The versioned URL that corresponds to a cache key
|
|
842
|
+
* for the original URL, or undefined if that URL isn't precached.
|
|
843
|
+
*/
|
|
844
|
+
getCacheKeyForURL(e) {
|
|
845
|
+
const t = new URL(e, location.href);
|
|
846
|
+
return this._urlsToCacheKeys.get(t.href);
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* @param {string} url A cache key whose SRI you want to look up.
|
|
850
|
+
* @return {string} The subresource integrity associated with the cache key,
|
|
851
|
+
* or undefined if it's not set.
|
|
852
|
+
*/
|
|
853
|
+
getIntegrityForCacheKey(e) {
|
|
854
|
+
return this._cacheKeysToIntegrities.get(e);
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* This acts as a drop-in replacement for
|
|
858
|
+
* [`cache.match()`](https://developer.mozilla.org/en-US/docs/Web/API/Cache/match)
|
|
859
|
+
* with the following differences:
|
|
860
|
+
*
|
|
861
|
+
* - It knows what the name of the precache is, and only checks in that cache.
|
|
862
|
+
* - It allows you to pass in an "original" URL without versioning parameters,
|
|
863
|
+
* and it will automatically look up the correct cache key for the currently
|
|
864
|
+
* active revision of that URL.
|
|
865
|
+
*
|
|
866
|
+
* E.g., `matchPrecache('index.html')` will find the correct precached
|
|
867
|
+
* response for the currently active service worker, even if the actual cache
|
|
868
|
+
* key is `'/index.html?__WB_REVISION__=1234abcd'`.
|
|
869
|
+
*
|
|
870
|
+
* @param {string|Request} request The key (without revisioning parameters)
|
|
871
|
+
* to look up in the precache.
|
|
872
|
+
* @return {Promise<Response|undefined>}
|
|
873
|
+
*/
|
|
874
|
+
async matchPrecache(e) {
|
|
875
|
+
const t = e instanceof Request ? e.url : e, s = this.getCacheKeyForURL(t);
|
|
876
|
+
if (s)
|
|
877
|
+
return (await self.caches.open(this.strategy.cacheName)).match(s);
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* Returns a function that looks up `url` in the precache (taking into
|
|
881
|
+
* account revision information), and returns the corresponding `Response`.
|
|
882
|
+
*
|
|
883
|
+
* @param {string} url The precached URL which will be used to lookup the
|
|
884
|
+
* `Response`.
|
|
885
|
+
* @return {workbox-routing~handlerCallback}
|
|
886
|
+
*/
|
|
887
|
+
createHandlerBoundToURL(e) {
|
|
888
|
+
const t = this.getCacheKeyForURL(e);
|
|
889
|
+
if (!t)
|
|
890
|
+
throw new l("non-precached-url", { url: e });
|
|
891
|
+
return (s) => (s.request = new Request(e), s.params = Object.assign({ cacheKey: t }, s.params), this.strategy.handle(s));
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
let U;
|
|
895
|
+
const K = () => (U || (U = new G()), U);
|
|
896
|
+
try {
|
|
897
|
+
self["workbox:routing:7.0.0"] && _();
|
|
898
|
+
} catch {
|
|
899
|
+
}
|
|
900
|
+
const T = "GET", R = (a) => a && typeof a == "object" ? a : { handle: a };
|
|
901
|
+
class w {
|
|
902
|
+
/**
|
|
903
|
+
* Constructor for Route class.
|
|
904
|
+
*
|
|
905
|
+
* @param {workbox-routing~matchCallback} match
|
|
906
|
+
* A callback function that determines whether the route matches a given
|
|
907
|
+
* `fetch` event by returning a non-falsy value.
|
|
908
|
+
* @param {workbox-routing~handlerCallback} handler A callback
|
|
909
|
+
* function that returns a Promise resolving to a Response.
|
|
910
|
+
* @param {string} [method='GET'] The HTTP method to match the Route
|
|
911
|
+
* against.
|
|
912
|
+
*/
|
|
913
|
+
constructor(e, t, s = T) {
|
|
914
|
+
this.handler = R(t), this.match = e, this.method = s;
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
*
|
|
918
|
+
* @param {workbox-routing-handlerCallback} handler A callback
|
|
919
|
+
* function that returns a Promise resolving to a Response
|
|
920
|
+
*/
|
|
921
|
+
setCatchHandler(e) {
|
|
922
|
+
this.catchHandler = R(e);
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
class V extends w {
|
|
926
|
+
/**
|
|
927
|
+
* If the regular expression contains
|
|
928
|
+
* [capture groups]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#grouping-back-references},
|
|
929
|
+
* the captured values will be passed to the
|
|
930
|
+
* {@link workbox-routing~handlerCallback} `params`
|
|
931
|
+
* argument.
|
|
932
|
+
*
|
|
933
|
+
* @param {RegExp} regExp The regular expression to match against URLs.
|
|
934
|
+
* @param {workbox-routing~handlerCallback} handler A callback
|
|
935
|
+
* function that returns a Promise resulting in a Response.
|
|
936
|
+
* @param {string} [method='GET'] The HTTP method to match the Route
|
|
937
|
+
* against.
|
|
938
|
+
*/
|
|
939
|
+
constructor(e, t, s) {
|
|
940
|
+
const n = ({ url: r }) => {
|
|
941
|
+
const c = e.exec(r.href);
|
|
942
|
+
if (c && !(r.origin !== location.origin && c.index !== 0))
|
|
943
|
+
return c.slice(1);
|
|
944
|
+
};
|
|
945
|
+
super(n, t, s);
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
class Q {
|
|
949
|
+
/**
|
|
950
|
+
* Initializes a new Router.
|
|
951
|
+
*/
|
|
952
|
+
constructor() {
|
|
953
|
+
this._routes = /* @__PURE__ */ new Map(), this._defaultHandlerMap = /* @__PURE__ */ new Map();
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* @return {Map<string, Array<workbox-routing.Route>>} routes A `Map` of HTTP
|
|
957
|
+
* method name ('GET', etc.) to an array of all the corresponding `Route`
|
|
958
|
+
* instances that are registered.
|
|
959
|
+
*/
|
|
960
|
+
get routes() {
|
|
961
|
+
return this._routes;
|
|
962
|
+
}
|
|
963
|
+
/**
|
|
964
|
+
* Adds a fetch event listener to respond to events when a route matches
|
|
965
|
+
* the event's request.
|
|
966
|
+
*/
|
|
967
|
+
addFetchListener() {
|
|
968
|
+
self.addEventListener("fetch", (e) => {
|
|
969
|
+
const { request: t } = e, s = this.handleRequest({ request: t, event: e });
|
|
970
|
+
s && e.respondWith(s);
|
|
971
|
+
});
|
|
972
|
+
}
|
|
973
|
+
/**
|
|
974
|
+
* Adds a message event listener for URLs to cache from the window.
|
|
975
|
+
* This is useful to cache resources loaded on the page prior to when the
|
|
976
|
+
* service worker started controlling it.
|
|
977
|
+
*
|
|
978
|
+
* The format of the message data sent from the window should be as follows.
|
|
979
|
+
* Where the `urlsToCache` array may consist of URL strings or an array of
|
|
980
|
+
* URL string + `requestInit` object (the same as you'd pass to `fetch()`).
|
|
981
|
+
*
|
|
982
|
+
* ```
|
|
983
|
+
* {
|
|
984
|
+
* type: 'CACHE_URLS',
|
|
985
|
+
* payload: {
|
|
986
|
+
* urlsToCache: [
|
|
987
|
+
* './script1.js',
|
|
988
|
+
* './script2.js',
|
|
989
|
+
* ['./script3.js', {mode: 'no-cors'}],
|
|
990
|
+
* ],
|
|
991
|
+
* },
|
|
992
|
+
* }
|
|
993
|
+
* ```
|
|
994
|
+
*/
|
|
995
|
+
addCacheListener() {
|
|
996
|
+
self.addEventListener("message", (e) => {
|
|
997
|
+
if (e.data && e.data.type === "CACHE_URLS") {
|
|
998
|
+
const { payload: t } = e.data, s = Promise.all(t.urlsToCache.map((n) => {
|
|
999
|
+
typeof n == "string" && (n = [n]);
|
|
1000
|
+
const r = new Request(...n);
|
|
1001
|
+
return this.handleRequest({ request: r, event: e });
|
|
1002
|
+
}));
|
|
1003
|
+
e.waitUntil(s), e.ports && e.ports[0] && s.then(() => e.ports[0].postMessage(!0));
|
|
1004
|
+
}
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* Apply the routing rules to a FetchEvent object to get a Response from an
|
|
1009
|
+
* appropriate Route's handler.
|
|
1010
|
+
*
|
|
1011
|
+
* @param {Object} options
|
|
1012
|
+
* @param {Request} options.request The request to handle.
|
|
1013
|
+
* @param {ExtendableEvent} options.event The event that triggered the
|
|
1014
|
+
* request.
|
|
1015
|
+
* @return {Promise<Response>|undefined} A promise is returned if a
|
|
1016
|
+
* registered route can handle the request. If there is no matching
|
|
1017
|
+
* route and there's no `defaultHandler`, `undefined` is returned.
|
|
1018
|
+
*/
|
|
1019
|
+
handleRequest({ request: e, event: t }) {
|
|
1020
|
+
const s = new URL(e.url, location.href);
|
|
1021
|
+
if (!s.protocol.startsWith("http"))
|
|
1022
|
+
return;
|
|
1023
|
+
const n = s.origin === location.origin, { params: r, route: c } = this.findMatchingRoute({
|
|
1024
|
+
event: t,
|
|
1025
|
+
request: e,
|
|
1026
|
+
sameOrigin: n,
|
|
1027
|
+
url: s
|
|
1028
|
+
});
|
|
1029
|
+
let i = c && c.handler;
|
|
1030
|
+
const o = e.method;
|
|
1031
|
+
if (!i && this._defaultHandlerMap.has(o) && (i = this._defaultHandlerMap.get(o)), !i)
|
|
1032
|
+
return;
|
|
1033
|
+
let h;
|
|
1034
|
+
try {
|
|
1035
|
+
h = i.handle({ url: s, request: e, event: t, params: r });
|
|
1036
|
+
} catch (u) {
|
|
1037
|
+
h = Promise.reject(u);
|
|
1038
|
+
}
|
|
1039
|
+
const g = c && c.catchHandler;
|
|
1040
|
+
return h instanceof Promise && (this._catchHandler || g) && (h = h.catch(async (u) => {
|
|
1041
|
+
if (g)
|
|
1042
|
+
try {
|
|
1043
|
+
return await g.handle({ url: s, request: e, event: t, params: r });
|
|
1044
|
+
} catch (L) {
|
|
1045
|
+
L instanceof Error && (u = L);
|
|
1046
|
+
}
|
|
1047
|
+
if (this._catchHandler)
|
|
1048
|
+
return this._catchHandler.handle({ url: s, request: e, event: t });
|
|
1049
|
+
throw u;
|
|
1050
|
+
})), h;
|
|
1051
|
+
}
|
|
1052
|
+
/**
|
|
1053
|
+
* Checks a request and URL (and optionally an event) against the list of
|
|
1054
|
+
* registered routes, and if there's a match, returns the corresponding
|
|
1055
|
+
* route along with any params generated by the match.
|
|
1056
|
+
*
|
|
1057
|
+
* @param {Object} options
|
|
1058
|
+
* @param {URL} options.url
|
|
1059
|
+
* @param {boolean} options.sameOrigin The result of comparing `url.origin`
|
|
1060
|
+
* against the current origin.
|
|
1061
|
+
* @param {Request} options.request The request to match.
|
|
1062
|
+
* @param {Event} options.event The corresponding event.
|
|
1063
|
+
* @return {Object} An object with `route` and `params` properties.
|
|
1064
|
+
* They are populated if a matching route was found or `undefined`
|
|
1065
|
+
* otherwise.
|
|
1066
|
+
*/
|
|
1067
|
+
findMatchingRoute({ url: e, sameOrigin: t, request: s, event: n }) {
|
|
1068
|
+
const r = this._routes.get(s.method) || [];
|
|
1069
|
+
for (const c of r) {
|
|
1070
|
+
let i;
|
|
1071
|
+
const o = c.match({ url: e, sameOrigin: t, request: s, event: n });
|
|
1072
|
+
if (o)
|
|
1073
|
+
return i = o, (Array.isArray(i) && i.length === 0 || o.constructor === Object && // eslint-disable-line
|
|
1074
|
+
Object.keys(o).length === 0 || typeof o == "boolean") && (i = void 0), { route: c, params: i };
|
|
1075
|
+
}
|
|
1076
|
+
return {};
|
|
1077
|
+
}
|
|
1078
|
+
/**
|
|
1079
|
+
* Define a default `handler` that's called when no routes explicitly
|
|
1080
|
+
* match the incoming request.
|
|
1081
|
+
*
|
|
1082
|
+
* Each HTTP method ('GET', 'POST', etc.) gets its own default handler.
|
|
1083
|
+
*
|
|
1084
|
+
* Without a default handler, unmatched requests will go against the
|
|
1085
|
+
* network as if there were no service worker present.
|
|
1086
|
+
*
|
|
1087
|
+
* @param {workbox-routing~handlerCallback} handler A callback
|
|
1088
|
+
* function that returns a Promise resulting in a Response.
|
|
1089
|
+
* @param {string} [method='GET'] The HTTP method to associate with this
|
|
1090
|
+
* default handler. Each method has its own default.
|
|
1091
|
+
*/
|
|
1092
|
+
setDefaultHandler(e, t = T) {
|
|
1093
|
+
this._defaultHandlerMap.set(t, R(e));
|
|
1094
|
+
}
|
|
1095
|
+
/**
|
|
1096
|
+
* If a Route throws an error while handling a request, this `handler`
|
|
1097
|
+
* will be called and given a chance to provide a response.
|
|
1098
|
+
*
|
|
1099
|
+
* @param {workbox-routing~handlerCallback} handler A callback
|
|
1100
|
+
* function that returns a Promise resulting in a Response.
|
|
1101
|
+
*/
|
|
1102
|
+
setCatchHandler(e) {
|
|
1103
|
+
this._catchHandler = R(e);
|
|
1104
|
+
}
|
|
1105
|
+
/**
|
|
1106
|
+
* Registers a route with the router.
|
|
1107
|
+
*
|
|
1108
|
+
* @param {workbox-routing.Route} route The route to register.
|
|
1109
|
+
*/
|
|
1110
|
+
registerRoute(e) {
|
|
1111
|
+
this._routes.has(e.method) || this._routes.set(e.method, []), this._routes.get(e.method).push(e);
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Unregisters a route with the router.
|
|
1115
|
+
*
|
|
1116
|
+
* @param {workbox-routing.Route} route The route to unregister.
|
|
1117
|
+
*/
|
|
1118
|
+
unregisterRoute(e) {
|
|
1119
|
+
if (!this._routes.has(e.method))
|
|
1120
|
+
throw new l("unregister-route-but-not-found-with-method", {
|
|
1121
|
+
method: e.method
|
|
1122
|
+
});
|
|
1123
|
+
const t = this._routes.get(e.method).indexOf(e);
|
|
1124
|
+
if (t > -1)
|
|
1125
|
+
this._routes.get(e.method).splice(t, 1);
|
|
1126
|
+
else
|
|
1127
|
+
throw new l("unregister-route-route-not-registered");
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
let y;
|
|
1131
|
+
const z = () => (y || (y = new Q(), y.addFetchListener(), y.addCacheListener()), y);
|
|
1132
|
+
function J(a, e, t) {
|
|
1133
|
+
let s;
|
|
1134
|
+
if (typeof a == "string") {
|
|
1135
|
+
const r = new URL(a, location.href), c = ({ url: i }) => i.href === r.href;
|
|
1136
|
+
s = new w(c, e, t);
|
|
1137
|
+
} else if (a instanceof RegExp)
|
|
1138
|
+
s = new V(a, e, t);
|
|
1139
|
+
else if (typeof a == "function")
|
|
1140
|
+
s = new w(a, e, t);
|
|
1141
|
+
else if (a instanceof w)
|
|
1142
|
+
s = a;
|
|
1143
|
+
else
|
|
1144
|
+
throw new l("unsupported-route-type", {
|
|
1145
|
+
moduleName: "workbox-routing",
|
|
1146
|
+
funcName: "registerRoute",
|
|
1147
|
+
paramName: "capture"
|
|
1148
|
+
});
|
|
1149
|
+
return z().registerRoute(s), s;
|
|
1150
|
+
}
|
|
1151
|
+
function X(a, e = []) {
|
|
1152
|
+
for (const t of [...a.searchParams.keys()])
|
|
1153
|
+
e.some((s) => s.test(t)) && a.searchParams.delete(t);
|
|
1154
|
+
return a;
|
|
1155
|
+
}
|
|
1156
|
+
function* Y(a, { ignoreURLParametersMatching: e = [/^utm_/, /^fbclid$/], directoryIndex: t = "index.html", cleanURLs: s = !0, urlManipulation: n } = {}) {
|
|
1157
|
+
const r = new URL(a, location.href);
|
|
1158
|
+
r.hash = "", yield r.href;
|
|
1159
|
+
const c = X(r, e);
|
|
1160
|
+
if (yield c.href, t && c.pathname.endsWith("/")) {
|
|
1161
|
+
const i = new URL(c.href);
|
|
1162
|
+
i.pathname += t, yield i.href;
|
|
1163
|
+
}
|
|
1164
|
+
if (s) {
|
|
1165
|
+
const i = new URL(c.href);
|
|
1166
|
+
i.pathname += ".html", yield i.href;
|
|
1167
|
+
}
|
|
1168
|
+
if (n) {
|
|
1169
|
+
const i = n({ url: r });
|
|
1170
|
+
for (const o of i)
|
|
1171
|
+
yield o.href;
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
class Z extends w {
|
|
1175
|
+
/**
|
|
1176
|
+
* @param {PrecacheController} precacheController A `PrecacheController`
|
|
1177
|
+
* instance used to both match requests and respond to fetch events.
|
|
1178
|
+
* @param {Object} [options] Options to control how requests are matched
|
|
1179
|
+
* against the list of precached URLs.
|
|
1180
|
+
* @param {string} [options.directoryIndex=index.html] The `directoryIndex` will
|
|
1181
|
+
* check cache entries for a URLs ending with '/' to see if there is a hit when
|
|
1182
|
+
* appending the `directoryIndex` value.
|
|
1183
|
+
* @param {Array<RegExp>} [options.ignoreURLParametersMatching=[/^utm_/, /^fbclid$/]] An
|
|
1184
|
+
* array of regex's to remove search params when looking for a cache match.
|
|
1185
|
+
* @param {boolean} [options.cleanURLs=true] The `cleanURLs` option will
|
|
1186
|
+
* check the cache for the URL with a `.html` added to the end of the end.
|
|
1187
|
+
* @param {workbox-precaching~urlManipulation} [options.urlManipulation]
|
|
1188
|
+
* This is a function that should take a URL and return an array of
|
|
1189
|
+
* alternative URLs that should be checked for precache matches.
|
|
1190
|
+
*/
|
|
1191
|
+
constructor(e, t) {
|
|
1192
|
+
const s = ({ request: n }) => {
|
|
1193
|
+
const r = e.getURLsToCacheKeys();
|
|
1194
|
+
for (const c of Y(n.url, t)) {
|
|
1195
|
+
const i = r.get(c);
|
|
1196
|
+
if (i) {
|
|
1197
|
+
const o = e.getIntegrityForCacheKey(i);
|
|
1198
|
+
return { cacheKey: i, integrity: o };
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
};
|
|
1202
|
+
super(s, e.strategy);
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
function ee(a) {
|
|
1206
|
+
const e = K(), t = new Z(e, a);
|
|
1207
|
+
J(t);
|
|
1208
|
+
}
|
|
1209
|
+
const te = "-precache-", se = async (a, e = te) => {
|
|
1210
|
+
const s = (await self.caches.keys()).filter((n) => n.includes(e) && n.includes(self.registration.scope) && n !== a);
|
|
1211
|
+
return await Promise.all(s.map((n) => self.caches.delete(n))), s;
|
|
1212
|
+
};
|
|
1213
|
+
function ae() {
|
|
1214
|
+
self.addEventListener("activate", (a) => {
|
|
1215
|
+
const e = C.getPrecacheName();
|
|
1216
|
+
a.waitUntil(se(e).then((t) => {
|
|
1217
|
+
}));
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
function ne(a) {
|
|
1221
|
+
K().precache(a);
|
|
1222
|
+
}
|
|
1223
|
+
function re(a, e) {
|
|
1224
|
+
ne(a), ee(e);
|
|
1225
|
+
}
|
|
1226
|
+
function ce() {
|
|
1227
|
+
self.addEventListener("activate", () => self.clients.claim());
|
|
1228
|
+
}
|
|
1229
|
+
ae();
|
|
1230
|
+
re([{"revision":null,"url":"assets/AssociationGroups-474358b5.js"},{"revision":null,"url":"assets/BgRssiChart-3e7d7555.css"},{"revision":null,"url":"assets/BgRssiChart-554c89ef.js"},{"revision":null,"url":"assets/BlinkIcon-5407e2e0.js"},{"revision":null,"url":"assets/ColumnFilter-378ec338.js"},{"revision":null,"url":"assets/ColumnFilterBoolean-e0ff8ce6.js"},{"revision":null,"url":"assets/ColumnFilterDate-b17871ea.js"},{"revision":null,"url":"assets/ColumnFilterNumber-c07930a6.js"},{"revision":null,"url":"assets/ColumnFilterString-079ac562.js"},{"revision":null,"url":"assets/ControllerChart-f2fbb771.js"},{"revision":null,"url":"assets/ControlPanel-3c3168d8.js"},{"revision":null,"url":"assets/Debug-ea34e06e.js"},{"revision":null,"url":"assets/DialogAdvanced-5f8c36c7.js"},{"revision":null,"url":"assets/DialogAdvanced-eaabda04.css"},{"revision":null,"url":"assets/DialogAssociation-6da4cd66.js"},{"revision":null,"url":"assets/DialogGatewayValue-501b7bbe.js"},{"revision":null,"url":"assets/DialogGatewayValue-911dd212.css"},{"revision":null,"url":"assets/DialogHealthCheck-2228ed6c.css"},{"revision":null,"url":"assets/DialogHealthCheck-9e90523a.js"},{"revision":null,"url":"assets/DialogSceneValue-ff3081b9.js"},{"revision":null,"url":"assets/ErrorPage-a4f837c6.js"},{"revision":null,"url":"assets/ExpandedNode-9f727a42.css"},{"revision":null,"url":"assets/ExpandedNode-a0bff765.js"},{"revision":null,"url":"assets/file-input-064e7979.js"},{"revision":null,"url":"assets/HomeAssistant-974143e2.js"},{"revision":null,"url":"assets/index-058391ec.js"},{"revision":null,"url":"assets/index-3c63af0b.js"},{"revision":null,"url":"assets/index-468a52af.js"},{"revision":null,"url":"assets/index-be785cef.css"},{"revision":null,"url":"assets/index-d98f5afd.css"},{"revision":null,"url":"assets/items-45b4c1f5.js"},{"revision":null,"url":"assets/ListInput-d8c678f2.js"},{"revision":null,"url":"assets/Login-1826b0a1.css"},{"revision":null,"url":"assets/Login-5424b4df.js"},{"revision":null,"url":"assets/mdi-4fe99e39.js"},{"revision":null,"url":"assets/Mesh-1b8d31eb.css"},{"revision":null,"url":"assets/Mesh-25b19dfe.js"},{"revision":null,"url":"assets/NodeDetails-da00c417.css"},{"revision":null,"url":"assets/NodeDetails-e9d8d566.js"},{"revision":null,"url":"assets/NodePanel-3639f227.css"},{"revision":null,"url":"assets/NodePanel-5cdb1b4a.js"},{"revision":null,"url":"assets/NodeScheduler-e91e411b.js"},{"revision":null,"url":"assets/OTAUpdates-066cbfed.js"},{"revision":null,"url":"assets/prismeditor.esm-3002a813.js"},{"revision":null,"url":"assets/qr-scanner-worker.min-5f44a019.js"},{"revision":null,"url":"assets/QrReader-00dee3fb.css"},{"revision":null,"url":"assets/QrReader-c320584c.js"},{"revision":null,"url":"assets/ReinterviewBadge-a40fb19f.js"},{"revision":null,"url":"assets/RichValue-3ea76a33.css"},{"revision":null,"url":"assets/RichValue-3f78fa98.js"},{"revision":null,"url":"assets/Scenes-4aea74b8.js"},{"revision":null,"url":"assets/Settings-ac079344.css"},{"revision":null,"url":"assets/Settings-d8e203ed.js"},{"revision":null,"url":"assets/SmartStart-63c21be6.js"},{"revision":null,"url":"assets/SmartView-f9259d20.js"},{"revision":null,"url":"assets/StatisticsArrows-40c56587.js"},{"revision":null,"url":"assets/StatisticsCard-a91596c0.js"},{"revision":null,"url":"assets/Store-701d51c8.js"},{"revision":null,"url":"assets/Store-a58f7130.css"},{"revision":null,"url":"assets/UserCodeTable-c397703b.js"},{"revision":null,"url":"assets/ValueId-b8e1e4a2.js"},{"revision":null,"url":"assets/ValueId-ea679e64.css"},{"revision":null,"url":"assets/vuedraggable.umd-441070b9.js"},{"revision":null,"url":"assets/ZwaveGraph-4fa851e3.js"},{"revision":null,"url":"assets/ZwaveGraph-fe07d4ee.css"},{"revision":"9f4424f947dd53d9e757d01479c11fd0","url":"index.html"},{"revision":"402b66900e731ca748771b6fc5e7a068","url":"registerSW.js"},{"revision":"2c3eb54f5696a20e732d2d6e1ce909ef","url":"pwa-64x64.png"},{"revision":"dd8a946cf77cce4eaeabd41dc732c883","url":"pwa-192x192.png"},{"revision":"3c2803ea3e471e905691052c8f32687c","url":"pwa-512x512.png"},{"revision":"34ca1c83c0e26a2f60b62cac1a26156b","url":"maskable-icon-512x512.png"},{"revision":"8bf37b582cbef3fb40a4ef9232b4b8b5","url":"manifest.webmanifest"}]);
|
|
1231
|
+
self.skipWaiting();
|
|
1232
|
+
ce();
|