@fuxishi/vitepress-theme 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,886 @@
1
+ import { nextTick as e, onBeforeUnmount as t, onMounted as n, watch as r } from "vue";
2
+ import { useData as i, useRoute as a } from "vitepress";
3
+ //#region node_modules/@vibrant/image/dist/esm/histogram.js
4
+ var o = class {
5
+ constructor(e, t) {
6
+ this.pixels = e, this.opts = t;
7
+ let { sigBits: n } = t, r = (e, t, r) => (e << 2 * n) + (t << n) + r;
8
+ this.getColorIndex = r;
9
+ let i = 8 - n, a = 1 << 3 * n, o = new Uint32Array(a), s, c, l, u, d, f, p, m, h, g;
10
+ s = l = d = 0, c = u = f = Number.MAX_VALUE;
11
+ let _ = e.length / 4, v = 0;
12
+ for (; v < _;) {
13
+ let t = v * 4;
14
+ if (v++, p = e[t + 0], m = e[t + 1], h = e[t + 2], g = e[t + 3], g === 0) continue;
15
+ p >>= i, m >>= i, h >>= i;
16
+ let n = r(p, m, h);
17
+ o[n] === void 0 && (o[n] = 0), o[n] += 1, p > s && (s = p), p < c && (c = p), m > l && (l = m), m < u && (u = m), h > d && (d = h), h < f && (f = h);
18
+ }
19
+ this._colorCount = o.reduce((e, t) => t > 0 ? e + 1 : e, 0), this.hist = o, this.rmax = s, this.rmin = c, this.gmax = l, this.gmin = u, this.bmax = d, this.bmin = f;
20
+ }
21
+ get colorCount() {
22
+ return this._colorCount;
23
+ }
24
+ }, s = class {
25
+ scaleDown(e) {
26
+ let t = this.getWidth(), n = this.getHeight(), r = 1;
27
+ if (e.maxDimension > 0) {
28
+ let i = Math.max(t, n);
29
+ i > e.maxDimension && (r = e.maxDimension / i);
30
+ } else r = 1 / e.quality;
31
+ r < 1 && this.resize(t * r, n * r, r);
32
+ }
33
+ };
34
+ function c(e, t) {
35
+ if (t.length > 0) {
36
+ let n = e.data, r = n.length / 4, i, a, o, s, c;
37
+ for (let e = 0; e < r; e++) {
38
+ i = e * 4, a = n[i + 0], o = n[i + 1], s = n[i + 2], c = n[i + 3];
39
+ for (let e = 0; e < t.length; e++) if (!t[e]?.(a, o, s, c)) {
40
+ n[i + 3] = 0;
41
+ break;
42
+ }
43
+ }
44
+ }
45
+ return e;
46
+ }
47
+ //#endregion
48
+ //#region node_modules/@vibrant/image-browser/dist/esm/index.js
49
+ function l(e) {
50
+ let t = new URL(e, location.href);
51
+ return t.protocol === location.protocol && t.host === location.host && t.port === location.port;
52
+ }
53
+ function u(e, t) {
54
+ let n = new URL(e), r = new URL(t);
55
+ return n.protocol === r.protocol && n.hostname === r.hostname && n.port === r.port;
56
+ }
57
+ var d = class extends s {
58
+ _getCanvas() {
59
+ if (!this._canvas) throw Error("Canvas is not initialized");
60
+ return this._canvas;
61
+ }
62
+ _getContext() {
63
+ if (!this._context) throw Error("Context is not initialized");
64
+ return this._context;
65
+ }
66
+ _getWidth() {
67
+ if (!this._width) throw Error("Width is not initialized");
68
+ return this._width;
69
+ }
70
+ _getHeight() {
71
+ if (!this._height) throw Error("Height is not initialized");
72
+ return this._height;
73
+ }
74
+ _initCanvas() {
75
+ let e = this.image;
76
+ if (!e) throw Error("Image is not initialized");
77
+ let t = this._canvas = document.createElement("canvas"), n = t.getContext("2d");
78
+ if (!n) throw ReferenceError("Failed to create canvas context");
79
+ this._context = n, t.className = "@vibrant/canvas", t.style.display = "none", this._width = t.width = e.width, this._height = t.height = e.height, n.drawImage(e, 0, 0), document.body.appendChild(t);
80
+ }
81
+ load(e) {
82
+ let t, n;
83
+ if (typeof e == "string") t = document.createElement("img"), n = e, !l(n) && !u(window.location.href, n) && (t.crossOrigin = "anonymous"), t.src = n;
84
+ else if (e instanceof HTMLImageElement) t = e, n = e.src;
85
+ else return Promise.reject(/* @__PURE__ */ Error("Cannot load buffer as an image in browser"));
86
+ return this.image = t, new Promise((e, r) => {
87
+ let i = () => {
88
+ this._initCanvas(), e(this);
89
+ };
90
+ t.complete ? i() : (t.onload = i, t.onerror = (e) => r(/* @__PURE__ */ Error(`Fail to load image: ${n}`)));
91
+ });
92
+ }
93
+ clear() {
94
+ this._getContext().clearRect(0, 0, this._getWidth(), this._getHeight());
95
+ }
96
+ update(e) {
97
+ this._getContext().putImageData(e, 0, 0);
98
+ }
99
+ getWidth() {
100
+ return this._getWidth();
101
+ }
102
+ getHeight() {
103
+ return this._getHeight();
104
+ }
105
+ resize(e, t, n) {
106
+ if (!this.image) throw Error("Image is not initialized");
107
+ this._width = this._getCanvas().width = e, this._height = this._getCanvas().height = t, this._getContext().scale(n, n), this._getContext().drawImage(this.image, 0, 0);
108
+ }
109
+ getPixelCount() {
110
+ return this._getWidth() * this._getHeight();
111
+ }
112
+ getImageData() {
113
+ return this._getContext().getImageData(0, 0, this._getWidth(), this._getHeight());
114
+ }
115
+ remove() {
116
+ this._canvas && this._canvas.parentNode && this._canvas.parentNode.removeChild(this._canvas);
117
+ }
118
+ };
119
+ //#endregion
120
+ //#region node_modules/@vibrant/core/dist/esm/utils.js
121
+ function f(e, ...t) {
122
+ return t.forEach((t) => {
123
+ if (t) {
124
+ for (let n in t) if (t.hasOwnProperty(n)) {
125
+ let r = t[n];
126
+ Array.isArray(r) ? e[n] = r.slice(0) : typeof r == "object" ? (e[n] || (e[n] = {}), f(e[n], r)) : e[n] = r;
127
+ }
128
+ }
129
+ }), e;
130
+ }
131
+ //#endregion
132
+ //#region node_modules/@vibrant/core/dist/esm/options.js
133
+ function p(e, t) {
134
+ let { colorCount: n, quantizer: r, generators: i, filters: a } = e, o = { colorCount: n }, s = typeof r == "string" ? {
135
+ name: r,
136
+ options: {}
137
+ } : r;
138
+ return s.options = f({}, o, s.options), f({}, {
139
+ quantizer: s,
140
+ generators: i,
141
+ filters: a
142
+ }, t);
143
+ }
144
+ //#endregion
145
+ //#region node_modules/@vibrant/core/dist/esm/builder.js
146
+ var m = class {
147
+ constructor(e, t = {}) {
148
+ this._src = e, this._opts = f({}, S.DefaultOpts, t);
149
+ }
150
+ maxColorCount(e) {
151
+ return this._opts.colorCount = e, this;
152
+ }
153
+ maxDimension(e) {
154
+ return this._opts.maxDimension = e, this;
155
+ }
156
+ addFilter(e) {
157
+ return this._opts.filters ? this._opts.filters.push(e) : this._opts.filters = [e], this;
158
+ }
159
+ removeFilter(e) {
160
+ if (this._opts.filters) {
161
+ let t = this._opts.filters.indexOf(e);
162
+ t > 0 && this._opts.filters.splice(t);
163
+ }
164
+ return this;
165
+ }
166
+ clearFilters() {
167
+ return this._opts.filters = [], this;
168
+ }
169
+ quality(e) {
170
+ return this._opts.quality = e, this;
171
+ }
172
+ useImageClass(e) {
173
+ return this._opts.ImageClass = e, this;
174
+ }
175
+ useGenerator(e, t) {
176
+ return this._opts.generators || (this._opts.generators = []), this._opts.generators.push(t ? {
177
+ name: e,
178
+ options: t
179
+ } : e), this;
180
+ }
181
+ useQuantizer(e, t) {
182
+ return this._opts.quantizer = t ? {
183
+ name: e,
184
+ options: t
185
+ } : e, this;
186
+ }
187
+ build() {
188
+ return new S(this._src, this._opts);
189
+ }
190
+ getPalette() {
191
+ return this.build().getPalette();
192
+ }
193
+ }, h = class {
194
+ constructor(e) {
195
+ this.pipeline = e, this._map = {};
196
+ }
197
+ names() {
198
+ return Object.keys(this._map);
199
+ }
200
+ has(e) {
201
+ return !!this._map[e];
202
+ }
203
+ get(e) {
204
+ return this._map[e];
205
+ }
206
+ register(e, t) {
207
+ return this._map[e] = t, this.pipeline;
208
+ }
209
+ }, g = class {
210
+ constructor() {
211
+ this.filter = new h(this), this.quantizer = new h(this), this.generator = new h(this);
212
+ }
213
+ _buildProcessTasks({ filters: e, quantizer: t, generators: n }) {
214
+ return n.length === 1 && n[0] === "*" && (n = this.generator.names()), {
215
+ filters: e.map((e) => r(this.filter, e)),
216
+ quantizer: r(this.quantizer, t),
217
+ generators: n.map((e) => r(this.generator, e))
218
+ };
219
+ function r(e, t) {
220
+ let n, r;
221
+ return typeof t == "string" ? n = t : (n = t.name, r = t.options), {
222
+ name: n,
223
+ fn: e.get(n),
224
+ options: r
225
+ };
226
+ }
227
+ }
228
+ async process(e, t) {
229
+ let { filters: n, quantizer: r, generators: i } = this._buildProcessTasks(t), a = await this._filterColors(n, e), o = await this._generateColors(r, a);
230
+ return {
231
+ colors: o,
232
+ palettes: await this._generatePalettes(i, o)
233
+ };
234
+ }
235
+ _filterColors(e, t) {
236
+ return Promise.resolve(c(t, e.map(({ fn: e }) => e)));
237
+ }
238
+ _generateColors(e, t) {
239
+ return Promise.resolve(e.fn(t.data, e.options));
240
+ }
241
+ async _generatePalettes(e, t) {
242
+ let n = await Promise.all(e.map(({ fn: e, options: n }) => Promise.resolve(e(t, n))));
243
+ return Promise.resolve(n.reduce((t, n, r) => (t[e[r].name] = n, t), {}));
244
+ }
245
+ };
246
+ //#endregion
247
+ //#region node_modules/@vibrant/color/dist/esm/converter.js
248
+ function _(e, t, n) {
249
+ return "#" + ((1 << 24) + (e << 16) + (t << 8) + n).toString(16).slice(1, 7);
250
+ }
251
+ function v(e, t, n) {
252
+ e /= 255, t /= 255, n /= 255;
253
+ let r = Math.max(e, t, n), i = Math.min(e, t, n), a = 0, o = 0, s = (r + i) / 2;
254
+ if (r !== i) {
255
+ let c = r - i;
256
+ switch (o = s > .5 ? c / (2 - r - i) : c / (r + i), r) {
257
+ case e:
258
+ a = (t - n) / c + (t < n ? 6 : 0);
259
+ break;
260
+ case t:
261
+ a = (n - e) / c + 2;
262
+ break;
263
+ case n:
264
+ a = (e - t) / c + 4;
265
+ break;
266
+ }
267
+ a /= 6;
268
+ }
269
+ return [
270
+ a,
271
+ o,
272
+ s
273
+ ];
274
+ }
275
+ function y(e, t, n) {
276
+ let r, i, a;
277
+ function o(e, t, n) {
278
+ return n < 0 && (n += 1), n > 1 && --n, n < 1 / 6 ? e + (t - e) * 6 * n : n < 1 / 2 ? t : n < 2 / 3 ? e + (t - e) * (2 / 3 - n) * 6 : e;
279
+ }
280
+ if (t === 0) r = i = a = n;
281
+ else {
282
+ let s = n < .5 ? n * (1 + t) : n + t - n * t, c = 2 * n - s;
283
+ r = o(c, s, e + 1 / 3), i = o(c, s, e), a = o(c, s, e - 1 / 3);
284
+ }
285
+ return [
286
+ r * 255,
287
+ i * 255,
288
+ a * 255
289
+ ];
290
+ }
291
+ //#endregion
292
+ //#region node_modules/@vibrant/color/dist/esm/index.js
293
+ var b = class e {
294
+ static applyFilters(e, t) {
295
+ return t.length > 0 ? e.filter(({ r: e, g: n, b: r }) => {
296
+ for (let i = 0; i < t.length; i++) if (!t[i]?.(e, n, r, 255)) return !1;
297
+ return !0;
298
+ }) : e;
299
+ }
300
+ static clone(t) {
301
+ return new e(t._rgb, t._population);
302
+ }
303
+ get r() {
304
+ return this._rgb[0];
305
+ }
306
+ get g() {
307
+ return this._rgb[1];
308
+ }
309
+ get b() {
310
+ return this._rgb[2];
311
+ }
312
+ get rgb() {
313
+ return this._rgb;
314
+ }
315
+ get hsl() {
316
+ if (!this._hsl) {
317
+ let [e, t, n] = this._rgb;
318
+ this._hsl = v(e, t, n);
319
+ }
320
+ return this._hsl;
321
+ }
322
+ get hex() {
323
+ if (!this._hex) {
324
+ let [e, t, n] = this._rgb;
325
+ this._hex = _(e, t, n);
326
+ }
327
+ return this._hex;
328
+ }
329
+ get population() {
330
+ return this._population;
331
+ }
332
+ toJSON() {
333
+ return {
334
+ rgb: this.rgb,
335
+ population: this.population
336
+ };
337
+ }
338
+ getYiq() {
339
+ if (!this._yiq) {
340
+ let e = this._rgb;
341
+ this._yiq = (e[0] * 299 + e[1] * 587 + e[2] * 114) / 1e3;
342
+ }
343
+ return this._yiq;
344
+ }
345
+ get titleTextColor() {
346
+ return this._titleTextColor ||= this.getYiq() < 200 ? "#fff" : "#000", this._titleTextColor;
347
+ }
348
+ get bodyTextColor() {
349
+ return this._bodyTextColor ||= this.getYiq() < 150 ? "#fff" : "#000", this._bodyTextColor;
350
+ }
351
+ constructor(e, t) {
352
+ this._rgb = e, this._population = t;
353
+ }
354
+ }, x = class e {
355
+ constructor(t, n) {
356
+ this._src = t, this.opts = f({}, e.DefaultOpts, n);
357
+ }
358
+ static use(e) {
359
+ this._pipeline = e;
360
+ }
361
+ static from(e) {
362
+ return new m(e);
363
+ }
364
+ get result() {
365
+ return this._result;
366
+ }
367
+ _process(t, n) {
368
+ t.scaleDown(this.opts);
369
+ let r = p(this.opts, n);
370
+ return e._pipeline.process(t.getImageData(), r);
371
+ }
372
+ async getPalette() {
373
+ let e = new this.opts.ImageClass();
374
+ try {
375
+ let t = await e.load(this._src), n = await this._process(t, { generators: ["default"] });
376
+ this._result = n;
377
+ let r = n.palettes.default;
378
+ if (!r) throw Error("Something went wrong and a palette was not found, please file a bug against our GitHub repo: https://github.com/vibrant-Colors/node-vibrant/");
379
+ return e.remove(), r;
380
+ } catch (t) {
381
+ return e.remove(), Promise.reject(t);
382
+ }
383
+ }
384
+ async getPalettes() {
385
+ let e = new this.opts.ImageClass();
386
+ try {
387
+ let t = await e.load(this._src), n = await this._process(t, { generators: ["*"] });
388
+ this._result = n;
389
+ let r = n.palettes;
390
+ return e.remove(), r;
391
+ } catch (t) {
392
+ return e.remove(), Promise.reject(t);
393
+ }
394
+ }
395
+ };
396
+ x.DefaultOpts = {
397
+ colorCount: 64,
398
+ quality: 5,
399
+ filters: []
400
+ };
401
+ var S = x;
402
+ //#endregion
403
+ //#region node_modules/node-vibrant/dist/esm/configs/browser.js
404
+ S.DefaultOpts.quantizer = "mmcq", S.DefaultOpts.generators = ["default"], S.DefaultOpts.filters = ["default"], S.DefaultOpts.ImageClass = d;
405
+ //#endregion
406
+ //#region node_modules/@vibrant/quantizer-mmcq/dist/esm/vbox.js
407
+ var C = 5, w = 8 - C, T = class e {
408
+ constructor(e, t, n, r, i, a, o) {
409
+ this.histogram = o, this._volume = -1, this._avg = null, this._count = -1, this.dimension = {
410
+ r1: e,
411
+ r2: t,
412
+ g1: n,
413
+ g2: r,
414
+ b1: i,
415
+ b2: a
416
+ };
417
+ }
418
+ static build(t) {
419
+ let n = new o(t, { sigBits: C }), { rmin: r, rmax: i, gmin: a, gmax: s, bmin: c, bmax: l } = n;
420
+ return new e(r, i, a, s, c, l, n);
421
+ }
422
+ invalidate() {
423
+ this._volume = this._count = -1, this._avg = null;
424
+ }
425
+ volume() {
426
+ if (this._volume < 0) {
427
+ let { r1: e, r2: t, g1: n, g2: r, b1: i, b2: a } = this.dimension;
428
+ this._volume = (t - e + 1) * (r - n + 1) * (a - i + 1);
429
+ }
430
+ return this._volume;
431
+ }
432
+ count() {
433
+ if (this._count < 0) {
434
+ let { hist: e, getColorIndex: t } = this.histogram, { r1: n, r2: r, g1: i, g2: a, b1: o, b2: s } = this.dimension, c = 0;
435
+ for (let l = n; l <= r; l++) for (let n = i; n <= a; n++) for (let r = o; r <= s; r++) {
436
+ let i = t(l, n, r);
437
+ e[i] && (c += e[i]);
438
+ }
439
+ this._count = c;
440
+ }
441
+ return this._count;
442
+ }
443
+ clone() {
444
+ let { histogram: t } = this, { r1: n, r2: r, g1: i, g2: a, b1: o, b2: s } = this.dimension;
445
+ return new e(n, r, i, a, o, s, t);
446
+ }
447
+ avg() {
448
+ if (!this._avg) {
449
+ let { hist: e, getColorIndex: t } = this.histogram, { r1: n, r2: r, g1: i, g2: a, b1: o, b2: s } = this.dimension, c = 0, l = 1 << 8 - C, u, d, f;
450
+ u = d = f = 0;
451
+ for (let p = n; p <= r; p++) for (let n = i; n <= a; n++) for (let r = o; r <= s; r++) {
452
+ let i = e[t(p, n, r)];
453
+ i && (c += i, u += i * (p + .5) * l, d += i * (n + .5) * l, f += i * (r + .5) * l);
454
+ }
455
+ c ? this._avg = [
456
+ ~~(u / c),
457
+ ~~(d / c),
458
+ ~~(f / c)
459
+ ] : this._avg = [
460
+ ~~(l * (n + r + 1) / 2),
461
+ ~~(l * (i + a + 1) / 2),
462
+ ~~(l * (o + s + 1) / 2)
463
+ ];
464
+ }
465
+ return this._avg;
466
+ }
467
+ contains(e) {
468
+ let [t, n, r] = e, { r1: i, r2: a, g1: o, g2: s, b1: c, b2: l } = this.dimension;
469
+ return t >>= w, n >>= w, r >>= w, t >= i && t <= a && n >= o && n <= s && r >= c && r <= l;
470
+ }
471
+ split() {
472
+ let { hist: e, getColorIndex: t } = this.histogram, { r1: n, r2: r, g1: i, g2: a, b1: o, b2: s } = this.dimension, c = this.count();
473
+ if (!c) return [];
474
+ if (c === 1) return [this.clone()];
475
+ let l = r - n + 1, u = a - i + 1, d = s - o + 1, f = Math.max(l, u, d), p = null, m, h;
476
+ m = h = 0;
477
+ let g = null;
478
+ if (f === l) {
479
+ g = "r", p = new Uint32Array(r + 1);
480
+ for (let c = n; c <= r; c++) {
481
+ m = 0;
482
+ for (let n = i; n <= a; n++) for (let r = o; r <= s; r++) {
483
+ let i = t(c, n, r);
484
+ e[i] && (m += e[i]);
485
+ }
486
+ h += m, p[c] = h;
487
+ }
488
+ } else if (f === u) {
489
+ g = "g", p = new Uint32Array(a + 1);
490
+ for (let c = i; c <= a; c++) {
491
+ m = 0;
492
+ for (let i = n; i <= r; i++) for (let n = o; n <= s; n++) {
493
+ let r = t(i, c, n);
494
+ e[r] && (m += e[r]);
495
+ }
496
+ h += m, p[c] = h;
497
+ }
498
+ } else {
499
+ g = "b", p = new Uint32Array(s + 1);
500
+ for (let c = o; c <= s; c++) {
501
+ m = 0;
502
+ for (let o = n; o <= r; o++) for (let n = i; n <= a; n++) {
503
+ let r = t(o, n, c);
504
+ e[r] && (m += e[r]);
505
+ }
506
+ h += m, p[c] = h;
507
+ }
508
+ }
509
+ let _ = -1, v = new Uint32Array(p.length);
510
+ for (let e = 0; e < p.length; e++) {
511
+ let t = p[e];
512
+ t && (_ < 0 && t > h / 2 && (_ = e), v[e] = h - t);
513
+ }
514
+ let y = this;
515
+ function b(e) {
516
+ let t = e + "1", n = e + "2", r = y.dimension[t], i = y.dimension[n], a = y.clone(), o = y.clone(), s = _ - r, c = i - _;
517
+ for (s <= c ? (i = Math.min(i - 1, ~~(_ + c / 2)), i = Math.max(0, i)) : (i = Math.max(r, ~~(_ - 1 - s / 2)), i = Math.min(y.dimension[n], i)); !p[i];) i++;
518
+ let l = v[i];
519
+ for (; !l && p[i - 1];) l = v[--i];
520
+ return a.dimension[n] = i, o.dimension[t] = i + 1, [a, o];
521
+ }
522
+ return b(g);
523
+ }
524
+ }, E = class {
525
+ _sort() {
526
+ this._sorted ||= (this.contents.sort(this._comparator), !0);
527
+ }
528
+ constructor(e) {
529
+ this._comparator = e, this.contents = [], this._sorted = !1;
530
+ }
531
+ push(e) {
532
+ this.contents.push(e), this._sorted = !1;
533
+ }
534
+ peek(e) {
535
+ return this._sort(), e = typeof e == "number" ? e : this.contents.length - 1, this.contents[e];
536
+ }
537
+ pop() {
538
+ return this._sort(), this.contents.pop();
539
+ }
540
+ size() {
541
+ return this.contents.length;
542
+ }
543
+ map(e) {
544
+ return this._sort(), this.contents.map(e);
545
+ }
546
+ }, D = .75;
547
+ function O(e, t) {
548
+ let n = e.size();
549
+ for (; e.size() < t;) {
550
+ let t = e.pop();
551
+ if (t && t.count() > 0) {
552
+ let [r, i] = t.split();
553
+ if (!r || (e.push(r), i && i.count() > 0 && e.push(i), e.size() === n)) break;
554
+ n = e.size();
555
+ } else break;
556
+ }
557
+ }
558
+ var k = (e, t) => {
559
+ if (e.length === 0 || t.colorCount < 2 || t.colorCount > 256) throw Error("Wrong MMCQ parameters");
560
+ let n = T.build(e);
561
+ n.histogram.colorCount;
562
+ let r = new E((e, t) => e.count() - t.count());
563
+ r.push(n), O(r, D * t.colorCount);
564
+ let i = new E((e, t) => e.count() * e.volume() - t.count() * t.volume());
565
+ return i.contents = r.contents, O(i, t.colorCount - i.size()), A(i);
566
+ };
567
+ function A(e) {
568
+ let t = [];
569
+ for (; e.size();) {
570
+ let n = e.pop(), r = n.avg(), [i, a, o] = r;
571
+ t.push(new b(r, n.count()));
572
+ }
573
+ return t;
574
+ }
575
+ //#endregion
576
+ //#region node_modules/@vibrant/generator-default/dist/esm/index.js
577
+ var j = {
578
+ targetDarkLuma: .26,
579
+ maxDarkLuma: .45,
580
+ minLightLuma: .55,
581
+ targetLightLuma: .74,
582
+ minNormalLuma: .3,
583
+ targetNormalLuma: .5,
584
+ maxNormalLuma: .7,
585
+ targetMutesSaturation: .3,
586
+ maxMutesSaturation: .4,
587
+ targetVibrantSaturation: 1,
588
+ minVibrantSaturation: .35,
589
+ weightSaturation: 3,
590
+ weightLuma: 6.5,
591
+ weightPopulation: .5
592
+ };
593
+ function M(e) {
594
+ let t = 0;
595
+ return e.forEach((e) => {
596
+ t = Math.max(t, e.population);
597
+ }), t;
598
+ }
599
+ function N(e, t) {
600
+ return e.Vibrant === t || e.DarkVibrant === t || e.LightVibrant === t || e.Muted === t || e.DarkMuted === t || e.LightMuted === t;
601
+ }
602
+ function P(e, t, n, r, i, a, o) {
603
+ function s(...e) {
604
+ let t = 0, n = 0;
605
+ for (let r = 0; r < e.length; r += 2) {
606
+ let i = e[r], a = e[r + 1];
607
+ !i || !a || (t += i * a, n += a);
608
+ }
609
+ return t / n;
610
+ }
611
+ function c(e, t) {
612
+ return 1 - Math.abs(e - t);
613
+ }
614
+ return s(c(e, t), o.weightSaturation, c(n, r), o.weightLuma, i / a, o.weightPopulation);
615
+ }
616
+ function F(e, t, n, r, i, a, o, s, c, l) {
617
+ let u = null, d = 0;
618
+ return t.forEach((t) => {
619
+ let [, f, p] = t.hsl;
620
+ if (f >= s && f <= c && p >= i && p <= a && !N(e, t)) {
621
+ let e = P(f, o, p, r, t.population, n, l);
622
+ (u === null || e > d) && (u = t, d = e);
623
+ }
624
+ }), u;
625
+ }
626
+ function I(e, t, n) {
627
+ let r = {
628
+ Vibrant: null,
629
+ DarkVibrant: null,
630
+ LightVibrant: null,
631
+ Muted: null,
632
+ DarkMuted: null,
633
+ LightMuted: null
634
+ };
635
+ return r.Vibrant = F(r, e, t, n.targetNormalLuma, n.minNormalLuma, n.maxNormalLuma, n.targetVibrantSaturation, n.minVibrantSaturation, 1, n), r.LightVibrant = F(r, e, t, n.targetLightLuma, n.minLightLuma, 1, n.targetVibrantSaturation, n.minVibrantSaturation, 1, n), r.DarkVibrant = F(r, e, t, n.targetDarkLuma, 0, n.maxDarkLuma, n.targetVibrantSaturation, n.minVibrantSaturation, 1, n), r.Muted = F(r, e, t, n.targetNormalLuma, n.minNormalLuma, n.maxNormalLuma, n.targetMutesSaturation, 0, n.maxMutesSaturation, n), r.LightMuted = F(r, e, t, n.targetLightLuma, n.minLightLuma, 1, n.targetMutesSaturation, 0, n.maxMutesSaturation, n), r.DarkMuted = F(r, e, t, n.targetDarkLuma, 0, n.maxDarkLuma, n.targetMutesSaturation, 0, n.maxMutesSaturation, n), r;
636
+ }
637
+ function L(e, t, n) {
638
+ if (!e.Vibrant && !e.DarkVibrant && !e.LightVibrant) {
639
+ if (!e.DarkVibrant && e.DarkMuted) {
640
+ let [t, r, i] = e.DarkMuted.hsl;
641
+ i = n.targetDarkLuma, e.DarkVibrant = new b(y(t, r, i), 0);
642
+ }
643
+ if (!e.LightVibrant && e.LightMuted) {
644
+ let [t, r, i] = e.LightMuted.hsl;
645
+ i = n.targetDarkLuma, e.DarkVibrant = new b(y(t, r, i), 0);
646
+ }
647
+ }
648
+ if (!e.Vibrant && e.DarkVibrant) {
649
+ let [t, r, i] = e.DarkVibrant.hsl;
650
+ i = n.targetNormalLuma, e.Vibrant = new b(y(t, r, i), 0);
651
+ } else if (!e.Vibrant && e.LightVibrant) {
652
+ let [t, r, i] = e.LightVibrant.hsl;
653
+ i = n.targetNormalLuma, e.Vibrant = new b(y(t, r, i), 0);
654
+ }
655
+ if (!e.DarkVibrant && e.Vibrant) {
656
+ let [t, r, i] = e.Vibrant.hsl;
657
+ i = n.targetDarkLuma, e.DarkVibrant = new b(y(t, r, i), 0);
658
+ }
659
+ if (!e.LightVibrant && e.Vibrant) {
660
+ let [t, r, i] = e.Vibrant.hsl;
661
+ i = n.targetLightLuma, e.LightVibrant = new b(y(t, r, i), 0);
662
+ }
663
+ if (!e.Muted && e.Vibrant) {
664
+ let [t, r, i] = e.Vibrant.hsl;
665
+ i = n.targetMutesSaturation, e.Muted = new b(y(t, r, i), 0);
666
+ }
667
+ if (!e.DarkMuted && e.DarkVibrant) {
668
+ let [t, r, i] = e.DarkVibrant.hsl;
669
+ i = n.targetMutesSaturation, e.DarkMuted = new b(y(t, r, i), 0);
670
+ }
671
+ if (!e.LightMuted && e.LightVibrant) {
672
+ let [t, r, i] = e.LightVibrant.hsl;
673
+ i = n.targetMutesSaturation, e.LightMuted = new b(y(t, r, i), 0);
674
+ }
675
+ }
676
+ //#endregion
677
+ //#region node_modules/node-vibrant/dist/esm/pipeline/index.js
678
+ var R = new g().filter.register("default", (e, t, n, r) => r >= 125 && !(e > 250 && t > 250 && n > 250)).quantizer.register("mmcq", k).generator.register("default", ((e, t) => {
679
+ t = Object.assign({}, j, t);
680
+ let n = M(e), r = I(e, n, t);
681
+ return L(r, n, t), r;
682
+ }));
683
+ //#endregion
684
+ //#region node_modules/node-vibrant/dist/esm/browser.js
685
+ S.use(R);
686
+ //#endregion
687
+ //#region .vitepress/components/FxHeroImageBg.ts
688
+ var z = "fx-hero-colors";
689
+ function B() {
690
+ try {
691
+ let e = localStorage.getItem(z);
692
+ return e ? JSON.parse(e) : null;
693
+ } catch {
694
+ return null;
695
+ }
696
+ }
697
+ function V(e) {
698
+ try {
699
+ localStorage.setItem(z, JSON.stringify(e));
700
+ } catch {}
701
+ }
702
+ function H(e) {
703
+ return [
704
+ e.Vibrant,
705
+ e.DarkVibrant,
706
+ e.LightVibrant,
707
+ e.Muted,
708
+ e.DarkMuted,
709
+ e.LightMuted
710
+ ].filter(Boolean);
711
+ }
712
+ function U(e) {
713
+ return e.slice().sort((e, t) => e.hsl[0] - t.hsl[0]).map((e) => e.hex);
714
+ }
715
+ function W(e) {
716
+ let t = H(e);
717
+ if (t.length === 0) return "-webkit-linear-gradient(-45deg, #bd34fe 50%, #47caff 50%)";
718
+ let n = U(t);
719
+ return `conic-gradient(from 0deg, ${[...n, n[0]].join(", ")})`;
720
+ }
721
+ function G(e) {
722
+ let t = H(e);
723
+ if (t.length < 2) return "linear-gradient(120deg, #bd34fe, #41d1ff)";
724
+ let n = -1, r = [t[0].hex, t[1].hex];
725
+ for (let e = 0; e < t.length; e++) for (let i = e + 1; i < t.length; i++) {
726
+ let a = Math.abs(t[e].hsl[0] - t[i].hsl[0]);
727
+ a > n && (n = a, r = [t[e].hex, t[i].hex]);
728
+ }
729
+ return `linear-gradient(120deg, ${r[0]}, ${r[1]})`;
730
+ }
731
+ function K(e) {
732
+ return `${parseInt(e.slice(1, 3), 16)}, ${parseInt(e.slice(3, 5), 16)}, ${parseInt(e.slice(5, 7), 16)}`;
733
+ }
734
+ function q(e) {
735
+ let t = H(e);
736
+ if (t.length < 2) return ["189, 52, 254", "65, 209, 255"];
737
+ let n = -1, r = [t[0], t[1]];
738
+ for (let e = 0; e < t.length; e++) for (let i = e + 1; i < t.length; i++) {
739
+ let a = Math.abs(t[e].hsl[0] - t[i].hsl[0]);
740
+ a > n && (n = a, r = [t[e], t[i]]);
741
+ }
742
+ return [K(r[0].hex), K(r[1].hex)];
743
+ }
744
+ function J() {
745
+ return document.documentElement.classList.contains("dark");
746
+ }
747
+ function Y(e) {
748
+ return {
749
+ imageGradient: W(e),
750
+ nameGradient: G(e),
751
+ beamC1: q(e)[0],
752
+ beamC2: q(e)[1]
753
+ };
754
+ }
755
+ function X(e) {
756
+ let t = document.documentElement;
757
+ t.style.setProperty("--vp-home-hero-image-background-image", e.imageGradient), t.style.setProperty("--vp-home-hero-name-background", e.nameGradient), t.style.setProperty("--fx-beam-c1", e.beamC1), t.style.setProperty("--fx-beam-c2", e.beamC2);
758
+ }
759
+ function Z(e) {
760
+ let t = document.documentElement;
761
+ t.style.setProperty("--fx-beam-c1", e.beamC1), t.style.setProperty("--fx-beam-c2", e.beamC2);
762
+ }
763
+ var Q = {
764
+ props: { heroImageColor: {
765
+ type: Boolean,
766
+ default: !1
767
+ } },
768
+ render: () => null,
769
+ setup(o) {
770
+ if (!o.heroImageColor) return;
771
+ let s = null, c = a(), { frontmatter: l } = i();
772
+ function u() {
773
+ let e = document.documentElement;
774
+ e.style.removeProperty("--vp-home-hero-image-background-image"), e.style.removeProperty("--vp-home-hero-name-background");
775
+ }
776
+ function d(e) {
777
+ return J() ? e.dark || e.light : e.light || e.dark;
778
+ }
779
+ function f(e) {
780
+ let t = B();
781
+ return !t || !t.images ? !1 : e && (e.light && t.images.light && e.light !== t.images.light || e.dark && t.images.dark && e.dark !== t.images.dark) ? (localStorage.removeItem(z), !0) : !1;
782
+ }
783
+ function p() {
784
+ let e = B();
785
+ if (!e) return !1;
786
+ let t = d(e);
787
+ return t ? (X(t), !0) : !1;
788
+ }
789
+ function m() {
790
+ let e = B();
791
+ if (!e) return !1;
792
+ let t = d(e);
793
+ return t ? (Z(t), !0) : !1;
794
+ }
795
+ function h() {
796
+ return l.value.fxHeroImages || {};
797
+ }
798
+ async function g() {
799
+ try {
800
+ let e = await import(
801
+ /* @vite-ignore */
802
+ "/index.md"
803
+ ), t = (typeof e.__pageData == "string" ? JSON.parse(e.__pageData) : e.__pageData)?.frontmatter?.hero?.image;
804
+ return t ? typeof t == "string" ? {
805
+ light: t,
806
+ dark: t
807
+ } : {
808
+ light: t.light,
809
+ dark: t.dark
810
+ } : null;
811
+ } catch {
812
+ return null;
813
+ }
814
+ }
815
+ async function _(e, t) {
816
+ let n = e.src;
817
+ if (n) try {
818
+ let e = Y(await S.from(n).quality(1).getPalette());
819
+ (J() && t === "dark" || !J() && t === "light") && X(e);
820
+ let r = B() || {};
821
+ r[t] = e, r.images ||= {}, r.images[t] = n, V(r);
822
+ } catch {}
823
+ }
824
+ async function v(e, t) {
825
+ try {
826
+ let n = Y(await S.from(e).quality(1).getPalette()), r = B() || {};
827
+ return r[t] = n, r.images ||= {}, r.images[t] = e, V(r), n;
828
+ } catch {
829
+ return null;
830
+ }
831
+ }
832
+ async function y(e) {
833
+ if (!e.light && !e.dark) return;
834
+ let t = {};
835
+ if (e.light) {
836
+ let n = await v(e.light, "light");
837
+ n && (t.light = n);
838
+ }
839
+ if (e.dark) {
840
+ let n = await v(e.dark, "dark");
841
+ n && (t.dark = n);
842
+ }
843
+ if (t.light || t.dark) {
844
+ let e = J() ? t.dark || t.light : t.light || t.dark;
845
+ e && X(e);
846
+ }
847
+ }
848
+ async function b() {
849
+ let e = h();
850
+ if (e.light || e.dark) {
851
+ await y(e);
852
+ return;
853
+ }
854
+ let t = await g();
855
+ if (t) {
856
+ await y(t);
857
+ return;
858
+ }
859
+ try {
860
+ let e = await (await fetch(window.location.origin + "/")).text(), t = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".VPHero .image-container img.VPImage"), n = {};
861
+ t.forEach((e) => {
862
+ let t = e.getAttribute("src");
863
+ t && (e.classList.contains("dark") ? n.dark = t : n.light = t);
864
+ }), (n.light || n.dark) && await y(n);
865
+ } catch {}
866
+ }
867
+ function x() {
868
+ let e = document.querySelector(".VPHero .image-container img.VPImage.light"), t = document.querySelector(".VPHero .image-container img.VPImage.dark");
869
+ e || t ? (e && e.complete && e.naturalWidth > 0 ? _(e, "light") : e && e.addEventListener("load", () => _(e, "light"), { once: !0 }), t && t.complete && t.naturalWidth > 0 ? _(t, "dark") : t && t.addEventListener("load", () => _(t, "dark"), { once: !0 })) : (u(), m(), b());
870
+ }
871
+ n(() => {
872
+ f(h()), p() || b(), x(), s = new MutationObserver((e) => {
873
+ for (let t of e) if (t.attributeName === "class") {
874
+ m(), x();
875
+ break;
876
+ }
877
+ }), s.observe(document.documentElement, { attributes: !0 });
878
+ }), r(() => c.path, () => {
879
+ e(x);
880
+ }), t(() => {
881
+ s?.disconnect(), u();
882
+ });
883
+ }
884
+ };
885
+ //#endregion
886
+ export { Q as default };