@mlikiowa/nanaeo 1.0.1702968347635 → 1.0.1702969131476

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. package/2022/08/04/NewBlog/index.html +1 -3473
  2. package/2022/08/13/GaussWave/index.html +1 -3407
  3. package/about/index.html +1 -3236
  4. package/archives/2022/08/index.html +1 -3411
  5. package/archives/2022/index.html +1 -3411
  6. package/archives/index.html +1 -3308
  7. package/categories/DevLog/index.html +1 -3351
  8. package/categories/SiteLog/index.html +1 -3351
  9. package/categories/index.html +1 -3174
  10. package/content.json +1 -1
  11. package/css/Readme.html +1 -9
  12. package/css/first.css +2 -1504
  13. package/css/style.css +2 -7106
  14. package/friends/index.html +1 -3661
  15. package/index.html +1 -3421
  16. package/js/app.js +2 -1223
  17. package/js/plugins/aplayer.js +2 -186
  18. package/js/plugins/parallax.js +2 -191
  19. package/js/plugins/rightMenu.js +2 -577
  20. package/js/plugins/rightMenus.js +2 -618
  21. package/js/plugins/tags/contributors.js +2 -92
  22. package/js/plugins/tags/friends.js +2 -93
  23. package/js/plugins/tags/sites.js +2 -96
  24. package/js/search/hexo.js +2 -192
  25. package/maps/css/first.css.map +1 -0
  26. package/maps/css/style.css.map +1 -0
  27. package/maps/js/app.js.map +1 -0
  28. package/maps/js/plugins/aplayer.js.map +1 -0
  29. package/maps/js/plugins/parallax.js.map +1 -0
  30. package/maps/js/plugins/rightMenu.js.map +1 -0
  31. package/maps/js/plugins/rightMenus.js.map +1 -0
  32. package/maps/js/plugins/tags/contributors.js.map +1 -0
  33. package/maps/js/plugins/tags/friends.js.map +1 -0
  34. package/maps/js/plugins/tags/sites.js.map +1 -0
  35. package/maps/js/search/hexo.js.map +1 -0
  36. package/maps/volantis-sw.js.map +1 -0
  37. package/package.json +1 -1
  38. package/tags/DevLog/index.html +1 -3351
  39. package/tags/Gauss/index.html +1 -3351
  40. package/tags/Hexo/index.html +1 -3351
  41. package/tags/HexoThemes/index.html +1 -3351
  42. package/tags/SiteLog/index.html +1 -3351
  43. package/tags/index.html +1 -3159
  44. package/volantis-sw.js +2 -797
