@fraczled/sdk 1.30.58 → 1.30.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import { g as q, b as V, a as B, t as I, c as Z, d as R, e as Q, f as K, h as m, i as J, j as x, k as nt, l as it, m as at, s as lt, n as ct, E as H, o as ft, p as tt, q as ot, r as ht } from "./index-CshG7pKg.js";
2
- const dt = {
1
+ import { g as q, b as V, a as B, t as R, c as Z, d as I, e as Q, f as K, h as m, i as J, j as x, k as at, l as it, m as lt, s as ct, n as ft, E as H, o as ht, p as tt, q as ot, r as st, u as dt } from "./index-1ZLOWYyw.js";
2
+ const ut = {
3
3
  normal: "source-over",
4
4
  dissolve: "source-over",
5
5
  darken: "darken",
@@ -27,56 +27,56 @@ const dt = {
27
27
  saturation: "saturation",
28
28
  color: "color",
29
29
  luminosity: "luminosity"
30
- }, ut = (t) => t && dt[t] || "source-over", gt = (t = "behind") => {
30
+ }, gt = (t) => t && ut[t] || "source-over", pt = (t = "behind") => {
31
31
  const o = ["adjustments"];
32
32
  return t === "behind" && o.push("stroke-behind"), o.push("effect", "fill"), t === "front" && o.push("stroke-front"), o;
33
- }, pt = (t, o) => !o || o === "none" ? t : o === "uppercase" ? t.toUpperCase() : o === "lowercase" ? t.toLowerCase() : o === "capitalize" ? t.replace(/\b\w/g, (s) => s.toUpperCase()) : t, X = (t, o, s) => o ? t.measureText(o).width + (o.length > 1 ? s * (o.length - 1) : 0) : 0, yt = (t, o, s, n) => {
34
- const i = [], r = o.split(`
33
+ }, yt = (t, o) => !o || o === "none" ? t : o === "uppercase" ? t.toUpperCase() : o === "lowercase" ? t.toLowerCase() : o === "capitalize" ? t.replace(/\b\w/g, (s) => s.toUpperCase()) : t, X = (t, o, s) => o ? t.measureText(o).width + (o.length > 1 ? s * (o.length - 1) : 0) : 0, wt = (t, o, s, r) => {
34
+ const a = [], n = o.split(`
35
35
  `);
36
- return r.forEach((a, l) => {
36
+ return n.forEach((i, l) => {
37
37
  if (s === void 0 || s <= 0) {
38
- i.push({ text: a, width: X(t, a, n) }), l < r.length - 1 && a === "" && i.push({ text: "", width: 0 });
38
+ a.push({ text: i, width: X(t, i, r) }), l < n.length - 1 && i === "" && a.push({ text: "", width: 0 });
39
39
  return;
40
40
  }
41
- const e = a.split(/(\s+)/).filter((h) => h.length > 0);
41
+ const e = i.split(/(\s+)/).filter((h) => h.length > 0);
42
42
  let c = "";
43
43
  e.forEach((h) => {
44
44
  const d = c + h;
45
- if (!c && (X(t, h, n) <= s || h.trim() === "")) {
45
+ if (!c && (X(t, h, r) <= s || h.trim() === "")) {
46
46
  c = h;
47
47
  return;
48
48
  }
49
- if (X(t, d, n) <= s) {
49
+ if (X(t, d, r) <= s) {
50
50
  c = d;
51
51
  return;
52
52
  }
53
- if (c && i.push({ text: c, width: X(t, c, n) }), X(t, h, n) <= s) {
53
+ if (c && a.push({ text: c, width: X(t, c, r) }), X(t, h, r) <= s) {
54
54
  c = h;
55
55
  return;
56
56
  }
57
57
  let f = "";
58
58
  for (const g of h) {
59
59
  const b = f + g;
60
- if (!f || X(t, b, n) <= s) {
60
+ if (!f || X(t, b, r) <= s) {
61
61
  f = b;
62
62
  continue;
63
63
  }
64
- i.push({ text: f, width: X(t, f, n) }), f = g;
64
+ a.push({ text: f, width: X(t, f, r) }), f = g;
65
65
  }
66
66
  c = f;
67
- }), c && i.push({ text: c, width: X(t, c, n) }), l < r.length - 1 && a === "" && i.push({ text: "", width: 0 });
68
- }), i;
69
- }, wt = (t, o, s) => {
70
- const n = o.fontSize || 24, i = nt(
71
- n,
67
+ }), c && a.push({ text: c, width: X(t, c, r) }), l < n.length - 1 && i === "" && a.push({ text: "", width: 0 });
68
+ }), a;
69
+ }, bt = (t, o, s) => {
70
+ const r = o.fontSize || 24, a = at(
71
+ r,
72
72
  o.fontFamily || "sans-serif",
73
73
  o.fontWeight || "normal",
74
74
  o.fontStyle || "normal"
75
- ), r = (o.lineHeight ?? 1.4) * n, a = (o.letterSpacing ?? 0) * n, l = o.textAlign || "left", e = o.autoWidth ? void 0 : s, c = pt(o.content || "", o.textTransform);
76
- t.save(), t.font = i;
77
- const h = yt(t, c, e, a), d = it({
75
+ ), n = (o.lineHeight ?? 1.4) * r, i = (o.letterSpacing ?? 0) * r, l = o.textAlign || "left", e = o.autoWidth ? void 0 : s, c = yt(o.content || "", o.textTransform);
76
+ t.save(), t.font = a;
77
+ const h = wt(t, c, e, i), d = it({
78
78
  ctx: t,
79
- fontSize: n,
79
+ fontSize: r,
80
80
  fontFamily: o.fontFamily || "sans-serif",
81
81
  fontWeight: o.fontWeight || "normal",
82
82
  fontStyle: o.fontStyle || "normal",
@@ -85,39 +85,39 @@ const dt = {
85
85
  });
86
86
  return t.restore(), {
87
87
  lines: h,
88
- lineHeight: r,
89
- letterSpacing: a,
88
+ lineHeight: n,
89
+ letterSpacing: i,
90
90
  width: s,
91
91
  align: l,
92
- font: i,
92
+ font: a,
93
93
  offsetY: d.baselineOffset
94
94
  };
95
- }, _ = (t, o, s, n, i, r) => {
95
+ }, _ = (t, o, s, r, a, n) => {
96
96
  if (!o) return;
97
- if (i === 0) {
98
- r === "fill" ? t.fillText(o, s, n) : t.strokeText(o, s, n);
97
+ if (a === 0) {
98
+ n === "fill" ? t.fillText(o, s, r) : t.strokeText(o, s, r);
99
99
  return;
100
100
  }
101
- let a = s;
101
+ let i = s;
102
102
  for (const l of o)
103
- r === "fill" ? t.fillText(l, a, n) : t.strokeText(l, a, n), a += t.measureText(l).width + i;
103
+ n === "fill" ? t.fillText(l, i, r) : t.strokeText(l, i, r), i += t.measureText(l).width + a;
104
104
  }, C = (t, o, s) => {
105
- const { lines: n, lineHeight: i, letterSpacing: r, width: a, align: l, font: e } = o, c = s.offsetX ?? 0, h = (o.offsetY ?? 0) + (s.offsetY ?? 0);
106
- t.save(), t.font = e, t.textBaseline = "alphabetic", t.textAlign = "left", s.fillStyle && (t.fillStyle = s.fillStyle), s.strokeStyle && s.strokeWidth && (t.strokeStyle = s.strokeStyle, t.lineWidth = s.strokeWidth, t.lineJoin = s.lineJoin ?? "round", t.lineCap = s.lineCap ?? "round"), n.forEach((d, p) => {
107
- const u = p * i + h, f = d.width;
105
+ const { lines: r, lineHeight: a, letterSpacing: n, width: i, align: l, font: e } = o, c = s.offsetX ?? 0, h = (o.offsetY ?? 0) + (s.offsetY ?? 0);
106
+ t.save(), t.font = e, t.textBaseline = "alphabetic", t.textAlign = "left", s.fillStyle && (t.fillStyle = s.fillStyle), s.strokeStyle && s.strokeWidth && (t.strokeStyle = s.strokeStyle, t.lineWidth = s.strokeWidth, t.lineJoin = s.lineJoin ?? "round", t.lineCap = s.lineCap ?? "round"), r.forEach((d, p) => {
107
+ const u = p * a + h, f = d.width;
108
108
  let g = c;
109
- l === "center" ? g = a / 2 - f / 2 + c : l === "right" && (g = a - f + c), s.strokeStyle && s.strokeWidth && _(t, d.text, g, u, r, "stroke"), s.fillStyle && _(t, d.text, g, u, r, "fill");
109
+ l === "center" ? g = i / 2 - f / 2 + c : l === "right" && (g = i - f + c), s.strokeStyle && s.strokeWidth && _(t, d.text, g, u, n, "stroke"), s.fillStyle && _(t, d.text, g, u, n, "fill");
110
110
  }), t.restore();
111
- }, bt = (t, o, s, n, i, r) => {
112
- const a = (n - 90) * Math.PI / 180, l = Math.cos(a), e = Math.sin(a), c = o / 2 - l * (o / 2), h = s / 2 - e * (s / 2), d = o / 2 + l * (o / 2), p = s / 2 + e * (s / 2), u = t.createLinearGradient(c, h, d, p);
113
- return u.addColorStop(0, i), u.addColorStop(1, r), u;
114
- }, kt = (t, o, s) => {
115
- const { lines: n, lineHeight: i, width: r, align: a } = o, l = s.spread, e = Math.max(0, s.roundness);
116
- n.forEach((c, h) => {
111
+ }, kt = (t, o, s, r, a, n) => {
112
+ const i = (r - 90) * Math.PI / 180, l = Math.cos(i), e = Math.sin(i), c = o / 2 - l * (o / 2), h = s / 2 - e * (s / 2), d = o / 2 + l * (o / 2), p = s / 2 + e * (s / 2), u = t.createLinearGradient(c, h, d, p);
113
+ return u.addColorStop(0, a), u.addColorStop(1, n), u;
114
+ }, St = (t, o, s) => {
115
+ const { lines: r, lineHeight: a, width: n, align: i } = o, l = s.spread, e = Math.max(0, s.roundness);
116
+ r.forEach((c, h) => {
117
117
  const d = c.width;
118
118
  let p = 0;
119
- a === "center" ? p = r / 2 - d / 2 : a === "right" && (p = r - d);
120
- const u = h * i, f = p - l, g = u, b = d + l * 2, v = i;
119
+ i === "center" ? p = n / 2 - d / 2 : i === "right" && (p = n - d);
120
+ const u = h * a, f = p - l, g = u, b = d + l * 2, v = a;
121
121
  if (t.save(), t.fillStyle = s.fillStyle, t.beginPath(), e <= 0)
122
122
  t.rect(f, g, b, v);
123
123
  else {
@@ -126,45 +126,45 @@ const dt = {
126
126
  }
127
127
  t.fill(), t.restore();
128
128
  });
129
- }, j = (t, o, s, n, i, r) => {
129
+ }, j = (t, o, s, r, a, n) => {
130
130
  var T;
131
- const a = wt(t, o, s);
132
- if (a.lines.length === 0) return;
133
- const l = o.color || "#000000", e = q(r, l), c = V((T = o.effect) == null ? void 0 : T.adjustments), h = r.blurAmount ?? 5, d = i === "blur" ? `${c} blur(${h}px)` : c, p = o.textStrokeWidth ?? 0, u = o.textStrokeColor || "#000000", f = o.textStrokePosition || "behind", g = o.textStrokeStyle || "round", b = g === "round" ? "round" : "miter", v = g === "round" ? "round" : "butt", w = () => {
134
- p <= 0 || C(t, a, {
131
+ const i = bt(t, o, s);
132
+ if (i.lines.length === 0) return;
133
+ const l = o.color || "#000000", e = q(n, l), c = V((T = o.effect) == null ? void 0 : T.adjustments), h = n.blurAmount ?? 5, d = a === "blur" ? `${c} blur(${h}px)` : c, p = o.textStrokeWidth ?? 0, u = o.textStrokeColor || "#000000", f = o.textStrokePosition || "behind", g = o.textStrokeStyle || "round", b = g === "round" ? "round" : "miter", v = g === "round" ? "round" : "butt", w = () => {
134
+ p <= 0 || C(t, i, {
135
135
  strokeStyle: u,
136
136
  strokeWidth: p,
137
137
  lineJoin: b,
138
138
  lineCap: v
139
139
  });
140
- }, M = gt(f === "front" ? "front" : "behind");
141
- t.save(), t.filter = d, M.forEach((D) => {
140
+ }, P = pt(f === "front" ? "front" : "behind");
141
+ t.save(), t.filter = d, P.forEach((D) => {
142
142
  switch (D) {
143
143
  case "stroke-behind":
144
144
  w();
145
145
  break;
146
146
  case "effect": {
147
- switch (i) {
147
+ switch (a) {
148
148
  case "shadow": {
149
- const { offsetX: y, offsetY: S } = R(r), P = r.blur ?? 0, Y = B(r), k = I(e, Y);
150
- t.save(), t.shadowColor = k, t.shadowBlur = P, t.shadowOffsetX = y, t.shadowOffsetY = S, C(t, a, { fillStyle: l }), t.restore();
149
+ const { offsetX: y, offsetY: S } = I(n), M = n.blur ?? 0, Y = B(n), k = R(e, Y);
150
+ t.save(), t.shadowColor = k, t.shadowBlur = M, t.shadowOffsetX = y, t.shadowOffsetY = S, C(t, i, { fillStyle: l }), t.restore();
151
151
  break;
152
152
  }
153
153
  case "lift": {
154
- const y = x(r), S = `rgba(0,0,0, ${0.5 * y})`;
155
- t.save(), t.shadowColor = S, t.shadowBlur = 20 * y, t.shadowOffsetX = 0, t.shadowOffsetY = 10 * y, C(t, a, { fillStyle: l }), t.restore();
154
+ const y = x(n), S = `rgba(0,0,0, ${0.5 * y})`;
155
+ t.save(), t.shadowColor = S, t.shadowBlur = 20 * y, t.shadowOffsetX = 0, t.shadowOffsetY = 10 * y, C(t, i, { fillStyle: l }), t.restore();
156
156
  break;
157
157
  }
158
158
  case "neon": {
159
- const y = J(r), S = r.textColor || "#ffffff";
160
- t.save(), [y * 5, y * 3, y].forEach((P) => {
161
- t.shadowColor = e, t.shadowBlur = P, t.shadowOffsetX = 0, t.shadowOffsetY = 0, C(t, a, { fillStyle: S });
162
- }), C(t, a, { fillStyle: S }), t.restore();
159
+ const y = J(n), S = n.textColor || "#ffffff";
160
+ t.save(), [y * 5, y * 3, y].forEach((M) => {
161
+ t.shadowColor = e, t.shadowBlur = M, t.shadowOffsetX = 0, t.shadowOffsetY = 0, C(t, i, { fillStyle: S });
162
+ }), C(t, i, { fillStyle: S }), t.restore();
163
163
  break;
164
164
  }
165
165
  case "outline": {
166
- const y = m(r);
167
- C(t, a, {
166
+ const y = m(n);
167
+ C(t, i, {
168
168
  strokeStyle: e,
169
169
  strokeWidth: y,
170
170
  lineJoin: "round",
@@ -174,8 +174,8 @@ const dt = {
174
174
  break;
175
175
  }
176
176
  case "hollow": {
177
- const y = K(r);
178
- C(t, a, {
177
+ const y = K(n);
178
+ C(t, i, {
179
179
  strokeStyle: e,
180
180
  strokeWidth: y,
181
181
  lineJoin: "round",
@@ -184,13 +184,13 @@ const dt = {
184
184
  break;
185
185
  }
186
186
  case "splice": {
187
- const y = Q(r), { offsetX: S, offsetY: P } = R(r);
188
- t.save(), t.shadowColor = "rgba(0,0,0,0.2)", t.shadowBlur = 0, t.shadowOffsetX = S, t.shadowOffsetY = P, C(t, a, {
187
+ const y = Q(n), { offsetX: S, offsetY: M } = I(n);
188
+ t.save(), t.shadowColor = "rgba(0,0,0,0.2)", t.shadowBlur = 0, t.shadowOffsetX = S, t.shadowOffsetY = M, C(t, i, {
189
189
  strokeStyle: e,
190
190
  strokeWidth: y,
191
191
  lineJoin: "round",
192
192
  lineCap: "round"
193
- }), t.restore(), C(t, a, {
193
+ }), t.restore(), C(t, i, {
194
194
  strokeStyle: e,
195
195
  strokeWidth: y,
196
196
  lineJoin: "round",
@@ -199,54 +199,54 @@ const dt = {
199
199
  break;
200
200
  }
201
201
  case "echo": {
202
- const { offsetX: y, offsetY: S } = R(r);
203
- C(t, a, { fillStyle: I(e, 0.5), offsetX: y, offsetY: S }), C(t, a, {
204
- fillStyle: I(e, 0.3),
202
+ const { offsetX: y, offsetY: S } = I(n);
203
+ C(t, i, { fillStyle: R(e, 0.5), offsetX: y, offsetY: S }), C(t, i, {
204
+ fillStyle: R(e, 0.3),
205
205
  offsetX: y * 2,
206
206
  offsetY: S * 2
207
- }), C(t, a, { fillStyle: l });
207
+ }), C(t, i, { fillStyle: l });
208
208
  break;
209
209
  }
210
210
  case "glitch": {
211
- const y = Z(r);
212
- C(t, a, { fillStyle: "#0ea5e9", offsetX: -y, offsetY: 0 }), C(t, a, { fillStyle: "#f43f5e", offsetX: y, offsetY: 0 }), C(t, a, { fillStyle: l });
211
+ const y = Z(n);
212
+ C(t, i, { fillStyle: "#0ea5e9", offsetX: -y, offsetY: 0 }), C(t, i, { fillStyle: "#f43f5e", offsetX: y, offsetY: 0 }), C(t, i, { fillStyle: l });
213
213
  break;
214
214
  }
215
215
  case "blur": {
216
- C(t, a, { fillStyle: l });
216
+ C(t, i, { fillStyle: l });
217
217
  break;
218
218
  }
219
219
  case "duotone": {
220
- const y = r.duotoneLight || "#f472b6", S = r.duotoneDark || "#1e40af";
221
- C(t, a, { fillStyle: y, offsetX: 1, offsetY: 1 }), C(t, a, { fillStyle: y, offsetX: -1, offsetY: -1 }), C(t, a, { fillStyle: S });
220
+ const y = n.duotoneLight || "#f472b6", S = n.duotoneDark || "#1e40af";
221
+ C(t, i, { fillStyle: y, offsetX: 1, offsetY: 1 }), C(t, i, { fillStyle: y, offsetX: -1, offsetY: -1 }), C(t, i, { fillStyle: S });
222
222
  break;
223
223
  }
224
224
  case "reflection": {
225
- const y = (r.reflectionOpacity ?? 50) / 100, S = r.reflectionDistance ?? 5, P = `rgba(0,0,0, ${y * 0.3})`;
226
- t.save(), t.shadowColor = P, t.shadowBlur = S, t.shadowOffsetX = 0, t.shadowOffsetY = S + 10, C(t, a, { fillStyle: l }), t.restore();
225
+ const y = (n.reflectionOpacity ?? 50) / 100, S = n.reflectionDistance ?? 5, M = `rgba(0,0,0, ${y * 0.3})`;
226
+ t.save(), t.shadowColor = M, t.shadowBlur = S, t.shadowOffsetX = 0, t.shadowOffsetY = S + 10, C(t, i, { fillStyle: l }), t.restore();
227
227
  break;
228
228
  }
229
229
  case "background": {
230
- const y = B(r), S = (r.spread ?? 50) / 5, P = (r.roundness ?? 0) / 2;
231
- kt(t, a, {
232
- fillStyle: I(e, y),
230
+ const y = B(n), S = (n.spread ?? 50) / 5, M = (n.roundness ?? 0) / 2;
231
+ St(t, i, {
232
+ fillStyle: R(e, y),
233
233
  spread: S,
234
- roundness: P
234
+ roundness: M
235
235
  });
236
236
  break;
237
237
  }
238
238
  case "gradient_overlay": {
239
- const y = r.gradientColor1 || "#667eea", S = r.gradientColor2 || "#764ba2", P = r.gradientAngle || 135, Y = bt(t, s, n, P, y, S);
240
- C(t, a, { fillStyle: Y });
239
+ const y = n.gradientColor1 || "#667eea", S = n.gradientColor2 || "#764ba2", M = n.gradientAngle || 135, Y = kt(t, s, r, M, y, S);
240
+ C(t, i, { fillStyle: Y });
241
241
  break;
242
242
  }
243
243
  default:
244
- C(t, a, { fillStyle: l });
244
+ C(t, i, { fillStyle: l });
245
245
  }
246
246
  break;
247
247
  }
248
248
  case "fill":
249
- i === "background" && C(t, a, { fillStyle: l });
249
+ a === "background" && C(t, i, { fillStyle: l });
250
250
  break;
251
251
  case "stroke-front":
252
252
  w();
@@ -262,106 +262,106 @@ const dt = {
262
262
  arrow: "0,35 60,35 60,15 100,50 60,85 60,65 0,65",
263
263
  heart: "50,20 55,15 65,10 80,10 95,25 95,45 50,90 5,45 5,25 20,10 35,10 45,15"
264
264
  }, L = (t, o, s) => {
265
- const n = document.createElement("canvas");
266
- n.width = Math.max(1, Math.ceil(t * s)), n.height = Math.max(1, Math.ceil(o * s));
267
- const i = n.getContext("2d");
268
- if (!i)
265
+ const r = document.createElement("canvas");
266
+ r.width = Math.max(1, Math.ceil(t * s)), r.height = Math.max(1, Math.ceil(o * s));
267
+ const a = r.getContext("2d");
268
+ if (!a)
269
269
  throw new Error("Failed to get canvas context");
270
- return i.setTransform(1, 0, 0, 1, 0, 0), i.scale(s, s), { canvas: n, ctx: i };
270
+ return a.setTransform(1, 0, 0, 1, 0, 0), a.scale(s, s), { canvas: r, ctx: a };
271
271
  }, z = (t) => {
272
272
  if (!t)
273
273
  return { x: 0, y: 0, width: 0, height: 0 };
274
274
  const o = t.split(/[\s,]+/).map((s) => Number.parseFloat(s)).filter((s) => !Number.isNaN(s));
275
275
  return o.length >= 4 ? { x: o[0], y: o[1], width: o[2], height: o[3] } : { x: 0, y: 0, width: 0, height: 0 };
276
- }, St = (t) => {
276
+ }, Ct = (t) => {
277
277
  try {
278
- let o = "linear", s = 90, n = "";
278
+ let o = "linear", s = 90, r = "";
279
279
  if (t.includes("radial-gradient")) {
280
280
  o = "radial";
281
- const r = t.match(/radial-gradient\((.*)\)/);
282
- if (!r) return null;
283
- const l = r[1].split(/,(?![^()]*\))/).map((e) => e.trim());
284
- l[0].includes("circle") || l[0].includes("ellipse") || l[0].includes("at ") ? n = l.slice(1).join(",") : n = l.join(",");
281
+ const n = t.match(/radial-gradient\((.*)\)/);
282
+ if (!n) return null;
283
+ const l = n[1].split(/,(?![^()]*\))/).map((e) => e.trim());
284
+ l[0].includes("circle") || l[0].includes("ellipse") || l[0].includes("at ") ? r = l.slice(1).join(",") : r = l.join(",");
285
285
  } else {
286
- const r = t.match(/linear-gradient\((.*)\)/);
287
- if (!r) return null;
288
- const l = r[1].split(/,(?![^()]*\))/).map((e) => e.trim());
289
- l[0].includes("deg") ? (s = parseInt(l[0], 10), n = l.slice(1).join(",")) : l[0].includes("to ") ? (l[0] === "to right" ? s = 90 : l[0] === "to bottom" ? s = 180 : l[0] === "to left" ? s = 270 : l[0] === "to top" ? s = 0 : s = 180, n = l.slice(1).join(",")) : (s = 180, n = l.join(","));
286
+ const n = t.match(/linear-gradient\((.*)\)/);
287
+ if (!n) return null;
288
+ const l = n[1].split(/,(?![^()]*\))/).map((e) => e.trim());
289
+ l[0].includes("deg") ? (s = parseInt(l[0], 10), r = l.slice(1).join(",")) : l[0].includes("to ") ? (l[0] === "to right" ? s = 90 : l[0] === "to bottom" ? s = 180 : l[0] === "to left" ? s = 270 : l[0] === "to top" ? s = 0 : s = 180, r = l.slice(1).join(",")) : (s = 180, r = l.join(","));
290
290
  }
291
- const i = n.split(/,(?![^()]*\))/).map((r) => r.trim()).map((r) => {
292
- const a = r.match(/(.+)\s+(\d+)%$/);
293
- return a ? { color: a[1], offset: a[2] + "%" } : { color: r, offset: "" };
294
- }).filter((r) => r.color);
295
- return i.length === 2 && (i[0].offset || (i[0].offset = "0%"), i[1].offset || (i[1].offset = "100%")), { type: o, angle: s, stops: i };
291
+ const a = r.split(/,(?![^()]*\))/).map((n) => n.trim()).map((n) => {
292
+ const i = n.match(/(.+)\s+(\d+)%$/);
293
+ return i ? { color: i[1], offset: i[2] + "%" } : { color: n, offset: "" };
294
+ }).filter((n) => n.color);
295
+ return a.length === 2 && (a[0].offset || (a[0].offset = "0%"), a[1].offset || (a[1].offset = "100%")), { type: o, angle: s, stops: a };
296
296
  } catch {
297
297
  return null;
298
298
  }
299
- }, st = (t, o, s, n) => {
300
- const i = (n - 90) * Math.PI / 180, r = Math.cos(i), a = Math.sin(i), l = o / 2 - r * (o / 2), e = s / 2 - a * (s / 2), c = o / 2 + r * (o / 2), h = s / 2 + a * (s / 2);
299
+ }, et = (t, o, s, r) => {
300
+ const a = (r - 90) * Math.PI / 180, n = Math.cos(a), i = Math.sin(a), l = o / 2 - n * (o / 2), e = s / 2 - i * (s / 2), c = o / 2 + n * (o / 2), h = s / 2 + i * (s / 2);
301
301
  return t.createLinearGradient(l, e, c, h);
302
- }, Ct = (t, o, s) => {
303
- const n = Math.min(o, s) / 2;
302
+ }, vt = (t, o, s) => {
303
+ const r = Math.min(o, s) / 2;
304
304
  if (typeof t == "number") {
305
- const c = Math.max(0, Math.min(t, n));
305
+ const c = Math.max(0, Math.min(t, r));
306
306
  return { tl: c, tr: c, br: c, bl: c };
307
307
  }
308
- const i = t, r = Math.max(0, Math.min((i == null ? void 0 : i.tl) ?? 0, n)), a = Math.max(0, Math.min((i == null ? void 0 : i.tr) ?? 0, n)), l = Math.max(0, Math.min((i == null ? void 0 : i.br) ?? 0, n)), e = Math.max(0, Math.min((i == null ? void 0 : i.bl) ?? 0, n));
309
- return { tl: r, tr: a, br: l, bl: e };
310
- }, N = (t, o, s, n, i, r) => {
311
- const { tl: a, tr: l, br: e, bl: c } = Ct(r, n, i);
312
- if (a === 0 && l === 0 && e === 0 && c === 0) {
313
- t.rect(o, s, n, i);
308
+ const a = t, n = Math.max(0, Math.min((a == null ? void 0 : a.tl) ?? 0, r)), i = Math.max(0, Math.min((a == null ? void 0 : a.tr) ?? 0, r)), l = Math.max(0, Math.min((a == null ? void 0 : a.br) ?? 0, r)), e = Math.max(0, Math.min((a == null ? void 0 : a.bl) ?? 0, r));
309
+ return { tl: n, tr: i, br: l, bl: e };
310
+ }, N = (t, o, s, r, a, n) => {
311
+ const { tl: i, tr: l, br: e, bl: c } = vt(n, r, a);
312
+ if (i === 0 && l === 0 && e === 0 && c === 0) {
313
+ t.rect(o, s, r, a);
314
314
  return;
315
315
  }
316
- t.moveTo(o + a, s), t.lineTo(o + n - l, s), t.arcTo(o + n, s, o + n, s + l, l), t.lineTo(o + n, s + i - e), t.arcTo(o + n, s + i, o + n - e, s + i, e), t.lineTo(o + c, s + i), t.arcTo(o, s + i, o, s + i - c, c), t.lineTo(o, s + a), t.arcTo(o, s, o + a, s, a), t.closePath();
317
- }, et = (t, o, s, n) => {
318
- const i = t.split(" ").map((e) => {
316
+ t.moveTo(o + i, s), t.lineTo(o + r - l, s), t.arcTo(o + r, s, o + r, s + l, l), t.lineTo(o + r, s + a - e), t.arcTo(o + r, s + a, o + r - e, s + a, e), t.lineTo(o + c, s + a), t.arcTo(o, s + a, o, s + a - c, c), t.lineTo(o, s + i), t.arcTo(o, s, o + i, s, i), t.closePath();
317
+ }, rt = (t, o, s, r) => {
318
+ const a = t.split(" ").map((e) => {
319
319
  const [c, h] = e.split(",").map(Number);
320
- return { x: c / 100 * s, y: h / 100 * n };
321
- }), r = typeof o == "number";
322
- if (r && o <= 0)
323
- return `M ${i.map((e) => `${e.x},${e.y}`).join(" L ")} Z`;
324
- const a = i.length;
320
+ return { x: c / 100 * s, y: h / 100 * r };
321
+ }), n = typeof o == "number";
322
+ if (n && o <= 0)
323
+ return `M ${a.map((e) => `${e.x},${e.y}`).join(" L ")} Z`;
324
+ const i = a.length;
325
325
  let l = "";
326
- for (let e = 0; e < a; e++) {
327
- const c = i[(e - 1 + a) % a], h = i[e], d = i[(e + 1) % a], p = { x: c.x - h.x, y: c.y - h.y }, u = { x: d.x - h.x, y: d.y - h.y }, f = Math.sqrt(p.x * p.x + p.y * p.y), g = Math.sqrt(u.x * u.x + u.y * u.y), b = Math.min(f, g) / 2;
326
+ for (let e = 0; e < i; e++) {
327
+ const c = a[(e - 1 + i) % i], h = a[e], d = a[(e + 1) % i], p = { x: c.x - h.x, y: c.y - h.y }, u = { x: d.x - h.x, y: d.y - h.y }, f = Math.sqrt(p.x * p.x + p.y * p.y), g = Math.sqrt(u.x * u.x + u.y * u.y), b = Math.min(f, g) / 2;
328
328
  let v = 0;
329
- r ? v = o : v = o[`p${e}`] ?? 0;
329
+ n ? v = o : v = o[`p${e}`] ?? 0;
330
330
  const w = Math.min(v, b);
331
331
  if (w <= 0) {
332
332
  e === 0 ? l += `M ${h.x},${h.y} ` : l += `L ${h.x},${h.y} `;
333
333
  continue;
334
334
  }
335
- const M = { x: h.x + p.x / f * w, y: h.y + p.y / f * w }, T = { x: h.x + u.x / g * w, y: h.y + u.y / g * w };
336
- e === 0 ? l += `M ${M.x},${M.y} ` : l += `L ${M.x},${M.y} `, l += `Q ${h.x},${h.y} ${T.x},${T.y} `;
335
+ const P = { x: h.x + p.x / f * w, y: h.y + p.y / f * w }, T = { x: h.x + u.x / g * w, y: h.y + u.y / g * w };
336
+ e === 0 ? l += `M ${P.x},${P.y} ` : l += `L ${P.x},${P.y} `, l += `Q ${h.x},${h.y} ${T.x},${T.y} `;
337
337
  }
338
338
  return l += "Z", l;
339
- }, vt = (t) => {
339
+ }, Mt = (t) => {
340
340
  const o = t.clip;
341
341
  if (!o) return null;
342
- const s = Math.max(0, o.left ?? 0), n = Math.max(0, o.top ?? 0), i = Math.max(0, o.right ?? 0), r = Math.max(0, o.bottom ?? 0);
343
- if (!(n > 0 || i > 0 || r > 0 || s > 0)) return null;
344
- const l = t.width - s - i, e = t.height - n - r;
342
+ const s = Math.max(0, o.left ?? 0), r = Math.max(0, o.top ?? 0), a = Math.max(0, o.right ?? 0), n = Math.max(0, o.bottom ?? 0);
343
+ if (!(r > 0 || a > 0 || n > 0 || s > 0)) return null;
344
+ const l = t.width - s - a, e = t.height - r - n;
345
345
  return l <= 0 || e <= 0 ? null : {
346
346
  left: s,
347
- top: n,
347
+ top: r,
348
348
  width: l,
349
349
  height: e,
350
350
  originX: s + l / 2,
351
- originY: n + e / 2
351
+ originY: r + e / 2
352
352
  };
353
- }, Mt = (t) => {
354
- var i, r, a, l;
355
- const o = (r = (i = t.effect) == null ? void 0 : i.style) == null ? void 0 : r.type, s = ((l = (a = t.effect) == null ? void 0 : a.style) == null ? void 0 : l.params) || {};
353
+ }, Pt = (t) => {
354
+ var a, n, i, l;
355
+ const o = (n = (a = t.effect) == null ? void 0 : a.style) == null ? void 0 : n.type, s = ((l = (i = t.effect) == null ? void 0 : i.style) == null ? void 0 : l.params) || {};
356
356
  if (!o || o === "none") return 0;
357
- const n = (e, c) => e ?? c;
357
+ const r = (e, c) => e ?? c;
358
358
  switch (o) {
359
359
  case "shadow": {
360
- const e = n(s.blur, 10), c = n(s.offset, 50) / 5;
360
+ const e = r(s.blur, 10), c = r(s.offset, 50) / 5;
361
361
  return e + c + 10;
362
362
  }
363
363
  case "lift": {
364
- const e = n(s.intensity, 50) / 50, c = 20 * e, h = 10 * e;
364
+ const e = r(s.intensity, 50) / 50, c = 20 * e, h = 10 * e;
365
365
  return c + h + 10;
366
366
  }
367
367
  case "neon":
@@ -371,153 +371,154 @@ const dt = {
371
371
  case "hollow":
372
372
  return K(s) * 2 + 2;
373
373
  case "splice": {
374
- const e = Q(s), { offsetX: c, offsetY: h } = R(s);
374
+ const e = Q(s), { offsetX: c, offsetY: h } = I(s);
375
375
  return Math.max(Math.abs(c), Math.abs(h)) + e * 2 + 4;
376
376
  }
377
377
  case "echo": {
378
- const { offsetX: e, offsetY: c } = R(s);
378
+ const { offsetX: e, offsetY: c } = I(s);
379
379
  return Math.max(Math.abs(e), Math.abs(c)) * 2 + 4;
380
380
  }
381
381
  case "glitch":
382
382
  return Math.abs(Z(s)) + 4;
383
383
  case "blur":
384
- return n(s.blurAmount, 5) * 2 + 4;
384
+ return r(s.blurAmount, 5) * 2 + 4;
385
385
  case "duotone":
386
386
  case "gradient_overlay":
387
387
  case "background":
388
388
  return 2;
389
389
  case "reflection": {
390
- const e = n(s.reflectionDistance, 5), c = e, h = e + 10;
390
+ const e = r(s.reflectionDistance, 5), c = e, h = e + 10;
391
391
  return Math.abs(h) + c + 6;
392
392
  }
393
393
  default:
394
394
  return 0;
395
395
  }
396
- }, rt = (t) => {
396
+ }, nt = (t) => {
397
397
  const o = [], s = /d=\"([^\"]+)\"/g;
398
- let n = null;
399
- for (; (n = s.exec(t)) !== null; )
400
- o.push(n[1]);
398
+ let r = null;
399
+ for (; (r = s.exec(t)) !== null; )
400
+ o.push(r[1]);
401
401
  return o;
402
- }, Pt = (t, o, s) => {
402
+ }, Tt = (t, o, s) => {
403
403
  if (t.type === "shape") {
404
- const n = t.content, i = tt(n);
405
- if (i && typeof DOMMatrix < "u") {
406
- const r = rt(i.markup);
407
- if (r.length > 0) {
408
- const { x: a, y: l, width: e, height: c } = z(i.viewBox), h = e > 0 ? o / e : 1, d = c > 0 ? s / c : 1, p = new Path2D();
409
- return r.forEach((u) => {
410
- const f = new Path2D(u), g = new DOMMatrix().translate(-a, -l).scale(h, d);
404
+ const r = t.content, a = tt(r);
405
+ if (a && typeof DOMMatrix < "u") {
406
+ const n = nt(a.markup);
407
+ if (n.length > 0) {
408
+ const { x: i, y: l, width: e, height: c } = z(a.viewBox), h = e > 0 ? o / e : 1, d = c > 0 ? s / c : 1, p = new Path2D();
409
+ return n.forEach((u) => {
410
+ const f = new Path2D(u), g = new DOMMatrix().translate(-i, -l).scale(h, d);
411
411
  p.addPath(f, g);
412
412
  }), p;
413
413
  }
414
414
  }
415
- if (n === "rect") {
416
- const r = new Path2D(), a = t.cornerRadius || 0;
417
- return N(r, 0, 0, o, s, a), r;
415
+ if (r === "rect") {
416
+ const n = new Path2D(), i = t.cornerRadius || 0;
417
+ return N(n, 0, 0, o, s, i), n;
418
418
  }
419
- if (n === "circle") {
420
- const r = new Path2D();
421
- return r.ellipse(o / 2, s / 2, o / 2, s / 2, 0, 0, Math.PI * 2), r;
419
+ if (r === "circle") {
420
+ const n = new Path2D();
421
+ return n.ellipse(o / 2, s / 2, o / 2, s / 2, 0, 0, Math.PI * 2), n;
422
422
  }
423
- if (n === "line") {
424
- const r = new Path2D();
425
- return r.moveTo(0, s / 2), r.lineTo(o, s / 2), r;
423
+ if (r === "line") {
424
+ const n = new Path2D();
425
+ return n.moveTo(0, s / 2), n.lineTo(o, s / 2), n;
426
426
  }
427
- if (E[n]) {
428
- const r = t.cornerRadius || 0, a = et(E[n], r, o, s);
429
- return new Path2D(a);
427
+ if (E[r]) {
428
+ const n = t.cornerRadius || 0, i = rt(E[r], n, o, s);
429
+ return new Path2D(i);
430
430
  }
431
431
  }
432
432
  return null;
433
433
  }, $ = (t, o, s) => {
434
434
  if (t.type === "image" && t.clipShape) {
435
- const n = tt(t.clipShape);
436
- if (n) {
437
- const i = rt(n.markup);
438
- if (i.length > 0 && typeof DOMMatrix < "u") {
439
- const { x: r, y: a, width: l, height: e } = z(n.viewBox), c = l > 0 ? o / l : 1, h = e > 0 ? s / e : 1, d = new Path2D();
440
- return i.forEach((p) => {
441
- const u = new Path2D(p), f = new DOMMatrix().translate(-r, -a).scale(c, h);
435
+ const r = tt(t.clipShape);
436
+ if (r) {
437
+ const a = nt(r.markup);
438
+ if (a.length > 0 && typeof DOMMatrix < "u") {
439
+ const { x: n, y: i, width: l, height: e } = z(r.viewBox), c = l > 0 ? o / l : 1, h = e > 0 ? s / e : 1, d = new Path2D();
440
+ return a.forEach((p) => {
441
+ const u = new Path2D(p), f = new DOMMatrix().translate(-n, -i).scale(c, h);
442
442
  d.addPath(u, f);
443
443
  }), d;
444
444
  }
445
445
  }
446
446
  if (t.clipShape === "circle") {
447
- const i = new Path2D();
448
- return i.ellipse(o / 2, s / 2, o / 2, s / 2, 0, 0, Math.PI * 2), i;
447
+ const a = new Path2D();
448
+ return a.ellipse(o / 2, s / 2, o / 2, s / 2, 0, 0, Math.PI * 2), a;
449
449
  }
450
450
  if (t.clipShape === "path" && t.path) {
451
- const i = ot(t.path);
452
- return new Path2D(i);
451
+ const a = ot(t.path);
452
+ return new Path2D(a);
453
453
  }
454
454
  if (E[t.clipShape]) {
455
- const i = t.cornerRadius || 0, r = et(E[t.clipShape], i, o, s);
456
- return new Path2D(r);
455
+ const a = t.cornerRadius || 0, n = rt(E[t.clipShape], a, o, s);
456
+ return new Path2D(n);
457
457
  }
458
458
  }
459
459
  return null;
460
- }, Tt = (t, o, s, n) => {
461
- const i = o.backgroundColor || "transparent", r = i.includes("gradient") ? St(i) : null;
462
- if (r)
463
- if (r.type === "radial") {
464
- const c = t.createRadialGradient(s / 2, n / 2, 0, s / 2, n / 2, Math.max(s, n) / 2);
465
- r.stops.forEach((h, d) => {
466
- const p = r.stops.length > 1 ? d / (r.stops.length - 1) : 0, u = h.offset ? Number.parseFloat(h.offset) / 100 : p;
460
+ }, Wt = (t, o, s, r) => {
461
+ const a = o.backgroundColor || "transparent", n = a.includes("gradient") ? Ct(a) : null;
462
+ if (n)
463
+ if (n.type === "radial") {
464
+ const c = t.createRadialGradient(s / 2, r / 2, 0, s / 2, r / 2, Math.max(s, r) / 2);
465
+ n.stops.forEach((h, d) => {
466
+ const p = n.stops.length > 1 ? d / (n.stops.length - 1) : 0, u = h.offset ? Number.parseFloat(h.offset) / 100 : p;
467
467
  c.addColorStop(Number.isFinite(u) ? u : p, h.color);
468
468
  }), t.fillStyle = c;
469
469
  } else {
470
- const c = st(t, s, n, r.angle);
471
- r.stops.forEach((h, d) => {
472
- const p = r.stops.length > 1 ? d / (r.stops.length - 1) : 0, u = h.offset ? Number.parseFloat(h.offset) / 100 : p;
470
+ const c = et(t, s, r, n.angle);
471
+ n.stops.forEach((h, d) => {
472
+ const p = n.stops.length > 1 ? d / (n.stops.length - 1) : 0, u = h.offset ? Number.parseFloat(h.offset) / 100 : p;
473
473
  c.addColorStop(Number.isFinite(u) ? u : p, h.color);
474
474
  }), t.fillStyle = c;
475
475
  }
476
476
  else
477
- t.fillStyle = i;
478
- const a = Pt(o, s, n);
479
- a ? t.fill(a) : t.fillRect(0, 0, s, n);
477
+ t.fillStyle = a;
478
+ const i = Tt(o, s, r);
479
+ i ? t.fill(i) : t.fillRect(0, 0, s, r);
480
480
  const l = o.content === "line" ? Math.max(2, o.strokeWidth || 4) : o.strokeWidth || 0, e = o.strokeColor || "transparent";
481
- l > 0 && e !== "transparent" && (t.save(), t.strokeStyle = e, t.lineWidth = l, t.lineJoin = "round", t.lineCap = o.strokeStyle === "round" ? "round" : "butt", o.strokeStyle === "dashed" ? t.setLineDash([6, 4]) : o.strokeStyle === "dotted" ? t.setLineDash([2, 2]) : t.setLineDash([]), a ? t.stroke(a) : t.strokeRect(0, 0, s, n), t.restore());
482
- }, Wt = (t, o, s) => {
481
+ l > 0 && e !== "transparent" && (t.save(), t.strokeStyle = e, t.lineWidth = l, t.lineJoin = "round", t.lineCap = o.strokeStyle === "round" ? "round" : "butt", o.strokeStyle === "dashed" ? t.setLineDash([6, 4]) : o.strokeStyle === "dotted" ? t.setLineDash([2, 2]) : t.setLineDash([]), i ? t.stroke(i) : t.strokeRect(0, 0, s, r), t.restore());
482
+ }, Ot = (t, o, s) => {
483
483
  if (o === "none") return t;
484
- const n = t.width / s, i = t.height / s, { canvas: r, ctx: a } = L(n, i, s);
485
- return a.filter = o, a.drawImage(t, 0, 0, n, i), r;
486
- }, Ot = (t) => new Promise((o, s) => {
487
- const n = new Image();
488
- n.decoding = "async", n.crossOrigin = "anonymous", n.onload = () => o(n), n.onerror = (i) => s(i), n.src = t;
489
- }), Dt = async (t, o, s, n, i) => {
484
+ const r = t.width / s, a = t.height / s, { canvas: n, ctx: i } = L(r, a, s);
485
+ return i.filter = o, i.drawImage(t, 0, 0, r, a), n;
486
+ }, Dt = (t) => new Promise((o, s) => {
487
+ const r = new Image();
488
+ r.decoding = "async", r.crossOrigin = "anonymous", r.onload = () => o(r), r.onerror = (a) => s(a), r.src = st(t);
489
+ }), Yt = async (t, o, s, r, a) => {
490
490
  if (o.isIcon && o.iconPaths && o.iconPaths.length > 0) {
491
- const { x: M, y: T, width: D, height: y } = z(
492
- o.iconViewBox || `0 0 ${s} ${n}`
493
- ), S = D > 0 ? s / D : 1, P = y > 0 ? n / y : 1;
494
- t.save(), t.fillStyle = o.color || "#000000", t.translate(-M * S, -T * P), t.scale(S, P), o.iconPaths.forEach((Y) => {
495
- const k = new Path2D(Y);
496
- t.fill(k);
491
+ const { x: T, y: D, width: y, height: S } = z(
492
+ o.iconViewBox || `0 0 ${s} ${r}`
493
+ ), M = y > 0 ? s / y : 1, Y = S > 0 ? r / S : 1;
494
+ t.save(), t.fillStyle = o.color || "#000000", t.translate(-T * M, -D * Y), t.scale(M, Y), o.iconPaths.forEach((k) => {
495
+ const O = new Path2D(k);
496
+ t.fill(O);
497
497
  }), t.restore();
498
498
  return;
499
499
  }
500
- const r = o.content;
501
- if (!r) return;
502
- let a = i.get(r);
503
- a || (a = await Ot(r), i.set(r, a));
504
- const l = a.naturalWidth || a.width || s, e = a.naturalHeight || a.height || n, c = ht(o.crop, s, n, l, e), h = c.width * l, d = c.height * e, p = s / h, u = n / d, f = l * p, g = e * u, b = -(c.x * l) * p, v = -(c.y * e) * u, w = (o.imageRotation ?? 0) * (Math.PI / 180);
505
- if (o.backgroundColor && o.backgroundColor !== "transparent" && (t.save(), t.fillStyle = o.backgroundColor, t.fillRect(0, 0, s, n), t.restore()), t.save(), w) {
506
- const M = b + f / 2, T = v + g / 2;
507
- t.translate(M, T), t.rotate(w), t.translate(-M, -T);
500
+ const n = o.content;
501
+ if (!n) return;
502
+ const i = st(n);
503
+ let l = a.get(i);
504
+ l || (l = await Dt(i), a.set(i, l));
505
+ const e = l.naturalWidth || l.width || s, c = l.naturalHeight || l.height || r, h = dt(o.crop, s, r, e, c), d = h.width * e, p = h.height * c, u = s / d, f = r / p, g = e * u, b = c * f, v = -(h.x * e) * u, w = -(h.y * c) * f, P = (o.imageRotation ?? 0) * (Math.PI / 180);
506
+ if (o.backgroundColor && o.backgroundColor !== "transparent" && (t.save(), t.fillStyle = o.backgroundColor, t.fillRect(0, 0, s, r), t.restore()), t.save(), P) {
507
+ const T = v + g / 2, D = w + b / 2;
508
+ t.translate(T, D), t.rotate(P), t.translate(-T, -D);
508
509
  }
509
- t.drawImage(a, b, v, f, g), t.restore();
510
- }, Yt = (t, o) => {
510
+ t.drawImage(l, v, w, g, b), t.restore();
511
+ }, Xt = (t, o) => {
511
512
  if (!o.path) return;
512
513
  const s = ot(o.path);
513
514
  if (!s) return;
514
- const n = new Path2D(s), i = o.backgroundColor ?? o.path.fillColor ?? "transparent", r = o.strokeColor ?? o.path.strokeColor ?? "transparent", a = o.strokeWidth ?? o.path.strokeWidth ?? 0;
515
- i && i !== "transparent" && (t.save(), t.fillStyle = i, t.fill(n), t.restore()), a > 0 && r && r !== "transparent" && (t.save(), t.strokeStyle = r, t.lineWidth = a, t.lineCap = o.path.lineCap, t.lineJoin = o.path.lineJoin, o.strokeStyle === "dashed" ? t.setLineDash([6, 4]) : o.strokeStyle === "dotted" ? t.setLineDash([2, 2]) : t.setLineDash([]), t.stroke(n), t.restore());
516
- }, Xt = async (t, o, s) => {
517
- var D, y, S, P, Y;
518
- const n = Mt(t), i = typeof n == "number" ? n : 0, r = t.width + i * 2, a = t.height + i * 2, { canvas: l, ctx: e } = L(r, a, o);
519
- e.save(), e.translate(i, i);
520
- const c = vt(t), h = ((y = (D = t.effect) == null ? void 0 : D.style) == null ? void 0 : y.type) ?? "none", d = ((P = (S = t.effect) == null ? void 0 : S.style) == null ? void 0 : P.params) ?? {}, p = V((Y = t.effect) == null ? void 0 : Y.adjustments), { canvas: u, ctx: f } = L(t.width, t.height, o);
515
+ const r = new Path2D(s), a = o.backgroundColor ?? o.path.fillColor ?? "transparent", n = o.strokeColor ?? o.path.strokeColor ?? "transparent", i = o.strokeWidth ?? o.path.strokeWidth ?? 0;
516
+ a && a !== "transparent" && (t.save(), t.fillStyle = a, t.fill(r), t.restore()), i > 0 && n && n !== "transparent" && (t.save(), t.strokeStyle = n, t.lineWidth = i, t.lineCap = o.path.lineCap, t.lineJoin = o.path.lineJoin, o.strokeStyle === "dashed" ? t.setLineDash([6, 4]) : o.strokeStyle === "dotted" ? t.setLineDash([2, 2]) : t.setLineDash([]), t.stroke(r), t.restore());
517
+ }, It = async (t, o, s) => {
518
+ var D, y, S, M, Y;
519
+ const r = Pt(t), a = typeof r == "number" ? r : 0, n = t.width + a * 2, i = t.height + a * 2, { canvas: l, ctx: e } = L(n, i, o);
520
+ e.save(), e.translate(a, a);
521
+ const c = Mt(t), h = ((y = (D = t.effect) == null ? void 0 : D.style) == null ? void 0 : y.type) ?? "none", d = ((M = (S = t.effect) == null ? void 0 : S.style) == null ? void 0 : M.params) ?? {}, p = V((Y = t.effect) == null ? void 0 : Y.adjustments), { canvas: u, ctx: f } = L(t.width, t.height, o);
521
522
  if (t.type === "text")
522
523
  c ? (f.save(), f.beginPath(), f.rect(c.left, c.top, c.width, c.height), f.clip(), j(f, t, t.width, t.height, h, d), f.restore()) : j(f, t, t.width, t.height, h, d);
523
524
  else {
@@ -527,7 +528,7 @@ const dt = {
527
528
  const k = $(t, t.width, t.height);
528
529
  k ? (f.beginPath(), f.addPath(k), f.clip()) : t.type === "image" && t.cornerRadius && (f.beginPath(), N(f, 0, 0, t.width, t.height, t.cornerRadius), f.clip());
529
530
  }
530
- if (t.type === "shape" ? Tt(f, t, t.width, t.height) : t.type === "image" ? await Dt(f, t, t.width, t.height, s) : t.type === "path" ? Yt(f, t) : (f.fillStyle = t.backgroundColor || "transparent", f.fillRect(0, 0, t.width, t.height)), f.restore(), t.type === "image" && (t.strokeWidth || 0) > 0) {
531
+ if (t.type === "shape" ? Wt(f, t, t.width, t.height) : t.type === "image" ? await Yt(f, t, t.width, t.height, s) : t.type === "path" ? Xt(f, t) : (f.fillStyle = t.backgroundColor || "transparent", f.fillRect(0, 0, t.width, t.height)), f.restore(), t.type === "image" && (t.strokeWidth || 0) > 0) {
531
532
  const k = $(t, t.width, t.height);
532
533
  f.save(), f.strokeStyle = t.strokeColor || "#000000", f.lineWidth = t.strokeWidth || 0, f.lineJoin = "round", f.lineCap = t.strokeStyle === "round" ? "round" : "butt", t.strokeStyle === "dashed" ? f.setLineDash([6, 4]) : t.strokeStyle === "dotted" ? f.setLineDash([2, 2]) : f.setLineDash([]), k ? f.stroke(k) : t.cornerRadius ? (f.beginPath(), N(f, 0, 0, t.width, t.height, t.cornerRadius), f.stroke()) : f.strokeRect(0, 0, t.width, t.height), f.restore();
533
534
  }
@@ -540,26 +541,26 @@ const dt = {
540
541
  }
541
542
  h === "duotone" && b.push("grayscale(100%)");
542
543
  }
543
- const v = b.join(" ").trim() || "none", w = !g && h === "blur", M = g || w ? u : Wt(u, v, o);
544
+ const v = b.join(" ").trim() || "none", w = !g && h === "blur", P = g || w ? u : Ot(u, v, o);
544
545
  if (!g && (h === "shadow" || h === "lift" || h === "neon")) {
545
546
  if (e.save(), e.filter = "none", h === "shadow") {
546
- const { offsetX: k, offsetY: O } = R(d), W = d.blur ?? 0, A = B(d);
547
- e.shadowColor = I(q(d, "#000000"), A), e.shadowBlur = W, e.shadowOffsetX = k, e.shadowOffsetY = O, e.drawImage(M, 0, 0, t.width, t.height);
547
+ const { offsetX: k, offsetY: O } = I(d), W = d.blur ?? 0, A = B(d);
548
+ e.shadowColor = R(q(d, "#000000"), A), e.shadowBlur = W, e.shadowOffsetX = k, e.shadowOffsetY = O, e.drawImage(P, 0, 0, t.width, t.height);
548
549
  } else if (h === "lift") {
549
550
  const k = x(d);
550
- e.shadowColor = `rgba(0,0,0, ${0.5 * k})`, e.shadowBlur = 20 * k, e.shadowOffsetX = 0, e.shadowOffsetY = 10 * k, e.drawImage(M, 0, 0, t.width, t.height);
551
+ e.shadowColor = `rgba(0,0,0, ${0.5 * k})`, e.shadowBlur = 20 * k, e.shadowOffsetX = 0, e.shadowOffsetY = 10 * k, e.drawImage(P, 0, 0, t.width, t.height);
551
552
  } else if (h === "neon") {
552
553
  const k = J(d), O = d.color || "#00ff00";
553
554
  [k * 5, k * 3, k].forEach((W) => {
554
- e.shadowColor = O, e.shadowBlur = W, e.shadowOffsetX = 0, e.shadowOffsetY = 0, e.drawImage(M, 0, 0, t.width, t.height);
555
+ e.shadowColor = O, e.shadowBlur = W, e.shadowOffsetX = 0, e.shadowOffsetY = 0, e.drawImage(P, 0, 0, t.width, t.height);
555
556
  });
556
557
  }
557
558
  e.restore();
558
559
  }
559
560
  if (!g && h === "reflection") {
560
561
  const k = (d.reflectionOpacity ?? 50) / 100, O = d.reflectionDistance ?? 5, W = 0.35;
561
- e.save(), e.drawImage(M, 0, 0, t.width, t.height), e.translate(0, t.height + O), e.scale(1, -1), e.globalAlpha = k, e.drawImage(
562
- M,
562
+ e.save(), e.drawImage(P, 0, 0, t.width, t.height), e.translate(0, t.height + O), e.scale(1, -1), e.globalAlpha = k, e.drawImage(
563
+ P,
563
564
  0,
564
565
  t.height - t.height * W,
565
566
  t.width,
@@ -570,11 +571,11 @@ const dt = {
570
571
  t.height * W
571
572
  ), e.restore();
572
573
  } else
573
- w ? (e.save(), e.filter = v, e.drawImage(u, 0, 0, t.width, t.height), e.restore()) : e.drawImage(M, 0, 0, t.width, t.height);
574
+ w ? (e.save(), e.filter = v, e.drawImage(u, 0, 0, t.width, t.height), e.restore()) : e.drawImage(P, 0, 0, t.width, t.height);
574
575
  if (!g && h === "gradient_overlay") {
575
576
  const k = d.gradientColor1 || "#667eea", O = d.gradientColor2 || "#764ba2", W = d.gradientAngle || 135, A = (d.transparency ?? 80) / 100;
576
577
  e.save(), e.globalAlpha = A, e.filter = p || "none", e.globalCompositeOperation = "overlay";
577
- const F = st(e, t.width, t.height, W);
578
+ const F = et(e, t.width, t.height, W);
578
579
  F.addColorStop(0, k), F.addColorStop(1, O), e.fillStyle = F;
579
580
  const G = $(t, t.width, t.height);
580
581
  G ? (e.save(), e.beginPath(), e.addPath(G), e.clip(), e.fillRect(0, 0, t.width, t.height), e.restore()) : e.fillRect(0, 0, t.width, t.height), e.restore();
@@ -587,47 +588,47 @@ const dt = {
587
588
  const T = c ? { x: c.originX, y: c.originY } : { x: t.width / 2, y: t.height / 2 };
588
589
  return {
589
590
  canvas: l,
590
- padding: i,
591
+ padding: a,
591
592
  origin: T,
592
- width: r,
593
- height: a
593
+ width: n,
594
+ height: i
594
595
  };
595
596
  }, U = async (t, o) => {
596
- const { page: s, settings: n, bleed: i, backgroundColor: r, pixelRatio: a } = o, l = o.width, e = o.height, c = i, h = i;
597
- r !== "transparent" && (t.save(), t.fillStyle = r || n.backgroundColor || "#ffffff", t.fillRect(0, 0, l, e), t.restore());
597
+ const { page: s, settings: r, bleed: a, backgroundColor: n, pixelRatio: i } = o, l = o.width, e = o.height, c = a, h = a;
598
+ n !== "transparent" && (t.save(), t.fillStyle = n || r.backgroundColor || "#ffffff", t.fillRect(0, 0, l, e), t.restore());
598
599
  const d = [...s.elements].filter((u) => u.visible !== !1).sort((u, f) => u.zIndex - f.zIndex), p = /* @__PURE__ */ new Map();
599
600
  for (const u of d) {
600
- const { canvas: f, padding: g, origin: b, width: v, height: w } = await Xt(
601
+ const { canvas: f, padding: g, origin: b, width: v, height: w } = await It(
601
602
  u,
602
- a,
603
+ i,
603
604
  p
604
605
  );
605
- t.save(), t.globalCompositeOperation = ut(u.blendMode), t.globalAlpha = u.opacity ?? 1, t.translate(c + u.x, h + u.y), t.translate(b.x, b.y), t.rotate((u.rotation ?? 0) * Math.PI / 180), t.scale(u.flipX ? -1 : 1, u.flipY ? -1 : 1), t.translate(-b.x, -b.y), t.drawImage(f, -g, -g, v, w), t.restore();
606
+ t.save(), t.globalCompositeOperation = gt(u.blendMode), t.globalAlpha = u.opacity ?? 1, t.translate(c + u.x, h + u.y), t.translate(b.x, b.y), t.rotate((u.rotation ?? 0) * Math.PI / 180), t.scale(u.flipX ? -1 : 1, u.flipY ? -1 : 1), t.translate(-b.x, -b.y), t.drawImage(f, -g, -g, v, w), t.restore();
606
607
  }
607
- }, It = async (t) => {
608
- await at(document);
608
+ }, Lt = async (t) => {
609
+ await lt(document);
609
610
  const o = t.width, s = t.height;
610
- if (!lt(
611
+ if (!ct(
611
612
  o,
612
613
  s,
613
614
  t.pixelRatio,
614
615
  8192,
615
616
  67108864
616
617
  )) {
617
- const { canvas: a, ctx: l } = L(o, s, t.pixelRatio);
618
- return await U(l, t), a;
618
+ const { canvas: i, ctx: l } = L(o, s, t.pixelRatio);
619
+ return await U(l, t), i;
619
620
  }
620
- const i = ct(o, s, {
621
+ const a = ft(o, s, {
621
622
  tileWidth: H.tileSize,
622
623
  tileHeight: H.tileSize,
623
624
  overlap: H.tileOverlap
624
- }), r = [];
625
- for (const a of i.tiles) {
626
- const { canvas: l, ctx: e } = L(a.width, a.height, t.pixelRatio);
627
- e.translate(-a.x, -a.y), await U(e, t), r.push({ rect: a, canvas: l });
625
+ }), n = [];
626
+ for (const i of a.tiles) {
627
+ const { canvas: l, ctx: e } = L(i.width, i.height, t.pixelRatio);
628
+ e.translate(-i.x, -i.y), await U(e, t), n.push({ rect: i, canvas: l });
628
629
  }
629
- return ft(r, o, s, t.pixelRatio);
630
+ return ht(n, o, s, t.pixelRatio);
630
631
  };
631
632
  export {
632
- It as capturePageCanvas
633
+ Lt as capturePageCanvas
633
634
  };