PageSourceSearch

https://cinematicket.org/v3.62.12/ngsw-worker.js

js cinematicket.org collected 2026-09-25 07:00:48 UTC 71,442 bytes, 1,922 lines download raw bytes

vendor: 1,046 bytes, lines 1-26
1(() => {
2  var __defProp = Object.defineProperty;
3  var __defProps = Object.defineProperties;
4  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6  var __hasOwnProp = Object.prototype.hasOwnProperty;
7  var __propIsEnum = Object.prototype.propertyIsEnumerable;
8  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9  var __spreadValues = (a, b) => {
10    for (var prop in b || (b = {}))
11      if (__hasOwnProp.call(b, prop))
12        __defNormalProp(a, prop, b[prop]);
13    if (__getOwnPropSymbols)
14      for (var prop of __getOwnPropSymbols(b)) {
15        if (__propIsEnum.call(b, prop))
16          __defNormalProp(a, prop, b[prop]);
17      }
18    return a;
19  };
20  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21  var __publicField = (obj, key, value) => {
22    __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
23    return value;
24  };
25
26  
26// bazel-out/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/service-worker/worker/src/named-cache-storage.js
27  var NamedCacheStorage = class {
28    constructor(original, cacheNamePrefix) {
29      __publicField(this, "original");
30      __publicField(this, "cacheNamePrefix");
31      this.original = original;
32      this.cacheNamePrefix = cacheNamePrefix;
33    }
34    delete(cacheName) {
35      return this.original.delete(`${this.cacheNamePrefix}:${cacheName}`);
36    }
37    has(cacheName) {
38      return this.original.has(`${this.cacheNamePrefix}:${cacheName}`);
39    }
40    async keys() {
41      const prefix = `${this.cacheNamePrefix}:`;
42      const allCacheNames = await this.original.keys();
43      const ownCacheNames = allCacheNames.filter((name) => name.startsWith(prefix));
44      return ownCacheNames.map((name) => name.slice(prefix.length));
45    }
46    match(request, options) {
47      return this.original.match(request, options);
48    }
49    async open(cacheName) {
50      const cache = await this.original.open(`${this.cacheNamePrefix}:${cacheName}`);
51      return Object.assign(cache, { name: cacheName });
52    }
53  };
54
55  
55// bazel-out/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/service-worker/worker/src/adapter.js
56  var Adapter = class {
57    constructor(scopeUrl, caches) {
58      __publicField(this, "scopeUrl");
59      __publicField(this, "caches");
60      __publicField(this, "origin");
61      this.scopeUrl = scopeUrl;
62      const parsedScopeUrl = this.parseUrl(this.scopeUrl);
63      this.origin = parsedScopeUrl.origin;
64      this.caches = new NamedCacheStorage(caches, `ngsw:${parsedScopeUrl.path}`);
65    }
66    newRequest(input, init) {
67      return new Request(input, init);
68    }
69    newResponse(body, init) {
70      return new Response(body, init);
71    }
72    newHeaders(headers) {
73      return new Headers(headers);
74    }
75    isClient(source) {
76      return source instanceof Client;
77    }
78    get time() {
79      return Date.now();
80    }
81    normalizeUrl(url) {
82      const parsed = this.parseUrl(url, this.scopeUrl);
83      return parsed.origin === this.origin ? parsed.path : url;
84    }
85    parseUrl(url, relativeTo) {
86      const parsed = !relativeTo ? new URL(url) : new URL(url, relativeTo);
87      return { origin: parsed.origin, path: parsed.pathname, search: parsed.search };
88    }
89    timeout(ms) {
90      return new Promise((resolve) => {
91        setTimeout(() => resolve(), ms);
92      });
93    }
94  };
95
96  
96// bazel-out/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/service-worker/worker/src/database.js
97  var NotFound = class {
98    constructor(table, key) {
99      __publicField(this, "table");
100      __publicField(this, "key");
101      this.table = table;
102      this.key = key;
103    }
104  };
105
106  
106// bazel-out/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/service-worker/worker/src/db-cache.js
107  var CacheDatabase = class {
108    constructor(adapter2) {
109      __publicField(this, "adapter");
110      __publicField(this, "cacheNamePrefix", "db");
111      __publicField(this, "tables", /* @__PURE__ */ new Map());
112      this.adapter = adapter2;
113    }
114    "delete"(name) {
115      if (this.tables.has(name)) {
116        this.tables.delete(name);
117      }
118      return this.adapter.caches.delete(`${this.cacheNamePrefix}:${name}`);
119    }
120    async list() {
121      const prefix = `${this.cacheNamePrefix}:`;
122      const allCacheNames = await this.adapter.caches.keys();
123      const dbCacheNames = allCacheNames.filter((name) => name.startsWith(prefix));
124      return dbCacheNames.map((name) => name.slice(prefix.length));
125    }
126    async open(name, cacheQueryOptions) {
127      if (!this.tables.has(name)) {
128        const cache = await this.adapter.caches.open(`${this.cacheNamePrefix}:${name}`);
129        const table = new CacheTable(name, cache, this.adapter, cacheQueryOptions);
130        this.tables.set(name, table);
131      }
132      return this.tables.get(name);
133    }
134  };
135  var CacheTable = class {
136    constructor(name, cache, adapter2, cacheQueryOptions) {
137      __publicField(this, "name");
138      __publicField(this, "cache");
139      __publicField(this, "adapter");
140      __publicField(this, "cacheQueryOptions");
141      __publicField(this, "cacheName");
142      this.name = name;
143      this.cache = cache;
144      this.adapter = adapter2;
145      this.cacheQueryOptions = cacheQueryOptions;
146      this.cacheName = this.cache.name;
147    }
148    request(key) {
149      return this.adapter.newRequest("/" + key);
150    }
151    "delete"(key) {
152      return this.cache.delete(this.request(key), this.cacheQueryOptions);
153    }
154    keys() {
155      return this.cache.keys().then((requests) => requests.map((req) => req.url.slice(1)));
156    }
157    read(key) {
158      return this.cache.match(this.request(key), this.cacheQueryOptions).then((res) => {
159        if (res === void 0) {
160          return Promise.reject(new NotFound(this.name, key));
161        }
162        return res.json();
163      });
164    }
165    write(key, value) {
166      return this.cache.put(this.request(key), this.adapter.newResponse(JSON.stringify(value)));
167    }
168  };
169
170  
170// bazel-out/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/service-worker/worker/src/api.js
171  var UpdateCacheStatus;
172  (function(UpdateCacheStatus2) {
173    UpdateCacheStatus2[UpdateCacheStatus2["NOT_CACHED"] = 0] = "NOT_CACHED";
174    UpdateCacheStatus2[UpdateCacheStatus2["CACHED_BUT_UNUSED"] = 1] = "CACHED_BUT_UNUSED";
175    UpdateCacheStatus2[UpdateCacheStatus2["CACHED"] = 2] = "CACHED";
176  })(UpdateCacheStatus || (UpdateCacheStatus = {}));
177
178  
178// bazel-out/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/service-worker/worker/src/error.js
179  var SwCriticalError = class extends Error {
180    constructor() {
181      super(...arguments);
182      __publicField(this, "isCritical", true);
183    }
184  };
185  function errorToString(error) {
186    if (error instanceof Error) {
187      return `${error.message}
188${error.stack}`;
189    } else {
190      return `${error}`;
191    }
192  }
193  var SwUnrecoverableStateError = class extends SwCriticalError {
194    constructor() {
195      super(...arguments);
196      __publicField(this, "isUnrecoverableState", true);
197    }
198  };
199
200  
200// bazel-out/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/service-worker/worker/src/sha1.js
201  function sha1(str) {
202    const utf8 = str;
203    const words32 = stringToWords32(utf8, Endian.Big);
204    return _sha1(words32, utf8.length * 8);
205  }
206  function sha1Binary(buffer) {
207    const words32 = arrayBufferToWords32(buffer, Endian.Big);
208    return _sha1(words32, buffer.byteLength * 8);
209  }
210  function _sha1(words32, len) {
211    const w = [];
212    let [a, b, c, d, e] = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
213    words32[len >> 5] |= 128 << 24 - len % 32;
214    words32[(len + 64 >> 9 << 4) + 15] = len;
215    for (let i = 0; i < words32.length; i += 16) {
216      const [h0, h1, h2, h3, h4] = [a, b, c, d, e];
217      for (let j = 0; j < 80; j++) {
218        if (j < 16) {
219          w[j] = words32[i + j];
220        } else {
221          w[j] = rol32(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
222        }
223        const [f, k] = fk(j, b, c, d);
224        const temp = [rol32(a, 5), f, e, k, w[j]].reduce(add32);
225        [e, d, c, b, a] = [d, c, rol32(b, 30), a, temp];
226      }
227      [a, b, c, d, e] = [add32(a, h0), add32(b, h1), add32(c, h2), add32(d, h3), add32(e, h4)];
228    }
229    return byteStringToHexString(words32ToByteString([a, b, c, d, e]));
230  }
231  function add32(a, b) {
232    return add32to64(a, b)[1];
233  }
234  function add32to64(a, b) {
235    const low = (a & 65535) + (b & 65535);
236    const high = (a >>> 16) + (b >>> 16) + (low >>> 16);
237    return [high >>> 16, high << 16 | low & 65535];
238  }
239  function rol32(a, count) {
240    return a << count | a >>> 32 - count;
241  }
242  var Endian;
243  (function(Endian2) {
244    Endian2[Endian2["Little"] = 0] = "Little";
245    Endian2[Endian2["Big"] = 1] = "Big";
246  })(Endian || (Endian = {}));
247  function fk(index, b, c, d) {
248    if (index < 20) {
249      return [b & c | ~b & d, 1518500249];
250    }
251    if (index < 40) {
252      return [b ^ c ^ d, 1859775393];
253    }
254    if (index < 60) {
255      return [b & c | b & d | c & d, 2400959708];
256    }
257    return [b ^ c ^ d, 3395469782];
258  }
259  function stringToWords32(str, endian) {
260    const size = str.length + 3 >>> 2;
261    const words32 = [];
262    for (let i = 0; i < size; i++) {
263      words32[i] = wordAt(str, i * 4, endian);
264    }
265    return words32;
266  }
267  function arrayBufferToWords32(buffer, endian) {
268    const size = buffer.byteLength + 3 >>> 2;
269    const words32 = [];
270    const view = new Uint8Array(buffer);
271    for (let i = 0; i < size; i++) {
272      words32[i] = wordAt(view, i * 4, endian);
273    }
274    return words32;
275  }
276  function byteAt(str, index) {
277    if (typeof str === "string") {
278      return index >= str.length ? 0 : str.charCodeAt(index) & 255;
279    } else {
280      return index >= str.byteLength ? 0 : str[index] & 255;
281    }
282  }
283  function wordAt(str, index, endian) {
284    let word = 0;
285    if (endian === Endian.Big) {
286      for (let i = 0; i < 4; i++) {
287        word += byteAt(str, index + i) << 24 - 8 * i;
288      }
289    } else {
290      for (let i = 0; i < 4; i++) {
291        word += byteAt(str, index + i) << 8 * i;
292      }
293    }
294    return word;
295  }
296  function words32ToByteString(words32) {
297    return words32.reduce((str, word) => str + word32ToByteString(word), "");
298  }
299  function word32ToByteString(word) {
300    let str = "";
301    for (let i = 0; i < 4; i++) {
302      str += String.fromCharCode(word >>> 8 * (3 - i) & 255);
303    }
304    return str;
305  }
306  function byteStringToHexString(str) {
307    let hex = "";
308    for (let i = 0; i < str.length; i++) {
309      const b = byteAt(str, i);
310      hex += (b >>> 4).toString(16) + (b & 15).toString(16);
311    }
312    return hex.toLowerCase();
313  }
314
315  
315// bazel-out/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/service-worker/worker/src/assets.js
316  var AssetGroup = class {
317    constructor(scope2, adapter2, idle, config, hashes, db, cacheNamePrefix) {
318      __publicField(this, "scope");
319      __publicField(this, "adapter");
320      __publicField(this, "idle");
321      __publicField(this, "config");
322      __publicField(this, "hashes");
323      __publicField(this, "db");
324      __publicField(this, "inFlightRequests", /* @__PURE__ */ new Map());
325      __publicField(this, "urls", []);
326      __publicField(this, "patterns", []);
327      __publicField(this, "cache");
328      __publicField(this, "name");
329      __publicField(this, "metadata");
330      this.scope = scope2;
331      this.adapter = adapter2;
332      this.idle = idle;
333      this.config = config;
334      this.hashes = hashes;
335      this.db = db;
336      this.name = config.name;
337      this.urls = config.urls.map((url) => adapter2.normalizeUrl(url));
338      this.patterns = config.patterns.map((pattern) => new RegExp(pattern));
339      this.cache = adapter2.caches.open(`${cacheNamePrefix}:${config.name}:cache`);
340      this.metadata = this.db.open(`${cacheNamePrefix}:${config.name}:meta`, config.cacheQueryOptions);
341    }
342    async cacheStatus(url) {
343      const cache = await this.cache;
344      const meta = await this.metadata;
345      const req = this.adapter.newRequest(url);
346      const res = await cache.match(req, this.config.cacheQueryOptions);
347      if (res === void 0) {
348        return UpdateCacheStatus.NOT_CACHED;
349      }
350      try {
351        const data = await meta.read(req.url);
352        if (!data.used) {
353          return UpdateCacheStatus.CACHED_BUT_UNUSED;
354        }
355      } catch (_) {
356      }
357      return UpdateCacheStatus.CACHED;
358    }
359    async getCacheNames() {
360      const [cache, metadata] = await Promise.all([this.cache, this.metadata]);
361      return [cache.name, metadata.cacheName];
362    }
363    async handleFetch(req, _event) {
364      const url = this.adapter.normalizeUrl(req.url);
365      if (this.urls.indexOf(url) !== -1 || this.patterns.some((pattern) => pattern.test(url))) {
366        const cache = await this.cache;
367        let cachedResponse;
368        try {
369          cachedResponse = await cache.match(req, this.config.cacheQueryOptions);
370        } catch (error) {
371          throw new SwCriticalError(`Cache is throwing while looking for a match: ${error}`);
372        }
373        if (cachedResponse !== void 0) {
374          if (this.hashes.has(url)) {
375            return cachedResponse;
376          } else {
377            if (await this.needToRevalidate(req, cachedResponse)) {
378              this.idle.schedule(`revalidate(${cache.name}): ${req.url}`, async () => {
379                await this.fetchAndCacheOnce(req);
380              });
381            }
382            return cachedResponse;
383          }
384        }
385        const res = await this.fetchAndCacheOnce(this.newRequestWithMetadata(req.url, req));
386        return res.clone();
387      } else {
388        return null;
389      }
390    }
391    async needToRevalidate(req, res) {
392      if (res.headers.has("Cache-Control")) {
393        const cacheControl = res.headers.get("Cache-Control");
394        const cacheDirectives = cacheControl.split(",").map((v) => v.trim()).map((v) => v.split("="));
395        cacheDirectives.forEach((v) => v[0] = v[0].toLowerCase());
396        const maxAgeDirective = cacheDirectives.find((v) => v[0] === "max-age");
397        const cacheAge = maxAgeDirective ? maxAgeDirective[1] : void 0;
398        if (!cacheAge) {
399          return true;
400        }
401        try {
402          const maxAge = 1e3 * parseInt(cacheAge);
403          let ts;
404          try {
405            const metaTable = await this.metadata;
406            ts = (await metaTable.read(req.url)).ts;
407          } catch (e) {
408            const date = res.headers.get("Date");
409            if (date === null) {
410              return true;
411            }
412            ts = Date.parse(date);
413          }
414          const age = this.adapter.time - ts;
415          return age < 0 || age > maxAge;
416        } catch (e) {
417          return true;
418        }
419      } else if (res.headers.has("Expires")) {
420        const expiresStr = res.headers.get("Expires");
421        try {
422          return this.adapter.time > Date.parse(expiresStr);
423        } catch (e) {
424          return true;
425        }
426      } else {
427        return true;
428      }
429    }
430    async fetchFromCacheOnly(url) {
431      const cache = await this.cache;
432      const metaTable = await this.metadata;
433      const request = this.adapter.newRequest(url);
434      const response = await cache.match(request, this.config.cacheQueryOptions);
435      if (response === void 0) {
436        return null;
437      }
438      let metadata = void 0;
439      try {
440        metadata = await metaTable.read(request.url);
441      } catch (e) {
442      }
443      return { response, metadata };
444    }
445    async unhashedResources() {
446      const cache = await this.cache;
447      return (await cache.keys()).map((request) => this.adapter.normalizeUrl(request.url)).filter((url) => !this.hashes.has(url));
448    }
449    async fetchAndCacheOnce(req, used = true) {
450      if (this.inFlightRequests.has(req.url)) {
451        return this.inFlightRequests.get(req.url);
452      }
453      const fetchOp = this.fetchFromNetwork(req);
454      this.inFlightRequests.set(req.url, fetchOp);
455      try {
456        const res = await fetchOp;
457        if (!res.ok) {
458          throw new Error(`Response not Ok (fetchAndCacheOnce): request for ${req.url} returned response ${res.status} ${res.statusText}`);
459        }
460        try {
461          const cache = await this.cache;
462          await cache.put(req, res.clone());
463          if (!this.hashes.has(this.adapter.normalizeUrl(req.url))) {
464            const meta = { ts: this.adapter.time, used };
465            const metaTable = await this.metadata;
466            await metaTable.write(req.url, meta);
467          }
468          return res;
469        } catch (err) {
470          throw new SwCriticalError(`Failed to update the caches for request to '${req.url}' (fetchAndCacheOnce): ${errorToString(err)}`);
471        }
472      } finally {
473        this.inFlightRequests.delete(req.url);
474      }
475    }
476    async fetchFromNetwork(req, redirectLimit = 3) {
477      const res = await this.cacheBustedFetchFromNetwork(req);
478      if (res["redirected"] && !!res.url) {
479        if (redirectLimit === 0) {
480          throw new SwCriticalError(`Response hit redirect limit (fetchFromNetwork): request redirected too many times, next is ${res.url}`);
481        }
482        return this.fetchFromNetwork(this.newRequestWithMetadata(res.url, req), redirectLimit - 1);
483      }
484      return res;
485    }
486    async cacheBustedFetchFromNetwork(req) {
487      const url = this.adapter.normalizeUrl(req.url);
488      if (this.hashes.has(url)) {
489        const canonicalHash = this.hashes.get(url);
490        let response = await this.safeFetch(req);
491        let makeCacheBustedRequest = response.ok;
492        if (makeCacheBustedRequest) {
493          const fetchedHash = sha1Binary(await response.clone().arrayBuffer());
494          makeCacheBustedRequest = fetchedHash !== canonicalHash;
495        }
496        if (makeCacheBustedRequest) {
497          const cacheBustReq = this.newRequestWithMetadata(this.cacheBust(req.url), req);
498          response = await this.safeFetch(cacheBustReq);
499          if (response.ok) {
500            const cacheBustedHash = sha1Binary(await response.clone().arrayBuffer());
501            if (canonicalHash !== cacheBustedHash) {
502              throw new SwCriticalError(`Hash mismatch (cacheBustedFetchFromNetwork): ${req.url}: expected ${canonicalHash}, got ${cacheBustedHash} (after cache busting)`);
503            }
504          }
505        }
506        if (!response.ok && response.status === 404) {
507          throw new SwUnrecoverableStateError(`Failed to retrieve hashed resource from the server. (AssetGroup: ${this.config.name} | URL: ${url})`);
508        }
509        return response;
510      } else {
511        return this.safeFetch(req);
512      }
513    }
514    async maybeUpdate(updateFrom, req, cache) {
515      const url = this.adapter.normalizeUrl(req.url);
516      if (this.hashes.has(url)) {
517        const hash = this.hashes.get(url);
518        const res = await updateFrom.lookupResourceWithHash(url, hash);
519        if (res !== null) {
520          await cache.put(req, res);
521          return true;
522        }
523      }
524      return false;
525    }
526    newRequestWithMetadata(url, options) {
527      return this.adapter.newRequest(url, { headers: options.headers });
528    }
529    cacheBust(url) {
530      return url + (url.indexOf("?") === -1 ? "?" : "&") + "ngsw-cache-bust=" + Math.random();
531    }
532    async safeFetch(req) {
533      try {
534        return await this.scope.fetch(req);
535      } catch (e) {
536        return this.adapter.newResponse("", {
537          status: 504,
538          statusText: "Gateway Timeout"
539        });
540      }
541    }
542  };
543  var PrefetchAssetGroup = class extends AssetGroup {
544    async initializeFully(updateFrom) {
545      const cache = await this.cache;
546      await this.urls.reduce(async (previous, url) => {
547        await previous;
548        const req = this.adapter.newRequest(url);
549        let alreadyCached = false;
550        try {
551          alreadyCached = await cache.match(req, this.config.cacheQueryOptions) !== void 0;
552        } catch (error) {
553          throw new SwCriticalError(`Cache is throwing while looking for a match in a PrefetchAssetGroup: ${error}`);
554        }
555        if (alreadyCached) {
556          return;
557        }
558        if (updateFrom !== void 0 && await this.maybeUpdate(updateFrom, req, cache)) {
559          return;
560        }
561        await this.fetchAndCacheOnce(req, false);
562      }, Promise.resolve());
563      if (updateFrom !== void 0) {
564        const metaTable = await this.metadata;
565        await (await updateFrom.previouslyCachedResources()).filter((url) => this.urls.indexOf(url) !== -1 || this.patterns.some((pattern) => pattern.test(url))).reduce(async (previous, url) => {
566          await previous;
567          const req = this.adapter.newRequest(url);
568          const alreadyCached = await cache.match(req, this.config.cacheQueryOptions) !== void 0;
569          if (alreadyCached) {
570            return;
571          }
572          const res = await updateFrom.lookupResourceWithoutHash(url);
573          if (res === null || res.metadata === void 0) {
574            return;
575          }
576          await cache.put(req, res.response);
577          await metaTable.write(req.url, __spreadProps(__spreadValues({}, res.metadata), { used: false }));
578        }, Promise.resolve());
579      }
580    }
581  };
582  var LazyAssetGroup = class extends AssetGroup {
583    async initializeFully(updateFrom) {
584      if (updateFrom === void 0) {
585        return;
586      }
587      const cache = await this.cache;
588      await this.urls.reduce(async (previous, url) => {
589        await previous;
590        const req = this.adapter.newRequest(url);
591        let alreadyCached = false;
592        try {
593          alreadyCached = await cache.match(req, this.config.cacheQueryOptions) !== void 0;
594        } catch (error) {
595          throw new SwCriticalError(`Cache is throwing while looking for a match in a LazyAssetGroup: ${error}`);
596        }
597        if (alreadyCached) {
598          return;
599        }
600        const updated = await this.maybeUpdate(updateFrom, req, cache);
601        if (this.config.updateMode === "prefetch" && !updated) {
602          const cacheStatus = await updateFrom.recentCacheStatus(url);
603          if (cacheStatus !== UpdateCacheStatus.CACHED) {
604            return;
605          }
606          await this.fetchAndCacheOnce(req, false);
607        }
608      }, Promise.resolve());
609    }
610  };
611
612  
612// bazel-out/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/service-worker/worker/src/data.js
613  var LruList = class {
614    constructor(state) {
615      __publicField(this, "state");
616      if (state === void 0) {
617        state = {
618          head: null,
619          tail: null,
620          map: {},
621          count: 0
622        };
623      }
624      this.state = state;
625    }
626    get size() {
627      return this.state.count;
628    }
629    pop() {
630      if (this.state.tail === null) {
631        return null;
632      }
633      const url = this.state.tail;
634      this.remove(url);
635      return url;
636    }
637    remove(url) {
638      const node = this.state.map[url];
639      if (node === void 0) {
640        return false;
641      }
642      if (this.state.head === url) {
643        if (node.next === null) {
644          this.state.head = null;
645          this.state.tail = null;
646          this.state.map = {};
647          this.state.count = 0;
648          return true;
649        }
650        const next = this.state.map[node.next];
651        next.previous = null;
652        this.state.head = next.url;
653        node.next = null;
654        delete this.state.map[url];
655        this.state.count--;
656        return true;
657      }
658      const previous = this.state.map[node.previous];
659      previous.next = node.next;
660      if (node.next !== null) {
661        this.state.map[node.next].previous = node.previous;
662      } else {
663        this.state.tail = node.previous;
664      }
665      node.next = null;
666      node.previous = null;
667      delete this.state.map[url];
668      this.state.count--;
669      return true;
670    }
671    accessed(url) {
672      if (this.state.head === url) {
673        return;
674      }
675      const node = this.state.map[url] || { url, next: null, previous: null };
676      if (this.state.map[url] !== void 0) {
677        this.remove(url);
678      }
679      if (this.state.head !== null) {
680        this.state.map[this.state.head].previous = url;
681      }
682      node.next = this.state.head;
683      this.state.head = url;
684      if (this.state.tail === null) {
685        this.state.tail = url;
686      }
687      this.state.map[url] = node;
688      this.state.count++;
689    }
690  };
691  var DataGroup = class {
692    constructor(scope2, adapter2, config, db, debugHandler, cacheNamePrefix) {
693      __publicField(this, "scope");
694      __publicField(this, "adapter");
695      __publicField(this, "config");
696      __publicField(this, "db");
697      __publicField(this, "debugHandler");
698      __publicField(this, "patterns");
699      __publicField(this, "cache");
700      __publicField(this, "_lru", null);
701      __publicField(this, "lruTable");
702      __publicField(this, "ageTable");
703      this.scope = scope2;
704      this.adapter = adapter2;
705      this.config = config;
706      this.db = db;
707      this.debugHandler = debugHandler;
708      this.patterns = config.patterns.map((pattern) => new RegExp(pattern));
709      this.cache = adapter2.caches.open(`${cacheNamePrefix}:${config.name}:cache`);
710      this.lruTable = this.db.open(`${cacheNamePrefix}:${config.name}:lru`, config.cacheQueryOptions);
711      this.ageTable = this.db.open(`${cacheNamePrefix}:${config.name}:age`, config.cacheQueryOptions);
712    }
713    async lru() {
714      if (this._lru === null) {
715        const table = await this.lruTable;
716        try {
717          this._lru = new LruList(await table.read("lru"));
718        } catch (e) {
719          this._lru = new LruList();
720        }
721      }
722      return this._lru;
723    }
724    async syncLru() {
725      if (this._lru === null) {
726        return;
727      }
728      const table = await this.lruTable;
729      try {
730        return table.write("lru", this._lru.state);
731      } catch (err) {
732        this.debugHandler.log(err, `DataGroup(${this.config.name}@${this.config.version}).syncLru()`);
733      }
734    }
735    async handleFetch(req, event) {
736      if (!this.patterns.some((pattern) => pattern.test(req.url))) {
737        return null;
738      }
739      const lru = await this.lru();
740      switch (req.method) {
741        case "OPTIONS":
742          return null;
743        case "GET":
744        case "HEAD":
745          switch (this.config.strategy) {
746            case "freshness":
747              return this.handleFetchWithFreshness(req, event, lru);
748            case "performance":
749              return this.handleFetchWithPerformance(req, event, lru);
750            default:
751              throw new Error(`Unknown strategy: ${this.config.strategy}`);
752          }
753        default:
754          const wasCached = lru.remove(req.url);
755          if (wasCached) {
756            await this.clearCacheForUrl(req.url);
757          }
758          await this.syncLru();
759          return this.safeFetch(req);
760      }
761    }
762    async handleFetchWithPerformance(req, event, lru) {
763      var _a;
764      const okToCacheOpaque = (_a = this.config.cacheOpaqueResponses) != null ? _a : false;
765      let res = null;
766      const fromCache = await this.loadFromCache(req, lru);
767      if (fromCache !== null) {
768        res = fromCache.res;
769        if (this.config.refreshAheadMs !== void 0 && fromCache.age >= this.config.refreshAheadMs) {
770          event.waitUntil(this.safeCacheResponse(req, this.safeFetch(req), lru, okToCacheOpaque));
771        }
772      }
773      if (res !== null) {
774        return res;
775      }
776      const [timeoutFetch, networkFetch] = this.networkFetchWithTimeout(req);
777      res = await timeoutFetch;
778      if (res === void 0) {
779        res = this.adapter.newResponse(null, { status: 504, statusText: "Gateway Timeout" });
780        event.waitUntil(this.safeCacheResponse(req, networkFetch, lru, okToCacheOpaque));
781      } else {
782        await this.safeCacheResponse(req, res, lru, okToCacheOpaque);
783      }
784      return res;
785    }
786    async handleFetchWithFreshness(req, event, lru) {
787      var _a;
788      const okToCacheOpaque = (_a = this.config.cacheOpaqueResponses) != null ? _a : true;
789      const [timeoutFetch, networkFetch] = this.networkFetchWithTimeout(req);
790      let res;
791      try {
792        res = await timeoutFetch;
793      } catch (e) {
794        res = void 0;
795      }
796      if (res === void 0) {
797        event.waitUntil(this.safeCacheResponse(req, networkFetch, lru, okToCacheOpaque));
798        const fromCache = await this.loadFromCache(req, lru);
799        res = fromCache !== null ? fromCache.res : null;
800      } else {
801        await this.safeCacheResponse(req, res, lru, okToCacheOpaque);
802      }
803      if (res !== null) {
804        return res;
805      }
806      return networkFetch;
807    }
808    networkFetchWithTimeout(req) {
809      if (this.config.timeoutMs !== void 0) {
810        const networkFetch = this.scope.fetch(req);
811        const safeNetworkFetch = (async () => {
812          try {
813            return await networkFetch;
814          } catch (e) {
815            return this.adapter.newResponse(null, {
816              status: 504,
817              statusText: "Gateway Timeout"
818            });
819          }
820        })();
821        const networkFetchUndefinedError = (async () => {
822          try {
823            return await networkFetch;
824          } catch (e) {
825            return void 0;
826          }
827        })();
828        const timeout = this.adapter.timeout(this.config.timeoutMs);
829        return [Promise.race([networkFetchUndefinedError, timeout]), safeNetworkFetch];
830      } else {
831        const networkFetch = this.safeFetch(req);
832        return [networkFetch, networkFetch];
833      }
834    }
835    async safeCacheResponse(req, resOrPromise, lru, okToCacheOpaque) {
836      try {
837        const res = await resOrPromise;
838        try {
839          await this.cacheResponse(req, res, lru, okToCacheOpaque);
840        } catch (err) {
841          this.debugHandler.log(err, `DataGroup(${this.config.name}@${this.config.version}).safeCacheResponse(${req.url}, status: ${res.status})`);
842        }
843      } catch (e) {
844      }
845    }
846    async loadFromCache(req, lru) {
847      const cache = await this.cache;
848      let res = await cache.match(req, this.config.cacheQueryOptions);
849      if (res !== void 0) {
850        try {
851          const ageTable = await this.ageTable;
852          const age = this.adapter.time - (await ageTable.read(req.url)).age;
853          if (age <= this.config.maxAge) {
854            lru.accessed(req.url);
855            return { res, age };
856          }
857        } catch (e) {
858        }
859        lru.remove(req.url);
860        await this.clearCacheForUrl(req.url);
861        await this.syncLru();
862      }
863      return null;
864    }
865    async cacheResponse(req, res, lru, okToCacheOpaque = false) {
866      if (!(res.ok || okToCacheOpaque && res.type === "opaque")) {
867        return;
868      }
869      if (lru.size >= this.config.maxSize) {
870        const evictedUrl = lru.pop();
871        if (evictedUrl !== null) {
872          await this.clearCacheForUrl(evictedUrl);
873        }
874      }
875      lru.accessed(req.url);
876      await (await this.cache).put(req, res.clone());
877      const ageTable = await this.ageTable;
878      await ageTable.write(req.url, { age: this.adapter.time });
879      await this.syncLru();
880    }
881    async cleanup() {
882      await Promise.all([
883        this.cache.then((cache) => this.adapter.caches.delete(cache.name)),
884        this.ageTable.then((table) => this.db.delete(table.name)),
885        this.lruTable.then((table) => this.db.delete(table.name))
886      ]);
887    }
888    async getCacheNames() {
889      const [cache, ageTable, lruTable] = await Promise.all([
890        this.cache,
891        this.ageTable,
892        this.lruTable
893      ]);
894      return [cache.name, ageTable.cacheName, lruTable.cacheName];
895    }
896    async clearCacheForUrl(url) {
897      const [cache, ageTable] = await Promise.all([this.cache, this.ageTable]);
898      await Promise.all([
899        cache.delete(this.adapter.newRequest(url, { method: "GET" }), this.config.cacheQueryOptions),
900        cache.delete(this.adapter.newRequest(url, { method: "HEAD" }), this.config.cacheQueryOptions),
901        ageTable.delete(url)
902      ]);
903    }
904    async safeFetch(req) {
905      try {
906        return this.scope.fetch(req);
907      } catch (e) {
908        return this.adapter.newResponse(null, {
909          status: 504,
910          statusText: "Gateway Timeout"
911        });
912      }
913    }
914  };
915
916  
916// bazel-out/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/service-worker/worker/src/app-version.js
917  var AppVersion = class {
918    constructor(scope2, adapter2, database, idle, debugHandler, manifest, manifestHash) {
919      __publicField(this, "scope");
920      __publicField(this, "adapter");
921      __publicField(this, "database");
922      __publicField(this, "debugHandler");
923      __publicField(this, "manifest");
924      __publicField(this, "manifestHash");
925      __publicField(this, "hashTable", /* @__PURE__ */ new Map());
926      __publicField(this, "assetGroups");
927      __publicField(this, "dataGroups");
928      __publicField(this, "navigationUrls");
929      __publicField(this, "indexUrl");
930      __publicField(this, "_okay", true);
931      this.scope = scope2;
932      this.adapter = adapter2;
933      this.database = database;
934      this.debugHandler = debugHandler;
935      this.manifest = manifest;
936      this.manifestHash = manifestHash;
937      this.indexUrl = this.adapter.normalizeUrl(this.manifest.index);
938      Object.keys(manifest.hashTable).forEach((url) => {
939        this.hashTable.set(adapter2.normalizeUrl(url), manifest.hashTable[url]);
940      });
941      const assetCacheNamePrefix = `${manifestHash}:assets`;
942      this.assetGroups = (manifest.assetGroups || []).map((config) => {
943        switch (config.installMode) {
944          case "prefetch":
945            return new PrefetchAssetGroup(scope2, adapter2, idle, config, this.hashTable, database, assetCacheNamePrefix);
946          case "lazy":
947            return new LazyAssetGroup(scope2, adapter2, idle, config, this.hashTable, database, assetCacheNamePrefix);
948        }
949      });
950      this.dataGroups = (manifest.dataGroups || []).map((config) => new DataGroup(scope2, adapter2, config, database, debugHandler, `${config.version}:data`));
951      const includeUrls = manifest.navigationUrls.filter((spec) => spec.positive);
952      const excludeUrls = manifest.navigationUrls.filter((spec) => !spec.positive);
953      this.navigationUrls = {
954        include: includeUrls.map((spec) => new RegExp(spec.regex)),
955        exclude: excludeUrls.map((spec) => new RegExp(spec.regex))
956      };
957    }
958    get okay() {
959      return this._okay;
960    }
961    async initializeFully(updateFrom) {
962      try {
963        await this.assetGroups.reduce(async (previous, group) => {
964          await previous;
965          return group.initializeFully(updateFrom);
966        }, Promise.resolve());
967      } catch (err) {
968        this._okay = false;
969        throw err;
970      }
971    }
972    async handleFetch(req, event) {
973      const asset = await this.assetGroups.reduce(async (potentialResponse, group) => {
974        const resp = await potentialResponse;
975        if (resp !== null) {
976          return resp;
977        }
978        return group.handleFetch(req, event);
979      }, Promise.resolve(null));
980      if (asset !== null) {
981        return asset;
982      }
983      const data = await this.dataGroups.reduce(async (potentialResponse, group) => {
984        const resp = await potentialResponse;
985        if (resp !== null) {
986          return resp;
987        }
988        return group.handleFetch(req, event);
989      }, Promise.resolve(null));
990      if (data !== null) {
991        return data;
992      }
993      if (this.adapter.normalizeUrl(req.url) !== this.indexUrl && this.isNavigationRequest(req)) {
994        if (this.manifest.navigationRequestStrategy === "freshness") {
995          try {
996            return await this.scope.fetch(req);
997          } catch (e) {
998          }
999        }
1000        return this.handleFetch(this.adapter.newRequest(this.indexUrl), event);
1001      }
1002      return null;
1003    }
1004    isNavigationRequest(req) {
1005      if (req.method !== "GET" || req.mode !== "navigate") {
1006        return false;
1007      }
1008      if (!this.acceptsTextHtml(req)) {
1009        return false;
1010      }
1011      const urlPrefix = this.scope.registration.scope.replace(/\/$/, "");
1012      const url = req.url.startsWith(urlPrefix) ? req.url.slice(urlPrefix.length) : req.url;
1013      const urlWithoutQueryOrHash = url.replace(/[?#].*$/, "");
1014      return this.navigationUrls.include.some((regex) => regex.test(urlWithoutQueryOrHash)) && !this.navigationUrls.exclude.some((regex) => regex.test(urlWithoutQueryOrHash));
1015    }
1016    async lookupResourceWithHash(url, hash) {
1017      if (!this.hashTable.has(url)) {
1018        return null;
1019      }
1020      if (this.hashTable.get(url) !== hash) {
1021        return null;
1022      }
1023      const cacheState = await this.lookupResourceWithoutHash(url);
1024      return cacheState && cacheState.response;
1025    }
1026    lookupResourceWithoutHash(url) {
1027      return this.assetGroups.reduce(async (potentialResponse, group) => {
1028        const resp = await potentialResponse;
1029        if (resp !== null) {
1030          return resp;
1031        }
1032        return group.fetchFromCacheOnly(url);
1033      }, Promise.resolve(null));
1034    }
1035    previouslyCachedResources() {
1036      return this.assetGroups.reduce(async (resources, group) => (await resources).concat(await group.unhashedResources()), Promise.resolve([]));
1037    }
1038    async recentCacheStatus(url) {
1039      return this.assetGroups.reduce(async (current, group) => {
1040        const status = await current;
1041        if (status === UpdateCacheStatus.CACHED) {
1042          return status;
1043        }
1044        const groupStatus = await group.cacheStatus(url);
1045        if (groupStatus === UpdateCacheStatus.NOT_CACHED) {
1046          return status;
1047        }
1048        return groupStatus;
1049      }, Promise.resolve(UpdateCacheStatus.NOT_CACHED));
1050    }
1051    async getCacheNames() {
1052      const allGroupCacheNames = await Promise.all([
1053        ...this.assetGroups.map((group) => group.getCacheNames()),
1054        ...this.dataGroups.map((group) => group.getCacheNames())
1055      ]);
1056      return [].concat(...allGroupCacheNames);
1057    }
1058    get appData() {
1059      return this.manifest.appData || null;
1060    }
1061    acceptsTextHtml(req) {
1062      const accept = req.headers.get("Accept");
1063      if (accept === null) {
1064        return false;
1065      }
1066      const values = accept.split(",");
1067      return values.some((value) => value.trim().toLowerCase() === "text/html");
1068    }
1069  };
1070
1071  
1071// bazel-out/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/service-worker/worker/src/debug.js
1072  var SW_VERSION = "19.2.21";
1073  var DEBUG_LOG_BUFFER_SIZE = 100;
1074  var DebugHandler = class {
1075    constructor(driver, adapter2) {
1076      __publicField(this, "driver");
1077      __publicField(this, "adapter");
1078      __publicField(this, "debugLogA", []);
1079      __publicField(this, "debugLogB", []);
1080      this.driver = driver;
1081      this.adapter = adapter2;
1082    }
1083    async handleFetch(req) {
1084      const [state, versions, idle] = await Promise.all([
1085        this.driver.debugState(),
1086        this.driver.debugVersions(),
1087        this.driver.debugIdleState()
1088      ]);
1089      const msgState = `NGSW Debug Info:
1090
1091Driver version: ${SW_VERSION}
1092Driver state: ${state.state} (${state.why})
1093Latest manifest hash: ${state.latestHash || "none"}
1094Last update check: ${this.since(state.lastUpdateCheck)}`;
1095      const msgVersions = versions.map((version) => `=== Version ${version.hash} ===
1096
1097Clients: ${version.clients.join(", ")}`).join("\n\n");
1098      const msgIdle = `=== Idle Task Queue ===
1099Last update tick: ${this.since(idle.lastTrigger)}
1100Last update run: ${this.since(idle.lastRun)}
1101Task queue:
1102${idle.queue.map((v) => " * " + v).join("\n")}
1103
1104Debug log:
1105${this.formatDebugLog(this.debugLogB)}
1106${this.formatDebugLog(this.debugLogA)}
1107`;
1108      return this.adapter.newResponse(`${msgState}
1109
1110${msgVersions}
1111
1112${msgIdle}`, { headers: this.adapter.newHeaders({ "Content-Type": "text/plain" }) });
1113    }
1114    since(time) {
1115      if (time === null) {
1116        return "never";
1117      }
1118      let age = this.adapter.time - time;
1119      const days = Math.floor(age / 864e5);
1120      age = age % 864e5;
1121      const hours = Math.floor(age / 36e5);
1122      age = age % 36e5;
1123      const minutes = Math.floor(age / 6e4);
1124      age = age % 6e4;
1125      const seconds = Math.floor(age / 1e3);
1126      const millis = age % 1e3;
1127      return (days > 0 ? `${days}d` : "") + (hours > 0 ? `${hours}h` : "") + (minutes > 0 ? `${minutes}m` : "") + (seconds > 0 ? `${seconds}s` : "") + (millis > 0 ? `${millis}u` : "");
1128    }
1129    log(value, context = "") {
1130      if (this.debugLogA.length === DEBUG_LOG_BUFFER_SIZE) {
1131        this.debugLogB = this.debugLogA;
1132        this.debugLogA = [];
1133      }
1134      if (typeof value !== "string") {
1135        value = this.errorToString(value);
1136      }
1137      this.debugLogA.push({ value, time: this.adapter.time, context });
1138    }
1139    errorToString(err) {
1140      return `${err.name}(${err.message}, ${err.stack})`;
1141    }
1142    formatDebugLog(log) {
1143      return log.map((entry) => `[${this.since(entry.time)}] ${entry.value} ${entry.context}`).join("\n");
1144    }
1145  };
1146
1147  
1147// bazel-out/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/service-worker/worker/src/idle.js
1148  var IdleScheduler = class {
1149    constructor(adapter2, delay, maxDelay, debug) {
1150      __publicField(this, "adapter");
1151      __publicField(this, "delay");
1152      __publicField(this, "maxDelay");
1153      __publicField(this, "debug");
1154      __publicField(this, "queue", []);
1155      __publicField(this, "scheduled", null);
1156      __publicField(this, "empty", Promise.resolve());
1157      __publicField(this, "emptyResolve", null);
1158      __publicField(this, "lastTrigger", null);
1159      __publicField(this, "lastRun", null);
1160      __publicField(this, "oldestScheduledAt", null);
1161      this.adapter = adapter2;
1162      this.delay = delay;
1163      this.maxDelay = maxDelay;
1164      this.debug = debug;
1165    }
1166    async trigger() {
1167      var _a;
1168      this.lastTrigger = this.adapter.time;
1169      if (this.queue.length === 0) {
1170        return;
1171      }
1172      if (this.scheduled !== null) {
1173        this.scheduled.cancel = true;
1174      }
1175      const scheduled = {
1176        cancel: false
1177      };
1178      this.scheduled = scheduled;
1179      const now = this.adapter.time;
1180      const maxDelay = Math.max(0, ((_a = this.oldestScheduledAt) != null ? _a : now) + this.maxDelay - now);
1181      const delay = Math.min(maxDelay, this.delay);
1182      await this.adapter.timeout(delay);
1183      if (scheduled.cancel) {
1184        return;
1185      }
1186      this.scheduled = null;
1187      await this.execute();
1188    }
1189    async execute() {
1190      this.lastRun = this.adapter.time;
1191      while (this.queue.length > 0) {
1192        const queue = this.queue;
1193        this.queue = [];
1194        await queue.reduce(async (previous, task) => {
1195          await previous;
1196          try {
1197            await task.run();
1198          } catch (err) {
1199            this.debug.log(err, `while running idle task ${task.desc}`);
1200          }
1201        }, Promise.resolve());
1202      }
1203      if (this.emptyResolve !== null) {
1204        this.emptyResolve();
1205        this.emptyResolve = null;
1206      }
1207      this.empty = Promise.resolve();
1208      this.oldestScheduledAt = null;
1209    }
1210    schedule(desc, run) {
1211      this.queue.push({ desc, run });
1212      if (this.emptyResolve === null) {
1213        this.empty = new Promise((resolve) => {
1214          this.emptyResolve = resolve;
1215        });
1216      }
1217      if (this.oldestScheduledAt === null) {
1218        this.oldestScheduledAt = this.adapter.time;
1219      }
1220    }
1221    get size() {
1222      return this.queue.length;
1223    }
1224    get taskDescriptions() {
1225      return this.queue.map((task) => task.desc);
1226    }
1227  };
1228
1229  
1229// bazel-out/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/service-worker/worker/src/manifest.js
1230  function hashManifest(manifest) {
1231    return sha1(JSON.stringify(manifest));
1232  }
1233
1234  
1234// bazel-out/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/service-worker/worker/src/msg.js
1235  function isMsgCheckForUpdates(msg) {
1236    return msg.action === "CHECK_FOR_UPDATES";
1237  }
1238  function isMsgActivateUpdate(msg) {
1239    return msg.action === "ACTIVATE_UPDATE";
1240  }
1241
1242  
1242// bazel-out/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/service-worker/worker/src/driver.js
1243  var IDLE_DELAY = 5e3;
1244  var MAX_IDLE_DELAY = 3e4;
1245  var SUPPORTED_CONFIG_VERSION = 1;
1246  var NOTIFICATION_OPTION_NAMES = [
1247    "actions",
1248    "badge",
1249    "body",
1250    "data",
1251    "dir",
1252    "icon",
1253    "image",
1254    "lang",
1255    "renotify",
1256    "requireInteraction",
1257    "silent",
1258    "tag",
1259    "timestamp",
1260    "title",
1261    "vibrate"
1262  ];
1263  var DriverReadyState;
1264  (function(DriverReadyState2) {
1265    DriverReadyState2[DriverReadyState2["NORMAL"] = 0] = "NORMAL";
1266    DriverReadyState2[DriverReadyState2["EXISTING_CLIENTS_ONLY"] = 1] = "EXISTING_CLIENTS_ONLY";
1267    DriverReadyState2[DriverReadyState2["SAFE_MODE"] = 2] = "SAFE_MODE";
1268  })(DriverReadyState || (DriverReadyState = {}));
1269  var Driver = class {
1270    constructor(scope2, adapter2, db) {
1271      __publicField(this, "scope");
1272      __publicField(this, "adapter");
1273      __publicField(this, "db");
1274      __publicField(this, "state", DriverReadyState.NORMAL);
1275      __publicField(this, "stateMessage", "(nominal)");
1276      __publicField(this, "initialized", null);
1277      __publicField(this, "clientVersionMap", /* @__PURE__ */ new Map());
1278      __publicField(this, "versions", /* @__PURE__ */ new Map());
1279      __publicField(this, "latestHash", null);
1280      __publicField(this, "lastUpdateCheck", null);
1281      __publicField(this, "scheduledNavUpdateCheck", false);
1282      __publicField(this, "loggedInvalidOnlyIfCachedRequest", false);
1283      __publicField(this, "ngswStatePath");
1284      __publicField(this, "idle");
1285      __publicField(this, "debugger");
1286      __publicField(this, "controlTable");
1287      this.scope = scope2;
1288      this.adapter = adapter2;
1289      this.db = db;
1290      this.controlTable = this.db.open("control");
1291      this.ngswStatePath = this.adapter.parseUrl("ngsw/state", this.scope.registration.scope).path;
1292      this.scope.addEventListener("install", (event) => {
1293        event.waitUntil(this.scope.skipWaiting());
1294      });
1295      this.scope.addEventListener("activate", (event) => {
1296        event.waitUntil((async () => {
1297          await this.scope.clients.claim();
1298        })());
1299        if (this.scope.registration.active !== null) {
1300          this.scope.registration.active.postMessage({ action: "INITIALIZE" });
1301        }
1302      });
1303      this.scope.addEventListener("fetch", (event) => this.onFetch(event));
1304      this.scope.addEventListener("message", (event) => this.onMessage(event));
1305      this.scope.addEventListener("push", (event) => this.onPush(event));
1306      this.scope.addEventListener("notificationclick", (event) => this.onClick(event));
1307      this.debugger = new DebugHandler(this, this.adapter);
1308      this.idle = new IdleScheduler(this.adapter, IDLE_DELAY, MAX_IDLE_DELAY, this.debugger);
1309    }
1310    onFetch(event) {
1311      const req = event.request;
1312      const scopeUrl = this.scope.registration.scope;
1313      const requestUrlObj = this.adapter.parseUrl(req.url, scopeUrl);
1314      if (req.headers.has("ngsw-bypass") || /[?&]ngsw-bypass(?:[=&]|$)/i.test(requestUrlObj.search)) {
1315        return;
1316      }
1317      if (requestUrlObj.path === this.ngswStatePath) {
1318        event.respondWith(this.debugger.handleFetch(req));
1319        return;
1320      }
1321      if (this.state === DriverReadyState.SAFE_MODE) {
1322        event.waitUntil(this.idle.trigger());
1323        return;
1324      }
1325      if (requestUrlObj.origin.startsWith("http:") && scopeUrl.startsWith("https:")) {
1326        this.debugger.log(`Ignoring passive mixed content request: Driver.fetch(${req.url})`);
1327        return;
1328      }
1329      if (req.cache === "only-if-cached" && req.mode !== "same-origin") {
1330        if (!this.loggedInvalidOnlyIfCachedRequest) {
1331          this.loggedInvalidOnlyIfCachedRequest = true;
1332          this.debugger.log(`Ignoring invalid request: 'only-if-cached' can be set only with 'same-origin' mode`, `Driver.fetch(${req.url}, cache: ${req.cache}, mode: ${req.mode})`);
1333        }
1334        return;
1335      }
1336      event.respondWith(this.handleFetch(event));
1337    }
1338    onMessage(event) {
1339      if (this.state === DriverReadyState.SAFE_MODE) {
1340        return;
1341      }
1342      const data = event.data;
1343      if (!data || !data.action) {
1344        return;
1345      }
1346      event.waitUntil((async () => {
1347        if (data.action === "INITIALIZE") {
1348          return this.ensureInitialized(event);
1349        }
1350        if (!this.adapter.isClient(event.source)) {
1351          return;
1352        }
1353        await this.ensureInitialized(event);
1354        await this.handleMessage(data, event.source);
1355      })());
1356    }
1357    onPush(msg) {
1358      if (!msg.data) {
1359        return;
1360      }
1361      msg.waitUntil(this.handlePush(msg.data.json()));
1362    }
1363    onClick(event) {
1364      event.waitUntil(this.handleClick(event.notification, event.action));
1365    }
1366    async ensureInitialized(event) {
1367      if (this.initialized !== null) {
1368        return this.initialized;
1369      }
1370      try {
1371        this.initialized = this.initialize();
1372        await this.initialized;
1373      } catch (error) {
1374        this.state = DriverReadyState.SAFE_MODE;
1375        this.stateMessage = `Initialization failed due to error: ${errorToString(error)}`;
1376        throw error;
1377      } finally {
1378        event.waitUntil(this.idle.trigger());
1379      }
1380    }
1381    async handleMessage(msg, from) {
1382      if (isMsgCheckForUpdates(msg)) {
1383        const action = this.checkForUpdate();
1384        await this.completeOperation(from, action, msg.nonce);
1385      } else if (isMsgActivateUpdate(msg)) {
1386        const action = this.updateClient(from);
1387        await this.completeOperation(from, action, msg.nonce);
1388      }
1389    }
1390    async handlePush(data) {
1391      await this.broadcast({
1392        type: "PUSH",
1393        data
1394      });
1395      if (!data.notification || !data.notification.title) {
1396        return;
1397      }
1398      const desc = data.notification;
1399      let options = {};
1400      NOTIFICATION_OPTION_NAMES.filter((name) => desc.hasOwnProperty(name)).forEach((name) => options[name] = desc[name]);
1401      await this.scope.registration.showNotification(desc["title"], options);
1402    }
1403    async handleClick(notification, action) {
1404      var _a, _b, _c;
1405      notification.close();
1406      const options = {};
1407      NOTIFICATION_OPTION_NAMES.filter((name) => name in notification).forEach((name) => options[name] = notification[name]);
1408      const notificationAction = action === "" || action === void 0 ? "default" : action;
1409      const onActionClick = (_b = (_a = notification == null ? void 0 : notification.data) == null ? void 0 : _a.onActionClick) == null ? void 0 : _b[notificationAction];
1410      const urlToOpen = new URL((_c = onActionClick == null ? void 0 : onActionClick.url) != null ? _c : "", this.scope.registration.scope).href;
1411      switch (onActionClick == null ? void 0 : onActionClick.operation) {
1412        case "openWindow":
1413          await this.scope.clients.openWindow(urlToOpen);
1414          break;
1415        case "focusLastFocusedOrOpen": {
1416          let matchingClient = await this.getLastFocusedMatchingClient(this.scope);
1417          if (matchingClient) {
1418            await (matchingClient == null ? void 0 : matchingClient.focus());
1419          } else {
1420            await this.scope.clients.openWindow(urlToOpen);
1421          }
1422          break;
1423        }
1424        case "navigateLastFocusedOrOpen": {
1425          let matchingClient = await this.getLastFocusedMatchingClient(this.scope);
1426          if (matchingClient) {
1427            matchingClient = await matchingClient.navigate(urlToOpen);
1428            await (matchingClient == null ? void 0 : matchingClient.focus());
1429          } else {
1430            await this.scope.clients.openWindow(urlToOpen);
1431          }
1432          break;
1433        }
1434        case "sendRequest": {
1435          await this.scope.fetch(urlToOpen);
1436          break;
1437        }
1438        default:
1439          break;
1440      }
1441      await this.broadcast({
1442        type: "NOTIFICATION_CLICK",
1443        data: { action, notification: options }
1444      });
1445    }
1446    async getLastFocusedMatchingClient(scope2) {
1447      const windowClients = await scope2.clients.matchAll({ type: "window" });
1448      return windowClients[0];
1449    }
1450    async completeOperation(client, promise, nonce) {
1451      const response = { type: "OPERATION_COMPLETED", nonce };
1452      try {
1453        client.postMessage(__spreadProps(__spreadValues({}, response), {
1454          result: await promise
1455        }));
1456      } catch (e) {
1457        client.postMessage(__spreadProps(__spreadValues({}, response), {
1458          error: e.toString()
1459        }));
1460      }
1461    }
1462    async updateClient(client) {
1463      const existing = this.clientVersionMap.get(client.id);
1464      if (existing === this.latestHash) {
1465        return false;
1466      }
1467      let previous = void 0;
1468      if (existing !== void 0) {
1469        const existingVersion = this.versions.get(existing);
1470        previous = this.mergeHashWithAppData(existingVersion.manifest, existing);
1471      }
1472      this.clientVersionMap.set(client.id, this.latestHash);
1473      await this.sync();
1474      const current = this.versions.get(this.latestHash);
1475      return true;
1476    }
1477    async handleFetch(event) {
1478      try {
1479        await this.ensureInitialized(event);
1480      } catch (e) {
1481        return this.safeFetch(event.request);
1482      }
1483      if (event.request.mode === "navigate" && !this.scheduledNavUpdateCheck) {
1484        this.scheduledNavUpdateCheck = true;
1485        this.idle.schedule("check-updates-on-navigation", async () => {
1486          this.scheduledNavUpdateCheck = false;
1487          await this.checkForUpdate();
1488        });
1489      }
1490      const appVersion = await this.assignVersion(event);
1491      const isVersionWithinMaxAge = (appVersion == null ? void 0 : appVersion.manifest.applicationMaxAge) === void 0 || this.adapter.time - appVersion.manifest.timestamp < appVersion.manifest.applicationMaxAge;
1492      let res = null;
1493      try {
1494        if (appVersion !== null && isVersionWithinMaxAge) {
1495          try {
1496            res = await appVersion.handleFetch(event.request, event);
1497          } catch (err) {
1498            if (err.isUnrecoverableState) {
1499              await this.notifyClientsAboutUnrecoverableState(appVersion, err.message);
1500            }
1501            if (err.isCritical) {
1502              this.debugger.log(err, `Driver.handleFetch(version: ${appVersion.manifestHash})`);
1503              await this.versionFailed(appVersion, err);
1504              return this.safeFetch(event.request);
1505            }
1506            throw err;
1507          }
1508        }
1509        if (res === null) {
1510          return this.safeFetch(event.request);
1511        }
1512        return res;
1513      } finally {
1514        event.waitUntil(this.idle.trigger());
1515      }
1516    }
1517    async initialize() {
1518      const table = await this.controlTable;
1519      let manifests, assignments, latest;
1520      try {
1521        [manifests, assignments, latest] = await Promise.all([
1522          table.read("manifests"),
1523          table.read("assignments"),
1524          table.read("latest")
1525        ]);
1526        if (!this.versions.has(latest.latest) && !manifests.hasOwnProperty(latest.latest)) {
1527          this.debugger.log(`Missing manifest for latest version hash ${latest.latest}`, "initialize: read from DB");
1528          throw new Error(`Missing manifest for latest hash ${latest.latest}`);
1529        }
1530        this.idle.schedule("init post-load (update)", async () => {
1531          await this.checkForUpdate();
1532        });
1533      } catch (_) {
1534        const manifest = await this.fetchLatestManifest();
1535        const hash = hashManifest(manifest);
1536        manifests = { [hash]: manifest };
1537        assignments = {};
1538        latest = { latest: hash };
1539        await Promise.all([
1540          table.write("manifests", manifests),
1541          table.write("assignments", assignments),
1542          table.write("latest", latest)
1543        ]);
1544      }
1545      this.idle.schedule("init post-load (cleanup)", async () => {
1546        await this.cleanupCaches();
1547      });
1548      Object.keys(manifests).forEach((hash) => {
1549        const manifest = manifests[hash];
1550        if (!this.versions.has(hash)) {
1551          this.versions.set(hash, new AppVersion(this.scope, this.adapter, this.db, this.idle, this.debugger, manifest, hash));
1552        }
1553      });
1554      Object.keys(assignments).forEach((clientId) => {
1555        const hash = assignments[clientId];
1556        if (this.versions.has(hash)) {
1557          this.clientVersionMap.set(clientId, hash);
1558        } else {
1559          this.clientVersionMap.set(clientId, latest.latest);
1560          this.debugger.log(`Unknown version ${hash} mapped for client ${clientId}, using latest instead`, `initialize: map assignments`);
1561        }
1562      });
1563      this.latestHash = latest.latest;
1564      if (!this.versions.has(latest.latest)) {
1565        throw new Error(`Invariant violated (initialize): latest hash ${latest.latest} has no known manifest`);
1566      }
1567      await Promise.all(Object.keys(manifests).map(async (hash) => {
1568        try {
1569          await this.scheduleInitialization(this.versions.get(hash));
1570        } catch (err) {
1571          this.debugger.log(err, `initialize: schedule init of ${hash}`);
1572        }
1573      }));
1574    }
1575    lookupVersionByHash(hash, debugName = "lookupVersionByHash") {
1576      if (!this.versions.has(hash)) {
1577        throw new Error(`Invariant violated (${debugName}): want AppVersion for ${hash} but not loaded`);
1578      }
1579      return this.versions.get(hash);
1580    }
1581    async assignVersion(event) {
1582      const isWorkerScriptRequest = event.request.destination === "worker" && event.resultingClientId && event.clientId;
1583      const clientId = isWorkerScriptRequest ? event.clientId : event.resultingClientId || event.clientId;
1584      if (clientId) {
1585        if (this.clientVersionMap.has(clientId)) {
1586          const hash = this.clientVersionMap.get(clientId);
1587          let appVersion = this.lookupVersionByHash(hash, "assignVersion");
1588          if (this.state === DriverReadyState.NORMAL && hash !== this.latestHash && appVersion.isNavigationRequest(event.request)) {
1589            if (this.latestHash === null) {
1590              throw new Error(`Invariant violated (assignVersion): latestHash was null`);
1591            }
1592            const client = await this.scope.clients.get(clientId);
1593            if (client) {
1594              await this.updateClient(client);
1595            }
1596            appVersion = this.lookupVersionByHash(this.latestHash, "assignVersion");
1597          }
1598          if (isWorkerScriptRequest) {
1599            if (!this.clientVersionMap.has(event.resultingClientId)) {
1600              this.clientVersionMap.set(event.resultingClientId, hash);
1601              await this.sync();
1602            } else if (this.clientVersionMap.get(event.resultingClientId) !== hash) {
1603              throw new Error(`Version mismatch between worker client ${event.resultingClientId} and requesting client ${clientId}`);
1604            }
1605          }
1606          return appVersion;
1607        } else {
1608          if (this.state !== DriverReadyState.NORMAL) {
1609            return null;
1610          }
1611          if (this.latestHash === null) {
1612            throw new Error(`Invariant violated (assignVersion): latestHash was null`);
1613          }
1614          if (isWorkerScriptRequest) {
1615            if (!this.clientVersionMap.has(event.resultingClientId)) {
1616              this.clientVersionMap.set(event.resultingClientId, this.latestHash);
1617            } else if (this.clientVersionMap.get(event.resultingClientId) !== this.latestHash) {
1618              throw new Error(`Version mismatch between worker client ${event.resultingClientId} and requesting client ${clientId}`);
1619            }
1620          }
1621          this.clientVersionMap.set(clientId, this.latestHash);
1622          await this.sync();
1623          return this.lookupVersionByHash(this.latestHash, "assignVersion");
1624        }
1625      } else {
1626        if (this.state !== DriverReadyState.NORMAL) {
1627          return null;
1628        }
1629        if (this.latestHash === null) {
1630          throw new Error(`Invariant violated (assignVersion): latestHash was null`);
1631        }
1632        return this.lookupVersionByHash(this.latestHash, "assignVersion");
1633      }
1634    }
1635    async fetchLatestManifest(ignoreOfflineError = false) {
1636      const res = await this.safeFetch(this.adapter.newRequest("ngsw.json?ngsw-cache-bust=" + Math.random()));
1637      if (!res.ok) {
1638        if (res.status === 404) {
1639          await this.deleteAllCaches();
1640          await this.scope.registration.unregister();
1641        } else if ((res.status === 503 || res.status === 504) && ignoreOfflineError) {
1642          return null;
1643        }
1644        throw new Error(`Manifest fetch failed! (status: ${res.status})`);
1645      }
1646      this.lastUpdateCheck = this.adapter.time;
1647      return res.json();
1648    }
1649    async deleteAllCaches() {
1650      const cacheNames = await this.adapter.caches.keys();
1651      await Promise.all(cacheNames.map((name) => this.adapter.caches.delete(name)));
1652    }
1653    async scheduleInitialization(appVersion) {
1654      const initialize = async () => {
1655        try {
1656          await appVersion.initializeFully();
1657        } catch (err) {
1658          this.debugger.log(err, `initializeFully for ${appVersion.manifestHash}`);
1659          await this.versionFailed(appVersion, err);
1660        }
1661      };
1662      if (this.scope.registration.scope.indexOf("://localhost") > -1) {
1663        return initialize();
1664      }
1665      this.idle.schedule(`initialization(${appVersion.manifestHash})`, initialize);
1666    }
1667    async versionFailed(appVersion, err) {
1668      const broken = Array.from(this.versions.entries()).find(([hash, version]
1668) => version === appVersion);
1669      if (broken === void 0) {
1670        return;
1671      }
1672      const brokenHash = broken[0];
1673      if (this.latestHash === brokenHash) {
1674        this.state = DriverReadyState.EXISTING_CLIENTS_ONLY;
1675        this.stateMessage = `Degraded due to: ${errorToString(err)}`;
1676      }
1677    }
1678    async setupUpdate(manifest, hash) {
1679      try {
1680        const newVersion = new AppVersion(this.scope, this.adapter, this.db, this.idle, this.debugger, manifest, hash);
1681        if (manifest.configVersion !== SUPPORTED_CONFIG_VERSION) {
1682          await this.deleteAllCaches();
1683          await this.scope.registration.unregister();
1684          throw new Error(`Invalid config version: expected ${SUPPORTED_CONFIG_VERSION}, got ${manifest.configVersion}.`);
1685        }
1686        await newVersion.initializeFully(this);
1687        this.versions.set(hash, newVersion);
1688        this.latestHash = hash;
1689        if (this.state === DriverReadyState.EXISTING_CLIENTS_ONLY) {
1690          this.state = DriverReadyState.NORMAL;
1691          this.stateMessage = "(nominal)";
1692        }
1693        await this.sync();
1694        await this.notifyClientsAboutVersionReady(manifest, hash);
1695      } catch (e) {
1696        await this.notifyClientsAboutVersionInstallationFailed(manifest, hash, e);
1697        throw e;
1698      }
1699    }
1700    async checkForUpdate() {
1701      let hash = "(unknown)";
1702      try {
1703        const manifest = await this.fetchLatestManifest(true);
1704        if (manifest === null) {
1705          this.debugger.log("Check for update aborted. (Client or server offline.)");
1706          return false;
1707        }
1708        hash = hashManifest(manifest);
1709        if (this.versions.has(hash)) {
1710          await this.notifyClientsAboutNoNewVersionDetected(manifest, hash);
1711          return false;
1712        }
1713        await this.notifyClientsAboutVersionDetected(manifest, hash);
1714        await this.setupUpdate(manifest, hash);
1715        return true;
1716      } catch (err) {
1717        this.debugger.log(err, `Error occurred while updating to manifest ${hash}`);
1718        this.state = DriverReadyState.EXISTING_CLIENTS_ONLY;
1719        this.stateMessage = `Degraded due to failed initialization: ${errorToString(err)}`;
1720        return false;
1721      }
1722    }
1723    async sync() {
1724      const table = await this.controlTable;
1725      const manifests = {};
1726      this.versions.forEach((version, hash) => {
1727        manifests[hash] = version.manifest;
1728      });
1729      const assignments = {};
1730      this.clientVersionMap.forEach((hash, clientId) => {
1731        assignments[clientId] = hash;
1732      });
1733      const latest = {
1734        latest: this.latestHash
1735      };
1736      await Promise.all([
1737        table.write("manifests", manifests),
1738        table.write("assignments", assignments),
1739        table.write("latest", latest)
1740      ]);
1741    }
1742    async cleanupCaches() {
1743      try {
1744        const activeClients = new Set((await this.scope.clients.matchAll()).map((client) => client.id));
1745        const knownClients = Array.from(this.clientVersionMap.keys());
1746        const obsoleteClients = knownClients.filter((id) => !activeClients.has(id));
1747        obsoleteClients.forEach((id) => this.clientVersionMap.delete(id));
1748        const usedVersions = new Set(this.clientVersionMap.values());
1749        const obsoleteVersions = Array.from(this.versions.keys()).filter((version) => !usedVersions.has(version) && version !== this.latestHash);
1750        obsoleteVersions.forEach((version) => this.versions.delete(version));
1751        await this.sync();
1752        const allCaches = await this.adapter.caches.keys();
1753        const usedCaches = new Set(await this.getCacheNames());
1754        const cachesToDelete = allCaches.filter((name) => !usedCaches.has(name));
1755        await Promise.all(cachesToDelete.map((name) => this.adapter.caches.delete(name)));
1756      } catch (err) {
1757        this.debugger.log(err, "cleanupCaches");
1758      }
1759    }
1760    lookupResourceWithHash(url, hash) {
1761      return Array.from(this.versions.values()).reduce(async (prev, version) => {
1762        if (await prev !== null) {
1763          return prev;
1764        }
1765        return version.lookupResourceWithHash(url, hash);
1766      }, Promise.resolve(null));
1767    }
1768    async lookupResourceWithoutHash(url) {
1769      await this.initialized;
1770      const version = this.versions.get(this.latestHash);
1771      return version ? version.lookupResourceWithoutHash(url) : null;
1772    }
1773    async previouslyCachedResources() {
1774      await this.initialized;
1775      const version = this.versions.get(this.latestHash);
1776      return version ? version.previouslyCachedResources() : [];
1777    }
1778    async recentCacheStatus(url) {
1779      const version = this.versions.get(this.latestHash);
1780      return version ? version.recentCacheStatus(url) : UpdateCacheStatus.NOT_CACHED;
1781    }
1782    mergeHashWithAppData(manifest, hash) {
1783      return {
1784        hash,
1785        appData: manifest.appData
1786      };
1787    }
1788    async notifyClientsAboutUnrecoverableState(appVersion, reason) {
1789      const broken = Array.from(this.versions.entries()).find(([hash, version]) => version === appVersion);
1790      if (broken === void 0) {
1791        return;
1792      }
1793      const brokenHash = broken[0];
1794      const affectedClients = Array.from(this.clientVersionMap.entries()).filter(([clientId, hash]) => hash === brokenHash).map(([clientId]) => clientId);
1795      await Promise.all(affectedClients.map(async (clientId) => {
1796        const client = await this.scope.clients.get(clientId);
1797        if (client) {
1798          client.postMessage({ type: "UNRECOVERABLE_STATE", reason });
1799        }
1800      }));
1801    }
1802    async notifyClientsAboutVersionInstallationFailed(manifest, hash, error) {
1803      await this.initialized;
1804      const clients = await this.scope.clients.matchAll();
1805      await Promise.all(clients.map(async (client) => {
1806        client.postMessage({
1807          type: "VERSION_INSTALLATION_FAILED",
1808          version: this.mergeHashWithAppData(manifest, hash),
1809          error: errorToString(error)
1810        });
1811      }));
1812    }
1813    async notifyClientsAboutNoNewVersionDetected(manifest, hash) {
1814      await this.initialized;
1815      const clients = await this.scope.clients.matchAll();
1816      await Promise.all(clients.map(async (client) => {
1817        client.postMessage({
1818          type: "NO_NEW_VERSION_DETECTED",
1819          version: this.mergeHashWithAppData(manifest, hash)
1820        });
1821      }));
1822    }
1823    async notifyClientsAboutVersionDetected(manifest, hash) {
1824      await this.initialized;
1825      const clients = await this.scope.clients.matchAll();
1826      await Promise.all(clients.map(async (client) => {
1827        const version = this.clientVersionMap.get(client.id);
1828        if (version === void 0) {
1829          return;
1830        }
1831        client.postMessage({
1832          type: "VERSION_DETECTED",
1833          version: this.mergeHashWithAppData(manifest, hash)
1834        });
1835      }));
1836    }
1837    async notifyClientsAboutVersionReady(manifest, hash) {
1838      await this.initialized;
1839      const clients = await this.scope.clients.matchAll();
1840      await Promise.all(clients.map(async (client) => {
1841        const version = this.clientVersionMap.get(client.id);
1842        if (version === void 0) {
1843          return;
1844        }
1845        if (version === this.latestHash) {
1846          return;
1847        }
1848        const current = this.versions.get(version);
1849        const notice = {
1850          type: "VERSION_READY",
1851          currentVersion: this.mergeHashWithAppData(current.manifest, version),
1852          latestVersion: this.mergeHashWithAppData(manifest, hash)
1853        };
1854        client.postMessage(notice);
1855      }));
1856    }
1857    async broadcast(msg) {
1858      const clients = await this.scope.clients.matchAll();
1859      clients.forEach((client) => {
1860        client.postMessage(msg);
1861      });
1862    }
1863    async debugState() {
1864      return {
1865        state: DriverReadyState[this.state],
1866        why: this.stateMessage,
1867        latestHash: this.latestHash,
1868        lastUpdateCheck: this.lastUpdateCheck
1869      };
1870    }
1871    async debugVersions() {
1872      return Array.from(this.versions.keys()).map((hash) => {
1873        const version = this.versions.get(hash);
1874        const clients = Array.from(this.clientVersionMap.entries()).filter(([clientId, version2]) => version2 === hash).map(([clientId, version2]) => clientId);
1875        return {
1876          hash,
1877          manifest: version.manifest,
1878          clients,
1879          status: ""
1880        };
1881      });
1882    }
1883    async debugIdleState() {
1884      return {
1885        queue: this.idle.taskDescriptions,
1886        lastTrigger: this.idle.lastTrigger,
1887        lastRun: this.idle.lastRun
1888      };
1889    }
1890    async safeFetch(req) {
1891      try {
1892        return await this.scope.fetch(req);
1893      } catch (err) {
1894        this.debugger.log(err, `Driver.fetch(${req.url})`);
1895        return this.adapter.newResponse(null, {
1896          status: 504,
1897          statusText: "Gateway Timeout"
1898        });
1899      }
1900    }
1901    async getCacheNames() {
1902      const controlTable = await this.controlTable;
1903      const appVersions = Array.from(this.versions.values());
1904      const appVersionCacheNames = await Promise.all(appVersions.map((version) => version.getCacheNames()));
1905      return [controlTable.cacheName].concat(...appVersionCacheNames);
1906    }
1907  };
1908
1909  
1909// bazel-out/darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/service-worker/worker/main.js
1910  var scope = self;
1911  var adapter = new Adapter(scope.registration.scope, self.caches);
1912  new Driver(scope, adapter, new CacheDatabase(adapter));
1913})();
1914/**
1915 * @license
1916 * Copyright Google LLC All Rights Reserved.
1917 *
1918 * Use of this source code is governed by an MIT-style license that can be
1919 * found in the LICENSE file at https://angular.dev/license
1920 */
1921!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="db6f1645-bf44-5bbd-ae56-2dd383501e03")}catch(e){}}();
1922//# debugId=db6f1645-bf44-5bbd-ae56-2dd383501e03

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.