@mypixia/simplex-designer 2.1.0 → 2.1.2

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 Ge, { useState as N, useRef as dt, useEffect as et, useMemo as re, forwardRef as _e, useCallback as ot, useReducer as Ye, useImperativeHandle as qe } from "react";
2
- import Ve from "qrcode";
3
- import Xe from "react-barcode";
4
- import ae from "axios";
5
- import './index_external.css';var Rt = { exports: {} }, Tt = {};
1
+ import _e, { useState as N, useRef as dt, useEffect as et, useMemo as ae, forwardRef as Ye, useCallback as ot, useReducer as qe, useImperativeHandle as Ve } from "react";
2
+ import Xe from "qrcode";
3
+ import Je from "react-barcode";
4
+ import se from "axios";
5
+ import './index_external.css';var Dt = { exports: {} }, Tt = {};
6
6
  /**
7
7
  * @license React
8
8
  * react-jsx-runtime.production.js
@@ -12,10 +12,10 @@ import './index_external.css';var Rt = { exports: {} }, Tt = {};
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 se;
16
- function Je() {
17
- if (se) return Tt;
18
- se = 1;
15
+ var le;
16
+ function Ke() {
17
+ if (le) return Tt;
18
+ le = 1;
19
19
  var d = Symbol.for("react.transitional.element"), o = Symbol.for("react.fragment");
20
20
  function a(l, s, f) {
21
21
  var x = null;
@@ -44,15 +44,15 @@ var jt = {};
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 le;
48
- function Ke() {
49
- return le || (le = 1, process.env.NODE_ENV !== "production" && function() {
50
- function d(m) {
51
- if (m == null) return null;
52
- if (typeof m == "function")
53
- return m.$$typeof === rt ? null : m.displayName || m.name || null;
54
- if (typeof m == "string") return m;
55
- switch (m) {
47
+ var ne;
48
+ function Ze() {
49
+ return ne || (ne = 1, process.env.NODE_ENV !== "production" && function() {
50
+ function d(u) {
51
+ if (u == null) return null;
52
+ if (typeof u == "function")
53
+ return u.$$typeof === rt ? null : u.displayName || u.name || null;
54
+ if (typeof u == "string") return u;
55
+ switch (u) {
56
56
  case w:
57
57
  return "Fragment";
58
58
  case E:
@@ -66,126 +66,126 @@ function Ke() {
66
66
  case q:
67
67
  return "Activity";
68
68
  }
69
- if (typeof m == "object")
70
- switch (typeof m.tag == "number" && console.error(
69
+ if (typeof u == "object")
70
+ switch (typeof u.tag == "number" && console.error(
71
71
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
72
- ), m.$$typeof) {
72
+ ), u.$$typeof) {
73
73
  case T:
74
74
  return "Portal";
75
75
  case $:
76
- return (m.displayName || "Context") + ".Provider";
76
+ return (u.displayName || "Context") + ".Provider";
77
77
  case S:
78
- return (m._context.displayName || "Context") + ".Consumer";
78
+ return (u._context.displayName || "Context") + ".Consumer";
79
79
  case B:
80
- var A = m.render;
81
- return m = m.displayName, m || (m = A.displayName || A.name || "", m = m !== "" ? "ForwardRef(" + m + ")" : "ForwardRef"), m;
80
+ var A = u.render;
81
+ return u = u.displayName, u || (u = A.displayName || A.name || "", u = u !== "" ? "ForwardRef(" + u + ")" : "ForwardRef"), u;
82
82
  case U:
83
- return A = m.displayName || null, A !== null ? A : d(m.type) || "Memo";
83
+ return A = u.displayName || null, A !== null ? A : d(u.type) || "Memo";
84
84
  case ft:
85
- A = m._payload, m = m._init;
85
+ A = u._payload, u = u._init;
86
86
  try {
87
- return d(m(A));
87
+ return d(u(A));
88
88
  } catch {
89
89
  }
90
90
  }
91
91
  return null;
92
92
  }
93
- function o(m) {
94
- return "" + m;
93
+ function o(u) {
94
+ return "" + u;
95
95
  }
96
- function a(m) {
96
+ function a(u) {
97
97
  try {
98
- o(m);
98
+ o(u);
99
99
  var A = !1;
100
100
  } catch {
101
101
  A = !0;
102
102
  }
103
103
  if (A) {
104
104
  A = console;
105
- var Q = A.error, _ = typeof Symbol == "function" && Symbol.toStringTag && m[Symbol.toStringTag] || m.constructor.name || "Object";
105
+ var Q = A.error, _ = typeof Symbol == "function" && Symbol.toStringTag && u[Symbol.toStringTag] || u.constructor.name || "Object";
106
106
  return Q.call(
107
107
  A,
108
108
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
109
109
  _
110
- ), o(m);
110
+ ), o(u);
111
111
  }
112
112
  }
113
- function l(m) {
114
- if (m === w) return "<>";
115
- if (typeof m == "object" && m !== null && m.$$typeof === ft)
113
+ function l(u) {
114
+ if (u === w) return "<>";
115
+ if (typeof u == "object" && u !== null && u.$$typeof === ft)
116
116
  return "<...>";
117
117
  try {
118
- var A = d(m);
118
+ var A = d(u);
119
119
  return A ? "<" + A + ">" : "<...>";
120
120
  } catch {
121
121
  return "<...>";
122
122
  }
123
123
  }
124
124
  function s() {
125
- var m = Y.A;
126
- return m === null ? null : m.getOwner();
125
+ var u = Y.A;
126
+ return u === null ? null : u.getOwner();
127
127
  }
128
128
  function f() {
129
129
  return Error("react-stack-top-frame");
130
130
  }
131
- function x(m) {
132
- if (O.call(m, "key")) {
133
- var A = Object.getOwnPropertyDescriptor(m, "key").get;
131
+ function x(u) {
132
+ if (O.call(u, "key")) {
133
+ var A = Object.getOwnPropertyDescriptor(u, "key").get;
134
134
  if (A && A.isReactWarning) return !1;
135
135
  }
136
- return m.key !== void 0;
136
+ return u.key !== void 0;
137
137
  }
138
- function c(m, A) {
138
+ function c(u, A) {
139
139
  function Q() {
140
140
  K || (K = !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
  A
143
143
  ));
144
144
  }
145
- Q.isReactWarning = !0, Object.defineProperty(m, "key", {
145
+ Q.isReactWarning = !0, Object.defineProperty(u, "key", {
146
146
  get: Q,
147
147
  configurable: !0
148
148
  });
149
149
  }
150
150
  function y() {
151
- var m = d(this.type);
152
- return it[m] || (it[m] = !0, console.error(
151
+ var u = d(this.type);
152
+ return it[u] || (it[u] = !0, console.error(
153
153
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
154
- )), m = this.props.ref, m !== void 0 ? m : null;
154
+ )), u = this.props.ref, u !== void 0 ? u : null;
155
155
  }
156
- function g(m, A, Q, _, Z, V, ht, H) {
157
- return Q = V.ref, m = {
156
+ function g(u, A, Q, _, Z, V, ht, H) {
157
+ return Q = V.ref, u = {
158
158
  $$typeof: I,
159
- type: m,
159
+ type: u,
160
160
  key: A,
161
161
  props: V,
162
162
  _owner: Z
163
- }, (Q !== void 0 ? Q : null) !== null ? Object.defineProperty(m, "ref", {
163
+ }, (Q !== void 0 ? Q : null) !== null ? Object.defineProperty(u, "ref", {
164
164
  enumerable: !1,
165
165
  get: y
166
- }) : Object.defineProperty(m, "ref", { enumerable: !1, value: null }), m._store = {}, Object.defineProperty(m._store, "validated", {
166
+ }) : Object.defineProperty(u, "ref", { enumerable: !1, value: null }), u._store = {}, Object.defineProperty(u._store, "validated", {
167
167
  configurable: !1,
168
168
  enumerable: !1,
169
169
  writable: !0,
170
170
  value: 0
171
- }), Object.defineProperty(m, "_debugInfo", {
171
+ }), Object.defineProperty(u, "_debugInfo", {
172
172
  configurable: !1,
173
173
  enumerable: !1,
174
174
  writable: !0,
175
175
  value: null
176
- }), Object.defineProperty(m, "_debugStack", {
176
+ }), Object.defineProperty(u, "_debugStack", {
177
177
  configurable: !1,
178
178
  enumerable: !1,
179
179
  writable: !0,
180
180
  value: ht
181
- }), Object.defineProperty(m, "_debugTask", {
181
+ }), Object.defineProperty(u, "_debugTask", {
182
182
  configurable: !1,
183
183
  enumerable: !1,
184
184
  writable: !0,
185
185
  value: H
186
- }), Object.freeze && (Object.freeze(m.props), Object.freeze(m)), m;
186
+ }), Object.freeze && (Object.freeze(u.props), Object.freeze(u)), u;
187
187
  }
188
- function F(m, A, Q, _, Z, V, ht, H) {
188
+ function F(u, A, Q, _, Z, V, ht, H) {
189
189
  var P = A.children;
190
190
  if (P !== void 0)
191
191
  if (_)
@@ -199,9 +199,9 @@ function Ke() {
199
199
  );
200
200
  else C(P);
201
201
  if (O.call(A, "key")) {
202
- P = d(m);
203
- var nt = Object.keys(A).filter(function(Dt) {
204
- return Dt !== "key";
202
+ P = d(u);
203
+ var nt = Object.keys(A).filter(function(Et) {
204
+ return Et !== "key";
205
205
  });
206
206
  _ = 0 < nt.length ? "{key: someKey, " + nt.join(": ..., ") + ": ...}" : "{key: someKey}", j[P + _] || (nt = 0 < nt.length ? "{" + nt.join(": ..., ") + ": ...}" : "{}", console.error(
207
207
  `A props object containing a "key" prop is being spread into JSX:
@@ -223,9 +223,9 @@ React keys must be passed directly to JSX without using spread:
223
223
  } else Q = A;
224
224
  return P && c(
225
225
  Q,
226
- typeof m == "function" ? m.displayName || m.name || "Unknown" : m
226
+ typeof u == "function" ? u.displayName || u.name || "Unknown" : u
227
227
  ), g(
228
- m,
228
+ u,
229
229
  P,
230
230
  V,
231
231
  Z,
@@ -235,54 +235,54 @@ React keys must be passed directly to JSX without using spread:
235
235
  H
236
236
  );
237
237
  }
238
- function C(m) {
239
- typeof m == "object" && m !== null && m.$$typeof === I && m._store && (m._store.validated = 1);
238
+ function C(u) {
239
+ typeof u == "object" && u !== null && u.$$typeof === I && u._store && (u._store.validated = 1);
240
240
  }
241
- var p = Ge, I = Symbol.for("react.transitional.element"), T = Symbol.for("react.portal"), w = Symbol.for("react.fragment"), z = Symbol.for("react.strict_mode"), E = Symbol.for("react.profiler"), S = Symbol.for("react.consumer"), $ = Symbol.for("react.context"), B = Symbol.for("react.forward_ref"), W = Symbol.for("react.suspense"), at = Symbol.for("react.suspense_list"), U = Symbol.for("react.memo"), ft = Symbol.for("react.lazy"), q = Symbol.for("react.activity"), rt = Symbol.for("react.client.reference"), Y = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, O = Object.prototype.hasOwnProperty, J = Array.isArray, st = console.createTask ? console.createTask : function() {
241
+ var p = _e, I = Symbol.for("react.transitional.element"), T = Symbol.for("react.portal"), w = Symbol.for("react.fragment"), z = Symbol.for("react.strict_mode"), E = Symbol.for("react.profiler"), S = Symbol.for("react.consumer"), $ = Symbol.for("react.context"), B = Symbol.for("react.forward_ref"), W = Symbol.for("react.suspense"), at = Symbol.for("react.suspense_list"), U = Symbol.for("react.memo"), ft = Symbol.for("react.lazy"), q = Symbol.for("react.activity"), rt = Symbol.for("react.client.reference"), Y = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, O = Object.prototype.hasOwnProperty, J = Array.isArray, st = console.createTask ? console.createTask : function() {
242
242
  return null;
243
243
  };
244
244
  p = {
245
- "react-stack-bottom-frame": function(m) {
246
- return m();
245
+ "react-stack-bottom-frame": function(u) {
246
+ return u();
247
247
  }
248
248
  };
249
- var K, it = {}, L = p["react-stack-bottom-frame"].bind(
249
+ var K, it = {}, M = p["react-stack-bottom-frame"].bind(
250
250
  p,
251
251
  f
252
252
  )(), G = st(l(f)), j = {};
253
- jt.Fragment = w, jt.jsx = function(m, A, Q, _, Z) {
253
+ jt.Fragment = w, jt.jsx = function(u, A, Q, _, Z) {
254
254
  var V = 1e4 > Y.recentlyCreatedOwnerStacks++;
255
255
  return F(
256
- m,
256
+ u,
257
257
  A,
258
258
  Q,
259
259
  !1,
260
260
  _,
261
261
  Z,
262
- V ? Error("react-stack-top-frame") : L,
263
- V ? st(l(m)) : G
262
+ V ? Error("react-stack-top-frame") : M,
263
+ V ? st(l(u)) : G
264
264
  );
265
- }, jt.jsxs = function(m, A, Q, _, Z) {
265
+ }, jt.jsxs = function(u, A, Q, _, Z) {
266
266
  var V = 1e4 > Y.recentlyCreatedOwnerStacks++;
267
267
  return F(
268
- m,
268
+ u,
269
269
  A,
270
270
  Q,
271
271
  !0,
272
272
  _,
273
273
  Z,
274
- V ? Error("react-stack-top-frame") : L,
275
- V ? st(l(m)) : G
274
+ V ? Error("react-stack-top-frame") : M,
275
+ V ? st(l(u)) : G
276
276
  );
277
277
  };
278
278
  }()), jt;
279
279
  }
280
- var ne;
281
- function Ze() {
282
- return ne || (ne = 1, process.env.NODE_ENV === "production" ? Rt.exports = Je() : Rt.exports = Ke()), Rt.exports;
280
+ var ce;
281
+ function ti() {
282
+ return ce || (ce = 1, process.env.NODE_ENV === "production" ? Dt.exports = Ke() : Dt.exports = Ze()), Dt.exports;
283
283
  }
284
- var i = Ze();
285
- const Pt = {
284
+ var i = ti();
285
+ const Ut = {
286
286
  business: {
287
287
  name: "Business & Office",
288
288
  icons: [
@@ -373,14 +373,14 @@ const Pt = {
373
373
  { name: "shield", symbol: "🛡️", unicode: "🛡️" }
374
374
  ]
375
375
  }
376
- }, de = () => Object.values(Pt).flatMap(
376
+ }, fe = () => Object.values(Ut).flatMap(
377
377
  (d) => d.icons.map((o) => ({
378
378
  ...o,
379
379
  category: d.name
380
380
  }))
381
- ), ti = (d) => de().filter(
381
+ ), ei = (d) => fe().filter(
382
382
  (a) => a.name.toLowerCase().includes(d.toLowerCase()) || a.category.toLowerCase().includes(d.toLowerCase())
383
- ), ei = ({ onSelectIcon: d, disabled: o = !1 }) => {
383
+ ), ii = ({ onSelectIcon: d, disabled: o = !1 }) => {
384
384
  const [a, l] = N(!1), [s, f] = N(""), [x, c] = N("all"), y = dt(null);
385
385
  et(() => {
386
386
  const p = (I) => {
@@ -391,9 +391,9 @@ const Pt = {
391
391
  const g = (p) => {
392
392
  d(p), l(!1), f("");
393
393
  }, C = (() => {
394
- let p = de();
395
- if (s.trim() && (p = ti(s)), x !== "all") {
396
- const I = Pt[x];
394
+ let p = fe();
395
+ if (s.trim() && (p = ei(s)), x !== "all") {
396
+ const I = Ut[x];
397
397
  I && (p = p.filter((T) => T.category === I.name));
398
398
  }
399
399
  return p;
@@ -433,7 +433,7 @@ const Pt = {
433
433
  className: "category-select",
434
434
  children: [
435
435
  /* @__PURE__ */ i.jsx("option", { value: "all", children: "All Categories" }),
