builder-settings-types 0.0.337 → 0.0.339

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.
Files changed (31) hide show
  1. package/dist/builder-settings-types.cjs.js +76 -82
  2. package/dist/builder-settings-types.es.js +1527 -1277
  3. package/dist/index.css +1 -1
  4. package/dist/settings/gradient-settings/GradientSetting.d.ts +4 -0
  5. package/dist/settings/gradient-settings/components/CustomColorPicker.d.ts +2 -0
  6. package/dist/settings/image-map-settings/ImageMapSetting.d.ts +14 -33
  7. package/dist/settings/image-map-settings/components/ConfirmModal.d.ts +12 -0
  8. package/dist/settings/image-map-settings/components/CursorTooltip.d.ts +10 -0
  9. package/dist/settings/image-map-settings/components/ErrorToast.d.ts +5 -0
  10. package/dist/settings/image-map-settings/components/index.d.ts +3 -0
  11. package/dist/settings/image-map-settings/constants/defaults.d.ts +10 -0
  12. package/dist/settings/image-map-settings/constants/icons.d.ts +13 -0
  13. package/dist/settings/image-map-settings/constants/index.d.ts +2 -0
  14. package/dist/settings/image-map-settings/services/FileManagerService.d.ts +11 -0
  15. package/dist/settings/image-map-settings/services/HistoryManager.d.ts +12 -0
  16. package/dist/settings/image-map-settings/services/index.d.ts +2 -0
  17. package/dist/settings/image-map-settings/types.d.ts +1 -1
  18. package/dist/settings/image-map-settings/ui/ControlsRow.d.ts +11 -0
  19. package/dist/settings/image-map-settings/ui/ImageSection.d.ts +16 -0
  20. package/dist/settings/image-map-settings/ui/MainDisplay.d.ts +12 -0
  21. package/dist/settings/image-map-settings/ui/MarkerElement.d.ts +6 -0
  22. package/dist/settings/image-map-settings/ui/PopoverContent.d.ts +11 -0
  23. package/dist/settings/image-map-settings/ui/PrizeList.d.ts +2 -0
  24. package/dist/settings/image-map-settings/ui/UploadSection.d.ts +8 -0
  25. package/dist/settings/image-map-settings/ui/index.d.ts +7 -0
  26. package/dist/settings/image-map-settings/utils/coordinates.d.ts +11 -0
  27. package/dist/settings/image-map-settings/utils/index.d.ts +3 -0
  28. package/dist/settings/image-map-settings/utils/marker-index.d.ts +6 -0
  29. package/dist/settings/image-map-settings/utils/validation.d.ts +5 -0
  30. package/dist/types/index.d.ts +2 -2
  31. package/package.json +1 -1