package/volantis-sw.js CHANGED
@@ -1,797 +1,2 @@
1
- // 全站打包上传 npm,sw 并发请求 cdn
2
- const prefix = 'volantis-community';
3
- const cacheSuffixVersion = '00000018-0.550065074186102';
4
- const CACHE_NAME = prefix + '-v' + cacheSuffixVersion;
5
- const PreCachlist = [
6
- "/css/style.css",
7
- "/js/app.js",
8
- "/js/search/hexo.js",
9
- ];
10
- let NPMMirror = true;
11
- const NPMPackage = "@mlikiowa/nanaeo";
12
- let NPMPackageVersion = "1.0.1702968276783";
13
- let debug = true;
14
- // location.hostname == 'localhost' && (debug = true) && (NPMMirror = false);
15
- const handleFetch = async (event) => {
16
- const url = event.request.url;
17
- if (/nocache/.test(url)) {
18
- return NetworkOnly(event)
19
- } else if (/@latest/.test(url)) {
20
- return CacheFirst(event)
21
- } else if (/cdnjs\.cloudflare\.com/.test(url)) {
22
- return CacheAlways(event)
23
- } else if (/music\.126\.net/.test(url)) {
24
- return CacheAlways(event)
25
- } else if (/qqmusic\.qq\.com/.test(url)) {
26
- return CacheAlways(event)
27
- } else if (/jsdelivr\.net/.test(url)) {
28
- return CacheAlways(event)
29
- } else if (/npm\.elemecdn\.com/.test(url)) {
30
- return CacheAlways(event)
31
- } else if (/unpkg\.com/.test(url)) {
32
- return CacheAlways(event)
33
- } else if (/.*\.(?:png|jpg|jpeg|svg|gif|webp|ico|eot|ttf|woff|woff2|mp3)$/.test(url)) {
34
- return CacheAlways(event)
35
- } else if (/.*\.(css|js)$/.test(url)) {
36
- return CacheAlways(event)
37
- } else {
38
- return CacheFirst(event)
39
- }
40
- }
41
- const cdn = {
42
- gh: {
43
- jsdelivr: 'https://cdn.jsdelivr.net/gh',
44
- fastly: 'https://fastly.jsdelivr.net/gh',
45
- gcore: 'https://gcore.jsdelivr.net/gh',
46
- testingcf: 'https://testingcf.jsdelivr.net/gh',
47
- test1: 'https://test1.jsdelivr.net/gh',
48
- },
49
- combine: {
50
- jsdelivr: 'https://cdn.jsdelivr.net/combine',
51
- fastly: 'https://fastly.jsdelivr.net/combine',
52
- gcore: 'https://gcore.jsdelivr.net/combine',
53
- testingcf: 'https://testingcf.jsdelivr.net/combine',
54
- test1: 'https://test1.jsdelivr.net/combine',
55
- },
56
- npm: {
57
- jsdelivr: 'https://cdn.jsdelivr.net/npm',
58
- fastly: 'https://fastly.jsdelivr.net/npm',
59
- gcore: 'https://gcore.jsdelivr.net/npm',
60
- testingcf: 'https://testingcf.jsdelivr.net/npm',
61
- test1: 'https://test1.jsdelivr.net/npm',
62
- unpkg: 'https://unpkg.com',
63
- eleme: 'https://npm.elemecdn.com',
64
- },
65
- cdnjs: {
66
- cdnjs: 'https://cdnjs.cloudflare.com/ajax/libs',
67
- baomitu: 'https://lib.baomitu.com',
68
- bootcdn: 'https://cdn.bootcdn.net/ajax/libs',
69
- bytedance: 'https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M',
70
- sustech: 'https://mirrors.sustech.edu.cn/cdnjs/ajax/libs',
71
- }
72
- }
73
- const cdn_match_list = []
74
- for (const type in cdn) {
75
- for (const key in cdn[type]) {
76
- cdn_match_list.push({ type: type, key: cdn[type][key] })
77
- }
78
- }
79
- const _console = console;
80
- const color = {
81
- black: '#000000',
82
- red: '#FF0000',
83
- green: '#008000',
84
- yellow: '#FFFF00',
85
- blue: '#0000FF',
86
- magenta: '#FF00FF',
87
- cyan: '#00FFFF',
88
- white: '#FFFFFF',
89
- };
90
- const add = (...arr) => {
91
- let fi = [
92
- []
93
- ];
94
- for (let key = 0; key < arr.length; key++) {
95
- const [first, ...other] = arr[key];
96
- fi[0] += first;
97
- fi = fi.concat(other);
98
- }
99
- return fi;
100
- };
101
- const createlog = (util) => (...args) => {
102
- // const fun = _console[util] ? _console[util] : _console.log;
103
- const fun = util == "error" ? _console[util] : _console.log;
104
- fun.apply(void 0, args);
105
- };
106
- const creategroup = (util) => (...args) => {
107
- const fun = _console.groupCollapsed;
108
- fun.apply(void 0, args);
109
- };
110
- const colorUtils = {
111
- bold: (str) => {
112
- if (typeof str === 'string' || typeof str === 'number') {
113
- return `${str};font-weight: bold;`;
114
- }
115
- for (let key = 1; key < str.length; key++) {
116
- str[key] += `;font-weight: bold;`;
117
- }
118
- return str;
119
- }
120
- };
121
- const colorHash = {
122
- log: 'black',
123
- wait: 'cyan',
124
- error: 'red',
125
- warn: 'yellow',
126
- ready: 'green',
127
- info: 'blue',
128
- event: 'magenta',
129
- };
130
- const createChalk = (name) => (...str) => {
131
- if (typeof str[0] === 'object') {
132
- createlog(name)(...add(colorUtils.bold(colorUtils[colorHash[name]](`[${firstToUpperCase(name)}] `)), ...str));
133
- return;
134
- }
135
- let strArr = str;
136
- if (typeof str === 'string' || typeof str === 'number') {
137
- strArr = colorUtils[colorHash[name]](str);
138
- }
139
- createlog(name)(...add(colorUtils.bold(colorUtils[colorHash[name]](`[${firstToUpperCase(name)}] `)), strArr));
140
- };
141
- const createChalkBg = (name) => (...str) => {
142
- if (typeof str[0] === 'object') {
143
- createlog(name)(...add(colorUtils.bold(colorUtils[`bg${firstToUpperCase(colorHash[name])}`](`[${firstToUpperCase(name)}] `)), ...str));
144
- return;
145
- }
146
- let strArr = str;
147
- if (typeof str === 'string' || typeof str === 'number') {
148
- strArr = colorUtils[colorHash[name]](str);
149
- }
150
- createlog(name)(...add(colorUtils.bold(colorUtils[`bg${firstToUpperCase(colorHash[name])}`](`[${firstToUpperCase(name)}] `)), strArr));
151
- };
152
- const createChalkGroup = (name) => (...str) => {
153
- if (typeof str[0] === 'object') {
154
- creategroup(name)(...add(colorUtils.bold(colorUtils[colorHash[name]](`[${firstToUpperCase(name)}] `)), ...str));
155
- return;
156
- }
157
- let strArr = str;
158
- if (typeof str === 'string' || typeof str === 'number') {
159
- strArr = colorUtils[colorHash[name]](str);
160
- }
161
- creategroup(name)(...add(colorUtils.bold(colorUtils[colorHash[name]](`[${firstToUpperCase(name)}] `)), strArr));
162
- };
163
- const chalk = {
164
- group: {
165
- end: _console.groupEnd
166
- },
167
- bg: {}
168
- };
169
- Object.keys(colorHash).forEach(key => {
170
- chalk[key] = createChalk(key);
171
- chalk.group[key] = createChalkGroup(key);
172
- chalk.bg[key] = createChalkBg(key);
173
- });
174
- const firstToUpperCase = (str) => str.toLowerCase().replace(/( |^)[a-z]/g, (L) => L.toUpperCase());
175
- Object.keys(color).forEach(key => {
176
- colorUtils[key] = (str) => {
177
- if (typeof str === 'string' || typeof str === 'number') {
178
- return [`%c${str}`, `color:${color[key]}`];
179
- }
180
- for (let i = 1; i < str.length; i++) {
181
- str[i] += `;color:${color[key]}`;
182
- }
183
- return str;
184
- };
185
- colorUtils[`bg${firstToUpperCase(key)}`] = (str) => {
186
- if (typeof str === 'string' || typeof str === 'number') {
187
- return [`%c${str}`, `padding: 2px 4px; border-radius: 3px; color: ${key === 'white' ? '#000' : '#fff'}; font-weight: bold; background:${color[key]};`];
188
- }
189
- for (let i = 1; i < str.length; i++) {
190
- str[i] += `;padding: 2px 4px; border-radius: 3px; font-weight: bold; background:${color[key]};`;
191
- }
192
- return str;
193
- };
194
- });
195
- self.logger = {
196
- add,
197
- ...chalk,
198
- ...colorUtils,
199
- };
200
-
201
- if (!debug) {
202
- logger = {
203
- log: () => { },
204
- wait: () => { },
205
- error: () => { },
206
- warn: () => { },
207
- ready: () => { },
208
- info: () => { },
209
- event: () => { },
210
- group: {
211
- log: () => { },
212
- wait: () => { },
213
- error: () => { },
214
- warn: () => { },
215
- ready: () => { },
216
- info: () => { },
217
- event: () => { },
218
- end: () => { },
219
- },
220
- bg: {
221
- log: () => { },
222
- wait: () => { },
223
- error: () => { },
224
- warn: () => { },
225
- ready: () => { },
226
- info: () => { },
227
- event: () => { },
228
- }
229
- };
230
- console.log = () => { };
231
- }
232
-
233
- const generate_uuid = () => {
234
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
235
- var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
236
- return v.toString(16);
237
- });
238
- }
239
- self.db = {
240
- read: (key, config) => {
241
- if (!config) { config = { type: "text" } }
242
- return new Promise((resolve, reject) => {
243
- caches.open(CACHE_NAME).then(cache => {
244
- cache.match(new Request(`https://LOCALCACHE/${encodeURIComponent(key)}`)).then(function (res) {
245
- if (!res) resolve(null)
246
- res.text().then(text => resolve(text))
247
- }).catch(() => {
248
- resolve(null)
249
- })
250
- })
251
- })
252
- },
253
- write: (key, value) => {
254
- return new Promise((resolve, reject) => {
255
- caches.open(CACHE_NAME).then(function (cache) {
256
- cache.put(new Request(`https://LOCALCACHE/${encodeURIComponent(key)}`), new Response(value));
257
- resolve()
258
- }).catch(() => {
259
- reject()
260
- })
261
- })
262
- }
263
- }
264
- const compareVersion = (a, b) => {
265
- let v1 = a.split('.');
266
- let v2 = b.split('.');
267
- const len = Math.max(v1.length, v2.length);
268
- while (v1.length < len) {
269
- v1.push('0');
270
- }
271
- while (v2.length < len) {
272
- v2.push('0');
273
- }
274
- for (let i = 0; i < len; i++) {
275
- const num1 = parseInt(v1[i]);
276
- const num2 = parseInt(v2[i]);
277
- if (num1 > num2) {
278
- return a;
279
- } else if (num1 < num2) {
280
- return b;
281
- }
282
- }
283
- return a;
284
- }
285
-
286
- const mirrors = [
287
- `https://registry.npmjs.org/${NPMPackage}/latest`,
288
- `https://registry.npmmirror.com/${NPMPackage}/latest`,
289
- `https://mirrors.cloud.tencent.com/npm/${NPMPackage}/latest`
290
- ]
291
- const getLocalVersion = async () => {
292
- NPMPackageVersion = await db.read('blog_version') || NPMPackageVersion
293
- logger.bg.info(`Local Version: ${NPMPackage}@${NPMPackageVersion}`)
294
- }
295
- let mirror_time = 0;
296
- const setNewestVersion = async () => {
297
- if (!NPMMirror) {
298
- return
299
- }
300
- let f = null;
301
- if (!(mirror_time % (mirrors.length + 1))) {
302
- f = FetchEngine(mirrors);
303
- } else {
304
- f = fetch(mirrors[(mirror_time % (mirrors.length + 1)) - 1]);
305
- }
306
- mirror_time++;
307
- return f
308
- .then(res => res.json())
309
- .then(async res => {
310
- if (!res.version) throw ('No Version Found!')
311
- NPMPackageVersion = compareVersion(res.version, await db.read('blog_version') || NPMPackageVersion)
312
- logger.bg.ready(`${NPMPackage}@${NPMPackageVersion}`)
313
- await db.write('blog_version', NPMPackageVersion)
314
- })
315
- .catch(error => {
316
- logger.error('[Set Newest Version] ' + (error.stack || error))
317
- })
318
- }
319
- setInterval(async () => {
320
- await setNewestVersion()
321
- }, 60 * 1000);
322
- setTimeout(async () => {
323
- await setNewestVersion()
324
- }, 5000)
325
- const installFunction = async () => {
326
- await getLocalVersion();
327
- return caches.open(CACHE_NAME + "-precache")
328
- .then(async function (cache) {
329
- if (!await db.read('uuid')) {
330
- await db.write('uuid', generate_uuid())
331
- }
332
- if (PreCachlist.length) {
333
- logger.group.event(`Precaching ${PreCachlist.length} files.`);
334
- let index = 0;
335
- PreCachlist.forEach(function (url) {
336
- cache.match(new Request(url)).then(function (response) {
337
- if (response) {
338
- logger.ready(`Precaching ${url}`);
339
- } else {
340
- logger.wait(`Precaching ${url}`);
341
- cache.add(new Request(url));
342
- }
343
- index++;
344
- if (index === PreCachlist.length) {
345
- logger.ready(`Precached ${PreCachlist.length} files.`);
346
- logger.group.end();
347
- }
348
- })
349
- })
350
- }
351
- }).catch((error) => {
352
- logger.error('[install] ' + (error.stack || error));
353
- })
354
- }
355
- self.addEventListener('install', async function (event) {
356
- logger.bg.event("service worker install event listening");
357
- try {
358
- self.skipWaiting();
359
- event.waitUntil(installFunction());
360
- logger.bg.ready('service worker install sucess!');
361
- } catch (error) {
362
- logger.error('[install] ' + (error.stack || error));
363
- }
364
- });
365
- self.addEventListener('activate', async event => {
366
- logger.bg.event("service worker activate event listening");
367
- try {
368
- event.waitUntil(
369
- caches.keys().then((keys) => {
370
- return Promise.all(keys.map((key) => {
371
- if (!key.includes(cacheSuffixVersion)) {
372
- caches.delete(key);
373
- logger.bg.ready('Deleted Outdated Cache: ' + key);
374
- }
375
- }));
376
- }).catch((error) => {
377
- logger.error('[activate] ' + (error.stack || error));
378
- })
379
- );
380
- await self.clients.claim()
381
- logger.bg.ready('service worker activate sucess!');
382
- } catch (error) {
383
- logger.error('[activate] ' + (error.stack || error));
384
- }
385
- })
386
- self.addEventListener('fetch', async event => {
387
- event.respondWith(
388
- handleFetch(event).catch((error) => {
389
- logger.error('[fetch] ' + event.request.url + '\n[error] ' + (error.stack || error));
390
- })
391
- )
392
- });
393
-
394
-
395
- const NetworkOnly = async (event) => {
396
- logger.group.info('NetworkOnly: ' + new URL(event.request.url).pathname);
397
- logger.wait('service worker fetch: ' + event.request.url)
398
- logger.group.end();
399
- return fetch(event.request)
400
- }
401
- const CacheFirst = async (event) => {
402
- return caches.match(event.request).then(function (resp) {
403
- logger.group.info('CacheFirst: ' + new URL(event.request.url).pathname);
404
- logger.wait('service worker fetch: ' + event.request.url)
405
- if (resp) {
406
- logger.group.ready(`Cache Hit`);
407
- console.log(resp)
408
- logger.group.end();
409
- logger.group.end();
410
- event.waitUntil(CacheRuntime(event.request))
411
- return resp;
412
- } else {
413
- logger.warn(`Cache Miss`);
414
- logger.group.end();
415
- return CacheRuntime(event.request)
416
- }
417
- })
418
- }
419
- const CacheAlways = async (event) => {
420
- return caches.match(event.request).then(function (resp) {
421
- logger.group.info('CacheAlways: ' + new URL(event.request.url).pathname);
422
- logger.wait('service worker fetch: ' + event.request.url)
423
- if (resp) {
424
- logger.group.ready(`Cache Hit`);
425
- console.log(resp)
426
- logger.group.end();
427
- logger.group.end();
428
- return resp;
429
- } else {
430
- logger.warn(`Cache Miss`);
431
- logger.group.end();
432
- return CacheRuntime(event.request)
433
- }
434
- })
435
- }
436
-
437
- const matchCache = async (event) => {
438
- return caches.match(event.request).then(function (resp) {
439
- logger.group.info('service worker fetch: ' + event.request.url)
440
- if (resp) {
441
- logger.group.ready(`Cache Hit`);
442
- console.log(resp)
443
- logger.group.end();
444
- logger.group.end();
445
- return resp;
446
- } else {
447
- logger.warn(`Cache Miss`);
448
- logger.group.end();
449
- return CacheRuntime(event.request)
450
- }
451
- })
452
- }
453
- async function CacheRuntime(request) {
454
- const url = new URL(request.url);
455
- let response = await matchCDN(request);
456
- if (!response) {
457
- response = await fetch(request).catch(() => null)
458
- }
459
- logger.group.event(`Cache Runtime ${url.pathname}`);
460
- logger.wait(`Caching url: ${request.url}`);
461
- console.log(response);
462
-
463
- if (request.method === "GET" && (url.protocol == "https:")) {
464
- const cache = await caches.open(CACHE_NAME + "-runtime");
465
- cache.put(request, response.clone()).catch(error => {
466
- logger.error('[Cache Runtime] ' + (error.stack || error));
467
- if (error.name === 'QuotaExceededError') {
468
- caches.delete(CACHE_NAME + "-runtime");
469
- logger.ready("deleted cache")
470
- }
471
- })
472
- logger.ready(`Cached url: ${request.url}`);
473
- } else {
474
- logger.warn(`Not Cached url: ${request.url}`);
475
- }
476
- logger.group.end();
477
- return response;
478
- }
479
-
480
- const matchCDN = async (req) => {
481
- const nav = navigator
482
- const { saveData, effectiveType } = nav.connection || nav.mozConnection || nav.webkitConnection || {}
483
- if (saveData || /2g/.test(effectiveType)) {
484
- logger.warn("Slow Network: Transparent Proxy");
485
- return fetch(req);
486
- }
487
- const urls = []
488
- let urlObj = new URL(req.url)
489
- let pathType = urlObj.pathname.split('/')[1]
490
- let pathTestRes = "";
491
-
492
- if (NPMMirror && new RegExp(location.origin).test(req.url)) {
493
- logger.group.ready(`Match NPM Mirror: ` + req.url);
494
- for (const key in cdn.npm) {
495
- let url = cdn.npm[key] + "/" + NPMPackage + "@" + NPMPackageVersion + req.url.replace(location.origin, '')
496
- url = fullPath(fullPath(url))
497
- console.log(url);
498
- urls.push(url)
499
- }
500
- logger.group.end()
501
- }
502
- if (!urls.length) {
503
- for (const item of cdn_match_list) {
504
- if (new RegExp(item.key).test(req.url)) {
505
- pathType = item.type
506
- pathTestRes = new RegExp(item.key).exec(req.url)[0]
507
- break;
508
- }
509
- }
510
- for (const type in cdn) {
511
- if (type === pathType) {
512
- logger.group.ready(`Match CDN ${pathType}: ` + req.url);
513
- for (const key in cdn[type]) {
514
- const url = cdn[type][key] + req.url.replace(pathTestRes, '')
515
- console.log(url);
516
- urls.push(url)
517
- }
518
- logger.group.end()
519
- }
520
- }
521
- }
522
-
523
- let res;
524
- if (urls.length)
525
- res = FetchEngine(urls)
526
- else
527
- res = fetch(req)
528
- if (res && NPMMirror && new RegExp(location.origin).test(req.url)) {
529
- const ext = fullPath(fullPath(req.url)).split('.').pop()
530
- const contentType = getContentType(ext)
531
- res = res
532
- .then(res => res.arrayBuffer())
533
- .then(buffer => new Response(buffer, {
534
- headers: {
535
- "Content-Type": contentType
536
- }
537
- }))
538
- .catch(() => null)
539
- }
540
- return res
541
- }
542
-
543
- const fullPath = (url) => {
544
- url = url.split('?')[0].split('#')[0]
545
- if (url.endsWith('/')) {
546
- url += 'index.html'
547
- } else {
548
- const list = url.split('/')
549
- const last = list[list.length - 1]
550
- if (last.indexOf('.') === -1) {
551
- url += '.html'
552
- }
553
- }
554
- return url
555
- }
556
- async function progress(res) {
557
- return new Response(await res.arrayBuffer(), {
558
- status: res.status,
559
- headers: res.headers
560
- })
561
- }
562
-
563
- function createPromiseAny() {
564
- Promise.any = function (promises) {
565
- return new Promise((resolve, reject) => {
566
- promises = Array.isArray(promises) ? promises : []
567
- let len = promises.length
568
- let errs = []
569
- if (len === 0) return reject(new AggregateError('All promises were rejected'))
570
- promises.forEach((p) => {
571
- if (p instanceof Promise) {
572
- p.then(
573
- (res) => resolve(res),
574
- (err) => {
575
- len--
576
- errs.push(err)
577
- if (len === 0) reject(new AggregateError(errs))
578
- }
579
- )
580
- } else {
581
- reject(p)
582
- }
583
- })
584
- })
585
- }
586
- }
587
-
588
- function fetchAny(reqs) {
589
- const controller = new AbortController()
590
-
591
- return reqs.map(req => {
592
- return new Promise((resolve, reject) => {
593
- fetch(req, {
594
- signal: controller.signal
595
- })
596
- .then(progress)
597
- .then(res => {
598
- controller.abort()
599
- if (res.status !== 200)
600
- reject(null)
601
- else
602
- resolve(res)
603
- })
604
- .catch(() => reject(null))
605
- })
606
- })
607
- }
608
-
609
- function fetchParallel(reqs) {
610
- const abortEvent = new Event("abortOtherInstance")
611
- const eventTarget = new EventTarget();
612
-
613
- return reqs.map(async req => {
614
- const controller = new AbortController();
615
- let tagged = false;
616
- eventTarget.addEventListener(abortEvent.type, () => {
617
- if (!tagged) controller.abort();
618
- })
619
- return new Promise((resolve, reject) => {
620
- fetch(req, {
621
- signal: controller.signal,
622
- }).then(res => {
623
- tagged = true;
624
- eventTarget.dispatchEvent(abortEvent)
625
- if (res.status !== 200)
626
- reject(null)
627
- else
628
- resolve(res)
629
- }).catch(() => reject(null))
630
- })
631
- });
632
- }
633
-
634
- const FetchEngine = (reqs) => {
635
- if (!Promise.any) createPromiseAny();
636
- return Promise.any(fetchParallel(reqs)).then(res => res)
637
- .catch((e) => {
638
- if (e == "AggregateError: All promises were rejected") {
639
- return Promise.any(fetchAny(reqs))
640
- .then((res) => res)
641
- .catch(() => null);
642
- }
643
- return null;
644
- });
645
- };
646
-
647
- const getContentType = (ext) => {
648
- switch (ext) {
649
- case 'js':
650
- return 'text/javascript'
651
- case 'html':
652
- return 'text/html'
653
- case 'css':
654
- return 'text/css'
655
- case 'json':
656
- return 'application/json'
657
- case 'webp':
658
- return 'image/webp'
659
- case 'jpg':
660
- return 'image/jpg'
661
- case 'jpeg':
662
- return 'image/jpeg'
663
- case 'png':
664
- return 'image/png'
665
- case 'gif':
666
- return 'image/gif'
667
- case 'xml':
668
- return 'text/xml'
669
- case 'xsl':
670
- return 'text/xml'
671
- case 'webmanifest':
672
- return 'text/webmanifest'
673
- case 'map':
674
- return 'application/json'
675
- case 'bcmap':
676
- return 'image/vnd.wap.wbmp'
677
- case 'wbmp':
678
- return 'image/vnd.wap.wbmp'
679
- case 'bmp':
680
- return 'image/bmp'
681
- case 'ico':
682
- return 'image/vnd.microsoft.icon'
683
- case 'tiff':
684
- return 'image/tiff'
685
- case 'tif':
686
- return 'image/tiff'
687
- case 'svg':
688
- return 'image/svg+xml'
689
- case 'svgz':
690
- return 'image/svg+xml'
691
- case 'woff':
692
- return 'application/font-woff'
693
- case 'woff2':
694
- return 'application/font-woff2'
695
- case 'ttf':
696
- return 'application/font-ttf'
697
- case 'otf':
698
- return 'application/font-otf'
699
- case 'eot':
700
- return 'application/vnd.ms-fontobject'
701
- case 'zip':
702
- return 'application/zip'
703
- case 'tar':
704
- return 'application/x-tar'
705
- case 'gz':
706
- return 'application/gzip'
707
- case 'bz2':
708
- return 'application/x-bzip2'
709
- case 'rar':
710
- return 'application/x-rar-compressed'
711
- case '7z':
712
- return 'application/x-7z-compressed'
713
- case 'doc':
714
- return 'application/msword'
715
- case 'docx':
716
- return 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
717
- case 'xls':
718
- return 'application/vnd.ms-excel'
719
- case 'xlsx':
720
- return 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
721
- case 'ppt':
722
- return 'application/vnd.ms-powerpoint'
723
- case 'pptx':
724
- return 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
725
- case 'pdf':
726
- return 'application/pdf'
727
- case 'txt':
728
- return 'text/plain'
729
- case 'rtf':
730
- return 'application/rtf'
731
- case 'mp3':
732
- return 'audio/mpeg'
733
- case 'wav':
734
- return 'audio/x-wav'
735
- case 'ogg':
736
- return 'audio/ogg'
737
- case 'mp4':
738
- return 'video/mp4'
739
- case 'm4v':
740
- return 'video/x-m4v'
741
- case 'mov':
742
- return 'video/quicktime'
743
- case 'avi':
744
- return 'video/x-msvideo'
745
- case 'wmv':
746
- return 'video/x-ms-wmv'
747
- case 'flv':
748
- return 'video/x-flv'
749
- case 'swf':
750
- return 'application/x-shockwave-flash'
751
- case 'mpg':
752
- return 'video/mpeg'
753
- case 'mpeg':
754
- return 'video/mpeg'
755
- case 'mpe':
756
- return 'video/mpeg'
757
- case 'mpv':
758
- return 'video/mpeg'
759
- case 'm2v':
760
- return 'video/mpeg'
761
- case 'm4a':
762
- return 'audio/mp4'
763
- case 'aac':
764
- return 'audio/aac'
765
- case 'm3u':
766
- return 'audio/x-mpegurl'
767
- case 'm3u8':
768
- return 'application/vnd.apple.mpegurl'
769
- case 'pls':
770
- return 'audio/x-scpls'
771
- case 'cue':
772
- return 'application/x-cue'
773
- case 'wma':
774
- return 'audio/x-ms-wma'
775
- case 'flac':
776
- return 'audio/flac'
777
- case 'aif':
778
- return 'audio/x-aiff'
779
- case 'aiff':
780
- return 'audio/x-aiff'
781
- case 'aifc':
782
- return 'audio/x-aiff'
783
- case 'au':
784
- return 'audio/basic'
785
- case 'snd':
786
- return 'audio/basic'
787
- case 'mid':
788
- return 'audio/midi'
789
- case 'midi':
790
- return 'audio/midi'
791
- case 'kar':
792
- return 'audio/midi'
793
- default:
794
- return 'text/plain'
795
- }
796
- }
797
-
1
+ "use strict";function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){_defineProperty(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(e){var r=_toPrimitive(e,"string");return"symbol"==_typeof(r)?r:String(r)}function _toPrimitive(e,r){if("object"!=_typeof(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _toArray(e){return _arrayWithHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _regeneratorRuntime(){_regeneratorRuntime=function(){return r};var e,r={},t=Object.prototype,n=t.hasOwnProperty,o=Object.defineProperty||function(e,r,t){e[r]=t.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function s(e,r,t){return Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[r]}try{s({},"")}catch(e){s=function(e,r,t){return e[r]=t}}function l(e,r,t,n){var a=r&&r.prototype instanceof y?r:y,c=Object.create(a.prototype),i=new T(n||[]);return o(c,"_invoke",{value:j(e,t,i)}),c}function f(e,r,t){try{return{type:"normal",arg:e.call(r,t)}}catch(e){return{type:"throw",arg:e}}}r.wrap=l;var p="suspendedStart",g="suspendedYield",h="executing",d="completed",m={};function y(){}function v(){}function b(){}var w={};s(w,c,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(L([])));_&&_!==t&&n.call(_,c)&&(w=_);var k=b.prototype=y.prototype=Object.create(w);function C(e){["next","throw","return"].forEach((function(r){s(e,r,(function(e){return this._invoke(r,e)}))}))}function P(e,r){function t(o,a,c,i){var u=f(e[o],e,a);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==_typeof(l)&&n.call(l,"__await")?r.resolve(l.__await).then((function(e){t("next",e,c,i)}),(function(e){t("throw",e,c,i)})):r.resolve(l).then((function(e){s.value=e,c(s)}),(function(e){return t("throw",e,c,i)}))}i(u.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new r((function(r,o){t(e,n,r,o)}))}return a=a?a.then(o,o):o()}})}function j(r,t,n){var o=p;return function(a,c){if(o===h)throw new Error("Generator is already running");if(o===d){if("throw"===a)throw c;return{value:e,done:!0}}for(n.method=a,n.arg=c;;){var i=n.delegate;if(i){var u=A(i,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=h;var s=f(r,t,n);if("normal"===s.type){if(o=n.done?d:g,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=d,n.method="throw",n.arg=s.arg)}}}function A(r,t){var n=t.method,o=r.iterator[n];if(o===e)return t.delegate=null,"throw"===n&&r.iterator["return"]&&(t.method="return",t.arg=e,A(r,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var a=f(o,r.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,m;var c=a.arg;return c?c.done?(t[r.resultName]=c.value,t.next=r.nextLoc,"return"!==t.method&&(t.method="next",t.arg=e),t.delegate=null,m):c:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,m)}function R(e){var r={tryLoc:e[0]};1 in e&&(r.catchLoc=e[1]),2 in e&&(r.finallyLoc=e[2],r.afterLoc=e[3]),this.tryEntries.push(r)}function E(e){var r=e.completion||{};r.type="normal",delete r.arg,e.completion=r}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(R,this),this.reset(!0)}function L(r){if(r||""===r){var t=r[c];if(t)return t.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function t(){for(;++o<r.length;)if(n.call(r,o))return t.value=r[o],t.done=!1,t;return t.value=e,t.done=!0,t};return a.next=a}}throw new TypeError(_typeof(r)+" is not iterable")}return v.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:v,configurable:!0}),v.displayName=s(b,u,"GeneratorFunction"),r.isGeneratorFunction=function(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===v||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,u,"GeneratorFunction")),e.prototype=Object.create(k),e},r.awrap=function(e){return{__await:e}},C(P.prototype),s(P.prototype,i,(function(){return this})),r.AsyncIterator=P,r.async=function(e,t,n,o,a){void 0===a&&(a=Promise);var c=new P(l(e,t,n,o),a);return r.isGeneratorFunction(t)?c:c.next().then((function(e){return e.done?e.value:c.next()}))},C(k),s(k,u,"Generator"),s(k,c,(function(){return this})),s(k,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var r=Object(e),t=[];for(var n in r)t.push(n);return t.reverse(),function o(){for(;t.length;){var e=t.pop();if(e in r)return o.value=e,o.done=!1,o}return o.done=!0,o}},r.values=L,T.prototype={constructor:T,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(E),!r)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var t=this;function o(n,o){return i.type="throw",i.arg=r,t.next=n,o&&(t.method="next",t.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var c=this.tryEntries[a],i=c.completion;if("root"===c.tryLoc)return o("end");if(c.tryLoc<=this.prev){var u=n.call(c,"catchLoc"),s=n.call(c,"finallyLoc");if(u&&s){if(this.prev<c.catchLoc)return o(c.catchLoc,!0);if(this.prev<c.finallyLoc)return o(c.finallyLoc)}else if(u){if(this.prev<c.catchLoc)return o(c.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<c.finallyLoc)return o(c.finallyLoc)}}}},abrupt:function(e,r){for(var t=this.tryEntries.length-1;t>=0;--t){var o=this.tryEntries[t];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=r&&r<=a.finallyLoc&&(a=null);var c=a?a.completion:{};return c.type=e,c.arg=r,a?(this.method="next",this.next=a.finallyLoc,m):this.complete(c)},complete:function(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),m},finish:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),E(t),m}},"catch":function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.tryLoc===e){var n=t.completion;if("throw"===n.type){var o=n.arg;E(t)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,t,n){return this.delegate={iterator:L(r),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=e),m}},r}function asyncGeneratorStep(e,r,t,n,o,a,c){try{var i=e[a](c),u=i.value}catch(s){return void t(s)}i.done?r(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(e){return function(){var r=this,t=arguments;return new Promise((function(n,o){var a=e.apply(r,t);function c(e){asyncGeneratorStep(a,n,o,c,i,"next",e)}function i(e){asyncGeneratorStep(a,n,o,c,i,"throw",e)}c(undefined)}))}}var prefix="volantis-community",cacheSuffixVersion="00000018-0.3702105021586909",CACHE_NAME=prefix+"-v"+cacheSuffixVersion,PreCachlist=["/css/style.css","/js/app.js","/js/search/hexo.js"],NPMMirror=!0,NPMPackage="@mlikiowa/nanaeo",NPMPackageVersion="1.0.1702968276783",debug=!0,handleFetch=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function r(e){var t;return _regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(t=e.request.url,!/nocache/.test(t)){r.next=5;break}return r.abrupt("return",NetworkOnly(e));case 5:if(!/@latest/.test(t)){r.next=9;break}return r.abrupt("return",CacheFirst(e));case 9:if(!/cdnjs\.cloudflare\.com/.test(t)){r.next=13;break}return r.abrupt("return",CacheAlways(e));case 13:if(!/music\.126\.net/.test(t)){r.next=17;break}return r.abrupt("return",CacheAlways(e));case 17:if(!/qqmusic\.qq\.com/.test(t)){r.next=21;break}return r.abrupt("return",CacheAlways(e));case 21:if(!/jsdelivr\.net/.test(t)){r.next=25;break}return r.abrupt("return",CacheAlways(e));case 25:if(!/npm\.elemecdn\.com/.test(t)){r.next=29;break}return r.abrupt("return",CacheAlways(e));case 29:if(!/unpkg\.com/.test(t)){r.next=33;break}return r.abrupt("return",CacheAlways(e));case 33:if(!/.*\.(?:png|jpg|jpeg|svg|gif|webp|ico|eot|ttf|woff|woff2|mp3)$/.test(t)){r.next=37;break}return r.abrupt("return",CacheAlways(e));case 37:if(!/.*\.(css|js)$/.test(t)){r.next=41;break}return r.abrupt("return",CacheAlways(e));case 41:return r.abrupt("return",CacheFirst(e));case 42:case"end":return r.stop()}}),r)})));return function(r){return e.apply(this,arguments)}}(),cdn={gh:{jsdelivr:"https://cdn.jsdelivr.net/gh",fastly:"https://fastly.jsdelivr.net/gh",gcore:"https://gcore.jsdelivr.net/gh",testingcf:"https://testingcf.jsdelivr.net/gh",test1:"https://test1.jsdelivr.net/gh"},combine:{jsdelivr:"https://cdn.jsdelivr.net/combine",fastly:"https://fastly.jsdelivr.net/combine",gcore:"https://gcore.jsdelivr.net/combine",testingcf:"https://testingcf.jsdelivr.net/combine",test1:"https://test1.jsdelivr.net/combine"},npm:{jsdelivr:"https://cdn.jsdelivr.net/npm",fastly:"https://fastly.jsdelivr.net/npm",gcore:"https://gcore.jsdelivr.net/npm",testingcf:"https://testingcf.jsdelivr.net/npm",test1:"https://test1.jsdelivr.net/npm",unpkg:"https://unpkg.com",eleme:"https://npm.elemecdn.com"},cdnjs:{cdnjs:"https://cdnjs.cloudflare.com/ajax/libs",baomitu:"https://lib.baomitu.com",bootcdn:"https://cdn.bootcdn.net/ajax/libs",bytedance:"https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M",sustech:"https://mirrors.sustech.edu.cn/cdnjs/ajax/libs"}},cdn_match_list=[];for(var type in cdn)for(var key in cdn[type])cdn_match_list.push({type,key:cdn[type][key]});var _console=console,color={black:"#000000",red:"#FF0000",green:"#008000",yellow:"#FFFF00",blue:"#0000FF",magenta:"#FF00FF",cyan:"#00FFFF",white:"#FFFFFF"},add=function(){for(var e=[[]],r=0;r<arguments.length;r++){var t=_toArray(r<0||arguments.length<=r?undefined:arguments[r]),n=t[0],o=t.slice(1);e[0]+=n,e=e.concat(o)}return e},createlog=function(e){return function(){for(var r="error"==e?_console[e]:_console.log,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];r.apply(void 0,n)}},creategroup=function(e){return function(){for(var e=_console.groupCollapsed,r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];e.apply(void 0,t)}},colorUtils={bold:function(e){if("string"==typeof e||"number"==typeof e)return"".concat(e,";font-weight: bold;");for(var r=1;r<e.length;r++)e[r]+=";font-weight: bold;";return e}},colorHash={log:"black",wait:"cyan",error:"red",warn:"yellow",ready:"green",info:"blue",event:"magenta"},createChalk=function(e){return function(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];if("object"!==_typeof(t[0])){var o=t;"string"!=typeof t&&"number"!=typeof t||(o=colorUtils[colorHash[e]](t)),createlog(e).apply(void 0,_toConsumableArray(add(colorUtils.bold(colorUtils[colorHash[e]]("[".concat(firstToUpperCase(e),"] "))),o)))}else createlog(e).apply(void 0,_toConsumableArray(add.apply(void 0,[colorUtils.bold(colorUtils[colorHash[e]]("[".concat(firstToUpperCase(e),"] ")))].concat(t))))}},createChalkBg=function(e){return function(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];if("object"!==_typeof(t[0])){var o=t;"string"!=typeof t&&"number"!=typeof t||(o=colorUtils[colorHash[e]](t)),createlog(e).apply(void 0,_toConsumableArray(add(colorUtils.bold(colorUtils["bg".concat(firstToUpperCase(colorHash[e]))]("[".concat(firstToUpperCase(e),"] "))),o)))}else createlog(e).apply(void 0,_toConsumableArray(add.apply(void 0,[colorUtils.bold(colorUtils["bg".concat(firstToUpperCase(colorHash[e]))]("[".concat(firstToUpperCase(e),"] ")))].concat(t))))}},createChalkGroup=function(e){return function(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];if("object"!==_typeof(t[0])){var o=t;"string"!=typeof t&&"number"!=typeof t||(o=colorUtils[colorHash[e]](t)),creategroup(e).apply(void 0,_toConsumableArray(add(colorUtils.bold(colorUtils[colorHash[e]]("[".concat(firstToUpperCase(e),"] "))),o)))}else creategroup(e).apply(void 0,_toConsumableArray(add.apply(void 0,[colorUtils.bold(colorUtils[colorHash[e]]("[".concat(firstToUpperCase(e),"] ")))].concat(t))))}},chalk={group:{end:_console.groupEnd},bg:{}};Object.keys(colorHash).forEach((function(e){chalk[e]=createChalk(e),chalk.group[e]=createChalkGroup(e),chalk.bg[e]=createChalkBg(e)}));var firstToUpperCase=function(e){return e.toLowerCase().replace(/( |^)[a-z]/g,(function(e){return e.toUpperCase()}))};Object.keys(color).forEach((function(e){colorUtils[e]=function(r){if("string"==typeof r||"number"==typeof r)return["%c".concat(r),"color:".concat(color[e])];for(var t=1;t<r.length;t++)r[t]+=";color:".concat(color[e]);return r},colorUtils["bg".concat(firstToUpperCase(e))]=function(r){if("string"==typeof r||"number"==typeof r)return["%c".concat(r),"padding: 2px 4px; border-radius: 3px; color: ".concat("white"===e?"#000":"#fff","; font-weight: bold; background:").concat(color[e],";")];for(var t=1;t<r.length;t++)r[t]+=";padding: 2px 4px; border-radius: 3px; font-weight: bold; background:".concat(color[e],";");return r}})),self.logger=_objectSpread(_objectSpread({add},chalk),colorUtils),debug||(logger={log:function(){},wait:function(){},error:function(){},warn:function(){},ready:function(){},info:function(){},event:function(){},group:{log:function(){},wait:function(){},error:function(){},warn:function(){},ready:function(){},info:function(){},event:function(){},end:function(){}},bg:{log:function(){},wait:function(){},error:function(){},warn:function(){},ready:function(){},info:function(){},event:function(){}}},console.log=function(){});var generate_uuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var r=16*Math.random()|0;return("x"==e?r:3&r|8).toString(16)}))};self.db={read:function(e,r){return r||(r={type:"text"}),new Promise((function(r,t){caches.open(CACHE_NAME).then((function(t){t.match(new Request("https://LOCALCACHE/".concat(encodeURIComponent(e)))).then((function(e){e||r(null),e.text().then((function(e){return r(e)}))}))["catch"]((function(){r(null)}))}))}))},write:function(e,r){return new Promise((function(t,n){caches.open(CACHE_NAME).then((function(n){n.put(new Request("https://LOCALCACHE/".concat(encodeURIComponent(e))),new Response(r)),t()}))["catch"]((function(){n()}))}))}};var compareVersion=function(e,r){for(var t=e.split("."),n=r.split("."),o=Math.max(t.length,n.length);t.length<o;)t.push("0");for(;n.length<o;)n.push("0");for(var a=0;a<o;a++){var c=parseInt(t[a]),i=parseInt(n[a]);if(c>i)return e;if(c<i)return r}return e},mirrors=["https://registry.npmjs.org/".concat(NPMPackage,"/latest"),"https://registry.npmmirror.com/".concat(NPMPackage,"/latest"),"https://mirrors.cloud.tencent.com/npm/".concat(NPMPackage,"/latest")],getLocalVersion=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function r(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,db.read("blog_version");case 2:if(e.t0=e.sent,e.t0){e.next=5;break}e.t0=NPMPackageVersion;case 5:NPMPackageVersion=e.t0,logger.bg.info("Local Version: ".concat(NPMPackage,"@").concat(NPMPackageVersion));case 7:case"end":return e.stop()}}),r)})));return function(){return e.apply(this,arguments)}}(),mirror_time=0,setNewestVersion=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function r(){var e;return _regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(NPMMirror){r.next=2;break}return r.abrupt("return");case 2:return e=null,e=mirror_time%(mirrors.length+1)?fetch(mirrors[mirror_time%(mirrors.length+1)-1]):FetchEngine(mirrors),mirror_time++,r.abrupt("return",e.then((function(e){return e.json()})).then(function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function r(e){return _regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(e.version){r.next=2;break}throw"No Version Found!";case 2:return r.t0=compareVersion,r.t1=e.version,r.next=6,db.read("blog_version");case 6:if(r.t2=r.sent,r.t2){r.next=9;break}r.t2=NPMPackageVersion;case 9:return r.t3=r.t2,NPMPackageVersion=(0,r.t0)(r.t1,r.t3),logger.bg.ready("".concat(NPMPackage,"@").concat(NPMPackageVersion)),r.next=14,db.write("blog_version",NPMPackageVersion);case 14:case"end":return r.stop()}}),r)})));return function(r){return e.apply(this,arguments)}}())["catch"]((function(e){logger.error("[Set Newest Version] "+(e.stack||e))})));case 6:case"end":return r.stop()}}),r)})));return function(){return e.apply(this,arguments)}}();setInterval(_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,setNewestVersion();case 2:case"end":return e.stop()}}),e)}))),6e4),setTimeout(_asyncToGenerator(_regeneratorRuntime().mark((function r(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,setNewestVersion();case 2:case"end":return e.stop()}}),r)}))),5e3);var installFunction=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function r(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,getLocalVersion();case 2:return e.abrupt("return",caches.open(CACHE_NAME+"-precache").then(function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function r(e){var t;return _regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,db.read("uuid");case 2:if(r.sent){r.next=5;break}return r.next=5,db.write("uuid",generate_uuid());case 5:PreCachlist.length&&(logger.group.event("Precaching ".concat(PreCachlist.length," files.")),t=0,PreCachlist.forEach((function(r){e.match(new Request(r)).then((function(n){n?logger.ready("Precaching ".concat(r)):(logger.wait("Precaching ".concat(r)),e.add(new Request(r))),++t===PreCachlist.length&&(logger.ready("Precached ".concat(PreCachlist.length," files.")),logger.group.end())}))})));case 6:case"end":return r.stop()}}),r)})));return function(r){return e.apply(this,arguments)}}())["catch"]((function(e){logger.error("[install] "+(e.stack||e))})));case 3:case"end":return e.stop()}}),r)})));return function(){return e.apply(this,arguments)}}();self.addEventListener("install",function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function r(e){return _regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:logger.bg.event("service worker install event listening");try{self.skipWaiting(),e.waitUntil(installFunction()),logger.bg.ready("service worker install sucess!")}catch(t){logger.error("[install] "+(t.stack||t))}case 2:case"end":return r.stop()}}),r)})));return function(r){return e.apply(this,arguments)}}()),self.addEventListener("activate",function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function r(e){return _regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return logger.bg.event("service worker activate event listening"),r.prev=1,e.waitUntil(caches.keys().then((function(e){return Promise.all(e.map((function(e){e.includes(cacheSuffixVersion)||(caches["delete"](e),logger.bg.ready("Deleted Outdated Cache: "+e))})))}))["catch"]((function(e){logger.error("[activate] "+(e.stack||e))}))),r.next=5,self.clients.claim();case 5:logger.bg.ready("service worker activate sucess!"),r.next=11;break;case 8:r.prev=8,r.t0=r["catch"](1),logger.error("[activate] "+(r.t0.stack||r.t0));case 11:case"end":return r.stop()}}),r,null,[[1,8]])})));return function(r){return e.apply(this,arguments)}}()),self.addEventListener("fetch",function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function r(e){return _regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:e.respondWith(handleFetch(e)["catch"]((function(r){logger.error("[fetch] "+e.request.url+"\n[error] "+(r.stack||r))})));case 1:case"end":return r.stop()}}),r)})));return function(r){return e.apply(this,arguments)}}());var NetworkOnly=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function r(e){return _regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return logger.group.info("NetworkOnly: "+new URL(e.request.url).pathname),logger.wait("service worker fetch: "+e.request.url),logger.group.end(),r.abrupt("return",fetch(e.request));case 4:case"end":return r.stop()}}),r)})));return function(r){return e.apply(this,arguments)}}(),CacheFirst=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function r(e){return _regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",caches.match(e.request).then((function(r){return logger.group.info("CacheFirst: "+new URL(e.request.url).pathname),logger.wait("service worker fetch: "+e.request.url),r?(logger.group.ready("Cache Hit"),console.log(r),logger.group.end(),logger.group.end(),e.waitUntil(CacheRuntime(e.request)),r):(logger.warn("Cache Miss"),logger.group.end(),CacheRuntime(e.request))})));case 1:case"end":return r.stop()}}),r)})));return function(r){return e.apply(this,arguments)}}(),CacheAlways=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function r(e){return _regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",caches.match(e.request).then((function(r){return logger.group.info("CacheAlways: "+new URL(e.request.url).pathname),logger.wait("service worker fetch: "+e.request.url),r?(logger.group.ready("Cache Hit"),console.log(r),logger.group.end(),logger.group.end(),r):(logger.warn("Cache Miss"),logger.group.end(),CacheRuntime(e.request))})));case 1:case"end":return r.stop()}}),r)})));return function(r){return e.apply(this,arguments)}}(),matchCache=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function r(e){return _regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",caches.match(e.request).then((function(r){return logger.group.info("service worker fetch: "+e.request.url),r?(logger.group.ready("Cache Hit"),console.log(r),logger.group.end(),logger.group.end(),r):(logger.warn("Cache Miss"),logger.group.end(),CacheRuntime(e.request))})));case 1:case"end":return r.stop()}}),r)})));return function(r){return e.apply(this,arguments)}}();function CacheRuntime(e){return _CacheRuntime.apply(this,arguments)}function _CacheRuntime(){return(_CacheRuntime=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var t,n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new URL(r.url),e.next=3,matchCDN(r);case 3:if(n=e.sent){e.next=8;break}return e.next=7,fetch(r)["catch"]((function(){return null}));case 7:n=e.sent;case 8:if(logger.group.event("Cache Runtime ".concat(t.pathname)),logger.wait("Caching url: ".concat(r.url)),console.log(n),"GET"!==r.method||"https:"!=t.protocol){e.next=19;break}return e.next=14,caches.open(CACHE_NAME+"-runtime");case 14:e.sent.put(r,n.clone())["catch"]((function(e){logger.error("[Cache Runtime] "+(e.stack||e)),"QuotaExceededError"===e.name&&(caches["delete"](CACHE_NAME+"-runtime"),logger.ready("deleted cache"))})),logger.ready("Cached url: ".concat(r.url)),e.next=20;break;case 19:logger.warn("Not Cached url: ".concat(r.url));case 20:return logger.group.end(),e.abrupt("return",n);case 22:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var matchCDN=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function r(e){var t,n,o,a,c,i,u,s,l,f,p,g,h,d,m,y,v,b,w;return _regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(t=navigator,n=t.connection||t.mozConnection||t.webkitConnection||{},o=n.saveData,a=n.effectiveType,!o&&!/2g/.test(a)){r.next=5;break}return logger.warn("Slow Network: Transparent Proxy"),r.abrupt("return",fetch(e));case 5:if(c=[],i=new URL(e.url),u=i.pathname.split("/")[1],s="",NPMMirror&&new RegExp(location.origin).test(e.url)){for(l in logger.group.ready("Match NPM Mirror: "+e.url),cdn.npm)f=cdn.npm[l]+"/"+NPMPackage+"@"+NPMPackageVersion+e.url.replace(location.origin,""),f=fullPath(fullPath(f)),console.log(f),c.push(f);logger.group.end()}if(c.length){r.next=22;break}p=0,g=cdn_match_list;case 12:if(!(p<g.length)){r.next=21;break}if(h=g[p],!new RegExp(h.key).test(e.url)){r.next=18;break}return u=h.type,s=new RegExp(h.key).exec(e.url)[0],r.abrupt("break",21);case 18:p++,r.next=12;break;case 21:for(d in cdn)if(d===u){for(m in logger.group.ready("Match CDN ".concat(u,": ")+e.url),cdn[d])y=cdn[d][m]+e.url.replace(s,""),console.log(y),c.push(y);logger.group.end()}case 22:return(v=c.length?FetchEngine(c):fetch(e))&&NPMMirror&&new RegExp(location.origin).test(e.url)&&(b=fullPath(fullPath(e.url)).split(".").pop(),w=getContentType(b),v=v.then((function(e){return e.arrayBuffer()})).then((function(e){return new Response(e,{headers:{"Content-Type":w}})}))["catch"]((function(){return null}))),r.abrupt("return",v);case 25:case"end":return r.stop()}}),r)})));return function(r){return e.apply(this,arguments)}}(),fullPath=function(e){if((e=e.split("?")[0].split("#")[0]).endsWith("/"))e+="index.html";else{var r=e.split("/");-1===r[r.length-1].indexOf(".")&&(e+=".html")}return e};function progress(e){return _progress.apply(this,arguments)}function _progress(){return(_progress=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Response,e.next=3,r.arrayBuffer();case 3:return e.t1=e.sent,e.t2={status:r.status,headers:r.headers},e.abrupt("return",new e.t0(e.t1,e.t2));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function createPromiseAny(){Promise.any=function(e){return new Promise((function(r,t){var n=(e=Array.isArray(e)?e:[]).length,o=[];if(0===n)return t(new AggregateError("All promises were rejected"));e.forEach((function(e){e instanceof Promise?e.then((function(e){return r(e)}),(function(e){n--,o.push(e),0===n&&t(new AggregateError(o))})):t(e)}))}))}}function fetchAny(e){var r=new AbortController;return e.map((function(e){return new Promise((function(t,n){fetch(e,{signal:r.signal}).then(progress).then((function(e){r.abort(),200!==e.status?n(null):t(e)}))["catch"]((function(){return n(null)}))}))}))}function fetchParallel(e){var r=new Event("abortOtherInstance"),t=new EventTarget;return e.map(function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function n(e){var o,a;return _regeneratorRuntime().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return o=new AbortController,a=!1,t.addEventListener(r.type,(function(){a||o.abort()})),n.abrupt("return",new Promise((function(n,c){fetch(e,{signal:o.signal}).then((function(e){a=!0,t.dispatchEvent(r),200!==e.status?c(null):n(e)}))["catch"]((function(){return c(null)}))})));case 4:case"end":return n.stop()}}),n)})));return function(r){return e.apply(this,arguments)}}())}var FetchEngine=function(e){return Promise.any||createPromiseAny(),Promise.any(fetchParallel(e)).then((function(e){return e}))["catch"]((function(r){return"AggregateError: All promises were rejected"==r?Promise.any(fetchAny(e)).then((function(e){return e}))["catch"]((function(){return null})):null}))},getContentType=function(e){switch(e){case"js":return"text/javascript";case"html":return"text/html";case"css":return"text/css";case"json":case"map":return"application/json";case"webp":return"image/webp";case"jpg":return"image/jpg";case"jpeg":return"image/jpeg";case"png":return"image/png";case"gif":return"image/gif";case"xml":case"xsl":return"text/xml";case"webmanifest":return"text/webmanifest";case"bcmap":case"wbmp":return"image/vnd.wap.wbmp";case"bmp":return"image/bmp";case"ico":return"image/vnd.microsoft.icon";case"tiff":case"tif":return"image/tiff";case"svg":case"svgz":return"image/svg+xml";case"woff":return"application/font-woff";case"woff2":return"application/font-woff2";case"ttf":return"application/font-ttf";case"otf":return"application/font-otf";case"eot":return"application/vnd.ms-fontobject";case"zip":return"application/zip";case"tar":return"application/x-tar";case"gz":return"application/gzip";case"bz2":return"application/x-bzip2";case"rar":return"application/x-rar-compressed";case"7z":return"application/x-7z-compressed";case"doc":return"application/msword";case"docx":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"xls":return"application/vnd.ms-excel";case"xlsx":return"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";case"ppt":return"application/vnd.ms-powerpoint";case"pptx":return"application/vnd.openxmlformats-officedocument.presentationml.presentation";case"pdf":return"application/pdf";case"txt":default:return"text/plain";case"rtf":return"application/rtf";case"mp3":return"audio/mpeg";case"wav":return"audio/x-wav";case"ogg":return"audio/ogg";case"mp4":return"video/mp4";case"m4v":return"video/x-m4v";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"wmv":return"video/x-ms-wmv";case"flv":return"video/x-flv";case"swf":return"application/x-shockwave-flash";case"mpg":case"mpeg":case"mpe":case"mpv":case"m2v":return"video/mpeg";case"m4a":return"audio/mp4";case"aac":return"audio/aac";case"m3u":return"audio/x-mpegurl";case"m3u8":return"application/vnd.apple.mpegurl";case"pls":return"audio/x-scpls";case"cue":return"application/x-cue";case"wma":return"audio/x-ms-wma";case"flac":return"audio/flac";case"aif":case"aiff":case"aifc":return"audio/x-aiff";case"au":case"snd":return"audio/basic";case"mid":case"midi":case"kar":return"audio/midi"}};
2
+ //# sourceMappingURL=maps/volantis-sw.js.map