436
- Object.entries(Pt).map(([p, I]) => /* @__PURE__ */ i.jsx("option", { value: p, children: I.name }, p))
436
+ Object.entries(Ut).map(([p, I]) => /* @__PURE__ */ i.jsx("option", { value: p, children: I.name }, p))
437
437
  ]
438
438
  }
439
439
  )
@@ -458,7 +458,7 @@ const Pt = {
458
458
  ] }) })
459
459
  ] })
460
460
  ] });
461
- }, ii = ({ isOpen: d, onClose: o, onAddQRCode: a, theme: l }) => {
461
+ }, oi = ({ isOpen: d, onClose: o, onAddQRCode: a, theme: l }) => {
462
462
  const [s, f] = N(""), [x, c] = N(""), [y, g] = N(200), [F, C] = N("M"), p = () => {
463
463
  if (!s.trim()) return;
464
464
  const w = {
@@ -472,7 +472,7 @@ const Pt = {
472
472
  light: "#FFFFFF"
473
473
  }
474
474
  };
475
- Ve.toDataURL(s, w, (z, E) => {
475
+ Xe.toDataURL(s, w, (z, E) => {
476
476
  if (z) {
477
477
  console.error("QR Code generation error:", z);
478
478
  return;
@@ -585,7 +585,7 @@ const Pt = {
585
585
  ] })
586
586
  ] })
587
587
  ] }) }) : null;
