You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

workbox-ea903bce.js 32KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134
  1. define('./workbox-ea903bce.js', ['exports'], function (t) {
  2. 'use strict'
  3. try {
  4. self['workbox:core:6.1.5'] && _()
  5. } catch (t) {}
  6. const e = (t, ...e) => {
  7. let s = t
  8. return e.length > 0 && (s += ` :: ${JSON.stringify(e)}`), s
  9. }
  10. class s extends Error {
  11. constructor(t, s) {
  12. super(e(t, s)), (this.name = t), (this.details = s)
  13. }
  14. }
  15. try {
  16. self['workbox:routing:6.1.5'] && _()
  17. } catch (t) {}
  18. const n = (t) => (t && 'object' == typeof t ? t : { handle: t })
  19. class i {
  20. constructor(t, e, s = 'GET') {
  21. ;(this.handler = n(e)), (this.match = t), (this.method = s)
  22. }
  23. setCatchHandler(t) {
  24. this.catchHandler = n(t)
  25. }
  26. }
  27. class r extends i {
  28. constructor(t, e, s) {
  29. super(
  30. ({ url: e }) => {
  31. const s = t.exec(e.href)
  32. if (s && (e.origin === location.origin || 0 === s.index))
  33. return s.slice(1)
  34. },
  35. e,
  36. s
  37. )
  38. }
  39. }
  40. class a {
  41. constructor() {
  42. ;(this.t = new Map()), (this.i = new Map())
  43. }
  44. get routes() {
  45. return this.t
  46. }
  47. addFetchListener() {
  48. self.addEventListener('fetch', (t) => {
  49. const { request: e } = t,
  50. s = this.handleRequest({ request: e, event: t })
  51. s && t.respondWith(s)
  52. })
  53. }
  54. addCacheListener() {
  55. self.addEventListener('message', (t) => {
  56. if (t.data && 'CACHE_URLS' === t.data.type) {
  57. const { payload: e } = t.data,
  58. s = Promise.all(
  59. e.urlsToCache.map((e) => {
  60. 'string' == typeof e && (e = [e])
  61. const s = new Request(...e)
  62. return this.handleRequest({ request: s, event: t })
  63. })
  64. )
  65. t.waitUntil(s),
  66. t.ports && t.ports[0] && s.then(() => t.ports[0].postMessage(!0))
  67. }
  68. })
  69. }
  70. handleRequest({ request: t, event: e }) {
  71. const s = new URL(t.url, location.href)
  72. if (!s.protocol.startsWith('http')) return
  73. const n = s.origin === location.origin,
  74. { params: i, route: r } = this.findMatchingRoute({
  75. event: e,
  76. request: t,
  77. sameOrigin: n,
  78. url: s,
  79. })
  80. let a = r && r.handler
  81. const c = t.method
  82. if ((!a && this.i.has(c) && (a = this.i.get(c)), !a)) return
  83. let o
  84. try {
  85. o = a.handle({ url: s, request: t, event: e, params: i })
  86. } catch (t) {
  87. o = Promise.reject(t)
  88. }
  89. const h = r && r.catchHandler
  90. return (
  91. o instanceof Promise &&
  92. (this.o || h) &&
  93. (o = o.catch(async (n) => {
  94. if (h)
  95. try {
  96. return await h.handle({
  97. url: s,
  98. request: t,
  99. event: e,
  100. params: i,
  101. })
  102. } catch (t) {
  103. n = t
  104. }
  105. if (this.o) return this.o.handle({ url: s, request: t, event: e })
  106. throw n
  107. })),
  108. o
  109. )
  110. }
  111. findMatchingRoute({ url: t, sameOrigin: e, request: s, event: n }) {
  112. const i = this.t.get(s.method) || []
  113. for (const r of i) {
  114. let i
  115. const a = r.match({ url: t, sameOrigin: e, request: s, event: n })
  116. if (a)
  117. return (
  118. (i = a),
  119. ((Array.isArray(a) && 0 === a.length) ||
  120. (a.constructor === Object && 0 === Object.keys(a).length) ||
  121. 'boolean' == typeof a) &&
  122. (i = void 0),
  123. { route: r, params: i }
  124. )
  125. }
  126. return {}
  127. }
  128. setDefaultHandler(t, e = 'GET') {
  129. this.i.set(e, n(t))
  130. }
  131. setCatchHandler(t) {
  132. this.o = n(t)
  133. }
  134. registerRoute(t) {
  135. this.t.has(t.method) || this.t.set(t.method, []),
  136. this.t.get(t.method).push(t)
  137. }
  138. unregisterRoute(t) {
  139. if (!this.t.has(t.method))
  140. throw new s('unregister-route-but-not-found-with-method', {
  141. method: t.method,
  142. })
  143. const e = this.t.get(t.method).indexOf(t)
  144. if (!(e > -1)) throw new s('unregister-route-route-not-registered')
  145. this.t.get(t.method).splice(e, 1)
  146. }
  147. }
  148. let c
  149. const o = () => (
  150. c || ((c = new a()), c.addFetchListener(), c.addCacheListener()), c
  151. )
  152. function h(t, e, n) {
  153. let a
  154. if ('string' == typeof t) {
  155. const s = new URL(t, location.href)
  156. a = new i(({ url: t }) => t.href === s.href, e, n)
  157. } else if (t instanceof RegExp) a = new r(t, e, n)
  158. else if ('function' == typeof t) a = new i(t, e, n)
  159. else {
  160. if (!(t instanceof i))
  161. throw new s('unsupported-route-type', {
  162. moduleName: 'workbox-routing',
  163. funcName: 'registerRoute',
  164. paramName: 'capture',
  165. })
  166. a = t
  167. }
  168. return o().registerRoute(a), a
  169. }
  170. try {
  171. self['workbox:strategies:6.1.5'] && _()
  172. } catch (t) {}
  173. const u = {
  174. cacheWillUpdate: async ({ response: t }) =>
  175. 200 === t.status || 0 === t.status ? t : null,
  176. },
  177. l = {
  178. googleAnalytics: 'googleAnalytics',
  179. precache: 'precache-v2',
  180. prefix: 'workbox',
  181. runtime: 'runtime',
  182. suffix: 'undefined' != typeof registration ? registration.scope : '',
  183. },
  184. f = (t) =>
  185. [l.prefix, t, l.suffix].filter((t) => t && t.length > 0).join('-'),
  186. w = (t) => t || f(l.precache),
  187. d = (t) => t || f(l.runtime)
  188. function p() {
  189. return (p =
  190. Object.assign ||
  191. function (t) {
  192. for (var e = 1; e < arguments.length; e++) {
  193. var s = arguments[e]
  194. for (var n in s)
  195. Object.prototype.hasOwnProperty.call(s, n) && (t[n] = s[n])
  196. }
  197. return t
  198. }).apply(this, arguments)
  199. }
  200. function y(t, e) {
  201. const s = new URL(t)
  202. for (const t of e) s.searchParams.delete(t)
  203. return s.href
  204. }
  205. class m {
  206. constructor() {
  207. this.promise = new Promise((t, e) => {
  208. ;(this.resolve = t), (this.reject = e)
  209. })
  210. }
  211. }
  212. const g = new Set()
  213. function R(t) {
  214. return 'string' == typeof t ? new Request(t) : t
  215. }
  216. class v {
  217. constructor(t, e) {
  218. ;(this.h = {}),
  219. Object.assign(this, e),
  220. (this.event = e.event),
  221. (this.u = t),
  222. (this.l = new m()),
  223. (this.p = []),
  224. (this.m = [...t.plugins]),
  225. (this.g = new Map())
  226. for (const t of this.m) this.g.set(t, {})
  227. this.event.waitUntil(this.l.promise)
  228. }
  229. async fetch(t) {
  230. const { event: e } = this
  231. let n = R(t)
  232. if (
  233. 'navigate' === n.mode &&
  234. e instanceof FetchEvent &&
  235. e.preloadResponse
  236. ) {
  237. const t = await e.preloadResponse
  238. if (t) return t
  239. }
  240. const i = this.hasCallback('fetchDidFail') ? n.clone() : null
  241. try {
  242. for (const t of this.iterateCallbacks('requestWillFetch'))
  243. n = await t({ request: n.clone(), event: e })
  244. } catch (t) {
  245. throw new s('plugin-error-request-will-fetch', { thrownError: t })
  246. }
  247. const r = n.clone()
  248. try {
  249. let t
  250. t = await fetch(n, 'navigate' === n.mode ? void 0 : this.u.fetchOptions)
  251. for (const s of this.iterateCallbacks('fetchDidSucceed'))
  252. t = await s({ event: e, request: r, response: t })
  253. return t
  254. } catch (t) {
  255. throw (
  256. (i &&
  257. (await this.runCallbacks('fetchDidFail', {
  258. error: t,
  259. event: e,
  260. originalRequest: i.clone(),
  261. request: r.clone(),
  262. })),
  263. t)
  264. )
  265. }
  266. }
  267. async fetchAndCachePut(t) {
  268. const e = await this.fetch(t),
  269. s = e.clone()
  270. return this.waitUntil(this.cachePut(t, s)), e
  271. }
  272. async cacheMatch(t) {
  273. const e = R(t)
  274. let s
  275. const { cacheName: n, matchOptions: i } = this.u,
  276. r = await this.getCacheKey(e, 'read'),
  277. a = p({}, i, { cacheName: n })
  278. s = await caches.match(r, a)
  279. for (const t of this.iterateCallbacks('cachedResponseWillBeUsed'))
  280. s =
  281. (await t({
  282. cacheName: n,
  283. matchOptions: i,
  284. cachedResponse: s,
  285. request: r,
  286. event: this.event,
  287. })) || void 0
  288. return s
  289. }
  290. async cachePut(t, e) {
  291. const n = R(t)
  292. var i
  293. await ((i = 0), new Promise((t) => setTimeout(t, i)))
  294. const r = await this.getCacheKey(n, 'write')
  295. if (!e)
  296. throw new s('cache-put-with-no-response', {
  297. url:
  298. ((a = r.url),
  299. new URL(String(a), location.href).href.replace(
  300. new RegExp(`^${location.origin}`),
  301. ''
  302. )),
  303. })
  304. var a
  305. const c = await this.R(e)
  306. if (!c) return !1
  307. const { cacheName: o, matchOptions: h } = this.u,
  308. u = await self.caches.open(o),
  309. l = this.hasCallback('cacheDidUpdate'),
  310. f = l
  311. ? await (async function (t, e, s, n) {
  312. const i = y(e.url, s)
  313. if (e.url === i) return t.match(e, n)
  314. const r = p({}, n, { ignoreSearch: !0 }),
  315. a = await t.keys(e, r)
  316. for (const e of a) if (i === y(e.url, s)) return t.match(e, n)
  317. })(u, r.clone(), ['__WB_REVISION__'], h)
  318. : null
  319. try {
  320. await u.put(r, l ? c.clone() : c)
  321. } catch (t) {
  322. throw (
  323. ('QuotaExceededError' === t.name &&
  324. (await (async function () {
  325. for (const t of g) await t()
  326. })()),
  327. t)
  328. )
  329. }
  330. for (const t of this.iterateCallbacks('cacheDidUpdate'))
  331. await t({
  332. cacheName: o,
  333. oldResponse: f,
  334. newResponse: c.clone(),
  335. request: r,
  336. event: this.event,
  337. })
  338. return !0
  339. }
  340. async getCacheKey(t, e) {
  341. if (!this.h[e]) {
  342. let s = t
  343. for (const t of this.iterateCallbacks('cacheKeyWillBeUsed'))
  344. s = R(
  345. await t({
  346. mode: e,
  347. request: s,
  348. event: this.event,
  349. params: this.params,
  350. })
  351. )
  352. this.h[e] = s
  353. }
  354. return this.h[e]
  355. }
  356. hasCallback(t) {
  357. for (const e of this.u.plugins) if (t in e) return !0
  358. return !1
  359. }
  360. async runCallbacks(t, e) {
  361. for (const s of this.iterateCallbacks(t)) await s(e)
  362. }
  363. *iterateCallbacks(t) {
  364. for (const e of this.u.plugins)
  365. if ('function' == typeof e[t]) {
  366. const s = this.g.get(e),
  367. n = (n) => {
  368. const i = p({}, n, { state: s })
  369. return e[t](i)
  370. }
  371. yield n
  372. }
  373. }
  374. waitUntil(t) {
  375. return this.p.push(t), t
  376. }
  377. async doneWaiting() {
  378. let t
  379. for (; (t = this.p.shift()); ) await t
  380. }
  381. destroy() {
  382. this.l.resolve()
  383. }
  384. async R(t) {
  385. let e = t,
  386. s = !1
  387. for (const t of this.iterateCallbacks('cacheWillUpdate'))
  388. if (
  389. ((e =
  390. (await t({
  391. request: this.request,
  392. response: e,
  393. event: this.event,
  394. })) || void 0),
  395. (s = !0),
  396. !e)
  397. )
  398. break
  399. return s || (e && 200 !== e.status && (e = void 0)), e
  400. }
  401. }
  402. class q {
  403. constructor(t = {}) {
  404. ;(this.cacheName = d(t.cacheName)),
  405. (this.plugins = t.plugins || []),
  406. (this.fetchOptions = t.fetchOptions),
  407. (this.matchOptions = t.matchOptions)
  408. }
  409. handle(t) {
  410. const [e] = this.handleAll(t)
  411. return e
  412. }
  413. handleAll(t) {
  414. t instanceof FetchEvent && (t = { event: t, request: t.request })
  415. const e = t.event,
  416. s = 'string' == typeof t.request ? new Request(t.request) : t.request,
  417. n = 'params' in t ? t.params : void 0,
  418. i = new v(this, { event: e, request: s, params: n }),
  419. r = this.v(i, s, e)
  420. return [r, this.q(r, i, s, e)]
  421. }
  422. async v(t, e, n) {
  423. let i
  424. await t.runCallbacks('handlerWillStart', { event: n, request: e })
  425. try {
  426. if (((i = await this.U(e, t)), !i || 'error' === i.type))
  427. throw new s('no-response', { url: e.url })
  428. } catch (s) {
  429. for (const r of t.iterateCallbacks('handlerDidError'))
  430. if (((i = await r({ error: s, event: n, request: e })), i)) break
  431. if (!i) throw s
  432. }
  433. for (const s of t.iterateCallbacks('handlerWillRespond'))
  434. i = await s({ event: n, request: e, response: i })
  435. return i
  436. }
  437. async q(t, e, s, n) {
  438. let i, r
  439. try {
  440. i = await t
  441. } catch (r) {}
  442. try {
  443. await e.runCallbacks('handlerDidRespond', {
  444. event: n,
  445. request: s,
  446. response: i,
  447. }),
  448. await e.doneWaiting()
  449. } catch (t) {
  450. r = t
  451. }
  452. if (
  453. (await e.runCallbacks('handlerDidComplete', {
  454. event: n,
  455. request: s,
  456. response: i,
  457. error: r,
  458. }),
  459. e.destroy(),
  460. r)
  461. )
  462. throw r
  463. }
  464. }
  465. function U(t) {
  466. t.then(() => {})
  467. }
  468. class x {
  469. constructor(t, e, { onupgradeneeded: s, onversionchange: n } = {}) {
  470. ;(this._ = null),
  471. (this.L = t),
  472. (this.N = e),
  473. (this.C = s),
  474. (this.D = n || (() => this.close()))
  475. }
  476. get db() {
  477. return this._
  478. }
  479. async open() {
  480. if (!this._)
  481. return (
  482. (this._ = await new Promise((t, e) => {
  483. let s = !1
  484. setTimeout(() => {
  485. ;(s = !0),
  486. e(new Error('The open request was blocked and timed out'))
  487. }, this.OPEN_TIMEOUT)
  488. const n = indexedDB.open(this.L, this.N)
  489. ;(n.onerror = () => e(n.error)),
  490. (n.onupgradeneeded = (t) => {
  491. s
  492. ? (n.transaction.abort(), n.result.close())
  493. : 'function' == typeof this.C && this.C(t)
  494. }),
  495. (n.onsuccess = () => {
  496. const e = n.result
  497. s ? e.close() : ((e.onversionchange = this.D.bind(this)), t(e))
  498. })
  499. })),
  500. this
  501. )
  502. }
  503. async getKey(t, e) {
  504. return (await this.getAllKeys(t, e, 1))[0]
  505. }
  506. async getAll(t, e, s) {
  507. return await this.getAllMatching(t, { query: e, count: s })
  508. }
  509. async getAllKeys(t, e, s) {
  510. return (
  511. await this.getAllMatching(t, { query: e, count: s, includeKeys: !0 })
  512. ).map((t) => t.key)
  513. }
  514. async getAllMatching(
  515. t,
  516. {
  517. index: e,
  518. query: s = null,
  519. direction: n = 'next',
  520. count: i,
  521. includeKeys: r = !1,
  522. } = {}
  523. ) {
  524. return await this.transaction([t], 'readonly', (a, c) => {
  525. const o = a.objectStore(t),
  526. h = e ? o.index(e) : o,
  527. u = [],
  528. l = h.openCursor(s, n)
  529. l.onsuccess = () => {
  530. const t = l.result
  531. t
  532. ? (u.push(r ? t : t.value),
  533. i && u.length >= i ? c(u) : t.continue())
  534. : c(u)
  535. }
  536. })
  537. }
  538. async transaction(t, e, s) {
  539. return (
  540. await this.open(),
  541. await new Promise((n, i) => {
  542. const r = this._.transaction(t, e)
  543. ;(r.onabort = () => i(r.error)),
  544. (r.oncomplete = () => n()),
  545. s(r, (t) => n(t))
  546. })
  547. )
  548. }
  549. async T(t, e, s, ...n) {
  550. return await this.transaction([e], s, (s, i) => {
  551. const r = s.objectStore(e),
  552. a = r[t].apply(r, n)
  553. a.onsuccess = () => i(a.result)
  554. })
  555. }
  556. close() {
  557. this._ && (this._.close(), (this._ = null))
  558. }
  559. }
  560. x.prototype.OPEN_TIMEOUT = 2e3
  561. const b = {
  562. readonly: ['get', 'count', 'getKey', 'getAll', 'getAllKeys'],
  563. readwrite: ['add', 'put', 'clear', 'delete'],
  564. }
  565. for (const [t, e] of Object.entries(b))
  566. for (const s of e)
  567. s in IDBObjectStore.prototype &&
  568. (x.prototype[s] = async function (e, ...n) {
  569. return await this.T(s, e, t, ...n)
  570. })
  571. try {
  572. self['workbox:expiration:6.1.5'] && _()
  573. } catch (t) {}
  574. const L = 'cache-entries',
  575. N = (t) => {
  576. const e = new URL(t, location.href)
  577. return (e.hash = ''), e.href
  578. }
  579. class C {
  580. constructor(t) {
  581. ;(this.P = t),
  582. (this._ = new x('workbox-expiration', 1, {
  583. onupgradeneeded: (t) => this.k(t),
  584. }))
  585. }
  586. k(t) {
  587. const e = t.target.result.createObjectStore(L, { keyPath: 'id' })
  588. e.createIndex('cacheName', 'cacheName', { unique: !1 }),
  589. e.createIndex('timestamp', 'timestamp', { unique: !1 }),
  590. (async (t) => {
  591. await new Promise((e, s) => {
  592. const n = indexedDB.deleteDatabase(t)
  593. ;(n.onerror = () => {
  594. s(n.error)
  595. }),
  596. (n.onblocked = () => {
  597. s(new Error('Delete blocked'))
  598. }),
  599. (n.onsuccess = () => {
  600. e()
  601. })
  602. })
  603. })(this.P)
  604. }
  605. async setTimestamp(t, e) {
  606. const s = {
  607. url: (t = N(t)),
  608. timestamp: e,
  609. cacheName: this.P,
  610. id: this.K(t),
  611. }
  612. await this._.put(L, s)
  613. }
  614. async getTimestamp(t) {
  615. return (await this._.get(L, this.K(t))).timestamp
  616. }
  617. async expireEntries(t, e) {
  618. const s = await this._.transaction(L, 'readwrite', (s, n) => {
  619. const i = s
  620. .objectStore(L)
  621. .index('timestamp')
  622. .openCursor(null, 'prev'),
  623. r = []
  624. let a = 0
  625. i.onsuccess = () => {
  626. const s = i.result
  627. if (s) {
  628. const n = s.value
  629. n.cacheName === this.P &&
  630. ((t && n.timestamp < t) || (e && a >= e)
  631. ? r.push(s.value)
  632. : a++),
  633. s.continue()
  634. } else n(r)
  635. }
  636. }),
  637. n = []
  638. for (const t of s) await this._.delete(L, t.id), n.push(t.url)
  639. return n
  640. }
  641. K(t) {
  642. return this.P + '|' + N(t)
  643. }
  644. }
  645. class E {
  646. constructor(t, e = {}) {
  647. ;(this.O = !1),
  648. (this.W = !1),
  649. (this.M = e.maxEntries),
  650. (this.A = e.maxAgeSeconds),
  651. (this.S = e.matchOptions),
  652. (this.P = t),
  653. (this.I = new C(t))
  654. }
  655. async expireEntries() {
  656. if (this.O) return void (this.W = !0)
  657. this.O = !0
  658. const t = this.A ? Date.now() - 1e3 * this.A : 0,
  659. e = await this.I.expireEntries(t, this.M),
  660. s = await self.caches.open(this.P)
  661. for (const t of e) await s.delete(t, this.S)
  662. ;(this.O = !1), this.W && ((this.W = !1), U(this.expireEntries()))
  663. }
  664. async updateTimestamp(t) {
  665. await this.I.setTimestamp(t, Date.now())
  666. }
  667. async isURLExpired(t) {
  668. if (this.A) {
  669. return (await this.I.getTimestamp(t)) < Date.now() - 1e3 * this.A
  670. }
  671. return !1
  672. }
  673. async delete() {
  674. ;(this.W = !1), await this.I.expireEntries(1 / 0)
  675. }
  676. }
  677. function D(t, e) {
  678. const s = e()
  679. return t.waitUntil(s), s
  680. }
  681. try {
  682. self['workbox:precaching:6.1.5'] && _()
  683. } catch (t) {}
  684. function T(t) {
  685. if (!t) throw new s('add-to-cache-list-unexpected-type', { entry: t })
  686. if ('string' == typeof t) {
  687. const e = new URL(t, location.href)
  688. return { cacheKey: e.href, url: e.href }
  689. }
  690. const { revision: e, url: n } = t
  691. if (!n) throw new s('add-to-cache-list-unexpected-type', { entry: t })
  692. if (!e) {
  693. const t = new URL(n, location.href)
  694. return { cacheKey: t.href, url: t.href }
  695. }
  696. const i = new URL(n, location.href),
  697. r = new URL(n, location.href)
  698. return (
  699. i.searchParams.set('__WB_REVISION__', e),
  700. { cacheKey: i.href, url: r.href }
  701. )
  702. }
  703. class P {
  704. constructor() {
  705. ;(this.updatedURLs = []),
  706. (this.notUpdatedURLs = []),
  707. (this.handlerWillStart = async ({ request: t, state: e }) => {
  708. e && (e.originalRequest = t)
  709. }),
  710. (this.cachedResponseWillBeUsed = async ({
  711. event: t,
  712. state: e,
  713. cachedResponse: s,
  714. }) => {
  715. if ('install' === t.type) {
  716. const t = e.originalRequest.url
  717. s ? this.notUpdatedURLs.push(t) : this.updatedURLs.push(t)
  718. }
  719. return s
  720. })
  721. }
  722. }
  723. class k {
  724. constructor({ precacheController: t }) {
  725. ;(this.cacheKeyWillBeUsed = async ({ request: t, params: e }) => {
  726. const s = (e && e.cacheKey) || this.j.getCacheKeyForURL(t.url)
  727. return s ? new Request(s) : t
  728. }),
  729. (this.j = t)
  730. }
  731. }
  732. let K, O
  733. async function W(t, e) {
  734. let n = null
  735. if (t.url) {
  736. n = new URL(t.url).origin
  737. }
  738. if (n !== self.location.origin)
  739. throw new s('cross-origin-copy-response', { origin: n })
  740. const i = t.clone(),
  741. r = {
  742. headers: new Headers(i.headers),
  743. status: i.status,
  744. statusText: i.statusText,
  745. },
  746. a = e ? e(r) : r,
  747. c = (function () {
  748. if (void 0 === K) {
  749. const t = new Response('')
  750. if ('body' in t)
  751. try {
  752. new Response(t.body), (K = !0)
  753. } catch (t) {
  754. K = !1
  755. }
  756. K = !1
  757. }
  758. return K
  759. })()
  760. ? i.body
  761. : await i.blob()
  762. return new Response(c, a)
  763. }
  764. class M extends q {
  765. constructor(t = {}) {
  766. ;(t.cacheName = w(t.cacheName)),
  767. super(t),
  768. (this.F = !1 !== t.fallbackToNetwork),
  769. this.plugins.push(M.copyRedirectedCacheableResponsesPlugin)
  770. }
  771. async U(t, e) {
  772. const s = await e.cacheMatch(t)
  773. return (
  774. s ||
  775. (e.event && 'install' === e.event.type
  776. ? await this.B(t, e)
  777. : await this.H(t, e))
  778. )
  779. }
  780. async H(t, e) {
  781. let n
  782. if (!this.F)
  783. throw new s('missing-precache-entry', {
  784. cacheName: this.cacheName,
  785. url: t.url,
  786. })
  787. return (n = await e.fetch(t)), n
  788. }
  789. async B(t, e) {
  790. this.$()
  791. const n = await e.fetch(t)
  792. if (!(await e.cachePut(t, n.clone())))
  793. throw new s('bad-precaching-response', { url: t.url, status: n.status })
  794. return n
  795. }
  796. $() {
  797. let t = null,
  798. e = 0
  799. for (const [s, n] of this.plugins.entries())
  800. n !== M.copyRedirectedCacheableResponsesPlugin &&
  801. (n === M.defaultPrecacheCacheabilityPlugin && (t = s),
  802. n.cacheWillUpdate && e++)
  803. 0 === e
  804. ? this.plugins.push(M.defaultPrecacheCacheabilityPlugin)
  805. : e > 1 && null !== t && this.plugins.splice(t, 1)
  806. }
  807. }
  808. ;(M.defaultPrecacheCacheabilityPlugin = {
  809. cacheWillUpdate: async ({ response: t }) =>
  810. !t || t.status >= 400 ? null : t,
  811. }),
  812. (M.copyRedirectedCacheableResponsesPlugin = {
  813. cacheWillUpdate: async ({ response: t }) =>
  814. t.redirected ? await W(t) : t,
  815. })
  816. class A {
  817. constructor({
  818. cacheName: t,
  819. plugins: e = [],
  820. fallbackToNetwork: s = !0,
  821. } = {}) {
  822. ;(this.G = new Map()),
  823. (this.V = new Map()),
  824. (this.J = new Map()),
  825. (this.u = new M({
  826. cacheName: w(t),
  827. plugins: [...e, new k({ precacheController: this })],
  828. fallbackToNetwork: s,
  829. })),
  830. (this.install = this.install.bind(this)),
  831. (this.activate = this.activate.bind(this))
  832. }
  833. get strategy() {
  834. return this.u
  835. }
  836. precache(t) {
  837. this.addToCacheList(t),
  838. this.X ||
  839. (self.addEventListener('install', this.install),
  840. self.addEventListener('activate', this.activate),
  841. (this.X = !0))
  842. }
  843. addToCacheList(t) {
  844. const e = []
  845. for (const n of t) {
  846. 'string' == typeof n
  847. ? e.push(n)
  848. : n && void 0 === n.revision && e.push(n.url)
  849. const { cacheKey: t, url: i } = T(n),
  850. r = 'string' != typeof n && n.revision ? 'reload' : 'default'
  851. if (this.G.has(i) && this.G.get(i) !== t)
  852. throw new s('add-to-cache-list-conflicting-entries', {
  853. firstEntry: this.G.get(i),
  854. secondEntry: t,
  855. })
  856. if ('string' != typeof n && n.integrity) {
  857. if (this.J.has(t) && this.J.get(t) !== n.integrity)
  858. throw new s('add-to-cache-list-conflicting-integrities', { url: i })
  859. this.J.set(t, n.integrity)
  860. }
  861. if ((this.G.set(i, t), this.V.set(i, r), e.length > 0)) {
  862. const t = `Workbox is precaching URLs without revision info: ${e.join(
  863. ', '
  864. )}\nThis is generally NOT safe. Learn more at https://bit.ly/wb-precache`
  865. console.warn(t)
  866. }
  867. }
  868. }
  869. install(t) {
  870. return D(t, async () => {
  871. const e = new P()
  872. this.strategy.plugins.push(e)
  873. for (const [e, s] of this.G) {
  874. const n = this.J.get(s),
  875. i = this.V.get(e),
  876. r = new Request(e, {
  877. integrity: n,
  878. cache: i,
  879. credentials: 'same-origin',
  880. })
  881. await Promise.all(
  882. this.strategy.handleAll({
  883. params: { cacheKey: s },
  884. request: r,
  885. event: t,
  886. })
  887. )
  888. }
  889. const { updatedURLs: s, notUpdatedURLs: n } = e
  890. return { updatedURLs: s, notUpdatedURLs: n }
  891. })
  892. }
  893. activate(t) {
  894. return D(t, async () => {
  895. const t = await self.caches.open(this.strategy.cacheName),
  896. e = await t.keys(),
  897. s = new Set(this.G.values()),
  898. n = []
  899. for (const i of e) s.has(i.url) || (await t.delete(i), n.push(i.url))
  900. return { deletedURLs: n }
  901. })
  902. }
  903. getURLsToCacheKeys() {
  904. return this.G
  905. }
  906. getCachedURLs() {
  907. return [...this.G.keys()]
  908. }
  909. getCacheKeyForURL(t) {
  910. const e = new URL(t, location.href)
  911. return this.G.get(e.href)
  912. }
  913. async matchPrecache(t) {
  914. const e = t instanceof Request ? t.url : t,
  915. s = this.getCacheKeyForURL(e)
  916. if (s) {
  917. return (await self.caches.open(this.strategy.cacheName)).match(s)
  918. }
  919. }
  920. createHandlerBoundToURL(t) {
  921. const e = this.getCacheKeyForURL(t)
  922. if (!e) throw new s('non-precached-url', { url: t })
  923. return (s) => (
  924. (s.request = new Request(t)),
  925. (s.params = p({ cacheKey: e }, s.params)),
  926. this.strategy.handle(s)
  927. )
  928. }
  929. }
  930. const S = () => (O || (O = new A()), O)
  931. class I extends i {
  932. constructor(t, e) {
  933. super(({ request: s }) => {
  934. const n = t.getURLsToCacheKeys()
  935. for (const t of (function* (
  936. t,
  937. {
  938. ignoreURLParametersMatching: e = [/^utm_/, /^fbclid$/],
  939. directoryIndex: s = 'index.html',
  940. cleanURLs: n = !0,
  941. urlManipulation: i,
  942. } = {}
  943. ) {
  944. const r = new URL(t, location.href)
  945. ;(r.hash = ''), yield r.href
  946. const a = (function (t, e = []) {
  947. for (const s of [...t.searchParams.keys()])
  948. e.some((t) => t.test(s)) && t.searchParams.delete(s)
  949. return t
  950. })(r, e)
  951. if ((yield a.href, s && a.pathname.endsWith('/'))) {
  952. const t = new URL(a.href)
  953. ;(t.pathname += s), yield t.href
  954. }
  955. if (n) {
  956. const t = new URL(a.href)
  957. ;(t.pathname += '.html'), yield t.href
  958. }
  959. if (i) {
  960. const t = i({ url: r })
  961. for (const e of t) yield e.href
  962. }
  963. })(s.url, e)) {
  964. const e = n.get(t)
  965. if (e) return { cacheKey: e }
  966. }
  967. }, t.strategy)
  968. }
  969. }
  970. ;(t.CacheFirst = class extends q {
  971. async U(t, e) {
  972. let n,
  973. i = await e.cacheMatch(t)
  974. if (!i)
  975. try {
  976. i = await e.fetchAndCachePut(t)
  977. } catch (t) {
  978. n = t
  979. }
  980. if (!i) throw new s('no-response', { url: t.url, error: n })
  981. return i
  982. }
  983. }),
  984. (t.ExpirationPlugin = class {
  985. constructor(t = {}) {
  986. var e
  987. ;(this.cachedResponseWillBeUsed = async ({
  988. event: t,
  989. request: e,
  990. cacheName: s,
  991. cachedResponse: n,
  992. }) => {
  993. if (!n) return null
  994. const i = this.Y(n),
  995. r = this.Z(s)
  996. U(r.expireEntries())
  997. const a = r.updateTimestamp(e.url)
  998. if (t)
  999. try {
  1000. t.waitUntil(a)
  1001. } catch (t) {}
  1002. return i ? n : null
  1003. }),
  1004. (this.cacheDidUpdate = async ({ cacheName: t, request: e }) => {
  1005. const s = this.Z(t)
  1006. await s.updateTimestamp(e.url), await s.expireEntries()
  1007. }),
  1008. (this.tt = t),
  1009. (this.A = t.maxAgeSeconds),
  1010. (this.et = new Map()),
  1011. t.purgeOnQuotaError &&
  1012. ((e = () => this.deleteCacheAndMetadata()), g.add(e))
  1013. }
  1014. Z(t) {
  1015. if (t === d()) throw new s('expire-custom-caches-only')
  1016. let e = this.et.get(t)
  1017. return e || ((e = new E(t, this.tt)), this.et.set(t, e)), e
  1018. }
  1019. Y(t) {
  1020. if (!this.A) return !0
  1021. const e = this.st(t)
  1022. if (null === e) return !0
  1023. return e >= Date.now() - 1e3 * this.A
  1024. }
  1025. st(t) {
  1026. if (!t.headers.has('date')) return null
  1027. const e = t.headers.get('date'),
  1028. s = new Date(e).getTime()
  1029. return isNaN(s) ? null : s
  1030. }
  1031. async deleteCacheAndMetadata() {
  1032. for (const [t, e] of this.et)
  1033. await self.caches.delete(t), await e.delete()
  1034. this.et = new Map()
  1035. }
  1036. }),
  1037. (t.NetworkFirst = class extends q {
  1038. constructor(t = {}) {
  1039. super(t),
  1040. this.plugins.some((t) => 'cacheWillUpdate' in t) ||
  1041. this.plugins.unshift(u),
  1042. (this.nt = t.networkTimeoutSeconds || 0)
  1043. }
  1044. async U(t, e) {
  1045. const n = [],
  1046. i = []
  1047. let r
  1048. if (this.nt) {
  1049. const { id: s, promise: a } = this.it({
  1050. request: t,
  1051. logs: n,
  1052. handler: e,
  1053. })
  1054. ;(r = s), i.push(a)
  1055. }
  1056. const a = this.rt({ timeoutId: r, request: t, logs: n, handler: e })
  1057. i.push(a)
  1058. const c = await e.waitUntil(
  1059. (async () => (await e.waitUntil(Promise.race(i))) || (await a))()
  1060. )
  1061. if (!c) throw new s('no-response', { url: t.url })
  1062. return c
  1063. }
  1064. it({ request: t, logs: e, handler: s }) {
  1065. let n
  1066. return {
  1067. promise: new Promise((e) => {
  1068. n = setTimeout(async () => {
  1069. e(await s.cacheMatch(t))
  1070. }, 1e3 * this.nt)
  1071. }),
  1072. id: n,
  1073. }
  1074. }
  1075. async rt({ timeoutId: t, request: e, logs: s, handler: n }) {
  1076. let i, r
  1077. try {
  1078. r = await n.fetchAndCachePut(e)
  1079. } catch (t) {
  1080. i = t
  1081. }
  1082. return t && clearTimeout(t), (!i && r) || (r = await n.cacheMatch(e)), r
  1083. }
  1084. }),
  1085. (t.StaleWhileRevalidate = class extends q {
  1086. constructor(t) {
  1087. super(t),
  1088. this.plugins.some((t) => 'cacheWillUpdate' in t) ||
  1089. this.plugins.unshift(u)
  1090. }
  1091. async U(t, e) {
  1092. const n = e.fetchAndCachePut(t).catch(() => {})
  1093. let i,
  1094. r = await e.cacheMatch(t)
  1095. if (r);
  1096. else
  1097. try {
  1098. r = await n
  1099. } catch (t) {
  1100. i = t
  1101. }
  1102. if (!r) throw new s('no-response', { url: t.url, error: i })
  1103. return r
  1104. }
  1105. }),
  1106. (t.cleanupOutdatedCaches = function () {
  1107. self.addEventListener('activate', (t) => {
  1108. const e = w()
  1109. t.waitUntil(
  1110. (async (t, e = '-precache-') => {
  1111. const s = (await self.caches.keys()).filter(
  1112. (s) =>
  1113. s.includes(e) && s.includes(self.registration.scope) && s !== t
  1114. )
  1115. return await Promise.all(s.map((t) => self.caches.delete(t))), s
  1116. })(e).then((t) => {})
  1117. )
  1118. })
  1119. }),
  1120. (t.clientsClaim = function () {
  1121. self.addEventListener('activate', () => self.clients.claim())
  1122. }),
  1123. (t.precacheAndRoute = function (t, e) {
  1124. !(function (t) {
  1125. S().precache(t)
  1126. })(t),
  1127. (function (t) {
  1128. const e = S()
  1129. h(new I(e, t))
  1130. })(e)
  1131. }),
  1132. (t.registerRoute = h)
  1133. })
  1134. //# sourceMappingURL=workbox-ea903bce.js.map