@mypixia/simplex-designer 2.0.2 → 2.0.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.
package/dist/index.es.js CHANGED
@@ -1,6 +1,6 @@
1
- import Ue, { useState as A, useRef as gt, useEffect as Z, useMemo as ee, forwardRef as Oe, useCallback as rt, useReducer as Qe, useImperativeHandle as $e } from "react";
2
- import He from "qrcode";
3
- import Ge from "react-barcode";
1
+ import Oe, { useState as N, useRef as gt, useEffect as Z, useMemo as ee, forwardRef as Qe, useCallback as rt, useReducer as $e, useImperativeHandle as He } from "react";
2
+ import Ge from "qrcode";
3
+ import _e from "react-barcode";
4
4
  import ie from "axios";
5
5
  import './index_external.css';var Et = { exports: {} }, Ct = {};
6
6
  /**
@@ -13,7 +13,7 @@ import './index_external.css';var Et = { exports: {} }, Ct = {};
13
13
  * LICENSE file in the root directory of this source tree.
14
14
  */
15
15
  var oe;
16
- function _e() {
16
+ function Ye() {
17
17
  if (oe) return Ct;
18
18
  oe = 1;
19
19
  var f = Symbol.for("react.transitional.element"), o = Symbol.for("react.fragment");
@@ -34,7 +34,7 @@ function _e() {
34
34
  }
35
35
  return Ct.Fragment = o, Ct.jsx = a, Ct.jsxs = a, Ct;
36
36
  }
37
- var Tt = {};
37
+ var jt = {};
38
38
  /**
39
39
  * @license React
40
40
  * react-jsx-runtime.development.js
@@ -45,12 +45,12 @@ var Tt = {};
45
45
  * LICENSE file in the root directory of this source tree.
46
46
  */
47
47
  var re;
48
- function Ye() {
48
+ function qe() {
49
49
  return re || (re = 1, process.env.NODE_ENV !== "production" && function() {
50
50
  function f(u) {
51
51
  if (u == null) return null;
52
52
  if (typeof u == "function")
53
- return u.$$typeof === $ ? null : u.displayName || u.name || null;
53
+ return u.$$typeof === H ? null : u.displayName || u.name || null;
54
54
  if (typeof u == "string") return u;
55
55
  switch (u) {
56
56
  case k:
@@ -59,11 +59,11 @@ function Ye() {
59
59
  return "Profiler";
60
60
  case C:
61
61
  return "StrictMode";
62
- case lt:
62
+ case st:
63
63
  return "Suspense";
64
64
  case W:
65
65
  return "SuspenseList";
66
- case ht:
66
+ case ft:
67
67
  return "Activity";
68
68
  }
69
69
  if (typeof u == "object")
@@ -74,7 +74,7 @@ function Ye() {
74
74
  return "Portal";
75
75
  case O:
76
76
  return (u.displayName || "Context") + ".Provider";
77
- case T:
77
+ case j:
78
78
  return (u._context.displayName || "Context") + ".Consumer";
79
79
  case v:
80
80
  var D = u.render;
@@ -102,11 +102,11 @@ function Ye() {
102
102
  }
103
103
  if (D) {
104
104
  D = console;
105
- var L = D.error, H = typeof Symbol == "function" && Symbol.toStringTag && u[Symbol.toStringTag] || u.constructor.name || "Object";
105
+ var L = D.error, G = typeof Symbol == "function" && Symbol.toStringTag && u[Symbol.toStringTag] || u.constructor.name || "Object";
106
106
  return L.call(
107
107
  D,
108
108
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
109
- H
109
+ G
110
110
  ), o(u);
111
111
  }
112
112
  }
@@ -147,22 +147,22 @@ function Ye() {
147
147
  configurable: !0
148
148
  });
149
149
  }
150
- function d() {
150
+ function c() {
151
151
  var u = f(this.type);
152
152
  return q[u] || (q[u] = !0, console.error(
153
153
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
154
154
  )), u = this.props.ref, u !== void 0 ? u : null;
155
155
  }
156
- function j(u, D, L, H, G, it, X, V) {
156
+ function T(u, D, L, G, _, it, X, V) {
157
157
  return L = it.ref, u = {
158
- $$typeof: z,
158
+ $$typeof: E,
159
159
  type: u,
160
160
  key: D,
161
161
  props: it,
162
- _owner: G
162
+ _owner: _
163
163
  }, (L !== void 0 ? L : null) !== null ? Object.defineProperty(u, "ref", {
164
164
  enumerable: !1,
165
- get: d
165
+ get: c
166
166
  }) : Object.defineProperty(u, "ref", { enumerable: !1, value: null }), u._store = {}, Object.defineProperty(u._store, "validated", {
167
167
  configurable: !1,
168
168
  enumerable: !1,
@@ -185,36 +185,36 @@ function Ye() {
185
185
  value: V
186
186
  }), Object.freeze && (Object.freeze(u.props), Object.freeze(u)), u;
187
187
  }
188
- function F(u, D, L, H, G, it, X, V) {
188
+ function F(u, D, L, G, _, it, X, V) {
189
189
  var U = D.children;
190
190
  if (U !== void 0)
191
- if (H)
191
+ if (G)
192
192
  if (nt(U)) {
193
- for (H = 0; H < U.length; H++)
194
- R(U[H]);
193
+ for (G = 0; G < U.length; G++)
194
+ A(U[G]);
195
195
  Object.freeze && Object.freeze(U);
196
196
  } else
197
197
  console.error(
198
198
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
199
199
  );
200
- else R(U);
200
+ else A(U);
201
201
  if (M.call(D, "key")) {
202
202
  U = f(u);
203
203
  var K = Object.keys(D).filter(function(xt) {
204
204
  return xt !== "key";
205
205
  });
206
- H = 0 < K.length ? "{key: someKey, " + K.join(": ..., ") + ": ...}" : "{key: someKey}", et[U + H] || (K = 0 < K.length ? "{" + K.join(": ..., ") + ": ...}" : "{}", console.error(
206
+ G = 0 < K.length ? "{key: someKey, " + K.join(": ..., ") + ": ...}" : "{key: someKey}", et[U + G] || (K = 0 < K.length ? "{" + K.join(": ..., ") + ": ...}" : "{}", console.error(
207
207
  `A props object containing a "key" prop is being spread into JSX:
208
208
  let props = %s;
209
209
  <%s {...props} />
210
210
  React keys must be passed directly to JSX without using spread:
211
211
  let props = %s;
212
212
  <%s key={someKey} {...props} />`,
213
- H,
213
+ G,
214
214
  U,
215
215
  K,
216
216
  U
217
- ), et[U + H] = !0);
217
+ ), et[U + G] = !0);
218
218
  }
219
219
  if (U = null, L !== void 0 && (a(L), U = "" + L), x(D) && (a(D.key), U = "" + D.key), "key" in D) {
220
220
  L = {};
@@ -224,21 +224,21 @@ React keys must be passed directly to JSX without using spread:
224
224
  return U && n(
225
225
  L,
226
226
  typeof u == "function" ? u.displayName || u.name || "Unknown" : u
227
- ), j(
227
+ ), T(
228
228
  u,
229
229
  U,
230
230
  it,
231
- G,
231
+ _,
232
232
  s(),
233
233
  L,
234
234
  X,
235
235
  V
236
236
  );
237
237
  }
238
- function R(u) {
239
- typeof u == "object" && u !== null && u.$$typeof === z && u._store && (u._store.validated = 1);
238
+ function A(u) {
239
+ typeof u == "object" && u !== null && u.$$typeof === E && u._store && (u._store.validated = 1);
240
240
  }
241
- var y = Ue, z = Symbol.for("react.transitional.element"), B = Symbol.for("react.portal"), k = Symbol.for("react.fragment"), C = Symbol.for("react.strict_mode"), J = Symbol.for("react.profiler"), T = Symbol.for("react.consumer"), O = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), lt = Symbol.for("react.suspense"), W = Symbol.for("react.suspense_list"), yt = Symbol.for("react.memo"), Q = Symbol.for("react.lazy"), ht = Symbol.for("react.activity"), $ = Symbol.for("react.client.reference"), at = y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, M = Object.prototype.hasOwnProperty, nt = Array.isArray, tt = console.createTask ? console.createTask : function() {
241
+ var y = Oe, E = Symbol.for("react.transitional.element"), B = Symbol.for("react.portal"), k = Symbol.for("react.fragment"), C = Symbol.for("react.strict_mode"), J = Symbol.for("react.profiler"), j = Symbol.for("react.consumer"), O = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), st = Symbol.for("react.suspense"), W = Symbol.for("react.suspense_list"), yt = Symbol.for("react.memo"), Q = Symbol.for("react.lazy"), ft = Symbol.for("react.activity"), H = Symbol.for("react.client.reference"), at = y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, M = Object.prototype.hasOwnProperty, nt = Array.isArray, tt = console.createTask ? console.createTask : function() {
242
242
  return null;
243
243
  };
244
244
  y = {
@@ -250,38 +250,38 @@ React keys must be passed directly to JSX without using spread:
250
250
  y,
251
251
  h
252
252
  )(), p = tt(l(h)), et = {};
253
- Tt.Fragment = k, Tt.jsx = function(u, D, L, H, G) {
253
+ jt.Fragment = k, jt.jsx = function(u, D, L, G, _) {
254
254
  var it = 1e4 > at.recentlyCreatedOwnerStacks++;
255
255
  return F(
256
256
  u,
257
257
  D,
258
258
  L,
259
259
  !1,
260
- H,
261
260
  G,
261
+ _,
262
262
  it ? Error("react-stack-top-frame") : P,
263
263
  it ? tt(l(u)) : p
264
264
  );
265
- }, Tt.jsxs = function(u, D, L, H, G) {
265
+ }, jt.jsxs = function(u, D, L, G, _) {
266
266
  var it = 1e4 > at.recentlyCreatedOwnerStacks++;
267
267
  return F(
268
268
  u,
269
269
  D,
270
270
  L,
271
271
  !0,
272
- H,
273
272
  G,
273
+ _,
274
274
  it ? Error("react-stack-top-frame") : P,
275
275
  it ? tt(l(u)) : p
276
276
  );
277
277
  };
278
- }()), Tt;
278
+ }()), jt;
279
279
  }
280
280
  var ae;
281
- function qe() {
282
- return ae || (ae = 1, process.env.NODE_ENV === "production" ? Et.exports = _e() : Et.exports = Ye()), Et.exports;
281
+ function Ve() {
282
+ return ae || (ae = 1, process.env.NODE_ENV === "production" ? Et.exports = Ye() : Et.exports = qe()), Et.exports;
283
283
  }
284
- var e = qe();
284
+ var e = Ve();
285
285
  const Ut = {
286
286
  business: {
287
287
  name: "Business & Office",
@@ -378,27 +378,27 @@ const Ut = {
378
378
  ...o,
379
379
  category: f.name
380
380
  }))
381
- ), Ve = (f) => le().filter(
381
+ ), Xe = (f) => le().filter(
382
382
  (a) => a.name.toLowerCase().includes(f.toLowerCase()) || a.category.toLowerCase().includes(f.toLowerCase())
383
- ), Xe = ({ onSelectIcon: f, disabled: o = !1 }) => {
384
- const [a, l] = A(!1), [s, h] = A(""), [x, n] = A("all"), d = gt(null);
383
+ ), Je = ({ onSelectIcon: f, disabled: o = !1 }) => {
384
+ const [a, l] = N(!1), [s, h] = N(""), [x, n] = N("all"), c = gt(null);
385
385
  Z(() => {
386
- const y = (z) => {
387
- d.current && !d.current.contains(z.target) && l(!1);
386
+ const y = (E) => {
387
+ c.current && !c.current.contains(E.target) && l(!1);
388
388
  };
389
389
  return document.addEventListener("mousedown", y), () => document.removeEventListener("mousedown", y);
390
390
  }, []);
391
- const j = (y) => {
391
+ const T = (y) => {
392
392
  f(y), l(!1), h("");
393
- }, R = (() => {
393
+ }, A = (() => {
394
394
  let y = le();
395
- if (s.trim() && (y = Ve(s)), x !== "all") {
396
- const z = Ut[x];
397
- z && (y = y.filter((B) => B.category === z.name));
395
+ if (s.trim() && (y = Xe(s)), x !== "all") {
396
+ const E = Ut[x];
397
+ E && (y = y.filter((B) => B.category === E.name));
398
398
  }
399
399
  return y;
400
400
  })();
401
- return /* @__PURE__ */ e.jsxs("div", { className: "icon-selector", ref: d, children: [
401
+ return /* @__PURE__ */ e.jsxs("div", { className: "icon-selector", ref: c, children: [
402
402
  /* @__PURE__ */ e.jsxs(
403
403
  "button",
404
404
  {
@@ -433,36 +433,36 @@ const Ut = {
433
433
  className: "category-select",
434
434
  children: [
435
435
  /* @__PURE__ */ e.jsx("option", { value: "all", children: "All Categories" }),
436
- Object.entries(Ut).map(([y, z]) => /* @__PURE__ */ e.jsx("option", { value: y, children: z.name }, y))
436
+ Object.entries(Ut).map(([y, E]) => /* @__PURE__ */ e.jsx("option", { value: y, children: E.name }, y))
437
437
  ]
438
438
  }
439
439
  )
440
440
  ] }),
441
- /* @__PURE__ */ e.jsx("div", { className: "icon-grid", children: R.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "no-icons", children: s ? "No icons found" : "No icons in this category" }) : R.map((y, z) => /* @__PURE__ */ e.jsxs(
441
+ /* @__PURE__ */ e.jsx("div", { className: "icon-grid", children: A.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "no-icons", children: s ? "No icons found" : "No icons in this category" }) : A.map((y, E) => /* @__PURE__ */ e.jsxs(
442
442
  "button",
443
443
  {
444
444
  className: "icon-item",
445
- onClick: () => j(y),
445
+ onClick: () => T(y),
446
446
  title: `${y.name} (${y.category})`,
447
447
  children: [
448
448
  /* @__PURE__ */ e.jsx("span", { className: "icon-symbol", children: y.symbol }),
449
449
  /* @__PURE__ */ e.jsx("span", { className: "icon-name", children: y.name })
450
450
  ]
451
451
  },
452
- `${y.name}-${z}`
452
+ `${y.name}-${E}`
453
453
  )) }),
454
454
  /* @__PURE__ */ e.jsx("div", { className: "icon-dropdown-footer", children: /* @__PURE__ */ e.jsxs("span", { className: "icon-count", children: [
455
- R.length,
455
+ A.length,
456
456
  " icon",
457
- R.length !== 1 ? "s" : ""
457
+ A.length !== 1 ? "s" : ""
458
458
  ] }) })
459
459
  ] })
460
460
  ] });
461
- }, Je = ({ isOpen: f, onClose: o, onAddQRCode: a, theme: l }) => {
462
- const [s, h] = A(""), [x, n] = A(""), [d, j] = A(200), [F, R] = A("M"), y = () => {
461
+ }, Ke = ({ isOpen: f, onClose: o, onAddQRCode: a, theme: l }) => {
462
+ const [s, h] = N(""), [x, n] = N(""), [c, T] = N(200), [F, A] = N("M"), y = () => {
463
463
  if (!s.trim()) return;
464
464
  const k = {
465
- width: d,
465
+ width: c,
466
466
  errorCorrectionLevel: F,
467
467
  type: "image/png",
468
468
  quality: 0.92,
@@ -472,14 +472,14 @@ const Ut = {
472
472
  light: "#FFFFFF"
473
473
  }
474
474
  };
475
- He.toDataURL(s, k, (C, J) => {
475
+ Ge.toDataURL(s, k, (C, J) => {
476
476
  if (C) {
477
477
  console.error("QR Code generation error:", C);
478
478
  return;
479
479
  }
480
480
  n(J);
481
481
  });
482
- }, z = () => {
482
+ }, E = () => {
483
483
  if (!x) return;
484
484
  const k = new Image();
485
485
  k.onload = () => {
@@ -487,8 +487,8 @@ const Ut = {
487
487
  type: "qrcode",
488
488
  src: x,
489
489
  data: s,
490
- width: d,
491
- height: d,
490
+ width: c,
491
+ height: c,
492
492
  x: 100,
493
493
  y: 100,
494
494
  imageObject: k
@@ -533,8 +533,8 @@ const Ut = {
533
533
  {
534
534
  type: "number",
535
535
  id: "qr-size",
536
- value: d,
537
- onChange: (k) => j(Math.max(50, Math.min(500, parseInt(k.target.value) || 200))),
536
+ value: c,
537
+ onChange: (k) => T(Math.max(50, Math.min(500, parseInt(k.target.value) || 200))),
538
538
  min: "50",
539
539
  max: "500"
540
540
  }
@@ -547,7 +547,7 @@ const Ut = {
547
547
  {
548
548
  id: "qr-error-level",
549
549
  value: F,
550
- onChange: (k) => R(k.target.value),
550
+ onChange: (k) => A(k.target.value),
551
551
  children: [
552
552
  /* @__PURE__ */ e.jsx("option", { value: "L", children: "Low (7%)" }),
553
553
  /* @__PURE__ */ e.jsx("option", { value: "M", children: "Medium (15%)" }),
@@ -574,7 +574,7 @@ const Ut = {
574
574
  "button",
575
575
  {
576
576
  className: "qr-btn qr-btn-add",
577
- onClick: z,
577
+ onClick: E,
578
578
  style: {
579
579
  backgroundColor: (l == null ? void 0 : l.primaryColor) || "#3b82f6",
580
580
  borderColor: (l == null ? void 0 : l.primaryColor) || "#3b82f6"
@@ -585,8 +585,8 @@ const Ut = {
585
585
  ] })
586
586
  ] })
587
587
  ] }) }) : null;
588
- }, Ke = ({ isOpen: f, onClose: o, onAddBarcode: a, theme: l }) => {
589
- const [s, h] = A(""), [x, n] = A("CODE128"), [d, j] = A(null), [F, R] = A(2), [y, z] = A(100), [B, k] = A(20), [C, J] = A("center"), [T, O] = A("bottom"), [v, lt] = A(10), W = gt(null), yt = [
588
+ }, Ze = ({ isOpen: f, onClose: o, onAddBarcode: a, theme: l }) => {
589
+ const [s, h] = N(""), [x, n] = N("CODE128"), [c, T] = N(null), [F, A] = N(2), [y, E] = N(100), [B, k] = N(20), [C, J] = N("center"), [j, O] = N("bottom"), [v, st] = N(10), W = gt(null), yt = [
590
590
  { value: "CODE128", label: "CODE128 (Most Common)" },
591
591
  { value: "EAN13", label: "EAN-13 (European Article Number)" },
592
592
  { value: "EAN8", label: "EAN-8 (Short EAN)" },
@@ -599,8 +599,8 @@ const Ut = {
599
599
  ], Q = () => {
600
600
  if (s.trim())
601
601
  try {
602
- j(/* @__PURE__ */ e.jsx(
603
- Ge,
602
+ T(/* @__PURE__ */ e.jsx(
603
+ _e,
604
604
  {
605
605
  value: s,
606
606
  format: x,
@@ -608,7 +608,7 @@ const Ut = {
608
608
  height: y,
609
609
  fontSize: B,
610
610
  textAlign: C,
611
- textPosition: T,
611
+ textPosition: j,
612
612
  margin: v,
613
613
  background: "#ffffff",
614
614
  lineColor: "#000000"
@@ -617,9 +617,9 @@ const Ut = {
617
617
  } catch (M) {
618
618
  console.error("Barcode generation error:", M), alert("Invalid data for selected barcode format. Please check your input.");
619
619
  }
620
- }, ht = () => {
620
+ }, ft = () => {
621
621
  var M, nt, tt, ct;
622
- if (!(!d || !W.current))
622
+ if (!(!c || !W.current))
623
623
  try {
624
624
  const q = W.current.querySelector("svg");
625
625
  if (!q) {
@@ -628,7 +628,7 @@ const Ut = {
628
628
  }
629
629
  const P = document.createElement("canvas"), p = P.getContext("2d"), et = q.getBoundingClientRect(), u = ((nt = (M = q.width) == null ? void 0 : M.baseVal) == null ? void 0 : nt.value) || et.width || 200, D = ((ct = (tt = q.height) == null ? void 0 : tt.baseVal) == null ? void 0 : ct.value) || et.height || 100;
630
630
  P.width = u, P.height = D;
631
- const L = new XMLSerializer().serializeToString(q), H = new Blob([L], { type: "image/svg+xml;charset=utf-8" }), G = URL.createObjectURL(H), it = new Image();
631
+ const L = new XMLSerializer().serializeToString(q), G = new Blob([L], { type: "image/svg+xml;charset=utf-8" }), _ = URL.createObjectURL(G), it = new Image();
632
632
  it.onload = () => {
633
633
  p.drawImage(it, 0, 0);
634
634
  const X = P.toDataURL("image/png"), V = new Image();
@@ -643,14 +643,14 @@ const Ut = {
643
643
  x: 100,
644
644
  y: 100,
645
645
  imageObject: V
646
- }), $();
647
- }, V.src = X, URL.revokeObjectURL(G);
648
- }, it.src = G;
646
+ }), H();
647
+ }, V.src = X, URL.revokeObjectURL(_);
648
+ }, it.src = _;
649
649
  } catch (q) {
650
650
  console.error("Error adding barcode to canvas:", q), alert("Failed to add barcode to canvas. Please try again.");
651
651
  }
652
- }, $ = () => {
653
- h(""), j(null), n("CODE128"), R(2), z(100), k(20), o();
652
+ }, H = () => {
653
+ h(""), T(null), n("CODE128"), A(2), E(100), k(20), o();
654
654
  }, at = (M) => ({
655
655
  CODE128: "Supports all ASCII characters. Most versatile format.",
656
656
  EAN13: "Requires exactly 12 digits (13th is checksum). Used for retail products.",
@@ -662,14 +662,14 @@ const Ut = {
662
662
  pharmacode: "Numbers 3-131070. Used in pharmaceutical industry.",
663
663
  codabar: "Supports 0-9, A-D, and symbols. Used in libraries."
664
664
  })[M] || "";
665
- return f ? /* @__PURE__ */ e.jsx("div", { className: "barcode-modal-overlay", onClick: $, children: /* @__PURE__ */ e.jsxs("div", { className: "barcode-modal-content", onClick: (M) => M.stopPropagation(), children: [
665
+ return f ? /* @__PURE__ */ e.jsx("div", { className: "barcode-modal-overlay", onClick: H, children: /* @__PURE__ */ e.jsxs("div", { className: "barcode-modal-content", onClick: (M) => M.stopPropagation(), children: [
666
666
  /* @__PURE__ */ e.jsxs("div", { className: "barcode-modal-header", children: [
667
667
  /* @__PURE__ */ e.jsx("h3", { children: "Generate Barcode" }),
668
668
  /* @__PURE__ */ e.jsx(
669
669
  "button",
670
670
  {
671
671
  className: "barcode-modal-close",
672
- onClick: $,
672
+ onClick: H,
673
673
  "aria-label": "Close",
674
674
  children: "×"
675
675
  }
@@ -714,7 +714,7 @@ const Ut = {
714
714
  max: "4",
715
715
  step: "0.5",
716
716
  value: F,
717
- onChange: (M) => R(parseFloat(M.target.value))
717
+ onChange: (M) => A(parseFloat(M.target.value))
718
718
  }
719
719
  ),
720
720
  /* @__PURE__ */ e.jsxs("span", { className: "range-value", children: [
@@ -732,7 +732,7 @@ const Ut = {
732
732
  min: "50",
733
733
  max: "200",
734
734
  value: y,
735
- onChange: (M) => z(parseInt(M.target.value))
735
+ onChange: (M) => E(parseInt(M.target.value))
736
736
  }
737
737
  ),
738
738
  /* @__PURE__ */ e.jsxs("span", { className: "range-value", children: [
@@ -764,7 +764,7 @@ const Ut = {
764
764
  "select",
765
765
  {
766
766
  id: "text-position",
767
- value: T,
767
+ value: j,
768
768
  onChange: (M) => O(M.target.value),
769
769
  children: [
770
770
  /* @__PURE__ */ e.jsx("option", { value: "bottom", children: "Bottom" }),
@@ -783,14 +783,14 @@ const Ut = {
783
783
  children: "Generate Barcode"
784
784
  }
785
785
  ) }),
786
- d && /* @__PURE__ */ e.jsxs("div", { className: "barcode-preview", children: [
786
+ c && /* @__PURE__ */ e.jsxs("div", { className: "barcode-preview", children: [
787
787
  /* @__PURE__ */ e.jsx("h4", { children: "Preview" }),
788
- /* @__PURE__ */ e.jsx("div", { className: "barcode-preview-container", ref: W, children: d }),
788
+ /* @__PURE__ */ e.jsx("div", { className: "barcode-preview-container", ref: W, children: c }),
789
789
  /* @__PURE__ */ e.jsx(
790
790
  "button",
791
791
  {
792
792
  className: "barcode-btn barcode-btn-add",
793
- onClick: ht,
793
+ onClick: ft,
794
794
  style: {
795
795
  backgroundColor: (l == null ? void 0 : l.primaryColor) || "#3b82f6",
796
796
  borderColor: (l == null ? void 0 : l.primaryColor) || "#3b82f6"
@@ -801,7 +801,7 @@ const Ut = {
801
801
  ] })
802
802
  ] })
803
803
  ] }) }) : null;
804
- }, Ze = ({ theme: f }) => /* @__PURE__ */ e.jsxs("div", { className: "premium-feature-container", style: {
804
+ }, ti = ({ theme: f }) => /* @__PURE__ */ e.jsxs("div", { className: "premium-feature-container", style: {
805
805
  padding: "20px",
806
806
  backgroundColor: "#f8f9fa",
807
807
  borderRadius: "8px",
@@ -864,19 +864,19 @@ const Ut = {
864
864
  100% { transform: rotate(360deg); }
865
865
  }
866
866
  ` })
867
- ] }), ti = ({ isOpen: f, onClose: o, onAddSticker: a, theme: l, apiKey: s, apiEndpoint: h }) => {
868
- const [x, n] = A([]), [d, j] = A(!1), [F, R] = A(null), [y, z] = A(""), [B, k] = A(""), [C, J] = A({});
867
+ ] }), ei = ({ isOpen: f, onClose: o, onAddSticker: a, theme: l, apiKey: s, apiEndpoint: h }) => {
868
+ const [x, n] = N([]), [c, T] = N(!1), [F, A] = N(null), [y, E] = N(""), [B, k] = N(""), [C, J] = N({});
869
869
  gt(null);
870
- const [T, O] = A(!1), [v, lt] = A(!1), [W, yt] = A(!1), Q = `${h}/api/v1/designer`;
870
+ const [j, O] = N(!1), [v, st] = N(!1), [W, yt] = N(!1), Q = `${h}/api/v1/designer`;
871
871
  Z(() => {
872
- f && s && ht();
872
+ f && s && ft();
873
873
  }, [f, s]);
874
- const ht = async () => {
874
+ const ft = async () => {
875
875
  const P = sessionStorage.getItem("apc_x_sub_status");
876
- P === "active" ? (O(!0), lt(!0), at()) : P === "inactive" ? (O(!1), lt(!0)) : (yt(!0), await $());
877
- }, $ = async () => {
876
+ P === "active" ? (O(!0), st(!0), at()) : P === "inactive" ? (O(!1), st(!0)) : (yt(!0), await H());
877
+ }, H = async () => {
878
878
  if (!s) {
879
- O(!1), lt(!0), yt(!1);
879
+ O(!1), st(!0), yt(!1);
880
880
  return;
881
881
  }
882
882
  const P = `${Q}/get-subscription-status/${s}`;
@@ -885,7 +885,7 @@ const Ut = {
885
885
  } catch (p) {
886
886
  console.error("Subscription check failed:", p), sessionStorage.setItem("apc_x_sub_status", "inactive"), O(!1);
887
887
  } finally {
888
- yt(!1), lt(!0);
888
+ yt(!1), st(!0);
889
889
  }
890
890
  }, at = async () => {
891
891
  const P = sessionStorage.getItem("apc_stickers");
@@ -897,7 +897,7 @@ const Ut = {
897
897
  } catch {
898
898
  console.warn("Failed to parse cached stickers, fetching fresh data");
899
899
  }
900
- j(!0), R(null);
900
+ T(!0), A(null);
901
901
  try {
902
902
  const p = await ie.get(`${Q}/get-stickers`);
903
903
  if (p.data && p.data.object && p.data.object.contents) {
@@ -906,9 +906,9 @@ const Ut = {
906
906
  } else
907
907
  throw new Error("Invalid response format");
908
908
  } catch (p) {
909
- console.error("Error fetching stickers:", p), R("Failed to load stickers. Please try again.");
909
+ console.error("Error fetching stickers:", p), A("Failed to load stickers. Please try again.");
910
910
  } finally {
911
- j(!1);
911
+ T(!1);
912
912
  }
913
913
  }, M = (P, p) => {
914
914
  a({
@@ -930,8 +930,8 @@ const Ut = {
930
930
  return P.forEach((et) => {
931
931
  const u = et.name.split("/");
932
932
  let D = p;
933
- u.forEach((L, H) => {
934
- D[L] || (D[L] = H === u.length - 1 ? et : {}), D = D[L];
933
+ u.forEach((L, G) => {
934
+ D[L] || (D[L] = G === u.length - 1 ? et : {}), D = D[L];
935
935
  });
936
936
  }), p;
937
937
  }, ct = (P, p = "", et = 0) => /* @__PURE__ */ e.jsx("div", { className: "sticker-tree-level", style: { paddingLeft: `${et * 15}px` }, children: Object.keys(P).map((u) => {
@@ -947,8 +947,8 @@ const Ut = {
947
947
  src: P[u].url,
948
948
  alt: u,
949
949
  loading: "lazy",
950
- onError: (G) => {
951
- G.target.style.display = "none";
950
+ onError: (_) => {
951
+ _.target.style.display = "none";
952
952
  }
953
953
  }
954
954
  ) })
@@ -986,8 +986,8 @@ const Ut = {
986
986
  ] }),
987
987
  /* @__PURE__ */ e.jsxs("div", { className: "sticker-modal-body", children: [
988
988
  W && /* @__PURE__ */ e.jsx(se, {}),
989
- !T && !W && v && /* @__PURE__ */ e.jsx(Ze, { theme: l }),
990
- T && v && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
989
+ !j && !W && v && /* @__PURE__ */ e.jsx(ti, { theme: l }),
990
+ j && v && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
991
991
  /* @__PURE__ */ e.jsx("div", { className: "sticker-modal-controls", children: /* @__PURE__ */ e.jsx("div", { className: "search-container", children: /* @__PURE__ */ e.jsx(
992
992
  "input",
993
993
  {
@@ -998,16 +998,16 @@ const Ut = {
998
998
  className: "sticker-search"
999
999
  }
1000
1000
  ) }) }),
1001
- d && /* @__PURE__ */ e.jsx(se, {}),
1001
+ c && /* @__PURE__ */ e.jsx(se, {}),
1002
1002
  F && /* @__PURE__ */ e.jsxs("div", { className: "sticker-error", children: [
1003
1003
  /* @__PURE__ */ e.jsx("p", { children: F }),
1004
1004
  /* @__PURE__ */ e.jsx("button", { onClick: at, children: "Retry" })
1005
1005
  ] }),
1006
- !d && !F && x.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "sticker-grid", children: ct(tt(q)) })
1006
+ !c && !F && x.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "sticker-grid", children: ct(tt(q)) })
1007
1007
  ] })
1008
1008
  ] })
1009
1009
  ] }) }) : null;
1010
- }, ei = [
1010
+ }, ii = [
1011
1011
  // FLORAL DESIGNS (40 items)
1012
1012
  {
1013
1013
  id: 1,
@@ -2559,12 +2559,12 @@ const Ut = {
2559
2559
  category: "Geometric",
2560
2560
  description: "Complex mandala flower pattern"
2561
2561
  }
2562
- ], ii = ({ isOpen: f, onClose: o, onAddEmbroidery: a, theme: l, apiKey: s, apiEndpoint: h }) => {
2563
- const [x, n] = A([]), [d, j] = A(!1), [F, R] = A(null), [y, z] = A(""), [B, k] = A("All"), C = gt(null), J = ["All", "Floral", "Nature", "Geometric", "Traditional", "Sports", "Hobbies", "Food", "Symbols", "Holiday", "Text"];
2562
+ ], oi = ({ isOpen: f, onClose: o, onAddEmbroidery: a, theme: l, apiKey: s, apiEndpoint: h }) => {
2563
+ const [x, n] = N([]), [c, T] = N(!1), [F, A] = N(null), [y, E] = N(""), [B, k] = N("All"), C = gt(null), J = ["All", "Floral", "Nature", "Geometric", "Traditional", "Sports", "Hobbies", "Food", "Symbols", "Holiday", "Text"];
2564
2564
  Z(() => {
2565
- f && n(ei);
2565
+ f && n(ii);
2566
2566
  }, [f]);
2567
- const T = (v) => {
2567
+ const j = (v) => {
2568
2568
  a({
2569
2569
  type: "embroidery",
2570
2570
  src: v.url,
@@ -2577,8 +2577,8 @@ const Ut = {
2577
2577
  y: 100
2578
2578
  }), o();
2579
2579
  }, O = x.filter((v) => {
2580
- const lt = !y || v.name.toLowerCase().includes(y.toLowerCase()) || v.description.toLowerCase().includes(y.toLowerCase()), W = B === "All" || v.category === B;
2581
- return lt && W;
2580
+ const st = !y || v.name.toLowerCase().includes(y.toLowerCase()) || v.description.toLowerCase().includes(y.toLowerCase()), W = B === "All" || v.category === B;
2581
+ return st && W;
2582
2582
  });
2583
2583
  return f ? /* @__PURE__ */ e.jsx("div", { className: "embroidery-modal-overlay", onClick: o, children: /* @__PURE__ */ e.jsxs(
2584
2584
  "div",
@@ -2606,7 +2606,7 @@ const Ut = {
2606
2606
  type: "text",
2607
2607
  placeholder: "Search embroidery designs...",
2608
2608
  value: y,
2609
- onChange: (v) => z(v.target.value),
2609
+ onChange: (v) => E(v.target.value),
2610
2610
  className: "embroidery-search"
2611
2611
  }
2612
2612
  ) }),
@@ -2624,16 +2624,16 @@ const Ut = {
2624
2624
  ] })
2625
2625
  ] }),
2626
2626
  /* @__PURE__ */ e.jsxs("div", { className: "embroidery-modal-body", children: [
2627
- d && /* @__PURE__ */ e.jsxs("div", { className: "embroidery-loading", children: [
2627
+ c && /* @__PURE__ */ e.jsxs("div", { className: "embroidery-loading", children: [
2628
2628
  /* @__PURE__ */ e.jsx("div", { className: "loading-spinner" }),
2629
2629
  /* @__PURE__ */ e.jsx("p", { children: "Loading embroidery designs..." })
2630
2630
  ] }),
2631
2631
  F && /* @__PURE__ */ e.jsx("div", { className: "embroidery-error", children: /* @__PURE__ */ e.jsx("p", { children: F }) }),
2632
- !d && !F && /* @__PURE__ */ e.jsx("div", { className: "embroidery-grid", children: O.map((v) => /* @__PURE__ */ e.jsxs(
2632
+ !c && !F && /* @__PURE__ */ e.jsx("div", { className: "embroidery-grid", children: O.map((v) => /* @__PURE__ */ e.jsxs(
2633
2633
  "div",
2634
2634
  {
2635
2635
  className: "embroidery-item",
2636
- onClick: () => T(v),
2636
+ onClick: () => j(v),
2637
2637
  title: v.description,
2638
2638
  children: [
2639
2639
  /* @__PURE__ */ e.jsx("div", { className: "embroidery-preview", children: /* @__PURE__ */ e.jsx(
@@ -2642,8 +2642,8 @@ const Ut = {
2642
2642
  src: v.url,
2643
2643
  alt: v.name,
2644
2644
  loading: "lazy",
2645
- onError: (lt) => {
2646
- console.error("Failed to load embroidery image:", v.url), lt.target.style.display = "none";
2645
+ onError: (st) => {
2646
+ console.error("Failed to load embroidery image:", v.url), st.target.style.display = "none";
2647
2647
  }
2648
2648
  }
2649
2649
  ) }),
@@ -2655,7 +2655,7 @@ const Ut = {
2655
2655
  },
2656
2656
  v.id
2657
2657
  )) }),
2658
- !d && !F && O.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "no-embroideries", children: /* @__PURE__ */ e.jsx("p", { children: "No embroidery designs found matching your search." }) })
2658
+ !c && !F && O.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "no-embroideries", children: /* @__PURE__ */ e.jsx("p", { children: "No embroidery designs found matching your search." }) })
2659
2659
  ] }),
2660
2660
  /* @__PURE__ */ e.jsx("div", { className: "embroidery-modal-footer", children: /* @__PURE__ */ e.jsxs("div", { className: "embroidery-disclaimer", children: [
2661
2661
  /* @__PURE__ */ e.jsx("span", { className: "disclaimer-icon", children: "ℹ️" }),
@@ -2664,7 +2664,7 @@ const Ut = {
2664
2664
  ]
2665
2665
  }
2666
2666
  ) }) : null;
2667
- }, jt = [
2667
+ }, Tt = [
2668
2668
  // MOTIVATIONAL & INSPIRATIONAL (25 items)
2669
2669
  {
2670
2670
  id: 1,
@@ -4601,24 +4601,24 @@ const Ut = {
4601
4601
  fill: "#8B0000",
4602
4602
  textAlign: "center"
4603
4603
  }
4604
- ], oi = ({ isOpen: f, onClose: o, onAddText: a, theme: l }) => {
4605
- const [s, h] = A(""), [x, n] = A("All"), d = ee(() => {
4606
- const y = jt.reduce((z, B) => (z[B.category] = (z[B.category] || 0) + 1, z), {});
4604
+ ], ri = ({ isOpen: f, onClose: o, onAddText: a, theme: l }) => {
4605
+ const [s, h] = N(""), [x, n] = N("All"), c = ee(() => {
4606
+ const y = Tt.reduce((E, B) => (E[B.category] = (E[B.category] || 0) + 1, E), {});
4607
4607
  return [
4608
- { name: "All", count: jt.length },
4609
- ...Object.entries(y).map(([z, B]) => ({ name: z, count: B }))
4608
+ { name: "All", count: Tt.length },
4609
+ ...Object.entries(y).map(([E, B]) => ({ name: E, count: B }))
4610
4610
  ];
4611
- }, [jt]), j = ee(() => jt.filter((y) => {
4612
- const z = !s || y.text.toLowerCase().includes(s.toLowerCase()) || y.category.toLowerCase().includes(s.toLowerCase()), B = x === "All" || y.category === x;
4613
- return z && B;
4614
- }), [jt, s, x]), F = (y) => {
4615
- const z = {
4611
+ }, [Tt]), T = ee(() => Tt.filter((y) => {
4612
+ const E = !s || y.text.toLowerCase().includes(s.toLowerCase()) || y.category.toLowerCase().includes(s.toLowerCase()), B = x === "All" || y.category === x;
4613
+ return E && B;
4614
+ }), [Tt, s, x]), F = (y) => {
4615
+ const E = {
4616
4616
  ...y,
4617
4617
  x: 100,
4618
4618
  y: 100
4619
4619
  };
4620
- a("text", z), o();
4621
- }, R = () => {
4620
+ a("text", E), o();
4621
+ }, A = () => {
4622
4622
  a("text", {
4623
4623
  text: "Your Text Here",
4624
4624
  fontSize: 24,
@@ -4644,7 +4644,7 @@ const Ut = {
4644
4644
  className: "search-input"
4645
4645
  }
4646
4646
  ) }),
4647
- /* @__PURE__ */ e.jsx("div", { className: "category-tabs", children: d.map((y) => /* @__PURE__ */ e.jsxs(
4647
+ /* @__PURE__ */ e.jsx("div", { className: "category-tabs", children: c.map((y) => /* @__PURE__ */ e.jsxs(
4648
4648
  "button",
4649
4649
  {
4650
4650
  className: `category-tab ${x === y.name ? "active" : ""}`,
@@ -4662,11 +4662,11 @@ const Ut = {
4662
4662
  )) })
4663
4663
  ] }),
4664
4664
  /* @__PURE__ */ e.jsxs("div", { className: "templates-grid", children: [
4665
- /* @__PURE__ */ e.jsx("div", { className: "custom-text-option", onClick: R, children: /* @__PURE__ */ e.jsxs("div", { className: "custom-text-preview", children: [
4665
+ /* @__PURE__ */ e.jsx("div", { className: "custom-text-option", onClick: A, children: /* @__PURE__ */ e.jsxs("div", { className: "custom-text-preview", children: [
4666
4666
  /* @__PURE__ */ e.jsx("div", { className: "custom-icon", children: "✏️" }),
4667
4667
  /* @__PURE__ */ e.jsx("div", { className: "custom-label", children: "Create Custom Text" })
4668
4668
  ] }) }),
4669
- j.map((y) => /* @__PURE__ */ e.jsxs(
4669
+ T.map((y) => /* @__PURE__ */ e.jsxs(
4670
4670
  "div",
4671
4671
  {
4672
4672
  className: "template-item",
@@ -4701,13 +4701,13 @@ const Ut = {
4701
4701
  ))
4702
4702
  ] }),
4703
4703
  /* @__PURE__ */ e.jsx("div", { className: "modal-footer", children: /* @__PURE__ */ e.jsxs("div", { className: "results-count", children: [
4704
- j.length,
4704
+ T.length,
4705
4705
  " template",
4706
- j.length !== 1 ? "s" : "",
4706
+ T.length !== 1 ? "s" : "",
4707
4707
  " found"
4708
4708
  ] }) })
4709
4709
  ] }) }) : null;
4710
- }, ri = ({
4710
+ }, ai = ({
4711
4711
  onAddElement: f,
4712
4712
  onDeleteElement: o,
4713
4713
  onDuplicateElement: a,
@@ -4716,21 +4716,21 @@ const Ut = {
4716
4716
  onToggleGrid: h,
4717
4717
  onToggleRulers: x,
4718
4718
  onToggleSnap: n,
4719
- onImageUpload: d,
4720
- canUndo: j,
4719
+ onImageUpload: c,
4720
+ canUndo: T,
4721
4721
  canRedo: F,
4722
- showGrid: R,
4722
+ showGrid: A,
4723
4723
  showRulers: y,
4724
- snapToGrid: z,
4724
+ snapToGrid: E,
4725
4725
  selectedElement: B,
4726
4726
  theme: k,
4727
4727
  readOnly: C,
4728
4728
  apiKey: J,
4729
- apiEndpoint: T
4729
+ apiEndpoint: j
4730
4730
  }) => {
4731
- const [O, v] = A(!1), [lt, W] = A(!1), [yt, Q] = A(!1), [ht, $] = A(!1), [at, M] = A(!1), [nt, tt] = A(!1), [ct, q] = A(!1), P = (U) => {
4731
+ const [O, v] = N(!1), [st, W] = N(!1), [yt, Q] = N(!1), [ft, H] = N(!1), [at, M] = N(!1), [nt, tt] = N(!1), [ct, q] = N(!1), P = (U) => {
4732
4732
  const K = U.target.files[0];
4733
- K && K.type.startsWith("image/") && d(K), U.target.value = "";
4733
+ K && K.type.startsWith("image/") && c(K), U.target.value = "";
4734
4734
  }, p = (U) => {
4735
4735
  f("icon", {
4736
4736
  iconData: U,
@@ -4747,9 +4747,9 @@ const Ut = {
4747
4747
  f("sticker", U);
4748
4748
  }, L = (U) => {
4749
4749
  f("embroidery", U);
4750
- }, H = (U, K) => {
4750
+ }, G = (U, K) => {
4751
4751
  f(U, K);
4752
- }, G = () => {
4752
+ }, _ = () => {
4753
4753
  tt(!nt), q(!1);
4754
4754
  }, it = () => {
4755
4755
  q(!ct), tt(!1);
@@ -4766,7 +4766,7 @@ const Ut = {
4766
4766
  {
4767
4767
  className: "toolbar-btn compact",
4768
4768
  onClick: l,
4769
- disabled: !j || C,
4769
+ disabled: !T || C,
4770
4770
  title: "Undo (Ctrl+Z)",
4771
4771
  children: [
4772
4772
  /* @__PURE__ */ e.jsx("span", { className: "icon", children: "↶" }),
@@ -4797,7 +4797,7 @@ const Ut = {
4797
4797
  className: "toolbar-btn compact dropdown-trigger",
4798
4798
  disabled: C,
4799
4799
  title: "Add Text",
4800
- onClick: G,
4800
+ onClick: _,
4801
4801
  children: [
4802
4802
  /* @__PURE__ */ e.jsx("span", { className: "icon", children: "𝐓" }),
4803
4803
  /* @__PURE__ */ e.jsx("span", { className: "label", children: "Text" }),
@@ -4896,7 +4896,7 @@ const Ut = {
4896
4896
  )
4897
4897
  ] }),
4898
4898
  /* @__PURE__ */ e.jsx("div", { className: "toolbar-separator" }),
4899
- /* @__PURE__ */ e.jsx(Xe, { onSelectIcon: p, theme: k, disabled: C }),
4899
+ /* @__PURE__ */ e.jsx(Je, { onSelectIcon: p, theme: k, disabled: C }),
4900
4900
  /* @__PURE__ */ e.jsxs(
4901
4901
  "button",
4902
4902
  {
@@ -4943,7 +4943,7 @@ const Ut = {
4943
4943
  "button",
4944
4944
  {
4945
4945
  className: "toolbar-btn compact",
4946
- onClick: () => $(!0),
4946
+ onClick: () => H(!0),
4947
4947
  disabled: C,
4948
4948
  title: "Add Embroidery Design",
4949
4949
  children: [
@@ -4988,7 +4988,7 @@ const Ut = {
4988
4988
  /* @__PURE__ */ e.jsxs(
4989
4989
  "button",
4990
4990
  {
4991
- className: `toolbar-btn compact ${R ? "active" : ""}`,
4991
+ className: `toolbar-btn compact ${A ? "active" : ""}`,
4992
4992
  onClick: h,
4993
4993
  title: "Toggle Grid",
4994
4994
  children: [
@@ -5012,7 +5012,7 @@ const Ut = {
5012
5012
  /* @__PURE__ */ e.jsxs(
5013
5013
  "button",
5014
5014
  {
5015
- className: `toolbar-btn compact ${z ? "active" : ""}`,
5015
+ className: `toolbar-btn compact ${E ? "active" : ""}`,
5016
5016
  onClick: n,
5017
5017
  title: "Snap to Grid",
5018
5018
  children: [
@@ -5024,7 +5024,7 @@ const Ut = {
5024
5024
  ] })
5025
5025
  ] }),
5026
5026
  /* @__PURE__ */ e.jsx(
5027
- Je,
5027
+ Ke,
5028
5028
  {
5029
5029
  isOpen: O,
5030
5030
  onClose: () => v(!1),
@@ -5033,54 +5033,54 @@ const Ut = {
5033
5033
  }
5034
5034
  ),
5035
5035
  /* @__PURE__ */ e.jsx(
5036
- Ke,
5036
+ Ze,
5037
5037
  {
5038
- isOpen: lt,
5038
+ isOpen: st,
5039
5039
  onClose: () => W(!1),
5040
5040
  onAddBarcode: u,
5041
5041
  theme: k
5042
5042
  }
5043
5043
  ),
5044
5044
  /* @__PURE__ */ e.jsx(
5045
- ti,
5045
+ ei,
5046
5046
  {
5047
5047
  isOpen: yt,
5048
5048
  onClose: () => Q(!1),
5049
5049
  onAddSticker: D,
5050
5050
  theme: k,
5051
5051
  apiKey: J,
5052
- apiEndpoint: T
5052
+ apiEndpoint: j
5053
5053
  }
5054
5054
  ),
5055
5055
  /* @__PURE__ */ e.jsx(
5056
- ii,
5056
+ oi,
5057
5057
  {
5058
- isOpen: ht,
5059
- onClose: () => $(!1),
5058
+ isOpen: ft,
5059
+ onClose: () => H(!1),
5060
5060
  onAddEmbroidery: L,
5061
5061
  theme: k,
5062
5062
  apiKey: J,
5063
- apiEndpoint: T
5063
+ apiEndpoint: j
5064
5064
  }
5065
5065
  ),
5066
5066
  /* @__PURE__ */ e.jsx(
5067
- oi,
5067
+ ri,
5068
5068
  {
5069
5069
  isOpen: at,
5070
5070
  onClose: () => M(!1),
5071
- onAddText: H,
5071
+ onAddText: G,
5072
5072
  theme: k
5073
5073
  }
5074
5074
  )
5075
5075
  ] });
5076
- }, ai = ({
5076
+ }, si = ({
5077
5077
  selectedElement: f,
5078
5078
  onUpdate: o,
5079
5079
  onMoveLayer: a,
5080
5080
  availableFonts: l,
5081
5081
  theme: s
5082
5082
  }) => {
5083
- const [h, x] = A(!1);
5083
+ const [h, x] = N(!1);
5084
5084
  if (!f)
5085
5085
  return /* @__PURE__ */ e.jsxs("div", { className: "properties-panel", children: [
5086
5086
  /* @__PURE__ */ e.jsx("h3", { children: "Properties" }),
@@ -5088,7 +5088,7 @@ const Ut = {
5088
5088
  ] });
5089
5089
  const n = (k, C) => {
5090
5090
  o(f.id, { [k]: C });
5091
- }, d = () => {
5091
+ }, c = () => {
5092
5092
  var k, C, J;
5093
5093
  return /* @__PURE__ */ e.jsxs("div", { className: "property-group", children: [
5094
5094
  /* @__PURE__ */ e.jsx("h4", { children: "Text Content" }),
@@ -5098,7 +5098,7 @@ const Ut = {
5098
5098
  "textarea",
5099
5099
  {
5100
5100
  value: f.text || "",
5101
- onChange: (T) => n("text", T.target.value),
5101
+ onChange: (j) => n("text", j.target.value),
5102
5102
  rows: 3,
5103
5103
  placeholder: "Enter your text here..."
5104
5104
  }
@@ -5110,8 +5110,8 @@ const Ut = {
5110
5110
  "select",
5111
5111
  {
5112
5112
  value: f.fontFamily || "Arial",
5113
- onChange: (T) => n("fontFamily", T.target.value),
5114
- children: l.map((T) => /* @__PURE__ */ e.jsx("option", { value: T, children: T }, T))
5113
+ onChange: (j) => n("fontFamily", j.target.value),
5114
+ children: l.map((j) => /* @__PURE__ */ e.jsx("option", { value: j, children: j }, j))
5115
5115
  }
5116
5116
  )
5117
5117
  ] }),
@@ -5123,7 +5123,7 @@ const Ut = {
5123
5123
  {
5124
5124
  type: "number",
5125
5125
  value: f.fontSize || 20,
5126
- onChange: (T) => n("fontSize", parseInt(T.target.value)),
5126
+ onChange: (j) => n("fontSize", parseInt(j.target.value)),
5127
5127
  min: "8",
5128
5128
  max: "200"
5129
5129
  }
@@ -5137,7 +5137,7 @@ const Ut = {
5137
5137
  type: "number",
5138
5138
  step: "0.1",
5139
5139
  value: f.lineHeight || 1.2,
5140
- onChange: (T) => n("lineHeight", parseFloat(T.target.value)),
5140
+ onChange: (j) => n("lineHeight", parseFloat(j.target.value)),
5141
5141
  min: "0.5",
5142
5142
  max: "3"
5143
5143
  }
@@ -5193,8 +5193,8 @@ const Ut = {
5193
5193
  {
5194
5194
  className: (k = f.textDecoration) != null && k.includes("underline") ? "active" : "",
5195
5195
  onClick: () => {
5196
- const T = f.textDecoration || "", O = T.split(" ").filter((v) => v && v !== "underline");
5197
- T.includes("underline") || O.push("underline"), n("textDecoration", O.join(" ").trim());
5196
+ const j = f.textDecoration || "", O = j.split(" ").filter((v) => v && v !== "underline");
5197
+ j.includes("underline") || O.push("underline"), n("textDecoration", O.join(" ").trim());
5198
5198
  },
5199
5199
  title: "Underline",
5200
5200
  children: /* @__PURE__ */ e.jsx("u", { children: "U" })
@@ -5205,8 +5205,8 @@ const Ut = {
5205
5205
  {
5206
5206
  className: (C = f.textDecoration) != null && C.includes("overline") ? "active" : "",
5207
5207
  onClick: () => {
5208
- const T = f.textDecoration || "", O = T.split(" ").filter((v) => v && v !== "overline");
5209
- T.includes("overline") || O.push("overline"), n("textDecoration", O.join(" ").trim());
5208
+ const j = f.textDecoration || "", O = j.split(" ").filter((v) => v && v !== "overline");
5209
+ j.includes("overline") || O.push("overline"), n("textDecoration", O.join(" ").trim());
5210
5210
  },
5211
5211
  title: "Overline",
5212
5212
  children: /* @__PURE__ */ e.jsx("span", { style: { textDecoration: "overline" }, children: "O" })
@@ -5217,8 +5217,8 @@ const Ut = {
5217
5217
  {
5218
5218
  className: (J = f.textDecoration) != null && J.includes("line-through") ? "active" : "",
5219
5219
  onClick: () => {
5220
- const T = f.textDecoration || "", O = T.split(" ").filter((v) => v && v !== "line-through");
5221
- T.includes("line-through") || O.push("line-through"), n("textDecoration", O.join(" ").trim());
5220
+ const j = f.textDecoration || "", O = j.split(" ").filter((v) => v && v !== "line-through");
5221
+ j.includes("line-through") || O.push("line-through"), n("textDecoration", O.join(" ").trim());
5222
5222
  },
5223
5223
  title: "Strikethrough",
5224
5224
  children: /* @__PURE__ */ e.jsx("s", { children: "S" })
@@ -5316,7 +5316,7 @@ const Ut = {
5316
5316
  {
5317
5317
  type: "color",
5318
5318
  value: f.fill || "#000000",
5319
- onChange: (T) => n("fill", T.target.value)
5319
+ onChange: (j) => n("fill", j.target.value)
5320
5320
  }
5321
5321
  )
5322
5322
  ] }),
@@ -5328,7 +5328,7 @@ const Ut = {
5328
5328
  {
5329
5329
  type: "color",
5330
5330
  value: f.backgroundColor || "#ffffff",
5331
- onChange: (T) => n("backgroundColor", T.target.value),
5331
+ onChange: (j) => n("backgroundColor", j.target.value),
5332
5332
  disabled: !f.hasBackground
5333
5333
  }
5334
5334
  ),
@@ -5354,7 +5354,7 @@ const Ut = {
5354
5354
  type: "number",
5355
5355
  step: "0.1",
5356
5356
  value: f.letterSpacing || 0,
5357
- onChange: (T) => n("letterSpacing", parseFloat(T.target.value)),
5357
+ onChange: (j) => n("letterSpacing", parseFloat(j.target.value)),
5358
5358
  min: "-5",
5359
5359
  max: "10"
5360
5360
  }
@@ -5368,7 +5368,7 @@ const Ut = {
5368
5368
  type: "number",
5369
5369
  step: "0.1",
5370
5370
  value: f.wordSpacing || 0,
5371
- onChange: (T) => n("wordSpacing", parseFloat(T.target.value)),
5371
+ onChange: (j) => n("wordSpacing", parseFloat(j.target.value)),
5372
5372
  min: "-10",
5373
5373
  max: "20"
5374
5374
  }
@@ -5394,7 +5394,7 @@ const Ut = {
5394
5394
  {
5395
5395
  type: "number",
5396
5396
  value: f.textShadowX || 2,
5397
- onChange: (T) => n("textShadowX", parseInt(T.target.value)),
5397
+ onChange: (j) => n("textShadowX", parseInt(j.target.value)),
5398
5398
  min: "-20",
5399
5399
  max: "20"
5400
5400
  }
@@ -5407,7 +5407,7 @@ const Ut = {
5407
5407
  {
5408
5408
  type: "number",
5409
5409
  value: f.textShadowY || 2,
5410
- onChange: (T) => n("textShadowY", parseInt(T.target.value)),
5410
+ onChange: (j) => n("textShadowY", parseInt(j.target.value)),
5411
5411
  min: "-20",
5412
5412
  max: "20"
5413
5413
  }
@@ -5420,7 +5420,7 @@ const Ut = {
5420
5420
  {
5421
5421
  type: "number",
5422
5422
  value: f.textShadowBlur || 4,
5423
- onChange: (T) => n("textShadowBlur", parseInt(T.target.value)),
5423
+ onChange: (j) => n("textShadowBlur", parseInt(j.target.value)),
5424
5424
  min: "0",
5425
5425
  max: "20"
5426
5426
  }
@@ -5433,7 +5433,7 @@ const Ut = {
5433
5433
  {
5434
5434
  type: "color",
5435
5435
  value: f.textShadowColor || "#000000",
5436
- onChange: (T) => n("textShadowColor", T.target.value)
5436
+ onChange: (j) => n("textShadowColor", j.target.value)
5437
5437
  }
5438
5438
  )
5439
5439
  ] })
@@ -5448,7 +5448,7 @@ const Ut = {
5448
5448
  {
5449
5449
  type: "color",
5450
5450
  value: f.stroke || "#000000",
5451
- onChange: (T) => n("stroke", T.target.value)
5451
+ onChange: (j) => n("stroke", j.target.value)
5452
5452
  }
5453
5453
  )
5454
5454
  ] }),
@@ -5459,7 +5459,7 @@ const Ut = {
5459
5459
  {
5460
5460
  type: "number",
5461
5461
  value: f.strokeWidth || 0,
5462
- onChange: (T) => n("strokeWidth", parseInt(T.target.value)),
5462
+ onChange: (j) => n("strokeWidth", parseInt(j.target.value)),
5463
5463
  min: "0",
5464
5464
  max: "20"
5465
5465
  }
@@ -5476,7 +5476,7 @@ const Ut = {
5476
5476
  max: "1",
5477
5477
  step: "0.1",
5478
5478
  value: f.opacity || 1,
5479
- onChange: (T) => n("opacity", parseFloat(T.target.value))
5479
+ onChange: (j) => n("opacity", parseFloat(j.target.value))
5480
5480
  }
5481
5481
  ),
5482
5482
  /* @__PURE__ */ e.jsxs("span", { children: [
@@ -5490,7 +5490,7 @@ const Ut = {
5490
5490
  "select",
5491
5491
  {
5492
5492
  value: f.fontVariant || "normal",
5493
- onChange: (T) => n("fontVariant", T.target.value),
5493
+ onChange: (j) => n("fontVariant", j.target.value),
5494
5494
  children: [
5495
5495
  /* @__PURE__ */ e.jsx("option", { value: "normal", children: "Normal" }),
5496
5496
  /* @__PURE__ */ e.jsx("option", { value: "small-caps", children: "Small Caps" })
@@ -5504,7 +5504,7 @@ const Ut = {
5504
5504
  "select",
5505
5505
  {
5506
5506
  value: f.writingMode || "horizontal-tb",
5507
- onChange: (T) => n("writingMode", T.target.value),
5507
+ onChange: (j) => n("writingMode", j.target.value),
5508
5508
  children: [
5509
5509
  /* @__PURE__ */ e.jsx("option", { value: "horizontal-tb", children: "Horizontal" }),
5510
5510
  /* @__PURE__ */ e.jsx("option", { value: "vertical-rl", children: "Vertical Right-to-Left" }),
@@ -5543,7 +5543,7 @@ const Ut = {
5543
5543
  {
5544
5544
  type: "number",
5545
5545
  value: f.backgroundPadding || 5,
5546
- onChange: (T) => n("backgroundPadding", parseInt(T.target.value)),
5546
+ onChange: (j) => n("backgroundPadding", parseInt(j.target.value)),
5547
5547
  min: "0",
5548
5548
  max: "50",
5549
5549
  disabled: !f.hasBackground
@@ -5552,7 +5552,7 @@ const Ut = {
5552
5552
  ] })
5553
5553
  ] })
5554
5554
  ] });
5555
- }, j = () => /* @__PURE__ */ e.jsxs("div", { className: "property-group", children: [
5555
+ }, T = () => /* @__PURE__ */ e.jsxs("div", { className: "property-group", children: [
5556
5556
  /* @__PURE__ */ e.jsx("h4", { children: "Shape Properties" }),
5557
5557
  /* @__PURE__ */ e.jsxs("div", { className: "property-row", children: [
5558
5558
  /* @__PURE__ */ e.jsx("label", { children: "Fill Color" }),
@@ -5648,7 +5648,7 @@ const Ut = {
5648
5648
  }
5649
5649
  )
5650
5650
  ] })
5651
- ] }), R = () => /* @__PURE__ */ e.jsxs("div", { className: "property-group", children: [
5651
+ ] }), A = () => /* @__PURE__ */ e.jsxs("div", { className: "property-group", children: [
5652
5652
  /* @__PURE__ */ e.jsx("h4", { children: "Position & Size" }),
5653
5653
  /* @__PURE__ */ e.jsxs("div", { className: "property-row", children: [
5654
5654
  /* @__PURE__ */ e.jsxs("div", { className: "input-group", children: [
@@ -5776,7 +5776,7 @@ const Ut = {
5776
5776
  )
5777
5777
  ] })
5778
5778
  ] })
5779
- ] }), z = () => /* @__PURE__ */ e.jsxs("div", { className: "property-group", children: [
5779
+ ] }), E = () => /* @__PURE__ */ e.jsxs("div", { className: "property-group", children: [
5780
5780
  /* @__PURE__ */ e.jsx("h4", { children: "Layer Controls" }),
5781
5781
  /* @__PURE__ */ e.jsxs("div", { className: "button-group vertical", children: [
5782
5782
  /* @__PURE__ */ e.jsx("button", { onClick: () => a(f.id, "top"), children: "Bring to Front" }),
@@ -5803,12 +5803,12 @@ const Ut = {
5803
5803
  /* @__PURE__ */ e.jsx("span", { className: "element-type", children: f.type })
5804
5804
  ] }),
5805
5805
  /* @__PURE__ */ e.jsxs("div", { className: "panel-content", children: [
5806
- f.type === "text" && d(),
5807
- B.includes(f.type) && j(),
5806
+ f.type === "text" && c(),
5807
+ B.includes(f.type) && T(),
5808
5808
  f.type === "image" && F(),
5809
5809
  f.type === "horizontalLine" && y(),
5810
- R(),
5811
- z(),
5810
+ A(),
5811
+ E(),
5812
5812
  /* @__PURE__ */ e.jsx("div", { className: "property-group", children: /* @__PURE__ */ e.jsxs(
5813
5813
  "button",
5814
5814
  {
@@ -5822,7 +5822,7 @@ const Ut = {
5822
5822
  ) })
5823
5823
  ] })
5824
5824
  ] });
5825
- }, si = ({
5825
+ }, li = ({
5826
5826
  elements: f,
5827
5827
  selectedElement: o,
5828
5828
  onSelectElement: a,
@@ -5830,8 +5830,8 @@ const Ut = {
5830
5830
  onDeleteElement: s,
5831
5831
  theme: h
5832
5832
  }) => {
5833
- const x = (d, j) => {
5834
- switch (d) {
5833
+ const x = (c, T) => {
5834
+ switch (c) {
5835
5835
  case "text":
5836
5836
  return "T";
5837
5837
  case "rectangle":
@@ -5871,32 +5871,32 @@ const Ut = {
5871
5871
  default:
5872
5872
  return "?";
5873
5873
  }
5874
- }, n = (d) => {
5875
- var j, F;
5876
- if (d.type === "text")
5877
- return d.isIcon && d.iconData ? `Icon: ${d.iconData.name}` : ((j = d.text) == null ? void 0 : j.substring(0, 20)) + (((F = d.text) == null ? void 0 : F.length) > 20 ? "..." : "") || "Text";
5878
- if (d.type === "qrcode")
5879
- return `QR Code: ${(d.data || "").substring(0, 15) + ((d.data || "").length > 15 ? "..." : "")}`;
5880
- if (d.type === "barcode") {
5881
- const R = d.format || "CODE128", y = d.data || "";
5882
- return `Barcode (${R}): ${y.substring(0, 10) + (y.length > 10 ? "..." : "")}`;
5874
+ }, n = (c) => {
5875
+ var T, F;
5876
+ if (c.type === "text")
5877
+ return c.isIcon && c.iconData ? `Icon: ${c.iconData.name}` : ((T = c.text) == null ? void 0 : T.substring(0, 20)) + (((F = c.text) == null ? void 0 : F.length) > 20 ? "..." : "") || "Text";
5878
+ if (c.type === "qrcode")
5879
+ return `QR Code: ${(c.data || "").substring(0, 15) + ((c.data || "").length > 15 ? "..." : "")}`;
5880
+ if (c.type === "barcode") {
5881
+ const A = c.format || "CODE128", y = c.data || "";
5882
+ return `Barcode (${A}): ${y.substring(0, 10) + (y.length > 10 ? "..." : "")}`;
5883
5883
  }
5884
- return d.type === "sticker" ? `Sticker: ${(d.name || "Untitled").substring(0, 15)}` : d.type === "embroidery" ? `Embroidery: ${(d.name || "Design").substring(0, 15)}` : d.type.charAt(0).toUpperCase() + d.type.slice(1);
5884
+ return c.type === "sticker" ? `Sticker: ${(c.name || "Untitled").substring(0, 15)}` : c.type === "embroidery" ? `Embroidery: ${(c.name || "Design").substring(0, 15)}` : c.type.charAt(0).toUpperCase() + c.type.slice(1);
5885
5885
  };
5886
5886
  return /* @__PURE__ */ e.jsxs("div", { className: "layers-panel", children: [
5887
5887
  /* @__PURE__ */ e.jsxs("div", { className: "panel-header", children: [
5888
5888
  /* @__PURE__ */ e.jsx("h3", { children: "Layers" }),
5889
5889
  /* @__PURE__ */ e.jsx("span", { className: "layer-count", children: f.length })
5890
5890
  ] }),
5891
- /* @__PURE__ */ e.jsx("div", { className: "layers-list", children: f.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "no-layers", children: "No elements added yet" }) : [...f].reverse().map((d, j) => /* @__PURE__ */ e.jsxs(
5891
+ /* @__PURE__ */ e.jsx("div", { className: "layers-list", children: f.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "no-layers", children: "No elements added yet" }) : [...f].reverse().map((c, T) => /* @__PURE__ */ e.jsxs(
5892
5892
  "div",
5893
5893
  {
5894
- className: `layer-item ${(o == null ? void 0 : o.id) === d.id ? "selected" : ""}`,
5895
- onClick: () => a(d),
5894
+ className: `layer-item ${(o == null ? void 0 : o.id) === c.id ? "selected" : ""}`,
5895
+ onClick: () => a(c),
5896
5896
  children: [
5897
5897
  /* @__PURE__ */ e.jsxs("div", { className: "layer-info", children: [
5898
- /* @__PURE__ */ e.jsx("span", { className: "layer-icon", children: x(d.type) }),
5899
- /* @__PURE__ */ e.jsx("span", { className: "layer-name", children: n(d) })
5898
+ /* @__PURE__ */ e.jsx("span", { className: "layer-icon", children: x(c.type) }),
5899
+ /* @__PURE__ */ e.jsx("span", { className: "layer-name", children: n(c) })
5900
5900
  ] }),
5901
5901
  /* @__PURE__ */ e.jsxs("div", { className: "layer-controls", children: [
5902
5902
  /* @__PURE__ */ e.jsx(
@@ -5904,9 +5904,9 @@ const Ut = {
5904
5904
  {
5905
5905
  className: "layer-btn",
5906
5906
  onClick: (F) => {
5907
- F.stopPropagation(), l(d.id, "up");
5907
+ F.stopPropagation(), l(c.id, "up");
5908
5908
  },
5909
- disabled: j === 0,
5909
+ disabled: T === 0,
5910
5910
  title: "Move Up",
5911
5911
  children: "↑"
5912
5912
  }
@@ -5916,9 +5916,9 @@ const Ut = {
5916
5916
  {
5917
5917
  className: "layer-btn",
5918
5918
  onClick: (F) => {
5919
- F.stopPropagation(), l(d.id, "down");
5919
+ F.stopPropagation(), l(c.id, "down");
5920
5920
  },
5921
- disabled: j === f.length - 1,
5921
+ disabled: T === f.length - 1,
5922
5922
  title: "Move Down",
5923
5923
  children: "↓"
5924
5924
  }
@@ -5928,7 +5928,7 @@ const Ut = {
5928
5928
  {
5929
5929
  className: "layer-btn delete",
5930
5930
  onClick: (F) => {
5931
- F.stopPropagation(), s(d.id);
5931
+ F.stopPropagation(), s(c.id);
5932
5932
  },
5933
5933
  title: "Delete",
5934
5934
  children: "×"
@@ -5937,40 +5937,40 @@ const Ut = {
5937
5937
  ] })
5938
5938
  ]
5939
5939
  },
5940
- d.id
5940
+ c.id
5941
5941
  )) })
5942
5942
  ] });
5943
5943
  };
5944
- class li {
5944
+ class ni {
5945
5945
  constructor() {
5946
5946
  this.canvas = document.createElement("canvas"), this.ctx = this.canvas.getContext("2d");
5947
5947
  }
5948
5948
  // Add this method to the ExportManager class
5949
5949
  async exportAllSections(o, a, l, s, h = "png", x = !0) {
5950
5950
  const n = {};
5951
- for (const d of a) {
5952
- const j = d.id || d.sectionName, F = o[j];
5951
+ for (const c of a) {
5952
+ const T = c.id || c.sectionName, F = o[T];
5953
5953
  if (!F || !F.elements || F.elements.length === 0) {
5954
- console.log(`Skipping section ${j} - no elements`);
5954
+ console.log(`Skipping section ${T} - no elements`);
5955
5955
  continue;
5956
5956
  }
5957
5957
  if (this.canvas.width = l, this.canvas.height = s, this.ctx.clearRect(0, 0, l, s), x) {
5958
- const y = d.image || d.sectionImage;
5958
+ const y = c.image || c.sectionImage;
5959
5959
  if (y)
5960
5960
  try {
5961
- const z = await this.loadImage(y);
5962
- await this.processImageColor(z, F.selectedColor || "#FFFFFF"), this.ctx.drawImage(this.processedImage, 0, 0, l, s);
5963
- } catch (z) {
5964
- console.warn("Failed to load background image:", z);
5961
+ const E = await this.loadImage(y);
5962
+ await this.processImageColor(E, F.selectedColor || "#FFFFFF"), this.ctx.drawImage(this.processedImage, 0, 0, l, s);
5963
+ } catch (E) {
5964
+ console.warn("Failed to load background image:", E);
5965
5965
  }
5966
5966
  } else
5967
5967
  this.ctx.clearRect(0, 0, l, s);
5968
5968
  for (const y of F.elements)
5969
5969
  await this.drawElement(y);
5970
- const R = this.canvas.toDataURL(`image/${h}`, h === "jpeg" ? 0.9 : void 0);
5971
- n[j] = {
5972
- dataUrl: R,
5973
- blob: await this.dataUrlToBlob(R)
5970
+ const A = this.canvas.toDataURL(`image/${h}`, h === "jpeg" ? 0.9 : void 0);
5971
+ n[T] = {
5972
+ dataUrl: A,
5973
+ blob: await this.dataUrlToBlob(A)
5974
5974
  };
5975
5975
  }
5976
5976
  return n;
@@ -5988,7 +5988,7 @@ class li {
5988
5988
  } else
5989
5989
  for (const s of l) {
5990
5990
  const { blob: h } = o[s], x = URL.createObjectURL(h), n = document.createElement("a");
5991
- n.href = x, n.download = `${a}-${s}.png`, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(x), await new Promise((d) => setTimeout(d, 100));
5991
+ n.href = x, n.download = `${a}-${s}.png`, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(x), await new Promise((c) => setTimeout(c, 100));
5992
5992
  }
5993
5993
  }
5994
5994
  async loadImage(o) {
@@ -6010,17 +6010,17 @@ class li {
6010
6010
  console.warn("Invalid target color:", a);
6011
6011
  return;
6012
6012
  }
6013
- const { r: d, g: j, b: F } = n;
6014
- for (let R = 0; R < x.length; R += 4) {
6015
- if (x[R + 3] === 0) continue;
6016
- const z = this.getLuma(x[R], x[R + 1], x[R + 2]);
6017
- x[R] = Math.round(d * z), x[R + 1] = Math.round(j * z), x[R + 2] = Math.round(F * z);
6013
+ const { r: c, g: T, b: F } = n;
6014
+ for (let A = 0; A < x.length; A += 4) {
6015
+ if (x[A + 3] === 0) continue;
6016
+ const E = this.getLuma(x[A], x[A + 1], x[A + 2]);
6017
+ x[A] = Math.round(c * E), x[A + 1] = Math.round(T * E), x[A + 2] = Math.round(F * E);
6018
6018
  }
6019
- return s.putImageData(h, 0, 0), this.processedImage = new Image(), new Promise((R) => {
6019
+ return s.putImageData(h, 0, 0), this.processedImage = new Image(), new Promise((A) => {
6020
6020
  this.processedImage.onload = () => {
6021
- R();
6021
+ A();
6022
6022
  }, this.processedImage.onerror = () => {
6023
- console.error("Failed to create processed image"), R();
6023
+ console.error("Failed to create processed image"), A();
6024
6024
  }, this.processedImage.src = l.toDataURL("image/png");
6025
6025
  });
6026
6026
  }
@@ -6109,8 +6109,8 @@ class li {
6109
6109
  const a = o.width / 2, l = o.height / 2, s = Math.min(o.width, o.height) / 2, h = s * 0.4, x = o.numPoints || 5;
6110
6110
  this.ctx.beginPath();
6111
6111
  for (let n = 0; n < x * 2; n++) {
6112
- const d = n % 2 === 0 ? s : h, j = n * Math.PI / x, F = a + Math.cos(j) * d, R = l + Math.sin(j) * d;
6113
- n === 0 ? this.ctx.moveTo(F, R) : this.ctx.lineTo(F, R);
6112
+ const c = n % 2 === 0 ? s : h, T = n * Math.PI / x, F = a + Math.cos(T) * c, A = l + Math.sin(T) * c;
6113
+ n === 0 ? this.ctx.moveTo(F, A) : this.ctx.lineTo(F, A);
6114
6114
  }
6115
6115
  this.ctx.closePath(), o.fill && o.fill !== "transparent" && (this.ctx.fillStyle = o.fill, this.ctx.fill()), o.stroke && o.strokeWidth > 0 && (this.ctx.strokeStyle = o.stroke, this.ctx.lineWidth = o.strokeWidth, this.ctx.stroke());
6116
6116
  }
@@ -6143,8 +6143,8 @@ class li {
6143
6143
  const a = o.width / 2, l = o.height / 2, s = Math.min(o.width, o.height) / 2, h = 6;
6144
6144
  this.ctx.beginPath();
6145
6145
  for (let x = 0; x < h; x++) {
6146
- const n = x * 2 * Math.PI / h - Math.PI / 2, d = a + s * Math.cos(n), j = l + s * Math.sin(n);
6147
- x === 0 ? this.ctx.moveTo(d, j) : this.ctx.lineTo(d, j);
6146
+ const n = x * 2 * Math.PI / h - Math.PI / 2, c = a + s * Math.cos(n), T = l + s * Math.sin(n);
6147
+ x === 0 ? this.ctx.moveTo(c, T) : this.ctx.lineTo(c, T);
6148
6148
  }
6149
6149
  this.ctx.closePath(), o.fill && o.fill !== "transparent" && (this.ctx.fillStyle = o.fill, this.ctx.fill()), o.stroke && o.strokeWidth > 0 && (this.ctx.strokeStyle = o.stroke, this.ctx.lineWidth = o.strokeWidth, this.ctx.stroke());
6150
6150
  }
@@ -6152,8 +6152,8 @@ class li {
6152
6152
  const a = o.width / 2, l = o.height / 2, s = Math.min(o.width, o.height) / 2, h = 5;
6153
6153
  this.ctx.beginPath();
6154
6154
  for (let x = 0; x < h; x++) {
6155
- const n = x * 2 * Math.PI / h - Math.PI / 2, d = a + s * Math.cos(n), j = l + s * Math.sin(n);
6156
- x === 0 ? this.ctx.moveTo(d, j) : this.ctx.lineTo(d, j);
6155
+ const n = x * 2 * Math.PI / h - Math.PI / 2, c = a + s * Math.cos(n), T = l + s * Math.sin(n);
6156
+ x === 0 ? this.ctx.moveTo(c, T) : this.ctx.lineTo(c, T);
6157
6157
  }
6158
6158
  this.ctx.closePath(), o.fill && o.fill !== "transparent" && (this.ctx.fillStyle = o.fill, this.ctx.fill()), o.stroke && o.strokeWidth > 0 && (this.ctx.strokeStyle = o.stroke, this.ctx.lineWidth = o.strokeWidth, this.ctx.stroke());
6159
6159
  }
@@ -6274,26 +6274,26 @@ class li {
6274
6274
  }
6275
6275
  // Export all sections as JSON with File objects
6276
6276
  async exportAllSectionsAsJSON(o, a, l, s, h = "png") {
6277
- const x = [], n = [], d = {};
6277
+ const x = [], n = [], c = {};
6278
6278
  for (const F of a) {
6279
- const R = F.id || F.sectionName, y = o[R];
6279
+ const A = F.id || F.sectionName, y = o[A];
6280
6280
  if (!y || !y.elements || y.elements.length === 0) {
6281
- console.log(`Skipping section ${R} - no elements`);
6281
+ console.log(`Skipping section ${A} - no elements`);
6282
6282
  continue;
6283
6283
  }
6284
- const z = {
6284
+ const E = {
6285
6285
  ...y,
6286
6286
  // Include background information
6287
6287
  backgroundImage: F.image || F.sectionImage,
6288
6288
  sectionImage: F.image || F.sectionImage,
6289
- sectionName: R,
6289
+ sectionName: A,
6290
6290
  // Ensure we have the selected color
6291
6291
  selectedColor: y.selectedColor || "#FFFFFF",
6292
6292
  // Include canvas dimensions
6293
6293
  canvasWidth: l,
6294
6294
  canvasHeight: s
6295
6295
  };
6296
- d[R] = z;
6296
+ c[A] = E;
6297
6297
  const B = await this.exportSectionAsBlob(
6298
6298
  y,
6299
6299
  F,
@@ -6305,11 +6305,11 @@ class li {
6305
6305
  if (B) {
6306
6306
  const C = await this.blobToFile(
6307
6307
  B,
6308
- `${R}-full.${h}`,
6308
+ `${A}-full.${h}`,
6309
6309
  `image/${h}`
6310
6310
  );
6311
6311
  x.push({
6312
- sectionName: R,
6312
+ sectionName: A,
6313
6313
  sectionImage: C
6314
6314
  });
6315
6315
  }
@@ -6324,19 +6324,20 @@ class li {
6324
6324
  if (k) {
6325
6325
  const C = await this.blobToFile(
6326
6326
  k,
6327
- `${R}-print.${h}`,
6327
+ `${A}-print.${h}`,
6328
6328
  `image/${h}`
6329
6329
  );
6330
6330
  n.push({
6331
- sectionName: R,
6331
+ sectionName: A,
6332
6332
  sectionImage: C
6333
6333
  });
6334
6334
  }
6335
6335
  }
6336
- const j = {
6337
- sections: d,
6336
+ const T = {
6337
+ sections: c,
6338
6338
  canvasWidth: l,
6339
6339
  canvasHeight: s,
6340
+ sectionImage: a[0].image || a[0].sectionImage,
6340
6341
  format: h,
6341
6342
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
6342
6343
  version: "1.0",
@@ -6352,7 +6353,7 @@ class li {
6352
6353
  return {
6353
6354
  fullDesign: x,
6354
6355
  printReady: n,
6355
- designFile: JSON.stringify(j)
6356
+ designFile: JSON.stringify(T)
6356
6357
  };
6357
6358
  }
6358
6359
  // Helper method to export a single section as blob
@@ -6362,10 +6363,10 @@ class li {
6362
6363
  const n = a.image || a.sectionImage;
6363
6364
  if (n)
6364
6365
  try {
6365
- const d = await this.loadImage(n);
6366
- await this.processImageColor(d, o.selectedColor || "#FFFFFF"), this.ctx.drawImage(this.processedImage, 0, 0, l, s);
6367
- } catch (d) {
6368
- console.warn("Failed to load background image:", d);
6366
+ const c = await this.loadImage(n);
6367
+ await this.processImageColor(c, o.selectedColor || "#FFFFFF"), this.ctx.drawImage(this.processedImage, 0, 0, l, s);
6368
+ } catch (c) {
6369
+ console.warn("Failed to load background image:", c);
6369
6370
  }
6370
6371
  } else
6371
6372
  this.ctx.clearRect(0, 0, l, s);
@@ -6379,14 +6380,14 @@ class li {
6379
6380
  }
6380
6381
  }
6381
6382
  async exportCurrentSectionAsJSON(o, a = "png") {
6382
- var R, y, z, B, k, C, J, T, O;
6383
- const l = ((R = o.activeSection) == null ? void 0 : R.sectionName) || "main", s = {
6383
+ var A, y, E, B, k, C, J, j, O;
6384
+ const l = ((A = o.activeSection) == null ? void 0 : A.sectionName) || "main", s = {
6384
6385
  elements: o.elements,
6385
6386
  selectedColor: o.selectedColor,
6386
6387
  canvasWidth: o.canvasWidth,
6387
6388
  canvasHeight: o.canvasHeight,
6388
6389
  // Include background information
6389
- backgroundImage: ((y = o.activeSection) == null ? void 0 : y.sectionImage) || ((z = o.activeSection) == null ? void 0 : z.image),
6390
+ backgroundImage: ((y = o.activeSection) == null ? void 0 : y.sectionImage) || ((E = o.activeSection) == null ? void 0 : E.image),
6390
6391
  sectionImage: ((B = o.activeSection) == null ? void 0 : B.sectionImage) || ((k = o.activeSection) == null ? void 0 : k.image),
6391
6392
  sectionName: l,
6392
6393
  zoomLevel: o.zoomLevel,
@@ -6397,7 +6398,7 @@ class li {
6397
6398
  sectionName: l,
6398
6399
  image: (C = o.activeSection) == null ? void 0 : C.sectionImage,
6399
6400
  sectionImage: (J = o.activeSection) == null ? void 0 : J.sectionImage
6400
- }, x = [], n = [], d = await this.exportSectionAsBlob(
6401
+ }, x = [], n = [], c = await this.exportSectionAsBlob(
6401
6402
  s,
6402
6403
  h,
6403
6404
  o.canvasWidth,
@@ -6405,9 +6406,9 @@ class li {
6405
6406
  a,
6406
6407
  !0
6407
6408
  );
6408
- if (d) {
6409
+ if (c) {
6409
6410
  const v = await this.blobToFile(
6410
- d,
6411
+ c,
6411
6412
  `${l}-full.${a}`,
6412
6413
  `image/${a}`
6413
6414
  );
@@ -6416,7 +6417,7 @@ class li {
6416
6417
  sectionImage: v
6417
6418
  });
6418
6419
  }
6419
- const j = await this.exportSectionAsBlob(
6420
+ const T = await this.exportSectionAsBlob(
6420
6421
  s,
6421
6422
  h,
6422
6423
  o.canvasWidth,
@@ -6424,9 +6425,9 @@ class li {
6424
6425
  a,
6425
6426
  !1
6426
6427
  );
6427
- if (j) {
6428
+ if (T) {
6428
6429
  const v = await this.blobToFile(
6429
- j,
6430
+ T,
6430
6431
  `${l}-print.${a}`,
6431
6432
  `image/${a}`
6432
6433
  );
@@ -6446,7 +6447,7 @@ class li {
6446
6447
  productInfo: {
6447
6448
  sections: [{
6448
6449
  sectionName: l,
6449
- sectionImage: ((T = o.activeSection) == null ? void 0 : T.sectionImage) || ((O = o.activeSection) == null ? void 0 : O.image),
6450
+ sectionImage: ((j = o.activeSection) == null ? void 0 : j.sectionImage) || ((O = o.activeSection) == null ? void 0 : O.image),
6450
6451
  id: l
6451
6452
  }]
6452
6453
  }
@@ -6458,7 +6459,7 @@ class li {
6458
6459
  };
6459
6460
  }
6460
6461
  }
6461
- class ni {
6462
+ class ci {
6462
6463
  constructor(o = "localStorage") {
6463
6464
  this.storage = o === "sessionStorage" ? sessionStorage : localStorage, this.STORAGE_PREFIX = "mypixia_canvas_", this.DESIGNS_LIST_KEY = "mypixia_saved_designs";
6464
6465
  }
@@ -6628,7 +6629,7 @@ class ni {
6628
6629
  timestamp: l,
6629
6630
  lastModified: l
6630
6631
  };
6631
- h >= 0 ? s[h] = x : s.push(x), s.sort((n, d) => new Date(d.timestamp) - new Date(n.timestamp)), this.storage.setItem(this.DESIGNS_LIST_KEY, JSON.stringify(s));
6632
+ h >= 0 ? s[h] = x : s.push(x), s.sort((n, c) => new Date(c.timestamp) - new Date(n.timestamp)), this.storage.setItem(this.DESIGNS_LIST_KEY, JSON.stringify(s));
6632
6633
  }
6633
6634
  validateDesignData(o) {
6634
6635
  return o && o.id && o.name && o.canvasData && Array.isArray(o.canvasData.elements);
@@ -6648,7 +6649,7 @@ class ni {
6648
6649
  return "Unknown";
6649
6650
  }
6650
6651
  }
6651
- const ci = Oe((f, o) => {
6652
+ const di = Qe((f, o) => {
6652
6653
  const {
6653
6654
  theme: a = {
6654
6655
  primaryColor: "#000000",
@@ -6679,45 +6680,45 @@ const ci = Oe((f, o) => {
6679
6680
  ]
6680
6681
  },
6681
6682
  initFile: h
6682
- } = f, [x, n] = A([]), [d, j] = A(null), [F, R] = A(!1), [y, z] = A(!1), [B, k] = A(!1), [C, J] = A({ x: 0, y: 0 }), [T, O] = A(null), [v, lt] = A(800), [W, yt] = A(600), [Q, ht] = A(1), [$, at] = A(s.colorSettings[0]), [M, nt] = A(!1), [tt, ct] = A(!0), [q, P] = A(!0), [p, et] = A(s.sections[0]), [u, D] = A(!1), [L, H] = A({}), [G, it] = A([]), [X, V] = A(-1), [U] = A(new ni("localStorage")), K = gt(null), kt = gt(null), xt = gt(null), ut = gt(null), Ot = gt(null), zt = gt(new li()), wt = gt(!1), st = rt(() => {
6683
+ } = f, [x, n] = N([]), [c, T] = N(null), [F, A] = N(!1), [y, E] = N(!1), [B, k] = N(!1), [C, J] = N({ x: 0, y: 0 }), [j, O] = N(null), [v, st] = N(800), [W, yt] = N(600), [Q, ft] = N(1), [H, at] = N(s.colorSettings[0]), [M, nt] = N(!1), [tt, ct] = N(!0), [q, P] = N(!0), [p, et] = N(s.sections[0]), [u, D] = N(!1), [L, G] = N({}), [_, it] = N([]), [X, V] = N(-1), [U] = N(new ci("localStorage")), K = gt(null), kt = gt(null), xt = gt(null), ut = gt(null), Ot = gt(null), Bt = gt(new ni()), wt = gt(!1), [fi, ne] = N(null), lt = rt(() => {
6683
6684
  const i = {
6684
6685
  elements: JSON.parse(JSON.stringify(x)),
6685
- selectedElement: d ? { ...d } : null,
6686
+ selectedElement: c ? { ...c } : null,
6686
6687
  timestamp: Date.now()
6687
- }, t = G.slice(0, X + 1);
6688
+ }, t = _.slice(0, X + 1);
6688
6689
  t.push(i), t.length > 50 ? t.shift() : V(X + 1), it(t);
6689
- }, [x, d, G, X]), St = rt(() => ({
6690
+ }, [x, c, _, X]), St = rt(() => ({
6690
6691
  elements: x,
6691
6692
  canvasWidth: v,
6692
6693
  canvasHeight: W,
6693
- selectedColor: $,
6694
+ selectedColor: H,
6694
6695
  activeSection: p,
6695
6696
  product: s,
6696
6697
  sectionDesigns: L,
6697
6698
  zoomLevel: Q,
6698
6699
  showGrid: M,
6699
6700
  snapToGrid: q,
6700
- selectedElement: d ? { ...d } : null,
6701
+ selectedElement: c ? { ...c } : null,
6701
6702
  canvasRef: K
6702
6703
  // Include reference for thumbnail generation
6703
- }), [x, v, W, $, p, s, L, Q, M, q, d]);
6704
+ }), [x, v, W, H, p, s, L, Q, M, q, c]);
6704
6705
  Z(() => {
6705
6706
  const t = setTimeout(async () => {
6706
- if (x.length === 0 && G.length <= 1) {
6707
+ if (x.length === 0 && _.length <= 1) {
6707
6708
  if (h)
6708
6709
  try {
6709
- const N = await fetch(h);
6710
- if (N.ok) {
6711
- const E = await N.text();
6712
- if (E.trim()) {
6713
- const Y = JSON.parse(E.trim());
6714
- if (Y.sections && typeof Y.sections == "object") {
6715
- const ft = Object.keys(Y.sections)[0], ot = Y.sections[ft];
6710
+ const I = await fetch(h);
6711
+ if (I.ok) {
6712
+ const z = await I.text();
6713
+ if (z.trim()) {
6714
+ const $ = JSON.parse(z.trim());
6715
+ if (console.log("design data is", $), ne($), $.sections && typeof $.sections == "object") {
6716
+ const dt = Object.keys($.sections)[0], ot = $.sections[dt];
6716
6717
  if (ot && ot.elements) {
6717
- console.log("Loading design from file:", h), n(ot.elements || []), lt(ot.canvasWidth || 800), yt(ot.canvasHeight || 600), at(ot.selectedColor || s.colorSettings[0]), ht(ot.zoomLevel || 1), nt(ot.showGrid || !1), P(ot.snapToGrid || !0), j(null), Y.sections && H(Y.sections);
6718
- const Rt = s.sections.find((Dt) => Dt.sectionName === ft);
6718
+ console.log("Loading design from file:", h), n(ot.elements || []), st(ot.canvasWidth || 800), yt(ot.canvasHeight || 600), at(ot.selectedColor || s.colorSettings[0]), ft(ot.zoomLevel || 1), nt(ot.showGrid || !1), P(ot.snapToGrid || !0), T(null), $.sections && G($.sections);
6719
+ const Rt = s.sections.find((Dt) => Dt.sectionName === dt);
6719
6720
  Rt && et(Rt), it([]), V(-1), setTimeout(() => {
6720
- st();
6721
+ lt();
6721
6722
  }, 100);
6722
6723
  return;
6723
6724
  }
@@ -6725,13 +6726,13 @@ const ci = Oe((f, o) => {
6725
6726
  }
6726
6727
  } else
6727
6728
  console.warn("Failed to load design file, using default text");
6728
- } catch (N) {
6729
- console.error("Error loading design file:", N), console.warn("Using default text instead");
6729
+ } catch (I) {
6730
+ console.error("Error loading design file:", I), console.warn("Using default text instead");
6730
6731
  }
6731
- const r = 24, c = "Arial", g = "Change me", w = document.createElement("canvas").getContext("2d");
6732
- w.font = `${r}px ${c}`;
6733
- const b = w.measureText(g).width, I = {
6734
- id: dt(),
6732
+ const r = 24, d = "Arial", g = "Change me", w = document.createElement("canvas").getContext("2d");
6733
+ w.font = `${r}px ${d}`;
6734
+ const b = w.measureText(g).width, R = {
6735
+ id: ht(),
6735
6736
  type: "text",
6736
6737
  x: v / 2 - b / 2,
6737
6738
  // Center the actual text width
@@ -6741,52 +6742,7 @@ const ci = Oe((f, o) => {
6741
6742
  height: r,
6742
6743
  text: g,
6743
6744
  fontSize: r,
6744
- fontFamily: c,
6745
- fontWeight: "normal",
6746
- fontStyle: "normal",
6747
- textAlign: "left",
6748
- // Use left alignment to match positioning
6749
- fill: "#000000",
6750
- stroke: "",
6751
- strokeWidth: 0,
6752
- rotation: 0,
6753
- opacity: 1
6754
- };
6755
- n([I]), j(I), setTimeout(() => {
6756
- st();
6757
- }, 100);
6758
- }
6759
- }, 300);
6760
- return () => clearTimeout(t);
6761
- }, [h, s.colorSettings, s.sections]), Z(() => {
6762
- const t = setTimeout(async () => {
6763
- if (x.length === 0 && G.length <= 1) {
6764
- let r = "Change me";
6765
- if (h && f.initFile.length > 0)
6766
- try {
6767
- const N = await fetch(h);
6768
- if (N.ok) {
6769
- const E = await N.text();
6770
- console.log("fileContent", E), E.trim() && (r = E.trim());
6771
- } else
6772
- console.warn("Failed to load file content, using default text");
6773
- } catch (N) {
6774
- console.error("Error loading file content:", N), console.warn("Using default text instead");
6775
- }
6776
- const c = 24, g = "Arial", w = document.createElement("canvas").getContext("2d");
6777
- w.font = `${c}px ${g}`;
6778
- const b = w.measureText(r).width, I = {
6779
- id: dt(),
6780
- type: "text",
6781
- x: v / 2 - b / 2,
6782
- // Center the actual text width
6783
- y: W / 2 - c / 2,
6784
- // Center based on font size
6785
- width: b,
6786
- height: c,
6787
- text: r,
6788
- fontSize: c,
6789
- fontFamily: g,
6745
+ fontFamily: d,
6790
6746
  fontWeight: "normal",
6791
6747
  fontStyle: "normal",
6792
6748
  textAlign: "left",
@@ -6797,16 +6753,16 @@ const ci = Oe((f, o) => {
6797
6753
  rotation: 0,
6798
6754
  opacity: 1
6799
6755
  };
6800
- n([I]), j(I), setTimeout(() => {
6801
- st();
6756
+ n([R]), T(R), setTimeout(() => {
6757
+ lt();
6802
6758
  }, 100);
6803
6759
  }
6804
6760
  }, 300);
6805
6761
  return () => clearTimeout(t);
6806
- }, [h]);
6807
- const Bt = rt((i = "png", t = !0) => {
6762
+ }, [h, s.colorSettings, s.sections]);
6763
+ const zt = rt((i = "png", t = !0) => {
6808
6764
  const r = St();
6809
- return s.sections, zt.current.exportAllSections(
6765
+ return s.sections, Bt.current.exportAllSections(
6810
6766
  { [(p == null ? void 0 : p.sectionName) || "main"]: r },
6811
6767
  [{
6812
6768
  id: (p == null ? void 0 : p.sectionName) || "main",
@@ -6819,7 +6775,7 @@ const ci = Oe((f, o) => {
6819
6775
  i,
6820
6776
  t
6821
6777
  );
6822
- }, [St, s.sections, p, v, W]), ne = [
6778
+ }, [St, s.sections, p, v, W]), ce = [
6823
6779
  "Arial",
6824
6780
  "Helvetica",
6825
6781
  "Times New Roman",
@@ -6843,10 +6799,10 @@ const ci = Oe((f, o) => {
6843
6799
  const i = document.createElement("canvas");
6844
6800
  i.width = v, i.height = W, Ot.current = i;
6845
6801
  }, [v, W]), Z(() => {
6846
- G.length === 0 && st();
6802
+ _.length === 0 && lt();
6847
6803
  }, []);
6848
- const It = (i, t, r, c, g, m) => {
6849
- i.beginPath(), i.moveTo(t + m, r), i.lineTo(t + c - m, r), i.quadraticCurveTo(t + c, r, t + c, r + m), i.lineTo(t + c, r + g - m), i.quadraticCurveTo(t + c, r + g, t + c - m, r + g), i.lineTo(t + m, r + g), i.quadraticCurveTo(t, r + g, t, r + g - m), i.lineTo(t, r + m), i.quadraticCurveTo(t, r, t + m, r), i.closePath();
6804
+ const It = (i, t, r, d, g, m) => {
6805
+ i.beginPath(), i.moveTo(t + m, r), i.lineTo(t + d - m, r), i.quadraticCurveTo(t + d, r, t + d, r + m), i.lineTo(t + d, r + g - m), i.quadraticCurveTo(t + d, r + g, t + d - m, r + g), i.lineTo(t + m, r + g), i.quadraticCurveTo(t, r + g, t, r + g - m), i.lineTo(t, r + m), i.quadraticCurveTo(t, r, t + m, r), i.closePath();
6850
6806
  }, Qt = (i, t) => {
6851
6807
  if (!t.isIcon)
6852
6808
  return {
@@ -6858,80 +6814,80 @@ const ci = Oe((f, o) => {
6858
6814
  cy: t.y + t.height / 2
6859
6815
  };
6860
6816
  i.save(), i.font = `${t.fontStyle || ""} ${t.fontWeight || ""} ${t.fontSize}px ${t.fontFamily}`, i.textBaseline = "alphabetic", i.textAlign = "left";
6861
- const r = i.measureText(t.text), c = r.actualBoundingBoxAscent ?? t.fontSize * 0.8, g = r.actualBoundingBoxDescent ?? t.fontSize * 0.2, m = r.actualBoundingBoxLeft ?? 0, w = r.actualBoundingBoxRight ?? r.width, S = m + w, b = c + g, I = t.x, N = t.y, E = I - S / 2 - m, Y = N - b / 2 - c;
6862
- return i.restore(), { x: E, y: Y, width: S, height: b, cx: I, cy: N };
6863
- }, ce = (i, t) => {
6817
+ const r = i.measureText(t.text), d = r.actualBoundingBoxAscent ?? t.fontSize * 0.8, g = r.actualBoundingBoxDescent ?? t.fontSize * 0.2, m = r.actualBoundingBoxLeft ?? 0, w = r.actualBoundingBoxRight ?? r.width, S = m + w, b = d + g, R = t.x, I = t.y, z = R - S / 2 - m, $ = I - b / 2 - d;
6818
+ return i.restore(), { x: z, y: $, width: S, height: b, cx: R, cy: I };
6819
+ }, de = (i, t) => {
6864
6820
  if (!t) return;
6865
- const r = 8, c = 8, g = 4, m = 30, w = Qt(i, t), S = t.isIcon ? Math.max(r, 12) : r, b = {
6821
+ const r = 8, d = 8, g = 4, m = 30, w = Qt(i, t), S = t.isIcon ? Math.max(r, 12) : r, b = {
6866
6822
  x: -w.width / 2 - S,
6867
6823
  y: -w.height / 2 - S,
6868
6824
  w: w.width + S * 2,
6869
6825
  h: w.height + S * 2
6870
6826
  };
6871
6827
  i.save(), i.translate(w.cx, w.cy), t.rotation && i.rotate(t.rotation * Math.PI / 180);
6872
- const I = i.createLinearGradient(
6828
+ const R = i.createLinearGradient(
6873
6829
  b.x,
6874
6830
  b.y,
6875
6831
  b.x + b.w,
6876
6832
  b.y + b.h
6877
6833
  );
6878
- I.addColorStop(0, "#3b82f6"), I.addColorStop(0.5, "#1d4ed8"), I.addColorStop(1, "#3b82f6"), i.strokeStyle = "rgba(59,130,246,.3)", i.lineWidth = 3, It(
6834
+ R.addColorStop(0, "#3b82f6"), R.addColorStop(0.5, "#1d4ed8"), R.addColorStop(1, "#3b82f6"), i.strokeStyle = "rgba(59,130,246,.3)", i.lineWidth = 3, It(
6879
6835
  i,
6880
6836
  b.x - 1,
6881
6837
  b.y - 1,
6882
6838
  b.w + 2,
6883
6839
  b.h + 2,
6884
6840
  g + 1
6885
- ), i.stroke(), i.strokeStyle = I, i.lineWidth = 2, i.setLineDash([8, 4]), It(i, b.x, b.y, b.w, b.h, g), i.stroke(), i.lineDashOffset = -(Date.now() / 50) % 12, i.strokeStyle = "#ffffff", i.lineWidth = 1, i.setLineDash([4, 8]), It(i, b.x, b.y, b.w, b.h, g), i.stroke(), i.setLineDash([]), i.lineDashOffset = 0, [
6841
+ ), i.stroke(), i.strokeStyle = R, i.lineWidth = 2, i.setLineDash([8, 4]), It(i, b.x, b.y, b.w, b.h, g), i.stroke(), i.lineDashOffset = -(Date.now() / 50) % 12, i.strokeStyle = "#ffffff", i.lineWidth = 1, i.setLineDash([4, 8]), It(i, b.x, b.y, b.w, b.h, g), i.stroke(), i.setLineDash([]), i.lineDashOffset = 0, [
6886
6842
  { x: b.x, y: b.y },
6887
6843
  { x: b.x + b.w, y: b.y },
6888
6844
  { x: b.x + b.w, y: b.y + b.h },
6889
6845
  { x: b.x, y: b.y + b.h }
6890
- ].forEach((Y) => {
6846
+ ].forEach(($) => {
6891
6847
  i.fillStyle = "rgba(0,0,0,.2)", i.fillRect(
6892
- Y.x - c / 2 + 1,
6893
- Y.y - c / 2 + 1,
6894
- c,
6895
- c
6848
+ $.x - d / 2 + 1,
6849
+ $.y - d / 2 + 1,
6850
+ d,
6851
+ d
6896
6852
  ), i.fillStyle = "#ffffff", i.fillRect(
6897
- Y.x - c / 2,
6898
- Y.y - c / 2,
6899
- c,
6900
- c
6853
+ $.x - d / 2,
6854
+ $.y - d / 2,
6855
+ d,
6856
+ d
6901
6857
  ), i.strokeStyle = "#3b82f6", i.lineWidth = 1, i.strokeRect(
6902
- Y.x - c / 2,
6903
- Y.y - c / 2,
6904
- c,
6905
- c
6858
+ $.x - d / 2,
6859
+ $.y - d / 2,
6860
+ d,
6861
+ d
6906
6862
  );
6907
6863
  });
6908
- const N = 0, E = b.y - m;
6909
- i.strokeStyle = "#3b82f6", i.lineWidth = 1, i.setLineDash([2, 2]), i.beginPath(), i.moveTo(N, E + 12), i.lineTo(N, b.y), i.stroke(), i.setLineDash([]), i.beginPath(), i.arc(N, E, 12, 0, 2 * Math.PI), i.fillStyle = "#f59e0b", i.fill(), i.strokeStyle = "#ffffff", i.lineWidth = 2, i.stroke(), i.strokeStyle = "#ffffff", i.lineWidth = 2, i.beginPath(), i.arc(N, E, 6, -Math.PI / 2, Math.PI, !1), i.stroke(), i.beginPath(), i.moveTo(N - 6, E), i.lineTo(N - 3, E - 3), i.lineTo(N - 3, E + 3), i.closePath(), i.fillStyle = "#ffffff", i.fill(), i.restore();
6910
- }, de = (i, t) => {
6864
+ const I = 0, z = b.y - m;
6865
+ i.strokeStyle = "#3b82f6", i.lineWidth = 1, i.setLineDash([2, 2]), i.beginPath(), i.moveTo(I, z + 12), i.lineTo(I, b.y), i.stroke(), i.setLineDash([]), i.beginPath(), i.arc(I, z, 12, 0, 2 * Math.PI), i.fillStyle = "#f59e0b", i.fill(), i.strokeStyle = "#ffffff", i.lineWidth = 2, i.stroke(), i.strokeStyle = "#ffffff", i.lineWidth = 2, i.beginPath(), i.arc(I, z, 6, -Math.PI / 2, Math.PI, !1), i.stroke(), i.beginPath(), i.moveTo(I - 6, z), i.lineTo(I - 3, z - 3), i.lineTo(I - 3, z + 3), i.closePath(), i.fillStyle = "#ffffff", i.fill(), i.restore();
6866
+ }, fe = (i, t) => {
6911
6867
  if (!t) return [];
6912
- const r = Qt(i, t), c = t.isIcon ? Math.max(8, 12) : 8, g = 8, m = 30, w = (t.rotation || 0) * Math.PI / 180, S = {
6913
- x: -r.width / 2 - c,
6914
- y: -r.height / 2 - c,
6915
- w: r.width + c * 2,
6916
- h: r.height + c * 2
6868
+ const r = Qt(i, t), d = t.isIcon ? Math.max(8, 12) : 8, g = 8, m = 30, w = (t.rotation || 0) * Math.PI / 180, S = {
6869
+ x: -r.width / 2 - d,
6870
+ y: -r.height / 2 - d,
6871
+ w: r.width + d * 2,
6872
+ h: r.height + d * 2
6917
6873
  }, b = [
6918
6874
  { x: S.x, y: S.y, type: "nw-resize" },
6919
6875
  { x: S.x + S.w, y: S.y, type: "ne-resize" },
6920
6876
  { x: S.x + S.w, y: S.y + S.h, type: "se-resize" },
6921
6877
  { x: S.x, y: S.y + S.h, type: "sw-resize" },
6922
6878
  { x: 0, y: S.y - m, type: "rotate" }
6923
- ], I = Math.cos(w), N = Math.sin(w);
6924
- return b.map((E) => ({
6925
- x: r.cx + (E.x * I - E.y * N),
6926
- y: r.cy + (E.x * N + E.y * I),
6927
- type: E.type,
6928
- size: E.type === "rotate" ? 24 : g
6879
+ ], R = Math.cos(w), I = Math.sin(w);
6880
+ return b.map((z) => ({
6881
+ x: r.cx + (z.x * R - z.y * I),
6882
+ y: r.cy + (z.x * I + z.y * R),
6883
+ type: z.type,
6884
+ size: z.type === "rotate" ? 24 : g
6929
6885
  }));
6930
6886
  }, $t = (i, t, r) => {
6931
6887
  if (!r) return null;
6932
- const c = K.current;
6933
- if (!c) return null;
6934
- const g = c.getContext("2d"), m = de(g, r);
6888
+ const d = K.current;
6889
+ if (!d) return null;
6890
+ const g = d.getContext("2d"), m = fe(g, r);
6935
6891
  for (const w of m) {
6936
6892
  const S = i - w.x, b = t - w.y;
6937
6893
  if (Math.sqrt(S * S + b * b) <= w.size / 2)
@@ -6940,15 +6896,15 @@ const ci = Oe((f, o) => {
6940
6896
  return null;
6941
6897
  }, Ft = rt(() => {
6942
6898
  if (X > 0) {
6943
- const i = G[X - 1];
6944
- n(i.elements), j(i.selectedElement), V(X - 1);
6899
+ const i = _[X - 1];
6900
+ n(i.elements), T(i.selectedElement), V(X - 1);
6945
6901
  }
6946
- }, [G, X]), bt = rt(() => {
6947
- if (X < G.length - 1) {
6948
- const i = G[X + 1];
6949
- n(i.elements), j(i.selectedElement), V(X + 1);
6902
+ }, [_, X]), bt = rt(() => {
6903
+ if (X < _.length - 1) {
6904
+ const i = _[X + 1];
6905
+ n(i.elements), T(i.selectedElement), V(X + 1);
6950
6906
  }
6951
- }, [G, X]), pt = (i) => q ? Math.round(i / Nt) * Nt : i;
6907
+ }, [_, X]), pt = (i) => q ? Math.round(i / Nt) * Nt : i;
6952
6908
  Z(() => {
6953
6909
  if (p != null && p.sectionImage) {
6954
6910
  xt.current = null, ut.current = null;
@@ -6956,20 +6912,20 @@ const ci = Oe((f, o) => {
6956
6912
  i && (i.getContext("2d").clearRect(0, 0, v, W), console.log("cleared canvas"));
6957
6913
  const t = new Image();
6958
6914
  t.crossOrigin = "anonymous", t.onload = () => {
6959
- xt.current = t, At(t, $);
6915
+ xt.current = t, At(t, H);
6960
6916
  }, t.onerror = () => {
6961
- console.error("Failed to load background image:", p.sectionImage), _();
6917
+ console.error("Failed to load background image:", p.sectionImage), Y();
6962
6918
  }, t.src = p.sectionImage;
6963
6919
  } else
6964
- xt.current = null, ut.current = null, _();
6920
+ xt.current = null, ut.current = null, Y();
6965
6921
  }, [p == null ? void 0 : p.sectionImage]), Z(() => {
6966
6922
  const i = (t) => {
6967
6923
  const r = document.activeElement;
6968
6924
  if (!(r && (r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.tagName === "SELECT" || r.isContentEditable))) {
6969
- if ((t.key === "Delete" || t.key === "Backspace") && d && !l) {
6925
+ if ((t.key === "Delete" || t.key === "Backspace") && c && !l) {
6970
6926
  t.preventDefault();
6971
- const g = d;
6972
- n((m) => m.filter((w) => w.id !== g.id)), j(null), st();
6927
+ const g = c;
6928
+ n((m) => m.filter((w) => w.id !== g.id)), T(null), lt();
6973
6929
  }
6974
6930
  if (t.ctrlKey || t.metaKey)
6975
6931
  switch (t.key) {
@@ -6985,82 +6941,82 @@ const ci = Oe((f, o) => {
6985
6941
  return document.addEventListener("keydown", i), () => {
6986
6942
  document.removeEventListener("keydown", i);
6987
6943
  };
6988
- }, [d, l, Ft, bt, st]);
6989
- const fe = (i) => {
6944
+ }, [c, l, Ft, bt, lt]);
6945
+ const he = (i) => {
6990
6946
  const t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);
6991
6947
  return t ? {
6992
6948
  r: parseInt(t[1], 16),
6993
6949
  g: parseInt(t[2], 16),
6994
6950
  b: parseInt(t[3], 16)
6995
6951
  } : null;
6996
- }, dt = () => `element_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, he = (i) => {
6952
+ }, ht = () => `element_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, ge = (i) => {
6997
6953
  i.strokeStyle = "#e0e0e0", i.lineWidth = 1, i.setLineDash([1, 1]);
6998
6954
  for (let t = 0; t <= v; t += Nt)
6999
6955
  i.beginPath(), i.moveTo(t, 0), i.lineTo(t, W), i.stroke();
7000
6956
  for (let t = 0; t <= W; t += Nt)
7001
6957
  i.beginPath(), i.moveTo(0, t), i.lineTo(v, t), i.stroke();
7002
6958
  i.setLineDash([]);
7003
- }, ge = (i, t) => {
6959
+ }, xe = (i, t) => {
7004
6960
  i.save();
7005
- const r = t.x + t.width / 2, c = t.y + t.height / 2;
7006
- switch (i.translate(r, c), t.rotation && i.rotate(t.rotation * Math.PI / 180), i.translate(-t.width / 2, -t.height / 2), t.type) {
6961
+ const r = t.x + t.width / 2, d = t.y + t.height / 2;
6962
+ switch (i.translate(r, d), t.rotation && i.rotate(t.rotation * Math.PI / 180), i.translate(-t.width / 2, -t.height / 2), t.type) {
7007
6963
  case "text":
7008
- ue(i, t);
6964
+ me(i, t);
7009
6965
  break;
7010
6966
  case "rectangle":
7011
- me(i, t);
6967
+ pe(i, t);
7012
6968
  break;
7013
6969
  case "circle":
7014
- pe(i, t);
6970
+ we(i, t);
7015
6971
  break;
7016
6972
  case "triangle":
7017
- we(i, t);
6973
+ be(i, t);
7018
6974
  break;
7019
6975
  case "star":
7020
- be(i, t);
6976
+ ve(i, t);
7021
6977
  break;
7022
6978
  case "arrow":
7023
- ve(i, t);
6979
+ ke(i, t);
7024
6980
  break;
7025
6981
  case "diamond":
7026
- ke(i, t);
6982
+ Se(i, t);
7027
6983
  break;
7028
6984
  case "hexagon":
7029
- Se(i, t);
6985
+ Fe(i, t);
7030
6986
  break;
7031
6987
  case "pentagon":
7032
- Fe(i, t);
6988
+ Ce(i, t);
7033
6989
  break;
7034
6990
  case "heart":
7035
- Ce(i, t);
6991
+ je(i, t);
7036
6992
  break;
7037
6993
  case "oval":
7038
6994
  Te(i, t);
7039
6995
  break;
7040
6996
  case "roundedRectangle":
7041
- je(i, t);
6997
+ Ne(i, t);
7042
6998
  break;
7043
6999
  case "image":
7044
- Ie(i, t);
7000
+ Ae(i, t);
7045
7001
  break;
7046
7002
  case "qrcode":
7047
- ye(i, t);
7003
+ ue(i, t);
7048
7004
  break;
7049
7005
  case "barcode":
7050
- xe(i, t);
7006
+ ye(i, t);
7051
7007
  break;
7052
7008
  case "sticker":
7053
- Ae(i, t);
7009
+ Re(i, t);
7054
7010
  break;
7055
7011
  case "horizontalLine":
7056
- Ne(i, t);
7012
+ Ie(i, t);
7057
7013
  break;
7058
7014
  case "embroidery":
7059
- Re(i, t);
7015
+ De(i, t);
7060
7016
  break;
7061
7017
  }
7062
7018
  i.restore();
7063
- }, xe = (i, t) => {
7019
+ }, ye = (i, t) => {
7064
7020
  if (t.imageObject)
7065
7021
  i.drawImage(t.imageObject, 0, 0, t.width, t.height);
7066
7022
  else if (t.src && !t.imageLoading) {
@@ -7068,19 +7024,19 @@ const ci = Oe((f, o) => {
7068
7024
  const r = new Image();
7069
7025
  r.onload = () => {
7070
7026
  n(
7071
- (c) => c.map(
7027
+ (d) => d.map(
7072
7028
  (g) => g.id === t.id ? { ...g, imageObject: r, imageLoading: !1 } : g
7073
7029
  )
7074
7030
  );
7075
7031
  }, r.onerror = () => {
7076
7032
  n(
7077
- (c) => c.map(
7033
+ (d) => d.map(
7078
7034
  (g) => g.id === t.id ? { ...g, imageLoading: !1 } : g
7079
7035
  )
7080
7036
  );
7081
7037
  }, r.src = t.src, i.fillStyle = "#f0f0f0", i.fillRect(0, 0, t.width, t.height), i.strokeStyle = "#ccc", i.strokeRect(0, 0, t.width, t.height), i.fillStyle = "#666", i.font = "12px Arial", i.textAlign = "center", i.textBaseline = "middle", i.fillText("Loading...", t.width / 2, t.height / 2);
7082
7038
  } else t.imageLoading ? (i.fillStyle = "#f0f0f0", i.fillRect(0, 0, t.width, t.height), i.strokeStyle = "#ccc", i.strokeRect(0, 0, t.width, t.height), i.fillStyle = "#666", i.font = "12px Arial", i.textAlign = "center", i.textBaseline = "middle", i.fillText("Loading...", t.width / 2, t.height / 2)) : (i.fillStyle = "#f0f0f0", i.fillRect(0, 0, t.width, t.height), i.strokeStyle = "#ccc", i.strokeRect(0, 0, t.width, t.height), i.fillStyle = "#666", i.font = "12px Arial", i.textAlign = "center", i.textBaseline = "middle", i.fillText("No Barcode", t.width / 2, t.height / 2));
7083
- }, ye = (i, t) => {
7039
+ }, ue = (i, t) => {
7084
7040
  if (t.imageObject)
7085
7041
  i.drawImage(t.imageObject, 0, 0, t.width, t.height);
7086
7042
  else if (t.src && !t.imageLoading) {
@@ -7088,19 +7044,19 @@ const ci = Oe((f, o) => {
7088
7044
  const r = new Image();
7089
7045
  r.onload = () => {
7090
7046
  n(
7091
- (c) => c.map(
7047
+ (d) => d.map(
7092
7048
  (g) => g.id === t.id ? { ...g, imageObject: r, imageLoading: !1 } : g
7093
7049
  )
7094
7050
  );
7095
7051
  }, r.onerror = () => {
7096
7052
  n(
7097
- (c) => c.map(
7053
+ (d) => d.map(
7098
7054
  (g) => g.id === t.id ? { ...g, imageLoading: !1 } : g
7099
7055
  )
7100
7056
  );
7101
7057
  }, r.src = t.src, i.fillStyle = "#f0f0f0", i.fillRect(0, 0, t.width, t.height), i.strokeStyle = "#ccc", i.strokeRect(0, 0, t.width, t.height), i.fillStyle = "#666", i.font = "12px Arial", i.textAlign = "center", i.textBaseline = "middle", i.fillText("Loading QR...", t.width / 2, t.height / 2);
7102
7058
  } else t.imageLoading ? (i.fillStyle = "#f0f0f0", i.fillRect(0, 0, t.width, t.height), i.strokeStyle = "#ccc", i.strokeRect(0, 0, t.width, t.height), i.fillStyle = "#666", i.font = "12px Arial", i.textAlign = "center", i.textBaseline = "middle", i.fillText("Loading QR...", t.width / 2, t.height / 2)) : (i.fillStyle = "#f0f0f0", i.fillRect(0, 0, t.width, t.height), i.strokeStyle = "#ccc", i.strokeRect(0, 0, t.width, t.height), i.fillStyle = "#666", i.font = "12px Arial", i.textAlign = "center", i.textBaseline = "middle", i.fillText("No QR Data", t.width / 2, t.height / 2));
7103
- }, ue = (i, t) => {
7059
+ }, me = (i, t) => {
7104
7060
  i.save();
7105
7061
  let r = t.text || "Text";
7106
7062
  if (t.textTransform)
@@ -7116,8 +7072,8 @@ const ci = Oe((f, o) => {
7116
7072
  break;
7117
7073
  }
7118
7074
  i.font = `${t.fontStyle || "normal"} ${t.fontWeight || "normal"} ${t.fontSize || 20}px ${t.fontFamily || "Arial"}`, i.fillStyle = t.fill || "#000000", i.textAlign = t.textAlign || "left", i.textBaseline = "top", t.opacity !== void 0 && (i.globalAlpha = t.opacity), t.stroke && t.strokeWidth > 0 && (i.strokeStyle = t.stroke, i.lineWidth = t.strokeWidth);
7119
- const c = r.split(`
7120
- `), g = (t.fontSize || 20) * (t.lineHeight || 1.2), m = Math.max(...c.map((S) => i.measureText(S).width)), w = c.length * g;
7075
+ const d = r.split(`
7076
+ `), g = (t.fontSize || 20) * (t.lineHeight || 1.2), m = Math.max(...d.map((S) => i.measureText(S).width)), w = d.length * g;
7121
7077
  if (t.backgroundColor && t.backgroundColor !== "transparent") {
7122
7078
  i.fillStyle = t.backgroundColor;
7123
7079
  const S = t.backgroundPadding || 4;
@@ -7128,81 +7084,81 @@ const ci = Oe((f, o) => {
7128
7084
  w + S * 2
7129
7085
  ), i.fillStyle = t.fill || "#000000";
7130
7086
  }
7131
- c.forEach((S, b) => {
7132
- const I = b * g, N = i.measureText(S).width;
7133
- t.stroke && t.strokeWidth > 0 && i.strokeText(S, 0, I), i.fillText(S, 0, I);
7134
- const E = t.fontSize || 20, Y = t.decorationColor || t.fill || "#000000", ft = Math.max(1, E / 20);
7135
- if (i.strokeStyle = Y, i.lineWidth = ft, t.textDecoration === "underline" || t.underline) {
7136
- const ot = I + E + 2;
7137
- i.beginPath(), i.moveTo(0, ot), i.lineTo(N, ot), i.stroke();
7087
+ d.forEach((S, b) => {
7088
+ const R = b * g, I = i.measureText(S).width;
7089
+ t.stroke && t.strokeWidth > 0 && i.strokeText(S, 0, R), i.fillText(S, 0, R);
7090
+ const z = t.fontSize || 20, $ = t.decorationColor || t.fill || "#000000", dt = Math.max(1, z / 20);
7091
+ if (i.strokeStyle = $, i.lineWidth = dt, t.textDecoration === "underline" || t.underline) {
7092
+ const ot = R + z + 2;
7093
+ i.beginPath(), i.moveTo(0, ot), i.lineTo(I, ot), i.stroke();
7138
7094
  }
7139
7095
  if (t.textDecoration === "overline" || t.overline) {
7140
- const ot = I - 2;
7141
- i.beginPath(), i.moveTo(0, ot), i.lineTo(N, ot), i.stroke();
7096
+ const ot = R - 2;
7097
+ i.beginPath(), i.moveTo(0, ot), i.lineTo(I, ot), i.stroke();
7142
7098
  }
7143
7099
  if (t.textDecoration === "line-through" || t.strikethrough) {
7144
- const ot = I + E / 2;
7145
- i.beginPath(), i.moveTo(0, ot), i.lineTo(N, ot), i.stroke();
7100
+ const ot = R + z / 2;
7101
+ i.beginPath(), i.moveTo(0, ot), i.lineTo(I, ot), i.stroke();
7146
7102
  }
7147
7103
  typeof t.textDecoration == "string" && t.textDecoration.includes(" ") && t.textDecoration.split(" ").forEach((Rt) => {
7148
7104
  switch (Rt.trim()) {
7149
7105
  case "underline":
7150
- const Dt = I + E + 2;
7151
- i.beginPath(), i.moveTo(0, Dt), i.lineTo(N, Dt), i.stroke();
7106
+ const Dt = R + z + 2;
7107
+ i.beginPath(), i.moveTo(0, Dt), i.lineTo(I, Dt), i.stroke();
7152
7108
  break;
7153
7109
  case "overline":
7154
- const Zt = I - 2;
7155
- i.beginPath(), i.moveTo(0, Zt), i.lineTo(N, Zt), i.stroke();
7110
+ const Zt = R - 2;
7111
+ i.beginPath(), i.moveTo(0, Zt), i.lineTo(I, Zt), i.stroke();
7156
7112
  break;
7157
7113
  case "line-through":
7158
- const te = I + E / 2;
7159
- i.beginPath(), i.moveTo(0, te), i.lineTo(N, te), i.stroke();
7114
+ const te = R + z / 2;
7115
+ i.beginPath(), i.moveTo(0, te), i.lineTo(I, te), i.stroke();
7160
7116
  break;
7161
7117
  }
7162
7118
  });
7163
7119
  }), i.restore();
7164
- }, me = (i, t) => {
7165
- t.fill && t.fill !== "transparent" && (i.fillStyle = t.fill, i.fillRect(0, 0, t.width, t.height)), t.stroke && t.strokeWidth > 0 && (i.strokeStyle = t.stroke, i.lineWidth = t.strokeWidth, i.strokeRect(0, 0, t.width, t.height));
7166
7120
  }, pe = (i, t) => {
7167
- const r = Math.min(t.width, t.height) / 2, c = t.width / 2, g = t.height / 2;
7168
- i.beginPath(), i.arc(c, g, r, 0, 2 * Math.PI), t.fill && t.fill !== "transparent" && (i.fillStyle = t.fill, i.fill()), t.stroke && t.strokeWidth > 0 && (i.strokeStyle = t.stroke, i.lineWidth = t.strokeWidth, i.stroke());
7121
+ t.fill && t.fill !== "transparent" && (i.fillStyle = t.fill, i.fillRect(0, 0, t.width, t.height)), t.stroke && t.strokeWidth > 0 && (i.strokeStyle = t.stroke, i.lineWidth = t.strokeWidth, i.strokeRect(0, 0, t.width, t.height));
7169
7122
  }, we = (i, t) => {
7123
+ const r = Math.min(t.width, t.height) / 2, d = t.width / 2, g = t.height / 2;
7124
+ i.beginPath(), i.arc(d, g, r, 0, 2 * Math.PI), t.fill && t.fill !== "transparent" && (i.fillStyle = t.fill, i.fill()), t.stroke && t.strokeWidth > 0 && (i.strokeStyle = t.stroke, i.lineWidth = t.strokeWidth, i.stroke());
7125
+ }, be = (i, t) => {
7170
7126
  const r = t.width / 2;
7171
7127
  t.height / 2, i.beginPath(), i.moveTo(r, 0), i.lineTo(0, t.height), i.lineTo(t.width, t.height), i.closePath(), t.fill && t.fill !== "transparent" && (i.fillStyle = t.fill, i.fill()), t.stroke && t.strokeWidth > 0 && (i.strokeStyle = t.stroke, i.lineWidth = t.strokeWidth, i.stroke());
7172
- }, be = (i, t) => {
7173
- const r = t.width / 2, c = t.height / 2, g = Math.min(t.width, t.height) / 2, m = g * 0.4, w = t.numPoints || 5;
7128
+ }, ve = (i, t) => {
7129
+ const r = t.width / 2, d = t.height / 2, g = Math.min(t.width, t.height) / 2, m = g * 0.4, w = t.numPoints || 5;
7174
7130
  i.beginPath();
7175
7131
  for (let S = 0; S < w * 2; S++) {
7176
- const b = S % 2 === 0 ? g : m, I = S * Math.PI / w, N = r + Math.cos(I) * b, E = c + Math.sin(I) * b;
7177
- S === 0 ? i.moveTo(N, E) : i.lineTo(N, E);
7132
+ const b = S % 2 === 0 ? g : m, R = S * Math.PI / w, I = r + Math.cos(R) * b, z = d + Math.sin(R) * b;
7133
+ S === 0 ? i.moveTo(I, z) : i.lineTo(I, z);
7178
7134
  }
7179
7135
  i.closePath(), t.fill && t.fill !== "transparent" && (i.fillStyle = t.fill, i.fill()), t.stroke && t.strokeWidth > 0 && (i.strokeStyle = t.stroke, i.lineWidth = t.strokeWidth, i.stroke());
7180
- }, ve = (i, t) => {
7181
- const r = t.width, c = t.height, g = r * 0.3;
7182
- i.beginPath(), i.moveTo(r / 2, 0), i.lineTo(r, c * 0.6), i.lineTo(r - g, c * 0.6), i.lineTo(r - g, c), i.lineTo(g, c), i.lineTo(g, c * 0.6), i.lineTo(0, c * 0.6), i.closePath(), t.fill && t.fill !== "transparent" && (i.fillStyle = t.fill, i.fill()), t.stroke && t.strokeWidth > 0 && (i.strokeStyle = t.stroke, i.lineWidth = t.strokeWidth, i.stroke());
7183
7136
  }, ke = (i, t) => {
7184
- const r = t.width / 2, c = t.height / 2;
7185
- i.beginPath(), i.moveTo(r, 0), i.lineTo(t.width, c), i.lineTo(r, t.height), i.lineTo(0, c), i.closePath(), t.fill && t.fill !== "transparent" && (i.fillStyle = t.fill, i.fill()), t.stroke && t.strokeWidth > 0 && (i.strokeStyle = t.stroke, i.lineWidth = t.strokeWidth, i.stroke());
7137
+ const r = t.width, d = t.height, g = r * 0.3;
7138
+ i.beginPath(), i.moveTo(r / 2, 0), i.lineTo(r, d * 0.6), i.lineTo(r - g, d * 0.6), i.lineTo(r - g, d), i.lineTo(g, d), i.lineTo(g, d * 0.6), i.lineTo(0, d * 0.6), i.closePath(), t.fill && t.fill !== "transparent" && (i.fillStyle = t.fill, i.fill()), t.stroke && t.strokeWidth > 0 && (i.strokeStyle = t.stroke, i.lineWidth = t.strokeWidth, i.stroke());
7186
7139
  }, Se = (i, t) => {
7187
- const r = t.width / 2, c = t.height / 2, g = Math.min(t.width, t.height) / 2, m = 6;
7140
+ const r = t.width / 2, d = t.height / 2;
7141
+ i.beginPath(), i.moveTo(r, 0), i.lineTo(t.width, d), i.lineTo(r, t.height), i.lineTo(0, d), i.closePath(), t.fill && t.fill !== "transparent" && (i.fillStyle = t.fill, i.fill()), t.stroke && t.strokeWidth > 0 && (i.strokeStyle = t.stroke, i.lineWidth = t.strokeWidth, i.stroke());
7142
+ }, Fe = (i, t) => {
7143
+ const r = t.width / 2, d = t.height / 2, g = Math.min(t.width, t.height) / 2, m = 6;
7188
7144
  i.beginPath();
7189
7145
  for (let w = 0; w < m; w++) {
7190
- const S = w * 2 * Math.PI / m - Math.PI / 2, b = r + g * Math.cos(S), I = c + g * Math.sin(S);
7191
- w === 0 ? i.moveTo(b, I) : i.lineTo(b, I);
7146
+ const S = w * 2 * Math.PI / m - Math.PI / 2, b = r + g * Math.cos(S), R = d + g * Math.sin(S);
7147
+ w === 0 ? i.moveTo(b, R) : i.lineTo(b, R);
7192
7148
  }
7193
7149
  i.closePath(), t.fill && t.fill !== "transparent" && (i.fillStyle = t.fill, i.fill()), t.stroke && t.strokeWidth > 0 && (i.strokeStyle = t.stroke, i.lineWidth = t.strokeWidth, i.stroke());
7194
- }, Fe = (i, t) => {
7195
- const r = t.width / 2, c = t.height / 2, g = Math.min(t.width, t.height) / 2, m = 5;
7150
+ }, Ce = (i, t) => {
7151
+ const r = t.width / 2, d = t.height / 2, g = Math.min(t.width, t.height) / 2, m = 5;
7196
7152
  i.beginPath();
7197
7153
  for (let w = 0; w < m; w++) {
7198
- const S = w * 2 * Math.PI / m - Math.PI / 2, b = r + g * Math.cos(S), I = c + g * Math.sin(S);
7199
- w === 0 ? i.moveTo(b, I) : i.lineTo(b, I);
7154
+ const S = w * 2 * Math.PI / m - Math.PI / 2, b = r + g * Math.cos(S), R = d + g * Math.sin(S);
7155
+ w === 0 ? i.moveTo(b, R) : i.lineTo(b, R);
7200
7156
  }
7201
7157
  i.closePath(), t.fill && t.fill !== "transparent" && (i.fillStyle = t.fill, i.fill()), t.stroke && t.strokeWidth > 0 && (i.strokeStyle = t.stroke, i.lineWidth = t.strokeWidth, i.stroke());
7202
- }, Ce = (i, t) => {
7203
- const r = t.width, c = t.height, g = 0, m = 0;
7158
+ }, je = (i, t) => {
7159
+ const r = t.width, d = t.height, g = 0, m = 0;
7204
7160
  i.beginPath();
7205
- const w = c * 0.3;
7161
+ const w = d * 0.3;
7206
7162
  i.moveTo(g + r / 2, m + w), i.bezierCurveTo(
7207
7163
  g + r / 2,
7208
7164
  m,
@@ -7212,16 +7168,16 @@ const ci = Oe((f, o) => {
7212
7168
  m + w
7213
7169
  ), i.bezierCurveTo(
7214
7170
  g,
7215
- m + (c + w) / 2,
7171
+ m + (d + w) / 2,
7216
7172
  g + r / 2,
7217
- m + (c + w) / 2,
7173
+ m + (d + w) / 2,
7218
7174
  g + r / 2,
7219
- m + c
7175
+ m + d
7220
7176
  ), i.bezierCurveTo(
7221
7177
  g + r / 2,
7222
- m + (c + w) / 2,
7178
+ m + (d + w) / 2,
7223
7179
  g + r,
7224
- m + (c + w) / 2,
7180
+ m + (d + w) / 2,
7225
7181
  g + r,
7226
7182
  m + w
7227
7183
  ), i.bezierCurveTo(
@@ -7233,38 +7189,38 @@ const ci = Oe((f, o) => {
7233
7189
  m + w
7234
7190
  ), i.closePath(), t.fill && t.fill !== "transparent" && (i.fillStyle = t.fill, i.fill()), t.stroke && t.strokeWidth > 0 && (i.strokeStyle = t.stroke, i.lineWidth = t.strokeWidth, i.stroke());
7235
7191
  }, Te = (i, t) => {
7236
- const r = t.width / 2, c = t.height / 2, g = t.width / 2, m = t.height / 2;
7237
- i.beginPath(), i.ellipse(r, c, g, m, 0, 0, 2 * Math.PI), t.fill && t.fill !== "transparent" && (i.fillStyle = t.fill, i.fill()), t.stroke && t.strokeWidth > 0 && (i.strokeStyle = t.stroke, i.lineWidth = t.strokeWidth, i.stroke());
7238
- }, je = (i, t) => {
7192
+ const r = t.width / 2, d = t.height / 2, g = t.width / 2, m = t.height / 2;
7193
+ i.beginPath(), i.ellipse(r, d, g, m, 0, 0, 2 * Math.PI), t.fill && t.fill !== "transparent" && (i.fillStyle = t.fill, i.fill()), t.stroke && t.strokeWidth > 0 && (i.strokeStyle = t.stroke, i.lineWidth = t.strokeWidth, i.stroke());
7194
+ }, Ne = (i, t) => {
7239
7195
  const r = Math.min(t.width, t.height) * 0.1;
7240
7196
  It(i, 0, 0, t.width, t.height, r), t.fill && t.fill !== "transparent" && (i.fillStyle = t.fill, i.fill()), t.stroke && t.strokeWidth > 0 && (i.strokeStyle = t.stroke, i.lineWidth = t.strokeWidth, i.stroke());
7241
- }, Ne = (i, t) => {
7242
- i.save(), t.opacity !== void 0 && (i.globalAlpha = t.opacity), i.strokeStyle = t.stroke || t.fill || "#000000", i.lineWidth = t.strokeWidth || t.height || 2, i.lineCap = "round", i.beginPath(), i.moveTo(0, t.height / 2), i.lineTo(t.width, t.height / 2), i.stroke(), i.restore();
7243
7197
  }, Ie = (i, t) => {
7198
+ i.save(), t.opacity !== void 0 && (i.globalAlpha = t.opacity), i.strokeStyle = t.stroke || t.fill || "#000000", i.lineWidth = t.strokeWidth || t.height || 2, i.lineCap = "round", i.beginPath(), i.moveTo(0, t.height / 2), i.lineTo(t.width, t.height / 2), i.stroke(), i.restore();
7199
+ }, Ae = (i, t) => {
7244
7200
  if (t.imageData)
7245
7201
  try {
7246
7202
  t.imageData.complete && t.imageData.naturalHeight !== 0 ? i.drawImage(t.imageData, 0, 0, t.width, t.height) : (i.fillStyle = "#f0f0f0", i.fillRect(0, 0, t.width, t.height), i.strokeStyle = "#ccc", i.lineWidth = 1, i.strokeRect(0, 0, t.width, t.height), i.fillStyle = "#666", i.font = "14px Arial", i.textAlign = "center", i.textBaseline = "middle", i.fillText("Loading...", t.width / 2, t.height / 2));
7247
7203
  } catch (r) {
7248
7204
  console.error("Error drawing image:", r), i.fillStyle = "#ffebee", i.fillRect(0, 0, t.width, t.height), i.strokeStyle = "#f44336", i.lineWidth = 2, i.strokeRect(0, 0, t.width, t.height), i.fillStyle = "#f44336", i.font = "14px Arial", i.textAlign = "center", i.textBaseline = "middle", i.fillText("Error loading image", t.width / 2, t.height / 2);
7249
7205
  }
7250
- }, Ae = (i, t) => {
7206
+ }, Re = (i, t) => {
7251
7207
  if (t.src && !t.imageLoading && !t.loadedImage) {
7252
7208
  t.imageLoading = !0;
7253
7209
  const r = new Image();
7254
7210
  r.crossOrigin = "anonymous", r.onload = () => {
7255
- t.loadedImage = r, t.imageLoading = !1, _();
7211
+ t.loadedImage = r, t.imageLoading = !1, Y();
7256
7212
  }, r.onerror = () => {
7257
7213
  console.error("Failed to load sticker:", t.src), t.imageLoading = !1, i.fillStyle = "#f0f0f0", i.fillRect(0, 0, t.width, t.height), i.strokeStyle = "#ccc", i.strokeRect(0, 0, t.width, t.height), i.fillStyle = "#666", i.font = "12px Arial", i.textAlign = "center", i.fillText("Failed to load", t.width / 2, t.height / 2);
7258
7214
  }, r.src = t.src;
7259
7215
  } else t.loadedImage ? i.drawImage(t.loadedImage, 0, 0, t.width, t.height) : t.imageLoading && (i.fillStyle = "#f8f9fa", i.fillRect(0, 0, t.width, t.height), i.strokeStyle = "#dee2e6", i.strokeRect(0, 0, t.width, t.height), i.fillStyle = "#6c757d", i.font = "12px Arial", i.textAlign = "center", i.fillText("Loading...", t.width / 2, t.height / 2));
7260
- }, Re = (i, t) => {
7216
+ }, De = (i, t) => {
7261
7217
  if (t.imageObject)
7262
7218
  i.drawImage(t.imageObject, 0, 0, t.width, t.height);
7263
7219
  else if (t.src && !t.imageLoading) {
7264
7220
  t.imageLoading = !0;
7265
7221
  const r = new Image();
7266
7222
  r.crossOrigin = "anonymous", r.onload = () => {
7267
- t.imageObject = r, t.imageLoading = !1, _();
7223
+ t.imageObject = r, t.imageLoading = !1, Y();
7268
7224
  }, r.onerror = () => {
7269
7225
  t.imageLoading = !1, console.error("Failed to load embroidery image:", t.src), Wt(i, t);
7270
7226
  }, r.src = t.src, Wt(i, t, "Loading...");
@@ -7274,43 +7230,43 @@ const ci = Oe((f, o) => {
7274
7230
  i.fillStyle = "#f9f9f9", i.fillRect(0, 0, t.width, t.height), i.strokeStyle = "#ddd", i.lineWidth = 2, i.strokeRect(0, 0, t.width, t.height), i.fillStyle = "#999", i.font = "24px Arial", i.textAlign = "center", i.textBaseline = "middle", i.fillText("🧵", t.width / 2, t.height / 2 - 10), i.fillStyle = "#666", i.font = "12px Arial", i.fillText(r, t.width / 2, t.height / 2 + 15);
7275
7231
  }, Ht = (i, t, r) => {
7276
7232
  if (!r) return !1;
7277
- const c = r.x + r.width / 2, g = r.y + r.height / 2, m = i - c, w = t - g, S = -(r.rotation || 0) * Math.PI / 180, b = Math.cos(S), I = Math.sin(S), N = m * b - w * I, E = m * I + w * b, Y = r.width / 2, ft = r.height / 2;
7278
- return N >= -Y && N <= Y && E >= -ft && E <= ft;
7279
- }, De = rt(() => {
7280
- (F || y || B) && st(), R(!1), z(!1), k(!1), O(null);
7233
+ const d = r.x + r.width / 2, g = r.y + r.height / 2, m = i - d, w = t - g, S = -(r.rotation || 0) * Math.PI / 180, b = Math.cos(S), R = Math.sin(S), I = m * b - w * R, z = m * R + w * b, $ = r.width / 2, dt = r.height / 2;
7234
+ return I >= -$ && I <= $ && z >= -dt && z <= dt;
7235
+ }, Ee = rt(() => {
7236
+ (F || y || B) && lt(), A(!1), E(!1), k(!1), O(null);
7281
7237
  const i = K.current;
7282
7238
  i && (i.style.cursor = "default");
7283
- }, [F, y, B, st]);
7239
+ }, [F, y, B, lt]);
7284
7240
  Z(() => {
7285
7241
  const i = (t) => {
7286
7242
  if (l) return;
7287
7243
  const r = document.activeElement;
7288
- if (!(r && (r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.tagName === "SELECT" || r.isContentEditable)) && ((t.ctrlKey || t.metaKey) && (t.key === "z" && !t.shiftKey ? (t.preventDefault(), Ft()) : (t.key === "z" && t.shiftKey || t.key === "y") && (t.preventDefault(), bt())), (t.key === "Delete" || t.key === "Backspace") && d && (Mt(d.id), t.preventDefault()), (t.ctrlKey || t.metaKey) && t.key === "d" && d && (_t(d.id), t.preventDefault()), d && ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(t.key))) {
7244
+ if (!(r && (r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.tagName === "SELECT" || r.isContentEditable)) && ((t.ctrlKey || t.metaKey) && (t.key === "z" && !t.shiftKey ? (t.preventDefault(), Ft()) : (t.key === "z" && t.shiftKey || t.key === "y") && (t.preventDefault(), bt())), (t.key === "Delete" || t.key === "Backspace") && c && (Mt(c.id), t.preventDefault()), (t.ctrlKey || t.metaKey) && t.key === "d" && c && (_t(c.id), t.preventDefault()), c && ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(t.key))) {
7289
7245
  t.preventDefault();
7290
7246
  const g = t.shiftKey ? 10 : 1;
7291
7247
  let m = {};
7292
7248
  switch (t.key) {
7293
7249
  case "ArrowUp":
7294
- m.y = d.y - g;
7250
+ m.y = c.y - g;
7295
7251
  break;
7296
7252
  case "ArrowDown":
7297
- m.y = d.y + g;
7253
+ m.y = c.y + g;
7298
7254
  break;
7299
7255
  case "ArrowLeft":
7300
- m.x = d.x - g;
7256
+ m.x = c.x - g;
7301
7257
  break;
7302
7258
  case "ArrowRight":
7303
- m.x = d.x + g;
7259
+ m.x = c.x + g;
7304
7260
  break;
7305
7261
  }
7306
- Gt(d.id, m), st();
7262
+ Gt(c.id, m), lt();
7307
7263
  }
7308
7264
  };
7309
7265
  return window.addEventListener("keydown", i), () => window.removeEventListener("keydown", i);
7310
- }, [d, Ft, bt, l]);
7311
- const Ee = (i, t = {}) => {
7266
+ }, [c, Ft, bt, l]);
7267
+ const Be = (i, t = {}) => {
7312
7268
  const r = {
7313
- id: dt(),
7269
+ id: ht(),
7314
7270
  type: i,
7315
7271
  x: 50,
7316
7272
  y: 50,
@@ -7324,28 +7280,28 @@ const ci = Oe((f, o) => {
7324
7280
  };
7325
7281
  switch (i) {
7326
7282
  case "text":
7327
- r.id = dt(), r.text = t.text || "New Text", r.fontSize = t.fontSize || 20, r.fontFamily = t.fontFamily || "Arial", r.fontWeight = t.fontWeight || "normal", r.fontStyle = t.fontStyle || "normal", r.textAlign = t.textAlign || "left", r.width = 150, r.height = 50;
7283
+ r.id = ht(), r.text = t.text || "New Text", r.fontSize = t.fontSize || 20, r.fontFamily = t.fontFamily || "Arial", r.fontWeight = t.fontWeight || "normal", r.fontStyle = t.fontStyle || "normal", r.textAlign = t.textAlign || "left", r.width = 150, r.height = 50;
7328
7284
  break;
7329
7285
  case "icon":
7330
- r.id = dt(), r.text = t.text || "🎯", r.fontSize = t.fontSize || 48, r.fontFamily = t.fontFamily || "Arial", r.fontWeight = t.fontWeight || "normal", r.fontStyle = t.fontStyle || "normal", r.textAlign = "center", r.width = 80, r.height = 80, r.iconData = t.iconData || null, r.type = "text", r.isIcon = !0;
7286
+ r.id = ht(), r.text = t.text || "🎯", r.fontSize = t.fontSize || 48, r.fontFamily = t.fontFamily || "Arial", r.fontWeight = t.fontWeight || "normal", r.fontStyle = t.fontStyle || "normal", r.textAlign = "center", r.width = 80, r.height = 80, r.iconData = t.iconData || null, r.type = "text", r.isIcon = !0;
7331
7287
  break;
7332
7288
  case "image":
7333
- r.id = dt(), r.imageData = t.imageData || null, r.width = t.width || 200, r.height = t.height || 200;
7289
+ r.id = ht(), r.imageData = t.imageData || null, r.width = t.width || 200, r.height = t.height || 200;
7334
7290
  break;
7335
7291
  case "qrcode":
7336
- r.id = dt(), r.type = "qrcode", r.x = (t == null ? void 0 : t.x) || v / 2 - ((t == null ? void 0 : t.width) || 100) / 2, r.y = (t == null ? void 0 : t.y) || W / 2 - ((t == null ? void 0 : t.height) || 100) / 2, r.width = (t == null ? void 0 : t.width) || 100, r.height = (t == null ? void 0 : t.height) || 100, r.src = (t == null ? void 0 : t.src) || "", r.data = (t == null ? void 0 : t.data) || "", r.rotation = 0, r.opacity = 1;
7292
+ r.id = ht(), r.type = "qrcode", r.x = (t == null ? void 0 : t.x) || v / 2 - ((t == null ? void 0 : t.width) || 100) / 2, r.y = (t == null ? void 0 : t.y) || W / 2 - ((t == null ? void 0 : t.height) || 100) / 2, r.width = (t == null ? void 0 : t.width) || 100, r.height = (t == null ? void 0 : t.height) || 100, r.src = (t == null ? void 0 : t.src) || "", r.data = (t == null ? void 0 : t.data) || "", r.rotation = 0, r.opacity = 1;
7337
7293
  break;
7338
7294
  case "barcode":
7339
- r.id = dt(), r.type = "barcode", r.x = (t == null ? void 0 : t.x) || v / 2 - ((t == null ? void 0 : t.width) || 200) / 2, r.y = (t == null ? void 0 : t.y) || W / 2 - ((t == null ? void 0 : t.height) || 100) / 2, r.width = (t == null ? void 0 : t.width) || 200, r.height = (t == null ? void 0 : t.height) || 100, r.src = (t == null ? void 0 : t.src) || "", r.data = (t == null ? void 0 : t.data) || "", r.format = (t == null ? void 0 : t.format) || "CODE128", r.rotation = 0, r.opacity = 1, r.imageObject = (t == null ? void 0 : t.imageObject) || null;
7295
+ r.id = ht(), r.type = "barcode", r.x = (t == null ? void 0 : t.x) || v / 2 - ((t == null ? void 0 : t.width) || 200) / 2, r.y = (t == null ? void 0 : t.y) || W / 2 - ((t == null ? void 0 : t.height) || 100) / 2, r.width = (t == null ? void 0 : t.width) || 200, r.height = (t == null ? void 0 : t.height) || 100, r.src = (t == null ? void 0 : t.src) || "", r.data = (t == null ? void 0 : t.data) || "", r.format = (t == null ? void 0 : t.format) || "CODE128", r.rotation = 0, r.opacity = 1, r.imageObject = (t == null ? void 0 : t.imageObject) || null;
7340
7296
  break;
7341
7297
  case "sticker":
7342
- r.id = dt(), r.type = "sticker", r.imageData = (t == null ? void 0 : t.imageData) || null, r.width = t.width || 200, r.height = t.height || 200;
7298
+ r.id = ht(), r.type = "sticker", r.imageData = (t == null ? void 0 : t.imageData) || null, r.width = t.width || 200, r.height = t.height || 200;
7343
7299
  break;
7344
7300
  case "horizontalLine":
7345
- r.id = dt(), r.type = "horizontalLine", r.x = v / 2 - 100, r.y = W / 2 - 1, r.width = 200, r.height = 2, r.fill = "#000000", r.stroke = "#000000", r.strokeWidth = 2, r.rotation = 0, r.opacity = 1;
7301
+ r.id = ht(), r.type = "horizontalLine", r.x = v / 2 - 100, r.y = W / 2 - 1, r.width = 200, r.height = 2, r.fill = "#000000", r.stroke = "#000000", r.strokeWidth = 2, r.rotation = 0, r.opacity = 1;
7346
7302
  break;
7347
7303
  case "embroidery":
7348
- r.id = dt(), r.type = "embroidery", r.imageData = (t == null ? void 0 : t.imageData) || null, r.width = t.width || 200, r.height = t.height || 200;
7304
+ r.id = ht(), r.type = "embroidery", r.imageData = (t == null ? void 0 : t.imageData) || null, r.width = t.width || 200, r.height = t.height || 200;
7349
7305
  break;
7350
7306
  case "rectangle":
7351
7307
  case "circle":
@@ -7363,49 +7319,49 @@ const ci = Oe((f, o) => {
7363
7319
  console.warn(`Unknown element type: ${i}`);
7364
7320
  return;
7365
7321
  }
7366
- n((c) => [...c, r]), j(r), st();
7322
+ n((d) => [...d, r]), T(r), lt();
7367
7323
  }, Gt = (i, t) => {
7368
7324
  n((r) => r.map(
7369
- (c) => c.id === i ? { ...c, ...t } : c
7370
- )), d && d.id === i && j((r) => ({ ...r, ...t }));
7325
+ (d) => d.id === i ? { ...d, ...t } : d
7326
+ )), c && c.id === i && T((r) => ({ ...r, ...t }));
7371
7327
  }, Mt = rt(() => {
7372
- d && (n((i) => i.filter((t) => t.id !== d.id)), j(null), st());
7373
- }, [d, st]), _t = (i) => {
7328
+ c && (n((i) => i.filter((t) => t.id !== c.id)), T(null), lt());
7329
+ }, [c, lt]), _t = (i) => {
7374
7330
  const t = x.find((r) => r.id === i);
7375
7331
  if (t) {
7376
7332
  const r = {
7377
7333
  ...t,
7378
- id: dt(),
7334
+ id: ht(),
7379
7335
  x: t.x + 20,
7380
7336
  y: t.y + 20
7381
7337
  };
7382
- n((c) => [...c, r]), j(r), st();
7338
+ n((d) => [...d, r]), T(r), lt();
7383
7339
  }
7384
7340
  }, Yt = (i, t) => {
7385
7341
  const r = x.findIndex((m) => m.id === i);
7386
7342
  if (r === -1) return;
7387
- const c = [...x], g = c[r];
7388
- t === "up" && r < c.length - 1 ? (c[r] = c[r + 1], c[r + 1] = g) : t === "down" && r > 0 ? (c[r] = c[r - 1], c[r - 1] = g) : t === "top" ? (c.splice(r, 1), c.push(g)) : t === "bottom" && (c.splice(r, 1), c.unshift(g)), n(c), st();
7343
+ const d = [...x], g = d[r];
7344
+ t === "up" && r < d.length - 1 ? (d[r] = d[r + 1], d[r + 1] = g) : t === "down" && r > 0 ? (d[r] = d[r - 1], d[r - 1] = g) : t === "top" ? (d.splice(r, 1), d.push(g)) : t === "bottom" && (d.splice(r, 1), d.unshift(g)), n(d), lt();
7389
7345
  };
7390
7346
  rt(() => {
7391
- p && H((i) => ({
7347
+ p && G((i) => ({
7392
7348
  ...i,
7393
7349
  [p.sectionName]: {
7394
7350
  elements: [...x],
7395
- selectedColor: $
7351
+ selectedColor: H
7396
7352
  }
7397
7353
  }));
7398
- }, [p, x, $]);
7399
- const [, ze] = Qe((i) => i + 1, 0);
7354
+ }, [p, x, H]);
7355
+ const [, ze] = $e((i) => i + 1, 0);
7400
7356
  setTimeout(() => {
7401
7357
  ze();
7402
- }, 20), $e(o, () => ({
7358
+ }, 20), He(o, () => ({
7403
7359
  handleSectionChange: qt,
7404
7360
  // Export methods that return download-ready data
7405
- exportPrintReady: async (i = "png") => await Bt(i, !1),
7406
- exportFullDesign: async (i = "png") => await Bt(i, !0),
7361
+ exportPrintReady: async (i = "png") => await zt(i, !1),
7362
+ exportFullDesign: async (i = "png") => await zt(i, !0),
7407
7363
  // Access to the existing exportDesign method
7408
- exportDesign: Bt,
7364
+ exportDesign: zt,
7409
7365
  // Get canvas data for custom exports
7410
7366
  getCanvasData: () => St(),
7411
7367
  // NEW: Export methods that return JSON with File objects
@@ -7413,20 +7369,20 @@ const ci = Oe((f, o) => {
7413
7369
  try {
7414
7370
  const t = St();
7415
7371
  console.log("canvas data to export: ", t);
7416
- const r = {}, c = (p == null ? void 0 : p.sectionName) || "main";
7417
- r[c] = {
7372
+ const r = {}, d = (p == null ? void 0 : p.sectionName) || "main";
7373
+ r[d] = {
7418
7374
  elements: t.elements,
7419
7375
  selectedColor: t.selectedColor,
7420
7376
  canvasWidth: t.canvasWidth,
7421
7377
  canvasHeight: t.canvasHeight
7422
7378
  }, t.sectionDesigns && typeof t.sectionDesigns == "object" && Object.assign(r, t.sectionDesigns);
7423
7379
  const g = s.sections && s.sections.length > 0 ? s.sections : [{
7424
- id: c,
7425
- sectionName: c,
7380
+ id: d,
7381
+ sectionName: d,
7426
7382
  image: p == null ? void 0 : p.sectionImage,
7427
7383
  sectionImage: p == null ? void 0 : p.sectionImage
7428
7384
  }];
7429
- return await zt.current.exportAllSectionsAsJSON(
7385
+ return await Bt.current.exportAllSectionsAsJSON(
7430
7386
  r,
7431
7387
  g,
7432
7388
  v,
@@ -7440,7 +7396,7 @@ const ci = Oe((f, o) => {
7440
7396
  exportCurrentSectionAsJSON: async (i = "png") => {
7441
7397
  try {
7442
7398
  const t = St();
7443
- return await zt.current.exportCurrentSectionAsJSON(t, i);
7399
+ return await Bt.current.exportCurrentSectionAsJSON(t, i);
7444
7400
  } catch (t) {
7445
7401
  throw console.error("Export current section as JSON failed:", t), t;
7446
7402
  }
@@ -7451,231 +7407,231 @@ const ci = Oe((f, o) => {
7451
7407
  if (i && i.getContext("2d").clearRect(0, 0, v, W), p != null && p.sectionImage) {
7452
7408
  const t = new Image();
7453
7409
  t.crossOrigin = "anonymous", t.onload = () => {
7454
- t.src === p.sectionImage && (xt.current = t, At(t, $));
7410
+ t.src === p.sectionImage && (xt.current = t, At(t, H));
7455
7411
  }, t.onerror = () => {
7456
- console.error("Failed to load background image:", p.sectionImage), _();
7412
+ console.error("Failed to load background image:", p.sectionImage), Y();
7457
7413
  }, t.src = p.sectionImage;
7458
7414
  } else
7459
- _();
7415
+ Y();
7460
7416
  }, [p == null ? void 0 : p.sectionImage]);
7461
- const mt = gt(null), Lt = gt(!1), _ = rt(() => {
7417
+ const mt = gt(null), Lt = gt(!1), Y = rt(() => {
7462
7418
  const i = K.current;
7463
7419
  if (!i || Lt.current) return;
7464
7420
  Lt.current = !0;
7465
7421
  const t = i.getContext("2d");
7466
- t.clearRect(0, 0, v, W), ut.current && t.drawImage(ut.current, 0, 0, v, W), M && he(t), x.forEach((r) => {
7467
- t.save(), t.globalAlpha = r.opacity || 1, ge(t, r), t.restore();
7468
- }), d && ce(t, d), Lt.current = !1;
7469
- }, [x, d, v, W, M]), vt = rt(() => {
7422
+ t.clearRect(0, 0, v, W), ut.current && t.drawImage(ut.current, 0, 0, v, W), M && ge(t), x.forEach((r) => {
7423
+ t.save(), t.globalAlpha = r.opacity || 1, xe(t, r), t.restore();
7424
+ }), c && de(t, c), Lt.current = !1;
7425
+ }, [x, c, v, W, M]), vt = rt(() => {
7470
7426
  mt.current && cancelAnimationFrame(mt.current), mt.current = requestAnimationFrame(() => {
7471
- _(), mt.current = null;
7427
+ Y(), mt.current = null;
7472
7428
  });
7473
- }, [_]);
7429
+ }, [Y]);
7474
7430
  Z(() => {
7475
7431
  vt();
7476
- }, [x, d, v, W, M, vt]), Z(() => {
7432
+ }, [x, c, v, W, M, vt]), Z(() => {
7477
7433
  ut.current && vt();
7478
7434
  }, [ut.current, vt]), Z(() => () => {
7479
7435
  mt.current && cancelAnimationFrame(mt.current);
7480
7436
  }, []);
7481
7437
  const Pt = rt(() => {
7482
- _(), (F || y || B) && (mt.current = requestAnimationFrame(Pt));
7483
- }, [_, F, y, B]);
7438
+ Y(), (F || y || B) && (mt.current = requestAnimationFrame(Pt));
7439
+ }, [Y, F, y, B]);
7484
7440
  Z(() => {
7485
7441
  F || y || B ? Pt() : (mt.current && (cancelAnimationFrame(mt.current), mt.current = null), vt());
7486
7442
  }, [F, y, B, Pt, vt]);
7487
- const Be = rt((i) => {
7443
+ const We = rt((i) => {
7488
7444
  if (l) return;
7489
- const r = K.current.getBoundingClientRect(), c = (i.clientX - r.left) / Q, g = (i.clientY - r.top) / Q;
7490
- if (J({ x: c, y: g }), d) {
7491
- const w = $t(c, g, d);
7445
+ const r = K.current.getBoundingClientRect(), d = (i.clientX - r.left) / Q, g = (i.clientY - r.top) / Q;
7446
+ if (J({ x: d, y: g }), c) {
7447
+ const w = $t(d, g, c);
7492
7448
  if (w) {
7493
7449
  if (w === "rotate") {
7494
7450
  k(!0);
7495
- const S = d.x + d.width / 2, b = d.y + d.height / 2, I = Math.atan2(g - b, c - S) * 180 / Math.PI;
7451
+ const S = c.x + c.width / 2, b = c.y + c.height / 2, R = Math.atan2(g - b, d - S) * 180 / Math.PI;
7496
7452
  J({
7497
- x: c,
7453
+ x: d,
7498
7454
  y: g,
7499
- initialAngle: I,
7500
- initialRotation: d.rotation || 0
7455
+ initialAngle: R,
7456
+ initialRotation: c.rotation || 0
7501
7457
  });
7502
7458
  } else
7503
- z(!0), O(w), J({
7504
- x: c,
7459
+ E(!0), O(w), J({
7460
+ x: d,
7505
7461
  y: g,
7506
- initialWidth: d.width,
7507
- initialHeight: d.height,
7508
- initialX: d.x,
7509
- initialY: d.y
7462
+ initialWidth: c.width,
7463
+ initialHeight: c.height,
7464
+ initialX: c.x,
7465
+ initialY: c.y
7510
7466
  });
7511
7467
  return;
7512
7468
  }
7513
7469
  }
7514
7470
  let m = null;
7515
7471
  for (let w = x.length - 1; w >= 0; w--)
7516
- if (Ht(c, g, x[w])) {
7472
+ if (Ht(d, g, x[w])) {
7517
7473
  m = x[w];
7518
7474
  break;
7519
7475
  }
7520
- m ? (j(m), R(!0), J({
7521
- x: c,
7476
+ m ? (T(m), A(!0), J({
7477
+ x: d,
7522
7478
  y: g,
7523
- offsetX: c - m.x,
7479
+ offsetX: d - m.x,
7524
7480
  offsetY: g - m.y
7525
- })) : j(null), _();
7526
- }, [l, Q, d, x, _]), We = rt((i) => {
7481
+ })) : T(null), Y();
7482
+ }, [l, Q, c, x, Y]), Me = rt((i) => {
7527
7483
  if (l) return;
7528
- const t = K.current, r = t.getBoundingClientRect(), c = (i.clientX - r.left) / Q, g = (i.clientY - r.top) / Q;
7529
- if (d && !F && !y && !B) {
7530
- const m = $t(c, g, d);
7531
- m ? m === "rotate" ? t.style.cursor = "grab" : t.style.cursor = m : Ht(c, g, d) ? t.style.cursor = "move" : t.style.cursor = "default";
7484
+ const t = K.current, r = t.getBoundingClientRect(), d = (i.clientX - r.left) / Q, g = (i.clientY - r.top) / Q;
7485
+ if (c && !F && !y && !B) {
7486
+ const m = $t(d, g, c);
7487
+ m ? m === "rotate" ? t.style.cursor = "grab" : t.style.cursor = m : Ht(d, g, c) ? t.style.cursor = "move" : t.style.cursor = "default";
7532
7488
  } else
7533
7489
  t.style.cursor = F ? "grabbing" : "default";
7534
- if (B && d) {
7535
- const m = d.x + d.width / 2, w = d.y + d.height / 2, b = Math.atan2(g - w, c - m) * 180 / Math.PI - C.initialAngle;
7536
- let I = C.initialRotation + b;
7537
- i.shiftKey && (I = Math.round(I / 15) * 15), I = (I % 360 + 360) % 360, n(
7538
- (N) => N.map(
7539
- (E) => E.id === d.id ? { ...E, rotation: I } : E
7490
+ if (B && c) {
7491
+ const m = c.x + c.width / 2, w = c.y + c.height / 2, b = Math.atan2(g - w, d - m) * 180 / Math.PI - C.initialAngle;
7492
+ let R = C.initialRotation + b;
7493
+ i.shiftKey && (R = Math.round(R / 15) * 15), R = (R % 360 + 360) % 360, n(
7494
+ (I) => I.map(
7495
+ (z) => z.id === c.id ? { ...z, rotation: R } : z
7540
7496
  )
7541
- ), j((N) => ({ ...N, rotation: I })), _();
7497
+ ), T((I) => ({ ...I, rotation: R })), Y();
7542
7498
  return;
7543
7499
  }
7544
- if (y && d && T) {
7545
- const m = c - C.x, w = g - C.y;
7546
- let S = C.initialWidth, b = C.initialHeight, I = C.initialX, N = C.initialY;
7547
- switch (T) {
7500
+ if (y && c && j) {
7501
+ const m = d - C.x, w = g - C.y;
7502
+ let S = C.initialWidth, b = C.initialHeight, R = C.initialX, I = C.initialY;
7503
+ switch (j) {
7548
7504
  case "se-resize":
7549
7505
  S = Math.max(20, C.initialWidth + m), b = Math.max(20, C.initialHeight + w);
7550
7506
  break;
7551
7507
  case "sw-resize":
7552
- S = Math.max(20, C.initialWidth - m), b = Math.max(20, C.initialHeight + w), I = C.initialX + (C.initialWidth - S);
7508
+ S = Math.max(20, C.initialWidth - m), b = Math.max(20, C.initialHeight + w), R = C.initialX + (C.initialWidth - S);
7553
7509
  break;
7554
7510
  case "ne-resize":
7555
- S = Math.max(20, C.initialWidth + m), b = Math.max(20, C.initialHeight - w), N = C.initialY + (C.initialHeight - b);
7511
+ S = Math.max(20, C.initialWidth + m), b = Math.max(20, C.initialHeight - w), I = C.initialY + (C.initialHeight - b);
7556
7512
  break;
7557
7513
  case "nw-resize":
7558
- S = Math.max(20, C.initialWidth - m), b = Math.max(20, C.initialHeight - w), I = C.initialX + (C.initialWidth - S), N = C.initialY + (C.initialHeight - b);
7514
+ S = Math.max(20, C.initialWidth - m), b = Math.max(20, C.initialHeight - w), R = C.initialX + (C.initialWidth - S), I = C.initialY + (C.initialHeight - b);
7559
7515
  break;
7560
7516
  }
7561
- if (i.shiftKey && d.type !== "text") {
7562
- const Y = C.initialWidth / C.initialHeight;
7563
- T.includes("e"), b = S / Y, T.includes("n") && (N = C.initialY + (C.initialHeight - b));
7517
+ if (i.shiftKey && c.type !== "text") {
7518
+ const $ = C.initialWidth / C.initialHeight;
7519
+ j.includes("e"), b = S / $, j.includes("n") && (I = C.initialY + (C.initialHeight - b));
7564
7520
  }
7565
- q && (I = pt(I), N = pt(N), S = pt(S), b = pt(b));
7566
- const E = {
7567
- ...d,
7568
- x: I,
7569
- y: N,
7521
+ q && (R = pt(R), I = pt(I), S = pt(S), b = pt(b));
7522
+ const z = {
7523
+ ...c,
7524
+ x: R,
7525
+ y: I,
7570
7526
  width: S,
7571
7527
  height: b
7572
7528
  };
7573
7529
  n(
7574
- (Y) => Y.map(
7575
- (ft) => ft.id === d.id ? E : ft
7530
+ ($) => $.map(
7531
+ (dt) => dt.id === c.id ? z : dt
7576
7532
  )
7577
- ), j(E), _();
7533
+ ), T(z), Y();
7578
7534
  return;
7579
7535
  }
7580
- if (F && d) {
7581
- let m = c - C.offsetX, w = g - C.offsetY;
7582
- q && (m = pt(m), w = pt(w)), m = Math.max(0, Math.min(v - d.width, m)), w = Math.max(0, Math.min(W - d.height, w));
7536
+ if (F && c) {
7537
+ let m = d - C.offsetX, w = g - C.offsetY;
7538
+ q && (m = pt(m), w = pt(w)), m = Math.max(0, Math.min(v - c.width, m)), w = Math.max(0, Math.min(W - c.height, w));
7583
7539
  const S = {
7584
- ...d,
7540
+ ...c,
7585
7541
  x: m,
7586
7542
  y: w
7587
7543
  };
7588
7544
  n(
7589
7545
  (b) => b.map(
7590
- (I) => I.id === d.id ? S : I
7546
+ (R) => R.id === c.id ? S : R
7591
7547
  )
7592
- ), j(S), _();
7548
+ ), T(S), Y();
7593
7549
  }
7594
- }, [l, Q, d, F, y, B, T, C, q, v, W, x, _]), qt = rt((i) => {
7595
- p && H((r) => ({
7550
+ }, [l, Q, c, F, y, B, j, C, q, v, W, x, Y]), qt = rt((i) => {
7551
+ p && G((r) => ({
7596
7552
  ...r,
7597
7553
  [p.sectionName]: {
7598
- elements: x.map((c) => c.type === "image" ? {
7599
- ...c,
7554
+ elements: x.map((d) => d.type === "image" ? {
7555
+ ...d,
7600
7556
  // Keep the image data reference
7601
- imageData: c.imageData,
7602
- src: c.src
7603
- } : c),
7604
- selectedColor: $
7557
+ imageData: d.imageData,
7558
+ src: d.src
7559
+ } : d),
7560
+ selectedColor: H
7605
7561
  }
7606
7562
  }));
7607
7563
  const t = L[i.sectionName];
7608
7564
  if (t) {
7609
- const r = t.elements.map((c) => {
7610
- if (c.type === "image" && c.src && !c.imageData) {
7565
+ const r = t.elements.map((d) => {
7566
+ if (d.type === "image" && d.src && !d.imageData) {
7611
7567
  const g = new Image();
7612
7568
  return g.onload = () => {
7613
7569
  n(
7614
7570
  (m) => m.map(
7615
- (w) => w.id === c.id ? { ...w, imageData: g } : w
7571
+ (w) => w.id === d.id ? { ...w, imageData: g } : w
7616
7572
  )
7617
- ), _();
7618
- }, g.src = c.src, { ...c, imageData: g };
7573
+ ), Y();
7574
+ }, g.src = d.src, { ...d, imageData: g };
7619
7575
  }
7620
- return c;
7576
+ return d;
7621
7577
  });
7622
- n(r), at(t.selectedColor || $);
7578
+ n(r), at(t.selectedColor || H);
7623
7579
  } else
7624
7580
  n([]);
7625
- et(i), j(null);
7626
- }, [p, x, $, L, _]), Me = rt((i) => {
7581
+ et(i), T(null);
7582
+ }, [p, x, H, L, Y]), Le = rt((i) => {
7627
7583
  if (i && i.type.startsWith("image/")) {
7628
7584
  const t = new FileReader();
7629
7585
  t.onload = (r) => {
7630
- const c = new Image();
7631
- c.onload = () => {
7586
+ const d = new Image();
7587
+ d.onload = () => {
7632
7588
  const g = {
7633
- id: dt(),
7589
+ id: ht(),
7634
7590
  type: "image",
7635
7591
  x: pt(v / 2 - 100),
7636
7592
  y: pt(W / 2 - 100),
7637
- width: Math.min(c.width, 200),
7593
+ width: Math.min(d.width, 200),
7638
7594
  // Limit initial size
7639
- height: Math.min(c.height, 200),
7595
+ height: Math.min(d.height, 200),
7640
7596
  rotation: 0,
7641
- imageData: c,
7597
+ imageData: d,
7642
7598
  src: r.target.result,
7643
- originalWidth: c.width,
7644
- originalHeight: c.height
7645
- }, m = c.width / c.height;
7646
- g.width / g.height !== m && (g.width / m <= 200 ? g.height = g.width / m : g.width = g.height * m), n((w) => [...w, g]), j(g), st();
7647
- }, c.onerror = () => {
7599
+ originalWidth: d.width,
7600
+ originalHeight: d.height
7601
+ }, m = d.width / d.height;
7602
+ g.width / g.height !== m && (g.width / m <= 200 ? g.height = g.width / m : g.width = g.height * m), n((w) => [...w, g]), T(g), lt();
7603
+ }, d.onerror = () => {
7648
7604
  console.error("Failed to load uploaded image"), alert("Failed to load the uploaded image. Please try again.");
7649
- }, c.src = r.target.result;
7605
+ }, d.src = r.target.result;
7650
7606
  }, t.onerror = () => {
7651
7607
  console.error("Failed to read file"), alert("Failed to read the file. Please try again.");
7652
7608
  }, t.readAsDataURL(i);
7653
7609
  } else
7654
7610
  alert("Please select a valid image file.");
7655
- }, [v, W, pt, dt, st]);
7611
+ }, [v, W, pt, ht, lt]);
7656
7612
  Z(() => {
7657
7613
  if (p != null && p.sectionImage) {
7658
7614
  wt.current = !0, xt.current = null, ut.current = null;
7659
7615
  const i = new Image();
7660
7616
  i.crossOrigin = "anonymous", i.onload = () => {
7661
- xt.current = i, At(i, $);
7617
+ xt.current = i, At(i, H);
7662
7618
  }, i.onerror = () => {
7663
- console.error("Failed to load background image:", p.sectionImage), wt.current = !1, _();
7619
+ console.error("Failed to load background image:", p.sectionImage), wt.current = !1, Y();
7664
7620
  }, i.src = p.sectionImage;
7665
7621
  } else
7666
- xt.current = null, ut.current = null, wt.current = !1, _();
7667
- }, [p == null ? void 0 : p.sectionImage, $]);
7622
+ xt.current = null, ut.current = null, wt.current = !1, Y();
7623
+ }, [p == null ? void 0 : p.sectionImage, H]);
7668
7624
  const Vt = rt(
7669
- Le(() => {
7670
- _();
7625
+ Pe(() => {
7626
+ Y();
7671
7627
  }, 16),
7672
7628
  // 60fps limit
7673
- [_]
7629
+ [Y]
7674
7630
  );
7675
7631
  Z(() => {
7676
7632
  wt.current || Vt();
7677
- }, [x, d, M, Vt]);
7678
- function Le(i, t) {
7633
+ }, [x, c, M, Vt]);
7634
+ function Pe(i, t) {
7679
7635
  let r;
7680
7636
  return function(...g) {
7681
7637
  const m = () => {
@@ -7685,52 +7641,52 @@ const ci = Oe((f, o) => {
7685
7641
  };
7686
7642
  }
7687
7643
  Z(() => {
7688
- xt.current && At(xt.current, $);
7689
- }, [$]), Z(() => {
7690
- _();
7691
- }, [_]);
7692
- const Pe = (i, t, r) => (0.2126 * i + 0.7152 * t + 0.0722 * r) / 255, At = rt((i, t) => {
7693
- const r = Ot.current, c = r.getContext("2d");
7694
- r.width = v, r.height = W, c.clearRect(0, 0, v, W), c.drawImage(i, 0, 0, v, W);
7695
- const g = c.getImageData(0, 0, v, W), m = g.data, w = fe(t);
7644
+ xt.current && At(xt.current, H);
7645
+ }, [H]), Z(() => {
7646
+ Y();
7647
+ }, [Y]);
7648
+ const Ue = (i, t, r) => (0.2126 * i + 0.7152 * t + 0.0722 * r) / 255, At = rt((i, t) => {
7649
+ const r = Ot.current, d = r.getContext("2d");
7650
+ r.width = v, r.height = W, d.clearRect(0, 0, v, W), d.drawImage(i, 0, 0, v, W);
7651
+ const g = d.getImageData(0, 0, v, W), m = g.data, w = he(t);
7696
7652
  if (!w) {
7697
7653
  wt.current = !1;
7698
7654
  return;
7699
7655
  }
7700
- const { r: S, g: b, b: I } = w;
7701
- for (let E = 0; E < m.length; E += 4) {
7702
- if (m[E + 3] === 0) continue;
7703
- const ft = Pe(m[E], m[E + 1], m[E + 2]);
7704
- m[E] = Math.round(S * ft), m[E + 1] = Math.round(b * ft), m[E + 2] = Math.round(I * ft);
7656
+ const { r: S, g: b, b: R } = w;
7657
+ for (let z = 0; z < m.length; z += 4) {
7658
+ if (m[z + 3] === 0) continue;
7659
+ const dt = Ue(m[z], m[z + 1], m[z + 2]);
7660
+ m[z] = Math.round(S * dt), m[z + 1] = Math.round(b * dt), m[z + 2] = Math.round(R * dt);
7705
7661
  }
7706
- c.putImageData(g, 0, 0);
7707
- const N = new Image();
7708
- N.onload = () => {
7709
- console.log("plain color: ", s.plainColor), ut.current = s.plainColor === "Y" ? N : i, wt.current = !1, _();
7710
- }, N.src = r.toDataURL("image/png");
7711
- }, [v, W, _]), Xt = (i) => {
7662
+ d.putImageData(g, 0, 0);
7663
+ const I = new Image();
7664
+ I.onload = () => {
7665
+ console.log("plain color: ", s.plainColor), ut.current = s.plainColor === "Y" ? I : i, wt.current = !1, Y();
7666
+ }, I.src = r.toDataURL("image/png");
7667
+ }, [v, W, Y]), Xt = (i) => {
7712
7668
  if (!tt) return { horizontal: [], vertical: [] };
7713
7669
  const t = document.querySelector(".ruler-horizontal"), r = document.querySelector(".ruler-vertical");
7714
7670
  if (!t || !r)
7715
7671
  return { horizontal: [], vertical: [] };
7716
- const c = t.getBoundingClientRect(), g = r.getBoundingClientRect(), m = c.width, w = g.height, S = 50, b = [], I = [];
7717
- for (let N = S; N <= m; N += S)
7718
- N <= m - 20 && b.push({
7719
- position: N,
7720
- value: Math.round(N / i)
7672
+ const d = t.getBoundingClientRect(), g = r.getBoundingClientRect(), m = d.width, w = g.height, S = 50, b = [], R = [];
7673
+ for (let I = S; I <= m; I += S)
7674
+ I <= m - 20 && b.push({
7675
+ position: I,
7676
+ value: Math.round(I / i)
7721
7677
  });
7722
- for (let N = S; N <= w; N += S)
7723
- N <= w - 15 && I.push({
7724
- position: N,
7725
- value: Math.round(N / i)
7678
+ for (let I = S; I <= w; I += S)
7679
+ I <= w - 15 && R.push({
7680
+ position: I,
7681
+ value: Math.round(I / i)
7726
7682
  });
7727
- return { horizontal: b, vertical: I };
7728
- }, [Jt, Kt] = A({ horizontal: [], vertical: [] });
7683
+ return { horizontal: b, vertical: R };
7684
+ }, [Jt, Kt] = N({ horizontal: [], vertical: [] });
7729
7685
  return Z(() => {
7730
7686
  const i = () => {
7731
7687
  setTimeout(() => {
7732
- const c = Xt(Q);
7733
- Kt(c);
7688
+ const d = Xt(Q);
7689
+ Kt(d);
7734
7690
  }, 50);
7735
7691
  };
7736
7692
  i();
@@ -7751,23 +7707,23 @@ const ci = Oe((f, o) => {
7751
7707
  }
7752
7708
  }, [tt, u, Q]), /* @__PURE__ */ e.jsxs("div", { className: "pure-canvas-designer", children: [
7753
7709
  /* @__PURE__ */ e.jsx("div", { className: "designer-header", children: /* @__PURE__ */ e.jsx(
7754
- ri,
7710
+ ai,
7755
7711
  {
7756
- onAddElement: Ee,
7757
- onDeleteElement: () => d && Mt(d.id),
7758
- onDuplicateElement: () => d && _t(d.id),
7712
+ onAddElement: Be,
7713
+ onDeleteElement: () => c && Mt(c.id),
7714
+ onDuplicateElement: () => c && _t(c.id),
7759
7715
  onUndo: Ft,
7760
7716
  onRedo: bt,
7761
7717
  onToggleGrid: () => nt(!M),
7762
7718
  onToggleRulers: () => ct(!tt),
7763
7719
  onToggleSnap: () => P(!q),
7764
- onImageUpload: Me,
7720
+ onImageUpload: Le,
7765
7721
  canUndo: X > 0,
7766
- canRedo: X < G.length - 1,
7722
+ canRedo: X < _.length - 1,
7767
7723
  showGrid: M,
7768
7724
  showRulers: tt,
7769
7725
  snapToGrid: q,
7770
- selectedElement: d,
7726
+ selectedElement: c,
7771
7727
  theme: a,
7772
7728
  readOnly: l,
7773
7729
  apiKey: f.apiKey,
@@ -7801,9 +7757,9 @@ const ci = Oe((f, o) => {
7801
7757
  ref: K,
7802
7758
  width: v,
7803
7759
  height: W,
7804
- onMouseDown: Be,
7805
- onMouseMove: We,
7806
- onMouseUp: De,
7760
+ onMouseDown: We,
7761
+ onMouseMove: Me,
7762
+ onMouseUp: Ee,
7807
7763
  style: {
7808
7764
  border: "1px solid #e2e8f0",
7809
7765
  cursor: F ? "grabbing" : "default",
@@ -7814,21 +7770,21 @@ const ci = Oe((f, o) => {
7814
7770
  ) }),
7815
7771
  /* @__PURE__ */ e.jsxs("div", { className: "side-panels", children: [
7816
7772
  /* @__PURE__ */ e.jsx(
7817
- ai,
7773
+ si,
7818
7774
  {
7819
- selectedElement: d,
7775
+ selectedElement: c,
7820
7776
  onUpdate: Gt,
7821
7777
  onMoveLayer: Yt,
7822
- availableFonts: ne,
7778
+ availableFonts: ce,
7823
7779
  theme: a
7824
7780
  }
7825
7781
  ),
7826
7782
  /* @__PURE__ */ e.jsx(
7827
- si,
7783
+ li,
7828
7784
  {
7829
7785
  elements: x,
7830
- selectedElement: d,
7831
- onSelectElement: j,
7786
+ selectedElement: c,
7787
+ onSelectElement: T,
7832
7788
  onMoveLayer: Yt,
7833
7789
  onDeleteElement: Mt,
7834
7790
  theme: a
@@ -7850,8 +7806,8 @@ const ci = Oe((f, o) => {
7850
7806
  className: `section-thumbnail compact ${p.sectionName === i.sectionName ? "active" : ""}`,
7851
7807
  onClick: (r) => {
7852
7808
  r.stopPropagation();
7853
- const c = s.sections.find((g) => g.sectionName === i.sectionName);
7854
- qt(c);
7809
+ const d = s.sections.find((g) => g.sectionName === i.sectionName);
7810
+ qt(d);
7855
7811
  },
7856
7812
  title: i.sectionName,
7857
7813
  children: [
@@ -7883,7 +7839,7 @@ const ci = Oe((f, o) => {
7883
7839
  s.colorSettings.slice(0, 3).map((i, t) => /* @__PURE__ */ e.jsxs(
7884
7840
  "div",
7885
7841
  {
7886
- className: `color-swatch-enhanced compact ${$ === i ? "active" : ""}`,
7842
+ className: `color-swatch-enhanced compact ${H === i ? "active" : ""}`,
7887
7843
  onClick: (r) => {
7888
7844
  r.stopPropagation(), at(i);
7889
7845
  },
@@ -7896,7 +7852,7 @@ const ci = Oe((f, o) => {
7896
7852
  style: { backgroundColor: i }
7897
7853
  }
7898
7854
  ),
7899
- $ === i && /* @__PURE__ */ e.jsx("div", { className: "color-selection-ring compact" })
7855
+ H === i && /* @__PURE__ */ e.jsx("div", { className: "color-selection-ring compact" })
7900
7856
  ]
7901
7857
  },
7902
7858
  i
@@ -7922,7 +7878,7 @@ const ci = Oe((f, o) => {
7922
7878
  /* @__PURE__ */ e.jsx("div", { className: "color-dropdown-menu", style: { display: "none" }, children: s.colorSettings.slice(3).map((i, t) => /* @__PURE__ */ e.jsxs(
7923
7879
  "div",
7924
7880
  {
7925
- className: `color-swatch-dropdown ${$ === i ? "active" : ""}`,
7881
+ className: `color-swatch-dropdown ${H === i ? "active" : ""}`,
7926
7882
  onClick: (r) => {
7927
7883
  r.stopPropagation(), at(i), r.currentTarget.parentElement.style.display = "none";
7928
7884
  },
@@ -7950,7 +7906,7 @@ const ci = Oe((f, o) => {
7950
7906
  "button",
7951
7907
  {
7952
7908
  className: "zoom-button compact zoom-out",
7953
- onClick: () => ht(Math.max(0.25, Q - 0.25)),
7909
+ onClick: () => ft(Math.max(0.25, Q - 0.25)),
7954
7910
  disabled: Q <= 0.25,
7955
7911
  title: "Zoom Out",
7956
7912
  children: /* @__PURE__ */ e.jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
@@ -7973,7 +7929,7 @@ const ci = Oe((f, o) => {
7973
7929
  max: "4",
7974
7930
  step: "0.25",
7975
7931
  value: Q,
7976
- onChange: (i) => ht(parseFloat(i.target.value)),
7932
+ onChange: (i) => ft(parseFloat(i.target.value)),
7977
7933
  className: "zoom-slider compact"
7978
7934
  }
7979
7935
  ) })
@@ -7982,7 +7938,7 @@ const ci = Oe((f, o) => {
7982
7938
  "button",
7983
7939
  {
7984
7940
  className: "zoom-button compact zoom-in",
7985
- onClick: () => ht(Math.min(4, Q + 0.25)),
7941
+ onClick: () => ft(Math.min(4, Q + 0.25)),
7986
7942
  disabled: Q >= 4,
7987
7943
  title: "Zoom In",
7988
7944
  children: /* @__PURE__ */ e.jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
@@ -7997,7 +7953,7 @@ const ci = Oe((f, o) => {
7997
7953
  "button",
7998
7954
  {
7999
7955
  className: "zoom-reset compact",
8000
- onClick: () => ht(1),
7956
+ onClick: () => ft(1),
8001
7957
  title: "Reset Zoom (100%)",
8002
7958
  children: /* @__PURE__ */ e.jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
8003
7959
  /* @__PURE__ */ e.jsx("path", { d: "M3 3l18 18" }),
@@ -8011,7 +7967,7 @@ const ci = Oe((f, o) => {
8011
7967
  ] })
8012
7968
  ] });
8013
7969
  });
8014
- ci.displayName = "Mypixia";
7970
+ di.displayName = "Mypixia";
8015
7971
  export {
8016
- ci as default
7972
+ di as default
8017
7973
  };