588
- }, oi = ({ isOpen: d, onClose: o, onAddBarcode: a, theme: l }) => {
588
+ }, ri = ({ isOpen: d, onClose: o, onAddBarcode: a, theme: l }) => {
589
589
  const [s, f] = N(""), [x, c] = N("CODE128"), [y, g] = N(null), [F, C] = N(2), [p, I] = N(100), [T, w] = N(20), [z, E] = N("center"), [S, $] = N("bottom"), [B, W] = N(10), at = dt(null), U = [
590
590
  { value: "CODE128", label: "CODE128 (Most Common)" },
591
591
  { value: "EAN13", label: "EAN-13 (European Article Number)" },
@@ -600,7 +600,7 @@ const Pt = {
600
600
  if (s.trim())
601
601
  try {
602
602
  g(/* @__PURE__ */ i.jsx(
603
- Xe,
603
+ Je,
604
604
  {
605
605
  value: s,
606
606
  format: x,
@@ -626,19 +626,19 @@ const Pt = {
626
626
  console.error("No SVG element found in barcode");
627
627
  return;
628
628
  }
629
- const L = document.createElement("canvas"), G = L.getContext("2d"), j = it.getBoundingClientRect(), m = ((J = (O = it.width) == null ? void 0 : O.baseVal) == null ? void 0 : J.value) || j.width || 200, A = ((K = (st = it.height) == null ? void 0 : st.baseVal) == null ? void 0 : K.value) || j.height || 100;
630
- L.width = m, L.height = A;
629
+ const M = document.createElement("canvas"), G = M.getContext("2d"), j = it.getBoundingClientRect(), u = ((J = (O = it.width) == null ? void 0 : O.baseVal) == null ? void 0 : J.value) || j.width || 200, A = ((K = (st = it.height) == null ? void 0 : st.baseVal) == null ? void 0 : K.value) || j.height || 100;
630
+ M.width = u, M.height = A;
631
631
  const Q = new XMLSerializer().serializeToString(it), _ = new Blob([Q], { type: "image/svg+xml;charset=utf-8" }), Z = URL.createObjectURL(_), V = new Image();
632
632
  V.onload = () => {
633
633
  G.drawImage(V, 0, 0);
634
- const ht = L.toDataURL("image/png"), H = new Image();
634
+ const ht = M.toDataURL("image/png"), H = new Image();
635
635
  H.onload = () => {
636
636
  a({
637
637
  type: "barcode",
638
638
  src: ht,
639
639
  data: s,
640
640
  format: x,
641
- width: m,
641
+ width: u,
642
642
  height: A,
643
643
  x: 100,
644
644
  y: 100,
@@ -801,7 +801,7 @@ const Pt = {
801
801
  ] })
802
802
  ] })
803
803
  ] }) }) : null;
804
- }, ri = ({ theme: d }) => /* @__PURE__ */ i.jsxs("div", { className: "premium-feature-container", style: {
804
+ }, ai = ({ theme: d }) => /* @__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 Pt = {
847
847
  children: "Get API Key"
848
848
  }
849
849
  )
850
- ] }), ce = () => /* @__PURE__ */ i.jsxs("div", { style: { textAlign: "center", padding: "40px" }, children: [
850
+ ] }), de = () => /* @__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,7 +864,7 @@ const Pt = {
864
864
  100% { transform: rotate(360deg); }
865
865
  }
866
866
  ` })
867
- ] }), ai = ({ isOpen: d, onClose: o, onAddSticker: a, theme: l, apiKey: s, apiEndpoint: f }) => {
867
+ ] }), si = ({ isOpen: d, onClose: o, onAddSticker: a, theme: l, apiKey: s, apiEndpoint: f }) => {
868
868
  const [x, c] = N([]), [y, g] = N(!1), [F, C] = N(null), [p, I] = N(""), [T, w] = N(""), [z, E] = N({});
869
869
  dt(null);
870
870
  const [S, $] = N(!1), [B, W] = N(!1), [at, U] = N(!1), ft = `${f}/api/v1/designer`;
@@ -872,26 +872,26 @@ const Pt = {
872
872
  d && s && q();
873
873
  }, [d, s]);
874
874
  const q = async () => {
875
- const L = sessionStorage.getItem("apc_x_sub_status");
876
- L === "active" ? ($(!0), W(!0), Y()) : L === "inactive" ? ($(!1), W(!0)) : (U(!0), await rt());
875
+ const M = sessionStorage.getItem("apc_x_sub_status");
876
+ M === "active" ? ($(!0), W(!0), Y()) : M === "inactive" ? ($(!1), W(!0)) : (U(!0), await rt());
877
877
  }, rt = async () => {
878
878
  if (!s) {
879
879
  $(!1), W(!0), U(!1);
880
880
  return;
881
881
  }
882
- const L = `${ft}/get-subscription-status/${s}`;
882
+ const M = `${ft}/get-subscription-status/${s}`;
883
883
  try {
884
- (await ae.get(L)).data.object === "active" ? (sessionStorage.setItem("apc_x_sub_status", "active"), $(!0), Y()) : (sessionStorage.setItem("apc_x_sub_status", "inactive"), $(!1));
884
+ (await se.get(M)).data.object === "active" ? (sessionStorage.setItem("apc_x_sub_status", "active"), $(!0), Y()) : (sessionStorage.setItem("apc_x_sub_status", "inactive"), $(!1));
885
885
  } catch (G) {
886
886
  console.error("Subscription check failed:", G), sessionStorage.setItem("apc_x_sub_status", "inactive"), $(!1);
887
887
  } finally {
888
888
  U(!1), W(!0);
889
889
  }
890
890
  }, Y = async () => {
891
- const L = sessionStorage.getItem("apc_stickers");
892
- if (L)
891
+ const M = sessionStorage.getItem("apc_stickers");
892
+ if (M)
893
893
  try {
894
- const G = JSON.parse(L);
894
+ const G = JSON.parse(M);
895
895
  c(G);
896
896
  return;
897
897
  } catch {
@@ -899,7 +899,7 @@ const Pt = {
899
899
  }
900
900
  g(!0), C(null);
901
901
  try {
902
- const G = await ae.get(`${ft}/get-stickers`);
902
+ const G = await se.get(`${ft}/get-stickers`);
903
903
  if (G.data && G.data.object && G.data.object.contents) {
904
904
  const j = G.data.object.contents;
905
905
  c(j), sessionStorage.setItem("apc_stickers", JSON.stringify(j));
@@ -910,42 +910,42 @@ const Pt = {
910
910
  } finally {
911
911
  g(!1);
912
912
  }
913
- }, O = (L, G) => {
913
+ }, O = (M, G) => {
914
914
  a({
915
915
  type: "sticker",
916
- src: L,
916
+ src: M,
917
917
  name: G,
918
918
  width: 100,
919
919
  height: 100,
920
920
  x: 100,
921
921
  y: 100
922
922
  }), o();
923
- }, J = (L) => {
923
+ }, J = (M) => {
924
924
  E((G) => ({
925
925
  ...G,
926
- [L]: !G[L]
926
+ [M]: !G[M]
927
927
  }));
928
- }, st = (L) => {
928
+ }, st = (M) => {
929
929
  const G = {};
930
- return L.forEach((j) => {
931
- const m = j.name.split("/");
930
+ return M.forEach((j) => {
931
+ const u = j.name.split("/");
932
932
  let A = G;
933
- m.forEach((Q, _) => {
934
- A[Q] || (A[Q] = _ === m.length - 1 ? j : {}), A = A[Q];
933
+ u.forEach((Q, _) => {
934
+ A[Q] || (A[Q] = _ === u.length - 1 ? j : {}), A = A[Q];
935
935
  });
936
936
  }), G;
937
- }, K = (L, G = "", j = 0) => /* @__PURE__ */ i.jsx("div", { className: "sticker-tree-level", style: { paddingLeft: `${j * 15}px` }, children: Object.keys(L).map((m) => {
938
- const A = `${G}/${m}`, Q = z[A];
939
- return L[m].type === "image" ? !T || m.toLowerCase().includes(T.toLowerCase()) ? /* @__PURE__ */ i.jsx(
937
+ }, K = (M, G = "", j = 0) => /* @__PURE__ */ i.jsx("div", { className: "sticker-tree-level", style: { paddingLeft: `${j * 15}px` }, children: Object.keys(M).map((u) => {
938
+ const A = `${G}/${u}`, Q = z[A];
939
+ return M[u].type === "image" ? !T || u.toLowerCase().includes(T.toLowerCase()) ? /* @__PURE__ */ i.jsx(
940
940
  "div",
941
941
  {
942
942
  className: "sticker-item",
943
- onClick: () => O(L[m].url, m),
943
+ onClick: () => O(M[u].url, u),
944
944
  children: /* @__PURE__ */ i.jsx("div", { className: "sticker-preview", children: /* @__PURE__ */ i.jsx(
945
945
  "img",
946
946
  {
947
- src: L[m].url,
948
- alt: m,
947
+ src: M[u].url,
948
+ alt: u,
949
949
  loading: "lazy",
950
950
  onError: (Z) => {
951
951
  Z.target.style.display = "none";
@@ -962,16 +962,16 @@ const Pt = {
962
962
  onClick: () => J(A),
963
963
  children: [
964
964
  /* @__PURE__ */ i.jsx("span", { className: `expand-icon ${Q ? "expanded" : ""}`, children: "▶" }),
965
- /* @__PURE__ */ i.jsx("span", { className: "category-name", children: m })
965
+ /* @__PURE__ */ i.jsx("span", { className: "category-name", children: u })
966
966
  ]
967
967
  }
968
968
  ),
969
- Q && K(L[m], A, j + 1)
969
+ Q && K(M[u], A, j + 1)
970
970
  ] }, A);
971
971
  }) }), it = x.filter(
972
- (L) => !T || L.name.toLowerCase().includes(T.toLowerCase())
972
+ (M) => !T || M.name.toLowerCase().includes(T.toLowerCase())
973
973
  );
974
- return d ? /* @__PURE__ */ i.jsx("div", { className: "sticker-modal-overlay", onClick: o, children: /* @__PURE__ */ i.jsxs("div", { className: "sticker-modal-content", onClick: (L) => L.stopPropagation(), children: [
974
+ return d ? /* @__PURE__ */ i.jsx("div", { className: "sticker-modal-overlay", onClick: o, children: /* @__PURE__ */ i.jsxs("div", { className: "sticker-modal-content", onClick: (M) => M.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,8 +985,8 @@ const Pt = {
985
985
  )
986
986
  ] }),
987
987
  /* @__PURE__ */ i.jsxs("div", { className: "sticker-modal-body", children: [
988
- at && /* @__PURE__ */ i.jsx(ce, {}),
989
- !S && !at && B && /* @__PURE__ */ i.jsx(ri, { theme: l }),
988
+ at && /* @__PURE__ */ i.jsx(de, {}),
989
+ !S && !at && B && /* @__PURE__ */ i.jsx(ai, { theme: l }),
990
990
  S && B && /* @__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",
@@ -994,11 +994,11 @@ const Pt = {
994
994
  type: "text",
995
995
  placeholder: "Search stickers...",
996
996
  value: T,
997
- onChange: (L) => w(L.target.value),
997
+ onChange: (M) => w(M.target.value),
998
998
  className: "sticker-search"
999
999
  }
1000
1000
  ) }) }),
1001
- y && /* @__PURE__ */ i.jsx(ce, {}),
1001
+ y && /* @__PURE__ */ i.jsx(de, {}),
1002
1002
  F && /* @__PURE__ */ i.jsxs("div", { className: "sticker-error", children: [
1003
1003
  /* @__PURE__ */ i.jsx("p", { children: F }),
1004
1004
  /* @__PURE__ */ i.jsx("button", { onClick: Y, children: "Retry" })
@@ -1007,7 +1007,7 @@ const Pt = {
1007
1007
  ] })
1008
1008
  ] })
1009
1009
  ] }) }) : null;
1010
- }, si = [
1010
+ }, li = [
1011
1011
  // FLORAL DESIGNS (40 items)
1012
1012
  {
1013
1013
  id: 1,
@@ -2559,10 +2559,10 @@ const Pt = {
2559
2559
  category: "Geometric",
2560
2560
  description: "Complex mandala flower pattern"
2561
2561
  }
2562
- ], li = ({ isOpen: d, onClose: o, onAddEmbroidery: a, theme: l, apiKey: s, apiEndpoint: f }) => {
2562
+ ], ni = ({ isOpen: d, onClose: o, onAddEmbroidery: a, theme: l, apiKey: s, apiEndpoint: f }) => {
2563
2563
  const [x, c] = N([]), [y, g] = N(!1), [F, C] = N(null), [p, I] = N(""), [T, w] = N("All"), z = dt(null), E = ["All", "Floral", "Nature", "Geometric", "Traditional", "Sports", "Hobbies", "Food", "Symbols", "Holiday", "Text"];
2564
2564
  et(() => {
2565
- d && c(si);
2565
+ d && c(li);
2566
2566
  }, [d]);
2567
2567
  const S = (B) => {
2568
2568
  a({
@@ -4601,14 +4601,14 @@ const Pt = {
4601
4601
  fill: "#8B0000",
4602
4602
  textAlign: "center"
4603
4603
  }
4604
- ], ni = ({ isOpen: d, onClose: o, onAddText: a, theme: l }) => {
4605
- const [s, f] = N(""), [x, c] = N("All"), y = re(() => {
4604
+ ], ci = ({ isOpen: d, onClose: o, onAddText: a, theme: l }) => {
4605
+ const [s, f] = N(""), [x, c] = N("All"), y = ae(() => {
4606
4606
  const p = Nt.reduce((I, T) => (I[T.category] = (I[T.category] || 0) + 1, I), {});
4607
4607
  return [
4608
4608
  { name: "All", count: Nt.length },
4609
4609
  ...Object.entries(p).map(([I, T]) => ({ name: I, count: T }))
4610
4610
  ];
4611
- }, [Nt]), g = re(() => Nt.filter((p) => {
4611
+ }, [Nt]), g = ae(() => Nt.filter((p) => {
4612
4612
  const I = !s || p.text.toLowerCase().includes(s.toLowerCase()) || p.category.toLowerCase().includes(s.toLowerCase()), T = x === "All" || p.category === x;
4613
4613
  return I && T;
4614
4614
  }), [Nt, s, x]), F = (p) => {
@@ -4707,7 +4707,7 @@ const Pt = {
4707
4707
  " found"
4708
4708
  ] }) })
4709
4709
  ] }) }) : null;
4710
- }, ci = ({
4710
+ }, di = ({
4711
4711
  onAddElement: d,
4712
4712
  onDeleteElement: o,
4713
4713
  onDuplicateElement: a,
@@ -4728,7 +4728,7 @@ const Pt = {
4728
4728
  apiKey: E,
4729
4729
  apiEndpoint: S
4730
4730
  }) => {
4731
- const [$, B] = N(!1), [W, at] = N(!1), [U, ft] = N(!1), [q, rt] = N(!1), [Y, O] = N(!1), [J, st] = N(!1), [K, it] = N(!1), L = (P) => {
4731
+ const [$, B] = N(!1), [W, at] = N(!1), [U, ft] = N(!1), [q, rt] = N(!1), [Y, O] = N(!1), [J, st] = N(!1), [K, it] = N(!1), M = (P) => {
4732
4732
  const nt = P.target.files[0];
4733
4733
  nt && nt.type.startsWith("image/") && y(nt), P.target.value = "";
4734
4734
  }, G = (P) => {
@@ -4741,7 +4741,7 @@ const Pt = {
4741
4741
  });
4742
4742
  }, j = (P) => {
4743
4743
  d("qrcode", P);
4744
- }, m = (P) => {
4744
+ }, u = (P) => {
4745
4745
  d("barcode", P);
4746
4746
  }, A = (P) => {
4747
4747
  d("sticker", P);
@@ -4890,13 +4890,13 @@ const Pt = {
4890
4890
  {
4891
4891
  type: "file",
4892
4892
  accept: "image/*",
4893
- onChange: L,
4893
+ onChange: M,
4894
4894
  disabled: z
4895
4895
  }
4896
4896
  )
4897
4897
  ] }),
4898
4898
  /* @__PURE__ */ i.jsx("div", { className: "toolbar-separator" }),
4899
- /* @__PURE__ */ i.jsx(ei, { onSelectIcon: G, theme: w, disabled: z }),
4899
+ /* @__PURE__ */ i.jsx(ii, { onSelectIcon: G, theme: w, disabled: z }),
4900
4900
  /* @__PURE__ */ i.jsxs(
4901
4901
  "button",
4902
4902
  {
@@ -5024,7 +5024,7 @@ const Pt = {
5024
5024
  ] })
5025
5025
  ] }),
5026
5026
  /* @__PURE__ */ i.jsx(
5027
- ii,
5027
+ oi,
5028
5028
  {
5029
5029
  isOpen: $,
5030
5030
  onClose: () => B(!1),
@@ -5033,16 +5033,16 @@ const Pt = {
5033
5033
  }
5034
5034
  ),
5035
5035
  /* @__PURE__ */ i.jsx(
5036
- oi,
5036
+ ri,
5037
5037
  {
5038
5038
  isOpen: W,
5039
5039
  onClose: () => at(!1),
5040
- onAddBarcode: m,
5040
+ onAddBarcode: u,
5041
5041
  theme: w
5042
5042
  }
5043
5043
  ),
5044
5044
  /* @__PURE__ */ i.jsx(
5045
- ai,
5045
+ si,
5046
5046
  {
5047
5047
  isOpen: U,
5048
5048
  onClose: () => ft(!1),
@@ -5053,7 +5053,7 @@ const Pt = {
5053
5053
  }
5054
5054
  ),
5055
5055
  /* @__PURE__ */ i.jsx(
5056
- li,
5056
+ ni,
5057
5057
  {
5058
5058
  isOpen: q,
5059
5059
  onClose: () => rt(!1),
@@ -5064,7 +5064,7 @@ const Pt = {
5064
5064
  }
5065
5065
  ),
5066
5066
  /* @__PURE__ */ i.jsx(
5067
- ni,
5067
+ ci,
5068
5068
  {
5069
5069
  isOpen: Y,
5070
5070
  onClose: () => O(!1),
@@ -5073,7 +5073,7 @@ const Pt = {
5073
5073
  }
5074
5074
  )
5075
5075
  ] });
5076
- }, di = ({
5076
+ }, fi = ({
5077
5077
  selectedElement: d,
5078
5078
  onUpdate: o,
5079
5079
  onMoveLayer: a,
@@ -5822,7 +5822,7 @@ const Pt = {
5822
5822
  ) })
5823
5823
  ] })
5824
5824
  ] });
5825
- }, fi = ({
5825
+ }, hi = ({
5826
5826
  elements: d,
5827
5827
  selectedElement: o,
5828
5828
  onSelectElement: a,
@@ -5941,7 +5941,7 @@ const Pt = {
5941
5941
  )) })
5942
5942
  ] });
5943
5943
  };
5944
- class hi {
5944
+ class gi {
5945
5945
  constructor() {
5946
5946
  this.canvas = document.createElement("canvas"), this.ctx = this.canvas.getContext("2d");
5947
5947
  }
@@ -6543,7 +6543,7 @@ class hi {
6543
6543
  };
6544
6544
  }
6545
6545
  }
