@mypixia/simplex-designer 2.0.4 → 2.0.7

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,8 +1,8 @@
1
- import Qe, { useState as N, useRef as gt, useEffect as ot, useMemo as ie, forwardRef as $e, useCallback as rt, useReducer as He, useImperativeHandle as Ge } from "react";
1
+ import Qe, { useState as N, useRef as gt, useEffect as rt, useMemo as ie, forwardRef as $e, useCallback as at, useReducer as He, useImperativeHandle as Ge } from "react";
2
2
  import _e from "qrcode";
3
3
  import Ye from "react-barcode";
4
4
  import oe from "axios";
5
- import './index_external.css';var Dt = { exports: {} }, Ct = {};
5
+ import './index_external.css';var Et = { exports: {} }, jt = {};
6
6
  /**
7
7
  * @license React
8
8
  * react-jsx-runtime.production.js
@@ -14,25 +14,25 @@ import './index_external.css';var Dt = { exports: {} }, Ct = {};
14
14
  */
15
15
  var re;
16
16
  function qe() {
17
- if (re) return Ct;
17
+ if (re) return jt;
18
18
  re = 1;
19
19
  var f = Symbol.for("react.transitional.element"), o = Symbol.for("react.fragment");
20
- function a(l, s, h) {
21
- var x = null;
22
- if (h !== void 0 && (x = "" + h), s.key !== void 0 && (x = "" + s.key), "key" in s) {
23
- h = {};
20
+ function a(l, s, g) {
21
+ var h = null;
22
+ if (g !== void 0 && (h = "" + g), s.key !== void 0 && (h = "" + s.key), "key" in s) {
23
+ g = {};
24
24
  for (var n in s)
25
- n !== "key" && (h[n] = s[n]);
26
- } else h = s;
27
- return s = h.ref, {
25
+ n !== "key" && (g[n] = s[n]);
26
+ } else g = s;
27
+ return s = g.ref, {
28
28
  $$typeof: f,
29
29
  type: l,
30
- key: x,
30
+ key: h,
31
31
  ref: s !== void 0 ? s : null,
32
- props: h
32
+ props: g
33
33
  };
34
34
  }
35
- return Ct.Fragment = o, Ct.jsx = a, Ct.jsxs = a, Ct;
35
+ return jt.Fragment = o, jt.jsx = a, jt.jsxs = a, jt;
36
36
  }
37
37
  var Tt = {};
38
38
  /**
@@ -47,163 +47,163 @@ var Tt = {};
47
47
  var ae;
48
48
  function Ve() {
49
49
  return ae || (ae = 1, process.env.NODE_ENV !== "production" && function() {
50
- function f(u) {
51
- if (u == null) return null;
52
- if (typeof u == "function")
53
- return u.$$typeof === q ? null : u.displayName || u.name || null;
54
- if (typeof u == "string") return u;
55
- switch (u) {
56
- case b:
50
+ function f(y) {
51
+ if (y == null) return null;
52
+ if (typeof y == "function")
53
+ return y.$$typeof === _ ? null : y.displayName || y.name || null;
54
+ if (typeof y == "string") return y;
55
+ switch (y) {
56
+ case p:
57
57
  return "Fragment";
58
- case J:
58
+ case X:
59
59
  return "Profiler";
60
- case F:
60
+ case v:
61
61
  return "StrictMode";
62
- case st:
62
+ case Z:
63
63
  return "Suspense";
64
64
  case W:
65
65
  return "SuspenseList";
66
66
  case ft:
67
67
  return "Activity";
68
68
  }
69
- if (typeof u == "object")
70
- switch (typeof u.tag == "number" && console.error(
69
+ if (typeof y == "object")
70
+ switch (typeof y.tag == "number" && console.error(
71
71
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
72
- ), u.$$typeof) {
73
- case B:
72
+ ), y.$$typeof) {
73
+ case j:
74
74
  return "Portal";
75
75
  case O:
76
- return (u.displayName || "Context") + ".Provider";
77
- case C:
78
- return (u._context.displayName || "Context") + ".Consumer";
79
- case v:
80
- var D = u.render;
81
- return u = u.displayName, u || (u = D.displayName || D.name || "", u = u !== "" ? "ForwardRef(" + u + ")" : "ForwardRef"), u;
76
+ return (y.displayName || "Context") + ".Provider";
77
+ case T:
78
+ return (y._context.displayName || "Context") + ".Consumer";
79
+ case k:
80
+ var D = y.render;
81
+ return y = y.displayName, y || (y = D.displayName || D.name || "", y = y !== "" ? "ForwardRef(" + y + ")" : "ForwardRef"), y;
82
82
  case xt:
83
- return D = u.displayName || null, D !== null ? D : f(u.type) || "Memo";
83
+ return D = y.displayName || null, D !== null ? D : f(y.type) || "Memo";
84
84
  case Q:
85
- D = u._payload, u = u._init;
85
+ D = y._payload, y = y._init;
86
86
  try {
87
- return f(u(D));
87
+ return f(y(D));
88
88
  } catch {
89
89
  }
90
90
  }
91
91
  return null;
92
92
  }
93
- function o(u) {
94
- return "" + u;
93
+ function o(y) {
94
+ return "" + y;
95
95
  }
96
- function a(u) {
96
+ function a(y) {
97
97
  try {
98
- o(u);
98
+ o(y);
99
99
  var D = !1;
100
100
  } catch {
101
101
  D = !0;
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, H = typeof Symbol == "function" && Symbol.toStringTag && y[Symbol.toStringTag] || y.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
109
  H
110
- ), o(u);
110
+ ), o(y);
111
111
  }
112
112
  }
113
- function l(u) {
114
- if (u === b) return "<>";
115
- if (typeof u == "object" && u !== null && u.$$typeof === Q)
113
+ function l(y) {
114
+ if (y === p) return "<>";
115
+ if (typeof y == "object" && y !== null && y.$$typeof === Q)
116
116
  return "<...>";
117
117
  try {
118
- var D = f(u);
118
+ var D = f(y);
119
119
  return D ? "<" + D + ">" : "<...>";
120
120
  } catch {
121
121
  return "<...>";
122
122
  }
123
123
  }
124
124
  function s() {
125
- var u = at.A;
126
- return u === null ? null : u.getOwner();
125
+ var y = st.A;
126
+ return y === null ? null : y.getOwner();
127
127
  }
128
- function h() {
128
+ function g() {
129
129
  return Error("react-stack-top-frame");
130
130
  }
131
- function x(u) {
132
- if (M.call(u, "key")) {
133
- var D = Object.getOwnPropertyDescriptor(u, "key").get;
131
+ function h(y) {
132
+ if (M.call(y, "key")) {
133
+ var D = Object.getOwnPropertyDescriptor(y, "key").get;
134
134
  if (D && D.isReactWarning) return !1;
135
135
  }
136
- return u.key !== void 0;
136
+ return y.key !== void 0;
137
137
  }
138
- function n(u, D) {
138
+ function n(y, D) {
139
139
  function L() {
140
140
  ct || (ct = !0, console.error(
141
141
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
142
142
  D
143
143
  ));
144
144
  }
145
- L.isReactWarning = !0, Object.defineProperty(u, "key", {
145
+ L.isReactWarning = !0, Object.defineProperty(y, "key", {
146
146
  get: L,
147
147
  configurable: !0
148
148
  });
149
149
  }
150
- function d() {
151
- var u = f(this.type);
152
- return _[u] || (_[u] = !0, console.error(
150
+ function c() {
151
+ var y = f(this.type);
152
+ return Y[y] || (Y[y] = !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
- )), u = this.props.ref, u !== void 0 ? u : null;
154
+ )), y = this.props.ref, y !== void 0 ? y : null;
155
155
  }
156
- function j(u, D, L, H, G, et, X, Y) {
157
- return L = et.ref, u = {
158
- $$typeof: E,
159
- type: u,
156
+ function F(y, D, L, H, G, it, J, q) {
157
+ return L = it.ref, y = {
158
+ $$typeof: B,
159
+ type: y,
160
160
  key: D,
161
- props: et,
161
+ props: it,
162
162
  _owner: G
163
- }, (L !== void 0 ? L : null) !== null ? Object.defineProperty(u, "ref", {
163
+ }, (L !== void 0 ? L : null) !== null ? Object.defineProperty(y, "ref", {
164
164
  enumerable: !1,
165
- get: d
166
- }) : Object.defineProperty(u, "ref", { enumerable: !1, value: null }), u._store = {}, Object.defineProperty(u._store, "validated", {
165
+ get: c
166
+ }) : Object.defineProperty(y, "ref", { enumerable: !1, value: null }), y._store = {}, Object.defineProperty(y._store, "validated", {
167
167
  configurable: !1,
168
168
  enumerable: !1,
169
169
  writable: !0,
170
170
  value: 0
171
- }), Object.defineProperty(u, "_debugInfo", {
171
+ }), Object.defineProperty(y, "_debugInfo", {
172
172
  configurable: !1,
173
173
  enumerable: !1,
174
174
  writable: !0,
175
175
  value: null
176
- }), Object.defineProperty(u, "_debugStack", {
176
+ }), Object.defineProperty(y, "_debugStack", {
177
177
  configurable: !1,
178
178
  enumerable: !1,
179
179
  writable: !0,
180
- value: X
181
- }), Object.defineProperty(u, "_debugTask", {
180
+ value: J
181
+ }), Object.defineProperty(y, "_debugTask", {
182
182
  configurable: !1,
183
183
  enumerable: !1,
184
184
  writable: !0,
185
- value: Y
186
- }), Object.freeze && (Object.freeze(u.props), Object.freeze(u)), u;
185
+ value: q
186
+ }), Object.freeze && (Object.freeze(y.props), Object.freeze(y)), y;
187
187
  }
188
- function S(u, D, L, H, G, et, X, Y) {
188
+ function I(y, D, L, H, G, it, J, q) {
189
189
  var U = D.children;
190
190
  if (U !== void 0)
191
191
  if (H)
192
192
  if (nt(U)) {
193
193
  for (H = 0; H < U.length; H++)
194
- I(U[H]);
194
+ E(U[H]);
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 I(U);
200
+ else E(U);
201
201
  if (M.call(D, "key")) {
202
- U = f(u);
203
- var K = Object.keys(D).filter(function(mt) {
204
- return mt !== "key";
202
+ U = f(y);
203
+ var K = Object.keys(D).filter(function(pt) {
204
+ return pt !== "key";
205
205
  });
206
- H = 0 < K.length ? "{key: someKey, " + K.join(": ..., ") + ": ...}" : "{key: someKey}", tt[U + H] || (K = 0 < K.length ? "{" + K.join(": ..., ") + ": ...}" : "{}", console.error(
206
+ H = 0 < K.length ? "{key: someKey, " + K.join(": ..., ") + ": ...}" : "{key: someKey}", et[U + H] || (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} />
@@ -214,72 +214,72 @@ React keys must be passed directly to JSX without using spread:
214
214
  U,
215
215
  K,
216
216
  U
217
- ), tt[U + H] = !0);
217
+ ), et[U + H] = !0);
218
218
  }
219
- if (U = null, L !== void 0 && (a(L), U = "" + L), x(D) && (a(D.key), U = "" + D.key), "key" in D) {
219
+ if (U = null, L !== void 0 && (a(L), U = "" + L), h(D) && (a(D.key), U = "" + D.key), "key" in D) {
220
220
  L = {};
221
- for (var vt in D)
222
- vt !== "key" && (L[vt] = D[vt]);
221
+ for (var kt in D)
222
+ kt !== "key" && (L[kt] = D[kt]);
223
223
  } else L = D;
224
224
  return U && n(
225
225
  L,
226
- typeof u == "function" ? u.displayName || u.name || "Unknown" : u
227
- ), j(
228
- u,
226
+ typeof y == "function" ? y.displayName || y.name || "Unknown" : y
227
+ ), F(
228
+ y,
229
229
  U,
230
- et,
230
+ it,
231
231
  G,
232
232
  s(),
233
233
  L,
234
- X,
235
- Y
234
+ J,
235
+ q
236
236
  );
237
237
  }
238
- function I(u) {
239
- typeof u == "object" && u !== null && u.$$typeof === E && u._store && (u._store.validated = 1);
238
+ function E(y) {
239
+ typeof y == "object" && y !== null && y.$$typeof === B && y._store && (y._store.validated = 1);
240
240
  }
241
- var y = Qe, E = Symbol.for("react.transitional.element"), B = Symbol.for("react.portal"), b = Symbol.for("react.fragment"), F = Symbol.for("react.strict_mode"), J = Symbol.for("react.profiler"), C = 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"), xt = Symbol.for("react.memo"), Q = Symbol.for("react.lazy"), ft = Symbol.for("react.activity"), q = 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, Z = console.createTask ? console.createTask : function() {
241
+ var m = Qe, B = Symbol.for("react.transitional.element"), j = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), X = Symbol.for("react.profiler"), T = Symbol.for("react.consumer"), O = Symbol.for("react.context"), k = Symbol.for("react.forward_ref"), Z = Symbol.for("react.suspense"), W = Symbol.for("react.suspense_list"), xt = Symbol.for("react.memo"), Q = Symbol.for("react.lazy"), ft = Symbol.for("react.activity"), _ = Symbol.for("react.client.reference"), st = m.__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
- y = {
245
- "react-stack-bottom-frame": function(u) {
246
- return u();
244
+ m = {
245
+ "react-stack-bottom-frame": function(y) {
246
+ return y();
247
247
  }
248
248
  };
249
- var ct, _ = {}, P = y["react-stack-bottom-frame"].bind(
250
- y,
251
- h
252
- )(), T = Z(l(h)), tt = {};
253
- Tt.Fragment = b, Tt.jsx = function(u, D, L, H, G) {
254
- var et = 1e4 > at.recentlyCreatedOwnerStacks++;
255
- return S(
256
- u,
249
+ var ct, Y = {}, P = m["react-stack-bottom-frame"].bind(
250
+ m,
251
+ g
252
+ )(), C = tt(l(g)), et = {};
253
+ Tt.Fragment = p, Tt.jsx = function(y, D, L, H, G) {
254
+ var it = 1e4 > st.recentlyCreatedOwnerStacks++;
255
+ return I(
256
+ y,
257
257
  D,
258
258
  L,
259
259
  !1,
260
260
  H,
261
261
  G,
262
- et ? Error("react-stack-top-frame") : P,
263
- et ? Z(l(u)) : T
262
+ it ? Error("react-stack-top-frame") : P,
263
+ it ? tt(l(y)) : C
264
264
  );
265
- }, Tt.jsxs = function(u, D, L, H, G) {
266
- var et = 1e4 > at.recentlyCreatedOwnerStacks++;
267
- return S(
268
- u,
265
+ }, Tt.jsxs = function(y, D, L, H, G) {
266
+ var it = 1e4 > st.recentlyCreatedOwnerStacks++;
267
+ return I(
268
+ y,
269
269
  D,
270
270
  L,
271
271
  !0,
272
272
  H,
273
273
  G,
274
- et ? Error("react-stack-top-frame") : P,
275
- et ? Z(l(u)) : T
274
+ it ? Error("react-stack-top-frame") : P,
275
+ it ? tt(l(y)) : C
276
276
  );
277
277
  };
278
278
  }()), Tt;
279
279
  }
280
280
  var se;
281
281
  function Xe() {
282
- return se || (se = 1, process.env.NODE_ENV === "production" ? Dt.exports = qe() : Dt.exports = Ve()), Dt.exports;
282
+ return se || (se = 1, process.env.NODE_ENV === "production" ? Et.exports = qe() : Et.exports = Ve()), Et.exports;
283
283
  }
284
284
  var i = Xe();
285
285
  const Ut = {
@@ -381,24 +381,24 @@ const Ut = {
381
381
  ), Je = (f) => ne().filter(
382
382
  (a) => a.name.toLowerCase().includes(f.toLowerCase()) || a.category.toLowerCase().includes(f.toLowerCase())
383
383
  ), Ke = ({ onSelectIcon: f, disabled: o = !1 }) => {
384
- const [a, l] = N(!1), [s, h] = N(""), [x, n] = N("all"), d = gt(null);
385
- ot(() => {
386
- const y = (E) => {
387
- d.current && !d.current.contains(E.target) && l(!1);
384
+ const [a, l] = N(!1), [s, g] = N(""), [h, n] = N("all"), c = gt(null);
385
+ rt(() => {
386
+ const m = (B) => {
387
+ c.current && !c.current.contains(B.target) && l(!1);
388
388
  };
389
- return document.addEventListener("mousedown", y), () => document.removeEventListener("mousedown", y);
389
+ return document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
390
390
  }, []);
391
- const j = (y) => {
392
- f(y), l(!1), h("");
393
- }, I = (() => {
394
- let y = ne();
395
- if (s.trim() && (y = Je(s)), x !== "all") {
396
- const E = Ut[x];
397
- E && (y = y.filter((B) => B.category === E.name));
391
+ const F = (m) => {
392
+ f(m), l(!1), g("");
393
+ }, E = (() => {
394
+ let m = ne();
395
+ if (s.trim() && (m = Je(s)), h !== "all") {
396
+ const B = Ut[h];
397
+ B && (m = m.filter((j) => j.category === B.name));
398
398
  }
399
- return y;
399
+ return m;
400
400
  })();
401
- return /* @__PURE__ */ i.jsxs("div", { className: "icon-selector", ref: d, children: [
401
+ return /* @__PURE__ */ i.jsxs("div", { className: "icon-selector", ref: c, children: [
402
402
  /* @__PURE__ */ i.jsxs(
403
403
  "button",
404
404
  {
@@ -421,49 +421,49 @@ const Ut = {
421
421
  type: "text",
422
422
  placeholder: "Search icons...",
423
423
  value: s,
424
- onChange: (y) => h(y.target.value),
424
+ onChange: (m) => g(m.target.value),
425
425
  className: "icon-search"
426
426
  }
427
427
  ),
428
428
  /* @__PURE__ */ i.jsxs(
429
429
  "select",
430
430
  {
431
- value: x,
432
- onChange: (y) => n(y.target.value),
431
+ value: h,
432
+ onChange: (m) => n(m.target.value),
433
433
  className: "category-select",
434
434
  children: [
435
435
  /* @__PURE__ */ i.jsx("option", { value: "all", children: "All Categories" }),
436
- Object.entries(Ut).map(([y, E]) => /* @__PURE__ */ i.jsx("option", { value: y, children: E.name }, y))
436
+ Object.entries(Ut).map(([m, B]) => /* @__PURE__ */ i.jsx("option", { value: m, children: B.name }, m))
437
437
  ]
438
438
  }
439
439
  )
440
440
  ] }),
441
- /* @__PURE__ */ i.jsx("div", { className: "icon-grid", children: I.length === 0 ? /* @__PURE__ */ i.jsx("div", { className: "no-icons", children: s ? "No icons found" : "No icons in this category" }) : I.map((y, E) => /* @__PURE__ */ i.jsxs(
441
+ /* @__PURE__ */ i.jsx("div", { className: "icon-grid", children: E.length === 0 ? /* @__PURE__ */ i.jsx("div", { className: "no-icons", children: s ? "No icons found" : "No icons in this category" }) : E.map((m, B) => /* @__PURE__ */ i.jsxs(
442
442
  "button",
443
443
  {
444
444
  className: "icon-item",
445
- onClick: () => j(y),
446
- title: `${y.name} (${y.category})`,
445
+ onClick: () => F(m),
446
+ title: `${m.name} (${m.category})`,
447
447
  children: [
448
- /* @__PURE__ */ i.jsx("span", { className: "icon-symbol", children: y.symbol }),
449
- /* @__PURE__ */ i.jsx("span", { className: "icon-name", children: y.name })
448
+ /* @__PURE__ */ i.jsx("span", { className: "icon-symbol", children: m.symbol }),
449
+ /* @__PURE__ */ i.jsx("span", { className: "icon-name", children: m.name })
450
450
  ]
451
451
  },
452
- `${y.name}-${E}`
452
+ `${m.name}-${B}`
453
453
  )) }),
454
454
  /* @__PURE__ */ i.jsx("div", { className: "icon-dropdown-footer", children: /* @__PURE__ */ i.jsxs("span", { className: "icon-count", children: [
455
- I.length,
455
+ E.length,
456
456
  " icon",
457
- I.length !== 1 ? "s" : ""
457
+ E.length !== 1 ? "s" : ""
458
458
  ] }) })
459
459
  ] })
460
460
  ] });
461
461
  }, Ze = ({ isOpen: f, onClose: o, onAddQRCode: a, theme: l }) => {
462
- const [s, h] = N(""), [x, n] = N(""), [d, j] = N(200), [S, I] = N("M"), y = () => {
462
+ const [s, g] = N(""), [h, n] = N(""), [c, F] = N(200), [I, E] = N("M"), m = () => {
463
463
  if (!s.trim()) return;
464
- const b = {
465
- width: d,
466
- errorCorrectionLevel: S,
464
+ const p = {
465
+ width: c,
466
+ errorCorrectionLevel: I,
467
467
  type: "image/png",
468
468
  quality: 0.92,
469
469
  margin: 1,
@@ -472,40 +472,40 @@ const Ut = {
472
472
  light: "#FFFFFF"
473
473
  }
474
474
  };
475
- _e.toDataURL(s, b, (F, J) => {
476
- if (F) {
477
- console.error("QR Code generation error:", F);
475
+ _e.toDataURL(s, p, (v, X) => {
476
+ if (v) {
477
+ console.error("QR Code generation error:", v);
478
478
  return;
479
479
  }
480
- n(J);
480
+ n(X);
481
481
  });
482
- }, E = () => {
483
- if (!x) return;
484
- const b = new Image();
485
- b.onload = () => {
482
+ }, B = () => {
483
+ if (!h) return;
484
+ const p = new Image();
485
+ p.onload = () => {
486
486
  a({
487
487
  type: "qrcode",
488
- src: x,
488
+ src: h,
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
- imageObject: b
494
+ imageObject: p
495
495
  // Store the loaded image object
496
- }), B();
497
- }, b.src = x;
498
- }, B = () => {
499
- h(""), n(""), o();
496
+ }), j();
497
+ }, p.src = h;
498
+ }, j = () => {
499
+ g(""), n(""), o();
500
500
  };
501
- return f ? /* @__PURE__ */ i.jsx("div", { className: "qr-modal-overlay", onClick: B, children: /* @__PURE__ */ i.jsxs("div", { className: "qr-modal-content", onClick: (b) => b.stopPropagation(), children: [
501
+ return f ? /* @__PURE__ */ i.jsx("div", { className: "qr-modal-overlay", onClick: j, children: /* @__PURE__ */ i.jsxs("div", { className: "qr-modal-content", onClick: (p) => p.stopPropagation(), children: [
502
502
  /* @__PURE__ */ i.jsxs("div", { className: "qr-modal-header", children: [
503
503
  /* @__PURE__ */ i.jsx("h3", { children: "Generate QR Code" }),
504
504
  /* @__PURE__ */ i.jsx(
505
505
  "button",
506
506
  {
507
507
  className: "qr-modal-close",
508
- onClick: B,
508
+ onClick: j,
509
509
  "aria-label": "Close",
510
510
  children: "×"
511
511
  }
@@ -519,7 +519,7 @@ const Ut = {
519
519
  {
520
520
  id: "qr-data",
521
521
  value: s,
522
- onChange: (b) => h(b.target.value),
522
+ onChange: (p) => g(p.target.value),
523
523
  placeholder: "https://example.com or any text...",
524
524
  rows: 3
525
525
  }
@@ -533,8 +533,8 @@ const Ut = {
533
533
  {
534
534
  type: "number",
535
535
  id: "qr-size",
536
- value: d,
537
- onChange: (b) => j(Math.max(50, Math.min(500, parseInt(b.target.value) || 200))),
536
+ value: c,
537
+ onChange: (p) => F(Math.max(50, Math.min(500, parseInt(p.target.value) || 200))),
538
538
  min: "50",
539
539
  max: "500"
540
540
  }
@@ -546,8 +546,8 @@ const Ut = {
546
546
  "select",
547
547
  {
548
548
  id: "qr-error-level",
549
- value: S,
550
- onChange: (b) => I(b.target.value),
549
+ value: I,
550
+ onChange: (p) => E(p.target.value),
551
551
  children: [
552
552
  /* @__PURE__ */ i.jsx("option", { value: "L", children: "Low (7%)" }),
553
553
  /* @__PURE__ */ i.jsx("option", { value: "M", children: "Medium (15%)" }),
@@ -562,19 +562,19 @@ const Ut = {
562
562
  "button",
563
563
  {
564
564
  className: "qr-btn qr-btn-generate",
565
- onClick: y,
565
+ onClick: m,
566
566
  disabled: !s.trim(),
567
567
  children: "Generate QR Code"
568
568
  }
569
569
  ) }),
570
- x && /* @__PURE__ */ i.jsxs("div", { className: "qr-preview", children: [
570
+ h && /* @__PURE__ */ i.jsxs("div", { className: "qr-preview", children: [
571
571
  /* @__PURE__ */ i.jsx("h4", { children: "Preview" }),
572
- /* @__PURE__ */ i.jsx("div", { className: "qr-preview-container", children: /* @__PURE__ */ i.jsx("img", { src: x, alt: "QR Code Preview" }) }),
572
+ /* @__PURE__ */ i.jsx("div", { className: "qr-preview-container", children: /* @__PURE__ */ i.jsx("img", { src: h, alt: "QR Code Preview" }) }),
573
573
  /* @__PURE__ */ i.jsx(
574
574
  "button",
575
575
  {
576
576
  className: "qr-btn qr-btn-add",
577
- onClick: E,
577
+ onClick: B,
578
578
  style: {
579
579
  backgroundColor: (l == null ? void 0 : l.primaryColor) || "#3b82f6",
580
580
  borderColor: (l == null ? void 0 : l.primaryColor) || "#3b82f6"
@@ -586,7 +586,7 @@ const Ut = {
586
586
  ] })
587
587
  ] }) }) : null;
588
588
  }, ti = ({ isOpen: f, onClose: o, onAddBarcode: a, theme: l }) => {
589
- const [s, h] = N(""), [x, n] = N("CODE128"), [d, j] = N(null), [S, I] = N(2), [y, E] = N(100), [B, b] = N(20), [F, J] = N("center"), [C, O] = N("bottom"), [v, st] = N(10), W = gt(null), xt = [
589
+ const [s, g] = N(""), [h, n] = N("CODE128"), [c, F] = N(null), [I, E] = N(2), [m, B] = N(100), [j, p] = N(20), [v, X] = N("center"), [T, O] = N("bottom"), [k, Z] = N(10), W = gt(null), xt = [
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,17 +599,17 @@ const Ut = {
599
599
  ], Q = () => {
600
600
  if (s.trim())
601
601
  try {
602
- j(/* @__PURE__ */ i.jsx(
602
+ F(/* @__PURE__ */ i.jsx(
603
603
  Ye,
604
604
  {
605
605
  value: s,
606
- format: x,
607
- width: S,
608
- height: y,
609
- fontSize: B,
610
- textAlign: F,
611
- textPosition: C,
612
- margin: v,
606
+ format: h,
607
+ width: I,
608
+ height: m,
609
+ fontSize: j,
610
+ textAlign: v,
611
+ textPosition: T,
612
+ margin: k,
613
613
  background: "#ffffff",
614
614
  lineColor: "#000000"
615
615
  }
@@ -618,40 +618,40 @@ const Ut = {
618
618
  console.error("Barcode generation error:", M), alert("Invalid data for selected barcode format. Please check your input.");
619
619
  }
620
620
  }, ft = () => {
621
- var M, nt, Z, ct;
622
- if (!(!d || !W.current))
621
+ var M, nt, tt, ct;
622
+ if (!(!c || !W.current))
623
623
  try {
624
- const _ = W.current.querySelector("svg");
625
- if (!_) {
624
+ const Y = W.current.querySelector("svg");
625
+ if (!Y) {
626
626
  console.error("No SVG element found in barcode");
627
627
  return;
628
628
  }
629
- const P = document.createElement("canvas"), T = P.getContext("2d"), tt = _.getBoundingClientRect(), u = ((nt = (M = _.width) == null ? void 0 : M.baseVal) == null ? void 0 : nt.value) || tt.width || 200, D = ((ct = (Z = _.height) == null ? void 0 : Z.baseVal) == null ? void 0 : ct.value) || tt.height || 100;
630
- P.width = u, P.height = D;
631
- const L = new XMLSerializer().serializeToString(_), H = new Blob([L], { type: "image/svg+xml;charset=utf-8" }), G = URL.createObjectURL(H), et = new Image();
632
- et.onload = () => {
633
- T.drawImage(et, 0, 0);
634
- const X = P.toDataURL("image/png"), Y = new Image();
635
- Y.onload = () => {
629
+ const P = document.createElement("canvas"), C = P.getContext("2d"), et = Y.getBoundingClientRect(), y = ((nt = (M = Y.width) == null ? void 0 : M.baseVal) == null ? void 0 : nt.value) || et.width || 200, D = ((ct = (tt = Y.height) == null ? void 0 : tt.baseVal) == null ? void 0 : ct.value) || et.height || 100;
630
+ P.width = y, P.height = D;
631
+ const L = new XMLSerializer().serializeToString(Y), H = new Blob([L], { type: "image/svg+xml;charset=utf-8" }), G = URL.createObjectURL(H), it = new Image();
632
+ it.onload = () => {
633
+ C.drawImage(it, 0, 0);
634
+ const J = P.toDataURL("image/png"), q = new Image();
635
+ q.onload = () => {
636
636
  a({
637
637
  type: "barcode",
638
- src: X,
638
+ src: J,
639
639
  data: s,
640
- format: x,
641
- width: u,
640
+ format: h,
641
+ width: y,
642
642
  height: D,
643
643
  x: 100,
644
644
  y: 100,
645
- imageObject: Y
646
- }), q();
647
- }, Y.src = X, URL.revokeObjectURL(G);
648
- }, et.src = G;
649
- } catch (_) {
650
- console.error("Error adding barcode to canvas:", _), alert("Failed to add barcode to canvas. Please try again.");
645
+ imageObject: q
646
+ }), _();
647
+ }, q.src = J, URL.revokeObjectURL(G);
648
+ }, it.src = G;
649
+ } catch (Y) {
650
+ console.error("Error adding barcode to canvas:", Y), alert("Failed to add barcode to canvas. Please try again.");
651
651
  }
652
- }, q = () => {
653
- h(""), j(null), n("CODE128"), I(2), E(100), b(20), o();
654
- }, at = (M) => ({
652
+ }, _ = () => {
653
+ g(""), F(null), n("CODE128"), E(2), B(100), p(20), o();
654
+ }, st = (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.",
657
657
  EAN8: "Requires exactly 7 digits (8th is checksum). Compact version of EAN-13.",
@@ -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__ */ i.jsx("div", { className: "barcode-modal-overlay", onClick: q, children: /* @__PURE__ */ i.jsxs("div", { className: "barcode-modal-content", onClick: (M) => M.stopPropagation(), children: [
665
+ return f ? /* @__PURE__ */ i.jsx("div", { className: "barcode-modal-overlay", onClick: _, children: /* @__PURE__ */ i.jsxs("div", { className: "barcode-modal-content", onClick: (M) => M.stopPropagation(), children: [
666
666
  /* @__PURE__ */ i.jsxs("div", { className: "barcode-modal-header", children: [
667
667
  /* @__PURE__ */ i.jsx("h3", { children: "Generate Barcode" }),
668
668
  /* @__PURE__ */ i.jsx(
669
669
  "button",
670
670
  {
671
671
  className: "barcode-modal-close",
672
- onClick: q,
672
+ onClick: _,
673
673
  "aria-label": "Close",
674
674
  children: "×"
675
675
  }
@@ -684,7 +684,7 @@ const Ut = {
684
684
  type: "text",
685
685
  id: "barcode-data",
686
686
  value: s,
687
- onChange: (M) => h(M.target.value),
687
+ onChange: (M) => g(M.target.value),
688
688
  placeholder: "Enter your data..."
689
689
  }
690
690
  )
@@ -695,12 +695,12 @@ const Ut = {
695
695
  "select",
696
696
  {
697
697
  id: "barcode-format",
698
- value: x,
698
+ value: h,
699
699
  onChange: (M) => n(M.target.value),
700
700
  children: xt.map((M) => /* @__PURE__ */ i.jsx("option", { value: M.value, children: M.label }, M.value))
701
701
  }
702
702
  ),
703
- /* @__PURE__ */ i.jsx("small", { className: "format-description", children: at(x) })
703
+ /* @__PURE__ */ i.jsx("small", { className: "format-description", children: st(h) })
704
704
  ] }),
705
705
  /* @__PURE__ */ i.jsxs("div", { className: "barcode-options", children: [
706
706
  /* @__PURE__ */ i.jsxs("div", { className: "barcode-form-group", children: [
@@ -713,12 +713,12 @@ const Ut = {
713
713
  min: "1",
714
714
  max: "4",
715
715
  step: "0.5",
716
- value: S,
717
- onChange: (M) => I(parseFloat(M.target.value))
716
+ value: I,
717
+ onChange: (M) => E(parseFloat(M.target.value))
718
718
  }
719
719
  ),
720
720
  /* @__PURE__ */ i.jsxs("span", { className: "range-value", children: [
721
- S,
721
+ I,
722
722
  "px"
723
723
  ] })
724
724
  ] }),
@@ -731,12 +731,12 @@ const Ut = {
731
731
  id: "barcode-height",
732
732
  min: "50",
733
733
  max: "200",
734
- value: y,
735
- onChange: (M) => E(parseInt(M.target.value))
734
+ value: m,
735
+ onChange: (M) => B(parseInt(M.target.value))
736
736
  }
737
737
  ),
738
738
  /* @__PURE__ */ i.jsxs("span", { className: "range-value", children: [
739
- y,
739
+ m,
740
740
  "px"
741
741
  ] })
742
742
  ] }),
@@ -749,12 +749,12 @@ const Ut = {
749
749
  id: "barcode-fontsize",
750
750
  min: "10",
751
751
  max: "30",
752
- value: B,
753
- onChange: (M) => b(parseInt(M.target.value))
752
+ value: j,
753
+ onChange: (M) => p(parseInt(M.target.value))
754
754
  }
755
755
  ),
756
756
  /* @__PURE__ */ i.jsxs("span", { className: "range-value", children: [
757
- B,
757
+ j,
758
758
  "px"
759
759
  ] })
760
760
  ] }),
@@ -764,7 +764,7 @@ const Ut = {
764
764
  "select",
765
765
  {
766
766
  id: "text-position",
767
- value: C,
767
+ value: T,
768
768
  onChange: (M) => O(M.target.value),
769
769
  children: [
770
770
  /* @__PURE__ */ i.jsx("option", { value: "bottom", children: "Bottom" }),
@@ -783,9 +783,9 @@ const Ut = {
783
783
  children: "Generate Barcode"
784
784
  }
785
785
  ) }),
786
- d && /* @__PURE__ */ i.jsxs("div", { className: "barcode-preview", children: [
786
+ c && /* @__PURE__ */ i.jsxs("div", { className: "barcode-preview", children: [
787
787
  /* @__PURE__ */ i.jsx("h4", { children: "Preview" }),
788
- /* @__PURE__ */ i.jsx("div", { className: "barcode-preview-container", ref: W, children: d }),
788
+ /* @__PURE__ */ i.jsx("div", { className: "barcode-preview-container", ref: W, children: c }),
789
789
  /* @__PURE__ */ i.jsx(
790
790
  "button",
791
791
  {
@@ -864,88 +864,88 @@ const Ut = {
864
864
  100% { transform: rotate(360deg); }
865
865
  }
866
866
  ` })
867
- ] }), ii = ({ isOpen: f, onClose: o, onAddSticker: a, theme: l, apiKey: s, apiEndpoint: h }) => {
868
- const [x, n] = N([]), [d, j] = N(!1), [S, I] = N(null), [y, E] = N(""), [B, b] = N(""), [F, J] = N({});
867
+ ] }), ii = ({ isOpen: f, onClose: o, onAddSticker: a, theme: l, apiKey: s, apiEndpoint: g }) => {
868
+ const [h, n] = N([]), [c, F] = N(!1), [I, E] = N(null), [m, B] = N(""), [j, p] = N(""), [v, X] = N({});
869
869
  gt(null);
870
- const [C, O] = N(!1), [v, st] = N(!1), [W, xt] = N(!1), Q = `${h}/api/v1/designer`;
871
- ot(() => {
870
+ const [T, O] = N(!1), [k, Z] = N(!1), [W, xt] = N(!1), Q = `${g}/api/v1/designer`;
871
+ rt(() => {
872
872
  f && s && ft();
873
873
  }, [f, s]);
874
874
  const ft = async () => {
875
875
  const P = sessionStorage.getItem("apc_x_sub_status");
876
- P === "active" ? (O(!0), st(!0), at()) : P === "inactive" ? (O(!1), st(!0)) : (xt(!0), await q());
877
- }, q = async () => {
876
+ P === "active" ? (O(!0), Z(!0), st()) : P === "inactive" ? (O(!1), Z(!0)) : (xt(!0), await _());
877
+ }, _ = async () => {
878
878
  if (!s) {
879
- O(!1), st(!0), xt(!1);
879
+ O(!1), Z(!0), xt(!1);
880
880
  return;
881
881
  }
882
882
  const P = `${Q}/get-subscription-status/${s}`;
883
883
  try {
884
- (await oe.get(P)).data.object === "active" ? (sessionStorage.setItem("apc_x_sub_status", "active"), O(!0), at()) : (sessionStorage.setItem("apc_x_sub_status", "inactive"), O(!1));
885
- } catch (T) {
886
- console.error("Subscription check failed:", T), sessionStorage.setItem("apc_x_sub_status", "inactive"), O(!1);
884
+ (await oe.get(P)).data.object === "active" ? (sessionStorage.setItem("apc_x_sub_status", "active"), O(!0), st()) : (sessionStorage.setItem("apc_x_sub_status", "inactive"), O(!1));
885
+ } catch (C) {
886
+ console.error("Subscription check failed:", C), sessionStorage.setItem("apc_x_sub_status", "inactive"), O(!1);
887
887
  } finally {
888
- xt(!1), st(!0);
888
+ xt(!1), Z(!0);
889
889
  }
890
- }, at = async () => {
890
+ }, st = async () => {
891
891
  const P = sessionStorage.getItem("apc_stickers");
892
892
  if (P)
893
893
  try {
894
- const T = JSON.parse(P);
895
- n(T);
894
+ const C = JSON.parse(P);
895
+ n(C);
896
896
  return;
897
897
  } catch {
898
898
  console.warn("Failed to parse cached stickers, fetching fresh data");
899
899
  }
900
- j(!0), I(null);
900
+ F(!0), E(null);
901
901
  try {
902
- const T = await oe.get(`${Q}/get-stickers`);
903
- if (T.data && T.data.object && T.data.object.contents) {
904
- const tt = T.data.object.contents;
905
- n(tt), sessionStorage.setItem("apc_stickers", JSON.stringify(tt));
902
+ const C = await oe.get(`${Q}/get-stickers`);
903
+ if (C.data && C.data.object && C.data.object.contents) {
904
+ const et = C.data.object.contents;
905
+ n(et), sessionStorage.setItem("apc_stickers", JSON.stringify(et));
906
906
  } else
907
907
  throw new Error("Invalid response format");
908
- } catch (T) {
909
- console.error("Error fetching stickers:", T), I("Failed to load stickers. Please try again.");
908
+ } catch (C) {
909
+ console.error("Error fetching stickers:", C), E("Failed to load stickers. Please try again.");
910
910
  } finally {
911
- j(!1);
911
+ F(!1);
912
912
  }
913
- }, M = (P, T) => {
913
+ }, M = (P, C) => {
914
914
  a({
915
915
  type: "sticker",
916
916
  src: P,
917
- name: T,
917
+ name: C,
918
918
  width: 100,
919
919
  height: 100,
920
920
  x: 100,
921
921
  y: 100
922
922
  }), o();
923
923
  }, nt = (P) => {
924
- J((T) => ({
925
- ...T,
926
- [P]: !T[P]
924
+ X((C) => ({
925
+ ...C,
926
+ [P]: !C[P]
927
927
  }));
928
- }, Z = (P) => {
929
- const T = {};
930
- return P.forEach((tt) => {
931
- const u = tt.name.split("/");
932
- let D = T;
933
- u.forEach((L, H) => {
934
- D[L] || (D[L] = H === u.length - 1 ? tt : {}), D = D[L];
928
+ }, tt = (P) => {
929
+ const C = {};
930
+ return P.forEach((et) => {
931
+ const y = et.name.split("/");
932
+ let D = C;
933
+ y.forEach((L, H) => {
934
+ D[L] || (D[L] = H === y.length - 1 ? et : {}), D = D[L];
935
935
  });
936
- }), T;
937
- }, ct = (P, T = "", tt = 0) => /* @__PURE__ */ i.jsx("div", { className: "sticker-tree-level", style: { paddingLeft: `${tt * 15}px` }, children: Object.keys(P).map((u) => {
938
- const D = `${T}/${u}`, L = F[D];
939
- return P[u].type === "image" ? !B || u.toLowerCase().includes(B.toLowerCase()) ? /* @__PURE__ */ i.jsx(
936
+ }), C;
937
+ }, ct = (P, C = "", et = 0) => /* @__PURE__ */ i.jsx("div", { className: "sticker-tree-level", style: { paddingLeft: `${et * 15}px` }, children: Object.keys(P).map((y) => {
938
+ const D = `${C}/${y}`, L = v[D];
939
+ return P[y].type === "image" ? !j || y.toLowerCase().includes(j.toLowerCase()) ? /* @__PURE__ */ i.jsx(
940
940
  "div",
941
941
  {
942
942
  className: "sticker-item",
943
- onClick: () => M(P[u].url, u),
943
+ onClick: () => M(P[y].url, y),
944
944
  children: /* @__PURE__ */ i.jsx("div", { className: "sticker-preview", children: /* @__PURE__ */ i.jsx(
945
945
  "img",
946
946
  {
947
- src: P[u].url,
948
- alt: u,
947
+ src: P[y].url,
948
+ alt: y,
949
949
  loading: "lazy",
950
950
  onError: (G) => {
951
951
  G.target.style.display = "none";
@@ -962,14 +962,14 @@ const Ut = {
962
962
  onClick: () => nt(D),
963
963
  children: [
964
964
  /* @__PURE__ */ i.jsx("span", { className: `expand-icon ${L ? "expanded" : ""}`, children: "▶" }),
965
- /* @__PURE__ */ i.jsx("span", { className: "category-name", children: u })
965
+ /* @__PURE__ */ i.jsx("span", { className: "category-name", children: y })
966
966
  ]
967
967
  }
968
968
  ),
969
- L && ct(P[u], D, tt + 1)
969
+ L && ct(P[y], D, et + 1)
970
970
  ] }, D);
971
- }) }), _ = x.filter(
972
- (P) => !B || P.name.toLowerCase().includes(B.toLowerCase())
971
+ }) }), Y = h.filter(
972
+ (P) => !j || P.name.toLowerCase().includes(j.toLowerCase())
973
973
  );
974
974
  return f ? /* @__PURE__ */ i.jsx("div", { className: "sticker-modal-overlay", onClick: o, children: /* @__PURE__ */ i.jsxs("div", { className: "sticker-modal-content", onClick: (P) => P.stopPropagation(), children: [
975
975
  /* @__PURE__ */ i.jsxs("div", { className: "sticker-modal-header", children: [
@@ -986,24 +986,24 @@ const Ut = {
986
986
  ] }),
987
987
  /* @__PURE__ */ i.jsxs("div", { className: "sticker-modal-body", children: [
988
988
  W && /* @__PURE__ */ i.jsx(le, {}),
989
- !C && !W && v && /* @__PURE__ */ i.jsx(ei, { theme: l }),
990
- C && v && /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
989
+ !T && !W && k && /* @__PURE__ */ i.jsx(ei, { theme: l }),
990
+ T && k && /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
991
991
  /* @__PURE__ */ i.jsx("div", { className: "sticker-modal-controls", children: /* @__PURE__ */ i.jsx("div", { className: "search-container", children: /* @__PURE__ */ i.jsx(
992
992
  "input",
993
993
  {
994
994
  type: "text",
995
995
  placeholder: "Search stickers...",
996
- value: B,
997
- onChange: (P) => b(P.target.value),
996
+ value: j,
997
+ onChange: (P) => p(P.target.value),
998
998
  className: "sticker-search"
999
999
  }
1000
1000
  ) }) }),
1001
- d && /* @__PURE__ */ i.jsx(le, {}),
1002
- S && /* @__PURE__ */ i.jsxs("div", { className: "sticker-error", children: [
1003
- /* @__PURE__ */ i.jsx("p", { children: S }),
1004
- /* @__PURE__ */ i.jsx("button", { onClick: at, children: "Retry" })
1001
+ c && /* @__PURE__ */ i.jsx(le, {}),
1002
+ I && /* @__PURE__ */ i.jsxs("div", { className: "sticker-error", children: [
1003
+ /* @__PURE__ */ i.jsx("p", { children: I }),
1004
+ /* @__PURE__ */ i.jsx("button", { onClick: st, children: "Retry" })
1005
1005
  ] }),
1006
- !d && !S && x.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "sticker-grid", children: ct(Z(_)) })
1006
+ !c && !I && h.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "sticker-grid", children: ct(tt(Y)) })
1007
1007
  ] })
1008
1008
  ] })
1009
1009
  ] }) }) : null;
@@ -2559,33 +2559,33 @@ const Ut = {
2559
2559
  category: "Geometric",
2560
2560
  description: "Complex mandala flower pattern"
2561
2561
  }
2562
- ], ri = ({ isOpen: f, onClose: o, onAddEmbroidery: a, theme: l, apiKey: s, apiEndpoint: h }) => {
2563
- const [x, n] = N([]), [d, j] = N(!1), [S, I] = N(null), [y, E] = N(""), [B, b] = N("All"), F = gt(null), J = ["All", "Floral", "Nature", "Geometric", "Traditional", "Sports", "Hobbies", "Food", "Symbols", "Holiday", "Text"];
2564
- ot(() => {
2562
+ ], ri = ({ isOpen: f, onClose: o, onAddEmbroidery: a, theme: l, apiKey: s, apiEndpoint: g }) => {
2563
+ const [h, n] = N([]), [c, F] = N(!1), [I, E] = N(null), [m, B] = N(""), [j, p] = N("All"), v = gt(null), X = ["All", "Floral", "Nature", "Geometric", "Traditional", "Sports", "Hobbies", "Food", "Symbols", "Holiday", "Text"];
2564
+ rt(() => {
2565
2565
  f && n(oi);
2566
2566
  }, [f]);
2567
- const C = (v) => {
2567
+ const T = (k) => {
2568
2568
  a({
2569
2569
  type: "embroidery",
2570
- src: v.url,
2571
- name: v.name,
2572
- description: v.description,
2573
- category: v.category,
2570
+ src: k.url,
2571
+ name: k.name,
2572
+ description: k.description,
2573
+ category: k.category,
2574
2574
  width: 120,
2575
2575
  height: 120,
2576
2576
  x: 100,
2577
2577
  y: 100
2578
2578
  }), o();
2579
- }, O = x.filter((v) => {
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;
2579
+ }, O = h.filter((k) => {
2580
+ const Z = !m || k.name.toLowerCase().includes(m.toLowerCase()) || k.description.toLowerCase().includes(m.toLowerCase()), W = j === "All" || k.category === j;
2581
+ return Z && W;
2582
2582
  });
2583
2583
  return f ? /* @__PURE__ */ i.jsx("div", { className: "embroidery-modal-overlay", onClick: o, children: /* @__PURE__ */ i.jsxs(
2584
2584
  "div",
2585
2585
  {
2586
2586
  className: "embroidery-modal-content",
2587
- onClick: (v) => v.stopPropagation(),
2588
- ref: F,
2587
+ onClick: (k) => k.stopPropagation(),
2588
+ ref: v,
2589
2589
  children: [
2590
2590
  /* @__PURE__ */ i.jsxs("div", { className: "embroidery-modal-header", children: [
2591
2591
  /* @__PURE__ */ i.jsx("h3", { children: "Choose an Embroidery Design" }),
@@ -2605,8 +2605,8 @@ const Ut = {
2605
2605
  {
2606
2606
  type: "text",
2607
2607
  placeholder: "Search embroidery designs...",
2608
- value: y,
2609
- onChange: (v) => E(v.target.value),
2608
+ value: m,
2609
+ onChange: (k) => B(k.target.value),
2610
2610
  className: "embroidery-search"
2611
2611
  }
2612
2612
  ) }),
@@ -2615,47 +2615,47 @@ const Ut = {
2615
2615
  /* @__PURE__ */ i.jsx(
2616
2616
  "select",
2617
2617
  {
2618
- value: B,
2619
- onChange: (v) => b(v.target.value),
2618
+ value: j,
2619
+ onChange: (k) => p(k.target.value),
2620
2620
  className: "category-select",
2621
- children: J.map((v) => /* @__PURE__ */ i.jsx("option", { value: v, children: v }, v))
2621
+ children: X.map((k) => /* @__PURE__ */ i.jsx("option", { value: k, children: k }, k))
2622
2622
  }
2623
2623
  )
2624
2624
  ] })
2625
2625
  ] }),
2626
2626
  /* @__PURE__ */ i.jsxs("div", { className: "embroidery-modal-body", children: [
2627
- d && /* @__PURE__ */ i.jsxs("div", { className: "embroidery-loading", children: [
2627
+ c && /* @__PURE__ */ i.jsxs("div", { className: "embroidery-loading", children: [
2628
2628
  /* @__PURE__ */ i.jsx("div", { className: "loading-spinner" }),
2629
2629
  /* @__PURE__ */ i.jsx("p", { children: "Loading embroidery designs..." })
2630
2630
  ] }),
2631
- S && /* @__PURE__ */ i.jsx("div", { className: "embroidery-error", children: /* @__PURE__ */ i.jsx("p", { children: S }) }),
2632
- !d && !S && /* @__PURE__ */ i.jsx("div", { className: "embroidery-grid", children: O.map((v) => /* @__PURE__ */ i.jsxs(
2631
+ I && /* @__PURE__ */ i.jsx("div", { className: "embroidery-error", children: /* @__PURE__ */ i.jsx("p", { children: I }) }),
2632
+ !c && !I && /* @__PURE__ */ i.jsx("div", { className: "embroidery-grid", children: O.map((k) => /* @__PURE__ */ i.jsxs(
2633
2633
  "div",
2634
2634
  {
2635
2635
  className: "embroidery-item",
2636
- onClick: () => C(v),
2637
- title: v.description,
2636
+ onClick: () => T(k),
2637
+ title: k.description,
2638
2638
  children: [
2639
2639
  /* @__PURE__ */ i.jsx("div", { className: "embroidery-preview", children: /* @__PURE__ */ i.jsx(
2640
2640
  "img",
2641
2641
  {
2642
- src: v.url,
2643
- alt: v.name,
2642
+ src: k.url,
2643
+ alt: k.name,
2644
2644
  loading: "lazy",
2645
- onError: (st) => {
2646
- console.error("Failed to load embroidery image:", v.url), st.target.style.display = "none";
2645
+ onError: (Z) => {
2646
+ console.error("Failed to load embroidery image:", k.url), Z.target.style.display = "none";
2647
2647
  }
2648
2648
  }
2649
2649
  ) }),
2650
2650
  /* @__PURE__ */ i.jsxs("div", { className: "embroidery-info", children: [
2651
- /* @__PURE__ */ i.jsx("div", { className: "embroidery-name", children: v.name }),
2652
- /* @__PURE__ */ i.jsx("div", { className: "embroidery-category", children: v.category })
2651
+ /* @__PURE__ */ i.jsx("div", { className: "embroidery-name", children: k.name }),
2652
+ /* @__PURE__ */ i.jsx("div", { className: "embroidery-category", children: k.category })
2653
2653
  ] })
2654
2654
  ]
2655
2655
  },
2656
- v.id
2656
+ k.id
2657
2657
  )) }),
2658
- !d && !S && O.length === 0 && /* @__PURE__ */ i.jsx("div", { className: "no-embroideries", children: /* @__PURE__ */ i.jsx("p", { children: "No embroidery designs found matching your search." }) })
2658
+ !c && !I && O.length === 0 && /* @__PURE__ */ i.jsx("div", { className: "no-embroideries", children: /* @__PURE__ */ i.jsx("p", { children: "No embroidery designs found matching your search." }) })
2659
2659
  ] }),
2660
2660
  /* @__PURE__ */ i.jsx("div", { className: "embroidery-modal-footer", children: /* @__PURE__ */ i.jsxs("div", { className: "embroidery-disclaimer", children: [
2661
2661
  /* @__PURE__ */ i.jsx("span", { className: "disclaimer-icon", children: "ℹ️" }),
@@ -2664,7 +2664,7 @@ const Ut = {
2664
2664
  ]
2665
2665
  }
2666
2666
  ) }) : null;
2667
- }, jt = [
2667
+ }, Nt = [
2668
2668
  // MOTIVATIONAL & INSPIRATIONAL (25 items)
2669
2669
  {
2670
2670
  id: 1,
@@ -4602,23 +4602,23 @@ const Ut = {
4602
4602
  textAlign: "center"
4603
4603
  }
4604
4604
  ], ai = ({ isOpen: f, onClose: o, onAddText: a, theme: l }) => {
4605
- const [s, h] = N(""), [x, n] = N("All"), d = ie(() => {
4606
- const y = jt.reduce((E, B) => (E[B.category] = (E[B.category] || 0) + 1, E), {});
4605
+ const [s, g] = N(""), [h, n] = N("All"), c = ie(() => {
4606
+ const m = Nt.reduce((B, j) => (B[j.category] = (B[j.category] || 0) + 1, B), {});
4607
4607
  return [
4608
- { name: "All", count: jt.length },
4609
- ...Object.entries(y).map(([E, B]) => ({ name: E, count: B }))
4608
+ { name: "All", count: Nt.length },
4609
+ ...Object.entries(m).map(([B, j]) => ({ name: B, count: j }))
4610
4610
  ];
4611
- }, [jt]), j = ie(() => jt.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
- }), [jt, s, x]), S = (y) => {
4615
- const E = {
4616
- ...y,
4611
+ }, [Nt]), F = ie(() => Nt.filter((m) => {
4612
+ const B = !s || m.text.toLowerCase().includes(s.toLowerCase()) || m.category.toLowerCase().includes(s.toLowerCase()), j = h === "All" || m.category === h;
4613
+ return B && j;
4614
+ }), [Nt, s, h]), I = (m) => {
4615
+ const B = {
4616
+ ...m,
4617
4617
  x: 100,
4618
4618
  y: 100
4619
4619
  };
4620
- a("text", E), o();
4621
- }, I = () => {
4620
+ a("text", B), o();
4621
+ }, E = () => {
4622
4622
  a("text", {
4623
4623
  text: "Your Text Here",
4624
4624
  fontSize: 24,
@@ -4628,7 +4628,7 @@ const Ut = {
4628
4628
  y: 100
4629
4629
  }), o();
4630
4630
  };
4631
- return f ? /* @__PURE__ */ i.jsx("div", { className: "text-templates-modal-overlay", onClick: o, children: /* @__PURE__ */ i.jsxs("div", { className: "text-templates-modal", onClick: (y) => y.stopPropagation(), children: [
4631
+ return f ? /* @__PURE__ */ i.jsx("div", { className: "text-templates-modal-overlay", onClick: o, children: /* @__PURE__ */ i.jsxs("div", { className: "text-templates-modal", onClick: (m) => m.stopPropagation(), children: [
4632
4632
  /* @__PURE__ */ i.jsxs("div", { className: "modal-header", children: [
4633
4633
  /* @__PURE__ */ i.jsx("h2", { children: "Text Templates" }),
4634
4634
  /* @__PURE__ */ i.jsx("button", { className: "close-btn", onClick: o, "aria-label": "Close", children: "×" })
@@ -4640,70 +4640,70 @@ const Ut = {
4640
4640
  type: "text",
4641
4641
  placeholder: "Search templates...",
4642
4642
  value: s,
4643
- onChange: (y) => h(y.target.value),
4643
+ onChange: (m) => g(m.target.value),
4644
4644
  className: "search-input"
4645
4645
  }
4646
4646
  ) }),
4647
- /* @__PURE__ */ i.jsx("div", { className: "category-tabs", children: d.map((y) => /* @__PURE__ */ i.jsxs(
4647
+ /* @__PURE__ */ i.jsx("div", { className: "category-tabs", children: c.map((m) => /* @__PURE__ */ i.jsxs(
4648
4648
  "button",
4649
4649
  {
4650
- className: `category-tab ${x === y.name ? "active" : ""}`,
4651
- onClick: () => n(y.name),
4650
+ className: `category-tab ${h === m.name ? "active" : ""}`,
4651
+ onClick: () => n(m.name),
4652
4652
  children: [
4653
- y.name,
4653
+ m.name,
4654
4654
  /* @__PURE__ */ i.jsxs("span", { className: "count", children: [
4655
4655
  "(",
4656
- y.count,
4656
+ m.count,
4657
4657
  ")"
4658
4658
  ] })
4659
4659
  ]
4660
4660
  },
4661
- y.name
4661
+ m.name
4662
4662
  )) })
4663
4663
  ] }),
4664
4664
  /* @__PURE__ */ i.jsxs("div", { className: "templates-grid", children: [
4665
- /* @__PURE__ */ i.jsx("div", { className: "custom-text-option", onClick: I, children: /* @__PURE__ */ i.jsxs("div", { className: "custom-text-preview", children: [
4665
+ /* @__PURE__ */ i.jsx("div", { className: "custom-text-option", onClick: E, children: /* @__PURE__ */ i.jsxs("div", { className: "custom-text-preview", children: [
4666
4666
  /* @__PURE__ */ i.jsx("div", { className: "custom-icon", children: "✏️" }),
4667
4667
  /* @__PURE__ */ i.jsx("div", { className: "custom-label", children: "Create Custom Text" })
4668
4668
  ] }) }),
4669
- j.map((y) => /* @__PURE__ */ i.jsxs(
4669
+ F.map((m) => /* @__PURE__ */ i.jsxs(
4670
4670
  "div",
4671
4671
  {
4672
4672
  className: "template-item",
4673
- onClick: () => S(y),
4673
+ onClick: () => I(m),
4674
4674
  children: [
4675
4675
  /* @__PURE__ */ i.jsx(
4676
4676
  "div",
4677
4677
  {
4678
4678
  className: "template-preview",
4679
4679
  style: {
4680
- fontFamily: y.fontFamily,
4681
- fontSize: `${Math.min(y.fontSize * 0.6, 18)}px`,
4682
- fontWeight: y.fontWeight,
4683
- fontStyle: y.fontStyle,
4684
- color: y.fill,
4685
- backgroundColor: y.hasBackground ? y.backgroundColor : "transparent",
4686
- textAlign: y.textAlign || "left",
4687
- textTransform: y.textTransform || "none",
4688
- letterSpacing: y.letterSpacing ? `${y.letterSpacing}px` : "normal",
4689
- textShadow: y.hasTextShadow ? `${y.textShadowX}px ${y.textShadowY}px ${y.textShadowBlur}px ${y.textShadowColor}` : "none"
4680
+ fontFamily: m.fontFamily,
4681
+ fontSize: `${Math.min(m.fontSize * 0.6, 18)}px`,
4682
+ fontWeight: m.fontWeight,
4683
+ fontStyle: m.fontStyle,
4684
+ color: m.fill,
4685
+ backgroundColor: m.hasBackground ? m.backgroundColor : "transparent",
4686
+ textAlign: m.textAlign || "left",
4687
+ textTransform: m.textTransform || "none",
4688
+ letterSpacing: m.letterSpacing ? `${m.letterSpacing}px` : "normal",
4689
+ textShadow: m.hasTextShadow ? `${m.textShadowX}px ${m.textShadowY}px ${m.textShadowBlur}px ${m.textShadowColor}` : "none"
4690
4690
  },
4691
- children: y.text
4691
+ children: m.text
4692
4692
  }
4693
4693
  ),
4694
4694
  /* @__PURE__ */ i.jsxs("div", { className: "template-info", children: [
4695
- /* @__PURE__ */ i.jsx("span", { className: "template-category", children: y.category }),
4696
- /* @__PURE__ */ i.jsx("span", { className: "template-font", children: y.fontFamily })
4695
+ /* @__PURE__ */ i.jsx("span", { className: "template-category", children: m.category }),
4696
+ /* @__PURE__ */ i.jsx("span", { className: "template-font", children: m.fontFamily })
4697
4697
  ] })
4698
4698
  ]
4699
4699
  },
4700
- y.id
4700
+ m.id
4701
4701
  ))
4702
4702
  ] }),
4703
4703
  /* @__PURE__ */ i.jsx("div", { className: "modal-footer", children: /* @__PURE__ */ i.jsxs("div", { className: "results-count", children: [
4704
- j.length,
4704
+ F.length,
4705
4705
  " template",
4706
- j.length !== 1 ? "s" : "",
4706
+ F.length !== 1 ? "s" : "",
4707
4707
  " found"
4708
4708
  ] }) })
4709
4709
  ] }) }) : null;
@@ -4713,25 +4713,25 @@ const Ut = {
4713
4713
  onDuplicateElement: a,
4714
4714
  onUndo: l,
4715
4715
  onRedo: s,
4716
- onToggleGrid: h,
4717
- onToggleRulers: x,
4716
+ onToggleGrid: g,
4717
+ onToggleRulers: h,
4718
4718
  onToggleSnap: n,
4719
- onImageUpload: d,
4720
- canUndo: j,
4721
- canRedo: S,
4722
- showGrid: I,
4723
- showRulers: y,
4724
- snapToGrid: E,
4725
- selectedElement: B,
4726
- theme: b,
4727
- readOnly: F,
4728
- apiKey: J,
4729
- apiEndpoint: C
4719
+ onImageUpload: c,
4720
+ canUndo: F,
4721
+ canRedo: I,
4722
+ showGrid: E,
4723
+ showRulers: m,
4724
+ snapToGrid: B,
4725
+ selectedElement: j,
4726
+ theme: p,
4727
+ readOnly: v,
4728
+ apiKey: X,
4729
+ apiEndpoint: T
4730
4730
  }) => {
4731
- const [O, v] = N(!1), [st, W] = N(!1), [xt, Q] = N(!1), [ft, q] = N(!1), [at, M] = N(!1), [nt, Z] = N(!1), [ct, _] = N(!1), P = (U) => {
4731
+ const [O, k] = N(!1), [Z, W] = N(!1), [xt, Q] = N(!1), [ft, _] = N(!1), [st, M] = N(!1), [nt, tt] = N(!1), [ct, Y] = N(!1), P = (U) => {
4732
4732
  const K = U.target.files[0];
4733
- K && K.type.startsWith("image/") && d(K), U.target.value = "";
4734
- }, T = (U) => {
4733
+ K && K.type.startsWith("image/") && c(K), U.target.value = "";
4734
+ }, C = (U) => {
4735
4735
  f("icon", {
4736
4736
  iconData: U,
4737
4737
  text: U.symbol,
@@ -4739,9 +4739,9 @@ const Ut = {
4739
4739
  fontFamily: "Arial",
4740
4740
  fill: "#000000"
4741
4741
  });
4742
- }, tt = (U) => {
4742
+ }, et = (U) => {
4743
4743
  f("qrcode", U);
4744
- }, u = (U) => {
4744
+ }, y = (U) => {
4745
4745
  f("barcode", U);
4746
4746
  }, D = (U) => {
4747
4747
  f("sticker", U);
@@ -4750,13 +4750,13 @@ const Ut = {
4750
4750
  }, H = (U, K) => {
4751
4751
  f(U, K);
4752
4752
  }, G = () => {
4753
- Z(!nt), _(!1);
4754
- }, et = () => {
4755
- _(!ct), Z(!1);
4756
- }, X = (U) => {
4757
- U === "custom" ? f("text") : U === "templates" && M(!0), Z(!1);
4758
- }, Y = (U) => {
4759
- f(U), _(!1);
4753
+ tt(!nt), Y(!1);
4754
+ }, it = () => {
4755
+ Y(!ct), tt(!1);
4756
+ }, J = (U) => {
4757
+ U === "custom" ? f("text") : U === "templates" && M(!0), tt(!1);
4758
+ }, q = (U) => {
4759
+ f(U), Y(!1);
4760
4760
  };
4761
4761
  return /* @__PURE__ */ i.jsxs("div", { className: "toolbar", children: [
4762
4762
  /* @__PURE__ */ i.jsxs("div", { className: "toolbar-section", children: [
@@ -4766,7 +4766,7 @@ const Ut = {
4766
4766
  {
4767
4767
  className: "toolbar-btn compact",
4768
4768
  onClick: l,
4769
- disabled: !j || F,
4769
+ disabled: !F || v,
4770
4770
  title: "Undo (Ctrl+Z)",
4771
4771
  children: [
4772
4772
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "↶" }),
@@ -4779,7 +4779,7 @@ const Ut = {
4779
4779
  {
4780
4780
  className: "toolbar-btn compact",
4781
4781
  onClick: s,
4782
- disabled: !S || F,
4782
+ disabled: !I || v,
4783
4783
  title: "Redo (Ctrl+Y)",
4784
4784
  children: [
4785
4785
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "↷" }),
@@ -4795,7 +4795,7 @@ const Ut = {
4795
4795
  "button",
4796
4796
  {
4797
4797
  className: "toolbar-btn compact dropdown-trigger",
4798
- disabled: F,
4798
+ disabled: v,
4799
4799
  title: "Add Text",
4800
4800
  onClick: G,
4801
4801
  children: [
@@ -4806,11 +4806,11 @@ const Ut = {
4806
4806
  }
4807
4807
  ),
4808
4808
  /* @__PURE__ */ i.jsxs("div", { className: `dropdown-menu ${nt ? "show" : ""}`, children: [
4809
- /* @__PURE__ */ i.jsxs("button", { onClick: () => X("custom"), children: [
4809
+ /* @__PURE__ */ i.jsxs("button", { onClick: () => J("custom"), children: [
4810
4810
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "𝐓" }),
4811
4811
  " Custom Text"
4812
4812
  ] }),
4813
- /* @__PURE__ */ i.jsxs("button", { onClick: () => X("templates"), children: [
4813
+ /* @__PURE__ */ i.jsxs("button", { onClick: () => J("templates"), children: [
4814
4814
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "📝" }),
4815
4815
  " Text Templates"
4816
4816
  ] })
@@ -4821,8 +4821,8 @@ const Ut = {
4821
4821
  "button",
4822
4822
  {
4823
4823
  className: "toolbar-btn compact dropdown-trigger",
4824
- disabled: F,
4825
- onClick: et,
4824
+ disabled: v,
4825
+ onClick: it,
4826
4826
  children: [
4827
4827
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "◩" }),
4828
4828
  /* @__PURE__ */ i.jsx("span", { className: "label", children: "Shapes" }),
@@ -4831,58 +4831,58 @@ const Ut = {
4831
4831
  }
4832
4832
  ),
4833
4833
  /* @__PURE__ */ i.jsxs("div", { className: `dropdown-menu ${ct ? "show" : ""}`, children: [
4834
- /* @__PURE__ */ i.jsxs("button", { onClick: () => Y("rectangle"), children: [
4834
+ /* @__PURE__ */ i.jsxs("button", { onClick: () => q("rectangle"), children: [
4835
4835
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "▭" }),
4836
4836
  " Rectangle"
4837
4837
  ] }),
4838
- /* @__PURE__ */ i.jsxs("button", { onClick: () => Y("circle"), children: [
4838
+ /* @__PURE__ */ i.jsxs("button", { onClick: () => q("circle"), children: [
4839
4839
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "●" }),
4840
4840
  " Circle"
4841
4841
  ] }),
4842
- /* @__PURE__ */ i.jsxs("button", { onClick: () => Y("triangle"), children: [
4842
+ /* @__PURE__ */ i.jsxs("button", { onClick: () => q("triangle"), children: [
4843
4843
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "▲" }),
4844
4844
  " Triangle"
4845
4845
  ] }),
4846
- /* @__PURE__ */ i.jsxs("button", { onClick: () => Y("star"), children: [
4846
+ /* @__PURE__ */ i.jsxs("button", { onClick: () => q("star"), children: [
4847
4847
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "★" }),
4848
4848
  " Star"
4849
4849
  ] }),
4850
- /* @__PURE__ */ i.jsxs("button", { onClick: () => Y("heart"), children: [
4850
+ /* @__PURE__ */ i.jsxs("button", { onClick: () => q("heart"), children: [
4851
4851
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "♥" }),
4852
4852
  " Heart"
4853
4853
  ] }),
4854
- /* @__PURE__ */ i.jsxs("button", { onClick: () => Y("arrow"), children: [
4854
+ /* @__PURE__ */ i.jsxs("button", { onClick: () => q("arrow"), children: [
4855
4855
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "➤" }),
4856
4856
  " Arrow"
4857
4857
  ] }),
4858
- /* @__PURE__ */ i.jsxs("button", { onClick: () => Y("diamond"), children: [
4858
+ /* @__PURE__ */ i.jsxs("button", { onClick: () => q("diamond"), children: [
4859
4859
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "◆" }),
4860
4860
  " Diamond"
4861
4861
  ] }),
4862
- /* @__PURE__ */ i.jsxs("button", { onClick: () => Y("hexagon"), children: [
4862
+ /* @__PURE__ */ i.jsxs("button", { onClick: () => q("hexagon"), children: [
4863
4863
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "⬡" }),
4864
4864
  " Hexagon"
4865
4865
  ] }),
4866
- /* @__PURE__ */ i.jsxs("button", { onClick: () => Y("pentagon"), children: [
4866
+ /* @__PURE__ */ i.jsxs("button", { onClick: () => q("pentagon"), children: [
4867
4867
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "⬟" }),
4868
4868
  " Pentagon"
4869
4869
  ] }),
4870
- /* @__PURE__ */ i.jsxs("button", { onClick: () => Y("oval"), children: [
4870
+ /* @__PURE__ */ i.jsxs("button", { onClick: () => q("oval"), children: [
4871
4871
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "⬯" }),
4872
4872
  " Oval"
4873
4873
  ] }),
4874
- /* @__PURE__ */ i.jsxs("button", { onClick: () => Y("roundedRectangle"), children: [
4874
+ /* @__PURE__ */ i.jsxs("button", { onClick: () => q("roundedRectangle"), children: [
4875
4875
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "▢" }),
4876
4876
  " Rounded Rectangle"
4877
4877
  ] }),
4878
- /* @__PURE__ */ i.jsxs("button", { onClick: () => Y("horizontalLine"), children: [
4878
+ /* @__PURE__ */ i.jsxs("button", { onClick: () => q("horizontalLine"), children: [
4879
4879
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "―" }),
4880
4880
  " Horizontal Line"
4881
4881
  ] })
4882
4882
  ] })
4883
4883
  ] }),
4884
4884
  /* @__PURE__ */ i.jsx("div", { className: "toolbar-separator" }),
4885
- /* @__PURE__ */ i.jsxs("label", { className: "toolbar-btn compact file-upload", style: { cursor: F ? "not-allowed" : "pointer" }, children: [
4885
+ /* @__PURE__ */ i.jsxs("label", { className: "toolbar-btn compact file-upload", style: { cursor: v ? "not-allowed" : "pointer" }, children: [
4886
4886
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "☁️" }),
4887
4887
  /* @__PURE__ */ i.jsx("span", { className: "label", children: "Upload" }),
4888
4888
  /* @__PURE__ */ i.jsx(
@@ -4891,18 +4891,18 @@ const Ut = {
4891
4891
  type: "file",
4892
4892
  accept: "image/*",
4893
4893
  onChange: P,
4894
- disabled: F
4894
+ disabled: v
4895
4895
  }
4896
4896
  )
4897
4897
  ] }),
4898
4898
  /* @__PURE__ */ i.jsx("div", { className: "toolbar-separator" }),
4899
- /* @__PURE__ */ i.jsx(Ke, { onSelectIcon: T, theme: b, disabled: F }),
4899
+ /* @__PURE__ */ i.jsx(Ke, { onSelectIcon: C, theme: p, disabled: v }),
4900
4900
  /* @__PURE__ */ i.jsxs(
4901
4901
  "button",
4902
4902
  {
4903
4903
  className: "toolbar-btn compact",
4904
4904
  onClick: () => Q(!0),
4905
- disabled: F,
4905
+ disabled: v,
4906
4906
  title: "Add Sticker",
4907
4907
  children: [
4908
4908
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "🎨" }),
@@ -4915,8 +4915,8 @@ const Ut = {
4915
4915
  "button",
4916
4916
  {
4917
4917
  className: "toolbar-btn compact",
4918
- onClick: () => v(!0),
4919
- disabled: F,
4918
+ onClick: () => k(!0),
4919
+ disabled: v,
4920
4920
  title: "Add QR Code",
4921
4921
  children: [
4922
4922
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "▦" }),
@@ -4929,7 +4929,7 @@ const Ut = {
4929
4929
  {
4930
4930
  className: "toolbar-btn compact",
4931
4931
  onClick: () => W(!0),
4932
- disabled: F,
4932
+ disabled: v,
4933
4933
  title: "Add Barcode",
4934
4934
  children: [
4935
4935
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "▤" }),
@@ -4943,8 +4943,8 @@ const Ut = {
4943
4943
  "button",
4944
4944
  {
4945
4945
  className: "toolbar-btn compact",
4946
- onClick: () => q(!0),
4947
- disabled: F,
4946
+ onClick: () => _(!0),
4947
+ disabled: v,
4948
4948
  title: "Add Embroidery Design",
4949
4949
  children: [
4950
4950
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "🧵" }),
@@ -4952,7 +4952,7 @@ const Ut = {
4952
4952
  ]
4953
4953
  }
4954
4954
  ) }),
4955
- B && /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
4955
+ j && /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
4956
4956
  /* @__PURE__ */ i.jsx("div", { className: "toolbar-separator" }),
4957
4957
  /* @__PURE__ */ i.jsxs("div", { className: "toolbar-group", children: [
4958
4958
  /* @__PURE__ */ i.jsxs(
@@ -4960,7 +4960,7 @@ const Ut = {
4960
4960
  {
4961
4961
  className: "toolbar-btn compact success",
4962
4962
  onClick: a,
4963
- disabled: F,
4963
+ disabled: v,
4964
4964
  title: "Duplicate Element (Ctrl+D)",
4965
4965
  children: [
4966
4966
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "⧉" }),
@@ -4973,7 +4973,7 @@ const Ut = {
4973
4973
  {
4974
4974
  className: "toolbar-btn compact danger",
4975
4975
  onClick: o,
4976
- disabled: F,
4976
+ disabled: v,
4977
4977
  title: "Delete Element (Delete)",
4978
4978
  children: [
4979
4979
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "🗑️" }),
@@ -4988,8 +4988,8 @@ const Ut = {
4988
4988
  /* @__PURE__ */ i.jsxs(
4989
4989
  "button",
4990
4990
  {
4991
- className: `toolbar-btn compact ${I ? "active" : ""}`,
4992
- onClick: h,
4991
+ className: `toolbar-btn compact ${E ? "active" : ""}`,
4992
+ onClick: g,
4993
4993
  title: "Toggle Grid",
4994
4994
  children: [
4995
4995
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "⚏" }),
@@ -5000,8 +5000,8 @@ const Ut = {
5000
5000
  /* @__PURE__ */ i.jsxs(
5001
5001
  "button",
5002
5002
  {
5003
- className: `toolbar-btn compact ${y ? "active" : ""}`,
5004
- onClick: x,
5003
+ className: `toolbar-btn compact ${m ? "active" : ""}`,
5004
+ onClick: h,
5005
5005
  title: "Toggle Rulers",
5006
5006
  children: [
5007
5007
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "📐" }),
@@ -5012,7 +5012,7 @@ const Ut = {
5012
5012
  /* @__PURE__ */ i.jsxs(
5013
5013
  "button",
5014
5014
  {
5015
- className: `toolbar-btn compact ${E ? "active" : ""}`,
5015
+ className: `toolbar-btn compact ${B ? "active" : ""}`,
5016
5016
  onClick: n,
5017
5017
  title: "Snap to Grid",
5018
5018
  children: [
@@ -5027,18 +5027,18 @@ const Ut = {
5027
5027
  Ze,
5028
5028
  {
5029
5029
  isOpen: O,
5030
- onClose: () => v(!1),
5031
- onAddQRCode: tt,
5032
- theme: b
5030
+ onClose: () => k(!1),
5031
+ onAddQRCode: et,
5032
+ theme: p
5033
5033
  }
5034
5034
  ),
5035
5035
  /* @__PURE__ */ i.jsx(
5036
5036
  ti,
5037
5037
  {
5038
- isOpen: st,
5038
+ isOpen: Z,
5039
5039
  onClose: () => W(!1),
5040
- onAddBarcode: u,
5041
- theme: b
5040
+ onAddBarcode: y,
5041
+ theme: p
5042
5042
  }
5043
5043
  ),
5044
5044
  /* @__PURE__ */ i.jsx(
@@ -5047,29 +5047,29 @@ const Ut = {
5047
5047
  isOpen: xt,
5048
5048
  onClose: () => Q(!1),
5049
5049
  onAddSticker: D,
5050
- theme: b,
5051
- apiKey: J,
5052
- apiEndpoint: C
5050
+ theme: p,
5051
+ apiKey: X,
5052
+ apiEndpoint: T
5053
5053
  }
5054
5054
  ),
5055
5055
  /* @__PURE__ */ i.jsx(
5056
5056
  ri,
5057
5057
  {
5058
5058
  isOpen: ft,
5059
- onClose: () => q(!1),
5059
+ onClose: () => _(!1),
5060
5060
  onAddEmbroidery: L,
5061
- theme: b,
5062
- apiKey: J,
5063
- apiEndpoint: C
5061
+ theme: p,
5062
+ apiKey: X,
5063
+ apiEndpoint: T
5064
5064
  }
5065
5065
  ),
5066
5066
  /* @__PURE__ */ i.jsx(
5067
5067
  ai,
5068
5068
  {
5069
- isOpen: at,
5069
+ isOpen: st,
5070
5070
  onClose: () => M(!1),
5071
5071
  onAddText: H,
5072
- theme: b
5072
+ theme: p
5073
5073
  }
5074
5074
  )
5075
5075
  ] });
@@ -5080,16 +5080,16 @@ const Ut = {
5080
5080
  availableFonts: l,
5081
5081
  theme: s
5082
5082
  }) => {
5083
- const [h, x] = N(!1);
5083
+ const [g, h] = N(!1);
5084
5084
  if (!f)
5085
5085
  return /* @__PURE__ */ i.jsxs("div", { className: "properties-panel", children: [
5086
5086
  /* @__PURE__ */ i.jsx("h3", { children: "Properties" }),
5087
5087
  /* @__PURE__ */ i.jsx("p", { className: "no-selection", children: "Select an element to edit its properties" })
5088
5088
  ] });
5089
- const n = (b, F) => {
5090
- o(f.id, { [b]: F });
5091
- }, d = () => {
5092
- var b, F, J;
5089
+ const n = (p, v) => {
5090
+ o(f.id, { [p]: v });
5091
+ }, c = () => {
5092
+ var p, v, X;
5093
5093
  return /* @__PURE__ */ i.jsxs("div", { className: "property-group", children: [
5094
5094
  /* @__PURE__ */ i.jsx("h4", { children: "Text Content" }),
5095
5095
  /* @__PURE__ */ i.jsxs("div", { className: "property-row", children: [
@@ -5098,7 +5098,7 @@ const Ut = {
5098
5098
  "textarea",
5099
5099
  {
5100
5100
  value: f.text || "",
5101
- onChange: (C) => n("text", C.target.value),
5101
+ onChange: (T) => n("text", T.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: (C) => n("fontFamily", C.target.value),
5114
- children: l.map((C) => /* @__PURE__ */ i.jsx("option", { value: C, children: C }, C))
5113
+ onChange: (T) => n("fontFamily", T.target.value),
5114
+ children: l.map((T) => /* @__PURE__ */ i.jsx("option", { value: T, children: T }, T))
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: (C) => n("fontSize", parseInt(C.target.value)),
5126
+ onChange: (T) => n("fontSize", parseInt(T.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: (C) => n("lineHeight", parseFloat(C.target.value)),
5140
+ onChange: (T) => n("lineHeight", parseFloat(T.target.value)),
5141
5141
  min: "0.5",
5142
5142
  max: "3"
5143
5143
  }
@@ -5191,10 +5191,10 @@ const Ut = {
5191
5191
  /* @__PURE__ */ i.jsx(
5192
5192
  "button",
5193
5193
  {
5194
- className: (b = f.textDecoration) != null && b.includes("underline") ? "active" : "",
5194
+ className: (p = f.textDecoration) != null && p.includes("underline") ? "active" : "",
5195
5195
  onClick: () => {
5196
- const C = f.textDecoration || "", O = C.split(" ").filter((v) => v && v !== "underline");
5197
- C.includes("underline") || O.push("underline"), n("textDecoration", O.join(" ").trim());
5196
+ const T = f.textDecoration || "", O = T.split(" ").filter((k) => k && k !== "underline");
5197
+ T.includes("underline") || O.push("underline"), n("textDecoration", O.join(" ").trim());
5198
5198
  },
5199
5199
  title: "Underline",
5200
5200
  children: /* @__PURE__ */ i.jsx("u", { children: "U" })
@@ -5203,10 +5203,10 @@ const Ut = {
5203
5203
  /* @__PURE__ */ i.jsx(
5204
5204
  "button",
5205
5205
  {
5206
- className: (F = f.textDecoration) != null && F.includes("overline") ? "active" : "",
5206
+ className: (v = f.textDecoration) != null && v.includes("overline") ? "active" : "",
5207
5207
  onClick: () => {
5208
- const C = f.textDecoration || "", O = C.split(" ").filter((v) => v && v !== "overline");
5209
- C.includes("overline") || O.push("overline"), n("textDecoration", O.join(" ").trim());
5208
+ const T = f.textDecoration || "", O = T.split(" ").filter((k) => k && k !== "overline");
5209
+ T.includes("overline") || O.push("overline"), n("textDecoration", O.join(" ").trim());
5210
5210
  },
5211
5211
  title: "Overline",
5212
5212
  children: /* @__PURE__ */ i.jsx("span", { style: { textDecoration: "overline" }, children: "O" })
@@ -5215,10 +5215,10 @@ const Ut = {
5215
5215
  /* @__PURE__ */ i.jsx(
5216
5216
  "button",
5217
5217
  {
5218
- className: (J = f.textDecoration) != null && J.includes("line-through") ? "active" : "",
5218
+ className: (X = f.textDecoration) != null && X.includes("line-through") ? "active" : "",
5219
5219
  onClick: () => {
5220
- const C = f.textDecoration || "", O = C.split(" ").filter((v) => v && v !== "line-through");
5221
- C.includes("line-through") || O.push("line-through"), n("textDecoration", O.join(" ").trim());
5220
+ const T = f.textDecoration || "", O = T.split(" ").filter((k) => k && k !== "line-through");
5221
+ T.includes("line-through") || O.push("line-through"), n("textDecoration", O.join(" ").trim());
5222
5222
  },
5223
5223
  title: "Strikethrough",
5224
5224
  children: /* @__PURE__ */ i.jsx("s", { children: "S" })
@@ -5316,7 +5316,7 @@ const Ut = {
5316
5316
  {
5317
5317
  type: "color",
5318
5318
  value: f.fill || "#000000",
5319
- onChange: (C) => n("fill", C.target.value)
5319
+ onChange: (T) => n("fill", T.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: (C) => n("backgroundColor", C.target.value),
5331
+ onChange: (T) => n("backgroundColor", T.target.value),
5332
5332
  disabled: !f.hasBackground
5333
5333
  }
5334
5334
  ),
@@ -5344,7 +5344,7 @@ const Ut = {
5344
5344
  ] })
5345
5345
  ] })
5346
5346
  ] }) }),
5347
- h && /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
5347
+ g && /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
5348
5348
  /* @__PURE__ */ i.jsxs("div", { className: "property-row", children: [
5349
5349
  /* @__PURE__ */ i.jsxs("div", { className: "input-group", children: [
5350
5350
  /* @__PURE__ */ i.jsx("label", { children: "Letter Spacing" }),
@@ -5354,7 +5354,7 @@ const Ut = {
5354
5354
  type: "number",
5355
5355
  step: "0.1",
5356
5356
  value: f.letterSpacing || 0,
5357
- onChange: (C) => n("letterSpacing", parseFloat(C.target.value)),
5357
+ onChange: (T) => n("letterSpacing", parseFloat(T.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: (C) => n("wordSpacing", parseFloat(C.target.value)),
5371
+ onChange: (T) => n("wordSpacing", parseFloat(T.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: (C) => n("textShadowX", parseInt(C.target.value)),
5397
+ onChange: (T) => n("textShadowX", parseInt(T.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: (C) => n("textShadowY", parseInt(C.target.value)),
5410
+ onChange: (T) => n("textShadowY", parseInt(T.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: (C) => n("textShadowBlur", parseInt(C.target.value)),
5423
+ onChange: (T) => n("textShadowBlur", parseInt(T.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: (C) => n("textShadowColor", C.target.value)
5436
+ onChange: (T) => n("textShadowColor", T.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: (C) => n("stroke", C.target.value)
5451
+ onChange: (T) => n("stroke", T.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: (C) => n("strokeWidth", parseInt(C.target.value)),
5462
+ onChange: (T) => n("strokeWidth", parseInt(T.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: (C) => n("opacity", parseFloat(C.target.value))
5479
+ onChange: (T) => n("opacity", parseFloat(T.target.value))
5480
5480
  }
5481
5481
  ),
5482
5482
  /* @__PURE__ */ i.jsxs("span", { children: [
@@ -5490,7 +5490,7 @@ const Ut = {
5490
5490
  "select",
5491
5491
  {
5492
5492
  value: f.fontVariant || "normal",
5493
- onChange: (C) => n("fontVariant", C.target.value),
5493
+ onChange: (T) => n("fontVariant", T.target.value),
5494
5494
  children: [
5495
5495
  /* @__PURE__ */ i.jsx("option", { value: "normal", children: "Normal" }),
5496
5496
  /* @__PURE__ */ i.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: (C) => n("writingMode", C.target.value),
5507
+ onChange: (T) => n("writingMode", T.target.value),
5508
5508
  children: [
5509
5509
  /* @__PURE__ */ i.jsx("option", { value: "horizontal-tb", children: "Horizontal" }),
5510
5510
  /* @__PURE__ */ i.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: (C) => n("backgroundPadding", parseInt(C.target.value)),
5546
+ onChange: (T) => n("backgroundPadding", parseInt(T.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__ */ i.jsxs("div", { className: "property-group", children: [
5555
+ }, F = () => /* @__PURE__ */ i.jsxs("div", { className: "property-group", children: [
5556
5556
  /* @__PURE__ */ i.jsx("h4", { children: "Shape Properties" }),
5557
5557
  /* @__PURE__ */ i.jsxs("div", { className: "property-row", children: [
5558
5558
  /* @__PURE__ */ i.jsx("label", { children: "Fill Color" }),
@@ -5561,7 +5561,7 @@ const Ut = {
5561
5561
  {
5562
5562
  type: "color",
5563
5563
  value: f.fill || "#000000",
5564
- onChange: (b) => n("fill", b.target.value)
5564
+ onChange: (p) => n("fill", p.target.value)
5565
5565
  }
5566
5566
  )
5567
5567
  ] }),
@@ -5572,7 +5572,7 @@ const Ut = {
5572
5572
  {
5573
5573
  type: "color",
5574
5574
  value: f.stroke || "#000000",
5575
- onChange: (b) => n("stroke", b.target.value)
5575
+ onChange: (p) => n("stroke", p.target.value)
5576
5576
  }
5577
5577
  )
5578
5578
  ] }),
@@ -5583,7 +5583,7 @@ const Ut = {
5583
5583
  {
5584
5584
  type: "number",
5585
5585
  value: f.strokeWidth || 2,
5586
- onChange: (b) => n("strokeWidth", parseInt(b.target.value)),
5586
+ onChange: (p) => n("strokeWidth", parseInt(p.target.value)),
5587
5587
  min: "0",
5588
5588
  max: "20"
5589
5589
  }
@@ -5596,7 +5596,7 @@ const Ut = {
5596
5596
  {
5597
5597
  type: "number",
5598
5598
  value: f.numPoints || 5,
5599
- onChange: (b) => n("numPoints", parseInt(b.target.value)),
5599
+ onChange: (p) => n("numPoints", parseInt(p.target.value)),
5600
5600
  min: "3",
5601
5601
  max: "20"
5602
5602
  }
@@ -5609,13 +5609,13 @@ const Ut = {
5609
5609
  {
5610
5610
  type: "number",
5611
5611
  value: f.cornerRadius || 10,
5612
- onChange: (b) => n("cornerRadius", parseInt(b.target.value)),
5612
+ onChange: (p) => n("cornerRadius", parseInt(p.target.value)),
5613
5613
  min: "0",
5614
5614
  max: "50"
5615
5615
  }
5616
5616
  )
5617
5617
  ] })
5618
- ] }), S = () => /* @__PURE__ */ i.jsxs("div", { className: "property-group", children: [
5618
+ ] }), I = () => /* @__PURE__ */ i.jsxs("div", { className: "property-group", children: [
5619
5619
  /* @__PURE__ */ i.jsx("h4", { children: "Image Properties" }),
5620
5620
  /* @__PURE__ */ i.jsxs("div", { className: "property-row", children: [
5621
5621
  /* @__PURE__ */ i.jsx("label", { children: "Opacity" }),
@@ -5627,7 +5627,7 @@ const Ut = {
5627
5627
  max: "1",
5628
5628
  step: "0.1",
5629
5629
  value: f.opacity || 1,
5630
- onChange: (b) => n("opacity", parseFloat(b.target.value))
5630
+ onChange: (p) => n("opacity", parseFloat(p.target.value))
5631
5631
  }
5632
5632
  ),
5633
5633
  /* @__PURE__ */ i.jsxs("span", { children: [
@@ -5635,20 +5635,20 @@ const Ut = {
5635
5635
  "%"
5636
5636
  ] })
5637
5637
  ] }),
5638
- h && /* @__PURE__ */ i.jsxs("div", { className: "property-row", children: [
5638
+ g && /* @__PURE__ */ i.jsxs("div", { className: "property-row", children: [
5639
5639
  /* @__PURE__ */ i.jsx("label", { children: "Border Radius" }),
5640
5640
  /* @__PURE__ */ i.jsx(
5641
5641
  "input",
5642
5642
  {
5643
5643
  type: "number",
5644
5644
  value: f.borderRadius || 0,
5645
- onChange: (b) => n("borderRadius", parseInt(b.target.value)),
5645
+ onChange: (p) => n("borderRadius", parseInt(p.target.value)),
5646
5646
  min: "0",
5647
5647
  max: "50"
5648
5648
  }
5649
5649
  )
5650
5650
  ] })
5651
- ] }), I = () => /* @__PURE__ */ i.jsxs("div", { className: "property-group", children: [
5651
+ ] }), E = () => /* @__PURE__ */ i.jsxs("div", { className: "property-group", children: [
5652
5652
  /* @__PURE__ */ i.jsx("h4", { children: "Position & Size" }),
5653
5653
  /* @__PURE__ */ i.jsxs("div", { className: "property-row", children: [
5654
5654
  /* @__PURE__ */ i.jsxs("div", { className: "input-group", children: [
@@ -5658,7 +5658,7 @@ const Ut = {
5658
5658
  {
5659
5659
  type: "number",
5660
5660
  value: Math.round(f.x) || 0,
5661
- onChange: (b) => n("x", parseInt(b.target.value))
5661
+ onChange: (p) => n("x", parseInt(p.target.value))
5662
5662
  }
5663
5663
  )
5664
5664
  ] }),
@@ -5669,7 +5669,7 @@ const Ut = {
5669
5669
  {
5670
5670
  type: "number",
5671
5671
  value: Math.round(f.y) || 0,
5672
- onChange: (b) => n("y", parseInt(b.target.value))
5672
+ onChange: (p) => n("y", parseInt(p.target.value))
5673
5673
  }
5674
5674
  )
5675
5675
  ] })
@@ -5682,7 +5682,7 @@ const Ut = {
5682
5682
  {
5683
5683
  type: "number",
5684
5684
  value: Math.round(f.width) || 0,
5685
- onChange: (b) => n("width", parseInt(b.target.value)),
5685
+ onChange: (p) => n("width", parseInt(p.target.value)),
5686
5686
  min: "1"
5687
5687
  }
5688
5688
  )
@@ -5694,7 +5694,7 @@ const Ut = {
5694
5694
  {
5695
5695
  type: "number",
5696
5696
  value: Math.round(f.height) || 0,
5697
- onChange: (b) => n("height", parseInt(b.target.value)),
5697
+ onChange: (p) => n("height", parseInt(p.target.value)),
5698
5698
  min: "1"
5699
5699
  }
5700
5700
  )
@@ -5709,7 +5709,7 @@ const Ut = {
5709
5709
  min: "-180",
5710
5710
  max: "180",
5711
5711
  value: f.rotation || 0,
5712
- onChange: (b) => n("rotation", parseInt(b.target.value))
5712
+ onChange: (p) => n("rotation", parseInt(p.target.value))
5713
5713
  }
5714
5714
  ),
5715
5715
  /* @__PURE__ */ i.jsxs("span", { children: [
@@ -5717,7 +5717,7 @@ const Ut = {
5717
5717
  "°"
5718
5718
  ] })
5719
5719
  ] })
5720
- ] }), y = () => /* @__PURE__ */ i.jsxs("div", { className: "property-group", children: [
5720
+ ] }), m = () => /* @__PURE__ */ i.jsxs("div", { className: "property-group", children: [
5721
5721
  /* @__PURE__ */ i.jsx("h4", { children: "Line Properties" }),
5722
5722
  /* @__PURE__ */ i.jsxs("div", { className: "property-row", children: [
5723
5723
  /* @__PURE__ */ i.jsxs("div", { className: "input-group", children: [
@@ -5727,9 +5727,9 @@ const Ut = {
5727
5727
  {
5728
5728
  type: "number",
5729
5729
  value: f.strokeWidth || f.height || 2,
5730
- onChange: (b) => {
5731
- const F = parseInt(b.target.value);
5732
- n("strokeWidth", F), n("height", F);
5730
+ onChange: (p) => {
5731
+ const v = parseInt(p.target.value);
5732
+ n("strokeWidth", v), n("height", v);
5733
5733
  },
5734
5734
  min: "1",
5735
5735
  max: "50"
@@ -5743,7 +5743,7 @@ const Ut = {
5743
5743
  {
5744
5744
  type: "number",
5745
5745
  value: f.width || 200,
5746
- onChange: (b) => n("width", parseInt(b.target.value)),
5746
+ onChange: (p) => n("width", parseInt(p.target.value)),
5747
5747
  min: "10",
5748
5748
  max: "1000"
5749
5749
  }
@@ -5758,8 +5758,8 @@ const Ut = {
5758
5758
  {
5759
5759
  type: "color",
5760
5760
  value: f.stroke || f.fill || "#000000",
5761
- onChange: (b) => {
5762
- n("stroke", b.target.value), n("fill", b.target.value);
5761
+ onChange: (p) => {
5762
+ n("stroke", p.target.value), n("fill", p.target.value);
5763
5763
  }
5764
5764
  }
5765
5765
  ),
@@ -5768,15 +5768,15 @@ const Ut = {
5768
5768
  {
5769
5769
  type: "text",
5770
5770
  value: f.stroke || f.fill || "#000000",
5771
- onChange: (b) => {
5772
- n("stroke", b.target.value), n("fill", b.target.value);
5771
+ onChange: (p) => {
5772
+ n("stroke", p.target.value), n("fill", p.target.value);
5773
5773
  },
5774
5774
  placeholder: "#000000"
5775
5775
  }
5776
5776
  )
5777
5777
  ] })
5778
5778
  ] })
5779
- ] }), E = () => /* @__PURE__ */ i.jsxs("div", { className: "property-group", children: [
5779
+ ] }), B = () => /* @__PURE__ */ i.jsxs("div", { className: "property-group", children: [
5780
5780
  /* @__PURE__ */ i.jsx("h4", { children: "Layer Controls" }),
5781
5781
  /* @__PURE__ */ i.jsxs("div", { className: "button-group vertical", children: [
5782
5782
  /* @__PURE__ */ i.jsx("button", { onClick: () => a(f.id, "top"), children: "Bring to Front" }),
@@ -5784,7 +5784,7 @@ const Ut = {
5784
5784
  /* @__PURE__ */ i.jsx("button", { onClick: () => a(f.id, "down"), children: "Send Backward" }),
5785
5785
  /* @__PURE__ */ i.jsx("button", { onClick: () => a(f.id, "bottom"), children: "Send to Back" })
5786
5786
  ] })
5787
- ] }), B = [
5787
+ ] }), j = [
5788
5788
  "rectangle",
5789
5789
  "circle",
5790
5790
  "triangle",
@@ -5803,19 +5803,19 @@ const Ut = {
5803
5803
  /* @__PURE__ */ i.jsx("span", { className: "element-type", children: f.type })
5804
5804
  ] }),
5805
5805
  /* @__PURE__ */ i.jsxs("div", { className: "panel-content", children: [
5806
- f.type === "text" && d(),
5807
- B.includes(f.type) && j(),
5808
- f.type === "image" && S(),
5809
- f.type === "horizontalLine" && y(),
5810
- I(),
5806
+ f.type === "text" && c(),
5807
+ j.includes(f.type) && F(),
5808
+ f.type === "image" && I(),
5809
+ f.type === "horizontalLine" && m(),
5811
5810
  E(),
5811
+ B(),
5812
5812
  /* @__PURE__ */ i.jsx("div", { className: "property-group", children: /* @__PURE__ */ i.jsxs(
5813
5813
  "button",
5814
5814
  {
5815
5815
  className: "toggle-advanced",
5816
- onClick: () => x(!h),
5816
+ onClick: () => h(!g),
5817
5817
  children: [
5818
- h ? "Hide" : "Show",
5818
+ g ? "Hide" : "Show",
5819
5819
  " Advanced Options"
5820
5820
  ]
5821
5821
  }
@@ -5828,10 +5828,10 @@ const Ut = {
5828
5828
  onSelectElement: a,
5829
5829
  onMoveLayer: l,
5830
5830
  onDeleteElement: s,
5831
- theme: h
5831
+ theme: g
5832
5832
  }) => {
5833
- const x = (d, j) => {
5834
- switch (d) {
5833
+ const h = (c, F) => {
5834
+ switch (c) {
5835
5835
  case "text":
5836
5836
  return "T";
5837
5837
  case "rectangle":
@@ -5871,42 +5871,42 @@ const Ut = {
5871
5871
  default:
5872
5872
  return "?";
5873
5873
  }
5874
- }, n = (d) => {
5875
- var j, S;
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)) + (((S = d.text) == null ? void 0 : S.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 I = d.format || "CODE128", y = d.data || "";
5882
- return `Barcode (${I}): ${y.substring(0, 10) + (y.length > 10 ? "..." : "")}`;
5874
+ }, n = (c) => {
5875
+ var F, I;
5876
+ if (c.type === "text")
5877
+ return c.isIcon && c.iconData ? `Icon: ${c.iconData.name}` : ((F = c.text) == null ? void 0 : F.substring(0, 20)) + (((I = c.text) == null ? void 0 : I.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 E = c.format || "CODE128", m = c.data || "";
5882
+ return `Barcode (${E}): ${m.substring(0, 10) + (m.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__ */ i.jsxs("div", { className: "layers-panel", children: [
5887
5887
  /* @__PURE__ */ i.jsxs("div", { className: "panel-header", children: [
5888
5888
  /* @__PURE__ */ i.jsx("h3", { children: "Layers" }),
5889
5889
  /* @__PURE__ */ i.jsx("span", { className: "layer-count", children: f.length })
5890
5890
  ] }),
5891
- /* @__PURE__ */ i.jsx("div", { className: "layers-list", children: f.length === 0 ? /* @__PURE__ */ i.jsx("div", { className: "no-layers", children: "No elements added yet" }) : [...f].reverse().map((d, j) => /* @__PURE__ */ i.jsxs(
5891
+ /* @__PURE__ */ i.jsx("div", { className: "layers-list", children: f.length === 0 ? /* @__PURE__ */ i.jsx("div", { className: "no-layers", children: "No elements added yet" }) : [...f].reverse().map((c, F) => /* @__PURE__ */ i.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__ */ i.jsxs("div", { className: "layer-info", children: [
5898
- /* @__PURE__ */ i.jsx("span", { className: "layer-icon", children: x(d.type) }),
5899
- /* @__PURE__ */ i.jsx("span", { className: "layer-name", children: n(d) })
5898
+ /* @__PURE__ */ i.jsx("span", { className: "layer-icon", children: h(c.type) }),
5899
+ /* @__PURE__ */ i.jsx("span", { className: "layer-name", children: n(c) })
5900
5900
  ] }),
5901
5901
  /* @__PURE__ */ i.jsxs("div", { className: "layer-controls", children: [
5902
5902
  /* @__PURE__ */ i.jsx(
5903
5903
  "button",
5904
5904
  {
5905
5905
  className: "layer-btn",
5906
- onClick: (S) => {
5907
- S.stopPropagation(), l(d.id, "up");
5906
+ onClick: (I) => {
5907
+ I.stopPropagation(), l(c.id, "up");
5908
5908
  },
5909
- disabled: j === 0,
5909
+ disabled: F === 0,
5910
5910
  title: "Move Up",
5911
5911
  children: "↑"
5912
5912
  }
@@ -5915,10 +5915,10 @@ const Ut = {
5915
5915
  "button",
5916
5916
  {
5917
5917
  className: "layer-btn",
5918
- onClick: (S) => {
5919
- S.stopPropagation(), l(d.id, "down");
5918
+ onClick: (I) => {
5919
+ I.stopPropagation(), l(c.id, "down");
5920
5920
  },
5921
- disabled: j === f.length - 1,
5921
+ disabled: F === f.length - 1,
5922
5922
  title: "Move Down",
5923
5923
  children: "↓"
5924
5924
  }
@@ -5927,8 +5927,8 @@ const Ut = {
5927
5927
  "button",
5928
5928
  {
5929
5929
  className: "layer-btn delete",
5930
- onClick: (S) => {
5931
- S.stopPropagation(), s(d.id);
5930
+ onClick: (I) => {
5931
+ I.stopPropagation(), s(c.id);
5932
5932
  },
5933
5933
  title: "Delete",
5934
5934
  children: "×"
@@ -5937,7 +5937,7 @@ const Ut = {
5937
5937
  ] })
5938
5938
  ]
5939
5939
  },
5940
- d.id
5940
+ c.id
5941
5941
  )) })
5942
5942
  ] });
5943
5943
  };
@@ -5946,34 +5946,34 @@ class ci {
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
- async exportAllSections(o, a, l, s, h = "png", x = !0) {
5950
- const n = {};
5951
- for (const d of a) {
5952
- const j = d.id || d.sectionName, S = o[j];
5953
- if (!S || !S.elements || S.elements.length === 0) {
5954
- console.log(`Skipping section ${j} - no elements`);
5949
+ async exportAllSections(o, a, l, s, g = "png", h = !0, n = null) {
5950
+ const c = {};
5951
+ for (const F of a) {
5952
+ const I = F.id || F.sectionName, E = o[I];
5953
+ if (!E || !E.elements || E.elements.length === 0) {
5954
+ console.log(`Skipping section ${I} - no elements`);
5955
5955
  continue;
5956
5956
  }
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;
5959
- if (y)
5957
+ if (this.canvas.width = l, this.canvas.height = s, this.ctx.clearRect(0, 0, l, s), h) {
5958
+ let B = F.image || F.sectionImage;
5959
+ if (n && n.sectionImage && (F.sectionName === "Front" || n.sections && Object.keys(n.sections).includes(F.sectionName)) && (B = n.sectionImage), B)
5960
5960
  try {
5961
- const E = await this.loadImage(y);
5962
- await this.processImageColor(E, S.selectedColor || "#FFFFFF"), this.ctx.drawImage(this.processedImage, 0, 0, l, s);
5963
- } catch (E) {
5964
- console.warn("Failed to load background image:", E);
5961
+ const j = await this.loadImage(B);
5962
+ await this.processImageColor(j, E.selectedColor || "#FFFFFF"), this.ctx.drawImage(this.processedImage, 0, 0, l, s);
5963
+ } catch (j) {
5964
+ console.warn("Failed to load background image:", j);
5965
5965
  }
5966
5966
  } else
5967
5967
  this.ctx.clearRect(0, 0, l, s);
5968
- for (const y of S.elements)
5969
- await this.drawElement(y);
5970
- const I = this.canvas.toDataURL(`image/${h}`, h === "jpeg" ? 0.9 : void 0);
5971
- n[j] = {
5972
- dataUrl: I,
5973
- blob: await this.dataUrlToBlob(I)
5968
+ for (const B of E.elements)
5969
+ await this.drawElement(B);
5970
+ const m = this.canvas.toDataURL(`image/${g}`, g === "jpeg" ? 0.9 : void 0);
5971
+ c[I] = {
5972
+ dataUrl: m,
5973
+ blob: await this.dataUrlToBlob(m)
5974
5974
  };
5975
5975
  }
5976
- return n;
5976
+ return c;
5977
5977
  }
5978
5978
  // Also add a method to download all exports
5979
5979
  async downloadExports(o, a = "design") {
@@ -5983,12 +5983,12 @@ class ci {
5983
5983
  return;
5984
5984
  }
5985
5985
  if (l.length === 1) {
5986
- const s = l[0], { blob: h } = o[s], x = URL.createObjectURL(h), n = document.createElement("a");
5987
- n.href = x, n.download = `${a}-${s}.png`, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(x);
5986
+ const s = l[0], { blob: g } = o[s], h = URL.createObjectURL(g), n = document.createElement("a");
5987
+ n.href = h, n.download = `${a}-${s}.png`, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(h);
5988
5988
  } else
5989
5989
  for (const s of l) {
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));
5990
+ const { blob: g } = o[s], h = URL.createObjectURL(g), n = document.createElement("a");
5991
+ n.href = h, n.download = `${a}-${s}.png`, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(h), await new Promise((c) => setTimeout(c, 100));
5992
5992
  }
5993
5993
  }
5994
5994
  async loadImage(o) {
@@ -6005,22 +6005,22 @@ class ci {
6005
6005
  async processImageColor(o, a) {
6006
6006
  const l = document.createElement("canvas"), s = l.getContext("2d");
6007
6007
  l.width = o.width, l.height = o.height, s.clearRect(0, 0, l.width, l.height), s.drawImage(o, 0, 0);
6008
- const h = s.getImageData(0, 0, l.width, l.height), x = h.data, n = this.hexToRgb(a);
6008
+ const g = s.getImageData(0, 0, l.width, l.height), h = g.data, n = this.hexToRgb(a);
6009
6009
  if (!n) {
6010
6010
  console.warn("Invalid target color:", a);
6011
6011
  return;
6012
6012
  }
6013
- const { r: d, g: j, b: S } = n;
6014
- for (let I = 0; I < x.length; I += 4) {
6015
- if (x[I + 3] === 0) continue;
6016
- const E = this.getLuma(x[I], x[I + 1], x[I + 2]);
6017
- x[I] = Math.round(d * E), x[I + 1] = Math.round(j * E), x[I + 2] = Math.round(S * E);
6013
+ const { r: c, g: F, b: I } = n;
6014
+ for (let E = 0; E < h.length; E += 4) {
6015
+ if (h[E + 3] === 0) continue;
6016
+ const B = this.getLuma(h[E], h[E + 1], h[E + 2]);
6017
+ h[E] = Math.round(c * B), h[E + 1] = Math.round(F * B), h[E + 2] = Math.round(I * B);
6018
6018
  }
6019
- return s.putImageData(h, 0, 0), this.processedImage = new Image(), new Promise((I) => {
6019
+ return s.putImageData(g, 0, 0), this.processedImage = new Image(), new Promise((E) => {
6020
6020
  this.processedImage.onload = () => {
6021
- I();
6021
+ E();
6022
6022
  }, this.processedImage.onerror = () => {
6023
- console.error("Failed to create processed image"), I();
6023
+ console.error("Failed to create processed image"), E();
6024
6024
  }, this.processedImage.src = l.toDataURL("image/png");
6025
6025
  });
6026
6026
  }
@@ -6080,7 +6080,7 @@ class ci {
6080
6080
  await this.drawEmbroidery(o);
6081
6081
  break;
6082
6082
  case "image":
6083
- o.imageData && this.ctx.drawImage(o.imageData, 0, 0, o.width, o.height);
6083
+ await this.drawImage(o);
6084
6084
  break;
6085
6085
  }
6086
6086
  this.ctx.restore();
@@ -6089,9 +6089,9 @@ class ci {
6089
6089
  this.ctx.font = `${o.fontStyle || "normal"} ${o.fontWeight || "normal"} ${o.fontSize || 20}px ${o.fontFamily || "Arial"}`, this.ctx.fillStyle = o.fill || "#000000", this.ctx.textAlign = o.textAlign || "left", this.ctx.textBaseline = "top", o.stroke && o.strokeWidth > 0 && (this.ctx.strokeStyle = o.stroke, this.ctx.lineWidth = o.strokeWidth);
6090
6090
  const a = (o.text || "Text").split(`
6091
6091
  `), l = (o.fontSize || 20) * 1.2;
6092
- a.forEach((s, h) => {
6093
- const x = h * l;
6094
- o.stroke && o.strokeWidth > 0 && this.ctx.strokeText(s, 0, x), this.ctx.fillText(s, 0, x);
6092
+ a.forEach((s, g) => {
6093
+ const h = g * l;
6094
+ o.stroke && o.strokeWidth > 0 && this.ctx.strokeText(s, 0, h), this.ctx.fillText(s, 0, h);
6095
6095
  });
6096
6096
  }
6097
6097
  drawRectangle(o) {
@@ -6106,11 +6106,11 @@ class ci {
6106
6106
  this.ctx.beginPath(), this.ctx.moveTo(a, 0), this.ctx.lineTo(0, o.height), this.ctx.lineTo(o.width, o.height), 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());
6107
6107
  }
6108
6108
  drawStar(o) {
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;
6109
+ const a = o.width / 2, l = o.height / 2, s = Math.min(o.width, o.height) / 2, g = s * 0.4, h = o.numPoints || 5;
6110
6110
  this.ctx.beginPath();
6111
- for (let n = 0; n < x * 2; n++) {
6112
- const d = n % 2 === 0 ? s : h, j = n * Math.PI / x, S = a + Math.cos(j) * d, I = l + Math.sin(j) * d;
6113
- n === 0 ? this.ctx.moveTo(S, I) : this.ctx.lineTo(S, I);
6111
+ for (let n = 0; n < h * 2; n++) {
6112
+ const c = n % 2 === 0 ? s : g, F = n * Math.PI / h, I = a + Math.cos(F) * c, E = l + Math.sin(F) * c;
6113
+ n === 0 ? this.ctx.moveTo(I, E) : this.ctx.lineTo(I, E);
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
  }
@@ -6120,10 +6120,10 @@ class ci {
6120
6120
  }
6121
6121
  async dataUrlToBlob(o) {
6122
6122
  return new Promise((a) => {
6123
- const l = document.createElement("canvas"), s = l.getContext("2d"), h = new Image();
6124
- h.onload = () => {
6125
- l.width = h.width, l.height = h.height, s.drawImage(h, 0, 0), l.toBlob(a);
6126
- }, h.src = o;
6123
+ const l = document.createElement("canvas"), s = l.getContext("2d"), g = new Image();
6124
+ g.onload = () => {
6125
+ l.width = g.width, l.height = g.height, s.drawImage(g, 0, 0), l.toBlob(a);
6126
+ }, g.src = o;
6127
6127
  });
6128
6128
  }
6129
6129
  hexToRgb(o) {
@@ -6140,67 +6140,67 @@ class ci {
6140
6140
  this.ctx.beginPath(), this.ctx.moveTo(a, 0), this.ctx.lineTo(o.width, l), this.ctx.lineTo(a, o.height), this.ctx.lineTo(0, l), 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());
6141
6141
  }
6142
6142
  drawHexagon(o) {
6143
- const a = o.width / 2, l = o.height / 2, s = Math.min(o.width, o.height) / 2, h = 6;
6143
+ const a = o.width / 2, l = o.height / 2, s = Math.min(o.width, o.height) / 2, g = 6;
6144
6144
  this.ctx.beginPath();
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);
6145
+ for (let h = 0; h < g; h++) {
6146
+ const n = h * 2 * Math.PI / g - Math.PI / 2, c = a + s * Math.cos(n), F = l + s * Math.sin(n);
6147
+ h === 0 ? this.ctx.moveTo(c, F) : this.ctx.lineTo(c, F);
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
  }
6151
6151
  drawPentagon(o) {
6152
- const a = o.width / 2, l = o.height / 2, s = Math.min(o.width, o.height) / 2, h = 5;
6152
+ const a = o.width / 2, l = o.height / 2, s = Math.min(o.width, o.height) / 2, g = 5;
6153
6153
  this.ctx.beginPath();
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);
6154
+ for (let h = 0; h < g; h++) {
6155
+ const n = h * 2 * Math.PI / g - Math.PI / 2, c = a + s * Math.cos(n), F = l + s * Math.sin(n);
6156
+ h === 0 ? this.ctx.moveTo(c, F) : this.ctx.lineTo(c, F);
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
  }
6160
6160
  drawHeart(o) {
6161
- const a = o.width, l = o.height, s = 0, h = 0;
6161
+ const a = o.width, l = o.height, s = 0, g = 0;
6162
6162
  this.ctx.beginPath();
6163
- const x = l * 0.3;
6164
- this.ctx.moveTo(s + a / 2, h + x), this.ctx.bezierCurveTo(
6163
+ const h = l * 0.3;
6164
+ this.ctx.moveTo(s + a / 2, g + h), this.ctx.bezierCurveTo(
6165
6165
  s + a / 2,
6166
- h,
6166
+ g,
6167
6167
  s,
6168
- h,
6168
+ g,
6169
6169
  s,
6170
- h + x
6170
+ g + h
6171
6171
  ), this.ctx.bezierCurveTo(
6172
6172
  s,
6173
- h + (l + x) / 2,
6173
+ g + (l + h) / 2,
6174
6174
  s + a / 2,
6175
- h + (l + x) / 2,
6175
+ g + (l + h) / 2,
6176
6176
  s + a / 2,
6177
- h + l
6177
+ g + l
6178
6178
  ), this.ctx.bezierCurveTo(
6179
6179
  s + a / 2,
6180
- h + (l + x) / 2,
6180
+ g + (l + h) / 2,
6181
6181
  s + a,
6182
- h + (l + x) / 2,
6182
+ g + (l + h) / 2,
6183
6183
  s + a,
6184
- h + x
6184
+ g + h
6185
6185
  ), this.ctx.bezierCurveTo(
6186
6186
  s + a,
6187
- h,
6187
+ g,
6188
6188
  s + a / 2,
6189
- h,
6189
+ g,
6190
6190
  s + a / 2,
6191
- h + x
6191
+ g + h
6192
6192
  ), 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());
6193
6193
  }
6194
6194
  drawOval(o) {
6195
- const a = o.width / 2, l = o.height / 2, s = o.width / 2, h = o.height / 2;
6196
- this.ctx.beginPath(), this.ctx.ellipse(a, l, s, h, 0, 0, 2 * Math.PI), 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());
6195
+ const a = o.width / 2, l = o.height / 2, s = o.width / 2, g = o.height / 2;
6196
+ this.ctx.beginPath(), this.ctx.ellipse(a, l, s, g, 0, 0, 2 * Math.PI), 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());
6197
6197
  }
6198
6198
  drawRoundedRectangle(o) {
6199
6199
  const a = Math.min(o.width, o.height) * 0.1;
6200
6200
  this.drawRoundedRect(0, 0, o.width, o.height, a), 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());
6201
6201
  }
6202
- drawRoundedRect(o, a, l, s, h) {
6203
- this.ctx.beginPath(), this.ctx.moveTo(o + h, a), this.ctx.lineTo(o + l - h, a), this.ctx.quadraticCurveTo(o + l, a, o + l, a + h), this.ctx.lineTo(o + l, a + s - h), this.ctx.quadraticCurveTo(o + l, a + s, o + l - h, a + s), this.ctx.lineTo(o + h, a + s), this.ctx.quadraticCurveTo(o, a + s, o, a + s - h), this.ctx.lineTo(o, a + h), this.ctx.quadraticCurveTo(o, a, o + h, a), this.ctx.closePath();
6202
+ drawRoundedRect(o, a, l, s, g) {
6203
+ this.ctx.beginPath(), this.ctx.moveTo(o + g, a), this.ctx.lineTo(o + l - g, a), this.ctx.quadraticCurveTo(o + l, a, o + l, a + g), this.ctx.lineTo(o + l, a + s - g), this.ctx.quadraticCurveTo(o + l, a + s, o + l - g, a + s), this.ctx.lineTo(o + g, a + s), this.ctx.quadraticCurveTo(o, a + s, o, a + s - g), this.ctx.lineTo(o, a + g), this.ctx.quadraticCurveTo(o, a, o + g, a), this.ctx.closePath();
6204
6204
  }
6205
6205
  async drawQRCode(o) {
6206
6206
  if (o.imageObject)
@@ -6263,6 +6263,54 @@ class ci {
6263
6263
  console.warn("Failed to draw embroidery:", a), this.ctx.fillStyle = "#ffebee", this.ctx.fillRect(0, 0, o.width, o.height), this.ctx.strokeStyle = "#f44336", this.ctx.strokeRect(0, 0, o.width, o.height), this.ctx.fillStyle = "#f44336", this.ctx.font = "12px Arial", this.ctx.textAlign = "center", this.ctx.textBaseline = "middle", this.ctx.fillText("Error", o.width / 2, o.height / 2);
6264
6264
  }
6265
6265
  }
6266
+ // Add this new method to handle image elements more robustly
6267
+ async drawImage(o) {
6268
+ try {
6269
+ let a = null;
6270
+ if (o.imageObject && o.imageObject instanceof HTMLImageElement)
6271
+ a = o.imageObject;
6272
+ else if (o.imageData) {
6273
+ if (o.imageData instanceof HTMLImageElement)
6274
+ a = o.imageData;
6275
+ else if (typeof o.imageData == "string")
6276
+ try {
6277
+ a = await this.loadImage(o.imageData);
6278
+ } catch (l) {
6279
+ console.warn("Failed to load image from imageData URL:", o.imageData, l), a = await this.loadImageWithFallback(o.imageData);
6280
+ }
6281
+ } else if (o.src)
6282
+ try {
6283
+ a = await this.loadImage(o.src);
6284
+ } catch (l) {
6285
+ console.warn("Failed to load image from src:", o.src, l), a = await this.loadImageWithFallback(o.src);
6286
+ }
6287
+ else if (o.image)
6288
+ try {
6289
+ a = await this.loadImage(o.image);
6290
+ } catch (l) {
6291
+ console.warn("Failed to load image from image property:", o.image, l), a = await this.loadImageWithFallback(o.image);
6292
+ }
6293
+ a ? (o.opacity !== void 0 && (this.ctx.globalAlpha = o.opacity), this.ctx.drawImage(a, 0, 0, o.width, o.height)) : this.drawImagePlaceholder(o);
6294
+ } catch (a) {
6295
+ console.error("Failed to draw image element:", a), this.drawImagePlaceholder(o);
6296
+ }
6297
+ }
6298
+ // Add fallback image loading method
6299
+ async loadImageWithFallback(o) {
6300
+ return new Promise((a) => {
6301
+ const l = new Image();
6302
+ l.onload = () => a(l), l.onerror = () => {
6303
+ const s = new Image();
6304
+ s.crossOrigin = "anonymous", s.onload = () => a(s), s.onerror = () => {
6305
+ console.warn("All image loading attempts failed for:", o), a(null);
6306
+ }, s.src = o;
6307
+ }, l.src = o;
6308
+ });
6309
+ }
6310
+ // Add placeholder drawing method
6311
+ drawImagePlaceholder(o) {
6312
+ this.ctx.fillStyle = "#f0f0f0", this.ctx.fillRect(0, 0, o.width, o.height), this.ctx.strokeStyle = "#ccc", this.ctx.lineWidth = 2, this.ctx.strokeRect(0, 0, o.width, o.height), this.ctx.fillStyle = "#666", this.ctx.font = "12px Arial", this.ctx.textAlign = "center", this.ctx.textBaseline = "middle", this.ctx.fillText("Image", o.width / 2, o.height / 2 - 8), this.ctx.fillText("Not Found", o.width / 2, o.height / 2 + 8);
6313
+ }
6266
6314
  /**Export to JSON formats**/
6267
6315
  // Add these new methods to the ExportManager class
6268
6316
  // Helper method to convert blob to File
@@ -6273,189 +6321,225 @@ class ci {
6273
6321
  });
6274
6322
  }
6275
6323
  // Export all sections as JSON with File objects
6276
- async exportAllSectionsAsJSON(o, a, l, s, h = "png") {
6277
- const x = [], n = [], d = {};
6278
- for (const S of a) {
6279
- const I = S.id || S.sectionName, y = o[I];
6280
- if (!y || !y.elements || y.elements.length === 0) {
6281
- console.log(`Skipping section ${I} - no elements`);
6324
+ async exportAllSectionsAsJSON(o, a, l, s, g = "png", h = null) {
6325
+ var m, B;
6326
+ const n = [], c = [], F = {};
6327
+ for (const j of a) {
6328
+ const p = j.id || j.sectionName, v = o[p];
6329
+ if (!v || !v.elements || v.elements.length === 0) {
6330
+ console.log(`Skipping section ${p} - no elements`);
6282
6331
  continue;
6283
6332
  }
6284
- const E = {
6285
- ...y,
6286
- // Include background information
6287
- backgroundImage: S.image || S.sectionImage,
6288
- sectionImage: S.image || S.sectionImage,
6289
- sectionName: I,
6333
+ let X = j.image || j.sectionImage;
6334
+ h && h.sectionImage && (j.sectionName === "Front" || h.sections && Object.keys(h.sections).includes(j.sectionName)) && (X = h.sectionImage);
6335
+ const T = {
6336
+ ...v,
6337
+ // Include background information using the determined image
6338
+ backgroundImage: X,
6339
+ sectionImage: X,
6340
+ sectionName: p,
6290
6341
  // Ensure we have the selected color
6291
- selectedColor: y.selectedColor || "#FFFFFF",
6342
+ selectedColor: v.selectedColor || "#FFFFFF",
6292
6343
  // Include canvas dimensions
6293
6344
  canvasWidth: l,
6294
6345
  canvasHeight: s
6295
6346
  };
6296
- d[I] = E;
6297
- const B = await this.exportSectionAsBlob(
6298
- y,
6299
- S,
6347
+ F[p] = T;
6348
+ const O = await this.exportSectionAsBlob(
6349
+ v,
6350
+ j,
6300
6351
  l,
6301
6352
  s,
6302
- h,
6303
- !0
6353
+ g,
6354
+ !0,
6355
+ h
6356
+ // Pass initData to exportSectionAsBlob
6304
6357
  );
6305
- if (B) {
6306
- const F = await this.blobToFile(
6307
- B,
6308
- `${I}-full.${h}`,
6309
- `image/${h}`
6358
+ if (O) {
6359
+ const Z = await this.blobToFile(
6360
+ O,
6361
+ `${p}-full.${g}`,
6362
+ `image/${g}`
6310
6363
  );
6311
- x.push({
6312
- sectionName: I,
6313
- sectionImage: F
6364
+ n.push({
6365
+ sectionName: p,
6366
+ sectionImage: Z
6314
6367
  });
6315
6368
  }
6316
- const b = await this.exportSectionAsBlob(
6317
- y,
6318
- S,
6369
+ const k = await this.exportSectionAsBlob(
6370
+ v,
6371
+ j,
6319
6372
  l,
6320
6373
  s,
6321
- h,
6322
- !1
6374
+ g,
6375
+ !1,
6376
+ h
6377
+ // Pass initData to exportSectionAsBlob
6323
6378
  );
6324
- if (b) {
6325
- const F = await this.blobToFile(
6326
- b,
6327
- `${I}-print.${h}`,
6328
- `image/${h}`
6379
+ if (k) {
6380
+ const Z = await this.blobToFile(
6381
+ k,
6382
+ `${p}-print.${g}`,
6383
+ `image/${g}`
6329
6384
  );
6330
- n.push({
6331
- sectionName: I,
6332
- sectionImage: F
6385
+ c.push({
6386
+ sectionName: p,
6387
+ sectionImage: Z
6333
6388
  });
6334
6389
  }
6335
6390
  }
6336
- const j = {
6337
- sections: d,
6391
+ let I = ((m = a[0]) == null ? void 0 : m.image) || ((B = a[0]) == null ? void 0 : B.sectionImage);
6392
+ if (h && h.sectionImage) {
6393
+ const j = a[0];
6394
+ j && (j.sectionName === "Front" || h.sections && Object.keys(h.sections).includes(j.sectionName)) && (I = h.sectionImage);
6395
+ }
6396
+ const E = {
6397
+ sections: F,
6338
6398
  canvasWidth: l,
6339
6399
  canvasHeight: s,
6340
- sectionImage: a[0].image || a[0].sectionImage,
6341
- format: h,
6400
+ sectionImage: I,
6401
+ format: g,
6342
6402
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
6343
6403
  version: "1.0",
6404
+ // Include initData information if present
6405
+ ...h && {
6406
+ initData: {
6407
+ sectionImage: h.sectionImage,
6408
+ sections: h.sections ? Object.keys(h.sections) : []
6409
+ }
6410
+ },
6344
6411
  // Include product information for complete context
6345
6412
  product: {
6346
- sections: a.map((S) => ({
6347
- sectionName: S.sectionName || S.id,
6348
- sectionImage: S.image || S.sectionImage,
6349
- id: S.id || S.sectionName
6413
+ sections: a.map((j) => ({
6414
+ sectionName: j.sectionName || j.id,
6415
+ sectionImage: j.image || j.sectionImage,
6416
+ id: j.id || j.sectionName
6350
6417
  }))
6351
6418
  }
6352
6419
  };
6353
6420
  return {
6354
- fullDesign: x,
6355
- printReady: n,
6356
- designFile: JSON.stringify(j)
6421
+ fullDesign: n,
6422
+ printReady: c,
6423
+ designFile: JSON.stringify(E)
6357
6424
  };
6358
6425
  }
6359
6426
  // Helper method to export a single section as blob
6360
- async exportSectionAsBlob(o, a, l, s, h = "png", x = !0) {
6427
+ async exportSectionAsBlob(o, a, l, s, g = "png", h = !0, n = null) {
6361
6428
  try {
6362
- if (this.canvas.width = l, this.canvas.height = s, this.ctx.clearRect(0, 0, l, s), x) {
6363
- const n = a.image || a.sectionImage;
6364
- if (n)
6429
+ if (this.canvas.width = l, this.canvas.height = s, this.ctx.clearRect(0, 0, l, s), h) {
6430
+ let c = a.image || a.sectionImage;
6431
+ if (n && n.sectionImage && (a.sectionName === "Front" || n.sections && Object.keys(n.sections).includes(a.sectionName)) && (c = n.sectionImage), c)
6365
6432
  try {
6366
- const d = await this.loadImage(n);
6367
- await this.processImageColor(d, o.selectedColor || "#FFFFFF"), this.ctx.drawImage(this.processedImage, 0, 0, l, s);
6368
- } catch (d) {
6369
- console.warn("Failed to load background image:", d);
6433
+ const F = await this.loadImage(c);
6434
+ await this.processImageColor(F, o.selectedColor || "#FFFFFF"), this.ctx.drawImage(this.processedImage, 0, 0, l, s);
6435
+ } catch (F) {
6436
+ console.warn("Failed to load background image:", F);
6370
6437
  }
6371
6438
  } else
6372
6439
  this.ctx.clearRect(0, 0, l, s);
6373
- for (const n of o.elements)
6374
- await this.drawElement(n);
6375
- return new Promise((n) => {
6376
- this.canvas.toBlob(n, `image/${h}`, h === "jpeg" ? 0.9 : void 0);
6440
+ for (const c of o.elements)
6441
+ await this.drawElement(c);
6442
+ return new Promise((c) => {
6443
+ this.canvas.toBlob(c, `image/${g}`, g === "jpeg" ? 0.9 : void 0);
6377
6444
  });
6378
- } catch (n) {
6379
- return console.error("Error exporting section as blob:", n), null;
6445
+ } catch (c) {
6446
+ return console.error("Error exporting section as blob:", c), null;
6380
6447
  }
6381
6448
  }
6382
- async exportCurrentSectionAsJSON(o, a = "png") {
6383
- var I, y, E, B, b, F, J, C, O;
6384
- const l = ((I = o.activeSection) == null ? void 0 : I.sectionName) || "main", s = {
6449
+ async exportCurrentSectionAsJSON(o, a = "png", l = null) {
6450
+ var B, j, p;
6451
+ const s = ((B = o.activeSection) == null ? void 0 : B.sectionName) || "main";
6452
+ let g = ((j = o.activeSection) == null ? void 0 : j.sectionImage) || ((p = o.activeSection) == null ? void 0 : p.image);
6453
+ l && l.sectionImage && (s === "Front" || l.sections && Object.keys(l.sections).includes(s)) && (g = l.sectionImage);
6454
+ const h = {
6385
6455
  elements: o.elements,
6386
6456
  selectedColor: o.selectedColor,
6387
6457
  canvasWidth: o.canvasWidth,
6388
6458
  canvasHeight: o.canvasHeight,
6389
- // Include background information
6390
- backgroundImage: ((y = o.activeSection) == null ? void 0 : y.sectionImage) || ((E = o.activeSection) == null ? void 0 : E.image),
6391
- sectionImage: ((B = o.activeSection) == null ? void 0 : B.sectionImage) || ((b = o.activeSection) == null ? void 0 : b.image),
6392
- sectionName: l,
6459
+ // Include background information using the determined image
6460
+ backgroundImage: g,
6461
+ sectionImage: g,
6462
+ sectionName: s,
6393
6463
  zoomLevel: o.zoomLevel,
6394
6464
  showGrid: o.showGrid,
6395
6465
  snapToGrid: o.snapToGrid
6396
- }, h = {
6397
- id: l,
6398
- sectionName: l,
6399
- image: (F = o.activeSection) == null ? void 0 : F.sectionImage,
6400
- sectionImage: (J = o.activeSection) == null ? void 0 : J.sectionImage
6401
- }, x = [], n = [], d = await this.exportSectionAsBlob(
6402
- s,
6466
+ }, n = {
6467
+ id: s,
6468
+ sectionName: s,
6469
+ image: g,
6470
+ sectionImage: g
6471
+ }, c = [], F = [], I = await this.exportSectionAsBlob(
6403
6472
  h,
6473
+ n,
6404
6474
  o.canvasWidth,
6405
6475
  o.canvasHeight,
6406
6476
  a,
6407
- !0
6477
+ !0,
6478
+ l
6479
+ // Pass initData to exportSectionAsBlob
6408
6480
  );
6409
- if (d) {
6481
+ if (I) {
6410
6482
  const v = await this.blobToFile(
6411
- d,
6412
- `${l}-full.${a}`,
6483
+ I,
6484
+ `${s}-full.${a}`,
6413
6485
  `image/${a}`
6414
6486
  );
6415
- x.push({
6416
- sectionName: l,
6487
+ c.push({
6488
+ sectionName: s,
6417
6489
  sectionImage: v
6418
6490
  });
6419
6491
  }
6420
- const j = await this.exportSectionAsBlob(
6421
- s,
6492
+ const E = await this.exportSectionAsBlob(
6422
6493
  h,
6494
+ n,
6423
6495
  o.canvasWidth,
6424
6496
  o.canvasHeight,
6425
6497
  a,
6426
- !1
6498
+ !1,
6499
+ l
6500
+ // Pass initData to exportSectionAsBlob
6427
6501
  );
6428
- if (j) {
6502
+ if (E) {
6429
6503
  const v = await this.blobToFile(
6430
- j,
6431
- `${l}-print.${a}`,
6504
+ E,
6505
+ `${s}-print.${a}`,
6432
6506
  `image/${a}`
6433
6507
  );
6434
- n.push({
6435
- sectionName: l,
6508
+ F.push({
6509
+ sectionName: s,
6436
6510
  sectionImage: v
6437
6511
  });
6438
6512
  }
6439
- const S = {
6440
- sections: { [l]: s },
6513
+ const m = {
6514
+ sections: { [s]: h },
6441
6515
  canvasWidth: o.canvasWidth,
6442
6516
  canvasHeight: o.canvasHeight,
6517
+ sectionImage: g,
6518
+ // Use the determined image here too
6443
6519
  format: a,
6444
6520
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
6445
6521
  version: "1.0",
6522
+ // Include initData information if present
6523
+ ...l && {
6524
+ initData: {
6525
+ sectionImage: l.sectionImage,
6526
+ sections: l.sections ? Object.keys(l.sections) : []
6527
+ }
6528
+ },
6446
6529
  // Include product information for complete context
6447
6530
  productInfo: {
6448
6531
  sections: [{
6449
- sectionName: l,
6450
- sectionImage: ((C = o.activeSection) == null ? void 0 : C.sectionImage) || ((O = o.activeSection) == null ? void 0 : O.image),
6451
- id: l
6532
+ sectionName: s,
6533
+ sectionImage: g,
6534
+ // Use the determined image here too
6535
+ id: s
6452
6536
  }]
6453
6537
  }
6454
6538
  };
6455
6539
  return {
6456
- fullDesign: x,
6457
- printReady: n,
6458
- designFile: JSON.stringify(S)
6540
+ fullDesign: c,
6541
+ printReady: F,
6542
+ designFile: JSON.stringify(m)
6459
6543
  };
6460
6544
  }
6461
6545
  }
@@ -6467,10 +6551,10 @@ class di {
6467
6551
  saveDesign(o, a) {
6468
6552
  var l;
6469
6553
  try {
6470
- const s = this.generateDesignId(o), h = (/* @__PURE__ */ new Date()).toISOString(), x = {
6554
+ const s = this.generateDesignId(o), g = (/* @__PURE__ */ new Date()).toISOString(), h = {
6471
6555
  id: s,
6472
6556
  name: o,
6473
- timestamp: h,
6557
+ timestamp: g,
6474
6558
  version: "1.0",
6475
6559
  canvasData: {
6476
6560
  elements: a.elements || [],
@@ -6486,11 +6570,11 @@ class di {
6486
6570
  },
6487
6571
  metadata: {
6488
6572
  elementCount: ((l = a.elements) == null ? void 0 : l.length) || 0,
6489
- lastModified: h,
6573
+ lastModified: g,
6490
6574
  thumbnail: a.thumbnail || null
6491
6575
  }
6492
6576
  };
6493
- return this.storage.setItem(this.STORAGE_PREFIX + s, JSON.stringify(x)), this.updateDesignsList(s, o, h), { success: !0, designId: s, message: "Design saved successfully" };
6577
+ return this.storage.setItem(this.STORAGE_PREFIX + s, JSON.stringify(h)), this.updateDesignsList(s, o, g), { success: !0, designId: s, message: "Design saved successfully" };
6494
6578
  } catch (s) {
6495
6579
  return console.error("Error saving design:", s), { success: !1, error: s.message };
6496
6580
  }
@@ -6500,10 +6584,10 @@ class di {
6500
6584
  try {
6501
6585
  let a = o;
6502
6586
  if (!o.startsWith("design_")) {
6503
- const x = this.getAllDesigns().find((n) => n.name === o);
6504
- if (!x)
6587
+ const h = this.getAllDesigns().find((n) => n.name === o);
6588
+ if (!h)
6505
6589
  return { success: !1, error: "Design not found" };
6506
- a = x.id;
6590
+ a = h.id;
6507
6591
  }
6508
6592
  const l = this.storage.getItem(this.STORAGE_PREFIX + a);
6509
6593
  return l ? { success: !0, data: JSON.parse(l) } : { success: !1, error: "Design not found" };
@@ -6536,8 +6620,8 @@ class di {
6536
6620
  const a = this.loadDesign(o);
6537
6621
  if (!a.success)
6538
6622
  return a;
6539
- const l = a.data, s = JSON.stringify(l, null, 2), h = new Blob([s], { type: "application/json" }), x = URL.createObjectURL(h), n = document.createElement("a");
6540
- return n.href = x, n.download = `${l.name}_${l.id}.json`, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(x), { success: !0, message: "Design exported successfully" };
6623
+ const l = a.data, s = JSON.stringify(l, null, 2), g = new Blob([s], { type: "application/json" }), h = URL.createObjectURL(g), n = document.createElement("a");
6624
+ return n.href = h, n.download = `${l.name}_${l.id}.json`, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(h), { success: !0, message: "Design exported successfully" };
6541
6625
  } catch (a) {
6542
6626
  return console.error("Error exporting design:", a), { success: !1, error: a.message };
6543
6627
  }
@@ -6549,13 +6633,13 @@ class di {
6549
6633
  const l = new FileReader();
6550
6634
  l.onload = (s) => {
6551
6635
  try {
6552
- const h = JSON.parse(s.target.result);
6553
- if (!this.validateDesignData(h)) {
6636
+ const g = JSON.parse(s.target.result);
6637
+ if (!this.validateDesignData(g)) {
6554
6638
  a({ success: !1, error: "Invalid design file format" });
6555
6639
  return;
6556
6640
  }
6557
- const x = this.generateDesignId(h.name + "_imported");
6558
- h.id = x, h.name += "_imported", h.timestamp = (/* @__PURE__ */ new Date()).toISOString(), h.metadata.lastModified = h.timestamp, this.storage.setItem(this.STORAGE_PREFIX + x, JSON.stringify(h)), this.updateDesignsList(x, h.name, h.timestamp), a({ success: !0, data: h, message: "Design imported successfully" });
6641
+ const h = this.generateDesignId(g.name + "_imported");
6642
+ g.id = h, g.name += "_imported", g.timestamp = (/* @__PURE__ */ new Date()).toISOString(), g.metadata.lastModified = g.timestamp, this.storage.setItem(this.STORAGE_PREFIX + h, JSON.stringify(g)), this.updateDesignsList(h, g.name, g.timestamp), a({ success: !0, data: g, message: "Design imported successfully" });
6559
6643
  } catch {
6560
6644
  a({ success: !1, error: "Failed to parse design file" });
6561
6645
  }
@@ -6623,13 +6707,13 @@ class di {
6623
6707
  return `design_${a}_${l}`;
6624
6708
  }
6625
6709
  updateDesignsList(o, a, l) {
6626
- const s = this.getAllDesigns(), h = s.findIndex((n) => n.id === o), x = {
6710
+ const s = this.getAllDesigns(), g = s.findIndex((n) => n.id === o), h = {
6627
6711
  id: o,
6628
6712
  name: a,
6629
6713
  timestamp: l,
6630
6714
  lastModified: l
6631
6715
  };
6632
- 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));
6716
+ g >= 0 ? s[g] = h : s.push(h), s.sort((n, c) => new Date(c.timestamp) - new Date(n.timestamp)), this.storage.setItem(this.DESIGNS_LIST_KEY, JSON.stringify(s));
6633
6717
  }
6634
6718
  validateDesignData(o) {
6635
6719
  return o && o.id && o.name && o.canvasData && Array.isArray(o.canvasData.elements);
@@ -6679,45 +6763,45 @@ const fi = $e((f, o) => {
6679
6763
  }
6680
6764
  ]
6681
6765
  },
6682
- initFile: h
6683
- } = f, [x, n] = N([]), [d, j] = N(null), [S, I] = N(!1), [y, E] = N(!1), [B, b] = N(!1), [F, J] = N({ x: 0, y: 0 }), [C, O] = N(null), [v, st] = N(800), [W, xt] = N(600), [Q, ft] = N(1), [q, at] = N(s.colorSettings[0]), [M, nt] = N(!1), [Z, ct] = N(!0), [_, P] = N(!0), [T, tt] = N(s.sections[0]), [u, D] = N(!1), [L, H] = N({}), [G, et] = N([]), [X, Y] = N(-1), [U] = N(new di("localStorage")), K = gt(null), vt = gt(null), mt = gt(null), pt = gt(null), Ot = gt(null), Et = gt(new ci()), Bt = gt(!1), [zt, ce] = N(null), lt = rt(() => {
6766
+ initFile: g
6767
+ } = f, [h, n] = N([]), [c, F] = N(null), [I, E] = N(!1), [m, B] = N(!1), [j, p] = N(!1), [v, X] = N({ x: 0, y: 0 }), [T, O] = N(null), [k, Z] = N(800), [W, xt] = N(600), [Q, ft] = N(1), [_, st] = N(s.colorSettings[0]), [M, nt] = N(!1), [tt, ct] = N(!0), [Y, P] = N(!0), [C, et] = N(s.sections[0]), [y, D] = N(!1), [L, H] = N({}), [G, it] = N([]), [J, q] = N(-1), [U] = N(new di("localStorage")), K = gt(null), kt = gt(null), pt = gt(null), wt = gt(null), Ot = gt(null), Bt = gt(new ci()), zt = gt(!1), [yt, ce] = N(null), lt = at(() => {
6684
6768
  const e = {
6685
- elements: JSON.parse(JSON.stringify(x)),
6686
- selectedElement: d ? { ...d } : null,
6769
+ elements: JSON.parse(JSON.stringify(h)),
6770
+ selectedElement: c ? { ...c } : null,
6687
6771
  timestamp: Date.now()
6688
- }, t = G.slice(0, X + 1);
6689
- t.push(e), t.length > 50 ? t.shift() : Y(X + 1), et(t);
6690
- }, [x, d, G, X]), kt = rt(() => ({
6691
- elements: x,
6692
- canvasWidth: v,
6772
+ }, t = G.slice(0, J + 1);
6773
+ t.push(e), t.length > 50 ? t.shift() : q(J + 1), it(t);
6774
+ }, [h, c, G, J]), St = at(() => ({
6775
+ elements: h,
6776
+ canvasWidth: k,
6693
6777
  canvasHeight: W,
6694
- selectedColor: q,
6695
- activeSection: T,
6778
+ selectedColor: _,
6779
+ activeSection: C,
6696
6780
  product: s,
6697
6781
  sectionDesigns: L,
6698
6782
  zoomLevel: Q,
6699
6783
  showGrid: M,
6700
- snapToGrid: _,
6701
- selectedElement: d ? { ...d } : null,
6784
+ snapToGrid: Y,
6785
+ selectedElement: c ? { ...c } : null,
6702
6786
  canvasRef: K
6703
6787
  // Include reference for thumbnail generation
6704
- }), [x, v, W, q, T, s, L, Q, M, _, d]);
6705
- ot(() => {
6788
+ }), [h, k, W, _, C, s, L, Q, M, Y, c]);
6789
+ rt(() => {
6706
6790
  const t = setTimeout(async () => {
6707
- if (x.length === 0 && G.length <= 1) {
6708
- if (h)
6791
+ if (h.length === 0 && G.length <= 1) {
6792
+ if (g)
6709
6793
  try {
6710
- const A = await fetch(h);
6794
+ const A = await fetch(g);
6711
6795
  if (A.ok) {
6712
6796
  const z = await A.text();
6713
6797
  if (z.trim()) {
6714
6798
  const $ = JSON.parse(z.trim());
6715
6799
  if (console.log("Loading design from file:", $), ce($), $.sections && typeof $.sections == "object") {
6716
- const dt = Object.keys($.sections)[0], it = $.sections[dt];
6717
- if (it && it.elements) {
6718
- n(it.elements || []), st(it.canvasWidth || 800), xt(it.canvasHeight || 600), at(it.selectedColor || s.colorSettings[0]), ft(it.zoomLevel || 1), nt(it.showGrid || !1), P(it.snapToGrid || !0), j(null), $.sections && H($.sections);
6719
- const It = s.sections.find((Rt) => Rt.sectionName === dt);
6720
- It && tt(It), et([]), Y(-1), setTimeout(() => {
6800
+ const dt = Object.keys($.sections)[0], ot = $.sections[dt];
6801
+ if (ot && ot.elements) {
6802
+ n(ot.elements || []), Z(ot.canvasWidth || 800), xt(ot.canvasHeight || 600), st(ot.selectedColor || s.colorSettings[0]), ft(ot.zoomLevel || 1), nt(ot.showGrid || !1), P(ot.snapToGrid || !0), F(null), $.sections && H($.sections);
6803
+ const Rt = s.sections.find((Dt) => Dt.sectionName === dt);
6804
+ Rt && et(Rt), it([]), q(-1), setTimeout(() => {
6721
6805
  lt();
6722
6806
  }, 100);
6723
6807
  return;
@@ -6729,20 +6813,20 @@ const fi = $e((f, o) => {
6729
6813
  } catch (A) {
6730
6814
  console.error("Error loading design file:", A), console.warn("Using default text instead");
6731
6815
  }
6732
- const r = 24, c = "Arial", g = "Change me", p = document.createElement("canvas").getContext("2d");
6733
- p.font = `${r}px ${c}`;
6734
- const w = p.measureText(g).width, R = {
6816
+ const r = 24, d = "Arial", x = "Change me", w = document.createElement("canvas").getContext("2d");
6817
+ w.font = `${r}px ${d}`;
6818
+ const b = w.measureText(x).width, R = {
6735
6819
  id: ht(),
6736
6820
  type: "text",
6737
- x: v / 2 - w / 2,
6821
+ x: k / 2 - b / 2,
6738
6822
  // Center the actual text width
6739
6823
  y: W / 2 - r / 2,
6740
6824
  // Center based on font size
6741
- width: w,
6825
+ width: b,
6742
6826
  height: r,
6743
- text: g,
6827
+ text: x,
6744
6828
  fontSize: r,
6745
- fontFamily: c,
6829
+ fontFamily: d,
6746
6830
  fontWeight: "normal",
6747
6831
  fontStyle: "normal",
6748
6832
  textAlign: "left",
@@ -6753,29 +6837,30 @@ const fi = $e((f, o) => {
6753
6837
  rotation: 0,
6754
6838
  opacity: 1
6755
6839
  };
6756
- n([R]), j(R), setTimeout(() => {
6840
+ n([R]), F(R), setTimeout(() => {
6757
6841
  lt();
6758
6842
  }, 100);
6759
6843
  }
6760
6844
  }, 300);
6761
6845
  return () => clearTimeout(t);
6762
- }, [h, s.colorSettings, s.sections]);
6763
- const Wt = rt((e = "png", t = !0) => {
6764
- const r = kt();
6765
- return s.sections, Et.current.exportAllSections(
6766
- { [(T == null ? void 0 : T.sectionName) || "main"]: r },
6846
+ }, [g, s.colorSettings, s.sections]);
6847
+ const Wt = at((e = "png", t = !0) => {
6848
+ const r = St();
6849
+ return s.sections, Bt.current.exportAllSections(
6850
+ { [(C == null ? void 0 : C.sectionName) || "main"]: r },
6767
6851
  [{
6768
- id: (T == null ? void 0 : T.sectionName) || "main",
6769
- sectionName: (T == null ? void 0 : T.sectionName) || "main",
6770
- image: T == null ? void 0 : T.sectionImage,
6771
- sectionImage: T == null ? void 0 : T.sectionImage
6852
+ id: (C == null ? void 0 : C.sectionName) || "main",
6853
+ sectionName: (C == null ? void 0 : C.sectionName) || "main",
6854
+ image: C == null ? void 0 : C.sectionImage,
6855
+ sectionImage: C == null ? void 0 : C.sectionImage
6772
6856
  }],
6773
- v,
6857
+ k,
6774
6858
  W,
6775
6859
  e,
6776
- t
6860
+ t,
6861
+ yt
6777
6862
  );
6778
- }, [kt, s.sections, T, v, W]), de = [
6863
+ }, [St, s.sections, C, k, W]), de = [
6779
6864
  "Arial",
6780
6865
  "Helvetica",
6781
6866
  "Times New Roman",
@@ -6791,18 +6876,18 @@ const fi = $e((f, o) => {
6791
6876
  "Bookman",
6792
6877
  "Avant Garde",
6793
6878
  "Century Gothic"
6794
- ], Nt = 20;
6795
- ot(() => {
6879
+ ], It = 20;
6880
+ rt(() => {
6796
6881
  const e = () => D(window.innerWidth < 768);
6797
6882
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
6798
- }, []), ot(() => {
6883
+ }, []), rt(() => {
6799
6884
  const e = document.createElement("canvas");
6800
- e.width = v, e.height = W, Ot.current = e;
6801
- }, [v, W]), ot(() => {
6885
+ e.width = k, e.height = W, Ot.current = e;
6886
+ }, [k, W]), rt(() => {
6802
6887
  G.length === 0 && lt();
6803
6888
  }, []);
6804
- const At = (e, t, r, c, g, m) => {
6805
- e.beginPath(), e.moveTo(t + m, r), e.lineTo(t + c - m, r), e.quadraticCurveTo(t + c, r, t + c, r + m), e.lineTo(t + c, r + g - m), e.quadraticCurveTo(t + c, r + g, t + c - m, r + g), e.lineTo(t + m, r + g), e.quadraticCurveTo(t, r + g, t, r + g - m), e.lineTo(t, r + m), e.quadraticCurveTo(t, r, t + m, r), e.closePath();
6889
+ const At = (e, t, r, d, x, u) => {
6890
+ e.beginPath(), e.moveTo(t + u, r), e.lineTo(t + d - u, r), e.quadraticCurveTo(t + d, r, t + d, r + u), e.lineTo(t + d, r + x - u), e.quadraticCurveTo(t + d, r + x, t + d - u, r + x), e.lineTo(t + u, r + x), e.quadraticCurveTo(t, r + x, t, r + x - u), e.lineTo(t, r + u), e.quadraticCurveTo(t, r, t + u, r), e.closePath();
6806
6891
  }, Qt = (e, t) => {
6807
6892
  if (!t.isIcon)
6808
6893
  return {
@@ -6814,126 +6899,129 @@ const fi = $e((f, o) => {
6814
6899
  cy: t.y + t.height / 2
6815
6900
  };
6816
6901
  e.save(), e.font = `${t.fontStyle || ""} ${t.fontWeight || ""} ${t.fontSize}px ${t.fontFamily}`, e.textBaseline = "alphabetic", e.textAlign = "left";
6817
- const r = e.measureText(t.text), c = r.actualBoundingBoxAscent ?? t.fontSize * 0.8, g = r.actualBoundingBoxDescent ?? t.fontSize * 0.2, m = r.actualBoundingBoxLeft ?? 0, p = r.actualBoundingBoxRight ?? r.width, k = m + p, w = c + g, R = t.x, A = t.y, z = R - k / 2 - m, $ = A - w / 2 - c;
6818
- return e.restore(), { x: z, y: $, width: k, height: w, cx: R, cy: A };
6902
+ const r = e.measureText(t.text), d = r.actualBoundingBoxAscent ?? t.fontSize * 0.8, x = r.actualBoundingBoxDescent ?? t.fontSize * 0.2, u = r.actualBoundingBoxLeft ?? 0, w = r.actualBoundingBoxRight ?? r.width, S = u + w, b = d + x, R = t.x, A = t.y, z = R - S / 2 - u, $ = A - b / 2 - d;
6903
+ return e.restore(), { x: z, y: $, width: S, height: b, cx: R, cy: A };
6819
6904
  }, fe = (e, t) => {
6820
6905
  if (!t) return;
6821
- const r = 8, c = 8, g = 4, m = 30, p = Qt(e, t), k = t.isIcon ? Math.max(r, 12) : r, w = {
6822
- x: -p.width / 2 - k,
6823
- y: -p.height / 2 - k,
6824
- w: p.width + k * 2,
6825
- h: p.height + k * 2
6906
+ const r = 8, d = 8, x = 4, u = 30, w = Qt(e, t), S = t.isIcon ? Math.max(r, 12) : r, b = {
6907
+ x: -w.width / 2 - S,
6908
+ y: -w.height / 2 - S,
6909
+ w: w.width + S * 2,
6910
+ h: w.height + S * 2
6826
6911
  };
6827
- e.save(), e.translate(p.cx, p.cy), t.rotation && e.rotate(t.rotation * Math.PI / 180);
6912
+ e.save(), e.translate(w.cx, w.cy), t.rotation && e.rotate(t.rotation * Math.PI / 180);
6828
6913
  const R = e.createLinearGradient(
6829
- w.x,
6830
- w.y,
6831
- w.x + w.w,
6832
- w.y + w.h
6914
+ b.x,
6915
+ b.y,
6916
+ b.x + b.w,
6917
+ b.y + b.h
6833
6918
  );
6834
6919
  R.addColorStop(0, "#3b82f6"), R.addColorStop(0.5, "#1d4ed8"), R.addColorStop(1, "#3b82f6"), e.strokeStyle = "rgba(59,130,246,.3)", e.lineWidth = 3, At(
6835
6920
  e,
6836
- w.x - 1,
6837
- w.y - 1,
6838
- w.w + 2,
6839
- w.h + 2,
6840
- g + 1
6841
- ), e.stroke(), e.strokeStyle = R, e.lineWidth = 2, e.setLineDash([8, 4]), At(e, w.x, w.y, w.w, w.h, g), e.stroke(), e.lineDashOffset = -(Date.now() / 50) % 12, e.strokeStyle = "#ffffff", e.lineWidth = 1, e.setLineDash([4, 8]), At(e, w.x, w.y, w.w, w.h, g), e.stroke(), e.setLineDash([]), e.lineDashOffset = 0, [
6842
- { x: w.x, y: w.y },
6843
- { x: w.x + w.w, y: w.y },
6844
- { x: w.x + w.w, y: w.y + w.h },
6845
- { x: w.x, y: w.y + w.h }
6921
+ b.x - 1,
6922
+ b.y - 1,
6923
+ b.w + 2,
6924
+ b.h + 2,
6925
+ x + 1
6926
+ ), e.stroke(), e.strokeStyle = R, e.lineWidth = 2, e.setLineDash([8, 4]), At(e, b.x, b.y, b.w, b.h, x), e.stroke(), e.lineDashOffset = -(Date.now() / 50) % 12, e.strokeStyle = "#ffffff", e.lineWidth = 1, e.setLineDash([4, 8]), At(e, b.x, b.y, b.w, b.h, x), e.stroke(), e.setLineDash([]), e.lineDashOffset = 0, [
6927
+ { x: b.x, y: b.y },
6928
+ { x: b.x + b.w, y: b.y },
6929
+ { x: b.x + b.w, y: b.y + b.h },
6930
+ { x: b.x, y: b.y + b.h }
6846
6931
  ].forEach(($) => {
6847
6932
  e.fillStyle = "rgba(0,0,0,.2)", e.fillRect(
6848
- $.x - c / 2 + 1,
6849
- $.y - c / 2 + 1,
6850
- c,
6851
- c
6933
+ $.x - d / 2 + 1,
6934
+ $.y - d / 2 + 1,
6935
+ d,
6936
+ d
6852
6937
  ), e.fillStyle = "#ffffff", e.fillRect(
6853
- $.x - c / 2,
6854
- $.y - c / 2,
6855
- c,
6856
- c
6938
+ $.x - d / 2,
6939
+ $.y - d / 2,
6940
+ d,
6941
+ d
6857
6942
  ), e.strokeStyle = "#3b82f6", e.lineWidth = 1, e.strokeRect(
6858
- $.x - c / 2,
6859
- $.y - c / 2,
6860
- c,
6861
- c
6943
+ $.x - d / 2,
6944
+ $.y - d / 2,
6945
+ d,
6946
+ d
6862
6947
  );
6863
6948
  });
6864
- const A = 0, z = w.y - m;
6865
- e.strokeStyle = "#3b82f6", e.lineWidth = 1, e.setLineDash([2, 2]), e.beginPath(), e.moveTo(A, z + 12), e.lineTo(A, w.y), e.stroke(), e.setLineDash([]), e.beginPath(), e.arc(A, z, 12, 0, 2 * Math.PI), e.fillStyle = "#f59e0b", e.fill(), e.strokeStyle = "#ffffff", e.lineWidth = 2, e.stroke(), e.strokeStyle = "#ffffff", e.lineWidth = 2, e.beginPath(), e.arc(A, z, 6, -Math.PI / 2, Math.PI, !1), e.stroke(), e.beginPath(), e.moveTo(A - 6, z), e.lineTo(A - 3, z - 3), e.lineTo(A - 3, z + 3), e.closePath(), e.fillStyle = "#ffffff", e.fill(), e.restore();
6949
+ const A = 0, z = b.y - u;
6950
+ e.strokeStyle = "#3b82f6", e.lineWidth = 1, e.setLineDash([2, 2]), e.beginPath(), e.moveTo(A, z + 12), e.lineTo(A, b.y), e.stroke(), e.setLineDash([]), e.beginPath(), e.arc(A, z, 12, 0, 2 * Math.PI), e.fillStyle = "#f59e0b", e.fill(), e.strokeStyle = "#ffffff", e.lineWidth = 2, e.stroke(), e.strokeStyle = "#ffffff", e.lineWidth = 2, e.beginPath(), e.arc(A, z, 6, -Math.PI / 2, Math.PI, !1), e.stroke(), e.beginPath(), e.moveTo(A - 6, z), e.lineTo(A - 3, z - 3), e.lineTo(A - 3, z + 3), e.closePath(), e.fillStyle = "#ffffff", e.fill(), e.restore();
6866
6951
  }, he = (e, t) => {
6867
6952
  if (!t) return [];
6868
- const r = Qt(e, t), c = t.isIcon ? Math.max(8, 12) : 8, g = 8, m = 30, p = (t.rotation || 0) * Math.PI / 180, k = {
6869
- x: -r.width / 2 - c,
6870
- y: -r.height / 2 - c,
6871
- w: r.width + c * 2,
6872
- h: r.height + c * 2
6873
- }, w = [
6874
- { x: k.x, y: k.y, type: "nw-resize" },
6875
- { x: k.x + k.w, y: k.y, type: "ne-resize" },
6876
- { x: k.x + k.w, y: k.y + k.h, type: "se-resize" },
6877
- { x: k.x, y: k.y + k.h, type: "sw-resize" },
6878
- { x: 0, y: k.y - m, type: "rotate" }
6879
- ], R = Math.cos(p), A = Math.sin(p);
6880
- return w.map((z) => ({
6953
+ const r = Qt(e, t), d = t.isIcon ? Math.max(8, 12) : 8, x = 8, u = 30, w = (t.rotation || 0) * Math.PI / 180, S = {
6954
+ x: -r.width / 2 - d,
6955
+ y: -r.height / 2 - d,
6956
+ w: r.width + d * 2,
6957
+ h: r.height + d * 2
6958
+ }, b = [
6959
+ { x: S.x, y: S.y, type: "nw-resize" },
6960
+ { x: S.x + S.w, y: S.y, type: "ne-resize" },
6961
+ { x: S.x + S.w, y: S.y + S.h, type: "se-resize" },
6962
+ { x: S.x, y: S.y + S.h, type: "sw-resize" },
6963
+ { x: 0, y: S.y - u, type: "rotate" }
6964
+ ], R = Math.cos(w), A = Math.sin(w);
6965
+ return b.map((z) => ({
6881
6966
  x: r.cx + (z.x * R - z.y * A),
6882
6967
  y: r.cy + (z.x * A + z.y * R),
6883
6968
  type: z.type,
6884
- size: z.type === "rotate" ? 24 : g
6969
+ size: z.type === "rotate" ? 24 : x
6885
6970
  }));
6886
6971
  }, $t = (e, t, r) => {
6887
6972
  if (!r) return null;
6888
- const c = K.current;
6889
- if (!c) return null;
6890
- const g = c.getContext("2d"), m = he(g, r);
6891
- for (const p of m) {
6892
- const k = e - p.x, w = t - p.y;
6893
- if (Math.sqrt(k * k + w * w) <= p.size / 2)
6894
- return p.type;
6973
+ const d = K.current;
6974
+ if (!d) return null;
6975
+ const x = d.getContext("2d"), u = he(x, r);
6976
+ for (const w of u) {
6977
+ const S = e - w.x, b = t - w.y;
6978
+ if (Math.sqrt(S * S + b * b) <= w.size / 2)
6979
+ return w.type;
6895
6980
  }
6896
6981
  return null;
6897
- }, St = rt(() => {
6898
- if (X > 0) {
6899
- const e = G[X - 1];
6900
- n(e.elements), j(e.selectedElement), Y(X - 1);
6982
+ }, Ft = at(() => {
6983
+ if (J > 0) {
6984
+ const e = G[J - 1];
6985
+ n(e.elements), F(e.selectedElement), q(J - 1);
6901
6986
  }
6902
- }, [G, X]), wt = rt(() => {
6903
- if (X < G.length - 1) {
6904
- const e = G[X + 1];
6905
- n(e.elements), j(e.selectedElement), Y(X + 1);
6987
+ }, [G, J]), bt = at(() => {
6988
+ if (J < G.length - 1) {
6989
+ const e = G[J + 1];
6990
+ n(e.elements), F(e.selectedElement), q(J + 1);
6906
6991
  }
6907
- }, [G, X]), ut = (e) => _ ? Math.round(e / Nt) * Nt : e;
6908
- ot(() => {
6909
- if (T != null && T.sectionImage) {
6910
- mt.current = null, pt.current = null;
6992
+ }, [G, J]), ut = (e) => Y ? Math.round(e / It) * It : e;
6993
+ rt(() => {
6994
+ if (C != null && C.sectionImage) {
6995
+ pt.current = null, wt.current = null;
6911
6996
  const e = K.current;
6912
- e && (e.getContext("2d").clearRect(0, 0, v, W), console.log("cleared canvas"));
6997
+ if (e && e.getContext("2d").clearRect(0, 0, k, W), g && !yt)
6998
+ return;
6913
6999
  const t = new Image();
6914
7000
  t.crossOrigin = "anonymous", t.onload = () => {
6915
- mt.current = t, Xt(t, q);
7001
+ pt.current = t, Xt(t, _);
6916
7002
  }, t.onerror = () => {
6917
- console.error("Failed to load background image:", T.sectionImage), V();
6918
- }, t.src = zt ? zt.sectionImage : T.sectionImage;
7003
+ console.error("Failed to load background image:", C.sectionImage), V();
7004
+ };
7005
+ let r = C.sectionImage;
7006
+ yt && yt.sectionImage && (C.sectionName === "Front" || yt.sections && Object.keys(yt.sections).includes(C.sectionName)) && (r = yt.sectionImage), t.src = r;
6919
7007
  } else
6920
- mt.current = null, pt.current = null, V();
6921
- }, [T, zt]), ot(() => {
7008
+ pt.current = null, wt.current = null, V();
7009
+ }, [C, _, yt]), rt(() => {
6922
7010
  const e = (t) => {
6923
7011
  const r = document.activeElement;
6924
7012
  if (!(r && (r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.tagName === "SELECT" || r.isContentEditable))) {
6925
- if ((t.key === "Delete" || t.key === "Backspace") && d && !l) {
7013
+ if ((t.key === "Delete" || t.key === "Backspace") && c && !l) {
6926
7014
  t.preventDefault();
6927
- const g = d;
6928
- n((m) => m.filter((p) => p.id !== g.id)), j(null), lt();
7015
+ const x = c;
7016
+ n((u) => u.filter((w) => w.id !== x.id)), F(null), lt();
6929
7017
  }
6930
7018
  if (t.ctrlKey || t.metaKey)
6931
7019
  switch (t.key) {
6932
7020
  case "z":
6933
- t.shiftKey ? (t.preventDefault(), wt()) : (t.preventDefault(), St());
7021
+ t.shiftKey ? (t.preventDefault(), bt()) : (t.preventDefault(), Ft());
6934
7022
  break;
6935
7023
  case "y":
6936
- t.preventDefault(), wt();
7024
+ t.preventDefault(), bt();
6937
7025
  break;
6938
7026
  }
6939
7027
  }
@@ -6941,7 +7029,7 @@ const fi = $e((f, o) => {
6941
7029
  return document.addEventListener("keydown", e), () => {
6942
7030
  document.removeEventListener("keydown", e);
6943
7031
  };
6944
- }, [d, l, St, wt, lt]);
7032
+ }, [c, l, Ft, bt, lt]);
6945
7033
  const ge = (e) => {
6946
7034
  const t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
6947
7035
  return t ? {
@@ -6951,15 +7039,15 @@ const fi = $e((f, o) => {
6951
7039
  } : null;
6952
7040
  }, ht = () => `element_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, xe = (e) => {
6953
7041
  e.strokeStyle = "#e0e0e0", e.lineWidth = 1, e.setLineDash([1, 1]);
6954
- for (let t = 0; t <= v; t += Nt)
7042
+ for (let t = 0; t <= k; t += It)
6955
7043
  e.beginPath(), e.moveTo(t, 0), e.lineTo(t, W), e.stroke();
6956
- for (let t = 0; t <= W; t += Nt)
6957
- e.beginPath(), e.moveTo(0, t), e.lineTo(v, t), e.stroke();
7044
+ for (let t = 0; t <= W; t += It)
7045
+ e.beginPath(), e.moveTo(0, t), e.lineTo(k, t), e.stroke();
6958
7046
  e.setLineDash([]);
6959
7047
  }, ye = (e, t) => {
6960
7048
  e.save();
6961
- const r = t.x + t.width / 2, c = t.y + t.height / 2;
6962
- switch (e.translate(r, c), t.rotation && e.rotate(t.rotation * Math.PI / 180), e.translate(-t.width / 2, -t.height / 2), t.type) {
7049
+ const r = t.x + t.width / 2, d = t.y + t.height / 2;
7050
+ switch (e.translate(r, d), t.rotation && e.rotate(t.rotation * Math.PI / 180), e.translate(-t.width / 2, -t.height / 2), t.type) {
6963
7051
  case "text":
6964
7052
  pe(e, t);
6965
7053
  break;
@@ -6985,38 +7073,38 @@ const fi = $e((f, o) => {
6985
7073
  Ce(e, t);
6986
7074
  break;
6987
7075
  case "pentagon":
6988
- Te(e, t);
7076
+ je(e, t);
6989
7077
  break;
6990
7078
  case "heart":
6991
- je(e, t);
7079
+ Te(e, t);
6992
7080
  break;
6993
7081
  case "oval":
6994
7082
  Ne(e, t);
6995
7083
  break;
6996
7084
  case "roundedRectangle":
6997
- Ae(e, t);
7085
+ Ie(e, t);
6998
7086
  break;
6999
7087
  case "image":
7000
7088
  Re(e, t);
7001
7089
  break;
7002
7090
  case "qrcode":
7003
- me(e, t);
7091
+ ue(e, t);
7004
7092
  break;
7005
7093
  case "barcode":
7006
- ue(e, t);
7094
+ me(e, t);
7007
7095
  break;
7008
7096
  case "sticker":
7009
7097
  De(e, t);
7010
7098
  break;
7011
7099
  case "horizontalLine":
7012
- Ie(e, t);
7100
+ Ae(e, t);
7013
7101
  break;
7014
7102
  case "embroidery":
7015
7103
  Ee(e, t);
7016
7104
  break;
7017
7105
  }
7018
7106
  e.restore();
7019
- }, ue = (e, t) => {
7107
+ }, me = (e, t) => {
7020
7108
  if (t.imageObject)
7021
7109
  e.drawImage(t.imageObject, 0, 0, t.width, t.height);
7022
7110
  else if (t.src && !t.imageLoading) {
@@ -7024,19 +7112,19 @@ const fi = $e((f, o) => {
7024
7112
  const r = new Image();
7025
7113
  r.onload = () => {
7026
7114
  n(
7027
- (c) => c.map(
7028
- (g) => g.id === t.id ? { ...g, imageObject: r, imageLoading: !1 } : g
7115
+ (d) => d.map(
7116
+ (x) => x.id === t.id ? { ...x, imageObject: r, imageLoading: !1 } : x
7029
7117
  )
7030
7118
  );
7031
7119
  }, r.onerror = () => {
7032
7120
  n(
7033
- (c) => c.map(
7034
- (g) => g.id === t.id ? { ...g, imageLoading: !1 } : g
7121
+ (d) => d.map(
7122
+ (x) => x.id === t.id ? { ...x, imageLoading: !1 } : x
7035
7123
  )
7036
7124
  );
7037
7125
  }, r.src = t.src, e.fillStyle = "#f0f0f0", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ccc", e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#666", e.font = "12px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Loading...", t.width / 2, t.height / 2);
7038
7126
  } else t.imageLoading ? (e.fillStyle = "#f0f0f0", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ccc", e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#666", e.font = "12px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Loading...", t.width / 2, t.height / 2)) : (e.fillStyle = "#f0f0f0", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ccc", e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#666", e.font = "12px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("No Barcode", t.width / 2, t.height / 2));
7039
- }, me = (e, t) => {
7127
+ }, ue = (e, t) => {
7040
7128
  if (t.imageObject)
7041
7129
  e.drawImage(t.imageObject, 0, 0, t.width, t.height);
7042
7130
  else if (t.src && !t.imageLoading) {
@@ -7044,14 +7132,14 @@ const fi = $e((f, o) => {
7044
7132
  const r = new Image();
7045
7133
  r.onload = () => {
7046
7134
  n(
7047
- (c) => c.map(
7048
- (g) => g.id === t.id ? { ...g, imageObject: r, imageLoading: !1 } : g
7135
+ (d) => d.map(
7136
+ (x) => x.id === t.id ? { ...x, imageObject: r, imageLoading: !1 } : x
7049
7137
  )
7050
7138
  );
7051
7139
  }, r.onerror = () => {
7052
7140
  n(
7053
- (c) => c.map(
7054
- (g) => g.id === t.id ? { ...g, imageLoading: !1 } : g
7141
+ (d) => d.map(
7142
+ (x) => x.id === t.id ? { ...x, imageLoading: !1 } : x
7055
7143
  )
7056
7144
  );
7057
7145
  }, r.src = t.src, e.fillStyle = "#f0f0f0", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ccc", e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#666", e.font = "12px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Loading QR...", t.width / 2, t.height / 2);
@@ -7068,43 +7156,43 @@ const fi = $e((f, o) => {
7068
7156
  r = r.toLowerCase();
7069
7157
  break;
7070
7158
  case "capitalize":
7071
- r = r.replace(/\b\w/g, (k) => k.toUpperCase());
7159
+ r = r.replace(/\b\w/g, (S) => S.toUpperCase());
7072
7160
  break;
7073
7161
  }
7074
7162
  e.font = `${t.fontStyle || "normal"} ${t.fontWeight || "normal"} ${t.fontSize || 20}px ${t.fontFamily || "Arial"}`, e.fillStyle = t.fill || "#000000", e.textAlign = t.textAlign || "left", e.textBaseline = "top", t.opacity !== void 0 && (e.globalAlpha = t.opacity), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth);
7075
- const c = r.split(`
7076
- `), g = (t.fontSize || 20) * (t.lineHeight || 1.2), m = Math.max(...c.map((k) => e.measureText(k).width)), p = c.length * g;
7163
+ const d = r.split(`
7164
+ `), x = (t.fontSize || 20) * (t.lineHeight || 1.2), u = Math.max(...d.map((S) => e.measureText(S).width)), w = d.length * x;
7077
7165
  if (t.backgroundColor && t.backgroundColor !== "transparent") {
7078
7166
  e.fillStyle = t.backgroundColor;
7079
- const k = t.backgroundPadding || 4;
7167
+ const S = t.backgroundPadding || 4;
7080
7168
  e.fillRect(
7081
- -k,
7082
- -k,
7083
- m + k * 2,
7084
- p + k * 2
7169
+ -S,
7170
+ -S,
7171
+ u + S * 2,
7172
+ w + S * 2
7085
7173
  ), e.fillStyle = t.fill || "#000000";
7086
7174
  }
7087
- c.forEach((k, w) => {
7088
- const R = w * g, A = e.measureText(k).width;
7089
- t.stroke && t.strokeWidth > 0 && e.strokeText(k, 0, R), e.fillText(k, 0, R);
7175
+ d.forEach((S, b) => {
7176
+ const R = b * x, A = e.measureText(S).width;
7177
+ t.stroke && t.strokeWidth > 0 && e.strokeText(S, 0, R), e.fillText(S, 0, R);
7090
7178
  const z = t.fontSize || 20, $ = t.decorationColor || t.fill || "#000000", dt = Math.max(1, z / 20);
7091
7179
  if (e.strokeStyle = $, e.lineWidth = dt, t.textDecoration === "underline" || t.underline) {
7092
- const it = R + z + 2;
7093
- e.beginPath(), e.moveTo(0, it), e.lineTo(A, it), e.stroke();
7180
+ const ot = R + z + 2;
7181
+ e.beginPath(), e.moveTo(0, ot), e.lineTo(A, ot), e.stroke();
7094
7182
  }
7095
7183
  if (t.textDecoration === "overline" || t.overline) {
7096
- const it = R - 2;
7097
- e.beginPath(), e.moveTo(0, it), e.lineTo(A, it), e.stroke();
7184
+ const ot = R - 2;
7185
+ e.beginPath(), e.moveTo(0, ot), e.lineTo(A, ot), e.stroke();
7098
7186
  }
7099
7187
  if (t.textDecoration === "line-through" || t.strikethrough) {
7100
- const it = R + z / 2;
7101
- e.beginPath(), e.moveTo(0, it), e.lineTo(A, it), e.stroke();
7188
+ const ot = R + z / 2;
7189
+ e.beginPath(), e.moveTo(0, ot), e.lineTo(A, ot), e.stroke();
7102
7190
  }
7103
- typeof t.textDecoration == "string" && t.textDecoration.includes(" ") && t.textDecoration.split(" ").forEach((It) => {
7104
- switch (It.trim()) {
7191
+ typeof t.textDecoration == "string" && t.textDecoration.includes(" ") && t.textDecoration.split(" ").forEach((Rt) => {
7192
+ switch (Rt.trim()) {
7105
7193
  case "underline":
7106
- const Rt = R + z + 2;
7107
- e.beginPath(), e.moveTo(0, Rt), e.lineTo(A, Rt), e.stroke();
7194
+ const Dt = R + z + 2;
7195
+ e.beginPath(), e.moveTo(0, Dt), e.lineTo(A, Dt), e.stroke();
7108
7196
  break;
7109
7197
  case "overline":
7110
7198
  const te = R - 2;
@@ -7120,81 +7208,81 @@ const fi = $e((f, o) => {
7120
7208
  }, we = (e, t) => {
7121
7209
  t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fillRect(0, 0, t.width, t.height)), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.strokeRect(0, 0, t.width, t.height));
7122
7210
  }, be = (e, t) => {
7123
- const r = Math.min(t.width, t.height) / 2, c = t.width / 2, g = t.height / 2;
7124
- e.beginPath(), e.arc(c, g, r, 0, 2 * Math.PI), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7211
+ const r = Math.min(t.width, t.height) / 2, d = t.width / 2, x = t.height / 2;
7212
+ e.beginPath(), e.arc(d, x, r, 0, 2 * Math.PI), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7125
7213
  }, ve = (e, t) => {
7126
7214
  const r = t.width / 2;
7127
7215
  t.height / 2, e.beginPath(), e.moveTo(r, 0), e.lineTo(0, t.height), e.lineTo(t.width, t.height), e.closePath(), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7128
7216
  }, ke = (e, t) => {
7129
- const r = t.width / 2, c = t.height / 2, g = Math.min(t.width, t.height) / 2, m = g * 0.4, p = t.numPoints || 5;
7217
+ const r = t.width / 2, d = t.height / 2, x = Math.min(t.width, t.height) / 2, u = x * 0.4, w = t.numPoints || 5;
7130
7218
  e.beginPath();
7131
- for (let k = 0; k < p * 2; k++) {
7132
- const w = k % 2 === 0 ? g : m, R = k * Math.PI / p, A = r + Math.cos(R) * w, z = c + Math.sin(R) * w;
7133
- k === 0 ? e.moveTo(A, z) : e.lineTo(A, z);
7219
+ for (let S = 0; S < w * 2; S++) {
7220
+ const b = S % 2 === 0 ? x : u, R = S * Math.PI / w, A = r + Math.cos(R) * b, z = d + Math.sin(R) * b;
7221
+ S === 0 ? e.moveTo(A, z) : e.lineTo(A, z);
7134
7222
  }
7135
7223
  e.closePath(), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7136
7224
  }, Se = (e, t) => {
7137
- const r = t.width, c = t.height, g = r * 0.3;
7138
- e.beginPath(), e.moveTo(r / 2, 0), e.lineTo(r, c * 0.6), e.lineTo(r - g, c * 0.6), e.lineTo(r - g, c), e.lineTo(g, c), e.lineTo(g, c * 0.6), e.lineTo(0, c * 0.6), e.closePath(), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7225
+ const r = t.width, d = t.height, x = r * 0.3;
7226
+ e.beginPath(), e.moveTo(r / 2, 0), e.lineTo(r, d * 0.6), e.lineTo(r - x, d * 0.6), e.lineTo(r - x, d), e.lineTo(x, d), e.lineTo(x, d * 0.6), e.lineTo(0, d * 0.6), e.closePath(), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7139
7227
  }, Fe = (e, t) => {
7140
- const r = t.width / 2, c = t.height / 2;
7141
- e.beginPath(), e.moveTo(r, 0), e.lineTo(t.width, c), e.lineTo(r, t.height), e.lineTo(0, c), e.closePath(), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7228
+ const r = t.width / 2, d = t.height / 2;
7229
+ e.beginPath(), e.moveTo(r, 0), e.lineTo(t.width, d), e.lineTo(r, t.height), e.lineTo(0, d), e.closePath(), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7142
7230
  }, Ce = (e, t) => {
7143
- const r = t.width / 2, c = t.height / 2, g = Math.min(t.width, t.height) / 2, m = 6;
7231
+ const r = t.width / 2, d = t.height / 2, x = Math.min(t.width, t.height) / 2, u = 6;
7144
7232
  e.beginPath();
7145
- for (let p = 0; p < m; p++) {
7146
- const k = p * 2 * Math.PI / m - Math.PI / 2, w = r + g * Math.cos(k), R = c + g * Math.sin(k);
7147
- p === 0 ? e.moveTo(w, R) : e.lineTo(w, R);
7233
+ for (let w = 0; w < u; w++) {
7234
+ const S = w * 2 * Math.PI / u - Math.PI / 2, b = r + x * Math.cos(S), R = d + x * Math.sin(S);
7235
+ w === 0 ? e.moveTo(b, R) : e.lineTo(b, R);
7148
7236
  }
7149
7237
  e.closePath(), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7150
- }, Te = (e, t) => {
7151
- const r = t.width / 2, c = t.height / 2, g = Math.min(t.width, t.height) / 2, m = 5;
7238
+ }, je = (e, t) => {
7239
+ const r = t.width / 2, d = t.height / 2, x = Math.min(t.width, t.height) / 2, u = 5;
7152
7240
  e.beginPath();
7153
- for (let p = 0; p < m; p++) {
7154
- const k = p * 2 * Math.PI / m - Math.PI / 2, w = r + g * Math.cos(k), R = c + g * Math.sin(k);
7155
- p === 0 ? e.moveTo(w, R) : e.lineTo(w, R);
7241
+ for (let w = 0; w < u; w++) {
7242
+ const S = w * 2 * Math.PI / u - Math.PI / 2, b = r + x * Math.cos(S), R = d + x * Math.sin(S);
7243
+ w === 0 ? e.moveTo(b, R) : e.lineTo(b, R);
7156
7244
  }
7157
7245
  e.closePath(), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7158
- }, je = (e, t) => {
7159
- const r = t.width, c = t.height, g = 0, m = 0;
7246
+ }, Te = (e, t) => {
7247
+ const r = t.width, d = t.height, x = 0, u = 0;
7160
7248
  e.beginPath();
7161
- const p = c * 0.3;
7162
- e.moveTo(g + r / 2, m + p), e.bezierCurveTo(
7163
- g + r / 2,
7164
- m,
7165
- g,
7166
- m,
7167
- g,
7168
- m + p
7249
+ const w = d * 0.3;
7250
+ e.moveTo(x + r / 2, u + w), e.bezierCurveTo(
7251
+ x + r / 2,
7252
+ u,
7253
+ x,
7254
+ u,
7255
+ x,
7256
+ u + w
7169
7257
  ), e.bezierCurveTo(
7170
- g,
7171
- m + (c + p) / 2,
7172
- g + r / 2,
7173
- m + (c + p) / 2,
7174
- g + r / 2,
7175
- m + c
7258
+ x,
7259
+ u + (d + w) / 2,
7260
+ x + r / 2,
7261
+ u + (d + w) / 2,
7262
+ x + r / 2,
7263
+ u + d
7176
7264
  ), e.bezierCurveTo(
7177
- g + r / 2,
7178
- m + (c + p) / 2,
7179
- g + r,
7180
- m + (c + p) / 2,
7181
- g + r,
7182
- m + p
7265
+ x + r / 2,
7266
+ u + (d + w) / 2,
7267
+ x + r,
7268
+ u + (d + w) / 2,
7269
+ x + r,
7270
+ u + w
7183
7271
  ), e.bezierCurveTo(
7184
- g + r,
7185
- m,
7186
- g + r / 2,
7187
- m,
7188
- g + r / 2,
7189
- m + p
7272
+ x + r,
7273
+ u,
7274
+ x + r / 2,
7275
+ u,
7276
+ x + r / 2,
7277
+ u + w
7190
7278
  ), e.closePath(), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7191
7279
  }, Ne = (e, t) => {
7192
- const r = t.width / 2, c = t.height / 2, g = t.width / 2, m = t.height / 2;
7193
- e.beginPath(), e.ellipse(r, c, g, m, 0, 0, 2 * Math.PI), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7194
- }, Ae = (e, t) => {
7280
+ const r = t.width / 2, d = t.height / 2, x = t.width / 2, u = t.height / 2;
7281
+ e.beginPath(), e.ellipse(r, d, x, u, 0, 0, 2 * Math.PI), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7282
+ }, Ie = (e, t) => {
7195
7283
  const r = Math.min(t.width, t.height) * 0.1;
7196
7284
  At(e, 0, 0, t.width, t.height, r), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7197
- }, Ie = (e, t) => {
7285
+ }, Ae = (e, t) => {
7198
7286
  e.save(), t.opacity !== void 0 && (e.globalAlpha = t.opacity), e.strokeStyle = t.stroke || t.fill || "#000000", e.lineWidth = t.strokeWidth || t.height || 2, e.lineCap = "round", e.beginPath(), e.moveTo(0, t.height / 2), e.lineTo(t.width, t.height / 2), e.stroke(), e.restore();
7199
7287
  }, Re = (e, t) => {
7200
7288
  const r = t.src || t.imageData;
@@ -7220,8 +7308,8 @@ const fi = $e((f, o) => {
7220
7308
  }
7221
7309
  }
7222
7310
  e.fillStyle = "#f0f0f0", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ccc", e.lineWidth = 1, e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#666", e.font = "14px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Loading...", t.width / 2, t.height / 2);
7223
- } catch (c) {
7224
- console.error("Error drawing image:", c), e.fillStyle = "#ffebee", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#f44336", e.lineWidth = 2, e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#f44336", e.font = "14px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Error loading image", t.width / 2, t.height / 2);
7311
+ } catch (d) {
7312
+ console.error("Error drawing image:", d), e.fillStyle = "#ffebee", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#f44336", e.lineWidth = 2, e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#f44336", e.font = "14px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Error loading image", t.width / 2, t.height / 2);
7225
7313
  }
7226
7314
  else
7227
7315
  e.fillStyle = "#f8f8f8", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ddd", e.lineWidth = 1, e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#999", e.font = "14px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("No Image", t.width / 2, t.height / 2);
@@ -7240,7 +7328,7 @@ const fi = $e((f, o) => {
7240
7328
  try {
7241
7329
  e.drawImage(t.imageObject, 0, 0, t.width, t.height);
7242
7330
  } catch (r) {
7243
- console.error("Error drawing embroidery image:", r), Ft(e, t, "Error loading image");
7331
+ console.error("Error drawing embroidery image:", r), Ct(e, t, "Error loading image");
7244
7332
  }
7245
7333
  else if (t.src && !t.imageLoading) {
7246
7334
  t.imageLoading = !0;
@@ -7248,47 +7336,47 @@ const fi = $e((f, o) => {
7248
7336
  r.crossOrigin = "anonymous", r.onload = () => {
7249
7337
  r.complete && r.naturalHeight !== 0 ? (t.imageObject = r, t.imageLoading = !1, V()) : (t.imageLoading = !1, console.error("Image loaded but is invalid:", t.src));
7250
7338
  }, r.onerror = () => {
7251
- t.imageLoading = !1, console.error("Failed to load embroidery image:", t.src), Ft(e, t, "Failed to load");
7252
- }, r.src = t.src, Ft(e, t, "Loading...");
7253
- } else t.imageLoading ? Ft(e, t, "Loading...") : Ft(e, t);
7254
- }, Ft = (e, t, r = "Embroidery") => {
7339
+ t.imageLoading = !1, console.error("Failed to load embroidery image:", t.src), Ct(e, t, "Failed to load");
7340
+ }, r.src = t.src, Ct(e, t, "Loading...");
7341
+ } else t.imageLoading ? Ct(e, t, "Loading...") : Ct(e, t);
7342
+ }, Ct = (e, t, r = "Embroidery") => {
7255
7343
  e.fillStyle = "#f9f9f9", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ddd", e.lineWidth = 2, e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#999", e.font = "24px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("🧵", t.width / 2, t.height / 2 - 10), e.fillStyle = "#666", e.font = "12px Arial", e.fillText(r, t.width / 2, t.height / 2 + 15);
7256
7344
  }, Ht = (e, t, r) => {
7257
7345
  if (!r) return !1;
7258
- const c = r.x + r.width / 2, g = r.y + r.height / 2, m = e - c, p = t - g, k = -(r.rotation || 0) * Math.PI / 180, w = Math.cos(k), R = Math.sin(k), A = m * w - p * R, z = m * R + p * w, $ = r.width / 2, dt = r.height / 2;
7346
+ const d = r.x + r.width / 2, x = r.y + r.height / 2, u = e - d, w = t - x, S = -(r.rotation || 0) * Math.PI / 180, b = Math.cos(S), R = Math.sin(S), A = u * b - w * R, z = u * R + w * b, $ = r.width / 2, dt = r.height / 2;
7259
7347
  return A >= -$ && A <= $ && z >= -dt && z <= dt;
7260
- }, Be = rt(() => {
7261
- (S || y || B) && lt(), I(!1), E(!1), b(!1), O(null);
7348
+ }, Be = at(() => {
7349
+ (I || m || j) && lt(), E(!1), B(!1), p(!1), O(null);
7262
7350
  const e = K.current;
7263
7351
  e && (e.style.cursor = "default");
7264
- }, [S, y, B, lt]);
7265
- ot(() => {
7352
+ }, [I, m, j, lt]);
7353
+ rt(() => {
7266
7354
  const e = (t) => {
7267
7355
  if (l) return;
7268
7356
  const r = document.activeElement;
7269
- if (!(r && (r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.tagName === "SELECT" || r.isContentEditable)) && ((t.ctrlKey || t.metaKey) && (t.key === "z" && !t.shiftKey ? (t.preventDefault(), St()) : (t.key === "z" && t.shiftKey || t.key === "y") && (t.preventDefault(), wt())), (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))) {
7357
+ 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))) {
7270
7358
  t.preventDefault();
7271
- const g = t.shiftKey ? 10 : 1;
7272
- let m = {};
7359
+ const x = t.shiftKey ? 10 : 1;
7360
+ let u = {};
7273
7361
  switch (t.key) {
7274
7362
  case "ArrowUp":
7275
- m.y = d.y - g;
7363
+ u.y = c.y - x;
7276
7364
  break;
7277
7365
  case "ArrowDown":
7278
- m.y = d.y + g;
7366
+ u.y = c.y + x;
7279
7367
  break;
7280
7368
  case "ArrowLeft":
7281
- m.x = d.x - g;
7369
+ u.x = c.x - x;
7282
7370
  break;
7283
7371
  case "ArrowRight":
7284
- m.x = d.x + g;
7372
+ u.x = c.x + x;
7285
7373
  break;
7286
7374
  }
7287
- Gt(d.id, m), lt();
7375
+ Gt(c.id, u), lt();
7288
7376
  }
7289
7377
  };
7290
7378
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
7291
- }, [d, St, wt, l]);
7379
+ }, [c, Ft, bt, l]);
7292
7380
  const ze = (e, t = {}) => {
7293
7381
  const r = {
7294
7382
  id: ht(),
@@ -7314,16 +7402,16 @@ const fi = $e((f, o) => {
7314
7402
  r.id = ht(), r.imageData = t.imageData || null, r.width = t.width || 200, r.height = t.height || 200;
7315
7403
  break;
7316
7404
  case "qrcode":
7317
- 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;
7405
+ r.id = ht(), r.type = "qrcode", r.x = (t == null ? void 0 : t.x) || k / 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;
7318
7406
  break;
7319
7407
  case "barcode":
7320
- 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;
7408
+ r.id = ht(), r.type = "barcode", r.x = (t == null ? void 0 : t.x) || k / 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;
7321
7409
  break;
7322
7410
  case "sticker":
7323
7411
  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;
7324
7412
  break;
7325
7413
  case "horizontalLine":
7326
- 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;
7414
+ r.id = ht(), r.type = "horizontalLine", r.x = k / 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;
7327
7415
  break;
7328
7416
  case "embroidery":
7329
7417
  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;
@@ -7344,15 +7432,15 @@ const fi = $e((f, o) => {
7344
7432
  console.warn(`Unknown element type: ${e}`);
7345
7433
  return;
7346
7434
  }
7347
- n((c) => [...c, r]), j(r), lt();
7435
+ n((d) => [...d, r]), F(r), lt();
7348
7436
  }, Gt = (e, t) => {
7349
7437
  n((r) => r.map(
7350
- (c) => c.id === e ? { ...c, ...t } : c
7351
- )), d && d.id === e && j((r) => ({ ...r, ...t }));
7352
- }, Mt = rt(() => {
7353
- d && (n((e) => e.filter((t) => t.id !== d.id)), j(null), lt());
7354
- }, [d, lt]), _t = (e) => {
7355
- const t = x.find((r) => r.id === e);
7438
+ (d) => d.id === e ? { ...d, ...t } : d
7439
+ )), c && c.id === e && F((r) => ({ ...r, ...t }));
7440
+ }, Mt = at(() => {
7441
+ c && (n((e) => e.filter((t) => t.id !== c.id)), F(null), lt());
7442
+ }, [c, lt]), _t = (e) => {
7443
+ const t = h.find((r) => r.id === e);
7356
7444
  if (t) {
7357
7445
  const r = {
7358
7446
  ...t,
@@ -7360,23 +7448,23 @@ const fi = $e((f, o) => {
7360
7448
  x: t.x + 20,
7361
7449
  y: t.y + 20
7362
7450
  };
7363
- n((c) => [...c, r]), j(r), lt();
7451
+ n((d) => [...d, r]), F(r), lt();
7364
7452
  }
7365
7453
  }, Yt = (e, t) => {
7366
- const r = x.findIndex((m) => m.id === e);
7454
+ const r = h.findIndex((u) => u.id === e);
7367
7455
  if (r === -1) return;
7368
- const c = [...x], g = c[r];
7369
- 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), lt();
7456
+ const d = [...h], x = d[r];
7457
+ t === "up" && r < d.length - 1 ? (d[r] = d[r + 1], d[r + 1] = x) : t === "down" && r > 0 ? (d[r] = d[r - 1], d[r - 1] = x) : t === "top" ? (d.splice(r, 1), d.push(x)) : t === "bottom" && (d.splice(r, 1), d.unshift(x)), n(d), lt();
7370
7458
  };
7371
- rt(() => {
7372
- T && H((e) => ({
7459
+ at(() => {
7460
+ C && H((e) => ({
7373
7461
  ...e,
7374
- [T.sectionName]: {
7375
- elements: [...x],
7376
- selectedColor: q
7462
+ [C.sectionName]: {
7463
+ elements: [...h],
7464
+ selectedColor: _
7377
7465
  }
7378
7466
  }));
7379
- }, [T, x, q]);
7467
+ }, [C, h, _]);
7380
7468
  const [, We] = He((e) => e + 1, 0);
7381
7469
  setTimeout(() => {
7382
7470
  We();
@@ -7388,31 +7476,32 @@ const fi = $e((f, o) => {
7388
7476
  // Access to the existing exportDesign method
7389
7477
  exportDesign: Wt,
7390
7478
  // Get canvas data for custom exports
7391
- getCanvasData: () => kt(),
7479
+ getCanvasData: () => St(),
7392
7480
  // NEW: Export methods that return JSON with File objects
7393
7481
  exportAllDesignsAsJSON: async (e = "png") => {
7394
7482
  try {
7395
- const t = kt();
7483
+ const t = St();
7396
7484
  console.log("canvas data to export: ", t);
7397
- const r = {}, c = (T == null ? void 0 : T.sectionName) || "main";
7398
- r[c] = {
7485
+ const r = {}, d = (C == null ? void 0 : C.sectionName) || "main";
7486
+ r[d] = {
7399
7487
  elements: t.elements,
7400
7488
  selectedColor: t.selectedColor,
7401
7489
  canvasWidth: t.canvasWidth,
7402
7490
  canvasHeight: t.canvasHeight
7403
7491
  }, t.sectionDesigns && typeof t.sectionDesigns == "object" && Object.assign(r, t.sectionDesigns);
7404
- const g = s.sections && s.sections.length > 0 ? s.sections : [{
7405
- id: c,
7406
- sectionName: c,
7407
- image: T == null ? void 0 : T.sectionImage,
7408
- sectionImage: T == null ? void 0 : T.sectionImage
7492
+ const x = s.sections && s.sections.length > 0 ? s.sections : [{
7493
+ id: d,
7494
+ sectionName: d,
7495
+ image: C == null ? void 0 : C.sectionImage,
7496
+ sectionImage: C == null ? void 0 : C.sectionImage
7409
7497
  }];
7410
- return await Et.current.exportAllSectionsAsJSON(
7498
+ return await Bt.current.exportAllSectionsAsJSON(
7411
7499
  r,
7412
- g,
7413
- v,
7500
+ x,
7501
+ k,
7414
7502
  W,
7415
- e
7503
+ e,
7504
+ yt
7416
7505
  );
7417
7506
  } catch (t) {
7418
7507
  throw console.error("Export as JSON failed:", t), t;
@@ -7420,273 +7509,273 @@ const fi = $e((f, o) => {
7420
7509
  },
7421
7510
  exportCurrentSectionAsJSON: async (e = "png") => {
7422
7511
  try {
7423
- const t = kt();
7424
- return await Et.current.exportCurrentSectionAsJSON(t, e);
7512
+ const t = St();
7513
+ return await Bt.current.exportCurrentSectionAsJSON(t, e, yt);
7425
7514
  } catch (t) {
7426
7515
  throw console.error("Export current section as JSON failed:", t), t;
7427
7516
  }
7428
7517
  }
7429
7518
  }));
7430
- const yt = gt(null), Lt = gt(!1), V = rt(() => {
7519
+ const mt = gt(null), Lt = gt(!1), V = at(() => {
7431
7520
  const e = K.current;
7432
7521
  if (!e || Lt.current) return;
7433
7522
  Lt.current = !0;
7434
7523
  const t = e.getContext("2d");
7435
- t.clearRect(0, 0, v, W), pt.current && t.drawImage(pt.current, 0, 0, v, W), M && xe(t), x.forEach((r) => {
7524
+ t.clearRect(0, 0, k, W), wt.current && t.drawImage(wt.current, 0, 0, k, W), M && xe(t), h.forEach((r) => {
7436
7525
  t.save(), t.globalAlpha = r.opacity || 1, ye(t, r), t.restore();
7437
- }), d && fe(t, d), Lt.current = !1;
7438
- }, [x, d, v, W, M]), bt = rt(() => {
7439
- yt.current && cancelAnimationFrame(yt.current), yt.current = requestAnimationFrame(() => {
7440
- V(), yt.current = null;
7526
+ }), c && fe(t, c), Lt.current = !1;
7527
+ }, [h, c, k, W, M]), vt = at(() => {
7528
+ mt.current && cancelAnimationFrame(mt.current), mt.current = requestAnimationFrame(() => {
7529
+ V(), mt.current = null;
7441
7530
  });
7442
7531
  }, [V]);
7443
- ot(() => {
7444
- bt();
7445
- }, [x, d, v, W, M, bt]), ot(() => {
7446
- pt.current && bt();
7447
- }, [pt.current, bt]), ot(() => () => {
7448
- yt.current && cancelAnimationFrame(yt.current);
7532
+ rt(() => {
7533
+ vt();
7534
+ }, [h, c, k, W, M, vt]), rt(() => {
7535
+ wt.current && vt();
7536
+ }, [wt.current, vt]), rt(() => () => {
7537
+ mt.current && cancelAnimationFrame(mt.current);
7449
7538
  }, []);
7450
- const Pt = rt(() => {
7451
- V(), (S || y || B) && (yt.current = requestAnimationFrame(Pt));
7452
- }, [V, S, y, B]);
7453
- ot(() => {
7454
- S || y || B ? Pt() : (yt.current && (cancelAnimationFrame(yt.current), yt.current = null), bt());
7455
- }, [S, y, B, Pt, bt]);
7456
- const Me = rt((e) => {
7539
+ const Pt = at(() => {
7540
+ V(), (I || m || j) && (mt.current = requestAnimationFrame(Pt));
7541
+ }, [V, I, m, j]);
7542
+ rt(() => {
7543
+ I || m || j ? Pt() : (mt.current && (cancelAnimationFrame(mt.current), mt.current = null), vt());
7544
+ }, [I, m, j, Pt, vt]);
7545
+ const Me = at((e) => {
7457
7546
  if (l) return;
7458
- const r = K.current.getBoundingClientRect(), c = (e.clientX - r.left) / Q, g = (e.clientY - r.top) / Q;
7459
- if (J({ x: c, y: g }), d) {
7460
- const p = $t(c, g, d);
7461
- if (p) {
7462
- if (p === "rotate") {
7463
- b(!0);
7464
- const k = d.x + d.width / 2, w = d.y + d.height / 2, R = Math.atan2(g - w, c - k) * 180 / Math.PI;
7465
- J({
7466
- x: c,
7467
- y: g,
7547
+ const r = K.current.getBoundingClientRect(), d = (e.clientX - r.left) / Q, x = (e.clientY - r.top) / Q;
7548
+ if (X({ x: d, y: x }), c) {
7549
+ const w = $t(d, x, c);
7550
+ if (w) {
7551
+ if (w === "rotate") {
7552
+ p(!0);
7553
+ const S = c.x + c.width / 2, b = c.y + c.height / 2, R = Math.atan2(x - b, d - S) * 180 / Math.PI;
7554
+ X({
7555
+ x: d,
7556
+ y: x,
7468
7557
  initialAngle: R,
7469
- initialRotation: d.rotation || 0
7558
+ initialRotation: c.rotation || 0
7470
7559
  });
7471
7560
  } else
7472
- E(!0), O(p), J({
7473
- x: c,
7474
- y: g,
7475
- initialWidth: d.width,
7476
- initialHeight: d.height,
7477
- initialX: d.x,
7478
- initialY: d.y
7561
+ B(!0), O(w), X({
7562
+ x: d,
7563
+ y: x,
7564
+ initialWidth: c.width,
7565
+ initialHeight: c.height,
7566
+ initialX: c.x,
7567
+ initialY: c.y
7479
7568
  });
7480
7569
  return;
7481
7570
  }
7482
7571
  }
7483
- let m = null;
7484
- for (let p = x.length - 1; p >= 0; p--)
7485
- if (Ht(c, g, x[p])) {
7486
- m = x[p];
7572
+ let u = null;
7573
+ for (let w = h.length - 1; w >= 0; w--)
7574
+ if (Ht(d, x, h[w])) {
7575
+ u = h[w];
7487
7576
  break;
7488
7577
  }
7489
- m ? (j(m), I(!0), J({
7490
- x: c,
7491
- y: g,
7492
- offsetX: c - m.x,
7493
- offsetY: g - m.y
7494
- })) : j(null), V();
7495
- }, [l, Q, d, x, V]), Le = rt((e) => {
7578
+ u ? (F(u), E(!0), X({
7579
+ x: d,
7580
+ y: x,
7581
+ offsetX: d - u.x,
7582
+ offsetY: x - u.y
7583
+ })) : F(null), V();
7584
+ }, [l, Q, c, h, V]), Le = at((e) => {
7496
7585
  if (l) return;
7497
- const t = K.current, r = t.getBoundingClientRect(), c = (e.clientX - r.left) / Q, g = (e.clientY - r.top) / Q;
7498
- if (d && !S && !y && !B) {
7499
- const m = $t(c, g, d);
7500
- m ? m === "rotate" ? t.style.cursor = "grab" : t.style.cursor = m : Ht(c, g, d) ? t.style.cursor = "move" : t.style.cursor = "default";
7586
+ const t = K.current, r = t.getBoundingClientRect(), d = (e.clientX - r.left) / Q, x = (e.clientY - r.top) / Q;
7587
+ if (c && !I && !m && !j) {
7588
+ const u = $t(d, x, c);
7589
+ u ? u === "rotate" ? t.style.cursor = "grab" : t.style.cursor = u : Ht(d, x, c) ? t.style.cursor = "move" : t.style.cursor = "default";
7501
7590
  } else
7502
- t.style.cursor = S ? "grabbing" : "default";
7503
- if (B && d) {
7504
- const m = d.x + d.width / 2, p = d.y + d.height / 2, w = Math.atan2(g - p, c - m) * 180 / Math.PI - F.initialAngle;
7505
- let R = F.initialRotation + w;
7591
+ t.style.cursor = I ? "grabbing" : "default";
7592
+ if (j && c) {
7593
+ const u = c.x + c.width / 2, w = c.y + c.height / 2, b = Math.atan2(x - w, d - u) * 180 / Math.PI - v.initialAngle;
7594
+ let R = v.initialRotation + b;
7506
7595
  e.shiftKey && (R = Math.round(R / 15) * 15), R = (R % 360 + 360) % 360, n(
7507
7596
  (A) => A.map(
7508
- (z) => z.id === d.id ? { ...z, rotation: R } : z
7597
+ (z) => z.id === c.id ? { ...z, rotation: R } : z
7509
7598
  )
7510
- ), j((A) => ({ ...A, rotation: R })), V();
7599
+ ), F((A) => ({ ...A, rotation: R })), V();
7511
7600
  return;
7512
7601
  }
7513
- if (y && d && C) {
7514
- const m = c - F.x, p = g - F.y;
7515
- let k = F.initialWidth, w = F.initialHeight, R = F.initialX, A = F.initialY;
7516
- switch (C) {
7602
+ if (m && c && T) {
7603
+ const u = d - v.x, w = x - v.y;
7604
+ let S = v.initialWidth, b = v.initialHeight, R = v.initialX, A = v.initialY;
7605
+ switch (T) {
7517
7606
  case "se-resize":
7518
- k = Math.max(20, F.initialWidth + m), w = Math.max(20, F.initialHeight + p);
7607
+ S = Math.max(20, v.initialWidth + u), b = Math.max(20, v.initialHeight + w);
7519
7608
  break;
7520
7609
  case "sw-resize":
7521
- k = Math.max(20, F.initialWidth - m), w = Math.max(20, F.initialHeight + p), R = F.initialX + (F.initialWidth - k);
7610
+ S = Math.max(20, v.initialWidth - u), b = Math.max(20, v.initialHeight + w), R = v.initialX + (v.initialWidth - S);
7522
7611
  break;
7523
7612
  case "ne-resize":
7524
- k = Math.max(20, F.initialWidth + m), w = Math.max(20, F.initialHeight - p), A = F.initialY + (F.initialHeight - w);
7613
+ S = Math.max(20, v.initialWidth + u), b = Math.max(20, v.initialHeight - w), A = v.initialY + (v.initialHeight - b);
7525
7614
  break;
7526
7615
  case "nw-resize":
7527
- k = Math.max(20, F.initialWidth - m), w = Math.max(20, F.initialHeight - p), R = F.initialX + (F.initialWidth - k), A = F.initialY + (F.initialHeight - w);
7616
+ S = Math.max(20, v.initialWidth - u), b = Math.max(20, v.initialHeight - w), R = v.initialX + (v.initialWidth - S), A = v.initialY + (v.initialHeight - b);
7528
7617
  break;
7529
7618
  }
7530
- if (e.shiftKey && d.type !== "text") {
7531
- const $ = F.initialWidth / F.initialHeight;
7532
- C.includes("e"), w = k / $, C.includes("n") && (A = F.initialY + (F.initialHeight - w));
7619
+ if (e.shiftKey && c.type !== "text") {
7620
+ const $ = v.initialWidth / v.initialHeight;
7621
+ T.includes("e"), b = S / $, T.includes("n") && (A = v.initialY + (v.initialHeight - b));
7533
7622
  }
7534
- _ && (R = ut(R), A = ut(A), k = ut(k), w = ut(w));
7623
+ Y && (R = ut(R), A = ut(A), S = ut(S), b = ut(b));
7535
7624
  const z = {
7536
- ...d,
7625
+ ...c,
7537
7626
  x: R,
7538
7627
  y: A,
7539
- width: k,
7540
- height: w
7628
+ width: S,
7629
+ height: b
7541
7630
  };
7542
7631
  n(
7543
7632
  ($) => $.map(
7544
- (dt) => dt.id === d.id ? z : dt
7633
+ (dt) => dt.id === c.id ? z : dt
7545
7634
  )
7546
- ), j(z), V();
7635
+ ), F(z), V();
7547
7636
  return;
7548
7637
  }
7549
- if (S && d) {
7550
- let m = c - F.offsetX, p = g - F.offsetY;
7551
- _ && (m = ut(m), p = ut(p)), m = Math.max(0, Math.min(v - d.width, m)), p = Math.max(0, Math.min(W - d.height, p));
7552
- const k = {
7553
- ...d,
7554
- x: m,
7555
- y: p
7638
+ if (I && c) {
7639
+ let u = d - v.offsetX, w = x - v.offsetY;
7640
+ Y && (u = ut(u), w = ut(w)), u = Math.max(0, Math.min(k - c.width, u)), w = Math.max(0, Math.min(W - c.height, w));
7641
+ const S = {
7642
+ ...c,
7643
+ x: u,
7644
+ y: w
7556
7645
  };
7557
7646
  n(
7558
- (w) => w.map(
7559
- (R) => R.id === d.id ? k : R
7647
+ (b) => b.map(
7648
+ (R) => R.id === c.id ? S : R
7560
7649
  )
7561
- ), j(k), V();
7650
+ ), F(S), V();
7562
7651
  }
7563
- }, [l, Q, d, S, y, B, C, F, _, v, W, x, V]), qt = rt((e) => {
7564
- T && H((r) => ({
7652
+ }, [l, Q, c, I, m, j, T, v, Y, k, W, h, V]), qt = at((e) => {
7653
+ C && H((r) => ({
7565
7654
  ...r,
7566
- [T.sectionName]: {
7567
- elements: x.map((c) => c.type === "image" ? {
7568
- ...c,
7655
+ [C.sectionName]: {
7656
+ elements: h.map((d) => d.type === "image" ? {
7657
+ ...d,
7569
7658
  // Keep the image data reference
7570
- imageData: c.imageData,
7571
- src: c.src
7572
- } : c),
7573
- selectedColor: q
7659
+ imageData: d.imageData,
7660
+ src: d.src
7661
+ } : d),
7662
+ selectedColor: _
7574
7663
  }
7575
7664
  }));
7576
7665
  const t = L[e.sectionName];
7577
7666
  if (t) {
7578
- const r = t.elements.map((c) => {
7579
- if (c.type === "image" && c.src && !c.imageData) {
7580
- const g = new Image();
7581
- return g.onload = () => {
7667
+ const r = t.elements.map((d) => {
7668
+ if (d.type === "image" && d.src && !d.imageData) {
7669
+ const x = new Image();
7670
+ return x.onload = () => {
7582
7671
  n(
7583
- (m) => m.map(
7584
- (p) => p.id === c.id ? { ...p, imageData: g } : p
7672
+ (u) => u.map(
7673
+ (w) => w.id === d.id ? { ...w, imageData: x } : w
7585
7674
  )
7586
7675
  ), V();
7587
- }, g.src = c.src, { ...c, imageData: g };
7676
+ }, x.src = d.src, { ...d, imageData: x };
7588
7677
  }
7589
- return c;
7678
+ return d;
7590
7679
  });
7591
- n(r), at(t.selectedColor || q);
7680
+ n(r), st(t.selectedColor || _);
7592
7681
  } else
7593
7682
  n([]);
7594
- tt(e), j(null);
7595
- }, [T, x, q, L, V]), Pe = rt((e) => {
7683
+ et(e), F(null);
7684
+ }, [C, h, _, L, V]), Pe = at((e) => {
7596
7685
  if (e && e.type.startsWith("image/")) {
7597
7686
  const t = new FileReader();
7598
7687
  t.onload = (r) => {
7599
- const c = new Image();
7600
- c.onload = () => {
7601
- const g = {
7688
+ const d = new Image();
7689
+ d.onload = () => {
7690
+ const x = {
7602
7691
  id: ht(),
7603
7692
  type: "image",
7604
- x: ut(v / 2 - 100),
7693
+ x: ut(k / 2 - 100),
7605
7694
  y: ut(W / 2 - 100),
7606
- width: Math.min(c.width, 200),
7695
+ width: Math.min(d.width, 200),
7607
7696
  // Limit initial size
7608
- height: Math.min(c.height, 200),
7697
+ height: Math.min(d.height, 200),
7609
7698
  rotation: 0,
7610
- imageData: c,
7699
+ imageData: d,
7611
7700
  src: r.target.result,
7612
- originalWidth: c.width,
7613
- originalHeight: c.height
7614
- }, m = c.width / c.height;
7615
- g.width / g.height !== m && (g.width / m <= 200 ? g.height = g.width / m : g.width = g.height * m), n((p) => [...p, g]), j(g), lt();
7616
- }, c.onerror = () => {
7701
+ originalWidth: d.width,
7702
+ originalHeight: d.height
7703
+ }, u = d.width / d.height;
7704
+ x.width / x.height !== u && (x.width / u <= 200 ? x.height = x.width / u : x.width = x.height * u), n((w) => [...w, x]), F(x), lt();
7705
+ }, d.onerror = () => {
7617
7706
  console.error("Failed to load uploaded image"), alert("Failed to load the uploaded image. Please try again.");
7618
- }, c.src = r.target.result;
7707
+ }, d.src = r.target.result;
7619
7708
  }, t.onerror = () => {
7620
7709
  console.error("Failed to read file"), alert("Failed to read the file. Please try again.");
7621
7710
  }, t.readAsDataURL(e);
7622
7711
  } else
7623
7712
  alert("Please select a valid image file.");
7624
- }, [v, W, ut, ht, lt]), Vt = rt(
7713
+ }, [k, W, ut, ht, lt]), Vt = at(
7625
7714
  Ue(() => {
7626
7715
  V();
7627
7716
  }, 16),
7628
7717
  // 60fps limit
7629
7718
  [V]
7630
7719
  );
7631
- ot(() => {
7632
- Bt.current || Vt();
7633
- }, [x, d, M, Vt]);
7720
+ rt(() => {
7721
+ zt.current || Vt();
7722
+ }, [h, c, M, Vt]);
7634
7723
  function Ue(e, t) {
7635
7724
  let r;
7636
- return function(...g) {
7637
- const m = () => {
7638
- clearTimeout(r), e(...g);
7725
+ return function(...x) {
7726
+ const u = () => {
7727
+ clearTimeout(r), e(...x);
7639
7728
  };
7640
- clearTimeout(r), r = setTimeout(m, t);
7729
+ clearTimeout(r), r = setTimeout(u, t);
7641
7730
  };
7642
7731
  }
7643
- ot(() => {
7644
- mt.current && Xt(mt.current, q);
7645
- }, [q]), ot(() => {
7732
+ rt(() => {
7733
+ pt.current && Xt(pt.current, _);
7734
+ }, [_]), rt(() => {
7646
7735
  V();
7647
7736
  }, [V]);
7648
- const Oe = (e, t, r) => (0.2126 * e + 0.7152 * t + 0.0722 * r) / 255, Xt = rt((e, t) => {
7649
- const r = Ot.current, c = r.getContext("2d");
7650
- r.width = v, r.height = W, c.clearRect(0, 0, v, W), c.drawImage(e, 0, 0, v, W);
7651
- const g = c.getImageData(0, 0, v, W), m = g.data, p = ge(t);
7652
- if (!p) {
7653
- Bt.current = !1;
7737
+ const Oe = (e, t, r) => (0.2126 * e + 0.7152 * t + 0.0722 * r) / 255, Xt = at((e, t) => {
7738
+ const r = Ot.current, d = r.getContext("2d");
7739
+ r.width = k, r.height = W, d.clearRect(0, 0, k, W), d.drawImage(e, 0, 0, k, W);
7740
+ const x = d.getImageData(0, 0, k, W), u = x.data, w = ge(t);
7741
+ if (!w) {
7742
+ zt.current = !1;
7654
7743
  return;
7655
7744
  }
7656
- const { r: k, g: w, b: R } = p;
7657
- for (let z = 0; z < m.length; z += 4) {
7658
- if (m[z + 3] === 0) continue;
7659
- const dt = Oe(m[z], m[z + 1], m[z + 2]);
7660
- m[z] = Math.round(k * dt), m[z + 1] = Math.round(w * dt), m[z + 2] = Math.round(R * dt);
7745
+ const { r: S, g: b, b: R } = w;
7746
+ for (let z = 0; z < u.length; z += 4) {
7747
+ if (u[z + 3] === 0) continue;
7748
+ const dt = Oe(u[z], u[z + 1], u[z + 2]);
7749
+ u[z] = Math.round(S * dt), u[z + 1] = Math.round(b * dt), u[z + 2] = Math.round(R * dt);
7661
7750
  }
7662
- c.putImageData(g, 0, 0);
7751
+ d.putImageData(x, 0, 0);
7663
7752
  const A = new Image();
7664
7753
  A.onload = () => {
7665
- pt.current = s.plainColor === "Y" ? A : e, Bt.current = !1, V();
7754
+ wt.current = s.plainColor === "Y" ? A : e, zt.current = !1, V();
7666
7755
  }, A.src = r.toDataURL("image/png");
7667
- }, [v, W, V]), Jt = (e) => {
7668
- if (!Z) return { horizontal: [], vertical: [] };
7756
+ }, [k, W, V]), Jt = (e) => {
7757
+ if (!tt) return { horizontal: [], vertical: [] };
7669
7758
  const t = document.querySelector(".ruler-horizontal"), r = document.querySelector(".ruler-vertical");
7670
7759
  if (!t || !r)
7671
7760
  return { horizontal: [], vertical: [] };
7672
- const c = t.getBoundingClientRect(), g = r.getBoundingClientRect(), m = c.width, p = g.height, k = 50, w = [], R = [];
7673
- for (let A = k; A <= m; A += k)
7674
- A <= m - 20 && w.push({
7761
+ const d = t.getBoundingClientRect(), x = r.getBoundingClientRect(), u = d.width, w = x.height, S = 50, b = [], R = [];
7762
+ for (let A = S; A <= u; A += S)
7763
+ A <= u - 20 && b.push({
7675
7764
  position: A,
7676
7765
  value: Math.round(A / e)
7677
7766
  });
7678
- for (let A = k; A <= p; A += k)
7679
- A <= p - 15 && R.push({
7767
+ for (let A = S; A <= w; A += S)
7768
+ A <= w - 15 && R.push({
7680
7769
  position: A,
7681
7770
  value: Math.round(A / e)
7682
7771
  });
7683
- return { horizontal: w, vertical: R };
7772
+ return { horizontal: b, vertical: R };
7684
7773
  }, [Kt, Zt] = N({ horizontal: [], vertical: [] });
7685
- return ot(() => {
7774
+ return rt(() => {
7686
7775
  const e = () => {
7687
7776
  setTimeout(() => {
7688
- const c = Jt(Q);
7689
- Zt(c);
7777
+ const d = Jt(Q);
7778
+ Zt(d);
7690
7779
  }, 50);
7691
7780
  };
7692
7781
  e();
@@ -7697,33 +7786,33 @@ const fi = $e((f, o) => {
7697
7786
  return window.addEventListener("resize", r), () => {
7698
7787
  window.removeEventListener("resize", r), clearTimeout(t);
7699
7788
  };
7700
- }, [Q, Z]), ot(() => {
7701
- if (Z && !u) {
7789
+ }, [Q, tt]), rt(() => {
7790
+ if (tt && !y) {
7702
7791
  const e = setTimeout(() => {
7703
7792
  const t = Jt(Q);
7704
7793
  Zt(t);
7705
7794
  }, 100);
7706
7795
  return () => clearTimeout(e);
7707
7796
  }
7708
- }, [Z, u, Q]), /* @__PURE__ */ i.jsxs("div", { className: "pure-canvas-designer", children: [
7797
+ }, [tt, y, Q]), /* @__PURE__ */ i.jsxs("div", { className: "pure-canvas-designer", children: [
7709
7798
  /* @__PURE__ */ i.jsx("div", { className: "designer-header", children: /* @__PURE__ */ i.jsx(
7710
7799
  si,
7711
7800
  {
7712
7801
  onAddElement: ze,
7713
- onDeleteElement: () => d && Mt(d.id),
7714
- onDuplicateElement: () => d && _t(d.id),
7715
- onUndo: St,
7716
- onRedo: wt,
7802
+ onDeleteElement: () => c && Mt(c.id),
7803
+ onDuplicateElement: () => c && _t(c.id),
7804
+ onUndo: Ft,
7805
+ onRedo: bt,
7717
7806
  onToggleGrid: () => nt(!M),
7718
- onToggleRulers: () => ct(!Z),
7719
- onToggleSnap: () => P(!_),
7807
+ onToggleRulers: () => ct(!tt),
7808
+ onToggleSnap: () => P(!Y),
7720
7809
  onImageUpload: Pe,
7721
- canUndo: X > 0,
7722
- canRedo: X < G.length - 1,
7810
+ canUndo: J > 0,
7811
+ canRedo: J < G.length - 1,
7723
7812
  showGrid: M,
7724
- showRulers: Z,
7725
- snapToGrid: _,
7726
- selectedElement: d,
7813
+ showRulers: tt,
7814
+ snapToGrid: Y,
7815
+ selectedElement: c,
7727
7816
  theme: a,
7728
7817
  readOnly: l,
7729
7818
  apiKey: f.apiKey,
@@ -7731,7 +7820,7 @@ const fi = $e((f, o) => {
7731
7820
  }
7732
7821
  ) }),
7733
7822
  /* @__PURE__ */ i.jsxs("div", { className: "designer-content", children: [
7734
- Z && !u && /* @__PURE__ */ i.jsxs("div", { className: "rulers", children: [
7823
+ tt && !y && /* @__PURE__ */ i.jsxs("div", { className: "rulers", children: [
7735
7824
  /* @__PURE__ */ i.jsx("div", { className: "ruler-horizontal", children: /* @__PURE__ */ i.jsx("div", { className: "ruler-horizontal-numbers", children: Kt.horizontal.map((e, t) => /* @__PURE__ */ i.jsx(
7736
7825
  "span",
7737
7826
  {
@@ -7751,18 +7840,18 @@ const fi = $e((f, o) => {
7751
7840
  t
7752
7841
  )) }) })
7753
7842
  ] }),
7754
- /* @__PURE__ */ i.jsx("div", { className: "canvas-container", ref: vt, children: /* @__PURE__ */ i.jsx(
7843
+ /* @__PURE__ */ i.jsx("div", { className: "canvas-container", ref: kt, children: /* @__PURE__ */ i.jsx(
7755
7844
  "canvas",
7756
7845
  {
7757
7846
  ref: K,
7758
- width: v,
7847
+ width: k,
7759
7848
  height: W,
7760
7849
  onMouseDown: Me,
7761
7850
  onMouseMove: Le,
7762
7851
  onMouseUp: Be,
7763
7852
  style: {
7764
7853
  border: "1px solid #e2e8f0",
7765
- cursor: S ? "grabbing" : "default",
7854
+ cursor: I ? "grabbing" : "default",
7766
7855
  transform: `scale(${Q})`,
7767
7856
  transformOrigin: "top left"
7768
7857
  }
@@ -7772,7 +7861,7 @@ const fi = $e((f, o) => {
7772
7861
  /* @__PURE__ */ i.jsx(
7773
7862
  li,
7774
7863
  {
7775
- selectedElement: d,
7864
+ selectedElement: c,
7776
7865
  onUpdate: Gt,
7777
7866
  onMoveLayer: Yt,
7778
7867
  availableFonts: de,
@@ -7782,9 +7871,9 @@ const fi = $e((f, o) => {
7782
7871
  /* @__PURE__ */ i.jsx(
7783
7872
  ni,
7784
7873
  {
7785
- elements: x,
7786
- selectedElement: d,
7787
- onSelectElement: j,
7874
+ elements: h,
7875
+ selectedElement: c,
7876
+ onSelectElement: F,
7788
7877
  onMoveLayer: Yt,
7789
7878
  onDeleteElement: Mt,
7790
7879
  theme: a
@@ -7803,11 +7892,11 @@ const fi = $e((f, o) => {
7803
7892
  return /* @__PURE__ */ i.jsxs(
7804
7893
  "div",
7805
7894
  {
7806
- className: `section-thumbnail compact ${T.sectionName === e.sectionName ? "active" : ""}`,
7895
+ className: `section-thumbnail compact ${C.sectionName === e.sectionName ? "active" : ""}`,
7807
7896
  onClick: (r) => {
7808
7897
  r.stopPropagation();
7809
- const c = s.sections.find((g) => g.sectionName === e.sectionName);
7810
- qt(c);
7898
+ const d = s.sections.find((x) => x.sectionName === e.sectionName);
7899
+ qt(d);
7811
7900
  },
7812
7901
  title: e.sectionName,
7813
7902
  children: [
@@ -7839,9 +7928,9 @@ const fi = $e((f, o) => {
7839
7928
  s.colorSettings.slice(0, 3).map((e, t) => /* @__PURE__ */ i.jsxs(
7840
7929
  "div",
7841
7930
  {
7842
- className: `color-swatch-enhanced compact ${q === e ? "active" : ""}`,
7931
+ className: `color-swatch-enhanced compact ${_ === e ? "active" : ""}`,
7843
7932
  onClick: (r) => {
7844
- r.stopPropagation(), at(e);
7933
+ r.stopPropagation(), st(e);
7845
7934
  },
7846
7935
  title: `Change product to ${e}`,
7847
7936
  children: [
@@ -7852,7 +7941,7 @@ const fi = $e((f, o) => {
7852
7941
  style: { backgroundColor: e }
7853
7942
  }
7854
7943
  ),
7855
- q === e && /* @__PURE__ */ i.jsx("div", { className: "color-selection-ring compact" })
7944
+ _ === e && /* @__PURE__ */ i.jsx("div", { className: "color-selection-ring compact" })
7856
7945
  ]
7857
7946
  },
7858
7947
  e
@@ -7878,9 +7967,9 @@ const fi = $e((f, o) => {
7878
7967
  /* @__PURE__ */ i.jsx("div", { className: "color-dropdown-menu", style: { display: "none" }, children: s.colorSettings.slice(3).map((e, t) => /* @__PURE__ */ i.jsxs(
7879
7968
  "div",
7880
7969
  {
7881
- className: `color-swatch-dropdown ${q === e ? "active" : ""}`,
7970
+ className: `color-swatch-dropdown ${_ === e ? "active" : ""}`,
7882
7971
  onClick: (r) => {
7883
- r.stopPropagation(), at(e), r.currentTarget.parentElement.style.display = "none";
7972
+ r.stopPropagation(), st(e), r.currentTarget.parentElement.style.display = "none";
7884
7973
  },
7885
7974
  title: `Change product to ${e}`,
7886
7975
  children: [