@takazudo/zdtp 0.4.3 → 0.4.4

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.
@@ -1,50 +1,5 @@
1
- import { g, z as rt, n as W, d as it, b as at, f as ot, i as st, r as j, A as ft, h as ut, B as lt } from "./panel-config-3tBEHjvZ.js";
2
- class N extends Error {
3
- constructor(t) {
4
- super(t), this.name = "TierResolverError", Object.setPrototypeOf(this, N.prototype);
5
- }
6
- }
7
- function me(e, t) {
8
- return e.tiers.find((n) => n.id === t);
9
- }
10
- function V(e, t) {
11
- return e.items.find((n) => n.id === t);
12
- }
13
- function be(e, t, n, r) {
14
- const i = me(e, t);
15
- if (!i)
16
- throw new N(
17
- `Tier "${t}" not found in tab "${e.id}". Available tiers: ${e.tiers.map((u) => u.id).join(", ")}.`
18
- );
19
- const a = V(i, n);
20
- if (!a)
21
- throw new N(
22
- `Item "${n}" not found in tier "${t}" of tab "${e.id}".`
23
- );
24
- const s = r[t]?.[n];
25
- if (i.referencesTier !== void 0) {
26
- const u = i.referencesTier, c = me(e, u);
27
- if (!c)
28
- throw new N(
29
- `Tier "${t}" declares referencesTier "${u}" but that tier does not exist in tab "${e.id}".`
30
- );
31
- const h = V(c, s ?? n);
32
- if (!h) {
33
- const p = V(c, a.default) ?? V(c, n) ?? c.items[0];
34
- if (!p)
35
- throw new N(
36
- `Referenced tier "${u}" has no items; cannot resolve fallback for item "${n}" in tier "${t}" of tab "${e.id}".`
37
- );
38
- return { kind: "ref", targetCssVar: p.cssVar };
39
- }
40
- return { kind: "ref", targetCssVar: h.cssVar };
41
- }
42
- return s !== void 0 ? a.pill && s === a.pill.value ? { kind: "literal", value: a.pill.value } : { kind: "literal", value: s } : a.pill ? { kind: "literal", value: a.pill.customDefault } : { kind: "literal", value: a.default };
43
- }
44
- function ye(e) {
45
- return e.kind === "literal" ? e.value : `var(${e.targetCssVar})`;
46
- }
47
- const Oe = (e, t) => {
1
+ import { g, C as ot, q as W, d as at, b as st, f as ft, i as lt, r as z, o as xe, p as Me, E as ut, h as ct, F as dt, l as ht } from "./panel-config-CXTCcYQs.js";
2
+ const Ce = (e, t) => {
48
3
  if (typeof e == "number") {
49
4
  if (t === 3)
50
5
  return {
@@ -77,7 +32,7 @@ const Oe = (e, t) => {
77
32
  alpha: (e & 255) / 255
78
33
  };
79
34
  }
80
- }, ct = {
35
+ }, pt = {
81
36
  aliceblue: 15792383,
82
37
  antiquewhite: 16444375,
83
38
  aqua: 65535,
@@ -228,23 +183,23 @@ const Oe = (e, t) => {
228
183
  whitesmoke: 16119285,
229
184
  yellow: 16776960,
230
185
  yellowgreen: 10145074
231
- }, dt = (e) => Oe(ct[e.toLowerCase()], 6), ht = /^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i, pt = (e) => {
186
+ }, gt = (e) => Ce(pt[e.toLowerCase()], 6), mt = /^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i, bt = (e) => {
232
187
  let t;
233
- return (t = e.match(ht)) ? Oe(parseInt(t[1], 16), t[1].length) : void 0;
234
- }, w = "([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)", A = `${w}%`, le = `(?:${w}%|${w})`, gt = `(?:${w}(deg|grad|rad|turn)|${w})`, O = "\\s*,\\s*", mt = new RegExp(
235
- `^rgba?\\(\\s*${w}${O}${w}${O}${w}\\s*(?:,\\s*${le}\\s*)?\\)$`
236
- ), bt = new RegExp(
237
- `^rgba?\\(\\s*${A}${O}${A}${O}${A}\\s*(?:,\\s*${le}\\s*)?\\)$`
238
- ), yt = (e) => {
188
+ return (t = e.match(mt)) ? Ce(parseInt(t[1], 16), t[1].length) : void 0;
189
+ }, S = "([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)", H = `${S}%`, pe = `(?:${S}%|${S})`, yt = `(?:${S}(deg|grad|rad|turn)|${S})`, O = "\\s*,\\s*", xt = new RegExp(
190
+ `^rgba?\\(\\s*${S}${O}${S}${O}${S}\\s*(?:,\\s*${pe}\\s*)?\\)$`
191
+ ), Mt = new RegExp(
192
+ `^rgba?\\(\\s*${H}${O}${H}${O}${H}\\s*(?:,\\s*${pe}\\s*)?\\)$`
193
+ ), vt = (e) => {
239
194
  let t = { mode: "rgb" }, n;
240
- if (n = e.match(mt))
195
+ if (n = e.match(xt))
241
196
  n[1] !== void 0 && (t.r = n[1] / 255), n[2] !== void 0 && (t.g = n[2] / 255), n[3] !== void 0 && (t.b = n[3] / 255);
242
- else if (n = e.match(bt))
197
+ else if (n = e.match(Mt))
243
198
  n[1] !== void 0 && (t.r = n[1] / 100), n[2] !== void 0 && (t.g = n[2] / 100), n[3] !== void 0 && (t.b = n[3] / 100);
244
199
  else
245
200
  return;
246
201
  return n[4] !== void 0 ? t.alpha = Math.max(0, Math.min(1, n[4] / 100)) : n[5] !== void 0 && (t.alpha = Math.max(0, Math.min(1, +n[5]))), t;
247
- }, B = (e, t) => e === void 0 ? void 0 : typeof e != "object" ? Ae(e) : e.mode !== void 0 ? e : t ? { ...e, mode: t } : void 0, y = (e = "rgb") => (t) => (t = B(t, e)) !== void 0 ? (
202
+ }, j = (e, t) => e === void 0 ? void 0 : typeof e != "object" ? Ee(e) : e.mode !== void 0 ? e : t ? { ...e, mode: t } : void 0, x = (e = "rgb") => (t) => (t = j(t, e)) !== void 0 ? (
248
203
  // if the color's mode corresponds to our target mode
249
204
  t.mode === e ? (
250
205
  // then just return the color
@@ -252,41 +207,41 @@ const Oe = (e, t) => {
252
207
  ) : (
253
208
  // otherwise check to see if we have a dedicated
254
209
  // converter for the target mode
255
- x[t.mode][e] ? (
210
+ M[t.mode][e] ? (
256
211
  // and return its result...
257
- x[t.mode][e](t)
212
+ M[t.mode][e](t)
258
213
  ) : (
259
214
  // ...otherwise pass through RGB as an intermediary step.
260
215
  // if the target mode is RGB...
261
216
  e === "rgb" ? (
262
217
  // just return the RGB
263
- x[t.mode].rgb(t)
218
+ M[t.mode].rgb(t)
264
219
  ) : (
265
220
  // otherwise convert color.mode -> RGB -> target_mode
266
- x.rgb[e](x[t.mode].rgb(t))
221
+ M.rgb[e](M[t.mode].rgb(t))
267
222
  )
268
223
  )
269
224
  )
270
- ) : void 0, x = {}, _e = {}, K = [], Pe = {}, xt = (e) => e, ce = (e) => (x[e.mode] = {
271
- ...x[e.mode],
225
+ ) : void 0, M = {}, _e = {}, K = [], Ae = {}, kt = (e) => e, ge = (e) => (M[e.mode] = {
226
+ ...M[e.mode],
272
227
  ...e.toMode
273
228
  }, Object.keys(e.fromMode || {}).forEach((t) => {
274
- x[t] || (x[t] = {}), x[t][e.mode] = e.fromMode[t];
229
+ M[t] || (M[t] = {}), M[t][e.mode] = e.fromMode[t];
275
230
  }), e.ranges || (e.ranges = {}), e.difference || (e.difference = {}), e.channels.forEach((t) => {
276
231
  if (e.ranges[t] === void 0 && (e.ranges[t] = [0, 1]), !e.interpolate[t])
277
232
  throw new Error(`Missing interpolator for: ${t}`);
278
233
  typeof e.interpolate[t] == "function" && (e.interpolate[t] = {
279
234
  use: e.interpolate[t]
280
- }), e.interpolate[t].fixup || (e.interpolate[t].fixup = xt);
235
+ }), e.interpolate[t].fixup || (e.interpolate[t].fixup = kt);
281
236
  }), _e[e.mode] = e, (e.parse || []).forEach((t) => {
282
- vt(t, e.mode);
283
- }), y(e.mode)), X = (e) => _e[e], vt = (e, t) => {
237
+ St(t, e.mode);
238
+ }), x(e.mode)), X = (e) => _e[e], St = (e, t) => {
284
239
  if (typeof e == "string") {
285
240
  if (!t)
286
241
  throw new Error("'mode' required when 'parser' is a string");
287
- Pe[e] = t;
242
+ Ae[e] = t;
288
243
  } else typeof e == "function" && K.indexOf(e) < 0 && K.push(e);
289
- }, ae = /[^\x00-\x7F]|[a-zA-Z_]/, Mt = /[^\x00-\x7F]|[-\w]/, f = {
244
+ }, ae = /[^\x00-\x7F]|[a-zA-Z_]/, wt = /[^\x00-\x7F]|[-\w]/, l = {
290
245
  Function: "function",
291
246
  Ident: "ident",
292
247
  Number: "number",
@@ -296,151 +251,151 @@ const Oe = (e, t) => {
296
251
  Hue: "hue",
297
252
  Alpha: "alpha"
298
253
  };
299
- let l = 0;
300
- function R(e) {
301
- let t = e[l], n = e[l + 1];
302
- return t === "-" || t === "+" ? /\d/.test(n) || n === "." && /\d/.test(e[l + 2]) : t === "." ? /\d/.test(n) : /\d/.test(t);
254
+ let u = 0;
255
+ function F(e) {
256
+ let t = e[u], n = e[u + 1];
257
+ return t === "-" || t === "+" ? /\d/.test(n) || n === "." && /\d/.test(e[u + 2]) : t === "." ? /\d/.test(n) : /\d/.test(t);
303
258
  }
304
- function oe(e) {
305
- if (l >= e.length)
259
+ function se(e) {
260
+ if (u >= e.length)
306
261
  return !1;
307
- let t = e[l];
262
+ let t = e[u];
308
263
  if (ae.test(t))
309
264
  return !0;
310
265
  if (t === "-") {
311
- if (e.length - l < 2)
266
+ if (e.length - u < 2)
312
267
  return !1;
313
- let n = e[l + 1];
268
+ let n = e[u + 1];
314
269
  return !!(n === "-" || ae.test(n));
315
270
  }
316
271
  return !1;
317
272
  }
318
- const kt = {
273
+ const $t = {
319
274
  deg: 1,
320
275
  rad: 180 / Math.PI,
321
276
  grad: 9 / 10,
322
277
  turn: 360
323
278
  };
324
- function C(e) {
279
+ function _(e) {
325
280
  let t = "";
326
- if ((e[l] === "-" || e[l] === "+") && (t += e[l++]), t += F(e), e[l] === "." && /\d/.test(e[l + 1]) && (t += e[l++] + F(e)), (e[l] === "e" || e[l] === "E") && ((e[l + 1] === "-" || e[l + 1] === "+") && /\d/.test(e[l + 2]) ? t += e[l++] + e[l++] + F(e) : /\d/.test(e[l + 1]) && (t += e[l++] + F(e))), oe(e)) {
327
- let n = G(e);
328
- return n === "deg" || n === "rad" || n === "turn" || n === "grad" ? { type: f.Hue, value: t * kt[n] } : void 0;
281
+ if ((e[u] === "-" || e[u] === "+") && (t += e[u++]), t += V(e), e[u] === "." && /\d/.test(e[u + 1]) && (t += e[u++] + V(e)), (e[u] === "e" || e[u] === "E") && ((e[u + 1] === "-" || e[u + 1] === "+") && /\d/.test(e[u + 2]) ? t += e[u++] + e[u++] + V(e) : /\d/.test(e[u + 1]) && (t += e[u++] + V(e))), se(e)) {
282
+ let n = B(e);
283
+ return n === "deg" || n === "rad" || n === "turn" || n === "grad" ? { type: l.Hue, value: t * $t[n] } : void 0;
329
284
  }
330
- return e[l] === "%" ? (l++, { type: f.Percentage, value: +t }) : { type: f.Number, value: +t };
285
+ return e[u] === "%" ? (u++, { type: l.Percentage, value: +t }) : { type: l.Number, value: +t };
331
286
  }
332
- function F(e) {
287
+ function V(e) {
333
288
  let t = "";
334
- for (; /\d/.test(e[l]); )
335
- t += e[l++];
289
+ for (; /\d/.test(e[u]); )
290
+ t += e[u++];
336
291
  return t;
337
292
  }
338
- function G(e) {
293
+ function B(e) {
339
294
  let t = "";
340
- for (; l < e.length && Mt.test(e[l]); )
341
- t += e[l++];
295
+ for (; u < e.length && wt.test(e[u]); )
296
+ t += e[u++];
342
297
  return t;
343
298
  }
344
- function wt(e) {
345
- let t = G(e);
346
- return e[l] === "(" ? (l++, { type: f.Function, value: t }) : t === "none" ? { type: f.None, value: void 0 } : { type: f.Ident, value: t };
299
+ function Nt(e) {
300
+ let t = B(e);
301
+ return e[u] === "(" ? (u++, { type: l.Function, value: t }) : t === "none" ? { type: l.None, value: void 0 } : { type: l.Ident, value: t };
347
302
  }
348
- function St(e = "") {
303
+ function Tt(e = "") {
349
304
  let t = e.trim(), n = [], r;
350
- for (l = 0; l < t.length; ) {
351
- if (r = t[l++], r === `
305
+ for (u = 0; u < t.length; ) {
306
+ if (r = t[u++], r === `
352
307
  ` || r === " " || r === " ") {
353
- for (; l < t.length && (t[l] === `
354
- ` || t[l] === " " || t[l] === " "); )
355
- l++;
308
+ for (; u < t.length && (t[u] === `
309
+ ` || t[u] === " " || t[u] === " "); )
310
+ u++;
356
311
  continue;
357
312
  }
358
313
  if (r === ",")
359
314
  return;
360
315
  if (r === ")") {
361
- n.push({ type: f.ParenClose });
316
+ n.push({ type: l.ParenClose });
362
317
  continue;
363
318
  }
364
319
  if (r === "+") {
365
- if (l--, R(t)) {
366
- n.push(C(t));
320
+ if (u--, F(t)) {
321
+ n.push(_(t));
367
322
  continue;
368
323
  }
369
324
  return;
370
325
  }
371
326
  if (r === "-") {
372
- if (l--, R(t)) {
373
- n.push(C(t));
327
+ if (u--, F(t)) {
328
+ n.push(_(t));
374
329
  continue;
375
330
  }
376
- if (oe(t)) {
377
- n.push({ type: f.Ident, value: G(t) });
331
+ if (se(t)) {
332
+ n.push({ type: l.Ident, value: B(t) });
378
333
  continue;
379
334
  }
380
335
  return;
381
336
  }
382
337
  if (r === ".") {
383
- if (l--, R(t)) {
384
- n.push(C(t));
338
+ if (u--, F(t)) {
339
+ n.push(_(t));
385
340
  continue;
386
341
  }
387
342
  return;
388
343
  }
389
344
  if (r === "/") {
390
- for (; l < t.length && (t[l] === `
391
- ` || t[l] === " " || t[l] === " "); )
392
- l++;
345
+ for (; u < t.length && (t[u] === `
346
+ ` || t[u] === " " || t[u] === " "); )
347
+ u++;
393
348
  let i;
394
- if (R(t) && (i = C(t), i.type !== f.Hue)) {
395
- n.push({ type: f.Alpha, value: i });
349
+ if (F(t) && (i = _(t), i.type !== l.Hue)) {
350
+ n.push({ type: l.Alpha, value: i });
396
351
  continue;
397
352
  }
398
- if (oe(t) && G(t) === "none") {
353
+ if (se(t) && B(t) === "none") {
399
354
  n.push({
400
- type: f.Alpha,
401
- value: { type: f.None, value: void 0 }
355
+ type: l.Alpha,
356
+ value: { type: l.None, value: void 0 }
402
357
  });
403
358
  continue;
404
359
  }
405
360
  return;
406
361
  }
407
362
  if (/\d/.test(r)) {
408
- l--, n.push(C(t));
363
+ u--, n.push(_(t));
409
364
  continue;
410
365
  }
411
366
  if (ae.test(r)) {
412
- l--, n.push(wt(t));
367
+ u--, n.push(Nt(t));
413
368
  continue;
414
369
  }
415
370
  return;
416
371
  }
417
372
  return n;
418
373
  }
419
- function $t(e) {
374
+ function It(e) {
420
375
  e._i = 0;
421
376
  let t = e[e._i++];
422
- if (!t || t.type !== f.Function || t.value !== "color" || (t = e[e._i++], t.type !== f.Ident))
377
+ if (!t || t.type !== l.Function || t.value !== "color" || (t = e[e._i++], t.type !== l.Ident))
423
378
  return;
424
- const n = Pe[t.value];
379
+ const n = Ae[t.value];
425
380
  if (!n)
426
381
  return;
427
- const r = { mode: n }, i = Ce(e, !1);
382
+ const r = { mode: n }, i = He(e, !1);
428
383
  if (!i)
429
384
  return;
430
385
  const a = X(n).channels;
431
- for (let o = 0, s, u; o < a.length; o++)
432
- s = i[o], u = a[o], s.type !== f.None && (r[u] = s.type === f.Number ? s.value : s.value / 100, u === "alpha" && (r[u] = Math.max(0, Math.min(1, r[u]))));
386
+ for (let o = 0, s, f; o < a.length; o++)
387
+ s = i[o], f = a[o], s.type !== l.None && (r[f] = s.type === l.Number ? s.value : s.value / 100, f === "alpha" && (r[f] = Math.max(0, Math.min(1, r[f]))));
433
388
  return r;
434
389
  }
435
- function Ce(e, t) {
390
+ function He(e, t) {
436
391
  const n = [];
437
392
  let r;
438
393
  for (; e._i < e.length; ) {
439
- if (r = e[e._i++], r.type === f.None || r.type === f.Number || r.type === f.Alpha || r.type === f.Percentage || t && r.type === f.Hue) {
394
+ if (r = e[e._i++], r.type === l.None || r.type === l.Number || r.type === l.Alpha || r.type === l.Percentage || t && r.type === l.Hue) {
440
395
  n.push(r);
441
396
  continue;
442
397
  }
443
- if (r.type === f.ParenClose) {
398
+ if (r.type === l.ParenClose) {
444
399
  if (e._i < e.length)
445
400
  return;
446
401
  continue;
@@ -449,70 +404,70 @@ function Ce(e, t) {
449
404
  }
450
405
  if (!(n.length < 3 || n.length > 4)) {
451
406
  if (n.length === 4) {
452
- if (n[3].type !== f.Alpha)
407
+ if (n[3].type !== l.Alpha)
453
408
  return;
454
409
  n[3] = n[3].value;
455
410
  }
456
- return n.length === 3 && n.push({ type: f.None, value: void 0 }), n.every((i) => i.type !== f.Alpha) ? n : void 0;
411
+ return n.length === 3 && n.push({ type: l.None, value: void 0 }), n.every((i) => i.type !== l.Alpha) ? n : void 0;
457
412
  }
458
413
  }
459
- function Tt(e, t) {
414
+ function Ot(e, t) {
460
415
  e._i = 0;
461
416
  let n = e[e._i++];
462
- if (!n || n.type !== f.Function)
417
+ if (!n || n.type !== l.Function)
463
418
  return;
464
- let r = Ce(e, t);
419
+ let r = He(e, t);
465
420
  if (r)
466
421
  return r.unshift(n.value), r;
467
422
  }
468
- const Ae = (e) => {
423
+ const Ee = (e) => {
469
424
  if (typeof e != "string")
470
425
  return;
471
- const t = St(e), n = t ? Tt(t, !0) : void 0;
426
+ const t = Tt(e), n = t ? Ot(t, !0) : void 0;
472
427
  let r, i = 0, a = K.length;
473
428
  for (; i < a; )
474
429
  if ((r = K[i++](e, n)) !== void 0)
475
430
  return r;
476
- return t ? $t(t) : void 0;
431
+ return t ? It(t) : void 0;
477
432
  };
478
- function Nt(e, t) {
433
+ function Pt(e, t) {
479
434
  if (!t || t[0] !== "rgb" && t[0] !== "rgba")
480
435
  return;
481
436
  const n = { mode: "rgb" }, [, r, i, a, o] = t;
482
- if (!(r.type === f.Hue || i.type === f.Hue || a.type === f.Hue))
483
- return r.type !== f.None && (n.r = r.type === f.Number ? r.value / 255 : r.value / 100), i.type !== f.None && (n.g = i.type === f.Number ? i.value / 255 : i.value / 100), a.type !== f.None && (n.b = a.type === f.Number ? a.value / 255 : a.value / 100), o.type !== f.None && (n.alpha = Math.min(
437
+ if (!(r.type === l.Hue || i.type === l.Hue || a.type === l.Hue))
438
+ return r.type !== l.None && (n.r = r.type === l.Number ? r.value / 255 : r.value / 100), i.type !== l.None && (n.g = i.type === l.Number ? i.value / 255 : i.value / 100), a.type !== l.None && (n.b = a.type === l.Number ? a.value / 255 : a.value / 100), o.type !== l.None && (n.alpha = Math.min(
484
439
  1,
485
440
  Math.max(
486
441
  0,
487
- o.type === f.Number ? o.value : o.value / 100
442
+ o.type === l.Number ? o.value : o.value / 100
488
443
  )
489
444
  )), n;
490
445
  }
491
- const It = (e) => e === "transparent" ? { mode: "rgb", r: 0, g: 0, b: 0, alpha: 0 } : void 0, Ot = (e, t, n) => e + n * (t - e), _t = (e) => {
446
+ const Ct = (e) => e === "transparent" ? { mode: "rgb", r: 0, g: 0, b: 0, alpha: 0 } : void 0, _t = (e, t, n) => e + n * (t - e), At = (e) => {
492
447
  let t = [];
493
448
  for (let n = 0; n < e.length - 1; n++) {
494
449
  let r = e[n], i = e[n + 1];
495
450
  r === void 0 && i === void 0 ? t.push(void 0) : r !== void 0 && i !== void 0 ? t.push([r, i]) : t.push(r !== void 0 ? [r, r] : [i, i]);
496
451
  }
497
452
  return t;
498
- }, Pt = (e) => (t) => {
499
- let n = _t(t);
453
+ }, Ht = (e) => (t) => {
454
+ let n = At(t);
500
455
  return (r) => {
501
456
  let i = r * n.length, a = r >= 1 ? n.length - 1 : Math.max(Math.floor(i), 0), o = n[a];
502
457
  return o === void 0 ? void 0 : e(o[0], o[1], i - a);
503
458
  };
504
- }, b = Pt(Ot), de = (e) => {
459
+ }, b = Ht(_t), me = (e) => {
505
460
  let t = !1, n = e.map((r) => r !== void 0 ? (t = !0, r) : 1);
506
461
  return t ? n : e;
507
- }, Ct = {
462
+ }, Et = {
508
463
  mode: "rgb",
509
464
  channels: ["r", "g", "b", "alpha"],
510
465
  parse: [
511
- Nt,
512
- pt,
513
- yt,
514
- dt,
515
- It,
466
+ Pt,
467
+ bt,
468
+ vt,
469
+ gt,
470
+ Ct,
516
471
  "srgb"
517
472
  ],
518
473
  serialize: "srgb",
@@ -520,49 +475,49 @@ const It = (e) => e === "transparent" ? { mode: "rgb", r: 0, g: 0, b: 0, alpha:
520
475
  r: b,
521
476
  g: b,
522
477
  b,
523
- alpha: { use: b, fixup: de }
478
+ alpha: { use: b, fixup: me }
524
479
  },
525
480
  gamut: !0,
526
481
  white: { r: 1, g: 1, b: 1 },
527
482
  black: { r: 0, g: 0, b: 0 }
528
- }, Z = (e = 0) => {
483
+ }, U = (e = 0) => {
529
484
  const t = Math.abs(e);
530
485
  return t <= 0.04045 ? e / 12.92 : (Math.sign(e) || 1) * Math.pow((t + 0.055) / 1.055, 2.4);
531
- }, He = ({ r: e, g: t, b: n, alpha: r }) => {
486
+ }, Re = ({ r: e, g: t, b: n, alpha: r }) => {
532
487
  let i = {
533
488
  mode: "lrgb",
534
- r: Z(e),
535
- g: Z(t),
536
- b: Z(n)
489
+ r: U(e),
490
+ g: U(t),
491
+ b: U(n)
537
492
  };
538
493
  return r !== void 0 && (i.alpha = r), i;
539
- }, U = (e = 0) => {
494
+ }, Q = (e = 0) => {
540
495
  const t = Math.abs(e);
541
496
  return t > 31308e-7 ? (Math.sign(e) || 1) * (1.055 * Math.pow(t, 1 / 2.4) - 0.055) : e * 12.92;
542
- }, Ee = ({ r: e, g: t, b: n, alpha: r }, i = "rgb") => {
497
+ }, Fe = ({ r: e, g: t, b: n, alpha: r }, i = "rgb") => {
543
498
  let a = {
544
499
  mode: i,
545
- r: U(e),
546
- g: U(t),
547
- b: U(n)
500
+ r: Q(e),
501
+ g: Q(t),
502
+ b: Q(n)
548
503
  };
549
504
  return r !== void 0 && (a.alpha = r), a;
550
- }, S = (e) => (e = e % 360) < 0 ? e + 360 : e, At = (e, t) => e.map((n, r, i) => {
505
+ }, w = (e) => (e = e % 360) < 0 ? e + 360 : e, Rt = (e, t) => e.map((n, r, i) => {
551
506
  if (n === void 0)
552
507
  return n;
553
- let a = S(n);
554
- return r === 0 || e[r - 1] === void 0 ? a : t(a - S(i[r - 1]));
555
- }).reduce((n, r) => !n.length || r === void 0 || n[n.length - 1] === void 0 ? (n.push(r), n) : (n.push(r + n[n.length - 1]), n), []), Ve = (e) => At(e, (t) => Math.abs(t) <= 180 ? t : t - 360 * Math.sign(t)), Ht = (e, t) => {
508
+ let a = w(n);
509
+ return r === 0 || e[r - 1] === void 0 ? a : t(a - w(i[r - 1]));
510
+ }).reduce((n, r) => !n.length || r === void 0 || n[n.length - 1] === void 0 ? (n.push(r), n) : (n.push(r + n[n.length - 1]), n), []), Ve = (e) => Rt(e, (t) => Math.abs(t) <= 180 ? t : t - 360 * Math.sign(t)), Ft = (e, t) => {
556
511
  if (e.h === void 0 || t.h === void 0 || !e.s || !t.s)
557
512
  return 0;
558
- let n = S(e.h), r = S(t.h), i = Math.sin((r - n + 360) / 2 * Math.PI / 180);
513
+ let n = w(e.h), r = w(t.h), i = Math.sin((r - n + 360) / 2 * Math.PI / 180);
559
514
  return 2 * Math.sqrt(e.s * t.s) * i;
560
- }, Et = (e, t) => {
515
+ }, Vt = (e, t) => {
561
516
  if (e.h === void 0 || t.h === void 0 || !e.c || !t.c)
562
517
  return 0;
563
- let n = S(e.h), r = S(t.h), i = Math.sin((r - n + 360) / 2 * Math.PI / 180);
518
+ let n = w(e.h), r = w(t.h), i = Math.sin((r - n + 360) / 2 * Math.PI / 180);
564
519
  return 2 * Math.sqrt(e.c * t.c) * i;
565
- }, Re = (e) => {
520
+ }, De = (e) => {
566
521
  let t = e.reduce(
567
522
  (r, i) => {
568
523
  if (i !== void 0) {
@@ -574,11 +529,11 @@ const It = (e) => e === "transparent" ? { mode: "rgb", r: 0, g: 0, b: 0, alpha:
574
529
  { sin: 0, cos: 0 }
575
530
  ), n = Math.atan2(t.sin, t.cos) * 180 / Math.PI;
576
531
  return n < 0 ? 360 + n : n;
577
- }, q = ({ l: e, a: t, b: n, alpha: r }, i = "lch") => {
532
+ }, G = ({ l: e, a: t, b: n, alpha: r }, i = "lch") => {
578
533
  t === void 0 && (t = 0), n === void 0 && (n = 0);
579
534
  let a = Math.sqrt(t * t + n * n), o = { mode: i, l: e, c: a };
580
- return a && (o.h = S(Math.atan2(n, t) * 180 / Math.PI)), r !== void 0 && (o.alpha = r), o;
581
- }, J = ({ l: e, c: t, h: n, alpha: r }, i = "lab") => {
535
+ return a && (o.h = w(Math.atan2(n, t) * 180 / Math.PI)), r !== void 0 && (o.alpha = r), o;
536
+ }, q = ({ l: e, c: t, h: n, alpha: r }, i = "lab") => {
582
537
  n === void 0 && (n = 0);
583
538
  let a = {
584
539
  mode: i,
@@ -592,8 +547,8 @@ const It = (e) => e === "transparent" ? { mode: "rgb", r: 0, g: 0, b: 0, alpha:
592
547
  Y: 1,
593
548
  Z: (1 - 0.3457 - 0.3585) / 0.3585
594
549
  };
595
- function Vt({ h: e, s: t, l: n, alpha: r }) {
596
- e = S(e !== void 0 ? e : 0), t === void 0 && (t = 0), n === void 0 && (n = 0);
550
+ function Dt({ h: e, s: t, l: n, alpha: r }) {
551
+ e = w(e !== void 0 ? e : 0), t === void 0 && (t = 0), n === void 0 && (n = 0);
597
552
  let i = n + t * (n < 0.5 ? n : 1 - n), a = i - (i - n) * 2 * Math.abs(e / 60 % 2 - 1), o;
598
553
  switch (Math.floor(e / 60)) {
599
554
  case 0:
@@ -619,7 +574,7 @@ function Vt({ h: e, s: t, l: n, alpha: r }) {
619
574
  }
620
575
  return o.mode = "rgb", r !== void 0 && (o.alpha = r), o;
621
576
  }
622
- function Rt({ r: e, g: t, b: n, alpha: r }) {
577
+ function Lt({ r: e, g: t, b: n, alpha: r }) {
623
578
  e === void 0 && (e = 0), t === void 0 && (t = 0), n === void 0 && (n = 0);
624
579
  let i = Math.max(e, t, n), a = Math.min(e, t, n), o = {
625
580
  mode: "hsl",
@@ -628,7 +583,7 @@ function Rt({ r: e, g: t, b: n, alpha: r }) {
628
583
  };
629
584
  return i - a !== 0 && (o.h = (i === e ? (t - n) / (i - a) + (t < n) * 6 : i === t ? (n - e) / (i - a) + 2 : (e - t) / (i - a) + 4) * 60), r !== void 0 && (o.alpha = r), o;
630
585
  }
631
- const Ft = (e, t) => {
586
+ const zt = (e, t) => {
632
587
  switch (t) {
633
588
  case "deg":
634
589
  return +e;
@@ -639,142 +594,142 @@ const Ft = (e, t) => {
639
594
  case "turn":
640
595
  return e * 360;
641
596
  }
642
- }, zt = new RegExp(
643
- `^hsla?\\(\\s*${gt}${O}${A}${O}${A}\\s*(?:,\\s*${le}\\s*)?\\)$`
644
- ), Dt = (e) => {
645
- let t = e.match(zt);
597
+ }, jt = new RegExp(
598
+ `^hsla?\\(\\s*${yt}${O}${H}${O}${H}\\s*(?:,\\s*${pe}\\s*)?\\)$`
599
+ ), Kt = (e) => {
600
+ let t = e.match(jt);
646
601
  if (!t) return;
647
602
  let n = { mode: "hsl" };
648
- return t[3] !== void 0 ? n.h = +t[3] : t[1] !== void 0 && t[2] !== void 0 && (n.h = Ft(t[1], t[2])), t[4] !== void 0 && (n.s = Math.min(Math.max(0, t[4] / 100), 1)), t[5] !== void 0 && (n.l = Math.min(Math.max(0, t[5] / 100), 1)), t[6] !== void 0 ? n.alpha = Math.max(0, Math.min(1, t[6] / 100)) : t[7] !== void 0 && (n.alpha = Math.max(0, Math.min(1, +t[7]))), n;
603
+ return t[3] !== void 0 ? n.h = +t[3] : t[1] !== void 0 && t[2] !== void 0 && (n.h = zt(t[1], t[2])), t[4] !== void 0 && (n.s = Math.min(Math.max(0, t[4] / 100), 1)), t[5] !== void 0 && (n.l = Math.min(Math.max(0, t[5] / 100), 1)), t[6] !== void 0 ? n.alpha = Math.max(0, Math.min(1, t[6] / 100)) : t[7] !== void 0 && (n.alpha = Math.max(0, Math.min(1, +t[7]))), n;
649
604
  };
650
- function Lt(e, t) {
605
+ function Bt(e, t) {
651
606
  if (!t || t[0] !== "hsl" && t[0] !== "hsla")
652
607
  return;
653
608
  const n = { mode: "hsl" }, [, r, i, a, o] = t;
654
- if (r.type !== f.None) {
655
- if (r.type === f.Percentage)
609
+ if (r.type !== l.None) {
610
+ if (r.type === l.Percentage)
656
611
  return;
657
612
  n.h = r.value;
658
613
  }
659
- if (i.type !== f.None) {
660
- if (i.type === f.Hue)
614
+ if (i.type !== l.None) {
615
+ if (i.type === l.Hue)
661
616
  return;
662
617
  n.s = i.value / 100;
663
618
  }
664
- if (a.type !== f.None) {
665
- if (a.type === f.Hue)
619
+ if (a.type !== l.None) {
620
+ if (a.type === l.Hue)
666
621
  return;
667
622
  n.l = a.value / 100;
668
623
  }
669
- return o.type !== f.None && (n.alpha = Math.min(
624
+ return o.type !== l.None && (n.alpha = Math.min(
670
625
  1,
671
626
  Math.max(
672
627
  0,
673
- o.type === f.Number ? o.value : o.value / 100
628
+ o.type === l.Number ? o.value : o.value / 100
674
629
  )
675
630
  )), n;
676
631
  }
677
- const jt = {
632
+ const Gt = {
678
633
  mode: "hsl",
679
634
  toMode: {
680
- rgb: Vt
635
+ rgb: Dt
681
636
  },
682
637
  fromMode: {
683
- rgb: Rt
638
+ rgb: Lt
684
639
  },
685
640
  channels: ["h", "s", "l", "alpha"],
686
641
  ranges: {
687
642
  h: [0, 360]
688
643
  },
689
644
  gamut: "rgb",
690
- parse: [Lt, Dt],
645
+ parse: [Bt, Kt],
691
646
  serialize: (e) => `hsl(${e.h !== void 0 ? e.h : "none"} ${e.s !== void 0 ? e.s * 100 + "%" : "none"} ${e.l !== void 0 ? e.l * 100 + "%" : "none"}${e.alpha < 1 ? ` / ${e.alpha}` : ""})`,
692
647
  interpolate: {
693
648
  h: { use: b, fixup: Ve },
694
649
  s: b,
695
650
  l: b,
696
- alpha: { use: b, fixup: de }
651
+ alpha: { use: b, fixup: me }
697
652
  },
698
653
  difference: {
699
- h: Ht
654
+ h: Ft
700
655
  },
701
656
  average: {
702
- h: Re
657
+ h: De
703
658
  }
704
- }, Fe = Math.pow(29, 3) / Math.pow(3, 3), ze = Math.pow(6, 3) / Math.pow(29, 3);
705
- let Q = (e) => Math.pow(e, 3) > ze ? Math.pow(e, 3) : (116 * e - 16) / Fe;
706
- const Bt = ({ l: e, a: t, b: n, alpha: r }) => {
659
+ }, Le = Math.pow(29, 3) / Math.pow(3, 3), ze = Math.pow(6, 3) / Math.pow(29, 3);
660
+ let ee = (e) => Math.pow(e, 3) > ze ? Math.pow(e, 3) : (116 * e - 16) / Le;
661
+ const qt = ({ l: e, a: t, b: n, alpha: r }) => {
707
662
  e === void 0 && (e = 0), t === void 0 && (t = 0), n === void 0 && (n = 0);
708
663
  let i = (e + 16) / 116, a = t / 500 + i, o = i - n / 200, s = {
709
664
  mode: "xyz50",
710
- x: Q(a) * I.X,
711
- y: Q(i) * I.Y,
712
- z: Q(o) * I.Z
665
+ x: ee(a) * I.X,
666
+ y: ee(i) * I.Y,
667
+ z: ee(o) * I.Z
713
668
  };
714
669
  return r !== void 0 && (s.alpha = r), s;
715
- }, Kt = ({ x: e, y: t, z: n, alpha: r }) => {
670
+ }, Jt = ({ x: e, y: t, z: n, alpha: r }) => {
716
671
  e === void 0 && (e = 0), t === void 0 && (t = 0), n === void 0 && (n = 0);
717
- let i = Ee({
672
+ let i = Fe({
718
673
  r: e * 3.1341359569958707 - t * 1.6173863321612538 - 0.4906619460083532 * n,
719
674
  g: e * -0.978795502912089 + t * 1.916254567259524 + 0.03344273116131949 * n,
720
675
  b: e * 0.07195537988411677 - t * 0.2289768264158322 + 1.405386058324125 * n
721
676
  });
722
677
  return r !== void 0 && (i.alpha = r), i;
723
- }, Gt = (e) => Kt(Bt(e)), qt = (e) => {
724
- let { r: t, g: n, b: r, alpha: i } = He(e), a = {
678
+ }, Wt = (e) => Jt(qt(e)), Xt = (e) => {
679
+ let { r: t, g: n, b: r, alpha: i } = Re(e), a = {
725
680
  mode: "xyz50",
726
681
  x: 0.436065742824811 * t + 0.3851514688337912 * n + 0.14307845442264197 * r,
727
682
  y: 0.22249319175623702 * t + 0.7168870538238823 * n + 0.06061979053616537 * r,
728
683
  z: 0.013923904500943465 * t + 0.09708128566574634 * n + 0.7140993584005155 * r
729
684
  };
730
685
  return i !== void 0 && (a.alpha = i), a;
731
- }, ee = (e) => e > ze ? Math.cbrt(e) : (Fe * e + 16) / 116, Jt = ({ x: e, y: t, z: n, alpha: r }) => {
686
+ }, te = (e) => e > ze ? Math.cbrt(e) : (Le * e + 16) / 116, Yt = ({ x: e, y: t, z: n, alpha: r }) => {
732
687
  e === void 0 && (e = 0), t === void 0 && (t = 0), n === void 0 && (n = 0);
733
- let i = ee(e / I.X), a = ee(t / I.Y), o = ee(n / I.Z), s = {
688
+ let i = te(e / I.X), a = te(t / I.Y), o = te(n / I.Z), s = {
734
689
  mode: "lab",
735
690
  l: 116 * a - 16,
736
691
  a: 500 * (i - a),
737
692
  b: 200 * (a - o)
738
693
  };
739
694
  return r !== void 0 && (s.alpha = r), s;
740
- }, Wt = (e) => {
741
- let t = Jt(qt(e));
695
+ }, Zt = (e) => {
696
+ let t = Yt(Xt(e));
742
697
  return e.r === e.b && e.b === e.g && (t.a = t.b = 0), t;
743
698
  };
744
- function Xt(e, t) {
699
+ function Ut(e, t) {
745
700
  if (!t || t[0] !== "lch")
746
701
  return;
747
702
  const n = { mode: "lch" }, [, r, i, a, o] = t;
748
- if (r.type !== f.None) {
749
- if (r.type === f.Hue)
703
+ if (r.type !== l.None) {
704
+ if (r.type === l.Hue)
750
705
  return;
751
706
  n.l = Math.min(Math.max(0, r.value), 100);
752
707
  }
753
- if (i.type !== f.None && (n.c = Math.max(
708
+ if (i.type !== l.None && (n.c = Math.max(
754
709
  0,
755
- i.type === f.Number ? i.value : i.value * 150 / 100
756
- )), a.type !== f.None) {
757
- if (a.type === f.Percentage)
710
+ i.type === l.Number ? i.value : i.value * 150 / 100
711
+ )), a.type !== l.None) {
712
+ if (a.type === l.Percentage)
758
713
  return;
759
714
  n.h = a.value;
760
715
  }
761
- return o.type !== f.None && (n.alpha = Math.min(
716
+ return o.type !== l.None && (n.alpha = Math.min(
762
717
  1,
763
718
  Math.max(
764
719
  0,
765
- o.type === f.Number ? o.value : o.value / 100
720
+ o.type === l.Number ? o.value : o.value / 100
766
721
  )
767
722
  )), n;
768
723
  }
769
- const Yt = {
724
+ const Qt = {
770
725
  mode: "lch",
771
726
  toMode: {
772
- lab: J,
773
- rgb: (e) => Gt(J(e))
727
+ lab: q,
728
+ rgb: (e) => Wt(q(e))
774
729
  },
775
730
  fromMode: {
776
- rgb: (e) => q(Wt(e)),
777
- lab: q
731
+ rgb: (e) => G(Zt(e)),
732
+ lab: G
778
733
  },
779
734
  channels: ["l", "c", "h", "alpha"],
780
735
  ranges: {
@@ -782,21 +737,21 @@ const Yt = {
782
737
  c: [0, 150],
783
738
  h: [0, 360]
784
739
  },
785
- parse: [Xt],
740
+ parse: [Ut],
786
741
  serialize: (e) => `lch(${e.l !== void 0 ? e.l : "none"} ${e.c !== void 0 ? e.c : "none"} ${e.h !== void 0 ? e.h : "none"}${e.alpha < 1 ? ` / ${e.alpha}` : ""})`,
787
742
  interpolate: {
788
743
  h: { use: b, fixup: Ve },
789
744
  c: b,
790
745
  l: b,
791
- alpha: { use: b, fixup: de }
746
+ alpha: { use: b, fixup: me }
792
747
  },
793
748
  difference: {
794
- h: Et
749
+ h: Vt
795
750
  },
796
751
  average: {
797
- h: Re
752
+ h: De
798
753
  }
799
- }, Zt = ({ r: e, g: t, b: n, alpha: r }) => {
754
+ }, en = ({ r: e, g: t, b: n, alpha: r }) => {
800
755
  e === void 0 && (e = 0), t === void 0 && (t = 0), n === void 0 && (n = 0);
801
756
  let i = Math.cbrt(
802
757
  0.412221469470763 * e + 0.5363325372617348 * t + 0.0514459932675022 * n
@@ -811,10 +766,10 @@ const Yt = {
811
766
  b: 0.0259040424655478 * i + 0.7827717124575296 * a - 0.8086757549230774 * o
812
767
  };
813
768
  return r !== void 0 && (s.alpha = r), s;
814
- }, Ut = (e) => {
815
- let t = Zt(He(e));
769
+ }, tn = (e) => {
770
+ let t = en(Re(e));
816
771
  return e.r === e.b && e.b === e.g && (t.a = t.b = 0), t;
817
- }, Qt = ({ l: e, a: t, b: n, alpha: r }) => {
772
+ }, nn = ({ l: e, a: t, b: n, alpha: r }) => {
818
773
  e === void 0 && (e = 0), t === void 0 && (t = 0), n === void 0 && (n = 0);
819
774
  let i = Math.pow(e + 0.3963377773761749 * t + 0.2158037573099136 * n, 3), a = Math.pow(e - 0.1055613458156586 * t - 0.0638541728258133 * n, 3), o = Math.pow(e - 0.0894841775298119 * t - 1.2914855480194092 * n, 3), s = {
820
775
  mode: "lrgb",
@@ -823,64 +778,64 @@ const Yt = {
823
778
  b: -0.0041960761386756 * i - 0.7034186179359362 * a + 1.7076146940746117 * o
824
779
  };
825
780
  return r !== void 0 && (s.alpha = r), s;
826
- }, en = (e) => Ee(Qt(e));
827
- function tn(e, t) {
781
+ }, rn = (e) => Fe(nn(e));
782
+ function on(e, t) {
828
783
  if (!t || t[0] !== "oklch")
829
784
  return;
830
785
  const n = { mode: "oklch" }, [, r, i, a, o] = t;
831
- if (r.type !== f.None) {
832
- if (r.type === f.Hue)
786
+ if (r.type !== l.None) {
787
+ if (r.type === l.Hue)
833
788
  return;
834
789
  n.l = Math.min(
835
- Math.max(0, r.type === f.Number ? r.value : r.value / 100),
790
+ Math.max(0, r.type === l.Number ? r.value : r.value / 100),
836
791
  1
837
792
  );
838
793
  }
839
- if (i.type !== f.None && (n.c = Math.max(
794
+ if (i.type !== l.None && (n.c = Math.max(
840
795
  0,
841
- i.type === f.Number ? i.value : i.value * 0.4 / 100
842
- )), a.type !== f.None) {
843
- if (a.type === f.Percentage)
796
+ i.type === l.Number ? i.value : i.value * 0.4 / 100
797
+ )), a.type !== l.None) {
798
+ if (a.type === l.Percentage)
844
799
  return;
845
800
  n.h = a.value;
846
801
  }
847
- return o.type !== f.None && (n.alpha = Math.min(
802
+ return o.type !== l.None && (n.alpha = Math.min(
848
803
  1,
849
804
  Math.max(
850
805
  0,
851
- o.type === f.Number ? o.value : o.value / 100
806
+ o.type === l.Number ? o.value : o.value / 100
852
807
  )
853
808
  )), n;
854
809
  }
855
- const nn = {
856
- ...Yt,
810
+ const an = {
811
+ ...Qt,
857
812
  mode: "oklch",
858
813
  toMode: {
859
- oklab: (e) => J(e, "oklab"),
860
- rgb: (e) => en(J(e, "oklab"))
814
+ oklab: (e) => q(e, "oklab"),
815
+ rgb: (e) => rn(q(e, "oklab"))
861
816
  },
862
817
  fromMode: {
863
- rgb: (e) => q(Ut(e), "oklch"),
864
- oklab: (e) => q(e, "oklch")
818
+ rgb: (e) => G(tn(e), "oklch"),
819
+ oklab: (e) => G(e, "oklch")
865
820
  },
866
- parse: [tn],
821
+ parse: [on],
867
822
  serialize: (e) => `oklch(${e.l !== void 0 ? e.l : "none"} ${e.c !== void 0 ? e.c : "none"} ${e.h !== void 0 ? e.h : "none"}${e.alpha < 1 ? ` / ${e.alpha}` : ""})`,
868
823
  ranges: {
869
824
  l: [0, 1],
870
825
  c: [0, 0.4],
871
826
  h: [0, 360]
872
827
  }
873
- }, rn = (e) => Math.max(0, Math.min(1, e || 0)), D = (e) => Math.round(rn(e) * 255), De = y("rgb"), Le = (e) => {
828
+ }, sn = (e) => Math.max(0, Math.min(1, e || 0)), L = (e) => Math.round(sn(e) * 255), je = x("rgb"), Ke = (e) => {
874
829
  if (e === void 0)
875
830
  return;
876
- let t = D(e.r), n = D(e.g), r = D(e.b);
831
+ let t = L(e.r), n = L(e.g), r = L(e.b);
877
832
  return "#" + (1 << 24 | t << 16 | n << 8 | r).toString(16).slice(1);
878
- }, an = (e) => {
833
+ }, fn = (e) => {
879
834
  if (e === void 0)
880
835
  return;
881
- let t = D(e.alpha !== void 0 ? e.alpha : 1);
882
- return Le(e) + (256 | t).toString(16).slice(1);
883
- }, on = (e) => Le(De(e)), sn = (e) => an(De(e)), je = y("rgb"), Be = (e) => {
836
+ let t = L(e.alpha !== void 0 ? e.alpha : 1);
837
+ return Ke(e) + (256 | t).toString(16).slice(1);
838
+ }, ln = (e) => Ke(je(e)), un = (e) => fn(je(e)), Be = x("rgb"), Ge = (e) => {
884
839
  const t = {
885
840
  mode: e.mode,
886
841
  r: Math.max(0, Math.min(e.r !== void 0 ? e.r : 0, 1)),
@@ -888,53 +843,53 @@ const nn = {
888
843
  b: Math.max(0, Math.min(e.b !== void 0 ? e.b : 0, 1))
889
844
  };
890
845
  return e.alpha !== void 0 && (t.alpha = e.alpha), t;
891
- }, fn = (e) => Be(je(e)), Ke = (e) => e !== void 0 && (e.r === void 0 || e.r >= 0 && e.r <= 1) && (e.g === void 0 || e.g >= 0 && e.g <= 1) && (e.b === void 0 || e.b >= 0 && e.b <= 1);
892
- function un(e) {
893
- return Ke(je(e));
846
+ }, cn = (e) => Ge(Be(e)), qe = (e) => e !== void 0 && (e.r === void 0 || e.r >= 0 && e.r <= 1) && (e.g === void 0 || e.g >= 0 && e.g <= 1) && (e.b === void 0 || e.b >= 0 && e.b <= 1);
847
+ function dn(e) {
848
+ return qe(Be(e));
894
849
  }
895
- function he(e = "rgb") {
850
+ function be(e = "rgb") {
896
851
  const { gamut: t } = X(e);
897
852
  if (!t)
898
853
  return (r) => !0;
899
- const n = y(typeof t == "string" ? t : e);
900
- return (r) => Ke(n(r));
854
+ const n = x(typeof t == "string" ? t : e);
855
+ return (r) => qe(n(r));
901
856
  }
902
- function ln(e = "rgb") {
857
+ function hn(e = "rgb") {
903
858
  const { gamut: t } = X(e);
904
859
  if (!t)
905
- return (a) => B(a);
906
- const n = typeof t == "string" ? t : e, r = y(n), i = he(n);
860
+ return (a) => j(a);
861
+ const n = typeof t == "string" ? t : e, r = x(n), i = be(n);
907
862
  return (a) => {
908
- const o = B(a);
863
+ const o = j(a);
909
864
  if (!o)
910
865
  return;
911
866
  const s = r(o);
912
867
  if (i(s))
913
868
  return o;
914
- const u = Be(s);
915
- return o.mode === u.mode ? u : y(o.mode)(u);
869
+ const f = Ge(s);
870
+ return o.mode === f.mode ? f : x(o.mode)(f);
916
871
  };
917
872
  }
918
- function cn(e, t = "lch", n = "rgb") {
919
- e = B(e);
920
- let r = n === "rgb" ? un : he(n), i = n === "rgb" ? fn : ln(n);
873
+ function pn(e, t = "lch", n = "rgb") {
874
+ e = j(e);
875
+ let r = n === "rgb" ? dn : be(n), i = n === "rgb" ? cn : hn(n);
921
876
  if (e === void 0 || r(e)) return e;
922
- let a = y(e.mode);
923
- e = y(t)(e);
877
+ let a = x(e.mode);
878
+ e = x(t)(e);
924
879
  let o = { ...e, c: 0 };
925
880
  if (!r(o))
926
881
  return a(i(o));
927
- let s = 0, u = e.c !== void 0 ? e.c : 0, c = X(t).ranges.c, d = (c[1] - c[0]) / Math.pow(2, 13), h = o.c;
928
- for (; u - s > d; )
929
- o.c = s + (u - s) * 0.5, r(o) ? (h = o.c, s = o.c) : u = o.c;
882
+ let s = 0, f = e.c !== void 0 ? e.c : 0, c = X(t).ranges.c, d = (c[1] - c[0]) / Math.pow(2, 13), h = o.c;
883
+ for (; f - s > d; )
884
+ o.c = s + (f - s) * 0.5, r(o) ? (h = o.c, s = o.c) : f = o.c;
930
885
  return a(
931
886
  r(o) ? o : { ...o, c: h }
932
887
  );
933
888
  }
934
- ce(nn);
935
- ce(Ct);
936
- ce(jt);
937
- const Rn = 0.37, Ge = y("oklch"), qe = y("rgb"), dn = y("hsl"), hn = he("rgb");
889
+ ge(an);
890
+ ge(Et);
891
+ ge(Gt);
892
+ const qn = 0.37, Je = x("oklch"), We = x("rgb"), gn = x("hsl"), mn = be("rgb");
938
893
  function Y(e) {
939
894
  return {
940
895
  mode: "oklch",
@@ -944,7 +899,7 @@ function Y(e) {
944
899
  alpha: e.a / 100
945
900
  };
946
901
  }
947
- function pn(e) {
902
+ function bn(e) {
948
903
  return {
949
904
  l: (e.l ?? 0) * 100,
950
905
  c: e.c ?? 0,
@@ -952,19 +907,19 @@ function pn(e) {
952
907
  a: (e.alpha ?? 1) * 100
953
908
  };
954
909
  }
955
- function Fn(e) {
910
+ function Jn(e) {
956
911
  const t = (e.l / 100).toFixed(4), n = e.c.toFixed(4), r = e.h.toFixed(2);
957
912
  if (e.a >= 100)
958
913
  return `oklch(${t} ${n} ${r})`;
959
914
  const i = (e.a / 100).toFixed(4);
960
915
  return `oklch(${t} ${n} ${r} / ${i})`;
961
916
  }
962
- function zn(e) {
917
+ function Wn(e) {
963
918
  const t = { l: 0, c: 0, h: 0, a: 100 };
964
919
  try {
965
- const n = Ae(e);
920
+ const n = Ee(e);
966
921
  if (!n) return t;
967
- const r = Ge(n);
922
+ const r = Je(n);
968
923
  if (!r) return t;
969
924
  const i = r.alpha === void 0 ? 1 : r.alpha;
970
925
  return {
@@ -977,12 +932,12 @@ function zn(e) {
977
932
  return t;
978
933
  }
979
934
  }
980
- function Dn(e, t) {
981
- const n = Y(e), r = qe(n);
982
- return r ? e.a < 100 ? sn({ ...r, alpha: e.a / 100 }) ?? "#000000ff" : on(r) ?? "#000000" : "#000000";
935
+ function Xn(e, t) {
936
+ const n = Y(e), r = We(n);
937
+ return r ? e.a < 100 ? un({ ...r, alpha: e.a / 100 }) ?? "#000000ff" : ln(r) ?? "#000000" : "#000000";
983
938
  }
984
- function Ln(e) {
985
- const t = Y(e), n = dn(t);
939
+ function Yn(e) {
940
+ const t = Y(e), n = gn(t);
986
941
  return n ? {
987
942
  h: n.h ?? 0,
988
943
  s: (n.s ?? 0) * 100,
@@ -990,18 +945,18 @@ function Ln(e) {
990
945
  a: e.a
991
946
  } : { h: 0, s: 0, l: 0, a: e.a };
992
947
  }
993
- function jn(e) {
948
+ function Zn(e) {
994
949
  const t = {
995
950
  mode: "hsl",
996
951
  h: e.h,
997
952
  s: e.s / 100,
998
953
  l: e.l / 100,
999
954
  alpha: e.a / 100
1000
- }, n = Ge(t);
1001
- return n ? pn(n) : { l: 0, c: 0, h: 0, a: e.a };
955
+ }, n = Je(t);
956
+ return n ? bn(n) : { l: 0, c: 0, h: 0, a: e.a };
1002
957
  }
1003
- function Bn(e) {
1004
- const t = Y(e), n = cn(t, "oklch", "rgb");
958
+ function Un(e) {
959
+ const t = Y(e), n = pn(t, "oklch", "rgb");
1005
960
  return n ? {
1006
961
  l: (n.l ?? e.l / 100) * 100,
1007
962
  c: n.c ?? 0,
@@ -1009,11 +964,11 @@ function Bn(e) {
1009
964
  a: e.a
1010
965
  } : { l: e.l, c: 0, h: e.h, a: e.a };
1011
966
  }
1012
- function Kn(e) {
1013
- const t = qe(Y(e));
1014
- return t ? hn(t) : !1;
967
+ function Qn(e) {
968
+ const t = We(Y(e));
969
+ return t ? mn(t) : !1;
1015
970
  }
1016
- function gn(e, t) {
971
+ function yn(e, t) {
1017
972
  const n = parseFloat(e);
1018
973
  let r;
1019
974
  switch (t.toLowerCase()) {
@@ -1031,76 +986,76 @@ function gn(e, t) {
1031
986
  }
1032
987
  return (r % 360 + 360) % 360;
1033
988
  }
1034
- function se(e) {
989
+ function fe(e) {
1035
990
  const n = e.trim().match(/^oklch\(\s*(.*?)\s*\)$/i);
1036
991
  if (!n) return null;
1037
992
  const i = n[1].split("/");
1038
993
  if (i.length > 2) return null;
1039
994
  const a = i[0].trim(), o = i.length === 2 ? i[1].trim() : null, s = a.split(/\s+/).filter(Boolean);
1040
995
  if (s.length !== 3) return null;
1041
- const u = (m) => {
996
+ const f = (m) => {
1042
997
  if (m.toLowerCase() === "none") return { value: 0, isPercent: !1 };
1043
- const P = m.match(/^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(%?)$/i);
1044
- if (!P) return null;
1045
- const E = parseFloat(P[1]);
1046
- return isNaN(E) ? null : { value: E, isPercent: P[2] === "%" };
1047
- }, c = u(s[0]);
998
+ const C = m.match(/^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(%?)$/i);
999
+ if (!C) return null;
1000
+ const R = parseFloat(C[1]);
1001
+ return isNaN(R) ? null : { value: R, isPercent: C[2] === "%" };
1002
+ }, c = f(s[0]);
1048
1003
  if (!c) return null;
1049
- const d = c.isPercent ? c.value : c.value * 100, h = u(s[1]);
1004
+ const d = c.isPercent ? c.value : c.value * 100, h = f(s[1]);
1050
1005
  if (!h) return null;
1051
- const p = h.isPercent ? h.value / 100 * 0.4 : h.value, v = s[2];
1052
- let M;
1053
- if (v.toLowerCase() === "none")
1054
- M = 0;
1006
+ const p = h.isPercent ? h.value / 100 * 0.4 : h.value, y = s[2];
1007
+ let v;
1008
+ if (y.toLowerCase() === "none")
1009
+ v = 0;
1055
1010
  else {
1056
- const m = v.match(/^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(deg|rad|grad|turn)?$/i);
1011
+ const m = y.match(/^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(deg|rad|grad|turn)?$/i);
1057
1012
  if (!m) return null;
1058
- const P = m[1], E = m[2] ?? "deg";
1059
- M = gn(P, E);
1013
+ const C = m[1], R = m[2] ?? "deg";
1014
+ v = yn(C, R);
1060
1015
  }
1061
- let _ = 100;
1016
+ let P = 100;
1062
1017
  if (o !== null) {
1063
- const m = u(o.trim());
1018
+ const m = f(o.trim());
1064
1019
  if (!m) return null;
1065
- _ = m.isPercent ? m.value : m.value * 100;
1020
+ P = m.isPercent ? m.value : m.value * 100;
1066
1021
  }
1067
1022
  return {
1068
1023
  l: d,
1069
1024
  c: p,
1070
- h: M,
1071
- a: _
1025
+ h: v,
1026
+ a: P
1072
1027
  };
1073
1028
  }
1074
- function Je(e = g()) {
1029
+ function Xe(e = g()) {
1030
+ return lt(e);
1031
+ }
1032
+ function Ye(e = g()) {
1075
1033
  return st(e);
1076
1034
  }
1077
- function We(e = g()) {
1035
+ function ye(e = g()) {
1078
1036
  return at(e);
1079
1037
  }
1080
- function pe(e = g()) {
1081
- return it(e);
1038
+ function er(e = g()) {
1039
+ return ft(e);
1082
1040
  }
1083
- function Gn(e = g()) {
1084
- return ot(e);
1041
+ function Ze(e = g()) {
1042
+ return ct(e);
1085
1043
  }
1086
- function Xe(e = g()) {
1044
+ function Ue(e = g()) {
1087
1045
  return ut(e);
1088
1046
  }
1089
- function Ye(e = g()) {
1090
- return ft(e);
1091
- }
1092
- function Ze(e = g()) {
1093
- return lt(e);
1047
+ function Qe(e = g()) {
1048
+ return dt(e);
1094
1049
  }
1095
- const mn = { top: 60, left: 20 };
1096
- function bn() {
1097
- if (typeof window > "u") return mn;
1050
+ const xn = { top: 60, left: 20 };
1051
+ function Mn() {
1052
+ if (typeof window > "u") return xn;
1098
1053
  const e = Math.min(1200, 0.8 * window.innerWidth), t = Math.min(800, 0.8 * window.innerHeight), n = Math.max(0, Math.round((window.innerHeight - t) / 2)), r = Math.max(0, Math.round((window.innerWidth - e) / 2));
1099
1054
  return { top: n, left: r };
1100
1055
  }
1101
- function qn(e) {
1056
+ function tr(e) {
1102
1057
  try {
1103
- const t = localStorage.getItem(Xe(e));
1058
+ const t = localStorage.getItem(Ze(e));
1104
1059
  if (t) {
1105
1060
  const n = JSON.parse(t);
1106
1061
  if (typeof n.top == "number" && typeof n.left == "number" && Number.isFinite(n.top) && Number.isFinite(n.left))
@@ -1108,79 +1063,91 @@ function qn(e) {
1108
1063
  }
1109
1064
  } catch {
1110
1065
  }
1111
- return bn();
1066
+ return Mn();
1112
1067
  }
1113
- function Jn(e, t) {
1068
+ function nr(e, t) {
1114
1069
  try {
1115
- localStorage.setItem(Xe(t), JSON.stringify(e));
1070
+ localStorage.setItem(Ze(t), JSON.stringify(e));
1116
1071
  } catch {
1117
1072
  }
1118
1073
  }
1119
- const te = 60, xe = 320, ve = 240, Me = 1600, ke = 1200, yn = { width: 1024 * 0.8, height: 768 * 0.8 };
1120
- function xn() {
1121
- return typeof window > "u" ? yn : Ue(
1074
+ const ne = 60, ve = 320, ke = 240, Se = 1600, we = 1200, vn = { width: 1024 * 0.8, height: 768 * 0.8 };
1075
+ function kn() {
1076
+ return typeof window > "u" ? vn : et(
1122
1077
  Math.min(1200, 0.8 * window.innerWidth),
1123
1078
  Math.min(800, 0.8 * window.innerHeight)
1124
1079
  );
1125
1080
  }
1126
- const we = 32;
1127
- function Ue(e, t) {
1128
- const n = typeof window < "u" ? window.innerWidth : Me, r = typeof window < "u" ? window.innerHeight : ke, i = Math.max(xe, Math.min(Me, n - we)), a = Math.max(ve, Math.min(ke, r - we));
1081
+ const $e = 32;
1082
+ function et(e, t) {
1083
+ const n = typeof window < "u" ? window.innerWidth : Se, r = typeof window < "u" ? window.innerHeight : we, i = Math.max(ve, Math.min(Se, n - $e)), a = Math.max(ke, Math.min(we, r - $e));
1129
1084
  return {
1130
- width: Math.max(xe, Math.min(e, i)),
1131
- height: Math.max(ve, Math.min(t, a))
1085
+ width: Math.max(ve, Math.min(e, i)),
1086
+ height: Math.max(ke, Math.min(t, a))
1132
1087
  };
1133
1088
  }
1134
- function Wn(e) {
1089
+ function rr(e) {
1135
1090
  try {
1136
- const t = localStorage.getItem(Ye(e));
1091
+ const t = localStorage.getItem(Ue(e));
1137
1092
  if (t) {
1138
1093
  const n = JSON.parse(t);
1139
1094
  if (typeof n.width == "number" && typeof n.height == "number" && Number.isFinite(n.width) && Number.isFinite(n.height))
1140
- return Ue(n.width, n.height);
1095
+ return et(n.width, n.height);
1141
1096
  }
1142
1097
  } catch {
1143
1098
  }
1144
- return xn();
1099
+ return kn();
1145
1100
  }
1146
- function Xn(e, t) {
1101
+ function ir(e, t) {
1147
1102
  try {
1148
- localStorage.setItem(Ye(t), JSON.stringify(e));
1103
+ localStorage.setItem(Ue(t), JSON.stringify(e));
1149
1104
  } catch {
1150
1105
  }
1151
1106
  }
1152
- const vn = 1;
1153
- function Yn(e) {
1107
+ const Sn = 1;
1108
+ function or(e) {
1154
1109
  return e === 0 ? "192px" : e === 2 ? "100%" : "288px";
1155
1110
  }
1156
- function Zn(e) {
1111
+ function ar(e) {
1157
1112
  try {
1158
- const t = localStorage.getItem(Ze(e));
1113
+ const t = localStorage.getItem(Qe(e));
1159
1114
  if (t === "0" || t === "1" || t === "2")
1160
1115
  return Number(t);
1161
1116
  } catch {
1162
1117
  }
1163
- return vn;
1118
+ return Sn;
1164
1119
  }
1165
- function Un(e, t) {
1120
+ function sr(e, t) {
1166
1121
  try {
1167
- localStorage.setItem(Ze(t), String(e));
1122
+ localStorage.setItem(Qe(t), String(e));
1168
1123
  } catch {
1169
1124
  }
1170
1125
  }
1171
- function Qn(e, t, n, r) {
1172
- const i = -(n - te), a = window.innerWidth - te, o = -30, s = window.innerHeight - te, u = Math.max(s, o), c = Math.max(a, i);
1126
+ function fr(e, t, n, r) {
1127
+ const i = -(n - ne), a = window.innerWidth - ne, o = -30, s = window.innerHeight - ne, f = Math.max(s, o), c = Math.max(a, i);
1173
1128
  return {
1174
- top: Math.max(o, Math.min(e, u)),
1129
+ top: Math.max(o, Math.min(e, f)),
1175
1130
  left: Math.max(i, Math.min(t, c))
1176
1131
  };
1177
1132
  }
1178
- async function er(e) {
1133
+ async function lr(e) {
1134
+ }
1135
+ function wn(e) {
1136
+ return typeof e == "number" || e === "bg" || e === "fg";
1137
+ }
1138
+ function le(e) {
1139
+ return typeof e == "object" && e !== null && "literal" in e;
1140
+ }
1141
+ function ue(e) {
1142
+ return le(e) && typeof e.literal == "object" && e.literal !== null;
1143
+ }
1144
+ function $n(e) {
1145
+ return typeof e == "object" && e !== null && "ref" in e;
1179
1146
  }
1180
- function ne() {
1147
+ function re() {
1181
1148
  return {};
1182
1149
  }
1183
- const Mn = {
1150
+ const Nn = {
1184
1151
  id: "stub",
1185
1152
  label: "STUB",
1186
1153
  paletteSize: 0,
@@ -1194,10 +1161,10 @@ const Mn = {
1194
1161
  panelSettings: { colorScheme: "", colorMode: !1 }
1195
1162
  };
1196
1163
  function $(e = g()) {
1197
- return rt(e.tabs) ?? Mn;
1164
+ return ot(e.tabs) ?? Nn;
1198
1165
  }
1199
- function ge(e) {
1200
- const t = Math.max(1, e.paletteSize);
1166
+ function Z(e) {
1167
+ const t = e.paletteSize;
1201
1168
  return {
1202
1169
  palette: Array.from({ length: t }, (r, i) => {
1203
1170
  if (t === 1) return "#808080";
@@ -1213,11 +1180,11 @@ function ge(e) {
1213
1180
  shikiTheme: e.defaultShikiTheme
1214
1181
  };
1215
1182
  }
1216
- function tr(e) {
1183
+ function ur(e) {
1217
1184
  const t = W(e);
1218
- return t ? ge(t) : void 0;
1185
+ return t ? Z(t) : void 0;
1219
1186
  }
1220
- function kn() {
1187
+ function Tn() {
1221
1188
  try {
1222
1189
  const e = document.createElement("canvas").getContext("2d");
1223
1190
  return e ? (e.fillStyle = "#ffffff", e.fillStyle === "#ffffff") : !1;
@@ -1225,8 +1192,8 @@ function kn() {
1225
1192
  return !1;
1226
1193
  }
1227
1194
  }
1228
- const wn = kn();
1229
- function Sn(e) {
1195
+ const In = Tn();
1196
+ function On(e) {
1230
1197
  const t = e.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?/);
1231
1198
  if (!t) return null;
1232
1199
  const n = parseInt(t[1], 10), r = parseInt(t[2], 10), i = parseInt(t[3], 10), a = `#${(1 << 24 | n << 16 | r << 8 | i).toString(16).slice(1)}`;
@@ -1239,12 +1206,12 @@ function Sn(e) {
1239
1206
  }
1240
1207
  return a;
1241
1208
  }
1242
- function $n(e, t, n, r) {
1209
+ function Pn(e, t, n, r) {
1243
1210
  const i = (o) => o.toString(16).padStart(2, "0"), a = `#${i(e)}${i(t)}${i(n)}`;
1244
1211
  return r < 255 ? `${a}${i(r)}` : a;
1245
1212
  }
1246
1213
  let k = null;
1247
- function fe(e) {
1214
+ function ce(e) {
1248
1215
  if (!e || e === "initial" || e === "inherit") return "#000000";
1249
1216
  const t = e.trim();
1250
1217
  if (/^#[0-9a-fA-F]{6}$/.test(t) || /^#[0-9a-fA-F]{8}$/.test(t)) return t;
@@ -1252,22 +1219,22 @@ function fe(e) {
1252
1219
  return `#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`;
1253
1220
  if (/^#[0-9a-fA-F]{4}$/.test(t))
1254
1221
  return `#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}${t[4]}${t[4]}`;
1255
- const n = Sn(t);
1222
+ const n = On(t);
1256
1223
  if (n) return n;
1257
- if (!wn) return "#000000";
1224
+ if (!In) return "#000000";
1258
1225
  try {
1259
1226
  if (k || (k = document.createElement("canvas").getContext("2d")), !k) return "#000000";
1260
1227
  k.fillStyle = "#000000", k.fillStyle = t, k.clearRect(0, 0, 1, 1), k.fillRect(0, 0, 1, 1);
1261
1228
  const [r, i, a, o] = k.getImageData(0, 0, 1, 1).data;
1262
- return $n(r, i, a, o);
1229
+ return Pn(r, i, a, o);
1263
1230
  } catch {
1264
1231
  return "#000000";
1265
1232
  }
1266
1233
  }
1267
- function L(e, t) {
1234
+ function A(e, t) {
1268
1235
  document.documentElement.style.setProperty(e, t);
1269
1236
  }
1270
- function Tn(e, t) {
1237
+ function Cn(e, t) {
1271
1238
  let n = Math.abs(e.h - t.h) % 360;
1272
1239
  return n > 180 && (n = 360 - n), Math.abs(e.l - t.l) <= 1e-3 && Math.abs(e.c - t.c) <= 1e-5 && n <= 1e-3 && Math.abs(e.a - t.a) <= 1e-3;
1273
1240
  }
@@ -1276,23 +1243,23 @@ function T(e, t, n) {
1276
1243
  if (typeof e == "number") return e;
1277
1244
  const r = t.indexOf(e);
1278
1245
  if (r >= 0) return r;
1279
- const i = se(e);
1246
+ const i = fe(e);
1280
1247
  if (i)
1281
1248
  for (let h = 0; h < t.length; h++) {
1282
- const p = se(t[h]);
1283
- if (p && Tn(i, p)) return h;
1249
+ const p = fe(t[h]);
1250
+ if (p && Cn(i, p)) return h;
1284
1251
  }
1285
- const a = fe(e), o = t.map((h) => fe(h)), s = o.indexOf(a);
1252
+ const a = ce(e), o = t.map((h) => ce(h)), s = o.indexOf(a);
1286
1253
  if (s >= 0) return s;
1287
- const u = Se(a);
1254
+ const f = Ne(a);
1288
1255
  let c = n, d = 1 / 0;
1289
1256
  for (let h = 0; h < o.length; h++) {
1290
- const p = Se(o[h]), v = (u.r - p.r) ** 2 + (u.g - p.g) ** 2 + (u.b - p.b) ** 2;
1291
- v < d && (d = v, c = h);
1257
+ const p = Ne(o[h]), y = (f.r - p.r) ** 2 + (f.g - p.g) ** 2 + (f.b - p.b) ** 2;
1258
+ y < d && (d = y, c = h);
1292
1259
  }
1293
1260
  return c;
1294
1261
  }
1295
- function Se(e) {
1262
+ function Ne(e) {
1296
1263
  const t = e.replace("#", "");
1297
1264
  return {
1298
1265
  r: parseInt(t.substring(0, 2), 16) || 0,
@@ -1301,7 +1268,7 @@ function Se(e) {
1301
1268
  aa: t.length >= 8 ? parseInt(t.substring(6, 8), 16) || 0 : 255
1302
1269
  };
1303
1270
  }
1304
- function Nn(e = $(), t) {
1271
+ function _n(e = $(), t) {
1305
1272
  const n = e.panelSettings, r = t !== void 0 && t.applySink !== void 0;
1306
1273
  if (n.colorMode && !r) {
1307
1274
  const i = document.documentElement.getAttribute("data-theme");
@@ -1310,21 +1277,25 @@ function Nn(e = $(), t) {
1310
1277
  }
1311
1278
  return n.colorScheme;
1312
1279
  }
1313
- function In(e = $(), t) {
1280
+ function An(e = $(), t) {
1314
1281
  const n = e.colorSchemes;
1315
1282
  if (Object.keys(n).length === 0)
1316
- return ge(e);
1317
- const r = Nn(e, t), i = n[r] ?? Object.values(n)[0];
1318
- return _n(i, e);
1319
- }
1320
- function On(e) {
1321
- return se(e) ? e : fe(e);
1322
- }
1323
- function _n(e, t = $()) {
1324
- const n = e.palette.map(On), r = {};
1283
+ return Z(e);
1284
+ const r = _n(e, t), i = n[r] ?? Object.values(n)[0];
1285
+ return En(i, e);
1286
+ }
1287
+ function Hn(e) {
1288
+ return fe(e) ? e : ce(e);
1289
+ }
1290
+ function En(e, t = $()) {
1291
+ if (t.paletteSize === 0)
1292
+ return console.warn(
1293
+ `[tweak] Scheme/preset load ignored for palette-less cluster "${t.id}" (paletteSize: 0) — schemes cannot seed a tier with no palette.`
1294
+ ), Z(t);
1295
+ const n = e.palette.map(Hn), r = {};
1325
1296
  for (const [i, a] of Object.entries(t.semanticDefaults)) {
1326
- const o = e.semantic?.[i];
1327
- o === void 0 ? r[i] = a : typeof o == "number" ? r[i] = o : r[i] = T(o, e.palette, a);
1297
+ const o = typeof a == "number" ? a : 0, s = e.semantic?.[i];
1298
+ s === void 0 ? r[i] = o : typeof s == "number" ? r[i] = s : r[i] = T(s, e.palette, o);
1328
1299
  }
1329
1300
  return {
1330
1301
  palette: n,
@@ -1353,82 +1324,151 @@ function _n(e, t = $()) {
1353
1324
  shikiTheme: String(e.shikiTheme ?? t.defaultShikiTheme)
1354
1325
  };
1355
1326
  }
1356
- function $e(e, t, n, r) {
1327
+ function Rn(e, t, n, r) {
1357
1328
  const i = t.length;
1358
- return e === "bg" ? t[H(n, i)] ?? "#000000" : e === "fg" ? t[H(r, i)] ?? "#ffffff" : t[H(e, i)] ?? "#000000";
1329
+ return e === "bg" ? t[E(n, i)] ?? "#000000" : e === "fg" ? t[E(r, i)] ?? "#ffffff" : t[E(e, i)] ?? "#000000";
1359
1330
  }
1360
- function H(e, t) {
1331
+ function E(e, t) {
1361
1332
  return e >= 0 && e < t ? e : 0;
1362
1333
  }
1363
- function Te(e, t = $(), n) {
1364
- const r = e.palette.length;
1334
+ function de(e, t, n, r, i, a, o) {
1335
+ if (wn(e)) return Rn(e, t, n, r);
1336
+ if (le(e) && ue(e))
1337
+ return o ? e.literal[o] : `light-dark(${e.literal.light}, ${e.literal.dark})`;
1338
+ if (le(e) && !ue(e)) return e.literal;
1339
+ if ($n(e) && i)
1340
+ try {
1341
+ return `var(${ht(e.ref, i, a ?? [i])})`;
1342
+ } catch {
1343
+ return null;
1344
+ }
1345
+ return null;
1346
+ }
1347
+ function Fn(e) {
1348
+ const t = e.panelSettings.colorMode;
1349
+ return t ? t.defaultMode : "light";
1350
+ }
1351
+ function cr(e, t) {
1352
+ return e.literal[t];
1353
+ }
1354
+ function dr(e, t, n = $(), r, i) {
1355
+ return de(
1356
+ e,
1357
+ t.palette,
1358
+ t.background,
1359
+ t.foreground,
1360
+ r,
1361
+ i,
1362
+ Fn(n)
1363
+ ) ?? "#000000";
1364
+ }
1365
+ const N = "color-scheme", Te = "light dark";
1366
+ function J(e, t) {
1367
+ for (const n of Object.keys(t.semanticCssNames)) {
1368
+ const r = e.semanticMappings[n] ?? t.semanticDefaults[n];
1369
+ if (r !== void 0 && ue(r)) return !0;
1370
+ }
1371
+ return !1;
1372
+ }
1373
+ function Ie(e, t = $(), n, r, i) {
1374
+ const a = e.palette.length;
1365
1375
  if (n) {
1366
- const i = [];
1367
- for (let a = 0; a < r; a++)
1368
- i.push([j(t, a), e.palette[a]]);
1369
- for (const [a, o] of Object.entries(t.baseRoles)) {
1370
- if (typeof o != "string" || o.length === 0) continue;
1371
- const s = e[a];
1372
- typeof s == "number" && i.push([o, e.palette[H(s, r)]]);
1376
+ const o = [];
1377
+ for (let s = 0; s < a; s++)
1378
+ o.push([z(t, s), e.palette[s]]);
1379
+ for (const [s, f] of Object.entries(t.baseRoles)) {
1380
+ if (typeof f != "string" || f.length === 0) continue;
1381
+ const c = e[s];
1382
+ typeof c == "number" && o.push([f, e.palette[E(c, a)]]);
1373
1383
  }
1374
- for (const [a, o] of Object.entries(t.semanticCssNames)) {
1375
- const s = e.semanticMappings[a] ?? t.semanticDefaults[a];
1376
- i.push([o, $e(s, e.palette, e.background, e.foreground)]);
1384
+ for (const [s, f] of Object.entries(t.semanticCssNames)) {
1385
+ const c = e.semanticMappings[s] ?? t.semanticDefaults[s], d = de(
1386
+ c,
1387
+ e.palette,
1388
+ e.background,
1389
+ e.foreground,
1390
+ r,
1391
+ i
1392
+ );
1393
+ d !== null && o.push([f, d]);
1377
1394
  }
1395
+ J(e, t) && o.push([N, Te]);
1378
1396
  try {
1379
- n.apply(i);
1380
- } catch (a) {
1381
- console.warn("[design-token-panel] applySink.apply threw; falling back silently.", a);
1397
+ n.apply(o);
1398
+ } catch (s) {
1399
+ console.warn("[design-token-panel] applySink.apply threw; falling back silently.", s);
1382
1400
  }
1383
1401
  return;
1384
1402
  }
1385
- for (let i = 0; i < r; i++)
1386
- L(j(t, i), e.palette[i]);
1387
- for (const [i, a] of Object.entries(t.baseRoles)) {
1388
- if (typeof a != "string" || a.length === 0) continue;
1389
- const o = e[i];
1390
- typeof o == "number" && L(a, e.palette[H(o, r)]);
1403
+ for (let o = 0; o < a; o++)
1404
+ A(z(t, o), e.palette[o]);
1405
+ for (const [o, s] of Object.entries(t.baseRoles)) {
1406
+ if (typeof s != "string" || s.length === 0) continue;
1407
+ const f = e[o];
1408
+ typeof f == "number" && A(s, e.palette[E(f, a)]);
1391
1409
  }
1392
- for (const [i, a] of Object.entries(t.semanticCssNames)) {
1393
- const o = e.semanticMappings[i] ?? t.semanticDefaults[i];
1394
- L(a, $e(o, e.palette, e.background, e.foreground));
1410
+ for (const [o, s] of Object.entries(t.semanticCssNames)) {
1411
+ const f = e.semanticMappings[o] ?? t.semanticDefaults[o], c = de(
1412
+ f,
1413
+ e.palette,
1414
+ e.background,
1415
+ e.foreground,
1416
+ r,
1417
+ i
1418
+ );
1419
+ c !== null && A(s, c);
1395
1420
  }
1396
- }
1397
- function nr(e, t) {
1398
- const n = t ?? g(), r = n.applySink;
1399
- Te(e.color, $(n), r), z(n.tabs, "spacing", e.spacing, r), z(n.tabs, "font", e.typography, r), z(n.tabs, "size", e.size, r);
1400
- const i = W(n);
1401
- if (i && e.secondary && Te(e.secondary, i, r), e.tabs)
1402
- for (const [a, o] of Object.entries(e.tabs)) {
1403
- const s = {};
1404
- for (const u of Object.values(o))
1405
- for (const [c, d] of Object.entries(u))
1406
- s[c] = d;
1407
- z(n.tabs, a, s, r);
1421
+ J(e, t) && A(N, Te);
1422
+ }
1423
+ function hr(e, t) {
1424
+ const n = t ?? g(), r = n.applySink, i = n.tabs.find((f) => f.id === "color"), a = $(n);
1425
+ Ie(e.color, a, r, i, n.tabs), D(n.tabs, "spacing", e.spacing, r), D(n.tabs, "font", e.typography, r), D(n.tabs, "size", e.size, r);
1426
+ const o = W(n);
1427
+ let s = !1;
1428
+ if (o && e.secondary) {
1429
+ const f = n.tabs.find((c) => c.id === "color-secondary");
1430
+ Ie(e.secondary, o, r, f, n.tabs), s = J(e.secondary, o);
1431
+ }
1432
+ if (!J(e.color, a) && !s)
1433
+ if (r)
1434
+ try {
1435
+ r.clear([N]);
1436
+ } catch (f) {
1437
+ console.warn("[design-token-panel] applySink.clear threw; falling back silently.", f);
1438
+ }
1439
+ else
1440
+ document.documentElement.style.removeProperty(N);
1441
+ if (e.tabs)
1442
+ for (const [f, c] of Object.entries(e.tabs)) {
1443
+ const d = {};
1444
+ for (const h of Object.values(c))
1445
+ for (const [p, y] of Object.entries(h))
1446
+ d[p] = y;
1447
+ D(n.tabs, f, d, r);
1408
1448
  }
1409
1449
  }
1410
- function z(e, t, n, r) {
1450
+ function D(e, t, n, r) {
1411
1451
  const i = e.find((s) => s.id === t);
1412
1452
  if (!i) return;
1413
1453
  const a = {};
1414
1454
  for (const s of i.tiers) {
1415
- const u = {};
1455
+ const f = {};
1416
1456
  for (const c of s.items) {
1417
1457
  const d = n[c.id];
1418
- typeof d == "string" && d.length > 0 && (u[c.id] = d);
1458
+ typeof d == "string" && d.length > 0 && (f[c.id] = d);
1419
1459
  }
1420
- a[s.id] = u;
1460
+ a[s.id] = f;
1421
1461
  }
1422
1462
  if (r) {
1423
- const s = [], u = [];
1463
+ const s = [], f = [];
1424
1464
  for (const c of i.tiers)
1425
1465
  for (const d of c.items)
1426
1466
  if (!d.readonly)
1427
1467
  try {
1428
- const h = be(i, c.id, d.id, a), p = ye(h);
1429
- typeof n[d.id] == "string" && n[d.id].length > 0 || c.referencesTier !== void 0 ? s.push([d.cssVar, p]) : u.push(d.cssVar);
1468
+ const h = xe(i, c.id, d.id, a), p = Me(h);
1469
+ typeof n[d.id] == "string" && n[d.id].length > 0 || c.referencesTier !== void 0 ? s.push([d.cssVar, p]) : f.push(d.cssVar);
1430
1470
  } catch {
1431
- u.push(d.cssVar);
1471
+ f.push(d.cssVar);
1432
1472
  }
1433
1473
  if (s.length > 0)
1434
1474
  try {
@@ -1436,9 +1476,9 @@ function z(e, t, n, r) {
1436
1476
  } catch (c) {
1437
1477
  console.warn("[design-token-panel] applySink.apply threw; falling back silently.", c);
1438
1478
  }
1439
- if (u.length > 0)
1479
+ if (f.length > 0)
1440
1480
  try {
1441
- r.clear(u);
1481
+ r.clear(f);
1442
1482
  } catch (c) {
1443
1483
  console.warn("[design-token-panel] applySink.clear threw; falling back silently.", c);
1444
1484
  }
@@ -1446,30 +1486,30 @@ function z(e, t, n, r) {
1446
1486
  }
1447
1487
  const o = document.documentElement;
1448
1488
  for (const s of i.tiers)
1449
- for (const u of s.items)
1450
- if (!u.readonly)
1489
+ for (const f of s.items)
1490
+ if (!f.readonly)
1451
1491
  try {
1452
- const c = be(i, s.id, u.id, a), d = ye(c);
1453
- typeof n[u.id] == "string" && n[u.id].length > 0 || s.referencesTier !== void 0 ? L(u.cssVar, d) : o.style.removeProperty(u.cssVar);
1492
+ const c = xe(i, s.id, f.id, a), d = Me(c);
1493
+ typeof n[f.id] == "string" && n[f.id].length > 0 || s.referencesTier !== void 0 ? A(f.cssVar, d) : o.style.removeProperty(f.cssVar);
1454
1494
  } catch {
1455
- o.style.removeProperty(u.cssVar);
1495
+ o.style.removeProperty(f.cssVar);
1456
1496
  }
1457
1497
  }
1458
- function Qe(e) {
1498
+ function tt(e) {
1459
1499
  const t = e ?? g(), n = $(t), r = W(t);
1460
1500
  return r ? [n, r] : [n];
1461
1501
  }
1462
- function et(e) {
1502
+ function nt(e) {
1463
1503
  const t = [];
1464
1504
  for (let n = 0; n < e.paletteSize; n++)
1465
- t.push(j(e, n));
1505
+ t.push(z(e, n));
1466
1506
  for (const n of Object.values(e.baseRoles))
1467
1507
  typeof n == "string" && n.length > 0 && t.push(n);
1468
1508
  for (const n of Object.values(e.semanticCssNames))
1469
1509
  t.push(n);
1470
1510
  return t;
1471
1511
  }
1472
- function Pn(e) {
1512
+ function Vn(e) {
1473
1513
  const t = [];
1474
1514
  for (const n of e.tabs)
1475
1515
  if (!(n.id === "color" || n.id === "color-secondary"))
@@ -1478,16 +1518,16 @@ function Pn(e) {
1478
1518
  i.readonly || t.push(i.cssVar);
1479
1519
  return t;
1480
1520
  }
1481
- function Cn(e, t, n) {
1482
- const r = e ?? Qe(n), i = n?.applySink;
1483
- return An(r, i);
1521
+ function Dn(e, t, n) {
1522
+ const r = e ?? tt(n), i = n?.applySink;
1523
+ return Ln(r, i);
1484
1524
  }
1485
- function An(e, t) {
1525
+ function Ln(e, t) {
1486
1526
  if (t) {
1487
1527
  const r = [];
1488
1528
  for (const i of e)
1489
- r.push(...et(i));
1490
- if (r.length > 0)
1529
+ r.push(...nt(i));
1530
+ if (e.length > 0 && r.push(N), r.length > 0)
1491
1531
  try {
1492
1532
  t.clear(r);
1493
1533
  } catch (i) {
@@ -1498,20 +1538,21 @@ function An(e, t) {
1498
1538
  const n = document.documentElement;
1499
1539
  for (const r of e) {
1500
1540
  for (let i = 0; i < r.paletteSize; i++)
1501
- n.style.removeProperty(j(r, i));
1541
+ n.style.removeProperty(z(r, i));
1502
1542
  for (const i of Object.values(r.baseRoles))
1503
1543
  n.style.removeProperty(i);
1504
1544
  for (const i of Object.values(r.semanticCssNames))
1505
1545
  n.style.removeProperty(i);
1506
1546
  }
1547
+ e.length > 0 && n.style.removeProperty(N);
1507
1548
  }
1508
- function rr(e, t) {
1509
- const n = t ?? g(), r = n.applySink, i = Qe(n);
1549
+ function pr(e, t) {
1550
+ const n = t ?? g(), r = n.applySink, i = tt(n);
1510
1551
  if (r) {
1511
1552
  const o = [];
1512
1553
  for (const s of i)
1513
- o.push(...et(s));
1514
- if (o.push(...Pn(n)), o.length > 0)
1554
+ o.push(...nt(s));
1555
+ if (i.length > 0 && o.push(N), o.push(...Vn(n)), o.length > 0)
1515
1556
  try {
1516
1557
  r.clear(o);
1517
1558
  } catch (s) {
@@ -1519,20 +1560,59 @@ function rr(e, t) {
1519
1560
  }
1520
1561
  return;
1521
1562
  }
1522
- Cn(i);
1563
+ Dn(i);
1523
1564
  const a = document.documentElement;
1524
1565
  for (const o of n.tabs)
1525
1566
  if (!(o.id === "color" || o.id === "color-secondary"))
1526
1567
  for (const s of o.tiers)
1527
- for (const u of s.items)
1528
- u.readonly || a.style.removeProperty(u.cssVar);
1568
+ for (const f of s.items)
1569
+ f.readonly || a.style.removeProperty(f.cssVar);
1529
1570
  }
1530
- function tt(e, t) {
1571
+ function rt(e, t) {
1531
1572
  if (!e || typeof e != "object") return !1;
1532
1573
  const n = e;
1533
1574
  return Array.isArray(n.palette) && n.palette.length === t && typeof n.background == "number" && typeof n.foreground == "number" && typeof n.cursor == "number" && typeof n.selectionBg == "number" && typeof n.selectionFg == "number" && typeof n.semanticMappings == "object" && n.semanticMappings !== null;
1534
1575
  }
1535
- function ue(e, t) {
1576
+ function zn(e) {
1577
+ if (typeof e == "number" || e === "bg" || e === "fg") return e;
1578
+ if (!e || typeof e != "object" || Array.isArray(e)) return;
1579
+ const t = e;
1580
+ if ("literal" in t) {
1581
+ const n = t.literal;
1582
+ if (typeof n == "string") return { literal: n };
1583
+ if (n && typeof n == "object" && !Array.isArray(n)) {
1584
+ const r = n;
1585
+ if (typeof r.light == "string" && typeof r.dark == "string")
1586
+ return { literal: { light: r.light, dark: r.dark } };
1587
+ }
1588
+ return;
1589
+ }
1590
+ if ("ref" in t) {
1591
+ const n = t.ref;
1592
+ if (n && typeof n == "object" && !Array.isArray(n)) {
1593
+ const r = n;
1594
+ if (typeof r.tier == "string" && typeof r.item == "string")
1595
+ return {
1596
+ ref: {
1597
+ tier: r.tier,
1598
+ item: r.item,
1599
+ ...typeof r.tab == "string" ? { tab: r.tab } : {}
1600
+ }
1601
+ };
1602
+ }
1603
+ return;
1604
+ }
1605
+ }
1606
+ function jn(e, t) {
1607
+ if (!e || typeof e != "object" || Array.isArray(e)) return { ...t };
1608
+ const n = { ...t };
1609
+ for (const [r, i] of Object.entries(e)) {
1610
+ const a = zn(i);
1611
+ a !== void 0 && (n[r] = a);
1612
+ }
1613
+ return n;
1614
+ }
1615
+ function he(e, t) {
1536
1616
  const n = Array.isArray(e.palette) ? e.palette : null;
1537
1617
  let r;
1538
1618
  return n && n.length === t.palette.length && n.every((i) => typeof i == "string") ? r = n : (n && n.some((i) => typeof i != "string") && console.error(
@@ -1544,11 +1624,11 @@ function ue(e, t) {
1544
1624
  cursor: typeof e.cursor == "number" ? e.cursor : t.cursor,
1545
1625
  selectionBg: typeof e.selectionBg == "number" ? e.selectionBg : t.selectionBg,
1546
1626
  selectionFg: typeof e.selectionFg == "number" ? e.selectionFg : t.selectionFg,
1547
- semanticMappings: e.semanticMappings && typeof e.semanticMappings == "object" ? { ...t.semanticMappings, ...e.semanticMappings } : t.semanticMappings,
1627
+ semanticMappings: jn(e.semanticMappings, t.semanticMappings),
1548
1628
  shikiTheme: typeof e.shikiTheme == "string" && e.shikiTheme.length > 0 ? e.shikiTheme : t.shikiTheme
1549
1629
  };
1550
1630
  }
1551
- const ir = {
1631
+ const gr = {
1552
1632
  "text-caption": "text-xs",
1553
1633
  "text-small": "text-sm",
1554
1634
  "text-body": "text-base",
@@ -1558,14 +1638,14 @@ const ir = {
1558
1638
  // Dropped — no main-site equivalent. `null` signals "discard".
1559
1639
  "text-micro": null
1560
1640
  };
1561
- function Ne(e) {
1641
+ function Oe(e) {
1562
1642
  if (!e || typeof e != "object") return {};
1563
1643
  const t = {};
1564
1644
  for (const [n, r] of Object.entries(e))
1565
1645
  typeof r == "string" && (t[n] = r);
1566
1646
  return t;
1567
1647
  }
1568
- function Hn(e, t = {}) {
1648
+ function Kn(e, t = {}) {
1569
1649
  if (!e || typeof e != "object") return {};
1570
1650
  const n = {};
1571
1651
  for (const [r, i] of Object.entries(e))
@@ -1578,7 +1658,7 @@ function Hn(e, t = {}) {
1578
1658
  n[r] = i;
1579
1659
  return n;
1580
1660
  }
1581
- function En(e) {
1661
+ function Bn(e) {
1582
1662
  if (!e || typeof e != "object" || Array.isArray(e)) return {};
1583
1663
  const t = {};
1584
1664
  for (const [n, r] of Object.entries(e)) {
@@ -1587,43 +1667,43 @@ function En(e) {
1587
1667
  for (const [a, o] of Object.entries(r)) {
1588
1668
  if (!o || typeof o != "object" || Array.isArray(o)) continue;
1589
1669
  const s = {};
1590
- for (const [u, c] of Object.entries(o))
1591
- typeof c == "string" && (s[u] = c);
1670
+ for (const [f, c] of Object.entries(o))
1671
+ typeof c == "string" && (s[f] = c);
1592
1672
  i[a] = s;
1593
1673
  }
1594
1674
  t[n] = i;
1595
1675
  }
1596
1676
  return t;
1597
1677
  }
1598
- function Ie(e, t, n, r = g()) {
1678
+ function Pe(e, t, n, r = g()) {
1599
1679
  if (!e.color || typeof e.color != "object") return null;
1600
- const i = n ?? nt(t, r), a = e.typography !== void 0 ? e.typography : e.font, o = r.legacyIdRenameMap ?? {}, s = {
1601
- color: ue(e.color, i),
1680
+ const i = n ?? it(t, r), a = e.typography !== void 0 ? e.typography : e.font, o = r.legacyIdRenameMap ?? {}, s = {
1681
+ color: he(e.color, i),
1602
1682
  // New sections added after v1 migration — tolerate their absence so
1603
1683
  // older v2 payloads (Color-only) still load cleanly.
1604
- spacing: Ne(e.spacing),
1684
+ spacing: Oe(e.spacing),
1605
1685
  // Typography slice: apply the host-configured rename map (if any)
1606
1686
  // so payloads persisted under the host's "old" ids survive a
1607
1687
  // host-driven id rename without losing the user's tweaks.
1608
- typography: Hn(a, o),
1609
- size: Ne(e.size)
1610
- }, u = W(r);
1611
- u && e.secondary && tt(e.secondary, u.paletteSize) && (s.secondary = ue(
1688
+ typography: Kn(a, o),
1689
+ size: Oe(e.size)
1690
+ }, f = W(r);
1691
+ f && e.secondary && rt(e.secondary, f.paletteSize) && (s.secondary = he(
1612
1692
  e.secondary,
1613
- ge(u)
1693
+ Z(f)
1614
1694
  ));
1615
- const c = En(e.tabs);
1695
+ const c = Bn(e.tabs);
1616
1696
  return Object.keys(c).length > 0 && (s.tabs = c), s;
1617
1697
  }
1618
- function ar(e = localStorage, t, n = $(), r = g()) {
1619
- const i = Je(r), a = We(r), o = pe(r), s = re(e, o);
1698
+ function mr(e = localStorage, t, n = $(), r = g()) {
1699
+ const i = Xe(r), a = Ye(r), o = ye(r), s = ie(e, o);
1620
1700
  if (s !== null) {
1621
- const d = ie(s);
1701
+ const d = oe(s);
1622
1702
  if (d && typeof d == "object") {
1623
- const h = d, p = Ie(h, n, t, r);
1703
+ const h = d, p = Pe(h, n, t, r);
1624
1704
  if (p !== null) {
1625
- const v = h.typography !== void 0 ? h.typography : h.font, M = JSON.stringify(v ?? {}) !== JSON.stringify(p.typography), _ = h.color, m = Array.isArray(_?.palette) && _.palette.length !== n.paletteSize;
1626
- if (M || h.typography === void 0 || m)
1705
+ const y = h.typography !== void 0 ? h.typography : h.font, v = JSON.stringify(y ?? {}) !== JSON.stringify(p.typography), P = h.color, m = Array.isArray(P?.palette) && P.palette.length !== n.paletteSize;
1706
+ if (v || h.typography === void 0 || m)
1627
1707
  try {
1628
1708
  e.setItem(o, JSON.stringify(p));
1629
1709
  } catch {
@@ -1633,11 +1713,11 @@ function ar(e = localStorage, t, n = $(), r = g()) {
1633
1713
  }
1634
1714
  console.warn(`[tweak] Malformed ${o}, attempting v2 migration`);
1635
1715
  }
1636
- const u = re(e, a);
1637
- if (u !== null) {
1638
- const d = ie(u);
1716
+ const f = ie(e, a);
1717
+ if (f !== null) {
1718
+ const d = oe(f);
1639
1719
  if (d && typeof d == "object") {
1640
- const p = Ie(d, n, t, r);
1720
+ const p = Pe(d, n, t, r);
1641
1721
  if (p !== null) {
1642
1722
  try {
1643
1723
  e.setItem(o, JSON.stringify(p)), e.removeItem(a);
@@ -1648,23 +1728,23 @@ function ar(e = localStorage, t, n = $(), r = g()) {
1648
1728
  }
1649
1729
  console.warn(`[tweak] Malformed ${a}, attempting v1 migration`);
1650
1730
  }
1651
- const c = re(e, i);
1731
+ const c = ie(e, i);
1652
1732
  if (c !== null) {
1653
- const d = ie(c);
1654
- if (d && typeof d == "object" && tt(d, n.paletteSize)) {
1655
- const h = t ?? nt(n, r), p = d;
1733
+ const d = oe(c);
1734
+ if (d && typeof d == "object" && rt(d, n.paletteSize)) {
1735
+ const h = t ?? it(n, r), p = d;
1656
1736
  p.shikiTheme || (p.shikiTheme = h.shikiTheme);
1657
- const M = {
1658
- color: ue(p, h),
1659
- spacing: ne(),
1660
- typography: ne(),
1661
- size: ne()
1737
+ const v = {
1738
+ color: he(p, h),
1739
+ spacing: re(),
1740
+ typography: re(),
1741
+ size: re()
1662
1742
  };
1663
1743
  try {
1664
- e.setItem(o, JSON.stringify(M)), e.removeItem(i);
1744
+ e.setItem(o, JSON.stringify(v)), e.removeItem(i);
1665
1745
  } catch {
1666
1746
  }
1667
- return M;
1747
+ return v;
1668
1748
  }
1669
1749
  console.warn(`[tweak] Malformed ${i}; discarding and using fresh defaults`);
1670
1750
  try {
@@ -1674,43 +1754,43 @@ function ar(e = localStorage, t, n = $(), r = g()) {
1674
1754
  }
1675
1755
  return null;
1676
1756
  }
1677
- function or(e, t = localStorage, n = g()) {
1757
+ function br(e, t = localStorage, n = g()) {
1678
1758
  try {
1679
- t.setItem(pe(n), JSON.stringify(e));
1759
+ t.setItem(ye(n), JSON.stringify(e));
1680
1760
  } catch {
1681
1761
  }
1682
1762
  }
1683
- function sr(e = localStorage, t = g()) {
1763
+ function yr(e = localStorage, t = g()) {
1684
1764
  try {
1685
- e.removeItem(pe(t));
1765
+ e.removeItem(ye(t));
1686
1766
  } catch {
1687
1767
  }
1688
1768
  try {
1689
- e.removeItem(We(t));
1769
+ e.removeItem(Ye(t));
1690
1770
  } catch {
1691
1771
  }
1692
1772
  try {
1693
- e.removeItem(Je(t));
1773
+ e.removeItem(Xe(t));
1694
1774
  } catch {
1695
1775
  }
1696
1776
  }
1697
- function re(e, t) {
1777
+ function ie(e, t) {
1698
1778
  try {
1699
1779
  return e.getItem(t);
1700
1780
  } catch {
1701
1781
  return null;
1702
1782
  }
1703
1783
  }
1704
- function ie(e) {
1784
+ function oe(e) {
1705
1785
  try {
1706
1786
  return JSON.parse(e);
1707
1787
  } catch {
1708
1788
  return null;
1709
1789
  }
1710
1790
  }
1711
- function nt(e, t) {
1791
+ function it(e, t) {
1712
1792
  try {
1713
- return In(e, t);
1793
+ return An(e, t);
1714
1794
  } catch {
1715
1795
  return {
1716
1796
  palette: Array.from(
@@ -1728,46 +1808,51 @@ function nt(e, t) {
1728
1808
  }
1729
1809
  }
1730
1810
  export {
1731
- Zn as A,
1732
- Un as B,
1733
- sr as C,
1734
- mn as D,
1735
- rr as E,
1736
- tr as F,
1737
- Yn as G,
1738
- In as H,
1739
- Cn as I,
1740
- Jn as J,
1741
- Xn as K,
1742
- Ue as L,
1743
- Rn as M,
1744
- ne as N,
1745
- pe as O,
1746
- ir as Z,
1747
- Je as a,
1748
- We as b,
1811
+ Sn as A,
1812
+ rr as B,
1813
+ tr as C,
1814
+ xn as D,
1815
+ fr as E,
1816
+ ar as F,
1817
+ sr as G,
1818
+ Dn as H,
1819
+ yr as I,
1820
+ pr as J,
1821
+ ur as K,
1822
+ or as L,
1823
+ qn as M,
1824
+ An as N,
1825
+ nr as O,
1826
+ ir as P,
1827
+ et as Q,
1828
+ re as R,
1829
+ ye as S,
1830
+ dr as T,
1831
+ gr as Z,
1832
+ Xe as a,
1833
+ Ye as b,
1749
1834
  $ as c,
1750
- Ln as d,
1751
- ye as e,
1752
- Bn as f,
1753
- Gn as g,
1754
- zn as h,
1755
- _n as i,
1756
- Fn as j,
1757
- jn as k,
1758
- ar as l,
1759
- Kn as m,
1760
- On as n,
1761
- Dn as o,
1762
- se as p,
1763
- er as q,
1764
- be as r,
1765
- H as s,
1766
- nr as t,
1767
- or as u,
1768
- xn as v,
1769
- vn as w,
1770
- Wn as x,
1771
- qn as y,
1772
- Qn as z
1835
+ ue as d,
1836
+ le as e,
1837
+ $n as f,
1838
+ er as g,
1839
+ En as h,
1840
+ wn as i,
1841
+ Wn as j,
1842
+ Yn as k,
1843
+ mr as l,
1844
+ Un as m,
1845
+ Hn as n,
1846
+ Xn as o,
1847
+ Jn as p,
1848
+ Zn as q,
1849
+ Qn as r,
1850
+ E as s,
1851
+ fe as t,
1852
+ cr as u,
1853
+ Fn as v,
1854
+ lr as w,
1855
+ hr as x,
1856
+ br as y,
1857
+ kn as z
1773
1858
  };