exodeui 6.3.36 → 6.3.37
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.js +17 -17
- package/dist/index.mjs +448 -436
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -30,7 +30,7 @@ function Ps(g, t, i) {
|
|
|
30
30
|
}
|
|
31
31
|
const Ge = /* @__PURE__ */ new Map();
|
|
32
32
|
function ps(g) {
|
|
33
|
-
var
|
|
33
|
+
var I;
|
|
34
34
|
const {
|
|
35
35
|
text: t,
|
|
36
36
|
fontFamily: i = "Inter",
|
|
@@ -135,7 +135,7 @@ function ps(g) {
|
|
|
135
135
|
} finally {
|
|
136
136
|
r !== 0 && m && (CanvasRenderingContext2D.prototype.measureText = m);
|
|
137
137
|
}
|
|
138
|
-
let w = (C == null ? void 0 : C.height) !== void 0 && C.height > 0 ? C.height : (((
|
|
138
|
+
let w = (C == null ? void 0 : C.height) !== void 0 && C.height > 0 ? C.height : (((I = C == null ? void 0 : C.lines) == null ? void 0 : I.length) || 0) * S * o;
|
|
139
139
|
if (f > 0 && C && C.lines && C.lines.length > 1) {
|
|
140
140
|
let k = 0;
|
|
141
141
|
const T = b.fullText || t;
|
|
@@ -144,12 +144,12 @@ function ps(g) {
|
|
|
144
144
|
` || T[k] === "\r") && (w += f, k++, T[k - 1] === "\r" && T[k] === `
|
|
145
145
|
` && k++);
|
|
146
146
|
}
|
|
147
|
-
let
|
|
148
|
-
return g.composer === "every-line" &&
|
|
147
|
+
let M = (C == null ? void 0 : C.lines) || [];
|
|
148
|
+
return g.composer === "every-line" && M.length > 1 && (M = _s(M)), g.balanceRaggedLines === !0 && M.length > 1 && (M = Ps(M)), {
|
|
149
149
|
width: a,
|
|
150
150
|
height: w,
|
|
151
|
-
lineCount:
|
|
152
|
-
lines:
|
|
151
|
+
lineCount: M.length,
|
|
152
|
+
lines: M
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
155
|
function is(g, t, i) {
|
|
@@ -217,10 +217,10 @@ function Es(g, t, i) {
|
|
|
217
217
|
r && v.length > 0 && (f ? m + s + A.h > S : b + s + A.w > y) ? (u.push({ children: v, width: b, height: m }), v = [A], b = A.w, m = A.h) : (v.push(A), f ? (b = Math.max(b, A.w), m += (v.length > 1 ? s : 0) + A.h) : (b += (v.length > 1 ? s : 0) + A.w, m = Math.max(m, A.h)));
|
|
218
218
|
}), v.length > 0 && u.push({ children: v, width: b, height: m }), c && !f && (l = Math.max(...u.map((A) => A.width), 0) + n.left + n.right), d && f && (p = Math.max(...u.map((A) => A.height), 0) + n.top + n.bottom);
|
|
219
219
|
const C = [];
|
|
220
|
-
let w = n.left,
|
|
221
|
-
const
|
|
220
|
+
let w = n.left, M = n.top;
|
|
221
|
+
const I = a.toLowerCase(), k = I === "center" || I.endsWith("-center"), T = I.endsWith("-right"), L = I === "center" || I.startsWith("center-"), P = I.startsWith("bottom-");
|
|
222
222
|
return u.forEach((A) => {
|
|
223
|
-
let W = w, z =
|
|
223
|
+
let W = w, z = M;
|
|
224
224
|
f ? L ? z = n.top + (p - n.top - n.bottom - A.height) / 2 : P && (z = p - n.bottom - A.height) : k ? W = n.left + (l - n.left - n.right - A.width) / 2 : T && (W = l - n.right - A.width), A.children.forEach((Y) => {
|
|
225
225
|
var F, j;
|
|
226
226
|
let G = W, N = z;
|
|
@@ -233,7 +233,7 @@ function Es(g, t, i) {
|
|
|
233
233
|
width: J && f ? A.width : void 0,
|
|
234
234
|
height: x ? f ? void 0 : A.height : void 0
|
|
235
235
|
}), f ? z += Y.h + s : W += Y.w + s;
|
|
236
|
-
}), f ? w += A.width + s :
|
|
236
|
+
}), f ? w += A.width + s : M += A.height + s;
|
|
237
237
|
}), { frameWidth: c ? l : void 0, frameHeight: d ? p : void 0, childUpdates: C };
|
|
238
238
|
}
|
|
239
239
|
function As(g, t, i) {
|
|
@@ -242,15 +242,15 @@ function As(g, t, i) {
|
|
|
242
242
|
const { gridColumns: e, gridRows: s, columnGap: n = 0, rowGap: a = 0, padding: r, align: f } = o;
|
|
243
243
|
let h = g.width, l = g.height;
|
|
244
244
|
const p = h - r.left - r.right, c = l - r.top - r.bottom, d = is(e || "1fr", p, n), u = is(s || "auto", c, a), v = d.length > 0 ? d.reduce((T, L) => T + L, 0) + (d.length - 1) * n : 0, b = u.length > 0 ? u.reduce((T, L) => T + L, 0) + (u.length - 1) * a : 0, m = f.toLowerCase(), y = m === "center" || m.endsWith("-center"), S = m.endsWith("-right"), C = m === "center" || m.startsWith("center-"), w = m.startsWith("bottom-");
|
|
245
|
-
let
|
|
246
|
-
y ?
|
|
245
|
+
let M = 0, I = 0;
|
|
246
|
+
y ? M = (p - v) / 2 : S && (M = p - v), C ? I = (c - b) / 2 : w && (I = c - b);
|
|
247
247
|
const k = [];
|
|
248
248
|
return t.forEach((T, L) => {
|
|
249
249
|
var j, X;
|
|
250
250
|
const P = L % d.length || 0, _ = Math.floor(L / d.length) || 0;
|
|
251
251
|
_ >= u.length && u.push(100);
|
|
252
252
|
const E = d[P], A = u[_];
|
|
253
|
-
let W = r.left +
|
|
253
|
+
let W = r.left + M + d.slice(0, P).reduce((tt, R) => tt + R + n, 0), z = r.top + I + u.slice(0, _).reduce((tt, R) => tt + R + a, 0);
|
|
254
254
|
const Y = i(T.id), G = T.geometry;
|
|
255
255
|
let N = (Y == null ? void 0 : Y.width) ?? G.width ?? 100, J = (Y == null ? void 0 : Y.height) ?? G.height ?? 100;
|
|
256
256
|
if (G.type === "Ellipse" || G.type === "Polygon" || G.type === "Star") {
|
|
@@ -575,8 +575,8 @@ const gs = (g) => g, Ls = (g) => g > 0 ? 1 : 0, Rs = (g) => g < 1 ? 0 : 1, os =
|
|
|
575
575
|
const s = o.scale_x ?? 1, n = o.scale_y ?? 1, a = (r, f, h) => {
|
|
576
576
|
let l = 0, p = 0;
|
|
577
577
|
const c = o.rotation * Math.PI / 180, d = Math.cos(c), u = Math.sin(c), v = r * s * d - f * n * u + o.x, b = r * s * u + f * n * d + o.y;
|
|
578
|
-
h.forEach((
|
|
579
|
-
const k = e(
|
|
578
|
+
h.forEach((I) => {
|
|
579
|
+
const k = e(I.boneId);
|
|
580
580
|
if (!k) return;
|
|
581
581
|
const T = {
|
|
582
582
|
x: k.x,
|
|
@@ -584,17 +584,17 @@ const gs = (g) => g, Ls = (g) => g > 0 ? 1 : 0, Rs = (g) => g < 1 ? 0 : 1, os =
|
|
|
584
584
|
rotation: k.rotation,
|
|
585
585
|
scaleX: k.scale_x ?? 1,
|
|
586
586
|
scaleY: k.scale_y ?? 1
|
|
587
|
-
}, L = i[
|
|
588
|
-
l += z *
|
|
587
|
+
}, L = i[I.boneId] || [1, 0, 0, 1, 0, 0], P = v * L[0] + b * L[2] + L[4], _ = v * L[1] + b * L[3] + L[5], E = T.rotation * Math.PI / 180, A = Math.cos(E), W = Math.sin(E), z = P * T.scaleX * A - _ * T.scaleY * W + T.x, Y = P * T.scaleX * W + _ * T.scaleY * A + T.y;
|
|
588
|
+
l += z * I.amount, p += Y * I.amount;
|
|
589
589
|
});
|
|
590
|
-
const m = [...h].sort((
|
|
590
|
+
const m = [...h].sort((I, k) => k.amount - I.amount);
|
|
591
591
|
if (m.length >= 2 && m[0].amount > 0 && m[1].amount > 0) {
|
|
592
|
-
const
|
|
593
|
-
if (
|
|
594
|
-
const T =
|
|
592
|
+
const I = e(m[0].boneId), k = e(m[1].boneId);
|
|
593
|
+
if (I && k && I.length !== void 0 && k.length !== void 0) {
|
|
594
|
+
const T = I.length * (I.scale_y ?? 1), L = I.rotation * Math.PI / 180, P = I.x - T * Math.sin(L), _ = I.y + T * Math.cos(L), E = k.length * (k.scale_y ?? 1), A = k.rotation * Math.PI / 180, W = k.x - E * Math.sin(A), z = k.y + E * Math.cos(A);
|
|
595
595
|
let Y = null, G = null, N = !1;
|
|
596
596
|
const J = 1;
|
|
597
|
-
if (Math.hypot(
|
|
597
|
+
if (Math.hypot(I.x - k.x, I.y - k.y) < J || Math.hypot(I.x - W, I.y - z) < J ? (Y = I.x, G = I.y) : (Math.hypot(P - k.x, _ - k.y) < J || Math.hypot(P - W, _ - z) < J) && (Y = P, G = _, N = !0), Y !== null && G !== null) {
|
|
598
598
|
const x = i[m[0].boneId] || [1, 0, 0, 1, 0, 0], F = x[0] * x[3] - x[1] * x[2];
|
|
599
599
|
let j = 0, X = 0;
|
|
600
600
|
if (F !== 0) {
|
|
@@ -602,22 +602,22 @@ const gs = (g) => g, Ls = (g) => g > 0 ? 1 : 0, Rs = (g) => g < 1 ? 0 : 1, os =
|
|
|
602
602
|
if (!N)
|
|
603
603
|
j = tt, X = R;
|
|
604
604
|
else {
|
|
605
|
-
const ot = -x[2] / F, yt = x[0] / F, bt = Math.hypot(ot, yt), gt =
|
|
605
|
+
const ot = -x[2] / F, yt = x[0] / F, bt = Math.hypot(ot, yt), gt = I.length * bt;
|
|
606
606
|
j = tt - gt * Math.sin(O), X = R + gt * Math.cos(O);
|
|
607
607
|
}
|
|
608
608
|
const D = Math.hypot(v - j, b - X), q = Math.hypot(l - Y, p - G);
|
|
609
609
|
if (q > 0 && D > 0) {
|
|
610
|
-
const ot = Math.max(q, 0.01), yt = Math.min(D / ot, 3), bt = Y + (l - Y) * yt, gt = G + (p - G) * yt,
|
|
610
|
+
const ot = Math.max(q, 0.01), yt = Math.min(D / ot, 3), bt = Y + (l - Y) * yt, gt = G + (p - G) * yt, Et = m[0].amount, It = m[1].amount, St = Math.min(Et, It) * 2, Xt = 1 - Math.pow(1 - St, 4);
|
|
611
611
|
l = l * (1 - Xt) + bt * Xt, p = p * (1 - Xt) + gt * Xt;
|
|
612
612
|
}
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
|
-
const y = o.rotation * Math.PI / 180, S = Math.cos(y), C = Math.sin(y), w = l - o.x,
|
|
617
|
+
const y = o.rotation * Math.PI / 180, S = Math.cos(y), C = Math.sin(y), w = l - o.x, M = p - o.y;
|
|
618
618
|
return {
|
|
619
|
-
x: (w * S +
|
|
620
|
-
y: (-w * C +
|
|
619
|
+
x: (w * S + M * C) / s,
|
|
620
|
+
y: (-w * C + M * S) / n
|
|
621
621
|
};
|
|
622
622
|
};
|
|
623
623
|
return g.map((r, f) => {
|
|
@@ -944,8 +944,8 @@ class ci {
|
|
|
944
944
|
for (; b < d.length; ) {
|
|
945
945
|
const S = y(), C = y(), w = y();
|
|
946
946
|
if (e.length > 0) {
|
|
947
|
-
const
|
|
948
|
-
|
|
947
|
+
const M = e[e.length - 1];
|
|
948
|
+
M.out_x = S.x, M.out_y = S.y;
|
|
949
949
|
}
|
|
950
950
|
n = w.x, a = w.y, e.push({ x: n, y: a, in_x: C.x, in_y: C.y, out_x: n, out_y: a }), r = C.x, f = C.y;
|
|
951
951
|
}
|
|
@@ -954,8 +954,8 @@ class ci {
|
|
|
954
954
|
for (; b < d.length; ) {
|
|
955
955
|
const S = { x: 2 * n - r, y: 2 * a - f }, C = y(), w = y();
|
|
956
956
|
if (e.length > 0) {
|
|
957
|
-
const
|
|
958
|
-
|
|
957
|
+
const M = e[e.length - 1];
|
|
958
|
+
M.out_x = S.x, M.out_y = S.y;
|
|
959
959
|
}
|
|
960
960
|
n = w.x, a = w.y, e.push({ x: n, y: a, in_x: C.x, in_y: C.y, out_x: n, out_y: a }), r = C.x, f = C.y;
|
|
961
961
|
}
|
|
@@ -1567,9 +1567,9 @@ class ci {
|
|
|
1567
1567
|
else {
|
|
1568
1568
|
const S = b.split(".");
|
|
1569
1569
|
let C = m;
|
|
1570
|
-
for (let
|
|
1571
|
-
const
|
|
1572
|
-
C[
|
|
1570
|
+
for (let M = 0; M < S.length - 1; M++) {
|
|
1571
|
+
const I = S[M];
|
|
1572
|
+
C[I] === void 0 && (C[I] = {}), C = C[I];
|
|
1573
1573
|
}
|
|
1574
1574
|
const w = S[S.length - 1];
|
|
1575
1575
|
C[w] = v, d = v;
|
|
@@ -1715,16 +1715,16 @@ class ci {
|
|
|
1715
1715
|
this._springChainState.has(m.id) || this._springChainState.set(m.id, /* @__PURE__ */ new Map());
|
|
1716
1716
|
const w = this._springChainState.get(m.id);
|
|
1717
1717
|
if (!w.has(u)) {
|
|
1718
|
-
const
|
|
1718
|
+
const I = this.objectStates.get(u);
|
|
1719
1719
|
w.set(u, {
|
|
1720
|
-
x: (
|
|
1721
|
-
y: (
|
|
1720
|
+
x: (I == null ? void 0 : I.x) ?? 0,
|
|
1721
|
+
y: (I == null ? void 0 : I.y) ?? 0,
|
|
1722
1722
|
vx: 0,
|
|
1723
1723
|
vy: 0
|
|
1724
1724
|
});
|
|
1725
1725
|
}
|
|
1726
|
-
const
|
|
1727
|
-
|
|
1726
|
+
const M = w.get(u);
|
|
1727
|
+
M && (M.vx += v, M.vy += b);
|
|
1728
1728
|
}
|
|
1729
1729
|
});
|
|
1730
1730
|
})), d = 1;
|
|
@@ -1910,12 +1910,12 @@ class ci {
|
|
|
1910
1910
|
if (r.type === "Translation") {
|
|
1911
1911
|
const y = this.getGlobalTransform(r.targetId);
|
|
1912
1912
|
if (y) {
|
|
1913
|
-
const S = r.offsetX || 0, C = r.offsetY || 0, w = y.x + S,
|
|
1914
|
-
if (
|
|
1915
|
-
const T = this.objectVelocities.get(i.id) || { vx: 0, vy: 0 }, { x: L, y: P, vx: _, vy: E } = this.computeSpring(e.x, e.y, T.vx, T.vy, w,
|
|
1913
|
+
const S = r.offsetX || 0, C = r.offsetY || 0, w = y.x + S, M = y.y + C, I = r.useSpring;
|
|
1914
|
+
if (I) {
|
|
1915
|
+
const T = this.objectVelocities.get(i.id) || { vx: 0, vy: 0 }, { x: L, y: P, vx: _, vy: E } = this.computeSpring(e.x, e.y, T.vx, T.vy, w, M, r, t);
|
|
1916
1916
|
r.copyX && (e.x = e.x + (L - e.x) * f), r.copyY && (e.y = e.y + (P - e.y) * f), this.objectVelocities.set(i.id, { vx: _, vy: E });
|
|
1917
1917
|
} else
|
|
1918
|
-
r.copyX && (e.x = e.x + (w - e.x) * f), r.copyY && (e.y = e.y + (
|
|
1918
|
+
r.copyX && (e.x = e.x + (w - e.x) * f), r.copyY && (e.y = e.y + (M - e.y) * f);
|
|
1919
1919
|
let k = !1;
|
|
1920
1920
|
if ((l = r.limitX) != null && l.enabled) {
|
|
1921
1921
|
const T = e.x;
|
|
@@ -1925,7 +1925,7 @@ class ci {
|
|
|
1925
1925
|
const T = e.y;
|
|
1926
1926
|
e.y = Math.max(r.limitY.min, Math.min(r.limitY.max, e.y)), e.y !== T && (k = !0);
|
|
1927
1927
|
}
|
|
1928
|
-
k &&
|
|
1928
|
+
k && I && this.objectVelocities.set(i.id, { vx: 0, vy: 0 });
|
|
1929
1929
|
}
|
|
1930
1930
|
} else if (r.type === "Rotation") {
|
|
1931
1931
|
const y = this.getGlobalTransform(r.targetId);
|
|
@@ -1946,41 +1946,41 @@ class ci {
|
|
|
1946
1946
|
} else if (r.type === "FollowPointer") {
|
|
1947
1947
|
const y = ((c = this._lastPointerPos) == null ? void 0 : c.x) ?? e.x, S = ((d = this._lastPointerPos) == null ? void 0 : d.y) ?? e.y, C = r.useSpring;
|
|
1948
1948
|
if (C) {
|
|
1949
|
-
const
|
|
1950
|
-
e.x =
|
|
1949
|
+
const M = this.objectVelocities.get(i.id) || { vx: 0, vy: 0 }, { x: I, y: k, vx: T, vy: L } = this.computeSpring(e.x, e.y, M.vx, M.vy, y, S, r, t);
|
|
1950
|
+
e.x = I, e.y = k, this.objectVelocities.set(i.id, { vx: T, vy: L });
|
|
1951
1951
|
} else
|
|
1952
1952
|
e.x = e.x + (y - e.x) * f, e.y = e.y + (S - e.y) * f;
|
|
1953
1953
|
let w = !1;
|
|
1954
1954
|
if ((u = r.limitX) != null && u.enabled) {
|
|
1955
|
-
const
|
|
1956
|
-
e.x = Math.max(r.limitX.min, Math.min(r.limitX.max, e.x)), e.x !==
|
|
1955
|
+
const M = e.x;
|
|
1956
|
+
e.x = Math.max(r.limitX.min, Math.min(r.limitX.max, e.x)), e.x !== M && (w = !0);
|
|
1957
1957
|
}
|
|
1958
1958
|
if ((v = r.limitY) != null && v.enabled) {
|
|
1959
|
-
const
|
|
1960
|
-
e.y = Math.max(r.limitY.min, Math.min(r.limitY.max, e.y)), e.y !==
|
|
1959
|
+
const M = e.y;
|
|
1960
|
+
e.y = Math.max(r.limitY.min, Math.min(r.limitY.max, e.y)), e.y !== M && (w = !0);
|
|
1961
1961
|
}
|
|
1962
1962
|
w && C && this.objectVelocities.set(i.id, { vx: 0, vy: 0 });
|
|
1963
1963
|
} else if (r.type === "Distance") {
|
|
1964
1964
|
const y = this.getGlobalTransform(r.targetId);
|
|
1965
1965
|
if (y) {
|
|
1966
|
-
const S = e.x - y.x, C = e.y - y.y, w = Math.sqrt(S * S + C * C),
|
|
1967
|
-
let
|
|
1966
|
+
const S = e.x - y.x, C = e.y - y.y, w = Math.sqrt(S * S + C * C), M = r.distance || 0;
|
|
1967
|
+
let I = w;
|
|
1968
1968
|
switch (r.mode) {
|
|
1969
1969
|
case "exact":
|
|
1970
|
-
|
|
1970
|
+
I = M;
|
|
1971
1971
|
break;
|
|
1972
1972
|
case "minimum":
|
|
1973
|
-
|
|
1973
|
+
I = Math.max(M, w);
|
|
1974
1974
|
break;
|
|
1975
1975
|
case "maximum":
|
|
1976
|
-
|
|
1976
|
+
I = Math.min(M, w);
|
|
1977
1977
|
break;
|
|
1978
1978
|
case "clamped":
|
|
1979
|
-
|
|
1979
|
+
I = Math.max(0, Math.min(M, w));
|
|
1980
1980
|
break;
|
|
1981
1981
|
}
|
|
1982
1982
|
if (w > 0) {
|
|
1983
|
-
const k = e.x === y.x && e.y === y.y ? 1 :
|
|
1983
|
+
const k = e.x === y.x && e.y === y.y ? 1 : I / w;
|
|
1984
1984
|
e.x = e.x + (y.x + S * k - e.x) * f, e.y = e.y + (y.y + C * k - e.y) * f;
|
|
1985
1985
|
}
|
|
1986
1986
|
}
|
|
@@ -1997,7 +1997,7 @@ class ci {
|
|
|
1997
1997
|
F && (C = F.geometry);
|
|
1998
1998
|
}
|
|
1999
1999
|
if (!C) return;
|
|
2000
|
-
const w = (r.distance || 0) / 100,
|
|
2000
|
+
const w = (r.distance || 0) / 100, M = S.width || C.width || 0, I = S.height || C.height || 0, k = this.getPointOnPath(C, M, I, w), T = S.rotation * Math.PI / 180, L = Math.cos(T), P = Math.sin(T), _ = k.x * S.scale_x * L - k.y * S.scale_y * P, E = k.x * S.scale_x * P + k.y * S.scale_y * L;
|
|
2001
2001
|
let A = S.rotation + (r.offsetRotation || 0);
|
|
2002
2002
|
if (r.orient) {
|
|
2003
2003
|
const F = Math.cos(k.angle), j = Math.sin(k.angle), X = F * S.scale_x * L - j * S.scale_y * P, tt = F * S.scale_x * P + j * S.scale_y * L;
|
|
@@ -2076,10 +2076,10 @@ class ci {
|
|
|
2076
2076
|
const c = a[p], d = this.getGlobalTransform(c.id), u = l.x - d.x, v = l.y - d.y, b = i.x - d.x, m = i.y - d.y, y = Math.sqrt(u * u + v * v), S = Math.sqrt(b * b + m * m);
|
|
2077
2077
|
if (y > 1e-3 && S > 1e-3) {
|
|
2078
2078
|
const C = Math.atan2(v, u);
|
|
2079
|
-
let
|
|
2080
|
-
|
|
2081
|
-
const
|
|
2082
|
-
|
|
2079
|
+
let M = (Math.atan2(m, b) - C) * 180 / Math.PI;
|
|
2080
|
+
M *= e;
|
|
2081
|
+
const I = this.objectStates.get(c.id);
|
|
2082
|
+
I && (I.rotation += M);
|
|
2083
2083
|
}
|
|
2084
2084
|
}
|
|
2085
2085
|
}
|
|
@@ -2156,9 +2156,9 @@ class ci {
|
|
|
2156
2156
|
})) : t === "blur" && this.activeHoverIds.clear(), this.activeDropdownId && t === "down") {
|
|
2157
2157
|
const c = this.artboard.objects.find((d) => d.id === this.activeDropdownId);
|
|
2158
2158
|
if (c && (c.type === "Dropdown" || c.variant === "dropdown")) {
|
|
2159
|
-
const d = this.objectStates.get(c.id), u = (d == null ? void 0 : d.options) || c.options || {}, v = c.geometry || {}, b = v.width ?? c.width ?? 200, m = v.height ?? c.height ?? 40, y = u.optionsList || [], S = u.itemHeight || 32, C = u.listPadding ?? 4, w = y.length * S + C * 2,
|
|
2159
|
+
const d = this.objectStates.get(c.id), u = (d == null ? void 0 : d.options) || c.options || {}, v = c.geometry || {}, b = v.width ?? c.width ?? 200, m = v.height ?? c.height ?? 40, y = u.optionsList || [], S = u.itemHeight || 32, C = u.listPadding ?? 4, w = y.length * S + C * 2, M = this.getWorldTransform(c.id), I = b * Math.abs(M.scaleX), k = m * Math.abs(M.scaleY), T = M.y + k / 2 + 4, L = Math.abs(i - M.x) <= I / 2, P = o >= T && o <= T + w * Math.abs(M.scaleY);
|
|
2160
2160
|
if (L && P) {
|
|
2161
|
-
const _ = Math.abs(
|
|
2161
|
+
const _ = Math.abs(M.scaleY), E = o - (T + C * _), A = Math.floor(E / (S * _));
|
|
2162
2162
|
if (A >= 0 && A < y.length) {
|
|
2163
2163
|
const W = y[A];
|
|
2164
2164
|
u.selectedOption = W, u.isOpen = !1, this.activeDropdownId = null, c.inputId && this.setInternalInput(c.inputId, W), this.onComponentChange && this.onComponentChange({
|
|
@@ -2274,7 +2274,7 @@ class ci {
|
|
|
2274
2274
|
}
|
|
2275
2275
|
}
|
|
2276
2276
|
if (c.type === "LineGraph" && (t === "down" || t === "click")) {
|
|
2277
|
-
const v = c.geometry, b = (v == null ? void 0 : v.datasets) || [], m = this.objectStates.get(c.id), y = (m == null ? void 0 : m.width) || (v == null ? void 0 : v.width) || 200, S = (m == null ? void 0 : m.height) || (v == null ? void 0 : v.height) || 150, C = this.getWorldTransform(c.id), w = 30,
|
|
2277
|
+
const v = c.geometry, b = (v == null ? void 0 : v.datasets) || [], m = this.objectStates.get(c.id), y = (m == null ? void 0 : m.width) || (v == null ? void 0 : v.width) || 200, S = (m == null ? void 0 : m.height) || (v == null ? void 0 : v.height) || 150, C = this.getWorldTransform(c.id), w = 30, M = 20, I = y - w, k = S - M;
|
|
2278
2278
|
let T = 1;
|
|
2279
2279
|
b.forEach((_) => {
|
|
2280
2280
|
const E = Math.max(..._.data || [0]);
|
|
@@ -2282,9 +2282,9 @@ class ci {
|
|
|
2282
2282
|
});
|
|
2283
2283
|
let L = 1 / 0, P = null;
|
|
2284
2284
|
b.forEach((_, E) => {
|
|
2285
|
-
const A = _.data || [], W =
|
|
2285
|
+
const A = _.data || [], W = I / Math.max(A.length - 1, 1);
|
|
2286
2286
|
A.forEach((z, Y) => {
|
|
2287
|
-
const G = C.x - y / 2 + w + Y * W, N = C.y + S / 2 -
|
|
2287
|
+
const G = C.x - y / 2 + w + Y * W, N = C.y + S / 2 - M - z / T * k, J = Math.sqrt((i - G) ** 2 + (o - N) ** 2);
|
|
2288
2288
|
J < L && (L = J, P = { dIdx: E, pIdx: Y, val: z, label: _.label || `Dataset ${E + 1}` });
|
|
2289
2289
|
});
|
|
2290
2290
|
}), P && L < 20 && this.onGraphPointClick && this.onGraphPointClick({ objectId: c.id, componentName: c.name, datasetIndex: P.dIdx, pointIndex: P.pIdx, value: P.val, label: P.label }), this.onComponentChange && this.onComponentChange({ objectId: c.id, componentName: c.name, variant: "linegraph", property: "click", value: (P == null ? void 0 : P.val) ?? null });
|
|
@@ -2504,10 +2504,10 @@ class ci {
|
|
|
2504
2504
|
return Math.abs(c) <= b / 2 && Math.abs(d) <= m / 2;
|
|
2505
2505
|
}
|
|
2506
2506
|
updateSliderValueFromPointer(t, i, o) {
|
|
2507
|
-
var
|
|
2507
|
+
var M;
|
|
2508
2508
|
const e = this.objectStates.get(t.id);
|
|
2509
2509
|
if (!e) return;
|
|
2510
|
-
const s = t.options || {}, n = ((
|
|
2510
|
+
const s = t.options || {}, n = ((M = t.geometry) == null ? void 0 : M.width) ?? t.width ?? 200, a = this.getWorldTransform(t.id), r = i - a.x, f = o - a.y, h = -a.rotation * (Math.PI / 180), l = Math.cos(h), p = Math.sin(h), c = r * l - f * p, d = s.thumbWidth ?? 16, u = n - d;
|
|
2511
2511
|
let b = (c + u / 2) / u;
|
|
2512
2512
|
b = Math.max(0, Math.min(1, b));
|
|
2513
2513
|
const m = s.min ?? 0, y = s.max ?? 100, S = s.step || 1;
|
|
@@ -2523,10 +2523,10 @@ class ci {
|
|
|
2523
2523
|
}));
|
|
2524
2524
|
}
|
|
2525
2525
|
updateJoystickValueFromPointer(t, i, o) {
|
|
2526
|
-
var
|
|
2526
|
+
var M, I;
|
|
2527
2527
|
const e = this.objectStates.get(t.id);
|
|
2528
2528
|
if (!e) return;
|
|
2529
|
-
const s = (e == null ? void 0 : e.width) !== void 0 ? e.width : ((
|
|
2529
|
+
const s = (e == null ? void 0 : e.width) !== void 0 ? e.width : ((M = t.geometry) == null ? void 0 : M.width) ?? t.width ?? 100, n = (e == null ? void 0 : e.height) !== void 0 ? e.height : ((I = t.geometry) == null ? void 0 : I.height) ?? t.height ?? 100, a = this.getWorldTransform(t.id), r = i - a.x, f = o - a.y, h = -a.rotation * (Math.PI / 180), l = Math.cos(h), p = Math.sin(h);
|
|
2530
2530
|
let c = (r * l - f * p) / Math.max(1e-3, Math.abs(a.scaleX || 1)), d = (r * p + f * l) / Math.max(1e-3, Math.abs(a.scaleY || 1));
|
|
2531
2531
|
t.handleOrigin === "top-left" ? (c -= s / 2, d -= n / 2) : t.handleOrigin === "bottom-right" && (c += s / 2, d += n / 2);
|
|
2532
2532
|
const u = Math.min(s, n) * 0.45, v = Math.min(s, n) * 0.15, b = u - v;
|
|
@@ -2569,20 +2569,20 @@ class ci {
|
|
|
2569
2569
|
const c = (d = this.artboard) == null ? void 0 : d.objects.find((w) => w.id === l.targetObjectId);
|
|
2570
2570
|
if (c) {
|
|
2571
2571
|
if (l.actionType === "bind" && l.targetProperty && l.isContinuous !== !1) {
|
|
2572
|
-
const w = l.sourceMin ?? -1,
|
|
2572
|
+
const w = l.sourceMin ?? -1, M = l.sourceMax ?? 1, I = l.targetMin ?? 0, k = l.targetMax ?? 100;
|
|
2573
2573
|
let T = !!l.isContinuous, L = 0, P = 0;
|
|
2574
2574
|
if (T) {
|
|
2575
|
-
if ((l.sourceAxis === "x" || l.sourceAxis === "y") &&
|
|
2576
|
-
const E = Math.max(Math.abs(w), Math.abs(
|
|
2575
|
+
if ((l.sourceAxis === "x" || l.sourceAxis === "y") && I >= 0) {
|
|
2576
|
+
const E = Math.max(Math.abs(w), Math.abs(M)) || 1;
|
|
2577
2577
|
P = p / E * k;
|
|
2578
2578
|
} else {
|
|
2579
|
-
let E = (p - w) / (
|
|
2580
|
-
E = Math.max(0, Math.min(1, E)), P =
|
|
2579
|
+
let E = (p - w) / (M - w);
|
|
2580
|
+
E = Math.max(0, Math.min(1, E)), P = I + E * (k - I);
|
|
2581
2581
|
}
|
|
2582
2582
|
Math.abs(p) < 0.05 && (P = 0);
|
|
2583
2583
|
} else {
|
|
2584
|
-
const E = (p - w) / (
|
|
2585
|
-
L =
|
|
2584
|
+
const E = (p - w) / (M - w), A = Math.max(0, Math.min(1, E));
|
|
2585
|
+
L = I + A * (k - I), l.step && l.step > 0 && (L = Math.round(L / l.step) * l.step);
|
|
2586
2586
|
}
|
|
2587
2587
|
const _ = this.objectStates.get(c.id);
|
|
2588
2588
|
if (_) {
|
|
@@ -2601,11 +2601,11 @@ class ci {
|
|
|
2601
2601
|
(C = c.physics) != null && C.enabled && this.physicsEngine && (l.targetProperty === "x" || l.targetProperty === "transform.x" || l.targetProperty === "y" || l.targetProperty === "transform.y") && (l.targetProperty === "x" || l.targetProperty === "transform.x" ? this.physicsEngine.applyForce(c.id, (L - ((_ == null ? void 0 : _.x) || 0)) * 10, 0) : (l.targetProperty === "y" || l.targetProperty === "transform.y") && this.physicsEngine.applyForce(c.id, 0, (L - ((_ == null ? void 0 : _.y) || 0)) * 10));
|
|
2602
2602
|
} else if (l.actionType === "playAnimation" || l.actionType === "stopAnimation" || l.actionType === "pauseAnimation") {
|
|
2603
2603
|
let w = !1;
|
|
2604
|
-
const
|
|
2605
|
-
l.condition === "always" ? w = !0 : l.condition === ">" ? w = p >
|
|
2606
|
-
const
|
|
2604
|
+
const M = l.threshold ?? 0;
|
|
2605
|
+
l.condition === "always" ? w = !0 : l.condition === ">" ? w = p > M : l.condition === "<" ? w = p < M : l.condition === "==" && (w = Math.abs(p - M) < 0.01);
|
|
2606
|
+
const I = e[`_prev_src_${l.id}`] ?? p;
|
|
2607
2607
|
let k = !1;
|
|
2608
|
-
l.condition === "always" ? k = !0 : l.condition === ">" ? k =
|
|
2608
|
+
l.condition === "always" ? k = !0 : l.condition === ">" ? k = I > M : l.condition === "<" ? k = I < M : l.condition === "==" && (k = Math.abs(I - M) < 0.01), e[`_prev_src_${l.id}`] = p, w && !k && l.targetAnimationId && (l.actionType === "playAnimation" || l.actionType);
|
|
2609
2609
|
}
|
|
2610
2610
|
}
|
|
2611
2611
|
});
|
|
@@ -2632,24 +2632,24 @@ class ci {
|
|
|
2632
2632
|
const y = (p = (l = this.artboard) == null ? void 0 : l.animations) == null ? void 0 : p.find((S) => S.id === b[m].animationId);
|
|
2633
2633
|
y && (s.push({ anim: y, weight: 1 }), n = 1);
|
|
2634
2634
|
} else {
|
|
2635
|
-
const y = b[m].position[0], S = b[m + 1].position[0], C = (d = (c = this.artboard) == null ? void 0 : c.animations) == null ? void 0 : d.find((T) => T.id === b[m].animationId), w = (v = (u = this.artboard) == null ? void 0 : u.animations) == null ? void 0 : v.find((T) => T.id === b[m + 1].animationId),
|
|
2636
|
-
let
|
|
2637
|
-
|
|
2638
|
-
const k = 1 -
|
|
2639
|
-
C && (s.push({ anim: C, weight: k }), n += k), w && (s.push({ anim: w, weight:
|
|
2635
|
+
const y = b[m].position[0], S = b[m + 1].position[0], C = (d = (c = this.artboard) == null ? void 0 : c.animations) == null ? void 0 : d.find((T) => T.id === b[m].animationId), w = (v = (u = this.artboard) == null ? void 0 : u.animations) == null ? void 0 : v.find((T) => T.id === b[m + 1].animationId), M = Math.max(1e-3, S - y);
|
|
2636
|
+
let I = (o - y) / M;
|
|
2637
|
+
I = Math.max(0, Math.min(1, I));
|
|
2638
|
+
const k = 1 - I;
|
|
2639
|
+
C && (s.push({ anim: C, weight: k }), n += k), w && (s.push({ anim: w, weight: I }), n += I);
|
|
2640
2640
|
}
|
|
2641
2641
|
}
|
|
2642
2642
|
} else
|
|
2643
2643
|
t.blendAnimations.forEach((b) => {
|
|
2644
|
-
var w,
|
|
2645
|
-
const m = (
|
|
2644
|
+
var w, M;
|
|
2645
|
+
const m = (M = (w = this.artboard) == null ? void 0 : w.animations) == null ? void 0 : M.find((I) => I.id === b.animationId);
|
|
2646
2646
|
if (!m) return;
|
|
2647
2647
|
const y = b.position[0] - o, S = b.position[1] - e, C = y * y + S * S;
|
|
2648
2648
|
if (C < 1e-4)
|
|
2649
2649
|
s.push({ anim: m, weight: 1e4 }), n += 1e4;
|
|
2650
2650
|
else {
|
|
2651
|
-
const
|
|
2652
|
-
s.push({ anim: m, weight:
|
|
2651
|
+
const I = 1 / C;
|
|
2652
|
+
s.push({ anim: m, weight: I }), n += I;
|
|
2653
2653
|
}
|
|
2654
2654
|
});
|
|
2655
2655
|
if (n === 0) return;
|
|
@@ -2663,38 +2663,38 @@ class ci {
|
|
|
2663
2663
|
var L, P;
|
|
2664
2664
|
const S = y.object_id || y.objectId, C = y.property, w = (L = this.artboard) == null ? void 0 : L.objects.find((_) => _.id === S);
|
|
2665
2665
|
if (((P = w == null ? void 0 : w.physics) == null ? void 0 : P.enabled) && w.physics.bodyType !== "Static" && (C === "x" || C === "y" || C === "rotation")) return;
|
|
2666
|
-
const
|
|
2667
|
-
if (
|
|
2666
|
+
const I = this.interpolate(y.keyframes, i);
|
|
2667
|
+
if (I === void 0) return;
|
|
2668
2668
|
let k = a.get(S);
|
|
2669
2669
|
k || (k = /* @__PURE__ */ new Map(), a.set(S, k));
|
|
2670
2670
|
let T = k.get(C);
|
|
2671
2671
|
if (!T) {
|
|
2672
|
-
if (typeof
|
|
2672
|
+
if (typeof I == "number")
|
|
2673
2673
|
T = { type: "number", value: 0 };
|
|
2674
|
-
else if (typeof
|
|
2675
|
-
T = { type: "color", value:
|
|
2676
|
-
else if (T = { type: "number", value:
|
|
2674
|
+
else if (typeof I == "string" && I.startsWith("#"))
|
|
2675
|
+
T = { type: "color", value: I, colorAcc: { r: 0, g: 0, b: 0, a: 0 } };
|
|
2676
|
+
else if (T = { type: "number", value: I }, m < 0.5) return;
|
|
2677
2677
|
k.set(C, T);
|
|
2678
2678
|
}
|
|
2679
|
-
if (T.type === "number" && typeof
|
|
2680
|
-
T.value +=
|
|
2681
|
-
else if (T.type === "color" && typeof
|
|
2682
|
-
const _ = r(
|
|
2679
|
+
if (T.type === "number" && typeof I == "number")
|
|
2680
|
+
T.value += I * m;
|
|
2681
|
+
else if (T.type === "color" && typeof I == "string" && T.colorAcc) {
|
|
2682
|
+
const _ = r(I);
|
|
2683
2683
|
_ && (T.colorAcc.r += _.r * m, T.colorAcc.g += _.g * m, T.colorAcc.b += _.b * m, T.colorAcc.a += _.a * m);
|
|
2684
2684
|
} else
|
|
2685
|
-
m > 0.5 && (T.value =
|
|
2685
|
+
m > 0.5 && (T.value = I);
|
|
2686
2686
|
});
|
|
2687
2687
|
}), a.forEach((b, m) => {
|
|
2688
2688
|
var C;
|
|
2689
2689
|
const y = this.objectStates.get(m), S = (C = this.artboard) == null ? void 0 : C.objects.find((w) => w.id === m);
|
|
2690
|
-
!y || !S || b.forEach((w,
|
|
2691
|
-
let
|
|
2690
|
+
!y || !S || b.forEach((w, M) => {
|
|
2691
|
+
let I = w.value;
|
|
2692
2692
|
if (w.type === "color" && w.colorAcc) {
|
|
2693
2693
|
const k = Math.round(w.colorAcc.r).toString(16).padStart(2, "0"), T = Math.round(w.colorAcc.g).toString(16).padStart(2, "0"), L = Math.round(w.colorAcc.b).toString(16).padStart(2, "0");
|
|
2694
|
-
|
|
2694
|
+
I = `#${k}${T}${L}`;
|
|
2695
2695
|
}
|
|
2696
|
-
if (
|
|
2697
|
-
const k = (
|
|
2696
|
+
if (M.includes(".")) {
|
|
2697
|
+
const k = (M || "").split(".");
|
|
2698
2698
|
let T = y;
|
|
2699
2699
|
for (let L = 0; L < k.length - 1; L++) {
|
|
2700
2700
|
if (typeof T[k[L]] != "object" || T[k[L]] === null) {
|
|
@@ -2709,9 +2709,9 @@ class ci {
|
|
|
2709
2709
|
}
|
|
2710
2710
|
T = T[k[L]];
|
|
2711
2711
|
}
|
|
2712
|
-
T[k[k.length - 1]] =
|
|
2712
|
+
T[k[k.length - 1]] = I, k[k.length - 1] === "color" && (k[k.length - 2] === "fill" || k[k.length - 2] === "stroke") && (T.type = "Solid");
|
|
2713
2713
|
} else
|
|
2714
|
-
|
|
2714
|
+
M === "fill" ? (y.style || (y.style = {}), y.style.fill = I) : M === "stroke" ? (y.style || (y.style = {}), y.style.stroke = I) : y[M] = I;
|
|
2715
2715
|
});
|
|
2716
2716
|
});
|
|
2717
2717
|
}
|
|
@@ -2950,7 +2950,7 @@ class ci {
|
|
|
2950
2950
|
}
|
|
2951
2951
|
*/
|
|
2952
2952
|
renderObject(t, i, o) {
|
|
2953
|
-
var u, v, b, m, y, S, C, w,
|
|
2953
|
+
var u, v, b, m, y, S, C, w, M, I, k, T, L, P, _, E, A, W, z, Y, G, N, J, x, F, j;
|
|
2954
2954
|
const e = this.objectStates.get(i.id);
|
|
2955
2955
|
if (!e) {
|
|
2956
2956
|
this.warn("No state for object:", i.id);
|
|
@@ -2993,28 +2993,28 @@ class ci {
|
|
|
2993
2993
|
const ft = p.offsetX || 0, pt = p.offsetY || 0, at = p.rotation || 0, B = p.scale !== void 0 ? p.scale : 1;
|
|
2994
2994
|
tt += X * ft, R += X * pt, O += X * at, D *= Math.pow(B, X), q *= Math.pow(B, X);
|
|
2995
2995
|
} else if (p.type === "Grid") {
|
|
2996
|
-
const ft = p.cols || Math.ceil(Math.sqrt(p.count)), pt = p.gapX || 0, at = p.gapY || 0, B = Math.floor(X / ft), nt = X % ft, Z = a + pt,
|
|
2997
|
-
tt += nt * Z, R += B *
|
|
2996
|
+
const ft = p.cols || Math.ceil(Math.sqrt(p.count)), pt = p.gapX || 0, at = p.gapY || 0, B = Math.floor(X / ft), nt = X % ft, Z = a + pt, Pt = r + at;
|
|
2997
|
+
tt += nt * Z, R += B * Pt;
|
|
2998
2998
|
} else if (p.type === "Radial") {
|
|
2999
|
-
const ft = p.radius || 100, pt = p.startAngle || 0, B = (p.endAngle || 360) - pt, nt = p.count > 1 ? B / (B === 360 ? p.count : p.count - 1) : 0, Z = pt + X * nt,
|
|
3000
|
-
tt = e.x + ft * Math.cos(
|
|
2999
|
+
const ft = p.radius || 100, pt = p.startAngle || 0, B = (p.endAngle || 360) - pt, nt = p.count > 1 ? B / (B === 360 ? p.count : p.count - 1) : 0, Z = pt + X * nt, Pt = Z * Math.PI / 180;
|
|
3000
|
+
tt = e.x + ft * Math.cos(Pt), R = e.y + ft * Math.sin(Pt), O += Z;
|
|
3001
3001
|
}
|
|
3002
3002
|
}
|
|
3003
3003
|
const ot = i.type === "Group" || i.type === "Frame" || i.type === "Component", yt = a > 0 && r > 0;
|
|
3004
3004
|
if (!ot && yt) {
|
|
3005
|
-
const ft = (((w = n.shadow) == null ? void 0 : w.isEnabled) !== !1 ? (((
|
|
3005
|
+
const ft = (((w = n.shadow) == null ? void 0 : w.isEnabled) !== !1 ? (((M = n.shadow) == null ? void 0 : M.blur) || 0) + 10 : 0) + (((I = n.blur) == null ? void 0 : I.isEnabled) !== !1 && ((k = n.blur) == null ? void 0 : k.radius) || 0) + 20;
|
|
3006
3006
|
if (!this.isObjectInView(t, tt, R, a, r, ft))
|
|
3007
3007
|
continue;
|
|
3008
3008
|
}
|
|
3009
3009
|
this.debug_objectsRendered++, t.save();
|
|
3010
3010
|
const bt = [], gt = n.blur || ((T = i.style) == null ? void 0 : T.blur);
|
|
3011
3011
|
gt && gt.amount > 0 && bt.push(`blur(${gt.amount}px)`);
|
|
3012
|
-
const
|
|
3013
|
-
let It =
|
|
3014
|
-
It || (It = n.effect || ((P = i.style) == null ? void 0 : P.effect) ||
|
|
3012
|
+
const Et = n.effects || ((L = i.style) == null ? void 0 : L.effects) || [];
|
|
3013
|
+
let It = Et.find((ft) => ft.isEnabled !== !1 && (ft.type === "BackgroundBlur" || ft.type === "LayerBlur"));
|
|
3014
|
+
It || (It = n.effect || ((P = i.style) == null ? void 0 : P.effect) || Et.find((ft) => ft.isEnabled !== !1));
|
|
3015
3015
|
const St = It, Xt = (St == null ? void 0 : St.isEnabled) !== !1, le = St == null ? void 0 : St.type, he = (St == null ? void 0 : St.radius) ?? 10;
|
|
3016
3016
|
Xt && le === "LayerBlur" ? bt.push(`blur(${he}px)`) : Xt && le === "BackgroundBlur" && (n === i.style && (n = { ...n }), n.fill = { type: "None" });
|
|
3017
|
-
const et = ((_ = s == null ? void 0 : s.type) == null ? void 0 : _.toLowerCase().includes("image")) || ((E = i.type) == null ? void 0 : E.toLowerCase().includes("image")), mt = n.adjustments && Object.keys(n.adjustments).length > 0 ? n.adjustments : null, Rt = s != null && s.adjustments && Object.keys(s.adjustments).length > 0 ? s.adjustments : null,
|
|
3017
|
+
const et = ((_ = s == null ? void 0 : s.type) == null ? void 0 : _.toLowerCase().includes("image")) || ((E = i.type) == null ? void 0 : E.toLowerCase().includes("image")), mt = n.adjustments && Object.keys(n.adjustments).length > 0 ? n.adjustments : null, Rt = s != null && s.adjustments && Object.keys(s.adjustments).length > 0 ? s.adjustments : null, _t = et ? Rt || mt : mt || Rt, dt = et && !_t ? {
|
|
3018
3018
|
exposure: 0,
|
|
3019
3019
|
contrast: 0,
|
|
3020
3020
|
saturation: 100,
|
|
@@ -3025,9 +3025,9 @@ class ci {
|
|
|
3025
3025
|
blur: 0,
|
|
3026
3026
|
negative: 0,
|
|
3027
3027
|
hue: 0
|
|
3028
|
-
} :
|
|
3028
|
+
} : _t;
|
|
3029
3029
|
if (e && dt && (e.geometry = e.geometry || {}, e.geometry.adjustments = { ...dt }), dt) {
|
|
3030
|
-
const ft = (dt.exposure || 0) / 100, pt = dt.contrast || 0, at = 1 + (dt.saturation || 0) / 100, B = (dt.temperature || 0) / 200, nt = (dt.tint || 0) / 200, Z = (dt.highlights || 0) / 500,
|
|
3030
|
+
const ft = (dt.exposure || 0) / 100, pt = dt.contrast || 0, at = 1 + (dt.saturation || 0) / 100, B = (dt.temperature || 0) / 200, nt = (dt.tint || 0) / 200, Z = (dt.highlights || 0) / 500, Pt = (dt.shadows || 0) / 500;
|
|
3031
3031
|
let xt = "", kt = "SourceGraphic";
|
|
3032
3032
|
if (ft !== 0 && (xt += `
|
|
3033
3033
|
<feComponentTransfer in="${kt}" result="exposure">
|
|
@@ -3052,15 +3052,15 @@ class ci {
|
|
|
3052
3052
|
0 0 ${Mt} 0 ${1 - Mt}
|
|
3053
3053
|
0 0 0 1 0"/>`, kt = "invert";
|
|
3054
3054
|
}
|
|
3055
|
-
if (B !== 0 || nt !== 0 || Z !== 0 ||
|
|
3056
|
-
const Mt = 1 + Z +
|
|
3055
|
+
if (B !== 0 || nt !== 0 || Z !== 0 || Pt !== 0) {
|
|
3056
|
+
const Mt = 1 + Z + Pt, $ = Mt * (1 + B - nt / 2), Wt = Mt * (1 + nt), Kt = Mt * (1 - B - nt / 2), te = dt.shadows * 0.1 / 255, Jt = [
|
|
3057
3057
|
$,
|
|
3058
3058
|
0,
|
|
3059
3059
|
0,
|
|
3060
3060
|
0,
|
|
3061
3061
|
te,
|
|
3062
3062
|
0,
|
|
3063
|
-
|
|
3063
|
+
Wt,
|
|
3064
3064
|
0,
|
|
3065
3065
|
0,
|
|
3066
3066
|
te,
|
|
@@ -3083,11 +3083,11 @@ class ci {
|
|
|
3083
3083
|
}
|
|
3084
3084
|
}
|
|
3085
3085
|
bt.length > 0 ? t.filter = bt.join(" ") : t.filter = "none", t.imageSmoothingEnabled = !0, t.imageSmoothingQuality = "high";
|
|
3086
|
-
const
|
|
3087
|
-
t.globalAlpha =
|
|
3088
|
-
const
|
|
3089
|
-
if (
|
|
3090
|
-
const ft =
|
|
3086
|
+
const Ft = t.globalAlpha, Dt = this.normalizeOpacity(e.opacity !== void 0 ? e.opacity : 100);
|
|
3087
|
+
t.globalAlpha = Ft * Dt;
|
|
3088
|
+
const $t = e.compositeOperation || e.blendMode;
|
|
3089
|
+
if ($t && $t !== "Normal") {
|
|
3090
|
+
const ft = $t.toLowerCase();
|
|
3091
3091
|
[
|
|
3092
3092
|
"multiply",
|
|
3093
3093
|
"screen",
|
|
@@ -3119,7 +3119,7 @@ class ci {
|
|
|
3119
3119
|
"screen"
|
|
3120
3120
|
].includes(ft) && (t.globalCompositeOperation = ft);
|
|
3121
3121
|
}
|
|
3122
|
-
const
|
|
3122
|
+
const Ot = t, Vt = e.masks || (i.maskedBy ? [{
|
|
3123
3123
|
maskId: i.maskedBy,
|
|
3124
3124
|
inverted: i.maskInverted === !0,
|
|
3125
3125
|
type: i.maskType || "alpha",
|
|
@@ -3128,10 +3128,10 @@ class ci {
|
|
|
3128
3128
|
isVisible: !0
|
|
3129
3129
|
}] : []);
|
|
3130
3130
|
let ie = !1;
|
|
3131
|
-
const me =
|
|
3131
|
+
const me = Vt.filter((ft) => ft.isVisible !== !1 && o.has(ft.maskId));
|
|
3132
3132
|
if (me.length > 0) {
|
|
3133
3133
|
const ft = me[0], pt = o.get(ft.maskId), at = this.objectStates.get(pt.id);
|
|
3134
|
-
at && at.visible !== !1 && (ie = !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), i.parentId && this.applyAbsoluteTransform(this.maskCtx, i.parentId, o), this.maskCtx.save(), this.maskCtx.globalAlpha = 1, t = this.maskCtx, t.filter =
|
|
3134
|
+
at && at.visible !== !1 && (ie = !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), i.parentId && this.applyAbsoluteTransform(this.maskCtx, i.parentId, o), this.maskCtx.save(), this.maskCtx.globalAlpha = 1, t = this.maskCtx, t.filter = Ot.filter);
|
|
3135
3135
|
}
|
|
3136
3136
|
t.translate(Math.round(tt), Math.round(R)), t.rotate(O * Math.PI / 180);
|
|
3137
3137
|
const ye = e.skew_x || 0, Ut = e.skew_y || 0;
|
|
@@ -3156,11 +3156,11 @@ class ci {
|
|
|
3156
3156
|
} else if (ft.startsWith("rgba")) {
|
|
3157
3157
|
const kt = ft.match(/[\d.]+/g);
|
|
3158
3158
|
if (kt && kt.length >= 4) {
|
|
3159
|
-
const At = kt[0], Mt = kt[1], $ = kt[2],
|
|
3160
|
-
Z = `rgba(${At}, ${Mt}, ${$}, ${parseFloat(
|
|
3159
|
+
const At = kt[0], Mt = kt[1], $ = kt[2], Wt = kt[3];
|
|
3160
|
+
Z = `rgba(${At}, ${Mt}, ${$}, ${parseFloat(Wt) * pt})`;
|
|
3161
3161
|
}
|
|
3162
3162
|
}
|
|
3163
|
-
const
|
|
3163
|
+
const Pt = t.getTransform(), xt = Math.sqrt(Pt.a * Pt.a + Pt.b * Pt.b) || 1;
|
|
3164
3164
|
t.shadowColor = Z, t.shadowBlur = nt * xt, t.shadowOffsetX = (se.offsetX || 0) * xt, t.shadowOffsetY = (se.offsetY || 0) * xt;
|
|
3165
3165
|
}
|
|
3166
3166
|
const jt = i.liquidFill || ((N = i.style) == null ? void 0 : N.liquidFill);
|
|
@@ -3193,7 +3193,7 @@ class ci {
|
|
|
3193
3193
|
} else if (s.type === "SVG") {
|
|
3194
3194
|
const ft = s.svgContent;
|
|
3195
3195
|
if (ft) {
|
|
3196
|
-
const pt = n.palette || [], at = n.fill, B = n.stroke, nt = at ? this.normalizeOpacity(at.opacity ?? 100) : 1, Z = (at == null ? void 0 : at.type) === "Solid" && (!B || B.isEnabled === !1 || B.type === "Solid" && B.color === at.color),
|
|
3196
|
+
const pt = n.palette || [], at = n.fill, B = n.stroke, nt = at ? this.normalizeOpacity(at.opacity ?? 100) : 1, Z = (at == null ? void 0 : at.type) === "Solid" && (!B || B.isEnabled === !1 || B.type === "Solid" && B.color === at.color), Pt = at && at.type !== "None" ? Z ? "monochrome" : at.type === "Solid" ? (at.color || "") + "|opacity:" + nt : JSON.stringify(at.stops || []) + "|opacity:" + nt : "", xt = B && B.isEnabled !== !1 && (B.width || 0) > 0 ? Z ? [
|
|
3197
3197
|
"monochrome",
|
|
3198
3198
|
B.width || 0,
|
|
3199
3199
|
B.trimStart ?? 0,
|
|
@@ -3215,7 +3215,7 @@ class ci {
|
|
|
3215
3215
|
].join("|") : "nostroke", kt = [
|
|
3216
3216
|
i.id,
|
|
3217
3217
|
pt.join("_"),
|
|
3218
|
-
|
|
3218
|
+
Pt,
|
|
3219
3219
|
xt,
|
|
3220
3220
|
e.opacity ?? 100,
|
|
3221
3221
|
e.visible !== !1 ? "v" : "h"
|
|
@@ -3225,11 +3225,11 @@ class ci {
|
|
|
3225
3225
|
At = new Image(), At.crossOrigin = "anonymous";
|
|
3226
3226
|
let $ = ft;
|
|
3227
3227
|
$.match(/xmlns=["']http:\/\/www\.w3\.org\/2000\/svg["']/i) || ($ = $.replace(/<svg([^>]*)>/i, (rt, V) => `<svg xmlns="http://www.w3.org/2000/svg"${V}>`));
|
|
3228
|
-
let
|
|
3228
|
+
let Wt = s.width || a || 100, Kt = s.height || r || 100;
|
|
3229
3229
|
const te = $.match(/viewBox=["']\s*0\s+0\s+([\d.]+)\s+([\d.]+)\s*["']/i);
|
|
3230
|
-
if (te && (
|
|
3230
|
+
if (te && (Wt = parseFloat(te[1]), Kt = parseFloat(te[2])), $ = $.replace(/<svg([^>]*)>/i, (rt, V) => {
|
|
3231
3231
|
let st = V.replace(/\b(?:width|height)=["'][^"']*["']/gi, " ");
|
|
3232
|
-
return st.match(/\bviewBox=/i) || (st += ` viewBox="0 0 ${
|
|
3232
|
+
return st.match(/\bviewBox=/i) || (st += ` viewBox="0 0 ${Wt} ${Kt}"`), st.match(/\bpreserveAspectRatio=/i) || (st += ' preserveAspectRatio="none"'), st += ' width="100%" height="100%"', `<svg${st}>`;
|
|
3233
3233
|
}), s.colors && s.colors.length > 0 && pt.length > 0 && s.colors.forEach((rt, V) => {
|
|
3234
3234
|
if (pt[V]) {
|
|
3235
3235
|
const st = rt.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"), it = new RegExp(st, "gi");
|
|
@@ -3246,23 +3246,23 @@ class ci {
|
|
|
3246
3246
|
}).join("");
|
|
3247
3247
|
let it = "";
|
|
3248
3248
|
if (at.type === "LinearGradient" || at.type === "Linear") {
|
|
3249
|
-
const vt = (
|
|
3250
|
-
it = `<linearGradient id="${rt}" x1="${Yt}%" y1="${Qt}%" x2="${ne}%" y2="${
|
|
3249
|
+
const vt = (Ht, Nt) => Array.isArray(Ht) ? Ht[Nt] ?? (Nt === 0 ? 0 : 1) : Ht && typeof Ht == "object" ? Ht[Nt === 0 ? "x" : "y"] ?? (Nt === 0 ? 0 : 1) : Nt === 0 ? 0 : 1, Yt = vt(at.start, 0) * 100, Qt = vt(at.start, 1) * 100, ne = vt(at.end, 0) * 100, Gt = vt(at.end, 1) * 100;
|
|
3250
|
+
it = `<linearGradient id="${rt}" x1="${Yt}%" y1="${Qt}%" x2="${ne}%" y2="${Gt}%" gradientUnits="objectBoundingBox">${st}</linearGradient>`;
|
|
3251
3251
|
} else {
|
|
3252
|
-
const vt = (
|
|
3252
|
+
const vt = (Gt, Ht) => Array.isArray(Gt) ? Gt[Ht] ?? 0.5 : Gt && typeof Gt == "object" ? Gt[Ht === 0 ? "x" : "y"] ?? 0.5 : 0.5, Yt = vt(at.center, 0) * 100, Qt = vt(at.center, 1) * 100, ne = (at.radius ?? 0.5) * 100;
|
|
3253
3253
|
it = `<radialGradient id="${rt}" cx="${Yt}%" cy="${Qt}%" r="${ne}%" gradientUnits="objectBoundingBox">${st}</radialGradient>`;
|
|
3254
3254
|
}
|
|
3255
3255
|
/<defs>/i.test($) ? $ = $.replace(/<defs>/i, `<defs>${it}`) : $ = $.replace(/<svg([^>]*)>/i, `<svg$1><defs>${it}</defs>`), $ = $.replace(/\bfill\s*=\s*["'][^"']*["']/gi, (vt) => /fill\s*=\s*["']\s*(none|transparent)\s*["']/i.test(vt) ? vt : `fill="url(#${rt})"`), $ = $.replace(/fill\s*:\s*[^;"')]+/gi, (vt) => /fill\s*:\s*(none|transparent)/i.test(vt) ? vt : `fill:url(#${rt})`);
|
|
3256
3256
|
}
|
|
3257
3257
|
}
|
|
3258
3258
|
const Jt = (rt, V, st = 1) => {
|
|
3259
|
-
const it = (rt.stops || []).map((
|
|
3260
|
-
const
|
|
3261
|
-
return `<stop offset="${
|
|
3262
|
-
}).join(""), vt = (
|
|
3259
|
+
const it = (rt.stops || []).map((Gt) => {
|
|
3260
|
+
const Ht = Gt.offset !== void 0 ? Gt.offset : Gt.pos ?? 0, Nt = this.normalizeOpacity(Gt.opacity ?? 100) * st;
|
|
3261
|
+
return `<stop offset="${Ht * 100}%" stop-color="${Gt.color || "#000"}" stop-opacity="${Nt}"/>`;
|
|
3262
|
+
}).join(""), vt = (Gt, Ht, Nt = 0.5) => Array.isArray(Gt) ? Gt[Ht] ?? Nt : Gt && typeof Gt == "object" ? Gt[Ht === 0 ? "x" : "y"] ?? Nt : Nt;
|
|
3263
3263
|
if (rt.type === "LinearGradient" || rt.type === "Linear") {
|
|
3264
|
-
const
|
|
3265
|
-
return `<linearGradient id="${V}" x1="${
|
|
3264
|
+
const Gt = vt(rt.start, 0, 0) * 100, Ht = vt(rt.start, 1, 0) * 100, Nt = vt(rt.end, 0, 1) * 100, Ie = vt(rt.end, 1, 1) * 100;
|
|
3265
|
+
return `<linearGradient id="${V}" x1="${Gt}%" y1="${Ht}%" x2="${Nt}%" y2="${Ie}%" gradientUnits="objectBoundingBox">${it}</linearGradient>`;
|
|
3266
3266
|
}
|
|
3267
3267
|
const Yt = vt(rt.center, 0, 0.5) * 100, Qt = vt(rt.center, 1, 0.5) * 100, ne = (rt.radius ?? 0.5) * 100;
|
|
3268
3268
|
return `<radialGradient id="${V}" cx="${Yt}%" cy="${Qt}%" r="${ne}%" gradientUnits="objectBoundingBox">${it}</radialGradient>`;
|
|
@@ -3275,13 +3275,13 @@ class ci {
|
|
|
3275
3275
|
if (it.type === "Solid")
|
|
3276
3276
|
st = it.color || B.color || "#000000";
|
|
3277
3277
|
else if (it.type === "LinearGradient" || it.type === "RadialGradient" || it.type === "Linear" || it.type === "Radial") {
|
|
3278
|
-
const
|
|
3279
|
-
$ = ut($, Jt(it,
|
|
3278
|
+
const zt = "exode-stroke";
|
|
3279
|
+
$ = ut($, Jt(it, zt, rt)), st = `url(#${zt})`;
|
|
3280
3280
|
}
|
|
3281
3281
|
}
|
|
3282
3282
|
st || (st = V), $.match(/\bstroke\s*=\s*["']/i) ? $ = $.replace(
|
|
3283
3283
|
/\bstroke\s*=\s*["'][^"']*["']/gi,
|
|
3284
|
-
(
|
|
3284
|
+
(zt) => /stroke\s*=\s*["']\s*(none|transparent)\s*["']/i.test(zt) ? zt : `stroke="${st}"`
|
|
3285
3285
|
) : $ = $.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke="${st}"`), $ = $.replace(
|
|
3286
3286
|
new RegExp(`(?<![a-z-])stroke\\s*:\\s*(?!none|transparent)[^;"')]+`, "gi"),
|
|
3287
3287
|
`stroke:${st}`
|
|
@@ -3289,44 +3289,44 @@ class ci {
|
|
|
3289
3289
|
let vt = s.width || a || 100, Yt = s.height || r || 100;
|
|
3290
3290
|
const Qt = ft.match(/viewBox=["']\s*0\s+0\s+([\d.]+)\s+([\d.]+)\s*["']/i);
|
|
3291
3291
|
if (Qt) {
|
|
3292
|
-
const
|
|
3293
|
-
!isNaN(
|
|
3292
|
+
const zt = parseFloat(Qt[1]), oe = parseFloat(Qt[2]);
|
|
3293
|
+
!isNaN(zt) && !isNaN(oe) && (vt = zt, Yt = oe);
|
|
3294
3294
|
}
|
|
3295
|
-
const ne = Math.max(1e-3, a / vt),
|
|
3296
|
-
$.match(/\bstroke-width\s*=\s*["']/i) ? $ = $.replace(/\bstroke-width\s*=\s*["'][^"']*["']/gi, `stroke-width="${
|
|
3295
|
+
const ne = Math.max(1e-3, a / vt), Gt = Math.max(1e-3, r / Yt), Ht = (ne + Gt) / 2, Nt = (B.width || 1) / Ht;
|
|
3296
|
+
$.match(/\bstroke-width\s*=\s*["']/i) ? $ = $.replace(/\bstroke-width\s*=\s*["'][^"']*["']/gi, `stroke-width="${Nt}"`) : $ = $.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-width="${Nt}"`), $ = $.replace(/stroke-width\s*:\s*[^;"')]+/gi, `stroke-width:${Nt}`), $.match(/\bstroke-opacity\s*=\s*["']/i) ? $ = $.replace(/\bstroke-opacity\s*=\s*["'][^"']*["']/gi, `stroke-opacity="${rt}"`) : $ = $.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-opacity="${rt}"`), $ = $.replace(/stroke-opacity\s*:\s*[^;"')]+/gi, `stroke-opacity:${rt}`);
|
|
3297
3297
|
const Ie = B.lineCap || "round";
|
|
3298
3298
|
$.match(/\bstroke-linecap\s*=\s*["']/i) ? $ = $.replace(/\bstroke-linecap\s*=\s*["'][^"']*["']/gi, `stroke-linecap="${Ie}"`) : $ = $.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-linecap="${Ie}"`), $ = $.replace(/stroke-linecap\s*:\s*[^;"')]+/gi, `stroke-linecap:${Ie}`);
|
|
3299
3299
|
const Le = B.lineJoin || "round";
|
|
3300
3300
|
$.match(/\bstroke-linejoin\s*=\s*["']/i) ? $ = $.replace(/\bstroke-linejoin\s*=\s*["'][^"']*["']/gi, `stroke-linejoin="${Le}"`) : $ = $.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-linejoin="${Le}"`), $ = $.replace(/stroke-linejoin\s*:\s*[^;"')]+/gi, `stroke-linejoin:${Le}`);
|
|
3301
3301
|
const Re = B.trimStart ?? 0, Oe = B.trimEnd ?? 1, Fe = B.trimOffset ?? 0, $e = B.dashOffset ?? 0, Ye = Re !== 0 || Oe !== 1 || Fe !== 0 || $e !== 0;
|
|
3302
3302
|
if (Ye) {
|
|
3303
|
-
const
|
|
3304
|
-
this.frameCount % 600 === 0 && this.debugLog(`SVG Trim - Object: ${i.name || i.id}, Start: ${
|
|
3303
|
+
const zt = Math.max(0, Math.min(1, Re)), oe = Math.max(0, Math.min(1, Oe));
|
|
3304
|
+
this.frameCount % 600 === 0 && this.debugLog(`SVG Trim - Object: ${i.name || i.id}, Start: ${zt}, End: ${oe}`);
|
|
3305
3305
|
const we = (vt + Yt) * 2, Be = (Fe % 1 + 1) % 1, We = ($e % 1 + 1) % 1;
|
|
3306
3306
|
let de = "", ce = 0;
|
|
3307
|
-
if (
|
|
3307
|
+
if (zt >= oe)
|
|
3308
3308
|
de = `0 ${we}`, ce = 0;
|
|
3309
3309
|
else {
|
|
3310
|
-
const fe = we * (oe -
|
|
3311
|
-
ce = -(we * (
|
|
3310
|
+
const fe = we * (oe - zt), ke = we - fe;
|
|
3311
|
+
ce = -(we * (zt + Be + We)), de = `${fe} ${ke}`;
|
|
3312
3312
|
}
|
|
3313
3313
|
$.match(/\bstroke-dasharray\s*=/i) ? $ = $.replace(/\bstroke-dasharray\s*=\s*["'][^"']*["']/gi, `stroke-dasharray="${de}"`) : $ = $.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-dasharray="${de}"`), $ = $.replace(/stroke-dasharray\s*:\s*[^;"')]+/gi, `stroke-dasharray:${de}`), $.match(/\bstroke-dashoffset\s*=/i) ? $ = $.replace(/\bstroke-dashoffset\s*=\s*["'][^"']*["']/gi, `stroke-dashoffset="${ce}"`) : $ = $.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-dashoffset="${ce}"`), $ = $.replace(/stroke-dashoffset\s*:\s*[^;"')]+/gi, `stroke-dashoffset:${ce}`);
|
|
3314
3314
|
} else if (B.dashArray && B.dashArray.length > 0) {
|
|
3315
|
-
const
|
|
3316
|
-
$ = $.replace(/\bstroke-dasharray\s*=\s*["'][^"']*["']/gi, `stroke-dasharray="${
|
|
3315
|
+
const zt = B.dashArray.join(" ");
|
|
3316
|
+
$ = $.replace(/\bstroke-dasharray\s*=\s*["'][^"']*["']/gi, `stroke-dasharray="${zt}"`), $ = $.replace(/stroke-dasharray\s*:\s*[^;"')]+/gi, `stroke-dasharray:${zt}`), B.dashOffset && ($ = $.replace(/\bstroke-dashoffset\s*=\s*["'][^"']*["']/gi, `stroke-dashoffset="${B.dashOffset}"`), $ = $.replace(/stroke-dashoffset\s*:\s*[^;"')]+/gi, `stroke-dashoffset:${B.dashOffset}`));
|
|
3317
3317
|
}
|
|
3318
3318
|
if (!/\bstroke\s*=\s*["']/i.test(ft) && !new RegExp("(?<![a-z-])stroke\\s*:", "i").test(ft)) {
|
|
3319
|
-
let
|
|
3319
|
+
let zt = "", oe = "";
|
|
3320
3320
|
if (Ye) {
|
|
3321
3321
|
const de = s.width || a || 100, ce = s.height || r || 100, fe = (de + ce) * 2, ke = Math.max(0, Math.min(1, Re)), Xe = Math.max(0, Math.min(1, Oe)), Ve = (Fe % 1 + 1) % 1, Ne = ($e % 1 + 1) % 1;
|
|
3322
3322
|
if (ke >= Xe)
|
|
3323
|
-
|
|
3323
|
+
zt = ` stroke-dasharray="0 ${fe}"`, oe = ' stroke-dashoffset="0"';
|
|
3324
3324
|
else {
|
|
3325
3325
|
const De = fe * (Xe - ke), He = fe - De, H = -(fe * (ke + Ve + Ne));
|
|
3326
|
-
|
|
3326
|
+
zt = ` stroke-dasharray="${De} ${He}"`, oe = ` stroke-dashoffset="${H}"`;
|
|
3327
3327
|
}
|
|
3328
|
-
} else (x = B.dashArray) != null && x.length && (
|
|
3329
|
-
const we = ` stroke-linecap="${B.lineCap || "round"}"`, Be = ` stroke-linejoin="${B.lineJoin || "round"}"`, We = `stroke="${st}" stroke-width="${
|
|
3328
|
+
} else (x = B.dashArray) != null && x.length && (zt = ` stroke-dasharray="${B.dashArray.join(" ")}"`, B.dashOffset && (oe = ` stroke-dashoffset="${B.dashOffset}"`));
|
|
3329
|
+
const we = ` stroke-linecap="${B.lineCap || "round"}"`, Be = ` stroke-linejoin="${B.lineJoin || "round"}"`, We = `stroke="${st}" stroke-width="${Nt}" stroke-opacity="${rt}"${we}${Be}${zt}${oe}`;
|
|
3330
3330
|
$ = $.replace(
|
|
3331
3331
|
/(<svg[^>]*>)(\s*(?:<defs>[\s\S]*?<\/defs>)?)/i,
|
|
3332
3332
|
(de, ce, fe) => `${ce}${fe}<g ${We}>`
|
|
@@ -3345,12 +3345,12 @@ class ci {
|
|
|
3345
3345
|
}
|
|
3346
3346
|
let Mt = null;
|
|
3347
3347
|
if (At.complete && At.naturalWidth > 0 ? (Mt = At, this.lastValidSvgImgMap.set(i.id, At)) : Mt = this.lastValidSvgImgMap.get(i.id) || null, Mt && Mt.complete && Mt.naturalWidth > 0) {
|
|
3348
|
-
const $ = Math.max(1, a),
|
|
3348
|
+
const $ = Math.max(1, a), Wt = Math.max(1, r);
|
|
3349
3349
|
if (Z && (at == null ? void 0 : at.type) === "Solid") {
|
|
3350
|
-
this.maskBuffer || (this.maskBuffer = document.createElement("canvas"), this.maskCtx = this.maskBuffer.getContext("2d")), this.maskBuffer.width = $, this.maskBuffer.height =
|
|
3350
|
+
this.maskBuffer || (this.maskBuffer = document.createElement("canvas"), this.maskCtx = this.maskBuffer.getContext("2d")), this.maskBuffer.width = $, this.maskBuffer.height = Wt, 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, $, Wt), this.maskCtx.drawImage(Mt, 0, 0, $, Wt), this.maskCtx.globalCompositeOperation = "source-in";
|
|
3351
3351
|
const Kt = at.color || "#000000", te = this.normalizeOpacity(at.opacity ?? 100);
|
|
3352
|
-
this.maskCtx.fillStyle = Kt, this.maskCtx.globalAlpha = te, this.maskCtx.fillRect(0, 0, $,
|
|
3353
|
-
} else h !== 0 ? (t.save(), this.drawRoundRect(t, -$ / 2, -
|
|
3352
|
+
this.maskCtx.fillStyle = Kt, this.maskCtx.globalAlpha = te, this.maskCtx.fillRect(0, 0, $, Wt), t.drawImage(this.maskBuffer, -$ / 2, -Wt / 2, $, Wt);
|
|
3353
|
+
} else h !== 0 ? (t.save(), this.drawRoundRect(t, -$ / 2, -Wt / 2, $, Wt, h), t.clip(), t.drawImage(Mt, -$ / 2, -Wt / 2, $, Wt), t.restore()) : t.drawImage(Mt, -$ / 2, -Wt / 2, $, Wt);
|
|
3354
3354
|
}
|
|
3355
3355
|
}
|
|
3356
3356
|
} else if (l.type === "LineGraph")
|
|
@@ -3384,18 +3384,18 @@ class ci {
|
|
|
3384
3384
|
const pt = i.type === "Frame", at = i.clipsContent !== void 0 ? i.clipsContent : i.clipContent !== void 0 ? i.clipContent : pt;
|
|
3385
3385
|
if (t.save(), at) {
|
|
3386
3386
|
t.beginPath();
|
|
3387
|
-
const nt = e.width ?? (s == null ? void 0 : s.width) ?? i.width ?? 0, Z = e.height ?? (s == null ? void 0 : s.height) ?? i.height ?? 0,
|
|
3388
|
-
this.drawRoundRect(t, -nt / 2, -Z / 2, nt, Z,
|
|
3387
|
+
const nt = e.width ?? (s == null ? void 0 : s.width) ?? i.width ?? 0, Z = e.height ?? (s == null ? void 0 : s.height) ?? i.height ?? 0, Pt = e.cornerRadius ?? (s == null ? void 0 : s.corner_radius) ?? i.cornerRadius ?? 0;
|
|
3388
|
+
this.drawRoundRect(t, -nt / 2, -Z / 2, nt, Z, Pt), t.clip();
|
|
3389
3389
|
}
|
|
3390
3390
|
let B = 0;
|
|
3391
3391
|
for (i.children.forEach((nt) => {
|
|
3392
3392
|
const Z = o.get(nt);
|
|
3393
3393
|
if (!Z) return;
|
|
3394
|
-
const
|
|
3395
|
-
if (xt && xt.isMask && (
|
|
3394
|
+
const Pt = this.objectStates.get(nt), xt = (Pt == null ? void 0 : Pt.geometry) || Z.geometry;
|
|
3395
|
+
if (xt && xt.isMask && (Pt == null ? void 0 : Pt.visible) !== !1) {
|
|
3396
3396
|
const kt = xt.width || 0, At = xt.height || 0;
|
|
3397
3397
|
this.applyObjectTransform(t, nt);
|
|
3398
|
-
const Mt = (
|
|
3398
|
+
const Mt = (Pt == null ? void 0 : Pt.corner_radius) ?? (xt == null ? void 0 : xt.corner_radius) ?? 0;
|
|
3399
3399
|
this.applyPath(t, xt, kt, At, Mt), t.clip(), B++;
|
|
3400
3400
|
} else
|
|
3401
3401
|
this.renderObject(t, Z, o);
|
|
@@ -3412,10 +3412,10 @@ class ci {
|
|
|
3412
3412
|
feather: i.maskFeather || 0,
|
|
3413
3413
|
isVisible: !0
|
|
3414
3414
|
}] : [])).filter((B) => B.isVisible !== !1 && o.has(B.maskId)).forEach((B) => {
|
|
3415
|
-
var Mt, $,
|
|
3416
|
-
const nt = o.get(B.maskId), Z = this.objectStates.get(nt.id),
|
|
3415
|
+
var Mt, $, Wt, Kt, te, Jt;
|
|
3416
|
+
const nt = o.get(B.maskId), Z = this.objectStates.get(nt.id), Pt = B.feather || 0, xt = B.inverted === !0, kt = B.opacity !== void 0 ? typeof B.opacity == "number" ? B.opacity : B.opacity / 100 : 1;
|
|
3417
3417
|
if ((B.type || "alpha") === "luma") {
|
|
3418
|
-
(!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, nt.id, o),
|
|
3418
|
+
(!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, nt.id, o), Pt > 0 && (this.lumaCtx.filter = `blur(${Pt}px)`), this.lumaCtx.globalAlpha = kt;
|
|
3419
3419
|
const ut = (Z == null ? void 0 : Z.width) || nt.geometry.width || 0, ct = (Z == null ? void 0 : Z.height) || nt.geometry.height || 0, Ct = (Z == null ? void 0 : Z.corner_radius) ?? nt.corner_radius ?? 0;
|
|
3420
3420
|
if (((Mt = nt.geometry) == null ? void 0 : Mt.type) === "Text") {
|
|
3421
3421
|
const it = Z != null && Z.geometry ? this.deepMerge(nt.geometry, Z.geometry) : nt.geometry, vt = Z != null && Z.style ? this.deepMerge(nt.style, Z.style) : nt.style;
|
|
@@ -3426,7 +3426,7 @@ class ci {
|
|
|
3426
3426
|
let vt = this.imageCache.get(it);
|
|
3427
3427
|
vt || (vt = new Image(), vt.src = it, this.imageCache.set(it, vt)), vt.complete && vt.naturalWidth > 0 ? this.lumaCtx.drawImage(vt, -ut / 2, -ct / 2, ut, ct) : (this.applyPath(this.lumaCtx, nt.geometry, ut, ct, Ct), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill());
|
|
3428
3428
|
}
|
|
3429
|
-
} else if (((
|
|
3429
|
+
} else if (((Wt = nt.geometry) == null ? void 0 : Wt.type) === "SVG") {
|
|
3430
3430
|
const it = nt.geometry.svgContent;
|
|
3431
3431
|
if (it) {
|
|
3432
3432
|
const vt = `__lumamask_${nt.id}`;
|
|
@@ -3451,7 +3451,7 @@ class ci {
|
|
|
3451
3451
|
}
|
|
3452
3452
|
this.maskCtx.putImageData(rt, 0, 0);
|
|
3453
3453
|
} else {
|
|
3454
|
-
this.maskCtx.save(), this.rootTransform && this.maskCtx.setTransform(this.rootTransform), this.maskCtx.globalCompositeOperation = xt ? "destination-out" : "destination-in",
|
|
3454
|
+
this.maskCtx.save(), this.rootTransform && this.maskCtx.setTransform(this.rootTransform), this.maskCtx.globalCompositeOperation = xt ? "destination-out" : "destination-in", Pt > 0 && (this.maskCtx.filter = `blur(${Pt}px)`), this.maskCtx.globalAlpha = kt, this.applyAbsoluteTransform(this.maskCtx, nt.id, o);
|
|
3455
3455
|
const ut = (Z == null ? void 0 : Z.width) || nt.geometry.width || 0, ct = (Z == null ? void 0 : Z.height) || nt.geometry.height || 0, Ct = (Z == null ? void 0 : Z.corner_radius) ?? nt.corner_radius ?? 0;
|
|
3456
3456
|
if (((Kt = nt.geometry) == null ? void 0 : Kt.type) === "Text") {
|
|
3457
3457
|
const rt = Z != null && Z.geometry ? this.deepMerge(nt.geometry, Z.geometry) : nt.geometry, V = Z != null && Z.style ? this.deepMerge(nt.style, Z.style) : nt.style;
|
|
@@ -3480,15 +3480,15 @@ class ci {
|
|
|
3480
3480
|
this.applyPath(this.maskCtx, nt.geometry, ut, ct, Ct), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill();
|
|
3481
3481
|
this.maskCtx.restore();
|
|
3482
3482
|
}
|
|
3483
|
-
}),
|
|
3483
|
+
}), Ot.save(), Ot.setTransform(1, 0, 0, 1, 0, 0);
|
|
3484
3484
|
const at = i.maskBlendMode || i.blendMode;
|
|
3485
|
-
at && at !== "Normal" && (
|
|
3485
|
+
at && at !== "Normal" && (Ot.globalCompositeOperation = at.toLowerCase()), Ot.drawImage(this.maskBuffer, 0, 0), Ot.restore(), Ot.restore();
|
|
3486
3486
|
} else
|
|
3487
3487
|
t.restore();
|
|
3488
3488
|
}
|
|
3489
3489
|
}
|
|
3490
3490
|
_renderText(t, i, o, e, s, n, a, r = !1, f = !1, h = 1, l = 1) {
|
|
3491
|
-
var yt, bt, gt,
|
|
3491
|
+
var yt, bt, gt, Et, It, St, Xt, le, he;
|
|
3492
3492
|
let p = o.text || "";
|
|
3493
3493
|
if (o.textInputId && !r) {
|
|
3494
3494
|
const et = this.inputs.get(o.textInputId);
|
|
@@ -3499,15 +3499,15 @@ class ci {
|
|
|
3499
3499
|
t.save();
|
|
3500
3500
|
const mt = ((yt = e == null ? void 0 : e.fill) == null ? void 0 : yt.color) || "#000000", Rt = ((bt = e == null ? void 0 : e.fill) == null ? void 0 : bt.opacity) !== void 0 ? (gt = e == null ? void 0 : e.fill) == null ? void 0 : gt.opacity : 1;
|
|
3501
3501
|
t.fillStyle = mt, t.globalAlpha *= Rt;
|
|
3502
|
-
const
|
|
3503
|
-
t.fill(
|
|
3502
|
+
const _t = new Path2D(et);
|
|
3503
|
+
t.fill(_t), t.restore();
|
|
3504
3504
|
return;
|
|
3505
3505
|
}
|
|
3506
3506
|
let c = p || "";
|
|
3507
3507
|
o.enableSegments === !0 && o.segments && Array.isArray(o.segments) && (c = o.segments.map((et) => et && et.text ? et.text : "").join(""));
|
|
3508
3508
|
const d = o.textCase || "none";
|
|
3509
3509
|
d === "uppercase" ? c = c.toUpperCase() : d === "lowercase" ? c = c.toLowerCase() : d === "capitalize" && (c = c.replace(/\b\w/g, (et) => et.toUpperCase()));
|
|
3510
|
-
let u = ((
|
|
3510
|
+
let u = ((Et = o.fontWeight) == null ? void 0 : Et.toString()) || "400", v = o.fontStyle || "normal";
|
|
3511
3511
|
u.toLowerCase().includes("italic") && (v = "italic", u = u.replace(/italic/gi, "").trim() || "400");
|
|
3512
3512
|
const b = this.mapFontWeight(u), m = Math.max(1, o.fontSize || 32);
|
|
3513
3513
|
let y = o.fontFamily || "Inter";
|
|
@@ -3516,9 +3516,9 @@ class ci {
|
|
|
3516
3516
|
const mt = new RegExp(`[\\s-]${et}$`, "i");
|
|
3517
3517
|
mt.test(y) && (y = y.replace(mt, "").trim());
|
|
3518
3518
|
});
|
|
3519
|
-
const
|
|
3520
|
-
t.font =
|
|
3521
|
-
const
|
|
3519
|
+
const M = `${o.smallCaps === !0 ? "small-caps " : ""}${v} ${b} ${m}px "${y}", sans-serif`;
|
|
3520
|
+
t.font = M;
|
|
3521
|
+
const I = o.textVerticalAlign || "top";
|
|
3522
3522
|
t.textBaseline = "top";
|
|
3523
3523
|
const k = o.textAlign || "left";
|
|
3524
3524
|
t.textAlign = k;
|
|
@@ -3559,62 +3559,62 @@ class ci {
|
|
|
3559
3559
|
if (X === 0 || tt === 0 || X >= 1e5) {
|
|
3560
3560
|
let et = 0, mt = 0;
|
|
3561
3561
|
const Rt = G.fullText || c;
|
|
3562
|
-
(N || []).forEach((
|
|
3563
|
-
const dt =
|
|
3564
|
-
|
|
3562
|
+
(N || []).forEach((_t) => {
|
|
3563
|
+
const dt = _t.text || "", Ft = t.measureText(dt).width + (dt.length > 0 ? (dt.length - 1) * T : 0);
|
|
3564
|
+
Ft > et && (et = Ft), mt += dt.length, mt < Rt.length && (Rt[mt] === `
|
|
3565
3565
|
` || Rt[mt] === "\r") && (mt++, Rt[mt - 1] === "\r" && Rt[mt] === `
|
|
3566
3566
|
` && mt++);
|
|
3567
3567
|
}), (X === 0 || X >= 1e5) && (X = et), tt === 0 && (tt = j || 0);
|
|
3568
3568
|
}
|
|
3569
3569
|
let R = -j / 2;
|
|
3570
|
-
a > 0 && a > j && (
|
|
3570
|
+
a > 0 && a > j && (I === "top" ? R = -a / 2 : I === "middle" || I === "center" ? R = -j / 2 : I === "bottom" && (R = a / 2 - j)), R += F;
|
|
3571
3571
|
let O = null, D = 0;
|
|
3572
3572
|
if (o.pathId && this.artboard) {
|
|
3573
3573
|
const et = this.artboard.objects.find((mt) => mt.id === o.pathId);
|
|
3574
3574
|
if (et && et.type === "Shape" && ((Xt = et.geometry) == null ? void 0 : Xt.type) === "Path") {
|
|
3575
|
-
const mt = this.objectStates.get(et.id), Rt = mt != null && mt.geometry ? this.deepMerge(et.geometry, mt.geometry) : et.geometry,
|
|
3576
|
-
O = { geo: Rt, obj: et, w:
|
|
3575
|
+
const mt = this.objectStates.get(et.id), Rt = mt != null && mt.geometry ? this.deepMerge(et.geometry, mt.geometry) : et.geometry, _t = (mt == null ? void 0 : mt.scale_x) !== void 0 ? (et.width || 0) * mt.scale_x : et.width || 0, dt = (mt == null ? void 0 : mt.scale_y) !== void 0 ? (et.height || 0) * mt.scale_y : et.height || 0;
|
|
3576
|
+
O = { geo: Rt, obj: et, w: _t, h: dt }, D = this.getPerimeter(Rt, _t, dt);
|
|
3577
3577
|
}
|
|
3578
3578
|
}
|
|
3579
3579
|
const q = (et, mt) => {
|
|
3580
|
-
var
|
|
3581
|
-
if (T === 0 && (!o.enableSegments || !((
|
|
3580
|
+
var _t, dt;
|
|
3581
|
+
if (T === 0 && (!o.enableSegments || !((_t = o.segments) != null && _t.length))) return t.measureText(et).width;
|
|
3582
3582
|
let Rt = 0;
|
|
3583
|
-
for (let
|
|
3584
|
-
const
|
|
3585
|
-
let
|
|
3583
|
+
for (let Ft = 0; Ft < et.length; Ft++) {
|
|
3584
|
+
const Dt = mt + Ft;
|
|
3585
|
+
let $t = 0;
|
|
3586
3586
|
if (o.enableSegments === !0 && ((dt = o.segments) == null ? void 0 : dt.length) > 0) {
|
|
3587
|
-
let
|
|
3587
|
+
let Ot = 0, Vt = null;
|
|
3588
3588
|
for (const ie of o.segments) {
|
|
3589
|
-
if (
|
|
3590
|
-
|
|
3589
|
+
if (Dt < Ot + (ie.text || "").length) {
|
|
3590
|
+
Vt = ie;
|
|
3591
3591
|
break;
|
|
3592
3592
|
}
|
|
3593
|
-
|
|
3593
|
+
Ot += (ie.text || "").length;
|
|
3594
3594
|
}
|
|
3595
|
-
if (
|
|
3595
|
+
if (Vt) {
|
|
3596
3596
|
t.save();
|
|
3597
|
-
let ie =
|
|
3598
|
-
const me = this.mapFontWeight((
|
|
3599
|
-
t.font = `${ye} ${me} ${Ut}px "${ie}", sans-serif`,
|
|
3597
|
+
let ie = Vt.fontFamily || o.fontFamily || "Inter";
|
|
3598
|
+
const me = this.mapFontWeight((Vt.fontWeight || o.fontWeight || "400").toString()), ye = Vt.fontStyle || v, Ut = Vt.fontSize || m;
|
|
3599
|
+
t.font = `${ye} ${me} ${Ut}px "${ie}", sans-serif`, $t = t.measureText(et[Ft]).width, t.restore();
|
|
3600
3600
|
} else
|
|
3601
|
-
|
|
3601
|
+
$t = t.measureText(et[Ft]).width;
|
|
3602
3602
|
} else
|
|
3603
|
-
|
|
3604
|
-
Rt +=
|
|
3603
|
+
$t = t.measureText(et[Ft]).width;
|
|
3604
|
+
Rt += $t + T;
|
|
3605
3605
|
}
|
|
3606
3606
|
return Rt - (et.length > 0 ? T : 0);
|
|
3607
|
-
}, ot = (et, mt, Rt,
|
|
3607
|
+
}, ot = (et, mt, Rt, _t, dt) => {
|
|
3608
3608
|
var me, ye;
|
|
3609
|
-
const
|
|
3610
|
-
` || c[dt - 1] === "\r") && o.paragraphIndent ? o.paragraphIndent : 0,
|
|
3609
|
+
const Dt = (dt === 0 || c[dt - 1] === `
|
|
3610
|
+
` || c[dt - 1] === "\r") && o.paragraphIndent ? o.paragraphIndent : 0, $t = (!r || f) && (i.behaviors || []).some(
|
|
3611
3611
|
(Ut) => Ut.enabled && (Ut.type.toString().includes("Text") || ["Typewriter", "Scramble", "Wave", "Bounce", "GlitchText", "Reveal3D", "RevealSlide", "RevealBlur"].includes(Ut.type))
|
|
3612
|
-
),
|
|
3613
|
-
if (
|
|
3614
|
-
t.font =
|
|
3612
|
+
), Ot = !o.pathId && !$t && (o.enableSegments !== !0 || !o.segments || o.segments.length === 0), Vt = o.baselineShift || 0, ie = Rt + Vt;
|
|
3613
|
+
if (Ot)
|
|
3614
|
+
t.font = M, _t ? t.strokeText(et, mt + Dt, ie) : t.fillText(et, mt + Dt, ie);
|
|
3615
3615
|
else {
|
|
3616
3616
|
const Ut = q(et, dt);
|
|
3617
|
-
let Se = mt +
|
|
3617
|
+
let Se = mt + Dt;
|
|
3618
3618
|
k === "center" ? Se -= Ut / 2 : k === "right" && (Se -= Ut);
|
|
3619
3619
|
const Pe = dt + et.length >= c.length || c[dt + et.length] === `
|
|
3620
3620
|
` || c[dt + et.length] === "\r";
|
|
@@ -3669,7 +3669,7 @@ class ci {
|
|
|
3669
3669
|
for (let pt = 0; pt < et.length; pt++) {
|
|
3670
3670
|
let at = et[pt];
|
|
3671
3671
|
const B = dt + pt;
|
|
3672
|
-
let nt = 0, Z = 0,
|
|
3672
|
+
let nt = 0, Z = 0, Pt = 1, xt = 1, kt = 0, At = 1, Mt = at;
|
|
3673
3673
|
ft.forEach((ut) => {
|
|
3674
3674
|
const ct = ut.settings || {}, Ct = ct.strength || 1, rt = Date.now();
|
|
3675
3675
|
if (ut.type === U.Typewriter)
|
|
@@ -3686,7 +3686,7 @@ class ci {
|
|
|
3686
3686
|
V && (nt += (V.x - (s.x + jt)) * Ct * 0.2, Z += (V.y - (s.y + Rt + Z)) * Ct * 0.2);
|
|
3687
3687
|
} else if (ut.type === U.Reveal3D) {
|
|
3688
3688
|
const V = Math.max(0, Math.min(1, this.currentTime * (ct.speed || 1) - B * (ct.stagger || 0.1)));
|
|
3689
|
-
|
|
3689
|
+
Pt *= V, xt *= V, At = V;
|
|
3690
3690
|
} else if (ut.type === U.RevealSlide) {
|
|
3691
3691
|
const V = Math.max(0, Math.min(1, this.currentTime * 1.5 - B * 0.05)), st = (1 - V) * (ct.distance || 40) * Ct, it = ct.direction || "up";
|
|
3692
3692
|
it === "up" ? Z -= st : it === "down" ? Z += st : it === "left" ? nt -= st : it === "right" && (nt += st), At = V;
|
|
@@ -3728,7 +3728,7 @@ class ci {
|
|
|
3728
3728
|
nt += Math.sin(rt * 2e-3 * V + B) * st * Ct, Z += Math.cos(rt * 15e-4 * V + B * 0.7) * st * Ct;
|
|
3729
3729
|
} else if (ut.type === U.TextBreathe) {
|
|
3730
3730
|
const st = 1 + (Math.sin(rt * 3e-3 + B * 0.2) + 1) / 2 * 0.2 * Ct;
|
|
3731
|
-
|
|
3731
|
+
Pt *= st, xt *= st;
|
|
3732
3732
|
} else if (ut.type === U.TextSpin) {
|
|
3733
3733
|
const V = ct.speed || 1;
|
|
3734
3734
|
kt += rt * 0.01 * V + B;
|
|
@@ -3740,18 +3740,18 @@ class ci {
|
|
|
3740
3740
|
}
|
|
3741
3741
|
} else if (ut.type === U.TextPerspective) {
|
|
3742
3742
|
const V = et.length / 2, st = (B - V) / V, it = 1 - Math.abs(st) * 0.3 * Ct;
|
|
3743
|
-
|
|
3743
|
+
Pt *= it, xt *= it, nt += st * 20 * Ct;
|
|
3744
3744
|
} else if (ut.type === U.TextMirror)
|
|
3745
3745
|
At *= 0.8;
|
|
3746
3746
|
else if (ut.type === U.TextFloral) {
|
|
3747
3747
|
const V = ct.speed || 1, st = ct.stagger || 0.1, it = (rt * 1e-3 * V + B * st) % 2;
|
|
3748
|
-
it < 1 && (
|
|
3748
|
+
it < 1 && (Pt *= it, xt *= it, kt += it * Math.PI);
|
|
3749
3749
|
} else if (ut.type === U.TextSmoke) {
|
|
3750
3750
|
const V = ct.speed || 1, st = ct.height || 50, it = (rt * 5e-4 * V + B * 0.2) % 1;
|
|
3751
3751
|
Z -= it * st * Ct, nt += Math.sin(rt * 2e-3 + B) * 5 * Ct, At = 1 - it;
|
|
3752
3752
|
} else if (ut.type === U.TextVariable) {
|
|
3753
3753
|
const V = ct.speed || 1, st = ct.intensity || 1.5, it = (Math.sin(rt * 4e-3 * V + B * 0.3) + 1) / 2;
|
|
3754
|
-
|
|
3754
|
+
Pt *= 1 + it * (st - 1) * Ct;
|
|
3755
3755
|
} else if (ut.type === U.TextZing) {
|
|
3756
3756
|
const V = ct.speed || 2, st = ct.distance || 100, it = (rt * 2e-3 * V + B * 0.05) % 1;
|
|
3757
3757
|
nt += (1 - it) * st * Ct, At = it;
|
|
@@ -3766,7 +3766,7 @@ class ci {
|
|
|
3766
3766
|
Math.random() < 0.1 && (nt += (Math.random() - 0.5) * V, Z += (Math.random() - 0.5) * V, Math.random() < 0.05 && (At = 0.5));
|
|
3767
3767
|
}
|
|
3768
3768
|
});
|
|
3769
|
-
let $ = null,
|
|
3769
|
+
let $ = null, Wt = o.textDecoration || "none", Kt = m;
|
|
3770
3770
|
if (o.enableSegments === !0 && ((ye = o.segments) == null ? void 0 : ye.length) > 0) {
|
|
3771
3771
|
let ut = 0, ct = null;
|
|
3772
3772
|
for (const Ct of o.segments) {
|
|
@@ -3783,10 +3783,10 @@ class ci {
|
|
|
3783
3783
|
it.test(Ct) && (Ct = Ct.replace(it, "").trim());
|
|
3784
3784
|
});
|
|
3785
3785
|
const rt = this.mapFontWeight((ct.fontWeight || o.fontWeight || "400").toString()), V = ct.fontStyle || v;
|
|
3786
|
-
Kt = ct.fontSize || m, t.font = `${V} ${rt} ${Kt}px "${Ct}", sans-serif`, ct.fill && ($ = ct.fill), ct.textDecoration && (
|
|
3786
|
+
Kt = ct.fontSize || m, t.font = `${V} ${rt} ${Kt}px "${Ct}", sans-serif`, ct.fill && ($ = ct.fill), ct.textDecoration && (Wt = ct.textDecoration), Kt < J && (Z += (J - Kt) * 0.85);
|
|
3787
3787
|
}
|
|
3788
3788
|
} else
|
|
3789
|
-
t.font =
|
|
3789
|
+
t.font = M;
|
|
3790
3790
|
const te = t.globalAlpha;
|
|
3791
3791
|
t.globalAlpha *= At, t.save();
|
|
3792
3792
|
const Jt = t.measureText(Mt).width;
|
|
@@ -3795,7 +3795,7 @@ class ci {
|
|
|
3795
3795
|
t.translate(rt.x + vt + nt, rt.y + Yt), t.rotate(V + kt + (it === -1 ? Math.PI : 0));
|
|
3796
3796
|
} else
|
|
3797
3797
|
t.translate(jt + nt + Jt / 2, Rt + Z), kt !== 0 && t.rotate(kt);
|
|
3798
|
-
if (t.scale(
|
|
3798
|
+
if (t.scale(Pt, xt), $ && !r && !f) {
|
|
3799
3799
|
const ut = this.createCanvasFill(t, $, X, tt);
|
|
3800
3800
|
t.fillStyle = ut || $.color || "#000000";
|
|
3801
3801
|
} else if (!r && !f) {
|
|
@@ -3806,25 +3806,25 @@ class ci {
|
|
|
3806
3806
|
if (r || f) {
|
|
3807
3807
|
const ut = f ? "#000000" : this.createCanvasFill(t, e.fill, X, tt);
|
|
3808
3808
|
t.fillStyle = ut || e.fill.color || "#ffffff", t.fillText(Mt, -Jt / 2, 0);
|
|
3809
|
-
} else
|
|
3810
|
-
|
|
3809
|
+
} else _t ? t.strokeText(Mt, -Jt / 2, 0) : t.fillText(Mt, -Jt / 2, 0);
|
|
3810
|
+
Wt !== "none" && !r && this.drawTextDecoration(t, Wt, 0, 0, Jt, Kt), t.restore(), t.globalAlpha = te, k === "justify" && Ee > 0 && Mt === " " && !Pe ? jt += Jt + T + Ee : jt += Jt + T;
|
|
3811
3811
|
}
|
|
3812
3812
|
}
|
|
3813
3813
|
};
|
|
3814
3814
|
if (r) {
|
|
3815
3815
|
let et = 0, mt = R;
|
|
3816
3816
|
(N || []).forEach((Rt) => {
|
|
3817
|
-
const
|
|
3817
|
+
const _t = Rt.text || "", dt = c.indexOf(_t, et);
|
|
3818
3818
|
dt !== -1 && (et = dt);
|
|
3819
|
-
let
|
|
3820
|
-
k === "center" ?
|
|
3819
|
+
let Ft = -X / 2;
|
|
3820
|
+
k === "center" ? Ft = 0 : k === "right" && (Ft = X / 2), ot(_t, Ft, mt, !1, et), et += _t.length, mt += A;
|
|
3821
3821
|
});
|
|
3822
3822
|
} else if (f) {
|
|
3823
3823
|
let et = 0, mt = R;
|
|
3824
3824
|
(N || []).forEach((Rt) => {
|
|
3825
|
-
const
|
|
3825
|
+
const _t = Rt.text || "";
|
|
3826
3826
|
let dt = -X / 2;
|
|
3827
|
-
k === "center" ? dt = 0 : k === "right" && (dt = X / 2), ot(
|
|
3827
|
+
k === "center" ? dt = 0 : k === "right" && (dt = X / 2), ot(_t, dt, mt, !1, et), et += _t.length, et < c.length && (c[et] === `
|
|
3828
3828
|
` || c[et] === "\r") && (et++, c[et - 1] === "\r" && c[et] === `
|
|
3829
3829
|
` && et++), mt += A;
|
|
3830
3830
|
});
|
|
@@ -3832,39 +3832,39 @@ class ci {
|
|
|
3832
3832
|
if (e.fill) {
|
|
3833
3833
|
const mt = t.globalAlpha, Rt = this.createCanvasFill(t, e.fill, X, tt);
|
|
3834
3834
|
t.fillStyle = Rt || e.fill.color || "#000000", t.globalAlpha = mt * this.normalizeOpacity(e.fill.opacity ?? 100);
|
|
3835
|
-
const
|
|
3836
|
-
let
|
|
3837
|
-
const
|
|
3838
|
-
return
|
|
3835
|
+
const _t = G.fullText || (o.enableSegments ? (o.segments || []).map((Dt) => {
|
|
3836
|
+
let $t = Dt.text || "";
|
|
3837
|
+
const Ot = Dt.textCase || o.textCase || "none";
|
|
3838
|
+
return Ot === "uppercase" ? $t.toUpperCase() : Ot === "lowercase" ? $t.toLowerCase() : Ot === "capitalize" ? $t.replace(/\b\w/g, (Vt) => Vt.toUpperCase()) : $t;
|
|
3839
3839
|
}).join("") : c);
|
|
3840
|
-
let dt = 0,
|
|
3841
|
-
(N || []).forEach((
|
|
3842
|
-
const
|
|
3843
|
-
let
|
|
3844
|
-
k === "center" ?
|
|
3845
|
-
` ||
|
|
3840
|
+
let dt = 0, Ft = R;
|
|
3841
|
+
(N || []).forEach((Dt) => {
|
|
3842
|
+
const $t = Dt.text || "";
|
|
3843
|
+
let Ot = -X / 2;
|
|
3844
|
+
k === "center" ? Ot = 0 : k === "right" && (Ot = X / 2), ot($t, Ot, Ft, !1, dt), dt += $t.length, Ft += A, dt < _t.length && (_t[dt] === `
|
|
3845
|
+
` || _t[dt] === "\r") && (_ > 0 && (Ft += _), dt++, _t[dt - 1] === "\r" && _t[dt] === `
|
|
3846
3846
|
` && dt++);
|
|
3847
3847
|
}), t.globalAlpha = mt;
|
|
3848
3848
|
}
|
|
3849
3849
|
const et = o.paragraphRule;
|
|
3850
3850
|
if (et && (((le = et.top) == null ? void 0 : le.width) > 0 || ((he = et.bottom) == null ? void 0 : he.width) > 0)) {
|
|
3851
3851
|
let mt = 0;
|
|
3852
|
-
(N || []).forEach((Rt,
|
|
3853
|
-
var
|
|
3854
|
-
const
|
|
3852
|
+
(N || []).forEach((Rt, _t) => {
|
|
3853
|
+
var Dt, $t;
|
|
3854
|
+
const Ft = mt === 0 || mt < c.length && (c[mt] === `
|
|
3855
3855
|
` || c[mt] === "\r");
|
|
3856
|
-
if (
|
|
3857
|
-
if (((
|
|
3858
|
-
const
|
|
3856
|
+
if (Ft && _t > 0 && mt++, Ft) {
|
|
3857
|
+
if (((Dt = et.top) == null ? void 0 : Dt.width) > 0) {
|
|
3858
|
+
const Ot = R + _t * A - et.top.offset;
|
|
3859
3859
|
t.strokeStyle = et.top.color || "#000000", t.lineWidth = et.top.width, t.beginPath();
|
|
3860
|
-
const
|
|
3861
|
-
t.moveTo(
|
|
3860
|
+
const Vt = -n / 2 + A * 0.2;
|
|
3861
|
+
t.moveTo(Vt, Ot), t.lineTo(n / 2 - A * 0.2, Ot), t.stroke();
|
|
3862
3862
|
}
|
|
3863
|
-
if (((
|
|
3864
|
-
const
|
|
3863
|
+
if ((($t = et.bottom) == null ? void 0 : $t.width) > 0) {
|
|
3864
|
+
const Ot = R + (_t + 1) * A - et.bottom.offset;
|
|
3865
3865
|
t.strokeStyle = et.bottom.color || "#000000", t.lineWidth = et.bottom.width, t.beginPath();
|
|
3866
|
-
const
|
|
3867
|
-
t.moveTo(
|
|
3866
|
+
const Vt = -n / 2 + A * 0.2;
|
|
3867
|
+
t.moveTo(Vt, Ot), t.lineTo(n / 2 - A * 0.2, Ot), t.stroke();
|
|
3868
3868
|
}
|
|
3869
3869
|
}
|
|
3870
3870
|
mt += (Rt.text || "").length;
|
|
@@ -3873,13 +3873,18 @@ class ci {
|
|
|
3873
3873
|
if (e.stroke && e.stroke.width > 0) {
|
|
3874
3874
|
const mt = t.globalAlpha;
|
|
3875
3875
|
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;
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3876
|
+
let _t = 1;
|
|
3877
|
+
if (this.rootTransform) {
|
|
3878
|
+
const Dt = t.getTransform(), $t = Math.sqrt(Dt.a * Dt.a + Dt.b * Dt.b) || 1, Ot = this.rootTransform, Vt = Math.sqrt(Ot.a * Ot.a + Ot.b * Ot.b) || 1;
|
|
3879
|
+
_t = $t / Vt;
|
|
3880
|
+
} else
|
|
3881
|
+
_t = (Math.abs(h) + Math.abs(l)) / 2 || 1;
|
|
3882
|
+
t.lineWidth = (e.stroke.width || 1) / (_t || 1), t.globalAlpha = mt * this.normalizeOpacity(e.stroke.opacity ?? 100);
|
|
3883
|
+
let dt = 0, Ft = R;
|
|
3884
|
+
(N || []).forEach((Dt) => {
|
|
3885
|
+
let $t = -X / 2;
|
|
3886
|
+
k === "center" ? $t = 0 : k === "right" && ($t = X / 2), ot(Dt.text, $t, Ft, !0, dt), dt += (Dt.text || "").length, Ft += A, dt < c.length && (c[dt] === `
|
|
3887
|
+
` || c[dt] === "\r") && (_ > 0 && (Ft += _), dt++, c[dt - 1] === "\r" && c[dt] === `
|
|
3883
3888
|
` && dt++);
|
|
3884
3889
|
}), t.globalAlpha = mt;
|
|
3885
3890
|
}
|
|
@@ -3887,7 +3892,14 @@ class ci {
|
|
|
3887
3892
|
}
|
|
3888
3893
|
applyStrokeAlignment(t, i, o, e, s, n, a = 1, r = 1) {
|
|
3889
3894
|
if (!i.stroke || i.stroke.width <= 0 || i.stroke.isEnabled === !1) return;
|
|
3890
|
-
const f = i.stroke
|
|
3895
|
+
const f = i.stroke;
|
|
3896
|
+
let h = 1;
|
|
3897
|
+
if (this.rootTransform) {
|
|
3898
|
+
const S = t.getTransform(), C = Math.sqrt(S.a * S.a + S.b * S.b) || 1, w = this.rootTransform, M = Math.sqrt(w.a * w.a + w.b * w.b) || 1;
|
|
3899
|
+
h = C / M;
|
|
3900
|
+
} else
|
|
3901
|
+
h = (Math.abs(a) + Math.abs(r)) / 2 || 1;
|
|
3902
|
+
const l = (f.width || 1) / (h || 1), p = (f.alignment || "center").toLowerCase();
|
|
3891
3903
|
if (t.save(), i.fill && i.fill.type !== "None" && i.fill.isEnabled !== !1 && i.fill.opacity !== 0 && i.fill.color !== "transparent" && i.fill.color !== "rgba(0,0,0,0)" && (t.shadowColor = "transparent", t.shadowBlur = 0, t.shadowOffsetX = 0, t.shadowOffsetY = 0), f.fill) {
|
|
3892
3904
|
const S = this.createCanvasFill(t, f.fill, e, s);
|
|
3893
3905
|
S ? t.strokeStyle = S : t.strokeStyle = f.color || "#000000";
|
|
@@ -3901,13 +3913,13 @@ class ci {
|
|
|
3901
3913
|
if (S > 0) {
|
|
3902
3914
|
const C = Math.max(0, Math.min(1, u)), w = Math.max(0, Math.min(1, v));
|
|
3903
3915
|
if (C < w) {
|
|
3904
|
-
const
|
|
3905
|
-
t.setLineDash([
|
|
3916
|
+
const M = S * (w - C), I = S - M, k = -(S * (C + b % 1));
|
|
3917
|
+
t.setLineDash([M, I]), t.lineDashOffset = k + m * S;
|
|
3906
3918
|
} else if (C === w)
|
|
3907
3919
|
t.setLineDash([0, S]);
|
|
3908
3920
|
else {
|
|
3909
|
-
const
|
|
3910
|
-
t.setLineDash([
|
|
3921
|
+
const M = S * (1 - C + w), I = S - M, k = -(S * C);
|
|
3922
|
+
t.setLineDash([M, I]), t.lineDashOffset = k + m * S;
|
|
3911
3923
|
}
|
|
3912
3924
|
}
|
|
3913
3925
|
} else y.length > 0 && (t.setLineDash(y), t.lineDashOffset = m);
|
|
@@ -3960,7 +3972,7 @@ class ci {
|
|
|
3960
3972
|
f.x,
|
|
3961
3973
|
f.y
|
|
3962
3974
|
) : s += Math.sqrt((f.x - h) ** 2 + (f.y - l) ** 2), n = f.x, a = f.y, f.closePath || r === e.length - 1 && (t.is_closed || t.isClosed)) {
|
|
3963
|
-
const d = n, u = a, v = [...e.slice(0, r + 1)].reverse().find((
|
|
3975
|
+
const d = n, u = a, v = [...e.slice(0, r + 1)].reverse().find((M) => M.moveTo) || e[0], b = v.x, m = v.y, y = e[r].out_x, S = e[r].out_y, C = v.in_x, w = v.in_y;
|
|
3964
3976
|
y !== void 0 || C !== void 0 ? s += this.getBezierLength(
|
|
3965
3977
|
d,
|
|
3966
3978
|
u,
|
|
@@ -3982,8 +3994,8 @@ class ci {
|
|
|
3982
3994
|
getBezierLength(t, i, o, e, s, n, a, r, f = 10) {
|
|
3983
3995
|
let h = 0, l = t, p = i;
|
|
3984
3996
|
for (let c = 1; c <= f; c++) {
|
|
3985
|
-
const d = c / f, u = 1 - d, v = d * d, b = u * u, m = b * u, y = v * d, S = m * t + 3 * b * d * o + 3 * u * v * s + y * a, C = m * i + 3 * b * d * e + 3 * u * v * n + y * r, w = S - l,
|
|
3986
|
-
h += Math.sqrt(w * w +
|
|
3997
|
+
const d = c / f, u = 1 - d, v = d * d, b = u * u, m = b * u, y = v * d, S = m * t + 3 * b * d * o + 3 * u * v * s + y * a, C = m * i + 3 * b * d * e + 3 * u * v * n + y * r, w = S - l, M = C - p;
|
|
3998
|
+
h += Math.sqrt(w * w + M * M), l = S, p = C;
|
|
3987
3999
|
}
|
|
3988
4000
|
return h;
|
|
3989
4001
|
}
|
|
@@ -3991,7 +4003,7 @@ class ci {
|
|
|
3991
4003
|
if (t <= 0) return 0;
|
|
3992
4004
|
let l = 0, p = i, c = o;
|
|
3993
4005
|
for (let d = 1; d <= h; d++) {
|
|
3994
|
-
const u = d / h, v = 1 - u, b = u * u, m = v * v, y = m * v, S = b * u, C = y * i + 3 * m * u * e + 3 * v * b * n + S * r, w = y * o + 3 * m * u * s + 3 * v * b * a + S * f,
|
|
4006
|
+
const u = d / h, v = 1 - u, b = u * u, m = v * v, y = m * v, S = b * u, C = y * i + 3 * m * u * e + 3 * v * b * n + S * r, w = y * o + 3 * m * u * s + 3 * v * b * a + S * f, M = C - p, I = w - c, k = Math.sqrt(M * M + I * I);
|
|
3995
4007
|
if (l + k >= t) {
|
|
3996
4008
|
const T = t - l, L = k === 0 ? 0 : T / k;
|
|
3997
4009
|
return (d - 1 + L) / h;
|
|
@@ -4025,13 +4037,13 @@ class ci {
|
|
|
4025
4037
|
let C = 0;
|
|
4026
4038
|
const w = y.out_x !== void 0 || S.in_x !== void 0;
|
|
4027
4039
|
if (w ? C = this.getBezierLength(y.x, y.y, y.out_x ?? y.x, y.out_y ?? y.y, S.in_x ?? S.x, S.in_y ?? S.y, S.x, S.y) : C = Math.sqrt((S.x - y.x) ** 2 + (S.y - y.y) ** 2), d + C >= c || m === u[u.length - 1]) {
|
|
4028
|
-
let
|
|
4040
|
+
let M = 0;
|
|
4029
4041
|
if (w)
|
|
4030
|
-
return
|
|
4042
|
+
return M = this.getBezierTAtLength(c - d, y.x, y.y, y.out_x ?? y.x, y.out_y ?? y.y, S.in_x ?? S.x, S.in_y ?? S.y, S.x, S.y, 20), this.getBezierPointAndAngle(M, y, S, h, l);
|
|
4031
4043
|
{
|
|
4032
|
-
|
|
4033
|
-
const
|
|
4034
|
-
return { x:
|
|
4044
|
+
M = C === 0 ? 0 : (c - d) / C;
|
|
4045
|
+
const I = y.x + (S.x - y.x) * M - h, k = y.y + (S.y - y.y) * M - l, T = Math.atan2(S.y - y.y, S.x - y.x);
|
|
4046
|
+
return { x: I, y: k, angle: T };
|
|
4035
4047
|
}
|
|
4036
4048
|
}
|
|
4037
4049
|
d += C;
|
|
@@ -4047,8 +4059,8 @@ class ci {
|
|
|
4047
4059
|
return { x: 0, y: 0, angle: 0 };
|
|
4048
4060
|
}
|
|
4049
4061
|
getBezierPointAndAngle(t, i, o, e, s) {
|
|
4050
|
-
const n = i.x, a = i.y, r = i.out_x ?? i.x, f = i.out_y ?? i.y, h = o.in_x ?? o.x, l = o.in_y ?? o.y, p = o.x, c = o.y, d = 1 - t, u = t * t, v = d * d, b = v * d, m = u * t, y = b * n + 3 * v * t * r + 3 * d * u * h + m * p - e, S = b * a + 3 * v * t * f + 3 * d * u * l + m * c - s, C = 3 * v * (r - n) + 6 * d * t * (h - r) + 3 * u * (p - h), w = 3 * v * (f - a) + 6 * d * t * (l - f) + 3 * u * (c - l),
|
|
4051
|
-
return { x: y, y: S, angle:
|
|
4062
|
+
const n = i.x, a = i.y, r = i.out_x ?? i.x, f = i.out_y ?? i.y, h = o.in_x ?? o.x, l = o.in_y ?? o.y, p = o.x, c = o.y, d = 1 - t, u = t * t, v = d * d, b = v * d, m = u * t, y = b * n + 3 * v * t * r + 3 * d * u * h + m * p - e, S = b * a + 3 * v * t * f + 3 * d * u * l + m * c - s, C = 3 * v * (r - n) + 6 * d * t * (h - r) + 3 * u * (p - h), w = 3 * v * (f - a) + 6 * d * t * (l - f) + 3 * u * (c - l), M = Math.atan2(w, C);
|
|
4063
|
+
return { x: y, y: S, angle: M };
|
|
4052
4064
|
}
|
|
4053
4065
|
applyAbsoluteTransform(t, i, o) {
|
|
4054
4066
|
if (!o.get(i)) return;
|
|
@@ -4098,8 +4110,8 @@ class ci {
|
|
|
4098
4110
|
y.width = m, y.height = Math.floor(s / p);
|
|
4099
4111
|
const S = y.getContext("2d"), C = S.createImageData(y.width, y.height);
|
|
4100
4112
|
for (let w = 0; w < C.data.length; w += 4) {
|
|
4101
|
-
const
|
|
4102
|
-
C.data[w] =
|
|
4113
|
+
const M = Math.random() > 0.95 ? 150 : 255;
|
|
4114
|
+
C.data[w] = M, C.data[w + 1] = M, C.data[w + 2] = M, C.data[w + 3] = 255 * h;
|
|
4103
4115
|
}
|
|
4104
4116
|
S.putImageData(C, 0, 0), t.globalCompositeOperation = "multiply", t.imageSmoothingEnabled = !1, t.drawImage(y, -e / 2, -s / 2, e, s);
|
|
4105
4117
|
} else if (f === "acid_gradient" || f === "acid_rave") {
|
|
@@ -4108,8 +4120,8 @@ class ci {
|
|
|
4108
4120
|
const w = m * 60 % 360;
|
|
4109
4121
|
C.addColorStop(0, this._shiftHue(y, w, h * 0.7)), C.addColorStop(1, this._shiftHue(S, (w + 180) % 360, h * 0.7));
|
|
4110
4122
|
} else {
|
|
4111
|
-
const w = m * 100 % 360,
|
|
4112
|
-
C.addColorStop(0, `hsla(${w}, 80%, 50%, ${h * 0.5})`), C.addColorStop(1, `hsla(${
|
|
4123
|
+
const w = m * 100 % 360, M = (w + 180) % 360;
|
|
4124
|
+
C.addColorStop(0, `hsla(${w}, 80%, 50%, ${h * 0.5})`), C.addColorStop(1, `hsla(${M}, 80%, 50%, ${h * 0.5})`);
|
|
4113
4125
|
}
|
|
4114
4126
|
t.fillStyle = C, t.globalCompositeOperation = "screen", t.fillRect(-e / 2, -s / 2, e, s);
|
|
4115
4127
|
} else if (f === "halftone") {
|
|
@@ -4146,20 +4158,20 @@ class ci {
|
|
|
4146
4158
|
const w = y.getContext("2d");
|
|
4147
4159
|
if (w) {
|
|
4148
4160
|
w.imageSmoothingEnabled = !1;
|
|
4149
|
-
const
|
|
4150
|
-
w.drawImage(t.canvas,
|
|
4161
|
+
const M = t.getTransform(), I = M.e - e / 2, k = M.f - s / 2;
|
|
4162
|
+
w.drawImage(t.canvas, I, k, e, s, 0, 0, S, C), t.imageSmoothingEnabled = !1, t.drawImage(y, 0, 0, S, C, -e / 2, -s / 2, e, s), t.imageSmoothingEnabled = !0;
|
|
4151
4163
|
}
|
|
4152
4164
|
} else if (f === "glitch") {
|
|
4153
4165
|
const m = this.currentTime * l, y = r.chaosAmount ?? 0.2, S = Math.max(3, Math.floor(8 * h)), C = h * e * 0.15;
|
|
4154
4166
|
t.globalCompositeOperation = "screen", t.globalAlpha = h * 0.4;
|
|
4155
4167
|
const w = C * 0.3;
|
|
4156
4168
|
t.fillStyle = "rgba(255, 0, 0, 0.4)", t.fillRect(-e / 2 + w, -s / 2, e, s), t.fillStyle = "rgba(0, 255, 255, 0.4)", t.fillRect(-e / 2 - w, -s / 2, e, s), t.globalCompositeOperation = "source-over", t.globalAlpha = 1;
|
|
4157
|
-
const
|
|
4158
|
-
for (let
|
|
4159
|
-
const k = Math.sin(
|
|
4169
|
+
const M = s / S;
|
|
4170
|
+
for (let I = 0; I < S; I++) {
|
|
4171
|
+
const k = Math.sin(I * 127.1 + m * 311.7 * l) * 43758.5, T = k - Math.floor(k);
|
|
4160
4172
|
if (T > 1 - y) {
|
|
4161
|
-
const L = (T - (1 - y)) / y * C * (Math.random() > 0.5 ? 1 : -1), P = -s / 2 +
|
|
4162
|
-
t.save(), t.beginPath(), t.rect(-e / 2, P, e,
|
|
4173
|
+
const L = (T - (1 - y)) / y * C * (Math.random() > 0.5 ? 1 : -1), P = -s / 2 + I * M, _ = t.getTransform(), E = _.e - e / 2 + L, A = _.f + P;
|
|
4174
|
+
t.save(), t.beginPath(), t.rect(-e / 2, P, e, M), t.clip(), t.globalAlpha = 0.8, t.drawImage(t.canvas, E, A, e, M, -e / 2 + L, P, e, M), t.restore();
|
|
4163
4175
|
}
|
|
4164
4176
|
}
|
|
4165
4177
|
}
|
|
@@ -4333,9 +4345,9 @@ class ci {
|
|
|
4333
4345
|
renderInputBox(t, i) {
|
|
4334
4346
|
var R, O;
|
|
4335
4347
|
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((R = i.geometry) == null ? void 0 : R.width) || 250, n = ((O = i.geometry) == null ? void 0 : O.height) || 45, a = this.focusedId === i.id, r = this.lastHoveredObjectId === i.id, f = e.previewState || "default", h = f !== "default" ? f : a ? "focused" : r ? "hovered" : "default", l = e.label || { visible: !0, text: "Label" }, p = e.helperText || { visible: !1, text: "Helper text" }, c = e.leftIcon || { visible: !1 }, d = e.rightIcon || { visible: !1 }, u = e.multiline === !0, v = e.corner_radius ?? 8, b = e.corners || { tl: v, tr: v, bl: v, br: v }, m = [b.tl, b.tr, b.br, b.bl];
|
|
4336
|
-
let y = e.backgroundColor || "rgba(31, 41, 55, 1)", S = e.borderColor || "rgba(55, 65, 81, 1)", C = e.borderWidth ?? 1.5, w = e.color || "#ffffff",
|
|
4348
|
+
let y = e.backgroundColor || "rgba(31, 41, 55, 1)", S = e.borderColor || "rgba(55, 65, 81, 1)", C = e.borderWidth ?? 1.5, w = e.color || "#ffffff", M = e.placeholderColor || "rgba(156, 163, 175, 1)", I = e.fontSize || 14;
|
|
4337
4349
|
const k = `${h}Style`, T = e[k];
|
|
4338
|
-
T ? (T.backgroundColor !== void 0 && (y = T.backgroundColor), T.borderColor !== void 0 && (S = T.borderColor), T.borderWidth !== void 0 && (C = T.borderWidth), T.color !== void 0 && (w = T.color), T.placeholderColor !== void 0 && (
|
|
4350
|
+
T ? (T.backgroundColor !== void 0 && (y = T.backgroundColor), T.borderColor !== void 0 && (S = T.borderColor), T.borderWidth !== void 0 && (C = T.borderWidth), T.color !== void 0 && (w = T.color), T.placeholderColor !== void 0 && (M = T.placeholderColor), T.fontSize !== void 0 && (I = T.fontSize)) : h === "focused" ? (S = e.focusBorderColor || "rgba(59, 130, 246, 1)", C = Math.max(C, 2)) : h === "hovered" || h === "hover" ? (S = e.hoverBorderColor || S, y = e.hoverBackgroundColor || y) : h === "disabled" ? (y = e.disabledBackgroundColor || "rgba(31, 41, 55, 0.6)", S = e.disabledBorderColor || "rgba(55, 65, 81, 0.4)") : h === "error" && (S = "rgba(239, 68, 68, 1)", C = Math.max(C, 2)), t.beginPath(), this.drawRoundRect(t, -s / 2, -n / 2, s, n, m);
|
|
4339
4351
|
const L = this.createCanvasFill(t, y, s, n);
|
|
4340
4352
|
if (L && (t.fillStyle = L, t.fill()), C > 0) {
|
|
4341
4353
|
const D = this.createCanvasFill(t, S, s, n);
|
|
@@ -4347,15 +4359,15 @@ class ci {
|
|
|
4347
4359
|
}
|
|
4348
4360
|
const P = (D, q) => {
|
|
4349
4361
|
if (!D.visible || !D.svgPath) return;
|
|
4350
|
-
const ot = D.size || 14, yt = D.offset ?? 16, bt = D.color || "#ffffff", gt = q ? -(s / 2) + yt : s / 2 - yt,
|
|
4351
|
-
if (t.save(), t.translate(gt, 0), !
|
|
4352
|
-
const It = new Path2D(
|
|
4362
|
+
const ot = D.size || 14, yt = D.offset ?? 16, bt = D.color || "#ffffff", gt = q ? -(s / 2) + yt : s / 2 - yt, Et = D.svgPath;
|
|
4363
|
+
if (t.save(), t.translate(gt, 0), !Et.startsWith("<svg")) {
|
|
4364
|
+
const It = new Path2D(Et), St = ot / 24;
|
|
4353
4365
|
t.scale(St, St), t.translate(-12, -12), t.fillStyle = bt, t.fill(It);
|
|
4354
4366
|
}
|
|
4355
4367
|
t.restore();
|
|
4356
4368
|
};
|
|
4357
4369
|
P(c, !0), P(d, !1);
|
|
4358
|
-
const _ = e.text || "", E = e.placeholder || "Enter text...", A = !_, W = _ || E, z = A ?
|
|
4370
|
+
const _ = e.text || "", E = e.placeholder || "Enter text...", A = !_, W = _ || E, z = A ? M : w, Y = I, G = e.fontFamily || "Inter", N = e.fontWeight || 400;
|
|
4359
4371
|
t.font = `${N} ${Y}px "${G}", sans-serif`, t.fillStyle = z, t.textAlign = "left", t.textBaseline = u ? "top" : "middle";
|
|
4360
4372
|
const J = e.inputPadding ?? 16, x = c.visible ? (c.offset ?? 16) + (c.size || 14) / 2 + 8 : J, F = d.visible ? (d.offset ?? 16) + (d.size || 14) / 2 + 8 : J, j = -(s / 2) + x, X = s - x - F, tt = e.inputType === "password" ? "•".repeat(W.length) : W;
|
|
4361
4373
|
if (t.save(), t.beginPath(), t.rect(j - 2, -n / 2 + 4, X + 4, n - 8), t.clip(), u) {
|
|
@@ -4365,11 +4377,11 @@ class ci {
|
|
|
4365
4377
|
const ot = Y * 1.2;
|
|
4366
4378
|
let yt = 0;
|
|
4367
4379
|
D.forEach((bt, gt) => {
|
|
4368
|
-
const
|
|
4380
|
+
const Et = bt.split(" ");
|
|
4369
4381
|
let It = "";
|
|
4370
|
-
for (let St = 0; St <
|
|
4371
|
-
const Xt = It +
|
|
4372
|
-
t.measureText(Xt).width > X && St > 0 ? (t.fillText(It, j, q), It =
|
|
4382
|
+
for (let St = 0; St < Et.length; St++) {
|
|
4383
|
+
const Xt = It + Et[St] + " ";
|
|
4384
|
+
t.measureText(Xt).width > X && St > 0 ? (t.fillText(It, j, q), It = Et[St] + " ", q += ot) : It = Xt;
|
|
4373
4385
|
}
|
|
4374
4386
|
t.fillText(It, j, q), yt = t.measureText(It).width, gt < D.length - 1 && (q += ot, yt = 0);
|
|
4375
4387
|
}), a && !A && Math.floor(performance.now() / 500) % 2 === 0 && t.fillRect(j + yt, q, 1.5, Y);
|
|
@@ -4395,7 +4407,7 @@ class ci {
|
|
|
4395
4407
|
}
|
|
4396
4408
|
}
|
|
4397
4409
|
renderSlider(t, i) {
|
|
4398
|
-
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.geometry) || i.geometry, s = (o == null ? void 0 : o.options) || i.options || {}, n = e.width || 200, a = s.value ?? 50, r = s.min ?? 0, h = (s.max ?? 100) - r, l = h === 0 ? 0 : (a - r) / h, p = s.trackHeight || 4, c = s.trackRoundedness ?? 2, d = s.trackShape ?? "Rectangle", u = s.trackPath || "", v = s.accentColor || "#3b82f6", b = s.inactiveColor || "#374151", m = s.thumbShape || "Ellipse", y = s.thumbWidth ?? 16, S = s.thumbHeight ?? 16, C = s.thumbRoundedness ?? 0, w = s.thumbColor || "#ffffff",
|
|
4410
|
+
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.geometry) || i.geometry, s = (o == null ? void 0 : o.options) || i.options || {}, n = e.width || 200, a = s.value ?? 50, r = s.min ?? 0, h = (s.max ?? 100) - r, l = h === 0 ? 0 : (a - r) / h, p = s.trackHeight || 4, c = s.trackRoundedness ?? 2, d = s.trackShape ?? "Rectangle", u = s.trackPath || "", v = s.accentColor || "#3b82f6", b = s.inactiveColor || "#374151", m = s.thumbShape || "Ellipse", y = s.thumbWidth ?? 16, S = s.thumbHeight ?? 16, C = s.thumbRoundedness ?? 0, w = s.thumbColor || "#ffffff", M = s.thumbPath || "", I = s.thumbIcon || "", k = s.showValueTooltip ?? !1, T = s.tooltipBgColor || "#333333", L = s.tooltipColor || "#ffffff", P = s.tooltipOffsetX ?? 0, _ = s.tooltipOffsetY ?? -25, E = (X, tt, R, O, D, q, ot) => {
|
|
4399
4411
|
if ((X === "Custom" || X === "Icon") && ot)
|
|
4400
4412
|
try {
|
|
4401
4413
|
const yt = new Path2D(ot);
|
|
@@ -4419,14 +4431,14 @@ class ci {
|
|
|
4419
4431
|
else if (X === "Polygon") {
|
|
4420
4432
|
const yt = i.geometry.sides || 3, bt = i.geometry.radius || Math.min(O, D) / 2;
|
|
4421
4433
|
for (let gt = 0; gt < yt; gt++) {
|
|
4422
|
-
const
|
|
4434
|
+
const Et = gt * 2 * Math.PI / yt - Math.PI / 2, It = tt + bt * Math.cos(Et), St = R + bt * Math.sin(Et);
|
|
4423
4435
|
gt === 0 ? t.moveTo(It, St) : t.lineTo(It, St);
|
|
4424
4436
|
}
|
|
4425
4437
|
t.closePath();
|
|
4426
4438
|
} else if (X === "Star") {
|
|
4427
4439
|
const bt = Math.min(O, D) / 2, gt = bt / 2;
|
|
4428
|
-
for (let
|
|
4429
|
-
const It =
|
|
4440
|
+
for (let Et = 0; Et < 10; Et++) {
|
|
4441
|
+
const It = Et % 2 === 0 ? bt : gt, St = Et * Math.PI / 5 - Math.PI / 2;
|
|
4430
4442
|
t.lineTo(tt + It * Math.cos(St), R + It * Math.sin(St));
|
|
4431
4443
|
}
|
|
4432
4444
|
t.closePath();
|
|
@@ -4443,7 +4455,7 @@ class ci {
|
|
|
4443
4455
|
const G = t.getTransform(), N = Math.sqrt(G.a * G.a + G.b * G.b) || 1;
|
|
4444
4456
|
t.shadowColor = "rgba(0,0,0,0.2)", t.shadowBlur = 4 * N, t.shadowOffsetY = 1 * N;
|
|
4445
4457
|
const J = this.createCanvasFill(t, w, y, S);
|
|
4446
|
-
if (J && (t.fillStyle = J), E(m, 0, 0, y, S, C, m === "Icon" ?
|
|
4458
|
+
if (J && (t.fillStyle = J), E(m, 0, 0, y, S, C, m === "Icon" ? I : M), t.restore(), k) {
|
|
4447
4459
|
t.save(), t.translate(z + P, _);
|
|
4448
4460
|
const X = Math.round(a).toString();
|
|
4449
4461
|
t.font = "10px Inter, sans-serif";
|
|
@@ -4493,8 +4505,8 @@ class ci {
|
|
|
4493
4505
|
}
|
|
4494
4506
|
t.restore();
|
|
4495
4507
|
}
|
|
4496
|
-
const w = e.selectedOption || e.placeholder || "Select...",
|
|
4497
|
-
t.font = `${
|
|
4508
|
+
const w = e.selectedOption || e.placeholder || "Select...", M = e.fontSize || 14, I = e.fontWeight || 400, k = e.fontFamily || "Inter, sans-serif";
|
|
4509
|
+
t.font = `${I} ${M}px ${k}`;
|
|
4498
4510
|
const T = h ? e.disabledColor || "#9ca3af" : !e.selectedOption && e.placeholder ? "#9ca3af" : u;
|
|
4499
4511
|
t.fillStyle = this.createCanvasFill(t, typeof T == "string" ? { type: "Solid", color: T } : T, s, n) || "#333333", t.textAlign = "left", t.textBaseline = "middle";
|
|
4500
4512
|
const L = y === "none" ? 0 : S + 8, P = s - m * 2 - L;
|
|
@@ -4505,8 +4517,8 @@ class ci {
|
|
|
4505
4517
|
t.shadowColor = typeof N.color == "string" ? N.color : ((_ = N.color) == null ? void 0 : _.color) || "rgba(0,0,0,0.15)", t.shadowBlur = (N.blur ?? 12) * x, t.shadowOffsetY = (N.offsetY ?? 6) * x, t.shadowOffsetX = (N.offsetX ?? 0) * x, t.beginPath(), this.drawRoundRect(t, a, E, s, Y, G), t.fillStyle = this.createCanvasFill(t, typeof e.listBackgroundColor == "string" ? { type: "Solid", color: e.listBackgroundColor } : e.listBackgroundColor || { type: "Solid", color: "#ffffff" }, s, Y) || "#ffffff", t.fill();
|
|
4506
4518
|
const F = e.listBorderWidth ?? 1;
|
|
4507
4519
|
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 }, s, Y) || "#e5e7eb", t.lineWidth = F, t.stroke()), t.restore();
|
|
4508
|
-
const j = e.itemFontSize ||
|
|
4509
|
-
t.font = `${
|
|
4520
|
+
const j = e.itemFontSize || M, X = e.itemFontFamily || k;
|
|
4521
|
+
t.font = `${I} ${j}px ${X}`, A.forEach((tt, R) => {
|
|
4510
4522
|
const O = E + z + R * W;
|
|
4511
4523
|
if (tt === e.selectedOption)
|
|
4512
4524
|
t.fillStyle = this.createCanvasFill(t, typeof e.itemSelectedBackgroundColor == "string" ? { type: "Solid", color: e.itemSelectedBackgroundColor } : e.itemSelectedBackgroundColor || { type: "Solid", color: "#f3f4f6" }, s, W) || "#f3f4f6", t.fillRect(a + F, O, s - F * 2, W), t.fillStyle = e.itemSelectedColor || e.accentColor || u || "#374151";
|
|
@@ -4526,13 +4538,13 @@ class ci {
|
|
|
4526
4538
|
f && p ? (d = p.backgroundColor || d, u = p.color || u, v = p.text || v, S = p.scale ?? 0.95, b = p.cornerRadius ?? b) : r && l && (d = l.backgroundColor || d, u = l.color || u, v = l.text || v, S = l.scale ?? 1, b = l.cornerRadius ?? b, m = l.borderColor || m);
|
|
4527
4539
|
const C = -n / 2, w = -a / 2;
|
|
4528
4540
|
t.save(), t.scale(S, S), t.beginPath(), this.drawRoundRect(t, C, w, n, a, b);
|
|
4529
|
-
const
|
|
4530
|
-
|
|
4531
|
-
const
|
|
4532
|
-
t.font = `${T} ${
|
|
4541
|
+
const M = this.createCanvasFill(t, d, n, a);
|
|
4542
|
+
M && (t.fillStyle = M, t.fill()), (y > 0 || r && l.borderColor) && (t.strokeStyle = m, t.lineWidth = y || (r ? 1 : 0), t.stroke());
|
|
4543
|
+
const I = h.fontSize || 14, k = h.fontFamily || "Inter", T = h.fontWeight || 600;
|
|
4544
|
+
t.font = `${T} ${I}px "${k}", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, t.fillStyle = u, t.textAlign = "center", t.textBaseline = "middle";
|
|
4533
4545
|
let L = 0;
|
|
4534
4546
|
if (c.enabled && c.svgPath) {
|
|
4535
|
-
const P =
|
|
4547
|
+
const P = I * 1.1, _ = c.gap || 8, E = t.measureText(v), W = -(E.width + P + _) / 2, z = c.position === "left" ? W + P / 2 : W + E.width + _ + P / 2;
|
|
4536
4548
|
L = c.position === "left" ? W + P + _ + E.width / 2 : W + E.width / 2, t.save(), t.translate(z, 0);
|
|
4537
4549
|
const Y = new Path2D(c.svgPath), G = P / 24;
|
|
4538
4550
|
t.scale(G, G), t.translate(-12, -12), t.fillStyle = u, t.fill(Y), t.restore();
|
|
@@ -4556,8 +4568,8 @@ class ci {
|
|
|
4556
4568
|
const ot = this.createCanvasFill(t, b, s, n);
|
|
4557
4569
|
ot && (t.strokeStyle = ot, t.stroke());
|
|
4558
4570
|
}
|
|
4559
|
-
const C = 2, w = n - C * 2,
|
|
4560
|
-
t.beginPath(), t.arc(T +
|
|
4571
|
+
const C = 2, w = n - C * 2, M = w / 2, I = a + C, k = a + s - C - w, T = f ? k : I, L = r + C;
|
|
4572
|
+
t.beginPath(), t.arc(T + M, L + M, M, 0, Math.PI * 2);
|
|
4561
4573
|
const P = this.createCanvasFill(t, y, w, w);
|
|
4562
4574
|
P && (t.fillStyle = P, t.fill()), e.disabled && (t.globalAlpha *= 2);
|
|
4563
4575
|
let _ = !1, E = !1;
|
|
@@ -4574,9 +4586,9 @@ class ci {
|
|
|
4574
4586
|
if (!_ && !E && e.label && e.label.text) {
|
|
4575
4587
|
const ot = e.label, yt = ot.fontSize || 14, bt = ot.fontWeight || 400, gt = ot.fontFamily || "Inter";
|
|
4576
4588
|
t.font = `${bt} ${yt}px "${gt}", sans-serif`, t.fillStyle = ot.color || "#f3f4f6", t.textBaseline = "middle";
|
|
4577
|
-
const
|
|
4589
|
+
const Et = ot.gap || 10;
|
|
4578
4590
|
let It = 0, St = 0;
|
|
4579
|
-
ot.position === "left" ? (t.textAlign = "right", It = a -
|
|
4591
|
+
ot.position === "left" ? (t.textAlign = "right", It = a - Et, St = 0) : ot.position === "right" ? (t.textAlign = "left", It = a + s + Et, St = 0) : ot.position === "top" ? (t.textAlign = "center", It = 0, St = r - Et, t.textBaseline = "bottom") : ot.position === "bottom" ? (t.textAlign = "center", It = 0, St = r + n + Et, t.textBaseline = "top") : (t.textAlign = "left", It = a + s + Et, St = 0), t.fillText(ot.text, It, St);
|
|
4580
4592
|
}
|
|
4581
4593
|
}
|
|
4582
4594
|
renderCheckbox(t, i) {
|
|
@@ -4597,15 +4609,15 @@ class ci {
|
|
|
4597
4609
|
t.save(), t.beginPath();
|
|
4598
4610
|
const w = this.createCanvasFill(t, c, s, n);
|
|
4599
4611
|
t.strokeStyle = w || c, t.lineWidth = Math.max(2, s * 0.12), t.lineCap = "round", t.lineJoin = "round";
|
|
4600
|
-
const
|
|
4601
|
-
t.moveTo(
|
|
4612
|
+
const M = a + s * 0.25, I = r + n * 0.5, k = a + s * 0.45, T = r + n * 0.7, L = a + s * 0.75, P = r + n * 0.25;
|
|
4613
|
+
t.moveTo(M, I), t.lineTo(k, T), t.lineTo(L, P), t.stroke(), t.restore();
|
|
4602
4614
|
}
|
|
4603
4615
|
if (e.disabled && (t.globalAlpha *= 2), e.label && e.label.text) {
|
|
4604
4616
|
const w = e.label;
|
|
4605
4617
|
t.save(), t.font = `${w.fontWeight || 400} ${w.fontSize || 14}px "${w.fontFamily || "Inter"}", sans-serif`, t.fillStyle = w.color || "#f3f4f6", t.textBaseline = "middle";
|
|
4606
|
-
const
|
|
4607
|
-
let
|
|
4608
|
-
w.position === "left" ? (t.textAlign = "right",
|
|
4618
|
+
const M = w.gap || 8;
|
|
4619
|
+
let I = 0, k = 0;
|
|
4620
|
+
w.position === "left" ? (t.textAlign = "right", I = a - M, k = 0) : w.position === "right" ? (t.textAlign = "left", I = a + s + M, k = 0) : w.position === "top" ? (t.textAlign = "center", I = 0, k = r - M, t.textBaseline = "bottom") : w.position === "bottom" && (t.textAlign = "center", I = 0, k = r + n + M, t.textBaseline = "top"), t.fillText(w.text, I, k), t.restore();
|
|
4609
4621
|
}
|
|
4610
4622
|
}
|
|
4611
4623
|
renderRadioGroup(t, i) {
|
|
@@ -4614,28 +4626,28 @@ class ci {
|
|
|
4614
4626
|
e.disabled && (t.globalAlpha *= 0.5);
|
|
4615
4627
|
const y = 8, S = y * 2;
|
|
4616
4628
|
if (t.save(), t.font = `${m} ${v}px "${b}", sans-serif`, t.textBaseline = "middle", t.textAlign = "left", l === "vertical") {
|
|
4617
|
-
const
|
|
4618
|
-
h.forEach((
|
|
4619
|
-
const T = r + k *
|
|
4629
|
+
const M = Math.max(S, v) + p;
|
|
4630
|
+
h.forEach((I, k) => {
|
|
4631
|
+
const T = r + k * M + y;
|
|
4620
4632
|
t.beginPath(), t.arc(a + y, T, y, 0, Math.PI * 2);
|
|
4621
|
-
const L = f ===
|
|
4622
|
-
L ? (t.strokeStyle = P || c, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(a + y, T, y / 2, 0, Math.PI * 2), t.fillStyle = P || c, t.fill()) : (t.strokeStyle = _ || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = u, t.fillText(
|
|
4633
|
+
const L = f === I, P = this.createCanvasFill(t, c, S, S), _ = this.createCanvasFill(t, d, S, S);
|
|
4634
|
+
L ? (t.strokeStyle = P || c, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(a + y, T, y / 2, 0, Math.PI * 2), t.fillStyle = P || c, t.fill()) : (t.strokeStyle = _ || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = u, t.fillText(I, a + S + 8, T);
|
|
4623
4635
|
});
|
|
4624
4636
|
} else {
|
|
4625
|
-
let
|
|
4626
|
-
h.forEach((
|
|
4627
|
-
const k = f ===
|
|
4628
|
-
t.beginPath(), t.arc(
|
|
4637
|
+
let M = a;
|
|
4638
|
+
h.forEach((I) => {
|
|
4639
|
+
const k = f === I, T = t.measureText(I).width;
|
|
4640
|
+
t.beginPath(), t.arc(M + y, 0, y, 0, Math.PI * 2);
|
|
4629
4641
|
const L = this.createCanvasFill(t, c, S, S), P = this.createCanvasFill(t, d, S, S);
|
|
4630
|
-
k ? (t.strokeStyle = L || c, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(
|
|
4642
|
+
k ? (t.strokeStyle = L || c, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(M + y, 0, y / 2, 0, Math.PI * 2), t.fillStyle = L || c, t.fill()) : (t.strokeStyle = P || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = u, t.fillText(I, M + S + 6, 0), M += S + 6 + T + p;
|
|
4631
4643
|
});
|
|
4632
4644
|
}
|
|
4633
4645
|
if (t.restore(), e.disabled && (t.globalAlpha *= 2), e.label && e.label.text) {
|
|
4634
|
-
const
|
|
4635
|
-
t.save(), t.font = `${
|
|
4636
|
-
const
|
|
4646
|
+
const M = e.label;
|
|
4647
|
+
t.save(), t.font = `${M.fontWeight || 400} ${M.fontSize || 14}px "${M.fontFamily || "Inter"}", sans-serif`, t.fillStyle = M.color || "#9ca3af", t.textBaseline = "middle";
|
|
4648
|
+
const I = M.gap || 8;
|
|
4637
4649
|
let k = 0, T = 0;
|
|
4638
|
-
|
|
4650
|
+
M.position === "left" ? (t.textAlign = "right", k = a - I, T = 0) : M.position === "right" ? (t.textAlign = "left", k = a + s + I, T = 0) : M.position === "top" ? (t.textAlign = "center", k = 0, T = r - I, t.textBaseline = "bottom") : M.position === "bottom" && (t.textAlign = "center", k = 0, T = r + n + I, t.textBaseline = "top"), t.fillText(M.text, k, T), t.restore();
|
|
4639
4651
|
}
|
|
4640
4652
|
}
|
|
4641
4653
|
renderBarChart(t, i) {
|
|
@@ -4727,8 +4739,8 @@ class ci {
|
|
|
4727
4739
|
isFinite(l) || (l = 10), isFinite(p) || (p = 0), l = Math.max(l, 0), p = Math.min(p, 0);
|
|
4728
4740
|
const u = l - p || 10;
|
|
4729
4741
|
t.save(), s.enableShadows && (t.shadowColor = s.shadowColor, t.shadowBlur = s.shadowBlur, t.shadowOffsetY = s.shadowOffsetY), t.font = s.axisLabelFontSize + "px Inter, sans-serif";
|
|
4730
|
-
const v = s.showYLabels ? t.measureText(l.toFixed(0)).width + 14 : 10, b = s.showXLabels ? s.axisLabelFontSize + 12 : 8, y = (s.showLegend && d > 0 ? s.legendFontSize + 10 : 0) + 8, S = 10, C = r + v, w = f + y,
|
|
4731
|
-
if (s.enableShadows && (t.shadowColor = "transparent"), t.beginPath(), t.roundRect(r, f, n, a, 10), t.fillStyle = h.cardBackground, t.fill(), t.strokeStyle = h.cardBorderColor, t.lineWidth = 1, t.stroke(), s.chartBackground && s.chartBackground !== "transparent" && (t.beginPath(), t.rect(C, w,
|
|
4742
|
+
const v = s.showYLabels ? t.measureText(l.toFixed(0)).width + 14 : 10, b = s.showXLabels ? s.axisLabelFontSize + 12 : 8, y = (s.showLegend && d > 0 ? s.legendFontSize + 10 : 0) + 8, S = 10, C = r + v, w = f + y, M = n - v - S, I = a - y - b;
|
|
4743
|
+
if (s.enableShadows && (t.shadowColor = "transparent"), t.beginPath(), t.roundRect(r, f, n, a, 10), t.fillStyle = h.cardBackground, t.fill(), t.strokeStyle = h.cardBorderColor, t.lineWidth = 1, t.stroke(), s.chartBackground && s.chartBackground !== "transparent" && (t.beginPath(), t.rect(C, w, M, I), t.fillStyle = s.chartBackground, t.fill()), s.showLegend && d > 0) {
|
|
4732
4744
|
t.font = s.legendFontSize + "px Inter, sans-serif", t.textBaseline = "middle";
|
|
4733
4745
|
const P = f + 12;
|
|
4734
4746
|
let _ = C;
|
|
@@ -4742,11 +4754,11 @@ class ci {
|
|
|
4742
4754
|
t.setLineDash(s.gridLineDash || []), t.lineWidth = s.gridLineWidth || 1, t.strokeStyle = h.gridColor;
|
|
4743
4755
|
for (let P = 0; P <= k; P++)
|
|
4744
4756
|
if (s.orientation === "horizontal") {
|
|
4745
|
-
const _ = C + P / k *
|
|
4746
|
-
t.beginPath(), t.moveTo(_, w), t.lineTo(_, w +
|
|
4757
|
+
const _ = C + P / k * M;
|
|
4758
|
+
t.beginPath(), t.moveTo(_, w), t.lineTo(_, w + I), t.stroke();
|
|
4747
4759
|
} else {
|
|
4748
|
-
const _ = w + P / k *
|
|
4749
|
-
t.beginPath(), t.moveTo(C, _), t.lineTo(C +
|
|
4760
|
+
const _ = w + P / k * I;
|
|
4761
|
+
t.beginPath(), t.moveTo(C, _), t.lineTo(C + M, _), t.stroke();
|
|
4750
4762
|
}
|
|
4751
4763
|
t.setLineDash([]);
|
|
4752
4764
|
}
|
|
@@ -4754,16 +4766,16 @@ class ci {
|
|
|
4754
4766
|
t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "right", t.textBaseline = "middle", t.fillStyle = h.axisLabelColor;
|
|
4755
4767
|
for (let P = 0; P <= k; P++)
|
|
4756
4768
|
if (s.orientation === "horizontal") {
|
|
4757
|
-
const _ = p + P / k * u, E = C + P / k *
|
|
4758
|
-
t.textAlign = "center", t.fillText(_.toFixed(0), E, w +
|
|
4769
|
+
const _ = p + P / k * u, E = C + P / k * M;
|
|
4770
|
+
t.textAlign = "center", t.fillText(_.toFixed(0), E, w + I + s.axisLabelFontSize);
|
|
4759
4771
|
} else {
|
|
4760
|
-
const _ = l - P / k * u, E = w + P / k *
|
|
4772
|
+
const _ = l - P / k * u, E = w + P / k * I;
|
|
4761
4773
|
t.textAlign = "right", t.fillText(_.toFixed(0), C - 6, E);
|
|
4762
4774
|
}
|
|
4763
4775
|
}
|
|
4764
|
-
if (t.setLineDash([]), s.showXAxis && (t.lineWidth = s.xAxisLineWidth || 1, t.strokeStyle = s.xAxisColor, t.beginPath(), t.moveTo(C, w +
|
|
4776
|
+
if (t.setLineDash([]), s.showXAxis && (t.lineWidth = s.xAxisLineWidth || 1, t.strokeStyle = s.xAxisColor, t.beginPath(), t.moveTo(C, w + I), t.lineTo(C + M, w + I), t.stroke()), s.showYAxis && (t.lineWidth = s.yAxisLineWidth || 1, t.strokeStyle = s.yAxisColor, t.beginPath(), t.moveTo(C, w), t.lineTo(C, w + I), t.stroke()), s.enableShadows && (t.shadowColor = s.shadowColor), s.chartType === "stacked")
|
|
4765
4777
|
if (s.orientation === "horizontal") {
|
|
4766
|
-
const P =
|
|
4778
|
+
const P = I / c;
|
|
4767
4779
|
for (let _ = 0; _ < c; _++) {
|
|
4768
4780
|
const E = w + _ * P + P / 2;
|
|
4769
4781
|
s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "right", t.textBaseline = "middle", t.fillStyle = h.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[_] || "", C - 5, E), s.enableShadows && (t.shadowColor = s.shadowColor));
|
|
@@ -4771,22 +4783,22 @@ class ci {
|
|
|
4771
4783
|
s.datasets.forEach((W, z) => {
|
|
4772
4784
|
const Y = W.data[_] ?? 0;
|
|
4773
4785
|
if (Y === 0) return;
|
|
4774
|
-
const G = Y / u *
|
|
4786
|
+
const G = Y / u * M, N = Math.min(s.barWidth * d + s.barGap, P - 8), J = E - N / 2, x = A;
|
|
4775
4787
|
A += G;
|
|
4776
4788
|
const F = s._resolveColor(W.color, z);
|
|
4777
4789
|
t.beginPath(), t.fillStyle = s._makeGradient(t, F, x, J, x + G, J), s._drawRoundedBar(t, x, J, G, N, z === d - 1 ? s.barCornerRadius : 0, !1), s.barStyle === "outline" || s.barStyle === "dashed" ? (t.fillStyle = "transparent", t.strokeStyle = s.barBorderColor === "auto" ? F : s.barBorderColor, t.lineWidth = s.barBorderWidth, s.barStyle === "dashed" && t.setLineDash([4, 4]), t.stroke(), t.setLineDash([])) : t.fill();
|
|
4778
4790
|
});
|
|
4779
4791
|
}
|
|
4780
4792
|
} else {
|
|
4781
|
-
const P =
|
|
4793
|
+
const P = M / c;
|
|
4782
4794
|
for (let _ = 0; _ < c; _++) {
|
|
4783
4795
|
const E = C + _ * P + P / 2;
|
|
4784
|
-
s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "top", t.fillStyle = h.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[_] || "", E, w +
|
|
4785
|
-
let A = w +
|
|
4796
|
+
s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "top", t.fillStyle = h.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[_] || "", E, w + I + 5), s.enableShadows && (t.shadowColor = s.shadowColor));
|
|
4797
|
+
let A = w + I;
|
|
4786
4798
|
s.datasets.forEach((W, z) => {
|
|
4787
4799
|
const Y = W.data[_] ?? 0;
|
|
4788
4800
|
if (Y === 0) return;
|
|
4789
|
-
const G = Y / u *
|
|
4801
|
+
const G = Y / u * I, N = Math.min(s.barWidth * d + s.barGap, P - 8), J = E - N / 2, x = A - G;
|
|
4790
4802
|
A -= G;
|
|
4791
4803
|
const F = s._resolveColor(W.color, z);
|
|
4792
4804
|
t.beginPath(), t.fillStyle = s._makeGradient(t, F, J, x, J, x + G), s._drawRoundedBar(t, J, x, N, G, z === d - 1 ? s.barCornerRadius : 0, !0), s.barStyle === "outline" || s.barStyle === "dashed" ? (t.fillStyle = "transparent", t.strokeStyle = s.barBorderColor === "auto" ? F : s.barBorderColor, t.lineWidth = s.barBorderWidth, s.barStyle === "dashed" && t.setLineDash([4, 4]), t.stroke(), t.setLineDash([])) : t.fill();
|
|
@@ -4794,26 +4806,26 @@ class ci {
|
|
|
4794
4806
|
}
|
|
4795
4807
|
}
|
|
4796
4808
|
else if (s.orientation === "horizontal") {
|
|
4797
|
-
const P =
|
|
4809
|
+
const P = I / c, _ = d * s.barWidth + Math.max(0, (d - 1) * s.barGap), E = C + (0 - p) / u * M;
|
|
4798
4810
|
for (let A = 0; A < c; A++) {
|
|
4799
4811
|
const W = w + A * P + P / 2;
|
|
4800
4812
|
s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "right", t.textBaseline = "middle", t.fillStyle = h.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[A] || "", C - 5, W), s.enableShadows && (t.shadowColor = s.shadowColor));
|
|
4801
4813
|
const z = W - _ / 2;
|
|
4802
4814
|
s.datasets.forEach((Y, G) => {
|
|
4803
|
-
const N = Y.data[A] ?? 0, J = Math.abs(N / u *
|
|
4815
|
+
const N = Y.data[A] ?? 0, J = Math.abs(N / u * M);
|
|
4804
4816
|
if (J < 1) return;
|
|
4805
4817
|
const x = z + G * (s.barWidth + s.barGap), F = N >= 0 ? E : E - J, j = s._resolveColor(Y.color, G);
|
|
4806
4818
|
t.beginPath(), t.fillStyle = s._makeGradient(t, j, F, x, F + J, x), s._drawRoundedBar(t, F, x, J, s.barWidth, s.barCornerRadius, !1), s.barStyle === "outline" || s.barStyle === "dashed" ? (t.fillStyle = "transparent", t.strokeStyle = s.barBorderColor === "auto" ? j : s.barBorderColor, t.lineWidth = s.barBorderWidth, s.barStyle === "dashed" && t.setLineDash([4, 4]), t.stroke(), t.setLineDash([])) : t.fill(), s.showValueOnTop && N !== 0 && (t.font = (s.valueFontWeight || "bold") + " " + (s.valueFontSize || 10) + "px Inter, sans-serif", t.textAlign = N >= 0 ? "left" : "right", t.textBaseline = "middle", t.fillStyle = s.valueColor === "auto" ? j : s.valueColor || "#fff", t.shadowColor = "transparent", t.fillText(N.toString(), N >= 0 ? F + J + 4 : F - 4, x + s.barWidth / 2), s.enableShadows && (t.shadowColor = s.shadowColor));
|
|
4807
4819
|
});
|
|
4808
4820
|
}
|
|
4809
4821
|
} else {
|
|
4810
|
-
const P =
|
|
4822
|
+
const P = M / c, _ = d * s.barWidth + Math.max(0, (d - 1) * s.barGap), E = w + I - (0 - p) / u * I;
|
|
4811
4823
|
for (let A = 0; A < c; A++) {
|
|
4812
4824
|
const W = C + A * P + P / 2;
|
|
4813
|
-
s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "top", t.fillStyle = h.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[A] || "", W, w +
|
|
4825
|
+
s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "top", t.fillStyle = h.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[A] || "", W, w + I + 5), s.enableShadows && (t.shadowColor = s.shadowColor));
|
|
4814
4826
|
const z = W - _ / 2;
|
|
4815
4827
|
s.datasets.forEach((Y, G) => {
|
|
4816
|
-
const N = Y.data[A] ?? 0, J = Math.abs(N / u *
|
|
4828
|
+
const N = Y.data[A] ?? 0, J = Math.abs(N / u * I);
|
|
4817
4829
|
if (J < 1) return;
|
|
4818
4830
|
const x = z + G * (s.barWidth + s.barGap), F = N >= 0 ? E - J : E, j = s._resolveColor(Y.color, G);
|
|
4819
4831
|
t.beginPath(), t.fillStyle = s._makeGradient(t, j, x, F, x, F + J), s._drawRoundedBar(t, x, F, s.barWidth, J, s.barCornerRadius, !0), s.barStyle === "outline" || s.barStyle === "dashed" ? (t.fillStyle = "transparent", t.strokeStyle = s.barBorderColor === "auto" ? j : s.barBorderColor, t.lineWidth = s.barBorderWidth, s.barStyle === "dashed" && t.setLineDash([4, 4]), t.stroke(), t.setLineDash([])) : t.fill(), s.showValueOnTop && N !== 0 && (t.font = (s.valueFontWeight || "bold") + " " + (s.valueFontSize || 10) + "px Inter, sans-serif", t.textAlign = "center", t.textBaseline = N >= 0 ? "bottom" : "top", t.fillStyle = s.valueColor === "auto" ? j : s.valueColor || "#fff", t.shadowColor = "transparent", t.fillText(N.toString(), x + s.barWidth / 2, N >= 0 ? F - 4 : F + J + 4), s.enableShadows && (t.shadowColor = s.shadowColor));
|
|
@@ -4865,46 +4877,46 @@ class ci {
|
|
|
4865
4877
|
if (s.chartType === "rose") {
|
|
4866
4878
|
const m = Math.max(...s.slices.map((C) => C.value || 0)), y = Math.PI * 2 / s.slices.length, S = c > 0 ? s.sliceGap / c : 0;
|
|
4867
4879
|
s.slices.forEach((C, w) => {
|
|
4868
|
-
const
|
|
4869
|
-
if (
|
|
4870
|
-
const
|
|
4871
|
-
if (t.beginPath(), t.moveTo(d, u), t.arc(d, u,
|
|
4872
|
-
const P = k + (T - k) / 2, _ = d +
|
|
4880
|
+
const M = C.value || 0;
|
|
4881
|
+
if (M === 0) return;
|
|
4882
|
+
const I = M / m * c, k = -Math.PI / 2 + w * y + S / 2, T = k + y - S, L = s._resolveSliceColor(C, w);
|
|
4883
|
+
if (t.beginPath(), t.moveTo(d, u), t.arc(d, u, I, k, T), t.closePath(), t.fillStyle = L + "cc", t.fill(), t.strokeStyle = L, t.lineWidth = 1.5, t.stroke(), s.showLabels) {
|
|
4884
|
+
const P = k + (T - k) / 2, _ = d + I * 0.65 * Math.cos(P), E = u + I * 0.65 * Math.sin(P), A = Math.round(M / r * 100);
|
|
4873
4885
|
t.save(), t.font = `bold ${s.labelFontSize}px Inter, sans-serif`, t.fillStyle = f.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${A}%`, _, E), t.restore();
|
|
4874
4886
|
}
|
|
4875
4887
|
});
|
|
4876
4888
|
} else {
|
|
4877
4889
|
const m = s.chartType === "pie" ? 0 : s.innerRadius, y = c * Math.max(0, m), S = c > 0 ? s.sliceGap / c : 0;
|
|
4878
4890
|
let C = -Math.PI / 2;
|
|
4879
|
-
if (s.slices.forEach((w,
|
|
4880
|
-
const
|
|
4881
|
-
if (
|
|
4882
|
-
C +=
|
|
4891
|
+
if (s.slices.forEach((w, M) => {
|
|
4892
|
+
const I = w.value || 0;
|
|
4893
|
+
if (I === 0) {
|
|
4894
|
+
C += I / r * Math.PI * 2;
|
|
4883
4895
|
return;
|
|
4884
4896
|
}
|
|
4885
|
-
const k =
|
|
4897
|
+
const k = I / r * Math.PI * 2, T = C + S / 2, L = C + k - S / 2;
|
|
4886
4898
|
if (L <= T) {
|
|
4887
4899
|
C += k;
|
|
4888
4900
|
return;
|
|
4889
4901
|
}
|
|
4890
|
-
const P = s._resolveSliceColor(w,
|
|
4902
|
+
const P = s._resolveSliceColor(w, M);
|
|
4891
4903
|
if (t.beginPath(), t.fillStyle = P, y <= 0 ? (t.moveTo(d, u), t.arc(d, u, c, T, L), t.lineTo(d, u)) : (t.moveTo(d + c * Math.cos(T), u + c * Math.sin(T)), t.arc(d, u, c, T, L), t.arc(d, u, y, L, T, !0), t.closePath()), t.fill(), s.showLabels) {
|
|
4892
|
-
const _ = T + (L - T) / 2, E = y + (c - y) / 2, A = d + E * Math.cos(_), W = u + E * Math.sin(_), z = Math.round(
|
|
4904
|
+
const _ = T + (L - T) / 2, E = y + (c - y) / 2, A = d + E * Math.cos(_), W = u + E * Math.sin(_), z = Math.round(I / r * 100);
|
|
4893
4905
|
t.save(), t.font = `bold ${s.labelFontSize}px Inter, sans-serif`, t.fillStyle = f.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${z}%`, A, W), t.restore();
|
|
4894
4906
|
}
|
|
4895
4907
|
C += k;
|
|
4896
4908
|
}), s.chartType === "donut" && s.showCenterText && y > 14) {
|
|
4897
|
-
const w = Math.round(r),
|
|
4898
|
-
t.textAlign = "center", t.textBaseline = "middle", t.font = `bold ${
|
|
4909
|
+
const w = Math.round(r), M = Math.min(Math.floor(y * 0.52), 20), I = Math.min(Math.floor(y * 0.26), 10);
|
|
4910
|
+
t.textAlign = "center", t.textBaseline = "middle", t.font = `bold ${M}px Inter, sans-serif`, t.fillStyle = f.centerTextColor, t.fillText(w.toString(), d, u - I * 0.5), s.centerLabel && (t.font = `${I}px Inter, sans-serif`, t.fillStyle = f.centerLabelColor, t.fillText(s.centerLabel, d, u + M * 0.6));
|
|
4899
4911
|
}
|
|
4900
4912
|
}
|
|
4901
4913
|
if (s.showLegend && s.slices.length > 0) {
|
|
4902
4914
|
t.font = `${s.legendFontSize}px Inter, sans-serif`;
|
|
4903
4915
|
const m = 2, y = n / m, S = s.legendFontSize + 8, C = a / 2 - l + 10, w = -n / 2 + 10;
|
|
4904
|
-
s.slices.forEach((
|
|
4905
|
-
const k =
|
|
4916
|
+
s.slices.forEach((M, I) => {
|
|
4917
|
+
const k = I % m, T = Math.floor(I / m), L = w + k * y, P = C + T * S, _ = s._resolveSliceColor(M, I), E = 7;
|
|
4906
4918
|
t.beginPath(), t.roundRect(L, P - E / 2, E, E, 2), t.fillStyle = _, t.fill(), t.textAlign = "left", t.textBaseline = "middle", t.fillStyle = f.legendColor;
|
|
4907
|
-
const A = Math.round((
|
|
4919
|
+
const A = Math.round((M.value || 0) / r * 100), W = `${M.label || "Item"} ${A}%`, z = y - E - 20;
|
|
4908
4920
|
let Y = W;
|
|
4909
4921
|
for (; t.measureText(Y).width > z && Y.length > 4; )
|
|
4910
4922
|
Y = Y.slice(0, -4) + "…";
|
|
@@ -4925,14 +4937,14 @@ class ci {
|
|
|
4925
4937
|
i.joystickType === "2D" ? (c = r * p, d = f * p) : i.joystickType === "1D_X" ? (c = r * p, d = 0) : i.joystickType === "1D_Y" && (c = 0, d = f * p), t.beginPath(), t.arc(c, d, a, 0, Math.PI * 2), t.fillStyle = "#fff", t.fill(), t.strokeStyle = "rgba(0,0,0,0.5)", t.lineWidth = 1, t.stroke(), t.restore();
|
|
4926
4938
|
}
|
|
4927
4939
|
getRadioGroupItemIndexAtPointer(t, i, o) {
|
|
4928
|
-
var
|
|
4940
|
+
var I, k;
|
|
4929
4941
|
const e = t.options || {}, s = this.objectStates.get(t.id) || {}, n = e.optionsList || [];
|
|
4930
4942
|
if (n.length === 0) return null;
|
|
4931
|
-
const a = s.width !== void 0 ? s.width : ((
|
|
4943
|
+
const a = s.width !== void 0 ? s.width : ((I = t.geometry) == null ? void 0 : I.width) || 180, r = s.height !== void 0 ? s.height : ((k = t.geometry) == null ? void 0 : k.height) || 100, f = e.orientation || "vertical", h = e.itemGap !== void 0 ? e.itemGap : 16, l = e.fontSize || 14, p = this.getWorldTransform(t.id), c = i - p.x, d = o - p.y, u = -p.rotation * (Math.PI / 180), v = Math.cos(u), b = Math.sin(u), m = c * v - d * b, y = c * b + d * v, C = 8 * 2, w = -a / 2, M = -r / 2;
|
|
4932
4944
|
if (f === "vertical") {
|
|
4933
4945
|
const T = Math.max(C, l) + h;
|
|
4934
4946
|
for (let L = 0; L < n.length; L++) {
|
|
4935
|
-
const P =
|
|
4947
|
+
const P = M + L * T;
|
|
4936
4948
|
if (m >= w && m <= w + a && y >= P && y <= P + T)
|
|
4937
4949
|
return L;
|
|
4938
4950
|
}
|
|
@@ -4940,7 +4952,7 @@ class ci {
|
|
|
4940
4952
|
let T = w;
|
|
4941
4953
|
for (let L = 0; L < n.length; L++) {
|
|
4942
4954
|
const _ = n[L].length * 8, E = C + 6 + _ + h;
|
|
4943
|
-
if (m >= T && m <= T + E && y >=
|
|
4955
|
+
if (m >= T && m <= T + E && y >= M && y <= M + r)
|
|
4944
4956
|
return L;
|
|
4945
4957
|
T += E;
|
|
4946
4958
|
}
|
|
@@ -5008,9 +5020,9 @@ class ci {
|
|
|
5008
5020
|
if (t.beginPath(), t.moveTo(p(0), e / 2), t.lineTo(p(0), l(v[0])), u.smoothing && v.length > 2)
|
|
5009
5021
|
for (let m = 0; m < v.length - 1; m++) {
|
|
5010
5022
|
const y = v[m === 0 ? m : m - 1], S = v[m], C = v[m + 1], w = v[m + 1 === v.length - 1 ? m + 1 : m + 2];
|
|
5011
|
-
for (let
|
|
5012
|
-
const
|
|
5013
|
-
t.lineTo(p(m +
|
|
5023
|
+
for (let M = 1; M <= d; M++) {
|
|
5024
|
+
const I = M / d, k = this._catmullRom(y, S, C, w, I);
|
|
5025
|
+
t.lineTo(p(m + I), l(k));
|
|
5014
5026
|
}
|
|
5015
5027
|
}
|
|
5016
5028
|
else
|
|
@@ -5024,8 +5036,8 @@ class ci {
|
|
|
5024
5036
|
for (let b = 0; b < v.length - 1; b++) {
|
|
5025
5037
|
const m = v[b === 0 ? b : b - 1], y = v[b], S = v[b + 1], C = v[b + 1 === v.length - 1 ? b + 1 : b + 2];
|
|
5026
5038
|
for (let w = 1; w <= d; w++) {
|
|
5027
|
-
const
|
|
5028
|
-
t.lineTo(p(b +
|
|
5039
|
+
const M = w / d, I = this._catmullRom(m, y, S, C, M);
|
|
5040
|
+
t.lineTo(p(b + M), l(I));
|
|
5029
5041
|
}
|
|
5030
5042
|
}
|
|
5031
5043
|
else
|
|
@@ -5152,10 +5164,10 @@ class ci {
|
|
|
5152
5164
|
}
|
|
5153
5165
|
renderListView(t, i) {
|
|
5154
5166
|
var A, W, z, Y;
|
|
5155
|
-
const o = this.objectStates.get(i.id) || {}, e = o.options || i.options || {}, s = o.width !== void 0 ? o.width : ((A = i.geometry) == null ? void 0 : A.width) || 200, n = o.height !== void 0 ? o.height : ((W = i.geometry) == null ? void 0 : W.height) || 300, a = -s / 2, r = -n / 2, f = o.corner_radius !== void 0 ? o.corner_radius : e.corner_radius ?? 0, h = e.orientation || "vertical", l = e.items || [], p = e.itemGap ?? 10, c = e.itemHeight ?? 50, d = e.itemWidth ?? 200, u = e.scrollOffset ?? 0, v = e.padding ?? 0, b = e.glassEffect !== !1, m = e.accentColor || "#3b82f6", y = e.itemTextColor || "#333333", S = e.itemBackgroundColor || "#ffffff", C = e.hoveredIndex ?? null, w = e.activeItemIndex ?? null,
|
|
5156
|
-
if (t.save(), t.globalAlpha *= T,
|
|
5167
|
+
const o = this.objectStates.get(i.id) || {}, e = o.options || i.options || {}, s = o.width !== void 0 ? o.width : ((A = i.geometry) == null ? void 0 : A.width) || 200, n = o.height !== void 0 ? o.height : ((W = i.geometry) == null ? void 0 : W.height) || 300, a = -s / 2, r = -n / 2, f = o.corner_radius !== void 0 ? o.corner_radius : e.corner_radius ?? 0, h = e.orientation || "vertical", l = e.items || [], p = e.itemGap ?? 10, c = e.itemHeight ?? 50, d = e.itemWidth ?? 200, u = e.scrollOffset ?? 0, v = e.padding ?? 0, b = e.glassEffect !== !1, m = e.accentColor || "#3b82f6", y = e.itemTextColor || "#333333", S = e.itemBackgroundColor || "#ffffff", C = e.hoveredIndex ?? null, w = e.activeItemIndex ?? null, M = e.glowIntensity ?? 0, I = e.glowColor || "#3b82f6", k = typeof I == "string" ? I : I.color || ((Y = (z = I.stops) == null ? void 0 : z[0]) == null ? void 0 : Y.color) || "#3b82f6", T = e.opacity !== void 0 ? e.opacity : i.opacity !== void 0 ? i.opacity : 1;
|
|
5168
|
+
if (t.save(), t.globalAlpha *= T, M > 0) {
|
|
5157
5169
|
const G = t.getTransform(), N = Math.sqrt(G.a * G.a + G.b * G.b) || 1;
|
|
5158
|
-
t.shadowColor = k, t.shadowBlur =
|
|
5170
|
+
t.shadowColor = k, t.shadowBlur = M * 2 * N, t.shadowOffsetX = 0, t.shadowOffsetY = 0;
|
|
5159
5171
|
}
|
|
5160
5172
|
if (b) {
|
|
5161
5173
|
const G = e.listBackgroundColor || "rgba(31, 41, 55, 0.4)", N = this.createCanvasFill(t, G, s, n);
|
|
@@ -5193,8 +5205,8 @@ class ci {
|
|
|
5193
5205
|
const J = e.listLayout || "linear", x = J === "circular" ? d : h === "vertical" ? s : d, F = J === "circular" || h === "vertical" ? c : n;
|
|
5194
5206
|
let j = 0, X = 0, tt = 0;
|
|
5195
5207
|
if (J === "circular") {
|
|
5196
|
-
const St = l.length || 1, Xt = Math.PI * 2 / St, le = e.circularStartAngle || 0, he = e.circularRadius || 100, et = u * 0.01 + le * Math.PI / 180, mt = N * Xt + et, Rt = a + s / 2,
|
|
5197
|
-
j = Rt + Math.cos(mt) * he - x / 2, X =
|
|
5208
|
+
const St = l.length || 1, Xt = Math.PI * 2 / St, le = e.circularStartAngle || 0, he = e.circularRadius || 100, et = u * 0.01 + le * Math.PI / 180, mt = N * Xt + et, Rt = a + s / 2, _t = r + n / 2;
|
|
5209
|
+
j = Rt + Math.cos(mt) * he - x / 2, X = _t + Math.sin(mt) * he - F / 2, tt = mt + (e.itemRotation || 0) * Math.PI / 180;
|
|
5198
5210
|
} else
|
|
5199
5211
|
j = h === "vertical" ? a : _, X = h === "vertical" ? _ : r, tt = (e.itemRotation || 0) * Math.PI / 180;
|
|
5200
5212
|
const R = C === N, O = w === N, D = O && e.activeItemShape ? e.activeItemShape : e.itemShape || "rectangle", q = O && e.activeItemShape ? e.activeItemPath : e.itemPath || "", ot = e.itemCornerRadius || 0;
|
|
@@ -5215,10 +5227,10 @@ class ci {
|
|
|
5215
5227
|
}
|
|
5216
5228
|
const yt = O ? "#ffffff" : b ? "rgba(255, 255, 255, 0.9)" : y;
|
|
5217
5229
|
t.fillStyle = yt, t.font = O || R ? "600 14px Inter, sans-serif" : "400 14px Inter, sans-serif";
|
|
5218
|
-
const bt = typeof G == "string" ? G : (G == null ? void 0 : G.label) || `Item ${N + 1}`, gt = j + (h === "vertical" ? 16 : x / 2),
|
|
5230
|
+
const bt = typeof G == "string" ? G : (G == null ? void 0 : G.label) || `Item ${N + 1}`, gt = j + (h === "vertical" ? 16 : x / 2), Et = X + F / 2;
|
|
5219
5231
|
h === "horizontal" || J === "circular" ? t.textAlign = "center" : t.textAlign = "left";
|
|
5220
5232
|
const It = J === "circular" ? j + x / 2 : gt;
|
|
5221
|
-
t.fillText(bt, It,
|
|
5233
|
+
t.fillText(bt, It, Et), t.restore(), _ += (h === "vertical" ? c : d) + p;
|
|
5222
5234
|
}), t.restore(), e.showScrollbar !== !1) {
|
|
5223
5235
|
const G = (l.length || 0) * (h === "vertical" ? c : d) + ((l.length || 0) - 1) * p, N = h === "vertical" ? n : s, J = e.listLayout || "linear", x = e.containerShape === "circle" || J === "circular";
|
|
5224
5236
|
if (G > N || J === "circular" && l.length > 0) {
|
|
@@ -5276,17 +5288,17 @@ class ci {
|
|
|
5276
5288
|
var z, Y;
|
|
5277
5289
|
const e = t.options || {}, s = this.objectStates.get(t.id) || {}, n = e.items || [];
|
|
5278
5290
|
if (n.length === 0) return null;
|
|
5279
|
-
const a = s.width !== void 0 ? s.width : ((z = t.geometry) == null ? void 0 : z.width) || 200, r = s.height !== void 0 ? s.height : ((Y = t.geometry) == null ? void 0 : Y.height) || 300, f = e.orientation || "vertical", h = e.itemGap ?? 10, l = e.itemHeight ?? 50, p = e.itemWidth ?? 200, c = e.scrollOffset ?? 0, d = e.padding ?? 0, u = this.getWorldTransform(t.id), v = i - u.x, b = o - u.y, m = -u.rotation * (Math.PI / 180), y = Math.cos(m), S = Math.sin(m), C = v * y - b * S, w = v * S + b * y,
|
|
5280
|
-
let T = (f === "vertical" ?
|
|
5291
|
+
const a = s.width !== void 0 ? s.width : ((z = t.geometry) == null ? void 0 : z.width) || 200, r = s.height !== void 0 ? s.height : ((Y = t.geometry) == null ? void 0 : Y.height) || 300, f = e.orientation || "vertical", h = e.itemGap ?? 10, l = e.itemHeight ?? 50, p = e.itemWidth ?? 200, c = e.scrollOffset ?? 0, d = e.padding ?? 0, u = this.getWorldTransform(t.id), v = i - u.x, b = o - u.y, m = -u.rotation * (Math.PI / 180), y = Math.cos(m), S = Math.sin(m), C = v * y - b * S, w = v * S + b * y, M = -a / 2, I = -r / 2, k = typeof d == "number" ? d : f === "vertical" ? d[0] : d[3];
|
|
5292
|
+
let T = (f === "vertical" ? I : M) + c + k;
|
|
5281
5293
|
const L = e.listLayout || "linear", P = n.length || 1, _ = Math.PI * 2 / P, E = e.circularStartAngle || 0, A = e.circularRadius || 100, W = c * 0.01 + E * Math.PI / 180;
|
|
5282
5294
|
for (let G = 0; G < n.length; G++) {
|
|
5283
5295
|
const N = L === "circular" ? p : f === "vertical" ? a : p, J = L === "circular" || f === "vertical" ? l : r;
|
|
5284
5296
|
let x = 0, F = 0, j = 0;
|
|
5285
5297
|
if (L === "circular") {
|
|
5286
|
-
const X = G * _ + W, tt =
|
|
5298
|
+
const X = G * _ + W, tt = M + a / 2, R = I + r / 2;
|
|
5287
5299
|
x = tt + Math.cos(X) * A - N / 2, F = R + Math.sin(X) * A - J / 2, j = X + (e.itemRotation || 0) * Math.PI / 180;
|
|
5288
5300
|
} else
|
|
5289
|
-
x = f === "vertical" ?
|
|
5301
|
+
x = f === "vertical" ? M : T, F = f === "vertical" ? T : I, j = (e.itemRotation || 0) * Math.PI / 180;
|
|
5290
5302
|
if (j !== 0) {
|
|
5291
5303
|
const X = x + N / 2, tt = F + J / 2, R = C - X, O = w - tt, D = -j, q = R * Math.cos(D) - O * Math.sin(D) + X, ot = R * Math.sin(D) + O * Math.cos(D) + tt;
|
|
5292
5304
|
if (q >= x && q <= x + N && ot >= F && ot <= F + J)
|
|
@@ -5311,7 +5323,7 @@ class ci {
|
|
|
5311
5323
|
if (!e.behaviors || e.behaviors.length === 0) return;
|
|
5312
5324
|
const s = this.objectStates.get(e.id);
|
|
5313
5325
|
s && e.behaviors.forEach((n) => {
|
|
5314
|
-
var p, c, d, u, v, b, m, y, S, C, w,
|
|
5326
|
+
var p, c, d, u, v, b, m, y, S, C, w, M, I, k, T, L, P, _, E, A, W, z, Y, G, N, J, x, F, j, X, tt, R, O, D, q, ot, yt, bt, gt, Et, It, St, Xt, le, he, et, mt, Rt, _t, dt, Ft, Dt, $t, Ot, Vt, ie, me, ye, Ut, Se, Pe, Ee, Ce, Ae, xe, se, jt, ft, pt, at, B, nt, Z, Pt, xt, kt, At, Mt, $, Wt, Kt, te, Jt, ut, ct, Ct, rt, V, st, it, vt, Yt, Qt, ne, Gt, Ht, Nt, Ie, Le, Re, Oe, Fe, $e, Ye, zt, oe, we, Be, We, de, ce, fe, ke, Xe, Ve, Ne, De, He;
|
|
5315
5327
|
if (!n.enabled) return;
|
|
5316
5328
|
const a = n.startTime || 0, r = n.endTime || 1 / 0;
|
|
5317
5329
|
if (this.currentTime < a || this.currentTime > r) return;
|
|
@@ -5340,11 +5352,11 @@ class ci {
|
|
|
5340
5352
|
} else if (n.type === U.Vortex) {
|
|
5341
5353
|
const H = ((S = n.settings) == null ? void 0 : S.radius) || 400, Q = ((C = n.settings) == null ? void 0 : C.speed) || 2, K = ((w = n.settings) == null ? void 0 : w.strength) || 1;
|
|
5342
5354
|
if (l < H) {
|
|
5343
|
-
const ht = Math.pow(1 - l / H, 1.5), Tt = this.currentTime * Q * Math.PI * 2, Lt = Math.cos(Tt) * 30 - f * 0.4,
|
|
5344
|
-
s.x += Lt * ht * K * t * 5, s.y +=
|
|
5355
|
+
const ht = Math.pow(1 - l / H, 1.5), Tt = this.currentTime * Q * Math.PI * 2, Lt = Math.cos(Tt) * 30 - f * 0.4, Bt = Math.sin(Tt) * 30 - h * 0.4;
|
|
5356
|
+
s.x += Lt * ht * K * t * 5, s.y += Bt * ht * K * t * 5, s.rotation += 5 * ht * K * t * 5, s.scale_x *= 1 - ht * 0.1 * K * t, s.scale_y *= 1 - ht * 0.1 * K * t;
|
|
5345
5357
|
}
|
|
5346
5358
|
} else if (n.type === U.Fluid) {
|
|
5347
|
-
const H = ((
|
|
5359
|
+
const H = ((M = n.settings) == null ? void 0 : M.radius) || 300, Q = ((I = n.settings) == null ? void 0 : I.strength) || 1;
|
|
5348
5360
|
if (l < H) {
|
|
5349
5361
|
const K = Math.pow(1 - l / H, 1.2), ht = f / (l || 1) * K * 1.2 * Q, Tt = h / (l || 1) * K * 1.2 * Q;
|
|
5350
5362
|
s.x += ht * 10 * t * 5, s.y += Tt * 10 * t * 5, s.scale_x *= 1 + K * 0.3 * Q * t, s.scale_y *= 1 + K * 0.3 * Q * t;
|
|
@@ -5374,7 +5386,7 @@ class ci {
|
|
|
5374
5386
|
s.scale_x *= 1 + K * 0.5 * Q * t, s.scale_y *= 1 + K * 0.5 * Q * t;
|
|
5375
5387
|
}
|
|
5376
5388
|
} else if (n.type === U.Parallax) {
|
|
5377
|
-
const H = ((W = n.settings) == null ? void 0 : W.factor) || 15, Q = ((z = n.settings) == null ? void 0 : z.strength) || 1, K = this.canvasWidth / 2, ht = this.canvasHeight / 2, Tt = this._lastPointerPos || { x: K, y: ht }, Lt = (Tt.x - K) / K,
|
|
5389
|
+
const H = ((W = n.settings) == null ? void 0 : W.factor) || 15, Q = ((z = n.settings) == null ? void 0 : z.strength) || 1, K = this.canvasWidth / 2, ht = this.canvasHeight / 2, Tt = this._lastPointerPos || { x: K, y: ht }, Lt = (Tt.x - K) / K, Bt = (Tt.y - ht) / ht, ee = (((Y = e.transform) == null ? void 0 : Y.x) ?? 0) + Lt * H * Q, ue = (((G = e.transform) == null ? void 0 : G.y) ?? 0) + Bt * H * Q, Te = (((N = e.transform) == null ? void 0 : N.rotate_x) ?? 0) - Bt * H * 1.5 * Q, ae = (((J = e.transform) == null ? void 0 : J.rotate_y) ?? 0) + Lt * H * 1.5 * Q, be = Math.min(1, 10 * t);
|
|
5378
5390
|
s.x = this.lerp(s.x ?? ((x = e.transform) == null ? void 0 : x.x) ?? 0, ee, be), s.y = this.lerp(s.y ?? ((F = e.transform) == null ? void 0 : F.y) ?? 0, ue, be), s.rotate_x = this.lerp(s.rotate_x ?? ((j = e.transform) == null ? void 0 : j.rotate_x) ?? 0, Te, be), s.rotate_y = this.lerp(s.rotate_y ?? ((X = e.transform) == null ? void 0 : X.rotate_y) ?? 0, ae, be);
|
|
5379
5391
|
} else if (n.type === U.Fold) {
|
|
5380
5392
|
if (l < 300) {
|
|
@@ -5384,21 +5396,21 @@ class ci {
|
|
|
5384
5396
|
} else if (n.type === U.Crumple) {
|
|
5385
5397
|
if (l < 300) {
|
|
5386
5398
|
const H = 1 - l / 300, Q = H * (Math.random() - 0.5) * 5, K = H * (Math.random() - 0.5) * 0.05, ht = Math.min(1, 15 * t);
|
|
5387
|
-
s.skew_x = this.lerp(s.skew_x ?? ((yt = e.transform) == null ? void 0 : yt.skew_x) ?? 0, Q, ht), s.scale_x = this.lerp(s.scale_x ?? ((bt = e.transform) == null ? void 0 : bt.scale_x) ?? 1, (((gt = e.transform) == null ? void 0 : gt.scale_x) ?? 1) * (1 + K), ht), s.scale_y = this.lerp(s.scale_y ?? ((
|
|
5399
|
+
s.skew_x = this.lerp(s.skew_x ?? ((yt = e.transform) == null ? void 0 : yt.skew_x) ?? 0, Q, ht), s.scale_x = this.lerp(s.scale_x ?? ((bt = e.transform) == null ? void 0 : bt.scale_x) ?? 1, (((gt = e.transform) == null ? void 0 : gt.scale_x) ?? 1) * (1 + K), ht), s.scale_y = this.lerp(s.scale_y ?? ((Et = e.transform) == null ? void 0 : Et.scale_y) ?? 1, (((It = e.transform) == null ? void 0 : It.scale_y) ?? 1) * (1 + K), ht), s.style = s.style || { ...e.style }, s.style.artEffect = { enabled: !0, type: "crumple_overlay", intensity: ((St = n.settings) == null ? void 0 : St.intensity) ?? 1, scale: ((Xt = n.settings) == null ? void 0 : Xt.scale) ?? 2 };
|
|
5388
5400
|
}
|
|
5389
5401
|
} else if (n.type === U.Squash) {
|
|
5390
5402
|
const H = ((le = n.settings) == null ? void 0 : le.strength) || 0.8;
|
|
5391
5403
|
l < (e.width || 100) && this.isMouseDown ? (s.scale_y = this.lerp(s.scale_y ?? 1, (((he = e.transform) == null ? void 0 : he.scale_y) ?? 1) * H, 0.3), s.scale_x = this.lerp(s.scale_x ?? 1, (((et = e.transform) == null ? void 0 : et.scale_x) ?? 1) * (1 + (1 - H) * 0.4), 0.3)) : (s.scale_y = this.lerp(s.scale_y ?? 1, ((mt = e.transform) == null ? void 0 : mt.scale_y) ?? 1, 0.2), s.scale_x = this.lerp(s.scale_x ?? 1, ((Rt = e.transform) == null ? void 0 : Rt.scale_x) ?? 1, 0.2));
|
|
5392
5404
|
} else if (n.type === U.TextCounter) {
|
|
5393
|
-
const H = ((
|
|
5405
|
+
const H = ((_t = n.settings) == null ? void 0 : _t.duration) || 2, Q = ((dt = n.settings) == null ? void 0 : dt.from) || 0, K = ((Ft = n.settings) == null ? void 0 : Ft.to) || 100;
|
|
5394
5406
|
n._runtimeStart === void 0 && (n._runtimeStart = this.currentTime);
|
|
5395
5407
|
const ht = this.currentTime - n._runtimeStart, Tt = Math.min(1, ht / H), Lt = Math.floor(Q + (K - Q) * Tt);
|
|
5396
|
-
if (((
|
|
5397
|
-
const
|
|
5398
|
-
s.geometry || (s.geometry = { ...e.geometry }), s.geometry.text = `${
|
|
5408
|
+
if (((Dt = e.geometry) == null ? void 0 : Dt.type) === "Text") {
|
|
5409
|
+
const Bt = (($t = n.settings) == null ? void 0 : $t.prefix) || "", ee = ((Ot = n.settings) == null ? void 0 : Ot.suffix) || "";
|
|
5410
|
+
s.geometry || (s.geometry = { ...e.geometry }), s.geometry.text = `${Bt}${Lt}${ee}`;
|
|
5399
5411
|
}
|
|
5400
5412
|
} else if (n.type === U.Spotlight) {
|
|
5401
|
-
const H = ((
|
|
5413
|
+
const H = ((Vt = n.settings) == null ? void 0 : Vt.radius) || 250, Q = ((ie = n.settings) == null ? void 0 : ie.strength) || 1.5;
|
|
5402
5414
|
if (l < H) {
|
|
5403
5415
|
const K = Math.pow(1 - l / H, 2);
|
|
5404
5416
|
s.style || (s.style = { ...e.style }), s.style.adjustments || (s.style.adjustments = { ...(me = e.style) == null ? void 0 : me.adjustments }), s.style.adjustments.exposure = (((Ut = (ye = e.style) == null ? void 0 : ye.adjustments) == null ? void 0 : Ut.exposure) || 0) + K * Q * 50;
|
|
@@ -5417,13 +5429,13 @@ class ci {
|
|
|
5417
5429
|
this.applyBehaviorSensor(s, Zt.PositionX, ht * K, t, n.settings), this.applyBehaviorSensor(s, Zt.PositionY, ht * K, t, n.settings);
|
|
5418
5430
|
}
|
|
5419
5431
|
} else if (n.type === U.Scroll) {
|
|
5420
|
-
const H = ((Z = n.settings) == null ? void 0 : Z.axis) || "vertical", Q = ((
|
|
5432
|
+
const H = ((Z = n.settings) == null ? void 0 : Z.axis) || "vertical", Q = ((Pt = n.settings) == null ? void 0 : Pt.factor) || 0.5, K = ((xt = n.settings) == null ? void 0 : xt.strength) || 1, ht = ((kt = n.settings) == null ? void 0 : kt.scaleFactor) || 0;
|
|
5421
5433
|
(H === "vertical" || H === "both") && (s.y += this.scrollOffset.y * Q * K * t), (H === "horizontal" || H === "both") && (s.x += this.scrollOffset.x * Q * K * t), ht !== 0 && (s.scale_x *= 1 + this.scrollOffset.y * ht * t, s.scale_y *= 1 + this.scrollOffset.y * ht * t);
|
|
5422
5434
|
} else if (n.type === U.LookAt) {
|
|
5423
5435
|
const H = ((At = n.settings) == null ? void 0 : At.factor) || 1, Q = ((Mt = n.settings) == null ? void 0 : Mt.strength) || 1, K = Math.atan2(-h, -f) * (180 / Math.PI), ht = s.rotation, Tt = (K - ht + 180) % 360 - 180;
|
|
5424
5436
|
s.rotation += Tt * H * Q * t * 10;
|
|
5425
5437
|
} else if (n.type === U.Scan) {
|
|
5426
|
-
const H = ((($ = n.settings) == null ? void 0 : $.speed) || 1) * 4e-3, Q = ((
|
|
5438
|
+
const H = ((($ = n.settings) == null ? void 0 : $.speed) || 1) * 4e-3, Q = ((Wt = n.settings) == null ? void 0 : Wt.strength) || 1, K = (Math.sin(Date.now() * H) + 1) / 2;
|
|
5427
5439
|
s.style && (s.style.exposure = (s.style.exposure || 1) + K * Q * t * 5), s.x += (K - 0.5) * 20 * Q * t;
|
|
5428
5440
|
} else if (n.type === U.Glint)
|
|
5429
5441
|
s.style = s.style || { ...e.style }, s.style.artEffect = {
|
|
@@ -5462,10 +5474,10 @@ class ci {
|
|
|
5462
5474
|
} else
|
|
5463
5475
|
s.skew_x = this.lerp(s.skew_x || 0, ((ne = e.transform) == null ? void 0 : ne.skew_x) || 0, 0.05);
|
|
5464
5476
|
} else if (n.type === U.Lens) {
|
|
5465
|
-
const H = ((
|
|
5477
|
+
const H = ((Gt = n.settings) == null ? void 0 : Gt.radius) || 200, Q = ((Ht = n.settings) == null ? void 0 : Ht.strength) || 0.5;
|
|
5466
5478
|
if (l < H) {
|
|
5467
5479
|
const K = Math.pow(1 - l / H, 2);
|
|
5468
|
-
s.scale_x = this.lerp(s.scale_x ?? 1, (((
|
|
5480
|
+
s.scale_x = this.lerp(s.scale_x ?? 1, (((Nt = e.transform) == null ? void 0 : Nt.scale_x) ?? 1) * (1 + K * Q), 0.2), s.scale_y = this.lerp(s.scale_y ?? 1, (((Ie = e.transform) == null ? void 0 : Ie.scale_y) ?? 1) * (1 + K * Q), 0.2);
|
|
5469
5481
|
} else
|
|
5470
5482
|
s.scale_x = this.lerp(s.scale_x ?? 1, ((Le = e.transform) == null ? void 0 : Le.scale_x) ?? 1, 0.1), s.scale_y = this.lerp(s.scale_y ?? 1, ((Re = e.transform) == null ? void 0 : Re.scale_y) ?? 1, 0.1);
|
|
5471
5483
|
} else if (n.type === U.LayoutAnimation) {
|
|
@@ -5492,15 +5504,15 @@ class ci {
|
|
|
5492
5504
|
duration: (($e = n.settings) == null ? void 0 : $e.duration) ?? Q
|
|
5493
5505
|
});
|
|
5494
5506
|
}
|
|
5495
|
-
const
|
|
5496
|
-
if (
|
|
5497
|
-
const ee = this.currentTime -
|
|
5507
|
+
const Bt = K.get(ht);
|
|
5508
|
+
if (Bt.duration > 0 && Bt.from !== Bt.to) {
|
|
5509
|
+
const ee = this.currentTime - Bt.startTime, ue = Math.min(1, ee / Bt.duration), Te = this.applyEasing(ue, ((Ye = n.settings) == null ? void 0 : Ye.easing) || "easeOutCubic"), ae = Bt.from + (Bt.to - Bt.from) * Te;
|
|
5498
5510
|
this.setObjectProperty(s, e, ht, ae);
|
|
5499
5511
|
}
|
|
5500
5512
|
}
|
|
5501
5513
|
} else if (n.type === U.StateReactive) {
|
|
5502
5514
|
this._layoutAnimCache.has(e.id) || this._layoutAnimCache.set(e.id, /* @__PURE__ */ new Map());
|
|
5503
|
-
const H = this._layoutAnimCache.get(e.id), Q = ((
|
|
5515
|
+
const H = this._layoutAnimCache.get(e.id), Q = ((zt = n.settings) == null ? void 0 : zt.defaultDuration) || 0.3, K = [
|
|
5504
5516
|
"x",
|
|
5505
5517
|
"y",
|
|
5506
5518
|
"scale_x",
|
|
@@ -5535,9 +5547,9 @@ class ci {
|
|
|
5535
5547
|
duration: Q
|
|
5536
5548
|
});
|
|
5537
5549
|
}
|
|
5538
|
-
const
|
|
5539
|
-
if (
|
|
5540
|
-
const ee = this.currentTime -
|
|
5550
|
+
const Bt = H.get(ht);
|
|
5551
|
+
if (Bt.duration > 0 && Bt.from !== Bt.to) {
|
|
5552
|
+
const ee = this.currentTime - Bt.startTime, ue = Math.min(1, ee / Bt.duration), Te = this.applyEasing(ue, ((oe = n.settings) == null ? void 0 : oe.defaultEasing) || "easeOutCubic"), ae = Bt.from + (Bt.to - Bt.from) * Te;
|
|
5541
5553
|
this.setObjectProperty(s, e, ht, ae);
|
|
5542
5554
|
}
|
|
5543
5555
|
}
|
|
@@ -5563,7 +5575,7 @@ class ci {
|
|
|
5563
5575
|
for (const Tt of H) {
|
|
5564
5576
|
const Lt = K.get(Tt.targetId);
|
|
5565
5577
|
if (!Lt) continue;
|
|
5566
|
-
const
|
|
5578
|
+
const Bt = Lt.x - ht.x, ee = Lt.y - ht.y, ue = Math.sqrt(Bt * Bt + ee * ee) || 1e-3, ae = (ue - (Tt.restLength || 50)) * (Tt.stiffness || 0.8), be = Bt / ue * ae, Ue = ee / ue * ae;
|
|
5567
5579
|
ht.vx += be * t * 10, ht.vy += Ue * t * 10, Lt.vx -= be * t * 10, Lt.vy -= Ue * t * 10, ht.vx *= 1 - Q * t * 10, ht.vy *= 1 - Q * t * 10, Lt.vx *= 1 - Q * t * 10, Lt.vy *= 1 - Q * t * 10;
|
|
5568
5580
|
const pe = this.objectStates.get(Tt.targetId);
|
|
5569
5581
|
pe && (pe.x += Lt.vx * t, pe.y += Lt.vy * t);
|
|
@@ -5571,13 +5583,13 @@ class ci {
|
|
|
5571
5583
|
s.x += ht.vx * t, s.y += ht.vy * t;
|
|
5572
5584
|
}
|
|
5573
5585
|
} else if (n.type === U.ParticleEmitter) {
|
|
5574
|
-
const H = ((We = n.settings) == null ? void 0 : We.rate) || 10, Q = ((de = n.settings) == null ? void 0 : de.speed) || 100, K = ((ce = n.settings) == null ? void 0 : ce.size) || 5, ht = ((fe = n.settings) == null ? void 0 : fe.lifetime) || 2, Tt = ((ke = n.settings) == null ? void 0 : ke.gravity) || 0, Lt = ((Xe = n.settings) == null ? void 0 : Xe.color) || "#ffffff",
|
|
5586
|
+
const H = ((We = n.settings) == null ? void 0 : We.rate) || 10, Q = ((de = n.settings) == null ? void 0 : de.speed) || 100, K = ((ce = n.settings) == null ? void 0 : ce.size) || 5, ht = ((fe = n.settings) == null ? void 0 : fe.lifetime) || 2, Tt = ((ke = n.settings) == null ? void 0 : ke.gravity) || 0, Lt = ((Xe = n.settings) == null ? void 0 : Xe.color) || "#ffffff", Bt = ((Ve = n.settings) == null ? void 0 : Ve.maxParticles) || 200, ee = (Ne = n.settings) != null && Ne.rateInputId ? this.inputs.get(n.settings.rateInputId) ?? H : H, ue = (De = n.settings) != null && De.gravityInputId ? this.inputs.get(n.settings.gravityInputId) ?? Tt : Tt, Te = (He = n.settings) != null && He.speedInputId ? this.inputs.get(n.settings.speedInputId) ?? Q : Q;
|
|
5575
5587
|
this._emitterPools.has(e.id) || this._emitterPools.set(e.id, []);
|
|
5576
5588
|
const ae = this._emitterPools.get(e.id);
|
|
5577
5589
|
let be = 0;
|
|
5578
5590
|
n._pendingBurst && n._pendingBurst > 0 && (be = n._pendingBurst, n._pendingBurst = 0);
|
|
5579
5591
|
const Ue = Math.floor(ee * t) + (be || 0);
|
|
5580
|
-
for (let pe = 0; pe < Math.min(Ue,
|
|
5592
|
+
for (let pe = 0; pe < Math.min(Ue, Bt - ae.length); pe++) {
|
|
5581
5593
|
const re = Math.random() * Math.PI * 2, ss = Te * (0.5 + Math.random() * 0.5);
|
|
5582
5594
|
ae.push({
|
|
5583
5595
|
x: s.x,
|
|
@@ -5600,7 +5612,7 @@ class ci {
|
|
|
5600
5612
|
});
|
|
5601
5613
|
}
|
|
5602
5614
|
applyBehaviorSensor(t, i, o, e, s, n, a = 0, r = 0, f = 1) {
|
|
5603
|
-
var d, u, v, b, m, y, S, C, w,
|
|
5615
|
+
var d, u, v, b, m, y, S, C, w, M, I, k, T, L, P, _, E, A, W, z, Y, G, N, J;
|
|
5604
5616
|
const h = (s == null ? void 0 : s.intensity) || (s == null ? void 0 : s.strength) || 1, l = Math.min(1, 15 * e), p = f > 0 ? a / f : 0, c = f > 0 ? r / f : 0;
|
|
5605
5617
|
switch (i) {
|
|
5606
5618
|
case Zt.Scale: {
|
|
@@ -5644,8 +5656,8 @@ class ci {
|
|
|
5644
5656
|
break;
|
|
5645
5657
|
}
|
|
5646
5658
|
case Zt.Blur: {
|
|
5647
|
-
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.blur || (t.style.blur = { ...(
|
|
5648
|
-
const x = ((k = (
|
|
5659
|
+
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.blur || (t.style.blur = { ...(M = n == null ? void 0 : n.style) == null ? void 0 : M.blur });
|
|
5660
|
+
const x = ((k = (I = n == null ? void 0 : n.style) == null ? void 0 : I.blur) == null ? void 0 : k.amount) || 0, F = x + o * ((s == null ? void 0 : s.blur) || 20) * h;
|
|
5649
5661
|
t.style.blur.amount = (t.style.blur.amount ?? x) * (1 - l) + F * l;
|
|
5650
5662
|
break;
|
|
5651
5663
|
}
|
|
@@ -5785,8 +5797,8 @@ const yi = Ss(({
|
|
|
5785
5797
|
scrollY: S,
|
|
5786
5798
|
scrollX: C,
|
|
5787
5799
|
mouseX: w,
|
|
5788
|
-
mouseY:
|
|
5789
|
-
isMouseDown:
|
|
5800
|
+
mouseY: M,
|
|
5801
|
+
isMouseDown: I,
|
|
5790
5802
|
inputs: k,
|
|
5791
5803
|
interactive: T = !0,
|
|
5792
5804
|
onNavigation: L
|
|
@@ -5826,7 +5838,7 @@ const yi = Ss(({
|
|
|
5826
5838
|
W.current === 0 && (W.current = yt);
|
|
5827
5839
|
let bt = yt - W.current;
|
|
5828
5840
|
bt > 0.1 && (bt = 0.1), W.current = yt;
|
|
5829
|
-
const gt = q.getBoundingClientRect(),
|
|
5841
|
+
const gt = q.getBoundingClientRect(), Et = window.devicePixelRatio || 1, It = Math.round(gt.width * Et), St = Math.round(gt.height * Et);
|
|
5830
5842
|
(q.width !== It || q.height !== St) && (q.width = It, q.height = St);
|
|
5831
5843
|
try {
|
|
5832
5844
|
o ? D.advance(bt) : m !== void 0 && D.seek(m), D.render(ot, q.width, q.height);
|
|
@@ -5840,8 +5852,8 @@ const yi = Ss(({
|
|
|
5840
5852
|
};
|
|
5841
5853
|
}, [o, m]), ve(() => {
|
|
5842
5854
|
const R = E.current;
|
|
5843
|
-
S !== void 0 && R.updateInput("scrollY", S), C !== void 0 && R.updateInput("scrollX", C), w !== void 0 && R.updateInput("mouseX", w),
|
|
5844
|
-
}, [S, C, w,
|
|
5855
|
+
S !== void 0 && R.updateInput("scrollY", S), C !== void 0 && R.updateInput("scrollX", C), w !== void 0 && R.updateInput("mouseX", w), M !== void 0 && R.updateInput("mouseY", M), I !== void 0 && R.updateInput("isMouseDown", I), k && Object.entries(k).forEach(([O, D]) => R.updateInput(O, D));
|
|
5856
|
+
}, [S, C, w, M, I, k]);
|
|
5845
5857
|
const x = (R, O) => {
|
|
5846
5858
|
if (!T || !_.current) return;
|
|
5847
5859
|
R.stopPropagation(), "nativeEvent" in R && R.nativeEvent && typeof R.nativeEvent.stopImmediatePropagation == "function" ? R.nativeEvent.stopImmediatePropagation() : typeof R.stopImmediatePropagation == "function" && R.stopImmediatePropagation();
|
|
@@ -5883,14 +5895,14 @@ const yi = Ss(({
|
|
|
5883
5895
|
const tt = () => F.map((R) => {
|
|
5884
5896
|
const O = R.inputBinding.keyboardConfig, D = (gt) => {
|
|
5885
5897
|
var It;
|
|
5886
|
-
const
|
|
5898
|
+
const Et = { key: gt, code: gt, preventDefault: () => {
|
|
5887
5899
|
} };
|
|
5888
|
-
(It = E.current) == null || It.handleKeyDown(
|
|
5900
|
+
(It = E.current) == null || It.handleKeyDown(Et);
|
|
5889
5901
|
}, q = (gt) => {
|
|
5890
5902
|
var It;
|
|
5891
|
-
const
|
|
5903
|
+
const Et = { key: gt, code: gt, preventDefault: () => {
|
|
5892
5904
|
} };
|
|
5893
|
-
(It = E.current) == null || It.handleKeyUp(
|
|
5905
|
+
(It = E.current) == null || It.handleKeyUp(Et);
|
|
5894
5906
|
}, ot = E.current, yt = (gt) => ot && ot.activeKeys ? ot.activeKeys.has(gt.toLowerCase()) : !1, bt = (gt) => ({
|
|
5895
5907
|
width: "50px",
|
|
5896
5908
|
height: "50px",
|
|
@@ -6126,7 +6138,7 @@ const vi = ({ artboard: g, config: t }) => {
|
|
|
6126
6138
|
]
|
|
6127
6139
|
}
|
|
6128
6140
|
);
|
|
6129
|
-
}, fi = "6.3.
|
|
6141
|
+
}, fi = "6.3.36", hi = {
|
|
6130
6142
|
version: fi
|
|
6131
6143
|
}, Si = hi.version;
|
|
6132
6144
|
export {
|