6546
- class gi {
6546
+ class xi {
6547
6547
  constructor(o = "localStorage") {
6548
6548
  this.storage = o === "sessionStorage" ? sessionStorage : localStorage, this.STORAGE_PREFIX = "mypixia_canvas_", this.DESIGNS_LIST_KEY = "mypixia_saved_designs";
6549
6549
  }
@@ -6733,7 +6733,7 @@ class gi {
6733
6733
  return "Unknown";
6734
6734
  }
6735
6735
  }
6736
- const xi = _e((d, o) => {
6736
+ const yi = Ye((d, o) => {
6737
6737
  const {
6738
6738
  theme: a = {
6739
6739
  primaryColor: "#000000",
@@ -6765,7 +6765,7 @@ const xi = _e((d, o) => {
6765
6765
  },
6766
6766
  initFile: f,
6767
6767
  initDesignContent: x
6768
- } = d, [c, y] = N([]), [g, F] = N(null), [C, p] = N(!1), [I, T] = N(!1), [w, z] = N(!1), [E, S] = N({ x: 0, y: 0 }), [$, B] = N(null), [W, at] = N(800), [U, ft] = N(600), [q, rt] = N(1), [Y, O] = N(s.colorSettings[0]), [J, st] = N(!1), [K, it] = N(!0), [L, G] = N(!0), [j, m] = N(s.sections[0]), [A, Q] = N(!1), [_, Z] = N({}), [V, ht] = N([]), [H, P] = N(-1), [nt] = N(new gi("localStorage")), gt = dt(null), Dt = dt(null), kt = dt(null), wt = dt(null), Ut = dt(null), Et = dt(new hi()), Bt = dt(!1), [yt, Ot] = N(null), lt = ot(() => {
6768
+ } = d, [c, y] = N([]), [g, F] = N(null), [C, p] = N(!1), [I, T] = N(!1), [w, z] = N(!1), [E, S] = N({ x: 0, y: 0 }), [$, B] = N(null), [W, at] = N(800), [U, ft] = N(600), [q, rt] = N(1), [Y, O] = N(s.colorSettings[0]), [J, st] = N(!1), [K, it] = N(!0), [M, G] = N(!0), [j, u] = N(s.sections[0]), [A, Q] = N(!1), [_, Z] = N({}), [V, ht] = N([]), [H, P] = N(-1), [nt] = N(new xi("localStorage")), gt = dt(null), Et = dt(null), kt = dt(null), wt = dt(null), Ot = dt(null), Bt = dt(new gi()), zt = dt(!1), [yt, Qt] = N(null), lt = ot(() => {
6769
6769
  const e = {
6770
6770
  elements: JSON.parse(JSON.stringify(c)),
6771
6771
  selectedElement: g ? { ...g } : null,
@@ -6782,17 +6782,17 @@ const xi = _e((d, o) => {
6782
6782
  sectionDesigns: _,
6783
6783
  zoomLevel: q,
6784
6784
  showGrid: J,
6785
- snapToGrid: L,
6785
+ snapToGrid: M,
6786
6786
  selectedElement: g ? { ...g } : null,
6787
6787
  canvasRef: gt
6788
6788
  // Include reference for thumbnail generation
6789
- }), [c, W, U, Y, j, s, _, q, J, L, g]), Qt = (e) => {
6789
+ }), [c, W, U, Y, j, s, _, q, J, M, g]), $t = (e) => {
6790
6790
  if (e.sections && typeof e.sections == "object") {
6791
6791
  const t = Object.keys(e.sections)[0], r = e.sections[t];
6792
6792
  if (r && r.elements) {
6793
6793
  y(r.elements || []), at(r.canvasWidth || 800), ft(r.canvasHeight || 600), O(r.selectedColor || s.colorSettings[0]), rt(r.zoomLevel || 1), st(r.showGrid || !1), G(r.snapToGrid || !0), F(null), e.sections && Z(e.sections);
6794
6794
  const n = s.sections.find((h) => h.sectionName === t);
6795
- n && m(n), ht([]), P(-1), setTimeout(() => {
6795
+ n && u(n), ht([]), P(-1), setTimeout(() => {
6796
6796
  lt();
6797
6797
  }, 100);
6798
6798
  return;
@@ -6805,7 +6805,7 @@ const xi = _e((d, o) => {
6805
6805
  if (x)
6806
6806
  try {
6807
6807
  const r = JSON.parse(x);
6808
- console.log("Loading design from content in memory:", r), Ot(r), Qt(r);
6808
+ Qt(r), $t(r);
6809
6809
  } catch (r) {
6810
6810
  console.error("Error loading design file:", r), console.warn("Using default text instead");
6811
6811
  }
@@ -6816,7 +6816,7 @@ const xi = _e((d, o) => {
6816
6816
  const n = await r.text();
6817
6817
  if (n.trim()) {
6818
6818
  const h = JSON.parse(n.trim());
6819
- console.log("Loading design from file:", h), Ot(h), Qt(h);
6819
+ Qt(h), $t(h);
6820
6820
  }
6821
6821
  } else
6822
6822
  console.warn("Failed to load design file, using default text");
@@ -6855,9 +6855,9 @@ const xi = _e((d, o) => {
6855
6855
  }, 300);
6856
6856
  return () => clearTimeout(t);
6857
6857
  }, [f, x, s.colorSettings, s.sections]);
6858
- const zt = ot((e = "png", t = !0) => {
6858
+ const Wt = ot((e = "png", t = !0) => {
6859
6859
  const r = St();
6860
- return s.sections, Et.current.exportAllSections(
6860
+ return s.sections, Bt.current.exportAllSections(
6861
6861
  { [(j == null ? void 0 : j.sectionName) || "main"]: r },
6862
6862
  [{
6863
6863
  id: (j == null ? void 0 : j.sectionName) || "main",
@@ -6871,7 +6871,7 @@ const xi = _e((d, o) => {
6871
6871
  t,
6872
6872
  yt
6873
6873
  );
6874
- }, [St, s.sections, j, W, U]), fe = [
6874
+ }, [St, s.sections, j, W, U]), he = [
6875
6875
  "Arial",
6876
6876
  "Helvetica",
6877
6877
  "Times New Roman",
@@ -6893,13 +6893,13 @@ const xi = _e((d, o) => {
6893
6893
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
6894
6894
  }, []), et(() => {
6895
6895
  const e = document.createElement("canvas");
6896
- e.width = W, e.height = U, Ut.current = e;
6896
+ e.width = W, e.height = U, Ot.current = e;
6897
6897
  }, [W, U]), et(() => {
6898
6898
  V.length === 0 && lt();
6899
6899
  }, []);
6900
- const At = (e, t, r, n, h, u) => {
6901
- e.beginPath(), e.moveTo(t + u, r), e.lineTo(t + n - u, r), e.quadraticCurveTo(t + n, r, t + n, r + u), e.lineTo(t + n, r + h - u), e.quadraticCurveTo(t + n, r + h, t + n - u, r + h), e.lineTo(t + u, r + h), e.quadraticCurveTo(t, r + h, t, r + h - u), e.lineTo(t, r + u), e.quadraticCurveTo(t, r, t + u, r), e.closePath();
6902
- }, $t = (e, t) => {
6900
+ const At = (e, t, r, n, h, m) => {
6901
+ e.beginPath(), e.moveTo(t + m, r), e.lineTo(t + n - m, r), e.quadraticCurveTo(t + n, r, t + n, r + m), e.lineTo(t + n, r + h - m), e.quadraticCurveTo(t + n, r + h, t + n - m, r + h), e.lineTo(t + m, r + h), e.quadraticCurveTo(t, r + h, t, r + h - m), e.lineTo(t, r + m), e.quadraticCurveTo(t, r, t + m, r), e.closePath();
6902
+ }, Ht = (e, t) => {
6903
6903
  if (!t.isIcon)
6904
6904
  return {
6905
6905
  x: t.x,
@@ -6910,11 +6910,11 @@ const xi = _e((d, o) => {
6910
6910
  cy: t.y + t.height / 2
6911
6911
  };
6912
6912
  e.save(), e.font = `${t.fontStyle || ""} ${t.fontWeight || ""} ${t.fontSize}px ${t.fontFamily}`, e.textBaseline = "alphabetic", e.textAlign = "left";
6913
- const r = e.measureText(t.text), n = r.actualBoundingBoxAscent ?? t.fontSize * 0.8, h = r.actualBoundingBoxDescent ?? t.fontSize * 0.2, u = r.actualBoundingBoxLeft ?? 0, b = r.actualBoundingBoxRight ?? r.width, k = u + b, v = n + h, R = t.x, D = t.y, M = R - k / 2 - u, tt = D - v / 2 - n;
6914
- return e.restore(), { x: M, y: tt, width: k, height: v, cx: R, cy: D };
6915
- }, he = (e, t) => {
6913
+ const r = e.measureText(t.text), n = r.actualBoundingBoxAscent ?? t.fontSize * 0.8, h = r.actualBoundingBoxDescent ?? t.fontSize * 0.2, m = r.actualBoundingBoxLeft ?? 0, b = r.actualBoundingBoxRight ?? r.width, k = m + b, v = n + h, R = t.x, D = t.y, L = R - k / 2 - m, tt = D - v / 2 - n;
6914
+ return e.restore(), { x: L, y: tt, width: k, height: v, cx: R, cy: D };
6915
+ }, ge = (e, t) => {
6916
6916
  if (!t) return;
6917
- const r = 8, n = 8, h = 4, u = 30, b = $t(e, t), k = t.isIcon ? Math.max(r, 12) : r, v = {
6917
+ const r = 8, n = 8, h = 4, m = 30, b = Ht(e, t), k = t.isIcon ? Math.max(r, 12) : r, v = {
6918
6918
  x: -b.width / 2 - k,
6919
6919
  y: -b.height / 2 - k,
6920
6920
  w: b.width + k * 2,
@@ -6957,11 +6957,11 @@ const xi = _e((d, o) => {
6957
6957
  n
6958
6958
  );
6959
6959
  });
6960
- const D = 0, M = v.y - u;
6961
- e.strokeStyle = "#3b82f6", e.lineWidth = 1, e.setLineDash([2, 2]), e.beginPath(), e.moveTo(D, M + 12), e.lineTo(D, v.y), e.stroke(), e.setLineDash([]), e.beginPath(), e.arc(D, M, 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, M, 6, -Math.PI / 2, Math.PI, !1), e.stroke(), e.beginPath(), e.moveTo(D - 6, M), e.lineTo(D - 3, M - 3), e.lineTo(D - 3, M + 3), e.closePath(), e.fillStyle = "#ffffff", e.fill(), e.restore();
6962
- }, ge = (e, t) => {
6960
+ const D = 0, L = v.y - m;
6961
+ e.strokeStyle = "#3b82f6", e.lineWidth = 1, e.setLineDash([2, 2]), e.beginPath(), e.moveTo(D, L + 12), e.lineTo(D, v.y), e.stroke(), e.setLineDash([]), e.beginPath(), e.arc(D, L, 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, L, 6, -Math.PI / 2, Math.PI, !1), e.stroke(), e.beginPath(), e.moveTo(D - 6, L), e.lineTo(D - 3, L - 3), e.lineTo(D - 3, L + 3), e.closePath(), e.fillStyle = "#ffffff", e.fill(), e.restore();
6962
+ }, xe = (e, t) => {
6963
6963
  if (!t) return [];
6964
- const r = $t(e, t), n = t.isIcon ? Math.max(8, 12) : 8, h = 8, u = 30, b = (t.rotation || 0) * Math.PI / 180, k = {
6964
+ const r = Ht(e, t), n = t.isIcon ? Math.max(8, 12) : 8, h = 8, m = 30, b = (t.rotation || 0) * Math.PI / 180, k = {
6965
6965
  x: -r.width / 2 - n,
6966
6966
  y: -r.height / 2 - n,
6967
6967
  w: r.width + n * 2,
@@ -6971,20 +6971,20 @@ const xi = _e((d, o) => {
6971
6971
  { x: k.x + k.w, y: k.y, type: "ne-resize" },
6972
6972
  { x: k.x + k.w, y: k.y + k.h, type: "se-resize" },
6973
6973
  { x: k.x, y: k.y + k.h, type: "sw-resize" },
6974
- { x: 0, y: k.y - u, type: "rotate" }
6974
+ { x: 0, y: k.y - m, type: "rotate" }
6975
6975
  ], R = Math.cos(b), D = Math.sin(b);
6976
- return v.map((M) => ({
6977
- x: r.cx + (M.x * R - M.y * D),
6978
- y: r.cy + (M.x * D + M.y * R),
6979
- type: M.type,
6980
- size: M.type === "rotate" ? 24 : h
6976
+ return v.map((L) => ({
6977
+ x: r.cx + (L.x * R - L.y * D),
6978
+ y: r.cy + (L.x * D + L.y * R),
6979
+ type: L.type,
6980
+ size: L.type === "rotate" ? 24 : h
6981
6981
  }));
6982
- }, Ht = (e, t, r) => {
6982
+ }, Gt = (e, t, r) => {
6983
6983
  if (!r) return null;
6984
6984
  const n = gt.current;
6985
6985
  if (!n) return null;
6986
- const h = n.getContext("2d"), u = ge(h, r);
6987
- for (const b of u) {
6986
+ const h = n.getContext("2d"), m = xe(h, r);
6987
+ for (const b of m) {
6988
6988
  const k = e - b.x, v = t - b.y;
6989
6989
  if (Math.sqrt(k * k + v * v) <= b.size / 2)
6990
6990
  return b.type;
@@ -7000,7 +7000,7 @@ const xi = _e((d, o) => {
7000
7000
  const e = V[H + 1];
7001
7001
  y(e.elements), F(e.selectedElement), P(H + 1);
7002
7002
  }
7003
- }, [V, H]), ut = (e) => L ? Math.round(e / It) * It : e;
7003
+ }, [V, H]), mt = (e) => M ? Math.round(e / It) * It : e;
7004
7004
  et(() => {
7005
7005
  if (j != null && j.sectionImage) {
7006
7006
  kt.current = null, wt.current = null;
@@ -7009,7 +7009,7 @@ const xi = _e((d, o) => {
7009
7009
  return;
7010
7010
  const t = new Image();
7011
7011
  t.crossOrigin = "anonymous", t.onload = () => {
7012
- kt.current = t, Jt(t, Y);
7012
+ kt.current = t, Kt(t, Y);
7013
7013
  }, t.onerror = () => {
7014
7014
  console.error("Failed to load background image:", j.sectionImage), X();
7015
7015
  };
@@ -7024,7 +7024,7 @@ const xi = _e((d, o) => {
7024
7024
  if ((t.key === "Delete" || t.key === "Backspace") && g && !l) {
7025
7025
  t.preventDefault();
7026
7026
  const h = g;
7027
- y((u) => u.filter((b) => b.id !== h.id)), F(null), lt();
7027
+ y((m) => m.filter((b) => b.id !== h.id)), F(null), lt();
7028
7028
  }
7029
7029
  if (t.ctrlKey || t.metaKey)
7030
7030
  switch (t.key) {
@@ -7041,14 +7041,14 @@ const xi = _e((d, o) => {
7041
7041
  document.removeEventListener("keydown", e);
7042
7042
  };
7043
7043
  }, [g, l, Ft, bt, lt]);
7044
- const xe = (e) => {
7044
+ const ye = (e) => {
7045
7045
  const t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
7046
7046
  return t ? {
7047
7047
  r: parseInt(t[1], 16),
7048
7048
  g: parseInt(t[2], 16),
7049
7049
  b: parseInt(t[3], 16)
7050
7050
  } : null;
7051
- }, ct = () => `element_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, ye = (e) => {
7051
+ }, ct = () => `element_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, ue = (e) => {
7052
7052
  e.strokeStyle = "#e0e0e0", e.lineWidth = 1, e.setLineDash([1, 1]);
7053
7053
  for (let t = 0; t <= W; t += It)
7054
7054
  e.beginPath(), e.moveTo(t, 0), e.lineTo(t, U), e.stroke();
@@ -7060,62 +7060,62 @@ const xi = _e((d, o) => {
7060
7060
  const r = t.x + t.width / 2, n = t.y + t.height / 2;
7061
7061
  switch (e.translate(r, n), t.rotation && e.rotate(t.rotation * Math.PI / 180), e.translate(-t.width / 2, -t.height / 2), t.type) {
7062
7062
  case "text":
7063
- we(e, t);
7063
+ be(e, t);
7064
7064
  break;
7065
7065
  case "rectangle":
7066
- be(e, t);
7066
+ ve(e, t);
7067
7067
  break;
7068
7068
  case "circle":
7069
- ve(e, t);
7069
+ ke(e, t);
7070
7070
  break;
7071
7071
  case "triangle":
7072
- ke(e, t);
7072
+ Se(e, t);
7073
7073
  break;
7074
7074
  case "star":
7075
- Se(e, t);
7075
+ Fe(e, t);
7076
7076
  break;
7077
7077
  case "arrow":
7078
- Fe(e, t);
7078
+ Ce(e, t);
7079
7079
  break;
7080
7080
  case "diamond":
7081
- Ce(e, t);
7081
+ Te(e, t);
7082
7082
  break;
7083
7083
  case "hexagon":
7084
- Te(e, t);
7084
+ je(e, t);
7085
7085
  break;
7086
7086
  case "pentagon":
7087
- je(e, t);
7087
+ Ne(e, t);
7088
7088
  break;
7089
7089
  case "heart":
7090
- Ne(e, t);
7090
+ Ie(e, t);
7091
7091
  break;
7092
7092
  case "oval":
7093
- Ie(e, t);
7093
+ Ae(e, t);
7094
7094
  break;
7095
7095
  case "roundedRectangle":
7096
- Ae(e, t);
7096
+ Re(e, t);
7097
7097
  break;
7098
7098
  case "image":
7099
- De(e, t);
7099
+ Ee(e, t);
7100
7100
  break;
7101
7101
  case "qrcode":
7102
- pe(e, t);
7102
+ we(e, t);
7103
7103
  break;
7104
7104
  case "barcode":
7105
- ue(e, t);
7105
+ pe(e, t);
7106
7106
  break;
7107
7107
  case "sticker":
7108
- Ee(e, t);
7108
+ Be(e, t);
7109
7109
  break;
7110
7110
  case "horizontalLine":
7111
- Re(e, t);
7111
+ De(e, t);
7112
7112
  break;
7113
7113
  case "embroidery":
7114
- Be(e, t);
7114
+ ze(e, t);
7115
7115
  break;
7116
7116
  }
7117
7117
  e.restore();
7118
- }, ue = (e, t) => {
7118
+ }, pe = (e, t) => {
7119
7119
  if (t.imageObject)
7120
7120
  e.drawImage(t.imageObject, 0, 0, t.width, t.height);
7121
7121
  else if (t.src && !t.imageLoading) {
@@ -7135,7 +7135,7 @@ const xi = _e((d, o) => {
7135
7135
  );
7136
7136
  }, 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);
7137
7137
  } 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));
7138
- }, pe = (e, t) => {
7138
+ }, we = (e, t) => {
7139
7139
  if (t.imageObject)
7140
7140
  e.drawImage(t.imageObject, 0, 0, t.width, t.height);
7141
7141
  else if (t.src && !t.imageLoading) {
@@ -7155,7 +7155,7 @@ const xi = _e((d, o) => {
7155
7155
  );
7156
7156
  }, 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);
7157
7157
  } 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));
7158
- }, we = (e, t) => {
7158
+ }, be = (e, t) => {
7159
7159
  e.save();
7160
7160
  let r = t.text || "Text";
7161
7161
  if (t.textTransform)
@@ -7172,23 +7172,23 @@ const xi = _e((d, o) => {
7172
7172
  }
7173
7173
  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);
7174
7174
  const n = r.split(`
7175
- `), h = (t.fontSize || 20) * (t.lineHeight || 1.2), u = Math.max(...n.map((k) => e.measureText(k).width)), b = n.length * h;
7175
+ `), h = (t.fontSize || 20) * (t.lineHeight || 1.2), m = Math.max(...n.map((k) => e.measureText(k).width)), b = n.length * h;
7176
7176
  if (t.backgroundColor && t.backgroundColor !== "transparent") {
7177
7177
  e.fillStyle = t.backgroundColor;
7178
7178
  const k = t.backgroundPadding || 4;
7179
7179
  e.fillRect(
7180
7180
  -k,
7181
7181
  -k,
7182
- u + k * 2,
7182
+ m + k * 2,
7183
7183
  b + k * 2
7184
7184
  ), e.fillStyle = t.fill || "#000000";
7185
7185
  }
7186
7186
  n.forEach((k, v) => {
7187
7187
  const R = v * h, D = e.measureText(k).width;
7188
7188
  t.stroke && t.strokeWidth > 0 && e.strokeText(k, 0, R), e.fillText(k, 0, R);
7189
- const M = t.fontSize || 20, tt = t.decorationColor || t.fill || "#000000", xt = Math.max(1, M / 20);
7189
+ const L = t.fontSize || 20, tt = t.decorationColor || t.fill || "#000000", xt = Math.max(1, L / 20);
7190
7190
  if (e.strokeStyle = tt, e.lineWidth = xt, t.textDecoration === "underline" || t.underline) {
7191
- const pt = R + M + 2;
7191
+ const pt = R + L + 2;
7192
7192
  e.beginPath(), e.moveTo(0, pt), e.lineTo(D, pt), e.stroke();
7193
7193
  }
7194
7194
  if (t.textDecoration === "overline" || t.overline) {
@@ -7196,106 +7196,106 @@ const xi = _e((d, o) => {
7196
7196
  e.beginPath(), e.moveTo(0, pt), e.lineTo(D, pt), e.stroke();
7197
7197
  }
7198
7198
  if (t.textDecoration === "line-through" || t.strikethrough) {
7199
- const pt = R + M / 2;
7199
+ const pt = R + L / 2;
7200
7200
  e.beginPath(), e.moveTo(0, pt), e.lineTo(D, pt), e.stroke();
7201
7201
  }
7202
- typeof t.textDecoration == "string" && t.textDecoration.includes(" ") && t.textDecoration.split(" ").forEach((He) => {
7203
- switch (He.trim()) {
7202
+ typeof t.textDecoration == "string" && t.textDecoration.includes(" ") && t.textDecoration.split(" ").forEach((Ge) => {
7203
+ switch (Ge.trim()) {
7204
7204
  case "underline":
7205
- const ee = R + M + 2;
7206
- e.beginPath(), e.moveTo(0, ee), e.lineTo(D, ee), e.stroke();
7205
+ const ie = R + L + 2;
7206
+ e.beginPath(), e.moveTo(0, ie), e.lineTo(D, ie), e.stroke();
7207
7207
  break;
7208
7208
  case "overline":
7209
- const ie = R - 2;
7210
- e.beginPath(), e.moveTo(0, ie), e.lineTo(D, ie), e.stroke();
7209
+ const oe = R - 2;
7210
+ e.beginPath(), e.moveTo(0, oe), e.lineTo(D, oe), e.stroke();
7211
7211
  break;
7212
7212
  case "line-through":
7213
- const oe = R + M / 2;
7214
- e.beginPath(), e.moveTo(0, oe), e.lineTo(D, oe), e.stroke();
7213
+ const re = R + L / 2;
7214
+ e.beginPath(), e.moveTo(0, re), e.lineTo(D, re), e.stroke();
7215
7215
  break;
7216
7216
  }
7217
7217
  });
7218
7218
  }), e.restore();
7219
- }, be = (e, t) => {
7220
- 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));
7221
7219
  }, ve = (e, t) => {
7220
+ 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));
7221
+ }, ke = (e, t) => {
7222
7222
  const r = Math.min(t.width, t.height) / 2, n = t.width / 2, h = t.height / 2;
7223
7223
  e.beginPath(), e.arc(n, h, 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());
7224
- }, ke = (e, t) => {
7224
+ }, Se = (e, t) => {
7225
7225
  const r = t.width / 2;
7226
7226
  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());
7227
- }, Se = (e, t) => {
7228
- const r = t.width / 2, n = t.height / 2, h = Math.min(t.width, t.height) / 2, u = h * 0.4, b = t.numPoints || 5;
7227
+ }, Fe = (e, t) => {
7228
+ const r = t.width / 2, n = t.height / 2, h = Math.min(t.width, t.height) / 2, m = h * 0.4, b = t.numPoints || 5;
7229
7229
  e.beginPath();
7230
7230
  for (let k = 0; k < b * 2; k++) {
7231
- const v = k % 2 === 0 ? h : u, R = k * Math.PI / b, D = r + Math.cos(R) * v, M = n + Math.sin(R) * v;
7232
- k === 0 ? e.moveTo(D, M) : e.lineTo(D, M);
7231
+ const v = k % 2 === 0 ? h : m, R = k * Math.PI / b, D = r + Math.cos(R) * v, L = n + Math.sin(R) * v;
7232
+ k === 0 ? e.moveTo(D, L) : e.lineTo(D, L);
7233
7233
  }
7234
7234
  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());
7235
- }, Fe = (e, t) => {
7235
+ }, Ce = (e, t) => {
7236
7236
  const r = t.width, n = t.height, h = r * 0.3;
7237
7237
  e.beginPath(), e.moveTo(r / 2, 0), e.lineTo(r, n * 0.6), e.lineTo(r - h, n * 0.6), e.lineTo(r - h, n), e.lineTo(h, n), e.lineTo(h, n * 0.6), e.lineTo(0, n * 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());
7238
- }, Ce = (e, t) => {
7238
+ }, Te = (e, t) => {
7239
7239
  const r = t.width / 2, n = t.height / 2;
7240
7240
  e.beginPath(), e.moveTo(r, 0), e.lineTo(t.width, n), e.lineTo(r, t.height), e.lineTo(0, n), 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());
7241
- }, Te = (e, t) => {
7242
- const r = t.width / 2, n = t.height / 2, h = Math.min(t.width, t.height) / 2, u = 6;
7241
+ }, je = (e, t) => {
7242
+ const r = t.width / 2, n = t.height / 2, h = Math.min(t.width, t.height) / 2, m = 6;
7243
7243
  e.beginPath();
7244
- for (let b = 0; b < u; b++) {
7245
- const k = b * 2 * Math.PI / u - Math.PI / 2, v = r + h * Math.cos(k), R = n + h * Math.sin(k);
7244
+ for (let b = 0; b < m; b++) {
7245
+ const k = b * 2 * Math.PI / m - Math.PI / 2, v = r + h * Math.cos(k), R = n + h * Math.sin(k);
7246
7246
  b === 0 ? e.moveTo(v, R) : e.lineTo(v, R);
7247
7247
  }
7248
7248
  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());
7249
- }, je = (e, t) => {
7250
- const r = t.width / 2, n = t.height / 2, h = Math.min(t.width, t.height) / 2, u = 5;
7249
+ }, Ne = (e, t) => {
7250
+ const r = t.width / 2, n = t.height / 2, h = Math.min(t.width, t.height) / 2, m = 5;
7251
7251
  e.beginPath();
7252
- for (let b = 0; b < u; b++) {
7253
- const k = b * 2 * Math.PI / u - Math.PI / 2, v = r + h * Math.cos(k), R = n + h * Math.sin(k);
7252
+ for (let b = 0; b < m; b++) {
7253
+ const k = b * 2 * Math.PI / m - Math.PI / 2, v = r + h * Math.cos(k), R = n + h * Math.sin(k);
7254
7254
  b === 0 ? e.moveTo(v, R) : e.lineTo(v, R);
7255
7255
  }
7256
7256
  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());
7257
- }, Ne = (e, t) => {
7258
- const r = t.width, n = t.height, h = 0, u = 0;
7257
+ }, Ie = (e, t) => {
7258
+ const r = t.width, n = t.height, h = 0, m = 0;
7259
7259
  e.beginPath();
7260
7260
  const b = n * 0.3;
7261
- e.moveTo(h + r / 2, u + b), e.bezierCurveTo(
7261
+ e.moveTo(h + r / 2, m + b), e.bezierCurveTo(
7262
7262
  h + r / 2,
7263
- u,
7263
+ m,
7264
7264
  h,
7265
- u,
7265
+ m,
7266
7266
  h,
7267
- u + b
7267
+ m + b
7268
7268
  ), e.bezierCurveTo(
7269
7269
  h,
7270
- u + (n + b) / 2,
7270
+ m + (n + b) / 2,
7271
7271
  h + r / 2,
7272
- u + (n + b) / 2,
7272
+ m + (n + b) / 2,
7273
7273
  h + r / 2,
7274
- u + n
7274
+ m + n
7275
7275
  ), e.bezierCurveTo(
7276
7276
  h + r / 2,
7277
- u + (n + b) / 2,
7277
+ m + (n + b) / 2,
7278
7278
  h + r,
7279
- u + (n + b) / 2,
7279
+ m + (n + b) / 2,
7280
7280
  h + r,
7281
- u + b
7281
+ m + b
7282
7282
  ), e.bezierCurveTo(
7283
7283
  h + r,
7284
- u,
7284
+ m,
7285
7285
  h + r / 2,
7286
- u,
7286
+ m,
7287
7287
  h + r / 2,
7288
- u + b
7288
+ m + b
7289
7289
  ), 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());
7290
- }, Ie = (e, t) => {
7291
- const r = t.width / 2, n = t.height / 2, h = t.width / 2, u = t.height / 2;
7292
- e.beginPath(), e.ellipse(r, n, h, u, 0, 0, 2 * Math.PI), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
7293
7290
  }, Ae = (e, t) => {
7291
+ const r = t.width / 2, n = t.height / 2, h = t.width / 2, m = t.height / 2;
7292
+ e.beginPath(), e.ellipse(r, n, h, 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());
7293
+ }, Re = (e, t) => {
7294
7294
  const r = Math.min(t.width, t.height) * 0.1;
7295
7295
  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());
7296
- }, Re = (e, t) => {
7297
- 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();
7298
7296
  }, De = (e, t) => {
7297
+ 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();
7298
+ }, Ee = (e, t) => {
7299
7299
  const r = t.src || t.imageData;
7300
7300
  if (r)
7301
7301
  try {
@@ -7324,17 +7324,38 @@ const xi = _e((d, o) => {
7324
7324
  }
7325
7325
  else
7326
7326
  e.fillStyle = "#f8f8f8", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ddd", e.lineWidth = 1, e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#999", e.font = "14px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("No Image", t.width / 2, t.height / 2);
7327
- }, Ee = (e, t) => {
7328
- if (t.src && !t.imageLoading && !t.loadedImage) {
7329
- t.imageLoading = !0;
7330
- const r = new Image();
7331
- r.crossOrigin = "anonymous", r.onload = () => {
7332
- t.loadedImage = r, t.imageLoading = !1, X();
7333
- }, r.onerror = () => {
7334
- 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);
7335
- }, r.src = t.src;
7336
- } 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));
7337
7327
  }, Be = (e, t) => {
7328
+ const r = t.src;
7329
+ if (r)
7330
+ try {
7331
+ if (r instanceof HTMLImageElement) {
7332
+ if (r.complete && r.naturalWidth > 0 && r.naturalHeight > 0) {
7333
+ e.drawImage(r, 0, 0, t.width, t.height);
7334
+ return;
7335
+ }
7336
+ } else if (typeof r == "string" && r.length > 0) {
7337
+ if (t._stickerElement || (t._stickerElement = new Image(), t._stickerElement.crossOrigin = "anonymous", t._stickerElement.onload = () => {
7338
+ X();
7339
+ }, t._stickerElement.onerror = () => {
7340
+ console.error("Failed to load sticker:", r), t._stickerLoadError = !0, X();
7341
+ }, t._stickerElement.src = r), t._stickerElement.complete && t._stickerElement.naturalWidth > 0 && t._stickerElement.naturalHeight > 0) {
7342
+ e.drawImage(t._stickerElement, 0, 0, t.width, t.height);
7343
+ return;
7344
+ }
7345
+ if (t._stickerLoadError) {
7346
+ Rt(e, t, "Failed to load", !0);
7347
+ return;
7348
+ }
7349
+ }
7350
+ Rt(e, t, "Loading...");
7351
+ } catch (n) {
7352
+ console.error("Error drawing sticker:", n), Rt(e, t, "Error", !0);
7353
+ }
7354
+ else
7355
+ Rt(e, t, "No Sticker");
7356
+ }, Rt = (e, t, r, n = !1) => {
7357
+ e.fillStyle = n ? "#ffebee" : "#f8f9fa", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = n ? "#f44336" : "#dee2e6", e.lineWidth = 2, e.strokeRect(0, 0, t.width, t.height), e.fillStyle = n ? "#f44336" : "#6c757d", e.font = "12px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText(r, t.width / 2, t.height / 2);
7358
+ }, ze = (e, t) => {
7338
7359
  if (t.imageObject && t.imageObject.complete && t.imageObject.naturalHeight !== 0)
7339
7360
  try {
7340
7361
  e.drawImage(t.imageObject, 0, 0, t.width, t.height);
@@ -7352,11 +7373,11 @@ const xi = _e((d, o) => {
7352
7373
  } else t.imageLoading ? Ct(e, t, "Loading...") : Ct(e, t);
7353
7374
  }, Ct = (e, t, r = "Embroidery") => {
7354
7375
  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);
7355
- }, Gt = (e, t, r) => {
7376
+ }, _t = (e, t, r) => {
7356
7377
  if (!r) return !1;
7357
- const n = r.x + r.width / 2, h = r.y + r.height / 2, u = e - n, b = t - h, k = -(r.rotation || 0) * Math.PI / 180, v = Math.cos(k), R = Math.sin(k), D = u * v - b * R, M = u * R + b * v, tt = r.width / 2, xt = r.height / 2;
7358
- return D >= -tt && D <= tt && M >= -xt && M <= xt;
7359
- }, ze = ot(() => {
7378
+ const n = r.x + r.width / 2, h = r.y + r.height / 2, m = e - n, b = t - h, k = -(r.rotation || 0) * Math.PI / 180, v = Math.cos(k), R = Math.sin(k), D = m * v - b * R, L = m * R + b * v, tt = r.width / 2, xt = r.height / 2;
7379
+ return D >= -tt && D <= tt && L >= -xt && L <= xt;
7380
+ }, We = ot(() => {
7360
7381
  (C || I || w) && lt(), p(!1), T(!1), z(!1), B(null);
7361
7382
  const e = gt.current;
7362
7383
  e && (e.style.cursor = "default");
@@ -7365,30 +7386,30 @@ const xi = _e((d, o) => {
7365
7386
  const e = (t) => {
7366
7387
  if (l) return;
7367
7388
  const r = document.activeElement;
7368
- if (!(r && (r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.tagName === "SELECT" || r.isContentEditable)) && ((t.ctrlKey || t.metaKey) && (t.key === "z" && !t.shiftKey ? (t.preventDefault(), Ft()) : (t.key === "z" && t.shiftKey || t.key === "y") && (t.preventDefault(), bt())), (t.key === "Delete" || t.key === "Backspace") && g && (Wt(g.id), t.preventDefault()), (t.ctrlKey || t.metaKey) && t.key === "d" && g && (Yt(g.id), t.preventDefault()), g && ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(t.key))) {
7389
+ if (!(r && (r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.tagName === "SELECT" || r.isContentEditable)) && ((t.ctrlKey || t.metaKey) && (t.key === "z" && !t.shiftKey ? (t.preventDefault(), Ft()) : (t.key === "z" && t.shiftKey || t.key === "y") && (t.preventDefault(), bt())), (t.key === "Delete" || t.key === "Backspace") && g && (Mt(g.id), t.preventDefault()), (t.ctrlKey || t.metaKey) && t.key === "d" && g && (qt(g.id), t.preventDefault()), g && ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(t.key))) {
7369
7390
  t.preventDefault();
7370
7391
  const h = t.shiftKey ? 10 : 1;
7371
- let u = {};
7392
+ let m = {};
7372
7393
  switch (t.key) {
7373
7394
  case "ArrowUp":
7374
- u.y = g.y - h;
7395
+ m.y = g.y - h;
7375
7396
  break;
7376
7397
  case "ArrowDown":
7377
- u.y = g.y + h;
7398
+ m.y = g.y + h;
7378
7399
  break;
7379
7400
  case "ArrowLeft":
7380
- u.x = g.x - h;
7401
+ m.x = g.x - h;
7381
7402
  break;
7382
7403
  case "ArrowRight":
7383
- u.x = g.x + h;
7404
+ m.x = g.x + h;
7384
7405
  break;
7385
7406
  }
7386
- _t(g.id, u), lt();
7407
+ Yt(g.id, m), lt();
7387
7408
  }
7388
7409
  };
7389
7410
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
7390
7411
  }, [g, Ft, bt, l]);
7391
- const We = (e, t = {}) => {
7412
+ const Me = (e, t = {}) => {
7392
7413
  const r = {
7393
7414
  id: ct(),
7394
7415
  type: e,
@@ -7444,13 +7465,13 @@ const xi = _e((d, o) => {
7444
7465
  return;
7445
7466
  }
7446
7467
  y((n) => [...n, r]), F(r), lt();
7447
- }, _t = (e, t) => {
7468
+ }, Yt = (e, t) => {
7448
7469
  y((r) => r.map(
7449
7470
  (n) => n.id === e ? { ...n, ...t } : n
7450
7471
  )), g && g.id === e && F((r) => ({ ...r, ...t }));
7451
- }, Wt = ot(() => {
7472
+ }, Mt = ot(() => {
7452
7473
  g && (y((e) => e.filter((t) => t.id !== g.id)), F(null), lt());
7453
- }, [g, lt]), Yt = (e) => {
7474
+ }, [g, lt]), qt = (e) => {
7454
7475
  const t = c.find((r) => r.id === e);
7455
7476
  if (t) {
7456
7477
  const r = {
@@ -7461,8 +7482,8 @@ const xi = _e((d, o) => {
7461
7482
  };
7462
7483
  y((n) => [...n, r]), F(r), lt();
7463
7484
  }
7464
- }, qt = (e, t) => {
7465
- const r = c.findIndex((u) => u.id === e);
7485
+ }, Vt = (e, t) => {
7486
+ const r = c.findIndex((m) => m.id === e);
7466
7487
  if (r === -1) return;
7467
7488
  const n = [...c], h = n[r];
7468
7489
  t === "up" && r < n.length - 1 ? (n[r] = n[r + 1], n[r + 1] = h) : t === "down" && r > 0 ? (n[r] = n[r - 1], n[r - 1] = h) : t === "top" ? (n.splice(r, 1), n.push(h)) : t === "bottom" && (n.splice(r, 1), n.unshift(h)), y(n), lt();
@@ -7476,11 +7497,11 @@ const xi = _e((d, o) => {
7476
7497
  }
7477
7498
  }));
7478
7499
  }, [j, c, Y]);
7479
- const [, Le] = Ye((e) => e + 1, 0);
7500
+ const [, Le] = qe((e) => e + 1, 0);
7480
7501
  setTimeout(() => {
7481
7502
  Le();
7482
7503
  }, 20);
7483
- const Me = ot(() => {
7504
+ const Pe = ot(() => {
7484
7505
  j && Z((e) => ({
7485
7506
  ...e,
7486
7507
  [j.sectionName]: {
@@ -7489,14 +7510,14 @@ const xi = _e((d, o) => {
7489
7510
  }
7490
7511
  }));
7491
7512
  }, [j, c, Y]);
7492
- qe(o, () => ({
7493
- handleSectionChange: Vt,
7494
- flushCurrentSectionDesign: Me,
7513
+ Ve(o, () => ({
7514
+ handleSectionChange: Xt,
7515
+ flushCurrentSectionDesign: Pe,
7495
7516
  // Export methods that return download-ready data
7496
- exportPrintReady: async (e = "png") => await zt(e, !1),
7497
- exportFullDesign: async (e = "png") => await zt(e, !0),
7517
+ exportPrintReady: async (e = "png") => await Wt(e, !1),
7518
+ exportFullDesign: async (e = "png") => await Wt(e, !0),
7498
7519
  // Access to the existing exportDesign method
7499
- exportDesign: zt,
7520
+ exportDesign: Wt,
7500
7521
  // Get canvas data for custom exports
7501
7522
  getCanvasData: () => St(),
7502
7523
  // NEW: Export methods that return JSON with File objects
@@ -7510,15 +7531,15 @@ const xi = _e((d, o) => {
7510
7531
  }, h = {
7511
7532
  ...t.sectionDesigns || {},
7512
7533
  [r]: n
7513
- }, u = s.sections && s.sections.length > 0 ? s.sections : [{
7534
+ }, m = s.sections && s.sections.length > 0 ? s.sections : [{
7514
7535
  id: r,
7515
7536
  sectionName: r,
7516
7537
  image: j == null ? void 0 : j.sectionImage,
7517
7538
  sectionImage: j == null ? void 0 : j.sectionImage
7518
7539
  }];
7519
- return await Et.current.exportAllSectionsAsJSON(
7540
+ return await Bt.current.exportAllSectionsAsJSON(
7520
7541
  h,
7521
- u,
7542
+ m,
7522
7543
  W,
7523
7544
  U,
7524
7545
  e,
@@ -7531,23 +7552,23 @@ const xi = _e((d, o) => {
7531
7552
  exportCurrentSectionAsJSON: async (e = "png") => {
7532
7553
  try {
7533
7554
  const t = St();
7534
- return await Et.current.exportCurrentSectionAsJSON(t, e, yt);
7555
+ return await Bt.current.exportCurrentSectionAsJSON(t, e, yt);
7535
7556
  } catch (t) {
7536
7557
  throw console.error("Export current section as JSON failed:", t), t;
7537
7558
  }
7538
7559
  }
7539
7560
  }));
7540
- const mt = dt(null), Lt = dt(!1), X = ot(() => {
7561
+ const ut = dt(null), Lt = dt(!1), X = ot(() => {
7541
7562
  const e = gt.current;
7542
7563
  if (!e || Lt.current) return;
7543
7564
  Lt.current = !0;
7544
7565
  const t = e.getContext("2d");
7545
- t.clearRect(0, 0, W, U), wt.current && t.drawImage(wt.current, 0, 0, W, U), J && ye(t), c.forEach((r) => {
7566
+ t.clearRect(0, 0, W, U), wt.current && t.drawImage(wt.current, 0, 0, W, U), J && ue(t), c.forEach((r) => {
7546
7567
  t.save(), t.globalAlpha = r.opacity || 1, me(t, r), t.restore();
7547
- }), g && he(t, g), Lt.current = !1;
7568
+ }), g && ge(t, g), Lt.current = !1;
7548
7569
  }, [c, g, W, U, J]), vt = ot(() => {
7549
- mt.current && cancelAnimationFrame(mt.current), mt.current = requestAnimationFrame(() => {
7550
- X(), mt.current = null;
7570
+ ut.current && cancelAnimationFrame(ut.current), ut.current = requestAnimationFrame(() => {
7571
+ X(), ut.current = null;
7551
7572
  });
7552
7573
  }, [X]);
7553
7574
  et(() => {
@@ -7555,19 +7576,19 @@ const xi = _e((d, o) => {
7555
7576
  }, [c, g, W, U, J, vt]), et(() => {
7556
7577
  wt.current && vt();
7557
7578
  }, [wt.current, vt]), et(() => () => {
7558
- mt.current && cancelAnimationFrame(mt.current);
7579
+ ut.current && cancelAnimationFrame(ut.current);
7559
7580
  }, []);
7560
- const Mt = ot(() => {
7561
- X(), (C || I || w) && (mt.current = requestAnimationFrame(Mt));
7581
+ const Pt = ot(() => {
7582
+ X(), (C || I || w) && (ut.current = requestAnimationFrame(Pt));
7562
7583
  }, [X, C, I, w]);
7563
7584
  et(() => {
7564
- C || I || w ? Mt() : (mt.current && (cancelAnimationFrame(mt.current), mt.current = null), vt());
7565
- }, [C, I, w, Mt, vt]);
7566
- const Pe = ot((e) => {
7585
+ C || I || w ? Pt() : (ut.current && (cancelAnimationFrame(ut.current), ut.current = null), vt());
7586
+ }, [C, I, w, Pt, vt]);
7587
+ const Ue = ot((e) => {
7567
7588
  if (l) return;
7568
7589
  const r = gt.current.getBoundingClientRect(), n = (e.clientX - r.left) / q, h = (e.clientY - r.top) / q;
7569
7590
  if (S({ x: n, y: h }), g) {
7570
- const b = Ht(n, h, g);
7591
+ const b = Gt(n, h, g);
7571
7592
  if (b) {
7572
7593
  if (b === "rotate") {
7573
7594
  z(!0);
@@ -7590,59 +7611,59 @@ const xi = _e((d, o) => {
7590
7611
  return;
7591
7612
  }
7592
7613
  }
7593
- let u = null;
7614
+ let m = null;
7594
7615
  for (let b = c.length - 1; b >= 0; b--)
7595
- if (Gt(n, h, c[b])) {
7596
- u = c[b];
7616
+ if (_t(n, h, c[b])) {
7617
+ m = c[b];
7597
7618
  break;
7598
7619
  }
7599
- u ? (F(u), p(!0), S({
7620
+ m ? (F(m), p(!0), S({
7600
7621
  x: n,
7601
7622
  y: h,
7602
- offsetX: n - u.x,
7603
- offsetY: h - u.y
7623
+ offsetX: n - m.x,
7624
+ offsetY: h - m.y
7604
7625
  })) : F(null), X();
7605
- }, [l, q, g, c, X]), Ue = ot((e) => {
7626
+ }, [l, q, g, c, X]), Oe = ot((e) => {
7606
7627
  if (l) return;
7607
7628
  const t = gt.current, r = t.getBoundingClientRect(), n = (e.clientX - r.left) / q, h = (e.clientY - r.top) / q;
7608
7629
  if (g && !C && !I && !w) {
7609
- const u = Ht(n, h, g);
7610
- u ? u === "rotate" ? t.style.cursor = "grab" : t.style.cursor = u : Gt(n, h, g) ? t.style.cursor = "move" : t.style.cursor = "default";
7630
+ const m = Gt(n, h, g);
7631
+ m ? m === "rotate" ? t.style.cursor = "grab" : t.style.cursor = m : _t(n, h, g) ? t.style.cursor = "move" : t.style.cursor = "default";
7611
7632
  } else
7612
7633
  t.style.cursor = C ? "grabbing" : "default";
7613
7634
  if (w && g) {
7614
- const u = g.x + g.width / 2, b = g.y + g.height / 2, v = Math.atan2(h - b, n - u) * 180 / Math.PI - E.initialAngle;
7635
+ const m = g.x + g.width / 2, b = g.y + g.height / 2, v = Math.atan2(h - b, n - m) * 180 / Math.PI - E.initialAngle;
7615
7636
  let R = E.initialRotation + v;
7616
7637
  e.shiftKey && (R = Math.round(R / 15) * 15), R = (R % 360 + 360) % 360, y(
7617
7638
  (D) => D.map(
7618
- (M) => M.id === g.id ? { ...M, rotation: R } : M
7639
+ (L) => L.id === g.id ? { ...L, rotation: R } : L
7619
7640
  )
7620
7641
  ), F((D) => ({ ...D, rotation: R })), X();
7621
7642
  return;
7622
7643
  }
7623
7644
  if (I && g && $) {
7624
- const u = n - E.x, b = h - E.y;
7645
+ const m = n - E.x, b = h - E.y;
7625
7646
  let k = E.initialWidth, v = E.initialHeight, R = E.initialX, D = E.initialY;
7626
7647
  switch ($) {
7627
7648
  case "se-resize":
7628
- k = Math.max(20, E.initialWidth + u), v = Math.max(20, E.initialHeight + b);
7649
+ k = Math.max(20, E.initialWidth + m), v = Math.max(20, E.initialHeight + b);
7629
7650
  break;
7630
7651
  case "sw-resize":
7631
- k = Math.max(20, E.initialWidth - u), v = Math.max(20, E.initialHeight + b), R = E.initialX + (E.initialWidth - k);
7652
+ k = Math.max(20, E.initialWidth - m), v = Math.max(20, E.initialHeight + b), R = E.initialX + (E.initialWidth - k);
7632
7653
  break;
7633
7654
  case "ne-resize":
7634
- k = Math.max(20, E.initialWidth + u), v = Math.max(20, E.initialHeight - b), D = E.initialY + (E.initialHeight - v);
7655
+ k = Math.max(20, E.initialWidth + m), v = Math.max(20, E.initialHeight - b), D = E.initialY + (E.initialHeight - v);
7635
7656
  break;
7636
7657
  case "nw-resize":
7637
- k = Math.max(20, E.initialWidth - u), v = Math.max(20, E.initialHeight - b), R = E.initialX + (E.initialWidth - k), D = E.initialY + (E.initialHeight - v);
7658
+ k = Math.max(20, E.initialWidth - m), v = Math.max(20, E.initialHeight - b), R = E.initialX + (E.initialWidth - k), D = E.initialY + (E.initialHeight - v);
7638
7659
  break;
7639
7660
  }
7640
7661
  if (e.shiftKey && g.type !== "text") {
7641
7662
  const tt = E.initialWidth / E.initialHeight;
7642
7663
  $.includes("e"), v = k / tt, $.includes("n") && (D = E.initialY + (E.initialHeight - v));
7643
7664
  }
7644
- L && (R = ut(R), D = ut(D), k = ut(k), v = ut(v));
7645
- const M = {
7665
+ M && (R = mt(R), D = mt(D), k = mt(k), v = mt(v));
7666
+ const L = {
7646
7667
  ...g,
7647
7668
  x: R,
7648
7669
  y: D,
@@ -7651,17 +7672,17 @@ const xi = _e((d, o) => {
7651
7672
  };
7652
7673
  y(
7653
7674
  (tt) => tt.map(
7654
- (xt) => xt.id === g.id ? M : xt
7675
+ (xt) => xt.id === g.id ? L : xt
7655
7676
  )
7656
- ), F(M), X();
7677
+ ), F(L), X();
7657
7678
  return;
7658
7679
  }
7659
7680
  if (C && g) {
7660
- let u = n - E.offsetX, b = h - E.offsetY;
7661
- L && (u = ut(u), b = ut(b)), u = Math.max(0, Math.min(W - g.width, u)), b = Math.max(0, Math.min(U - g.height, b));
7681
+ let m = n - E.offsetX, b = h - E.offsetY;
7682
+ M && (m = mt(m), b = mt(b)), m = Math.max(0, Math.min(W - g.width, m)), b = Math.max(0, Math.min(U - g.height, b));
7662
7683
  const k = {
7663
7684
  ...g,
7664
- x: u,
7685
+ x: m,
7665
7686
  y: b
7666
7687
  };
7667
7688
  y(
@@ -7670,7 +7691,7 @@ const xi = _e((d, o) => {
7670
7691
  )
7671
7692
  ), F(k), X();
7672
7693
  }
7673
- }, [l, q, g, C, I, w, $, E, L, W, U, c, X]), Vt = ot((e) => {
7694
+ }, [l, q, g, C, I, w, $, E, M, W, U, c, X]), Xt = ot((e) => {
7674
7695
  j && Z((r) => ({
7675
7696
  ...r,
7676
7697
  [j.sectionName]: {
@@ -7690,7 +7711,7 @@ const xi = _e((d, o) => {
7690
7711
  const h = new Image();
7691
7712
  return h.onload = () => {
7692
7713
  y(
7693
- (u) => u.map(
7714
+ (m) => m.map(
7694
7715
  (b) => b.id === n.id ? { ...b, imageData: h } : b
7695
7716
  )
7696
7717
  ), X();
@@ -7701,8 +7722,8 @@ const xi = _e((d, o) => {
7701
7722
  y(r), O(t.selectedColor || Y);
7702
7723
  } else
7703
7724
  y([]);
7704
- m(e), F(null);
7705
- }, [j, c, Y, _, X]), Oe = ot((e) => {
7725
+ u(e), F(null);
7726
+ }, [j, c, Y, _, X]), Qe = ot((e) => {
7706
7727
  if (e && e.type.startsWith("image/")) {
7707
7728
  const t = new FileReader();
7708
7729
  t.onload = (r) => {
@@ -7711,8 +7732,8 @@ const xi = _e((d, o) => {
7711
7732
  const h = {
7712
7733
  id: ct(),
7713
7734
  type: "image",
7714
- x: ut(W / 2 - 100),
7715
- y: ut(U / 2 - 100),
7735
+ x: mt(W / 2 - 100),
7736
+ y: mt(U / 2 - 100),
7716
7737
  width: Math.min(n.width, 200),
7717
7738
  // Limit initial size
7718
7739
  height: Math.min(n.height, 200),
@@ -7721,8 +7742,8 @@ const xi = _e((d, o) => {
7721
7742
  src: r.target.result,
7722
7743
  originalWidth: n.width,
7723
7744
  originalHeight: n.height
7724
- }, u = n.width / n.height;
7725
- h.width / h.height !== u && (h.width / u <= 200 ? h.height = h.width / u : h.width = h.height * u), y((b) => [...b, h]), F(h), lt();
7745
+ }, m = n.width / n.height;
7746
+ h.width / h.height !== m && (h.width / m <= 200 ? h.height = h.width / m : h.width = h.height * m), y((b) => [...b, h]), F(h), lt();
7726
7747
  }, n.onerror = () => {
7727
7748
  console.error("Failed to load uploaded image"), alert("Failed to load the uploaded image. Please try again.");
7728
7749
  }, n.src = r.target.result;
@@ -7731,57 +7752,57 @@ const xi = _e((d, o) => {
7731
7752
  }, t.readAsDataURL(e);
7732
7753
  } else
7733
7754
  alert("Please select a valid image file.");
7734
- }, [W, U, ut, ct, lt]), Xt = ot(
7735
- Qe(() => {
7755
+ }, [W, U, mt, ct, lt]), Jt = ot(
7756
+ $e(() => {
7736
7757
  X();
7737
7758
  }, 16),
7738
7759
  // 60fps limit
7739
7760
  [X]
7740
7761
  );
7741
7762
  et(() => {
7742
- Bt.current || Xt();
7743
- }, [c, g, J, Xt]);
7744
- function Qe(e, t) {
7763
+ zt.current || Jt();
7764
+ }, [c, g, J, Jt]);
7765
+ function $e(e, t) {
7745
7766
  let r;
7746
7767
  return function(...h) {
7747
- const u = () => {
7768
+ const m = () => {
7748
7769
  clearTimeout(r), e(...h);
7749
7770
  };
7750
- clearTimeout(r), r = setTimeout(u, t);
7771
+ clearTimeout(r), r = setTimeout(m, t);
7751
7772
  };
7752
7773
  }
7753
7774
  et(() => {
7754
- kt.current && Jt(kt.current, Y);
7775
+ kt.current && Kt(kt.current, Y);
7755
7776
  }, [Y]), et(() => {
7756
7777
  X();
7757
7778
  }, [X]);
7758
- const $e = (e, t, r) => (0.2126 * e + 0.7152 * t + 0.0722 * r) / 255, Jt = ot((e, t) => {
7759
- const r = Ut.current, n = r.getContext("2d");
7779
+ const He = (e, t, r) => (0.2126 * e + 0.7152 * t + 0.0722 * r) / 255, Kt = ot((e, t) => {
7780
+ const r = Ot.current, n = r.getContext("2d");
7760
7781
  r.width = W, r.height = U, n.clearRect(0, 0, W, U), n.drawImage(e, 0, 0, W, U);
7761
- const h = n.getImageData(0, 0, W, U), u = h.data, b = xe(t);
7782
+ const h = n.getImageData(0, 0, W, U), m = h.data, b = ye(t);
7762
7783
  if (!b) {
7763
- Bt.current = !1;
7784
+ zt.current = !1;
7764
7785
  return;
7765
7786
  }
7766
7787
  const { r: k, g: v, b: R } = b;
7767
- for (let M = 0; M < u.length; M += 4) {
7768
- if (u[M + 3] === 0) continue;
7769
- const xt = $e(u[M], u[M + 1], u[M + 2]);
7770
- u[M] = Math.round(k * xt), u[M + 1] = Math.round(v * xt), u[M + 2] = Math.round(R * xt);
7788
+ for (let L = 0; L < m.length; L += 4) {
7789
+ if (m[L + 3] === 0) continue;
7790
+ const xt = He(m[L], m[L + 1], m[L + 2]);
7791
+ m[L] = Math.round(k * xt), m[L + 1] = Math.round(v * xt), m[L + 2] = Math.round(R * xt);
7771
7792
  }
7772
7793
  n.putImageData(h, 0, 0);
7773
7794
  const D = new Image();
7774
7795
  D.onload = () => {
7775
- wt.current = s.plainColor === "Y" ? D : e, Bt.current = !1, X();
7796
+ wt.current = s.plainColor === "Y" ? D : e, zt.current = !1, X();
7776
7797
  }, D.src = r.toDataURL("image/png");
7777
- }, [W, U, X]), Kt = (e) => {
7798
+ }, [W, U, X]), Zt = (e) => {
7778
7799
  if (!K) return { horizontal: [], vertical: [] };
7779
7800
  const t = document.querySelector(".ruler-horizontal"), r = document.querySelector(".ruler-vertical");
7780
7801
  if (!t || !r)
7781
7802
  return { horizontal: [], vertical: [] };
7782
- const n = t.getBoundingClientRect(), h = r.getBoundingClientRect(), u = n.width, b = h.height, k = 50, v = [], R = [];
7783
- for (let D = k; D <= u; D += k)
7784
- D <= u - 20 && v.push({
7803
+ const n = t.getBoundingClientRect(), h = r.getBoundingClientRect(), m = n.width, b = h.height, k = 50, v = [], R = [];
7804
+ for (let D = k; D <= m; D += k)
7805
+ D <= m - 20 && v.push({
7785
7806
  position: D,
7786
7807
  value: Math.round(D / e)
7787
7808
  });
@@ -7791,12 +7812,12 @@ const xi = _e((d, o) => {
7791
7812
  value: Math.round(D / e)
7792
7813
  });
7793
7814
  return { horizontal: v, vertical: R };
7794
- }, [Zt, te] = N({ horizontal: [], vertical: [] });
7815
+ }, [te, ee] = N({ horizontal: [], vertical: [] });
7795
7816
  return et(() => {
7796
7817
  const e = () => {
7797
7818
  setTimeout(() => {
7798
- const n = Kt(q);
7799
- te(n);
7819
+ const n = Zt(q);
7820
+ ee(n);
7800
7821
  }, 50);
7801
7822
  };
7802
7823
  e();
@@ -7810,29 +7831,29 @@ const xi = _e((d, o) => {
7810
7831
  }, [q, K]), et(() => {
7811
7832
  if (K && !A) {
7812
7833
  const e = setTimeout(() => {
7813
- const t = Kt(q);
7814
- te(t);
7834
+ const t = Zt(q);
7835
+ ee(t);
7815
7836
  }, 100);
7816
7837
  return () => clearTimeout(e);
7817
7838
  }
7818
7839
  }, [K, A, q]), /* @__PURE__ */ i.jsxs("div", { className: "pure-canvas-designer", children: [
7819
7840
  /* @__PURE__ */ i.jsx("div", { className: "designer-header", children: /* @__PURE__ */ i.jsx(
7820
- ci,
7841
+ di,
7821
7842
  {
7822
- onAddElement: We,
7823
- onDeleteElement: () => g && Wt(g.id),
7824
- onDuplicateElement: () => g && Yt(g.id),
7843
+ onAddElement: Me,
7844
+ onDeleteElement: () => g && Mt(g.id),
7845
+ onDuplicateElement: () => g && qt(g.id),
7825
7846
  onUndo: Ft,
7826
7847
  onRedo: bt,
7827
7848
  onToggleGrid: () => st(!J),
7828
7849
  onToggleRulers: () => it(!K),
7829
- onToggleSnap: () => G(!L),
7830
- onImageUpload: Oe,
7850
+ onToggleSnap: () => G(!M),
7851
+ onImageUpload: Qe,
7831
7852
  canUndo: H > 0,
7832
7853
  canRedo: H < V.length - 1,
7833
7854
  showGrid: J,
7834
7855
  showRulers: K,
7835
- snapToGrid: L,
7856
+ snapToGrid: M,
7836
7857
  selectedElement: g,
7837
7858
  theme: a,
7838
7859
  readOnly: l,
@@ -7842,7 +7863,7 @@ const xi = _e((d, o) => {
7842
7863
  ) }),
7843
7864
  /* @__PURE__ */ i.jsxs("div", { className: "designer-content", children: [
7844
7865
  K && !A && /* @__PURE__ */ i.jsxs("div", { className: "rulers", children: [
7845
- /* @__PURE__ */ i.jsx("div", { className: "ruler-horizontal", children: /* @__PURE__ */ i.jsx("div", { className: "ruler-horizontal-numbers", children: Zt.horizontal.map((e, t) => /* @__PURE__ */ i.jsx(
7866
+ /* @__PURE__ */ i.jsx("div", { className: "ruler-horizontal", children: /* @__PURE__ */ i.jsx("div", { className: "ruler-horizontal-numbers", children: te.horizontal.map((e, t) => /* @__PURE__ */ i.jsx(
7846
7867
  "span",
7847
7868
  {
7848
7869
  className: "ruler-number horizontal",
@@ -7851,7 +7872,7 @@ const xi = _e((d, o) => {
7851
7872
  },
7852
7873
  t
7853
7874
  )) }) }),
7854
- /* @__PURE__ */ i.jsx("div", { className: "ruler-vertical", children: /* @__PURE__ */ i.jsx("div", { className: "ruler-vertical-numbers", children: Zt.vertical.map((e, t) => /* @__PURE__ */ i.jsx(
7875
+ /* @__PURE__ */ i.jsx("div", { className: "ruler-vertical", children: /* @__PURE__ */ i.jsx("div", { className: "ruler-vertical-numbers", children: te.vertical.map((e, t) => /* @__PURE__ */ i.jsx(
7855
7876
  "span",
7856
7877
  {
7857
7878
  className: "ruler-number vertical",
@@ -7861,15 +7882,15 @@ const xi = _e((d, o) => {
7861
7882
  t
7862
7883
  )) }) })
7863
7884
  ] }),
7864
- /* @__PURE__ */ i.jsx("div", { className: "canvas-container", ref: Dt, children: /* @__PURE__ */ i.jsx(
7885
+ /* @__PURE__ */ i.jsx("div", { className: "canvas-container", ref: Et, children: /* @__PURE__ */ i.jsx(
7865
7886
  "canvas",
7866
7887
  {
7867
7888
  ref: gt,
7868
7889
  width: W,
7869
7890
  height: U,
7870
- onMouseDown: Pe,
7871
- onMouseMove: Ue,
7872
- onMouseUp: ze,
7891
+ onMouseDown: Ue,
7892
+ onMouseMove: Oe,
7893
+ onMouseUp: We,
7873
7894
  style: {
7874
7895
  border: "1px solid #e2e8f0",
7875
7896
  cursor: C ? "grabbing" : "default",
@@ -7880,23 +7901,23 @@ const xi = _e((d, o) => {
7880
7901
  ) }),
7881
7902
  /* @__PURE__ */ i.jsxs("div", { className: "side-panels", children: [
7882
7903
  /* @__PURE__ */ i.jsx(
7883
- di,
7904
+ fi,
7884
7905
  {
7885
7906
  selectedElement: g,
7886
- onUpdate: _t,
7887
- onMoveLayer: qt,
7888
- availableFonts: fe,
7907
+ onUpdate: Yt,
7908
+ onMoveLayer: Vt,
7909
+ availableFonts: he,
7889
7910
  theme: a
7890
7911
  }
7891
7912
  ),
7892
7913
  /* @__PURE__ */ i.jsx(
7893
- fi,
7914
+ hi,
7894
7915
  {
7895
7916
  elements: c,
7896
7917
  selectedElement: g,
7897
7918
  onSelectElement: F,
7898
- onMoveLayer: qt,
7899
- onDeleteElement: Wt,
7919
+ onMoveLayer: Vt,
7920
+ onDeleteElement: Mt,
7900
7921
  theme: a
7901
7922
  }
7902
7923
  )
@@ -7917,7 +7938,7 @@ const xi = _e((d, o) => {
7917
7938
  onClick: (r) => {
7918
7939
  r.stopPropagation();
7919
7940
  const n = s.sections.find((h) => h.sectionName === e.sectionName);
7920
- Vt(n);
7941
+ Xt(n);
7921
7942
  },
7922
7943
  title: e.sectionName,
7923
7944
  children: [
@@ -8077,7 +8098,7 @@ const xi = _e((d, o) => {
8077
8098
  ] })
8078
8099
  ] });
8079
8100
  });
8080
- xi.displayName = "Mypixia";
8101
+ yi.displayName = "Mypixia";
8081
8102
  export {
8082
- xi as default
8103
+ yi as default
8083
8104
  };