From 101135ba8a767522cada2a488404a7821638747f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Roche?= Date: Mon, 22 Apr 2024 14:57:25 +0200 Subject: [PATCH] update links --- .../lighthouse-on-vercel-preview-url.yml | 4 +- HOW-TO.md | 2 +- app/(pages)/(components)/wrapper/index.js | 2 +- components/gsap/scroll-trigger.js | 2 +- components/link/index.js | 2 +- components/scrollbar/index.js | 2 +- docs/gsap/README.md | 2 +- libs/{react-lenis => lenis}/index.js | 0 libs/webgl/components/image/webgl.js | 2 +- libs/webgl/hooks/use-webgl-rect.js | 2 +- public/sw.js | 338 +++++++++++++++++- public/swe-worker-ab00d3c7d2d59769.js | 1 - public/swe-worker-development.js | 102 ++++++ 13 files changed, 448 insertions(+), 13 deletions(-) rename libs/{react-lenis => lenis}/index.js (100%) delete mode 100644 public/swe-worker-ab00d3c7d2d59769.js create mode 100644 public/swe-worker-development.js diff --git a/.github/workflows/lighthouse-on-vercel-preview-url.yml b/.github/workflows/lighthouse-on-vercel-preview-url.yml index b15c5807..abfbb708 100644 --- a/.github/workflows/lighthouse-on-vercel-preview-url.yml +++ b/.github/workflows/lighthouse-on-vercel-preview-url.yml @@ -18,8 +18,8 @@ jobs: env: VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} with: - # find project id here: https://vercel.com/studio-freight/satus/settings - vercel_team_id: 'studio-freight' + # find project id here: https://vercel.com/darkroom-engineering/satus/settings + vercel_team_id: 'darkroom-engineering' vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID }} - uses: actions/checkout@v4.1.1 - name: Audit preview URL with Lighthouse diff --git a/HOW-TO.md b/HOW-TO.md index 5a0ab0eb..6800b977 100644 --- a/HOW-TO.md +++ b/HOW-TO.md @@ -8,7 +8,7 @@ Navigate to /debug/orchestra page to see the debug panel. ### Use Lenis -[See documentation](https://github.com/studio-freight/lenis/tree/main/packages/react-lenis) +[See documentation](https://github.com/darkroomengineering/lenis/blob/main/packages/react/README.md) ### Add WebGL diff --git a/app/(pages)/(components)/wrapper/index.js b/app/(pages)/(components)/wrapper/index.js index 010ca741..bedab563 100644 --- a/app/(pages)/(components)/wrapper/index.js +++ b/app/(pages)/(components)/wrapper/index.js @@ -1,5 +1,5 @@ import cn from 'clsx' -import { Lenis } from 'libs/react-lenis' +import { Lenis } from 'libs/lenis' import { Canvas } from 'libs/webgl/components/canvas' import { Footer } from '../footer' import { Navigation } from '../navigation' diff --git a/components/gsap/scroll-trigger.js b/components/gsap/scroll-trigger.js index 0511279e..0a123c48 100644 --- a/components/gsap/scroll-trigger.js +++ b/components/gsap/scroll-trigger.js @@ -2,7 +2,7 @@ import gsap from 'gsap' import { ScrollTrigger } from 'gsap/all' -import { useLenis } from 'libs/react-lenis' +import { useLenis } from 'libs/lenis' import { useEffect, useLayoutEffect } from 'react' export function ScrollTriggerConfig() { diff --git a/components/link/index.js b/components/link/index.js index ac739b56..26c0b7b7 100644 --- a/components/link/index.js +++ b/components/link/index.js @@ -1,6 +1,6 @@ 'use client' -import { useLenis } from 'libs/react-lenis' +import { useLenis } from 'libs/lenis' import NextLink from 'next/link' import { usePathname } from 'next/navigation' import { forwardRef } from 'react' diff --git a/components/scrollbar/index.js b/components/scrollbar/index.js index f929bff0..7851c8f1 100644 --- a/components/scrollbar/index.js +++ b/components/scrollbar/index.js @@ -1,7 +1,7 @@ 'use client' import { useRect } from '@darkroom.engineering/hamo' -import { useLenis } from '@studio-freight/react-lenis' +import { useLenis } from 'libs/lenis' import { mapRange } from 'libs/maths' import { useEffect, useRef } from 'react' import s from './scrollbar.module.scss' diff --git a/docs/gsap/README.md b/docs/gsap/README.md index 950e5fd4..15a5ac2e 100644 --- a/docs/gsap/README.md +++ b/docs/gsap/README.md @@ -4,7 +4,7 @@ Satūs uses GSAP for animations ## Usage -To setup GSAP in your project, you can import it like with the `` component, it will merge automatically merge GSAP ticker with [Tempus](https://www.npmjs.com/package/@studio-freight/tempus). If `scrollTrigger` is passed as a prop, it will also setup ScrollTrigger so it's synced with [Lenis](https://www.npmjs.com/package/@studio-freight/lenis). +To setup GSAP in your project, you can import it like with the `` component, it will merge automatically merge GSAP ticker with [Tempus](https://www.npmjs.com/package/@darkroom.engineering/tempus). If `scrollTrigger` is passed as a prop, it will also setup ScrollTrigger so it's synced with [Lenis](https://www.npmjs.com/package/@darkroom.engineering/lenis). ```jsx diff --git a/libs/react-lenis/index.js b/libs/lenis/index.js similarity index 100% rename from libs/react-lenis/index.js rename to libs/lenis/index.js diff --git a/libs/webgl/components/image/webgl.js b/libs/webgl/components/image/webgl.js index af360233..253c6d46 100644 --- a/libs/webgl/components/image/webgl.js +++ b/libs/webgl/components/image/webgl.js @@ -1,4 +1,4 @@ -import { useLenis } from '@studio-freight/react-lenis' +import { useLenis } from 'libs/lenis' import { useTexture } from 'libs/webgl/hooks/use-texture' import { useWebGLRect } from 'libs/webgl/hooks/use-webgl-rect' import { useRef, useState } from 'react' diff --git a/libs/webgl/hooks/use-webgl-rect.js b/libs/webgl/hooks/use-webgl-rect.js index 4a01c919..aa454e73 100644 --- a/libs/webgl/hooks/use-webgl-rect.js +++ b/libs/webgl/hooks/use-webgl-rect.js @@ -1,6 +1,6 @@ import { useThree } from '@react-three/fiber' -import { useLenis } from '@studio-freight/react-lenis' import { useTransform } from 'hooks/use-transform' +import { useLenis } from 'libs/lenis' import { useCallback, useRef } from 'react' import { Euler, Vector3 } from 'three' diff --git a/public/sw.js b/public/sw.js index 32bba9e8..6f84802c 100644 --- a/public/sw.js +++ b/public/sw.js @@ -1,2 +1,336 @@ -!function(){"use strict";let e,t,a,s,r,i;let n={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"serwist",runtime:"runtime",suffix:"undefined"!=typeof registration?registration.scope:""},c=e=>[n.prefix,e,n.suffix].filter(e=>e&&e.length>0).join("-"),l=e=>e||c(n.precache),o=e=>e||c(n.runtime),h=(e,...t)=>{let a=e;return t.length>0&&(a+=` :: ${JSON.stringify(t)}`),a};class u extends Error{details;constructor(e,t){super(h(e,t)),this.name=e,this.details=t}}let d=new Set;class f{promise;resolve;reject;constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}function m(e,t){let a=new URL(e);for(let e of t)a.searchParams.delete(e);return a.href}async function w(e,t,a,s){let r=m(t.url,a);if(t.url===r)return e.match(t,s);let i={...s,ignoreSearch:!0};for(let n of(await e.keys(t,i)))if(r===m(n.url,a))return e.match(n,s)}let p=async()=>{for(let e of d)await e()},g=e=>new URL(String(e),location.href).href.replace(RegExp(`^${location.origin}`),"");function y(e){return"string"==typeof e?new Request(e):e}class _{event;request;url;params;_cacheKeys={};_strategy;_handlerDeferred;_extendLifetimePromises;_plugins;_pluginStateMap;constructor(e,t){for(let a of(this.event=t.event,this.request=t.request,t.url&&(this.url=t.url,this.params=t.params),this._strategy=e,this._handlerDeferred=new f,this._extendLifetimePromises=[],this._plugins=[...e.plugins],this._pluginStateMap=new Map,this._plugins))this._pluginStateMap.set(a,{});this.event.waitUntil(this._handlerDeferred.promise)}async fetch(e){let{event:t}=this,a=y(e);if("navigate"===a.mode&&t instanceof FetchEvent&&t.preloadResponse){let e=await t.preloadResponse;if(e)return e}let s=this.hasCallback("fetchDidFail")?a.clone():null;try{for(let e of this.iterateCallbacks("requestWillFetch"))a=await e({request:a.clone(),event:t})}catch(e){if(e instanceof Error)throw new u("plugin-error-request-will-fetch",{thrownErrorMessage:e.message})}let r=a.clone();try{let e;for(let s of(e=await fetch(a,"navigate"===a.mode?void 0:this._strategy.fetchOptions),this.iterateCallbacks("fetchDidSucceed")))e=await s({event:t,request:r,response:e});return e}catch(e){throw s&&await this.runCallbacks("fetchDidFail",{error:e,event:t,originalRequest:s.clone(),request:r.clone()}),e}}async fetchAndCachePut(e){let t=await this.fetch(e),a=t.clone();return this.waitUntil(this.cachePut(e,a)),t}async cacheMatch(e){let t;let a=y(e),{cacheName:s,matchOptions:r}=this._strategy,i=await this.getCacheKey(a,"read"),n={...r,cacheName:s};for(let e of(t=await caches.match(i,n),this.iterateCallbacks("cachedResponseWillBeUsed")))t=await e({cacheName:s,matchOptions:r,cachedResponse:t,request:i,event:this.event})||void 0;return t}async cachePut(e,t){let a=y(e);await new Promise(e=>setTimeout(e,0));let s=await this.getCacheKey(a,"write");if(!t)throw new u("cache-put-with-no-response",{url:g(s.url)});let r=await this._ensureResponseSafeToCache(t);if(!r)return!1;let{cacheName:i,matchOptions:n}=this._strategy,c=await self.caches.open(i),l=this.hasCallback("cacheDidUpdate"),o=l?await w(c,s.clone(),["__WB_REVISION__"],n):null;try{await c.put(s,l?r.clone():r)}catch(e){if(e instanceof Error)throw"QuotaExceededError"===e.name&&await p(),e}for(let e of this.iterateCallbacks("cacheDidUpdate"))await e({cacheName:i,oldResponse:o,newResponse:r.clone(),request:s,event:this.event});return!0}async getCacheKey(e,t){let a=`${e.url} | ${t}`;if(!this._cacheKeys[a]){let s=e;for(let e of this.iterateCallbacks("cacheKeyWillBeUsed"))s=y(await e({mode:t,request:s,event:this.event,params:this.params}));this._cacheKeys[a]=s}return this._cacheKeys[a]}hasCallback(e){for(let t of this._strategy.plugins)if(e in t)return!0;return!1}async runCallbacks(e,t){for(let a of this.iterateCallbacks(e))await a(t)}*iterateCallbacks(e){for(let t of this._strategy.plugins)if("function"==typeof t[e]){let a=this._pluginStateMap.get(t),s=s=>{let r={...s,state:a};return t[e](r)};yield s}}waitUntil(e){return this._extendLifetimePromises.push(e),e}async doneWaiting(){let e;for(;e=this._extendLifetimePromises.shift();)await e}destroy(){this._handlerDeferred.resolve(null)}async _ensureResponseSafeToCache(e){let t=e,a=!1;for(let e of this.iterateCallbacks("cacheWillUpdate"))if(t=await e({request:this.request,response:t,event:this.event})||void 0,a=!0,!t)break;return!a&&t&&200!==t.status&&(t=void 0),t}}class b{cacheName;plugins;fetchOptions;matchOptions;constructor(e={}){this.cacheName=o(e.cacheName),this.plugins=e.plugins||[],this.fetchOptions=e.fetchOptions,this.matchOptions=e.matchOptions}handle(e){let[t]=this.handleAll(e);return t}handleAll(e){e instanceof FetchEvent&&(e={event:e,request:e.request});let t=e.event,a="string"==typeof e.request?new Request(e.request):e.request,s=new _(this,e.url?{event:t,request:a,url:e.url,params:e.params}:{event:t,request:a}),r=this._getResponse(s,a,t),i=this._awaitComplete(r,s,a,t);return[r,i]}async _getResponse(e,t,a){let s;await e.runCallbacks("handlerWillStart",{event:a,request:t});try{if(s=await this._handle(t,e),void 0===s||"error"===s.type)throw new u("no-response",{url:t.url})}catch(r){if(r instanceof Error){for(let i of e.iterateCallbacks("handlerDidError"))if(void 0!==(s=await i({error:r,event:a,request:t})))break}if(!s)throw r}for(let r of e.iterateCallbacks("handlerWillRespond"))s=await r({event:a,request:t,response:s});return s}async _awaitComplete(e,t,a,s){let r,i;try{r=await e}catch(e){}try{await t.runCallbacks("handlerDidRespond",{event:s,request:a,response:r}),await t.doneWaiting()}catch(e){e instanceof Error&&(i=e)}if(await t.runCallbacks("handlerDidComplete",{event:s,request:a,response:r,error:i}),t.destroy(),i)throw i}}let x={cacheWillUpdate:async({response:e})=>200===e.status||0===e.status?e:null};class v extends b{_networkTimeoutSeconds;constructor(e={}){super(e),this.plugins.some(e=>"cacheWillUpdate"in e)||this.plugins.unshift(x),this._networkTimeoutSeconds=e.networkTimeoutSeconds||0}async _handle(e,t){let a;let s=[],r=[];if(this._networkTimeoutSeconds){let{id:i,promise:n}=this._getTimeoutPromise({request:e,logs:s,handler:t});a=i,r.push(n)}let i=this._getNetworkPromise({timeoutId:a,request:e,logs:s,handler:t});r.push(i);let n=await t.waitUntil((async()=>await t.waitUntil(Promise.race(r))||await i)());if(!n)throw new u("no-response",{url:e.url});return n}_getTimeoutPromise({request:e,logs:t,handler:a}){let s;return{promise:new Promise(t=>{s=setTimeout(async()=>{t(await a.cacheMatch(e))},1e3*this._networkTimeoutSeconds)}),id:s}}async _getNetworkPromise({timeoutId:e,request:t,logs:a,handler:s}){let r,i;try{i=await s.fetchAndCachePut(t)}catch(e){e instanceof Error&&(r=e)}return e&&clearTimeout(e),(r||!i)&&(i=await s.cacheMatch(t)),i}}let E=(e,t)=>t.some(t=>e instanceof t),R=new WeakMap,q=new WeakMap,S=new WeakMap,C={get(e,t,a){if(e instanceof IDBTransaction){if("done"===t)return R.get(e);if("store"===t)return a.objectStoreNames[1]?void 0:a.objectStore(a.objectStoreNames[0])}return D(e[t])},set:(e,t,a)=>(e[t]=a,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function D(e){var s;if(e instanceof IDBRequest)return function(e){let t=new Promise((t,a)=>{let s=()=>{e.removeEventListener("success",r),e.removeEventListener("error",i)},r=()=>{t(D(e.result)),s()},i=()=>{a(e.error),s()};e.addEventListener("success",r),e.addEventListener("error",i)});return S.set(t,e),t}(e);if(q.has(e))return q.get(e);let r="function"==typeof(s=e)?(a||(a=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(s)?function(...e){return s.apply(P(this),e),D(this.request)}:function(...e){return D(s.apply(P(this),e))}:(s instanceof IDBTransaction&&function(e){if(R.has(e))return;let t=new Promise((t,a)=>{let s=()=>{e.removeEventListener("complete",r),e.removeEventListener("error",i),e.removeEventListener("abort",i)},r=()=>{t(),s()},i=()=>{a(e.error||new DOMException("AbortError","AbortError")),s()};e.addEventListener("complete",r),e.addEventListener("error",i),e.addEventListener("abort",i)});R.set(e,t)}(s),E(s,t||(t=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])))?new Proxy(s,C):s;return r!==e&&(q.set(e,r),S.set(r,e)),r}let P=e=>S.get(e);function k(e,t,{blocked:a,upgrade:s,blocking:r,terminated:i}={}){let n=indexedDB.open(e,t),c=D(n);return s&&n.addEventListener("upgradeneeded",e=>{s(D(n.result),e.oldVersion,e.newVersion,D(n.transaction),e)}),a&&n.addEventListener("blocked",e=>a(e.oldVersion,e.newVersion,e)),c.then(e=>{i&&e.addEventListener("close",()=>i()),r&&e.addEventListener("versionchange",e=>r(e.oldVersion,e.newVersion,e))}).catch(()=>{}),c}let N=["get","getKey","getAll","getAllKeys","count"],T=["put","add","delete","clear"],A=new Map;function I(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t))return;if(A.get(t))return A.get(t);let a=t.replace(/FromIndex$/,""),s=t!==a,r=T.includes(a);if(!(a in(s?IDBIndex:IDBObjectStore).prototype)||!(r||N.includes(a)))return;let i=async function(e,...t){let i=this.transaction(e,r?"readwrite":"readonly"),n=i.store;return s&&(n=n.index(t.shift())),(await Promise.all([n[a](...t),r&&i.done]))[0]};return A.set(t,i),i}C={...r=C,get:(e,t,a)=>I(e,t)||r.get(e,t,a),has:(e,t)=>!!I(e,t)||r.has(e,t)};let U=["continue","continuePrimaryKey","advance"],L={},F=new WeakMap,M=new WeakMap,W={get(e,t){if(!U.includes(t))return e[t];let a=L[t];return a||(a=L[t]=function(...e){F.set(this,M.get(this)[t](...e))}),a}};async function*K(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;let a=new Proxy(t,W);for(M.set(a,t),S.set(a,P(t));t;)yield a,t=await (F.get(a)||t.continue()),F.delete(a)}function O(e,t){return t===Symbol.asyncIterator&&E(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&E(e,[IDBIndex,IDBObjectStore])}C={...i=C,get:(e,t,a)=>O(e,t)?K:i.get(e,t,a),has:(e,t)=>O(e,t)||i.has(e,t)};let B=async(t,a)=>{let s=null;if(t.url&&(s=new URL(t.url).origin),s!==self.location.origin)throw new u("cross-origin-copy-response",{origin:s});let r=t.clone(),i={headers:new Headers(r.headers),status:r.status,statusText:r.statusText},n=a?a(i):i,c=!function(){if(void 0===e){let t=new Response("");if("body"in t)try{new Response(t.body),e=!0}catch(t){e=!1}e=!1}return e}()?await r.blob():r.body;return new Response(c,n)},j=e=>{d.add(e)};class $ extends b{_fallbackToNetwork;static defaultPrecacheCacheabilityPlugin={cacheWillUpdate:async({response:e})=>!e||e.status>=400?null:e};static copyRedirectedCacheableResponsesPlugin={cacheWillUpdate:async({response:e})=>e.redirected?await B(e):e};constructor(e={}){e.cacheName=l(e.cacheName),super(e),this._fallbackToNetwork=!1!==e.fallbackToNetwork,this.plugins.push($.copyRedirectedCacheableResponsesPlugin)}async _handle(e,t){return await t.cacheMatch(e)||(t.event&&"install"===t.event.type?await this._handleInstall(e,t):await this._handleFetch(e,t))}async _handleFetch(e,t){let a;let s=t.params||{};if(this._fallbackToNetwork){let r=s.integrity,i=e.integrity,n=!i||i===r;a=await t.fetch(new Request(e,{integrity:"no-cors"!==e.mode?i||r:void 0})),r&&n&&"no-cors"!==e.mode&&(this._useDefaultCacheabilityPluginIfNeeded(),await t.cachePut(e,a.clone()))}else throw new u("missing-precache-entry",{cacheName:this.cacheName,url:e.url});return a}async _handleInstall(e,t){this._useDefaultCacheabilityPluginIfNeeded();let a=await t.fetch(e);if(!await t.cachePut(e,a.clone()))throw new u("bad-precaching-response",{url:e.url,status:a.status});return a}_useDefaultCacheabilityPluginIfNeeded(){let e=null,t=0;for(let[a,s]of this.plugins.entries())s!==$.copyRedirectedCacheableResponsesPlugin&&(s===$.defaultPrecacheCacheabilityPlugin&&(e=a),s.cacheWillUpdate&&t++);0===t?this.plugins.push($.defaultPrecacheCacheabilityPlugin):t>1&&null!==e&&this.plugins.splice(e,1)}}"undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);let H="cache-entries",V=e=>{let t=new URL(e,location.href);return t.hash="",t.href};class Q{_cacheName;_db=null;constructor(e){this._cacheName=e}_getId(e){return`${this._cacheName}|${V(e)}`}_upgradeDb(e){let t=e.createObjectStore(H,{keyPath:"id"});t.createIndex("cacheName","cacheName",{unique:!1}),t.createIndex("timestamp","timestamp",{unique:!1})}_upgradeDbAndDeleteOldDbs(e){this._upgradeDb(e),this._cacheName&&function(e,{blocked:t}={}){let a=indexedDB.deleteDatabase(e);t&&a.addEventListener("blocked",e=>t(e.oldVersion,e)),D(a).then(()=>void 0)}(this._cacheName)}async setTimestamp(e,t){e=V(e);let a={id:this._getId(e),cacheName:this._cacheName,url:e,timestamp:t},s=(await this.getDb()).transaction(H,"readwrite",{durability:"relaxed"});await s.store.put(a),await s.done}async getTimestamp(e){let t=await this.getDb(),a=await t.get(H,this._getId(e));return a?.timestamp}async expireEntries(e,t){let a=await this.getDb(),s=await a.transaction(H,"readwrite").store.index("timestamp").openCursor(null,"prev"),r=[],i=0;for(;s;){let a=s.value;a.cacheName===this._cacheName&&(e&&a.timestamp=t?(s.delete(),r.push(a.url)):i++),s=await s.continue()}return r}async getDb(){return this._db||(this._db=await k("serwist-expiration",1,{upgrade:this._upgradeDbAndDeleteOldDbs.bind(this)})),this._db}}class G{_isRunning=!1;_rerunRequested=!1;_maxEntries;_maxAgeSeconds;_matchOptions;_cacheName;_timestampModel;constructor(e,t={}){this._maxEntries=t.maxEntries,this._maxAgeSeconds=t.maxAgeSeconds,this._matchOptions=t.matchOptions,this._cacheName=e,this._timestampModel=new Q(e)}async expireEntries(){if(this._isRunning){this._rerunRequested=!0;return}this._isRunning=!0;let e=this._maxAgeSeconds?Date.now()-1e3*this._maxAgeSeconds:0,t=await this._timestampModel.expireEntries(e,this._maxEntries),a=await self.caches.open(this._cacheName);for(let e of t)await a.delete(e,this._matchOptions);this._isRunning=!1,this._rerunRequested&&(this._rerunRequested=!1,this.expireEntries())}async updateTimestamp(e){await this._timestampModel.setTimestamp(e,Date.now())}async isURLExpired(e){if(!this._maxAgeSeconds)return!1;let t=await this._timestampModel.getTimestamp(e),a=Date.now()-1e3*this._maxAgeSeconds;return void 0===t||tthis.deleteCacheAndMetadata())}_getCacheExpiration(e){if(e===o())throw new u("expire-custom-caches-only");let t=this._cacheExpirations.get(e);return t||(t=new G(e,this._config),this._cacheExpirations.set(e,t)),t}cachedResponseWillBeUsed({event:e,cacheName:t,request:a,cachedResponse:s}){if(!s)return null;let r=this._isResponseDateFresh(s),i=this._getCacheExpiration(t),n="last-used"===this._config.maxAgeFrom,c=(async()=>{n&&await i.updateTimestamp(a.url),await i.expireEntries()})();try{e.waitUntil(c)}catch(e){}return r?s:null}_isResponseDateFresh(e){if("last-used"===this._config.maxAgeFrom)return!0;let t=Date.now();if(!this._config.maxAgeSeconds)return!0;let a=this._getDateHeaderTimestamp(e);return null===a||a>=t-1e3*this._config.maxAgeSeconds}_getDateHeaderTimestamp(e){if(!e.headers.has("date"))return null;let t=new Date(e.headers.get("date")).getTime();return Number.isNaN(t)?null:t}async cacheDidUpdate({cacheName:e,request:t}){let a=this._getCacheExpiration(e);await a.updateTimestamp(t.url),await a.expireEntries()}async deleteCacheAndMetadata(){for(let[e,t]of this._cacheExpirations)await self.caches.delete(e),await t.delete();this._cacheExpirations=new Map}}let J=(e,t,a)=>{let s,r;let i=e.size;if(a&&a>i||t&&t<0)throw new u("range-not-satisfiable",{size:i,end:a,start:t});return void 0!==t&&void 0!==a?(s=t,r=a+1):void 0!==t&&void 0===a?(s=t,r=i):void 0!==a&&void 0===t&&(s=i-a,r=i),{start:s,end:r}},Y=e=>{let t=e.trim().toLowerCase();if(!t.startsWith("bytes="))throw new u("unit-must-be-bytes",{normalizedRangeHeader:t});if(t.includes(","))throw new u("single-range-only",{normalizedRangeHeader:t});let a=/(\d*)-(\d*)/.exec(t);if(!a||!(a[1]||a[2]))throw new u("invalid-range-values",{normalizedRangeHeader:t});return{start:""===a[1]?void 0:Number(a[1]),end:""===a[2]?void 0:Number(a[2])}},X=async(e,t)=>{try{if(206===t.status)return t;let a=e.headers.get("range");if(!a)throw new u("no-range-header");let s=Y(a),r=await t.blob(),i=J(r,s.start,s.end),n=r.slice(i.start,i.end),c=n.size,l=new Response(n,{status:206,statusText:"Partial Content",headers:t.headers});return l.headers.set("Content-Length",String(c)),l.headers.set("Content-Range",`bytes ${i.start}-${i.end-1}/${r.size}`),l}catch(e){return new Response("",{status:416,statusText:"Range Not Satisfiable"})}};class Z{cachedResponseWillBeUsed=async({request:e,cachedResponse:t})=>t&&e.headers.has("range")?await X(e,t):t}class ee extends b{async _handle(e,t){let a,s=await t.cacheMatch(e);if(!s)try{s=await t.fetchAndCachePut(e)}catch(e){e instanceof Error&&(a=e)}if(!s)throw new u("no-response",{url:e.url,error:a});return s}}class et extends b{constructor(e={}){super(e),this.plugins.some(e=>"cacheWillUpdate"in e)||this.plugins.unshift(x)}async _handle(e,t){let a;let s=t.fetchAndCachePut(e).catch(()=>{});t.waitUntil(s);let r=await t.cacheMatch(e);if(r);else try{r=await s}catch(e){e instanceof Error&&(a=e)}if(!r)throw new u("no-response",{url:e.url,error:a});return r}}let ea=[{matcher:/^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,handler:new ee({cacheName:"google-fonts-webfonts",plugins:[new z({maxEntries:4,maxAgeSeconds:31536e3,maxAgeFrom:"last-used"})]})},{matcher:/^https:\/\/fonts\.(?:googleapis)\.com\/.*/i,handler:new et({cacheName:"google-fonts-stylesheets",plugins:[new z({maxEntries:4,maxAgeSeconds:604800,maxAgeFrom:"last-used"})]})},{matcher:/\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,handler:new et({cacheName:"static-font-assets",plugins:[new z({maxEntries:4,maxAgeSeconds:604800,maxAgeFrom:"last-used"})]})},{matcher:/\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,handler:new et({cacheName:"static-image-assets",plugins:[new z({maxEntries:64,maxAgeSeconds:2592e3,maxAgeFrom:"last-used"})]})},{matcher:/\/_next\/static.+\.js$/i,handler:new ee({cacheName:"next-static-js-assets",plugins:[new z({maxEntries:64,maxAgeSeconds:86400,maxAgeFrom:"last-used"})]})},{matcher:/\/_next\/image\?url=.+$/i,handler:new et({cacheName:"next-image",plugins:[new z({maxEntries:64,maxAgeSeconds:86400,maxAgeFrom:"last-used"})]})},{matcher:/\.(?:mp3|wav|ogg)$/i,handler:new ee({cacheName:"static-audio-assets",plugins:[new z({maxEntries:32,maxAgeSeconds:86400,maxAgeFrom:"last-used"}),new Z]})},{matcher:/\.(?:mp4|webm)$/i,handler:new ee({cacheName:"static-video-assets",plugins:[new z({maxEntries:32,maxAgeSeconds:86400,maxAgeFrom:"last-used"}),new Z]})},{matcher:/\.(?:js)$/i,handler:new et({cacheName:"static-js-assets",plugins:[new z({maxEntries:48,maxAgeSeconds:86400,maxAgeFrom:"last-used"})]})},{matcher:/\.(?:css|less)$/i,handler:new et({cacheName:"static-style-assets",plugins:[new z({maxEntries:32,maxAgeSeconds:86400,maxAgeFrom:"last-used"})]})},{matcher:/\/_next\/data\/.+\/.+\.json$/i,handler:new v({cacheName:"next-data",plugins:[new z({maxEntries:32,maxAgeSeconds:86400,maxAgeFrom:"last-used"})]})},{matcher:/\.(?:json|xml|csv)$/i,handler:new v({cacheName:"static-data-assets",plugins:[new z({maxEntries:32,maxAgeSeconds:86400,maxAgeFrom:"last-used"})]})},{matcher:({sameOrigin:e,url:{pathname:t}})=>!(!e||t.startsWith("/api/auth/callback"))&&!!t.startsWith("/api/"),method:"GET",handler:new v({cacheName:"apis",plugins:[new z({maxEntries:16,maxAgeSeconds:86400,maxAgeFrom:"last-used"})],networkTimeoutSeconds:10})},{matcher:({request:e,url:{pathname:t},sameOrigin:a})=>"1"===e.headers.get("RSC")&&"1"===e.headers.get("Next-Router-Prefetch")&&a&&!t.startsWith("/api/"),handler:new v({cacheName:"pages-rsc-prefetch",plugins:[new z({maxEntries:32,maxAgeSeconds:86400})]})},{matcher:({request:e,url:{pathname:t},sameOrigin:a})=>"1"===e.headers.get("RSC")&&a&&!t.startsWith("/api/"),handler:new v({cacheName:"pages-rsc",plugins:[new z({maxEntries:32,maxAgeSeconds:86400})]})},{matcher:({request:e,url:{pathname:t},sameOrigin:a})=>e.headers.get("Content-Type")?.includes("text/html")&&a&&!t.startsWith("/api/"),handler:new v({cacheName:"pages",plugins:[new z({maxEntries:32,maxAgeSeconds:86400})]})},{matcher:({url:{pathname:e},sameOrigin:t})=>t&&!e.startsWith("/api/"),handler:new v({cacheName:"others",plugins:[new z({maxEntries:32,maxAgeSeconds:86400})]})},{matcher:({sameOrigin:e})=>!e,handler:new v({cacheName:"cross-origin",plugins:[new z({maxEntries:32,maxAgeSeconds:3600})],networkTimeoutSeconds:10})}],es={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"serwist",runtime:"runtime",suffix:"undefined"!=typeof registration?registration.scope:""},er=e=>[es.prefix,e,es.suffix].filter(e=>e&&e.length>0).join("-"),ei=e=>{for(let t of Object.keys(es))e(t)},en=e=>{ei(t=>{let a=e[t];"string"==typeof a&&(es[t]=a)})},ec=e=>e||er(es.googleAnalytics),el=e=>e||er(es.precache),eo=e=>e||er(es.runtime),eh=(e,...t)=>{let a=e;return t.length>0&&(a+=` :: ${JSON.stringify(t)}`),a};class eu extends Error{details;constructor(e,t){super(eh(e,t)),this.name=e,this.details=t}}let ed=e=>new URL(String(e),location.href).href.replace(RegExp(`^${location.origin}`),"");class ef{promise;resolve;reject;constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}function em(e,t){let a=new URL(e);for(let e of t)a.searchParams.delete(e);return a.href}async function ew(e,t,a,s){let r=em(t.url,a);if(t.url===r)return e.match(t,s);let i={...s,ignoreSearch:!0};for(let n of(await e.keys(t,i)))if(r===em(n.url,a))return e.match(n,s)}let ep=new Set,eg=async()=>{for(let e of ep)await e()};function ey(e){return new Promise(t=>setTimeout(t,e))}let e_=(e,t)=>{let a=t();return e.waitUntil(a),a};function eb(e){return"string"==typeof e?new Request(e):e}class ex{event;request;url;params;_cacheKeys={};_strategy;_handlerDeferred;_extendLifetimePromises;_plugins;_pluginStateMap;constructor(e,t){for(let a of(this.event=t.event,this.request=t.request,t.url&&(this.url=t.url,this.params=t.params),this._strategy=e,this._handlerDeferred=new ef,this._extendLifetimePromises=[],this._plugins=[...e.plugins],this._pluginStateMap=new Map,this._plugins))this._pluginStateMap.set(a,{});this.event.waitUntil(this._handlerDeferred.promise)}async fetch(e){let{event:t}=this,a=eb(e);if("navigate"===a.mode&&t instanceof FetchEvent&&t.preloadResponse){let e=await t.preloadResponse;if(e)return e}let s=this.hasCallback("fetchDidFail")?a.clone():null;try{for(let e of this.iterateCallbacks("requestWillFetch"))a=await e({request:a.clone(),event:t})}catch(e){if(e instanceof Error)throw new eu("plugin-error-request-will-fetch",{thrownErrorMessage:e.message})}let r=a.clone();try{let e;for(let s of(e=await fetch(a,"navigate"===a.mode?void 0:this._strategy.fetchOptions),this.iterateCallbacks("fetchDidSucceed")))e=await s({event:t,request:r,response:e});return e}catch(e){throw s&&await this.runCallbacks("fetchDidFail",{error:e,event:t,originalRequest:s.clone(),request:r.clone()}),e}}async fetchAndCachePut(e){let t=await this.fetch(e),a=t.clone();return this.waitUntil(this.cachePut(e,a)),t}async cacheMatch(e){let t;let a=eb(e),{cacheName:s,matchOptions:r}=this._strategy,i=await this.getCacheKey(a,"read"),n={...r,cacheName:s};for(let e of(t=await caches.match(i,n),this.iterateCallbacks("cachedResponseWillBeUsed")))t=await e({cacheName:s,matchOptions:r,cachedResponse:t,request:i,event:this.event})||void 0;return t}async cachePut(e,t){let a=eb(e);await ey(0);let s=await this.getCacheKey(a,"write");if(!t)throw new eu("cache-put-with-no-response",{url:ed(s.url)});let r=await this._ensureResponseSafeToCache(t);if(!r)return!1;let{cacheName:i,matchOptions:n}=this._strategy,c=await self.caches.open(i),l=this.hasCallback("cacheDidUpdate"),o=l?await ew(c,s.clone(),["__WB_REVISION__"],n):null;try{await c.put(s,l?r.clone():r)}catch(e){if(e instanceof Error)throw"QuotaExceededError"===e.name&&await eg(),e}for(let e of this.iterateCallbacks("cacheDidUpdate"))await e({cacheName:i,oldResponse:o,newResponse:r.clone(),request:s,event:this.event});return!0}async getCacheKey(e,t){let a=`${e.url} | ${t}`;if(!this._cacheKeys[a]){let s=e;for(let e of this.iterateCallbacks("cacheKeyWillBeUsed"))s=eb(await e({mode:t,request:s,event:this.event,params:this.params}));this._cacheKeys[a]=s}return this._cacheKeys[a]}hasCallback(e){for(let t of this._strategy.plugins)if(e in t)return!0;return!1}async runCallbacks(e,t){for(let a of this.iterateCallbacks(e))await a(t)}*iterateCallbacks(e){for(let t of this._strategy.plugins)if("function"==typeof t[e]){let a=this._pluginStateMap.get(t),s=s=>{let r={...s,state:a};return t[e](r)};yield s}}waitUntil(e){return this._extendLifetimePromises.push(e),e}async doneWaiting(){let e;for(;e=this._extendLifetimePromises.shift();)await e}destroy(){this._handlerDeferred.resolve(null)}async _ensureResponseSafeToCache(e){let t=e,a=!1;for(let e of this.iterateCallbacks("cacheWillUpdate"))if(t=await e({request:this.request,response:t,event:this.event})||void 0,a=!0,!t)break;return!a&&t&&200!==t.status&&(t=void 0),t}}class ev{cacheName;plugins;fetchOptions;matchOptions;constructor(e={}){this.cacheName=eo(e.cacheName),this.plugins=e.plugins||[],this.fetchOptions=e.fetchOptions,this.matchOptions=e.matchOptions}handle(e){let[t]=this.handleAll(e);return t}handleAll(e){e instanceof FetchEvent&&(e={event:e,request:e.request});let t=e.event,a="string"==typeof e.request?new Request(e.request):e.request,s=new ex(this,e.url?{event:t,request:a,url:e.url,params:e.params}:{event:t,request:a}),r=this._getResponse(s,a,t),i=this._awaitComplete(r,s,a,t);return[r,i]}async _getResponse(e,t,a){let s;await e.runCallbacks("handlerWillStart",{event:a,request:t});try{if(s=await this._handle(t,e),void 0===s||"error"===s.type)throw new eu("no-response",{url:t.url})}catch(r){if(r instanceof Error){for(let i of e.iterateCallbacks("handlerDidError"))if(void 0!==(s=await i({error:r,event:a,request:t})))break}if(!s)throw r}for(let r of e.iterateCallbacks("handlerWillRespond"))s=await r({event:a,request:t,response:s});return s}async _awaitComplete(e,t,a,s){let r,i;try{r=await e}catch(e){}try{await t.runCallbacks("handlerDidRespond",{event:s,request:a,response:r}),await t.doneWaiting()}catch(e){e instanceof Error&&(i=e)}if(await t.runCallbacks("handlerDidComplete",{event:s,request:a,response:r,error:i}),t.destroy(),i)throw i}}let eE={cacheWillUpdate:async({response:e})=>200===e.status||0===e.status?e:null};class eR extends ev{_networkTimeoutSeconds;constructor(e={}){super(e),this.plugins.some(e=>"cacheWillUpdate"in e)||this.plugins.unshift(eE),this._networkTimeoutSeconds=e.networkTimeoutSeconds||0}async _handle(e,t){let a;let s=[],r=[];if(this._networkTimeoutSeconds){let{id:i,promise:n}=this._getTimeoutPromise({request:e,logs:s,handler:t});a=i,r.push(n)}let i=this._getNetworkPromise({timeoutId:a,request:e,logs:s,handler:t});r.push(i);let n=await t.waitUntil((async()=>await t.waitUntil(Promise.race(r))||await i)());if(!n)throw new eu("no-response",{url:e.url});return n}_getTimeoutPromise({request:e,logs:t,handler:a}){let s;return{promise:new Promise(t=>{s=setTimeout(async()=>{t(await a.cacheMatch(e))},1e3*this._networkTimeoutSeconds)}),id:s}}async _getNetworkPromise({timeoutId:e,request:t,logs:a,handler:s}){let r,i;try{i=await s.fetchAndCachePut(t)}catch(e){e instanceof Error&&(r=e)}return e&&clearTimeout(e),(r||!i)&&(i=await s.cacheMatch(t)),i}}class eq extends ev{_networkTimeoutSeconds;constructor(e={}){super(e),this._networkTimeoutSeconds=e.networkTimeoutSeconds||0}async _handle(e,t){let a,s;try{let s=[t.fetch(e)];if(this._networkTimeoutSeconds){let e=ey(1e3*this._networkTimeoutSeconds);s.push(e)}if(!(a=await Promise.race(s)))throw Error(`Timed out the network response after ${this._networkTimeoutSeconds} seconds.`)}catch(e){e instanceof Error&&(s=e)}if(!a)throw new eu("no-response",{url:e.url,error:s});return a}}let eS=e=>e&&"object"==typeof e?e:{handle:e};class eC{handler;match;method;catchHandler;constructor(e,t,a="GET"){this.handler=eS(t),this.match=e,this.method=a}setCatchHandler(e){this.catchHandler=eS(e)}}let eD="requests",eP="queueName";class ek{_db=null;async addEntry(e){let t=(await this.getDb()).transaction(eD,"readwrite",{durability:"relaxed"});await t.store.add(e),await t.done}async getFirstEntryId(){let e=await this.getDb(),t=await e.transaction(eD).store.openCursor();return t?.value.id}async getAllEntriesByQueueName(e){let t=await this.getDb();return await t.getAllFromIndex(eD,eP,IDBKeyRange.only(e))||[]}async getEntryCountByQueueName(e){return(await this.getDb()).countFromIndex(eD,eP,IDBKeyRange.only(e))}async deleteEntry(e){let t=await this.getDb();await t.delete(eD,e)}async getFirstEntryByQueueName(e){return await this.getEndEntryFromIndex(IDBKeyRange.only(e),"next")}async getLastEntryByQueueName(e){return await this.getEndEntryFromIndex(IDBKeyRange.only(e),"prev")}async getEndEntryFromIndex(e,t){let a=await this.getDb(),s=await a.transaction(eD).store.index(eP).openCursor(e,t);return s?.value}async getDb(){return this._db||(this._db=await k("serwist-background-sync",3,{upgrade:this._upgradeDb})),this._db}_upgradeDb(e,t){t>0&&t<3&&e.objectStoreNames.contains(eD)&&e.deleteObjectStore(eD),e.createObjectStore(eD,{autoIncrement:!0,keyPath:"id"}).createIndex(eP,eP,{unique:!1})}}class eN{_queueName;_queueDb;constructor(e){this._queueName=e,this._queueDb=new ek}async pushEntry(e){delete e.id,e.queueName=this._queueName,await this._queueDb.addEntry(e)}async unshiftEntry(e){let t=await this._queueDb.getFirstEntryId();t?e.id=t-1:delete e.id,e.queueName=this._queueName,await this._queueDb.addEntry(e)}async popEntry(){return this._removeEntry(await this._queueDb.getLastEntryByQueueName(this._queueName))}async shiftEntry(){return this._removeEntry(await this._queueDb.getFirstEntryByQueueName(this._queueName))}async getAll(){return await this._queueDb.getAllEntriesByQueueName(this._queueName)}async size(){return await this._queueDb.getEntryCountByQueueName(this._queueName)}async deleteEntry(e){await this._queueDb.deleteEntry(e)}async _removeEntry(e){return e&&await this.deleteEntry(e.id),e}}let eT=["method","referrer","referrerPolicy","mode","credentials","cache","redirect","integrity","keepalive"];class eA{_requestData;static async fromRequest(e){let t={url:e.url,headers:{}};for(let a of("GET"!==e.method&&(t.body=await e.clone().arrayBuffer()),e.headers.forEach((e,a)=>{t.headers[a]=e}),eT))void 0!==e[a]&&(t[a]=e[a]);return new eA(t)}constructor(e){"navigate"===e.mode&&(e.mode="same-origin"),this._requestData=e}toObject(){let e=Object.assign({},this._requestData);return e.headers=Object.assign({},this._requestData.headers),e.body&&(e.body=e.body.slice(0)),e}toRequest(){return new Request(this._requestData.url,this._requestData)}clone(){return new eA(this.toObject())}}let eI="serwist-background-sync",eU=new Set,eL=e=>{let t={request:new eA(e.requestData).toRequest(),timestamp:e.timestamp};return e.metadata&&(t.metadata=e.metadata),t};class eF{_name;_onSync;_maxRetentionTime;_queueStore;_forceSyncFallback;_syncInProgress=!1;_requestsAddedDuringSync=!1;constructor(e,{forceSyncFallback:t,onSync:a,maxRetentionTime:s}={}){if(eU.has(e))throw new eu("duplicate-queue-name",{name:e});eU.add(e),this._name=e,this._onSync=a||this.replayRequests,this._maxRetentionTime=s||10080,this._forceSyncFallback=!!t,this._queueStore=new eN(this._name),this._addSyncListener()}get name(){return this._name}async pushRequest(e){await this._addRequest(e,"push")}async unshiftRequest(e){await this._addRequest(e,"unshift")}async popRequest(){return this._removeRequest("pop")}async shiftRequest(){return this._removeRequest("shift")}async getAll(){let e=await this._queueStore.getAll(),t=Date.now(),a=[];for(let s of e){let e=6e4*this._maxRetentionTime;t-s.timestamp>e?await this._queueStore.deleteEntry(s.id):a.push(eL(s))}return a}async size(){return await this._queueStore.size()}async _addRequest({request:e,metadata:t,timestamp:a=Date.now()},s){let r={requestData:(await eA.fromRequest(e.clone())).toObject(),timestamp:a};switch(t&&(r.metadata=t),s){case"push":await this._queueStore.pushEntry(r);break;case"unshift":await this._queueStore.unshiftEntry(r)}this._syncInProgress?this._requestsAddedDuringSync=!0:await this.registerSync()}async _removeRequest(e){let t;let a=Date.now();switch(e){case"pop":t=await this._queueStore.popEntry();break;case"shift":t=await this._queueStore.shiftEntry()}if(t){let s=6e4*this._maxRetentionTime;return a-t.timestamp>s?this._removeRequest(e):eL(t)}}async replayRequests(){let e;for(;e=await this.shiftRequest();)try{await fetch(e.request.clone())}catch(t){throw await this.unshiftRequest(e),new eu("queue-replay-failed",{name:this._name})}}async registerSync(){if("sync"in self.registration&&!this._forceSyncFallback)try{await self.registration.sync.register(`${eI}:${this._name}`)}catch(e){}}_addSyncListener(){"sync"in self.registration&&!this._forceSyncFallback?self.addEventListener("sync",e=>{if(e.tag===`${eI}:${this._name}`){let t=async()=>{let t;this._syncInProgress=!0;try{await this._onSync({queue:this})}catch(e){if(e instanceof Error)throw e}finally{this._requestsAddedDuringSync&&!(t&&!e.lastChance)&&await this.registerSync(),this._syncInProgress=!1,this._requestsAddedDuringSync=!1}};e.waitUntil(t())}}):this._onSync({queue:this})}static get _queueNames(){return eU}}class eM{_queue;constructor(e,t){this._queue=new eF(e,t)}async fetchDidFail({request:e}){await this._queue.pushRequest({request:e})}}let eW="www.google-analytics.com",eK="www.googletagmanager.com",eO=/^\/(\w+\/)?collect/,eB=e=>async({queue:t})=>{let a;for(;a=await t.shiftRequest();){let{request:s,timestamp:r}=a,i=new URL(s.url);try{let t="POST"===s.method?new URLSearchParams(await s.clone().text()):i.searchParams,a=r-(Number(t.get("qt"))||0),n=Date.now()-a;if(t.set("qt",String(n)),e.parameterOverrides)for(let a of Object.keys(e.parameterOverrides)){let s=e.parameterOverrides[a];t.set(a,s)}"function"==typeof e.hitFilter&&e.hitFilter.call(null,t),await fetch(new Request(i.origin+i.pathname,{body:t.toString(),method:"POST",mode:"cors",credentials:"omit",headers:{"Content-Type":"text/plain"}}))}catch(e){throw await t.unshiftRequest(a),e}}},ej=e=>{let t=({url:e})=>e.hostname===eW&&eO.test(e.pathname),a=new eq({plugins:[e]});return[new eC(t,a,"GET"),new eC(t,a,"POST")]},e$=e=>new eC(({url:e})=>e.hostname===eW&&"/analytics.js"===e.pathname,new eR({cacheName:e}),"GET"),eH=e=>new eC(({url:e})=>e.hostname===eK&&"/gtag/js"===e.pathname,new eR({cacheName:e}),"GET"),eV=e=>new eC(({url:e})=>e.hostname===eK&&"/gtm.js"===e.pathname,new eR({cacheName:e}),"GET"),eQ=({serwist:e,cacheName:t,...a})=>{let s=ec(t),r=new eM("serwist-google-analytics",{maxRetentionTime:2880,onSync:eB(a)});for(let t of[eV(s),e$(s),eH(s),...ej(r)])e.registerRoute(t)};class eG{_fallbackUrls;_serwist;constructor({fallbackUrls:e,serwist:t}){this._fallbackUrls=e,this._serwist=t}async handlerDidError(e){for(let t of this._fallbackUrls)if("string"==typeof t){let e=await this._serwist.matchPrecache(t);if(void 0!==e)return e}else if(t.matcher(e)){let e=await this._serwist.matchPrecache(t.url);if(void 0!==e)return e}}}let ez="-precache-",eJ=async(e,t=ez)=>{let a=(await self.caches.keys()).filter(a=>a.includes(t)&&a.includes(self.registration.scope)&&a!==e);return await Promise.all(a.map(e=>self.caches.delete(e))),a},eY=e=>{self.addEventListener("activate",t=>{t.waitUntil(eJ(el(e)).then(e=>{}))})},eX=()=>{self.addEventListener("activate",()=>self.clients.claim())},eZ=async(e,t)=>{let a=null;if(e.url&&(a=new URL(e.url).origin),a!==self.location.origin)throw new eu("cross-origin-copy-response",{origin:a});let r=e.clone(),i={headers:new Headers(r.headers),status:r.status,statusText:r.statusText},n=t?t(i):i,c=!function(){if(void 0===s){let e=new Response("");if("body"in e)try{new Response(e.body),s=!0}catch(e){s=!1}s=!1}return s}()?await r.blob():r.body;return new Response(c,n)},e0=()=>{self.__WB_DISABLE_DEV_LOGS=!0},e1=()=>!!self.registration?.navigationPreload,e4=e=>{e1()&&self.addEventListener("activate",t=>{t.waitUntil(self.registration.navigationPreload.enable().then(()=>{e&&self.registration.navigationPreload.setHeaderValue(e)}))})};class e6 extends eC{_allowlist;_denylist;constructor(e,{allowlist:t=[/./],denylist:a=[]}={}){super(e=>this._match(e),e),this._allowlist=t,this._denylist=a}_match({url:e,request:t}){if(t&&"navigate"!==t.mode)return!1;let a=e.pathname+e.search;for(let e of this._denylist)if(e.test(a))return!1;return!!this._allowlist.some(e=>e.test(a))}}class e2 extends eC{constructor(e,t,a){super(({url:t})=>{let a=e.exec(t.href);if(a&&(t.origin===location.origin||0===a.index))return a.slice(1)},t,a)}}let e3=(e,t,a)=>{let s;if("string"==typeof e){let r=new URL(e,location.href);s=new eC(({url:e})=>e.href===r.href,t,a)}else if(e instanceof RegExp)s=new e2(e,t,a);else if("function"==typeof e)s=new eC(e,t,a);else if(e instanceof eC)s=e;else throw new eu("unsupported-route-type",{moduleName:"serwist",funcName:"parseRoute",paramName:"capture"});return s},e8=(e,t=[])=>{for(let a of[...e.searchParams.keys()])t.some(e=>e.test(a))&&e.searchParams.delete(a);return e};class e5 extends eC{constructor(e,t){super(({request:a})=>{let s=e.getUrlsToPrecacheKeys();for(let r of function*(e,{directoryIndex:t="index.html",ignoreURLParametersMatching:a=[/^utm_/,/^fbclid$/],cleanURLs:s=!0,urlManipulation:r}={}){let i=new URL(e,location.href);i.hash="",yield i.href;let n=e8(i,a);if(yield n.href,t&&n.pathname.endsWith("/")){let e=new URL(n.href);e.pathname+=t,yield e.href}if(s){let e=new URL(n.href);e.pathname+=".html",yield e.href}if(r)for(let e of r({url:i}))yield e.href}(a.url,t)){let t=s.get(r);if(t){let a=e.getIntegrityForPrecacheKey(t);return{cacheKey:t,integrity:a}}}},e.precacheStrategy)}}class e9 extends ev{_fallbackToNetwork;static defaultPrecacheCacheabilityPlugin={cacheWillUpdate:async({response:e})=>!e||e.status>=400?null:e};static copyRedirectedCacheableResponsesPlugin={cacheWillUpdate:async({response:e})=>e.redirected?await eZ(e):e};constructor(e={}){e.cacheName=el(e.cacheName),super(e),this._fallbackToNetwork=!1!==e.fallbackToNetwork,this.plugins.push(e9.copyRedirectedCacheableResponsesPlugin)}async _handle(e,t){return await t.cacheMatch(e)||(t.event&&"install"===t.event.type?await this._handleInstall(e,t):await this._handleFetch(e,t))}async _handleFetch(e,t){let a;let s=t.params||{};if(this._fallbackToNetwork){let r=s.integrity,i=e.integrity,n=!i||i===r;a=await t.fetch(new Request(e,{integrity:"no-cors"!==e.mode?i||r:void 0})),r&&n&&"no-cors"!==e.mode&&(this._useDefaultCacheabilityPluginIfNeeded(),await t.cachePut(e,a.clone()))}else throw new eu("missing-precache-entry",{cacheName:this.cacheName,url:e.url});return a}async _handleInstall(e,t){this._useDefaultCacheabilityPluginIfNeeded();let a=await t.fetch(e);if(!await t.cachePut(e,a.clone()))throw new eu("bad-precaching-response",{url:e.url,status:a.status});return a}_useDefaultCacheabilityPluginIfNeeded(){let e=null,t=0;for(let[a,s]of this.plugins.entries())s!==e9.copyRedirectedCacheableResponsesPlugin&&(s===e9.defaultPrecacheCacheabilityPlugin&&(e=a),s.cacheWillUpdate&&t++);0===t?this.plugins.push(e9.defaultPrecacheCacheabilityPlugin):t>1&&null!==e&&this.plugins.splice(e,1)}}let e7=e=>{en(e)},te=async(e,t,a)=>{let s=t.map((e,t)=>({index:t,item:e})),r=async e=>{let t=[];for(;;){let r=s.pop();if(!r)return e(t);let i=await a(r.item);t.push({result:i,index:r.index})}},i=Array.from({length:e},()=>new Promise(r));return(await Promise.all(i)).flat().sort((e,t)=>e.indexe.result)};class tt{_precacheController;constructor({precacheController:e}){this._precacheController=e}cacheKeyWillBeUsed=async({request:e,params:t})=>{let a=t?.cacheKey||this._precacheController.getPrecacheKeyForUrl(e.url);return a?new Request(a,{headers:e.headers}):e}}class ta{updatedURLs=[];notUpdatedURLs=[];handlerWillStart=async({request:e,state:t})=>{t&&(t.originalRequest=e)};cachedResponseWillBeUsed=async({event:e,state:t,cachedResponse:a})=>{if("install"===e.type&&t?.originalRequest&&t.originalRequest instanceof Request){let e=t.originalRequest.url;a?this.notUpdatedURLs.push(e):this.updatedURLs.push(e)}return a}}let ts=e=>{if(!e)throw new eu("add-to-cache-list-unexpected-type",{entry:e});if("string"==typeof e){let t=new URL(e,location.href);return{cacheKey:t.href,url:t.href}}let{revision:t,url:a}=e;if(!a)throw new eu("add-to-cache-list-unexpected-type",{entry:e});if(!t){let e=new URL(a,location.href);return{cacheKey:e.href,url:e.href}}let s=new URL(a,location.href),r=new URL(a,location.href);return s.searchParams.set("__WB_REVISION__",t),{cacheKey:s.href,url:r.href}};class tr{_urlsToCacheKeys=new Map;_urlsToCacheModes=new Map;_cacheKeysToIntegrities=new Map;_concurrentPrecaching;_precacheStrategy;_routes;_defaultHandlerMap;_catchHandler;constructor({precacheEntries:e,precacheOptions:t,cleanupOutdatedCaches:a,navigateFallback:s,navigateFallbackAllowlist:r,navigateFallbackDenylist:i,plugins:n=[],fallbackToNetwork:c=!0,concurrentPrecaching:l=1,skipWaiting:o=!1,importScripts:h,navigationPreload:u=!1,cacheId:d,clientsClaim:f=!1,runtimeCaching:m,offlineAnalyticsConfig:w,disableDevLogs:p=!1,fallbacks:g}={}){if(this._concurrentPrecaching=l,this._precacheStrategy=new e9({cacheName:el(t?.cacheName),plugins:[...n,new tt({precacheController:this})],fallbackToNetwork:c}),this._routes=new Map,this._defaultHandlerMap=new Map,this.handleInstall=this.handleInstall.bind(this),this.handleActivate=this.handleActivate.bind(this),this.handleFetch=this.handleFetch.bind(this),this.handleCache=this.handleCache.bind(this),h&&h.length>0&&self.importScripts(...h),u&&e4(),void 0!==d&&e7({prefix:d}),o?self.skipWaiting():self.addEventListener("message",e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()}),f&&eX(),this.registerRoute(new e5(this,t)),e&&e.length>0&&this.addToPrecacheList(e),a&&eY(t?.cacheName),s&&this.registerRoute(new e6(this.createHandlerBoundToUrl(s),{allowlist:r,denylist:i})),void 0!==w&&("boolean"==typeof w?w&&eQ({serwist:this}):eQ({...w,serwist:this})),void 0!==m){if(void 0!==g){let e=new eG({fallbackUrls:g.entries,serwist:this});m.forEach(t=>{t.handler instanceof ev&&!t.handler.plugins.some(e=>"handlerDidError"in e)&&t.handler.plugins.push(e)})}for(let e of m)this.registerCapture(e.matcher,e.handler,e.method)}p&&e0()}get precacheStrategy(){return this._precacheStrategy}get routes(){return this._routes}addEventListeners(){self.addEventListener("install",this.handleInstall),self.addEventListener("activate",this.handleActivate),self.addEventListener("fetch",this.handleFetch),self.addEventListener("message",this.handleCache)}addToPrecacheList(e){let t=[];for(let a of e){"string"==typeof a?t.push(a):a&&!a.integrity&&void 0===a.revision&&t.push(a.url);let{cacheKey:e,url:s}=ts(a),r="string"!=typeof a&&a.revision?"reload":"default";if(this._urlsToCacheKeys.has(s)&&this._urlsToCacheKeys.get(s)!==e)throw new eu("add-to-cache-list-conflicting-entries",{firstEntry:this._urlsToCacheKeys.get(s),secondEntry:e});if("string"!=typeof a&&a.integrity){if(this._cacheKeysToIntegrities.has(e)&&this._cacheKeysToIntegrities.get(e)!==a.integrity)throw new eu("add-to-cache-list-conflicting-integrities",{url:s});this._cacheKeysToIntegrities.set(e,a.integrity)}this._urlsToCacheKeys.set(s,e),this._urlsToCacheModes.set(s,r),t.length>0&&console.warn(`Serwist is precaching URLs without revision info: ${t.join(", ")} -This is generally NOT safe. Learn more at https://bit.ly/wb-precache`)}}handleInstall(e){return e_(e,async()=>{let t=new ta;this.precacheStrategy.plugins.push(t),await te(this._concurrentPrecaching,Array.from(this._urlsToCacheKeys.entries()),async([t,a])=>{let s=this._cacheKeysToIntegrities.get(a),r=this._urlsToCacheModes.get(t),i=new Request(t,{integrity:s,cache:r,credentials:"same-origin"});await Promise.all(this.precacheStrategy.handleAll({event:e,request:i,url:new URL(i.url),params:{cacheKey:a}}))});let{updatedURLs:a,notUpdatedURLs:s}=t;return{updatedURLs:a,notUpdatedURLs:s}})}handleActivate(e){return e_(e,async()=>{let e=await self.caches.open(this.precacheStrategy.cacheName),t=await e.keys(),a=new Set(this._urlsToCacheKeys.values()),s=[];for(let r of t)a.has(r.url)||(await e.delete(r),s.push(r.url));return{deletedCacheRequests:s}})}handleFetch(e){let{request:t}=e,a=this.handleRequest({request:t,event:e});a&&e.respondWith(a)}handleCache(e){if(e.data&&"CACHE_URLS"===e.data.type){let{payload:t}=e.data,a=Promise.all(t.urlsToCache.map(t=>{let a;return a="string"==typeof t?new Request(t):new Request(...t),this.handleRequest({request:a,event:e})}));e.waitUntil(a),e.ports?.[0]&&a.then(()=>e.ports[0].postMessage(!0))}}setDefaultHandler(e,t="GET"){this._defaultHandlerMap.set(t,eS(e))}setCatchHandler(e){this._catchHandler=eS(e)}registerCapture(e,t,a){let s=e3(e,t,a);return this.registerRoute(s),s}registerRoute(e){this._routes.has(e.method)||this._routes.set(e.method,[]),this._routes.get(e.method).push(e)}unregisterRoute(e){if(!this._routes.has(e.method))throw new eu("unregister-route-but-not-found-with-method",{method:e.method});let t=this._routes.get(e.method).indexOf(e);if(t>-1)this._routes.get(e.method).splice(t,1);else throw new eu("unregister-route-route-not-registered")}getUrlsToPrecacheKeys(){return this._urlsToCacheKeys}getPrecachedUrls(){return[...this._urlsToCacheKeys.keys()]}getPrecacheKeyForUrl(e){let t=new URL(e,location.href);return this._urlsToCacheKeys.get(t.href)}getIntegrityForPrecacheKey(e){return this._cacheKeysToIntegrities.get(e)}async matchPrecache(e){let t=e instanceof Request?e.url:e,a=this.getPrecacheKeyForUrl(t);if(a)return(await self.caches.open(this.precacheStrategy.cacheName)).match(a)}createHandlerBoundToUrl(e){let t=this.getPrecacheKeyForUrl(e);if(!t)throw new eu("non-precached-url",{url:e});return a=>(a.request=new Request(e),a.params={cacheKey:t,...a.params},this.precacheStrategy.handle(a))}handleRequest({request:e,event:t}){let a;let s=new URL(e.url,location.href);if(!s.protocol.startsWith("http"))return;let r=s.origin===location.origin,{params:i,route:n}=this.findMatchingRoute({event:t,request:e,sameOrigin:r,url:s}),c=n?.handler,l=e.method;if(!c&&this._defaultHandlerMap.has(l)&&(c=this._defaultHandlerMap.get(l)),!c)return;try{a=c.handle({url:s,request:e,event:t,params:i})}catch(e){a=Promise.reject(e)}let o=n?.catchHandler;return a instanceof Promise&&(this._catchHandler||o)&&(a=a.catch(async a=>{if(o)try{return await o.handle({url:s,request:e,event:t,params:i})}catch(e){e instanceof Error&&(a=e)}if(this._catchHandler)return this._catchHandler.handle({url:s,request:e,event:t});throw a})),a}findMatchingRoute({url:e,sameOrigin:t,request:a,event:s}){for(let r of this._routes.get(a.method)||[]){let i;let n=r.match({url:e,sameOrigin:t,request:a,event:s});if(n)return Array.isArray(i=n)&&0===i.length?i=void 0:n.constructor===Object&&0===Object.keys(n).length?i=void 0:"boolean"==typeof n&&(i=void 0),{route:r,params:i}}return{}}}new tr({precacheEntries:[{'revision':'055966d7d51944d59a4f11e264ebd4cb','url':'/_next/static/_pQTeG765JYEnog9J4840/_buildManifest.js'},{'revision':'b6652df95db52feb4daf4eca35380933','url':'/_next/static/_pQTeG765JYEnog9J4840/_ssgManifest.js'},{'revision':null,'url':'/_next/static/chunks/1f94eeea-e8ec0fb64a813575.js'},{'revision':null,'url':'/_next/static/chunks/249-05f14d7a998f49db.js'},{'revision':null,'url':'/_next/static/chunks/320.6211eb946b8a47f4.js'},{'revision':null,'url':'/_next/static/chunks/323.4218dabac2e7ece9.js'},{'revision':null,'url':'/_next/static/chunks/362-4eff0290e3bf6198.js'},{'revision':null,'url':'/_next/static/chunks/381-8d3e0bee0b93f808.js'},{'revision':null,'url':'/_next/static/chunks/40-6d14f8827cc2b5d4.js'},{'revision':null,'url':'/_next/static/chunks/405-3c31dd0f62768174.js'},{'revision':null,'url':'/_next/static/chunks/468-fb2d3efb12eaad86.js'},{'revision':null,'url':'/_next/static/chunks/509ab1ef.569f8ae6c5d9d300.js'},{'revision':null,'url':'/_next/static/chunks/558.89e6bee20a3324db.js'},{'revision':null,'url':'/_next/static/chunks/615.6520508377e051f5.js'},{'revision':null,'url':'/_next/static/chunks/793159d7-16a7180ed14ce59e.js'},{'revision':null,'url':'/_next/static/chunks/849-69563cf2325d2b87.js'},{'revision':null,'url':'/_next/static/chunks/873-648b1096bdd0bd9e.js'},{'revision':null,'url':'/_next/static/chunks/895-71ae980201881a3c.js'},{'revision':null,'url':'/_next/static/chunks/94cf3c84-ff5c059de3e887e1.js'},{'revision':null,'url':'/_next/static/chunks/968.22a3106f0da5a6a8.js'},{'revision':null,'url':'/_next/static/chunks/app/(pages)/home/page-cc486d634913f522.js'},{'revision':null,'url':'/_next/static/chunks/app/(pages)/hubspot/page-d9ca651142a37919.js'},{'revision':null,'url':'/_next/static/chunks/app/(pages)/layout-2117cbc1366234fb.js'},{'revision':null,'url':'/_next/static/chunks/app/(pages)/r3f/page-4230193e57172601.js'},{'revision':null,'url':'/_next/static/chunks/app/(pages)/shopify/page-bc40eaa8265a2e75.js'},{'revision':null,'url':'/_next/static/chunks/app/(pages)/storyblok/%5Bslug%5D/page-56ff10d59b4b7414.js'},{'revision':null,'url':'/_next/static/chunks/app/(pages)/storyblok/page-c288c40c66e34d8d.js'},{'revision':null,'url':'/_next/static/chunks/app/(pages)/template-4a86f640ed0fd9ca.js'},{'revision':null,'url':'/_next/static/chunks/app/_not-found/page-0dfd6762eda3b081.js'},{'revision':null,'url':'/_next/static/chunks/app/debug/layout-303aa2c10ddf03ad.js'},{'revision':null,'url':'/_next/static/chunks/app/debug/orchestra/page-00ac3c729fa8ba51.js'},{'revision':null,'url':'/_next/static/chunks/fbbce377-cc3da5881d1a0315.js'},{'revision':null,'url':'/_next/static/chunks/framework-3604f115e12d558f.js'},{'revision':null,'url':'/_next/static/chunks/main-app-28c05d913cf725e7.js'},{'revision':null,'url':'/_next/static/chunks/main-b44e7376652b812a.js'},{'revision':null,'url':'/_next/static/chunks/pages/_app-4c2a6c06133f1ffb.js'},{'revision':null,'url':'/_next/static/chunks/pages/_error-64e5c6fa0b80230e.js'},{'revision':'79330112775102f91e1010318bae2bd3','url':'/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js'},{'revision':null,'url':'/_next/static/chunks/webpack-e2335765ac2b7d43.js'},{'revision':null,'url':'/_next/static/css/0847daa8068eb623.css'},{'revision':null,'url':'/_next/static/css/15985cab45436ff4.css'},{'revision':null,'url':'/_next/static/css/1604936466bdd436.css'},{'revision':null,'url':'/_next/static/css/c51a91db91b82fc3.css'},{'revision':null,'url':'/_next/static/css/d22d53a8444a47d5.css'},{'revision':null,'url':'/_next/static/css/d7c16d1c77b3229b.css'},{'revision':null,'url':'/_next/static/css/dc5cdc32d421ef51.css'},{'revision':'b030616b10becd6a9d1c93f6a5deed7f','url':'/_next/static/media/49e51380911abed7-s.p.woff2'},{'revision':'6173918d63fc1a11cbfa6225cded29e3','url':'/config/Satus-R3f.json'},{'revision':'7acaee8001995cd8d7496ccae00f23a9','url':'/swe-worker-ab00d3c7d2d59769.js'}],skipWaiting:!0,clientsClaim:!0,navigationPreload:!0,runtimeCaching:ea}).addEventListeners()}(); \ No newline at end of file +/* + * ATTENTION: An "eval-source-map" devtool has been used. + * This devtool is neither made for production nor for readable output files. + * It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools. + * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) + * or disable the default devtool with "devtool: false". + * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). + */ +/******/ (function() { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./node_modules/.pnpm/@serwist+core@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/core/dist/chunks/quotaErrorCallbacks.js": +/*!******************************************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/@serwist+core@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/core/dist/chunks/quotaErrorCallbacks.js ***! + \******************************************************************************************************************************************/ +/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ S: function() { return /* binding */ SerwistError; },\n/* harmony export */ a: function() { return /* binding */ canConstructResponseFromBodyStream; },\n/* harmony export */ c: function() { return /* binding */ cacheNames; },\n/* harmony export */ f: function() { return /* binding */ finalAssertExports; },\n/* harmony export */ l: function() { return /* binding */ logger; },\n/* harmony export */ q: function() { return /* binding */ quotaErrorCallbacks; }\n/* harmony export */ });\nconst _cacheNameDetails = {\n googleAnalytics: \"googleAnalytics\",\n precache: \"precache-v2\",\n prefix: \"serwist\",\n runtime: \"runtime\",\n suffix: typeof registration !== \"undefined\" ? registration.scope : \"\"\n};\nconst _createCacheName = (cacheName)=>{\n return [\n _cacheNameDetails.prefix,\n cacheName,\n _cacheNameDetails.suffix\n ].filter((value)=>value && value.length > 0).join(\"-\");\n};\nconst eachCacheNameDetail = (fn)=>{\n for (const key of Object.keys(_cacheNameDetails)){\n fn(key);\n }\n};\nconst cacheNames = {\n updateDetails: (details)=>{\n eachCacheNameDetail((key)=>{\n const detail = details[key];\n if (typeof detail === \"string\") {\n _cacheNameDetails[key] = detail;\n }\n });\n },\n getGoogleAnalyticsName: (userCacheName)=>{\n return userCacheName || _createCacheName(_cacheNameDetails.googleAnalytics);\n },\n getPrecacheName: (userCacheName)=>{\n return userCacheName || _createCacheName(_cacheNameDetails.precache);\n },\n getPrefix: ()=>{\n return _cacheNameDetails.prefix;\n },\n getRuntimeName: (userCacheName)=>{\n return userCacheName || _createCacheName(_cacheNameDetails.runtime);\n },\n getSuffix: ()=>{\n return _cacheNameDetails.suffix;\n }\n};\n\nconst messages = {\n \"invalid-value\": ({ paramName, validValueDescription, value })=>{\n if (!paramName || !validValueDescription) {\n throw new Error(`Unexpected input to 'invalid-value' error.`);\n }\n return `The '${paramName}' parameter was given a value with an ` + `unexpected value. ${validValueDescription} Received a value of ` + `${JSON.stringify(value)}.`;\n },\n \"not-an-array\": ({ moduleName, className, funcName, paramName })=>{\n if (!moduleName || !className || !funcName || !paramName) {\n throw new Error(`Unexpected input to 'not-an-array' error.`);\n }\n return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className}.${funcName}()' must be an array.`;\n },\n \"incorrect-type\": ({ expectedType, paramName, moduleName, className, funcName })=>{\n if (!expectedType || !paramName || !moduleName || !funcName) {\n throw new Error(`Unexpected input to 'incorrect-type' error.`);\n }\n const classNameStr = className ? `${className}.` : \"\";\n return `The parameter '${paramName}' passed into ` + `'${moduleName}.${classNameStr}` + `${funcName}()' must be of type ${expectedType}.`;\n },\n \"incorrect-class\": ({ expectedClassName, paramName, moduleName, className, funcName, isReturnValueProblem })=>{\n if (!expectedClassName || !moduleName || !funcName) {\n throw new Error(`Unexpected input to 'incorrect-class' error.`);\n }\n const classNameStr = className ? `${className}.` : \"\";\n if (isReturnValueProblem) {\n return `The return value from '${moduleName}.${classNameStr}${funcName}()' must be an instance of class ${expectedClassName}.`;\n }\n return `The parameter '${paramName}' passed into ` + `'${moduleName}.${classNameStr}${funcName}()' ` + `must be an instance of class ${expectedClassName}.`;\n },\n \"missing-a-method\": ({ expectedMethod, paramName, moduleName, className, funcName })=>{\n if (!expectedMethod || !paramName || !moduleName || !className || !funcName) {\n throw new Error(`Unexpected input to 'missing-a-method' error.`);\n }\n return `${moduleName}.${className}.${funcName}() expected the ` + `'${paramName}' parameter to expose a '${expectedMethod}' method.`;\n },\n \"add-to-cache-list-unexpected-type\": ({ entry })=>{\n return `An unexpected entry was passed to '@serwist/precaching.PrecacheController.addToCacheList()' The entry '${JSON.stringify(entry)}' isn't supported. You must supply an array of strings with one or more characters, objects with a url property or Request objects.`;\n },\n \"add-to-cache-list-conflicting-entries\": ({ firstEntry, secondEntry })=>{\n if (!firstEntry || !secondEntry) {\n throw new Error(\"Unexpected input to \" + `'add-to-cache-list-duplicate-entries' error.`);\n }\n return `Two of the entries passed to '@serwist/precaching.PrecacheController.addToCacheList()' had the URL ${firstEntry} but different revision details. Serwist is unable to cache and version the asset correctly. Please remove one of the entries.`;\n },\n \"plugin-error-request-will-fetch\": ({ thrownErrorMessage })=>{\n if (!thrownErrorMessage) {\n throw new Error(\"Unexpected input to \" + `'plugin-error-request-will-fetch', error.`);\n }\n return `An error was thrown by a plugin's 'requestWillFetch()' method. The thrown error message was: '${thrownErrorMessage}'.`;\n },\n \"invalid-cache-name\": ({ cacheNameId, value })=>{\n if (!cacheNameId) {\n throw new Error(`Expected a 'cacheNameId' for error 'invalid-cache-name'`);\n }\n return `You must provide a name containing at least one character for setCacheDetails({${cacheNameId}: '...'}). Received a value of '${JSON.stringify(value)}'`;\n },\n \"unregister-route-but-not-found-with-method\": ({ method })=>{\n if (!method) {\n throw new Error(\"Unexpected input to \" + `'unregister-route-but-not-found-with-method' error.`);\n }\n return `The route you're trying to unregister was not previously registered for the method type '${method}'.`;\n },\n \"unregister-route-route-not-registered\": ()=>{\n return `The route you're trying to unregister was not previously ` + \"registered.\";\n },\n \"queue-replay-failed\": ({ name })=>{\n return `Replaying the background sync queue '${name}' failed.`;\n },\n \"duplicate-queue-name\": ({ name })=>{\n return `The Queue name '${name}' is already being used. All instances of backgroundSync.Queue must be given unique names.`;\n },\n \"expired-test-without-max-age\": ({ methodName, paramName })=>{\n return `The '${methodName}()' method can only be used when the ` + `'${paramName}' is used in the constructor.`;\n },\n \"unsupported-route-type\": ({ moduleName, className, funcName, paramName })=>{\n return `The supplied '${paramName}' parameter was an unsupported type. Please check the docs for ${moduleName}.${className}.${funcName} for valid input types.`;\n },\n \"not-array-of-class\": ({ value, expectedClass, moduleName, className, funcName, paramName })=>{\n return `The supplied '${paramName}' parameter must be an array of '${expectedClass}' objects. Received '${JSON.stringify(value)},'. Please check the call to ${moduleName}.${className}.${funcName}() to fix the issue.`;\n },\n \"max-entries-or-age-required\": ({ moduleName, className, funcName })=>{\n return `You must define either 'config.maxEntries' or 'config.maxAgeSeconds' in '${moduleName}.${className}.${funcName}'`;\n },\n \"statuses-or-headers-required\": ({ moduleName, className, funcName })=>{\n return `You must define either 'config.statuses' or 'config.headers' in '${moduleName}.${className}.${funcName}'`;\n },\n \"invalid-string\": ({ moduleName, funcName, paramName })=>{\n if (!paramName || !moduleName || !funcName) {\n throw new Error(`Unexpected input to 'invalid-string' error.`);\n }\n return `When using strings, the '${paramName}' parameter must start with 'http' (for cross-origin matches) or '/' (for same-origin matches). Please see the docs for ${moduleName}.${funcName}() for more info.`;\n },\n \"channel-name-required\": ()=>{\n return \"You must provide a channelName to construct a \" + \"BroadcastCacheUpdate instance.\";\n },\n \"invalid-responses-are-same-args\": ()=>{\n return \"The arguments passed into responsesAreSame() appear to be \" + \"invalid. Please ensure valid Responses are used.\";\n },\n \"expire-custom-caches-only\": ()=>{\n return `You must provide a 'cacheName' property when using the ` + \"expiration plugin with a runtime caching strategy.\";\n },\n \"unit-must-be-bytes\": ({ normalizedRangeHeader })=>{\n if (!normalizedRangeHeader) {\n throw new Error(`Unexpected input to 'unit-must-be-bytes' error.`);\n }\n return `The 'unit' portion of the Range header must be set to 'bytes'. The Range header provided was \"${normalizedRangeHeader}\"`;\n },\n \"single-range-only\": ({ normalizedRangeHeader })=>{\n if (!normalizedRangeHeader) {\n throw new Error(`Unexpected input to 'single-range-only' error.`);\n }\n return `Multiple ranges are not supported. Please use a single start value, and optional end value. The Range header provided was \"${normalizedRangeHeader}\"`;\n },\n \"invalid-range-values\": ({ normalizedRangeHeader })=>{\n if (!normalizedRangeHeader) {\n throw new Error(`Unexpected input to 'invalid-range-values' error.`);\n }\n return `The Range header is missing both start and end values. At least one of those values is needed. The Range header provided was \"${normalizedRangeHeader}\"`;\n },\n \"no-range-header\": ()=>{\n return \"No Range header was found in the Request provided.\";\n },\n \"range-not-satisfiable\": ({ size, start, end })=>{\n return `The start (${start}) and end (${end}) values in the Range are ` + `not satisfiable by the cached response, which is ${size} bytes.`;\n },\n \"attempt-to-cache-non-get-request\": ({ url, method })=>{\n return `Unable to cache '${url}' because it is a '${method}' request and only 'GET' requests can be cached.`;\n },\n \"cache-put-with-no-response\": ({ url })=>{\n return `There was an attempt to cache '${url}' but the response was not defined.`;\n },\n \"no-response\": ({ url, error })=>{\n let message = `The strategy could not generate a response for '${url}'.`;\n if (error) {\n message += ` The underlying error is ${error}.`;\n }\n return message;\n },\n \"bad-precaching-response\": ({ url, status })=>{\n return `The precaching request for '${url}' failed${status ? ` with an HTTP status of ${status}.` : \".\"}`;\n },\n \"non-precached-url\": ({ url })=>{\n return `'createHandlerBoundToURL(\"${url}\")' was called, but that URL is not precached. Please pass in a URL that is precached instead.`;\n },\n \"add-to-cache-list-conflicting-integrities\": ({ url })=>{\n return `Two of the entries passed to '@serwist/precaching.PrecacheController.addToCacheList()' had the URL ${url} with different integrity values. Please remove one of them.`;\n },\n \"missing-precache-entry\": ({ cacheName, url })=>{\n return `Unable to find a precached response in ${cacheName} for ${url}.`;\n },\n \"cross-origin-copy-response\": ({ origin })=>{\n return `'@serwist/core.copyResponse()' can only be used with same-origin responses. It was passed a response with origin ${origin}.`;\n },\n \"opaque-streams-source\": ({ type })=>{\n const message = `One of the '@serwist/streams' sources resulted in an '${type}' response.`;\n if (type === \"opaqueredirect\") {\n return `${message} Please do not use a navigation request that results in a redirect as a source.`;\n }\n return `${message} Please ensure your sources are CORS-enabled.`;\n }\n};\n\nconst fallback = (code, ...args)=>{\n let msg = code;\n if (args.length > 0) {\n msg += ` :: ${JSON.stringify(args)}`;\n }\n return msg;\n};\nconst generatorFunction = (code, details = {})=>{\n const message = messages[code];\n if (!message) {\n throw new Error(`Unable to find message for code '${code}'.`);\n }\n return message(details);\n};\nconst messageGenerator = false ? 0 : generatorFunction;\n\nclass SerwistError extends Error {\n details;\n constructor(errorCode, details){\n const message = messageGenerator(errorCode, details);\n super(message);\n this.name = errorCode;\n this.details = details;\n }\n}\n\nlet supportStatus;\nfunction canConstructResponseFromBodyStream() {\n if (supportStatus === undefined) {\n const testResponse = new Response(\"\");\n if (\"body\" in testResponse) {\n try {\n new Response(testResponse.body);\n supportStatus = true;\n } catch (error) {\n supportStatus = false;\n }\n }\n supportStatus = false;\n }\n return supportStatus;\n}\n\nconst isArray = (value, details)=>{\n if (!Array.isArray(value)) {\n throw new SerwistError(\"not-an-array\", details);\n }\n};\nconst hasMethod = (object, expectedMethod, details)=>{\n const type = typeof object[expectedMethod];\n if (type !== \"function\") {\n details.expectedMethod = expectedMethod;\n throw new SerwistError(\"missing-a-method\", details);\n }\n};\nconst isType = (object, expectedType, details)=>{\n if (typeof object !== expectedType) {\n details.expectedType = expectedType;\n throw new SerwistError(\"incorrect-type\", details);\n }\n};\nconst isInstance = (object, expectedClass, details)=>{\n if (!(object instanceof expectedClass)) {\n details.expectedClassName = expectedClass.name;\n throw new SerwistError(\"incorrect-class\", details);\n }\n};\nconst isOneOf = (value, validValues, details)=>{\n if (!validValues.includes(value)) {\n details.validValueDescription = `Valid values are ${JSON.stringify(validValues)}.`;\n throw new SerwistError(\"invalid-value\", details);\n }\n};\nconst isArrayOfClass = (value, expectedClass, details)=>{\n const error = new SerwistError(\"not-array-of-class\", details);\n if (!Array.isArray(value)) {\n throw error;\n }\n for (const item of value){\n if (!(item instanceof expectedClass)) {\n throw error;\n }\n }\n};\nconst finalAssertExports = false ? 0 : {\n hasMethod,\n isArray,\n isInstance,\n isOneOf,\n isType,\n isArrayOfClass\n};\n\nconst logger = false ? 0 : (()=>{\n if (!(\"__WB_DISABLE_DEV_LOGS\" in globalThis)) {\n self.__WB_DISABLE_DEV_LOGS = false;\n }\n let inGroup = false;\n const methodToColorMap = {\n debug: \"#7f8c8d\",\n log: \"#2ecc71\",\n warn: \"#f39c12\",\n error: \"#c0392b\",\n groupCollapsed: \"#3498db\",\n groupEnd: null\n };\n const print = (method, args)=>{\n if (self.__WB_DISABLE_DEV_LOGS) {\n return;\n }\n if (method === \"groupCollapsed\") {\n if (typeof navigator !== \"undefined\" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {\n console[method](...args);\n return;\n }\n }\n const styles = [\n `background: ${methodToColorMap[method]}`,\n \"border-radius: 0.5em\",\n \"color: white\",\n \"font-weight: bold\",\n \"padding: 2px 0.5em\"\n ];\n const logPrefix = inGroup ? [] : [\n \"%cserwist\",\n styles.join(\";\")\n ];\n console[method](...logPrefix, ...args);\n if (method === \"groupCollapsed\") {\n inGroup = true;\n }\n if (method === \"groupEnd\") {\n inGroup = false;\n }\n };\n const loggerMethods = Object.keys(methodToColorMap);\n return loggerMethods.reduce((api, method)=>{\n api[method] = (...args)=>{\n print(method, args);\n };\n return api;\n }, {});\n})();\n\nconst quotaErrorCallbacks = new Set();\n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vQHNlcndpc3QrY29yZU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LCBxdW90YUVycm9yQ2FsbGJhY2tzIGFzIHEgfTtcbiJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/@serwist+core@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/core/dist/chunks/quotaErrorCallbacks.js\n")); + +/***/ }), + +/***/ "./node_modules/.pnpm/@serwist+core@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/core/dist/index.internal.js": +/*!******************************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/@serwist+core@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/core/dist/index.internal.js ***! + \******************************************************************************************************************************/ +/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Deferred: function() { return /* binding */ Deferred; },\n/* harmony export */ SerwistError: function() { return /* reexport safe */ _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.S; },\n/* harmony export */ assert: function() { return /* reexport safe */ _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.f; },\n/* harmony export */ cacheMatchIgnoreParams: function() { return /* binding */ cacheMatchIgnoreParams; },\n/* harmony export */ canConstructReadableStream: function() { return /* binding */ canConstructReadableStream; },\n/* harmony export */ canConstructResponseFromBodyStream: function() { return /* reexport safe */ _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.a; },\n/* harmony export */ dontWaitFor: function() { return /* binding */ dontWaitFor; },\n/* harmony export */ executeQuotaErrorCallbacks: function() { return /* binding */ executeQuotaErrorCallbacks; },\n/* harmony export */ getFriendlyURL: function() { return /* binding */ getFriendlyURL; },\n/* harmony export */ logger: function() { return /* reexport safe */ _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.l; },\n/* harmony export */ privateCacheNames: function() { return /* reexport safe */ _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.c; },\n/* harmony export */ resultingClientExists: function() { return /* binding */ resultingClientExists; },\n/* harmony export */ timeout: function() { return /* binding */ timeout; },\n/* harmony export */ waitUntil: function() { return /* binding */ waitUntil; }\n/* harmony export */ });\n/* harmony import */ var _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./chunks/quotaErrorCallbacks.js */ \"./node_modules/.pnpm/@serwist+core@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/core/dist/chunks/quotaErrorCallbacks.js\");\n\n\n\nclass Deferred {\n promise;\n resolve;\n reject;\n constructor(){\n this.promise = new Promise((resolve, reject)=>{\n this.resolve = resolve;\n this.reject = reject;\n });\n }\n}\n\nfunction stripParams(fullURL, ignoreParams) {\n const strippedURL = new URL(fullURL);\n for (const param of ignoreParams){\n strippedURL.searchParams.delete(param);\n }\n return strippedURL.href;\n}\nasync function cacheMatchIgnoreParams(cache, request, ignoreParams, matchOptions) {\n const strippedRequestURL = stripParams(request.url, ignoreParams);\n if (request.url === strippedRequestURL) {\n return cache.match(request, matchOptions);\n }\n const keysOptions = {\n ...matchOptions,\n ignoreSearch: true\n };\n const cacheKeys = await cache.keys(request, keysOptions);\n for (const cacheKey of cacheKeys){\n const strippedCacheKeyURL = stripParams(cacheKey.url, ignoreParams);\n if (strippedRequestURL === strippedCacheKeyURL) {\n return cache.match(cacheKey, matchOptions);\n }\n }\n return;\n}\n\nlet supportStatus;\nfunction canConstructReadableStream() {\n if (supportStatus === undefined) {\n try {\n new ReadableStream({\n start () {}\n });\n supportStatus = true;\n } catch (error) {\n supportStatus = false;\n }\n }\n return supportStatus;\n}\n\nfunction dontWaitFor(promise) {\n void promise.then(()=>{});\n}\n\nconst executeQuotaErrorCallbacks = async ()=>{\n if (true) {\n _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`About to run ${_chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.q.size} callbacks to clean up caches.`);\n }\n for (const callback of _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.q){\n await callback();\n if (true) {\n _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.l.log(callback, \"is complete.\");\n }\n }\n if (true) {\n _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.l.log(\"Finished running callbacks.\");\n }\n};\n\nconst getFriendlyURL = (url)=>{\n const urlObj = new URL(String(url), location.href);\n return urlObj.href.replace(new RegExp(`^${location.origin}`), \"\");\n};\n\nfunction timeout(ms) {\n return new Promise((resolve)=>setTimeout(resolve, ms));\n}\n\nconst MAX_RETRY_TIME = 2000;\nasync function resultingClientExists(resultingClientId) {\n if (!resultingClientId) {\n return;\n }\n let existingWindows = await self.clients.matchAll({\n type: \"window\"\n });\n const existingWindowIds = new Set(existingWindows.map((w)=>w.id));\n let resultingWindow = undefined;\n const startTime = performance.now();\n while(performance.now() - startTime < MAX_RETRY_TIME){\n existingWindows = await self.clients.matchAll({\n type: \"window\"\n });\n resultingWindow = existingWindows.find((w)=>{\n if (resultingClientId) {\n return w.id === resultingClientId;\n }\n return !existingWindowIds.has(w.id);\n });\n if (resultingWindow) {\n break;\n }\n await timeout(100);\n }\n return resultingWindow;\n}\n\nconst waitUntil = (event, asyncFn)=>{\n const returnPromise = asyncFn();\n event.waitUntil(returnPromise);\n return returnPromise;\n};\n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vQHNlcndpc3QrY29yZUA5LjAuMC1wcmV2aWV3LjIxX3R5cGVzY3JpcHRANS40LjUvbm9kZV9tb2R1bGVzL0BzZXJ3aXN0L2NvcmUvZGlzdC9pbmRleC5pbnRlcm5hbC5qcyIsIm1hcHBpbmdzIjoiOzs7Oz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XG4gICAgICAgIHJlc3VsdGluZ1dpbmRvdyA9IGV4aXN0aW5nV2luZG93cy5maW5kKCh3KT0+e1xuICAgICAgICAgICAgaWYgKHJlc3VsdGluZ0NsaWVudElkKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHcuaWQgPT09IHJlc3VsdGluZ0NsaWVudElkO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuICFleGlzdGluZ1dpbmRvd0lkcy5oYXMody5pZCk7XG4gICAgICAgIH0pO1xuICAgICAgICBpZiAocmVzdWx0aW5nV2luZG93KSB7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgICAgICBhd2FpdCB0aW1lb3V0KDEwMCk7XG4gICAgfVxuICAgIHJldHVybiByZXN1bHRpbmdXaW5kb3c7XG59XG5cbmNvbnN0IHdhaXRVbnRpbCA9IChldmVudCwgYXN5bmNGbik9PntcbiAgICBjb25zdCByZXR1cm5Qcm9taXNlID0gYXN5bmNGbigpO1xuICAgIGV2ZW50LndhaXRVbnRpbChyZXR1cm5Qcm9taXNlKTtcbiAgICByZXR1cm4gcmV0dXJuUHJvbWlzZTtcbn07XG5cbmV4cG9ydCB7IERlZmVycmVkLCBjYWNoZU1hdGNoSWdub3JlUGFyYW1zLCBjYW5Db25zdHJ1Y3RSZWFkYWJsZVN0cmVhbSwgZG9udFdhaXRGb3IsIGV4ZWN1dGVRdW90YUVycm9yQ2FsbGJhY2tzLCBnZXRGcmllbmRseVVSTCwgbG9nZ2VyLCByZXN1bHRpbmdDbGllbnRFeGlzdHMsIHRpbWVvdXQsIHdhaXRVbnRpbCB9O1xuIl0sIm5hbWVzIjpbXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/@serwist+core@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/core/dist/index.internal.js\n")); + +/***/ }), + +/***/ "./node_modules/.pnpm/@serwist+core@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/core/dist/index.js": +/*!*********************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/@serwist+core@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/core/dist/index.js ***! + \*********************************************************************************************************************/ +/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ cacheNames: function() { return /* binding */ cacheNames; },\n/* harmony export */ clientsClaim: function() { return /* binding */ clientsClaim; },\n/* harmony export */ copyResponse: function() { return /* binding */ copyResponse; },\n/* harmony export */ registerQuotaErrorCallback: function() { return /* binding */ registerQuotaErrorCallback; },\n/* harmony export */ setCacheNameDetails: function() { return /* binding */ setCacheNameDetails; }\n/* harmony export */ });\n/* harmony import */ var _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./chunks/quotaErrorCallbacks.js */ \"./node_modules/.pnpm/@serwist+core@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/core/dist/chunks/quotaErrorCallbacks.js\");\n\n\nconst cacheNames = {\n get googleAnalytics () {\n return _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.c.getGoogleAnalyticsName();\n },\n get precache () {\n return _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.c.getPrecacheName();\n },\n get prefix () {\n return _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.c.getPrefix();\n },\n get runtime () {\n return _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.c.getRuntimeName();\n },\n get suffix () {\n return _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.c.getSuffix();\n }\n};\n\nconst clientsClaim = ()=>{\n self.addEventListener(\"activate\", ()=>self.clients.claim());\n};\n\nconst copyResponse = async (response, modifier)=>{\n let origin = null;\n if (response.url) {\n const responseURL = new URL(response.url);\n origin = responseURL.origin;\n }\n if (origin !== self.location.origin) {\n throw new _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.S(\"cross-origin-copy-response\", {\n origin\n });\n }\n const clonedResponse = response.clone();\n const responseInit = {\n headers: new Headers(clonedResponse.headers),\n status: clonedResponse.status,\n statusText: clonedResponse.statusText\n };\n const modifiedResponseInit = modifier ? modifier(responseInit) : responseInit;\n const body = (0,_chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.a)() ? clonedResponse.body : await clonedResponse.blob();\n return new Response(body, modifiedResponseInit);\n};\n\nconst registerQuotaErrorCallback = (callback)=>{\n if (true) {\n _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(callback, \"function\", {\n moduleName: \"@serwist/core\",\n funcName: \"register\",\n paramName: \"callback\"\n });\n }\n _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.q.add(callback);\n if (true) {\n _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.l.log(\"Registered a callback to respond to quota errors.\", callback);\n }\n};\n\nconst setCacheNameDetails = (details)=>{\n if (true) {\n for (const key of Object.keys(details)){\n _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(details[key], \"string\", {\n moduleName: \"@serwist/core\",\n funcName: \"setCacheNameDetails\",\n paramName: `details.${key}`\n });\n }\n if (details.precache?.length === 0) {\n throw new _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.S(\"invalid-cache-name\", {\n cacheNameId: \"precache\",\n value: details.precache\n });\n }\n if (details.runtime?.length === 0) {\n throw new _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.S(\"invalid-cache-name\", {\n cacheNameId: \"runtime\",\n value: details.runtime\n });\n }\n if (details.googleAnalytics?.length === 0) {\n throw new _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.S(\"invalid-cache-name\", {\n cacheNameId: \"googleAnalytics\",\n value: details.googleAnalytics\n });\n }\n }\n _chunks_quotaErrorCallbacks_js__WEBPACK_IMPORTED_MODULE_0__.c.updateDetails(details);\n};\n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vQHNlcndpc3QrY29yZUA5LjAuMC1wcmV2aWV3LjIxX3R5cGVzY3JpcHRANS40LjUvbm9kZV9tb2R1bGVzL0BzZXJ3aXN0L2NvcmUvZGlzdC9pbmRleC5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBZ007O0FBRWhNO0FBQ0E7QUFDQSxlQUFlLDZEQUFZO0FBQzNCLEtBQUs7QUFDTDtBQUNBLGVBQWUsNkRBQVk7QUFDM0IsS0FBSztBQUNMO0FBQ0EsZUFBZSw2REFBWTtBQUMzQixLQUFLO0FBQ0w7QUFDQSxlQUFlLDZEQUFZO0FBQzNCLEtBQUs7QUFDTDtBQUNBLGVBQWUsNkRBQVk7QUFDM0I7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxrQkFBa0IsNkRBQVk7QUFDOUI7QUFDQSxTQUFTO0FBQ1Q7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLGlCQUFpQixpRUFBa0M7QUFDbkQ7QUFDQTs7QUFFQTtBQUNBLFFBQVEsSUFBcUM7QUFDN0MsUUFBUSw2REFBa0I7QUFDMUI7QUFDQTtBQUNBO0FBQ0EsU0FBUztBQUNUO0FBQ0EsSUFBSSw2REFBbUI7QUFDdkIsUUFBUSxJQUFxQztBQUM3QyxRQUFRLDZEQUFNO0FBQ2Q7QUFDQTs7QUFFQTtBQUNBLFFBQVEsSUFBcUM7QUFDN0M7QUFDQSx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VEZXRhaWxzID0gKGRldGFpbHMpPT57XG4gICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICBmb3IgKGNvbnN0IGtleSBvZiBPYmplY3Qua2V5cyhkZXRhaWxzKSl7XG4gICAgICAgICAgICBmaW5hbEFzc2VydEV4cG9ydHMuaXNUeXBlKGRldGFpbHNba2V5XSwgXCJzdHJpbmdcIiwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3QvY29yZVwiLFxuICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcInNldENhY2hlTmFtZURldGFpbHNcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IGBkZXRhaWxzLiR7a2V5fWBcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChkZXRhaWxzLnByZWNhY2hlPy5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBTZXJ3aXN0RXJyb3IoXCJpbnZhbGlkLWNhY2hlLW5hbWVcIiwge1xuICAgICAgICAgICAgICAgIGNhY2hlTmFtZUlkOiBcInByZWNhY2hlXCIsXG4gICAgICAgICAgICAgICAgdmFsdWU6IGRldGFpbHMucHJlY2FjaGVcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChkZXRhaWxzLnJ1bnRpbWU/Lmxlbmd0aCA9PT0gMCkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IFNlcndpc3RFcnJvcihcImludmFsaWQtY2FjaGUtbmFtZVwiLCB7XG4gICAgICAgICAgICAgICAgY2FjaGVOYW1lSWQ6IFwicnVudGltZVwiLFxuICAgICAgICAgICAgICAgIHZhbHVlOiBkZXRhaWxzLnJ1bnRpbWVcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChkZXRhaWxzLmdvb2dsZUFuYWx5dGljcz8ubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwiaW52YWxpZC1jYWNoZS1uYW1lXCIsIHtcbiAgICAgICAgICAgICAgICBjYWNoZU5hbWVJZDogXCJnb29nbGVBbmFseXRpY3NcIixcbiAgICAgICAgICAgICAgICB2YWx1ZTogZGV0YWlscy5nb29nbGVBbmFseXRpY3NcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgfVxuICAgIGNhY2hlTmFtZXMkMS51cGRhdGVEZXRhaWxzKGRldGFpbHMpO1xufTtcblxuZXhwb3J0IHsgY2FjaGVOYW1lcywgY2xpZW50c0NsYWltLCBjb3B5UmVzcG9uc2UsIHJlZ2lzdGVyUXVvdGFFcnJvckNhbGxiYWNrLCBzZXRDYWNoZU5hbWVEZXRhaWxzIH07XG4iXSwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/@serwist+core@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/core/dist/index.js\n")); + +/***/ }), + +/***/ "./node_modules/.pnpm/@serwist+next@9.0.0-preview.21_next@14.2.1_typescript@5.4.5_webpack@5.91.0/node_modules/@serwist/next/dist/index.worker.js": +/*!*******************************************************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/@serwist+next@9.0.0-preview.21_next@14.2.1_typescript@5.4.5_webpack@5.91.0/node_modules/@serwist/next/dist/index.worker.js ***! + \*******************************************************************************************************************************************************/ +/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PAGES_CACHE_NAME: function() { return /* binding */ PAGES_CACHE_NAME; },\n/* harmony export */ defaultCache: function() { return /* binding */ defaultCache; }\n/* harmony export */ });\n/* harmony import */ var _serwist_sw_plugins__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @serwist/sw/plugins */ \"./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/index.plugins.js\");\n/* harmony import */ var _serwist_sw_strategies__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @serwist/sw/strategies */ \"./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/index.strategies.js\");\n\n\n\nconst PAGES_CACHE_NAME = {\n rscPrefetch: \"pages-rsc-prefetch\",\n rsc: \"pages-rsc\",\n html: \"pages\"\n};\n\nconst defaultCache = true ? [] : 0;\n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vQHNlcndpc3QrbmV4dEA5LjAuMC1wcmV2aWV3LjIxX25leHRAMTQuMi4xX3R5cGVzY3JpcHRANS40LjVfd2VicGFja0A1LjkxLjAvbm9kZV9tb2R1bGVzL0BzZXJ3aXN0L25leHQvZGlzdC9pbmRleC53b3JrZXIuanMiLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQUE0RTtBQUNZOztBQUV4RjtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBLHFCQUFxQixLQUFxQyxRQUFRLENBbVBqRTs7QUFFeUMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9fTl9FLy4vbm9kZV9tb2R1bGVzLy5wbnBtL0BzZXJ3aXN0K25leHRAOS4wLjAtcHJldmlldy4yMV9uZXh0QDE0LjIuMV90eXBlc2NyaXB0QDUuNC41X3dlYnBhY2tANS45MS4wL25vZGVfbW9kdWxlcy9Ac2Vyd2lzdC9uZXh0L2Rpc3QvaW5kZXgud29ya2VyLmpzPzk4N2MiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgRXhwaXJhdGlvblBsdWdpbiwgUmFuZ2VSZXF1ZXN0c1BsdWdpbiB9IG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hbGlkYXRlKHtcbiAgICAgICAgICAgIGNhY2hlTmFtZTogXCJnb29nbGUtZm9udHMtc3R5bGVzaGVldHNcIixcbiAgICAgICAgICAgIHBsdWdpbnM6IFtcbiAgICAgICAgICAgICAgICBuZXcgRXhwaXJhdGlvblBsdWdpbih7XG4gICAgICAgICAgICAgICAgICAgIG1heEVudHJpZXM6IDQsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZVNlY29uZHM6IDcgKiAyNCAqIDYwICogNjAsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZUZyb206IFwibGFzdC11c2VkXCJcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgXVxuICAgICAgICB9KVxuICAgIH0sXG4gICAge1xuICAgICAgICBtYXRjaGVyOiAvXFwuKD86ZW90fG90Znx0dGN8dHRmfHdvZmZ8d29mZjJ8Zm9udC5jc3MpJC9pLFxuICAgICAgICBoYW5kbGVyOiBuZXcgU3RhbGVXaGlsZVJldmFsaWRhdGUoe1xuICAgICAgICAgICAgY2FjaGVOYW1lOiBcInN0YXRpYy1mb250LWFzc2V0c1wiLFxuICAgICAgICAgICAgcGx1Z2luczogW1xuICAgICAgICAgICAgICAgIG5ldyBFeHBpcmF0aW9uUGx1Z2luKHtcbiAgICAgICAgICAgICAgICAgICAgbWF4RW50cmllczogNCxcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlU2Vjb25kczogNyAqIDI0ICogNjAgKiA2MCxcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlRnJvbTogXCJsYXN0LXVzZWRcIlxuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICBdXG4gICAgICAgIH0pXG4gICAgfSxcbiAgICB7XG4gICAgICAgIG1hdGNoZXI6IC9cXC4oPzpqcGd8anBlZ3xnaWZ8cG5nfHN2Z3xpY298d2VicCkkL2ksXG4gICAgICAgIGhhbmRsZXI6IG5ldyBTdGFsZVdoaWxlUmV2YWxpZGF0ZSh7XG4gICAgICAgICAgICBjYWNoZU5hbWU6IFwic3RhdGljLWltYWdlLWFzc2V0c1wiLFxuICAgICAgICAgICAgcGx1Z2luczogW1xuICAgICAgICAgICAgICAgIG5ldyBFeHBpcmF0aW9uUGx1Z2luKHtcbiAgICAgICAgICAgICAgICAgICAgbWF4RW50cmllczogNjQsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZVNlY29uZHM6IDMwICogMjQgKiA2MCAqIDYwLFxuICAgICAgICAgICAgICAgICAgICBtYXhBZ2VGcm9tOiBcImxhc3QtdXNlZFwiXG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIF1cbiAgICAgICAgfSlcbiAgICB9LFxuICAgIHtcbiAgICAgICAgbWF0Y2hlcjogL1xcL19uZXh0XFwvc3RhdGljLitcXC5qcyQvaSxcbiAgICAgICAgaGFuZGxlcjogbmV3IENhY2hlRmlyc3Qoe1xuICAgICAgICAgICAgY2FjaGVOYW1lOiBcIm5leHQtc3RhdGljLWpzLWFzc2V0c1wiLFxuICAgICAgICAgICAgcGx1Z2luczogW1xuICAgICAgICAgICAgICAgIG5ldyBFeHBpcmF0aW9uUGx1Z2luKHtcbiAgICAgICAgICAgICAgICAgICAgbWF4RW50cmllczogNjQsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZVNlY29uZHM6IDI0ICogNjAgKiA2MCxcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlRnJvbTogXCJsYXN0LXVzZWRcIlxuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICBdXG4gICAgICAgIH0pXG4gICAgfSxcbiAgICB7XG4gICAgICAgIG1hdGNoZXI6IC9cXC9fbmV4dFxcL2ltYWdlXFw/dXJsPS4rJC9pLFxuICAgICAgICBoYW5kbGVyOiBuZXcgU3RhbGVXaGlsZVJldmFsaWRhdGUoe1xuICAgICAgICAgICAgY2FjaGVOYW1lOiBcIm5leHQtaW1hZ2VcIixcbiAgICAgICAgICAgIHBsdWdpbnM6IFtcbiAgICAgICAgICAgICAgICBuZXcgRXhwaXJhdGlvblBsdWdpbih7XG4gICAgICAgICAgICAgICAgICAgIG1heEVudHJpZXM6IDY0LFxuICAgICAgICAgICAgICAgICAgICBtYXhBZ2VTZWNvbmRzOiAyNCAqIDYwICogNjAsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZUZyb206IFwibGFzdC11c2VkXCJcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgXVxuICAgICAgICB9KVxuICAgIH0sXG4gICAge1xuICAgICAgICBtYXRjaGVyOiAvXFwuKD86bXAzfHdhdnxvZ2cpJC9pLFxuICAgICAgICBoYW5kbGVyOiBuZXcgQ2FjaGVGaXJzdCh7XG4gICAgICAgICAgICBjYWNoZU5hbWU6IFwic3RhdGljLWF1ZGlvLWFzc2V0c1wiLFxuICAgICAgICAgICAgcGx1Z2luczogW1xuICAgICAgICAgICAgICAgIG5ldyBFeHBpcmF0aW9uUGx1Z2luKHtcbiAgICAgICAgICAgICAgICAgICAgbWF4RW50cmllczogMzIsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZVNlY29uZHM6IDI0ICogNjAgKiA2MCxcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlRnJvbTogXCJsYXN0LXVzZWRcIlxuICAgICAgICAgICAgICAgIH0pLFxuICAgICAgICAgICAgICAgIG5ldyBSYW5nZVJlcXVlc3RzUGx1Z2luKClcbiAgICAgICAgICAgIF1cbiAgICAgICAgfSlcbiAgICB9LFxuICAgIHtcbiAgICAgICAgbWF0Y2hlcjogL1xcLig/Om1wNHx3ZWJtKSQvaSxcbiAgICAgICAgaGFuZGxlcjogbmV3IENhY2hlRmlyc3Qoe1xuICAgICAgICAgICAgY2FjaGVOYW1lOiBcInN0YXRpYy12aWRlby1hc3NldHNcIixcbiAgICAgICAgICAgIHBsdWdpbnM6IFtcbiAgICAgICAgICAgICAgICBuZXcgRXhwaXJhdGlvblBsdWdpbih7XG4gICAgICAgICAgICAgICAgICAgIG1heEVudHJpZXM6IDMyLFxuICAgICAgICAgICAgICAgICAgICBtYXhBZ2VTZWNvbmRzOiAyNCAqIDYwICogNjAsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZUZyb206IFwibGFzdC11c2VkXCJcbiAgICAgICAgICAgICAgICB9KSxcbiAgICAgICAgICAgICAgICBuZXcgUmFuZ2VSZXF1ZXN0c1BsdWdpbigpXG4gICAgICAgICAgICBdXG4gICAgICAgIH0pXG4gICAgfSxcbiAgICB7XG4gICAgICAgIG1hdGNoZXI6IC9cXC4oPzpqcykkL2ksXG4gICAgICAgIGhhbmRsZXI6IG5ldyBTdGFsZVdoaWxlUmV2YWxpZGF0ZSh7XG4gICAgICAgICAgICBjYWNoZU5hbWU6IFwic3RhdGljLWpzLWFzc2V0c1wiLFxuICAgICAgICAgICAgcGx1Z2luczogW1xuICAgICAgICAgICAgICAgIG5ldyBFeHBpcmF0aW9uUGx1Z2luKHtcbiAgICAgICAgICAgICAgICAgICAgbWF4RW50cmllczogNDgsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZVNlY29uZHM6IDI0ICogNjAgKiA2MCxcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlRnJvbTogXCJsYXN0LXVzZWRcIlxuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICBdXG4gICAgICAgIH0pXG4gICAgfSxcbiAgICB7XG4gICAgICAgIG1hdGNoZXI6IC9cXC4oPzpjc3N8bGVzcykkL2ksXG4gICAgICAgIGhhbmRsZXI6IG5ldyBTdGFsZVdoaWxlUmV2YWxpZGF0ZSh7XG4gICAgICAgICAgICBjYWNoZU5hbWU6IFwic3RhdGljLXN0eWxlLWFzc2V0c1wiLFxuICAgICAgICAgICAgcGx1Z2luczogW1xuICAgICAgICAgICAgICAgIG5ldyBFeHBpcmF0aW9uUGx1Z2luKHtcbiAgICAgICAgICAgICAgICAgICAgbWF4RW50cmllczogMzIsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZVNlY29uZHM6IDI0ICogNjAgKiA2MCxcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlRnJvbTogXCJsYXN0LXVzZWRcIlxuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICBdXG4gICAgICAgIH0pXG4gICAgfSxcbiAgICB7XG4gICAgICAgIG1hdGNoZXI6IC9cXC9fbmV4dFxcL2RhdGFcXC8uK1xcLy4rXFwuanNvbiQvaSxcbiAgICAgICAgaGFuZGxlcjogbmV3IE5ldHdvcmtGaXJzdCh7XG4gICAgICAgICAgICBjYWNoZU5hbWU6IFwibmV4dC1kYXRhXCIsXG4gICAgICAgICAgICBwbHVnaW5zOiBbXG4gICAgICAgICAgICAgICAgbmV3IEV4cGlyYXRpb25QbHVnaW4oe1xuICAgICAgICAgICAgICAgICAgICBtYXhFbnRyaWVzOiAzMixcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlU2Vjb25kczogMjQgKiA2MCAqIDYwLFxuICAgICAgICAgICAgICAgICAgICBtYXhBZ2VGcm9tOiBcImxhc3QtdXNlZFwiXG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIF1cbiAgICAgICAgfSlcbiAgICB9LFxuICAgIHtcbiAgICAgICAgbWF0Y2hlcjogL1xcLig/Ompzb258eG1sfGNzdikkL2ksXG4gICAgICAgIGhhbmRsZXI6IG5ldyBOZXR3b3JrRmlyc3Qoe1xuICAgICAgICAgICAgY2FjaGVOYW1lOiBcInN0YXRpYy1kYXRhLWFzc2V0c1wiLFxuICAgICAgICAgICAgcGx1Z2luczogW1xuICAgICAgICAgICAgICAgIG5ldyBFeHBpcmF0aW9uUGx1Z2luKHtcbiAgICAgICAgICAgICAgICAgICAgbWF4RW50cmllczogMzIsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZVNlY29uZHM6IDI0ICogNjAgKiA2MCxcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlRnJvbTogXCJsYXN0LXVzZWRcIlxuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICBdXG4gICAgICAgIH0pXG4gICAgfSxcbiAgICB7XG4gICAgICAgIG1hdGNoZXI6ICh7IHNhbWVPcmlnaW4sIHVybDogeyBwYXRobmFtZSB9IH0pPT57XG4gICAgICAgICAgICBpZiAoIXNhbWVPcmlnaW4gfHwgcGF0aG5hbWUuc3RhcnRzV2l0aChcIi9hcGkvYXV0aC9jYWxsYmFja1wiKSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChwYXRobmFtZS5zdGFydHNXaXRoKFwiL2FwaS9cIikpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgfSxcbiAgICAgICAgbWV0aG9kOiBcIkdFVFwiLFxuICAgICAgICBoYW5kbGVyOiBuZXcgTmV0d29ya0ZpcnN0KHtcbiAgICAgICAgICAgIGNhY2hlTmFtZTogXCJhcGlzXCIsXG4gICAgICAgICAgICBwbHVnaW5zOiBbXG4gICAgICAgICAgICAgICAgbmV3IEV4cGlyYXRpb25QbHVnaW4oe1xuICAgICAgICAgICAgICAgICAgICBtYXhFbnRyaWVzOiAxNixcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlU2Vjb25kczogMjQgKiA2MCAqIDYwLFxuICAgICAgICAgICAgICAgICAgICBtYXhBZ2VGcm9tOiBcImxhc3QtdXNlZFwiXG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIF0sXG4gICAgICAgICAgICBuZXR3b3JrVGltZW91dFNlY29uZHM6IDEwXG4gICAgICAgIH0pXG4gICAgfSxcbiAgICB7XG4gICAgICAgIG1hdGNoZXI6ICh7IHJlcXVlc3QsIHVybDogeyBwYXRobmFtZSB9LCBzYW1lT3JpZ2luIH0pPT5yZXF1ZXN0LmhlYWRlcnMuZ2V0KFwiUlNDXCIpID09PSBcIjFcIiAmJiByZXF1ZXN0LmhlYWRlcnM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biAgICB9LFxuICAgIHtcbiAgICAgICAgbWF0Y2hlcjogKHsgc2FtZU9yaWdpbiB9KT0+IXNhbWVPcmlnaW4sXG4gICAgICAgIGhhbmRsZXI6IG5ldyBOZXR3b3JrRmlyc3Qoe1xuICAgICAgICAgICAgY2FjaGVOYW1lOiBcImNyb3NzLW9yaWdpblwiLFxuICAgICAgICAgICAgcGx1Z2luczogW1xuICAgICAgICAgICAgICAgIG5ldyBFeHBpcmF0aW9uUGx1Z2luKHtcbiAgICAgICAgICAgICAgICAgICAgbWF4RW50cmllczogMzIsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZVNlY29uZHM6IDYwICogNjBcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgXSxcbiAgICAgICAgICAgIG5ldHdvcmtUaW1lb3V0U2Vjb25kczogMTBcbiAgICAgICAgfSlcbiAgICB9XG5dO1xuXG5leHBvcnQgeyBQQUdFU19DQUNIRV9OQU1FLCBkZWZhdWx0Q2FjaGUgfTtcbiJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/@serwist+next@9.0.0-preview.21_next@14.2.1_typescript@5.4.5_webpack@5.91.0/node_modules/@serwist/next/dist/index.worker.js\n")); + +/***/ }), + +/***/ "./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/NetworkOnly.js": +/*!******************************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/NetworkOnly.js ***! + \******************************************************************************************************************************/ +/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ N: function() { return /* binding */ NetworkOnly; },\n/* harmony export */ a: function() { return /* binding */ NetworkFirst; },\n/* harmony export */ c: function() { return /* binding */ cacheOkAndOpaquePlugin; },\n/* harmony export */ m: function() { return /* binding */ messages; }\n/* harmony export */ });\n/* harmony import */ var _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @serwist/core/internal */ \"./node_modules/.pnpm/@serwist+core@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/core/dist/index.internal.js\");\n/* harmony import */ var _Strategy_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Strategy.js */ \"./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/Strategy.js\");\n\n\n\nconst cacheOkAndOpaquePlugin = {\n cacheWillUpdate: async ({ response })=>{\n if (response.status === 200 || response.status === 0) {\n return response;\n }\n return null;\n }\n};\n\nconst messages = {\n strategyStart: (strategyName, request)=>`Using ${strategyName} to respond to '${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(request.url)}'`,\n printFinalResponse: (response)=>{\n if (response) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupCollapsed(\"View the final response here.\");\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(response || \"[No response returned]\");\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupEnd();\n }\n }\n};\n\nclass NetworkFirst extends _Strategy_js__WEBPACK_IMPORTED_MODULE_1__.S {\n _networkTimeoutSeconds;\n constructor(options = {}){\n super(options);\n if (!this.plugins.some((p)=>\"cacheWillUpdate\" in p)) {\n this.plugins.unshift(cacheOkAndOpaquePlugin);\n }\n this._networkTimeoutSeconds = options.networkTimeoutSeconds || 0;\n if (true) {\n if (this._networkTimeoutSeconds) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isType(this._networkTimeoutSeconds, \"number\", {\n moduleName: \"@serwist/strategies\",\n className: this.constructor.name,\n funcName: \"constructor\",\n paramName: \"networkTimeoutSeconds\"\n });\n }\n }\n }\n async _handle(request, handler) {\n const logs = [];\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isInstance(request, Request, {\n moduleName: \"@serwist/strategies\",\n className: this.constructor.name,\n funcName: \"handle\",\n paramName: \"makeRequest\"\n });\n }\n const promises = [];\n let timeoutId;\n if (this._networkTimeoutSeconds) {\n const { id, promise } = this._getTimeoutPromise({\n request,\n logs,\n handler\n });\n timeoutId = id;\n promises.push(promise);\n }\n const networkPromise = this._getNetworkPromise({\n timeoutId,\n request,\n logs,\n handler\n });\n promises.push(networkPromise);\n const response = await handler.waitUntil((async ()=>{\n return await handler.waitUntil(Promise.race(promises)) || await networkPromise;\n })());\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupCollapsed(messages.strategyStart(this.constructor.name, request));\n for (const log of logs){\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(log);\n }\n messages.printFinalResponse(response);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupEnd();\n }\n if (!response) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"no-response\", {\n url: request.url\n });\n }\n return response;\n }\n _getTimeoutPromise({ request, logs, handler }) {\n let timeoutId;\n const timeoutPromise = new Promise((resolve)=>{\n const onNetworkTimeout = async ()=>{\n if (true) {\n logs.push(`Timing out the network response at ${this._networkTimeoutSeconds} seconds.`);\n }\n resolve(await handler.cacheMatch(request));\n };\n timeoutId = setTimeout(onNetworkTimeout, this._networkTimeoutSeconds * 1000);\n });\n return {\n promise: timeoutPromise,\n id: timeoutId\n };\n }\n async _getNetworkPromise({ timeoutId, request, logs, handler }) {\n let error = undefined;\n let response = undefined;\n try {\n response = await handler.fetchAndCachePut(request);\n } catch (fetchError) {\n if (fetchError instanceof Error) {\n error = fetchError;\n }\n }\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n if (true) {\n if (response) {\n logs.push(\"Got response from network.\");\n } else {\n logs.push(\"Unable to get a response from the network. Will respond \" + \"with a cached response.\");\n }\n }\n if (error || !response) {\n response = await handler.cacheMatch(request);\n if (true) {\n if (response) {\n logs.push(`Found a cached response in the '${this.cacheName}' cache.`);\n } else {\n logs.push(`No response found in the '${this.cacheName}' cache.`);\n }\n }\n }\n return response;\n }\n}\n\nclass NetworkOnly extends _Strategy_js__WEBPACK_IMPORTED_MODULE_1__.S {\n _networkTimeoutSeconds;\n constructor(options = {}){\n super(options);\n this._networkTimeoutSeconds = options.networkTimeoutSeconds || 0;\n }\n async _handle(request, handler) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isInstance(request, Request, {\n moduleName: \"@serwist/strategies\",\n className: this.constructor.name,\n funcName: \"_handle\",\n paramName: \"request\"\n });\n }\n let error = undefined;\n let response;\n try {\n const promises = [\n handler.fetch(request)\n ];\n if (this._networkTimeoutSeconds) {\n const timeoutPromise = (0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.timeout)(this._networkTimeoutSeconds * 1000);\n promises.push(timeoutPromise);\n }\n response = await Promise.race(promises);\n if (!response) {\n throw new Error(`Timed out the network response after ${this._networkTimeoutSeconds} seconds.`);\n }\n } catch (err) {\n if (err instanceof Error) {\n error = err;\n }\n }\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupCollapsed(messages.strategyStart(this.constructor.name, request));\n if (response) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(\"Got response from network.\");\n } else {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(\"Unable to get a response from the network.\");\n }\n messages.printFinalResponse(response);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupEnd();\n }\n if (!response) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"no-response\", {\n url: request.url,\n error\n });\n }\n return response;\n }\n}\n\n\n//# sourceURL=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AgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3Qvc3RyYXRlZ2llc1wiLFxuICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6IHRoaXMuY29uc3RydWN0b3IubmFtZSxcbiAgICAgICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiY29uc3RydWN0b3JcIixcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcIm5ldHdvcmtUaW1lb3V0U2Vjb25kc1wiXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG4gICAgYXN5bmMgX2hhbmRsZShyZXF1ZXN0LCBoYW5kbGVyKSB7XG4gICAgICAgIGNvbnN0IGxvZ3MgPSBbXTtcbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgYXNzZXJ0LmlzSW5zdGFuY2UocmVxdWVzdCwgUmVxdWVzdCwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3Qvc3RyYXRlZ2llc1wiLFxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogdGhpcy5jb25zdHJ1Y3Rvci5uYW1lLFxuICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcImhhbmRsZVwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJtYWtlUmVxdWVzdFwiXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCBwcm9taXNlcyA9IFtdO1xuICAgICAgICBsZXQgdGltZW91dElkO1xuICAgICAgICBpZiAodGhpcy5fbmV0d29ya1RpbWVvdXRTZWNvbmRzKSB7XG4gICAgICAgICAgICBjb25zdCB7IGlkLCBwcm9taXNlIH0gPSB0aGlzLl9nZXRUaW1lb3V0UHJvbWlzZSh7XG4gICAgICAgICAgICAgICAgcmVxdWVzdCxcbiAgICAgICAgICAgICAgICBsb2dzLFxuICAgICAgICAgICAgICAgIGhhbmRsZXJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgdGltZW91dElkID0gaWQ7XG4gICAgICAgICAgICBwcm9taXNlcy5wdXNoKHByb21pc2UpO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IG5ldHdvcmtQcm9taXNlID0gdGhpcy5fZ2V0TmV0d29ya1Byb21pc2Uoe1xuICAgICAgICAgICAgdGltZW91dElkLFxuICAgICAgICAgICAgcmVxdWVzdCxcbiAgICAgICAgICAgIGxvZ3MsXG4gICAgICAgICAgICBoYW5kbGVyXG4gICAgICAgIH0pO1xuICAgICAgICBwcm9taXNlcy5wdXNoKG5ldHdvcmtQcm9taXNlKTtcbiAgICAgICAgY29uc3QgcmVzcG9uc2UgPSBhd2FpdCBoYW5kbGVyLndhaXRVbnRpbCgoYXN5bmMgKCk9PntcbiAgICAgICAgICAgIHJldHVybiBhd2FpdCBoYW5kbGVyLndhaXRVbnRpbChQcm9taXNlLnJhY2UocHJvbWlzZXMpKSB8fCBhd2FpdCBuZXR3b3JrUHJvbWlzZTtcbiAgICAgICAgfSkoKSk7XG4gICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgIGxvZ2dlci5ncm91cENvbGxhcHNlZChtZXNzYWdlcy5zdHJhdGVneVN0YXJ0KHRoaXMuY29uc3RydWN0b3IubmFtZSwgcmVxdWVzdCkpO1xuICAgICAgICAgICAgZm9yIChjb25zdCBsb2cgb2YgbG9ncyl7XG4gICAgICAgICAgICAgICAgbG9nZ2VyLmxvZyhsb2cpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbWVzc2FnZXMucHJpbnRGaW5hbFJlc3BvbnNlKHJlc3BvbnNlKTtcbiAgICAgICAgICAgIGxvZ2dlci5ncm91cEVuZCgpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghcmVzcG9uc2UpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBTZXJ3aXN0RXJyb3IoXCJuby1yZXNwb25zZVwiLCB7XG4gICAgICAgICAgICAgICAgdXJsOiByZXF1ZXN0LnVybFxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlc3BvbnNlO1xuICAgIH1cbiAgICBfZ2V0VGltZW91dFByb21pc2UoeyByZXF1ZXN0LCBsb2dzLCBoYW5kbGVyIH0pIHtcbiAgICAgICAgbGV0IHRpbWVvdXRJZDtcbiAgICAgICAgY29uc3QgdGltZW91dFByb21pc2UgPSBuZXcgUHJvbWlzZSgocmVzb2x2ZSk9PntcbiAgICAgICAgICAgIGNvbnN0IG9uTmV0d29ya1RpbWVvdXQgPSBhc3luYyAoKT0+e1xuICAgICAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgbG9ncy5wdXNoKGBUaW1pbmcgb3V0IHRoZSBuZXR3b3JrIHJlc3BvbnNlIGF0ICR7dGhpcy5fbmV0d29ya1RpbWVvdXRTZWNvbmRzfSBzZWNvbmRzLmApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXNvbHZlKGF3YWl0IGhhbmRsZXIuY2FjaGVNYXRjaChyZXF1ZXN0KSk7XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgdGltZW91dElkID0gc2V0VGltZW91dChvbk5ldHdvcmtUaW1lb3V0LCB0aGlzLl9uZXR3b3JrVGltZW91dFNlY29uZHMgKiAxMDAwKTtcbiAgICAgICAgfSk7XG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICBwcm9taXNlOiB0aW1lb3V0UHJvbWlzZSxcbiAgICAgICAgICAgIGlkOiB0aW1lb3V0SWRcbiAgICAgICAgfTtcbiAgICB9XG4gICAgYXN5bmMgX2dldE5ldHdvcmtQcm9taXNlKHsgdGltZW91dElkLCByZXF1ZXN0LCBsb2dzLCBoYW5kbGVyIH0pIHtcbiAgICAgICAgbGV0IGVycm9yID0gdW5kZWZpbmVkO1xuICAgICAgICBsZXQgcmVzcG9uc2UgPSB1bmRlZmluZWQ7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IGhhbmRsZXIuZmV0Y2hBbmRDYWNoZVB1dChyZXF1ZXN0KTtcbiAgICAgICAgfSBjYXRjaCAoZmV0Y2hFcnJvcikge1xuICAgICAgICAgICAgaWYgKGZldGNoRXJyb3IgaW5zdGFuY2VvZiBFcnJvcikge1xuICAgICAgICAgICAgICAgIGVycm9yID0gZmV0Y2hFcnJvcjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAodGltZW91dElkKSB7XG4gICAgICAgICAgICBjbGVhclRpbWVvdXQodGltZW91dElkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBpZiAocmVzcG9uc2UpIHtcbiAgICAgICAgICAgICAgICBsb2dzLnB1c2goXCJHb3QgcmVzcG9uc2UgZnJvbSBuZXR3b3JrLlwiKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgbG9ncy5wdXNoKFwiVW5hYmxlIHRvIGdldCBhIHJlc3BvbnNlIGZyb20gdGhlIG5ldHdvcmsuIFdpbGwgcmVzcG9uZCBcIiArIFwid2l0aCBhIGNhY2hlZCByZXNwb25zZS5cIik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGVycm9yIHx8ICFyZXNwb25zZSkge1xuICAgICAgICAgICAgcmVzcG9uc2UgPSBhd2FpdCBoYW5kbGVyLmNhY2hlTWF0Y2gocmVxdWVzdCk7XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFw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ICAgICAgICAgcGFyYW1OYW1lOiBcInJlcXVlc3RcIlxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgbGV0IGVycm9yID0gdW5kZWZpbmVkO1xuICAgICAgICBsZXQgcmVzcG9uc2U7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBjb25zdCBwcm9taXNlcyA9IFtcbiAgICAgICAgICAgICAgICBoYW5kbGVyLmZldGNoKHJlcXVlc3QpXG4gICAgICAgICAgICBdO1xuICAgICAgICAgICAgaWYgKHRoaXMuX25ldHdvcmtUaW1lb3V0U2Vjb25kcykge1xuICAgICAgICAgICAgICAgIGNvbnN0IHRpbWVvdXRQcm9taXNlID0gdGltZW91dCh0aGlzLl9uZXR3b3JrVGltZW91dFNlY29uZHMgKiAxMDAwKTtcbiAgICAgICAgICAgICAgICBwcm9taXNlcy5wdXNoKHRpbWVvdXRQcm9taXNlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJlc3BvbnNlID0gYXdhaXQgUHJvbWlzZS5yYWNlKHByb21pc2VzKTtcbiAgICAgICAgICAgIGlmICghcmVzcG9uc2UpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYFRpbWVkIG91dCB0aGUgbmV0d29yayByZXNwb25zZSBhZnRlciAke3RoaXMuX25ldHdvcmtUaW1lb3V0U2Vjb25kc30gc2Vjb25kcy5gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgICBpZiAoZXJyIGluc3RhbmNlb2YgRXJyb3IpIHtcbiAgICAgICAgICAgICAgICBlcnJvciA9IGVycjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBDb2xsYXBzZWQobWVzc2FnZXMuc3RyYXRlZ3lTdGFydCh0aGlzLmNvbnN0cnVjdG9yLm5hbWUsIHJlcXVlc3QpKTtcbiAgICAgICAgICAgIGlmIChyZXNwb25zZSkge1xuICAgICAgICAgICAgICAgIGxvZ2dlci5sb2coXCJHb3QgcmVzcG9uc2UgZnJvbSBuZXR3b3JrLlwiKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgbG9nZ2VyLmxvZyhcIlVuYWJsZSB0byBnZXQgYSByZXNwb25zZSBmcm9tIHRoZSBuZXR3b3JrLlwiKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG1lc3NhZ2VzLnByaW50RmluYWxSZXNwb25zZShyZXNwb25zZSk7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBFbmQoKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIXJlc3BvbnNlKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwibm8tcmVzcG9uc2VcIiwge1xuICAgICAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXG4gICAgICAgICAgICAgICAgZXJyb3JcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXNwb25zZTtcbiAgICB9XG59XG5cbmV4cG9ydCB7IE5ldHdvcmtPbmx5IGFzIE4sIE5ldHdvcmtGaXJzdCBhcyBhLCBjYWNoZU9rQW5kT3BhcXVlUGx1Z2luIGFzIGMsIG1lc3NhZ2VzIGFzIG0gfTtcbiJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/NetworkOnly.js\n")); + +/***/ }), + +/***/ "./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/PrecacheFallbackPlugin.js": +/*!*****************************************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/PrecacheFallbackPlugin.js ***! + \*****************************************************************************************************************************************/ +/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ B: function() { return /* binding */ BackgroundSyncPlugin; },\n/* harmony export */ P: function() { return /* binding */ PrecacheFallbackPlugin; },\n/* harmony export */ Q: function() { return /* binding */ Queue; },\n/* harmony export */ S: function() { return /* binding */ StorableRequest; },\n/* harmony export */ a: function() { return /* binding */ QueueStore; },\n/* harmony export */ i: function() { return /* binding */ initialize; }\n/* harmony export */ });\n/* harmony import */ var _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @serwist/core/internal */ \"./node_modules/.pnpm/@serwist+core@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/core/dist/index.internal.js\");\n/* harmony import */ var _singletonRouter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./singletonRouter.js */ \"./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/singletonRouter.js\");\n/* harmony import */ var _NetworkOnly_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./NetworkOnly.js */ \"./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/NetworkOnly.js\");\n/* harmony import */ var idb__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! idb */ \"./node_modules/.pnpm/idb@8.0.0/node_modules/idb/build/index.js\");\n/* harmony import */ var _singletonPrecacheController_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./singletonPrecacheController.js */ \"./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/singletonPrecacheController.js\");\n\n\n\n\n\n\nconst DB_VERSION = 3;\nconst DB_NAME = \"serwist-background-sync\";\nconst REQUEST_OBJECT_STORE_NAME = \"requests\";\nconst QUEUE_NAME_INDEX = \"queueName\";\nclass QueueDb {\n _db = null;\n async addEntry(entry) {\n const db = await this.getDb();\n const tx = db.transaction(REQUEST_OBJECT_STORE_NAME, \"readwrite\", {\n durability: \"relaxed\"\n });\n await tx.store.add(entry);\n await tx.done;\n }\n async getFirstEntryId() {\n const db = await this.getDb();\n const cursor = await db.transaction(REQUEST_OBJECT_STORE_NAME).store.openCursor();\n return cursor?.value.id;\n }\n async getAllEntriesByQueueName(queueName) {\n const db = await this.getDb();\n const results = await db.getAllFromIndex(REQUEST_OBJECT_STORE_NAME, QUEUE_NAME_INDEX, IDBKeyRange.only(queueName));\n return results ? results : new Array();\n }\n async getEntryCountByQueueName(queueName) {\n const db = await this.getDb();\n return db.countFromIndex(REQUEST_OBJECT_STORE_NAME, QUEUE_NAME_INDEX, IDBKeyRange.only(queueName));\n }\n async deleteEntry(id) {\n const db = await this.getDb();\n await db.delete(REQUEST_OBJECT_STORE_NAME, id);\n }\n async getFirstEntryByQueueName(queueName) {\n return await this.getEndEntryFromIndex(IDBKeyRange.only(queueName), \"next\");\n }\n async getLastEntryByQueueName(queueName) {\n return await this.getEndEntryFromIndex(IDBKeyRange.only(queueName), \"prev\");\n }\n async getEndEntryFromIndex(query, direction) {\n const db = await this.getDb();\n const cursor = await db.transaction(REQUEST_OBJECT_STORE_NAME).store.index(QUEUE_NAME_INDEX).openCursor(query, direction);\n return cursor?.value;\n }\n async getDb() {\n if (!this._db) {\n this._db = await (0,idb__WEBPACK_IMPORTED_MODULE_3__.openDB)(DB_NAME, DB_VERSION, {\n upgrade: this._upgradeDb\n });\n }\n return this._db;\n }\n _upgradeDb(db, oldVersion) {\n if (oldVersion > 0 && oldVersion < DB_VERSION) {\n if (db.objectStoreNames.contains(REQUEST_OBJECT_STORE_NAME)) {\n db.deleteObjectStore(REQUEST_OBJECT_STORE_NAME);\n }\n }\n const objStore = db.createObjectStore(REQUEST_OBJECT_STORE_NAME, {\n autoIncrement: true,\n keyPath: \"id\"\n });\n objStore.createIndex(QUEUE_NAME_INDEX, QUEUE_NAME_INDEX, {\n unique: false\n });\n }\n}\n\nclass QueueStore {\n _queueName;\n _queueDb;\n constructor(queueName){\n this._queueName = queueName;\n this._queueDb = new QueueDb();\n }\n async pushEntry(entry) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isType(entry, \"object\", {\n moduleName: \"@serwist/sw/plugins\",\n className: \"BackgroundSyncQueueStore\",\n funcName: \"pushEntry\",\n paramName: \"entry\"\n });\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isType(entry.requestData, \"object\", {\n moduleName: \"@serwist/sw/plugins\",\n className: \"BackgroundSyncQueueStore\",\n funcName: \"pushEntry\",\n paramName: \"entry.requestData\"\n });\n }\n delete entry.id;\n entry.queueName = this._queueName;\n await this._queueDb.addEntry(entry);\n }\n async unshiftEntry(entry) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isType(entry, \"object\", {\n moduleName: \"@serwist/sw/plugins\",\n className: \"BackgroundSyncQueueStore\",\n funcName: \"unshiftEntry\",\n paramName: \"entry\"\n });\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isType(entry.requestData, \"object\", {\n moduleName: \"@serwist/sw/plugins\",\n className: \"BackgroundSyncQueueStore\",\n funcName: \"unshiftEntry\",\n paramName: \"entry.requestData\"\n });\n }\n const firstId = await this._queueDb.getFirstEntryId();\n if (firstId) {\n entry.id = firstId - 1;\n } else {\n delete entry.id;\n }\n entry.queueName = this._queueName;\n await this._queueDb.addEntry(entry);\n }\n async popEntry() {\n return this._removeEntry(await this._queueDb.getLastEntryByQueueName(this._queueName));\n }\n async shiftEntry() {\n return this._removeEntry(await this._queueDb.getFirstEntryByQueueName(this._queueName));\n }\n async getAll() {\n return await this._queueDb.getAllEntriesByQueueName(this._queueName);\n }\n async size() {\n return await this._queueDb.getEntryCountByQueueName(this._queueName);\n }\n async deleteEntry(id) {\n await this._queueDb.deleteEntry(id);\n }\n async _removeEntry(entry) {\n if (entry) {\n await this.deleteEntry(entry.id);\n }\n return entry;\n }\n}\n\nconst serializableProperties = [\n \"method\",\n \"referrer\",\n \"referrerPolicy\",\n \"mode\",\n \"credentials\",\n \"cache\",\n \"redirect\",\n \"integrity\",\n \"keepalive\"\n];\nclass StorableRequest {\n _requestData;\n static async fromRequest(request) {\n const requestData = {\n url: request.url,\n headers: {}\n };\n if (request.method !== \"GET\") {\n requestData.body = await request.clone().arrayBuffer();\n }\n request.headers.forEach((value, key)=>{\n requestData.headers[key] = value;\n });\n for (const prop of serializableProperties){\n if (request[prop] !== undefined) {\n requestData[prop] = request[prop];\n }\n }\n return new StorableRequest(requestData);\n }\n constructor(requestData){\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isType(requestData, \"object\", {\n moduleName: \"@serwist/sw/plugins\",\n className: \"StorableRequest\",\n funcName: \"constructor\",\n paramName: \"requestData\"\n });\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isType(requestData.url, \"string\", {\n moduleName: \"@serwist/sw/plugins\",\n className: \"StorableRequest\",\n funcName: \"constructor\",\n paramName: \"requestData.url\"\n });\n }\n if (requestData.mode === \"navigate\") {\n requestData.mode = \"same-origin\";\n }\n this._requestData = requestData;\n }\n toObject() {\n const requestData = Object.assign({}, this._requestData);\n requestData.headers = Object.assign({}, this._requestData.headers);\n if (requestData.body) {\n requestData.body = requestData.body.slice(0);\n }\n return requestData;\n }\n toRequest() {\n return new Request(this._requestData.url, this._requestData);\n }\n clone() {\n return new StorableRequest(this.toObject());\n }\n}\n\nconst TAG_PREFIX = \"serwist-background-sync\";\nconst MAX_RETENTION_TIME$1 = 60 * 24 * 7;\nconst queueNames = new Set();\nconst convertEntry = (queueStoreEntry)=>{\n const queueEntry = {\n request: new StorableRequest(queueStoreEntry.requestData).toRequest(),\n timestamp: queueStoreEntry.timestamp\n };\n if (queueStoreEntry.metadata) {\n queueEntry.metadata = queueStoreEntry.metadata;\n }\n return queueEntry;\n};\nclass Queue {\n _name;\n _onSync;\n _maxRetentionTime;\n _queueStore;\n _forceSyncFallback;\n _syncInProgress = false;\n _requestsAddedDuringSync = false;\n constructor(name, { forceSyncFallback, onSync, maxRetentionTime } = {}){\n if (queueNames.has(name)) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"duplicate-queue-name\", {\n name\n });\n }\n queueNames.add(name);\n this._name = name;\n this._onSync = onSync || this.replayRequests;\n this._maxRetentionTime = maxRetentionTime || MAX_RETENTION_TIME$1;\n this._forceSyncFallback = Boolean(forceSyncFallback);\n this._queueStore = new QueueStore(this._name);\n this._addSyncListener();\n }\n get name() {\n return this._name;\n }\n async pushRequest(entry) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isType(entry, \"object\", {\n moduleName: \"@serwist/sw/plugins\",\n className: \"BackgroundSyncQueue\",\n funcName: \"pushRequest\",\n paramName: \"entry\"\n });\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isInstance(entry.request, Request, {\n moduleName: \"@serwist/sw/plugins\",\n className: \"BackgroundSyncQueue\",\n funcName: \"pushRequest\",\n paramName: \"entry.request\"\n });\n }\n await this._addRequest(entry, \"push\");\n }\n async unshiftRequest(entry) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isType(entry, \"object\", {\n moduleName: \"@serwist/sw/plugins\",\n className: \"BackgroundSyncQueue\",\n funcName: \"unshiftRequest\",\n paramName: \"entry\"\n });\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isInstance(entry.request, Request, {\n moduleName: \"@serwist/sw/plugins\",\n className: \"BackgroundSyncQueue\",\n funcName: \"unshiftRequest\",\n paramName: \"entry.request\"\n });\n }\n await this._addRequest(entry, \"unshift\");\n }\n async popRequest() {\n return this._removeRequest(\"pop\");\n }\n async shiftRequest() {\n return this._removeRequest(\"shift\");\n }\n async getAll() {\n const allEntries = await this._queueStore.getAll();\n const now = Date.now();\n const unexpiredEntries = [];\n for (const entry of allEntries){\n const maxRetentionTimeInMs = this._maxRetentionTime * 60 * 1000;\n if (now - entry.timestamp > maxRetentionTimeInMs) {\n await this._queueStore.deleteEntry(entry.id);\n } else {\n unexpiredEntries.push(convertEntry(entry));\n }\n }\n return unexpiredEntries;\n }\n async size() {\n return await this._queueStore.size();\n }\n async _addRequest({ request, metadata, timestamp = Date.now() }, operation) {\n const storableRequest = await StorableRequest.fromRequest(request.clone());\n const entry = {\n requestData: storableRequest.toObject(),\n timestamp\n };\n if (metadata) {\n entry.metadata = metadata;\n }\n switch(operation){\n case \"push\":\n await this._queueStore.pushEntry(entry);\n break;\n case \"unshift\":\n await this._queueStore.unshiftEntry(entry);\n break;\n }\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(`Request for '${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(request.url)}' has ` + `been added to background sync queue '${this._name}'.`);\n }\n if (this._syncInProgress) {\n this._requestsAddedDuringSync = true;\n } else {\n await this.registerSync();\n }\n }\n async _removeRequest(operation) {\n const now = Date.now();\n let entry;\n switch(operation){\n case \"pop\":\n entry = await this._queueStore.popEntry();\n break;\n case \"shift\":\n entry = await this._queueStore.shiftEntry();\n break;\n }\n if (entry) {\n const maxRetentionTimeInMs = this._maxRetentionTime * 60 * 1000;\n if (now - entry.timestamp > maxRetentionTimeInMs) {\n return this._removeRequest(operation);\n }\n return convertEntry(entry);\n }\n return undefined;\n }\n async replayRequests() {\n let entry = undefined;\n while(entry = await this.shiftRequest()){\n try {\n await fetch(entry.request.clone());\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(`Request for '${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(entry.request.url)}' ` + `has been replayed in queue '${this._name}'`);\n }\n } catch (error) {\n await this.unshiftRequest(entry);\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(`Request for '${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(entry.request.url)}' ` + `failed to replay, putting it back in queue '${this._name}'`);\n }\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"queue-replay-failed\", {\n name: this._name\n });\n }\n }\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(`All requests in queue '${this.name}' have successfully replayed; the queue is now empty!`);\n }\n }\n async registerSync() {\n if (\"sync\" in self.registration && !this._forceSyncFallback) {\n try {\n await self.registration.sync.register(`${TAG_PREFIX}:${this._name}`);\n } catch (err) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.warn(`Unable to register sync event for '${this._name}'.`, err);\n }\n }\n }\n }\n _addSyncListener() {\n if (\"sync\" in self.registration && !this._forceSyncFallback) {\n self.addEventListener(\"sync\", (event)=>{\n if (event.tag === `${TAG_PREFIX}:${this._name}`) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(`Background sync for tag '${event.tag}' has been received`);\n }\n const syncComplete = async ()=>{\n this._syncInProgress = true;\n let syncError = undefined;\n try {\n await this._onSync({\n queue: this\n });\n } catch (error) {\n if (error instanceof Error) {\n syncError = error;\n throw syncError;\n }\n } finally{\n if (this._requestsAddedDuringSync && !(syncError && !event.lastChance)) {\n await this.registerSync();\n }\n this._syncInProgress = false;\n this._requestsAddedDuringSync = false;\n }\n };\n event.waitUntil(syncComplete());\n }\n });\n } else {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(\"Background sync replaying without background sync event\");\n }\n void this._onSync({\n queue: this\n });\n }\n }\n static get _queueNames() {\n return queueNames;\n }\n}\n\nclass BackgroundSyncPlugin {\n _queue;\n constructor(name, options){\n this._queue = new Queue(name, options);\n }\n async fetchDidFail({ request }) {\n await this._queue.pushRequest({\n request\n });\n }\n}\n\nconst QUEUE_NAME = \"serwist-google-analytics\";\nconst MAX_RETENTION_TIME = 60 * 48;\nconst GOOGLE_ANALYTICS_HOST = \"www.google-analytics.com\";\nconst GTM_HOST = \"www.googletagmanager.com\";\nconst ANALYTICS_JS_PATH = \"/analytics.js\";\nconst GTAG_JS_PATH = \"/gtag/js\";\nconst GTM_JS_PATH = \"/gtm.js\";\nconst COLLECT_PATHS_REGEX = /^\\/(\\w+\\/)?collect/;\n\nconst createOnSyncCallback = (config)=>{\n return async ({ queue })=>{\n let entry = undefined;\n while(entry = await queue.shiftRequest()){\n const { request, timestamp } = entry;\n const url = new URL(request.url);\n try {\n const params = request.method === \"POST\" ? new URLSearchParams(await request.clone().text()) : url.searchParams;\n const originalHitTime = timestamp - (Number(params.get(\"qt\")) || 0);\n const queueTime = Date.now() - originalHitTime;\n params.set(\"qt\", String(queueTime));\n if (config.parameterOverrides) {\n for (const param of Object.keys(config.parameterOverrides)){\n const value = config.parameterOverrides[param];\n params.set(param, value);\n }\n }\n if (typeof config.hitFilter === \"function\") {\n config.hitFilter.call(null, params);\n }\n await fetch(new Request(url.origin + url.pathname, {\n body: params.toString(),\n method: \"POST\",\n mode: \"cors\",\n credentials: \"omit\",\n headers: {\n \"Content-Type\": \"text/plain\"\n }\n }));\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(`Request for '${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(url.href)}' has been replayed`);\n }\n } catch (err) {\n await queue.unshiftRequest(entry);\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(`Request for '${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(url.href)}' failed to replay, putting it back in the queue.`);\n }\n throw err;\n }\n }\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(\"All Google Analytics request successfully replayed; \" + \"the queue is now empty!\");\n }\n };\n};\nconst createCollectRoutes = (bgSyncPlugin)=>{\n const match = ({ url })=>url.hostname === GOOGLE_ANALYTICS_HOST && COLLECT_PATHS_REGEX.test(url.pathname);\n const handler = new _NetworkOnly_js__WEBPACK_IMPORTED_MODULE_2__.N({\n plugins: [\n bgSyncPlugin\n ]\n });\n return [\n new _singletonRouter_js__WEBPACK_IMPORTED_MODULE_1__.R(match, handler, \"GET\"),\n new _singletonRouter_js__WEBPACK_IMPORTED_MODULE_1__.R(match, handler, \"POST\")\n ];\n};\nconst createAnalyticsJsRoute = (cacheName)=>{\n const match = ({ url })=>url.hostname === GOOGLE_ANALYTICS_HOST && url.pathname === ANALYTICS_JS_PATH;\n const handler = new _NetworkOnly_js__WEBPACK_IMPORTED_MODULE_2__.a({\n cacheName\n });\n return new _singletonRouter_js__WEBPACK_IMPORTED_MODULE_1__.R(match, handler, \"GET\");\n};\nconst createGtagJsRoute = (cacheName)=>{\n const match = ({ url })=>url.hostname === GTM_HOST && url.pathname === GTAG_JS_PATH;\n const handler = new _NetworkOnly_js__WEBPACK_IMPORTED_MODULE_2__.a({\n cacheName\n });\n return new _singletonRouter_js__WEBPACK_IMPORTED_MODULE_1__.R(match, handler, \"GET\");\n};\nconst createGtmJsRoute = (cacheName)=>{\n const match = ({ url })=>url.hostname === GTM_HOST && url.pathname === GTM_JS_PATH;\n const handler = new _NetworkOnly_js__WEBPACK_IMPORTED_MODULE_2__.a({\n cacheName\n });\n return new _singletonRouter_js__WEBPACK_IMPORTED_MODULE_1__.R(match, handler, \"GET\");\n};\nconst initialize = ({ cacheName, router = (0,_singletonRouter_js__WEBPACK_IMPORTED_MODULE_1__.g)(), ...options } = {})=>{\n const resolvedCacheName = _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.privateCacheNames.getGoogleAnalyticsName(cacheName);\n const bgSyncPlugin = new BackgroundSyncPlugin(QUEUE_NAME, {\n maxRetentionTime: MAX_RETENTION_TIME,\n onSync: createOnSyncCallback(options)\n });\n const routes = [\n createGtmJsRoute(resolvedCacheName),\n createAnalyticsJsRoute(resolvedCacheName),\n createGtagJsRoute(resolvedCacheName),\n ...createCollectRoutes(bgSyncPlugin)\n ];\n for (const route of routes){\n router.registerRoute(route);\n }\n};\n\nclass PrecacheFallbackPlugin {\n _fallbackUrls;\n _precacheController;\n constructor({ fallbackUrls, precacheController }){\n this._fallbackUrls = fallbackUrls;\n this._precacheController = precacheController || (0,_singletonPrecacheController_js__WEBPACK_IMPORTED_MODULE_4__.g)();\n }\n async handlerDidError(param) {\n for (const fallback of this._fallbackUrls){\n if (typeof fallback === \"string\") {\n const fallbackResponse = await this._precacheController.matchPrecache(fallback);\n if (fallbackResponse !== undefined) {\n return fallbackResponse;\n }\n } else if (fallback.matcher(param)) {\n const fallbackResponse = await this._precacheController.matchPrecache(fallback.url);\n if (fallbackResponse !== undefined) {\n return fallbackResponse;\n }\n }\n }\n return undefined;\n }\n}\n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vQHNlcndpc3Qrc3dAOS4wLjAtcHJldmlldy4yMV90eXBlc2NyaXB0QDUuNC41L25vZGVfbW9kdWxlcy9Ac2Vyd2lzdC9zdy9kaXN0L2NodW5rcy9QcmVjYWNoZUZhbGxiYWNrUGx1Z2luLmpzIiwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7O0FBQXlHO0FBQzlCO0FBQ0o7QUFDMUM7QUFDMEQ7O0FBRXZGO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsU0FBUztBQUNUO0FBQ0E7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ICAgfVxuICAgIH1cbiAgICBhc3luYyBfcmVtb3ZlUmVxdWVzdChvcGVyYXRpb24pIHtcbiAgICAgICAgY29uc3Qgbm93ID0gRGF0ZS5ub3coKTtcbiAgICAgICAgbGV0IGVudHJ5O1xuICAgICAgICBzd2l0Y2gob3BlcmF0aW9uKXtcbiAgICAgICAgICAgIGNhc2UgXCJwb3BcIjpcbiAgICAgICAgICAgICAgICBlbnRyeSA9IGF3YWl0IHRoaXMuX3F1ZXVlU3RvcmUucG9wRW50cnkoKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgXCJzaGlmdFwiOlxuICAgICAgICAgICAgICAgIGVudHJ5ID0gYXdhaXQgdGhpcy5fcXVldWVTdG9yZS5zaGlmdEVudHJ5KCk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGVudHJ5KSB7XG4gICAgICAgICAgICBjb25zdCBtYXhSZXRlbnRpb25UaW1lSW5NcyA9IHRoaXMuX21heFJldGVudGlvblRpbWUgKiA2MCAqIDEwMDA7XG4gICAgICAgICAgICBpZiAobm93IC0gZW50cnkudGltZXN0YW1wID4gbWF4UmV0ZW50aW9uVGltZUluTXMpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fcmVtb3ZlUmVxdWVzdChvcGVyYXRpb24pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIGNvbnZlcnRFbnRyeShlbnRyeSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHVuZGVmaW5lZDtcbiAgICB9XG4gICAgYXN5bmMgcmVwbGF5UmVxdWVzdHMoKSB7XG4gICAgICAgIGxldCBlbnRyeSA9IHVuZGVmaW5lZDtcbiAgICAgICAgd2hpbGUoZW50cnkgPSBhd2FpdCB0aGlzLnNoaWZ0UmVxdWVzdCgpKXtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgYXdhaXQgZ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Z3JvdW5kIHN5bmMgZm9yIHRhZyAnJHtldmVudC50YWd9JyBoYXMgYmVlbiByZWNlaXZlZGApO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHN5bmNDb21wbGV0ZSA9IGFzeW5jICgpPT57XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9zeW5jSW5Qcm9ncmVzcyA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgc3luY0Vycm9yID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCB0aGlzLl9vblN5bmMoe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBxdWV1ZTogdGhpc1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXJyb3IgaW5zdGFuY2VvZiBFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzeW5jRXJyb3IgPSBlcnJvcjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgc3luY0Vycm9yO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseXtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5fcmVxdWVzdHNBZGRlZER1cmluZ1N5bmMgJiYgIShzeW5jRXJyb3IgJiYgIWV2ZW50Lmxhc3RDaGFuY2UpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IHRoaXMucmVnaXN0ZXJTeW5jKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3N5bmNJblByb2dyZXNzID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fcmVxdWVzdHNBZGRlZER1cmluZ1N5bmMgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAgICAgZXZlbnQud2FpdFVudGlsKHN5bmNDb21wbGV0ZSgpKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICBsb2dnZXIubG9nKFwiQmFja2dyb3VuZCBzeW5jIHJlcGxheWluZyB3aXRob3V0IGJhY2tncm91bmQgc3luYyBldmVudFwiKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZvaWQgdGhpcy5fb25TeW5jKHtcbiAgICAgICAgICAgICAgICBxdWV1ZTogdGhpc1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgc3RhdGljIGdldCBfcXVldWVOYW1lcygpIHtcbiAgICAgICAgcmV0dXJuIHF1ZXVlTmFtZXM7XG4gICAgfVxufVxuXG5jbGFzcyBCYWNrZ3JvdW5kU3luY1BsdWdpbiB7XG4gICAgX3F1ZXVlO1xuICAgIGNvbnN0cnVjdG9yKG5hbWUsIG9wdGlvbnMpe1xuICAgICAgICB0aGlzLl9xdWV1ZSA9IG5ldyBRdWV1ZShuYW1lLCBvcHRpb25zKTtcbiAgICB9XG4gICAgYXN5bmMgZmV0Y2hEaWRGYWlsKHsgcmVxdWVzdCB9KSB7XG4gICAgICAgIGF3YWl0IHRoaXMuX3F1ZXVlLnB1c2hSZXF1ZXN0KHtcbiAgICAgICAgICAgIHJlcXVlc3RcbiAgICAgICAgfSk7XG4gICAgfVxufVxuXG5jb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gPSB0aW1lc3RhbXAgLSAoTnVtYmVyKHBhcmFtcy5nZXQoXCJxdFwiKSkgfHwgMCk7XG4gICAgICAgICAgICAgICAgY29uc3QgcXVldWVUaW1lID0gRGF0ZS5ub3coKSAtIG9yaWdpbmFsSGl0VGltZTtcbiAgICAgICAgICAgICAgICBwYXJhbXMuc2V0KFwicXRcIiwgU3RyaW5nKHF1ZXVlVGltZSkpO1xuICAgICAgICAgICAgICAgIGlmIChjb25maWcucGFyYW1ldGVyT3ZlcnJpZGVzKSB7XG4gICAgICAgICAgICAgICAgICAgIGZvciAoY29uc3QgcGFyYW0gb2YgT2JqZWN0LmtleXMoY29uZmlnLnBhcmFtZXRlck92ZXJyaWRlcykpe1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdmFsdWUgPSBjb25maWcucGFyYW1ldGVyT3ZlcnJpZGVzW3BhcmFtXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5zZXQocGFyYW0sIHZhbHVlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAodHlwZW9mIGNvbmZpZy5oaXRGaWx0ZXIgPT09IFwiZnVuY3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICBjb25maWcuaGl0RmlsdGVyLmNhbGwobnVsbCwgcGFyYW1zKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYXdhaXQgZmV0Y2gobmV3IFJlcXVlc3QodXJsLm9yaWdpbiArIHVybC5wYXRobmFtZSwge1xuICAgICAgICAgICAgICAgICAgICBib2R5OiBwYXJhbXMudG9TdHJpbmcoKSxcbiAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiBcIlBPU1RcIixcbiAgICAgICAgICAgICAgICAgICAgbW9kZTogXCJjb3JzXCIsXG4gICAgICAgICAgICAgICAgICAgIGNyZWRlbnRpYWxzOiBcIm9taXRcIixcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJDb250ZW50LVR5cGVcIjogXCJ0ZXh0L3BsYWluXCJcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ2dlci5sb2coYFJlcXVlc3QgZm9yICcke2dldEZyaWVuZGx5VVJMKHVybC5ocmVmKX0nIGhhcyBiZWVuIHJlcGxheWVkYCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgICAgICAgYXdhaXQgcXVldWUudW5zaGlmdFJlcXVlc3QoZW50cnkpO1xuICAgICAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmxvZyhgUmVxdWVzdCBmb3IgJyR7Z2V0RnJpZW5kbHlVUkwodXJsLmhyZWYpfScgZmFpbGVkIHRvIHJlcGxheSwgcHV0dGluZyBpdCBiYWNrIGluIHRoZSBxdWV1ZS5gKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdGhyb3cgZXJyO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgIGxvZ2dlci5sb2coXCJBbGwgR29vZ2xlIEFuYWx5dGljcyByZXF1ZXN0IHN1Y2Nlc3NmdWxseSByZXBsYXllZDsgXCIgKyBcInRoZSBxdWV1ZSBpcyBub3cgZW1wdHkhXCIpO1xuICAgICAgICB9XG4gICAgfTtcbn07XG5jb25zdCBjcmVhdGVDb2xsZWN0Um91dG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ICAgICAgIGNvbnN0IGZhbGxiYWNrUmVzcG9uc2UgPSBhd2FpdCB0aGlzLl9wcmVjYWNoZUNvbnRyb2xsZXIubWF0Y2hQcmVjYWNoZShmYWxsYmFjay51cmwpO1xuICAgICAgICAgICAgICAgIGlmIChmYWxsYmFja1Jlc3BvbnNlICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbGxiYWNrUmVzcG9uc2U7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiB1bmRlZmluZWQ7XG4gICAgfVxufVxuXG5leHBvcnQgeyBCYWNrZ3JvdW5kU3luY1BsdWdpbiBhcyBCLCBQcmVjYWNoZUZhbGxiYWNrUGx1Z2luIGFzIFAsIFF1ZXVlIGFzIFEsIFN0b3JhYmxlUmVxdWVzdCBhcyBTLCBRdWV1ZVN0b3JlIGFzIGEsIGluaXRpYWxpemUgYXMgaSB9O1xuIl0sIm5hbWVzIjpbXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/PrecacheFallbackPlugin.js\n")); + +/***/ }), + +/***/ "./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/Strategy.js": +/*!***************************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/Strategy.js ***! + \***************************************************************************************************************************/ +/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ S: function() { return /* binding */ Strategy; },\n/* harmony export */ a: function() { return /* binding */ StrategyHandler; }\n/* harmony export */ });\n/* harmony import */ var _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @serwist/core/internal */ \"./node_modules/.pnpm/@serwist+core@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/core/dist/index.internal.js\");\n\n\nfunction toRequest(input) {\n return typeof input === \"string\" ? new Request(input) : input;\n}\nclass StrategyHandler {\n event;\n request;\n url;\n params;\n _cacheKeys = {};\n _strategy;\n _handlerDeferred;\n _extendLifetimePromises;\n _plugins;\n _pluginStateMap;\n constructor(strategy, options){\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isInstance(options.event, ExtendableEvent, {\n moduleName: \"@serwist/strategies\",\n className: \"StrategyHandler\",\n funcName: \"constructor\",\n paramName: \"options.event\"\n });\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isInstance(options.request, Request, {\n moduleName: \"@serwist/strategies\",\n className: \"StrategyHandler\",\n funcName: \"constructor\",\n paramName: \"options.request\"\n });\n }\n this.event = options.event;\n this.request = options.request;\n if (options.url) {\n this.url = options.url;\n this.params = options.params;\n }\n this._strategy = strategy;\n this._handlerDeferred = new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.Deferred();\n this._extendLifetimePromises = [];\n this._plugins = [\n ...strategy.plugins\n ];\n this._pluginStateMap = new Map();\n for (const plugin of this._plugins){\n this._pluginStateMap.set(plugin, {});\n }\n this.event.waitUntil(this._handlerDeferred.promise);\n }\n async fetch(input) {\n const { event } = this;\n let request = toRequest(input);\n if (request.mode === \"navigate\" && event instanceof FetchEvent && event.preloadResponse) {\n const possiblePreloadResponse = await event.preloadResponse;\n if (possiblePreloadResponse) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(`Using a preloaded navigation response for '${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(request.url)}'`);\n }\n return possiblePreloadResponse;\n }\n }\n const originalRequest = this.hasCallback(\"fetchDidFail\") ? request.clone() : null;\n try {\n for (const cb of this.iterateCallbacks(\"requestWillFetch\")){\n request = await cb({\n request: request.clone(),\n event\n });\n }\n } catch (err) {\n if (err instanceof Error) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"plugin-error-request-will-fetch\", {\n thrownErrorMessage: err.message\n });\n }\n }\n const pluginFilteredRequest = request.clone();\n try {\n let fetchResponse;\n fetchResponse = await fetch(request, request.mode === \"navigate\" ? undefined : this._strategy.fetchOptions);\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.debug(`Network request for '${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(request.url)}' returned a response with status '${fetchResponse.status}'.`);\n }\n for (const callback of this.iterateCallbacks(\"fetchDidSucceed\")){\n fetchResponse = await callback({\n event,\n request: pluginFilteredRequest,\n response: fetchResponse\n });\n }\n return fetchResponse;\n } catch (error) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(`Network request for '${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(request.url)}' threw an error.`, error);\n }\n if (originalRequest) {\n await this.runCallbacks(\"fetchDidFail\", {\n error: error,\n event,\n originalRequest: originalRequest.clone(),\n request: pluginFilteredRequest.clone()\n });\n }\n throw error;\n }\n }\n async fetchAndCachePut(input) {\n const response = await this.fetch(input);\n const responseClone = response.clone();\n void this.waitUntil(this.cachePut(input, responseClone));\n return response;\n }\n async cacheMatch(key) {\n const request = toRequest(key);\n let cachedResponse;\n const { cacheName, matchOptions } = this._strategy;\n const effectiveRequest = await this.getCacheKey(request, \"read\");\n const multiMatchOptions = {\n ...matchOptions,\n ...{\n cacheName\n }\n };\n cachedResponse = await caches.match(effectiveRequest, multiMatchOptions);\n if (true) {\n if (cachedResponse) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.debug(`Found a cached response in '${cacheName}'.`);\n } else {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.debug(`No cached response found in '${cacheName}'.`);\n }\n }\n for (const callback of this.iterateCallbacks(\"cachedResponseWillBeUsed\")){\n cachedResponse = await callback({\n cacheName,\n matchOptions,\n cachedResponse,\n request: effectiveRequest,\n event: this.event\n }) || undefined;\n }\n return cachedResponse;\n }\n async cachePut(key, response) {\n const request = toRequest(key);\n await (0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.timeout)(0);\n const effectiveRequest = await this.getCacheKey(request, \"write\");\n if (true) {\n if (effectiveRequest.method && effectiveRequest.method !== \"GET\") {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"attempt-to-cache-non-get-request\", {\n url: (0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(effectiveRequest.url),\n method: effectiveRequest.method\n });\n }\n }\n if (!response) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.error(`Cannot cache non-existent response for '${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(effectiveRequest.url)}'.`);\n }\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"cache-put-with-no-response\", {\n url: (0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(effectiveRequest.url)\n });\n }\n const responseToCache = await this._ensureResponseSafeToCache(response);\n if (!responseToCache) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.debug(`Response '${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(effectiveRequest.url)}' will not be cached.`, responseToCache);\n }\n return false;\n }\n const { cacheName, matchOptions } = this._strategy;\n const cache = await self.caches.open(cacheName);\n if (true) {\n const vary = response.headers.get(\"Vary\");\n if (vary && matchOptions?.ignoreVary !== true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.debug(`The response for ${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(effectiveRequest.url)} has a 'Vary: ${vary}' header. Consider setting the {ignoreVary: true} option on your strategy to ensure cache matching and deletion works as expected.`);\n }\n }\n const hasCacheUpdateCallback = this.hasCallback(\"cacheDidUpdate\");\n const oldResponse = hasCacheUpdateCallback ? await (0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.cacheMatchIgnoreParams)(cache, effectiveRequest.clone(), [\n \"__WB_REVISION__\"\n ], matchOptions) : null;\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.debug(`Updating the '${cacheName}' cache with a new Response for ${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(effectiveRequest.url)}.`);\n }\n try {\n await cache.put(effectiveRequest, hasCacheUpdateCallback ? responseToCache.clone() : responseToCache);\n } catch (error) {\n if (error instanceof Error) {\n if (error.name === \"QuotaExceededError\") {\n await (0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.executeQuotaErrorCallbacks)();\n }\n throw error;\n }\n }\n for (const callback of this.iterateCallbacks(\"cacheDidUpdate\")){\n await callback({\n cacheName,\n oldResponse,\n newResponse: responseToCache.clone(),\n request: effectiveRequest,\n event: this.event\n });\n }\n return true;\n }\n async getCacheKey(request, mode) {\n const key = `${request.url} | ${mode}`;\n if (!this._cacheKeys[key]) {\n let effectiveRequest = request;\n for (const callback of this.iterateCallbacks(\"cacheKeyWillBeUsed\")){\n effectiveRequest = toRequest(await callback({\n mode,\n request: effectiveRequest,\n event: this.event,\n params: this.params\n }));\n }\n this._cacheKeys[key] = effectiveRequest;\n }\n return this._cacheKeys[key];\n }\n hasCallback(name) {\n for (const plugin of this._strategy.plugins){\n if (name in plugin) {\n return true;\n }\n }\n return false;\n }\n async runCallbacks(name, param) {\n for (const callback of this.iterateCallbacks(name)){\n await callback(param);\n }\n }\n *iterateCallbacks(name) {\n for (const plugin of this._strategy.plugins){\n if (typeof plugin[name] === \"function\") {\n const state = this._pluginStateMap.get(plugin);\n const statefulCallback = (param)=>{\n const statefulParam = {\n ...param,\n state\n };\n return plugin[name](statefulParam);\n };\n yield statefulCallback;\n }\n }\n }\n waitUntil(promise) {\n this._extendLifetimePromises.push(promise);\n return promise;\n }\n async doneWaiting() {\n let promise = undefined;\n while(promise = this._extendLifetimePromises.shift()){\n await promise;\n }\n }\n destroy() {\n this._handlerDeferred.resolve(null);\n }\n async _ensureResponseSafeToCache(response) {\n let responseToCache = response;\n let pluginsUsed = false;\n for (const callback of this.iterateCallbacks(\"cacheWillUpdate\")){\n responseToCache = await callback({\n request: this.request,\n response: responseToCache,\n event: this.event\n }) || undefined;\n pluginsUsed = true;\n if (!responseToCache) {\n break;\n }\n }\n if (!pluginsUsed) {\n if (responseToCache && responseToCache.status !== 200) {\n responseToCache = undefined;\n }\n if (true) {\n if (responseToCache) {\n if (responseToCache.status !== 200) {\n if (responseToCache.status === 0) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.warn(`The response for '${this.request.url}' is an opaque response. The caching strategy that you're using will not cache opaque responses by default.`);\n } else {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.debug(`The response for '${this.request.url}' returned a status code of '${response.status}' and won't be cached as a result.`);\n }\n }\n }\n }\n }\n return responseToCache;\n }\n}\n\nclass Strategy {\n cacheName;\n plugins;\n fetchOptions;\n matchOptions;\n constructor(options = {}){\n this.cacheName = _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.privateCacheNames.getRuntimeName(options.cacheName);\n this.plugins = options.plugins || [];\n this.fetchOptions = options.fetchOptions;\n this.matchOptions = options.matchOptions;\n }\n handle(options) {\n const [responseDone] = this.handleAll(options);\n return responseDone;\n }\n handleAll(options) {\n if (options instanceof FetchEvent) {\n options = {\n event: options,\n request: options.request\n };\n }\n const event = options.event;\n const request = typeof options.request === \"string\" ? new Request(options.request) : options.request;\n const handler = new StrategyHandler(this, options.url ? {\n event,\n request,\n url: options.url,\n params: options.params\n } : {\n event,\n request\n });\n const responseDone = this._getResponse(handler, request, event);\n const handlerDone = this._awaitComplete(responseDone, handler, request, event);\n return [\n responseDone,\n handlerDone\n ];\n }\n async _getResponse(handler, request, event) {\n await handler.runCallbacks(\"handlerWillStart\", {\n event,\n request\n });\n let response = undefined;\n try {\n response = await this._handle(request, handler);\n if (response === undefined || response.type === \"error\") {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"no-response\", {\n url: request.url\n });\n }\n } catch (error) {\n if (error instanceof Error) {\n for (const callback of handler.iterateCallbacks(\"handlerDidError\")){\n response = await callback({\n error,\n event,\n request\n });\n if (response !== undefined) {\n break;\n }\n }\n }\n if (!response) {\n throw error;\n }\n if (true) {\n throw _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(`While responding to '${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(request.url)}', an ${error instanceof Error ? error.toString() : \"\"} error occurred. Using a fallback response provided by a handlerDidError plugin.`);\n }\n }\n for (const callback of handler.iterateCallbacks(\"handlerWillRespond\")){\n response = await callback({\n event,\n request,\n response\n });\n }\n return response;\n }\n async _awaitComplete(responseDone, handler, request, event) {\n let response = undefined;\n let error = undefined;\n try {\n response = await responseDone;\n } catch (error) {}\n try {\n await handler.runCallbacks(\"handlerDidRespond\", {\n event,\n request,\n response\n });\n await handler.doneWaiting();\n } catch (waitUntilError) {\n if (waitUntilError instanceof Error) {\n error = waitUntilError;\n }\n }\n await handler.runCallbacks(\"handlerDidComplete\", {\n event,\n request,\n response,\n error\n });\n handler.destroy();\n if (error) {\n throw error;\n }\n }\n}\n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vQHNlcndpc3Qrc3dAOS4wLjAtcHJldmlldy4yMV90eXBlc2NyaXB0QDUuNC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ICAgICAgICAgICAgICAgICBsb2dnZXIubG9nKGBVc2luZyBhIHByZWxvYWRlZCBuYXZpZ2F0aW9uIHJlc3BvbnNlIGZvciAnJHtnZXRGcmllbmRseVVSTChyZXF1ZXN0LnVybCl9J2ApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gcG9zc2libGVQcmVsb2FkUmVzcG9uc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgY29uc3Qgb3JpZ2luYWxSZXF1ZXN0ID0gdGhpcy5oYXNDYWxsYmFjayhcImZldGNoRGlkRmFpbFwiKSA/IHJlcXVlc3QuY2xvbmUoKSA6IG51bGw7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBmb3IgKGNvbnN0IGNiIG9mIHRoaXMuaXRlcmF0ZUNhbGxiYWNrcyhcInJlcXVlc3RXaWxsRmV0Y2hcIikpe1xuICAgICAgICAgICAgICAgIHJlcXVlc3QgPSBhd2FpdCBjYih7XG4gICAgICAgICAgICAgICAgICAgIHJlcXVlc3Q6IHJlcXVlc3QuY2xvbmUoKSxcbiAgICAgICAgICAgICAgICAgICAgZXZlbnRcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgICBpZiAoZXJyIGluc3RhbmNlb2YgRXJyb3IpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwicGx1Z2luLWVycm9yLXJlcXVlc3Qtd2lsbC1mZXRjaFwiLCB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93bkVycm9yTWVzc2FnZTogZXJyLm1lc3NhZ2VcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBjb25zdCBwbHVnaW5GaWx0ZXJlZFJlcXVlc3QgPSByZXF1ZXN0LmNsb25lKCk7XG4gICAgICAgIHRye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ZXN0IGZvciAnJHtnZXRGcmllbmRseVVSTChyZXF1ZXN0LnVybCl9JyB0aHJldyBhbiBlcnJvci5gLCBlcnJvcik7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAob3JpZ2luYWxSZXF1ZXN0KSB7XG4gICAgICAgICAgICAgICAgYXdhaXQgdGhpcy5ydW5DYWxsYmFja3MoXCJmZXRjaERpZEZhaWxcIiwge1xuICAgICAgICAgICAgICAgICAgICBlcnJvcjogZXJyb3IsXG4gICAgICAgICAgICAgICAgICAgIGV2ZW50LFxuICAgICAgICAgICAgICAgICAgICBvcmlnaW5hbFJlcXVlc3Q6IG9yaWdpbmFsUmVxdWVzdC5jbG9uZSgpLFxuICAgICAgICAgICAgICAgICAgICByZXF1ZXN0OiBwbHVnaW5GaWx0ZXJlZFJlcXVlc3QuY2xvbmUoKVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhyb3cgZXJyb3I7XG4gICAgICAgIH1cbiAgICB9XG4gICAgYXN5bmMgZmV0Y2hBbmRDYWNoZVB1dChpbnB1dCkge1xuICAgICAgICBjb25zdCByZXNwb25zZSA9IGF3YWl0IHRoaXMuZmV0Y2goaW5wdXQpO1xuICAgICAgICBjb25zdCByZXNwb25zZUNsb25lID0gcmVzcG9uc2UuY2xvbmUoKTtcbiAgICAgICAgdm9pZCB0aGlzLndhaXRVbnRpbCh0aGlzLmNhY2hlUHV0KGlucHV0LCByZXNwb25zZUNsb25lKSk7XG4gICAgICAgIHJldHVybiByZXNwb25zZTtcbiAgICB9XG4gICAgYXN5bmMgY2FjaGVNYXRjaChrZXkpIHtcbiAgICAgICAgY29uc3QgcmVxdWVzdCA9IHRvUmVxdWVzdChrZXkpO1xuICAgICAgICBsZXQgY2FjaGVkUmVzcG9uc2U7XG4gICAgICAgIGNvbnN0IHsgY2FjaGVOYW1lLCBtYXRjaE9wdGlvbnMgfSA9IHRoaXMuX3N0cmF0ZWd5O1xuICAgIC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AgICAgfVxuICAgIH1cbiAgICAqaXRlcmF0ZUNhbGxiYWNrcyhuYW1lKSB7XG4gICAgICAgIGZvciAoY29uc3QgcGx1Z2luIG9mIHRoaXMuX3N0cmF0ZWd5LnBsdWdpbnMpe1xuICAgICAgICAgICAgaWYgKHR5cGVvZiBwbHVnaW5bbmFtZV0gPT09IFwiZnVuY3Rpb25cIikge1xuICAgICAgICAgICAgICAgIGNvbnN0IHN0YXRlID0gdGhpcy5fcGx1Z2luU3RhdGVNYXAuZ2V0KHBsdWdpbik7XG4gICAgICAgICAgICAgICAgY29uc3Qgc3RhdGVmdWxDYWxsYmFjayA9IChwYXJhbSk9PntcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RhdGVmdWxQYXJhbSA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC4uLnBhcmFtLFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGVcbiAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBsdWdpbltuYW1lXShzdGF0ZWZ1bFBhcmFtKTtcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIHlpZWxkIHN0YXRlZnVsQ2FsbGJhY2s7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG4gICAgd2FpdFVudGlsKHByb21pc2UpIHtcbiAgICAgICAgdGhpcy5fZXh0ZW5kTGlmZXRpbWVQcm9taXNlcy5wdXNoKHByb21pc2UpO1xuICAgICAgICByZXR1cm4gcHJvbWlzZTtcbiAgICB9XG4gICAgYXN5bmMgZG9uZVdhaXRpbmcoKSB7XG4gICAgICAgIGxldCBwcm9taXNlID0gdW5kZWZpbmVkO1xuICAgICAgICB3aGlsZShwcm9taXNlID0gdGhpcy5fZXh0ZW5kTGlmZXRpbWVQcm9taXNlcy5zaGlmdCgpKXtcbiAgICAgICAgICAgIGF3YWl0IHByb21pc2U7XG4gICAgICAgIH1cbiAgICB9XG4gICAgZGV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4gICAgICAgICAgICByZXF1ZXN0XG4gICAgICAgIH0pO1xuICAgICAgICBjb25zdCByZXNwb25zZURvbmUgPSB0aGlzLl9nZXRSZXNwb25zZShoYW5kbGVyLCByZXF1ZXN0LCBldmVudCk7XG4gICAgICAgIGNvbnN0IGhhbmRsZXJEb25lID0gdGhpcy5fYXdhaXRDb21wbGV0ZShyZXNwb25zZURvbmUsIGhhbmRsZXIsIHJlcXVlc3QsIGV2ZW50KTtcbiAgICAgICAgcmV0dXJuIFtcbiAgICAgICAgICAgIHJlc3BvbnNlRG9uZSxcbiAgICAgICAgICAgIGhhbmRsZXJEb25lXG4gICAgICAgIF07XG4gICAgfVxuICAgIGFzeW5jIF9nZXRSZXNwb25zZShoYW5kbGVyLCByZXF1ZXN0LCBldmVudCkge1xuICAgICAgICBhd2FpdCBoYW5kbGVyLnJ1bkNhbGxiYWNrcyhcImhhbmRsZXJXaWxsU3RhcnRcIiwge1xuICAgICAgICAgICAgZXZlbnQsXG4gICAgICAgICAgICByZXF1ZXN0XG4gICAgICAgIH0pO1xuICAgICAgICBsZXQgcmVzcG9uc2UgPSB1bmRlZmluZWQ7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IHRoaXMuX2hhbmRsZShyZXF1ZXN0LCBoYW5kbGVyKTtcbiAgICAgICAgICAgIGlmIChyZXNwb25zZSA9PT0gdW5kZWZpbmVkIHx8IHJlc3BvbnNlLnR5cGUgPT09IFwiZXJyb3JcIikge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBTZXJ3aXN0RXJyb3IoXCJuby1yZXNwb25zZVwiLCB7XG4gICAgICAgICAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmxcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgIGlmIChlcnJvciBpbnN0YW5jZW9mIEVycm9yKSB7XG4gICAgICAgICAgICAgICAgZm9yIChjb25zdCBjYWxsYmFjayBvZiBoYW5kbGVyLml0ZXJhdGVDYWxsYmFja3MoXCJoYW5kbGVyRGlkRXJyb3JcIikpe1xuICAgICAgICAgICAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IGNhbGxiYWNrKHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yLFxuICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQsXG4gICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2UgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoIXJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgZXJyb3I7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbG9nZ2VyLmxvZyhgV2hpbGUgcmVzcG9uZGluZyB0byAnJHtnZXRGcmllbmRseVVSTChyZXF1ZXN0LnVybCl9JywgYW4gJHtlcnJvciBpbnN0YW5jZW9mIEVycm9yID8gZXJyb3IudG9TdHJpbmcoKSA6IFwiXCJ9IGVycm9yIG9jY3VycmVkLiBVc2luZyBhIGZhbGxiYWNrIHJlc3BvbnNlIHByb3ZpZGVkIGJ5IGEgaGFuZGxlckRpZEVycm9yIHBsdWdpbi5gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBmb3IgKGNvbnN0IGNhbGxiYWNrIG9mIGhhbmRsZXIuaXRlcmF0ZUNhbGxiYWNrcyhcImhhbmRsZXJXaWxsUmVzcG9uZFwiKSl7XG4gICAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IGNhbGxiYWNrKHtcbiAgICAgICAgICAgICAgICBldmVudCxcbiAgICAgICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgICAgIHJlc3BvbnNlXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmVzcG9uc2U7XG4gICAgfVxuICAgIGFzeW5jIF9hd2FpdENvbXBsZXRlKHJlc3BvbnNlRG9uZSwgaGFuZGxlciwgcmVxdWVzdCwgZXZlbnQpIHtcbiAgICAgICAgbGV0IHJlc3BvbnNlID0gdW5kZWZpbmVkO1xuICAgICAgICBsZXQgZXJyb3IgPSB1bmRlZmluZWQ7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IHJlc3BvbnNlRG9uZTtcbiAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHt9XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBhd2FpdCBoYW5kbGVyLnJ1bkNhbGxiYWNrcyhcImhhbmRsZXJEaWRSZXNwb25kXCIsIHtcbiAgICAgICAgICAgICAgICBldmVudCxcbiAgICAgICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgICAgIHJlc3BvbnNlXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGF3YWl0IGhhbmRsZXIuZG9uZVdhaXRpbmcoKTtcbiAgICAgICAgfSBjYXRjaCAod2FpdFVudGlsRXJyb3IpIHtcbiAgICAgICAgICAgIGlmICh3YWl0VW50aWxFcnJvciBpbnN0YW5jZW9mIEVycm9yKSB7XG4gICAgICAgICAgICAgICAgZXJyb3IgPSB3YWl0VW50aWxFcnJvcjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBhd2FpdCBoYW5kbGVyLnJ1bkNhbGxiYWNrcyhcImhhbmRsZXJEaWRDb21wbGV0ZVwiLCB7XG4gICAgICAgICAgICBldmVudCxcbiAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICByZXNwb25zZSxcbiAgICAgICAgICAgIGVycm9yXG4gICAgICAgIH0pO1xuICAgICAgICBoYW5kbGVyLmRlc3Ryb3koKTtcbiAgICAgICAgaWYgKGVycm9yKSB7XG4gICAgICAgICAgICB0aHJvdyBlcnJvcjtcbiAgICAgICAgfVxuICAgIH1cbn1cblxuZXhwb3J0IHsgU3RyYXRlZ3kgYXMgUywgU3RyYXRlZ3lIYW5kbGVyIGFzIGEgfTtcbiJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/Strategy.js\n")); + +/***/ }), + +/***/ "./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/singletonPrecacheController.js": +/*!**********************************************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/singletonPrecacheController.js ***! + \**********************************************************************************************************************************************/ +/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ P: function() { return /* binding */ PrecacheController; },\n/* harmony export */ a: function() { return /* binding */ PrecacheStrategy; },\n/* harmony export */ g: function() { return /* binding */ getSingletonPrecacheController; },\n/* harmony export */ s: function() { return /* binding */ setSingletonPrecacheController; }\n/* harmony export */ });\n/* harmony import */ var _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @serwist/core/internal */ \"./node_modules/.pnpm/@serwist+core@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/core/dist/index.internal.js\");\n/* harmony import */ var _serwist_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @serwist/core */ \"./node_modules/.pnpm/@serwist+core@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/core/dist/index.js\");\n/* harmony import */ var _Strategy_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Strategy.js */ \"./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/Strategy.js\");\n\n\n\n\nconst parallel = async (limit, array, func)=>{\n const work = array.map((item, index)=>({\n index,\n item\n }));\n const processor = async (res)=>{\n const results = [];\n while(true){\n const next = work.pop();\n if (!next) {\n return res(results);\n }\n const result = await func(next.item);\n results.push({\n result: result,\n index: next.index\n });\n }\n };\n const queues = Array.from({\n length: limit\n }, ()=>new Promise(processor));\n const results = (await Promise.all(queues)).flat().sort((a, b)=>a.index < b.index ? -1 : 1).map((res)=>res.result);\n return results;\n};\n\nclass PrecacheStrategy extends _Strategy_js__WEBPACK_IMPORTED_MODULE_2__.S {\n _fallbackToNetwork;\n static defaultPrecacheCacheabilityPlugin = {\n async cacheWillUpdate ({ response }) {\n if (!response || response.status >= 400) {\n return null;\n }\n return response;\n }\n };\n static copyRedirectedCacheableResponsesPlugin = {\n async cacheWillUpdate ({ response }) {\n return response.redirected ? await (0,_serwist_core__WEBPACK_IMPORTED_MODULE_1__.copyResponse)(response) : response;\n }\n };\n constructor(options = {}){\n options.cacheName = _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.privateCacheNames.getPrecacheName(options.cacheName);\n super(options);\n this._fallbackToNetwork = options.fallbackToNetwork === false ? false : true;\n this.plugins.push(PrecacheStrategy.copyRedirectedCacheableResponsesPlugin);\n }\n async _handle(request, handler) {\n const response = await handler.cacheMatch(request);\n if (response) {\n return response;\n }\n if (handler.event && handler.event.type === \"install\") {\n return await this._handleInstall(request, handler);\n }\n return await this._handleFetch(request, handler);\n }\n async _handleFetch(request, handler) {\n let response = undefined;\n const params = handler.params || {};\n if (this._fallbackToNetwork) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.warn(`The precached response for ${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(request.url)} in ${this.cacheName} was not found. Falling back to the network.`);\n }\n const integrityInManifest = params.integrity;\n const integrityInRequest = request.integrity;\n const noIntegrityConflict = !integrityInRequest || integrityInRequest === integrityInManifest;\n response = await handler.fetch(new Request(request, {\n integrity: request.mode !== \"no-cors\" ? integrityInRequest || integrityInManifest : undefined\n }));\n if (integrityInManifest && noIntegrityConflict && request.mode !== \"no-cors\") {\n this._useDefaultCacheabilityPluginIfNeeded();\n const wasCached = await handler.cachePut(request, response.clone());\n if (true) {\n if (wasCached) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(`A response for ${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(request.url)} was used to \"repair\" the precache.`);\n }\n }\n }\n } else {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"missing-precache-entry\", {\n cacheName: this.cacheName,\n url: request.url\n });\n }\n if (true) {\n const cacheKey = params.cacheKey || await handler.getCacheKey(request, \"read\");\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupCollapsed(`Precaching is responding to: ${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(request.url)}`);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(`Serving the precached url: ${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(cacheKey instanceof Request ? cacheKey.url : cacheKey)}`);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupCollapsed(\"View request details here.\");\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(request);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupEnd();\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupCollapsed(\"View response details here.\");\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(response);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupEnd();\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupEnd();\n }\n return response;\n }\n async _handleInstall(request, handler) {\n this._useDefaultCacheabilityPluginIfNeeded();\n const response = await handler.fetch(request);\n const wasCached = await handler.cachePut(request, response.clone());\n if (!wasCached) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"bad-precaching-response\", {\n url: request.url,\n status: response.status\n });\n }\n return response;\n }\n _useDefaultCacheabilityPluginIfNeeded() {\n let defaultPluginIndex = null;\n let cacheWillUpdatePluginCount = 0;\n for (const [index, plugin] of this.plugins.entries()){\n if (plugin === PrecacheStrategy.copyRedirectedCacheableResponsesPlugin) {\n continue;\n }\n if (plugin === PrecacheStrategy.defaultPrecacheCacheabilityPlugin) {\n defaultPluginIndex = index;\n }\n if (plugin.cacheWillUpdate) {\n cacheWillUpdatePluginCount++;\n }\n }\n if (cacheWillUpdatePluginCount === 0) {\n this.plugins.push(PrecacheStrategy.defaultPrecacheCacheabilityPlugin);\n } else if (cacheWillUpdatePluginCount > 1 && defaultPluginIndex !== null) {\n this.plugins.splice(defaultPluginIndex, 1);\n }\n }\n}\n\nclass PrecacheCacheKeyPlugin {\n _precacheController;\n constructor({ precacheController }){\n this._precacheController = precacheController;\n }\n cacheKeyWillBeUsed = async ({ request, params })=>{\n const cacheKey = params?.cacheKey || this._precacheController.getCacheKeyForURL(request.url);\n return cacheKey ? new Request(cacheKey, {\n headers: request.headers\n }) : request;\n };\n}\n\nclass PrecacheInstallReportPlugin {\n updatedURLs = [];\n notUpdatedURLs = [];\n handlerWillStart = async ({ request, state })=>{\n if (state) {\n state.originalRequest = request;\n }\n };\n cachedResponseWillBeUsed = async ({ event, state, cachedResponse })=>{\n if (event.type === \"install\") {\n if (state?.originalRequest && state.originalRequest instanceof Request) {\n const url = state.originalRequest.url;\n if (cachedResponse) {\n this.notUpdatedURLs.push(url);\n } else {\n this.updatedURLs.push(url);\n }\n }\n }\n return cachedResponse;\n };\n}\n\nconst REVISION_SEARCH_PARAM = \"__WB_REVISION__\";\nfunction createCacheKey(entry) {\n if (!entry) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"add-to-cache-list-unexpected-type\", {\n entry\n });\n }\n if (typeof entry === \"string\") {\n const urlObject = new URL(entry, location.href);\n return {\n cacheKey: urlObject.href,\n url: urlObject.href\n };\n }\n const { revision, url } = entry;\n if (!url) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"add-to-cache-list-unexpected-type\", {\n entry\n });\n }\n if (!revision) {\n const urlObject = new URL(url, location.href);\n return {\n cacheKey: urlObject.href,\n url: urlObject.href\n };\n }\n const cacheKeyURL = new URL(url, location.href);\n const originalURL = new URL(url, location.href);\n cacheKeyURL.searchParams.set(REVISION_SEARCH_PARAM, revision);\n return {\n cacheKey: cacheKeyURL.href,\n url: originalURL.href\n };\n}\n\nconst logGroup = (groupTitle, deletedURLs)=>{\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupCollapsed(groupTitle);\n for (const url of deletedURLs){\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(url);\n }\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupEnd();\n};\nfunction printCleanupDetails(deletedURLs) {\n const deletionCount = deletedURLs.length;\n if (deletionCount > 0) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupCollapsed(`During precaching cleanup, ${deletionCount} cached request${deletionCount === 1 ? \" was\" : \"s were\"} deleted.`);\n logGroup(\"Deleted Cache Requests\", deletedURLs);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupEnd();\n }\n}\n\nfunction _nestedGroup(groupTitle, urls) {\n if (urls.length === 0) {\n return;\n }\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupCollapsed(groupTitle);\n for (const url of urls){\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(url);\n }\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupEnd();\n}\nfunction printInstallDetails(urlsToPrecache, urlsAlreadyPrecached) {\n const precachedCount = urlsToPrecache.length;\n const alreadyPrecachedCount = urlsAlreadyPrecached.length;\n if (precachedCount || alreadyPrecachedCount) {\n let message = `Precaching ${precachedCount} file${precachedCount === 1 ? \"\" : \"s\"}.`;\n if (alreadyPrecachedCount > 0) {\n message += ` ${alreadyPrecachedCount} ` + `file${alreadyPrecachedCount === 1 ? \" is\" : \"s are\"} already cached.`;\n }\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupCollapsed(message);\n _nestedGroup(\"View newly precached URLs.\", urlsToPrecache);\n _nestedGroup(\"View previously precached URLs.\", urlsAlreadyPrecached);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupEnd();\n }\n}\n\nclass PrecacheController {\n _installAndActiveListenersAdded;\n _concurrentPrecaching;\n _strategy;\n _urlsToCacheKeys = new Map();\n _urlsToCacheModes = new Map();\n _cacheKeysToIntegrities = new Map();\n constructor({ cacheName, plugins = [], fallbackToNetwork = true, concurrentPrecaching = 1 } = {}){\n this._concurrentPrecaching = concurrentPrecaching;\n this._strategy = new PrecacheStrategy({\n cacheName: _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.privateCacheNames.getPrecacheName(cacheName),\n plugins: [\n ...plugins,\n new PrecacheCacheKeyPlugin({\n precacheController: this\n })\n ],\n fallbackToNetwork\n });\n this.install = this.install.bind(this);\n this.activate = this.activate.bind(this);\n }\n get strategy() {\n return this._strategy;\n }\n precache(entries) {\n this.addToCacheList(entries);\n if (!this._installAndActiveListenersAdded) {\n self.addEventListener(\"install\", this.install);\n self.addEventListener(\"activate\", this.activate);\n this._installAndActiveListenersAdded = true;\n }\n }\n addToCacheList(entries) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isArray(entries, {\n moduleName: \"@serwist/precaching\",\n className: \"PrecacheController\",\n funcName: \"addToCacheList\",\n paramName: \"entries\"\n });\n }\n const urlsToWarnAbout = [];\n for (const entry of entries){\n if (typeof entry === \"string\") {\n urlsToWarnAbout.push(entry);\n } else if (entry && !entry.integrity && entry.revision === undefined) {\n urlsToWarnAbout.push(entry.url);\n }\n const { cacheKey, url } = createCacheKey(entry);\n const cacheMode = typeof entry !== \"string\" && entry.revision ? \"reload\" : \"default\";\n if (this._urlsToCacheKeys.has(url) && this._urlsToCacheKeys.get(url) !== cacheKey) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"add-to-cache-list-conflicting-entries\", {\n firstEntry: this._urlsToCacheKeys.get(url),\n secondEntry: cacheKey\n });\n }\n if (typeof entry !== \"string\" && entry.integrity) {\n if (this._cacheKeysToIntegrities.has(cacheKey) && this._cacheKeysToIntegrities.get(cacheKey) !== entry.integrity) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"add-to-cache-list-conflicting-integrities\", {\n url\n });\n }\n this._cacheKeysToIntegrities.set(cacheKey, entry.integrity);\n }\n this._urlsToCacheKeys.set(url, cacheKey);\n this._urlsToCacheModes.set(url, cacheMode);\n if (urlsToWarnAbout.length > 0) {\n const warningMessage = `Serwist is precaching URLs without revision info: ${urlsToWarnAbout.join(\", \")}\\nThis is generally NOT safe. Learn more at https://bit.ly/wb-precache`;\n if (false) {} else {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.warn(warningMessage);\n }\n }\n }\n }\n install(event) {\n return (0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.waitUntil)(event, async ()=>{\n const installReportPlugin = new PrecacheInstallReportPlugin();\n this.strategy.plugins.push(installReportPlugin);\n await parallel(this._concurrentPrecaching, Array.from(this._urlsToCacheKeys.entries()), async ([url, cacheKey])=>{\n const integrity = this._cacheKeysToIntegrities.get(cacheKey);\n const cacheMode = this._urlsToCacheModes.get(url);\n const request = new Request(url, {\n integrity,\n cache: cacheMode,\n credentials: \"same-origin\"\n });\n await Promise.all(this.strategy.handleAll({\n event,\n request,\n url: new URL(request.url),\n params: {\n cacheKey\n }\n }));\n });\n const { updatedURLs, notUpdatedURLs } = installReportPlugin;\n if (true) {\n printInstallDetails(updatedURLs, notUpdatedURLs);\n }\n return {\n updatedURLs,\n notUpdatedURLs\n };\n });\n }\n activate(event) {\n return (0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.waitUntil)(event, async ()=>{\n const cache = await self.caches.open(this.strategy.cacheName);\n const currentlyCachedRequests = await cache.keys();\n const expectedCacheKeys = new Set(this._urlsToCacheKeys.values());\n const deletedCacheRequests = [];\n for (const request of currentlyCachedRequests){\n if (!expectedCacheKeys.has(request.url)) {\n await cache.delete(request);\n deletedCacheRequests.push(request.url);\n }\n }\n if (true) {\n printCleanupDetails(deletedCacheRequests);\n }\n return {\n deletedCacheRequests\n };\n });\n }\n getURLsToCacheKeys() {\n return this._urlsToCacheKeys;\n }\n getCachedURLs() {\n return [\n ...this._urlsToCacheKeys.keys()\n ];\n }\n getCacheKeyForURL(url) {\n const urlObject = new URL(url, location.href);\n return this._urlsToCacheKeys.get(urlObject.href);\n }\n getIntegrityForCacheKey(cacheKey) {\n return this._cacheKeysToIntegrities.get(cacheKey);\n }\n async matchPrecache(request) {\n const url = request instanceof Request ? request.url : request;\n const cacheKey = this.getCacheKeyForURL(url);\n if (cacheKey) {\n const cache = await self.caches.open(this.strategy.cacheName);\n return cache.match(cacheKey);\n }\n return undefined;\n }\n createHandlerBoundToURL(url) {\n const cacheKey = this.getCacheKeyForURL(url);\n if (!cacheKey) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"non-precached-url\", {\n url\n });\n }\n return (options)=>{\n options.request = new Request(url);\n options.params = {\n cacheKey,\n ...options.params\n };\n return this.strategy.handle(options);\n };\n }\n}\n\nlet defaultPrecacheController = undefined;\nconst getSingletonPrecacheController = ()=>{\n if (!defaultPrecacheController) {\n defaultPrecacheController = new PrecacheController();\n }\n return defaultPrecacheController;\n};\nconst setSingletonPrecacheController = (precacheController)=>{\n defaultPrecacheController = precacheController;\n return defaultPrecacheController;\n};\n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vQHNlcndpc3Qrc3dAOS4wLjAtcHJldmlldy4yMV90eXBlc2NyaXB0QDUuNC41L25vZGVfbW9kdWxlcy9Ac2Vyd2lzdC9zdy9kaXN0L2NodW5rcy9zaW5nbGV0b25QcmVjYWNoZUNvbnRyb2xsZXIuanMiLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFvSDtBQUN2RTtBQUNDOztBQUU5QztBQUNBO0FBQ0E7QUFDQTtBQUNBLFNBQVM7QUFDVDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsYUFBYTtBQUNiO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsS0FBSztBQUNMO0FBQ0E7QUFDQTs7QUFFQSwrQkFBK0IsMkNBQVE7QUFDdkM7QUFDQTtBQUNBLGlDQUFpQyxVQUFVO0FBQzNDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsaUNBQWlDLFVBQVU7QUFDM0MsK0NBQStDLDJEQUFZO0FBQzNEO0FBQ0E7QUFDQSw0QkFBNEI7QUFDNUIsNEJBQTRCLHFFQUFpQjtBQUM3QztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ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AgICAgICAgaWYgKGNhY2hlZFJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubm90VXBkYXRlZFVSTHMucHVzaCh1cmwpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudXBkYXRlZFVSTHMucHVzaCh1cmwpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gY2FjaGVkUmVzcG9uc2U7XG4gICAgfTtcbn1cblxuY29uc3QgUkVWSVNJT05fU0VBUkNIX1BBUkFNID0gXCJfX1dCX1JFVklTSU9OX19cIjtcbmZ1bmN0aW9uIGNyZWF0ZUNhY2hlS2V5KGVudHJ5KSB7XG4gICAgaWYgKCFlbnRyeSkge1xuICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwiYWRkLXRvLWNhY2hlLWxpc3QtdW5leHBlY3RlZC10eXBlXCIsIHtcbiAgICAgICAgICAgIGVudHJ5XG4gICAgICAgIH0pO1xuICAgIH1cbiAgICBpZiAodHlwZW9mIGVudHJ5ID09PSBcInN0cmluZ1wiKSB7XG4gICAgICAgIGNvbnN0IHVybE9iamVjdCA9IG5ldyBVUkwoZW50cnksIGxvY2F0aW9uLmhyZWYpO1xuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgY2FjaGVLZXk6IHVybE9iamVjdC5ocmVmLFxuICAgICAgICAgICAgdXJsOiB1cmxPYmplY3QuaHJlZlxuICAgICAgICB9O1xuICAgIH1cbiAgICBjb25zdCB7IHJldmlzaW9uLCB1cmwgfSA9IGVudHJ5O1xuICAgIGlmICghdXJsKSB7XG4gICAgICAgIHRocm93IG5ldyBTZXJ3aXN0RXJyb3IoXCJhZGQtdG8tY2FjaGUtbGlzdC11bmV4cGVjdGVkLXR5cGVcIiwge1xuICAgICAgICAgICAgZW50cnlcbiAgICAgICAgfSk7XG4gICAgfVxuICAgIGlmICghc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AgICAgICAgICAgYXNzZXJ0LmlzQXJyYXkoZW50cmllcywge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3QvcHJlY2FjaGluZ1wiLFxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJQcmVjYWNoZUNvbnRyb2xsZXJcIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJhZGRUb0NhY2hlTGlzdFwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJlbnRyaWVzXCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IHVybHNUb1dhcm5BYm91dCA9IFtdO1xuICAgICAgICBmb3IgKGNvbnN0IGVudHJ5IG9mIGVudHJpZXMpe1xuICAgICAgICAgICAgaWYgKHR5cGVvZiBlbnRyeSA9PT0gXCJzdHJpbmdcIikge1xuICAgICAgICAgICAgICAgIHVybHNUb1dhcm5BYm91dC5wdXNoKGVudHJ5KTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoZW50cnkgJiYgIWVudHJ5LmludGVncml0eSAmJiBlbnRyeS5yZXZpc2lvbiA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgdXJsc1RvV2FybkFib3V0LnB1c2goZW50cnkudXJsKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvbnN0IHsgY2FjaGVLZXksIHVybCB9ID0gY3JlYXRlQ2FjaGVLZXkoZW50cnkpO1xuICAgICAgICAgICAgY29uc3QgY2FjaGVNb2RlID0gdHlwZW9mIGVudHJ5ICE9PSBcInN0cmluZ1wiICYmIGVudHJ5LnJldmlzaW9uID8gXCJyZWxvYWRcIiA6IFwiZGVmYXVsdFwiO1xuICAgICAgICAgICAgaWYgKHRoaXMuX3VybHNUb0NhY2hlS2V5cy5oYXModXJsKSAmJiB0aGlzLl91cmxzVG9DYWNoZUtleXMuZ2V0KHVybCkgIT09IGNhY2hlS2V5KSB7XG4gICA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ICAgICAgICAgICAgICAgIGNvbnN0IHdhcm5pbmdNZXNzYWdlID0gYFNlcndpc3QgaXMgcHJlY2FjaGluZyBVUkxzIHdpdGhvdXQgcmV2aXNpb24gaW5mbzogJHt1cmxzVG9XYXJuQWJvdXQuam9pbihcIiwgXCIpfVxcblRoaXMgaXMgZ2VuZXJhbGx5IE5PVCBzYWZlLiBMZWFybiBtb3JlIGF0IGh0dHBzOi8vYml0Lmx5L3diLXByZWNhY2hlYDtcbiAgICAgICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgPT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUud2Fybih3YXJuaW5nTWVzc2FnZSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLndhcm4od2FybmluZ01lc3NhZ2UpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbiAgICBpbnN0YWxsKGV2ZW50KSB7XG4gICAgICAgIHJldHVybiB3YWl0VW50aWwoZXZlbnQsIGFzeW5jICgpPT57XG4gICAgICAgICAgICBjb25zdCBpbnN0YWxsUmVwb3J0UGx1Z2luID0gbmV3IFByZWNhY2hlSW5zdGFsbFJlcG9ydFBsdWdpbigpO1xuICAgICAgICAgICAgdGhpcy5zdHJhdGVneS5wbHVnaW5zLnB1c2goaW5zdGFsbFJlcG9ydFBsdWdpbik7XG4gICAgICAgICAgICBhd2FpdCBwYXJhbGxlbCh0aGlzLl9jb25jdXJyZW50UHJlY2FjaGluZywgQXJyYXkuZnJvbSh0aGlzLl91cmxzVG9DYWNoZUtleXMuZW50cmllcygpKSwgYXN5bmMgKFt1cmwsIGNhY2hlS2V5XSk9PntcbiAgICAgICAgICAgICAgICBjb25zdCBpbnRlZ3JpdHkgPSB0aGlzLl9jYWNoZUtleXNUb0ludGVncml0aWVzLmdldChjYWNoZUtleSk7XG4gICAgICAgICAgICAgICAgY29uc3QgY2FjaGVNb2RlID0gdGhpcy5fdXJsc1RvQ2FjaGVNb2Rlcy5nZXQodXJsKTtcbiAgICAgICAgICAgICAgICBjb25zdCByZXF1ZXN0ID0gbmV3IFJlcXVlc3QodXJsLCB7XG4gICAgICAgICAgICAgICAgICAgIGludGVncml0eSxcbiAgICAgICAgICAgICAgICAgICAgY2FjaGU6IGNhY2hlTW9kZSxcbiAgICAgICAgICAgICAgICAgICAgY3JlZGVudGlhbHM6IFwic2FtZS1vcmlnaW5cIlxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIGF3YWl0IFByb21pc2UuYWxsKHRoaXMuc3RyYXRlZ3kuaGFuZGxlQWxsKHtcbiAgICAgICAgICAgICAgICAgICAgZXZlbnQsXG4gICAgICAgICAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICAgICAgICAgIHVybDogbmV3IFVSTChyZXF1ZXN0LnVybCksXG4gICAgICAgICAgICAgICAgICAgIHBhcmFtczoge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2FjaGVLZXlcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgY29uc3QgeyB1cGRhdGVkVVJMcywgbm90VXBkYXRlZFVSTHMgfSA9IGluc3RhbGxSZXBvcnRQbHVnaW47XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgcHJpbnRJbnN0YWxsRGV0YWlscyh1cGRhdGVkVVJMcywgbm90VXBkYXRlZFVSTHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICB1cGRhdGVkVVJMcyxcbiAgICAgICAgICAgICAgICBub3RVcGRhdGVkVVJMc1xuICAgICAgICAgICAgfTtcbiAgICAgICAgfSk7XG4gICAgfVxuICAgIGFjdGl2YXRlKGV2ZW50KSB7XG4gICAgICAgIHJldHVybiB3YWl0VW50aWwoZXZlbnQsIGFzeW5jICgpPT57XG4gICAgICAgICAgICBjb25zdCBjYWNoZSA9IGF3YWl0IHNlbGYuY2FjaGVzLm9wZW4odGhpcy5zdHJhdGVneS5jYWNoZU5hbWUpO1xuICAgICAgICAgICAgY29uc3QgY3VycmVudGx5Q2FjaGVkUmVxdWVzdHMgPSBhd2FpdCBjYWNoZS5rZXlzKCk7XG4gICAgICAgICAgICBjb25zdCBleHBlY3RlZENhY2hlS2V5cyA9IG5ldyBTZXQodGhpcy5fdXJsc1RvQ2FjaGVLZXlzLnZhbHVlcygpKTtcbiAgICAgICAgICAgIGNvbnN0IGRlbGV0ZWRDYWNoZVJlcXVlc3RzID0gW107XG4gICAgICAgICAgICBmb3IgKGNvbnN0IHJlcXVlc3Qgb2YgY3VycmVudGx5Q2FjaGVkUmVxdWVzdHMpe1xuICAgICAgICAgICAgICAgIGlmICghZXhwZWN0ZWRDYWNoZUtleXMuaGFzKHJlcXVlc3QudXJsKSkge1xuICAgICAgICAgICAgICAgICAgICBhd2FpdCBjYWNoZS5kZWxldGUocmVxdWVzdCk7XG4gICAgICAgICAgICAgICAgICAgIGRlbGV0ZWRDYWNoZVJlcXVlc3RzLnB1c2gocmVxdWVzdC51cmwpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICBwcmludENsZWFudXBEZXRhaWxzKGRlbGV0ZWRDYWNoZVJlcXVlc3RzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgZGVsZXRlZENhY2hlUmVxdWVzdHNcbiAgICAgICAgICAgIH07XG4gICAgICAgIH0pO1xuICAgIH1c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tcbiAgICAgICAgY29uc3QgY2FjaGVLZXkgPSB0aGlzLmdldENhY2hlS2V5Rm9yVVJMKHVybCk7XG4gICAgICAgIGlmICghY2FjaGVLZXkpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBTZXJ3aXN0RXJyb3IoXCJub24tcHJlY2FjaGVkLXVybFwiLCB7XG4gICAgICAgICAgICAgICAgdXJsXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gKG9wdGlvbnMpPT57XG4gICAgICAgICAgICBvcHRpb25zLnJlcXVlc3QgPSBuZXcgUmVxdWVzdCh1cmwpO1xuICAgICAgICAgICAgb3B0aW9ucy5wYXJhbXMgPSB7XG4gICAgICAgICAgICAgICAgY2FjaGVLZXksXG4gICAgICAgICAgICAgICAgLi4ub3B0aW9ucy5wYXJhbXNcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5zdHJhdGVneS5oYW5kbGUob3B0aW9ucyk7XG4gICAgICAgIH07XG4gICAgfVxufVxuXG5sZXQgZGVmYXVsdFByZWNhY2hlQ29udHJvbGxlciA9IHVuZGVmaW5lZDtcbmNvbnN0IGdldFNpbmdsZXRvblByZWNhY2hlQ29udHJvbGxlciA9ICgpPT57XG4gICAgaWYgKCFkZWZhdWx0UHJlY2FjaGVDb250cm9sbGVyKSB7XG4gICAgICAgIGRlZmF1bHRQcmVjYWNoZUNvbnRyb2xsZXIgPSBuZXcgUHJlY2FjaGVDb250cm9sbGVyKCk7XG4gICAgfVxuICAgIHJldHVybiBkZWZhdWx0UHJlY2FjaGVDb250cm9sbGVyO1xufTtcbmNvbnN0IHNldFNpbmdsZXRvblByZWNhY2hlQ29udHJvbGxlciA9IChwcmVjYWNoZUNvbnRyb2xsZXIpPT57XG4gICAgZGVmYXVsdFByZWNhY2hlQ29udHJvbGxlciA9IHByZWNhY2hlQ29udHJvbGxlcjtcbiAgICByZXR1cm4gZGVmYXVsdFByZWNhY2hlQ29udHJvbGxlcjtcbn07XG5cbmV4cG9ydCB7IFByZWNhY2hlQ29udHJvbGxlciBhcyBQLCBQcmVjYWNoZVN0cmF0ZWd5IGFzIGEsIGdldFNpbmdsZXRvblByZWNhY2hlQ29udHJvbGxlciBhcyBnLCBzZXRTaW5nbGV0b25QcmVjYWNoZUNvbnRyb2xsZXIgYXMgcyB9O1xuIl0sIm5hbWVzIjpbXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/singletonPrecacheController.js\n")); + +/***/ }), + +/***/ "./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/singletonRouter.js": +/*!**********************************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/singletonRouter.js ***! + \**********************************************************************************************************************************/ +/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ R: function() { return /* binding */ Route; },\n/* harmony export */ a: function() { return /* binding */ RegExpRoute; },\n/* harmony export */ b: function() { return /* binding */ Router; },\n/* harmony export */ g: function() { return /* binding */ getSingletonRouter; },\n/* harmony export */ p: function() { return /* binding */ parseRoute; },\n/* harmony export */ s: function() { return /* binding */ setSingletonRouter; }\n/* harmony export */ });\n/* harmony import */ var _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @serwist/core/internal */ \"./node_modules/.pnpm/@serwist+core@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/core/dist/index.internal.js\");\n\n\nconst defaultMethod = \"GET\";\nconst validMethods = [\n \"DELETE\",\n \"GET\",\n \"HEAD\",\n \"PATCH\",\n \"POST\",\n \"PUT\"\n];\n\nconst normalizeHandler = (handler)=>{\n if (handler && typeof handler === \"object\") {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.hasMethod(handler, \"handle\", {\n moduleName: \"@serwist/routing\",\n className: \"Route\",\n funcName: \"constructor\",\n paramName: \"handler\"\n });\n }\n return handler;\n }\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isType(handler, \"function\", {\n moduleName: \"@serwist/routing\",\n className: \"Route\",\n funcName: \"constructor\",\n paramName: \"handler\"\n });\n }\n return {\n handle: handler\n };\n};\n\nclass Route {\n handler;\n match;\n method;\n catchHandler;\n constructor(match, handler, method = defaultMethod){\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isType(match, \"function\", {\n moduleName: \"@serwist/routing\",\n className: \"Route\",\n funcName: \"constructor\",\n paramName: \"match\"\n });\n if (method) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isOneOf(method, validMethods, {\n paramName: \"method\"\n });\n }\n }\n this.handler = normalizeHandler(handler);\n this.match = match;\n this.method = method;\n }\n setCatchHandler(handler) {\n this.catchHandler = normalizeHandler(handler);\n }\n}\n\nclass RegExpRoute extends Route {\n constructor(regExp, handler, method){\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isInstance(regExp, RegExp, {\n moduleName: \"@serwist/routing\",\n className: \"RegExpRoute\",\n funcName: \"constructor\",\n paramName: \"pattern\"\n });\n }\n const match = ({ url })=>{\n const result = regExp.exec(url.href);\n if (!result) {\n return;\n }\n if (url.origin !== location.origin && result.index !== 0) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.debug(`The regular expression '${regExp.toString()}' only partially matched against the cross-origin URL '${url.toString()}'. RegExpRoute's will only handle cross-origin requests if they match the entire URL.`);\n }\n return;\n }\n return result.slice(1);\n };\n super(match, handler, method);\n }\n}\n\nconst parseRoute = (capture, handler, method)=>{\n let route;\n if (typeof capture === \"string\") {\n const captureUrl = new URL(capture, location.href);\n if (true) {\n if (!(capture.startsWith(\"/\") || capture.startsWith(\"http\"))) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"invalid-string\", {\n moduleName: \"@serwist/routing\",\n funcName: \"registerRoute\",\n paramName: \"capture\"\n });\n }\n const valueToCheck = capture.startsWith(\"http\") ? captureUrl.pathname : capture;\n const wildcards = \"[*:?+]\";\n if (new RegExp(`${wildcards}`).exec(valueToCheck)) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.debug(`The '$capture' parameter contains an Express-style wildcard character (${wildcards}). Strings are now always interpreted as exact matches; use a RegExp for partial or wildcard matches.`);\n }\n }\n const matchCallback = ({ url })=>{\n if (true) {\n if (url.pathname === captureUrl.pathname && url.origin !== captureUrl.origin) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.debug(`${capture} only partially matches the cross-origin URL ${url.toString()}. This route will only handle cross-origin requests if they match the entire URL.`);\n }\n }\n return url.href === captureUrl.href;\n };\n route = new Route(matchCallback, handler, method);\n } else if (capture instanceof RegExp) {\n route = new RegExpRoute(capture, handler, method);\n } else if (typeof capture === \"function\") {\n route = new Route(capture, handler, method);\n } else if (capture instanceof Route) {\n route = capture;\n } else {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"unsupported-route-type\", {\n moduleName: \"@serwist/routing\",\n funcName: \"registerRoute\",\n paramName: \"capture\"\n });\n }\n return route;\n};\n\nclass Router {\n _routes;\n _defaultHandlerMap;\n _fetchListenerHandler = null;\n _cacheListenerHandler = null;\n _catchHandler;\n constructor(){\n this._routes = new Map();\n this._defaultHandlerMap = new Map();\n }\n get routes() {\n return this._routes;\n }\n addFetchListener() {\n if (!this._fetchListenerHandler) {\n this._fetchListenerHandler = (event)=>{\n const { request } = event;\n const responsePromise = this.handleRequest({\n request,\n event\n });\n if (responsePromise) {\n event.respondWith(responsePromise);\n }\n };\n self.addEventListener(\"fetch\", this._fetchListenerHandler);\n }\n }\n removeFetchListener() {\n if (this._fetchListenerHandler) {\n self.removeEventListener(\"fetch\", this._fetchListenerHandler);\n this._fetchListenerHandler = null;\n }\n }\n addCacheListener() {\n if (!this._cacheListenerHandler) {\n this._cacheListenerHandler = (event)=>{\n if (event.data && event.data.type === \"CACHE_URLS\") {\n const { payload } = event.data;\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.debug(\"Caching URLs from the window\", payload.urlsToCache);\n }\n const requestPromises = Promise.all(payload.urlsToCache.map((entry)=>{\n if (typeof entry === \"string\") {\n entry = [\n entry\n ];\n }\n const request = new Request(...entry);\n return this.handleRequest({\n request,\n event\n });\n }));\n event.waitUntil(requestPromises);\n if (event.ports?.[0]) {\n void requestPromises.then(()=>event.ports[0].postMessage(true));\n }\n }\n };\n self.addEventListener(\"message\", this._cacheListenerHandler);\n }\n }\n removeCacheListener() {\n if (this._cacheListenerHandler) {\n self.removeEventListener(\"message\", this._cacheListenerHandler);\n }\n }\n handleRequest({ request, event }) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isInstance(request, Request, {\n moduleName: \"@serwist/routing\",\n className: \"Router\",\n funcName: \"handleRequest\",\n paramName: \"options.request\"\n });\n }\n const url = new URL(request.url, location.href);\n if (!url.protocol.startsWith(\"http\")) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.debug(\"Router only supports URLs that start with 'http'.\");\n }\n return;\n }\n const sameOrigin = url.origin === location.origin;\n const { params, route } = this.findMatchingRoute({\n event,\n request,\n sameOrigin,\n url\n });\n let handler = route?.handler;\n const debugMessages = [];\n if (true) {\n if (handler) {\n debugMessages.push([\n \"Found a route to handle this request:\",\n route\n ]);\n if (params) {\n debugMessages.push([\n `Passing the following params to the route's handler:`,\n params\n ]);\n }\n }\n }\n const method = request.method;\n if (!handler && this._defaultHandlerMap.has(method)) {\n if (true) {\n debugMessages.push(`Failed to find a matching route. Falling back to the default handler for ${method}.`);\n }\n handler = this._defaultHandlerMap.get(method);\n }\n if (!handler) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.debug(`No route found for: ${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(url)}`);\n }\n return;\n }\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupCollapsed(`Router is responding to: ${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(url)}`);\n for (const msg of debugMessages){\n if (Array.isArray(msg)) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(...msg);\n } else {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(msg);\n }\n }\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupEnd();\n }\n let responsePromise;\n try {\n responsePromise = handler.handle({\n url,\n request,\n event,\n params\n });\n } catch (err) {\n responsePromise = Promise.reject(err);\n }\n const catchHandler = route?.catchHandler;\n if (responsePromise instanceof Promise && (this._catchHandler || catchHandler)) {\n responsePromise = responsePromise.catch(async (err)=>{\n if (catchHandler) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupCollapsed(`Error thrown when responding to: ${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(url)}. Falling back to route's Catch Handler.`);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.error(\"Error thrown by:\", route);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.error(err);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupEnd();\n }\n try {\n return await catchHandler.handle({\n url,\n request,\n event,\n params\n });\n } catch (catchErr) {\n if (catchErr instanceof Error) {\n err = catchErr;\n }\n }\n }\n if (this._catchHandler) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupCollapsed(`Error thrown when responding to: ${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(url)}. Falling back to global Catch Handler.`);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.error(\"Error thrown by:\", route);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.error(err);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupEnd();\n }\n return this._catchHandler.handle({\n url,\n request,\n event\n });\n }\n throw err;\n });\n }\n return responsePromise;\n }\n findMatchingRoute({ url, sameOrigin, request, event }) {\n const routes = this._routes.get(request.method) || [];\n for (const route of routes){\n let params;\n const matchResult = route.match({\n url,\n sameOrigin,\n request,\n event\n });\n if (matchResult) {\n if (true) {\n if (matchResult instanceof Promise) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.warn(`While routing ${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.getFriendlyURL)(url)}, an async matchCallback function was used. Please convert the following route to use a synchronous matchCallback function:`, route);\n }\n }\n params = matchResult;\n if (Array.isArray(params) && params.length === 0) {\n params = undefined;\n } else if (matchResult.constructor === Object && Object.keys(matchResult).length === 0) {\n params = undefined;\n } else if (typeof matchResult === \"boolean\") {\n params = undefined;\n }\n return {\n route,\n params\n };\n }\n }\n return {};\n }\n setDefaultHandler(handler, method = defaultMethod) {\n this._defaultHandlerMap.set(method, normalizeHandler(handler));\n }\n setCatchHandler(handler) {\n this._catchHandler = normalizeHandler(handler);\n }\n registerCapture(capture, handler, method) {\n const route = parseRoute(capture, handler, method);\n this.registerRoute(route);\n return route;\n }\n registerRoute(route) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isType(route, \"object\", {\n moduleName: \"@serwist/routing\",\n className: \"Router\",\n funcName: \"registerRoute\",\n paramName: \"route\"\n });\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.hasMethod(route, \"match\", {\n moduleName: \"@serwist/routing\",\n className: \"Router\",\n funcName: \"registerRoute\",\n paramName: \"route\"\n });\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isType(route.handler, \"object\", {\n moduleName: \"@serwist/routing\",\n className: \"Router\",\n funcName: \"registerRoute\",\n paramName: \"route\"\n });\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.hasMethod(route.handler, \"handle\", {\n moduleName: \"@serwist/routing\",\n className: \"Router\",\n funcName: \"registerRoute\",\n paramName: \"route.handler\"\n });\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isType(route.method, \"string\", {\n moduleName: \"@serwist/routing\",\n className: \"Router\",\n funcName: \"registerRoute\",\n paramName: \"route.method\"\n });\n }\n if (!this._routes.has(route.method)) {\n this._routes.set(route.method, []);\n }\n this._routes.get(route.method).push(route);\n }\n unregisterRoute(route) {\n if (!this._routes.has(route.method)) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"unregister-route-but-not-found-with-method\", {\n method: route.method\n });\n }\n const routeIndex = this._routes.get(route.method).indexOf(route);\n if (routeIndex > -1) {\n this._routes.get(route.method).splice(routeIndex, 1);\n } else {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"unregister-route-route-not-registered\");\n }\n }\n}\n\nlet defaultRouter = undefined;\nconst getSingletonRouter = ()=>{\n if (!defaultRouter) {\n defaultRouter = new Router();\n defaultRouter.addFetchListener();\n defaultRouter.addCacheListener();\n }\n return defaultRouter;\n};\nconst setSingletonRouter = (router)=>{\n if (defaultRouter) {\n defaultRouter.removeFetchListener();\n defaultRouter.removeCacheListener();\n }\n defaultRouter = router;\n defaultRouter.addFetchListener();\n defaultRouter.addCacheListener();\n return defaultRouter;\n};\n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9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AgICAgICAgfVxuICAgIH1cbiAgICBhZGRDYWNoZUxpc3RlbmVyKCkge1xuICAgICAgICBpZiAoIXRoaXMuX2NhY2hlTGlzdGVuZXJIYW5kbGVyKSB7XG4gICAgICAgICAgICB0aGlzLl9jYWNoZUxpc3RlbmVySGFuZGxlciA9IChldmVudCk9PntcbiAgICAgICAgICAgICAgICBpZiAoZXZlbnQuZGF0YSAmJiBldmVudC5kYXRhLnR5cGUgPT09IFwiQ0FDSEVfVVJMU1wiKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHsgcGF5bG9hZCB9ID0gZXZlbnQuZGF0YTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmRlYnVnKFwiQ2FjaGluZyBVUkxzIGZyb20gdGhlIHdpbmRvd1wiLCBwYXlsb2FkLnVybHNUb0NhY2hlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBjb25zdCByZXF1ZXN0UHJvbWlzZXMgPSBQcm9taXNlLmFsbChwYXlsb2FkLnVybHNUb0NhY2hlLm1hcCgoZW50cnkpPT57XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIGVudHJ5ID09PSBcInN0cmluZ1wiKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZW50cnkgPSBbXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudHJ5XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHJlcXVlc3QgPSBuZXcgUmVxdWVzdCguLi5lbnRyeSk7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5oYW5kbGVSZXF1ZXN0KHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50XG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgICAgICAgICBldmVudC53YWl0VW50aWwocmVxdWVzdFByb21pc2VzKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGV2ZW50LnBvcnRzPy5bMF0pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgcmVxdWVzdFByb21pc2VzLnRoZW4oKCk9PmV2ZW50LnBvcnRzWzBdLnBvc3RNZXNzYWdlKHRydWUpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBzZWxmLmFkZEV2ZW50TGlzdGVuZXIoXCJtZXNzYWdlXCIsIHRoaXMuX2NhY2hlTGlzdGVuZXJIYW5kbGVyKTtcbiAgICAgICAgfVxuICAgIH1cbiAgICByZW1vdmVDYWNoZUxpc3RlbmVyKCkge1xuICAgICAgICBpZiAodGhpcy5fY2FjaGVMaXN0ZW5lckhhbmRsZXIpIHtcbiAgICAgICAgICAgIHNlbGYucmVtb3ZlRXZlbnRMaXN0ZW5lcihcIm1lc3NhZ2VcIiwgdGhpcy5fY2FjaGVMaXN0ZW5lckhhbmRsZXIpO1xuICAgICAgICB9XG4gICAgfVxuICAgIGhhbmRsZVJlcXVlc3QoeyByZXF1ZXN0LCBldmVudCB9KSB7XG4gICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgIGFzc2VydC5pc0luc3RhbmNlKHJlcXVlc3QsIFJlcXVlc3QsIHtcbiAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiBcIkBzZXJ3aXN0L3JvdXRpbmdcIixcbiAgICAgICAgICAgICAgICBjbGFzc05hbWU6IFwiUm91dGVyXCIsXG4gICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiaGFuZGxlUmVxdWVzdFwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJvcHRpb25zLnJlcXVlc3RcIlxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgdXJsID0gbmV3IFVSTChyZXF1ZXN0LnVybCwgbG9jYXRpb24uaHJlZik7XG4gICAgICAgIGlmICghdXJsLnByb3RvY29sLnN0YXJ0c1dpdGgoXCJodHRwXCIpKSB7XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgbG9nZ2VyLmRlYnVnKFwiUm91dGVyIG9ubHkgc3VwcG9ydHMgVVJMcyB0aGF0IHN0YXJ0IHdpdGggJ2h0dHAnLlwiKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCBzYW1lT3JpZ2luID0gdXJsLm9yaWdpbiA9PT0gbG9jYXRpb24ub3JpZ2luO1xuICAgICAgICBjb25zdCB7IHBhcmFtcywgcm91dGUgfSA9IHRoaXMuZmluZE1hdGNoaW5nUm91dGUoe1xuICAgICAgICAgICAgZXZlbnQsXG4gICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgc2FtZU9yaWdpbixcbiAgICAgICAgICAgIHVybFxuICAgICAgICB9KTtcbiAgICAgICAgbGV0IGhhbmRsZXIgPSByb3V0ZT8uaGFuZGxlcjtcbiAgICAgICAgY29uc3QgZGVidWdNZXNzYWdlcyA9IFtdO1xuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBpZiAoaGFuZGxlcikge1xuICAgICAgICAgICAgICAgIGRlYnVnTWVzc2FnZXMucHVzaChbXG4gICAgICAgICAgICAgICAgICAgIFwiRm91bmQgYSByb3V0ZSB0byBoYW5kbGUgdGhpcyByZXF1ZXN0OlwiLFxuICAgICAgICAgICAgICAgICAgICByb3V0ZVxuICAgICAgICAgICAgICAgIF0pO1xuICAgICAgICAgICAgICAgIGlmIChwYXJhbXMpIHtcbiAgICAgICAgICAgICAgICAgICAgZGVidWdNZXNzYWdlcy5wdXNoKFtcbiAgICAgICAgICAgICAgICAgICAgICAgIGBQYXNzaW5nIHRoZSBmb2xsb3dpbmcgcGFyYW1zIHRvIHRoZSByb3V0ZSdzIGhhbmRsZXI6YCxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtc1xuICAgICAgICAgICAgICAgICAgICBdKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgbWV0aG9kID0gcmVxdWVzdC5tZXRob2Q7XG4gICAgICAgIGlmICghaGFuZGxlciAmJiB0aGlzLl9kZWZhdWx0SGFuZGxlck1hcC5oYXMobWV0aG9kKSkge1xuICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgIGRlYnVnTWVzc2FnZXMucHVzaChgRmFpbGVkIHRvIGZpbmQgYSBtYXRjaGluZyByb3V0ZS4gRmFsbGluZyBiYWNrIHRvIHRoZSBkZWZhdWx0IGhhbmRsZXIgZm9yICR7bWV0aG9kfS5gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGhhbmRsZXIgPSB0aGlzLl9kZWZhdWx0SGFuZGxlck1hcC5nZXQobWV0aG9kKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIWhhbmRsZXIpIHtcbiAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICBsb2dnZXIuZGVidWcoYE5vIHJvdXRlIGZvdW5kIGZvcjogJHtnZXRGcmllbmRseVVSTCh1cmwpfWApO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgIGxvZ2dlci5ncm91cENvbGxhcHNlZChgUm91dGVyIGlzIHJlc3BvbmRpbmcgdG86ICR7Z2V0RnJpZW5kbHlVUkwodXJsKX1gKTtcbiAgICAgICAgICAgIGZvciAoY29uc3QgbXNnIG9mIGRlYnVnTWVzc2FnZXMpe1xuICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KG1zZykpIHtcbiAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmxvZyguLi5tc2cpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ2dlci5sb2cobXNnKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBFbmQoKTtcbiAgICAgICAgfVxuICAgICAgICBsZXQgcmVzcG9uc2VQcm9taXNlO1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgcmVzcG9uc2VQcm9taXNlID0gaGFuZGxlci5oYW5kbGUoe1xuICAgICAgICAgICAgICAgIHVybCxcbiAgICAgICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgICAgIGV2ZW50LFxuICAgICAgICAgICAgICAgIHBhcmFtc1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgcmVzcG9uc2VQcm9taXNlID0gUHJvbWlzZS5yZWplY3QoZXJyKTtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCBjYXRjaEhhbmRsZXIgPSByb3V0ZT8uY2F0Y2hIYW5kbGVyO1xuICAgICAgICBpZiAocmVzcG9uc2VQcm9taXNlIGluc3RhbmNlb2YgUHJvbWlzZSAmJiAodGhpcy5fY2F0Y2hIYW5kbGVyIHx8IGNhdGNoSGFuZGxlcikpIHtcbiAgICAgICAgICAgIHJlc3BvbnNlUHJvbWlzZSA9IHJlc3BvbnNlUHJvbWlzZS5jYXRjaChhc3luYyAoZXJyKT0+e1xuICAgICAgICAgICAgICAgIGlmIChjYXRjaEhhbmRsZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmdyb3VwQ29sbGFwc2VkKGBFcnJvciB0aHJvd24gd2hlbiByZXNwb25kaW5nIHRvOiAgJHtnZXRGcmllbmRseVVSTCh1cmwpfS4gRmFsbGluZyBiYWNrIHRvIHJvdXRlJ3MgQ2F0Y2ggSGFuZGxlci5gKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZ2dlci5lcnJvcihcIkVycm9yIHRocm93biBieTpcIiwgcm91dGUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmVycm9yKGVycik7XG4gICAgICAgICAgICAgICAgICAgICAgICBsb2dnZXIuZ3JvdXBFbmQoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGF3YWl0IGNhdGNoSGFuZGxlci5oYW5kbGUoe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtc1xuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGNhdGNoRXJyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2F0Y2hFcnIgaW5zdGFuY2VvZiBFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IGNhdGNoRXJyO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmICh0aGlzLl9jYXRjaEhhbmRsZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmdyb3VwQ29sbGFwc2VkKGBFcnJvciB0aHJvd24gd2hlbiByZXNwb25kaW5nIHRvOiAgJHtnZXRGcmllbmRseVVSTCh1cmwpfS4gRmFsbGluZyBiYWNrIHRvIGdsb2JhbCBDYXRjaCBIYW5kbGVyLmApO1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmVycm9yKFwiRXJyb3IgdGhyb3duIGJ5OlwiLCByb3V0ZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBsb2dnZXIuZXJyb3IoZXJyKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZ2dlci5ncm91cEVuZCgpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9jYXRjaEhhbmRsZXIuaGFuZGxlKHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybCxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICAgICAgICAgICAgICBldmVudFxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdGhyb3cgZXJyO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlc3BvbnNlUHJvbWlzZTtcbiAgICB9XG4gICAgZmluZE1hdGNoaW5nUm91dGUoeyB1cmwsIHNhbWVPcmlnaW4sIHJlcXVlc3QsIGV2ZW50IH0pIHtcbiAgICAgICAgY29uc3Qgcm91dGVzID0gdGhpcy5fcm91dGVzLmdldChyZXF1ZXN0Lm1ldGhvZCkgfHwgW107XG4gICAgICAgIGZvciAoY29uc3Qgcm91dGUgb2Ygcm91dGVzKXtcbiAgICAgICAgICAgIGxldCBwYXJhbXM7XG4gICAgICAgICAgICBjb25zdCBtYXRjaFJlc3VsdCA9IHJvdXRlLm1hdGNoKHtcbiAgICAgICAgICAgICAgICB1cmwsXG4gICAgICAgICAgICAgICAgc2FtZU9yaWdpbixcbiAgICAgICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgICAgIGV2ZW50XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGlmIChtYXRjaFJlc3VsdCkge1xuICAgICAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG1hdGNoUmVzdWx0IGluc3RhbmNlb2YgUHJvbWlzZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLndhcm4oYFdoaWxlIHJvdXRpbmcgJHtnZXRGcmllbmRseVVSTCh1cmwpfSwgYW4gYXN5bmMgbWF0Y2hDYWxsYmFjayBmdW5jdGlvbiB3YXMgdXNlZC4gUGxlYXNlIGNvbnZlcnQgdGhlIGZvbGxvd2luZyByb3V0ZSB0byB1c2UgYSBzeW5jaHJvbm91cyBtYXRjaENhbGxiYWNrIGZ1bmN0aW9uOmAsIHJvdXRlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBwYXJhbXMgPSBtYXRjaFJlc3VsdDtcbiAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShwYXJhbXMpICYmIHBhcmFtcy5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobWF0Y2hSZXN1bHQuY29uc3RydWN0b3IgPT09IE9iamVjdCAmJiBPYmplY3Qua2V5cyhtYXRjaFJlc3VsdCkubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHBhcmFtcyA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiBtYXRjaFJlc3VsdCA9PT0gXCJib29sZWFuXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgICAgICByb3V0ZSxcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zXG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4ge307XG4gICAgfVxuICAgIHNldERlZmF1bHRIYW5kbGVyKGhhbmRsZXIsIG1ldGhvZCA9IGRlZmF1bHRNZXRob2QpIHtcbiAgICAgICAgdGhpcy5fZGVmYXVsdEhhbmRsZXJNYXAuc2V0KG1ldGhvZCwgbm9ybWFsaXplSGFuZGxlcihoYW5kbGVyKSk7XG4gICAgfVxuICAgIHNldENhdGNoSGFuZGxlcihoYW5kbGVyKSB7XG4gICAgICAgIHRoaXMuX2NhdGNoSGFuZGxlciA9IG5vcm1hbGl6ZUhhbmRsZXIoaGFuZGxlcik7XG4gICAgfVxuICAgIHJlZ2lzdGVyQ2FwdHVyZShjYXB0dXJlLCBoYW5kbGVyLCBtZXRob2QpIHtcbiAgICAgICAgY29uc3Qgcm91dGUgPSBwYXJzZVJvdXRlKGNhcHR1cmUsIGhhbmRsZXIsIG1ldGhvZCk7XG4gICAgICAgIHRoaXMucmVnaXN0ZXJSb3V0ZShyb3V0ZSk7XG4gICAgICAgIHJldHVybiByb3V0ZTtcbiAgICB9XG4gICAgcmVnaXN0ZXJSb3V0ZShyb3V0ZSkge1xuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBhc3NlcnQuaXNUeXBlKHJvdXRlLCBcIm9iamVjdFwiLCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJAc2Vyd2lzdC9yb3V0aW5nXCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIlJvdXRlclwiLFxuICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcInJlZ2lzdGVyUm91dGVcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwicm91dGVcIlxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBhc3NlcnQuaGFzTWV0aG9kKHJvdXRlLCBcIm1hdGNoXCIsIHtcbiAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiBcIkBzZXJ3aXN0L3JvdXRpbmdcIixcbiAgICAgICAgICAgICAgICBjbGFzc05hbWU6IFwiUm91dGVyXCIsXG4gICAgICAgICAgICAgICAgZnVuY05hbWU6IFwicmVnaXN0ZXJSb3V0ZVwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJyb3V0ZVwiXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGFzc2VydC5pc1R5cGUocm91dGUuaGFuZGxlciwgXCJvYmplY3RcIiwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3Qvcm91dGluZ1wiLFxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJSb3V0ZXJcIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJyZWdpc3RlclJvdXRlXCIsXG4gICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcInJvdXRlXCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgYXNzZXJ0Lmhhc01ldGhvZChyb3V0ZS5oYW5kbGVyLCBcImhhbmRsZVwiLCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJAc2Vyd2lzdC9yb3V0aW5nXCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIlJvdXRlclwiLFxuICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcInJlZ2lzdGVyUm91dGVcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwicm91dGUuaGFuZGxlclwiXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGFzc2VydC5pc1R5cGUocm91dGUubWV0aG9kLCBcInN0cmluZ1wiLCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJAc2Vyd2lzdC9yb3V0aW5nXCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIlJvdXRlclwiLFxuICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcInJlZ2lzdGVyUm91dGVcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwicm91dGUubWV0aG9kXCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGlmICghdGhpcy5fcm91dGVzLmhhcyhyb3V0ZS5tZXRob2QpKSB7XG4gICAgICAgICAgICB0aGlzLl9yb3V0ZXMuc2V0KHJvdXRlLm1ldGhvZCwgW10pO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMuX3JvdXRlcy5nZXQocm91dGUubWV0aG9kKS5wdXNoKHJvdXRlKTtcbiAgICB9XG4gICAgdW5yZWdpc3RlclJvdXRlKHJvdXRlKSB7XG4gICAgICAgIGlmICghdGhpcy5fcm91dGVzLmhhcyhyb3V0ZS5tZXRob2QpKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwidW5yZWdpc3Rlci1yb3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F1bHRSb3V0ZXIgPSByb3V0ZXI7XG4gICAgZGVmYXVsdFJvdXRlci5hZGRGZXRjaExpc3RlbmVyKCk7XG4gICAgZGVmYXVsdFJvdXRlci5hZGRDYWNoZUxpc3RlbmVyKCk7XG4gICAgcmV0dXJuIGRlZmF1bHRSb3V0ZXI7XG59O1xuXG5leHBvcnQgeyBSb3V0ZSBhcyBSLCBSZWdFeHBSb3V0ZSBhcyBhLCBSb3V0ZXIgYXMgYiwgZ2V0U2luZ2xldG9uUm91dGVyIGFzIGcsIHBhcnNlUm91dGUgYXMgcCwgc2V0U2luZ2xldG9uUm91dGVyIGFzIHMgfTtcbiJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/singletonRouter.js\n")); + +/***/ }), + +/***/ "./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/index.plugins.js": +/*!*************************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/index.plugins.js ***! + \*************************************************************************************************************************/ +/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BROADCAST_UPDATE_DEFAULT_HEADERS: function() { return /* binding */ defaultHeadersToCheck; },\n/* harmony export */ BROADCAST_UPDATE_MESSAGE_META: function() { return /* binding */ CACHE_UPDATED_MESSAGE_META; },\n/* harmony export */ BROADCAST_UPDATE_MESSAGE_TYPE: function() { return /* binding */ CACHE_UPDATED_MESSAGE_TYPE; },\n/* harmony export */ BackgroundSyncPlugin: function() { return /* reexport safe */ _chunks_PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_0__.B; },\n/* harmony export */ BackgroundSyncQueue: function() { return /* reexport safe */ _chunks_PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_0__.Q; },\n/* harmony export */ BackgroundSyncQueueStore: function() { return /* reexport safe */ _chunks_PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_0__.a; },\n/* harmony export */ BroadcastCacheUpdate: function() { return /* binding */ BroadcastCacheUpdate; },\n/* harmony export */ BroadcastUpdatePlugin: function() { return /* binding */ BroadcastUpdatePlugin; },\n/* harmony export */ CacheExpiration: function() { return /* binding */ CacheExpiration; },\n/* harmony export */ CacheableResponse: function() { return /* binding */ CacheableResponse; },\n/* harmony export */ CacheableResponsePlugin: function() { return /* binding */ CacheableResponsePlugin; },\n/* harmony export */ ExpirationPlugin: function() { return /* binding */ ExpirationPlugin; },\n/* harmony export */ PrecacheFallbackPlugin: function() { return /* reexport safe */ _chunks_PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_0__.P; },\n/* harmony export */ RangeRequestsPlugin: function() { return /* binding */ RangeRequestsPlugin; },\n/* harmony export */ StorableRequest: function() { return /* reexport safe */ _chunks_PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_0__.S; },\n/* harmony export */ createPartialResponse: function() { return /* binding */ createPartialResponse; },\n/* harmony export */ initializeGoogleAnalytics: function() { return /* reexport safe */ _chunks_PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_0__.i; },\n/* harmony export */ responsesAreSame: function() { return /* binding */ responsesAreSame; }\n/* harmony export */ });\n/* harmony import */ var _chunks_PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./chunks/PrecacheFallbackPlugin.js */ \"./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/PrecacheFallbackPlugin.js\");\n/* harmony import */ var _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @serwist/core/internal */ \"./node_modules/.pnpm/@serwist+core@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/core/dist/index.internal.js\");\n/* harmony import */ var idb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! idb */ \"./node_modules/.pnpm/idb@8.0.0/node_modules/idb/build/index.js\");\n/* harmony import */ var _serwist_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @serwist/core */ \"./node_modules/.pnpm/@serwist+core@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/core/dist/index.js\");\n/* harmony import */ var _chunks_singletonRouter_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./chunks/singletonRouter.js */ \"./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/singletonRouter.js\");\n/* harmony import */ var _chunks_NetworkOnly_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./chunks/NetworkOnly.js */ \"./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/NetworkOnly.js\");\n/* harmony import */ var _chunks_Strategy_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./chunks/Strategy.js */ \"./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/Strategy.js\");\n/* harmony import */ var _chunks_singletonPrecacheController_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./chunks/singletonPrecacheController.js */ \"./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/singletonPrecacheController.js\");\n\n\n\n\n\n\n\n\n\nconst CACHE_UPDATED_MESSAGE_TYPE = \"CACHE_UPDATED\";\nconst CACHE_UPDATED_MESSAGE_META = \"serwist-broadcast-update\";\nconst defaultNotifyAllClients = true;\nconst defaultHeadersToCheck = [\n \"content-length\",\n \"etag\",\n \"last-modified\"\n];\n\nconst responsesAreSame = (firstResponse, secondResponse, headersToCheck)=>{\n if (true) {\n if (!(firstResponse instanceof Response && secondResponse instanceof Response)) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.SerwistError(\"invalid-responses-are-same-args\");\n }\n }\n const atLeastOneHeaderAvailable = headersToCheck.some((header)=>{\n return firstResponse.headers.has(header) && secondResponse.headers.has(header);\n });\n if (!atLeastOneHeaderAvailable) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.warn(\"Unable to determine where the response has been updated because none of the headers that would be checked are present.\");\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.debug(\"Attempting to compare the following: \", firstResponse, secondResponse, headersToCheck);\n }\n return true;\n }\n return headersToCheck.every((header)=>{\n const headerStateComparison = firstResponse.headers.has(header) === secondResponse.headers.has(header);\n const headerValueComparison = firstResponse.headers.get(header) === secondResponse.headers.get(header);\n return headerStateComparison && headerValueComparison;\n });\n};\n\nconst isSafari = typeof navigator !== \"undefined\" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\nconst defaultPayloadGenerator = (data)=>{\n return {\n cacheName: data.cacheName,\n updatedURL: data.request.url\n };\n};\nclass BroadcastCacheUpdate {\n _headersToCheck;\n _generatePayload;\n _notifyAllClients;\n constructor({ generatePayload, headersToCheck, notifyAllClients } = {}){\n this._headersToCheck = headersToCheck || defaultHeadersToCheck;\n this._generatePayload = generatePayload || defaultPayloadGenerator;\n this._notifyAllClients = notifyAllClients ?? defaultNotifyAllClients;\n }\n async notifyIfUpdated(options) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.assert.isType(options.cacheName, \"string\", {\n moduleName: \"@serwist/broadcast-update\",\n className: \"BroadcastCacheUpdate\",\n funcName: \"notifyIfUpdated\",\n paramName: \"cacheName\"\n });\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.assert.isInstance(options.newResponse, Response, {\n moduleName: \"@serwist/broadcast-update\",\n className: \"BroadcastCacheUpdate\",\n funcName: \"notifyIfUpdated\",\n paramName: \"newResponse\"\n });\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.assert.isInstance(options.request, Request, {\n moduleName: \"@serwist/broadcast-update\",\n className: \"BroadcastCacheUpdate\",\n funcName: \"notifyIfUpdated\",\n paramName: \"request\"\n });\n }\n if (!options.oldResponse) {\n return;\n }\n if (!responsesAreSame(options.oldResponse, options.newResponse, this._headersToCheck)) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.log(\"Newer response found (and cached) for:\", options.request.url);\n }\n const messageData = {\n type: CACHE_UPDATED_MESSAGE_TYPE,\n meta: CACHE_UPDATED_MESSAGE_META,\n payload: this._generatePayload(options)\n };\n if (options.request.mode === \"navigate\") {\n let resultingClientId;\n if (options.event instanceof FetchEvent) {\n resultingClientId = options.event.resultingClientId;\n }\n const resultingWin = await (0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.resultingClientExists)(resultingClientId);\n if (!resultingWin || isSafari) {\n await (0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.timeout)(3500);\n }\n }\n if (this._notifyAllClients) {\n const windows = await self.clients.matchAll({\n type: \"window\"\n });\n for (const win of windows){\n win.postMessage(messageData);\n }\n } else {\n if (options.event instanceof FetchEvent) {\n const client = await self.clients.get(options.event.clientId);\n client?.postMessage(messageData);\n }\n }\n }\n }\n}\n\nclass BroadcastUpdatePlugin {\n _broadcastUpdate;\n constructor(options){\n this._broadcastUpdate = new BroadcastCacheUpdate(options);\n }\n cacheDidUpdate(options) {\n void this._broadcastUpdate.notifyIfUpdated(options);\n }\n}\n\nclass CacheableResponse {\n _statuses;\n _headers;\n constructor(config = {}){\n if (true) {\n if (!(config.statuses || config.headers)) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.SerwistError(\"statuses-or-headers-required\", {\n moduleName: \"@serwist/cacheable-response\",\n className: \"CacheableResponse\",\n funcName: \"constructor\"\n });\n }\n if (config.statuses) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.assert.isArray(config.statuses, {\n moduleName: \"@serwist/cacheable-response\",\n className: \"CacheableResponse\",\n funcName: \"constructor\",\n paramName: \"config.statuses\"\n });\n }\n if (config.headers) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.assert.isType(config.headers, \"object\", {\n moduleName: \"@serwist/cacheable-response\",\n className: \"CacheableResponse\",\n funcName: \"constructor\",\n paramName: \"config.headers\"\n });\n }\n }\n this._statuses = config.statuses;\n if (config.headers) {\n this._headers = new Headers(config.headers);\n }\n }\n isResponseCacheable(response) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.assert.isInstance(response, Response, {\n moduleName: \"@serwist/cacheable-response\",\n className: \"CacheableResponse\",\n funcName: \"isResponseCacheable\",\n paramName: \"response\"\n });\n }\n let cacheable = true;\n if (this._statuses) {\n cacheable = this._statuses.includes(response.status);\n }\n if (this._headers && cacheable) {\n for (const [headerName, headerValue] of this._headers.entries()){\n if (response.headers.get(headerName) !== headerValue) {\n cacheable = false;\n break;\n }\n }\n }\n if (true) {\n if (!cacheable) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.groupCollapsed(`The request for '${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.getFriendlyURL)(response.url)}' returned a response that does not meet the criteria for being cached.`);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.groupCollapsed(\"View cacheability criteria here.\");\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.log(`Cacheable statuses: ${JSON.stringify(this._statuses)}`);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.log(`Cacheable headers: ${JSON.stringify(this._headers, null, 2)}`);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.groupEnd();\n const logFriendlyHeaders = {};\n response.headers.forEach((value, key)=>{\n logFriendlyHeaders[key] = value;\n });\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.groupCollapsed(\"View response status and headers here.\");\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.log(`Response status: ${response.status}`);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.log(`Response headers: ${JSON.stringify(logFriendlyHeaders, null, 2)}`);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.groupEnd();\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.groupCollapsed(\"View full response details here.\");\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.log(response.headers);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.log(response);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.groupEnd();\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.groupEnd();\n }\n }\n return cacheable;\n }\n}\n\nclass CacheableResponsePlugin {\n _cacheableResponse;\n constructor(config){\n this._cacheableResponse = new CacheableResponse(config);\n }\n cacheWillUpdate = async ({ response })=>{\n if (this._cacheableResponse.isResponseCacheable(response)) {\n return response;\n }\n return null;\n };\n}\n\nconst DB_NAME = \"serwist-expiration\";\nconst CACHE_OBJECT_STORE = \"cache-entries\";\nconst normalizeURL = (unNormalizedUrl)=>{\n const url = new URL(unNormalizedUrl, location.href);\n url.hash = \"\";\n return url.href;\n};\nclass CacheTimestampsModel {\n _cacheName;\n _db = null;\n constructor(cacheName){\n this._cacheName = cacheName;\n }\n _getId(url) {\n return `${this._cacheName}|${normalizeURL(url)}`;\n }\n _upgradeDb(db) {\n const objStore = db.createObjectStore(CACHE_OBJECT_STORE, {\n keyPath: \"id\"\n });\n objStore.createIndex(\"cacheName\", \"cacheName\", {\n unique: false\n });\n objStore.createIndex(\"timestamp\", \"timestamp\", {\n unique: false\n });\n }\n _upgradeDbAndDeleteOldDbs(db) {\n this._upgradeDb(db);\n if (this._cacheName) {\n void (0,idb__WEBPACK_IMPORTED_MODULE_2__.deleteDB)(this._cacheName);\n }\n }\n async setTimestamp(url, timestamp) {\n url = normalizeURL(url);\n const entry = {\n id: this._getId(url),\n cacheName: this._cacheName,\n url,\n timestamp\n };\n const db = await this.getDb();\n const tx = db.transaction(CACHE_OBJECT_STORE, \"readwrite\", {\n durability: \"relaxed\"\n });\n await tx.store.put(entry);\n await tx.done;\n }\n async getTimestamp(url) {\n const db = await this.getDb();\n const entry = await db.get(CACHE_OBJECT_STORE, this._getId(url));\n return entry?.timestamp;\n }\n async expireEntries(minTimestamp, maxCount) {\n const db = await this.getDb();\n let cursor = await db.transaction(CACHE_OBJECT_STORE, \"readwrite\").store.index(\"timestamp\").openCursor(null, \"prev\");\n const urlsDeleted = [];\n let entriesNotDeletedCount = 0;\n while(cursor){\n const result = cursor.value;\n if (result.cacheName === this._cacheName) {\n if (minTimestamp && result.timestamp < minTimestamp || maxCount && entriesNotDeletedCount >= maxCount) {\n cursor.delete();\n urlsDeleted.push(result.url);\n } else {\n entriesNotDeletedCount++;\n }\n }\n cursor = await cursor.continue();\n }\n return urlsDeleted;\n }\n async getDb() {\n if (!this._db) {\n this._db = await (0,idb__WEBPACK_IMPORTED_MODULE_2__.openDB)(DB_NAME, 1, {\n upgrade: this._upgradeDbAndDeleteOldDbs.bind(this)\n });\n }\n return this._db;\n }\n}\n\nclass CacheExpiration {\n _isRunning = false;\n _rerunRequested = false;\n _maxEntries;\n _maxAgeSeconds;\n _matchOptions;\n _cacheName;\n _timestampModel;\n constructor(cacheName, config = {}){\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.assert.isType(cacheName, \"string\", {\n moduleName: \"@serwist/expiration\",\n className: \"CacheExpiration\",\n funcName: \"constructor\",\n paramName: \"cacheName\"\n });\n if (!(config.maxEntries || config.maxAgeSeconds)) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.SerwistError(\"max-entries-or-age-required\", {\n moduleName: \"@serwist/expiration\",\n className: \"CacheExpiration\",\n funcName: \"constructor\"\n });\n }\n if (config.maxEntries) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.assert.isType(config.maxEntries, \"number\", {\n moduleName: \"@serwist/expiration\",\n className: \"CacheExpiration\",\n funcName: \"constructor\",\n paramName: \"config.maxEntries\"\n });\n }\n if (config.maxAgeSeconds) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.assert.isType(config.maxAgeSeconds, \"number\", {\n moduleName: \"@serwist/expiration\",\n className: \"CacheExpiration\",\n funcName: \"constructor\",\n paramName: \"config.maxAgeSeconds\"\n });\n }\n }\n this._maxEntries = config.maxEntries;\n this._maxAgeSeconds = config.maxAgeSeconds;\n this._matchOptions = config.matchOptions;\n this._cacheName = cacheName;\n this._timestampModel = new CacheTimestampsModel(cacheName);\n }\n async expireEntries() {\n if (this._isRunning) {\n this._rerunRequested = true;\n return;\n }\n this._isRunning = true;\n const minTimestamp = this._maxAgeSeconds ? Date.now() - this._maxAgeSeconds * 1000 : 0;\n const urlsExpired = await this._timestampModel.expireEntries(minTimestamp, this._maxEntries);\n const cache = await self.caches.open(this._cacheName);\n for (const url of urlsExpired){\n await cache.delete(url, this._matchOptions);\n }\n if (true) {\n if (urlsExpired.length > 0) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.groupCollapsed(`Expired ${urlsExpired.length} ` + `${urlsExpired.length === 1 ? \"entry\" : \"entries\"} and removed ` + `${urlsExpired.length === 1 ? \"it\" : \"them\"} from the ` + `'${this._cacheName}' cache.`);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.log(`Expired the following ${urlsExpired.length === 1 ? \"URL\" : \"URLs\"}:`);\n for (const url of urlsExpired){\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.log(` ${url}`);\n }\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.groupEnd();\n } else {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.debug(\"Cache expiration ran and found no entries to remove.\");\n }\n }\n this._isRunning = false;\n if (this._rerunRequested) {\n this._rerunRequested = false;\n void this.expireEntries();\n }\n }\n async updateTimestamp(url) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.assert.isType(url, \"string\", {\n moduleName: \"@serwist/expiration\",\n className: \"CacheExpiration\",\n funcName: \"updateTimestamp\",\n paramName: \"url\"\n });\n }\n await this._timestampModel.setTimestamp(url, Date.now());\n }\n async isURLExpired(url) {\n if (!this._maxAgeSeconds) {\n if (true) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.SerwistError(\"expired-test-without-max-age\", {\n methodName: \"isURLExpired\",\n paramName: \"maxAgeSeconds\"\n });\n }\n return false;\n }\n const timestamp = await this._timestampModel.getTimestamp(url);\n const expireOlderThan = Date.now() - this._maxAgeSeconds * 1000;\n return timestamp !== undefined ? timestamp < expireOlderThan : true;\n }\n async delete() {\n this._rerunRequested = false;\n await this._timestampModel.expireEntries(Number.POSITIVE_INFINITY);\n }\n}\n\nclass ExpirationPlugin {\n _config;\n _cacheExpirations;\n constructor(config = {}){\n if (true) {\n if (!(config.maxEntries || config.maxAgeSeconds)) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.SerwistError(\"max-entries-or-age-required\", {\n moduleName: \"@serwist/expiration\",\n className: \"ExpirationPlugin\",\n funcName: \"constructor\"\n });\n }\n if (config.maxEntries) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.assert.isType(config.maxEntries, \"number\", {\n moduleName: \"@serwist/expiration\",\n className: \"ExpirationPlugin\",\n funcName: \"constructor\",\n paramName: \"config.maxEntries\"\n });\n }\n if (config.maxAgeSeconds) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.assert.isType(config.maxAgeSeconds, \"number\", {\n moduleName: \"@serwist/expiration\",\n className: \"ExpirationPlugin\",\n funcName: \"constructor\",\n paramName: \"config.maxAgeSeconds\"\n });\n }\n if (config.maxAgeFrom) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.assert.isType(config.maxAgeFrom, \"string\", {\n moduleName: \"@serwist/expiration\",\n className: \"ExpirationPlugin\",\n funcName: \"constructor\",\n paramName: \"config.maxAgeFrom\"\n });\n }\n }\n this._config = config;\n this._cacheExpirations = new Map();\n if (!this._config.maxAgeFrom) {\n this._config.maxAgeFrom = \"last-fetched\";\n }\n if (this._config.purgeOnQuotaError) {\n (0,_serwist_core__WEBPACK_IMPORTED_MODULE_3__.registerQuotaErrorCallback)(()=>this.deleteCacheAndMetadata());\n }\n }\n _getCacheExpiration(cacheName) {\n if (cacheName === _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.privateCacheNames.getRuntimeName()) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.SerwistError(\"expire-custom-caches-only\");\n }\n let cacheExpiration = this._cacheExpirations.get(cacheName);\n if (!cacheExpiration) {\n cacheExpiration = new CacheExpiration(cacheName, this._config);\n this._cacheExpirations.set(cacheName, cacheExpiration);\n }\n return cacheExpiration;\n }\n cachedResponseWillBeUsed({ event, cacheName, request, cachedResponse }) {\n if (!cachedResponse) {\n return null;\n }\n const isFresh = this._isResponseDateFresh(cachedResponse);\n const cacheExpiration = this._getCacheExpiration(cacheName);\n const isMaxAgeFromLastUsed = this._config.maxAgeFrom === \"last-used\";\n const done = (async ()=>{\n if (isMaxAgeFromLastUsed) {\n await cacheExpiration.updateTimestamp(request.url);\n }\n await cacheExpiration.expireEntries();\n })();\n try {\n event.waitUntil(done);\n } catch (error) {\n if (true) {\n if (event instanceof FetchEvent) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.warn(`Unable to ensure service worker stays alive when updating cache entry for '${(0,_serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.getFriendlyURL)(event.request.url)}'.`);\n }\n }\n }\n return isFresh ? cachedResponse : null;\n }\n _isResponseDateFresh(cachedResponse) {\n const isMaxAgeFromLastUsed = this._config.maxAgeFrom === \"last-used\";\n if (isMaxAgeFromLastUsed) {\n return true;\n }\n const now = Date.now();\n if (!this._config.maxAgeSeconds) {\n return true;\n }\n const dateHeaderTimestamp = this._getDateHeaderTimestamp(cachedResponse);\n if (dateHeaderTimestamp === null) {\n return true;\n }\n return dateHeaderTimestamp >= now - this._config.maxAgeSeconds * 1000;\n }\n _getDateHeaderTimestamp(cachedResponse) {\n if (!cachedResponse.headers.has(\"date\")) {\n return null;\n }\n const dateHeader = cachedResponse.headers.get(\"date\");\n const parsedDate = new Date(dateHeader);\n const headerTime = parsedDate.getTime();\n if (Number.isNaN(headerTime)) {\n return null;\n }\n return headerTime;\n }\n async cacheDidUpdate({ cacheName, request }) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.assert.isType(cacheName, \"string\", {\n moduleName: \"@serwist/expiration\",\n className: \"Plugin\",\n funcName: \"cacheDidUpdate\",\n paramName: \"cacheName\"\n });\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.assert.isInstance(request, Request, {\n moduleName: \"@serwist/expiration\",\n className: \"Plugin\",\n funcName: \"cacheDidUpdate\",\n paramName: \"request\"\n });\n }\n const cacheExpiration = this._getCacheExpiration(cacheName);\n await cacheExpiration.updateTimestamp(request.url);\n await cacheExpiration.expireEntries();\n }\n async deleteCacheAndMetadata() {\n for (const [cacheName, cacheExpiration] of this._cacheExpirations){\n await self.caches.delete(cacheName);\n await cacheExpiration.delete();\n }\n this._cacheExpirations = new Map();\n }\n}\n\nconst calculateEffectiveBoundaries = (blob, start, end)=>{\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.assert.isInstance(blob, Blob, {\n moduleName: \"@serwist/range-requests\",\n funcName: \"calculateEffectiveBoundaries\",\n paramName: \"blob\"\n });\n }\n const blobSize = blob.size;\n if (end && end > blobSize || start && start < 0) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.SerwistError(\"range-not-satisfiable\", {\n size: blobSize,\n end,\n start\n });\n }\n let effectiveStart;\n let effectiveEnd;\n if (start !== undefined && end !== undefined) {\n effectiveStart = start;\n effectiveEnd = end + 1;\n } else if (start !== undefined && end === undefined) {\n effectiveStart = start;\n effectiveEnd = blobSize;\n } else if (end !== undefined && start === undefined) {\n effectiveStart = blobSize - end;\n effectiveEnd = blobSize;\n }\n return {\n start: effectiveStart,\n end: effectiveEnd\n };\n};\n\nconst parseRangeHeader = (rangeHeader)=>{\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.assert.isType(rangeHeader, \"string\", {\n moduleName: \"@serwist/range-requests\",\n funcName: \"parseRangeHeader\",\n paramName: \"rangeHeader\"\n });\n }\n const normalizedRangeHeader = rangeHeader.trim().toLowerCase();\n if (!normalizedRangeHeader.startsWith(\"bytes=\")) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.SerwistError(\"unit-must-be-bytes\", {\n normalizedRangeHeader\n });\n }\n if (normalizedRangeHeader.includes(\",\")) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.SerwistError(\"single-range-only\", {\n normalizedRangeHeader\n });\n }\n const rangeParts = /(\\d*)-(\\d*)/.exec(normalizedRangeHeader);\n if (!rangeParts || !(rangeParts[1] || rangeParts[2])) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.SerwistError(\"invalid-range-values\", {\n normalizedRangeHeader\n });\n }\n return {\n start: rangeParts[1] === \"\" ? undefined : Number(rangeParts[1]),\n end: rangeParts[2] === \"\" ? undefined : Number(rangeParts[2])\n };\n};\n\nconst createPartialResponse = async (request, originalResponse)=>{\n try {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.assert.isInstance(request, Request, {\n moduleName: \"@serwist/range-requests\",\n funcName: \"createPartialResponse\",\n paramName: \"request\"\n });\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.assert.isInstance(originalResponse, Response, {\n moduleName: \"@serwist/range-requests\",\n funcName: \"createPartialResponse\",\n paramName: \"originalResponse\"\n });\n }\n if (originalResponse.status === 206) {\n return originalResponse;\n }\n const rangeHeader = request.headers.get(\"range\");\n if (!rangeHeader) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.SerwistError(\"no-range-header\");\n }\n const boundaries = parseRangeHeader(rangeHeader);\n const originalBlob = await originalResponse.blob();\n const effectiveBoundaries = calculateEffectiveBoundaries(originalBlob, boundaries.start, boundaries.end);\n const slicedBlob = originalBlob.slice(effectiveBoundaries.start, effectiveBoundaries.end);\n const slicedBlobSize = slicedBlob.size;\n const slicedResponse = new Response(slicedBlob, {\n status: 206,\n statusText: \"Partial Content\",\n headers: originalResponse.headers\n });\n slicedResponse.headers.set(\"Content-Length\", String(slicedBlobSize));\n slicedResponse.headers.set(\"Content-Range\", `bytes ${effectiveBoundaries.start}-${effectiveBoundaries.end - 1}/` + `${originalBlob.size}`);\n return slicedResponse;\n } catch (error) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.warn(\"Unable to construct a partial response; returning a \" + \"416 Range Not Satisfiable response instead.\");\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.groupCollapsed(\"View details here.\");\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.log(error);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.log(request);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.log(originalResponse);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_1__.logger.groupEnd();\n }\n return new Response(\"\", {\n status: 416,\n statusText: \"Range Not Satisfiable\"\n });\n }\n};\n\nclass RangeRequestsPlugin {\n cachedResponseWillBeUsed = async ({ request, cachedResponse })=>{\n if (cachedResponse && request.headers.has(\"range\")) {\n return await createPartialResponse(request, cachedResponse);\n }\n return cachedResponse;\n };\n}\n\n\n//# sourceURL=[module]\n//# sourceM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QgKGFuZCBjYWNoZWQpIGZvcjpcIiwgb3B0aW9ucy5yZXF1ZXN0LnVybCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb25zdCBtZXNzYWdlRGF0YSA9IHtcbiAgICAgICAgICAgICAgICB0eXBlOiBDQUNIRV9VUERBVEVEX01FU1NBR0VfVFlQRSxcbiAgICAgICAgICAgICAgICBtZXRhOiBDQUNIRV9VUERBVEVEX01FU1NBR0VfTUVUQSxcbiAgICAgICAgICAgICAgICBwYXlsb2FkOiB0aGlzLl9nZW5lcmF0ZVBheWxvYWQob3B0aW9ucylcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBpZiAob3B0aW9ucy5yZXF1ZXN0Lm1vZGUgPT09IFwibmF2aWdhdGVcIikge1xuICAgICAgICAgICAgICAgIGxldCByZXN1bHRpbmdDbGllbnRJZDtcbiAgICAgICAgICAgICAgICBpZiAob3B0aW9ucy5ldmVudCBpbnN0YW5jZW9mIEZldGNoRXZlbnQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0aW5nQ2xpZW50SWQgPSBvcHRpb25zLmV2ZW50LnJlc3VsdGluZ0NsaWVudElkO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjb25zdCByZXN1bHRpbmdXaW4gPSBhd2FpdCByZXN1bHRpbmdDbGllbnRFeGlzdHMocmVzdWx0aW5nQ2xpZW50SWQpO1xuICAgICAgICAgICAgICAgIGlmICghcmVzdWx0aW5nV2luIHx8IGlzU2FmYXJpKSB7XG4gICAgICAgICAgICAgICAgICAgIGF3YWl0IHRpbWVvdXQoMzUwMCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHRoaXMuX25vdGlmeUFsbENsaWVudHMpIHtcbiAgICAgICAgICAgICAgICBjb25zdCB3aW5kb3dzID0gYXdhaXQgc2VsZi5jbGllbnRzLm1hdGNoQWxsKHtcbiAgICAgICAgICAgICAgICAgICAgdHl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cbiAgICAgICAgICAgIGlmICghKGNvbmZpZy5zdGF0dXNlcyB8fCBjb25maWcuaGVhZGVycykpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwic3RhdHVzZXMtb3ItaGVhZGVycy1yZXF1aXJlZFwiLCB7XG4gICAgICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3QvY2FjaGVhYmxlLXJlc3BvbnNlXCIsXG4gICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJDYWNoZWFibGVSZXNwb25zZVwiLFxuICAgICAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJjb25zdHJ1Y3RvclwiXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoY29uZmlnLnN0YXR1c2VzKSB7XG4gICAgICAgICAgICAgICAgYXNzZXJ0LmlzQXJyYXkoY29uZmlnLnN0YXR1c2VzLCB7XG4gICAgICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3QvY2FjaGVhYmxlLXJlc3BvbnNlXCIsXG4gICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJDYWNoZWFibGVSZXNwb25zZVwiLFxuICAgICAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJjb25zdHJ1Y3RvclwiLFxuICAgICAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwiY29uZmlnLnN0YXR1c2VzXCJcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChjb25maWcuaGVhZGVycykge1xuICAgICAgICAgICAgICAgIGFzc2VydC5pc1R5cGUoY29uZmlnLmhlYWRlcnMsIFwib2JqZWN0XCIsIHtcbiAgICAgICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJAc2Vyd2lzdC9jYWNoZWFibGUtcmVzcG9uc2VcIixcbiAgICAgICAgICAgICAgICAgICAgY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AgICB9XG4gICAgICAgIGlmICh0aGlzLl9oZWFkZXJzICYmIGNhY2hlYWJsZSkge1xuICAgICAgICAgICAgZm9yIChjb25zdCBbaGVhZGVyTmFtZSwgaGVhZGVyVmFsdWVdIG9mIHRoaXMuX2hlYWRlcnMuZW50cmllcygpKXtcbiAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2UuaGVhZGVycy5nZXQoaGVhZGVyTmFtZSkgIT09IGhlYWRlclZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIGNhY2hlYWJsZSA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgaWYgKCFjYWNoZWFibGUpIHtcbiAgICAgICAgICAgICAgICBsb2dnZXIuZ3JvdXBDb2xsYXBzZWQoYFRoZSByZXF1ZXN0IGZvciAnJHtnZXRGcmllbmRseVVSTChyZXNwb25zZS51cmwpfScgcmV0dXJuZWQgYSByZXNwb25zZSB0aGF0IGRvZXMgbm90IG1lZXQgdGhlIGNyaXRlcmlhIGZvciBiZWluZyBjYWNoZWQuYCk7XG4gICAgICAgICAgICAgICAgbG9nZ2VyLmdyb3VwQ29sbGFwc2VkKFwiVmlldyBjYWNoZWFiaWxpdHkgY3JpdGVyaWEgaGVyZS5cIik7XG4gICAgICAgICAgICAgICAgbG9nZ2VyLmxvZyhgQ2FjaGVhYmxlIHN0YXR1c2VzOiAke0pTT04uc3RyaW5naWZ5KHRoaXMuX3N0YXR1c2VzKX1gKTtcbiAgICAgICAgICAgICAgICBsb2dnZXIubG9nKGBDYWNoZWFibGUgaGVhZGVyczogJHtKU09OLnN0cmluZ2lmeSh0aGlzLl9oZWFkZXJzLCBudWxsLCAyKX1gKTtcbiAgICAgICAgICAgICAgICBsb2dnZXIuZ3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HNEZWxldGVkLnB1c2gocmVzdWx0LnVybCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgZW50cmllc05vdERlbGV0ZWRDb3VudCsrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGN1cnNvciA9IGF3YWl0IGN1cnNvci5jb250aW51ZSgpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB1cmxzRGVsZXRlZDtcbiAgICB9XG4gICAgYXN5bmMgZ2V0RGIoKSB7XG4gICAgICAgIGlmICghdGhpcy5fZGIpIHtcbiAgICAgICAgICAgIHRoaXMuX2RiID0gYXdhaXQgb3BlbkRCKERCX05BTUUsIDEsIHtcbiAgICAgICAgICAgICAgICB1cGdyYWRlOiB0aGlzLl91cGdyYWRlRGJBbmREZWxldGVPbGREYnMuYmluZCh0aGlzKVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRoaXMuX2RiO1xuICAgIH1cbn1cblxuY2xhc3MgQ2FjaGVFeHBpcmF0aW9uIHtcbiAgICBfaXNSdW5uaW5nID0gZmFsc2U7XG4gICAgX3JlcnVuUmVxdWVzdGVkID0gZmFsc2U7XG4gICAgX21heEVudHJpZXM7XG4gICAgX21heEFnZVNlY29uZHM7XG4gICAgX21hdGNoT3B0aW9ucztcbiAgICBfY2FjaGVOYW1lO1xuICAgIF90aW1lc3RhbXBNb2RlbDtcbiAgICBjb25zdHJ1Y3RvcihjYWNoZU5hbWUsIGNvbmZpZyA9IHt9KXtcbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgYXNzZXJ0LmlzVHlwZShjYWNoZU5hbWUsIFwic3RyaW5nXCIsIHtcbiAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiBcIkBzZXJ3aXN0L2V4cGlyYXRpb25cIixcbiAgICAgICAgICAgICAgICBjbGFzc05hbWU6IFwiQ2FjaGVFeHBpcmF0aW9uXCIsXG4gICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiY29uc3RydWN0b3JcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwiY2FjaGVOYW1lXCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgaWYgKCEoY29uZmlnLm1heEVudHJpZXMgfHwgY29uZmlnLm1heEFnZVNlY29uZHMpKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IFNlcndpc3RFcnJvcihcIm1heC1lbnRyaWVzLW9yLWFnZS1yZXF1aXJlZFwiLCB7XG4gICAgICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3QvZXhwaXJhdGlvblwiLFxuICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6IFwiQ2FjaGVFeHBpcmF0aW9uXCIsXG4gICAgICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcImNvbnN0cnVjdG9yXCJcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChjb25maWcubWF4RW50cmllcykge1xuICAgICAgICAgICAgICAgIGFzc2VydC5pc1R5cGUoY29uZmlnLm1heEVudHJpZXMsIFwibnVtYmVyXCIsIHtcbiAgICAgICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJAc2Vyd2lzdC9leHBpcmF0aW9uXCIsXG4gICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJDYWNoZUV4cGlyYXRpb25cIixcbiAgICAgICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiY29uc3RydWN0b3JcIixcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcImNvbmZpZy5tYXhFbnRyaWVzXCJcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChjb25maWcubWF4QWdlU2Vjb25kcykge1xuICAgICAgICAgICAgICAgIGFzc2VydC5pc1R5cGUoY29uZmlnLm1heEFnZVNlY29uZHMsIFwibnVtYmVyXCIsIHtcbiAgICAgICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJAc2Vyd2lzdC9leHBpcmF0aW9uXCIsXG4gICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJDYWNoZUV4cGlyYXRpb25cIixcbiAgICAgICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiY29uc3RydWN0b3JcIixcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcImNvbmZpZy5tYXhBZ2VTZWNvbmRzXCJcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICB0aGlzLl9tYXhFbnRyaWVzID0gY29uZmlnLm1heEVudHJpZXM7XG4gICAgICAgIHRoaXMuX21heEFnZVNlY29uZHMgPSBjb25maWcubWF4QWdlU2Vjb25kcztcbiAgICAgICAgdGhpcy5fbWF0Y2hPcHRpb25zID0gY29uZmlnLm1hdGNoT3B0aW9ucztcbiAgICAgICAgdGhpcy5fY2FjaGVOYW1lID0gY2FjaGVOYW1lO1xuICAgICAgICB0aGlzLl90aW1lc3RhbXBNb2RlbCA9IG5ldyBDYWNoZVRpbWVzdGFtcHNNb2RlbChjYWNoZU5hbWUpO1xuICAgIH1cbiAgICBhc3luYyBleHBpcmVFbnRyaWVzKCkge1xuICAgICAgICBpZiAodGhpcy5faXNSdW5uaW5nKSB7XG4gICAgICAgICAgICB0aGlzLl9yZXJ1blJlcXVlc3RlZCA9IHRydWU7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5faXNSdW5uaW5nID0gdHJ1ZTtcbiAgICAgICAgY29uc3QgbWluVGltZXN0YW1wID0gdGhpcy5fbWF4QWdlU2Vjb25kcyA/IERhdGUubm93KCkgLSB0aGlzLl9tYXhBZ2VTZWNvbmRzICogMTAwMCA6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9XG4gICAgICAgICAgICAgICAgbG9nZ2VyLmdyb3VwRW5kKCk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGxvZ2dlci5kZWJ1ZyhcIkNhY2hlIGV4cGlyYXRpb24gcmFuIGFuZCBmb3VuZCBubyBlbnRyaWVzIHRvIHJlbW92ZS5cIik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5faXNSdW5uaW5nID0gZmFsc2U7XG4gICAgICAgIGlmICh0aGlzLl9yZXJ1blJlcXVlc3RlZCkge1xuICAgICAgICAgICAgdGhpcy5fcmVydW5SZXF1ZXN0ZWQgPSBmYWxzZTtcbiAgICAgICAgICAgIHZvaWQgdGhpcy5leHBpcmVFbnRyaWVzKCk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgYXN5bmMgdXBkYXRlVGltZXN0YW1wKHVybCkge1xuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBhc3NlcnQuaXNUeXBlKHVybCwgXCJzdHJpbmdcIiwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3QvZXhwaXJhdGlvblwiLFxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJDYWNoZUV4cGlyYXRpb25cIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJ1cGRhdGVUaW1lc3RhbXBcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwidXJsXCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGF3YWl0IHRoaXMuX3RpbWVzdGFtcE1vZGVsLnNldFRpbWVzdGFtcCh1cmwsIERhdGUubm93KCkpO1xuICAgIH1cbiAgICBhc3luYyBpc1VSTEV4cGlyZWQodXJsKSB7XG4gICAgICAgIGlmICghdGhpcy5fbWF4QWdlU2Vjb25kcykge1xuICAgICAg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uXCIpIHtcbiAgICAgICAgICAgIGlmICghKGNvbmZpZy5tYXhFbnRyaWVzIHx8IGNvbmZpZy5tYXhBZ2VTZWNvbmRzKSkge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBTZXJ3aXN0RXJyb3IoXCJtYXgtZW50cmllcy1vci1hZ2UtcmVxdWlyZWRcIiwge1xuICAgICAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiBcIkBzZXJ3aXN0L2V4cGlyYXRpb25cIixcbiAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIkV4cGlyYXRpb25QbHVnaW5cIixcbiAgICAgICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiY29uc3RydWN0b3JcIlxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGNvbmZpZy5tYXhFbnRyaWVzKSB7XG4gICAgICAgICAgICAgICAgYXNzZXJ0LmlzVHlwZShjb25maWcubWF4RW50cmllcywgXCJudW1iZXJcIiwge1xuICAgICAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiBcIkBzZXJ3aXN0L2V4cGlyYXRpb25cIixcbiAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIkV4cGlyYXRpb25QbHVnaW5cIixcbiAgICAgICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiY29uc3RydWN0b3JcIixcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcImNvbmZpZy5tYXhFbnRyaWVzXCJcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChjb25maWcubWF4QWdlU2Vjb25kcykge1xuICAgICAgICAgICAgICAgIGFzc2VydC5pc1R5cGUoY29uZmlnLm1heEFnZVNlY29uZHMsIFwibnVtYmVyXCIsIHtcbiAgICAgICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJAc2Vyd2lzdC9leHBpcmF0aW9uXCIsXG4gICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJFeHBpcmF0aW9uUGx1Z2luXCIsXG4gICAgICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcImNvbnN0cnVjdG9yXCIsXG4gICAgICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJjb25maWcubWF4QWdlU2Vjb25kc1wiXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoY29uZmlnLm1heEFnZUZyb20pIHtcbiAgICAgICAgICAgICAgICBhc3NlcnQuaXNUeXBlKGNvbmZpZy5tYXhBZ2VGcm9tLCBcInN0cmluZ1wiLCB7XG4gICAgICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3QvZXhwaXJhdGlvblwiLFxuICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6IFwiRXhwaXJhdGlvblBsdWdpblwiLFxuICAgICAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJjb25zdHJ1Y3RvclwiLFxuICAgICAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwiY29uZmlnLm1heEFnZUZyb21cIlxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHRoaXMuX2NvbmZpZyA9IGNvbmZpZztcbiAgICAgICAgdGhpcy5fY2FjaGVFeHBpcmF0aW9ucyA9IG5ldyBNYXAoKTtcbiAgICAgICAgaWYgKCF0aGlzLl9jb25maWcubWF4QWdlRnJvbSkge1xuICAgICAgICAgICAgdGhpcy5fY29uZmlnLm1heEFnZUZyb20gPSBcImxhc3QtZmV0Y2hlZFwiO1xuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLl9jb25maWcucHVyZ2VPblF1b3RhRXJyb3IpIHtcbiAgICAgICAgICAgIHJlZ2lzdGVyUXVvdGFFcnJvckNhbGxiYWNrKCgpPT50aGlzLmRlbGV0ZUNhY2hlQW5kTWV0YWRhdGEoKSk7X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ybiBhd2FpdCBjcmVhdGVQYXJ0aWFsUmVzcG9uc2UocmVxdWVzdCwgY2FjaGVkUmVzcG9uc2UpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBjYWNoZWRSZXNwb25zZTtcbiAgICB9O1xufVxuXG5leHBvcnQgeyBkZWZhdWx0SGVhZGVyc1RvQ2hlY2sgYXMgQlJPQURDQVNUX1VQREFURV9ERUZBVUxUX0hFQURFUlMsIENBQ0hFX1VQREFURURfTUVTU0FHRV9NRVRBIGFzIEJST0FEQ0FTVF9VUERBVEVfTUVTU0FHRV9NRVRBLCBDQUNIRV9VUERBVEVEX01FU1NBR0VfVFlQRSBhcyBCUk9BRENBU1RfVVBEQVRFX01FU1NBR0VfVFlQRSwgQnJvYWRjYXN0Q2FjaGVVcGRhdGUsIEJyb2FkY2FzdFVwZGF0ZVBsdWdpbiwgQ2FjaGVFeHBpcmF0aW9uLCBDYWNoZWFibGVSZXNwb25zZSwgQ2FjaGVhYmxlUmVzcG9uc2VQbHVnaW4sIEV4cGlyYXRpb25QbHVnaW4sIFJhbmdlUmVxdWVzdHNQbHVnaW4sIGNyZWF0ZVBhcnRpYWxSZXNwb25zZSwgcmVzcG9uc2VzQXJlU2FtZSB9O1xuIl0sIm5hbWVzIjpbXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/index.plugins.js\n")); + +/***/ }), + +/***/ "./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/index.strategies.js": +/*!****************************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/index.strategies.js ***! + \****************************************************************************************************************************/ +/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CacheFirst: function() { return /* binding */ CacheFirst; },\n/* harmony export */ CacheOnly: function() { return /* binding */ CacheOnly; },\n/* harmony export */ NetworkFirst: function() { return /* reexport safe */ _chunks_NetworkOnly_js__WEBPACK_IMPORTED_MODULE_2__.a; },\n/* harmony export */ NetworkOnly: function() { return /* reexport safe */ _chunks_NetworkOnly_js__WEBPACK_IMPORTED_MODULE_2__.N; },\n/* harmony export */ StaleWhileRevalidate: function() { return /* binding */ StaleWhileRevalidate; },\n/* harmony export */ Strategy: function() { return /* reexport safe */ _chunks_Strategy_js__WEBPACK_IMPORTED_MODULE_1__.S; },\n/* harmony export */ StrategyHandler: function() { return /* reexport safe */ _chunks_Strategy_js__WEBPACK_IMPORTED_MODULE_1__.a; }\n/* harmony export */ });\n/* harmony import */ var _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @serwist/core/internal */ \"./node_modules/.pnpm/@serwist+core@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/core/dist/index.internal.js\");\n/* harmony import */ var _chunks_Strategy_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./chunks/Strategy.js */ \"./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/Strategy.js\");\n/* harmony import */ var _chunks_NetworkOnly_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./chunks/NetworkOnly.js */ \"./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/chunks/NetworkOnly.js\");\n\n\n\n\n\n\nclass CacheFirst extends _chunks_Strategy_js__WEBPACK_IMPORTED_MODULE_1__.S {\n async _handle(request, handler) {\n const logs = [];\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isInstance(request, Request, {\n moduleName: \"@serwist/strategies\",\n className: this.constructor.name,\n funcName: \"makeRequest\",\n paramName: \"request\"\n });\n }\n let response = await handler.cacheMatch(request);\n let error = undefined;\n if (!response) {\n if (true) {\n logs.push(`No response found in the '${this.cacheName}' cache. Will respond with a network request.`);\n }\n try {\n response = await handler.fetchAndCachePut(request);\n } catch (err) {\n if (err instanceof Error) {\n error = err;\n }\n }\n if (true) {\n if (response) {\n logs.push(\"Got response from network.\");\n } else {\n logs.push(\"Unable to get a response from the network.\");\n }\n }\n } else {\n if (true) {\n logs.push(`Found a cached response in the '${this.cacheName}' cache.`);\n }\n }\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupCollapsed(_chunks_NetworkOnly_js__WEBPACK_IMPORTED_MODULE_2__.m.strategyStart(this.constructor.name, request));\n for (const log of logs){\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(log);\n }\n _chunks_NetworkOnly_js__WEBPACK_IMPORTED_MODULE_2__.m.printFinalResponse(response);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupEnd();\n }\n if (!response) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"no-response\", {\n url: request.url,\n error\n });\n }\n return response;\n }\n}\n\nclass CacheOnly extends _chunks_Strategy_js__WEBPACK_IMPORTED_MODULE_1__.S {\n async _handle(request, handler) {\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isInstance(request, Request, {\n moduleName: \"@serwist/strategies\",\n className: this.constructor.name,\n funcName: \"makeRequest\",\n paramName: \"request\"\n });\n }\n const response = await handler.cacheMatch(request);\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupCollapsed(_chunks_NetworkOnly_js__WEBPACK_IMPORTED_MODULE_2__.m.strategyStart(this.constructor.name, request));\n if (response) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(`Found a cached response in the '${this.cacheName}' cache.`);\n _chunks_NetworkOnly_js__WEBPACK_IMPORTED_MODULE_2__.m.printFinalResponse(response);\n } else {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(`No response found in the '${this.cacheName}' cache.`);\n }\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupEnd();\n }\n if (!response) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"no-response\", {\n url: request.url\n });\n }\n return response;\n }\n}\n\nclass StaleWhileRevalidate extends _chunks_Strategy_js__WEBPACK_IMPORTED_MODULE_1__.S {\n constructor(options = {}){\n super(options);\n if (!this.plugins.some((p)=>\"cacheWillUpdate\" in p)) {\n this.plugins.unshift(_chunks_NetworkOnly_js__WEBPACK_IMPORTED_MODULE_2__.c);\n }\n }\n async _handle(request, handler) {\n const logs = [];\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.assert.isInstance(request, Request, {\n moduleName: \"@serwist/strategies\",\n className: this.constructor.name,\n funcName: \"handle\",\n paramName: \"request\"\n });\n }\n const fetchAndCachePromise = handler.fetchAndCachePut(request).catch(()=>{});\n void handler.waitUntil(fetchAndCachePromise);\n let response = await handler.cacheMatch(request);\n let error = undefined;\n if (response) {\n if (true) {\n logs.push(`Found a cached response in the '${this.cacheName}' cache. Will update with the network response in the background.`);\n }\n } else {\n if (true) {\n logs.push(`No response found in the '${this.cacheName}' cache. Will wait for the network response.`);\n }\n try {\n response = await fetchAndCachePromise;\n } catch (err) {\n if (err instanceof Error) {\n error = err;\n }\n }\n }\n if (true) {\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupCollapsed(_chunks_NetworkOnly_js__WEBPACK_IMPORTED_MODULE_2__.m.strategyStart(this.constructor.name, request));\n for (const log of logs){\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.log(log);\n }\n _chunks_NetworkOnly_js__WEBPACK_IMPORTED_MODULE_2__.m.printFinalResponse(response);\n _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.logger.groupEnd();\n }\n if (!response) {\n throw new _serwist_core_internal__WEBPACK_IMPORTED_MODULE_0__.SerwistError(\"no-response\", {\n url: request.url,\n error\n });\n }\n return response;\n }\n}\n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vQHNlcndpc3Qrc3dAOS4wLjAtcHJldmlldy4yMV90eXBlc2NyaXB0QDUuNC41L25vZGVfbW9kdWxlcy9Ac2Vyd2lzdC9zdy9kaXN0L2luZGV4LnN0cmF0ZWdpZXMuanMiLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7OztBQUFzRTtBQUNqQjtBQUNPO0FBQ3lCO0FBQ1A7O0FBRTlFLHlCQUF5QixrREFBUTtBQUNqQztBQUNBO0FBQ0EsWUFBWSxJQUFxQztBQUNqRCxZQUFZLDBEQUFNO0FBQ2xCO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsYUFBYTtBQUNiO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsZ0JBQWdCLElBQXFDO0FBQ3JELHVEQUF1RCxlQUFlO0FBQ3RFO0FBQ0E7QUFDQTtBQUNBLGNBQWM7QUFDZDtBQUNBO0FBQ0E7QUFDQTtBQUNBLGdCQUFnQixJQUFxQztBQUNyRDtBQUNBO0FBQ0Esa0JBQWtCO0FBQ2xCO0FBQ0E7QUFDQTtBQUNBLFVBQVU7QUFDVixnQkFBZ0IsSUFBcUM7QUFDckQsNkRBQTZELGVBQWU7QUFDNUU7QUFDQTtBQUNBLFlBQVksSUFBcUM7QUFDakQsWUFBWSwwREFBTSxnQkFBZ0IscURBQVE7QUFDMUM7QUFDQSxnQkFBZ0IsMERBQU07QUFDdEI7QUFDQSxZQUFZLHFEQUFRO0FBQ3BCLFlBQVksMERBQU07QUFDbEI7QUFDQTtBQUNBLHNCQUFzQixnRUFBWTtBQUNsQztBQUNBO0FBQ0EsYUFB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ShyZXF1ZXN0LCBSZXF1ZXN0LCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJAc2Vyd2lzdC9zdHJhdGVnaWVzXCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiB0aGlzLmNvbnN0cnVjdG9yLm5hbWUsXG4gICAgICAgICAgICAgICAgZnVuY05hbWU6IFwibWFrZVJlcXVlc3RcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwicmVxdWVzdFwiXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICBsZXQgcmVzcG9uc2UgPSBhd2FpdCBoYW5kbGVyLmNhY2hlTWF0Y2gocmVxdWVzdCk7XG4gICAgICAgIGxldCBlcnJvciA9IHVuZGVmaW5lZDtcbiAgICAgICAgaWYgKCFyZXNwb25zZSkge1xuICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgIGxvZ3MucHVzaChgTm8gcmVzcG9uc2UgZm91bmQgaW4gdGhlICcke3RoaXMuY2FjaGVOYW1lfScgY2FjaGUuIFdpbGwgcmVzcG9uZCB3aXRoIGEgbmV0d29yayByZXF1ZXN0LmApO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IGhhbmRsZXIuZmV0Y2hBbmRDYWNoZVB1dChyZXF1ZXN0KTtcbiAgICAgICAgICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgICAgIGlmIChlcnIgaW5zdGFuY2VvZiBFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICBlcnJvciA9IGVycjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ3MucHVzaChcIkdvdCByZXNwb25zZSBmcm9tIG5ldHdvcmsuXCIpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ3MucHVzaChcIlVuYWJsZSB0byBnZXQgYSByZXNwb25zZSBmcm9tIHRoZSBuZXR3b3JrLlwiKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgbG9ncy5wdXNoKGBGb3VuZCBhIGNhY2hlZCByZXNwb25zZSBpbiB0aGUgJyR7dGhpcy5jYWNoZU5hbWV9JyBjYWNoZS5gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBDb2xsYXBzZWQobWVzc2FnZXMuc3RyYXRlZ3lTdGFydCh0aGlzLmNvbnN0cnVjdG9yLm5hbWUsIHJlcXVlc3QpKTtcbiAgICAgICAgICAgIGZvciAoY29uc3QgbG9nIG9mIGxvZ3Mpe1xuICAgICAgICAgICAgICAgIGxvZ2dlci5sb2cobG9nKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG1lc3NhZ2VzLnByaW50RmluYWxSZXNwb25zZShyZXNwb25zZSk7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBFbmQoKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIXJlc3BvbnNlKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwibm8tcmVzcG9uc2VcIiwge1xuICAgICAgICAgICAgICAgIHVybDog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IHdhaXQgZm9yIHRoZSBuZXR3b3JrIHJlc3BvbnNlLmApO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IGZldGNoQW5kQ2FjaGVQcm9taXNlO1xuICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgICAgICAgaWYgKGVyciBpbnN0YW5jZW9mIEVycm9yKSB7XG4gICAgICAgICAgICAgICAgICAgIGVycm9yID0gZXJyO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBDb2xsYXBzZWQobWVzc2FnZXMuc3RyYXRlZ3lTdGFydCh0aGlzLmNvbnN0cnVjdG9yLm5hbWUsIHJlcXVlc3QpKTtcbiAgICAgICAgICAgIGZvciAoY29uc3QgbG9nIG9mIGxvZ3Mpe1xuICAgICAgICAgICAgICAgIGxvZ2dlci5sb2cobG9nKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG1lc3NhZ2VzLnByaW50RmluYWxSZXNwb25zZShyZXNwb25zZSk7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBFbmQoKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIXJlc3BvbnNlKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwibm8tcmVzcG9uc2VcIiwge1xuICAgICAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXG4gICAgICAgICAgICAgICAgZXJyb3JcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXNwb25zZTtcbiAgICB9XG59XG5cbmV4cG9ydCB7IENhY2hlRmlyc3QsIENhY2hlT25seSwgU3RhbGVXaGlsZVJldmFsaWRhdGUsIFN0cmF0ZWd5IH07XG4iXSwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/@serwist+sw@9.0.0-preview.21_typescript@5.4.5/node_modules/@serwist/sw/dist/index.strategies.js\n")); + +/***/ }), + +/***/ "./node_modules/.pnpm/idb@8.0.0/node_modules/idb/build/index.js": +/*!**********************************************************************!*\ + !*** ./node_modules/.pnpm/idb@8.0.0/node_modules/idb/build/index.js ***! + \**********************************************************************/ +/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ deleteDB: function() { return /* binding */ deleteDB; },\n/* harmony export */ openDB: function() { return /* binding */ openDB; },\n/* harmony export */ unwrap: function() { return /* binding */ unwrap; },\n/* harmony export */ wrap: function() { return /* binding */ wrap; }\n/* harmony export */ });\nconst instanceOfAny = (object, constructors) => constructors.some((c) => object instanceof c);\n\nlet idbProxyableTypes;\nlet cursorAdvanceMethods;\n// This is a function to prevent it throwing up in node environments.\nfunction getIdbProxyableTypes() {\n return (idbProxyableTypes ||\n (idbProxyableTypes = [\n IDBDatabase,\n IDBObjectStore,\n IDBIndex,\n IDBCursor,\n IDBTransaction,\n ]));\n}\n// This is a function to prevent it throwing up in node environments.\nfunction getCursorAdvanceMethods() {\n return (cursorAdvanceMethods ||\n (cursorAdvanceMethods = [\n IDBCursor.prototype.advance,\n IDBCursor.prototype.continue,\n IDBCursor.prototype.continuePrimaryKey,\n ]));\n}\nconst transactionDoneMap = new WeakMap();\nconst transformCache = new WeakMap();\nconst reverseTransformCache = new WeakMap();\nfunction promisifyRequest(request) {\n const promise = new Promise((resolve, reject) => {\n const unlisten = () => {\n request.removeEventListener('success', success);\n request.removeEventListener('error', error);\n };\n const success = () => {\n resolve(wrap(request.result));\n unlisten();\n };\n const error = () => {\n reject(request.error);\n unlisten();\n };\n request.addEventListener('success', success);\n request.addEventListener('error', error);\n });\n // This mapping exists in reverseTransformCache but doesn't doesn't exist in transformCache. This\n // is because we create many promises from a single IDBRequest.\n reverseTransformCache.set(promise, request);\n return promise;\n}\nfunction cacheDonePromiseForTransaction(tx) {\n // Early bail if we've already created a done promise for this transaction.\n if (transactionDoneMap.has(tx))\n return;\n const done = new Promise((resolve, reject) => {\n const unlisten = () => {\n tx.removeEventListener('complete', complete);\n tx.removeEventListener('error', error);\n tx.removeEventListener('abort', error);\n };\n const complete = () => {\n resolve();\n unlisten();\n };\n const error = () => {\n reject(tx.error || new DOMException('AbortError', 'AbortError'));\n unlisten();\n };\n tx.addEventListener('complete', complete);\n tx.addEventListener('error', error);\n tx.addEventListener('abort', error);\n });\n // Cache it for later retrieval.\n transactionDoneMap.set(tx, done);\n}\nlet idbProxyTraps = {\n get(target, prop, receiver) {\n if (target instanceof IDBTransaction) {\n // Special handling for transaction.done.\n if (prop === 'done')\n return transactionDoneMap.get(target);\n // Make tx.store return the only store in the transaction, or undefined if there are many.\n if (prop === 'store') {\n return receiver.objectStoreNames[1]\n ? undefined\n : receiver.objectStore(receiver.objectStoreNames[0]);\n }\n }\n // Else transform whatever we get back.\n return wrap(target[prop]);\n },\n set(target, prop, value) {\n target[prop] = value;\n return true;\n },\n has(target, prop) {\n if (target instanceof IDBTransaction &&\n (prop === 'done' || prop === 'store')) {\n return true;\n }\n return prop in target;\n },\n};\nfunction replaceTraps(callback) {\n idbProxyTraps = callback(idbProxyTraps);\n}\nfunction wrapFunction(func) {\n // Due to expected object equality (which is enforced by the caching in `wrap`), we\n // only create one new func per func.\n // Cursor methods are special, as the behaviour is a little more different to standard IDB. In\n // IDB, you advance the cursor and wait for a new 'success' on the IDBRequest that gave you the\n // cursor. It's kinda like a promise that can resolve with many values. That doesn't make sense\n // with real promises, so each advance methods returns a new promise for the cursor object, or\n // undefined if the end of the cursor has been reached.\n if (getCursorAdvanceMethods().includes(func)) {\n return function (...args) {\n // Calling the original function with the proxy as 'this' causes ILLEGAL INVOCATION, so we use\n // the original object.\n func.apply(unwrap(this), args);\n return wrap(this.request);\n };\n }\n return function (...args) {\n // Calling the original function with the proxy as 'this' causes ILLEGAL INVOCATION, so we use\n // the original object.\n return wrap(func.apply(unwrap(this), args));\n };\n}\nfunction transformCachableValue(value) {\n if (typeof value === 'function')\n return wrapFunction(value);\n // This doesn't return, it just creates a 'done' promise for the transaction,\n // which is later returned for transaction.done (see idbObjectHandler).\n if (value instanceof IDBTransaction)\n cacheDonePromiseForTransaction(value);\n if (instanceOfAny(value, getIdbProxyableTypes()))\n return new Proxy(value, idbProxyTraps);\n // Return the same value back if we're not going to transform it.\n return value;\n}\nfunction wrap(value) {\n // We sometimes generate multiple promises from a single IDBRequest (eg when cursoring), because\n // IDB is weird and a single IDBRequest can yield many responses, so these can't be cached.\n if (value instanceof IDBRequest)\n return promisifyRequest(value);\n // If we've already transformed this value before, reuse the transformed value.\n // This is faster, but it also provides object equality.\n if (transformCache.has(value))\n return transformCache.get(value);\n const newValue = transformCachableValue(value);\n // Not all types are transformed.\n // These may be primitive types, so they can't be WeakMap keys.\n if (newValue !== value) {\n transformCache.set(value, newValue);\n reverseTransformCache.set(newValue, value);\n }\n return newValue;\n}\nconst unwrap = (value) => reverseTransformCache.get(value);\n\n/**\n * Open a database.\n *\n * @param name Name of the database.\n * @param version Schema version.\n * @param callbacks Additional callbacks.\n */\nfunction openDB(name, version, { blocked, upgrade, blocking, terminated } = {}) {\n const request = indexedDB.open(name, version);\n const openPromise = wrap(request);\n if (upgrade) {\n request.addEventListener('upgradeneeded', (event) => {\n upgrade(wrap(request.result), event.oldVersion, event.newVersion, wrap(request.transaction), event);\n });\n }\n if (blocked) {\n request.addEventListener('blocked', (event) => blocked(\n // Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405\n event.oldVersion, event.newVersion, event));\n }\n openPromise\n .then((db) => {\n if (terminated)\n db.addEventListener('close', () => terminated());\n if (blocking) {\n db.addEventListener('versionchange', (event) => blocking(event.oldVersion, event.newVersion, event));\n }\n })\n .catch(() => { });\n return openPromise;\n}\n/**\n * Delete a database.\n *\n * @param name Name of the database.\n */\nfunction deleteDB(name, { blocked } = {}) {\n const request = indexedDB.deleteDatabase(name);\n if (blocked) {\n request.addEventListener('blocked', (event) => blocked(\n // Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405\n event.oldVersion, event));\n }\n return wrap(request).then(() => undefined);\n}\n\nconst readMethods = ['get', 'getKey', 'getAll', 'getAllKeys', 'count'];\nconst writeMethods = ['put', 'add', 'delete', 'clear'];\nconst cachedMethods = new Map();\nfunction getMethod(target, prop) {\n if (!(target instanceof IDBDatabase &&\n !(prop in target) &&\n typeof prop === 'string')) {\n return;\n }\n if (cachedMethods.get(prop))\n return cachedMethods.get(prop);\n const targetFuncName = prop.replace(/FromIndex$/, '');\n const useIndex = prop !== targetFuncName;\n const isWrite = writeMethods.includes(targetFuncName);\n if (\n // Bail if the target doesn't exist on the target. Eg, getAll isn't in Edge.\n !(targetFuncName in (useIndex ? IDBIndex : IDBObjectStore).prototype) ||\n !(isWrite || readMethods.includes(targetFuncName))) {\n return;\n }\n const method = async function (storeName, ...args) {\n // isWrite ? 'readwrite' : undefined gzipps better, but fails in Edge :(\n const tx = this.transaction(storeName, isWrite ? 'readwrite' : 'readonly');\n let target = tx.store;\n if (useIndex)\n target = target.index(args.shift());\n // Must reject if op rejects.\n // If it's a write operation, must reject if tx.done rejects.\n // Must reject with op rejection first.\n // Must resolve with op value.\n // Must handle both promises (no unhandled rejections)\n return (await Promise.all([\n target[targetFuncName](...args),\n isWrite && tx.done,\n ]))[0];\n };\n cachedMethods.set(prop, method);\n return method;\n}\nreplaceTraps((oldTraps) => ({\n ...oldTraps,\n get: (target, prop, receiver) => getMethod(target, prop) || oldTraps.get(target, prop, receiver),\n has: (target, prop) => !!getMethod(target, prop) || oldTraps.has(target, prop),\n}));\n\nconst advanceMethodProps = ['continue', 'continuePrimaryKey', 'advance'];\nconst methodMap = {};\nconst advanceResults = new WeakMap();\nconst ittrProxiedCursorToOriginalProxy = new WeakMap();\nconst cursorIteratorTraps = {\n get(target, prop) {\n if (!advanceMethodProps.includes(prop))\n return target[prop];\n let cachedFunc = methodMap[prop];\n if (!cachedFunc) {\n cachedFunc = methodMap[prop] = function (...args) {\n advanceResults.set(this, ittrProxiedCursorToOriginalProxy.get(this)[prop](...args));\n };\n }\n return cachedFunc;\n },\n};\nasync function* iterate(...args) {\n // tslint:disable-next-line:no-this-assignment\n let cursor = this;\n if (!(cursor instanceof IDBCursor)) {\n cursor = await cursor.openCursor(...args);\n }\n if (!cursor)\n return;\n cursor = cursor;\n const proxiedCursor = new Proxy(cursor, cursorIteratorTraps);\n ittrProxiedCursorToOriginalProxy.set(proxiedCursor, cursor);\n // Map this double-proxy back to the original, so other cursor methods work.\n reverseTransformCache.set(proxiedCursor, unwrap(cursor));\n while (cursor) {\n yield proxiedCursor;\n // If one of the advancing methods was not called, call continue().\n cursor = await (advanceResults.get(proxiedCursor) || cursor.continue());\n advanceResults.delete(proxiedCursor);\n }\n}\nfunction isIteratorProp(target, prop) {\n return ((prop === Symbol.asyncIterator &&\n instanceOfAny(target, [IDBIndex, IDBObjectStore, IDBCursor])) ||\n (prop === 'iterate' && instanceOfAny(target, [IDBIndex, IDBObjectStore])));\n}\nreplaceTraps((oldTraps) => ({\n ...oldTraps,\n get(target, prop, receiver) {\n if (isIteratorProp(target, prop))\n return iterate;\n return oldTraps.get(target, prop, receiver);\n },\n has(target, prop) {\n return isIteratorProp(target, prop) || oldTraps.has(target, prop);\n },\n}));\n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vaWRiQDguMC4wL25vZGVfbW9kdWxlcy9pZGIvYnVpbGQvaW5kZXguanMiLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQUF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@8.0.0/node_modules/idb/build/index.js\n")); + +/***/ }), + +/***/ "./app/sw.js": +/*!*******************!*\ + !*** ./app/sw.js ***! + \*******************/ +/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) { + +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _serwist_next_worker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @serwist/next/worker */ \"./node_modules/.pnpm/@serwist+next@9.0.0-preview.21_next@14.2.1_typescript@5.4.5_webpack@5.91.0/node_modules/@serwist/next/dist/index.worker.js\");\n/* harmony import */ var serwist__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! serwist */ \"./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/index.js\");\n\n\nconst serwist = new serwist__WEBPACK_IMPORTED_MODULE_1__.Serwist({\n precacheEntries: undefined,\n skipWaiting: true,\n clientsClaim: true,\n navigationPreload: true,\n runtimeCaching: _serwist_next_worker__WEBPACK_IMPORTED_MODULE_0__.defaultCache\n});\nserwist.addEventListeners();\n\n\n;\n // Wrapped in an IIFE to avoid polluting the global scope\n ;\n (function () {\n var _a, _b;\n // Legacy CSS implementations will `eval` browser code in a Node.js context\n // to extract CSS. For backwards compatibility, we need to check we're in a\n // browser context before continuing.\n if (typeof self !== 'undefined' &&\n // AMP / No-JS mode does not inject these helpers:\n '$RefreshHelpers$' in self) {\n // @ts-ignore __webpack_module__ is global\n var currentExports = __webpack_module__.exports;\n // @ts-ignore __webpack_module__ is global\n var prevSignature = (_b = (_a = __webpack_module__.hot.data) === null || _a === void 0 ? void 0 : _a.prevSignature) !== null && _b !== void 0 ? _b : null;\n // This cannot happen in MainTemplate because the exports mismatch between\n // templating and execution.\n self.$RefreshHelpers$.registerExportsForReactRefresh(currentExports, __webpack_module__.id);\n // A module can be accepted automatically based on its exports, e.g. when\n // it is a Refresh Boundary.\n if (self.$RefreshHelpers$.isReactRefreshBoundary(currentExports)) {\n // Save the previous exports signature on update so we can compare the boundary\n // signatures. We avoid saving exports themselves since it causes memory leaks (https://github.com/vercel/next.js/pull/53797)\n __webpack_module__.hot.dispose(function (data) {\n data.prevSignature =\n self.$RefreshHelpers$.getRefreshBoundarySignature(currentExports);\n });\n // Unconditionally accept an update to this module, we'll check if it's\n // still a Refresh Boundary later.\n // @ts-ignore importMeta is replaced in the loader\n /* unsupported import.meta.webpackHot */ undefined.accept();\n // This field is set when the previous version of this module was a\n // Refresh Boundary, letting us know we need to check for invalidation or\n // enqueue an update.\n if (prevSignature !== null) {\n // A boundary can become ineligible if its exports are incompatible\n // with the previous exports.\n //\n // For example, if you add/remove/change exports, we'll want to\n // re-execute the importing modules, and force those components to\n // re-render. Similarly, if you convert a class component to a\n // function, we want to invalidate the boundary.\n if (self.$RefreshHelpers$.shouldInvalidateReactRefreshBoundary(prevSignature, self.$RefreshHelpers$.getRefreshBoundarySignature(currentExports))) {\n __webpack_module__.hot.invalidate();\n }\n else {\n self.$RefreshHelpers$.scheduleUpdate();\n }\n }\n }\n else {\n // Since we just executed the code for the module, it's possible that the\n // new exports made it ineligible for being a boundary.\n // We only care about the case when we were _previously_ a boundary,\n // because we already accepted this update (accidental side effect).\n var isNoLongerABoundary = prevSignature !== null;\n if (isNoLongerABoundary) {\n __webpack_module__.hot.invalidate();\n }\n }\n }\n })();\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9hcHAvc3cuanMiLCJtYXBwaW5ncyI6Ijs7O0FBQW1EO0FBQ2xCO0FBRWpDLE1BQU1FLFVBQVUsSUFBSUQsNENBQU9BLENBQUM7SUFDMUJFLGlCQUFpQkMsS0FBS0MsYUFBYTtJQUNuQ0MsYUFBYTtJQUNiQyxjQUFjO0lBQ2RDLG1CQUFtQjtJQUNuQkMsZ0JBQWdCVCw4REFBWUE7QUFDOUI7QUFFQUUsUUFBUVEsaUJBQWlCIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vX05fRS8uL2FwcC9zdy5qcz9lODQ4Il0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGRlZmF1bHRDYWNoZSB9IGZyb20gJ0BzZXJ3aXN0L25leHQvd29ya2VyJ1xyXG5pbXBvcnQgeyBTZXJ3aXN0IH0gZnJvbSAnc2Vyd2lzdCdcclxuXHJcbmNvbnN0IHNlcndpc3QgPSBuZXcgU2Vyd2lzdCh7XHJcbiAgcHJlY2FjaGVFbnRyaWVzOiBzZWxmLl9fU1dfTUFOSUZFU1QsXHJcbiAgc2tpcFdhaXRpbmc6IHRydWUsXHJcbiAgY2xpZW50c0NsYWltOiB0cnVlLFxyXG4gIG5hdmlnYXRpb25QcmVsb2FkOiB0cnVlLFxyXG4gIHJ1bnRpbWVDYWNoaW5nOiBkZWZhdWx0Q2FjaGUsXHJcbn0pXHJcblxyXG5zZXJ3aXN0LmFkZEV2ZW50TGlzdGVuZXJzKClcclxuIl0sIm5hbWVzIjpbImRlZmF1bHRDYWNoZSIsIlNlcndpc3QiLCJzZXJ3aXN0IiwicHJlY2FjaGVFbnRyaWVzIiwic2VsZiIsIl9fU1dfTUFOSUZFU1QiLCJza2lwV2FpdGluZyIsImNsaWVudHNDbGFpbSIsIm5hdmlnYXRpb25QcmVsb2FkIiwicnVudGltZUNhY2hpbmciLCJhZGRFdmVudExpc3RlbmVycyJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./app/sw.js\n")); + +/***/ }), + +/***/ "./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/NetworkOnly.js": +/*!**********************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/NetworkOnly.js ***! + \**********************************************************************************************************************/ +/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ N: function() { return /* binding */ NetworkOnly; },\n/* harmony export */ S: function() { return /* binding */ Strategy; },\n/* harmony export */ a: function() { return /* binding */ NetworkFirst; },\n/* harmony export */ b: function() { return /* binding */ StrategyHandler; },\n/* harmony export */ c: function() { return /* binding */ cacheOkAndOpaquePlugin; },\n/* harmony export */ m: function() { return /* binding */ messages; }\n/* harmony export */ });\n/* harmony import */ var _timeout_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./timeout.js */ \"./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/timeout.js\");\n\n\nfunction toRequest(input) {\n return typeof input === \"string\" ? new Request(input) : input;\n}\nclass StrategyHandler {\n event;\n request;\n url;\n params;\n _cacheKeys = {};\n _strategy;\n _handlerDeferred;\n _extendLifetimePromises;\n _plugins;\n _pluginStateMap;\n constructor(strategy, options){\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isInstance(options.event, ExtendableEvent, {\n moduleName: \"serwist/strategies\",\n className: \"StrategyHandler\",\n funcName: \"constructor\",\n paramName: \"options.event\"\n });\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isInstance(options.request, Request, {\n moduleName: \"serwist/strategies\",\n className: \"StrategyHandler\",\n funcName: \"constructor\",\n paramName: \"options.request\"\n });\n }\n this.event = options.event;\n this.request = options.request;\n if (options.url) {\n this.url = options.url;\n this.params = options.params;\n }\n this._strategy = strategy;\n this._handlerDeferred = new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.D();\n this._extendLifetimePromises = [];\n this._plugins = [\n ...strategy.plugins\n ];\n this._pluginStateMap = new Map();\n for (const plugin of this._plugins){\n this._pluginStateMap.set(plugin, {});\n }\n this.event.waitUntil(this._handlerDeferred.promise);\n }\n async fetch(input) {\n const { event } = this;\n let request = toRequest(input);\n if (request.mode === \"navigate\" && event instanceof FetchEvent && event.preloadResponse) {\n const possiblePreloadResponse = await event.preloadResponse;\n if (possiblePreloadResponse) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`Using a preloaded navigation response for '${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(request.url)}'`);\n }\n return possiblePreloadResponse;\n }\n }\n const originalRequest = this.hasCallback(\"fetchDidFail\") ? request.clone() : null;\n try {\n for (const cb of this.iterateCallbacks(\"requestWillFetch\")){\n request = await cb({\n request: request.clone(),\n event\n });\n }\n } catch (err) {\n if (err instanceof Error) {\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"plugin-error-request-will-fetch\", {\n thrownErrorMessage: err.message\n });\n }\n }\n const pluginFilteredRequest = request.clone();\n try {\n let fetchResponse;\n fetchResponse = await fetch(request, request.mode === \"navigate\" ? undefined : this._strategy.fetchOptions);\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.debug(`Network request for '${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(request.url)}' returned a response with status '${fetchResponse.status}'.`);\n }\n for (const callback of this.iterateCallbacks(\"fetchDidSucceed\")){\n fetchResponse = await callback({\n event,\n request: pluginFilteredRequest,\n response: fetchResponse\n });\n }\n return fetchResponse;\n } catch (error) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`Network request for '${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(request.url)}' threw an error.`, error);\n }\n if (originalRequest) {\n await this.runCallbacks(\"fetchDidFail\", {\n error: error,\n event,\n originalRequest: originalRequest.clone(),\n request: pluginFilteredRequest.clone()\n });\n }\n throw error;\n }\n }\n async fetchAndCachePut(input) {\n const response = await this.fetch(input);\n const responseClone = response.clone();\n void this.waitUntil(this.cachePut(input, responseClone));\n return response;\n }\n async cacheMatch(key) {\n const request = toRequest(key);\n let cachedResponse;\n const { cacheName, matchOptions } = this._strategy;\n const effectiveRequest = await this.getCacheKey(request, \"read\");\n const multiMatchOptions = {\n ...matchOptions,\n ...{\n cacheName\n }\n };\n cachedResponse = await caches.match(effectiveRequest, multiMatchOptions);\n if (true) {\n if (cachedResponse) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.debug(`Found a cached response in '${cacheName}'.`);\n } else {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.debug(`No cached response found in '${cacheName}'.`);\n }\n }\n for (const callback of this.iterateCallbacks(\"cachedResponseWillBeUsed\")){\n cachedResponse = await callback({\n cacheName,\n matchOptions,\n cachedResponse,\n request: effectiveRequest,\n event: this.event\n }) || undefined;\n }\n return cachedResponse;\n }\n async cachePut(key, response) {\n const request = toRequest(key);\n await (0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.t)(0);\n const effectiveRequest = await this.getCacheKey(request, \"write\");\n if (true) {\n if (effectiveRequest.method && effectiveRequest.method !== \"GET\") {\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"attempt-to-cache-non-get-request\", {\n url: (0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(effectiveRequest.url),\n method: effectiveRequest.method\n });\n }\n }\n if (!response) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.error(`Cannot cache non-existent response for '${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(effectiveRequest.url)}'.`);\n }\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"cache-put-with-no-response\", {\n url: (0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(effectiveRequest.url)\n });\n }\n const responseToCache = await this._ensureResponseSafeToCache(response);\n if (!responseToCache) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.debug(`Response '${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(effectiveRequest.url)}' will not be cached.`, responseToCache);\n }\n return false;\n }\n const { cacheName, matchOptions } = this._strategy;\n const cache = await self.caches.open(cacheName);\n if (true) {\n const vary = response.headers.get(\"Vary\");\n if (vary && matchOptions?.ignoreVary !== true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.debug(`The response for ${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(effectiveRequest.url)} has a 'Vary: ${vary}' header. Consider setting the {ignoreVary: true} option on your strategy to ensure cache matching and deletion works as expected.`);\n }\n }\n const hasCacheUpdateCallback = this.hasCallback(\"cacheDidUpdate\");\n const oldResponse = hasCacheUpdateCallback ? await (0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.a)(cache, effectiveRequest.clone(), [\n \"__WB_REVISION__\"\n ], matchOptions) : null;\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.debug(`Updating the '${cacheName}' cache with a new Response for ${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(effectiveRequest.url)}.`);\n }\n try {\n await cache.put(effectiveRequest, hasCacheUpdateCallback ? responseToCache.clone() : responseToCache);\n } catch (error) {\n if (error instanceof Error) {\n if (error.name === \"QuotaExceededError\") {\n await (0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.e)();\n }\n throw error;\n }\n }\n for (const callback of this.iterateCallbacks(\"cacheDidUpdate\")){\n await callback({\n cacheName,\n oldResponse,\n newResponse: responseToCache.clone(),\n request: effectiveRequest,\n event: this.event\n });\n }\n return true;\n }\n async getCacheKey(request, mode) {\n const key = `${request.url} | ${mode}`;\n if (!this._cacheKeys[key]) {\n let effectiveRequest = request;\n for (const callback of this.iterateCallbacks(\"cacheKeyWillBeUsed\")){\n effectiveRequest = toRequest(await callback({\n mode,\n request: effectiveRequest,\n event: this.event,\n params: this.params\n }));\n }\n this._cacheKeys[key] = effectiveRequest;\n }\n return this._cacheKeys[key];\n }\n hasCallback(name) {\n for (const plugin of this._strategy.plugins){\n if (name in plugin) {\n return true;\n }\n }\n return false;\n }\n async runCallbacks(name, param) {\n for (const callback of this.iterateCallbacks(name)){\n await callback(param);\n }\n }\n *iterateCallbacks(name) {\n for (const plugin of this._strategy.plugins){\n if (typeof plugin[name] === \"function\") {\n const state = this._pluginStateMap.get(plugin);\n const statefulCallback = (param)=>{\n const statefulParam = {\n ...param,\n state\n };\n return plugin[name](statefulParam);\n };\n yield statefulCallback;\n }\n }\n }\n waitUntil(promise) {\n this._extendLifetimePromises.push(promise);\n return promise;\n }\n async doneWaiting() {\n let promise = undefined;\n while(promise = this._extendLifetimePromises.shift()){\n await promise;\n }\n }\n destroy() {\n this._handlerDeferred.resolve(null);\n }\n async _ensureResponseSafeToCache(response) {\n let responseToCache = response;\n let pluginsUsed = false;\n for (const callback of this.iterateCallbacks(\"cacheWillUpdate\")){\n responseToCache = await callback({\n request: this.request,\n response: responseToCache,\n event: this.event\n }) || undefined;\n pluginsUsed = true;\n if (!responseToCache) {\n break;\n }\n }\n if (!pluginsUsed) {\n if (responseToCache && responseToCache.status !== 200) {\n responseToCache = undefined;\n }\n if (true) {\n if (responseToCache) {\n if (responseToCache.status !== 200) {\n if (responseToCache.status === 0) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.warn(`The response for '${this.request.url}' is an opaque response. The caching strategy that you're using will not cache opaque responses by default.`);\n } else {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.debug(`The response for '${this.request.url}' returned a status code of '${response.status}' and won't be cached as a result.`);\n }\n }\n }\n }\n }\n return responseToCache;\n }\n}\n\nclass Strategy {\n cacheName;\n plugins;\n fetchOptions;\n matchOptions;\n constructor(options = {}){\n this.cacheName = _timeout_js__WEBPACK_IMPORTED_MODULE_0__.c.getRuntimeName(options.cacheName);\n this.plugins = options.plugins || [];\n this.fetchOptions = options.fetchOptions;\n this.matchOptions = options.matchOptions;\n }\n handle(options) {\n const [responseDone] = this.handleAll(options);\n return responseDone;\n }\n handleAll(options) {\n if (options instanceof FetchEvent) {\n options = {\n event: options,\n request: options.request\n };\n }\n const event = options.event;\n const request = typeof options.request === \"string\" ? new Request(options.request) : options.request;\n const handler = new StrategyHandler(this, options.url ? {\n event,\n request,\n url: options.url,\n params: options.params\n } : {\n event,\n request\n });\n const responseDone = this._getResponse(handler, request, event);\n const handlerDone = this._awaitComplete(responseDone, handler, request, event);\n return [\n responseDone,\n handlerDone\n ];\n }\n async _getResponse(handler, request, event) {\n await handler.runCallbacks(\"handlerWillStart\", {\n event,\n request\n });\n let response = undefined;\n try {\n response = await this._handle(request, handler);\n if (response === undefined || response.type === \"error\") {\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"no-response\", {\n url: request.url\n });\n }\n } catch (error) {\n if (error instanceof Error) {\n for (const callback of handler.iterateCallbacks(\"handlerDidError\")){\n response = await callback({\n error,\n event,\n request\n });\n if (response !== undefined) {\n break;\n }\n }\n }\n if (!response) {\n throw error;\n }\n if (true) {\n throw _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`While responding to '${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(request.url)}', an ${error instanceof Error ? error.toString() : \"\"} error occurred. Using a fallback response provided by a handlerDidError plugin.`);\n }\n }\n for (const callback of handler.iterateCallbacks(\"handlerWillRespond\")){\n response = await callback({\n event,\n request,\n response\n });\n }\n return response;\n }\n async _awaitComplete(responseDone, handler, request, event) {\n let response = undefined;\n let error = undefined;\n try {\n response = await responseDone;\n } catch (error) {}\n try {\n await handler.runCallbacks(\"handlerDidRespond\", {\n event,\n request,\n response\n });\n await handler.doneWaiting();\n } catch (waitUntilError) {\n if (waitUntilError instanceof Error) {\n error = waitUntilError;\n }\n }\n await handler.runCallbacks(\"handlerDidComplete\", {\n event,\n request,\n response,\n error\n });\n handler.destroy();\n if (error) {\n throw error;\n }\n }\n}\n\nconst cacheOkAndOpaquePlugin = {\n cacheWillUpdate: async ({ response })=>{\n if (response.status === 200 || response.status === 0) {\n return response;\n }\n return null;\n }\n};\n\nconst messages = {\n strategyStart: (strategyName, request)=>`Using ${strategyName} to respond to '${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(request.url)}'`,\n printFinalResponse: (response)=>{\n if (response) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(\"View the final response here.\");\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(response || \"[No response returned]\");\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupEnd();\n }\n }\n};\n\nclass NetworkFirst extends Strategy {\n _networkTimeoutSeconds;\n constructor(options = {}){\n super(options);\n if (!this.plugins.some((p)=>\"cacheWillUpdate\" in p)) {\n this.plugins.unshift(cacheOkAndOpaquePlugin);\n }\n this._networkTimeoutSeconds = options.networkTimeoutSeconds || 0;\n if (true) {\n if (this._networkTimeoutSeconds) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(this._networkTimeoutSeconds, \"number\", {\n moduleName: \"serwist/strategies\",\n className: this.constructor.name,\n funcName: \"constructor\",\n paramName: \"networkTimeoutSeconds\"\n });\n }\n }\n }\n async _handle(request, handler) {\n const logs = [];\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isInstance(request, Request, {\n moduleName: \"serwist/strategies\",\n className: this.constructor.name,\n funcName: \"handle\",\n paramName: \"makeRequest\"\n });\n }\n const promises = [];\n let timeoutId;\n if (this._networkTimeoutSeconds) {\n const { id, promise } = this._getTimeoutPromise({\n request,\n logs,\n handler\n });\n timeoutId = id;\n promises.push(promise);\n }\n const networkPromise = this._getNetworkPromise({\n timeoutId,\n request,\n logs,\n handler\n });\n promises.push(networkPromise);\n const response = await handler.waitUntil((async ()=>{\n return await handler.waitUntil(Promise.race(promises)) || await networkPromise;\n })());\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(messages.strategyStart(this.constructor.name, request));\n for (const log of logs){\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(log);\n }\n messages.printFinalResponse(response);\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupEnd();\n }\n if (!response) {\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"no-response\", {\n url: request.url\n });\n }\n return response;\n }\n _getTimeoutPromise({ request, logs, handler }) {\n let timeoutId;\n const timeoutPromise = new Promise((resolve)=>{\n const onNetworkTimeout = async ()=>{\n if (true) {\n logs.push(`Timing out the network response at ${this._networkTimeoutSeconds} seconds.`);\n }\n resolve(await handler.cacheMatch(request));\n };\n timeoutId = setTimeout(onNetworkTimeout, this._networkTimeoutSeconds * 1000);\n });\n return {\n promise: timeoutPromise,\n id: timeoutId\n };\n }\n async _getNetworkPromise({ timeoutId, request, logs, handler }) {\n let error = undefined;\n let response = undefined;\n try {\n response = await handler.fetchAndCachePut(request);\n } catch (fetchError) {\n if (fetchError instanceof Error) {\n error = fetchError;\n }\n }\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n if (true) {\n if (response) {\n logs.push(\"Got response from network.\");\n } else {\n logs.push(\"Unable to get a response from the network. Will respond \" + \"with a cached response.\");\n }\n }\n if (error || !response) {\n response = await handler.cacheMatch(request);\n if (true) {\n if (response) {\n logs.push(`Found a cached response in the '${this.cacheName}' cache.`);\n } else {\n logs.push(`No response found in the '${this.cacheName}' cache.`);\n }\n }\n }\n return response;\n }\n}\n\nclass NetworkOnly extends Strategy {\n _networkTimeoutSeconds;\n constructor(options = {}){\n super(options);\n this._networkTimeoutSeconds = options.networkTimeoutSeconds || 0;\n }\n async _handle(request, handler) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isInstance(request, Request, {\n moduleName: \"serwist/strategies\",\n className: this.constructor.name,\n funcName: \"_handle\",\n paramName: \"request\"\n });\n }\n let error = undefined;\n let response;\n try {\n const promises = [\n handler.fetch(request)\n ];\n if (this._networkTimeoutSeconds) {\n const timeoutPromise = (0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.t)(this._networkTimeoutSeconds * 1000);\n promises.push(timeoutPromise);\n }\n response = await Promise.race(promises);\n if (!response) {\n throw new Error(`Timed out the network response after ${this._networkTimeoutSeconds} seconds.`);\n }\n } catch (err) {\n if (err instanceof Error) {\n error = err;\n }\n }\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(messages.strategyStart(this.constructor.name, request));\n if (response) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(\"Got response from network.\");\n } else {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(\"Unable to get a response from the network.\");\n }\n messages.printFinalResponse(response);\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupEnd();\n }\n if (!response) {\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"no-response\", {\n url: request.url,\n error\n });\n }\n return response;\n }\n}\n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vc2Vyd2lzdEA5LjAuMC1wcmV2aWV3LjI0X3R5cGVzY3JpcHRANS40LjUvbm9kZV9tb2R1bGVzL3Nlcndpc3QvZGlzdC9jaHVua3MvTmV0d29ya09ubHkuanMiLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUF3Tjs7QUFFeE47QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsWUFBWSxJQUFxQztBQUNqRCxZQUFZLDBDQUFrQjtBQUM5QjtBQUNBO0FBQ0E7QUFDQTtBQUNBLGFBQWE7QUFDYixZQUFZLDBDQUFrQjtBQUM5QjtBQUNBO0FBQ0E7QUFDQTtBQUNBLGFBQWE7QUFDYjtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0Esb0NBQW9DLDBDQUFRO0FBQzVDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLCtDQUErQztBQUMvQztBQUN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3QgY2FsbGJhY2sgb2YgdGhpcy5pdGVyYXRlQ2FsbGJhY2tzKFwiZmV0Y2hEaWRTdWNjZWVkXCIpKXtcbiAgICAgICAgICAgICAgICBmZXRjaFJlc3BvbnNlID0gYXdhaXQgY2FsbGJhY2soe1xuICAgICAgICAgICAgICAgICAgICBldmVudCxcbiAgICAgICAgICAgICAgICAgICAgcmVxdWVzdDogcGx1Z2luRmlsdGVyZWRSZXF1ZXN0LFxuICAgICAgICAgICAgICAgICAgICByZXNwb25zZTogZmV0Y2hSZXNwb25zZVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIGZldGNoUmVzcG9uc2U7XG4gICAgICAgIH0gY2F0Y2ggKGVycm9yKSB7XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgbG9nZ2VyLmxvZyhgTmV0d29yayByZXF1ZXN0IGZvciAnJHtnZXRGcmllbmRseVVSTChyZXF1ZXN0LnVybCl9JyB0aHJldyBhbiBlcnJvci5gLCBlcnJvcik7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAob3JpZ2luYWxSZXF1ZXN0KSB7XG4gICAgICAgICAgICAgICAgYXdhaXQgdGhpcy5ydW5DYWxsYmFja3MoXCJmZXRjaERpZEZhaWxcIiwge1xuICAgICAgICAgICAgICAgICAgICBlcnJvcjogZXJyb3IsXG4gICAgICAgICAgICAgICAgICAgIGV2ZW50LFxuICAgICAgICAgICAgICAgICAgICBvcmlnaW5hbFJlcXVlc3Q6IG9yaWdpbmFsUmVxdWVzdC5jbG9uZSgpLFxuICAgICAgICAgICAgICAgICAgICByZXF1ZXN0OiBwbHVnaW5GaWx0ZXJlZFJlcXVlc3QuY2xvbmUoKVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhyb3cgZXJyb3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lzW2tleV0gPSBlZmZlY3RpdmVSZXF1ZXN0O1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB0aGlzLl9jYWNoZUtleXNba2V5XTtcbiAgICB9XG4gICAgaGFzQ2FsbGJhY2sobmFtZSkge1xuICAgICAgICBmb3IgKGNvbnN0IHBsdWdpbiBvZiB0aGlzLl9zdHJhdGVneS5wbHVnaW5zKXtcbiAgICAgICAgICAgIGlmIChuYW1lIGluIHBsdWdpbikge1xuICAgICAgICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9XG4gICAgYXN5bmMgcnVuQ2FsbGJhY2tzKG5hbWUsIHBhcmFtKSB7XG4gICAgICAgIGZvciAoY29uc3QgY2FsbGJhY2sgb2YgdGhpcy5pdGVyYXRlQ2FsbGJhY2tzKG5hbWUpKXtcbiAgICAgICAgICAgIGF3YWl0IGNhbGxiYWNrKHBhcmFtKTtcbiAgICAgICAgfVxuICAgIH1cbiAgICAqaXRlcmF0ZUNhbGxiYWNrcyhuYW1lKSB7XG4gICAgICAgIGZvciAoY29uc3QgcGx1Z2luIG9mIHRoaXMuX3N0cmF0ZWd5LnBsdWdpbnMpe1xuICAgICAgICAgICAgaWYgKHR5cGVvZiBwbHVnaW5bbmFtZV0gPT09IFwiZnVuY3Rpb25cIikge1xuICAgICAgICAgICAgICAgIGNvbnN0IHN0YXRlID0gdGhpcy5fcGx1Z2luU3RhdGVNYXAuZ2V0KHBsdWdpbik7XG4gICAgICAgICAgICAgICAgY29uc3Qgc3RhdGVmdWxDYWxsYmFjayA9IChwYXJhbSk9PntcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RhdGVmdWxQYXJhbSA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC4uLnBhcmFtLFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGVcbiAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICA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gICAgICBldmVudDogdGhpcy5ldmVudFxuICAgICAgICAgICAgfSkgfHwgdW5kZWZpbmVkO1xuICAgICAgICAgICAgcGx1Z2luc1VzZWQgPSB0cnVlO1xuICAgICAgICAgICAgaWYgKCFyZXNwb25zZVRvQ2FjaGUpIHtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoIXBsdWdpbnNVc2VkKSB7XG4gICAgICAgICAgICBpZiAocmVzcG9uc2VUb0NhY2hlICYmIHJlc3BvbnNlVG9DYWNoZS5zdGF0dXMgIT09IDIwMCkge1xuICAgICAgICAgICAgICAgIHJlc3BvbnNlVG9DYWNoZSA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2VUb0NhY2hlKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZVRvQ2FjaGUuc3RhdHVzICE9PSAyMDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZVRvQ2FjaGUuc3RhdHVzID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLndhcm4oYFRoZSByZXNwb25zZSBmb3IgJyR7dGhpcy5yZXF1ZXN0LnVybH0nIGlzIGFuIG9wYXF1ZSByZXNwb25zZS4gVGhlIGNhY2hpbmcgc3RyYXRlZ3kgdGhhdCB5b3UncmUgdXNpbmcgd2lsbCBub3QgY2FjaGUgb3BhcXVlIHJlc3BvbnNlcyBieSBkZWZhdWx0LmApO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2dnZXIuZGVidWcoYFRoZSByZXNwb25zZSBmb3IgJyR7dGhpcy5yZXF1ZXN0L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ICAgICAgIHJlcXVlc3RcbiAgICAgICAgfSk7XG4gICAgICAgIGxldCByZXNwb25zZSA9IHVuZGVmaW5lZDtcbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIHJlc3BvbnNlID0gYXdhaXQgdGhpcy5faGFuZGxlKHJlcXVlc3QsIGhhbmRsZXIpO1xuICAgICAgICAgICAgaWYgKHJlc3BvbnNlID09PSB1bmRlZmluZWQgfHwgcmVzcG9uc2UudHlwZSA9PT0gXCJlcnJvclwiKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IFNlcndpc3RFcnJvcihcIm5vLXJlc3BvbnNlXCIsIHtcbiAgICAgICAgICAgICAgICAgICAgdXJsOiByZXF1ZXN0LnVybFxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgaWYgKGVycm9yIGluc3RhbmNlb2YgRXJyb3IpIHtcbiAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IGNhbGxiYWNrIG9mIGhhbmRsZXIuaXRlcmF0ZUNhbGxiYWNrcyhcImhhbmRsZXJEaWRFcnJvclwiKSl7XG4gICAgICAgICAgICAgICAgICAgIHJlc3BvbnNlID0gYXdhaXQgY2FsbGJhY2soe1xuICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IsXG4gICAgICAgICAgICAgICAgICAgICAgICBldmVudCxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3RcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZSAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICghcmVzcG9uc2UpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBlcnJvcjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBsb2dnZXIubG9nKGBXaGlsZSByZXNwb25kaW5nIHRvICcke2dldEZyaWVuZGx5VVJMKHJlcXVlc3QudXJsKX0nLCBhbiAke2Vycm9yIGluc3RhbmNlb2YgRXJyb3IgPyBlcnJvci50b1N0cmluZygpIDogXCJcIn0gZXJyb3Igb2NjdXJyZWQuIFVzaW5nIGEgZmFsbGJhY2sgcmVzcG9uc2UgcHJvdmlkZWQgYnkgYSBoYW5kbGVyRGlkRXJyb3IgcGx1Z2luLmApO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGZvciAoY29uc3QgY2FsbGJhY2sgb2YgaGFuZGxlci5pdGVyYXRlQ2FsbGJhY2tzKFwiaGFuZGxlcldpbGxSZXNwb25kXCIpKXtcbiAgICAgICAgICAgIHJlc3BvbnNlID0gYXdhaXQgY2FsbGJhY2soe1xuICAgICAgICAgICAgICAgIGV2ZW50LFxuICAgICAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICAgICAgcmVzcG9uc2VcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXNwb25zZTtcbiAgICB9XG4gICAgYXN5bmMgX2F3YWl0Q29tcGxldGUocmVzcG9uc2VEb25lLCBoYW5kbGVyLCByZXF1ZXN0LCBldmVudCkge1xuICAgICAgICBsZXQgcmVzcG9uc2UgPSB1bmRlZmluZWQ7XG4gICAgICAgIGxldCBlcnJvciA9IHVuZGVmaW5lZDtcbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIHJlc3BvbnNlID0gYXdhaXQgcmVzcG9uc2VEb25lO1xuICAgICAgICB9IGNhdGNoIChlcnJvcikge31cbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIGF3YWl0IGhhbmRsZXIucnVuQ2FsbGJhY2tzKFwiaGFuZGxlckRpZFJlc3BvbmRcIiwge1xuICAgICAgICAgICAgICAgIGV2ZW50LFxuICAgICAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICAgICAgcmVzcG9uc2VcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgYXdhaXQgaGFuZGxlci5kb25lV2FpdGluZygpO1xuICAgICAgICB9IGNhdGNoICh3YWl0VW50aWxFcnJvcikge1xuICAgICAgICAgICAgaWYgKHdhaXRVbnRpbEVycm9yIGluc3RhbmNlb2YgRXJyb3IpIHtcbiAgICAgICAgICAgICAgICBlcnJvciA9IHdhaXRVbnRpbEVycm9yO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGF3YWl0IGhhbmRsZXIucnVuQ2FsbGJhY2tzKFwiaGFuZGxlckRpZENvbXBsZXRlXCIsIHtcbiAgICAgICAgICAgIGV2ZW50LFxuICAgICAgICAgICAgcmVxdWVzdCxcbiAgICAgICAgICAgIHJlc3BvbnNlLFxuICAgICAgICAgICAgZXJyb3JcbiAgICAgICAgfSk7XG4gICAgICAgIGhhbmRsZXIuZGVzdHJveSgpO1xuICAgICAgICBpZiAoZXJyb3IpIHtcbiAgICAgICAgICAgIHRocm93IGVycm9yO1xuICAgICAgICB9XG4gICAgfVxufVxuXG5jb25zdCBjYWNoZU9rQW5kT3BhcXVlUGx1Z2luID0ge1xuICAgIGNhY2hlV2lsbFVwZGF0ZTogYXN5bmMgKHsgcmVzcG9uc2UgfSk9PntcbiAgICAgICAgaWYgKHJlc3BvbnNlLnN0YXR1cyA9PT0gMjAwIHx8IHJlc3BvbnNlLnN0YXR1cyA9PT0gMCkge1xuICAgICAgICAgICAgcmV0dXJuIHJlc3BvbnNlO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBudWxsO1xuICAgIH1cbn07XG5cbmNvbnN0IG1lc3NhZ2VzID0ge1xuICAgIHN0cmF0ZWd5U3RhcnQ6IChzd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c1R5cGUodGhpcy5fbmV0d29ya1RpbWVvdXRTZWNvbmRzLCBcIm51bWJlclwiLCB7XG4gICAgICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwic2Vyd2lzdC9zdHJhdGVnaWVzXCIsXG4gICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogdGhpcy5jb25zdHJ1Y3Rvci5uYW1lLFxuICAgICAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJjb25zdHJ1Y3RvclwiLFxuICAgICAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwibmV0d29ya1RpbWVvdXRTZWNvbmRzXCJcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbiAgICBhc3luYyBfaGFuZGxlKHJlcXVlc3QsIGhhbmRsZXIpIHtcbiAgICAgICAgY29uc3QgbG9ncyA9IFtdO1xuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBmaW5hbEFzc2VydEV4cG9ydHMuaXNJbnN0YW5jZShyZXF1ZXN0LCBSZXF1ZXN0LCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJzZXJ3aXN0L3N0cmF0ZWdpZXNcIixcbiAgICAgICAgICAgICAgICBjbGFzc05hbWU6IHRoaXMuY29uc3RydWN0b3IubmFtZSxcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJoYW5kbGVcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwibWFrZVJlcXVlc3RcIlxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgcHJvbWlzZXMgPSBbXTtcbiAgICAgICAgbGV0IHRpbWVvdXRJZDtcbiAgICAgICAgaWYgKHRoaXMuX25ldHdvcmtUaW1lb3V0U2Vjb25kcykge1xuICAgICAgICAgICAgY29uc3QgeyBpZCwgcHJvbWlzZSB9ID0gdGhpcy5fZ2V0VGltZW91dFByb21pc2Uoe1xuICAgICAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICAgICAgbG9ncyxcbiAgICAgICAgICAgICAgICBoYW5kbGVyXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIHRpbWVvdXRJZCA9IGlkO1xuICAgICAgICAgICAgcHJvbWlzZXMucHVzaChwcm9taXNlKTtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCBuZXR3b3JrUHJvbWlzZSA9IHRoaXMuX2dldE5ldHdvcmtQcm9taXNlKHtcbiAgICAgICAgICAgIHRpbWVvdXRJZCxcbiAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICBsb2dzLFxuICAgICAgICAgICAgaGFuZGxlclxuICAgICAgICB9KTtcbiAgICAgICAgcHJvbWlzZXMucHVzaChuZXR3b3JrUHJvbWlzZSk7XG4gICAgICAgIGNvbnN0IHJlc3BvbnNlID0gYXdhaXQgaGFuZGxlci53YWl0VW50aWwoKGFzeW5jICgpPT57XG4gICAgICAgICAgICByZXR1cm4gYXdhaXQgaGFuZGxlci53YWl0VW50aWwoUHJvbWlzZS5yYWNlKHByb21pc2VzKSkgfHwgYXdhaXQgbmV0d29ya1Byb21pc2U7XG4gICAgICAgIH0pKCkpO1xuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBDb2xsYXBzZWQobWVzc2FnZXMuc3RyYXRlZ3lTdGFydCh0aGlzLmNvbnN0cnVjdG9yLm5hbWUsIHJlcXVlc3QpKTtcbiAgICAgICAgICAgIGZvciAoY29uc3QgbG9nIG9mIGxvZ3Mpe1xuICAgICAgICAgICAgICAgIGxvZ2dlci5sb2cobG9nKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG1lc3NhZ2VzLnByaW50RmluYWxSZXNwb25zZShyZXNwb25zZSk7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBFbmQoKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIXJlc3BvbnNlKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwibm8tcmVzcG9uc2VcIiwge1xuICAgICAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmxcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXNwb25zZTtcbiAgICB9XG4gICAgX2dldFRpbWVvdXRQcm9taXNlKHsgcmVxdWVzdCwgbG9ncywgaGFuZGxlciB9KSB7XG4gICAgICAgIGxldCB0aW1lb3V0SWQ7XG4gICAgICAgIGNvbnN0IHRpbWVvdXRQcm9taXNlID0gbmV3IFByb21pc2UoKHJlc29sdmUpPT57XG4gICAgICAgICAgICBjb25zdCBvbk5ldHdvcmtUaW1lb3V0ID0gYXN5bmMgKCk9PntcbiAgICAgICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ3MucHVzaChgVGltaW5nIG91dCB0aGUgbmV0d29yayByZXNwb25zZSBhdCAke3RoaXMuX25ldHdvcmtUaW1lb3V0U2Vjb25kc30gc2Vjb25kcy5gKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmVzb2x2ZShhd2FpdCBoYW5kbGVyLmNhY2hlTWF0Y2gocmVxdWVzdCkpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIHRpbWVvdXRJZCA9IHNldFRpbWVvdXQob25OZXR3b3JrVGltZW91dCwgdGhpcy5fbmV0d29ya1RpbWVvdXRTZWNvbmRzICogMTAwMCk7XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgcHJvbWlzZTogdGltZW91dFByb21pc2UsXG4gICAgICAgICAgICBpZDogdGltZW91dElkXG4gICAgICAgIH07XG4gICAgfVxuICAgIGFzeW5jIF9nZXROZXR3b3JrUHJvbWlzZSh7IHRpbWVvdXRJZCwgcmVxdWVzdCwgbG9ncywgaGFuZGxlciB9KSB7XG4gICAgICAgIGxldCBlcnJvciA9IHVuZGVmaW5lZDtcbiAgICAgICAgbGV0IHJlc3BvbnNlID0gdW5kZWZpbmVkO1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgcmVzcG9uc2UgPSBhd2FpdCBoYW5kbGVyLmZldGNoQW5kQ2FjaGVQdXQocmVxdWVzdCk7XG4gICAgICAgIH0gY2F0Y2ggKGZldGNoRXJyb3IpIHtcbiAgICAgICAgICAgIGlmIChmZXRjaEVycm9yIGluc3RhbmNlb2YgRXJyb3IpIHtcbiAgICAgICAgICAgICAgICBlcnJvciA9IGZldGNoRXJyb3I7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRpbWVvdXRJZCkge1xuICAgICAgICAgICAgY2xlYXJUaW1lb3V0KHRpbWVvdXRJZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgaWYgKHJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgbG9ncy5wdXNoKFwiR290IHJlc3BvbnNlIGZyb20gbmV0d29yay5cIik7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGxvZ3MucHVzaChcIlVuYWJsZSB0byBnZXQgYSByZXNwb25zZSBmcm9tIHRoZSBuZXR3b3JrLiBXaWxsIHJlc3BvbmQgXCIgKyBcIndpdGggYSBjYWNoZWQgcmVzcG9uc2UuXCIpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmIChlcnJvciB8fCAhcmVzcG9uc2UpIHtcbiAgICAgICAgICAgIHJlc3BvbnNlID0gYXdhaXQgaGFuZGxlci5jYWNoZU1hdGNoKHJlcXVlc3QpO1xuICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZSkge1xuICAgICAgICAgICAgICAgICAgICBsb2dzLnB1c2goYEZvdW5kIGEgY2FjaGVkIHJlc3BvbnNlIGluIHRoZSAnJHt0aGlzLmNhY2hlTmFtZX0nIGNhY2hlLmApO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ3MucHVzaChgTm8gcmVzcG9uc2UgZm91bmQgaW4gdGhlICcke3RoaXMuY2FjaGVOYW1lfScgY2FjaGUuYCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXNwb25zZTtcbiAgICB9XG59XG5cbmNsYXNzIE5ldHdvcmtPbmx5IGV4dGVuZHMgU3RyYXRlZ3kge1xuICAgIF9uZXR3b3JrVGltZW91dFNlY29uZHM7XG4gICAgY29uc3RydWN0b3Iob3B0aW9ucyA9IHt9KXtcbiAgICAgICAgc3VwZXIob3B0aW9ucyk7XG4gICAgICAgIHRoaXMuX25ldHdvcmtUaW1lb3V0U2Vjb25kcyA9IG9wdGlvbnMubmV0d29ya1RpbWVvdXRTZWNvbmRzIHx8IDA7XG4gICAgfVxuICAgIGFzeW5jIF9oYW5kbGUocmVxdWVzdCwgaGFuZGxlcikge1xuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBmaW5hbEFzc2VydEV4cG9ydHMuaXNJbnN0YW5jZShyZXF1ZXN0LCBSZXF1ZXN0LCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJzZXJ3aXN0L3N0cmF0ZWdpZXNcIixcbiAgICAgICAgICAgICAgICBjbGFzc05hbWU6IHRoaXMuY29uc3RydWN0b3IubmFtZSxcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJfaGFuZGxlXCIsXG4gICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcInJlcXVlc3RcIlxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgbGV0IGVycm9yID0gdW5kZWZpbmVkO1xuICAgICAgICBsZXQgcmVzcG9uc2U7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBjb25zdCBwcm9taXNlcyA9IFtcbiAgICAgICAgICAgICAgICBoYW5kbGVyLmZldGNoKHJlcXVlc3QpXG4gICAgICAgICAgICBdO1xuICAgICAgICAgICAgaWYgKHRoaXMuX25ldHdvcmtUaW1lb3V0U2Vjb25kcykge1xuICAgICAgICAgICAgICAgIGNvbnN0IHRpbWVvdXRQcm9taXNlID0gdGltZW91dCh0aGlzLl9uZXR3b3JrVGltZW91dFNlY29uZHMgKiAxMDAwKTtcbiAgICAgICAgICAgICAgICBwcm9taXNlcy5wdXNoKHRpbWVvdXRQcm9taXNlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJlc3BvbnNlID0gYXdhaXQgUHJvbWlzZS5yYWNlKHByb21pc2VzKTtcbiAgICAgICAgICAgIGlmICghcmVzcG9uc2UpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYFRpbWVkIG91dCB0aGUgbmV0d29yayByZXNwb25zZSBhZnRlciAke3RoaXMuX25ldHdvcmtUaW1lb3V0U2Vjb25kc30gc2Vjb25kcy5gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgICBpZiAoZXJyIGluc3RhbmNlb2YgRXJyb3IpIHtcbiAgICAgICAgICAgICAgICBlcnJvciA9IGVycjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBDb2xsYXBzZWQobWVzc2FnZXMuc3RyYXRlZ3lTdGFydCh0aGlzLmNvbnN0cnVjdG9yLm5hbWUsIHJlcXVlc3QpKTtcbiAgICAgICAgICAgIGlmIChyZXNwb25zZSkge1xuICAgICAgICAgICAgICAgIGxvZ2dlci5sb2coXCJHb3QgcmVzcG9uc2UgZnJvbSBuZXR3b3JrLlwiKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgbG9nZ2VyLmxvZyhcIlVuYWJsZSB0byBnZXQgYSByZXNwb25zZSBmcm9tIHRoZSBuZXR3b3JrLlwiKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG1lc3NhZ2VzLnByaW50RmluYWxSZXNwb25zZShyZXNwb25zZSk7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBFbmQoKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIXJlc3BvbnNlKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwibm8tcmVzcG9uc2VcIiwge1xuICAgICAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXG4gICAgICAgICAgICAgICAgZXJyb3JcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXNwb25zZTtcbiAgICB9XG59XG5cbmV4cG9ydCB7IE5ldHdvcmtPbmx5IGFzIE4sIFN0cmF0ZWd5IGFzIFMsIE5ldHdvcmtGaXJzdCBhcyBhLCBTdHJhdGVneUhhbmRsZXIgYXMgYiwgY2FjaGVPa0FuZE9wYXF1ZVBsdWdpbiBhcyBjLCBtZXNzYWdlcyBhcyBtIH07XG4iXSwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/NetworkOnly.js\n")); + +/***/ }), + +/***/ "./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/PrecacheFallbackPlugin.js": +/*!*********************************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/PrecacheFallbackPlugin.js ***! + \*********************************************************************************************************************************/ +/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ B: function() { return /* binding */ BackgroundSyncPlugin; },\n/* harmony export */ P: function() { return /* binding */ PrecacheFallbackPlugin; },\n/* harmony export */ Q: function() { return /* binding */ Queue; },\n/* harmony export */ R: function() { return /* binding */ Route; },\n/* harmony export */ S: function() { return /* binding */ StorableRequest; },\n/* harmony export */ a: function() { return /* binding */ QueueStore; },\n/* harmony export */ d: function() { return /* binding */ defaultMethod; },\n/* harmony export */ i: function() { return /* binding */ initialize; },\n/* harmony export */ n: function() { return /* binding */ normalizeHandler; }\n/* harmony export */ });\n/* harmony import */ var _timeout_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./timeout.js */ \"./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/timeout.js\");\n/* harmony import */ var _NetworkOnly_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./NetworkOnly.js */ \"./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/NetworkOnly.js\");\n/* harmony import */ var idb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! idb */ \"./node_modules/.pnpm/idb@8.0.0/node_modules/idb/build/index.js\");\n\n\n\n\nconst defaultMethod = \"GET\";\nconst validMethods = [\n \"DELETE\",\n \"GET\",\n \"HEAD\",\n \"PATCH\",\n \"POST\",\n \"PUT\"\n];\n\nconst normalizeHandler = (handler)=>{\n if (handler && typeof handler === \"object\") {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.hasMethod(handler, \"handle\", {\n moduleName: \"serwist\",\n className: \"Route\",\n funcName: \"constructor\",\n paramName: \"handler\"\n });\n }\n return handler;\n }\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(handler, \"function\", {\n moduleName: \"serwist\",\n className: \"Route\",\n funcName: \"constructor\",\n paramName: \"handler\"\n });\n }\n return {\n handle: handler\n };\n};\n\nclass Route {\n handler;\n match;\n method;\n catchHandler;\n constructor(match, handler, method = defaultMethod){\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(match, \"function\", {\n moduleName: \"serwist\",\n className: \"Route\",\n funcName: \"constructor\",\n paramName: \"match\"\n });\n if (method) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isOneOf(method, validMethods, {\n paramName: \"method\"\n });\n }\n }\n this.handler = normalizeHandler(handler);\n this.match = match;\n this.method = method;\n }\n setCatchHandler(handler) {\n this.catchHandler = normalizeHandler(handler);\n }\n}\n\nconst DB_VERSION = 3;\nconst DB_NAME = \"serwist-background-sync\";\nconst REQUEST_OBJECT_STORE_NAME = \"requests\";\nconst QUEUE_NAME_INDEX = \"queueName\";\nclass QueueDb {\n _db = null;\n async addEntry(entry) {\n const db = await this.getDb();\n const tx = db.transaction(REQUEST_OBJECT_STORE_NAME, \"readwrite\", {\n durability: \"relaxed\"\n });\n await tx.store.add(entry);\n await tx.done;\n }\n async getFirstEntryId() {\n const db = await this.getDb();\n const cursor = await db.transaction(REQUEST_OBJECT_STORE_NAME).store.openCursor();\n return cursor?.value.id;\n }\n async getAllEntriesByQueueName(queueName) {\n const db = await this.getDb();\n const results = await db.getAllFromIndex(REQUEST_OBJECT_STORE_NAME, QUEUE_NAME_INDEX, IDBKeyRange.only(queueName));\n return results ? results : new Array();\n }\n async getEntryCountByQueueName(queueName) {\n const db = await this.getDb();\n return db.countFromIndex(REQUEST_OBJECT_STORE_NAME, QUEUE_NAME_INDEX, IDBKeyRange.only(queueName));\n }\n async deleteEntry(id) {\n const db = await this.getDb();\n await db.delete(REQUEST_OBJECT_STORE_NAME, id);\n }\n async getFirstEntryByQueueName(queueName) {\n return await this.getEndEntryFromIndex(IDBKeyRange.only(queueName), \"next\");\n }\n async getLastEntryByQueueName(queueName) {\n return await this.getEndEntryFromIndex(IDBKeyRange.only(queueName), \"prev\");\n }\n async getEndEntryFromIndex(query, direction) {\n const db = await this.getDb();\n const cursor = await db.transaction(REQUEST_OBJECT_STORE_NAME).store.index(QUEUE_NAME_INDEX).openCursor(query, direction);\n return cursor?.value;\n }\n async getDb() {\n if (!this._db) {\n this._db = await (0,idb__WEBPACK_IMPORTED_MODULE_2__.openDB)(DB_NAME, DB_VERSION, {\n upgrade: this._upgradeDb\n });\n }\n return this._db;\n }\n _upgradeDb(db, oldVersion) {\n if (oldVersion > 0 && oldVersion < DB_VERSION) {\n if (db.objectStoreNames.contains(REQUEST_OBJECT_STORE_NAME)) {\n db.deleteObjectStore(REQUEST_OBJECT_STORE_NAME);\n }\n }\n const objStore = db.createObjectStore(REQUEST_OBJECT_STORE_NAME, {\n autoIncrement: true,\n keyPath: \"id\"\n });\n objStore.createIndex(QUEUE_NAME_INDEX, QUEUE_NAME_INDEX, {\n unique: false\n });\n }\n}\n\nclass QueueStore {\n _queueName;\n _queueDb;\n constructor(queueName){\n this._queueName = queueName;\n this._queueDb = new QueueDb();\n }\n async pushEntry(entry) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(entry, \"object\", {\n moduleName: \"serwist/plugins\",\n className: \"BackgroundSyncQueueStore\",\n funcName: \"pushEntry\",\n paramName: \"entry\"\n });\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(entry.requestData, \"object\", {\n moduleName: \"serwist/plugins\",\n className: \"BackgroundSyncQueueStore\",\n funcName: \"pushEntry\",\n paramName: \"entry.requestData\"\n });\n }\n delete entry.id;\n entry.queueName = this._queueName;\n await this._queueDb.addEntry(entry);\n }\n async unshiftEntry(entry) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(entry, \"object\", {\n moduleName: \"serwist/plugins\",\n className: \"BackgroundSyncQueueStore\",\n funcName: \"unshiftEntry\",\n paramName: \"entry\"\n });\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(entry.requestData, \"object\", {\n moduleName: \"serwist/plugins\",\n className: \"BackgroundSyncQueueStore\",\n funcName: \"unshiftEntry\",\n paramName: \"entry.requestData\"\n });\n }\n const firstId = await this._queueDb.getFirstEntryId();\n if (firstId) {\n entry.id = firstId - 1;\n } else {\n delete entry.id;\n }\n entry.queueName = this._queueName;\n await this._queueDb.addEntry(entry);\n }\n async popEntry() {\n return this._removeEntry(await this._queueDb.getLastEntryByQueueName(this._queueName));\n }\n async shiftEntry() {\n return this._removeEntry(await this._queueDb.getFirstEntryByQueueName(this._queueName));\n }\n async getAll() {\n return await this._queueDb.getAllEntriesByQueueName(this._queueName);\n }\n async size() {\n return await this._queueDb.getEntryCountByQueueName(this._queueName);\n }\n async deleteEntry(id) {\n await this._queueDb.deleteEntry(id);\n }\n async _removeEntry(entry) {\n if (entry) {\n await this.deleteEntry(entry.id);\n }\n return entry;\n }\n}\n\nconst serializableProperties = [\n \"method\",\n \"referrer\",\n \"referrerPolicy\",\n \"mode\",\n \"credentials\",\n \"cache\",\n \"redirect\",\n \"integrity\",\n \"keepalive\"\n];\nclass StorableRequest {\n _requestData;\n static async fromRequest(request) {\n const requestData = {\n url: request.url,\n headers: {}\n };\n if (request.method !== \"GET\") {\n requestData.body = await request.clone().arrayBuffer();\n }\n request.headers.forEach((value, key)=>{\n requestData.headers[key] = value;\n });\n for (const prop of serializableProperties){\n if (request[prop] !== undefined) {\n requestData[prop] = request[prop];\n }\n }\n return new StorableRequest(requestData);\n }\n constructor(requestData){\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(requestData, \"object\", {\n moduleName: \"serwist/plugins\",\n className: \"StorableRequest\",\n funcName: \"constructor\",\n paramName: \"requestData\"\n });\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(requestData.url, \"string\", {\n moduleName: \"serwist/plugins\",\n className: \"StorableRequest\",\n funcName: \"constructor\",\n paramName: \"requestData.url\"\n });\n }\n if (requestData.mode === \"navigate\") {\n requestData.mode = \"same-origin\";\n }\n this._requestData = requestData;\n }\n toObject() {\n const requestData = Object.assign({}, this._requestData);\n requestData.headers = Object.assign({}, this._requestData.headers);\n if (requestData.body) {\n requestData.body = requestData.body.slice(0);\n }\n return requestData;\n }\n toRequest() {\n return new Request(this._requestData.url, this._requestData);\n }\n clone() {\n return new StorableRequest(this.toObject());\n }\n}\n\nconst TAG_PREFIX = \"serwist-background-sync\";\nconst MAX_RETENTION_TIME$1 = 60 * 24 * 7;\nconst queueNames = new Set();\nconst convertEntry = (queueStoreEntry)=>{\n const queueEntry = {\n request: new StorableRequest(queueStoreEntry.requestData).toRequest(),\n timestamp: queueStoreEntry.timestamp\n };\n if (queueStoreEntry.metadata) {\n queueEntry.metadata = queueStoreEntry.metadata;\n }\n return queueEntry;\n};\nclass Queue {\n _name;\n _onSync;\n _maxRetentionTime;\n _queueStore;\n _forceSyncFallback;\n _syncInProgress = false;\n _requestsAddedDuringSync = false;\n constructor(name, { forceSyncFallback, onSync, maxRetentionTime } = {}){\n if (queueNames.has(name)) {\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"duplicate-queue-name\", {\n name\n });\n }\n queueNames.add(name);\n this._name = name;\n this._onSync = onSync || this.replayRequests;\n this._maxRetentionTime = maxRetentionTime || MAX_RETENTION_TIME$1;\n this._forceSyncFallback = Boolean(forceSyncFallback);\n this._queueStore = new QueueStore(this._name);\n this._addSyncListener();\n }\n get name() {\n return this._name;\n }\n async pushRequest(entry) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(entry, \"object\", {\n moduleName: \"serwist/plugins\",\n className: \"BackgroundSyncQueue\",\n funcName: \"pushRequest\",\n paramName: \"entry\"\n });\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isInstance(entry.request, Request, {\n moduleName: \"serwist/plugins\",\n className: \"BackgroundSyncQueue\",\n funcName: \"pushRequest\",\n paramName: \"entry.request\"\n });\n }\n await this._addRequest(entry, \"push\");\n }\n async unshiftRequest(entry) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(entry, \"object\", {\n moduleName: \"serwist/plugins\",\n className: \"BackgroundSyncQueue\",\n funcName: \"unshiftRequest\",\n paramName: \"entry\"\n });\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isInstance(entry.request, Request, {\n moduleName: \"serwist/plugins\",\n className: \"BackgroundSyncQueue\",\n funcName: \"unshiftRequest\",\n paramName: \"entry.request\"\n });\n }\n await this._addRequest(entry, \"unshift\");\n }\n async popRequest() {\n return this._removeRequest(\"pop\");\n }\n async shiftRequest() {\n return this._removeRequest(\"shift\");\n }\n async getAll() {\n const allEntries = await this._queueStore.getAll();\n const now = Date.now();\n const unexpiredEntries = [];\n for (const entry of allEntries){\n const maxRetentionTimeInMs = this._maxRetentionTime * 60 * 1000;\n if (now - entry.timestamp > maxRetentionTimeInMs) {\n await this._queueStore.deleteEntry(entry.id);\n } else {\n unexpiredEntries.push(convertEntry(entry));\n }\n }\n return unexpiredEntries;\n }\n async size() {\n return await this._queueStore.size();\n }\n async _addRequest({ request, metadata, timestamp = Date.now() }, operation) {\n const storableRequest = await StorableRequest.fromRequest(request.clone());\n const entry = {\n requestData: storableRequest.toObject(),\n timestamp\n };\n if (metadata) {\n entry.metadata = metadata;\n }\n switch(operation){\n case \"push\":\n await this._queueStore.pushEntry(entry);\n break;\n case \"unshift\":\n await this._queueStore.unshiftEntry(entry);\n break;\n }\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`Request for '${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(request.url)}' has ` + `been added to background sync queue '${this._name}'.`);\n }\n if (this._syncInProgress) {\n this._requestsAddedDuringSync = true;\n } else {\n await this.registerSync();\n }\n }\n async _removeRequest(operation) {\n const now = Date.now();\n let entry;\n switch(operation){\n case \"pop\":\n entry = await this._queueStore.popEntry();\n break;\n case \"shift\":\n entry = await this._queueStore.shiftEntry();\n break;\n }\n if (entry) {\n const maxRetentionTimeInMs = this._maxRetentionTime * 60 * 1000;\n if (now - entry.timestamp > maxRetentionTimeInMs) {\n return this._removeRequest(operation);\n }\n return convertEntry(entry);\n }\n return undefined;\n }\n async replayRequests() {\n let entry = undefined;\n while(entry = await this.shiftRequest()){\n try {\n await fetch(entry.request.clone());\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`Request for '${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(entry.request.url)}' ` + `has been replayed in queue '${this._name}'`);\n }\n } catch (error) {\n await this.unshiftRequest(entry);\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`Request for '${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(entry.request.url)}' ` + `failed to replay, putting it back in queue '${this._name}'`);\n }\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"queue-replay-failed\", {\n name: this._name\n });\n }\n }\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`All requests in queue '${this.name}' have successfully replayed; the queue is now empty!`);\n }\n }\n async registerSync() {\n if (\"sync\" in self.registration && !this._forceSyncFallback) {\n try {\n await self.registration.sync.register(`${TAG_PREFIX}:${this._name}`);\n } catch (err) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.warn(`Unable to register sync event for '${this._name}'.`, err);\n }\n }\n }\n }\n _addSyncListener() {\n if (\"sync\" in self.registration && !this._forceSyncFallback) {\n self.addEventListener(\"sync\", (event)=>{\n if (event.tag === `${TAG_PREFIX}:${this._name}`) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`Background sync for tag '${event.tag}' has been received`);\n }\n const syncComplete = async ()=>{\n this._syncInProgress = true;\n let syncError = undefined;\n try {\n await this._onSync({\n queue: this\n });\n } catch (error) {\n if (error instanceof Error) {\n syncError = error;\n throw syncError;\n }\n } finally{\n if (this._requestsAddedDuringSync && !(syncError && !event.lastChance)) {\n await this.registerSync();\n }\n this._syncInProgress = false;\n this._requestsAddedDuringSync = false;\n }\n };\n event.waitUntil(syncComplete());\n }\n });\n } else {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(\"Background sync replaying without background sync event\");\n }\n void this._onSync({\n queue: this\n });\n }\n }\n static get _queueNames() {\n return queueNames;\n }\n}\n\nclass BackgroundSyncPlugin {\n _queue;\n constructor(name, options){\n this._queue = new Queue(name, options);\n }\n async fetchDidFail({ request }) {\n await this._queue.pushRequest({\n request\n });\n }\n}\n\nconst QUEUE_NAME = \"serwist-google-analytics\";\nconst MAX_RETENTION_TIME = 60 * 48;\nconst GOOGLE_ANALYTICS_HOST = \"www.google-analytics.com\";\nconst GTM_HOST = \"www.googletagmanager.com\";\nconst ANALYTICS_JS_PATH = \"/analytics.js\";\nconst GTAG_JS_PATH = \"/gtag/js\";\nconst GTM_JS_PATH = \"/gtm.js\";\nconst COLLECT_PATHS_REGEX = /^\\/(\\w+\\/)?collect/;\n\nconst createOnSyncCallback = (config)=>{\n return async ({ queue })=>{\n let entry = undefined;\n while(entry = await queue.shiftRequest()){\n const { request, timestamp } = entry;\n const url = new URL(request.url);\n try {\n const params = request.method === \"POST\" ? new URLSearchParams(await request.clone().text()) : url.searchParams;\n const originalHitTime = timestamp - (Number(params.get(\"qt\")) || 0);\n const queueTime = Date.now() - originalHitTime;\n params.set(\"qt\", String(queueTime));\n if (config.parameterOverrides) {\n for (const param of Object.keys(config.parameterOverrides)){\n const value = config.parameterOverrides[param];\n params.set(param, value);\n }\n }\n if (typeof config.hitFilter === \"function\") {\n config.hitFilter.call(null, params);\n }\n await fetch(new Request(url.origin + url.pathname, {\n body: params.toString(),\n method: \"POST\",\n mode: \"cors\",\n credentials: \"omit\",\n headers: {\n \"Content-Type\": \"text/plain\"\n }\n }));\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`Request for '${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(url.href)}' has been replayed`);\n }\n } catch (err) {\n await queue.unshiftRequest(entry);\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`Request for '${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(url.href)}' failed to replay, putting it back in the queue.`);\n }\n throw err;\n }\n }\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(\"All Google Analytics request successfully replayed; \" + \"the queue is now empty!\");\n }\n };\n};\nconst createCollectRoutes = (bgSyncPlugin)=>{\n const match = ({ url })=>url.hostname === GOOGLE_ANALYTICS_HOST && COLLECT_PATHS_REGEX.test(url.pathname);\n const handler = new _NetworkOnly_js__WEBPACK_IMPORTED_MODULE_1__.N({\n plugins: [\n bgSyncPlugin\n ]\n });\n return [\n new Route(match, handler, \"GET\"),\n new Route(match, handler, \"POST\")\n ];\n};\nconst createAnalyticsJsRoute = (cacheName)=>{\n const match = ({ url })=>url.hostname === GOOGLE_ANALYTICS_HOST && url.pathname === ANALYTICS_JS_PATH;\n const handler = new _NetworkOnly_js__WEBPACK_IMPORTED_MODULE_1__.a({\n cacheName\n });\n return new Route(match, handler, \"GET\");\n};\nconst createGtagJsRoute = (cacheName)=>{\n const match = ({ url })=>url.hostname === GTM_HOST && url.pathname === GTAG_JS_PATH;\n const handler = new _NetworkOnly_js__WEBPACK_IMPORTED_MODULE_1__.a({\n cacheName\n });\n return new Route(match, handler, \"GET\");\n};\nconst createGtmJsRoute = (cacheName)=>{\n const match = ({ url })=>url.hostname === GTM_HOST && url.pathname === GTM_JS_PATH;\n const handler = new _NetworkOnly_js__WEBPACK_IMPORTED_MODULE_1__.a({\n cacheName\n });\n return new Route(match, handler, \"GET\");\n};\nconst initialize = ({ serwist, cacheName, ...options })=>{\n const resolvedCacheName = _timeout_js__WEBPACK_IMPORTED_MODULE_0__.c.getGoogleAnalyticsName(cacheName);\n const bgSyncPlugin = new BackgroundSyncPlugin(QUEUE_NAME, {\n maxRetentionTime: MAX_RETENTION_TIME,\n onSync: createOnSyncCallback(options)\n });\n const routes = [\n createGtmJsRoute(resolvedCacheName),\n createAnalyticsJsRoute(resolvedCacheName),\n createGtagJsRoute(resolvedCacheName),\n ...createCollectRoutes(bgSyncPlugin)\n ];\n for (const route of routes){\n serwist.registerRoute(route);\n }\n};\n\nclass PrecacheFallbackPlugin {\n _fallbackUrls;\n _serwist;\n constructor({ fallbackUrls, serwist }){\n this._fallbackUrls = fallbackUrls;\n this._serwist = serwist;\n }\n async handlerDidError(param) {\n for (const fallback of this._fallbackUrls){\n if (typeof fallback === \"string\") {\n const fallbackResponse = await this._serwist.matchPrecache(fallback);\n if (fallbackResponse !== undefined) {\n return fallbackResponse;\n }\n } else if (fallback.matcher(param)) {\n const fallbackResponse = await this._serwist.matchPrecache(fallback.url);\n if (fallbackResponse !== undefined) {\n return fallbackResponse;\n }\n }\n }\n return undefined;\n }\n}\n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vc2Vyd2lzdEA5LjAuMC1wcmV2aWV3LjI0X3R5cGVzY3JpcHRANS40LjUvbm9kZV9tb2R1bGVzL3Nlcndpc3QvZGlzdC9jaHVua3MvUHJlY2FjaGVGYWxsYmFja1BsdWdpbi5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7QUFBNkg7QUFDdEQ7QUFDMUM7O0FBR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mVxdWVzdCkge1xuICAgICAgICBjb25zdCByZXF1ZXN0RGF0YSA9IHtcbiAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXG4gICAgICAgICAgICBoZWFkZXJzOiB7fVxuICAgICAgICB9O1xuICAgICAgICBpZiAocmVxdWVzdC5tZXRob2QgIT09IFwiR0VUXCIpIHtcbiAgICAgICAgICAgIHJlcXVlc3REYXRhLmJvZHkgPSBhd2FpdCByZXF1ZXN0LmNsb25lKCkuYXJyYXlCdWZmZXIoKTtcbiAgICAgICAgfVxuICAgICAgICByZXF1ZXN0LmhlYWRlcnMuZm9yRWFjaCgodmFsdWUsIGtleSk9PntcbiAgICAgICAgICAgIHJlcXVlc3REYXRhLmhlYWRlcnNba2V5XSA9IHZhbHVlO1xuICAgICAgICB9KTtcbiAgICAgICAgZm9yIChjb25zdCBwcm9wIG9mIHNlcmlhbGl6YWJsZVByb3BlcnRpZXMpe1xuICAgICAgICAgICAgaWYgKHJlcXVlc3RbcHJvcF0gIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgIHJlcXVlc3REYXRhW3Byb3BdID0gcmVxdWVzdFtwcm9wXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbmV3IFN0b3JhYmxlUmVxdWVzdChyZXF1ZXN0RGF0YSk7XG4gICAgfVxuICAgIGNvbnN0cnVjdG9yKHJlcXVlc3REYXRhKXtcbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmlzVHlwZShyZXF1ZXN0RGF0YSwgXCJvYmplY3RcIiwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwic2Vyd2lzdC9wbHVnaW5zXCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIlN0b3JhYmxlUmVxdWVzdFwiLFxuICAgICAgICAgICAgICAgI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AgICAgICAgICBjbGFzc05hbWU6IFwiQmFja2dyb3VuZFN5bmNRdWV1ZVwiLFxuICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcInB1c2hSZXF1ZXN0XCIsXG4gICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcImVudHJ5XCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmlzSW5zdGFuY2UoZW50cnkucmVxdWVzdCwgUmVxdWVzdCwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwic2Vyd2lzdC9wbHVnaW5zXCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIkJhY2tncm91bmRTeW5jUXVldWVcIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJwdXNoUmVxdWVzdFwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJlbnRyeS5yZXF1ZXN0XCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGF3YWl0IHRoaXMuX2FkZFJlcXVlc3QoZW50cnksIFwicHVzaFwiKTtcbiAgICB9XG4gICAgYXN5bmMgdW5zaGlmdFJlcXVlc3QoZW50cnkpIHtcbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmlzVHlwZShlbnRyeSwgXCJvYmplY3RcIiwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwic2Vyd2lzdC9wbHVnaW5zXCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIkJhY2tncm91bmRTeW5jUXVldWVcIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJ1bnNoaWZ0UmVxdWVzdFwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJlbnRyeVwiXG4gICAgICAgICAgICB9KTtcb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Iud2FybihgVW5hYmxlIHRvIHJlZ2lzdGVyIHN5bmMgZXZlbnQgZm9yICcke3RoaXMuX25hbWV9Jy5gLCBlcnIpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbiAgICBfYWRkU3luY0xpc3RlbmVyKCkge1xuICAgICAgICBpZiAoXCJzeW5jXCIgaW4gc2VsZi5yZWdpc3RyYXRpb24gJiYgIXRoaXMuX2ZvcmNlU3luY0ZhbGxiYWNrKSB7XG4gICAgICAgICAgICBzZWxmLmFkZEV2ZW50TGlzdGVuZXIoXCJzeW5jXCIsIChldmVudCk9PntcbiAgICAgICAgICAgICAgICBpZiAoZXZlbnQudGFnID09PSBgJHtUQUdfUFJFRklYfToke3RoaXMuX25hbWV9YCkge1xuICAgICAgICAgICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsb2dnZXIubG9nKGBCYWNrZ3JvdW5kIHN5bmMgZm9yIHRhZyAnJHtldmVudC50YWd9JyBoYXMgYmVlbiByZWNlaXZlZGApO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHN5bmNDb21wbGV0ZSA9IGFzeW5jICgpPT57XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9zeW5jSW5Qcm9ncmVzcyA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgc3luY0Vycm9yID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCB0aGlzLl9vblN5bmMoe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBxdWV1ZTogdGhpc1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXJyb3IgaW5zdGFuY2VvZiBFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzeW5jRXJyb3IgPSBlcnJvcjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgc3luY0Vycm9yO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseXtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5fcmVxdWVzdHNBZGRlZER1cmluZ1N5bmMgJiYgIShzeW5jRXJyb3IgJiYgIWV2ZW50Lmxhc3RDaGFuY2UpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IHRoaXMucmVnaXN0ZXJTeW5jKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3N5bmNJblByb2dyZXNzID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fcmVxdWVzdHNBZGRlZER1cmluZ1N5bmMgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAgICAgZXZlbnQud2FpdFVudGlsKHN5bmNDb21wbGV0ZSgpKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICBsb2dnZXIubG9nKFwiQmFja2dyb3VuZCBzeW5jIHJlcGxheWluZyB3aXRob3V0IGJhY2tncm91bmQgc3luYyBldmVudFwiKTtcbiAgICAgICAgICAg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hcmFtcy5zZXQocGFyYW0sIHZhbHVlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAodHlwZW9mIGNvbmZpZy5oaXRGaWx0ZXIgPT09IFwiZnVuY3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICBjb25maWcuaGl0RmlsdGVyLmNhbGwobnVsbCwgcGFyYW1zKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYXdhaXQgZmV0Y2gobmV3IFJlcXVlc3QodXJsLm9yaWdpbiArIHVybC5wYXRobmFtZSwge1xuICAgICAgICAgICAgICAgICAgICBib2R5OiBwYXJhbXMudG9TdHJpbmcoKSxcbiAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiBcIlBPU1RcIixcbiAgICAgICAgICAgICAgICAgICAgbW9kZTogXCJjb3JzXCIsXG4gICAgICAgICAgICAgICAgICAgIGNyZWRlbnRpYWxzOiBcIm9taXRcIixcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJDb250ZW50LVR5cGVcIjogXCJ0ZXh0L3BsYWluXCJcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ2dlci5sb2coYFJlcXVlc3QgZm9yICcke2dldEZyaWVuZGx5VVJMKHVybC5ocmVmKX0nIGhhcyBiZWVuIHJlcGxheWVkYCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgICAgICAgYXdhaXQgcXVldWUudW5zaGlmdFJlcXVlc3QoZW50cnkpO1xuICAgICAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VO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hbGxiYWNrVXJscyl7XG4gICAgICAgICAgICBpZiAodHlwZW9mIGZhbGxiYWNrID09PSBcInN0cmluZ1wiKSB7XG4gICAgICAgICAgICAgICAgY29uc3QgZmFsbGJhY2tSZXNwb25zZSA9IGF3YWl0IHRoaXMuX3Nlcndpc3QubWF0Y2hQcmVjYWNoZShmYWxsYmFjayk7XG4gICAgICAgICAgICAgICAgaWYgKGZhbGxiYWNrUmVzcG9uc2UgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsbGJhY2tSZXNwb25zZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGZhbGxiYWNrLm1hdGNoZXIocGFyYW0pKSB7XG4gICAgICAgICAgICAgICAgY29uc3QgZmFsbGJhY2tSZXNwb25zZSA9IGF3YWl0IHRoaXMuX3Nlcndpc3QubWF0Y2hQcmVjYWNoZShmYWxsYmFjay51cmwpO1xuICAgICAgICAgICAgICAgIGlmIChmYWxsYmFja1Jlc3BvbnNlICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbGxiYWNrUmVzcG9uc2U7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiB1bmRlZmluZWQ7XG4gICAgfVxufVxuXG5leHBvcnQgeyBCYWNrZ3JvdW5kU3luY1BsdWdpbiBhcyBCLCBQcmVjYWNoZUZhbGxiYWNrUGx1Z2luIGFzIFAsIFF1ZXVlIGFzIFEsIFJvdXRlIGFzIFIsIFN0b3JhYmxlUmVxdWVzdCBhcyBTLCBRdWV1ZVN0b3JlIGFzIGEsIGRlZmF1bHRNZXRob2QgYXMgZCwgaW5pdGlhbGl6ZSBhcyBpLCBub3JtYWxpemVIYW5kbGVyIGFzIG4gfTtcbiJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/PrecacheFallbackPlugin.js\n")); + +/***/ }), + +/***/ "./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/Serwist.js": +/*!******************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/Serwist.js ***! + \******************************************************************************************************************/ +/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ N: function() { return /* binding */ NavigationRoute; },\n/* harmony export */ P: function() { return /* binding */ PrecacheRoute; },\n/* harmony export */ R: function() { return /* binding */ RegExpRoute; },\n/* harmony export */ S: function() { return /* binding */ Serwist; },\n/* harmony export */ a: function() { return /* binding */ clientsClaim; },\n/* harmony export */ b: function() { return /* binding */ copyResponse; },\n/* harmony export */ c: function() { return /* binding */ cleanupOutdatedCaches; },\n/* harmony export */ d: function() { return /* binding */ disableDevLogs; },\n/* harmony export */ e: function() { return /* binding */ disableNavigationPreload; },\n/* harmony export */ f: function() { return /* binding */ enableNavigationPreload; },\n/* harmony export */ g: function() { return /* binding */ PrecacheStrategy; },\n/* harmony export */ h: function() { return /* binding */ createCacheKey; },\n/* harmony export */ i: function() { return /* binding */ isNavigationPreloadSupported; },\n/* harmony export */ j: function() { return /* binding */ parallel; },\n/* harmony export */ k: function() { return /* binding */ printInstallDetails; },\n/* harmony export */ l: function() { return /* binding */ printCleanupDetails; },\n/* harmony export */ m: function() { return /* binding */ PrecacheInstallReportPlugin; },\n/* harmony export */ n: function() { return /* binding */ generateURLVariations; },\n/* harmony export */ p: function() { return /* binding */ parseRoute; },\n/* harmony export */ s: function() { return /* binding */ setCacheNameDetails; }\n/* harmony export */ });\n/* harmony import */ var _timeout_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./timeout.js */ \"./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/timeout.js\");\n/* harmony import */ var _waitUntil_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./waitUntil.js */ \"./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/waitUntil.js\");\n/* harmony import */ var _PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./PrecacheFallbackPlugin.js */ \"./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/PrecacheFallbackPlugin.js\");\n/* harmony import */ var _NetworkOnly_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./NetworkOnly.js */ \"./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/NetworkOnly.js\");\n\n\n\n\n\nconst SUBSTRING_TO_FIND = \"-precache-\";\nconst deleteOutdatedCaches = async (currentPrecacheName, substringToFind = SUBSTRING_TO_FIND)=>{\n const cacheNames = await self.caches.keys();\n const cacheNamesToDelete = cacheNames.filter((cacheName)=>{\n return cacheName.includes(substringToFind) && cacheName.includes(self.registration.scope) && cacheName !== currentPrecacheName;\n });\n await Promise.all(cacheNamesToDelete.map((cacheName)=>self.caches.delete(cacheName)));\n return cacheNamesToDelete;\n};\n\nconst cleanupOutdatedCaches = (cacheName)=>{\n self.addEventListener(\"activate\", (event)=>{\n event.waitUntil(deleteOutdatedCaches(_timeout_js__WEBPACK_IMPORTED_MODULE_0__.c.getPrecacheName(cacheName)).then((cachesDeleted)=>{\n if (true) {\n if (cachesDeleted.length > 0) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(\"The following out-of-date precaches were cleaned up automatically:\", cachesDeleted);\n }\n }\n }));\n });\n};\n\nconst clientsClaim = ()=>{\n self.addEventListener(\"activate\", ()=>self.clients.claim());\n};\n\nconst copyResponse = async (response, modifier)=>{\n let origin = null;\n if (response.url) {\n const responseURL = new URL(response.url);\n origin = responseURL.origin;\n }\n if (origin !== self.location.origin) {\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"cross-origin-copy-response\", {\n origin\n });\n }\n const clonedResponse = response.clone();\n const responseInit = {\n headers: new Headers(clonedResponse.headers),\n status: clonedResponse.status,\n statusText: clonedResponse.statusText\n };\n const modifiedResponseInit = modifier ? modifier(responseInit) : responseInit;\n const body = (0,_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.c)() ? clonedResponse.body : await clonedResponse.blob();\n return new Response(body, modifiedResponseInit);\n};\n\nconst disableDevLogs = ()=>{\n self.__WB_DISABLE_DEV_LOGS = true;\n};\n\nconst isNavigationPreloadSupported = ()=>{\n return Boolean(self.registration?.navigationPreload);\n};\nconst enableNavigationPreload = (headerValue)=>{\n if (isNavigationPreloadSupported()) {\n self.addEventListener(\"activate\", (event)=>{\n event.waitUntil(self.registration.navigationPreload.enable().then(()=>{\n if (headerValue) {\n void self.registration.navigationPreload.setHeaderValue(headerValue);\n }\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(\"Navigation preloading is enabled.\");\n }\n }));\n });\n } else {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(\"Navigation preloading is not supported in this browser.\");\n }\n }\n};\nconst disableNavigationPreload = ()=>{\n if (isNavigationPreloadSupported()) {\n self.addEventListener(\"activate\", (event)=>{\n event.waitUntil(self.registration.navigationPreload.disable().then(()=>{\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(\"Navigation preloading is disabled.\");\n }\n }));\n });\n } else {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(\"Navigation preloading is not supported in this browser.\");\n }\n }\n};\n\nclass NavigationRoute extends _PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_2__.R {\n _allowlist;\n _denylist;\n constructor(handler, { allowlist = [\n /./\n ], denylist = [] } = {}){\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isArrayOfClass(allowlist, RegExp, {\n moduleName: \"serwist\",\n className: \"NavigationRoute\",\n funcName: \"constructor\",\n paramName: \"options.allowlist\"\n });\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isArrayOfClass(denylist, RegExp, {\n moduleName: \"serwist\",\n className: \"NavigationRoute\",\n funcName: \"constructor\",\n paramName: \"options.denylist\"\n });\n }\n super((options)=>this._match(options), handler);\n this._allowlist = allowlist;\n this._denylist = denylist;\n }\n _match({ url, request }) {\n if (request && request.mode !== \"navigate\") {\n return false;\n }\n const pathnameAndSearch = url.pathname + url.search;\n for (const regExp of this._denylist){\n if (regExp.test(pathnameAndSearch)) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`The navigation route ${pathnameAndSearch} is not being used, since the URL matches this denylist pattern: ${regExp.toString()}`);\n }\n return false;\n }\n }\n if (this._allowlist.some((regExp)=>regExp.test(pathnameAndSearch))) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.debug(`The navigation route ${pathnameAndSearch} is being used.`);\n }\n return true;\n }\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`The navigation route ${pathnameAndSearch} is not being used, since the URL being navigated to doesn't match the allowlist.`);\n }\n return false;\n }\n}\n\nclass RegExpRoute extends _PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_2__.R {\n constructor(regExp, handler, method){\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isInstance(regExp, RegExp, {\n moduleName: \"serwist\",\n className: \"RegExpRoute\",\n funcName: \"constructor\",\n paramName: \"pattern\"\n });\n }\n const match = ({ url })=>{\n const result = regExp.exec(url.href);\n if (!result) {\n return;\n }\n if (url.origin !== location.origin && result.index !== 0) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.debug(`The regular expression '${regExp.toString()}' only partially matched against the cross-origin URL '${url.toString()}'. RegExpRoute's will only handle cross-origin requests if they match the entire URL.`);\n }\n return;\n }\n return result.slice(1);\n };\n super(match, handler, method);\n }\n}\n\nconst parseRoute = (capture, handler, method)=>{\n let route;\n if (typeof capture === \"string\") {\n const captureUrl = new URL(capture, location.href);\n if (true) {\n if (!(capture.startsWith(\"/\") || capture.startsWith(\"http\"))) {\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"invalid-string\", {\n moduleName: \"serwist\",\n funcName: \"parseRoute\",\n paramName: \"capture\"\n });\n }\n const valueToCheck = capture.startsWith(\"http\") ? captureUrl.pathname : capture;\n const wildcards = \"[*:?+]\";\n if (new RegExp(`${wildcards}`).exec(valueToCheck)) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.debug(`The '$capture' parameter contains an Express-style wildcard character (${wildcards}). Strings are now always interpreted as exact matches; use a RegExp for partial or wildcard matches.`);\n }\n }\n const matchCallback = ({ url })=>{\n if (true) {\n if (url.pathname === captureUrl.pathname && url.origin !== captureUrl.origin) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.debug(`${capture} only partially matches the cross-origin URL ${url.toString()}. This route will only handle cross-origin requests if they match the entire URL.`);\n }\n }\n return url.href === captureUrl.href;\n };\n route = new _PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_2__.R(matchCallback, handler, method);\n } else if (capture instanceof RegExp) {\n route = new RegExpRoute(capture, handler, method);\n } else if (typeof capture === \"function\") {\n route = new _PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_2__.R(capture, handler, method);\n } else if (capture instanceof _PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_2__.R) {\n route = capture;\n } else {\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"unsupported-route-type\", {\n moduleName: \"serwist\",\n funcName: \"parseRoute\",\n paramName: \"capture\"\n });\n }\n return route;\n};\n\nconst removeIgnoredSearchParams = (urlObject, ignoreURLParametersMatching = [])=>{\n for (const paramName of [\n ...urlObject.searchParams.keys()\n ]){\n if (ignoreURLParametersMatching.some((regExp)=>regExp.test(paramName))) {\n urlObject.searchParams.delete(paramName);\n }\n }\n return urlObject;\n};\n\nfunction* generateURLVariations(url, { directoryIndex = \"index.html\", ignoreURLParametersMatching = [\n /^utm_/,\n /^fbclid$/\n], cleanURLs = true, urlManipulation } = {}) {\n const urlObject = new URL(url, location.href);\n urlObject.hash = \"\";\n yield urlObject.href;\n const urlWithoutIgnoredParams = removeIgnoredSearchParams(urlObject, ignoreURLParametersMatching);\n yield urlWithoutIgnoredParams.href;\n if (directoryIndex && urlWithoutIgnoredParams.pathname.endsWith(\"/\")) {\n const directoryURL = new URL(urlWithoutIgnoredParams.href);\n directoryURL.pathname += directoryIndex;\n yield directoryURL.href;\n }\n if (cleanURLs) {\n const cleanURL = new URL(urlWithoutIgnoredParams.href);\n cleanURL.pathname += \".html\";\n yield cleanURL.href;\n }\n if (urlManipulation) {\n const additionalURLs = urlManipulation({\n url: urlObject\n });\n for (const urlToAttempt of additionalURLs){\n yield urlToAttempt.href;\n }\n }\n}\n\nclass PrecacheRoute extends _PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_2__.R {\n constructor(serwist, options){\n const match = ({ request })=>{\n const urlsToCacheKeys = serwist.getUrlsToPrecacheKeys();\n for (const possibleURL of generateURLVariations(request.url, options)){\n const cacheKey = urlsToCacheKeys.get(possibleURL);\n if (cacheKey) {\n const integrity = serwist.getIntegrityForPrecacheKey(cacheKey);\n return {\n cacheKey,\n integrity\n };\n }\n }\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.debug(`Precaching did not find a match for ${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(request.url)}.`);\n }\n return;\n };\n super(match, serwist.precacheStrategy);\n }\n}\n\nclass PrecacheStrategy extends _NetworkOnly_js__WEBPACK_IMPORTED_MODULE_3__.S {\n _fallbackToNetwork;\n static defaultPrecacheCacheabilityPlugin = {\n async cacheWillUpdate ({ response }) {\n if (!response || response.status >= 400) {\n return null;\n }\n return response;\n }\n };\n static copyRedirectedCacheableResponsesPlugin = {\n async cacheWillUpdate ({ response }) {\n return response.redirected ? await copyResponse(response) : response;\n }\n };\n constructor(options = {}){\n options.cacheName = _timeout_js__WEBPACK_IMPORTED_MODULE_0__.c.getPrecacheName(options.cacheName);\n super(options);\n this._fallbackToNetwork = options.fallbackToNetwork === false ? false : true;\n this.plugins.push(PrecacheStrategy.copyRedirectedCacheableResponsesPlugin);\n }\n async _handle(request, handler) {\n const response = await handler.cacheMatch(request);\n if (response) {\n return response;\n }\n if (handler.event && handler.event.type === \"install\") {\n return await this._handleInstall(request, handler);\n }\n return await this._handleFetch(request, handler);\n }\n async _handleFetch(request, handler) {\n let response = undefined;\n const params = handler.params || {};\n if (this._fallbackToNetwork) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.warn(`The precached response for ${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(request.url)} in ${this.cacheName} was not found. Falling back to the network.`);\n }\n const integrityInManifest = params.integrity;\n const integrityInRequest = request.integrity;\n const noIntegrityConflict = !integrityInRequest || integrityInRequest === integrityInManifest;\n response = await handler.fetch(new Request(request, {\n integrity: request.mode !== \"no-cors\" ? integrityInRequest || integrityInManifest : undefined\n }));\n if (integrityInManifest && noIntegrityConflict && request.mode !== \"no-cors\") {\n this._useDefaultCacheabilityPluginIfNeeded();\n const wasCached = await handler.cachePut(request, response.clone());\n if (true) {\n if (wasCached) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`A response for ${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(request.url)} was used to \"repair\" the precache.`);\n }\n }\n }\n } else {\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"missing-precache-entry\", {\n cacheName: this.cacheName,\n url: request.url\n });\n }\n if (true) {\n const cacheKey = params.cacheKey || await handler.getCacheKey(request, \"read\");\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(`Precaching is responding to: ${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(request.url)}`);\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`Serving the precached url: ${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(cacheKey instanceof Request ? cacheKey.url : cacheKey)}`);\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(\"View request details here.\");\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(request);\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupEnd();\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(\"View response details here.\");\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(response);\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupEnd();\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupEnd();\n }\n return response;\n }\n async _handleInstall(request, handler) {\n this._useDefaultCacheabilityPluginIfNeeded();\n const response = await handler.fetch(request);\n const wasCached = await handler.cachePut(request, response.clone());\n if (!wasCached) {\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"bad-precaching-response\", {\n url: request.url,\n status: response.status\n });\n }\n return response;\n }\n _useDefaultCacheabilityPluginIfNeeded() {\n let defaultPluginIndex = null;\n let cacheWillUpdatePluginCount = 0;\n for (const [index, plugin] of this.plugins.entries()){\n if (plugin === PrecacheStrategy.copyRedirectedCacheableResponsesPlugin) {\n continue;\n }\n if (plugin === PrecacheStrategy.defaultPrecacheCacheabilityPlugin) {\n defaultPluginIndex = index;\n }\n if (plugin.cacheWillUpdate) {\n cacheWillUpdatePluginCount++;\n }\n }\n if (cacheWillUpdatePluginCount === 0) {\n this.plugins.push(PrecacheStrategy.defaultPrecacheCacheabilityPlugin);\n } else if (cacheWillUpdatePluginCount > 1 && defaultPluginIndex !== null) {\n this.plugins.splice(defaultPluginIndex, 1);\n }\n }\n}\n\nconst setCacheNameDetails = (details)=>{\n if (true) {\n for (const key of Object.keys(details)){\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(details[key], \"string\", {\n moduleName: \"@serwist/core\",\n funcName: \"setCacheNameDetails\",\n paramName: `details.${key}`\n });\n }\n if (details.precache?.length === 0) {\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"invalid-cache-name\", {\n cacheNameId: \"precache\",\n value: details.precache\n });\n }\n if (details.runtime?.length === 0) {\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"invalid-cache-name\", {\n cacheNameId: \"runtime\",\n value: details.runtime\n });\n }\n if (details.googleAnalytics?.length === 0) {\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"invalid-cache-name\", {\n cacheNameId: \"googleAnalytics\",\n value: details.googleAnalytics\n });\n }\n }\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.c.updateDetails(details);\n};\n\nconst parallel = async (limit, array, func)=>{\n const work = array.map((item, index)=>({\n index,\n item\n }));\n const processor = async (res)=>{\n const results = [];\n while(true){\n const next = work.pop();\n if (!next) {\n return res(results);\n }\n const result = await func(next.item);\n results.push({\n result: result,\n index: next.index\n });\n }\n };\n const queues = Array.from({\n length: limit\n }, ()=>new Promise(processor));\n const results = (await Promise.all(queues)).flat().sort((a, b)=>a.index < b.index ? -1 : 1).map((res)=>res.result);\n return results;\n};\n\nclass PrecacheCacheKeyPlugin {\n _precacheController;\n constructor({ precacheController }){\n this._precacheController = precacheController;\n }\n cacheKeyWillBeUsed = async ({ request, params })=>{\n const cacheKey = params?.cacheKey || this._precacheController.getPrecacheKeyForUrl(request.url);\n return cacheKey ? new Request(cacheKey, {\n headers: request.headers\n }) : request;\n };\n}\n\nclass PrecacheInstallReportPlugin {\n updatedURLs = [];\n notUpdatedURLs = [];\n handlerWillStart = async ({ request, state })=>{\n if (state) {\n state.originalRequest = request;\n }\n };\n cachedResponseWillBeUsed = async ({ event, state, cachedResponse })=>{\n if (event.type === \"install\") {\n if (state?.originalRequest && state.originalRequest instanceof Request) {\n const url = state.originalRequest.url;\n if (cachedResponse) {\n this.notUpdatedURLs.push(url);\n } else {\n this.updatedURLs.push(url);\n }\n }\n }\n return cachedResponse;\n };\n}\n\nconst REVISION_SEARCH_PARAM = \"__WB_REVISION__\";\nconst createCacheKey = (entry)=>{\n if (!entry) {\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"add-to-cache-list-unexpected-type\", {\n entry\n });\n }\n if (typeof entry === \"string\") {\n const urlObject = new URL(entry, location.href);\n return {\n cacheKey: urlObject.href,\n url: urlObject.href\n };\n }\n const { revision, url } = entry;\n if (!url) {\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"add-to-cache-list-unexpected-type\", {\n entry\n });\n }\n if (!revision) {\n const urlObject = new URL(url, location.href);\n return {\n cacheKey: urlObject.href,\n url: urlObject.href\n };\n }\n const cacheKeyURL = new URL(url, location.href);\n const originalURL = new URL(url, location.href);\n cacheKeyURL.searchParams.set(REVISION_SEARCH_PARAM, revision);\n return {\n cacheKey: cacheKeyURL.href,\n url: originalURL.href\n };\n};\n\nconst logGroup = (groupTitle, deletedURLs)=>{\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(groupTitle);\n for (const url of deletedURLs){\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(url);\n }\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupEnd();\n};\nconst printCleanupDetails = (deletedURLs)=>{\n const deletionCount = deletedURLs.length;\n if (deletionCount > 0) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(`During precaching cleanup, ${deletionCount} cached request${deletionCount === 1 ? \" was\" : \"s were\"} deleted.`);\n logGroup(\"Deleted Cache Requests\", deletedURLs);\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupEnd();\n }\n};\n\nfunction _nestedGroup(groupTitle, urls) {\n if (urls.length === 0) {\n return;\n }\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(groupTitle);\n for (const url of urls){\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(url);\n }\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupEnd();\n}\nconst printInstallDetails = (urlsToPrecache, urlsAlreadyPrecached)=>{\n const precachedCount = urlsToPrecache.length;\n const alreadyPrecachedCount = urlsAlreadyPrecached.length;\n if (precachedCount || alreadyPrecachedCount) {\n let message = `Precaching ${precachedCount} file${precachedCount === 1 ? \"\" : \"s\"}.`;\n if (alreadyPrecachedCount > 0) {\n message += ` ${alreadyPrecachedCount} ` + `file${alreadyPrecachedCount === 1 ? \" is\" : \"s are\"} already cached.`;\n }\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(message);\n _nestedGroup(\"View newly precached URLs.\", urlsToPrecache);\n _nestedGroup(\"View previously precached URLs.\", urlsAlreadyPrecached);\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupEnd();\n }\n};\n\nclass Serwist {\n _urlsToCacheKeys = new Map();\n _urlsToCacheModes = new Map();\n _cacheKeysToIntegrities = new Map();\n _concurrentPrecaching;\n _precacheStrategy;\n _routes;\n _defaultHandlerMap;\n _catchHandler;\n constructor({ precacheEntries, precacheOptions, cleanupOutdatedCaches: cleanupOutdatedCaches$1, navigateFallback, navigateFallbackAllowlist, navigateFallbackDenylist, plugins = [], fallbackToNetwork = true, concurrentPrecaching = 1, skipWaiting = false, importScripts, navigationPreload = false, cacheId, clientsClaim: clientsClaim$1 = false, runtimeCaching, offlineAnalyticsConfig, disableDevLogs: disableDevLogs$1 = false, fallbacks } = {}){\n this._concurrentPrecaching = concurrentPrecaching;\n this._precacheStrategy = new PrecacheStrategy({\n cacheName: _timeout_js__WEBPACK_IMPORTED_MODULE_0__.c.getPrecacheName(precacheOptions?.cacheName),\n plugins: [\n ...plugins,\n new PrecacheCacheKeyPlugin({\n precacheController: this\n })\n ],\n fallbackToNetwork\n });\n this._routes = new Map();\n this._defaultHandlerMap = new Map();\n this.handleInstall = this.handleInstall.bind(this);\n this.handleActivate = this.handleActivate.bind(this);\n this.handleFetch = this.handleFetch.bind(this);\n this.handleCache = this.handleCache.bind(this);\n if (!!importScripts && importScripts.length > 0) self.importScripts(...importScripts);\n if (navigationPreload) enableNavigationPreload();\n if (cacheId !== undefined) {\n setCacheNameDetails({\n prefix: cacheId\n });\n }\n if (skipWaiting) {\n self.skipWaiting();\n } else {\n self.addEventListener(\"message\", (event)=>{\n if (event.data && event.data.type === \"SKIP_WAITING\") {\n self.skipWaiting();\n }\n });\n }\n if (clientsClaim$1) clientsClaim();\n this.registerRoute(new PrecacheRoute(this, precacheOptions));\n if (!!precacheEntries && precacheEntries.length > 0) {\n this.addToPrecacheList(precacheEntries);\n }\n if (cleanupOutdatedCaches$1) {\n cleanupOutdatedCaches(precacheOptions?.cacheName);\n }\n if (navigateFallback) {\n this.registerRoute(new NavigationRoute(this.createHandlerBoundToUrl(navigateFallback), {\n allowlist: navigateFallbackAllowlist,\n denylist: navigateFallbackDenylist\n }));\n }\n if (offlineAnalyticsConfig !== undefined) {\n if (typeof offlineAnalyticsConfig === \"boolean\") {\n offlineAnalyticsConfig && (0,_PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_2__.i)({\n serwist: this\n });\n } else {\n (0,_PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_2__.i)({\n ...offlineAnalyticsConfig,\n serwist: this\n });\n }\n }\n if (runtimeCaching !== undefined) {\n if (fallbacks !== undefined) {\n const fallbackPlugin = new _PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_2__.P({\n fallbackUrls: fallbacks.entries,\n serwist: this\n });\n runtimeCaching.forEach((cacheEntry)=>{\n if (cacheEntry.handler instanceof _NetworkOnly_js__WEBPACK_IMPORTED_MODULE_3__.S && !cacheEntry.handler.plugins.some((plugin)=>\"handlerDidError\" in plugin)) {\n cacheEntry.handler.plugins.push(fallbackPlugin);\n }\n });\n }\n for (const entry of runtimeCaching){\n this.registerCapture(entry.matcher, entry.handler, entry.method);\n }\n }\n if (disableDevLogs$1) disableDevLogs();\n }\n get precacheStrategy() {\n return this._precacheStrategy;\n }\n get routes() {\n return this._routes;\n }\n addEventListeners() {\n self.addEventListener(\"install\", this.handleInstall);\n self.addEventListener(\"activate\", this.handleActivate);\n self.addEventListener(\"fetch\", this.handleFetch);\n self.addEventListener(\"message\", this.handleCache);\n }\n addToPrecacheList(entries) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isArray(entries, {\n moduleName: \"serwist\",\n className: \"Serwist\",\n funcName: \"addToCacheList\",\n paramName: \"entries\"\n });\n }\n const urlsToWarnAbout = [];\n for (const entry of entries){\n if (typeof entry === \"string\") {\n urlsToWarnAbout.push(entry);\n } else if (entry && !entry.integrity && entry.revision === undefined) {\n urlsToWarnAbout.push(entry.url);\n }\n const { cacheKey, url } = createCacheKey(entry);\n const cacheMode = typeof entry !== \"string\" && entry.revision ? \"reload\" : \"default\";\n if (this._urlsToCacheKeys.has(url) && this._urlsToCacheKeys.get(url) !== cacheKey) {\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"add-to-cache-list-conflicting-entries\", {\n firstEntry: this._urlsToCacheKeys.get(url),\n secondEntry: cacheKey\n });\n }\n if (typeof entry !== \"string\" && entry.integrity) {\n if (this._cacheKeysToIntegrities.has(cacheKey) && this._cacheKeysToIntegrities.get(cacheKey) !== entry.integrity) {\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"add-to-cache-list-conflicting-integrities\", {\n url\n });\n }\n this._cacheKeysToIntegrities.set(cacheKey, entry.integrity);\n }\n this._urlsToCacheKeys.set(url, cacheKey);\n this._urlsToCacheModes.set(url, cacheMode);\n if (urlsToWarnAbout.length > 0) {\n const warningMessage = `Serwist is precaching URLs without revision info: ${urlsToWarnAbout.join(\", \")}\\nThis is generally NOT safe. Learn more at https://bit.ly/wb-precache`;\n if (false) {} else {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.warn(warningMessage);\n }\n }\n }\n }\n handleInstall(event) {\n return (0,_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.w)(event, async ()=>{\n const installReportPlugin = new PrecacheInstallReportPlugin();\n this.precacheStrategy.plugins.push(installReportPlugin);\n await parallel(this._concurrentPrecaching, Array.from(this._urlsToCacheKeys.entries()), async ([url, cacheKey])=>{\n const integrity = this._cacheKeysToIntegrities.get(cacheKey);\n const cacheMode = this._urlsToCacheModes.get(url);\n const request = new Request(url, {\n integrity,\n cache: cacheMode,\n credentials: \"same-origin\"\n });\n await Promise.all(this.precacheStrategy.handleAll({\n event,\n request,\n url: new URL(request.url),\n params: {\n cacheKey\n }\n }));\n });\n const { updatedURLs, notUpdatedURLs } = installReportPlugin;\n if (true) {\n printInstallDetails(updatedURLs, notUpdatedURLs);\n }\n return {\n updatedURLs,\n notUpdatedURLs\n };\n });\n }\n handleActivate(event) {\n return (0,_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.w)(event, async ()=>{\n const cache = await self.caches.open(this.precacheStrategy.cacheName);\n const currentlyCachedRequests = await cache.keys();\n const expectedCacheKeys = new Set(this._urlsToCacheKeys.values());\n const deletedCacheRequests = [];\n for (const request of currentlyCachedRequests){\n if (!expectedCacheKeys.has(request.url)) {\n await cache.delete(request);\n deletedCacheRequests.push(request.url);\n }\n }\n if (true) {\n printCleanupDetails(deletedCacheRequests);\n }\n return {\n deletedCacheRequests\n };\n });\n }\n handleFetch(event) {\n const { request } = event;\n const responsePromise = this.handleRequest({\n request,\n event\n });\n if (responsePromise) {\n event.respondWith(responsePromise);\n }\n }\n handleCache(event) {\n if (event.data && event.data.type === \"CACHE_URLS\") {\n const { payload } = event.data;\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.debug(\"Caching URLs from the window\", payload.urlsToCache);\n }\n const requestPromises = Promise.all(payload.urlsToCache.map((entry)=>{\n let request;\n if (typeof entry === \"string\") {\n request = new Request(entry);\n } else {\n request = new Request(...entry);\n }\n return this.handleRequest({\n request,\n event\n });\n }));\n event.waitUntil(requestPromises);\n if (event.ports?.[0]) {\n void requestPromises.then(()=>event.ports[0].postMessage(true));\n }\n }\n }\n setDefaultHandler(handler, method = _PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_2__.d) {\n this._defaultHandlerMap.set(method, (0,_PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_2__.n)(handler));\n }\n setCatchHandler(handler) {\n this._catchHandler = (0,_PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_2__.n)(handler);\n }\n registerCapture(capture, handler, method) {\n const route = parseRoute(capture, handler, method);\n this.registerRoute(route);\n return route;\n }\n registerRoute(route) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(route, \"object\", {\n moduleName: \"serwist\",\n className: \"Serwist\",\n funcName: \"registerRoute\",\n paramName: \"route\"\n });\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.hasMethod(route, \"match\", {\n moduleName: \"serwist\",\n className: \"Serwist\",\n funcName: \"registerRoute\",\n paramName: \"route\"\n });\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(route.handler, \"object\", {\n moduleName: \"serwist\",\n className: \"Serwist\",\n funcName: \"registerRoute\",\n paramName: \"route\"\n });\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.hasMethod(route.handler, \"handle\", {\n moduleName: \"serwist\",\n className: \"Serwist\",\n funcName: \"registerRoute\",\n paramName: \"route.handler\"\n });\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(route.method, \"string\", {\n moduleName: \"serwist\",\n className: \"Serwist\",\n funcName: \"registerRoute\",\n paramName: \"route.method\"\n });\n }\n if (!this._routes.has(route.method)) {\n this._routes.set(route.method, []);\n }\n this._routes.get(route.method).push(route);\n }\n unregisterRoute(route) {\n if (!this._routes.has(route.method)) {\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"unregister-route-but-not-found-with-method\", {\n method: route.method\n });\n }\n const routeIndex = this._routes.get(route.method).indexOf(route);\n if (routeIndex > -1) {\n this._routes.get(route.method).splice(routeIndex, 1);\n } else {\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"unregister-route-route-not-registered\");\n }\n }\n getUrlsToPrecacheKeys() {\n return this._urlsToCacheKeys;\n }\n getPrecachedUrls() {\n return [\n ...this._urlsToCacheKeys.keys()\n ];\n }\n getPrecacheKeyForUrl(url) {\n const urlObject = new URL(url, location.href);\n return this._urlsToCacheKeys.get(urlObject.href);\n }\n getIntegrityForPrecacheKey(cacheKey) {\n return this._cacheKeysToIntegrities.get(cacheKey);\n }\n async matchPrecache(request) {\n const url = request instanceof Request ? request.url : request;\n const cacheKey = this.getPrecacheKeyForUrl(url);\n if (cacheKey) {\n const cache = await self.caches.open(this.precacheStrategy.cacheName);\n return cache.match(cacheKey);\n }\n return undefined;\n }\n createHandlerBoundToUrl(url) {\n const cacheKey = this.getPrecacheKeyForUrl(url);\n if (!cacheKey) {\n throw new _timeout_js__WEBPACK_IMPORTED_MODULE_0__.S(\"non-precached-url\", {\n url\n });\n }\n return (options)=>{\n options.request = new Request(url);\n options.params = {\n cacheKey,\n ...options.params\n };\n return this.precacheStrategy.handle(options);\n };\n }\n handleRequest({ request, event }) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isInstance(request, Request, {\n moduleName: \"serwist\",\n className: \"Serwist\",\n funcName: \"handleRequest\",\n paramName: \"options.request\"\n });\n }\n const url = new URL(request.url, location.href);\n if (!url.protocol.startsWith(\"http\")) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.debug(\"Router only supports URLs that start with 'http'.\");\n }\n return;\n }\n const sameOrigin = url.origin === location.origin;\n const { params, route } = this.findMatchingRoute({\n event,\n request,\n sameOrigin,\n url\n });\n let handler = route?.handler;\n const debugMessages = [];\n if (true) {\n if (handler) {\n debugMessages.push([\n \"Found a route to handle this request:\",\n route\n ]);\n if (params) {\n debugMessages.push([\n `Passing the following params to the route's handler:`,\n params\n ]);\n }\n }\n }\n const method = request.method;\n if (!handler && this._defaultHandlerMap.has(method)) {\n if (true) {\n debugMessages.push(`Failed to find a matching route. Falling back to the default handler for ${method}.`);\n }\n handler = this._defaultHandlerMap.get(method);\n }\n if (!handler) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.debug(`No route found for: ${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(url)}`);\n }\n return;\n }\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(`Router is responding to: ${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(url)}`);\n for (const msg of debugMessages){\n if (Array.isArray(msg)) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(...msg);\n } else {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(msg);\n }\n }\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupEnd();\n }\n let responsePromise;\n try {\n responsePromise = handler.handle({\n url,\n request,\n event,\n params\n });\n } catch (err) {\n responsePromise = Promise.reject(err);\n }\n const catchHandler = route?.catchHandler;\n if (responsePromise instanceof Promise && (this._catchHandler || catchHandler)) {\n responsePromise = responsePromise.catch(async (err)=>{\n if (catchHandler) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(`Error thrown when responding to: ${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(url)}. Falling back to route's Catch Handler.`);\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.error(\"Error thrown by:\", route);\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.error(err);\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupEnd();\n }\n try {\n return await catchHandler.handle({\n url,\n request,\n event,\n params\n });\n } catch (catchErr) {\n if (catchErr instanceof Error) {\n err = catchErr;\n }\n }\n }\n if (this._catchHandler) {\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(`Error thrown when responding to: ${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(url)}. Falling back to global Catch Handler.`);\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.error(\"Error thrown by:\", route);\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.error(err);\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.groupEnd();\n }\n return this._catchHandler.handle({\n url,\n request,\n event\n });\n }\n throw err;\n });\n }\n return responsePromise;\n }\n findMatchingRoute({ url, sameOrigin, request, event }) {\n const routes = this._routes.get(request.method) || [];\n for (const route of routes){\n let params;\n const matchResult = route.match({\n url,\n sameOrigin,\n request,\n event\n });\n if (matchResult) {\n if (true) {\n if (matchResult instanceof Promise) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.warn(`While routing ${(0,_timeout_js__WEBPACK_IMPORTED_MODULE_0__.g)(url)}, an async matchCallback function was used. Please convert the following route to use a synchronous matchCallback function:`, route);\n }\n }\n params = matchResult;\n if (Array.isArray(params) && params.length === 0) {\n params = undefined;\n } else if (matchResult.constructor === Object && Object.keys(matchResult).length === 0) {\n params = undefined;\n } else if (typeof matchResult === \"boolean\") {\n params = undefined;\n }\n return {\n route,\n params\n };\n }\n }\n return {};\n }\n}\n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vc2Vyd2lzdEA5LjAuMC1wcmV2aWV3LjI0X3R5cGVzY3JpcHRANS40LjUvbm9k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5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmlzQXJyYXlPZkNsYXNzKGFsbG93bGlzdCwgUmVnRXhwLCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJzZXJ3aXN0XCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIk5hdmlnYXRpb25Sb3V0ZVwiLFxuICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcImNvbnN0cnVjdG9yXCIsXG4gICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcIm9wdGlvbnMuYWxsb3dsaXN0XCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmlzQXJyYXlPZkNsYXNzKGRlbnlsaXN0LCBSZWdFeHAsIHtcbiAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiBcInNlcndpc3RcIixcbiAgICAgICAgICAgICAgICBjbGFzc05hbWU6IFwiTmF2aWdhdGlvblJvdXRlXCIsXG4gICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiY29uc3RydWN0b3JcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwib3B0aW9ucy5kZW55bGlzdFwiXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICBzdXBlcigob3B0aW9ucyk9PnRoaXMuX21hdGNoKG9wdGlvbnMpLCBoYW5kbGVyKTtcbiAgICAgICAgdGhpcy5fYWxsb3dsaXN0ID0gYWxsb3dsaXN0O1xuICAgICAgICB0aGlzLl9kZW55bGlzdCA9IGRlbnlsaXN0O1xuICAgIH1cbiAgICBfbWF0Y2goeyB1cmwsIHJlcXVlc3QgfSkge1xuICAgICAgICBpZiAocmVxdWVzdCAmJiByZXF1ZXN0Lm1vZGUgIT09IFwibmF2aWdhdGVcIikge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgICA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dhdGlvbiByb3V0ZSAke3BhdGhuYW1lQW5kU2VhcmNofSBpcyBub3QgYmVpbmcgdXNlZCwgc2luY2UgdGhlIFVSTCBiZWluZyBuYXZpZ2F0ZWQgdG8gZG9lc24ndCBtYXRjaCB0aGUgYWxsb3dsaXN0LmApO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9XG59XG5cbmNsYXNzIFJlZ0V4cFJvdXRlIGV4dGVuZHMgUm91dGUge1xuICAgIGNvbnN0cnVjdG9yKHJlZ0V4cCwgaGFuZGxlciwgbWV0aG9kKXtcbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmlzSW5zdGFuY2UocmVnRXhwLCBSZWdFeHAsIHtcbiAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiBcInNlcndpc3RcIixcbiAgICAgICAgICAgICAgICBjbGFzc05hbWU6IFwiUmVnRXhwUm91dGVcIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJjb25zdHJ1Y3RvclwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJwYXR0ZXJuXCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IG1hdGNoID0gKHsgdXJsIH0pPT57XG4gICAgICAgICAgICBjb25zdCByZXN1bHQgPSByZWdFeHAuZXhlYyh1cmwuaHJlZik7XG4gICAgICAgICAgICBpZiAoIXJlc3VsdCkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh1cmwub3JpZ2luICE9PSBsb2NhdGlvbi5vcmlnaW4gJiYgcmVzdWx0LmluZGV4ICE9PSAwKSB7XG4gICAgICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIik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CBvcHRpb25zKSl7XG4gICAgICAgICAgICAgICAgY29uc3QgY2FjaGVLZXkgPSB1cmxzVG9DYWNoZUtleXMuZ2V0KHBvc3NpYmxlVVJMKTtcbiAgICAgICAgICAgICAgICBpZiAoY2FjaGVLZXkpIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgaW50ZWdyaXR5ID0gc2Vyd2lzdC5nZXRJbnRlZ3JpdHlGb3JQcmVjYWNoZUtleShjYWNoZUtleSk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjYWNoZUtleSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGludGVncml0eVxuICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICBsb2dnZXIuZGVidWcoYFByZWNhY2hpbmcgZGlkIG5vdCBmaW5kIGEgbWF0Y2ggZm9yICR7Z2V0RnJpZW5kbHlVUkwocmVxdWVzdC51cmwpfS5gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfTtcbiAgICAgICAgc3VwZXIobWF0Y2gsIHNlcndpc3QucHJlY2FjaGVTdHJhdGVneSk7XG4gICAgfVxufVxuXG5jbGFzcyBQcmVjYWNoZVN0cmF0ZWd5IGV4dGVuZHMgU3RyYXRlZ3kge1xuICAgIF9mYWxsYmFja1RvTmV0d29yaztcbiAgICBzdGF0aWMgZGVmYXVsdFByZWNhY2hlQ2FjaGVhYmlsaXR5UGx1Z2luID0ge1xuICAgICAgICBhc3luYyBjYWNoZVdpbGxVcGRhdGUgKHsgcmVzcG9uc2UgfSkge1xuICAgICAgICAgICAgaWYgKCFyZXNwb25zZSB8fCByZXNwb25zZS5zdGF0dXMgPj0gNDAwKSB7XG4g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oID0gdGhpcy5oYW5kbGVGZXRjaC5iaW5kKHRoaXMpO1xuICAgICAgICB0aGlzLmhhbmRsZUNhY2hlID0gdGhpcy5oYW5kbGVDYWNoZS5iaW5kKHRoaXMpO1xuICAgICAgICBpZiAoISFpbXBvcnRTY3JpcHRzICYmIGltcG9ydFNjcmlwdHMubGVuZ3RoID4gMCkgc2VsZi5pbXBvcnRTY3JpcHRzKC4uLmltcG9ydFNjcmlwdHMpO1xuICAgICAgICBpZiAobmF2aWdhdGlvblByZWxvYWQpIGVuYWJsZU5hdmlnYXRpb25QcmVsb2FkKCk7XG4gICAgICAgIGlmIChjYWNoZUlkICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIHNldENhY2hlTmFtZURldGFpbHMoe1xuICAgICAgICAgICAgICAgIHByZWZpeDogY2FjaGVJZFxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHNraXBXYWl0aW5nKSB7XG4gICAgICAgICAgICBzZWxmLnNraXBXYWl0aW5nKCk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBzZWxmLmFkZEV2ZW50TGlzdGVuZXIoXCJtZXNzYWdlXCIsIChldmVudCk9PntcbiAgICAgICAgICAgICAgICBpZiAoZXZlbnQuZGF0YSAmJiBldmVudC5kYXRhLnR5cGUgPT09IFwiU0tJUF9XQUlUSU5HXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5za2lwV2FpdGluZygpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChjbGllbnRzQ2xhaW0kMSkgY2xpZW50c0NsYWltKCk7XG4gICAgICAgIHRoaXMucmVnaXN0ZXJSb3V0ZShuZXcgUHJlY2FjaGVSb3V0ZSh0aGlzLCBwcmVjYWNoZU9wdGlvbnMpKTtcbiAgICAgICAgaWYgKCEhcHJlY2FjaGVFbnRyaWVzICYmIHByZWNhY2hlRW50cmllcy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AgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmIChydW50aW1lQ2FjaGluZyAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICBpZiAoZmFsbGJhY2tzICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICBjb25zdCBmYWxsYmFja1BsdWdpbiA9IG5ldyBQcmVjYWNoZUZhbGxiYWNrUGx1Z2luKHtcbiAgICAgICAgICAgICAgICAgICAgZmFsbGJhY2tVcmxzOiBmYWxsYmFja3MuZW50cmllcyxcbiAgICAgICAgICAgICAgICAgICAgc2Vyd2lzdDogdGhpc1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIHJ1bnRpbWVDYWNoaW5nLmZvckVhY2goKGNhY2hlRW50cnkpPT57XG4gICAgICAgICAgICAgICAgICAgIGlmIChjYWNoZUVudHJ5LmhhbmRsZXIgaW5zdGFuY2VvZiBTdHJhdGVneSAmJiAhY2FjaGVFbnRyeS5oYW5kbGVyLnBsdWdpbnMuc29tZSgocGx1Z2luKT0+XCJoYW5kbGVyRGlkRXJyb3JcIiBpbiBwbHVnaW4pKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjYWNoZUVudHJ5LmhhbmRsZXIucGx1Z2lucy5wdXNoKGZhbGxiYWNrUGx1Z2luKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZm9yIChjb25zdCBlbnRyeSBvZiBydW50aW1lQ2FjaGluZyl7XG4gICAgICAgICAgICAgICAgdGhpcy5yZWdpc3RlckNhcHR1cmUoZW50cnkubWF0Y2hlciwgZW50cnkuaGFuZGxlciwgZW50cnkubWV0aG9kKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoZGlzYWJsZURldkxvZ3MkMSkgZGlzYWJsZURldkxvZ3MoKTtcbiAgICB9XG4gICAgZ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vSW50ZWdyaXRpZXMuaGFzKGNhY2hlS2V5KSAmJiB0aGlzLl9jYWNoZUtleXNUb0ludGVncml0aWVzLmdldChjYWNoZUtleSkgIT09IGVudHJ5LmludGVncml0eSkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwiYWRkLXRvLWNhY2hlLWxpc3QtY29uZmxpY3RpbmctaW50ZWdyaXRpZXNcIiwge1xuICAgICAgICAgICAgICAgICAgICAgICAgdXJsXG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB0aGlzLl9jYWNoZUtleXNUb0ludGVncml0aWVzLnNldChjYWNoZUtleSwgZW50cnkuaW50ZWdyaXR5KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRoaXMuX3VybHNUb0NhY2hlS2V5cy5zZXQodXJsLCBjYWNoZUtleSk7XG4gICAgICAgICAgICB0aGlzLl91cmxzVG9DYWNoZU1vZGVzLnNldCh1cmwsIGNhY2hlTW9kZSk7XG4gICAgICAgICAgICBpZiAodXJsc1RvV2FybkFib3V0Lmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICBjb25zdCB3YXJuaW5nTWVzc2FnZSA9IGBTZXJ3aXN0IGlzIHByZWNhY2hpbmcgVVJMcyB3aXRob3V0IHJldmlzaW9uIGluZm86ICR7dXJsc1RvV2FybkFib3V0LmpvaW4oXCIsIFwiKX1cXG5UaGlzIGlzIGdlbmVyYWxseSBOT1Qgc2FmZS4gTGVhcm4gbW9yZSBhdCBodHRwczovL2JpdC5seS93Yi1wcmVjYWNoZWA7XG4gICAgICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WID09PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICBjb25zb2xlLndhcm4od2FybmluZ01lc3NhZ2UpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ2dlci53YXJuKHdhcm5pbmdNZXNzYWdlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG4gICAgaGFuZGxlSW5zdGFsbChldmVudCkge1xuICAgICAgICByZXR1cm4gd2FpdFVudGlsKGV2ZW50LCBhc3luYyAoKT0+e1xuICAgICAgICAgICAgY29uc3QgaW5zdGFsbFJlcG9ydFBsdWdpbiA9IG5ldyBQcmVjYWNoZUluc3RhbGxSZXBvcnRQbHVnaW4oKTtcbiAgICAgICAgICAgIHRoaXMucHJlY2FjaGVTdHJhdGVneS5wbHVnaW5zLnB1c2goaW5zdGFsbFJlcG9ydFBsdWdpbik7XG4gICAgICAgICAgICBhd2FpdCBwYXJhbGxlbCh0aGlzLl9jb25jdXJyZW50UHJlY2FjaGluZywgQXJyYXkuZnJvbSh0aGlzLl91cmxzVG9DYWNoZUtleXMuZW50cmllcygpKSwgYXN5bmMgKFt1cmwsIGNhY2hlS2V5XSk9PntcbiAgICAgICAgICAgICAgICBjb25zdCBpbnRlZ3JpdHkgPSB0aGlzLl9jYWNoZUtleXNUb0ludGVncml0aWVzLmdldChjYWNoZUtleSk7XG4gICAgICAgICAgICAgICAgY29uc3QgY2FjaGVNb2RlID0gdGhpcy5fdXJsc1RvQ2FjaGVNb2Rlcy5nZXQodXJsKTtcbiAgICAgICAgICAgICAgICBjb25zdCByZXF1ZXN0ID0gbmV3IFJlcXVlc3QodXJsLCB7XG4gICAgICAgICAgICAgICAgICAgIGludGVncml0eSxcbiAgICAgICAgICAgICAgICAgICAgY2FjaGU6IGNhY2hlTW9kZSxcbiAgICAgICAgICAgICAgICAgICAgY3JlZGVudGlhbHM6IFwic2FtZS1vcmlnaW5cIlxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIGF3YWl0IFByb21pc2UuYWxsKHRoaXMucHJlY2FjaGVTdHJhdGVneS5oYW5kbGVBbGwoe1xuICAgICAgICAgICAgICAgICAgICBldmVudCxcbiAgICAgICAgICAgICAgICAgICAgcmVxdWVzdCxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBuZXcgVVJMKHJlcXVlc3QudXJsKSxcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjYWNoZUtleVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBjb25zdCB7IHVwZGF0ZWRVUkxzLCBub3RVcGRhdGVkVVJMcyB9ID0gaW5zdGFsbFJlcG9ydFBsdWdpbjtcbiAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICBwcmludEluc3RhbGxEZXRhaWxzKHVwZGF0ZWRVUkxzLCBub3RVcGRhdGVkVVJMcyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIHVwZGF0ZWRVUkxzLFxuICAgICAgICAgICAgICAgIG5vdFVwZGF0ZWRVUkxzXG4gICAgICAgICAgICB9O1xuICAgICAgICB9KTtcbiAgICB9XG4gICAgaGFuZGxlQWN0aXZhdGUoZXZlbnQpIHtcbiAgICAgICAgcmV0dXJuIHdhaXRVbnRpbChldmVudCwgYXN5bmMgKCk9PntcbiAgICAgICAgICAgIGNvbnN0IGNhY2hlID0gYXdhaXQgc2VsZi5jYWNoZXMub3Blbih0aGlzLnByZWNhY2hlU3RyYXRlZ3kuY2FjaGVOYW1lKTtcbiAgICAgICAgICAgIGNvbnN0IGN1cnJlbnRseUNhY2hlZFJlcXVlc3RzID0gYXdhaXQgY2FjaGUua2V5cygpO1xuICAgICAgICAgICAgY29uc3QgZXhwZWN0ZWRDYWNoZUtleXMgPSBuZXcgU2V0KHRoaXMuX3VybHNUb0NhY2hlS2V5cy52YWx1ZXMoKSk7XG4gICAgICAgICAgICBjb25zdCBkZWxldGVkQ2FjaGVSZXF1ZXN0cyA9IFtdO1xuICAgICAgICAgICAgZm9yIChjb25zdCByZXF1ZXN0IG9mIGN1cnJlbnRseUNhY2hlZFJlcXVlc3RzKXtcbiAgICAgICAgICAgICAgICBpZiAoIWV4cGVjdGVkQ2FjaGVLZXlzLmhhcyhyZXF1ZXN0LnVybCkpIHtcbiAgICAgICAgICAgICAgICAgICAgYXdhaXQgY2FjaGUuZGVsZXRlKHJlcXVlc3QpO1xuICAgICAgICAgICAgICAgICAgICBkZWxldGVkQ2FjaGVSZXF1ZXN0cy5wdXNoKHJlcXVlc3QudXJsKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgcHJpbnRDbGVhbnVwRGV0YWlscyhkZWxldGVkQ2FjaGVSZXF1ZXN0cyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIGRlbGV0ZWRDYWNoZVJlcXVlc3RzXG4gICAgICAgICAgICB9O1xuICAgICAgICB9KTtcbiAgICB9XG4gICAgaGFuZGxlRmV0Y2goZXZlbnQpIHtcbiAgICAgICAgY29uc3QgeyByZXF1ZXN0IH0gPSBldmVudDtcbiAgICAgICAgY29uc3QgcmVzcG9uc2VQcm9taXNlID0gdGhpcy5oYW5kbGVSZXF1ZXN0KHtcbiAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICBldmVudFxuICAgICAgICB9KTtcbiAgICAgICAgaWYgKHJlc3BvbnNlUHJvbWlzZSkge1xuICAgICAgICAgICAgZXZlbnQucmVzcG9uZFdpdGgocmVzcG9uc2VQcm9taXNlKTtcbiAgICAgICAgfVxuICAgIH1cbiAgICBoYW5kbGVDYWNoZShldmVudCkge1xuICAgICAgICBpZiAoZXZlbnQuZGF0YSAmJiBldmVudC5kYXRhLnR5cGUgPT09IFwiQ0FDSEVfVVJMU1wiKSB7XG4gICAgICAgICAgICBjb25zdCB7IHBheWxvYWQgfSA9IGV2ZW50LmRhdGE7XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgbG9nZ2VyLmRlYnVnKFwiQ2FjaGluZyBVUkxzIGZyb20gdGhlIHdpbmRvd1wiLCBwYXlsb2FkLnVybHNUb0NhY2hlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvbnN0IHJlcXVlc3RQcm9taXNlcyA9IFByb21pc2UuYWxsKHBheWxvYWQudXJsc1RvQ2FjaGUubWFwKChlbnRyeSk9PntcbiAgICAgICAgICAgICAgICBsZXQgcmVxdWVzdDtcbiAgICAgICAgICAgICAgICBpZiAodHlwZW9mIGVudHJ5ID09PSBcInN0cmluZ1wiKSB7XG4gICAgICAgICAgICAgICAgICAgIHJlcXVlc3QgPSBuZXcgUmVxdWVzdChlbnRyeSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmVxdWVzdCA9IG5ldyBSZXF1ZXN0KC4uLmVudHJ5KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaGFuZGxlUmVxdWVzdCh7XG4gICAgICAgICAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICAgICAgICAgIGV2ZW50XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9KSk7XG4gICAgICAgICAgICBldmVudC53YWl0VW50aWwocmVxdWVzdFByb21pc2VzKTtcbiAgICAgICAgICAgIGlmIChldmVudC5wb3J0cz8uWzBdKSB7XG4gICAgICAgICAgICAgICAgdm9pZCByZXF1ZXN0UHJvbWlzZXMudGhlbigoKT0+ZXZlbnQucG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cnRzLmhhc01ldGhvZChyb3V0ZSwgXCJtYXRjaFwiLCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJzZXJ3aXN0XCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIlNlcndpc3RcIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJyZWdpc3RlclJvdXRlXCIsXG4gICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcInJvdXRlXCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmlzVHlwZShyb3V0ZS5oYW5kbGVyLCBcIm9iamVjdFwiLCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJzZXJ3aXN0XCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIlNlcndpc3RcIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJyZWdpc3RlclJvdXRlXCIsXG4gICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcInJvdXRlXCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmhhc01ldGhvZChyb3V0ZS5oYW5kbGVyLCBcImhhbmRsZVwiLCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJzZXJ3aXN0XCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIlNlcndpc3RcIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJyZWdpc3RlclJvdXRlXCIsXG4gICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcInJvdXRlLmhhbmRsZXJcIlxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBmaW5hbEFzc2VydEV4cG9ydHMuaXNUeXBlKHJvdXRlLm1ldGhvZCwgXCJzdHJpbmdcIiwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwic2Vyd2lzdFwiLFxuICAgICAgICAgIC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b1VybCh1cmwpIHtcbiAgICAgICAgY29uc3QgY2FjaGVLZXkgPSB0aGlzLmdldFByZWNhY2hlS2V5Rm9yVXJsKHVybCk7XG4gICAgICAgIGlmICghY2FjaGVLZXkpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBTZXJ3aXN0RXJyb3IoXCJub24tcHJlY2FjaGVkLXVybFwiLCB7XG4gICAgICAgICAgICAgICAgdXJsXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gKG9wdGlvbnMpPT57XG4gICAgICAgICAgICBvcHRpb25zLnJlcXVlc3QgPSBuZXcgUmVxdWVzdCh1cmwpO1xuICAgICAgICAgICAgb3B0aW9ucy5wYXJhbXMgPSB7XG4gICAgICAgICAgICAgICAgY2FjaGVLZXksXG4gICAgICAgICAgICAgICAgLi4ub3B0aW9ucy5wYXJhbXNcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5wcmVjYWNoZVN0cmF0ZWd5LmhhbmRsZShvcHRpb25zKTtcbiAgICAgICAgfTtcbiAgICB9XG4gICAgaGFuZGxlUmVxdWVzdCh7IHJlcXVlc3QsIGV2ZW50IH0pIHtcbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmlzSW5zdGFuY2UocmVxdWVzdCwgUmVxdWVzdCwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwic2Vyd2lzdFwiLFxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJTZXJ3aXN0XCIsXG4gICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiaGFuZGxlUmVxdWVzdFwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJvcHRpb25zLnJlcXVlc3RcIlxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgdXJsID0gbmV3IFVSTChyZXF1ZXN0LnVybCwgbG9jYXRpb24uaHJlZik7XG4gICAgICAgIGlmICghdXJsLnByb3RvY29sLnN0YXJ0c1dpdGgoXCJodHRwXCIpKSB7XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgbG9nZ2VyLmRlYnVnKFwiUm91dGVyIG9ubHkgc3VwcG9ydHMgVVJMcyB0aGF0IHN0YXJ0IHdpdGggJ2h0dHAnLlwiKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCBzYW1lT3JpZ2luID0gdXJsLm9yaWdpbiA9PT0gbG9jYXRpb24ub3JpZ2luO1xuICAgICAgICBjb25zdCB7IHBhcmFtcywgcm91dGUgfSA9IHRoaXMuZmluZE1hdGNoaW5nUm91dGUoe1xuICAgICAgICAgICAgZXZlbnQsXG4gICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgc2FtZU9yaWdpbixcbiAgICAgICAgICAgIHVybFxuICAgICAgICB9KTtcbiAgICAgICAgbGV0IGhhbmRsZXIgPSByb3V0ZT8uaGFuZGxlcjtcbiAgICAgICAgY29uc3QgZGVidWdNZXNzYWdlcyA9IFtdO1xuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBpZiAoaGFuZGxlcikge1xuICAgICAgICAgICAgICAgIGRlYnVnTWVzc2FnZXMucHVzaChbXG4gICAgICAgICAgICAgICAgICAgIFwiRm91bmQgYSByb3V0ZSB0byBoYW5kbGUgdGhpcyByZXF1ZXN0OlwiLFxuICAgICAgICAgICAgICAgICAgICByb3V0ZVxuICAgICAgICAgICAgICAgIF0pO1xuICAgICAgICAgICAgICAgIGlmIChwYXJhbXMpIHtcbiAgICAgICAgICAgICAgICAgICAgZGVidWdNZXNzYWdlcy5wdXNoKFtcbiAgICAgICAgICAgICAgICAgICAgICAgIGBQYXNzaW5nIHRoZSBmb2xsb3dpbmcgcGFyYW1zIHRvIHRoZSByb3V0ZSdzIGhhbmRsZXI6YCxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtc1xuICAgICAgICAgICAgICAgICAgICBdKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgbWV0aG9kID0gcmVxdWVzdC5tZXRob2Q7XG4gICAgICAgIGlmICghaGFuZGxlciAmJiB0aGlzLl9kZWZhdWx0SGFuZGxlck1hcC5oYXMobWV0aG9kKSkge1xuICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgIGRlYnVnTWVzc2FnZXMucHVzaChgRmFpbGVkIHRvIGZpbmQgYSBtYXRjaGluZyByb3V0ZS4gRmFsbGluZyBiYWNrIHRvIHRoZSBkZWZhdWx0IGhhbmRsZXIgZm9yICR7bWV0aG9kfS5gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGhhbmRsZXIgPSB0aGlzLl9kZWZhdWx0SGFuZGxlck1hcC5nZXQobWV0aG9kKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIWhhbmRsZXIpIHtcbiAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICBsb2dnZXIuZGVidWcoYE5vIHJvdXRlIGZvdW5kIGZvcjogJHtnZXRGcmllbmRseVVSTCh1cmwpfWApO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgIGxvZ2dlci5ncm91cENvbGxhcHNlZChgUm91dGVyIGlzIHJlc3BvbmRpbmcgdG86ICR7Z2V0RnJpZW5kbHlVUkwodXJsKX1gKTtcbiAgICAgICAgICAgIGZvciAoY29uc3QgbXNnIG9mIGRlYnVnTWVzc2FnZXMpe1xuICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KG1zZykpIHtcbiAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmxvZyguLi5tc2cpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ2dlci5sb2cobXNnKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBFbmQoKTtcbiAgICAgICAgfVxuICAgICAgICBsZXQgcmVzcG9uc2VQcm9taXNlO1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgcmVzcG9uc2VQcm9taXNlID0gaGFuZGxlci5oYW5kbGUoe1xuICAgICAgICAgICAgICAgIHVybCxcbiAgICAgICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgICAgIGV2ZW50LFxuICAgICAgICAgICAgICAgIHBhcmFtc1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgcmVzcG9uc2VQcm9taXNlID0gUHJvbWlzZS5yZWplY3QoZXJyKTtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCBjYXRjaEhhbmRsZXIgPSByb3V0ZT8uY2F0Y2hIYW5kbGVyO1xuICAgICAgICBpZiAocmVzcG9uc2VQcm9taXNlIGluc3RhbmNlb2YgUHJvbWlzZSAmJiAodGhpcy5fY2F0Y2hIYW5kbGVyIHx8IGNhdGNoSGFuZGxlcikpIHtcbiAgICAgICAgICAgIHJlc3BvbnNlUHJvbWlzZSA9IHJlc3BvbnNlUHJvbWlzZS5jYXRjaChhc3luYyAoZXJyKT0+e1xuICAgICAgICAgICAgICAgIGlmIChjYXRjaEhhbmRsZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmdyb3VwQ29sbGFwc2VkKGBFcnJvciB0aHJvd24gd2hlbiByZXNwb25kaW5nIHRvOiAgJHtnZXRGcmllbmRseVVSTCh1cmwpfS4gRmFsbGluZyBiYWNrIHRvIHJvdXRlJ3MgQ2F0Y2ggSGFuZGxlci5gKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZ2dlci5lcnJvcihcIkVycm9yIHRocm93biBieTpcIiwgcm91dGUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmVycm9yKGVycik7XG4gICAgICAgICAgICAgICAgICAgICAgICBsb2dnZXIuZ3JvdXBFbmQoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGF3YWl0IGNhdGNoSGFuZGxlci5oYW5kbGUoe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtc1xuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGNhdGNoRXJyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2F0Y2hFcnIgaW5zdGFuY2VvZiBFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IGNhdGNoRXJyO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmICh0aGlzLl9jYXRjaEhhbmRsZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmdyb3VwQ29sbGFwc2VkKGBFcnJvciB0aHJvd24gd2hlbiByZXNwb25kaW5nIHRvOiAgJHtnZXRGcmllbmRseVVSTCh1cmwpfS4gRmFsbGluZyBiYWNrIHRvIGdsb2JhbCBDYXRjaCBIYW5kbGVyLmApO1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmVycm9yKFwiRXJyb3IgdGhyb3duIGJ5OlwiLCByb3V0ZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBsb2dnZXIuZXJyb3IoZXJyKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZ2dlci5ncm91cEVuZCgpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9jYXRjaEhhbmRsZXIuaGFuZGxlKHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybCxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICAgICAgICAgICAgICBldmVudFxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdGhyb3cgZXJyO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlc3BvbnNlUHJvbWlzZTtcbiAgICB9XG4gICAgZmluZE1hdGNoaW5nUm91dGUoeyB1cmwsIHNhbWVPcmlnaW4sIHJlcXVlc3QsIGV2ZW50IH0pIHtcbiAgICAgICAgY29uc3Qgcm91dGVzID0gdGhpcy5fcm91dGVzLmdldChyZXF1ZXN0Lm1ldGhvZCkgfHwgW107XG4gICAgICAgIGZvciAoY29uc3Qgcm91dGUgb2Ygcm91dGVzKXtcbiAgICAgICAgICAgIGxldCBwYXJhbXM7XG4gICAgICAgICAgICBjb25zdCBtYXRjaFJlc3VsdCA9IHJvdXRlLm1hdGNoKHtcbiAgICAgICAgICAgICAgICB1cmwsXG4gICAgICAgICAgICAgICAgc2FtZU9yaWdpbixcbiAgICAgICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgICAgIGV2ZW50XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGlmIChtYXRjaFJlc3VsdCkge1xuICAgICAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG1hdGNoUmVzdWx0IGluc3RhbmNlb2YgUHJvbWlzZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLndhcm4oYFdoaWxlIHJvdXRpbmcgJHtnZXRGcmllbmRseVVSTCh1cmwpfSwgYW4gYXN5bmMgbWF0Y2hDYWxsYmFjayBmdW5jdGlvbiB3YXMgdXNlZC4gUGxlYXNlIGNvbnZlcnQgdGhlIGZvbGxvd2luZyByb3V0ZSB0byB1c2UgYSBzeW5jaHJvbm91cyBtYXRjaENhbGxiYWNrIGZ1bmN0aW9uOmAsIHJvdXRlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBwYXJhbXMgPSBtYXRjaFJlc3VsdDtcbiAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShwYXJhbXMpICYmIHBhcmFtcy5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobWF0Y2hSZXN1bHQuY29uc3RydWN0b3IgPT09IE9iamVjdCAmJiBPYmplY3Qua2V5cy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NoZU5hbWVEZXRhaWxzIGFzIHMgfTtcbiJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/Serwist.js\n")); + +/***/ }), + +/***/ "./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/registerQuotaErrorCallback.js": +/*!*************************************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/registerQuotaErrorCallback.js ***! + \*************************************************************************************************************************************/ +/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ r: function() { return /* binding */ registerQuotaErrorCallback; }\n/* harmony export */ });\n/* harmony import */ var _timeout_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./timeout.js */ \"./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/timeout.js\");\n\n\nconst registerQuotaErrorCallback = (callback)=>{\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(callback, \"function\", {\n moduleName: \"@serwist/core\",\n funcName: \"register\",\n paramName: \"callback\"\n });\n }\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.q.add(callback);\n if (true) {\n _timeout_js__WEBPACK_IMPORTED_MODULE_0__.l.log(\"Registered a callback to respond to quota errors.\", callback);\n }\n};\n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vc2Vyd2lzdEA5LjAuMC1wcmV2aWV3LjI0X3R5cGVzY3JpcHRANS40LjUvbm9kZV9tb2R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VvdGFFcnJvckNhbGxiYWNrcy5hZGQoY2FsbGJhY2spO1xuICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgbG9nZ2VyLmxvZyhcIlJlZ2lzdGVyZWQgYSBjYWxsYmFjayB0byByZXNwb25kIHRvIHF1b3RhIGVycm9ycy5cIiwgY2FsbGJhY2spO1xuICAgIH1cbn07XG5cbmV4cG9ydCB7IHJlZ2lzdGVyUXVvdGFFcnJvckNhbGxiYWNrIGFzIHIgfTtcbiJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/registerQuotaErrorCallback.js\n")); + +/***/ }), + +/***/ "./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/timeout.js": +/*!******************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/timeout.js ***! + \******************************************************************************************************************/ +/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ D: function() { return /* binding */ Deferred; },\n/* harmony export */ S: function() { return /* binding */ SerwistError; },\n/* harmony export */ a: function() { return /* binding */ cacheMatchIgnoreParams; },\n/* harmony export */ c: function() { return /* binding */ cacheNames; },\n/* harmony export */ e: function() { return /* binding */ executeQuotaErrorCallbacks; },\n/* harmony export */ f: function() { return /* binding */ finalAssertExports; },\n/* harmony export */ g: function() { return /* binding */ getFriendlyURL; },\n/* harmony export */ l: function() { return /* binding */ logger; },\n/* harmony export */ q: function() { return /* binding */ quotaErrorCallbacks; },\n/* harmony export */ t: function() { return /* binding */ timeout; }\n/* harmony export */ });\nconst _cacheNameDetails = {\n googleAnalytics: \"googleAnalytics\",\n precache: \"precache-v2\",\n prefix: \"serwist\",\n runtime: \"runtime\",\n suffix: typeof registration !== \"undefined\" ? registration.scope : \"\"\n};\nconst _createCacheName = (cacheName)=>{\n return [\n _cacheNameDetails.prefix,\n cacheName,\n _cacheNameDetails.suffix\n ].filter((value)=>value && value.length > 0).join(\"-\");\n};\nconst eachCacheNameDetail = (fn)=>{\n for (const key of Object.keys(_cacheNameDetails)){\n fn(key);\n }\n};\nconst cacheNames = {\n updateDetails: (details)=>{\n eachCacheNameDetail((key)=>{\n const detail = details[key];\n if (typeof detail === \"string\") {\n _cacheNameDetails[key] = detail;\n }\n });\n },\n getGoogleAnalyticsName: (userCacheName)=>{\n return userCacheName || _createCacheName(_cacheNameDetails.googleAnalytics);\n },\n getPrecacheName: (userCacheName)=>{\n return userCacheName || _createCacheName(_cacheNameDetails.precache);\n },\n getPrefix: ()=>{\n return _cacheNameDetails.prefix;\n },\n getRuntimeName: (userCacheName)=>{\n return userCacheName || _createCacheName(_cacheNameDetails.runtime);\n },\n getSuffix: ()=>{\n return _cacheNameDetails.suffix;\n }\n};\n\nconst logger = false ? 0 : (()=>{\n if (!(\"__WB_DISABLE_DEV_LOGS\" in globalThis)) {\n self.__WB_DISABLE_DEV_LOGS = false;\n }\n let inGroup = false;\n const methodToColorMap = {\n debug: \"#7f8c8d\",\n log: \"#2ecc71\",\n warn: \"#f39c12\",\n error: \"#c0392b\",\n groupCollapsed: \"#3498db\",\n groupEnd: null\n };\n const print = (method, args)=>{\n if (self.__WB_DISABLE_DEV_LOGS) {\n return;\n }\n if (method === \"groupCollapsed\") {\n if (typeof navigator !== \"undefined\" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {\n console[method](...args);\n return;\n }\n }\n const styles = [\n `background: ${methodToColorMap[method]}`,\n \"border-radius: 0.5em\",\n \"color: white\",\n \"font-weight: bold\",\n \"padding: 2px 0.5em\"\n ];\n const logPrefix = inGroup ? [] : [\n \"%cserwist\",\n styles.join(\";\")\n ];\n console[method](...logPrefix, ...args);\n if (method === \"groupCollapsed\") {\n inGroup = true;\n }\n if (method === \"groupEnd\") {\n inGroup = false;\n }\n };\n const loggerMethods = Object.keys(methodToColorMap);\n return loggerMethods.reduce((api, method)=>{\n api[method] = (...args)=>{\n print(method, args);\n };\n return api;\n }, {});\n})();\n\nconst messages = {\n \"invalid-value\": ({ paramName, validValueDescription, value })=>{\n if (!paramName || !validValueDescription) {\n throw new Error(`Unexpected input to 'invalid-value' error.`);\n }\n return `The '${paramName}' parameter was given a value with an ` + `unexpected value. ${validValueDescription} Received a value of ` + `${JSON.stringify(value)}.`;\n },\n \"not-an-array\": ({ moduleName, className, funcName, paramName })=>{\n if (!moduleName || !className || !funcName || !paramName) {\n throw new Error(`Unexpected input to 'not-an-array' error.`);\n }\n return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className}.${funcName}()' must be an array.`;\n },\n \"incorrect-type\": ({ expectedType, paramName, moduleName, className, funcName })=>{\n if (!expectedType || !paramName || !moduleName || !funcName) {\n throw new Error(`Unexpected input to 'incorrect-type' error.`);\n }\n const classNameStr = className ? `${className}.` : \"\";\n return `The parameter '${paramName}' passed into ` + `'${moduleName}.${classNameStr}` + `${funcName}()' must be of type ${expectedType}.`;\n },\n \"incorrect-class\": ({ expectedClassName, paramName, moduleName, className, funcName, isReturnValueProblem })=>{\n if (!expectedClassName || !moduleName || !funcName) {\n throw new Error(`Unexpected input to 'incorrect-class' error.`);\n }\n const classNameStr = className ? `${className}.` : \"\";\n if (isReturnValueProblem) {\n return `The return value from '${moduleName}.${classNameStr}${funcName}()' must be an instance of class ${expectedClassName}.`;\n }\n return `The parameter '${paramName}' passed into ` + `'${moduleName}.${classNameStr}${funcName}()' ` + `must be an instance of class ${expectedClassName}.`;\n },\n \"missing-a-method\": ({ expectedMethod, paramName, moduleName, className, funcName })=>{\n if (!expectedMethod || !paramName || !moduleName || !className || !funcName) {\n throw new Error(`Unexpected input to 'missing-a-method' error.`);\n }\n return `${moduleName}.${className}.${funcName}() expected the ` + `'${paramName}' parameter to expose a '${expectedMethod}' method.`;\n },\n \"add-to-cache-list-unexpected-type\": ({ entry })=>{\n return `An unexpected entry was passed to 'serwist.Serwist.addToPrecacheList()' The entry '${JSON.stringify(entry)}' isn't supported. You must supply an array of strings with one or more characters, objects with a url property or Request objects.`;\n },\n \"add-to-cache-list-conflicting-entries\": ({ firstEntry, secondEntry })=>{\n if (!firstEntry || !secondEntry) {\n throw new Error(\"Unexpected input to \" + `'add-to-cache-list-duplicate-entries' error.`);\n }\n return `Two of the entries passed to 'serwist.Serwist.addToPrecacheList()' had the URL ${firstEntry} but different revision details. Serwist is unable to cache and version the asset correctly. Please remove one of the entries.`;\n },\n \"plugin-error-request-will-fetch\": ({ thrownErrorMessage })=>{\n if (!thrownErrorMessage) {\n throw new Error(\"Unexpected input to \" + `'plugin-error-request-will-fetch', error.`);\n }\n return `An error was thrown by a plugin's 'requestWillFetch()' method. The thrown error message was: '${thrownErrorMessage}'.`;\n },\n \"invalid-cache-name\": ({ cacheNameId, value })=>{\n if (!cacheNameId) {\n throw new Error(`Expected a 'cacheNameId' for error 'invalid-cache-name'`);\n }\n return `You must provide a name containing at least one character for setCacheDetails({${cacheNameId}: '...'}). Received a value of '${JSON.stringify(value)}'`;\n },\n \"unregister-route-but-not-found-with-method\": ({ method })=>{\n if (!method) {\n throw new Error(\"Unexpected input to \" + `'unregister-route-but-not-found-with-method' error.`);\n }\n return `The route you're trying to unregister was not previously registered for the method type '${method}'.`;\n },\n \"unregister-route-route-not-registered\": ()=>{\n return `The route you're trying to unregister was not previously ` + \"registered.\";\n },\n \"queue-replay-failed\": ({ name })=>{\n return `Replaying the background sync queue '${name}' failed.`;\n },\n \"duplicate-queue-name\": ({ name })=>{\n return `The Queue name '${name}' is already being used. All instances of backgroundSync.Queue must be given unique names.`;\n },\n \"expired-test-without-max-age\": ({ methodName, paramName })=>{\n return `The '${methodName}()' method can only be used when the ` + `'${paramName}' is used in the constructor.`;\n },\n \"unsupported-route-type\": ({ moduleName, className, funcName, paramName })=>{\n return `The supplied '${paramName}' parameter was an unsupported type. Please check the docs for ${moduleName}.${className}.${funcName} for valid input types.`;\n },\n \"not-array-of-class\": ({ value, expectedClass, moduleName, className, funcName, paramName })=>{\n return `The supplied '${paramName}' parameter must be an array of '${expectedClass}' objects. Received '${JSON.stringify(value)},'. Please check the call to ${moduleName}.${className}.${funcName}() to fix the issue.`;\n },\n \"max-entries-or-age-required\": ({ moduleName, className, funcName })=>{\n return `You must define either 'config.maxEntries' or 'config.maxAgeSeconds' in '${moduleName}.${className}.${funcName}'`;\n },\n \"statuses-or-headers-required\": ({ moduleName, className, funcName })=>{\n return `You must define either 'config.statuses' or 'config.headers' in '${moduleName}.${className}.${funcName}'`;\n },\n \"invalid-string\": ({ moduleName, funcName, paramName })=>{\n if (!paramName || !moduleName || !funcName) {\n throw new Error(`Unexpected input to 'invalid-string' error.`);\n }\n return `When using strings, the '${paramName}' parameter must start with 'http' (for cross-origin matches) or '/' (for same-origin matches). Please see the docs for ${moduleName}.${funcName}() for more info.`;\n },\n \"channel-name-required\": ()=>{\n return \"You must provide a channelName to construct a \" + \"BroadcastCacheUpdate instance.\";\n },\n \"invalid-responses-are-same-args\": ()=>{\n return \"The arguments passed into responsesAreSame() appear to be \" + \"invalid. Please ensure valid Responses are used.\";\n },\n \"expire-custom-caches-only\": ()=>{\n return `You must provide a 'cacheName' property when using the ` + \"expiration plugin with a runtime caching strategy.\";\n },\n \"unit-must-be-bytes\": ({ normalizedRangeHeader })=>{\n if (!normalizedRangeHeader) {\n throw new Error(`Unexpected input to 'unit-must-be-bytes' error.`);\n }\n return `The 'unit' portion of the Range header must be set to 'bytes'. The Range header provided was \"${normalizedRangeHeader}\"`;\n },\n \"single-range-only\": ({ normalizedRangeHeader })=>{\n if (!normalizedRangeHeader) {\n throw new Error(`Unexpected input to 'single-range-only' error.`);\n }\n return `Multiple ranges are not supported. Please use a single start value, and optional end value. The Range header provided was \"${normalizedRangeHeader}\"`;\n },\n \"invalid-range-values\": ({ normalizedRangeHeader })=>{\n if (!normalizedRangeHeader) {\n throw new Error(`Unexpected input to 'invalid-range-values' error.`);\n }\n return `The Range header is missing both start and end values. At least one of those values is needed. The Range header provided was \"${normalizedRangeHeader}\"`;\n },\n \"no-range-header\": ()=>{\n return \"No Range header was found in the Request provided.\";\n },\n \"range-not-satisfiable\": ({ size, start, end })=>{\n return `The start (${start}) and end (${end}) values in the Range are ` + `not satisfiable by the cached response, which is ${size} bytes.`;\n },\n \"attempt-to-cache-non-get-request\": ({ url, method })=>{\n return `Unable to cache '${url}' because it is a '${method}' request and only 'GET' requests can be cached.`;\n },\n \"cache-put-with-no-response\": ({ url })=>{\n return `There was an attempt to cache '${url}' but the response was not defined.`;\n },\n \"no-response\": ({ url, error })=>{\n let message = `The strategy could not generate a response for '${url}'.`;\n if (error) {\n message += ` The underlying error is ${error}.`;\n }\n return message;\n },\n \"bad-precaching-response\": ({ url, status })=>{\n return `The precaching request for '${url}' failed${status ? ` with an HTTP status of ${status}.` : \".\"}`;\n },\n \"non-precached-url\": ({ url })=>{\n return `'createHandlerBoundToURL(\"${url}\")' was called, but that URL is not precached. Please pass in a URL that is precached instead.`;\n },\n \"add-to-cache-list-conflicting-integrities\": ({ url })=>{\n return `Two of the entries passed to 'serwist.Serwist.addToPrecacheList()' had the URL ${url} with different integrity values. Please remove one of them.`;\n },\n \"missing-precache-entry\": ({ cacheName, url })=>{\n return `Unable to find a precached response in ${cacheName} for ${url}.`;\n },\n \"cross-origin-copy-response\": ({ origin })=>{\n return `'@serwist/core.copyResponse()' can only be used with same-origin responses. It was passed a response with origin ${origin}.`;\n },\n \"opaque-streams-source\": ({ type })=>{\n const message = `One of the '@serwist/streams' sources resulted in an '${type}' response.`;\n if (type === \"opaqueredirect\") {\n return `${message} Please do not use a navigation request that results in a redirect as a source.`;\n }\n return `${message} Please ensure your sources are CORS-enabled.`;\n }\n};\n\nconst fallback = (code, ...args)=>{\n let msg = code;\n if (args.length > 0) {\n msg += ` :: ${JSON.stringify(args)}`;\n }\n return msg;\n};\nconst generatorFunction = (code, details = {})=>{\n const message = messages[code];\n if (!message) {\n throw new Error(`Unable to find message for code '${code}'.`);\n }\n return message(details);\n};\nconst messageGenerator = false ? 0 : generatorFunction;\n\nclass SerwistError extends Error {\n details;\n constructor(errorCode, details){\n const message = messageGenerator(errorCode, details);\n super(message);\n this.name = errorCode;\n this.details = details;\n }\n}\n\nconst isArray = (value, details)=>{\n if (!Array.isArray(value)) {\n throw new SerwistError(\"not-an-array\", details);\n }\n};\nconst hasMethod = (object, expectedMethod, details)=>{\n const type = typeof object[expectedMethod];\n if (type !== \"function\") {\n details.expectedMethod = expectedMethod;\n throw new SerwistError(\"missing-a-method\", details);\n }\n};\nconst isType = (object, expectedType, details)=>{\n if (typeof object !== expectedType) {\n details.expectedType = expectedType;\n throw new SerwistError(\"incorrect-type\", details);\n }\n};\nconst isInstance = (object, expectedClass, details)=>{\n if (!(object instanceof expectedClass)) {\n details.expectedClassName = expectedClass.name;\n throw new SerwistError(\"incorrect-class\", details);\n }\n};\nconst isOneOf = (value, validValues, details)=>{\n if (!validValues.includes(value)) {\n details.validValueDescription = `Valid values are ${JSON.stringify(validValues)}.`;\n throw new SerwistError(\"invalid-value\", details);\n }\n};\nconst isArrayOfClass = (value, expectedClass, details)=>{\n const error = new SerwistError(\"not-array-of-class\", details);\n if (!Array.isArray(value)) {\n throw error;\n }\n for (const item of value){\n if (!(item instanceof expectedClass)) {\n throw error;\n }\n }\n};\nconst finalAssertExports = false ? 0 : {\n hasMethod,\n isArray,\n isInstance,\n isOneOf,\n isType,\n isArrayOfClass\n};\n\nconst getFriendlyURL = (url)=>{\n const urlObj = new URL(String(url), location.href);\n return urlObj.href.replace(new RegExp(`^${location.origin}`), \"\");\n};\n\nclass Deferred {\n promise;\n resolve;\n reject;\n constructor(){\n this.promise = new Promise((resolve, reject)=>{\n this.resolve = resolve;\n this.reject = reject;\n });\n }\n}\n\nfunction stripParams(fullURL, ignoreParams) {\n const strippedURL = new URL(fullURL);\n for (const param of ignoreParams){\n strippedURL.searchParams.delete(param);\n }\n return strippedURL.href;\n}\nasync function cacheMatchIgnoreParams(cache, request, ignoreParams, matchOptions) {\n const strippedRequestURL = stripParams(request.url, ignoreParams);\n if (request.url === strippedRequestURL) {\n return cache.match(request, matchOptions);\n }\n const keysOptions = {\n ...matchOptions,\n ignoreSearch: true\n };\n const cacheKeys = await cache.keys(request, keysOptions);\n for (const cacheKey of cacheKeys){\n const strippedCacheKeyURL = stripParams(cacheKey.url, ignoreParams);\n if (strippedRequestURL === strippedCacheKeyURL) {\n return cache.match(cacheKey, matchOptions);\n }\n }\n return;\n}\n\nconst quotaErrorCallbacks = new Set();\n\nconst executeQuotaErrorCallbacks = async ()=>{\n if (true) {\n logger.log(`About to run ${quotaErrorCallbacks.size} callbacks to clean up caches.`);\n }\n for (const callback of quotaErrorCallbacks){\n await callback();\n if (true) {\n logger.log(callback, \"is complete.\");\n }\n }\n if (true) {\n logger.log(\"Finished running callbacks.\");\n }\n};\n\nfunction timeout(ms) {\n return new Promise((resolve)=>setTimeout(resolve, ms));\n}\n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vc2Vyd2lzdEA5LjAuMC1wcmV2aWV3LjI0X3R5cGVzY3JpcHRANS40LjUvbm9kZV9tb2R1bGVzL3Nlcndpc3QvZGlzdC9jaHVua3MvdGltZW91dC5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7O0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTt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WJ1ZzogXCIjN2Y4YzhkXCIsXG4gICAgICAgIGxvZzogXCIjMmVjYzcxXCIsXG4gICAgICAgIHdhcm46IFwiI2YzOWMxMlwiLFxuICAgICAgICBlcnJvcjogXCIjYzAzOTJiXCIsXG4gICAgICAgIGdyb3VwQ29sbGFwc2VkOiBcIiMzNDk4ZGJcIixcbiAgICAgICAgZ3JvdXBFbmQ6IG51bGxcbiAgICB9O1xuICAgIGNvbnN0IHByaW50ID0gKG1ldGhvZCwgYXJncyk9PntcbiAgICAgICAgaWYgKHNlbGYuX19XQl9ESVNBQkxFX0RFVl9MT0dTKSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1ldGhvZCA9PT0gXCJncm91cENvbGxhcHNlZFwiKSB7XG4gICAgICAgICAgICBpZiAodHlwZW9mIG5hdmlnYXRvciAhPT0gXCJ1bmRlZmluZWRcIiAmJiAvXigoPyFjaHJvbWV8YW5kcm9pZCkuKSpzYWZhcmkvaS50ZXN0KG5hdmlnYXRvci51c2VyQWdlbnQpKSB7XG4gICAgICAgICAgICAgICAgY29uc29sZVttZXRob2RdKC4uLmFyZ3MpO1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBjb25zdCBzdHlsZXMgPSBbXG4gICAgICAgICAgICBgYmFja2dyb3VuZDogJHttZXRob2RUb0NvbG9yTWFwW21ldGhvZF19YCxcbiAgICAgICAgICAgIFwiYm9yZGVyLXJhZGl1czogMC41ZW1cIixcbiAgICAgICAgICAgIFwiY29sb3I6IHdoaXRlXCIsXG4gICAgICAgICAgICBcImZvbnQtd2VpZ2h0OiBib2xkXCIsXG4gICAgICAgICAgICBcInBhZGRpbmc6IDJweCAwLjVlbVwiXG4gICAgICAgIF07XG4gICAgICAgIGNvbnN0IGxvZ1ByZWZpeCA9IGluR3JvdXAgPyBbXSA6IFtcbiAgICAgICAgICAgIFwiJWNzZXJ3aXN0X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b3JDYWxsYmFja3Muc2l6ZX0gY2FsbGJhY2tzIHRvIGNsZWFuIHVwIGNhY2hlcy5gKTtcbiAgICB9XG4gICAgZm9yIChjb25zdCBjYWxsYmFjayBvZiBxdW90YUVycm9yQ2FsbGJhY2tzKXtcbiAgICAgICAgYXdhaXQgY2FsbGJhY2soKTtcbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgbG9nZ2VyLmxvZyhjYWxsYmFjaywgXCJpcyBjb21wbGV0ZS5cIik7XG4gICAgICAgIH1cbiAgICB9XG4gICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICBsb2dnZXIubG9nKFwiRmluaXNoZWQgcnVubmluZyBjYWxsYmFja3MuXCIpO1xuICAgIH1cbn07XG5cbmZ1bmN0aW9uIHRpbWVvdXQobXMpIHtcbiAgICByZXR1cm4gbmV3IFByb21pc2UoKHJlc29sdmUpPT5zZXRUaW1lb3V0KHJlc29sdmUsIG1zKSk7XG59XG5cbmV4cG9ydCB7IERlZmVycmVkIGFzIEQsIFNlcndpc3RFcnJvciBhcyBTLCBjYWNoZU1hdGNoSWdub3JlUGFyYW1zIGFzIGEsIGNhY2hlTmFtZXMgYXMgYywgZXhlY3V0ZVF1b3RhRXJyb3JDYWxsYmFja3MgYXMgZSwgZmluYWxBc3NlcnRFeHBvcnRzIGFzIGYsIGdldEZyaWVuZGx5VVJMIGFzIGcsIGxvZ2dlciBhcyBsLCBxdW90YUVycm9yQ2FsbGJhY2tzIGFzIHEsIHRpbWVvdXQgYXMgdCB9O1xuIl0sIm5hbWVzIjpbXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/timeout.js\n")); + +/***/ }), + +/***/ "./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/waitUntil.js": +/*!********************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/waitUntil.js ***! + \********************************************************************************************************************/ +/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ c: function() { return /* binding */ canConstructResponseFromBodyStream; },\n/* harmony export */ w: function() { return /* binding */ waitUntil; }\n/* harmony export */ });\nlet supportStatus;\nfunction canConstructResponseFromBodyStream() {\n if (supportStatus === undefined) {\n const testResponse = new Response(\"\");\n if (\"body\" in testResponse) {\n try {\n new Response(testResponse.body);\n supportStatus = true;\n } catch (error) {\n supportStatus = false;\n }\n }\n supportStatus = false;\n }\n return supportStatus;\n}\n\nconst waitUntil = (event, asyncFn)=>{\n const returnPromise = asyncFn();\n event.waitUntil(returnPromise);\n return returnPromise;\n};\n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vc2Vyd2lzdEA5LjAuMC1wcmV2aWV3LjI0X3R5cGVzY3JpcHRANS40LjUvbm9kZV9tb2R1bGVzL3Nlcndpc3QvZGlzdC9jaHVua3Mvd2FpdFVudGlsLmpzIiwibWFwcGluZ3MiOiI7Ozs7O0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLGNBQWM7QUFDZDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVtRSIsInNvdXJjZXMiOlsid2VicGFjazovL19OX0UvLi9ub2RlX21vZHVsZXMvLnBucG0vc2Vyd2lzdEA5LjA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webpack-internal:///./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/waitUntil.js\n")); + +/***/ }), + +/***/ "./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/index.js": +/*!*********************************************************************************************************!*\ + !*** ./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/index.js ***! + \*********************************************************************************************************/ +/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ NavigationRoute: function() { return /* reexport safe */ _chunks_Serwist_js__WEBPACK_IMPORTED_MODULE_1__.N; },\n/* harmony export */ PrecacheRoute: function() { return /* reexport safe */ _chunks_Serwist_js__WEBPACK_IMPORTED_MODULE_1__.P; },\n/* harmony export */ PrecacheStrategy: function() { return /* reexport safe */ _chunks_Serwist_js__WEBPACK_IMPORTED_MODULE_1__.g; },\n/* harmony export */ RegExpRoute: function() { return /* reexport safe */ _chunks_Serwist_js__WEBPACK_IMPORTED_MODULE_1__.R; },\n/* harmony export */ Route: function() { return /* reexport safe */ _chunks_PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_3__.R; },\n/* harmony export */ Serwist: function() { return /* reexport safe */ _chunks_Serwist_js__WEBPACK_IMPORTED_MODULE_1__.S; },\n/* harmony export */ cacheNames: function() { return /* binding */ cacheNames; },\n/* harmony export */ cleanupOutdatedCaches: function() { return /* reexport safe */ _chunks_Serwist_js__WEBPACK_IMPORTED_MODULE_1__.c; },\n/* harmony export */ clientsClaim: function() { return /* reexport safe */ _chunks_Serwist_js__WEBPACK_IMPORTED_MODULE_1__.a; },\n/* harmony export */ copyResponse: function() { return /* reexport safe */ _chunks_Serwist_js__WEBPACK_IMPORTED_MODULE_1__.b; },\n/* harmony export */ disableDevLogs: function() { return /* reexport safe */ _chunks_Serwist_js__WEBPACK_IMPORTED_MODULE_1__.d; },\n/* harmony export */ disableNavigationPreload: function() { return /* reexport safe */ _chunks_Serwist_js__WEBPACK_IMPORTED_MODULE_1__.e; },\n/* harmony export */ enableNavigationPreload: function() { return /* reexport safe */ _chunks_Serwist_js__WEBPACK_IMPORTED_MODULE_1__.f; },\n/* harmony export */ isNavigationPreloadSupported: function() { return /* reexport safe */ _chunks_Serwist_js__WEBPACK_IMPORTED_MODULE_1__.i; },\n/* harmony export */ parseRoute: function() { return /* reexport safe */ _chunks_Serwist_js__WEBPACK_IMPORTED_MODULE_1__.p; },\n/* harmony export */ registerQuotaErrorCallback: function() { return /* reexport safe */ _chunks_registerQuotaErrorCallback_js__WEBPACK_IMPORTED_MODULE_2__.r; },\n/* harmony export */ setCacheNameDetails: function() { return /* reexport safe */ _chunks_Serwist_js__WEBPACK_IMPORTED_MODULE_1__.s; }\n/* harmony export */ });\n/* harmony import */ var _chunks_timeout_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./chunks/timeout.js */ \"./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/timeout.js\");\n/* harmony import */ var _chunks_Serwist_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./chunks/Serwist.js */ \"./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/Serwist.js\");\n/* harmony import */ var _chunks_registerQuotaErrorCallback_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./chunks/registerQuotaErrorCallback.js */ \"./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/registerQuotaErrorCallback.js\");\n/* harmony import */ var _chunks_PrecacheFallbackPlugin_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./chunks/PrecacheFallbackPlugin.js */ \"./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/PrecacheFallbackPlugin.js\");\n/* harmony import */ var _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./chunks/waitUntil.js */ \"./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/waitUntil.js\");\n/* harmony import */ var _chunks_NetworkOnly_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./chunks/NetworkOnly.js */ \"./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/NetworkOnly.js\");\n/* harmony import */ var idb__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! idb */ \"./node_modules/.pnpm/idb@8.0.0/node_modules/idb/build/index.js\");\n\n\n\n\n\n\n\n\nconst cacheNames = {\n get googleAnalytics () {\n return _chunks_timeout_js__WEBPACK_IMPORTED_MODULE_0__.c.getGoogleAnalyticsName();\n },\n get precache () {\n return _chunks_timeout_js__WEBPACK_IMPORTED_MODULE_0__.c.getPrecacheName();\n },\n get prefix () {\n return _chunks_timeout_js__WEBPACK_IMPORTED_MODULE_0__.c.getPrefix();\n },\n get runtime () {\n return _chunks_timeout_js__WEBPACK_IMPORTED_MODULE_0__.c.getRuntimeName();\n },\n get suffix () {\n return _chunks_timeout_js__WEBPACK_IMPORTED_MODULE_0__.c.getSuffix();\n }\n};\n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vc2Vyd2lzdEA5LjAuMC1wcmV2aWV3LjI0X3R5cGVzY3JpcHRANS40LjUvbm9kZV9tb2R1bGVzL3Nlcndpc3QvZGlzdC9pbmRleC5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBd0Q7QUFDZ1Q7QUFDL1E7QUFDekI7QUF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b3JDYWxsYmFjayB9IGZyb20gJy4vY2h1bmtzL3JlZ2lzdGVyUXVvdGFFcnJvckNhbGxiYWNrLmpzJztcbmV4cG9ydCB7IFIgYXMgUm91dGUgfSBmcm9tICcuL2NodW5rcy9QcmVjYWNoZUZhbGxiYWNrUGx1Z2luLmpzJztcbmltcG9ydCAnLi9jaHVua3Mvd2FpdFVudGlsLmpzJztcbmltcG9ydCAnLi9jaHVua3MvTmV0d29ya09ubHkuanMnO1xuaW1wb3J0ICdpZGInO1xuXG5jb25zdCBjYWNoZU5hbWVzID0ge1xuICAgIGdldCBnb29nbGVBbmFseXRpY3MgKCkge1xuICAgICAgICByZXR1cm4gY2FjaGVOYW1lcyQxLmdldEdvb2dsZUFuYWx5dGljc05hbWUoKTtcbiAgICB9LFxuICAgIGdldCBwcmVjYWNoZSAoKSB7XG4gICAgICAgIHJldHVybiBjYWNoZU5hbWVzJDEuZ2V0UHJlY2FjaGVOYW1lKCk7XG4gICAgfSxcbiAgICBnZXQgcHJlZml4ICgpIHtcbiAgICAgICAgcmV0dXJuIGNhY2hlTmFtZXMkMS5nZXRQcmVmaXgoKTtcbiAgICB9LFxuICAgIGdldCBydW50aW1lICgpIHtcbiAgICAgICAgcmV0dXJuIGNhY2hlTmFtZXMkMS5nZXRSdW50aW1lTmFtZSgpO1xuICAgIH0sXG4gICAgZ2V0IHN1ZmZpeCAoKSB7XG4gICAgICAgIHJldHVybiBjYWNoZU5hbWVzJDEuZ2V0U3VmZml4KCk7XG4gICAgfVxufTtcblxuZXhwb3J0IHsgY2FjaGVOYW1lcyB9O1xuIl0sIm5hbWVzIjpbXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/index.js\n")); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ if (cachedModule.error !== undefined) throw cachedModule.error; +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ id: moduleId, +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ var threw = true; +/******/ try { +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ threw = false; +/******/ } finally { +/******/ if(threw) delete __webpack_module_cache__[moduleId]; +/******/ } +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ !function() { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/trusted types policy */ +/******/ !function() { +/******/ var policy; +/******/ __webpack_require__.tt = function() { +/******/ // Create Trusted Type policy if Trusted Types are available and the policy doesn't exist yet. +/******/ if (policy === undefined) { +/******/ policy = { +/******/ createScript: function(script) { return script; } +/******/ }; +/******/ if (typeof trustedTypes !== "undefined" && trustedTypes.createPolicy) { +/******/ policy = trustedTypes.createPolicy("nextjs#bundler", policy); +/******/ } +/******/ } +/******/ return policy; +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/trusted types script */ +/******/ !function() { +/******/ __webpack_require__.ts = function(script) { return __webpack_require__.tt().createScript(script); }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/react refresh */ +/******/ !function() { +/******/ if (__webpack_require__.i) { +/******/ __webpack_require__.i.push(function(options) { +/******/ var originalFactory = options.factory; +/******/ options.factory = function(moduleObject, moduleExports, webpackRequire) { +/******/ var hasRefresh = typeof self !== "undefined" && !!self.$RefreshInterceptModuleExecution$; +/******/ var cleanup = hasRefresh ? self.$RefreshInterceptModuleExecution$(moduleObject.id) : function() {}; +/******/ try { +/******/ originalFactory.call(this, moduleObject, moduleExports, webpackRequire); +/******/ } finally { +/******/ cleanup(); +/******/ } +/******/ } +/******/ }) +/******/ } +/******/ }(); +/******/ +/******/ /* webpack/runtime/compat */ +/******/ +/******/ +/******/ // noop fns to prevent runtime errors during initialization +/******/ if (typeof self !== "undefined") { +/******/ self.$RefreshReg$ = function () {}; +/******/ self.$RefreshSig$ = function () { +/******/ return function (type) { +/******/ return type; +/******/ }; +/******/ }; +/******/ } +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module can't be inlined because the eval-source-map devtool is used. +/******/ var __webpack_exports__ = __webpack_require__("./app/sw.js"); +/******/ +/******/ })() +; \ No newline at end of file diff --git a/public/swe-worker-ab00d3c7d2d59769.js b/public/swe-worker-ab00d3c7d2d59769.js deleted file mode 100644 index c5671bed..00000000 --- a/public/swe-worker-ab00d3c7d2d59769.js +++ /dev/null @@ -1 +0,0 @@ -self.onmessage=async e=>{switch(e.data.type){case"__START_URL_CACHE__":{let t=e.data.url,a=await fetch(t);if(!a.redirected)return(await caches.open("start-url")).put(t,a);return Promise.resolve()}case"__FRONTEND_NAV_CACHE__":{let t=e.data.url,a=await caches.open("pages");if(await a.match(t,{ignoreSearch:!0}))return;let r=await fetch(t);if(!r.ok)return;return a.put(t,r.clone()),Promise.resolve()}default:return Promise.resolve()}}; \ No newline at end of file diff --git a/public/swe-worker-development.js b/public/swe-worker-development.js new file mode 100644 index 00000000..56b3e519 --- /dev/null +++ b/public/swe-worker-development.js @@ -0,0 +1,102 @@ +/* + * ATTENTION: An "eval-source-map" devtool has been used. + * This devtool is neither made for production nor for readable output files. + * It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools. + * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) + * or disable the default devtool with "devtool: false". + * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). + */ +/******/ (function() { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./node_modules/.pnpm/@serwist+next@9.0.0-preview.21_next@14.2.1_typescript@5.4.5_webpack@5.91.0/node_modules/@serwist/next/dist/sw-entry-worker.js": +/*!**********************************************************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/@serwist+next@9.0.0-preview.21_next@14.2.1_typescript@5.4.5_webpack@5.91.0/node_modules/@serwist/next/dist/sw-entry-worker.js ***! + \**********************************************************************************************************************************************************/ +/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\nself.onmessage = async (ev)=>{\n switch(ev.data.type){\n case \"__START_URL_CACHE__\":\n {\n const url = ev.data.url;\n const response = await fetch(url);\n if (!response.redirected) {\n const startUrlCache = await caches.open(\"start-url\");\n return startUrlCache.put(url, response);\n }\n return Promise.resolve();\n }\n case \"__FRONTEND_NAV_CACHE__\":\n {\n const url = ev.data.url;\n const pagesCache = await caches.open(\"pages\");\n const isPageCached = !!await pagesCache.match(url, {\n ignoreSearch: true\n });\n if (isPageCached) {\n return;\n }\n const page = await fetch(url);\n if (!page.ok) {\n return;\n }\n pagesCache.put(url, page.clone());\n return Promise.resolve();\n }\n default:\n return Promise.resolve();\n }\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vQHNlcndpc3QrbmV4dEA5LjAuMC1wcmV2aWV3LjIxX25leHRAMTQuMi4xX3R5cGVzY3JpcHRANS40LjVfd2VicGFja0A1LjkxLjAvbm9kZV9tb2R1bGVzL0BzZXJ3aXN0L25leHQvZGlzdC9zdy1lbnRyeS13b3JrZXIuanMiLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLGlCQUFpQjtBQUNqQjtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vX05fRS8uL25vZGVfbW9kdWxlcy8ucG5wbS9Ac2Vyd2lzdCtuZXh0QDkuMC4wLXByZXZpZXcuMjFfbmV4dEAxNC4yLjFfdHlwZXNjcmlwdEA1LjQuNV93ZWJwYWNrQDUuOTEuMC9ub2RlX21vZHVsZXMvQHNlcndpc3QvbmV4dC9kaXN0L3N3LWVudHJ5LXdvcmtlci5qcz82ZDBhIl0sInNvdXJjZXNDb250ZW50IjpbInNlbGYub25tZXNzYWdlID0gYXN5bmMgKGV2KT0+e1xuICAgIHN3aXRjaChldi5kYXRhLnR5cGUpe1xuICAgICAgICBjYXNlIFwiX19TVEFSVF9VUkxfQ0FDSEVfX1wiOlxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgIGNvbnN0IHVybCA9IGV2LmRhdGEudXJsO1xuICAgICAgICAgICAgICAgIGNvbnN0IHJlc3BvbnNlID0gYXdhaXQgZmV0Y2godXJsKTtcbiAgICAgICAgICAgICAgICBpZiAoIXJlc3BvbnNlLnJlZGlyZWN0ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RhcnRVcmxDYWNoZSA9IGF3YWl0IGNhY2hlcy5vcGVuKFwic3RhcnQtdXJsXCIpO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gc3RhcnRVcmxDYWNoZS5wdXQodXJsLCByZXNwb25zZSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgY2FzZSBcIl9fRlJPTlRFTkRfTkFWX0NBQ0hFX19cIjpcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICBjb25zdCB1cmwgPSBldi5kYXRhLnVybDtcbiAgICAgICAgICAgICAgICBjb25zdCBwYWdlc0NhY2hlID0gYXdhaXQgY2FjaGVzLm9wZW4oXCJwYWdlc1wiKTtcbiAgICAgICAgICAgICAgICBjb25zdCBpc1BhZ2VDYWNoZWQgPSAhIWF3YWl0IHBhZ2VzQ2FjaGUubWF0Y2godXJsLCB7XG4gICAgICAgICAgICAgICAgICAgIGlnbm9yZVNlYXJjaDogdHJ1ZVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIGlmIChpc1BhZ2VDYWNoZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjb25zdCBwYWdlID0gYXdhaXQgZmV0Y2godXJsKTtcbiAgICAgICAgICAgICAgICBpZiAoIXBhZ2Uub2spIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBwYWdlc0NhY2hlLnB1dCh1cmwsIHBhZ2UuY2xvbmUoKSk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSgpO1xuICAgICAgICAgICAgfVxuICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSgpO1xuICAgIH1cbn07XG4iXSwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/@serwist+next@9.0.0-preview.21_next@14.2.1_typescript@5.4.5_webpack@5.91.0/node_modules/@serwist/next/dist/sw-entry-worker.js\n")); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The require scope +/******/ var __webpack_require__ = {}; +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/make namespace object */ +/******/ !function() { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/trusted types policy */ +/******/ !function() { +/******/ var policy; +/******/ __webpack_require__.tt = function() { +/******/ // Create Trusted Type policy if Trusted Types are available and the policy doesn't exist yet. +/******/ if (policy === undefined) { +/******/ policy = { +/******/ createScript: function(script) { return script; } +/******/ }; +/******/ if (typeof trustedTypes !== "undefined" && trustedTypes.createPolicy) { +/******/ policy = trustedTypes.createPolicy("nextjs#bundler", policy); +/******/ } +/******/ } +/******/ return policy; +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/trusted types script */ +/******/ !function() { +/******/ __webpack_require__.ts = function(script) { return __webpack_require__.tt().createScript(script); }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/react refresh */ +/******/ !function() { +/******/ if (__webpack_require__.i) { +/******/ __webpack_require__.i.push(function(options) { +/******/ var originalFactory = options.factory; +/******/ options.factory = function(moduleObject, moduleExports, webpackRequire) { +/******/ var hasRefresh = typeof self !== "undefined" && !!self.$RefreshInterceptModuleExecution$; +/******/ var cleanup = hasRefresh ? self.$RefreshInterceptModuleExecution$(moduleObject.id) : function() {}; +/******/ try { +/******/ originalFactory.call(this, moduleObject, moduleExports, webpackRequire); +/******/ } finally { +/******/ cleanup(); +/******/ } +/******/ } +/******/ }) +/******/ } +/******/ }(); +/******/ +/******/ /* webpack/runtime/compat */ +/******/ +/******/ +/******/ // noop fns to prevent runtime errors during initialization +/******/ if (typeof self !== "undefined") { +/******/ self.$RefreshReg$ = function () {}; +/******/ self.$RefreshSig$ = function () { +/******/ return function (type) { +/******/ return type; +/******/ }; +/******/ }; +/******/ } +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module can't be inlined because the eval-source-map devtool is used. +/******/ var __webpack_exports__ = {}; +/******/ __webpack_modules__["./node_modules/.pnpm/@serwist+next@9.0.0-preview.21_next@14.2.1_typescript@5.4.5_webpack@5.91.0/node_modules/@serwist/next/dist/sw-entry-worker.js"](0, __webpack_exports__, __webpack_require__); +/******/ +/******/ })() +; \ No newline at end of file