exodeui 6.3.20 → 6.3.21

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.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  var ys = Object.defineProperty;
2
2
  var bs = (p, t, s) => t in p ? ys(p, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : p[t] = s;
3
- var tt = (p, t, s) => bs(p, typeof t != "symbol" ? t + "" : t, s);
3
+ var et = (p, t, s) => bs(p, typeof t != "symbol" ? t + "" : t, s);
4
4
  import { jsx as Ce, jsxs as vs } from "react/jsx-runtime";
5
5
  import { forwardRef as Cs, useRef as ve, useState as ds, useImperativeHandle as Ss, useEffect as Se, useCallback as ge } from "react";
6
- import { prepareWithSegments as Ye, layoutWithLines as Is } from "@chenglou/pretext";
6
+ import { prepareWithSegments as Xe, layoutWithLines as Is } from "@chenglou/pretext";
7
7
  import ae from "@dimforge/rapier2d-compat";
8
8
  import * as ws from "lz-string";
9
- var Y = /* @__PURE__ */ ((p) => (p.Proximity = "Proximity", p.Magnetic = "Magnetic", p.Repel = "Repel", p.Orbit = "Orbit", p.Vortex = "Vortex", p.Fluid = "Fluid", p.Elastic = "Elastic", p.Holographic = "Holographic", p.Sticky = "Sticky", p.Dilation = "Dilation", p.Parallax = "Parallax", p.Noise = "Noise", p.Float = "Float", p.Pulse = "Pulse", p.Draggable = "Draggable", p.Scroll = "Scroll", p.LookAt = "LookAt", p.Glint = "Glint", p.Scan = "Scan", p.Ratchet = "Ratchet", p.Jitter = "Jitter", p.Follower = "Follower", p.Wrap = "Wrap", p.Typewriter = "Typewriter", p.Scramble = "Scramble", p.Wave = "Wave", p.Bounce = "Bounce", p.TextTrail = "TextTrail", p.Reveal3D = "Reveal3D", p.RevealSlide = "RevealSlide", p.RevealBlur = "RevealBlur", p.TextLiquid = "TextLiquid", p.TextVortex = "TextVortex", p.TextExplosion = "TextExplosion", p.TextRain = "TextRain", p.TextGravity = "TextGravity", p.TextMatrix = "TextMatrix", p.TextNeon = "TextNeon", p.TextDissolve = "TextDissolve", p.TextOrganic = "TextOrganic", p.TextBreathe = "TextBreathe", p.TextSpin = "TextSpin", p.TextMagnet = "TextMagnet", p.TextPerspective = "TextPerspective", p.TextMirror = "TextMirror", p.TextFloral = "TextFloral", p.TextSmoke = "TextSmoke", p.TextVariable = "TextVariable", p.TextZing = "TextZing", p.TextElastic = "TextElastic", p.TextGlitch3D = "TextGlitch3D", p.GlitchText = "GlitchText", p.TextCounter = "TextCounter", p.Squash = "Squash", p.Spotlight = "Spotlight", p.Lens = "Lens", p.Gravity = "Gravity", p.Velocity = "Velocity", p.Shear = "Shear", p.LayoutAnimation = "LayoutAnimation", p.SpringChain = "SpringChain", p.ParticleEmitter = "ParticleEmitter", p.StateReactive = "StateReactive", p.Fold = "Fold", p.Crumple = "Crumple", p))(Y || {}), Kt = /* @__PURE__ */ ((p) => (p.Scale = "Scale", p.Opacity = "Opacity", p.RotateZ = "RotateZ", p.RotateX = "RotateX", p.RotateY = "RotateY", p.PositionX = "PositionX", p.PositionY = "PositionY", p.SkewX = "SkewX", p.Blur = "Blur", p.Exposure = "Exposure", p.HueShift = "HueShift", p.Negative = "Negative", p.CornerRadius = "CornerRadius", p.StrokeWidth = "StrokeWidth", p.BoxShadow = "BoxShadow", p.FontSize = "FontSize", p.LetterSpacing = "LetterSpacing", p))(Kt || {}), Ms = /* @__PURE__ */ ((p) => (p.Equal = "Equal", p.NotEqual = "NotEqual", p.GreaterThan = "GreaterThan", p.LessThan = "LessThan", p.GreaterEqual = "GreaterEqual", p.LessEqual = "LessEqual", p.IsTrue = "IsTrue", p.IsFalse = "IsFalse", p))(Ms || {}), Ct = /* @__PURE__ */ ((p) => (p.AND = "AND", p.OR = "OR", p.NOT = "NOT", p.XOR = "XOR", p.OBJECT = "OBJECT", p.PROPERTY = "PROPERTY", p.GET_PROPERTY = "GET_PROPERTY", p.SET_PROPERTY = "SET_PROPERTY", p.ADD = "ADD", p.SUB = "SUB", p.MUL = "MUL", p.DIV = "DIV", p.MOD = "MOD", p.POW = "POW", p.ABS = "ABS", p.ROUND = "ROUND", p.FLOOR = "FLOOR", p.CEIL = "CEIL", p.SIN = "SIN", p.COS = "COS", p.TAN = "TAN", p.CLAMP = "CLAMP", p.REMAP = "REMAP", p.EQ = "EQ", p.NEQ = "NEQ", p.GT = "GT", p.LT = "LT", p.GTE = "GTE", p.LTE = "LTE", p.IF_ELSE = "IF_ELSE", p.VALUE = "VALUE", p.INPUT = "INPUT", p.LOG = "LOG", p.SCROLL_X = "SCROLL_X", p.SCROLL_Y = "SCROLL_Y", p.MOUSE_X = "MOUSE_X", p.MOUSE_Y = "MOUSE_Y", p.IS_MOUSE_DOWN = "IS_MOUSE_DOWN", p.EFFECTOR = "EFFECTOR", p.MONITOR = "MONITOR", p.DELAY = "DELAY", p.SPRING_PULL = "SPRING_PULL", p.SPRING_SETTLE = "SPRING_SETTLE", p.EMIT = "EMIT", p))(Ct || {});
9
+ var G = /* @__PURE__ */ ((p) => (p.Proximity = "Proximity", p.Magnetic = "Magnetic", p.Repel = "Repel", p.Orbit = "Orbit", p.Vortex = "Vortex", p.Fluid = "Fluid", p.Elastic = "Elastic", p.Holographic = "Holographic", p.Sticky = "Sticky", p.Dilation = "Dilation", p.Parallax = "Parallax", p.Noise = "Noise", p.Float = "Float", p.Pulse = "Pulse", p.Draggable = "Draggable", p.Scroll = "Scroll", p.LookAt = "LookAt", p.Glint = "Glint", p.Scan = "Scan", p.Ratchet = "Ratchet", p.Jitter = "Jitter", p.Follower = "Follower", p.Wrap = "Wrap", p.Typewriter = "Typewriter", p.Scramble = "Scramble", p.Wave = "Wave", p.Bounce = "Bounce", p.TextTrail = "TextTrail", p.Reveal3D = "Reveal3D", p.RevealSlide = "RevealSlide", p.RevealBlur = "RevealBlur", p.TextLiquid = "TextLiquid", p.TextVortex = "TextVortex", p.TextExplosion = "TextExplosion", p.TextRain = "TextRain", p.TextGravity = "TextGravity", p.TextMatrix = "TextMatrix", p.TextNeon = "TextNeon", p.TextDissolve = "TextDissolve", p.TextOrganic = "TextOrganic", p.TextBreathe = "TextBreathe", p.TextSpin = "TextSpin", p.TextMagnet = "TextMagnet", p.TextPerspective = "TextPerspective", p.TextMirror = "TextMirror", p.TextFloral = "TextFloral", p.TextSmoke = "TextSmoke", p.TextVariable = "TextVariable", p.TextZing = "TextZing", p.TextElastic = "TextElastic", p.TextGlitch3D = "TextGlitch3D", p.GlitchText = "GlitchText", p.TextCounter = "TextCounter", p.Squash = "Squash", p.Spotlight = "Spotlight", p.Lens = "Lens", p.Gravity = "Gravity", p.Velocity = "Velocity", p.Shear = "Shear", p.LayoutAnimation = "LayoutAnimation", p.SpringChain = "SpringChain", p.ParticleEmitter = "ParticleEmitter", p.StateReactive = "StateReactive", p.Fold = "Fold", p.Crumple = "Crumple", p))(G || {}), Kt = /* @__PURE__ */ ((p) => (p.Scale = "Scale", p.Opacity = "Opacity", p.RotateZ = "RotateZ", p.RotateX = "RotateX", p.RotateY = "RotateY", p.PositionX = "PositionX", p.PositionY = "PositionY", p.SkewX = "SkewX", p.Blur = "Blur", p.Exposure = "Exposure", p.HueShift = "HueShift", p.Negative = "Negative", p.CornerRadius = "CornerRadius", p.StrokeWidth = "StrokeWidth", p.BoxShadow = "BoxShadow", p.FontSize = "FontSize", p.LetterSpacing = "LetterSpacing", p))(Kt || {}), Ms = /* @__PURE__ */ ((p) => (p.Equal = "Equal", p.NotEqual = "NotEqual", p.GreaterThan = "GreaterThan", p.LessThan = "LessThan", p.GreaterEqual = "GreaterEqual", p.LessEqual = "LessEqual", p.IsTrue = "IsTrue", p.IsFalse = "IsFalse", p))(Ms || {}), St = /* @__PURE__ */ ((p) => (p.AND = "AND", p.OR = "OR", p.NOT = "NOT", p.XOR = "XOR", p.OBJECT = "OBJECT", p.PROPERTY = "PROPERTY", p.GET_PROPERTY = "GET_PROPERTY", p.SET_PROPERTY = "SET_PROPERTY", p.ADD = "ADD", p.SUB = "SUB", p.MUL = "MUL", p.DIV = "DIV", p.MOD = "MOD", p.POW = "POW", p.ABS = "ABS", p.ROUND = "ROUND", p.FLOOR = "FLOOR", p.CEIL = "CEIL", p.SIN = "SIN", p.COS = "COS", p.TAN = "TAN", p.CLAMP = "CLAMP", p.REMAP = "REMAP", p.EQ = "EQ", p.NEQ = "NEQ", p.GT = "GT", p.LT = "LT", p.GTE = "GTE", p.LTE = "LTE", p.IF_ELSE = "IF_ELSE", p.VALUE = "VALUE", p.INPUT = "INPUT", p.LOG = "LOG", p.SCROLL_X = "SCROLL_X", p.SCROLL_Y = "SCROLL_Y", p.MOUSE_X = "MOUSE_X", p.MOUSE_Y = "MOUSE_Y", p.IS_MOUSE_DOWN = "IS_MOUSE_DOWN", p.EFFECTOR = "EFFECTOR", p.MONITOR = "MONITOR", p.DELAY = "DELAY", p.SPRING_PULL = "SPRING_PULL", p.SPRING_SETTLE = "SPRING_SETTLE", p.EMIT = "EMIT", p))(St || {});
10
10
  function ks(p) {
11
11
  if (p.length < 5) return p;
12
12
  const t = new Set("aeiouyAEIOUY".split(""));
@@ -47,102 +47,102 @@ function ps(p) {
47
47
  enableSegments: f = !1
48
48
  } = p;
49
49
  let d = String(t || "");
50
- c === "uppercase" ? d = d.toUpperCase() : c === "lowercase" ? d = d.toLowerCase() : c === "capitalize" && (d = d.replace(/\b\w/g, (P) => P.toUpperCase())), p.hyphenation === !0 && (d = Ts(d));
50
+ c === "uppercase" ? d = d.toUpperCase() : c === "lowercase" ? d = d.toLowerCase() : c === "capitalize" && (d = d.replace(/\b\w/g, (_) => _.toUpperCase())), p.hyphenation === !0 && (d = Ts(d));
51
51
  const u = `${i} ${e} ${o}px "${s}", sans-serif`, m = `${d}|${u}|${r}|${l}|${h}|${f}|${JSON.stringify(g)}|hyp:${!!p.hyphenation}|comp:${p.composer}|bal:${!!p.balanceRaggedLines}`;
52
52
  let y = Ee.get(m);
53
- const v = typeof CanvasRenderingContext2D < "u" ? CanvasRenderingContext2D.prototype.measureText : null, b = function(P) {
53
+ const v = typeof CanvasRenderingContext2D < "u" ? CanvasRenderingContext2D.prototype.measureText : null, b = function(_) {
54
54
  if (!v) return { width: 0, fontBoundingBoxAscent: 0, fontBoundingBoxDescent: 0 };
55
- const T = v.call(this, P);
56
- return r !== 0 && P && P.length > 0 ? {
55
+ const T = v.call(this, _);
56
+ return r !== 0 && _ && _.length > 0 ? {
57
57
  ...T,
58
- width: T.width + (P.length - 1) * r
58
+ width: T.width + (_.length - 1) * r
59
59
  } : T;
60
60
  };
61
61
  if (!y) {
62
62
  try {
63
63
  if (r !== 0 && typeof CanvasRenderingContext2D < "u" && (CanvasRenderingContext2D.prototype.measureText = b), f && g && g.length > 0) {
64
- const P = g.map((T) => {
65
- let W = T.text || "";
64
+ const _ = g.map((T) => {
65
+ let $ = T.text || "";
66
66
  const k = T.textCase || c || "none";
67
- return k === "uppercase" ? W.toUpperCase() : k === "lowercase" ? W.toLowerCase() : k === "capitalize" ? W.replace(/\b\w/g, (_) => _.toUpperCase()) : W;
67
+ return k === "uppercase" ? $.toUpperCase() : k === "lowercase" ? $.toLowerCase() : k === "capitalize" ? $.replace(/\b\w/g, (E) => E.toUpperCase()) : $;
68
68
  }).join("");
69
- if (y = Ye(P, u), y) {
70
- let T = 0, W = o;
69
+ if (y = Xe(_, u), y) {
70
+ let T = 0, $ = o;
71
71
  for (const k of g) {
72
- let _ = k.text || "";
73
- if (!_) continue;
74
- const L = k.textCase || c || "none";
75
- L === "uppercase" ? _ = _.toUpperCase() : L === "lowercase" ? _ = _.toLowerCase() : L === "capitalize" && (_ = _.replace(/\b\w/g, (O) => O.toUpperCase()));
76
- const x = k.fontSize || o;
77
- x > W && (W = x);
78
- const A = `${k.fontStyle || i} ${k.fontWeight || e} ${x}px "${k.fontFamily || s}", sans-serif`, $ = Ye(_, A);
79
- if ($ && $.widths)
80
- for (let O = 0; O < $.widths.length; O++) {
81
- const z = T + O;
82
- if (z < y.widths.length) {
83
- y.widths[z] = $.widths[O];
84
- const H = $.kinds[O];
72
+ let E = k.text || "";
73
+ if (!E) continue;
74
+ const R = k.textCase || c || "none";
75
+ R === "uppercase" ? E = E.toUpperCase() : R === "lowercase" ? E = E.toLowerCase() : R === "capitalize" && (E = E.replace(/\b\w/g, (x) => x.toUpperCase()));
76
+ const A = k.fontSize || o;
77
+ A > $ && ($ = A);
78
+ const O = `${k.fontStyle || i} ${k.fontWeight || e} ${A}px "${k.fontFamily || s}", sans-serif`, W = Xe(E, O);
79
+ if (W && W.widths)
80
+ for (let x = 0; x < W.widths.length; x++) {
81
+ const Y = T + x;
82
+ if (Y < y.widths.length) {
83
+ y.widths[Y] = W.widths[x];
84
+ const H = W.kinds[x];
85
85
  if (H === 2) {
86
- const et = _[O];
87
- et === `
88
- ` || et === "\r" ? y.kinds[z] = 2 : y.kinds[z] = 0;
86
+ const Q = E[x];
87
+ Q === `
88
+ ` || Q === "\r" ? y.kinds[Y] = 2 : y.kinds[Y] = 0;
89
89
  } else
90
- y.kinds[z] = H;
90
+ y.kinds[Y] = H;
91
91
  }
92
92
  }
93
- T += _.length;
93
+ T += E.length;
94
94
  }
95
- y.fullText = P, y.maxFontSize = W;
95
+ y.fullText = _, y.maxFontSize = $;
96
96
  }
97
97
  } else
98
- y = Ye(d, u);
98
+ y = Xe(d, u);
99
99
  y && Ee.set(m, y);
100
- } catch (P) {
101
- return console.error("[ExodeUI] Pretext prepare failed:", P), { width: a, height: 0, lineCount: 0, lines: [] };
100
+ } catch (_) {
101
+ return console.error("[ExodeUI] Pretext prepare failed:", _), { width: a, height: 0, lineCount: 0, lines: [] };
102
102
  } finally {
103
103
  r !== 0 && typeof CanvasRenderingContext2D < "u" && v && (CanvasRenderingContext2D.prototype.measureText = v);
104
104
  }
105
105
  if (Ee.size > 500) {
106
- const P = Ee.keys().next().value;
107
- P && Ee.delete(P);
106
+ const _ = Ee.keys().next().value;
107
+ _ && Ee.delete(_);
108
108
  }
109
109
  }
110
110
  if (h > 0 && y && y.widths && !y.indentApplied) {
111
- const P = [...y.widths], T = y.fullText || d;
112
- let W = !0;
111
+ const _ = [...y.widths], T = y.fullText || d;
112
+ let $ = !0;
113
113
  for (let k = 0; k < T.length; k++)
114
- W && P[k] !== void 0 && (P[k] += h, W = !1), (T[k] === `
115
- ` || T[k] === "\r") && (W = !0, T[k] === "\r" && T[k + 1] === `
114
+ $ && _[k] !== void 0 && (_[k] += h, $ = !1), (T[k] === `
115
+ ` || T[k] === "\r") && ($ = !0, T[k] === "\r" && T[k + 1] === `
116
116
  ` && k++);
117
- y = { ...y, widths: P, indentApplied: !0 };
117
+ y = { ...y, widths: _, indentApplied: !0 };
118
118
  }
119
119
  if (!y) return { width: a, height: 0, lineCount: 0, lines: [] };
120
120
  let C = n;
121
121
  typeof C == "string" && (C = parseFloat(C)), C > 5 && o > 0 && (C = C / o), r !== 0 && (CanvasRenderingContext2D.prototype.measureText = b);
122
122
  let S;
123
123
  try {
124
- const P = y.maxFontSize || o;
124
+ const _ = y.maxFontSize || o;
125
125
  if (a >= 1e5) {
126
126
  const T = d.split(/\r\n|\r|\n/);
127
127
  S = {
128
- lines: T.map((W) => ({ text: W, width: 0 })),
128
+ lines: T.map(($) => ({ text: $, width: 0 })),
129
129
  // Width will be measured below
130
- height: T.length * (C * P),
130
+ height: T.length * (C * _),
131
131
  lineCount: T.length
132
132
  };
133
133
  } else
134
- S = Is(y, a, C * P);
134
+ S = Is(y, a, C * _);
135
135
  } finally {
136
136
  r !== 0 && v && (CanvasRenderingContext2D.prototype.measureText = v);
137
137
  }
138
138
  let I = (S == null ? void 0 : S.height) !== void 0 && S.height > 0 ? S.height : (((M = S == null ? void 0 : S.lines) == null ? void 0 : M.length) || 0) * C * o;
139
139
  if (l > 0 && S && S.lines && S.lines.length > 1) {
140
- let P = 0;
140
+ let _ = 0;
141
141
  const T = y.fullText || t;
142
- for (let W = 0; W < S.lines.length - 1; W++)
143
- P += S.lines[W].text.length, (T[P] === `
144
- ` || T[P] === "\r") && (I += l, P++, T[P - 1] === "\r" && T[P] === `
145
- ` && P++);
142
+ for (let $ = 0; $ < S.lines.length - 1; $++)
143
+ _ += S.lines[$].text.length, (T[_] === `
144
+ ` || T[_] === "\r") && (I += l, _++, T[_ - 1] === "\r" && T[_] === `
145
+ ` && _++);
146
146
  }
147
147
  let w = (S == null ? void 0 : S.lines) || [];
148
148
  return p.composer === "every-line" && w.length > 1 && (w = _s(w)), p.balanceRaggedLines === !0 && w.length > 1 && (w = Ps(w)), {
@@ -182,58 +182,58 @@ function ss(p, t, s) {
182
182
  }
183
183
  }
184
184
  function Es(p, t, s) {
185
- var _, L;
186
- const o = p.autoLayout, { direction: e, spacing: i, padding: n, align: a, wrap: r } = o, l = e === "vertical", h = t.map((x) => {
187
- const A = s(x.id), $ = x.geometry;
188
- let O = (A == null ? void 0 : A.width) ?? $.width ?? 100, z = (A == null ? void 0 : A.height) ?? $.height ?? 100;
189
- if ($.type === "Ellipse" || $.type === "Polygon" || $.type === "Star") {
190
- const H = (A == null ? void 0 : A.radius) ?? $.radius ?? (A == null ? void 0 : A.outer_radius) ?? $.outer_radius ?? 50;
191
- O = H * 2, z = H * 2;
192
- } else if ($.type === "Text") {
185
+ var E, R;
186
+ const o = p.autoLayout, { direction: e, spacing: i, padding: n, align: a, wrap: r } = o, l = e === "vertical", h = t.map((A) => {
187
+ const O = s(A.id), W = A.geometry;
188
+ let x = (O == null ? void 0 : O.width) ?? W.width ?? 100, Y = (O == null ? void 0 : O.height) ?? W.height ?? 100;
189
+ if (W.type === "Ellipse" || W.type === "Polygon" || W.type === "Star") {
190
+ const H = (O == null ? void 0 : O.radius) ?? W.radius ?? (O == null ? void 0 : O.outer_radius) ?? W.outer_radius ?? 50;
191
+ x = H * 2, Y = H * 2;
192
+ } else if (W.type === "Text") {
193
193
  const H = ps({
194
- text: (A == null ? void 0 : A.text) ?? $.text ?? "",
195
- fontFamily: $.fontFamily,
196
- fontSize: $.fontSize,
197
- fontWeight: $.fontWeight,
198
- fontStyle: $.fontStyle,
199
- lineHeight: $.lineHeight,
200
- width: $.width || 200,
201
- letterSpacing: $.letterSpacing,
202
- paragraphSpacing: $.paragraphSpacing,
203
- paragraphIndent: $.paragraphIndent,
204
- textCase: $.textCase,
205
- segments: $.segments,
206
- enableSegments: $.enableSegments
194
+ text: (O == null ? void 0 : O.text) ?? W.text ?? "",
195
+ fontFamily: W.fontFamily,
196
+ fontSize: W.fontSize,
197
+ fontWeight: W.fontWeight,
198
+ fontStyle: W.fontStyle,
199
+ lineHeight: W.lineHeight,
200
+ width: W.width || 200,
201
+ letterSpacing: W.letterSpacing,
202
+ paragraphSpacing: W.paragraphSpacing,
203
+ paragraphIndent: W.paragraphIndent,
204
+ textCase: W.textCase,
205
+ segments: W.segments,
206
+ enableSegments: W.enableSegments
207
207
  });
208
- z = H.height, $.width || (O = H.width);
208
+ Y = H.height, W.width || (x = H.width);
209
209
  }
210
- return O *= x.transform.scale_x || 1, z *= x.transform.scale_y || 1, { id: x.id, w: O, h: z, original: x };
210
+ return x *= A.transform.scale_x || 1, Y *= A.transform.scale_y || 1, { id: A.id, w: x, h: Y, original: A };
211
211
  });
212
212
  let c = p.width, g = p.height;
213
- const f = ((_ = p.layoutProps) == null ? void 0 : _.width) === "hug", d = ((L = p.layoutProps) == null ? void 0 : L.height) === "hug", u = [];
213
+ const f = ((E = p.layoutProps) == null ? void 0 : E.width) === "hug", d = ((R = p.layoutProps) == null ? void 0 : R.height) === "hug", u = [];
214
214
  let m = [], y = 0, v = 0;
215
215
  const b = c - n.left - n.right, C = g - n.top - n.bottom;
216
- h.forEach((x) => {
217
- r && m.length > 0 && (l ? v + i + x.h > C : y + i + x.w > b) ? (u.push({ children: m, width: y, height: v }), m = [x], y = x.w, v = x.h) : (m.push(x), l ? (y = Math.max(y, x.w), v += (m.length > 1 ? i : 0) + x.h) : (y += (m.length > 1 ? i : 0) + x.w, v = Math.max(v, x.h)));
218
- }), m.length > 0 && u.push({ children: m, width: y, height: v }), f && !l && (c = Math.max(...u.map((x) => x.width), 0) + n.left + n.right), d && l && (g = Math.max(...u.map((x) => x.height), 0) + n.top + n.bottom);
216
+ h.forEach((A) => {
217
+ r && m.length > 0 && (l ? v + i + A.h > C : y + i + A.w > b) ? (u.push({ children: m, width: y, height: v }), m = [A], y = A.w, v = A.h) : (m.push(A), l ? (y = Math.max(y, A.w), v += (m.length > 1 ? i : 0) + A.h) : (y += (m.length > 1 ? i : 0) + A.w, v = Math.max(v, A.h)));
218
+ }), m.length > 0 && u.push({ children: m, width: y, height: v }), f && !l && (c = Math.max(...u.map((A) => A.width), 0) + n.left + n.right), d && l && (g = Math.max(...u.map((A) => A.height), 0) + n.top + n.bottom);
219
219
  const S = [];
220
220
  let I = n.left, w = n.top;
221
- const M = a.toLowerCase(), P = M === "center" || M.endsWith("-center"), T = M.endsWith("-right"), W = M === "center" || M.startsWith("center-"), k = M.startsWith("bottom-");
222
- return u.forEach((x) => {
223
- let A = I, $ = w;
224
- l ? W ? $ = n.top + (g - n.top - n.bottom - x.height) / 2 : k && ($ = g - n.bottom - x.height) : P ? A = n.left + (c - n.left - n.right - x.width) / 2 : T && (A = c - n.right - x.width), x.children.forEach((O) => {
225
- var F, q;
226
- let z = A, H = $;
227
- l ? P ? z += (x.width - O.w) / 2 : T && (z += x.width - O.w) : W ? H += (x.height - O.h) / 2 : k && (H += x.height - O.h);
228
- const et = ((F = O.original.layoutProps) == null ? void 0 : F.width) === "fill", E = ((q = O.original.layoutProps) == null ? void 0 : q.height) === "fill";
221
+ const M = a.toLowerCase(), _ = M === "center" || M.endsWith("-center"), T = M.endsWith("-right"), $ = M === "center" || M.startsWith("center-"), k = M.startsWith("bottom-");
222
+ return u.forEach((A) => {
223
+ let O = I, W = w;
224
+ l ? $ ? W = n.top + (g - n.top - n.bottom - A.height) / 2 : k && (W = g - n.bottom - A.height) : _ ? O = n.left + (c - n.left - n.right - A.width) / 2 : T && (O = c - n.right - A.width), A.children.forEach((x) => {
225
+ var F, U;
226
+ let Y = O, H = W;
227
+ l ? _ ? Y += (A.width - x.w) / 2 : T && (Y += A.width - x.w) : $ ? H += (A.height - x.h) / 2 : k && (H += A.height - x.h);
228
+ const Q = ((F = x.original.layoutProps) == null ? void 0 : F.width) === "fill", P = ((U = x.original.layoutProps) == null ? void 0 : U.height) === "fill";
229
229
  S.push({
230
- id: O.id,
231
- x: z + O.w / 2 - c / 2,
232
- y: H + O.h / 2 - g / 2,
233
- width: et && l ? x.width : void 0,
234
- height: E ? l ? void 0 : x.height : void 0
235
- }), l ? $ += O.h + i : A += O.w + i;
236
- }), l ? I += x.width + i : w += x.height + i;
230
+ id: x.id,
231
+ x: Y + x.w / 2 - c / 2,
232
+ y: H + x.h / 2 - g / 2,
233
+ width: Q && l ? A.width : void 0,
234
+ height: P ? l ? void 0 : A.height : void 0
235
+ }), l ? W += x.h + i : O += x.w + i;
236
+ }), l ? I += A.width + i : w += A.height + i;
237
237
  }), { frameWidth: f ? c : void 0, frameHeight: d ? g : void 0, childUpdates: S };
238
238
  }
239
239
  function xs(p, t, s) {
@@ -241,39 +241,39 @@ function xs(p, t, s) {
241
241
  if (!o) return { childUpdates: [] };
242
242
  const { gridColumns: e, gridRows: i, columnGap: n = 0, rowGap: a = 0, padding: r, align: l } = o;
243
243
  let h = p.width, c = p.height;
244
- const g = h - r.left - r.right, f = c - r.top - r.bottom, d = es(e || "1fr", g, n), u = es(i || "auto", f, a), m = d.length > 0 ? d.reduce((T, W) => T + W, 0) + (d.length - 1) * n : 0, y = u.length > 0 ? u.reduce((T, W) => T + W, 0) + (u.length - 1) * a : 0, v = l.toLowerCase(), b = v === "center" || v.endsWith("-center"), C = v.endsWith("-right"), S = v === "center" || v.startsWith("center-"), I = v.startsWith("bottom-");
244
+ const g = h - r.left - r.right, f = c - r.top - r.bottom, d = es(e || "1fr", g, n), u = es(i || "auto", f, a), m = d.length > 0 ? d.reduce((T, $) => T + $, 0) + (d.length - 1) * n : 0, y = u.length > 0 ? u.reduce((T, $) => T + $, 0) + (u.length - 1) * a : 0, v = l.toLowerCase(), b = v === "center" || v.endsWith("-center"), C = v.endsWith("-right"), S = v === "center" || v.startsWith("center-"), I = v.startsWith("bottom-");
245
245
  let w = 0, M = 0;
246
246
  b ? w = (g - m) / 2 : C && (w = g - m), S ? M = (f - y) / 2 : I && (M = f - y);
247
- const P = [];
248
- return t.forEach((T, W) => {
249
- var q, Q;
250
- const k = W % d.length || 0, _ = Math.floor(W / d.length) || 0;
251
- _ >= u.length && u.push(100);
252
- const L = d[k], x = u[_];
253
- let A = r.left + w + d.slice(0, k).reduce((it, dt) => it + dt + n, 0), $ = r.top + M + u.slice(0, _).reduce((it, dt) => it + dt + a, 0);
254
- const O = s(T.id), z = T.geometry;
255
- let H = (O == null ? void 0 : O.width) ?? z.width ?? 100, et = (O == null ? void 0 : O.height) ?? z.height ?? 100;
256
- if (z.type === "Ellipse" || z.type === "Polygon" || z.type === "Star") {
257
- const it = (O == null ? void 0 : O.radius) ?? z.radius ?? (O == null ? void 0 : O.outer_radius) ?? z.outer_radius ?? 50;
258
- H = it * 2, et = it * 2;
247
+ const _ = [];
248
+ return t.forEach((T, $) => {
249
+ var U, J;
250
+ const k = $ % d.length || 0, E = Math.floor($ / d.length) || 0;
251
+ E >= u.length && u.push(100);
252
+ const R = d[k], A = u[E];
253
+ let O = r.left + w + d.slice(0, k).reduce((it, dt) => it + dt + n, 0), W = r.top + M + u.slice(0, E).reduce((it, dt) => it + dt + a, 0);
254
+ const x = s(T.id), Y = T.geometry;
255
+ let H = (x == null ? void 0 : x.width) ?? Y.width ?? 100, Q = (x == null ? void 0 : x.height) ?? Y.height ?? 100;
256
+ if (Y.type === "Ellipse" || Y.type === "Polygon" || Y.type === "Star") {
257
+ const it = (x == null ? void 0 : x.radius) ?? Y.radius ?? (x == null ? void 0 : x.outer_radius) ?? Y.outer_radius ?? 50;
258
+ H = it * 2, Q = it * 2;
259
259
  }
260
- H *= T.transform.scale_x || 1, et *= T.transform.scale_y || 1;
261
- let E = A, F = $;
262
- b ? E += (L - H) / 2 : C && (E += L - H), S ? F += (x - et) / 2 : I && (F += x - et), P.push({
260
+ H *= T.transform.scale_x || 1, Q *= T.transform.scale_y || 1;
261
+ let P = O, F = W;
262
+ b ? P += (R - H) / 2 : C && (P += R - H), S ? F += (A - Q) / 2 : I && (F += A - Q), _.push({
263
263
  id: T.id,
264
- x: E + H / 2 - h / 2,
265
- y: F + et / 2 - c / 2,
266
- width: ((q = T.layoutProps) == null ? void 0 : q.width) === "fill" ? L : void 0,
267
- height: ((Q = T.layoutProps) == null ? void 0 : Q.height) === "fill" ? x : void 0
264
+ x: P + H / 2 - h / 2,
265
+ y: F + Q / 2 - c / 2,
266
+ width: ((U = T.layoutProps) == null ? void 0 : U.width) === "fill" ? R : void 0,
267
+ height: ((J = T.layoutProps) == null ? void 0 : J.height) === "fill" ? A : void 0
268
268
  });
269
- }), { childUpdates: P };
269
+ }), { childUpdates: _ };
270
270
  }
271
271
  class As {
272
272
  constructor() {
273
- tt(this, "world", null);
274
- tt(this, "bodies", /* @__PURE__ */ new Map());
275
- tt(this, "colliders", /* @__PURE__ */ new Map());
276
- tt(this, "initialized", !1);
273
+ et(this, "world", null);
274
+ et(this, "bodies", /* @__PURE__ */ new Map());
275
+ et(this, "colliders", /* @__PURE__ */ new Map());
276
+ et(this, "initialized", !1);
277
277
  }
278
278
  async init(t) {
279
279
  this.initialized || (await ae.init(), this.world = new ae.World(new ae.Vector2(t.x, t.y)), this.initialized = !0);
@@ -371,9 +371,9 @@ class As {
371
371
  e && e.applyImpulse(new ae.Vector2(s, o), !0);
372
372
  }
373
373
  }
374
- const us = (p) => p, Os = (p) => p > 0 ? 1 : 0, Rs = (p) => p < 1 ? 0 : 1, is = (p) => p * p, ns = (p) => p * (2 - p), os = (p) => p < 0.5 ? 2 * p * p : -1 + (4 - 2 * p) * p, Ls = (p) => p * p * p, Fs = (p) => --p * p * p + 1, $s = (p) => p < 0.5 ? 4 * p * p * p : (p - 1) * (2 * p - 2) * (2 * p - 2) + 1, Ws = (p) => p * p * p * p, Bs = (p) => 1 - --p * p * p * p, Gs = (p) => p < 0.5 ? 8 * p * p * p * p : 1 - 8 * --p * p * p * p, Ys = (p) => p * p * p * p * p, Xs = (p) => 1 + --p * p * p * p * p, Ds = (p) => p < 0.5 ? 16 * p * p * p * p * p : 1 + 16 * --p * p * p * p * p, Vs = (p) => 1 - Math.cos(p * Math.PI / 2), zs = (p) => Math.sin(p * Math.PI / 2), Ns = (p) => -(Math.cos(Math.PI * p) - 1) / 2, Hs = (p) => p === 0 ? 0 : Math.pow(2, 10 * (p - 1)), Us = (p) => p === 1 ? 1 : 1 - Math.pow(2, -10 * p), qs = (p) => p === 0 ? 0 : p === 1 ? 1 : p < 0.5 ? Math.pow(2, 20 * p - 10) / 2 : (2 - Math.pow(2, -20 * p + 10)) / 2, Js = (p) => 1 - Math.sqrt(1 - p * p), Qs = (p) => Math.sqrt(1 - --p * p), Ks = (p) => p < 0.5 ? (1 - Math.sqrt(1 - 4 * p * p)) / 2 : (Math.sqrt(1 - (-2 * p + 2) * (-2 * p + 2)) + 1) / 2, Ge = 1.70158, $e = Ge * 1.525, gs = Ge + 1, Zs = (p) => gs * p * p * p - Ge * p * p, js = (p) => 1 + gs * Math.pow(p - 1, 3) + Ge * Math.pow(p - 1, 2), ti = (p) => p < 0.5 ? Math.pow(2 * p, 2) * (($e + 1) * 2 * p - $e) / 2 : (Math.pow(2 * p - 2, 2) * (($e + 1) * (p * 2 - 2) + $e) + 2) / 2, ms = 2 * Math.PI / 3, as = 2 * Math.PI / 4.5, ei = (p) => p === 0 ? 0 : p === 1 ? 1 : -Math.pow(2, 10 * p - 10) * Math.sin((p * 10 - 10.75) * ms), si = (p) => p === 0 ? 0 : p === 1 ? 1 : Math.pow(2, -10 * p) * Math.sin((p * 10 - 0.75) * ms) + 1, ii = (p) => p === 0 ? 0 : p === 1 ? 1 : p < 0.5 ? -(Math.pow(2, 20 * p - 10) * Math.sin((20 * p - 11.125) * as)) / 2 : Math.pow(2, -20 * p + 10) * Math.sin((20 * p - 11.125) * as) / 2 + 1, Be = (p) => p < 1 / 2.75 ? 7.5625 * p * p : p < 2 / 2.75 ? 7.5625 * (p -= 1.5 / 2.75) * p + 0.75 : p < 2.5 / 2.75 ? 7.5625 * (p -= 2.25 / 2.75) * p + 0.9375 : 7.5625 * (p -= 2.625 / 2.75) * p + 0.984375, ni = (p) => 1 - Be(1 - p), oi = Be, ai = (p) => p < 0.5 ? (1 - Be(1 - 2 * p)) / 2 : (1 + Be(2 * p - 1)) / 2, Xe = /* @__PURE__ */ new Map(), xe = (p, t, s, o) => {
374
+ const us = (p) => p, Os = (p) => p > 0 ? 1 : 0, Rs = (p) => p < 1 ? 0 : 1, is = (p) => p * p, ns = (p) => p * (2 - p), os = (p) => p < 0.5 ? 2 * p * p : -1 + (4 - 2 * p) * p, Ls = (p) => p * p * p, Fs = (p) => --p * p * p + 1, $s = (p) => p < 0.5 ? 4 * p * p * p : (p - 1) * (2 * p - 2) * (2 * p - 2) + 1, Ws = (p) => p * p * p * p, Bs = (p) => 1 - --p * p * p * p, Ys = (p) => p < 0.5 ? 8 * p * p * p * p : 1 - 8 * --p * p * p * p, Xs = (p) => p * p * p * p * p, Gs = (p) => 1 + --p * p * p * p * p, Ds = (p) => p < 0.5 ? 16 * p * p * p * p * p : 1 + 16 * --p * p * p * p * p, zs = (p) => 1 - Math.cos(p * Math.PI / 2), Vs = (p) => Math.sin(p * Math.PI / 2), Ns = (p) => -(Math.cos(Math.PI * p) - 1) / 2, Hs = (p) => p === 0 ? 0 : Math.pow(2, 10 * (p - 1)), Us = (p) => p === 1 ? 1 : 1 - Math.pow(2, -10 * p), qs = (p) => p === 0 ? 0 : p === 1 ? 1 : p < 0.5 ? Math.pow(2, 20 * p - 10) / 2 : (2 - Math.pow(2, -20 * p + 10)) / 2, Js = (p) => 1 - Math.sqrt(1 - p * p), Qs = (p) => Math.sqrt(1 - --p * p), Ks = (p) => p < 0.5 ? (1 - Math.sqrt(1 - 4 * p * p)) / 2 : (Math.sqrt(1 - (-2 * p + 2) * (-2 * p + 2)) + 1) / 2, Ye = 1.70158, $e = Ye * 1.525, gs = Ye + 1, Zs = (p) => gs * p * p * p - Ye * p * p, js = (p) => 1 + gs * Math.pow(p - 1, 3) + Ye * Math.pow(p - 1, 2), ti = (p) => p < 0.5 ? Math.pow(2 * p, 2) * (($e + 1) * 2 * p - $e) / 2 : (Math.pow(2 * p - 2, 2) * (($e + 1) * (p * 2 - 2) + $e) + 2) / 2, ms = 2 * Math.PI / 3, as = 2 * Math.PI / 4.5, ei = (p) => p === 0 ? 0 : p === 1 ? 1 : -Math.pow(2, 10 * p - 10) * Math.sin((p * 10 - 10.75) * ms), si = (p) => p === 0 ? 0 : p === 1 ? 1 : Math.pow(2, -10 * p) * Math.sin((p * 10 - 0.75) * ms) + 1, ii = (p) => p === 0 ? 0 : p === 1 ? 1 : p < 0.5 ? -(Math.pow(2, 20 * p - 10) * Math.sin((20 * p - 11.125) * as)) / 2 : Math.pow(2, -20 * p + 10) * Math.sin((20 * p - 11.125) * as) / 2 + 1, Be = (p) => p < 1 / 2.75 ? 7.5625 * p * p : p < 2 / 2.75 ? 7.5625 * (p -= 1.5 / 2.75) * p + 0.75 : p < 2.5 / 2.75 ? 7.5625 * (p -= 2.25 / 2.75) * p + 0.9375 : 7.5625 * (p -= 2.625 / 2.75) * p + 0.984375, ni = (p) => 1 - Be(1 - p), oi = Be, ai = (p) => p < 0.5 ? (1 - Be(1 - 2 * p)) / 2 : (1 + Be(2 * p - 1)) / 2, Ge = /* @__PURE__ */ new Map(), xe = (p, t, s, o) => {
375
375
  const e = `${p},${t},${s},${o}`;
376
- if (Xe.has(e)) return Xe.get(e);
376
+ if (Ge.has(e)) return Ge.get(e);
377
377
  const i = (h) => (1 - 3 * s + 3 * p) * h * h * h + (3 * s - 6 * p) * h * h + 3 * p * h, n = (h) => (1 - 3 * o + 3 * t) * h * h * h + (3 * o - 6 * t) * h * h + 3 * t * h, a = (h) => 3 * (1 - 3 * s + 3 * p) * h * h + 2 * (3 * s - 6 * p) * h + 3 * p, r = (h) => {
378
378
  let c = h;
379
379
  for (let g = 0; g < 8; g++) {
@@ -385,7 +385,7 @@ const us = (p) => p, Os = (p) => p > 0 ? 1 : 0, Rs = (p) => p < 1 ? 0 : 1, is =
385
385
  }
386
386
  return c;
387
387
  }, l = (h) => h === 0 ? 0 : h === 1 ? 1 : n(r(h));
388
- return Xe.set(e, l), l;
388
+ return Ge.set(e, l), l;
389
389
  }, rs = (p) => {
390
390
  const t = p.match(/cubic-bezier\s*\(\s*([-?\d.]+)\s*,\s*([-?\d.]+)\s*,\s*([-?\d.]+)\s*,\s*([-?\d.]+)\s*\)/);
391
391
  if (!t) return null;
@@ -410,14 +410,14 @@ const us = (p) => p, Os = (p) => p > 0 ? 1 : 0, Rs = (p) => p < 1 ? 0 : 1, is =
410
410
  // Quartic
411
411
  EaseInQuart: Ws,
412
412
  EaseOutQuart: Bs,
413
- EaseInOutQuart: Gs,
413
+ EaseInOutQuart: Ys,
414
414
  // Quintic
415
- EaseInQuint: Ys,
416
- EaseOutQuint: Xs,
415
+ EaseInQuint: Xs,
416
+ EaseOutQuint: Gs,
417
417
  EaseInOutQuint: Ds,
418
418
  // Sinusoidal
419
- EaseInSine: Vs,
420
- EaseOutSine: zs,
419
+ EaseInSine: zs,
420
+ EaseOutSine: Vs,
421
421
  EaseInOutSine: Ns,
422
422
  // Exponential
423
423
  EaseInExpo: Hs,
@@ -519,22 +519,49 @@ const us = (p) => p, Os = (p) => p > 0 ? 1 : 0, Rs = (p) => p < 1 ? 0 : 1, is =
519
519
  const i = o.scale_x ?? 1, n = o.scale_y ?? 1, a = (r, l, h) => {
520
520
  let c = 0, g = 0;
521
521
  const f = o.rotation * Math.PI / 180, d = Math.cos(f), u = Math.sin(f), m = r * i * d - l * n * u + o.x, y = r * i * u + l * n * d + o.y;
522
- h.forEach((w) => {
523
- const M = e(w.boneId);
524
- if (!M) return;
525
- const P = {
526
- x: M.x,
527
- y: M.y,
528
- rotation: M.rotation,
529
- scaleX: M.scale_x ?? 1,
530
- scaleY: M.scale_y ?? 1
531
- }, T = s[w.boneId] || [1, 0, 0, 1, 0, 0], W = m * T[0] + y * T[2] + T[4], k = m * T[1] + y * T[3] + T[5], _ = P.rotation * Math.PI / 180, L = Math.cos(_), x = Math.sin(_), A = W * P.scaleX * L - k * P.scaleY * x + P.x, $ = W * P.scaleX * x + k * P.scaleY * L + P.y;
532
- c += A * w.amount, g += $ * w.amount;
522
+ h.forEach((M) => {
523
+ const _ = e(M.boneId);
524
+ if (!_) return;
525
+ const T = {
526
+ x: _.x,
527
+ y: _.y,
528
+ rotation: _.rotation,
529
+ scaleX: _.scale_x ?? 1,
530
+ scaleY: _.scale_y ?? 1
531
+ }, $ = s[M.boneId] || [1, 0, 0, 1, 0, 0], k = m * $[0] + y * $[2] + $[4], E = m * $[1] + y * $[3] + $[5], R = T.rotation * Math.PI / 180, A = Math.cos(R), O = Math.sin(R), W = k * T.scaleX * A - E * T.scaleY * O + T.x, x = k * T.scaleX * O + E * T.scaleY * A + T.y;
532
+ c += W * M.amount, g += x * M.amount;
533
533
  });
534
- const v = o.rotation * Math.PI / 180, b = Math.cos(v), C = Math.sin(v), S = c - o.x, I = g - o.y;
534
+ const v = [...h].sort((M, _) => _.amount - M.amount);
535
+ if (v.length >= 2 && v[0].amount > 0 && v[1].amount > 0) {
536
+ const M = e(v[0].boneId), _ = e(v[1].boneId);
537
+ if (M && _ && M.length !== void 0 && _.length !== void 0) {
538
+ const T = M.length * (M.scale_y ?? 1), $ = M.rotation * Math.PI / 180, k = M.x - T * Math.sin($), E = M.y + T * Math.cos($), R = _.length * (_.scale_y ?? 1), A = _.rotation * Math.PI / 180, O = _.x - R * Math.sin(A), W = _.y + R * Math.cos(A);
539
+ let x = null, Y = null, H = !1;
540
+ const Q = 1;
541
+ if (Math.hypot(M.x - _.x, M.y - _.y) < Q || Math.hypot(M.x - O, M.y - W) < Q ? (x = M.x, Y = M.y) : (Math.hypot(k - _.x, E - _.y) < Q || Math.hypot(k - O, E - W) < Q) && (x = k, Y = E, H = !0), x !== null && Y !== null) {
542
+ const P = s[v[0].boneId] || [1, 0, 0, 1, 0, 0], F = P[0] * P[3] - P[1] * P[2];
543
+ let U = 0, J = 0;
544
+ if (F !== 0) {
545
+ const it = (P[2] * P[5] - P[3] * P[4]) / F, dt = (P[1] * P[4] - P[0] * P[5]) / F, yt = Math.atan2(-P[1], P[3]);
546
+ if (!H)
547
+ U = it, J = dt;
548
+ else {
549
+ const ot = -P[2] / F, Et = P[0] / F, Ft = Math.hypot(ot, Et), wt = M.length * Ft;
550
+ U = it - wt * Math.sin(yt), J = dt + wt * Math.cos(yt);
551
+ }
552
+ const ht = Math.hypot(m - U, y - J), pt = Math.hypot(c - x, g - Y);
553
+ if (pt > 0 && ht > 0) {
554
+ const ot = Math.max(pt, 0.01), Et = Math.min(ht / ot, 3), Ft = x + (c - x) * Et, wt = Y + (g - Y) * Et, Xt = v[0].amount, Bt = v[1].amount, B = Math.min(Xt, Bt) * 2, nt = 1 - Math.pow(1 - B, 4);
555
+ c = c * (1 - nt) + Ft * nt, g = g * (1 - nt) + wt * nt;
556
+ }
557
+ }
558
+ }
559
+ }
560
+ }
561
+ const b = o.rotation * Math.PI / 180, C = Math.cos(b), S = Math.sin(b), I = c - o.x, w = g - o.y;
535
562
  return {
536
- x: (S * b + I * C) / i,
537
- y: (-S * C + I * b) / n
563
+ x: (I * C + w * S) / i,
564
+ y: (-I * S + w * C) / n
538
565
  };
539
566
  };
540
567
  return p.map((r, l) => {
@@ -682,69 +709,69 @@ const us = (p) => p, Os = (p) => p > 0 ? 1 : 0, Rs = (p) => p < 1 ? 0 : 1, is =
682
709
  };
683
710
  class ci {
684
711
  constructor() {
685
- tt(this, "artboard", null);
686
- tt(this, "objectStates", /* @__PURE__ */ new Map());
712
+ et(this, "artboard", null);
713
+ et(this, "objectStates", /* @__PURE__ */ new Map());
687
714
  // Physics State
688
- tt(this, "physicsEngine", null);
715
+ et(this, "physicsEngine", null);
689
716
  // State Machine State
690
- tt(this, "activeStateMachine", null);
691
- tt(this, "inputs", /* @__PURE__ */ new Map());
717
+ et(this, "activeStateMachine", null);
718
+ et(this, "inputs", /* @__PURE__ */ new Map());
692
719
  // id -> value
693
- tt(this, "inputNameMap", /* @__PURE__ */ new Map());
720
+ et(this, "inputNameMap", /* @__PURE__ */ new Map());
694
721
  // name -> id[] mapping
695
- tt(this, "layerStates", /* @__PURE__ */ new Map());
696
- tt(this, "pretextCache", /* @__PURE__ */ new Map());
697
- tt(this, "pointerHistory", []);
698
- tt(this, "MAX_HISTORY", 200);
699
- tt(this, "imageCache", /* @__PURE__ */ new Map());
700
- tt(this, "lastValidSvgImgMap", /* @__PURE__ */ new Map());
701
- tt(this, "maskBuffer", null);
702
- tt(this, "maskCtx", null);
703
- tt(this, "lumaBuffer", null);
704
- tt(this, "lumaCtx", null);
705
- tt(this, "_noiseTileCanvas", null);
706
- tt(this, "layout", { fit: "Contain", alignment: "Center" });
707
- tt(this, "onTrigger");
708
- tt(this, "onInputUpdate");
709
- tt(this, "onComponentChange");
722
+ et(this, "layerStates", /* @__PURE__ */ new Map());
723
+ et(this, "pretextCache", /* @__PURE__ */ new Map());
724
+ et(this, "pointerHistory", []);
725
+ et(this, "MAX_HISTORY", 200);
726
+ et(this, "imageCache", /* @__PURE__ */ new Map());
727
+ et(this, "lastValidSvgImgMap", /* @__PURE__ */ new Map());
728
+ et(this, "maskBuffer", null);
729
+ et(this, "maskCtx", null);
730
+ et(this, "lumaBuffer", null);
731
+ et(this, "lumaCtx", null);
732
+ et(this, "_noiseTileCanvas", null);
733
+ et(this, "layout", { fit: "Contain", alignment: "Center" });
734
+ et(this, "onTrigger");
735
+ et(this, "onInputUpdate");
736
+ et(this, "onComponentChange");
710
737
  // Specific Component Listeners
711
- tt(this, "onToggle");
712
- tt(this, "onInputChange");
713
- tt(this, "onInputFocus");
714
- tt(this, "onInputBlur");
715
- tt(this, "onLog");
716
- tt(this, "onButtonClick");
717
- tt(this, "onGraphPointClick");
738
+ et(this, "onToggle");
739
+ et(this, "onInputChange");
740
+ et(this, "onInputFocus");
741
+ et(this, "onInputBlur");
742
+ et(this, "onLog");
743
+ et(this, "onButtonClick");
744
+ et(this, "onGraphPointClick");
718
745
  // Track triggers that were just fired in the current frame
719
- tt(this, "justFiredTriggers", /* @__PURE__ */ new Set());
720
- tt(this, "rootTransform", null);
721
- tt(this, "canvasWidth", 0);
722
- tt(this, "canvasHeight", 0);
746
+ et(this, "justFiredTriggers", /* @__PURE__ */ new Set());
747
+ et(this, "rootTransform", null);
748
+ et(this, "canvasWidth", 0);
749
+ et(this, "canvasHeight", 0);
723
750
  // Track currently hovered object for Enter/Leave events
724
- tt(this, "lastHoveredObjectId", null);
725
- tt(this, "_lastPointerPos", null);
726
- tt(this, "_prevPointerPos", null);
751
+ et(this, "lastHoveredObjectId", null);
752
+ et(this, "_lastPointerPos", null);
753
+ et(this, "_prevPointerPos", null);
727
754
  // Interaction State
728
- tt(this, "focusedId", null);
729
- tt(this, "draggingSliderId", null);
730
- tt(this, "activeDropdownId", null);
731
- tt(this, "activeObjectId", null);
732
- tt(this, "draggingListViewId", null);
733
- tt(this, "scrollOffset", { x: 0, y: 0 });
734
- tt(this, "_totalScroll", { x: 0, y: 0 });
735
- tt(this, "draggingBehaviors", /* @__PURE__ */ new Set());
736
- tt(this, "isMouseDown", !1);
755
+ et(this, "focusedId", null);
756
+ et(this, "draggingSliderId", null);
757
+ et(this, "activeDropdownId", null);
758
+ et(this, "activeObjectId", null);
759
+ et(this, "draggingListViewId", null);
760
+ et(this, "scrollOffset", { x: 0, y: 0 });
761
+ et(this, "_totalScroll", { x: 0, y: 0 });
762
+ et(this, "draggingBehaviors", /* @__PURE__ */ new Set());
763
+ et(this, "isMouseDown", !1);
737
764
  // LayoutAnimation & StateReactive: per-object property interpolation cache
738
- tt(this, "_layoutAnimCache", /* @__PURE__ */ new Map());
765
+ et(this, "_layoutAnimCache", /* @__PURE__ */ new Map());
739
766
  // SpringChain: per-chain physics state
740
- tt(this, "_springChainState", /* @__PURE__ */ new Map());
767
+ et(this, "_springChainState", /* @__PURE__ */ new Map());
741
768
  // ParticleEmitter: per-emitter particle pools
742
- tt(this, "_emitterPools", /* @__PURE__ */ new Map());
769
+ et(this, "_emitterPools", /* @__PURE__ */ new Map());
743
770
  // Physics/Animation State
744
- tt(this, "objectVelocities", /* @__PURE__ */ new Map());
745
- tt(this, "currentTime", 0);
746
- tt(this, "frameCount", 0);
747
- tt(this, "fontLeadingFactors", {
771
+ et(this, "objectVelocities", /* @__PURE__ */ new Map());
772
+ et(this, "currentTime", 0);
773
+ et(this, "frameCount", 0);
774
+ et(this, "fontLeadingFactors", {
748
775
  Inter: 0.35,
749
776
  Roboto: 0.45,
750
777
  Montserrat: 0.4,
@@ -757,24 +784,24 @@ class ci {
757
784
  "Bebas Neue": 0.45,
758
785
  Oswald: 0.4
759
786
  });
760
- tt(this, "onLogicUpdate");
761
- tt(this, "logicNodeValues", /* @__PURE__ */ new Map());
762
- tt(this, "logicNodeState", /* @__PURE__ */ new Map());
763
- tt(this, "pointerDownTimes", /* @__PURE__ */ new Map());
764
- tt(this, "activeHoverIds", /* @__PURE__ */ new Set());
765
- tt(this, "onNavigation");
787
+ et(this, "onLogicUpdate");
788
+ et(this, "logicNodeValues", /* @__PURE__ */ new Map());
789
+ et(this, "logicNodeState", /* @__PURE__ */ new Map());
790
+ et(this, "pointerDownTimes", /* @__PURE__ */ new Map());
791
+ et(this, "activeHoverIds", /* @__PURE__ */ new Set());
792
+ et(this, "onNavigation");
766
793
  // New Interaction State Trackers
767
- tt(this, "periodicTriggerTimes", /* @__PURE__ */ new Map());
794
+ et(this, "periodicTriggerTimes", /* @__PURE__ */ new Map());
768
795
  // interactionId -> lastFiredTime
769
- tt(this, "wasInView", /* @__PURE__ */ new Set());
796
+ et(this, "wasInView", /* @__PURE__ */ new Set());
770
797
  // objectId -> boolean
771
- tt(this, "scrollProgressLastValue", /* @__PURE__ */ new Map());
772
- tt(this, "debug_objectsRendered", 0);
773
- tt(this, "debug_objectsTotal", 0);
774
- tt(this, "lastRenderTime", 0);
775
- tt(this, "debugMode", !1);
798
+ et(this, "scrollProgressLastValue", /* @__PURE__ */ new Map());
799
+ et(this, "debug_objectsRendered", 0);
800
+ et(this, "debug_objectsTotal", 0);
801
+ et(this, "lastRenderTime", 0);
802
+ et(this, "debugMode", !1);
776
803
  // Trigger Management
777
- tt(this, "activeTriggers", /* @__PURE__ */ new Map());
804
+ et(this, "activeTriggers", /* @__PURE__ */ new Map());
778
805
  console.info("%c[ExodeUI Engine] Pixel-Perfect Parity Active (v6.3.10) - SVG Fill & Gradient Parity Active", "color: #3b82f6; font-weight: bold; padding: 2px 4px; border-radius: 4px; background: rgba(59, 130, 246, 0.1)");
779
806
  }
780
807
  // interactionId -> lastProgress
@@ -1409,23 +1436,23 @@ class ci {
1409
1436
  };
1410
1437
  let d = 0;
1411
1438
  switch (e.op) {
1412
- case Ct.AND:
1439
+ case St.AND:
1413
1440
  d = f("a", !1) && f("b", !1);
1414
1441
  break;
1415
- case Ct.OR:
1442
+ case St.OR:
1416
1443
  d = f("a", !1) || f("b", !1);
1417
1444
  break;
1418
- case Ct.NOT:
1445
+ case St.NOT:
1419
1446
  d = !f("in", !1);
1420
1447
  break;
1421
- case Ct.XOR:
1448
+ case St.XOR:
1422
1449
  d = !!f("a", !1) != !!f("b", !1);
1423
1450
  break;
1424
- case Ct.OBJECT:
1451
+ case St.OBJECT:
1425
1452
  d = e.name;
1426
1453
  break;
1427
- case Ct.PROPERTY:
1428
- case Ct.GET_PROPERTY: {
1454
+ case St.PROPERTY:
1455
+ case St.GET_PROPERTY: {
1429
1456
  const u = f("id", "");
1430
1457
  if (!u) {
1431
1458
  d = 0;
@@ -1444,7 +1471,7 @@ class ci {
1444
1471
  m in y ? d = y[m] : d = this.resolvePath(y, m);
1445
1472
  break;
1446
1473
  }
1447
- case Ct.SET_PROPERTY: {
1474
+ case St.SET_PROPERTY: {
1448
1475
  const u = f("id", ""), m = f("value", void 0);
1449
1476
  if (!u || m === void 0) {
1450
1477
  d = 0;
@@ -1474,105 +1501,105 @@ class ci {
1474
1501
  }
1475
1502
  break;
1476
1503
  }
1477
- case Ct.ADD:
1504
+ case St.ADD:
1478
1505
  d = f("a", 0) + f("b", 0);
1479
1506
  break;
1480
- case Ct.SUB:
1507
+ case St.SUB:
1481
1508
  d = f("a", 0) - f("b", 0);
1482
1509
  break;
1483
- case Ct.MUL:
1510
+ case St.MUL:
1484
1511
  d = f("a", 0) * f("b", 0);
1485
1512
  break;
1486
- case Ct.DIV: {
1513
+ case St.DIV: {
1487
1514
  const u = f("b", 1);
1488
1515
  d = u === 0 ? 0 : f("a", 0) / u;
1489
1516
  break;
1490
1517
  }
1491
- case Ct.MOD:
1518
+ case St.MOD:
1492
1519
  d = f("a", 0) % f("b", 1);
1493
1520
  break;
1494
- case Ct.POW:
1521
+ case St.POW:
1495
1522
  d = Math.pow(f("a", 0), f("b", 1));
1496
1523
  break;
1497
- case Ct.ABS:
1524
+ case St.ABS:
1498
1525
  d = Math.abs(f("in", 0));
1499
1526
  break;
1500
- case Ct.ROUND:
1527
+ case St.ROUND:
1501
1528
  d = Math.round(f("in", 0));
1502
1529
  break;
1503
- case Ct.FLOOR:
1530
+ case St.FLOOR:
1504
1531
  d = Math.floor(f("in", 0));
1505
1532
  break;
1506
- case Ct.CEIL:
1533
+ case St.CEIL:
1507
1534
  d = Math.ceil(f("in", 0));
1508
1535
  break;
1509
- case Ct.SIN:
1536
+ case St.SIN:
1510
1537
  d = Math.sin(f("in", 0));
1511
1538
  break;
1512
- case Ct.COS:
1539
+ case St.COS:
1513
1540
  d = Math.cos(f("in", 0));
1514
1541
  break;
1515
- case Ct.TAN:
1542
+ case St.TAN:
1516
1543
  d = Math.tan(f("in", 0));
1517
1544
  break;
1518
- case Ct.CLAMP: {
1545
+ case St.CLAMP: {
1519
1546
  const u = f("in", 0), m = f("min", 0), y = f("max", 1);
1520
1547
  d = Math.max(m, Math.min(y, u));
1521
1548
  break;
1522
1549
  }
1523
- case Ct.REMAP: {
1550
+ case St.REMAP: {
1524
1551
  const u = f("in", 0), m = f("inMin", 0), y = f("inMax", 100), v = f("outMin", 0), b = f("outMax", 1);
1525
1552
  d = y === m ? v : v + (u - m) * (b - v) / (y - m);
1526
1553
  break;
1527
1554
  }
1528
- case Ct.EQ:
1555
+ case St.EQ:
1529
1556
  d = f("a", 0) == f("b", 0);
1530
1557
  break;
1531
- case Ct.NEQ:
1558
+ case St.NEQ:
1532
1559
  d = f("a", 0) != f("b", 0);
1533
1560
  break;
1534
- case Ct.GT:
1561
+ case St.GT:
1535
1562
  d = f("a", 0) > f("b", 0);
1536
1563
  break;
1537
- case Ct.LT:
1564
+ case St.LT:
1538
1565
  d = f("a", 0) < f("b", 0);
1539
1566
  break;
1540
- case Ct.GTE:
1567
+ case St.GTE:
1541
1568
  d = f("a", 0) >= f("b", 0);
1542
1569
  break;
1543
- case Ct.LTE:
1570
+ case St.LTE:
1544
1571
  d = f("a", 0) <= f("b", 0);
1545
1572
  break;
1546
- case Ct.IF_ELSE:
1573
+ case St.IF_ELSE:
1547
1574
  d = f("cond", !1) ? f("then", 0) : f("else", 0);
1548
1575
  break;
1549
- case Ct.VALUE:
1576
+ case St.VALUE:
1550
1577
  d = e.value !== void 0 ? e.value : 0;
1551
1578
  break;
1552
- case Ct.INPUT:
1579
+ case St.INPUT:
1553
1580
  d = this.inputs.get(e.name) ?? 0;
1554
1581
  break;
1555
- case Ct.LOG: {
1582
+ case St.LOG: {
1556
1583
  const u = f("in", "");
1557
1584
  this.debugLog(`[User Logic] ${u}`), d = u;
1558
1585
  break;
1559
1586
  }
1560
- case Ct.SCROLL_X:
1587
+ case St.SCROLL_X:
1561
1588
  d = this.inputs.get("scrollX") ?? 0;
1562
1589
  break;
1563
- case Ct.SCROLL_Y:
1590
+ case St.SCROLL_Y:
1564
1591
  d = this.inputs.get("scrollY") ?? 0;
1565
1592
  break;
1566
- case Ct.MOUSE_X:
1593
+ case St.MOUSE_X:
1567
1594
  d = this.inputs.get("mouseX") ?? 0;
1568
1595
  break;
1569
- case Ct.MOUSE_Y:
1596
+ case St.MOUSE_Y:
1570
1597
  d = this.inputs.get("mouseY") ?? 0;
1571
1598
  break;
1572
- case Ct.IS_MOUSE_DOWN:
1599
+ case St.IS_MOUSE_DOWN:
1573
1600
  d = this.inputs.get("isMouseDown") ?? !1;
1574
1601
  break;
1575
- case Ct.EFFECTOR: {
1602
+ case St.EFFECTOR: {
1576
1603
  const u = f("id", ""), m = f("intensity", 1), y = f("trigger", !0);
1577
1604
  if (!u || !y) {
1578
1605
  d = 0;
@@ -1597,16 +1624,16 @@ class ci {
1597
1624
  }
1598
1625
  break;
1599
1626
  }
1600
- case Ct.MONITOR: {
1627
+ case St.MONITOR: {
1601
1628
  d = f("in", 0);
1602
1629
  break;
1603
1630
  }
1604
- case Ct.SPRING_PULL: {
1631
+ case St.SPRING_PULL: {
1605
1632
  const u = f("objectId", ""), m = f("forceX", 0), y = f("forceY", 0);
1606
1633
  u && ((l = this.artboard) == null || l.objects.forEach((v) => {
1607
1634
  v.behaviors && v.behaviors.forEach((b) => {
1608
1635
  var C;
1609
- if (b.type === Y.SpringChain && ((C = b.settings) != null && C.connections) && (b.settings.connections.some((I) => I.targetId === u) || v.id === u)) {
1636
+ if (b.type === G.SpringChain && ((C = b.settings) != null && C.connections) && (b.settings.connections.some((I) => I.targetId === u) || v.id === u)) {
1610
1637
  this._springChainState.has(v.id) || this._springChainState.set(v.id, /* @__PURE__ */ new Map());
1611
1638
  const I = this._springChainState.get(v.id);
1612
1639
  if (!I.has(u)) {
@@ -1625,7 +1652,7 @@ class ci {
1625
1652
  })), d = 1;
1626
1653
  break;
1627
1654
  }
1628
- case Ct.SPRING_SETTLE: {
1655
+ case St.SPRING_SETTLE: {
1629
1656
  const u = f("objectId", "");
1630
1657
  let m = !0;
1631
1658
  if (u) {
@@ -1638,11 +1665,11 @@ class ci {
1638
1665
  d = m;
1639
1666
  break;
1640
1667
  }
1641
- case Ct.EMIT: {
1668
+ case St.EMIT: {
1642
1669
  const u = f("objectId", ""), m = f("count", 20);
1643
1670
  u && ((h = this.artboard) == null || h.objects.forEach((y) => {
1644
1671
  y.behaviors && y.behaviors.forEach((v) => {
1645
- v.type === Y.ParticleEmitter && y.id === u && (v._pendingBurst = (v._pendingBurst || 0) + m);
1672
+ v.type === G.ParticleEmitter && y.id === u && (v._pendingBurst = (v._pendingBurst || 0) + m);
1646
1673
  });
1647
1674
  })), d = 1;
1648
1675
  break;
@@ -1651,7 +1678,7 @@ class ci {
1651
1678
  d = 0;
1652
1679
  break;
1653
1680
  }
1654
- if (this.logicNodeValues.set(t, d), e.op === Ct.DELAY) {
1681
+ if (this.logicNodeValues.set(t, d), e.op === St.DELAY) {
1655
1682
  const u = f("delay", 0), m = f("in", 0);
1656
1683
  let y = this.logicNodeState.get(t);
1657
1684
  for (y || (y = { queue: [] }, this.logicNodeState.set(t, y)), y.queue.push({ time: this.currentTime + u, value: m }); y.queue.length > 0 && y.queue[0].time <= this.currentTime; )
@@ -1683,7 +1710,7 @@ class ci {
1683
1710
  }
1684
1711
  runLogicNodes() {
1685
1712
  !this.activeStateMachine || !this.activeStateMachine.logicNodes || this.activeStateMachine.logicNodes.forEach((t) => {
1686
- (t.op === Ct.SET_PROPERTY || t.op === Ct.EFFECTOR) && this.evaluateLogicTree(t.id);
1713
+ (t.op === St.SET_PROPERTY || t.op === St.EFFECTOR) && this.evaluateLogicTree(t.id);
1687
1714
  });
1688
1715
  }
1689
1716
  resolvePath(t, s) {
@@ -1806,20 +1833,20 @@ class ci {
1806
1833
  if (b) {
1807
1834
  const C = r.offsetX || 0, S = r.offsetY || 0, I = b.x + C, w = b.y + S, M = r.useSpring;
1808
1835
  if (M) {
1809
- const T = this.objectVelocities.get(s.id) || { vx: 0, vy: 0 }, { x: W, y: k, vx: _, vy: L } = this.computeSpring(e.x, e.y, T.vx, T.vy, I, w, r, t);
1810
- r.copyX && (e.x = e.x + (W - e.x) * l), r.copyY && (e.y = e.y + (k - e.y) * l), this.objectVelocities.set(s.id, { vx: _, vy: L });
1836
+ const T = this.objectVelocities.get(s.id) || { vx: 0, vy: 0 }, { x: $, y: k, vx: E, vy: R } = this.computeSpring(e.x, e.y, T.vx, T.vy, I, w, r, t);
1837
+ r.copyX && (e.x = e.x + ($ - e.x) * l), r.copyY && (e.y = e.y + (k - e.y) * l), this.objectVelocities.set(s.id, { vx: E, vy: R });
1811
1838
  } else
1812
1839
  r.copyX && (e.x = e.x + (I - e.x) * l), r.copyY && (e.y = e.y + (w - e.y) * l);
1813
- let P = !1;
1840
+ let _ = !1;
1814
1841
  if ((c = r.limitX) != null && c.enabled) {
1815
1842
  const T = e.x;
1816
- e.x = Math.max(r.limitX.min, Math.min(r.limitX.max, e.x)), e.x !== T && (P = !0);
1843
+ e.x = Math.max(r.limitX.min, Math.min(r.limitX.max, e.x)), e.x !== T && (_ = !0);
1817
1844
  }
1818
1845
  if ((g = r.limitY) != null && g.enabled) {
1819
1846
  const T = e.y;
1820
- e.y = Math.max(r.limitY.min, Math.min(r.limitY.max, e.y)), e.y !== T && (P = !0);
1847
+ e.y = Math.max(r.limitY.min, Math.min(r.limitY.max, e.y)), e.y !== T && (_ = !0);
1821
1848
  }
1822
- P && M && this.objectVelocities.set(s.id, { vx: 0, vy: 0 });
1849
+ _ && M && this.objectVelocities.set(s.id, { vx: 0, vy: 0 });
1823
1850
  }
1824
1851
  } else if (r.type === "Rotation") {
1825
1852
  const b = this.getGlobalTransform(r.targetId);
@@ -1840,8 +1867,8 @@ class ci {
1840
1867
  } else if (r.type === "FollowPointer") {
1841
1868
  const b = ((f = this._lastPointerPos) == null ? void 0 : f.x) ?? e.x, C = ((d = this._lastPointerPos) == null ? void 0 : d.y) ?? e.y, S = r.useSpring;
1842
1869
  if (S) {
1843
- const w = this.objectVelocities.get(s.id) || { vx: 0, vy: 0 }, { x: M, y: P, vx: T, vy: W } = this.computeSpring(e.x, e.y, w.vx, w.vy, b, C, r, t);
1844
- e.x = M, e.y = P, this.objectVelocities.set(s.id, { vx: T, vy: W });
1870
+ const w = this.objectVelocities.get(s.id) || { vx: 0, vy: 0 }, { x: M, y: _, vx: T, vy: $ } = this.computeSpring(e.x, e.y, w.vx, w.vy, b, C, r, t);
1871
+ e.x = M, e.y = _, this.objectVelocities.set(s.id, { vx: T, vy: $ });
1845
1872
  } else
1846
1873
  e.x = e.x + (b - e.x) * l, e.y = e.y + (C - e.y) * l;
1847
1874
  let I = !1;
@@ -1874,8 +1901,8 @@ class ci {
1874
1901
  break;
1875
1902
  }
1876
1903
  if (I > 0) {
1877
- const P = e.x === b.x && e.y === b.y ? 1 : M / I;
1878
- e.x = e.x + (b.x + C * P - e.x) * l, e.y = e.y + (b.y + S * P - e.y) * l;
1904
+ const _ = e.x === b.x && e.y === b.y ? 1 : M / I;
1905
+ e.x = e.x + (b.x + C * _ - e.x) * l, e.y = e.y + (b.y + S * _ - e.y) * l;
1879
1906
  }
1880
1907
  }
1881
1908
  } else if (r.type === "FollowPath") {
@@ -1886,20 +1913,20 @@ class ci {
1886
1913
  let S = b.geometry;
1887
1914
  if (b.type === "Frame" || b.type === "Group" || !S || S.type !== "Path" && S.type !== "Ellipse" && S.type !== "Rectangle") {
1888
1915
  const F = (v = this.artboard) == null ? void 0 : v.objects.find(
1889
- (q) => q.parentId === b.id && q.type === "Shape" && q.geometry && (q.geometry.type === "Path" || q.geometry.type === "Ellipse" || q.geometry.type === "Rectangle")
1916
+ (U) => U.parentId === b.id && U.type === "Shape" && U.geometry && (U.geometry.type === "Path" || U.geometry.type === "Ellipse" || U.geometry.type === "Rectangle")
1890
1917
  );
1891
1918
  F && (S = F.geometry);
1892
1919
  }
1893
1920
  if (!S) return;
1894
- const I = (r.distance || 0) / 100, w = C.width || S.width || 0, M = C.height || S.height || 0, P = this.getPointOnPath(S, w, M, I), T = C.rotation * Math.PI / 180, W = Math.cos(T), k = Math.sin(T), _ = P.x * C.scale_x * W - P.y * C.scale_y * k, L = P.x * C.scale_x * k + P.y * C.scale_y * W;
1895
- let x = C.rotation + (r.offsetRotation || 0);
1921
+ const I = (r.distance || 0) / 100, w = C.width || S.width || 0, M = C.height || S.height || 0, _ = this.getPointOnPath(S, w, M, I), T = C.rotation * Math.PI / 180, $ = Math.cos(T), k = Math.sin(T), E = _.x * C.scale_x * $ - _.y * C.scale_y * k, R = _.x * C.scale_x * k + _.y * C.scale_y * $;
1922
+ let A = C.rotation + (r.offsetRotation || 0);
1896
1923
  if (r.orient) {
1897
- const F = Math.cos(P.angle), q = Math.sin(P.angle), Q = F * C.scale_x * W - q * C.scale_y * k, it = F * C.scale_x * k + q * C.scale_y * W;
1898
- x = Math.atan2(it, Q) * 180 / Math.PI + (r.offsetRotation || 0);
1924
+ const F = Math.cos(_.angle), U = Math.sin(_.angle), J = F * C.scale_x * $ - U * C.scale_y * k, it = F * C.scale_x * k + U * C.scale_y * $;
1925
+ A = Math.atan2(it, J) * 180 / Math.PI + (r.offsetRotation || 0);
1899
1926
  }
1900
- const A = x * Math.PI / 180, $ = Math.cos(A), O = Math.sin(A), z = (r.offsetX || 0) * $ - (r.offsetY || 0) * O, H = (r.offsetX || 0) * O + (r.offsetY || 0) * $, et = C.x + _ + z, E = C.y + L + H;
1901
- if (e.x = e.x + (et - e.x) * l, e.y = e.y + (E - e.y) * l, r.orient) {
1902
- let F = (x - e.rotation) % 360;
1927
+ const O = A * Math.PI / 180, W = Math.cos(O), x = Math.sin(O), Y = (r.offsetX || 0) * W - (r.offsetY || 0) * x, H = (r.offsetX || 0) * x + (r.offsetY || 0) * W, Q = C.x + E + Y, P = C.y + R + H;
1928
+ if (e.x = e.x + (Q - e.x) * l, e.y = e.y + (P - e.y) * l, r.orient) {
1929
+ let F = (A - e.rotation) % 360;
1903
1930
  F > 180 && (F -= 360), F < -180 && (F += 360), e.rotation = e.rotation + F * l;
1904
1931
  }
1905
1932
  }
@@ -1915,25 +1942,27 @@ class ci {
1915
1942
  });
1916
1943
  }
1917
1944
  getGlobalTransform(t) {
1918
- var u;
1945
+ var c, g;
1919
1946
  const s = this.objectStates.get(t);
1920
1947
  if (!s) return { x: 0, y: 0, rotation: 0, scale_x: 1, scale_y: 1 };
1921
- const o = (u = this.artboard) == null ? void 0 : u.objects.find((m) => m.id === t), e = this.getAnimatedValue(t, "x", s.x), i = this.getAnimatedValue(t, "y", s.y), n = this.getAnimatedValue(t, "rotation", s.rotation), a = this.getAnimatedValue(t, "scale_x", s.scale_x ?? 1) * (s.flip_x ? -1 : 1), r = this.getAnimatedValue(t, "scale_y", s.scale_y ?? 1) * (s.flip_y ? -1 : 1);
1948
+ const o = (c = this.artboard) == null ? void 0 : c.objects.find((f) => f.id === t), e = (o == null ? void 0 : o.type) === "Bone" ? (g = o.geometry) == null ? void 0 : g.length : void 0;
1922
1949
  if (!o || !o.parentId)
1923
1950
  return {
1924
- x: e,
1925
- y: i,
1926
- rotation: n,
1927
- scale_x: a,
1928
- scale_y: r
1951
+ x: s.x,
1952
+ y: s.y,
1953
+ rotation: s.rotation,
1954
+ scale_x: (s.scale_x ?? 1) * (s.flip_x ? -1 : 1),
1955
+ scale_y: (s.scale_y ?? 1) * (s.flip_y ? -1 : 1),
1956
+ length: e
1929
1957
  };
1930
- const l = this.getGlobalTransform(o.parentId), h = l.rotation * Math.PI / 180, c = Math.cos(h), g = Math.sin(h), f = l.x + (e * l.scale_x * c - i * l.scale_y * g), d = l.y + (e * l.scale_x * g + i * l.scale_y * c);
1958
+ const i = this.getGlobalTransform(o.parentId), n = i.rotation * Math.PI / 180, a = Math.cos(n), r = Math.sin(n), l = i.x + (s.x * i.scale_x * a - s.y * i.scale_y * r), h = i.y + (s.x * i.scale_x * r + s.y * i.scale_y * a);
1931
1959
  return {
1932
- x: f,
1933
- y: d,
1934
- rotation: l.rotation + n,
1935
- scale_x: l.scale_x * a,
1936
- scale_y: l.scale_y * r
1960
+ x: l,
1961
+ y: h,
1962
+ rotation: i.rotation + s.rotation,
1963
+ scale_x: i.scale_x * (s.scale_x ?? 1) * (s.flip_x ? -1 : 1),
1964
+ scale_y: i.scale_y * (s.scale_y ?? 1) * (s.flip_y ? -1 : 1),
1965
+ length: e
1937
1966
  };
1938
1967
  }
1939
1968
  globalToLocal(t, s) {
@@ -2038,22 +2067,22 @@ class ci {
2038
2067
  e && e.type === "Component" && e.variant === "listview" && this.updateListViewHoverFromPointer(e, s, o), this.isMouseDown && a && this.fireEventForObject(a, "Drag"), a !== this.lastHoveredObjectId && (console.log(`[Engine] HOVER CHANGE: ${this.lastHoveredObjectId} -> ${a}`), this.lastHoveredObjectId && this.fireEventForObject(this.lastHoveredObjectId, "onPointerLeave"), a && this.fireEventForObject(a, "onPointerEnter"), this.lastHoveredObjectId = a);
2039
2068
  return;
2040
2069
  }
2041
- if ((t === "up" || t === "blur") && (this.draggingSliderId = null, this.draggingListViewId = null, this.draggingBehaviors.clear(), this.pointerDownTimes.delete(a), this.activeObjectId = null), t === "down" && (this.pointerDownTimes.set(a, this.currentTime), this.activeObjectId = a, e && ((r = e.behaviors) != null && r.some((f) => f.type === Y.Draggable)) && this.draggingBehaviors.add(a)), t === "move" ? (a && !this.activeHoverIds.has(a) && this.activeHoverIds.add(a), this.activeHoverIds.forEach((f) => {
2070
+ if ((t === "up" || t === "blur") && (this.draggingSliderId = null, this.draggingListViewId = null, this.draggingBehaviors.clear(), this.pointerDownTimes.delete(a), this.activeObjectId = null), t === "down" && (this.pointerDownTimes.set(a, this.currentTime), this.activeObjectId = a, e && ((r = e.behaviors) != null && r.some((f) => f.type === G.Draggable)) && this.draggingBehaviors.add(a)), t === "move" ? (a && !this.activeHoverIds.has(a) && this.activeHoverIds.add(a), this.activeHoverIds.forEach((f) => {
2042
2071
  f !== a && this.activeHoverIds.delete(f);
2043
2072
  })) : t === "blur" && this.activeHoverIds.clear(), this.activeDropdownId && t === "down") {
2044
2073
  const f = this.artboard.objects.find((d) => d.id === this.activeDropdownId);
2045
2074
  if (f && (f.type === "Dropdown" || f.variant === "dropdown")) {
2046
- const d = this.objectStates.get(f.id), u = (d == null ? void 0 : d.options) || f.options || {}, m = f.geometry || {}, y = m.width ?? f.width ?? 200, v = m.height ?? f.height ?? 40, b = u.optionsList || [], C = u.itemHeight || 32, S = u.listPadding ?? 4, I = b.length * C + S * 2, w = this.getWorldTransform(f.id), M = y * Math.abs(w.scaleX), P = v * Math.abs(w.scaleY), T = w.y + P / 2 + 4, W = Math.abs(s - w.x) <= M / 2, k = o >= T && o <= T + I * Math.abs(w.scaleY);
2047
- if (W && k) {
2048
- const _ = Math.abs(w.scaleY), L = o - (T + S * _), x = Math.floor(L / (C * _));
2049
- if (x >= 0 && x < b.length) {
2050
- const A = b[x];
2051
- u.selectedOption = A, u.isOpen = !1, this.activeDropdownId = null, f.inputId && this.setInternalInput(f.inputId, A), this.onComponentChange && this.onComponentChange({
2075
+ const d = this.objectStates.get(f.id), u = (d == null ? void 0 : d.options) || f.options || {}, m = f.geometry || {}, y = m.width ?? f.width ?? 200, v = m.height ?? f.height ?? 40, b = u.optionsList || [], C = u.itemHeight || 32, S = u.listPadding ?? 4, I = b.length * C + S * 2, w = this.getWorldTransform(f.id), M = y * Math.abs(w.scaleX), _ = v * Math.abs(w.scaleY), T = w.y + _ / 2 + 4, $ = Math.abs(s - w.x) <= M / 2, k = o >= T && o <= T + I * Math.abs(w.scaleY);
2076
+ if ($ && k) {
2077
+ const E = Math.abs(w.scaleY), R = o - (T + S * E), A = Math.floor(R / (C * E));
2078
+ if (A >= 0 && A < b.length) {
2079
+ const O = b[A];
2080
+ u.selectedOption = O, u.isOpen = !1, this.activeDropdownId = null, f.inputId && this.setInternalInput(f.inputId, O), this.onComponentChange && this.onComponentChange({
2052
2081
  objectId: f.id,
2053
2082
  componentName: f.name,
2054
2083
  variant: "dropdown",
2055
2084
  property: "selectedOption",
2056
- value: A
2085
+ value: O
2057
2086
  });
2058
2087
  }
2059
2088
  return;
@@ -2153,20 +2182,20 @@ class ci {
2153
2182
  }
2154
2183
  }
2155
2184
  if (f.type === "LineGraph" && (t === "down" || t === "click")) {
2156
- const m = f.geometry, y = (m == null ? void 0 : m.datasets) || [], v = this.objectStates.get(f.id), b = (v == null ? void 0 : v.width) || (m == null ? void 0 : m.width) || 200, C = (v == null ? void 0 : v.height) || (m == null ? void 0 : m.height) || 150, S = this.getWorldTransform(f.id), I = 30, w = 20, M = b - I, P = C - w;
2185
+ const m = f.geometry, y = (m == null ? void 0 : m.datasets) || [], v = this.objectStates.get(f.id), b = (v == null ? void 0 : v.width) || (m == null ? void 0 : m.width) || 200, C = (v == null ? void 0 : v.height) || (m == null ? void 0 : m.height) || 150, S = this.getWorldTransform(f.id), I = 30, w = 20, M = b - I, _ = C - w;
2157
2186
  let T = 1;
2158
- y.forEach((_) => {
2159
- const L = Math.max(..._.data || [0]);
2160
- L > T && (T = L);
2187
+ y.forEach((E) => {
2188
+ const R = Math.max(...E.data || [0]);
2189
+ R > T && (T = R);
2161
2190
  });
2162
- let W = 1 / 0, k = null;
2163
- y.forEach((_, L) => {
2164
- const x = _.data || [], A = M / Math.max(x.length - 1, 1);
2165
- x.forEach(($, O) => {
2166
- const z = S.x - b / 2 + I + O * A, H = S.y + C / 2 - w - $ / T * P, et = Math.sqrt((s - z) ** 2 + (o - H) ** 2);
2167
- et < W && (W = et, k = { dIdx: L, pIdx: O, val: $, label: _.label || `Dataset ${L + 1}` });
2191
+ let $ = 1 / 0, k = null;
2192
+ y.forEach((E, R) => {
2193
+ const A = E.data || [], O = M / Math.max(A.length - 1, 1);
2194
+ A.forEach((W, x) => {
2195
+ const Y = S.x - b / 2 + I + x * O, H = S.y + C / 2 - w - W / T * _, Q = Math.sqrt((s - Y) ** 2 + (o - H) ** 2);
2196
+ Q < $ && ($ = Q, k = { dIdx: R, pIdx: x, val: W, label: E.label || `Dataset ${R + 1}` });
2168
2197
  });
2169
- }), k && W < 20 && this.onGraphPointClick && this.onGraphPointClick({ objectId: f.id, componentName: f.name, datasetIndex: k.dIdx, pointIndex: k.pIdx, value: k.val, label: k.label }), this.onComponentChange && this.onComponentChange({ objectId: f.id, componentName: f.name, variant: "linegraph", property: "click", value: (k == null ? void 0 : k.val) ?? null });
2198
+ }), k && $ < 20 && this.onGraphPointClick && this.onGraphPointClick({ objectId: f.id, componentName: f.name, datasetIndex: k.dIdx, pointIndex: k.pIdx, value: k.val, label: k.label }), this.onComponentChange && this.onComponentChange({ objectId: f.id, componentName: f.name, variant: "linegraph", property: "click", value: (k == null ? void 0 : k.val) ?? null });
2170
2199
  }
2171
2200
  if (t === "click") {
2172
2201
  const m = (l = this.artboard) == null ? void 0 : l.objects.find((b) => b.id === e.id), y = this.focusedId, v = (m == null ? void 0 : m.type) === "InputBox" || (m == null ? void 0 : m.type) === "Component" && m.variant === "inputbox";
@@ -2633,68 +2662,68 @@ class ci {
2633
2662
  }
2634
2663
  */
2635
2664
  renderObject(t, s, o) {
2636
- var u, m, y, v, b, C, S, I, w, M, P, T, W, k, _, L, x;
2665
+ var u, m, y, v, b, C, S, I, w, M, _, T, $, k, E, R, A;
2637
2666
  const e = this.objectStates.get(s.id);
2638
2667
  if (!e) {
2639
2668
  console.warn("No state for object:", s.id);
2640
2669
  return;
2641
2670
  }
2642
- this.frameCount % 60, t.roundRect || (t.roundRect = (A, $, O, z, H) => (this.drawRoundRect(t, A, $, O, z, H), t));
2671
+ this.frameCount % 60, t.roundRect || (t.roundRect = (O, W, x, Y, H) => (this.drawRoundRect(t, O, W, x, Y, H), t));
2643
2672
  const i = e.geometry ? this.deepMerge(s.geometry, e.geometry) : s.geometry, n = e.style ? this.deepMerge(s.style, e.style) : s.style;
2644
2673
  let a = (i == null ? void 0 : i.width) || ((u = s.geometry) == null ? void 0 : u.width) || s.width || 0, r = (i == null ? void 0 : i.height) || ((m = s.geometry) == null ? void 0 : m.height) || s.height || 0;
2645
2674
  if ((a === 0 || r === 0) && (i != null && i.points) && Array.isArray(i.points) && i.points.length > 0) {
2646
- let A = 1 / 0, $ = -1 / 0, O = 1 / 0, z = -1 / 0;
2675
+ let O = 1 / 0, W = -1 / 0, x = 1 / 0, Y = -1 / 0;
2647
2676
  i.points.forEach((H) => {
2648
- A = Math.min(A, H.x), $ = Math.max($, H.x), O = Math.min(O, H.y), z = Math.max(z, H.y);
2649
- }), a === 0 && (a = $ - A), r === 0 && (r = z - O);
2677
+ O = Math.min(O, H.x), W = Math.max(W, H.x), x = Math.min(x, H.y), Y = Math.max(Y, H.y);
2678
+ }), a === 0 && (a = W - O), r === 0 && (r = Y - x);
2650
2679
  }
2651
- const l = (A) => {
2652
- if (A)
2653
- return A.corner_radius ?? A.cornerRadius;
2680
+ const l = (O) => {
2681
+ if (O)
2682
+ return O.corner_radius ?? O.cornerRadius;
2654
2683
  }, h = l(e) ?? l(n) ?? l(i) ?? l(s.style) ?? l(s.geometry) ?? 0;
2655
2684
  let c = { ...i, width: a, height: r };
2656
2685
  if (delete c.cornerRadius, c.corner_radius = h, c.type === "Path" && s.weights && s.bindMatrices && c.points) {
2657
- const A = this.getGlobalTransform(s.id);
2658
- if (A) {
2659
- const $ = li(
2686
+ const O = this.getGlobalTransform(s.id);
2687
+ if (O) {
2688
+ const W = li(
2660
2689
  c.points,
2661
2690
  s.weights,
2662
2691
  s.bindMatrices,
2663
- A,
2664
- (O) => this.getGlobalTransform(O)
2692
+ O,
2693
+ (x) => this.getGlobalTransform(x)
2665
2694
  );
2666
- c = { ...c, points: $ };
2695
+ c = { ...c, points: W };
2667
2696
  }
2668
2697
  }
2669
2698
  if (e.visible === !1)
2670
2699
  return;
2671
2700
  const g = s.repeaterConfig, f = g && g.isEnabled && g.count > 1, d = f ? g.count : 1;
2672
- for (let A = 0; A < d; A++) {
2673
- let $ = e.x, O = e.y, z = e.rotation, H = e.scale_x ?? 1, et = e.scale_y ?? 1;
2674
- if (f && A > 0) {
2701
+ for (let O = 0; O < d; O++) {
2702
+ let W = e.x, x = e.y, Y = e.rotation, H = e.scale_x ?? 1, Q = e.scale_y ?? 1;
2703
+ if (f && O > 0) {
2675
2704
  if (g.type === "Linear") {
2676
- const J = g.offsetX || 0, ft = g.offsetY || 0, U = g.rotation || 0, G = g.scale !== void 0 ? g.scale : 1;
2677
- $ += A * J, O += A * ft, z += A * U, H *= Math.pow(G, A), et *= Math.pow(G, A);
2705
+ const K = g.offsetX || 0, ft = g.offsetY || 0, q = g.rotation || 0, X = g.scale !== void 0 ? g.scale : 1;
2706
+ W += O * K, x += O * ft, Y += O * q, H *= Math.pow(X, O), Q *= Math.pow(X, O);
2678
2707
  } else if (g.type === "Grid") {
2679
- const J = g.cols || Math.ceil(Math.sqrt(g.count)), ft = g.gapX || 0, U = g.gapY || 0, G = Math.floor(A / J), K = A % J, Z = a + ft, At = r + U;
2680
- $ += K * Z, O += G * At;
2708
+ const K = g.cols || Math.ceil(Math.sqrt(g.count)), ft = g.gapX || 0, q = g.gapY || 0, X = Math.floor(O / K), Z = O % K, j = a + ft, Ot = r + q;
2709
+ W += Z * j, x += X * Ot;
2681
2710
  } else if (g.type === "Radial") {
2682
- const J = g.radius || 100, ft = g.startAngle || 0, G = (g.endAngle || 360) - ft, K = g.count > 1 ? G / (G === 360 ? g.count : g.count - 1) : 0, Z = ft + A * K, At = Z * Math.PI / 180;
2683
- $ = e.x + J * Math.cos(At), O = e.y + J * Math.sin(At), z += Z;
2711
+ const K = g.radius || 100, ft = g.startAngle || 0, X = (g.endAngle || 360) - ft, Z = g.count > 1 ? X / (X === 360 ? g.count : g.count - 1) : 0, j = ft + O * Z, Ot = j * Math.PI / 180;
2712
+ W = e.x + K * Math.cos(Ot), x = e.y + K * Math.sin(Ot), Y += j;
2684
2713
  }
2685
2714
  }
2686
- const E = s.type === "Group" || s.type === "Frame" || s.type === "Component", F = a > 0 && r > 0;
2687
- if (!E && F) {
2688
- const J = (((y = n.shadow) == null ? void 0 : y.isEnabled) !== !1 ? (((v = n.shadow) == null ? void 0 : v.blur) || 0) + 10 : 0) + (((b = n.blur) == null ? void 0 : b.isEnabled) !== !1 && ((C = n.blur) == null ? void 0 : C.radius) || 0) + 20;
2689
- if (!this.isObjectInView(t, $, O, a, r, J))
2715
+ const P = s.type === "Group" || s.type === "Frame" || s.type === "Component", F = a > 0 && r > 0;
2716
+ if (!P && F) {
2717
+ const K = (((y = n.shadow) == null ? void 0 : y.isEnabled) !== !1 ? (((v = n.shadow) == null ? void 0 : v.blur) || 0) + 10 : 0) + (((b = n.blur) == null ? void 0 : b.isEnabled) !== !1 && ((C = n.blur) == null ? void 0 : C.radius) || 0) + 20;
2718
+ if (!this.isObjectInView(t, W, x, a, r, K))
2690
2719
  continue;
2691
2720
  }
2692
2721
  this.debug_objectsRendered++, t.save();
2693
- const q = [], Q = n.blur || ((S = s.style) == null ? void 0 : S.blur);
2694
- Q && Q.amount > 0 && q.push(`blur(${Q.amount}px)`);
2695
- const it = n.effect || ((I = s.style) == null ? void 0 : I.effect), dt = (it == null ? void 0 : it.isEnabled) === !0, St = it == null ? void 0 : it.type, ht = (it == null ? void 0 : it.radius) ?? 10;
2696
- dt && St === "LayerBlur" && q.push(`blur(${ht}px)`);
2697
- const mt = ((w = i == null ? void 0 : i.type) == null ? void 0 : w.toLowerCase().includes("image")) || ((M = s.type) == null ? void 0 : M.toLowerCase().includes("image")), rt = n.adjustments && Object.keys(n.adjustments).length > 0 ? n.adjustments : null, Lt = i != null && i.adjustments && Object.keys(i.adjustments).length > 0 ? i.adjustments : null, Gt = mt ? Lt || rt : rt || Lt, Pt = mt && !Gt ? {
2722
+ const U = [], J = n.blur || ((S = s.style) == null ? void 0 : S.blur);
2723
+ J && J.amount > 0 && U.push(`blur(${J.amount}px)`);
2724
+ const it = n.effect || ((I = s.style) == null ? void 0 : I.effect), dt = (it == null ? void 0 : it.isEnabled) === !0, yt = it == null ? void 0 : it.type, ht = (it == null ? void 0 : it.radius) ?? 10;
2725
+ dt && yt === "LayerBlur" && U.push(`blur(${ht}px)`);
2726
+ const pt = ((w = i == null ? void 0 : i.type) == null ? void 0 : w.toLowerCase().includes("image")) || ((M = s.type) == null ? void 0 : M.toLowerCase().includes("image")), ot = n.adjustments && Object.keys(n.adjustments).length > 0 ? n.adjustments : null, Et = i != null && i.adjustments && Object.keys(i.adjustments).length > 0 ? i.adjustments : null, Ft = pt ? Et || ot : ot || Et, wt = pt && !Ft ? {
2698
2727
  exposure: 0,
2699
2728
  contrast: 0,
2700
2729
  saturation: 100,
@@ -2705,69 +2734,69 @@ class ci {
2705
2734
  blur: 0,
2706
2735
  negative: 0,
2707
2736
  hue: 0
2708
- } : Gt;
2709
- if (e && Pt && (e.geometry = e.geometry || {}, e.geometry.adjustments = { ...Pt }), Pt) {
2710
- const J = (Pt.exposure || 0) / 100, ft = Pt.contrast || 0, U = 1 + (Pt.saturation || 0) / 100, G = (Pt.temperature || 0) / 200, K = (Pt.tint || 0) / 200, Z = (Pt.highlights || 0) / 500, At = (Pt.shadows || 0) / 500;
2711
- let Ot = "", kt = "SourceGraphic";
2712
- if (J !== 0 && (Ot += `
2713
- <feComponentTransfer in="${kt}" result="exposure">
2714
- <feFuncR type="linear" slope="1" intercept="${J}"/>
2715
- <feFuncG type="linear" slope="1" intercept="${J}"/>
2716
- <feFuncB type="linear" slope="1" intercept="${J}"/>
2717
- </feComponentTransfer>`, kt = "exposure"), ft !== 0) {
2718
- const yt = (ft + 100) / 100, R = 0.5 * (1 - yt);
2719
- Ot += `
2720
- <feComponentTransfer in="${kt}" result="contrast">
2721
- <feFuncR type="linear" slope="${yt}" intercept="${R}"/>
2722
- <feFuncG type="linear" slope="${yt}" intercept="${R}"/>
2723
- <feFuncB type="linear" slope="${yt}" intercept="${R}"/>
2724
- </feComponentTransfer>`, kt = "contrast";
2737
+ } : Ft;
2738
+ if (e && wt && (e.geometry = e.geometry || {}, e.geometry.adjustments = { ...wt }), wt) {
2739
+ const K = (wt.exposure || 0) / 100, ft = wt.contrast || 0, q = 1 + (wt.saturation || 0) / 100, X = (wt.temperature || 0) / 200, Z = (wt.tint || 0) / 200, j = (wt.highlights || 0) / 500, Ot = (wt.shadows || 0) / 500;
2740
+ let Rt = "", Tt = "SourceGraphic";
2741
+ if (K !== 0 && (Rt += `
2742
+ <feComponentTransfer in="${Tt}" result="exposure">
2743
+ <feFuncR type="linear" slope="1" intercept="${K}"/>
2744
+ <feFuncG type="linear" slope="1" intercept="${K}"/>
2745
+ <feFuncB type="linear" slope="1" intercept="${K}"/>
2746
+ </feComponentTransfer>`, Tt = "exposure"), ft !== 0) {
2747
+ const bt = (ft + 100) / 100, L = 0.5 * (1 - bt);
2748
+ Rt += `
2749
+ <feComponentTransfer in="${Tt}" result="contrast">
2750
+ <feFuncR type="linear" slope="${bt}" intercept="${L}"/>
2751
+ <feFuncG type="linear" slope="${bt}" intercept="${L}"/>
2752
+ <feFuncB type="linear" slope="${bt}" intercept="${L}"/>
2753
+ </feComponentTransfer>`, Tt = "contrast";
2725
2754
  }
2726
- if (U !== 1 && (Ot += `<feColorMatrix in="${kt}" type="saturate" values="${U}" result="saturate"/>`, kt = "saturate"), Pt.hue && (Ot += `<feColorMatrix in="${kt}" type="hueRotate" values="${Pt.hue}" result="hue"/>`, kt = "hue"), Pt.negative) {
2727
- const yt = 1 - Pt.negative / 50;
2728
- Ot += `
2729
- <feColorMatrix in="${kt}" type="matrix" result="invert"
2730
- values="${yt} 0 0 0 ${1 - yt}
2731
- 0 ${yt} 0 0 ${1 - yt}
2732
- 0 0 ${yt} 0 ${1 - yt}
2733
- 0 0 0 1 0"/>`, kt = "invert";
2755
+ if (q !== 1 && (Rt += `<feColorMatrix in="${Tt}" type="saturate" values="${q}" result="saturate"/>`, Tt = "saturate"), wt.hue && (Rt += `<feColorMatrix in="${Tt}" type="hueRotate" values="${wt.hue}" result="hue"/>`, Tt = "hue"), wt.negative) {
2756
+ const bt = 1 - wt.negative / 50;
2757
+ Rt += `
2758
+ <feColorMatrix in="${Tt}" type="matrix" result="invert"
2759
+ values="${bt} 0 0 0 ${1 - bt}
2760
+ 0 ${bt} 0 0 ${1 - bt}
2761
+ 0 0 ${bt} 0 ${1 - bt}
2762
+ 0 0 0 1 0"/>`, Tt = "invert";
2734
2763
  }
2735
- if (G !== 0 || K !== 0 || Z !== 0 || At !== 0) {
2736
- const yt = 1 + Z + At, R = yt * (1 + G - K / 2), ct = yt * (1 + K), Xt = yt * (1 - G - K / 2), xt = Pt.shadows * 0.1 / 255, te = [
2737
- R,
2764
+ if (X !== 0 || Z !== 0 || j !== 0 || Ot !== 0) {
2765
+ const bt = 1 + j + Ot, L = bt * (1 + X - Z / 2), ct = bt * (1 + Z), Dt = bt * (1 - X - Z / 2), At = wt.shadows * 0.1 / 255, te = [
2766
+ L,
2738
2767
  0,
2739
2768
  0,
2740
2769
  0,
2741
- xt,
2770
+ At,
2742
2771
  0,
2743
2772
  ct,
2744
2773
  0,
2745
2774
  0,
2746
- xt,
2775
+ At,
2747
2776
  0,
2748
2777
  0,
2749
- Xt,
2778
+ Dt,
2750
2779
  0,
2751
- xt,
2780
+ At,
2752
2781
  0,
2753
2782
  0,
2754
2783
  0,
2755
2784
  1,
2756
2785
  0
2757
2786
  ].join(" ");
2758
- Ot += `<feColorMatrix in="${kt}" type="matrix" values="${te}" result="advanced"/>`, kt = "advanced";
2787
+ Rt += `<feColorMatrix in="${Tt}" type="matrix" values="${te}" result="advanced"/>`, Tt = "advanced";
2759
2788
  }
2760
- if (Pt.blur && (Ot += `<feGaussianBlur in="${kt}" stdDeviation="${Pt.blur}" result="blur"/>`, kt = "blur"), Ot) {
2761
- const yt = `<svg xmlns="http://www.w3.org/2000/svg"><filter id="f" color-interpolation-filters="sRGB">${Ot}</filter></svg>`, R = btoa(yt);
2762
- q.push(`url('data:image/svg+xml;base64,${R}#f')`);
2789
+ if (wt.blur && (Rt += `<feGaussianBlur in="${Tt}" stdDeviation="${wt.blur}" result="blur"/>`, Tt = "blur"), Rt) {
2790
+ const bt = `<svg xmlns="http://www.w3.org/2000/svg"><filter id="f" color-interpolation-filters="sRGB">${Rt}</filter></svg>`, L = btoa(bt);
2791
+ U.push(`url('data:image/svg+xml;base64,${L}#f')`);
2763
2792
  }
2764
2793
  }
2765
- q.length > 0 ? t.filter = q.join(" ") : t.filter = "none", t.imageSmoothingEnabled = !0, t.imageSmoothingQuality = "high";
2766
- const Dt = t.globalAlpha, Yt = this.normalizeOpacity(e.opacity !== void 0 ? e.opacity : 100);
2767
- t.globalAlpha = Dt * Yt;
2794
+ U.length > 0 ? t.filter = U.join(" ") : t.filter = "none", t.imageSmoothingEnabled = !0, t.imageSmoothingQuality = "high";
2795
+ const Xt = t.globalAlpha, Bt = this.normalizeOpacity(e.opacity !== void 0 ? e.opacity : 100);
2796
+ t.globalAlpha = Xt * Bt;
2768
2797
  const B = e.compositeOperation || e.blendMode;
2769
2798
  if (B && B !== "Normal") {
2770
- const J = B.toLowerCase();
2799
+ const K = B.toLowerCase();
2771
2800
  [
2772
2801
  "multiply",
2773
2802
  "screen",
@@ -2797,9 +2826,9 @@ class ci {
2797
2826
  "xor",
2798
2827
  "multiply",
2799
2828
  "screen"
2800
- ].includes(J) && (t.globalCompositeOperation = J);
2829
+ ].includes(K) && (t.globalCompositeOperation = K);
2801
2830
  }
2802
- const lt = t, Vt = e.masks || (s.maskedBy ? [{
2831
+ const nt = t, zt = e.masks || (s.maskedBy ? [{
2803
2832
  maskId: s.maskedBy,
2804
2833
  inverted: s.maskInverted === !0,
2805
2834
  type: s.maskType || "alpha",
@@ -2807,179 +2836,179 @@ class ci {
2807
2836
  feather: s.maskFeather || 0,
2808
2837
  isVisible: !0
2809
2838
  }] : []);
2810
- let Mt = !1;
2811
- const Tt = Vt.filter((J) => J.isVisible !== !1 && o.has(J.maskId));
2812
- if (Tt.length > 0) {
2813
- const J = Tt[0], ft = o.get(J.maskId), U = this.objectStates.get(ft.id);
2814
- U && U.visible !== !1 && (Mt = !0, (!this.maskBuffer || this.maskBuffer.width !== this.canvasWidth || this.maskBuffer.height !== this.canvasHeight) && (this.maskBuffer = document.createElement("canvas"), this.maskBuffer.width = this.canvasWidth, this.maskBuffer.height = this.canvasHeight, this.maskCtx = this.maskBuffer.getContext("2d", { willReadFrequently: !0 }), this.maskCtx && (this.maskCtx.imageSmoothingEnabled = !0, this.maskCtx.imageSmoothingQuality = "high")), this.maskCtx.setTransform(1, 0, 0, 1, 0, 0), this.maskCtx.globalCompositeOperation = "source-over", this.maskCtx.globalAlpha = 1, this.maskCtx.filter = "none", this.maskCtx.clearRect(0, 0, this.maskBuffer.width, this.maskBuffer.height), this.rootTransform && this.maskCtx.setTransform(this.rootTransform), s.parentId && this.applyAbsoluteTransform(this.maskCtx, s.parentId, o), this.maskCtx.save(), this.maskCtx.globalAlpha = 1, t = this.maskCtx, t.filter = lt.filter);
2839
+ let kt = !1;
2840
+ const _t = zt.filter((K) => K.isVisible !== !1 && o.has(K.maskId));
2841
+ if (_t.length > 0) {
2842
+ const K = _t[0], ft = o.get(K.maskId), q = this.objectStates.get(ft.id);
2843
+ q && q.visible !== !1 && (kt = !0, (!this.maskBuffer || this.maskBuffer.width !== this.canvasWidth || this.maskBuffer.height !== this.canvasHeight) && (this.maskBuffer = document.createElement("canvas"), this.maskBuffer.width = this.canvasWidth, this.maskBuffer.height = this.canvasHeight, this.maskCtx = this.maskBuffer.getContext("2d", { willReadFrequently: !0 }), this.maskCtx && (this.maskCtx.imageSmoothingEnabled = !0, this.maskCtx.imageSmoothingQuality = "high")), this.maskCtx.setTransform(1, 0, 0, 1, 0, 0), this.maskCtx.globalCompositeOperation = "source-over", this.maskCtx.globalAlpha = 1, this.maskCtx.filter = "none", this.maskCtx.clearRect(0, 0, this.maskBuffer.width, this.maskBuffer.height), this.rootTransform && this.maskCtx.setTransform(this.rootTransform), s.parentId && this.applyAbsoluteTransform(this.maskCtx, s.parentId, o), this.maskCtx.save(), this.maskCtx.globalAlpha = 1, t = this.maskCtx, t.filter = nt.filter);
2815
2844
  }
2816
- t.translate(Math.round($), Math.round(O)), t.rotate(z * Math.PI / 180);
2817
- const zt = e.skew_x || 0, Ut = e.skew_y || 0;
2818
- (zt !== 0 || Ut !== 0) && t.transform(1, Math.tan(Ut * Math.PI / 180), Math.tan(zt * Math.PI / 180), 1, 0, 0);
2845
+ t.translate(Math.round(W), Math.round(x)), t.rotate(Y * Math.PI / 180);
2846
+ const Vt = e.skew_x || 0, Ut = e.skew_y || 0;
2847
+ (Vt !== 0 || Ut !== 0) && t.transform(1, Math.tan(Ut * Math.PI / 180), Math.tan(Vt * Math.PI / 180), 1, 0, 0);
2819
2848
  const Jt = e.rotate_x || 0, qt = e.rotate_y || 0, Qt = (e.flip_x === !0 ? -1 : 1) * Math.cos(qt * Math.PI / 180), oe = (e.flip_y === !0 ? -1 : 1) * Math.cos(Jt * Math.PI / 180);
2820
2849
  t.scale(
2821
2850
  H * Qt,
2822
- et * oe
2851
+ Q * oe
2823
2852
  ), n.shadow && n.shadow.isEnabled !== !0 && ((n.shadow.blur || 0) > 0 || Math.abs(n.shadow.offsetX || 0) > 0 || Math.abs(n.shadow.offsetY || 0) > 0) && (n.shadow.isEnabled = !0);
2824
2853
  const jt = n.shadow;
2825
2854
  if (jt && jt.isEnabled !== !1) {
2826
- let J = jt.color || "#000000";
2827
- (T = (P = this.artboard) == null ? void 0 : P.tokens) != null && T.colors && this.artboard.tokens.colors[J] && (J = this.artboard.tokens.colors[J]);
2828
- const ft = this.normalizeOpacity(jt.opacity ?? 100), U = jt.spread || 0, K = (jt.blur || 0) + U * 1.5;
2829
- let Z = J;
2830
- if (J.startsWith("#")) {
2831
- const kt = J.replace("#", ""), Nt = parseInt(kt.substring(0, 2), 16), yt = parseInt(kt.substring(2, 4), 16), R = parseInt(kt.substring(4, 6), 16);
2832
- Z = `rgba(${Nt}, ${yt}, ${R}, ${ft})`;
2833
- } else if (J.startsWith("rgba")) {
2834
- const kt = J.match(/[\d.]+/g);
2835
- if (kt && kt.length >= 4) {
2836
- const Nt = kt[0], yt = kt[1], R = kt[2], ct = kt[3];
2837
- Z = `rgba(${Nt}, ${yt}, ${R}, ${parseFloat(ct) * ft})`;
2855
+ let K = jt.color || "#000000";
2856
+ (T = (_ = this.artboard) == null ? void 0 : _.tokens) != null && T.colors && this.artboard.tokens.colors[K] && (K = this.artboard.tokens.colors[K]);
2857
+ const ft = this.normalizeOpacity(jt.opacity ?? 100), q = jt.spread || 0, Z = (jt.blur || 0) + q * 1.5;
2858
+ let j = K;
2859
+ if (K.startsWith("#")) {
2860
+ const Tt = K.replace("#", ""), Nt = parseInt(Tt.substring(0, 2), 16), bt = parseInt(Tt.substring(2, 4), 16), L = parseInt(Tt.substring(4, 6), 16);
2861
+ j = `rgba(${Nt}, ${bt}, ${L}, ${ft})`;
2862
+ } else if (K.startsWith("rgba")) {
2863
+ const Tt = K.match(/[\d.]+/g);
2864
+ if (Tt && Tt.length >= 4) {
2865
+ const Nt = Tt[0], bt = Tt[1], L = Tt[2], ct = Tt[3];
2866
+ j = `rgba(${Nt}, ${bt}, ${L}, ${parseFloat(ct) * ft})`;
2838
2867
  }
2839
2868
  }
2840
- const At = t.getTransform(), Ot = Math.sqrt(At.a * At.a + At.b * At.b) || 1;
2841
- t.shadowColor = Z, t.shadowBlur = K * Ot, t.shadowOffsetX = (jt.offsetX || 0) * Ot, t.shadowOffsetY = (jt.offsetY || 0) * Ot;
2869
+ const Ot = t.getTransform(), Rt = Math.sqrt(Ot.a * Ot.a + Ot.b * Ot.b) || 1;
2870
+ t.shadowColor = j, t.shadowBlur = Z * Rt, t.shadowOffsetX = (jt.offsetX || 0) * Rt, t.shadowOffsetY = (jt.offsetY || 0) * Rt;
2842
2871
  }
2843
- const ee = s.liquidFill || ((W = s.style) == null ? void 0 : W.liquidFill);
2872
+ const ee = s.liquidFill || (($ = s.style) == null ? void 0 : $.liquidFill);
2844
2873
  if (ee && ee.enabled) {
2845
2874
  t.save();
2846
- const J = ee.fillLevel ?? 0.5;
2875
+ const K = ee.fillLevel ?? 0.5;
2847
2876
  t.beginPath();
2848
- const ft = r / 2 - r * J;
2849
- t.rect(-a / 2, ft, a, r * J), t.clip(), t.fillStyle = ee.color || "#3b82f6", t.globalAlpha = t.globalAlpha * (ee.opacity ?? 1);
2877
+ const ft = r / 2 - r * K;
2878
+ t.rect(-a / 2, ft, a, r * K), t.clip(), t.fillStyle = ee.color || "#3b82f6", t.globalAlpha = t.globalAlpha * (ee.opacity ?? 1);
2850
2879
  }
2851
2880
  if ((i == null ? void 0 : i.type) === "Text")
2852
2881
  this._renderText(t, s, c, n, e, a, r);
2853
2882
  else if ((i == null ? void 0 : i.type) === "Image") {
2854
- const J = i.originalSrc || i.src;
2855
- if (J) {
2856
- let ft = this.imageCache.get(J);
2883
+ const K = i.originalSrc || i.src;
2884
+ if (K) {
2885
+ let ft = this.imageCache.get(K);
2857
2886
  ft || (ft = new Image(), ft.onload = () => {
2858
2887
  console.log(`[ExodeUI] Image loaded successfully, size: ${ft.naturalWidth}x${ft.naturalHeight}`);
2859
- }, ft.onerror = (K) => {
2860
- console.error("[ExodeUI] Image load failed:", K, `Src preview: ${J.substring(0, 100)}...`);
2861
- }, ft.src = J, this.imageCache.set(J, ft));
2862
- const U = n.stroke && n.stroke.width > 0 && n.stroke.isEnabled !== !1, G = (((k = n.stroke) == null ? void 0 : k.alignment) || "center").toLowerCase();
2863
- if (U && (G === "outside" || G === "center") && this.applyStrokeAlignment(t, n, c, a, r, h), n.fill && n.fill.type !== "None") {
2888
+ }, ft.onerror = (Z) => {
2889
+ console.error("[ExodeUI] Image load failed:", Z, `Src preview: ${K.substring(0, 100)}...`);
2890
+ }, ft.src = K, this.imageCache.set(K, ft));
2891
+ const q = n.stroke && n.stroke.width > 0 && n.stroke.isEnabled !== !1, X = (((k = n.stroke) == null ? void 0 : k.alignment) || "center").toLowerCase();
2892
+ if (q && (X === "outside" || X === "center") && this.applyStrokeAlignment(t, n, c, a, r, h), n.fill && n.fill.type !== "None") {
2864
2893
  t.save();
2865
- const K = t.globalAlpha, Z = this.createCanvasFill(t, n.fill, a, r);
2866
- t.fillStyle = Z || n.fill.color || "transparent", t.globalAlpha = K * this.normalizeOpacity(n.fill.opacity ?? 100), h !== 0 ? (this.drawRoundRect(t, -a / 2, -r / 2, a, r, h), t.fill()) : t.fillRect(-a / 2, -r / 2, a, r), t.globalAlpha = K, t.restore();
2894
+ const Z = t.globalAlpha, j = this.createCanvasFill(t, n.fill, a, r);
2895
+ t.fillStyle = j || n.fill.color || "transparent", t.globalAlpha = Z * this.normalizeOpacity(n.fill.opacity ?? 100), h !== 0 ? (this.drawRoundRect(t, -a / 2, -r / 2, a, r, h), t.fill()) : t.fillRect(-a / 2, -r / 2, a, r), t.globalAlpha = Z, t.restore();
2867
2896
  }
2868
- ft.complete && ft.naturalWidth > 0 ? (h !== 0 ? (t.save(), this.drawRoundRect(t, -a / 2, -r / 2, a, r, h), t.clip(), t.drawImage(ft, -a / 2, -r / 2, a, r), t.restore()) : t.drawImage(ft, -a / 2, -r / 2, a, r), U && G === "inside" && this.applyStrokeAlignment(t, n, c, a, r, h)) : U && G === "inside" && this.applyStrokeAlignment(t, n, c, a, r, h);
2897
+ ft.complete && ft.naturalWidth > 0 ? (h !== 0 ? (t.save(), this.drawRoundRect(t, -a / 2, -r / 2, a, r, h), t.clip(), t.drawImage(ft, -a / 2, -r / 2, a, r), t.restore()) : t.drawImage(ft, -a / 2, -r / 2, a, r), q && X === "inside" && this.applyStrokeAlignment(t, n, c, a, r, h)) : q && X === "inside" && this.applyStrokeAlignment(t, n, c, a, r, h);
2869
2898
  }
2870
2899
  } else if (i.type === "SVG") {
2871
- const J = i.svgContent;
2872
- if (J) {
2873
- const ft = n.palette || [], U = n.fill, G = n.stroke, K = U ? this.normalizeOpacity(U.opacity ?? 100) : 1, Z = (U == null ? void 0 : U.type) === "Solid" && (!G || G.isEnabled === !1 || G.type === "Solid" && G.color === U.color), At = U && U.type !== "None" ? Z ? "monochrome" : U.type === "Solid" ? (U.color || "") + "|opacity:" + K : JSON.stringify(U.stops || []) + "|opacity:" + K : "", Ot = G && G.isEnabled !== !1 && (G.width || 0) > 0 ? Z ? [
2900
+ const K = i.svgContent;
2901
+ if (K) {
2902
+ const ft = n.palette || [], q = n.fill, X = n.stroke, Z = q ? this.normalizeOpacity(q.opacity ?? 100) : 1, j = (q == null ? void 0 : q.type) === "Solid" && (!X || X.isEnabled === !1 || X.type === "Solid" && X.color === q.color), Ot = q && q.type !== "None" ? j ? "monochrome" : q.type === "Solid" ? (q.color || "") + "|opacity:" + Z : JSON.stringify(q.stops || []) + "|opacity:" + Z : "", Rt = X && X.isEnabled !== !1 && (X.width || 0) > 0 ? j ? [
2874
2903
  "monochrome",
2875
- G.width || 0,
2876
- G.trimStart ?? 0,
2877
- G.trimEnd ?? 1,
2878
- G.trimOffset ?? 0,
2879
- G.dashOffset ?? 0
2904
+ X.width || 0,
2905
+ X.trimStart ?? 0,
2906
+ X.trimEnd ?? 1,
2907
+ X.trimOffset ?? 0,
2908
+ X.dashOffset ?? 0
2880
2909
  ].join("|") : [
2881
- G.width || 0,
2882
- G.fill ? G.fill.type === "Solid" ? G.fill.color || "" : JSON.stringify(G.fill.stops || []) : G.color || "",
2883
- G.opacity ?? 1,
2884
- G.lineCap || "",
2885
- G.lineJoin || "",
2886
- (G.dashArray || []).join(","),
2910
+ X.width || 0,
2911
+ X.fill ? X.fill.type === "Solid" ? X.fill.color || "" : JSON.stringify(X.fill.stops || []) : X.color || "",
2912
+ X.opacity ?? 1,
2913
+ X.lineCap || "",
2914
+ X.lineJoin || "",
2915
+ (X.dashArray || []).join(","),
2887
2916
  // [FIX] Include trim-path values so stroke-draw animations bust the cache
2888
- G.trimStart ?? 0,
2889
- G.trimEnd ?? 1,
2890
- G.trimOffset ?? 0,
2891
- G.dashOffset ?? 0
2892
- ].join("|") : "nostroke", kt = [
2917
+ X.trimStart ?? 0,
2918
+ X.trimEnd ?? 1,
2919
+ X.trimOffset ?? 0,
2920
+ X.dashOffset ?? 0
2921
+ ].join("|") : "nostroke", Tt = [
2893
2922
  s.id,
2894
2923
  ft.join("_"),
2895
- At,
2896
2924
  Ot,
2925
+ Rt,
2897
2926
  e.opacity ?? 100,
2898
2927
  e.visible !== !1 ? "v" : "h"
2899
2928
  ].join("_");
2900
- let Nt = this.imageCache.get(kt);
2929
+ let Nt = this.imageCache.get(Tt);
2901
2930
  if (!Nt) {
2902
2931
  Nt = new Image(), Nt.crossOrigin = "anonymous";
2903
- let R = J;
2904
- R.match(/xmlns=["']http:\/\/www\.w3\.org\/2000\/svg["']/i) || (R = R.replace(/<svg([^>]*)>/i, (ot, It) => `<svg xmlns="http://www.w3.org/2000/svg"${It}>`));
2905
- let ct = i.width || a || 100, Xt = i.height || r || 100;
2906
- const xt = R.match(/viewBox=["']\s*0\s+0\s+([\d.]+)\s+([\d.]+)\s*["']/i);
2907
- if (xt && (ct = parseFloat(xt[1]), Xt = parseFloat(xt[2])), R = R.replace(/<svg([^>]*)>/i, (ot, It) => {
2908
- let bt = It.replace(/\b(?:width|height)=["'][^"']*["']/gi, " ");
2909
- return bt.match(/\bviewBox=/i) || (bt += ` viewBox="0 0 ${ct} ${Xt}"`), bt.match(/\bpreserveAspectRatio=/i) || (bt += ' preserveAspectRatio="none"'), bt += ' width="100%" height="100%"', `<svg${bt}>`;
2910
- }), i.colors && i.colors.length > 0 && ft.length > 0 && i.colors.forEach((ot, It) => {
2932
+ let L = K;
2933
+ L.match(/xmlns=["']http:\/\/www\.w3\.org\/2000\/svg["']/i) || (L = L.replace(/<svg([^>]*)>/i, (rt, It) => `<svg xmlns="http://www.w3.org/2000/svg"${It}>`));
2934
+ let ct = i.width || a || 100, Dt = i.height || r || 100;
2935
+ const At = L.match(/viewBox=["']\s*0\s+0\s+([\d.]+)\s+([\d.]+)\s*["']/i);
2936
+ if (At && (ct = parseFloat(At[1]), Dt = parseFloat(At[2])), L = L.replace(/<svg([^>]*)>/i, (rt, It) => {
2937
+ let vt = It.replace(/\b(?:width|height)=["'][^"']*["']/gi, " ");
2938
+ return vt.match(/\bviewBox=/i) || (vt += ` viewBox="0 0 ${ct} ${Dt}"`), vt.match(/\bpreserveAspectRatio=/i) || (vt += ' preserveAspectRatio="none"'), vt += ' width="100%" height="100%"', `<svg${vt}>`;
2939
+ }), i.colors && i.colors.length > 0 && ft.length > 0 && i.colors.forEach((rt, It) => {
2911
2940
  if (ft[It]) {
2912
- const bt = ot.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"), vt = new RegExp(bt, "gi");
2913
- R = R.replace(vt, ft[It]);
2941
+ const vt = rt.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"), Ct = new RegExp(vt, "gi");
2942
+ L = L.replace(Ct, ft[It]);
2914
2943
  }
2915
- }), U && U.type && U.type !== "None") {
2916
- if (U.type === "Solid" && U.color) {
2917
- const ot = Z ? "#FFFFFF" : U.color, It = Z ? 1 : this.normalizeOpacity(U.opacity ?? 100);
2918
- R = R.replace(/\bfill\s*=\s*["'][^"']*["']/gi, (bt) => /fill\s*=\s*["']\s*(none|transparent)\s*["']/i.test(bt) ? bt : `fill="${ot}"`), R = R.replace(/fill\s*:\s*[^;"')]+/gi, (bt) => /fill\s*:\s*(none|transparent)/i.test(bt) ? bt : `fill:${ot}`), It < 1 && (R = R.replace(/\bfill-opacity\s*=\s*["'][^"']*["']/gi, `fill-opacity="${It}"`), R = R.replace(/fill-opacity\s*:\s*[^;"')]+/gi, `fill-opacity:${It}`), R.match(/\bfill-opacity\s*=/i) || (R = R.replace(/(<svg[^>]*>)/i, `$1<g fill-opacity="${It}">`), R = R.replace(/<\/svg>/i, "</g></svg>")));
2919
- } else if (U.type === "LinearGradient" || U.type === "RadialGradient" || U.type === "Linear" || U.type === "Radial") {
2920
- const ot = "exode-fill", It = this.normalizeOpacity(U.opacity ?? 100), bt = (U.stops || []).map((gt) => {
2921
- const Rt = gt.offset !== void 0 ? gt.offset : gt.pos ?? 0, at = this.normalizeOpacity(gt.opacity ?? 100) * It;
2922
- return `<stop offset="${Rt * 100}%" stop-color="${gt.color || "#000"}" stop-opacity="${at}"/>`;
2944
+ }), q && q.type && q.type !== "None") {
2945
+ if (q.type === "Solid" && q.color) {
2946
+ const rt = j ? "#FFFFFF" : q.color, It = j ? 1 : this.normalizeOpacity(q.opacity ?? 100);
2947
+ L = L.replace(/\bfill\s*=\s*["'][^"']*["']/gi, (vt) => /fill\s*=\s*["']\s*(none|transparent)\s*["']/i.test(vt) ? vt : `fill="${rt}"`), L = L.replace(/fill\s*:\s*[^;"')]+/gi, (vt) => /fill\s*:\s*(none|transparent)/i.test(vt) ? vt : `fill:${rt}`), It < 1 && (L = L.replace(/\bfill-opacity\s*=\s*["'][^"']*["']/gi, `fill-opacity="${It}"`), L = L.replace(/fill-opacity\s*:\s*[^;"')]+/gi, `fill-opacity:${It}`), L.match(/\bfill-opacity\s*=/i) || (L = L.replace(/(<svg[^>]*>)/i, `$1<g fill-opacity="${It}">`), L = L.replace(/<\/svg>/i, "</g></svg>")));
2948
+ } else if (q.type === "LinearGradient" || q.type === "RadialGradient" || q.type === "Linear" || q.type === "Radial") {
2949
+ const rt = "exode-fill", It = this.normalizeOpacity(q.opacity ?? 100), vt = (q.stops || []).map((mt) => {
2950
+ const Lt = mt.offset !== void 0 ? mt.offset : mt.pos ?? 0, lt = this.normalizeOpacity(mt.opacity ?? 100) * It;
2951
+ return `<stop offset="${Lt * 100}%" stop-color="${mt.color || "#000"}" stop-opacity="${lt}"/>`;
2923
2952
  }).join("");
2924
- let vt = "";
2925
- if (U.type === "LinearGradient" || U.type === "Linear") {
2926
- const gt = (wt, V) => Array.isArray(wt) ? wt[V] ?? (V === 0 ? 0 : 1) : wt && typeof wt == "object" ? wt[V === 0 ? "x" : "y"] ?? (V === 0 ? 0 : 1) : V === 0 ? 0 : 1, Rt = gt(U.start, 0) * 100, at = gt(U.start, 1) * 100, st = gt(U.end, 0) * 100, nt = gt(U.end, 1) * 100;
2927
- vt = `<linearGradient id="${ot}" x1="${Rt}%" y1="${at}%" x2="${st}%" y2="${nt}%" gradientUnits="objectBoundingBox">${bt}</linearGradient>`;
2953
+ let Ct = "";
2954
+ if (q.type === "LinearGradient" || q.type === "Linear") {
2955
+ const mt = (Mt, V) => Array.isArray(Mt) ? Mt[V] ?? (V === 0 ? 0 : 1) : Mt && typeof Mt == "object" ? Mt[V === 0 ? "x" : "y"] ?? (V === 0 ? 0 : 1) : V === 0 ? 0 : 1, Lt = mt(q.start, 0) * 100, lt = mt(q.start, 1) * 100, st = mt(q.end, 0) * 100, at = mt(q.end, 1) * 100;
2956
+ Ct = `<linearGradient id="${rt}" x1="${Lt}%" y1="${lt}%" x2="${st}%" y2="${at}%" gradientUnits="objectBoundingBox">${vt}</linearGradient>`;
2928
2957
  } else {
2929
- const gt = (nt, wt) => Array.isArray(nt) ? nt[wt] ?? 0.5 : nt && typeof nt == "object" ? nt[wt === 0 ? "x" : "y"] ?? 0.5 : 0.5, Rt = gt(U.center, 0) * 100, at = gt(U.center, 1) * 100, st = (U.radius ?? 0.5) * 100;
2930
- vt = `<radialGradient id="${ot}" cx="${Rt}%" cy="${at}%" r="${st}%" gradientUnits="objectBoundingBox">${bt}</radialGradient>`;
2958
+ const mt = (at, Mt) => Array.isArray(at) ? at[Mt] ?? 0.5 : at && typeof at == "object" ? at[Mt === 0 ? "x" : "y"] ?? 0.5 : 0.5, Lt = mt(q.center, 0) * 100, lt = mt(q.center, 1) * 100, st = (q.radius ?? 0.5) * 100;
2959
+ Ct = `<radialGradient id="${rt}" cx="${Lt}%" cy="${lt}%" r="${st}%" gradientUnits="objectBoundingBox">${vt}</radialGradient>`;
2931
2960
  }
2932
- /<defs>/i.test(R) ? R = R.replace(/<defs>/i, `<defs>${vt}`) : R = R.replace(/<svg([^>]*)>/i, `<svg$1><defs>${vt}</defs>`), R = R.replace(/\bfill\s*=\s*["'][^"']*["']/gi, (gt) => /fill\s*=\s*["']\s*(none|transparent)\s*["']/i.test(gt) ? gt : `fill="url(#${ot})"`), R = R.replace(/fill\s*:\s*[^;"')]+/gi, (gt) => /fill\s*:\s*(none|transparent)/i.test(gt) ? gt : `fill:url(#${ot})`);
2961
+ /<defs>/i.test(L) ? L = L.replace(/<defs>/i, `<defs>${Ct}`) : L = L.replace(/<svg([^>]*)>/i, `<svg$1><defs>${Ct}</defs>`), L = L.replace(/\bfill\s*=\s*["'][^"']*["']/gi, (mt) => /fill\s*=\s*["']\s*(none|transparent)\s*["']/i.test(mt) ? mt : `fill="url(#${rt})"`), L = L.replace(/fill\s*:\s*[^;"')]+/gi, (mt) => /fill\s*:\s*(none|transparent)/i.test(mt) ? mt : `fill:url(#${rt})`);
2933
2962
  }
2934
2963
  }
2935
- const te = (ot, It, bt = 1) => {
2936
- const vt = (ot.stops || []).map((nt) => {
2937
- const wt = nt.offset !== void 0 ? nt.offset : nt.pos ?? 0, V = this.normalizeOpacity(nt.opacity ?? 100) * bt;
2938
- return `<stop offset="${wt * 100}%" stop-color="${nt.color || "#000"}" stop-opacity="${V}"/>`;
2939
- }).join(""), gt = (nt, wt, V = 0.5) => Array.isArray(nt) ? nt[wt] ?? V : nt && typeof nt == "object" ? nt[wt === 0 ? "x" : "y"] ?? V : V;
2940
- if (ot.type === "LinearGradient" || ot.type === "Linear") {
2941
- const nt = gt(ot.start, 0, 0) * 100, wt = gt(ot.start, 1, 0) * 100, V = gt(ot.end, 0, 1) * 100, pt = gt(ot.end, 1, 1) * 100;
2942
- return `<linearGradient id="${It}" x1="${nt}%" y1="${wt}%" x2="${V}%" y2="${pt}%" gradientUnits="objectBoundingBox">${vt}</linearGradient>`;
2964
+ const te = (rt, It, vt = 1) => {
2965
+ const Ct = (rt.stops || []).map((at) => {
2966
+ const Mt = at.offset !== void 0 ? at.offset : at.pos ?? 0, V = this.normalizeOpacity(at.opacity ?? 100) * vt;
2967
+ return `<stop offset="${Mt * 100}%" stop-color="${at.color || "#000"}" stop-opacity="${V}"/>`;
2968
+ }).join(""), mt = (at, Mt, V = 0.5) => Array.isArray(at) ? at[Mt] ?? V : at && typeof at == "object" ? at[Mt === 0 ? "x" : "y"] ?? V : V;
2969
+ if (rt.type === "LinearGradient" || rt.type === "Linear") {
2970
+ const at = mt(rt.start, 0, 0) * 100, Mt = mt(rt.start, 1, 0) * 100, V = mt(rt.end, 0, 1) * 100, ut = mt(rt.end, 1, 1) * 100;
2971
+ return `<linearGradient id="${It}" x1="${at}%" y1="${Mt}%" x2="${V}%" y2="${ut}%" gradientUnits="objectBoundingBox">${Ct}</linearGradient>`;
2943
2972
  }
2944
- const Rt = gt(ot.center, 0, 0.5) * 100, at = gt(ot.center, 1, 0.5) * 100, st = (ot.radius ?? 0.5) * 100;
2945
- return `<radialGradient id="${It}" cx="${Rt}%" cy="${at}%" r="${st}%" gradientUnits="objectBoundingBox">${vt}</radialGradient>`;
2946
- }, $t = (ot, It) => /<defs>/i.test(ot) ? ot.replace(/<defs>/i, `<defs>${It}`) : ot.replace(/(<svg[^>]*>)/i, `$1<defs>${It}</defs>`);
2947
- if (G && G.isEnabled !== !1 && (G.width || 0) > 0) {
2948
- const ot = Z ? 1 : this.normalizeOpacity(G.opacity ?? 100), It = Z ? "#FFFFFF" : G.color || (U == null ? void 0 : U.color) || "#000000";
2949
- let bt = "";
2950
- const vt = G.fill;
2951
- if (vt && vt.type) {
2952
- if (vt.type === "Solid")
2953
- bt = vt.color || G.color || "#000000";
2954
- else if (vt.type === "LinearGradient" || vt.type === "RadialGradient" || vt.type === "Linear" || vt.type === "Radial") {
2973
+ const Lt = mt(rt.center, 0, 0.5) * 100, lt = mt(rt.center, 1, 0.5) * 100, st = (rt.radius ?? 0.5) * 100;
2974
+ return `<radialGradient id="${It}" cx="${Lt}%" cy="${lt}%" r="${st}%" gradientUnits="objectBoundingBox">${Ct}</radialGradient>`;
2975
+ }, Wt = (rt, It) => /<defs>/i.test(rt) ? rt.replace(/<defs>/i, `<defs>${It}`) : rt.replace(/(<svg[^>]*>)/i, `$1<defs>${It}</defs>`);
2976
+ if (X && X.isEnabled !== !1 && (X.width || 0) > 0) {
2977
+ const rt = j ? 1 : this.normalizeOpacity(X.opacity ?? 100), It = j ? "#FFFFFF" : X.color || (q == null ? void 0 : q.color) || "#000000";
2978
+ let vt = "";
2979
+ const Ct = X.fill;
2980
+ if (Ct && Ct.type) {
2981
+ if (Ct.type === "Solid")
2982
+ vt = Ct.color || X.color || "#000000";
2983
+ else if (Ct.type === "LinearGradient" || Ct.type === "RadialGradient" || Ct.type === "Linear" || Ct.type === "Radial") {
2955
2984
  const Ht = "exode-stroke";
2956
- R = $t(R, te(vt, Ht, ot)), bt = `url(#${Ht})`;
2985
+ L = Wt(L, te(Ct, Ht, rt)), vt = `url(#${Ht})`;
2957
2986
  }
2958
2987
  }
2959
- bt || (bt = It), R.match(/\bstroke\s*=\s*["']/i) ? R = R.replace(
2988
+ vt || (vt = It), L.match(/\bstroke\s*=\s*["']/i) ? L = L.replace(
2960
2989
  /\bstroke\s*=\s*["'][^"']*["']/gi,
2961
- (Ht) => /stroke\s*=\s*["']\s*(none|transparent)\s*["']/i.test(Ht) ? Ht : `stroke="${bt}"`
2962
- ) : R = R.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke="${bt}"`), R = R.replace(
2990
+ (Ht) => /stroke\s*=\s*["']\s*(none|transparent)\s*["']/i.test(Ht) ? Ht : `stroke="${vt}"`
2991
+ ) : L = L.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke="${vt}"`), L = L.replace(
2963
2992
  new RegExp(`(?<![a-z-])stroke\\s*:\\s*(?!none|transparent)[^;"')]+`, "gi"),
2964
- `stroke:${bt}`
2993
+ `stroke:${vt}`
2965
2994
  );
2966
- let gt = i.width || a || 100, Rt = i.height || r || 100;
2967
- const at = J.match(/viewBox=["']\s*0\s+0\s+([\d.]+)\s+([\d.]+)\s*["']/i);
2968
- if (at) {
2969
- const Ht = parseFloat(at[1]), se = parseFloat(at[2]);
2970
- !isNaN(Ht) && !isNaN(se) && (gt = Ht, Rt = se);
2995
+ let mt = i.width || a || 100, Lt = i.height || r || 100;
2996
+ const lt = K.match(/viewBox=["']\s*0\s+0\s+([\d.]+)\s+([\d.]+)\s*["']/i);
2997
+ if (lt) {
2998
+ const Ht = parseFloat(lt[1]), se = parseFloat(lt[2]);
2999
+ !isNaN(Ht) && !isNaN(se) && (mt = Ht, Lt = se);
2971
3000
  }
2972
- const st = Math.max(1e-3, a / gt), nt = Math.max(1e-3, r / Rt), wt = (st + nt) / 2, V = (G.width || 1) / wt;
2973
- R.match(/\bstroke-width\s*=\s*["']/i) ? R = R.replace(/\bstroke-width\s*=\s*["'][^"']*["']/gi, `stroke-width="${V}"`) : R = R.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-width="${V}"`), R = R.replace(/stroke-width\s*:\s*[^;"')]+/gi, `stroke-width:${V}`), R.match(/\bstroke-opacity\s*=\s*["']/i) ? R = R.replace(/\bstroke-opacity\s*=\s*["'][^"']*["']/gi, `stroke-opacity="${ot}"`) : R = R.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-opacity="${ot}"`), R = R.replace(/stroke-opacity\s*:\s*[^;"')]+/gi, `stroke-opacity:${ot}`);
2974
- const pt = G.lineCap || "round";
2975
- R.match(/\bstroke-linecap\s*=\s*["']/i) ? R = R.replace(/\bstroke-linecap\s*=\s*["'][^"']*["']/gi, `stroke-linecap="${pt}"`) : R = R.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-linecap="${pt}"`), R = R.replace(/stroke-linecap\s*:\s*[^;"')]+/gi, `stroke-linecap:${pt}`);
2976
- const ut = G.lineJoin || "round";
2977
- R.match(/\bstroke-linejoin\s*=\s*["']/i) ? R = R.replace(/\bstroke-linejoin\s*=\s*["'][^"']*["']/gi, `stroke-linejoin="${ut}"`) : R = R.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-linejoin="${ut}"`), R = R.replace(/stroke-linejoin\s*:\s*[^;"')]+/gi, `stroke-linejoin:${ut}`);
2978
- const ce = G.trimStart ?? 0, me = G.trimEnd ?? 1, Ie = G.trimOffset ?? 0, we = G.dashOffset ?? 0, Te = ce !== 0 || me !== 1 || Ie !== 0 || we !== 0;
3001
+ const st = Math.max(1e-3, a / mt), at = Math.max(1e-3, r / Lt), Mt = (st + at) / 2, V = (X.width || 1) / Mt;
3002
+ L.match(/\bstroke-width\s*=\s*["']/i) ? L = L.replace(/\bstroke-width\s*=\s*["'][^"']*["']/gi, `stroke-width="${V}"`) : L = L.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-width="${V}"`), L = L.replace(/stroke-width\s*:\s*[^;"')]+/gi, `stroke-width:${V}`), L.match(/\bstroke-opacity\s*=\s*["']/i) ? L = L.replace(/\bstroke-opacity\s*=\s*["'][^"']*["']/gi, `stroke-opacity="${rt}"`) : L = L.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-opacity="${rt}"`), L = L.replace(/stroke-opacity\s*:\s*[^;"')]+/gi, `stroke-opacity:${rt}`);
3003
+ const ut = X.lineCap || "round";
3004
+ L.match(/\bstroke-linecap\s*=\s*["']/i) ? L = L.replace(/\bstroke-linecap\s*=\s*["'][^"']*["']/gi, `stroke-linecap="${ut}"`) : L = L.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-linecap="${ut}"`), L = L.replace(/stroke-linecap\s*:\s*[^;"')]+/gi, `stroke-linecap:${ut}`);
3005
+ const gt = X.lineJoin || "round";
3006
+ L.match(/\bstroke-linejoin\s*=\s*["']/i) ? L = L.replace(/\bstroke-linejoin\s*=\s*["'][^"']*["']/gi, `stroke-linejoin="${gt}"`) : L = L.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-linejoin="${gt}"`), L = L.replace(/stroke-linejoin\s*:\s*[^;"')]+/gi, `stroke-linejoin:${gt}`);
3007
+ const ce = X.trimStart ?? 0, me = X.trimEnd ?? 1, Ie = X.trimOffset ?? 0, we = X.dashOffset ?? 0, Te = ce !== 0 || me !== 1 || Ie !== 0 || we !== 0;
2979
3008
  if (Te) {
2980
3009
  const Ht = Math.max(0, Math.min(1, ce)), se = Math.max(0, Math.min(1, me));
2981
3010
  this.frameCount % 600 === 0 && this.debugLog(`SVG Trim - Object: ${s.name || s.id}, Start: ${Ht}, End: ${se}`);
2982
- const ue = (gt + Rt) * 2, Me = (Ie % 1 + 1) % 1, ke = (we % 1 + 1) % 1;
3011
+ const ue = (mt + Lt) * 2, Me = (Ie % 1 + 1) % 1, ke = (we % 1 + 1) % 1;
2983
3012
  let fe = "", re = 0;
2984
3013
  if (Ht >= se)
2985
3014
  fe = `0 ${ue}`, re = 0;
@@ -2987,12 +3016,12 @@ class ci {
2987
3016
  const le = ue * (se - Ht), ye = ue - le;
2988
3017
  re = -(ue * (Ht + Me + ke)), fe = `${le} ${ye}`;
2989
3018
  }
2990
- R.match(/\bstroke-dasharray\s*=/i) ? R = R.replace(/\bstroke-dasharray\s*=\s*["'][^"']*["']/gi, `stroke-dasharray="${fe}"`) : R = R.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-dasharray="${fe}"`), R = R.replace(/stroke-dasharray\s*:\s*[^;"')]+/gi, `stroke-dasharray:${fe}`), R.match(/\bstroke-dashoffset\s*=/i) ? R = R.replace(/\bstroke-dashoffset\s*=\s*["'][^"']*["']/gi, `stroke-dashoffset="${re}"`) : R = R.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-dashoffset="${re}"`), R = R.replace(/stroke-dashoffset\s*:\s*[^;"')]+/gi, `stroke-dashoffset:${re}`);
2991
- } else if (G.dashArray && G.dashArray.length > 0) {
2992
- const Ht = G.dashArray.join(" ");
2993
- R = R.replace(/\bstroke-dasharray\s*=\s*["'][^"']*["']/gi, `stroke-dasharray="${Ht}"`), R = R.replace(/stroke-dasharray\s*:\s*[^;"')]+/gi, `stroke-dasharray:${Ht}`), G.dashOffset && (R = R.replace(/\bstroke-dashoffset\s*=\s*["'][^"']*["']/gi, `stroke-dashoffset="${G.dashOffset}"`), R = R.replace(/stroke-dashoffset\s*:\s*[^;"')]+/gi, `stroke-dashoffset:${G.dashOffset}`));
3019
+ L.match(/\bstroke-dasharray\s*=/i) ? L = L.replace(/\bstroke-dasharray\s*=\s*["'][^"']*["']/gi, `stroke-dasharray="${fe}"`) : L = L.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-dasharray="${fe}"`), L = L.replace(/stroke-dasharray\s*:\s*[^;"')]+/gi, `stroke-dasharray:${fe}`), L.match(/\bstroke-dashoffset\s*=/i) ? L = L.replace(/\bstroke-dashoffset\s*=\s*["'][^"']*["']/gi, `stroke-dashoffset="${re}"`) : L = L.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-dashoffset="${re}"`), L = L.replace(/stroke-dashoffset\s*:\s*[^;"')]+/gi, `stroke-dashoffset:${re}`);
3020
+ } else if (X.dashArray && X.dashArray.length > 0) {
3021
+ const Ht = X.dashArray.join(" ");
3022
+ L = L.replace(/\bstroke-dasharray\s*=\s*["'][^"']*["']/gi, `stroke-dasharray="${Ht}"`), L = L.replace(/stroke-dasharray\s*:\s*[^;"')]+/gi, `stroke-dasharray:${Ht}`), X.dashOffset && (L = L.replace(/\bstroke-dashoffset\s*=\s*["'][^"']*["']/gi, `stroke-dashoffset="${X.dashOffset}"`), L = L.replace(/stroke-dashoffset\s*:\s*[^;"')]+/gi, `stroke-dashoffset:${X.dashOffset}`));
2994
3023
  }
2995
- if (!/\bstroke\s*=\s*["']/i.test(J) && !new RegExp("(?<![a-z-])stroke\\s*:", "i").test(J)) {
3024
+ if (!/\bstroke\s*=\s*["']/i.test(K) && !new RegExp("(?<![a-z-])stroke\\s*:", "i").test(K)) {
2996
3025
  let Ht = "", se = "";
2997
3026
  if (Te) {
2998
3027
  const fe = i.width || a || 100, re = i.height || r || 100, le = (fe + re) * 2, ye = Math.max(0, Math.min(1, ce)), _e = Math.max(0, Math.min(1, me)), Ae = (Ie % 1 + 1) % 1, Oe = (we % 1 + 1) % 1;
@@ -3002,85 +3031,85 @@ class ci {
3002
3031
  const Pe = le * (_e - ye), Re = le - Pe, Le = -(le * (ye + Ae + Oe));
3003
3032
  Ht = ` stroke-dasharray="${Pe} ${Re}"`, se = ` stroke-dashoffset="${Le}"`;
3004
3033
  }
3005
- } else (_ = G.dashArray) != null && _.length && (Ht = ` stroke-dasharray="${G.dashArray.join(" ")}"`, G.dashOffset && (se = ` stroke-dashoffset="${G.dashOffset}"`));
3006
- const ue = ` stroke-linecap="${G.lineCap || "round"}"`, Me = ` stroke-linejoin="${G.lineJoin || "round"}"`, ke = `stroke="${bt}" stroke-width="${V}" stroke-opacity="${ot}"${ue}${Me}${Ht}${se}`;
3007
- R = R.replace(
3034
+ } else (E = X.dashArray) != null && E.length && (Ht = ` stroke-dasharray="${X.dashArray.join(" ")}"`, X.dashOffset && (se = ` stroke-dashoffset="${X.dashOffset}"`));
3035
+ const ue = ` stroke-linecap="${X.lineCap || "round"}"`, Me = ` stroke-linejoin="${X.lineJoin || "round"}"`, ke = `stroke="${vt}" stroke-width="${V}" stroke-opacity="${rt}"${ue}${Me}${Ht}${se}`;
3036
+ L = L.replace(
3008
3037
  /(<svg[^>]*>)(\s*(?:<defs>[\s\S]*?<\/defs>)?)/i,
3009
3038
  (fe, re, le) => `${re}${le}<g ${ke}>`
3010
- ), R = R.replace(/<\/svg>/i, "</g></svg>");
3039
+ ), L = L.replace(/<\/svg>/i, "</g></svg>");
3011
3040
  }
3012
- } else G && G.isEnabled === !1 && (R = R.replace(/\bstroke\s*=\s*["'][^"']*["']/gi, 'stroke="none"'), R = R.replace(new RegExp(`(?<![a-z-])stroke\\s*:\\s*(?!none|transparent)[^;"')]+`, "gi"), "stroke:none"));
3013
- const Wt = new Blob([R], { type: "image/svg+xml" }), Ft = URL.createObjectURL(Wt);
3041
+ } else X && X.isEnabled === !1 && (L = L.replace(/\bstroke\s*=\s*["'][^"']*["']/gi, 'stroke="none"'), L = L.replace(new RegExp(`(?<![a-z-])stroke\\s*:\\s*(?!none|transparent)[^;"')]+`, "gi"), "stroke:none"));
3042
+ const Yt = new Blob([L], { type: "image/svg+xml" }), $t = URL.createObjectURL(Yt);
3014
3043
  Nt.onload = () => {
3015
- if (URL.revokeObjectURL(Ft), this.frameCount % 900 === 0) {
3016
- const ot = this.imageCache.get(kt);
3017
- ot && this.debugLog(`SVG Payload Ready: ${s.name || s.id} (${ot.naturalWidth}x${ot.naturalHeight})`);
3044
+ if (URL.revokeObjectURL($t), this.frameCount % 900 === 0) {
3045
+ const rt = this.imageCache.get(Tt);
3046
+ rt && this.debugLog(`SVG Payload Ready: ${s.name || s.id} (${rt.naturalWidth}x${rt.naturalHeight})`);
3018
3047
  }
3019
3048
  }, Nt.onerror = () => {
3020
- URL.revokeObjectURL(Ft), this.debugLog(`SVG Error: Failed to load payload for ${s.name || s.id}`);
3021
- }, Nt.src = Ft, this.imageCache.set(kt, Nt);
3049
+ URL.revokeObjectURL($t), this.debugLog(`SVG Error: Failed to load payload for ${s.name || s.id}`);
3050
+ }, Nt.src = $t, this.imageCache.set(Tt, Nt);
3022
3051
  }
3023
- let yt = null;
3024
- if (Nt.complete && Nt.naturalWidth > 0 ? (yt = Nt, this.lastValidSvgImgMap.set(s.id, Nt)) : yt = this.lastValidSvgImgMap.get(s.id) || null, yt && yt.complete && yt.naturalWidth > 0) {
3025
- const R = Math.max(1, a), ct = Math.max(1, r);
3026
- if (Z && (U == null ? void 0 : U.type) === "Solid") {
3027
- this.maskBuffer || (this.maskBuffer = document.createElement("canvas"), this.maskCtx = this.maskBuffer.getContext("2d")), this.maskBuffer.width = R, this.maskBuffer.height = ct, this.maskCtx.setTransform(1, 0, 0, 1, 0, 0), this.maskCtx.globalCompositeOperation = "source-over", this.maskCtx.globalAlpha = 1, this.maskCtx.filter = "none", this.maskCtx.clearRect(0, 0, R, ct), this.maskCtx.drawImage(yt, 0, 0, R, ct), this.maskCtx.globalCompositeOperation = "source-in";
3028
- const Xt = U.color || "#000000", xt = this.normalizeOpacity(U.opacity ?? 100);
3029
- this.maskCtx.fillStyle = Xt, this.maskCtx.globalAlpha = xt, this.maskCtx.fillRect(0, 0, R, ct), t.drawImage(this.maskBuffer, -R / 2, -ct / 2, R, ct);
3030
- } else h !== 0 ? (t.save(), this.drawRoundRect(t, -R / 2, -ct / 2, R, ct, h), t.clip(), t.drawImage(yt, -R / 2, -ct / 2, R, ct), t.restore()) : t.drawImage(yt, -R / 2, -ct / 2, R, ct);
3052
+ let bt = null;
3053
+ if (Nt.complete && Nt.naturalWidth > 0 ? (bt = Nt, this.lastValidSvgImgMap.set(s.id, Nt)) : bt = this.lastValidSvgImgMap.get(s.id) || null, bt && bt.complete && bt.naturalWidth > 0) {
3054
+ const L = Math.max(1, a), ct = Math.max(1, r);
3055
+ if (j && (q == null ? void 0 : q.type) === "Solid") {
3056
+ this.maskBuffer || (this.maskBuffer = document.createElement("canvas"), this.maskCtx = this.maskBuffer.getContext("2d")), this.maskBuffer.width = L, this.maskBuffer.height = ct, this.maskCtx.setTransform(1, 0, 0, 1, 0, 0), this.maskCtx.globalCompositeOperation = "source-over", this.maskCtx.globalAlpha = 1, this.maskCtx.filter = "none", this.maskCtx.clearRect(0, 0, L, ct), this.maskCtx.drawImage(bt, 0, 0, L, ct), this.maskCtx.globalCompositeOperation = "source-in";
3057
+ const Dt = q.color || "#000000", At = this.normalizeOpacity(q.opacity ?? 100);
3058
+ this.maskCtx.fillStyle = Dt, this.maskCtx.globalAlpha = At, this.maskCtx.fillRect(0, 0, L, ct), t.drawImage(this.maskBuffer, -L / 2, -ct / 2, L, ct);
3059
+ } else h !== 0 ? (t.save(), this.drawRoundRect(t, -L / 2, -ct / 2, L, ct, h), t.clip(), t.drawImage(bt, -L / 2, -ct / 2, L, ct), t.restore()) : t.drawImage(bt, -L / 2, -ct / 2, L, ct);
3031
3060
  }
3032
3061
  }
3033
3062
  } else if (c.type === "LineGraph")
3034
3063
  this.renderLineGraph(t, c, a, r);
3035
3064
  else if (s.type === "Shape") {
3036
3065
  if (this.applyPath(t, c, a, r, h), t.save(), n.blur && n.blur.amount > 0 && (t.filter = `blur(${n.blur.amount}px)`), n.fill) {
3037
- const J = t.globalAlpha;
3038
- if (((L = n.fill) == null ? void 0 : L.type) === "Image" && (n.fill.originalSrc || n.fill.src)) {
3066
+ const K = t.globalAlpha;
3067
+ if (((R = n.fill) == null ? void 0 : R.type) === "Image" && (n.fill.originalSrc || n.fill.src)) {
3039
3068
  const ft = n.fill.originalSrc || n.fill.src;
3040
- let U = this.imageCache.get(ft);
3041
- U || (U = new Image(), U.src = ft, this.imageCache.set(ft, U)), U.complete && U.naturalWidth > 0 && (t.save(), this.applyPath(t, c, a, r, h), t.clip(), this.renderFittedImage(t, U, -a / 2, -r / 2, a, r, n.fill.fillMode), t.restore());
3069
+ let q = this.imageCache.get(ft);
3070
+ q || (q = new Image(), q.src = ft, this.imageCache.set(ft, q)), q.complete && q.naturalWidth > 0 && (t.save(), this.applyPath(t, c, a, r, h), t.clip(), this.renderFittedImage(t, q, -a / 2, -r / 2, a, r, n.fill.fillMode), t.restore());
3042
3071
  } else {
3043
3072
  const ft = this.createCanvasFill(t, n.fill, a, r);
3044
- t.fillStyle = ft || (typeof n.fill == "string" ? n.fill : n.fill.color || "transparent"), t.globalAlpha = J * this.normalizeOpacity(n.fill.opacity ?? 100), this.applyPath(t, c, a, r, h), t.fill();
3073
+ t.fillStyle = ft || (typeof n.fill == "string" ? n.fill : n.fill.color || "transparent"), t.globalAlpha = K * this.normalizeOpacity(n.fill.opacity ?? 100), this.applyPath(t, c, a, r, h), t.fill();
3045
3074
  }
3046
- t.globalAlpha = J;
3075
+ t.globalAlpha = K;
3047
3076
  }
3048
3077
  t.restore(), n.stroke && n.stroke.width > 0 && this.applyStrokeAlignment(t, n, c, a, r, h);
3049
3078
  } else if (s.type === "Frame" || s.type === "Group" && !s.isStructuralGroup) {
3050
- const J = e.width ?? i.width ?? s.width ?? a, ft = e.height ?? i.height ?? s.height ?? r, U = h;
3051
- if (t.save(), t.beginPath(), this.drawRoundRect(t, -J / 2, -ft / 2, J, ft, U), n.fill && n.fill.type !== "None") {
3052
- const G = t.globalAlpha, K = this.createCanvasFill(t, n.fill, J, ft);
3053
- t.fillStyle = K || n.fill.color || "transparent", t.globalAlpha = G * this.normalizeOpacity(n.fill.opacity ?? 100), t.fill(), t.globalAlpha = G;
3079
+ const K = e.width ?? i.width ?? s.width ?? a, ft = e.height ?? i.height ?? s.height ?? r, q = h;
3080
+ if (t.save(), t.beginPath(), this.drawRoundRect(t, -K / 2, -ft / 2, K, ft, q), n.fill && n.fill.type !== "None") {
3081
+ const X = t.globalAlpha, Z = this.createCanvasFill(t, n.fill, K, ft);
3082
+ t.fillStyle = Z || n.fill.color || "transparent", t.globalAlpha = X * this.normalizeOpacity(n.fill.opacity ?? 100), t.fill(), t.globalAlpha = X;
3054
3083
  }
3055
3084
  if (t.restore(), n.stroke && n.stroke.width > 0 && n.stroke.isEnabled !== !1) {
3056
- const G = { type: "Rectangle" };
3057
- this.applyStrokeAlignment(t, n, G, J, ft, U);
3085
+ const X = { type: "Rectangle" };
3086
+ this.applyStrokeAlignment(t, n, X, K, ft, q);
3058
3087
  }
3059
- } else s.type === "Group" && s.isStructuralGroup || (s.type === "Component" && s.variant === "inputbox" ? this.renderInputBox(t, s) : s.type === "Component" && s.variant === "button" ? this.renderButton(t, s) : s.type === "Component" && s.variant === "toggle_button" ? this.renderToggleButton(t, s) : s.type === "Toggle" || s.type === "Component" && s.variant === "toggle" ? this.renderToggle(t, s) : s.type === "Slider" || s.type === "Component" && s.variant === "slider" ? this.renderSlider(t, s) : s.type === "Dropdown" || s.type === "Component" && s.variant === "dropdown" ? this.renderDropdown(t, s) : s.type === "ListView" || s.type === "Component" && s.variant === "listview" ? this.renderListView(t, s) : s.type === "Checkbox" || s.type === "Component" && s.variant === "checkbox" ? this.renderCheckbox(t, s) : s.type === "RadioGroup" || s.type === "Component" && s.variant === "radiogroup" ? this.renderRadioGroup(t, s) : s.type === "BarChart" || s.type === "Component" && s.variant === "barchart" ? this.renderBarChart(t, s) : s.type === "PieChart" || s.type === "Component" && s.variant === "piechart" ? this.renderPieChart(t, s) : this.frameCount % 60 === 0 && console.warn("[Engine] Unhandled object type in renderObject:", s.type, "Geo:", (x = s.geometry) == null ? void 0 : x.type));
3060
- if (this.applyArtEffectOverlay(t, s, c, a, r, h), dt && St === "BackgroundBlur" && this.applyBackgroundBlurGlass(t, c, a, r, h, it), ee && ee.enabled && t.restore(), s.children && s.children.length > 0) {
3061
- const ft = s.type === "Frame", U = s.clipsContent !== void 0 ? s.clipsContent : s.clipContent !== void 0 ? s.clipContent : ft;
3062
- if (t.save(), U) {
3088
+ } else s.type === "Group" && s.isStructuralGroup || (s.type === "Component" && s.variant === "inputbox" ? this.renderInputBox(t, s) : s.type === "Component" && s.variant === "button" ? this.renderButton(t, s) : s.type === "Component" && s.variant === "toggle_button" ? this.renderToggleButton(t, s) : s.type === "Toggle" || s.type === "Component" && s.variant === "toggle" ? this.renderToggle(t, s) : s.type === "Slider" || s.type === "Component" && s.variant === "slider" ? this.renderSlider(t, s) : s.type === "Dropdown" || s.type === "Component" && s.variant === "dropdown" ? this.renderDropdown(t, s) : s.type === "ListView" || s.type === "Component" && s.variant === "listview" ? this.renderListView(t, s) : s.type === "Checkbox" || s.type === "Component" && s.variant === "checkbox" ? this.renderCheckbox(t, s) : s.type === "RadioGroup" || s.type === "Component" && s.variant === "radiogroup" ? this.renderRadioGroup(t, s) : s.type === "BarChart" || s.type === "Component" && s.variant === "barchart" ? this.renderBarChart(t, s) : s.type === "PieChart" || s.type === "Component" && s.variant === "piechart" ? this.renderPieChart(t, s) : this.frameCount % 60 === 0 && console.warn("[Engine] Unhandled object type in renderObject:", s.type, "Geo:", (A = s.geometry) == null ? void 0 : A.type));
3089
+ if (this.applyArtEffectOverlay(t, s, c, a, r, h), dt && yt === "BackgroundBlur" && this.applyBackgroundBlurGlass(t, c, a, r, h, it), ee && ee.enabled && t.restore(), s.children && s.children.length > 0) {
3090
+ const ft = s.type === "Frame", q = s.clipsContent !== void 0 ? s.clipsContent : s.clipContent !== void 0 ? s.clipContent : ft;
3091
+ if (t.save(), q) {
3063
3092
  t.beginPath();
3064
- const K = e.width ?? (i == null ? void 0 : i.width) ?? s.width ?? 0, Z = e.height ?? (i == null ? void 0 : i.height) ?? s.height ?? 0, At = e.cornerRadius ?? (i == null ? void 0 : i.corner_radius) ?? s.cornerRadius ?? 0;
3065
- this.drawRoundRect(t, -K / 2, -Z / 2, K, Z, At), t.clip();
3093
+ const Z = e.width ?? (i == null ? void 0 : i.width) ?? s.width ?? 0, j = e.height ?? (i == null ? void 0 : i.height) ?? s.height ?? 0, Ot = e.cornerRadius ?? (i == null ? void 0 : i.corner_radius) ?? s.cornerRadius ?? 0;
3094
+ this.drawRoundRect(t, -Z / 2, -j / 2, Z, j, Ot), t.clip();
3066
3095
  }
3067
- let G = 0;
3068
- for (s.children.forEach((K) => {
3069
- const Z = o.get(K);
3070
- if (!Z) return;
3071
- const At = this.objectStates.get(K), Ot = (At == null ? void 0 : At.geometry) || Z.geometry;
3072
- if (Ot && Ot.isMask && (At == null ? void 0 : At.visible) !== !1) {
3073
- const kt = Ot.width || 0, Nt = Ot.height || 0;
3074
- this.applyObjectTransform(t, K);
3075
- const yt = (At == null ? void 0 : At.corner_radius) ?? (Ot == null ? void 0 : Ot.corner_radius) ?? 0;
3076
- this.applyPath(t, Ot, kt, Nt, yt), t.clip(), G++;
3096
+ let X = 0;
3097
+ for (s.children.forEach((Z) => {
3098
+ const j = o.get(Z);
3099
+ if (!j) return;
3100
+ const Ot = this.objectStates.get(Z), Rt = (Ot == null ? void 0 : Ot.geometry) || j.geometry;
3101
+ if (Rt && Rt.isMask && (Ot == null ? void 0 : Ot.visible) !== !1) {
3102
+ const Tt = Rt.width || 0, Nt = Rt.height || 0;
3103
+ this.applyObjectTransform(t, Z);
3104
+ const bt = (Ot == null ? void 0 : Ot.corner_radius) ?? (Rt == null ? void 0 : Rt.corner_radius) ?? 0;
3105
+ this.applyPath(t, Rt, Tt, Nt, bt), t.clip(), X++;
3077
3106
  } else
3078
- this.renderObject(t, Z, o);
3079
- }); G > 0; )
3080
- t.restore(), G--;
3107
+ this.renderObject(t, j, o);
3108
+ }); X > 0; )
3109
+ t.restore(), X--;
3081
3110
  t.restore();
3082
3111
  }
3083
- if (Mt) {
3112
+ if (kt) {
3084
3113
  this.maskCtx.restore(), (e.masks || (s.maskedBy ? [{
3085
3114
  maskId: s.maskedBy,
3086
3115
  inverted: s.maskInverted === !0,
@@ -3088,84 +3117,84 @@ class ci {
3088
3117
  opacity: s.maskOpacity !== void 0 ? s.maskOpacity / 100 : 1,
3089
3118
  feather: s.maskFeather || 0,
3090
3119
  isVisible: !0
3091
- }] : [])).filter((G) => G.isVisible !== !1 && o.has(G.maskId)).forEach((G) => {
3092
- var yt, R, ct, Xt, xt, te;
3093
- const K = o.get(G.maskId), Z = this.objectStates.get(K.id), At = G.feather || 0, Ot = G.inverted === !0, kt = G.opacity !== void 0 ? typeof G.opacity == "number" ? G.opacity : G.opacity / 100 : 1;
3094
- if ((G.type || "alpha") === "luma") {
3095
- (!this.lumaBuffer || this.lumaBuffer.width !== this.maskBuffer.width || this.lumaBuffer.height !== this.maskBuffer.height) && (this.lumaBuffer = document.createElement("canvas"), this.lumaBuffer.width = this.maskBuffer.width, this.lumaBuffer.height = this.maskBuffer.height, this.lumaCtx = this.lumaBuffer.getContext("2d", { willReadFrequently: !0 }), this.lumaCtx && (this.lumaCtx.imageSmoothingEnabled = !0, this.lumaCtx.imageSmoothingQuality = "high")), this.lumaCtx.setTransform(1, 0, 0, 1, 0, 0), this.lumaCtx.globalCompositeOperation = "source-over", this.lumaCtx.globalAlpha = 1, this.lumaCtx.filter = "none", this.lumaCtx.clearRect(0, 0, this.lumaBuffer.width, this.lumaBuffer.height), this.lumaCtx.save(), this.rootTransform && this.lumaCtx.setTransform(this.rootTransform), this.applyAbsoluteTransform(this.lumaCtx, K.id, o), At > 0 && (this.lumaCtx.filter = `blur(${At}px)`), this.lumaCtx.globalAlpha = kt;
3096
- const $t = (Z == null ? void 0 : Z.width) || K.geometry.width || 0, Wt = (Z == null ? void 0 : Z.height) || K.geometry.height || 0, Ft = (Z == null ? void 0 : Z.corner_radius) ?? K.corner_radius ?? 0;
3097
- if (((yt = K.geometry) == null ? void 0 : yt.type) === "Text") {
3098
- const vt = Z != null && Z.geometry ? this.deepMerge(K.geometry, Z.geometry) : K.geometry, gt = Z != null && Z.style ? this.deepMerge(K.style, Z.style) : K.style;
3099
- this._renderText(this.lumaCtx, K, { ...vt, width: $t, height: Wt, corner_radius: Ft }, gt, Z, $t, Wt, !0);
3100
- } else if (((R = K.geometry) == null ? void 0 : R.type) === "Image") {
3101
- const vt = K.geometry.src;
3102
- if (vt) {
3103
- let gt = this.imageCache.get(vt);
3104
- gt || (gt = new Image(), gt.src = vt, this.imageCache.set(vt, gt)), gt.complete && gt.naturalWidth > 0 ? this.lumaCtx.drawImage(gt, -$t / 2, -Wt / 2, $t, Wt) : (this.applyPath(this.lumaCtx, K.geometry, $t, Wt, Ft), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill());
3120
+ }] : [])).filter((X) => X.isVisible !== !1 && o.has(X.maskId)).forEach((X) => {
3121
+ var bt, L, ct, Dt, At, te;
3122
+ const Z = o.get(X.maskId), j = this.objectStates.get(Z.id), Ot = X.feather || 0, Rt = X.inverted === !0, Tt = X.opacity !== void 0 ? typeof X.opacity == "number" ? X.opacity : X.opacity / 100 : 1;
3123
+ if ((X.type || "alpha") === "luma") {
3124
+ (!this.lumaBuffer || this.lumaBuffer.width !== this.maskBuffer.width || this.lumaBuffer.height !== this.maskBuffer.height) && (this.lumaBuffer = document.createElement("canvas"), this.lumaBuffer.width = this.maskBuffer.width, this.lumaBuffer.height = this.maskBuffer.height, this.lumaCtx = this.lumaBuffer.getContext("2d", { willReadFrequently: !0 }), this.lumaCtx && (this.lumaCtx.imageSmoothingEnabled = !0, this.lumaCtx.imageSmoothingQuality = "high")), this.lumaCtx.setTransform(1, 0, 0, 1, 0, 0), this.lumaCtx.globalCompositeOperation = "source-over", this.lumaCtx.globalAlpha = 1, this.lumaCtx.filter = "none", this.lumaCtx.clearRect(0, 0, this.lumaBuffer.width, this.lumaBuffer.height), this.lumaCtx.save(), this.rootTransform && this.lumaCtx.setTransform(this.rootTransform), this.applyAbsoluteTransform(this.lumaCtx, Z.id, o), Ot > 0 && (this.lumaCtx.filter = `blur(${Ot}px)`), this.lumaCtx.globalAlpha = Tt;
3125
+ const Wt = (j == null ? void 0 : j.width) || Z.geometry.width || 0, Yt = (j == null ? void 0 : j.height) || Z.geometry.height || 0, $t = (j == null ? void 0 : j.corner_radius) ?? Z.corner_radius ?? 0;
3126
+ if (((bt = Z.geometry) == null ? void 0 : bt.type) === "Text") {
3127
+ const Ct = j != null && j.geometry ? this.deepMerge(Z.geometry, j.geometry) : Z.geometry, mt = j != null && j.style ? this.deepMerge(Z.style, j.style) : Z.style;
3128
+ this._renderText(this.lumaCtx, Z, { ...Ct, width: Wt, height: Yt, corner_radius: $t }, mt, j, Wt, Yt, !0);
3129
+ } else if (((L = Z.geometry) == null ? void 0 : L.type) === "Image") {
3130
+ const Ct = Z.geometry.src;
3131
+ if (Ct) {
3132
+ let mt = this.imageCache.get(Ct);
3133
+ mt || (mt = new Image(), mt.src = Ct, this.imageCache.set(Ct, mt)), mt.complete && mt.naturalWidth > 0 ? this.lumaCtx.drawImage(mt, -Wt / 2, -Yt / 2, Wt, Yt) : (this.applyPath(this.lumaCtx, Z.geometry, Wt, Yt, $t), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill());
3105
3134
  }
3106
- } else if (((ct = K.geometry) == null ? void 0 : ct.type) === "SVG") {
3107
- const vt = K.geometry.svgContent;
3108
- if (vt) {
3109
- const gt = `__lumamask_${K.id}`;
3110
- let Rt = this.imageCache.get(gt);
3111
- if (!Rt) {
3112
- Rt = new Image();
3113
- const at = new Blob([vt], { type: "image/svg+xml" });
3114
- Rt.src = URL.createObjectURL(at), Rt.onload = () => {
3135
+ } else if (((ct = Z.geometry) == null ? void 0 : ct.type) === "SVG") {
3136
+ const Ct = Z.geometry.svgContent;
3137
+ if (Ct) {
3138
+ const mt = `__lumamask_${Z.id}`;
3139
+ let Lt = this.imageCache.get(mt);
3140
+ if (!Lt) {
3141
+ Lt = new Image();
3142
+ const lt = new Blob([Ct], { type: "image/svg+xml" });
3143
+ Lt.src = URL.createObjectURL(lt), Lt.onload = () => {
3115
3144
  this.artboard && this.reset();
3116
- }, this.imageCache.set(gt, Rt);
3145
+ }, this.imageCache.set(mt, Lt);
3117
3146
  }
3118
- Rt.complete && Rt.naturalWidth > 0 ? this.lumaCtx.drawImage(Rt, -$t / 2, -Wt / 2, $t, Wt) : (this.applyPath(this.lumaCtx, K.geometry, $t, Wt, Ft), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill());
3147
+ Lt.complete && Lt.naturalWidth > 0 ? this.lumaCtx.drawImage(Lt, -Wt / 2, -Yt / 2, Wt, Yt) : (this.applyPath(this.lumaCtx, Z.geometry, Wt, Yt, $t), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill());
3119
3148
  }
3120
3149
  } else
3121
- this.applyPath(this.lumaCtx, K.geometry, $t, Wt, Ft), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill();
3150
+ this.applyPath(this.lumaCtx, Z.geometry, Wt, Yt, $t), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill();
3122
3151
  this.lumaCtx.restore();
3123
- const ot = this.maskCtx.getImageData(0, 0, this.canvasWidth, this.canvasHeight), It = this.lumaCtx.getImageData(0, 0, this.canvasWidth, this.canvasHeight).data, bt = ot.data;
3124
- for (let vt = 0; vt < bt.length; vt += 4) {
3125
- const gt = It[vt], Rt = It[vt + 1], at = It[vt + 2];
3126
- let st = (0.299 * gt + 0.587 * Rt + 0.114 * at) / 255;
3127
- Ot && (st = 1 - st), bt[vt + 3] *= st;
3152
+ const rt = this.maskCtx.getImageData(0, 0, this.canvasWidth, this.canvasHeight), It = this.lumaCtx.getImageData(0, 0, this.canvasWidth, this.canvasHeight).data, vt = rt.data;
3153
+ for (let Ct = 0; Ct < vt.length; Ct += 4) {
3154
+ const mt = It[Ct], Lt = It[Ct + 1], lt = It[Ct + 2];
3155
+ let st = (0.299 * mt + 0.587 * Lt + 0.114 * lt) / 255;
3156
+ Rt && (st = 1 - st), vt[Ct + 3] *= st;
3128
3157
  }
3129
- this.maskCtx.putImageData(ot, 0, 0);
3158
+ this.maskCtx.putImageData(rt, 0, 0);
3130
3159
  } else {
3131
- this.maskCtx.save(), this.rootTransform && this.maskCtx.setTransform(this.rootTransform), this.maskCtx.globalCompositeOperation = Ot ? "destination-out" : "destination-in", At > 0 && (this.maskCtx.filter = `blur(${At}px)`), this.maskCtx.globalAlpha = kt, this.applyAbsoluteTransform(this.maskCtx, K.id, o);
3132
- const $t = (Z == null ? void 0 : Z.width) || K.geometry.width || 0, Wt = (Z == null ? void 0 : Z.height) || K.geometry.height || 0, Ft = (Z == null ? void 0 : Z.corner_radius) ?? K.corner_radius ?? 0;
3133
- if (((Xt = K.geometry) == null ? void 0 : Xt.type) === "Text") {
3134
- const ot = Z != null && Z.geometry ? this.deepMerge(K.geometry, Z.geometry) : K.geometry, It = Z != null && Z.style ? this.deepMerge(K.style, Z.style) : K.style;
3135
- this._renderText(this.maskCtx, K, { ...ot, width: $t, height: Wt, corner_radius: Ft }, It, Z, $t, Wt, !0);
3136
- } else if (((xt = K.geometry) == null ? void 0 : xt.type) === "Image") {
3137
- const ot = K.geometry.src;
3138
- if (ot) {
3139
- let It = this.imageCache.get(ot);
3140
- It || (It = new Image(), It.src = ot, this.imageCache.set(ot, It)), It.complete && It.naturalWidth > 0 ? this.maskCtx.drawImage(It, -$t / 2, -Wt / 2, $t, Wt) : (this.applyPath(this.maskCtx, K.geometry, $t, Wt, Ft), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill());
3160
+ this.maskCtx.save(), this.rootTransform && this.maskCtx.setTransform(this.rootTransform), this.maskCtx.globalCompositeOperation = Rt ? "destination-out" : "destination-in", Ot > 0 && (this.maskCtx.filter = `blur(${Ot}px)`), this.maskCtx.globalAlpha = Tt, this.applyAbsoluteTransform(this.maskCtx, Z.id, o);
3161
+ const Wt = (j == null ? void 0 : j.width) || Z.geometry.width || 0, Yt = (j == null ? void 0 : j.height) || Z.geometry.height || 0, $t = (j == null ? void 0 : j.corner_radius) ?? Z.corner_radius ?? 0;
3162
+ if (((Dt = Z.geometry) == null ? void 0 : Dt.type) === "Text") {
3163
+ const rt = j != null && j.geometry ? this.deepMerge(Z.geometry, j.geometry) : Z.geometry, It = j != null && j.style ? this.deepMerge(Z.style, j.style) : Z.style;
3164
+ this._renderText(this.maskCtx, Z, { ...rt, width: Wt, height: Yt, corner_radius: $t }, It, j, Wt, Yt, !0);
3165
+ } else if (((At = Z.geometry) == null ? void 0 : At.type) === "Image") {
3166
+ const rt = Z.geometry.src;
3167
+ if (rt) {
3168
+ let It = this.imageCache.get(rt);
3169
+ It || (It = new Image(), It.src = rt, this.imageCache.set(rt, It)), It.complete && It.naturalWidth > 0 ? this.maskCtx.drawImage(It, -Wt / 2, -Yt / 2, Wt, Yt) : (this.applyPath(this.maskCtx, Z.geometry, Wt, Yt, $t), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill());
3141
3170
  }
3142
- } else if (((te = K.geometry) == null ? void 0 : te.type) === "SVG") {
3143
- const ot = K.geometry.svgContent;
3144
- if (ot) {
3145
- const It = `__alphamask_${K.id}`;
3146
- let bt = this.imageCache.get(It);
3147
- if (!bt) {
3148
- bt = new Image();
3149
- const vt = new Blob([ot], { type: "image/svg+xml" });
3150
- bt.src = URL.createObjectURL(vt), bt.onload = () => {
3171
+ } else if (((te = Z.geometry) == null ? void 0 : te.type) === "SVG") {
3172
+ const rt = Z.geometry.svgContent;
3173
+ if (rt) {
3174
+ const It = `__alphamask_${Z.id}`;
3175
+ let vt = this.imageCache.get(It);
3176
+ if (!vt) {
3177
+ vt = new Image();
3178
+ const Ct = new Blob([rt], { type: "image/svg+xml" });
3179
+ vt.src = URL.createObjectURL(Ct), vt.onload = () => {
3151
3180
  this.artboard && this.reset();
3152
- }, this.imageCache.set(It, bt);
3181
+ }, this.imageCache.set(It, vt);
3153
3182
  }
3154
- bt.complete && bt.naturalWidth > 0 ? this.maskCtx.drawImage(bt, -$t / 2, -Wt / 2, $t, Wt) : (this.applyPath(this.maskCtx, K.geometry, $t, Wt, Ft), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill());
3183
+ vt.complete && vt.naturalWidth > 0 ? this.maskCtx.drawImage(vt, -Wt / 2, -Yt / 2, Wt, Yt) : (this.applyPath(this.maskCtx, Z.geometry, Wt, Yt, $t), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill());
3155
3184
  }
3156
3185
  } else
3157
- this.applyPath(this.maskCtx, K.geometry, $t, Wt, Ft), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill();
3186
+ this.applyPath(this.maskCtx, Z.geometry, Wt, Yt, $t), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill();
3158
3187
  this.maskCtx.restore();
3159
3188
  }
3160
- }), lt.save(), lt.setTransform(1, 0, 0, 1, 0, 0);
3161
- const U = s.maskBlendMode || s.blendMode;
3162
- U && U !== "Normal" && (lt.globalCompositeOperation = U.toLowerCase()), lt.drawImage(this.maskBuffer, 0, 0), lt.restore(), lt.restore();
3189
+ }), nt.save(), nt.setTransform(1, 0, 0, 1, 0, 0);
3190
+ const q = s.maskBlendMode || s.blendMode;
3191
+ q && q !== "Normal" && (nt.globalCompositeOperation = q.toLowerCase()), nt.drawImage(this.maskBuffer, 0, 0), nt.restore(), nt.restore();
3163
3192
  } else
3164
3193
  t.restore();
3165
3194
  }
3166
3195
  }
3167
3196
  _renderText(t, s, o, e, i, n, a, r = !1, l = !1) {
3168
- var St, ht, mt, rt, Lt, Gt, Pt, Dt, Yt;
3197
+ var yt, ht, pt, ot, Et, Ft, wt, Xt, Bt;
3169
3198
  let h = o.text || "";
3170
3199
  if (o.textInputId && !r) {
3171
3200
  const B = this.inputs.get(o.textInputId);
@@ -3174,24 +3203,24 @@ class ci {
3174
3203
  if (o.svgPath) {
3175
3204
  const B = o.svgPath;
3176
3205
  t.save();
3177
- const lt = ((St = e == null ? void 0 : e.fill) == null ? void 0 : St.color) || "#000000", Vt = ((ht = e == null ? void 0 : e.fill) == null ? void 0 : ht.opacity) !== void 0 ? (mt = e == null ? void 0 : e.fill) == null ? void 0 : mt.opacity : 1;
3178
- t.fillStyle = lt, t.globalAlpha *= Vt;
3179
- const Mt = new Path2D(B);
3180
- t.fill(Mt), t.restore();
3206
+ const nt = ((yt = e == null ? void 0 : e.fill) == null ? void 0 : yt.color) || "#000000", zt = ((ht = e == null ? void 0 : e.fill) == null ? void 0 : ht.opacity) !== void 0 ? (pt = e == null ? void 0 : e.fill) == null ? void 0 : pt.opacity : 1;
3207
+ t.fillStyle = nt, t.globalAlpha *= zt;
3208
+ const kt = new Path2D(B);
3209
+ t.fill(kt), t.restore();
3181
3210
  return;
3182
3211
  }
3183
3212
  let c = h || "";
3184
3213
  o.enableSegments === !0 && o.segments && Array.isArray(o.segments) && (c = o.segments.map((B) => B && B.text ? B.text : "").join(""));
3185
3214
  const g = o.textCase || "none";
3186
3215
  g === "uppercase" ? c = c.toUpperCase() : g === "lowercase" ? c = c.toLowerCase() : g === "capitalize" && (c = c.replace(/\b\w/g, (B) => B.toUpperCase()));
3187
- let f = ((rt = o.fontWeight) == null ? void 0 : rt.toString()) || "400", d = o.fontStyle || "normal";
3216
+ let f = ((ot = o.fontWeight) == null ? void 0 : ot.toString()) || "400", d = o.fontStyle || "normal";
3188
3217
  f.toLowerCase().includes("italic") && (d = "italic", f = f.replace(/italic/gi, "").trim() || "400");
3189
3218
  const u = this.mapFontWeight(f), m = Math.max(1, o.fontSize || 32);
3190
3219
  let y = o.fontFamily || "Inter";
3191
3220
  const v = ["Bold", "SemiBold", "Medium", "Regular", "Light", "Thin", "ExtraBold", "Black", "Italic"];
3192
3221
  v.forEach((B) => {
3193
- const lt = new RegExp(`[\\s-]${B}$`, "i");
3194
- lt.test(y) && (y = y.replace(lt, "").trim());
3222
+ const nt = new RegExp(`[\\s-]${B}$`, "i");
3223
+ nt.test(y) && (y = y.replace(nt, "").trim());
3195
3224
  });
3196
3225
  const S = `${o.smallCaps === !0 ? "small-caps " : ""}${d} ${u} ${m}px "${y}", sans-serif`;
3197
3226
  t.font = S;
@@ -3207,23 +3236,23 @@ class ci {
3207
3236
  M = B.unit === "PERCENT" ? B.value / 100 * m : B.value;
3208
3237
  }
3209
3238
  t.letterSpacing !== void 0 && (t.letterSpacing = `${M}px`);
3210
- const P = o.kerning || "auto", T = o.kerningValue || 0;
3211
- P === "manual" && T !== 0 && (t.letterSpacing = `${M + T}px`);
3212
- const W = o.paragraphSpacing || 0;
3239
+ const _ = o.kerning || "auto", T = o.kerningValue || 0;
3240
+ _ === "manual" && T !== 0 && (t.letterSpacing = `${M + T}px`);
3241
+ const $ = o.paragraphSpacing || 0;
3213
3242
  let k = o.lineHeight ?? 1.2;
3214
3243
  typeof k == "string" && (k = parseFloat(k)), k > 5 && m > 0 && (k = k / m);
3215
- const _ = (k || 1.2) * m, L = o.isPointText === !0 || !o.width || o.width <= 0, x = ((Lt = o.padding) == null ? void 0 : Lt.left) || ((Gt = o.padding) == null ? void 0 : Gt.right) || 0, A = L ? 1e5 : o.width && o.width > 0 ? Math.ceil(o.width) - x * 2 : 1e5;
3244
+ const E = (k || 1.2) * m, R = o.isPointText === !0 || !o.width || o.width <= 0, A = ((Et = o.padding) == null ? void 0 : Et.left) || ((Ft = o.padding) == null ? void 0 : Ft.right) || 0, O = R ? 1e5 : o.width && o.width > 0 ? Math.ceil(o.width) - A * 2 : 1e5;
3216
3245
  o.autoHeight;
3217
- const $ = ps({
3246
+ const W = ps({
3218
3247
  text: c,
3219
3248
  fontFamily: y,
3220
3249
  fontSize: m,
3221
3250
  fontWeight: u,
3222
3251
  fontStyle: d,
3223
3252
  lineHeight: k,
3224
- width: A,
3253
+ width: O,
3225
3254
  letterSpacing: M,
3226
- paragraphSpacing: W,
3255
+ paragraphSpacing: $,
3227
3256
  paragraphIndent: o.paragraphIndent || 0,
3228
3257
  segments: o.segments,
3229
3258
  enableSegments: o.enableSegments,
@@ -3231,25 +3260,25 @@ class ci {
3231
3260
  hyphenation: o.hyphenation,
3232
3261
  composer: o.composer,
3233
3262
  balanceRaggedLines: o.balanceRaggedLines
3234
- }), O = $.lines || [], z = $.maxFontSize || m, H = this.fontLeadingFactors[y] ?? 0.5, et = (_ - m) * H;
3235
- let E = $.height, F = -E / 2;
3236
- a > 0 && a > E && (I === "top" ? F = -a / 2 : I === "middle" || I === "center" ? F = -E / 2 : I === "bottom" && (F = a / 2 - E)), F += et;
3237
- let q = null, Q = 0;
3263
+ }), x = W.lines || [], Y = W.maxFontSize || m, H = this.fontLeadingFactors[y] ?? 0.5, Q = (E - m) * H;
3264
+ let P = W.height, F = -P / 2;
3265
+ a > 0 && a > P && (I === "top" ? F = -a / 2 : I === "middle" || I === "center" ? F = -P / 2 : I === "bottom" && (F = a / 2 - P)), F += Q;
3266
+ let U = null, J = 0;
3238
3267
  if (o.pathId && this.artboard) {
3239
- const B = this.artboard.objects.find((lt) => lt.id === o.pathId);
3240
- if (B && B.type === "Shape" && ((Pt = B.geometry) == null ? void 0 : Pt.type) === "Path") {
3241
- const lt = this.objectStates.get(B.id), Vt = lt != null && lt.geometry ? this.deepMerge(B.geometry, lt.geometry) : B.geometry, Mt = (lt == null ? void 0 : lt.scale_x) !== void 0 ? (B.width || 0) * lt.scale_x : B.width || 0, Tt = (lt == null ? void 0 : lt.scale_y) !== void 0 ? (B.height || 0) * lt.scale_y : B.height || 0;
3242
- q = { geo: Vt, obj: B, w: Mt, h: Tt }, Q = this.getPerimeter(Vt, Mt, Tt);
3268
+ const B = this.artboard.objects.find((nt) => nt.id === o.pathId);
3269
+ if (B && B.type === "Shape" && ((wt = B.geometry) == null ? void 0 : wt.type) === "Path") {
3270
+ const nt = this.objectStates.get(B.id), zt = nt != null && nt.geometry ? this.deepMerge(B.geometry, nt.geometry) : B.geometry, kt = (nt == null ? void 0 : nt.scale_x) !== void 0 ? (B.width || 0) * nt.scale_x : B.width || 0, _t = (nt == null ? void 0 : nt.scale_y) !== void 0 ? (B.height || 0) * nt.scale_y : B.height || 0;
3271
+ U = { geo: zt, obj: B, w: kt, h: _t }, J = this.getPerimeter(zt, kt, _t);
3243
3272
  }
3244
3273
  }
3245
- const it = (B, lt) => {
3246
- var Mt, Tt;
3247
- if (M === 0 && (!o.enableSegments || !((Mt = o.segments) != null && Mt.length))) return t.measureText(B).width;
3248
- let Vt = 0;
3249
- for (let zt = 0; zt < B.length; zt++) {
3250
- const Ut = lt + zt;
3274
+ const it = (B, nt) => {
3275
+ var kt, _t;
3276
+ if (M === 0 && (!o.enableSegments || !((kt = o.segments) != null && kt.length))) return t.measureText(B).width;
3277
+ let zt = 0;
3278
+ for (let Vt = 0; Vt < B.length; Vt++) {
3279
+ const Ut = nt + Vt;
3251
3280
  let Jt = 0;
3252
- if (o.enableSegments === !0 && ((Tt = o.segments) == null ? void 0 : Tt.length) > 0) {
3281
+ if (o.enableSegments === !0 && ((_t = o.segments) == null ? void 0 : _t.length) > 0) {
3253
3282
  let qt = 0, Qt = null;
3254
3283
  for (const oe of o.segments) {
3255
3284
  if (Ut < qt + (oe.text || "").length) {
@@ -3261,291 +3290,291 @@ class ci {
3261
3290
  if (Qt) {
3262
3291
  t.save();
3263
3292
  let oe = Qt.fontFamily || o.fontFamily || "Inter";
3264
- const jt = this.mapFontWeight((Qt.fontWeight || o.fontWeight || "400").toString()), ee = Qt.fontStyle || d, J = Qt.fontSize || m;
3265
- t.font = `${ee} ${jt} ${J}px "${oe}", sans-serif`, Jt = t.measureText(B[zt]).width, t.restore();
3293
+ const jt = this.mapFontWeight((Qt.fontWeight || o.fontWeight || "400").toString()), ee = Qt.fontStyle || d, K = Qt.fontSize || m;
3294
+ t.font = `${ee} ${jt} ${K}px "${oe}", sans-serif`, Jt = t.measureText(B[Vt]).width, t.restore();
3266
3295
  } else
3267
- Jt = t.measureText(B[zt]).width;
3296
+ Jt = t.measureText(B[Vt]).width;
3268
3297
  } else
3269
- Jt = t.measureText(B[zt]).width;
3270
- Vt += Jt + M;
3298
+ Jt = t.measureText(B[Vt]).width;
3299
+ zt += Jt + M;
3271
3300
  }
3272
- return Vt - (B.length > 0 ? M : 0);
3273
- }, dt = (B, lt, Vt, Mt, Tt) => {
3301
+ return zt - (B.length > 0 ? M : 0);
3302
+ }, dt = (B, nt, zt, kt, _t) => {
3274
3303
  var jt, ee;
3275
- const Ut = (Tt === 0 || c[Tt - 1] === `
3276
- ` || c[Tt - 1] === "\r") && o.paragraphIndent ? o.paragraphIndent : 0, Jt = (!r || l) && (s.behaviors || []).some(
3277
- (J) => J.enabled && (J.type.toString().includes("Text") || ["Typewriter", "Scramble", "Wave", "Bounce", "GlitchText", "Reveal3D", "RevealSlide", "RevealBlur"].includes(J.type))
3278
- ), qt = !o.pathId && !Jt && (o.enableSegments !== !0 || !o.segments || o.segments.length === 0), Qt = o.baselineShift || 0, oe = Vt + Qt;
3304
+ const Ut = (_t === 0 || c[_t - 1] === `
3305
+ ` || c[_t - 1] === "\r") && o.paragraphIndent ? o.paragraphIndent : 0, Jt = (!r || l) && (s.behaviors || []).some(
3306
+ (K) => K.enabled && (K.type.toString().includes("Text") || ["Typewriter", "Scramble", "Wave", "Bounce", "GlitchText", "Reveal3D", "RevealSlide", "RevealBlur"].includes(K.type))
3307
+ ), qt = !o.pathId && !Jt && (o.enableSegments !== !0 || !o.segments || o.segments.length === 0), Qt = o.baselineShift || 0, oe = zt + Qt;
3279
3308
  if (qt)
3280
- t.font = S, Mt ? t.strokeText(B, lt + Ut, oe) : t.fillText(B, lt + Ut, oe);
3309
+ t.font = S, kt ? t.strokeText(B, nt + Ut, oe) : t.fillText(B, nt + Ut, oe);
3281
3310
  else {
3282
- const J = it(B, Tt);
3283
- let ft = lt + Ut;
3284
- w === "center" ? ft -= J / 2 : w === "right" && (ft -= J);
3285
- const U = Tt + B.length >= c.length || c[Tt + B.length] === `
3286
- ` || c[Tt + B.length] === "\r";
3287
- let G = 0, K = 0;
3288
- const Z = o.justifyMinWordSpacing, At = o.justifyMaxWordSpacing;
3289
- if (w === "justify" && !U && J > 0 && !o.pathId) {
3290
- const yt = L ? J : A - x * 2 + 0, R = Math.max(0, yt - J);
3311
+ const K = it(B, _t);
3312
+ let ft = nt + Ut;
3313
+ w === "center" ? ft -= K / 2 : w === "right" && (ft -= K);
3314
+ const q = _t + B.length >= c.length || c[_t + B.length] === `
3315
+ ` || c[_t + B.length] === "\r";
3316
+ let X = 0, Z = 0;
3317
+ const j = o.justifyMinWordSpacing, Ot = o.justifyMaxWordSpacing;
3318
+ if (w === "justify" && !q && K > 0 && !o.pathId) {
3319
+ const bt = R ? K : O - A * 2 + 0, L = Math.max(0, bt - K);
3291
3320
  for (let ct = 0; ct < B.length; ct++)
3292
- B[ct] === " " && K++;
3293
- if (K > 0) {
3321
+ B[ct] === " " && Z++;
3322
+ if (Z > 0) {
3294
3323
  const ct = t.measureText(" ").width;
3295
- let Xt = Z || ct * 0.5, xt = At || ct * 2.5;
3296
- G = Math.max(0, Math.min(R / K, xt - Xt));
3324
+ let Dt = j || ct * 0.5, At = Ot || ct * 2.5;
3325
+ X = Math.max(0, Math.min(L / Z, At - Dt));
3297
3326
  }
3298
3327
  }
3299
- let Ot = o.pathOffset || 0;
3300
- o.pathId && Q > 0 && q && (w === "center" ? Ot += Q / 2 - J / 2 : w === "right" && (Ot += Q - J));
3301
- let kt = ft;
3328
+ let Rt = o.pathOffset || 0;
3329
+ o.pathId && J > 0 && U && (w === "center" ? Rt += J / 2 - K / 2 : w === "right" && (Rt += J - K));
3330
+ let Tt = ft;
3302
3331
  const Nt = r && !l ? [] : ((jt = s.behaviors) == null ? void 0 : jt.filter(
3303
- (yt) => [
3304
- Y.Typewriter,
3305
- Y.Scramble,
3306
- Y.Wave,
3307
- Y.Bounce,
3308
- Y.GlitchText,
3309
- Y.TextTrail,
3310
- Y.Reveal3D,
3311
- Y.RevealSlide,
3312
- Y.RevealBlur,
3313
- Y.TextLiquid,
3314
- Y.TextVortex,
3315
- Y.TextExplosion,
3316
- Y.TextRain,
3317
- Y.TextGravity,
3318
- Y.TextElastic,
3319
- Y.TextMatrix,
3320
- Y.TextNeon,
3321
- Y.TextGlitch3D,
3322
- Y.TextDissolve,
3323
- Y.TextOrganic,
3324
- Y.TextBreathe,
3325
- Y.TextFloral,
3326
- Y.TextSmoke,
3327
- Y.TextVariable,
3328
- Y.TextMagnet,
3329
- Y.TextSpin,
3330
- Y.TextZing,
3331
- Y.TextPerspective,
3332
- Y.TextMirror
3333
- ].includes(yt.type) && yt.enabled
3332
+ (bt) => [
3333
+ G.Typewriter,
3334
+ G.Scramble,
3335
+ G.Wave,
3336
+ G.Bounce,
3337
+ G.GlitchText,
3338
+ G.TextTrail,
3339
+ G.Reveal3D,
3340
+ G.RevealSlide,
3341
+ G.RevealBlur,
3342
+ G.TextLiquid,
3343
+ G.TextVortex,
3344
+ G.TextExplosion,
3345
+ G.TextRain,
3346
+ G.TextGravity,
3347
+ G.TextElastic,
3348
+ G.TextMatrix,
3349
+ G.TextNeon,
3350
+ G.TextGlitch3D,
3351
+ G.TextDissolve,
3352
+ G.TextOrganic,
3353
+ G.TextBreathe,
3354
+ G.TextFloral,
3355
+ G.TextSmoke,
3356
+ G.TextVariable,
3357
+ G.TextMagnet,
3358
+ G.TextSpin,
3359
+ G.TextZing,
3360
+ G.TextPerspective,
3361
+ G.TextMirror
3362
+ ].includes(bt.type) && bt.enabled
3334
3363
  )) || [];
3335
- for (let yt = 0; yt < B.length; yt++) {
3336
- let R = B[yt];
3337
- const ct = Tt + yt;
3338
- let Xt = 0, xt = 0, te = 1, $t = 1, Wt = 0, Ft = 1, ot = R;
3339
- Nt.forEach((at) => {
3340
- const st = at.settings || {}, nt = st.strength || 1, wt = Date.now();
3341
- if (at.type === Y.Typewriter)
3342
- this.currentTime * (st.speed || 1) - ct * (st.stagger || 0.05) < 0 && (Ft = 0);
3343
- else if (at.type === Y.Scramble)
3344
- Math.max(0, Math.min(1, this.currentTime / (st.duration || 1.5)) - ct * 0.02) < 1 && Math.random() < 0.3 && (ot = "$%#@!*&"[Math.floor(Math.random() * 7)]);
3345
- else if (at.type === Y.Wave)
3346
- xt += Math.sin(this.currentTime * 5 * (st.speed || 1) + ct * (st.frequency || 1)) * (st.amplitude || 20) * nt;
3347
- else if (at.type === Y.Bounce) {
3364
+ for (let bt = 0; bt < B.length; bt++) {
3365
+ let L = B[bt];
3366
+ const ct = _t + bt;
3367
+ let Dt = 0, At = 0, te = 1, Wt = 1, Yt = 0, $t = 1, rt = L;
3368
+ Nt.forEach((lt) => {
3369
+ const st = lt.settings || {}, at = st.strength || 1, Mt = Date.now();
3370
+ if (lt.type === G.Typewriter)
3371
+ this.currentTime * (st.speed || 1) - ct * (st.stagger || 0.05) < 0 && ($t = 0);
3372
+ else if (lt.type === G.Scramble)
3373
+ Math.max(0, Math.min(1, this.currentTime / (st.duration || 1.5)) - ct * 0.02) < 1 && Math.random() < 0.3 && (rt = "$%#@!*&"[Math.floor(Math.random() * 7)]);
3374
+ else if (lt.type === G.Wave)
3375
+ At += Math.sin(this.currentTime * 5 * (st.speed || 1) + ct * (st.frequency || 1)) * (st.amplitude || 20) * at;
3376
+ else if (lt.type === G.Bounce) {
3348
3377
  const V = Math.max(0, this.currentTime % 2 - ct * (st.stagger || 0.1));
3349
- V < 1 && (xt -= Math.abs(Math.sin(V * Math.PI)) * (st.height || 50) * nt);
3350
- } else if (at.type === Y.TextTrail) {
3378
+ V < 1 && (At -= Math.abs(Math.sin(V * Math.PI)) * (st.height || 50) * at);
3379
+ } else if (lt.type === G.TextTrail) {
3351
3380
  const V = this.pointerHistory[Math.max(0, this.pointerHistory.length - 1 - ct * (st.delay || 5))];
3352
- V && (Xt += (V.x - (i.x + kt)) * nt * 0.2, xt += (V.y - (i.y + Vt + xt)) * nt * 0.2);
3353
- } else if (at.type === Y.Reveal3D) {
3381
+ V && (Dt += (V.x - (i.x + Tt)) * at * 0.2, At += (V.y - (i.y + zt + At)) * at * 0.2);
3382
+ } else if (lt.type === G.Reveal3D) {
3354
3383
  const V = Math.max(0, Math.min(1, this.currentTime * (st.speed || 1) - ct * (st.stagger || 0.1)));
3355
- te *= V, $t *= V, Ft = V;
3356
- } else if (at.type === Y.RevealSlide) {
3357
- const V = Math.max(0, Math.min(1, this.currentTime * 1.5 - ct * 0.05)), pt = (1 - V) * (st.distance || 40) * nt, ut = st.direction || "up";
3358
- ut === "up" ? xt -= pt : ut === "down" ? xt += pt : ut === "left" ? Xt -= pt : ut === "right" && (Xt += pt), Ft = V;
3359
- } else if (at.type === Y.RevealBlur) {
3384
+ te *= V, Wt *= V, $t = V;
3385
+ } else if (lt.type === G.RevealSlide) {
3386
+ const V = Math.max(0, Math.min(1, this.currentTime * 1.5 - ct * 0.05)), ut = (1 - V) * (st.distance || 40) * at, gt = st.direction || "up";
3387
+ gt === "up" ? At -= ut : gt === "down" ? At += ut : gt === "left" ? Dt -= ut : gt === "right" && (Dt += ut), $t = V;
3388
+ } else if (lt.type === G.RevealBlur) {
3360
3389
  const V = Math.max(0, Math.min(1, this.currentTime * 1.2 - ct * 0.1));
3361
- Ft = V, Xt += (1 - V) * 5;
3362
- } else if (at.type === Y.TextLiquid) {
3363
- const V = Math.max(0, Math.sin(wt * 1e-3 * (st.speed || 1) + ct * 0.5));
3364
- xt += V * (st.amplitude || 10) * nt, $t *= 1 + V * 0.2;
3365
- } else if (at.type === Y.TextVortex) {
3366
- const V = wt * 2e-3 * (st.speed || 1) + ct * 0.2, pt = (1 - (Math.sin(wt * 1e-3) * 0.5 + 0.5)) * (st.radius || 50);
3367
- Xt += Math.cos(V) * pt * nt, xt += Math.sin(V) * pt * nt;
3368
- } else if (at.type === Y.TextExplosion) {
3369
- const V = st.force || 1, pt = this.currentTime % 2;
3370
- if (pt < 1) {
3371
- const ut = (ct / B.length - 0.5) * Math.PI * 2, ce = pt * 100 * V;
3372
- Xt += Math.cos(ut) * ce * nt, xt += Math.sin(ut) * ce * nt, Ft = 1 - pt;
3390
+ $t = V, Dt += (1 - V) * 5;
3391
+ } else if (lt.type === G.TextLiquid) {
3392
+ const V = Math.max(0, Math.sin(Mt * 1e-3 * (st.speed || 1) + ct * 0.5));
3393
+ At += V * (st.amplitude || 10) * at, Wt *= 1 + V * 0.2;
3394
+ } else if (lt.type === G.TextVortex) {
3395
+ const V = Mt * 2e-3 * (st.speed || 1) + ct * 0.2, ut = (1 - (Math.sin(Mt * 1e-3) * 0.5 + 0.5)) * (st.radius || 50);
3396
+ Dt += Math.cos(V) * ut * at, At += Math.sin(V) * ut * at;
3397
+ } else if (lt.type === G.TextExplosion) {
3398
+ const V = st.force || 1, ut = this.currentTime % 2;
3399
+ if (ut < 1) {
3400
+ const gt = (ct / B.length - 0.5) * Math.PI * 2, ce = ut * 100 * V;
3401
+ Dt += Math.cos(gt) * ce * at, At += Math.sin(gt) * ce * at, $t = 1 - ut;
3373
3402
  }
3374
- } else if (at.type === Y.TextRain) {
3375
- const V = st.speed || 1, pt = st.height || 100, ut = (wt * 1e-3 * V + ct * 0.1) % 1;
3376
- xt -= (1 - ut) * pt * nt, Ft = ut > 0.1 ? 1 : ut * 10;
3377
- } else if (at.type === Y.TextGravity) {
3378
- const V = st.gravity || 9.8, pt = this.currentTime % 3 / 3, ut = 0.5 * V * Math.pow(pt * 10, 2);
3379
- ut < 100 ? xt += ut * nt : xt += 100 * nt;
3380
- } else if (at.type === Y.TextMatrix) {
3403
+ } else if (lt.type === G.TextRain) {
3404
+ const V = st.speed || 1, ut = st.height || 100, gt = (Mt * 1e-3 * V + ct * 0.1) % 1;
3405
+ At -= (1 - gt) * ut * at, $t = gt > 0.1 ? 1 : gt * 10;
3406
+ } else if (lt.type === G.TextGravity) {
3407
+ const V = st.gravity || 9.8, ut = this.currentTime % 3 / 3, gt = 0.5 * V * Math.pow(ut * 10, 2);
3408
+ gt < 100 ? At += gt * at : At += 100 * at;
3409
+ } else if (lt.type === G.TextMatrix) {
3381
3410
  const V = st.speed || 1;
3382
3411
  if (Math.random() < 0.1 * V) {
3383
- const ut = "0123456789ABCDEF!@#$%^&*";
3384
- ot = ut[Math.floor(Math.random() * ut.length)];
3412
+ const gt = "0123456789ABCDEF!@#$%^&*";
3413
+ rt = gt[Math.floor(Math.random() * gt.length)];
3385
3414
  }
3386
- Ft = 0.3 + (Math.sin(wt * 0.01 * V + ct) + 1) / 2 * 0.7;
3387
- } else if (at.type === Y.TextNeon) {
3415
+ $t = 0.3 + (Math.sin(Mt * 0.01 * V + ct) + 1) / 2 * 0.7;
3416
+ } else if (lt.type === G.TextNeon) {
3388
3417
  const V = Math.random() > 0.95 ? 0.5 : 1;
3389
- Ft = (0.7 + (Math.sin(wt * 5e-3) + 1) / 2 * 0.3) * V;
3390
- } else if (at.type === Y.TextDissolve)
3391
- Math.sin(ct * 1.5 + wt * 2e-3 * (st.speed || 1)) > 0.5 && (Ft = 0);
3392
- else if (at.type === Y.TextOrganic) {
3393
- const V = st.speed || 1, pt = st.amplitude || 10;
3394
- Xt += Math.sin(wt * 2e-3 * V + ct) * pt * nt, xt += Math.cos(wt * 15e-4 * V + ct * 0.7) * pt * nt;
3395
- } else if (at.type === Y.TextBreathe) {
3396
- const pt = 1 + (Math.sin(wt * 3e-3 + ct * 0.2) + 1) / 2 * 0.2 * nt;
3397
- te *= pt, $t *= pt;
3398
- } else if (at.type === Y.TextSpin) {
3418
+ $t = (0.7 + (Math.sin(Mt * 5e-3) + 1) / 2 * 0.3) * V;
3419
+ } else if (lt.type === G.TextDissolve)
3420
+ Math.sin(ct * 1.5 + Mt * 2e-3 * (st.speed || 1)) > 0.5 && ($t = 0);
3421
+ else if (lt.type === G.TextOrganic) {
3422
+ const V = st.speed || 1, ut = st.amplitude || 10;
3423
+ Dt += Math.sin(Mt * 2e-3 * V + ct) * ut * at, At += Math.cos(Mt * 15e-4 * V + ct * 0.7) * ut * at;
3424
+ } else if (lt.type === G.TextBreathe) {
3425
+ const ut = 1 + (Math.sin(Mt * 3e-3 + ct * 0.2) + 1) / 2 * 0.2 * at;
3426
+ te *= ut, Wt *= ut;
3427
+ } else if (lt.type === G.TextSpin) {
3399
3428
  const V = st.speed || 1;
3400
- Wt += wt * 0.01 * V + ct;
3401
- } else if (at.type === Y.TextMagnet) {
3429
+ Yt += Mt * 0.01 * V + ct;
3430
+ } else if (lt.type === G.TextMagnet) {
3402
3431
  const V = this.pointerHistory[this.pointerHistory.length - 1];
3403
3432
  if (V) {
3404
- const pt = V.x - (i.x + kt), ut = V.y - (i.y + Vt);
3405
- Wt = Math.atan2(ut, pt);
3433
+ const ut = V.x - (i.x + Tt), gt = V.y - (i.y + zt);
3434
+ Yt = Math.atan2(gt, ut);
3406
3435
  }
3407
- } else if (at.type === Y.TextPerspective) {
3408
- const V = B.length / 2, pt = (ct - V) / V, ut = 1 - Math.abs(pt) * 0.3 * nt;
3409
- te *= ut, $t *= ut, Xt += pt * 20 * nt;
3410
- } else if (at.type === Y.TextMirror)
3411
- Ft *= 0.8;
3412
- else if (at.type === Y.TextFloral) {
3413
- const V = st.speed || 1, pt = st.stagger || 0.1, ut = (wt * 1e-3 * V + ct * pt) % 2;
3414
- ut < 1 && (te *= ut, $t *= ut, Wt += ut * Math.PI);
3415
- } else if (at.type === Y.TextSmoke) {
3416
- const V = st.speed || 1, pt = st.height || 50, ut = (wt * 5e-4 * V + ct * 0.2) % 1;
3417
- xt -= ut * pt * nt, Xt += Math.sin(wt * 2e-3 + ct) * 5 * nt, Ft = 1 - ut;
3418
- } else if (at.type === Y.TextVariable) {
3419
- const V = st.speed || 1, pt = st.intensity || 1.5, ut = (Math.sin(wt * 4e-3 * V + ct * 0.3) + 1) / 2;
3420
- te *= 1 + ut * (pt - 1) * nt;
3421
- } else if (at.type === Y.TextZing) {
3422
- const V = st.speed || 2, pt = st.distance || 100, ut = (wt * 2e-3 * V + ct * 0.05) % 1;
3423
- Xt += (1 - ut) * pt * nt, Ft = ut;
3424
- } else if (at.type === Y.TextElastic) {
3425
- const V = st.stiffness || 0.2, pt = st.damping || 0.1, ut = Math.sin(wt * 0.01) * Math.exp(-wt * 1e-3 * pt);
3426
- $t *= 1 + ut * V * nt;
3427
- } else if (at.type === Y.TextGlitch3D) {
3436
+ } else if (lt.type === G.TextPerspective) {
3437
+ const V = B.length / 2, ut = (ct - V) / V, gt = 1 - Math.abs(ut) * 0.3 * at;
3438
+ te *= gt, Wt *= gt, Dt += ut * 20 * at;
3439
+ } else if (lt.type === G.TextMirror)
3440
+ $t *= 0.8;
3441
+ else if (lt.type === G.TextFloral) {
3442
+ const V = st.speed || 1, ut = st.stagger || 0.1, gt = (Mt * 1e-3 * V + ct * ut) % 2;
3443
+ gt < 1 && (te *= gt, Wt *= gt, Yt += gt * Math.PI);
3444
+ } else if (lt.type === G.TextSmoke) {
3445
+ const V = st.speed || 1, ut = st.height || 50, gt = (Mt * 5e-4 * V + ct * 0.2) % 1;
3446
+ At -= gt * ut * at, Dt += Math.sin(Mt * 2e-3 + ct) * 5 * at, $t = 1 - gt;
3447
+ } else if (lt.type === G.TextVariable) {
3448
+ const V = st.speed || 1, ut = st.intensity || 1.5, gt = (Math.sin(Mt * 4e-3 * V + ct * 0.3) + 1) / 2;
3449
+ te *= 1 + gt * (ut - 1) * at;
3450
+ } else if (lt.type === G.TextZing) {
3451
+ const V = st.speed || 2, ut = st.distance || 100, gt = (Mt * 2e-3 * V + ct * 0.05) % 1;
3452
+ Dt += (1 - gt) * ut * at, $t = gt;
3453
+ } else if (lt.type === G.TextElastic) {
3454
+ const V = st.stiffness || 0.2, ut = st.damping || 0.1, gt = Math.sin(Mt * 0.01) * Math.exp(-Mt * 1e-3 * ut);
3455
+ Wt *= 1 + gt * V * at;
3456
+ } else if (lt.type === G.TextGlitch3D) {
3428
3457
  const V = st.intensity || 5;
3429
- Math.random() < 0.2 && (Xt += (Math.random() - 0.5) * V, xt += (Math.random() - 0.5) * V, Ft = 0.8);
3430
- } else if (at.type === Y.GlitchText) {
3458
+ Math.random() < 0.2 && (Dt += (Math.random() - 0.5) * V, At += (Math.random() - 0.5) * V, $t = 0.8);
3459
+ } else if (lt.type === G.GlitchText) {
3431
3460
  const V = st.intensity || 5;
3432
- Math.random() < 0.1 && (Xt += (Math.random() - 0.5) * V, xt += (Math.random() - 0.5) * V, Math.random() < 0.05 && (Ft = 0.5));
3461
+ Math.random() < 0.1 && (Dt += (Math.random() - 0.5) * V, At += (Math.random() - 0.5) * V, Math.random() < 0.05 && ($t = 0.5));
3433
3462
  }
3434
3463
  });
3435
- let It = null, bt = o.textDecoration || "none", vt = m;
3464
+ let It = null, vt = o.textDecoration || "none", Ct = m;
3436
3465
  if (o.enableSegments === !0 && ((ee = o.segments) == null ? void 0 : ee.length) > 0) {
3437
- let at = 0, st = null;
3438
- for (const nt of o.segments) {
3439
- if (ct < at + (nt.text || "").length) {
3440
- st = nt;
3466
+ let lt = 0, st = null;
3467
+ for (const at of o.segments) {
3468
+ if (ct < lt + (at.text || "").length) {
3469
+ st = at;
3441
3470
  break;
3442
3471
  }
3443
- at += (nt.text || "").length;
3472
+ lt += (at.text || "").length;
3444
3473
  }
3445
3474
  if (st) {
3446
- let nt = st.fontFamily || o.fontFamily || "Inter";
3447
- v.forEach((pt) => {
3448
- const ut = new RegExp(`[\\s-]${pt}$`, "i");
3449
- ut.test(nt) && (nt = nt.replace(ut, "").trim());
3475
+ let at = st.fontFamily || o.fontFamily || "Inter";
3476
+ v.forEach((ut) => {
3477
+ const gt = new RegExp(`[\\s-]${ut}$`, "i");
3478
+ gt.test(at) && (at = at.replace(gt, "").trim());
3450
3479
  });
3451
- const wt = this.mapFontWeight((st.fontWeight || o.fontWeight || "400").toString()), V = st.fontStyle || d;
3452
- vt = st.fontSize || m, t.font = `${V} ${wt} ${vt}px "${nt}", sans-serif`, st.fill && (It = st.fill), st.textDecoration && (bt = st.textDecoration), vt < z && (xt += (z - vt) * 0.85);
3480
+ const Mt = this.mapFontWeight((st.fontWeight || o.fontWeight || "400").toString()), V = st.fontStyle || d;
3481
+ Ct = st.fontSize || m, t.font = `${V} ${Mt} ${Ct}px "${at}", sans-serif`, st.fill && (It = st.fill), st.textDecoration && (vt = st.textDecoration), Ct < Y && (At += (Y - Ct) * 0.85);
3453
3482
  }
3454
3483
  } else
3455
3484
  t.font = S;
3456
- const gt = t.globalAlpha;
3457
- t.globalAlpha *= Ft, t.save();
3458
- const Rt = t.measureText(ot).width;
3459
- if (q && Q > 0) {
3460
- const at = kt - ft + Rt / 2, nt = (Ot + at) / Q, wt = this.getPointOnPath(q.geo, q.w, q.h, Math.abs(nt % 1)), V = wt.angle, pt = Vt + xt + (o.pathOffsetY || 0), ut = o.pathSide === "right" ? -1 : 1, ce = Math.cos(V + Math.PI / 2) * pt * ut, me = Math.sin(V + Math.PI / 2) * pt * ut;
3461
- t.translate(wt.x + ce + Xt, wt.y + me), t.rotate(V + Wt + (ut === -1 ? Math.PI : 0));
3485
+ const mt = t.globalAlpha;
3486
+ t.globalAlpha *= $t, t.save();
3487
+ const Lt = t.measureText(rt).width;
3488
+ if (U && J > 0) {
3489
+ const lt = Tt - ft + Lt / 2, at = (Rt + lt) / J, Mt = this.getPointOnPath(U.geo, U.w, U.h, Math.abs(at % 1)), V = Mt.angle, ut = zt + At + (o.pathOffsetY || 0), gt = o.pathSide === "right" ? -1 : 1, ce = Math.cos(V + Math.PI / 2) * ut * gt, me = Math.sin(V + Math.PI / 2) * ut * gt;
3490
+ t.translate(Mt.x + ce + Dt, Mt.y + me), t.rotate(V + Yt + (gt === -1 ? Math.PI : 0));
3462
3491
  } else
3463
- t.translate(kt + Xt + Rt / 2, Vt + xt), Wt !== 0 && t.rotate(Wt);
3464
- if (t.scale(te, $t), It && !r && !l) {
3465
- const at = this.createCanvasFill(t, It, n, a);
3466
- t.fillStyle = at || It.color || "#000000";
3492
+ t.translate(Tt + Dt + Lt / 2, zt + At), Yt !== 0 && t.rotate(Yt);
3493
+ if (t.scale(te, Wt), It && !r && !l) {
3494
+ const lt = this.createCanvasFill(t, It, n, a);
3495
+ t.fillStyle = lt || It.color || "#000000";
3467
3496
  } else if (!r && !l) {
3468
- const at = this.createCanvasFill(t, e.fill, n, a);
3469
- t.fillStyle = at || e.fill.color || "#000000";
3497
+ const lt = this.createCanvasFill(t, e.fill, n, a);
3498
+ t.fillStyle = lt || e.fill.color || "#000000";
3470
3499
  }
3471
- if (Ft > 0)
3500
+ if ($t > 0)
3472
3501
  if (r || l) {
3473
- const at = l ? "#000000" : this.createCanvasFill(t, e.fill, n, a);
3474
- t.fillStyle = at || e.fill.color || "#ffffff", t.fillText(ot, -Rt / 2, 0);
3475
- } else Mt ? t.strokeText(ot, -Rt / 2, 0) : t.fillText(ot, -Rt / 2, 0);
3476
- bt !== "none" && !r && this.drawTextDecoration(t, bt, 0, 0, Rt, vt), t.restore(), t.globalAlpha = gt, w === "justify" && G > 0 && ot === " " && !U ? kt += Rt + M + G : kt += Rt + M;
3502
+ const lt = l ? "#000000" : this.createCanvasFill(t, e.fill, n, a);
3503
+ t.fillStyle = lt || e.fill.color || "#ffffff", t.fillText(rt, -Lt / 2, 0);
3504
+ } else kt ? t.strokeText(rt, -Lt / 2, 0) : t.fillText(rt, -Lt / 2, 0);
3505
+ vt !== "none" && !r && this.drawTextDecoration(t, vt, 0, 0, Lt, Ct), t.restore(), t.globalAlpha = mt, w === "justify" && X > 0 && rt === " " && !q ? Tt += Lt + M + X : Tt += Lt + M;
3477
3506
  }
3478
3507
  }
3479
3508
  };
3480
3509
  if (r) {
3481
- let B = 0, lt = F;
3482
- (O || []).forEach((Vt) => {
3483
- const Mt = Vt.text || "", Tt = c.indexOf(Mt, B);
3484
- Tt !== -1 && (B = Tt);
3485
- let zt = -n / 2;
3486
- w === "center" ? zt = 0 : w === "right" && (zt = n / 2), dt(Mt, zt, lt, !1, B), B += Mt.length, lt += _;
3510
+ let B = 0, nt = F;
3511
+ (x || []).forEach((zt) => {
3512
+ const kt = zt.text || "", _t = c.indexOf(kt, B);
3513
+ _t !== -1 && (B = _t);
3514
+ let Vt = -n / 2;
3515
+ w === "center" ? Vt = 0 : w === "right" && (Vt = n / 2), dt(kt, Vt, nt, !1, B), B += kt.length, nt += E;
3487
3516
  });
3488
3517
  } else if (l) {
3489
- let B = 0, lt = F;
3490
- (O || []).forEach((Vt) => {
3491
- const Mt = Vt.text || "";
3492
- let Tt = -n / 2;
3493
- w === "center" ? Tt = 0 : w === "right" && (Tt = n / 2), dt(Mt, Tt, lt, !1, B), B += Mt.length, B < c.length && (c[B] === `
3518
+ let B = 0, nt = F;
3519
+ (x || []).forEach((zt) => {
3520
+ const kt = zt.text || "";
3521
+ let _t = -n / 2;
3522
+ w === "center" ? _t = 0 : w === "right" && (_t = n / 2), dt(kt, _t, nt, !1, B), B += kt.length, B < c.length && (c[B] === `
3494
3523
  ` || c[B] === "\r") && (B++, c[B - 1] === "\r" && c[B] === `
3495
- ` && B++), lt += _;
3524
+ ` && B++), nt += E;
3496
3525
  });
3497
3526
  } else {
3498
3527
  if (e.fill) {
3499
- const lt = t.globalAlpha, Vt = this.createCanvasFill(t, e.fill, n, a);
3500
- t.fillStyle = Vt || e.fill.color || "#000000", t.globalAlpha = lt * this.normalizeOpacity(e.fill.opacity ?? 100);
3501
- const Mt = $.fullText || (o.enableSegments ? (o.segments || []).map((Ut) => {
3528
+ const nt = t.globalAlpha, zt = this.createCanvasFill(t, e.fill, n, a);
3529
+ t.fillStyle = zt || e.fill.color || "#000000", t.globalAlpha = nt * this.normalizeOpacity(e.fill.opacity ?? 100);
3530
+ const kt = W.fullText || (o.enableSegments ? (o.segments || []).map((Ut) => {
3502
3531
  let Jt = Ut.text || "";
3503
3532
  const qt = Ut.textCase || o.textCase || "none";
3504
3533
  return qt === "uppercase" ? Jt.toUpperCase() : qt === "lowercase" ? Jt.toLowerCase() : qt === "capitalize" ? Jt.replace(/\b\w/g, (Qt) => Qt.toUpperCase()) : Jt;
3505
3534
  }).join("") : c);
3506
- let Tt = 0, zt = F;
3507
- (O || []).forEach((Ut) => {
3535
+ let _t = 0, Vt = F;
3536
+ (x || []).forEach((Ut) => {
3508
3537
  const Jt = Ut.text || "";
3509
3538
  let qt = -n / 2;
3510
- w === "center" ? qt = 0 : w === "right" && (qt = n / 2), dt(Jt, qt, zt, !1, Tt), Tt += Jt.length, zt += _, Tt < Mt.length && (Mt[Tt] === `
3511
- ` || Mt[Tt] === "\r") && (W > 0 && (zt += W), Tt++, Mt[Tt - 1] === "\r" && Mt[Tt] === `
3512
- ` && Tt++);
3513
- }), t.globalAlpha = lt;
3539
+ w === "center" ? qt = 0 : w === "right" && (qt = n / 2), dt(Jt, qt, Vt, !1, _t), _t += Jt.length, Vt += E, _t < kt.length && (kt[_t] === `
3540
+ ` || kt[_t] === "\r") && ($ > 0 && (Vt += $), _t++, kt[_t - 1] === "\r" && kt[_t] === `
3541
+ ` && _t++);
3542
+ }), t.globalAlpha = nt;
3514
3543
  }
3515
3544
  const B = o.paragraphRule;
3516
- if (B && (((Dt = B.top) == null ? void 0 : Dt.width) > 0 || ((Yt = B.bottom) == null ? void 0 : Yt.width) > 0)) {
3517
- let lt = 0;
3518
- (O || []).forEach((Vt, Mt) => {
3545
+ if (B && (((Xt = B.top) == null ? void 0 : Xt.width) > 0 || ((Bt = B.bottom) == null ? void 0 : Bt.width) > 0)) {
3546
+ let nt = 0;
3547
+ (x || []).forEach((zt, kt) => {
3519
3548
  var Ut, Jt;
3520
- const zt = lt === 0 || lt < c.length && (c[lt] === `
3521
- ` || c[lt] === "\r");
3522
- if (zt && Mt > 0 && lt++, zt) {
3549
+ const Vt = nt === 0 || nt < c.length && (c[nt] === `
3550
+ ` || c[nt] === "\r");
3551
+ if (Vt && kt > 0 && nt++, Vt) {
3523
3552
  if (((Ut = B.top) == null ? void 0 : Ut.width) > 0) {
3524
- const qt = F + Mt * _ - B.top.offset;
3553
+ const qt = F + kt * E - B.top.offset;
3525
3554
  t.strokeStyle = B.top.color || "#000000", t.lineWidth = B.top.width, t.beginPath();
3526
- const Qt = -n / 2 + _ * 0.2;
3527
- t.moveTo(Qt, qt), t.lineTo(n / 2 - _ * 0.2, qt), t.stroke();
3555
+ const Qt = -n / 2 + E * 0.2;
3556
+ t.moveTo(Qt, qt), t.lineTo(n / 2 - E * 0.2, qt), t.stroke();
3528
3557
  }
3529
3558
  if (((Jt = B.bottom) == null ? void 0 : Jt.width) > 0) {
3530
- const qt = F + (Mt + 1) * _ - B.bottom.offset;
3559
+ const qt = F + (kt + 1) * E - B.bottom.offset;
3531
3560
  t.strokeStyle = B.bottom.color || "#000000", t.lineWidth = B.bottom.width, t.beginPath();
3532
- const Qt = -n / 2 + _ * 0.2;
3533
- t.moveTo(Qt, qt), t.lineTo(n / 2 - _ * 0.2, qt), t.stroke();
3561
+ const Qt = -n / 2 + E * 0.2;
3562
+ t.moveTo(Qt, qt), t.lineTo(n / 2 - E * 0.2, qt), t.stroke();
3534
3563
  }
3535
3564
  }
3536
- lt += (Vt.text || "").length;
3565
+ nt += (zt.text || "").length;
3537
3566
  });
3538
3567
  }
3539
3568
  if (e.stroke && e.stroke.width > 0) {
3540
- const lt = t.globalAlpha;
3541
- e.fill && e.fill.type !== "None" && e.fill.isEnabled !== !1 && e.fill.opacity !== 0 && e.fill.color !== "transparent" && e.fill.color !== "rgba(0,0,0,0)" && (t.shadowColor = "transparent", t.shadowBlur = 0, t.shadowOffsetX = 0, t.shadowOffsetY = 0), t.strokeStyle = e.stroke.color, t.lineWidth = e.stroke.width, t.globalAlpha = lt * this.normalizeOpacity(e.stroke.opacity ?? 100);
3542
- let Mt = 0, Tt = F;
3543
- (O || []).forEach((zt) => {
3569
+ const nt = t.globalAlpha;
3570
+ e.fill && e.fill.type !== "None" && e.fill.isEnabled !== !1 && e.fill.opacity !== 0 && e.fill.color !== "transparent" && e.fill.color !== "rgba(0,0,0,0)" && (t.shadowColor = "transparent", t.shadowBlur = 0, t.shadowOffsetX = 0, t.shadowOffsetY = 0), t.strokeStyle = e.stroke.color, t.lineWidth = e.stroke.width, t.globalAlpha = nt * this.normalizeOpacity(e.stroke.opacity ?? 100);
3571
+ let kt = 0, _t = F;
3572
+ (x || []).forEach((Vt) => {
3544
3573
  let Ut = -n / 2;
3545
- w === "center" ? Ut = 0 : w === "right" && (Ut = n / 2), dt(zt.text, Ut, Tt, !0, Mt), Mt += (zt.text || "").length, Tt += _, Mt < c.length && (c[Mt] === `
3546
- ` || c[Mt] === "\r") && (W > 0 && (Tt += W), Mt++, c[Mt - 1] === "\r" && c[Mt] === `
3547
- ` && Mt++);
3548
- }), t.globalAlpha = lt;
3574
+ w === "center" ? Ut = 0 : w === "right" && (Ut = n / 2), dt(Vt.text, Ut, _t, !0, kt), kt += (Vt.text || "").length, _t += E, kt < c.length && (c[kt] === `
3575
+ ` || c[kt] === "\r") && ($ > 0 && (_t += $), kt++, c[kt - 1] === "\r" && c[kt] === `
3576
+ ` && kt++);
3577
+ }), t.globalAlpha = nt;
3549
3578
  }
3550
3579
  }
3551
3580
  }
@@ -3655,12 +3684,12 @@ class ci {
3655
3684
  if (t <= 0) return 0;
3656
3685
  let c = 0, g = s, f = o;
3657
3686
  for (let d = 1; d <= h; d++) {
3658
- const u = d / h, m = 1 - u, y = u * u, v = m * m, b = v * m, C = y * u, S = b * s + 3 * v * u * e + 3 * m * y * n + C * r, I = b * o + 3 * v * u * i + 3 * m * y * a + C * l, w = S - g, M = I - f, P = Math.sqrt(w * w + M * M);
3659
- if (c + P >= t) {
3660
- const T = t - c, W = P === 0 ? 0 : T / P;
3661
- return (d - 1 + W) / h;
3687
+ const u = d / h, m = 1 - u, y = u * u, v = m * m, b = v * m, C = y * u, S = b * s + 3 * v * u * e + 3 * m * y * n + C * r, I = b * o + 3 * v * u * i + 3 * m * y * a + C * l, w = S - g, M = I - f, _ = Math.sqrt(w * w + M * M);
3688
+ if (c + _ >= t) {
3689
+ const T = t - c, $ = _ === 0 ? 0 : T / _;
3690
+ return (d - 1 + $) / h;
3662
3691
  }
3663
- c += P, g = S, f = I;
3692
+ c += _, g = S, f = I;
3664
3693
  }
3665
3694
  return 1;
3666
3695
  }
@@ -3694,8 +3723,8 @@ class ci {
3694
3723
  return w = this.getBezierTAtLength(f - d, b.x, b.y, b.out_x ?? b.x, b.out_y ?? b.y, C.in_x ?? C.x, C.in_y ?? C.y, C.x, C.y, 20), this.getBezierPointAndAngle(w, b, C, h, c);
3695
3724
  {
3696
3725
  w = S === 0 ? 0 : (f - d) / S;
3697
- const M = b.x + (C.x - b.x) * w - h, P = b.y + (C.y - b.y) * w - c, T = Math.atan2(C.y - b.y, C.x - b.x);
3698
- return { x: M, y: P, angle: T };
3726
+ const M = b.x + (C.x - b.x) * w - h, _ = b.y + (C.y - b.y) * w - c, T = Math.atan2(C.y - b.y, C.x - b.x);
3727
+ return { x: M, y: _, angle: T };
3699
3728
  }
3700
3729
  }
3701
3730
  d += S;
@@ -3804,8 +3833,8 @@ class ci {
3804
3833
  const I = b.getContext("2d");
3805
3834
  if (I) {
3806
3835
  I.imageSmoothingEnabled = !1;
3807
- const w = t.getTransform(), M = w.e - e / 2, P = w.f - i / 2;
3808
- I.drawImage(t.canvas, M, P, e, i, 0, 0, C, S), t.imageSmoothingEnabled = !1, t.drawImage(b, 0, 0, C, S, -e / 2, -i / 2, e, i), t.imageSmoothingEnabled = !0;
3836
+ const w = t.getTransform(), M = w.e - e / 2, _ = w.f - i / 2;
3837
+ I.drawImage(t.canvas, M, _, e, i, 0, 0, C, S), t.imageSmoothingEnabled = !1, t.drawImage(b, 0, 0, C, S, -e / 2, -i / 2, e, i), t.imageSmoothingEnabled = !0;
3809
3838
  }
3810
3839
  } else if (l === "glitch") {
3811
3840
  const v = this.currentTime * c, b = r.chaosAmount ?? 0.2, C = Math.max(3, Math.floor(8 * h)), S = h * e * 0.15;
@@ -3814,10 +3843,10 @@ class ci {
3814
3843
  t.fillStyle = "rgba(255, 0, 0, 0.4)", t.fillRect(-e / 2 + I, -i / 2, e, i), t.fillStyle = "rgba(0, 255, 255, 0.4)", t.fillRect(-e / 2 - I, -i / 2, e, i), t.globalCompositeOperation = "source-over", t.globalAlpha = 1;
3815
3844
  const w = i / C;
3816
3845
  for (let M = 0; M < C; M++) {
3817
- const P = Math.sin(M * 127.1 + v * 311.7 * c) * 43758.5, T = P - Math.floor(P);
3846
+ const _ = Math.sin(M * 127.1 + v * 311.7 * c) * 43758.5, T = _ - Math.floor(_);
3818
3847
  if (T > 1 - b) {
3819
- const W = (T - (1 - b)) / b * S * (Math.random() > 0.5 ? 1 : -1), k = -i / 2 + M * w, _ = t.getTransform(), L = _.e - e / 2 + W, x = _.f + k;
3820
- t.save(), t.beginPath(), t.rect(-e / 2, k, e, w), t.clip(), t.globalAlpha = 0.8, t.drawImage(t.canvas, L, x, e, w, -e / 2 + W, k, e, w), t.restore();
3848
+ const $ = (T - (1 - b)) / b * S * (Math.random() > 0.5 ? 1 : -1), k = -i / 2 + M * w, E = t.getTransform(), R = E.e - e / 2 + $, A = E.f + k;
3849
+ t.save(), t.beginPath(), t.rect(-e / 2, k, e, w), t.clip(), t.globalAlpha = 0.8, t.drawImage(t.canvas, R, A, e, w, -e / 2 + $, k, e, w), t.restore();
3821
3850
  }
3822
3851
  }
3823
3852
  }
@@ -3980,141 +4009,141 @@ class ci {
3980
4009
  }
3981
4010
  }
3982
4011
  renderInputBox(t, s) {
3983
- var dt, St;
3984
- const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((dt = s.geometry) == null ? void 0 : dt.width) || 250, n = ((St = s.geometry) == null ? void 0 : St.height) || 45, a = this.focusedId === s.id, r = this.lastHoveredObjectId === s.id, l = e.previewState || "default", h = l !== "default" ? l : a ? "focused" : r ? "hovered" : "default", c = e.label || { visible: !0, text: "Label" }, g = e.helperText || { visible: !1, text: "Helper text" }, f = e.leftIcon || { visible: !1 }, d = e.rightIcon || { visible: !1 }, u = e.multiline === !0, m = e.corner_radius ?? 8, y = e.corners || { tl: m, tr: m, bl: m, br: m }, v = [y.tl, y.tr, y.br, y.bl];
4012
+ var dt, yt;
4013
+ const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((dt = s.geometry) == null ? void 0 : dt.width) || 250, n = ((yt = s.geometry) == null ? void 0 : yt.height) || 45, a = this.focusedId === s.id, r = this.lastHoveredObjectId === s.id, l = e.previewState || "default", h = l !== "default" ? l : a ? "focused" : r ? "hovered" : "default", c = e.label || { visible: !0, text: "Label" }, g = e.helperText || { visible: !1, text: "Helper text" }, f = e.leftIcon || { visible: !1 }, d = e.rightIcon || { visible: !1 }, u = e.multiline === !0, m = e.corner_radius ?? 8, y = e.corners || { tl: m, tr: m, bl: m, br: m }, v = [y.tl, y.tr, y.br, y.bl];
3985
4014
  let b = e.backgroundColor || "rgba(31, 41, 55, 1)", C = e.borderColor || "rgba(55, 65, 81, 1)", S = e.borderWidth ?? 1.5, I = e.color || "#ffffff", w = e.placeholderColor || "rgba(156, 163, 175, 1)", M = e.fontSize || 14;
3986
- const P = `${h}Style`, T = e[P];
4015
+ const _ = `${h}Style`, T = e[_];
3987
4016
  T ? (T.backgroundColor !== void 0 && (b = T.backgroundColor), T.borderColor !== void 0 && (C = T.borderColor), T.borderWidth !== void 0 && (S = T.borderWidth), T.color !== void 0 && (I = T.color), T.placeholderColor !== void 0 && (w = T.placeholderColor), T.fontSize !== void 0 && (M = T.fontSize)) : h === "focused" ? (C = e.focusBorderColor || "rgba(59, 130, 246, 1)", S = Math.max(S, 2)) : h === "hovered" || h === "hover" ? (C = e.hoverBorderColor || C, b = e.hoverBackgroundColor || b) : h === "disabled" ? (b = e.disabledBackgroundColor || "rgba(31, 41, 55, 0.6)", C = e.disabledBorderColor || "rgba(55, 65, 81, 0.4)") : h === "error" && (C = "rgba(239, 68, 68, 1)", S = Math.max(S, 2)), t.beginPath(), this.drawRoundRect(t, -i / 2, -n / 2, i, n, v);
3988
- const W = this.createCanvasFill(t, b, i, n);
3989
- if (W && (t.fillStyle = W, t.fill()), S > 0) {
4017
+ const $ = this.createCanvasFill(t, b, i, n);
4018
+ if ($ && (t.fillStyle = $, t.fill()), S > 0) {
3990
4019
  const ht = this.createCanvasFill(t, C, i, n);
3991
4020
  if (ht && (t.strokeStyle = ht, t.lineWidth = S, t.stroke()), h === "focused" || h === "focus") {
3992
4021
  t.save(), t.beginPath();
3993
- const mt = v.map((rt) => rt + 2);
3994
- this.drawRoundRect(t, -i / 2 - 2, -n / 2 - 2, i + 4, n + 4, mt), t.strokeStyle = "rgba(59, 130, 246, 0.3)", t.lineWidth = 2, t.stroke(), t.restore();
4022
+ const pt = v.map((ot) => ot + 2);
4023
+ this.drawRoundRect(t, -i / 2 - 2, -n / 2 - 2, i + 4, n + 4, pt), t.strokeStyle = "rgba(59, 130, 246, 0.3)", t.lineWidth = 2, t.stroke(), t.restore();
3995
4024
  }
3996
4025
  }
3997
- const k = (ht, mt) => {
4026
+ const k = (ht, pt) => {
3998
4027
  if (!ht.visible || !ht.svgPath) return;
3999
- const rt = ht.size || 14, Lt = ht.offset ?? 16, Gt = ht.color || "#ffffff", Pt = mt ? -(i / 2) + Lt : i / 2 - Lt, Dt = ht.svgPath;
4000
- if (t.save(), t.translate(Pt, 0), !Dt.startsWith("<svg")) {
4001
- const Yt = new Path2D(Dt), B = rt / 24;
4002
- t.scale(B, B), t.translate(-12, -12), t.fillStyle = Gt, t.fill(Yt);
4028
+ const ot = ht.size || 14, Et = ht.offset ?? 16, Ft = ht.color || "#ffffff", wt = pt ? -(i / 2) + Et : i / 2 - Et, Xt = ht.svgPath;
4029
+ if (t.save(), t.translate(wt, 0), !Xt.startsWith("<svg")) {
4030
+ const Bt = new Path2D(Xt), B = ot / 24;
4031
+ t.scale(B, B), t.translate(-12, -12), t.fillStyle = Ft, t.fill(Bt);
4003
4032
  }
4004
4033
  t.restore();
4005
4034
  };
4006
4035
  k(f, !0), k(d, !1);
4007
- const _ = e.text || "", L = e.placeholder || "Enter text...", x = !_, A = _ || L, $ = x ? w : I, O = M, z = e.fontFamily || "Inter", H = e.fontWeight || 400;
4008
- t.font = `${H} ${O}px "${z}", sans-serif`, t.fillStyle = $, t.textAlign = "left", t.textBaseline = u ? "top" : "middle";
4009
- const et = e.inputPadding ?? 16, E = f.visible ? (f.offset ?? 16) + (f.size || 14) / 2 + 8 : et, F = d.visible ? (d.offset ?? 16) + (d.size || 14) / 2 + 8 : et, q = -(i / 2) + E, Q = i - E - F, it = e.inputType === "password" ? "•".repeat(A.length) : A;
4010
- if (t.save(), t.beginPath(), t.rect(q - 2, -n / 2 + 4, Q + 4, n - 8), t.clip(), u) {
4036
+ const E = e.text || "", R = e.placeholder || "Enter text...", A = !E, O = E || R, W = A ? w : I, x = M, Y = e.fontFamily || "Inter", H = e.fontWeight || 400;
4037
+ t.font = `${H} ${x}px "${Y}", sans-serif`, t.fillStyle = W, t.textAlign = "left", t.textBaseline = u ? "top" : "middle";
4038
+ const Q = e.inputPadding ?? 16, P = f.visible ? (f.offset ?? 16) + (f.size || 14) / 2 + 8 : Q, F = d.visible ? (d.offset ?? 16) + (d.size || 14) / 2 + 8 : Q, U = -(i / 2) + P, J = i - P - F, it = e.inputType === "password" ? "•".repeat(O.length) : O;
4039
+ if (t.save(), t.beginPath(), t.rect(U - 2, -n / 2 + 4, J + 4, n - 8), t.clip(), u) {
4011
4040
  const ht = it.split(`
4012
4041
  `);
4013
- let mt = -n / 2 + et;
4014
- const rt = O * 1.2;
4015
- let Lt = 0;
4016
- ht.forEach((Gt, Pt) => {
4017
- const Dt = Gt.split(" ");
4018
- let Yt = "";
4019
- for (let B = 0; B < Dt.length; B++) {
4020
- const lt = Yt + Dt[B] + " ";
4021
- t.measureText(lt).width > Q && B > 0 ? (t.fillText(Yt, q, mt), Yt = Dt[B] + " ", mt += rt) : Yt = lt;
4042
+ let pt = -n / 2 + Q;
4043
+ const ot = x * 1.2;
4044
+ let Et = 0;
4045
+ ht.forEach((Ft, wt) => {
4046
+ const Xt = Ft.split(" ");
4047
+ let Bt = "";
4048
+ for (let B = 0; B < Xt.length; B++) {
4049
+ const nt = Bt + Xt[B] + " ";
4050
+ t.measureText(nt).width > J && B > 0 ? (t.fillText(Bt, U, pt), Bt = Xt[B] + " ", pt += ot) : Bt = nt;
4022
4051
  }
4023
- t.fillText(Yt, q, mt), Lt = t.measureText(Yt).width, Pt < ht.length - 1 && (mt += rt, Lt = 0);
4024
- }), a && !x && Math.floor(performance.now() / 500) % 2 === 0 && t.fillRect(q + Lt, mt, 1.5, O);
4052
+ t.fillText(Bt, U, pt), Et = t.measureText(Bt).width, wt < ht.length - 1 && (pt += ot, Et = 0);
4053
+ }), a && !A && Math.floor(performance.now() / 500) % 2 === 0 && t.fillRect(U + Et, pt, 1.5, x);
4025
4054
  } else {
4026
- const mt = t.measureText(it).width;
4027
- let rt = 0;
4028
- if (mt > Q && (rt = mt - Q), t.fillText(it, q - rt, 0), a && !x && Math.floor(performance.now() / 500) % 2 === 0) {
4029
- const Gt = q + mt - rt;
4030
- t.fillRect(Gt, -(O / 2), 1.5, O);
4055
+ const pt = t.measureText(it).width;
4056
+ let ot = 0;
4057
+ if (pt > J && (ot = pt - J), t.fillText(it, U - ot, 0), a && !A && Math.floor(performance.now() / 500) % 2 === 0) {
4058
+ const Ft = U + pt - ot;
4059
+ t.fillRect(Ft, -(x / 2), 1.5, x);
4031
4060
  }
4032
4061
  }
4033
4062
  if (t.restore(), c.visible !== !1) {
4034
- const ht = c.text || "Label", mt = c.fontSize || 12, rt = c.color || "rgba(156, 163, 175, 1)", Lt = c.offset ?? 8;
4035
- t.font = `600 ${mt}px "${z}", sans-serif`, t.fillStyle = rt, t.textAlign = "left", t.textBaseline = "bottom";
4036
- const Gt = -(i / 2), Pt = -(n / 2) - Lt;
4037
- t.fillText(ht, Gt, Pt);
4063
+ const ht = c.text || "Label", pt = c.fontSize || 12, ot = c.color || "rgba(156, 163, 175, 1)", Et = c.offset ?? 8;
4064
+ t.font = `600 ${pt}px "${Y}", sans-serif`, t.fillStyle = ot, t.textAlign = "left", t.textBaseline = "bottom";
4065
+ const Ft = -(i / 2), wt = -(n / 2) - Et;
4066
+ t.fillText(ht, Ft, wt);
4038
4067
  }
4039
4068
  if (g.visible === !0) {
4040
- const ht = g.text || "Helper text", mt = g.fontSize || 11, rt = h === "error" ? "rgba(239, 68, 68, 1)" : g.color || "rgba(156, 163, 175, 1)", Lt = g.offset ?? 6;
4041
- t.font = `400 ${mt}px "${z}", sans-serif`, t.fillStyle = rt, t.textAlign = "left", t.textBaseline = "top";
4042
- const Gt = -(i / 2), Pt = n / 2 + Lt;
4043
- t.fillText(ht, Gt, Pt);
4069
+ const ht = g.text || "Helper text", pt = g.fontSize || 11, ot = h === "error" ? "rgba(239, 68, 68, 1)" : g.color || "rgba(156, 163, 175, 1)", Et = g.offset ?? 6;
4070
+ t.font = `400 ${pt}px "${Y}", sans-serif`, t.fillStyle = ot, t.textAlign = "left", t.textBaseline = "top";
4071
+ const Ft = -(i / 2), wt = n / 2 + Et;
4072
+ t.fillText(ht, Ft, wt);
4044
4073
  }
4045
4074
  }
4046
4075
  renderSlider(t, s) {
4047
- const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.geometry) || s.geometry, i = (o == null ? void 0 : o.options) || s.options || {}, n = e.width || 200, a = i.value ?? 50, r = i.min ?? 0, h = (i.max ?? 100) - r, c = h === 0 ? 0 : (a - r) / h, g = i.trackHeight || 4, f = i.trackRoundedness ?? 2, d = i.trackShape ?? "Rectangle", u = i.trackPath || "", m = i.accentColor || "#3b82f6", y = i.inactiveColor || "#374151", v = i.thumbShape || "Ellipse", b = i.thumbWidth ?? 16, C = i.thumbHeight ?? 16, S = i.thumbRoundedness ?? 0, I = i.thumbColor || "#ffffff", w = i.thumbPath || "", M = i.thumbIcon || "", P = i.showValueTooltip ?? !1, T = i.tooltipBgColor || "#333333", W = i.tooltipColor || "#ffffff", k = i.tooltipOffsetX ?? 0, _ = i.tooltipOffsetY ?? -25, L = (Q, it, dt, St, ht, mt, rt) => {
4048
- if ((Q === "Custom" || Q === "Icon") && rt)
4076
+ const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.geometry) || s.geometry, i = (o == null ? void 0 : o.options) || s.options || {}, n = e.width || 200, a = i.value ?? 50, r = i.min ?? 0, h = (i.max ?? 100) - r, c = h === 0 ? 0 : (a - r) / h, g = i.trackHeight || 4, f = i.trackRoundedness ?? 2, d = i.trackShape ?? "Rectangle", u = i.trackPath || "", m = i.accentColor || "#3b82f6", y = i.inactiveColor || "#374151", v = i.thumbShape || "Ellipse", b = i.thumbWidth ?? 16, C = i.thumbHeight ?? 16, S = i.thumbRoundedness ?? 0, I = i.thumbColor || "#ffffff", w = i.thumbPath || "", M = i.thumbIcon || "", _ = i.showValueTooltip ?? !1, T = i.tooltipBgColor || "#333333", $ = i.tooltipColor || "#ffffff", k = i.tooltipOffsetX ?? 0, E = i.tooltipOffsetY ?? -25, R = (J, it, dt, yt, ht, pt, ot) => {
4077
+ if ((J === "Custom" || J === "Icon") && ot)
4049
4078
  try {
4050
- const Lt = new Path2D(rt);
4051
- if (t.save(), t.translate(it, dt), Q === "Icon") {
4052
- const Gt = Math.min(St, ht) / 24;
4053
- t.scale(Gt, Gt), t.translate(-12, -12);
4079
+ const Et = new Path2D(ot);
4080
+ if (t.save(), t.translate(it, dt), J === "Icon") {
4081
+ const Ft = Math.min(yt, ht) / 24;
4082
+ t.scale(Ft, Ft), t.translate(-12, -12);
4054
4083
  }
4055
- t.fill(Lt), t.restore();
4084
+ t.fill(Et), t.restore();
4056
4085
  return;
4057
- } catch (Lt) {
4058
- console.error("Error drawing slider shape in engine:", Lt);
4086
+ } catch (Et) {
4087
+ console.error("Error drawing slider shape in engine:", Et);
4059
4088
  }
4060
- if (t.beginPath(), Q === "Ellipse")
4061
- t.ellipse(it, dt, St / 2, ht / 2, 0, 0, Math.PI * 2);
4062
- else if (Q === "Rectangle")
4063
- this.drawRoundRect(t, it - St / 2, dt - ht / 2, St, ht, mt);
4064
- else if (Q === "Triangle")
4065
- t.moveTo(it, dt - ht / 2), t.lineTo(it + St / 2, dt + ht / 2), t.lineTo(it - St / 2, dt + ht / 2), t.closePath();
4066
- else if (Q === "Diamond")
4067
- t.moveTo(it, dt - ht / 2), t.lineTo(it + St / 2, dt), t.lineTo(it, dt + ht / 2), t.lineTo(it - St / 2, dt), t.closePath();
4068
- else if (Q === "Polygon") {
4069
- const Lt = s.geometry.sides || 3, Gt = s.geometry.radius || Math.min(St, ht) / 2;
4070
- for (let Pt = 0; Pt < Lt; Pt++) {
4071
- const Dt = Pt * 2 * Math.PI / Lt - Math.PI / 2, Yt = it + Gt * Math.cos(Dt), B = dt + Gt * Math.sin(Dt);
4072
- Pt === 0 ? t.moveTo(Yt, B) : t.lineTo(Yt, B);
4089
+ if (t.beginPath(), J === "Ellipse")
4090
+ t.ellipse(it, dt, yt / 2, ht / 2, 0, 0, Math.PI * 2);
4091
+ else if (J === "Rectangle")
4092
+ this.drawRoundRect(t, it - yt / 2, dt - ht / 2, yt, ht, pt);
4093
+ else if (J === "Triangle")
4094
+ t.moveTo(it, dt - ht / 2), t.lineTo(it + yt / 2, dt + ht / 2), t.lineTo(it - yt / 2, dt + ht / 2), t.closePath();
4095
+ else if (J === "Diamond")
4096
+ t.moveTo(it, dt - ht / 2), t.lineTo(it + yt / 2, dt), t.lineTo(it, dt + ht / 2), t.lineTo(it - yt / 2, dt), t.closePath();
4097
+ else if (J === "Polygon") {
4098
+ const Et = s.geometry.sides || 3, Ft = s.geometry.radius || Math.min(yt, ht) / 2;
4099
+ for (let wt = 0; wt < Et; wt++) {
4100
+ const Xt = wt * 2 * Math.PI / Et - Math.PI / 2, Bt = it + Ft * Math.cos(Xt), B = dt + Ft * Math.sin(Xt);
4101
+ wt === 0 ? t.moveTo(Bt, B) : t.lineTo(Bt, B);
4073
4102
  }
4074
4103
  t.closePath();
4075
- } else if (Q === "Star") {
4076
- const Gt = Math.min(St, ht) / 2, Pt = Gt / 2;
4077
- for (let Dt = 0; Dt < 5 * 2; Dt++) {
4078
- const Yt = Dt % 2 === 0 ? Gt : Pt, B = Dt * Math.PI / 5 - Math.PI / 2;
4079
- t.lineTo(it + Yt * Math.cos(B), dt + Yt * Math.sin(B));
4104
+ } else if (J === "Star") {
4105
+ const Ft = Math.min(yt, ht) / 2, wt = Ft / 2;
4106
+ for (let Xt = 0; Xt < 5 * 2; Xt++) {
4107
+ const Bt = Xt % 2 === 0 ? Ft : wt, B = Xt * Math.PI / 5 - Math.PI / 2;
4108
+ t.lineTo(it + Bt * Math.cos(B), dt + Bt * Math.sin(B));
4080
4109
  }
4081
4110
  t.closePath();
4082
- } else Q === "Line" && (t.moveTo(it - St / 2, dt), t.lineTo(it + St / 2, dt));
4111
+ } else J === "Line" && (t.moveTo(it - yt / 2, dt), t.lineTo(it + yt / 2, dt));
4083
4112
  t.fill();
4084
- }, x = this.createCanvasFill(t, y, n, g);
4085
- x && (t.fillStyle = x, t.strokeStyle = x), d === "Line" ? (t.lineWidth = g, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo(n / 2, 0), t.stroke()) : L(d, 0, 0, n, g, f, u);
4086
- const A = n - b, $ = -n / 2 + b / 2 + c * A, O = $ - -n / 2;
4087
- if (O > 0) {
4088
- const Q = this.createCanvasFill(t, m, n, g);
4089
- Q && (t.fillStyle = Q, t.strokeStyle = Q), d === "Line" ? (t.lineWidth = g, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo($, 0), t.stroke()) : d === "Rectangle" && (t.beginPath(), this.drawRoundRect(t, -n / 2, -g / 2, O, g, f), t.fill());
4113
+ }, A = this.createCanvasFill(t, y, n, g);
4114
+ A && (t.fillStyle = A, t.strokeStyle = A), d === "Line" ? (t.lineWidth = g, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo(n / 2, 0), t.stroke()) : R(d, 0, 0, n, g, f, u);
4115
+ const O = n - b, W = -n / 2 + b / 2 + c * O, x = W - -n / 2;
4116
+ if (x > 0) {
4117
+ const J = this.createCanvasFill(t, m, n, g);
4118
+ J && (t.fillStyle = J, t.strokeStyle = J), d === "Line" ? (t.lineWidth = g, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo(W, 0), t.stroke()) : d === "Rectangle" && (t.beginPath(), this.drawRoundRect(t, -n / 2, -g / 2, x, g, f), t.fill());
4090
4119
  }
4091
- t.save(), t.translate($, 0);
4092
- const z = t.getTransform(), H = Math.sqrt(z.a * z.a + z.b * z.b) || 1;
4120
+ t.save(), t.translate(W, 0);
4121
+ const Y = t.getTransform(), H = Math.sqrt(Y.a * Y.a + Y.b * Y.b) || 1;
4093
4122
  t.shadowColor = "rgba(0,0,0,0.2)", t.shadowBlur = 4 * H, t.shadowOffsetY = 1 * H;
4094
- const et = this.createCanvasFill(t, I, b, C);
4095
- if (et && (t.fillStyle = et), L(v, 0, 0, b, C, S, v === "Icon" ? M : w), t.restore(), P) {
4096
- t.save(), t.translate($ + k, _);
4097
- const Q = Math.round(a).toString();
4123
+ const Q = this.createCanvasFill(t, I, b, C);
4124
+ if (Q && (t.fillStyle = Q), R(v, 0, 0, b, C, S, v === "Icon" ? M : w), t.restore(), _) {
4125
+ t.save(), t.translate(W + k, E);
4126
+ const J = Math.round(a).toString();
4098
4127
  t.font = "10px Inter, sans-serif";
4099
- const it = t.measureText(Q), dt = 6, St = 4, ht = it.width + dt * 2, mt = 14 + St;
4100
- t.beginPath(), this.drawRoundRect(t, -ht / 2, -mt / 2, ht, mt, 4), t.fillStyle = T, t.fill(), t.fillStyle = W, t.textAlign = "center", t.textBaseline = "middle", t.fillText(Q, 0, 0), t.restore();
4128
+ const it = t.measureText(J), dt = 6, yt = 4, ht = it.width + dt * 2, pt = 14 + yt;
4129
+ t.beginPath(), this.drawRoundRect(t, -ht / 2, -pt / 2, ht, pt, 4), t.fillStyle = T, t.fill(), t.fillStyle = $, t.textAlign = "center", t.textBaseline = "middle", t.fillText(J, 0, 0), t.restore();
4101
4130
  }
4102
- const E = i.label || {}, F = i.helperText || {}, q = i.fontFamily || "Inter";
4103
- if (E.visible !== !1) {
4104
- const Q = E.text || "Label", it = E.fontSize || 12, dt = E.color || "rgba(156, 163, 175, 1)", St = E.offset ?? 8;
4105
- t.font = `600 ${it}px "${q}", sans-serif`, t.fillStyle = dt, t.textAlign = "left", t.textBaseline = "bottom";
4106
- const ht = -(n / 2), mt = -(g / 2) - St;
4107
- t.fillText(Q, ht, mt);
4131
+ const P = i.label || {}, F = i.helperText || {}, U = i.fontFamily || "Inter";
4132
+ if (P.visible !== !1) {
4133
+ const J = P.text || "Label", it = P.fontSize || 12, dt = P.color || "rgba(156, 163, 175, 1)", yt = P.offset ?? 8;
4134
+ t.font = `600 ${it}px "${U}", sans-serif`, t.fillStyle = dt, t.textAlign = "left", t.textBaseline = "bottom";
4135
+ const ht = -(n / 2), pt = -(g / 2) - yt;
4136
+ t.fillText(J, ht, pt);
4108
4137
  }
4109
4138
  if (F.visible === !0) {
4110
- const Q = F.text || "Helper text", it = F.fontSize || 11, dt = F.color || "rgba(156, 163, 175, 1)", St = F.offset ?? 6;
4111
- t.font = `400 ${it}px "${q}", sans-serif`, t.fillStyle = dt, t.textAlign = "left", t.textBaseline = "top";
4112
- const ht = -(n / 2), mt = g / 2 + St;
4113
- t.fillText(Q, ht, mt);
4139
+ const J = F.text || "Helper text", it = F.fontSize || 11, dt = F.color || "rgba(156, 163, 175, 1)", yt = F.offset ?? 6;
4140
+ t.font = `400 ${it}px "${U}", sans-serif`, t.fillStyle = dt, t.textAlign = "left", t.textBaseline = "top";
4141
+ const ht = -(n / 2), pt = g / 2 + yt;
4142
+ t.fillText(J, ht, pt);
4114
4143
  }
4115
4144
  }
4116
4145
  renderDropdown(t, s) {
4117
- var _;
4146
+ var E;
4118
4147
  const o = this.objectStates.get(s.id);
4119
4148
  if (!o) return;
4120
4149
  const e = o.options || s.options || {}, i = s.geometry.width || 160, n = s.geometry.height || 40, a = -i / 2, r = -n / 2, l = e.corner_radius ?? 6, h = e.disabled || e.previewState === "disabled", c = this.lastHoveredObjectId === s.id || e.previewState === "hover", g = (e.isOpen || e.previewState === "active") && !h;
@@ -4126,44 +4155,44 @@ class ci {
4126
4155
  y > 0 && (t.strokeStyle = this.createCanvasFill(t, typeof d == "string" ? { type: "Solid", color: d } : d, i, n) || "#e5e7eb", t.lineWidth = y, t.stroke());
4127
4156
  const v = 12, b = e.chevronType || "chevron", C = e.chevronSize || 16, S = (g ? e.openIconColor : e.closedIconColor) || e.chevronColor || "#6b7280";
4128
4157
  if (b !== "none") {
4129
- const L = a + i - v - C / 2;
4130
- t.save(), t.translate(L, 0);
4131
- const x = g ? e.openIconAngle ?? 180 : e.closedIconAngle ?? 0;
4132
- if (t.rotate(x * Math.PI / 180), t.strokeStyle = S, t.fillStyle = S, t.lineWidth = 1.5, t.lineCap = "round", t.lineJoin = "round", b === "chevron")
4158
+ const R = a + i - v - C / 2;
4159
+ t.save(), t.translate(R, 0);
4160
+ const A = g ? e.openIconAngle ?? 180 : e.closedIconAngle ?? 0;
4161
+ if (t.rotate(A * Math.PI / 180), t.strokeStyle = S, t.fillStyle = S, t.lineWidth = 1.5, t.lineCap = "round", t.lineJoin = "round", b === "chevron")
4133
4162
  t.beginPath(), t.moveTo(-C / 2, -C * 0.2), t.lineTo(0, C * 0.2), t.lineTo(C / 2, -C * 0.2), t.stroke();
4134
4163
  else if (b === "custom" || b === "path") {
4135
- const A = g && e.openIconPath || e.closedIconPath;
4136
- if (A) {
4137
- const $ = new Path2D(A);
4164
+ const O = g && e.openIconPath || e.closedIconPath;
4165
+ if (O) {
4166
+ const W = new Path2D(O);
4138
4167
  t.save();
4139
- const O = C / 24;
4140
- t.scale(O, O), t.translate(-12, -12), t.fill($), t.restore();
4168
+ const x = C / 24;
4169
+ t.scale(x, x), t.translate(-12, -12), t.fill(W), t.restore();
4141
4170
  }
4142
4171
  }
4143
4172
  t.restore();
4144
4173
  }
4145
- const I = e.selectedOption || e.placeholder || "Select...", w = e.fontSize || 14, M = e.fontWeight || 400, P = e.fontFamily || "Inter, sans-serif";
4146
- t.font = `${M} ${w}px ${P}`;
4174
+ const I = e.selectedOption || e.placeholder || "Select...", w = e.fontSize || 14, M = e.fontWeight || 400, _ = e.fontFamily || "Inter, sans-serif";
4175
+ t.font = `${M} ${w}px ${_}`;
4147
4176
  const T = h ? e.disabledColor || "#9ca3af" : !e.selectedOption && e.placeholder ? "#9ca3af" : u;
4148
4177
  t.fillStyle = this.createCanvasFill(t, typeof T == "string" ? { type: "Solid", color: T } : T, i, n) || "#333333", t.textAlign = "left", t.textBaseline = "middle";
4149
- const W = b === "none" ? 0 : C + 8, k = i - v * 2 - W;
4178
+ const $ = b === "none" ? 0 : C + 8, k = i - v * 2 - $;
4150
4179
  if (t.save(), t.beginPath(), t.rect(a + v, r, k, n), t.clip(), t.fillText(I, a + v, 0), t.restore(), g && !h) {
4151
- const L = r + n + 4, x = e.optionsList || [], A = e.itemHeight || 32, $ = e.listPadding ?? 4, O = x.length * A + $ * 2, z = e.listCornerRadius ?? l;
4180
+ const R = r + n + 4, A = e.optionsList || [], O = e.itemHeight || 32, W = e.listPadding ?? 4, x = A.length * O + W * 2, Y = e.listCornerRadius ?? l;
4152
4181
  t.save();
4153
- const H = e.listShadow || {}, et = t.getTransform(), E = Math.sqrt(et.a * et.a + et.b * et.b) || 1;
4154
- t.shadowColor = typeof H.color == "string" ? H.color : ((_ = H.color) == null ? void 0 : _.color) || "rgba(0,0,0,0.15)", t.shadowBlur = (H.blur ?? 12) * E, t.shadowOffsetY = (H.offsetY ?? 6) * E, t.shadowOffsetX = (H.offsetX ?? 0) * E, t.beginPath(), this.drawRoundRect(t, a, L, i, O, z), t.fillStyle = this.createCanvasFill(t, typeof e.listBackgroundColor == "string" ? { type: "Solid", color: e.listBackgroundColor } : e.listBackgroundColor || { type: "Solid", color: "#ffffff" }, i, O) || "#ffffff", t.fill();
4182
+ const H = e.listShadow || {}, Q = t.getTransform(), P = Math.sqrt(Q.a * Q.a + Q.b * Q.b) || 1;
4183
+ t.shadowColor = typeof H.color == "string" ? H.color : ((E = H.color) == null ? void 0 : E.color) || "rgba(0,0,0,0.15)", t.shadowBlur = (H.blur ?? 12) * P, t.shadowOffsetY = (H.offsetY ?? 6) * P, t.shadowOffsetX = (H.offsetX ?? 0) * P, t.beginPath(), this.drawRoundRect(t, a, R, i, x, Y), t.fillStyle = this.createCanvasFill(t, typeof e.listBackgroundColor == "string" ? { type: "Solid", color: e.listBackgroundColor } : e.listBackgroundColor || { type: "Solid", color: "#ffffff" }, i, x) || "#ffffff", t.fill();
4155
4184
  const F = e.listBorderWidth ?? 1;
4156
- F > 0 && (t.shadowColor = "transparent", t.strokeStyle = this.createCanvasFill(t, typeof e.listBorderColor == "string" ? { type: "Solid", color: e.listBorderColor } : e.listBorderColor || { type: "Solid", color: d }, i, O) || "#e5e7eb", t.lineWidth = F, t.stroke()), t.restore();
4157
- const q = e.itemFontSize || w, Q = e.itemFontFamily || P;
4158
- t.font = `${M} ${q}px ${Q}`, x.forEach((it, dt) => {
4159
- const St = L + $ + dt * A;
4185
+ F > 0 && (t.shadowColor = "transparent", t.strokeStyle = this.createCanvasFill(t, typeof e.listBorderColor == "string" ? { type: "Solid", color: e.listBorderColor } : e.listBorderColor || { type: "Solid", color: d }, i, x) || "#e5e7eb", t.lineWidth = F, t.stroke()), t.restore();
4186
+ const U = e.itemFontSize || w, J = e.itemFontFamily || _;
4187
+ t.font = `${M} ${U}px ${J}`, A.forEach((it, dt) => {
4188
+ const yt = R + W + dt * O;
4160
4189
  if (it === e.selectedOption)
4161
- t.fillStyle = this.createCanvasFill(t, typeof e.itemSelectedBackgroundColor == "string" ? { type: "Solid", color: e.itemSelectedBackgroundColor } : e.itemSelectedBackgroundColor || { type: "Solid", color: "#f3f4f6" }, i, A) || "#f3f4f6", t.fillRect(a + F, St, i - F * 2, A), t.fillStyle = e.itemSelectedColor || e.accentColor || u || "#374151";
4190
+ t.fillStyle = this.createCanvasFill(t, typeof e.itemSelectedBackgroundColor == "string" ? { type: "Solid", color: e.itemSelectedBackgroundColor } : e.itemSelectedBackgroundColor || { type: "Solid", color: "#f3f4f6" }, i, O) || "#f3f4f6", t.fillRect(a + F, yt, i - F * 2, O), t.fillStyle = e.itemSelectedColor || e.accentColor || u || "#374151";
4162
4191
  else if (t.fillStyle = e.listTextColor || u || "#333333", this.activeDropdownId === s.id && this._lastPointerPos) {
4163
- const mt = this._lastPointerPos.y - (L + $), rt = Math.floor(mt / A);
4164
- dt === rt && (t.fillStyle = this.createCanvasFill(t, typeof e.itemHoverBackgroundColor == "string" ? { type: "Solid", color: e.itemHoverBackgroundColor } : e.itemHoverBackgroundColor || { type: "Solid", color: "#f9fafb" }, i, A) || "#f9fafb", t.fillRect(a + F, St, i - F * 2, A), t.fillStyle = e.itemHoverColor || u);
4192
+ const pt = this._lastPointerPos.y - (R + W), ot = Math.floor(pt / O);
4193
+ dt === ot && (t.fillStyle = this.createCanvasFill(t, typeof e.itemHoverBackgroundColor == "string" ? { type: "Solid", color: e.itemHoverBackgroundColor } : e.itemHoverBackgroundColor || { type: "Solid", color: "#f9fafb" }, i, O) || "#f9fafb", t.fillRect(a + F, yt, i - F * 2, O), t.fillStyle = e.itemHoverColor || u);
4165
4194
  }
4166
- t.fillText(it, a + v, St + A / 2);
4195
+ t.fillText(it, a + v, yt + O / 2);
4167
4196
  });
4168
4197
  }
4169
4198
  t.globalAlpha = m;
@@ -4177,16 +4206,16 @@ class ci {
4177
4206
  t.save(), t.scale(C, C), t.beginPath(), this.drawRoundRect(t, S, I, n, a, y);
4178
4207
  const w = this.createCanvasFill(t, d, n, a);
4179
4208
  w && (t.fillStyle = w, t.fill()), (b > 0 || r && c.borderColor) && (t.strokeStyle = v, t.lineWidth = b || (r ? 1 : 0), t.stroke());
4180
- const M = h.fontSize || 14, P = h.fontFamily || "Inter", T = h.fontWeight || 600;
4181
- t.font = `${T} ${M}px "${P}", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, t.fillStyle = u, t.textAlign = "center", t.textBaseline = "middle";
4182
- let W = 0;
4209
+ const M = h.fontSize || 14, _ = h.fontFamily || "Inter", T = h.fontWeight || 600;
4210
+ t.font = `${T} ${M}px "${_}", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, t.fillStyle = u, t.textAlign = "center", t.textBaseline = "middle";
4211
+ let $ = 0;
4183
4212
  if (f.enabled && f.svgPath) {
4184
- const k = M * 1.1, _ = f.gap || 8, L = t.measureText(m), A = -(L.width + k + _) / 2, $ = f.position === "left" ? A + k / 2 : A + L.width + _ + k / 2;
4185
- W = f.position === "left" ? A + k + _ + L.width / 2 : A + L.width / 2, t.save(), t.translate($, 0);
4186
- const O = new Path2D(f.svgPath), z = k / 24;
4187
- t.scale(z, z), t.translate(-12, -12), t.fillStyle = u, t.fill(O), t.restore();
4213
+ const k = M * 1.1, E = f.gap || 8, R = t.measureText(m), O = -(R.width + k + E) / 2, W = f.position === "left" ? O + k / 2 : O + R.width + E + k / 2;
4214
+ $ = f.position === "left" ? O + k + E + R.width / 2 : O + R.width / 2, t.save(), t.translate(W, 0);
4215
+ const x = new Path2D(f.svgPath), Y = k / 24;
4216
+ t.scale(Y, Y), t.translate(-12, -12), t.fillStyle = u, t.fill(x), t.restore();
4188
4217
  }
4189
- t.fillText(m, W, 0), t.restore();
4218
+ t.fillText(m, $, 0), t.restore();
4190
4219
  }
4191
4220
  renderToggleButton(t, s) {
4192
4221
  var m, y;
@@ -4196,36 +4225,36 @@ class ci {
4196
4225
  t.font = `${c.fontWeight || 600} ${d}px "${u}", sans-serif`, t.fillStyle = f, t.textAlign = "center", t.textBaseline = "middle", t.fillText(c.text || "Toggle", 0, 0), t.restore();
4197
4226
  }
4198
4227
  renderToggle(t, s) {
4199
- var z, H, et, E, F, q, Q, it, dt, St, ht, mt;
4200
- const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((z = s.geometry) == null ? void 0 : z.width) || 52, n = ((H = s.geometry) == null ? void 0 : H.height) || 30, a = -i / 2, r = -n / 2, l = e.checked ?? !1, h = e.cornerRadius ?? e.corner_radius ?? n / 2, c = e.toggleStyle || {}, g = c.backgroundColor || e.activeColor || "#10b981", f = c.borderColor || e.borderColor || "transparent", d = c.borderWidth ?? e.borderWidth ?? 0, u = c.knobColor || e.knobColor || "#ffffff", m = l ? g : e.inactiveColor || "#374151", y = l ? f : e.borderColor || "transparent", v = l ? d : e.borderWidth ?? 0, b = l ? u : e.knobColor || "#ffffff";
4228
+ var Y, H, Q, P, F, U, J, it, dt, yt, ht, pt;
4229
+ const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((Y = s.geometry) == null ? void 0 : Y.width) || 52, n = ((H = s.geometry) == null ? void 0 : H.height) || 30, a = -i / 2, r = -n / 2, l = e.checked ?? !1, h = e.cornerRadius ?? e.corner_radius ?? n / 2, c = e.toggleStyle || {}, g = c.backgroundColor || e.activeColor || "#10b981", f = c.borderColor || e.borderColor || "transparent", d = c.borderWidth ?? e.borderWidth ?? 0, u = c.knobColor || e.knobColor || "#ffffff", m = l ? g : e.inactiveColor || "#374151", y = l ? f : e.borderColor || "transparent", v = l ? d : e.borderWidth ?? 0, b = l ? u : e.knobColor || "#ffffff";
4201
4230
  e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, i, n, h);
4202
4231
  const C = this.createCanvasFill(t, m, i, n);
4203
4232
  if (C && (t.fillStyle = C, t.fill()), v > 0) {
4204
4233
  t.lineWidth = v;
4205
- const rt = this.createCanvasFill(t, y, i, n);
4206
- rt && (t.strokeStyle = rt, t.stroke());
4234
+ const ot = this.createCanvasFill(t, y, i, n);
4235
+ ot && (t.strokeStyle = ot, t.stroke());
4207
4236
  }
4208
- const S = 2, I = n - S * 2, w = I / 2, M = a + S, P = a + i - S - I, T = l ? P : M, W = r + S;
4209
- t.beginPath(), t.arc(T + w, W + w, w, 0, Math.PI * 2);
4237
+ const S = 2, I = n - S * 2, w = I / 2, M = a + S, _ = a + i - S - I, T = l ? _ : M, $ = r + S;
4238
+ t.beginPath(), t.arc(T + w, $ + w, w, 0, Math.PI * 2);
4210
4239
  const k = this.createCanvasFill(t, b, I, I);
4211
4240
  k && (t.fillStyle = k, t.fill()), e.disabled && (t.globalAlpha *= 2);
4212
- let _ = !1, L = !1;
4213
- const x = (l ? (et = c.leftLabel) == null ? void 0 : et.text : null) || ((E = e.leftLabel) == null ? void 0 : E.text) || "", A = (l ? (F = c.leftLabel) == null ? void 0 : F.color : null) || ((q = e.leftLabel) == null ? void 0 : q.color) || "#f3f4f6";
4214
- if ((Q = e.leftLabel) != null && Q.enabled && x) {
4215
- const rt = e.leftLabel;
4216
- t.font = `${rt.fontWeight || 400} ${rt.fontSize || 12}px "${rt.fontFamily || "Inter"}", sans-serif`, t.fillStyle = A, t.textBaseline = "middle", t.textAlign = "right", t.fillText(x, a - (rt.gap || 8), 0), _ = !0;
4241
+ let E = !1, R = !1;
4242
+ const A = (l ? (Q = c.leftLabel) == null ? void 0 : Q.text : null) || ((P = e.leftLabel) == null ? void 0 : P.text) || "", O = (l ? (F = c.leftLabel) == null ? void 0 : F.color : null) || ((U = e.leftLabel) == null ? void 0 : U.color) || "#f3f4f6";
4243
+ if ((J = e.leftLabel) != null && J.enabled && A) {
4244
+ const ot = e.leftLabel;
4245
+ t.font = `${ot.fontWeight || 400} ${ot.fontSize || 12}px "${ot.fontFamily || "Inter"}", sans-serif`, t.fillStyle = O, t.textBaseline = "middle", t.textAlign = "right", t.fillText(A, a - (ot.gap || 8), 0), E = !0;
4217
4246
  }
4218
- const $ = (l ? (it = c.rightLabel) == null ? void 0 : it.text : null) || ((dt = e.rightLabel) == null ? void 0 : dt.text) || "", O = (l ? (St = c.rightLabel) == null ? void 0 : St.color : null) || ((ht = e.rightLabel) == null ? void 0 : ht.color) || "#f3f4f6";
4219
- if ((mt = e.rightLabel) != null && mt.enabled && $) {
4220
- const rt = e.rightLabel;
4221
- t.font = `${rt.fontWeight || 400} ${rt.fontSize || 12}px "${rt.fontFamily || "Inter"}", sans-serif`, t.fillStyle = O, t.textBaseline = "middle", t.textAlign = "left", t.fillText($, a + i + (rt.gap || 8), 0), L = !0;
4247
+ const W = (l ? (it = c.rightLabel) == null ? void 0 : it.text : null) || ((dt = e.rightLabel) == null ? void 0 : dt.text) || "", x = (l ? (yt = c.rightLabel) == null ? void 0 : yt.color : null) || ((ht = e.rightLabel) == null ? void 0 : ht.color) || "#f3f4f6";
4248
+ if ((pt = e.rightLabel) != null && pt.enabled && W) {
4249
+ const ot = e.rightLabel;
4250
+ t.font = `${ot.fontWeight || 400} ${ot.fontSize || 12}px "${ot.fontFamily || "Inter"}", sans-serif`, t.fillStyle = x, t.textBaseline = "middle", t.textAlign = "left", t.fillText(W, a + i + (ot.gap || 8), 0), R = !0;
4222
4251
  }
4223
- if (!_ && !L && e.label && e.label.text) {
4224
- const rt = e.label, Lt = rt.fontSize || 14, Gt = rt.fontWeight || 400, Pt = rt.fontFamily || "Inter";
4225
- t.font = `${Gt} ${Lt}px "${Pt}", sans-serif`, t.fillStyle = rt.color || "#f3f4f6", t.textBaseline = "middle";
4226
- const Dt = rt.gap || 10;
4227
- let Yt = 0, B = 0;
4228
- rt.position === "left" ? (t.textAlign = "right", Yt = a - Dt, B = 0) : rt.position === "right" ? (t.textAlign = "left", Yt = a + i + Dt, B = 0) : rt.position === "top" ? (t.textAlign = "center", Yt = 0, B = r - Dt, t.textBaseline = "bottom") : rt.position === "bottom" ? (t.textAlign = "center", Yt = 0, B = r + n + Dt, t.textBaseline = "top") : (t.textAlign = "left", Yt = a + i + Dt, B = 0), t.fillText(rt.text, Yt, B);
4252
+ if (!E && !R && e.label && e.label.text) {
4253
+ const ot = e.label, Et = ot.fontSize || 14, Ft = ot.fontWeight || 400, wt = ot.fontFamily || "Inter";
4254
+ t.font = `${Ft} ${Et}px "${wt}", sans-serif`, t.fillStyle = ot.color || "#f3f4f6", t.textBaseline = "middle";
4255
+ const Xt = ot.gap || 10;
4256
+ let Bt = 0, B = 0;
4257
+ ot.position === "left" ? (t.textAlign = "right", Bt = a - Xt, B = 0) : ot.position === "right" ? (t.textAlign = "left", Bt = a + i + Xt, B = 0) : ot.position === "top" ? (t.textAlign = "center", Bt = 0, B = r - Xt, t.textBaseline = "bottom") : ot.position === "bottom" ? (t.textAlign = "center", Bt = 0, B = r + n + Xt, t.textBaseline = "top") : (t.textAlign = "left", Bt = a + i + Xt, B = 0), t.fillText(ot.text, Bt, B);
4229
4258
  }
4230
4259
  }
4231
4260
  renderCheckbox(t, s) {
@@ -4246,15 +4275,15 @@ class ci {
4246
4275
  t.save(), t.beginPath();
4247
4276
  const I = this.createCanvasFill(t, f, i, n);
4248
4277
  t.strokeStyle = I || f, t.lineWidth = Math.max(2, i * 0.12), t.lineCap = "round", t.lineJoin = "round";
4249
- const w = a + i * 0.25, M = r + n * 0.5, P = a + i * 0.45, T = r + n * 0.7, W = a + i * 0.75, k = r + n * 0.25;
4250
- t.moveTo(w, M), t.lineTo(P, T), t.lineTo(W, k), t.stroke(), t.restore();
4278
+ const w = a + i * 0.25, M = r + n * 0.5, _ = a + i * 0.45, T = r + n * 0.7, $ = a + i * 0.75, k = r + n * 0.25;
4279
+ t.moveTo(w, M), t.lineTo(_, T), t.lineTo($, k), t.stroke(), t.restore();
4251
4280
  }
4252
4281
  if (e.disabled && (t.globalAlpha *= 2), e.label && e.label.text) {
4253
4282
  const I = e.label;
4254
4283
  t.save(), t.font = `${I.fontWeight || 400} ${I.fontSize || 14}px "${I.fontFamily || "Inter"}", sans-serif`, t.fillStyle = I.color || "#f3f4f6", t.textBaseline = "middle";
4255
4284
  const w = I.gap || 8;
4256
- let M = 0, P = 0;
4257
- I.position === "left" ? (t.textAlign = "right", M = a - w, P = 0) : I.position === "right" ? (t.textAlign = "left", M = a + i + w, P = 0) : I.position === "top" ? (t.textAlign = "center", M = 0, P = r - w, t.textBaseline = "bottom") : I.position === "bottom" && (t.textAlign = "center", M = 0, P = r + n + w, t.textBaseline = "top"), t.fillText(I.text, M, P), t.restore();
4285
+ let M = 0, _ = 0;
4286
+ I.position === "left" ? (t.textAlign = "right", M = a - w, _ = 0) : I.position === "right" ? (t.textAlign = "left", M = a + i + w, _ = 0) : I.position === "top" ? (t.textAlign = "center", M = 0, _ = r - w, t.textBaseline = "bottom") : I.position === "bottom" && (t.textAlign = "center", M = 0, _ = r + n + w, t.textBaseline = "top"), t.fillText(I.text, M, _), t.restore();
4258
4287
  }
4259
4288
  }
4260
4289
  renderRadioGroup(t, s) {
@@ -4264,34 +4293,34 @@ class ci {
4264
4293
  const b = 8, C = b * 2;
4265
4294
  if (t.save(), t.font = `${v} ${m}px "${y}", sans-serif`, t.textBaseline = "middle", t.textAlign = "left", c === "vertical") {
4266
4295
  const w = Math.max(C, m) + g;
4267
- h.forEach((M, P) => {
4268
- const T = r + P * w + b;
4296
+ h.forEach((M, _) => {
4297
+ const T = r + _ * w + b;
4269
4298
  t.beginPath(), t.arc(a + b, T, b, 0, Math.PI * 2);
4270
- const W = l === M, k = this.createCanvasFill(t, f, C, C), _ = this.createCanvasFill(t, d, C, C);
4271
- W ? (t.strokeStyle = k || f, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(a + b, T, b / 2, 0, Math.PI * 2), t.fillStyle = k || f, t.fill()) : (t.strokeStyle = _ || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = u, t.fillText(M, a + C + 8, T);
4299
+ const $ = l === M, k = this.createCanvasFill(t, f, C, C), E = this.createCanvasFill(t, d, C, C);
4300
+ $ ? (t.strokeStyle = k || f, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(a + b, T, b / 2, 0, Math.PI * 2), t.fillStyle = k || f, t.fill()) : (t.strokeStyle = E || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = u, t.fillText(M, a + C + 8, T);
4272
4301
  });
4273
4302
  } else {
4274
4303
  let w = a;
4275
4304
  h.forEach((M) => {
4276
- const P = l === M, T = t.measureText(M).width;
4305
+ const _ = l === M, T = t.measureText(M).width;
4277
4306
  t.beginPath(), t.arc(w + b, 0, b, 0, Math.PI * 2);
4278
- const W = this.createCanvasFill(t, f, C, C), k = this.createCanvasFill(t, d, C, C);
4279
- P ? (t.strokeStyle = W || f, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(w + b, 0, b / 2, 0, Math.PI * 2), t.fillStyle = W || f, t.fill()) : (t.strokeStyle = k || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = u, t.fillText(M, w + C + 6, 0), w += C + 6 + T + g;
4307
+ const $ = this.createCanvasFill(t, f, C, C), k = this.createCanvasFill(t, d, C, C);
4308
+ _ ? (t.strokeStyle = $ || f, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(w + b, 0, b / 2, 0, Math.PI * 2), t.fillStyle = $ || f, t.fill()) : (t.strokeStyle = k || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = u, t.fillText(M, w + C + 6, 0), w += C + 6 + T + g;
4280
4309
  });
4281
4310
  }
4282
4311
  if (t.restore(), e.disabled && (t.globalAlpha *= 2), e.label && e.label.text) {
4283
4312
  const w = e.label;
4284
4313
  t.save(), t.font = `${w.fontWeight || 400} ${w.fontSize || 14}px "${w.fontFamily || "Inter"}", sans-serif`, t.fillStyle = w.color || "#9ca3af", t.textBaseline = "middle";
4285
4314
  const M = w.gap || 8;
4286
- let P = 0, T = 0;
4287
- w.position === "left" ? (t.textAlign = "right", P = a - M, T = 0) : w.position === "right" ? (t.textAlign = "left", P = a + i + M, T = 0) : w.position === "top" ? (t.textAlign = "center", P = 0, T = r - M, t.textBaseline = "bottom") : w.position === "bottom" && (t.textAlign = "center", P = 0, T = r + n + M, t.textBaseline = "top"), t.fillText(w.text, P, T), t.restore();
4315
+ let _ = 0, T = 0;
4316
+ w.position === "left" ? (t.textAlign = "right", _ = a - M, T = 0) : w.position === "right" ? (t.textAlign = "left", _ = a + i + M, T = 0) : w.position === "top" ? (t.textAlign = "center", _ = 0, T = r - M, t.textBaseline = "bottom") : w.position === "bottom" && (t.textAlign = "center", _ = 0, T = r + n + M, t.textBaseline = "top"), t.fillText(w.text, _, T), t.restore();
4288
4317
  }
4289
4318
  }
4290
4319
  renderBarChart(t, s) {
4291
- var T, W;
4320
+ var T, $;
4292
4321
  const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = {
4293
4322
  width: ((T = s.geometry) == null ? void 0 : T.width) || 300,
4294
- height: ((W = s.geometry) == null ? void 0 : W.height) || 180,
4323
+ height: (($ = s.geometry) == null ? void 0 : $.height) || 180,
4295
4324
  chartType: e.chartType || "grouped",
4296
4325
  stylePreset: e.stylePreset || "default",
4297
4326
  datasets: e.datasets || [{ id: "ds-1", label: "Revenue", data: [42, 67, 31, 55, 78, 48], color: "#6366f1" }],
@@ -4320,21 +4349,21 @@ class ci {
4320
4349
  _getPreset: function() {
4321
4350
  return fs[this.stylePreset] || fs.default;
4322
4351
  },
4323
- _resolveColor: function(k, _) {
4324
- const L = this._getPreset();
4325
- return ["#6366f1", "#f59e0b", "#10b981", "#3b82f6", "#a855f7"].includes(k) ? L.colors[_ % L.colors.length] : typeof k == "string" ? k : L.colors[_ % L.colors.length];
4352
+ _resolveColor: function(k, E) {
4353
+ const R = this._getPreset();
4354
+ return ["#6366f1", "#f59e0b", "#10b981", "#3b82f6", "#a855f7"].includes(k) ? R.colors[E % R.colors.length] : typeof k == "string" ? k : R.colors[E % R.colors.length];
4326
4355
  },
4327
- _makeGradient: function(k, _, L, x, A, $) {
4328
- if (!this._getPreset().barGradient && !this.barGradient) return _;
4329
- const z = k.createLinearGradient(L, x, A, $);
4330
- return z.addColorStop(0, _), z.addColorStop(1, _ + "44"), z;
4356
+ _makeGradient: function(k, E, R, A, O, W) {
4357
+ if (!this._getPreset().barGradient && !this.barGradient) return E;
4358
+ const Y = k.createLinearGradient(R, A, O, W);
4359
+ return Y.addColorStop(0, E), Y.addColorStop(1, E + "44"), Y;
4331
4360
  },
4332
- _drawRoundedBar: function(k, _, L, x, A, $, O) {
4333
- if ($ = Math.min($, Math.min(Math.abs(x), Math.abs(A)) / 2), $ <= 0 || x === 0 || A === 0) {
4334
- k.rect(_, L, x, A);
4361
+ _drawRoundedBar: function(k, E, R, A, O, W, x) {
4362
+ if (W = Math.min(W, Math.min(Math.abs(A), Math.abs(O)) / 2), W <= 0 || A === 0 || O === 0) {
4363
+ k.rect(E, R, A, O);
4335
4364
  return;
4336
4365
  }
4337
- k.beginPath(), O ? (k.moveTo(_, L + A), k.lineTo(_, L + $), k.quadraticCurveTo(_, L, _ + $, L), k.lineTo(_ + x - $, L), k.quadraticCurveTo(_ + x, L, _ + x, L + $), k.lineTo(_ + x, L + A), k.lineTo(_, L + A)) : (k.moveTo(_, L), k.lineTo(_ + x - $, L), k.quadraticCurveTo(_ + x, L, _ + x, L + $), k.lineTo(_ + x, L + A - $), k.quadraticCurveTo(_ + x, L + A, _ + x - $, L + A), k.lineTo(_, L + A), k.lineTo(_, L)), k.closePath();
4366
+ k.beginPath(), x ? (k.moveTo(E, R + O), k.lineTo(E, R + W), k.quadraticCurveTo(E, R, E + W, R), k.lineTo(E + A - W, R), k.quadraticCurveTo(E + A, R, E + A, R + W), k.lineTo(E + A, R + O), k.lineTo(E, R + O)) : (k.moveTo(E, R), k.lineTo(E + A - W, R), k.quadraticCurveTo(E + A, R, E + A, R + W), k.lineTo(E + A, R + O - W), k.quadraticCurveTo(E + A, R + O, E + A - W, R + O), k.lineTo(E, R + O), k.lineTo(E, R)), k.closePath();
4338
4367
  }
4339
4368
  }, n = i.width, a = i.height, r = -n / 2, l = -a / 2;
4340
4369
  if (!i.datasets || i.datasets.length === 0 || i.categories.length === 0) {
@@ -4346,16 +4375,16 @@ class ci {
4346
4375
  const f = i.categories.length, d = i.datasets.length;
4347
4376
  if (i.chartType === "stacked")
4348
4377
  for (let k = 0; k < f; k++) {
4349
- let _ = 0, L = 0;
4350
- i.datasets.forEach((x) => {
4351
- const A = x.data[k] ?? 0;
4352
- A >= 0 ? _ += A : L += A;
4353
- }), _ > c && (c = _), L < g && (g = L);
4378
+ let E = 0, R = 0;
4379
+ i.datasets.forEach((A) => {
4380
+ const O = A.data[k] ?? 0;
4381
+ O >= 0 ? E += O : R += O;
4382
+ }), E > c && (c = E), R < g && (g = R);
4354
4383
  }
4355
4384
  else
4356
4385
  i.datasets.forEach((k) => {
4357
- k.data && k.data.forEach((_) => {
4358
- _ > c && (c = _), _ < g && (g = _);
4386
+ k.data && k.data.forEach((E) => {
4387
+ E > c && (c = E), E < g && (g = E);
4359
4388
  });
4360
4389
  });
4361
4390
  isFinite(c) || (c = 10), isFinite(g) || (g = 0), c = Math.max(c, 0), g = Math.min(g, 0);
@@ -4365,54 +4394,54 @@ class ci {
4365
4394
  if (t.beginPath(), t.roundRect(r, l, n, a, 10), t.fillStyle = h.cardBackground, t.fill(), t.strokeStyle = h.cardBorderColor, t.lineWidth = 1, t.stroke(), i.showLegend && d > 0) {
4366
4395
  t.font = `${i.legendFontSize}px Inter, sans-serif`, t.textBaseline = "middle";
4367
4396
  const k = l + 12;
4368
- let _ = S;
4369
- i.datasets.forEach((L, x) => {
4370
- const A = i._resolveColor(L.color, x), $ = L.label || `Series ${x + 1}`, O = 7;
4371
- t.beginPath(), t.roundRect(_, k - O / 2, O, O, 2), t.fillStyle = A, t.fill(), t.fillStyle = h.legendColor, t.textAlign = "left", t.fillText($, _ + O + 4, k), _ += t.measureText($).width + O + 16;
4397
+ let E = S;
4398
+ i.datasets.forEach((R, A) => {
4399
+ const O = i._resolveColor(R.color, A), W = R.label || `Series ${A + 1}`, x = 7;
4400
+ t.beginPath(), t.roundRect(E, k - x / 2, x, x, 2), t.fillStyle = O, t.fill(), t.fillStyle = h.legendColor, t.textAlign = "left", t.fillText(W, E + x + 4, k), E += t.measureText(W).width + x + 16;
4372
4401
  });
4373
4402
  }
4374
- const P = 4;
4403
+ const _ = 4;
4375
4404
  if (i.showGridLines) {
4376
4405
  t.setLineDash([3, 4]), t.lineWidth = 1, t.strokeStyle = h.gridColor;
4377
- for (let k = 0; k <= P; k++) {
4378
- const _ = I + k / P * M;
4379
- t.beginPath(), t.moveTo(S, _), t.lineTo(S + w, _), t.stroke();
4406
+ for (let k = 0; k <= _; k++) {
4407
+ const E = I + k / _ * M;
4408
+ t.beginPath(), t.moveTo(S, E), t.lineTo(S + w, E), t.stroke();
4380
4409
  }
4381
4410
  t.setLineDash([]);
4382
4411
  }
4383
4412
  if (i.showYLabels) {
4384
4413
  t.font = `${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "right", t.textBaseline = "middle", t.fillStyle = h.axisLabelColor;
4385
- for (let k = 0; k <= P; k++) {
4386
- const _ = c - k / P * u, L = I + k / P * M;
4387
- t.fillText(_.toFixed(0), S - 6, L);
4414
+ for (let k = 0; k <= _; k++) {
4415
+ const E = c - k / _ * u, R = I + k / _ * M;
4416
+ t.fillText(E.toFixed(0), S - 6, R);
4388
4417
  }
4389
4418
  }
4390
4419
  if (t.lineWidth = 1, t.setLineDash([]), i.showXAxis && (t.strokeStyle = i.xAxisColor, t.beginPath(), t.moveTo(S, I + M), t.lineTo(S + w, I + M), t.stroke()), i.showYAxis && (t.strokeStyle = i.yAxisColor, t.beginPath(), t.moveTo(S, I), t.lineTo(S, I + M), t.stroke()), i.chartType === "stacked") {
4391
4420
  const k = w / f;
4392
- for (let _ = 0; _ < f; _++) {
4393
- const L = S + _ * k + k / 2;
4394
- i.showXLabels && (t.font = `${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "center", t.textBaseline = "top", t.fillStyle = h.axisLabelColor, t.fillText(i.categories[_] || "", L, I + M + 5));
4395
- let x = I + M;
4396
- i.datasets.forEach((A, $) => {
4397
- const O = A.data[_] ?? 0;
4398
- if (O === 0) return;
4399
- const z = O / u * M, H = Math.min(i.barWidth * d + i.barGap, k - 8), et = L - H / 2, E = x - z;
4400
- x -= z;
4401
- const F = i._resolveColor(A.color, $);
4402
- t.beginPath(), t.fillStyle = i._makeGradient(t, F, et, E, et, E + z), i._drawRoundedBar(t, et, E, H, z, $ === d - 1 ? i.barCornerRadius : 0, !0), t.fill();
4421
+ for (let E = 0; E < f; E++) {
4422
+ const R = S + E * k + k / 2;
4423
+ i.showXLabels && (t.font = `${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "center", t.textBaseline = "top", t.fillStyle = h.axisLabelColor, t.fillText(i.categories[E] || "", R, I + M + 5));
4424
+ let A = I + M;
4425
+ i.datasets.forEach((O, W) => {
4426
+ const x = O.data[E] ?? 0;
4427
+ if (x === 0) return;
4428
+ const Y = x / u * M, H = Math.min(i.barWidth * d + i.barGap, k - 8), Q = R - H / 2, P = A - Y;
4429
+ A -= Y;
4430
+ const F = i._resolveColor(O.color, W);
4431
+ t.beginPath(), t.fillStyle = i._makeGradient(t, F, Q, P, Q, P + Y), i._drawRoundedBar(t, Q, P, H, Y, W === d - 1 ? i.barCornerRadius : 0, !0), t.fill();
4403
4432
  });
4404
4433
  }
4405
4434
  } else {
4406
- const k = w / f, _ = d * i.barWidth + Math.max(0, (d - 1) * i.barGap), L = I + M - (0 - g) / u * M;
4407
- for (let x = 0; x < f; x++) {
4408
- const A = S + x * k + k / 2;
4409
- i.showXLabels && (t.font = `${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "center", t.textBaseline = "top", t.fillStyle = h.axisLabelColor, t.fillText(i.categories[x] || "", A, I + M + 5));
4410
- const $ = A - _ / 2;
4411
- i.datasets.forEach((O, z) => {
4412
- const H = O.data[x] ?? 0, et = Math.abs(H / u * M);
4413
- if (et < 1) return;
4414
- const E = $ + z * (i.barWidth + i.barGap), F = H >= 0 ? L - et : L, q = i._resolveColor(O.color, z);
4415
- t.beginPath(), t.fillStyle = i._makeGradient(t, q, E, F, E, F + et), i._drawRoundedBar(t, E, F, i.barWidth, et, i.barCornerRadius, !0), t.fill(), i.showValueOnTop && H !== 0 && (t.font = `bold ${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "center", t.textBaseline = "bottom", t.fillStyle = q, t.fillText(H.toString(), E + i.barWidth / 2, F - 2));
4435
+ const k = w / f, E = d * i.barWidth + Math.max(0, (d - 1) * i.barGap), R = I + M - (0 - g) / u * M;
4436
+ for (let A = 0; A < f; A++) {
4437
+ const O = S + A * k + k / 2;
4438
+ i.showXLabels && (t.font = `${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "center", t.textBaseline = "top", t.fillStyle = h.axisLabelColor, t.fillText(i.categories[A] || "", O, I + M + 5));
4439
+ const W = O - E / 2;
4440
+ i.datasets.forEach((x, Y) => {
4441
+ const H = x.data[A] ?? 0, Q = Math.abs(H / u * M);
4442
+ if (Q < 1) return;
4443
+ const P = W + Y * (i.barWidth + i.barGap), F = H >= 0 ? R - Q : R, U = i._resolveColor(x.color, Y);
4444
+ t.beginPath(), t.fillStyle = i._makeGradient(t, U, P, F, P, F + Q), i._drawRoundedBar(t, P, F, i.barWidth, Q, i.barCornerRadius, !0), t.fill(), i.showValueOnTop && H !== 0 && (t.font = `bold ${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "center", t.textBaseline = "bottom", t.fillStyle = U, t.fillText(H.toString(), P + i.barWidth / 2, F - 2));
4416
4445
  });
4417
4446
  }
4418
4447
  }
@@ -4463,10 +4492,10 @@ class ci {
4463
4492
  i.slices.forEach((S, I) => {
4464
4493
  const w = S.value || 0;
4465
4494
  if (w === 0) return;
4466
- const M = w / v * f, P = -Math.PI / 2 + I * b + C / 2, T = P + b - C, W = i._resolveSliceColor(S, I);
4467
- if (t.beginPath(), t.moveTo(d, u), t.arc(d, u, M, P, T), t.closePath(), t.fillStyle = W + "cc", t.fill(), t.strokeStyle = W, t.lineWidth = 1.5, t.stroke(), i.showLabels) {
4468
- const k = P + (T - P) / 2, _ = d + M * 0.65 * Math.cos(k), L = u + M * 0.65 * Math.sin(k), x = Math.round(w / r * 100);
4469
- t.save(), t.font = `bold ${i.labelFontSize}px Inter, sans-serif`, t.fillStyle = l.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${x}%`, _, L), t.restore();
4495
+ const M = w / v * f, _ = -Math.PI / 2 + I * b + C / 2, T = _ + b - C, $ = i._resolveSliceColor(S, I);
4496
+ if (t.beginPath(), t.moveTo(d, u), t.arc(d, u, M, _, T), t.closePath(), t.fillStyle = $ + "cc", t.fill(), t.strokeStyle = $, t.lineWidth = 1.5, t.stroke(), i.showLabels) {
4497
+ const k = _ + (T - _) / 2, E = d + M * 0.65 * Math.cos(k), R = u + M * 0.65 * Math.sin(k), A = Math.round(w / r * 100);
4498
+ t.save(), t.font = `bold ${i.labelFontSize}px Inter, sans-serif`, t.fillStyle = l.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${A}%`, E, R), t.restore();
4470
4499
  }
4471
4500
  });
4472
4501
  } else {
@@ -4478,17 +4507,17 @@ class ci {
4478
4507
  S += M / r * Math.PI * 2;
4479
4508
  return;
4480
4509
  }
4481
- const P = M / r * Math.PI * 2, T = S + C / 2, W = S + P - C / 2;
4482
- if (W <= T) {
4483
- S += P;
4510
+ const _ = M / r * Math.PI * 2, T = S + C / 2, $ = S + _ - C / 2;
4511
+ if ($ <= T) {
4512
+ S += _;
4484
4513
  return;
4485
4514
  }
4486
4515
  const k = i._resolveSliceColor(I, w);
4487
- if (t.beginPath(), t.fillStyle = k, b <= 0 ? (t.moveTo(d, u), t.arc(d, u, f, T, W), t.lineTo(d, u)) : (t.moveTo(d + f * Math.cos(T), u + f * Math.sin(T)), t.arc(d, u, f, T, W), t.arc(d, u, b, W, T, !0), t.closePath()), t.fill(), i.showLabels) {
4488
- const _ = T + (W - T) / 2, L = b + (f - b) / 2, x = d + L * Math.cos(_), A = u + L * Math.sin(_), $ = Math.round(M / r * 100);
4489
- t.save(), t.font = `bold ${i.labelFontSize}px Inter, sans-serif`, t.fillStyle = l.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${$}%`, x, A), t.restore();
4516
+ if (t.beginPath(), t.fillStyle = k, b <= 0 ? (t.moveTo(d, u), t.arc(d, u, f, T, $), t.lineTo(d, u)) : (t.moveTo(d + f * Math.cos(T), u + f * Math.sin(T)), t.arc(d, u, f, T, $), t.arc(d, u, b, $, T, !0), t.closePath()), t.fill(), i.showLabels) {
4517
+ const E = T + ($ - T) / 2, R = b + (f - b) / 2, A = d + R * Math.cos(E), O = u + R * Math.sin(E), W = Math.round(M / r * 100);
4518
+ t.save(), t.font = `bold ${i.labelFontSize}px Inter, sans-serif`, t.fillStyle = l.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${W}%`, A, O), t.restore();
4490
4519
  }
4491
- S += P;
4520
+ S += _;
4492
4521
  }), i.chartType === "donut" && i.showCenterText && b > 14) {
4493
4522
  const I = Math.round(r), w = Math.min(Math.floor(b * 0.52), 20), M = Math.min(Math.floor(b * 0.26), 10);
4494
4523
  t.textAlign = "center", t.textBaseline = "middle", t.font = `bold ${w}px Inter, sans-serif`, t.fillStyle = l.centerTextColor, t.fillText(I.toString(), d, u - M * 0.5), i.centerLabel && (t.font = `${M}px Inter, sans-serif`, t.fillStyle = l.centerLabelColor, t.fillText(i.centerLabel, d, u + w * 0.6));
@@ -4498,36 +4527,36 @@ class ci {
4498
4527
  t.font = `${i.legendFontSize}px Inter, sans-serif`;
4499
4528
  const v = 2, b = n / v, C = i.legendFontSize + 8, S = a / 2 - c + 10, I = -n / 2 + 10;
4500
4529
  i.slices.forEach((w, M) => {
4501
- const P = M % v, T = Math.floor(M / v), W = I + P * b, k = S + T * C, _ = i._resolveSliceColor(w, M), L = 7;
4502
- t.beginPath(), t.roundRect(W, k - L / 2, L, L, 2), t.fillStyle = _, t.fill(), t.textAlign = "left", t.textBaseline = "middle", t.fillStyle = l.legendColor;
4503
- const x = Math.round((w.value || 0) / r * 100), A = `${w.label || "Item"} ${x}%`, $ = b - L - 20;
4504
- let O = A;
4505
- for (; t.measureText(O).width > $ && O.length > 4; )
4506
- O = O.slice(0, -4) + "…";
4507
- t.fillText(O, W + L + 4, k);
4530
+ const _ = M % v, T = Math.floor(M / v), $ = I + _ * b, k = S + T * C, E = i._resolveSliceColor(w, M), R = 7;
4531
+ t.beginPath(), t.roundRect($, k - R / 2, R, R, 2), t.fillStyle = E, t.fill(), t.textAlign = "left", t.textBaseline = "middle", t.fillStyle = l.legendColor;
4532
+ const A = Math.round((w.value || 0) / r * 100), O = `${w.label || "Item"} ${A}%`, W = b - R - 20;
4533
+ let x = O;
4534
+ for (; t.measureText(x).width > W && x.length > 4; )
4535
+ x = x.slice(0, -4) + "…";
4536
+ t.fillText(x, $ + R + 4, k);
4508
4537
  });
4509
4538
  }
4510
4539
  t.restore();
4511
4540
  }
4512
4541
  getRadioGroupItemIndexAtPointer(t, s, o) {
4513
- var M, P;
4542
+ var M, _;
4514
4543
  const e = t.options || {}, i = this.objectStates.get(t.id) || {}, n = e.optionsList || [];
4515
4544
  if (n.length === 0) return null;
4516
- const a = i.width !== void 0 ? i.width : ((M = t.geometry) == null ? void 0 : M.width) || 180, r = i.height !== void 0 ? i.height : ((P = t.geometry) == null ? void 0 : P.height) || 100, l = e.orientation || "vertical", h = e.itemGap !== void 0 ? e.itemGap : 16, c = e.fontSize || 14, g = this.getWorldTransform(t.id), f = s - g.x, d = o - g.y, u = -g.rotation * (Math.PI / 180), m = Math.cos(u), y = Math.sin(u), v = f * m - d * y, b = f * y + d * m, S = 8 * 2, I = -a / 2, w = -r / 2;
4545
+ const a = i.width !== void 0 ? i.width : ((M = t.geometry) == null ? void 0 : M.width) || 180, r = i.height !== void 0 ? i.height : ((_ = t.geometry) == null ? void 0 : _.height) || 100, l = e.orientation || "vertical", h = e.itemGap !== void 0 ? e.itemGap : 16, c = e.fontSize || 14, g = this.getWorldTransform(t.id), f = s - g.x, d = o - g.y, u = -g.rotation * (Math.PI / 180), m = Math.cos(u), y = Math.sin(u), v = f * m - d * y, b = f * y + d * m, S = 8 * 2, I = -a / 2, w = -r / 2;
4517
4546
  if (l === "vertical") {
4518
4547
  const T = Math.max(S, c) + h;
4519
- for (let W = 0; W < n.length; W++) {
4520
- const k = w + W * T;
4548
+ for (let $ = 0; $ < n.length; $++) {
4549
+ const k = w + $ * T;
4521
4550
  if (v >= I && v <= I + a && b >= k && b <= k + T)
4522
- return W;
4551
+ return $;
4523
4552
  }
4524
4553
  } else {
4525
4554
  let T = I;
4526
- for (let W = 0; W < n.length; W++) {
4527
- const _ = n[W].length * 8, L = S + 6 + _ + h;
4528
- if (v >= T && v <= T + L && b >= w && b <= w + r)
4529
- return W;
4530
- T += L;
4555
+ for (let $ = 0; $ < n.length; $++) {
4556
+ const E = n[$].length * 8, R = S + 6 + E + h;
4557
+ if (v >= T && v <= T + R && b >= w && b <= w + r)
4558
+ return $;
4559
+ T += R;
4531
4560
  }
4532
4561
  }
4533
4562
  return null;
@@ -4594,8 +4623,8 @@ class ci {
4594
4623
  for (let v = 0; v < m.length - 1; v++) {
4595
4624
  const b = m[v === 0 ? v : v - 1], C = m[v], S = m[v + 1], I = m[v + 1 === m.length - 1 ? v + 1 : v + 2];
4596
4625
  for (let w = 1; w <= d; w++) {
4597
- const M = w / d, P = this._catmullRom(b, C, S, I, M);
4598
- t.lineTo(g(v + M), c(P));
4626
+ const M = w / d, _ = this._catmullRom(b, C, S, I, M);
4627
+ t.lineTo(g(v + M), c(_));
4599
4628
  }
4600
4629
  }
4601
4630
  else
@@ -4736,52 +4765,52 @@ class ci {
4736
4765
  t.moveTo(s + r, o), t.lineTo(s + e - l, o), t.arcTo(s + e, o, s + e, o + l, l), t.lineTo(s + e, o + i - h), t.arcTo(s + e, o + i, s + e - h, o + i, h), t.lineTo(s + c, o + i), t.arcTo(s, o + i, s, o + i - c, c), t.lineTo(s, o + r), t.arcTo(s, o, s + r, o, r), t.closePath();
4737
4766
  }
4738
4767
  renderListView(t, s) {
4739
- var L, x, A, $;
4740
- const o = this.objectStates.get(s.id) || {}, e = o.options || s.options || {}, i = o.width !== void 0 ? o.width : ((L = s.geometry) == null ? void 0 : L.width) || 200, n = o.height !== void 0 ? o.height : ((x = s.geometry) == null ? void 0 : x.height) || 300, a = -i / 2, r = -n / 2, l = o.corner_radius !== void 0 ? o.corner_radius : e.corner_radius ?? 0, h = e.orientation || "vertical", c = e.items || [], g = e.itemGap ?? 10, f = e.itemHeight ?? 50, d = e.itemWidth ?? 200, u = e.scrollOffset ?? 0, m = e.padding ?? 0, y = e.glassEffect !== !1, v = e.accentColor || "#3b82f6", b = e.itemTextColor || "#333333", C = e.itemBackgroundColor || "#ffffff", S = e.hoveredIndex ?? null, I = e.activeItemIndex ?? null, w = e.glowIntensity ?? 0, M = e.glowColor || "#3b82f6", P = typeof M == "string" ? M : M.color || (($ = (A = M.stops) == null ? void 0 : A[0]) == null ? void 0 : $.color) || "#3b82f6", T = e.opacity !== void 0 ? e.opacity : s.opacity !== void 0 ? s.opacity : 1;
4768
+ var R, A, O, W;
4769
+ const o = this.objectStates.get(s.id) || {}, e = o.options || s.options || {}, i = o.width !== void 0 ? o.width : ((R = s.geometry) == null ? void 0 : R.width) || 200, n = o.height !== void 0 ? o.height : ((A = s.geometry) == null ? void 0 : A.height) || 300, a = -i / 2, r = -n / 2, l = o.corner_radius !== void 0 ? o.corner_radius : e.corner_radius ?? 0, h = e.orientation || "vertical", c = e.items || [], g = e.itemGap ?? 10, f = e.itemHeight ?? 50, d = e.itemWidth ?? 200, u = e.scrollOffset ?? 0, m = e.padding ?? 0, y = e.glassEffect !== !1, v = e.accentColor || "#3b82f6", b = e.itemTextColor || "#333333", C = e.itemBackgroundColor || "#ffffff", S = e.hoveredIndex ?? null, I = e.activeItemIndex ?? null, w = e.glowIntensity ?? 0, M = e.glowColor || "#3b82f6", _ = typeof M == "string" ? M : M.color || ((W = (O = M.stops) == null ? void 0 : O[0]) == null ? void 0 : W.color) || "#3b82f6", T = e.opacity !== void 0 ? e.opacity : s.opacity !== void 0 ? s.opacity : 1;
4741
4770
  if (t.save(), t.globalAlpha *= T, w > 0) {
4742
- const O = t.getTransform(), z = Math.sqrt(O.a * O.a + O.b * O.b) || 1;
4743
- t.shadowColor = P, t.shadowBlur = w * 2 * z, t.shadowOffsetX = 0, t.shadowOffsetY = 0;
4771
+ const x = t.getTransform(), Y = Math.sqrt(x.a * x.a + x.b * x.b) || 1;
4772
+ t.shadowColor = _, t.shadowBlur = w * 2 * Y, t.shadowOffsetX = 0, t.shadowOffsetY = 0;
4744
4773
  }
4745
4774
  if (y) {
4746
- const O = e.listBackgroundColor || "rgba(31, 41, 55, 0.4)", z = this.createCanvasFill(t, O, i, n);
4747
- t.fillStyle = z || "rgba(31, 41, 55, 0.4)", this.drawListViewRect(t, a, r, i, n, l), t.fill();
4775
+ const x = e.listBackgroundColor || "rgba(31, 41, 55, 0.4)", Y = this.createCanvasFill(t, x, i, n);
4776
+ t.fillStyle = Y || "rgba(31, 41, 55, 0.4)", this.drawListViewRect(t, a, r, i, n, l), t.fill();
4748
4777
  const H = t.createLinearGradient(a, r, a + i, r + n);
4749
4778
  H.addColorStop(0, "rgba(255, 255, 255, 0.15)"), H.addColorStop(0.5, "rgba(255, 255, 255, 0.08)"), H.addColorStop(1, "rgba(255, 255, 255, 0.03)"), t.fillStyle = H, this.drawListViewRect(t, a, r, i, n, l), t.fill(), t.strokeStyle = "rgba(255, 255, 255, 0.25)", t.lineWidth = 1, this.drawListViewRect(t, a, r, i, n, l), t.stroke();
4750
4779
  } else {
4751
- const O = e.listBackgroundColor || "transparent", z = this.createCanvasFill(t, O, i, n);
4752
- z && (t.fillStyle = z, this.drawListViewRect(t, a, r, i, n, l), t.fill());
4780
+ const x = e.listBackgroundColor || "transparent", Y = this.createCanvasFill(t, x, i, n);
4781
+ Y && (t.fillStyle = Y, this.drawListViewRect(t, a, r, i, n, l), t.fill());
4753
4782
  const H = e.borderWidth ?? 0;
4754
4783
  H > 0 && (t.strokeStyle = e.borderColor || "#cccccc", t.lineWidth = H, this.drawListViewRect(t, a, r, i, n, l), t.stroke());
4755
4784
  }
4756
4785
  t.shadowBlur = 0, t.save(), this.drawListViewRect(t, a, r, i, n, l), t.clip();
4757
- const W = typeof m == "number" ? m : h === "vertical" ? m[0] : m[3];
4758
- let k = (h === "vertical" ? r : a) + u + W;
4759
- if (t.textBaseline = "middle", c.forEach((O, z) => {
4760
- const H = h === "vertical" ? i : d, et = h === "vertical" ? f : n, E = h === "vertical" ? a : k, F = h === "vertical" ? k : r, q = S === z, Q = I === z;
4761
- if (Q) {
4762
- const mt = this.createCanvasFill(t, v, H, et);
4763
- t.fillStyle = mt || v;
4764
- const rt = t.globalAlpha;
4765
- t.globalAlpha = rt * 0.8, t.fillRect(E, F, H, et), t.globalAlpha = rt;
4766
- } else if (q)
4767
- t.fillStyle = y ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.05)", t.fillRect(E, F, H, et);
4786
+ const $ = typeof m == "number" ? m : h === "vertical" ? m[0] : m[3];
4787
+ let k = (h === "vertical" ? r : a) + u + $;
4788
+ if (t.textBaseline = "middle", c.forEach((x, Y) => {
4789
+ const H = h === "vertical" ? i : d, Q = h === "vertical" ? f : n, P = h === "vertical" ? a : k, F = h === "vertical" ? k : r, U = S === Y, J = I === Y;
4790
+ if (J) {
4791
+ const pt = this.createCanvasFill(t, v, H, Q);
4792
+ t.fillStyle = pt || v;
4793
+ const ot = t.globalAlpha;
4794
+ t.globalAlpha = ot * 0.8, t.fillRect(P, F, H, Q), t.globalAlpha = ot;
4795
+ } else if (U)
4796
+ t.fillStyle = y ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.05)", t.fillRect(P, F, H, Q);
4768
4797
  else if (C !== "transparent") {
4769
- const mt = this.createCanvasFill(t, C, H, et);
4770
- t.fillStyle = mt || C, t.fillRect(E, F, H, et);
4798
+ const pt = this.createCanvasFill(t, C, H, Q);
4799
+ t.fillStyle = pt || C, t.fillRect(P, F, H, Q);
4771
4800
  }
4772
- if (Q || q) {
4773
- const mt = this.createCanvasFill(t, v, h === "vertical" ? 3 : H, h === "vertical" ? et : 3);
4774
- t.fillStyle = mt || v, h === "vertical" ? t.fillRect(E, F, 3, et) : t.fillRect(E, F + et - 3, H, 3);
4801
+ if (J || U) {
4802
+ const pt = this.createCanvasFill(t, v, h === "vertical" ? 3 : H, h === "vertical" ? Q : 3);
4803
+ t.fillStyle = pt || v, h === "vertical" ? t.fillRect(P, F, 3, Q) : t.fillRect(P, F + Q - 3, H, 3);
4775
4804
  }
4776
- const it = Q ? "#ffffff" : y ? "rgba(255, 255, 255, 0.9)" : b;
4777
- t.fillStyle = it, t.font = Q || q ? "600 14px Inter, sans-serif" : "400 14px Inter, sans-serif";
4778
- const dt = typeof O == "string" ? O : (O == null ? void 0 : O.label) || `Item ${z + 1}`, St = E + (h === "vertical" ? 16 : H / 2), ht = F + et / 2;
4779
- h === "horizontal" ? t.textAlign = "center" : t.textAlign = "left", t.fillText(dt, St, ht), k += (h === "vertical" ? f : d) + g;
4805
+ const it = J ? "#ffffff" : y ? "rgba(255, 255, 255, 0.9)" : b;
4806
+ t.fillStyle = it, t.font = J || U ? "600 14px Inter, sans-serif" : "400 14px Inter, sans-serif";
4807
+ const dt = typeof x == "string" ? x : (x == null ? void 0 : x.label) || `Item ${Y + 1}`, yt = P + (h === "vertical" ? 16 : H / 2), ht = F + Q / 2;
4808
+ h === "horizontal" ? t.textAlign = "center" : t.textAlign = "left", t.fillText(dt, yt, ht), k += (h === "vertical" ? f : d) + g;
4780
4809
  }), t.restore(), e.showScrollbar !== !1) {
4781
- const O = (c.length || 0) * (h === "vertical" ? f : d) + ((c.length || 0) - 1) * g, z = h === "vertical" ? n : i;
4782
- if (O > z) {
4783
- const H = z / O, et = z * H, E = -u / O * z, F = e.scrollbarColor || "rgba(255,255,255,0.3)", q = e.scrollbarWidth || 4;
4784
- t.fillStyle = F, h === "vertical" ? t.fillRect(a + i - q - 2, r + E, q, et) : t.fillRect(a + E, r + n - q - 2, et, q);
4810
+ const x = (c.length || 0) * (h === "vertical" ? f : d) + ((c.length || 0) - 1) * g, Y = h === "vertical" ? n : i;
4811
+ if (x > Y) {
4812
+ const H = Y / x, Q = Y * H, P = -u / x * Y, F = e.scrollbarColor || "rgba(255,255,255,0.3)", U = e.scrollbarWidth || 4;
4813
+ t.fillStyle = F, h === "vertical" ? t.fillRect(a + i - U - 2, r + P, U, Q) : t.fillRect(a + P, r + n - U - 2, Q, U);
4785
4814
  }
4786
4815
  }
4787
4816
  t.restore();
@@ -4799,15 +4828,15 @@ class ci {
4799
4828
  i.hoveredIndex !== e && (i.hoveredIndex = e);
4800
4829
  }
4801
4830
  getListViewItemIndexAtPointer(t, s, o) {
4802
- var W, k;
4831
+ var $, k;
4803
4832
  const e = t.options || {}, i = this.objectStates.get(t.id) || {}, n = e.items || [];
4804
4833
  if (n.length === 0) return null;
4805
- const a = i.width !== void 0 ? i.width : ((W = t.geometry) == null ? void 0 : W.width) || 200, r = i.height !== void 0 ? i.height : ((k = t.geometry) == null ? void 0 : k.height) || 300, l = e.orientation || "vertical", h = e.itemGap ?? 10, c = e.itemHeight ?? 50, g = e.itemWidth ?? 200, f = e.scrollOffset ?? 0, d = e.padding ?? 0, u = this.getWorldTransform(t.id), m = s - u.x, y = o - u.y, v = -u.rotation * (Math.PI / 180), b = Math.cos(v), C = Math.sin(v), S = m * b - y * C, I = m * C + y * b, w = -a / 2, M = -r / 2, P = typeof d == "number" ? d : l === "vertical" ? d[0] : d[3];
4806
- let T = (l === "vertical" ? M : w) + f + P;
4807
- for (let _ = 0; _ < n.length; _++) {
4808
- const L = l === "vertical" ? a : g, x = l === "vertical" ? c : r, A = l === "vertical" ? w : T, $ = l === "vertical" ? T : M;
4809
- if (S >= A && S <= A + L && I >= $ && I <= $ + x)
4810
- return _;
4834
+ const a = i.width !== void 0 ? i.width : (($ = t.geometry) == null ? void 0 : $.width) || 200, r = i.height !== void 0 ? i.height : ((k = t.geometry) == null ? void 0 : k.height) || 300, l = e.orientation || "vertical", h = e.itemGap ?? 10, c = e.itemHeight ?? 50, g = e.itemWidth ?? 200, f = e.scrollOffset ?? 0, d = e.padding ?? 0, u = this.getWorldTransform(t.id), m = s - u.x, y = o - u.y, v = -u.rotation * (Math.PI / 180), b = Math.cos(v), C = Math.sin(v), S = m * b - y * C, I = m * C + y * b, w = -a / 2, M = -r / 2, _ = typeof d == "number" ? d : l === "vertical" ? d[0] : d[3];
4835
+ let T = (l === "vertical" ? M : w) + f + _;
4836
+ for (let E = 0; E < n.length; E++) {
4837
+ const R = l === "vertical" ? a : g, A = l === "vertical" ? c : r, O = l === "vertical" ? w : T, W = l === "vertical" ? T : M;
4838
+ if (S >= O && S <= O + R && I >= W && I <= W + A)
4839
+ return E;
4811
4840
  T += (l === "vertical" ? c : g) + h;
4812
4841
  }
4813
4842
  return null;
@@ -4826,196 +4855,196 @@ class ci {
4826
4855
  if (!e.behaviors || e.behaviors.length === 0) return;
4827
4856
  const i = this.objectStates.get(e.id);
4828
4857
  i && e.behaviors.forEach((n) => {
4829
- var g, f, d, u, m, y, v, b, C, S, I, w, M, P, T, W, k, _, L, x, A, $, O, z, H, et, E, F, q, Q, it, dt, St, ht, mt, rt, Lt, Gt, Pt, Dt, Yt, B, lt, Vt, Mt, Tt, zt, Ut, Jt, qt, Qt, oe, jt, ee, J, ft, U, G, K, Z, At, Ot, kt, Nt, yt, R, ct, Xt, xt, te, $t, Wt, Ft, ot, It, bt, vt, gt, Rt, at, st, nt, wt, V, pt, ut, ce, me, Ie, we, Te, Ht, se, ue, Me, ke, fe, re, le, ye, _e, Ae, Oe, Pe, Re, Le, De, Ve, ze, Ne, He, Ue, qe, Je, Qe, Ke, Ze, je;
4858
+ var g, f, d, u, m, y, v, b, C, S, I, w, M, _, T, $, k, E, R, A, O, W, x, Y, H, Q, P, F, U, J, it, dt, yt, ht, pt, ot, Et, Ft, wt, Xt, Bt, B, nt, zt, kt, _t, Vt, Ut, Jt, qt, Qt, oe, jt, ee, K, ft, q, X, Z, j, Ot, Rt, Tt, Nt, bt, L, ct, Dt, At, te, Wt, Yt, $t, rt, It, vt, Ct, mt, Lt, lt, st, at, Mt, V, ut, gt, ce, me, Ie, we, Te, Ht, se, ue, Me, ke, fe, re, le, ye, _e, Ae, Oe, Pe, Re, Le, De, ze, Ve, Ne, He, Ue, qe, Je, Qe, Ke, Ze, je;
4830
4859
  if (!n.enabled) return;
4831
4860
  const a = n.startTime || 0, r = n.endTime || 1 / 0;
4832
4861
  if (this.currentTime < a || this.currentTime > r) return;
4833
4862
  const l = i.x - s, h = i.y - o, c = Math.sqrt(l * l + h * h);
4834
- if (this.frameCount % 240 === 0 && Math.random() < 0.1 && console.log(`[ExodeUI] Executing ${n.type} on ${e.name}`), n.type === Y.Proximity) {
4835
- const X = ((g = n.settings) == null ? void 0 : g.radius) || 300, N = ((f = n.settings) == null ? void 0 : f.falloff) || "smooth";
4836
- let D = 0;
4837
- c < X && (N === "linear" ? D = 1 - c / X : D = Math.pow(1 - c / X, 2)), n.sensors.forEach((j) => {
4838
- this.applyBehaviorSensor(i, j, D, t, n.settings, e, l, h, c);
4863
+ if (this.frameCount % 240 === 0 && Math.random() < 0.1 && console.log(`[ExodeUI] Executing ${n.type} on ${e.name}`), n.type === G.Proximity) {
4864
+ const D = ((g = n.settings) == null ? void 0 : g.radius) || 300, N = ((f = n.settings) == null ? void 0 : f.falloff) || "smooth";
4865
+ let z = 0;
4866
+ c < D && (N === "linear" ? z = 1 - c / D : z = Math.pow(1 - c / D, 2)), n.sensors.forEach((tt) => {
4867
+ this.applyBehaviorSensor(i, tt, z, t, n.settings, e, l, h, c);
4839
4868
  });
4840
- } else if (n.type === Y.Magnetic) {
4841
- const X = ((d = n.settings) == null ? void 0 : d.radius) || 400, N = ((u = n.settings) == null ? void 0 : u.strength) || 0.5;
4842
- if (c < X && c > 5) {
4843
- const D = 1 - c / X, j = l * D * N, _t = h * D * N;
4844
- i.x -= j * t * 10, i.y -= _t * t * 10;
4869
+ } else if (n.type === G.Magnetic) {
4870
+ const D = ((d = n.settings) == null ? void 0 : d.radius) || 400, N = ((u = n.settings) == null ? void 0 : u.strength) || 0.5;
4871
+ if (c < D && c > 5) {
4872
+ const z = 1 - c / D, tt = l * z * N, Pt = h * z * N;
4873
+ i.x -= tt * t * 10, i.y -= Pt * t * 10;
4845
4874
  }
4846
- } else if (n.type === Y.Repel) {
4847
- const X = ((m = n.settings) == null ? void 0 : m.radius) || 300, N = ((y = n.settings) == null ? void 0 : y.strength) || 1;
4848
- if (c < X) {
4849
- const D = Math.pow(1 - c / X, 2);
4850
- i.x += l / (c || 1) * D * 60 * N * t * 5, i.y += h / (c || 1) * D * 60 * N * t * 5;
4875
+ } else if (n.type === G.Repel) {
4876
+ const D = ((m = n.settings) == null ? void 0 : m.radius) || 300, N = ((y = n.settings) == null ? void 0 : y.strength) || 1;
4877
+ if (c < D) {
4878
+ const z = Math.pow(1 - c / D, 2);
4879
+ i.x += l / (c || 1) * z * 60 * N * t * 5, i.y += h / (c || 1) * z * 60 * N * t * 5;
4851
4880
  }
4852
- } else if (n.type === Y.Orbit) {
4853
- const X = ((v = n.settings) == null ? void 0 : v.speed) || 1, N = ((b = n.settings) == null ? void 0 : b.radius) || 30, D = this.currentTime * X * Math.PI * 2;
4854
- i.x += Math.cos(D) * N * t * 5, i.y += Math.sin(D) * N * t * 5, i.rotation += 2 * t * 5;
4855
- } else if (n.type === Y.Vortex) {
4856
- const X = ((C = n.settings) == null ? void 0 : C.radius) || 400, N = ((S = n.settings) == null ? void 0 : S.speed) || 2, D = ((I = n.settings) == null ? void 0 : I.strength) || 1;
4857
- if (c < X) {
4858
- const j = Math.pow(1 - c / X, 1.5), _t = this.currentTime * N * Math.PI * 2, Et = Math.cos(_t) * 30 - l * 0.4, Bt = Math.sin(_t) * 30 - h * 0.4;
4859
- i.x += Et * j * D * t * 5, i.y += Bt * j * D * t * 5, i.rotation += 5 * j * D * t * 5, i.scale_x *= 1 - j * 0.1 * D * t, i.scale_y *= 1 - j * 0.1 * D * t;
4881
+ } else if (n.type === G.Orbit) {
4882
+ const D = ((v = n.settings) == null ? void 0 : v.speed) || 1, N = ((b = n.settings) == null ? void 0 : b.radius) || 30, z = this.currentTime * D * Math.PI * 2;
4883
+ i.x += Math.cos(z) * N * t * 5, i.y += Math.sin(z) * N * t * 5, i.rotation += 2 * t * 5;
4884
+ } else if (n.type === G.Vortex) {
4885
+ const D = ((C = n.settings) == null ? void 0 : C.radius) || 400, N = ((S = n.settings) == null ? void 0 : S.speed) || 2, z = ((I = n.settings) == null ? void 0 : I.strength) || 1;
4886
+ if (c < D) {
4887
+ const tt = Math.pow(1 - c / D, 1.5), Pt = this.currentTime * N * Math.PI * 2, xt = Math.cos(Pt) * 30 - l * 0.4, Gt = Math.sin(Pt) * 30 - h * 0.4;
4888
+ i.x += xt * tt * z * t * 5, i.y += Gt * tt * z * t * 5, i.rotation += 5 * tt * z * t * 5, i.scale_x *= 1 - tt * 0.1 * z * t, i.scale_y *= 1 - tt * 0.1 * z * t;
4860
4889
  }
4861
- } else if (n.type === Y.Fluid) {
4862
- const X = ((w = n.settings) == null ? void 0 : w.radius) || 300, N = ((M = n.settings) == null ? void 0 : M.strength) || 1;
4863
- if (c < X) {
4864
- const D = Math.pow(1 - c / X, 1.2), j = l / (c || 1) * D * 1.2 * N, _t = h / (c || 1) * D * 1.2 * N;
4865
- i.x += j * 10 * t * 5, i.y += _t * 10 * t * 5, i.scale_x *= 1 + D * 0.3 * N * t, i.scale_y *= 1 + D * 0.3 * N * t;
4890
+ } else if (n.type === G.Fluid) {
4891
+ const D = ((w = n.settings) == null ? void 0 : w.radius) || 300, N = ((M = n.settings) == null ? void 0 : M.strength) || 1;
4892
+ if (c < D) {
4893
+ const z = Math.pow(1 - c / D, 1.2), tt = l / (c || 1) * z * 1.2 * N, Pt = h / (c || 1) * z * 1.2 * N;
4894
+ i.x += tt * 10 * t * 5, i.y += Pt * 10 * t * 5, i.scale_x *= 1 + z * 0.3 * N * t, i.scale_y *= 1 + z * 0.3 * N * t;
4866
4895
  }
4867
- } else if (n.type === Y.Elastic) {
4868
- const X = ((P = n.settings) == null ? void 0 : P.radius) || 300, N = ((T = n.settings) == null ? void 0 : T.strength) || 1;
4869
- if (c < X) {
4870
- const D = 1 - c / X;
4871
- i.scale_x *= 1 + D * 0.4 * N * t, i.scale_y *= 1 + D * 0.4 * N * t;
4896
+ } else if (n.type === G.Elastic) {
4897
+ const D = ((_ = n.settings) == null ? void 0 : _.radius) || 300, N = ((T = n.settings) == null ? void 0 : T.strength) || 1;
4898
+ if (c < D) {
4899
+ const z = 1 - c / D;
4900
+ i.scale_x *= 1 + z * 0.4 * N * t, i.scale_y *= 1 + z * 0.4 * N * t;
4872
4901
  }
4873
- } else if (n.type === Y.Holographic) {
4874
- const X = i.x - this.canvasWidth / 2, N = i.y - this.canvasHeight / 2, D = ((W = n.settings) == null ? void 0 : W.factor) || 25;
4875
- if (i.x -= X / 1e3 * D * t * 5, i.y -= N / 1e3 * D * t * 5, i.style) {
4876
- const j = 1 - Math.min(1, c / 400);
4877
- i.style.exposure = (i.style.exposure || 1) + j * 0.5 * t;
4902
+ } else if (n.type === G.Holographic) {
4903
+ const D = i.x - this.canvasWidth / 2, N = i.y - this.canvasHeight / 2, z = (($ = n.settings) == null ? void 0 : $.factor) || 25;
4904
+ if (i.x -= D / 1e3 * z * t * 5, i.y -= N / 1e3 * z * t * 5, i.style) {
4905
+ const tt = 1 - Math.min(1, c / 400);
4906
+ i.style.exposure = (i.style.exposure || 1) + tt * 0.5 * t;
4878
4907
  }
4879
- } else if (n.type === Y.Sticky) {
4880
- const X = ((k = n.settings) == null ? void 0 : k.radius) || 80, N = ((_ = n.settings) == null ? void 0 : _.strength) || 1;
4881
- if (c < X) {
4882
- const D = Math.pow(1 - c / X, 2);
4883
- i.x -= l * D * N * t * 10, i.y -= h * D * N * t * 10, i.scale_x *= 1 - D * 0.1 * N * t, i.scale_y *= 1 - D * 0.1 * N * t;
4908
+ } else if (n.type === G.Sticky) {
4909
+ const D = ((k = n.settings) == null ? void 0 : k.radius) || 80, N = ((E = n.settings) == null ? void 0 : E.strength) || 1;
4910
+ if (c < D) {
4911
+ const z = Math.pow(1 - c / D, 2);
4912
+ i.x -= l * z * N * t * 10, i.y -= h * z * N * t * 10, i.scale_x *= 1 - z * 0.1 * N * t, i.scale_y *= 1 - z * 0.1 * N * t;
4884
4913
  }
4885
- } else if (n.type === Y.Dilation) {
4886
- const X = ((L = n.settings) == null ? void 0 : L.size) || 120, N = ((x = n.settings) == null ? void 0 : x.strength) || 1;
4887
- if (c < X) {
4888
- const D = 1 - c / X;
4889
- i.scale_x *= 1 + D * 0.5 * N * t, i.scale_y *= 1 + D * 0.5 * N * t;
4914
+ } else if (n.type === G.Dilation) {
4915
+ const D = ((R = n.settings) == null ? void 0 : R.size) || 120, N = ((A = n.settings) == null ? void 0 : A.strength) || 1;
4916
+ if (c < D) {
4917
+ const z = 1 - c / D;
4918
+ i.scale_x *= 1 + z * 0.5 * N * t, i.scale_y *= 1 + z * 0.5 * N * t;
4890
4919
  }
4891
- } else if (n.type === Y.Parallax) {
4892
- const X = ((A = n.settings) == null ? void 0 : A.factor) || 15, N = (($ = n.settings) == null ? void 0 : $.strength) || 1, D = this.canvasWidth / 2, j = this.canvasHeight / 2, _t = this._lastPointerPos || { x: D, y: j }, Et = (_t.x - D) / D, Bt = (_t.y - j) / j, Zt = (((O = e.transform) == null ? void 0 : O.x) ?? 0) + Et * X * N, he = (((z = e.transform) == null ? void 0 : z.y) ?? 0) + Bt * X * N, be = (((H = e.transform) == null ? void 0 : H.rotate_x) ?? 0) - Bt * X * 1.5 * N, ie = (((et = e.transform) == null ? void 0 : et.rotate_y) ?? 0) + Et * X * 1.5 * N, pe = Math.min(1, 10 * t);
4893
- i.x = this.lerp(i.x ?? ((E = e.transform) == null ? void 0 : E.x) ?? 0, Zt, pe), i.y = this.lerp(i.y ?? ((F = e.transform) == null ? void 0 : F.y) ?? 0, he, pe), i.rotate_x = this.lerp(i.rotate_x ?? ((q = e.transform) == null ? void 0 : q.rotate_x) ?? 0, be, pe), i.rotate_y = this.lerp(i.rotate_y ?? ((Q = e.transform) == null ? void 0 : Q.rotate_y) ?? 0, ie, pe);
4894
- } else if (n.type === Y.Fold) {
4920
+ } else if (n.type === G.Parallax) {
4921
+ const D = ((O = n.settings) == null ? void 0 : O.factor) || 15, N = ((W = n.settings) == null ? void 0 : W.strength) || 1, z = this.canvasWidth / 2, tt = this.canvasHeight / 2, Pt = this._lastPointerPos || { x: z, y: tt }, xt = (Pt.x - z) / z, Gt = (Pt.y - tt) / tt, Zt = (((x = e.transform) == null ? void 0 : x.x) ?? 0) + xt * D * N, he = (((Y = e.transform) == null ? void 0 : Y.y) ?? 0) + Gt * D * N, be = (((H = e.transform) == null ? void 0 : H.rotate_x) ?? 0) - Gt * D * 1.5 * N, ie = (((Q = e.transform) == null ? void 0 : Q.rotate_y) ?? 0) + xt * D * 1.5 * N, pe = Math.min(1, 10 * t);
4922
+ i.x = this.lerp(i.x ?? ((P = e.transform) == null ? void 0 : P.x) ?? 0, Zt, pe), i.y = this.lerp(i.y ?? ((F = e.transform) == null ? void 0 : F.y) ?? 0, he, pe), i.rotate_x = this.lerp(i.rotate_x ?? ((U = e.transform) == null ? void 0 : U.rotate_x) ?? 0, be, pe), i.rotate_y = this.lerp(i.rotate_y ?? ((J = e.transform) == null ? void 0 : J.rotate_y) ?? 0, ie, pe);
4923
+ } else if (n.type === G.Fold) {
4895
4924
  if (c < 300) {
4896
- const X = 1 - c / 300, N = (l > 0 ? -1 : 1) * X * 10, D = 1 - X * 0.1, j = h / 300 * X * 20, _t = -(l / 300) * X * 20, Et = Math.min(1, 10 * t);
4897
- i.skew_x = this.lerp(i.skew_x ?? ((it = e.transform) == null ? void 0 : it.skew_x) ?? 0, N, Et), i.scale_y = this.lerp(i.scale_y ?? ((dt = e.transform) == null ? void 0 : dt.scale_y) ?? 1, (((St = e.transform) == null ? void 0 : St.scale_y) ?? 1) * D, Et), i.rotate_x = this.lerp(i.rotate_x ?? ((ht = e.transform) == null ? void 0 : ht.rotate_x) ?? 0, j, Et), i.rotate_y = this.lerp(i.rotate_y ?? ((mt = e.transform) == null ? void 0 : mt.rotate_y) ?? 0, _t, Et), i.style = i.style || { ...e.style }, i.style.artEffect = { enabled: !0, type: "fold_overlay", intensity: ((rt = n.settings) == null ? void 0 : rt.opacity) ?? 0.5 };
4925
+ const D = 1 - c / 300, N = (l > 0 ? -1 : 1) * D * 10, z = 1 - D * 0.1, tt = h / 300 * D * 20, Pt = -(l / 300) * D * 20, xt = Math.min(1, 10 * t);
4926
+ i.skew_x = this.lerp(i.skew_x ?? ((it = e.transform) == null ? void 0 : it.skew_x) ?? 0, N, xt), i.scale_y = this.lerp(i.scale_y ?? ((dt = e.transform) == null ? void 0 : dt.scale_y) ?? 1, (((yt = e.transform) == null ? void 0 : yt.scale_y) ?? 1) * z, xt), i.rotate_x = this.lerp(i.rotate_x ?? ((ht = e.transform) == null ? void 0 : ht.rotate_x) ?? 0, tt, xt), i.rotate_y = this.lerp(i.rotate_y ?? ((pt = e.transform) == null ? void 0 : pt.rotate_y) ?? 0, Pt, xt), i.style = i.style || { ...e.style }, i.style.artEffect = { enabled: !0, type: "fold_overlay", intensity: ((ot = n.settings) == null ? void 0 : ot.opacity) ?? 0.5 };
4898
4927
  }
4899
- } else if (n.type === Y.Crumple) {
4928
+ } else if (n.type === G.Crumple) {
4900
4929
  if (c < 300) {
4901
- const X = 1 - c / 300, N = X * (Math.random() - 0.5) * 5, D = X * (Math.random() - 0.5) * 0.05, j = Math.min(1, 15 * t);
4902
- i.skew_x = this.lerp(i.skew_x ?? ((Lt = e.transform) == null ? void 0 : Lt.skew_x) ?? 0, N, j), i.scale_x = this.lerp(i.scale_x ?? ((Gt = e.transform) == null ? void 0 : Gt.scale_x) ?? 1, (((Pt = e.transform) == null ? void 0 : Pt.scale_x) ?? 1) * (1 + D), j), i.scale_y = this.lerp(i.scale_y ?? ((Dt = e.transform) == null ? void 0 : Dt.scale_y) ?? 1, (((Yt = e.transform) == null ? void 0 : Yt.scale_y) ?? 1) * (1 + D), j), i.style = i.style || { ...e.style }, i.style.artEffect = { enabled: !0, type: "crumple_overlay", intensity: ((B = n.settings) == null ? void 0 : B.intensity) ?? 1, scale: ((lt = n.settings) == null ? void 0 : lt.scale) ?? 2 };
4930
+ const D = 1 - c / 300, N = D * (Math.random() - 0.5) * 5, z = D * (Math.random() - 0.5) * 0.05, tt = Math.min(1, 15 * t);
4931
+ i.skew_x = this.lerp(i.skew_x ?? ((Et = e.transform) == null ? void 0 : Et.skew_x) ?? 0, N, tt), i.scale_x = this.lerp(i.scale_x ?? ((Ft = e.transform) == null ? void 0 : Ft.scale_x) ?? 1, (((wt = e.transform) == null ? void 0 : wt.scale_x) ?? 1) * (1 + z), tt), i.scale_y = this.lerp(i.scale_y ?? ((Xt = e.transform) == null ? void 0 : Xt.scale_y) ?? 1, (((Bt = e.transform) == null ? void 0 : Bt.scale_y) ?? 1) * (1 + z), tt), i.style = i.style || { ...e.style }, i.style.artEffect = { enabled: !0, type: "crumple_overlay", intensity: ((B = n.settings) == null ? void 0 : B.intensity) ?? 1, scale: ((nt = n.settings) == null ? void 0 : nt.scale) ?? 2 };
4903
4932
  }
4904
- } else if (n.type === Y.Squash) {
4905
- const X = ((Vt = n.settings) == null ? void 0 : Vt.strength) || 0.8;
4906
- c < (e.width || 100) && this.isMouseDown ? (i.scale_y = this.lerp(i.scale_y ?? 1, (((Mt = e.transform) == null ? void 0 : Mt.scale_y) ?? 1) * X, 0.3), i.scale_x = this.lerp(i.scale_x ?? 1, (((Tt = e.transform) == null ? void 0 : Tt.scale_x) ?? 1) * (1 + (1 - X) * 0.4), 0.3)) : (i.scale_y = this.lerp(i.scale_y ?? 1, ((zt = e.transform) == null ? void 0 : zt.scale_y) ?? 1, 0.2), i.scale_x = this.lerp(i.scale_x ?? 1, ((Ut = e.transform) == null ? void 0 : Ut.scale_x) ?? 1, 0.2));
4907
- } else if (n.type === Y.TextCounter) {
4908
- const X = ((Jt = n.settings) == null ? void 0 : Jt.duration) || 2, N = ((qt = n.settings) == null ? void 0 : qt.from) || 0, D = ((Qt = n.settings) == null ? void 0 : Qt.to) || 100;
4933
+ } else if (n.type === G.Squash) {
4934
+ const D = ((zt = n.settings) == null ? void 0 : zt.strength) || 0.8;
4935
+ c < (e.width || 100) && this.isMouseDown ? (i.scale_y = this.lerp(i.scale_y ?? 1, (((kt = e.transform) == null ? void 0 : kt.scale_y) ?? 1) * D, 0.3), i.scale_x = this.lerp(i.scale_x ?? 1, (((_t = e.transform) == null ? void 0 : _t.scale_x) ?? 1) * (1 + (1 - D) * 0.4), 0.3)) : (i.scale_y = this.lerp(i.scale_y ?? 1, ((Vt = e.transform) == null ? void 0 : Vt.scale_y) ?? 1, 0.2), i.scale_x = this.lerp(i.scale_x ?? 1, ((Ut = e.transform) == null ? void 0 : Ut.scale_x) ?? 1, 0.2));
4936
+ } else if (n.type === G.TextCounter) {
4937
+ const D = ((Jt = n.settings) == null ? void 0 : Jt.duration) || 2, N = ((qt = n.settings) == null ? void 0 : qt.from) || 0, z = ((Qt = n.settings) == null ? void 0 : Qt.to) || 100;
4909
4938
  n._runtimeStart === void 0 && (n._runtimeStart = this.currentTime);
4910
- const j = this.currentTime - n._runtimeStart, _t = Math.min(1, j / X), Et = Math.floor(N + (D - N) * _t);
4939
+ const tt = this.currentTime - n._runtimeStart, Pt = Math.min(1, tt / D), xt = Math.floor(N + (z - N) * Pt);
4911
4940
  if (((oe = e.geometry) == null ? void 0 : oe.type) === "Text") {
4912
- const Bt = ((jt = n.settings) == null ? void 0 : jt.prefix) || "", Zt = ((ee = n.settings) == null ? void 0 : ee.suffix) || "";
4913
- i.geometry || (i.geometry = { ...e.geometry }), i.geometry.text = `${Bt}${Et}${Zt}`;
4941
+ const Gt = ((jt = n.settings) == null ? void 0 : jt.prefix) || "", Zt = ((ee = n.settings) == null ? void 0 : ee.suffix) || "";
4942
+ i.geometry || (i.geometry = { ...e.geometry }), i.geometry.text = `${Gt}${xt}${Zt}`;
4914
4943
  }
4915
- } else if (n.type === Y.Spotlight) {
4916
- const X = ((J = n.settings) == null ? void 0 : J.radius) || 250, N = ((ft = n.settings) == null ? void 0 : ft.strength) || 1.5;
4917
- if (c < X) {
4918
- const D = Math.pow(1 - c / X, 2);
4919
- i.style || (i.style = { ...e.style }), i.style.adjustments || (i.style.adjustments = { ...(U = e.style) == null ? void 0 : U.adjustments }), i.style.adjustments.exposure = (((K = (G = e.style) == null ? void 0 : G.adjustments) == null ? void 0 : K.exposure) || 0) + D * N * 50;
4944
+ } else if (n.type === G.Spotlight) {
4945
+ const D = ((K = n.settings) == null ? void 0 : K.radius) || 250, N = ((ft = n.settings) == null ? void 0 : ft.strength) || 1.5;
4946
+ if (c < D) {
4947
+ const z = Math.pow(1 - c / D, 2);
4948
+ i.style || (i.style = { ...e.style }), i.style.adjustments || (i.style.adjustments = { ...(q = e.style) == null ? void 0 : q.adjustments }), i.style.adjustments.exposure = (((Z = (X = e.style) == null ? void 0 : X.adjustments) == null ? void 0 : Z.exposure) || 0) + z * N * 50;
4920
4949
  } else
4921
- (Z = i.style) != null && Z.adjustments && (i.style.adjustments.exposure = this.lerp(i.style.adjustments.exposure || 0, ((Ot = (At = e.style) == null ? void 0 : At.adjustments) == null ? void 0 : Ot.exposure) || 0, 0.1));
4922
- } else if (n.type === Y.Noise || n.type === Y.Float) {
4923
- const X = (((kt = n.settings) == null ? void 0 : kt.frequency) || ((Nt = n.settings) == null ? void 0 : Nt.speed) || 1) * 2e-3, N = (((yt = n.settings) == null ? void 0 : yt.amplitude) || ((R = n.settings) == null ? void 0 : R.range) || 50) * (((ct = n.settings) == null ? void 0 : ct.strength) || 1), D = Date.now();
4924
- i.x += Math.sin(D * X) * N * t, i.y += Math.cos(D * X * 0.8) * N * t, i.rotation += Math.sin(D * X * 0.5) * 5 * t;
4925
- } else if (n.type === Y.Pulse) {
4926
- const X = (((Xt = n.settings) == null ? void 0 : Xt.speed) || 1) * 5e-3, N = (((xt = n.settings) == null ? void 0 : xt.scale) || 1.2) - 1, D = Math.sin(Date.now() * X), j = ((te = n.settings) == null ? void 0 : te.strength) || 1;
4927
- i.scale_x *= 1 + D * N * j * t, i.scale_y *= 1 + D * N * j * t, i.style && (i.style.exposure = (i.style.exposure || 1) + Math.max(0, D) * 0.1 * j * t);
4928
- } else if (n.type === Y.Draggable) {
4929
- const X = (($t = n.settings) == null ? void 0 : $t.radius) || 150, N = this.draggingBehaviors.has(e.id);
4930
- if (c < X || N) {
4931
- const D = ((Wt = n.settings) == null ? void 0 : Wt.strength) || 1, j = N ? 1 : Math.max(0, 1 - c / X);
4932
- this.applyBehaviorSensor(i, Kt.PositionX, j * D, t, n.settings), this.applyBehaviorSensor(i, Kt.PositionY, j * D, t, n.settings);
4950
+ (j = i.style) != null && j.adjustments && (i.style.adjustments.exposure = this.lerp(i.style.adjustments.exposure || 0, ((Rt = (Ot = e.style) == null ? void 0 : Ot.adjustments) == null ? void 0 : Rt.exposure) || 0, 0.1));
4951
+ } else if (n.type === G.Noise || n.type === G.Float) {
4952
+ const D = (((Tt = n.settings) == null ? void 0 : Tt.frequency) || ((Nt = n.settings) == null ? void 0 : Nt.speed) || 1) * 2e-3, N = (((bt = n.settings) == null ? void 0 : bt.amplitude) || ((L = n.settings) == null ? void 0 : L.range) || 50) * (((ct = n.settings) == null ? void 0 : ct.strength) || 1), z = Date.now();
4953
+ i.x += Math.sin(z * D) * N * t, i.y += Math.cos(z * D * 0.8) * N * t, i.rotation += Math.sin(z * D * 0.5) * 5 * t;
4954
+ } else if (n.type === G.Pulse) {
4955
+ const D = (((Dt = n.settings) == null ? void 0 : Dt.speed) || 1) * 5e-3, N = (((At = n.settings) == null ? void 0 : At.scale) || 1.2) - 1, z = Math.sin(Date.now() * D), tt = ((te = n.settings) == null ? void 0 : te.strength) || 1;
4956
+ i.scale_x *= 1 + z * N * tt * t, i.scale_y *= 1 + z * N * tt * t, i.style && (i.style.exposure = (i.style.exposure || 1) + Math.max(0, z) * 0.1 * tt * t);
4957
+ } else if (n.type === G.Draggable) {
4958
+ const D = ((Wt = n.settings) == null ? void 0 : Wt.radius) || 150, N = this.draggingBehaviors.has(e.id);
4959
+ if (c < D || N) {
4960
+ const z = ((Yt = n.settings) == null ? void 0 : Yt.strength) || 1, tt = N ? 1 : Math.max(0, 1 - c / D);
4961
+ this.applyBehaviorSensor(i, Kt.PositionX, tt * z, t, n.settings), this.applyBehaviorSensor(i, Kt.PositionY, tt * z, t, n.settings);
4933
4962
  }
4934
- } else if (n.type === Y.Scroll) {
4935
- const X = ((Ft = n.settings) == null ? void 0 : Ft.axis) || "vertical", N = ((ot = n.settings) == null ? void 0 : ot.factor) || 0.5, D = ((It = n.settings) == null ? void 0 : It.strength) || 1, j = ((bt = n.settings) == null ? void 0 : bt.scaleFactor) || 0;
4936
- (X === "vertical" || X === "both") && (i.y += this.scrollOffset.y * N * D * t), (X === "horizontal" || X === "both") && (i.x += this.scrollOffset.x * N * D * t), j !== 0 && (i.scale_x *= 1 + this.scrollOffset.y * j * t, i.scale_y *= 1 + this.scrollOffset.y * j * t);
4937
- } else if (n.type === Y.LookAt) {
4938
- const X = ((vt = n.settings) == null ? void 0 : vt.factor) || 1, N = ((gt = n.settings) == null ? void 0 : gt.strength) || 1, D = Math.atan2(-h, -l) * (180 / Math.PI), j = i.rotation, _t = (D - j + 180) % 360 - 180;
4939
- i.rotation += _t * X * N * t * 10;
4940
- } else if (n.type === Y.Scan) {
4941
- const X = (((Rt = n.settings) == null ? void 0 : Rt.speed) || 1) * 4e-3, N = ((at = n.settings) == null ? void 0 : at.strength) || 1, D = (Math.sin(Date.now() * X) + 1) / 2;
4942
- i.style && (i.style.exposure = (i.style.exposure || 1) + D * N * t * 5), i.x += (D - 0.5) * 20 * N * t;
4943
- } else if (n.type === Y.Glint)
4963
+ } else if (n.type === G.Scroll) {
4964
+ const D = (($t = n.settings) == null ? void 0 : $t.axis) || "vertical", N = ((rt = n.settings) == null ? void 0 : rt.factor) || 0.5, z = ((It = n.settings) == null ? void 0 : It.strength) || 1, tt = ((vt = n.settings) == null ? void 0 : vt.scaleFactor) || 0;
4965
+ (D === "vertical" || D === "both") && (i.y += this.scrollOffset.y * N * z * t), (D === "horizontal" || D === "both") && (i.x += this.scrollOffset.x * N * z * t), tt !== 0 && (i.scale_x *= 1 + this.scrollOffset.y * tt * t, i.scale_y *= 1 + this.scrollOffset.y * tt * t);
4966
+ } else if (n.type === G.LookAt) {
4967
+ const D = ((Ct = n.settings) == null ? void 0 : Ct.factor) || 1, N = ((mt = n.settings) == null ? void 0 : mt.strength) || 1, z = Math.atan2(-h, -l) * (180 / Math.PI), tt = i.rotation, Pt = (z - tt + 180) % 360 - 180;
4968
+ i.rotation += Pt * D * N * t * 10;
4969
+ } else if (n.type === G.Scan) {
4970
+ const D = (((Lt = n.settings) == null ? void 0 : Lt.speed) || 1) * 4e-3, N = ((lt = n.settings) == null ? void 0 : lt.strength) || 1, z = (Math.sin(Date.now() * D) + 1) / 2;
4971
+ i.style && (i.style.exposure = (i.style.exposure || 1) + z * N * t * 5), i.x += (z - 0.5) * 20 * N * t;
4972
+ } else if (n.type === G.Glint)
4944
4973
  i.style = i.style || { ...e.style }, i.style.artEffect = {
4945
4974
  enabled: !0,
4946
4975
  type: "glint_overlay",
4947
4976
  intensity: ((st = n.settings) == null ? void 0 : st.strength) ?? 0.8
4948
4977
  };
4949
- else if (n.type === Y.Ratchet) {
4950
- const X = ((nt = n.settings) == null ? void 0 : nt.steps) || 12, N = (((wt = n.settings) == null ? void 0 : wt.speed) || 1) * 30, D = Math.floor(i.rotation / (360 / X)) * (360 / X);
4951
- i.rotation = this.lerp(i.rotation, D + N * t, 0.1);
4952
- } else if (n.type === Y.Jitter && c < 300) {
4953
- const X = ((V = n.settings) == null ? void 0 : V.strength) || 1, N = (((pt = n.settings) == null ? void 0 : pt.intensity) || 5) * X;
4978
+ else if (n.type === G.Ratchet) {
4979
+ const D = ((at = n.settings) == null ? void 0 : at.steps) || 12, N = (((Mt = n.settings) == null ? void 0 : Mt.speed) || 1) * 30, z = Math.floor(i.rotation / (360 / D)) * (360 / D);
4980
+ i.rotation = this.lerp(i.rotation, z + N * t, 0.1);
4981
+ } else if (n.type === G.Jitter && c < 300) {
4982
+ const D = ((V = n.settings) == null ? void 0 : V.strength) || 1, N = (((ut = n.settings) == null ? void 0 : ut.intensity) || 5) * D;
4954
4983
  i.x += (Math.random() - 0.5) * N * t * 60, i.y += (Math.random() - 0.5) * N * t * 60, i.rotation += (Math.random() - 0.5) * N * t * 120;
4955
- } else if (n.type === Y.Follower) {
4956
- const X = (ut = n.settings) == null ? void 0 : ut.targetId;
4957
- if (X) {
4958
- const N = this.objectStates.get(X);
4984
+ } else if (n.type === G.Follower) {
4985
+ const D = (gt = n.settings) == null ? void 0 : gt.targetId;
4986
+ if (D) {
4987
+ const N = this.objectStates.get(D);
4959
4988
  if (N) {
4960
- const D = ((ce = n.settings) == null ? void 0 : ce.stiffness) || 0.1, j = N.x - i.x, _t = N.y - i.y;
4961
- i.x += j * D * t * 60, i.y += _t * D * t * 60;
4989
+ const z = ((ce = n.settings) == null ? void 0 : ce.stiffness) || 0.1, tt = N.x - i.x, Pt = N.y - i.y;
4990
+ i.x += tt * z * t * 60, i.y += Pt * z * t * 60;
4962
4991
  }
4963
4992
  }
4964
- } else if (n.type === Y.Wrap)
4993
+ } else if (n.type === G.Wrap)
4965
4994
  i.x < 0 ? i.x = this.canvasWidth : i.x > this.canvasWidth && (i.x = 0), i.y < 0 ? i.y = this.canvasHeight : i.y > this.canvasHeight && (i.y = 0);
4966
- else if (n.type === Y.Gravity) {
4967
- const X = ((me = n.settings) == null ? void 0 : me.strength) || 9.8;
4968
- i.y += X * t * 10;
4969
- } else if (n.type === Y.Velocity) {
4970
- const X = ((Ie = n.settings) == null ? void 0 : Ie.vx) || 0, N = ((we = n.settings) == null ? void 0 : we.vy) || 0;
4971
- i.x += X * t * 10, i.y += N * t * 10;
4972
- } else if (n.type === Y.Shear) {
4973
- const X = ((Te = n.settings) == null ? void 0 : Te.strength) || 1, N = ((Ht = n.settings) == null ? void 0 : Ht.radius) || 300;
4995
+ else if (n.type === G.Gravity) {
4996
+ const D = ((me = n.settings) == null ? void 0 : me.strength) || 9.8;
4997
+ i.y += D * t * 10;
4998
+ } else if (n.type === G.Velocity) {
4999
+ const D = ((Ie = n.settings) == null ? void 0 : Ie.vx) || 0, N = ((we = n.settings) == null ? void 0 : we.vy) || 0;
5000
+ i.x += D * t * 10, i.y += N * t * 10;
5001
+ } else if (n.type === G.Shear) {
5002
+ const D = ((Te = n.settings) == null ? void 0 : Te.strength) || 1, N = ((Ht = n.settings) == null ? void 0 : Ht.radius) || 300;
4974
5003
  if (c < N) {
4975
- const D = 1 - c / N;
4976
- i.skew_x = this.lerp(i.skew_x || 0, (((se = e.transform) == null ? void 0 : se.skew_x) || 0) + D * X * 30, 0.1);
5004
+ const z = 1 - c / N;
5005
+ i.skew_x = this.lerp(i.skew_x || 0, (((se = e.transform) == null ? void 0 : se.skew_x) || 0) + z * D * 30, 0.1);
4977
5006
  } else
4978
5007
  i.skew_x = this.lerp(i.skew_x || 0, ((ue = e.transform) == null ? void 0 : ue.skew_x) || 0, 0.05);
4979
- } else if (n.type === Y.Lens) {
4980
- const X = ((Me = n.settings) == null ? void 0 : Me.radius) || 200, N = ((ke = n.settings) == null ? void 0 : ke.strength) || 0.5;
4981
- if (c < X) {
4982
- const D = Math.pow(1 - c / X, 2);
4983
- i.scale_x = this.lerp(i.scale_x ?? 1, (((fe = e.transform) == null ? void 0 : fe.scale_x) ?? 1) * (1 + D * N), 0.2), i.scale_y = this.lerp(i.scale_y ?? 1, (((re = e.transform) == null ? void 0 : re.scale_y) ?? 1) * (1 + D * N), 0.2);
5008
+ } else if (n.type === G.Lens) {
5009
+ const D = ((Me = n.settings) == null ? void 0 : Me.radius) || 200, N = ((ke = n.settings) == null ? void 0 : ke.strength) || 0.5;
5010
+ if (c < D) {
5011
+ const z = Math.pow(1 - c / D, 2);
5012
+ i.scale_x = this.lerp(i.scale_x ?? 1, (((fe = e.transform) == null ? void 0 : fe.scale_x) ?? 1) * (1 + z * N), 0.2), i.scale_y = this.lerp(i.scale_y ?? 1, (((re = e.transform) == null ? void 0 : re.scale_y) ?? 1) * (1 + z * N), 0.2);
4984
5013
  } else
4985
5014
  i.scale_x = this.lerp(i.scale_x ?? 1, ((le = e.transform) == null ? void 0 : le.scale_x) ?? 1, 0.1), i.scale_y = this.lerp(i.scale_y ?? 1, ((ye = e.transform) == null ? void 0 : ye.scale_y) ?? 1, 0.1);
4986
- } else if (n.type === Y.LayoutAnimation) {
4987
- const X = ((_e = n.settings) == null ? void 0 : _e.watchProperties) || ["x", "y", "scale_x", "scale_y", "opacity", "rotation"], N = ((Ae = n.settings) == null ? void 0 : Ae.duration) || 0.3;
5015
+ } else if (n.type === G.LayoutAnimation) {
5016
+ const D = ((_e = n.settings) == null ? void 0 : _e.watchProperties) || ["x", "y", "scale_x", "scale_y", "opacity", "rotation"], N = ((Ae = n.settings) == null ? void 0 : Ae.duration) || 0.3;
4988
5017
  this._layoutAnimCache.has(e.id) || this._layoutAnimCache.set(e.id, /* @__PURE__ */ new Map());
4989
- const D = this._layoutAnimCache.get(e.id);
4990
- for (const j of X) {
4991
- const _t = this.getObjectProperty(i, e, j);
4992
- if (_t === void 0) continue;
4993
- const Et = D.get(j);
4994
- if (!Et)
4995
- D.set(j, {
4996
- from: _t,
4997
- to: _t,
5018
+ const z = this._layoutAnimCache.get(e.id);
5019
+ for (const tt of D) {
5020
+ const Pt = this.getObjectProperty(i, e, tt);
5021
+ if (Pt === void 0) continue;
5022
+ const xt = z.get(tt);
5023
+ if (!xt)
5024
+ z.set(tt, {
5025
+ from: Pt,
5026
+ to: Pt,
4998
5027
  startTime: this.currentTime,
4999
5028
  duration: 0
5000
5029
  });
5001
- else if (Et.to !== _t) {
5002
- const Zt = this.getObjectProperty(i, e, j);
5003
- D.set(j, {
5004
- from: Zt ?? Et.from,
5005
- to: _t,
5030
+ else if (xt.to !== Pt) {
5031
+ const Zt = this.getObjectProperty(i, e, tt);
5032
+ z.set(tt, {
5033
+ from: Zt ?? xt.from,
5034
+ to: Pt,
5006
5035
  startTime: this.currentTime,
5007
5036
  duration: ((Oe = n.settings) == null ? void 0 : Oe.duration) ?? N
5008
5037
  });
5009
5038
  }
5010
- const Bt = D.get(j);
5011
- if (Bt.duration > 0 && Bt.from !== Bt.to) {
5012
- const Zt = this.currentTime - Bt.startTime, he = Math.min(1, Zt / Bt.duration), be = this.applyEasing(he, ((Pe = n.settings) == null ? void 0 : Pe.easing) || "easeOutCubic"), ie = Bt.from + (Bt.to - Bt.from) * be;
5013
- this.setObjectProperty(i, e, j, ie);
5039
+ const Gt = z.get(tt);
5040
+ if (Gt.duration > 0 && Gt.from !== Gt.to) {
5041
+ const Zt = this.currentTime - Gt.startTime, he = Math.min(1, Zt / Gt.duration), be = this.applyEasing(he, ((Pe = n.settings) == null ? void 0 : Pe.easing) || "easeOutCubic"), ie = Gt.from + (Gt.to - Gt.from) * be;
5042
+ this.setObjectProperty(i, e, tt, ie);
5014
5043
  }
5015
5044
  }
5016
- } else if (n.type === Y.StateReactive) {
5045
+ } else if (n.type === G.StateReactive) {
5017
5046
  this._layoutAnimCache.has(e.id) || this._layoutAnimCache.set(e.id, /* @__PURE__ */ new Map());
5018
- const X = this._layoutAnimCache.get(e.id), N = ((Re = n.settings) == null ? void 0 : Re.defaultDuration) || 0.3, D = [
5047
+ const D = this._layoutAnimCache.get(e.id), N = ((Re = n.settings) == null ? void 0 : Re.defaultDuration) || 0.3, z = [
5019
5048
  "x",
5020
5049
  "y",
5021
5050
  "scale_x",
@@ -5030,69 +5059,69 @@ class ci {
5030
5059
  "style.shadow.offsetX",
5031
5060
  "style.shadow.offsetY"
5032
5061
  ];
5033
- for (const j of D) {
5034
- const _t = this.getObjectProperty(i, e, j);
5035
- if (_t === void 0 || typeof _t != "number") continue;
5036
- const Et = X.get(j);
5037
- if (!Et)
5038
- X.set(j, {
5039
- from: _t,
5040
- to: _t,
5062
+ for (const tt of z) {
5063
+ const Pt = this.getObjectProperty(i, e, tt);
5064
+ if (Pt === void 0 || typeof Pt != "number") continue;
5065
+ const xt = D.get(tt);
5066
+ if (!xt)
5067
+ D.set(tt, {
5068
+ from: Pt,
5069
+ to: Pt,
5041
5070
  startTime: this.currentTime,
5042
5071
  duration: 0
5043
5072
  });
5044
- else if (Et.to !== _t) {
5045
- const Zt = this.getObjectProperty(i, e, j);
5046
- X.set(j, {
5047
- from: Zt ?? Et.from,
5048
- to: _t,
5073
+ else if (xt.to !== Pt) {
5074
+ const Zt = this.getObjectProperty(i, e, tt);
5075
+ D.set(tt, {
5076
+ from: Zt ?? xt.from,
5077
+ to: Pt,
5049
5078
  startTime: this.currentTime,
5050
5079
  duration: N
5051
5080
  });
5052
5081
  }
5053
- const Bt = X.get(j);
5054
- if (Bt.duration > 0 && Bt.from !== Bt.to) {
5055
- const Zt = this.currentTime - Bt.startTime, he = Math.min(1, Zt / Bt.duration), be = this.applyEasing(he, ((Le = n.settings) == null ? void 0 : Le.defaultEasing) || "easeOutCubic"), ie = Bt.from + (Bt.to - Bt.from) * be;
5056
- this.setObjectProperty(i, e, j, ie);
5082
+ const Gt = D.get(tt);
5083
+ if (Gt.duration > 0 && Gt.from !== Gt.to) {
5084
+ const Zt = this.currentTime - Gt.startTime, he = Math.min(1, Zt / Gt.duration), be = this.applyEasing(he, ((Le = n.settings) == null ? void 0 : Le.defaultEasing) || "easeOutCubic"), ie = Gt.from + (Gt.to - Gt.from) * be;
5085
+ this.setObjectProperty(i, e, tt, ie);
5057
5086
  }
5058
5087
  }
5059
- } else if (n.type === Y.SpringChain) {
5060
- const X = ((De = n.settings) == null ? void 0 : De.connections) || [], N = ((Ve = n.settings) == null ? void 0 : Ve.globalDamping) || 0.3;
5088
+ } else if (n.type === G.SpringChain) {
5089
+ const D = ((De = n.settings) == null ? void 0 : De.connections) || [], N = ((ze = n.settings) == null ? void 0 : ze.globalDamping) || 0.3;
5061
5090
  this._springChainState.has(e.id) || this._springChainState.set(e.id, /* @__PURE__ */ new Map());
5062
- const D = this._springChainState.get(e.id);
5063
- for (const _t of X) {
5064
- if (!D.has(_t.targetId)) {
5065
- const Et = this.objectStates.get(_t.targetId);
5066
- D.set(_t.targetId, {
5067
- x: (Et == null ? void 0 : Et.x) ?? 0,
5068
- y: (Et == null ? void 0 : Et.y) ?? 0,
5091
+ const z = this._springChainState.get(e.id);
5092
+ for (const Pt of D) {
5093
+ if (!z.has(Pt.targetId)) {
5094
+ const xt = this.objectStates.get(Pt.targetId);
5095
+ z.set(Pt.targetId, {
5096
+ x: (xt == null ? void 0 : xt.x) ?? 0,
5097
+ y: (xt == null ? void 0 : xt.y) ?? 0,
5069
5098
  vx: 0,
5070
5099
  vy: 0
5071
5100
  });
5072
5101
  }
5073
- D.has(e.id) || D.set(e.id, { x: i.x, y: i.y, vx: 0, vy: 0 });
5102
+ z.has(e.id) || z.set(e.id, { x: i.x, y: i.y, vx: 0, vy: 0 });
5074
5103
  }
5075
- const j = D.get(e.id);
5076
- if (j) {
5077
- j.x = i.x, j.y = i.y;
5078
- for (const _t of X) {
5079
- const Et = D.get(_t.targetId);
5080
- if (!Et) continue;
5081
- const Bt = Et.x - j.x, Zt = Et.y - j.y, he = Math.sqrt(Bt * Bt + Zt * Zt) || 1e-3, ie = (he - (_t.restLength || 50)) * (_t.stiffness || 0.8), pe = Bt / he * ie, Fe = Zt / he * ie;
5082
- j.vx += pe * t * 10, j.vy += Fe * t * 10, Et.vx -= pe * t * 10, Et.vy -= Fe * t * 10, j.vx *= 1 - N * t * 10, j.vy *= 1 - N * t * 10, Et.vx *= 1 - N * t * 10, Et.vy *= 1 - N * t * 10;
5083
- const de = this.objectStates.get(_t.targetId);
5084
- de && (de.x += Et.vx * t, de.y += Et.vy * t);
5104
+ const tt = z.get(e.id);
5105
+ if (tt) {
5106
+ tt.x = i.x, tt.y = i.y;
5107
+ for (const Pt of D) {
5108
+ const xt = z.get(Pt.targetId);
5109
+ if (!xt) continue;
5110
+ const Gt = xt.x - tt.x, Zt = xt.y - tt.y, he = Math.sqrt(Gt * Gt + Zt * Zt) || 1e-3, ie = (he - (Pt.restLength || 50)) * (Pt.stiffness || 0.8), pe = Gt / he * ie, Fe = Zt / he * ie;
5111
+ tt.vx += pe * t * 10, tt.vy += Fe * t * 10, xt.vx -= pe * t * 10, xt.vy -= Fe * t * 10, tt.vx *= 1 - N * t * 10, tt.vy *= 1 - N * t * 10, xt.vx *= 1 - N * t * 10, xt.vy *= 1 - N * t * 10;
5112
+ const de = this.objectStates.get(Pt.targetId);
5113
+ de && (de.x += xt.vx * t, de.y += xt.vy * t);
5085
5114
  }
5086
- i.x += j.vx * t, i.y += j.vy * t;
5115
+ i.x += tt.vx * t, i.y += tt.vy * t;
5087
5116
  }
5088
- } else if (n.type === Y.ParticleEmitter) {
5089
- const X = ((ze = n.settings) == null ? void 0 : ze.rate) || 10, N = ((Ne = n.settings) == null ? void 0 : Ne.speed) || 100, D = ((He = n.settings) == null ? void 0 : He.size) || 5, j = ((Ue = n.settings) == null ? void 0 : Ue.lifetime) || 2, _t = ((qe = n.settings) == null ? void 0 : qe.gravity) || 0, Et = ((Je = n.settings) == null ? void 0 : Je.color) || "#ffffff", Bt = ((Qe = n.settings) == null ? void 0 : Qe.maxParticles) || 200, Zt = (Ke = n.settings) != null && Ke.rateInputId ? this.inputs.get(n.settings.rateInputId) ?? X : X, he = (Ze = n.settings) != null && Ze.gravityInputId ? this.inputs.get(n.settings.gravityInputId) ?? _t : _t, be = (je = n.settings) != null && je.speedInputId ? this.inputs.get(n.settings.speedInputId) ?? N : N;
5117
+ } else if (n.type === G.ParticleEmitter) {
5118
+ const D = ((Ve = n.settings) == null ? void 0 : Ve.rate) || 10, N = ((Ne = n.settings) == null ? void 0 : Ne.speed) || 100, z = ((He = n.settings) == null ? void 0 : He.size) || 5, tt = ((Ue = n.settings) == null ? void 0 : Ue.lifetime) || 2, Pt = ((qe = n.settings) == null ? void 0 : qe.gravity) || 0, xt = ((Je = n.settings) == null ? void 0 : Je.color) || "#ffffff", Gt = ((Qe = n.settings) == null ? void 0 : Qe.maxParticles) || 200, Zt = (Ke = n.settings) != null && Ke.rateInputId ? this.inputs.get(n.settings.rateInputId) ?? D : D, he = (Ze = n.settings) != null && Ze.gravityInputId ? this.inputs.get(n.settings.gravityInputId) ?? Pt : Pt, be = (je = n.settings) != null && je.speedInputId ? this.inputs.get(n.settings.speedInputId) ?? N : N;
5090
5119
  this._emitterPools.has(e.id) || this._emitterPools.set(e.id, []);
5091
5120
  const ie = this._emitterPools.get(e.id);
5092
5121
  let pe = 0;
5093
5122
  n._pendingBurst && n._pendingBurst > 0 && (pe = n._pendingBurst, n._pendingBurst = 0);
5094
5123
  const Fe = Math.floor(Zt * t) + (pe || 0);
5095
- for (let de = 0; de < Math.min(Fe, Bt - ie.length); de++) {
5124
+ for (let de = 0; de < Math.min(Fe, Gt - ie.length); de++) {
5096
5125
  const ne = Math.random() * Math.PI * 2, ts = be * (0.5 + Math.random() * 0.5);
5097
5126
  ie.push({
5098
5127
  x: i.x,
@@ -5100,9 +5129,9 @@ class ci {
5100
5129
  vx: Math.cos(ne) * ts,
5101
5130
  vy: Math.sin(ne) * ts,
5102
5131
  life: 0,
5103
- maxLife: j * (0.5 + Math.random() * 0.5),
5104
- size: D * (0.5 + Math.random()),
5105
- color: Et,
5132
+ maxLife: tt * (0.5 + Math.random() * 0.5),
5133
+ size: z * (0.5 + Math.random()),
5134
+ color: xt,
5106
5135
  opacity: 1
5107
5136
  });
5108
5137
  }
@@ -5115,88 +5144,88 @@ class ci {
5115
5144
  });
5116
5145
  }
5117
5146
  applyBehaviorSensor(t, s, o, e, i, n, a = 0, r = 0, l = 1) {
5118
- var d, u, m, y, v, b, C, S, I, w, M, P, T, W, k, _, L, x, A, $, O, z, H, et;
5147
+ var d, u, m, y, v, b, C, S, I, w, M, _, T, $, k, E, R, A, O, W, x, Y, H, Q;
5119
5148
  const h = (i == null ? void 0 : i.intensity) || (i == null ? void 0 : i.strength) || 1, c = Math.min(1, 15 * e), g = l > 0 ? a / l : 0, f = l > 0 ? r / l : 0;
5120
5149
  switch (s) {
5121
5150
  case Kt.Scale: {
5122
- const E = ((d = n == null ? void 0 : n.transform) == null ? void 0 : d.scale_x) ?? 1, F = ((u = n == null ? void 0 : n.transform) == null ? void 0 : u.scale_y) ?? 1, q = E * (1 + o * h * 0.4), Q = F * (1 + o * h * 0.4);
5123
- t.scale_x = (t.scale_x ?? E) * (1 - c) + q * c, t.scale_y = (t.scale_y ?? F) * (1 - c) + Q * c;
5151
+ const P = ((d = n == null ? void 0 : n.transform) == null ? void 0 : d.scale_x) ?? 1, F = ((u = n == null ? void 0 : n.transform) == null ? void 0 : u.scale_y) ?? 1, U = P * (1 + o * h * 0.4), J = F * (1 + o * h * 0.4);
5152
+ t.scale_x = (t.scale_x ?? P) * (1 - c) + U * c, t.scale_y = (t.scale_y ?? F) * (1 - c) + J * c;
5124
5153
  break;
5125
5154
  }
5126
5155
  case Kt.Opacity: {
5127
- const E = ((m = n == null ? void 0 : n.transform) == null ? void 0 : m.opacity) ?? 100, F = Math.max(0, Math.min(100, E - o * h * 100));
5128
- t.opacity = (t.opacity ?? E) * (1 - c) + F * c;
5156
+ const P = ((m = n == null ? void 0 : n.transform) == null ? void 0 : m.opacity) ?? 100, F = Math.max(0, Math.min(100, P - o * h * 100));
5157
+ t.opacity = (t.opacity ?? P) * (1 - c) + F * c;
5129
5158
  break;
5130
5159
  }
5131
5160
  case Kt.RotateZ: {
5132
- const E = ((y = n == null ? void 0 : n.transform) == null ? void 0 : y.rotation) ?? 0, F = E + o * h * 45;
5133
- t.rotation = (t.rotation ?? E) * (1 - c) + F * c;
5161
+ const P = ((y = n == null ? void 0 : n.transform) == null ? void 0 : y.rotation) ?? 0, F = P + o * h * 45;
5162
+ t.rotation = (t.rotation ?? P) * (1 - c) + F * c;
5134
5163
  break;
5135
5164
  }
5136
5165
  case Kt.RotateX: {
5137
- const E = ((v = n == null ? void 0 : n.transform) == null ? void 0 : v.rotate_x) ?? 0, F = E - f * o * h * 60;
5138
- t.rotate_x = (t.rotate_x ?? E) * (1 - c) + F * c;
5166
+ const P = ((v = n == null ? void 0 : n.transform) == null ? void 0 : v.rotate_x) ?? 0, F = P - f * o * h * 60;
5167
+ t.rotate_x = (t.rotate_x ?? P) * (1 - c) + F * c;
5139
5168
  break;
5140
5169
  }
5141
5170
  case Kt.RotateY: {
5142
- const E = ((b = n == null ? void 0 : n.transform) == null ? void 0 : b.rotate_y) ?? 0, F = E + g * o * h * 60;
5143
- t.rotate_y = (t.rotate_y ?? E) * (1 - c) + F * c;
5171
+ const P = ((b = n == null ? void 0 : n.transform) == null ? void 0 : b.rotate_y) ?? 0, F = P + g * o * h * 60;
5172
+ t.rotate_y = (t.rotate_y ?? P) * (1 - c) + F * c;
5144
5173
  break;
5145
5174
  }
5146
5175
  case Kt.PositionX: {
5147
- const E = ((C = n == null ? void 0 : n.transform) == null ? void 0 : C.x) ?? 0, F = E - g * o * h * 40;
5148
- t.x = (t.x ?? E) * (1 - c) + F * c;
5176
+ const P = ((C = n == null ? void 0 : n.transform) == null ? void 0 : C.x) ?? 0, F = P - g * o * h * 40;
5177
+ t.x = (t.x ?? P) * (1 - c) + F * c;
5149
5178
  break;
5150
5179
  }
5151
5180
  case Kt.PositionY: {
5152
- const E = ((S = n == null ? void 0 : n.transform) == null ? void 0 : S.y) ?? 0, F = E - f * o * h * 40;
5153
- t.y = (t.y ?? E) * (1 - c) + F * c;
5181
+ const P = ((S = n == null ? void 0 : n.transform) == null ? void 0 : S.y) ?? 0, F = P - f * o * h * 40;
5182
+ t.y = (t.y ?? P) * (1 - c) + F * c;
5154
5183
  break;
5155
5184
  }
5156
5185
  case Kt.SkewX: {
5157
- const E = ((I = n == null ? void 0 : n.transform) == null ? void 0 : I.skew_x) ?? 0, F = E + g * o * h * 45;
5158
- t.skew_x = (t.skew_x ?? E) * (1 - c) + F * c, t.skew_x > 85 && (t.skew_x = 85), t.skew_x < -85 && (t.skew_x = -85);
5186
+ const P = ((I = n == null ? void 0 : n.transform) == null ? void 0 : I.skew_x) ?? 0, F = P + g * o * h * 45;
5187
+ t.skew_x = (t.skew_x ?? P) * (1 - c) + F * c, t.skew_x > 85 && (t.skew_x = 85), t.skew_x < -85 && (t.skew_x = -85);
5159
5188
  break;
5160
5189
  }
5161
5190
  case Kt.Blur: {
5162
5191
  t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.blur || (t.style.blur = { ...(w = n == null ? void 0 : n.style) == null ? void 0 : w.blur });
5163
- const E = ((P = (M = n == null ? void 0 : n.style) == null ? void 0 : M.blur) == null ? void 0 : P.amount) || 0, F = E + o * ((i == null ? void 0 : i.blur) || 20) * h;
5164
- t.style.blur.amount = (t.style.blur.amount ?? E) * (1 - c) + F * c;
5192
+ const P = ((_ = (M = n == null ? void 0 : n.style) == null ? void 0 : M.blur) == null ? void 0 : _.amount) || 0, F = P + o * ((i == null ? void 0 : i.blur) || 20) * h;
5193
+ t.style.blur.amount = (t.style.blur.amount ?? P) * (1 - c) + F * c;
5165
5194
  break;
5166
5195
  }
5167
5196
  case Kt.Exposure: {
5168
5197
  t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(T = n == null ? void 0 : n.style) == null ? void 0 : T.adjustments });
5169
- const E = ((k = (W = n == null ? void 0 : n.style) == null ? void 0 : W.adjustments) == null ? void 0 : k.exposure) || 0, F = E + o * ((i == null ? void 0 : i.exposure) || 50) * h;
5170
- t.style.adjustments.exposure = (t.style.adjustments.exposure ?? E) * (1 - c) + F * c;
5198
+ const P = ((k = ($ = n == null ? void 0 : n.style) == null ? void 0 : $.adjustments) == null ? void 0 : k.exposure) || 0, F = P + o * ((i == null ? void 0 : i.exposure) || 50) * h;
5199
+ t.style.adjustments.exposure = (t.style.adjustments.exposure ?? P) * (1 - c) + F * c;
5171
5200
  break;
5172
5201
  }
5173
5202
  case Kt.HueShift: {
5174
- t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(_ = n == null ? void 0 : n.style) == null ? void 0 : _.adjustments });
5175
- const E = ((x = (L = n == null ? void 0 : n.style) == null ? void 0 : L.adjustments) == null ? void 0 : x.hue) || 0, F = E + o * ((i == null ? void 0 : i.hue) || 180) * h;
5176
- t.style.adjustments.hue = (t.style.adjustments.hue ?? E) * (1 - c) + F * c;
5203
+ t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(E = n == null ? void 0 : n.style) == null ? void 0 : E.adjustments });
5204
+ const P = ((A = (R = n == null ? void 0 : n.style) == null ? void 0 : R.adjustments) == null ? void 0 : A.hue) || 0, F = P + o * ((i == null ? void 0 : i.hue) || 180) * h;
5205
+ t.style.adjustments.hue = (t.style.adjustments.hue ?? P) * (1 - c) + F * c;
5177
5206
  break;
5178
5207
  }
5179
5208
  case Kt.Negative: {
5180
- t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(A = n == null ? void 0 : n.style) == null ? void 0 : A.adjustments });
5181
- const E = ((O = ($ = n == null ? void 0 : n.style) == null ? void 0 : $.adjustments) == null ? void 0 : O.negative) || 0, F = E + o * ((i == null ? void 0 : i.negative) || 100) * h;
5182
- t.style.adjustments.negative = (t.style.adjustments.negative ?? E) * (1 - c) + F * c;
5209
+ t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(O = n == null ? void 0 : n.style) == null ? void 0 : O.adjustments });
5210
+ const P = ((x = (W = n == null ? void 0 : n.style) == null ? void 0 : W.adjustments) == null ? void 0 : x.negative) || 0, F = P + o * ((i == null ? void 0 : i.negative) || 100) * h;
5211
+ t.style.adjustments.negative = (t.style.adjustments.negative ?? P) * (1 - c) + F * c;
5183
5212
  break;
5184
5213
  }
5185
5214
  case Kt.CornerRadius: {
5186
- const E = ((z = n == null ? void 0 : n.transform) == null ? void 0 : z.corner_radius) || 0, F = E + o * h * 50;
5187
- t.corner_radius = (t.corner_radius ?? E) * (1 - c) + F * c;
5215
+ const P = ((Y = n == null ? void 0 : n.transform) == null ? void 0 : Y.corner_radius) || 0, F = P + o * h * 50;
5216
+ t.corner_radius = (t.corner_radius ?? P) * (1 - c) + F * c;
5188
5217
  break;
5189
5218
  }
5190
5219
  case Kt.StrokeWidth: {
5191
5220
  t.style || (t.style = { ...n == null ? void 0 : n.style });
5192
- const E = ((H = n == null ? void 0 : n.style) == null ? void 0 : H.borderWidth) || 0, F = E + o * h * 10;
5193
- t.style.borderWidth = (t.style.borderWidth ?? E) * (1 - c) + F * c;
5221
+ const P = ((H = n == null ? void 0 : n.style) == null ? void 0 : H.borderWidth) || 0, F = P + o * h * 10;
5222
+ t.style.borderWidth = (t.style.borderWidth ?? P) * (1 - c) + F * c;
5194
5223
  break;
5195
5224
  }
5196
5225
  case Kt.LetterSpacing: {
5197
5226
  t.geometry || (t.geometry = {});
5198
- const E = ((et = n == null ? void 0 : n.geometry) == null ? void 0 : et.letterSpacing) || 0, F = E + o * h * 10;
5199
- t.geometry.letterSpacing = (t.geometry.letterSpacing ?? E) * (1 - c) + F * c;
5227
+ const P = ((Q = n == null ? void 0 : n.geometry) == null ? void 0 : Q.letterSpacing) || 0, F = P + o * h * 10;
5228
+ t.geometry.letterSpacing = (t.geometry.letterSpacing ?? P) * (1 - c) + F * c;
5200
5229
  break;
5201
5230
  }
5202
5231
  }
@@ -5302,75 +5331,75 @@ const yi = Cs(({
5302
5331
  mouseX: I,
5303
5332
  mouseY: w,
5304
5333
  isMouseDown: M,
5305
- inputs: P,
5334
+ inputs: _,
5306
5335
  interactive: T = !0,
5307
- onNavigation: W
5336
+ onNavigation: $
5308
5337
  }, k) => {
5309
- const _ = ve(null), L = ve(new ci()), x = ve(void 0), A = ve(0), $ = ve(null), O = ve(b), [, z] = ds(p || null), H = ve(!0);
5310
- Ss(k, () => _.current), Se(() => (H.current = !0, () => {
5311
- H.current = !1, x.current && cancelAnimationFrame(x.current);
5338
+ const E = ve(null), R = ve(new ci()), A = ve(void 0), O = ve(0), W = ve(null), x = ve(b), [, Y] = ds(p || null), H = ve(!0);
5339
+ Ss(k, () => E.current), Se(() => (H.current = !0, () => {
5340
+ H.current = !1, A.current && cancelAnimationFrame(A.current);
5312
5341
  }), []), Se(() => {
5313
- L.current.setLayout(e, i);
5342
+ R.current.setLayout(e, i);
5314
5343
  }, [e, i]), Se(() => {
5315
- const E = L.current;
5316
- a && E.setTriggerCallback(a), r && E.setInputUpdateCallback((F, q) => r({ [F]: q })), l && E.setComponentChangeCallback((F) => l(F)), h && E.setToggleCallback(h), c && E.setInputChangeCallback(c), g && E.setInputFocusCallback(g), f && E.setInputBlurCallback(f), d && E.setOnLogCallback((F) => d(F, "info")), u && E.setLogicUpdateCallback(u), m && E.setButtonClickCallback(m), y && E.setGraphPointClickCallback((F) => y(F.objectId, F)), W && E.setNavigationCallback(W);
5317
- }, [a, r, l, h, c, g, f, d, u, m, y, W]), Se(() => {
5344
+ const P = R.current;
5345
+ a && P.setTriggerCallback(a), r && P.setInputUpdateCallback((F, U) => r({ [F]: U })), l && P.setComponentChangeCallback((F) => l(F)), h && P.setToggleCallback(h), c && P.setInputChangeCallback(c), g && P.setInputFocusCallback(g), f && P.setInputBlurCallback(f), d && P.setOnLogCallback((F) => d(F, "info")), u && P.setLogicUpdateCallback(u), m && P.setButtonClickCallback(m), y && P.setGraphPointClickCallback((F) => y(F.objectId, F)), $ && P.setNavigationCallback($);
5346
+ }, [a, r, l, h, c, g, f, d, u, m, y, $]), Se(() => {
5318
5347
  (async () => {
5319
5348
  let F = p;
5320
5349
  if (t && !p)
5321
5350
  try {
5322
5351
  t.startsWith("{") ? F = JSON.parse(t) : F = await (await fetch(t)).json();
5323
- } catch (q) {
5324
- console.error("[ExodeUI] Failed to load src:", q);
5352
+ } catch (U) {
5353
+ console.error("[ExodeUI] Failed to load src:", U);
5325
5354
  }
5326
5355
  if (F) {
5327
- const q = L.current, Q = F.id || F.name || "default";
5328
- ($.current !== Q || O.current !== b) && (q.load(F), $.current = Q, O.current = b, z(F), A.current = 0, q.advance(0)), n && n(q);
5356
+ const U = R.current, J = F.id || F.name || "default";
5357
+ (W.current !== J || x.current !== b) && (U.load(F), W.current = J, x.current = b, Y(F), O.current = 0, U.advance(0)), n && n(U);
5329
5358
  }
5330
5359
  })();
5331
5360
  }, [p == null ? void 0 : p.id, t, b]), Se(() => {
5332
- const E = (F) => {
5333
- if (!L.current || !H.current) return;
5334
- const q = L.current, Q = _.current;
5335
- if (!Q) return;
5336
- const it = Q.getContext("2d");
5361
+ const P = (F) => {
5362
+ if (!R.current || !H.current) return;
5363
+ const U = R.current, J = E.current;
5364
+ if (!J) return;
5365
+ const it = J.getContext("2d");
5337
5366
  if (!it) return;
5338
5367
  const dt = F / 1e3;
5339
- A.current === 0 && (A.current = dt);
5340
- let St = dt - A.current;
5341
- St > 0.1 && (St = 0.1), A.current = dt;
5342
- const ht = Q.getBoundingClientRect(), mt = window.devicePixelRatio || 1, rt = Math.round(ht.width * mt), Lt = Math.round(ht.height * mt);
5343
- (Q.width !== rt || Q.height !== Lt) && (Q.width = rt, Q.height = Lt), o ? q.advance(St) : v !== void 0 && q.seek(v), q.render(it, Q.width, Q.height), x.current = requestAnimationFrame(E);
5368
+ O.current === 0 && (O.current = dt);
5369
+ let yt = dt - O.current;
5370
+ yt > 0.1 && (yt = 0.1), O.current = dt;
5371
+ const ht = J.getBoundingClientRect(), pt = window.devicePixelRatio || 1, ot = Math.round(ht.width * pt), Et = Math.round(ht.height * pt);
5372
+ (J.width !== ot || J.height !== Et) && (J.width = ot, J.height = Et), o ? U.advance(yt) : v !== void 0 && U.seek(v), U.render(it, J.width, J.height), A.current = requestAnimationFrame(P);
5344
5373
  };
5345
- return x.current = requestAnimationFrame(E), () => {
5346
- x.current && cancelAnimationFrame(x.current);
5374
+ return A.current = requestAnimationFrame(P), () => {
5375
+ A.current && cancelAnimationFrame(A.current);
5347
5376
  };
5348
5377
  }, [o, v]), Se(() => {
5349
- const E = L.current;
5350
- C !== void 0 && E.updateInput("scrollY", C), S !== void 0 && E.updateInput("scrollX", S), I !== void 0 && E.updateInput("mouseX", I), w !== void 0 && E.updateInput("mouseY", w), M !== void 0 && E.updateInput("isMouseDown", M), P && Object.entries(P).forEach(([F, q]) => E.updateInput(F, q));
5351
- }, [C, S, I, w, M, P]);
5352
- const et = (E, F) => {
5353
- if (!T || !_.current) return;
5354
- const q = _.current, Q = q.getBoundingClientRect(), it = E.clientX - Q.left, dt = E.clientY - Q.top, St = window.devicePixelRatio || 1;
5355
- L.current.handlePointerInput(F, it * St, dt * St, q.width, q.height);
5378
+ const P = R.current;
5379
+ C !== void 0 && P.updateInput("scrollY", C), S !== void 0 && P.updateInput("scrollX", S), I !== void 0 && P.updateInput("mouseX", I), w !== void 0 && P.updateInput("mouseY", w), M !== void 0 && P.updateInput("isMouseDown", M), _ && Object.entries(_).forEach(([F, U]) => P.updateInput(F, U));
5380
+ }, [C, S, I, w, M, _]);
5381
+ const Q = (P, F) => {
5382
+ if (!T || !E.current) return;
5383
+ const U = E.current, J = U.getBoundingClientRect(), it = P.clientX - J.left, dt = P.clientY - J.top, yt = window.devicePixelRatio || 1;
5384
+ R.current.handlePointerInput(F, it * yt, dt * yt, U.width, U.height);
5356
5385
  };
5357
5386
  return /* @__PURE__ */ Ce(
5358
5387
  "canvas",
5359
5388
  {
5360
- ref: _,
5361
- onPointerDown: (E) => {
5389
+ ref: E,
5390
+ onPointerDown: (P) => {
5362
5391
  var F;
5363
- et(E, "down"), (F = _.current) == null || F.focus();
5392
+ Q(P, "down"), (F = E.current) == null || F.focus();
5364
5393
  },
5365
- onPointerMove: (E) => et(E, "move"),
5366
- onPointerUp: (E) => et(E, "up"),
5367
- onPointerCancel: (E) => et(E, "up"),
5368
- onClick: (E) => et(E, "click"),
5369
- onWheel: (E) => {
5370
- L.current.handleWheel(E.deltaX, E.deltaY);
5394
+ onPointerMove: (P) => Q(P, "move"),
5395
+ onPointerUp: (P) => Q(P, "up"),
5396
+ onPointerCancel: (P) => Q(P, "up"),
5397
+ onClick: (P) => Q(P, "click"),
5398
+ onWheel: (P) => {
5399
+ R.current.handleWheel(P.deltaX, P.deltaY);
5371
5400
  },
5372
- onKeyDown: (E) => L.current.handleKeyDown(E.nativeEvent),
5373
- onContextMenu: (E) => E.preventDefault(),
5401
+ onKeyDown: (P) => R.current.handleKeyDown(P.nativeEvent),
5402
+ onContextMenu: (P) => P.preventDefault(),
5374
5403
  tabIndex: 0,
5375
5404
  style: {
5376
5405
  ...s,
@@ -5488,17 +5517,17 @@ const vi = ({ artboard: p, config: t }) => {
5488
5517
  ]
5489
5518
  }
5490
5519
  );
5491
- }, fi = "6.3.19", hi = {
5520
+ }, fi = "6.3.20", hi = {
5492
5521
  version: fi
5493
5522
  }, Ci = hi.version;
5494
5523
  export {
5495
5524
  Kt as BehaviorSensor,
5496
- Y as BehaviorType,
5525
+ G as BehaviorType,
5497
5526
  Ms as ConditionOp,
5498
5527
  vi as ExodeSEO,
5499
5528
  yi as ExodeUICanvas,
5500
5529
  ci as ExodeUIEngine,
5501
- Ct as LogicOp,
5530
+ St as LogicOp,
5502
5531
  Ci as VERSION,
5503
5532
  bi as useExodeUI
5504
5533
  };