diff --git a/app/(pages)/r3f/(components)/box/index.js b/app/(pages)/r3f/(components)/box/index.js index 3730e9fd..e525cce7 100644 --- a/app/(pages)/r3f/(components)/box/index.js +++ b/app/(pages)/r3f/(components)/box/index.js @@ -2,6 +2,8 @@ import { useFrame } from '@darkroom.engineering/hamo' import { OrbitControls } from '@react-three/drei' +import { useSheet } from 'libs/theatre' +import { useTheatre } from 'libs/theatre/hooks/use-theatre' import { WebGLTunnel } from 'libs/webgl/components/tunnel' import { useRef } from 'react' @@ -14,6 +16,23 @@ export function Box() { meshRef.current.rotation.y = time * 0.0001 }) + const sheet = useSheet('webgl') + useTheatre( + sheet, + 'box', + { + x: 0, + y: 0, + z: 0, + }, + { + onValuesChange: ({ x, y, z }) => { + if (!meshRef.current) return + meshRef.current.position.set(x, y, z) + }, + }, + ) + return ( diff --git a/libs/theatre/hooks/use-theatre.js b/libs/theatre/hooks/use-theatre.js index a466faa0..57fe608b 100644 --- a/libs/theatre/hooks/use-theatre.js +++ b/libs/theatre/hooks/use-theatre.js @@ -1,5 +1,4 @@ import { useCallback, useEffect, useRef, useState } from 'react' -import { useCurrentRafDriver } from '..' import { useStudio } from './use-studio' export function useTheatreObject(sheet, theatreKey, config, deps = []) { @@ -25,7 +24,6 @@ export function useTheatre( { onValuesChange, lazy = true, deps = [] } = {}, ) { const object = useTheatreObject(sheet, theatreKey, config, deps) - const rafDriver = useCurrentRafDriver() const [values, setValues] = useState({}) const lazyValues = useRef({}) @@ -39,11 +37,11 @@ export function useTheatre( if (!lazy) setValues(values) onValuesChange?.(values) - }, rafDriver) + }) return unsubscribe } - }, [object, rafDriver, lazy, ...deps]) + }, [object, lazy, ...deps]) const studio = useStudio() diff --git a/libs/theatre/studio/index.js b/libs/theatre/studio/index.js index 698c69ed..6bb02b06 100644 --- a/libs/theatre/studio/index.js +++ b/libs/theatre/studio/index.js @@ -1,3 +1,4 @@ +import '@theatre/core' import studio from '@theatre/studio' import { useEffect } from 'react' import s from './studio.module.scss' diff --git a/public/sw.js b/public/sw.js index 6f84802c..1b744dd1 100644 --- a/public/sw.js +++ b/public/sw.js @@ -10,113 +10,13 @@ /******/ "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 ***! - \******************************************************************************************************************************************/ +/***/ "./node_modules/.pnpm/@serwist+next@9.0.2_next@14.2.3_@babel+core@7.24.5_react-dom@18.3.1_react@18.3.1__react@18.3._e2nkmeterpqllgsh44wfxk7k2q/node_modules/@serwist/next/dist/index.worker.js": +/*!*****************************************************************************************************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/@serwist+next@9.0.2_next@14.2.3_@babel+core@7.24.5_react-dom@18.3.1_react@18.3.1__react@18.3._e2nkmeterpqllgsh44wfxk7k2q/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 */ 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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnB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IGYsIGxvZ2dlciBhcyBsLCBxdW90YUVycm9yQ2FsbGJhY2tzIGFzIHEgfTtcbiJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vQHNlcndpc3QrY29yZUA5LjAuMC1wcmV2aWV3LjIxX3R5cGVzY3JpcHRANS40LjUvbm9kZV9tb2R1bGVzL0BzZXJ3aXN0L2NvcmUvZGlzdC9pbmRleC5pbnRlcm5hbC5qcyIsIm1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G93XCJcbiAgICAgICAgfSk7XG4gICAgICAgIHJlc3VsdGluZ1dpbmRvdyA9IGV4aXN0aW5nV2luZG93cy5maW5kKCh3KT0+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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vQHNlcndpc3QrY29yZUA5LjAuMC1wcmV2aWV3LjIxX3R5cGVzY3JpcHRANS40LjUvbm9kZV9tb2R1bGVzL0BzZXJ3aXN0L2NvcmUvZGlzdC9pbmRleC5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBZ007O0FBRWhNO0FBQ0E7QUFDQSxlQUFlLDZEQUFZO0FBQzNCLEtBQUs7QUFDTDtBQUNBLGVBQWUsNkRBQVk7QUFDM0IsS0FBSztBQUNMO0FBQ0EsZUFBZSw2REFBWTtBQUMzQixLQUFLO0FBQ0w7QUFDQSxlQUFlLDZEQUFZO0FBQzNCLEtBQUs7QUFDTDtBQUNBLGVBQWUsNkRBQVk7QUFDM0I7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxrQkFBa0IsNkRBQVk7QUFDOUI7QUFDQSxTQUFTO0FBQ1Q7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLGlCQUFpQixpRUFBa0M7QUFDbkQ7QUFDQTs7QUFFQTtBQUNBLFFBQVEsSUFBcUM7QUFDN0MsUUFBUSw2REFBa0I7QUFDMUI7QUFDQTtBQUNBO0FBQ0EsU0FBUztBQUNUO0FBQ0EsSUFBSSw2REFBbUI7QUFDdkIsUUFBUSxJQUFxQztBQUM3QyxRQUFRLDZEQUFNO0FBQ2Q7QUFDQTs7QUFFQTtBQUNBLFFBQVEsSUF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25zdCBzZXRDYWNoZU5hbWVEZXRhaWxzID0gKGRldGFpbHMpPT57XG4gICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICBmb3IgKGNvbnN0IGtleSBvZiBPYmplY3Qua2V5cyhkZXRhaWxzKSl7XG4gICAgICAgICAgICBmaW5hbEFzc2VydEV4cG9ydHMuaXNUeXBlKGRldGFpbHNba2V5XSwgXCJzdHJpbmdcIiwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3QvY29yZVwiLFxuICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcInNldENhY2hlTmFtZURldGFpbHNcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IGBkZXRhaWxzLiR7a2V5fWBcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChkZXRhaWxzLnByZWNhY2hlPy5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBTZXJ3aXN0RXJyb3IoXCJpbnZhbGlkLWNhY2hlLW5hbWVcIiwge1xuICAgICAgICAgICAgICAgIGNhY2hlTmFtZUlkOiBcInByZWNhY2hlXCIsXG4gICAgICAgICAgICAgICAgdmFsdWU6IGRldGFpbHMucHJlY2FjaGVcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChkZXRhaWxzLnJ1bnRpbWU/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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vQHNlcndpc3QrbmV4dEA5LjAuMC1wcmV2aWV3LjIxX25leHRAMTQuMi4xX3R5cGVzY3JpcHRANS40LjVfd2VicGFja0A1LjkxLjAvbm9kZV9tb2R1bGVzL0BzZXJ3aXN0L25leHQvZGlzdC9pbmRleC53b3JrZXIuanMiLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQUE0RTtBQUNZOztBQUV4RjtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBLHFCQUFxQixLQUFxQyxRQUFRLENBbVBqRTs7QUFFeUMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9fTl9FLy4vbm9kZV9tb2R1bGVzLy5wbnBtL0BzZXJ3aXN0K25leHRAOS4wLjAtcHJldmlldy4yMV9uZXh0QDE0LjIuMV90eXBlc2NyaXB0QDUuNC41X3dlYnBhY2tANS45MS4wL25vZGVfbW9kdWxlcy9Ac2Vyd2lzdC9uZXh0L2Rpc3QvaW5kZXgud29ya2VyLmpzPzk4N2MiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgRXhwaXJhdGlvblBsdWdpbiwgUmFuZ2VSZXF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3IFN0YWxlV2hpbGVSZXZhbGlkYXRlKHtcbiAgICAgICAgICAgIGNhY2hlTmFtZTogXCJnb29nbGUtZm9udHMtc3R5bGVzaGVldHNcIixcbiAgICAgICAgICAgIHBsdWdpbnM6IFtcbiAgICAgICAgICAgICAgICBuZXcgRXhwaXJhdGlvblBsdWdpbih7XG4gICAgICAgICAgICAgICAgICAgIG1heEVudHJpZXM6IDQsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZVNlY29uZHM6IDcgKiAyNCAqIDYwICogNjAsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZUZyb206IFwibGFzdC11c2VkXCJcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgXVxuICAgICAgICB9KVxuICAgIH0sXG4gICAge1xuICAgICAgICBtYXRjaGVyOiAvXFwuKD86ZW90fG90Znx0dGN8dHRmfHdvZmZ8d29mZjJ8Zm9udC5jc3MpJC9pLFxuICAgICAgICBoYW5kbGVyOiBuZXcgU3RhbGVXaGlsZVJldmFsaWRhdGUoe1xuICAgICAgICAgICAgY2FjaGVOYW1lOiBcInN0YXRpYy1mb250LWFzc2V0c1wiLFxuICAgICAgICAgICAgcGx1Z2luczogW1xuICAgICAgICAgICAgICAgIG5ldyBFeHBpcmF0aW9uUGx1Z2luKHtcbiAgICAgICAgICAgICAgICAgICAgbWF4RW50cmllczogNCxcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlU2Vjb25kczogNyAqIDI0ICogNjAgKiA2MCxcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlRnJvbTogXCJsYXN0LXVzZWRcIlxuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICBdXG4gICAgICAgIH0pXG4gICAgfSxcbiAgICB7XG4gICAgICAgIG1hdGNoZXI6IC9cXC4oPzpqcGd8anBlZ3xnaWZ8cG5nfHN2Z3xpY298d2VicCkkL2ksXG4gICAgICAgIGhhbmRsZXI6IG5ldyBTdGFsZVdoaWxlUmV2YWxpZGF0ZSh7XG4gICAgICAgICAgICBjYWNoZU5hbWU6IFwic3RhdGljLWltYWdlLWFzc2V0c1wiLFxuICAgICAgICAgICAgcGx1Z2luczogW1xuICAgICAgICAgICAgICAgIG5ldyBFeHBpcmF0aW9uUGx1Z2luKHtcbiAgICAgICAgICAgICAgICAgICAgbWF4RW50cmllczogNjQsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZVNlY29uZHM6IDMwICogMjQgKiA2MCAqIDYwLFxuICAgICAgICAgICAgICAgICAgICBtYXhBZ2VGcm9tOiBcImxhc3QtdXNlZFwiXG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIF1cbiAgICAgICAgfSlcbiAgICB9LFxuICAgIHtcbiAgICAgICAgbWF0Y2hlcjogL1xcL19uZXh0XFwvc3RhdGljLitcXC5qcyQvaSxcbiAgICAgICAgaGFuZGxlcjogbmV3IENhY2hlRmlyc3Qoe1xuICAgICAgICAgICAgY2FjaGVOYW1lOiBcIm5leHQtc3RhdGljLWpzLWFzc2V0c1wiLFxuICAgICAgICAgICAgcGx1Z2luczogW1xuICAgICAgICAgICAgICAgIG5ldyBFeHBpcmF0aW9uUGx1Z2luKHtcbiAgICAgICAgICAgICAgICAgICAgbWF4RW50cmllczogNjQsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZVNlY29uZHM6IDI0ICogNjAgKiA2MCxcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlRnJvbTogXCJsYXN0LXVzZWRcIlxuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICBdXG4gICAgICAgIH0pXG4gICAgfSxcbiAgICB7XG4gICAgICAgIG1hdGNoZXI6IC9cXC9fbmV4dFxcL2ltYWdlXFw/dXJsPS4rJC9pLFxuICAgICAgICBoYW5kbGVyOiBuZXcgU3RhbGVXaGlsZVJldmFsaWRhdGUoe1xuICAgICAgICAgICAgY2FjaGVOYW1lOiBcIm5leHQtaW1hZ2VcIixcbiAgICAgICAgICAgIHBsdWdpbnM6IFtcbiAgICAgICAgICAgICAgICBuZXcgRXhwaXJhdGlvblBsdWdpbih7XG4gICAgICAgICAgICAgICAgICAgIG1heEVudHJpZXM6IDY0LFxuICAgICAgICAgICAgICAgICAgICBtYXhBZ2VTZWNvbmRzOiAyNCAqIDYwICogNjAsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZUZyb206IFwibGFzdC11c2VkXCJcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgXVxuICAgICAgICB9KVxuICAgIH0sXG4gICAge1xuICAgICAgICBtYXRjaGVyOiAvXFwuKD86bXAzfHdhdnxvZ2cpJC9pLFxuICAgICAgICBoYW5kbGVyOiBuZXcgQ2FjaGVGaXJzdCh7XG4gICAgICAgICAgICBjYWNoZU5hbWU6IFwic3RhdGljLWF1ZGlvLWFzc2V0c1wiLFxuICAgICAgICAgICAgcGx1Z2luczogW1xuICAgICAgICAgICAgICAgIG5ldyBFeHBpcmF0aW9uUGx1Z2luKHtcbiAgICAgICAgICAgICAgICAgICAgbWF4RW50cmllczogMzIsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZVNlY29uZHM6IDI0ICogNjAgKiA2MCxcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlRnJvbTogXCJsYXN0LXVzZWRcIlxuICAgICAgICAgICAgICAgIH0pLFxuICAgICAgICAgICAgICAgIG5ldyBSYW5nZVJlcXVlc3RzUGx1Z2luKClcbiAgICAgICAgICAgIF1cbiAgICAgICAgfSlcbiAgICB9LFxuICAgIHtcbiAgICAgICAgbWF0Y2hlcjogL1xcLig/Om1wNHx3ZWJtKSQvaSxcbiAgICAgICAgaGFuZGxlcjogbmV3IENhY2hlRmlyc3Qoe1xuICAgICAgICAgICAgY2FjaGVOYW1lOiBcInN0YXRpYy12aWRlby1hc3NldHNcIixcbiAgICAgICAgICAgIHBsdWdpbnM6IFtcbiAgICAgICAgICAgICAgICBuZXcgRXhwaXJhdGlvblBsdWdpbih7XG4gICAgICAgICAgICAgICAgICAgIG1heEVudHJpZXM6IDMyLFxuICAgICAgICAgICAgICAgICAgICBtYXhBZ2VTZWNvbmRzOiAyNCAqIDYwICogNjAsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZUZyb206IFwibGFzdC11c2VkXCJcbiAgICAgICAgICAgICAgICB9KSxcbiAgICAgICAgICAgICAgICBuZXcgUmFuZ2VSZXF1ZXN0c1BsdWdpbigpXG4gICAgICAgICAgICBdXG4gICAgICAgIH0pXG4gICAgfSxcbiAgICB7XG4gICAgICAgIG1hdGNoZXI6IC9cXC4oPzpqcykkL2ksXG4gICAgICAgIGhhbmRsZXI6IG5ldyBTdGFsZVdoaWxlUmV2YWxpZGF0ZSh7XG4gICAgICAgICAgICBjYWNoZU5hbWU6IFwic3RhdGljLWpzLWFzc2V0c1wiLFxuICAgICAgICAgICAgcGx1Z2luczogW1xuICAgICAgICAgICAgICAgIG5ldyBFeHBpcmF0aW9uUGx1Z2luKHtcbiAgICAgICAgICAgICAgICAgICAgbWF4RW50cmllczogNDgsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZVNlY29uZHM6IDI0ICogNjAgKiA2MCxcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlRnJvbTogXCJsYXN0LXVzZWRcIlxuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICBdXG4gICAgICAgIH0pXG4gICAgfSxcbiAgICB7XG4gICAgICAgIG1hdGNoZXI6IC9cXC4oPzpjc3N8bGVzcykkL2ksXG4gICAgICAgIGhhbmRsZXI6IG5ldyBTdGFsZVdoaWxlUmV2YWxpZGF0ZSh7XG4gICAgICAgICAgICBjYWNoZU5hbWU6IFwic3RhdGljLXN0eWxlLWFzc2V0c1wiLFxuICAgICAgICAgICAgcGx1Z2luczogW1xuICAgICAgICAgICAgICAgIG5ldyBFeHBpcmF0aW9uUGx1Z2luKHtcbiAgICAgICAgICAgICAgICAgICAgbWF4RW50cmllczogMzIsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZVNlY29uZHM6IDI0ICogNjAgKiA2MCxcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlRnJvbTogXCJsYXN0LXVzZWRcIlxuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICBdXG4gICAgICAgIH0pXG4gICAgfSxcbiAgICB7XG4gICAgICAgIG1hdGNoZXI6IC9cXC9fbmV4dFxcL2RhdGFcXC8uK1xcLy4rXFwuanNvbiQvaSxcbiAgICAgICAgaGFuZGxlcjogbmV3IE5ldHdvcmtGaXJzdCh7XG4gICAgICAgICAgICBjYWNoZU5hbWU6IFwibmV4dC1kYXRhXCIsXG4gICAgICAgICAgICBwbHVnaW5zOiBbXG4gICAgICAgICAgICAgICAgbmV3IEV4cGlyYXRpb25QbHVnaW4oe1xuICAgICAgICAgICAgICAgICAgICBtYXhFbnRyaWVzOiAzMixcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlU2Vjb25kczogMjQgKiA2MCAqIDYwLFxuICAgICAgICAgICAgICAgICAgICBtYXhBZ2VGcm9tOiBcImxhc3QtdXNlZFwiXG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIF1cbiAgICAgICAgfSlcbiAgICB9LFxuICAgIHtcbiAgICAgICAgbWF0Y2hlcjogL1xcLig/Ompzb258eG1sfGNzdikkL2ksXG4gICAgICAgIGhhbmRsZXI6IG5ldyBOZXR3b3JrRmlyc3Qoe1xuICAgICAgICAgICAgY2FjaGVOYW1lOiBcInN0YXRpYy1kYXRhLWFzc2V0c1wiLFxuICAgICAgICAgICAgcGx1Z2luczogW1xuICAgICAgICAgICAgICAgIG5ldyBFeHBpcmF0aW9uUGx1Z2luKHtcbiAgICAgICAgICAgICAgICAgICAgbWF4RW50cmllczogMzIsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZVNlY29uZHM6IDI0ICogNjAgKiA2MCxcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlRnJvbTogXCJsYXN0LXVzZWRcIlxuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICBdXG4gICAgICAgIH0pXG4gICAgfSxcbiAgICB7XG4gICAgICAgIG1hdGNoZXI6ICh7IHNhbWVPcmlnaW4sIHVybDogeyBwYXRobmFtZSB9IH0pPT57XG4gICAgICAgICAgICBpZiAoIXNhbWVPcmlnaW4gfHwgcGF0aG5hbWUuc3RhcnRzV2l0aChcIi9hcGkvYXV0aC9jYWxsYmFja1wiKSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChwYXRobmFtZS5zdGFydHNXaXRoKFwiL2FwaS9cIikpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgfSxcbiAgICAgICAgbWV0aG9kOiBcIkdFVFwiLFxuICAgICAgICBoYW5kbGVyOiBuZXcgTmV0d29ya0ZpcnN0KHtcbiAgICAgICAgICAgIGNhY2hlTmFtZTogXCJhcGlzXCIsXG4gICAgICAgICAgICBwbHVnaW5zOiBbXG4gICAgICAgICAgICAgICAgbmV3IEV4cGlyYXRpb25QbHVnaW4oe1xuICAgICAgICAgICAgICAgICAgICBtYXhFbnRyaWVzOiAxNixcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlU2Vjb25kczogMjQgKiA2MCAqIDYwLFxuICAgICAgICAgICAgICAgICAgICBtYXhBZ2VGcm9tOiBcImxhc3QtdXNlZFwiXG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIF0sXG4gICAgICAgICAgICBuZXR3b3JrVGltZW91dFNlY29uZHM6IDEwXG4gICAgICAgIH0pXG4gICAgfSxcbiAgICB7XG4gICAgICAgIG1hdGNoZXI6ICh7IHJlcXVlc3QsIHVybDogeyBwYXRobmFtZSB9LCBzYW1lT3JpZ2luIH0pPT5yZXF1ZXN0LmhlYWRlcnMuZ2V0KFwiUlNDXCIpID09PSBcIjFcIiAmJiBy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AgIF1cbiAgICAgICAgfSlcbiAgICB9LFxuICAgIHtcbiAgICAgICAgbWF0Y2hlcjogKHsgc2FtZU9yaWdpbiB9KT0+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;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JlclwiLCB7XG4gICAgICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3Qvc3RyYXRlZ2llc1wiLFxuICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6IHRoaXMuY29uc3RydWN0b3IubmFtZSxcbiAgICAgICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiY29uc3RydWN0b3JcIixcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcIm5ldHdvcmtUaW1lb3V0U2Vjb25kc1wiXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG4gICAgYXN5bmMgX2hhbmRsZShyZXF1ZXN0LCBoYW5kbGVyKSB7XG4gICAgICAgIGNvbnN0IGxvZ3MgPSBbXTtcbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgYXNzZXJ0LmlzSW5zdGFuY2UocmVxdWVzdCwgUmVxdWVzdCwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3Qvc3RyYXRlZ2llc1wiLFxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogdGhpcy5jb25zdHJ1Y3Rvci5uYW1lLFxuICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcImhhbmRsZVwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJtYWtlUmVxdWVzdFwiXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCBwcm9taXNlcyA9IFtdO1xuICAgICAgICBsZXQgdGltZW91dElkO1xuICAgICAgICBpZiAodGhpcy5fbmV0d29ya1RpbWVvdXRTZWNvbmRzKSB7XG4gICAgICAgICAgICBjb25zdCB7IGlkLCBwcm9taXNlIH0gPSB0aGlzLl9nZXRUaW1lb3V0UHJvbWlzZSh7XG4gICAgICAgICAgICAgICAgcmVxdWVzdCxcbiAgICAgICAgICAgICAgICBsb2dzLFxuICAgICAgICAgICAgICAgIGhhbmRsZXJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgdGltZW91dElkID0gaWQ7XG4gICAgICAgICAgICBwcm9taXNlcy5wdXNoKHByb21pc2UpO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IG5ldHdvcmtQcm9taXNlID0gdGhpcy5fZ2V0TmV0d29ya1Byb21pc2Uoe1xuICAgICAgICAgICAgdGltZW91dElkLFxuICAgICAgICAgICAgcmVxdWVzdCxcbiAgICAgICAgICAgIGxvZ3MsXG4gICAgICAgICAgICBoYW5kbGVyXG4gICAgICAgIH0pO1xuICAgICAgICBwcm9taXNlcy5wdXNoKG5ldHdvcmtQcm9taXNlKTtcbiAgICAgICAgY29uc3QgcmVzcG9uc2UgPSBhd2FpdCBoYW5kbGVyLndhaXRVbnRpbCgoYXN5bmMgKCk9PntcbiAgICAgICAgICAgIHJldHVybiBhd2FpdCBoYW5kbGVyLndhaXRVbnRpbChQcm9taXNlLnJhY2UocHJvbWlzZXMpKSB8fCBhd2FpdCBuZXR3b3JrUHJvbWlzZTtcbiAgICAgICAgfSkoKSk7XG4gICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgIGxvZ2dlci5ncm91cENvbGxhcHNlZChtZXNzYWdlcy5zdHJhdGVneVN0YXJ0KHRoaXMuY29uc3RydWN0b3IubmFtZSwgcmVxdWVzdCkpO1xuICAgICAgICAgICAgZm9yIChjb25zdCBsb2cgb2YgbG9ncyl7XG4gICAgICAgICAgICAgICAgbG9nZ2VyLmxvZyhsb2cpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbWVzc2FnZXMucHJpbnRGaW5hbFJlc3BvbnNlKHJlc3BvbnNlKTtcbiAgICAgICAgICAgIGxvZ2dlci5ncm91cEVuZCgpO1xuICAgICAgICB9XG4gICAgICAgIGlmICghcmVzcG9uc2UpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBTZXJ3aXN0RXJyb3IoXCJuby1yZXNwb25zZVwiLCB7XG4gICAgICAgICAgICAgICAgdXJsOiByZXF1ZXN0LnVybFxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlc3BvbnNlO1xuICAgIH1cbiAgICBfZ2V0VGltZW91dFByb21pc2UoeyByZXF1ZXN0LCBsb2dzLCBoYW5kbGVyIH0pIHtcbiAgICAgICAgbGV0IHRpbWVvdXRJZDtcbiAgICAgICAgY29uc3QgdGltZW91dFByb21pc2UgPSBuZXcgUHJvbWlzZSgocmVzb2x2ZSk9PntcbiAgICAgICAgICAgIGNvbnN0IG9uTmV0d29ya1RpbWVvdXQgPSBhc3luYyAoKT0+e1xuICAgICAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgbG9ncy5wdXNoKGBUaW1pbmcgb3V0IHRoZSBuZXR3b3JrIHJlc3BvbnNlIGF0ICR7dGhpcy5fbmV0d29ya1RpbWVvdXRTZWNvbmRzfSBzZWNvbmRzLmApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXNvbHZlKGF3YWl0IGhhbmRsZXIuY2FjaGVNYXRjaChyZXF1ZXN0KSk7XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgdGltZW91dElkID0gc2V0VGltZW91dChvbk5ldHdvcmtUaW1lb3V0LCB0aGlzLl9uZXR3b3JrVGltZW91dFNlY29uZHMgKiAxMDAwKTtcbiAgICAgICAgfSk7XG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICBwcm9taXNlOiB0aW1lb3V0UHJvbWlzZSxcbiAgICAgICAgICAgIGlkOiB0aW1lb3V0SWRcbiAgICAgICAgfTtcbiAgICB9XG4gICAgYXN5bmMgX2dldE5ldHdvcmtQcm9taXNlKHsgdGltZW91dElkLCByZXF1ZXN0LCBsb2dzLCBoYW5kbGVyIH0pIHtcbiAgICAgICAgbGV0IGVycm9yID0gdW5kZWZpbmVkO1xuICAgICAgICBsZXQgcmVzcG9uc2UgPSB1bmRlZmluZWQ7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IGhhbmRsZXIuZmV0Y2hBbmRDYWNoZVB1dChyZXF1ZXN0KTtcbiAgICAgICAgfSBjYXRjaCAoZmV0Y2hFcnJvcikge1xuICAgICAgICAgICAgaWYgKGZldGNoRXJyb3IgaW5zdGFuY2VvZiBFcnJvcikge1xuICAgICAgICAgICAgICAgIGVycm9yID0gZmV0Y2hFcnJvcjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAodGltZW91dElkKSB7XG4gICAgICAgICAgICBjbGVhclRpbWVvdXQodGltZW91dElkKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBpZiAocmVzcG9uc2UpIHtcbiAgICAgICAgICAgICAgICBsb2dzLnB1c2goXCJHb3QgcmVzcG9uc2UgZnJvbSBuZXR3b3JrLlwiKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgbG9ncy5wdXNoKFwiVW5hYmxlIHRvIGdldCBhIHJlc3BvbnNlIGZyb20gdGhlIG5ldHdvcmsuIFdpbGwgcmVzcG9uZCBcIiArIFwid2l0aCBhIGNhY2hlZCByZXNwb25zZS5cIik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGVycm9yIHx8ICFyZXNwb25zZSkge1xuICAgICAgICAgICAgcmVzcG9uc2UgPSBhd2FpdCBoYW5kbGVyLmNhY2hlTWF0Y2gocmVxdWVzdCk7XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbn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FuZGxlXCIsXG4gICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcInJlcXVlc3RcIlxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgbGV0IGVycm9yID0gdW5kZWZpbmVkO1xuICAgICAgICBsZXQgcmVzcG9uc2U7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBjb25zdCBwcm9taXNlcyA9IFtcbiAgICAgICAgICAgICAgICBoYW5kbGVyLmZldGNoKHJlcXVlc3QpXG4gICAgICAgICAgICBdO1xuICAgICAgICAgICAgaWYgKHRoaXMuX25ldHdvcmtUaW1lb3V0U2Vjb25kcykge1xuICAgICAgICAgICAgICAgIGNvbnN0IHRpbWVvdXRQcm9taXNlID0gdGltZW91dCh0aGlzLl9uZXR3b3JrVGltZW91dFNlY29uZHMgKiAxMDAwKTtcbiAgICAgICAgICAgICAgICBwcm9taXNlcy5wdXNoKHRpbWVvdXRQcm9taXNlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJlc3BvbnNlID0gYXdhaXQgUHJvbWlzZS5yYWNlKHByb21pc2VzKTtcbiAgICAgICAgICAgIGlmICghcmVzcG9uc2UpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYFRpbWVkIG91dCB0aGUgbmV0d29yayByZXNwb25zZSBhZnRlciAke3RoaXMuX25ldHdvcmtUaW1lb3V0U2Vjb25kc30gc2Vjb25kcy5gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgICBpZiAoZXJyIGluc3RhbmNlb2YgRXJyb3IpIHtcbiAgICAgICAgICAgICAgICBlcnJvciA9IGVycjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBDb2xsYXBzZWQobWVzc2FnZXMuc3RyYXRlZ3lTdGFydCh0aGlzLmNvbnN0cnVjdG9yLm5hbWUsIHJlcXVlc3QpKTtcbiAgICAgICAgICAgIGlmIChyZXNwb25zZSkge1xuICAgICAgICAgICAgICAgIGxvZ2dlci5sb2coXCJHb3QgcmVzcG9uc2UgZnJvbSBuZXR3b3JrLlwiKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgbG9nZ2VyLmxvZyhcIlVuYWJsZSB0byBnZXQgYSByZXNwb25zZSBmcm9tIHRoZSBuZXR3b3JrLlwiKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG1lc3NhZ2VzLnByaW50RmluYWxSZXNwb25zZShyZXNwb25zZSk7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBFbmQoKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIXJlc3BvbnNlKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwibm8tcmVzcG9uc2VcIiwge1xuICAgICAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXG4gICAgICAgICAgICAgICAgZXJyb3JcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXNwb25zZTtcbiAgICB9XG59XG5cbmV4cG9ydCB7IE5ldHdvcmtPbmx5IGFzIE4sIE5ldHdvcmtGaXJzdCBhcyBhLCBjYWNoZU9rQW5kT3BhcXVlUGx1Z2luIGFzIGMsIG1lc3NhZ2VzIGFzIG0gfTtcbiJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vQHNlcndpc3Qrc3dAOS4wLjAtcHJldmlldy4yMV90eXBlc2NyaXB0QDUuNC41L25vZGVfbW9kdWxlcy9Ac2Vyd2lzdC9zdy9kaXN0L2NodW5rcy9QcmVjYWNoZUZhbGxiYWNrUGx1Z2luLmpzIiwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7O0FBQXlHO0FBQzlCO0FBQ0o7QUFDMUM7QUFDMEQ7O0FBRXZGO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0Es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pZXMpe1xuICAgICAgICAgICAgaWYgKHJlcXVlc3RbcHJvcF0gIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgIHJlcXVlc3REYXRhW3Byb3BdID0gcmVxdWVzdFtwcm9wXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbmV3IFN0b3JhYmxlUmVxdWVzdChyZXF1ZXN0RGF0YSk7XG4gICAgfVxuICAgIGNvbnN0cnVjdG9yKHJlcXVlc3REYXRhKXtcbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgYXNzZXJ0LmlzVHlwZShyZXF1ZXN0RGF0YSwgXCJvYmplY3RcIiwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3Qvc3cvcGx1Z2luc1wiLFxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJTdG9yYWJsZVJlcXVlc3RcIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJjb25zdHJ1Y3RvclwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJyZXF1ZXN0RGF0YVwiXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGFzc2VydC5pc1R5cGUocmVxdWVzdERhdGEudXJsLCBcInN0cmluZ1wiLCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJAc2Vyd2lzdC9zdy9wbHVnaW5zXCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIlN0b3JhYmxlUmVxdWVzdFwiLFxuICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcImNvbnN0cnVjdG9yXCIsXG4gICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcInJlcXVlc3REYXRhLnVybFwiXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAocmVxdWVzdERhdGEubW9kZS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RlclN5bmMoKTtcbiAgICAgICAgfVxuICAgIH1cbiAgICBhc3luYyBfcmVtb3ZlUmVxdWVzdChvcGVyYXRpb24pIHtcbiAgICAgICAgY29uc3Qgbm93ID0gRGF0ZS5ub3coKTtcbiAgICAgICAgbGV0IGVudHJ5O1xuICAgICAgICBzd2l0Y2gob3BlcmF0aW9uKXtcbiAgICAgICAgICAgIGNhc2UgXCJwb3BcIjpcbiAgICAgICAgICAgICAgICBlbnRyeSA9IGF3YWl0IHRoaXMuX3F1ZXVlU3RvcmUucG9wRW50cnkoKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgXCJzaGlmdFwiOlxuICAgICAgICAgICAgICAgIGVudHJ5ID0gYXdhaXQgdGhpcy5fcXVldWVTdG9yZS5zaGlmdEVudHJ5KCk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGVudHJ5KSB7XG4gICAgICAgICAgICBjb25zdCBtYXhSZXRlbnRpb25UaW1lSW5NcyA9IHRoaXMuX21heFJldGVudGlvblRpbWUgKiA2MCAqIDEwMDA7XG4gICAgICAgICAgICBpZiAobm93IC0gZW50cnkudGltZXN0YW1wID4gbWF4UmV0ZW50aW9uVGltZUluTXMpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fcmVtb3ZlUmVxdWVzdChvcGVyYXRpb24pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIGNvbnZlcnRFbnRyeShlbnRyeSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHVuZGVmaW5lZDtcbiAgICB9XG4gICAgYXN5bmMgcmVwbGF5UmVxdWVzdHMoKSB7XG4gICAgICAgIGxldCBlbnRyeSA9IHVuZGVmaW5lZDtcbiAgICAgICAgd2hpbGUoZW50cnkgPSBhd2FpdCB0aGlzLnNoaWZ0UmVxdWVzdCgpKXtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgIC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sb2dnZXIubG9nKGBCYWNrZ3JvdW5kIHN5bmMgZm9yIHRhZyAnJHtldmVudC50YWd9JyBoYXMgYmVlbiByZWNlaXZlZGApO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHN5bmNDb21wbGV0ZSA9IGFzeW5jICgpPT57XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9zeW5jSW5Qcm9ncmVzcyA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgc3luY0Vycm9yID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCB0aGlzLl9vblN5bmMoe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBxdWV1ZTogdGhpc1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXJyb3IgaW5zdGFuY2VvZiBFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzeW5jRXJyb3IgPSBlcnJvcjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgc3luY0Vycm9yO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseXtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5fcmVxdWVzdHNBZGRlZER1cmluZ1N5bmMgJiYgIShzeW5jRXJyb3IgJiYgIWV2ZW50Lmxhc3RDaGFuY2UpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IHRoaXMucmVnaXN0ZXJTeW5jKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3N5bmNJblByb2dyZXNzID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fcmVxdWVzdHNBZGRlZER1cmluZ1N5bmMgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAgICAgZXZlbnQud2FpdFVudGlsKHN5bmNDb21wbGV0ZSgpKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICBsb2dnZXIubG9nKFwiQmFja2dyb3VuZCBzeW5jIHJlcGxheWluZyB3aXRob3V0IGJhY2tncm91bmQgc3luYyBldmVudFwiKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZvaWQgdGhpcy5fb25TeW5jKHtcbiAgICAgICAgICAgICAgICBxdWV1ZTogdGhpc1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgc3RhdGljIGdldCBfcXVldWVOYW1lcygpIHtcbiAgICAgICAgcmV0dXJuIHF1ZXVlTmFtZXM7XG4gICAgfVxufVxuXG5jbGFzcyBCYWNrZ3JvdW5kU3luY1BsdWdpbiB7XG4gICAgX3F1ZXVlO1xuICAgIGNvbnN0cnVjdG9yKG5hbWUsIG9wdGlvbnMpe1xuICAgICAgICB0aGlzLl9xdWV1ZSA9IG5ldyBRdWV1ZShuYW1lLCBvcHRpb25zKTtcbiAgICB9XG4gICAgYXN5bmMgZmV0Y2hEaWRGYWlsKHsgcmVxdWVzdCB9KSB7XG4gICAgICAgIGF3YWl0IHRoaXMuX3F1ZXVlLnB1c2hSZXF1ZXN0KHtcbiAgICAgICAgICAgIHJlcXVlc3RcbiAgICAgICAgfSk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vcmlnaW5hbEhpdFRpbWUgPSB0aW1lc3RhbXAgLSAoTnVtYmVyKHBhcmFtcy5nZXQoXCJxdFwiKSkgfHwgMCk7XG4gICAgICAgICAgICAgICAgY29uc3QgcXVldWVUaW1lID0gRGF0ZS5ub3coKSAtIG9yaWdpbmFsSGl0VGltZTtcbiAgICAgICAgICAgICAgICBwYXJhbXMuc2V0KFwicXRcIiwgU3RyaW5nKHF1ZXVlVGltZSkpO1xuICAgICAgICAgICAgICAgIGlmIChjb25maWcucGFyYW1ldGVyT3ZlcnJpZGVzKSB7XG4gICAgICAgICAgICAgICAgICAgIGZvciAoY29uc3QgcGFyYW0gb2YgT2JqZWN0LmtleXMoY29uZmlnLnBhcmFtZXRlck92ZXJyaWRlcykpe1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgdmFsdWUgPSBjb25maWcucGFyYW1ldGVyT3ZlcnJpZGVzW3BhcmFtXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5zZXQocGFyYW0sIHZhbHVlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAodHlwZW9mIGNvbmZpZy5oaXRGaWx0ZXIgPT09IFwiZnVuY3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICBjb25maWcuaGl0RmlsdGVyLmNhbGwobnVsbCwgcGFyYW1zKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYXdhaXQgZmV0Y2gobmV3IFJlcXVlc3QodXJsLm9yaWdpbiArIHVybC5wYXRobmFtZSwge1xuICAgICAgICAgICAgICAgICAgICBib2R5OiBwYXJhbXMudG9TdHJpbmcoKSxcbiAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiBcIlBPU1RcIixcbiAgICAgICAgICAgICAgICAgICAgbW9kZTogXCJjb3JzXCIsXG4gICAgICAgICAgICAgICAgICAgIGNyZWRlbnRpYWxzOiBcIm9taXRcIixcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJDb250ZW50LVR5cGVcIjogXCJ0ZXh0L3BsYWluXCJcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ2dlci5sb2coYFJlcXVlc3QgZm9yICcke2dldEZyaWVuZGx5VVJMKHVybC5ocmVmKX0nIGhhcyBiZWVuIHJlcGxheWVkYCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgICAgICAgYXdhaXQgcXVldWUudW5zaGlmdFJlcXVlc3QoZW50cnkpO1xuICAgICAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmxvZyhgUmVxdWVzdCBmb3IgJyR7Z2V0RnJpZW5kbHlVUkwodXJsLmhyZWYpfScgZmFpbGVkIHRvIHJlcGxheSwgcHV0dGluZyBpdCBiYWNrIGluIHRoZSBxdWV1ZS5gKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdGhyb3cgZXJyO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgIGxvZ2dlci5sb2coXCJBbGwgR29vZ2xlIEFuYWx5dGljcyByZXF1ZXN0IHN1Y2Nlc3NmdWxseSByZXBsYXllZDsgXCIgKyBcInRoZSBxdWV1ZSBpcyBub3cgZW1wdHkhXCIpO1xuICAgICAgICB9XG4gICAgfTtcbn07XG5jb25zdCBjc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cmFtKSkge1xuICAgICAgICAgICAgICAgIGNvbnN0IGZhbGxiYWNrUmVzcG9uc2UgPSBhd2FpdCB0aGlzLl9wcmVjYWNoZUNvbnRyb2xsZXIubWF0Y2hQcmVjYWNoZShmYWxsYmFjay51cmwpO1xuICAgICAgICAgICAgICAgIGlmIChmYWxsYmFja1Jlc3BvbnNlICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbGxiYWNrUmVzcG9uc2U7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiB1bmRlZmluZWQ7XG4gICAgfVxufVxuXG5leHBvcnQgeyBCYWNrZ3JvdW5kU3luY1BsdWdpbiBhcyBCLCBQcmVjYWNoZUZhbGxiYWNrUGx1Z2luIGFzIFAsIFF1ZXVlIGFzIFEsIFN0b3JhYmxlUmVxdWVzdCBhcyBTLCBRdWV1ZVN0b3JlIGFzIGEsIGluaXRpYWxpemUgYXMgaSB9O1xuIl0sIm5hbWVzIjpbXSwic291cmNlUm9vdCI6IiJ9\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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vQHNlcndpc3Qrc3dAOS4wLjAtcHJldmlldy4yM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R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICBsb2dnZXIubG9nKGBVc2luZyBhIHByZWxvYWRlZCBuYXZpZ2F0aW9uIHJlc3BvbnNlIGZvciAnJHtnZXRGcmllbmRseVVSTChyZXF1ZXN0LnVybCl9J2ApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gcG9zc2libGVQcmVsb2FkUmVzcG9uc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgY29uc3Qgb3JpZ2luYWxSZXF1ZXN0ID0gdGhpcy5oYXNDYWxsYmFjayhcImZldGNoRGlkRmFpbFwiKSA/IHJlcXVlc3QuY2xvbmUoKSA6IG51bGw7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBmb3IgKGNvbnN0IGNiIG9mIHRoaXMuaXRlcmF0ZUNhbGxiYWNrcyhcInJlcXVlc3RXaWxsRmV0Y2hcIikpe1xuICAgICAgICAgICAgICAgIHJlcXVlc3QgPSBhd2FpdCBjYih7XG4gICAgICAgICAgICAgICAgICAgIHJlcXVlc3Q6IHJlcXVlc3QuY2xvbmUoKSxcbiAgICAgICAgICAgICAgICAgICAgZXZlbnRcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgICBpZiAoZXJyIGluc3RhbmNlb2YgRXJyb3IpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwicGx1Z2luLWVycm9yLXJlcXVlc3Qtd2lsbC1mZXRjaFwiLCB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93bkVycm9yTWVzc2FnZTogZXJyLm1lc3NhZ2VcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBjb25zdCBwbHVnaW5GaWx0ZXJlZFJlcXVlc3QgPSByZXF1ZXN0LmNsb25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mxvZyhgTmV0d29yayByZXF1ZXN0IGZvciAnJHtnZXRGcmllbmRseVVSTChyZXF1ZXN0LnVybCl9JyB0aHJldyBhbiBlcnJvci5gLCBlcnJvcik7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAob3JpZ2luYWxSZXF1ZXN0KSB7XG4gICAgICAgICAgICAgICAgYXdhaXQgdGhpcy5ydW5DYWxsYmFja3MoXCJmZXRjaERpZEZhaWxcIiwge1xuICAgICAgICAgICAgICAgICAgICBlcnJvcjogZXJyb3IsXG4gICAgICAgICAgICAgICAgICAgIGV2ZW50LFxuICAgICAgICAgICAgICAgICAgICBvcmlnaW5hbFJlcXVlc3Q6IG9yaWdpbmFsUmVxdWVzdC5jbG9uZSgpLFxuICAgICAgICAgICAgICAgICAgICByZXF1ZXN0OiBwbHVnaW5GaWx0ZXJlZFJlcXVlc3QuY2xvbmUoKVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhyb3cgZXJyb3I7XG4gICAgICAgIH1cbiAgICB9XG4gICAgYXN5bmMgZmV0Y2hBbmRDYWNoZVB1dChpbnB1dCkge1xuICAgICAgICBjb25zdCByZXNwb25zZSA9IGF3YWl0IHRoaXMuZmV0Y2goaW5wdXQpO1xuICAgICAgICBjb25zdCByZXNwb25zZUNsb25lID0gcmVzcG9uc2UuY2xvbmUoKTtcbiAgICAgICAgdm9pZCB0aGlzLndhaXRVbnRpbCh0aGlzLmNhY2hlUHV0KGlucHV0LCByZXNwb25zZUNsb25lKSk7XG4gICAgICAgIHJldHVybiByZXNwb25zZTtcbiAgICB9XG4gICAgYXN5bmMgY2FjaGVNYXRjaChrZXkpIHtcbiAgICAgICAgY29uc3QgcmVxdWVzdCA9IHRvUmVxdWVzdChrZXkpO1xuICAgICAgICBsZXQgY2FjaGVkUmVzcG9uc2U7XG4gICAgICAgIGNvbnN0IHsgY2FjaGVOYW1lLCBtYXRjaE9wdGlvbnMgfSA9IHRoaXMuX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WNrKHBhcmFtKTtcbiAgICAgICAgfVxuICAgIH1cbiAgICAqaXRlcmF0ZUNhbGxiYWNrcyhuYW1lKSB7XG4gICAgICAgIGZvciAoY29uc3QgcGx1Z2luIG9mIHRoaXMuX3N0cmF0ZWd5LnBsdWdpbnMpe1xuICAgICAgICAgICAgaWYgKHR5cGVvZiBwbHVnaW5bbmFtZV0gPT09IFwiZnVuY3Rpb25cIikge1xuICAgICAgICAgICAgICAgIGNvbnN0IHN0YXRlID0gdGhpcy5fcGx1Z2luU3RhdGVNYXAuZ2V0KHBsdWdpbik7XG4gICAgICAgICAgICAgICAgY29uc3Qgc3RhdGVmdWxDYWxsYmFjayA9IChwYXJhbSk9PntcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RhdGVmdWxQYXJhbSA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC4uLnBhcmFtLFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGVcbiAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBsdWdpbltuYW1lXShzdGF0ZWZ1bFBhcmFtKTtcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIHlpZWxkIHN0YXRlZnVsQ2FsbGJhY2s7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG4gICAgd2FpdFVudGlsKHByb21pc2UpIHtcbiAgICAgICAgdGhpcy5fZXh0ZW5kTGlmZXRpbWVQcm9taXNlcy5wdXNoKHByb21pc2UpO1xuICAgICAgICByZXR1cm4gcHJvbWlzZTtcbiAgICB9XG4gICAgYXN5bmMgZG9uZVdhaXRpbmcoKSB7XG4gICAgICAgIGxldCBwcm9taXNlID0gdW5kZWZpbmVkO1xuICAgICAgICB3aGlsZShwcm9taXNlID0gdGhpcy5fZXh0ZW5kTGlmZXRpbWVQcm9taXNlcy5zaGlmdCgpKXtcbiAgICAgICAgICAgIGF3YWl0IHByb21pc2U7XG4gICAgICAgI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gICAgICAgICAgZXZlbnQsXG4gICAgICAgICAgICByZXF1ZXN0XG4gICAgICAgIH0pO1xuICAgICAgICBjb25zdCByZXNwb25zZURvbmUgPSB0aGlzLl9nZXRSZXNwb25zZShoYW5kbGVyLCByZXF1ZXN0LCBldmVudCk7XG4gICAgICAgIGNvbnN0IGhhbmRsZXJEb25lID0gdGhpcy5fYXdhaXRDb21wbGV0ZShyZXNwb25zZURvbmUsIGhhbmRsZXIsIHJlcXVlc3QsIGV2ZW50KTtcbiAgICAgICAgcmV0dXJuIFtcbiAgICAgICAgICAgIHJlc3BvbnNlRG9uZSxcbiAgICAgICAgICAgIGhhbmRsZXJEb25lXG4gICAgICAgIF07XG4gICAgfVxuICAgIGFzeW5jIF9nZXRSZXNwb25zZShoYW5kbGVyLCByZXF1ZXN0LCBldmVudCkge1xuICAgICAgICBhd2FpdCBoYW5kbGVyLnJ1bkNhbGxiYWNrcyhcImhhbmRsZXJXaWxsU3RhcnRcIiwge1xuICAgICAgICAgICAgZXZlbnQsXG4gICAgICAgICAgICByZXF1ZXN0XG4gICAgICAgIH0pO1xuICAgICAgICBsZXQgcmVzcG9uc2UgPSB1bmRlZmluZWQ7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IHRoaXMuX2hhbmRsZShyZXF1ZXN0LCBoYW5kbGVyKTtcbiAgICAgICAgICAgIGlmIChyZXNwb25zZSA9PT0gdW5kZWZpbmVkIHx8IHJlc3BvbnNlLnR5cGUgPT09IFwiZXJyb3JcIikge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBTZXJ3aXN0RXJyb3IoXCJuby1yZXNwb25zZVwiLCB7XG4gICAgICAgICAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmxcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgIGlmIChlcnJvciBpbnN0YW5jZW9mIEVycm9yKSB7XG4gICAgICAgICAgICAgICAgZm9yIChjb25zdCBjYWxsYmFjayBvZiBoYW5kbGVyLml0ZXJhdGVDYWxsYmFja3MoXCJoYW5kbGVyRGlkRXJyb3JcIikpe1xuICAgICAgICAgICAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IGNhbGxiYWNrKHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yLFxuICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQsXG4gICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2UgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoIXJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgZXJyb3I7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbG9nZ2VyLmxvZyhgV2hpbGUgcmVzcG9uZGluZyB0byAnJHtnZXRGcmllbmRseVVSTChyZXF1ZXN0LnVybCl9JywgYW4gJHtlcnJvciBpbnN0YW5jZW9mIEVycm9yID8gZXJyb3IudG9TdHJpbmcoKSA6IFwiXCJ9IGVycm9yIG9jY3VycmVkLiBVc2luZyBhIGZhbGxiYWNrIHJlc3BvbnNlIHByb3ZpZGVkIGJ5IGEgaGFuZGxlckRpZEVycm9yIHBsdWdpbi5gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBmb3IgKGNvbnN0IGNhbGxiYWNrIG9mIGhhbmRsZXIuaXRlcmF0ZUNhbGxiYWNrcyhcImhhbmRsZXJXaWxsUmVzcG9uZFwiKSl7XG4gICAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IGNhbGxiYWNrKHtcbiAgICAgICAgICAgICAgICBldmVudCxcbiAgICAgICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgICAgIHJlc3BvbnNlXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmVzcG9uc2U7XG4gICAgfVxuICAgIGFzeW5jIF9hd2FpdENvbXBsZXRlKHJlc3BvbnNlRG9uZSwgaGFuZGxlciwgcmVxdWVzdCwgZXZlbnQpIHtcbiAgICAgICAgbGV0IHJlc3BvbnNlID0gdW5kZWZpbmVkO1xuICAgICAgICBsZXQgZXJyb3IgPSB1bmRlZmluZWQ7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IHJlc3BvbnNlRG9uZTtcbiAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHt9XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBhd2FpdCBoYW5kbGVyLnJ1bkNhbGxiYWNrcyhcImhhbmRsZXJEaWRSZXNwb25kXCIsIHtcbiAgICAgICAgICAgICAgICBldmVudCxcbiAgICAgICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgICAgIHJlc3BvbnNlXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGF3YWl0IGhhbmRsZXIuZG9uZVdhaXRpbmcoKTtcbiAgICAgICAgfSBjYXRjaCAod2FpdFVudGlsRXJyb3IpIHtcbiAgICAgICAgICAgIGlmICh3YWl0VW50aWxFcnJvciBpbnN0YW5jZW9mIEVycm9yKSB7XG4gICAgICAgICAgICAgICAgZXJyb3IgPSB3YWl0VW50aWxFcnJvcjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBhd2FpdCBoYW5kbGVyLnJ1bkNhbGxiYWNrcyhcImhhbmRsZXJEaWRDb21wbGV0ZVwiLCB7XG4gICAgICAgICAgICBldmVudCxcbiAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICByZXNwb25zZSxcbiAgICAgICAgICAgIGVycm9yXG4gICAgICAgIH0pO1xuICAgICAgICBoYW5kbGVyLmRlc3Ryb3koKTtcbiAgICAgICAgaWYgKGVycm9yKSB7XG4gICAgICAgICAgICB0aHJvdyBlcnJvcjtcbiAgICAgICAgfVxuICAgIH1cbn1cblxuZXhwb3J0IHsgU3RyYXRlZ3kgYXMgUywgU3RyYXRlZ3lIYW5kbGVyIGFzIGEgfTtcbiJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vQHNlcndpc3Qrc3dAOS4wLjAtcHJldmlldy4yMV90eXBlc2NyaXB0QDUuNC41L25vZGVfbW9kdWxlcy9Ac2Vyd2lzdC9zdy9kaXN0L2NodW5rcy9zaW5nbGV0b25QcmVjYWNoZUNvbnRyb2xsZXIuanMiLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFvSDtBQUN2RTtBQUNDOztBQUU5QztBQUNBO0FBQ0E7QUFDQTtBQUNBLFNBQVM7QUFDVDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsYUFBYTtBQUNiO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsS0FBSztBQUNMO0FBQ0E7QUFDQTs7QUFFQSwrQkFBK0IsMkNBQVE7QUFDdkM7QUFDQTtBQUNBLGlDQUFpQyxVQUFVO0FBQzNDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsaUNBQWlDLFVBQVU7QUFDM0MsK0NBQStDLDJEQUFZO0FBQzNEO0FBQ0E7QUFDQSw0QkFBNEI7QUFDNUIsNEJBQTRCLHFFQUFpQjtBQUM3QztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ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VzdC51cmw7XG4gICAgICAgICAgICAgICAgaWYgKGNhY2hlZFJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubm90VXBkYXRlZFVSTHMucHVzaCh1cmwpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMudXBkYXRlZFVSTHMucHVzaCh1cmwpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gY2FjaGVkUmVzcG9uc2U7XG4gICAgfTtcbn1cblxuY29uc3QgUkVWSVNJT05fU0VBUkNIX1BBUkFNID0gXCJfX1dCX1JFVklTSU9OX19cIjtcbmZ1bmN0aW9uIGNyZWF0ZUNhY2hlS2V5KGVudHJ5KSB7XG4gICAgaWYgKCFlbnRyeSkge1xuICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwiYWRkLXRvLWNhY2hlLWxpc3QtdW5leHBlY3RlZC10eXBlXCIsIHtcbiAgICAgICAgICAgIGVudHJ5XG4gICAgICAgIH0pO1xuICAgIH1cbiAgICBpZiAodHlwZW9mIGVudHJ5ID09PSBcInN0cmluZ1wiKSB7XG4gICAgICAgIGNvbnN0IHVybE9iamVjdCA9IG5ldyBVUkwoZW50cnksIGxvY2F0aW9uLmhyZWYpO1xuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgY2FjaGVLZXk6IHVybE9iamVjdC5ocmVmLFxuICAgICAgICAgICAgdXJsOiB1cmxPYmplY3QuaHJlZlxuICAgICAgICB9O1xuICAgIH1cbiAgICBjb25zdCB7IHJldmlzaW9uLCB1cmwgfSA9IGVudHJ5O1xuICAgIGlmICghdXJsKSB7XG4gICAgICAgIHRocm93IG5ldyBTZXJ3aXN0RXJyb3IoXCJhZGQtdG8tY2FjaGUtbGlzdC11bmV4cGVjdGVkLXR5cGVcIiwge1xuICAgICAgICAgICAgZW50cnlcbiAgICAgICAgfSk7X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b2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgYXNzZXJ0LmlzQXJyYXkoZW50cmllcywge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3QvcHJlY2FjaGluZ1wiLFxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJQcmVjYWNoZUNvbnRyb2xsZXJcIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJhZGRUb0NhY2hlTGlzdFwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJlbnRyaWVzXCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IHVybHNUb1dhcm5BYm91dCA9IFtdO1xuICAgICAgICBmb3IgKGNvbnN0IGVudHJ5IG9mIGVudHJpZXMpe1xuICAgICAgICAgICAgaWYgKHR5cGVvZiBlbnRyeSA9PT0gXCJzdHJpbmdcIikge1xuICAgICAgICAgICAgICAgIHVybHNUb1dhcm5BYm91dC5wdXNoKGVudHJ5KTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoZW50cnkgJiYgIWVudHJ5LmludGVncml0eSAmJiBlbnRyeS5yZXZpc2lvbiA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgdXJsc1RvV2FybkFib3V0LnB1c2goZW50cnkudXJsKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvbnN0IHsgY2FjaGVLZXksIHVybCB9ID0gY3JlYXRlQ2FjaGVLZXkoZW50cnkpO1xuICAgICAgICAgICAgY29uc3QgY2FjaGVNb2RlID0gdHlwZW9mIGVudHJ5ICE9PSBcInN0cmluZ1wiICYmIGVudHJ5LnJldmlzaW9uID8gXCJyZWxvYWRcIiA6IFwiZGVmYXVsdFwiO1xuICAgICAgICAgICAgaWYgKHRoaXMuX3VybHNUb0NhY2hlS2V5cy5oYXModXJsKSAmJiB0aGlzLl91cmxzVG9DYWNoZUtleXMuZ2V0KHVybCkgIT09IG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ncml0aWVzLmdldChjYWNoZUtleSk7XG4gICAgICAgICAgICAgICAgY29uc3QgY2FjaGVNb2RlID0gdGhpcy5fdXJsc1RvQ2FjaGVNb2Rlcy5nZXQodXJsKTtcbiAgICAgICAgICAgICAgICBjb25zdCByZXF1ZXN0ID0gbmV3IFJlcXVlc3QodXJsLCB7XG4gICAgICAgICAgICAgICAgICAgIGludGVncml0eSxcbiAgICAgICAgICAgICAgICAgICAgY2FjaGU6IGNhY2hlTW9kZSxcbiAgICAgICAgICAgICAgICAgICAgY3JlZGVudGlhbHM6IFwic2FtZS1vcmlnaW5cIlxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIGF3YWl0IFByb21pc2UuYWxsKHRoaXMuc3RyYXRlZ3kuaGFuZGxlQWxsKHtcbiAgICAgICAgICAgICAgICAgICAgZXZlbnQsXG4gICAgICAgICAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICAgICAgICAgIHVybDogbmV3IFVSTChyZXF1ZXN0LnVybCksXG4gICAgICAgICAgICAgICAgICAgIHBhcmFtczoge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2FjaGVLZXlcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgY29uc3QgeyB1cGRhdGVkVVJMcywgbm90VXBkYXRlZFVSTHMgfSA9IGluc3RhbGxSZXBvcnRQbHVnaW47XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgcHJpbnRJbnN0YWxsRGV0YWlscyh1cGRhdGVkVVJMcywgbm90VXBkYXRlZFVSTHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICB1cGRhdGVkVVJMcyxcbiAgICAgICAgICAgICAgICBub3RVcGRhdGVkVVJMc1xuICAgICAgICAgICAgfTtcbiAgICAgICAgfSk7XG4gICAgfVxuICAgIGFjdGl2YXRlKGV2ZW50KSB7XG4gICAgICAgIHJldHVybiB3YWl0VW50aWwoZXZlbnQsIGFzeW5jICgpPT57XG4gICAgICAgICAgICBjb25zdCBjYWNoZSA9IGF3YWl0IHNlbGYuY2FjaGVzLm9wZW4odGhpcy5zdHJhdGVneS5jYWNoZU5hbWUpO1xuICAgICAgICAgICAgY29uc3QgY3VycmVudGx5Q2FjaGVkUmVxdWVzdHMgPSBhd2FpdCBjYWNoZS5rZXlzKCk7XG4gICAgICAgICAgICBjb25zdCBleHBlY3RlZENhY2hlS2V5cyA9IG5ldyBTZXQodGhpcy5fdXJsc1RvQ2FjaGVLZXlzLnZhbHVlcygpKTtcbiAgICAgICAgICAgIGNvbnN0IGRlbGV0ZWRDYWNoZVJlcXVlc3RzID0gW107XG4gICAgICAgICAgICBmb3IgKGNvbnN0IHJlcXVlc3Qgb2YgY3VycmVudGx5Q2FjaGVkUmVxdWVzdHMpe1xuICAgICAgICAgICAgICAgIGlmICghZXhwZWN0ZWRDYWNoZUtleXMuaGFzKHJlcXVlc3QudXJsKSkge1xuICAgICAgICAgICAgICAgICAgICBhd2FpdCBjYWNoZS5kZWxldGUocmVxdWVzdCk7XG4gICAgICAgICAgICAgICAgICAgIGRlbGV0ZWRDYWNoZVJlcXVlc3RzLnB1c2gocmVxdWVzdC51cmwpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICBwcmludENsZWFudXBEZXRhaWxzKGRlbGV0ZWRDYWNoZVJlcXVlc3RzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgZGVsZXRlZENhY2hlUmVxdWVzdHNcbiAgICAgICAgICAgIH07XG4gIC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m91bmRUb1VSTCh1cmwpIHtcbiAgICAgICAgY29uc3QgY2FjaGVLZXkgPSB0aGlzLmdldENhY2hlS2V5Rm9yVVJMKHVybCk7XG4gICAgICAgIGlmICghY2FjaGVLZXkpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBTZXJ3aXN0RXJyb3IoXCJub24tcHJlY2FjaGVkLXVybFwiLCB7XG4gICAgICAgICAgICAgICAgdXJsXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gKG9wdGlvbnMpPT57XG4gICAgICAgICAgICBvcHRpb25zLnJlcXVlc3QgPSBuZXcgUmVxdWVzdCh1cmwpO1xuICAgICAgICAgICAgb3B0aW9ucy5wYXJhbXMgPSB7XG4gICAgICAgICAgICAgICAgY2FjaGVLZXksXG4gICAgICAgICAgICAgICAgLi4ub3B0aW9ucy5wYXJhbXNcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5zdHJhdGVneS5oYW5kbGUob3B0aW9ucyk7XG4gICAgICAgIH07XG4gICAgfVxufVxuXG5sZXQgZGVmYXVsdFByZWNhY2hlQ29udHJvbGxlciA9IHVuZGVmaW5lZDtcbmNvbnN0IGdldFNpbmdsZXRvblByZWNhY2hlQ29udHJvbGxlciA9ICgpPT57XG4gICAgaWYgKCFkZWZhdWx0UHJlY2FjaGVDb250cm9sbGVyKSB7XG4gICAgICAgIGRlZmF1bHRQcmVjYWNoZUNvbnRyb2xsZXIgPSBuZXcgUHJlY2FjaGVDb250cm9sbGVyKCk7XG4gICAgfVxuICAgIHJldHVybiBkZWZhdWx0UHJlY2FjaGVDb250cm9sbGVyO1xufTtcbmNvbnN0IHNldFNpbmdsZXRvblByZWNhY2hlQ29udHJvbGxlciA9IChwcmVjYWNoZUNvbnRyb2xsZXIpPT57XG4gICAgZGVmYXVsdFByZWNhY2hlQ29udHJvbGxlciA9IHByZWNhY2hlQ29udHJvbGxlcjtcbiAgICByZXR1cm4gZGVmYXVsdFByZWNhY2hlQ29udHJvbGxlcjtcbn07XG5cbmV4cG9ydCB7IFByZWNhY2hlQ29udHJvbGxlciBhcyBQLCBQcmVjYWNoZVN0cmF0ZWd5IGFzIGEsIGdldFNpbmdsZXRvblByZWNhY2hlQ29udHJvbGxlciBhcyBnLCBzZXRTaW5nbGV0b25QcmVjYWNoZUNvbnRyb2xsZXIgYXMgcyB9O1xuIl0sIm5hbWVzIjpbXSwic291cmNlUm9vdCI6IiJ9\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,eyJ2ZXJzaW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W5kbGVyID0gbnVsbDtcbiAgICAgICAgfVxuICAgIH1cbiAgICBhZGRDYWNoZUxpc3RlbmVyKCkge1xuICAgICAgICBpZiAoIXRoaXMuX2NhY2hlTGlzdGVuZXJIYW5kbGVyKSB7XG4gICAgICAgICAgICB0aGlzLl9jYWNoZUxpc3RlbmVySGFuZGxlciA9IChldmVudCk9PntcbiAgICAgICAgICAgICAgICBpZiAoZXZlbnQuZGF0YSAmJiBldmVudC5kYXRhLnR5cGUgPT09IFwiQ0FDSEVfVVJMU1wiKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHsgcGF5bG9hZCB9ID0gZXZlbnQuZGF0YTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmRlYnVnKFwiQ2FjaGluZyBVUkxzIGZyb20gdGhlIHdpbmRvd1wiLCBwYXlsb2FkLnVybHNUb0NhY2hlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBjb25zdCByZXF1ZXN0UHJvbWlzZXMgPSBQcm9taXNlLmFsbChwYXlsb2FkLnVybHNUb0NhY2hlLm1hcCgoZW50cnkpPT57XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIGVudHJ5ID09PSBcInN0cmluZ1wiKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZW50cnkgPSBbXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudHJ5XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHJlcXVlc3QgPSBuZXcgUmVxdWVzdCguLi5lbnRyeSk7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5oYW5kbGVSZXF1ZXN0KHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50XG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgICAgICAgICBldmVudC53YWl0VW50aWwocmVxdWVzdFByb21pc2VzKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGV2ZW50LnBvcnRzPy5bMF0pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgcmVxdWVzdFByb21pc2VzLnRoZW4oKCk9PmV2ZW50LnBvcnRzWzBdLnBvc3RNZXNzYWdlKHRydWUpKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBzZWxmLmFkZEV2ZW50TGlzdGVuZXIoXCJtZXNzYWdlXCIsIHRoaXMuX2NhY2hlTGlzdGVuZXJIYW5kbGVyKTtcbiAgICAgICAgfVxuICAgIH1cbiAgICByZW1vdmVDYWNoZUxpc3RlbmVyKCkge1xuICAgICAgICBpZiAodGhpcy5fY2FjaGVMaXN0ZW5lckhhbmRsZXIpIHtcbiAgICAgICAgICAgIHNlbGYucmVtb3ZlRXZlbnRMaXN0ZW5lcihcIm1lc3NhZ2VcIiwgdGhpcy5fY2FjaGVMaXN0ZW5lckhhbmRsZXIpO1xuICAgICAgICB9XG4gICAgfVxuICAgIGhhbmRsZVJlcXVlc3QoeyByZXF1ZXN0LCBldmVudCB9KSB7XG4gICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgIGFzc2VydC5pc0luc3RhbmNlKHJlcXVlc3QsIFJlcXVlc3QsIHtcbiAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiBcIkBzZXJ3aXN0L3JvdXRpbmdcIixcbiAgICAgICAgICAgICAgICBjbGFzc05hbWU6IFwiUm91dGVyXCIsXG4gICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiaGFuZGxlUmVxdWVzdFwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJvcHRpb25zLnJlcXVlc3RcIlxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgdXJsID0gbmV3IFVSTChyZXF1ZXN0LnVybCwgbG9jYXRpb24uaHJlZik7XG4gICAgICAgIGlmICghdXJsLnByb3RvY29sLnN0YXJ0c1dpdGgoXCJodHRwXCIpKSB7XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgbG9nZ2VyLmRlYnVnKFwiUm91dGVyIG9ubHkgc3VwcG9ydHMgVVJMcyB0aGF0IHN0YXJ0IHdpdGggJ2h0dHAnLlwiKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCBzYW1lT3JpZ2luID0gdXJsLm9yaWdpbiA9PT0gbG9jYXRpb24ub3JpZ2luO1xuICAgICAgICBjb25zdCB7IHBhcmFtcywgcm91dGUgfSA9IHRoaXMuZmluZE1hdGNoaW5nUm91dGUoe1xuICAgICAgICAgICAgZXZlbnQsXG4gICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgc2FtZU9yaWdpbixcbiAgICAgICAgICAgIHVybFxuICAgICAgICB9KTtcbiAgICAgICAgbGV0IGhhbmRsZXIgPSByb3V0ZT8uaGFuZGxlcjtcbiAgICAgICAgY29uc3QgZGVidWdNZXNzYWdlcyA9IFtdO1xuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBpZiAoaGFuZGxlcikge1xuICAgICAgICAgICAgICAgIGRlYnVnTWVzc2FnZXMucHVzaChbXG4gICAgICAgICAgICAgICAgICAgIFwiRm91bmQgYSByb3V0ZSB0byBoYW5kbGUgdGhpcyByZXF1ZXN0OlwiLFxuICAgICAgICAgICAgICAgICAgICByb3V0ZVxuICAgICAgICAgICAgICAgIF0pO1xuICAgICAgICAgICAgICAgIGlmIChwYXJhbXMpIHtcbiAgICAgICAgICAgICAgICAgICAgZGVidWdNZXNzYWdlcy5wdXNoKFtcbiAgICAgICAgICAgICAgICAgICAgICAgIGBQYXNzaW5nIHRoZSBmb2xsb3dpbmcgcGFyYW1zIHRvIHRoZSByb3V0ZSdzIGhhbmRsZXI6YCxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtc1xuICAgICAgICAgICAgICAgICAgICBdKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgbWV0aG9kID0gcmVxdWVzdC5tZXRob2Q7XG4gICAgICAgIGlmICghaGFuZGxlciAmJiB0aGlzLl9kZWZhdWx0SGFuZGxlck1hcC5oYXMobWV0aG9kKSkge1xuICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgIGRlYnVnTWVzc2FnZXMucHVzaChgRmFpbGVkIHRvIGZpbmQgYSBtYXRjaGluZyByb3V0ZS4gRmFsbGluZyBiYWNrIHRvIHRoZSBkZWZhdWx0IGhhbmRsZXIgZm9yICR7bWV0aG9kfS5gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGhhbmRsZXIgPSB0aGlzLl9kZWZhdWx0SGFuZGxlck1hcC5nZXQobWV0aG9kKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIWhhbmRsZXIpIHtcbiAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICBsb2dnZXIuZGVidWcoYE5vIHJvdXRlIGZvdW5kIGZvcjogJHtnZXRGcmllbmRseVVSTCh1cmwpfWApO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgIGxvZ2dlci5ncm91cENvbGxhcHNlZChgUm91dGVyIGlzIHJlc3BvbmRpbmcgdG86ICR7Z2V0RnJpZW5kbHlVUkwodXJsKX1gKTtcbiAgICAgICAgICAgIGZvciAoY29uc3QgbXNnIG9mIGRlYnVnTWVzc2FnZXMpe1xuICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KG1zZykpIHtcbiAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmxvZyguLi5tc2cpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ2dlci5sb2cobXNnKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBFbmQoKTtcbiAgICAgICAgfVxuICAgICAgICBsZXQgcmVzcG9uc2VQcm9taXNlO1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgcmVzcG9uc2VQcm9taXNlID0gaGFuZGxlci5oYW5kbGUoe1xuICAgICAgICAgICAgICAgIHVybCxcbiAgICAgICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgICAgIGV2ZW50LFxuICAgICAgICAgICAgICAgIHBhcmFtc1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgcmVzcG9uc2VQcm9taXNlID0gUHJvbWlzZS5yZWplY3QoZXJyKTtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCBjYXRjaEhhbmRsZXIgPSByb3V0ZT8uY2F0Y2hIYW5kbGVyO1xuICAgICAgICBpZiAocmVzcG9uc2VQcm9taXNlIGluc3RhbmNlb2YgUHJvbWlzZSAmJiAodGhpcy5fY2F0Y2hIYW5kbGVyIHx8IGNhdGNoSGFuZGxlcikpIHtcbiAgICAgICAgICAgIHJlc3BvbnNlUHJvbWlzZSA9IHJlc3BvbnNlUHJvbWlzZS5jYXRjaChhc3luYyAoZXJyKT0+e1xuICAgICAgICAgICAgICAgIGlmIChjYXRjaEhhbmRsZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmdyb3VwQ29sbGFwc2VkKGBFcnJvciB0aHJvd24gd2hlbiByZXNwb25kaW5nIHRvOiAgJHtnZXRGcmllbmRseVVSTCh1cmwpfS4gRmFsbGluZyBiYWNrIHRvIHJvdXRlJ3MgQ2F0Y2ggSGFuZGxlci5gKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZ2dlci5lcnJvcihcIkVycm9yIHRocm93biBieTpcIiwgcm91dGUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmVycm9yKGVycik7XG4gICAgICAgICAgICAgICAgICAgICAgICBsb2dnZXIuZ3JvdXBFbmQoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGF3YWl0IGNhdGNoSGFuZGxlci5oYW5kbGUoe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtc1xuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGNhdGNoRXJyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2F0Y2hFcnIgaW5zdGFuY2VvZiBFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IGNhdGNoRXJyO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmICh0aGlzLl9jYXRjaEhhbmRsZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmdyb3VwQ29sbGFwc2VkKGBFcnJvciB0aHJvd24gd2hlbiByZXNwb25kaW5nIHRvOiAgJHtnZXRGcmllbmRseVVSTCh1cmwpfS4gRmFsbGluZyBiYWNrIHRvIGdsb2JhbCBDYXRjaCBIYW5kbGVyLmApO1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmVycm9yKFwiRXJyb3IgdGhyb3duIGJ5OlwiLCByb3V0ZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBsb2dnZXIuZXJyb3IoZXJyKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZ2dlci5ncm91cEVuZCgpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9jYXRjaEhhbmRsZXIuaGFuZGxlKHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybCxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICAgICAgICAgICAgICBldmVudFxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdGhyb3cgZXJyO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlc3BvbnNlUHJvbWlzZTtcbiAgICB9XG4gICAgZmluZE1hdGNoaW5nUm91dGUoeyB1cmwsIHNhbWVPcmlnaW4sIHJlcXVlc3QsIGV2ZW50IH0pIHtcbiAgICAgICAgY29uc3Qgcm91dGVzID0gdGhpcy5fcm91dGVzLmdldChyZXF1ZXN0Lm1ldGhvZCkgfHwgW107XG4gICAgICAgIGZvciAoY29uc3Qgcm91dGUgb2Ygcm91dGVzKXtcbiAgICAgICAgICAgIGxldCBwYXJhbXM7XG4gICAgICAgICAgICBjb25zdCBtYXRjaFJlc3VsdCA9IHJvdXRlLm1hdGNoKHtcbiAgICAgICAgICAgICAgICB1cmwsXG4gICAgICAgICAgICAgICAgc2FtZU9yaWdpbixcbiAgICAgICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgICAgIGV2ZW50XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGlmIChtYXRjaFJlc3VsdCkge1xuICAgICAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG1hdGNoUmVzdWx0IGluc3RhbmNlb2YgUHJvbWlzZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLndhcm4oYFdoaWxlIHJvdXRpbmcgJHtnZXRGcmllbmRseVVSTCh1cmwpfSwgYW4gYXN5bmMgbWF0Y2hDYWxsYmFjayBmdW5jdGlvbiB3YXMgdXNlZC4gUGxlYXNlIGNvbnZlcnQgdGhlIGZvbGxvd2luZyByb3V0ZSB0byB1c2UgYSBzeW5jaHJvbm91cyBtYXRjaENhbGxiYWNrIGZ1bmN0aW9uOmAsIHJvdXRlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBwYXJhbXMgPSBtYXRjaFJlc3VsdDtcbiAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShwYXJhbXMpICYmIHBhcmFtcy5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobWF0Y2hSZXN1bHQuY29uc3RydWN0b3IgPT09IE9iamVjdCAmJiBPYmplY3Qua2V5cyhtYXRjaFJlc3VsdCkubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHBhcmFtcyA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiBtYXRjaFJlc3VsdCA9PT0gXCJib29sZWFuXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgICAgICByb3V0ZSxcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zXG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4ge307XG4gICAgfVxuICAgIHNldERlZmF1bHRIYW5kbGVyKGhhbmRsZXIsIG1ldGhvZCA9IGRlZmF1bHRNZXRob2QpIHtcbiAgICAgICAgdGhpcy5fZGVmYXVsdEhhbmRsZXJNYXAuc2V0KG1ldGhvZCwgbm9ybWFsaXplSGFuZGxlcihoYW5kbGVyKSk7XG4gICAgfVxuICAgIHNldENhdGNoSGFuZGxlcihoYW5kbGVyKSB7XG4gICAgICAgIHRoaXMuX2NhdGNoSGFuZGxlciA9IG5vcm1hbGl6ZUhhbmRsZXIoaGFuZGxlcik7XG4gICAgfVxuICAgIHJlZ2lzdGVyQ2FwdHVyZShjYXB0dXJlLCBoYW5kbGVyLCBtZXRob2QpIHtcbiAgICAgICAgY29uc3Qgcm91dGUgPSBwYXJzZVJvdXRlKGNhcHR1cmUsIGhhbmRsZXIsIG1ldGhvZCk7XG4gICAgICAgIHRoaXMucmVnaXN0ZXJSb3V0ZShyb3V0ZSk7XG4gICAgICAgIHJldHVybiByb3V0ZTtcbiAgICB9XG4gICAgcmVnaXN0ZXJSb3V0ZShyb3V0ZSkge1xuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBhc3NlcnQuaXNUeXBlKHJvdXRlLCBcIm9iamVjdFwiLCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJAc2Vyd2lzdC9yb3V0aW5nXCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIlJvdXRlclwiLFxuICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcInJlZ2lzdGVyUm91dGVcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwicm91dGVcIlxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBhc3NlcnQuaGFzTWV0aG9kKHJvdXRlLCBcIm1hdGNoXCIsIHtcbiAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiBcIkBzZXJ3aXN0L3JvdXRpbmdcIixcbiAgICAgICAgICAgICAgICBjbGFzc05hbWU6IFwiUm91dGVyXCIsXG4gICAgICAgICAgICAgICAgZnVuY05hbWU6IFwicmVnaXN0ZXJSb3V0ZVwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJyb3V0ZVwiXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGFzc2VydC5pc1R5cGUocm91dGUuaGFuZGxlciwgXCJvYmplY3RcIiwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3Qvcm91dGluZ1wiLFxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJSb3V0ZXJcIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJyZWdpc3RlclJvdXRlXCIsXG4gICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcInJvdXRlXCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgYXNzZXJ0Lmhhc01ldGhvZChyb3V0ZS5oYW5kbGVyLCBcImhhbmRsZVwiLCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJAc2Vyd2lzdC9yb3V0aW5nXCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIlJvdXRlclwiLFxuICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcInJlZ2lzdGVyUm91dGVcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwicm91dGUuaGFuZGxlclwiXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGFzc2VydC5pc1R5cGUocm91dGUubWV0aG9kLCBcInN0cmluZ1wiLCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJAc2Vyd2lzdC9yb3V0aW5nXCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIlJvdXRlclwiLFxuICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcInJlZ2lzdGVyUm91dGVcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwicm91dGUubWV0aG9kXCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGlmICghdGhpcy5fcm91dGVzLmhhcyhyb3V0ZS5tZXRob2QpKSB7XG4gICAgICAgICAgICB0aGlzLl9yb3V0ZXMuc2V0KHJvdXRlLm1ldGhvZCwgW10pO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMuX3JvdXRlcy5nZXQocm91dGUubWV0aG9kKS5wdXNoKHJvdXRlKTtcbiAgICB9XG4gICAgdW5yZWdpc3RlclJvdXRlKHJvdXRlKSB7XG4gICAgICAgIGlmICghdGhpcy5fcm91dGVzLmhhcyhyb3V0ZS5tZXRob2QpKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yK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XG4gICAgfVxuICAgIGRlZmF1bHRSb3V0ZXIgPSByb3V0ZXI7XG4gICAgZGVmYXVsdFJvdXRlci5hZGRGZXRjaExpc3RlbmVyKCk7XG4gICAgZGVmYXVsdFJvdXRlci5hZGRDYWNoZUxpc3RlbmVyKCk7XG4gICAgcmV0dXJuIGRlZmF1bHRSb3V0ZXI7XG59O1xuXG5leHBvcnQgeyBSb3V0ZSBhcyBSLCBSZWdFeHBSb3V0ZSBhcyBhLCBSb3V0ZXIgYXMgYiwgZ2V0U2luZ2xldG9uUm91dGVyIGFzIGcsIHBhcnNlUm91dGUgYXMgcCwgc2V0U2luZ2xldG9uUm91dGVyIGFzIHMgfTtcbiJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\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\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XIgcmVzcG9uc2UgZm91bmQgKGFuZCBjYWNoZWQpIGZvcjpcIiwgb3B0aW9ucy5yZXF1ZXN0LnVybCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb25zdCBtZXNzYWdlRGF0YSA9IHtcbiAgICAgICAgICAgICAgICB0eXBlOiBDQUNIRV9VUERBVEVEX01FU1NBR0VfVFlQRSxcbiAgICAgICAgICAgICAgICBtZXRhOiBDQUNIRV9VUERBVEVEX01FU1NBR0VfTUVUQSxcbiAgICAgICAgICAgICAgICBwYXlsb2FkOiB0aGlzLl9nZW5lcmF0ZVBheWxvYWQob3B0aW9ucylcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBpZiAob3B0aW9ucy5yZXF1ZXN0Lm1vZGUgPT09IFwibmF2aWdhdGVcIikge1xuICAgICAgICAgICAgICAgIGxldCByZXN1bHRpbmdDbGllbnRJZDtcbiAgICAgICAgICAgICAgICBpZiAob3B0aW9ucy5ldmVudCBpbnN0YW5jZW9mIEZldGNoRXZlbnQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0aW5nQ2xpZW50SWQgPSBvcHRpb25zLmV2ZW50LnJlc3VsdGluZ0NsaWVudElkO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjb25zdCByZXN1bHRpbmdXaW4gPSBhd2FpdCByZXN1bHRpbmdDbGllbnRFeGlzdHMocmVzdWx0aW5nQ2xpZW50SWQpO1xuICAgICAgICAgICAgICAgIGlmICghcmVzdWx0aW5nV2luIHx8IGlzU2FmYXJpKSB7XG4gICAgICAgICAgICAgICAgICAgIGF3YWl0IHRpbWVvdXQoMzUwMCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHRoaXMuX25vdGlmeUFsbENsaWVudHMpIHtcbiAgICAgICAgICAgICAgICBjb25zdCB3aW5kb3dzID0gYXdhaXQgc2VsZi5jbGllbnRzLm1hdGNoQWxsKHtcbiAgIC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wcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgIGlmICghKGNvbmZpZy5zdGF0dXNlcyB8fCBjb25maWcuaGVhZGVycykpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwic3RhdHVzZXMtb3ItaGVhZGVycy1yZXF1aXJlZFwiLCB7XG4gICAgICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3QvY2FjaGVhYmxlLXJlc3BvbnNlXCIsXG4gICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJDYWNoZWFibGVSZXNwb25zZVwiLFxuICAgICAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJjb25zdHJ1Y3RvclwiXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoY29uZmlnLnN0YXR1c2VzKSB7XG4gICAgICAgICAgICAgICAgYXNzZXJ0LmlzQXJyYXkoY29uZmlnLnN0YXR1c2VzLCB7XG4gICAgICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3QvY2FjaGVhYmxlLXJlc3BvbnNlXCIsXG4gICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJDYWNoZWFibGVSZXNwb25zZVwiLFxuICAgICAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJjb25zdHJ1Y3RvclwiLFxuICAgICAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwiY29uZmlnLnN0YXR1c2VzXCJcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChjb25maWcuaGVhZGVycykge1xuICAgICAgICAgICAgICAgIGFzc2VydC5pc1R5cGUoY29uZmlnLmhlYWRlcnMsIFwib2JqZWN0XCIsIHtcbiAgICAgICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJAc2Vyd2lzdC9jYWNoZWFibGUtcmVzcG9uc2VcIixcbiAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIkNhY2hlYWJsZVJlc3BvbnNlXCIsXG4gICAgICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcImNvbnN0cnVjdG9yXCIsXG4gICAgICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJjb25maWcuaGVhZGVyc1wiXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5fc3RhdHVzZXMgPSBjb25maWcuc3RhdHVzZXM7XG4gICAgICAgIGlmIChjb25maWcuaGVhZGVycykge1xuICAgICAgICAgICAgdGhpcy5faGVhZGVycyA9IG5ldyBIZWFkZXJzKGNvbmZpZy5oZWFkZXJzKTtcbiAgICAgICAgfVxuICAgIH1cbiAgICBpc1Jlc3BvbnNlQ2FjaGVhYmxlKHJlc3BvbnNlKSB7XG4gICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgIGFzc2VydC5pc0luc3RhbmNlKHJlc3BvbnNlLCBSZXNwb25zZSwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3QvY2FjaGVhYmxlLXJlc3BvbnNlXCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIkNhY2hlYWJsZVJlc3BvbnNlXCIsXG4gICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiaXNSZXNwb25zZUNhY2hlYWJsZVwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJyZXNwb25zZVwiXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICBsZXQgY2FjaGVhYmxlID0gdHJ1ZTtcbiAgICAgICAgaWYgKHRoaXMuX3N0YXR1c2VzKSB7XG4gICAgICAgICAgICBjYWNoZWFibGUgPSB0aGlzLl9zdGF0dXNlcy5pbmNsdWRlcyhyZXNwb25zZS5zdGF0dXMpO1xuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLl9oZWFkZXJzICYmIGNhY2hlYWJsZSkge1xuICAgICAgICAgICAgZm9yIChjb25zdCBbaGVhZGVyTmFtZSwgaGVhZGVyVmFsdWVdIG9mIHRoaXMuX2hlYWRlcnMuZW50cmllcygpKXtcbiAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2UuaGVhZGVycy5nZXQoaGVhZGVyTmFtZSkgIT09IGhlYWRlclZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIGNhY2hlYWJsZSA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgaWYgKCFjYWNoZWFibGUpIHtcbiAgICAgICAgICAgICAgICBsb2dnZXIuZ3JvdXBDb2xsYXBzZWQoYFRoZSByZXF1ZXN0IGZvciAnJHtnZXRGcmllbmRseVVSTChyZXNwb25zZS51cmwpfScgcmV0dXJuZWQgYSByZXNwb25zZSB0aGF0IGRvZXMgbm90IG1lZXQgdGhlIGNyaXRlcmlhIGZvciBiZWluZyBjYWNoZWQuYCk7XG4gICAgICAgICAgICAgICAgbG9nZ2VyLmdyb3VwQ29sbGFwc2VkKFwiVmlldyBjYWNoZWFiaWxpdHkgY3JpdGVyaWEgaGVyZS5cIik7XG4gICAgICAgICAgICAgICAgbG9nZ2VyLmxvZyhgQ2FjaGVhYmxlIHN0YXR1c2VzOiAke0pTT04uc3RyaW5naWZ5KHRoaXMuX3N0YXR1c2VzKX1gKTtcbiAgICAgICAgICAgICAgICBsb2dnZXIubG9nKGBDYWNoZWFibGUgaGVhZGVyczogJHtKU09OLnN0cmluZ2lmeSh0aGlzLl9oZWFkZXJzLCBudWxsLCAyKX1gKTtcbiAgICAgICAg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gICAgICAgICAgICAgICAgIHVybHNEZWxldGVkLnB1c2gocmVzdWx0LnVybCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgZW50cmllc05vdERlbGV0ZWRDb3VudCsrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGN1cnNvciA9IGF3YWl0IGN1cnNvci5jb250aW51ZSgpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB1cmxzRGVsZXRlZDtcbiAgICB9XG4gICAgYXN5bmMgZ2V0RGIoKSB7XG4gICAgICAgIGlmICghdGhpcy5fZGIpIHtcbiAgICAgICAgICAgIHRoaXMuX2RiID0gYXdhaXQgb3BlbkRCKERCX05BTUUsIDEsIHtcbiAgICAgICAgICAgICAgICB1cGdyYWRlOiB0aGlzLl91cGdyYWRlRGJBbmREZWxldGVPbGREYnMuYmluZCh0aGlzKVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRoaXMuX2RiO1xuICAgIH1cbn1cblxuY2xhc3MgQ2FjaGVFeHBpcmF0aW9uIHtcbiAgICBfaXNSdW5uaW5nID0gZmFsc2U7XG4gICAgX3JlcnVuUmVxdWVzdGVkID0gZmFsc2U7XG4gICAgX21heEVudHJpZXM7XG4gICAgX21heEFnZVNlY29uZHM7XG4gICAgX21hdGNoT3B0aW9ucztcbiAgICBfY2FjaGVOYW1lO1xuICAgIF90aW1lc3RhbXBNb2RlbDtcbiAgICBjb25zdHJ1Y3RvcihjYWNoZU5hbWUsIGNvbmZpZyA9IHt9KXtcbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgYXNzZXJ0LmlzVHlwZShjYWNoZU5hbWUsIFwic3RyaW5nXCIsIHtcbiAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiBcIkBzZXJ3aXN0L2V4cGlyYXRpb25cIixcbiAgICAgICAgICAgICAgICBjbGFzc05hbWU6IFwiQ2FjaGVFeHBpcmF0aW9uXCIsXG4gICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiY29uc3RydWN0b3JcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwiY2FjaGVOYW1lXCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgaWYgKCEoY29uZmlnLm1heEVudHJpZXMgfHwgY29uZmlnLm1heEFnZVNlY29uZHMpKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IFNlcndpc3RFcnJvcihcIm1heC1lbnRyaWVzLW9yLWFnZS1yZXF1aXJlZFwiLCB7XG4gICAgICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3QvZXhwaXJhdGlvblwiLFxuICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6IFwiQ2FjaGVFeHBpcmF0aW9uXCIsXG4gICAgICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcImNvbnN0cnVjdG9yXCJcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChjb25maWcubWF4RW50cmllcykge1xuICAgICAgICAgICAgICAgIGFzc2VydC5pc1R5cGUoY29uZmlnLm1heEVudHJpZXMsIFwibnVtYmVyXCIsIHtcbiAgICAgICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJAc2Vyd2lzdC9leHBpcmF0aW9uXCIsXG4gICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJDYWNoZUV4cGlyYXRpb25cIixcbiAgICAgICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiY29uc3RydWN0b3JcIixcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcImNvbmZpZy5tYXhFbnRyaWVzXCJcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChjb25maWcubWF4QWdlU2Vjb25kcykge1xuICAgICAgICAgICAgICAgIGFzc2VydC5pc1R5cGUoY29uZmlnLm1heEFnZVNlY29uZHMsIFwibnVtYmVyXCIsIHtcbiAgICAgICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJAc2Vyd2lzdC9leHBpcmF0aW9uXCIsXG4gICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJDYWNoZUV4cGlyYXRpb25cIixcbiAgICAgICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiY29uc3RydWN0b3JcIixcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcImNvbmZpZy5tYXhBZ2VTZWNvbmRzXCJcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICB0aGlzLl9tYXhFbnRyaWVzID0gY29uZmlnLm1heEVudHJpZXM7XG4gICAgICAgIHRoaXMuX21heEFnZVNlY29uZHMgPSBjb25maWcubWF4QWdlU2Vjb25kcztcbiAgICAgICAgdGhpcy5fbWF0Y2hPcHRpb25zID0gY29uZmlnLm1hdGNoT3B0aW9ucztcbiAgICAgICAgdGhpcy5fY2FjaGVOYW1lID0gY2FjaGVOYW1lO1xuICAgICAgICB0aGlzLl90aW1lc3RhbXBNb2RlbCA9IG5ldyBDYWNoZVRpbWVzdGFtcHNNb2RlbChjYWNoZU5hbWUpO1xuICAgIH1cbiAgICBhc3luYyBleHBpcmVFbnRyaWVzKCkge1xuICAgICAgICBpZiAodGhpcy5faXNSdW5uaW5nKSB7XG4gICAgICAgICAgICB0aGlzLl9yZXJ1blJlcXVlc3RlZCA9IHRydWU7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5faXNSdW5uaW5nID0gdHJ1ZTtcbiAgICAgICAgY29uc3QgbWluVGltZXN0YW1wID0gdGhpcy5fbWF4QWdlU2Vjb25kcyA/IERhdGUubm93KCkgLSB0aGlzLl9tYXhBZ2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tcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgbG9nZ2VyLmdyb3VwRW5kKCk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGxvZ2dlci5kZWJ1ZyhcIkNhY2hlIGV4cGlyYXRpb24gcmFuIGFuZCBmb3VuZCBubyBlbnRyaWVzIHRvIHJlbW92ZS5cIik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5faXNSdW5uaW5nID0gZmFsc2U7XG4gICAgICAgIGlmICh0aGlzLl9yZXJ1blJlcXVlc3RlZCkge1xuICAgICAgICAgICAgdGhpcy5fcmVydW5SZXF1ZXN0ZWQgPSBmYWxzZTtcbiAgICAgICAgICAgIHZvaWQgdGhpcy5leHBpcmVFbnRyaWVzKCk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgYXN5bmMgdXBkYXRlVGltZXN0YW1wKHVybCkge1xuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBhc3NlcnQuaXNUeXBlKHVybCwgXCJzdHJpbmdcIiwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3QvZXhwaXJhdGlvblwiLFxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJDYWNoZUV4cGlyYXRpb25cIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJ1cGRhdGVUaW1lc3RhbXBcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwidXJsXCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGF3YWl0IHRoaXMuX3RpbWVzdGFtcE1vZGVsLnNldFRpbWVzdGFtcCh1cmwsIERhdGUubm93KCkpO1xuICAgIH1cbiAgICBhc3luYyBpc1VSTEV4cGlyZWQodXJsKSB7XG4gICAgICAgIGlmICghdGhpcy5fbWF4QWdl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hPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgIGlmICghKGNvbmZpZy5tYXhFbnRyaWVzIHx8IGNvbmZpZy5tYXhBZ2VTZWNvbmRzKSkge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBTZXJ3aXN0RXJyb3IoXCJtYXgtZW50cmllcy1vci1hZ2UtcmVxdWlyZWRcIiwge1xuICAgICAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiBcIkBzZXJ3aXN0L2V4cGlyYXRpb25cIixcbiAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIkV4cGlyYXRpb25QbHVnaW5cIixcbiAgICAgICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiY29uc3RydWN0b3JcIlxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGNvbmZpZy5tYXhFbnRyaWVzKSB7XG4gICAgICAgICAgICAgICAgYXNzZXJ0LmlzVHlwZShjb25maWcubWF4RW50cmllcywgXCJudW1iZXJcIiwge1xuICAgICAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiBcIkBzZXJ3aXN0L2V4cGlyYXRpb25cIixcbiAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIkV4cGlyYXRpb25QbHVnaW5cIixcbiAgICAgICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiY29uc3RydWN0b3JcIixcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcImNvbmZpZy5tYXhFbnRyaWVzXCJcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChjb25maWcubWF4QWdlU2Vjb25kcykge1xuICAgICAgICAgICAgICAgIGFzc2VydC5pc1R5cGUoY29uZmlnLm1heEFnZVNlY29uZHMsIFwibnVtYmVyXCIsIHtcbiAgICAgICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJAc2Vyd2lzdC9leHBpcmF0aW9uXCIsXG4gICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJFeHBpcmF0aW9uUGx1Z2luXCIsXG4gICAgICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcImNvbnN0cnVjdG9yXCIsXG4gICAgICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJjb25maWcubWF4QWdlU2Vjb25kc1wiXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoY29uZmlnLm1heEFnZUZyb20pIHtcbiAgICAgICAgICAgICAgICBhc3NlcnQuaXNUeXBlKGNvbmZpZy5tYXhBZ2VGcm9tLCBcInN0cmluZ1wiLCB7XG4gICAgICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwiQHNlcndpc3QvZXhwaXJhdGlvblwiLFxuICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6IFwiRXhwaXJhdGlvblBsdWdpblwiLFxuICAgICAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJjb25zdHJ1Y3RvclwiLFxuICAgICAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwiY29uZmlnLm1heEFnZUZyb21cIlxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHRoaXMuX2NvbmZpZyA9IGNvbmZpZztcbiAgICAgICAgdGhpcy5fY2FjaGVFeHBpcmF0aW9ucyA9IG5ldyBNYXAoKTtcbiAgICAgICAgaWYgKCF0aGlzLl9jb25maWcubWF4QWdlRnJvbSkge1xuICAgICAgICAgICAgdGhpcy5fY29uZmlnLm1heEFnZUZyb20gPSBcImxhc3QtZmV0Y2hlZFwiO1xuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLl9jb25maWcucHVyZ2VPblF1b3RhRXJyb3IpIHtcbiAgICAgICAgICAgIHJlZ2lzdGVyUXVvdGFFcnJvckNhbGxiYWNrKCgpPT50aGlzLmRlbGV0ZUNhY2hlQ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cbiAgICAgICAgICAgIHJldHVybiBhd2FpdCBjcmVhdGVQYXJ0aWFsUmVzcG9uc2UocmVxdWVzdCwgY2FjaGVkUmVzcG9uc2UpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBjYWNoZWRSZXNwb25zZTtcbiAgICB9O1xufVxuXG5leHBvcnQgeyBkZWZhdWx0SGVhZGVyc1RvQ2hlY2sgYXMgQlJPQURDQVNUX1VQREFURV9ERUZBVUxUX0hFQURFUlMsIENBQ0hFX1VQREFURURfTUVTU0FHRV9NRVRBIGFzIEJST0FEQ0FTVF9VUERBVEVfTUVTU0FHRV9NRVRBLCBDQUNIRV9VUERBVEVEX01FU1NBR0VfVFlQRSBhcyBCUk9BRENBU1RfVVBEQVRFX01FU1NBR0VfVFlQRSwgQnJvYWRjYXN0Q2FjaGVVcGRhdGUsIEJyb2FkY2FzdFVwZGF0ZVBsdWdpbiwgQ2FjaGVFeHBpcmF0aW9uLCBDYWNoZWFibGVSZXNwb25zZSwgQ2FjaGVhYmxlUmVzcG9uc2VQbHVnaW4sIEV4cGlyYXRpb25QbHVnaW4sIFJhbmdlUmVxdWVzdHNQbHVnaW4sIGNyZWF0ZVBhcnRpYWxSZXNwb25zZSwgcmVzcG9uc2VzQXJlU2FtZSB9O1xuIl0sIm5hbWVzIjpbXSwic291cmNlUm9vdCI6IiJ9\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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vQHNlcndpc3Qrc3dAOS4wLjAtcHJldmlldy4yMV90eXBlc2NyaXB0QDUuNC41L25vZGVfbW9kdWxlcy9Ac2Vyd2lzdC9zdy9kaXN0L2luZGV4LnN0cmF0ZWdpZXMuanMiLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7OztBQUFzRTtBQUNqQjtBQUNPO0FBQ3lCO0FBQ1A7O0FBRTlFLHlCQUF5QixrREFBUTtBQUNqQztBQUNBO0FBQ0EsWUFBWSxJQUFxQztBQUNqRCxZQUFZLDBEQUFNO0FBQ2xCO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsYUFBYTtBQUNiO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsZ0JBQWdCLElBQXFDO0FBQ3JELHVEQUF1RCxlQUFlO0FBQ3RFO0FBQ0E7QUFDQTtBQUNBLGNBQWM7QUFDZDtBQUNBO0FBQ0E7QUFDQTtBQUNBLGdCQUFnQixJQUFxQztBQUNyRDtBQUNBO0FBQ0Esa0JBQWtCO0FBQ2xCO0FBQ0E7QUFDQTtBQUNBLFVBQVU7QUFDVixnQkFBZ0IsSUFBcUM7QUFDckQsNkRBQTZELGVBQWU7QUFDNUU7QUFDQTtBQUNBLFlBQVksSUFBcUM7QUFDakQsWUFBWSwwREFBTSxnQkFBZ0IscURBQVE7QUFDMUM7QUFDQSxnQkFBZ0IsMERBQU07QUFDdEI7QUFDQSxZQUFZLHFEQUFRO0FBQ3BCLFlBQVksMERBQU07QUFDbEI7QUFDQTtBQUNBLHNCQUFzQixnRUFBWTtBQUNs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3NlcnQuaXNJbnN0YW5jZShyZXF1ZXN0LCBSZXF1ZXN0LCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJAc2Vyd2lzdC9zdHJhdGVnaWVzXCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiB0aGlzLmNvbnN0cnVjdG9yLm5hbWUsXG4gICAgICAgICAgICAgICAgZnVuY05hbWU6IFwibWFrZVJlcXVlc3RcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwicmVxdWVzdFwiXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICBsZXQgcmVzcG9uc2UgPSBhd2FpdCBoYW5kbGVyLmNhY2hlTWF0Y2gocmVxdWVzdCk7XG4gICAgICAgIGxldCBlcnJvciA9IHVuZGVmaW5lZDtcbiAgICAgICAgaWYgKCFyZXNwb25zZSkge1xuICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgIGxvZ3MucHVzaChgTm8gcmVzcG9uc2UgZm91bmQgaW4gdGhlICcke3RoaXMuY2FjaGVOYW1lfScgY2FjaGUuIFdpbGwgcmVzcG9uZCB3aXRoIGEgbmV0d29yayByZXF1ZXN0LmApO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IGhhbmRsZXIuZmV0Y2hBbmRDYWNoZVB1dChyZXF1ZXN0KTtcbiAgICAgICAgICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgICAgIGlmIChlcnIgaW5zdGFuY2VvZiBFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICBlcnJvciA9IGVycjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ3MucHVzaChcIkdvdCByZXNwb25zZSBmcm9tIG5ldHdvcmsuXCIpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ3MucHVzaChcIlVuYWJsZSB0byBnZXQgYSByZXNwb25zZSBmcm9tIHRoZSBuZXR3b3JrLlwiKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgbG9ncy5wdXNoKGBGb3VuZCBhIGNhY2hlZCByZXNwb25zZSBpbiB0aGUgJyR7dGhpcy5jYWNoZU5hbWV9JyBjYWNoZS5gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBDb2xsYXBzZWQobWVzc2FnZXMuc3RyYXRlZ3lTdGFydCh0aGlzLmNvbnN0cnVjdG9yLm5hbWUsIHJlcXVlc3QpKTtcbiAgICAgICAgICAgIGZvciAoY29uc3QgbG9nIG9mIGxvZ3Mpe1xuICAgICAgICAgICAgICAgIGxvZ2dlci5sb2cobG9nKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG1lc3NhZ2VzLnByaW50RmluYWxSZXNwb25zZShyZXNwb25zZSk7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBFbmQoKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIXJlc3BvbnNlKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwibm8tcmVzcG9uc2VcIiwge1xuIC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ZX0nIGNhY2hlLiBXaWxsIHdhaXQgZm9yIHRoZSBuZXR3b3JrIHJlc3BvbnNlLmApO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IGZldGNoQW5kQ2FjaGVQcm9taXNlO1xuICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgICAgICAgaWYgKGVyciBpbnN0YW5jZW9mIEVycm9yKSB7XG4gICAgICAgICAgICAgICAgICAgIGVycm9yID0gZXJyO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBDb2xsYXBzZWQobWVzc2FnZXMuc3RyYXRlZ3lTdGFydCh0aGlzLmNvbnN0cnVjdG9yLm5hbWUsIHJlcXVlc3QpKTtcbiAgICAgICAgICAgIGZvciAoY29uc3QgbG9nIG9mIGxvZ3Mpe1xuICAgICAgICAgICAgICAgIGxvZ2dlci5sb2cobG9nKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG1lc3NhZ2VzLnByaW50RmluYWxSZXNwb25zZShyZXNwb25zZSk7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBFbmQoKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIXJlc3BvbnNlKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwibm8tcmVzcG9uc2VcIiwge1xuICAgICAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXG4gICAgICAgICAgICAgICAgZXJyb3JcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXNwb25zZTtcbiAgICB9XG59XG5cbmV4cG9ydCB7IENhY2hlRmlyc3QsIENhY2hlT25seSwgU3RhbGVXaGlsZVJldmFsaWRhdGUsIFN0cmF0ZWd5IH07XG4iXSwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiIn0=\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")); +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__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! serwist */ \"./node_modules/.pnpm/serwist@9.0.2_typescript@5.4.5/node_modules/serwist/dist/index.js\");\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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vQHNlcndpc3QrbmV4dEA5LjAuMl9uZXh0QDE0LjIuM19AYmFiZWwrY29yZUA3LjI0LjVfcmVhY3QtZG9tQDE4LjMuMV9yZWFjdEAxOC4zLjFfX3JlYWN0QDE4LjMuX2UybmttZXRlcnBxbGxnc2g0NHdmeGs3azJxL25vZGVfbW9kdWxlcy9Ac2Vyd2lzdC9uZXh0L2Rpc3QvaW5kZXgud29ya2VyLmpzIiwibWFwcGluZ3MiOiI7Ozs7OztBQUFnSDs7QUFFaEg7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQSxxQkFBcUIsS0FBcUMsUUFBUSxDQW1QakU7O0FBRXlDIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vX05fRS8uL25vZGVfbW9kdWx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UgKiAyNCAqIDYwICogNjAsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZUZyb206IFwibGFzdC11c2VkXCJcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgXVxuICAgICAgICB9KVxuICAgIH0sXG4gICAge1xuICAgICAgICBtYXRjaGVyOiAvXmh0dHBzOlxcL1xcL2ZvbnRzXFwuKD86Z29vZ2xlYXBpcylcXC5jb21cXC8uKi9pLFxuICAgICAgICBoYW5kbGVyOiBuZXcgU3RhbGVXaGlsZVJldmFsaWRhdGUoe1xuICAgICAgICAgICAgY2FjaGVOYW1lOiBcImdvb2dsZS1mb250cy1zdHlsZXNoZWV0c1wiLFxuICAgICAgICAgICAgcGx1Z2luczogW1xuICAgICAgICAgICAgICAgIG5ldyBFeHBpcmF0aW9uUGx1Z2luKHtcbiAgICAgICAgICAgICAgICAgICAgbWF4RW50cmllczogNCxcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlU2Vjb25kczogNyAqIDI0ICogNjAgKiA2MCxcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlRnJvbTogXCJsYXN0LXVzZWRcIlxuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICBdXG4gICAgICAgIH0pXG4gICAgfSxcbiAgICB7XG4gICAgICAgIG1hdGNoZXI6IC9cXC4oPzplb3R8b3RmfHR0Y3x0dGZ8d29mZnx3b2ZmMnxmb250LmNzcykkL2ksXG4gICAgICAgIGhhbmRsZXI6IG5ldyBTdGFsZVdoaWxlUmV2YWxpZGF0ZSh7XG4gICAgICAgICAgICBjYWNoZU5hbWU6IFwic3RhdGljLWZvbnQtYXNzZXRzXCIsXG4gICAgICAgICAgICBwbHVnaW5zOiBbXG4gICAgICAgICAgICAgICAgbmV3IEV4cGlyYXRpb25QbHVnaW4oe1xuICAgICAgICAgICAgICAgICAgICBtYXhFbnRyaWVzOiA0LFxuICAgICAgICAgICAgICAgICAgICBtYXhBZ2VTZWNvbmRzOiA3ICogMjQgKiA2MCAqIDYwLFxuICAgICAgICAgICAgICAgICAgICBtYXhBZ2VGcm9tOiBcImxhc3QtdXNlZFwiXG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIF1cbiAgICAgICAgfSlcbiAgICB9LFxuICAgIHtcbiAgICAgICAgbWF0Y2hlcjogL1xcLig/OmpwZ3xqcGVnfGdpZnxwbmd8c3ZnfGljb3x3ZWJwKSQvaSxcbiAgICAgICAgaGFuZGxlcjogbmV3IFN0YWxlV2hpbGVSZXZhbGlkYXRlKHtcbiAgICAgICAgICAgIGNhY2hlTmFtZTogXCJzdGF0aWMtaW1hZ2UtYXNzZXRzXCIsXG4gICAgICAgICAgICBwbHVnaW5zOiBbXG4gICAgICAgICAgICAgICAgbmV3IEV4cGlyYXRpb25QbHVnaW4oe1xuICAgICAgICAgICAgICAgICAgICBtYXhFbnRyaWVzOiA2NCxcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlU2Vjb25kczogMzAgKiAyNCAqIDYwICogNjAsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZUZyb206IFwibGFzdC11c2VkXCJcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgXVxuICAgICAgICB9KVxuICAgIH0sXG4gICAge1xuICAgICAgICBtYXRjaGVyOiAvXFwvX25leHRcXC9zdGF0aWMuK1xcLmpzJC9pLFxuICAgICAgICBoYW5kbGVyOiBuZXcgQ2FjaGVGaXJzdCh7XG4gICAgICAgICAgICBjYWNoZU5hbWU6IFwibmV4dC1zdGF0aWMtanMtYXNzZXRzXCIsXG4gICAgICAgICAgICBwbHVnaW5zOiBbXG4gICAgICAgICAgICAgICAgbmV3IEV4cGlyYXRpb25QbHVnaW4oe1xuICAgICAgICAgICAgICAgICAgICBtYXhFbnRyaWVzOiA2NCxcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlU2Vjb25kczogMjQgKiA2MCAqIDYwLFxuICAgICAgICAgICAgICAgICAgICBtYXhBZ2VGcm9tOiBcImxhc3QtdXNlZFwiXG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIF1cbiAgICAgICAgfSlcbiAgICB9LFxuICAgIHtcbiAgICAgICAgbWF0Y2hlcjogL1xcL19uZXh0XFwvaW1hZ2VcXD91cmw9LiskL2ksXG4gICAgICAgIGhhbmRsZXI6IG5ldyBTdGFsZVdoaWxlUmV2YWxpZGF0ZSh7XG4gICAgICAgICAgICBjYWNoZU5hbWU6IFwibmV4dC1pbWFnZVwiLFxuICAgICAgICAgICAgcGx1Z2luczogW1xuICAgICAgICAgICAgICAgIG5ldyBFeHBpcmF0aW9uUGx1Z2luKHtcbiAgICAgICAgICAgICAgICAgICAgbWF4RW50cmllczogNjQsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZVNlY29uZHM6IDI0ICogNjAgKiA2MCxcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlRnJvbTogXCJsYXN0LXVzZWRcIlxuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICBdXG4gICAgICAgIH0pXG4gICAgfSxcbiAgICB7XG4gICAgICAgIG1hdGNoZXI6IC9cXC4oPzptcDN8d2F2fG9nZykkL2ksXG4gICAgICAgIGhhbmRsZXI6IG5ldyBDYWNoZUZpcnN0KHtcbiAgICAgICAgICAgIGNhY2hlTmFtZTogXCJzdGF0aWMtYXVkaW8tYXNzZXRzXCIsXG4gICAgICAgICAgICBwbHVnaW5zOiBbXG4gICAgICAgICAgICAgICAgbmV3IEV4cGlyYXRpb25QbHVnaW4oe1xuICAgICAgICAgICAgICAgICAgICBtYXhFbnRyaWVzOiAzMixcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlU2Vjb25kczogMjQgKiA2MCAqIDYwLFxuICAgICAgICAgICAgICAgICAgICBtYXhBZ2VGcm9tOiBcImxhc3QtdXNlZFwiXG4gICAgICAgICAgICAgICAgfSksXG4gICAgICAgICAgICAgICAgbmV3IFJhbmdlUmVxdWVzdHNQbHVnaW4oKVxuICAgICAgICAgICAgXVxuICAgICAgICB9KVxuICAgIH0sXG4gICAge1xuICAgICAgICBtYXRjaGVyOiAvXFwuKD86bXA0fHdlYm0pJC9pLFxuICAgICAgICBoYW5kbGVyOiBuZXcgQ2FjaGVGaXJzdCh7XG4gICAgICAgICAgICBjYWNoZU5hbWU6IFwic3RhdGljLXZpZGVvLWFzc2V0c1wiLFxuICAgICAgICAgICAgcGx1Z2luczogW1xuICAgICAgICAgICAgICAgIG5ldyBFeHBpcmF0aW9uUGx1Z2luKHtcbiAgICAgICAgICAgICAgICAgICAgbWF4RW50cmllczogMzIsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZVNlY29uZHM6IDI0ICogNjAgKiA2MCxcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlRnJvbTogXCJsYXN0LXVzZWRcIlxuICAgICAgICAgICAgICAgIH0pLFxuICAgICAgICAgICAgICAgIG5ldyBSYW5nZVJlcXVlc3RzUGx1Z2luKClcbiAgICAgICAgICAgIF1cbiAgICAgICAgfSlcbiAgICB9LFxuICAgIHtcbiAgICAgICAgbWF0Y2hlcjogL1xcLig/OmpzKSQvaSxcbiAgICAgICAgaGFuZGxlcjogbmV3IFN0YWxlV2hpbGVSZXZhbGlkYXRlKHtcbiAgICAgICAgICAgIGNhY2hlTmFtZTogXCJzdGF0aWMtanMtYXNzZXRzXCIsXG4gICAgICAgICAgICBwbHVnaW5zOiBbXG4gICAgICAgICAgICAgICAgbmV3IEV4cGlyYXRpb25QbHVnaW4oe1xuICAgICAgICAgICAgICAgICAgICBtYXhFbnRyaWVzOiA0OCxcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlU2Vjb25kczogMjQgKiA2MCAqIDYwLFxuICAgICAgICAgICAgICAgICAgICBtYXhBZ2VGcm9tOiBcImxhc3QtdXNlZFwiXG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIF1cbiAgICAgICAgfSlcbiAgICB9LFxuICAgIHtcbiAgICAgICAgbWF0Y2hlcjogL1xcLig/OmNzc3xsZXNzKSQvaSxcbiAgICAgICAgaGFuZGxlcjogbmV3IFN0YWxlV2hpbGVSZXZhbGlkYXRlKHtcbiAgICAgICAgICAgIGNhY2hlTmFtZTogXCJzdGF0aWMtc3R5bGUtYXNzZXRzXCIsXG4gICAgICAgICAgICBwbHVnaW5zOiBbXG4gICAgICAgICAgICAgICAgbmV3IEV4cGlyYXRpb25QbHVnaW4oe1xuICAgICAgICAgICAgICAgICAgICBtYXhFbnRyaWVzOiAzMixcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlU2Vjb25kczogMjQgKiA2MCAqIDYwLFxuICAgICAgICAgICAgICAgICAgICBtYXhBZ2VGcm9tOiBcImxhc3QtdXNlZFwiXG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIF1cbiAgICAgICAgfSlcbiAgICB9LFxuICAgIHtcbiAgICAgICAgbWF0Y2hlcjogL1xcL19uZXh0XFwvZGF0YVxcLy4rXFwvLitcXC5qc29uJC9pLFxuICAgICAgICBoYW5kbGVyOiBuZXcgTmV0d29ya0ZpcnN0KHtcbiAgICAgICAgICAgIGNhY2hlTmFtZTogXCJuZXh0LWRhdGFcIixcbiAgICAgICAgICAgIHBsdWdpbnM6IFtcbiAgICAgICAgICAgICAgICBuZXcgRXhwaXJhdGlvblBsdWdpbih7XG4gICAgICAgICAgICAgICAgICAgIG1heEVudHJpZXM6IDMyLFxuICAgICAgICAgICAgICAgICAgICBtYXhBZ2VTZWNvbmRzOiAyNCAqIDYwICogNjAsXG4gICAgICAgICAgICAgICAgICAgIG1heEFnZUZyb206IFwibGFzdC11c2VkXCJcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgXVxuICAgICAgICB9KVxuICAgIH0sXG4gICAge1xuICAgICAgICBtYXRjaGVyOiAvXFwuKD86anNvbnx4bWx8Y3N2KSQvaSxcbiAgICAgICAgaGFuZGxlcjogbmV3IE5ldHdvcmtGaXJzdCh7XG4gICAgICAgICAgICBjYWNoZU5hbWU6IFwic3RhdGljLWRhdGEtYXNzZXRzXCIsXG4gICAgICAgICAgICBwbHVnaW5zOiBbXG4gICAgICAgICAgICAgICAgbmV3IEV4cGlyYXRpb25QbHVnaW4oe1xuICAgICAgICAgICAgICAgICAgICBtYXhFbnRyaWVzOiAzMixcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlU2Vjb25kczogMjQgKiA2MCAqIDYwLFxuICAgICAgICAgICAgICAgICAgICBtYXhBZ2VGcm9tOiBcImxhc3QtdXNlZFwiXG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIF1cbiAgICAgICAgfSlcbiAgICB9LFxuICAgIHtcbiAgICAgICAgbWF0Y2hlcjogKHsgc2FtZU9yaWdpbiwgdXJsOiB7IHBhdGhuYW1lIH0gfSk9PntcbiAgICAgICAgICAgIGlmICghc2FtZU9yaWdpbiB8fCBwYXRobmFtZS5zdGFydHNXaXRoKFwiL2FwaS9hdXRoL2NhbGxiYWNrXCIpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHBhdGhuYW1lLnN0YXJ0c1dpdGgoXCIvYXBpL1wiKSkge1xuICAgICAgICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9LFxuICAgICAgICBtZXRob2Q6IFwiR0VUXCIsXG4gICAgICAgIGhhbmRsZXI6IG5ldyBOZXR3b3JrRmlyc3Qoe1xuICAgICAgICAgICAgY2FjaGVOYW1lOiBcImFwaXNcIixcbiAgICAgICAgICAgIHBsdWdpbnM6IFtcbiAgICAgICAgICAgICAgICBuZXcgRXhwaXJhdGlvblBsdWdpbih7XG4gICAgICAgICAgICAgICAgICAgIG1heEVudHJpZXM6IDE2LFxuICAgICAgICAgICAgICAgICAgICBtYXhBZ2VTZWNvbmRzOiAyNCAqIDYwICogNjAsXG4gICAgICAgICAgICAgICAgICAgI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biAgICAgICAgICAgIGNhY2hlTmFtZTogUEFHRVNfQ0FDSEVfTkFNRS5yc2MsXG4gICAgICAgICAgICBwbHVnaW5zOiBbXG4gICAgICAgICAgICAgICAgbmV3IEV4cGlyYXRpb25QbHVnaW4oe1xuICAgICAgICAgICAgICAgICAgICBtYXhFbnRyaWVzOiAzMixcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlU2Vjb25kczogMjQgKiA2MCAqIDYwXG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIF1cbiAgICAgICAgfSlcbiAgICB9LFxuICAgIHtcbiAgICAgICAgbWF0Y2hlcjogKHsgcmVxdWVzdCwgdXJsOiB7IHBhdGhuYW1lIH0sIHNhbWVPcmlnaW4gfSk9PnJlcXVlc3QuaGVhZGVycy5nZXQoXCJDb250ZW50LVR5cGVcIik/LmluY2x1ZGVzKFwidGV4dC9odG1sXCIpICYmIHNhbWVPcmlnaW4gJiYgIXBhdGhuYW1lLnN0YXJ0c1dpdGgoXCIvYXBpL1wiKSxcbiAgICAgICAgaGFuZGxlcjogbmV3IE5ldHdvcmtGaXJzdCh7XG4gICAgICAgICAgICBjYWNoZU5hbWU6IFBBR0VTX0NBQ0hFX05BTUUuaHRtbCxcbiAgICAgICAgICAgIHBsdWdpbnM6IFtcbiAgICAgICAgICAgICAgICBuZXcgRXhwaXJhdGlvblBsdWdpbih7XG4gICAgICAgICAgICAgICAgICAgIG1heEVudHJpZXM6IDMyLFxuICAgICAgICAgICAgICAgICAgICBtYXhBZ2VTZWNvbmRzOiAyNCAqIDYwICogNjBcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgXVxuICAgICAgICB9KVxuICAgIH0sXG4gICAge1xuICAgICAgICBtYXRjaGVyOiAoeyB1cmw6IHsgcGF0aG5hbWUgfSwgc2FtZU9yaWdpbiB9KT0+c2FtZU9yaWdpbiAmJiAhcGF0aG5hbWUuc3RhcnRzV2l0aChcIi9hcGkvXCIpLFxuICAgICAgICBoYW5kbGVyOiBuZXcgTmV0d29ya0ZpcnN0KHtcbiAgICAgICAgICAgIGNhY2hlTmFtZTogXCJvdGhlcnNcIixcbiAgICAgICAgICAgIHBsdWdpbnM6IFtcbiAgICAgICAgICAgICAgICBuZXcgRXhwaXJhdGlvblBsdWdpbih7XG4gICAgICAgICAgICAgICAgICAgIG1heEVudHJpZXM6IDMyLFxuICAgICAgICAgICAgICAgICAgICBtYXhBZ2VTZWNvbmRzOiAyNCAqIDYwICogNjBcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgXVxuICAgICAgICB9KVxuICAgIH0sXG4gICAge1xuICAgICAgICBtYXRjaGVyOiAoeyBzYW1lT3JpZ2luIH0pPT4hc2FtZU9yaWdpbixcbiAgICAgICAgaGFuZGxlcjogbmV3IE5ldHdvcmtGaXJzdCh7XG4gICAgICAgICAgICBjYWNoZU5hbWU6IFwiY3Jvc3Mtb3JpZ2luXCIsXG4gICAgICAgICAgICBwbHVnaW5zOiBbXG4gICAgICAgICAgICAgICAgbmV3IEV4cGlyYXRpb25QbHVnaW4oe1xuICAgICAgICAgICAgICAgICAgICBtYXhFbnRyaWVzOiAzMixcbiAgICAgICAgICAgICAgICAgICAgbWF4QWdlU2Vjb25kczogNjAgKiA2MFxuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICBdLFxuICAgICAgICAgICAgbmV0d29ya1RpbWVvdXRTZWNvbmRzOiAxMFxuICAgICAgICB9KVxuICAgIH1cbl07XG5cbmV4cG9ydCB7IFBBR0VTX0NBQ0hFX05BTUUsIGRlZmF1bHRDYWNoZSB9O1xuIl0sIm5hbWVzIjpbXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/@serwist+next@9.0.2_next@14.2.3_@babel+core@7.24.5_react-dom@18.3.1_react@18.3.1__react@18.3._e2nkmeterpqllgsh44wfxk7k2q/node_modules/@serwist/next/dist/index.worker.js\n")); /***/ }), @@ -136,77 +36,47 @@ eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* har \*******************/ /***/ (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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vc2Vyd2lzdEA5LjAuMC1wcmV2aWV3LjI0X3R5cGVzY3JpcHRANS40LjUvbm9kZV9tb2R1bGVzL3Nlcndpc3QvZGlzdC9jaHVua3MvTmV0d29ya09ubHkuanMiLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUF3Tjs7QUFFeE47QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsWUFBWSxJQUFxQztBQUNqRCxZQUFZLDBDQUFrQjtBQUM5QjtBQUNBO0FBQ0E7QUFDQTtBQUNBLGFBQWE7QUFDYixZQUFZLDBDQUFrQjtBQUM5QjtBQUNBO0FBQ0E7QUFDQTtBQUNBLGFBQWE7QUFDYjtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0Esb0NBQW9DLDBDQUFRO0FBQzVDO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLCtDQUErQztBQUMvQztBQUNBO0FBQ0E7QUFDQTtBQUNBLGdCQUFnQixRQUFRO0FBQ3hC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tzKFwiZmV0Y2hEaWRTdWNjZWVkXCIpKXtcbiAgICAgICAgICAgICAgICBmZXRjaFJlc3BvbnNlID0gYXdhaXQgY2FsbGJhY2soe1xuICAgICAgICAgICAgICAgICAgICBldmVudCxcbiAgICAgICAgICAgICAgICAgICAgcmVxdWVzdDogcGx1Z2luRmlsdGVyZWRSZXF1ZXN0LFxuICAgICAgICAgICAgICAgICAgICByZXNwb25zZTogZmV0Y2hSZXNwb25zZVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIGZldGNoUmVzcG9uc2U7XG4gICAgICAgIH0gY2F0Y2ggKGVycm9yKSB7XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgbG9nZ2VyLmxvZyhgTmV0d29yayByZXF1ZXN0IGZvciAnJHtnZXRGcmllbmRseVVSTChyZXF1ZXN0LnVybCl9JyB0aHJldyBhbiBlcnJvci5gLCBlcnJvcik7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAob3JpZ2luYWxSZXF1ZXN0KSB7XG4gICAgICAgICAgICAgICAgYXdhaXQgdGhpcy5ydW5DYWxsYmFja3MoXCJmZXRjaERpZEZhaWxcIiwge1xuICAgICAgICAgICAgICAgICAgICBlcnJvcjogZXJyb3IsXG4gICAgICAgICAgICAgICAgICAgIGV2ZW50LFxuICAgICAgICAgICAgICAgICAgICBvcmlnaW5hbFJlcXVlc3Q6IG9yaWdpbmFsUmVxdWVzdC5jbG9uZSgpLFxuICAgICAgICAgICAgICAgICAgICByZXF1ZXN0OiBwbHVnaW5GaWx0ZXJlZFJlcXVlc3QuY2xvbmUoKVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhyb3cgZXJyb3I7XG4gICAgICAgIH1cbiAgICB9XG4gICAgYXN5bmMgZmV0Y2h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9XG4gICAgICAgIHJldHVybiB0aGlzLl9jYWNoZUtleXNba2V5XTtcbiAgICB9XG4gICAgaGFzQ2FsbGJhY2sobmFtZSkge1xuICAgICAgICBmb3IgKGNvbnN0IHBsdWdpbiBvZiB0aGlzLl9zdHJhdGVneS5wbHVnaW5zKXtcbiAgICAgICAgICAgIGlmIChuYW1lIGluIHBsdWdpbikge1xuICAgICAgICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9XG4gICAgYXN5bmMgcnVuQ2FsbGJhY2tzKG5hbWUsIHBhcmFtKSB7XG4gICAgICAgIGZvciAoY29uc3QgY2FsbGJhY2sgb2YgdGhpcy5pdGVyYXRlQ2FsbGJhY2tzKG5hbWUpKXtcbiAgICAgICAgICAgIGF3YWl0IGNhbGxiYWNrKHBhcmFtKTtcbiAgICAgICAgfVxuICAgIH1cbiAgICAqaXRlcmF0ZUNhbGxiYWNrcyhuYW1lKSB7XG4gICAgICAgIGZvciAoY29uc3QgcGx1Z2luIG9mIHRoaXMuX3N0cmF0ZWd5LnBsdWdpbnMpe1xuICAgICAgICAgICAgaWYgKHR5cGVvZiBwbHVnaW5bbmFtZV0gPT09IFwiZnVuY3Rpb25cIikge1xuICAgICAgICAgICAgICAgIGNvbnN0IHN0YXRlID0gdGhpcy5fcGx1Z2luU3RhdGVNYXAuZ2V0KHBsdWdpbik7XG4gICAgICAgICAgICAgICAgY29uc3Qgc3RhdGVmdWxDYWxsYmFjayA9IChwYXJhbSk9PntcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3RhdGVmdWxQYXJhbSA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC4uLnBhcmFtLFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGVcbiAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBsdWdpbltuYW1lXShzdGF0ZWZ1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gdW5kZWZpbmVkO1xuICAgICAgICAgICAgcGx1Z2luc1VzZWQgPSB0cnVlO1xuICAgICAgICAgICAgaWYgKCFyZXNwb25zZVRvQ2FjaGUpIHtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoIXBsdWdpbnNVc2VkKSB7XG4gICAgICAgICAgICBpZiAocmVzcG9uc2VUb0NhY2hlICYmIHJlc3BvbnNlVG9DYWNoZS5zdGF0dXMgIT09IDIwMCkge1xuICAgICAgICAgICAgICAgIHJlc3BvbnNlVG9DYWNoZSA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2VUb0NhY2hlKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZVRvQ2FjaGUuc3RhdHVzICE9PSAyMDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZVRvQ2FjaGUuc3RhdHVzID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLndhcm4oYFRoZSByZXNwb25zZSBmb3IgJyR7dGhpcy5yZXF1ZXN0LnVybH0nIGlzIGFuIG9wYXF1ZSByZXNwb25zZS4gVGhlIGNhY2hpbmcgc3RyYXRlZ3kgdGhhdCB5b3UncmUgdXNpbmcgd2lsbCBub3QgY2FjaGUgb3BhcXVlIHJlc3BvbnNlcyBieSBkZWZhdWx0LmApO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2dnZXIuZGVidWcoYFRoZSByZXNwb25zZSBmb3IgJyR7dGhpcy5yZXF1ZXN0LnVybH0nIHJldHVybmVkIGEgc3RhdHVzIGNvZGUgb2YgJyR7cm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CByZXNwb25zZSA9IHVuZGVmaW5lZDtcbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIHJlc3BvbnNlID0gYXdhaXQgdGhpcy5faGFuZGxlKHJlcXVlc3QsIGhhbmRsZXIpO1xuICAgICAgICAgICAgaWYgKHJlc3BvbnNlID09PSB1bmRlZmluZWQgfHwgcmVzcG9uc2UudHlwZSA9PT0gXCJlcnJvclwiKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IFNlcndpc3RFcnJvcihcIm5vLXJlc3BvbnNlXCIsIHtcbiAgICAgICAgICAgICAgICAgICAgdXJsOiByZXF1ZXN0LnVybFxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgaWYgKGVycm9yIGluc3RhbmNlb2YgRXJyb3IpIHtcbiAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IGNhbGxiYWNrIG9mIGhhbmRsZXIuaXRlcmF0ZUNhbGxiYWNrcyhcImhhbmRsZXJEaWRFcnJvclwiKSl7XG4gICAgICAgICAgICAgICAgICAgIHJlc3BvbnNlID0gYXdhaXQgY2FsbGJhY2soe1xuICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3IsXG4gICAgICAgICAgICAgICAgICAgICAgICBldmVudCxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3RcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZSAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICghcmVzcG9uc2UpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBlcnJvcjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChwcm9jZXNzLmV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cIiwge1xuICAgICAgICAgICAgICAgIGV2ZW50LFxuICAgICAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICAgICAgcmVzcG9uc2VcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgYXdhaXQgaGFuZGxlci5kb25lV2FpdGluZygpO1xuICAgICAgICB9IGNhdGNoICh3YWl0VW50aWxFcnJvcikge1xuICAgICAgICAgICAgaWYgKHdhaXRVbnRpbEVycm9yIGluc3RhbmNlb2YgRXJyb3IpIHtcbiAgICAgICAgICAgICAgICBlcnJvciA9IHdhaXRVbnRpbEVycm9yO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGF3YWl0IGhhbmRsZXIucnVuQ2FsbGJhY2tzKFwiaGFuZGxlckRpZENvbXBsZXRlXCIsIHtcbiAgICAgICAgICAgIGV2ZW50LFxuICAgICAgICAgICAgcmVxdWVzdCxcbiAgICAgICAgICAgIHJlc3BvbnNlLFxuICAgICAgICAgICAgZXJyb3JcbiAgICAgICAgfSk7XG4gICAgICAgIGhhbmRsZXIuZGVzdHJveSgpO1xuICAgICAgICBpZiAoZXJyb3IpIHtcbiAgICAgICAgICAgIHRocm93IGVycm9yO1xuICAgICAgICB9XG4gICAgfVxufVxuXG5jb25zdCBjYWNoZU9rQW5kT3BhcXVlUGx1Z2luID0ge1xuICAgIGNhY2hlV2lsbFVwZGF0ZTogYXN5bmMgKHsgcmVzcG9uc2UgfSk9PntcbiAgICAgICAgaWYgKHJlc3BvbnNlLnN0YXR1cyA9PT0gMjAwIHx8IHJlc3BvbnNlLnN0YXR1cyA9PT0gMCkge1xuICAgICAgICAgICAgcmV0dXJuIHJlc3BvbnNlO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBudWxsO1xuICAgIH1cbn07XG5cbmNvbnN0IG1lc3NhZ2VzID0ge1xuICAgIHN0cmF0ZWd5U3RhcnQ6IChzdHJhdGVneU5hbWUsIHJlcXVlc3QpPT5gVXNpbmcgJHtzdHJh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Im51bWJlclwiLCB7XG4gICAgICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwic2Vyd2lzdC9zdHJhdGVnaWVzXCIsXG4gICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogdGhpcy5jb25zdHJ1Y3Rvci5uYW1lLFxuICAgICAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJjb25zdHJ1Y3RvclwiLFxuICAgICAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwibmV0d29ya1RpbWVvdXRTZWNvbmRzXCJcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbiAgICBhc3luYyBfaGFuZGxlKHJlcXVlc3QsIGhhbmRsZXIpIHtcbiAgICAgICAgY29uc3QgbG9ncyA9IFtdO1xuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBmaW5hbEFzc2VydEV4cG9ydHMuaXNJbnN0YW5jZShyZXF1ZXN0LCBSZXF1ZXN0LCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJzZXJ3aXN0L3N0cmF0ZWdpZXNcIixcbiAgICAgICAgICAgICAgICBjbGFzc05hbWU6IHRoaXMuY29uc3RydWN0b3IubmFtZSxcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJoYW5kbGVcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwibWFrZVJlcXVlc3RcIlxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgcHJvbWlzZXMgPSBbXTtcbiAgICAgICAgbGV0IHRpbWVvdXRJZDtcbiAgICAgICAgaWYgKHRoaXMuX25ldHdvcmtUaW1lb3V0U2Vjb25kcykge1xuICAgICAgICAgICAgY29uc3QgeyBpZCwgcHJvbWlzZSB9ID0gdGhpcy5fZ2V0VGltZW91dFByb21pc2Uoe1xuICAgICAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICAgICAgbG9ncyxcbiAgICAgICAgICAgICAgICBoYW5kbGVyXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIHRpbWVvdXRJZCA9IGlkO1xuICAgICAgICAgICAgcHJvbWlzZXMucHVzaChwcm9taXNlKTtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCBuZXR3b3JrUHJvbWlzZSA9IHRoaXMuX2dldE5ldHdvcmtQcm9taXNlKHtcbiAgICAgICAgICAgIHRpbWVvdXRJZCxcbiAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICBsb2dzLFxuICAgICAgICAgICAgaGFuZGxlclxuICAgICAgICB9KTtcbiAgICAgICAgcHJvbWlzZXMucHVzaChuZXR3b3JrUHJvbWlzZSk7XG4gICAgICAgIGNvbnN0IHJlc3BvbnNlID0gYXdhaXQgaGFuZGxlci53YWl0VW50aWwoKGFzeW5jICgpPT57XG4gICAgICAgICAgICByZXR1cm4gYXdhaXQgaGFuZGxlci53YWl0VW50aWwoUHJvbWlzZS5yYWNlKHByb21pc2VzKSkgfHwgYXdhaXQgbmV0d29ya1Byb21pc2U7XG4gICAgICAgIH0pKCkpO1xuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBDb2xsYXBzZWQobWVzc2FnZXMuc3RyYXRlZ3lTdGFydCh0aGlzLmNvbnN0cnVjdG9yLm5hbWUsIHJlcXVlc3QpKTtcbiAgICAgICAgICAgIGZvciAoY29uc3QgbG9nIG9mIGxvZ3Mpe1xuICAgICAgICAgICAgICAgIGxvZ2dlci5sb2cobG9nKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG1lc3NhZ2VzLnByaW50RmluYWxSZXNwb25zZShyZXNwb25zZSk7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBFbmQoKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIXJlc3BvbnNlKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwibm8tcmVzcG9uc2VcIiwge1xuICAgICAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmxcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXNwb25zZTtcbiAgICB9XG4gICAgX2dldFRpbWVvdXRQcm9taXNlKHsgcmVxdWVzdCwgbG9ncywgaGFuZGxlciB9KSB7XG4gICAgICAgIGxldCB0aW1lb3V0SWQ7XG4gICAgICAgIGNvbnN0IHRpbWVvdXRQcm9taXNlID0gbmV3IFByb21pc2UoKHJlc29sdmUpPT57XG4gICAgICAgICAgICBjb25zdCBvbk5ldHdvcmtUaW1lb3V0ID0gYXN5bmMgKCk9PntcbiAgICAgICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ3MucHVzaChgVGltaW5nIG91dCB0aGUgbmV0d29yayByZXNwb25zZSBhdCAke3RoaXMuX25ldHdvcmtUaW1lb3V0U2Vjb25kc30gc2Vjb25kcy5gKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmVzb2x2ZShhd2FpdCBoYW5kbGVyLmNhY2hlTWF0Y2gocmVxdWVzdCkpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIHRpbWVvdXRJZCA9IHNldFRpbWVvdXQob25OZXR3b3JrVGltZW91dCwgdGhpcy5fbmV0d29ya1RpbWVvdXRTZWNvbmRzICogMTAwMCk7XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgcHJvbWlzZTogdGltZW91dFByb21pc2UsXG4gICAgICAgICAgICBpZDogdGltZW91dElkXG4gICAgICAgIH07XG4gICAgfVxuICAgIGFzeW5jIF9nZXROZXR3b3JrUHJvbWlzZSh7IHRpbWVvdXRJZCwgcmVxdWVzdCwgbG9ncywgaGFuZGxlciB9KSB7XG4gICAgICAgIGxldCBlcnJvciA9IHVuZGVmaW5lZDtcbiAgICAgICAgbGV0IHJlc3BvbnNlID0gdW5kZWZpbmVkO1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgcmVzcG9uc2UgPSBhd2FpdCBoYW5kbGVyLmZldGNoQW5kQ2FjaGVQdXQocmVxdWVzdCk7XG4gICAgICAgIH0gY2F0Y2ggKGZldGNoRXJyb3IpIHtcbiAgICAgICAgICAgIGlmIChmZXRjaEVycm9yIGluc3RhbmNlb2YgRXJyb3IpIHtcbiAgICAgICAgICAgICAgICBlcnJvciA9IGZldGNoRXJyb3I7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRpbWVvdXRJZCkge1xuICAgICAgICAgICAgY2xlYXJUaW1lb3V0KHRpbWVvdXRJZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgaWYgKHJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgbG9ncy5wdXNoKFwiR290IHJlc3BvbnNlIGZyb20gbmV0d29yay5cIik7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGxvZ3MucHVzaChcIlVuYWJsZSB0byBnZXQgYSByZXNwb25zZSBmcm9tIHRoZSBuZXR3b3JrLiBXaWxsIHJlc3BvbmQgXCIgKyBcIndpdGggYSBjYWNoZWQgcmVzcG9uc2UuXCIpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmIChlcnJvciB8fCAhcmVzcG9uc2UpIHtcbiAgICAgICAgICAgIHJlc3BvbnNlID0gYXdhaXQgaGFuZGxlci5jYWNoZU1hdGNoKHJlcXVlc3QpO1xuICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZSkge1xuICAgICAgICAgICAgICAgICAgICBsb2dzLnB1c2goYEZvdW5kIGEgY2FjaGVkIHJlc3BvbnNlIGluIHRoZSAnJHt0aGlzLmNhY2hlTmFtZX0nIGNhY2hlLmApO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ3MucHVzaChgTm8gcmVzcG9uc2UgZm91bmQgaW4gdGhlICcke3RoaXMuY2FjaGVOYW1lfScgY2FjaGUuYCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXNwb25zZTtcbiAgICB9XG59XG5cbmNsYXNzIE5ldHdvcmtPbmx5IGV4dGVuZHMgU3RyYXRlZ3kge1xuICAgIF9uZXR3b3JrVGltZW91dFNlY29uZHM7XG4gICAgY29uc3RydWN0b3Iob3B0aW9ucyA9IHt9KXtcbiAgICAgICAgc3VwZXIob3B0aW9ucyk7XG4gICAgICAgIHRoaXMuX25ldHdvcmtUaW1lb3V0U2Vjb25kcyA9IG9wdGlvbnMubmV0d29ya1RpbWVvdXRTZWNvbmRzIHx8IDA7XG4gICAgfVxuICAgIGFzeW5jIF9oYW5kbGUocmVxdWVzdCwgaGFuZGxlcikge1xuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBmaW5hbEFzc2VydEV4cG9ydHMuaXNJbnN0YW5jZShyZXF1ZXN0LCBSZXF1ZXN0LCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJzZXJ3aXN0L3N0cmF0ZWdpZXNcIixcbiAgICAgICAgICAgICAgICBjbGFzc05hbWU6IHRoaXMuY29uc3RydWN0b3IubmFtZSxcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJfaGFuZGxlXCIsXG4gICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcInJlcXVlc3RcIlxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgbGV0IGVycm9yID0gdW5kZWZpbmVkO1xuICAgICAgICBsZXQgcmVzcG9uc2U7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBjb25zdCBwcm9taXNlcyA9IFtcbiAgICAgICAgICAgICAgICBoYW5kbGVyLmZldGNoKHJlcXVlc3QpXG4gICAgICAgICAgICBdO1xuICAgICAgICAgICAgaWYgKHRoaXMuX25ldHdvcmtUaW1lb3V0U2Vjb25kcykge1xuICAgICAgICAgICAgICAgIGNvbnN0IHRpbWVvdXRQcm9taXNlID0gdGltZW91dCh0aGlzLl9uZXR3b3JrVGltZW91dFNlY29uZHMgKiAxMDAwKTtcbiAgICAgICAgICAgICAgICBwcm9taXNlcy5wdXNoKHRpbWVvdXRQcm9taXNlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJlc3BvbnNlID0gYXdhaXQgUHJvbWlzZS5yYWNlKHByb21pc2VzKTtcbiAgICAgICAgICAgIGlmICghcmVzcG9uc2UpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYFRpbWVkIG91dCB0aGUgbmV0d29yayByZXNwb25zZSBhZnRlciAke3RoaXMuX25ldHdvcmtUaW1lb3V0U2Vjb25kc30gc2Vjb25kcy5gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgICBpZiAoZXJyIGluc3RhbmNlb2YgRXJyb3IpIHtcbiAgICAgICAgICAgICAgICBlcnJvciA9IGVycjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBDb2xsYXBzZWQobWVzc2FnZXMuc3RyYXRlZ3lTdGFydCh0aGlzLmNvbnN0cnVjdG9yLm5hbWUsIHJlcXVlc3QpKTtcbiAgICAgICAgICAgIGlmIChyZXNwb25zZSkge1xuICAgICAgICAgICAgICAgIGxvZ2dlci5sb2coXCJHb3QgcmVzcG9uc2UgZnJvbSBuZXR3b3JrLlwiKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgbG9nZ2VyLmxvZyhcIlVuYWJsZSB0byBnZXQgYSByZXNwb25zZSBmcm9tIHRoZSBuZXR3b3JrLlwiKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG1lc3NhZ2VzLnByaW50RmluYWxSZXNwb25zZShyZXNwb25zZSk7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBFbmQoKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIXJlc3BvbnNlKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwibm8tcmVzcG9uc2VcIiwge1xuICAgICAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXG4gICAgICAgICAgICAgICAgZXJyb3JcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXNwb25zZTtcbiAgICB9XG59XG5cbmV4cG9ydCB7IE5ldHdvcmtPbmx5IGFzIE4sIFN0cmF0ZWd5IGFzIFMsIE5ldHdvcmtGaXJzdCBhcyBhLCBTdHJhdGVneUhhbmRsZXIgYXMgYiwgY2FjaGVPa0FuZE9wYXF1ZVBsdWdpbiBhcyBjLCBtZXNzYWdlcyBhcyBtIH07XG4iXSwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiIn0=\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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vc2Vyd2lzdEA5LjAuMC1wcmV2aWV3LjI0X3R5cGVzY3JpcHRANS40LjUvbm9kZV9tb2R1bGVzL3Nlcndpc3QvZGlzdC9jaHVua3MvUHJlY2FjaGVGYWxsYmFja1BsdWdpbi5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7QUFBNkg7QUFDdEQ7QUFDMUM7O0FBRTdCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO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cIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJwdXNoRW50cnlcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwiZW50cnlcIlxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBmaW5hbEFzc2VydEV4cG9ydHMuaXNUeXBlKGVudHJ5LnJlcXVlc3REYXRhLCBcIm9iamVjdFwiLCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJzZXJ3aXN0L3BsdWdpbnNcIixcbiAgICAgICAgICAgICAgICBjbGFzc05hbWU6IFwiQmFja2dyb3VuZFN5bmNRdWV1ZVN0b3JlXCIsXG4gICAgICAgICAgICAgICAgZnVuY05hbWU6IFwicHVzaEVudHJ5XCIsXG4gICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcImVudHJ5LnJlcXVlc3REYXRhXCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGRlbGV0ZSBlbnRyeS5pZDtcbiAgICAgICAgZW50cnkucXVldWVOYW1lID0gdGhpcy5fcXVldWVOYW1lO1xuICAgICAgICBhd2FpdCB0aGlzLl9xdWV1ZURiLmFkZEVudHJ5KGVudHJ5KTtcbiAgICB9XG4gICAgYXN5bmMgdW5zaGlmdEVudHJ5KGVudHJ5KSB7XG4gICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgIGZpbmFsQXNzZXJ0RXhwb3J0cy5pc1R5cGUoZW50cnksIFwib2JqZWN0XCIsIHtcbiAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiBcInNlcndpc3QvcGx1Z2luc1wiLFxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJCYWNrZ3JvdW5kU3luY1F1ZXVlU3RvcmVcIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJ1bnNoaWZ0RW50cnlcIixcbiAgICAgICAgICAgICAgICBwYXJh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WV1ZVwiLFxuICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcInB1c2hSZXF1ZXN0XCIsXG4gICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcImVudHJ5XCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmlzSW5zdGFuY2UoZW50cnkucmVxdWVzdCwgUmVxdWVzdCwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwic2Vyd2lzdC9wbHVnaW5zXCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIkJhY2tncm91bmRTeW5jUXVldWVcIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJwdXNoUmVxdWVzdFwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJlbnRyeS5yZXF1ZXN0XCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGF3YWl0IHRoaXMuX2FkZFJlcXVlc3QoZW50cnksIFwicHVzaFwiKTtcbiAgICB9XG4gICAgYXN5bmMgdW5zaGlmdFJlcXVlc3QoZW50cnkpIHtcbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmlzVHlwZShlbnRyeSwgXCJvYmplY3RcIiwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwic2Vyd2lzdC9wbHVnaW5zXCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIkJhY2tncm91bmRTeW5jUXVldWVcIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJ1bnNoaWZ0UmVxdWVzdFwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJlbnRyeVwiXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGZpbmFsQXNzZXJ0RXhwb3J0cy5pc0luc3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QgZm9yICcke3RoaXMuX25hbWV9Jy5gLCBlcnIpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbiAgICBfYWRkU3luY0xpc3RlbmVyKCkge1xuICAgICAgICBpZiAoXCJzeW5jXCIgaW4gc2VsZi5yZWdpc3RyYXRpb24gJiYgIXRoaXMuX2ZvcmNlU3luY0ZhbGxiYWNrKSB7XG4gICAgICAgICAgICBzZWxmLmFkZEV2ZW50TGlzdGVuZXIoXCJzeW5jXCIsIChldmVudCk9PntcbiAgICAgICAgICAgICAgICBpZiAoZXZlbnQudGFnID09PSBgJHtUQUdfUFJFRklYfToke3RoaXMuX25hbWV9YCkge1xuICAgICAgICAgICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsb2dnZXIubG9nKGBCYWNrZ3JvdW5kIHN5bmMgZm9yIHRhZyAnJHtldmVudC50YWd9JyBoYXMgYmVlbiByZWNlaXZlZGApO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHN5bmNDb21wbGV0ZSA9IGFzeW5jICgpPT57XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9zeW5jSW5Qcm9ncmVzcyA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgc3luY0Vycm9yID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCB0aGlzLl9vblN5bmMoe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBxdWV1ZTogdGhpc1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXJyb3IgaW5zdGFuY2VvZiBFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzeW5jRXJyb3IgPSBlcnJvcjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgc3luY0Vycm9yO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseXtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5fcmVxdWVzdHNBZGRlZER1cmluZ1N5bmMgJiYgIShzeW5jRXJyb3IgJiYgIWV2ZW50Lmxhc3RDaGFuY2UpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IHRoaXMucmVnaXN0ZXJTeW5jKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3N5bmNJblByb2dyZXNzID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fcmVxdWVzdHNBZGRlZER1cmluZ1N5bmMgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAgICAgZXZlbnQud2FpdFVudGlsKHN5bmNDb21wbGV0ZSgpKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICBsb2dnZXIubG9nKFwiQmFja2dyb3VuZCBzeW5jIHJlcGxheWluZyB3aXRob3V0IGJhY2tncm91bmQgc3luYyBldmVudFwiKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZvaWQgdGhpcy5fb25TeW5jKHtcbi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AgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAodHlwZW9mIGNvbmZpZy5oaXRGaWx0ZXIgPT09IFwiZnVuY3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICBjb25maWcuaGl0RmlsdGVyLmNhbGwobnVsbCwgcGFyYW1zKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYXdhaXQgZmV0Y2gobmV3IFJlcXVlc3QodXJsLm9yaWdpbiArIHVybC5wYXRobmFtZSwge1xuICAgICAgICAgICAgICAgICAgICBib2R5OiBwYXJhbXMudG9TdHJpbmcoKSxcbiAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiBcIlBPU1RcIixcbiAgICAgICAgICAgICAgICAgICAgbW9kZTogXCJjb3JzXCIsXG4gICAgICAgICAgICAgICAgICAgIGNyZWRlbnRpYWxzOiBcIm9taXRcIixcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJDb250ZW50LVR5cGVcIjogXCJ0ZXh0L3BsYWluXCJcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ2dlci5sb2coYFJlcXVlc3QgZm9yICcke2dldEZyaWVuZGx5VVJMKHVybC5ocmVmKX0nIGhhcyBiZWVuIHJlcGxheWVkYCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgICAgICAgYXdhaXQgcXVldWUudW5zaGlmdFJlcXVlc3QoZW50cnkpO1xuICAgICAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICA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hbGxiYWNrID09PSBcInN0cmluZ1wiKSB7XG4gICAgICAgICAgICAgICAgY29uc3QgZmFsbGJhY2tSZXNwb25zZSA9IGF3YWl0IHRoaXMuX3Nlcndpc3QubWF0Y2hQcmVjYWNoZShmYWxsYmFjayk7XG4gICAgICAgICAgICAgICAgaWYgKGZhbGxiYWNrUmVzcG9uc2UgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsbGJhY2tSZXNwb25zZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGZhbGxiYWNrLm1hdGNoZXIocGFyYW0pKSB7XG4gICAgICAgICAgICAgICAgY29uc3QgZmFsbGJhY2tSZXNwb25zZSA9IGF3YWl0IHRoaXMuX3Nlcndpc3QubWF0Y2hQcmVjYWNoZShmYWxsYmFjay51cmwpO1xuICAgICAgICAgICAgICAgIGlmIChmYWxsYmFja1Jlc3BvbnNlICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbGxiYWNrUmVzcG9uc2U7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiB1bmRlZmluZWQ7XG4gICAgfVxufVxuXG5leHBvcnQgeyBCYWNrZ3JvdW5kU3luY1BsdWdpbiBhcyBCLCBQcmVjYWNoZUZhbGxiYWNrUGx1Z2luIGFzIFAsIFF1ZXVlIGFzIFEsIFJvdXRlIGFzIFIsIFN0b3JhYmxlUmVxdWVzdCBhcyBTLCBRdWV1ZVN0b3JlIGFzIGEsIGRlZmF1bHRNZXRob2QgYXMgZCwgaW5pdGlhbGl6ZSBhcyBpLCBub3JtYWxpemVIYW5kbGVyIGFzIG4gfTtcbiJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vc2Vyd2lzdEA5LjAuMC1wcmV2aWV3LjI0X3R5cGVzY3JpcHRANS40LjUvbm9kZV9tb2R1bGVzL3Nlcndpc3QvZGlzdC9jaHVua3MvU2Vyd2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Bub3QgYmVpbmcgdXNlZCwgc2luY2UgdGhlIFVSTCBiZWluZyBuYXZpZ2F0ZWQgdG8gZG9lc24ndCBtYXRjaCB0aGUgYWxsb3dsaXN0LmApO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9XG59XG5cbmNsYXNzIFJlZ0V4cFJvdXRlIGV4dGVuZHMgUm91dGUge1xuICAgIGNvbnN0cnVjdG9yKHJlZ0V4cCwgaGFuZGxlciwgbWV0aG9kKXtcbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmlzSW5zdGFuY2UocmVnRXhwLCBSZWdFeHAsIHtcbiAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiBcInNlcndpc3RcIixcbiAgICAgICAgICAgICAgICBjbGFzc05hbWU6IFwiUmVnRXhwUm91dGVcIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJjb25zdHJ1Y3RvclwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJwYXR0ZXJuXCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IG1hdGNoID0gKHsgdXJsIH0pPT57XG4gICAgICAgICAgICBjb25zdCByZXN1bHQgPSByZWdFeHAuZXhlYyh1cmwuaHJlZik7XG4gICAgICAgICAgICBpZiAoIXJlc3VsdCkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh1cmwub3JpZ2luICE9PSBsb2NhdGlvbi5vcmlnaW4gJiYgcmVzdWx0LmluZGV4ICE9PSAwKSB7XG4gICAgICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICBsb2dnZXIuZGVidWcoYFRoZS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VLZXkgPSB1cmxzVG9DYWNoZUtleXMuZ2V0KHBvc3NpYmxlVVJMKTtcbiAgICAgICAgICAgICAgICBpZiAoY2FjaGVLZXkpIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgaW50ZWdyaXR5ID0gc2Vyd2lzdC5nZXRJbnRlZ3JpdHlGb3JQcmVjYWNoZUtleShjYWNoZUtleSk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjYWNoZUtleSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGludGVncml0eVxuICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICBsb2dnZXIuZGVidWcoYFByZWNhY2hpbmcgZGlkIG5vdCBmaW5kIGEgbWF0Y2ggZm9yICR7Z2V0RnJpZW5kbHlVUkwocmVxdWVzdC51cmwpfS5gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfTtcbiAgICAgICAgc3VwZXIobWF0Y2gsIHNlcndpc3QucHJlY2FjaGVTdHJhdGVneSk7XG4gICAgfVxufVxuXG5jbGFzcyBQcmVjYWNoZVN0cmF0ZWd5IGV4dGVuZHMgU3RyYXRlZ3kge1xuICAgIF9mYWxsYmFja1RvTmV0d29yaztcbiAgICBzdGF0aWMgZGVmYXVsdFByZWNhY2hlQ2FjaGVhYmlsaXR5UGx1Z2luID0ge1xuICAgICAgICBhc3luYyBjYWNoZVdpbGxVcGRhdGUgKHsgcmVzcG9uc2UgfSkge1xuICAgICAgICAgICAgaWYgKCFyZXNwb25zZSB8fCByZXNwb25zZS5zdGF0dXMgPj0gNDAwKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7XG4gICAgICAgICAgICB9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ICAgICAgICBpbnRlZ3JpdHk6IHJlcXVlc3QubW9kZSAhPT0gXCJuby1jb3JzXCIgPyBpbnRlZ3JpdHlJblJlcXVlc3QgfHwgaW50ZWdyaXR5SW5NYW5pZmVzdCA6IHVuZGVmaW5lZFxuICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgaWYgKGludGVncml0eUluTWFuaWZlc3QgJiYgbm9JbnRlZ3JpdHlDb25mbGljdCAmJiByZXF1ZXN0Lm1vZGUgIT09IFwibm8tY29yc1wiKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5fdXNlRGVmYXVsdENhY2hlYWJpbGl0eVBsdWdpbklmTmVlZGVkKCk7XG4gICAgICAgICAgICAgICAgY29uc3Qgd2FzQ2FjaGVkID0gYXdhaXQgaGFuZGxlci5jYWNoZVB1dChyZXF1ZXN0LCByZXNwb25zZS5jbG9uZSgpKTtcbiAgICAgICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICh3YXNDYWNoZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZ2dlci5sb2coYEEgcmVzcG9uc2UgZm9yICR7Z2V0RnJpZW5kbHlVUkwocmVxdWVzdC51cmwpfSB3YXMgdXNlZCB0byBcInJlcGFpclwiIHRoZSBwcmVjYWNoZS5gKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBTZXJ3aXN0RXJyb3IoXCJtaXNzaW5nLXByZWNhY2hlLWVudHJ5XCIsIHtcbiAgICAgICAgICAgICAgICBjYWNoZU5hbWU6IHRoaXMuY2FjaGVOYW1lLFxuICAgICAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmxcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgI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wKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwiaW52YWxpZC1jYWNoZS1uYW1lXCIsIHtcbiAgICAgICAgICAgICAgICBjYWNoZU5hbWVJZDogXCJwcmVjYWNoZVwiLFxuICAgICAgICAgICAgICAgIHZhbHVlOiBkZXRhaWxzLnByZWNhY2hlXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoZGV0YWlscy5ydW50aW1lPy5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBTZXJ3aXN0RXJyb3IoXCJpbnZhbGlkLWNhY2hlLW5hbWVcIiwge1xuICAgICAgICAgICAgICAgIGNhY2hlTmFtZUlkOiBcInJ1bnRpbWVcIixcbiAgICAgICAgICAgICAgICB2YWx1ZTogZGV0YWlscy5ydW50aW1lXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoZGV0YWlscy5nb29nbGVBbmFseXRpY3M/Lmxlbmd0aCA9PT0gMCkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IFNlcndpc3RFcnJvcihcImludmFsaWQtY2FjaGUtbmFtZVwiLCB7XG4gICAgICAgICAgICAgICAgY2FjaGVOYW1lSWQ6IFwiZ29vZ2xlQW5hbHl0aWNzXCIsXG4gICAgICAgICAgICAgICAgdmFsdWU6IGRldGFpbHMuZ29vZ2xlQW5hbHl0aWNzXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgIH1cbiAgICBjYWNoZU5hbWVzLnVwZGF0ZURldGFpbHMoZGV0YWlscyk7XG59O1xuXG5jb25zdCBwYXJhbGxlbCA9IGFzeW5jIChsaW1pdCwgYXJyYXksIGZ1bmMpPT57XG4gICAgY29uc3Qgd29yayA9IGFycmF5Lm1hcCgoaXRlbSwgaW5kZXgpPT4oe1xuICAgICAgICAgICAgaW5kZXgsXG4gICAgICAgICAgICBpdGVtXG4gICAgICAgIH0pKTtcbiAgICBjb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gICAgICB0aGlzLmhhbmRsZUNhY2hlID0gdGhpcy5oYW5kbGVDYWNoZS5iaW5kKHRoaXMpO1xuICAgICAgICBpZiAoISFpbXBvcnRTY3JpcHRzICYmIGltcG9ydFNjcmlwdHMubGVuZ3RoID4gMCkgc2VsZi5pbXBvcnRTY3JpcHRzKC4uLmltcG9ydFNjcmlwdHMpO1xuICAgICAgICBpZiAobmF2aWdhdGlvblByZWxvYWQpIGVuYWJsZU5hdmlnYXRpb25QcmVsb2FkKCk7XG4gICAgICAgIGlmIChjYWNoZUlkICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIHNldENhY2hlTmFtZURldGFpbHMoe1xuICAgICAgICAgICAgICAgIHByZWZpeDogY2FjaGVJZFxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHNraXBXYWl0aW5nKSB7XG4gICAgICAgICAgICBzZWxmLnNraXBXYWl0aW5nKCk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBzZWxmLmFkZEV2ZW50TGlzdGVuZXIoXCJtZXNzYWdlXCIsIChldmVudCk9PntcbiAgICAgICAgICAgICAgICBpZiAoZXZlbnQuZGF0YSAmJiBldmVudC5kYXRhLnR5cGUgPT09IFwiU0tJUF9XQUlUSU5HXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5za2lwV2FpdGluZygpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChjbGllbnRzQ2xhaW0kMSkgY2xpZW50c0NsYWltKCk7XG4gICAgICAgIHRoaXMucmVnaXN0ZXJSb3V0ZShuZXcgUHJlY2FjaGVSb3V0ZSh0aGlzLCBwcmVjYWNoZU9wdGlvbnMpKTtcbiAgICAgICAgaWYgKCEhcHJlY2FjaGVFbnRyaWVzICYmIHByZWNhY2hlRW50cmllcy5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICB0aGlzLmFkZFRvUHJlY2FjaGVMaXN0KHByZWNhY2hlRW50cmllcyk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGNsZWFudXBPdXRkYXRlZENhY2hlcyQxKSB7XG4gICAgICAgICAgICBjbGVhbnVwT3V0ZGF0ZWRDYWNoZXMocHJlY2FjaGVPcHRpb25zPy5jYWNoZU5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChuYXZpZ2F0ZUZhbGxiYWNrKSB7XG4gICAgICAgICAgICB0aGlzLnJlZ2lzdGVyUm91dGUobmV3IE5hdmlnYXRpb25Sb3V0ZSh0aGlzLmNyZWF0ZUhhbmRsZXJCb3VuZFRvVXJsKG5hdmlnYXRlRmFsbGJhY2spLCB7XG4gICAgICAgICAgICAgICAgYWxsb3dsaXN0OiBuYXZpZ2F0ZUZhbGxiYWNrQWxsb3dsaXN0LFxuICAgICAgICAgICAgICAgIGRlbnlsaXN0OiBuYXZpZ2F0ZUZhbGxiYWNrRGVueWxpc3RcbiAgICAgICAgICAgIH0pKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAob2ZmbGluZUFuYWx5dGljc0NvbmZpZyAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICBpZiAodHlwZW9mIG9mZmxpbmVBbmFseXRpY3NDb25maWcgPT09IFwiYm9vbGVhblwiKSB7XG4gICAgICAgICAgICAgICAgb2ZmbGluZUFuYWx5dGljc0NvbmZpZyAmJiBpbml0aWFsaXplKHtcbiAgICAgICAgICAgICAgICAgICAgc2Vyd2lzdDogdGhpc1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBpbml0aWFsaXplKHtcbiAgICAgICAgICAgICAgICAgICAgLi4ub2ZmbGluZUFuYWx5dGljc0NvbmZpZyxcbiAgICAgICAgICAgICAgICAgICAgc2Vyd2lzdDogdGhpc1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmIChydW50aW1lQ2FjaGluZyAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICBpZiAoZmFsbGJhY2tzICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICBjb25zdCBmYWxsYmFja1BsdWdpbiA9IG5ldyBQcmVjYWNoZUZhbGxiYWNrUGx1Z2luKHtcbiAgICAgICAgICAgICAgICAgICAgZmFsbGJhY2tVcmxzOiBmYWxsYmFja3MuZW50cmllcyxcbiAgICAgICAgICAgICAgICAgICAgc2Vyd2lzdDogdGhpc1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIHJ1bnRpbWVDYWNoaW5nLmZvckVhY2goKGNhY2hlRW50cnkpPT57XG4gICAgICAgICAgICAgICAgICAgIGlmIChjYWNoZUVudHJ5LmhhbmRsZXIgaW5zdGFuY2VvZiBTdHJhdGVneSAmJiAhY2FjaGVFbnRyeS5oYW5kbGVyLnBsdWdpbnMuc29tZSgocGx1Z2luKT0+XCJoYW5kbGVyRGlkRXJyb3JcIiBpbiBwbHVnaW4pKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjYWNoZUVudHJ5LmhhbmRsZXIucGx1Z2lucy5wdXNoKGZhbGxiYWNrUGx1Z2luKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZm9yIChjb25zdCBlbnRyeSBvZiBydW50aW1lQ2FjaGluZyl7XG4gICAgICAgICAgICAgICAgdGhpcy5yZWdpc3RlckNhcHR1cmUoZW50cnkubWF0Y2hlciwgZW50cnkuaGFuZGxlciwgZW50cnkubWV0aG9kKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoZGlzYWJsZURldkxvZ3MkMSkgZGlzYWJsZURldkxvZ3MoKTtcbiAgICB9XG4gICAgZ2V0IHByZWNhY2hlU3RyYXRlZ3koKSB7XG4gICAgICAgIHJldHV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l9jYWNoZUtleXNUb0ludGVncml0aWVzLmdldChjYWNoZUtleSkgIT09IGVudHJ5LmludGVncml0eSkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwiYWRkLXRvLWNhY2hlLWxpc3QtY29uZmxpY3RpbmctaW50ZWdyaXRpZXNcIiwge1xuICAgICAgICAgICAgICAgICAgICAgICAgdXJsXG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB0aGlzLl9jYWNoZUtleXNUb0ludGVncml0aWVzLnNldChjYWNoZUtleSwgZW50cnkuaW50ZWdyaXR5KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRoaXMuX3VybHNUb0NhY2hlS2V5cy5zZXQodXJsLCBjYWNoZUtleSk7XG4gICAgICAgICAgICB0aGlzLl91cmxzVG9DYWNoZU1vZGVzLnNldCh1cmwsIGNhY2hlTW9kZSk7XG4gICAgICAgICAgICBpZiAodXJsc1RvV2FybkFib3V0Lmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICBjb25zdCB3YXJuaW5nTWVzc2FnZSA9IGBTZXJ3aXN0IGlzIHByZWNhY2hpbmcgVVJMcyB3aXRob3V0IHJldmlzaW9uIGluZm86ICR7dXJsc1RvV2FybkFib3V0LmpvaW4oXCIsIFwiKX1cXG5UaGlzIGlzIGdlbmVyYWxseSBOT1Qgc2FmZS4gTGVhcm4gbW9yZSBhdCBodHRwczovL2JpdC5seS93Yi1wcmVjYWNoZWA7XG4gICAgICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WID09PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICBjb25zb2xlLndhcm4od2FybmluZ01lc3NhZ2UpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ2dlci53YXJuKHdhcm5pbmdNZXNzYWdlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG4gICAgaGFuZGxlSW5zdGFsbChldmVudCkge1xuICAgICAgICByZXR1cm4gd2FpdFVudGlsKGV2ZW50LCBhc3luYyAoKT0+e1xuICAgICAgICAgICAgY29uc3QgaW5zdGFsbFJlcG9ydFBsdWdpbiA9IG5ldyBQcmVjYWNoZUluc3RhbGxSZXBvcnRQbHVnaW4oKTtcbiAgICAgICAgICAgIHRoaXMucHJlY2FjaGVTdHJhdGVneS5wbHVnaW5zLnB1c2goaW5zdGFsbFJlcG9ydFBsdWdpbik7XG4gICAgICAgICAgICBhd2FpdCBwYXJhbGxlbCh0aGlzLl9jb25jdXJyZW50UHJlY2FjaGluZywgQXJyYXkuZnJvbSh0aGlzLl91cmxzVG9DYWNoZUtleXMuZW50cmllcygpKSwgYXN5bmMgKFt1cmwsIGNhY2hlS2V5XSk9PntcbiAgICAgICAgICAgICAgICBjb25zdCBpbnRlZ3JpdHkgPSB0aGlzLl9jYWNoZUtleXNUb0ludGVncml0aWVzLmdldChjYWNoZUtleSk7XG4gICAgICAgICAgICAgICAgY29uc3QgY2FjaGVNb2RlID0gdGhpcy5fdXJsc1RvQ2FjaGVNb2Rlcy5nZXQodXJsKTtcbiAgICAgICAgICAgICAgICBjb25zdCByZXF1ZXN0ID0gbmV3IFJlcXVlc3QodXJsLCB7XG4gICAgICAgICAgICAgICAgICAgIGludGVncml0eSxcbiAgICAgICAgICAgICAgICAgICAgY2FjaGU6IGNhY2hlTW9kZSxcbiAgICAgICAgICAgICAgICAgICAgY3JlZGVudGlhbHM6IFwic2FtZS1vcmlnaW5cIlxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIGF3YWl0IFByb21pc2UuYWxsKHRoaXMucHJlY2FjaGVTdHJhdGVneS5oYW5kbGVBbGwoe1xuICAgICAgICAgICAgICAgICAgICBldmVudCxcbiAgICAgICAgICAgICAgICAgICAgcmVxdWVzdCxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBuZXcgVVJMKHJlcXVlc3QudXJsKSxcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjYWNoZUtleVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBjb25zdCB7IHVwZGF0ZWRVUkxzLCBub3RVcGRhdGVkVVJMcyB9ID0gaW5zdGFsbFJlcG9ydFBsdWdpbjtcbiAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICBwcmludEluc3RhbGxEZXRhaWxzKHVwZGF0ZWRVUkxzLCBub3RVcGRhdGVkVVJMcyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIHVwZGF0ZWRVUkxzLFxuICAgICAgICAgICAgICAgIG5vdFVwZGF0ZWRVUkxzXG4gICAgICAgICAgICB9O1xuICAgICAgICB9KTtcbiAgICB9XG4gICAgaGFuZGxlQWN0aXZhdGUoZXZlbnQpIHtcbiAgICAgICAgcmV0dXJuIHdhaXRVbnRpbChldmVudCwgYXN5bmMgKCk9PntcbiAgICAgICAgICAgIGNvbnN0IGNhY2hlID0gYXdhaXQgc2VsZi5jYWNoZXMub3Blbih0aGlzLnByZWNhY2hlU3RyYXRlZ3kuY2FjaGVOYW1lKTtcbiAgICAgICAgICAgIGNvbnN0IGN1cnJlbnRseUNhY2hlZFJlcXVlc3RzID0gYXdhaXQgY2FjaGUua2V5cygpO1xuICAgICAgICAgICAgY29uc3QgZXhwZWN0ZWRDYWNoZUtleXMgPSBuZXcgU2V0KHRoaXMuX3VybHNUb0NhY2hlS2V5cy52YWx1ZXMoKSk7XG4gICAgICAgICAgICBjb25zdCBkZWxldGVkQ2FjaGVSZXF1ZXN0cyA9IFtdO1xuICAgICAgICAgICAgZm9yIChjb25zdCByZXF1ZXN0IG9mIGN1cnJlbnRseUNhY2hlZFJlcXVlc3RzKXtcbiAgICAgICAgICAgICAgICBpZiAoIWV4cGVjdGVkQ2FjaGVLZXlzLmhhcyhyZXF1ZXN0LnVybCkpIHtcbiAgICAgICAgICAgICAgICAgICAgYXdhaXQgY2FjaGUuZGVsZXRlKHJlcXVlc3QpO1xuICAgICAgICAgICAgICAgICAgICBkZWxldGVkQ2FjaGVSZXF1ZXN0cy5wdXNoKHJlcXVlc3QudXJsKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgcHJpbnRDbGVhbnVwRGV0YWlscyhkZWxldGVkQ2FjaGVSZXF1ZXN0cyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIGRlbGV0ZWRDYWNoZVJlcXVlc3RzXG4gICAgICAgICAgICB9O1xuICAgICAgICB9KTtcbiAgICB9XG4gICAgaGFuZGxlRmV0Y2goZXZlbnQpIHtcbiAgICAgICAgY29uc3QgeyByZXF1ZXN0IH0gPSBldmVudDtcbiAgICAgICAgY29uc3QgcmVzcG9uc2VQcm9taXNlID0gdGhpcy5oYW5kbGVSZXF1ZXN0KHtcbiAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICBldmVudFxuICAgICAgICB9KTtcbiAgICAgICAgaWYgKHJlc3BvbnNlUHJvbWlzZSkge1xuICAgICAgICAgICAgZXZlbnQucmVzcG9uZFdpdGgocmVzcG9uc2VQcm9taXNlKTtcbiAgICAgICAgfVxuICAgIH1cbiAgICBoYW5kbGVDYWNoZShldmVudCkge1xuICAgICAgICBpZiAoZXZlbnQuZGF0YSAmJiBldmVudC5kYXRhLnR5cGUgPT09IFwiQ0FDSEVfVVJMU1wiKSB7XG4gICAgICAgICAgICBjb25zdCB7IHBheWxvYWQgfSA9IGV2ZW50LmRhdGE7XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgbG9nZ2VyLmRlYnVnKFwiQ2FjaGluZyBVUkxzIGZyb20gdGhlIHdpbmRvd1wiLCBwYXlsb2FkLnVybHNUb0NhY2hlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvbnN0IHJlcXVlc3RQcm9taXNlcyA9IFByb21pc2UuYWxsKHBheWxvYWQudXJsc1RvQ2FjaGUubWFwKChlbnRyeSk9PntcbiAgICAgICAgICAgICAgICBsZXQgcmVxdWVzdDtcbiAgICAgICAgICAgICAgICBpZiAodHlwZW9mIGVudHJ5ID09PSBcInN0cmluZ1wiKSB7XG4gICAgICAgICAgICAgICAgICAgIHJlcXVlc3QgPSBuZXcgUmVxdWVzdChlbnRyeSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmVxdWVzdCA9IG5ldyBSZXF1ZXN0KC4uLmVudHJ5KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaGFuZGxlUmVxdWVzdCh7XG4gICAgICAgICAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICAgICAgICAgIGV2ZW50XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9KSk7XG4gICAgICAgICAgICBldmVudC53YWl0VW50aWwocmVxdWVzdFByb21pc2VzKTtcbiAgICAgICAgICAgIGlmIChldmVudC5wb3J0cz8uWzBdKSB7XG4gICAgICAgICAgICAgICAgdm9pZCByZXF1ZXN0UHJvbWlzZXMudGhlbigoKT0+ZXZlbnQucG9ydHNbMF0ucG9zdE1lc3NhZ2UodHJ1ZSkpO1xuICAgICAg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gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJzZXJ3aXN0XCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIlNlcndpc3RcIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJyZWdpc3RlclJvdXRlXCIsXG4gICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcInJvdXRlXCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmlzVHlwZShyb3V0ZS5oYW5kbGVyLCBcIm9iamVjdFwiLCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJzZXJ3aXN0XCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIlNlcndpc3RcIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJyZWdpc3RlclJvdXRlXCIsXG4gICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcInJvdXRlXCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmhhc01ldGhvZChyb3V0ZS5oYW5kbGVyLCBcImhhbmRsZVwiLCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJzZXJ3aXN0XCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIlNlcndpc3RcIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJyZWdpc3RlclJvdXRlXCIsXG4gICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcInJvdXRlLmhhbmRsZXJcIlxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBmaW5hbEFzc2VydEV4cG9ydHMuaXNUeXBlKHJvdXRlLm1ldGhvZCwgXCJzdHJpbmdcIiwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwic2Vyd2lzdFwiLFxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJTZXJ3aXN0XCIsXG4gICAgICA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B0aGlzLmdldFByZWNhY2hlS2V5Rm9yVXJsKHVybCk7XG4gICAgICAgIGlmICghY2FjaGVLZXkpIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBTZXJ3aXN0RXJyb3IoXCJub24tcHJlY2FjaGVkLXVybFwiLCB7XG4gICAgICAgICAgICAgICAgdXJsXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gKG9wdGlvbnMpPT57XG4gICAgICAgICAgICBvcHRpb25zLnJlcXVlc3QgPSBuZXcgUmVxdWVzdCh1cmwpO1xuICAgICAgICAgICAgb3B0aW9ucy5wYXJhbXMgPSB7XG4gICAgICAgICAgICAgICAgY2FjaGVLZXksXG4gICAgICAgICAgICAgICAgLi4ub3B0aW9ucy5wYXJhbXNcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5wcmVjYWNoZVN0cmF0ZWd5LmhhbmRsZShvcHRpb25zKTtcbiAgICAgICAgfTtcbiAgICB9XG4gICAgaGFuZGxlUmVxdWVzdCh7IHJlcXVlc3QsIGV2ZW50IH0pIHtcbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmlzSW5zdGFuY2UocmVxdWVzdCwgUmVxdWVzdCwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwic2Vyd2lzdFwiLFxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJTZXJ3aXN0XCIsXG4gICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiaGFuZGxlUmVxdWVzdFwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJvcHRpb25zLnJlcXVlc3RcIlxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgdXJsID0gbmV3IFVSTChyZXF1ZXN0LnVybCwgbG9jYXRpb24uaHJlZik7XG4gICAgICAgIGlmICghdXJsLnByb3RvY29sLnN0YXJ0c1dpdGgoXCJodHRwXCIpKSB7XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgbG9nZ2VyLmRlYnVnKFwiUm91dGVyIG9ubHkgc3VwcG9ydHMgVVJMcyB0aGF0IHN0YXJ0IHdpdGggJ2h0dHAnLlwiKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCBzYW1lT3JpZ2luID0gdXJsLm9yaWdpbiA9PT0gbG9jYXRpb24ub3JpZ2luO1xuICAgICAgICBjb25zdCB7IHBhcmFtcywgcm91dGUgfSA9IHRoaXMuZmluZE1hdGNoaW5nUm91dGUoe1xuICAgICAgICAgICAgZXZlbnQsXG4gICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgc2FtZU9yaWdpbixcbiAgICAgICAgICAgIHVybFxuICAgICAgICB9KTtcbiAgICAgICAgbGV0IGhhbmRsZXIgPSByb3V0ZT8uaGFuZGxlcjtcbiAgICAgICAgY29uc3QgZGVidWdNZXNzYWdlcyA9IFtdO1xuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBpZiAoaGFuZGxlcikge1xuICAgICAgICAgICAgICAgIGRlYnVnTWVzc2FnZXMucHVzaChbXG4gICAgICAgICAgICAgICAgICAgIFwiRm91bmQgYSByb3V0ZSB0byBoYW5kbGUgdGhpcyByZXF1ZXN0OlwiLFxuICAgICAgICAgICAgICAgICAgICByb3V0ZVxuICAgICAgICAgICAgICAgIF0pO1xuICAgICAgICAgICAgICAgIGlmIChwYXJhbXMpIHtcbiAgICAgICAgICAgICAgICAgICAgZGVidWdNZXNzYWdlcy5wdXNoKFtcbiAgICAgICAgICAgICAgICAgICAgICAgIGBQYXNzaW5nIHRoZSBmb2xsb3dpbmcgcGFyYW1zIHRvIHRoZSByb3V0ZSdzIGhhbmRsZXI6YCxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtc1xuICAgICAgICAgICAgICAgICAgICBdKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgbWV0aG9kID0gcmVxdWVzdC5tZXRob2Q7XG4gICAgICAgIGlmICghaGFuZGxlciAmJiB0aGlzLl9kZWZhdWx0SGFuZGxlck1hcC5oYXMobWV0aG9kKSkge1xuICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgIGRlYnVnTWVzc2FnZXMucHVzaChgRmFpbGVkIHRvIGZpbmQgYSBtYXRjaGluZyByb3V0ZS4gRmFsbGluZyBiYWNrIHRvIHRoZSBkZWZhdWx0IGhhbmRsZXIgZm9yICR7bWV0aG9kfS5gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGhhbmRsZXIgPSB0aGlzLl9kZWZhdWx0SGFuZGxlck1hcC5nZXQobWV0aG9kKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIWhhbmRsZXIpIHtcbiAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICBsb2dnZXIuZGVidWcoYE5vIHJvdXRlIGZvdW5kIGZvcjogJHtnZXRGcmllbmRseVVSTCh1cmwpfWApO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgIGxvZ2dlci5ncm91cENvbGxhcHNlZChgUm91dGVyIGlzIHJlc3BvbmRpbmcgdG86ICR7Z2V0RnJpZW5kbHlVUkwodXJsKX1gKTtcbiAgICAgICAgICAgIGZvciAoY29uc3QgbXNnIG9mIGRlYnVnTWVzc2FnZXMpe1xuICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KG1zZykpIHtcbiAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmxvZyguLi5tc2cpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ2dlci5sb2cobXNnKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBFbmQoKTtcbiAgICAgICAgfVxuICAgICAgICBsZXQgcmVzcG9uc2VQcm9taXNlO1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgcmVzcG9uc2VQcm9taXNlID0gaGFuZGxlci5oYW5kbGUoe1xuICAgICAgICAgICAgICAgIHVybCxcbiAgICAgICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgICAgIGV2ZW50LFxuICAgICAgICAgICAgICAgIHBhcmFtc1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgcmVzcG9uc2VQcm9taXNlID0gUHJvbWlzZS5yZWplY3QoZXJyKTtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCBjYXRjaEhhbmRsZXIgPSByb3V0ZT8uY2F0Y2hIYW5kbGVyO1xuICAgICAgICBpZiAocmVzcG9uc2VQcm9taXNlIGluc3RhbmNlb2YgUHJvbWlzZSAmJiAodGhpcy5fY2F0Y2hIYW5kbGVyIHx8IGNhdGNoSGFuZGxlcikpIHtcbiAgICAgICAgICAgIHJlc3BvbnNlUHJvbWlzZSA9IHJlc3BvbnNlUHJvbWlzZS5jYXRjaChhc3luYyAoZXJyKT0+e1xuICAgICAgICAgICAgICAgIGlmIChjYXRjaEhhbmRsZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmdyb3VwQ29sbGFwc2VkKGBFcnJvciB0aHJvd24gd2hlbiByZXNwb25kaW5nIHRvOiAgJHtnZXRGcmllbmRseVVSTCh1cmwpfS4gRmFsbGluZyBiYWNrIHRvIHJvdXRlJ3MgQ2F0Y2ggSGFuZGxlci5gKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZ2dlci5lcnJvcihcIkVycm9yIHRocm93biBieTpcIiwgcm91dGUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmVycm9yKGVycik7XG4gICAgICAgICAgICAgICAgICAgICAgICBsb2dnZXIuZ3JvdXBFbmQoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGF3YWl0IGNhdGNoSGFuZGxlci5oYW5kbGUoe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtc1xuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGNhdGNoRXJyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2F0Y2hFcnIgaW5zdGFuY2VvZiBFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IGNhdGNoRXJyO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmICh0aGlzLl9jYXRjaEhhbmRsZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmdyb3VwQ29sbGFwc2VkKGBFcnJvciB0aHJvd24gd2hlbiByZXNwb25kaW5nIHRvOiAgJHtnZXRGcmllbmRseVVSTCh1cmwpfS4gRmFsbGluZyBiYWNrIHRvIGdsb2JhbCBDYXRjaCBIYW5kbGVyLmApO1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmVycm9yKFwiRXJyb3IgdGhyb3duIGJ5OlwiLCByb3V0ZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBsb2dnZXIuZXJyb3IoZXJyKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZ2dlci5ncm91cEVuZCgpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9jYXRjaEhhbmRsZXIuaGFuZGxlKHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybCxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICAgICAgICAgICAgICBldmVudFxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdGhyb3cgZXJyO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlc3BvbnNlUHJvbWlzZTtcbiAgICB9XG4gICAgZmluZE1hdGNoaW5nUm91dGUoeyB1cmwsIHNhbWVPcmlnaW4sIHJlcXVlc3QsIGV2ZW50IH0pIHtcbiAgICAgICAgY29uc3Qgcm91dGVzID0gdGhpcy5fcm91dGVzLmdldChyZXF1ZXN0Lm1ldGhvZCkgfHwgW107XG4gICAgICAgIGZvciAoY29uc3Qgcm91dGUgb2Ygcm91dGVzKXtcbiAgICAgICAgICAgIGxldCBwYXJhbXM7XG4gICAgICAgICAgICBjb25zdCBtYXRjaFJlc3VsdCA9IHJvdXRlLm1hdGNoKHtcbiAgICAgICAgICAgICAgICB1cmwsXG4gICAgICAgICAgICAgICAgc2FtZU9yaWdpbixcbiAgICAgICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgICAgIGV2ZW50XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGlmIChtYXRjaFJlc3VsdCkge1xuICAgICAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG1hdGNoUmVzdWx0IGluc3RhbmNlb2YgUHJvbWlzZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLndhcm4oYFdoaWxlIHJvdXRpbmcgJHtnZXRGcmllbmRseVVSTCh1cmwpfSwgYW4gYXN5bmMgbWF0Y2hDYWxsYmFjayBmdW5jdGlvbiB3YXMgdXNlZC4gUGxlYXNlIGNvbnZlcnQgdGhlIGZvbGxvd2luZyByb3V0ZSB0byB1c2UgYSBzeW5jaHJvbm91cyBtYXRjaENhbGxiYWNrIGZ1bmN0aW9uOmAsIHJvdXRlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBwYXJhbXMgPSBtYXRjaFJlc3VsdDtcbiAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShwYXJhbXMpICYmIHBhcmFtcy5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobWF0Y2hSZXN1bHQuY29uc3RydWN0b3IgPT09IE9iamVjdCAmJiBPYmplY3Qua2V5cyhtYXRjaFJlc3VsdCkubGVuZ3RoID09PSAwKSB7XG4gICAgICAg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W10sInNvdXJjZVJvb3QiOiIifQ==\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")); +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.2_next@14.2.3_@babel+core@7.24.5_react-dom@18.3.1_react@18.3.1__react@18.3._e2nkmeterpqllgsh44wfxk7k2q/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.2_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/registerQuotaErrorCallback.js": -/*!*************************************************************************************************************************************!*\ - !*** ./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.2_typescript@5.4.5/node_modules/serwist/dist/chunks/printInstallDetails.js": +/*!*******************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/serwist@9.0.2_typescript@5.4.5/node_modules/serwist/dist/chunks/printInstallDetails.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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vc2Vyd2lzdEA5LjAuMC1wcmV2aWV3LjI0X3R5cGVzY3JpcHRANS40LjUvbm9kZV9tb2R1bGVzL3Nlcndpc3QvZGlzdC9jaHVua3MvcmVnaXN0ZXJRdW90YUVycm9yQ2FsbGJhY2suanMiLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBOEY7O0FBRTlGO0FBQ0EsUUFBUSxJQUFxQztBQUM3QyxRQUFRLDBDQUFrQjtBQUMxQjtBQUNBO0FBQ0E7QUFDQSxTQUFTO0FBQ1Q7QUFDQSxJQUFJLDBDQUFtQjtBQUN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5cbmV4cG9ydCB7IHJlZ2lzdGVyUXVvdGFFcnJvckNhbGxiYWNrIGFzIHIgfTtcbiJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\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")); +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 */ N: function() { return /* binding */ NetworkOnly; },\n/* harmony export */ P: function() { return /* binding */ PrecacheStrategy; },\n/* harmony export */ R: function() { return /* binding */ Route; },\n/* harmony export */ S: function() { return /* binding */ Strategy; },\n/* harmony export */ a: function() { return /* binding */ NetworkFirst; },\n/* harmony export */ b: function() { return /* binding */ NavigationRoute; },\n/* harmony export */ c: function() { return /* binding */ createCacheKey; },\n/* harmony export */ d: function() { return /* binding */ disableDevLogs; },\n/* harmony export */ e: function() { return /* binding */ enableNavigationPreload; },\n/* harmony export */ f: function() { return /* binding */ printInstallDetails; },\n/* harmony export */ g: function() { return /* binding */ generateURLVariations; },\n/* harmony export */ h: function() { return /* binding */ printCleanupDetails; },\n/* harmony export */ i: function() { return /* binding */ defaultMethod; },\n/* harmony export */ j: function() { return /* binding */ parseRoute; },\n/* harmony export */ k: function() { return /* binding */ PrecacheInstallReportPlugin; },\n/* harmony export */ l: function() { return /* binding */ cacheOkAndOpaquePlugin; },\n/* harmony export */ m: function() { return /* binding */ messages; },\n/* harmony export */ n: function() { return /* binding */ normalizeHandler; },\n/* harmony export */ o: function() { return /* binding */ copyResponse; },\n/* harmony export */ p: function() { return /* binding */ parallel; },\n/* harmony export */ q: function() { return /* binding */ disableNavigationPreload; },\n/* harmony export */ r: function() { return /* binding */ isNavigationPreloadSupported; },\n/* harmony export */ s: function() { return /* binding */ setCacheNameDetails; },\n/* harmony export */ t: function() { return /* binding */ StrategyHandler; },\n/* harmony export */ u: function() { return /* binding */ RegExpRoute; },\n/* harmony export */ v: function() { return /* binding */ BackgroundSyncQueue; },\n/* harmony export */ w: function() { return /* binding */ BackgroundSyncQueueStore; },\n/* harmony export */ x: function() { return /* binding */ StorableRequest; }\n/* harmony export */ });\n/* harmony import */ var _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./waitUntil.js */ \"./node_modules/.pnpm/serwist@9.0.2_typescript@5.4.5/node_modules/serwist/dist/chunks/waitUntil.js\");\n/* harmony import */ var idb__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! idb */ \"./node_modules/.pnpm/idb@8.0.0/node_modules/idb/build/index.js\");\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 _waitUntil_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 _waitUntil_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 _waitUntil_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 _waitUntil_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\nclass NavigationRoute extends Route {\n _allowlist;\n _denylist;\n constructor(handler, { allowlist = [\n /./\n ], denylist = [] } = {}){\n if (true) {\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.f.isArrayOfClass(allowlist, RegExp, {\n moduleName: \"serwist\",\n className: \"NavigationRoute\",\n funcName: \"constructor\",\n paramName: \"options.allowlist\"\n });\n _waitUntil_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 _waitUntil_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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.debug(`The navigation route ${pathnameAndSearch} is being used.`);\n }\n return true;\n }\n if (true) {\n _waitUntil_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\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 RegExpRoute extends Route {\n constructor(regExp, handler, method){\n if (true) {\n _waitUntil_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 _waitUntil_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 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\nconst disableDevLogs = ()=>{\n self.__WB_DISABLE_DEV_LOGS = true;\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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.f.isInstance(options.event, ExtendableEvent, {\n moduleName: \"serwist\",\n className: \"StrategyHandler\",\n funcName: \"constructor\",\n paramName: \"options.event\"\n });\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.f.isInstance(options.request, Request, {\n moduleName: \"serwist\",\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 _waitUntil_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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`Using a preloaded navigation response for '${(0,_waitUntil_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 _waitUntil_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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.debug(`Network request for '${(0,_waitUntil_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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`Network request for '${(0,_waitUntil_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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.debug(`Found a cached response in '${cacheName}'.`);\n } else {\n _waitUntil_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,_waitUntil_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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.S(\"attempt-to-cache-non-get-request\", {\n url: (0,_waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.g)(effectiveRequest.url),\n method: effectiveRequest.method\n });\n }\n }\n if (!response) {\n if (true) {\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.error(`Cannot cache non-existent response for '${(0,_waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.g)(effectiveRequest.url)}'.`);\n }\n throw new _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.S(\"cache-put-with-no-response\", {\n url: (0,_waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.g)(effectiveRequest.url)\n });\n }\n const responseToCache = await this._ensureResponseSafeToCache(response);\n if (!responseToCache) {\n if (true) {\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.debug(`Response '${(0,_waitUntil_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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.debug(`The response for ${(0,_waitUntil_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,_waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.d)(cache, effectiveRequest.clone(), [\n \"__WB_REVISION__\"\n ], matchOptions) : null;\n if (true) {\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.debug(`Updating the '${cacheName}' cache with a new Response for ${(0,_waitUntil_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,_waitUntil_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 _waitUntil_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 _waitUntil_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 = _waitUntil_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 _waitUntil_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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`While responding to '${(0,_waitUntil_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,_waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.g)(request.url)}'`,\n printFinalResponse: (response)=>{\n if (response) {\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(\"View the final response here.\");\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.log(response || \"[No response returned]\");\n _waitUntil_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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(this._networkTimeoutSeconds, \"number\", {\n moduleName: \"serwist\",\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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.f.isInstance(request, Request, {\n moduleName: \"serwist\",\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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(messages.strategyStart(this.constructor.name, request));\n for (const log of logs){\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.log(log);\n }\n messages.printFinalResponse(response);\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.groupEnd();\n }\n if (!response) {\n throw new _waitUntil_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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.f.isInstance(request, Request, {\n moduleName: \"serwist\",\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,_waitUntil_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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(messages.strategyStart(this.constructor.name, request));\n if (response) {\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.log(\"Got response from network.\");\n } else {\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.log(\"Unable to get a response from the network.\");\n }\n messages.printFinalResponse(response);\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.groupEnd();\n }\n if (!response) {\n throw new _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.S(\"no-response\", {\n url: request.url,\n error\n });\n }\n return response;\n }\n}\n\nconst BACKGROUND_SYNC_DB_VERSION = 3;\nconst BACKGROUND_SYNC_DB_NAME = \"serwist-background-sync\";\nconst REQUEST_OBJECT_STORE_NAME = \"requests\";\nconst QUEUE_NAME_INDEX = \"queueName\";\nclass BackgroundSyncQueueDb {\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_1__.openDB)(BACKGROUND_SYNC_DB_NAME, BACKGROUND_SYNC_DB_VERSION, {\n upgrade: this._upgradeDb\n });\n }\n return this._db;\n }\n _upgradeDb(db, oldVersion) {\n if (oldVersion > 0 && oldVersion < BACKGROUND_SYNC_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 BackgroundSyncQueueStore {\n _queueName;\n _queueDb;\n constructor(queueName){\n this._queueName = queueName;\n this._queueDb = new BackgroundSyncQueueDb();\n }\n async pushEntry(entry) {\n if (true) {\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(entry, \"object\", {\n moduleName: \"serwist\",\n className: \"BackgroundSyncQueueStore\",\n funcName: \"pushEntry\",\n paramName: \"entry\"\n });\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(entry.requestData, \"object\", {\n moduleName: \"serwist\",\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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(entry, \"object\", {\n moduleName: \"serwist\",\n className: \"BackgroundSyncQueueStore\",\n funcName: \"unshiftEntry\",\n paramName: \"entry\"\n });\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(entry.requestData, \"object\", {\n moduleName: \"serwist\",\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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(requestData, \"object\", {\n moduleName: \"serwist\",\n className: \"StorableRequest\",\n funcName: \"constructor\",\n paramName: \"requestData\"\n });\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(requestData.url, \"string\", {\n moduleName: \"serwist\",\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 = 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 BackgroundSyncQueue {\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 _waitUntil_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;\n this._forceSyncFallback = Boolean(forceSyncFallback);\n this._queueStore = new BackgroundSyncQueueStore(this._name);\n this._addSyncListener();\n }\n get name() {\n return this._name;\n }\n async pushRequest(entry) {\n if (true) {\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(entry, \"object\", {\n moduleName: \"serwist\",\n className: \"BackgroundSyncQueue\",\n funcName: \"pushRequest\",\n paramName: \"entry\"\n });\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.f.isInstance(entry.request, Request, {\n moduleName: \"serwist\",\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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.f.isType(entry, \"object\", {\n moduleName: \"serwist\",\n className: \"BackgroundSyncQueue\",\n funcName: \"unshiftRequest\",\n paramName: \"entry\"\n });\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.f.isInstance(entry.request, Request, {\n moduleName: \"serwist\",\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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`Request for '${(0,_waitUntil_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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`Request for '${(0,_waitUntil_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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`Request for '${(0,_waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.g)(entry.request.url)}' ` + `failed to replay, putting it back in queue '${this._name}'`);\n }\n throw new _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.S(\"queue-replay-failed\", {\n name: this._name\n });\n }\n }\n if (true) {\n _waitUntil_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 _waitUntil_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 _waitUntil_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 _waitUntil_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 BackgroundSyncQueue(name, options);\n }\n async fetchDidFail({ request }) {\n await this._queue.pushRequest({\n request\n });\n }\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 _waitUntil_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_0__.h)() ? clonedResponse.body : await clonedResponse.blob();\n return new Response(body, modifiedResponseInit);\n};\n\nclass PrecacheStrategy extends Strategy {\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 = _waitUntil_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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.warn(`The precached response for ${(0,_waitUntil_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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`A response for ${(0,_waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.g)(request.url)} was used to \"repair\" the precache.`);\n }\n }\n }\n } else {\n throw new _waitUntil_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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(`Precaching is responding to: ${(0,_waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.g)(request.url)}`);\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.log(`Serving the precached url: ${(0,_waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.g)(cacheKey instanceof Request ? cacheKey.url : cacheKey)}`);\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(\"View request details here.\");\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.log(request);\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.groupEnd();\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(\"View response details here.\");\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.log(response);\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.groupEnd();\n _waitUntil_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 _waitUntil_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 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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.log(\"Navigation preloading is enabled.\");\n }\n }));\n });\n } else {\n if (true) {\n _waitUntil_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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.log(\"Navigation preloading is disabled.\");\n }\n }));\n });\n } else {\n if (true) {\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.log(\"Navigation preloading is not supported in this browser.\");\n }\n }\n};\n\nconst setCacheNameDetails = (details)=>{\n if (true) {\n for (const key of Object.keys(details)){\n _waitUntil_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 _waitUntil_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 _waitUntil_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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.S(\"invalid-cache-name\", {\n cacheNameId: \"googleAnalytics\",\n value: details.googleAnalytics\n });\n }\n }\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.c.updateDetails(details);\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 _waitUntil_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 _waitUntil_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 parseRoute = (capture, handler, method)=>{\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 _waitUntil_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 _waitUntil_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 _waitUntil_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 return new Route(matchCallback, handler, method);\n }\n if (capture instanceof RegExp) {\n return new RegExpRoute(capture, handler, method);\n }\n if (typeof capture === \"function\") {\n return new Route(capture, handler, method);\n }\n if (capture instanceof Route) {\n return capture;\n }\n throw new _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.S(\"unsupported-route-type\", {\n moduleName: \"serwist\",\n funcName: \"parseRoute\",\n paramName: \"capture\"\n });\n};\n\nconst logGroup = (groupTitle, deletedURLs)=>{\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(groupTitle);\n for (const url of deletedURLs){\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.log(url);\n }\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.groupEnd();\n};\nconst printCleanupDetails = (deletedURLs)=>{\n const deletionCount = deletedURLs.length;\n if (deletionCount > 0) {\n _waitUntil_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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.groupEnd();\n }\n};\n\nfunction _nestedGroup(groupTitle, urls) {\n if (urls.length === 0) {\n return;\n }\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(groupTitle);\n for (const url of urls){\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.log(url);\n }\n _waitUntil_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 _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.groupCollapsed(message);\n _nestedGroup(\"View newly precached URLs.\", urlsToPrecache);\n _nestedGroup(\"View previously precached URLs.\", urlsAlreadyPrecached);\n _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.l.groupEnd();\n }\n};\n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vc2Vyd2lzdEA5LjAuMl90eXBlc2NyaXB0QDUuNC41L25vZGVfbW9kdWxlcy9zZXJ3aXN0L2Rpc3QvY2h1bmtzL3ByaW50SW5zdGFsbERldGFpbHMuanMiLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFtUTtBQUN0Tzs7QUFFN0I7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQSxZQUFZLElBQXFDO0FBQ2pELFlBQVksNENBQWtCO0FBQzlCO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsYUFBYTtBQUNiO0FBQ0E7QUFDQTtBQUNBLFFBQVEsSUFBcUM7QUFDN0MsUUFBUSw0Q0FBa0I7QUFDMUI7QUFDQTtBQUNBO0FBQ0E7QUFDQSxTQUFTO0FBQ1Q7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxZQUFZLElBQXFDO0FBQ2pELFlBQVksNENBQWtCO0FBQzlCO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsYUFBYTtBQUNiO0FBQ0EsZ0JBQWdCLDRDQUFrQjtBQUNsQztBQUNBLGlCQUFpQjtBQUNqQjtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSwyQ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b25cIikge1xuICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmlzSW5zdGFuY2UocmVnRXhwLCBSZWdFeHAsIHtcbiAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiBcInNlcndpc3RcIixcbiAgICAgICAgICAgICAgICBjbGFzc05hbWU6IFwiUmVnRXhwUm91dGVcIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJjb25zdHJ1Y3RvclwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJwYXR0ZXJuXCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IG1hdGNoID0gKHsgdXJsIH0pPT57XG4gICAgICAgICAgICBjb25zdCByZXN1bHQgPSByZWdFeHAuZXhlYyh1cmwuaHJlZik7XG4gICAgICAgICAgICBpZiAoIXJlc3VsdCkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh1cmwub3JpZ2luICE9PSBsb2NhdGlvbi5vcmlnaW4gJiYgcmVzdWx0LmluZGV4ICE9PSAwKSB7XG4gICAgICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICBsb2dnZXIuZGVidWcoYFRoZSByZWd1bGFyIGV4cHJlc3Npb24gJyR7cmVnRXhwLnRvU3RyaW5nKCl9JyBvbmx5IHBhcnRpYWxseSBtYXRjaGVkIGFnYWluc3QgdGhlIGNyb3NzLW9yaWdpbiBVUkwgJyR7dXJsLnRvU3RyaW5nKCl9Jy4gUmVnRXhwUm91dGUncyB3aWxsIG9ubHkgaGFuZGxlIGNyb3NzLW9yaWdpbiByZXF1ZXN0cyBpZiB0aGV5IG1hdGNoIHRoZSBlbnRpcmUgVVJMLmApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gcmVzdWx0LnNsaWNlKDEpO1xuICAgICAgICB9O1xuICAgICAgICBzdXBlcihtYXRjaCwgaGFuZGxlciwgbWV0aG9kKTtcbiAgICB9XG59XG5cbmNvbnN0IHBhcmFsbGVsID0gYXN5bmMgKGxpbWl0LCBhcnJheSwgZnVuYyk9PntcbiAgICBjb25zdCB3b3JrID0gYXJyYXkubWFwKChpdGVtLCBpbmRleCk9Pih7XG4gICAgICAgICAgICBpbmRleCxcbiAgICAgICAgICAgIGl0ZW1cbiAgICAgICAgfSkpO1xuICAgIGNvbnN0IHByb2Nlc3NvciA9IGFzeW5jIChyZXMpPT57XG4gICAgICAgIGNvbnN0IHJlc3VsdHMgPSBbXTtcbiAgICAgICAgd2hpbGUodHJ1ZSl7XG4gICAgICAgICAgICBjb25zdCBuZXh0ID0gd29yay5wb3AoKTtcbiAgICAgICAgICAgIGlmICghbmV4dCkge1xuICAgICAgICAgICAgICAgIHJldHVybiByZXMocmVzdWx0cyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb25zdCByZXN1bHQgPSBhd2FpdCBmdW5jKG5leHQuaXRlbSk7XG4gICAgICAgICAgICByZXN1bHRzLnB1c2goe1xuICAgICAgICAgICAgICAgIHJlc3VsdDogcmVzdWx0LFxuICAgICAgICAgICAgICAgIGluZGV4OiBuZXh0LmluZGV4XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgIH07XG4gICAgY29uc3QgcXVldWVzID0gQXJyYXkuZnJvbSh7XG4gICAgICAgIGxlbmd0aDogbGltaXRcbiAgICB9LCAoKT0+bmV3IFByb21pc2UocHJvY2Vzc29yKSk7XG4gICAgY29uc3QgcmVzdWx0cyA9IChhd2FpdCBQcm9taXNlLmFsbChxdWV1ZXMpKS5mbGF0KCkuc29ydCgoYSwgYik9PmEuaW5kZXggPCBiLmluZGV4ID8gLTEgOiAxKS5tYXAoKHJlcyk9PnJlcy5yZXN1bHQpO1xuICAgI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N0OiByZXF1ZXN0LmNsb25lKCksXG4gICAgICAgICAgICAgICAgICAgIGV2ZW50XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgaWYgKGVyciBpbnN0YW5jZW9mIEVycm9yKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IFNlcndpc3RFcnJvcihcInBsdWdpbi1lcnJvci1yZXF1ZXN0LXdpbGwtZmV0Y2hcIiwge1xuICAgICAgICAgICAgICAgICAgICB0aHJvd25FcnJvck1lc3NhZ2U6IGVyci5tZXNzYWdlXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgcGx1Z2luRmlsdGVyZWRSZXF1ZXN0ID0gcmVxdWVzdC5jbG9uZSgpO1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgbGV0IGZldGNoUmVzcG9uc2U7XG4gICAgICAgICAgICBmZXRjaFJlc3BvbnNlID0gYXdhaXQgZmV0Y2gocmVxdWVzdCwgcmVxdWVzdC5tb2RlID09PSBcIm5hdmlnYXRlXCIgPyB1bmRlZmluZWQgOiB0aGlzLl9zdHJhdGVneS5mZXRjaE9wdGlvbnMpO1xuICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgIGxvZ2dlci5kZWJ1ZyhgTmV0d29yayByZXF1ZXN0IGZvciAnJHtnZXRGcmllbmRseVVSTChyZXF1ZXN0LnVybCl9JyByZXR1cm5lZCBhIHJlc3BvbnNlIHdpdGggc3RhdHVzICcke2ZldGNoUmVzcG9uc2Uuc3RhdHVzfScuYCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBmb3IgKGNvbnN0IGNhbGxiYWNrIG9mIHRoaXMuaXRlcmF0ZUNhbGxiYWNrcyhcImZldGNoRGlkU3VjY2VlZFwiKSl7XG4gICAgICAgICAgICAgICAgZmV0Y2hSZXNwb25zZSA9IGF3YWl0IGNhbGxiYWNrKHtcbiAgICAgICAgICAgICAgICAgICAgZXZlbnQsXG4gICAgICAgICAgICAgICAgICAgIHJlcXVlc3Q6IHBsdWdpbkZpbHRlcmVkUmVxdWVzdCxcbiAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2U6IGZldGNoUmVzcG9uc2VcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBmZXRjaFJlc3BvbnNlO1xuICAgICAgICB9IGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgIGxvZ2dlci5sb2coYE5ldHdvcmsgcmVxdWVzdCBmb3IgJyR7Z2V0RnJpZW5kbHlVUkwocmVxdWVzdC51cmwpfScgdGhyZXcgYW4gZXJyb3IuYCwgZXJyb3IpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKG9yaWdpbmFsUmVxdWVzdCkge1xuICAgICAgICAgICAgICAgIGF3YWl0IHRoaXMucnVuQ2FsbGJhY2tzKFwiZmV0Y2hEaWRGYWlsXCIsIHtcbiAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGVycm9yLFxuICAgICAgICAgICAgICAgICAgICBldmVudCxcbiAgICAgICAgICAgICAgICAgICAgb3JpZ2luYWxSZXF1ZXN0OiBvcmlnaW5hbFJlcXVlc3QuY2xvbmUoKSxcbiAgICAgICAgICAgICAgICAgICAgcmVxdWVzdDogcGx1Z2luRmlsdGVyZWRSZXF1ZXN0LmNsb25lKClcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRocm93IGVycm9yO1xuICAgICAgICB9XG4gICAgfVxuICAgIGFzeW5jIGZldGNoQW5kQ2FjaGVQdXQo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BjYWxsYmFjayh7XG4gICAgICAgICAgICAgICAgY2FjaGVOYW1lLFxuICAgICAgICAgICAgICAgIG9sZFJlc3BvbnNlLFxuICAgICAgICAgICAgICAgIG5ld1Jlc3BvbnNlOiByZXNwb25zZVRvQ2FjaGUuY2xvbmUoKSxcbiAgICAgICAgICAgICAgICByZXF1ZXN0OiBlZmZlY3RpdmVSZXF1ZXN0LFxuICAgICAgICAgICAgICAgIGV2ZW50OiB0aGlzLmV2ZW50XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICB9XG4gICAgYXN5bmMgZ2V0Q2FjaGVLZXkocmVxdWVzdCwgbW9kZSkge1xuICAgICAgICBjb25zdCBrZXkgPSBgJHtyZXF1ZXN0LnVybH0gfCAke21vZGV9YDtcbiAgICAgICAgaWYgKCF0aGlzLl9jYWNoZUtleXNba2V5XSkge1xuICAgICAgICAgICAgbGV0IGVmZmVjdGl2ZVJlcXVlc3QgPSByZXF1ZXN0O1xuICAgICAgICAgICAgZm9yIChjb25zdCBjYWxsYmFjayBvZiB0aGlzLml0ZXJhdGVDYWxsYmFja3MoXCJjYWNoZUtleVdpbGxCZVVzZWRcIikpe1xuICAgICAgICAgICAgICAgIGVmZmVjdGl2ZVJlcXVlc3QgPSB0b1JlcXVlc3QoYXdhaXQgY2FsbGJhY2soe1xuICAgICAgICAgICAgICAgICAgICBtb2RlLFxuICAgICAgICAgICAgICAgICAgICByZXF1ZXN0OiBlZmZlY3RpdmVSZXF1ZXN0LFxuICAgICAgICAgICAgICAgICAgICBldmVudDogdGhpcy5ldmVudCxcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zOiB0aGlzLnBhcmFtc1xuICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRoaXMuX2NhY2hlS2V5c1trZXldID0gZWZmZWN0aXZlUmVxdWVzdDtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdGhpcy5fY2FjaGVLZXlzW2tleV07XG4gICAgfVxuICAgIGhhc0NhbGxiYWNrKG5hbWUpIHtcbiAgICAgICAgZm9yIChjb25zdCBwbHVnaW4gb2YgdGhpcy5fc3RyYXRlZ3kucGx1Z2lucyl7XG4gICAgICAgICAgICBpZiAobmFtZSBpbiBwbHVnaW4pIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgfVxuICAgIGFzeW5jIHJ1bkNhbGxiYWNrcyhuYW1lLCBwYXJhbSkge1xuICAgICAgICBmb3IgKGNvbnN0IGNhbGxiYWNrIG9mIHRoaXMuaXRlcmF0ZUNhbGxiYWNrcyhuYW1lKSl7XG4gICAgICAgICAgICBhd2FpdCBjYWxsYmFjayhwYXJhbSk7XG4gICAgICAgIH1cbiAgICB9XG4gICAgKml0ZXJhdGVDYWxsYmFja3MobmFtZSkge1xuICAgICAgICBmb3IgKGNvbnN0IHBsdWdpbiBvZiB0aGlzLl9zdHJhdGVneS5wbHVnaW5zKXtcbiAgICAgICAgICAgIGlmICh0eXBlb2YgcGx1Z2luW25hbWVdID09PSBcImZ1bmN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICBjb25zdCBzdGF0ZSA9IHRoaXMuX3BsdWdpblN0YXRlTWFwLmdldChwbHVnaW4pO1xuICAgICAgICAgICAgICAgIGNvbnN0IHN0YXRlZnVsQ2FsbGJhY2sgPSAocGFyYW0pPT57XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHN0YXRlZnVsUGFyYW0gPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAuLi5wYXJhbSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlXG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBwbHVnaW5bbmFtZV0oc3RhdGVmdWxQYXJhbSk7XG4gICAgICAgIC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cbiAgICAgICAgICAgIHBsdWdpbnNVc2VkID0gdHJ1ZTtcbiAgICAgICAgICAgIGlmICghcmVzcG9uc2VUb0NhY2hlKSB7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFwbHVnaW5zVXNlZCkge1xuICAgICAgICAgICAgaWYgKHJlc3BvbnNlVG9DYWNoZSAmJiByZXNwb25zZVRvQ2FjaGUuc3RhdHVzICE9PSAyMDApIHtcbiAgICAgICAgICAgICAgICByZXNwb25zZVRvQ2FjaGUgPSB1bmRlZmluZWQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlVG9DYWNoZSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2VUb0NhY2hlLnN0YXR1cyAhPT0gMjAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2VUb0NhY2hlLnN0YXR1cyA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvZ2dlci53YXJuKGBUaGUgcmVzcG9uc2UgZm9yICcke3RoaXMucmVxdWVzdC51cmx9JyBpcyBhbiBvcGFxdWUgcmVzcG9uc2UuIFRoZSBjYWNoaW5nIHN0cmF0ZWd5IHRoYXQgeW91J3JlIHVzaW5nIHdpbGwgbm90IGNhY2hlIG9wYXF1ZSByZXNwb25zZXMgYnkgZGVmYXVsdC5gKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmRlYnVnKGBUaGUgcmVzcG9uc2UgZm9yICcke3RoaXMucmVxdWVzdC51cmx9JyByZXR1cm5lZCBhIHN0YXR1cyBjb2RlIG9mICcke3Jlc3BvbnNlLnN0Y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AgICAgICAgfVxuICAgICAgICBjb25zdCBldmVudCA9IG9wdGlvbnMuZXZlbnQ7XG4gICAgICAgIGNvbnN0IHJlcXVlc3QgPSB0eXBlb2Ygb3B0aW9ucy5yZXF1ZXN0ID09PSBcInN0cmluZ1wiID8gbmV3IFJlcXVlc3Qob3B0aW9ucy5yZXF1ZXN0KSA6IG9wdGlvbnMucmVxdWVzdDtcbiAgICAgICAgY29uc3QgaGFuZGxlciA9IG5ldyBTdHJhdGVneUhhbmRsZXIodGhpcywgb3B0aW9ucy51cmwgPyB7XG4gICAgICAgICAgICBldmVudCxcbiAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICB1cmw6IG9wdGlvbnMudXJsLFxuICAgICAgICAgICAgcGFyYW1zOiBvcHRpb25zLnBhcmFtc1xuICAgICAgICB9IDoge1xuICAgICAgICAgICAgZXZlbnQsXG4gICAgICAgICAgICByZXF1ZXN0XG4gICAgICAgIH0pO1xuICAgICAgICBjb25zdCByZXNwb25zZURvbmUgPSB0aGlzLl9nZXRSZXNwb25zZShoYW5kbGVyLCByZXF1ZXN0LCBldmVudCk7XG4gICAgICAgIGNvbnN0IGhhbmRsZXJEb25lID0gdGhpcy5fYXdhaXRDb21wbGV0ZShyZXNwb25zZURvbmUsIGhhbmRsZXIsIHJlcXVlc3QsIGV2ZW50KTtcbiAgICAgICAgcmV0dXJuIFtcbiAgICAgICAgICAgIHJlc3BvbnNlRG9uZSxcbiAgICAgICAgICAgIGhhbmRsZXJEb25lXG4gICAgICAgIF07XG4gICAgfVxuICAgIGFzeW5jIF9nZXRSZXNwb25zZShoYW5kbGVyLCByZXF1ZXN0LCBldmVudCkge1xuICAgICAgICBhd2FpdCBoYW5kbGVyLnJ1bkNhbGxiYWNrcyhcImhhbmRsZXJXaWxsU3RhcnRcIiwge1xuICAgICAgICAgICAgZXZlbnQsXG4gICAgICAgICAgICByZXF1ZXN0XG4gICAgICAgIH0pO1xuICAgICAgICBsZXQgcmVzcG9uc2UgPSB1bmRlZmluZWQ7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IHRoaXMuX2hhbmRsZShyZXF1ZXN0LCBoYW5kbGVyKTtcbiAgICAgICAgICAgIGlmIChyZXNwb25zZSA9PT0gdW5kZWZpbmVkIHx8IHJlc3BvbnNlLnR5cGUgPT09IFwiZXJyb3JcIikge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBTZXJ3aXN0RXJyb3IoXCJuby1yZXNwb25zZVwiLCB7XG4gICAgICAgICAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmxcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgIGlmIChlcnJvciBpbnN0YW5jZW9mIEVycm9yKSB7XG4gICAgICAgICAgICAgICAgZm9yIChjb25zdCBjYWxsYmFjayBvZiBoYW5kbGVyLml0ZXJhdGVDYWxsYmFja3MoXCJoYW5kbGVyRGlkRXJyb3JcIikpe1xuICAgICAgICAgICAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IGNhbGxiYWNrKHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yLFxuICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQsXG4gICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2UgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoIXJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgZXJyb3I7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09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cbiAgICAgICAgICAgICAgICBldmVudCxcbiAgICAgICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgICAgIHJlc3BvbnNlXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGF3YWl0IGhhbmRsZXIuZG9uZVdhaXRpbmcoKTtcbiAgICAgICAgfSBjYXRjaCAod2FpdFVudGlsRXJyb3IpIHtcbiAgICAgICAgICAgIGlmICh3YWl0VW50aWxFcnJvciBpbnN0YW5jZW9mIEVycm9yKSB7XG4gICAgICAgICAgICAgICAgZXJyb3IgPSB3YWl0VW50aWxFcnJvcjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBhd2FpdCBoYW5kbGVyLnJ1bkNhbGxiYWNrcyhcImhhbmRsZXJEaWRDb21wbGV0ZVwiLCB7XG4gICAgICAgICAgICBldmVudCxcbiAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICByZXNwb25zZSxcbiAgICAgICAgICAgIGVycm9yXG4gICAgICAgIH0pO1xuICAgICAgICBoYW5kbGVyLmRlc3Ryb3koKTtcbiAgICAgICAgaWYgKGVycm9yKSB7XG4gICAgICAgICAgICB0aHJvdyBlcnJvcjtcbiAgICAgICAgfVxuICAgIH1cbn1cblxuY29uc3QgY2FjaGVPa0FuZE9wYXF1ZVBsdWdpbiA9IHtcbiAgICBjYWNoZVdpbGxVcGRhdGU6IGFzeW5jICh7IHJlc3BvbnNlIH0pPT57XG4gICAgICAgIGlmIChyZXNwb25zZS5zdGF0dXMgPT09IDIwMCB8fCByZXNwb25zZS5zdGF0dXMgPT09IDApIHtcbiAgICAgICAgICAgIHJldHVybiByZXNwb25zZTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbnVsbDtcbiAgICB9XG59O1xuXG5jb25zdCBtZXNzYWdlcyA9IHtcbiAgICBzdHJhdGVneVN0YXJ0OiAoc3RyYXRlZ3lOYW1lLCByZXF1ZXN0KT0+YFVzaW5nICR7c3RyYXRlZ3l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iZXJcIiwge1xuICAgICAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiBcInNlcndpc3RcIixcbiAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiB0aGlzLmNvbnN0cnVjdG9yLm5hbWUsXG4gICAgICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcImNvbnN0cnVjdG9yXCIsXG4gICAgICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJuZXR3b3JrVGltZW91dFNlY29uZHNcIlxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuICAgIGFzeW5jIF9oYW5kbGUocmVxdWVzdCwgaGFuZGxlcikge1xuICAgICAgICBjb25zdCBsb2dzID0gW107XG4gICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgIGZpbmFsQXNzZXJ0RXhwb3J0cy5pc0luc3RhbmNlKHJlcXVlc3QsIFJlcXVlc3QsIHtcbiAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiBcInNlcndpc3RcIixcbiAgICAgICAgICAgICAgICBjbGFzc05hbWU6IHRoaXMuY29uc3RydWN0b3IubmFtZSxcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJoYW5kbGVcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwibWFrZVJlcXVlc3RcIlxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgcHJvbWlzZXMgPSBbXTtcbiAgICAgICAgbGV0IHRpbWVvdXRJZDtcbiAgICAgICAgaWYgKHRoaXMuX25ldHdvcmtUaW1lb3V0U2Vjb25kcykge1xuICAgICAgICAgICAgY29uc3QgeyBpZCwgcHJvbWlzZSB9ID0gdGhpcy5fZ2V0VGltZW91dFByb21pc2Uoe1xuICAgICAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICAgICAgbG9ncyxcbiAgICAgICAgICAgICAgICBoYW5kbGVyXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIHRpbWVvdXRJZCA9IGlkO1xuICAgICAgICAgICAgcHJvbWlzZXMucHVzaChwcm9taXNlKTtcbiAgICAgICAgfVxuICAgICAgICBjb25zdCBuZXR3b3JrUHJvbWlzZSA9IHRoaXMuX2dldE5ldHdvcmtQcm9taXNlKHtcbiAgICAgICAgICAgIHRpbWVvdXRJZCxcbiAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICBsb2dzLFxuICAgICAgICAgICAgaGFuZGxlclxuICAgICAgICB9KTtcbiAgICAgICAgcHJvbWlzZXMucHVzaChuZXR3b3JrUHJvbWlzZSk7XG4gICAgICAgIGNvbnN0IHJlc3BvbnNlID0gYXdhaXQgaGFuZGxlci53YWl0VW50aWwoKGFzeW5jICgpPT57XG4gICAgICAgICAgICByZXR1cm4gYXdhaXQgaGFuZGxlci53YWl0VW50aWwoUHJvbWlzZS5yYWNlKHByb21pc2VzKSkgfHwgYXdhaXQgbmV0d29ya1Byb21pc2U7XG4gICAgICAgIH0pKCkpO1xuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBDb2xsYXBzZWQobWVzc2FnZXMuc3RyYXRlZ3lTdGFydCh0aGlzLmNvbnN0cnVjdG9yLm5hbWUsIHJlcXVlc3QpKTtcbiAgICAgICAgICAgIGZvciAoY29uc3QgbG9nIG9mIGxvZ3Mpe1xuICAgICAgICAgICAgICAgIGxvZ2dlci5sb2cobG9nKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG1lc3NhZ2VzLnByaW50RmluYWxSZXNwb25zZShyZXNwb25zZSk7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBFbmQoKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIXJlc3BvbnNlKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwibm8tcmVzcG9uc2VcIiwge1xuICAgICAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmxcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXNwb25zZTtcbiAgICB9XG4gICAgX2dldFRpbWVvdXRQcm9taXNlKHsgcmVxdWVzdCwgbG9ncywgaGFuZGxlciB9KSB7XG4gICAgICAgIGxldCB0aW1lb3V0SWQ7XG4gICAgICAgIGNvbnN0IHRpbWVvdXRQcm9taXNlID0gbmV3IFByb21pc2UoKHJlc29sdmUpPT57XG4gICAgICAgICAgICBjb25zdCBvbk5ldHdvcmtUaW1lb3V0ID0gYXN5bmMgKCk9PntcbiAgICAgICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ3MucHVzaChgVGltaW5nIG91dCB0aGUgbmV0d29yayByZXNwb25zZSBhdCAke3RoaXMuX25ldHdvcmtUaW1lb3V0U2Vjb25kc30gc2Vjb25kcy5gKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmVzb2x2ZShhd2FpdCBoYW5kbGVyLmNhY2hlTWF0Y2gocmVxdWVzdCkpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIHRpbWVvdXRJZCA9IHNldFRpbWVvdXQob25OZXR3b3JrVGltZW91dCwgdGhpcy5fbmV0d29ya1RpbWVvdXRTZWNvbmRzICogMTAwMCk7XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgcHJvbWlzZTogdGltZW91dFByb21pc2UsXG4gICAgICAgICAgICBpZDogdGltZW91dElkXG4gICAgICAgIH07XG4gICAgfVxuICAgIGFzeW5jIF9nZXROZXR3b3JrUHJvbWlzZSh7IHRpbWVvdXRJZCwgcmVxdWVzdCwgbG9ncywgaGFuZGxlciB9KSB7XG4gICAgICAgIGxldCBlcnJvciA9IHVuZGVmaW5lZDtcbiAgICAgICAgbGV0IHJlc3BvbnNlID0gdW5kZWZpbmVkO1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgcmVzcG9uc2UgPSBhd2FpdCBoYW5kbGVyLmZldGNoQW5kQ2FjaGVQdXQocmVxdWVzdCk7XG4gICAgICAgIH0gY2F0Y2ggKGZldGNoRXJyb3IpIHtcbiAgICAgICAgICAgIGlmIChmZXRjaEVycm9yIGluc3RhbmNlb2YgRXJyb3IpIHtcbiAgICAgICAgICAgICAgICBlcnJvciA9IGZldGNoRXJyb3I7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRpbWVvdXRJZCkge1xuICAgICAgICAgICAgY2xlYXJUaW1lb3V0KHRpbWVvdXRJZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgaWYgKHJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgbG9ncy5wdXNoKFwiR290IHJlc3BvbnNlIGZyb20gbmV0d29yay5cIik7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGxvZ3MucHVzaChcIlVuYWJsZSB0byBnZXQgYSByZXNwb25zZSBmcm9tIHRoZSBuZXR3b3JrLiBXaWxsIHJlc3BvbmQgXCIgKyBcIndpdGggYSBjYWNoZWQgcmVzcG9uc2UuXCIpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmIChlcnJvciB8fCAhcmVzcG9uc2UpIHtcbiAgICAgICAgICAgIHJlc3BvbnNlID0gYXdhaXQgaGFuZGxlci5jYWNoZU1hdGNoKHJlcXVlc3QpO1xuICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZSkge1xuICAgICAgICAgICAgICAgICAgICBsb2dzLnB1c2goYEZvdW5kIGEgY2FjaGVkIHJlc3BvbnNlIGluIHRoZSAnJHt0aGlzLmNhY2hlTmFtZX0nIGNhY2hlLmApO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ3MucHVzaChgTm8gcmVzcG9uc2UgZm91bmQgaW4gdGhlICcke3RoaXMuY2FjaGVOYW1lfScgY2FjaGUuYCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXNwb25zZTtcbiAgICB9XG59XG5cbmNsYXNzIE5ldHdvcmtPbmx5IGV4dGVuZHMgU3RyYXRlZ3kge1xuICAgIF9uZXR3b3JrVGltZW91dFNlY29uZHM7XG4gICAgY29uc3RydWN0b3Iob3B0aW9ucyA9IHt9KXtcbiAgICAgICAgc3VwZXIob3B0aW9ucyk7XG4gICAgICAgIHRoaXMuX25ldHdvcmtUaW1lb3V0U2Vjb25kcyA9IG9wdGlvbnMubmV0d29ya1RpbWVvdXRTZWNvbmRzIHx8IDA7XG4gICAgfVxuICAgIGFzeW5jIF9oYW5kbGUocmVxdWVzdCwgaGFuZGxlcikge1xuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBmaW5hbEFzc2VydEV4cG9ydHMuaXNJbnN0YW5jZShyZXF1ZXN0LCBSZXF1ZXN0LCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJzZXJ3aXN0XCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiB0aGlzLmNvbnN0cnVjdG9yLm5hbWUsXG4gICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiX2hhbmRsZVwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJyZXF1ZXN0XCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGxldCBlcnJvciA9IHVuZGVmaW5lZDtcbiAgICAgICAgbGV0IHJlc3BvbnNlO1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgY29uc3QgcHJvbWlzZXMgPSBbXG4gICAgICAgICAgICAgICAgaGFuZGxlci5mZXRjaChyZXF1ZXN0KVxuICAgICAgICAgICAgXTtcbiAgICAgICAgICAgIGlmICh0aGlzLl9uZXR3b3JrVGltZW91dFNlY29uZHMpIHtcbiAgICAgICAgICAgICAgICBjb25zdCB0aW1lb3V0UHJvbWlzZSA9IHRpbWVvdXQodGhpcy5fbmV0d29ya1RpbWVvdXRTZWNvbmRzICogMTAwMCk7XG4gICAgICAgICAgICAgICAgcHJvbWlzZXMucHVzaCh0aW1lb3V0UHJvbWlzZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IFByb21pc2UucmFjZShwcm9taXNlcyk7XG4gICAgICAgICAgICBpZiAoIXJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBUaW1lZCBvdXQgdGhlIG5ldHdvcmsgcmVzcG9uc2UgYWZ0ZXIgJHt0aGlzLl9uZXR3b3JrVGltZW91dFNlY29uZHN9IHNlY29uZHMuYCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgaWYgKGVyciBpbnN0YW5jZW9mIEVycm9yKSB7XG4gICAgICAgICAgICAgICAgZXJyb3IgPSBlcnI7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgbG9nZ2VyLmdyb3VwQ29sbGFwc2VkKG1lc3NhZ2VzLnN0cmF0ZWd5U3RhcnQodGhpcy5jb25zdHJ1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AgICB0aGlzLl9xdWV1ZURiID0gbmV3IEJhY2tncm91bmRTeW5jUXVldWVEYigpO1xuICAgIH1cbiAgICBhc3luYyBwdXNoRW50cnkoZW50cnkpIHtcbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmlzVHlwZShlbnRyeSwgXCJvYmplY3RcIiwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwic2Vyd2lzdFwiLFxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJCYWNrZ3JvdW5kU3luY1F1ZXVlU3RvcmVcIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJwdXNoRW50cnlcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwiZW50cnlcIlxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBmaW5hbEFzc2VydEV4cG9ydHMuaXNUeXBlKGVudHJ5LnJlcXVlc3REYXRhLCBcIm9iamVjdFwiLCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJzZXJ3aXN0XCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIkJhY2tncm91bmRTeW5jUXVldWVTdG9yZVwiLFxuICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcInB1c2hFbnRyeVwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJlbnRyeS5yZXF1ZXN0RGF0YVwiXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICBkZWxldGUgZW50cnkuaWQ7XG4gICAgICAgIGVudHJ5LnF1ZXVlTmFtZSA9IHRoaXMuX3F1ZXVlTmFtZTtcbiAgICAgICAgYXdhaXQgdGhpcy5fcXVldWVEYi5hZGRFbnRyeShlbnRyeSk7XG4gICAgfVxuICAgIGFzeW5jIHVuc2hpZnRFbnRyeShlbnRyeSkge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gICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmlzVHlwZShyZXF1ZXN0RGF0YSwgXCJvYmplY3RcIiwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwic2Vyd2lzdFwiLFxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJTdG9yYWJsZVJlcXVlc3RcIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJjb25zdHJ1Y3RvclwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJyZXF1ZXN0RGF0YVwiXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGZpbmFsQXNzZXJ0RXhwb3J0cy5pc1R5cGUocmVxdWVzdERhdGEudXJsLCBcInN0cmluZ1wiLCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJzZXJ3aXN0XCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIlN0b3JhYmxlUmVxdWVzdFwiLFxuICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcImNvbnN0cnVjdG9yXCIsXG4gICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcInJlcXVlc3REYXRhLnVybFwiXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAocmVxdWVzdERhdGEubW9kZSA9PT0gXCJuYXZpZ2F0ZVwiKSB7XG4gICAgICAgICAgICByZXF1ZXN0RGF0YS5tb2RlID0gXCJzYW1lLW9yaWdpblwiO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMuX3JlcXVlc3REYXRhID0gcmVxdWVzdERhdGE7XG4gICAgfVxuICAgIHRvT2JqZWN0KCkge1xuICAgICAgICBjb25zdCByZXF1ZXN0RGF0YSA9IE9iamVjdC5hc3NpZ24oe30sIHRoaXMuX3JlcXVlc3REYXRhKTtcbiAgICAg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SA9IGF3YWl0IHRoaXMuX3F1ZXVlU3RvcmUucG9wRW50cnkoKTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIGNhc2UgXCJzaGlmdFwiOlxuICAgICAgICAgICAgICAgIGVudHJ5ID0gYXdhaXQgdGhpcy5fcXVldWVTdG9yZS5zaGlmdEVudHJ5KCk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGVudHJ5KSB7XG4gICAgICAgICAgICBjb25zdCBtYXhSZXRlbnRpb25UaW1lSW5NcyA9IHRoaXMuX21heFJldGVudGlvblRpbWUgKiA2MCAqIDEwMDA7XG4gICAgICAgICAgICBpZiAobm93IC0gZW50cnkudGltZXN0YW1wID4gbWF4UmV0ZW50aW9uVGltZUluTXMpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fcmVtb3ZlUmVxdWVzdChvcGVyYXRpb24pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIGNvbnZlcnRFbnRyeShlbnRyeSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHVuZGVmaW5lZDtcbiAgICB9XG4gICAgYXN5bmMgcmVwbGF5UmVxdWVzdHMoKSB7XG4gICAgICAgIGxldCBlbnRyeSA9IHVuZGVmaW5lZDtcbiAgICAgICAgd2hpbGUoZW50cnkgPSBhd2FpdCB0aGlzLnNoaWZ0UmVxdWVzdCgpKXtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgYXdhaXQgZmV0Y2goZW50cnkucmVxdWVzdC5jbG9uZSgpKTtcbiAgICAgICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ2dlci5sb2coYFJlcXVlc3QgZm9yICcke2dldEZyaWVuZGx5VVJMKGVudHJ5LnJlcXVlc3QudXJsKX0nIGAgKy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AgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIGF3YWl0IHNlbGYucmVnaXN0cmF0aW9uLnN5bmMucmVnaXN0ZXIoYCR7VEFHX1BSRUZJWH06JHt0aGlzLl9uYW1lfWApO1xuICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICBsb2dnZXIud2FybihgVW5hYmxlIHRvIHJlZ2lzdGVyIHN5bmMgZXZlbnQgZm9yICcke3RoaXMuX25hbWV9Jy5gLCBlcnIpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbiAgICBfYWRkU3luY0xpc3RlbmVyKCkge1xuICAgICAgICBpZiAoXCJzeW5jXCIgaW4gc2VsZi5yZWdpc3RyYXRpb24gJiYgIXRoaXMuX2ZvcmNlU3luY0ZhbGxiYWNrKSB7XG4gICAgICAgICAgICBzZWxmLmFkZEV2ZW50TGlzdGVuZXIoXCJzeW5jXCIsIChldmVudCk9PntcbiAgICAgICAgICAgICAgICBpZiAoZXZlbnQudGFnID09PSBgJHtUQUdfUFJFRklYfToke3RoaXMuX25hbWV9YCkge1xuICAgICAgICAgICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsb2dnZXIubG9nKGBCYWNrZ3JvdW5kIHN5bmMgZm9yIHRhZyAnJHtldmVudC50YWd9JyBoYXMgYmVlbiByZWNlaXZlZGApO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHN5bmNDb21wbGV0ZSA9IGFzeW5jICgpPT57XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9zeW5jSW5Qcm9ncmVzcyA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgc3luY0Vycm9yID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCB0aGlzLl9vblN5bmMoe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBxdWV1ZTogdGhpc1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXJyb3IgaW5zdGFuY2VvZiBFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzeW5jRXJyb3IgPSBlcnJvcjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgc3luY0Vycm9yO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseXtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5fcmVxdWVzdHNBZGRlZER1cmluZ1N5bmMgJiYgIShzeW5jRXJyb3IgJiYgIWV2ZW50Lmxhc3RDaGFuY2UpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IHRoaXMucmVnaXN0ZXJTeW5jKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3N5bmNJblByb2dyZXNzID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fcmVxdWVzdHNBZGRlZER1cmluZ1N5bmMgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICAgICAgZXZlbnQud2FpdFVudGlsKHN5bmNDb21wbGV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BkaXNhYmxlZC5cIik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSkpO1xuICAgICAgICB9KTtcbiAgICB9IGVsc2Uge1xuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBsb2dnZXIubG9nKFwiTmF2aWdhdGlvbiBwcmVsb2FkaW5nIGlzIG5vdCBzdXBwb3J0ZWQgaW4gdGhpcyBicm93c2VyLlwiKTtcbiAgICAgICAgfVxuICAgIH1cbn07XG5cbmNvbnN0IHNldENhY2hlTmFtZURldGFpbHMgPSAoZGV0YWlscyk9PntcbiAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgIGZvciAoY29uc3Qga2V5IG9mIE9iamVjdC5rZXlzKGRldGFpbHMpKXtcbiAgICAgICAgICAgIGZpbmFsQXNzZXJ0RXhwb3J0cy5pc1R5cGUoZGV0YWlsc1trZXldLCBcInN0cmluZ1wiLCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJAc2Vyd2lzdC9jb3JlXCIsXG4gICAgICAgICAgICAgICAgZnVuY05hbWU6IFwic2V0Q2FjaGVOYW1lRGV0YWlsc1wiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogYGRldGFpbHMuJHtrZXl9YFxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGRldGFpbHMucHJlY2FjaGU/Lmxlbmd0aCA9PT0gMCkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IFNlcndpc3RFcnJvcihcImludmFsaWQtY2FjaGUtbmFtZVwiLCB7XG4gICAgICAgICAgICAgICAgY2FjaGVOYW1lSWQ6IFwicHJlY2FjaGVcIixcbiAgICAgICAgICAgICAgICB2YWx1ZTogZGV0YWlscy5wcmVjYWNoZVxuICAgICAgICAgICAgfSk7XG4gICAgICAg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HlwZSA9PT0gXCJpbnN0YWxsXCIpIHtcbiAgICAgICAgICAgIGlmIChzdGF0ZT8ub3JpZ2luYWxSZXF1ZXN0ICYmIHN0YXRlLm9yaWdpbmFsUmVxdWVzdCBpbnN0YW5jZW9mIFJlcXVlc3QpIHtcbiAgICAgICAgICAgICAgICBjb25zdCB1cmwgPSBzdGF0ZS5vcmlnaW5hbFJlcXVlc3QudXJsO1xuICAgICAgICAgICAgICAgIGlmIChjYWNoZWRSZXNwb25zZSkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLm5vdFVwZGF0ZWRVUkxzLnB1c2godXJsKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnVwZGF0ZWRVUkxzLnB1c2godXJsKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGNhY2hlZFJlc3BvbnNlO1xuICAgIH07XG59XG5cbmNvbnN0IFJFVklTSU9OX1NFQVJDSF9QQVJBTSA9IFwiX19XQl9SRVZJU0lPTl9fXCI7XG5jb25zdCBjcmVhdGVDYWNoZUtleSA9IChlbnRyeSk9PntcbiAgICBpZiAoIWVudHJ5KSB7XG4gICAgICAgIHRocm93IG5ldyBTZXJ3aXN0RXJyb3IoXCJhZGQtdG8tY2FjaGUtbGlzdC11bmV4cGVjdGVkLXR5cGVcIiwge1xuICAgICAgICAgICAgZW50cnlcbiAgICAgICAgfSk7XG4gICAgfVxuICAgIGlmICh0eXBlb2YgZW50cnkgPT09IFwic3RyaW5nXCIpIHtcbiAgICAgICAgY29uc3QgdXJsT2JqZWN0ID0gbmV3IFVSTChlbnRyeSwgbG9jYXRpb24uaHJlZik7XG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICBjYWNoZUtleTogdXJsT2JqZWN0LmhyZWYsXG4gICAgICAgICAgICB1cmw6IHVybE9iamVjdC5ocmVmXG4gICAgICAgIH07XG4gICAgf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stallDetails.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 ***! - \******************************************************************************************************************/ +/***/ "./node_modules/.pnpm/serwist@9.0.2_typescript@5.4.5/node_modules/serwist/dist/chunks/resultingClientExists.js": +/*!*********************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/serwist@9.0.2_typescript@5.4.5/node_modules/serwist/dist/chunks/resultingClientExists.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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vc2Vyd2lzdEA5LjAuMC1wcmV2aWV3LjI0X3R5cGVzY3JpcHRANS40LjUvbm9kZV9tb2R1bGVzL3Nlcndpc3QvZGlzdC9jaHVua3MvdGltZW91dC5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7O0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLFNBQVM7QUFDVCxLQUFLO0FBQ0w7QUFDQTtBQUNBLEtBQUs7QUFDTDtBQUNBO0FBQ0EsS0FBSztBQUNMO0FBQ0E7QUFDQSxLQUFLO0FBQ0w7QUFDQTtBQUNBLEtBQUs7QUFDTDtBQUNBO0FBQ0E7QUFDQTs7QUFFQSxlQUFlLE1BQXFDLEdBQUcsQ0FBSTtBQUMzRDtBQUNBO0FBQ0E7QUFDQTtBQ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XJncyk9PntcbiAgICAgICAgaWYgKHNlbGYuX19XQl9ESVNBQkxFX0RFVl9MT0dTKSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1ldGhvZCA9PT0gXCJncm91cENvbGxhcHNlZFwiKSB7XG4gICAgICAgICAgICBpZiAodHlwZW9mIG5hdmlnYXRvciAhPT0gXCJ1bmRlZmluZWRcIiAmJiAvXigoPyFjaHJvbWV8YW5kcm9pZCkuKSpzYWZhcmkvaS50ZXN0KG5hdmlnYXRvci51c2VyQWdlbnQpKSB7XG4gICAgICAgICAgICAgICAgY29uc29sZVttZXRob2RdKC4uLmFyZ3MpO1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBjb25zdCBzdHlsZXMgPSBbXG4gICAgICAgICAgICBgYmFja2dyb3VuZDogJHttZXRob2RUb0NvbG9yTWFwW21ldGhvZF19YCxcbiAgICAgICAgICAgIFwiYm9yZGVyLXJhZGl1czogMC41ZW1cIixcbiAgICAgICAgICAgIFwiY29sb3I6IHdoaXRlXCIsXG4gICAgICAgICAgICBcImZvbnQtd2VpZ2h0OiBib2xkXCIsXG4gICAgICAgICAgICBcInBhZGRpbmc6IDJweCAwLjVlbVwiXG4gICAgICAgIF07XG4gICAgICAgIGNvbnN0IGxvZ1ByZWZpeCA9IGluR3JvdXAgPyBbXSA6IFtcbiAgICAgICAgICAgIFwiJWNzZXJ3aXN0XCIsXG4gICAgICAgICAgICBzdHlsZXMuam9pbihcIjtcIilcbiAgICAgICAgXTtcbiAgICAgICAgY29uc29sZVttZXRob2RdKC4uLmxvZ1ByZWZpeCwgLi4uYXJncyk7XG4gICAgICAgIGlmIChtZXRob2QgPT09IFwiZ3JvdXBDb2xsYXBzZWRcIikge1xuICAgICAgICAgICAgaW5Hcm91cCA9IHRydWU7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1ldGhvZCA9PT0gXCJncm91cE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G9nZ2VyLmxvZyhjYWxsYmFjaywgXCJpcyBjb21wbGV0ZS5cIik7XG4gICAgICAgIH1cbiAgICB9XG4gICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICBsb2dnZXIubG9nKFwiRmluaXNoZWQgcnVubmluZyBjYWxsYmFja3MuXCIpO1xuICAgIH1cbn07XG5cbmZ1bmN0aW9uIHRpbWVvdXQobXMpIHtcbiAgICByZXR1cm4gbmV3IFByb21pc2UoKHJlc29sdmUpPT5zZXRUaW1lb3V0KHJlc29sdmUsIG1zKSk7XG59XG5cbmV4cG9ydCB7IERlZmVycmVkIGFzIEQsIFNlcndpc3RFcnJvciBhcyBTLCBjYWNoZU1hdGNoSWdub3JlUGFyYW1zIGFzIGEsIGNhY2hlTmFtZXMgYXMgYywgZXhlY3V0ZVF1b3RhRXJyb3JDYWxsYmFja3MgYXMgZSwgZmluYWxBc3NlcnRFeHBvcnRzIGFzIGYsIGdldEZyaWVuZGx5VVJMIGFzIGcsIGxvZ2dlciBhcyBsLCBxdW90YUVycm9yQ2FsbGJhY2tzIGFzIHEsIHRpbWVvdXQgYXMgdCB9O1xuIl0sIm5hbWVzIjpbXSwic291cmNlUm9vdCI6IiJ9\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")); +eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ r: function() { return /* binding */ resultingClientExists; }\n/* harmony export */ });\n/* harmony import */ var _waitUntil_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./waitUntil.js */ \"./node_modules/.pnpm/serwist@9.0.2_typescript@5.4.5/node_modules/serwist/dist/chunks/waitUntil.js\");\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 (0,_waitUntil_js__WEBPACK_IMPORTED_MODULE_0__.t)(100);\n }\n return resultingWindow;\n}\n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vc2Vyd2lzdEA5LjAuMl90eXBlc2NyaXB0QDUuNC41L25vZGVfbW9kdWxlcy9zZXJ3aXN0L2Rpc3QvY2h1bmtzL3Jlc3VsdGluZ0NsaWVudEV4aXN0cy5qcyIsIm1hcHBpbmdzIjoiOzs7OztBQUE4Qzs7QUFFOUM7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxLQUFLO0FBQ0w7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsU0FBUztBQUNUO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxTQUFTO0FBQ1Q7QUFDQTtBQUNBO0FBQ0EsY0FBYyxnREFBTztBQUNyQjtBQUNBO0FBQ0E7O0FBRXNDIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vX05fRS8uL25vZGVfbW9kdWxlcy8ucG5wbS9zZXJ3aXN0QDkuMC4yX3R5cGVzY3JpcHRANS40LjUvbm9kZV9tb2R1bGVzL3Nlcndpc3QvZGlzdC9jaHVua3MvcmVzdWx0aW5nQ2xpZW50RXhpc3RzLmpzPzQzNGIiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgd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bmdXaW5kb3cpIHtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgICAgIGF3YWl0IHRpbWVvdXQoMTAwKTtcbiAgICB9XG4gICAgcmV0dXJuIHJlc3VsdGluZ1dpbmRvdztcbn1cblxuZXhwb3J0IHsgcmVzdWx0aW5nQ2xpZW50RXhpc3RzIGFzIHIgfTtcbiJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/serwist@9.0.2_typescript@5.4.5/node_modules/serwist/dist/chunks/resultingClientExists.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 ***! - \********************************************************************************************************************/ +/***/ "./node_modules/.pnpm/serwist@9.0.2_typescript@5.4.5/node_modules/serwist/dist/chunks/waitUntil.js": +/*!*********************************************************************************************************!*\ + !*** ./node_modules/.pnpm/serwist@9.0.2_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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vc2Vyd2lzdEA5LjAuMC1wcmV2aWV3LjI0X3R5cGVzY3JpcHRANS40LjUvbm9kZV9tb2R1bGVzL3Nlcndpc3QvZGlzdC9jaHVua3Mvd2FpdFVudGlsLmpzIiwibWFwcGluZ3MiOiI7Ozs7O0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLGNBQWM7QUFDZDtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVtRSIsInNvdXJjZXMiOlsid2VicGFjazovL19OX0UvLi9ub2RlX21vZHVsZXMvLnBucG0vc2Vyd2lzdEA5LjAuMC1wcmV2aWV3LjI0X3R5cGVzY3JpcHRANS40LjUvbm9kZV9tb2R1bGVzL3Nlcndpc3QvZGlzdC9jaHVua3Mvd2FpdFVudGlsLmpzP2YwYjAiXSwic291cmNlc0NvbnRlbnQiOlsibGV0IHN1cHBvcnRTdGF0dXM7XG5mdW5jdGlvbiBjYW5Db25zdHJ1Y3RSZXNwb25zZUZyb21Cb2R5U3RyZWFtKCkge1xuICAgIGlmIChzdXBwb3J0U3RhdHVzID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgY29uc3QgdGVzdFJlc3BvbnNlID0gbmV3IFJlc3BvbnNlKFwiXCIpO1xuICAgICAgICBpZiAoXCJib2R5XCIgaW4gdGVzdFJlc3BvbnNlKSB7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIG5ldyBSZXNwb25zZSh0ZXN0UmVzcG9uc2UuYm9keSk7XG4gICAgICAgICAgICAgICAgc3VwcG9ydFN0YXR1cyA9IHRydWU7XG4gICAgICAgICAgICB9IGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgICAgIHN1cHBvcnRTdGF0dXMgPSBmYWxzZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBzdXBwb3J0U3RhdHVzID0gZmFsc2U7XG4gICAgfVxuICAgIHJldHVybiBzdXBwb3J0U3RhdHVzO1xufVxuXG5jb25zdCB3YWl0VW50aWwgPSAoZXZlbnQsIGFzeW5jRm4pPT57XG4gICAgY29uc3QgcmV0dXJuUHJvbWlzZSA9IGFzeW5jRm4oKTtcbiAgICBldmVudC53YWl0VW50aWwocmV0dXJuUHJvbWlzZSk7XG4gICAgcmV0dXJuIHJldHVyblByb21pc2U7XG59O1xuXG5leHBvcnQgeyBjYW5Db25zdHJ1Y3RSZXNwb25zZUZyb21Cb2R5U3RyZWFtIGFzIGMsIHdhaXRVbnRpbCBhcyB3IH07XG4iXSwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/chunks/waitUntil.js\n")); +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 */ clientsClaim; },\n/* harmony export */ b: function() { return /* binding */ cleanupOutdatedCaches; },\n/* harmony export */ c: function() { return /* binding */ cacheNames; },\n/* harmony export */ d: function() { return /* binding */ cacheMatchIgnoreParams; },\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 */ h: function() { return /* binding */ canConstructResponseFromBodyStream; },\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 */ w: function() { return /* binding */ waitUntil; }\n/* harmony export */ });\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 'serwist.BackgroundSyncQueue' 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 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 getFriendlyURL = (url)=>{\n const urlObj = new URL(String(url), location.href);\n return urlObj.href.replace(new RegExp(`^${location.origin}`), \"\");\n};\n\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\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\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 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(cacheNames.getPrecacheName(cacheName)).then((cachesDeleted)=>{\n if (true) {\n if (cachesDeleted.length > 0) {\n logger.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 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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vc2Vyd2lzdEA5LjAuMl90eXBlc2NyaXB0QDUuNC41L25vZGVfbW9kdWxlcy9zZXJ3aXN0L2Rpc3QvY2h1bmtzL3dhaXRVbnRpbC5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7OztBQUFBO0FBQ0Esd0JBQXdCLHlDQUF5QztBQUNqRTtBQUNBO0FBQ0E7QUFDQSx1QkFBdUIsVUFBVSwrREFBK0QsdUJBQXVCLDJCQUEyQixzQkFBc0I7QUFDeEssS0FBSztBQUNMLHVCQUF1Qiw0Q0FBNEM7QUFDbkU7QUFDQTtBQUNBO0FBQ0EsaUNBQWlDLFVBQVUsc0JBQXNCLFdBQVcsR0FBRyxVQUFVLEdBQUcsU0FBUztBQUNyRyxLQUFLO0FBQ0wseUJBQXlCLDBEQUEwRDtBQUNuRjtBQUNBO0FBQ0E7QUFDQSw0Q0FBNEMsVUFBVTtBQUN0RCxpQ0FBaUMsVUFBVSxzQkFBc0IsV0FBVyxHQUFHLGFBQWEsT0FBTyxTQUFTLHNCQUFzQixhQUFhO0FBQy9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YWxzZTtcbiAgICBjb25zdCBtZXRob2RUb0NvbG9yTWFwID0ge1xuICAgICAgICBkZWJ1ZzogXCIjN2Y4YzhkXCIsXG4gICAgICAgIGxvZzogXCIjMmVjYzcxXCIsXG4gICAgICAgIHdhcm46IFwiI2YzOWMxMlwiLFxuICAgICAgICBlcnJvcjogXCIjYzAzOTJiXCIsXG4gICAgICAgIGdyb3VwQ29sbGFwc2VkOiBcIiMzNDk4ZGJcIixcbiAgICAgICAgZ3JvdXBFbmQ6IG51bGxcbiAgICB9O1xuICAgIGNvbnN0IHByaW50ID0gKG1ldGhvZCwgYXJncyk9PntcbiAgICAgICAgaWYgKHNlbGYuX19XQl9ESVNBQkxFX0RFVl9MT0dTKSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG1ldGhvZCA9PT0gXCJncm91cENvbGxhcHNlZFwiKSB7XG4gICAgICAgICAgICBpZiAodHlwZW9mIG5hdmlnYXRvciAhPT0gXCJ1bmRlZmluZWRcIiAmJiAvXigoPyFjaHJvbWV8YW5kcm9pZCkuKSpzYWZhcmkvaS50ZXN0KG5hdmlnYXRvci51c2VyQWdlbnQpKSB7XG4gICAgICAgICAgICAgICAgY29uc29sZVttZXRob2RdKC4uLmFyZ3MpO1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBjb25zdCBzdHlsZXMgPSBbXG4gICAgICAgICAgICBgYmFja2dyb3VuZDogJHttZXRob2RUb0NvbG9yTWFwW21ldGhvZF19YCxcbiAgICAgICAgICAgIFwiYm9yZGVyLXJhZGl1czogMC41ZW1cIixcbiAgICAgICAgICAgIFwiY29sb3I6IHdoaXRlXCIsXG4gICAgICAgICAgICBcImZvbnQtd2VpZ2h0OiBib2xkXCIsXG4gICAgICAgICAgICBcInBhZGRpbmc6IDJweCAwLjVlbVwiXG4gICAgICAgIF07XG4gICAgICAgIGNvbnN0IGxvZ1ByZWZp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yZVBhcmFtcyBhcyBkLCBleGVjdXRlUXVvdGFFcnJvckNhbGxiYWNrcyBhcyBlLCBmaW5hbEFzc2VydEV4cG9ydHMgYXMgZiwgZ2V0RnJpZW5kbHlVUkwgYXMgZywgY2FuQ29uc3RydWN0UmVzcG9uc2VGcm9tQm9keVN0cmVhbSBhcyBoLCBsb2dnZXIgYXMgbCwgcXVvdGFFcnJvckNhbGxiYWNrcyBhcyBxLCB0aW1lb3V0IGFzIHQsIHdhaXRVbnRpbCBhcyB3IH07XG4iXSwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/serwist@9.0.2_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 ***! - \*********************************************************************************************************/ +/***/ "./node_modules/.pnpm/serwist@9.0.2_typescript@5.4.5/node_modules/serwist/dist/index.js": +/*!**********************************************************************************************!*\ + !*** ./node_modules/.pnpm/serwist@9.0.2_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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vc2Vyd2lzdEA5LjAuMC1wcmV2aWV3LjI0X3R5cGVzY3JpcHRANS40LjUvbm9kZV9tb2R1bGVzL3Nlcndpc3QvZGlzdC9pbmRleC5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBd0Q7QUFDZ1Q7QUFDL1E7QUFDekI7QUFDakM7QUFDRTtBQUNwQjs7QUFFYjtBQUNBO0FBQ0EsZUFBZSxpREFBWTtBQUMzQixLQUFLO0FBQ0w7QUFDQSxlQUFlLGlEQUFZO0FBQzNCLEtBQUs7QUFDTDtBQUNBLGVBQWUsaURBQVk7QUFDM0IsS0FBSztBQUNMO0FBQ0EsZUFBZSxpREFBWTtBQUMzQixLQUFLO0FBQ0w7QUFDQSxlQUFlLGlEQUFZO0FBQzNCO0FBQ0E7O0FBRXNCIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vX05fRS8uL25vZGVfbW9kdWxlcy8ucG5wbS9zZXJ3aXN0QDkuMC4wLXByZXZpZXcuMjRfdHlwZXNjcmlwdEA1LjQuNS9ub2RlX21vZHVsZXMvc2Vyd2lzdC9kaXN0L2luZGV4LmpzPzBiNjAiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgYyBhcyBjYWNoZU5hbWVzJDEgfSBmcm9tICcuL2NodW5rcy90aW1lb3V0LmpzJztcbmV4cG9ydCB7IE4gYXMgTmF2aWdhdGlvblJvdXRlLCBQIGFzIFByZWNhY2hlUm91dG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KTtcbiAgICB9LFxuICAgIGdldCBydW50aW1lICgpIHtcbiAgICAgICAgcmV0dXJuIGNhY2hlTmFtZXMkMS5nZXRSdW50aW1lTmFtZSgpO1xuICAgIH0sXG4gICAgZ2V0IHN1ZmZpeCAoKSB7XG4gICAgICAgIHJldHVybiBjYWNoZU5hbWVzJDEuZ2V0U3VmZml4KCk7XG4gICAgfVxufTtcblxuZXhwb3J0IHsgY2FjaGVOYW1lcyB9O1xuIl0sIm5hbWVzIjpbXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/serwist@9.0.0-preview.24_typescript@5.4.5/node_modules/serwist/dist/index.js\n")); +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 */ BROADCAST_UPDATE_DEFAULT_HEADERS; },\n/* harmony export */ BackgroundSyncPlugin: function() { return /* reexport safe */ _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.B; },\n/* harmony export */ BackgroundSyncQueue: function() { return /* reexport safe */ _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.v; },\n/* harmony export */ BackgroundSyncQueueStore: function() { return /* reexport safe */ _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.w; },\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 */ CacheFirst: function() { return /* binding */ CacheFirst; },\n/* harmony export */ CacheOnly: function() { return /* binding */ CacheOnly; },\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 */ NavigationRoute: function() { return /* reexport safe */ _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.b; },\n/* harmony export */ NetworkFirst: function() { return /* reexport safe */ _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.a; },\n/* harmony export */ NetworkOnly: function() { return /* reexport safe */ _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.N; },\n/* harmony export */ PrecacheFallbackPlugin: function() { return /* binding */ PrecacheFallbackPlugin; },\n/* harmony export */ PrecacheRoute: function() { return /* binding */ PrecacheRoute; },\n/* harmony export */ PrecacheStrategy: function() { return /* reexport safe */ _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.P; },\n/* harmony export */ RangeRequestsPlugin: function() { return /* binding */ RangeRequestsPlugin; },\n/* harmony export */ RegExpRoute: function() { return /* reexport safe */ _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.u; },\n/* harmony export */ Route: function() { return /* reexport safe */ _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.R; },\n/* harmony export */ Serwist: function() { return /* binding */ Serwist; },\n/* harmony export */ StaleWhileRevalidate: function() { return /* binding */ StaleWhileRevalidate; },\n/* harmony export */ StorableRequest: function() { return /* reexport safe */ _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.x; },\n/* harmony export */ Strategy: function() { return /* reexport safe */ _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.S; },\n/* harmony export */ StrategyHandler: function() { return /* reexport safe */ _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.t; },\n/* harmony export */ cacheNames: function() { return /* binding */ cacheNames; },\n/* harmony export */ copyResponse: function() { return /* reexport safe */ _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.o; },\n/* harmony export */ createPartialResponse: function() { return /* binding */ createPartialResponse; },\n/* harmony export */ disableDevLogs: function() { return /* reexport safe */ _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.d; },\n/* harmony export */ disableNavigationPreload: function() { return /* reexport safe */ _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.q; },\n/* harmony export */ enableNavigationPreload: function() { return /* reexport safe */ _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.e; },\n/* harmony export */ initializeGoogleAnalytics: function() { return /* binding */ initializeGoogleAnalytics; },\n/* harmony export */ isNavigationPreloadSupported: function() { return /* reexport safe */ _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.r; },\n/* harmony export */ registerQuotaErrorCallback: function() { return /* binding */ registerQuotaErrorCallback; },\n/* harmony export */ responsesAreSame: function() { return /* binding */ responsesAreSame; },\n/* harmony export */ setCacheNameDetails: function() { return /* reexport safe */ _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.s; }\n/* harmony export */ });\n/* harmony import */ var _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./chunks/printInstallDetails.js */ \"./node_modules/.pnpm/serwist@9.0.2_typescript@5.4.5/node_modules/serwist/dist/chunks/printInstallDetails.js\");\n/* harmony import */ var _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./chunks/waitUntil.js */ \"./node_modules/.pnpm/serwist@9.0.2_typescript@5.4.5/node_modules/serwist/dist/chunks/waitUntil.js\");\n/* harmony import */ var _chunks_resultingClientExists_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./chunks/resultingClientExists.js */ \"./node_modules/.pnpm/serwist@9.0.2_typescript@5.4.5/node_modules/serwist/dist/chunks/resultingClientExists.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\n\n\n\n\n\nclass PrecacheRoute extends _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.R {\n constructor(serwist, options){\n const match = ({ request })=>{\n const urlsToCacheKeys = serwist.getUrlsToPrecacheKeys();\n for (const possibleURL of (0,_chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.g)(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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.debug(`Precaching did not find a match for ${(0,_chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.g)(request.url)}.`);\n }\n return;\n };\n super(match, serwist.precacheStrategy);\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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.log(`Request for '${(0,_chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.g)(url.href)}' has been replayed`);\n }\n } catch (err) {\n await queue.unshiftRequest(entry);\n if (true) {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.log(`Request for '${(0,_chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.g)(url.href)}' failed to replay, putting it back in the queue.`);\n }\n throw err;\n }\n }\n if (true) {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.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 _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.N({\n plugins: [\n bgSyncPlugin\n ]\n });\n return [\n new _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.R(match, handler, \"GET\"),\n new _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.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 _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.a({\n cacheName\n });\n return new _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.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 _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.a({\n cacheName\n });\n return new _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.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 _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.a({\n cacheName\n });\n return new _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.R(match, handler, \"GET\");\n};\nconst initializeGoogleAnalytics = ({ serwist, cacheName, ...options })=>{\n const resolvedCacheName = _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.c.getGoogleAnalyticsName(cacheName);\n const bgSyncPlugin = new _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.B(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\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 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, skipWaiting = false, importScripts, navigationPreload = false, cacheId, clientsClaim: clientsClaim$1 = false, runtimeCaching, offlineAnalyticsConfig, disableDevLogs: disableDevLogs$1 = false, fallbacks } = {}){\n this._concurrentPrecaching = precacheOptions?.concurrency ?? 10;\n this._precacheStrategy = new _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.P({\n cacheName: _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.c.getPrecacheName(precacheOptions?.cacheName),\n plugins: [\n ...precacheOptions?.plugins ?? [],\n new PrecacheCacheKeyPlugin({\n precacheController: this\n })\n ],\n fallbackToNetwork: precacheOptions?.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) (0,_chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.e)();\n if (cacheId !== undefined) {\n (0,_chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.s)({\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) (0,_chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.a)();\n if (!!precacheEntries && precacheEntries.length > 0) {\n this.addToPrecacheList(precacheEntries);\n }\n if (precacheOptions?.cleanupOutdatedCaches) {\n (0,_chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.b)(precacheOptions?.cacheName);\n }\n this.registerRoute(new PrecacheRoute(this, precacheOptions));\n if (precacheOptions?.navigateFallback) {\n this.registerRoute(new _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.b(this.createHandlerBoundToUrl(precacheOptions?.navigateFallback), {\n allowlist: precacheOptions?.navigateFallbackAllowlist,\n denylist: precacheOptions?.navigateFallbackDenylist\n }));\n }\n if (offlineAnalyticsConfig !== undefined) {\n if (typeof offlineAnalyticsConfig === \"boolean\") {\n offlineAnalyticsConfig && initializeGoogleAnalytics({\n serwist: this\n });\n } else {\n initializeGoogleAnalytics({\n ...offlineAnalyticsConfig,\n serwist: this\n });\n }\n }\n if (runtimeCaching !== undefined) {\n if (fallbacks !== undefined) {\n const fallbackPlugin = new PrecacheFallbackPlugin({\n fallbackUrls: fallbacks.entries,\n serwist: this\n });\n runtimeCaching.forEach((cacheEntry)=>{\n if (cacheEntry.handler instanceof _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.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) (0,_chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.d)();\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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.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 } = (0,_chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.c)(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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.warn(warningMessage);\n }\n }\n }\n }\n handleInstall(event) {\n return (0,_chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.w)(event, async ()=>{\n const installReportPlugin = new _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.k();\n this.precacheStrategy.plugins.push(installReportPlugin);\n await (0,_chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.p)(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 (0,_chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.f)(updatedURLs, notUpdatedURLs);\n }\n return {\n updatedURLs,\n notUpdatedURLs\n };\n });\n }\n handleActivate(event) {\n return (0,_chunks_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 (0,_chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.h)(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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.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 = _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.i) {\n this._defaultHandlerMap.set(method, (0,_chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.n)(handler));\n }\n setCatchHandler(handler) {\n this._catchHandler = (0,_chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.n)(handler);\n }\n registerCapture(capture, handler, method) {\n const route = (0,_chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.j)(capture, handler, method);\n this.registerRoute(route);\n return route;\n }\n registerRoute(route) {\n if (true) {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isType(route, \"object\", {\n moduleName: \"serwist\",\n className: \"Serwist\",\n funcName: \"registerRoute\",\n paramName: \"route\"\n });\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.hasMethod(route, \"match\", {\n moduleName: \"serwist\",\n className: \"Serwist\",\n funcName: \"registerRoute\",\n paramName: \"route\"\n });\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isType(route.handler, \"object\", {\n moduleName: \"serwist\",\n className: \"Serwist\",\n funcName: \"registerRoute\",\n paramName: \"route\"\n });\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.hasMethod(route.handler, \"handle\", {\n moduleName: \"serwist\",\n className: \"Serwist\",\n funcName: \"registerRoute\",\n paramName: \"route.handler\"\n });\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.debug(`No route found for: ${(0,_chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.g)(url)}`);\n }\n return;\n }\n if (true) {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.groupCollapsed(`Router is responding to: ${(0,_chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.g)(url)}`);\n for (const msg of debugMessages){\n if (Array.isArray(msg)) {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.log(...msg);\n } else {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.log(msg);\n }\n }\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.groupCollapsed(`Error thrown when responding to: ${(0,_chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.g)(url)}. Falling back to route's Catch Handler.`);\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.error(\"Error thrown by:\", route);\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.error(err);\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.groupCollapsed(`Error thrown when responding to: ${(0,_chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.g)(url)}. Falling back to global Catch Handler.`);\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.error(\"Error thrown by:\", route);\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.error(err);\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.warn(`While routing ${(0,_chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.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\nconst cacheNames = {\n get googleAnalytics () {\n return _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.c.getGoogleAnalyticsName();\n },\n get precache () {\n return _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.c.getPrecacheName();\n },\n get prefix () {\n return _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.c.getPrefix();\n },\n get runtime () {\n return _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.c.getRuntimeName();\n },\n get suffix () {\n return _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.c.getSuffix();\n }\n};\n\nconst BROADCAST_UPDATE_MESSAGE_TYPE = \"CACHE_UPDATED\";\nconst BROADCAST_UPDATE_MESSAGE_META = \"serwist-broadcast-update\";\nconst BROADCAST_UPDATE_DEFAULT_NOTIFY = true;\nconst BROADCAST_UPDATE_DEFAULT_HEADERS = [\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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.S(\"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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.warn(\"Unable to determine where the response has been updated because none of the headers that would be checked are present.\");\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.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 || BROADCAST_UPDATE_DEFAULT_HEADERS;\n this._generatePayload = generatePayload || defaultPayloadGenerator;\n this._notifyAllClients = notifyAllClients ?? BROADCAST_UPDATE_DEFAULT_NOTIFY;\n }\n async notifyIfUpdated(options) {\n if (true) {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isType(options.cacheName, \"string\", {\n moduleName: \"serwist\",\n className: \"BroadcastCacheUpdate\",\n funcName: \"notifyIfUpdated\",\n paramName: \"cacheName\"\n });\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isInstance(options.newResponse, Response, {\n moduleName: \"serwist\",\n className: \"BroadcastCacheUpdate\",\n funcName: \"notifyIfUpdated\",\n paramName: \"newResponse\"\n });\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isInstance(options.request, Request, {\n moduleName: \"serwist\",\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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.log(\"Newer response found (and cached) for:\", options.request.url);\n }\n const messageData = {\n type: BROADCAST_UPDATE_MESSAGE_TYPE,\n meta: BROADCAST_UPDATE_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,_chunks_resultingClientExists_js__WEBPACK_IMPORTED_MODULE_2__.r)(resultingClientId);\n if (!resultingWin || isSafari) {\n await (0,_chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.t)(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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.S(\"statuses-or-headers-required\", {\n moduleName: \"serwist\",\n className: \"CacheableResponse\",\n funcName: \"constructor\"\n });\n }\n if (config.statuses) {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isArray(config.statuses, {\n moduleName: \"serwist\",\n className: \"CacheableResponse\",\n funcName: \"constructor\",\n paramName: \"config.statuses\"\n });\n }\n if (config.headers) {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isType(config.headers, \"object\", {\n moduleName: \"serwist\",\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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isInstance(response, Response, {\n moduleName: \"serwist\",\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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.groupCollapsed(`The request for '${(0,_chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.g)(response.url)}' returned a response that does not meet the criteria for being cached.`);\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.groupCollapsed(\"View cacheability criteria here.\");\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.log(`Cacheable statuses: ${JSON.stringify(this._statuses)}`);\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.log(`Cacheable headers: ${JSON.stringify(this._headers, null, 2)}`);\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.groupEnd();\n const logFriendlyHeaders = {};\n response.headers.forEach((value, key)=>{\n logFriendlyHeaders[key] = value;\n });\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.groupCollapsed(\"View response status and headers here.\");\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.log(`Response status: ${response.status}`);\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.log(`Response headers: ${JSON.stringify(logFriendlyHeaders, null, 2)}`);\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.groupEnd();\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.groupCollapsed(\"View full response details here.\");\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.log(response.headers);\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.log(response);\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.groupEnd();\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.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_3__.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_3__.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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isType(cacheName, \"string\", {\n moduleName: \"serwist\",\n className: \"CacheExpiration\",\n funcName: \"constructor\",\n paramName: \"cacheName\"\n });\n if (!(config.maxEntries || config.maxAgeSeconds)) {\n throw new _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.S(\"max-entries-or-age-required\", {\n moduleName: \"serwist\",\n className: \"CacheExpiration\",\n funcName: \"constructor\"\n });\n }\n if (config.maxEntries) {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isType(config.maxEntries, \"number\", {\n moduleName: \"serwist\",\n className: \"CacheExpiration\",\n funcName: \"constructor\",\n paramName: \"config.maxEntries\"\n });\n }\n if (config.maxAgeSeconds) {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isType(config.maxAgeSeconds, \"number\", {\n moduleName: \"serwist\",\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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.groupCollapsed(`Expired ${urlsExpired.length} ` + `${urlsExpired.length === 1 ? \"entry\" : \"entries\"} and removed ` + `${urlsExpired.length === 1 ? \"it\" : \"them\"} from the ` + `'${this._cacheName}' cache.`);\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.log(`Expired the following ${urlsExpired.length === 1 ? \"URL\" : \"URLs\"}:`);\n for (const url of urlsExpired){\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.log(` ${url}`);\n }\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.groupEnd();\n } else {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isType(url, \"string\", {\n moduleName: \"serwist\",\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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.S(\"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\nconst registerQuotaErrorCallback = (callback)=>{\n if (true) {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isType(callback, \"function\", {\n moduleName: \"@serwist/core\",\n funcName: \"register\",\n paramName: \"callback\"\n });\n }\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.q.add(callback);\n if (true) {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.log(\"Registered a callback to respond to quota errors.\", callback);\n }\n};\n\nclass ExpirationPlugin {\n _config;\n _cacheExpirations;\n constructor(config = {}){\n if (true) {\n if (!(config.maxEntries || config.maxAgeSeconds)) {\n throw new _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.S(\"max-entries-or-age-required\", {\n moduleName: \"serwist\",\n className: \"ExpirationPlugin\",\n funcName: \"constructor\"\n });\n }\n if (config.maxEntries) {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isType(config.maxEntries, \"number\", {\n moduleName: \"serwist\",\n className: \"ExpirationPlugin\",\n funcName: \"constructor\",\n paramName: \"config.maxEntries\"\n });\n }\n if (config.maxAgeSeconds) {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isType(config.maxAgeSeconds, \"number\", {\n moduleName: \"serwist\",\n className: \"ExpirationPlugin\",\n funcName: \"constructor\",\n paramName: \"config.maxAgeSeconds\"\n });\n }\n if (config.maxAgeFrom) {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isType(config.maxAgeFrom, \"string\", {\n moduleName: \"serwist\",\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 registerQuotaErrorCallback(()=>this.deleteCacheAndMetadata());\n }\n }\n _getCacheExpiration(cacheName) {\n if (cacheName === _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.c.getRuntimeName()) {\n throw new _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.S(\"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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.warn(`Unable to ensure service worker stays alive when updating cache entry for '${(0,_chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.g)(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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isType(cacheName, \"string\", {\n moduleName: \"serwist\",\n className: \"Plugin\",\n funcName: \"cacheDidUpdate\",\n paramName: \"cacheName\"\n });\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isInstance(request, Request, {\n moduleName: \"serwist\",\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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.S(\"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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.S(\"unit-must-be-bytes\", {\n normalizedRangeHeader\n });\n }\n if (normalizedRangeHeader.includes(\",\")) {\n throw new _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.S(\"single-range-only\", {\n normalizedRangeHeader\n });\n }\n const rangeParts = /(\\d*)-(\\d*)/.exec(normalizedRangeHeader);\n if (!rangeParts || !(rangeParts[1] || rangeParts[2])) {\n throw new _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.S(\"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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isInstance(request, Request, {\n moduleName: \"@serwist/range-requests\",\n funcName: \"createPartialResponse\",\n paramName: \"request\"\n });\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.S(\"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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.warn(\"Unable to construct a partial response; returning a \" + \"416 Range Not Satisfiable response instead.\");\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.groupCollapsed(\"View details here.\");\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.log(error);\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.log(request);\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.log(originalResponse);\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.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\nclass CacheFirst extends _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.S {\n async _handle(request, handler) {\n const logs = [];\n if (true) {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isInstance(request, Request, {\n moduleName: \"serwist\",\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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.groupCollapsed(_chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.m.strategyStart(this.constructor.name, request));\n for (const log of logs){\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.log(log);\n }\n _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.m.printFinalResponse(response);\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.groupEnd();\n }\n if (!response) {\n throw new _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.S(\"no-response\", {\n url: request.url,\n error\n });\n }\n return response;\n }\n}\n\nclass CacheOnly extends _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.S {\n async _handle(request, handler) {\n if (true) {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isInstance(request, Request, {\n moduleName: \"serwist\",\n className: this.constructor.name,\n funcName: \"makeRequest\",\n paramName: \"request\"\n });\n }\n const response = await handler.cacheMatch(request);\n if (true) {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.groupCollapsed(_chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.m.strategyStart(this.constructor.name, request));\n if (response) {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.log(`Found a cached response in the '${this.cacheName}' cache.`);\n _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.m.printFinalResponse(response);\n } else {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.log(`No response found in the '${this.cacheName}' cache.`);\n }\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.groupEnd();\n }\n if (!response) {\n throw new _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.S(\"no-response\", {\n url: request.url\n });\n }\n return response;\n }\n}\n\nclass StaleWhileRevalidate extends _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.S {\n constructor(options = {}){\n super(options);\n if (!this.plugins.some((p)=>\"cacheWillUpdate\" in p)) {\n this.plugins.unshift(_chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.l);\n }\n }\n async _handle(request, handler) {\n const logs = [];\n if (true) {\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.f.isInstance(request, Request, {\n moduleName: \"serwist\",\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 _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.groupCollapsed(_chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.m.strategyStart(this.constructor.name, request));\n for (const log of logs){\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.log(log);\n }\n _chunks_printInstallDetails_js__WEBPACK_IMPORTED_MODULE_0__.m.printFinalResponse(response);\n _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.l.groupEnd();\n }\n if (!response) {\n throw new _chunks_waitUntil_js__WEBPACK_IMPORTED_MODULE_1__.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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vc2Vyd2lzdEA5LjAuMl90eXBlc2NyaXB0QDUuNC41L25vZGVfbW9kdWxlcy9zZXJ3aXN0L2Rpc3QvaW5kZXguanMiLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBb2dCO0FBQ3ZRO0FBQ2Q7QUFDaEs7QUFDeEM7O0FBRXZDLDRCQUE0Qiw2REFBSztBQUNqQztBQUNBLHlCQUF5Qix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MgUHJlY2FjaGVSb3V0ZSBleHRlbmRzIFJvdXRlIHtcbiAgICBjb25zdHJ1Y3RvcihzZXJ3aXN0LCBvcHRpb25zKXtcbiAgICAgICAgY29uc3QgbWF0Y2ggPSAoeyByZXF1ZXN0IH0pPT57XG4gICAgICAgICAgICBjb25zdCB1cmxzVG9DYWNoZUtleXMgPSBzZXJ3aXN0LmdldFVybHNUb1ByZWNhY2hlS2V5cygpO1xuICAgICAgICAgICAgZm9yIChjb25zdCBwb3NzaWJsZVVSTCBvZiBnZW5lcmF0ZVVSTFZhcmlhdGlvbnMocmVxdWVzdC51cmwsIG9wdGlvbnMpKXtcbiAgICAgICAgICAgICAgICBjb25zdCBjYWNoZUtleSA9IHVybHNUb0NhY2hlS2V5cy5nZXQocG9zc2libGVVUkwpO1xuICAgICAgICAgICAgICAgIGlmIChjYWNoZUtleSkge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBpbnRlZ3JpdHkgPSBzZXJ3aXN0LmdldEludGVncml0eUZvclByZWNhY2hlS2V5KGNhY2hlS2V5KTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhY2hlS2V5LFxuICAgICAgICAgICAgICAgICAgICAgICAgaW50ZWdyaXR5XG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgIGxvZ2dlci5kZWJ1ZyhgUHJlY2FjaGluZyBkaWQgbm90IGZpbmQgYSBtYXRjaCBmb3IgJHtnZXRGcmllbmRseVVSTChyZXF1ZXN0LnVybCl9LmApO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9O1xuICAgICAgICBzdXBlcihtYXRjaCwgc2Vyd2lzdC5wcmVjYWNoZVN0cm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N0IG9yaWdpbmFsSGl0VGltZSA9IHRpbWVzdGFtcCAtIChOdW1iZXIocGFyYW1zLmdldChcInF0XCIpKSB8fCAwKTtcbiAgICAgICAgICAgICAgICBjb25zdCBxdWV1ZVRpbWUgPSBEYXRlLm5vdygpIC0gb3JpZ2luYWxIaXRUaW1lO1xuICAgICAgICAgICAgICAgIHBhcmFtcy5zZXQoXCJxdFwiLCBTdHJpbmcocXVldWVUaW1lKSk7XG4gICAgICAgICAgICAgICAgaWYgKGNvbmZpZy5wYXJhbWV0ZXJPdmVycmlkZXMpIHtcbiAgICAgICAgICAgICAgICAgICAgZm9yIChjb25zdCBwYXJhbSBvZiBPYmplY3Qua2V5cyhjb25maWcucGFyYW1ldGVyT3ZlcnJpZGVzKSl7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB2YWx1ZSA9IGNvbmZpZy5wYXJhbWV0ZXJPdmVycmlkZXNbcGFyYW1dO1xuICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zLnNldChwYXJhbSwgdmFsdWUpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgY29uZmlnLmhpdEZpbHRlciA9PT0gXCJmdW5jdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbmZpZy5oaXRGaWx0ZXIuY2FsbChudWxsLCBwYXJhbXMpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBhd2FpdCBmZXRjaChuZXcgUmVxdWVzdCh1cmwub3JpZ2luICsgdXJsLnBhdGhuYW1lLCB7XG4gICAgICAgICAgICAgICAgICAgIGJvZHk6IHBhcmFtcy50b1N0cmluZygpLFxuICAgICAgICAgICAgICAgICAgICBtZXRob2Q6IFwiUE9TVFwiLFxuICAgICAgICAgICAgICAgICAgICBtb2RlOiBcImNvcnNcIixcbiAgICAgICAgICAgICAgICAgICAgY3JlZGVudGlhbHM6IFwib21pdFwiLFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcIkNvbnRlbnQtVHlwZVwiOiBcInRleHQvcGxhaW5cIlxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmxvZyhgUmVxdWVzdCBmb3IgJyR7Z2V0RnJpZW5kbHlVUkwodXJsLmhyZWYpfScgaGFzIGJlZW4gcmVwbGF5ZWRgKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGNhdGNoIChlcnIpIHtcbiAgICAgICAgICAgICAgICBhd2FpdCBxdWV1ZS51bnNoaWZ0UmVxdWVzdChlbnRyeSk7XG4gICAgICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgICAgICBsb2dnZXIubG9nKGBSZXF1ZXN0IGZvciAnJHtnZXRGcmllbmRseVVSTCh1cmwuaHJlZil9JyBmYWlsZWQgdG8gcmVwbGF5LCBwdXR0aW5nIGl0IGJhY2sgaW4gdGhlIHF1ZXVlLmApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB0aHJvdyBlcnI7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgbG9nZ2VyLmxvZyhcIkFsbCBHb29nbGUgQW5hbHl0aWNzIHJlcXVlc3Qgc3VjY2Vzc2Z1bGx5IHJlcGxheWVkOyBcIiArIFwidGhlIHF1ZXVlIGlzIG5vdyBlbXB0eSFcIik7XG4gICAgICAgIH1cbiAgICB9O1xufTt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BbmFseXRpY3NDb25maWcgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgaWYgKHR5cGVvZiBvZmZsaW5lQW5hbHl0aWNzQ29uZmlnID09PSBcImJvb2xlYW5cIikge1xuICAgICAgICAgICAgICAgIG9mZmxpbmVBbmFseXRpY3NDb25maWcgJiYgaW5pdGlhbGl6ZUdvb2dsZUFuYWx5dGljcyh7XG4gICAgICAgICAgICAgICAgICAgIHNlcndpc3Q6IHRoaXNcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaW5pdGlhbGl6ZUdvb2dsZUFuYWx5dGljcyh7XG4gICAgICAgICAgICAgICAgICAgIC4uLm9mZmxpbmVBbmFseXRpY3NDb25maWcsXG4gICAgICAgICAgICAgICAgICAgIHNlcndpc3Q6IHRoaXNcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAocnVudGltZUNhY2hpbmcgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgaWYgKGZhbGxiYWNrcyAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgY29uc3QgZmFsbGJhY2tQbHVnaW4gPSBuZXcgUHJlY2FjaGVGYWxsYmFja1BsdWdpbih7XG4gICAgICAgICAgICAgICAgICAgIGZhbGxiYWNrVXJsczogZmFsbGJhY2tzLmVudHJpZXMsXG4gICAgICAgICAgICAgICAgICAgIHNlcndpc3Q6IHRoaXNcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICBydW50aW1lQ2FjaGluZy5mb3JFYWNoKChjYWNoZUVudHJ5KT0+e1xuICAgICAgICAgICAgICAgICAgICBpZiAoY2FjaGVFbnRyeS5oYW5kbGVyIGluc3RhbmNlb2YgU3RyYXRlZ3kgJiYgIWNhY2hlRW50cnkuaGFuZGxlci5wbHVnaW5zLnNvbWUoKHBsdWdpbik9PlwiaGF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RyaWVzKSB7XG4gICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgIGZpbmFsQXNzZXJ0RXhwb3J0cy5pc0FycmF5KGVudHJpZXMsIHtcbiAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiBcInNlcndpc3RcIixcbiAgICAgICAgICAgICAgICBjbGFzc05hbWU6IFwiU2Vyd2lzdFwiLFxuICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcImFkZFRvQ2FjaGVMaXN0XCIsXG4gICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcImVudHJpZXNcIlxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgdXJsc1RvV2FybkFib3V0ID0gW107XG4gICAgICAgIGZvciAoY29uc3QgZW50cnkgb2YgZW50cmllcyl7XG4gICAgICAgICAgICBpZiAodHlwZW9mIGVudHJ5ID09PSBcInN0cmluZ1wiKSB7XG4gICAgICAgICAgICAgICAgdXJsc1RvV2FybkFib3V0LnB1c2goZW50cnkpO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChlbnRyeSAmJiAhZW50cnkuaW50ZWdyaXR5ICYmIGVudHJ5LnJldmlzaW9uID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICB1cmxzVG9XYXJuQWJvdXQucHVzaChlbnRyeS51cmwpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY29uc3QgeyBjYWNoZUtleSwgdXJsIH0gPSBjcmVhdGVDYWNoZUtleShlbnRyeSk7XG4gICAgICAgICAgICBjb25zdCBjYWNoZU1vZGUgPSB0eXBlb2YgZW50cnkgIT09IFwic3RyaW5nXCIgJiYgZW50cnkucmV2aXNpb24gPyBcInJlbG9hZFwiIDogXCJkZWZhdWx0XCI7XG4gICAgICAgICAgICBpZiAodGhpcy5fdXJsc1RvQ2FjaGVLZXlzLmhhcyh1cmwpICYmIHRoaXMuX3VybHNUb0NhY2hlS2V5cy5nZXQodXJsKSAhPT0gY2FjaGVLZXkpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgU2Vyd2lzdEVycm9yKFwiYWRkLXRvLWNhY2hlLWxpc3QtY29uZmxpY3RpbmctZW50cmllc1wiLCB7XG4gICAgICAgICAgICAgICAgICAgIGZpcnN0RW50cnk6IHRoaXMuX3VybHNUb0NhY2hlS2V5cy5nZXQodXJsKSxcbiAgICAgICAgICAgICAgICAgICAgc2Vjb25kRW50cnk6IGNhY2hlS2V5XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodHlwZW9mIGVudHJ5ICE9PSBcInN0cmluZ1wiICYmIGVudHJ5LmludGVncml0eSkge1xuICAgICAgICAgICAgICAgIGlmICh0aGlzLl9jYWNoZUtleXNUb0ludGVncml0aWVzLmhhcyhjYWNoZUtleSkgJiYgdGhpcy5fY2FjaGVLZXlzVG9JbnRlZ3JpdGllcy5nZXQoY2FjaGVLZXkpICE9PSBlbnRyeS5pbnRlZ3JpdHkpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFNlcndpc3RFcnJvcihcImFkZC10by1jYWNoZS1saXN0LWNvbmZsaWN0aW5nLWludGVncml0aWVzXCIsIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybFxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdGhpcy5fY2FjaGVLZXlzVG9JbnRlZ3JpdGllcy5zZXQoY2FjaGVLZXksIGVudHJ5LmludGVncml0eSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGlzLl91cmxzVG9DYWNoZUtleXMuc2V0KHVybCwgY2FjaGVLZXkpO1xuICAgICAgICAgICAgdGhpcy5fdXJsc1RvQ2FjaGVNb2Rlcy5zZXQodXJsLCBjYWNoZU1vZGUpO1xuICAgICAgICAgICAgaWYgKH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dyaXR5ID0gdGhpcy5fY2FjaGVLZXlzVG9JbnRlZ3JpdGllcy5nZXQoY2FjaGVLZXkpO1xuICAgICAgICAgICAgICAgIGNvbnN0IGNhY2hlTW9kZSA9IHRoaXMuX3VybHNUb0NhY2hlTW9kZXMuZ2V0KHVybCk7XG4gICAgICAgICAgICAgICAgY29uc3QgcmVxdWVzdCA9IG5ldyBSZXF1ZXN0KHVybCwge1xuICAgICAgICAgICAgICAgICAgICBpbnRlZ3JpdHksXG4gICAgICAgICAgICAgICAgICAgIGNhY2hlOiBjYWNoZU1vZGUsXG4gICAgICAgICAgICAgICAgICAgIGNyZWRlbnRpYWxzOiBcInNhbWUtb3JpZ2luXCJcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICBhd2FpdCBQcm9taXNlLmFsbCh0aGlzLnByZWNhY2hlU3RyYXRlZ3kuaGFuZGxlQWxsKHtcbiAgICAgICAgICAgICAgICAgICAgZXZlbnQsXG4gICAgICAgICAgICAgICAgICAgIHJlcXVlc3QsXG4gICAgICAgICAgICAgICAgICAgIHVybDogbmV3IFVSTChyZXF1ZXN0LnVybCksXG4gICAgICAgICAgICAgICAgICAgIHBhcmFtczoge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2FjaGVLZXlcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgY29uc3QgeyB1cGRhdGVkVVJMcywgbm90VXBkYXRlZFVSTHMgfSA9IGluc3RhbGxSZXBvcnRQbHVnaW47XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgcHJpbnRJbnN0YWxsRGV0YWlscyh1cGRhdGVkVVJMcywgbm90VXBkYXRlZFVSTHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICB1cGRhdGVkVVJMcyxcbiAgICAgICAgICAgICAgICBub3RVcGRhdGVkVVJMc1xuICAgICAgICAgICAgfTtcbiAgICAgICAgfSk7XG4gICAgfVxuICAgIGhhbmRsZUFjdGl2YXRlKGV2ZW50KSB7XG4gICAgICAgIHJldHVybiB3YWl0VW50aWwoZXZlbnQsIGFzeW5jICgpPT57XG4gICAgICAgICAgICBjb25zdCBjYWNoZSA9IGF3YWl0IHNlbGYuY2FjaGVzLm9wZW4odGhpcy5wcmVjYWNoZVN0cmF0ZWd5LmNhY2hlTmFtZSk7XG4gICAgICAgICAgICBjb25zdCBjdXJyZW50bHlDYWNoZWRSZXF1ZXN0cyA9IGF3YWl0IGNhY2hlLmtleXMoKTtcbiAgICAgICAgICAgIGNvbnN0IGV4cGVjdGVkQ2FjaGVLZXlzID0gbmV3IFNldCh0aGlzLl91cmxzVG9DYWNoZUtleXMudmFsdWVzKCkpO1xuICAgICAgICAgICAgY29uc3QgZGVsZXRlZENhY2hlUmVxdWVzdHMgPSBbXTtcbiAgICAgICAgICAgIGZvciAoY29uc3QgcmVxdWVzdCBvZiBjdXJyZW50bHlDYWNoZWRSZXF1ZXN0cyl7XG4gICAgICAgICAgICAgICAgaWYgKCFleHBlY3RlZENhY2hlS2V5cy5oYXMocmVxdWVzdC51cmwpKSB7XG4gICAgICAgICAgICAgICAgICAgIGF3YWl0IGNhY2hlLmRlbGV0ZShyZXF1ZXN0KTtcbiAgICAgICAgICAgICAgICAgICAgZGVsZXRlZENhY2hlUmVxdWVzdHMucHVzaChyZXF1ZXN0LnVybCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgIHByaW50Q2xlYW51cERldGFpbHMoZGVsZXRlZENhY2hlUmVxdWVzdHMpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0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ID0gbmV3IFJlcXVlc3QoZW50cnkpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHJlcXVlc3QgPSBuZXcgUmVxdWVzdCguLi5lbnRyeSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmhhbmRsZVJlcXVlc3Qoe1xuICAgICAgICAgICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgICAgICAgICBldmVudFxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgZXZlbnQud2FpdFVudGlsKHJlcXVlc3RQcm9taXNlcyk7XG4gICAgICAgICAgICBpZiAoZXZlbnQucG9ydHM/LlswXSkge1xuICAgICAgICAgICAgICAgIHZvaWQgcmVxdWVzdFByb21pc2VzLnRoZW4oKCk9PmV2ZW50LnBvcnRzWzBdLnBvc3RNZXNzYWdlKHRydWUpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbiAgICBzZXREZWZhdWx0SGFuZGxlcihoYW5kbGVyLCBtZXRob2QgPSBkZWZhdWx0TWV0aG9kKSB7XG4gICAgICAgIHRoaXMuX2RlZmF1bHRIYW5kbGVyTWFwLnNldChtZXRob2QsIG5vcm1hbGl6ZUhhbmRsZXIoaGFuZGxlcikpO1xuICAgIH1cbiAgICBzZXRDYXRjaEhhbmRsZXIoaGFuZGxlcikge1xuICAgICAgICB0aGlzLl9jYXRjaEhhbmRsZXIgPSBub3JtYWxpemVIYW5kbGVyKGhhbmRsZXIpO1xuICAgIH1cbiAgICByZWdpc3RlckNhcHR1cmUoY2FwdHVyZSwgaGFuZGxlciwgbWV0aG9kKSB7XG4gICAgICAgIGNvbnN0IHJvdXRlID0gcGFyc2VSb3V0ZShjYXB0dXJlLCBoYW5kbGVyLCBtZXRob2QpO1xuICAgICAgICB0aGlzLnJlZ2lzdGVyUm91dGUocm91dGUpO1xuICAgICAgICByZXR1cm4gcm91dGU7XG4gICAgfVxuICAgIHJlZ2lzdGVyUm91dGUocm91dGUpIHtcbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmlzVHlwZShyb3V0ZSwgXCJvYmplY3RcIiwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwic2Vyd2lzdFwiLFxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJTZXJ3aXN0XCIsXG4gICAgICAgICAgICAgICAgZnVuY05hbWU6IFwicmVnaXN0ZXJSb3V0ZVwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJyb3V0ZVwiXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGZpbmFsQXNzZXJ0RXhwb3J0cy5oYXNNZXRob2Qocm91dGUsIFwibWF0Y2hcIiwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwic2Vyd2lzdFwiLFxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJTZXJ3aXN0XCIsXG4gICAgICAgICAgICAgICAgZnVuY05hbWU6IFwicmVnaXN0ZXJSb3V0ZVwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJyb3V0ZVwiXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGZpbmFsQXNzZXJ0RXhwb3J0cy5pc1R5cGUocm91dGUuaGFuZGxlciwgXCJvYmplY3RcIiwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwic2Vyd2lzdFwiLFxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJTZXJ3aXN0XCIsXG4gICAgICAgICAgICAgICAgZnVuY05hbWU6IFwicmVnaXN0ZXJSb3V0ZVwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJyb3V0ZVwiXG4gICAgICAgICAgICB9KTtc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dCxcbiAgICAgICAgICAgIHNhbWVPcmlnaW4sXG4gICAgICAgICAgICB1cmxcbiAgICAgICAgfSk7XG4gICAgICAgIGxldCBoYW5kbGVyID0gcm91dGU/LmhhbmRsZXI7XG4gICAgICAgIGNvbnN0IGRlYnVnTWVzc2FnZXMgPSBbXTtcbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgaWYgKGhhbmRsZXIpIHtcbiAgICAgICAgICAgICAgICBkZWJ1Z01lc3NhZ2VzLnB1c2goW1xuICAgICAgICAgICAgICAgICAgICBcIkZvdW5kIGEgcm91dGUgdG8gaGFuZGxlIHRoaXMgcmVxdWVzdDpcIixcbiAgICAgICAgICAgICAgICAgICAgcm91dGVcbiAgICAgICAgICAgICAgICBdKTtcbiAgICAgICAgICAgICAgICBpZiAocGFyYW1zKSB7XG4gICAgICAgICAgICAgICAgICAgIGRlYnVnTWVzc2FnZXMucHVzaChbXG4gICAgICAgICAgICAgICAgICAgICAgICBgUGFzc2luZyB0aGUgZm9sbG93aW5nIHBhcmFtcyB0byB0aGUgcm91dGUncyBoYW5kbGVyOmAsXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXJhbXNcbiAgICAgICAgICAgICAgICAgICAgXSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGNvbnN0IG1ldGhvZCA9IHJlcXVlc3QubWV0aG9kO1xuICAgICAgICBpZiAoIWhhbmRsZXIgJiYgdGhpcy5fZGVmYXVsdEhhbmRsZXJNYXAuaGFzKG1ldGhvZCkpIHtcbiAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICBkZWJ1Z01lc3NhZ2VzLnB1c2goYEZhaWxlZCB0byBmaW5kIGEgbWF0Y2hpbmcgcm91dGUuIEZhbGxpbmcgYmFjayB0byB0aGUgZGVmYXVsdCBoYW5kbGVyIGZvciAke21ldGhvZH0uYCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBoYW5kbGVyID0gdGhpcy5fZGVmYXVsdEhhbmRsZXJNYXAuZ2V0KG1ldGhvZCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCFoYW5kbGVyKSB7XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgbG9nZ2VyLmRlYnVnKGBObyByb3V0ZSBmb3VuZCBmb3I6ICR7Z2V0RnJpZW5kbHlVUkwodXJsKX1gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBsb2dnZXIuZ3JvdXBDb2xsYXBzZWQoYFJvdXRlciBpcyByZXNwb25kaW5nIHRvOiAke2dldEZyaWVuZGx5VVJMKHVybCl9YCk7XG4gICAgICAgICAgICBmb3IgKGNvbnN0IG1zZyBvZiBkZWJ1Z01lc3NhZ2VzKXtcbiAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShtc2cpKSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ2dlci5sb2coLi4ubXNnKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBsb2dnZXIubG9nKG1zZyk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbG9nZ2VyLmdyb3VwRW5kKCk7XG4gICAgICAgIH1cbiAgICAgICAgbGV0IHJlc3BvbnNlUHJvbWlzZTtcbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIHJlc3BvbnNlUHJvbWlzZSA9IGhhbmRsZXIuaGFuZGxlKHtcbiAgICAgICAgICAgICAgICB1cmwsXG4gICAgICAgICAgICAgICAgcmVxdWVzdCxcbiAgICAgICAgICAgICAgICBldmVudCxcbiAgICAgICAgICAgICAgICBwYXJhbXNcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9IGNhdGNoIChlcnIpIHtcbiAgICAgICAgICAgIHJlc3BvbnNlUHJvbWlzZSA9IFByb21pc2UucmVqZWN0KGVycik7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgY2F0Y2hIYW5kbGVyID0gcm91dGU/LmNhdGNoSGFuZGxlcjtcbiAgICAgICAgaWYgKHJlc3BvbnNlUHJvbWlzZSBpbnN0YW5jZW9mIFByb21pc2UgJiYgKHRoaXMuX2NhdGNoSGFuZGxlciB8fCBjYXRjaEhhbmRsZXIpKSB7XG4gICAgICAgICAgICByZXNwb25zZVByb21pc2UgPSByZXNwb25zZVByb21pc2UuY2F0Y2goYXN5bmMgKGVycik9PntcbiAgICAgICAgICAgICAgICBpZiAoY2F0Y2hIYW5kbGVyKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZ2dlci5ncm91cENvbGxhcHNlZChgRXJyb3IgdGhyb3duIHdoZW4gcmVzcG9uZGluZyB0bzogICR7Z2V0RnJpZW5kbHlVUkwodXJsKX0uIEZhbGxpbmcgYmFjayB0byByb3V0ZSdzIENhdGNoIEhhbmRsZXIuYCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBsb2dnZXIuZXJyb3IoXCJFcnJvciB0aHJvd24gYnk6XCIsIHJvdXRlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZ2dlci5lcnJvcihlcnIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmdyb3VwRW5kKCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhd2FpdCBjYXRjaEhhbmRsZXIuaGFuZGxlKHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmwsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbXNcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChjYXRjaEVycikge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNhdGNoRXJyIGluc3RhbmNlb2YgRXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSBjYXRjaEVycjtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAodGhpcy5fY2F0Y2hIYW5kbGVyKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZ2dlci5ncm91cENvbGxhcHNlZChgRXJyb3IgdGhyb3duIHdoZW4gcmVzcG9uZGluZyB0bzogICR7Z2V0RnJpZW5kbHlVUkwodXJsKX0uIEZhbGxpbmcgYmFjayB0byBnbG9iYWwgQ2F0Y2ggSGFuZGxlci5gKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZ2dlci5lcnJvcihcIkVycm9yIHRocm93biBieTpcIiwgcm91dGUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyLmVycm9yKGVycik7XG4gICAgICAgICAgICAgICAgICAgICAgICBsb2dnZXIuZ3JvdXBFbmQoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fY2F0Y2hIYW5kbGVyLmhhbmRsZSh7XG4gICAgICAgICAgICAgICAgICAgICAgICB1cmwsXG4gICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0LFxuICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHRocm93IGVycjtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXNwb25zZVByb21pc2U7XG4gICAgfVxuICAgIGZpbmRNYXRjaGluZ1JvdXRlKHsgdXJsLCBzYW1lT3JpZ2luLCByZXF1ZXN0LCBldmVudCB9KSB7XG4gICAgICAgIGNvbnN0IHJvdXRlcyA9IHRoaXMuX3JvdXRlcy5nZXQocmVxdWVzdC5tZXRob2QpIHx8IFtdO1xuICAgICAgICBmb3IgKGNvbnN0IHJvdXRlIG9mIHJvdXRlcyl7XG4gICAgICAgICAgICBsZXQgcGFyYW1zO1xuICAgICAgICAgICAgY29uc3QgbWF0Y2hSZXN1bHQgPSByb3V0ZS5tYXRjaCh7XG4gICAgICAgICAgICAgICAgdXJsLFxuICAgICAgICAgICAgICAgIHNhbWVPcmlnaW4sXG4gICAgICAgICAgICAgICAgcmVxdWVzdCxcbiAgICAgICAgICAgICAgICBldmVudFxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBpZiAobWF0Y2hSZXN1bHQpIHtcbiAgICAgICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChtYXRjaFJlc3VsdCBpbnN0YW5jZW9mIFByb21pc2UpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZ2dlci53YXJuKGBXaGlsZSByb3V0aW5nICR7Z2V0RnJpZW5kbHlVUkwodXJsKX0sIGFuIGFzeW5jIG1hdGNoQ2FsbGJhY2sgZnVuY3Rpb24gd2FzIHVzZWQuIFBsZWFzZSBjb252ZXJ0IHRoZSBmb2xsb3dpbmcgcm91dGUgdG8gdXNlIGEgc3luY2hyb25vdXMgbWF0Y2hDYWxsYmFjayBmdW5jdGlvbjpgLCByb3V0ZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcGFyYW1zID0gbWF0Y2hSZXN1bHQ7XG4gICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkocGFyYW1zKSAmJiBwYXJhbXMubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHBhcmFtcyA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1hdGNoUmVzdWx0LmNvbnN0cnVjdG9yID09PSBPYmplY3QgJiYgT2JqZWN0LmtleXMobWF0Y2hSZXN1bHQpLmxlbmd0aCA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICBwYXJhbXMgPSB1bmRlZmluZWQ7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgbWF0Y2hSZXN1bHQgPT09IFwiYm9vbGVhblwiKSB7XG4gICAgICAgICAgICAgICAgICAgIHBhcmFtcyA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICAgICAgcm91dGUsXG4gICAgICAgICAgICAgICAgICAgIHBhcmFtc1xuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHt9O1xuICAgIH1cbn1cblxuY29uc3QgY2FjaGVOYW1lcyA9IHtcbiAgICBnZXQgZ29vZ2xlQW5hbHl0aWNzICgpIHtcbiAgICAgICAgcmV0dXJuIGNhY2hlTmFtZXMkMS5nZXR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O1xuICAgICAgICAgICAgICAgIGlmIChvcHRpb25zLmV2ZW50IGluc3RhbmNlb2YgRmV0Y2hFdmVudCkge1xuICAgICAgICAgICAgICAgICAgICByZXN1bHRpbmdDbGllbnRJZCA9IG9wdGlvbnMuZXZlbnQucmVzdWx0aW5nQ2xpZW50SWQ7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNvbnN0IHJlc3VsdGluZ1dpbiA9IGF3YWl0IHJlc3VsdGluZ0NsaWVudEV4aXN0cyhyZXN1bHRpbmdDbGllbnRJZCk7XG4gICAgICAgICAgICAgICAgaWYgKCFyZXN1bHRpbmdXaW4gfHwgaXNTYWZhcmkpIHtcbiAgICAgICAgICAgICAgICAgICAgYXdhaXQgdGltZW91dCgzNTAwKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodGhpcy5fbm90aWZ5QWxsQ2xpZW50cykge1xuICAgICAgICAgICAgICAgIGNvbnN0IHdpbmRvd3MgPSBhd2FpdCBzZWxmLmNsaWVudHMubWF0Y2hBbGwoe1xuICAgICAgICAgICAgICAgICAgICB0eXBlOiBcIndpbmRvd1wiXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgZm9yIChjb25zdCB3aW4gb2Ygd2luZG93cyl7XG4gICAgICAgICAgICAgICAgICAgIHdpbi5wb3N0TWVzc2FnZShtZXNzYWdlRGF0YSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBpZiAob3B0aW9ucy5ldmVudCBpbnN0YW5jZW9mIEZldGNoRXZlbnQpIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgY2xpZW50ID0gYXdhaXQgc2VsZi5jbGllbnRzLmdldChvcHRpb25zLmV2ZW50LmNsaWVudElkKTtcbiAgICAgICAgICAgICAgICAgICAgY2xpZW50Py5wb3N0TWVzc2FnZShtZXNzYWdlRGF0YSk7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c3NlcnRFeHBvcnRzLmlzQXJyYXkoY29uZmlnLnN0YXR1c2VzLCB7XG4gICAgICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwic2Vyd2lzdFwiLFxuICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6IFwiQ2FjaGVhYmxlUmVzcG9uc2VcIixcbiAgICAgICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiY29uc3RydWN0b3JcIixcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcImNvbmZpZy5zdGF0dXNlc1wiXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoY29uZmlnLmhlYWRlcnMpIHtcbiAgICAgICAgICAgICAgICBmaW5hbEFzc2VydEV4cG9ydHMuaXNUeXBlKGNvbmZpZy5oZWFkZXJzLCBcIm9iamVjdFwiLCB7XG4gICAgICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwic2Vyd2lzdFwiLFxuICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6IFwiQ2FjaGVhYmxlUmVzcG9uc2VcIixcbiAgICAgICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiY29uc3RydWN0b3JcIixcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcImNvbmZpZy5oZWFkZXJzXCJcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICB0aGlzLl9zdGF0dXNlcyA9IGNvbmZpZy5zdGF0dXNlcztcbiAgICAgICAgaWYgKGNvbmZpZy5oZWFkZXJzKSB7XG4gICAgICAgICAgICB0aGlzLl9oZWFkZXJzID0gbmV3IEhlYWRlcnMoY29uZmlnLmhlYWRlcnMpO1xuICAgICAgICB9XG4gICAgfVxuICAgIGlzUmVzcG9uc2VDYWNoZWFibGUocmVzcG9uc2UpIHtcbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmlzSW5zdGFuY2UocmVzcG9uc2UsIFJlc3BvbnNlLCB7XG4gICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJzZXJ3aXN0XCIsXG4gICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIkNhY2hlYWJsZVJlc3BvbnNlXCIsXG4gICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiaXNSZXNwb25zZUNhY2hlYWJsZVwiLFxuICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJyZXNwb25zZVwiXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICBsZXQgY2FjaGVhYmxlID0gdHJ1ZTtcbiAgICAgICAgaWYgKHRoaXMuX3N0YXR1c2VzKSB7XG4gICAgICAgICAgICBjYWNoZWFibGUgPSB0aGlzLl9zdGF0dXNlcy5pbmNsdWRlcyhyZXNwb25zZS5zdGF0dXMpO1xuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLl9oZWFkZXJzICYmIGNhY2hlYWJsZSkge1xuICAgICAgICAgICAgZm9yIChjb25zdCBbaGVhZGVyTmFtZSwgaGVhZGVyVmFsdWVdIG9mIHRoaXMuX2hlYWRlcnMuZW50cmllcygpKXtcbiAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2UuaGVhZGVycy5nZXQoaGVhZGVyTmFtZSkgIT09IGhlYWRlclZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIGNhY2hlYWJsZSA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgaWYgKCFjYWNoZWFibGUpIHtcbiAgICAgICAgICAgICAgICBsb2dnZXI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dGVcIikuc3RvcmUuaW5kZXgoXCJ0aW1lc3RhbXBcIikub3BlbkN1cnNvcihudWxsLCBcInByZXZcIik7XG4gICAgICAgIGNvbnN0IHVybHNEZWxldGVkID0gW107XG4gICAgICAgIGxldCBlbnRyaWVzTm90RGVsZXRlZENvdW50ID0gMDtcbiAgICAgICAgd2hpbGUoY3Vyc29yKXtcbiAgICAgICAgICAgIGNvbnN0IHJlc3VsdCA9IGN1cnNvci52YWx1ZTtcbiAgICAgICAgICAgIGlmIChyZXN1bHQuY2FjaGVOYW1lID09PSB0aGlzLl9jYWNoZU5hbWUpIHtcbiAgICAgICAgICAgICAgICBpZiAobWluVGltZXN0YW1wICYmIHJlc3VsdC50aW1lc3RhbXAgPCBtaW5UaW1lc3RhbXAgfHwgbWF4Q291bnQgJiYgZW50cmllc05vdERlbGV0ZWRDb3VudCA+PSBtYXhDb3VudCkge1xuICAgICAgICAgICAgICAgICAgICBjdXJzb3IuZGVsZXRlKCk7XG4gICAgICAgICAgICAgICAgICAgIHVybHNEZWxldGVkLnB1c2gocmVzdWx0LnVybCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgZW50cmllc05vdERlbGV0ZWRDb3VudCsrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGN1cnNvciA9IGF3YWl0IGN1cnNvci5jb250aW51ZSgpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB1cmxzRGVsZXRlZDtcbiAgICB9XG4gICAgYXN5bmMgZ2V0RGIoKSB7XG4gICAgICAgIGlmICghdGhpcy5fZGIpIHtcbiAgICAgICAgICAgIHRoaXMuX2RiID0gYXdhaXQgb3BlbkRCKERCX05BTUUsIDEsIHtcbiAgICAgICAgICAgICAgICB1cGdyYWRlOiB0aGlzLl91cGdyYWRlRGJBbmREZWxldGVPbGREYnMuYmluZCh0aGlzKVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRoaXMuX2RiO1xuICAgIH1cbn1cblxuY2xhc3MgQ2FjaGVFeHBpcmF0aW9uIHtcbiAgICBfaXNSdW5uaW5nID0gZmFsc2U7XG4gICAgX3JlcnVuUmVxdWVzdGVkID0gZmFsc2U7XG4gICAgX21heEVudHJpZXM7XG4gICAgX21heEFnZVNlY29uZHM7XG4gICAgX21hdGNoT3B0aW9ucztcbiAgICBfY2FjaGVOYW1lO1xuICAgIF90aW1lc3RhbXBNb2RlbDtcbiAgICBjb25zdHJ1Y3RvcihjYWNoZU5hbWUsIGNvbmZpZyA9IHt9KXtcbiAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmlzVHlwZShjYWNoZU5hbWUsIFwic3RyaW5nXCIsIHtcbiAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiBcInNlcndpc3RcIixcbiAgICAgICAgICAgICAgICBjbGFzc05hbWU6IFwiQ2FjaGVFeHBpcmF0aW9uXCIsXG4gICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiY29uc3RydWN0b3JcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwiY2FjaGVOYW1lXCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgaWYgKCEoY29uZmlnLm1heEVudHJpZXMgfHwgY29uZmlnLm1heEFnZVNlY29uZHMpKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IFNlcndpc3RFcnJvcihcIm1heC1lbnRyaWVzLW9yLWFnZS1yZXF1aXJlZFwiLCB7XG4gICAgICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwic2Vyd2lzdFwiLFxuICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6IFwiQ2FjaGVFeHBpcmF0aW9uXCIsXG4gICAgICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcImNvbnN0cnVjdG9yXCJcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChjb25maWcubWF4RW50cmllcykge1xuICAgICAgICAgICAgICAgIGZpbmFsQXNzZXJ0RXhwb3J0cy5pc1R5cGUoY29uZmlnLm1heEVudHJpZXMsIFwibnVtYmVyXCIsIHtcbiAgICAgICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJzZXJ3aXN0XCIsXG4gICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJDYWNoZUV4cGlyYXRpb25cIixcbiAgICAgICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiY29uc3RydWN0b3JcIixcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcImNvbmZpZy5tYXhFbnRyaWVzXCJcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChjb25maWcubWF4QWdlU2Vjb25kcykge1xuICAgICAgICAgICAgICAgIGZpbmFsQXNzZXJ0RXhwb3J0cy5pc1R5cGUoY29uZmlnLm1heEFnZVNlY29uZHMsIFwibnVtYmVyXCIsIHtcbiAgICAgICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJzZXJ3aXN0XCIsXG4gICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJDYWNoZUV4cGlyYXRpb25cIixcbiAgICAgICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiY29uc3RydWN0b3JcIixcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcImNvbmZpZy5tYXhBZ2VTZWNvbmRzXCJcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICB0aGlzLl9tYXhFbnRyaWVzID0gY29uZmlnLm1heEVudHJpZXM7XG4gICAgICAgIHRoaXMuX21heEFnZVNlY29uZHMgPSBjb25maWcubWF4QWdlU2Vjb25kcztcbiAgICA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09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICBmaW5hbEFzc2VydEV4cG9ydHMuaXNUeXBlKHVybCwgXCJzdHJpbmdcIiwge1xuICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwic2Vyd2lzdFwiLFxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJDYWNoZUV4cGlyYXRpb25cIixcbiAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJ1cGRhdGVUaW1lc3RhbXBcIixcbiAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwidXJsXCJcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGF3YWl0IHRoaXMuX3RpbWVzdGFtcE1vZGVsLnNldFRpbWVzdGFtcCh1cmwsIERhdGUubm93KCkpO1xuICAgIH1cbiAgICBhc3luYyBpc1VSTEV4cGlyZWQodXJsKSB7XG4gICAgICAgIGlmICghdGhpcy5fbWF4QWdlU2Vjb25kcykge1xuICAgICAgICAgICAgaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSBcInByb2R1Y3Rpb25cIikge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBTZXJ3aXN0RXJyb3IoXCJleHBpcmVkLXRlc3Qtd2l0aG91dC1tYXgtYWdlXCIsIHtcbiAgICAgICAgICAgICAgICAgICAgbWV0aG9kTmFtZTogXCJpc1VSTEV4cGlyZWRcIixcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcIm1heEFnZVNlY29uZHNcIlxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IHRpbWVzdGFtcCA9IGF3YWl0IHRoaXMuX3RpbWVzdGFtcE1vZGVsLmdldFRpbWVzdGFtcCh1cmwpO1xuICAgICAgICBjb25zdCBleHBpcmVPbGRlclRoYW4gPSBEYXRlLm5vdygpIC0gd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AgICBjb25zdHJ1Y3Rvcihjb25maWcgPSB7fSl7XG4gICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gXCJwcm9kdWN0aW9uXCIpIHtcbiAgICAgICAgICAgIGlmICghKGNvbmZpZy5tYXhFbnRyaWVzIHx8IGNvbmZpZy5tYXhBZ2VTZWNvbmRzKSkge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBTZXJ3aXN0RXJyb3IoXCJtYXgtZW50cmllcy1vci1hZ2UtcmVxdWlyZWRcIiwge1xuICAgICAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiBcInNlcndpc3RcIixcbiAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIkV4cGlyYXRpb25QbHVnaW5cIixcbiAgICAgICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiY29uc3RydWN0b3JcIlxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGNvbmZpZy5tYXhFbnRyaWVzKSB7XG4gICAgICAgICAgICAgICAgZmluYWxBc3NlcnRFeHBvcnRzLmlzVHlwZShjb25maWcubWF4RW50cmllcywgXCJudW1iZXJcIiwge1xuICAgICAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiBcInNlcndpc3RcIixcbiAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiBcIkV4cGlyYXRpb25QbHVnaW5cIixcbiAgICAgICAgICAgICAgICAgICAgZnVuY05hbWU6IFwiY29uc3RydWN0b3JcIixcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1OYW1lOiBcImNvbmZpZy5tYXhFbnRyaWVzXCJcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChjb25maWcubWF4QWdlU2Vjb25kcykge1xuICAgICAgICAgICAgICAgIGZpbmFsQXNzZXJ0RXhwb3J0cy5pc1R5cGUoY29uZmlnLm1heEFnZVNlY29uZHMsIFwibnVtYmVyXCIsIHtcbiAgICAgICAgICAgICAgICAgICAgbW9kdWxlTmFtZTogXCJzZXJ3aXN0XCIsXG4gICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogXCJFeHBpcmF0aW9uUGx1Z2luXCIsXG4gICAgICAgICAgICAgICAgICAgIGZ1bmNOYW1lOiBcImNvbnN0cnVjdG9yXCIsXG4gICAgICAgICAgICAgICAgICAgIHBhcmFtTmFtZTogXCJjb25maWcubWF4QWdlU2Vjb25kc1wiXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoY29uZmlnLm1heEFnZUZyb20pIHtcbiAgICAgICAgICAgICAgICBmaW5hbEFzc2VydEV4cG9ydHMuaXNUeXBlKGNvbmZpZy5tYXhBZ2VGcm9tLCBcInN0cmluZ1wiLCB7XG4gICAgICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IFwic2Vyd2lzdFwiLFxuICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6IFwiRXhwaXJhdGlvblBsdWdpblwiLFxuICAgICAgICAgICAgICAgICAgICBmdW5jTmFtZTogXCJjb25zdHJ1Y3RvclwiLFxuICAgICAgICAgICAgICAgICAgICBwYXJhbU5hbWU6IFwiY29uZmlnLm1heEFnZUZyb21cIlxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHRoaXMuX2NvbmZpZyA9IGNvbmZpZztcbiAgICAgICAgdGhpcy5fY2FjaGVFeHBpcmF0aW9ucyA9IG5ldyBNYXAoKTtcbiAgICAgICAgaWYgKCF0aGlzLl9jb25maWcubWF4QWdlRnJvbSkge1xuICAgICAgICAgICAgdGhpcy5fY29uZmlnLm1heEFnZUZyb20gPSBcImxhc3QtZmV0Y2hlZFwiO1xuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLl9jb25maWcucHVyZ2VPblF1b3RhRXJyb3IpIHtcbiAgICAgICAgICAgIHJlZ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gICAgIGxvZ3MucHVzaChgTm8gcmVzcG9uc2UgZm91bmQgaW4gdGhlICcke3RoaXMuY2FjaGVOYW1lfScgY2FjaGUuIFdpbGwgcmVzcG9uZCB3aXRoIGEgbmV0d29yayByZXF1ZXN0LmApO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IGhhbmRsZXIuZmV0Y2hBbmRDYWNoZVB1dChyZXF1ZXN0KTtcbiAgICAgICAgICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgICAgICAgICAgIGlmIChlcnIgaW5zdGFuY2VvZiBFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICBlcnJvciA9IGVycjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ3MucHVzaChcIkdvdCByZXNwb25zZSBmcm9tIG5ldHdvcmsuXCIpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGxvZ3MucHVzaChcIlVuYWJsZSB0byBnZXQgYSByZXNwb25zZSBmcm9tIHRoZSBuZXR3b3JrLlwiKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09IFwicHJvZHVjdGlvblwiKSB7XG4gICAgICAgICAgICAgICAgbG9ncy5wdXNoKGBGb3VuZCBhIGNhY2hlZCByZXNwb25zZSBpbiB0aGUgJyR7dGhpcy5jYWNoZU5hbWV9JyBjYWNoZS5gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAocHJvY2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bmFibGVOYXZpZ2F0aW9uUHJlbG9hZCwgaW5pdGlhbGl6ZUdvb2dsZUFuYWx5dGljcywgcmVnaXN0ZXJRdW90YUVycm9yQ2FsbGJhY2ssIHJlc3BvbnNlc0FyZVNhbWUsIHNldENhY2hlTmFtZURldGFpbHMgfTtcbiJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/serwist@9.0.2_typescript@5.4.5/node_modules/serwist/dist/index.js\n")); /***/ }) diff --git a/public/swe-worker-development.js b/public/swe-worker-development.js index 56b3e519..0a5bd310 100644 --- a/public/swe-worker-development.js +++ b/public/swe-worker-development.js @@ -10,13 +10,13 @@ /******/ "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 ***! - \**********************************************************************************************************************************************************/ +/***/ "./node_modules/.pnpm/@serwist+next@9.0.2_next@14.2.3_@babel+core@7.24.5_react-dom@18.3.1_react@18.3.1__react@18.3._e2nkmeterpqllgsh44wfxk7k2q/node_modules/@serwist/next/dist/sw-entry-worker.js": +/*!********************************************************************************************************************************************************************************************************!*\ + !*** ./node_modules/.pnpm/@serwist+next@9.0.2_next@14.2.3_@babel+core@7.24.5_react-dom@18.3.1_react@18.3.1__react@18.3._e2nkmeterpqllgsh44wfxk7k2q/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")); +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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvLnBucG0vQHNlcndpc3Q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Ch1cmwpO1xuICAgICAgICAgICAgICAgIGlmICghcmVzcG9uc2UucmVkaXJlY3RlZCkge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBzdGFydFVybENhY2hlID0gYXdhaXQgY2FjaGVzLm9wZW4oXCJzdGFydC11cmxcIik7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBzdGFydFVybENhY2hlLnB1dCh1cmwsIHJlc3BvbnNlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSgpO1xuICAgICAgICAgICAgfVxuICAgICAgICBjYXNlIFwiX19GUk9OVEVORF9OQVZfQ0FDSEVfX1wiOlxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgIGNvbnN0IHVybCA9IGV2LmRhdGEudXJsO1xuICAgICAgICAgICAgICAgIGNvbnN0IHBhZ2VzQ2FjaGUgPSBhd2FpdCBjYWNoZXMub3BlbihcInBhZ2VzXCIpO1xuICAgICAgICAgICAgICAgIGNvbnN0IGlzUGFnZUNhY2hlZCA9ICEhYXdhaXQgcGFnZXNDYWNoZS5tYXRjaCh1cmwsIHtcbiAgICAgICAgICAgICAgICAgICAgaWdub3JlU2VhcmNoOiB0cnVlXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgaWYgKGlzUGFnZUNhY2hlZCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNvbnN0IHBhZ2UgPSBhd2FpdCBmZXRjaCh1cmwpO1xuICAgICAgICAgICAgICAgIGlmICghcGFnZS5vaykge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHBhZ2VzQ2FjaGUucHV0KHVybCwgcGFnZS5jbG9uZSgpKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKCk7XG4gICAgfVxufTtcbiJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/.pnpm/@serwist+next@9.0.2_next@14.2.3_@babel+core@7.24.5_react-dom@18.3.1_react@18.3.1__react@18.3._e2nkmeterpqllgsh44wfxk7k2q/node_modules/@serwist/next/dist/sw-entry-worker.js\n")); /***/ }) @@ -96,7 +96,7 @@ eval(__webpack_require__.ts("__webpack_require__.r(__webpack_exports__);\nself.o /******/ // 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__); +/******/ __webpack_modules__["./node_modules/.pnpm/@serwist+next@9.0.2_next@14.2.3_@babel+core@7.24.5_react-dom@18.3.1_react@18.3.1__react@18.3._e2nkmeterpqllgsh44wfxk7k2q/node_modules/@serwist/next/dist/sw-entry-worker.js"](0, __webpack_exports__, __webpack_require__); /******/ /******/ })() ; \ No newline at end of file