@@ -1,35 +1,35 @@
1
- const xt = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
2
- let ft = (d = 21) => {
3
- let t = "", e = crypto.getRandomValues(new Uint8Array(d |= 0));
4
- for (; d--; )
5
- t += xt[e[d] & 63];
1
+ const Ot = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
2
+ let Mt = (c = 21) => {
3
+ let t = "", e = crypto.getRandomValues(new Uint8Array(c |= 0));
4
+ for (; c--; )
5
+ t += Ot[e[c] & 63];
6
6
  return t;
7
7
  };
8
- function Lt(d) {
9
- let t = 0, e = d.parentElement;
8
+ function Ht(c) {
9
+ let t = 0, e = c.parentElement;
10
10
  for (; e; )
11
- e.classList.contains("setting-group") && e !== d && t++, e = e.parentElement;
11
+ e.classList.contains("setting-group") && e !== c && t++, e = e.parentElement;
12
12
  return t;
13
13
  }
14
- function _(d, t) {
14
+ function Q(c, 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
+ c.setAttribute("data-nesting-level", e.toString()), e > 0 ? c.style.setProperty("--visual-indent", `${e * 2}px`) : (c.style.removeProperty("--visual-indent"), c.style.marginLeft = "");
17
17
  }
18
- function et(d, t = 0) {
19
- d.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
18
+ function lt(c, t = 0) {
19
+ c.querySelectorAll(":scope > .setting-group-content > .setting-group").forEach((i) => {
20
20
  const s = i, n = t + 1;
21
- _(s, n), et(s, n);
21
+ Q(s, n), lt(s, n);
22
22
  });
23
23
  }
24
- const kt = {
24
+ const $t = {
25
25
  maxLevel: 5,
26
26
  spacingMultiplier: 1,
27
27
  visualIndentMultiplier: 2,
28
28
  enableAutoDetection: !0
29
29
  };
30
- class Mt {
30
+ class Bt {
31
31
  constructor(t = {}) {
32
- this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...kt, ...t }, this.config.enableAutoDetection && this.setupAutoDetection();
32
+ this.observedElements = /* @__PURE__ */ new Set(), this.config = { ...$t, ...t }, this.config.enableAutoDetection && this.setupAutoDetection();
33
33
  }
34
34
  /**
35
35
  * Setup automatic detection using MutationObserver
@@ -63,7 +63,7 @@ class Mt {
63
63
  * Update nesting for a specific element
64
64
  */
65
65
  updateElementNesting(t) {
66
- const e = Lt(t);
66
+ const e = Ht(t);
67
67
  this.applyNestingWithConfig(t, e);
68
68
  }
69
69
  /**
@@ -111,21 +111,21 @@ class Mt {
111
111
  this.observer && (this.observer.disconnect(), this.observer = void 0), this.observedElements.clear();
112
112
  }
113
113
  }
114
- const rt = new Mt();
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") {
114
+ const mt = new Bt();
115
+ function it(c) {
116
+ if (c === null || typeof c != "object") return c;
117
+ if (c instanceof Date) return new Date(c.getTime());
118
+ if (c instanceof Array) return c.map((t) => it(t));
119
+ if (typeof c == "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 c)
122
+ Object.prototype.hasOwnProperty.call(c, e) && (t[e] = it(c[e]));
123
123
  return t;
124
124
  }
125
- return d;
125
+ return c;
126
126
  }
127
- function Nt(d) {
128
- switch (d) {
127
+ function At(c) {
128
+ switch (c) {
129
129
  case "number":
130
130
  return 0;
131
131
  case "text":
@@ -142,29 +142,29 @@ function Nt(d) {
142
142
  return "";
143
143
  }
144
144
  }
145
- const M = class M {
145
+ const S = class S {
146
146
  constructor(t = {}) {
147
- this.props = t, this.dataPropsPath = "", this.id = t.id || ft(), this.value = this.props.default, this.desktop = this.props.default, this.title = t.title || "", this.includeGetJson = t.includeGetJson !== void 0 ? t.includeGetJson : !0;
147
+ this.props = t, this.dataPropsPath = "", this.id = t.id || Mt(), this.value = this.props.default, this.desktop = this.props.default, this.title = t.title || "", this.includeGetJson = t.includeGetJson !== void 0 ? t.includeGetJson : !0;
148
148
  }
149
149
  static SetUploadUrl(t) {
150
- globalThis.DefaultUploadUrl = t, M.DefaultUploadUrl = t;
150
+ globalThis.DefaultUploadUrl = t, S.DefaultUploadUrl = t;
151
151
  }
152
152
  static SetDefaultLanguage(t) {
153
- globalThis.DefaultLanguage = t, M.DefaultLanguage = t;
153
+ globalThis.DefaultLanguage = t, S.DefaultLanguage = t;
154
154
  }
155
155
  static CurrentLanguage(t) {
156
- return t !== void 0 && (M.currentLanguage = t, M.currentLanguageExplicitlySet = !0, M.DefaultLanguage || M.SetDefaultLanguage(t), M.languageChangeCallbacks.forEach((e) => e(t))), M.currentLanguage || M.DefaultLanguage;
156
+ return t !== void 0 && (S.currentLanguage = t, S.currentLanguageExplicitlySet = !0, S.DefaultLanguage || S.SetDefaultLanguage(t), S.languageChangeCallbacks.forEach((e) => e(t))), S.currentLanguage || S.DefaultLanguage;
157
157
  }
158
158
  static HasExplicitCurrentLanguage() {
159
- return M.currentLanguageExplicitlySet;
159
+ return S.currentLanguageExplicitlySet;
160
160
  }
161
161
  static onLanguageChange(t) {
162
- return M.languageChangeCallbacks.add(t), () => {
163
- M.languageChangeCallbacks.delete(t);
162
+ return S.languageChangeCallbacks.add(t), () => {
163
+ S.languageChangeCallbacks.delete(t);
164
164
  };
165
165
  }
166
166
  static SetGlobalVariables(t) {
167
- M.GlobalVariables = { ...M.GlobalVariables, ...t };
167
+ S.GlobalVariables = { ...S.GlobalVariables, ...t };
168
168
  }
169
169
  destroy() {
170
170
  throw new Error("Method not implemented.");
@@ -185,8 +185,8 @@ const M = class M {
185
185
  this.value = t, this.inputEl && (this.inputEl.value = String(t)), this.onChange && this.onChange(t), this.props.detectChange && this.props.detectChange(t);
186
186
  }
187
187
  clone() {
188
- const t = this.constructor, e = Y(this.props), i = new t(e);
189
- return i.value = Y(this.value), i;
188
+ const t = this.constructor, e = it(this.props), i = new t(e);
189
+ return i.value = it(this.value), i;
190
190
  }
191
191
  createInput(t) {
192
192
  t = { ...this.props.inputProps, ...t };
@@ -206,7 +206,7 @@ const M = class M {
206
206
  const i = document.createElement("div");
207
207
  i.className = t.wrapperClassName || "";
208
208
  const s = document.createElement("input");
209
- this.inputEl = s, s.value = String(t.value || Nt(t.inputType)), s.type = t.inputType, s.placeholder = t.placeholder || "", s.className = t.inputClassName || "", this.dataPropsPath && s.setAttribute("data-test-id", this.dataPropsPath);
209
+ this.inputEl = s, s.value = String(t.value || At(t.inputType)), s.type = t.inputType, s.placeholder = t.placeholder || "", s.className = t.inputClassName || "", this.dataPropsPath && s.setAttribute("data-test-id", this.dataPropsPath);
210
210
  const n = (a) => {
211
211
  const l = a.target;
212
212
  let r = l.value;
@@ -247,96 +247,96 @@ const M = class M {
247
247
  return i.className = "input-icon " + (e || ""), i.innerHTML = t, i;
248
248
  }
249
249
  };
250
- M.currentLanguageExplicitlySet = !1, M.languageChangeCallbacks = /* @__PURE__ */ new Set(), M.GlobalVariables = {
250
+ S.currentLanguageExplicitlySet = !1, S.languageChangeCallbacks = /* @__PURE__ */ new Set(), S.GlobalVariables = {
251
251
  primary: "#1B1958",
252
252
  secondary: "#0D0938",
253
253
  tertiary: "#2A1560",
254
254
  accent: "#189541",
255
255
  "text-dark": "#00141E",
256
256
  "text-light": "#FFFFFF"
257
- }, M.GlobalVariableGroups = [
257
+ }, S.GlobalVariableGroups = [
258
258
  {
259
259
  title: "Global Colors",
260
260
  keys: ["primary", "secondary", "tertiary", "accent"]
261
261
  },
262
262
  { title: "Text Color", keys: ["text-dark", "text-light"] }
263
263
  ];
264
- let w = M;
265
- function F(d) {
266
- return d instanceof w;
264
+ let w = S;
265
+ function R(c) {
266
+ return c instanceof w;
267
267
  }
268
- function L(d) {
269
- return d instanceof H;
268
+ function M(c) {
269
+ return c instanceof $;
270
270
  }
271
- function ct(d) {
272
- return F(d) || L(d);
271
+ function vt(c) {
272
+ return R(c) || M(c);
273
273
  }
274
- const ot = (d, t, e) => {
274
+ const dt = (c, 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;
276
+ const l = (d) => {
277
+ if (d.target.closest("button")) return;
278
+ i = !0, s = d.clientX, n = d.clientY;
279
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) => {
280
+ o = p.left, a = p.top, document.addEventListener("mousemove", r), document.addEventListener("mouseup", h), document.body.style.userSelect = "none";
281
+ }, r = (d) => {
282
282
  if (!i) return;
283
- const p = h.clientX - s, g = h.clientY - n, C = window.innerWidth, m = window.innerHeight, u = t.offsetWidth, f = t.offsetHeight;
284
- let v = o + p, y = a + g;
285
- v = Math.max(8, Math.min(C - u - 8, v)), y = Math.max(8, Math.min(m - f - 8, y)), t.style.left = `${v}px`, t.style.top = `${y}px`, e == null || e(v, y);
286
- }, c = () => {
287
- i = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", c), document.body.style.userSelect = "";
283
+ const p = d.clientX - s, m = d.clientY - n, C = window.innerWidth, g = window.innerHeight, u = t.offsetWidth, f = t.offsetHeight;
284
+ let v = o + p, y = a + m;
285
+ v = Math.max(8, Math.min(C - u - 8, v)), y = Math.max(8, Math.min(g - f - 8, y)), t.style.left = `${v}px`, t.style.top = `${y}px`, e == null || e(v, y);
286
+ }, h = () => {
287
+ i = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", h), document.body.style.userSelect = "";
288
288
  };
289
- d.addEventListener("mousedown", l);
290
- }, G = (d) => {
291
- if (!d) return null;
292
- let t = d.trim();
289
+ c.addEventListener("mousedown", l);
290
+ }, z = (c) => {
291
+ if (!c) return null;
292
+ let t = c.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
+ }, tt = (c, t, e) => `#${[c, t, e].map((i) => Math.max(0, Math.min(255, i)).toString(16).padStart(2, "0")).join("")}`, N = (c) => {
295
+ const t = c.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
- }, U = (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;
303
- let c = 0;
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
- }, W = (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;
301
+ }, q = (c) => {
302
+ const { r: t, g: e, b: i } = N(c), 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
+ let h = 0;
304
+ r !== 0 && (a === s ? h = (n - o) / r % 6 : a === n ? h = (o - s) / r + 2 : h = (s - n) / r + 4), h < 0 && (h += 6);
305
+ const d = a === 0 ? 0 : r / a, p = a;
306
+ return { h: h * 60, s: d, v: p };
307
+ }, Z = (c, t, e) => {
308
+ const i = (c % 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
- 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(
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), tt(
311
311
  Math.round((a + o) * 255),
312
312
  Math.round((l + o) * 255),
313
313
  Math.round((r + o) * 255)
314
314
  );
315
- }, Ct = (d, t, e) => {
315
+ }, St = (c, 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: c, sat: s, lightness: i };
318
+ }, rt = (c, t, e) => {
319
+ const i = (1 - Math.abs(2 * e - 1)) * t, s = i * (1 - Math.abs(c / 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 c < 60 ? (o = i, a = s, l = 0) : c < 120 ? (o = s, a = i, l = 0) : c < 180 ? (o = 0, a = i, l = s) : c < 240 ? (o = 0, a = s, l = i) : c < 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
+ }, ct = (c, 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 (c.startsWith("#")) {
329
+ const { r: s, g: n, b: o } = N(c);
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 (c.startsWith("rgba("))
333
+ return c.replace(/,\s*[\d.]+\)$/, `, ${e})`);
334
+ if (c.startsWith("rgb("))
335
+ return c.replace("rgb(", "rgba(").replace(")", `, ${e})`);
336
+ if (c.startsWith("hsl(")) {
337
+ const s = c.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
338
338
  if (s) {
339
- const { r: n, g: o, b: a } = it(
339
+ const { r: n, g: o, b: a } = rt(
340
340
  parseInt(s[1]),
341
341
  parseInt(s[2]) / 100,
342
342
  parseInt(s[3]) / 100
@@ -344,10 +344,10 @@ 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 (c.startsWith("hsla(")) {
348
+ const s = c.match(/hsla\((\d+),\s*(\d+)%,\s*(\d+)%,\s*[\d.]+\)/);
349
349
  if (s) {
350
- const { r: n, g: o, b: a } = it(
350
+ const { r: n, g: o, b: a } = rt(
351
351
  parseInt(s[1]),
352
352
  parseInt(s[2]) / 100,
353
353
  parseInt(s[3]) / 100
@@ -355,13 +355,13 @@ const ot = (d, t, e) => {
355
355
  return `rgba(${n}, ${o}, ${a}, ${e})`;
356
356
  }
357
357
  }
358
- const i = G(d);
358
+ const i = z(c);
359
359
  if (i) {
360
- const { r: s, g: n, b: o } = P(i);
360
+ const { r: s, g: n, b: o } = N(i);
361
361
  return `rgba(${s}, ${n}, ${o}, ${e})`;
362
362
  }
363
- return d;
364
- }, It = (d) => [
363
+ return c;
364
+ }, Dt = (c) => [
365
365
  "red",
366
366
  "green",
367
367
  "blue",
@@ -385,22 +385,22 @@ const ot = (d, t, e) => {
385
385
  "teal",
386
386
  "fuchsia",
387
387
  "transparent"
388
- ].includes(d.toLowerCase()), yt = (d) => [
388
+ ].includes(c.toLowerCase()), It = (c) => [
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())), St = (d) => {
393
+ ].some((e) => e.test(c.trim())), Rt = (c) => {
394
394
  if (typeof document > "u")
395
- return yt(d) || !!G(d);
395
+ return It(c) || !!z(c);
396
396
  const t = document.createElement("div");
397
- return t.style.color = d, t.style.color !== "";
398
- }, Et = (d) => {
399
- const t = d.trim();
397
+ return t.style.color = c, t.style.color !== "";
398
+ }, Nt = (c) => {
399
+ const t = c.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 {
403
- color: X(o, a, l),
403
+ color: tt(o, a, l),
404
404
  position: 0,
405
405
  opacity: Math.round(r / 255 * 100)
406
406
  };
@@ -411,7 +411,7 @@ const ot = (d, t, e) => {
411
411
  if (e) {
412
412
  const n = parseInt(e[1]), o = parseInt(e[2]), a = parseInt(e[3]), l = e[4] ? parseFloat(e[4]) : 1;
413
413
  return {
414
- color: X(n, o, a),
414
+ color: tt(n, o, a),
415
415
  position: 0,
416
416
  opacity: Math.round(l * 100)
417
417
  };
@@ -420,23 +420,23 @@ const ot = (d, t, e) => {
420
420
  /hsla?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)/
421
421
  );
422
422
  if (i) {
423
- const { r: n, g: o, b: a } = it(
423
+ const { r: n, g: o, b: a } = rt(
424
424
  parseFloat(i[1]),
425
425
  parseFloat(i[2]) / 100,
426
426
  parseFloat(i[3]) / 100
427
427
  ), l = i[4] ? parseFloat(i[4]) : 1;
428
428
  return {
429
- color: X(n, o, a),
429
+ color: tt(n, o, a),
430
430
  position: 0,
431
431
  opacity: Math.round(l * 100)
432
432
  };
433
433
  }
434
- return { color: G(t) || t, position: 0, opacity: 100 };
435
- }, ht = (d) => {
434
+ return { color: z(t) || t, position: 0, opacity: 100 };
435
+ }, ft = (c) => {
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 < c.length; s++) {
439
+ const n = c[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
+ }, Ct = (c, t) => {
450
+ const e = new RegExp(`${t}\\s*\\(`, "i"), i = c.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
- }, Vt = (d) => {
458
- const t = d.split(" ")[0].toLowerCase();
454
+ for (let a = s; a < c.length && n > 0; a++)
455
+ c[a] === "(" ? n++ : c[a] === ")" && n--, o = a;
456
+ return n === 0 ? c.substring(s, o) : null;
457
+ }, Ft = (c) => {
458
+ const t = c.split(" ")[0].toLowerCase();
459
459
  return [
460
460
  "circle",
461
461
  "ellipse",
@@ -466,38 +466,38 @@ 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) || It(t);
470
- }, pt = (d) => {
469
+ ].includes(t) ? !1 : /^#[0-9a-f]{3,8}$/i.test(t) || /^rgb/i.test(c) || /^hsl/i.test(c) || Dt(t);
470
+ }, yt = (c) => {
471
471
  const t = [];
472
- return d.forEach((e, i) => {
472
+ return c.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 && yt(a[1].trim()) ? (n = a[1].trim(), o = parseFloat(a[2])) : (n = s, o = d.length === 1 ? 0 : i / (d.length - 1) * 100);
478
- const l = Et(n);
477
+ a && It(a[1].trim()) ? (n = a[1].trim(), o = parseFloat(a[2])) : (n = s, o = c.length === 1 ? 0 : i / (c.length - 1) * 100);
478
+ const l = Nt(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
+ }, D = (c) => {
482
+ const t = c.stops && c.stops.length ? c.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: c.type && ["linear", "radial", "solid"].includes(c.type) ? c.type : "linear",
485
+ angle: typeof c.angle == "number" ? c.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();
494
- if (St(t)) {
495
- const s = Et(t);
496
- return A({ type: "solid", angle: 0, stops: [s] });
492
+ }, T = (c) => {
493
+ const t = c.replace(/;$/, "").trim();
494
+ if (Rt(t)) {
495
+ const s = Nt(t);
496
+ return D({ type: "solid", angle: 0, stops: [s] });
497
497
  }
498
- const e = dt(t, "linear-gradient");
498
+ const e = Ct(t, "linear-gradient");
499
499
  if (e) {
500
- const s = ht(e);
500
+ const s = ft(e);
501
501
  let n = 90, o = s;
502
502
  const a = s[0];
503
503
  if (a.includes("deg")) {
@@ -513,30 +513,30 @@ const ot = (d, t, e) => {
513
513
  "to top right": 45,
514
514
  "to top left": 315
515
515
  }[a] ?? 90, o = s.slice(1));
516
- const l = pt(o);
517
- return l.length ? A({ type: "linear", angle: n, stops: l }) : null;
516
+ const l = yt(o);
517
+ return l.length ? D({ type: "linear", angle: n, stops: l }) : null;
518
518
  }
519
- const i = dt(t, "radial-gradient");
519
+ const i = Ct(t, "radial-gradient");
520
520
  if (i) {
521
- const s = ht(i), n = s[0] && !Vt(s[0]) ? s.slice(1) : s, o = pt(n);
522
- return o.length ? A({ type: "radial", angle: 0, stops: o }) : null;
521
+ const s = ft(i), n = s[0] && !Ft(s[0]) ? s.slice(1) : s, o = yt(n);
522
+ return o.length ? D({ 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
+ }, P = (c) => {
526
+ if (c.type === "solid") {
527
+ const e = c.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(
534
- (e) => `${st(e.color, e.opacity ?? 100)} ${e.position}%`
533
+ const t = c.stops.map(
534
+ (e) => `${ct(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
- }, Tt = (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 c.type === "radial" ? `radial-gradient(circle, ${t})` : `linear-gradient(${c.angle}deg, ${t})`;
537
+ }, Gt = (c) => Math.round(c / 100 * 255).toString(16).toUpperCase().padStart(2, "0"), et = (c) => {
538
+ if (c.type === "solid") {
539
+ const t = c.stops[0];
540
540
  if (t) {
541
541
  const e = t.color;
542
542
  if (e.startsWith("var(--"))
@@ -546,14 +546,14 @@ const ot = (d, t, e) => {
546
546
  if (i === 100)
547
547
  return e;
548
548
  {
549
- const s = Tt(i);
549
+ const s = Gt(i);
550
550
  return `${e}${s}`;
551
551
  }
552
552
  }
553
553
  return "#000000";
554
554
  }
555
- return d.type === "linear" ? `Linear ${d.angle}°` : "Radial Gradient";
556
- }, q = class q {
555
+ return c.type === "linear" ? `Linear ${c.angle}°` : "Radial Gradient";
556
+ }, X = class X {
557
557
  static defaults() {
558
558
  return {
559
559
  solid: [],
@@ -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 = G(s);
566
+ let n = z(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 = G(t), s = "solid";
612
+ let i = z(t), s = "solid";
613
613
  if (i)
614
614
  s = "solid";
615
615
  else {
@@ -621,9 +621,9 @@ const ot = (d, t, e) => {
621
621
  a !== -1 && o.splice(a, 1), o.unshift(i), o.length > this.MAX_COLORS && (o.length = this.MAX_COLORS), this.persist();
622
622
  }
623
623
  };
624
- q.STORAGE_KEY = "settingsLib_recentColors", q.MAX_COLORS = 12, q.colors = null;
625
- let R = q;
626
- const at = (d, t) => {
624
+ X.STORAGE_KEY = "settingsLib_recentColors", X.MAX_COLORS = 18, X.colors = null;
625
+ let W = X;
626
+ const pt = (c, t) => {
627
627
  const e = document.createElement("div");
628
628
  e.className = "color-picker-recent-section";
629
629
  const i = document.createElement("div");
@@ -632,31 +632,31 @@ 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 = (h, d) => {
636
+ const p = h.getBoundingClientRect();
637
+ s.textContent = d, s.style.left = `${p.left + p.width / 2}px`, s.style.top = `${p.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 = R.getColors(t);
645
- if (c.length === 0) {
644
+ const h = W.getColors(t);
645
+ if (h.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) => {
649
+ a.style.display = "grid", l.style.display = "none", h.forEach((d) => {
650
650
  const p = document.createElement("button");
651
651
  p.type = "button", p.className = "color-picker-recent-swatch";
652
- const g = Pt(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);
652
+ const m = Ut(d);
653
+ if (p.title = m, p.setAttribute("aria-label", `Use color: ${m}`), d.includes("gradient(")) {
654
+ p.style.backgroundImage = d, p.style.backgroundColor = "transparent";
655
+ const g = T(d);
656
+ g && g.stops && g.stops.length > 0 && (p.style.borderColor = g.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", () => {
658
+ p.style.backgroundColor = d, p.style.borderColor = d;
659
+ p.addEventListener("mouseenter", () => o(p, m)), p.addEventListener("mouseleave", () => {
660
660
  n(), p.style.boxShadow = "";
661
661
  }), p.addEventListener("mousedown", () => {
662
662
  p.style.boxShadow = "0px 0px 0px 2px var(--grey40)";
@@ -665,47 +665,47 @@ const at = (d, t) => {
665
665
  p.style.boxShadow = "";
666
666
  }, 150);
667
667
  }), p.addEventListener("click", () => {
668
- n(), d(h);
668
+ n(), c(d);
669
669
  }), a.appendChild(p);
670
670
  });
671
671
  };
672
672
  return r(), { container: e, refresh: r };
673
- }, Pt = (d) => {
674
- const t = T(d);
673
+ }, Ut = (c) => {
674
+ const t = T(c);
675
675
  if (t)
676
- return K(t);
677
- const e = G(d);
676
+ return et(t);
677
+ const e = z(c);
678
678
  if (e) {
679
- const i = P(e);
679
+ const i = N(e);
680
680
  return `${e} (RGB: ${i.r}, ${i.g}, ${i.b})`;
681
681
  }
682
- return d;
683
- }, bt = `<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
682
+ return c;
683
+ }, Pt = `<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"
686
686
  fill="#919EAB"/>
687
- </svg>`, wt = `<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
687
+ </svg>`, Vt = `<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
688
688
  <path fill-rule="evenodd" clip-rule="evenodd" d="M19.1972 3.29156C18.936 3.03034 18.6259 2.82313 18.2847 2.68176C17.9434 2.54039 17.5777 2.46763 17.2083 2.46763C16.8389 2.46763 16.4731 2.54039 16.1319 2.68176C15.7906 2.82313 15.4805 3.03034 15.2194 3.29156L13.7822 4.72875C13.2585 4.4772 12.6697 4.39449 12.097 4.49207C11.5243 4.58964 10.9961 4.86267 10.5853 5.27343L9.91687 5.94281C9.74268 6.11693 9.6045 6.32366 9.51023 6.5512C9.41595 6.77873 9.36743 7.02261 9.36743 7.2689C9.36743 7.5152 9.41595 7.75907 9.51023 7.98661C9.6045 8.21414 9.74268 8.42088 9.91687 8.595L3.83625 14.6747C3.57512 14.936 3.36803 15.2462 3.2268 15.5875C3.08556 15.9288 3.01296 16.2947 3.01312 16.6641V18.3516C3.01312 18.6499 3.13165 18.9361 3.34263 19.1471C3.55361 19.358 3.83975 19.4766 4.13812 19.4766H5.82562C6.57129 19.4759 7.28618 19.1792 7.81312 18.6516L13.8937 12.5728C14.0679 12.747 14.2746 12.8852 14.5021 12.9795C14.7297 13.0737 14.9735 13.1223 15.2198 13.1223C15.4661 13.1223 15.71 13.0737 15.9375 12.9795C16.1651 12.8852 16.3718 12.747 16.5459 12.5728L17.2153 11.9025C17.6261 11.4917 17.8991 10.9635 17.9967 10.3908C18.0942 9.81811 18.0115 9.22926 17.76 8.70562L19.1972 7.26937C19.4584 7.0082 19.6656 6.69813 19.807 6.35687C19.9484 6.01561 20.0211 5.64985 20.0211 5.28047C20.0211 4.91108 19.9484 4.54532 19.807 4.20406C19.6656 3.8628 19.4584 3.55273 19.1972 3.29156ZM5.16281 16.0012L11.2425 9.92062L12.5681 11.2462L6.48844 17.3269C6.31266 17.5027 6.07424 17.6015 5.82562 17.6016H4.88812V16.6641C4.88818 16.4154 4.98698 16.177 5.16281 16.0012Z" fill="#353C47"/>
689
- </svg>`, Ot = `<svg width="15" height="17" viewBox="0 0 15 17" fill="none" xmlns="http://www.w3.org/2000/svg">
689
+ </svg>`, zt = `<svg width="15" height="17" viewBox="0 0 15 17" fill="none" xmlns="http://www.w3.org/2000/svg">
690
690
  <path d="M14.1333 12.4667H0.8M0.8 12.4667L4.13333 9.13332M0.8 12.4667L4.13333 15.8M0.8 4.13332H14.1333M14.1333 4.13332L10.8 0.799988M14.1333 4.13332L10.8 7.46665" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
691
- </svg>`, Ht = `<svg width="14" height="2" viewBox="0 0 14 2" fill="none" xmlns="http://www.w3.org/2000/svg">
691
+ </svg>`, Wt = `<svg width="14" height="2" viewBox="0 0 14 2" fill="none" xmlns="http://www.w3.org/2000/svg">
692
692
  <path d="M0.8 0.800003H12.4667" stroke="#919EAB" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
693
- </svg>`, Bt = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
693
+ </svg>`, jt = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
694
694
  <rect x="21.25" y="21.333" width="18" height="18" rx="1" transform="rotate(-180 21.25 21.333)" stroke="#637381"/>
695
695
  <rect x="18.5835" y="18.667" width="12.6667" height="12.6667" rx="1" transform="rotate(-180 18.5835 18.667)" fill="#637381"/>
696
696
  </svg>
697
697
 
698
- `, $t = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
698
+ `, _t = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
699
699
  <path d="M4.5 21L19.5 21C19.8978 21 20.2794 20.842 20.5607 20.5607C20.842 20.2794 21 19.8978 21 19.5L21 4.5C21 4.10218 20.842 3.72065 20.5607 3.43934C20.2794 3.15804 19.8978 3 19.5 3L4.5 3C4.10218 3 3.72065 3.15804 3.43934 3.43934C3.15804 3.72064 3 4.10218 3 4.5L3 19.5C3 19.8978 3.15804 20.2794 3.43934 20.5607C3.72065 20.842 4.10218 21 4.5 21ZM7.5 4.5L7.5 7.5L10.5 7.5L10.5 4.5L13.5 4.5L13.5 7.5L16.5 7.5L16.5 10.5L13.5 10.5L13.5 13.5L16.5 13.5L16.5 16.5L13.5 16.5L13.5 19.5L10.5 19.5L10.5 16.5L7.5 16.5L7.5 19.5L4.5 19.5L4.5 4.5L7.5 4.5Z" fill="#637381"/>
700
700
  <path d="M13.5 16.5L10.5 16.5L10.5 13.5L13.5 13.5L13.5 16.5ZM13.5 10.5L10.5 10.5L10.5 7.5L13.5 7.5L13.5 10.5ZM10.5 13.5L7.5 13.5L7.5 10.5L10.5 10.5L10.5 13.5Z" fill="#637381"/>
701
701
  </svg>
702
702
 
703
- `, At = `<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
703
+ `, qt = `<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
704
704
  <path d="M20.6106 19.5062C20.6887 19.5843 20.6887 19.711 20.6106 19.7891L19.7896 20.6101C19.7115 20.6882 19.5848 20.6882 19.5067 20.6101L5.98957 7.09298C5.91146 7.01488 5.91146 6.88825 5.98957 6.81014L6.81063 5.98908C6.88873 5.91097 7.01537 5.91097 7.09347 5.98908L20.6106 19.5062Z" fill="#46525C"/>
705
705
  <path d="M9.69583 12.2146C9.81298 12.3318 9.81298 12.5217 9.69583 12.6389L7.80151 14.5332C6.72071 15.614 6.6062 17.4365 7.80151 18.6318C8.99473 19.8267 10.8184 19.7123 11.8992 18.6318L13.7935 16.7366C13.9106 16.6194 14.1006 16.6194 14.2178 16.7366L14.816 17.3348C14.9331 17.4519 14.9332 17.6418 14.816 17.759L12.9216 19.6543C11.2241 21.3536 8.47364 21.3518 6.77417 19.6543C5.07483 17.9568 5.0749 15.2064 6.77417 13.5068L8.66848 11.6116C8.78563 11.4944 8.97562 11.4944 9.0928 11.6116L9.69583 12.2146ZM13.5085 6.77441C15.2061 5.07514 17.9565 5.07509 19.656 6.77441C21.3535 8.47388 21.3533 11.2243 19.656 12.9238L17.7607 14.8182C17.6436 14.9354 17.4536 14.9353 17.3365 14.8182L16.7344 14.2161C16.6172 14.0989 16.6172 13.9089 16.7344 13.7918L18.6296 11.8975C19.7101 10.8167 19.8245 8.99503 18.6296 7.7998C17.4363 6.60449 15.6118 6.719 14.531 7.7998L12.6367 9.69412C12.5195 9.81128 12.3296 9.81128 12.2124 9.69412L11.6123 9.09402C11.4952 8.97684 11.4952 8.78685 11.6124 8.6697L13.5085 6.77441Z" fill="#46525C"/>
706
706
  </svg>
707
707
  `;
708
- class ut {
708
+ class Zt {
709
709
  constructor(t, e = "gradient") {
710
710
  this.isOpen = !1, this.currentColor = "#FF0000", this.currentOpacity = 100, this.outsideClick = (i) => {
711
711
  if (!this.isOpen) return;
@@ -747,7 +747,7 @@ class ut {
747
747
  const i = document.createElement("span");
748
748
  i.textContent = "Color";
749
749
  const s = document.createElement("button");
750
- s.className = "color-picker-close", s.innerHTML = bt, s.addEventListener("click", () => this.close(!0)), e.appendChild(i), e.appendChild(s), ot(e, t);
750
+ s.className = "color-picker-close", s.innerHTML = Pt, s.addEventListener("click", () => this.close(!0)), e.appendChild(i), e.appendChild(s), dt(e, t);
751
751
  const n = document.createElement("div");
752
752
  n.className = "color-picker-area", this.colorArea = n;
753
753
  const o = document.createElement("div");
@@ -755,24 +755,24 @@ class ut {
755
755
  const a = document.createElement("div");
756
756
  a.className = "color-picker-sliders-container";
757
757
  const l = document.createElement("button");
758
- l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = wt;
758
+ l.className = "color-picker-eyedropper", l.type = "button", l.innerHTML = Vt;
759
759
  const r = document.createElement("div");
760
760
  r.className = "color-picker-sliders-group";
761
- const c = document.createElement("div");
762
- c.className = "color-picker-hue", this.hueSlider = c;
763
761
  const h = document.createElement("div");
764
- h.className = "color-picker-hue-marker", this.hueMarker = h, c.appendChild(h);
762
+ h.className = "color-picker-hue", this.hueSlider = h;
763
+ const d = document.createElement("div");
764
+ d.className = "color-picker-hue-marker", this.hueMarker = d, h.appendChild(d);
765
765
  const p = document.createElement("div");
766
766
  p.className = "color-picker-opacity", this.opacitySlider = p;
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 C = at((E) => {
770
- var b;
771
- this.setColor(E), (b = this.onChange) == null || b.call(this, E, this.currentOpacity);
767
+ const m = document.createElement("div");
768
+ m.className = "color-picker-opacity-marker", this.opacityMarker = m, p.appendChild(m), r.appendChild(h), r.appendChild(p), a.appendChild(l), a.appendChild(r);
769
+ const C = pt((E) => {
770
+ var L;
771
+ this.setColor(E), (L = this.onChange) == null || L.call(this, E, this.currentOpacity);
772
772
  }, this.recentScope);
773
773
  this.recentSectionRefresh = C.refresh;
774
- const m = document.createElement("div");
775
- m.className = "color-picker-format-section";
774
+ const g = document.createElement("div");
775
+ g.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 f = document.createElement("option");
@@ -781,56 +781,56 @@ class ut {
781
781
  v.value = "rgb", v.textContent = "RGB";
782
782
  const y = document.createElement("option");
783
783
  y.value = "hsl", y.textContent = "HSL", u.appendChild(f), u.appendChild(v), u.appendChild(y);
784
- const x = document.createElement("input");
785
- x.type = "text", x.className = "color-picker-color-input", x.value = this.currentColor, this.input = x;
784
+ const b = document.createElement("input");
785
+ b.type = "text", b.className = "color-picker-color-input", b.value = this.currentColor, this.input = b;
786
786
  const k = document.createElement("div");
787
787
  k.className = "color-picker-input-container";
788
- const I = document.createElement("button");
789
- return I.className = "color-picker-copy-inside", I.textContent = "Copy", k.appendChild(x), k.appendChild(I), m.appendChild(u), m.appendChild(k), 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, p, x, u, I, l), t;
788
+ const x = document.createElement("button");
789
+ return x.className = "color-picker-copy-inside", x.textContent = "Copy", k.appendChild(b), k.appendChild(x), g.appendChild(u), g.appendChild(k), t.appendChild(e), t.appendChild(n), t.appendChild(a), t.appendChild(C.container), t.appendChild(g), t.addEventListener("click", (E) => E.stopPropagation()), this.bind(n, h, p, b, u, x, 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) => {
796
+ const l = (d) => {
797
797
  var v;
798
- const p = t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (h.clientX - p.left) / p.width)), C = Math.max(0, Math.min(1, (h.clientY - p.top) / p.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, f = W(u, g, 1 - C);
798
+ const p = t.getBoundingClientRect(), m = Math.max(0, Math.min(1, (d.clientX - p.left) / p.width)), C = Math.max(0, Math.min(1, (d.clientY - p.top) / p.height));
799
+ this.colorMarker.style.left = `${m * 100}%`, this.colorMarker.style.top = `${C * 100}%`;
800
+ const u = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, f = Z(u, m, 1 - C);
801
801
  this.currentColor = f, this.syncInput(), this.updateOpacityBg(), (v = this.onChange) == null || v.call(this, f, this.currentOpacity);
802
- }, r = (h) => {
802
+ }, r = (d) => {
803
803
  var v;
804
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 C = g * 360, m = this.parsePercentage(this.colorMarker.style.left || "0%"), u = this.parsePercentage(this.colorMarker.style.top || "0%"), f = W(C, m, 1 - u);
805
+ let m = Math.max(0, Math.min(1, (d.clientX - p.left) / p.width));
806
+ this.hueMarker.style.left = `${m * 100}%`;
807
+ const C = m * 360, g = this.parsePercentage(this.colorMarker.style.left || "0%"), u = this.parsePercentage(this.colorMarker.style.top || "0%"), f = Z(C, g, 1 - u);
808
808
  this.currentColor = f, this.colorArea.style.background = `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${C}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), (v = this.onChange) == null || v.call(this, f, this.currentOpacity);
809
- }, c = (h) => {
809
+ }, h = (d) => {
810
810
  var C;
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), (C = this.onChange) == null || C.call(this, this.currentColor, this.currentOpacity);
811
+ const p = i.getBoundingClientRect(), m = Math.max(0, Math.min(1, (d.clientX - p.left) / p.width));
812
+ this.opacityMarker.style.left = `${m * 100}%`, this.currentOpacity = Math.round(m * 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 = (C) => l(C), g = () => {
817
- document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
814
+ t.addEventListener("mousedown", (d) => {
815
+ d.preventDefault(), l(d);
816
+ const p = (C) => l(C), m = () => {
817
+ document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", m);
818
818
  };
819
- document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
820
- }), e.addEventListener("mousedown", (h) => {
821
- h.preventDefault(), r(h);
822
- const p = (C) => r(C), g = () => {
823
- document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
819
+ document.addEventListener("mousemove", p), document.addEventListener("mouseup", m);
820
+ }), e.addEventListener("mousedown", (d) => {
821
+ d.preventDefault(), r(d);
822
+ const p = (C) => r(C), m = () => {
823
+ document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", m);
824
824
  };
825
- document.addEventListener("mousemove", p), document.addEventListener("mouseup", g);
826
- }), i.addEventListener("mousedown", (h) => {
827
- h.preventDefault(), c(h);
828
- const p = (C) => c(C), g = () => {
829
- document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", g);
825
+ document.addEventListener("mousemove", p), document.addEventListener("mouseup", m);
826
+ }), i.addEventListener("mousedown", (d) => {
827
+ d.preventDefault(), h(d);
828
+ const p = (C) => h(C), m = () => {
829
+ document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", m);
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", p), document.addEventListener("mouseup", m);
832
+ }), n.addEventListener("change", () => this.syncInput()), s.addEventListener("input", () => this.applyFromInput()), s.addEventListener("blur", () => this.syncInput()), s.addEventListener("keydown", (d) => {
833
+ d.key === "Enter" && (d.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 d;
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 p = new window.EyeDropper(), { sRGBHex: m } = await p.open();
848
+ this.setColor(m), (d = this.onChange) == null || d.call(this, m, this.currentOpacity);
849
849
  } catch {
850
850
  }
851
851
  }), document.addEventListener("keydown", this.keyDown, !0), setTimeout(
@@ -856,17 +856,17 @@ class ut {
856
856
  setColor(t) {
857
857
  var o;
858
858
  this.currentColor = t;
859
- const { h: e, s: i, v: s } = U(t), n = e >= 360 ? e % 360 : e;
859
+ const { h: e, s: i, v: s } = q(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 } = U(this.currentColor);
863
+ const t = this.select.value, { h: e, s: i, v: s } = q(this.currentColor);
864
864
  if (t === "hex") this.input.value = this.currentColor;
865
865
  else if (t === "rgb") {
866
- const { r: n, g: o, b: a } = P(this.currentColor);
866
+ const { r: n, g: o, b: a } = N(this.currentColor);
867
867
  this.input.value = `rgb(${n}, ${o}, ${a})`;
868
868
  } else {
869
- const { hue: n, sat: o, lightness: a } = Ct(e, i, s);
869
+ const { hue: n, sat: o, lightness: a } = St(e, i, s);
870
870
  this.input.value = `hsl(${Math.round(n)}, ${Math.round(
871
871
  o * 100
872
872
  )}%, ${Math.round(a * 100)}%)`;
@@ -885,40 +885,49 @@ 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 = W(n, r, l);
888
+ e = Z(n, r, l);
889
889
  }
890
890
  }
891
891
  }
892
892
  e && this.setColor(e);
893
893
  }
894
894
  updateOpacityBg() {
895
- const { r: t, g: e, b: i } = P(this.currentColor);
895
+ const { r: t, g: e, b: i } = N(this.currentColor);
896
896
  this.opacitySlider.style.setProperty(
897
897
  "--base-color",
898
898
  `rgb(${t}, ${e}, ${i})`
899
+ ), this.opacitySlider.style.setProperty(
900
+ "--base-color-transparent",
901
+ `rgba(${t}, ${e}, ${i}, 0)`
899
902
  );
900
903
  }
901
904
  open(t, e, i) {
902
905
  var y;
903
906
  this.currentColor = t, this.currentOpacity = i ?? 100, this.syncInput();
904
- const { h: s, s: n, v: o } = U(t);
907
+ const { h: s, s: n, v: o } = q(t);
905
908
  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, C = r.top;
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 f = h - r.bottom, v = r.top;
911
- f >= l + p ? C = r.bottom + 8 : v >= l + p ? C = r.top - l - 8 : f > v ? (C = r.bottom + 8, C + l > h - p && (C = h - l - p)) : (C = r.top - l - 8, C < p && (C = p)), this.element.style.left = `${g}px`, this.element.style.top = `${C}px`;
909
+ const a = this.element.offsetWidth, l = this.element.offsetHeight, r = e.getBoundingClientRect(), h = window.innerWidth, d = window.innerHeight, p = 16;
910
+ let m = r.right + 8, C = r.top;
911
+ const g = h - r.right, u = r.left;
912
+ g >= a + p ? m = r.right + 8 : u >= a + p ? m = r.left - a - 8 : m = Math.max(p, (h - a) / 2);
913
+ const f = d - r.bottom, v = r.top;
914
+ f >= l + p ? C = r.bottom + 8 : v >= l + p ? C = r.top - l - 8 : f > v ? (C = r.bottom + 8, C + l > d - p && (C = d - l - p)) : (C = r.top - l - 8, C < p && (C = p)), this.element.style.left = `${m}px`, this.element.style.top = `${C}px`;
912
915
  }
913
916
  close(t) {
914
917
  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" && (R.addColor(this.currentColor, this.recentScope), (e = this.recentSectionRefresh) == null || e.call(this)));
918
+ 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" && (W.addColor(this.currentColor, this.recentScope), (e = this.recentSectionRefresh) == null || e.call(this)));
919
+ }
920
+ setOnChange(t) {
921
+ this.onChange = t;
922
+ }
923
+ getIsOpen() {
924
+ return this.isOpen;
916
925
  }
917
926
  getElement() {
918
927
  return this.element;
919
928
  }
920
929
  }
921
- class Dt {
930
+ class Jt {
922
931
  constructor(t) {
923
932
  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
933
  }
@@ -928,7 +937,7 @@ class Dt {
928
937
  }
929
938
  sanitizeColor(t) {
930
939
  const e = this.currentColor || "#FFFFFF";
931
- return G(t) ?? e;
940
+ return z(t) ?? e;
932
941
  }
933
942
  clampOpacity(t) {
934
943
  return Number.isFinite(t) ? Math.min(100, Math.max(0, Math.round(t))) : 100;
@@ -943,7 +952,7 @@ class Dt {
943
952
  const s = document.createElement("div");
944
953
  s.className = "color-picker-sliders-container embedded";
945
954
  const n = document.createElement("button");
946
- n.className = "color-picker-eyedropper", n.type = "button", n.innerHTML = wt;
955
+ n.className = "color-picker-eyedropper", n.type = "button", n.innerHTML = Vt;
947
956
  const o = document.createElement("div");
948
957
  o.className = "color-picker-sliders-group";
949
958
  const a = document.createElement("div");
@@ -952,69 +961,69 @@ class Dt {
952
961
  l.className = "color-picker-hue-marker", this.hueMarker = l, a.appendChild(l);
953
962
  const r = document.createElement("div");
954
963
  r.className = "color-picker-opacity embedded", this.opacitySlider = r;
955
- const c = document.createElement("div");
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);
957
- const h = at((x) => {
958
- const k = T(x);
959
- k && k.type !== "solid" ? this.onColorChange(x, this.currentOpacity) : (this.setColor(x), this.onColorChange(this.currentColor, this.currentOpacity));
964
+ const h = document.createElement("div");
965
+ h.className = "color-picker-opacity-marker", this.opacityMarker = h, r.appendChild(h), o.appendChild(a), o.appendChild(r), s.appendChild(n), s.appendChild(o);
966
+ const d = pt((b) => {
967
+ const k = T(b);
968
+ k && k.type !== "solid" ? this.onColorChange(b, this.currentOpacity) : (this.setColor(b), this.onColorChange(this.currentColor, this.currentOpacity));
960
969
  }, "all");
961
- this.recentSectionRefresh = h.refresh;
970
+ this.recentSectionRefresh = d.refresh;
962
971
  const p = document.createElement("div");
963
972
  p.className = "color-picker-format-section embedded";
964
- const g = document.createElement("select");
965
- g.className = "color-picker-format-select", this.select = g;
973
+ const m = document.createElement("select");
974
+ m.className = "color-picker-format-select", this.select = m;
966
975
  const C = document.createElement("option");
967
976
  C.value = "hex", C.textContent = "HEX";
968
- const m = document.createElement("option");
969
- m.value = "rgb", m.textContent = "RGB";
977
+ const g = document.createElement("option");
978
+ g.value = "rgb", g.textContent = "RGB";
970
979
  const u = document.createElement("option");
971
- u.value = "hsl", u.textContent = "HSL", g.appendChild(C), g.appendChild(m), g.appendChild(u);
980
+ u.value = "hsl", u.textContent = "HSL", m.appendChild(C), m.appendChild(g), m.appendChild(u);
972
981
  const f = document.createElement("input");
973
982
  f.type = "text", f.className = "color-picker-color-input", this.input = f;
974
983
  const v = document.createElement("div");
975
984
  v.className = "color-picker-input-container";
976
985
  const y = document.createElement("button");
977
- return y.className = "color-picker-copy-inside", y.textContent = "Copy", v.appendChild(f), v.appendChild(y), p.appendChild(g), p.appendChild(v), t.appendChild(e), t.appendChild(s), t.appendChild(p), t.appendChild(h.container), this.bind(e, a, r, f, g, y, n), t;
986
+ return y.className = "color-picker-copy-inside", y.textContent = "Copy", v.appendChild(f), v.appendChild(y), p.appendChild(m), p.appendChild(v), t.appendChild(e), t.appendChild(s), t.appendChild(p), t.appendChild(d.container), this.bind(e, a, r, f, m, y, n), t;
978
987
  }
979
988
  bind(t, e, i, s, n, o, a) {
980
- const l = (p, g) => {
981
- const C = g || t.getBoundingClientRect(), m = Math.max(0, Math.min(1, (p.clientX - C.left) / C.width)), u = Math.max(0, Math.min(1, (p.clientY - C.top) / C.height));
982
- this.colorMarker.style.left = `${m * 100}%`, this.colorMarker.style.top = `${u * 100}%`;
983
- const v = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, y = W(v, m, 1 - u);
989
+ const l = (p, m) => {
990
+ const C = m || t.getBoundingClientRect(), g = Math.max(0, Math.min(1, (p.clientX - C.left) / C.width)), u = Math.max(0, Math.min(1, (p.clientY - C.top) / C.height));
991
+ this.colorMarker.style.left = `${g * 100}%`, this.colorMarker.style.top = `${u * 100}%`;
992
+ const v = this.parsePercentage(this.hueMarker.style.left || "0%") * 360, y = Z(v, g, 1 - u);
984
993
  this.currentColor = y, this.syncInput(), this.updateOpacityBg(), this.queueChange();
985
- }, r = (p, g) => {
986
- const C = g || e.getBoundingClientRect(), m = Math.max(0, Math.min(1, (p.clientX - C.left) / C.width));
987
- this.hueMarker.style.left = `${m * 100}%`;
988
- const u = m * 360, f = this.parsePercentage(this.colorMarker.style.left || "0%"), v = this.parsePercentage(this.colorMarker.style.top || "0%"), y = W(u, f, 1 - v);
994
+ }, r = (p, m) => {
995
+ const C = m || e.getBoundingClientRect(), g = Math.max(0, Math.min(1, (p.clientX - C.left) / C.width));
996
+ this.hueMarker.style.left = `${g * 100}%`;
997
+ const u = g * 360, f = this.parsePercentage(this.colorMarker.style.left || "0%"), v = this.parsePercentage(this.colorMarker.style.top || "0%"), y = Z(u, f, 1 - v);
989
998
  this.currentColor = y, this.colorArea.style.background = `linear-gradient(to top, #000, transparent),
990
999
  linear-gradient(to right, #fff, hsl(${u}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg(), this.queueChange();
991
- }, c = (p, g) => {
992
- const C = g || i.getBoundingClientRect(), m = Math.max(0, Math.min(1, (p.clientX - C.left) / C.width));
993
- this.opacityMarker.style.left = `${m * 100}%`, this.currentOpacity = this.clampOpacity(m * 100), this.queueChange();
994
- }, h = (p, g, C) => {
995
- p.preventDefault(), this.isDragging = !0, this.cachedRect = C.getBoundingClientRect(), g(p, this.cachedRect);
996
- let m = null, u;
1000
+ }, h = (p, m) => {
1001
+ const C = m || i.getBoundingClientRect(), g = Math.max(0, Math.min(1, (p.clientX - C.left) / C.width));
1002
+ this.opacityMarker.style.left = `${g * 100}%`, this.currentOpacity = this.clampOpacity(g * 100), this.queueChange();
1003
+ }, d = (p, m, C) => {
1004
+ p.preventDefault(), this.isDragging = !0, this.cachedRect = C.getBoundingClientRect(), m(p, this.cachedRect);
1005
+ let g = null, u;
997
1006
  const f = () => {
998
1007
  this.dragRafId === void 0 && (this.dragRafId = window.requestAnimationFrame(() => {
999
- this.dragRafId = void 0, m && this.cachedRect && g(m, this.cachedRect);
1008
+ this.dragRafId = void 0, g && this.cachedRect && m(g, this.cachedRect);
1000
1009
  }));
1001
1010
  }, v = () => {
1002
- this.isDragging && (this.isDragging = !1, this.dragRafId !== void 0 && (cancelAnimationFrame(this.dragRafId), this.dragRafId = void 0), this.cachedRect = void 0, m = null, this.flushChange(), document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", v), window.removeEventListener("blur", v), this.applyPendingExternal());
1011
+ this.isDragging && (this.isDragging = !1, this.dragRafId !== void 0 && (cancelAnimationFrame(this.dragRafId), this.dragRafId = void 0), this.cachedRect = void 0, g = null, this.flushChange(), document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", v), window.removeEventListener("blur", v), this.applyPendingExternal());
1003
1012
  };
1004
1013
  u = (y) => {
1005
1014
  if (!y.buttons) {
1006
1015
  v();
1007
1016
  return;
1008
1017
  }
1009
- m = y, f();
1018
+ g = y, f();
1010
1019
  }, document.addEventListener("mousemove", u), document.addEventListener("mouseup", v), window.addEventListener("blur", v);
1011
1020
  };
1012
1021
  t.addEventListener("mousedown", (p) => {
1013
- h(p, l, t);
1022
+ d(p, l, t);
1014
1023
  }), e.addEventListener("mousedown", (p) => {
1015
- h(p, r, e);
1024
+ d(p, r, e);
1016
1025
  }), i.addEventListener("mousedown", (p) => {
1017
- h(p, c, i);
1026
+ d(p, h, i);
1018
1027
  }), n.addEventListener("change", () => {
1019
1028
  this.syncInput();
1020
1029
  }), s.addEventListener("input", () => {
@@ -1035,8 +1044,8 @@ class Dt {
1035
1044
  return;
1036
1045
  }
1037
1046
  try {
1038
- const p = new window.EyeDropper(), { sRGBHex: g } = await p.open();
1039
- this.setColor(g), this.onColorChange(this.currentColor, this.currentOpacity);
1047
+ const p = new window.EyeDropper(), { sRGBHex: m } = await p.open();
1048
+ this.setColor(m), this.onColorChange(this.currentColor, this.currentOpacity);
1040
1049
  } catch {
1041
1050
  }
1042
1051
  });
@@ -1044,19 +1053,19 @@ class Dt {
1044
1053
  setColor(t) {
1045
1054
  const e = this.sanitizeColor(t);
1046
1055
  this.currentColor = e;
1047
- const { h: i, s, v: n } = U(e), o = i >= 360 ? i % 360 : i;
1056
+ const { h: i, s, v: n } = q(e), o = i >= 360 ? i % 360 : i;
1048
1057
  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),
1049
1058
  linear-gradient(to right, #fff, hsl(${o}, 100%, 50%))`, this.syncInput(), this.updateOpacityBg();
1050
1059
  }
1051
1060
  syncInput() {
1052
- const t = this.select.value, { h: e, s: i, v: s } = U(this.currentColor);
1061
+ const t = this.select.value, { h: e, s: i, v: s } = q(this.currentColor);
1053
1062
  if (t === "hex")
1054
1063
  this.input.value = this.currentColor;
1055
1064
  else if (t === "rgb") {
1056
- const { r: n, g: o, b: a } = P(this.currentColor);
1065
+ const { r: n, g: o, b: a } = N(this.currentColor);
1057
1066
  this.input.value = `rgb(${n}, ${o}, ${a})`;
1058
1067
  } else {
1059
- const { hue: n, sat: o, lightness: a } = Ct(e, i, s);
1068
+ const { hue: n, sat: o, lightness: a } = St(e, i, s);
1060
1069
  this.input.value = `hsl(${Math.round(n)}, ${Math.round(
1061
1070
  o * 100
1062
1071
  )}%, ${Math.round(a * 100)}%)`;
@@ -1076,17 +1085,20 @@ class Dt {
1076
1085
  const s = t.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);
1077
1086
  if (s) {
1078
1087
  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);
1079
- e = W(n, r, l);
1088
+ e = Z(n, r, l);
1080
1089
  }
1081
1090
  }
1082
1091
  }
1083
1092
  e && (this.setColor(e), this.onColorChange(this.currentColor, this.currentOpacity));
1084
1093
  }
1085
1094
  updateOpacityBg() {
1086
- const { r: t, g: e, b: i } = P(this.currentColor);
1095
+ const { r: t, g: e, b: i } = N(this.currentColor);
1087
1096
  this.opacitySlider.style.setProperty(
1088
1097
  "--base-color",
1089
1098
  `rgb(${t}, ${e}, ${i})`
1099
+ ), this.opacitySlider.style.setProperty(
1100
+ "--base-color-transparent",
1101
+ `rgba(${t}, ${e}, ${i}, 0)`
1090
1102
  );
1091
1103
  }
1092
1104
  queueChange() {
@@ -1106,13 +1118,13 @@ class Dt {
1106
1118
  var l;
1107
1119
  const i = this.sanitizeColor(t);
1108
1120
  this.currentColor = i, this.currentOpacity = this.clampOpacity(e);
1109
- const { h: s, s: n, v: o } = U(i), a = s >= 360 ? s % 360 : s;
1121
+ const { h: s, s: n, v: o } = q(i), a = s >= 360 ? s % 360 : s;
1110
1122
  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),
1111
1123
  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);
1112
1124
  }
1113
1125
  commitRecentColor() {
1114
1126
  var t;
1115
- this.recentScope === "solid" && (R.addColor(this.currentColor, this.recentScope), (t = this.recentSectionRefresh) == null || t.call(this));
1127
+ this.recentScope === "solid" && (W.addColor(this.currentColor, this.recentScope), (t = this.recentSectionRefresh) == null || t.call(this));
1116
1128
  }
1117
1129
  getElement() {
1118
1130
  return this.element;
@@ -1136,21 +1148,30 @@ const V = class V extends w {
1136
1148
  type: "text",
1137
1149
  angle: "number",
1138
1150
  stops: "text"
1139
- }, 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) => {
1151
+ }, 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.sharedStopColorPicker = null, this.colorPickerStopIndex = null, this.variant = "default", this.globalLayoutMode = "list", this.globalSearchQuery = "", this.currentMode = "custom", this.linkedGlobalVariable = null, this.unlinkButton = null, this.onBackgroundClick = (i) => {
1140
1152
  var p;
1141
1153
  if (!this.popoverEl || !this.isPopoverOpen) return;
1142
- 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");
1143
- !n && !o && !l && !r && !c && !h && this.closePopover();
1154
+ 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((m) => m.contains(s)), r = s.closest(".gstop-color-input, .gradient-mini-preview, .gstop-color-preview"), h = s.classList.contains("color-picker-backdrop"), d = s.classList.contains("gradient-popover-backdrop");
1155
+ !n && !o && !l && !r && !h && !d && this.closePopover();
1144
1156
  }, this.handlePopoverKeydown = (i) => {
1157
+ var s, n;
1145
1158
  if (this.isPopoverOpen) {
1146
1159
  if (i.key === "Escape") {
1147
- i.preventDefault(), this.closePopover();
1160
+ if (i.preventDefault(), (s = this.sharedStopColorPicker) != null && s.getIsOpen()) {
1161
+ this.sharedStopColorPicker.close(!1), this.colorPickerStopIndex = null;
1162
+ return;
1163
+ }
1164
+ this.closePopover();
1148
1165
  return;
1149
1166
  }
1150
1167
  if (i.key === "Enter") {
1151
- const s = i.target;
1152
- if (s && (s.tagName === "INPUT" || s.tagName === "TEXTAREA")) return;
1153
- i.preventDefault(), this.closePopover();
1168
+ const o = i.target;
1169
+ if (o && (o.tagName === "INPUT" || o.tagName === "TEXTAREA")) return;
1170
+ if (i.preventDefault(), (n = this.sharedStopColorPicker) != null && n.getIsOpen()) {
1171
+ this.sharedStopColorPicker.close(!0), this.colorPickerStopIndex = null;
1172
+ return;
1173
+ }
1174
+ this.closePopover();
1154
1175
  }
1155
1176
  }
1156
1177
  }, this.detectChange = t.detectChange, this.variant = t.variant ?? "default", this.originalDefault = t.default, this.value = this.defaultValue(), this.setLinkedGlobalVariableFrom(this.originalDefault ?? this.value);
@@ -1162,6 +1183,9 @@ const V = class V extends w {
1162
1183
  }
1163
1184
  return t;
1164
1185
  }
1186
+ getSharedStopColorPicker() {
1187
+ return this.sharedStopColorPicker || (this.sharedStopColorPicker = new Zt(void 0, "solid")), this.sharedStopColorPicker;
1188
+ }
1165
1189
  setLinkedGlobalVariableFrom(t) {
1166
1190
  var i, s;
1167
1191
  if (!t) {
@@ -1192,16 +1216,16 @@ const V = class V extends w {
1192
1216
  const t = this.originalDefault;
1193
1217
  if (typeof t == "string") {
1194
1218
  if (t.startsWith("var(--"))
1195
- return A({
1219
+ return D({
1196
1220
  type: "solid",
1197
1221
  angle: 0,
1198
1222
  stops: [{ color: t, position: 0, opacity: 100 }]
1199
1223
  });
1200
1224
  const i = T(t);
1201
1225
  if (i)
1202
- return A(i);
1226
+ return D(i);
1203
1227
  }
1204
- return A(t && typeof t == "object" ? t : {
1228
+ return D(t && typeof t == "object" ? t : {
1205
1229
  type: "linear",
1206
1230
  angle: 90,
1207
1231
  stops: [
@@ -1212,27 +1236,27 @@ const V = class V extends w {
1212
1236
  }
1213
1237
  setValue(t) {
1214
1238
  let e = null;
1215
- typeof t == "string" ? t.startsWith("var(--") ? e = A({
1239
+ typeof t == "string" ? t.startsWith("var(--") ? e = D({
1216
1240
  type: "solid",
1217
1241
  angle: 0,
1218
1242
  stops: [{ color: t, position: 0, opacity: 100 }]
1219
- }) : e = T(t) : t && typeof t == "object" && (e = A(t)), e || (e = this.defaultValue()), this.value = e, this.setLinkedGlobalVariableFrom(t ?? e), this.updateUI(), this.isPopoverOpen && this.refreshPopoverContent(), this.triggerChange(), this.pendingSolidColor = null, this.updateUnlinkButtonVisibility();
1243
+ }) : e = T(t) : t && typeof t == "object" && (e = D(t)), e || (e = this.defaultValue()), this.value = e, this.setLinkedGlobalVariableFrom(t ?? e), this.updateUI(), this.isPopoverOpen && this.refreshPopoverContent(), this.triggerChange(), this.pendingSolidColor = null, this.updateUnlinkButtonVisibility();
1220
1244
  }
1221
1245
  updateUI() {
1222
1246
  if (this.previewEl && this.value)
1223
1247
  if (this.value.type === "solid") {
1224
1248
  const t = this.value.stops[0], e = t.opacity ?? 100, i = this.resolveGlobalVarColor(t.color);
1225
- this.previewEl.style.background = st(i, e);
1249
+ this.previewEl.style.background = ct(i, e);
1226
1250
  } else {
1227
1251
  const t = this.resolveGradientGlobalVars(this.value);
1228
- this.previewEl.style.background = S(t);
1252
+ this.previewEl.style.background = P(t);
1229
1253
  }
1230
1254
  if (this.inputEl && this.value && !this.isEditing)
1231
1255
  if (this.isBoundToGlobal() && this.linkedGlobalVariable) {
1232
1256
  const e = this.linkedGlobalVariable.replace("var(--", "").replace(")", "").split("-").map((i) => i.charAt(0).toUpperCase() + i.slice(1)).join(" ");
1233
1257
  this.inputEl.value = `Linked: ${e}`;
1234
1258
  } else
1235
- this.inputEl.value = K(this.value);
1259
+ this.inputEl.value = et(this.value);
1236
1260
  this.updateUnlinkButtonVisibility();
1237
1261
  }
1238
1262
  resolveGradientGlobalVars(t) {
@@ -1251,7 +1275,7 @@ const V = class V extends w {
1251
1275
  }
1252
1276
  cssForTextValue() {
1253
1277
  return this.value ? {
1254
- background: S(this.value),
1278
+ background: P(this.value),
1255
1279
  "-webkit-background-clip": "text",
1256
1280
  "background-clip": "text",
1257
1281
  color: "transparent",
@@ -1267,28 +1291,28 @@ const V = class V extends w {
1267
1291
  s.className = "input-label", s.textContent = this.props.title, i.appendChild(s), t.appendChild(i);
1268
1292
  }
1269
1293
  const e = document.createElement("div");
1270
- return e.className = "gradient-input-wrapper", this.previewEl = document.createElement("div"), this.previewEl.className = "gradient-mini-preview", this.previewEl.style.background = this.value ? S(this.value) : "linear-gradient(90deg, #a84b4b 0%, #786666 100%)", this.previewEl.addEventListener("click", (i) => {
1294
+ return e.className = "gradient-input-wrapper", this.previewEl = document.createElement("div"), this.previewEl.className = "gradient-mini-preview", this.previewEl.style.background = this.value ? P(this.value) : "linear-gradient(90deg, #a84b4b 0%, #786666 100%)", this.previewEl.addEventListener("click", (i) => {
1271
1295
  i.preventDefault(), i.stopPropagation(), this.openPopover();
1272
- }), this.inputEl = document.createElement("input"), this.inputEl.type = "text", this.inputEl.className = "gradient-text-input", this.inputEl.placeholder = "Enter gradient CSS or paste color...", this.inputEl.value = this.value ? K(this.value) : "", this.inputEl.readOnly = !1, this.inputEl.addEventListener("focus", () => {
1296
+ }), this.inputEl = document.createElement("input"), this.inputEl.type = "text", this.inputEl.className = "gradient-text-input", this.inputEl.placeholder = "Enter gradient CSS or paste color...", this.inputEl.value = this.value ? et(this.value) : "", this.inputEl.readOnly = !1, this.inputEl.addEventListener("focus", () => {
1273
1297
  if (this.isEditing = !0, this.value)
1274
1298
  if (this.value.type === "solid") {
1275
1299
  const i = this.value.stops[0];
1276
1300
  if (i) {
1277
- const s = i.color.toUpperCase(), n = i.opacity ?? 100;
1278
- if (n === 100)
1279
- this.inputEl.value = s;
1301
+ const n = this.resolveGlobalVarColor(i.color).toUpperCase(), o = i.opacity ?? 100;
1302
+ if (o === 100)
1303
+ this.inputEl.value = n;
1280
1304
  else {
1281
- const a = Math.round(n / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
1282
- this.inputEl.value = `${s}${a}`;
1305
+ const l = Math.round(o / 100 * 255).toString(16).toUpperCase().padStart(2, "0");
1306
+ this.inputEl.value = `${n}${l}`;
1283
1307
  }
1284
1308
  }
1285
1309
  } else
1286
- this.inputEl.value = S(this.value);
1310
+ this.inputEl.value = P(this.value);
1287
1311
  }), this.inputEl.addEventListener("blur", () => {
1288
- this.isEditing = !1, this.value && (this.inputEl.value = K(this.value));
1312
+ this.isEditing = !1, this.value && (this.inputEl.value = et(this.value));
1289
1313
  }), this.inputEl.addEventListener("paste", (i) => this.handlePaste(i)), this.inputEl.addEventListener("input", (i) => this.handleTextInput(i)), this.inputEl.addEventListener("keydown", (i) => {
1290
- i.key === "Enter" && (this.handleTextInput(i), this.inputEl.blur()), i.key === "Escape" && (this.value && (this.inputEl.value = S(this.value)), this.inputEl.blur());
1291
- }), e.appendChild(this.previewEl), this.unlinkButton = document.createElement("button"), this.unlinkButton.type = "button", this.unlinkButton.className = "gradient-unlink-button", this.unlinkButton.innerHTML = At, this.unlinkButton.title = "Break global color binding", this.unlinkButton.addEventListener("click", (i) => {
1314
+ i.key === "Enter" && (this.handleTextInput(i), this.inputEl.blur()), i.key === "Escape" && (this.value && (this.inputEl.value = P(this.value)), this.inputEl.blur());
1315
+ }), e.appendChild(this.previewEl), this.unlinkButton = document.createElement("button"), this.unlinkButton.type = "button", this.unlinkButton.className = "gradient-unlink-button", this.unlinkButton.innerHTML = qt, this.unlinkButton.title = "Break global color binding", this.unlinkButton.addEventListener("click", (i) => {
1292
1316
  i.preventDefault(), i.stopPropagation(), this.breakGlobalBinding();
1293
1317
  }), e.appendChild(this.unlinkButton), e.appendChild(this.inputEl), t.appendChild(e), this.createPopover(), this.element = t, this.updateUnlinkButtonVisibility(), t;
1294
1318
  }
@@ -1311,7 +1335,7 @@ const V = class V extends w {
1311
1335
  t.appendChild(l);
1312
1336
  }
1313
1337
  const i = document.createElement("button");
1314
- i.type = "button", i.className = "gradient-popover-close", i.innerHTML = bt, i.addEventListener("click", () => this.closePopover()), t.appendChild(i), ot(t, this.popoverEl, (l, r) => {
1338
+ i.type = "button", i.className = "gradient-popover-close", i.innerHTML = Pt, i.addEventListener("click", () => this.closePopover()), t.appendChild(i), dt(t, this.popoverEl, (l, r) => {
1315
1339
  this.popoverPosition = { left: l, top: r };
1316
1340
  });
1317
1341
  const s = document.createElement("div");
@@ -1322,10 +1346,10 @@ const V = class V extends w {
1322
1346
  n.appendChild(o), s.appendChild(n);
1323
1347
  const a = document.createElement("div");
1324
1348
  if (a.className = "gradient-editor-content", this.updatePopoverContent(a), s.appendChild(a), this.variant !== "global" && e) {
1325
- const l = e.children[0], r = e.children[1], c = (h) => {
1326
- 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);
1349
+ const l = e.children[0], r = e.children[1], h = (d) => {
1350
+ this.currentMode = d, d === "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);
1327
1351
  };
1328
- l.addEventListener("click", () => c("custom")), r.addEventListener("click", () => c("global")), this.isBoundToGlobal() ? (this.currentMode = "global", c("global")) : (this.currentMode = "custom", c("custom"));
1352
+ l.addEventListener("click", () => h("custom")), r.addEventListener("click", () => h("global")), this.isBoundToGlobal() ? (this.currentMode = "global", h("global")) : (this.currentMode = "custom", h("custom"));
1329
1353
  }
1330
1354
  this.popoverEl.appendChild(t), this.popoverEl.appendChild(s), document.body.appendChild(this.backdropEl), document.body.appendChild(this.popoverEl);
1331
1355
  }
@@ -1334,9 +1358,9 @@ const V = class V extends w {
1334
1358
  const t = document.createElement("div");
1335
1359
  t.className = "gradient-type-tabs";
1336
1360
  const e = document.createElement("button");
1337
- e.type = "button", e.className = `gradient-type-tab ${((s = this.value) == null ? void 0 : s.type) === "solid" ? "active" : ""}`, e.innerHTML = Bt, e.style.minWidth = "32px", e.addEventListener("click", () => this.switchType("solid"));
1361
+ e.type = "button", e.className = `gradient-type-tab ${((s = this.value) == null ? void 0 : s.type) === "solid" ? "active" : ""}`, e.innerHTML = jt, e.style.minWidth = "32px", e.addEventListener("click", () => this.switchType("solid"));
1338
1362
  const i = document.createElement("button");
1339
- return i.type = "button", i.className = `gradient-type-tab ${((n = this.value) == null ? void 0 : n.type) !== "solid" ? "active" : ""}`, i.innerHTML = $t, i.style.minWidth = "32px", i.addEventListener("click", () => {
1363
+ return i.type = "button", i.className = `gradient-type-tab ${((n = this.value) == null ? void 0 : n.type) !== "solid" ? "active" : ""}`, i.innerHTML = _t, i.style.minWidth = "32px", i.addEventListener("click", () => {
1340
1364
  var a, l;
1341
1365
  const o = ((a = this.value) == null ? void 0 : a.type) === "solid" ? "linear" : ((l = this.value) == null ? void 0 : l.type) || "linear";
1342
1366
  this.switchType(o);
@@ -1352,8 +1376,8 @@ const V = class V extends w {
1352
1376
  ]), t !== "solid" && this.value.stops.length === 1) {
1353
1377
  const l = this.value.stops[0].color;
1354
1378
  if (l.startsWith("var(--")) {
1355
- const r = this.resolveGlobalVarColor(l), c = T(r);
1356
- c && c.type !== "solid" && c.stops.length >= 2 ? (this.value.stops = c.stops, this.value.angle = c.angle, this.value.type = c.type) : (this.value.stops.push({
1379
+ const r = this.resolveGlobalVarColor(l), h = T(r);
1380
+ h && h.type !== "solid" && h.stops.length >= 2 ? (this.value.stops = h.stops, this.value.angle = h.angle, this.value.type = h.type) : (this.value.stops.push({
1357
1381
  color: "#786666",
1358
1382
  position: 100,
1359
1383
  opacity: 100
@@ -1372,7 +1396,7 @@ const V = class V extends w {
1372
1396
  }
1373
1397
  if (this.popoverEl) {
1374
1398
  const a = this.popoverEl.querySelectorAll(".gradient-type-tab");
1375
- a.forEach((c) => c.classList.remove("active"));
1399
+ a.forEach((h) => h.classList.remove("active"));
1376
1400
  const l = a[0], r = a[1];
1377
1401
  t === "solid" ? l == null || l.classList.add("active") : r == null || r.classList.add("active");
1378
1402
  }
@@ -1390,8 +1414,8 @@ const V = class V extends w {
1390
1414
  }
1391
1415
  renderGlobalColors(t) {
1392
1416
  (!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
1393
- const e = this.value.stops[0], i = (h) => {
1394
- h.innerHTML = "";
1417
+ const e = this.value.stops[0], i = (d) => {
1418
+ d.innerHTML = "";
1395
1419
  let p = {};
1396
1420
  try {
1397
1421
  p = w.GlobalVariables || {};
@@ -1400,39 +1424,39 @@ const V = class V extends w {
1400
1424
  }
1401
1425
  if (!p || Object.keys(p).length === 0) {
1402
1426
  const u = document.createElement("div");
1403
- u.textContent = "No global colors defined", u.style.fontSize = "12px", u.style.color = "#666", u.style.padding = "8px", h.appendChild(u);
1427
+ u.textContent = "No global colors defined", u.style.fontSize = "12px", u.style.color = "#666", u.style.padding = "8px", d.appendChild(u);
1404
1428
  return;
1405
1429
  }
1406
- const g = w.GlobalVariableGroups || [
1430
+ const m = w.GlobalVariableGroups || [
1407
1431
  { title: "Global Colors", keys: ["primary", "secondary", "tertiary", "accent"] },
1408
1432
  { title: "Text Color", keys: ["text-dark", "text-light"] }
1409
1433
  ], C = this.globalSearchQuery.toLowerCase();
1410
- let m;
1411
- 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) => {
1434
+ let g;
1435
+ this.globalLayoutMode === "list" ? (g = document.createElement("div"), g.className = "global-colors-list") : (g = document.createElement("div"), g.className = "global-colors-grid"), d.appendChild(g), m.forEach((u) => {
1412
1436
  const f = Object.entries(p).filter(([v]) => !u.keys.includes(v) && u.title !== "Global Colors" ? !1 : u.keys.includes(v) && v.toLowerCase().includes(C));
1413
1437
  f.length !== 0 && f.forEach(([v, y]) => {
1414
1438
  if (this.globalLayoutMode === "list") {
1415
- const x = document.createElement("div");
1416
- x.className = "global-color-row";
1439
+ const b = document.createElement("div");
1440
+ b.className = "global-color-row";
1417
1441
  const k = document.createElement("div");
1418
1442
  k.className = "global-color-circle";
1419
- const I = this.resolveGlobalVarColor(y);
1420
- k.style.background = I, (this.linkedGlobalVariable === `var(--${v})` || e.color === `var(--${v})`) && k.classList.add("selected");
1421
- const b = document.createElement("span");
1422
- b.className = "global-color-label", b.textContent = v.split("-").map((N) => N.charAt(0).toUpperCase() + N.slice(1)).join(" "), x.appendChild(k), x.appendChild(b), x.addEventListener("click", (N) => {
1423
- N.preventDefault();
1424
- const D = `var(--${v})`;
1425
- this.setValue(D), this.pendingSolidColor = D, i(h);
1426
- }), m.appendChild(x);
1443
+ const x = this.resolveGlobalVarColor(y);
1444
+ k.style.background = x, (this.linkedGlobalVariable === `var(--${v})` || e.color === `var(--${v})`) && k.classList.add("selected");
1445
+ const L = document.createElement("span");
1446
+ L.className = "global-color-label", L.textContent = v.split("-").map((I) => I.charAt(0).toUpperCase() + I.slice(1)).join(" "), b.appendChild(k), b.appendChild(L), b.addEventListener("click", (I) => {
1447
+ I.preventDefault();
1448
+ const F = `var(--${v})`;
1449
+ this.setValue(F), this.pendingSolidColor = F, i(d);
1450
+ }), g.appendChild(b);
1427
1451
  } else {
1428
- const x = document.createElement("div");
1429
- x.className = "global-color-circle";
1452
+ const b = document.createElement("div");
1453
+ b.className = "global-color-circle";
1430
1454
  const k = this.resolveGlobalVarColor(y);
1431
- x.style.background = k, x.title = v.split("-").map((E) => E.charAt(0).toUpperCase() + E.slice(1)).join(" "), (this.linkedGlobalVariable === `var(--${v})` || e.color === `var(--${v})`) && x.classList.add("selected"), x.addEventListener("click", (E) => {
1455
+ b.style.background = k, b.title = v.split("-").map((E) => E.charAt(0).toUpperCase() + E.slice(1)).join(" "), (this.linkedGlobalVariable === `var(--${v})` || e.color === `var(--${v})`) && b.classList.add("selected"), b.addEventListener("click", (E) => {
1432
1456
  E.preventDefault();
1433
- const b = `var(--${v})`;
1434
- this.setValue(b), this.pendingSolidColor = b, i(h);
1435
- }), m.appendChild(x);
1457
+ const L = `var(--${v})`;
1458
+ this.setValue(L), this.pendingSolidColor = L, i(d);
1459
+ }), g.appendChild(b);
1436
1460
  }
1437
1461
  });
1438
1462
  });
@@ -1445,21 +1469,21 @@ const V = class V extends w {
1445
1469
  const a = document.createElement("input");
1446
1470
  a.type = "text", a.className = "global-search-input", a.placeholder = "Search", a.value = this.globalSearchQuery;
1447
1471
  const l = document.createElement("div");
1448
- a.addEventListener("input", (h) => {
1449
- this.globalSearchQuery = h.target.value, i(l);
1472
+ a.addEventListener("input", (d) => {
1473
+ this.globalSearchQuery = d.target.value, i(l);
1450
1474
  }), n.appendChild(o), n.appendChild(a);
1451
1475
  const r = document.createElement("button");
1452
1476
  r.className = "global-layout-toggle", r.type = "button";
1453
- const c = () => {
1477
+ const h = () => {
1454
1478
  r.innerHTML = this.globalLayoutMode === "list" ? '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="7"></rect><rect x="14" y="3" width="7" height="7"></rect><rect x="14" y="14" width="7" height="7"></rect><rect x="3" y="14" width="7" height="7"></rect></svg>' : '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"></line><line x1="8" y1="12" x2="21" y2="12"></line><line x1="8" y1="18" x2="21" y2="18"></line><line x1="3" y1="6" x2="3.01" y2="6"></line><line x1="3" y1="12" x2="3.01" y2="12"></line><line x1="3" y1="18" x2="3.01" y2="18"></line></svg>';
1455
1479
  };
1456
- c(), r.addEventListener("click", () => {
1457
- this.globalLayoutMode = this.globalLayoutMode === "list" ? "grid" : "list", c(), i(l);
1480
+ h(), r.addEventListener("click", () => {
1481
+ this.globalLayoutMode = this.globalLayoutMode === "list" ? "grid" : "list", h(), i(l);
1458
1482
  }), s.appendChild(n), s.appendChild(r), t.appendChild(s), t.appendChild(l), i(l);
1459
1483
  }
1460
1484
  renderSolid(t) {
1461
1485
  (!this.value || !this.value.stops || !this.value.stops.length) && (this.value || (this.value = this.defaultValue()), this.value.stops = [{ color: "#000000", position: 0, opacity: 100 }]);
1462
- const e = this.value.stops[0], i = new Dt({
1486
+ const e = this.value.stops[0], i = new Jt({
1463
1487
  initialColor: e.color.startsWith("var(--") ? this.resolveGlobalVarColor(e.color) : e.color,
1464
1488
  initialOpacity: e.opacity ?? 100,
1465
1489
  onColorChange: (s, n) => {
@@ -1479,40 +1503,47 @@ const V = class V extends w {
1479
1503
  this.solidPicker = null;
1480
1504
  let e = null;
1481
1505
  {
1482
- const c = document.createElement("div");
1483
- c.className = "gradient-subtype-inline";
1484
- const h = document.createElement("select");
1485
- h.className = "gradient-subtype-select";
1506
+ const h = document.createElement("div");
1507
+ h.className = "gradient-subtype-inline";
1508
+ const d = document.createElement("select");
1509
+ d.className = "gradient-subtype-select";
1486
1510
  const p = document.createElement("option");
1487
1511
  p.value = "linear", p.textContent = "Linear";
1488
- const g = document.createElement("option");
1489
- 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°");
1512
+ const m = document.createElement("option");
1513
+ m.value = "radial", m.textContent = "Radial", d.appendChild(p), d.appendChild(m), d.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°");
1490
1514
  const C = document.createElement("button");
1491
- C.type = "button", C.className = "gradient-flip-btn", C.innerHTML = Ot, h.addEventListener("change", () => {
1492
- this.clearGlobalBindingForCustomChange(), this.switchType(h.value === "radial" ? "radial" : "linear", !0), e && this.updateDegreeVisibility(e);
1493
- }), e.addEventListener("focus", (m) => {
1494
- const u = m.target;
1515
+ C.type = "button", C.className = "gradient-flip-btn", C.innerHTML = zt, d.addEventListener("change", () => {
1516
+ this.clearGlobalBindingForCustomChange(), this.switchType(d.value === "radial" ? "radial" : "linear", !0), e && this.updateDegreeVisibility(e);
1517
+ }), e.addEventListener("focus", (g) => {
1518
+ const u = g.target;
1495
1519
  u.value = u.value.replace(/[^0-9-]/g, ""), setTimeout(() => u.select(), 0);
1496
- }), e.addEventListener("input", (m) => {
1520
+ }), e.addEventListener("input", (g) => {
1497
1521
  this.clearGlobalBindingForCustomChange();
1498
- const u = parseInt(m.target.value);
1522
+ const u = parseInt(g.target.value);
1499
1523
  !Number.isNaN(u) && this.value && (this.value.angle = Math.max(0, Math.min(360, u)), this.debouncedPreviewUpdate());
1500
- }), e.addEventListener("blur", (m) => {
1524
+ }), e.addEventListener("blur", (g) => {
1501
1525
  var v;
1502
1526
  this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
1503
- const u = m.target;
1527
+ const u = g.target;
1504
1528
  let f = parseInt(u.value);
1505
1529
  Number.isNaN(f) && (f = ((v = this.value) == null ? void 0 : v.angle) ?? 0), f = Math.max(0, Math.min(360, f)), this.value && (this.value.angle = f), u.value = `${f}°`, this.updateGradientPreview(), this.updateUI(), this.triggerChange();
1506
1530
  }), C.addEventListener("click", () => {
1507
- this.clearGlobalBindingForCustomChange(), !(!this.value || !this.value.stops) && (this.value.stops.forEach((m) => {
1508
- m.position = 100 - m.position;
1509
- }), this.value.stops.sort((m, u) => m.position - u.position), this.updateGradientPreview(i), this.createHandles(s, i), this.updateStopsList(l), this.updateUI(), this.triggerChange());
1510
- }), c.appendChild(h), c.appendChild(e), c.appendChild(C), t.appendChild(c), this.updateDegreeVisibility(e);
1531
+ this.clearGlobalBindingForCustomChange(), !(!this.value || !this.value.stops) && (this.value.stops.forEach((g) => {
1532
+ g.position = 100 - g.position;
1533
+ }), this.value.stops.sort((g, u) => g.position - u.position), this.updateGradientPreview(i), this.createHandles(s, i), this.updateStopsList(l), this.updateUI(), this.triggerChange());
1534
+ }), h.appendChild(d), h.appendChild(e), h.appendChild(C), t.appendChild(h), this.updateDegreeVisibility(e);
1511
1535
  }
1512
1536
  const i = document.createElement("div");
1513
1537
  i.className = "gradient-preview", this.updateGradientPreview(i);
1514
1538
  const s = document.createElement("div");
1515
- s.className = "gradient-handles", i.appendChild(s), t.appendChild(i), this.createHandles(s, i);
1539
+ s.className = "gradient-handles", i.appendChild(s), t.appendChild(i), this.createHandles(s, i), i.addEventListener("click", (h) => {
1540
+ var g;
1541
+ const d = h.target;
1542
+ if (d.classList.contains("gstop-handle") || d.classList.contains("gstop-chip"))
1543
+ return;
1544
+ const p = i.getBoundingClientRect(), C = (h.clientX - p.left) / p.width * 100;
1545
+ this.clearGlobalBindingForCustomChange(), this.addStopAtPosition(C), this.updateStopsList(), this.updateGradientPreview(i), this.createHandles(s, i), this.updateUI(), ((g = document.activeElement) == null ? void 0 : g.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange();
1546
+ });
1516
1547
  const n = document.createElement("div");
1517
1548
  n.className = "gradient-stops-header";
1518
1549
  const o = document.createElement("span");
@@ -1521,13 +1552,13 @@ const V = class V extends w {
1521
1552
  a.type = "button", a.className = "gradient-add-stop", a.textContent = "+", n.appendChild(o), n.appendChild(a);
1522
1553
  const l = document.createElement("div");
1523
1554
  l.className = "gradient-stops", t.appendChild(n), t.appendChild(l), this.updateStopsList(l);
1524
- const r = at((c) => {
1525
- const h = T(c);
1526
- h && (this.clearGlobalBindingForCustomChange(), this.value = h, this.switchType(h.type, !0), this.updateUI(), this.triggerChange());
1555
+ const r = pt((h) => {
1556
+ const d = T(h);
1557
+ d && (this.clearGlobalBindingForCustomChange(), this.value = d, this.switchType(d.type, !0), this.updateUI(), this.triggerChange());
1527
1558
  }, "all");
1528
1559
  this.recentGradientRefresh = r.refresh, t.appendChild(r.container), a.addEventListener("click", () => {
1529
- var c;
1530
- this.clearGlobalBindingForCustomChange(), this.addStop(), this.updateStopsList(l), this.updateGradientPreview(i), this.createHandles(s, i), this.updateUI(), ((c = document.activeElement) == null ? void 0 : c.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange();
1560
+ var h;
1561
+ this.clearGlobalBindingForCustomChange(), this.addStop(), this.updateStopsList(l), this.updateGradientPreview(i), this.createHandles(s, i), this.updateUI(), ((h = document.activeElement) == null ? void 0 : h.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange();
1531
1562
  });
1532
1563
  }
1533
1564
  updateDegreeVisibility(t) {
@@ -1539,9 +1570,9 @@ const V = class V extends w {
1539
1570
  const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-preview"));
1540
1571
  if (e && this.value)
1541
1572
  if (this.value.type === "solid")
1542
- e.style.background = S(this.value);
1573
+ e.style.background = P(this.value);
1543
1574
  else {
1544
- const s = this.value.stops.map((n) => `${st(n.color, n.opacity ?? 100)} ${n.position}%`).join(", ");
1575
+ const s = this.value.stops.map((n) => `${ct(n.color, n.opacity ?? 100)} ${n.position}%`).join(", ");
1545
1576
  e.style.background = `linear-gradient(90deg, ${s})`;
1546
1577
  }
1547
1578
  }
@@ -1558,43 +1589,44 @@ const V = class V extends w {
1558
1589
  o.className = "gstop-chip";
1559
1590
  const a = this.resolveGlobalVarColor(i.color);
1560
1591
  o.style.backgroundColor = a, n.appendChild(o);
1561
- const l = new ut((u, f) => {
1562
- this.clearGlobalBindingForCustomChange(), this.value && this.value.stops[s] && (this.value.stops[s].color = u, f !== void 0 && (this.value.stops[s].opacity = f), o.style.backgroundColor = u, this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), this.triggerChange());
1563
- }, "solid");
1564
- let r = !1, c = !1, h = 0, p = 0;
1565
- const g = (u) => {
1566
- r = !0, c = !1, h = u.clientX, p = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", C), document.addEventListener("mouseup", m), u.preventDefault(), u.stopPropagation();
1567
- }, C = (u) => {
1568
- if (!r || !this.value) return;
1569
- const f = u.clientX - h;
1570
- if (Math.abs(f) > 3 && (c = !0), c) {
1592
+ let l = !1, r = !1, h = 0, d = 0;
1593
+ const p = (g) => {
1594
+ l = !0, r = !1, h = g.clientX, d = this.value.stops[s].position, n.classList.add("selected"), document.addEventListener("mousemove", m), document.addEventListener("mouseup", C), g.preventDefault(), g.stopPropagation();
1595
+ }, m = (g) => {
1596
+ if (!l || !this.value) return;
1597
+ const u = g.clientX - h;
1598
+ if (Math.abs(u) > 3 && (r = !0), r) {
1571
1599
  this.clearGlobalBindingForCustomChange();
1572
- const v = e.getBoundingClientRect();
1573
- let y = p + f / v.width * 100;
1574
- y = Math.max(0, Math.min(100, y)), this.value.stops[s].position = Math.round(y), n.style.left = `${y}%`, this.updateGradientPreview();
1600
+ const f = e.getBoundingClientRect();
1601
+ let v = d + u / f.width * 100;
1602
+ v = Math.max(0, Math.min(100, v)), this.value.stops[s].position = Math.round(v), n.style.left = `${v}%`, this.updateGradientPreview();
1575
1603
  }
1576
- }, m = (u) => {
1577
- var f;
1578
- if (r)
1579
- if (r = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", C), document.removeEventListener("mouseup", m), c)
1580
- this.value && (this.value.stops.sort((v, y) => v.position - y.position), this.createHandles(t, e), this.updateStopsList()), this.updateUI(), this.triggerChange();
1604
+ }, C = (g) => {
1605
+ var u;
1606
+ if (l)
1607
+ if (l = !1, n.classList.remove("selected"), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", C), r)
1608
+ this.value && (this.value.stops.sort((f, v) => f.position - v.position), this.createHandles(t, e), this.updateStopsList()), this.updateUI(), this.triggerChange();
1581
1609
  else {
1582
- u.stopPropagation();
1583
- const v = (f = this.value) == null ? void 0 : f.stops[s];
1584
- v && setTimeout(() => {
1585
- const y = this.resolveGlobalVarColor(v.color);
1586
- l.open(y, o, v.opacity ?? 100);
1610
+ g.stopPropagation();
1611
+ const f = (u = this.value) == null ? void 0 : u.stops[s];
1612
+ f && setTimeout(() => {
1613
+ const v = this.getSharedStopColorPicker();
1614
+ v.getIsOpen() && v.close(!1), this.colorPickerStopIndex = s, v.setOnChange((b, k) => {
1615
+ this.clearGlobalBindingForCustomChange(), this.value && this.value.stops[s] && (this.value.stops[s].color = b, k !== void 0 && (this.value.stops[s].opacity = k), o.style.backgroundColor = b, this.updateGradientPreview(), this.updateStopsList(), this.updateUI(), this.triggerChange());
1616
+ });
1617
+ const y = this.resolveGlobalVarColor(f.color);
1618
+ v.open(y, o, f.opacity ?? 100);
1587
1619
  }, 0);
1588
1620
  }
1589
1621
  };
1590
- n.addEventListener("mousedown", g), t.appendChild(n);
1622
+ n.addEventListener("mousedown", p), t.appendChild(n);
1591
1623
  });
1592
1624
  }
1593
1625
  updateStopsList(t) {
1594
1626
  var i;
1595
1627
  const e = t || ((i = this.popoverEl) == null ? void 0 : i.querySelector(".gradient-stops"));
1596
1628
  !e || !this.value || this.value.type === "solid" || !this.value.stops || (e.innerHTML = "", this.value.stops.forEach((s, n) => {
1597
- var k, I;
1629
+ var b, k;
1598
1630
  const o = document.createElement("div");
1599
1631
  o.className = "gstop-row";
1600
1632
  const a = document.createElement("div");
@@ -1603,85 +1635,85 @@ const V = class V extends w {
1603
1635
  l.type = "text", l.className = "gstop-position-input", l.value = `${s.position}%`, l.style.width = "60px", a.appendChild(l);
1604
1636
  const r = document.createElement("div");
1605
1637
  r.className = "gstop-color-container";
1606
- const c = this.resolveGlobalVarColor(s.color), h = document.createElement("div");
1607
- h.className = "gstop-color-preview", h.style.backgroundColor = c;
1638
+ const h = this.resolveGlobalVarColor(s.color), d = document.createElement("div");
1639
+ d.className = "gstop-color-preview", d.style.backgroundColor = h;
1608
1640
  const p = document.createElement("input");
1609
- p.type = "text", p.className = "gstop-color-input", p.value = c.replace("#", "").toUpperCase();
1610
- const g = document.createElement("button");
1611
- g.type = "button", g.className = "gstop-color-copy", g.textContent = "Copy", r.appendChild(h), r.appendChild(p), r.appendChild(g);
1641
+ p.type = "text", p.className = "gstop-color-input", p.value = h.replace("#", "").toUpperCase();
1642
+ const m = document.createElement("button");
1643
+ m.type = "button", m.className = "gstop-color-copy", m.textContent = "Copy", r.appendChild(d), r.appendChild(p), r.appendChild(m);
1612
1644
  const C = document.createElement("button");
1613
- C.type = "button", C.className = "gstop-del", C.innerHTML = Ht, C.disabled = (((I = (k = this.value) == null ? void 0 : k.stops) == null ? void 0 : I.length) || 0) <= 2, o.appendChild(a), o.appendChild(r), o.appendChild(C), e.appendChild(o);
1614
- const m = document.createElement("span");
1615
- m.className = "gstop-opacity-label", m.textContent = "Opacity";
1645
+ C.type = "button", C.className = "gstop-del", C.innerHTML = Wt, C.disabled = (((k = (b = this.value) == null ? void 0 : b.stops) == null ? void 0 : k.length) || 0) <= 2, o.appendChild(a), o.appendChild(r), o.appendChild(C), e.appendChild(o);
1646
+ const g = document.createElement("span");
1647
+ g.className = "gstop-opacity-label", g.textContent = "Opacity";
1616
1648
  const u = document.createElement("div");
1617
1649
  u.className = "gstop-opacity-group";
1618
1650
  const f = document.createElement("input");
1619
1651
  f.type = "range", f.className = "gstop-opacity-slider", f.min = "0", f.max = "100", f.value = String(s.opacity ?? 100);
1620
- const v = P(c);
1621
- f.style.setProperty("--slider-color", `rgb(${v.r}, ${v.g}, ${v.b})`);
1652
+ const v = N(h);
1653
+ f.style.setProperty("--slider-color", `rgb(${v.r}, ${v.g}, ${v.b})`), f.style.setProperty("--slider-color-transparent", `rgba(${v.r}, ${v.g}, ${v.b}, 0)`);
1622
1654
  const y = document.createElement("span");
1623
- y.className = "gstop-opacity-value", y.textContent = `${s.opacity ?? 100}%`, u.appendChild(f), u.appendChild(y);
1624
- const x = new ut((E, b) => {
1625
- this.clearGlobalBindingForCustomChange(), p.value = E.replace("#", "").toUpperCase(), h.style.backgroundColor = E, this.value.stops[n].color = E, b !== void 0 && (this.value.stops[n].opacity = b, f.value = String(b), y.textContent = `${b}%`);
1626
- const N = P(E);
1627
- f.style.setProperty("--slider-color", `rgb(${N.r}, ${N.g}, ${N.b})`), this.updateGradientPreview(), this.createHandles(
1628
- this.popoverEl.querySelector(".gradient-handles"),
1629
- this.popoverEl.querySelector(".gradient-preview")
1630
- ), this.updateUI(), this.triggerChange();
1631
- }, "solid");
1632
- p.addEventListener("click", (E) => {
1633
- E.preventDefault(), E.stopPropagation();
1634
- const b = this.resolveGlobalVarColor(s.color);
1635
- x.open(b, p, s.opacity ?? 100);
1655
+ y.className = "gstop-opacity-value", y.textContent = `${s.opacity ?? 100}%`, u.appendChild(f), u.appendChild(y), p.addEventListener("click", (x) => {
1656
+ x.preventDefault(), x.stopPropagation();
1657
+ const E = this.getSharedStopColorPicker();
1658
+ E.getIsOpen() && E.close(!1), this.colorPickerStopIndex = n, E.setOnChange((I, F) => {
1659
+ this.clearGlobalBindingForCustomChange(), p.value = I.replace("#", "").toUpperCase(), d.style.backgroundColor = I, this.value.stops[n].color = I, F !== void 0 && (this.value.stops[n].opacity = F, f.value = String(F), y.textContent = `${F}%`);
1660
+ const j = N(I);
1661
+ f.style.setProperty("--slider-color", `rgb(${j.r}, ${j.g}, ${j.b})`), f.style.setProperty("--slider-color-transparent", `rgba(${j.r}, ${j.g}, ${j.b}, 0)`), this.updateGradientPreview(), this.createHandles(
1662
+ this.popoverEl.querySelector(".gradient-handles"),
1663
+ this.popoverEl.querySelector(".gradient-preview")
1664
+ ), this.updateUI(), this.triggerChange();
1665
+ });
1666
+ const L = this.resolveGlobalVarColor(s.color);
1667
+ E.open(L, p, s.opacity ?? 100);
1636
1668
  }), p.addEventListener("input", () => {
1637
1669
  this.clearGlobalBindingForCustomChange();
1638
- const E = p.value.trim(), b = E.startsWith("#") ? E : `#${E}`;
1639
- if (/^#[0-9A-Fa-f]{6}$/.test(b)) {
1640
- this.value.stops[n].color = b, h.style.backgroundColor = b;
1641
- const N = P(b);
1642
- f.style.setProperty("--slider-color", `rgb(${N.r}, ${N.g}, ${N.b})`), this.debouncedPreviewUpdate();
1670
+ const x = p.value.trim(), E = x.startsWith("#") ? x : `#${x}`;
1671
+ if (/^#[0-9A-Fa-f]{6}$/.test(E)) {
1672
+ this.value.stops[n].color = E, d.style.backgroundColor = E;
1673
+ const L = N(E);
1674
+ f.style.setProperty("--slider-color", `rgb(${L.r}, ${L.g}, ${L.b})`), f.style.setProperty("--slider-color-transparent", `rgba(${L.r}, ${L.g}, ${L.b}, 0)`), this.debouncedPreviewUpdate();
1643
1675
  }
1644
1676
  }), p.addEventListener("blur", () => {
1645
1677
  this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
1646
- }), g.addEventListener("click", async (E) => {
1647
- E.stopPropagation();
1678
+ }), m.addEventListener("click", async (x) => {
1679
+ x.stopPropagation();
1648
1680
  try {
1649
1681
  await navigator.clipboard.writeText(`#${p.value}`);
1650
1682
  } catch {
1651
1683
  }
1652
- }), l.addEventListener("focus", (E) => {
1653
- const b = E.target;
1654
- b.value = b.value.replace("%", ""), b.select();
1655
- }), l.addEventListener("input", (E) => {
1684
+ }), l.addEventListener("focus", (x) => {
1685
+ const E = x.target;
1686
+ E.value = E.value.replace("%", ""), E.select();
1687
+ }), l.addEventListener("input", (x) => {
1656
1688
  this.clearGlobalBindingForCustomChange();
1657
- const b = E.target, N = parseInt(b.value.replace(/[^\d]/g, ""), 10);
1658
- if (!Number.isNaN(N)) {
1659
- const D = Math.max(0, Math.min(100, N));
1660
- this.value.stops[n].position = D, b.value = `${D}%`, this.debouncedPreviewUpdate();
1689
+ const E = x.target, L = parseInt(E.value.replace(/[^\d]/g, ""), 10);
1690
+ if (!Number.isNaN(L)) {
1691
+ const I = Math.max(0, Math.min(100, L));
1692
+ this.value.stops[n].position = I, E.value = `${I}%`, this.debouncedPreviewUpdate();
1661
1693
  }
1662
- }), l.addEventListener("blur", (E) => {
1694
+ }), l.addEventListener("blur", (x) => {
1663
1695
  this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null);
1664
- const b = E.target, N = parseInt(b.value.replace(/[^\d]/g, ""), 10);
1665
- if (Number.isNaN(N))
1666
- b.value = `${this.value.stops[n].position}%`;
1696
+ const E = x.target, L = parseInt(E.value.replace(/[^\d]/g, ""), 10);
1697
+ if (Number.isNaN(L))
1698
+ E.value = `${this.value.stops[n].position}%`;
1667
1699
  else {
1668
- const D = Math.max(0, Math.min(100, N));
1669
- this.value.stops[n].position = D, b.value = `${D}%`;
1700
+ const I = Math.max(0, Math.min(100, L));
1701
+ this.value.stops[n].position = I, E.value = `${I}%`;
1670
1702
  }
1671
1703
  this.updateGradientPreview(), this.createHandles(
1672
1704
  this.popoverEl.querySelector(".gradient-handles"),
1673
1705
  this.popoverEl.querySelector(".gradient-preview")
1674
1706
  ), this.updateStopsList(), this.updateUI(), this.triggerChange();
1675
1707
  }), C.addEventListener("click", () => {
1676
- var E;
1677
- (this.value.stops.length || 0) <= 2 || (this.clearGlobalBindingForCustomChange(), this.value.stops.splice(n, 1), this.createHandles(
1708
+ var x, E;
1709
+ (this.value.stops.length || 0) <= 2 || ((x = this.sharedStopColorPicker) != null && x.getIsOpen() && this.colorPickerStopIndex === n ? (this.sharedStopColorPicker.close(!1), this.colorPickerStopIndex = null) : this.colorPickerStopIndex !== null && this.colorPickerStopIndex > n && this.colorPickerStopIndex--, this.clearGlobalBindingForCustomChange(), this.value.stops.splice(n, 1), this.createHandles(
1678
1710
  this.popoverEl.querySelector(".gradient-handles"),
1679
1711
  this.popoverEl.querySelector(".gradient-preview")
1680
1712
  ), this.updateStopsList(), this.updateGradientPreview(), this.updateUI(), ((E = document.activeElement) == null ? void 0 : E.tagName) !== "INPUT" && this.repositionPopover(), this.triggerChange());
1681
1713
  }), f.addEventListener("input", () => {
1682
1714
  this.clearGlobalBindingForCustomChange();
1683
- const E = parseInt(f.value, 10);
1684
- this.value.stops[n].opacity = Math.max(0, Math.min(100, E)), y.textContent = `${this.value.stops[n].opacity}%`, this.debouncedPreviewUpdate();
1715
+ const x = parseInt(f.value, 10);
1716
+ this.value.stops[n].opacity = Math.max(0, Math.min(100, x)), y.textContent = `${this.value.stops[n].opacity}%`, this.debouncedPreviewUpdate();
1685
1717
  }), f.addEventListener("change", () => {
1686
1718
  this.clearGlobalBindingForCustomChange(), this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), this.updateGradientPreview(), this.updateUI(), this.triggerChange();
1687
1719
  });
@@ -1689,20 +1721,36 @@ const V = class V extends w {
1689
1721
  }
1690
1722
  addStop() {
1691
1723
  if (!this.value || this.value.type === "solid" || !this.value.stops) return;
1692
- const t = this.value.stops.map((o) => o.position).sort((o, a) => o - a);
1724
+ const t = this.value.stops.map((s) => s.position).sort((s, n) => s - n);
1693
1725
  let e = 50, i = 0;
1694
- for (let o = 0; o < t.length - 1; o++) {
1695
- const a = t[o + 1] - t[o];
1696
- a > i && (i = a, e = t[o] + a / 2);
1726
+ for (let s = 0; s < t.length - 1; s++) {
1727
+ const n = t[s + 1] - t[s];
1728
+ n > i && (i = n, e = t[s] + n / 2);
1729
+ }
1730
+ this.addStopAtPosition(e);
1731
+ }
1732
+ addStopAtPosition(t) {
1733
+ if (!this.value || this.value.type === "solid" || !this.value.stops) return;
1734
+ const e = Math.max(0, Math.min(100, t)), i = [...this.value.stops].sort((r, h) => r.position - h.position);
1735
+ let s = i[0], n = i[i.length - 1];
1736
+ for (let r = 0; r < i.length - 1; r++)
1737
+ if (i[r].position <= e && i[r + 1].position >= e) {
1738
+ s = i[r], n = i[r + 1];
1739
+ break;
1740
+ }
1741
+ let o, a;
1742
+ if (s === n || s.position === n.position)
1743
+ o = s.color, a = s.opacity ?? 100;
1744
+ else {
1745
+ const r = (e - s.position) / (n.position - s.position), h = N(s.color), d = N(n.color), p = Math.round(h.r + (d.r - h.r) * r), m = Math.round(h.g + (d.g - h.g) * r), C = Math.round(h.b + (d.b - h.b) * r);
1746
+ o = `#${p.toString(16).padStart(2, "0")}${m.toString(16).padStart(2, "0")}${C.toString(16).padStart(2, "0")}`.toUpperCase(), a = Math.round((s.opacity ?? 100) + ((n.opacity ?? 100) - (s.opacity ?? 100)) * r);
1697
1747
  }
1698
- const s = this.value.stops.reduce(
1699
- (o, a) => Math.abs(a.position - e) < Math.abs(o.position - e) ? a : o
1700
- ), n = {
1748
+ const l = {
1701
1749
  position: Math.round(e),
1702
- color: s.color,
1703
- opacity: s.opacity ?? 100
1750
+ color: o,
1751
+ opacity: a
1704
1752
  };
1705
- this.value.stops.push(n), this.value.stops.sort((o, a) => o.position - a.position);
1753
+ this.value.stops.push(l), this.value.stops.sort((r, h) => r.position - h.position);
1706
1754
  }
1707
1755
  openPopover() {
1708
1756
  if (this.popoverEl && (V.openInstance && V.openInstance !== this && V.openInstance.closePopover(), !this.isPopoverOpen)) {
@@ -1711,10 +1759,10 @@ const V = class V extends w {
1711
1759
  this.popoverEl.style.position = "fixed", this.popoverEl.style.zIndex = "10000", this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
1712
1760
  const o = this.popoverEl.offsetHeight;
1713
1761
  let a = t.right + 8, l = t.top;
1714
- const r = i - t.right, c = t.left, h = e + n;
1715
- r < h && c > r + 100 && (a = t.left - e - 8);
1716
- const p = s - t.bottom, g = t.top;
1717
- 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 };
1762
+ const r = i - t.right, h = t.left, d = e + n;
1763
+ r < d && h > r + 100 && (a = t.left - e - 8);
1764
+ const p = s - t.bottom, m = t.top;
1765
+ m >= o + n ? l = t.top - o - 8 : p >= o + n ? l = t.bottom + 8 : m > 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 };
1718
1766
  }
1719
1767
  setTimeout(() => document.addEventListener("click", this.onBackgroundClick, !0), 200), document.addEventListener("keydown", this.handlePopoverKeydown, !0);
1720
1768
  }
@@ -1732,10 +1780,10 @@ const V = class V extends w {
1732
1780
  this.popoverEl.style.left, this.popoverEl.style.top, this.popoverEl.style.left = "-9999px", this.popoverEl.style.top = "0px";
1733
1781
  const a = this.popoverEl.offsetHeight;
1734
1782
  let l = e.right + 8, r = e.top;
1735
- const c = s - e.right, h = e.left, p = i + o;
1736
- c < p && h > c + 100 && (l = e.left - i - 8);
1737
- const g = n - e.bottom, C = e.top;
1738
- 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`;
1783
+ const h = s - e.right, d = e.left, p = i + o;
1784
+ h < p && d > h + 100 && (l = e.left - i - 8);
1785
+ const m = n - e.bottom, C = e.top;
1786
+ C >= a + o ? r = e.top - a - 8 : m >= a + o ? r = e.bottom + 8 : C > m ? (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`;
1739
1787
  });
1740
1788
  }
1741
1789
  }
@@ -1750,17 +1798,17 @@ const V = class V extends w {
1750
1798
  s && this.updatePopoverContent(s);
1751
1799
  }
1752
1800
  closePopover() {
1753
- var t;
1801
+ var t, e;
1754
1802
  if (!(!this.popoverEl || !this.isPopoverOpen)) {
1755
- 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") {
1756
- const e = S(this.value);
1757
- R.addColor(e, "gradient"), (t = this.recentGradientRefresh) == null || t.call(this);
1803
+ if (this.isPopoverOpen = !1, this.popoverPosition = null, (t = this.sharedStopColorPicker) != null && t.getIsOpen() && (this.sharedStopColorPicker.close(!0), this.colorPickerStopIndex = 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") {
1804
+ const i = P(this.value);
1805
+ W.addColor(i, "gradient"), (e = this.recentGradientRefresh) == null || e.call(this);
1758
1806
  }
1759
1807
  this.previewUpdateTimeout && (clearTimeout(this.previewUpdateTimeout), this.previewUpdateTimeout = null), V.openInstance === this && (V.openInstance = null);
1760
1808
  }
1761
1809
  }
1762
1810
  commitPendingSolidColor() {
1763
- this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() : R.addColor(this.pendingSolidColor, "solid"), this.pendingSolidColor = null);
1811
+ this.pendingSolidColor && (this.solidPicker ? this.solidPicker.commitRecentColor() : W.addColor(this.pendingSolidColor, "solid"), this.pendingSolidColor = null);
1764
1812
  }
1765
1813
  handlePaste(t) {
1766
1814
  var i;
@@ -1795,11 +1843,11 @@ const V = class V extends w {
1795
1843
  }
1796
1844
  getValue() {
1797
1845
  const t = this.getChangePayload();
1798
- return t ? typeof t == "string" ? t : S(t) : "";
1846
+ return t ? typeof t == "string" ? t : P(t) : "";
1799
1847
  }
1800
1848
  getCSSValue() {
1801
1849
  const t = this.getChangePayload();
1802
- return t ? typeof t == "string" ? t : S(t) : "";
1850
+ return t ? typeof t == "string" ? t : P(t) : "";
1803
1851
  }
1804
1852
  getCSSForText() {
1805
1853
  return this.value ? this.cssForTextValue() : {};
@@ -1809,23 +1857,23 @@ const V = class V extends w {
1809
1857
  }
1810
1858
  };
1811
1859
  V.openInstance = null, V.CHANGE_DEBOUNCE_DELAY = 150;
1812
- let j = V;
1813
- function J(d, t) {
1814
- for (const e in d)
1815
- if (Object.prototype.hasOwnProperty.call(d, e)) {
1816
- const i = d[e];
1860
+ let J = V;
1861
+ function Y(c, t) {
1862
+ for (const e in c)
1863
+ if (Object.prototype.hasOwnProperty.call(c, e)) {
1864
+ const i = c[e];
1817
1865
  t(e, i);
1818
1866
  }
1819
1867
  }
1820
- const Q = class Q {
1868
+ const ot = class ot {
1821
1869
  constructor(t) {
1822
1870
  this.elementRef = null, this.isHidden = !1, this.custom = !1, this.initialValues = {}, this.changeTimeout = null, this.isHandlingChange = !1, this.changeHandlers = /* @__PURE__ */ new Set(), this.blurTimeout = null, this.lastChangeTime = 0, this.handleBlur = () => {
1823
- }, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.dataPropsPath = "", this.hide = !1, this.id = t.id || ft(), this.title = t.title, this.settings = t.settings, this.isCollapsed = t.collapsed ?? !1, this.isMain = t.main ?? !1, this.custom = t.custom ?? !1, this.nestingLevel = 0, this.includeGetJson = t.includeGetJson ?? !0, this.addItemCfg = t.addItem, this.deleteItemCfg = t.deleteItem, this.dataProps = t.dataProps, this.dataPropsPath = t.dataProps || "", this.hide = t.hide ?? !1, Object.assign(this, t.settings), this.initialValues = this.getValues(), this.originalDefaultValues = this.getDefaultValues(), this.propagateNestingLevel(), this.propagateDataPropsPath();
1871
+ }, this.pendingBlurHandler = null, this.originalDefaultValues = {}, this.nestingLevel = 0, this.dataPropsPath = "", this.hide = !1, this.id = t.id || Mt(), this.title = t.title, this.settings = t.settings, this.isCollapsed = t.collapsed ?? !1, this.isMain = t.main ?? !1, this.custom = t.custom ?? !1, this.nestingLevel = 0, this.includeGetJson = t.includeGetJson ?? !0, this.addItemCfg = t.addItem, this.deleteItemCfg = t.deleteItem, this.dataProps = t.dataProps, this.dataPropsPath = t.dataProps || "", this.hide = t.hide ?? !1, Object.assign(this, t.settings), this.initialValues = this.getValues(), this.originalDefaultValues = this.getDefaultValues(), this.propagateNestingLevel(), this.propagateDataPropsPath();
1824
1872
  }
1825
1873
  propagateNestingLevel() {
1826
1874
  const t = this.nestingLevel + 1;
1827
- J(this.settings, (e, i) => {
1828
- L(i) && (i.nestingLevel = t, i.propagateNestingLevel());
1875
+ Y(this.settings, (e, i) => {
1876
+ M(i) && (i.nestingLevel = t, i.propagateNestingLevel());
1829
1877
  });
1830
1878
  }
1831
1879
  getNestingLevel() {
@@ -1849,18 +1897,18 @@ const Q = class Q {
1849
1897
  this.dataPropsPath = t, this.propagateDataPropsPath();
1850
1898
  }
1851
1899
  propagateDataPropsPath() {
1852
- J(this.settings, (t, e) => {
1900
+ Y(this.settings, (t, e) => {
1853
1901
  const i = String(t), s = this.dataPropsPath ? `${this.dataPropsPath}_${i}` : i;
1854
- (L(e) || F(e) && typeof e.setDataPropsPath == "function") && e.setDataPropsPath(s);
1902
+ (M(e) || R(e) && typeof e.setDataPropsPath == "function") && e.setDataPropsPath(s);
1855
1903
  });
1856
1904
  }
1857
1905
  updateNestingStyles() {
1858
- this.elementRef && (_(this.elementRef, this.nestingLevel), et(this.elementRef, this.nestingLevel));
1906
+ this.elementRef && (Q(this.elementRef, this.nestingLevel), lt(this.elementRef, this.nestingLevel));
1859
1907
  }
1860
1908
  forceChildUIRefresh() {
1861
1909
  Object.entries(this.settings).forEach(([t, e]) => {
1862
1910
  try {
1863
- if (L(e)) {
1911
+ if (M(e)) {
1864
1912
  const i = e.getValues();
1865
1913
  e.setValue(i);
1866
1914
  } else if (typeof e.setValue == "function") {
@@ -1914,19 +1962,19 @@ const Q = class Q {
1914
1962
  var l;
1915
1963
  const i = (e == null ? void 0 : e.preserveValues) ?? !0, s = new Set(Object.keys(this.settings)), n = Object.keys(t), o = {};
1916
1964
  i && n.forEach((r) => {
1917
- const c = this.settings[r];
1918
- c && (L(c) ? o[r] = c.getValues() : F(c) ? o[r] = c.value : typeof c.getValues == "function" ? o[r] = c.getValues() : c.value !== void 0 && (o[r] = c.value));
1965
+ const h = this.settings[r];
1966
+ h && (M(h) ? o[r] = h.getValues() : R(h) ? o[r] = h.value : typeof h.getValues == "function" ? o[r] = h.getValues() : h.value !== void 0 && (o[r] = h.value));
1919
1967
  }), s.forEach((r) => {
1920
1968
  n.includes(r) || this.removeSetting(r);
1921
1969
  }), n.forEach((r) => {
1922
1970
  var p;
1923
- const c = t[r], h = this.settings[r];
1924
- if (h !== c && (h && this.removeSetting(r), this.addSetting(r, c), i && r in o)) {
1925
- const g = o[r];
1971
+ const h = t[r], d = this.settings[r];
1972
+ if (d !== h && (d && this.removeSetting(r), this.addSetting(r, h), i && r in o)) {
1973
+ const m = o[r];
1926
1974
  try {
1927
- L(c) ? c.setValue(
1928
- g
1929
- ) : F(c) ? (p = c.setValue) == null || p.call(c, g) : c.setValue && c.setValue(g);
1975
+ M(h) ? h.setValue(
1976
+ m
1977
+ ) : R(h) ? (p = h.setValue) == null || p.call(h, m) : h.setValue && h.setValue(m);
1930
1978
  } catch (C) {
1931
1979
  console.warn(`Could not preserve value for setting ${r}:`, C);
1932
1980
  }
@@ -1937,7 +1985,7 @@ const Q = class Q {
1937
1985
  }
1938
1986
  clone() {
1939
1987
  const t = {};
1940
- J(this.settings, (s, n) => {
1988
+ Y(this.settings, (s, n) => {
1941
1989
  const o = String(s);
1942
1990
  typeof n.clone == "function" ? t[o] = n.clone() : (console.warn(
1943
1991
  `Setting with key '${o}' does not have a clone method. Copying reference.`
@@ -1954,7 +2002,7 @@ const Q = class Q {
1954
2002
  deleteItem: this.deleteItemCfg,
1955
2003
  dataProps: this.dataProps,
1956
2004
  hide: this.hide
1957
- }, i = Gt(e);
2005
+ }, i = Yt(e);
1958
2006
  return i.initialValues = this.getValues(), i;
1959
2007
  }
1960
2008
  resetDefault() {
@@ -1964,7 +2012,7 @@ const Q = class Q {
1964
2012
  setMobileValues(t) {
1965
2013
  !t || typeof t != "object" || (Object.entries(t).forEach(([e, i]) => {
1966
2014
  const s = this.settings[e];
1967
- s && (L(s) || F(s)) && typeof s.setMobileValue == "function" && s.setMobileValue(i);
2015
+ s && (M(s) || R(s)) && typeof s.setMobileValue == "function" && s.setMobileValue(i);
1968
2016
  }), this.setValue(t), this.onChange && this.onChange(this.getValues()));
1969
2017
  }
1970
2018
  getMobileValues(t) {
@@ -1973,7 +2021,7 @@ const Q = class Q {
1973
2021
  for (const i in this.settings)
1974
2022
  if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
1975
2023
  const s = this.settings[i];
1976
- if (L(s))
2024
+ if (M(s))
1977
2025
  e[i] = s.getMobileValues();
1978
2026
  else {
1979
2027
  const n = s;
@@ -1984,7 +2032,7 @@ const Q = class Q {
1984
2032
  } else {
1985
2033
  const e = this.settings[t];
1986
2034
  if (!e) return;
1987
- if (L(e)) return e.getMobileValues();
2035
+ if (M(e)) return e.getMobileValues();
1988
2036
  const i = e;
1989
2037
  return i.mobileValue !== void 0 ? i.mobileValue : i.value;
1990
2038
  }
@@ -2000,14 +2048,14 @@ const Q = class Q {
2000
2048
  Object.keys(s).length > 0 && (this.lastChangeTime = Date.now(), this.initialValues = i, t(i), this.updateVisibility()), this.isHandlingChange = !1;
2001
2049
  }, 50));
2002
2050
  };
2003
- return this.changeHandlers.clear(), J(this.settings, (i, s) => {
2051
+ return this.changeHandlers.clear(), Y(this.settings, (i, s) => {
2004
2052
  var n;
2005
- if (L(s))
2053
+ if (M(s))
2006
2054
  s.setOnChange(() => {
2007
2055
  const o = this.getValues();
2008
2056
  this.initialValues = o, t(o);
2009
2057
  }), this.changeHandlers.add(() => t(this.getValues()));
2010
- else if (F(s)) {
2058
+ else if (R(s)) {
2011
2059
  const o = () => e();
2012
2060
  this.changeHandlers.add(o), s.setOnChange(o);
2013
2061
  } else {
@@ -2030,10 +2078,10 @@ const Q = class Q {
2030
2078
  const o = i.slice(this.addItemCfg.keyPrefix.length), a = Number(o);
2031
2079
  if (Number.isFinite(a)) {
2032
2080
  const l = this.addItemCfg.createItem(a);
2033
- ct(l) && (this.addSetting(i, l), n = l);
2081
+ vt(l) && (this.addSetting(i, l), n = l);
2034
2082
  }
2035
2083
  }
2036
- n && (L(n) || F(n)) && typeof n.setValue == "function" && n.setValue(s);
2084
+ n && (M(n) || R(n)) && typeof n.setValue == "function" && n.setValue(s);
2037
2085
  }), setTimeout(() => {
2038
2086
  this.forceChildUIRefresh();
2039
2087
  }, 0);
@@ -2047,7 +2095,7 @@ const Q = class Q {
2047
2095
  const s = this.getValues();
2048
2096
  this.initialValues = s, (n = this.onChange) == null || n.call(this, s), this.updateVisibility();
2049
2097
  };
2050
- L(t) ? t.setOnChange(() => e()) : F(t) ? t.setOnChange(() => e()) : (i = t.setOnChange) == null || i.call(t, () => e());
2098
+ M(t) ? t.setOnChange(() => e()) : R(t) ? t.setOnChange(() => e()) : (i = t.setOnChange) == null || i.call(t, () => e());
2051
2099
  }
2052
2100
  addSetting(t, e) {
2053
2101
  var s, n;
@@ -2056,16 +2104,16 @@ const Q = class Q {
2056
2104
  ".setting-group-content"
2057
2105
  );
2058
2106
  if (o) {
2059
- L(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
2107
+ M(e) && typeof e.setNestingLevel == "function" && e.setNestingLevel(this.nestingLevel + 1);
2060
2108
  const a = e.draw(), l = this.deleteItemCfg ?? this.addItemCfg;
2061
2109
  if (l) {
2062
- const h = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
2063
- h && t.startsWith(h) && this.addDeleteButtonToElement(a, t);
2110
+ const d = l.keyPrefix ?? ((s = this.addItemCfg) == null ? void 0 : s.keyPrefix);
2111
+ d && t.startsWith(d) && this.addDeleteButtonToElement(a, t);
2064
2112
  }
2065
2113
  const r = o.querySelector(".sg-add-button-bottom");
2066
- r ? o.insertBefore(a, r) : o.appendChild(a), rt.trackElement(a), _(a, this.nestingLevel + 1), et(a, this.nestingLevel + 1);
2067
- const c = a.style.display;
2068
- a.style.display = "none", a.offsetHeight, a.style.display = c, this.updateNestingStyles();
2114
+ r ? o.insertBefore(a, r) : o.appendChild(a), mt.trackElement(a), Q(a, this.nestingLevel + 1), lt(a, this.nestingLevel + 1);
2115
+ const h = a.style.display;
2116
+ a.style.display = "none", a.offsetHeight, a.style.display = h, this.updateNestingStyles();
2069
2117
  }
2070
2118
  }
2071
2119
  const i = this.getValues();
@@ -2082,9 +2130,9 @@ const Q = class Q {
2082
2130
  const r = Array.from(
2083
2131
  t.querySelectorAll(".setting-group-title")
2084
2132
  );
2085
- for (const c of r)
2086
- if (c.closest(".setting-group") === t) {
2087
- s = c;
2133
+ for (const h of r)
2134
+ if (h.closest(".setting-group") === t) {
2135
+ s = h;
2088
2136
  break;
2089
2137
  }
2090
2138
  s || (s = r[0] ?? null);
@@ -2117,8 +2165,8 @@ const Q = class Q {
2117
2165
  }), o.addEventListener("mouseleave", () => {
2118
2166
  o.style.backgroundColor = "transparent";
2119
2167
  }), o.addEventListener("click", (r) => {
2120
- r.stopPropagation(), r.preventDefault(), this.showDeleteConfirmation().then((c) => {
2121
- c && (i && i.deleteItemCfg ? this.removeSetting(e) : this.removeSetting(e));
2168
+ r.stopPropagation(), r.preventDefault(), this.showDeleteConfirmation().then((h) => {
2169
+ h && (i && i.deleteItemCfg ? this.removeSetting(e) : this.removeSetting(e));
2122
2170
  });
2123
2171
  });
2124
2172
  const l = n.querySelector(".setting-group-arrow");
@@ -2212,13 +2260,13 @@ const Q = class Q {
2212
2260
  r(), t(!1);
2213
2261
  }), l.addEventListener("click", () => {
2214
2262
  r(), t(!0);
2215
- }), e.addEventListener("click", (h) => {
2216
- h.target === e && (r(), t(!1));
2263
+ }), e.addEventListener("click", (d) => {
2264
+ d.target === e && (r(), t(!1));
2217
2265
  });
2218
- const c = (h) => {
2219
- h.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", c));
2266
+ const h = (d) => {
2267
+ d.key === "Escape" && (r(), t(!1), document.removeEventListener("keydown", h));
2220
2268
  };
2221
- 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(() => {
2269
+ document.addEventListener("keydown", h), o.appendChild(a), o.appendChild(l), i.appendChild(s), i.appendChild(n), i.appendChild(o), e.appendChild(i), document.body.appendChild(e), requestAnimationFrame(() => {
2222
2270
  e.style.opacity = "1", i.style.transform = "scale(1)";
2223
2271
  }), setTimeout(() => l.focus(), 100);
2224
2272
  });
@@ -2251,7 +2299,7 @@ const Q = class Q {
2251
2299
  for (const i in this.settings)
2252
2300
  if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
2253
2301
  const s = this.settings[i];
2254
- if (L(s))
2302
+ if (M(s))
2255
2303
  e[i] = s.getValues();
2256
2304
  else {
2257
2305
  const n = s;
@@ -2262,7 +2310,7 @@ const Q = class Q {
2262
2310
  } else {
2263
2311
  const e = this.settings[t];
2264
2312
  if (!e) return;
2265
- if (L(e)) return e.getValues();
2313
+ if (M(e)) return e.getValues();
2266
2314
  const i = e;
2267
2315
  return i.getValue ? i.getValue() : i.value;
2268
2316
  }
@@ -2275,15 +2323,15 @@ const Q = class Q {
2275
2323
  for (const s in this.settings)
2276
2324
  if (Object.prototype.hasOwnProperty.call(this.settings, s)) {
2277
2325
  const n = this.settings[s];
2278
- if (L(n)) {
2326
+ if (M(n)) {
2279
2327
  const o = n.getValuesForJson();
2280
2328
  o !== null && (i[s] = o);
2281
2329
  } else {
2282
2330
  const o = n;
2283
2331
  if (o.includeGetJson !== !1)
2284
- if (n instanceof j) {
2332
+ if (n instanceof J) {
2285
2333
  const a = n.getRawValue();
2286
- i[s] = a ? S(a) : null;
2334
+ i[s] = a ? P(a) : null;
2287
2335
  } else
2288
2336
  i[s] = o.value;
2289
2337
  }
@@ -2292,14 +2340,14 @@ const Q = class Q {
2292
2340
  } else {
2293
2341
  const i = this.settings[t];
2294
2342
  if (!i) return;
2295
- if (L(i))
2343
+ if (M(i))
2296
2344
  return i.includeGetJson === !1 ? null : i.getValuesForJson();
2297
2345
  {
2298
2346
  const s = i;
2299
2347
  if (s.includeGetJson === !1) return null;
2300
- if (i instanceof j) {
2348
+ if (i instanceof J) {
2301
2349
  const n = i.getRawValue();
2302
- return n ? S(n) : null;
2350
+ return n ? P(n) : null;
2303
2351
  }
2304
2352
  return s.value;
2305
2353
  }
@@ -2311,7 +2359,7 @@ const Q = class Q {
2311
2359
  for (const i in this.settings)
2312
2360
  if (Object.prototype.hasOwnProperty.call(this.settings, i)) {
2313
2361
  const s = this.settings[i];
2314
- if (L(s))
2362
+ if (M(s))
2315
2363
  e[i] = s.getDefaultValues();
2316
2364
  else {
2317
2365
  const n = s;
@@ -2322,14 +2370,14 @@ const Q = class Q {
2322
2370
  } else {
2323
2371
  const e = this.settings[t];
2324
2372
  if (!e) return;
2325
- if (L(e)) return e.getDefaultValues();
2373
+ if (M(e)) return e.getDefaultValues();
2326
2374
  const i = e;
2327
2375
  return i.default !== void 0 ? i.default : i.value;
2328
2376
  }
2329
2377
  }
2330
2378
  draw() {
2331
2379
  const t = document.createElement("div");
2332
- t.className = "setting-group", t.id = `setting-group-${this.id}`, Q.hiddenElements.add(t), this.hide && (t.style.display = "none"), this.isMain && t.classList.add("main-group"), this.custom && t.classList.add("custom_class"), _(t, this.nestingLevel);
2380
+ t.className = "setting-group", t.id = `setting-group-${this.id}`, ot.hiddenElements.add(t), this.hide && (t.style.display = "none"), this.isMain && t.classList.add("main-group"), this.custom && t.classList.add("custom_class"), Q(t, this.nestingLevel);
2333
2381
  const e = document.createElement("div");
2334
2382
  e.className = "setting-group-title", this.isCollapsed && e.classList.add("collapsed-view"), e.setAttribute("role", "button"), e.setAttribute(
2335
2383
  "aria-expanded",
@@ -2355,43 +2403,43 @@ const Q = class Q {
2355
2403
  (!this.isCollapsed).toString()
2356
2404
  );
2357
2405
  };
2358
- if (e.onclick = l, e.onkeydown = (c) => {
2359
- (c.key === "Enter" || c.key === " ") && (c.preventDefault(), l());
2406
+ if (e.onclick = l, e.onkeydown = (h) => {
2407
+ (h.key === "Enter" || h.key === " ") && (h.preventDefault(), l());
2360
2408
  }, Object.keys(this.settings).length > 0) {
2361
- for (const c in this.settings)
2362
- if (Object.prototype.hasOwnProperty.call(this.settings, c)) {
2363
- const h = this.settings[c];
2364
- L(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.nestingLevel + 1);
2365
- const p = h.draw();
2366
- L(h) && h.deleteItemCfg && this.addDeleteButtonToElement(
2409
+ for (const h in this.settings)
2410
+ if (Object.prototype.hasOwnProperty.call(this.settings, h)) {
2411
+ const d = this.settings[h];
2412
+ M(d) && typeof d.setNestingLevel == "function" && d.setNestingLevel(this.nestingLevel + 1);
2413
+ const p = d.draw();
2414
+ M(d) && d.deleteItemCfg && this.addDeleteButtonToElement(
2367
2415
  p,
2368
- c,
2369
- h
2416
+ h,
2417
+ d
2370
2418
  ), a.appendChild(p);
2371
2419
  }
2372
2420
  } else {
2373
- const c = document.createElement("div");
2374
- c.className = "setting-group-empty", c.textContent = "No settings in this group", a.appendChild(c);
2421
+ const h = document.createElement("div");
2422
+ h.className = "setting-group-empty", h.textContent = "No settings in this group", a.appendChild(h);
2375
2423
  }
2376
2424
  if (this.addItemCfg) {
2377
- const c = document.createElement("button");
2378
- c.type = "button", c.className = "sg-add-button-bottom", c.style.marginTop = "8px";
2379
- const h = `
2425
+ const h = document.createElement("button");
2426
+ h.type = "button", h.className = "sg-add-button-bottom", h.style.marginTop = "8px";
2427
+ const d = `
2380
2428
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
2381
2429
  xmlns="http://www.w3.org/2000/svg">
2382
2430
  <path d="M8 3.333v9.334M3.333 8h9.334" stroke="currentColor"
2383
2431
  stroke-width="1.5" stroke-linecap="round"/>
2384
2432
  </svg>`;
2385
- c.innerHTML = `${h}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, c.addEventListener("click", (p) => {
2433
+ h.innerHTML = `${d}<span style="margin-left:4px;">${this.addItemCfg.buttonLabel ?? "Add"}</span>`, h.addEventListener("click", (p) => {
2386
2434
  p.stopPropagation(), p.preventDefault();
2387
- const g = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), C = this.addItemCfg.createItem(g);
2388
- if (ct(C)) {
2389
- const m = `${this.addItemCfg.keyPrefix}${g}`;
2390
- this.addSetting(m, C);
2435
+ const m = this.getNextIndexFromPrefix(this.addItemCfg.keyPrefix), C = this.addItemCfg.createItem(m);
2436
+ if (vt(C)) {
2437
+ const g = `${this.addItemCfg.keyPrefix}${m}`;
2438
+ this.addSetting(g, C);
2391
2439
  }
2392
- }), a.appendChild(c);
2440
+ }), a.appendChild(h);
2393
2441
  }
2394
- return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(a), this.elementRef = t, rt.trackElement(t), setTimeout(() => {
2442
+ return e.appendChild(i), e.appendChild(n), t.appendChild(e), t.appendChild(a), this.elementRef = t, mt.trackElement(t), setTimeout(() => {
2395
2443
  this.updateNestingStyles();
2396
2444
  }, 0), this.pendingBlurHandler && (this.pendingBlurHandler = null), t;
2397
2445
  }
@@ -2433,12 +2481,12 @@ const Q = class Q {
2433
2481
  }
2434
2482
  }
2435
2483
  };
2436
- Q.hiddenElements = /* @__PURE__ */ new Set();
2437
- let H = Q;
2438
- function Me(d) {
2439
- return new Ft(d);
2484
+ ot.hiddenElements = /* @__PURE__ */ new Set();
2485
+ let $ = ot;
2486
+ function ri(c) {
2487
+ return new Xt(c);
2440
2488
  }
2441
- class Ft extends H {
2489
+ class Xt extends $ {
2442
2490
  constructor(t) {
2443
2491
  super(t);
2444
2492
  const e = Object.keys(this.settings)[0];
@@ -2486,12 +2534,12 @@ class Ft extends H {
2486
2534
  if (o.className = "tab-content", this.contentContainers = {}, Object.keys(this.settings).forEach((a, l) => {
2487
2535
  const r = document.createElement("button");
2488
2536
  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);
2489
- const c = document.createElement("div");
2490
- c.className = "tab-panel", this.contentContainers[a] = c;
2491
- const h = this.settings[a];
2492
- h && (L(h) && typeof h.setNestingLevel == "function" && h.setNestingLevel(this.getNestingLevel() + 1), c.appendChild(
2493
- h.draw()
2494
- )), o.appendChild(c), l === 0 && !this.activeTabId && (this.activeTabId = a);
2537
+ const h = document.createElement("div");
2538
+ h.className = "tab-panel", this.contentContainers[a] = h;
2539
+ const d = this.settings[a];
2540
+ d && (M(d) && typeof d.setNestingLevel == "function" && d.setNestingLevel(this.getNestingLevel() + 1), h.appendChild(
2541
+ d.draw()
2542
+ )), o.appendChild(h), l === 0 && !this.activeTabId && (this.activeTabId = a);
2495
2543
  }), e.appendChild(i), e.appendChild(n), e.appendChild(o), !this.activeTabId) {
2496
2544
  const a = Object.keys(this.settings)[0];
2497
2545
  this.activeTabId = a || "";
@@ -2499,13 +2547,13 @@ class Ft extends H {
2499
2547
  return this.updateTabUI(), t;
2500
2548
  }
2501
2549
  }
2502
- function Gt(d) {
2503
- return new H(d);
2550
+ function Yt(c) {
2551
+ return new $(c);
2504
2552
  }
2505
- function Ne(d) {
2506
- return d;
2553
+ function ci(c) {
2554
+ return c;
2507
2555
  }
2508
- class Rt extends w {
2556
+ class Kt extends w {
2509
2557
  constructor(t = {}) {
2510
2558
  super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
2511
2559
  }
@@ -2525,29 +2573,29 @@ class Rt extends w {
2525
2573
  });
2526
2574
  }
2527
2575
  }
2528
- const zt = "<svg xmlns='http://www.w3.org/2000/svg' width='18' height='19' viewBox='0 0 18 19' fill='none'><path d='M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z' stroke='#667085' stroke-linecap='round' stroke-linejoin='round'/></svg>";
2529
- class O extends Rt {
2576
+ const Qt = "<svg xmlns='http://www.w3.org/2000/svg' width='18' height='19' viewBox='0 0 18 19' fill='none'><path d='M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z' stroke='#667085' stroke-linecap='round' stroke-linejoin='round'/></svg>";
2577
+ class H extends Kt {
2530
2578
  constructor(t) {
2531
2579
  super({
2532
2580
  ...t,
2533
- icon: t.icon || zt,
2581
+ icon: t.icon || Qt,
2534
2582
  title: t.title || "Color",
2535
- default: t.default ? O.normalizeColorValue(t.default) : "#000000"
2583
+ default: t.default ? H.normalizeColorValue(t.default) : "#000000"
2536
2584
  }), this.inputType = "color", this.element = null, this.colorInputEl = null, this.textInputEl = null, this.detectChange = t.detectChange;
2537
2585
  }
2538
2586
  static normalizeColorValue(t) {
2539
- return t.startsWith("var(--") ? t : t.startsWith("#") ? O.normalizeHexValue(t) : t.includes(",") ? O.rgbToHexStatic(t) : O.normalizeHexValue(t);
2587
+ return t.startsWith("var(--") ? t : t.startsWith("#") ? H.normalizeHexValue(t) : t.includes(",") ? H.rgbToHexStatic(t) : H.normalizeHexValue(t);
2540
2588
  }
2541
2589
  static normalizeHexValue(t) {
2542
2590
  return t = t.replace("#", ""), t.length === 3 && (t = t.split("").map((e) => e + e).join("")), t.length !== 6 ? (console.warn(`Invalid hex value "${t}", using default "#000000"`), "#000000") : /^[0-9A-Fa-f]{6}$/.test(t) ? `#${t.toLowerCase()}` : (console.warn(`Invalid hex value "${t}", using default "#000000"`), "#000000");
2543
2591
  }
2544
2592
  static rgbToHexStatic(t) {
2545
- const e = t.split(",").map((c) => parseInt(c.trim()));
2593
+ const e = t.split(",").map((h) => parseInt(h.trim()));
2546
2594
  if (e.length !== 3 || e.some(isNaN))
2547
2595
  return console.warn(`Invalid RGB value "${t}", using default "#000000"`), "#000000";
2548
- 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) => {
2549
- const h = c.toString(16);
2550
- return h.length === 1 ? "0" + h : h;
2596
+ 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 = (h) => {
2597
+ const d = h.toString(16);
2598
+ return d.length === 1 ? "0" + d : d;
2551
2599
  };
2552
2600
  return `#${r(o)}${r(a)}${r(l)}`;
2553
2601
  }
@@ -2557,7 +2605,7 @@ class O extends Rt {
2557
2605
  return;
2558
2606
  }
2559
2607
  if (typeof t == "string") {
2560
- const e = O.normalizeColorValue(t);
2608
+ const e = H.normalizeColorValue(t);
2561
2609
  this.value = e, this.colorInputEl && (this.colorInputEl.value = e), this.textInputEl && (this.textInputEl.value = e), this.onChange && this.onChange(e), this.props.detectChange && this.props.detectChange(e);
2562
2610
  } else
2563
2611
  this.value = "#000000", this.colorInputEl && (this.colorInputEl.value = "#000000"), this.textInputEl && (this.textInputEl.value = "#000000"), this.onChange && this.onChange("#000000"), this.props.detectChange && this.props.detectChange("#000000");
@@ -2570,16 +2618,16 @@ class O extends Rt {
2570
2618
  draw() {
2571
2619
  const t = document.createElement("div");
2572
2620
  if (t.className = "color-setting-wrapper " + (this.props.wrapperClassName || ""), this.props.title || this.props.icon) {
2573
- const m = document.createElement("div");
2574
- if (m.className = "icon-container", this.props.icon) {
2621
+ const g = document.createElement("div");
2622
+ if (g.className = "icon-container", this.props.icon) {
2575
2623
  const u = document.createElement("span");
2576
- u.className = "input-icon", u.innerHTML = this.props.icon, m.appendChild(u);
2624
+ u.className = "input-icon", u.innerHTML = this.props.icon, g.appendChild(u);
2577
2625
  }
2578
2626
  if (this.props.title) {
2579
2627
  const u = document.createElement("span");
2580
- u.className = "input-label", u.textContent = this.props.title, m.appendChild(u);
2628
+ u.className = "input-label", u.textContent = this.props.title, g.appendChild(u);
2581
2629
  }
2582
- t.appendChild(m);
2630
+ t.appendChild(g);
2583
2631
  }
2584
2632
  const e = document.createElement("div");
2585
2633
  e.className = "color-input-wrapper";
@@ -2601,85 +2649,85 @@ class O extends Rt {
2601
2649
  u.textContent = "Error: System error (Setting undefined)", a.appendChild(u);
2602
2650
  return;
2603
2651
  }
2604
- const m = w.GlobalVariables || {};
2605
- if (console.log("ColorSetting: GlobalVariables:", m), !m || Object.keys(m).length === 0) {
2652
+ const g = w.GlobalVariables || {};
2653
+ if (console.log("ColorSetting: GlobalVariables:", g), !g || Object.keys(g).length === 0) {
2606
2654
  const u = document.createElement("div");
2607
2655
  u.textContent = "No global colors defined", u.style.gridColumn = "1 / -1", u.style.fontSize = "12px", u.style.color = "#666", a.appendChild(u);
2608
2656
  return;
2609
2657
  }
2610
- Object.entries(m).forEach(([u, f]) => {
2658
+ Object.entries(g).forEach(([u, f]) => {
2611
2659
  const v = document.createElement("button");
2612
2660
  v.className = "global-color-btn", v.title = u, v.style.width = "30px", v.style.height = "30px", v.style.borderRadius = "50%", v.style.border = "1px solid #ddd", v.style.backgroundColor = f, v.style.cursor = "pointer", this.value === `var(--${u})` && (v.style.border = "2px solid #2196f3"), v.addEventListener("click", (y) => {
2613
- var k, I;
2661
+ var k, x;
2614
2662
  y.preventDefault();
2615
- const x = `var(--${u})`;
2616
- this.value = x, (k = this.onChange) == null || k.call(this, x), (I = this.detectChange) == null || I.call(this, x), Array.from(a.children).forEach((E) => {
2663
+ const b = `var(--${u})`;
2664
+ this.value = b, (k = this.onChange) == null || k.call(this, b), (x = this.detectChange) == null || x.call(this, b), Array.from(a.children).forEach((E) => {
2617
2665
  E.style.border = "1px solid #ddd";
2618
- }), v.style.border = "2px solid #2196f3", h.style.backgroundColor = f;
2666
+ }), v.style.border = "2px solid #2196f3", d.style.backgroundColor = f;
2619
2667
  }), a.appendChild(v);
2620
2668
  });
2621
- } catch (m) {
2622
- console.error("ColorSetting: Error in renderGlobalOptions", m), a.innerHTML = "Error loading global options";
2669
+ } catch (g) {
2670
+ console.error("ColorSetting: Error in renderGlobalOptions", g), a.innerHTML = "Error loading global options";
2623
2671
  }
2624
2672
  };
2625
- l(), s.addEventListener("click", (m) => {
2626
- m.preventDefault(), s.classList.add("active"), n.classList.remove("active"), o.style.display = "flex", a.style.display = "none", this.value && this.value.startsWith("var(--");
2627
- }), n.addEventListener("click", (m) => {
2628
- m.preventDefault(), n.classList.add("active"), s.classList.remove("active"), o.style.display = "none", a.style.display = "grid", l();
2673
+ l(), s.addEventListener("click", (g) => {
2674
+ g.preventDefault(), s.classList.add("active"), n.classList.remove("active"), o.style.display = "flex", a.style.display = "none", this.value && this.value.startsWith("var(--");
2675
+ }), n.addEventListener("click", (g) => {
2676
+ g.preventDefault(), n.classList.add("active"), s.classList.remove("active"), o.style.display = "none", a.style.display = "grid", l();
2629
2677
  }), this.value && this.value.startsWith("var(--") ? n.click() : s.click();
2630
- const r = (m) => {
2631
- const u = m.value.trim();
2678
+ const r = (g) => {
2679
+ const u = g.value.trim();
2632
2680
  if (!u)
2633
2681
  return e.classList.remove("error"), !0;
2634
2682
  const v = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(u);
2635
2683
  return v ? e.classList.remove("error") : e.classList.add("error"), v;
2636
- }, c = document.createElement("input");
2637
- 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;
2638
- const h = document.createElement("div");
2639
- h.className = "color-preview";
2684
+ }, h = document.createElement("input");
2685
+ h.type = "color", h.className = "color-picker", h.value = this.value && !this.value.startsWith("var(--") ? this.value : "#000000", h.setAttribute("aria-label", "Choose color"), h.setAttribute("title", "Click to open color picker"), this.getDataPropsPath() && h.setAttribute("data-test-id", this.getDataPropsPath()), this.colorInputEl = h;
2686
+ const d = document.createElement("div");
2687
+ d.className = "color-preview";
2640
2688
  let p = this.value || "#000000";
2641
2689
  if (p.startsWith("var(--")) {
2642
- const m = p.replace("var(--", "").replace(")", "");
2643
- p = (w.GlobalVariables || {})[m] || "#000000";
2690
+ const g = p.replace("var(--", "").replace(")", "");
2691
+ p = (w.GlobalVariables || {})[g] || "#000000";
2644
2692
  }
2645
- h.style.backgroundColor = p;
2646
- const g = document.createElement("input");
2647
- 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;
2648
- const C = (m) => {
2693
+ d.style.backgroundColor = p;
2694
+ const m = document.createElement("input");
2695
+ m.type = "text", m.className = "color-text-input", m.value = this.value || "", m.placeholder = "#000000", m.setAttribute("pattern", "#[0-9A-Fa-f]{6}"), m.setAttribute("title", "Enter a hex color value (e.g., #ff0000)"), m.setAttribute("aria-label", "Hex color value"), m.setAttribute("maxlength", "7"), this.getDataPropsPath() && m.setAttribute("data-test-id", `${this.getDataPropsPath()}_text`), this.textInputEl = m;
2696
+ const C = (g) => {
2649
2697
  var f, v;
2650
- let u = m.trim();
2698
+ let u = g.trim();
2651
2699
  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)) {
2652
- const y = O.normalizeColorValue(u);
2653
- this.value = y, (f = this.onChange) == null || f.call(this, y), (v = this.detectChange) == null || v.call(this, y), this.colorInputEl && (this.colorInputEl.value = y), h.style.backgroundColor = y;
2700
+ const y = H.normalizeColorValue(u);
2701
+ this.value = y, (f = this.onChange) == null || f.call(this, y), (v = this.detectChange) == null || v.call(this, y), this.colorInputEl && (this.colorInputEl.value = y), d.style.backgroundColor = y;
2654
2702
  }
2655
2703
  };
2656
- return this.textInputEl.addEventListener("input", (m) => {
2657
- const u = m.target.value;
2704
+ return this.textInputEl.addEventListener("input", (g) => {
2705
+ const u = g.target.value;
2658
2706
  C(u);
2659
- }), this.textInputEl.addEventListener("paste", (m) => {
2707
+ }), this.textInputEl.addEventListener("paste", (g) => {
2660
2708
  var f;
2661
- m.preventDefault();
2662
- const u = ((f = m.clipboardData) == null ? void 0 : f.getData("text")) || "";
2709
+ g.preventDefault();
2710
+ const u = ((f = g.clipboardData) == null ? void 0 : f.getData("text")) || "";
2663
2711
  this.textInputEl && (this.textInputEl.value = u.trim(), C(u));
2664
- }), this.textInputEl.addEventListener("keydown", (m) => {
2712
+ }), this.textInputEl.addEventListener("keydown", (g) => {
2665
2713
  var u, f, v;
2666
- m.key === "Enter" && (m.preventDefault(), C(((u = this.textInputEl) == null ? void 0 : u.value) || ""), (f = this.textInputEl) == null || f.blur()), m.key === "Escape" && (this.textInputEl && this.value && (this.textInputEl.value = this.value), (v = this.textInputEl) == null || v.blur(), e.classList.remove("error"));
2667
- }), this.colorInputEl.addEventListener("input", (m) => {
2714
+ g.key === "Enter" && (g.preventDefault(), C(((u = this.textInputEl) == null ? void 0 : u.value) || ""), (f = this.textInputEl) == null || f.blur()), g.key === "Escape" && (this.textInputEl && this.value && (this.textInputEl.value = this.value), (v = this.textInputEl) == null || v.blur(), e.classList.remove("error"));
2715
+ }), this.colorInputEl.addEventListener("input", (g) => {
2668
2716
  var v, y;
2669
- const u = m.target.value, f = O.normalizeColorValue(u);
2670
- this.value = f, (v = this.onChange) == null || v.call(this, f), (y = this.detectChange) == null || y.call(this, f), this.textInputEl && (this.textInputEl.value = f), h.style.backgroundColor = f, e.classList.remove("error");
2671
- }), this.colorInputEl.addEventListener("change", (m) => {
2717
+ const u = g.target.value, f = H.normalizeColorValue(u);
2718
+ this.value = f, (v = this.onChange) == null || v.call(this, f), (y = this.detectChange) == null || y.call(this, f), this.textInputEl && (this.textInputEl.value = f), d.style.backgroundColor = f, e.classList.remove("error");
2719
+ }), this.colorInputEl.addEventListener("change", (g) => {
2672
2720
  var v, y;
2673
- const u = m.target.value, f = O.normalizeColorValue(u);
2674
- this.value = f, (v = this.onChange) == null || v.call(this, f), (y = this.detectChange) == null || y.call(this, f), this.textInputEl && (this.textInputEl.value = f), h.style.backgroundColor = f;
2675
- }), 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;
2721
+ const u = g.target.value, f = H.normalizeColorValue(u);
2722
+ this.value = f, (v = this.onChange) == null || v.call(this, f), (y = this.detectChange) == null || y.call(this, f), this.textInputEl && (this.textInputEl.value = f), d.style.backgroundColor = f;
2723
+ }), o.appendChild(h), o.appendChild(d), o.appendChild(m), e.appendChild(i), e.appendChild(o), e.appendChild(a), t.appendChild(e), this.element = t, t;
2676
2724
  }
2677
2725
  getElement() {
2678
2726
  return this.element;
2679
2727
  }
2680
2728
  // Helper method to get normalized hex value
2681
2729
  getNormalizedValue() {
2682
- return this.value ? O.normalizeColorValue(this.value) : "#000000";
2730
+ return this.value ? H.normalizeColorValue(this.value) : "#000000";
2683
2731
  }
2684
2732
  // Helper method to check if current value is valid hex
2685
2733
  isValidHex() {
@@ -2690,20 +2738,20 @@ class O extends Rt {
2690
2738
  return this.isValidHex() ? this.hexToRgb(this.value) : "0, 0, 0";
2691
2739
  }
2692
2740
  }
2693
- const Ut = `
2741
+ const te = `
2694
2742
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
2695
2743
  <path d="M8.99999 15.8542C9.79613 16.5667 10.8475 17 12 17C14.4853 17 16.5 14.9853 16.5 12.5C16.5 10.4248 15.0953 8.67769 13.1849 8.15763M4.81513 8.15762C2.9047 8.67768 1.5 10.4248 1.5 12.5C1.5 14.9853 3.51472 17 6 17C8.48528 17 10.5 14.9853 10.5 12.5C10.5 11.9146 10.3882 11.3554 10.1849 10.8424M13.5 6.5C13.5 8.98528 11.4853 11 9 11C6.51472 11 4.5 8.98528 4.5 6.5C4.5 4.01472 6.51472 2 9 2C11.4853 2 13.5 4.01472 13.5 6.5Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
2696
2744
  <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"/>
2697
2745
  <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"/>
2698
2746
  </svg>`;
2699
- class z extends w {
2747
+ class _ extends w {
2700
2748
  constructor(t = {}) {
2701
2749
  super({
2702
2750
  ...t,
2703
- icon: t.icon || Ut,
2751
+ icon: t.icon || te,
2704
2752
  title: t.title || "Color & Opacity",
2705
2753
  default: t.default || "#000000FF"
2706
- }), 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));
2754
+ }), 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 = _.normalizeHexWithOpacity(this.value));
2707
2755
  }
2708
2756
  static normalizeHexWithOpacity(t) {
2709
2757
  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");
@@ -2721,7 +2769,7 @@ class z extends w {
2721
2769
  return `#${i}${n}`;
2722
2770
  }
2723
2771
  setValue(t) {
2724
- 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);
2772
+ t === void 0 || t === "" ? this.value = "#000000FF" : this.value = _.normalizeHexWithOpacity(t), this.updateInputElements(), this.updateColorPreview(), this.onChange && this.onChange(this.value), this.detectChange && this.detectChange(this.value);
2725
2773
  }
2726
2774
  updateInputElements() {
2727
2775
  this.value && (this.colorInputEl && (this.colorInputEl.value = this.getRgbColor()), this.textInputEl && (this.textInputEl.value = this.value), this.opacityInputEl && (this.opacityInputEl.value = this.getOpacityPercent().toString()));
@@ -2732,7 +2780,7 @@ class z extends w {
2732
2780
  this.colorPreviewEl.style.backgroundColor = `rgba(${s}, ${n}, ${o}, ${e})`;
2733
2781
  }
2734
2782
  handleColorChange(t) {
2735
- const e = this.getOpacityPercent(), i = z.combineColorOpacity(
2783
+ const e = this.getOpacityPercent(), i = _.combineColorOpacity(
2736
2784
  t,
2737
2785
  e
2738
2786
  );
@@ -2743,7 +2791,7 @@ class z extends w {
2743
2791
  return e || i ? (this.setValue(t), !0) : !1;
2744
2792
  }
2745
2793
  handleOpacityChange(t) {
2746
- const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s = z.combineColorOpacity(
2794
+ const e = this.getRgbColor(), i = Math.max(0, Math.min(100, t)), s = _.combineColorOpacity(
2747
2795
  e,
2748
2796
  i
2749
2797
  );
@@ -2789,8 +2837,8 @@ class z extends w {
2789
2837
  const l = ((r = a.clipboardData) == null ? void 0 : r.getData("text")) || "";
2790
2838
  this.textInputEl && (this.textInputEl.value = l.trim(), i(l));
2791
2839
  }), this.textInputEl.addEventListener("keydown", (a) => {
2792
- var l, r, c;
2793
- a.key === "Enter" && (a.preventDefault(), i(((l = this.textInputEl) == null ? void 0 : l.value) || ""), (r = this.textInputEl) == null || r.blur()), a.key === "Escape" && (this.textInputEl && this.value && (this.textInputEl.value = this.value), (c = this.textInputEl) == null || c.blur(), e.classList.remove("error"));
2840
+ var l, r, h;
2841
+ a.key === "Enter" && (a.preventDefault(), i(((l = this.textInputEl) == null ? void 0 : l.value) || ""), (r = this.textInputEl) == null || r.blur()), a.key === "Escape" && (this.textInputEl && this.value && (this.textInputEl.value = this.value), (h = this.textInputEl) == null || h.blur(), e.classList.remove("error"));
2794
2842
  }), this.textInputEl.addEventListener("blur", (a) => {
2795
2843
  const l = a.target;
2796
2844
  l.value.trim() === "" && (l.value = this.value || "#000000FF", e.classList.remove("error"));
@@ -2833,7 +2881,7 @@ class z extends w {
2833
2881
  };
2834
2882
  }
2835
2883
  }
2836
- class Ie extends w {
2884
+ class hi extends w {
2837
2885
  constructor(t = {}) {
2838
2886
  super(t), this.inputType = "text", t.onChange && this.setOnChange(t.onChange);
2839
2887
  }
@@ -2924,12 +2972,12 @@ class B extends w {
2924
2972
  );
2925
2973
  }
2926
2974
  }
2927
- const Wt = `
2975
+ const ee = `
2928
2976
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
2929
2977
  <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="1.5" stroke-linecap="round" stroke-linejoin="round"/>
2930
2978
  <path d="M9 1V17C4.58172 17 1 13.4183 1 9C1 4.58172 4.58172 1 9 1Z" fill="#667085" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
2931
2979
  </svg>`;
2932
- class jt extends B {
2980
+ class ie extends B {
2933
2981
  constructor(t = {}) {
2934
2982
  const e = {
2935
2983
  title: "Opacity",
@@ -2938,7 +2986,7 @@ class jt extends B {
2938
2986
  maxValue: 100,
2939
2987
  step: 1,
2940
2988
  default: t.default ?? 100,
2941
- icon: Wt,
2989
+ icon: ee,
2942
2990
  ...t
2943
2991
  };
2944
2992
  super(e), this.inputType = "number", this.mobileValue = t.mobile;
@@ -2950,12 +2998,12 @@ class jt extends B {
2950
2998
  this.mobileValue = t, t !== void 0 && this.setValue(t);
2951
2999
  }
2952
3000
  }
2953
- const qt = `
3001
+ const se = `
2954
3002
  <svg xmlns="http://www.w3.org/2000/svg" class="svg-select" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">
2955
3003
  <polyline points="6 9 12 15 18 9"></polyline>
2956
3004
  </svg>
2957
3005
  `;
2958
- class nt extends w {
3006
+ class ht extends w {
2959
3007
  constructor(t = {}) {
2960
3008
  if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, this.buttonEl = null, this.isLoading = !1, this.container = null, this.clickOutsideListener = null, this.resizeListener = null, t.options && (this._options = [...t.options]), t.getOptions && this._options.push(...t.getOptions()), t.getOptionsAsync && (this.isLoading = !0), this.value !== void 0) {
2961
3009
  const e = this._options.findIndex((i) => i.value === this.value);
@@ -2999,7 +3047,7 @@ class nt extends w {
2999
3047
  a.onclick = (l) => this.selectOption(l, o, e), i.appendChild(a);
3000
3048
  }), document.body.appendChild(i);
3001
3049
  const s = document.createElement("div");
3002
- return s.classList.add("svg-container"), s.innerHTML = qt, t.appendChild(s), this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
3050
+ return s.classList.add("svg-container"), s.innerHTML = se, t.appendChild(s), this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
3003
3051
  this._options.push(...n), this.isLoading = !1, this.updateOptionsList(), this.updateButtonText();
3004
3052
  }).catch((n) => {
3005
3053
  console.error("Failed to fetch async options:", n), this.isLoading = !1, this.updateButtonText("Failed to load options");
@@ -3062,7 +3110,7 @@ class nt extends w {
3062
3110
  this.clickOutsideListener && (document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = null), this.resizeListener && (window.removeEventListener("resize", this.resizeListener), this.resizeListener = null), this.cleanupDropdownPosition(), this.optionsListEl && this.optionsListEl.parentNode && this.optionsListEl.parentNode.removeChild(this.optionsListEl), super.destroy();
3063
3111
  }
3064
3112
  }
3065
- class Jt extends w {
3113
+ class ne extends w {
3066
3114
  constructor(t = {}) {
3067
3115
  super(t), this.inputType = "button", this.value || (this.value = "center");
3068
3116
  }
@@ -3118,7 +3166,7 @@ class Jt extends w {
3118
3166
  }), t.appendChild(i), t;
3119
3167
  }
3120
3168
  }
3121
- class Se extends w {
3169
+ class di extends w {
3122
3170
  constructor(t) {
3123
3171
  super(t), this.inputType = "button", this.bgWithAlpha = "rgba(145, 158, 171, 0.08)";
3124
3172
  }
@@ -3132,8 +3180,8 @@ class Se extends w {
3132
3180
  /^rgba\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/i
3133
3181
  );
3134
3182
  if (n) {
3135
- let a = +n[1], l = +n[2], r = +n[3], c = +n[4];
3136
- c >= 1 ? (a = Math.round(a * 0.9), l = Math.round(l * 0.9), r = Math.round(r * 0.9)) : c = Math.min(1, c + 0.12), s = `rgba(${a},${l},${r},${c})`;
3183
+ let a = +n[1], l = +n[2], r = +n[3], h = +n[4];
3184
+ h >= 1 ? (a = Math.round(a * 0.9), l = Math.round(l * 0.9), r = Math.round(r * 0.9)) : h = Math.min(1, h + 0.12), s = `rgba(${a},${l},${r},${h})`;
3137
3185
  }
3138
3186
  t.addEventListener("mouseenter", () => {
3139
3187
  console.log("hoverBg", s), t.style.setProperty("background-color", s, "important");
@@ -3147,7 +3195,7 @@ class Se extends w {
3147
3195
  return o.className = "button-setting-wrapper " + (this.props.wrapperClassName || ""), o.appendChild(t), o;
3148
3196
  }
3149
3197
  }
3150
- class Ve extends w {
3198
+ class pi extends w {
3151
3199
  constructor(t = {}) {
3152
3200
  super(t), this.inputType = { width: "number", height: "number" }, this.aspectRatio = 1, this.isUpdating = !1;
3153
3201
  const e = t.width || 0, i = t.height || 0;
@@ -3160,14 +3208,14 @@ class Ve extends w {
3160
3208
  suffix: "px",
3161
3209
  minValue: this.minWidth,
3162
3210
  maxValue: this.maxWidth,
3163
- icon: Zt
3211
+ icon: oe
3164
3212
  }), this.heightSetting = new B({
3165
3213
  title: "Height",
3166
3214
  default: this.value.height,
3167
3215
  suffix: "px",
3168
3216
  minValue: this.minHeight,
3169
3217
  maxValue: this.maxHeight,
3170
- icon: _t
3218
+ icon: ae
3171
3219
  }), this.widthSetting.setOnChange(this.handleWidthChange.bind(this)), this.heightSetting.setOnChange(this.handleHeightChange.bind(this));
3172
3220
  }
3173
3221
  handleWidthChange(t) {
@@ -3261,24 +3309,24 @@ class Ve extends w {
3261
3309
  }
3262
3310
  }
3263
3311
  }
3264
- const Zt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
3312
+ const oe = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
3265
3313
  <path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
3266
- </svg>`, _t = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
3314
+ </svg>`, ae = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
3267
3315
  <path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
3268
- </svg>`, tt = `
3316
+ </svg>`, at = `
3269
3317
  <svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
3270
3318
  <path d="M5 10.5L7.5 8M7.5 8L10 10.5M7.5 8V13.625M12.5 10.9643C13.2634 10.3338 13.75 9.37996 13.75 8.3125C13.75 6.41402 12.211 4.875 10.3125 4.875C10.1759 4.875 10.0482 4.80375 9.97882 4.68609C9.16379 3.30302 7.65902 2.375 5.9375 2.375C3.34867 2.375 1.25 4.47367 1.25 7.0625C1.25 8.35381 1.77215 9.52317 2.61684 10.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
3271
3319
  </svg>
3272
- `, Xt = `
3320
+ `, le = `
3273
3321
  <svg width="91" height="71" viewBox="0 0 91 71" fill="none" xmlns="http://www.w3.org/2000/svg">
3274
3322
  <rect width="91" height="71" rx="4" fill="#F2F4F7"/>
3275
3323
  <path d="M37 31.5L39.5 29M39.5 29L42 31.5M39.5 29V34.625M44.5 31.9643C45.2634 31.3338 45.75 30.38 45.75 29.3125C45.75 27.414 44.211 25.875 42.3125 25.875C42.1759 25.875 42.0482 25.8037 41.9788 25.6861C41.1638 24.303 39.659 23.375 37.9375 23.375C35.3487 23.375 33.25 25.4737 33.25 28.0625C33.25 29.3538 33.7721 30.5232 34.6168 31.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
3276
3324
  </svg>
3277
- `, Kt = `
3325
+ `, re = `
3278
3326
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 12 12" fill="none">
3279
3327
  <path d="M8 3V2.6C8 2.03995 8 1.75992 7.89101 1.54601C7.79513 1.35785 7.64215 1.20487 7.45399 1.10899C7.24008 1 6.96005 1 6.4 1H5.6C5.03995 1 4.75992 1 4.54601 1.10899C4.35785 1.20487 4.20487 1.35785 4.10899 1.54601C4 1.75992 4 2.03995 4 2.6V3M5 5.75V8.25M7 5.75V8.25M1.5 3H10.5M9.5 3V8.6C9.5 9.44008 9.5 9.86012 9.33651 10.181C9.1927 10.4632 8.96323 10.6927 8.68099 10.8365C8.36012 11 7.94008 11 7.1 11H4.9C4.05992 11 3.63988 11 3.31901 10.8365C3.03677 10.6927 2.8073 10.4632 2.66349 10.181C2.5 9.86012 2.5 9.44008 2.5 8.6V3" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
3280
3328
  </svg>
3281
- `, Yt = `
3329
+ `, ce = `
3282
3330
  <svg xmlns="http://www.w3.org/2000/svg" width="29" height="29" viewBox="0 0 29 29" fill="none">
3283
3331
  <!-- Top dot -->
3284
3332
  <circle cx="14.5" cy="3" r="1.5" fill="#02CC59" opacity="1"/>
@@ -3298,7 +3346,7 @@ const Zt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
3298
3346
  <circle cx="6.7" cy="6.7" r="1.5" fill="#02CC59" opacity="0.3"/>
3299
3347
  </svg>
3300
3348
  `;
3301
- class lt extends w {
3349
+ class ut extends w {
3302
3350
  constructor(t = {}) {
3303
3351
  super(t), this.inputType = "button", this.previewWrapper = null, this.previewEl = null, this.emptyStateEl = null, this.errorContainer = null, this.messageListener = null, this.loadingSpinner = null, this.props.delete === void 0 && (this.props.delete = !0), this.props.maxFileSizeMB === void 0 && (this.props.maxFileSizeMB = 5), !this.value && t.defaultUrl && t.defaultUrl !== "" && (this.value = t.defaultUrl), this.setupMessageListener();
3304
3352
  }
@@ -3351,7 +3399,7 @@ class lt extends w {
3351
3399
  );
3352
3400
  if (t && t !== "") {
3353
3401
  this.showLoading(), s && s instanceof HTMLElement && (s.style.display = "none"), e && e.classList.remove("no-image"), i && (i.innerHTML = `
3354
- <span class="upload-icon">${tt}</span>
3402
+ <span class="upload-icon">${at}</span>
3355
3403
  <span class="upload-label">Replace</span>
3356
3404
  `);
3357
3405
  const n = () => {
@@ -3362,7 +3410,7 @@ class lt extends w {
3362
3410
  this.previewEl.addEventListener("load", n), this.previewEl.addEventListener("error", o), this.previewEl.src = t;
3363
3411
  } else
3364
3412
  this.hideLoading(), this.previewWrapper.classList.remove("has-image"), this.previewEl.src = "", this.previewEl.style.display = "none", this.previewWrapper.style.display = "none", s && s instanceof HTMLElement && (s.style.display = "block"), e && e.classList.add("no-image"), i && (i.innerHTML = `
3365
- <span class="upload-icon">${tt}</span>
3413
+ <span class="upload-icon">${at}</span>
3366
3414
  <span class="upload-label">Upload</span>
3367
3415
  `);
3368
3416
  }
@@ -3395,9 +3443,9 @@ class lt extends w {
3395
3443
  const s = this.value && this.value !== "";
3396
3444
  s || i.classList.add("no-image");
3397
3445
  const n = document.createElement("div");
3398
- if (n.className = "preview-placeholder", n.innerHTML = Xt, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.loadingSpinner = document.createElement("div"), this.loadingSpinner.className = "loading-spinner", this.loadingSpinner.innerHTML = Yt, this.loadingSpinner.style.display = "none", this.previewWrapper.appendChild(this.loadingSpinner), this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.props.delete) {
3446
+ if (n.className = "preview-placeholder", n.innerHTML = le, this.previewWrapper = document.createElement("div"), this.previewWrapper.className = "preview-wrapper", this.loadingSpinner = document.createElement("div"), this.loadingSpinner.className = "loading-spinner", this.loadingSpinner.innerHTML = ce, this.loadingSpinner.style.display = "none", this.previewWrapper.appendChild(this.loadingSpinner), this.previewEl = document.createElement("img"), this.previewEl.className = "upload-preview", this.props.delete) {
3399
3447
  const a = document.createElement("button");
3400
- a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML = Kt, this.previewWrapper.appendChild(a), a.onclick = (l) => {
3448
+ a.className = "delete-button", a.type = "button", a.title = "Delete image", a.innerHTML = re, this.previewWrapper.appendChild(a), a.onclick = (l) => {
3401
3449
  var r;
3402
3450
  l.stopPropagation(), this.value = "", this.updatePreviewState(null), (r = this.onChange) == null || r.call(this, ""), this.hideError();
3403
3451
  };
@@ -3405,7 +3453,7 @@ class lt extends w {
3405
3453
  this.previewWrapper.appendChild(this.previewEl);
3406
3454
  const o = document.createElement("button");
3407
3455
  return o.className = "upload-button", o.type = "button", this.getDataPropsPath() && o.setAttribute("data-test-id", this.getDataPropsPath()), o.innerHTML = `
3408
- <span class="upload-icon">${tt}</span>
3456
+ <span class="upload-icon">${at}</span>
3409
3457
  <span class="upload-label">Upload</span>
3410
3458
  `, i.appendChild(n), i.appendChild(this.previewWrapper), i.appendChild(o), t.appendChild(i), s ? this.updatePreviewState(this.value) : this.updatePreviewState(null), o.onclick = () => {
3411
3459
  window.postMessage(
@@ -3418,69 +3466,527 @@ class lt extends w {
3418
3466
  }, t;
3419
3467
  }
3420
3468
  }
3421
- const gt = `
3469
+ const st = `
3422
3470
  <svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
3423
3471
  <path d="M5 10.5L7.5 8M7.5 8L10 10.5M7.5 8V13.625M12.5 10.9643C13.2634 10.3338 13.75 9.37996 13.75 8.3125C13.75 6.41402 12.211 4.875 10.3125 4.875C10.1759 4.875 10.0482 4.80375 9.97882 4.68609C9.16379 3.30302 7.65902 2.375 5.9375 2.375C3.34867 2.375 1.25 4.47367 1.25 7.0625C1.25 8.35381 1.77215 9.52317 2.61684 10.371" stroke="#475467" stroke-linecap="round" stroke-linejoin="round"/>
3424
3472
  </svg>
3425
- `, Qt = `
3473
+ `, Et = `
3426
3474
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
3427
3475
  <path d="M1.5 7.5C1.5 7.5 3.00374 5.45116 4.22538 4.22868C5.44702 3.0062 7.1352 2.25 9 2.25C12.7279 2.25 15.75 5.27208 15.75 9C15.75 12.7279 12.7279 15.75 9 15.75C5.92268 15.75 3.32633 13.6907 2.51382 10.875M1.5 7.5V3M1.5 7.5H6" stroke="#637381" stroke-linecap="round" stroke-linejoin="round"/>
3428
3476
  </svg>
3429
- `, te = `
3477
+ `, he = `
3430
3478
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
3431
3479
  <path fill-rule="evenodd" clip-rule="evenodd" d="M11.9943 13.4085L17.6486 19.0631C17.8371 19.2452 18.0896 19.346 18.3516 19.3437C18.6137 19.3414 18.8644 19.2363 19.0497 19.051C19.235 18.8656 19.3402 18.6149 19.3424 18.3528C19.3447 18.0908 19.244 17.8383 19.0619 17.6497L13.4076 11.9951L19.0619 6.34039C19.244 6.15187 19.3447 5.89937 19.3424 5.63728C19.3402 5.37519 19.235 5.12448 19.0497 4.93915C18.8644 4.75382 18.6137 4.64869 18.3516 4.64642C18.0896 4.64414 17.8371 4.74489 17.6486 4.92697L11.9943 10.5816L6.34004 4.92697C6.15068 4.74939 5.89967 4.65245 5.64011 4.65667C5.38055 4.66088 5.13282 4.76592 4.94932 4.94956C4.76583 5.1332 4.66097 5.38102 4.65694 5.6406C4.65291 5.90018 4.75002 6.15114 4.92772 6.34039L10.581 11.9951L4.92672 17.6497C4.83126 17.7419 4.75511 17.8522 4.70273 17.9742C4.65035 18.0961 4.62277 18.2273 4.62162 18.36C4.62047 18.4928 4.64576 18.6244 4.69601 18.7472C4.74627 18.8701 4.82049 18.9817 4.91433 19.0755C5.00818 19.1694 5.11978 19.2436 5.24262 19.2939C5.36545 19.3441 5.49707 19.3694 5.62978 19.3683C5.7625 19.3671 5.89366 19.3395 6.0156 19.2872C6.13755 19.2348 6.24784 19.1586 6.34004 19.0631L11.9943 13.4085Z" fill="#637381"/>
3432
3480
  </svg>
3433
- `, ee = `
3481
+ `, de = `
3434
3482
  <svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
3435
3483
  <path d="M14 0.5C21.4558 0.5 27.5 6.54416 27.5 14C27.5 21.4558 21.4558 27.5 14 27.5C6.54416 27.5 0.5 21.4558 0.5 14C0.5 6.54416 6.54416 0.5 14 0.5Z" fill="#EFF1F2"/>
3436
3484
  <path d="M14 0.5C21.4558 0.5 27.5 6.54416 27.5 14C27.5 21.4558 21.4558 27.5 14 27.5C6.54416 27.5 0.5 21.4558 0.5 14C0.5 6.54416 6.54416 0.5 14 0.5Z" stroke="#FF5630"/>
3437
3485
  <path d="M7.25 9.7895C7.25 9.4265 7.50875 9.13175 7.82825 9.13175L9.827 9.13175C10.2237 9.11975 10.574 8.8325 10.709 8.408L10.7315 8.333L10.8177 8.03975C10.8702 7.85975 10.916 7.70225 10.9805 7.562C11.234 7.00775 11.7035 6.623 12.2458 6.52475C12.3837 6.5 12.5292 6.5 12.6957 6.5L15.3043 6.5C15.4715 6.5 15.617 6.5 15.7542 6.52475C16.2965 6.623 16.7667 7.00775 17.0195 7.562C17.084 7.70225 17.1297 7.859 17.183 8.03975L17.2685 8.333L17.291 8.408C17.426 8.8325 17.846 9.1205 18.2435 9.13175L20.171 9.13175C20.4912 9.13175 20.75 9.4265 20.75 9.7895C20.75 10.1525 20.4912 10.4473 20.1717 10.4473L7.8275 10.4473C7.50875 10.4473 7.25 10.1525 7.25 9.7895Z" fill="#FF5630"/>
3438
3486
  <path fill-rule="evenodd" clip-rule="evenodd" d="M13.697 21.5L14.303 21.5C16.3902 21.5 17.4335 21.5 18.113 20.8355C18.791 20.171 18.86 19.0813 18.9987 16.9018L19.199 13.7608C19.274 12.578 19.3115 11.9863 18.9717 11.612C18.6312 11.237 18.0567 11.237 16.907 11.237L11.093 11.237C9.94325 11.237 9.368 11.237 9.02825 11.612C8.68775 11.987 8.72525 12.578 8.801 13.7608L9.00125 16.9018C9.14 19.0813 9.209 20.1718 9.88775 20.8355C10.5665 21.5 11.6097 21.5 13.697 21.5ZM12.6845 14.1418C12.6545 13.8163 12.3785 13.5793 12.0695 13.6115C11.7597 13.6438 11.5347 13.934 11.5655 14.2595L11.9405 18.2068C11.9705 18.5323 12.2465 18.7693 12.5555 18.737C12.8652 18.7048 13.0902 18.4145 13.0595 18.089L12.6845 14.1418ZM15.9312 13.6115C16.2402 13.6438 16.466 13.934 16.4345 14.2595L16.0595 18.2068C16.0295 18.5323 15.7527 18.7693 15.4445 18.737C15.1347 18.7048 14.9097 18.4145 14.9405 18.089L15.3155 14.1418C15.3455 13.8163 15.623 13.5793 15.9312 13.6115Z" fill="#FF5630"/>
3439
3487
  </svg>
3440
- `, ie = `
3488
+ `, pe = `
3441
3489
  <svg xmlns="http://www.w3.org/2000/svg" width="11" height="12" viewBox="0 0 11 12" fill="none">
3442
3490
  <path d="M-4.47342e-07 2.5585C-3.97978e-07 2.27617 0.20125 2.04692 0.44975 2.04692L2.00433 2.04692C2.31292 2.03758 2.58533 1.81417 2.69033 1.484L2.70783 1.42567L2.77492 1.19758C2.81575 1.05758 2.85133 0.935084 2.9015 0.826C3.09867 0.394917 3.46383 0.0956673 3.88558 0.0192507C3.99292 6.93798e-07 4.10608 7.1793e-07 4.23558 7.40573e-07L6.26442 1.09531e-06C6.3945 1.11805e-06 6.50767 1.13349e-06 6.61442 0.0192512C7.03617 0.0956679 7.40192 0.394918 7.5985 0.826001C7.64867 0.935085 7.68425 1.057 7.72567 1.19758L7.79217 1.42567L7.80967 1.484C7.91467 1.81417 8.24133 2.03817 8.5505 2.04692L10.0497 2.04692C10.2987 2.04692 10.5 2.27617 10.5 2.5585C10.5 2.84084 10.2987 3.07009 10.0502 3.07009L0.449166 3.07008C0.201249 3.07008 -4.96707e-07 2.84083 -4.47342e-07 2.5585Z" fill="#F04438"/>
3443
3491
  <path fill-rule="evenodd" clip-rule="evenodd" d="M5.01433 11.6667L5.48566 11.6667C7.10908 11.6667 7.9205 11.6667 8.449 11.1498C8.97633 10.633 9.03 9.78542 9.13792 8.09025L9.29366 5.64725C9.352 4.72734 9.38117 4.26709 9.11692 3.976C8.85208 3.68434 8.40525 3.68434 7.511 3.68433L2.989 3.68433C2.09475 3.68433 1.64733 3.68433 1.38308 3.976C1.11825 4.26767 1.14742 4.72733 1.20633 5.64725L1.36208 8.09025C1.47 9.78542 1.52366 10.6336 2.05158 11.1498C2.5795 11.6667 3.39091 11.6667 5.01433 11.6667ZM4.22683 5.94358C4.2035 5.69042 3.98883 5.50608 3.7485 5.53117C3.50758 5.55625 3.33258 5.782 3.3565 6.03517L3.64816 9.10525C3.6715 9.35842 3.88617 9.54275 4.1265 9.51767C4.36742 9.49258 4.54242 9.26683 4.5185 9.01367L4.22683 5.94358ZM6.75208 5.53117C6.99242 5.55625 7.168 5.782 7.1435 6.03517L6.85183 9.10525C6.8285 9.35842 6.61325 9.54275 6.3735 9.51767C6.13258 9.49259 5.95758 9.26683 5.9815 9.01367L6.27317 5.94358C6.2965 5.69042 6.51233 5.50609 6.75208 5.53117Z" fill="#F04438"/>
3444
3492
  </svg>
3445
- `, se = `
3493
+ `, ue = `
3446
3494
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
3447
3495
  <path fill-rule="evenodd" clip-rule="evenodd" d="M10.279 5.55268C10.1384 5.41223 9.94777 5.33334 9.74902 5.33334C9.55027 5.33334 9.35965 5.41223 9.21902 5.55268L4.21902 10.5527C4.07857 10.6933 3.99968 10.8839 3.99968 11.0827C3.99968 11.2814 4.07857 11.4721 4.21902 11.6127L9.21902 16.6127C9.28769 16.6864 9.37049 16.7455 9.46249 16.7865C9.55448 16.8275 9.6538 16.8495 9.7545 16.8513C9.8552 16.8531 9.95523 16.8345 10.0486 16.7968C10.142 16.7591 10.2268 16.7029 10.2981 16.6317C10.3693 16.5605 10.4254 16.4757 10.4631 16.3823C10.5009 16.2889 10.5194 16.1889 10.5176 16.0882C10.5158 15.9875 10.4938 15.8881 10.4528 15.7961C10.4118 15.7041 10.3527 15.6213 10.279 15.5527L6.55902 11.8327H14.749C15.462 11.8327 16.549 12.0527 17.436 12.6917C18.284 13.3017 18.999 14.3267 18.999 16.0827C18.999 16.2816 19.078 16.4724 19.2187 16.613C19.3593 16.7537 19.5501 16.8327 19.749 16.8327C19.9479 16.8327 20.1387 16.7537 20.2794 16.613C20.42 16.4724 20.499 16.2816 20.499 16.0827C20.499 13.8387 19.547 12.3627 18.312 11.4737C17.116 10.6127 15.702 10.3327 14.749 10.3327H6.55902L10.279 6.61268C10.4195 6.47206 10.4984 6.28143 10.4984 6.08268C10.4984 5.88393 10.4195 5.69331 10.279 5.55268Z" fill="#454F5B"/>
3448
3496
  </svg>
3449
- `, ne = `
3497
+ `, ge = `
3450
3498
  <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
3451
3499
  <path fill-rule="evenodd" clip-rule="evenodd" d="M14.2198 5.55268C14.3604 5.41223 14.551 5.33334 14.7498 5.33334C14.9485 5.33334 15.1391 5.41223 15.2798 5.55268L20.2798 10.5527C20.4202 10.6933 20.4991 10.8839 20.4991 11.0827C20.4991 11.2814 20.4202 11.4721 20.2798 11.6127L15.2798 16.6127C15.2111 16.6864 15.1283 16.7455 15.0363 16.7865C14.9443 16.8275 14.845 16.8495 14.7443 16.8513C14.6436 16.8531 14.5435 16.8345 14.4502 16.7968C14.3568 16.7591 14.2719 16.7029 14.2007 16.6317C14.1295 16.5605 14.0734 16.4757 14.0356 16.3823C13.9979 16.2889 13.9794 16.1889 13.9812 16.0882C13.9829 15.9875 14.005 15.8881 14.046 15.7961C14.087 15.7041 14.1461 15.6213 14.2198 15.5527L17.9398 11.8327H9.74976C9.03676 11.8327 7.94976 12.0527 7.06276 12.6917C6.21476 13.3017 5.49976 14.3267 5.49976 16.0827C5.49976 16.2816 5.42074 16.4724 5.28009 16.613C5.13943 16.7537 4.94867 16.8327 4.74976 16.8327C4.55084 16.8327 4.36008 16.7537 4.21943 16.613C4.07877 16.4724 3.99976 16.2816 3.99976 16.0827C3.99976 13.8387 4.95176 12.3627 6.18676 11.4737C7.38276 10.6127 8.79676 10.3327 9.74976 10.3327H17.9398L14.2198 6.61268C14.0793 6.47206 14.0004 6.28143 14.0004 6.08268C14.0004 5.88393 14.0793 5.69331 14.2198 5.55268Z" fill="#454F5B"/>
3452
3500
  </svg>
3453
3501
 
3454
- `, oe = `
3502
+ `, me = `
3455
3503
  <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15" fill="none">
3456
3504
  <path fill-rule="evenodd" clip-rule="evenodd" d="M15 7.5C15 11.6423 11.6423 15 7.5 15C3.35775 15 0 11.6423 0 7.5C0 3.35775 3.35775 0 7.5 0C11.6423 0 15 3.35775 15 7.5ZM10.5225 5.2275C10.6278 5.33297 10.687 5.47594 10.687 5.625C10.687 5.77406 10.6278 5.91703 10.5225 6.0225L6.7725 9.7725C6.66703 9.87784 6.52406 9.93701 6.375 9.93701C6.22594 9.93701 6.08297 9.87784 5.9775 9.7725L4.4775 8.2725C4.42224 8.221 4.37791 8.1589 4.34716 8.0899C4.31642 8.0209 4.29989 7.94642 4.29856 7.87089C4.29722 7.79536 4.31112 7.72034 4.33941 7.6503C4.3677 7.58026 4.40981 7.51664 4.46322 7.46322C4.51664 7.40981 4.58026 7.3677 4.6503 7.33941C4.72034 7.31112 4.79536 7.29722 4.87089 7.29856C4.94642 7.29989 5.0209 7.31642 5.0899 7.34716C5.1589 7.37791 5.221 7.42224 5.2725 7.4775L6.375 8.58L8.05125 6.90375L9.7275 5.2275C9.83297 5.12216 9.97594 5.063 10.125 5.063C10.2741 5.063 10.417 5.12216 10.5225 5.2275Z" fill="#06CD5C"/>
3457
3505
  </svg>
3458
- `, mt = `
3506
+ `, ve = `
3459
3507
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
3460
3508
  <path d="M8.99998 13.5L5.57436 8.6625C5.01365 8.00048 4.65256 7.19277 4.53315 6.33346C4.41373 5.47415 4.54091 4.5986 4.89987 3.80877C5.25883 3.01895 5.83479 2.34736 6.56068 1.87222C7.28657 1.39708 8.13251 1.13795 8.99998 1.125C10.2025 1.13688 11.3512 1.62483 12.1947 2.48198C13.0381 3.33913 13.5075 4.49561 13.5 5.69812C13.5004 6.74715 13.1433 7.765 12.4875 8.58375L8.99998 13.5ZM8.99998 2.25C8.0954 2.26039 7.23191 2.62934 6.59913 3.27583C5.96634 3.92233 5.61598 4.79353 5.62498 5.69812C5.62924 6.52369 5.92623 7.32097 6.46311 7.94812L8.99998 11.5425L11.6044 7.875C12.0994 7.25706 12.371 6.4899 12.375 5.69812C12.384 4.79353 12.0336 3.92233 11.4008 3.27583C10.7681 2.62934 9.90457 2.26039 8.99998 2.25Z" fill="#637381"/>
3461
3509
  <path d="M9 6.1875C9.62132 6.1875 10.125 5.68382 10.125 5.0625C10.125 4.44118 9.62132 3.9375 9 3.9375C8.37868 3.9375 7.875 4.44118 7.875 5.0625C7.875 5.68382 8.37868 6.1875 9 6.1875Z" fill="#637381"/>
3462
3510
  <path d="M15.75 6.75H14.625V7.875H15.75V15.75H2.25V7.875H3.375V6.75H2.25C1.95163 6.75 1.66548 6.86853 1.4545 7.07951C1.24353 7.29048 1.125 7.57663 1.125 7.875V15.75C1.125 16.0484 1.24353 16.3345 1.4545 16.5455C1.66548 16.7565 1.95163 16.875 2.25 16.875H15.75C16.0484 16.875 16.3345 16.7565 16.5455 16.5455C16.7565 16.3345 16.875 16.0484 16.875 15.75V7.875C16.875 7.57663 16.7565 7.29048 16.5455 7.07951C16.3345 6.86853 16.0484 6.75 15.75 6.75Z" fill="#637381"/>
3463
3511
  </svg>
3464
- `, ae = `
3512
+ `, fe = `
3465
3513
  <svg width="27" height="34" viewBox="0 0 27 34" fill="none" xmlns="http://www.w3.org/2000/svg">
3466
3514
  <path d="M13.2217 0.25C20.3738 0.25 26.1942 6.06962 26.1943 13.2217V13.2227C26.2179 18.4466 22.9671 23.3445 19.666 26.9609C18.0203 28.7638 16.3726 30.2373 15.1357 31.2598C14.5176 31.7708 14.0026 32.1695 13.6426 32.4395C13.4628 32.5743 13.3215 32.6771 13.2256 32.7461L13.2227 32.7471C12.5085 32.2389 9.52009 30.06 6.58984 26.8271C3.35339 23.2564 0.226466 18.445 0.25 13.2148V13.2139C0.25 6.07018 6.06958 0.25024 13.2217 0.25Z" fill="#F04438" stroke="#A82A21" stroke-width="0.5"/>
3467
3515
  </svg>
3468
- `, le = `
3516
+ `, Ce = `
3469
3517
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
3470
3518
  <path d="M14.4132 4.80441C14.7371 4.80441 15 5.06731 15 5.39119C15 5.71507 14.7371 5.97797 14.4132 5.97797H13.7595L13.3736 11.7568C13.3426 12.2221 13.3179 12.6056 13.2722 12.9163C13.2256 13.234 13.1515 13.523 12.9982 13.7921C12.7591 14.2119 12.3978 14.5496 11.963 14.7604C11.6845 14.8953 11.3913 14.9499 11.0714 14.9753C10.7584 15.0002 10.3738 15 9.90749 15H8.09251C7.62617 15 7.24164 15.0002 6.92863 14.9753C6.6087 14.9499 6.31554 14.8953 6.037 14.7604C5.60221 14.5496 5.24093 14.2119 5.00176 13.7921C4.84855 13.523 4.77439 13.234 4.72775 12.9163C4.68215 12.6056 4.65745 12.2221 4.62643 11.7568L4.24053 5.97797H3.58678C3.26291 5.97797 3 5.71507 3 5.39119C3 5.06731 3.26291 4.80441 3.58678 4.80441H14.4132ZM5.79648 11.6793C5.82874 12.1632 5.8517 12.4923 5.88899 12.7463C5.9252 12.9927 5.96948 13.1207 6.02115 13.2115C6.14297 13.4253 6.32656 13.5975 6.54802 13.7048C6.64205 13.7504 6.7733 13.7864 7.02203 13.8062C7.27784 13.8265 7.6077 13.8264 8.09251 13.8264H9.90749C10.3923 13.8264 10.7222 13.8265 10.978 13.8062C11.2267 13.7864 11.358 13.7504 11.452 13.7048C11.6734 13.5975 11.857 13.4253 11.9789 13.2115C12.0305 13.1207 12.0748 12.9927 12.111 12.7463C12.1483 12.4923 12.1713 12.1632 12.2035 11.6793L12.5841 5.97797H5.41586L5.79648 11.6793ZM7.21057 11.1048V8.0978C7.21057 7.77392 7.47348 7.51101 7.79736 7.51101C8.1211 7.51117 8.38326 7.77402 8.38326 8.0978V11.1048C8.38326 11.4286 8.1211 11.6915 7.79736 11.6916C7.47348 11.6916 7.21057 11.4287 7.21057 11.1048ZM9.61674 11.1048V8.0978C9.61674 7.77402 9.8789 7.51117 10.2026 7.51101C10.5265 7.51101 10.7894 7.77392 10.7894 8.0978V11.1048C10.7894 11.4287 10.5265 11.6916 10.2026 11.6916C9.8789 11.6915 9.61674 11.4286 9.61674 11.1048ZM10.8044 3C11.1283 3 11.3912 3.26291 11.3912 3.58678C11.3912 3.91066 11.1283 4.17357 10.8044 4.17357H7.19559C6.87172 4.17357 6.60881 3.91066 6.60881 3.58678C6.60881 3.26291 6.87172 3 7.19559 3H10.8044Z" fill="#46525C"/>
3471
3519
  </svg>
3472
- `, re = `
3520
+ `, ye = `
3473
3521
  <svg xmlns="http://www.w3.org/2000/svg" width="8" height="4" viewBox="0 0 8 4" fill="none">
3474
3522
  <path fill-rule="evenodd" clip-rule="evenodd" d="M0 0L2.58579 2.58579C3.36684 3.36684 4.63317 3.36683 5.41421 2.58579L8 0L0 0Z" fill="#1C252E"/>
3475
3523
  </svg>
3476
- `, $ = class $ extends w {
3524
+ `, G = 10, bt = 5, Ee = 24, be = 50, we = 5e3, xe = 800, Le = 0.8, ke = 700, Me = [
3525
+ "image/jpeg",
3526
+ "image/jpg",
3527
+ "image/png",
3528
+ "image/gif",
3529
+ "image/webp"
3530
+ ];
3531
+ function Se(c, t) {
3532
+ if (!Me.includes(c.type))
3533
+ return {
3534
+ valid: !1,
3535
+ error: "Invalid file type. Please upload a JPEG, PNG, GIF, or WebP image."
3536
+ };
3537
+ const e = t * 1024 * 1024;
3538
+ return c.size > e ? {
3539
+ valid: !1,
3540
+ error: `File size (${(c.size / 1048576).toFixed(1)}MB) exceeds ${t}MB limit.`
3541
+ } : { valid: !0 };
3542
+ }
3543
+ function wt(c, t, e) {
3544
+ if (!c.length) return [];
3545
+ const i = t && t.width && t.height && t || e && e.width && e.height && e || null;
3546
+ return c.map((s) => {
3547
+ const n = { ...s };
3548
+ return i && n.x > 100 && (n.x = n.x / i.width * 100), i && n.y > 100 && (n.y = n.y / i.height * 100), n.x = nt(n.x), n.y = nt(n.y), n;
3549
+ });
3550
+ }
3551
+ function nt(c) {
3552
+ return Number.isFinite(c) ? Math.max(0, Math.min(100, c)) : 0;
3553
+ }
3554
+ function xt(c, t, e) {
3555
+ const i = (c - e.left) / e.width * 100, s = (t - e.top) / e.height * 100;
3556
+ return {
3557
+ x: nt(i),
3558
+ y: nt(s)
3559
+ };
3560
+ }
3561
+ function Tt(c) {
3562
+ const t = c.map((i) => i.index).sort((i, s) => i - s);
3563
+ let e = 1;
3564
+ for (const i of t)
3565
+ if (i === e)
3566
+ e++;
3567
+ else
3568
+ break;
3569
+ return e;
3570
+ }
3571
+ function Ie(c, t) {
3572
+ const e = Tt(c);
3573
+ let i = `Prize ${e}`;
3574
+ if (t && t.length > 0) {
3575
+ const s = t[e - 1];
3576
+ s && (i = s);
3577
+ }
3578
+ return { index: e, name: i };
3579
+ }
3580
+ const gt = class gt {
3581
+ static show(t, e = we) {
3582
+ this.injectStyles();
3583
+ const i = document.createElement("div");
3584
+ i.className = "image-map-error-toast", i.textContent = t, i.style.cssText = `
3585
+ position: fixed;
3586
+ top: 20px;
3587
+ right: 20px;
3588
+ background-color: #ef4444;
3589
+ color: white;
3590
+ padding: 12px 16px;
3591
+ border-radius: 8px;
3592
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
3593
+ z-index: 10000;
3594
+ max-width: 350px;
3595
+ font-size: 14px;
3596
+ animation: slideIn 0.3s ease-out;
3597
+ `, document.body.appendChild(i), setTimeout(() => {
3598
+ i.style.animation = "slideOut 0.3s ease-out", setTimeout(() => {
3599
+ i.parentElement && i.parentElement.removeChild(i);
3600
+ }, 300);
3601
+ }, e);
3602
+ }
3603
+ static injectStyles() {
3604
+ if (!this.styleInjected) {
3605
+ if (!document.getElementById("image-map-toast-styles")) {
3606
+ const t = document.createElement("style");
3607
+ t.id = "image-map-toast-styles", t.textContent = `
3608
+ @keyframes slideIn {
3609
+ from {
3610
+ transform: translateX(400px);
3611
+ opacity: 0;
3612
+ }
3613
+ to {
3614
+ transform: translateX(0);
3615
+ opacity: 1;
3616
+ }
3617
+ }
3618
+ @keyframes slideOut {
3619
+ from {
3620
+ transform: translateX(0);
3621
+ opacity: 1;
3622
+ }
3623
+ to {
3624
+ transform: translateX(400px);
3625
+ opacity: 0;
3626
+ }
3627
+ }
3628
+ `, document.head.appendChild(t);
3629
+ }
3630
+ this.styleInjected = !0;
3631
+ }
3632
+ }
3633
+ };
3634
+ gt.styleInjected = !1;
3635
+ let U = gt;
3636
+ class Ne {
3637
+ constructor() {
3638
+ this.overlayElement = null, this.activePromise = null;
3639
+ }
3640
+ show(t) {
3641
+ return this.activePromise ? this.activePromise : (this.activePromise = new Promise((e) => {
3642
+ this.cleanup();
3643
+ const i = document.createElement("div");
3644
+ i.className = "image-map-confirm-overlay", this.overlayElement = i;
3645
+ const s = document.createElement("div");
3646
+ s.className = "image-map-confirm-modal";
3647
+ const n = document.createElement("div");
3648
+ n.className = "confirm-header", n.textContent = t.title;
3649
+ const o = document.createElement("div");
3650
+ o.className = "confirm-body", o.textContent = t.description;
3651
+ const a = document.createElement("div");
3652
+ a.className = "confirm-actions";
3653
+ const l = document.createElement("button");
3654
+ l.type = "button", l.className = "confirm-btn ghost", l.textContent = t.cancelText || "Cancel";
3655
+ const r = document.createElement("button");
3656
+ r.type = "button", r.className = "confirm-btn danger", r.textContent = t.confirmText || "Discard";
3657
+ const h = (d) => {
3658
+ i.remove(), this.overlayElement = null, this.activePromise = null, e(d);
3659
+ };
3660
+ l.addEventListener("click", () => h(!1)), r.addEventListener("click", () => h(!0)), i.addEventListener("click", (d) => {
3661
+ d.target === i && h(!1);
3662
+ }), a.appendChild(l), a.appendChild(r), s.appendChild(n), s.appendChild(o), s.appendChild(a), i.appendChild(s), document.body.appendChild(i), setTimeout(() => {
3663
+ s.classList.add("visible");
3664
+ }, 10);
3665
+ }), this.activePromise);
3666
+ }
3667
+ cleanup() {
3668
+ this.overlayElement && (this.overlayElement.remove(), this.overlayElement = null), this.activePromise = null;
3669
+ }
3670
+ }
3671
+ class Pe {
3672
+ constructor() {
3673
+ this.element = document.createElement("div"), this.element.className = "marker-cursor-tooltip";
3674
+ }
3675
+ getElement() {
3676
+ return this.element;
3677
+ }
3678
+ show() {
3679
+ this.element.classList.add("visible");
3680
+ }
3681
+ hide() {
3682
+ this.element.classList.remove("visible");
3683
+ }
3684
+ updateContent(t) {
3685
+ this.element.textContent = t;
3686
+ }
3687
+ updatePosition(t, e) {
3688
+ const i = e.getBoundingClientRect(), s = t.clientX - i.left, n = t.clientY - i.top;
3689
+ this.element.style.left = `${s}px`, this.element.style.top = `${n}px`;
3690
+ }
3691
+ shouldShow(t, e) {
3692
+ return t < e;
3693
+ }
3694
+ }
3695
+ class Ve {
3696
+ constructor() {
3697
+ this.history = [], this.historyIndex = -1;
3698
+ }
3699
+ initialize(t) {
3700
+ this.history = [JSON.parse(JSON.stringify(t))], this.historyIndex = 0;
3701
+ }
3702
+ saveState(t) {
3703
+ const e = JSON.parse(
3704
+ JSON.stringify(t)
3705
+ );
3706
+ if (this.historyIndex >= 0 && this.history.length > 0) {
3707
+ const i = this.history[this.historyIndex];
3708
+ if (JSON.stringify(i) === JSON.stringify(e))
3709
+ return;
3710
+ }
3711
+ this.history = this.history.slice(0, this.historyIndex + 1), this.history.push(e), this.historyIndex++, this.history.length > be && (this.history.shift(), this.historyIndex--);
3712
+ }
3713
+ canUndo() {
3714
+ return this.historyIndex > 0;
3715
+ }
3716
+ canRedo() {
3717
+ return this.historyIndex < this.history.length - 1;
3718
+ }
3719
+ undo() {
3720
+ return this.canUndo() ? (this.historyIndex--, JSON.parse(
3721
+ JSON.stringify(this.history[this.historyIndex])
3722
+ )) : null;
3723
+ }
3724
+ redo() {
3725
+ return this.canRedo() ? (this.historyIndex++, JSON.parse(
3726
+ JSON.stringify(this.history[this.historyIndex])
3727
+ )) : null;
3728
+ }
3729
+ reset() {
3730
+ this.history = [], this.historyIndex = -1;
3731
+ }
3732
+ }
3733
+ class Te {
3734
+ constructor() {
3735
+ this.messageListener = null, this.handlers = /* @__PURE__ */ new Map();
3736
+ }
3737
+ registerHandler(t, e) {
3738
+ this.handlers.set(t, e), this.messageListener || this.setupMessageListener();
3739
+ }
3740
+ unregisterHandler(t) {
3741
+ this.handlers.delete(t), this.handlers.size === 0 && this.cleanupMessageListener();
3742
+ }
3743
+ openFileManager(t) {
3744
+ window.postMessage(
3745
+ {
3746
+ type: "OPEN_FILE_MANAGER_MODAL",
3747
+ settingId: t
3748
+ },
3749
+ "*"
3750
+ );
3751
+ }
3752
+ setupMessageListener() {
3753
+ this.messageListener = (t) => {
3754
+ if (t.data && t.data.type === "FILE_MANAGER_IMAGE_SELECTED") {
3755
+ const e = t.data.settingId, i = t.data.imageUrl;
3756
+ if (e && i && typeof i == "string") {
3757
+ const s = this.handlers.get(e);
3758
+ s && s(i);
3759
+ }
3760
+ }
3761
+ }, window.addEventListener("message", this.messageListener);
3762
+ }
3763
+ cleanupMessageListener() {
3764
+ this.messageListener && (window.removeEventListener("message", this.messageListener), this.messageListener = null);
3765
+ }
3766
+ cleanup() {
3767
+ this.handlers.clear(), this.cleanupMessageListener();
3768
+ }
3769
+ }
3770
+ const Lt = new Te();
3771
+ function Oe(c, t) {
3772
+ const e = document.createElement("div");
3773
+ e.className = "marker-container", e.style.left = `${c.x}%`, e.style.top = `${c.y}%`, e.setAttribute("data-marker-id", String(c.id));
3774
+ const i = document.createElement("div");
3775
+ i.className = "image-map-marker", i.innerHTML = fe;
3776
+ const s = document.createElement("span");
3777
+ s.className = "marker-number", s.textContent = String(c.index), i.appendChild(s), e.appendChild(i);
3778
+ const n = document.createElement("button");
3779
+ return n.type = "button", n.className = "marker-delete-btn", n.innerHTML = de, n.addEventListener("click", (o) => {
3780
+ o.stopPropagation(), t.onDelete(c.id);
3781
+ }), e.appendChild(n), e.addEventListener("mousedown", (o) => {
3782
+ o.stopPropagation(), o.preventDefault(), t.onDragStart(c.id), e.classList.add("dragging");
3783
+ }), e;
3784
+ }
3785
+ function He(c, t, e) {
3786
+ const i = /* @__PURE__ */ new Map();
3787
+ c.forEach((n) => i.set(n.index, n));
3788
+ const s = document.createElement("div");
3789
+ s.className = "simple-prize-list";
3790
+ for (let n = t; n >= 1; n--) {
3791
+ const o = i.get(n), a = !!o, l = (o == null ? void 0 : o.prizeName) || e && e[n - 1] || "Prize Name", r = document.createElement("div");
3792
+ r.className = `simple-prize-item ${a ? "placed" : ""}`;
3793
+ const h = document.createElement("div");
3794
+ h.className = "simple-prize-number", h.textContent = `#${n}`, r.appendChild(h);
3795
+ const d = document.createElement("div");
3796
+ if (d.className = "simple-prize-text", d.textContent = `${l}`, r.appendChild(d), a) {
3797
+ const p = document.createElement("div");
3798
+ p.className = "simple-prize-check", p.innerHTML = me, r.appendChild(p);
3799
+ }
3800
+ s.appendChild(r);
3801
+ }
3802
+ return s;
3803
+ }
3804
+ function $e(c, t) {
3805
+ const e = document.createElement("div");
3806
+ e.className = "controls-row";
3807
+ const i = document.createElement("div");
3808
+ i.className = "place-prize-text", i.textContent = "Place Prize", e.appendChild(i);
3809
+ const s = document.createElement("div");
3810
+ s.className = "undo-redo-group";
3811
+ const n = document.createElement("button");
3812
+ n.type = "button", n.className = "undo-btn action-btn", n.innerHTML = ue, n.title = "Undo (Ctrl+Z)", n.disabled = !c.canUndo, n.addEventListener("click", () => t.onUndo()), s.appendChild(n);
3813
+ const o = document.createElement("button");
3814
+ o.type = "button", o.className = "redo-btn action-btn", o.innerHTML = ge, o.title = "Redo (Ctrl+Y)", o.disabled = !c.canRedo, o.addEventListener("click", () => t.onRedo()), s.appendChild(o), e.appendChild(s);
3815
+ const a = c.markerCount === c.maxMarkers, l = document.createElement("div");
3816
+ return l.className = "prize-counter-inline", l.textContent = `${c.markerCount}/${c.maxMarkers}`, a && l.classList.add("complete"), e.appendChild(l), e;
3817
+ }
3818
+ function Be(c) {
3819
+ const t = document.createElement("div");
3820
+ {
3821
+ t.className = "upload-section-wrapper";
3822
+ {
3823
+ const s = document.createElement("h4");
3824
+ s.className = "upload-section-title", s.textContent = "Upload/Replace Map Image", t.appendChild(s);
3825
+ }
3826
+ const e = document.createElement("div");
3827
+ e.className = "upload-section";
3828
+ const i = Ae(c);
3829
+ e.appendChild(i), t.appendChild(e);
3830
+ }
3831
+ return t;
3832
+ }
3833
+ function Ae(c) {
3834
+ if (c.uploadMethod === "input") {
3835
+ const t = document.createElement("label");
3836
+ t.className = "upload-label", t.innerHTML = `<div class="upload-placeholder">${st}<span>Click to upload image</span></div>`;
3837
+ const e = document.createElement("input");
3838
+ return e.type = "file", e.accept = "image/jpeg,image/jpg,image/png,image/gif,image/webp", e.style.display = "none", e.addEventListener("change", (i) => {
3839
+ var n;
3840
+ const s = (n = i.target.files) == null ? void 0 : n[0];
3841
+ s && c.onFileSelected(s);
3842
+ }), t.appendChild(e), t;
3843
+ } else {
3844
+ const t = document.createElement("button");
3845
+ return t.type = "button", t.className = "upload-label", t.innerHTML = `<div class="upload-placeholder">${st}<span>Open File Manager</span></div>`, t.addEventListener("click", () => {
3846
+ window.postMessage(
3847
+ {
3848
+ type: "OPEN_FILE_MANAGER_MODAL",
3849
+ settingId: c.settingId
3850
+ },
3851
+ "*"
3852
+ );
3853
+ }), t;
3854
+ }
3855
+ }
3856
+ function De() {
3857
+ const c = document.createElement("img");
3858
+ c.className = "image-map-thumbnail-main";
3859
+ const t = document.createElement("span");
3860
+ t.className = "image-map-icon", t.innerHTML = ve;
3861
+ const e = document.createElement("span");
3862
+ e.className = "image-map-marker-count";
3863
+ const i = document.createElement("button");
3864
+ return i.type = "button", i.className = "image-map-button", i.appendChild(t), i.appendChild(e), {
3865
+ thumbnailEl: c,
3866
+ configureButtonTextEl: e,
3867
+ mapIconEl: t,
3868
+ configureButton: i,
3869
+ uploadBox: document.createElement("div")
3870
+ };
3871
+ }
3872
+ function O(c, t) {
3873
+ const e = t && t.imageUrl && t.imageUrl !== "", i = c.thumbnailEl.parentElement, s = i == null ? void 0 : i.parentElement;
3874
+ s && (e ? (s.classList.add("has-image"), c.thumbnailEl.src = t.imageUrl) : (s.classList.remove("has-image"), c.thumbnailEl.src = "")), c.configureButtonTextEl.textContent = "Configure Map", c.configureButton && (c.configureButton.disabled = !e);
3875
+ }
3876
+ function Re(c, t) {
3877
+ const e = document.createElement("div");
3878
+ e.className = "image-map-upload-box";
3879
+ const i = document.createElement("div");
3880
+ i.className = "image-map-thumbnail-wrapper", i.appendChild(c);
3881
+ const s = document.createElement("button");
3882
+ return s.type = "button", s.className = "image-map-delete-btn", s.innerHTML = pe, s.addEventListener("click", (n) => {
3883
+ n.stopPropagation(), t();
3884
+ }), i.appendChild(s), e.appendChild(i), e;
3885
+ }
3886
+ function Fe(c, t, e) {
3887
+ if (c === "input") {
3888
+ const i = document.createElement("label");
3889
+ i.className = "image-map-upload-label", i.innerHTML = `
3890
+ <div class="upload-icon upload-icon-default">${st}</div>
3891
+ <div class="upload-icon upload-icon-replace">${Et}</div>
3892
+ <span class="upload-text">Upload Image</span>
3893
+ `;
3894
+ const s = document.createElement("input");
3895
+ return s.type = "file", s.accept = "image/jpeg,image/jpg,image/png,image/gif,image/webp", s.style.display = "none", s.addEventListener("change", (n) => {
3896
+ var a;
3897
+ const o = (a = n.target.files) == null ? void 0 : a[0];
3898
+ o && t && t(o);
3899
+ }), i.appendChild(s), i;
3900
+ } else {
3901
+ const i = document.createElement("button");
3902
+ return i.type = "button", i.className = "image-map-upload-label", i.innerHTML = `
3903
+ <div class="upload-icon upload-icon-default">${st}</div>
3904
+ <div class="upload-icon upload-icon-replace">${Et}</div>
3905
+ <span class="upload-text">Upload Image</span>
3906
+ `, i.addEventListener("click", () => {
3907
+ window.postMessage(
3908
+ {
3909
+ type: "OPEN_FILE_MANAGER_MODAL",
3910
+ settingId: e
3911
+ },
3912
+ "*"
3913
+ );
3914
+ }), i;
3915
+ }
3916
+ }
3917
+ function Ge(c, t, e, i) {
3918
+ const s = document.createElement("div");
3919
+ s.className = "image-map-container", s.addEventListener("scroll", e.onScroll);
3920
+ const n = document.createElement("div");
3921
+ n.className = "image-map-wrapper", n.addEventListener("mousemove", e.onMarkerDrag), n.addEventListener("mouseup", e.onStopDragging), n.addEventListener("mouseleave", e.onStopDragging);
3922
+ const o = document.createElement("img");
3923
+ o.className = "image-map-image", o.src = c, o.addEventListener("load", e.onImageLoad), o.addEventListener("click", e.onImageClick), n.appendChild(o);
3924
+ const a = i.getElement();
3925
+ return n.appendChild(a), o.addEventListener("mouseenter", () => i.show()), o.addEventListener("mouseleave", () => i.hide()), o.addEventListener("mousemove", (l) => {
3926
+ i.updatePosition(l, o), e.onMouseMove && e.onMouseMove(l);
3927
+ }), t.forEach((l) => {
3928
+ const r = Oe(l, {
3929
+ onDelete: e.onDelete,
3930
+ onDragStart: e.onDragStart
3931
+ });
3932
+ n.appendChild(r);
3933
+ }), s.appendChild(n), {
3934
+ container: s,
3935
+ imageElement: o
3936
+ };
3937
+ }
3938
+ function Ue(c, t) {
3939
+ const e = document.createElement("div");
3940
+ e.className = "image-map-backdrop", e.style.display = "none";
3941
+ const i = document.createElement("div");
3942
+ i.className = "image-map-popover", i.style.display = "none";
3943
+ const s = document.createElement("div");
3944
+ s.className = "image-map-header", s.style.cursor = "move";
3945
+ const n = document.createElement("h3");
3946
+ n.className = "image-map-title", n.textContent = "Prize Map", s.appendChild(n);
3947
+ const o = document.createElement("button");
3948
+ o.type = "button", o.className = "image-map-close-btn", o.innerHTML = he, o.addEventListener("click", () => void c()), s.appendChild(o), dt(s, i, (l, r) => {
3949
+ t(l, r);
3950
+ }), i.appendChild(s);
3951
+ const a = document.createElement("div");
3952
+ return a.className = "image-map-content", i.appendChild(a), document.body.appendChild(e), document.body.appendChild(i), { backdrop: e, popover: i, content: a };
3953
+ }
3954
+ function ze(c, t) {
3955
+ const e = t.getBoundingClientRect(), i = xe, s = Math.min(window.innerHeight * Le, ke);
3956
+ let n = e.right + 8, o = e.top;
3957
+ const a = window.innerWidth - e.right;
3958
+ return a < i + 16 && e.left > a + 100 && (n = e.left - i - 8), n = Math.max(8, Math.min(n, window.innerWidth - i - 8)), o = Math.max(8, Math.min(o, window.innerHeight - s - 8)), c.style.left = `${n}px`, c.style.top = `${o}px`, { left: n, top: o };
3959
+ }
3960
+ function We(c, t, e) {
3961
+ const i = document.createElement("div");
3962
+ i.className = "bottom-buttons";
3963
+ const s = document.createElement("button");
3964
+ s.type = "button", s.className = "clear-all-btn", s.innerHTML = Ce + "<span>Remove All</span>", s.addEventListener("click", t), i.appendChild(s);
3965
+ const n = document.createElement("div");
3966
+ n.className = "done-btn-wrapper";
3967
+ const o = document.createElement("button");
3968
+ if (o.type = "button", o.className = "done-btn", o.textContent = "Done", c || (o.disabled = !0, n.classList.add("has-tooltip")), o.addEventListener("click", () => {
3969
+ c && e();
3970
+ }), n.appendChild(o), !c) {
3971
+ const a = document.createElement("div");
3972
+ a.className = "done-btn-tooltip";
3973
+ const l = document.createElement("div");
3974
+ l.className = "done-btn-tooltip-content", l.textContent = "Map all prizes";
3975
+ const r = document.createElement("div");
3976
+ r.className = "done-btn-tooltip-tail", r.innerHTML = ye, a.appendChild(l), a.appendChild(r), n.appendChild(a);
3977
+ }
3978
+ return i.appendChild(n), i;
3979
+ }
3980
+ const A = class A extends w {
3477
3981
  constructor(t = {}) {
3478
3982
  var e;
3479
3983
  super(t), this.inputType = {
3480
3984
  imageUrl: "text",
3481
3985
  markers: "text"
3482
- }, this.mainButton = null, this.thumbnailEl = null, this.markerCountEl = null, this.mapIconEl = null, this.popoverEl = null, this.backdropEl = null, this.imageElement = null, this.cursorTooltip = null, this.popoverPosition = null, this.isPopoverOpen = !1, this.confirmOverlayEl = null, this.confirmPromise = null, this.lastImageNaturalSize = null, this.draggingMarkerId = null, this.history = [], this.historyIndex = -1, this.isUndoRedoOperation = !1, this.initialValue = null, this.messageListener = null, this.props.maxMarkers = this.props.maxMarkers ?? ((e = this.props.prizeMap) == null ? void 0 : e.length) ?? 10, this.props.maxFileSizeMB = this.props.maxFileSizeMB ?? 5e3, this.props.markerSize = this.props.markerSize ?? 24, this.value || (this.value = { imageUrl: "", markers: [] }), this.setupMessageListener(), this.onBackgroundClick = (i) => {
3483
- if (this.isPopoverOpen && this.popoverEl && !this.popoverEl.contains(i.target)) {
3986
+ }, this.mainDisplayElements = null, this.popoverElements = null, this.imageElement = null, this.cursorTooltip = null, this.popoverPosition = null, this.isPopoverOpen = !1, this.confirmModal = new Ne(), this.previousImageDimensions = null, this.draggingMarkerId = null, this.historyManager = new Ve(), this.isUndoRedoOperation = !1, this.initialValue = null, this.lastMouseX = 0, this.lastMouseY = 0, this.props.maxMarkers = this.props.maxMarkers ?? ((e = this.props.prizeMap) == null ? void 0 : e.length) ?? G, this.props.maxFileSizeMB = this.props.maxFileSizeMB ?? bt, this.props.markerSize = this.props.markerSize ?? Ee, this.value || (this.value = { imageUrl: "", markers: [] }), Lt.registerHandler(this.id, (i) => {
3987
+ this.handleFileManagerImageSelected(i);
3988
+ }), this.onBackgroundClick = (i) => {
3989
+ if (this.isPopoverOpen && this.popoverElements && !this.popoverElements.popover.contains(i.target)) {
3484
3990
  if (i.target.closest(
3485
3991
  '[class*="modal"], [class*="Modal"], [class*="dialog"], [class*="Dialog"], [class*="overlay"], [class*="Overlay"]'
3486
3992
  ))
@@ -3489,53 +3995,19 @@ const gt = `
3489
3995
  }
3490
3996
  }, this.handlePopoverKeydown = (i) => {
3491
3997
  this.isPopoverOpen && (i.key === "Escape" ? this.closePopover() : (i.ctrlKey || i.metaKey) && (i.key === "z" || i.key === "Z" ? i.shiftKey ? (i.preventDefault(), this.redo()) : (i.preventDefault(), this.undo()) : (i.key === "y" || i.key === "Y") && (i.preventDefault(), this.redo())));
3492
- }, this.boundHandleMarkerDrag = this.handleMarkerDrag.bind(this), this.boundStopDragging = this.stopDragging.bind(this);
3493
- }
3494
- setupMessageListener() {
3495
- this.messageListener = (t) => {
3496
- if (t.data && t.data.type === "FILE_MANAGER_IMAGE_SELECTED" && t.data.settingId === this.id) {
3497
- const e = t.data.imageUrl;
3498
- if (e && typeof e == "string") {
3499
- const i = this.lastImageNaturalSize, s = new Image();
3500
- s.onload = () => {
3501
- var a;
3502
- const n = {
3503
- width: s.naturalWidth || 0,
3504
- height: s.naturalHeight || 0
3505
- }, o = this.scaleMarkersForNewImage(
3506
- ((a = this.value) == null ? void 0 : a.markers) || [],
3507
- i,
3508
- n
3509
- );
3510
- this.value = {
3511
- imageUrl: e,
3512
- markers: o
3513
- }, this.lastImageNaturalSize = n, this.history = [
3514
- JSON.parse(
3515
- JSON.stringify(o)
3516
- )
3517
- ], this.historyIndex = 0, this.updateUndoRedoButtons(), this.updateMainDisplay(), this.isPopoverOpen && this.refreshPopoverContent(), this.triggerChange();
3518
- }, s.onerror = () => {
3519
- this.showError("Failed to load image from file manager.");
3520
- }, s.src = e;
3521
- }
3522
- }
3523
- }, window.addEventListener("message", this.messageListener);
3524
- }
3525
- cleanupMessageListener() {
3526
- this.messageListener && (window.removeEventListener("message", this.messageListener), this.messageListener = null);
3998
+ }, this.boundHandleMarkerDrag = this.handleMarkerDrag.bind(this), this.boundStopDragging = this.stopDragging.bind(this), this.boundHandleScroll = this.handleScroll.bind(this);
3527
3999
  }
3528
4000
  draw() {
3529
4001
  const t = document.createElement("div");
3530
4002
  if (t.className = "image-map-setting-wrapper", this.props.title || this.props.icon) {
3531
4003
  const h = document.createElement("div");
3532
4004
  if (h.className = "icon-container", this.props.icon) {
3533
- const p = this.createIcon(this.props.icon);
3534
- h.appendChild(p);
4005
+ const d = this.createIcon(this.props.icon);
4006
+ h.appendChild(d);
3535
4007
  }
3536
4008
  if (this.props.title) {
3537
- const p = this.createLabel(this.props.title);
3538
- h.appendChild(p);
4009
+ const d = this.createLabel(this.props.title);
4010
+ h.appendChild(d);
3539
4011
  }
3540
4012
  t.appendChild(h);
3541
4013
  }
@@ -3544,68 +4016,44 @@ const gt = `
3544
4016
  const i = document.createElement("div");
3545
4017
  i.className = "image-map-section";
3546
4018
  const s = document.createElement("h4");
3547
- s.className = "image-map-section-title", s.textContent = "Upload/Replace Map Image", i.appendChild(s);
3548
- const n = document.createElement("div");
3549
- n.className = "image-map-upload-box";
3550
- const o = document.createElement("div");
3551
- o.className = "image-map-thumbnail-wrapper", this.thumbnailEl = document.createElement("img"), this.thumbnailEl.className = "image-map-thumbnail-main", o.appendChild(this.thumbnailEl);
3552
- const a = document.createElement("button");
3553
- a.type = "button", a.className = "image-map-delete-btn", a.innerHTML = ie, a.addEventListener("click", (h) => {
3554
- h.stopPropagation(), this.value = { imageUrl: "", markers: [] }, this.updateMainDisplay(), this.triggerChange();
3555
- }), o.appendChild(a), n.appendChild(o);
3556
- const l = document.createElement("button");
3557
- l.type = "button", l.className = "image-map-upload-label", l.innerHTML = `
3558
- <div class="upload-icon upload-icon-default">${gt}</div>
3559
- <div class="upload-icon upload-icon-replace">${Qt}</div>
3560
- <span class="upload-text">Upload Image</span>
3561
- `, l.addEventListener("click", () => {
3562
- window.postMessage(
3563
- {
3564
- type: "OPEN_FILE_MANAGER_MODAL",
3565
- settingId: this.id
3566
- },
3567
- "*"
3568
- );
3569
- }), n.appendChild(l), i.appendChild(n), e.appendChild(i);
3570
- const r = document.createElement("div");
3571
- r.className = "image-map-section";
3572
- const c = document.createElement("h4");
3573
- return c.className = "image-map-section-title", c.textContent = "Map Setup", r.appendChild(c), this.mainButton = document.createElement("button"), this.mainButton.type = "button", this.mainButton.className = "image-map-button", this.mapIconEl = document.createElement("span"), this.mapIconEl.className = "image-map-icon", this.mapIconEl.innerHTML = mt, this.mainButton.appendChild(this.mapIconEl), this.markerCountEl = document.createElement("span"), this.markerCountEl.className = "image-map-marker-count", this.mainButton.appendChild(this.markerCountEl), this.mainButton.addEventListener("click", () => {
4019
+ s.className = "image-map-section-title", s.textContent = "Upload/Replace Map Image", i.appendChild(s), this.mainDisplayElements = De();
4020
+ const n = Re(
4021
+ this.mainDisplayElements.thumbnailEl,
4022
+ () => {
4023
+ this.value = { imageUrl: "", markers: [] }, this.mainDisplayElements && O(this.mainDisplayElements, this.value), this.triggerChange();
4024
+ }
4025
+ ), o = this.props.upload || "file-manager", a = Fe(
4026
+ o,
4027
+ (h) => this.handleImageUpload(h),
4028
+ this.id
4029
+ );
4030
+ n.appendChild(a), i.appendChild(n), e.appendChild(i);
4031
+ const l = document.createElement("div");
4032
+ l.className = "image-map-section";
4033
+ const r = document.createElement("h4");
4034
+ return r.className = "image-map-section-title", r.textContent = "Map Setup", l.appendChild(r), this.mainDisplayElements.configureButton.addEventListener("click", () => {
3574
4035
  var h;
3575
- (h = this.mainButton) != null && h.disabled || this.openPopover();
3576
- }), r.appendChild(this.mainButton), e.appendChild(r), t.appendChild(e), this.createPopover(), this.updateMainDisplay(), t;
3577
- }
3578
- updateMainDisplay() {
3579
- var s;
3580
- if (!this.thumbnailEl || !this.markerCountEl) return;
3581
- const t = this.value && this.value.imageUrl && this.value.imageUrl !== "", e = this.thumbnailEl.parentElement, i = e == null ? void 0 : e.parentElement;
3582
- i && (t ? (i.classList.add("has-image"), this.thumbnailEl.src = this.value.imageUrl) : (i.classList.remove("has-image"), this.thumbnailEl.src = "")), (s = this.value) != null && s.markers.length, this.markerCountEl.textContent = "Configure Map", this.mainButton && (this.mainButton.disabled = !t);
3583
- }
3584
- createPopover() {
3585
- this.backdropEl = document.createElement("div"), this.backdropEl.className = "image-map-backdrop", this.backdropEl.style.display = "none", this.popoverEl = document.createElement("div"), this.popoverEl.className = "image-map-popover", this.popoverEl.style.display = "none";
3586
- const t = document.createElement("div");
3587
- t.className = "image-map-header", t.style.cursor = "move";
3588
- const e = document.createElement("h3");
3589
- e.className = "image-map-title", e.textContent = "Prize Map", t.appendChild(e);
3590
- const i = document.createElement("button");
3591
- i.type = "button", i.className = "image-map-close-btn", i.innerHTML = te, i.addEventListener("click", () => void this.closePopover()), t.appendChild(i), ot(t, this.popoverEl, (n, o) => {
3592
- this.popoverPosition = { left: n, top: o };
3593
- }), this.popoverEl.appendChild(t);
3594
- const s = document.createElement("div");
3595
- s.className = "image-map-content", this.popoverEl.appendChild(s), document.body.appendChild(this.backdropEl), document.body.appendChild(this.popoverEl);
4036
+ (h = this.mainDisplayElements) != null && h.configureButton.disabled || this.openPopover();
4037
+ }), l.appendChild(this.mainDisplayElements.configureButton), e.appendChild(l), t.appendChild(e), this.createPopoverElements(), O(this.mainDisplayElements, this.value), t;
4038
+ }
4039
+ createPopoverElements() {
4040
+ this.popoverElements = Ue(
4041
+ () => void this.closePopover(),
4042
+ (t, e) => {
4043
+ this.popoverPosition = { left: t, top: e };
4044
+ }
4045
+ );
3596
4046
  }
3597
4047
  openPopover() {
3598
- $.openInstance && $.openInstance !== this && $.openInstance.closePopover(), this.isPopoverOpen = !0, $.openInstance = this, this.value ? this.initialValue = JSON.parse(
4048
+ A.openInstance && A.openInstance !== this && A.openInstance.closePopover(), this.isPopoverOpen = !0, A.openInstance = this, this.value ? this.initialValue = JSON.parse(
3599
4049
  JSON.stringify(this.value)
3600
- ) : this.initialValue = { imageUrl: "", markers: [] }, this.value && (this.history = [
3601
- JSON.parse(JSON.stringify(this.value.markers))
3602
- ], this.historyIndex = 0), this.backdropEl && (this.backdropEl.style.display = "block"), this.popoverEl && (this.popoverEl.style.display = "flex"), this.positionPopover(), this.refreshPopoverContentAndScrollToBottom(), setTimeout(() => {
4050
+ ) : this.initialValue = { imageUrl: "", markers: [] }, this.value && this.historyManager.initialize(this.value.markers), this.popoverElements && (this.popoverElements.backdrop.style.display = "block", this.popoverElements.popover.style.display = "flex"), this.positionPopoverElement(), this.refreshPopoverContentAndScrollToBottom(), setTimeout(() => {
3603
4051
  document.addEventListener("click", this.onBackgroundClick, !0);
3604
4052
  }, 200), document.addEventListener("keydown", this.handlePopoverKeydown, !0);
3605
4053
  }
3606
4054
  hasAllMarkers() {
3607
4055
  if (!this.value) return !1;
3608
- const t = this.props.maxMarkers || 10;
4056
+ const t = this.props.maxMarkers || G;
3609
4057
  return this.value.markers.length === t;
3610
4058
  }
3611
4059
  hasChanges() {
@@ -3614,55 +4062,100 @@ const gt = `
3614
4062
  async closePopover(t = !1) {
3615
4063
  if (!(!this.isPopoverOpen && !t)) {
3616
4064
  if (!t && this.hasChanges() && !this.hasAllMarkers()) {
3617
- if (!await this.showConfirmModal(
3618
- "Discard changes?",
3619
- "You haven't placed all markers. Closing will discard your changes."
3620
- ))
4065
+ if (!await this.confirmModal.show({
4066
+ title: "Discard changes?",
4067
+ description: "You haven't placed all markers. Closing will discard your changes."
4068
+ }))
3621
4069
  return;
3622
4070
  this.initialValue && (this.value = JSON.parse(
3623
4071
  JSON.stringify(this.initialValue)
3624
- ), this.updateMainDisplay(), this.triggerChange());
4072
+ ), this.mainDisplayElements && O(this.mainDisplayElements, this.value), this.triggerChange());
3625
4073
  }
3626
- this.isPopoverOpen = !1, this.draggingMarkerId = null, this.backdropEl && (this.backdropEl.style.display = "none"), this.popoverEl && (this.popoverEl.style.display = "none"), document.removeEventListener("click", this.onBackgroundClick, !0), document.removeEventListener("keydown", this.handlePopoverKeydown, !0), $.openInstance === this && ($.openInstance = null);
4074
+ this.isPopoverOpen = !1, this.draggingMarkerId = null, this.popoverElements && (this.popoverElements.backdrop.style.display = "none", this.popoverElements.popover.style.display = "none"), document.removeEventListener("click", this.onBackgroundClick, !0), document.removeEventListener("keydown", this.handlePopoverKeydown, !0), A.openInstance === this && (A.openInstance = null);
3627
4075
  }
3628
4076
  }
3629
- positionPopover() {
3630
- if (!this.popoverEl || !this.mainButton) return;
3631
- const t = this.mainButton.getBoundingClientRect(), e = 800, i = Math.min(window.innerHeight * 0.8, 700);
3632
- let s = t.right + 8, n = t.top;
3633
- const o = window.innerWidth - t.right;
3634
- o < e + 16 && t.left > o + 100 && (s = t.left - e - 8), s = Math.max(8, Math.min(s, window.innerWidth - e - 8)), n = Math.max(8, Math.min(n, window.innerHeight - i - 8)), this.popoverEl.style.left = `${s}px`, this.popoverEl.style.top = `${n}px`, this.popoverPosition = { left: s, top: n };
4077
+ positionPopoverElement() {
4078
+ !this.popoverElements || !this.mainDisplayElements || (this.popoverPosition = ze(
4079
+ this.popoverElements.popover,
4080
+ this.mainDisplayElements.configureButton
4081
+ ));
3635
4082
  }
3636
4083
  refreshPopoverContent() {
3637
- if (!this.popoverEl) return;
3638
- const t = this.popoverEl.querySelector(
3639
- ".image-map-content"
3640
- );
3641
- if (!t) return;
3642
- const e = t.querySelector(
4084
+ var a;
4085
+ if (!this.popoverElements) return;
4086
+ const t = this.popoverElements.content, e = t.querySelector(
3643
4087
  ".image-map-container"
3644
4088
  ), i = t.querySelector(
3645
4089
  ".simple-prize-list"
3646
4090
  ), s = (e == null ? void 0 : e.scrollTop) || 0, n = (i == null ? void 0 : i.scrollTop) || 0;
3647
4091
  if (t.innerHTML = "", this.value && this.value.imageUrl && this.value.imageUrl !== "") {
3648
- const a = this.renderControlsRow();
3649
- t.appendChild(a);
3650
- const l = document.createElement("div");
3651
- l.className = "image-map-main-layout";
4092
+ const l = $e(
4093
+ {
4094
+ canUndo: this.historyManager.canUndo(),
4095
+ canRedo: this.historyManager.canRedo(),
4096
+ markerCount: ((a = this.value) == null ? void 0 : a.markers.length) || 0,
4097
+ maxMarkers: this.props.maxMarkers || G
4098
+ },
4099
+ {
4100
+ onUndo: () => this.undo(),
4101
+ onRedo: () => this.redo()
4102
+ }
4103
+ );
4104
+ t.appendChild(l);
3652
4105
  const r = document.createElement("div");
3653
- r.className = "image-map-image-section", this.renderImageMapSection(r);
3654
- const c = document.createElement("div");
3655
- c.className = "prize-list-section", this.renderPrizeList(c), l.appendChild(r), l.appendChild(c), t.appendChild(l);
3656
- const h = this.renderBottomButtons();
3657
- t.appendChild(h);
3658
- const p = r.querySelector(
4106
+ r.className = "image-map-main-layout";
4107
+ const h = document.createElement("div");
4108
+ h.className = "image-map-image-section", this.cursorTooltip = new Pe();
4109
+ const { container: d, imageElement: p } = Ge(
4110
+ this.value.imageUrl,
4111
+ this.value.markers,
4112
+ {
4113
+ onImageClick: (v) => this.handleImageClick(v),
4114
+ onMarkerDrag: this.boundHandleMarkerDrag,
4115
+ onStopDragging: this.boundStopDragging,
4116
+ onImageLoad: () => this.recordImageNaturalSize(),
4117
+ onDelete: (v) => this.handleDeleteMarker(v),
4118
+ onDragStart: (v) => {
4119
+ this.draggingMarkerId = v;
4120
+ },
4121
+ onScroll: this.boundHandleScroll,
4122
+ onMouseMove: (v) => this.trackMousePosition(v)
4123
+ },
4124
+ this.cursorTooltip
4125
+ );
4126
+ this.imageElement = p, h.appendChild(d);
4127
+ const m = document.createElement("div");
4128
+ m.className = "prize-list-section";
4129
+ const C = He(
4130
+ this.value.markers,
4131
+ this.props.maxMarkers || G,
4132
+ this.props.prizeMap
4133
+ );
4134
+ m.appendChild(C), r.appendChild(h), r.appendChild(m), t.appendChild(r);
4135
+ const g = We(
4136
+ this.hasAllMarkers(),
4137
+ () => this.handleClearAllMarkers(),
4138
+ () => {
4139
+ this.triggerChange(), this.closePopover(!0);
4140
+ }
4141
+ );
4142
+ t.appendChild(g);
4143
+ const u = h.querySelector(
3659
4144
  ".image-map-container"
3660
- ), g = c.querySelector(
4145
+ ), f = m.querySelector(
3661
4146
  ".simple-prize-list"
3662
4147
  );
3663
- p && (p.scrollTop = s), g && (g.scrollTop = n);
3664
- } else
3665
- this.renderUploadSection(t);
4148
+ u && (u.scrollTop = s), f && (f.scrollTop = n), this.updateCursorTooltipContent();
4149
+ } else {
4150
+ const l = Be({
4151
+ uploadMethod: this.props.upload || "file-manager",
4152
+ settingId: this.id,
4153
+ onFileSelected: (r) => this.handleImageUpload(r),
4154
+ includeTitle: !0,
4155
+ variant: "popover"
4156
+ });
4157
+ t.appendChild(l);
4158
+ }
3666
4159
  }
3667
4160
  refreshPopoverContentAndScrollToBottom() {
3668
4161
  this.refreshPopoverContent(), requestAnimationFrame(() => {
@@ -3670,372 +4163,164 @@ const gt = `
3670
4163
  });
3671
4164
  }
3672
4165
  scrollPrizeListToBottom() {
3673
- if (!this.popoverEl) return;
3674
- const t = this.popoverEl.querySelector(
4166
+ if (!this.popoverElements) return;
4167
+ const t = this.popoverElements.popover.querySelector(
3675
4168
  ".simple-prize-list"
3676
4169
  );
3677
4170
  t && requestAnimationFrame(() => {
3678
4171
  t.scrollTop = t.scrollHeight;
3679
4172
  });
3680
4173
  }
3681
- renderUploadSection(t) {
3682
- const e = document.createElement("div");
3683
- e.className = "upload-section-wrapper";
3684
- const i = document.createElement("h4");
3685
- i.className = "upload-section-title", i.textContent = "Upload/Replace Map Image", e.appendChild(i);
3686
- const s = document.createElement("div");
3687
- s.className = "upload-section";
3688
- const n = document.createElement("label");
3689
- n.className = "upload-label", n.innerHTML = `
3690
- <div class="upload-placeholder">
3691
- ${gt}
3692
- <span>Click to upload image</span>
3693
- </div>
3694
- `;
3695
- const o = document.createElement("input");
3696
- o.type = "file", o.accept = "image/jpeg,image/jpg,image/png,image/gif,image/webp", o.style.display = "none", o.addEventListener("change", (c) => {
3697
- var p;
3698
- const h = (p = c.target.files) == null ? void 0 : p[0];
3699
- h && this.handleImageUpload(h);
3700
- }), n.appendChild(o), s.appendChild(n), e.appendChild(s);
3701
- const a = document.createElement("h4");
3702
- a.className = "upload-section-title", a.textContent = "Map Setup", e.appendChild(a);
3703
- const l = document.createElement("div");
3704
- l.className = "upload-section";
3705
- const r = document.createElement("button");
3706
- r.type = "button", r.className = "upload-label map-config-btn", r.innerHTML = `
3707
- <div class="upload-placeholder">
3708
- ${mt}
3709
- <span>Configure Map</span>
3710
- </div>
3711
- `, r.addEventListener("click", () => {
3712
- window.postMessage(
3713
- {
3714
- type: "OPEN_FILE_MANAGER_MODAL",
3715
- settingId: this.id
3716
- },
3717
- "*"
4174
+ handleFileManagerImageSelected(t) {
4175
+ const e = this.previousImageDimensions, i = new Image();
4176
+ i.onload = () => {
4177
+ var o;
4178
+ const s = {
4179
+ width: i.naturalWidth || 0,
4180
+ height: i.naturalHeight || 0
4181
+ }, n = wt(
4182
+ ((o = this.value) == null ? void 0 : o.markers) || [],
4183
+ e,
4184
+ s
3718
4185
  );
3719
- }), l.appendChild(r), e.appendChild(l), t.appendChild(e);
3720
- }
3721
- renderControlsRow() {
3722
- var c;
3723
- const t = document.createElement("div");
3724
- t.className = "controls-row";
3725
- const e = document.createElement("div");
3726
- e.className = "place-prize-text", e.textContent = "Place Prize", t.appendChild(e);
3727
- const i = document.createElement("div");
3728
- i.className = "undo-redo-group";
3729
- const s = document.createElement("button");
3730
- s.type = "button", s.className = "undo-btn action-btn", s.innerHTML = se, s.title = "Undo (Ctrl+Z)", s.disabled = !this.canUndo(), s.addEventListener("click", () => this.undo()), i.appendChild(s);
3731
- const n = document.createElement("button");
3732
- n.type = "button", n.className = "redo-btn action-btn", n.innerHTML = ne, n.title = "Redo (Ctrl+Y)", n.disabled = !this.canRedo(), n.addEventListener("click", () => this.redo()), i.appendChild(n), t.appendChild(i);
3733
- const o = this.props.maxMarkers || 10, a = ((c = this.value) == null ? void 0 : c.markers.length) || 0, l = a === o, r = document.createElement("div");
3734
- return r.className = "prize-counter-inline", r.textContent = `${a}/${o}`, l && r.classList.add("complete"), t.appendChild(r), t;
3735
- }
3736
- renderImageMapSection(t) {
3737
- const e = document.createElement("div");
3738
- e.className = "image-map-container";
3739
- const i = document.createElement("div");
3740
- i.className = "image-map-wrapper", i.addEventListener("mousemove", this.boundHandleMarkerDrag), i.addEventListener("mouseup", this.boundStopDragging), i.addEventListener("mouseleave", this.boundStopDragging), this.imageElement = document.createElement("img"), this.imageElement.className = "image-map-image", this.imageElement.src = this.value.imageUrl, this.imageElement.addEventListener(
3741
- "load",
3742
- () => this.recordImageNaturalSize()
3743
- ), this.imageElement.addEventListener(
3744
- "click",
3745
- (s) => this.handleImageClick(s)
3746
- ), i.appendChild(this.imageElement), this.cursorTooltip = document.createElement("div"), this.cursorTooltip.className = "marker-cursor-tooltip", i.appendChild(this.cursorTooltip), this.imageElement.addEventListener(
3747
- "mouseenter",
3748
- () => this.showCursorTooltip()
3749
- ), this.imageElement.addEventListener(
3750
- "mouseleave",
3751
- () => this.hideCursorTooltip()
3752
- ), this.imageElement.addEventListener(
3753
- "mousemove",
3754
- (s) => this.updateCursorTooltip(s)
3755
- ), this.value && this.value.markers && this.value.markers.forEach((s) => {
3756
- const n = this.createMarkerElement(s);
3757
- i.appendChild(n);
3758
- }), e.appendChild(i), t.appendChild(e);
3759
- }
3760
- renderBottomButtons() {
3761
- var l;
3762
- const t = this.props.maxMarkers || 10, i = (((l = this.value) == null ? void 0 : l.markers.length) || 0) === t, s = document.createElement("div");
3763
- s.className = "bottom-buttons";
3764
- const n = document.createElement("button");
3765
- n.type = "button", n.className = "clear-all-btn", n.innerHTML = le + "<span>Remove All</span>", n.addEventListener("click", () => this.handleClearAllMarkers()), s.appendChild(n);
3766
- const o = document.createElement("div");
3767
- o.className = "done-btn-wrapper";
3768
- const a = document.createElement("button");
3769
- if (a.type = "button", a.className = "done-btn", a.textContent = "Done", i || (a.disabled = !0, o.classList.add("has-tooltip")), a.addEventListener("click", () => {
3770
- i && (this.triggerChange(), this.closePopover(!0));
3771
- }), o.appendChild(a), !i) {
3772
- const r = document.createElement("div");
3773
- r.className = "done-btn-tooltip";
3774
- const c = document.createElement("div");
3775
- c.className = "done-btn-tooltip-content", c.textContent = "Map all prizes";
3776
- const h = document.createElement("div");
3777
- h.className = "done-btn-tooltip-tail", h.innerHTML = re, r.appendChild(c), r.appendChild(h), o.appendChild(r);
3778
- }
3779
- return s.appendChild(o), s;
3780
- }
3781
- renderPrizeList(t) {
3782
- var o;
3783
- const e = this.props.maxMarkers || 10, i = ((o = this.value) == null ? void 0 : o.markers) || [], s = /* @__PURE__ */ new Map();
3784
- i.forEach((a) => s.set(a.index, a));
3785
- const n = document.createElement("div");
3786
- n.className = "simple-prize-list";
3787
- for (let a = e; a >= 1; a--) {
3788
- const l = s.get(a), r = !!l, c = (l == null ? void 0 : l.prizeName) || this.props.prizeMap && this.props.prizeMap[a - 1] || "Prize Name", h = document.createElement("div");
3789
- h.className = `simple-prize-item ${r ? "placed" : ""}`;
3790
- const p = document.createElement("div");
3791
- p.className = "simple-prize-number", p.textContent = `#${a}`, h.appendChild(p);
3792
- const g = document.createElement("div");
3793
- if (g.className = "simple-prize-text", g.textContent = `${c}`, h.appendChild(g), r) {
3794
- const C = document.createElement("div");
3795
- C.className = "simple-prize-check", C.innerHTML = oe, h.appendChild(C);
3796
- }
3797
- n.appendChild(h);
3798
- }
3799
- t.appendChild(n);
3800
- }
3801
- createMarkerElement(t) {
3802
- const e = document.createElement("div");
3803
- e.className = "marker-container", e.style.left = `${t.x}%`, e.style.top = `${t.y}%`, e.setAttribute("data-marker-id", String(t.id));
3804
- const i = document.createElement("div");
3805
- i.className = "image-map-marker", i.innerHTML = ae;
3806
- const s = document.createElement("span");
3807
- s.className = "marker-number", s.textContent = String(t.index), i.appendChild(s), e.appendChild(i);
3808
- const n = document.createElement("button");
3809
- return n.type = "button", n.className = "marker-delete-btn", n.innerHTML = ee, n.addEventListener("click", (o) => {
3810
- o.stopPropagation(), this.handleDeleteMarker(t.id);
3811
- }), e.appendChild(n), e.addEventListener("mousedown", (o) => {
3812
- o.stopPropagation(), o.preventDefault(), this.draggingMarkerId = t.id, e.classList.add("dragging");
3813
- }), e;
4186
+ this.value = {
4187
+ imageUrl: t,
4188
+ markers: n
4189
+ }, this.previousImageDimensions = s, this.historyManager.initialize(n), this.updateUndoRedoButtons(), this.mainDisplayElements && O(this.mainDisplayElements, this.value), this.isPopoverOpen && this.refreshPopoverContent(), this.triggerChange();
4190
+ }, i.onerror = () => {
4191
+ U.show("Failed to load image from file manager.");
4192
+ }, i.src = t;
3814
4193
  }
3815
4194
  handleImageUpload(t) {
3816
- const e = this.lastImageNaturalSize;
3817
- if (![
3818
- "image/jpeg",
3819
- "image/jpg",
3820
- "image/png",
3821
- "image/gif",
3822
- "image/webp"
3823
- ].includes(t.type)) {
3824
- this.showError(
3825
- "Invalid file type. Please upload a JPEG, PNG, GIF, or WebP image."
3826
- );
3827
- return;
3828
- }
3829
- const s = (this.props.maxFileSizeMB || 5) * 1024 * 1024;
3830
- if (t.size > s) {
3831
- const o = (t.size / 1048576).toFixed(1);
3832
- this.showError(
3833
- `File size (${o}MB) exceeds ${this.props.maxFileSizeMB}MB limit.`
3834
- );
4195
+ const e = this.previousImageDimensions, i = Se(
4196
+ t,
4197
+ this.props.maxFileSizeMB || bt
4198
+ );
4199
+ if (!i.valid) {
4200
+ U.show(i.error);
3835
4201
  return;
3836
4202
  }
3837
- const n = new FileReader();
3838
- n.onload = (o) => {
3839
- var l;
3840
- const a = (l = o.target) == null ? void 0 : l.result;
3841
- if (typeof a == "string") {
3842
- const r = new Image();
3843
- r.onload = () => {
3844
- var p;
3845
- const c = {
3846
- width: r.naturalWidth || 0,
3847
- height: r.naturalHeight || 0
3848
- }, h = this.scaleMarkersForNewImage(
3849
- ((p = this.value) == null ? void 0 : p.markers) || [],
4203
+ const s = new FileReader();
4204
+ s.onload = (n) => {
4205
+ var a;
4206
+ const o = (a = n.target) == null ? void 0 : a.result;
4207
+ if (typeof o == "string") {
4208
+ const l = new Image();
4209
+ l.onload = () => {
4210
+ var d;
4211
+ const r = {
4212
+ width: l.naturalWidth || 0,
4213
+ height: l.naturalHeight || 0
4214
+ }, h = wt(
4215
+ ((d = this.value) == null ? void 0 : d.markers) || [],
3850
4216
  e,
3851
- c
4217
+ r
3852
4218
  );
3853
4219
  this.value = {
3854
- imageUrl: a,
4220
+ imageUrl: o,
3855
4221
  markers: h
3856
- }, this.lastImageNaturalSize = c, this.history = [
3857
- JSON.parse(JSON.stringify(h))
3858
- ], this.historyIndex = 0, this.updateUndoRedoButtons(), this.updateMainDisplay(), this.isPopoverOpen && this.refreshPopoverContent(), this.triggerChange();
3859
- }, r.onerror = () => {
3860
- this.showError("Failed to read image file.");
3861
- }, r.src = a;
4222
+ }, this.previousImageDimensions = r, this.historyManager.initialize(h), this.updateUndoRedoButtons(), this.mainDisplayElements && O(this.mainDisplayElements, this.value), this.isPopoverOpen && this.refreshPopoverContent(), this.triggerChange();
4223
+ }, l.onerror = () => {
4224
+ U.show("Failed to read image file.");
4225
+ }, l.src = o;
3862
4226
  }
3863
- }, n.onerror = () => {
3864
- this.showError("Failed to read image file.");
3865
- }, n.readAsDataURL(t);
4227
+ }, s.onerror = () => {
4228
+ U.show("Failed to read image file.");
4229
+ }, s.readAsDataURL(t);
3866
4230
  }
3867
4231
  handleImageClick(t) {
3868
4232
  if (this.draggingMarkerId !== null || !this.value || !this.imageElement) return;
3869
- if (this.value.markers.length >= (this.props.maxMarkers || 10)) {
3870
- this.showError(
3871
- `Maximum of ${this.props.maxMarkers || 10} markers allowed.`
4233
+ if (this.value.markers.length >= (this.props.maxMarkers || G)) {
4234
+ U.show(
4235
+ `Maximum of ${this.props.maxMarkers || G} markers allowed.`
3872
4236
  );
3873
4237
  return;
3874
4238
  }
3875
- 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);
3876
- let o = 1;
3877
- for (const c of n)
3878
- if (c === o)
3879
- o++;
3880
- else
3881
- break;
3882
- let a;
3883
- this.props.prizeMap && this.props.prizeMap.length > 0 && (a = this.props.prizeMap[o - 1]);
3884
- const l = {
4239
+ const e = this.imageElement.getBoundingClientRect(), { x: i, y: s } = xt(t.clientX, t.clientY, e), n = Tt(this.value.markers);
4240
+ let o;
4241
+ this.props.prizeMap && this.props.prizeMap.length > 0 && (o = this.props.prizeMap[n - 1]);
4242
+ const a = {
3885
4243
  id: Date.now(),
3886
- index: o,
3887
- x: Math.min(100, Math.max(0, i)),
3888
- y: Math.min(100, Math.max(0, s)),
3889
- prizeName: a
3890
- }, r = [...this.value.markers, l];
3891
- this.setMarkers(r), this.saveState(), this.refreshPopoverContent(), this.updateMainDisplay(), this.triggerChange();
4244
+ index: n,
4245
+ x: i,
4246
+ y: s,
4247
+ prizeName: o
4248
+ }, l = [...this.value.markers, a];
4249
+ this.setMarkers(l), this.saveState(), this.refreshPopoverContent(), this.mainDisplayElements && O(this.mainDisplayElements, this.value), this.triggerChange();
3892
4250
  }
3893
4251
  handleMarkerDrag(t) {
3894
- var r;
4252
+ var a;
3895
4253
  if (this.draggingMarkerId === null || !this.imageElement || !this.value)
3896
4254
  return;
3897
- const e = this.imageElement.getBoundingClientRect(), i = (t.clientX - e.left) / e.width * 100, s = (t.clientY - e.top) / e.height * 100, n = Math.min(100, Math.max(0, i)), o = Math.min(100, Math.max(0, s)), a = this.value.markers.map(
3898
- (c) => c.id === this.draggingMarkerId ? { ...c, x: n, y: o } : c
3899
- ), l = (r = this.popoverEl) == null ? void 0 : r.querySelector(
4255
+ const e = this.imageElement.getBoundingClientRect(), { x: i, y: s } = xt(t.clientX, t.clientY, e), n = this.value.markers.map(
4256
+ (l) => l.id === this.draggingMarkerId ? { ...l, x: i, y: s } : l
4257
+ ), o = (a = this.popoverElements) == null ? void 0 : a.popover.querySelector(
3900
4258
  `[data-marker-id="${this.draggingMarkerId}"]`
3901
4259
  );
3902
- l && (l.style.left = `${n}%`, l.style.top = `${o}%`), this.setMarkers(a);
4260
+ o && (o.style.left = `${i}%`, o.style.top = `${s}%`), this.setMarkers(n);
3903
4261
  }
3904
4262
  stopDragging() {
3905
4263
  var t;
3906
4264
  if (this.draggingMarkerId !== null) {
3907
- const e = (t = this.popoverEl) == null ? void 0 : t.querySelector(
4265
+ const e = (t = this.popoverElements) == null ? void 0 : t.popover.querySelector(
3908
4266
  `[data-marker-id="${this.draggingMarkerId}"]`
3909
4267
  );
3910
4268
  e == null || e.classList.remove("dragging"), this.draggingMarkerId = null, this.saveState(), this.triggerChange();
3911
4269
  }
3912
4270
  }
3913
- handleDeleteMarker(t) {
3914
- if (!this.value || this.value.markers.findIndex((s) => s.id === t) === -1) return;
3915
- const i = this.value.markers.filter((s) => s.id !== t);
3916
- this.setMarkers(i), this.saveState(), this.refreshPopoverContent(), this.updateMainDisplay(), this.triggerChange();
3917
- }
3918
- handleClearAllMarkers() {
3919
- this.value && (this.setMarkers([]), this.saveState(), this.refreshPopoverContent(), this.updateMainDisplay(), this.triggerChange());
3920
- }
3921
- getNextPrizeInfo() {
3922
- if (!this.value) return { index: 1, name: "Prize 1" };
3923
- const t = this.value.markers.map((s) => s.index).sort((s, n) => s - n);
3924
- let e = 1;
3925
- for (const s of t)
3926
- if (s === e)
3927
- e++;
3928
- else
3929
- break;
3930
- let i = `Prize ${e}`;
3931
- if (this.props.prizeMap && this.props.prizeMap.length > 0) {
3932
- const s = this.props.prizeMap[e - 1];
3933
- s && (i = s);
4271
+ handleScroll(t) {
4272
+ if (this.cursorTooltip && this.lastMouseX && this.lastMouseY && this.imageElement) {
4273
+ this.imageElement.getBoundingClientRect();
4274
+ const e = new MouseEvent("mousemove", {
4275
+ clientX: this.lastMouseX,
4276
+ clientY: this.lastMouseY
4277
+ });
4278
+ this.cursorTooltip.updatePosition(e, this.imageElement);
3934
4279
  }
3935
- return { index: e, name: i };
3936
4280
  }
3937
- showCursorTooltip() {
3938
- if (!this.cursorTooltip || !this.value || this.value.markers.length >= (this.props.maxMarkers || 10))
3939
- return;
3940
- const t = this.getNextPrizeInfo();
3941
- this.cursorTooltip.textContent = String(t.index), this.cursorTooltip.classList.add("visible");
3942
- }
3943
- hideCursorTooltip() {
3944
- this.cursorTooltip && this.cursorTooltip.classList.remove("visible");
4281
+ trackMousePosition(t) {
4282
+ this.lastMouseX = t.clientX, this.lastMouseY = t.clientY;
3945
4283
  }
3946
- updateCursorTooltip(t) {
3947
- if (!this.cursorTooltip || !this.imageElement) return;
3948
- const e = this.imageElement.getBoundingClientRect(), i = t.clientX - e.left, s = t.clientY - e.top;
3949
- this.cursorTooltip.style.left = `${i}px`, this.cursorTooltip.style.top = `${s}px`;
4284
+ handleDeleteMarker(t) {
4285
+ if (!this.value) return;
4286
+ const e = this.value.markers.filter((i) => i.id !== t);
4287
+ this.setMarkers(e), this.saveState(), this.refreshPopoverContent(), this.mainDisplayElements && O(this.mainDisplayElements, this.value), this.triggerChange();
3950
4288
  }
3951
- saveState() {
3952
- if (this.isUndoRedoOperation || !this.value) return;
3953
- const t = JSON.parse(
3954
- JSON.stringify(this.value.markers)
3955
- );
3956
- if (this.historyIndex >= 0 && this.history.length > 0) {
3957
- const e = this.history[this.historyIndex];
3958
- if (JSON.stringify(e) === JSON.stringify(t))
3959
- return;
4289
+ handleClearAllMarkers() {
4290
+ this.value && (this.setMarkers([]), this.saveState(), this.refreshPopoverContent(), this.mainDisplayElements && O(this.mainDisplayElements, this.value), this.triggerChange());
4291
+ }
4292
+ updateCursorTooltipContent() {
4293
+ if (!this.cursorTooltip || !this.value) return;
4294
+ const t = this.props.maxMarkers || G;
4295
+ if (this.cursorTooltip.shouldShow(this.value.markers.length, t)) {
4296
+ const e = Ie(
4297
+ this.value.markers,
4298
+ this.props.prizeMap
4299
+ );
4300
+ this.cursorTooltip.updateContent(String(e.index));
3960
4301
  }
3961
- this.history = this.history.slice(0, this.historyIndex + 1), this.history.push(t), this.historyIndex++, this.history.length > 50 && (this.history.shift(), this.historyIndex--), this.updateUndoRedoButtons();
3962
- }
3963
- canUndo() {
3964
- return this.historyIndex > 0;
3965
4302
  }
3966
- canRedo() {
3967
- return this.historyIndex < this.history.length - 1;
4303
+ saveState() {
4304
+ this.isUndoRedoOperation || !this.value || (this.historyManager.saveState(this.value.markers), this.updateUndoRedoButtons());
3968
4305
  }
3969
4306
  undo() {
3970
- if (!this.canUndo() || !this.value) return;
3971
- this.historyIndex--, this.isUndoRedoOperation = !0;
3972
- const t = JSON.parse(
3973
- JSON.stringify(this.history[this.historyIndex])
3974
- );
3975
- this.setMarkers(t), this.refreshPopoverContent(), this.updateMainDisplay(), this.triggerChange(), this.isUndoRedoOperation = !1, this.updateUndoRedoButtons();
4307
+ if (!this.value) return;
4308
+ const t = this.historyManager.undo();
4309
+ t !== null && (this.isUndoRedoOperation = !0, this.setMarkers(t), this.refreshPopoverContent(), this.mainDisplayElements && O(this.mainDisplayElements, this.value), this.triggerChange(), this.isUndoRedoOperation = !1, this.updateUndoRedoButtons());
3976
4310
  }
3977
4311
  redo() {
3978
- if (!this.canRedo() || !this.value) return;
3979
- this.historyIndex++, this.isUndoRedoOperation = !0;
3980
- const t = JSON.parse(
3981
- JSON.stringify(this.history[this.historyIndex])
3982
- );
3983
- this.setMarkers(t), this.refreshPopoverContent(), this.updateMainDisplay(), this.triggerChange(), this.isUndoRedoOperation = !1, this.updateUndoRedoButtons();
4312
+ if (!this.value) return;
4313
+ const t = this.historyManager.redo();
4314
+ t !== null && (this.isUndoRedoOperation = !0, this.setMarkers(t), this.refreshPopoverContent(), this.mainDisplayElements && O(this.mainDisplayElements, this.value), this.triggerChange(), this.isUndoRedoOperation = !1, this.updateUndoRedoButtons());
3984
4315
  }
3985
4316
  updateUndoRedoButtons() {
3986
- if (!this.popoverEl) return;
3987
- const t = this.popoverEl.querySelector(
4317
+ if (!this.popoverElements) return;
4318
+ const t = this.popoverElements.popover.querySelector(
3988
4319
  ".undo-btn"
3989
- ), e = this.popoverEl.querySelector(
4320
+ ), e = this.popoverElements.popover.querySelector(
3990
4321
  ".redo-btn"
3991
4322
  );
3992
- t && (t.disabled = !this.canUndo()), e && (e.disabled = !this.canRedo());
3993
- }
3994
- showError(t) {
3995
- const e = document.createElement("div");
3996
- if (e.className = "image-map-error-toast", e.textContent = t, e.style.cssText = `
3997
- position: fixed;
3998
- top: 20px;
3999
- right: 20px;
4000
- background-color: #ef4444;
4001
- color: white;
4002
- padding: 12px 16px;
4003
- border-radius: 8px;
4004
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
4005
- z-index: 10000;
4006
- max-width: 350px;
4007
- font-size: 14px;
4008
- animation: slideIn 0.3s ease-out;
4009
- `, !document.getElementById("image-map-toast-styles")) {
4010
- const i = document.createElement("style");
4011
- i.id = "image-map-toast-styles", i.textContent = `
4012
- @keyframes slideIn {
4013
- from {
4014
- transform: translateX(400px);
4015
- opacity: 0;
4016
- }
4017
- to {
4018
- transform: translateX(0);
4019
- opacity: 1;
4020
- }
4021
- }
4022
- @keyframes slideOut {
4023
- from {
4024
- transform: translateX(0);
4025
- opacity: 1;
4026
- }
4027
- to {
4028
- transform: translateX(400px);
4029
- opacity: 0;
4030
- }
4031
- }
4032
- `, document.head.appendChild(i);
4033
- }
4034
- document.body.appendChild(e), setTimeout(() => {
4035
- e.style.animation = "slideOut 0.3s ease-out", setTimeout(() => {
4036
- e.parentElement && e.parentElement.removeChild(e);
4037
- }, 300);
4038
- }, 5e3);
4323
+ t && (t.disabled = !this.historyManager.canUndo()), e && (e.disabled = !this.historyManager.canRedo());
4039
4324
  }
4040
4325
  setMarkers(t) {
4041
4326
  const e = t.map((i) => ({ ...i }));
@@ -4044,70 +4329,35 @@ const gt = `
4044
4329
  markers: e
4045
4330
  };
4046
4331
  }
4047
- scaleMarkersForNewImage(t, e, i) {
4048
- if (!t.length) return [];
4049
- const s = e && e.width && e.height && e || i && i.width && i.height && i || null;
4050
- return t.map((n) => {
4051
- const o = { ...n };
4052
- return s && o.x > 100 && (o.x = o.x / s.width * 100), s && o.y > 100 && (o.y = o.y / s.height * 100), o.x = this.clampPercentage(o.x), o.y = this.clampPercentage(o.y), o;
4053
- });
4054
- }
4055
- clampPercentage(t) {
4056
- return Number.isFinite(t) ? Math.max(0, Math.min(100, t)) : 0;
4057
- }
4058
4332
  recordImageNaturalSize() {
4059
4333
  if (!this.imageElement) return;
4060
4334
  const { naturalWidth: t, naturalHeight: e } = this.imageElement;
4061
- t && e && (this.lastImageNaturalSize = {
4335
+ t && e && (this.previousImageDimensions = {
4062
4336
  width: t,
4063
4337
  height: e
4064
4338
  });
4065
4339
  }
4066
- showConfirmModal(t, e) {
4067
- return this.confirmPromise ? this.confirmPromise : (this.confirmPromise = new Promise((i) => {
4068
- this.confirmOverlayEl && (this.confirmOverlayEl.remove(), this.confirmOverlayEl = null);
4069
- const s = document.createElement("div");
4070
- s.className = "image-map-confirm-overlay", this.confirmOverlayEl = s;
4071
- const n = document.createElement("div");
4072
- n.className = "image-map-confirm-modal";
4073
- const o = document.createElement("div");
4074
- o.className = "confirm-header", o.textContent = t;
4075
- const a = document.createElement("div");
4076
- a.className = "confirm-body", a.textContent = e;
4077
- const l = document.createElement("div");
4078
- l.className = "confirm-actions";
4079
- const r = document.createElement("button");
4080
- r.type = "button", r.className = "confirm-btn ghost", r.textContent = "Cancel";
4081
- const c = document.createElement("button");
4082
- c.type = "button", c.className = "confirm-btn danger", c.textContent = "Discard";
4083
- const h = (p) => {
4084
- s.remove(), this.confirmOverlayEl = null, this.confirmPromise = null, i(p);
4085
- };
4086
- r.addEventListener("click", () => h(!1)), c.addEventListener("click", () => h(!0)), s.addEventListener("click", (p) => {
4087
- p.target === s && h(!1);
4088
- }), l.appendChild(r), l.appendChild(c), n.appendChild(o), n.appendChild(a), n.appendChild(l), s.appendChild(n), document.body.appendChild(s), setTimeout(() => {
4089
- n.classList.add("visible");
4090
- }, 10);
4091
- }), this.confirmPromise);
4092
- }
4093
4340
  triggerChange() {
4094
4341
  this.value && (this.onChange && this.onChange(this.value), this.props.detectChange && this.props.detectChange(this.value));
4095
4342
  }
4096
4343
  destroy() {
4097
- var t, e;
4098
- this.closePopover(), (t = this.backdropEl) != null && t.parentElement && this.backdropEl.parentElement.removeChild(this.backdropEl), (e = this.popoverEl) != null && e.parentElement && this.popoverEl.parentElement.removeChild(this.popoverEl), document.removeEventListener("click", this.onBackgroundClick, !0), document.removeEventListener("keydown", this.handlePopoverKeydown, !0), this.cleanupMessageListener();
4344
+ this.closePopover(), this.popoverElements && (this.popoverElements.backdrop.parentElement && this.popoverElements.backdrop.parentElement.removeChild(
4345
+ this.popoverElements.backdrop
4346
+ ), this.popoverElements.popover.parentElement && this.popoverElements.popover.parentElement.removeChild(
4347
+ this.popoverElements.popover
4348
+ )), document.removeEventListener("click", this.onBackgroundClick, !0), document.removeEventListener("keydown", this.handlePopoverKeydown, !0), Lt.unregisterHandler(this.id), this.confirmModal.cleanup();
4099
4349
  }
4100
4350
  };
4101
- $.openInstance = null;
4102
- let vt = $;
4103
- class ce extends B {
4351
+ A.openInstance = null;
4352
+ let kt = A;
4353
+ class je extends B {
4104
4354
  constructor(t = {}) {
4105
4355
  super({
4106
4356
  ...t,
4107
4357
  title: t.title || "Height",
4108
4358
  suffix: t.suffix || "px",
4109
4359
  minValue: t.minValue ?? 0,
4110
- icon: t.icon || he,
4360
+ icon: t.icon || _e,
4111
4361
  default: t.default ?? 100
4112
4362
  }), this.inputType = "number", this.mobileValue = t.mobile;
4113
4363
  }
@@ -4118,17 +4368,17 @@ class ce extends B {
4118
4368
  this.mobileValue = t, t !== void 0 && this.setValue(t);
4119
4369
  }
4120
4370
  }
4121
- const he = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
4371
+ const _e = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
4122
4372
  <path d="M9 14L9 5M9 14L6.75 12.5M9 14L11.25 12.5M9 5L6.75 6.5M9 5L11.25 6.5M15.75 2.75H2.25M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
4123
4373
  </svg>`;
4124
- class de extends B {
4374
+ class qe extends B {
4125
4375
  constructor(t = {}) {
4126
4376
  super({
4127
4377
  ...t,
4128
4378
  title: t.title || "Width",
4129
4379
  suffix: t.suffix || "px",
4130
4380
  minValue: t.minValue ?? 0,
4131
- icon: t.icon || pe,
4381
+ icon: t.icon || Ze,
4132
4382
  default: t.default ?? 100
4133
4383
  }), this.inputType = "number", this.mobileValue = t.mobile;
4134
4384
  }
@@ -4139,14 +4389,14 @@ class de extends B {
4139
4389
  this.mobileValue = t, t !== void 0 && this.setValue(t);
4140
4390
  }
4141
4391
  }
4142
- const pe = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
4392
+ const Ze = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
4143
4393
  <path d="M4.5 9.5H13.5M4.5 9.5L6 7.25M4.5 9.5L6 11.75M13.5 9.5L12 7.25M13.5 9.5L12 11.75M15.75 16.25V2.75M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
4144
- </svg>`, ue = `
4394
+ </svg>`, Je = `
4145
4395
  <svg xmlns="http://www.w3.org/2000/svg" class="svg-select-api" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">
4146
4396
  <polyline points="6 9 12 15 18 9"></polyline>
4147
4397
  </svg>
4148
4398
  `;
4149
- class Te extends w {
4399
+ class ui extends w {
4150
4400
  constructor(t = {}) {
4151
4401
  if (super(t), this.inputType = "select", this._options = [], this.isOpen = !1, this.selectedOptionIndex = null, this.optionsListEl = null, this.svgContainer = null, this.buttonEl = null, this.isLoading = !1, this.container = null, this.hasInitializedOptions = !1, this.selectedOptionIndex = null, t.default !== void 0 && (this.value = t.default), this.initializeOptions(t), !t.getOptionsAsync && this.value !== void 0) {
4152
4402
  const e = this._options.findIndex(
@@ -4201,7 +4451,7 @@ class Te extends w {
4201
4451
  a.onclick = (l) => this.selectApiOption(l, o, e), i.appendChild(a);
4202
4452
  }), t.appendChild(i);
4203
4453
  const s = document.createElement("div");
4204
- return s.classList.add("svg-container"), s.innerHTML = ue, t.appendChild(s), s.onclick = () => {
4454
+ return s.classList.add("svg-container"), s.innerHTML = Je, t.appendChild(s), s.onclick = () => {
4205
4455
  var n, o;
4206
4456
  this.isLoading || (this.isOpen = !this.isOpen, (n = this.optionsListEl) == null || n.classList.toggle("open", this.isOpen), (o = this.svgContainer) == null || o.classList.toggle("open", this.isOpen));
4207
4457
  }, this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && !this.hasInitializedOptions ? (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
@@ -4295,7 +4545,7 @@ class Te extends w {
4295
4545
  ), this.updateButtonText(), this.updateOptionsList(), this.detectChangeCallback && this.detectChangeCallback !== this.props.detectChange && this.detectChangeCallback(t);
4296
4546
  }
4297
4547
  }
4298
- class Pe extends w {
4548
+ class gi extends w {
4299
4549
  constructor(t) {
4300
4550
  var e, i;
4301
4551
  super(t), this.inputType = "text", this.value = t.default ?? ((i = (e = t.options) == null ? void 0 : e[0]) == null ? void 0 : i.value) ?? "", this.detectChangeCallback = t.detectChange;
@@ -4318,19 +4568,19 @@ class Pe extends w {
4318
4568
  i.className = "toggle-switch";
4319
4569
  const s = document.createElement("input");
4320
4570
  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", () => {
4321
- var r, c;
4322
- const l = ((c = (r = this.props.options) == null ? void 0 : r.find((h) => h.status === s.checked)) == null ? void 0 : c.value) ?? "";
4571
+ var r, h;
4572
+ const l = ((h = (r = this.props.options) == null ? void 0 : r.find((d) => d.status === s.checked)) == null ? void 0 : h.value) ?? "";
4323
4573
  this.value = l, this.onChange && this.onChange(this.value), this.detectChangeCallback && this.detectChangeCallback(this.value);
4324
4574
  });
4325
4575
  const n = document.createElement("span");
4326
4576
  if (n.className = "toggle-slider", this.props.activeColor || this.props.inactiveColor) {
4327
- const l = document.createElement("style"), r = this.props.activeColor || "#4CAF50", c = this.props.inactiveColor || "#ccc";
4577
+ const l = document.createElement("style"), r = this.props.activeColor || "#4CAF50", h = this.props.inactiveColor || "#ccc";
4328
4578
  l.textContent = `
4329
4579
  .toggle-switch input:checked + .toggle-slider {
4330
4580
  background-color: ${r};
4331
4581
  }
4332
4582
  .toggle-switch .toggle-slider {
4333
- background-color: ${c};
4583
+ background-color: ${h};
4334
4584
  }
4335
4585
  `, document.head.appendChild(l);
4336
4586
  }
@@ -4345,13 +4595,13 @@ class Pe extends w {
4345
4595
  this.detectChangeCallback = t;
4346
4596
  }
4347
4597
  }
4348
- const ge = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
4598
+ const Xe = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
4349
4599
  <path d="M13.3334 5.99996H2.66675M13.3334 9.99996H2.66675M5.33341 12.6666V3.33329M10.6667 12.6666V3.33329" stroke="#667085" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
4350
4600
  </svg>`;
4351
- class Oe extends w {
4601
+ class mi extends w {
4352
4602
  // Store mobile value
4353
4603
  constructor(t = {}) {
4354
- t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? ge, t.suffix = t.suffix ?? "px", t.minValue = t.minValue ?? 0, super(t), this.inputType = "number", this.inputValues = {}, this.mobileValue = t.mobile, this.value = this.validateValue(t.default ?? 0), t.rowGap && (this.inputValues.row = this.value), t.columnGap && (this.inputValues.column = this.value);
4604
+ t.rowGap = t.rowGap ?? !0, t.columnGap = t.columnGap ?? !0, t.title = t.title ?? "Gap", t.icon = t.icon ?? Xe, t.suffix = t.suffix ?? "px", t.minValue = t.minValue ?? 0, super(t), this.inputType = "number", this.inputValues = {}, this.mobileValue = t.mobile, this.value = this.validateValue(t.default ?? 0), t.rowGap && (this.inputValues.row = this.value), t.columnGap && (this.inputValues.column = this.value);
4355
4605
  }
4356
4606
  draw() {
4357
4607
  const t = document.createElement("div");
@@ -4402,40 +4652,40 @@ class Oe extends w {
4402
4652
  this.mobileValue = t, t !== void 0 && this.setValue(t);
4403
4653
  }
4404
4654
  }
4405
- const me = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
4655
+ const Ye = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
4406
4656
  <path d="M2.25 11.75H15.75M5.85 2.75H12.15C13.4101 2.75 14.0402 2.75 14.5215 2.99524C14.9448 3.21095 15.289 3.55516 15.5048 3.97852C15.75 4.45982 15.75 5.08988 15.75 6.35V12.65C15.75 13.9101 15.75 14.5402 15.5048 15.0215C15.289 15.4448 14.9448 15.789 14.5215 16.0048C14.0402 16.25 13.4101 16.25 12.15 16.25H5.85C4.58988 16.25 3.95982 16.25 3.47852 16.0048C3.05516 15.789 2.71095 15.4448 2.49524 15.0215C2.25 14.5402 2.25 13.9101 2.25 12.65V6.35C2.25 5.08988 2.25 4.45982 2.49524 3.97852C2.71095 3.55516 3.05516 3.21095 3.47852 2.99524C3.95982 2.75 4.58988 2.75 5.85 2.75Z" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
4407
4657
  </svg>`;
4408
- class He extends B {
4658
+ class vi extends B {
4409
4659
  constructor(t = {}) {
4410
4660
  super({
4411
4661
  ...t,
4412
4662
  minValue: t.minValue ?? 0,
4413
4663
  maxValue: t.maxValue ?? 1e3,
4414
- icon: t.icon || me,
4664
+ icon: t.icon || Ye,
4415
4665
  title: t.title || "Margin Bottom",
4416
4666
  default: t.default ?? 20,
4417
4667
  wrapperClassName: "margin-bottom-wrapper " + (t.wrapperClassName || "")
4418
4668
  }), this.inputType = "number";
4419
4669
  }
4420
4670
  }
4421
- const ve = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
4671
+ const Ke = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
4422
4672
  <path d="M15.75 7.25H2.25m9.9 9h-6.3c-1.26 0-1.89 0-2.371-.245a2.25 2.25 0 0 1-.984-.983c-.245-.482-.245-1.112-.245-2.372v-6.3c0-1.26 0-1.89.245-2.371a2.25 2.25 0 0 1 .984-.984c.48-.245 1.11-.245 2.371-.245h6.3c1.26 0 1.89 0 2.371.245.424.216.768.56.984.984.245.48.245 1.11.245 2.371v6.3c0 1.26 0 1.89-.245 2.371-.216.424-.56.768-.984.984-.48.245-1.11.245-2.371.245"
4423
4673
  stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
4424
4674
  </svg>`;
4425
- class Be extends B {
4675
+ class fi extends B {
4426
4676
  constructor(t = {}) {
4427
4677
  super({
4428
4678
  ...t,
4429
4679
  minValue: t.minValue ?? 0,
4430
4680
  maxValue: t.maxValue ?? 1e3,
4431
- icon: t.icon || ve,
4681
+ icon: t.icon || Ke,
4432
4682
  title: t.title || "Margin Top",
4433
4683
  default: t.default ?? 20,
4434
4684
  wrapperClassName: "margin-top-wrapper " + (t.wrapperClassName || "")
4435
4685
  }), this.inputType = "number";
4436
4686
  }
4437
4687
  }
4438
- class $e extends w {
4688
+ class Ci extends w {
4439
4689
  constructor(t) {
4440
4690
  super(t), this.inputType = {}, this.container = null, this.defaultLanguage = "", this.uploadSettings = /* @__PURE__ */ new Map(), this.popup = null, t.default ? this.value = { ...t.default } : this.value || (this.value = {});
4441
4691
  const e = w.HasExplicitCurrentLanguage(), i = e ? w.CurrentLanguage() : "", s = w.DefaultLanguage;
@@ -4469,13 +4719,13 @@ class $e extends w {
4469
4719
  t.placeholder = e;
4470
4720
  return;
4471
4721
  }
4472
- const c = "...";
4473
- let h = 0, p = e.length, g = 0;
4474
- for (; h <= p; ) {
4475
- const m = Math.floor((h + p) / 2), u = e.slice(0, m).trimEnd() + c;
4476
- this.measureTextWidth(u, i) <= l ? (g = m, h = m + 1) : p = m - 1;
4722
+ const h = "...";
4723
+ let d = 0, p = e.length, m = 0;
4724
+ for (; d <= p; ) {
4725
+ const g = Math.floor((d + p) / 2), u = e.slice(0, g).trimEnd() + h;
4726
+ this.measureTextWidth(u, i) <= l ? (m = g, d = g + 1) : p = g - 1;
4477
4727
  }
4478
- const C = e.slice(0, g).trimEnd() + c;
4728
+ const C = e.slice(0, m).trimEnd() + h;
4479
4729
  t.placeholder = C;
4480
4730
  }
4481
4731
  autosizeTextarea(t, e = 3) {
@@ -4488,7 +4738,7 @@ class $e extends w {
4488
4738
  i.classList.add("simple-multi-language-row");
4489
4739
  const s = document.createElement("label");
4490
4740
  if (s.classList.add("simple-language-label"), s.textContent = t.toUpperCase(), s.setAttribute("for", `textarea-${t}`), i.appendChild(s), this.props.multiImg) {
4491
- const n = new lt({
4741
+ const n = new ut({
4492
4742
  defaultUrl: e || "",
4493
4743
  title: "",
4494
4744
  id: `${this.id}_upload_${t}`
@@ -4511,8 +4761,8 @@ class $e extends w {
4511
4761
  ), n.addEventListener("input", (l) => {
4512
4762
  const r = l.target;
4513
4763
  this.updateLanguageValue(t, r.value), t === this.defaultLanguage && this.updateOtherLanguagePlaceholders(r.value), this.autosizeTextarea(r, 3);
4514
- const c = n.getAttribute("data-full-placeholder") || "";
4515
- c && this.adaptPlaceholderToSingleLine(n, c);
4764
+ const h = n.getAttribute("data-full-placeholder") || "";
4765
+ h && this.adaptPlaceholderToSingleLine(n, h);
4516
4766
  }), i.appendChild(n), ((l) => (typeof queueMicrotask == "function" ? queueMicrotask : (r) => setTimeout(r, 0))(l))(() => {
4517
4767
  this.autosizeTextarea(n, 3);
4518
4768
  const l = n.getAttribute("data-full-placeholder") || "";
@@ -4623,8 +4873,8 @@ class $e extends w {
4623
4873
  `, n.addEventListener("click", () => this.closePopup()), i.appendChild(s), i.appendChild(n), e.appendChild(i);
4624
4874
  const o = document.createElement("div");
4625
4875
  return o.classList.add("multi-language-popup-content"), this.props.languages.forEach((a) => {
4626
- var c;
4627
- const l = ((c = this.value) == null ? void 0 : c[a]) || "", r = this.createTextareaRow(a, l);
4876
+ var h;
4877
+ const l = ((h = this.value) == null ? void 0 : h[a]) || "", r = this.createTextareaRow(a, l);
4628
4878
  o.appendChild(r);
4629
4879
  }), e.appendChild(o), t.appendChild(e), t.addEventListener("click", (a) => {
4630
4880
  a.target === t && this.closePopup();
@@ -4704,7 +4954,7 @@ class $e extends w {
4704
4954
  });
4705
4955
  }
4706
4956
  }
4707
- class Ae extends w {
4957
+ class yi extends w {
4708
4958
  constructor(t = {}) {
4709
4959
  super(t), this.inputType = "select";
4710
4960
  const e = [
@@ -4715,7 +4965,7 @@ class Ae extends w {
4715
4965
  { name: "Bounce", value: "bounce 1.5s ease-in-out infinite" },
4716
4966
  { name: "Pulse", value: "pulse 1.5s ease-in-out infinite" }
4717
4967
  ];
4718
- this.selectSetting = new nt({
4968
+ this.selectSetting = new ht({
4719
4969
  title: this.title || "Animation",
4720
4970
  options: e,
4721
4971
  default: this.props.default || "none"
@@ -4731,16 +4981,16 @@ class Ae extends w {
4731
4981
  this.selectSetting.destroy(), super.destroy();
4732
4982
  }
4733
4983
  }
4734
- const fe = `
4984
+ const Qe = `
4735
4985
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
4736
4986
  <path d="M5.625 9.5H5.6325M12.375 9.5H12.3825M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M2.25 6.35L2.25 12.65C2.25 13.9101 2.25 14.5402 2.49524 15.0215C2.71095 15.4448 3.05516 15.789 3.47852 16.0048C3.95982 16.25 4.58988 16.25 5.85 16.25H12.15C13.4101 16.25 14.0402 16.25 14.5215 16.0048C14.9448 15.789 15.289 15.4448 15.5048 15.0215C15.75 14.5402 15.75 13.9101 15.75 12.65V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75L5.85 2.75C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
4737
4987
  </svg>
4738
- `, Ce = `
4988
+ `, ti = `
4739
4989
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
4740
4990
  <path d="M6 2.75H5.85C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35V6.5M6 16.25H5.85C4.58988 16.25 3.95982 16.25 3.47852 16.0048C3.05516 15.789 2.71095 15.4448 2.49524 15.0215C2.25 14.5402 2.25 13.9101 2.25 12.65V12.5M15.75 6.5V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75H12M15.75 12.5V12.65C15.75 13.9101 15.75 14.5402 15.5048 15.0215C15.289 15.4448 14.9448 15.789 14.5215 16.0048C14.0402 16.25 13.4101 16.25 12.15 16.25H12" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
4741
4991
  </svg>
4742
4992
  `;
4743
- class De extends H {
4993
+ class Ei extends $ {
4744
4994
  constructor(t) {
4745
4995
  super({
4746
4996
  title: "Border",
@@ -4748,17 +4998,17 @@ class De extends H {
4748
4998
  settings: {
4749
4999
  size: new B({
4750
5000
  title: "Size",
4751
- icon: Ce,
5001
+ icon: ti,
4752
5002
  default: (t == null ? void 0 : t.size) ?? 0,
4753
5003
  suffix: "px"
4754
5004
  }),
4755
- color: new j({
5005
+ color: new J({
4756
5006
  title: "Border Color",
4757
5007
  default: (t == null ? void 0 : t.color) || "#000000"
4758
5008
  }),
4759
5009
  radius: new B({
4760
5010
  title: "Radius",
4761
- icon: fe,
5011
+ icon: Qe,
4762
5012
  default: (t == null ? void 0 : t.radius) ?? 12,
4763
5013
  suffix: "px"
4764
5014
  })
@@ -4782,20 +5032,20 @@ class De extends H {
4782
5032
  `;
4783
5033
  }
4784
5034
  }
4785
- const ye = `
5035
+ const ei = `
4786
5036
  <svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13" fill="none">
4787
5037
  <path d="M1 2.75C1 2.05109 1 1.70163 1.11418 1.42597C1.26642 1.05843 1.55843 0.766422 1.92597 0.614181C2.20163 0.5 2.55109 0.5 3.25 0.5H10.75C11.4489 0.5 11.7984 0.5 12.074 0.614181C12.4416 0.766422 12.7336 1.05843 12.8858 1.42597C13 1.70163 13 2.05109 13 2.75M4.75 12.5H9.25M7 0.5V12.5" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
4788
5038
  </svg>
4789
- `, Ee = `
5039
+ `, ii = `
4790
5040
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
4791
5041
  <path d="M3 5.75C3 5.05109 3 4.70163 3.11418 4.42597C3.26642 4.05843 3.55843 3.76642 3.92597 3.61418C4.20163 3.5 4.55109 3.5 5.25 3.5H12.75C13.4489 3.5 13.7984 3.5 14.074 3.61418C14.4416 3.76642 14.7336 4.05843 14.8858 4.42597C15 4.70163 15 5.05109 15 5.75M6 15.5H12M7.6875 3.5V15.5M10.3125 3.5V15.5" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
4792
5042
  </svg>
4793
- `, be = `
5043
+ `, si = `
4794
5044
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
4795
5045
  <path d="M6 5.75H12M9 5.75V13.25M5.85 16.25H12.15C13.4101 16.25 14.0402 16.25 14.5215 16.0048C14.9448 15.789 15.289 15.4448 15.5048 15.0215C15.75 14.5402 15.75 13.9101 15.75 12.65V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75H5.85C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35V12.65C2.25 13.9101 2.25 14.5402 2.49524 15.0215C2.71095 15.4448 3.05516 15.789 3.47852 16.0048C3.95982 16.25 4.58988 16.25 5.85 16.25Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
4796
5046
  </svg>
4797
5047
  `;
4798
- class Fe extends H {
5048
+ class bi extends $ {
4799
5049
  constructor(t = {}) {
4800
5050
  const { showAlign: e = t.showAlign ?? !0, ...i } = t;
4801
5051
  super({
@@ -4803,13 +5053,13 @@ class Fe extends H {
4803
5053
  collapsed: i.collapsed,
4804
5054
  settings: (() => {
4805
5055
  const s = {
4806
- color: new j({
5056
+ color: new J({
4807
5057
  title: "Color",
4808
5058
  default: i.colorDefault ?? "#001E1E"
4809
5059
  }),
4810
- fontFamily: new nt({
5060
+ fontFamily: new ht({
4811
5061
  title: "Font",
4812
- icon: ye,
5062
+ icon: ei,
4813
5063
  default: i.fontFamilyDefault ?? "Satoshi",
4814
5064
  options: i.fontFamilyOptions ?? [
4815
5065
  { name: "Alt", value: "Croco Sans Black Caps Alt" },
@@ -4820,9 +5070,9 @@ class Fe extends H {
4820
5070
  getOptions: i.fontFamilyGetOptions,
4821
5071
  getOptionsAsync: i.fontFamilyGetOptionsAsync
4822
5072
  }),
4823
- fontWeight: new nt({
5073
+ fontWeight: new ht({
4824
5074
  title: "Weight",
4825
- icon: Ee,
5075
+ icon: ii,
4826
5076
  default: i.fontWeightDefault ?? "400",
4827
5077
  options: i.fontWeightOptions ?? [
4828
5078
  { name: "Regular", value: "400" },
@@ -4834,7 +5084,7 @@ class Fe extends H {
4834
5084
  }),
4835
5085
  fontSize: new B({
4836
5086
  title: "Size",
4837
- icon: be,
5087
+ icon: si,
4838
5088
  default: i.fontSizeDefault ?? 12,
4839
5089
  suffix: "px",
4840
5090
  mobile: i.fontSizeMobileDefault
@@ -4842,7 +5092,7 @@ class Fe extends H {
4842
5092
  };
4843
5093
  return e ? {
4844
5094
  ...s,
4845
- align: new Jt({
5095
+ align: new ne({
4846
5096
  title: "Align",
4847
5097
  default: i.alignDefault ?? "center"
4848
5098
  })
@@ -4874,7 +5124,7 @@ class Fe extends H {
4874
5124
  `;
4875
5125
  }
4876
5126
  }
4877
- class Z extends w {
5127
+ class K extends w {
4878
5128
  constructor(t) {
4879
5129
  super({
4880
5130
  ...t,
@@ -4885,8 +5135,8 @@ class Z extends w {
4885
5135
  const t = this.value === "auto" ? "text" : "number", e = (a) => {
4886
5136
  this.value !== "auto" && (this.props.minValue !== void 0 && (a.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (a.max = String(this.props.maxValue)), this.props.className && a.classList.add(this.props.className), a.addEventListener("input", () => {
4887
5137
  const l = this.props.minValue ?? Number.MIN_SAFE_INTEGER, r = this.props.maxValue ?? Number.MAX_SAFE_INTEGER;
4888
- let c = Number(a.value);
4889
- c < l && (c = l), c > r && (c = r), a.value = String(c);
5138
+ let h = Number(a.value);
5139
+ h < l && (h = l), h > r && (h = r), a.value = String(h);
4890
5140
  }));
4891
5141
  }, i = this.createInput({
4892
5142
  value: this.value,
@@ -4920,33 +5170,33 @@ class Z extends w {
4920
5170
  }), i;
4921
5171
  }
4922
5172
  }
4923
- class Ge extends H {
5173
+ class wi extends $ {
4924
5174
  constructor(t) {
4925
5175
  super({
4926
5176
  title: "Margins",
4927
5177
  collapsed: t == null ? void 0 : t.collapsed,
4928
5178
  settings: {
4929
- marginTop: new Z({
5179
+ marginTop: new K({
4930
5180
  title: "Top",
4931
- icon: we,
5181
+ icon: ni,
4932
5182
  suffix: "px",
4933
5183
  default: (t == null ? void 0 : t.marginTop) ?? "auto"
4934
5184
  }),
4935
- marginRight: new Z({
5185
+ marginRight: new K({
4936
5186
  title: "Right",
4937
- icon: xe,
5187
+ icon: oi,
4938
5188
  suffix: "px",
4939
5189
  default: (t == null ? void 0 : t.marginRight) ?? 0
4940
5190
  }),
4941
- marginBottom: new Z({
5191
+ marginBottom: new K({
4942
5192
  title: "Bottom",
4943
- icon: Le,
5193
+ icon: ai,
4944
5194
  suffix: "px",
4945
5195
  default: (t == null ? void 0 : t.marginBottom) ?? 0
4946
5196
  }),
4947
- marginLeft: new Z({
5197
+ marginLeft: new K({
4948
5198
  title: "Left",
4949
- icon: ke,
5199
+ icon: li,
4950
5200
  suffix: "px",
4951
5201
  default: (t == null ? void 0 : t.marginLeft) ?? 0
4952
5202
  })
@@ -4963,29 +5213,29 @@ class Ge extends H {
4963
5213
  `;
4964
5214
  }
4965
5215
  }
4966
- const we = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
5216
+ const ni = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
4967
5217
  <path d="M2.25 16.25H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 16.25H5.6325M5.625 9.5H5.6325M12.375 16.25H12.3825M12.375 9.5H12.3825M9 16.25H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 16.25H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 2.75H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
4968
- </svg>`, xe = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
5218
+ </svg>`, oi = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
4969
5219
  <path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 16.25H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M15.75 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
4970
- </svg>`, Le = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
5220
+ </svg>`, ai = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
4971
5221
  <path d="M2.25 2.75H2.2575M2.25 9.5H2.2575M2.25 12.875H2.2575M2.25 6.125H2.2575M5.625 2.75H5.6325M5.625 9.5H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M15.75 16.25H2.25" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
4972
- </svg>`, ke = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
5222
+ </svg>`, li = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
4973
5223
  <path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 16.25H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
4974
5224
  </svg>`;
4975
- class Re extends H {
5225
+ class xi extends $ {
4976
5226
  constructor(t) {
4977
5227
  super({
4978
5228
  title: "Background Image",
4979
5229
  collapsed: t == null ? void 0 : t.collapsed,
4980
5230
  settings: {
4981
- backgroundImage: new lt({
5231
+ backgroundImage: new ut({
4982
5232
  ...t == null ? void 0 : t.uploadProps,
4983
5233
  default: (t == null ? void 0 : t.backgroundImage) ?? ""
4984
5234
  }),
4985
- opacity: new jt({
5235
+ opacity: new ie({
4986
5236
  default: (t == null ? void 0 : t.opacity) ?? 100
4987
5237
  }),
4988
- backgroundColor: new z({
5238
+ backgroundColor: new _({
4989
5239
  default: (t == null ? void 0 : t.backgroundColor) ?? "0, 0, 30"
4990
5240
  })
4991
5241
  }
@@ -5011,21 +5261,21 @@ class Re extends H {
5011
5261
  `;
5012
5262
  }
5013
5263
  }
5014
- class ze extends H {
5264
+ class Li extends $ {
5015
5265
  constructor(t) {
5016
5266
  super({
5017
5267
  title: (t == null ? void 0 : t.title) ?? "Image",
5018
5268
  collapsed: t == null ? void 0 : t.collapsed,
5019
5269
  settings: {
5020
- image: new lt({
5270
+ image: new ut({
5021
5271
  ...t == null ? void 0 : t.uploadProps,
5022
5272
  default: (t == null ? void 0 : t.image) ?? ""
5023
5273
  }),
5024
- width: new de({
5274
+ width: new qe({
5025
5275
  default: (t == null ? void 0 : t.width) ?? 1e3,
5026
5276
  mobile: t == null ? void 0 : t.widthMobile
5027
5277
  }),
5028
- height: new ce({
5278
+ height: new je({
5029
5279
  default: (t == null ? void 0 : t.height) ?? 300,
5030
5280
  mobile: t == null ? void 0 : t.heightMobile
5031
5281
  })
@@ -5034,42 +5284,42 @@ class ze extends H {
5034
5284
  }
5035
5285
  }
5036
5286
  export {
5037
- Jt as AlignSetting,
5038
- Ae as AnimationSetting,
5039
- Re as BackgroundSettingSet,
5040
- De as BorderSettingSet,
5041
- Se as ButtonSetting,
5042
- O as ColorSetting,
5043
- z as ColorWithOpacitySetting,
5044
- Ve as DimensionSetting,
5045
- Oe as GapSetting,
5046
- j as GradientSetting,
5047
- Fe as HeaderTypographySettingSet,
5048
- ce as HeightSetting,
5049
- Ie as HtmlSetting,
5050
- vt as ImageMapSetting,
5051
- ze as ImageSettingSet,
5052
- He as MarginBottomSetting,
5053
- Ge as MarginSettingGroup,
5054
- Be as MarginTopSetting,
5055
- $e as MultiLanguageSetting,
5287
+ ne as AlignSetting,
5288
+ yi as AnimationSetting,
5289
+ xi as BackgroundSettingSet,
5290
+ Ei as BorderSettingSet,
5291
+ di as ButtonSetting,
5292
+ H as ColorSetting,
5293
+ _ as ColorWithOpacitySetting,
5294
+ pi as DimensionSetting,
5295
+ mi as GapSetting,
5296
+ J as GradientSetting,
5297
+ bi as HeaderTypographySettingSet,
5298
+ je as HeightSetting,
5299
+ hi as HtmlSetting,
5300
+ kt as ImageMapSetting,
5301
+ Li as ImageSettingSet,
5302
+ vi as MarginBottomSetting,
5303
+ wi as MarginSettingGroup,
5304
+ fi as MarginTopSetting,
5305
+ Ci as MultiLanguageSetting,
5056
5306
  B as NumberSetting,
5057
- jt as OpacitySetting,
5058
- Te as SelectApiSettings,
5059
- nt as SelectSetting,
5307
+ ie as OpacitySetting,
5308
+ ui as SelectApiSettings,
5309
+ ht as SelectSetting,
5060
5310
  w as Setting,
5061
- H as SettingGroup,
5062
- Rt as StringSetting,
5063
- Ft as TabSettingGroup,
5064
- Ft as TabsSettingGroup,
5065
- Pe as Toggle,
5066
- lt as UploadSetting,
5067
- de as WidthSetting,
5068
- Ne as asSettingGroupWithSettings,
5069
- Gt as createSettingGroup,
5070
- Me as createTabSettingGroup,
5071
- F as isSetting,
5072
- ct as isSettingChild,
5073
- L as isSettingGroup,
5074
- J as iterateSettings
5311
+ $ as SettingGroup,
5312
+ Kt as StringSetting,
5313
+ Xt as TabSettingGroup,
5314
+ Xt as TabsSettingGroup,
5315
+ gi as Toggle,
5316
+ ut as UploadSetting,
5317
+ qe as WidthSetting,
5318
+ ci as asSettingGroupWithSettings,
5319
+ Yt as createSettingGroup,
5320
+ ri as createTabSettingGroup,
5321
+ R as isSetting,
5322
+ vt as isSettingChild,
5323
+ M as isSettingGroup,
5324
+ Y as iterateSettings
5075
5325
  };