@mypixia/simplex-designer 2.0.0 → 2.0.1

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 j, useRef as ft, useEffect as it, useMemo as ee, forwardRef as $e, useCallback as et, useReducer as He, useImperativeHandle as Ge } from "react";
2
- import _e from "qrcode";
3
- import Ye from "react-barcode";
4
- import ie from "axios";
5
- import './index_external.css';var Dt = { exports: {} }, Ft = {};
1
+ import We, { useState as N, useRef as xt, useEffect as it, useMemo as Xt, forwardRef as Me, useCallback as at, useReducer as Le, useImperativeHandle as Pe } from "react";
2
+ import Ue from "qrcode";
3
+ import Oe from "react-barcode";
4
+ import Jt from "axios";
5
+ import './index_external.css';var At = { exports: {} }, St = {};
6
6
  /**
7
7
  * @license React
8
8
  * react-jsx-runtime.production.js
@@ -12,29 +12,29 @@ import './index_external.css';var Dt = { exports: {} }, Ft = {};
12
12
  * This source code is licensed under the MIT license found in the
13
13
  * LICENSE file in the root directory of this source tree.
14
14
  */
15
- var oe;
16
- function qe() {
17
- if (oe) return Ft;
18
- oe = 1;
15
+ var Kt;
16
+ function Qe() {
17
+ if (Kt) return St;
18
+ Kt = 1;
19
19
  var f = Symbol.for("react.transitional.element"), o = Symbol.for("react.fragment");
20
- function a(d, s, h) {
21
- var g = null;
22
- if (h !== void 0 && (g = "" + h), s.key !== void 0 && (g = "" + s.key), "key" in s) {
20
+ function a(n, s, h) {
21
+ var x = null;
22
+ if (h !== void 0 && (x = "" + h), s.key !== void 0 && (x = "" + s.key), "key" in s) {
23
23
  h = {};
24
24
  for (var l in s)
25
25
  l !== "key" && (h[l] = s[l]);
26
26
  } else h = s;
27
27
  return s = h.ref, {
28
28
  $$typeof: f,
29
- type: d,
30
- key: g,
29
+ type: n,
30
+ key: x,
31
31
  ref: s !== void 0 ? s : null,
32
32
  props: h
33
33
  };
34
34
  }
35
- return Ft.Fragment = o, Ft.jsx = a, Ft.jsxs = a, Ft;
35
+ return St.Fragment = o, St.jsx = a, St.jsxs = a, St;
36
36
  }
37
- var Ct = {};
37
+ var Ft = {};
38
38
  /**
39
39
  * @license React
40
40
  * react-jsx-runtime.development.js
@@ -44,24 +44,24 @@ var Ct = {};
44
44
  * This source code is licensed under the MIT license found in the
45
45
  * LICENSE file in the root directory of this source tree.
46
46
  */
47
- var re;
48
- function Ve() {
49
- return re || (re = 1, process.env.NODE_ENV !== "production" && function() {
47
+ var Zt;
48
+ function $e() {
49
+ return Zt || (Zt = 1, process.env.NODE_ENV !== "production" && function() {
50
50
  function f(y) {
51
51
  if (y == null) return null;
52
52
  if (typeof y == "function")
53
- return y.$$typeof === Q ? null : y.displayName || y.name || null;
53
+ return y.$$typeof === $ ? null : y.displayName || y.name || null;
54
54
  if (typeof y == "string") return y;
55
55
  switch (y) {
56
56
  case S:
57
57
  return "Fragment";
58
- case J:
58
+ case K:
59
59
  return "Profiler";
60
- case T:
60
+ case j:
61
61
  return "StrictMode";
62
62
  case st:
63
63
  return "Suspense";
64
- case M:
64
+ case W:
65
65
  return "SuspenseList";
66
66
  case ct:
67
67
  return "Activity";
@@ -70,9 +70,9 @@ function Ve() {
70
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
72
  ), y.$$typeof) {
73
- case B:
73
+ case z:
74
74
  return "Portal";
75
- case $:
75
+ case Q:
76
76
  return (y.displayName || "Context") + ".Provider";
77
77
  case C:
78
78
  return (y._context.displayName || "Context") + ".Consumer";
@@ -102,15 +102,15 @@ function Ve() {
102
102
  }
103
103
  if (I) {
104
104
  I = console;
105
- var W = I.error, H = typeof Symbol == "function" && Symbol.toStringTag && y[Symbol.toStringTag] || y.constructor.name || "Object";
106
- return W.call(
105
+ var M = I.error, H = typeof Symbol == "function" && Symbol.toStringTag && y[Symbol.toStringTag] || y.constructor.name || "Object";
106
+ return M.call(
107
107
  I,
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
110
  ), o(y);
111
111
  }
112
112
  }
113
- function d(y) {
113
+ function n(y) {
114
114
  if (y === S) return "<>";
115
115
  if (typeof y == "object" && y !== null && y.$$typeof === O)
116
116
  return "<...>";
@@ -122,47 +122,47 @@ function Ve() {
122
122
  }
123
123
  }
124
124
  function s() {
125
- var y = rt.A;
125
+ var y = ot.A;
126
126
  return y === null ? null : y.getOwner();
127
127
  }
128
128
  function h() {
129
129
  return Error("react-stack-top-frame");
130
130
  }
131
- function g(y) {
132
- if (P.call(y, "key")) {
131
+ function x(y) {
132
+ if (L.call(y, "key")) {
133
133
  var I = Object.getOwnPropertyDescriptor(y, "key").get;
134
134
  if (I && I.isReactWarning) return !1;
135
135
  }
136
136
  return y.key !== void 0;
137
137
  }
138
138
  function l(y, I) {
139
- function W() {
139
+ function M() {
140
140
  nt || (nt = !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
  I
143
143
  ));
144
144
  }
145
- W.isReactWarning = !0, Object.defineProperty(y, "key", {
146
- get: W,
145
+ M.isReactWarning = !0, Object.defineProperty(y, "key", {
146
+ get: M,
147
147
  configurable: !0
148
148
  });
149
149
  }
150
- function n() {
150
+ function d() {
151
151
  var y = f(this.type);
152
152
  return _[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
154
  )), y = this.props.ref, y !== void 0 ? y : null;
155
155
  }
156
- function F(y, I, W, H, G, Z, q, Y) {
157
- return W = Z.ref, y = {
156
+ function F(y, I, M, H, G, tt, q, Y) {
157
+ return M = tt.ref, y = {
158
158
  $$typeof: E,
159
159
  type: y,
160
160
  key: I,
161
- props: Z,
161
+ props: tt,
162
162
  _owner: G
163
- }, (W !== void 0 ? W : null) !== null ? Object.defineProperty(y, "ref", {
163
+ }, (M !== void 0 ? M : null) !== null ? Object.defineProperty(y, "ref", {
164
164
  enumerable: !1,
165
- get: n
165
+ get: d
166
166
  }) : Object.defineProperty(y, "ref", { enumerable: !1, value: null }), y._store = {}, Object.defineProperty(y._store, "validated", {
167
167
  configurable: !1,
168
168
  enumerable: !1,
@@ -185,25 +185,25 @@ function Ve() {
185
185
  value: Y
186
186
  }), Object.freeze && (Object.freeze(y.props), Object.freeze(y)), y;
187
187
  }
188
- function N(y, I, W, H, G, Z, q, Y) {
189
- var L = I.children;
190
- if (L !== void 0)
188
+ function T(y, I, M, H, G, tt, q, Y) {
189
+ var U = I.children;
190
+ if (U !== void 0)
191
191
  if (H)
192
- if (lt(L)) {
193
- for (H = 0; H < L.length; H++)
194
- R(L[H]);
195
- Object.freeze && Object.freeze(L);
192
+ if (lt(U)) {
193
+ for (H = 0; H < U.length; H++)
194
+ R(U[H]);
195
+ Object.freeze && Object.freeze(U);
196
196
  } else
197
197
  console.error(
198
198
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
199
199
  );
200
- else R(L);
201
- if (P.call(I, "key")) {
202
- L = f(y);
203
- var ot = Object.keys(I).filter(function(Wt) {
204
- return Wt !== "key";
200
+ else R(U);
201
+ if (L.call(I, "key")) {
202
+ U = f(y);
203
+ var X = Object.keys(I).filter(function(ft) {
204
+ return ft !== "key";
205
205
  });
206
- H = 0 < ot.length ? "{key: someKey, " + ot.join(": ..., ") + ": ...}" : "{key: someKey}", K[L + H] || (ot = 0 < ot.length ? "{" + ot.join(": ..., ") + ": ...}" : "{}", console.error(
206
+ H = 0 < X.length ? "{key: someKey, " + X.join(": ..., ") + ": ...}" : "{key: someKey}", Z[U + H] || (X = 0 < X.length ? "{" + X.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} />
@@ -211,26 +211,26 @@ React keys must be passed directly to JSX without using spread:
211
211
  let props = %s;
212
212
  <%s key={someKey} {...props} />`,
213
213
  H,
214
- L,
215
- ot,
216
- L
217
- ), K[L + H] = !0);
214
+ U,
215
+ X,
216
+ U
217
+ ), Z[U + H] = !0);
218
218
  }
219
- if (L = null, W !== void 0 && (a(W), L = "" + W), g(I) && (a(I.key), L = "" + I.key), "key" in I) {
220
- W = {};
221
- for (var jt in I)
222
- jt !== "key" && (W[jt] = I[jt]);
223
- } else W = I;
224
- return L && l(
225
- W,
219
+ if (U = null, M !== void 0 && (a(M), U = "" + M), x(I) && (a(I.key), U = "" + I.key), "key" in I) {
220
+ M = {};
221
+ for (var bt in I)
222
+ bt !== "key" && (M[bt] = I[bt]);
223
+ } else M = I;
224
+ return U && l(
225
+ M,
226
226
  typeof y == "function" ? y.displayName || y.name || "Unknown" : y
227
227
  ), F(
228
228
  y,
229
- L,
230
- Z,
229
+ U,
230
+ tt,
231
231
  G,
232
232
  s(),
233
- W,
233
+ M,
234
234
  q,
235
235
  Y
236
236
  );
@@ -238,51 +238,51 @@ React keys must be passed directly to JSX without using spread:
238
238
  function R(y) {
239
239
  typeof y == "object" && y !== null && y.$$typeof === E && y._store && (y._store.validated = 1);
240
240
  }
241
- var m = Qe, E = Symbol.for("react.transitional.element"), B = Symbol.for("react.portal"), S = Symbol.for("react.fragment"), T = Symbol.for("react.strict_mode"), J = Symbol.for("react.profiler"), C = Symbol.for("react.consumer"), $ = Symbol.for("react.context"), k = Symbol.for("react.forward_ref"), st = Symbol.for("react.suspense"), M = Symbol.for("react.suspense_list"), ht = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), ct = Symbol.for("react.activity"), Q = Symbol.for("react.client.reference"), rt = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, P = Object.prototype.hasOwnProperty, lt = Array.isArray, X = console.createTask ? console.createTask : function() {
241
+ var u = We, E = Symbol.for("react.transitional.element"), z = Symbol.for("react.portal"), S = Symbol.for("react.fragment"), j = Symbol.for("react.strict_mode"), K = Symbol.for("react.profiler"), C = Symbol.for("react.consumer"), Q = Symbol.for("react.context"), k = Symbol.for("react.forward_ref"), st = Symbol.for("react.suspense"), W = Symbol.for("react.suspense_list"), ht = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), ct = Symbol.for("react.activity"), $ = Symbol.for("react.client.reference"), ot = u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, L = Object.prototype.hasOwnProperty, lt = Array.isArray, J = console.createTask ? console.createTask : function() {
242
242
  return null;
243
243
  };
244
- m = {
244
+ u = {
245
245
  "react-stack-bottom-frame": function(y) {
246
246
  return y();
247
247
  }
248
248
  };
249
- var nt, _ = {}, U = m["react-stack-bottom-frame"].bind(
250
- m,
249
+ var nt, _ = {}, P = u["react-stack-bottom-frame"].bind(
250
+ u,
251
251
  h
252
- )(), u = X(d(h)), K = {};
253
- Ct.Fragment = S, Ct.jsx = function(y, I, W, H, G) {
254
- var Z = 1e4 > rt.recentlyCreatedOwnerStacks++;
255
- return N(
252
+ )(), p = J(n(h)), Z = {};
253
+ Ft.Fragment = S, Ft.jsx = function(y, I, M, H, G) {
254
+ var tt = 1e4 > ot.recentlyCreatedOwnerStacks++;
255
+ return T(
256
256
  y,
257
257
  I,
258
- W,
258
+ M,
259
259
  !1,
260
260
  H,
261
261
  G,
262
- Z ? Error("react-stack-top-frame") : U,
263
- Z ? X(d(y)) : u
262
+ tt ? Error("react-stack-top-frame") : P,
263
+ tt ? J(n(y)) : p
264
264
  );
265
- }, Ct.jsxs = function(y, I, W, H, G) {
266
- var Z = 1e4 > rt.recentlyCreatedOwnerStacks++;
267
- return N(
265
+ }, Ft.jsxs = function(y, I, M, H, G) {
266
+ var tt = 1e4 > ot.recentlyCreatedOwnerStacks++;
267
+ return T(
268
268
  y,
269
269
  I,
270
- W,
270
+ M,
271
271
  !0,
272
272
  H,
273
273
  G,
274
- Z ? Error("react-stack-top-frame") : U,
275
- Z ? X(d(y)) : u
274
+ tt ? Error("react-stack-top-frame") : P,
275
+ tt ? J(n(y)) : p
276
276
  );
277
277
  };
278
- }()), Ct;
278
+ }()), Ft;
279
279
  }
280
- var ae;
281
- function Xe() {
282
- return ae || (ae = 1, process.env.NODE_ENV === "production" ? Dt.exports = qe() : Dt.exports = Ve()), Dt.exports;
280
+ var te;
281
+ function He() {
282
+ return te || (te = 1, process.env.NODE_ENV === "production" ? At.exports = Qe() : At.exports = $e()), At.exports;
283
283
  }
284
- var i = Xe();
285
- const Mt = {
284
+ var i = He();
285
+ const zt = {
286
286
  business: {
287
287
  name: "Business & Office",
288
288
  icons: [
@@ -373,38 +373,38 @@ const Mt = {
373
373
  { name: "shield", symbol: "🛡️", unicode: "🛡️" }
374
374
  ]
375
375
  }
376
- }, le = () => Object.values(Mt).flatMap(
376
+ }, ie = () => Object.values(zt).flatMap(
377
377
  (f) => f.icons.map((o) => ({
378
378
  ...o,
379
379
  category: f.name
380
380
  }))
381
- ), Je = (f) => le().filter(
381
+ ), Ge = (f) => ie().filter(
382
382
  (a) => a.name.toLowerCase().includes(f.toLowerCase()) || a.category.toLowerCase().includes(f.toLowerCase())
383
- ), Ke = ({ onSelectIcon: f, disabled: o = !1 }) => {
384
- const [a, d] = j(!1), [s, h] = j(""), [g, l] = j("all"), n = ft(null);
383
+ ), _e = ({ onSelectIcon: f, disabled: o = !1 }) => {
384
+ const [a, n] = N(!1), [s, h] = N(""), [x, l] = N("all"), d = xt(null);
385
385
  it(() => {
386
- const m = (E) => {
387
- n.current && !n.current.contains(E.target) && d(!1);
386
+ const u = (E) => {
387
+ d.current && !d.current.contains(E.target) && n(!1);
388
388
  };
389
- return document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
389
+ return document.addEventListener("mousedown", u), () => document.removeEventListener("mousedown", u);
390
390
  }, []);
391
- const F = (m) => {
392
- f(m), d(!1), h("");
391
+ const F = (u) => {
392
+ f(u), n(!1), h("");
393
393
  }, R = (() => {
394
- let m = le();
395
- if (s.trim() && (m = Je(s)), g !== "all") {
396
- const E = Mt[g];
397
- E && (m = m.filter((B) => B.category === E.name));
394
+ let u = ie();
395
+ if (s.trim() && (u = Ge(s)), x !== "all") {
396
+ const E = zt[x];
397
+ E && (u = u.filter((z) => z.category === E.name));
398
398
  }
399
- return m;
399
+ return u;
400
400
  })();
401
- return /* @__PURE__ */ i.jsxs("div", { className: "icon-selector", ref: n, children: [
401
+ return /* @__PURE__ */ i.jsxs("div", { className: "icon-selector", ref: d, children: [
402
402
  /* @__PURE__ */ i.jsxs(
403
403
  "button",
404
404
  {
405
405
  className: "toolbar-btn dropdown-trigger",
406
406
  disabled: o,
407
- onClick: () => d(!a),
407
+ onClick: () => n(!a),
408
408
  title: "Add Icon",
409
409
  children: [
410
410
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "🎯" }),
@@ -421,35 +421,35 @@ const Mt = {
421
421
  type: "text",
422
422
  placeholder: "Search icons...",
423
423
  value: s,
424
- onChange: (m) => h(m.target.value),
424
+ onChange: (u) => h(u.target.value),
425
425
  className: "icon-search"
426
426
  }
427
427
  ),
428
428
  /* @__PURE__ */ i.jsxs(
429
429
  "select",
430
430
  {
431
- value: g,
432
- onChange: (m) => l(m.target.value),
431
+ value: x,
432
+ onChange: (u) => l(u.target.value),
433
433
  className: "category-select",
434
434
  children: [
435
435
  /* @__PURE__ */ i.jsx("option", { value: "all", children: "All Categories" }),
436
- Object.entries(Mt).map(([m, E]) => /* @__PURE__ */ i.jsx("option", { value: m, children: E.name }, m))
436
+ Object.entries(zt).map(([u, E]) => /* @__PURE__ */ i.jsx("option", { value: u, children: E.name }, u))
437
437
  ]
438
438
  }
439
439
  )
440
440
  ] }),
441
- /* @__PURE__ */ i.jsx("div", { className: "icon-grid", children: R.length === 0 ? /* @__PURE__ */ i.jsx("div", { className: "no-icons", children: s ? "No icons found" : "No icons in this category" }) : R.map((m, E) => /* @__PURE__ */ i.jsxs(
441
+ /* @__PURE__ */ i.jsx("div", { className: "icon-grid", children: R.length === 0 ? /* @__PURE__ */ i.jsx("div", { className: "no-icons", children: s ? "No icons found" : "No icons in this category" }) : R.map((u, E) => /* @__PURE__ */ i.jsxs(
442
442
  "button",
443
443
  {
444
444
  className: "icon-item",
445
- onClick: () => F(m),
446
- title: `${m.name} (${m.category})`,
445
+ onClick: () => F(u),
446
+ title: `${u.name} (${u.category})`,
447
447
  children: [
448
- /* @__PURE__ */ i.jsx("span", { className: "icon-symbol", children: m.symbol }),
449
- /* @__PURE__ */ i.jsx("span", { className: "icon-name", children: m.name })
448
+ /* @__PURE__ */ i.jsx("span", { className: "icon-symbol", children: u.symbol }),
449
+ /* @__PURE__ */ i.jsx("span", { className: "icon-name", children: u.name })
450
450
  ]
451
451
  },
452
- `${m.name}-${E}`
452
+ `${u.name}-${E}`
453
453
  )) }),
454
454
  /* @__PURE__ */ i.jsx("div", { className: "icon-dropdown-footer", children: /* @__PURE__ */ i.jsxs("span", { className: "icon-count", children: [
455
455
  R.length,
@@ -458,12 +458,12 @@ const Mt = {
458
458
  ] }) })
459
459
  ] })
460
460
  ] });
461
- }, Ze = ({ isOpen: f, onClose: o, onAddQRCode: a, theme: d }) => {
462
- const [s, h] = j(""), [g, l] = j(""), [n, F] = j(200), [N, R] = j("M"), m = () => {
461
+ }, Ye = ({ isOpen: f, onClose: o, onAddQRCode: a, theme: n }) => {
462
+ const [s, h] = N(""), [x, l] = N(""), [d, F] = N(200), [T, R] = N("M"), u = () => {
463
463
  if (!s.trim()) return;
464
464
  const S = {
465
- width: n,
466
- errorCorrectionLevel: N,
465
+ width: d,
466
+ errorCorrectionLevel: T,
467
467
  type: "image/png",
468
468
  quality: 0.92,
469
469
  margin: 1,
@@ -472,40 +472,40 @@ const Mt = {
472
472
  light: "#FFFFFF"
473
473
  }
474
474
  };
475
- _e.toDataURL(s, S, (T, J) => {
476
- if (T) {
477
- console.error("QR Code generation error:", T);
475
+ Ue.toDataURL(s, S, (j, K) => {
476
+ if (j) {
477
+ console.error("QR Code generation error:", j);
478
478
  return;
479
479
  }
480
- l(J);
480
+ l(K);
481
481
  });
482
482
  }, E = () => {
483
- if (!g) return;
483
+ if (!x) return;
484
484
  const S = new Image();
485
485
  S.onload = () => {
486
486
  a({
487
487
  type: "qrcode",
488
- src: g,
488
+ src: x,
489
489
  data: s,
490
- width: n,
491
- height: n,
490
+ width: d,
491
+ height: d,
492
492
  x: 100,
493
493
  y: 100,
494
494
  imageObject: S
495
495
  // Store the loaded image object
496
- }), B();
497
- }, S.src = g;
498
- }, B = () => {
496
+ }), z();
497
+ }, S.src = x;
498
+ }, z = () => {
499
499
  h(""), l(""), 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: (S) => S.stopPropagation(), children: [
501
+ return f ? /* @__PURE__ */ i.jsx("div", { className: "qr-modal-overlay", onClick: z, children: /* @__PURE__ */ i.jsxs("div", { className: "qr-modal-content", onClick: (S) => S.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: z,
509
509
  "aria-label": "Close",
510
510
  children: "×"
511
511
  }
@@ -533,7 +533,7 @@ const Mt = {
533
533
  {
534
534
  type: "number",
535
535
  id: "qr-size",
536
- value: n,
536
+ value: d,
537
537
  onChange: (S) => F(Math.max(50, Math.min(500, parseInt(S.target.value) || 200))),
538
538
  min: "50",
539
539
  max: "500"
@@ -546,7 +546,7 @@ const Mt = {
546
546
  "select",
547
547
  {
548
548
  id: "qr-error-level",
549
- value: N,
549
+ value: T,
550
550
  onChange: (S) => R(S.target.value),
551
551
  children: [
552
552
  /* @__PURE__ */ i.jsx("option", { value: "L", children: "Low (7%)" }),
@@ -562,22 +562,22 @@ const Mt = {
562
562
  "button",
563
563
  {
564
564
  className: "qr-btn qr-btn-generate",
565
- onClick: m,
565
+ onClick: u,
566
566
  disabled: !s.trim(),
567
567
  children: "Generate QR Code"
568
568
  }
569
569
  ) }),
570
- g && /* @__PURE__ */ i.jsxs("div", { className: "qr-preview", children: [
570
+ x && /* @__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: g, alt: "QR Code Preview" }) }),
572
+ /* @__PURE__ */ i.jsx("div", { className: "qr-preview-container", children: /* @__PURE__ */ i.jsx("img", { src: x, alt: "QR Code Preview" }) }),
573
573
  /* @__PURE__ */ i.jsx(
574
574
  "button",
575
575
  {
576
576
  className: "qr-btn qr-btn-add",
577
577
  onClick: E,
578
578
  style: {
579
- backgroundColor: (d == null ? void 0 : d.primaryColor) || "#3b82f6",
580
- borderColor: (d == null ? void 0 : d.primaryColor) || "#3b82f6"
579
+ backgroundColor: (n == null ? void 0 : n.primaryColor) || "#3b82f6",
580
+ borderColor: (n == null ? void 0 : n.primaryColor) || "#3b82f6"
581
581
  },
582
582
  children: "Add to Canvas"
583
583
  }
@@ -585,8 +585,8 @@ const Mt = {
585
585
  ] })
586
586
  ] })
587
587
  ] }) }) : null;
588
- }, ti = ({ isOpen: f, onClose: o, onAddBarcode: a, theme: d }) => {
589
- const [s, h] = j(""), [g, l] = j("CODE128"), [n, F] = j(null), [N, R] = j(2), [m, E] = j(100), [B, S] = j(20), [T, J] = j("center"), [C, $] = j("bottom"), [k, st] = j(10), M = ft(null), ht = [
588
+ }, qe = ({ isOpen: f, onClose: o, onAddBarcode: a, theme: n }) => {
589
+ const [s, h] = N(""), [x, l] = N("CODE128"), [d, F] = N(null), [T, R] = N(2), [u, E] = N(100), [z, S] = N(20), [j, K] = N("center"), [C, Q] = N("bottom"), [k, st] = N(10), W = xt(null), ht = [
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)" },
@@ -600,58 +600,58 @@ const Mt = {
600
600
  if (s.trim())
601
601
  try {
602
602
  F(/* @__PURE__ */ i.jsx(
603
- Ye,
603
+ Oe,
604
604
  {
605
605
  value: s,
606
- format: g,
607
- width: N,
608
- height: m,
609
- fontSize: B,
610
- textAlign: T,
606
+ format: x,
607
+ width: T,
608
+ height: u,
609
+ fontSize: z,
610
+ textAlign: j,
611
611
  textPosition: C,
612
612
  margin: k,
613
613
  background: "#ffffff",
614
614
  lineColor: "#000000"
615
615
  }
616
616
  ));
617
- } catch (P) {
618
- console.error("Barcode generation error:", P), alert("Invalid data for selected barcode format. Please check your input.");
617
+ } catch (L) {
618
+ console.error("Barcode generation error:", L), alert("Invalid data for selected barcode format. Please check your input.");
619
619
  }
620
620
  }, ct = () => {
621
- var P, lt, X, nt;
622
- if (!(!n || !M.current))
621
+ var L, lt, J, nt;
622
+ if (!(!d || !W.current))
623
623
  try {
624
- const _ = M.current.querySelector("svg");
624
+ const _ = W.current.querySelector("svg");
625
625
  if (!_) {
626
626
  console.error("No SVG element found in barcode");
627
627
  return;
628
628
  }
629
- const U = document.createElement("canvas"), u = U.getContext("2d"), K = _.getBoundingClientRect(), y = ((lt = (P = _.width) == null ? void 0 : P.baseVal) == null ? void 0 : lt.value) || K.width || 200, I = ((nt = (X = _.height) == null ? void 0 : X.baseVal) == null ? void 0 : nt.value) || K.height || 100;
630
- U.width = y, U.height = I;
631
- const W = new XMLSerializer().serializeToString(_), H = new Blob([W], { type: "image/svg+xml;charset=utf-8" }), G = URL.createObjectURL(H), Z = new Image();
632
- Z.onload = () => {
633
- u.drawImage(Z, 0, 0);
634
- const q = U.toDataURL("image/png"), Y = new Image();
629
+ const P = document.createElement("canvas"), p = P.getContext("2d"), Z = _.getBoundingClientRect(), y = ((lt = (L = _.width) == null ? void 0 : L.baseVal) == null ? void 0 : lt.value) || Z.width || 200, I = ((nt = (J = _.height) == null ? void 0 : J.baseVal) == null ? void 0 : nt.value) || Z.height || 100;
630
+ P.width = y, P.height = I;
631
+ const M = new XMLSerializer().serializeToString(_), H = new Blob([M], { type: "image/svg+xml;charset=utf-8" }), G = URL.createObjectURL(H), tt = new Image();
632
+ tt.onload = () => {
633
+ p.drawImage(tt, 0, 0);
634
+ const q = P.toDataURL("image/png"), Y = new Image();
635
635
  Y.onload = () => {
636
636
  a({
637
637
  type: "barcode",
638
638
  src: q,
639
639
  data: s,
640
- format: g,
640
+ format: x,
641
641
  width: y,
642
642
  height: I,
643
643
  x: 100,
644
644
  y: 100,
645
645
  imageObject: Y
646
- }), Q();
646
+ }), $();
647
647
  }, Y.src = q, URL.revokeObjectURL(G);
648
- }, Z.src = G;
648
+ }, tt.src = G;
649
649
  } catch (_) {
650
650
  console.error("Error adding barcode to canvas:", _), alert("Failed to add barcode to canvas. Please try again.");
651
651
  }
652
- }, Q = () => {
652
+ }, $ = () => {
653
653
  h(""), F(null), l("CODE128"), R(2), E(100), S(20), o();
654
- }, rt = (P) => ({
654
+ }, ot = (L) => ({
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.",
@@ -661,15 +661,15 @@ const Mt = {
661
661
  MSI: "Numeric only. Used in retail inventory.",
662
662
  pharmacode: "Numbers 3-131070. Used in pharmaceutical industry.",
663
663
  codabar: "Supports 0-9, A-D, and symbols. Used in libraries."
664
- })[P] || "";
665
- return f ? /* @__PURE__ */ i.jsx("div", { className: "barcode-modal-overlay", onClick: Q, children: /* @__PURE__ */ i.jsxs("div", { className: "barcode-modal-content", onClick: (P) => P.stopPropagation(), children: [
664
+ })[L] || "";
665
+ return f ? /* @__PURE__ */ i.jsx("div", { className: "barcode-modal-overlay", onClick: $, children: /* @__PURE__ */ i.jsxs("div", { className: "barcode-modal-content", onClick: (L) => L.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 Mt = {
684
684
  type: "text",
685
685
  id: "barcode-data",
686
686
  value: s,
687
- onChange: (P) => h(P.target.value),
687
+ onChange: (L) => h(L.target.value),
688
688
  placeholder: "Enter your data..."
689
689
  }
690
690
  )
@@ -695,12 +695,12 @@ const Mt = {
695
695
  "select",
696
696
  {
697
697
  id: "barcode-format",
698
- value: g,
699
- onChange: (P) => l(P.target.value),
700
- children: ht.map((P) => /* @__PURE__ */ i.jsx("option", { value: P.value, children: P.label }, P.value))
698
+ value: x,
699
+ onChange: (L) => l(L.target.value),
700
+ children: ht.map((L) => /* @__PURE__ */ i.jsx("option", { value: L.value, children: L.label }, L.value))
701
701
  }
702
702
  ),
703
- /* @__PURE__ */ i.jsx("small", { className: "format-description", children: rt(g) })
703
+ /* @__PURE__ */ i.jsx("small", { className: "format-description", children: ot(x) })
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 Mt = {
713
713
  min: "1",
714
714
  max: "4",
715
715
  step: "0.5",
716
- value: N,
717
- onChange: (P) => R(parseFloat(P.target.value))
716
+ value: T,
717
+ onChange: (L) => R(parseFloat(L.target.value))
718
718
  }
719
719
  ),
720
720
  /* @__PURE__ */ i.jsxs("span", { className: "range-value", children: [
721
- N,
721
+ T,
722
722
  "px"
723
723
  ] })
724
724
  ] }),
@@ -731,12 +731,12 @@ const Mt = {
731
731
  id: "barcode-height",
732
732
  min: "50",
733
733
  max: "200",
734
- value: m,
735
- onChange: (P) => E(parseInt(P.target.value))
734
+ value: u,
735
+ onChange: (L) => E(parseInt(L.target.value))
736
736
  }
737
737
  ),
738
738
  /* @__PURE__ */ i.jsxs("span", { className: "range-value", children: [
739
- m,
739
+ u,
740
740
  "px"
741
741
  ] })
742
742
  ] }),
@@ -749,12 +749,12 @@ const Mt = {
749
749
  id: "barcode-fontsize",
750
750
  min: "10",
751
751
  max: "30",
752
- value: B,
753
- onChange: (P) => S(parseInt(P.target.value))
752
+ value: z,
753
+ onChange: (L) => S(parseInt(L.target.value))
754
754
  }
755
755
  ),
756
756
  /* @__PURE__ */ i.jsxs("span", { className: "range-value", children: [
757
- B,
757
+ z,
758
758
  "px"
759
759
  ] })
760
760
  ] }),
@@ -765,7 +765,7 @@ const Mt = {
765
765
  {
766
766
  id: "text-position",
767
767
  value: C,
768
- onChange: (P) => $(P.target.value),
768
+ onChange: (L) => Q(L.target.value),
769
769
  children: [
770
770
  /* @__PURE__ */ i.jsx("option", { value: "bottom", children: "Bottom" }),
771
771
  /* @__PURE__ */ i.jsx("option", { value: "top", children: "Top" })
@@ -783,17 +783,17 @@ const Mt = {
783
783
  children: "Generate Barcode"
784
784
  }
785
785
  ) }),
786
- n && /* @__PURE__ */ i.jsxs("div", { className: "barcode-preview", children: [
786
+ d && /* @__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: M, children: n }),
788
+ /* @__PURE__ */ i.jsx("div", { className: "barcode-preview-container", ref: W, children: d }),
789
789
  /* @__PURE__ */ i.jsx(
790
790
  "button",
791
791
  {
792
792
  className: "barcode-btn barcode-btn-add",
793
793
  onClick: ct,
794
794
  style: {
795
- backgroundColor: (d == null ? void 0 : d.primaryColor) || "#3b82f6",
796
- borderColor: (d == null ? void 0 : d.primaryColor) || "#3b82f6"
795
+ backgroundColor: (n == null ? void 0 : n.primaryColor) || "#3b82f6",
796
+ borderColor: (n == null ? void 0 : n.primaryColor) || "#3b82f6"
797
797
  },
798
798
  children: "Add to Canvas"
799
799
  }
@@ -801,7 +801,7 @@ const Mt = {
801
801
  ] })
802
802
  ] })
803
803
  ] }) }) : null;
804
- }, ei = ({ theme: f }) => /* @__PURE__ */ i.jsxs("div", { className: "premium-feature-container", style: {
804
+ }, Ve = ({ theme: f }) => /* @__PURE__ */ i.jsxs("div", { className: "premium-feature-container", style: {
805
805
  padding: "20px",
806
806
  backgroundColor: "#f8f9fa",
807
807
  borderRadius: "8px",
@@ -847,7 +847,7 @@ const Mt = {
847
847
  children: "Get API Key"
848
848
  }
849
849
  )
850
- ] }), se = () => /* @__PURE__ */ i.jsxs("div", { style: { textAlign: "center", padding: "40px" }, children: [
850
+ ] }), ee = () => /* @__PURE__ */ i.jsxs("div", { style: { textAlign: "center", padding: "40px" }, children: [
851
851
  /* @__PURE__ */ i.jsx("div", { style: {
852
852
  border: "4px solid #f3f3f3",
853
853
  borderTop: "4px solid #3498db",
@@ -864,87 +864,87 @@ const Mt = {
864
864
  100% { transform: rotate(360deg); }
865
865
  }
866
866
  ` })
867
- ] }), ii = ({ isOpen: f, onClose: o, onAddSticker: a, theme: d, apiKey: s, apiEndpoint: h }) => {
868
- const [g, l] = j([]), [n, F] = j(!1), [N, R] = j(null), [m, E] = j(""), [B, S] = j(""), [T, J] = j({});
869
- ft(null);
870
- const [C, $] = j(!1), [k, st] = j(!1), [M, ht] = j(!1), O = `${h}/api/v1/designer`;
867
+ ] }), Xe = ({ isOpen: f, onClose: o, onAddSticker: a, theme: n, apiKey: s, apiEndpoint: h }) => {
868
+ const [x, l] = N([]), [d, F] = N(!1), [T, R] = N(null), [u, E] = N(""), [z, S] = N(""), [j, K] = N({});
869
+ xt(null);
870
+ const [C, Q] = N(!1), [k, st] = N(!1), [W, ht] = N(!1), O = `${h}/api/v1/designer`;
871
871
  it(() => {
872
872
  f && s && ct();
873
873
  }, [f, s]);
874
874
  const ct = async () => {
875
- const U = sessionStorage.getItem("apc_x_sub_status");
876
- U === "active" ? ($(!0), st(!0), rt()) : U === "inactive" ? ($(!1), st(!0)) : (ht(!0), await Q());
877
- }, Q = async () => {
875
+ const P = sessionStorage.getItem("apc_x_sub_status");
876
+ P === "active" ? (Q(!0), st(!0), ot()) : P === "inactive" ? (Q(!1), st(!0)) : (ht(!0), await $());
877
+ }, $ = async () => {
878
878
  if (!s) {
879
- $(!1), st(!0), ht(!1);
879
+ Q(!1), st(!0), ht(!1);
880
880
  return;
881
881
  }
882
- const U = `${O}/get-subscription-status/${s}`;
882
+ const P = `${O}/get-subscription-status/${s}`;
883
883
  try {
884
- (await ie.get(U)).data.object === "active" ? (sessionStorage.setItem("apc_x_sub_status", "active"), $(!0), rt()) : (sessionStorage.setItem("apc_x_sub_status", "inactive"), $(!1));
885
- } catch (u) {
886
- console.error("Subscription check failed:", u), sessionStorage.setItem("apc_x_sub_status", "inactive"), $(!1);
884
+ (await Jt.get(P)).data.object === "active" ? (sessionStorage.setItem("apc_x_sub_status", "active"), Q(!0), ot()) : (sessionStorage.setItem("apc_x_sub_status", "inactive"), Q(!1));
885
+ } catch (p) {
886
+ console.error("Subscription check failed:", p), sessionStorage.setItem("apc_x_sub_status", "inactive"), Q(!1);
887
887
  } finally {
888
888
  ht(!1), st(!0);
889
889
  }
890
- }, rt = async () => {
891
- const U = sessionStorage.getItem("apc_stickers");
892
- if (U)
890
+ }, ot = async () => {
891
+ const P = sessionStorage.getItem("apc_stickers");
892
+ if (P)
893
893
  try {
894
- const u = JSON.parse(U);
895
- l(u);
894
+ const p = JSON.parse(P);
895
+ l(p);
896
896
  return;
897
897
  } catch {
898
898
  console.warn("Failed to parse cached stickers, fetching fresh data");
899
899
  }
900
900
  F(!0), R(null);
901
901
  try {
902
- const u = await ie.get(`${O}/get-stickers`);
903
- if (u.data && u.data.object && u.data.object.contents) {
904
- const K = u.data.object.contents;
905
- l(K), sessionStorage.setItem("apc_stickers", JSON.stringify(K));
902
+ const p = await Jt.get(`${O}/get-stickers`);
903
+ if (p.data && p.data.object && p.data.object.contents) {
904
+ const Z = p.data.object.contents;
905
+ l(Z), sessionStorage.setItem("apc_stickers", JSON.stringify(Z));
906
906
  } else
907
907
  throw new Error("Invalid response format");
908
- } catch (u) {
909
- console.error("Error fetching stickers:", u), R("Failed to load stickers. Please try again.");
908
+ } catch (p) {
909
+ console.error("Error fetching stickers:", p), R("Failed to load stickers. Please try again.");
910
910
  } finally {
911
911
  F(!1);
912
912
  }
913
- }, P = (U, u) => {
913
+ }, L = (P, p) => {
914
914
  a({
915
915
  type: "sticker",
916
- src: U,
917
- name: u,
916
+ src: P,
917
+ name: p,
918
918
  width: 100,
919
919
  height: 100,
920
920
  x: 100,
921
921
  y: 100
922
922
  }), o();
923
- }, lt = (U) => {
924
- J((u) => ({
925
- ...u,
926
- [U]: !u[U]
923
+ }, lt = (P) => {
924
+ K((p) => ({
925
+ ...p,
926
+ [P]: !p[P]
927
927
  }));
928
- }, X = (U) => {
929
- const u = {};
930
- return U.forEach((K) => {
931
- const y = K.name.split("/");
932
- let I = u;
933
- y.forEach((W, H) => {
934
- I[W] || (I[W] = H === y.length - 1 ? K : {}), I = I[W];
928
+ }, J = (P) => {
929
+ const p = {};
930
+ return P.forEach((Z) => {
931
+ const y = Z.name.split("/");
932
+ let I = p;
933
+ y.forEach((M, H) => {
934
+ I[M] || (I[M] = H === y.length - 1 ? Z : {}), I = I[M];
935
935
  });
936
- }), u;
937
- }, nt = (U, u = "", K = 0) => /* @__PURE__ */ i.jsx("div", { className: "sticker-tree-level", style: { paddingLeft: `${K * 15}px` }, children: Object.keys(U).map((y) => {
938
- const I = `${u}/${y}`, W = T[I];
939
- return U[y].type === "image" ? !B || y.toLowerCase().includes(B.toLowerCase()) ? /* @__PURE__ */ i.jsx(
936
+ }), p;
937
+ }, nt = (P, p = "", Z = 0) => /* @__PURE__ */ i.jsx("div", { className: "sticker-tree-level", style: { paddingLeft: `${Z * 15}px` }, children: Object.keys(P).map((y) => {
938
+ const I = `${p}/${y}`, M = j[I];
939
+ return P[y].type === "image" ? !z || y.toLowerCase().includes(z.toLowerCase()) ? /* @__PURE__ */ i.jsx(
940
940
  "div",
941
941
  {
942
942
  className: "sticker-item",
943
- onClick: () => P(U[y].url, y),
943
+ onClick: () => L(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: U[y].url,
947
+ src: P[y].url,
948
948
  alt: y,
949
949
  loading: "lazy",
950
950
  onError: (G) => {
@@ -961,17 +961,17 @@ const Mt = {
961
961
  className: "category-header",
962
962
  onClick: () => lt(I),
963
963
  children: [
964
- /* @__PURE__ */ i.jsx("span", { className: `expand-icon ${W ? "expanded" : ""}`, children: "▶" }),
964
+ /* @__PURE__ */ i.jsx("span", { className: `expand-icon ${M ? "expanded" : ""}`, children: "▶" }),
965
965
  /* @__PURE__ */ i.jsx("span", { className: "category-name", children: y })
966
966
  ]
967
967
  }
968
968
  ),
969
- W && nt(U[y], I, K + 1)
969
+ M && nt(P[y], I, Z + 1)
970
970
  ] }, I);
971
- }) }), _ = g.filter(
972
- (U) => !B || U.name.toLowerCase().includes(B.toLowerCase())
971
+ }) }), _ = x.filter(
972
+ (P) => !z || P.name.toLowerCase().includes(z.toLowerCase())
973
973
  );
974
- return f ? /* @__PURE__ */ i.jsx("div", { className: "sticker-modal-overlay", onClick: o, children: /* @__PURE__ */ i.jsxs("div", { className: "sticker-modal-content", onClick: (U) => U.stopPropagation(), children: [
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: [
976
976
  /* @__PURE__ */ i.jsx("h3", { children: "Stickers" }),
977
977
  /* @__PURE__ */ i.jsx(
@@ -985,29 +985,29 @@ const Mt = {
985
985
  )
986
986
  ] }),
987
987
  /* @__PURE__ */ i.jsxs("div", { className: "sticker-modal-body", children: [
988
- M && /* @__PURE__ */ i.jsx(se, {}),
989
- !C && !M && k && /* @__PURE__ */ i.jsx(ei, { theme: d }),
988
+ W && /* @__PURE__ */ i.jsx(ee, {}),
989
+ !C && !W && k && /* @__PURE__ */ i.jsx(Ve, { theme: n }),
990
990
  C && 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: (U) => S(U.target.value),
996
+ value: z,
997
+ onChange: (P) => S(P.target.value),
998
998
  className: "sticker-search"
999
999
  }
1000
1000
  ) }) }),
1001
- n && /* @__PURE__ */ i.jsx(se, {}),
1002
- N && /* @__PURE__ */ i.jsxs("div", { className: "sticker-error", children: [
1003
- /* @__PURE__ */ i.jsx("p", { children: N }),
1004
- /* @__PURE__ */ i.jsx("button", { onClick: rt, children: "Retry" })
1001
+ d && /* @__PURE__ */ i.jsx(ee, {}),
1002
+ T && /* @__PURE__ */ i.jsxs("div", { className: "sticker-error", children: [
1003
+ /* @__PURE__ */ i.jsx("p", { children: T }),
1004
+ /* @__PURE__ */ i.jsx("button", { onClick: ot, children: "Retry" })
1005
1005
  ] }),
1006
- !n && !N && g.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "sticker-grid", children: nt(X(_)) })
1006
+ !d && !T && x.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "sticker-grid", children: nt(J(_)) })
1007
1007
  ] })
1008
1008
  ] })
1009
1009
  ] }) }) : null;
1010
- }, oi = [
1010
+ }, Je = [
1011
1011
  // FLORAL DESIGNS (40 items)
1012
1012
  {
1013
1013
  id: 1,
@@ -2559,10 +2559,10 @@ const Mt = {
2559
2559
  category: "Geometric",
2560
2560
  description: "Complex mandala flower pattern"
2561
2561
  }
2562
- ], ri = ({ isOpen: f, onClose: o, onAddEmbroidery: a, theme: d, apiKey: s, apiEndpoint: h }) => {
2563
- const [g, l] = j([]), [n, F] = j(!1), [N, R] = j(null), [m, E] = j(""), [B, S] = j("All"), T = ft(null), J = ["All", "Floral", "Nature", "Geometric", "Traditional", "Sports", "Hobbies", "Food", "Symbols", "Holiday", "Text"];
2562
+ ], Ke = ({ isOpen: f, onClose: o, onAddEmbroidery: a, theme: n, apiKey: s, apiEndpoint: h }) => {
2563
+ const [x, l] = N([]), [d, F] = N(!1), [T, R] = N(null), [u, E] = N(""), [z, S] = N("All"), j = xt(null), K = ["All", "Floral", "Nature", "Geometric", "Traditional", "Sports", "Hobbies", "Food", "Symbols", "Holiday", "Text"];
2564
2564
  it(() => {
2565
- f && l(oi);
2565
+ f && l(Je);
2566
2566
  }, [f]);
2567
2567
  const C = (k) => {
2568
2568
  a({
@@ -2576,16 +2576,16 @@ const Mt = {
2576
2576
  x: 100,
2577
2577
  y: 100
2578
2578
  }), o();
2579
- }, $ = g.filter((k) => {
2580
- const st = !m || k.name.toLowerCase().includes(m.toLowerCase()) || k.description.toLowerCase().includes(m.toLowerCase()), M = B === "All" || k.category === B;
2581
- return st && M;
2579
+ }, Q = x.filter((k) => {
2580
+ const st = !u || k.name.toLowerCase().includes(u.toLowerCase()) || k.description.toLowerCase().includes(u.toLowerCase()), W = z === "All" || k.category === z;
2581
+ return st && 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
2587
  onClick: (k) => k.stopPropagation(),
2588
- ref: T,
2588
+ ref: j,
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,7 +2605,7 @@ const Mt = {
2605
2605
  {
2606
2606
  type: "text",
2607
2607
  placeholder: "Search embroidery designs...",
2608
- value: m,
2608
+ value: u,
2609
2609
  onChange: (k) => E(k.target.value),
2610
2610
  className: "embroidery-search"
2611
2611
  }
@@ -2615,21 +2615,21 @@ const Mt = {
2615
2615
  /* @__PURE__ */ i.jsx(
2616
2616
  "select",
2617
2617
  {
2618
- value: B,
2618
+ value: z,
2619
2619
  onChange: (k) => S(k.target.value),
2620
2620
  className: "category-select",
2621
- children: J.map((k) => /* @__PURE__ */ i.jsx("option", { value: k, children: k }, k))
2621
+ children: K.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
- n && /* @__PURE__ */ i.jsxs("div", { className: "embroidery-loading", children: [
2627
+ d && /* @__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
- N && /* @__PURE__ */ i.jsx("div", { className: "embroidery-error", children: /* @__PURE__ */ i.jsx("p", { children: N }) }),
2632
- !n && !N && /* @__PURE__ */ i.jsx("div", { className: "embroidery-grid", children: $.map((k) => /* @__PURE__ */ i.jsxs(
2631
+ T && /* @__PURE__ */ i.jsx("div", { className: "embroidery-error", children: /* @__PURE__ */ i.jsx("p", { children: T }) }),
2632
+ !d && !T && /* @__PURE__ */ i.jsx("div", { className: "embroidery-grid", children: Q.map((k) => /* @__PURE__ */ i.jsxs(
2633
2633
  "div",
2634
2634
  {
2635
2635
  className: "embroidery-item",
@@ -2655,7 +2655,7 @@ const Mt = {
2655
2655
  },
2656
2656
  k.id
2657
2657
  )) }),
2658
- !n && !N && $.length === 0 && /* @__PURE__ */ i.jsx("div", { className: "no-embroideries", children: /* @__PURE__ */ i.jsx("p", { children: "No embroidery designs found matching your search." }) })
2658
+ !d && !T && Q.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 Mt = {
2664
2664
  ]
2665
2665
  }
2666
2666
  ) }) : null;
2667
- }, Tt = [
2667
+ }, Ct = [
2668
2668
  // MOTIVATIONAL & INSPIRATIONAL (25 items)
2669
2669
  {
2670
2670
  id: 1,
@@ -4601,19 +4601,19 @@ const Mt = {
4601
4601
  fill: "#8B0000",
4602
4602
  textAlign: "center"
4603
4603
  }
4604
- ], ai = ({ isOpen: f, onClose: o, onAddText: a, theme: d }) => {
4605
- const [s, h] = j(""), [g, l] = j("All"), n = ee(() => {
4606
- const m = Tt.reduce((E, B) => (E[B.category] = (E[B.category] || 0) + 1, E), {});
4604
+ ], Ze = ({ isOpen: f, onClose: o, onAddText: a, theme: n }) => {
4605
+ const [s, h] = N(""), [x, l] = N("All"), d = Xt(() => {
4606
+ const u = Ct.reduce((E, z) => (E[z.category] = (E[z.category] || 0) + 1, E), {});
4607
4607
  return [
4608
- { name: "All", count: Tt.length },
4609
- ...Object.entries(m).map(([E, B]) => ({ name: E, count: B }))
4608
+ { name: "All", count: Ct.length },
4609
+ ...Object.entries(u).map(([E, z]) => ({ name: E, count: z }))
4610
4610
  ];
4611
- }, [Tt]), F = ee(() => Tt.filter((m) => {
4612
- const E = !s || m.text.toLowerCase().includes(s.toLowerCase()) || m.category.toLowerCase().includes(s.toLowerCase()), B = g === "All" || m.category === g;
4613
- return E && B;
4614
- }), [Tt, s, g]), N = (m) => {
4611
+ }, [Ct]), F = Xt(() => Ct.filter((u) => {
4612
+ const E = !s || u.text.toLowerCase().includes(s.toLowerCase()) || u.category.toLowerCase().includes(s.toLowerCase()), z = x === "All" || u.category === x;
4613
+ return E && z;
4614
+ }), [Ct, s, x]), T = (u) => {
4615
4615
  const E = {
4616
- ...m,
4616
+ ...u,
4617
4617
  x: 100,
4618
4618
  y: 100
4619
4619
  };
@@ -4628,7 +4628,7 @@ const Mt = {
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: (m) => m.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: (u) => u.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,25 +4640,25 @@ const Mt = {
4640
4640
  type: "text",
4641
4641
  placeholder: "Search templates...",
4642
4642
  value: s,
4643
- onChange: (m) => h(m.target.value),
4643
+ onChange: (u) => h(u.target.value),
4644
4644
  className: "search-input"
4645
4645
  }
4646
4646
  ) }),
4647
- /* @__PURE__ */ i.jsx("div", { className: "category-tabs", children: n.map((m) => /* @__PURE__ */ i.jsxs(
4647
+ /* @__PURE__ */ i.jsx("div", { className: "category-tabs", children: d.map((u) => /* @__PURE__ */ i.jsxs(
4648
4648
  "button",
4649
4649
  {
4650
- className: `category-tab ${g === m.name ? "active" : ""}`,
4651
- onClick: () => l(m.name),
4650
+ className: `category-tab ${x === u.name ? "active" : ""}`,
4651
+ onClick: () => l(u.name),
4652
4652
  children: [
4653
- m.name,
4653
+ u.name,
4654
4654
  /* @__PURE__ */ i.jsxs("span", { className: "count", children: [
4655
4655
  "(",
4656
- m.count,
4656
+ u.count,
4657
4657
  ")"
4658
4658
  ] })
4659
4659
  ]
4660
4660
  },
4661
- m.name
4661
+ u.name
4662
4662
  )) })
4663
4663
  ] }),
4664
4664
  /* @__PURE__ */ i.jsxs("div", { className: "templates-grid", children: [
@@ -4666,38 +4666,38 @@ const Mt = {
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
- F.map((m) => /* @__PURE__ */ i.jsxs(
4669
+ F.map((u) => /* @__PURE__ */ i.jsxs(
4670
4670
  "div",
4671
4671
  {
4672
4672
  className: "template-item",
4673
- onClick: () => N(m),
4673
+ onClick: () => T(u),
4674
4674
  children: [
4675
4675
  /* @__PURE__ */ i.jsx(
4676
4676
  "div",
4677
4677
  {
4678
4678
  className: "template-preview",
4679
4679
  style: {
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"
4680
+ fontFamily: u.fontFamily,
4681
+ fontSize: `${Math.min(u.fontSize * 0.6, 18)}px`,
4682
+ fontWeight: u.fontWeight,
4683
+ fontStyle: u.fontStyle,
4684
+ color: u.fill,
4685
+ backgroundColor: u.hasBackground ? u.backgroundColor : "transparent",
4686
+ textAlign: u.textAlign || "left",
4687
+ textTransform: u.textTransform || "none",
4688
+ letterSpacing: u.letterSpacing ? `${u.letterSpacing}px` : "normal",
4689
+ textShadow: u.hasTextShadow ? `${u.textShadowX}px ${u.textShadowY}px ${u.textShadowBlur}px ${u.textShadowColor}` : "none"
4690
4690
  },
4691
- children: m.text
4691
+ children: u.text
4692
4692
  }
4693
4693
  ),
4694
4694
  /* @__PURE__ */ i.jsxs("div", { className: "template-info", children: [
4695
- /* @__PURE__ */ i.jsx("span", { className: "template-category", children: m.category }),
4696
- /* @__PURE__ */ i.jsx("span", { className: "template-font", children: m.fontFamily })
4695
+ /* @__PURE__ */ i.jsx("span", { className: "template-category", children: u.category }),
4696
+ /* @__PURE__ */ i.jsx("span", { className: "template-font", children: u.fontFamily })
4697
4697
  ] })
4698
4698
  ]
4699
4699
  },
4700
- m.id
4700
+ u.id
4701
4701
  ))
4702
4702
  ] }),
4703
4703
  /* @__PURE__ */ i.jsx("div", { className: "modal-footer", children: /* @__PURE__ */ i.jsxs("div", { className: "results-count", children: [
@@ -4707,56 +4707,56 @@ const Mt = {
4707
4707
  " found"
4708
4708
  ] }) })
4709
4709
  ] }) }) : null;
4710
- }, si = ({
4710
+ }, ti = ({
4711
4711
  onAddElement: f,
4712
4712
  onDeleteElement: o,
4713
4713
  onDuplicateElement: a,
4714
- onUndo: d,
4714
+ onUndo: n,
4715
4715
  onRedo: s,
4716
4716
  onToggleGrid: h,
4717
- onToggleRulers: g,
4717
+ onToggleRulers: x,
4718
4718
  onToggleSnap: l,
4719
- onImageUpload: n,
4719
+ onImageUpload: d,
4720
4720
  canUndo: F,
4721
- canRedo: N,
4721
+ canRedo: T,
4722
4722
  showGrid: R,
4723
- showRulers: m,
4723
+ showRulers: u,
4724
4724
  snapToGrid: E,
4725
- selectedElement: B,
4725
+ selectedElement: z,
4726
4726
  theme: S,
4727
- readOnly: T,
4728
- apiKey: J,
4727
+ readOnly: j,
4728
+ apiKey: K,
4729
4729
  apiEndpoint: C
4730
4730
  }) => {
4731
- const [$, k] = j(!1), [st, M] = j(!1), [ht, O] = j(!1), [ct, Q] = j(!1), [rt, P] = j(!1), [lt, X] = j(!1), [nt, _] = j(!1), U = (L) => {
4732
- const ot = L.target.files[0];
4733
- ot && ot.type.startsWith("image/") && n(ot), L.target.value = "";
4734
- }, u = (L) => {
4731
+ const [Q, k] = N(!1), [st, W] = N(!1), [ht, O] = N(!1), [ct, $] = N(!1), [ot, L] = N(!1), [lt, J] = N(!1), [nt, _] = N(!1), P = (U) => {
4732
+ const X = U.target.files[0];
4733
+ X && X.type.startsWith("image/") && d(X), U.target.value = "";
4734
+ }, p = (U) => {
4735
4735
  f("icon", {
4736
- iconData: L,
4737
- text: L.symbol,
4736
+ iconData: U,
4737
+ text: U.symbol,
4738
4738
  fontSize: 48,
4739
4739
  fontFamily: "Arial",
4740
4740
  fill: "#000000"
4741
4741
  });
4742
- }, K = (L) => {
4743
- f("qrcode", L);
4744
- }, y = (L) => {
4745
- f("barcode", L);
4746
- }, I = (L) => {
4747
- f("sticker", L);
4748
- }, W = (L) => {
4749
- f("embroidery", L);
4750
- }, H = (L, ot) => {
4751
- f(L, ot);
4742
+ }, Z = (U) => {
4743
+ f("qrcode", U);
4744
+ }, y = (U) => {
4745
+ f("barcode", U);
4746
+ }, I = (U) => {
4747
+ f("sticker", U);
4748
+ }, M = (U) => {
4749
+ f("embroidery", U);
4750
+ }, H = (U, X) => {
4751
+ f(U, X);
4752
4752
  }, G = () => {
4753
- X(!lt), _(!1);
4754
- }, Z = () => {
4755
- _(!nt), X(!1);
4756
- }, q = (L) => {
4757
- L === "custom" ? f("text") : L === "templates" && P(!0), X(!1);
4758
- }, Y = (L) => {
4759
- f(L), _(!1);
4753
+ J(!lt), _(!1);
4754
+ }, tt = () => {
4755
+ _(!nt), J(!1);
4756
+ }, q = (U) => {
4757
+ U === "custom" ? f("text") : U === "templates" && L(!0), J(!1);
4758
+ }, Y = (U) => {
4759
+ f(U), _(!1);
4760
4760
  };
4761
4761
  return /* @__PURE__ */ i.jsxs("div", { className: "toolbar", children: [
4762
4762
  /* @__PURE__ */ i.jsxs("div", { className: "toolbar-section", children: [
@@ -4765,8 +4765,8 @@ const Mt = {
4765
4765
  "button",
4766
4766
  {
4767
4767
  className: "toolbar-btn compact",
4768
- onClick: d,
4769
- disabled: !F || T,
4768
+ onClick: n,
4769
+ disabled: !F || j,
4770
4770
  title: "Undo (Ctrl+Z)",
4771
4771
  children: [
4772
4772
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "↶" }),
@@ -4779,7 +4779,7 @@ const Mt = {
4779
4779
  {
4780
4780
  className: "toolbar-btn compact",
4781
4781
  onClick: s,
4782
- disabled: !N || T,
4782
+ disabled: !T || j,
4783
4783
  title: "Redo (Ctrl+Y)",
4784
4784
  children: [
4785
4785
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "↷" }),
@@ -4795,7 +4795,7 @@ const Mt = {
4795
4795
  "button",
4796
4796
  {
4797
4797
  className: "toolbar-btn compact dropdown-trigger",
4798
- disabled: T,
4798
+ disabled: j,
4799
4799
  title: "Add Text",
4800
4800
  onClick: G,
4801
4801
  children: [
@@ -4821,8 +4821,8 @@ const Mt = {
4821
4821
  "button",
4822
4822
  {
4823
4823
  className: "toolbar-btn compact dropdown-trigger",
4824
- disabled: T,
4825
- onClick: Z,
4824
+ disabled: j,
4825
+ onClick: tt,
4826
4826
  children: [
4827
4827
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "◩" }),
4828
4828
  /* @__PURE__ */ i.jsx("span", { className: "label", children: "Shapes" }),
@@ -4882,7 +4882,7 @@ const Mt = {
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: T ? "not-allowed" : "pointer" }, children: [
4885
+ /* @__PURE__ */ i.jsxs("label", { className: "toolbar-btn compact file-upload", style: { cursor: j ? "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(
@@ -4890,19 +4890,19 @@ const Mt = {
4890
4890
  {
4891
4891
  type: "file",
4892
4892
  accept: "image/*",
4893
- onChange: U,
4894
- disabled: T
4893
+ onChange: P,
4894
+ disabled: j
4895
4895
  }
4896
4896
  )
4897
4897
  ] }),
4898
4898
  /* @__PURE__ */ i.jsx("div", { className: "toolbar-separator" }),
4899
- /* @__PURE__ */ i.jsx(Ke, { onSelectIcon: u, theme: S, disabled: T }),
4899
+ /* @__PURE__ */ i.jsx(_e, { onSelectIcon: p, theme: S, disabled: j }),
4900
4900
  /* @__PURE__ */ i.jsxs(
4901
4901
  "button",
4902
4902
  {
4903
4903
  className: "toolbar-btn compact",
4904
4904
  onClick: () => O(!0),
4905
- disabled: T,
4905
+ disabled: j,
4906
4906
  title: "Add Sticker",
4907
4907
  children: [
4908
4908
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "🎨" }),
@@ -4916,7 +4916,7 @@ const Mt = {
4916
4916
  {
4917
4917
  className: "toolbar-btn compact",
4918
4918
  onClick: () => k(!0),
4919
- disabled: T,
4919
+ disabled: j,
4920
4920
  title: "Add QR Code",
4921
4921
  children: [
4922
4922
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "▦" }),
@@ -4928,8 +4928,8 @@ const Mt = {
4928
4928
  "button",
4929
4929
  {
4930
4930
  className: "toolbar-btn compact",
4931
- onClick: () => M(!0),
4932
- disabled: T,
4931
+ onClick: () => W(!0),
4932
+ disabled: j,
4933
4933
  title: "Add Barcode",
4934
4934
  children: [
4935
4935
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "▤" }),
@@ -4943,8 +4943,8 @@ const Mt = {
4943
4943
  "button",
4944
4944
  {
4945
4945
  className: "toolbar-btn compact",
4946
- onClick: () => Q(!0),
4947
- disabled: T,
4946
+ onClick: () => $(!0),
4947
+ disabled: j,
4948
4948
  title: "Add Embroidery Design",
4949
4949
  children: [
4950
4950
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "🧵" }),
@@ -4952,7 +4952,7 @@ const Mt = {
4952
4952
  ]
4953
4953
  }
4954
4954
  ) }),
4955
- B && /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
4955
+ z && /* @__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 Mt = {
4960
4960
  {
4961
4961
  className: "toolbar-btn compact success",
4962
4962
  onClick: a,
4963
- disabled: T,
4963
+ disabled: j,
4964
4964
  title: "Duplicate Element (Ctrl+D)",
4965
4965
  children: [
4966
4966
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "⧉" }),
@@ -4973,7 +4973,7 @@ const Mt = {
4973
4973
  {
4974
4974
  className: "toolbar-btn compact danger",
4975
4975
  onClick: o,
4976
- disabled: T,
4976
+ disabled: j,
4977
4977
  title: "Delete Element (Delete)",
4978
4978
  children: [
4979
4979
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "🗑️" }),
@@ -5000,8 +5000,8 @@ const Mt = {
5000
5000
  /* @__PURE__ */ i.jsxs(
5001
5001
  "button",
5002
5002
  {
5003
- className: `toolbar-btn compact ${m ? "active" : ""}`,
5004
- onClick: g,
5003
+ className: `toolbar-btn compact ${u ? "active" : ""}`,
5004
+ onClick: x,
5005
5005
  title: "Toggle Rulers",
5006
5006
  children: [
5007
5007
  /* @__PURE__ */ i.jsx("span", { className: "icon", children: "📐" }),
@@ -5024,72 +5024,72 @@ const Mt = {
5024
5024
  ] })
5025
5025
  ] }),
5026
5026
  /* @__PURE__ */ i.jsx(
5027
- Ze,
5027
+ Ye,
5028
5028
  {
5029
- isOpen: $,
5029
+ isOpen: Q,
5030
5030
  onClose: () => k(!1),
5031
- onAddQRCode: K,
5031
+ onAddQRCode: Z,
5032
5032
  theme: S
5033
5033
  }
5034
5034
  ),
5035
5035
  /* @__PURE__ */ i.jsx(
5036
- ti,
5036
+ qe,
5037
5037
  {
5038
5038
  isOpen: st,
5039
- onClose: () => M(!1),
5039
+ onClose: () => W(!1),
5040
5040
  onAddBarcode: y,
5041
5041
  theme: S
5042
5042
  }
5043
5043
  ),
5044
5044
  /* @__PURE__ */ i.jsx(
5045
- ii,
5045
+ Xe,
5046
5046
  {
5047
5047
  isOpen: ht,
5048
5048
  onClose: () => O(!1),
5049
5049
  onAddSticker: I,
5050
5050
  theme: S,
5051
- apiKey: J,
5051
+ apiKey: K,
5052
5052
  apiEndpoint: C
5053
5053
  }
5054
5054
  ),
5055
5055
  /* @__PURE__ */ i.jsx(
5056
- ri,
5056
+ Ke,
5057
5057
  {
5058
5058
  isOpen: ct,
5059
- onClose: () => Q(!1),
5060
- onAddEmbroidery: W,
5059
+ onClose: () => $(!1),
5060
+ onAddEmbroidery: M,
5061
5061
  theme: S,
5062
- apiKey: J,
5062
+ apiKey: K,
5063
5063
  apiEndpoint: C
5064
5064
  }
5065
5065
  ),
5066
5066
  /* @__PURE__ */ i.jsx(
5067
- ai,
5067
+ Ze,
5068
5068
  {
5069
- isOpen: rt,
5070
- onClose: () => P(!1),
5069
+ isOpen: ot,
5070
+ onClose: () => L(!1),
5071
5071
  onAddText: H,
5072
5072
  theme: S
5073
5073
  }
5074
5074
  )
5075
5075
  ] });
5076
- }, li = ({
5076
+ }, ei = ({
5077
5077
  selectedElement: f,
5078
5078
  onUpdate: o,
5079
5079
  onMoveLayer: a,
5080
- availableFonts: d,
5080
+ availableFonts: n,
5081
5081
  theme: s
5082
5082
  }) => {
5083
- const [h, g] = j(!1);
5083
+ const [h, x] = 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 l = (S, T) => {
5090
- o(f.id, { [S]: T });
5091
- }, n = () => {
5092
- var S, T, J;
5089
+ const l = (S, j) => {
5090
+ o(f.id, { [S]: j });
5091
+ }, d = () => {
5092
+ var S, j, K;
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: [
@@ -5111,7 +5111,7 @@ const Mt = {
5111
5111
  {
5112
5112
  value: f.fontFamily || "Arial",
5113
5113
  onChange: (C) => l("fontFamily", C.target.value),
5114
- children: d.map((C) => /* @__PURE__ */ i.jsx("option", { value: C, children: C }, C))
5114
+ children: n.map((C) => /* @__PURE__ */ i.jsx("option", { value: C, children: C }, C))
5115
5115
  }
5116
5116
  )
5117
5117
  ] }),
@@ -5193,8 +5193,8 @@ const Mt = {
5193
5193
  {
5194
5194
  className: (S = f.textDecoration) != null && S.includes("underline") ? "active" : "",
5195
5195
  onClick: () => {
5196
- const C = f.textDecoration || "", $ = C.split(" ").filter((k) => k && k !== "underline");
5197
- C.includes("underline") || $.push("underline"), l("textDecoration", $.join(" ").trim());
5196
+ const C = f.textDecoration || "", Q = C.split(" ").filter((k) => k && k !== "underline");
5197
+ C.includes("underline") || Q.push("underline"), l("textDecoration", Q.join(" ").trim());
5198
5198
  },
5199
5199
  title: "Underline",
5200
5200
  children: /* @__PURE__ */ i.jsx("u", { children: "U" })
@@ -5203,10 +5203,10 @@ const Mt = {
5203
5203
  /* @__PURE__ */ i.jsx(
5204
5204
  "button",
5205
5205
  {
5206
- className: (T = f.textDecoration) != null && T.includes("overline") ? "active" : "",
5206
+ className: (j = f.textDecoration) != null && j.includes("overline") ? "active" : "",
5207
5207
  onClick: () => {
5208
- const C = f.textDecoration || "", $ = C.split(" ").filter((k) => k && k !== "overline");
5209
- C.includes("overline") || $.push("overline"), l("textDecoration", $.join(" ").trim());
5208
+ const C = f.textDecoration || "", Q = C.split(" ").filter((k) => k && k !== "overline");
5209
+ C.includes("overline") || Q.push("overline"), l("textDecoration", Q.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 Mt = {
5215
5215
  /* @__PURE__ */ i.jsx(
5216
5216
  "button",
5217
5217
  {
5218
- className: (J = f.textDecoration) != null && J.includes("line-through") ? "active" : "",
5218
+ className: (K = f.textDecoration) != null && K.includes("line-through") ? "active" : "",
5219
5219
  onClick: () => {
5220
- const C = f.textDecoration || "", $ = C.split(" ").filter((k) => k && k !== "line-through");
5221
- C.includes("line-through") || $.push("line-through"), l("textDecoration", $.join(" ").trim());
5220
+ const C = f.textDecoration || "", Q = C.split(" ").filter((k) => k && k !== "line-through");
5221
+ C.includes("line-through") || Q.push("line-through"), l("textDecoration", Q.join(" ").trim());
5222
5222
  },
5223
5223
  title: "Strikethrough",
5224
5224
  children: /* @__PURE__ */ i.jsx("s", { children: "S" })
@@ -5615,7 +5615,7 @@ const Mt = {
5615
5615
  }
5616
5616
  )
5617
5617
  ] })
5618
- ] }), N = () => /* @__PURE__ */ i.jsxs("div", { className: "property-group", children: [
5618
+ ] }), T = () => /* @__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" }),
@@ -5717,7 +5717,7 @@ const Mt = {
5717
5717
  "°"
5718
5718
  ] })
5719
5719
  ] })
5720
- ] }), m = () => /* @__PURE__ */ i.jsxs("div", { className: "property-group", children: [
5720
+ ] }), u = () => /* @__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: [
@@ -5728,8 +5728,8 @@ const Mt = {
5728
5728
  type: "number",
5729
5729
  value: f.strokeWidth || f.height || 2,
5730
5730
  onChange: (S) => {
5731
- const T = parseInt(S.target.value);
5732
- l("strokeWidth", T), l("height", T);
5731
+ const j = parseInt(S.target.value);
5732
+ l("strokeWidth", j), l("height", j);
5733
5733
  },
5734
5734
  min: "1",
5735
5735
  max: "50"
@@ -5784,7 +5784,7 @@ const Mt = {
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
+ ] }), z = [
5788
5788
  "rectangle",
5789
5789
  "circle",
5790
5790
  "triangle",
@@ -5803,17 +5803,17 @@ const Mt = {
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" && n(),
5807
- B.includes(f.type) && F(),
5808
- f.type === "image" && N(),
5809
- f.type === "horizontalLine" && m(),
5806
+ f.type === "text" && d(),
5807
+ z.includes(f.type) && F(),
5808
+ f.type === "image" && T(),
5809
+ f.type === "horizontalLine" && u(),
5810
5810
  R(),
5811
5811
  E(),
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: () => g(!h),
5816
+ onClick: () => x(!h),
5817
5817
  children: [
5818
5818
  h ? "Hide" : "Show",
5819
5819
  " Advanced Options"
@@ -5822,16 +5822,16 @@ const Mt = {
5822
5822
  ) })
5823
5823
  ] })
5824
5824
  ] });
5825
- }, ni = ({
5825
+ }, ii = ({
5826
5826
  elements: f,
5827
5827
  selectedElement: o,
5828
5828
  onSelectElement: a,
5829
- onMoveLayer: d,
5829
+ onMoveLayer: n,
5830
5830
  onDeleteElement: s,
5831
5831
  theme: h
5832
5832
  }) => {
5833
- const g = (n, F) => {
5834
- switch (n) {
5833
+ const x = (d, F) => {
5834
+ switch (d) {
5835
5835
  case "text":
5836
5836
  return "T";
5837
5837
  case "rectangle":
@@ -5871,40 +5871,40 @@ const Mt = {
5871
5871
  default:
5872
5872
  return "?";
5873
5873
  }
5874
- }, l = (n) => {
5875
- var F, N;
5876
- if (n.type === "text")
5877
- return n.isIcon && n.iconData ? `Icon: ${n.iconData.name}` : ((F = n.text) == null ? void 0 : F.substring(0, 20)) + (((N = n.text) == null ? void 0 : N.length) > 20 ? "..." : "") || "Text";
5878
- if (n.type === "qrcode")
5879
- return `QR Code: ${(n.data || "").substring(0, 15) + ((n.data || "").length > 15 ? "..." : "")}`;
5880
- if (n.type === "barcode") {
5881
- const R = n.format || "CODE128", m = n.data || "";
5882
- return `Barcode (${R}): ${m.substring(0, 10) + (m.length > 10 ? "..." : "")}`;
5874
+ }, l = (d) => {
5875
+ var F, T;
5876
+ if (d.type === "text")
5877
+ return d.isIcon && d.iconData ? `Icon: ${d.iconData.name}` : ((F = d.text) == null ? void 0 : F.substring(0, 20)) + (((T = d.text) == null ? void 0 : T.length) > 20 ? "..." : "") || "Text";
5878
+ if (d.type === "qrcode")
5879
+ return `QR Code: ${(d.data || "").substring(0, 15) + ((d.data || "").length > 15 ? "..." : "")}`;
5880
+ if (d.type === "barcode") {
5881
+ const R = d.format || "CODE128", u = d.data || "";
5882
+ return `Barcode (${R}): ${u.substring(0, 10) + (u.length > 10 ? "..." : "")}`;
5883
5883
  }
5884
- return n.type === "sticker" ? `Sticker: ${(n.name || "Untitled").substring(0, 15)}` : n.type === "embroidery" ? `Embroidery: ${(n.name || "Design").substring(0, 15)}` : n.type.charAt(0).toUpperCase() + n.type.slice(1);
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);
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((n, F) => /* @__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((d, F) => /* @__PURE__ */ i.jsxs(
5892
5892
  "div",
5893
5893
  {
5894
- className: `layer-item ${(o == null ? void 0 : o.id) === n.id ? "selected" : ""}`,
5895
- onClick: () => a(n),
5894
+ className: `layer-item ${(o == null ? void 0 : o.id) === d.id ? "selected" : ""}`,
5895
+ onClick: () => a(d),
5896
5896
  children: [
5897
5897
  /* @__PURE__ */ i.jsxs("div", { className: "layer-info", children: [
5898
- /* @__PURE__ */ i.jsx("span", { className: "layer-icon", children: g(n.type) }),
5899
- /* @__PURE__ */ i.jsx("span", { className: "layer-name", children: l(n) })
5898
+ /* @__PURE__ */ i.jsx("span", { className: "layer-icon", children: x(d.type) }),
5899
+ /* @__PURE__ */ i.jsx("span", { className: "layer-name", children: l(d) })
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: (N) => {
5907
- N.stopPropagation(), d(n.id, "up");
5906
+ onClick: (T) => {
5907
+ T.stopPropagation(), n(d.id, "up");
5908
5908
  },
5909
5909
  disabled: F === 0,
5910
5910
  title: "Move Up",
@@ -5915,8 +5915,8 @@ const Mt = {
5915
5915
  "button",
5916
5916
  {
5917
5917
  className: "layer-btn",
5918
- onClick: (N) => {
5919
- N.stopPropagation(), d(n.id, "down");
5918
+ onClick: (T) => {
5919
+ T.stopPropagation(), n(d.id, "down");
5920
5920
  },
5921
5921
  disabled: F === f.length - 1,
5922
5922
  title: "Move Down",
@@ -5927,8 +5927,8 @@ const Mt = {
5927
5927
  "button",
5928
5928
  {
5929
5929
  className: "layer-btn delete",
5930
- onClick: (N) => {
5931
- N.stopPropagation(), s(n.id);
5930
+ onClick: (T) => {
5931
+ T.stopPropagation(), s(d.id);
5932
5932
  },
5933
5933
  title: "Delete",
5934
5934
  children: "×"
@@ -5937,36 +5937,36 @@ const Mt = {
5937
5937
  ] })
5938
5938
  ]
5939
5939
  },
5940
- n.id
5940
+ d.id
5941
5941
  )) })
5942
5942
  ] });
5943
5943
  };
5944
- class ci {
5944
+ class oi {
5945
5945
  constructor() {
5946
5946
  this.canvas = document.createElement("canvas"), this.ctx = this.canvas.getContext("2d");
5947
5947
  }
5948
5948
  // Add this method to the ExportManager class
5949
- async exportAllSections(o, a, d, s, h = "png", g = !0) {
5949
+ async exportAllSections(o, a, n, s, h = "png", x = !0) {
5950
5950
  const l = {};
5951
- for (const n of a) {
5952
- const F = n.id || n.sectionName, N = o[F];
5953
- if (!N || !N.elements || N.elements.length === 0) {
5951
+ for (const d of a) {
5952
+ const F = d.id || d.sectionName, T = o[F];
5953
+ if (!T || !T.elements || T.elements.length === 0) {
5954
5954
  console.log(`Skipping section ${F} - no elements`);
5955
5955
  continue;
5956
5956
  }
5957
- if (this.canvas.width = d, this.canvas.height = s, this.ctx.clearRect(0, 0, d, s), g) {
5958
- const m = n.image || n.sectionImage;
5959
- if (m)
5957
+ if (this.canvas.width = n, this.canvas.height = s, this.ctx.clearRect(0, 0, n, s), x) {
5958
+ const u = d.image || d.sectionImage;
5959
+ if (u)
5960
5960
  try {
5961
- const E = await this.loadImage(m);
5962
- await this.processImageColor(E, N.selectedColor || "#FFFFFF"), this.ctx.drawImage(this.processedImage, 0, 0, d, s);
5961
+ const E = await this.loadImage(u);
5962
+ await this.processImageColor(E, T.selectedColor || "#FFFFFF"), this.ctx.drawImage(this.processedImage, 0, 0, n, s);
5963
5963
  } catch (E) {
5964
5964
  console.warn("Failed to load background image:", E);
5965
5965
  }
5966
5966
  } else
5967
- this.ctx.clearRect(0, 0, d, s);
5968
- for (const m of N.elements)
5969
- await this.drawElement(m);
5967
+ this.ctx.clearRect(0, 0, n, s);
5968
+ for (const u of T.elements)
5969
+ await this.drawElement(u);
5970
5970
  const R = this.canvas.toDataURL(`image/${h}`, h === "jpeg" ? 0.9 : void 0);
5971
5971
  l[F] = {
5972
5972
  dataUrl: R,
@@ -5977,57 +5977,57 @@ class ci {
5977
5977
  }
5978
5978
  // Also add a method to download all exports
5979
5979
  async downloadExports(o, a = "design") {
5980
- const d = Object.keys(o);
5981
- if (d.length === 0) {
5980
+ const n = Object.keys(o);
5981
+ if (n.length === 0) {
5982
5982
  alert("No designs to export");
5983
5983
  return;
5984
5984
  }
5985
- if (d.length === 1) {
5986
- const s = d[0], { blob: h } = o[s], g = URL.createObjectURL(h), l = document.createElement("a");
5987
- l.href = g, l.download = `${a}-${s}.png`, document.body.appendChild(l), l.click(), document.body.removeChild(l), URL.revokeObjectURL(g);
5985
+ if (n.length === 1) {
5986
+ const s = n[0], { blob: h } = o[s], x = URL.createObjectURL(h), l = document.createElement("a");
5987
+ l.href = x, l.download = `${a}-${s}.png`, document.body.appendChild(l), l.click(), document.body.removeChild(l), URL.revokeObjectURL(x);
5988
5988
  } else
5989
- for (const s of d) {
5990
- const { blob: h } = o[s], g = URL.createObjectURL(h), l = document.createElement("a");
5991
- l.href = g, l.download = `${a}-${s}.png`, document.body.appendChild(l), l.click(), document.body.removeChild(l), URL.revokeObjectURL(g), await new Promise((n) => setTimeout(n, 100));
5989
+ for (const s of n) {
5990
+ const { blob: h } = o[s], x = URL.createObjectURL(h), l = document.createElement("a");
5991
+ l.href = x, l.download = `${a}-${s}.png`, document.body.appendChild(l), l.click(), document.body.removeChild(l), URL.revokeObjectURL(x), await new Promise((d) => setTimeout(d, 100));
5992
5992
  }
5993
5993
  }
5994
5994
  async loadImage(o) {
5995
- return new Promise((a, d) => {
5995
+ return new Promise((a, n) => {
5996
5996
  const s = new Image();
5997
- s.crossOrigin = "anonymous", s.onload = () => a(s), s.onerror = d, s.src = o;
5997
+ s.crossOrigin = "anonymous", s.onload = () => a(s), s.onerror = n, s.src = o;
5998
5998
  });
5999
5999
  }
6000
6000
  // Update the processImageColor method in ExportManager class
6001
6001
  // Add the getLuma utility function at the top of the class
6002
- getLuma(o, a, d) {
6003
- return (0.2126 * o + 0.7152 * a + 0.0722 * d) / 255;
6002
+ getLuma(o, a, n) {
6003
+ return (0.2126 * o + 0.7152 * a + 0.0722 * n) / 255;
6004
6004
  }
6005
6005
  async processImageColor(o, a) {
6006
- const d = document.createElement("canvas"), s = d.getContext("2d");
6007
- d.width = o.width, d.height = o.height, s.clearRect(0, 0, d.width, d.height), s.drawImage(o, 0, 0);
6008
- const h = s.getImageData(0, 0, d.width, d.height), g = h.data, l = this.hexToRgb(a);
6006
+ const n = document.createElement("canvas"), s = n.getContext("2d");
6007
+ n.width = o.width, n.height = o.height, s.clearRect(0, 0, n.width, n.height), s.drawImage(o, 0, 0);
6008
+ const h = s.getImageData(0, 0, n.width, n.height), x = h.data, l = this.hexToRgb(a);
6009
6009
  if (!l) {
6010
6010
  console.warn("Invalid target color:", a);
6011
6011
  return;
6012
6012
  }
6013
- const { r: n, g: F, b: N } = l;
6014
- for (let R = 0; R < g.length; R += 4) {
6015
- if (g[R + 3] === 0) continue;
6016
- const E = this.getLuma(g[R], g[R + 1], g[R + 2]);
6017
- g[R] = Math.round(n * E), g[R + 1] = Math.round(F * E), g[R + 2] = Math.round(N * E);
6013
+ const { r: d, g: F, b: T } = l;
6014
+ for (let R = 0; R < x.length; R += 4) {
6015
+ if (x[R + 3] === 0) continue;
6016
+ const E = this.getLuma(x[R], x[R + 1], x[R + 2]);
6017
+ x[R] = Math.round(d * E), x[R + 1] = Math.round(F * E), x[R + 2] = Math.round(T * E);
6018
6018
  }
6019
6019
  return s.putImageData(h, 0, 0), this.processedImage = new Image(), new Promise((R) => {
6020
6020
  this.processedImage.onload = () => {
6021
6021
  R();
6022
6022
  }, this.processedImage.onerror = () => {
6023
6023
  console.error("Failed to create processed image"), R();
6024
- }, this.processedImage.src = d.toDataURL("image/png");
6024
+ }, this.processedImage.src = n.toDataURL("image/png");
6025
6025
  });
6026
6026
  }
6027
6027
  async drawElement(o) {
6028
6028
  this.ctx.save();
6029
- const a = o.x + o.width / 2, d = o.y + o.height / 2;
6030
- switch (this.ctx.translate(a, d), o.rotation && this.ctx.rotate(o.rotation * Math.PI / 180), this.ctx.translate(-o.width / 2, -o.height / 2), o.type) {
6029
+ const a = o.x + o.width / 2, n = o.y + o.height / 2;
6030
+ switch (this.ctx.translate(a, n), o.rotation && this.ctx.rotate(o.rotation * Math.PI / 180), this.ctx.translate(-o.width / 2, -o.height / 2), o.type) {
6031
6031
  case "text":
6032
6032
  this.drawText(o);
6033
6033
  break;
@@ -6088,41 +6088,41 @@ class ci {
6088
6088
  drawText(o) {
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
- `), d = (o.fontSize || 20) * 1.2;
6091
+ `), n = (o.fontSize || 20) * 1.2;
6092
6092
  a.forEach((s, h) => {
6093
- const g = h * d;
6094
- o.stroke && o.strokeWidth > 0 && this.ctx.strokeText(s, 0, g), this.ctx.fillText(s, 0, g);
6093
+ const x = h * n;
6094
+ o.stroke && o.strokeWidth > 0 && this.ctx.strokeText(s, 0, x), this.ctx.fillText(s, 0, x);
6095
6095
  });
6096
6096
  }
6097
6097
  drawRectangle(o) {
6098
6098
  o.fill && o.fill !== "transparent" && (this.ctx.fillStyle = o.fill, this.ctx.fillRect(0, 0, o.width, o.height)), o.stroke && o.strokeWidth > 0 && (this.ctx.strokeStyle = o.stroke, this.ctx.lineWidth = o.strokeWidth, this.ctx.strokeRect(0, 0, o.width, o.height));
6099
6099
  }
6100
6100
  drawCircle(o) {
6101
- const a = Math.min(o.width, o.height) / 2, d = o.width / 2, s = o.height / 2;
6102
- this.ctx.beginPath(), this.ctx.arc(d, s, a, 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());
6101
+ const a = Math.min(o.width, o.height) / 2, n = o.width / 2, s = o.height / 2;
6102
+ this.ctx.beginPath(), this.ctx.arc(n, s, a, 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());
6103
6103
  }
6104
6104
  drawTriangle(o) {
6105
6105
  const a = o.width / 2;
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, d = o.height / 2, s = Math.min(o.width, o.height) / 2, h = s * 0.4, g = o.numPoints || 5;
6109
+ const a = o.width / 2, n = o.height / 2, s = Math.min(o.width, o.height) / 2, h = s * 0.4, x = o.numPoints || 5;
6110
6110
  this.ctx.beginPath();
6111
- for (let l = 0; l < g * 2; l++) {
6112
- const n = l % 2 === 0 ? s : h, F = l * Math.PI / g, N = a + Math.cos(F) * n, R = d + Math.sin(F) * n;
6113
- l === 0 ? this.ctx.moveTo(N, R) : this.ctx.lineTo(N, R);
6111
+ for (let l = 0; l < x * 2; l++) {
6112
+ const d = l % 2 === 0 ? s : h, F = l * Math.PI / x, T = a + Math.cos(F) * d, R = n + Math.sin(F) * d;
6113
+ l === 0 ? this.ctx.moveTo(T, R) : this.ctx.lineTo(T, R);
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
  }
6117
6117
  drawArrow(o) {
6118
- const a = o.width, d = o.height, s = a * 0.3;
6119
- this.ctx.beginPath(), this.ctx.moveTo(a / 2, 0), this.ctx.lineTo(a, d * 0.6), this.ctx.lineTo(a - s, d * 0.6), this.ctx.lineTo(a - s, d), this.ctx.lineTo(s, d), this.ctx.lineTo(s, d * 0.6), this.ctx.lineTo(0, d * 0.6), 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());
6118
+ const a = o.width, n = o.height, s = a * 0.3;
6119
+ this.ctx.beginPath(), this.ctx.moveTo(a / 2, 0), this.ctx.lineTo(a, n * 0.6), this.ctx.lineTo(a - s, n * 0.6), this.ctx.lineTo(a - s, n), this.ctx.lineTo(s, n), this.ctx.lineTo(s, n * 0.6), this.ctx.lineTo(0, n * 0.6), 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());
6120
6120
  }
6121
6121
  async dataUrlToBlob(o) {
6122
6122
  return new Promise((a) => {
6123
- const d = document.createElement("canvas"), s = d.getContext("2d"), h = new Image();
6123
+ const n = document.createElement("canvas"), s = n.getContext("2d"), h = new Image();
6124
6124
  h.onload = () => {
6125
- d.width = h.width, d.height = h.height, s.drawImage(h, 0, 0), d.toBlob(a);
6125
+ n.width = h.width, n.height = h.height, s.drawImage(h, 0, 0), n.toBlob(a);
6126
6126
  }, h.src = o;
6127
6127
  });
6128
6128
  }
@@ -6136,71 +6136,71 @@ class ci {
6136
6136
  }
6137
6137
  // Add the new shape drawing methods to ExportManager
6138
6138
  drawDiamond(o) {
6139
- const a = o.width / 2, d = o.height / 2;
6140
- this.ctx.beginPath(), this.ctx.moveTo(a, 0), this.ctx.lineTo(o.width, d), this.ctx.lineTo(a, o.height), this.ctx.lineTo(0, d), 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());
6139
+ const a = o.width / 2, n = o.height / 2;
6140
+ this.ctx.beginPath(), this.ctx.moveTo(a, 0), this.ctx.lineTo(o.width, n), this.ctx.lineTo(a, o.height), this.ctx.lineTo(0, n), 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, d = o.height / 2, s = Math.min(o.width, o.height) / 2, h = 6;
6143
+ const a = o.width / 2, n = o.height / 2, s = Math.min(o.width, o.height) / 2, h = 6;
6144
6144
  this.ctx.beginPath();
6145
- for (let g = 0; g < h; g++) {
6146
- const l = g * 2 * Math.PI / h - Math.PI / 2, n = a + s * Math.cos(l), F = d + s * Math.sin(l);
6147
- g === 0 ? this.ctx.moveTo(n, F) : this.ctx.lineTo(n, F);
6145
+ for (let x = 0; x < h; x++) {
6146
+ const l = x * 2 * Math.PI / h - Math.PI / 2, d = a + s * Math.cos(l), F = n + s * Math.sin(l);
6147
+ x === 0 ? this.ctx.moveTo(d, F) : this.ctx.lineTo(d, 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, d = o.height / 2, s = Math.min(o.width, o.height) / 2, h = 5;
6152
+ const a = o.width / 2, n = o.height / 2, s = Math.min(o.width, o.height) / 2, h = 5;
6153
6153
  this.ctx.beginPath();
6154
- for (let g = 0; g < h; g++) {
6155
- const l = g * 2 * Math.PI / h - Math.PI / 2, n = a + s * Math.cos(l), F = d + s * Math.sin(l);
6156
- g === 0 ? this.ctx.moveTo(n, F) : this.ctx.lineTo(n, F);
6154
+ for (let x = 0; x < h; x++) {
6155
+ const l = x * 2 * Math.PI / h - Math.PI / 2, d = a + s * Math.cos(l), F = n + s * Math.sin(l);
6156
+ x === 0 ? this.ctx.moveTo(d, F) : this.ctx.lineTo(d, 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, d = o.height, s = 0, h = 0;
6161
+ const a = o.width, n = o.height, s = 0, h = 0;
6162
6162
  this.ctx.beginPath();
6163
- const g = d * 0.3;
6164
- this.ctx.moveTo(s + a / 2, h + g), this.ctx.bezierCurveTo(
6163
+ const x = n * 0.3;
6164
+ this.ctx.moveTo(s + a / 2, h + x), this.ctx.bezierCurveTo(
6165
6165
  s + a / 2,
6166
6166
  h,
6167
6167
  s,
6168
6168
  h,
6169
6169
  s,
6170
- h + g
6170
+ h + x
6171
6171
  ), this.ctx.bezierCurveTo(
6172
6172
  s,
6173
- h + (d + g) / 2,
6173
+ h + (n + x) / 2,
6174
6174
  s + a / 2,
6175
- h + (d + g) / 2,
6175
+ h + (n + x) / 2,
6176
6176
  s + a / 2,
6177
- h + d
6177
+ h + n
6178
6178
  ), this.ctx.bezierCurveTo(
6179
6179
  s + a / 2,
6180
- h + (d + g) / 2,
6180
+ h + (n + x) / 2,
6181
6181
  s + a,
6182
- h + (d + g) / 2,
6182
+ h + (n + x) / 2,
6183
6183
  s + a,
6184
- h + g
6184
+ h + x
6185
6185
  ), this.ctx.bezierCurveTo(
6186
6186
  s + a,
6187
6187
  h,
6188
6188
  s + a / 2,
6189
6189
  h,
6190
6190
  s + a / 2,
6191
- h + g
6191
+ h + x
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, d = o.height / 2, s = o.width / 2, h = o.height / 2;
6196
- this.ctx.beginPath(), this.ctx.ellipse(a, d, 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, n = o.height / 2, s = o.width / 2, h = o.height / 2;
6196
+ this.ctx.beginPath(), this.ctx.ellipse(a, n, 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());
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, d, s, h) {
6203
- this.ctx.beginPath(), this.ctx.moveTo(o + h, a), this.ctx.lineTo(o + d - h, a), this.ctx.quadraticCurveTo(o + d, a, o + d, a + h), this.ctx.lineTo(o + d, a + s - h), this.ctx.quadraticCurveTo(o + d, a + s, o + d - 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, n, s, h) {
6203
+ this.ctx.beginPath(), this.ctx.moveTo(o + h, a), this.ctx.lineTo(o + n - h, a), this.ctx.quadraticCurveTo(o + n, a, o + n, a + h), this.ctx.lineTo(o + n, a + s - h), this.ctx.quadraticCurveTo(o + n, a + s, o + n - 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();
6204
6204
  }
6205
6205
  async drawQRCode(o) {
6206
6206
  if (o.imageObject)
@@ -6239,8 +6239,8 @@ class ci {
6239
6239
  else if (o.imageData)
6240
6240
  a = o.imageData;
6241
6241
  else if (o.src || o.image) {
6242
- const d = o.src || o.image;
6243
- a = await this.loadImage(d);
6242
+ const n = o.src || o.image;
6243
+ a = await this.loadImage(n);
6244
6244
  } else o.data && o.data.image && (a = await this.loadImage(o.data.image));
6245
6245
  a ? (o.opacity !== void 0 && (this.ctx.globalAlpha = o.opacity), this.ctx.drawImage(a, 0, 0, o.width, o.height)) : (this.ctx.fillStyle = "#f0f0f0", this.ctx.fillRect(0, 0, o.width, o.height), this.ctx.strokeStyle = "#ccc", 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("Sticker", o.width / 2, o.height / 2));
6246
6246
  } catch (a) {
@@ -6255,8 +6255,8 @@ class ci {
6255
6255
  else if (o.imageData)
6256
6256
  a = o.imageData;
6257
6257
  else if (o.src || o.image) {
6258
- const d = o.src || o.image;
6259
- a = await this.loadImage(d);
6258
+ const n = o.src || o.image;
6259
+ a = await this.loadImage(n);
6260
6260
  } else o.data && o.data.image && (a = await this.loadImage(o.data.image));
6261
6261
  a ? (o.opacity !== void 0 && (this.ctx.globalAlpha = o.opacity), this.ctx.drawImage(a, 0, 0, o.width, o.height)) : (this.ctx.fillStyle = "#f0f0f0", this.ctx.fillRect(0, 0, o.width, o.height), this.ctx.strokeStyle = "#ccc", 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("Embroidery", o.width / 2, o.height / 2));
6262
6262
  } catch (a) {
@@ -6266,88 +6266,88 @@ class ci {
6266
6266
  /**Export to JSON formats**/
6267
6267
  // Add these new methods to the ExportManager class
6268
6268
  // Helper method to convert blob to File
6269
- async blobToFile(o, a, d = "image/png") {
6269
+ async blobToFile(o, a, n = "image/png") {
6270
6270
  return new File([o], a, {
6271
- type: d,
6271
+ type: n,
6272
6272
  lastModified: Date.now()
6273
6273
  });
6274
6274
  }
6275
6275
  // Export all sections as JSON with File objects
6276
- async exportAllSectionsAsJSON(o, a, d, s, h = "png") {
6277
- const g = [], l = [];
6276
+ async exportAllSectionsAsJSON(o, a, n, s, h = "png") {
6277
+ const x = [], l = [];
6278
6278
  for (const F of a) {
6279
- const N = F.id || F.sectionName, R = o[N];
6279
+ const T = F.id || F.sectionName, R = o[T];
6280
6280
  if (!R || !R.elements || R.elements.length === 0) {
6281
- console.log(`Skipping section ${N} - no elements`);
6281
+ console.log(`Skipping section ${T} - no elements`);
6282
6282
  continue;
6283
6283
  }
6284
- const m = await this.exportSectionAsBlob(
6284
+ const u = await this.exportSectionAsBlob(
6285
6285
  R,
6286
6286
  F,
6287
- d,
6287
+ n,
6288
6288
  s,
6289
6289
  h,
6290
6290
  !0
6291
6291
  );
6292
- if (m) {
6293
- const B = await this.blobToFile(
6294
- m,
6295
- `${N}-full.${h}`,
6292
+ if (u) {
6293
+ const z = await this.blobToFile(
6294
+ u,
6295
+ `${T}-full.${h}`,
6296
6296
  `image/${h}`
6297
6297
  );
6298
- g.push({
6299
- sectionName: N,
6300
- sectionImage: B
6298
+ x.push({
6299
+ sectionName: T,
6300
+ sectionImage: z
6301
6301
  });
6302
6302
  }
6303
6303
  const E = await this.exportSectionAsBlob(
6304
6304
  R,
6305
6305
  F,
6306
- d,
6306
+ n,
6307
6307
  s,
6308
6308
  h,
6309
6309
  !1
6310
6310
  );
6311
6311
  if (E) {
6312
- const B = await this.blobToFile(
6312
+ const z = await this.blobToFile(
6313
6313
  E,
6314
- `${N}-print.${h}`,
6314
+ `${T}-print.${h}`,
6315
6315
  `image/${h}`
6316
6316
  );
6317
6317
  l.push({
6318
- sectionName: N,
6319
- sectionImage: B
6318
+ sectionName: T,
6319
+ sectionImage: z
6320
6320
  });
6321
6321
  }
6322
6322
  }
6323
- const n = {
6323
+ const d = {
6324
6324
  sections: o,
6325
- canvasWidth: d,
6325
+ canvasWidth: n,
6326
6326
  canvasHeight: s,
6327
6327
  format: h,
6328
6328
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
6329
6329
  version: "1.0"
6330
6330
  };
6331
6331
  return {
6332
- fullDesign: g,
6332
+ fullDesign: x,
6333
6333
  printReady: l,
6334
- designFile: JSON.stringify(n)
6334
+ designFile: JSON.stringify(d)
6335
6335
  };
6336
6336
  }
6337
6337
  // Helper method to export a single section as blob
6338
- async exportSectionAsBlob(o, a, d, s, h = "png", g = !0) {
6338
+ async exportSectionAsBlob(o, a, n, s, h = "png", x = !0) {
6339
6339
  try {
6340
- if (this.canvas.width = d, this.canvas.height = s, this.ctx.clearRect(0, 0, d, s), g) {
6340
+ if (this.canvas.width = n, this.canvas.height = s, this.ctx.clearRect(0, 0, n, s), x) {
6341
6341
  const l = a.image || a.sectionImage;
6342
6342
  if (l)
6343
6343
  try {
6344
- const n = await this.loadImage(l);
6345
- await this.processImageColor(n, o.selectedColor || "#FFFFFF"), this.ctx.drawImage(this.processedImage, 0, 0, d, s);
6346
- } catch (n) {
6347
- console.warn("Failed to load background image:", n);
6344
+ const d = await this.loadImage(l);
6345
+ await this.processImageColor(d, o.selectedColor || "#FFFFFF"), this.ctx.drawImage(this.processedImage, 0, 0, n, s);
6346
+ } catch (d) {
6347
+ console.warn("Failed to load background image:", d);
6348
6348
  }
6349
6349
  } else
6350
- this.ctx.clearRect(0, 0, d, s);
6350
+ this.ctx.clearRect(0, 0, n, s);
6351
6351
  for (const l of o.elements)
6352
6352
  await this.drawElement(l);
6353
6353
  return new Promise((l) => {
@@ -6357,35 +6357,81 @@ class ci {
6357
6357
  return console.error("Error exporting section as blob:", l), null;
6358
6358
  }
6359
6359
  }
6360
- // Export current section as JSON
6360
+ // Add this method to the ExportManager class
6361
6361
  async exportCurrentSectionAsJSON(o, a = "png") {
6362
- var h, g, l, n, F;
6363
- const d = {
6364
- [((h = o.activeSection) == null ? void 0 : h.sectionName) || "main"]: o
6365
- }, s = [{
6366
- id: ((g = o.activeSection) == null ? void 0 : g.sectionName) || "main",
6367
- sectionName: ((l = o.activeSection) == null ? void 0 : l.sectionName) || "main",
6368
- image: (n = o.activeSection) == null ? void 0 : n.sectionImage,
6369
- sectionImage: (F = o.activeSection) == null ? void 0 : F.sectionImage
6370
- }];
6371
- return await this.exportAllSectionsAsJSON(
6372
- d,
6362
+ var R, u, E;
6363
+ const n = ((R = o.activeSection) == null ? void 0 : R.sectionName) || "main", s = {
6364
+ elements: o.elements,
6365
+ selectedColor: o.selectedColor,
6366
+ canvasWidth: o.canvasWidth,
6367
+ canvasHeight: o.canvasHeight
6368
+ }, h = {
6369
+ id: n,
6370
+ sectionName: n,
6371
+ image: (u = o.activeSection) == null ? void 0 : u.sectionImage,
6372
+ sectionImage: (E = o.activeSection) == null ? void 0 : E.sectionImage
6373
+ }, x = [], l = [], d = await this.exportSectionAsBlob(
6374
+ s,
6375
+ h,
6376
+ o.canvasWidth,
6377
+ o.canvasHeight,
6378
+ a,
6379
+ !0
6380
+ );
6381
+ if (d) {
6382
+ const z = await this.blobToFile(
6383
+ d,
6384
+ `${n}-full.${a}`,
6385
+ `image/${a}`
6386
+ );
6387
+ x.push({
6388
+ sectionName: n,
6389
+ sectionImage: z
6390
+ });
6391
+ }
6392
+ const F = await this.exportSectionAsBlob(
6373
6393
  s,
6394
+ h,
6374
6395
  o.canvasWidth,
6375
6396
  o.canvasHeight,
6376
- a
6397
+ a,
6398
+ !1
6377
6399
  );
6400
+ if (F) {
6401
+ const z = await this.blobToFile(
6402
+ F,
6403
+ `${n}-print.${a}`,
6404
+ `image/${a}`
6405
+ );
6406
+ l.push({
6407
+ sectionName: n,
6408
+ sectionImage: z
6409
+ });
6410
+ }
6411
+ const T = {
6412
+ sections: { [n]: s },
6413
+ canvasWidth: o.canvasWidth,
6414
+ canvasHeight: o.canvasHeight,
6415
+ format: a,
6416
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
6417
+ version: "1.0"
6418
+ };
6419
+ return {
6420
+ fullDesign: x,
6421
+ printReady: l,
6422
+ designFile: JSON.stringify(T)
6423
+ };
6378
6424
  }
6379
6425
  }
6380
- class di {
6426
+ class ri {
6381
6427
  constructor(o = "localStorage") {
6382
6428
  this.storage = o === "sessionStorage" ? sessionStorage : localStorage, this.STORAGE_PREFIX = "mypixia_canvas_", this.DESIGNS_LIST_KEY = "mypixia_saved_designs";
6383
6429
  }
6384
6430
  // Save complete canvas design
6385
6431
  saveDesign(o, a) {
6386
- var d;
6432
+ var n;
6387
6433
  try {
6388
- const s = this.generateDesignId(o), h = (/* @__PURE__ */ new Date()).toISOString(), g = {
6434
+ const s = this.generateDesignId(o), h = (/* @__PURE__ */ new Date()).toISOString(), x = {
6389
6435
  id: s,
6390
6436
  name: o,
6391
6437
  timestamp: h,
@@ -6403,12 +6449,12 @@ class di {
6403
6449
  snapToGrid: a.snapToGrid || !0
6404
6450
  },
6405
6451
  metadata: {
6406
- elementCount: ((d = a.elements) == null ? void 0 : d.length) || 0,
6452
+ elementCount: ((n = a.elements) == null ? void 0 : n.length) || 0,
6407
6453
  lastModified: h,
6408
6454
  thumbnail: a.thumbnail || null
6409
6455
  }
6410
6456
  };
6411
- return this.storage.setItem(this.STORAGE_PREFIX + s, JSON.stringify(g)), this.updateDesignsList(s, o, h), { success: !0, designId: s, message: "Design saved successfully" };
6457
+ return this.storage.setItem(this.STORAGE_PREFIX + s, JSON.stringify(x)), this.updateDesignsList(s, o, h), { success: !0, designId: s, message: "Design saved successfully" };
6412
6458
  } catch (s) {
6413
6459
  return console.error("Error saving design:", s), { success: !1, error: s.message };
6414
6460
  }
@@ -6418,13 +6464,13 @@ class di {
6418
6464
  try {
6419
6465
  let a = o;
6420
6466
  if (!o.startsWith("design_")) {
6421
- const g = this.getAllDesigns().find((l) => l.name === o);
6422
- if (!g)
6467
+ const x = this.getAllDesigns().find((l) => l.name === o);
6468
+ if (!x)
6423
6469
  return { success: !1, error: "Design not found" };
6424
- a = g.id;
6470
+ a = x.id;
6425
6471
  }
6426
- const d = this.storage.getItem(this.STORAGE_PREFIX + a);
6427
- return d ? { success: !0, data: JSON.parse(d) } : { success: !1, error: "Design not found" };
6472
+ const n = this.storage.getItem(this.STORAGE_PREFIX + a);
6473
+ return n ? { success: !0, data: JSON.parse(n) } : { success: !1, error: "Design not found" };
6428
6474
  } catch (a) {
6429
6475
  return console.error("Error loading design:", a), { success: !1, error: a.message };
6430
6476
  }
@@ -6442,8 +6488,8 @@ class di {
6442
6488
  deleteDesign(o) {
6443
6489
  try {
6444
6490
  this.storage.removeItem(this.STORAGE_PREFIX + o);
6445
- const d = this.getAllDesigns().filter((s) => s.id !== o);
6446
- return this.storage.setItem(this.DESIGNS_LIST_KEY, JSON.stringify(d)), { success: !0, message: "Design deleted successfully" };
6491
+ const n = this.getAllDesigns().filter((s) => s.id !== o);
6492
+ return this.storage.setItem(this.DESIGNS_LIST_KEY, JSON.stringify(n)), { success: !0, message: "Design deleted successfully" };
6447
6493
  } catch (a) {
6448
6494
  return console.error("Error deleting design:", a), { success: !1, error: a.message };
6449
6495
  }
@@ -6454,8 +6500,8 @@ class di {
6454
6500
  const a = this.loadDesign(o);
6455
6501
  if (!a.success)
6456
6502
  return a;
6457
- const d = a.data, s = JSON.stringify(d, null, 2), h = new Blob([s], { type: "application/json" }), g = URL.createObjectURL(h), l = document.createElement("a");
6458
- return l.href = g, l.download = `${d.name}_${d.id}.json`, document.body.appendChild(l), l.click(), document.body.removeChild(l), URL.revokeObjectURL(g), { success: !0, message: "Design exported successfully" };
6503
+ const n = a.data, s = JSON.stringify(n, null, 2), h = new Blob([s], { type: "application/json" }), x = URL.createObjectURL(h), l = document.createElement("a");
6504
+ return l.href = x, l.download = `${n.name}_${n.id}.json`, document.body.appendChild(l), l.click(), document.body.removeChild(l), URL.revokeObjectURL(x), { success: !0, message: "Design exported successfully" };
6459
6505
  } catch (a) {
6460
6506
  return console.error("Error exporting design:", a), { success: !1, error: a.message };
6461
6507
  }
@@ -6464,34 +6510,34 @@ class di {
6464
6510
  importDesignFromFile(o) {
6465
6511
  return new Promise((a) => {
6466
6512
  try {
6467
- const d = new FileReader();
6468
- d.onload = (s) => {
6513
+ const n = new FileReader();
6514
+ n.onload = (s) => {
6469
6515
  try {
6470
6516
  const h = JSON.parse(s.target.result);
6471
6517
  if (!this.validateDesignData(h)) {
6472
6518
  a({ success: !1, error: "Invalid design file format" });
6473
6519
  return;
6474
6520
  }
6475
- const g = this.generateDesignId(h.name + "_imported");
6476
- h.id = g, h.name += "_imported", h.timestamp = (/* @__PURE__ */ new Date()).toISOString(), h.metadata.lastModified = h.timestamp, this.storage.setItem(this.STORAGE_PREFIX + g, JSON.stringify(h)), this.updateDesignsList(g, h.name, h.timestamp), a({ success: !0, data: h, message: "Design imported successfully" });
6521
+ const x = this.generateDesignId(h.name + "_imported");
6522
+ 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" });
6477
6523
  } catch {
6478
6524
  a({ success: !1, error: "Failed to parse design file" });
6479
6525
  }
6480
- }, d.readAsText(o);
6481
- } catch (d) {
6482
- a({ success: !1, error: d.message });
6526
+ }, n.readAsText(o);
6527
+ } catch (n) {
6528
+ a({ success: !1, error: n.message });
6483
6529
  }
6484
6530
  });
6485
6531
  }
6486
6532
  // Auto-save functionality
6487
6533
  autoSave(o, a) {
6488
- const d = this.STORAGE_PREFIX + "autosave_" + o;
6534
+ const n = this.STORAGE_PREFIX + "autosave_" + o;
6489
6535
  try {
6490
6536
  const s = {
6491
6537
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
6492
6538
  canvasData: a
6493
6539
  };
6494
- return this.storage.setItem(d, JSON.stringify(s)), !0;
6540
+ return this.storage.setItem(n, JSON.stringify(s)), !0;
6495
6541
  } catch (s) {
6496
6542
  return console.error("Auto-save failed:", s), !1;
6497
6543
  }
@@ -6500,10 +6546,10 @@ class di {
6500
6546
  loadAutoSave(o) {
6501
6547
  const a = this.STORAGE_PREFIX + "autosave_" + o;
6502
6548
  try {
6503
- const d = this.storage.getItem(a);
6504
- return d ? JSON.parse(d) : null;
6505
- } catch (d) {
6506
- return console.error("Failed to load auto-save:", d), null;
6549
+ const n = this.storage.getItem(a);
6550
+ return n ? JSON.parse(n) : null;
6551
+ } catch (n) {
6552
+ return console.error("Failed to load auto-save:", n), null;
6507
6553
  }
6508
6554
  }
6509
6555
  // Clear auto-save
@@ -6515,8 +6561,8 @@ class di {
6515
6561
  getStorageInfo() {
6516
6562
  const o = this.getAllDesigns();
6517
6563
  let a = 0;
6518
- return o.forEach((d) => {
6519
- const s = this.storage.getItem(this.STORAGE_PREFIX + d.id);
6564
+ return o.forEach((n) => {
6565
+ const s = this.storage.getItem(this.STORAGE_PREFIX + n.id);
6520
6566
  s && (a += new Blob([s]).size);
6521
6567
  }), {
6522
6568
  designCount: o.length,
@@ -6537,25 +6583,25 @@ class di {
6537
6583
  }
6538
6584
  // Private helper methods
6539
6585
  generateDesignId(o) {
6540
- const a = Date.now(), d = Math.random().toString(36).substring(2, 8);
6541
- return `design_${a}_${d}`;
6586
+ const a = Date.now(), n = Math.random().toString(36).substring(2, 8);
6587
+ return `design_${a}_${n}`;
6542
6588
  }
6543
- updateDesignsList(o, a, d) {
6544
- const s = this.getAllDesigns(), h = s.findIndex((l) => l.id === o), g = {
6589
+ updateDesignsList(o, a, n) {
6590
+ const s = this.getAllDesigns(), h = s.findIndex((l) => l.id === o), x = {
6545
6591
  id: o,
6546
6592
  name: a,
6547
- timestamp: d,
6548
- lastModified: d
6593
+ timestamp: n,
6594
+ lastModified: n
6549
6595
  };
6550
- h >= 0 ? s[h] = g : s.push(g), s.sort((l, n) => new Date(n.timestamp) - new Date(l.timestamp)), this.storage.setItem(this.DESIGNS_LIST_KEY, JSON.stringify(s));
6596
+ h >= 0 ? s[h] = x : s.push(x), s.sort((l, d) => new Date(d.timestamp) - new Date(l.timestamp)), this.storage.setItem(this.DESIGNS_LIST_KEY, JSON.stringify(s));
6551
6597
  }
6552
6598
  validateDesignData(o) {
6553
6599
  return o && o.id && o.name && o.canvasData && Array.isArray(o.canvasData.elements);
6554
6600
  }
6555
6601
  formatBytes(o) {
6556
6602
  if (o === 0) return "0 Bytes";
6557
- const a = 1024, d = ["Bytes", "KB", "MB", "GB"], s = Math.floor(Math.log(o) / Math.log(a));
6558
- return parseFloat((o / Math.pow(a, s)).toFixed(2)) + " " + d[s];
6603
+ const a = 1024, n = ["Bytes", "KB", "MB", "GB"], s = Math.floor(Math.log(o) / Math.log(a));
6604
+ return parseFloat((o / Math.pow(a, s)).toFixed(2)) + " " + n[s];
6559
6605
  }
6560
6606
  getStorageLimit() {
6561
6607
  try {
@@ -6567,14 +6613,14 @@ class di {
6567
6613
  return "Unknown";
6568
6614
  }
6569
6615
  }
6570
- const fi = $e((f, o) => {
6616
+ const ai = Me((f, o) => {
6571
6617
  const {
6572
6618
  theme: a = {
6573
6619
  primaryColor: "#000000",
6574
6620
  secondaryColor: "#cf7e52",
6575
6621
  tertiaryColor: "#FFFFFF"
6576
6622
  },
6577
- canvasId: d = null,
6623
+ canvasId: n = null,
6578
6624
  readOnly: s = !1,
6579
6625
  product: h = {
6580
6626
  name: "Premium Crew Neck T-Shirt",
@@ -6598,64 +6644,51 @@ const fi = $e((f, o) => {
6598
6644
  }
6599
6645
  ]
6600
6646
  }
6601
- } = f, [g, l] = j([]), [n, F] = j(null), [N, R] = j(!1), [m, E] = j(!1), [B, S] = j(!1), [T, J] = j({ x: 0, y: 0 }), [C, $] = j(null), [k, st] = j(800), [M, ht] = j(600), [O, ct] = j(1), [Q, rt] = j(h.colorSettings[0]), [P, lt] = j(!1), [X, nt] = j(!0), [_, U] = j(!0), [u, K] = j(h.sections[0]), [y, I] = j(!1), [W, H] = j({}), [G, Z] = j([]), [q, Y] = j(-1), [L] = j(new di("localStorage")), [ot, jt] = j(!0), [Wt, Lt] = j(null), yt = ft(null), ne = ft(null), xt = ft(null), ut = ft(null), Pt = ft(null), Rt = ft(new ci()), bt = ft(!1), kt = ft(null), at = et(() => {
6647
+ } = f, [x, l] = N([]), [d, F] = N(null), [T, R] = N(!1), [u, E] = N(!1), [z, S] = N(!1), [j, K] = N({ x: 0, y: 0 }), [C, Q] = N(null), [k, st] = N(800), [W, ht] = N(600), [O, ct] = N(1), [$, ot] = N(h.colorSettings[0]), [L, lt] = N(!1), [J, nt] = N(!0), [_, P] = N(!0), [p, Z] = N(h.sections[0]), [y, I] = N(!1), [M, H] = N({}), [G, tt] = N([]), [q, Y] = N(-1), [U] = N(new ri("localStorage")), X = xt(null), bt = xt(null), ft = xt(null), yt = xt(null), Bt = xt(null), It = xt(new oi()), pt = xt(!1), rt = at(() => {
6602
6648
  const e = {
6603
- elements: JSON.parse(JSON.stringify(g)),
6604
- selectedElement: n ? { ...n } : null,
6649
+ elements: JSON.parse(JSON.stringify(x)),
6650
+ selectedElement: d ? { ...d } : null,
6605
6651
  timestamp: Date.now()
6606
6652
  }, t = G.slice(0, q + 1);
6607
- t.push(e), t.length > 50 ? t.shift() : Y(q + 1), Z(t);
6608
- }, [g, n, G, q]), wt = et(() => ({
6609
- elements: g,
6653
+ t.push(e), t.length > 50 ? t.shift() : Y(q + 1), tt(t);
6654
+ }, [x, d, G, q]), vt = at(() => ({
6655
+ elements: x,
6610
6656
  canvasWidth: k,
6611
- canvasHeight: M,
6612
- selectedColor: Q,
6613
- activeSection: u,
6657
+ canvasHeight: W,
6658
+ selectedColor: $,
6659
+ activeSection: p,
6614
6660
  product: h,
6615
- sectionDesigns: W,
6661
+ sectionDesigns: M,
6616
6662
  zoomLevel: O,
6617
- showGrid: P,
6663
+ showGrid: L,
6618
6664
  snapToGrid: _,
6619
- selectedElement: n ? { ...n } : null,
6620
- canvasRef: yt
6665
+ selectedElement: d ? { ...d } : null,
6666
+ canvasRef: X
6621
6667
  // Include reference for thumbnail generation
6622
- }), [g, k, M, Q, u, h, W, O, P, _, n]);
6623
- et((e, t) => {
6624
- Lt((/* @__PURE__ */ new Date()).toISOString()), t && L.clearAutoSave(t), console.log("Design saved:", e, t);
6625
- }, [L]), et((e, t) => {
6626
- var r;
6668
+ }), [x, k, W, $, p, h, M, O, L, _, d]);
6669
+ at((e, t) => {
6627
6670
  try {
6628
- l(e.elements || []), st(e.canvasWidth || 800), ht(e.canvasHeight || 600), rt(e.selectedColor || h.colorSettings[0]), ct(e.zoomLevel || 1), lt(e.showGrid || !1), U(e.snapToGrid || !0), F(null), e.sectionDesigns && H(e.sectionDesigns), e.activeSection && K(e.activeSection), Z([]), Y(-1), setTimeout(() => {
6629
- at();
6630
- }, 100), Lt(((r = t.metadata) == null ? void 0 : r.lastModified) || (/* @__PURE__ */ new Date()).toISOString()), console.log("Design loaded successfully:", t.name);
6631
- } catch (c) {
6632
- console.error("Error loading design:", c);
6671
+ l(e.elements || []), st(e.canvasWidth || 800), ht(e.canvasHeight || 600), ot(e.selectedColor || h.colorSettings[0]), ct(e.zoomLevel || 1), lt(e.showGrid || !1), P(e.snapToGrid || !0), F(null), e.sectionDesigns && H(e.sectionDesigns), e.activeSection && Z(e.activeSection), tt([]), Y(-1), setTimeout(() => {
6672
+ rt();
6673
+ }, 100);
6674
+ } catch (r) {
6675
+ console.error("Error loading design:", r);
6633
6676
  }
6634
- }, [h.colorSettings, at]);
6635
- const Ut = et(() => {
6636
- if (!ot || g.length === 0) return;
6637
- const e = `autosave_${(u == null ? void 0 : u.sectionName) || "main"}_${Date.now()}`, t = wt();
6638
- L.autoSave(e, t) && console.log("Auto-saved at:", (/* @__PURE__ */ new Date()).toLocaleTimeString());
6639
- }, [ot, g.length, u == null ? void 0 : u.sectionName, wt, L]);
6640
- it(() => (ot && g.length > 0 && (kt.current && clearTimeout(kt.current), kt.current = setTimeout(() => {
6641
- Ut();
6642
- }, 3e4)), () => {
6643
- kt.current && clearTimeout(kt.current);
6644
- }), [g, Q, u, ot, Ut]), it(() => {
6677
+ }, [h.colorSettings, rt]), it(() => {
6645
6678
  const t = setTimeout(() => {
6646
- if (g.length === 0 && G.length <= 1) {
6647
- const c = "Arial", x = "Change me", w = document.createElement("canvas").getContext("2d");
6679
+ if (x.length === 0 && G.length <= 1) {
6680
+ const c = "Arial", g = "Change me", w = document.createElement("canvas").getContext("2d");
6648
6681
  w.font = `24px ${c}`;
6649
- const b = w.measureText(x).width, A = {
6682
+ const b = w.measureText(g).width, A = {
6650
6683
  id: dt(),
6651
6684
  type: "text",
6652
6685
  x: k / 2 - b / 2,
6653
6686
  // Center the actual text width
6654
- y: M / 2 - 24 / 2,
6687
+ y: W / 2 - 24 / 2,
6655
6688
  // Center based on font size
6656
6689
  width: b,
6657
6690
  height: 24,
6658
- text: x,
6691
+ text: g,
6659
6692
  fontSize: 24,
6660
6693
  fontFamily: c,
6661
6694
  fontWeight: "normal",
@@ -6669,28 +6702,28 @@ const fi = $e((f, o) => {
6669
6702
  opacity: 1
6670
6703
  };
6671
6704
  l([A]), F(A), setTimeout(() => {
6672
- at();
6705
+ rt();
6673
6706
  }, 100);
6674
6707
  }
6675
6708
  }, 300);
6676
6709
  return () => clearTimeout(t);
6677
6710
  }, []);
6678
- const Et = et((e = "png", t = !0) => {
6679
- const r = wt();
6680
- return h.sections, Rt.current.exportAllSections(
6681
- { [(u == null ? void 0 : u.sectionName) || "main"]: r },
6711
+ const Rt = at((e = "png", t = !0) => {
6712
+ const r = vt();
6713
+ return h.sections, It.current.exportAllSections(
6714
+ { [(p == null ? void 0 : p.sectionName) || "main"]: r },
6682
6715
  [{
6683
- id: (u == null ? void 0 : u.sectionName) || "main",
6684
- sectionName: (u == null ? void 0 : u.sectionName) || "main",
6685
- image: u == null ? void 0 : u.sectionImage,
6686
- sectionImage: u == null ? void 0 : u.sectionImage
6716
+ id: (p == null ? void 0 : p.sectionName) || "main",
6717
+ sectionName: (p == null ? void 0 : p.sectionName) || "main",
6718
+ image: p == null ? void 0 : p.sectionImage,
6719
+ sectionImage: p == null ? void 0 : p.sectionImage
6687
6720
  }],
6688
6721
  k,
6689
- M,
6722
+ W,
6690
6723
  e,
6691
6724
  t
6692
6725
  );
6693
- }, [wt, h.sections, u, k, M]), ce = [
6726
+ }, [vt, h.sections, p, k, W]), oe = [
6694
6727
  "Arial",
6695
6728
  "Helvetica",
6696
6729
  "Times New Roman",
@@ -6706,19 +6739,19 @@ const fi = $e((f, o) => {
6706
6739
  "Bookman",
6707
6740
  "Avant Garde",
6708
6741
  "Century Gothic"
6709
- ], Nt = 20;
6742
+ ], jt = 20;
6710
6743
  it(() => {
6711
6744
  const e = () => I(window.innerWidth < 768);
6712
6745
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
6713
6746
  }, []), it(() => {
6714
6747
  const e = document.createElement("canvas");
6715
- e.width = k, e.height = M, Pt.current = e;
6716
- }, [k, M]), it(() => {
6717
- G.length === 0 && at();
6748
+ e.width = k, e.height = W, Bt.current = e;
6749
+ }, [k, W]), it(() => {
6750
+ G.length === 0 && rt();
6718
6751
  }, []);
6719
- const At = (e, t, r, c, x, p) => {
6720
- e.beginPath(), e.moveTo(t + p, r), e.lineTo(t + c - p, r), e.quadraticCurveTo(t + c, r, t + c, r + p), e.lineTo(t + c, r + x - p), e.quadraticCurveTo(t + c, r + x, t + c - p, r + x), e.lineTo(t + p, r + x), e.quadraticCurveTo(t, r + x, t, r + x - p), e.lineTo(t, r + p), e.quadraticCurveTo(t, r, t + p, r), e.closePath();
6721
- }, Ot = (e, t) => {
6752
+ const Tt = (e, t, r, c, g, m) => {
6753
+ 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();
6754
+ }, Wt = (e, t) => {
6722
6755
  if (!t.isIcon)
6723
6756
  return {
6724
6757
  x: t.x,
@@ -6729,11 +6762,11 @@ const fi = $e((f, o) => {
6729
6762
  cy: t.y + t.height / 2
6730
6763
  };
6731
6764
  e.save(), e.font = `${t.fontStyle || ""} ${t.fontWeight || ""} ${t.fontSize}px ${t.fontFamily}`, e.textBaseline = "alphabetic", e.textAlign = "left";
6732
- const r = e.measureText(t.text), c = r.actualBoundingBoxAscent ?? t.fontSize * 0.8, x = r.actualBoundingBoxDescent ?? t.fontSize * 0.2, p = r.actualBoundingBoxLeft ?? 0, w = r.actualBoundingBoxRight ?? r.width, v = p + w, b = c + x, A = t.x, D = t.y, z = A - v / 2 - p, tt = D - b / 2 - c;
6733
- return e.restore(), { x: z, y: tt, width: v, height: b, cx: A, cy: D };
6734
- }, de = (e, t) => {
6765
+ const r = e.measureText(t.text), c = r.actualBoundingBoxAscent ?? t.fontSize * 0.8, g = r.actualBoundingBoxDescent ?? t.fontSize * 0.2, m = r.actualBoundingBoxLeft ?? 0, w = r.actualBoundingBoxRight ?? r.width, v = m + w, b = c + g, A = t.x, D = t.y, B = A - v / 2 - m, et = D - b / 2 - c;
6766
+ return e.restore(), { x: B, y: et, width: v, height: b, cx: A, cy: D };
6767
+ }, re = (e, t) => {
6735
6768
  if (!t) return;
6736
- const r = 8, c = 8, x = 4, p = 30, w = Ot(e, t), v = t.isIcon ? Math.max(r, 12) : r, b = {
6769
+ const r = 8, c = 8, g = 4, m = 30, w = Wt(e, t), v = t.isIcon ? Math.max(r, 12) : r, b = {
6737
6770
  x: -w.width / 2 - v,
6738
6771
  y: -w.height / 2 - v,
6739
6772
  w: w.width + v * 2,
@@ -6746,41 +6779,41 @@ const fi = $e((f, o) => {
6746
6779
  b.x + b.w,
6747
6780
  b.y + b.h
6748
6781
  );
6749
- A.addColorStop(0, "#3b82f6"), A.addColorStop(0.5, "#1d4ed8"), A.addColorStop(1, "#3b82f6"), e.strokeStyle = "rgba(59,130,246,.3)", e.lineWidth = 3, At(
6782
+ A.addColorStop(0, "#3b82f6"), A.addColorStop(0.5, "#1d4ed8"), A.addColorStop(1, "#3b82f6"), e.strokeStyle = "rgba(59,130,246,.3)", e.lineWidth = 3, Tt(
6750
6783
  e,
6751
6784
  b.x - 1,
6752
6785
  b.y - 1,
6753
6786
  b.w + 2,
6754
6787
  b.h + 2,
6755
- x + 1
6756
- ), e.stroke(), e.strokeStyle = A, 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, [
6788
+ g + 1
6789
+ ), e.stroke(), e.strokeStyle = A, e.lineWidth = 2, e.setLineDash([8, 4]), Tt(e, b.x, b.y, b.w, b.h, g), e.stroke(), e.lineDashOffset = -(Date.now() / 50) % 12, e.strokeStyle = "#ffffff", e.lineWidth = 1, e.setLineDash([4, 8]), Tt(e, b.x, b.y, b.w, b.h, g), e.stroke(), e.setLineDash([]), e.lineDashOffset = 0, [
6757
6790
  { x: b.x, y: b.y },
6758
6791
  { x: b.x + b.w, y: b.y },
6759
6792
  { x: b.x + b.w, y: b.y + b.h },
6760
6793
  { x: b.x, y: b.y + b.h }
6761
- ].forEach((tt) => {
6794
+ ].forEach((et) => {
6762
6795
  e.fillStyle = "rgba(0,0,0,.2)", e.fillRect(
6763
- tt.x - c / 2 + 1,
6764
- tt.y - c / 2 + 1,
6796
+ et.x - c / 2 + 1,
6797
+ et.y - c / 2 + 1,
6765
6798
  c,
6766
6799
  c
6767
6800
  ), e.fillStyle = "#ffffff", e.fillRect(
6768
- tt.x - c / 2,
6769
- tt.y - c / 2,
6801
+ et.x - c / 2,
6802
+ et.y - c / 2,
6770
6803
  c,
6771
6804
  c
6772
6805
  ), e.strokeStyle = "#3b82f6", e.lineWidth = 1, e.strokeRect(
6773
- tt.x - c / 2,
6774
- tt.y - c / 2,
6806
+ et.x - c / 2,
6807
+ et.y - c / 2,
6775
6808
  c,
6776
6809
  c
6777
6810
  );
6778
6811
  });
6779
- const D = 0, z = b.y - p;
6780
- e.strokeStyle = "#3b82f6", e.lineWidth = 1, e.setLineDash([2, 2]), e.beginPath(), e.moveTo(D, z + 12), e.lineTo(D, b.y), e.stroke(), e.setLineDash([]), e.beginPath(), e.arc(D, 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(D, z, 6, -Math.PI / 2, Math.PI, !1), e.stroke(), e.beginPath(), e.moveTo(D - 6, z), e.lineTo(D - 3, z - 3), e.lineTo(D - 3, z + 3), e.closePath(), e.fillStyle = "#ffffff", e.fill(), e.restore();
6781
- }, fe = (e, t) => {
6812
+ const D = 0, B = b.y - m;
6813
+ e.strokeStyle = "#3b82f6", e.lineWidth = 1, e.setLineDash([2, 2]), e.beginPath(), e.moveTo(D, B + 12), e.lineTo(D, b.y), e.stroke(), e.setLineDash([]), e.beginPath(), e.arc(D, B, 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(D, B, 6, -Math.PI / 2, Math.PI, !1), e.stroke(), e.beginPath(), e.moveTo(D - 6, B), e.lineTo(D - 3, B - 3), e.lineTo(D - 3, B + 3), e.closePath(), e.fillStyle = "#ffffff", e.fill(), e.restore();
6814
+ }, ae = (e, t) => {
6782
6815
  if (!t) return [];
6783
- const r = Ot(e, t), c = t.isIcon ? Math.max(8, 12) : 8, x = 8, p = 30, w = (t.rotation || 0) * Math.PI / 180, v = {
6816
+ const r = Wt(e, t), c = t.isIcon ? Math.max(8, 12) : 8, g = 8, m = 30, w = (t.rotation || 0) * Math.PI / 180, v = {
6784
6817
  x: -r.width / 2 - c,
6785
6818
  y: -r.height / 2 - c,
6786
6819
  w: r.width + c * 2,
@@ -6790,65 +6823,65 @@ const fi = $e((f, o) => {
6790
6823
  { x: v.x + v.w, y: v.y, type: "ne-resize" },
6791
6824
  { x: v.x + v.w, y: v.y + v.h, type: "se-resize" },
6792
6825
  { x: v.x, y: v.y + v.h, type: "sw-resize" },
6793
- { x: 0, y: v.y - p, type: "rotate" }
6826
+ { x: 0, y: v.y - m, type: "rotate" }
6794
6827
  ], A = Math.cos(w), D = Math.sin(w);
6795
- return b.map((z) => ({
6796
- x: r.cx + (z.x * A - z.y * D),
6797
- y: r.cy + (z.x * D + z.y * A),
6798
- type: z.type,
6799
- size: z.type === "rotate" ? 24 : x
6828
+ return b.map((B) => ({
6829
+ x: r.cx + (B.x * A - B.y * D),
6830
+ y: r.cy + (B.x * D + B.y * A),
6831
+ type: B.type,
6832
+ size: B.type === "rotate" ? 24 : g
6800
6833
  }));
6801
- }, Qt = (e, t, r) => {
6834
+ }, Mt = (e, t, r) => {
6802
6835
  if (!r) return null;
6803
- const c = yt.current;
6836
+ const c = X.current;
6804
6837
  if (!c) return null;
6805
- const x = c.getContext("2d"), p = fe(x, r);
6806
- for (const w of p) {
6838
+ const g = c.getContext("2d"), m = ae(g, r);
6839
+ for (const w of m) {
6807
6840
  const v = e - w.x, b = t - w.y;
6808
6841
  if (Math.sqrt(v * v + b * b) <= w.size / 2)
6809
6842
  return w.type;
6810
6843
  }
6811
6844
  return null;
6812
- }, St = et(() => {
6845
+ }, kt = at(() => {
6813
6846
  if (q > 0) {
6814
6847
  const e = G[q - 1];
6815
6848
  l(e.elements), F(e.selectedElement), Y(q - 1);
6816
6849
  }
6817
- }, [G, q]), vt = et(() => {
6850
+ }, [G, q]), wt = at(() => {
6818
6851
  if (q < G.length - 1) {
6819
6852
  const e = G[q + 1];
6820
6853
  l(e.elements), F(e.selectedElement), Y(q + 1);
6821
6854
  }
6822
- }, [G, q]), mt = (e) => _ ? Math.round(e / Nt) * Nt : e;
6855
+ }, [G, q]), ut = (e) => _ ? Math.round(e / jt) * jt : e;
6823
6856
  it(() => {
6824
- if (u != null && u.sectionImage) {
6825
- xt.current = null, ut.current = null;
6826
- const e = yt.current;
6827
- e && (e.getContext("2d").clearRect(0, 0, k, M), console.log("cleared canvas"));
6857
+ if (p != null && p.sectionImage) {
6858
+ ft.current = null, yt.current = null;
6859
+ const e = X.current;
6860
+ e && (e.getContext("2d").clearRect(0, 0, k, W), console.log("cleared canvas"));
6828
6861
  const t = new Image();
6829
6862
  t.crossOrigin = "anonymous", t.onload = () => {
6830
- xt.current = t, It(t, Q);
6863
+ ft.current = t, Nt(t, $);
6831
6864
  }, t.onerror = () => {
6832
- console.error("Failed to load background image:", u.sectionImage), V();
6833
- }, t.src = u.sectionImage;
6865
+ console.error("Failed to load background image:", p.sectionImage), V();
6866
+ }, t.src = p.sectionImage;
6834
6867
  } else
6835
- xt.current = null, ut.current = null, V();
6836
- }, [u == null ? void 0 : u.sectionImage]), it(() => {
6868
+ ft.current = null, yt.current = null, V();
6869
+ }, [p == null ? void 0 : p.sectionImage]), it(() => {
6837
6870
  const e = (t) => {
6838
6871
  const r = document.activeElement;
6839
6872
  if (!(r && (r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.tagName === "SELECT" || r.isContentEditable))) {
6840
- if ((t.key === "Delete" || t.key === "Backspace") && n && !s) {
6873
+ if ((t.key === "Delete" || t.key === "Backspace") && d && !s) {
6841
6874
  t.preventDefault();
6842
- const x = n;
6843
- l((p) => p.filter((w) => w.id !== x.id)), F(null), at();
6875
+ const g = d;
6876
+ l((m) => m.filter((w) => w.id !== g.id)), F(null), rt();
6844
6877
  }
6845
6878
  if (t.ctrlKey || t.metaKey)
6846
6879
  switch (t.key) {
6847
6880
  case "z":
6848
- t.shiftKey ? (t.preventDefault(), vt()) : (t.preventDefault(), St());
6881
+ t.shiftKey ? (t.preventDefault(), wt()) : (t.preventDefault(), kt());
6849
6882
  break;
6850
6883
  case "y":
6851
- t.preventDefault(), vt();
6884
+ t.preventDefault(), wt();
6852
6885
  break;
6853
6886
  }
6854
6887
  }
@@ -6856,82 +6889,82 @@ const fi = $e((f, o) => {
6856
6889
  return document.addEventListener("keydown", e), () => {
6857
6890
  document.removeEventListener("keydown", e);
6858
6891
  };
6859
- }, [n, s, St, vt, at]);
6860
- const he = (e) => {
6892
+ }, [d, s, kt, wt, rt]);
6893
+ const se = (e) => {
6861
6894
  const t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
6862
6895
  return t ? {
6863
6896
  r: parseInt(t[1], 16),
6864
6897
  g: parseInt(t[2], 16),
6865
6898
  b: parseInt(t[3], 16)
6866
6899
  } : null;
6867
- }, dt = () => `element_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, ge = (e) => {
6900
+ }, dt = () => `element_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, le = (e) => {
6868
6901
  e.strokeStyle = "#e0e0e0", e.lineWidth = 1, e.setLineDash([1, 1]);
6869
- for (let t = 0; t <= k; t += Nt)
6870
- e.beginPath(), e.moveTo(t, 0), e.lineTo(t, M), e.stroke();
6871
- for (let t = 0; t <= M; t += Nt)
6902
+ for (let t = 0; t <= k; t += jt)
6903
+ e.beginPath(), e.moveTo(t, 0), e.lineTo(t, W), e.stroke();
6904
+ for (let t = 0; t <= W; t += jt)
6872
6905
  e.beginPath(), e.moveTo(0, t), e.lineTo(k, t), e.stroke();
6873
6906
  e.setLineDash([]);
6874
- }, xe = (e, t) => {
6907
+ }, ne = (e, t) => {
6875
6908
  e.save();
6876
6909
  const r = t.x + t.width / 2, c = t.y + t.height / 2;
6877
6910
  switch (e.translate(r, c), t.rotation && e.rotate(t.rotation * Math.PI / 180), e.translate(-t.width / 2, -t.height / 2), t.type) {
6878
6911
  case "text":
6879
- me(e, t);
6912
+ fe(e, t);
6880
6913
  break;
6881
6914
  case "rectangle":
6882
- pe(e, t);
6915
+ he(e, t);
6883
6916
  break;
6884
6917
  case "circle":
6885
- we(e, t);
6918
+ ge(e, t);
6886
6919
  break;
6887
6920
  case "triangle":
6888
- be(e, t);
6921
+ xe(e, t);
6889
6922
  break;
6890
6923
  case "star":
6891
- ve(e, t);
6924
+ ye(e, t);
6892
6925
  break;
6893
6926
  case "arrow":
6894
- ke(e, t);
6927
+ ue(e, t);
6895
6928
  break;
6896
6929
  case "diamond":
6897
- Se(e, t);
6930
+ me(e, t);
6898
6931
  break;
6899
6932
  case "hexagon":
6900
- Fe(e, t);
6933
+ pe(e, t);
6901
6934
  break;
6902
6935
  case "pentagon":
6903
- Ce(e, t);
6936
+ we(e, t);
6904
6937
  break;
6905
6938
  case "heart":
6906
- Te(e, t);
6939
+ be(e, t);
6907
6940
  break;
6908
6941
  case "oval":
6909
- je(e, t);
6942
+ ve(e, t);
6910
6943
  break;
6911
6944
  case "roundedRectangle":
6912
- Ne(e, t);
6945
+ ke(e, t);
6913
6946
  break;
6914
6947
  case "image":
6915
- Ie(e, t);
6948
+ Fe(e, t);
6916
6949
  break;
6917
6950
  case "qrcode":
6918
- ue(e, t);
6951
+ de(e, t);
6919
6952
  break;
6920
6953
  case "barcode":
6921
- ye(e, t);
6954
+ ce(e, t);
6922
6955
  break;
6923
6956
  case "sticker":
6924
- De(e, t);
6957
+ Ce(e, t);
6925
6958
  break;
6926
6959
  case "horizontalLine":
6927
- Ae(e, t);
6960
+ Se(e, t);
6928
6961
  break;
6929
6962
  case "embroidery":
6930
- Re(e, t);
6963
+ je(e, t);
6931
6964
  break;
6932
6965
  }
6933
6966
  e.restore();
6934
- }, ye = (e, t) => {
6967
+ }, ce = (e, t) => {
6935
6968
  if (t.imageObject)
6936
6969
  e.drawImage(t.imageObject, 0, 0, t.width, t.height);
6937
6970
  else if (t.src && !t.imageLoading) {
@@ -6940,18 +6973,18 @@ const fi = $e((f, o) => {
6940
6973
  r.onload = () => {
6941
6974
  l(
6942
6975
  (c) => c.map(
6943
- (x) => x.id === t.id ? { ...x, imageObject: r, imageLoading: !1 } : x
6976
+ (g) => g.id === t.id ? { ...g, imageObject: r, imageLoading: !1 } : g
6944
6977
  )
6945
6978
  );
6946
6979
  }, r.onerror = () => {
6947
6980
  l(
6948
6981
  (c) => c.map(
6949
- (x) => x.id === t.id ? { ...x, imageLoading: !1 } : x
6982
+ (g) => g.id === t.id ? { ...g, imageLoading: !1 } : g
6950
6983
  )
6951
6984
  );
6952
6985
  }, 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);
6953
6986
  } 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));
6954
- }, ue = (e, t) => {
6987
+ }, de = (e, t) => {
6955
6988
  if (t.imageObject)
6956
6989
  e.drawImage(t.imageObject, 0, 0, t.width, t.height);
6957
6990
  else if (t.src && !t.imageLoading) {
@@ -6960,18 +6993,18 @@ const fi = $e((f, o) => {
6960
6993
  r.onload = () => {
6961
6994
  l(
6962
6995
  (c) => c.map(
6963
- (x) => x.id === t.id ? { ...x, imageObject: r, imageLoading: !1 } : x
6996
+ (g) => g.id === t.id ? { ...g, imageObject: r, imageLoading: !1 } : g
6964
6997
  )
6965
6998
  );
6966
6999
  }, r.onerror = () => {
6967
7000
  l(
6968
7001
  (c) => c.map(
6969
- (x) => x.id === t.id ? { ...x, imageLoading: !1 } : x
7002
+ (g) => g.id === t.id ? { ...g, imageLoading: !1 } : g
6970
7003
  )
6971
7004
  );
6972
7005
  }, 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);
6973
7006
  } 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 QR...", 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 QR Data", t.width / 2, t.height / 2));
6974
- }, me = (e, t) => {
7007
+ }, fe = (e, t) => {
6975
7008
  e.save();
6976
7009
  let r = t.text || "Text";
6977
7010
  if (t.textTransform)
@@ -6988,137 +7021,137 @@ const fi = $e((f, o) => {
6988
7021
  }
6989
7022
  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);
6990
7023
  const c = r.split(`
6991
- `), x = (t.fontSize || 20) * (t.lineHeight || 1.2), p = Math.max(...c.map((v) => e.measureText(v).width)), w = c.length * x;
7024
+ `), g = (t.fontSize || 20) * (t.lineHeight || 1.2), m = Math.max(...c.map((v) => e.measureText(v).width)), w = c.length * g;
6992
7025
  if (t.backgroundColor && t.backgroundColor !== "transparent") {
6993
7026
  e.fillStyle = t.backgroundColor;
6994
7027
  const v = t.backgroundPadding || 4;
6995
7028
  e.fillRect(
6996
7029
  -v,
6997
7030
  -v,
6998
- p + v * 2,
7031
+ m + v * 2,
6999
7032
  w + v * 2
7000
7033
  ), e.fillStyle = t.fill || "#000000";
7001
7034
  }
7002
7035
  c.forEach((v, b) => {
7003
- const A = b * x, D = e.measureText(v).width;
7036
+ const A = b * g, D = e.measureText(v).width;
7004
7037
  t.stroke && t.strokeWidth > 0 && e.strokeText(v, 0, A), e.fillText(v, 0, A);
7005
- const z = t.fontSize || 20, tt = t.decorationColor || t.fill || "#000000", gt = Math.max(1, z / 20);
7006
- if (e.strokeStyle = tt, e.lineWidth = gt, t.textDecoration === "underline" || t.underline) {
7007
- const pt = A + z + 2;
7008
- e.beginPath(), e.moveTo(0, pt), e.lineTo(D, pt), e.stroke();
7038
+ const B = t.fontSize || 20, et = t.decorationColor || t.fill || "#000000", gt = Math.max(1, B / 20);
7039
+ if (e.strokeStyle = et, e.lineWidth = gt, t.textDecoration === "underline" || t.underline) {
7040
+ const mt = A + B + 2;
7041
+ e.beginPath(), e.moveTo(0, mt), e.lineTo(D, mt), e.stroke();
7009
7042
  }
7010
7043
  if (t.textDecoration === "overline" || t.overline) {
7011
- const pt = A - 2;
7012
- e.beginPath(), e.moveTo(0, pt), e.lineTo(D, pt), e.stroke();
7044
+ const mt = A - 2;
7045
+ e.beginPath(), e.moveTo(0, mt), e.lineTo(D, mt), e.stroke();
7013
7046
  }
7014
7047
  if (t.textDecoration === "line-through" || t.strikethrough) {
7015
- const pt = A + z / 2;
7016
- e.beginPath(), e.moveTo(0, pt), e.lineTo(D, pt), e.stroke();
7048
+ const mt = A + B / 2;
7049
+ e.beginPath(), e.moveTo(0, mt), e.lineTo(D, mt), e.stroke();
7017
7050
  }
7018
- typeof t.textDecoration == "string" && t.textDecoration.includes(" ") && t.textDecoration.split(" ").forEach((Oe) => {
7019
- switch (Oe.trim()) {
7051
+ typeof t.textDecoration == "string" && t.textDecoration.includes(" ") && t.textDecoration.split(" ").forEach((Be) => {
7052
+ switch (Be.trim()) {
7020
7053
  case "underline":
7021
- const Kt = A + z + 2;
7022
- e.beginPath(), e.moveTo(0, Kt), e.lineTo(D, Kt), e.stroke();
7054
+ const Yt = A + B + 2;
7055
+ e.beginPath(), e.moveTo(0, Yt), e.lineTo(D, Yt), e.stroke();
7023
7056
  break;
7024
7057
  case "overline":
7025
- const Zt = A - 2;
7026
- e.beginPath(), e.moveTo(0, Zt), e.lineTo(D, Zt), e.stroke();
7058
+ const qt = A - 2;
7059
+ e.beginPath(), e.moveTo(0, qt), e.lineTo(D, qt), e.stroke();
7027
7060
  break;
7028
7061
  case "line-through":
7029
- const te = A + z / 2;
7030
- e.beginPath(), e.moveTo(0, te), e.lineTo(D, te), e.stroke();
7062
+ const Vt = A + B / 2;
7063
+ e.beginPath(), e.moveTo(0, Vt), e.lineTo(D, Vt), e.stroke();
7031
7064
  break;
7032
7065
  }
7033
7066
  });
7034
7067
  }), e.restore();
7035
- }, pe = (e, t) => {
7068
+ }, he = (e, t) => {
7036
7069
  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));
7037
- }, we = (e, t) => {
7038
- const r = Math.min(t.width, t.height) / 2, c = t.width / 2, x = t.height / 2;
7039
- e.beginPath(), e.arc(c, 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());
7040
- }, be = (e, t) => {
7070
+ }, ge = (e, t) => {
7071
+ const r = Math.min(t.width, t.height) / 2, c = t.width / 2, g = t.height / 2;
7072
+ 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());
7073
+ }, xe = (e, t) => {
7041
7074
  const r = t.width / 2;
7042
7075
  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());
7043
- }, ve = (e, t) => {
7044
- const r = t.width / 2, c = t.height / 2, x = Math.min(t.width, t.height) / 2, p = x * 0.4, w = t.numPoints || 5;
7076
+ }, ye = (e, t) => {
7077
+ const r = t.width / 2, c = t.height / 2, g = Math.min(t.width, t.height) / 2, m = g * 0.4, w = t.numPoints || 5;
7045
7078
  e.beginPath();
7046
7079
  for (let v = 0; v < w * 2; v++) {
7047
- const b = v % 2 === 0 ? x : p, A = v * Math.PI / w, D = r + Math.cos(A) * b, z = c + Math.sin(A) * b;
7048
- v === 0 ? e.moveTo(D, z) : e.lineTo(D, z);
7080
+ const b = v % 2 === 0 ? g : m, A = v * Math.PI / w, D = r + Math.cos(A) * b, B = c + Math.sin(A) * b;
7081
+ v === 0 ? e.moveTo(D, B) : e.lineTo(D, B);
7049
7082
  }
7050
7083
  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());
7051
- }, ke = (e, t) => {
7052
- const r = t.width, c = t.height, x = r * 0.3;
7053
- e.beginPath(), e.moveTo(r / 2, 0), e.lineTo(r, c * 0.6), e.lineTo(r - x, c * 0.6), e.lineTo(r - x, c), e.lineTo(x, c), e.lineTo(x, 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());
7054
- }, Se = (e, t) => {
7084
+ }, ue = (e, t) => {
7085
+ const r = t.width, c = t.height, g = r * 0.3;
7086
+ 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());
7087
+ }, me = (e, t) => {
7055
7088
  const r = t.width / 2, c = t.height / 2;
7056
7089
  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());
7057
- }, Fe = (e, t) => {
7058
- const r = t.width / 2, c = t.height / 2, x = Math.min(t.width, t.height) / 2, p = 6;
7090
+ }, pe = (e, t) => {
7091
+ const r = t.width / 2, c = t.height / 2, g = Math.min(t.width, t.height) / 2, m = 6;
7059
7092
  e.beginPath();
7060
- for (let w = 0; w < p; w++) {
7061
- const v = w * 2 * Math.PI / p - Math.PI / 2, b = r + x * Math.cos(v), A = c + x * Math.sin(v);
7093
+ for (let w = 0; w < m; w++) {
7094
+ const v = w * 2 * Math.PI / m - Math.PI / 2, b = r + g * Math.cos(v), A = c + g * Math.sin(v);
7062
7095
  w === 0 ? e.moveTo(b, A) : e.lineTo(b, A);
7063
7096
  }
7064
7097
  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());
7065
- }, Ce = (e, t) => {
7066
- const r = t.width / 2, c = t.height / 2, x = Math.min(t.width, t.height) / 2, p = 5;
7098
+ }, we = (e, t) => {
7099
+ const r = t.width / 2, c = t.height / 2, g = Math.min(t.width, t.height) / 2, m = 5;
7067
7100
  e.beginPath();
7068
- for (let w = 0; w < p; w++) {
7069
- const v = w * 2 * Math.PI / p - Math.PI / 2, b = r + x * Math.cos(v), A = c + x * Math.sin(v);
7101
+ for (let w = 0; w < m; w++) {
7102
+ const v = w * 2 * Math.PI / m - Math.PI / 2, b = r + g * Math.cos(v), A = c + g * Math.sin(v);
7070
7103
  w === 0 ? e.moveTo(b, A) : e.lineTo(b, A);
7071
7104
  }
7072
7105
  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());
7073
- }, Te = (e, t) => {
7074
- const r = t.width, c = t.height, x = 0, p = 0;
7106
+ }, be = (e, t) => {
7107
+ const r = t.width, c = t.height, g = 0, m = 0;
7075
7108
  e.beginPath();
7076
7109
  const w = c * 0.3;
7077
- e.moveTo(x + r / 2, p + w), e.bezierCurveTo(
7078
- x + r / 2,
7079
- p,
7080
- x,
7081
- p,
7082
- x,
7083
- p + w
7110
+ e.moveTo(g + r / 2, m + w), e.bezierCurveTo(
7111
+ g + r / 2,
7112
+ m,
7113
+ g,
7114
+ m,
7115
+ g,
7116
+ m + w
7084
7117
  ), e.bezierCurveTo(
7085
- x,
7086
- p + (c + w) / 2,
7087
- x + r / 2,
7088
- p + (c + w) / 2,
7089
- x + r / 2,
7090
- p + c
7118
+ g,
7119
+ m + (c + w) / 2,
7120
+ g + r / 2,
7121
+ m + (c + w) / 2,
7122
+ g + r / 2,
7123
+ m + c
7091
7124
  ), e.bezierCurveTo(
7092
- x + r / 2,
7093
- p + (c + w) / 2,
7094
- x + r,
7095
- p + (c + w) / 2,
7096
- x + r,
7097
- p + w
7125
+ g + r / 2,
7126
+ m + (c + w) / 2,
7127
+ g + r,
7128
+ m + (c + w) / 2,
7129
+ g + r,
7130
+ m + w
7098
7131
  ), e.bezierCurveTo(
7099
- x + r,
7100
- p,
7101
- x + r / 2,
7102
- p,
7103
- x + r / 2,
7104
- p + w
7132
+ g + r,
7133
+ m,
7134
+ g + r / 2,
7135
+ m,
7136
+ g + r / 2,
7137
+ m + w
7105
7138
  ), 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());
7106
- }, je = (e, t) => {
7107
- const r = t.width / 2, c = t.height / 2, x = t.width / 2, p = t.height / 2;
7108
- e.beginPath(), e.ellipse(r, c, x, p, 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());
7109
- }, Ne = (e, t) => {
7139
+ }, ve = (e, t) => {
7140
+ const r = t.width / 2, c = t.height / 2, g = t.width / 2, m = t.height / 2;
7141
+ 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());
7142
+ }, ke = (e, t) => {
7110
7143
  const r = Math.min(t.width, t.height) * 0.1;
7111
- 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());
7112
- }, Ae = (e, t) => {
7144
+ Tt(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());
7145
+ }, Se = (e, t) => {
7113
7146
  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();
7114
- }, Ie = (e, t) => {
7147
+ }, Fe = (e, t) => {
7115
7148
  if (t.imageData)
7116
7149
  try {
7117
7150
  t.imageData.complete && t.imageData.naturalHeight !== 0 ? e.drawImage(t.imageData, 0, 0, t.width, t.height) : (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));
7118
7151
  } catch (r) {
7119
7152
  console.error("Error drawing image:", r), 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);
7120
7153
  }
7121
- }, De = (e, t) => {
7154
+ }, Ce = (e, t) => {
7122
7155
  if (t.src && !t.imageLoading && !t.loadedImage) {
7123
7156
  t.imageLoading = !0;
7124
7157
  const r = new Image();
@@ -7128,7 +7161,7 @@ const fi = $e((f, o) => {
7128
7161
  console.error("Failed to load sticker:", t.src), t.imageLoading = !1, 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.fillText("Failed to load", t.width / 2, t.height / 2);
7129
7162
  }, r.src = t.src;
7130
7163
  } else t.loadedImage ? e.drawImage(t.loadedImage, 0, 0, t.width, t.height) : t.imageLoading && (e.fillStyle = "#f8f9fa", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#dee2e6", e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#6c757d", e.font = "12px Arial", e.textAlign = "center", e.fillText("Loading...", t.width / 2, t.height / 2));
7131
- }, Re = (e, t) => {
7164
+ }, je = (e, t) => {
7132
7165
  if (t.imageObject)
7133
7166
  e.drawImage(t.imageObject, 0, 0, t.width, t.height);
7134
7167
  else if (t.src && !t.imageLoading) {
@@ -7137,49 +7170,49 @@ const fi = $e((f, o) => {
7137
7170
  r.crossOrigin = "anonymous", r.onload = () => {
7138
7171
  t.imageObject = r, t.imageLoading = !1, V();
7139
7172
  }, r.onerror = () => {
7140
- t.imageLoading = !1, console.error("Failed to load embroidery image:", t.src), zt(e, t);
7141
- }, r.src = t.src, zt(e, t, "Loading...");
7173
+ t.imageLoading = !1, console.error("Failed to load embroidery image:", t.src), Dt(e, t);
7174
+ }, r.src = t.src, Dt(e, t, "Loading...");
7142
7175
  } else
7143
- zt(e, t);
7144
- }, zt = (e, t, r = "Embroidery") => {
7176
+ Dt(e, t);
7177
+ }, Dt = (e, t, r = "Embroidery") => {
7145
7178
  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);
7146
- }, $t = (e, t, r) => {
7179
+ }, Lt = (e, t, r) => {
7147
7180
  if (!r) return !1;
7148
- const c = r.x + r.width / 2, x = r.y + r.height / 2, p = e - c, w = t - x, v = -(r.rotation || 0) * Math.PI / 180, b = Math.cos(v), A = Math.sin(v), D = p * b - w * A, z = p * A + w * b, tt = r.width / 2, gt = r.height / 2;
7149
- return D >= -tt && D <= tt && z >= -gt && z <= gt;
7150
- }, Ee = et(() => {
7151
- (N || m || B) && at(), R(!1), E(!1), S(!1), $(null);
7152
- const e = yt.current;
7181
+ const c = r.x + r.width / 2, g = r.y + r.height / 2, m = e - c, w = t - g, v = -(r.rotation || 0) * Math.PI / 180, b = Math.cos(v), A = Math.sin(v), D = m * b - w * A, B = m * A + w * b, et = r.width / 2, gt = r.height / 2;
7182
+ return D >= -et && D <= et && B >= -gt && B <= gt;
7183
+ }, Te = at(() => {
7184
+ (T || u || z) && rt(), R(!1), E(!1), S(!1), Q(null);
7185
+ const e = X.current;
7153
7186
  e && (e.style.cursor = "default");
7154
- }, [N, m, B, at]);
7187
+ }, [T, u, z, rt]);
7155
7188
  it(() => {
7156
7189
  const e = (t) => {
7157
7190
  if (s) return;
7158
7191
  const r = document.activeElement;
7159
- 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(), vt())), (t.key === "Delete" || t.key === "Backspace") && n && (Bt(n.id), t.preventDefault()), (t.ctrlKey || t.metaKey) && t.key === "d" && n && (Gt(n.id), t.preventDefault()), n && ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(t.key))) {
7192
+ if (!(r && (r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.tagName === "SELECT" || r.isContentEditable)) && ((t.ctrlKey || t.metaKey) && (t.key === "z" && !t.shiftKey ? (t.preventDefault(), kt()) : (t.key === "z" && t.shiftKey || t.key === "y") && (t.preventDefault(), wt())), (t.key === "Delete" || t.key === "Backspace") && d && (Et(d.id), t.preventDefault()), (t.ctrlKey || t.metaKey) && t.key === "d" && d && (Ut(d.id), t.preventDefault()), d && ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(t.key))) {
7160
7193
  t.preventDefault();
7161
- const x = t.shiftKey ? 10 : 1;
7162
- let p = {};
7194
+ const g = t.shiftKey ? 10 : 1;
7195
+ let m = {};
7163
7196
  switch (t.key) {
7164
7197
  case "ArrowUp":
7165
- p.y = n.y - x;
7198
+ m.y = d.y - g;
7166
7199
  break;
7167
7200
  case "ArrowDown":
7168
- p.y = n.y + x;
7201
+ m.y = d.y + g;
7169
7202
  break;
7170
7203
  case "ArrowLeft":
7171
- p.x = n.x - x;
7204
+ m.x = d.x - g;
7172
7205
  break;
7173
7206
  case "ArrowRight":
7174
- p.x = n.x + x;
7207
+ m.x = d.x + g;
7175
7208
  break;
7176
7209
  }
7177
- Ht(n.id, p), at();
7210
+ Pt(d.id, m), rt();
7178
7211
  }
7179
7212
  };
7180
7213
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
7181
- }, [n, St, vt, s]);
7182
- const ze = (e, t = {}) => {
7214
+ }, [d, kt, wt, s]);
7215
+ const Ne = (e, t = {}) => {
7183
7216
  const r = {
7184
7217
  id: dt(),
7185
7218
  type: e,
@@ -7204,16 +7237,16 @@ const fi = $e((f, o) => {
7204
7237
  r.id = dt(), r.imageData = t.imageData || null, r.width = t.width || 200, r.height = t.height || 200;
7205
7238
  break;
7206
7239
  case "qrcode":
7207
- r.id = dt(), 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) || M / 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;
7240
+ r.id = dt(), 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;
7208
7241
  break;
7209
7242
  case "barcode":
7210
- r.id = dt(), 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) || M / 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;
7243
+ r.id = dt(), 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;
7211
7244
  break;
7212
7245
  case "sticker":
7213
7246
  r.id = dt(), r.type = "sticker", r.imageData = (t == null ? void 0 : t.imageData) || null, r.width = t.width || 200, r.height = t.height || 200;
7214
7247
  break;
7215
7248
  case "horizontalLine":
7216
- r.id = dt(), r.type = "horizontalLine", r.x = k / 2 - 100, r.y = M / 2 - 1, r.width = 200, r.height = 2, r.fill = "#000000", r.stroke = "#000000", r.strokeWidth = 2, r.rotation = 0, r.opacity = 1;
7249
+ r.id = dt(), 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;
7217
7250
  break;
7218
7251
  case "embroidery":
7219
7252
  r.id = dt(), r.type = "embroidery", r.imageData = (t == null ? void 0 : t.imageData) || null, r.width = t.width || 200, r.height = t.height || 200;
@@ -7234,15 +7267,15 @@ const fi = $e((f, o) => {
7234
7267
  console.warn(`Unknown element type: ${e}`);
7235
7268
  return;
7236
7269
  }
7237
- l((c) => [...c, r]), F(r), at();
7238
- }, Ht = (e, t) => {
7270
+ l((c) => [...c, r]), F(r), rt();
7271
+ }, Pt = (e, t) => {
7239
7272
  l((r) => r.map(
7240
7273
  (c) => c.id === e ? { ...c, ...t } : c
7241
- )), n && n.id === e && F((r) => ({ ...r, ...t }));
7242
- }, Bt = et(() => {
7243
- n && (l((e) => e.filter((t) => t.id !== n.id)), F(null), at());
7244
- }, [n, at]), Gt = (e) => {
7245
- const t = g.find((r) => r.id === e);
7274
+ )), d && d.id === e && F((r) => ({ ...r, ...t }));
7275
+ }, Et = at(() => {
7276
+ d && (l((e) => e.filter((t) => t.id !== d.id)), F(null), rt());
7277
+ }, [d, rt]), Ut = (e) => {
7278
+ const t = x.find((r) => r.id === e);
7246
7279
  if (t) {
7247
7280
  const r = {
7248
7281
  ...t,
@@ -7250,49 +7283,56 @@ const fi = $e((f, o) => {
7250
7283
  x: t.x + 20,
7251
7284
  y: t.y + 20
7252
7285
  };
7253
- l((c) => [...c, r]), F(r), at();
7286
+ l((c) => [...c, r]), F(r), rt();
7254
7287
  }
7255
- }, _t = (e, t) => {
7256
- const r = g.findIndex((p) => p.id === e);
7288
+ }, Ot = (e, t) => {
7289
+ const r = x.findIndex((m) => m.id === e);
7257
7290
  if (r === -1) return;
7258
- const c = [...g], x = c[r];
7259
- t === "up" && r < c.length - 1 ? (c[r] = c[r + 1], c[r + 1] = x) : t === "down" && r > 0 ? (c[r] = c[r - 1], c[r - 1] = x) : t === "top" ? (c.splice(r, 1), c.push(x)) : t === "bottom" && (c.splice(r, 1), c.unshift(x)), l(c), at();
7291
+ const c = [...x], g = c[r];
7292
+ 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)), l(c), rt();
7260
7293
  };
7261
- et(() => {
7262
- u && H((e) => ({
7294
+ at(() => {
7295
+ p && H((e) => ({
7263
7296
  ...e,
7264
- [u.sectionName]: {
7265
- elements: [...g],
7266
- selectedColor: Q
7297
+ [p.sectionName]: {
7298
+ elements: [...x],
7299
+ selectedColor: $
7267
7300
  }
7268
7301
  }));
7269
- }, [u, g, Q]);
7270
- const [, Be] = He((e) => e + 1, 0);
7302
+ }, [p, x, $]);
7303
+ const [, Ae] = Le((e) => e + 1, 0);
7271
7304
  setTimeout(() => {
7272
- Be();
7273
- }, 20), Ge(o, () => ({
7274
- handleSectionChange: Yt,
7305
+ Ae();
7306
+ }, 20), Pe(o, () => ({
7307
+ handleSectionChange: Qt,
7275
7308
  // Export methods that return download-ready data
7276
- exportPrintReady: async (e = "png") => await Et(e, !1),
7277
- exportFullDesign: async (e = "png") => await Et(e, !0),
7309
+ exportPrintReady: async (e = "png") => await Rt(e, !1),
7310
+ exportFullDesign: async (e = "png") => await Rt(e, !0),
7278
7311
  // Access to the existing exportDesign method
7279
- exportDesign: Et,
7312
+ exportDesign: Rt,
7280
7313
  // Get canvas data for custom exports
7281
- getCanvasData: () => wt(),
7314
+ getCanvasData: () => vt(),
7282
7315
  // NEW: Export methods that return JSON with File objects
7283
7316
  exportAllDesignsAsJSON: async (e = "png") => {
7284
7317
  try {
7285
- const t = wt();
7286
- return await Rt.current.exportAllSectionsAsJSON(
7287
- t.sectionDesigns || { [(u == null ? void 0 : u.sectionName) || "main"]: t },
7288
- h.sections || [{
7289
- id: (u == null ? void 0 : u.sectionName) || "main",
7290
- sectionName: (u == null ? void 0 : u.sectionName) || "main",
7291
- image: u == null ? void 0 : u.sectionImage,
7292
- sectionImage: u == null ? void 0 : u.sectionImage
7293
- }],
7318
+ const t = vt(), r = {}, c = (p == null ? void 0 : p.sectionName) || "main";
7319
+ r[c] = {
7320
+ elements: t.elements,
7321
+ selectedColor: t.selectedColor,
7322
+ canvasWidth: t.canvasWidth,
7323
+ canvasHeight: t.canvasHeight
7324
+ }, t.sectionDesigns && typeof t.sectionDesigns == "object" && Object.assign(r, t.sectionDesigns);
7325
+ const g = h.sections && h.sections.length > 0 ? h.sections : [{
7326
+ id: c,
7327
+ sectionName: c,
7328
+ image: p == null ? void 0 : p.sectionImage,
7329
+ sectionImage: p == null ? void 0 : p.sectionImage
7330
+ }];
7331
+ return await It.current.exportAllSectionsAsJSON(
7332
+ r,
7333
+ g,
7294
7334
  k,
7295
- M,
7335
+ W,
7296
7336
  e
7297
7337
  );
7298
7338
  } catch (t) {
@@ -7301,182 +7341,182 @@ const fi = $e((f, o) => {
7301
7341
  },
7302
7342
  exportCurrentSectionAsJSON: async (e = "png") => {
7303
7343
  try {
7304
- const t = wt();
7305
- return await Rt.current.exportCurrentSectionAsJSON(t, e);
7344
+ const t = vt();
7345
+ return await It.current.exportCurrentSectionAsJSON(t, e);
7306
7346
  } catch (t) {
7307
7347
  throw console.error("Export current section as JSON failed:", t), t;
7308
7348
  }
7309
7349
  }
7310
7350
  })), it(() => {
7311
- xt.current = null, ut.current = null;
7312
- const e = yt.current;
7313
- if (e && e.getContext("2d").clearRect(0, 0, k, M), u != null && u.sectionImage) {
7351
+ ft.current = null, yt.current = null;
7352
+ const e = X.current;
7353
+ if (e && e.getContext("2d").clearRect(0, 0, k, W), p != null && p.sectionImage) {
7314
7354
  const t = new Image();
7315
7355
  t.crossOrigin = "anonymous", t.onload = () => {
7316
- t.src === u.sectionImage && (xt.current = t, It(t, Q));
7356
+ t.src === p.sectionImage && (ft.current = t, Nt(t, $));
7317
7357
  }, t.onerror = () => {
7318
- console.error("Failed to load background image:", u.sectionImage), V();
7319
- }, t.src = u.sectionImage;
7358
+ console.error("Failed to load background image:", p.sectionImage), V();
7359
+ }, t.src = p.sectionImage;
7320
7360
  } else
7321
7361
  V();
7322
- }, [u == null ? void 0 : u.sectionImage]);
7323
- const V = et(() => {
7324
- const e = yt.current;
7362
+ }, [p == null ? void 0 : p.sectionImage]);
7363
+ const V = at(() => {
7364
+ const e = X.current;
7325
7365
  if (!e) return;
7326
7366
  const t = e.getContext("2d");
7327
- t.clearRect(0, 0, k, M), ut.current && t.drawImage(ut.current, 0, 0, k, M), P && ge(t), g.forEach((r) => {
7328
- xe(t, r);
7329
- }), n && de(t, n), requestAnimationFrame(V);
7330
- }, [g, n, k, M, P, ut]), Me = et((e) => {
7367
+ t.clearRect(0, 0, k, W), yt.current && t.drawImage(yt.current, 0, 0, k, W), L && le(t), x.forEach((r) => {
7368
+ ne(t, r);
7369
+ }), d && re(t, d), requestAnimationFrame(V);
7370
+ }, [x, d, k, W, L, yt]), Ie = at((e) => {
7331
7371
  if (s) return;
7332
- const r = yt.current.getBoundingClientRect(), c = (e.clientX - r.left) / O, x = (e.clientY - r.top) / O;
7333
- if (J({ x: c, y: x }), n) {
7334
- const w = Qt(c, x, n);
7372
+ const r = X.current.getBoundingClientRect(), c = (e.clientX - r.left) / O, g = (e.clientY - r.top) / O;
7373
+ if (K({ x: c, y: g }), d) {
7374
+ const w = Mt(c, g, d);
7335
7375
  if (w) {
7336
7376
  if (w === "rotate") {
7337
7377
  S(!0);
7338
- const v = n.x + n.width / 2, b = n.y + n.height / 2, A = Math.atan2(x - b, c - v) * 180 / Math.PI;
7339
- J({
7378
+ const v = d.x + d.width / 2, b = d.y + d.height / 2, A = Math.atan2(g - b, c - v) * 180 / Math.PI;
7379
+ K({
7340
7380
  x: c,
7341
- y: x,
7381
+ y: g,
7342
7382
  initialAngle: A,
7343
- initialRotation: n.rotation || 0
7383
+ initialRotation: d.rotation || 0
7344
7384
  });
7345
7385
  } else
7346
- E(!0), $(w), J({
7386
+ E(!0), Q(w), K({
7347
7387
  x: c,
7348
- y: x,
7349
- initialWidth: n.width,
7350
- initialHeight: n.height,
7351
- initialX: n.x,
7352
- initialY: n.y
7388
+ y: g,
7389
+ initialWidth: d.width,
7390
+ initialHeight: d.height,
7391
+ initialX: d.x,
7392
+ initialY: d.y
7353
7393
  });
7354
7394
  return;
7355
7395
  }
7356
7396
  }
7357
- let p = null;
7358
- for (let w = g.length - 1; w >= 0; w--)
7359
- if ($t(c, x, g[w])) {
7360
- p = g[w];
7397
+ let m = null;
7398
+ for (let w = x.length - 1; w >= 0; w--)
7399
+ if (Lt(c, g, x[w])) {
7400
+ m = x[w];
7361
7401
  break;
7362
7402
  }
7363
- p ? (F(p), R(!0), J({
7403
+ m ? (F(m), R(!0), K({
7364
7404
  x: c,
7365
- y: x,
7366
- offsetX: c - p.x,
7367
- offsetY: x - p.y
7405
+ y: g,
7406
+ offsetX: c - m.x,
7407
+ offsetY: g - m.y
7368
7408
  })) : F(null), V();
7369
- }, [s, O, n, g, V]), We = et((e) => {
7409
+ }, [s, O, d, x, V]), Re = at((e) => {
7370
7410
  if (s) return;
7371
- const t = yt.current, r = t.getBoundingClientRect(), c = (e.clientX - r.left) / O, x = (e.clientY - r.top) / O;
7372
- if (n && !N && !m && !B) {
7373
- const p = Qt(c, x, n);
7374
- p ? p === "rotate" ? t.style.cursor = "grab" : t.style.cursor = p : $t(c, x, n) ? t.style.cursor = "move" : t.style.cursor = "default";
7411
+ const t = X.current, r = t.getBoundingClientRect(), c = (e.clientX - r.left) / O, g = (e.clientY - r.top) / O;
7412
+ if (d && !T && !u && !z) {
7413
+ const m = Mt(c, g, d);
7414
+ m ? m === "rotate" ? t.style.cursor = "grab" : t.style.cursor = m : Lt(c, g, d) ? t.style.cursor = "move" : t.style.cursor = "default";
7375
7415
  } else
7376
- t.style.cursor = N ? "grabbing" : "default";
7377
- if (B && n) {
7378
- const p = n.x + n.width / 2, w = n.y + n.height / 2, b = Math.atan2(x - w, c - p) * 180 / Math.PI - T.initialAngle;
7379
- let A = T.initialRotation + b;
7416
+ t.style.cursor = T ? "grabbing" : "default";
7417
+ if (z && d) {
7418
+ const m = d.x + d.width / 2, w = d.y + d.height / 2, b = Math.atan2(g - w, c - m) * 180 / Math.PI - j.initialAngle;
7419
+ let A = j.initialRotation + b;
7380
7420
  e.shiftKey && (A = Math.round(A / 15) * 15), A = (A % 360 + 360) % 360, l(
7381
7421
  (D) => D.map(
7382
- (z) => z.id === n.id ? { ...z, rotation: A } : z
7422
+ (B) => B.id === d.id ? { ...B, rotation: A } : B
7383
7423
  )
7384
7424
  ), F((D) => ({ ...D, rotation: A })), V();
7385
7425
  return;
7386
7426
  }
7387
- if (m && n && C) {
7388
- const p = c - T.x, w = x - T.y;
7389
- let v = T.initialWidth, b = T.initialHeight, A = T.initialX, D = T.initialY;
7427
+ if (u && d && C) {
7428
+ const m = c - j.x, w = g - j.y;
7429
+ let v = j.initialWidth, b = j.initialHeight, A = j.initialX, D = j.initialY;
7390
7430
  switch (C) {
7391
7431
  case "se-resize":
7392
- v = Math.max(20, T.initialWidth + p), b = Math.max(20, T.initialHeight + w);
7432
+ v = Math.max(20, j.initialWidth + m), b = Math.max(20, j.initialHeight + w);
7393
7433
  break;
7394
7434
  case "sw-resize":
7395
- v = Math.max(20, T.initialWidth - p), b = Math.max(20, T.initialHeight + w), A = T.initialX + (T.initialWidth - v);
7435
+ v = Math.max(20, j.initialWidth - m), b = Math.max(20, j.initialHeight + w), A = j.initialX + (j.initialWidth - v);
7396
7436
  break;
7397
7437
  case "ne-resize":
7398
- v = Math.max(20, T.initialWidth + p), b = Math.max(20, T.initialHeight - w), D = T.initialY + (T.initialHeight - b);
7438
+ v = Math.max(20, j.initialWidth + m), b = Math.max(20, j.initialHeight - w), D = j.initialY + (j.initialHeight - b);
7399
7439
  break;
7400
7440
  case "nw-resize":
7401
- v = Math.max(20, T.initialWidth - p), b = Math.max(20, T.initialHeight - w), A = T.initialX + (T.initialWidth - v), D = T.initialY + (T.initialHeight - b);
7441
+ v = Math.max(20, j.initialWidth - m), b = Math.max(20, j.initialHeight - w), A = j.initialX + (j.initialWidth - v), D = j.initialY + (j.initialHeight - b);
7402
7442
  break;
7403
7443
  }
7404
- if (e.shiftKey && n.type !== "text") {
7405
- const tt = T.initialWidth / T.initialHeight;
7406
- C.includes("e"), b = v / tt, C.includes("n") && (D = T.initialY + (T.initialHeight - b));
7444
+ if (e.shiftKey && d.type !== "text") {
7445
+ const et = j.initialWidth / j.initialHeight;
7446
+ C.includes("e"), b = v / et, C.includes("n") && (D = j.initialY + (j.initialHeight - b));
7407
7447
  }
7408
- _ && (A = mt(A), D = mt(D), v = mt(v), b = mt(b));
7409
- const z = {
7410
- ...n,
7448
+ _ && (A = ut(A), D = ut(D), v = ut(v), b = ut(b));
7449
+ const B = {
7450
+ ...d,
7411
7451
  x: A,
7412
7452
  y: D,
7413
7453
  width: v,
7414
7454
  height: b
7415
7455
  };
7416
7456
  l(
7417
- (tt) => tt.map(
7418
- (gt) => gt.id === n.id ? z : gt
7457
+ (et) => et.map(
7458
+ (gt) => gt.id === d.id ? B : gt
7419
7459
  )
7420
- ), F(z), V();
7460
+ ), F(B), V();
7421
7461
  return;
7422
7462
  }
7423
- if (N && n) {
7424
- let p = c - T.offsetX, w = x - T.offsetY;
7425
- _ && (p = mt(p), w = mt(w)), p = Math.max(0, Math.min(k - n.width, p)), w = Math.max(0, Math.min(M - n.height, w));
7463
+ if (T && d) {
7464
+ let m = c - j.offsetX, w = g - j.offsetY;
7465
+ _ && (m = ut(m), w = ut(w)), m = Math.max(0, Math.min(k - d.width, m)), w = Math.max(0, Math.min(W - d.height, w));
7426
7466
  const v = {
7427
- ...n,
7428
- x: p,
7467
+ ...d,
7468
+ x: m,
7429
7469
  y: w
7430
7470
  };
7431
7471
  l(
7432
7472
  (b) => b.map(
7433
- (A) => A.id === n.id ? v : A
7473
+ (A) => A.id === d.id ? v : A
7434
7474
  )
7435
7475
  ), F(v), V();
7436
7476
  }
7437
- }, [s, O, n, N, m, B, C, T, _, k, M, g, V]), Yt = et((e) => {
7438
- u && H((r) => ({
7477
+ }, [s, O, d, T, u, z, C, j, _, k, W, x, V]), Qt = at((e) => {
7478
+ p && H((r) => ({
7439
7479
  ...r,
7440
- [u.sectionName]: {
7441
- elements: g.map((c) => c.type === "image" ? {
7480
+ [p.sectionName]: {
7481
+ elements: x.map((c) => c.type === "image" ? {
7442
7482
  ...c,
7443
7483
  // Keep the image data reference
7444
7484
  imageData: c.imageData,
7445
7485
  src: c.src
7446
7486
  } : c),
7447
- selectedColor: Q
7487
+ selectedColor: $
7448
7488
  }
7449
7489
  }));
7450
- const t = W[e.sectionName];
7490
+ const t = M[e.sectionName];
7451
7491
  if (t) {
7452
7492
  const r = t.elements.map((c) => {
7453
7493
  if (c.type === "image" && c.src && !c.imageData) {
7454
- const x = new Image();
7455
- return x.onload = () => {
7494
+ const g = new Image();
7495
+ return g.onload = () => {
7456
7496
  l(
7457
- (p) => p.map(
7458
- (w) => w.id === c.id ? { ...w, imageData: x } : w
7497
+ (m) => m.map(
7498
+ (w) => w.id === c.id ? { ...w, imageData: g } : w
7459
7499
  )
7460
7500
  ), V();
7461
- }, x.src = c.src, { ...c, imageData: x };
7501
+ }, g.src = c.src, { ...c, imageData: g };
7462
7502
  }
7463
7503
  return c;
7464
7504
  });
7465
- l(r), rt(t.selectedColor || Q);
7505
+ l(r), ot(t.selectedColor || $);
7466
7506
  } else
7467
7507
  l([]);
7468
- K(e), F(null);
7469
- }, [u, g, Q, W, V]), Le = et((e) => {
7508
+ Z(e), F(null);
7509
+ }, [p, x, $, M, V]), De = at((e) => {
7470
7510
  if (e && e.type.startsWith("image/")) {
7471
7511
  const t = new FileReader();
7472
7512
  t.onload = (r) => {
7473
7513
  const c = new Image();
7474
7514
  c.onload = () => {
7475
- const x = {
7515
+ const g = {
7476
7516
  id: dt(),
7477
7517
  type: "image",
7478
- x: mt(k / 2 - 100),
7479
- y: mt(M / 2 - 100),
7518
+ x: ut(k / 2 - 100),
7519
+ y: ut(W / 2 - 100),
7480
7520
  width: Math.min(c.width, 200),
7481
7521
  // Limit initial size
7482
7522
  height: Math.min(c.height, 200),
@@ -7485,8 +7525,8 @@ const fi = $e((f, o) => {
7485
7525
  src: r.target.result,
7486
7526
  originalWidth: c.width,
7487
7527
  originalHeight: c.height
7488
- }, p = c.width / c.height;
7489
- x.width / x.height !== p && (x.width / p <= 200 ? x.height = x.width / p : x.width = x.height * p), l((w) => [...w, x]), F(x), at();
7528
+ }, m = c.width / c.height;
7529
+ g.width / g.height !== m && (g.width / m <= 200 ? g.height = g.width / m : g.width = g.height * m), l((w) => [...w, g]), F(g), rt();
7490
7530
  }, c.onerror = () => {
7491
7531
  console.error("Failed to load uploaded image"), alert("Failed to load the uploaded image. Please try again.");
7492
7532
  }, c.src = r.target.result;
@@ -7495,70 +7535,70 @@ const fi = $e((f, o) => {
7495
7535
  }, t.readAsDataURL(e);
7496
7536
  } else
7497
7537
  alert("Please select a valid image file.");
7498
- }, [k, M, mt, dt, at]);
7538
+ }, [k, W, ut, dt, rt]);
7499
7539
  it(() => {
7500
- if (u != null && u.sectionImage) {
7501
- console.log("Loading new section image:", u.sectionImage), bt.current = !0, xt.current = null, ut.current = null;
7540
+ if (p != null && p.sectionImage) {
7541
+ pt.current = !0, ft.current = null, yt.current = null;
7502
7542
  const e = new Image();
7503
7543
  e.crossOrigin = "anonymous", e.onload = () => {
7504
- console.log("Background image loaded successfully"), xt.current = e, It(e, Q);
7544
+ ft.current = e, Nt(e, $);
7505
7545
  }, e.onerror = () => {
7506
- console.error("Failed to load background image:", u.sectionImage), bt.current = !1, V();
7507
- }, e.src = u.sectionImage;
7546
+ console.error("Failed to load background image:", p.sectionImage), pt.current = !1, V();
7547
+ }, e.src = p.sectionImage;
7508
7548
  } else
7509
- xt.current = null, ut.current = null, bt.current = !1, V();
7510
- }, [u == null ? void 0 : u.sectionImage, Q]);
7511
- const qt = et(
7512
- Pe(() => {
7549
+ ft.current = null, yt.current = null, pt.current = !1, V();
7550
+ }, [p == null ? void 0 : p.sectionImage, $]);
7551
+ const $t = at(
7552
+ Ee(() => {
7513
7553
  V();
7514
7554
  }, 16),
7515
7555
  // 60fps limit
7516
7556
  [V]
7517
7557
  );
7518
7558
  it(() => {
7519
- bt.current || qt();
7520
- }, [g, n, P, qt]);
7521
- function Pe(e, t) {
7559
+ pt.current || $t();
7560
+ }, [x, d, L, $t]);
7561
+ function Ee(e, t) {
7522
7562
  let r;
7523
- return function(...x) {
7524
- const p = () => {
7525
- clearTimeout(r), e(...x);
7563
+ return function(...g) {
7564
+ const m = () => {
7565
+ clearTimeout(r), e(...g);
7526
7566
  };
7527
- clearTimeout(r), r = setTimeout(p, t);
7567
+ clearTimeout(r), r = setTimeout(m, t);
7528
7568
  };
7529
7569
  }
7530
7570
  it(() => {
7531
- xt.current && It(xt.current, Q);
7532
- }, [Q]), it(() => {
7571
+ ft.current && Nt(ft.current, $);
7572
+ }, [$]), it(() => {
7533
7573
  V();
7534
7574
  }, [V]);
7535
- const Ue = (e, t, r) => (0.2126 * e + 0.7152 * t + 0.0722 * r) / 255, It = et((e, t) => {
7536
- const r = Pt.current, c = r.getContext("2d");
7537
- r.width = k, r.height = M, c.clearRect(0, 0, k, M), c.drawImage(e, 0, 0, k, M);
7538
- const x = c.getImageData(0, 0, k, M), p = x.data, w = he(t);
7575
+ const ze = (e, t, r) => (0.2126 * e + 0.7152 * t + 0.0722 * r) / 255, Nt = at((e, t) => {
7576
+ const r = Bt.current, c = r.getContext("2d");
7577
+ r.width = k, r.height = W, c.clearRect(0, 0, k, W), c.drawImage(e, 0, 0, k, W);
7578
+ const g = c.getImageData(0, 0, k, W), m = g.data, w = se(t);
7539
7579
  if (!w) {
7540
- bt.current = !1;
7580
+ pt.current = !1;
7541
7581
  return;
7542
7582
  }
7543
7583
  const { r: v, g: b, b: A } = w;
7544
- for (let z = 0; z < p.length; z += 4) {
7545
- if (p[z + 3] === 0) continue;
7546
- const gt = Ue(p[z], p[z + 1], p[z + 2]);
7547
- p[z] = Math.round(v * gt), p[z + 1] = Math.round(b * gt), p[z + 2] = Math.round(A * gt);
7584
+ for (let B = 0; B < m.length; B += 4) {
7585
+ if (m[B + 3] === 0) continue;
7586
+ const gt = ze(m[B], m[B + 1], m[B + 2]);
7587
+ m[B] = Math.round(v * gt), m[B + 1] = Math.round(b * gt), m[B + 2] = Math.round(A * gt);
7548
7588
  }
7549
- c.putImageData(x, 0, 0);
7589
+ c.putImageData(g, 0, 0);
7550
7590
  const D = new Image();
7551
7591
  D.onload = () => {
7552
- ut.current = D, bt.current = !1, V();
7592
+ yt.current = D, pt.current = !1, V();
7553
7593
  }, D.src = r.toDataURL("image/png");
7554
- }, [k, M, V]), Vt = (e) => {
7555
- if (!X) return { horizontal: [], vertical: [] };
7594
+ }, [k, W, V]), Ht = (e) => {
7595
+ if (!J) return { horizontal: [], vertical: [] };
7556
7596
  const t = document.querySelector(".ruler-horizontal"), r = document.querySelector(".ruler-vertical");
7557
7597
  if (!t || !r)
7558
7598
  return { horizontal: [], vertical: [] };
7559
- const c = t.getBoundingClientRect(), x = r.getBoundingClientRect(), p = c.width, w = x.height, v = 50, b = [], A = [];
7560
- for (let D = v; D <= p; D += v)
7561
- D <= p - 20 && b.push({
7599
+ const c = t.getBoundingClientRect(), g = r.getBoundingClientRect(), m = c.width, w = g.height, v = 50, b = [], A = [];
7600
+ for (let D = v; D <= m; D += v)
7601
+ D <= m - 20 && b.push({
7562
7602
  position: D,
7563
7603
  value: Math.round(D / e)
7564
7604
  });
@@ -7568,12 +7608,12 @@ const fi = $e((f, o) => {
7568
7608
  value: Math.round(D / e)
7569
7609
  });
7570
7610
  return { horizontal: b, vertical: A };
7571
- }, [Xt, Jt] = j({ horizontal: [], vertical: [] });
7611
+ }, [Gt, _t] = N({ horizontal: [], vertical: [] });
7572
7612
  return it(() => {
7573
7613
  const e = () => {
7574
7614
  setTimeout(() => {
7575
- const c = Vt(O);
7576
- Jt(c);
7615
+ const c = Ht(O);
7616
+ _t(c);
7577
7617
  }, 50);
7578
7618
  };
7579
7619
  e();
@@ -7584,33 +7624,33 @@ const fi = $e((f, o) => {
7584
7624
  return window.addEventListener("resize", r), () => {
7585
7625
  window.removeEventListener("resize", r), clearTimeout(t);
7586
7626
  };
7587
- }, [O, X]), it(() => {
7588
- if (X && !y) {
7627
+ }, [O, J]), it(() => {
7628
+ if (J && !y) {
7589
7629
  const e = setTimeout(() => {
7590
- const t = Vt(O);
7591
- Jt(t);
7630
+ const t = Ht(O);
7631
+ _t(t);
7592
7632
  }, 100);
7593
7633
  return () => clearTimeout(e);
7594
7634
  }
7595
- }, [X, y, O]), /* @__PURE__ */ i.jsxs("div", { className: "pure-canvas-designer", children: [
7635
+ }, [J, y, O]), /* @__PURE__ */ i.jsxs("div", { className: "pure-canvas-designer", children: [
7596
7636
  /* @__PURE__ */ i.jsx("div", { className: "designer-header", children: /* @__PURE__ */ i.jsx(
7597
- si,
7637
+ ti,
7598
7638
  {
7599
- onAddElement: ze,
7600
- onDeleteElement: () => n && Bt(n.id),
7601
- onDuplicateElement: () => n && Gt(n.id),
7602
- onUndo: St,
7603
- onRedo: vt,
7604
- onToggleGrid: () => lt(!P),
7605
- onToggleRulers: () => nt(!X),
7606
- onToggleSnap: () => U(!_),
7607
- onImageUpload: Le,
7639
+ onAddElement: Ne,
7640
+ onDeleteElement: () => d && Et(d.id),
7641
+ onDuplicateElement: () => d && Ut(d.id),
7642
+ onUndo: kt,
7643
+ onRedo: wt,
7644
+ onToggleGrid: () => lt(!L),
7645
+ onToggleRulers: () => nt(!J),
7646
+ onToggleSnap: () => P(!_),
7647
+ onImageUpload: De,
7608
7648
  canUndo: q > 0,
7609
7649
  canRedo: q < G.length - 1,
7610
- showGrid: P,
7611
- showRulers: X,
7650
+ showGrid: L,
7651
+ showRulers: J,
7612
7652
  snapToGrid: _,
7613
- selectedElement: n,
7653
+ selectedElement: d,
7614
7654
  theme: a,
7615
7655
  readOnly: s,
7616
7656
  apiKey: f.apiKey,
@@ -7618,8 +7658,8 @@ const fi = $e((f, o) => {
7618
7658
  }
7619
7659
  ) }),
7620
7660
  /* @__PURE__ */ i.jsxs("div", { className: "designer-content", children: [
7621
- X && !y && /* @__PURE__ */ i.jsxs("div", { className: "rulers", children: [
7622
- /* @__PURE__ */ i.jsx("div", { className: "ruler-horizontal", children: /* @__PURE__ */ i.jsx("div", { className: "ruler-horizontal-numbers", children: Xt.horizontal.map((e, t) => /* @__PURE__ */ i.jsx(
7661
+ J && !y && /* @__PURE__ */ i.jsxs("div", { className: "rulers", children: [
7662
+ /* @__PURE__ */ i.jsx("div", { className: "ruler-horizontal", children: /* @__PURE__ */ i.jsx("div", { className: "ruler-horizontal-numbers", children: Gt.horizontal.map((e, t) => /* @__PURE__ */ i.jsx(
7623
7663
  "span",
7624
7664
  {
7625
7665
  className: "ruler-number horizontal",
@@ -7628,7 +7668,7 @@ const fi = $e((f, o) => {
7628
7668
  },
7629
7669
  t
7630
7670
  )) }) }),
7631
- /* @__PURE__ */ i.jsx("div", { className: "ruler-vertical", children: /* @__PURE__ */ i.jsx("div", { className: "ruler-vertical-numbers", children: Xt.vertical.map((e, t) => /* @__PURE__ */ i.jsx(
7671
+ /* @__PURE__ */ i.jsx("div", { className: "ruler-vertical", children: /* @__PURE__ */ i.jsx("div", { className: "ruler-vertical-numbers", children: Gt.vertical.map((e, t) => /* @__PURE__ */ i.jsx(
7632
7672
  "span",
7633
7673
  {
7634
7674
  className: "ruler-number vertical",
@@ -7638,18 +7678,18 @@ const fi = $e((f, o) => {
7638
7678
  t
7639
7679
  )) }) })
7640
7680
  ] }),
7641
- /* @__PURE__ */ i.jsx("div", { className: "canvas-container", ref: ne, children: /* @__PURE__ */ i.jsx(
7681
+ /* @__PURE__ */ i.jsx("div", { className: "canvas-container", ref: bt, children: /* @__PURE__ */ i.jsx(
7642
7682
  "canvas",
7643
7683
  {
7644
- ref: yt,
7684
+ ref: X,
7645
7685
  width: k,
7646
- height: M,
7647
- onMouseDown: Me,
7648
- onMouseMove: We,
7649
- onMouseUp: Ee,
7686
+ height: W,
7687
+ onMouseDown: Ie,
7688
+ onMouseMove: Re,
7689
+ onMouseUp: Te,
7650
7690
  style: {
7651
7691
  border: "1px solid #e2e8f0",
7652
- cursor: N ? "grabbing" : "default",
7692
+ cursor: T ? "grabbing" : "default",
7653
7693
  transform: `scale(${O})`,
7654
7694
  transformOrigin: "top left"
7655
7695
  }
@@ -7657,23 +7697,23 @@ const fi = $e((f, o) => {
7657
7697
  ) }),
7658
7698
  /* @__PURE__ */ i.jsxs("div", { className: "side-panels", children: [
7659
7699
  /* @__PURE__ */ i.jsx(
7660
- li,
7700
+ ei,
7661
7701
  {
7662
- selectedElement: n,
7663
- onUpdate: Ht,
7664
- onMoveLayer: _t,
7665
- availableFonts: ce,
7702
+ selectedElement: d,
7703
+ onUpdate: Pt,
7704
+ onMoveLayer: Ot,
7705
+ availableFonts: oe,
7666
7706
  theme: a
7667
7707
  }
7668
7708
  ),
7669
7709
  /* @__PURE__ */ i.jsx(
7670
- ni,
7710
+ ii,
7671
7711
  {
7672
- elements: g,
7673
- selectedElement: n,
7712
+ elements: x,
7713
+ selectedElement: d,
7674
7714
  onSelectElement: F,
7675
- onMoveLayer: _t,
7676
- onDeleteElement: Bt,
7715
+ onMoveLayer: Ot,
7716
+ onDeleteElement: Et,
7677
7717
  theme: a
7678
7718
  }
7679
7719
  )
@@ -7686,15 +7726,15 @@ const fi = $e((f, o) => {
7686
7726
  /* @__PURE__ */ i.jsx("u", { children: h.name })
7687
7727
  ] }),
7688
7728
  /* @__PURE__ */ i.jsx("div", { className: "thumbnails-container", children: h.sections.map((e) => {
7689
- const t = W[e.sectionName] && W[e.sectionName].elements && W[e.sectionName].elements.length > 0;
7729
+ const t = M[e.sectionName] && M[e.sectionName].elements && M[e.sectionName].elements.length > 0;
7690
7730
  return /* @__PURE__ */ i.jsxs(
7691
7731
  "div",
7692
7732
  {
7693
- className: `section-thumbnail compact ${u.sectionName === e.sectionName ? "active" : ""}`,
7733
+ className: `section-thumbnail compact ${p.sectionName === e.sectionName ? "active" : ""}`,
7694
7734
  onClick: (r) => {
7695
7735
  r.stopPropagation();
7696
- const c = h.sections.find((x) => x.sectionName === e.sectionName);
7697
- Yt(c);
7736
+ const c = h.sections.find((g) => g.sectionName === e.sectionName);
7737
+ Qt(c);
7698
7738
  },
7699
7739
  title: e.sectionName,
7700
7740
  children: [
@@ -7726,9 +7766,9 @@ const fi = $e((f, o) => {
7726
7766
  h.colorSettings.slice(0, 3).map((e, t) => /* @__PURE__ */ i.jsxs(
7727
7767
  "div",
7728
7768
  {
7729
- className: `color-swatch-enhanced compact ${Q === e ? "active" : ""}`,
7769
+ className: `color-swatch-enhanced compact ${$ === e ? "active" : ""}`,
7730
7770
  onClick: (r) => {
7731
- r.stopPropagation(), rt(e);
7771
+ r.stopPropagation(), ot(e);
7732
7772
  },
7733
7773
  title: `Change product to ${e}`,
7734
7774
  children: [
@@ -7739,7 +7779,7 @@ const fi = $e((f, o) => {
7739
7779
  style: { backgroundColor: e }
7740
7780
  }
7741
7781
  ),
7742
- Q === e && /* @__PURE__ */ i.jsx("div", { className: "color-selection-ring compact" })
7782
+ $ === e && /* @__PURE__ */ i.jsx("div", { className: "color-selection-ring compact" })
7743
7783
  ]
7744
7784
  },
7745
7785
  e
@@ -7765,9 +7805,9 @@ const fi = $e((f, o) => {
7765
7805
  /* @__PURE__ */ i.jsx("div", { className: "color-dropdown-menu", style: { display: "none" }, children: h.colorSettings.slice(3).map((e, t) => /* @__PURE__ */ i.jsxs(
7766
7806
  "div",
7767
7807
  {
7768
- className: `color-swatch-dropdown ${Q === e ? "active" : ""}`,
7808
+ className: `color-swatch-dropdown ${$ === e ? "active" : ""}`,
7769
7809
  onClick: (r) => {
7770
- r.stopPropagation(), rt(e), r.currentTarget.parentElement.style.display = "none";
7810
+ r.stopPropagation(), ot(e), r.currentTarget.parentElement.style.display = "none";
7771
7811
  },
7772
7812
  title: `Change product to ${e}`,
7773
7813
  children: [
@@ -7854,7 +7894,7 @@ const fi = $e((f, o) => {
7854
7894
  ] })
7855
7895
  ] });
7856
7896
  });
7857
- fi.displayName = "Mypixia";
7897
+ ai.displayName = "Mypixia";
7858
7898
  export {
7859
- fi as default
7899
+ ai as default
7860
7900
  };