builder-settings-types 0.0.323 → 0.0.325

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,22 +1,22 @@
1
1
  const bt = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
2
- let mt = (d = 21) => {
3
- let t = "", e = crypto.getRandomValues(new Uint8Array(d |= 0));
4
- for (; d--; )
5
- t += bt[e[d] & 63];
2
+ let mt = (h = 21) => {
3
+ let t = "", e = crypto.getRandomValues(new Uint8Array(h |= 0));
4
+ for (; h--; )
5
+ t += bt[e[h] & 63];
6
6
  return t;
7
7
  };
8
- function wt(d) {
9
- let t = 0, e = d.parentElement;
8
+ function wt(h) {
9
+ let t = 0, e = h.parentElement;
10
10
  for (; e; )
11
- e.classList.contains("setting-group") && e !== d && t++, e = e.parentElement;
11
+ e.classList.contains("setting-group") && e !== h && t++, e = e.parentElement;
12
12
  return t;
13
13
  }
14
- function Z(d, t) {
14
+ function Z(h, t) {
15
15
  const e = Math.min(Math.max(t, 0), 5);
16
- d.setAttribute("data-nesting-level", e.toString()), e > 0 ? d.style.setProperty("--visual-indent", `${e * 2}px`) : (d.style.removeProperty("--visual-indent"), d.style.marginLeft = "");
16
+ h.setAttribute("data-nesting-level", e.toString()), e > 0 ? h.style.setProperty("--visual-indent", `${e * 2}px`) : (h.style.removeProperty("--visual-indent"), h.style.marginLeft = "");
17
17
  }
18
- function et(d, t = 0) {
19
- d.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
18
+ function et(h, t = 0) {
19
+ h.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
20
20
  const s = i, n = t + 1;
21
21
  Z(s, n), et(s, n);
22
22
  });
@@ -112,20 +112,20 @@ class Lt {
112
112
  }
113
113
  }
114
114
  const rt = new Lt();
115
- function Y(d) {
116
- if (d === null || typeof d != "object") return d;
117
- if (d instanceof Date) return new Date(d.getTime());
118
- if (d instanceof Array) return d.map((t) => Y(t));
119
- if (typeof d == "object") {
115
+ function Y(h) {
116
+ if (h === null || typeof h != "object") return h;
117
+ if (h instanceof Date) return new Date(h.getTime());
118
+ if (h instanceof Array) return h.map((t) => Y(t));
119
+ if (typeof h == "object") {
120
120
  const t = {};
121
- for (const e in d)
122
- Object.prototype.hasOwnProperty.call(d, e) && (t[e] = Y(d[e]));
121
+ for (const e in h)
122
+ Object.prototype.hasOwnProperty.call(h, e) && (t[e] = Y(h[e]));
123
123
  return t;
124
124
  }
125
- return d;
125
+ return h;
126
126
  }
127
- function kt(d) {
128
- switch (d) {
127
+ function kt(h) {
128
+ switch (h) {
129
129
  case "number":
130
130
  return 0;
131
131
  case "text":
@@ -262,79 +262,79 @@ M.currentLanguageExplicitlySet = !1, M.languageChangeCallbacks = /* @__PURE__ */
262
262
  { title: "Text Color", keys: ["text-dark", "text-light"] }
263
263
  ];
264
264
  let x = M;
265
- function G(d) {
266
- return d instanceof x;
265
+ function G(h) {
266
+ return h instanceof x;
267
267
  }
268
- function k(d) {
269
- return d instanceof $;
268
+ function k(h) {
269
+ return h instanceof $;
270
270
  }
271
- function ct(d) {
272
- return G(d) || k(d);
271
+ function ct(h) {
272
+ return G(h) || k(h);
273
273
  }
274
- const ot = (d, t, e) => {
274
+ const ot = (h, t, e) => {
275
275
  let i = !1, s = 0, n = 0, o = 0, a = 0;
276
- const l = (h) => {
277
- if (h.target.closest("button")) return;
278
- i = !0, s = h.clientX, n = h.clientY;
279
- const p = t.getBoundingClientRect();
280
- o = p.left, a = p.top, document.addEventListener("mousemove", r), document.addEventListener("mouseup", c), document.body.style.userSelect = "none";
281
- }, r = (h) => {
276
+ const l = (p) => {
277
+ if (p.target.closest("button")) return;
278
+ i = !0, s = p.clientX, n = p.clientY;
279
+ const d = t.getBoundingClientRect();
280
+ o = d.left, a = d.top, document.addEventListener("mousemove", r), document.addEventListener("mouseup", c), document.body.style.userSelect = "none";
281
+ }, r = (p) => {
282
282
  if (!i) return;
283
- const p = h.clientX - s, g = h.clientY - n, f = window.innerWidth, m = window.innerHeight, u = t.offsetWidth, v = t.offsetHeight;
284
- let C = o + p, y = a + g;
285
- C = Math.max(8, Math.min(f - u - 8, C)), y = Math.max(8, Math.min(m - v - 8, y)), t.style.left = `${C}px`, t.style.top = `${y}px`, e == null || e(C, y);
283
+ const d = p.clientX - s, g = p.clientY - n, C = window.innerWidth, m = window.innerHeight, u = t.offsetWidth, v = t.offsetHeight;
284
+ let f = o + d, y = a + g;
285
+ f = Math.max(8, Math.min(C - u - 8, f)), y = Math.max(8, Math.min(m - v - 8, y)), t.style.left = `${f}px`, t.style.top = `${y}px`, e == null || e(f, y);
286
286
  }, c = () => {
287
287
  i = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", c), document.body.style.userSelect = "";
288
288
  };
289
- d.addEventListener("mousedown", l);
290
- }, W = (d) => {
291
- if (!d) return null;
292
- let t = d.trim();
289
+ h.addEventListener("mousedown", l);
290
+ }, F = (h) => {
291
+ if (!h) return null;
292
+ let t = h.trim();
293
293
  return !t.startsWith("#") || (t = t.slice(1), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), !/^[0-9a-fA-F]{6}$/.test(t)) ? null : `#${t.toUpperCase()}`;
294
- }, X = (d, t, e) => `#${[d, t, e].map((i) => Math.max(0, Math.min(255, i)).toString(16).padStart(2, "0")).join("")}`, P = (d) => {
295
- const t = d.replace("#", ""), e = t.length === 3 ? t.split("").map((i) => i + i).join("") : t;
294
+ }, X = (h, t, e) => `#${[h, t, e].map((i) => Math.max(0, Math.min(255, i)).toString(16).padStart(2, "0")).join("")}`, P = (h) => {
295
+ const t = h.replace("#", ""), e = t.length === 3 ? t.split("").map((i) => i + i).join("") : t;
296
296
  return {
297
297
  r: parseInt(e.slice(0, 2), 16),
298
298
  g: parseInt(e.slice(2, 4), 16),
299
299
  b: parseInt(e.slice(4, 6), 16)
300
300
  };
301
- }, z = (d) => {
302
- const { r: t, g: e, b: i } = P(d), s = t / 255, n = e / 255, o = i / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), r = a - l;
301
+ }, U = (h) => {
302
+ const { r: t, g: e, b: i } = P(h), s = t / 255, n = e / 255, o = i / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), r = a - l;
303
303
  let c = 0;
304
304
  r !== 0 && (a === s ? c = (n - o) / r % 6 : a === n ? c = (o - s) / r + 2 : c = (s - n) / r + 4), c < 0 && (c += 6);
305
- const h = a === 0 ? 0 : r / a, p = a;
306
- return { h: c * 60, s: h, v: p };
307
- }, U = (d, t, e) => {
308
- const i = (d % 360 + 360) % 360, s = e * t, n = s * (1 - Math.abs(i / 60 % 2 - 1)), o = e - s;
305
+ const p = a === 0 ? 0 : r / a, d = a;
306
+ return { h: c * 60, s: p, v: d };
307
+ }, W = (h, t, e) => {
308
+ const i = (h % 360 + 360) % 360, s = e * t, n = s * (1 - Math.abs(i / 60 % 2 - 1)), o = e - s;
309
309
  let a = 0, l = 0, r = 0;
310
310
  return i < 60 ? (a = s, l = n, r = 0) : i < 120 ? (a = n, l = s, r = 0) : i < 180 ? (a = 0, l = s, r = n) : i < 240 ? (a = 0, l = n, r = s) : i < 300 ? (a = n, l = 0, r = s) : (a = s, l = 0, r = n), X(
311
311
  Math.round((a + o) * 255),
312
312
  Math.round((l + o) * 255),
313
313
  Math.round((r + o) * 255)
314
314
  );
315
- }, vt = (d, t, e) => {
315
+ }, vt = (h, t, e) => {
316
316
  const i = e * (1 - t / 2), s = i === 0 || i === 1 ? 0 : (e - i) / Math.min(i, 1 - i);
317
- return { hue: d, sat: s, lightness: i };
318
- }, it = (d, t, e) => {
319
- const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(d / 60 % 2 - 1)), n = e - i / 2;
317
+ return { hue: h, sat: s, lightness: i };
318
+ }, it = (h, t, e) => {
319
+ const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(h / 60 % 2 - 1)), n = e - i / 2;
320
320
  let o = 0, a = 0, l = 0;
321
- return d < 60 ? (o = i, a = s, l = 0) : d < 120 ? (o = s, a = i, l = 0) : d < 180 ? (o = 0, a = i, l = s) : d < 240 ? (o = 0, a = s, l = i) : d < 300 ? (o = s, a = 0, l = i) : (o = i, a = 0, l = s), {
321
+ return h < 60 ? (o = i, a = s, l = 0) : h < 120 ? (o = s, a = i, l = 0) : h < 180 ? (o = 0, a = i, l = s) : h < 240 ? (o = 0, a = s, l = i) : h < 300 ? (o = s, a = 0, l = i) : (o = i, a = 0, l = s), {
322
322
  r: Math.round((o + n) * 255),
323
323
  g: Math.round((a + n) * 255),
324
324
  b: Math.round((l + n) * 255)
325
325
  };
326
- }, st = (d, t) => {
326
+ }, st = (h, t) => {
327
327
  const e = Math.max(0, Math.min(100, t)) / 100;
328
- if (d.startsWith("#")) {
329
- const { r: s, g: n, b: o } = P(d);
328
+ if (h.startsWith("#")) {
329
+ const { r: s, g: n, b: o } = P(h);
330
330
  return `rgba(${s}, ${n}, ${o}, ${e})`;
331
331
  }
332
- if (d.startsWith("rgba("))
333
- return d.replace(/,\s*[\d.]+\)$/, `, ${e})`);
334
- if (d.startsWith("rgb("))
335
- return d.replace("rgb(", "rgba(").replace(")", `, ${e})`);
336
- if (d.startsWith("hsl(")) {
337
- const s = d.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
332
+ if (h.startsWith("rgba("))
333
+ return h.replace(/,\s*[\d.]+\)$/, `, ${e})`);
334
+ if (h.startsWith("rgb("))
335
+ return h.replace("rgb(", "rgba(").replace(")", `, ${e})`);
336
+ if (h.startsWith("hsl(")) {
337
+ const s = h.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
338
338
  if (s) {
339
339
  const { r: n, g: o, b: a } = it(
340
340
  parseInt(s[1]),
@@ -344,8 +344,8 @@ const ot = (d, t, e) => {
344
344
  return `rgba(${n}, ${o}, ${a}, ${e})`;
345
345
  }
346
346
  }
347
- if (d.startsWith("hsla(")) {
348
- const s = d.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);
347
+ if (h.startsWith("hsla(")) {
348
+ const s = h.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);
349
349
  if (s) {
350
350
  const { r: n, g: o, b: a } = it(
351
351
  parseInt(s[1]),
@@ -355,13 +355,13 @@ const ot = (d, t, e) => {
355
355
  return `rgba(${n}, ${o}, ${a}, ${e})`;
356
356
  }
357
357
  }
358
- const i = W(d);
358
+ const i = F(h);
359
359
  if (i) {
360
360
  const { r: s, g: n, b: o } = P(i);
361
361
  return `rgba(${s}, ${n}, ${o}, ${e})`;
362
362
  }
363
- return d;
364
- }, Mt = (d) => [
363
+ return h;
364
+ }, Mt = (h) => [
365
365
  "red",
366
366
  "green",
367
367
  "blue",
@@ -385,18 +385,18 @@ const ot = (d, t, e) => {
385
385
  "teal",
386
386
  "fuchsia",
387
387
  "transparent"
388
- ].includes(d.toLowerCase()), ft = (d) => [
388
+ ].includes(h.toLowerCase()), ft = (h) => [
389
389
  /^#[0-9a-fA-F]{3,8}$/,
390
390
  /^rgba?\s*\([^)]+\)$/,
391
391
  /^hsla?\s*\([^)]+\)$/,
392
392
  /^[a-zA-Z]+$/
393
- ].some((e) => e.test(d.trim())), Nt = (d) => {
393
+ ].some((e) => e.test(h.trim())), Nt = (h) => {
394
394
  if (typeof document > "u")
395
- return ft(d) || !!W(d);
395
+ return ft(h) || !!F(h);
396
396
  const t = document.createElement("div");
397
- return t.style.color = d, t.style.color !== "";
398
- }, Ct = (d) => {
399
- const t = d.trim();
397
+ return t.style.color = h, t.style.color !== "";
398
+ }, Ct = (h) => {
399
+ const t = h.trim();
400
400
  if (/^#[0-9A-Fa-f]{8}$/.test(t)) {
401
401
  const n = t.slice(1), o = parseInt(n.slice(0, 2), 16), a = parseInt(n.slice(2, 4), 16), l = parseInt(n.slice(4, 6), 16), r = parseInt(n.slice(6, 8), 16);
402
402
  return {
@@ -431,12 +431,12 @@ const ot = (d, t, e) => {
431
431
  opacity: Math.round(l * 100)
432
432
  };
433
433
  }
434
- return { color: W(t) || t, position: 0, opacity: 100 };
435
- }, ht = (d) => {
434
+ return { color: F(t) || t, position: 0, opacity: 100 };
435
+ }, ht = (h) => {
436
436
  const t = [];
437
437
  let e = "", i = 0;
438
- for (let s = 0; s < d.length; s++) {
439
- const n = d[s];
438
+ for (let s = 0; s < h.length; s++) {
439
+ const n = h[s];
440
440
  if (n === "(") i++;
441
441
  else if (n === ")") i--;
442
442
  else if (n === "," && i === 0) {
@@ -446,16 +446,16 @@ const ot = (d, t, e) => {
446
446
  e += n;
447
447
  }
448
448
  return e.trim() && t.push(e.trim()), t;
449
- }, dt = (d, t) => {
450
- const e = new RegExp(`${t}\\s*\\(`, "i"), i = d.match(e);
449
+ }, dt = (h, t) => {
450
+ const e = new RegExp(`${t}\\s*\\(`, "i"), i = h.match(e);
451
451
  if (!i) return null;
452
452
  const s = i.index + i[0].length;
453
453
  let n = 1, o = s;
454
- for (let a = s; a < d.length && n > 0; a++)
455
- d[a] === "(" ? n++ : d[a] === ")" && n--, o = a;
456
- return n === 0 ? d.substring(s, o) : null;
457
- }, It = (d) => {
458
- const t = d.split(" ")[0].toLowerCase();
454
+ for (let a = s; a < h.length && n > 0; a++)
455
+ h[a] === "(" ? n++ : h[a] === ")" && n--, o = a;
456
+ return n === 0 ? h.substring(s, o) : null;
457
+ }, It = (h) => {
458
+ const t = h.split(" ")[0].toLowerCase();
459
459
  return [
460
460
  "circle",
461
461
  "ellipse",
@@ -466,31 +466,31 @@ const ot = (d, t, e) => {
466
466
  "at",
467
467
  "contain",
468
468
  "cover"
469
- ].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(d) || /^hsl/i.test(d) || Mt(t);
470
- }, pt = (d) => {
469
+ ].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(h) || /^hsl/i.test(h) || Mt(t);
470
+ }, pt = (h) => {
471
471
  const t = [];
472
- return d.forEach((e, i) => {
472
+ return h.forEach((e, i) => {
473
473
  const s = e.trim();
474
474
  if (!s) return;
475
475
  let n = "", o = 0;
476
476
  const a = s.match(/^(.+?)\s+(\d+(?:\.\d+)?)%?\s*$/);
477
- a && ft(a[1].trim()) ? (n = a[1].trim(), o = parseFloat(a[2])) : (n = s, o = d.length === 1 ? 0 : i / (d.length - 1) * 100);
477
+ a && ft(a[1].trim()) ? (n = a[1].trim(), o = parseFloat(a[2])) : (n = s, o = h.length === 1 ? 0 : i / (h.length - 1) * 100);
478
478
  const l = Ct(n);
479
479
  l.position = Math.max(0, Math.min(100, Math.round(o))), t.push(l);
480
480
  }), t;
481
- }, A = (d) => {
482
- const t = d.stops && d.stops.length ? d.stops : [{ color: "#000000", position: 0, opacity: 100 }];
481
+ }, A = (h) => {
482
+ const t = h.stops && h.stops.length ? h.stops : [{ color: "#000000", position: 0, opacity: 100 }];
483
483
  return {
484
- type: d.type && ["linear", "radial", "solid"].includes(d.type) ? d.type : "linear",
485
- angle: typeof d.angle == "number" ? d.angle : 90,
484
+ type: h.type && ["linear", "radial", "solid"].includes(h.type) ? h.type : "linear",
485
+ angle: typeof h.angle == "number" ? h.angle : 90,
486
486
  stops: t.map((e, i) => ({
487
487
  color: e.color || "#000000",
488
488
  position: typeof e.position == "number" ? e.position : t.length === 1 ? 0 : Math.round(i / (t.length - 1) * 100),
489
489
  opacity: e.opacity === void 0 || Number.isNaN(e.opacity) ? 100 : e.opacity
490
490
  }))
491
491
  };
492
- }, T = (d) => {
493
- const t = d.replace(/;$/, "").trim();
492
+ }, T = (h) => {
493
+ const t = h.replace(/;$/, "").trim();
494
494
  if (Nt(t)) {
495
495
  const s = Ct(t);
496
496
  return A({ type: "solid", angle: 0, stops: [s] });
@@ -522,21 +522,21 @@ const ot = (d, t, e) => {
522
522
  return o.length ? A({ type: "radial", angle: 0, stops: o }) : null;
523
523
  }
524
524
  return null;
525
- }, S = (d) => {
526
- if (d.type === "solid") {
527
- const e = d.stops[0], i = e.color;
525
+ }, S = (h) => {
526
+ if (h.type === "solid") {
527
+ const e = h.stops[0], i = e.color;
528
528
  if (i.startsWith("var(--"))
529
529
  return i;
530
530
  const s = e.opacity ?? 100, n = i.replace("#", ""), o = Math.round(s / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
531
531
  return `#${n}${o}`;
532
532
  }
533
- const t = d.stops.map(
533
+ const t = h.stops.map(
534
534
  (e) => `${st(e.color, e.opacity ?? 100)} ${e.position}%`
535
535
  ).join(", ");
536
- return d.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${d.angle}deg, ${t})`;
537
- }, St = (d) => Math.round(d / 100 * 255).toString(16).toUpperCase().padStart(2, "0"), K = (d) => {
538
- if (d.type === "solid") {
539
- const t = d.stops[0];
536
+ return h.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${h.angle}deg, ${t})`;
537
+ }, St = (h) => Math.round(h / 100 * 255).toString(16).toUpperCase().padStart(2, "0"), K = (h) => {
538
+ if (h.type === "solid") {
539
+ const t = h.stops[0];
540
540
  if (t) {
541
541
  const e = t.color;
542
542
  if (e.startsWith("var(--"))
@@ -552,7 +552,7 @@ const ot = (d, t, e) => {
552
552
  }
553
553
  return "#000000";
554
554
  }
555
- return d.type === "linear" ? `Linear ${d.angle}°` : "Radial Gradient";
555
+ return h.type === "linear" ? `Linear ${h.angle}°` : "Radial Gradient";
556
556
  }, q = class q {
557
557
  static defaults() {
558
558
  return {
@@ -563,7 +563,7 @@ const ot = (d, t, e) => {
563
563
  static normalizeList(t) {
564
564
  const e = /* @__PURE__ */ new Set(), i = [];
565
565
  return t.forEach((s) => {
566
- let n = W(s);
566
+ let n = F(s);
567
567
  n || T(s) && (n = s), n && (e.has(n) || (e.add(n), i.push(n)));
568
568
  }), i.slice(0, this.MAX_COLORS);
569
569
  }
@@ -609,7 +609,7 @@ const ot = (d, t, e) => {
609
609
  }
610
610
  static addColor(t, e) {
611
611
  if (!t) return;
612
- let i = W(t), s = "solid";
612
+ let i = F(t), s = "solid";
613
613
  if (i)
614
614
  s = "solid";
615
615
  else {
@@ -622,8 +622,8 @@ const ot = (d, t, e) => {
622
622
  }
623
623
  };
624
624
  q.STORAGE_KEY = "settingsLib_recentColors", q.MAX_COLORS = 12, q.colors = null;
625
- let F = q;
626
- const at = (d, t) => {
625
+ let R = q;
626
+ const at = (h, t) => {
627
627
  const e = document.createElement("div");
628
628
  e.className = "color-picker-recent-section";
629
629
  const i = document.createElement("div");
@@ -632,54 +632,54 @@ const at = (d, t) => {
632
632
  s.className = "color-picker-tooltip", s.style.display = "none", e.appendChild(s);
633
633
  const n = () => {
634
634
  s.style.display = "none";
635
- }, o = (c, h) => {
636
- const p = c.getBoundingClientRect();
637
- s.textContent = h, s.style.left = `${p.left + p.width / 2}px`, s.style.top = `${p.bottom + 8}px`, s.style.display = "block";
635
+ }, o = (c, p) => {
636
+ const d = c.getBoundingClientRect();
637
+ s.textContent = p, s.style.left = `${d.left + d.width / 2}px`, s.style.top = `${d.bottom + 8}px`, s.style.display = "block";
638
638
  }, a = document.createElement("div");
639
639
  a.className = "color-picker-recent-grid";
640
640
  const l = document.createElement("div");
641
641
  l.className = "color-picker-recent-placeholder", l.textContent = "No recent colors yet", e.appendChild(i), e.appendChild(a), e.appendChild(l);
642
642
  const r = () => {
643
643
  n(), a.innerHTML = "";
644
- const c = F.getColors(t);
644
+ const c = R.getColors(t);
645
645
  if (c.length === 0) {
646
646
  a.style.display = "none", l.style.display = "block";
647
647
  return;
648
648
  }
649
- a.style.display = "grid", l.style.display = "none", c.forEach((h) => {
650
- const p = document.createElement("button");
651
- p.type = "button", p.className = "color-picker-recent-swatch";
652
- const g = Vt(h);
653
- if (p.title = g, p.setAttribute("aria-label", `Use color: ${g}`), h.includes("gradient(")) {
654
- p.style.backgroundImage = h, p.style.backgroundColor = "transparent";
655
- const m = T(h);
656
- m && m.stops && m.stops.length > 0 && (p.style.borderColor = m.stops[0].color);
649
+ a.style.display = "grid", l.style.display = "none", c.forEach((p) => {
650
+ const d = document.createElement("button");
651
+ d.type = "button", d.className = "color-picker-recent-swatch";
652
+ const g = Vt(p);
653
+ if (d.title = g, d.setAttribute("aria-label", `Use color: ${g}`), p.includes("gradient(")) {
654
+ d.style.backgroundImage = p, d.style.backgroundColor = "transparent";
655
+ const m = T(p);
656
+ m && m.stops && m.stops.length > 0 && (d.style.borderColor = m.stops[0].color);
657
657
  } else
658
- p.style.backgroundColor = h, p.style.borderColor = h;
659
- p.addEventListener("mouseenter", () => o(p, g)), p.addEventListener("mouseleave", () => {
660
- n(), p.style.boxShadow = "";
661
- }), p.addEventListener("mousedown", () => {
662
- p.style.boxShadow = "0px 0px 0px 2px var(--grey40)";
663
- }), p.addEventListener("mouseup", () => {
658
+ d.style.backgroundColor = p, d.style.borderColor = p;
659
+ d.addEventListener("mouseenter", () => o(d, g)), d.addEventListener("mouseleave", () => {
660
+ n(), d.style.boxShadow = "";
661
+ }), d.addEventListener("mousedown", () => {
662
+ d.style.boxShadow = "0px 0px 0px 2px var(--grey40)";
663
+ }), d.addEventListener("mouseup", () => {
664
664
  setTimeout(() => {
665
- p.style.boxShadow = "";
665
+ d.style.boxShadow = "";
666
666
  }, 150);
667
- }), p.addEventListener("click", () => {
668
- n(), d(h);
669
- }), a.appendChild(p);
667
+ }), d.addEventListener("click", () => {
668
+ n(), h(p);
669
+ }), a.appendChild(d);
670
670
  });
671
671
  };
672
672
  return r(), { container: e, refresh: r };
673
- }, Vt = (d) => {
674
- const t = T(d);
673
+ }, Vt = (h) => {
674
+ const t = T(h);
675
675
  if (t)
676
676
  return K(t);
677
- const e = W(d);
677
+ const e = F(h);
678
678
  if (e) {
679
679
  const i = P(e);
680
680
  return `${e} (RGB: ${i.r}, ${i.g}, ${i.b})`;
681
681
  }
682
- return d;
682
+ return h;
683
683
  }, yt = `<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
684
684
  <path fill-rule="evenodd" clip-rule="evenodd"
685
685
  d="M6.12347 4.96653L1.41158 0.254304C1.25449 0.102568 1.04409 0.0186071 0.825694 0.0205049C0.607302 0.0224037 0.398393 0.110007 0.24396 0.26445C0.0895282 0.418893 0.0019303 0.627818 3.24698e-05 0.846225C-0.00186536 1.06463 0.0820894 1.27505 0.233815 1.43215L4.9457 6.14438L0.233814 10.8566C0.0820886 11.0137 -0.00186625 11.2241 3.15434e-05 11.4425C0.00192934 11.6609 0.0895272 11.8699 0.243959 12.0243C0.398392 12.1787 0.607301 12.2663 0.825693 12.2682C1.04408 12.2701 1.25449 12.1862 1.41158 12.0344L6.12347 7.32222L10.8354 12.0344C10.9932 12.1824 11.2023 12.2632 11.4186 12.2597C11.6349 12.2562 11.8414 12.1687 11.9943 12.0156C12.1472 11.8626 12.2346 11.6561 12.2379 11.4398C12.2413 11.2234 12.1604 11.0143 12.0123 10.8566L7.30123 6.14438L12.0131 1.43215C12.0927 1.35531 12.1561 1.2634 12.1998 1.16177C12.2434 1.06014 12.2664 0.950833 12.2674 0.84023C12.2683 0.729626 12.2473 0.61994 12.2054 0.517568C12.1635 0.415196 12.1017 0.322191 12.0234 0.243979C11.9452 0.165768 11.8522 0.103916 11.7499 0.0620327C11.6475 0.0201492 11.5378 -0.000927989 11.4272 3.33052e-05C11.3166 0.000993646 11.2073 0.0239743 11.1057 0.0676297C11.0041 0.111286 10.9122 0.174745 10.8354 0.254305L6.12347 4.96653Z"
@@ -760,77 +760,77 @@ class ut {
760
760
  r.className = "color-picker-sliders-group";
761
761
  const c = document.createElement("div");
762
762
  c.className = "color-picker-hue", this.hueSlider = c;
763
- const h = document.createElement("div");
764
- h.className = "color-picker-hue-marker", this.hueMarker = h, c.appendChild(h);
765
763
  const p = document.createElement("div");
766
- p.className = "color-picker-opacity", this.opacitySlider = p;
764
+ p.className = "color-picker-hue-marker", this.hueMarker = p, c.appendChild(p);
765
+ const d = document.createElement("div");
766
+ d.className = "color-picker-opacity", this.opacitySlider = d;
767
767
  const g = document.createElement("div");
768
- g.className = "color-picker-opacity-marker", this.opacityMarker = g, p.appendChild(g), r.appendChild(c), r.appendChild(p), a.appendChild(l), a.appendChild(r);
769
- const f = at((E) => {
768
+ g.className = "color-picker-opacity-marker", this.opacityMarker = g, d.appendChild(g), r.appendChild(c), r.appendChild(d), a.appendChild(l), a.appendChild(r);
769
+ const C = at((E) => {
770
770
  var w;
771
771
  this.setColor(E), (w = this.onChange) == null || w.call(this, E, this.currentOpacity);
772
772
  }, this.recentScope);
773
- this.recentSectionRefresh = f.refresh;
773
+ this.recentSectionRefresh = C.refresh;
774
774
  const m = document.createElement("div");
775
775
  m.className = "color-picker-format-section";
776
776
  const u = document.createElement("select");
777
777
  u.className = "color-picker-format-select", this.select = u;
778
778
  const v = document.createElement("option");
779
779
  v.value = "hex", v.textContent = "HEX";
780
- const C = document.createElement("option");
781
- C.value = "rgb", C.textContent = "RGB";
780
+ const f = document.createElement("option");
781
+ f.value = "rgb", f.textContent = "RGB";
782
782
  const y = document.createElement("option");
783
- y.value = "hsl", y.textContent = "HSL", u.appendChild(v), u.appendChild(C), u.appendChild(y);
783
+ y.value = "hsl", y.textContent = "HSL", u.appendChild(v), u.appendChild(f), u.appendChild(y);
784
784
  const b = document.createElement("input");
785
785
  b.type = "text", b.className = "color-picker-color-input", b.value = this.currentColor, this.input = b;
786
786
  const L = document.createElement("div");
787
787
  L.className = "color-picker-input-container";
788
788
  const I = document.createElement("button");
789
- return I.className = "color-picker-copy-inside", I.textContent = "Copy", L.appendChild(b), L.appendChild(I), m.appendChild(u), m.appendChild(L), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(f.container), t.appendChild(m), t.addEventListener("click", (E) => E.stopPropagation()), this.bind(n, c, p, b, u, I, l), t;
789
+ return I.className = "color-picker-copy-inside", I.textContent = "Copy", L.appendChild(b), L.appendChild(I), m.appendChild(u), m.appendChild(L), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(C.container), t.appendChild(m), t.addEventListener("click", (E) => E.stopPropagation()), this.bind(n, c, d, b, u, I, l), t;
790
790
  }
791
791
  createBackdrop() {
792
792
  const t = document.createElement("div");
793
793
  return t.className = "color-picker-backdrop", t.style.display = "none", t.style.pointerEvents = "none", t;
794
794
  }
795
795
  bind(t, e, i, s, n, o, a) {
796
- const l = (h) => {
797
- var C;
798
- const p = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - p.left) / p.width)), f = Math.max(0, Math.min(1, (h.clientY - p.top) / p.height));
799
- this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${f * 100}%`;
800
- const u = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, v = U(u, g, 1 - f);
801
- this.currentColor = v, this.syncInput(), this.updateOpacityBg(), (C = this.onChange) == null || C.call(this, v, this.currentOpacity);
802
- }, r = (h) => {
803
- var C;
804
- const p = e.getBoundingClientRect();
805
- let g = Math.max(0, Math.min(1, (h.clientX - p.left) / p.width));
806
- this.hueMarker.style.left = `${g * 100}%`;
807
- const f = g * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), u = this.parsePercentage(this.colorMarker.style.top || "0%"), v = U(f, m, 1 - u);
808
- this.currentColor = v, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${f}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (C = this.onChange) == null || C.call(this, v, this.currentOpacity);
809
- }, c = (h) => {
796
+ const l = (p) => {
810
797
  var f;
811
- const p = i.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - p.left) / p.width));
812
- this.opacityMarker.style.left = `${g * 100}%`, this.currentOpacity = Math.round(g * 100), (f = this.onChange) == null || f.call(this, this.currentColor, this.currentOpacity);
798
+ const d = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width)), C = Math.max(0, Math.min(1, (p.clientY - d.top) / d.height));
799
+ this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${C * 100}%`;
800
+ const u = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, v = W(u, g, 1 - C);
801
+ this.currentColor = v, this.syncInput(), this.updateOpacityBg(), (f = this.onChange) == null || f.call(this, v, this.currentOpacity);
802
+ }, r = (p) => {
803
+ var f;
804
+ const d = e.getBoundingClientRect();
805
+ let g = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width));
806
+ this.hueMarker.style.left = `${g * 100}%`;
807
+ const C = g * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), u = this.parsePercentage(this.colorMarker.style.top || "0%"), v = W(C, m, 1 - u);
808
+ this.currentColor = v, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${C}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (f = this.onChange) == null || f.call(this, v, this.currentOpacity);
809
+ }, c = (p) => {
810
+ var C;
811
+ const d = i.getBoundingClientRect(), g = Math.max(0, Math.min(1, (p.clientX - d.left) / d.width));
812
+ this.opacityMarker.style.left = `${g * 100}%`, this.currentOpacity = Math.round(g * 100), (C = this.onChange) == null || C.call(this, this.currentColor, this.currentOpacity);
813
813
  };
814
- t.addEventListener("mousedown", (h) => {
815
- h.preventDefault(), l(h);
816
- const p = (f) => l(f), g = () => {
817
- document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
814
+ t.addEventListener("mousedown", (p) => {
815
+ p.preventDefault(), l(p);
816
+ const d = (C) => l(C), g = () => {
817
+ document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g);
818
818
  };
819
- document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
820
- }), e.addEventListener("mousedown", (h) => {
821
- h.preventDefault(), r(h);
822
- const p = (f) => r(f), g = () => {
823
- document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
819
+ document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
820
+ }), e.addEventListener("mousedown", (p) => {
821
+ p.preventDefault(), r(p);
822
+ const d = (C) => r(C), g = () => {
823
+ document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g);
824
824
  };
825
- document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
826
- }), i.addEventListener("mousedown", (h) => {
827
- h.preventDefault(), c(h);
828
- const p = (f) => c(f), g = () => {
829
- document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
825
+ document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
826
+ }), i.addEventListener("mousedown", (p) => {
827
+ p.preventDefault(), c(p);
828
+ const d = (C) => c(C), g = () => {
829
+ document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g);
830
830
  };
831
- document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
832
- }), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (h) => {
833
- h.key === "Enter" && (h.preventDefault(), this.syncInput(), s.blur());
831
+ document.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
832
+ }), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (p) => {
833
+ p.key === "Enter" && (p.preventDefault(), this.syncInput(), s.blur());
834
834
  }), o.addEventListener("click", async () => {
835
835
  try {
836
836
  await navigator.clipboard.writeText(s.value);
@@ -838,14 +838,14 @@ class ut {
838
838
  s.select(), document.execCommand("copy");
839
839
  }
840
840
  }), a.addEventListener("click", async () => {
841
- var h;
841
+ var p;
842
842
  if (!("EyeDropper" in window)) {
843
843
  alert("EyeDropper API is not supported in this browser.");
844
844
  return;
845
845
  }
846
846
  try {
847
- const p = new window.EyeDropper(), { sRGBHex: g } = await p.open();
848
- this.setColor(g), (h = this.onChange) == null || h.call(this, g, this.currentOpacity);
847
+ const d = new window.EyeDropper(), { sRGBHex: g } = await d.open();
848
+ this.setColor(g), (p = this.onChange) == null || p.call(this, g, this.currentOpacity);
849
849
  } catch {
850
850
  }
851
851
  }), document.addEventListener("keydown", this.keyDown, !0), setTimeout(
@@ -856,11 +856,11 @@ class ut {
856
856
  setColor(t) {
857
857
  var o;
858
858
  this.currentColor = t;
859
- const { h: e, s: i, v: s } = z(t), n = e >= 360 ? e % 360 : e;
859
+ const { h: e, s: i, v: s } = U(t), n = e >= 360 ? e % 360 : e;
860
860
  this.hueMarker.style.left = `${n / 360 * 100}%`, this.colorMarker.style.left = `${i * 100}%`, this.colorMarker.style.top = `${(1 - s) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (o = this.onChange) == null || o.call(this, t, this.currentOpacity);
861
861
  }
862
862
  syncInput() {
863
- const t = this.select.value, { h: e, s: i, v: s } = z(this.currentColor);
863
+ const t = this.select.value, { h: e, s: i, v: s } = U(this.currentColor);
864
864
  if (t === "hex") this.input.value = this.currentColor;
865
865
  else if (t === "rgb") {
866
866
  const { r: n, g: o, b: a } = P(this.currentColor);
@@ -885,7 +885,7 @@ class ut {
885
885
  const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
886
886
  if (s) {
887
887
  const n = parseInt(s[1]), o = parseInt(s[2]) / 100, a = parseInt(s[3]) / 100, l = a + o * Math.min(a, 1 - a), r = l === 0 ? 0 : 2 * (1 - a / l);
888
- e = U(n, r, l);
888
+ e = W(n, r, l);
889
889
  }
890
890
  }
891
891
  }
@@ -901,18 +901,18 @@ class ut {
901
901
  open(t, e, i) {
902
902
  var y;
903
903
  this.currentColor = t, this.currentOpacity = i ?? 100, this.syncInput();
904
- const { h: s, s: n, v: o } = z(t);
904
+ const { h: s, s: n, v: o } = U(t);
905
905
  this.hueMarker.style.left = `${s / 360 * 100}%`, this.colorMarker.style.left = `${n * 100}%`, this.colorMarker.style.top = `${(1 - o) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${s}, 100%, 50%))`, this.updateOpacityBg(), this.opacityMarker.style.left = `${this.currentOpacity}%`, (y = this.recentSectionRefresh) == null || y.call(this), this.isOpen = !0, this.backdrop.style.display = "block", this.backdrop.parentElement || document.body.appendChild(this.backdrop), this.element.style.display = "block", this.element.style.position = "fixed", this.element.style.zIndex = "10002", this.element.style.left = "-9999px", this.element.style.top = "0px", this.element.parentElement || document.body.appendChild(this.element);
906
- const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), c = window.innerWidth, h = window.innerHeight, p = 16;
907
- let g = r.right + 8, f = r.top;
906
+ const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), c = window.innerWidth, p = window.innerHeight, d = 16;
907
+ let g = r.right + 8, C = r.top;
908
908
  const m = c - r.right, u = r.left;
909
- m >= a + p ? g = r.right + 8 : u >= a + p ? g = r.left - a - 8 : g = Math.max(p, (c - a) / 2);
910
- const v = h - r.bottom, C = r.top;
911
- v >= l + p ? f = r.bottom + 8 : C >= l + p ? f = r.top - l - 8 : v > C ? (f = r.bottom + 8, f + l > h - p && (f = h - l - p)) : (f = r.top - l - 8, f < p && (f = p)), this.element.style.left = `${g}px`, this.element.style.top = `${f}px`;
909
+ m >= a + d ? g = r.right + 8 : u >= a + d ? g = r.left - a - 8 : g = Math.max(d, (c - a) / 2);
910
+ const v = p - r.bottom, f = r.top;
911
+ v >= l + d ? C = r.bottom + 8 : f >= l + d ? C = r.top - l - 8 : v > f ? (C = r.bottom + 8, C + l > p - d && (C = p - l - d)) : (C = r.top - l - 8, C < d && (C = d)), this.element.style.left = `${g}px`, this.element.style.top = `${C}px`;
912
912
  }
913
913
  close(t) {
914
914
  var e;
915
- this.isOpen && (this.isOpen = !1, this.backdrop.style.display = "none", this.element.style.display = "none", document.removeEventListener("click", this.outsideClick, !0), document.removeEventListener("keydown", this.keyDown, !0), t && this.onChange && this.recentScope === "solid" && (F.addColor(this.currentColor, this.recentScope), (e = this.recentSectionRefresh) == null || e.call(this)));
915
+ this.isOpen && (this.isOpen = !1, this.backdrop.style.display = "none", this.element.style.display = "none", document.removeEventListener("click", this.outsideClick, !0), document.removeEventListener("keydown", this.keyDown, !0), t && this.onChange && this.recentScope === "solid" && (R.addColor(this.currentColor, this.recentScope), (e = this.recentSectionRefresh) == null || e.call(this)));
916
916
  }
917
917
  getElement() {
918
918
  return this.element;
@@ -920,12 +920,19 @@ class ut {
920
920
  }
921
921
  class Bt {
922
922
  constructor(t) {
923
- this.isDragging = !1, this.currentColor = t.initialColor, this.currentOpacity = t.initialOpacity, this.onColorChange = t.onColorChange, this.recentScope = t.scope ?? "solid", this.element = this.build(), this.initFromColor(this.currentColor, this.currentOpacity);
923
+ this.isDragging = !1, this.currentColor = "#FFFFFF", this.currentColor = this.sanitizeColor(t.initialColor), this.currentOpacity = this.clampOpacity(t.initialOpacity), this.onColorChange = t.onColorChange, this.recentScope = t.scope ?? "solid", this.element = this.build(), this.initFromColor(this.currentColor, this.currentOpacity);
924
924
  }
925
925
  parsePercentage(t) {
926
926
  const e = parseFloat(t);
927
927
  return isNaN(e) ? 0 : e / 100;
928
928
  }
929
+ sanitizeColor(t) {
930
+ const e = this.currentColor || "#FFFFFF";
931
+ return F(t) ?? e;
932
+ }
933
+ clampOpacity(t) {
934
+ return Number.isFinite(t) ? Math.min(100, Math.max(0, Math.round(t))) : 100;
935
+ }
929
936
  build() {
930
937
  const t = document.createElement("div");
931
938
  t.className = "embedded-color-picker";
@@ -947,70 +954,71 @@ class Bt {
947
954
  r.className = "color-picker-opacity embedded", this.opacitySlider = r;
948
955
  const c = document.createElement("div");
949
956
  c.className = "color-picker-opacity-marker", this.opacityMarker = c, r.appendChild(c), o.appendChild(a), o.appendChild(r), s.appendChild(n), s.appendChild(o);
950
- const h = at((b) => {
957
+ const p = at((b) => {
951
958
  const L = T(b);
952
959
  L && L.type !== "solid" ? this.onColorChange(b, this.currentOpacity) : (this.setColor(b), this.onColorChange(this.currentColor, this.currentOpacity));
953
960
  }, "all");
954
- this.recentSectionRefresh = h.refresh;
955
- const p = document.createElement("div");
956
- p.className = "color-picker-format-section embedded";
961
+ this.recentSectionRefresh = p.refresh;
962
+ const d = document.createElement("div");
963
+ d.className = "color-picker-format-section embedded";
957
964
  const g = document.createElement("select");
958
965
  g.className = "color-picker-format-select", this.select = g;
959
- const f = document.createElement("option");
960
- f.value = "hex", f.textContent = "HEX";
966
+ const C = document.createElement("option");
967
+ C.value = "hex", C.textContent = "HEX";
961
968
  const m = document.createElement("option");
962
969
  m.value = "rgb", m.textContent = "RGB";
963
970
  const u = document.createElement("option");
964
- u.value = "hsl", u.textContent = "HSL", g.appendChild(f), g.appendChild(m), g.appendChild(u);
971
+ u.value = "hsl", u.textContent = "HSL", g.appendChild(C), g.appendChild(m), g.appendChild(u);
965
972
  const v = document.createElement("input");
966
973
  v.type = "text", v.className = "color-picker-color-input", this.input = v;
967
- const C = document.createElement("div");
968
- C.className = "color-picker-input-container";
974
+ const f = document.createElement("div");
975
+ f.className = "color-picker-input-container";
969
976
  const y = document.createElement("button");
970
- return y.className = "color-picker-copy-inside", y.textContent = "Copy", C.appendChild(v), C.appendChild(y), p.appendChild(g), p.appendChild(C), t.appendChild(e), t.appendChild(s), t.appendChild(p), t.appendChild(h.container), this.bind(e, a, r, v, g, y, n), t;
977
+ return y.className = "color-picker-copy-inside", y.textContent = "Copy", f.appendChild(v), f.appendChild(y), d.appendChild(g), d.appendChild(f), t.appendChild(e), t.appendChild(s), t.appendChild(d), t.appendChild(p.container), this.bind(e, a, r, v, g, y, n), t;
971
978
  }
972
979
  bind(t, e, i, s, n, o, a) {
973
- const l = (h) => {
974
- const p = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - p.left) / p.width)), f = Math.max(0, Math.min(1, (h.clientY - p.top) / p.height));
975
- this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${f * 100}%`;
976
- const u = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, v = U(u, g, 1 - f);
977
- this.currentColor = v, this.syncInput(), this.updateOpacityBg(), this.queueChange();
978
- }, r = (h) => {
979
- const p = e.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - p.left) / p.width));
980
- this.hueMarker.style.left = `${g * 100}%`;
981
- const f = g * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), u = this.parsePercentage(this.colorMarker.style.top || "0%"), v = U(f, m, 1 - u);
982
- this.currentColor = v, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
983
- linear-gradient(to right, #fff, hsl(${f}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), this.queueChange();
984
- }, c = (h) => {
985
- const p = i.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - p.left) / p.width));
986
- this.opacityMarker.style.left = `${g * 100}%`, this.currentOpacity = Math.round(g * 100), this.queueChange();
987
- };
988
- t.addEventListener("mousedown", (h) => {
989
- h.preventDefault(), this.isDragging = !0, l(h);
990
- const p = (f) => l(f), g = () => {
991
- this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g), this.applyPendingExternal();
992
- };
993
- document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
994
- }), e.addEventListener("mousedown", (h) => {
995
- h.preventDefault(), this.isDragging = !0, r(h);
996
- const p = (f) => r(f), g = () => {
997
- this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g), this.applyPendingExternal();
980
+ const l = (d) => {
981
+ const g = t.getBoundingClientRect(), C = Math.max(0, Math.min(1, (d.clientX - g.left) / g.width)), m = Math.max(0, Math.min(1, (d.clientY - g.top) / g.height));
982
+ this.colorMarker.style.left = `${C * 100}%`, this.colorMarker.style.top = `${m * 100}%`;
983
+ const v = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, f = W(v, C, 1 - m);
984
+ this.currentColor = f, this.syncInput(), this.updateOpacityBg(), this.queueChange();
985
+ }, r = (d) => {
986
+ const g = e.getBoundingClientRect(), C = Math.max(0, Math.min(1, (d.clientX - g.left) / g.width));
987
+ this.hueMarker.style.left = `${C * 100}%`;
988
+ const m = C * 360, u = this.parsePercentage(this.colorMarker.style.left || "0%"), v = this.parsePercentage(this.colorMarker.style.top || "0%"), f = W(m, u, 1 - v);
989
+ this.currentColor = f, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
990
+ linear-gradient(to right, #fff, hsl(${m}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), this.queueChange();
991
+ }, c = (d) => {
992
+ const g = i.getBoundingClientRect(), C = Math.max(0, Math.min(1, (d.clientX - g.left) / g.width));
993
+ this.opacityMarker.style.left = `${C * 100}%`, this.currentOpacity = this.clampOpacity(C * 100), this.queueChange();
994
+ }, p = (d, g) => {
995
+ d.preventDefault(), this.isDragging = !0, g(d);
996
+ let C;
997
+ const m = () => {
998
+ this.isDragging && (this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", C), document.removeEventListener("mouseup", m), window.removeEventListener("blur", m), this.applyPendingExternal());
998
999
  };
999
- document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
1000
- }), i.addEventListener("mousedown", (h) => {
1001
- h.preventDefault(), this.isDragging = !0, c(h);
1002
- const p = (f) => c(f), g = () => {
1003
- this.isDragging = !1, this.flushChange(), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g), this.applyPendingExternal();
1004
- };
1005
- document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
1000
+ C = (u) => {
1001
+ if (!u.buttons) {
1002
+ m();
1003
+ return;
1004
+ }
1005
+ g(u);
1006
+ }, document.addEventListener("mousemove", C), document.addEventListener("mouseup", m), window.addEventListener("blur", m);
1007
+ };
1008
+ t.addEventListener("mousedown", (d) => {
1009
+ p(d, l);
1010
+ }), e.addEventListener("mousedown", (d) => {
1011
+ p(d, r);
1012
+ }), i.addEventListener("mousedown", (d) => {
1013
+ p(d, c);
1006
1014
  }), n.addEventListener("change", () => {
1007
1015
  this.syncInput();
1008
1016
  }), s.addEventListener("input", () => {
1009
1017
  this.applyFromInput();
1010
1018
  }), s.addEventListener("blur", () => {
1011
1019
  this.syncInput();
1012
- }), s.addEventListener("keydown", (h) => {
1013
- h.key === "Enter" && (h.preventDefault(), this.syncInput(), s.blur());
1020
+ }), s.addEventListener("keydown", (d) => {
1021
+ d.key === "Enter" && (d.preventDefault(), this.syncInput(), s.blur());
1014
1022
  }), o.addEventListener("click", async () => {
1015
1023
  try {
1016
1024
  await navigator.clipboard.writeText(s.value);
@@ -1023,20 +1031,21 @@ class Bt {
1023
1031
  return;
1024
1032
  }
1025
1033
  try {
1026
- const h = new window.EyeDropper(), { sRGBHex: p } = await h.open();
1027
- this.setColor(p), this.onColorChange(this.currentColor, this.currentOpacity);
1034
+ const d = new window.EyeDropper(), { sRGBHex: g } = await d.open();
1035
+ this.setColor(g), this.onColorChange(this.currentColor, this.currentOpacity);
1028
1036
  } catch {
1029
1037
  }
1030
1038
  });
1031
1039
  }
1032
1040
  setColor(t) {
1033
- this.currentColor = t;
1034
- const { h: e, s: i, v: s } = z(t), n = e >= 360 ? e % 360 : e;
1035
- this.hueMarker.style.left = `${n / 360 * 100}%`, this.colorMarker.style.left = `${i * 100}%`, this.colorMarker.style.top = `${(1 - s) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
1036
- linear-gradient(to right, #fff, hsl(${n}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg();
1041
+ const e = this.sanitizeColor(t);
1042
+ this.currentColor = e;
1043
+ const { h: i, s, v: n } = U(e), o = i >= 360 ? i % 360 : i;
1044
+ this.hueMarker.style.left = `${o / 360 * 100}%`, this.colorMarker.style.left = `${s * 100}%`, this.colorMarker.style.top = `${(1 - n) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
1045
+ linear-gradient(to right, #fff, hsl(${o}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg();
1037
1046
  }
1038
1047
  syncInput() {
1039
- const t = this.select.value, { h: e, s: i, v: s } = z(this.currentColor);
1048
+ const t = this.select.value, { h: e, s: i, v: s } = U(this.currentColor);
1040
1049
  if (t === "hex")
1041
1050
  this.input.value = this.currentColor;
1042
1051
  else if (t === "rgb") {
@@ -1063,7 +1072,7 @@ class Bt {
1063
1072
  const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
1064
1073
  if (s) {
1065
1074
  const n = parseInt(s[1], 10), o = parseInt(s[2], 10) / 100, a = parseInt(s[3], 10) / 100, l = a + o * Math.min(a, 1 - a), r = l === 0 ? 0 : 2 * (1 - a / l);
1066
- e = U(n, r, l);
1075
+ e = W(n, r, l);
1067
1076
  }
1068
1077
  }
1069
1078
  }
@@ -1090,15 +1099,16 @@ class Bt {
1090
1099
  this.pendingExternalUpdate = void 0, this.initFromColor(t, e);
1091
1100
  }
1092
1101
  initFromColor(t, e) {
1093
- var a;
1094
- this.currentColor = t, this.currentOpacity = e;
1095
- const { h: i, s, v: n } = z(t), o = i >= 360 ? i % 360 : i;
1096
- this.hueMarker.style.left = `${o / 360 * 100}%`, this.colorMarker.style.left = `${s * 100}%`, this.colorMarker.style.top = `${(1 - n) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
1097
- linear-gradient(to right, #fff, hsl(${o}, 100%, 50%))`, this.opacityMarker.style.left = `${e}%`, this.updateOpacityBg(), this.syncInput(), (a = this.recentSectionRefresh) == null || a.call(this);
1102
+ var l;
1103
+ const i = this.sanitizeColor(t);
1104
+ this.currentColor = i, this.currentOpacity = this.clampOpacity(e);
1105
+ const { h: s, s: n, v: o } = U(i), a = s >= 360 ? s % 360 : s;
1106
+ this.hueMarker.style.left = `${a / 360 * 100}%`, this.colorMarker.style.left = `${n * 100}%`, this.colorMarker.style.top = `${(1 - o) * 100}%`, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
1107
+ linear-gradient(to right, #fff, hsl(${a}, 100%, 50%))`, this.opacityMarker.style.left = `${this.currentOpacity}%`, this.updateOpacityBg(), this.syncInput(), (l = this.recentSectionRefresh) == null || l.call(this);
1098
1108
  }
1099
1109
  commitRecentColor() {
1100
1110
  var t;
1101
- this.recentScope === "solid" && (F.addColor(this.currentColor, this.recentScope), (t = this.recentSectionRefresh) == null || t.call(this));
1111
+ this.recentScope === "solid" && (R.addColor(this.currentColor, this.recentScope), (t = this.recentSectionRefresh) == null || t.call(this));
1102
1112
  }
1103
1113
  getElement() {
1104
1114
  return this.element;
@@ -1123,10 +1133,10 @@ const V = class V extends x {
1123
1133
  angle: "number",
1124
1134
  stops: "text"
1125
1135
  }, this.element = null, this.previewEl = null, this.inputEl = void 0, this.popoverEl = null, this.backdropEl = null, this.isPopoverOpen = !1, this.isEditing = !1, this.popoverPosition = null, this.previewUpdateTimeout = null, this.changeDebounceTimeout = null, this.solidPicker = null, this.pendingSolidColor = null, this.variant = "default", this.globalLayoutMode = "list", this.globalSearchQuery = "", this.currentMode = "custom", this.linkedGlobalVariable = null, this.unlinkButton = null, this.onBackgroundClick = (i) => {
1126
- var p;
1136
+ var d;
1127
1137
  if (!this.popoverEl || !this.isPopoverOpen) return;
1128
- const s = i.target, n = this.popoverEl.contains(s), o = (p = this.element) == null ? void 0 : p.contains(s), a = document.querySelectorAll(".custom-color-picker"), l = Array.from(a).some((g) => g.contains(s)), r = s.closest(".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"), c = s.classList.contains("color-picker-backdrop"), h = s.classList.contains("gradient-popover-backdrop");
1129
- !n && !o && !l && !r && !c && !h && this.closePopover();
1138
+ const s = i.target, n = this.popoverEl.contains(s), o = (d = this.element) == null ? void 0 : d.contains(s), a = document.querySelectorAll(".custom-color-picker"), l = Array.from(a).some((g) => g.contains(s)), r = s.closest(".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"), c = s.classList.contains("color-picker-backdrop"), p = s.classList.contains("gradient-popover-backdrop");
1139
+ !n && !o && !l && !r && !c && !p && this.closePopover();
1130
1140
  }, this.handlePopoverKeydown = (i) => {
1131
1141
  if (this.isPopoverOpen) {
1132
1142
  if (i.key === "Escape") {
@@ -1308,8 +1318,8 @@ const V = class V extends x {
1308
1318
  n.appendChild(o), s.appendChild(n);
1309
1319
  const a = document.createElement("div");
1310
1320
  if (a.className = "gradient-editor-content", this.updatePopoverContent(a), s.appendChild(a), this.variant !== "global" && e) {
1311
- const l = e.children[0], r = e.children[1], c = (h) => {
1312
- this.currentMode = h, h === "custom" ? (l.classList.add("active"), r.classList.remove("active"), n.style.display = "block") : (r.classList.add("active"), l.classList.remove("active"), n.style.display = "none"), this.updatePopoverContent(a);
1321
+ const l = e.children[0], r = e.children[1], c = (p) => {
1322
+ this.currentMode = p, p === "custom" ? (l.classList.add("active"), r.classList.remove("active"), n.style.display = "block") : (r.classList.add("active"), l.classList.remove("active"), n.style.display = "none"), this.updatePopoverContent(a);
1313
1323
  };
1314
1324
  l.addEventListener("click", () => c("custom")), r.addEventListener("click", () => c("global")), this.isBoundToGlobal() ? (this.currentMode = "global", c("global")) : (this.currentMode = "custom", c("custom"));
1315
1325
  }
@@ -1376,48 +1386,48 @@ const V = class V extends x {
1376
1386
  }
1377
1387
  renderGlobalColors(t) {
1378
1388
  (!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
1379
- const e = this.value.stops[0], i = (h) => {
1380
- h.innerHTML = "";
1381
- let p = {};
1389
+ const e = this.value.stops[0], i = (p) => {
1390
+ p.innerHTML = "";
1391
+ let d = {};
1382
1392
  try {
1383
- p = x.GlobalVariables || {};
1393
+ d = x.GlobalVariables || {};
1384
1394
  } catch (u) {
1385
1395
  console.warn("Could not access Setting.GlobalVariables", u);
1386
1396
  }
1387
- if (!p || Object.keys(p).length === 0) {
1397
+ if (!d || Object.keys(d).length === 0) {
1388
1398
  const u = document.createElement("div");
1389
- u.textContent = "No global colors defined", u.style.fontSize = "12px", u.style.color = "#666", u.style.padding = "8px", h.appendChild(u);
1399
+ u.textContent = "No global colors defined", u.style.fontSize = "12px", u.style.color = "#666", u.style.padding = "8px", p.appendChild(u);
1390
1400
  return;
1391
1401
  }
1392
1402
  const g = x.GlobalVariableGroups || [
1393
1403
  { title: "Global Colors", keys: ["primary", "secondary", "tertiary", "accent"] },
1394
1404
  { title: "Text Color", keys: ["text-dark", "text-light"] }
1395
- ], f = this.globalSearchQuery.toLowerCase();
1405
+ ], C = this.globalSearchQuery.toLowerCase();
1396
1406
  let m;
1397
- this.globalLayoutMode === "list" ? (m = document.createElement("div"), m.className = "global-colors-list") : (m = document.createElement("div"), m.className = "global-colors-grid"), h.appendChild(m), g.forEach((u) => {
1398
- const v = Object.entries(p).filter(([C]) => !u.keys.includes(C) && u.title !== "Global Colors" ? !1 : u.keys.includes(C) && C.toLowerCase().includes(f));
1399
- v.length !== 0 && v.forEach(([C, y]) => {
1407
+ this.globalLayoutMode === "list" ? (m = document.createElement("div"), m.className = "global-colors-list") : (m = document.createElement("div"), m.className = "global-colors-grid"), p.appendChild(m), g.forEach((u) => {
1408
+ const v = Object.entries(d).filter(([f]) => !u.keys.includes(f) && u.title !== "Global Colors" ? !1 : u.keys.includes(f) && f.toLowerCase().includes(C));
1409
+ v.length !== 0 && v.forEach(([f, y]) => {
1400
1410
  if (this.globalLayoutMode === "list") {
1401
1411
  const b = document.createElement("div");
1402
1412
  b.className = "global-color-row";
1403
1413
  const L = document.createElement("div");
1404
1414
  L.className = "global-color-circle";
1405
1415
  const I = this.resolveGlobalVarColor(y);
1406
- L.style.background = I, (this.linkedGlobalVariable === `var(--${C})` || e.color === `var(--${C})`) && L.classList.add("selected");
1416
+ L.style.background = I, (this.linkedGlobalVariable === `var(--${f})` || e.color === `var(--${f})`) && L.classList.add("selected");
1407
1417
  const w = document.createElement("span");
1408
- w.className = "global-color-label", w.textContent = C.split("-").map((N) => N.charAt(0).toUpperCase() + N.slice(1)).join(" "), b.appendChild(L), b.appendChild(w), b.addEventListener("click", (N) => {
1418
+ w.className = "global-color-label", w.textContent = f.split("-").map((N) => N.charAt(0).toUpperCase() + N.slice(1)).join(" "), b.appendChild(L), b.appendChild(w), b.addEventListener("click", (N) => {
1409
1419
  N.preventDefault();
1410
- const D = `var(--${C})`;
1411
- this.setValue(D), this.pendingSolidColor = D, i(h);
1420
+ const D = `var(--${f})`;
1421
+ this.setValue(D), this.pendingSolidColor = D, i(p);
1412
1422
  }), m.appendChild(b);
1413
1423
  } else {
1414
1424
  const b = document.createElement("div");
1415
1425
  b.className = "global-color-circle";
1416
1426
  const L = this.resolveGlobalVarColor(y);
1417
- b.style.background = L, b.title = C.split("-").map((E) => E.charAt(0).toUpperCase() + E.slice(1)).join(" "), (this.linkedGlobalVariable === `var(--${C})` || e.color === `var(--${C})`) && b.classList.add("selected"), b.addEventListener("click", (E) => {
1427
+ b.style.background = L, b.title = f.split("-").map((E) => E.charAt(0).toUpperCase() + E.slice(1)).join(" "), (this.linkedGlobalVariable === `var(--${f})` || e.color === `var(--${f})`) && b.classList.add("selected"), b.addEventListener("click", (E) => {
1418
1428
  E.preventDefault();
1419
- const w = `var(--${C})`;
1420
- this.setValue(w), this.pendingSolidColor = w, i(h);
1429
+ const w = `var(--${f})`;
1430
+ this.setValue(w), this.pendingSolidColor = w, i(p);
1421
1431
  }), m.appendChild(b);
1422
1432
  }
1423
1433
  });
@@ -1431,8 +1441,8 @@ const V = class V extends x {
1431
1441
  const a = document.createElement("input");
1432
1442
  a.type = "text", a.className = "global-search-input", a.placeholder = "Search", a.value = this.globalSearchQuery;
1433
1443
  const l = document.createElement("div");
1434
- a.addEventListener("input", (h) => {
1435
- this.globalSearchQuery = h.target.value, i(l);
1444
+ a.addEventListener("input", (p) => {
1445
+ this.globalSearchQuery = p.target.value, i(l);
1436
1446
  }), n.appendChild(o), n.appendChild(a);
1437
1447
  const r = document.createElement("button");
1438
1448
  r.className = "global-layout-toggle", r.type = "button";
@@ -1467,15 +1477,15 @@ const V = class V extends x {
1467
1477
  {
1468
1478
  const c = document.createElement("div");
1469
1479
  c.className = "gradient-subtype-inline";
1470
- const h = document.createElement("select");
1471
- h.className = "gradient-subtype-select";
1472
- const p = document.createElement("option");
1473
- p.value = "linear", p.textContent = "Linear";
1480
+ const p = document.createElement("select");
1481
+ p.className = "gradient-subtype-select";
1482
+ const d = document.createElement("option");
1483
+ d.value = "linear", d.textContent = "Linear";
1474
1484
  const g = document.createElement("option");
1475
- g.value = "radial", g.textContent = "Radial", h.appendChild(p), h.appendChild(g), h.value = this.value.type === "radial" ? "radial" : "linear", e = document.createElement("input"), e.type = "text", e.inputMode = "numeric", e.className = "gradient-degree-input", e.value = `${this.value.angle ?? 90}°`, e.style.width = "75px", e.style.textAlign = "center", (!this.value.angle || this.value.stops.length < 2) && (this.value.angle = 90, e.value = "90°");
1476
- const f = document.createElement("button");
1477
- f.type = "button", f.className = "gradient-flip-btn", f.innerHTML = Tt, h.addEventListener("change", () => {
1478
- this.clearGlobalBindingForCustomChange(), this.switchType(h.value === "radial" ? "radial" : "linear", !0), e && this.updateDegreeVisibility(e);
1485
+ g.value = "radial", g.textContent = "Radial", p.appendChild(d), p.appendChild(g), p.value = this.value.type === "radial" ? "radial" : "linear", e = document.createElement("input"), e.type = "text", e.inputMode = "numeric", e.className = "gradient-degree-input", e.value = `${this.value.angle ?? 90}°`, e.style.width = "75px", e.style.textAlign = "center", (!this.value.angle || this.value.stops.length < 2) && (this.value.angle = 90, e.value = "90°");
1486
+ const C = document.createElement("button");
1487
+ C.type = "button", C.className = "gradient-flip-btn", C.innerHTML = Tt, p.addEventListener("change", () => {
1488
+ this.clearGlobalBindingForCustomChange(), this.switchType(p.value === "radial" ? "radial" : "linear", !0), e && this.updateDegreeVisibility(e);
1479
1489
  }), e.addEventListener("focus", (m) => {
1480
1490
  const u = m.target;
1481
1491
  u.value = u.value.replace(/[^0-9-]/g, ""), setTimeout(() => u.select(), 0);
@@ -1484,16 +1494,16 @@ const V = class V extends x {
1484
1494
  const u = parseInt(m.target.value);
1485
1495
  !Number.isNaN(u) && this.value && (this.value.angle = Math.max(0, Math.min(360, u)), this.debouncedPreviewUpdate());
1486
1496
  }), e.addEventListener("blur", (m) => {
1487
- var C;
1497
+ var f;
1488
1498
  this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
1489
1499
  const u = m.target;
1490
1500
  let v = parseInt(u.value);
1491
- Number.isNaN(v) && (v = ((C = this.value) == null ? void 0 : C.angle) ?? 0), v = Math.max(0, Math.min(360, v)), this.value && (this.value.angle = v), u.value = `${v}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
1492
- }), f.addEventListener("click", () => {
1501
+ Number.isNaN(v) && (v = ((f = this.value) == null ? void 0 : f.angle) ?? 0), v = Math.max(0, Math.min(360, v)), this.value && (this.value.angle = v), u.value = `${v}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
1502
+ }), C.addEventListener("click", () => {
1493
1503
  this.clearGlobalBindingForCustomChange(), !(!this.value || !this.value.stops) && (this.value.stops.forEach((m) => {
1494
1504
  m.position = 100 - m.position;
1495
1505
  }), this.value.stops.sort((m, u) => m.position - u.position), this.updateGradientPreview(i), this.createHandles(s, i), this.updateStopsList(l), this.updateUI(), this.triggerChange());
1496
- }), c.appendChild(h), c.appendChild(e), c.appendChild(f), t.appendChild(c), this.updateDegreeVisibility(e);
1506
+ }), c.appendChild(p), c.appendChild(e), c.appendChild(C), t.appendChild(c), this.updateDegreeVisibility(e);
1497
1507
  }
1498
1508
  const i = document.createElement("div");
1499
1509
  i.className = "gradient-preview", this.updateGradientPreview(i);
@@ -1508,8 +1518,8 @@ const V = class V extends x {
1508
1518
  const l = document.createElement("div");
1509
1519
  l.className = "gradient-stops", t.appendChild(n), t.appendChild(l), this.updateStopsList(l);
1510
1520
  const r = at((c) => {
1511
- const h = T(c);
1512
- h && (this.clearGlobalBindingForCustomChange(), this.value = h, this.switchType(h.type, !0), this.updateUI(), this.triggerChange());
1521
+ const p = T(c);
1522
+ p && (this.clearGlobalBindingForCustomChange(), this.value = p, this.switchType(p.type, !0), this.updateUI(), this.triggerChange());
1513
1523
  }, "all");
1514
1524
  this.recentGradientRefresh = r.refresh, t.appendChild(r.container), a.addEventListener("click", () => {
1515
1525
  var c;
@@ -1547,29 +1557,29 @@ const V = class V extends x {
1547
1557
  const l = new ut((u, v) => {
1548
1558
  this.clearGlobalBindingForCustomChange(), this.value && this.value.stops[s] && (this.value.stops[s].color = u, v !== void 0 && (this.value.stops[s].opacity = v), o.style.backgroundColor = u, this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), this.triggerChange());
1549
1559
  }, "solid");
1550
- let r = !1, c = !1, h = 0, p = 0;
1560
+ let r = !1, c = !1, p = 0, d = 0;
1551
1561
  const g = (u) => {
1552
- r = !0, c = !1, h = u.clientX, p = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", f), document.addEventListener("mouseup", m), u.preventDefault(), u.stopPropagation();
1553
- }, f = (u) => {
1562
+ r = !0, c = !1, p = u.clientX, d = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", C), document.addEventListener("mouseup", m), u.preventDefault(), u.stopPropagation();
1563
+ }, C = (u) => {
1554
1564
  if (!r || !this.value) return;
1555
- const v = u.clientX - h;
1565
+ const v = u.clientX - p;
1556
1566
  if (Math.abs(v) > 3 && (c = !0), c) {
1557
1567
  this.clearGlobalBindingForCustomChange();
1558
- const C = e.getBoundingClientRect();
1559
- let y = p + v / C.width * 100;
1568
+ const f = e.getBoundingClientRect();
1569
+ let y = d + v / f.width * 100;
1560
1570
  y = Math.max(0, Math.min(100, y)), this.value.stops[s].position = Math.round(y), n.style.left = `${y}%`, this.updateGradientPreview();
1561
1571
  }
1562
1572
  }, m = (u) => {
1563
1573
  var v;
1564
1574
  if (r)
1565
- if (r = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", f), document.removeEventListener("mouseup", m), c)
1566
- this.value && (this.value.stops.sort((C, y) => C.position - y.position), this.createHandles(t, e), this.updateStopsList()), this.updateUI(), this.triggerChange();
1575
+ if (r = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", C), document.removeEventListener("mouseup", m), c)
1576
+ this.value && (this.value.stops.sort((f, y) => f.position - y.position), this.createHandles(t, e), this.updateStopsList()), this.updateUI(), this.triggerChange();
1567
1577
  else {
1568
1578
  u.stopPropagation();
1569
- const C = (v = this.value) == null ? void 0 : v.stops[s];
1570
- C && setTimeout(() => {
1571
- const y = this.resolveGlobalVarColor(C.color);
1572
- l.open(y, o, C.opacity ?? 100);
1579
+ const f = (v = this.value) == null ? void 0 : v.stops[s];
1580
+ f && setTimeout(() => {
1581
+ const y = this.resolveGlobalVarColor(f.color);
1582
+ l.open(y, o, f.opacity ?? 100);
1573
1583
  }, 0);
1574
1584
  }
1575
1585
  };
@@ -1589,50 +1599,50 @@ const V = class V extends x {
1589
1599
  l.type = "text", l.className = "gstop-position-input", l.value = `${s.position}%`, l.style.width = "60px", a.appendChild(l);
1590
1600
  const r = document.createElement("div");
1591
1601
  r.className = "gstop-color-container";
1592
- const c = this.resolveGlobalVarColor(s.color), h = document.createElement("div");
1593
- h.className = "gstop-color-preview", h.style.backgroundColor = c;
1594
- const p = document.createElement("input");
1595
- p.type = "text", p.className = "gstop-color-input", p.value = c.replace("#", "").toUpperCase();
1602
+ const c = this.resolveGlobalVarColor(s.color), p = document.createElement("div");
1603
+ p.className = "gstop-color-preview", p.style.backgroundColor = c;
1604
+ const d = document.createElement("input");
1605
+ d.type = "text", d.className = "gstop-color-input", d.value = c.replace("#", "").toUpperCase();
1596
1606
  const g = document.createElement("button");
1597
- g.type = "button", g.className = "gstop-color-copy", g.textContent = "Copy", r.appendChild(h), r.appendChild(p), r.appendChild(g);
1598
- const f = document.createElement("button");
1599
- f.type = "button", f.className = "gstop-del", f.innerHTML = Pt, f.disabled = (((I = (L = this.value) == null ? void 0 : L.stops) == null ? void 0 : I.length) || 0) <= 2, o.appendChild(a), o.appendChild(r), o.appendChild(f), e.appendChild(o);
1607
+ g.type = "button", g.className = "gstop-color-copy", g.textContent = "Copy", r.appendChild(p), r.appendChild(d), r.appendChild(g);
1608
+ const C = document.createElement("button");
1609
+ C.type = "button", C.className = "gstop-del", C.innerHTML = Pt, C.disabled = (((I = (L = this.value) == null ? void 0 : L.stops) == null ? void 0 : I.length) || 0) <= 2, o.appendChild(a), o.appendChild(r), o.appendChild(C), e.appendChild(o);
1600
1610
  const m = document.createElement("span");
1601
1611
  m.className = "gstop-opacity-label", m.textContent = "Opacity";
1602
1612
  const u = document.createElement("div");
1603
1613
  u.className = "gstop-opacity-group";
1604
1614
  const v = document.createElement("input");
1605
1615
  v.type = "range", v.className = "gstop-opacity-slider", v.min = "0", v.max = "100", v.value = String(s.opacity ?? 100);
1606
- const C = P(c);
1607
- v.style.setProperty("--slider-color", `rgb(${C.r}, ${C.g}, ${C.b})`);
1616
+ const f = P(c);
1617
+ v.style.setProperty("--slider-color", `rgb(${f.r}, ${f.g}, ${f.b})`);
1608
1618
  const y = document.createElement("span");
1609
1619
  y.className = "gstop-opacity-value", y.textContent = `${s.opacity ?? 100}%`, u.appendChild(v), u.appendChild(y);
1610
1620
  const b = new ut((E, w) => {
1611
- this.clearGlobalBindingForCustomChange(), p.value = E.replace("#", "").toUpperCase(), h.style.backgroundColor = E, this.value.stops[n].color = E, w !== void 0 && (this.value.stops[n].opacity = w, v.value = String(w), y.textContent = `${w}%`);
1621
+ this.clearGlobalBindingForCustomChange(), d.value = E.replace("#", "").toUpperCase(), p.style.backgroundColor = E, this.value.stops[n].color = E, w !== void 0 && (this.value.stops[n].opacity = w, v.value = String(w), y.textContent = `${w}%`);
1612
1622
  const N = P(E);
1613
1623
  v.style.setProperty("--slider-color", `rgb(${N.r}, ${N.g}, ${N.b})`), this.updateGradientPreview(), this.createHandles(
1614
1624
  this.popoverEl.querySelector(".gradient-handles"),
1615
1625
  this.popoverEl.querySelector(".gradient-preview")
1616
1626
  ), this.updateUI(), this.triggerChange();
1617
1627
  }, "solid");
1618
- p.addEventListener("click", (E) => {
1628
+ d.addEventListener("click", (E) => {
1619
1629
  E.preventDefault(), E.stopPropagation();
1620
1630
  const w = this.resolveGlobalVarColor(s.color);
1621
- b.open(w, p, s.opacity ?? 100);
1622
- }), p.addEventListener("input", () => {
1631
+ b.open(w, d, s.opacity ?? 100);
1632
+ }), d.addEventListener("input", () => {
1623
1633
  this.clearGlobalBindingForCustomChange();
1624
- const E = p.value.trim(), w = E.startsWith("#") ? E : `#${E}`;
1634
+ const E = d.value.trim(), w = E.startsWith("#") ? E : `#${E}`;
1625
1635
  if (/^#[0-9A-Fa-f]{6}$/.test(w)) {
1626
- this.value.stops[n].color = w, h.style.backgroundColor = w;
1636
+ this.value.stops[n].color = w, p.style.backgroundColor = w;
1627
1637
  const N = P(w);
1628
1638
  v.style.setProperty("--slider-color", `rgb(${N.r}, ${N.g}, ${N.b})`), this.debouncedPreviewUpdate();
1629
1639
  }
1630
- }), p.addEventListener("blur", () => {
1640
+ }), d.addEventListener("blur", () => {
1631
1641
  this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
1632
1642
  }), g.addEventListener("click", async (E) => {
1633
1643
  E.stopPropagation();
1634
1644
  try {
1635
- await navigator.clipboard.writeText(`#${p.value}`);
1645
+ await navigator.clipboard.writeText(`#${d.value}`);
1636
1646
  } catch {
1637
1647
  }
1638
1648
  }), l.addEventListener("focus", (E) => {
@@ -1658,7 +1668,7 @@ const V = class V extends x {
1658
1668
  this.popoverEl.querySelector(".gradient-handles"),
1659
1669
  this.popoverEl.querySelector(".gradient-preview")
1660
1670
  ), this.updateStopsList(), this.updateUI(), this.triggerChange();
1661
- }), f.addEventListener("click", () => {
1671
+ }), C.addEventListener("click", () => {
1662
1672
  var E;
1663
1673
  (this.value.stops.length || 0) <= 2 || (this.clearGlobalBindingForCustomChange(), this.value.stops.splice(n, 1), this.createHandles(
1664
1674
  this.popoverEl.querySelector(".gradient-handles"),
@@ -1697,10 +1707,10 @@ const V = class V extends x {
1697
1707
  this.popoverEl.style.position = "fixed", this.popoverEl.style.zIndex = "10000", this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
1698
1708
  const o = this.popoverEl.offsetHeight;
1699
1709
  let a = t.right + 8, l = t.top;
1700
- const r = i - t.right, c = t.left, h = e + n;
1701
- r < h && c > r + 100 && (a = t.left - e - 8);
1702
- const p = s - t.bottom, g = t.top;
1703
- g >= o + n ? l = t.top - o - 8 : p >= o + n ? l = t.bottom + 8 : g > p ? (l = t.top - o - 8, l < n && (l = n)) : (l = t.bottom + 8, l + o > s - n && (l = s - o - n)), this.popoverEl.style.left = `${a}px`, this.popoverEl.style.top = `${l}px`, this.popoverPosition = { left: a, top: l };
1710
+ const r = i - t.right, c = t.left, p = e + n;
1711
+ r < p && c > r + 100 && (a = t.left - e - 8);
1712
+ const d = s - t.bottom, g = t.top;
1713
+ g >= o + n ? l = t.top - o - 8 : d >= o + n ? l = t.bottom + 8 : g > d ? (l = t.top - o - 8, l < n && (l = n)) : (l = t.bottom + 8, l + o > s - n && (l = s - o - n)), this.popoverEl.style.left = `${a}px`, this.popoverEl.style.top = `${l}px`, this.popoverPosition = { left: a, top: l };
1704
1714
  }
1705
1715
  setTimeout(() => document.addEventListener("click", this.onBackgroundClick, !0), 200), document.addEventListener("keydown", this.handlePopoverKeydown, !0);
1706
1716
  }
@@ -1718,10 +1728,10 @@ const V = class V extends x {
1718
1728
  this.popoverEl.style.left, this.popoverEl.style.top, this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
1719
1729
  const a = this.popoverEl.offsetHeight;
1720
1730
  let l = e.right + 8, r = e.top;
1721
- const c = s - e.right, h = e.left, p = i + o;
1722
- c < p && h > c + 100 && (l = e.left - i - 8);
1723
- const g = n - e.bottom, f = e.top;
1724
- f >= a + o ? r = e.top - a - 8 : g >= a + o ? r = e.bottom + 8 : f > g ? (r = e.top - a - 8, r < o && (r = o)) : (r = e.bottom + 8, r + a > n - o && (r = n - a - o)), this.popoverEl.style.left = `${l}px`, this.popoverEl.style.top = `${r}px`;
1731
+ const c = s - e.right, p = e.left, d = i + o;
1732
+ c < d && p > c + 100 && (l = e.left - i - 8);
1733
+ const g = n - e.bottom, C = e.top;
1734
+ C >= a + o ? r = e.top - a - 8 : g >= a + o ? r = e.bottom + 8 : C > g ? (r = e.top - a - 8, r < o && (r = o)) : (r = e.bottom + 8, r + a > n - o && (r = n - a - o)), this.popoverEl.style.left = `${l}px`, this.popoverEl.style.top = `${r}px`;
1725
1735
  });
1726
1736
  }
1727
1737
  }
@@ -1740,13 +1750,13 @@ const V = class V extends x {
1740
1750
  if (!(!this.popoverEl || !this.isPopoverOpen)) {
1741
1751
  if (this.isPopoverOpen = !1, this.popoverPosition = null, this.backdropEl && (this.backdropEl.style.display = "none"), this.popoverEl.style.display = "none", document.removeEventListener("click", this.onBackgroundClick, !0), document.removeEventListener("keydown", this.handlePopoverKeydown, !0), this.commitPendingSolidColor(), this.value && this.value.type !== "solid") {
1742
1752
  const e = S(this.value);
1743
- F.addColor(e, "gradient"), (t = this.recentGradientRefresh) == null || t.call(this);
1753
+ R.addColor(e, "gradient"), (t = this.recentGradientRefresh) == null || t.call(this);
1744
1754
  }
1745
1755
  this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), V.openInstance === this && (V.openInstance = null);
1746
1756
  }
1747
1757
  }
1748
1758
  commitPendingSolidColor() {
1749
- this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() : F.addColor(this.pendingSolidColor, "solid"), this.pendingSolidColor = null);
1759
+ this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() : R.addColor(this.pendingSolidColor, "solid"), this.pendingSolidColor = null);
1750
1760
  }
1751
1761
  handlePaste(t) {
1752
1762
  var i;
@@ -1796,10 +1806,10 @@ const V = class V extends x {
1796
1806
  };
1797
1807
  V.openInstance = null, V.CHANGE_DEBOUNCE_DELAY = 150;
1798
1808
  let j = V;
1799
- function J(d, t) {
1800
- for (const e in d)
1801
- if (Object.prototype.hasOwnProperty.call(d, e)) {
1802
- const i = d[e];
1809
+ function J(h, t) {
1810
+ for (const e in h)
1811
+ if (Object.prototype.hasOwnProperty.call(h, e)) {
1812
+ const i = h[e];
1803
1813
  t(e, i);
1804
1814
  }
1805
1815
  }
@@ -1820,6 +1830,14 @@ const Q = class Q {
1820
1830
  setNestingLevel(t) {
1821
1831
  this.nestingLevel = t, this.propagateNestingLevel(), this.elementRef && this.updateNestingStyles();
1822
1832
  }
1833
+ setTitle(t) {
1834
+ if (this.title = t, this.elementRef) {
1835
+ const e = this.elementRef.querySelector(
1836
+ ".setting-group-title h3"
1837
+ );
1838
+ e && (e.textContent = t);
1839
+ }
1840
+ }
1823
1841
  getDataPropsPath() {
1824
1842
  return this.dataPropsPath;
1825
1843
  }
@@ -1897,16 +1915,16 @@ const Q = class Q {
1897
1915
  }), s.forEach((r) => {
1898
1916
  n.includes(r) || this.removeSetting(r);
1899
1917
  }), n.forEach((r) => {
1900
- var p;
1901
- const c = t[r], h = this.settings[r];
1902
- if (h !== c && (h && this.removeSetting(r), this.addSetting(r, c), i && r in o)) {
1918
+ var d;
1919
+ const c = t[r], p = this.settings[r];
1920
+ if (p !== c && (p && this.removeSetting(r), this.addSetting(r, c), i && r in o)) {
1903
1921
  const g = o[r];
1904
1922
  try {
1905
1923
  k(c) ? c.setValue(
1906
1924
  g
1907
- ) : G(c) ? (p = c.setValue) == null || p.call(c, g) : c.setValue && c.setValue(g);
1908
- } catch (f) {
1909
- console.warn(`Could not preserve value for setting ${r}:`, f);
1925
+ ) : G(c) ? (d = c.setValue) == null || d.call(c, g) : c.setValue && c.setValue(g);
1926
+ } catch (C) {
1927
+ console.warn(`Could not preserve value for setting ${r}:`, C);
1910
1928
  }
1911
1929
  }
1912
1930
  }), this.settings = t, this.propagateNestingLevel(), this.propagateDataPropsPath();
@@ -2037,8 +2055,8 @@ const Q = class Q {
2037
2055
  k(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
2038
2056
  const a = e.draw(), l = this.deleteItemCfg ?? this.addItemCfg;
2039
2057
  if (l) {
2040
- const h = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
2041
- h && t.startsWith(h) && this.addDeleteButtonToElement(a, t);
2058
+ const p = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
2059
+ p && t.startsWith(p) && this.addDeleteButtonToElement(a, t);
2042
2060
  }
2043
2061
  const r = o.querySelector(".sg-add-button-bottom");
2044
2062
  r ? o.insertBefore(a, r) : o.appendChild(a), rt.trackElement(a), Z(a, this.nestingLevel + 1), et(a, this.nestingLevel + 1);
@@ -2190,11 +2208,11 @@ const Q = class Q {
2190
2208
  r(), t(!1);
2191
2209
  }), l.addEventListener("click", () => {
2192
2210
  r(), t(!0);
2193
- }), e.addEventListener("click", (h) => {
2194
- h.target === e && (r(), t(!1));
2211
+ }), e.addEventListener("click", (p) => {
2212
+ p.target === e && (r(), t(!1));
2195
2213
  });
2196
- const c = (h) => {
2197
- h.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", c));
2214
+ const c = (p) => {
2215
+ p.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", c));
2198
2216
  };
2199
2217
  document.addEventListener("keydown", c), o.appendChild(a), o.appendChild(l), i.appendChild(s), i.appendChild(n), i.appendChild(o), e.appendChild(i), document.body.appendChild(e), requestAnimationFrame(() => {
2200
2218
  e.style.opacity = "1", i.style.transform = "scale(1)";
@@ -2202,11 +2220,16 @@ const Q = class Q {
2202
2220
  });
2203
2221
  }
2204
2222
  getNextIndexFromPrefix(t) {
2205
- const e = Object.keys(this.settings).filter((i) => i.startsWith(t)).map((i) => {
2206
- const s = Number(i.slice(t.length));
2207
- return Number.isFinite(s) ? s : -1;
2208
- }).filter((i) => i >= 0);
2209
- return e.length ? Math.max(...e) + 1 : 0;
2223
+ const e = new Set(
2224
+ Object.keys(this.settings).filter((s) => s.startsWith(t)).map((s) => {
2225
+ const n = Number(s.slice(t.length));
2226
+ return Number.isFinite(n) ? n : -1;
2227
+ }).filter((s) => s >= 0)
2228
+ );
2229
+ let i = 0;
2230
+ for (; e.has(i); )
2231
+ i += 1;
2232
+ return i;
2210
2233
  }
2211
2234
  calculateChanges(t, e) {
2212
2235
  const i = {};
@@ -2333,14 +2356,14 @@ const Q = class Q {
2333
2356
  }, Object.keys(this.settings).length > 0) {
2334
2357
  for (const c in this.settings)
2335
2358
  if (Object.prototype.hasOwnProperty.call(this.settings, c)) {
2336
- const h = this.settings[c];
2337
- k(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.nestingLevel + 1);
2338
- const p = h.draw();
2339
- k(h) && h.deleteItemCfg && this.addDeleteButtonToElement(
2340
- p,
2359
+ const p = this.settings[c];
2360
+ k(p) && typeof p.setNestingLevel == "function" && p.setNestingLevel(this.nestingLevel + 1);
2361
+ const d = p.draw();
2362
+ k(p) && p.deleteItemCfg && this.addDeleteButtonToElement(
2363
+ d,
2341
2364
  c,
2342
- h
2343
- ), a.appendChild(p);
2365
+ p
2366
+ ), a.appendChild(d);
2344
2367
  }
2345
2368
  } else {
2346
2369
  const c = document.createElement("div");
@@ -2349,18 +2372,18 @@ const Q = class Q {
2349
2372
  if (this.addItemCfg) {
2350
2373
  const c = document.createElement("button");
2351
2374
  c.type = "button", c.className = "sg-add-button-bottom", c.style.marginTop = "8px";
2352
- const h = `
2375
+ const p = `
2353
2376
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
2354
2377
  xmlns="http://www.w3.org/2000/svg">
2355
2378
  <path d="M8 3.333v9.334M3.333 8h9.334" stroke="currentColor"
2356
2379
  stroke-width="1.5" stroke-linecap="round"/>
2357
2380
  </svg>`;
2358
- c.innerHTML = `${h}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, c.addEventListener("click", (p) => {
2359
- p.stopPropagation(), p.preventDefault();
2360
- const g = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), f = this.addItemCfg.createItem(g);
2361
- if (ct(f)) {
2381
+ c.innerHTML = `${p}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, c.addEventListener("click", (d) => {
2382
+ d.stopPropagation(), d.preventDefault();
2383
+ const g = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), C = this.addItemCfg.createItem(g);
2384
+ if (ct(C)) {
2362
2385
  const m = `${this.addItemCfg.keyPrefix}${g}`;
2363
- this.addSetting(m, f);
2386
+ this.addSetting(m, C);
2364
2387
  }
2365
2388
  }), a.appendChild(c);
2366
2389
  }
@@ -2408,8 +2431,8 @@ const Q = class Q {
2408
2431
  };
2409
2432
  Q.hiddenElements = /* @__PURE__ */ new Set();
2410
2433
  let $ = Q;
2411
- function be(d) {
2412
- return new At(d);
2434
+ function be(h) {
2435
+ return new At(h);
2413
2436
  }
2414
2437
  class At extends $ {
2415
2438
  constructor(t) {
@@ -2461,9 +2484,9 @@ class At extends $ {
2461
2484
  r.className = "tab-button", r.type = "button", r.setAttribute("data-tab-id", a), r.textContent = a, r.addEventListener("click", () => this.switchToTab(a)), n.appendChild(r);
2462
2485
  const c = document.createElement("div");
2463
2486
  c.className = "tab-panel", this.contentContainers[a] = c;
2464
- const h = this.settings[a];
2465
- h && (k(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.getNestingLevel() + 1), c.appendChild(
2466
- h.draw()
2487
+ const p = this.settings[a];
2488
+ p && (k(p) && typeof p.setNestingLevel == "function" && p.setNestingLevel(this.getNestingLevel() + 1), c.appendChild(
2489
+ p.draw()
2467
2490
  )), o.appendChild(c), l === 0 && !this.activeTabId && (this.activeTabId = a);
2468
2491
  }), e.appendChild(i), e.appendChild(n), e.appendChild(o), !this.activeTabId) {
2469
2492
  const a = Object.keys(this.settings)[0];
@@ -2472,11 +2495,11 @@ class At extends $ {
2472
2495
  return this.updateTabUI(), t;
2473
2496
  }
2474
2497
  }
2475
- function Dt(d) {
2476
- return new $(d);
2498
+ function Dt(h) {
2499
+ return new $(h);
2477
2500
  }
2478
- function we(d) {
2479
- return d;
2501
+ function we(h) {
2502
+ return h;
2480
2503
  }
2481
2504
  class Gt extends x {
2482
2505
  constructor(t = {}) {
@@ -2519,8 +2542,8 @@ class O extends Gt {
2519
2542
  if (e.length !== 3 || e.some(isNaN))
2520
2543
  return console.warn(`Invalid RGB value "${t}", using default "#000000"`), "#000000";
2521
2544
  const [i, s, n] = e, o = Math.max(0, Math.min(255, i)), a = Math.max(0, Math.min(255, s)), l = Math.max(0, Math.min(255, n)), r = (c) => {
2522
- const h = c.toString(16);
2523
- return h.length === 1 ? "0" + h : h;
2545
+ const p = c.toString(16);
2546
+ return p.length === 1 ? "0" + p : p;
2524
2547
  };
2525
2548
  return `#${r(o)}${r(a)}${r(l)}`;
2526
2549
  }
@@ -2581,15 +2604,15 @@ class O extends Gt {
2581
2604
  return;
2582
2605
  }
2583
2606
  Object.entries(m).forEach(([u, v]) => {
2584
- const C = document.createElement("button");
2585
- C.className = "global-color-btn", C.title = u, C.style.width = "30px", C.style.height = "30px", C.style.borderRadius = "50%", C.style.border = "1px solid #ddd", C.style.backgroundColor = v, C.style.cursor = "pointer", this.value === `var(--${u})` && (C.style.border = "2px solid #2196f3"), C.addEventListener("click", (y) => {
2607
+ const f = document.createElement("button");
2608
+ f.className = "global-color-btn", f.title = u, f.style.width = "30px", f.style.height = "30px", f.style.borderRadius = "50%", f.style.border = "1px solid #ddd", f.style.backgroundColor = v, f.style.cursor = "pointer", this.value === `var(--${u})` && (f.style.border = "2px solid #2196f3"), f.addEventListener("click", (y) => {
2586
2609
  var L, I;
2587
2610
  y.preventDefault();
2588
2611
  const b = `var(--${u})`;
2589
2612
  this.value = b, (L = this.onChange) == null || L.call(this, b), (I = this.detectChange) == null || I.call(this, b), Array.from(a.children).forEach((E) => {
2590
2613
  E.style.border = "1px solid #ddd";
2591
- }), C.style.border = "2px solid #2196f3", h.style.backgroundColor = v;
2592
- }), a.appendChild(C);
2614
+ }), f.style.border = "2px solid #2196f3", p.style.backgroundColor = v;
2615
+ }), a.appendChild(f);
2593
2616
  });
2594
2617
  } catch (m) {
2595
2618
  console.error("ColorSetting: Error in renderGlobalOptions", m), a.innerHTML = "Error loading global options";
@@ -2604,48 +2627,48 @@ class O extends Gt {
2604
2627
  const u = m.value.trim();
2605
2628
  if (!u)
2606
2629
  return e.classList.remove("error"), !0;
2607
- const C = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(u);
2608
- return C ? e.classList.remove("error") : e.classList.add("error"), C;
2630
+ const f = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(u);
2631
+ return f ? e.classList.remove("error") : e.classList.add("error"), f;
2609
2632
  }, c = document.createElement("input");
2610
2633
  c.type = "color", c.className = "color-picker", c.value = this.value && !this.value.startsWith("var(--") ? this.value : "#000000", c.setAttribute("aria-label", "Choose color"), c.setAttribute("title", "Click to open color picker"), this.getDataPropsPath() && c.setAttribute("data-test-id", this.getDataPropsPath()), this.colorInputEl = c;
2611
- const h = document.createElement("div");
2612
- h.className = "color-preview";
2613
- let p = this.value || "#000000";
2614
- if (p.startsWith("var(--")) {
2615
- const m = p.replace("var(--", "").replace(")", "");
2616
- p = (x.GlobalVariables || {})[m] || "#000000";
2634
+ const p = document.createElement("div");
2635
+ p.className = "color-preview";
2636
+ let d = this.value || "#000000";
2637
+ if (d.startsWith("var(--")) {
2638
+ const m = d.replace("var(--", "").replace(")", "");
2639
+ d = (x.GlobalVariables || {})[m] || "#000000";
2617
2640
  }
2618
- h.style.backgroundColor = p;
2641
+ p.style.backgroundColor = d;
2619
2642
  const g = document.createElement("input");
2620
2643
  g.type = "text", g.className = "color-text-input", g.value = this.value || "", g.placeholder = "#000000", g.setAttribute("pattern", "#[0-9A-Fa-f]{6}"), g.setAttribute("title", "Enter a hex color value (e.g., #ff0000)"), g.setAttribute("aria-label", "Hex color value"), g.setAttribute("maxlength", "7"), this.getDataPropsPath() && g.setAttribute("data-test-id", `${this.getDataPropsPath()}_text`), this.textInputEl = g;
2621
- const f = (m) => {
2622
- var v, C;
2644
+ const C = (m) => {
2645
+ var v, f;
2623
2646
  let u = m.trim();
2624
2647
  if (u && !u.startsWith("#") && !u.startsWith("var(") && /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(u) && (u = "#" + u, this.textInputEl && (this.textInputEl.value = u)), this.textInputEl && r(this.textInputEl)) {
2625
2648
  const y = O.normalizeColorValue(u);
2626
- this.value = y, (v = this.onChange) == null || v.call(this, y), (C = this.detectChange) == null || C.call(this, y), this.colorInputEl && (this.colorInputEl.value = y), h.style.backgroundColor = y;
2649
+ this.value = y, (v = this.onChange) == null || v.call(this, y), (f = this.detectChange) == null || f.call(this, y), this.colorInputEl && (this.colorInputEl.value = y), p.style.backgroundColor = y;
2627
2650
  }
2628
2651
  };
2629
2652
  return this.textInputEl.addEventListener("input", (m) => {
2630
2653
  const u = m.target.value;
2631
- f(u);
2654
+ C(u);
2632
2655
  }), this.textInputEl.addEventListener("paste", (m) => {
2633
2656
  var v;
2634
2657
  m.preventDefault();
2635
2658
  const u = ((v = m.clipboardData) == null ? void 0 : v.getData("text")) || "";
2636
- this.textInputEl && (this.textInputEl.value = u.trim(), f(u));
2659
+ this.textInputEl && (this.textInputEl.value = u.trim(), C(u));
2637
2660
  }), this.textInputEl.addEventListener("keydown", (m) => {
2638
- var u, v, C;
2639
- m.key === "Enter" && (m.preventDefault(), f(((u = this.textInputEl) == null ? void 0 : u.value) || ""), (v = this.textInputEl) == null || v.blur()), m.key === "Escape" && (this.textInputEl && this.value && (this.textInputEl.value = this.value), (C = this.textInputEl) == null || C.blur(), e.classList.remove("error"));
2661
+ var u, v, f;
2662
+ m.key === "Enter" && (m.preventDefault(), C(((u = this.textInputEl) == null ? void 0 : u.value) || ""), (v = this.textInputEl) == null || v.blur()), m.key === "Escape" && (this.textInputEl && this.value && (this.textInputEl.value = this.value), (f = this.textInputEl) == null || f.blur(), e.classList.remove("error"));
2640
2663
  }), this.colorInputEl.addEventListener("input", (m) => {
2641
- var C, y;
2664
+ var f, y;
2642
2665
  const u = m.target.value, v = O.normalizeColorValue(u);
2643
- this.value = v, (C = this.onChange) == null || C.call(this, v), (y = this.detectChange) == null || y.call(this, v), this.textInputEl && (this.textInputEl.value = v), h.style.backgroundColor = v, e.classList.remove("error");
2666
+ this.value = v, (f = this.onChange) == null || f.call(this, v), (y = this.detectChange) == null || y.call(this, v), this.textInputEl && (this.textInputEl.value = v), p.style.backgroundColor = v, e.classList.remove("error");
2644
2667
  }), this.colorInputEl.addEventListener("change", (m) => {
2645
- var C, y;
2668
+ var f, y;
2646
2669
  const u = m.target.value, v = O.normalizeColorValue(u);
2647
- this.value = v, (C = this.onChange) == null || C.call(this, v), (y = this.detectChange) == null || y.call(this, v), this.textInputEl && (this.textInputEl.value = v), h.style.backgroundColor = v;
2648
- }), o.appendChild(c), o.appendChild(h), o.appendChild(g), e.appendChild(i), e.appendChild(o), e.appendChild(a), t.appendChild(e), this.element = t, t;
2670
+ this.value = v, (f = this.onChange) == null || f.call(this, v), (y = this.detectChange) == null || y.call(this, v), this.textInputEl && (this.textInputEl.value = v), p.style.backgroundColor = v;
2671
+ }), o.appendChild(c), o.appendChild(p), o.appendChild(g), e.appendChild(i), e.appendChild(o), e.appendChild(a), t.appendChild(e), this.element = t, t;
2649
2672
  }
2650
2673
  getElement() {
2651
2674
  return this.element;
@@ -2669,14 +2692,14 @@ const Rt = `
2669
2692
  <path d="M9 17C13.4183 17 17 13.4183 17 9C17 4.58172 13.4183 1 9 1C4.58172 1 1 4.58172 1 9C1 13.4183 4.58172 17 9 17Z" stroke="#667085" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5"/>
2670
2693
  <path d="M9 1V17C4.58172 17 1 13.4183 1 9C1 4.58172 4.58172 1 9 1Z" fill="#667085" stroke="#667085" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5"/>
2671
2694
  </svg>`;
2672
- class R extends x {
2695
+ class z extends x {
2673
2696
  constructor(t = {}) {
2674
2697
  super({
2675
2698
  ...t,
2676
2699
  icon: t.icon || Rt,
2677
2700
  title: t.title || "Color & Opacity",
2678
2701
  default: t.default || "#000000FF"
2679
- }), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.opacityInputEl = null, this.colorPreviewEl = null, this.detectChange = t.detectChange, this.value && (this.value = R.normalizeHexWithOpacity(this.value));
2702
+ }), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.opacityInputEl = null, this.colorPreviewEl = null, this.detectChange = t.detectChange, this.value && (this.value = z.normalizeHexWithOpacity(this.value));
2680
2703
  }
2681
2704
  static normalizeHexWithOpacity(t) {
2682
2705
  return t = t.replace("#", ""), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), t.length === 6 && (t = t + "FF"), t.length === 8 && /^[0-9A-Fa-f]{8}$/.test(t) ? `#${t.toUpperCase()}` : (console.warn(`Invalid hex value "${t}", using default "#000000FF"`), "#000000FF");
@@ -2694,7 +2717,7 @@ class R extends x {
2694
2717
  return `#${i}${n}`;
2695
2718
  }
2696
2719
  setValue(t) {
2697
- t === void 0 || t === "" ? this.value = "#000000FF" : this.value = R.normalizeHexWithOpacity(t), this.updateInputElements(), this.updateColorPreview(), this.onChange && this.onChange(this.value), this.detectChange && this.detectChange(this.value);
2720
+ t === void 0 || t === "" ? this.value = "#000000FF" : this.value = z.normalizeHexWithOpacity(t), this.updateInputElements(), this.updateColorPreview(), this.onChange && this.onChange(this.value), this.detectChange && this.detectChange(this.value);
2698
2721
  }
2699
2722
  updateInputElements() {
2700
2723
  this.value && (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.textInputEl && (this.textInputEl.value = this.value), this.opacityInputEl && (this.opacityInputEl.value = this.getOpacityPercent().toString()));
@@ -2705,7 +2728,7 @@ class R extends x {
2705
2728
  this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${o}, ${e})`;
2706
2729
  }
2707
2730
  handleColorChange(t) {
2708
- const e = this.getOpacityPercent(), i = R.combineColorOpacity(
2731
+ const e = this.getOpacityPercent(), i = z.combineColorOpacity(
2709
2732
  t,
2710
2733
  e
2711
2734
  );
@@ -2716,7 +2739,7 @@ class R extends x {
2716
2739
  return e || i ? (this.setValue(t), !0) : !1;
2717
2740
  }
2718
2741
  handleOpacityChange(t) {
2719
- const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s = R.combineColorOpacity(
2742
+ const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s = z.combineColorOpacity(
2720
2743
  e,
2721
2744
  i
2722
2745
  );
@@ -3632,33 +3655,33 @@ const Kt = `
3632
3655
  "mousemove",
3633
3656
  (c) => this.updateCursorTooltip(c)
3634
3657
  ), this.value && this.value.markers && this.value.markers.forEach((c) => {
3635
- const h = this.createMarkerElement(c);
3636
- r.appendChild(h);
3658
+ const p = this.createMarkerElement(c);
3659
+ r.appendChild(p);
3637
3660
  }), l.appendChild(r), t.appendChild(l);
3638
3661
  }
3639
3662
  renderSidebar(t) {
3640
- var c, h;
3663
+ var c, p;
3641
3664
  const e = document.createElement("div");
3642
3665
  e.className = "prize-counter";
3643
3666
  const i = this.props.maxMarkers || 10, s = ((c = this.value) == null ? void 0 : c.markers.length) || 0, n = s === i;
3644
3667
  e.textContent = `Prizes ${s}/${i}`, n && e.classList.add("complete"), t.appendChild(e);
3645
3668
  const o = document.createElement("div");
3646
3669
  o.className = "prize-list";
3647
- const a = ((h = this.value) == null ? void 0 : h.markers) || [], l = /* @__PURE__ */ new Map();
3648
- a.forEach((p) => l.set(p.index, p));
3649
- for (let p = 1; p <= i; p++) {
3650
- const g = l.get(p), f = !!g, m = (g == null ? void 0 : g.prizeName) || this.props.prizeMap && this.props.prizeMap[p - 1] || `Prize #${p}`, u = document.createElement("div");
3651
- u.className = `prize-item ${f ? "placed" : "missing"}`;
3670
+ const a = ((p = this.value) == null ? void 0 : p.markers) || [], l = /* @__PURE__ */ new Map();
3671
+ a.forEach((d) => l.set(d.index, d));
3672
+ for (let d = 1; d <= i; d++) {
3673
+ const g = l.get(d), C = !!g, m = (g == null ? void 0 : g.prizeName) || this.props.prizeMap && this.props.prizeMap[d - 1] || `Prize #${d}`, u = document.createElement("div");
3674
+ u.className = `prize-item ${C ? "placed" : "missing"}`;
3652
3675
  const v = document.createElement("div");
3653
- v.className = "prize-index", v.textContent = String(p);
3654
- const C = document.createElement("div");
3655
- C.className = "prize-label";
3676
+ v.className = "prize-index", v.textContent = String(d);
3677
+ const f = document.createElement("div");
3678
+ f.className = "prize-label";
3656
3679
  const y = document.createElement("div");
3657
- y.className = "prize-title", y.textContent = `Prize #${p}`;
3680
+ y.className = "prize-title", y.textContent = `Prize #${d}`;
3658
3681
  const b = document.createElement("div");
3659
- b.className = "prize-subtitle", b.textContent = f ? m : "Not Placed", C.appendChild(y), C.appendChild(b);
3682
+ b.className = "prize-subtitle", b.textContent = C ? m : "Not Placed", f.appendChild(y), f.appendChild(b);
3660
3683
  const L = document.createElement("div");
3661
- L.className = `prize-status ${f ? "placed" : "missing"}`, L.innerHTML = f ? ie : se, u.appendChild(v), u.appendChild(C), u.appendChild(L), o.appendChild(u);
3684
+ L.className = `prize-status ${C ? "placed" : "missing"}`, L.innerHTML = C ? ie : se, u.appendChild(v), u.appendChild(f), u.appendChild(L), o.appendChild(u);
3662
3685
  }
3663
3686
  t.appendChild(o);
3664
3687
  const r = document.createElement("button");
@@ -3711,20 +3734,20 @@ const Kt = `
3711
3734
  if (typeof a == "string") {
3712
3735
  const r = new Image();
3713
3736
  r.onload = () => {
3714
- var p;
3737
+ var d;
3715
3738
  const c = {
3716
3739
  width: r.naturalWidth || 0,
3717
3740
  height: r.naturalHeight || 0
3718
- }, h = this.scaleMarkersForNewImage(
3719
- ((p = this.value) == null ? void 0 : p.markers) || [],
3741
+ }, p = this.scaleMarkersForNewImage(
3742
+ ((d = this.value) == null ? void 0 : d.markers) || [],
3720
3743
  e,
3721
3744
  c
3722
3745
  );
3723
3746
  this.value = {
3724
3747
  imageUrl: a,
3725
- markers: h
3748
+ markers: p
3726
3749
  }, this.lastImageNaturalSize = c, this.history = [
3727
- JSON.parse(JSON.stringify(h))
3750
+ JSON.parse(JSON.stringify(p))
3728
3751
  ], this.historyIndex = 0, this.updateUndoRedoButtons(), this.updateButtonDisplay(), this.refreshPopoverContent(), this.triggerChange();
3729
3752
  }, r.onerror = () => {
3730
3753
  this.showError("Failed to read image file.");
@@ -3742,7 +3765,7 @@ const Kt = `
3742
3765
  );
3743
3766
  return;
3744
3767
  }
3745
- const e = this.imageElement.getBoundingClientRect(), i = (t.clientX - e.left) / e.width * 100, s = (t.clientY - e.top) / e.height * 100, n = this.value.markers.map((c) => c.index).sort((c, h) => c - h);
3768
+ const e = this.imageElement.getBoundingClientRect(), i = (t.clientX - e.left) / e.width * 100, s = (t.clientY - e.top) / e.height * 100, n = this.value.markers.map((c) => c.index).sort((c, p) => c - p);
3746
3769
  let o = 1;
3747
3770
  for (const c of n)
3748
3771
  if (c === o)
@@ -3950,11 +3973,11 @@ const Kt = `
3950
3973
  r.type = "button", r.className = "confirm-btn ghost", r.textContent = "Cancel";
3951
3974
  const c = document.createElement("button");
3952
3975
  c.type = "button", c.className = "confirm-btn danger", c.textContent = "Discard";
3953
- const h = (p) => {
3954
- s.remove(), this.confirmOverlayEl = null, this.confirmPromise = null, i(p);
3976
+ const p = (d) => {
3977
+ s.remove(), this.confirmOverlayEl = null, this.confirmPromise = null, i(d);
3955
3978
  };
3956
- r.addEventListener("click", () => h(!1)), c.addEventListener("click", () => h(!0)), s.addEventListener("click", (p) => {
3957
- p.target === s && h(!1);
3979
+ r.addEventListener("click", () => p(!1)), c.addEventListener("click", () => p(!0)), s.addEventListener("click", (d) => {
3980
+ d.target === s && p(!1);
3958
3981
  }), l.appendChild(r), l.appendChild(c), n.appendChild(o), n.appendChild(a), n.appendChild(l), s.appendChild(n), document.body.appendChild(s), setTimeout(() => {
3959
3982
  n.classList.add("visible");
3960
3983
  }, 10);
@@ -4189,7 +4212,7 @@ class Ne extends x {
4189
4212
  const s = document.createElement("input");
4190
4213
  s.type = "checkbox", s.checked = ((a = (o = this.props.options) == null ? void 0 : o.find((l) => l.value === this.value)) == null ? void 0 : a.status) ?? !1, this.getDataPropsPath() && s.setAttribute("data-test-id", this.getDataPropsPath()), s.addEventListener("change", () => {
4191
4214
  var r, c;
4192
- const l = ((c = (r = this.props.options) == null ? void 0 : r.find((h) => h.status === s.checked)) == null ? void 0 : c.value) ?? "";
4215
+ const l = ((c = (r = this.props.options) == null ? void 0 : r.find((p) => p.status === s.checked)) == null ? void 0 : c.value) ?? "";
4193
4216
  this.value = l, this.onChange && this.onChange(this.value), this.detectChangeCallback && this.detectChangeCallback(this.value);
4194
4217
  });
4195
4218
  const n = document.createElement("span");
@@ -4340,13 +4363,13 @@ class Te extends x {
4340
4363
  return;
4341
4364
  }
4342
4365
  const c = "...";
4343
- let h = 0, p = e.length, g = 0;
4344
- for (; h <= p; ) {
4345
- const m = Math.floor((h + p) / 2), u = e.slice(0, m).trimEnd() + c;
4346
- this.measureTextWidth(u, i) <= l ? (g = m, h = m + 1) : p = m - 1;
4366
+ let p = 0, d = e.length, g = 0;
4367
+ for (; p <= d; ) {
4368
+ const m = Math.floor((p + d) / 2), u = e.slice(0, m).trimEnd() + c;
4369
+ this.measureTextWidth(u, i) <= l ? (g = m, p = m + 1) : d = m - 1;
4347
4370
  }
4348
- const f = e.slice(0, g).trimEnd() + c;
4349
- t.placeholder = f;
4371
+ const C = e.slice(0, g).trimEnd() + c;
4372
+ t.placeholder = C;
4350
4373
  }
4351
4374
  autosizeTextarea(t, e = 3) {
4352
4375
  t.style.height = "auto";
@@ -4855,7 +4878,7 @@ class Be extends $ {
4855
4878
  opacity: new Ut({
4856
4879
  default: (t == null ? void 0 : t.opacity) ?? 100
4857
4880
  }),
4858
- backgroundColor: new R({
4881
+ backgroundColor: new z({
4859
4882
  default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
4860
4883
  })
4861
4884
  }
@@ -4910,7 +4933,7 @@ export {
4910
4933
  Oe as BorderSettingSet,
4911
4934
  Le as ButtonSetting,
4912
4935
  O as ColorSetting,
4913
- R as ColorWithOpacitySetting,
4936
+ z as ColorWithOpacitySetting,
4914
4937
  ke as DimensionSetting,
4915
4938
  Ie as GapSetting,
4916
4939
  j as GradientSetting,