PageSourceSearch

https://pecunpay.es/sw.js

js pecunpay.es collected 2026-10-04 15:01:29 UTC 5,041 bytes, 173 lines download raw bytes

1/**
2 * Welcome to your Workbox-powered service worker!
3 *
4 * You'll need to register this file in your web app and you should
5 * disable HTTP caching for this file too.
6 * See https://goo.gl/nhQhGp
7 *
8 * The rest of the code is auto-generated. Please don't update this file
9 * directly; instead, make changes to your Workbox build configuration
10 * and re-run your build process.
11 * See https://goo.gl/2aRDsh
12 */
13
14importScripts("workbox-v4.3.1/workbox-sw.js");
15workbox.setConfig({modulePathPrefix: "workbox-v4.3.1"});
16
17workbox.core.setCacheNameDetails({prefix: "gatsby-plugin-offline"});
18
19workbox.core.skipWaiting();
20
21workbox.core.clientsClaim();
22
23/**
24 * The workboxSW.precacheAndRoute() method efficiently caches and responds to
25 * requests for URLs in the manifest.
26 * See https://goo.gl/S9QRab
27 */
28self.__precacheManifest = [
29  {
30    "url": "webpack-runtime-ee30332d9afca93844a1.js"
31  },
32  {
33    "url": "styles.eda400fca611531e110b.css"
34  },
35  {
36    "url": "framework-ee7c34175c779d85b74a.js"
37  },
38  {
39    "url": "82da5a65-10301fc49f93fee5e949.js"
40  },
41  {
42    "url": "94726e6d-0c0a5408c11901a549c7.js"
43  },
44  {
45    "url": "app-ae5cfaa42224d3c8278a.js"
46  },
47  {
48    "url": "offline-plugin-app-shell-fallback/index.html",
49    "revision": "e6844832c13c78dfa8f98010bf0fca9c"
50  },
51  {
52    "url": "component---cache-caches-gatsby-plugin-offline-app-shell-js-0f1511ef6c0f905f7604.js"
53  },
54  {
55    "url": "manifest.json",
56    "revision": "ed2575aee9d587d3ea1b213350a935b3"
57  },
58  {
59    "url": "manifest.webmanifest",
60    "revision": "13bc3fd8476060c34fa88a10355e7daa"
61  }
62].concat(self.__precacheManifest || []);
63workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
64
65workbox.routing.registerRoute(/(\.js$|\.css$|static\/)/, new workbox.strategies.CacheFirst(), 'GET');
66workbox.routing.registerRoute(/^https?:.*\/page-data\/.*\.json/, new workbox.strategies.StaleWhileRevalidate(), 'GET');
67workbox.routing.registerRoute(/^https?:.*\.(png|jpg|jpeg|webp|avif|svg|gif|tiff|js|woff|woff2|json|css)$/, new workbox.strategies.StaleWhileRevalidate(), 'GET');
68workbox.routing.registerRoute(/^https?:\/\/fonts\.googleapis\.com\/css/, new workbox.strategies.StaleWhileRevalidate(), 'GET');
69
70/* global importScripts, workbox, idbKeyval */
71importScripts(`idb-keyval-3.2.0-iife.min.js`)
72
73const { NavigationRoute } = workbox.routing
74
75let lastNavigationRequest = null
76let offlineShellEnabled = true
77
78// prefer standard object syntax to support more browsers
79const MessageAPI = {
80  setPathResources: (event, { path, resources }) => {
81    event.waitUntil(idbKeyval.set(`resources:${path}`, resources))
82  },
83
84  clearPathResources: event => {
85    event.waitUntil(idbKeyval.clear())
86  },
87
88  enableOfflineShell: () => {
89    offlineShellEnabled = true
90  },
91
92  disableOfflineShell: () => {
93    offlineShellEnabled = false
94  },
95}
96
97self.addEventListener(`message`, event => {
98  const { gatsbyApi: api } = event.data
99  if (api) MessageAPI[api](event, event.data)
100})
101
102function handleAPIRequest({ event }) {
103  const { pathname } = new URL(event.request.url)
104
105  const params = pathname.match(/:(.+)/)[1]
106  const data = {}
107
108  if (params.includes(`=`)) {
109    params.split(`&`).forEach(param => {
110      const [key, val] = param.split(`=`)
111      data[key] = val
112    })
113  } else {
114    data.api = params
115  }
116
117  if (MessageAPI[data.api] !== undefined) {
118    MessageAPI[data.api]()
119  }
120
121  if (!data.redirect) {
122    return new Response()
123  }
124
125  return new Response(null, {
126    status: 302,
127    headers: {
128      Location: lastNavigationRequest,
129    },
130  })
131}
132
133const navigationRoute = new NavigationRoute(async ({ event }) => {
134  // handle API requests separately to normal navigation requests, so do this
135  // check first
136  if (event.request.url.match(/\/.gatsby-plugin-offline:.+/)) {
137    return handleAPIRequest({ event })
138  }
139
140  if (!offlineShellEnabled) {
141    return await fetch(event.request)
142  }
143
144  lastNavigationRequest = event.request.url
145
146  let { pathname } = new URL(event.request.url)
147  pathname = pathname.replace(new RegExp(`^`), ``)
148
149  // Check for resources + the app bundle
150  // The latter may not exist if the SW is updating to a new version
151  const resources = await idbKeyval.get(`resources:${pathname}`)
152  if (!resources || !(await caches.match(`/app-ae5cfaa42224d3c8278a.js`))) {
153    return await fetch(event.request)
154  }
155
156  for (const resource of resources) {
157    // As soon as we detect a failed resource, fetch the entire page from
158    // network - that way we won't risk being in an inconsistent state with
159    // some parts of the page failing.
160    if (!(await caches.match(resource))) {
161      return await fetch(event.request)
162    }
163  }
164
165  const offlineShell = `/offline-plugin-app-shell-fallback/index.html`
166  const offlineShellWithKey = workbox.precaching.getCacheKeyForURL(offlineShell)
167  return await caches.match(offlineShellWithKey)
168})
169
170workbox.routing.registerRoute(navigationRoute)
171
172// this route is used when performing a non-navigation request (e.g. fetch)
173workbox.routing.registerRoute(/\/.gatsby-plugin-offline:.+/, handleAPIRequest)

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