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ivr using Terser v5.39.0.\n * Original file: /npm/next-pwa@5.6.0/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict'\n\nconst path = require('path')\nconst fs = require('fs')\nconst globby = require('globby')\nconst crypto = require('crypto')\nconst { CleanWebpackPlugin } = require('clean-webpack-plugin')\nconst WorkboxPlugin = require('workbox-webpack-plugin')\nconst defaultCache = require('./cache')\nconst buildCustomWorker = require('./build-custom-worker')\nconst buildFallbackWorker = require('./build-fallback-worker')\n\nconst getRevision = file => crypto.createHash('md5').update(fs.readFileSync(file)).digest('hex')\n\nmodule.exports =\n  (pluginOptions = {}) =>\n  (nextConfig = {}) =>\n    Object.assign({}, nextConfig, {\n      webpack(config, options) {\n        const {\n          webpack,\n          buildId,\n          dev,\n          config: { distDir = '.next', pageExtensions = ['tsx', 'ts', 'jsx', 'js', 'mdx'], experimental = {} }\n        } = options\n\n        let basePath = options.config.basePath\n        if (!basePath) basePath = '/'\n\n        // For workbox configurations:\n        // https://developers.google.com/web/tools/workbox/reference-docs/latest/module-workbox-webpack-plugin.GenerateSW\n        const {\n          disable = false,\n          register = true,\n          dest = distDir,\n          sw = 'sw.js',\n          cacheStartUrl = true,\n          dynamicStartUrl = true,\n          dynamicStartUrlRedirect,\n          skipWaiting = true,\n          clientsClaim = true,\n          cleanupOutdatedCaches = true,\n          additionalManifestEntries,\n          ignoreURLParametersMatching = [],\n          importScripts = [],\n          publicExcludes = ['!noprecache/**/*'],\n          buildExcludes = [],\n          modifyURLPrefix = {},\n          manifestTransforms = [],\n          fallbacks = {},\n          cacheOnFrontEndNav = false,\n          reloadOnOnline = true,\n          scope = basePath,\n          customWorkerDir = 'worker',\n          subdomainPrefix, // deprecated, use basePath in next.config.js instead\n          ...workbox\n        } = pluginOptions\n\n        if (typeof nextConfig.webpack === 'function') {\n          config = nextConfig.webpack(config, options)\n        }\n\n        if (disable) {\n          options.isServer && console.log('> [PWA] PWA support is disabled')\n          return config\n        }\n\n        if (subdomainPrefix) {\n          console.error(\n            '> [PWA] subdomainPrefix is deprecated, use basePath in next.config.js instead: https://nextjs.org/docs/api-reference/next.config.js/basepath'\n          )\n        }\n\n        console.log(`> [PWA] Compile ${options.isServer ? 'server' : 'client (static)'}`)\n\n        let { runtimeCaching = defaultCache } = pluginOptions\n        const _scope = path.posix.join(scope, '/')\n\n        // inject register script to main.js\n        const _sw = path.posix.join(basePath, sw.startsWith('/') ? sw : `/${sw}`)\n        config.plugins.push(\n          new webpack.DefinePlugin({\n            __PWA_SW__: `'${_sw}'`,\n            __PWA_SCOPE__: `'${_scope}'`,\n            __PWA_ENABLE_REGISTER__: `${Boolean(register)}`,\n            __PWA_START_URL__: dynamicStartUrl ? `'${basePath}'` : undefined,\n            __PWA_CACHE_ON_FRONT_END_NAV__: `${Boolean(cacheOnFrontEndNav)}`,\n            __PWA_RELOAD_ON_ONLINE__: `${Boolean(reloadOnOnline)}`\n          })\n        )\n\n        const registerJs = path.join(__dirname, 'register.js')\n        const entry = config.entry\n        config.entry = () =>\n          entry().then(entries => {\n            if (entries['main.js'] && !entries['main.js'].includes(registerJs)) {\n              entries['main.js'].unshift(registerJs)\n            }\n            return entries\n          })\n\n        if (!options.isServer) {\n          const _dest = path.join(options.dir, dest)\n          const customWorkerScriptName = buildCustomWorker({\n            id: buildId,\n            basedir: options.dir,\n            customWorkerDir,\n            destdir: _dest,\n            plugins: config.plugins.filter(plugin => plugin instanceof webpack.DefinePlugin),\n            minify: !dev\n          })\n\n          if (!!customWorkerScriptName) {\n            importScripts.unshift(customWorkerScriptName)\n          }\n\n          if (register) {\n            console.log(`> [PWA] Auto register service worker with: ${path.resolve(registerJs)}`)\n          } else {\n            console.log(\n              `> [PWA] Auto register service worker is disabled, please call following code in componentDidMount callback or useEffect hook`\n            )\n            console.log(`> [PWA]   window.workbox.register()`)\n          }\n\n          console.log(`> [PWA] Service worker: ${path.join(_dest, sw)}`)\n          console.log(`> [PWA]   url: ${_sw}`)\n          console.log(`> [PWA]   scope: ${_scope}`)\n\n          config.plugins.push(\n            new CleanWebpackPlugin({\n              cleanOnceBeforeBuildPatterns: [\n                path.join(_dest, 'workbox-*.js'),\n                path.join(_dest, 'workbox-*.js.map'),\n                path.join(_dest, sw),\n                path.join(_dest, `${sw}.map`)\n              ]\n            })\n          )\n\n          // precache files in public folder\n          let manifestEntries = additionalManifestEntries\n          if (!Array.isArray(manifestEntries)) {\n            manifestEntries = globby\n              .sync(\n                [\n                  '**/*',\n                  '!workbox-*.js',\n                  '!workbox-*.js.map',\n                  '!worker-*.js',\n                  '!worker-*.js.map',\n                  '!fallback-*.js',\n                  '!fallback-*.js.map',\n                  `!${sw.replace(/^\\/+/, '')}`,\n                  `!${sw.replace(/^\\/+/, '')}.map`,\n                  ...publicExcludes\n                ],\n                {\n                  cwd: 'public'\n                }\n              )\n              .map(f => ({\n                url: path.posix.join(basePath, `/${f}`),\n                revision: getRevision(`public/${f}`)\n              }))\n          }\n\n          if (cacheStartUrl) {\n            if (!dynamicStartUrl) {\n              manifestEntries.push({\n                url: basePath,\n                revision: buildId\n              })\n            } else if (typeof dynamicStartUrlRedirect === 'string' && dynamicStartUrlRedirect.length > 0) {\n              manifestEntries.push({\n                url: dynamicStartUrlRedirect,\n                revision: buildId\n              })\n            }\n          }\n\n          let _fallbacks = fallbacks\n          if (_fallbacks) {\n            const res = buildFallbackWorker({\n              id: buildId,\n              fallbacks,\n              basedir: options.dir,\n              destdir: _dest,\n              minify: !dev,\n              pageExtensions\n            })\n\n            if (res) {\n              _fallbacks = res.fallbacks\n              importScripts.unshift(res.name)\n              res.precaches.forEach(route => {\n                if (!manifestEntries.find(entry => entry.url.startsWith(route))) {\n                  manifestEntries.push({\n                    url: route,\n                    revision: buildId\n                  })\n                }\n              })\n            } else {\n              _fallbacks = undefined\n            }\n          }\n\n          const workboxCommon = {\n            swDest: path.join(_dest, sw),\n            additionalManifestEntries: dev ? [] : manifestEntries,\n            exclude: [\n              ...buildExcludes,\n              ({ asset, compilation }) => {\n                if (\n                  asset.name.startsWith('server/') ||\n                  asset.name.match(/^(build-manifest\\.json|react-loadable-manifest\\.json)$/)\n                ) {\n                  return true\n                }\n                if (dev && !asset.name.startsWith('static/runtime/')) {\n                  return true\n                }\n                if (experimental.modern /* modern */) {\n                  if (asset.name.endsWith('.module.js')) {\n                    return false\n                  }\n                  if (asset.name.endsWith('.js')) {\n                    return true\n                  }\n                }\n                return false\n              }\n            ],\n            modifyURLPrefix: {\n              ...modifyURLPrefix,\n              '/_next/../public/': '/'\n            },\n            manifestTransforms: [\n              ...manifestTransforms,\n              async (manifestEntries, compilation) => {\n                const manifest = manifestEntries.map(m => {\n                  m.url = m.url.replace('/_next//static/image', '/_next/static/image')\n                  m.url = m.url.replace('/_next//static/media', '/_next/static/media')\n                  if (m.revision === null) {\n                    let key = m.url\n                    if (key.startsWith(config.output.publicPath)) {\n                      key = m.url.substring(config.output.publicPath.length)\n                    }\n                    const assset = compilation.assetsInfo.get(key)\n                    m.revision = assset ? assset.contenthash || buildId : buildId\n                  }\n                  m.url = m.url.replace(/\\[/g, '%5B').replace(/\\]/g, '%5D')\n                  return m\n                })\n                return { manifest, warnings: [] }\n              }\n            ]\n          }\n\n          if (workbox.swSrc) {\n            const swSrc = path.join(options.dir, workbox.swSrc)\n            console.log(`> [PWA] Inject manifest in ${swSrc}`)\n            config.plugins.push(\n              new WorkboxPlugin.InjectManifest({\n                ...workboxCommon,\n                ...workbox,\n                swSrc\n              })\n            )\n          } else {\n            if (dev) {\n              console.log(\n                '> [PWA] Build in develop mode, cache and precache are mostly disabled. This means offline support is disabled, but you can continue developing other functions in service worker.'\n              )\n\n              ignoreURLParametersMatching.push(/ts/)\n              runtimeCaching = [\n                {\n                  urlPattern: /.*/i,\n                  handler: 'NetworkOnly',\n                  options: {\n                    cacheName: 'dev'\n                  }\n                }\n              ]\n            }\n\n            if (dynamicStartUrl) {\n              runtimeCaching.unshift({\n                urlPattern: basePath,\n                handler: 'NetworkFirst',\n                options: {\n                  cacheName: 'start-url',\n                  plugins: [\n                    {\n                      cacheWillUpdate: async ({ request, response, event, state }) => {\n                        if (response && response.type === 'opaqueredirect') {\n                          return new Response(response.body, {\n                            status: 200,\n                            statusText: 'OK',\n                            headers: response.headers\n                          })\n                        }\n                        return response\n                      }\n                    }\n                  ]\n                }\n              })\n            }\n\n            if (_fallbacks) {\n              runtimeCaching.forEach(c => {\n                if (c.options.precacheFallback) return\n                if (Array.isArray(c.options.plugins) && c.options.plugins.find(p => 'handlerDidError' in p)) return\n                if (!c.options.plugins) c.options.plugins = []\n                c.options.plugins.push({\n                  handlerDidError: async ({ request }) => self.fallback(request)\n                })\n              })\n            }\n\n            config.plugins.push(\n              new WorkboxPlugin.GenerateSW({\n                ...workboxCommon,\n                skipWaiting,\n                clientsClaim,\n                cleanupOutdatedCaches,\n                ignoreURLParametersMatching,\n                importScripts,\n                ...workbox,\n                runtimeCaching\n              })\n            )\n          }\n        }\n\n        return config\n      }\n    })\n"]}