@codingfactory/mediables-vue 2.4.1 → 2.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  var _e = Object.defineProperty;
2
2
  var xe = (s, e, t) => e in s ? _e(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
3
  var j = (s, e, t) => xe(s, typeof e != "symbol" ? e + "" : e, t);
4
- import * as g from "pixi-filters";
5
- import * as w from "pixi.js";
4
+ import * as b from "pixi-filters";
5
+ import * as S from "pixi.js";
6
6
  import { GlProgram as Ce } from "pixi.js";
7
7
  class B {
8
8
  constructor() {
@@ -291,7 +291,7 @@ class ve extends B {
291
291
  * @param {string} imageUrl - URL, data URL, or blob URL of the image
292
292
  */
293
293
  async loadTexture(e) {
294
- var l, c, u;
294
+ var l, c, d;
295
295
  if (this._mountPromise && await this._mountPromise, !((l = this.app) != null && l.renderer)) return !1;
296
296
  const t = window.PIXI, i = await this._loadImageElement(e);
297
297
  if (!i || !((c = this.app) != null && c.renderer)) return !1;
@@ -300,7 +300,7 @@ class ve extends B {
300
300
  return !1;
301
301
  this.originalTexture = r, this.baseTexture = r, this.sprite && (this.app.stage.removeChild(this.sprite), this.sprite.destroy()), this.sprite = new t.Sprite(r), this.app.stage.addChild(this.sprite), this.fitScale = this.getFitScaleFor(r), this.zoom = 1;
302
302
  const { w: a, h: o } = this._getCssSize();
303
- if (this.applyViewTransform({ center: { x: a / 2, y: o / 2 } }), await new Promise(requestAnimationFrame), !((u = this.app) != null && u.renderer)) return !1;
303
+ if (this.applyViewTransform({ center: { x: a / 2, y: o / 2 } }), await new Promise(requestAnimationFrame), !((d = this.app) != null && d.renderer)) return !1;
304
304
  const n = this.getFitScaleFor(r);
305
305
  return Math.abs(n - this.fitScale) / Math.max(1e-6, n) > 0.02 && (this.fitScale = n, this.applyViewTransform({ center: { x: a / 2, y: o / 2 } })), this.render(), this.emit("textureLoaded", { width: r.width, height: r.height }), !0;
306
306
  }
@@ -325,35 +325,35 @@ class ve extends B {
325
325
  let v = i / _;
326
326
  r && (v = Math.min(1, v)), l = Math.round(o * v);
327
327
  }
328
- const c = this.sprite, u = c.x, h = c.y, p = c.width, m = c.height;
328
+ const c = this.sprite, d = c.x, h = c.y, p = c.width, m = c.height;
329
329
  if (p <= 0 || m <= 0)
330
330
  return null;
331
- const C = l / p;
332
- let b = null;
331
+ const x = l / p;
332
+ let g = null;
333
333
  try {
334
- if (c.x = 0, c.y = 0, b = a.RenderTexture.create({
334
+ if (c.x = 0, c.y = 0, g = a.RenderTexture.create({
335
335
  width: Math.ceil(p),
336
336
  height: Math.ceil(m),
337
- resolution: C
338
- }), this.app.renderer.render({ container: this.app.stage, target: b }), !this.app.renderer.extract)
337
+ resolution: x
338
+ }), this.app.renderer.render({ container: this.app.stage, target: g }), !this.app.renderer.extract)
339
339
  return null;
340
- const _ = this.app.renderer.extract.canvas(b);
340
+ const _ = this.app.renderer.extract.canvas(g);
341
341
  if (!_)
342
342
  return null;
343
343
  let v = null;
344
344
  if (typeof _.toDataURL == "function")
345
345
  v = _.toDataURL(`image/${e}`, t);
346
346
  else if (typeof _.getContext == "function") {
347
- const z = document.createElement("canvas");
348
- z.width = _.width, z.height = _.height;
349
- const O = z.getContext("2d");
350
- O && (O.drawImage(_, 0, 0), v = z.toDataURL(`image/${e}`, t));
347
+ const C = document.createElement("canvas");
348
+ C.width = _.width, C.height = _.height;
349
+ const O = C.getContext("2d");
350
+ O && (O.drawImage(_, 0, 0), v = C.toDataURL(`image/${e}`, t));
351
351
  }
352
352
  return v || null;
353
353
  } catch {
354
354
  return null;
355
355
  } finally {
356
- c.x = u, c.y = h, b && b.destroy(!0);
356
+ c.x = d, c.y = h, g && g.destroy(!0);
357
357
  }
358
358
  }
359
359
  /**
@@ -583,9 +583,9 @@ class Pe extends B {
583
583
  if (!o || !o.createFilter || typeof o.createFilter != "function")
584
584
  return;
585
585
  const n = this.state.getFilterValues(a), l = o.defaultParams ? { ...o.defaultParams } : {};
586
- o.controls && Array.isArray(o.controls) && o.controls.forEach((u) => {
587
- const h = u.property || u.id;
588
- l[h] = n[u.id] ?? u.default;
586
+ o.controls && Array.isArray(o.controls) && o.controls.forEach((d) => {
587
+ const h = d.property || d.id;
588
+ l[h] = n[d.id] ?? d.default;
589
589
  });
590
590
  const c = o.createFilter(l);
591
591
  c && (t.push(c), this.instances[a] = c);
@@ -701,14 +701,14 @@ const T = class T extends B {
701
701
  if (!e || !r || !a || !o) return null;
702
702
  const l = e.width > t, c = e.height > i;
703
703
  if (!l && !c) return null;
704
- const u = T.AUTO_ZOOM_PADDING;
704
+ const d = T.AUTO_ZOOM_PADDING;
705
705
  let h = n;
706
706
  if (l) {
707
- const p = e.width / (u * r * o);
707
+ const p = e.width / (d * r * o);
708
708
  h = Math.min(h, p);
709
709
  }
710
710
  if (c) {
711
- const p = e.height / (u * a * o);
711
+ const p = e.height / (d * a * o);
712
712
  h = Math.min(h, p);
713
713
  }
714
714
  return h = Math.max(0.1, h), h >= n - 0.01 ? null : h;
@@ -752,8 +752,8 @@ const T = class T extends B {
752
752
  if (!l) return;
753
753
  const c = this.state.get("crop.shape");
754
754
  if (n.save(), c === "circle") {
755
- const y = l.x + l.width / 2, A = l.y + l.height / 2, _ = Math.min(l.width, l.height) / 2;
756
- n.beginPath(), n.arc(y, A, _, 0, Math.PI * 2), n.clip();
755
+ const y = l.x + l.width / 2, P = l.y + l.height / 2, _ = Math.min(l.width, l.height) / 2;
756
+ n.beginPath(), n.arc(y, P, _, 0, Math.PI * 2), n.clip();
757
757
  } else
758
758
  n.beginPath(), n.rect(l.x, l.y, l.width, l.height), n.clip();
759
759
  n.clearRect(l.x, l.y, l.width, l.height), n.restore(), n.strokeStyle = "#ffffff", n.lineWidth = 2, n.setLineDash([5, 5]), c === "circle" ? (n.beginPath(), n.arc(
@@ -763,23 +763,23 @@ const T = class T extends B {
763
763
  0,
764
764
  Math.PI * 2
765
765
  ), n.stroke()) : n.strokeRect(l.x, l.y, l.width, l.height), n.setLineDash([]), n.strokeStyle = "rgba(255,255,255,0.3)", n.lineWidth = 1;
766
- const u = l.width / 3, h = l.height / 3;
766
+ const d = l.width / 3, h = l.height / 3;
767
767
  for (let y = 1; y <= 2; y++)
768
- n.beginPath(), n.moveTo(l.x + u * y, l.y), n.lineTo(l.x + u * y, l.y + l.height), n.stroke(), n.beginPath(), n.moveTo(l.x, l.y + h * y), n.lineTo(l.x + l.width, l.y + h * y), n.stroke();
768
+ n.beginPath(), n.moveTo(l.x + d * y, l.y), n.lineTo(l.x + d * y, l.y + l.height), n.stroke(), n.beginPath(), n.moveTo(l.x, l.y + h * y), n.lineTo(l.x + l.width, l.y + h * y), n.stroke();
769
769
  const p = this.HANDLE_SIZE, m = [
770
770
  { x: l.x, y: l.y, m: "resize-nw" },
771
771
  { x: l.x + l.width, y: l.y, m: "resize-ne" },
772
772
  { x: l.x, y: l.y + l.height, m: "resize-sw" },
773
773
  { x: l.x + l.width, y: l.y + l.height, m: "resize-se" }
774
- ], C = [
774
+ ], x = [
775
775
  { x: l.x + l.width / 2, y: l.y, m: "n" },
776
776
  { x: l.x + l.width / 2, y: l.y + l.height, m: "s" },
777
777
  { x: l.x, y: l.y + l.height / 2, m: "w" },
778
778
  { x: l.x + l.width, y: l.y + l.height / 2, m: "e" }
779
- ], b = [...m, ...C];
780
- for (const y of b) {
781
- const A = this._hoverMode === y.m, _ = A ? p + 4 : p;
782
- n.beginPath(), n.rect(y.x - _ / 2, y.y - _ / 2, _, _), n.fillStyle = A ? "#4da3ff" : "#ffffff", n.strokeStyle = "rgba(0,0,0,0.6)", n.lineWidth = 1, n.fill(), n.stroke();
779
+ ], g = [...m, ...x];
780
+ for (const y of g) {
781
+ const P = this._hoverMode === y.m, _ = P ? p + 4 : p;
782
+ n.beginPath(), n.rect(y.x - _ / 2, y.y - _ / 2, _, _), n.fillStyle = P ? "#4da3ff" : "#ffffff", n.strokeStyle = "rgba(0,0,0,0.6)", n.lineWidth = 1, n.fill(), n.stroke();
783
783
  }
784
784
  }
785
785
  /**
@@ -807,12 +807,12 @@ const T = class T extends B {
807
807
  * Handle pointer move event
808
808
  */
809
809
  _handlePointerMove(e) {
810
- var l, c, u, h;
810
+ var l, c, d, h;
811
811
  const t = this.renderer.app;
812
812
  if (!t) return;
813
813
  const i = e.global;
814
814
  if (!this._isDragging || !this._dragStart || !this._startRect) {
815
- this._hoverMode = this._hitHandle(i.x, i.y), t.stage.cursor = this._hoverMode === "move" ? "move" : this._hoverMode === "n" || this._hoverMode === "s" ? "ns-resize" : this._hoverMode === "e" || this._hoverMode === "w" ? "ew-resize" : (l = this._hoverMode) != null && l.endsWith("nw") || (c = this._hoverMode) != null && c.endsWith("se") ? "nwse-resize" : (u = this._hoverMode) != null && u.endsWith("ne") || (h = this._hoverMode) != null && h.endsWith("sw") ? "nesw-resize" : "crosshair", this.drawOverlay();
815
+ this._hoverMode = this._hitHandle(i.x, i.y), t.stage.cursor = this._hoverMode === "move" ? "move" : this._hoverMode === "n" || this._hoverMode === "s" ? "ns-resize" : this._hoverMode === "e" || this._hoverMode === "w" ? "ew-resize" : (l = this._hoverMode) != null && l.endsWith("nw") || (c = this._hoverMode) != null && c.endsWith("se") ? "nwse-resize" : (d = this._hoverMode) != null && d.endsWith("ne") || (h = this._hoverMode) != null && h.endsWith("sw") ? "nesw-resize" : "crosshair", this.drawOverlay();
816
816
  return;
817
817
  }
818
818
  const r = this.state.get("crop.rect");
@@ -889,30 +889,58 @@ const T = class T extends B {
889
889
  apply() {
890
890
  const e = this.renderer.app, t = this.renderer.sprite, i = this.renderer.originalTexture, r = this.state.get("crop.rect");
891
891
  if (!r || !t || !e || !i) return null;
892
- const a = window.PIXI, o = this.renderer.zoom, n = i.width / t.width, l = i.height / t.height, c = (r.x - t.x) * n, u = (r.y - t.y) * l;
893
- let h = Math.round(Math.max(1, r.width * n)), p = Math.round(Math.max(1, r.height * l)), m = Math.round(c), C = Math.round(u);
892
+ const a = window.PIXI, o = this.renderer.zoom, n = i.width / t.width, l = i.height / t.height, c = (r.x - t.x) * n, d = (r.y - t.y) * l;
893
+ let h = Math.round(Math.max(1, r.width * n)), p = Math.round(Math.max(1, r.height * l)), m = Math.round(c), x = Math.round(d);
894
894
  if (h <= 0 || p <= 0) return null;
895
- const b = new a.Container(), y = new a.Sprite(i);
895
+ const g = new a.Container(), y = new a.Sprite(i);
896
896
  if (this.state.get("crop.shape") === "circle") {
897
- const V = Math.round(Math.max(h, p)), be = m + h / 2, ye = C + p / 2;
898
- m = Math.round(be - V / 2), C = Math.round(ye - V / 2), h = p = V;
899
- const M = new a.Graphics();
900
- typeof M.circle == "function" && typeof M.fill == "function" ? M.circle(h / 2, p / 2, h / 2).fill(16777215) : (M.beginFill(16777215, 1), M.drawCircle(h / 2, p / 2, h / 2), M.endFill()), y.mask = M, b.addChild(M);
897
+ const V = Math.round(Math.max(h, p)), be = m + h / 2, ye = x + p / 2;
898
+ m = Math.round(be - V / 2), x = Math.round(ye - V / 2), h = p = V;
899
+ const A = new a.Graphics();
900
+ typeof A.circle == "function" && typeof A.fill == "function" ? A.circle(h / 2, p / 2, h / 2).fill(16777215) : (A.beginFill(16777215, 1), A.drawCircle(h / 2, p / 2, h / 2), A.endFill()), y.mask = A, g.addChild(A);
901
901
  }
902
- y.x = -m, y.y = -C, b.addChild(y);
902
+ y.x = -m, y.y = -x, g.addChild(y);
903
903
  const _ = a.RenderTexture.create({ width: h, height: p });
904
904
  e.renderer.render({
905
- container: b,
905
+ container: g,
906
906
  target: _,
907
907
  clear: !0
908
- }), b.destroy({ children: !0 });
908
+ }), g.destroy({ children: !0 });
909
909
  const v = this.renderer.originalTexture;
910
910
  v && v !== this.renderer.baseTexture && v.destroy(!0), this.renderer.originalTexture = _, e.stage.removeChild(t), t.destroy();
911
- const z = new a.Sprite(_);
912
- e.stage.addChild(z), this.renderer.sprite = z, this.renderer.fitScale = this.renderer.getFitScaleFor(_), this.renderer.setZoom(o, { keepCenter: !1 }), this.renderer.applyViewTransform(), this.renderer.render();
913
- const O = { x: r.x, y: r.y, width: r.width, height: r.height }, me = this.state.get("crop.shape") || "free", ge = this.state.get("crop.aspect") || "free";
911
+ const C = new a.Sprite(_);
912
+ e.stage.addChild(C), this.renderer.sprite = C, this.renderer.fitScale = this.renderer.getFitScaleFor(_), this.renderer.setZoom(o, { keepCenter: !1 }), this.renderer.applyViewTransform(), this.renderer.render();
913
+ const O = { x: m, y: x, width: h, height: p }, me = this.state.get("crop.shape") || "free", ge = this.state.get("crop.aspect") || "free";
914
914
  return this.disable(), this.state.set("crop.appliedRect", O), this.state.set("crop.appliedShape", me), this.state.set("crop.appliedAspect", ge), this.emit("applied", { width: h, height: p }), { texture: _, preservedZoom: o };
915
915
  }
916
+ /**
917
+ * Apply a crop from saved texture-pixel coordinates (for state rehydration).
918
+ * Unlike apply(), this does not read from crop.rect or require the interactive overlay.
919
+ * @param {{ x: number, y: number, width: number, height: number }} pixelRect
920
+ * @param {'free'|'circle'} shape
921
+ * @returns {{ texture: Object, preservedZoom: number }|null}
922
+ */
923
+ applyFromPixelRect(e, t = "free") {
924
+ const i = this.renderer.app, r = this.renderer.sprite, a = this.renderer.originalTexture;
925
+ if (!e || !r || !i || !a) return null;
926
+ const o = window.PIXI, n = this.renderer.zoom;
927
+ let l = Math.round(Math.max(1, e.width)), c = Math.round(Math.max(1, e.height)), d = Math.round(e.x), h = Math.round(e.y);
928
+ if (l <= 0 || c <= 0) return null;
929
+ const p = new o.Container(), m = new o.Sprite(a);
930
+ if (t === "circle") {
931
+ const P = Math.round(Math.max(l, c)), _ = d + l / 2, v = h + c / 2;
932
+ d = Math.round(_ - P / 2), h = Math.round(v - P / 2), l = c = P;
933
+ const C = new o.Graphics();
934
+ typeof C.circle == "function" && typeof C.fill == "function" ? C.circle(l / 2, c / 2, l / 2).fill(16777215) : (C.beginFill(16777215, 1), C.drawCircle(l / 2, c / 2, l / 2), C.endFill()), m.mask = C, p.addChild(C);
935
+ }
936
+ m.x = -d, m.y = -h, p.addChild(m);
937
+ const x = o.RenderTexture.create({ width: l, height: c });
938
+ i.renderer.render({ container: p, target: x, clear: !0 }), p.destroy({ children: !0 });
939
+ const g = this.renderer.originalTexture;
940
+ g && g !== this.renderer.baseTexture && g.destroy(!0), this.renderer.originalTexture = x, i.stage.removeChild(r), r.destroy();
941
+ const y = new o.Sprite(x);
942
+ return i.stage.addChild(y), this.renderer.sprite = y, this.renderer.fitScale = this.renderer.getFitScaleFor(x), this.renderer.setZoom(n, { keepCenter: !1 }), this.renderer.applyViewTransform(), this.renderer.render(), { texture: x, preservedZoom: n };
943
+ }
916
944
  /**
917
945
  * Cancel crop
918
946
  */
@@ -993,8 +1021,8 @@ class Me {
993
1021
  if (!a.ok) {
994
1022
  let c = `Background removal failed (HTTP ${a.status})`;
995
1023
  try {
996
- const u = await a.text();
997
- u && (c += `: ${u}`);
1024
+ const d = await a.text();
1025
+ d && (c += `: ${d}`);
998
1026
  } catch {
999
1027
  }
1000
1028
  throw new Error(c);
@@ -1053,7 +1081,7 @@ class Me {
1053
1081
  }
1054
1082
  }
1055
1083
  }
1056
- function d(s, e = {}, ...t) {
1084
+ function u(s, e = {}, ...t) {
1057
1085
  const i = document.createElement(s);
1058
1086
  for (const [r, a] of Object.entries(e))
1059
1087
  if (a != null)
@@ -1070,16 +1098,16 @@ function d(s, e = {}, ...t) {
1070
1098
  return i;
1071
1099
  }
1072
1100
  function oe({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a = 0.5, onChange: o }) {
1073
- const n = s.includes("-") ? s.split("-").slice(1).join("-") : s, l = d("div", {
1101
+ const n = s.includes("-") ? s.split("-").slice(1).join("-") : s, l = u("div", {
1074
1102
  className: "slider-control slider-wrapper",
1075
1103
  "data-control": n,
1076
1104
  "data-testid": `slider-${n}`
1077
- }), c = d(
1105
+ }), c = u(
1078
1106
  "div",
1079
1107
  { className: "slider-header" },
1080
- d("label", { for: s, className: "slider-label" }, e),
1081
- d("span", { className: "slider-value", id: `${s}-value` }, q(a))
1082
- ), u = d("input", {
1108
+ u("label", { for: s, className: "slider-label" }, e),
1109
+ u("span", { className: "slider-value", id: `${s}-value` }, q(a))
1110
+ ), d = u("input", {
1083
1111
  type: "range",
1084
1112
  id: s,
1085
1113
  className: "slider-input",
@@ -1092,8 +1120,8 @@ function oe({ id: s, label: e, min: t = 0, max: i = 1, step: r = 0.01, value: a
1092
1120
  m && (m.textContent = q(p)), o == null || o(p);
1093
1121
  }
1094
1122
  });
1095
- return l.appendChild(c), l.appendChild(u), l.setValue = (h) => {
1096
- u.value = String(h);
1123
+ return l.appendChild(c), l.appendChild(d), l.setValue = (h) => {
1124
+ d.value = String(h);
1097
1125
  const p = l.querySelector(".slider-value");
1098
1126
  p && (p.textContent = q(h));
1099
1127
  }, l;
@@ -1102,24 +1130,24 @@ function q(s) {
1102
1130
  return Number.isInteger(s) ? String(s) : s.toFixed(2);
1103
1131
  }
1104
1132
  function ne({ id: s, label: e, checked: t = !1, onChange: i }) {
1105
- const r = d("div", { className: "toggle-control" }), a = d("label", { className: "toggle-label", for: s }, e), o = d("input", {
1133
+ const r = u("div", { className: "toggle-control" }), a = u("label", { className: "toggle-label", for: s }, e), o = u("input", {
1106
1134
  type: "checkbox",
1107
1135
  id: s,
1108
1136
  className: "toggle-input",
1109
1137
  checked: t ? "checked" : void 0,
1110
1138
  onChange: (c) => i == null ? void 0 : i(c.target.checked)
1111
- }), n = d("div", {
1139
+ }), n = u("div", {
1112
1140
  className: "toggle-switch",
1113
1141
  onClick: (c) => {
1114
1142
  c.target !== o && (o.checked = !o.checked, i == null || i(o.checked));
1115
1143
  }
1116
- }), l = d("span", { className: "toggle-slider" });
1144
+ }), l = u("span", { className: "toggle-slider" });
1117
1145
  return n.appendChild(o), n.appendChild(l), r.appendChild(a), r.appendChild(n), r.setChecked = (c) => {
1118
1146
  o.checked = c;
1119
1147
  }, r;
1120
1148
  }
1121
1149
  function le({ id: s, label: e, value: t = "#000000", onChange: i }) {
1122
- const r = d("div", { className: "color-control" }), a = d("label", { className: "color-label", for: s }, e), o = d("input", {
1150
+ const r = u("div", { className: "color-control" }), a = u("label", { className: "color-label", for: s }, e), o = u("input", {
1123
1151
  type: "color",
1124
1152
  id: s,
1125
1153
  className: "color-input",
@@ -1131,35 +1159,35 @@ function le({ id: s, label: e, value: t = "#000000", onChange: i }) {
1131
1159
  }, r;
1132
1160
  }
1133
1161
  function ce({ id: s, label: e, options: t = [], value: i, onChange: r }) {
1134
- const a = d("div", { className: "select-control" }), o = d("label", { className: "select-label", for: s }, e), n = d("select", {
1162
+ const a = u("div", { className: "select-control" }), o = u("label", { className: "select-label", for: s }, e), n = u("select", {
1135
1163
  id: s,
1136
1164
  className: "select-input",
1137
1165
  onChange: (l) => r == null ? void 0 : r(l.target.value)
1138
1166
  });
1139
1167
  for (const l of t) {
1140
- const c = d("option", { value: l.value }, l.label);
1168
+ const c = u("option", { value: l.value }, l.label);
1141
1169
  l.value === i && (c.selected = !0), n.appendChild(c);
1142
1170
  }
1143
1171
  return a.appendChild(o), a.appendChild(n), a.setValue = (l) => {
1144
1172
  n.value = l;
1145
1173
  }, a;
1146
1174
  }
1147
- function F({ label: s, className: e = "", onClick: t, icon: i = null, disabled: r = !1 }) {
1148
- const a = d("button", {
1175
+ function z({ label: s, className: e = "", onClick: t, icon: i = null, disabled: r = !1 }) {
1176
+ const a = u("button", {
1149
1177
  type: "button",
1150
1178
  className: `btn ${e}`.trim(),
1151
1179
  onClick: t,
1152
1180
  disabled: r ? "disabled" : void 0
1153
1181
  });
1154
1182
  if (i) {
1155
- const o = d("span", { className: "btn-icon" });
1183
+ const o = u("span", { className: "btn-icon" });
1156
1184
  o.innerHTML = i;
1157
1185
  const n = o.querySelector("svg");
1158
1186
  n && n.setAttribute("aria-hidden", "true"), a.appendChild(o);
1159
1187
  }
1160
1188
  return s && a.appendChild(document.createTextNode(s)), a;
1161
1189
  }
1162
- function x({ icon: s, title: e, className: t = "", onClick: i, disabled: r = !1, testId: a = null, ariaLabel: o = null }) {
1190
+ function w({ icon: s, title: e, className: t = "", onClick: i, disabled: r = !1, testId: a = null, ariaLabel: o = null }) {
1163
1191
  const n = {
1164
1192
  type: "button",
1165
1193
  className: `icon-btn ${t}`.trim(),
@@ -1169,24 +1197,24 @@ function x({ icon: s, title: e, className: t = "", onClick: i, disabled: r = !1,
1169
1197
  disabled: r ? "disabled" : void 0
1170
1198
  };
1171
1199
  a && (n.dataset = { testid: a });
1172
- const l = d("button", n);
1200
+ const l = u("button", n);
1173
1201
  l.innerHTML = s;
1174
1202
  const c = l.querySelector("svg");
1175
1203
  return c && c.setAttribute("aria-hidden", "true"), l;
1176
1204
  }
1177
1205
  function Z({ label: s, icon: e, active: t = !1, onClick: i }) {
1178
- const r = d("button", {
1206
+ const r = u("button", {
1179
1207
  type: "button",
1180
1208
  className: `chip ${t ? "active" : ""}`.trim(),
1181
1209
  onClick: i
1182
1210
  });
1183
1211
  if (e) {
1184
- const a = d("span", { className: "chip-icon" });
1212
+ const a = u("span", { className: "chip-icon" });
1185
1213
  a.innerHTML = e;
1186
1214
  const o = a.querySelector("svg");
1187
1215
  o && o.setAttribute("aria-hidden", "true"), r.appendChild(a);
1188
1216
  }
1189
- return r.appendChild(d("span", { className: "chip-label" }, s)), r.setActive = (a) => {
1217
+ return r.appendChild(u("span", { className: "chip-label" }, s)), r.setActive = (a) => {
1190
1218
  r.classList.toggle("active", a);
1191
1219
  }, r;
1192
1220
  }
@@ -1200,8 +1228,8 @@ class je {
1200
1228
  * @returns {HTMLElement}
1201
1229
  */
1202
1230
  render() {
1203
- this.element = d("div", { className: "editor-toolbar" });
1204
- const e = d("div", { className: "toolbar-section toolbar-left" }), t = x({
1231
+ this.element = u("div", { className: "editor-toolbar" });
1232
+ const e = u("div", { className: "toolbar-section toolbar-left" }), t = w({
1205
1233
  icon: Oe,
1206
1234
  title: "Open Image",
1207
1235
  className: "toolbar-btn",
@@ -1210,7 +1238,7 @@ class je {
1210
1238
  onClick: () => this.editor.openFilePicker()
1211
1239
  });
1212
1240
  e.appendChild(t);
1213
- const i = d("div", { className: "toolbar-section toolbar-center" }), r = x({
1241
+ const i = u("div", { className: "toolbar-section toolbar-center" }), r = w({
1214
1242
  icon: Ae,
1215
1243
  title: "Zoom Out",
1216
1244
  className: "toolbar-btn",
@@ -1221,13 +1249,13 @@ class je {
1221
1249
  this.editor.setZoom(h - 0.25);
1222
1250
  }
1223
1251
  });
1224
- this._zoomLabel = d("span", {
1252
+ this._zoomLabel = u("span", {
1225
1253
  className: "zoom-label",
1226
1254
  "aria-live": "polite",
1227
1255
  "aria-atomic": "true",
1228
1256
  role: "status"
1229
1257
  }, "100%");
1230
- const a = x({
1258
+ const a = w({
1231
1259
  icon: Fe,
1232
1260
  title: "Zoom In",
1233
1261
  className: "toolbar-btn",
@@ -1237,7 +1265,7 @@ class je {
1237
1265
  const h = this.state.get("zoom");
1238
1266
  this.editor.setZoom(h + 0.25);
1239
1267
  }
1240
- }), o = x({
1268
+ }), o = w({
1241
1269
  icon: ze,
1242
1270
  title: "Fit to Screen",
1243
1271
  className: "toolbar-btn",
@@ -1246,15 +1274,15 @@ class je {
1246
1274
  onClick: () => this.editor.fitToScreen()
1247
1275
  });
1248
1276
  i.appendChild(r), i.appendChild(this._zoomLabel), i.appendChild(a), i.appendChild(o);
1249
- const n = d("div", { className: "toolbar-section toolbar-right" });
1250
- this._themeBtn = x({
1277
+ const n = u("div", { className: "toolbar-section toolbar-right" });
1278
+ this._themeBtn = w({
1251
1279
  icon: this.state.get("isDarkMode") ? Q : J,
1252
1280
  title: "Toggle Theme",
1253
1281
  className: "toolbar-btn toolbar-btn-theme",
1254
1282
  testId: "btn-toggle-theme",
1255
1283
  ariaLabel: "Toggle theme",
1256
1284
  onClick: () => this.editor.toggleTheme()
1257
- }), this._cropBtn = x({
1285
+ }), this._cropBtn = w({
1258
1286
  icon: ue,
1259
1287
  title: "Crop",
1260
1288
  className: "toolbar-btn toolbar-btn-crop",
@@ -1264,21 +1292,21 @@ class je {
1264
1292
  this.state.get("mode") === "crop" ? this.editor.setMode("filters") : this.editor.setMode("crop");
1265
1293
  }
1266
1294
  });
1267
- const l = x({
1295
+ const l = w({
1268
1296
  icon: pe,
1269
1297
  title: "Reset All",
1270
1298
  className: "toolbar-btn",
1271
1299
  testId: "btn-reset-all",
1272
1300
  ariaLabel: "Reset all changes",
1273
1301
  onClick: () => this.editor.resetAll()
1274
- }), c = x({
1302
+ }), c = w({
1275
1303
  icon: Ye,
1276
1304
  title: "Save Image",
1277
1305
  className: "toolbar-btn toolbar-btn-primary",
1278
1306
  testId: "btn-save-edit",
1279
1307
  ariaLabel: "Save image",
1280
1308
  onClick: () => this.editor.save()
1281
- }), u = x({
1309
+ }), d = w({
1282
1310
  icon: K,
1283
1311
  title: "Close",
1284
1312
  className: "toolbar-btn",
@@ -1286,7 +1314,7 @@ class je {
1286
1314
  ariaLabel: "Close editor",
1287
1315
  onClick: () => this.editor.close()
1288
1316
  });
1289
- return n.appendChild(this._themeBtn), n.appendChild(this._cropBtn), n.appendChild(l), n.appendChild(c), n.appendChild(u), this.element.appendChild(e), this.element.appendChild(i), this.element.appendChild(n), this._subscribeToState(), this.element;
1317
+ return n.appendChild(this._themeBtn), n.appendChild(this._cropBtn), n.appendChild(l), n.appendChild(c), n.appendChild(d), this.element.appendChild(e), this.element.appendChild(i), this.element.appendChild(n), this._subscribeToState(), this.element;
1290
1318
  }
1291
1319
  /**
1292
1320
  * Subscribe to state changes
@@ -1347,15 +1375,15 @@ class qe {
1347
1375
  * @returns {HTMLElement}
1348
1376
  */
1349
1377
  render(e) {
1350
- this._onSelect = e, this.element = d("div", {
1378
+ this._onSelect = e, this.element = u("div", {
1351
1379
  className: "category-carousel-container",
1352
1380
  "data-testid": "category-carousel"
1353
- }), this._leftBtn = x({
1381
+ }), this._leftBtn = w({
1354
1382
  icon: he,
1355
1383
  title: "Previous categories",
1356
1384
  className: "carousel-nav carousel-nav-left",
1357
1385
  onClick: () => this._scrollLeft()
1358
- }), this._carousel = d("div", { className: "category-carousel" }), L.forEach((i) => {
1386
+ }), this._carousel = u("div", { className: "category-carousel" }), L.forEach((i) => {
1359
1387
  const r = Z({
1360
1388
  label: i.name,
1361
1389
  icon: i.icon,
@@ -1363,19 +1391,19 @@ class qe {
1363
1391
  onClick: () => this._selectCategory(i.id)
1364
1392
  });
1365
1393
  r.dataset.categoryId = i.id, r.dataset.category = i.id, r.dataset.testid = `category-${i.id}`, this._chips.set(i.id, r), this._carousel.appendChild(r);
1366
- }), this._rightBtn = x({
1394
+ }), this._rightBtn = w({
1367
1395
  icon: de,
1368
1396
  title: "Next categories",
1369
1397
  className: "carousel-nav carousel-nav-right",
1370
1398
  onClick: () => this._scrollRight()
1371
- }), this._pagination = d("div", {
1399
+ }), this._pagination = u("div", {
1372
1400
  className: "carousel-pagination",
1373
1401
  role: "tablist",
1374
1402
  "aria-label": "Category pages"
1375
1403
  });
1376
1404
  const t = Math.ceil(L.length / 3);
1377
1405
  for (let i = 0; i < t; i++) {
1378
- const r = d("button", {
1406
+ const r = u("button", {
1379
1407
  type: "button",
1380
1408
  className: `pagination-dot ${i === 0 ? "active" : ""}`,
1381
1409
  role: "tab",
@@ -1482,12 +1510,12 @@ class He {
1482
1510
  * @returns {HTMLElement}
1483
1511
  */
1484
1512
  render({ onToggle: e, onSelect: t }) {
1485
- return this._onToggle = e, this._onSelect = t, this.element = d("div", { className: "filter-carousel-container" }), this._leftBtn = x({
1513
+ return this._onToggle = e, this._onSelect = t, this.element = u("div", { className: "filter-carousel-container" }), this._leftBtn = w({
1486
1514
  icon: he,
1487
1515
  title: "Previous filters",
1488
1516
  className: "carousel-nav carousel-nav-left",
1489
1517
  onClick: () => this._scrollLeft()
1490
- }), this._carousel = d("div", { className: "filter-carousel" }), this._rightBtn = x({
1518
+ }), this._carousel = u("div", { className: "filter-carousel" }), this._rightBtn = w({
1491
1519
  icon: de,
1492
1520
  title: "Next filters",
1493
1521
  className: "carousel-nav carousel-nav-right",
@@ -1534,14 +1562,14 @@ class He {
1534
1562
  * @returns {HTMLElement}
1535
1563
  */
1536
1564
  _createFilterCard(e, { isActive: t, isSelected: i }) {
1537
- const r = d("div", {
1565
+ const r = u("div", {
1538
1566
  className: `filter-card ${t ? "active" : ""} ${i ? "selected" : ""}`,
1539
1567
  "data-filter": e.id,
1540
1568
  "data-testid": `filter-${e.id}`,
1541
1569
  onClick: () => this._handleCardClick(e.id)
1542
- }), a = d("div", { className: "filter-preview" }), o = d("span", { className: "filter-preview-text" }, e.name.charAt(0));
1570
+ }), a = u("div", { className: "filter-preview" }), o = u("span", { className: "filter-preview-text" }, e.name.charAt(0));
1543
1571
  a.appendChild(o);
1544
- const n = d("span", { className: "filter-name", title: e.name }, e.name), l = d("button", {
1572
+ const n = u("span", { className: "filter-name", title: e.name }, e.name), l = u("button", {
1545
1573
  className: `filter-toggle ${t ? "active" : ""}`,
1546
1574
  onClick: (c) => {
1547
1575
  var p;
@@ -1639,7 +1667,7 @@ class $e {
1639
1667
  * @returns {HTMLElement}
1640
1668
  */
1641
1669
  render({ onChange: e, onReset: t, onAction: i }) {
1642
- return this._onChange = e, this._onReset = t, this._onAction = i, this.element = d("div", { className: "filter-adjustments" }), this._subscribeToState(), this._renderControls(), this.element;
1670
+ return this._onChange = e, this._onReset = t, this._onAction = i, this.element = u("div", { className: "filter-adjustments" }), this._subscribeToState(), this._renderControls(), this.element;
1643
1671
  }
1644
1672
  /**
1645
1673
  * Subscribe to state changes
@@ -1662,24 +1690,24 @@ class $e {
1662
1690
  const e = this.state.get("selectedFilter");
1663
1691
  if (!e) {
1664
1692
  this.element.appendChild(
1665
- d("div", { className: "no-filter-selected" }, "Select a filter to adjust")
1693
+ u("div", { className: "no-filter-selected" }, "Select a filter to adjust")
1666
1694
  );
1667
1695
  return;
1668
1696
  }
1669
1697
  const t = this.filterManager.getFilterDef(e);
1670
1698
  if (!t) {
1671
1699
  this.element.appendChild(
1672
- d("div", { className: "no-filter-selected" }, "Filter not found")
1700
+ u("div", { className: "no-filter-selected" }, "Filter not found")
1673
1701
  );
1674
1702
  return;
1675
1703
  }
1676
- const i = d("div", { className: "adjustments-header" });
1677
- i.appendChild(d("span", { className: "adjustments-title" }, t.name)), i.appendChild(F({
1704
+ const i = u("div", { className: "adjustments-header" });
1705
+ i.appendChild(u("span", { className: "adjustments-title" }, t.name)), i.appendChild(z({
1678
1706
  label: "Reset",
1679
1707
  className: "btn-text",
1680
1708
  onClick: () => this._handleReset(e)
1681
1709
  })), this.element.appendChild(i);
1682
- const r = d("div", { className: "adjustments-grid" }), a = this.state.getFilterValues(e);
1710
+ const r = u("div", { className: "adjustments-grid" }), a = this.state.getFilterValues(e);
1683
1711
  t.controls.forEach((o) => {
1684
1712
  const n = this._createControl(e, o, a[o.id] ?? o.default);
1685
1713
  n && (this._controls.set(o.id, n), r.appendChild(n));
@@ -1730,8 +1758,8 @@ class $e {
1730
1758
  onChange: (l) => this._handleChange(e, t.id, l)
1731
1759
  });
1732
1760
  case "button":
1733
- const n = d("div", { className: "button-control" });
1734
- return n.appendChild(F({
1761
+ const n = u("div", { className: "button-control" });
1762
+ return n.appendChild(z({
1735
1763
  label: r,
1736
1764
  className: "btn-secondary",
1737
1765
  onClick: () => this._handleAction(e, t.action || t.id)
@@ -1842,31 +1870,31 @@ class We {
1842
1870
  * @param {Object} callbacks - { onChange, onReset, onRemove, onAction }
1843
1871
  */
1844
1872
  build(e, { onChange: t, onReset: i, onRemove: r, onAction: a }) {
1845
- this._onChange = t, this._onReset = i, this._onRemove = r, this._onAction = a, this._container = e, this._drawer = d("div", { className: "mobile-filter-drawer" });
1846
- const o = d("div", { className: "drawer-header" });
1847
- this._titleEl = d("span", { className: "drawer-title" }, "Filter");
1848
- const n = d("div", { className: "drawer-header-actions" }), l = F({
1873
+ this._onChange = t, this._onReset = i, this._onRemove = r, this._onAction = a, this._container = e, this._drawer = u("div", { className: "mobile-filter-drawer" });
1874
+ const o = u("div", { className: "drawer-header" });
1875
+ this._titleEl = u("span", { className: "drawer-title" }, "Filter");
1876
+ const n = u("div", { className: "drawer-header-actions" }), l = z({
1849
1877
  label: "Reset",
1850
1878
  className: "btn-text",
1851
1879
  onClick: () => {
1852
1880
  var h;
1853
1881
  this._currentFilterId && ((h = this._onReset) == null || h.call(this, this._currentFilterId), this._renderControls());
1854
1882
  }
1855
- }), c = F({
1883
+ }), c = z({
1856
1884
  label: "Remove",
1857
1885
  className: "btn-text btn-danger",
1858
1886
  onClick: () => {
1859
1887
  var h;
1860
1888
  this._currentFilterId && ((h = this._onRemove) == null || h.call(this, this._currentFilterId), this.close());
1861
1889
  }
1862
- }), u = x({
1890
+ }), d = w({
1863
1891
  icon: K,
1864
1892
  title: "Close",
1865
1893
  className: "btn-icon-sm",
1866
1894
  ariaLabel: "Close drawer",
1867
1895
  onClick: () => this.close()
1868
1896
  });
1869
- n.appendChild(l), n.appendChild(c), n.appendChild(u), o.appendChild(this._titleEl), o.appendChild(n), this._drawer.appendChild(o), this._body = d("div", { className: "drawer-body" }), this._drawer.appendChild(this._body), e.appendChild(this._drawer);
1897
+ n.appendChild(l), n.appendChild(c), n.appendChild(d), o.appendChild(this._titleEl), o.appendChild(n), this._drawer.appendChild(o), this._body = u("div", { className: "drawer-body" }), this._drawer.appendChild(this._body), e.appendChild(this._drawer);
1870
1898
  }
1871
1899
  /**
1872
1900
  * Open the drawer for a specific filter
@@ -1916,7 +1944,7 @@ class We {
1916
1944
  const e = this.filterManager.getFilterDef(this._currentFilterId);
1917
1945
  if (!e) return;
1918
1946
  this._titleEl.textContent = e.name;
1919
- const t = d("div", { className: "adjustments-grid" }), i = this.state.getFilterValues(this._currentFilterId);
1947
+ const t = u("div", { className: "adjustments-grid" }), i = this.state.getFilterValues(this._currentFilterId);
1920
1948
  e.controls.forEach((r) => {
1921
1949
  if (r.hidden) return;
1922
1950
  const a = this._createControl(this._currentFilterId, r, i[r.id] ?? r.default);
@@ -1980,8 +2008,8 @@ class We {
1980
2008
  });
1981
2009
  }
1982
2010
  case "button": {
1983
- const o = d("div", { className: "button-control" });
1984
- return o.appendChild(F({
2011
+ const o = u("div", { className: "button-control" });
2012
+ return o.appendChild(z({
1985
2013
  label: r,
1986
2014
  className: "btn-secondary",
1987
2015
  onClick: () => {
@@ -2037,10 +2065,10 @@ class Ze {
2037
2065
  * @returns {HTMLElement}
2038
2066
  */
2039
2067
  render({ onToggle: e, onSelect: t }) {
2040
- return this._onToggle = e, this._onSelect = t, this.element = d("div", {
2068
+ return this._onToggle = e, this._onSelect = t, this.element = u("div", {
2041
2069
  className: "mobile-active-filters",
2042
2070
  "data-testid": "mobile-active-filters"
2043
- }), this._scrollContainer = d("div", { className: "mobile-active-filters-scroll" }), this.element.appendChild(this._scrollContainer), this._subscribeToState(), this._renderChips(), this.element;
2071
+ }), this._scrollContainer = u("div", { className: "mobile-active-filters-scroll" }), this.element.appendChild(this._scrollContainer), this._subscribeToState(), this._renderChips(), this.element;
2044
2072
  }
2045
2073
  _subscribeToState() {
2046
2074
  const e = this.state.on("change:activeFilters", () => {
@@ -2056,7 +2084,7 @@ class Ze {
2056
2084
  this._scrollContainer.innerHTML = "", this._chips.clear();
2057
2085
  const e = this.state.get("activeFilters");
2058
2086
  if (!e || e.size === 0) {
2059
- const t = d("div", {
2087
+ const t = u("div", {
2060
2088
  className: "active-filter-placeholder"
2061
2089
  }, "No active filters");
2062
2090
  this._scrollContainer.appendChild(t);
@@ -2070,17 +2098,17 @@ class Ze {
2070
2098
  }), this._updateSelectedState();
2071
2099
  }
2072
2100
  _createChip(e, t) {
2073
- const i = d("div", {
2101
+ const i = u("div", {
2074
2102
  className: "active-filter-chip",
2075
2103
  "data-filter-id": e,
2076
2104
  "data-testid": `active-chip-${e}`
2077
- }), r = d("span", {
2105
+ }), r = u("span", {
2078
2106
  className: "active-filter-chip-label",
2079
2107
  onClick: (o) => {
2080
2108
  var n;
2081
2109
  o.stopPropagation(), (n = this._onSelect) == null || n.call(this, e);
2082
2110
  }
2083
- }, t.name), a = d("button", {
2111
+ }, t.name), a = u("button", {
2084
2112
  className: "active-filter-chip-check",
2085
2113
  "aria-label": `Remove ${t.name} filter`,
2086
2114
  onClick: (o) => {
@@ -2130,39 +2158,39 @@ class Qe {
2130
2158
  * @returns {HTMLElement}
2131
2159
  */
2132
2160
  render() {
2133
- this.element = d("div", {
2161
+ this.element = u("div", {
2134
2162
  className: "crop-controls",
2135
2163
  "data-testid": "crop-controls"
2136
2164
  });
2137
- const e = d("div", { className: "crop-section" });
2138
- e.appendChild(d("label", { className: "section-label" }, "Shape"));
2139
- const t = d("div", { className: "chip-row" }), i = this.state.get("crop.shape");
2165
+ const e = u("div", { className: "crop-section" });
2166
+ e.appendChild(u("label", { className: "section-label" }, "Shape"));
2167
+ const t = u("div", { className: "chip-row" }), i = this.state.get("crop.shape");
2140
2168
  Ge.forEach((c) => {
2141
- const u = Z({
2169
+ const d = Z({
2142
2170
  label: c.name,
2143
2171
  icon: c.icon,
2144
2172
  active: i === c.id,
2145
2173
  onClick: () => this._selectShape(c.id)
2146
2174
  });
2147
- u.dataset.shape = c.id, u.dataset.testid = `crop-shape-${c.id}`, this._shapeChips.set(c.id, u), t.appendChild(u);
2148
- }), e.appendChild(t), this.element.appendChild(e), this.state.get("lockCropShape") && (e.style.display = "none"), this._shapeSection = e, this._aspectSection = d("div", { className: "crop-section" }), this._aspectSection.appendChild(d("label", { className: "section-label" }, "Aspect Ratio"));
2149
- const r = d("div", { className: "chip-row aspect-row" }), a = this.state.get("crop.aspect");
2175
+ d.dataset.shape = c.id, d.dataset.testid = `crop-shape-${c.id}`, this._shapeChips.set(c.id, d), t.appendChild(d);
2176
+ }), e.appendChild(t), this.element.appendChild(e), this.state.get("lockCropShape") && (e.style.display = "none"), this._shapeSection = e, this._aspectSection = u("div", { className: "crop-section" }), this._aspectSection.appendChild(u("label", { className: "section-label" }, "Aspect Ratio"));
2177
+ const r = u("div", { className: "chip-row aspect-row" }), a = this.state.get("crop.aspect");
2150
2178
  Ke.forEach((c) => {
2151
- const u = Z({
2179
+ const d = Z({
2152
2180
  label: c.name,
2153
2181
  active: a === c.id,
2154
2182
  onClick: () => this._selectAspect(c.id)
2155
2183
  });
2156
- u.dataset.ratio = c.id, u.dataset.testid = `crop-ratio-${c.id}`, this._aspectChips.set(c.id, u), r.appendChild(u);
2184
+ d.dataset.ratio = c.id, d.dataset.testid = `crop-ratio-${c.id}`, this._aspectChips.set(c.id, d), r.appendChild(d);
2157
2185
  }), this._aspectSection.appendChild(r), this.element.appendChild(this._aspectSection), this._updateAspectVisibility();
2158
- const o = d("div", { className: "crop-actions" }), n = F({
2186
+ const o = u("div", { className: "crop-actions" }), n = z({
2159
2187
  label: "Cancel",
2160
2188
  className: "btn-secondary crop-cancel-btn",
2161
2189
  icon: K,
2162
2190
  onClick: () => this.cropManager.cancel()
2163
2191
  });
2164
2192
  n.dataset.testid = "cancel-crop";
2165
- const l = F({
2193
+ const l = z({
2166
2194
  label: "Apply Crop",
2167
2195
  className: "btn-primary crop-apply-btn",
2168
2196
  icon: G,
@@ -2238,18 +2266,18 @@ class Je {
2238
2266
  * @returns {HTMLElement}
2239
2267
  */
2240
2268
  render({ onRemove: e, onReset: t, onClearAll: i, onUpdateValue: r, onSelect: a }) {
2241
- this._onRemove = e, this._onReset = t, this._onClearAll = i, this._onUpdateValue = r, this._onSelect = a, this.element = d("div", {
2269
+ this._onRemove = e, this._onReset = t, this._onClearAll = i, this._onUpdateValue = r, this._onSelect = a, this.element = u("div", {
2242
2270
  className: "active-filters-panel",
2243
2271
  "data-testid": "active-filters-panel"
2244
2272
  });
2245
- const o = d("div", { className: "panel-header" });
2246
- o.appendChild(d("h3", { className: "panel-title" }, "Active Filters"));
2247
- const n = F({
2273
+ const o = u("div", { className: "panel-header" });
2274
+ o.appendChild(u("h3", { className: "panel-title" }, "Active Filters"));
2275
+ const n = z({
2248
2276
  label: "Clear All",
2249
2277
  className: "btn-text btn-danger",
2250
2278
  onClick: () => this._handleClearAll()
2251
2279
  });
2252
- return n.dataset.testid = "clear-all-filters", o.appendChild(n), this.element.appendChild(o), this._listContainer = d("div", { className: "active-filters-list" }), this.element.appendChild(this._listContainer), this._subscribeToState(), this._renderFilterList(), this.element;
2280
+ return n.dataset.testid = "clear-all-filters", o.appendChild(n), this.element.appendChild(o), this._listContainer = u("div", { className: "active-filters-list" }), this.element.appendChild(this._listContainer), this._subscribeToState(), this._renderFilterList(), this.element;
2253
2281
  }
2254
2282
  /**
2255
2283
  * Subscribe to state changes
@@ -2285,7 +2313,7 @@ class Je {
2285
2313
  const e = this.state.get("activeFilters");
2286
2314
  if (e.size === 0) {
2287
2315
  this._listContainer.appendChild(
2288
- d("div", { className: "no-filters-message" }, "No filters active")
2316
+ u("div", { className: "no-filters-message" }, "No filters active")
2289
2317
  );
2290
2318
  return;
2291
2319
  }
@@ -2303,26 +2331,26 @@ class Je {
2303
2331
  * @returns {HTMLElement}
2304
2332
  */
2305
2333
  _createFilterItem(e, t) {
2306
- const r = this.state.get("selectedFilter") === e, a = d("div", {
2334
+ const r = this.state.get("selectedFilter") === e, a = u("div", {
2307
2335
  className: `active-filter-item ${r ? "selected" : ""}`,
2308
2336
  "data-active-filter": e,
2309
2337
  "data-testid": `active-filter-${e}`,
2310
2338
  onClick: (m) => {
2311
2339
  m.target.closest(".filter-item-actions") || this._handleSelect(e);
2312
2340
  }
2313
- }), o = d("div", { className: "filter-item-header" }), n = d("span", { className: "filter-item-name" }, t.name), l = d("div", { className: "filter-item-actions" }), c = x({
2341
+ }), o = u("div", { className: "filter-item-header" }), n = u("span", { className: "filter-item-name" }, t.name), l = u("div", { className: "filter-item-actions" }), c = w({
2314
2342
  icon: pe,
2315
2343
  title: "Reset filter",
2316
2344
  className: "btn-icon-sm",
2317
2345
  onClick: () => this._handleReset(e)
2318
- }), u = x({
2346
+ }), d = w({
2319
2347
  icon: Be,
2320
2348
  title: "Remove filter",
2321
2349
  className: "btn-icon-sm btn-danger",
2322
2350
  onClick: () => this._handleRemove(e)
2323
2351
  });
2324
- l.appendChild(c), l.appendChild(u), o.appendChild(n), o.appendChild(l), a.appendChild(o);
2325
- const h = this.state.getFilterValues(e), p = d("div", { className: "filter-item-summary" });
2352
+ l.appendChild(c), l.appendChild(d), o.appendChild(n), o.appendChild(l), a.appendChild(o);
2353
+ const h = this.state.getFilterValues(e), p = u("div", { className: "filter-item-summary" });
2326
2354
  return p.textContent = this._getValuesSummary(t, h), a.appendChild(p), a._summaryEl = p, a;
2327
2355
  }
2328
2356
  /**
@@ -2531,13 +2559,13 @@ class ei extends B {
2531
2559
  * Build DOM structure
2532
2560
  */
2533
2561
  _buildDOM() {
2534
- this._container.innerHTML = "", this._editorEl = d("div", {
2562
+ this._container.innerHTML = "", this._editorEl = u("div", {
2535
2563
  className: `vanilla-image-editor ${this._state.get("isDarkMode") ? "dark" : "light"}`
2536
2564
  });
2537
- const e = d("div", { className: "editor-toolbar-container" });
2565
+ const e = u("div", { className: "editor-toolbar-container" });
2538
2566
  this._editorEl.appendChild(e), this._toolbarContainer = e;
2539
- const t = d("div", { className: "editor-content" }), i = d("div", { className: "canvas-section" });
2540
- this._canvasContainer = d("div", { className: "canvas-container" }), this._cropOverlay = d("canvas", { className: "crop-overlay", "aria-hidden": "true" }), i.appendChild(this._canvasContainer), i.appendChild(this._cropOverlay), t.appendChild(i), this._controlsSection = d("div", { className: "controls-section" }), t.appendChild(this._controlsSection), this._editorEl.appendChild(t), this._fileInput = d("input", {
2567
+ const t = u("div", { className: "editor-content" }), i = u("div", { className: "canvas-section" });
2568
+ this._canvasContainer = u("div", { className: "canvas-container" }), this._cropOverlay = u("canvas", { className: "crop-overlay", "aria-hidden": "true" }), i.appendChild(this._canvasContainer), i.appendChild(this._cropOverlay), t.appendChild(i), this._controlsSection = u("div", { className: "controls-section" }), t.appendChild(this._controlsSection), this._editorEl.appendChild(t), this._fileInput = u("input", {
2541
2569
  type: "file",
2542
2570
  accept: "image/*",
2543
2571
  className: "hidden-file-input",
@@ -2549,9 +2577,9 @@ class ei extends B {
2549
2577
  * Initialize UI components
2550
2578
  */
2551
2579
  _initUI() {
2552
- this._toolbar = new je(this._state, this), this._toolbarContainer.appendChild(this._toolbar.render()), this._filterControlsEl = d("div", { className: "filter-controls-container" }), this._categoryCarousel = new qe(this._state, this), this._filterControlsEl.appendChild(this._categoryCarousel.render((r) => {
2580
+ this._toolbar = new je(this._state, this), this._toolbarContainer.appendChild(this._toolbar.render()), this._filterControlsEl = u("div", { className: "filter-controls-container" }), this._categoryCarousel = new qe(this._state, this), this._filterControlsEl.appendChild(this._categoryCarousel.render((r) => {
2553
2581
  }));
2554
- const e = d("div", { className: "filter-layout" }), t = d("div", { className: "filter-left-column" });
2582
+ const e = u("div", { className: "filter-layout" }), t = u("div", { className: "filter-left-column" });
2555
2583
  this._filterCarousel = new He(this._state, this._filterManager), t.appendChild(this._filterCarousel.render({
2556
2584
  onToggle: (r, a) => this._handleFilterToggle(r, a),
2557
2585
  onSelect: (r) => {
@@ -2562,7 +2590,7 @@ class ei extends B {
2562
2590
  onReset: (r) => this._handleFilterReset(r),
2563
2591
  onAction: (r, a) => this._handleFilterAction(r, a)
2564
2592
  })), e.appendChild(t);
2565
- const i = d("div", { className: "filter-right-column" });
2593
+ const i = u("div", { className: "filter-right-column" });
2566
2594
  this._activeFiltersPanel = new Je(this._state, this._filterManager), i.appendChild(this._activeFiltersPanel.render({
2567
2595
  onRemove: (r) => this._handleFilterToggle(r, !1),
2568
2596
  onReset: (r) => this._handleFilterReset(r),
@@ -2719,12 +2747,18 @@ class ei extends B {
2719
2747
  * @param {Object} state - ImageEditorSessionState
2720
2748
  */
2721
2749
  _hydrateState(e) {
2722
- if (!(!e || e.version !== 1) && (e.crop && (e.crop.rect && this._state.set("crop.rect", { ...e.crop.rect }), e.crop.shape && this._state.set("crop.shape", e.crop.shape), e.crop.aspectRatio && this._state.set("crop.aspect", e.crop.aspectRatio)), Array.isArray(e.filters))) {
2723
- for (const t of e.filters)
2724
- if (t.enabled && (this._state.toggleFilter(t.id, !0), this._filterManager.initializeValues(t.id), t.values))
2725
- for (const [i, r] of Object.entries(t.values))
2726
- this._state.setFilterValue(t.id, i, r);
2727
- this._filterManager.applyFilters();
2750
+ if (!(!e || e.version !== 1)) {
2751
+ if (e.crop) {
2752
+ const t = e.crop.shape || "free", i = e.crop.aspectRatio || "free";
2753
+ e.crop.rect && (this._cropManager.applyFromPixelRect(e.crop.rect, t), this._state.set("crop.appliedRect", { ...e.crop.rect }), this._state.set("crop.appliedShape", t), this._state.set("crop.appliedAspect", i)), this._state.set("crop.shape", t), this._state.set("crop.aspect", i);
2754
+ }
2755
+ if (Array.isArray(e.filters)) {
2756
+ for (const t of e.filters)
2757
+ if (t.enabled && (this._state.toggleFilter(t.id, !0), this._filterManager.initializeValues(t.id), t.values))
2758
+ for (const [i, r] of Object.entries(t.values))
2759
+ this._state.setFilterValue(t.id, i, r);
2760
+ this._filterManager.applyFilters();
2761
+ }
2728
2762
  }
2729
2763
  }
2730
2764
  /**
@@ -2892,9 +2926,9 @@ class ei extends B {
2892
2926
  _showLoadingOverlay(e) {
2893
2927
  var i;
2894
2928
  if (!this._loadingOverlay)
2895
- this._loadingOverlay = d("div", { className: "editor-loading-overlay" }, [
2896
- d("div", { className: "editor-loading-spinner" }),
2897
- d("div", { className: "editor-loading-text" }, e)
2929
+ this._loadingOverlay = u("div", { className: "editor-loading-overlay" }, [
2930
+ u("div", { className: "editor-loading-spinner" }),
2931
+ u("div", { className: "editor-loading-text" }, e)
2898
2932
  ]);
2899
2933
  else {
2900
2934
  const r = this._loadingOverlay.querySelector(".editor-loading-text");
@@ -2914,36 +2948,36 @@ class ei extends B {
2914
2948
  * Destroy the editor and clean up
2915
2949
  */
2916
2950
  destroy() {
2917
- var e, t, i, r, a, o, n, l, c, u;
2951
+ var e, t, i, r, a, o, n, l, c, d;
2918
2952
  this._destroyed = !0;
2919
2953
  for (const h of this._objectUrls)
2920
2954
  try {
2921
2955
  URL.revokeObjectURL(h);
2922
2956
  } catch {
2923
2957
  }
2924
- this._objectUrls.clear(), (e = this._resizeObserver) == null || e.disconnect(), this._renderer.destroy(), this._cropManager.disable(), this._handleWindowResize && window.removeEventListener("resize", this._handleWindowResize), (t = this._toolbar) == null || t.destroy(), (i = this._categoryCarousel) == null || i.destroy(), (r = this._filterCarousel) == null || r.destroy(), (a = this._filterAdjustments) == null || a.destroy(), (o = this._mobileFilterDrawer) == null || o.destroy(), (n = this._mobileActiveFilters) == null || n.destroy(), (l = this._cropControls) == null || l.destroy(), (c = this._activeFiltersPanel) == null || c.destroy(), (u = this._editorEl) == null || u.remove(), this._container = null, this._state = null, this.emit("destroyed"), this.removeAllListeners();
2958
+ this._objectUrls.clear(), (e = this._resizeObserver) == null || e.disconnect(), this._renderer.destroy(), this._cropManager.disable(), this._handleWindowResize && window.removeEventListener("resize", this._handleWindowResize), (t = this._toolbar) == null || t.destroy(), (i = this._categoryCarousel) == null || i.destroy(), (r = this._filterCarousel) == null || r.destroy(), (a = this._filterAdjustments) == null || a.destroy(), (o = this._mobileFilterDrawer) == null || o.destroy(), (n = this._mobileActiveFilters) == null || n.destroy(), (l = this._cropControls) == null || l.destroy(), (c = this._activeFiltersPanel) == null || c.destroy(), (d = this._editorEl) == null || d.remove(), this._container = null, this._state = null, this.emit("destroyed"), this.removeAllListeners();
2925
2959
  }
2926
2960
  }
2927
- const S = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
2961
+ const k = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
2928
2962
  function tt(s, e) {
2929
2963
  return !Array.isArray(s.mediaTargets) || s.mediaTargets.length === 0 ? !0 : s.mediaTargets.includes(e);
2930
2964
  }
2931
2965
  function f(s) {
2932
2966
  var e;
2933
- return S.has(s.id), S.set(s.id, s), I.has(s.category) || I.set(s.category, []), (e = I.get(s.category)) == null || e.push(s.id), s;
2967
+ return k.has(s.id), k.set(s.id, s), I.has(s.category) || I.set(s.category, []), (e = I.get(s.category)) == null || e.push(s.id), s;
2934
2968
  }
2935
2969
  function it(s) {
2936
- return S.get(s);
2970
+ return k.get(s);
2937
2971
  }
2938
2972
  function U() {
2939
- return Array.from(S.values());
2973
+ return Array.from(k.values());
2940
2974
  }
2941
2975
  function rt() {
2942
- U().map((t) => t.id), Object.entries(g).filter(
2976
+ U().map((t) => t.id), Object.entries(b).filter(
2943
2977
  (t) => /Filter$/.test(t[0]) && typeof t[1] == "function"
2944
2978
  ).forEach(([t, i]) => {
2945
2979
  const r = t.replace(/Filter$/, "").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
2946
- S.has(r) || f({
2980
+ k.has(r) || f({
2947
2981
  id: r,
2948
2982
  name: t.replace(/Filter$/, ""),
2949
2983
  category: "unlisted",
@@ -2963,19 +2997,19 @@ function rt() {
2963
2997
  });
2964
2998
  }
2965
2999
  function st(s) {
2966
- return (I.get(s) || []).map((t) => S.get(t)).filter(Boolean);
3000
+ return (I.get(s) || []).map((t) => k.get(t)).filter(Boolean);
2967
3001
  }
2968
3002
  function at() {
2969
3003
  return Array.from(I.keys());
2970
3004
  }
2971
3005
  function ti(s) {
2972
- return S.has(s);
3006
+ return k.has(s);
2973
3007
  }
2974
3008
  function ot(s) {
2975
- const e = S.get(s);
3009
+ const e = k.get(s);
2976
3010
  if (!e)
2977
3011
  return !1;
2978
- S.delete(s);
3012
+ k.delete(s);
2979
3013
  const t = I.get(e.category);
2980
3014
  if (t) {
2981
3015
  const i = t.indexOf(s);
@@ -2984,11 +3018,11 @@ function ot(s) {
2984
3018
  return !0;
2985
3019
  }
2986
3020
  function ii(s, e) {
2987
- const t = S.get(s);
3021
+ const t = k.get(s);
2988
3022
  return t ? tt(t, e) : !1;
2989
3023
  }
2990
3024
  function nt() {
2991
- return Array.from(S.values()).map((s) => ({
3025
+ return Array.from(k.values()).map((s) => ({
2992
3026
  id: s.id,
2993
3027
  name: s.name,
2994
3028
  category: s.category,
@@ -2996,17 +3030,17 @@ function nt() {
2996
3030
  }));
2997
3031
  }
2998
3032
  if (typeof window < "u") {
2999
- window.__DEBUG_FILTERS_LIST = Array.from(S.keys()), window.getAllFilters = U, window.getFilter = it, window.getFiltersByCategory = st, window.getRegisteredFilters = nt;
3033
+ window.__DEBUG_FILTERS_LIST = Array.from(k.keys()), window.getAllFilters = U, window.getFilter = it, window.getFiltersByCategory = st, window.getRegisteredFilters = nt;
3000
3034
  const s = f;
3001
3035
  window.registerFilter = (e) => {
3002
3036
  const t = s(e);
3003
- return window.__DEBUG_FILTERS_LIST = Array.from(S.keys()), t;
3037
+ return window.__DEBUG_FILTERS_LIST = Array.from(k.keys()), t;
3004
3038
  };
3005
3039
  }
3006
3040
  typeof window < "u" && (window.initializeFilterRegistry = window.initializeFilterRegistry || function() {
3007
3041
  return [];
3008
3042
  });
3009
- const { AdjustmentFilter: lt } = g, { ColorMatrixFilter: ct } = w, k = {
3043
+ const { AdjustmentFilter: lt } = b, { ColorMatrixFilter: ct } = S, M = {
3010
3044
  gamma: 1,
3011
3045
  saturation: 1,
3012
3046
  contrast: 1,
@@ -3025,7 +3059,7 @@ const { AdjustmentFilter: lt } = g, { ColorMatrixFilter: ct } = w, k = {
3025
3059
  "blue",
3026
3060
  "alpha"
3027
3061
  ]);
3028
- function P(s, e) {
3062
+ function F(s, e) {
3029
3063
  if (typeof s == "number" && Number.isFinite(s))
3030
3064
  return s;
3031
3065
  if (typeof s == "string") {
@@ -3040,14 +3074,14 @@ function ee(s) {
3040
3074
  }
3041
3075
  function dt(s) {
3042
3076
  return {
3043
- gamma: P(s.gamma, k.gamma),
3044
- saturation: P(s.saturation, k.saturation),
3045
- contrast: P(s.contrast, k.contrast),
3046
- brightness: P(s.brightness, k.brightness),
3047
- red: P(s.red, k.red),
3048
- green: P(s.green, k.green),
3049
- blue: P(s.blue, k.blue),
3050
- alpha: P(s.alpha, k.alpha)
3077
+ gamma: F(s.gamma, M.gamma),
3078
+ saturation: F(s.saturation, M.saturation),
3079
+ contrast: F(s.contrast, M.contrast),
3080
+ brightness: F(s.brightness, M.brightness),
3081
+ red: F(s.red, M.red),
3082
+ green: F(s.green, M.green),
3083
+ blue: F(s.blue, M.blue),
3084
+ alpha: F(s.alpha, M.alpha)
3051
3085
  };
3052
3086
  }
3053
3087
  function te(s, e) {
@@ -3068,10 +3102,10 @@ f({
3068
3102
  try {
3069
3103
  if (!ee(o))
3070
3104
  return;
3071
- const l = this._customParams ?? { ...k }, c = P(n, l[o]);
3105
+ const l = this._customParams ?? { ...M }, c = F(n, l[o]);
3072
3106
  l[o] = c, this._customParams = l;
3073
- const u = this;
3074
- o in u && (u[o] = c);
3107
+ const d = this;
3108
+ o in d && (d[o] = c);
3075
3109
  } catch {
3076
3110
  }
3077
3111
  }, i;
@@ -3081,8 +3115,8 @@ f({
3081
3115
  try {
3082
3116
  if (!ee(n))
3083
3117
  return;
3084
- const c = this._customParams ?? { ...k }, u = P(l, c[n]);
3085
- c[n] = u, this._customParams = c, te(this, c);
3118
+ const c = this._customParams ?? { ...M }, d = F(l, c[n]);
3119
+ c[n] = d, this._customParams = c, te(this, c);
3086
3120
  } catch {
3087
3121
  }
3088
3122
  }, r;
@@ -3186,7 +3220,7 @@ f({
3186
3220
  }
3187
3221
  ]
3188
3222
  });
3189
- const { ColorMatrixFilter: ut } = w, N = {
3223
+ const { ColorMatrixFilter: ut } = S, N = {
3190
3224
  brightness: 1,
3191
3225
  contrast: 1,
3192
3226
  saturation: 1,
@@ -3344,7 +3378,7 @@ f({
3344
3378
  // Create an instance of the ColorMatrixFilter with alpha adjustment
3345
3379
  createFilter: (s) => {
3346
3380
  try {
3347
- const e = s.alpha !== void 0 ? s.alpha : 1, t = new w.ColorMatrixFilter();
3381
+ const e = s.alpha !== void 0 ? s.alpha : 1, t = new S.ColorMatrixFilter();
3348
3382
  return t.alpha = e, t._customParams = {
3349
3383
  alpha: e
3350
3384
  }, t.updateUIParam = function(i, r) {
@@ -3391,7 +3425,7 @@ f({
3391
3425
  */
3392
3426
  createFilter: (s) => {
3393
3427
  try {
3394
- const e = new w.BlurFilter({
3428
+ const e = new S.BlurFilter({
3395
3429
  strength: s.blur || 8,
3396
3430
  quality: s.quality || 4
3397
3431
  });
@@ -3450,7 +3484,7 @@ f({
3450
3484
  description: "Advanced color adjustments including sepia, hue rotation, and more",
3451
3485
  // Create an instance of the ColorMatrixFilter with the provided parameters
3452
3486
  createFilter: (s) => {
3453
- const e = w.ColorMatrixFilter;
3487
+ const e = S.ColorMatrixFilter;
3454
3488
  if (!e)
3455
3489
  return null;
3456
3490
  const t = new e();
@@ -3530,7 +3564,7 @@ f({
3530
3564
  }
3531
3565
  ]
3532
3566
  });
3533
- const { ColorOverlayFilter: gt } = g;
3567
+ const { ColorOverlayFilter: gt } = b;
3534
3568
  f({
3535
3569
  id: "colorOverlay",
3536
3570
  name: "Color Overlay",
@@ -3609,7 +3643,7 @@ f({
3609
3643
  const e = s.color ? s.color.replace("#", "0x") : "0x000000", t = s.distance !== void 0 ? s.distance : 5, i = s.angle !== void 0 ? s.angle : 90, r = {
3610
3644
  x: t * Math.cos(i * Math.PI / 180),
3611
3645
  y: t * Math.sin(i * Math.PI / 180)
3612
- }, a = new g.DropShadowFilter({
3646
+ }, a = new b.DropShadowFilter({
3613
3647
  offset: r,
3614
3648
  color: parseInt(e, 16),
3615
3649
  alpha: s.alpha !== void 0 ? s.alpha : 0.5,
@@ -3633,8 +3667,8 @@ f({
3633
3667
  switch (this._customParams = l, l[o] = n, o) {
3634
3668
  case "color":
3635
3669
  if (typeof n == "string") {
3636
- const u = parseInt(n.replace("#", "0x"), 16);
3637
- this.color = u;
3670
+ const d = parseInt(n.replace("#", "0x"), 16);
3671
+ this.color = d;
3638
3672
  }
3639
3673
  break;
3640
3674
  case "alpha":
@@ -3777,7 +3811,7 @@ f({
3777
3811
  }
3778
3812
  ]
3779
3813
  });
3780
- const { ColorMatrixFilter: bt } = w;
3814
+ const { ColorMatrixFilter: bt } = S;
3781
3815
  f({
3782
3816
  id: "grayscale",
3783
3817
  name: "Grayscale",
@@ -3830,7 +3864,7 @@ f({
3830
3864
  function re(s, e) {
3831
3865
  s.reset(), s.greyscale(e);
3832
3866
  }
3833
- const { HslAdjustmentFilter: yt } = g;
3867
+ const { HslAdjustmentFilter: yt } = b;
3834
3868
  f({
3835
3869
  id: "hsl-adjustment",
3836
3870
  name: "HSL Adjustment",
@@ -3940,7 +3974,7 @@ f({
3940
3974
  }
3941
3975
  ]
3942
3976
  });
3943
- const { KawaseBlurFilter: _t } = g;
3977
+ const { KawaseBlurFilter: _t } = b;
3944
3978
  f({
3945
3979
  id: "kawase-blur",
3946
3980
  name: "Kawase Blur",
@@ -4058,7 +4092,7 @@ f({
4058
4092
  }
4059
4093
  ]
4060
4094
  });
4061
- const { MotionBlurFilter: xt } = g;
4095
+ const { MotionBlurFilter: xt } = b;
4062
4096
  f({
4063
4097
  id: "motion-blur",
4064
4098
  name: "Motion Blur",
@@ -4166,7 +4200,7 @@ f({
4166
4200
  }
4167
4201
  ]
4168
4202
  });
4169
- const { RadialBlurFilter: Ct } = g;
4203
+ const { RadialBlurFilter: Ct } = b;
4170
4204
  f({
4171
4205
  id: "radial-blur",
4172
4206
  name: "Radial Blur",
@@ -4290,7 +4324,7 @@ f({
4290
4324
  }
4291
4325
  ]
4292
4326
  });
4293
- const { TiltShiftFilter: wt } = g;
4327
+ const { TiltShiftFilter: wt } = b;
4294
4328
  f({
4295
4329
  id: "tilt-shift",
4296
4330
  name: "Tilt Shift",
@@ -4314,28 +4348,28 @@ f({
4314
4348
  endY: o
4315
4349
  }, n.updateUIParam = function(l, c) {
4316
4350
  try {
4317
- const u = Number(c), h = this._customParams || {};
4318
- switch (this._customParams = h, h[l] = u, l) {
4351
+ const d = Number(c), h = this._customParams || {};
4352
+ switch (this._customParams = h, h[l] = d, l) {
4319
4353
  case "blur":
4320
- this.blur = u;
4354
+ this.blur = d;
4321
4355
  break;
4322
4356
  case "gradientBlur":
4323
- this.gradientBlur = u;
4357
+ this.gradientBlur = d;
4324
4358
  break;
4325
4359
  case "startX":
4326
- this.start && typeof this.start == "object" && (this.start.x = u);
4360
+ this.start && typeof this.start == "object" && (this.start.x = d);
4327
4361
  break;
4328
4362
  case "startY":
4329
- this.start && typeof this.start == "object" && (this.start.y = u);
4363
+ this.start && typeof this.start == "object" && (this.start.y = d);
4330
4364
  break;
4331
4365
  case "endX":
4332
- this.end && typeof this.end == "object" && (this.end.x = u);
4366
+ this.end && typeof this.end == "object" && (this.end.x = d);
4333
4367
  break;
4334
4368
  case "endY":
4335
- this.end && typeof this.end == "object" && (this.end.y = u);
4369
+ this.end && typeof this.end == "object" && (this.end.y = d);
4336
4370
  break;
4337
4371
  default:
4338
- l in this && (this[l] = u);
4372
+ l in this && (this[l] = d);
4339
4373
  break;
4340
4374
  }
4341
4375
  } catch {
@@ -4418,7 +4452,7 @@ f({
4418
4452
  }
4419
4453
  ]
4420
4454
  });
4421
- const { ZoomBlurFilter: St } = g;
4455
+ const { ZoomBlurFilter: St } = b;
4422
4456
  f({
4423
4457
  id: "zoom-blur",
4424
4458
  name: "Zoom Blur",
@@ -4545,7 +4579,7 @@ f({
4545
4579
  }
4546
4580
  ]
4547
4581
  });
4548
- const { ColorGradientFilter: se } = g;
4582
+ const { ColorGradientFilter: se } = b;
4549
4583
  f({
4550
4584
  id: "color-gradient",
4551
4585
  name: "Color Gradient",
@@ -4649,8 +4683,8 @@ f({
4649
4683
  }));
4650
4684
  break;
4651
4685
  case "removeColorStop":
4652
- const u = [...this.stops];
4653
- u.length > 2 && (u.pop(), this.stops = u, a.colorStops = this.stops.map((h) => ({
4686
+ const d = [...this.stops];
4687
+ d.length > 2 && (d.pop(), this.stops = d, a.colorStops = this.stops.map((h) => ({
4654
4688
  offset: h.offset,
4655
4689
  color: typeof h.color == "number" ? "#" + h.color.toString(16).padStart(6, "0") : h.color,
4656
4690
  alpha: h.alpha
@@ -4682,9 +4716,9 @@ f({
4682
4716
  if (/colorStops\[\d+\]\..*/.test(i)) {
4683
4717
  const h = i.match(/colorStops\[(\d+)\]\.(.*)/);
4684
4718
  if (h) {
4685
- const [p, m, C] = h, b = parseInt(m), y = [...this.stops];
4686
- if (b >= 0 && b < y.length)
4687
- return C === "color" && typeof r == "string" ? y[b].color = parseInt(r.replace("#", "0x")) : (C === "offset" || C === "alpha") && (y[b][C] = r), this.stops = y, this.stops.sort((A, _) => A.offset - _.offset), a.colorStops = this.getColorStopsForUI(), !0;
4719
+ const [p, m, x] = h, g = parseInt(m), y = [...this.stops];
4720
+ if (g >= 0 && g < y.length)
4721
+ return x === "color" && typeof r == "string" ? y[g].color = parseInt(r.replace("#", "0x")) : (x === "offset" || x === "alpha") && (y[g][x] = r), this.stops = y, this.stops.sort((P, _) => P.offset - _.offset), a.colorStops = this.getColorStopsForUI(), !0;
4688
4722
  }
4689
4723
  } else i in this && (this[i] = r);
4690
4724
  break;
@@ -4797,11 +4831,11 @@ f({
4797
4831
  // Create an instance of the ColorMapFilter with the provided parameters
4798
4832
  createFilter: (s) => {
4799
4833
  try {
4800
- const e = g.ColorMapFilter;
4834
+ const e = b.ColorMapFilter;
4801
4835
  if (!e)
4802
4836
  return null;
4803
4837
  let t = null;
4804
- s.texturePath ? t = w.Texture.from(s.texturePath) : t = w.Texture.from("/examples/filters-main/examples/images/colormap.png");
4838
+ s.texturePath ? t = S.Texture.from(s.texturePath) : t = S.Texture.from("/examples/filters-main/examples/images/colormap.png");
4805
4839
  const i = new e({
4806
4840
  colorMap: t,
4807
4841
  nearest: s.nearest,
@@ -4811,7 +4845,7 @@ f({
4811
4845
  const o = this._customParams || {};
4812
4846
  switch (this._customParams = o, o[r] = a, r) {
4813
4847
  case "texturePath":
4814
- a && (this.colorMap = w.Texture.from(a));
4848
+ a && (this.colorMap = S.Texture.from(a));
4815
4849
  break;
4816
4850
  case "mix":
4817
4851
  this.mix = a;
@@ -4872,7 +4906,7 @@ f({
4872
4906
  }
4873
4907
  ]
4874
4908
  });
4875
- const vt = g.ColorReplaceFilter;
4909
+ const vt = b.ColorReplaceFilter;
4876
4910
  f({
4877
4911
  id: "color-replace",
4878
4912
  name: "Color Replace",
@@ -4953,7 +4987,7 @@ f({
4953
4987
  }
4954
4988
  ]
4955
4989
  });
4956
- const kt = g.MultiColorReplaceFilter;
4990
+ const kt = b.MultiColorReplaceFilter;
4957
4991
  f({
4958
4992
  id: "multi-color-replace",
4959
4993
  name: "Multi-Color Replace",
@@ -5090,7 +5124,7 @@ f({
5090
5124
  }
5091
5125
  ]
5092
5126
  });
5093
- const { RGBSplitFilter: Pt } = g;
5127
+ const { RGBSplitFilter: Pt } = b;
5094
5128
  f({
5095
5129
  id: "rgb-split",
5096
5130
  name: "RGB Split",
@@ -5224,7 +5258,7 @@ f({
5224
5258
  }
5225
5259
  ]
5226
5260
  });
5227
- const { AdvancedBloomFilter: Mt } = g;
5261
+ const { AdvancedBloomFilter: Mt } = b;
5228
5262
  f({
5229
5263
  id: "advanced-bloom",
5230
5264
  name: "Advanced Bloom",
@@ -5380,7 +5414,7 @@ f({
5380
5414
  }
5381
5415
  ]
5382
5416
  });
5383
- const Ft = g.AsciiFilter;
5417
+ const Ft = b.AsciiFilter;
5384
5418
  f({
5385
5419
  id: "ascii",
5386
5420
  name: "ASCII",
@@ -5459,7 +5493,7 @@ f({
5459
5493
  }
5460
5494
  ]
5461
5495
  });
5462
- const At = g.BackdropBlurFilter;
5496
+ const At = b.BackdropBlurFilter;
5463
5497
  f({
5464
5498
  id: "backdrop-blur",
5465
5499
  name: "Backdrop Blur",
@@ -5566,7 +5600,7 @@ f({
5566
5600
  }
5567
5601
  ]
5568
5602
  });
5569
- const { BevelFilter: zt } = g;
5603
+ const { BevelFilter: zt } = b;
5570
5604
  f({
5571
5605
  id: "bevel",
5572
5606
  name: "Bevel",
@@ -5694,7 +5728,7 @@ f({
5694
5728
  }
5695
5729
  ]
5696
5730
  });
5697
- const { BloomFilter: Rt } = g;
5731
+ const { BloomFilter: Rt } = b;
5698
5732
  f({
5699
5733
  id: "bloom",
5700
5734
  name: "Bloom/Glow",
@@ -5719,7 +5753,7 @@ f({
5719
5753
  resolution: r,
5720
5754
  kernelSize: a
5721
5755
  }, o.updateUIParam = function(n, l) {
5722
- var c, u;
5756
+ var c, d;
5723
5757
  try {
5724
5758
  const h = Number(l), p = this._customParams || {};
5725
5759
  switch (this._customParams = p, p[n] = h, n) {
@@ -5727,7 +5761,7 @@ f({
5727
5761
  this.strength && typeof this.strength == "object" && (this.strength.x = h, (c = this._updateStrength) == null || c.call(this));
5728
5762
  break;
5729
5763
  case "strengthY":
5730
- this.strength && typeof this.strength == "object" && (this.strength.y = h, (u = this._updateStrength) == null || u.call(this));
5764
+ this.strength && typeof this.strength == "object" && (this.strength.y = h, (d = this._updateStrength) == null || d.call(this));
5731
5765
  break;
5732
5766
  case "quality":
5733
5767
  this.quality = h;
@@ -5806,7 +5840,7 @@ f({
5806
5840
  }
5807
5841
  ]
5808
5842
  });
5809
- const { BulgePinchFilter: Nt } = g;
5843
+ const { BulgePinchFilter: Nt } = b;
5810
5844
  f({
5811
5845
  id: "bulge-pinch",
5812
5846
  // ID must match what the application expects
@@ -5898,7 +5932,7 @@ f({
5898
5932
  }
5899
5933
  ]
5900
5934
  });
5901
- const { ConvolutionFilter: Tt } = g, E = {
5935
+ const { ConvolutionFilter: Tt } = b, E = {
5902
5936
  normal: [0, 0, 0, 0, 1, 0, 0, 0, 0],
5903
5937
  gaussianBlur: [0.045, 0.122, 0.045, 0.122, 0.332, 0.122, 0.045, 0.122, 0.045],
5904
5938
  boxBlur: [1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9],
@@ -6144,7 +6178,7 @@ f({
6144
6178
  }
6145
6179
  ]
6146
6180
  });
6147
- const { CrossHatchFilter: It } = g;
6181
+ const { CrossHatchFilter: It } = b;
6148
6182
  f({
6149
6183
  id: "cross-hatch",
6150
6184
  name: "Cross Hatch",
@@ -6187,7 +6221,7 @@ f({
6187
6221
  vignettingBlur: typeof s.vignettingBlur == "number" ? s.vignettingBlur : 0.3,
6188
6222
  time: typeof s.time == "number" ? s.time : 0,
6189
6223
  seed: typeof s.seed == "number" ? s.seed : Math.random()
6190
- }, t = new g.CRTFilter(e);
6224
+ }, t = new b.CRTFilter(e);
6191
6225
  return t._customParams = { ...e }, t.updateUIParam = function(i, r) {
6192
6226
  try {
6193
6227
  const a = this._customParams || {};
@@ -6351,7 +6385,7 @@ f({
6351
6385
  }
6352
6386
  ]
6353
6387
  });
6354
- const Et = w.DisplacementFilter, Xt = w.Sprite, $ = w.Texture;
6388
+ const Et = S.DisplacementFilter, Xt = S.Sprite, $ = S.Texture;
6355
6389
  f({
6356
6390
  id: "displacement",
6357
6391
  // ID must match what the application expects
@@ -6462,7 +6496,7 @@ f({
6462
6496
  scale: typeof s.scale == "number" ? s.scale : 1,
6463
6497
  angle: typeof s.angle == "number" ? s.angle : 5,
6464
6498
  grayscale: s.grayscale === !0
6465
- }, t = new g.DotFilter(e);
6499
+ }, t = new b.DotFilter(e);
6466
6500
  return t._customParams = { ...e }, t.updateUIParam = function(i, r) {
6467
6501
  try {
6468
6502
  const a = this._customParams || {};
@@ -6524,7 +6558,7 @@ f({
6524
6558
  }
6525
6559
  ]
6526
6560
  });
6527
- const { EmbossFilter: Yt } = g;
6561
+ const { EmbossFilter: Yt } = b;
6528
6562
  f({
6529
6563
  id: "emboss",
6530
6564
  name: "Emboss",
@@ -6573,7 +6607,7 @@ f({
6573
6607
  }
6574
6608
  ]
6575
6609
  });
6576
- const { GlitchFilter: Bt } = g, R = {
6610
+ const { GlitchFilter: Bt } = b, R = {
6577
6611
  TRANSPARENT: 0,
6578
6612
  ORIGINAL: 1,
6579
6613
  LOOP: 2,
@@ -6618,8 +6652,8 @@ f({
6618
6652
  break;
6619
6653
  case "redX":
6620
6654
  case "redY":
6621
- const u = this.red;
6622
- n === "redX" ? u.x = l : u.y = l, this.red = u;
6655
+ const d = this.red;
6656
+ n === "redX" ? d.x = l : d.y = l, this.red = d;
6623
6657
  break;
6624
6658
  case "greenX":
6625
6659
  case "greenY":
@@ -6828,7 +6862,7 @@ f({
6828
6862
  }
6829
6863
  ]
6830
6864
  });
6831
- const { GlowFilter: Ot } = g;
6865
+ const { GlowFilter: Ot } = b;
6832
6866
  f({
6833
6867
  id: "glow",
6834
6868
  name: "Glow",
@@ -6963,7 +6997,7 @@ f({
6963
6997
  }
6964
6998
  ]
6965
6999
  });
6966
- const { GodrayFilter: Lt } = g;
7000
+ const { GodrayFilter: Lt } = b;
6967
7001
  f({
6968
7002
  id: "godray",
6969
7003
  name: "Godray",
@@ -7125,7 +7159,7 @@ f({
7125
7159
  }
7126
7160
  ]
7127
7161
  });
7128
- const Dt = g.SimpleLightmapFilter, ae = w.Texture;
7162
+ const Dt = b.SimpleLightmapFilter, ae = S.Texture;
7129
7163
  f({
7130
7164
  id: "lightmap",
7131
7165
  name: "Lightmap",
@@ -7162,49 +7196,49 @@ f({
7162
7196
  textureType: e,
7163
7197
  color: t,
7164
7198
  alpha: i
7165
- }, l.updateUIParam = function(c, u) {
7199
+ }, l.updateUIParam = function(c, d) {
7166
7200
  try {
7167
7201
  const h = this._customParams || {};
7168
- switch (this._customParams = h, h[c] = u, c) {
7202
+ switch (this._customParams = h, h[c] = d, c) {
7169
7203
  case "textureType":
7170
- h.textureType = u;
7204
+ h.textureType = d;
7171
7205
  const p = document.createElement("canvas");
7172
7206
  p.width = 256, p.height = 256;
7173
7207
  const m = p.getContext("2d");
7174
7208
  if (m) {
7175
- if (u === "spotlight") {
7209
+ if (d === "spotlight") {
7176
7210
  m.fillStyle = "black", m.fillRect(0, 0, 256, 256);
7177
- const b = m.createRadialGradient(128, 128, 5, 128, 128, 80);
7178
- b.addColorStop(0, "white"), b.addColorStop(0.5, "rgba(255, 255, 255, 0.5)"), b.addColorStop(1, "rgba(0, 0, 0, 0)"), m.fillStyle = b, m.beginPath(), m.arc(128, 128, 100, 0, Math.PI * 2), m.fill();
7179
- } else if (u === "softlight") {
7180
- const b = m.createLinearGradient(0, 0, 256, 256);
7181
- b.addColorStop(0, "white"), b.addColorStop(0.3, "rgba(220, 220, 220, 1)"), b.addColorStop(0.7, "rgba(150, 150, 150, 1)"), b.addColorStop(1, "rgba(80, 80, 80, 1)"), m.fillStyle = b, m.fillRect(0, 0, 256, 256);
7211
+ const g = m.createRadialGradient(128, 128, 5, 128, 128, 80);
7212
+ g.addColorStop(0, "white"), g.addColorStop(0.5, "rgba(255, 255, 255, 0.5)"), g.addColorStop(1, "rgba(0, 0, 0, 0)"), m.fillStyle = g, m.beginPath(), m.arc(128, 128, 100, 0, Math.PI * 2), m.fill();
7213
+ } else if (d === "softlight") {
7214
+ const g = m.createLinearGradient(0, 0, 256, 256);
7215
+ g.addColorStop(0, "white"), g.addColorStop(0.3, "rgba(220, 220, 220, 1)"), g.addColorStop(0.7, "rgba(150, 150, 150, 1)"), g.addColorStop(1, "rgba(80, 80, 80, 1)"), m.fillStyle = g, m.fillRect(0, 0, 256, 256);
7182
7216
  } else {
7183
- const b = m.createRadialGradient(128, 128, 10, 128, 128, 160);
7184
- b.addColorStop(0, "white"), b.addColorStop(0.3, "rgba(220, 220, 220, 1)"), b.addColorStop(0.6, "rgba(150, 150, 150, 1)"), b.addColorStop(1, "black"), m.fillStyle = b, m.fillRect(0, 0, 256, 256);
7217
+ const g = m.createRadialGradient(128, 128, 10, 128, 128, 160);
7218
+ g.addColorStop(0, "white"), g.addColorStop(0.3, "rgba(220, 220, 220, 1)"), g.addColorStop(0.6, "rgba(150, 150, 150, 1)"), g.addColorStop(1, "black"), m.fillStyle = g, m.fillRect(0, 0, 256, 256);
7185
7219
  }
7186
- const C = ae.from(p);
7187
- if (this.lightMap = C, this.enabled !== void 0) {
7188
- const b = this.enabled;
7220
+ const x = ae.from(p);
7221
+ if (this.lightMap = x, this.enabled !== void 0) {
7222
+ const g = this.enabled;
7189
7223
  this.enabled = !1, setTimeout(() => {
7190
- this.enabled = b;
7224
+ this.enabled = g;
7191
7225
  }, 0);
7192
7226
  }
7193
7227
  }
7194
7228
  break;
7195
7229
  case "color":
7196
- h.color = u;
7230
+ h.color = d;
7197
7231
  try {
7198
- typeof u == "string" && u.startsWith("#") ? this.color = parseInt(u.replace("#", "0x"), 16) : this.color = 0;
7232
+ typeof d == "string" && d.startsWith("#") ? this.color = parseInt(d.replace("#", "0x"), 16) : this.color = 0;
7199
7233
  } catch {
7200
7234
  this.color = 0;
7201
7235
  }
7202
7236
  break;
7203
7237
  case "alpha":
7204
- this.alpha = Number(u);
7238
+ this.alpha = Number(d);
7205
7239
  break;
7206
7240
  default:
7207
- c in this && (this[c] = u);
7241
+ c in this && (this[c] = d);
7208
7242
  break;
7209
7243
  }
7210
7244
  } catch {
@@ -7256,7 +7290,7 @@ f({
7256
7290
  }
7257
7291
  ]
7258
7292
  });
7259
- const { NoiseFilter: Ut } = w;
7293
+ const { NoiseFilter: Ut } = S;
7260
7294
  f({
7261
7295
  id: "noise",
7262
7296
  name: "Noise",
@@ -7341,7 +7375,7 @@ f({
7341
7375
  }
7342
7376
  ]
7343
7377
  });
7344
- const { OldFilmFilter: Vt } = g;
7378
+ const { OldFilmFilter: Vt } = b;
7345
7379
  f({
7346
7380
  id: "old-film",
7347
7381
  name: "Old Film",
@@ -7530,7 +7564,7 @@ f({
7530
7564
  }
7531
7565
  ]
7532
7566
  });
7533
- const { OutlineFilter: jt } = g;
7567
+ const { OutlineFilter: jt } = b;
7534
7568
  f({
7535
7569
  id: "outline",
7536
7570
  name: "Outline",
@@ -7630,7 +7664,7 @@ f({
7630
7664
  }
7631
7665
  ]
7632
7666
  });
7633
- const { PixelateFilter: qt } = g;
7667
+ const { PixelateFilter: qt } = b;
7634
7668
  f({
7635
7669
  id: "pixelate",
7636
7670
  name: "Pixelate",
@@ -7721,7 +7755,7 @@ f({
7721
7755
  }
7722
7756
  ]
7723
7757
  });
7724
- const { ReflectionFilter: Ht } = g;
7758
+ const { ReflectionFilter: Ht } = b;
7725
7759
  f({
7726
7760
  id: "reflection",
7727
7761
  // ID must match what the application expects
@@ -7889,7 +7923,7 @@ f({
7889
7923
  }
7890
7924
  ]
7891
7925
  });
7892
- const { ShockwaveFilter: $t } = g;
7926
+ const { ShockwaveFilter: $t } = b;
7893
7927
  f({
7894
7928
  id: "shockwave",
7895
7929
  // ID must match what the application expects
@@ -7899,7 +7933,7 @@ f({
7899
7933
  // Create an instance of the ShockwaveFilter with the provided parameters
7900
7934
  createFilter: (s) => {
7901
7935
  try {
7902
- const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = { x: e, y: t }, r = s.amplitude ?? 30, a = s.wavelength ?? 160, o = s.speed ?? 500, n = s.brightness ?? 1, l = s.radius ?? -1, c = s.time ?? 0, u = new $t({
7936
+ const e = s.centerX ?? 0.5, t = s.centerY ?? 0.5, i = { x: e, y: t }, r = s.amplitude ?? 30, a = s.wavelength ?? 160, o = s.speed ?? 500, n = s.brightness ?? 1, l = s.radius ?? -1, c = s.time ?? 0, d = new $t({
7903
7937
  center: i,
7904
7938
  amplitude: r,
7905
7939
  wavelength: a,
@@ -7908,7 +7942,7 @@ f({
7908
7942
  radius: l,
7909
7943
  time: c
7910
7944
  });
7911
- return u._customParams = { ...s }, u.animating = s.animating ?? !1, u.updateUIParam = function(h, p) {
7945
+ return d._customParams = { ...s }, d.animating = s.animating ?? !1, d.updateUIParam = function(h, p) {
7912
7946
  const m = this._customParams || {};
7913
7947
  switch (this._customParams = m, m[h] = p, h) {
7914
7948
  case "centerX":
@@ -7933,7 +7967,7 @@ f({
7933
7967
  break;
7934
7968
  }
7935
7969
  return !0;
7936
- }, u;
7970
+ }, d;
7937
7971
  } catch {
7938
7972
  return null;
7939
7973
  }
@@ -8041,7 +8075,7 @@ f({
8041
8075
  }
8042
8076
  ]
8043
8077
  });
8044
- const { SimplexNoiseFilter: Wt } = g;
8078
+ const { SimplexNoiseFilter: Wt } = b;
8045
8079
  f({
8046
8080
  id: "simplex-noise",
8047
8081
  name: "Simplex Noise",
@@ -8196,7 +8230,7 @@ f({
8196
8230
  }
8197
8231
  ]
8198
8232
  });
8199
- class Zt extends w.Filter {
8233
+ class Zt extends S.Filter {
8200
8234
  constructor(e) {
8201
8235
  const t = Ce.from({
8202
8236
  vertex: `
@@ -8377,7 +8411,7 @@ f({
8377
8411
  }
8378
8412
  ]
8379
8413
  });
8380
- const { AdjustmentFilter: Gt } = g;
8414
+ const { AdjustmentFilter: Gt } = b;
8381
8415
  function D(s) {
8382
8416
  const e = typeof s == "string" ? parseInt(s.replace("#", "0x"), 16) : s;
8383
8417
  return [
@@ -8530,4 +8564,4 @@ export {
8530
8564
  ri as i,
8531
8565
  f as r
8532
8566
  };
8533
- //# sourceMappingURL=editor-DiiyShiW.js.map
8567
+ //# sourceMappingURL=editor-Cw08D0SQ.js.map