@kolkrabbi/design-editor 0.24.0 → 0.27.0

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.
Files changed (35) hide show
  1. package/README.md +2 -2
  2. package/dist/BindDot-CMUtpJPX.js +84 -0
  3. package/dist/BufferGeometryUtils-Cc8LNd5v.js +150 -0
  4. package/dist/ColorModesWindow-CWhL6nfm.js +1493 -0
  5. package/dist/GLTFLoader-BFir8PCc.js +1361 -0
  6. package/dist/OBJLoader-BgqC_-Jn.js +287 -0
  7. package/dist/{OrbitControls-Cql8Rn2i.js → OrbitControls-DVpLgmKv.js} +2755 -2202
  8. package/dist/STLLoader-C6DGLf6r.js +83 -0
  9. package/dist/Timeline-BObvcdXF.js +3014 -0
  10. package/dist/TreePicker-nMf17QGH.js +68 -0
  11. package/dist/core-EWu8GfXL.js +17504 -0
  12. package/dist/core.js +5 -3
  13. package/dist/design-editor.css +1 -1
  14. package/dist/design-editor.js +2114 -916
  15. package/dist/effects-DZEmfY7a.js +444 -0
  16. package/dist/effects.js +1 -1
  17. package/dist/generators-D1tFSZgG.js +2961 -0
  18. package/dist/generators.js +1 -1
  19. package/dist/{host-qtFVROOD.js → host-CRsCCafL.js} +429 -370
  20. package/dist/{host-be1CWhN1.js → host-ZLJKCZ54.js} +137 -136
  21. package/dist/motion-C_u7tsis.js +2295 -0
  22. package/dist/motion.js +1 -1
  23. package/dist/previewScale-BMkeLc6w.js +26 -0
  24. package/dist/{rolls-Bg1XHuvJ.js → rolls-BGtqxVYq.js} +2621 -1522
  25. package/dist/{src-B5fQgAVE.js → src-BpTckTDZ.js} +1 -1
  26. package/dist/{useLayerEdit-ieOjHx6x.js → useLayerEdit-BFcZhiNX.js} +20992 -12580
  27. package/package.json +9 -7
  28. package/dist/RuleRow-DIbuUt37.js +0 -650
  29. package/dist/TreePicker-DLmMl0aU.js +0 -68
  30. package/dist/core-CNI8b_83.js +0 -12314
  31. package/dist/effectCategories-0PnGZvjd.js +0 -4210
  32. package/dist/effects-BujxwoNY.js +0 -469
  33. package/dist/generators-SpRHQDMq.js +0 -2517
  34. package/dist/labels-B5qkocWy.js +0 -2007
  35. package/dist/motion-Bn3FVkCS.js +0 -2260
@@ -0,0 +1,2295 @@
1
+ import { An as e, At as t, D as n, Dn as r, En as i, F as a, L as o, Ln as s, Mn as c, Mt as l, On as u, Ot as d, Pn as f, Qt as p, Sn as m, T as h, Tn as g, Zt as _, bn as v, d as y, f as b, jt as x, kt as S, q as C, t as w, tn as T, wn as E } from "./rolls-BGtqxVYq.js";
2
+ import { r as ee } from "./TreePicker-nMf17QGH.js";
3
+ import { A as te, D, E as O, M as k, N as ne, O as re, P as ie, T as A, i as j, j as M, k as ae, t as oe, w as N } from "./Timeline-BObvcdXF.js";
4
+ import { BezierPathEditor as se, Button as P, Dropdown as ce, Input as le, LabeledControl as ue, MenuDropdownItem as F, PopoverPanel as de, SegmentedToggle as fe, SettingsRow as pe, Slider as me, Textarea as he, ToggleCheckbox as ge, Tooltip as I, glyphSize as _e, usePopover as ve } from "@kolkrabbi/kol-component";
5
+ import { Fragment as ye, useEffect as be, useState as L } from "react";
6
+ import { Fragment as xe, jsx as R, jsxs as z } from "react/jsx-runtime";
7
+ import { Icon as Se } from "@kolkrabbi/kol-icons";
8
+ //#region src/kinetic/animations.js
9
+ var B = {
10
+ dLen: 0,
11
+ dNormal: 0,
12
+ scale: 1,
13
+ dRot: 0,
14
+ opacity: 1,
15
+ vf: null
16
+ }, Ce = {
17
+ none: () => B,
18
+ march: (e) => ({
19
+ ...B,
20
+ dLen: e.u * e.pathLen * Math.max(1, Math.round(e.m.cycles || 1))
21
+ }),
22
+ orbit: (e) => ({
23
+ ...B,
24
+ dLen: e.u * e.pathLen * Math.max(1, Math.round(e.m.cycles || 1))
25
+ }),
26
+ vfwave: (t) => {
27
+ let n = Math.max(1, Math.round(t.m.cycles || 1)), r = .5 + .5 * Math.sin(t.u * e * n - t.i * (t.m.phase ?? .5));
28
+ return {
29
+ ...B,
30
+ vf: { [t.axisTag]: f(t.axisMin, t.axisMax, r) }
31
+ };
32
+ },
33
+ glyphwave: (t) => {
34
+ let n = Math.max(1, Math.round(t.m.cycles || 1)), r = Math.sin(t.u * e * n - t.i * (t.m.phase ?? .5));
35
+ return {
36
+ ...B,
37
+ dNormal: (t.m.amp ?? .3) * t.sizePx * r
38
+ };
39
+ },
40
+ cascade: (t) => {
41
+ let n = Math.max(1, Math.round(t.m.cycles || 1)), r = .5 + .5 * Math.sin(t.u * e * n - t.i * (t.m.phase ?? .6));
42
+ return {
43
+ ...B,
44
+ scale: f(.25, 1, r),
45
+ opacity: f(.15, 1, r)
46
+ };
47
+ },
48
+ sweep: (e) => {
49
+ let t = Ee(e);
50
+ return {
51
+ ...B,
52
+ scale: f(.25, 1, t),
53
+ opacity: f(.12, 1, t)
54
+ };
55
+ },
56
+ sweepWeight: (e) => {
57
+ let t = Ee(e);
58
+ return {
59
+ ...B,
60
+ vf: { [e.axisTag]: f(e.axisMin, e.axisMax, t) }
61
+ };
62
+ },
63
+ sweepShift: (e) => {
64
+ let t = Ee(e);
65
+ return {
66
+ ...B,
67
+ dNormal: t * .6 * e.sizePx
68
+ };
69
+ }
70
+ }, we = (e) => e - Math.floor(e);
71
+ function Te(e, t) {
72
+ if (t <= 0) return 0;
73
+ let n = Math.min(1, e / t);
74
+ return 1 - n * n * (3 - 2 * n);
75
+ }
76
+ function V(t, n, r, i, a, o) {
77
+ let s = we(i * a), c = Math.max(.02, o * .5), l = (e) => {
78
+ let t = Math.abs(we(e) - s);
79
+ return Te(Math.min(t, 1 - t), c);
80
+ };
81
+ switch (t) {
82
+ case "y": return l(r);
83
+ case "diagonal": return l(.5 + (n - .5) * .7071 + (r - .5) * .7071);
84
+ case "radial": return l(Math.hypot(n - .5, r - .5) / .7071);
85
+ case "angular": return l(Math.atan2(r - .5, n - .5) / e + .5);
86
+ case "wave": {
87
+ let t = Math.max(1, Math.round(1 + (1 - o) * 6));
88
+ return .5 + .5 * Math.sin((n * t - i * a) * e);
89
+ }
90
+ default: return l(n);
91
+ }
92
+ }
93
+ var Ee = (e) => V(e.m.field || "x", e.nx ?? .5, e.ny ?? .5, e.u, Math.max(1, Math.round(e.m.cycles || 1)), e.m.amp ?? .35);
94
+ function De(e, t) {
95
+ return (Ce[e] || Ce.none)(t);
96
+ }
97
+ //#endregion
98
+ //#region src/kinetic/features.js
99
+ var Oe = [
100
+ {
101
+ tag: "liga",
102
+ label: "Ligatures"
103
+ },
104
+ {
105
+ tag: "dlig",
106
+ label: "Discretionary ligatures"
107
+ },
108
+ {
109
+ tag: "smcp",
110
+ label: "Small caps"
111
+ },
112
+ {
113
+ tag: "case",
114
+ label: "Case-sensitive forms"
115
+ },
116
+ {
117
+ tag: "onum",
118
+ label: "Oldstyle figures"
119
+ },
120
+ {
121
+ tag: "tnum",
122
+ label: "Tabular figures"
123
+ },
124
+ {
125
+ tag: "frac",
126
+ label: "Fractions"
127
+ },
128
+ {
129
+ tag: "swsh",
130
+ label: "Swashes"
131
+ },
132
+ {
133
+ tag: "ss01",
134
+ label: "Stylistic set 1"
135
+ },
136
+ {
137
+ tag: "ss02",
138
+ label: "Stylistic set 2"
139
+ }
140
+ ];
141
+ function ke(e) {
142
+ if (!e) return "normal";
143
+ let t = [];
144
+ for (let [n, r] of Object.entries(e)) t.push(`"${n}" ${+!!r}`);
145
+ return t.length ? t.join(", ") : "normal";
146
+ }
147
+ //#endregion
148
+ //#region src/kinetic/KineticType.js
149
+ var Ae = "http://www.w3.org/2000/svg", H = (e) => e - Math.floor(e), U = (e) => document.createElementNS(Ae, e);
150
+ function je(e, t) {
151
+ return !e || !t || t === "none" ? e || "" : t === "upper" ? e.toUpperCase() : t === "lower" ? e.toLowerCase() : t === "title" ? e.replace(/\b\w/g, (e) => e.toUpperCase()) : e;
152
+ }
153
+ function Me(e) {
154
+ if (!e) return {
155
+ bg: "#16202E",
156
+ instances: []
157
+ };
158
+ if (Array.isArray(e.instances)) return e;
159
+ let { bg: t, ...n } = e;
160
+ return {
161
+ bg: t || "#16202E",
162
+ instances: [{
163
+ id: "main",
164
+ ...n
165
+ }]
166
+ };
167
+ }
168
+ var Ne = class {
169
+ constructor(e) {
170
+ this.host = e, this.params = Me(null), this.w = 0, this.h = 0, this._rt = /* @__PURE__ */ new Map(), this._instSig = "", this._needsRemeasure = !1;
171
+ let t = U("svg");
172
+ t.setAttribute("xmlns", Ae), t.style.display = "block", t.style.maxWidth = "100%", t.style.maxHeight = "100%", t.style.pointerEvents = "none", t.style.overflow = "hidden", this._clipApplied = !0, this.bg = U("rect"), this.layer = U("g"), this.measEl = U("text"), this.measEl.setAttribute("x", "0"), this.measEl.setAttribute("y", "0"), this.measEl.style.visibility = "hidden", t.append(this.bg, this.layer, this.measEl), e.appendChild(t), this.svg = t, e.__kolKineticEngine = this, typeof document < "u" && document.fonts && document.fonts.ready.then(() => {
173
+ this._needsRemeasure = !0;
174
+ }).catch(() => {});
175
+ }
176
+ resize(e, t) {
177
+ this.w = e, this.h = t, this.svg.setAttribute("width", e), this.svg.setAttribute("height", t), this.svg.setAttribute("viewBox", `0 0 ${e} ${t}`), this.bg.setAttribute("width", e), this.bg.setAttribute("height", t);
178
+ for (let e of this._rt.values()) e.cache = null;
179
+ }
180
+ setComposition(e) {
181
+ this.params = Me(e);
182
+ }
183
+ renderAt(e) {
184
+ !this.w || !this.h || this._render(c(e));
185
+ }
186
+ getInstanceRect(e) {
187
+ let t = this._rt.get(e);
188
+ if (!t || !t.glyphG) return null;
189
+ let n;
190
+ try {
191
+ n = t.glyphG.getBBox();
192
+ } catch {
193
+ return null;
194
+ }
195
+ if (!n || !n.width || !n.height) return null;
196
+ let r = (this.params.instances || []).find((t) => t.id === e), i = (r?.offset?.x || 0) * this.w, a = (r?.offset?.y || 0) * this.h;
197
+ return {
198
+ x: n.x + i,
199
+ y: n.y + a,
200
+ w: n.width,
201
+ h: n.height
202
+ };
203
+ }
204
+ hitTest(e, t) {
205
+ let n = this.svg.getBoundingClientRect();
206
+ if (!n.width || !n.height) return null;
207
+ let r = (e - n.left) * (this.w / n.width), i = (t - n.top) * (this.h / n.height), a = this.params.instances || [];
208
+ for (let e = a.length - 1; e >= 0; e--) {
209
+ let t = this.getInstanceRect(a[e].id);
210
+ if (t && r >= t.x && r <= t.x + t.w && i >= t.y && i <= t.y + t.h) return a[e].id;
211
+ }
212
+ return null;
213
+ }
214
+ dispose() {
215
+ this.host && this.host.__kolKineticEngine === this && delete this.host.__kolKineticEngine, this.svg && this.svg.parentNode === this.host && this.host.removeChild(this.svg);
216
+ }
217
+ _syncInstances() {
218
+ let e = this.params.instances || [], t = e.map((e) => e.id).join("|");
219
+ if (t === this._instSig) return;
220
+ this._instSig = t;
221
+ let n = new Set(e.map((e) => e.id));
222
+ for (let [e, t] of this._rt) n.has(e) || (t.group.remove(), this._rt.delete(e));
223
+ for (let t of e) {
224
+ let e = this._rt.get(t.id);
225
+ if (!e) {
226
+ let n = U("g"), r = U("path");
227
+ r.setAttribute("fill", "none");
228
+ let i = U("g");
229
+ i.setAttribute("data-glyphs", t.id), n.append(r, i), e = {
230
+ group: n,
231
+ pathEl: r,
232
+ glyphG: i,
233
+ glyphEls: [],
234
+ cache: null,
235
+ glyphKey: "",
236
+ closed: !1
237
+ }, this._rt.set(t.id, e);
238
+ }
239
+ this.layer.appendChild(e.group);
240
+ }
241
+ }
242
+ _render(e) {
243
+ let t = this.params.clip !== !1;
244
+ if (t !== this._clipApplied && (this._clipApplied = t, this.svg.style.overflow = t ? "hidden" : "visible"), this._needsRemeasure) {
245
+ this._needsRemeasure = !1;
246
+ for (let e of this._rt.values()) e.cache = null;
247
+ }
248
+ this.bg.setAttribute("fill", this.params.bg || "#16202E"), this._syncInstances();
249
+ for (let t of this.params.instances || []) {
250
+ let n = this._rt.get(t.id);
251
+ n && this._renderInstance(t, n, e);
252
+ }
253
+ }
254
+ _ensureGlyphs(e, t, n, r) {
255
+ let i = `${t}|${n.family}|${r}`;
256
+ if (i !== e.glyphKey) {
257
+ e.glyphKey = i, e.glyphG.textContent = "", e.glyphEls = [];
258
+ for (let n = 0; n < r; n++) for (let n of t) {
259
+ let t = U("text");
260
+ t.setAttribute("text-anchor", "middle"), t.setAttribute("dominant-baseline", "central"), t.textContent = n, e.glyphG.appendChild(t), e.glyphEls.push(t);
261
+ }
262
+ }
263
+ }
264
+ _measure(e, t, n, i) {
265
+ let a = t.letterSpacing || 0, o = ke(t.opentype), s = `${i}|${n.family}|${t.fontSize}|${a}|${r(t.vf)}|${o}`;
266
+ if (e.cache && e.cache.key === s) return e.cache;
267
+ let c = this.measEl;
268
+ c.style.fontFamily = `'${n.family}'`, c.style.fontSize = `${t.fontSize}px`, c.style.letterSpacing = `${a}px`, c.style.fontVariationSettings = r(t.vf), c.style.fontFeatureSettings = o, c.textContent = i;
269
+ let l = i.length, u = Array(l), d = 0;
270
+ try {
271
+ d = c.getComputedTextLength();
272
+ let e = Array(l);
273
+ for (let t = 0; t < l; t++) e[t] = c.getStartPositionOfChar(t).x;
274
+ for (let t = 0; t < l; t++) u[t] = (e[t] + (t + 1 < l ? e[t + 1] : d)) / 2;
275
+ } catch {
276
+ d = t.fontSize * .6 * l;
277
+ for (let e = 0; e < l; e++) u[e] = (e + .5) * (d / Math.max(1, l));
278
+ }
279
+ return e.cache = {
280
+ key: s,
281
+ centers: u,
282
+ total: d
283
+ }, e.cache;
284
+ }
285
+ _renderInstance(e, t, n) {
286
+ let r = E(e.font), i = e.phase ? H(n + e.phase) : n, a = je(e.text || "", e.case), o = Math.max(1, Math.round(e.multiply || 1)), s = o > 1 && a ? Array(o).fill(a).join(" ") : a, c = e.path?.type || "line", u = (e.offset?.x || 0) * this.w, d = (e.offset?.y || 0) * this.h;
287
+ if (t.group.setAttribute("transform", `translate(${u.toFixed(2)} ${d.toFixed(2)})`), e.morph?.on && !ne(c) && !ie(c)) {
288
+ let n = r.url, a = e.morph.face2 ? E(e.morph.face2) : null, o = a ? a.url : n, u = l(n), d = l(o);
289
+ if (u && d) {
290
+ this._setKind(t, "morph"), this._renderMorph(e, t, i, u, d, r, s, c);
291
+ return;
292
+ }
293
+ u || x(n).catch(() => {}), !d && o !== n && x(o).catch(() => {});
294
+ }
295
+ if (this._setKind(t, "text"), k(c)) {
296
+ t.pathEl.setAttribute("d", ""), t.pathEl.style.opacity = 0;
297
+ let n = Math.max(1, Math.round(e.path?.rows ?? 2)), a = Math.max(1, Math.round(e.path?.cols ?? 3));
298
+ if (this._ensureGlyphs(t, s, r, n * a), !s.length) return;
299
+ this._measure(t, e, r, s), this._placeArray(e, t, r, i, t.glyphEls, n, a);
300
+ return;
301
+ }
302
+ if (ne(c) || ie(c)) {
303
+ t.pathEl.setAttribute("d", ""), t.pathEl.style.opacity = 0;
304
+ let n = Math.max(1, Math.round(e.path?.count ?? 12));
305
+ if (this._ensureGlyphs(t, s, r, n), !s.length) return;
306
+ this._measure(t, e, r, s), ne(c) ? this._placeRadial(e, t, r, i, t.glyphEls, n) : this._placeRings(e, t, r, i, t.glyphEls, n);
307
+ return;
308
+ }
309
+ let f = M(c, this.w, this.h, e.path || {});
310
+ t.closed = f.closed, t.pathEl.setAttribute("d", f.d), t.pathEl.setAttribute("stroke", e.showPath ? e.fill || "#888" : "none"), t.pathEl.setAttribute("stroke-width", +!!e.showPath), t.pathEl.style.opacity = e.showPath ? .25 : 0, this._ensureGlyphs(t, s, r, 1), s.length && (this._measure(t, e, r, s), this._placeOnPath(e, t, r, i, t.glyphEls));
311
+ }
312
+ _styleGlyph(e, t, n, i) {
313
+ e.style.fontFamily = `'${n.family}'`, e.style.fontSize = `${t.fontSize}px`, e.style.fontStyle = t.italic ? "italic" : "normal", e.style.fontVariationSettings = r(i.vf ? {
314
+ ...t.vf,
315
+ ...i.vf
316
+ } : t.vf), e.style.fontFeatureSettings = ke(t.opentype), e.setAttribute("fill", t.fill || "#e8e4dc"), e.setAttribute("opacity", i.opacity);
317
+ }
318
+ _anim(e, t, n) {
319
+ let r = e.motions && e.motions.length ? [e.motion, ...e.motions] : [e.motion], i = 0, a = 0, o = 0, s = 1, c = 1, l = null;
320
+ for (let e of r) {
321
+ if (!e || (e.mode || "none") === "none") continue;
322
+ let r = n.axes.find((t) => t.tag === (e.axis || n.axes[0] && n.axes[0].tag)), u = De(e.mode, {
323
+ ...t,
324
+ m: e,
325
+ axisTag: r ? r.tag : "wght",
326
+ axisMin: r ? r.min : 100,
327
+ axisMax: r ? r.max : 900
328
+ });
329
+ i += u.dLen, a += u.dNormal, o += u.dRot, s *= u.scale, c *= u.opacity, u.vf && (l = {
330
+ ...l || {},
331
+ ...u.vf
332
+ });
333
+ }
334
+ return {
335
+ dLen: i,
336
+ dNormal: a,
337
+ scale: s,
338
+ dRot: o,
339
+ opacity: c,
340
+ vf: l
341
+ };
342
+ }
343
+ _placeOnPath(e, t, n, r, i) {
344
+ let a = t.cache;
345
+ if (!a) return;
346
+ let o = t.pathEl.getTotalLength();
347
+ if (!o) return;
348
+ let { centers: s, total: l } = a, u = e.align || "center", d = u === "start" ? 0 : u === "end" ? o - l : (o - l) / 2, f = .75, p = t.closed, m = e.flow === "flow" && !p, h = (e) => p ? (e % o + o) % o : Math.max(0, Math.min(o, e)), g = (e) => {
349
+ if (m && (e < 0 || e > o)) {
350
+ let n = e < 0 ? 0 : o, r = t.pathEl.getPointAtLength(n), i = t.pathEl.getPointAtLength(Math.max(0, n - f)), a = t.pathEl.getPointAtLength(Math.min(o, n + f)), s = a.x - i.x, c = a.y - i.y, l = Math.hypot(s, c) || 1;
351
+ s /= l, c /= l;
352
+ let u = e - n;
353
+ return {
354
+ x: r.x + s * u,
355
+ y: r.y + c * u
356
+ };
357
+ }
358
+ return t.pathEl.getPointAtLength(h(e));
359
+ }, _ = Math.min(i.length, s.length), v = c(e.stagger || 0), y = Math.max(1, Math.round(e.multiply || 1)), b = (s.length + 2) / y;
360
+ for (let t = 0; t < _; t++) {
361
+ let a = d + s[t], c = g(a), l = v && y > 1 ? H(r + v * Math.floor(t / b) / y) : r, u = this._anim(e, {
362
+ i: t,
363
+ n: s.length,
364
+ u: l,
365
+ sizePx: e.fontSize,
366
+ pathLen: o,
367
+ nx: this.w ? c.x / this.w : .5,
368
+ ny: this.h ? c.y / this.h : .5
369
+ }, n), p = a + u.dLen, m = g(p), h = g(p - f), _ = g(p + f), x = Math.atan2(_.y - h.y, _.x - h.x) * 180 / Math.PI;
370
+ i[t].setAttribute("transform", `translate(${m.x.toFixed(2)} ${m.y.toFixed(2)}) rotate(${(x + u.dRot).toFixed(2)}) translate(0 ${(-u.dNormal).toFixed(2)}) scale(${u.scale.toFixed(3)})`), this._styleGlyph(i[t], e, n, u);
371
+ }
372
+ }
373
+ _placeArray(e, t, n, r, i, a, o) {
374
+ let s = t.cache;
375
+ if (!s) return;
376
+ let { centers: l, total: u } = s, d = l.length;
377
+ if (!d) return;
378
+ let f = Math.min(this.w, this.h) * .08, p = (this.w - 2 * f) / o, m = (this.h - 2 * f) / a, h = c(e.stagger || 0), g = a * o;
379
+ for (let t = 0; t < g; t++) {
380
+ let a = Math.floor(t / o), s = f + t % o * p + p / 2, c = f + a * m + m / 2, _ = s - u / 2, v = h ? H(r + h * t / g) : r;
381
+ for (let r = 0; r < d; r++) {
382
+ let a = i[t * d + r];
383
+ if (!a) continue;
384
+ let o = _ + l[r], s = this._anim(e, {
385
+ i: t * d + r,
386
+ n: g * d,
387
+ u: v,
388
+ sizePx: e.fontSize,
389
+ pathLen: 0,
390
+ nx: this.w ? o / this.w : .5,
391
+ ny: this.h ? c / this.h : .5
392
+ }, n), u = c - s.dNormal;
393
+ a.setAttribute("transform", `translate(${o.toFixed(2)} ${u.toFixed(2)}) rotate(${s.dRot.toFixed(2)}) scale(${s.scale.toFixed(3)})`), this._styleGlyph(a, e, n, s);
394
+ }
395
+ }
396
+ }
397
+ _placeRadial(t, n, r, i, a, o) {
398
+ let s = n.cache;
399
+ if (!s) return;
400
+ let { centers: l } = s, u = l.length;
401
+ if (!u) return;
402
+ let d = this.w / 2, f = this.h / 2, p = Math.min(this.w, this.h) * .5, m = p * Math.max(0, Math.min(.95, t.path?.inner ?? .12)), h = Math.round(t.path?.spin ?? 1), g = c(t.stagger || 0);
403
+ for (let n = 0; n < o; n++) {
404
+ let s = o > 1 ? n / (o - 1) : 0, c = h + (g ? Math.round(g * 2 * s) : 0), _ = n / o * e + i * e * c, v = g ? H(i + g * n / o) : i, y = Math.cos(_), b = Math.sin(_), x = _ * 180 / Math.PI;
405
+ for (let e = 0; e < u; e++) {
406
+ let i = n * u + e, s = a[i];
407
+ if (!s) continue;
408
+ let c = m + l[e], h = d + y * c, g = f + b * c, _ = this._anim(t, {
409
+ i,
410
+ n: o * u,
411
+ u: v,
412
+ sizePx: t.fontSize,
413
+ pathLen: p,
414
+ nx: this.w ? h / this.w : .5,
415
+ ny: this.h ? g / this.h : .5
416
+ }, r), S = c + _.dLen, C = d + y * S, w = f + b * S;
417
+ s.setAttribute("transform", `translate(${C.toFixed(2)} ${w.toFixed(2)}) rotate(${(x + _.dRot).toFixed(2)}) translate(0 ${(-_.dNormal).toFixed(2)}) scale(${_.scale.toFixed(3)})`), this._styleGlyph(s, t, r, _);
418
+ }
419
+ }
420
+ }
421
+ _placeRings(t, n, r, i, a, o) {
422
+ let s = n.cache;
423
+ if (!s) return;
424
+ let { centers: l, total: u } = s, d = l.length;
425
+ if (!d) return;
426
+ let f = this.w / 2, p = this.h / 2, m = Math.min(this.w, this.h) * .5 * Math.max(.1, Math.min(1, t.path?.radius ?? .92)), h = m * Math.max(.02, Math.min(.95, t.path?.inner ?? .14)), g = Math.round(t.path?.spin ?? 1), _ = t.path?.twist ?? .5, v = t.path?.grow ?? .6, y = c(t.stagger || 0);
427
+ for (let n = 0; n < o; n++) {
428
+ let s = o > 1 ? n / (o - 1) : 0, c = Math.max(1, h + s * (m - h)), b = g + (y ? Math.round(y * 2 * s) : 0), x = i * e * b + s * _ * e, S = y ? H(i + y * n / o) : i, C = 1 + v * s;
429
+ for (let i = 0; i < d; i++) {
430
+ let s = n * d + i, m = a[s];
431
+ if (!m) continue;
432
+ let h = x + (l[i] - u / 2) / c, g = f + Math.cos(h) * c, _ = p + Math.sin(h) * c, v = this._anim(t, {
433
+ i: s,
434
+ n: o * d,
435
+ u: S,
436
+ sizePx: t.fontSize,
437
+ pathLen: e * c,
438
+ nx: this.w ? g / this.w : .5,
439
+ ny: this.h ? _ / this.h : .5
440
+ }, r), y = h + v.dLen / c, b = c - v.dNormal, w = f + Math.cos(y) * b, T = p + Math.sin(y) * b, E = y * 180 / Math.PI + 90 + v.dRot;
441
+ m.setAttribute("transform", `translate(${w.toFixed(2)} ${T.toFixed(2)}) rotate(${E.toFixed(2)}) scale(${(v.scale * C).toFixed(3)})`), this._styleGlyph(m, t, r, v);
442
+ }
443
+ }
444
+ }
445
+ _setKind(e, t) {
446
+ e.kind !== t && (e.kind = t, e.glyphG.textContent = "", e.glyphEls = [], e.morphEls = [], e.glyphKey = "", e.morphKey = "", e.morphPoolKey = "", e.cache = null);
447
+ }
448
+ _renderMorph(e, n, r, i, a, o, s, c) {
449
+ let l = e.fontSize, u = o.axes || [], d = {};
450
+ for (let t of u) d[t.tag] = e.vf?.[t.tag] ?? t.def;
451
+ let f = !!e.morph.face2, p = {};
452
+ if (!f) for (let t of u) p[t.tag] = e.morph.vf2?.[t.tag] ?? t.max;
453
+ let m = l * .12 + (e.letterSpacing || 0), h = e.morph.mode || "morph", g = e.morph.blend ?? .5, _ = e.morph.curve || "flat", v = e.morph.cp1 || {
454
+ x: .33,
455
+ y: .33
456
+ }, y = e.morph.cp2 || {
457
+ x: .66,
458
+ y: .66
459
+ }, b = e.fill || "#e8e4dc", x = JSON.stringify([
460
+ s,
461
+ e.font,
462
+ e.morph.face2 || "",
463
+ l,
464
+ d,
465
+ p,
466
+ h,
467
+ g,
468
+ _,
469
+ v,
470
+ y,
471
+ e.letterSpacing || 0,
472
+ b
473
+ ]), S = x !== n.morphKey;
474
+ if (S) {
475
+ n.morphKey = x;
476
+ let e = t(i, a, s, l, {
477
+ mode: h,
478
+ blend: g,
479
+ curve: _,
480
+ cp1: v,
481
+ cp2: y,
482
+ coordsA: d,
483
+ coordsB: p,
484
+ axes: u,
485
+ gap: m
486
+ });
487
+ n.morphData = e;
488
+ let r = [], o = 0;
489
+ for (let t of e.glyphs) r.push(o + t.advance / 2), o += t.advance;
490
+ n.morphCenters = r, n.morphTotal = e.totalAdvance;
491
+ }
492
+ let C = n.morphData?.glyphs.length || 0;
493
+ if (!s.length || !C) {
494
+ n.pathEl.setAttribute("d", ""), n.pathEl.style.opacity = 0;
495
+ return;
496
+ }
497
+ let w = k(c), T = w ? Math.max(1, Math.round(e.path?.rows ?? 2)) : 1, E = w ? Math.max(1, Math.round(e.path?.cols ?? 3)) : 1, ee = w ? T * E : 1, te = this._ensureMorphPool(n, C, ee, h);
498
+ if ((S || te) && this._refreshMorphPaths(n, ee, h, b), w) {
499
+ n.pathEl.setAttribute("d", ""), n.pathEl.style.opacity = 0, this._placeMorphArray(e, n, o, r, T, E);
500
+ return;
501
+ }
502
+ let D = M(c, this.w, this.h, e.path || {});
503
+ n.closed = D.closed, n.pathEl.setAttribute("d", D.d), n.pathEl.setAttribute("stroke", e.showPath ? e.fill || "#888" : "none"), n.pathEl.setAttribute("stroke-width", +!!e.showPath), n.pathEl.style.opacity = e.showPath ? .25 : 0, this._placeMorphOnPath(e, n, o, r);
504
+ }
505
+ _ensureMorphPool(e, t, n, r) {
506
+ let i = `${t}|${n}|${r}`;
507
+ if (i === e.morphPoolKey) return !1;
508
+ e.morphPoolKey = i, e.glyphG.textContent = "", e.morphEls = [];
509
+ let a = t * n;
510
+ for (let t = 0; t < a; t++) {
511
+ let t = U("g");
512
+ t.appendChild(U("path")), r === "fade" && t.appendChild(U("path")), e.glyphG.appendChild(t), e.morphEls.push(t);
513
+ }
514
+ return !0;
515
+ }
516
+ _refreshMorphPaths(e, t, n, r) {
517
+ let i = e.morphData?.glyphs || [], a = i.length;
518
+ if (a) for (let t = 0; t < e.morphEls.length; t++) {
519
+ let o = e.morphEls[t], s = i[t % a];
520
+ if (!s) continue;
521
+ let c = o.childNodes;
522
+ n === "fade" ? (this._setMorphPath(c[0], s.dA, s.bboxA, r, s.opA), this._setMorphPath(c[1], s.dB, s.bboxB, r, s.opB)) : this._setMorphPath(c[0], s.d, s.bbox, r, 1);
523
+ }
524
+ }
525
+ _setMorphPath(e, t, n, r, i) {
526
+ if (!e) return;
527
+ e.setAttribute("d", t || ""), e.setAttribute("fill", r), e.setAttribute("fill-rule", "evenodd"), e.setAttribute("opacity", i);
528
+ let a = (n.x1 + n.x2) / 2, o = (n.y1 + n.y2) / 2;
529
+ e.setAttribute("transform", `translate(${(-a).toFixed(2)} ${(-o).toFixed(2)})`);
530
+ }
531
+ _placeMorphOnPath(e, t, n, r, i = t.morphEls) {
532
+ let a = t.morphCenters, o = t.morphTotal;
533
+ if (!a || !i) return;
534
+ let s = t.pathEl.getTotalLength();
535
+ if (!s) return;
536
+ let l = e.align || "center", u = l === "start" ? 0 : l === "end" ? s - o : (s - o) / 2, d = .75, f = t.closed, p = e.flow === "flow" && !f, m = (e) => f ? (e % s + s) % s : Math.max(0, Math.min(s, e)), h = (e) => {
537
+ if (p && (e < 0 || e > s)) {
538
+ let n = e < 0 ? 0 : s, r = t.pathEl.getPointAtLength(n), i = t.pathEl.getPointAtLength(Math.max(0, n - d)), a = t.pathEl.getPointAtLength(Math.min(s, n + d)), o = a.x - i.x, c = a.y - i.y, l = Math.hypot(o, c) || 1;
539
+ o /= l, c /= l;
540
+ let u = e - n;
541
+ return {
542
+ x: r.x + o * u,
543
+ y: r.y + c * u
544
+ };
545
+ }
546
+ return t.pathEl.getPointAtLength(m(e));
547
+ }, g = e.italic ? " skewX(-12)" : "", _ = Math.min(i.length, a.length), v = c(e.stagger || 0), y = Math.max(1, Math.round(e.multiply || 1)), b = (a.length + 2) / y;
548
+ for (let t = 0; t < _; t++) {
549
+ let o = u + a[t], c = h(o), l = v && y > 1 ? H(r + v * Math.floor(t / b) / y) : r, f = this._anim(e, {
550
+ i: t,
551
+ n: a.length,
552
+ u: l,
553
+ sizePx: e.fontSize,
554
+ pathLen: s,
555
+ nx: this.w ? c.x / this.w : .5,
556
+ ny: this.h ? c.y / this.h : .5
557
+ }, n), p = o + f.dLen, m = h(p), _ = h(p - d), x = h(p + d), S = Math.atan2(x.y - _.y, x.x - _.x) * 180 / Math.PI;
558
+ i[t].setAttribute("transform", `translate(${m.x.toFixed(2)} ${m.y.toFixed(2)}) rotate(${(S + f.dRot).toFixed(2)}) translate(0 ${(-f.dNormal).toFixed(2)}) scale(${f.scale.toFixed(3)})${g}`), i[t].setAttribute("opacity", f.opacity);
559
+ }
560
+ }
561
+ _placeMorphArray(e, t, n, r, i, a, o = t.morphEls) {
562
+ let s = t.morphCenters, l = t.morphTotal;
563
+ if (!s || !o) return;
564
+ let u = s.length;
565
+ if (!u) return;
566
+ let d = Math.min(this.w, this.h) * .08, f = (this.w - 2 * d) / a, p = (this.h - 2 * d) / i, m = e.italic ? " skewX(-12)" : "", h = c(e.stagger || 0), g = i * a;
567
+ for (let t = 0; t < g; t++) {
568
+ let i = Math.floor(t / a), c = d + t % a * f + f / 2, _ = d + i * p + p / 2, v = c - l / 2, y = h ? H(r + h * t / g) : r;
569
+ for (let r = 0; r < u; r++) {
570
+ let i = t * u + r, a = o[i];
571
+ if (!a) continue;
572
+ let c = v + s[r], l = this._anim(e, {
573
+ i,
574
+ n: g * u,
575
+ u: y,
576
+ sizePx: e.fontSize,
577
+ pathLen: 0,
578
+ nx: this.w ? c / this.w : .5,
579
+ ny: this.h ? _ / this.h : .5
580
+ }, n), d = _ - l.dNormal;
581
+ a.setAttribute("transform", `translate(${c.toFixed(2)} ${d.toFixed(2)}) rotate(${l.dRot.toFixed(2)}) scale(${l.scale.toFixed(3)})${m}`), a.setAttribute("opacity", l.opacity);
582
+ }
583
+ }
584
+ }
585
+ }, W = (e, t = 0) => e?.instances?.[t] ?? null, G = (e, t, n = 0) => ({
586
+ ...e,
587
+ instances: (e.instances ?? []).map((e, r) => r === n ? {
588
+ ...e,
589
+ ...t
590
+ } : e)
591
+ }), Pe = (e, t) => ({
592
+ ...e,
593
+ instances: (e.instances ?? []).map((e, n, r) => ({
594
+ ...e,
595
+ ...t(e, n, r.length)
596
+ }))
597
+ }), K = (e, t, n = 0) => G(e, { path: {
598
+ ...W(e, n)?.path ?? {},
599
+ ...t
600
+ } }, n), q = (e, t, n = 0) => G(e, { motion: {
601
+ ...W(e, n)?.motion ?? {},
602
+ ...t
603
+ } }, n), J = (e, t = 0) => W(e, t)?.path?.type ?? "line", Y = (e, t = 0) => W(e, t)?.motion?.mode ?? "none", Fe = (e, t = 0) => ![
604
+ "radial",
605
+ "rings",
606
+ "array"
607
+ ].includes(J(e, t)), Ie = [
608
+ {
609
+ value: "line",
610
+ label: "Line"
611
+ },
612
+ {
613
+ value: "arc",
614
+ label: "Arc"
615
+ },
616
+ {
617
+ value: "sine",
618
+ label: "Sine"
619
+ },
620
+ {
621
+ value: "zigzag",
622
+ label: "Zigzag"
623
+ },
624
+ {
625
+ value: "spiral",
626
+ label: "Spiral"
627
+ },
628
+ {
629
+ value: "circle",
630
+ label: "Circle"
631
+ },
632
+ {
633
+ value: "ellipse",
634
+ label: "Ellipse"
635
+ },
636
+ {
637
+ value: "custom",
638
+ label: "Custom"
639
+ },
640
+ {
641
+ value: "array",
642
+ label: "Array"
643
+ },
644
+ {
645
+ value: "radial",
646
+ label: "Radial"
647
+ },
648
+ {
649
+ value: "rings",
650
+ label: "Rings"
651
+ }
652
+ ], X = (e, t = 0) => W(e, t)?.morph ?? {}, Z = (e, t, n = 0) => G(e, { morph: {
653
+ ...W(e, n)?.morph ?? {},
654
+ ...t
655
+ } }, n), Le = (e, t, n, r = 0) => Z(e, { vf2: {
656
+ ...X(e, r).vf2 ?? {},
657
+ [t]: n
658
+ } }, r), Re = (e, t = 0) => !["radial", "rings"].includes(J(e, t)), ze = (e, t = 0) => Re(e, t) && !!X(e, t).on, Q = (e, t = 0) => X(e, t).mode ?? "morph", Be = (e, t = 0) => ze(e, t) && ["morph", "fade"].includes(Q(e, t)), $ = (e, t, n = 0) => E(W(e, n)?.font).axes.find((e) => e.tag === t), Ve = (e, t, n, r = 0) => {
659
+ let i = $(e, t, r), a = i ? Math.min(i.max, Math.max(i.min, n)) : n;
660
+ return Le(e, t, Math.round(a), r);
661
+ }, He = (e, t, n, r = 0) => {
662
+ let i = $(e, t, r), a = i ? Math.min(i.max, Math.max(i.min, n)) : n;
663
+ return G(e, { vf: {
664
+ ...W(e, r)?.vf ?? {},
665
+ [t]: Math.round(a)
666
+ } }, r);
667
+ }, Ue = (e) => ({
668
+ key: `vf${e[0].toUpperCase()}${e.slice(1)}`,
669
+ label: v[e] || e,
670
+ tab: "style",
671
+ section: "Axes",
672
+ type: "range",
673
+ step: 1,
674
+ min: (t, n = 0) => $(t, e, n)?.min ?? 0,
675
+ max: (t, n = 0) => $(t, e, n)?.max ?? 1e3,
676
+ when: (t, n = 0) => !!$(t, e, n),
677
+ get: (t, n = 0) => W(t, n)?.vf?.[e] ?? $(t, e, n)?.def ?? 0,
678
+ set: (t, n, r = 0) => He(t, e, n, r)
679
+ }), We = (e, t = 0) => ze(e, t) && Q(e, t) === "morph" && (X(e, t).curve ?? "flat") === "custom", Ge = (e, t) => ({
680
+ key: `morphC${e}${t}`,
681
+ label: `P${e} ${t.toUpperCase()}`,
682
+ tab: "style",
683
+ section: "Morph",
684
+ type: "range",
685
+ min: 0,
686
+ max: 1,
687
+ step: .01,
688
+ noRandom: !0,
689
+ when: We,
690
+ get: (n, r = 0) => X(n, r)[`cp${e}`]?.[t] ?? (e === 1 ? .33 : .66),
691
+ set: (n, r, i = 0) => Z(n, { [`cp${e}`]: {
692
+ ...X(n, i)[`cp${e}`] ?? {
693
+ x: e === 1 ? .33 : .66,
694
+ y: e === 1 ? .33 : .66
695
+ },
696
+ [t]: r
697
+ } }, i)
698
+ }), Ke = [
699
+ {
700
+ key: "bg",
701
+ label: "Background",
702
+ tab: "style",
703
+ type: "color",
704
+ role: "bg",
705
+ noRandom: !0,
706
+ get: (e) => e.bg,
707
+ set: (e, t) => ({
708
+ ...e,
709
+ bg: t
710
+ })
711
+ },
712
+ {
713
+ key: "fill",
714
+ label: "Fill",
715
+ tab: "style",
716
+ type: "color",
717
+ role: "fg",
718
+ noRandom: !0,
719
+ get: (e, t = 0) => W(e, t)?.fill,
720
+ set: (e, t, n = 0) => G(e, { fill: t }, n)
721
+ },
722
+ {
723
+ key: "font",
724
+ label: "Font",
725
+ tab: "style",
726
+ type: "select",
727
+ options: m,
728
+ noRandom: !0,
729
+ get: (e, t = 0) => W(e, t)?.font,
730
+ set: (e, t, n = 0) => G(e, {
731
+ font: t,
732
+ vf: re(t, W(e, n)?.vf)
733
+ }, n)
734
+ },
735
+ {
736
+ key: "italic",
737
+ label: "Italic",
738
+ tab: "style",
739
+ type: "select",
740
+ noRandom: !0,
741
+ options: [{
742
+ value: "off",
743
+ label: "Off"
744
+ }, {
745
+ value: "on",
746
+ label: "On"
747
+ }],
748
+ get: (e, t = 0) => W(e, t)?.italic ? "on" : "off",
749
+ set: (e, t, n = 0) => G(e, { italic: t === "on" }, n)
750
+ },
751
+ {
752
+ key: "case",
753
+ label: "Case",
754
+ tab: "style",
755
+ type: "select",
756
+ noRandom: !0,
757
+ options: [
758
+ {
759
+ value: "none",
760
+ label: "Aa"
761
+ },
762
+ {
763
+ value: "upper",
764
+ label: "AA"
765
+ },
766
+ {
767
+ value: "lower",
768
+ label: "aa"
769
+ },
770
+ {
771
+ value: "title",
772
+ label: "Tt"
773
+ }
774
+ ],
775
+ get: (e, t = 0) => W(e, t)?.case ?? "none",
776
+ set: (e, t, n = 0) => G(e, { case: t }, n)
777
+ },
778
+ {
779
+ key: "fontSize",
780
+ label: "Font size",
781
+ tab: "style",
782
+ type: "range",
783
+ min: 8,
784
+ max: 1200,
785
+ step: 1,
786
+ rMin: 36,
787
+ rMax: 150,
788
+ get: (e, t = 0) => W(e, t)?.fontSize ?? 26,
789
+ set: (e, t, n = 0) => G(e, { fontSize: Math.round(t) }, n)
790
+ },
791
+ {
792
+ key: "letterSpacing",
793
+ label: "Letter spacing",
794
+ tab: "style",
795
+ type: "range",
796
+ min: -10,
797
+ max: 400,
798
+ step: .5,
799
+ rMin: 0,
800
+ rMax: 12,
801
+ get: (e, t = 0) => W(e, t)?.letterSpacing ?? 0,
802
+ set: (e, t, n = 0) => G(e, { letterSpacing: t }, n)
803
+ },
804
+ {
805
+ key: "align",
806
+ label: "Align",
807
+ tab: "style",
808
+ type: "select",
809
+ noRandom: !0,
810
+ when: Fe,
811
+ options: [
812
+ {
813
+ value: "start",
814
+ label: "Start"
815
+ },
816
+ {
817
+ value: "center",
818
+ label: "Center"
819
+ },
820
+ {
821
+ value: "end",
822
+ label: "End"
823
+ }
824
+ ],
825
+ get: (e, t = 0) => W(e, t)?.align ?? "center",
826
+ set: (e, t, n = 0) => G(e, { align: t }, n)
827
+ },
828
+ {
829
+ key: "multiply",
830
+ label: "Copies",
831
+ tab: "style",
832
+ type: "range",
833
+ min: 1,
834
+ max: 24,
835
+ step: 1,
836
+ noRandom: !0,
837
+ when: Fe,
838
+ get: (e, t = 0) => W(e, t)?.multiply ?? 1,
839
+ set: (e, t, n = 0) => G(e, { multiply: Math.round(t) }, n)
840
+ },
841
+ Ue("wdth"),
842
+ Ue("wght"),
843
+ {
844
+ key: "arrangement",
845
+ label: "Arrangement",
846
+ tab: "style",
847
+ section: "Arrangement",
848
+ type: "select",
849
+ noRandom: !0,
850
+ options: Ie,
851
+ get: J,
852
+ set: (e, t, n = 0) => K(e, { type: t }, n)
853
+ },
854
+ {
855
+ key: "spokes",
856
+ label: "Spokes",
857
+ tab: "style",
858
+ section: "Arrangement",
859
+ type: "range",
860
+ min: 2,
861
+ max: 32,
862
+ step: 1,
863
+ rMin: 6,
864
+ rMax: 28,
865
+ when: (e, t = 0) => J(e, t) === "radial",
866
+ get: (e, t = 0) => W(e, t)?.path?.count ?? 12,
867
+ set: (e, t, n = 0) => K(e, { count: Math.round(t) }, n)
868
+ },
869
+ {
870
+ key: "rings",
871
+ label: "Rings",
872
+ tab: "style",
873
+ section: "Arrangement",
874
+ type: "range",
875
+ min: 2,
876
+ max: 24,
877
+ step: 1,
878
+ rMin: 4,
879
+ rMax: 16,
880
+ when: (e, t = 0) => J(e, t) === "rings",
881
+ get: (e, t = 0) => W(e, t)?.path?.count ?? 12,
882
+ set: (e, t, n = 0) => K(e, { count: Math.round(t) }, n)
883
+ },
884
+ {
885
+ key: "inner",
886
+ label: "Inner radius",
887
+ tab: "style",
888
+ section: "Arrangement",
889
+ type: "range",
890
+ min: 0,
891
+ max: .9,
892
+ step: .01,
893
+ rMin: .04,
894
+ rMax: .4,
895
+ when: (e, t = 0) => J(e, t) === "radial" || J(e, t) === "rings",
896
+ get: (e, t = 0) => W(e, t)?.path?.inner ?? .12,
897
+ set: (e, t, n = 0) => K(e, { inner: t }, n)
898
+ },
899
+ {
900
+ key: "ringRadius",
901
+ label: "Radius",
902
+ tab: "style",
903
+ section: "Arrangement",
904
+ type: "range",
905
+ min: .1,
906
+ max: 1,
907
+ step: .01,
908
+ rMin: .6,
909
+ rMax: 1,
910
+ when: (e, t = 0) => J(e, t) === "rings",
911
+ get: (e, t = 0) => W(e, t)?.path?.radius ?? .92,
912
+ set: (e, t, n = 0) => K(e, { radius: t }, n)
913
+ },
914
+ {
915
+ key: "twist",
916
+ label: "Twist",
917
+ tab: "style",
918
+ section: "Arrangement",
919
+ type: "range",
920
+ min: 0,
921
+ max: 2,
922
+ step: .05,
923
+ rMin: 0,
924
+ rMax: 1.5,
925
+ when: (e, t = 0) => J(e, t) === "rings",
926
+ get: (e, t = 0) => W(e, t)?.path?.twist ?? .5,
927
+ set: (e, t, n = 0) => K(e, { twist: t }, n)
928
+ },
929
+ {
930
+ key: "grow",
931
+ label: "Grow",
932
+ tab: "style",
933
+ section: "Arrangement",
934
+ type: "range",
935
+ min: 0,
936
+ max: 2,
937
+ step: .05,
938
+ rMin: 0,
939
+ rMax: 1.5,
940
+ when: (e, t = 0) => J(e, t) === "rings",
941
+ get: (e, t = 0) => W(e, t)?.path?.grow ?? .6,
942
+ set: (e, t, n = 0) => K(e, { grow: t }, n)
943
+ },
944
+ {
945
+ key: "pathRadius",
946
+ label: "Radius",
947
+ tab: "style",
948
+ section: "Arrangement",
949
+ type: "range",
950
+ min: .2,
951
+ max: 1,
952
+ step: .01,
953
+ rMin: .5,
954
+ rMax: 1,
955
+ when: (e, t = 0) => [
956
+ "circle",
957
+ "ellipse",
958
+ "spiral"
959
+ ].includes(J(e, t)),
960
+ get: (e, t = 0) => W(e, t)?.path?.radius ?? .72,
961
+ set: (e, t, n = 0) => K(e, { radius: t }, n)
962
+ },
963
+ {
964
+ key: "turns",
965
+ label: "Turns",
966
+ tab: "style",
967
+ section: "Arrangement",
968
+ type: "range",
969
+ min: 1,
970
+ max: 8,
971
+ rMin: 1,
972
+ rMax: 6,
973
+ step: 1,
974
+ rMin: 2,
975
+ rMax: 5,
976
+ when: (e, t = 0) => J(e, t) === "spiral",
977
+ get: (e, t = 0) => W(e, t)?.path?.turns ?? 3,
978
+ set: (e, t, n = 0) => K(e, { turns: Math.round(t) }, n)
979
+ },
980
+ {
981
+ key: "amp",
982
+ label: "Amplitude",
983
+ tab: "style",
984
+ section: "Arrangement",
985
+ type: "range",
986
+ min: 0,
987
+ max: 1,
988
+ step: .05,
989
+ rMin: .2,
990
+ rMax: .7,
991
+ when: (e, t = 0) => [
992
+ "arc",
993
+ "sine",
994
+ "zigzag"
995
+ ].includes(J(e, t)),
996
+ get: (e, t = 0) => W(e, t)?.path?.amp ?? .4,
997
+ set: (e, t, n = 0) => K(e, { amp: t }, n)
998
+ },
999
+ {
1000
+ key: "freq",
1001
+ label: "Frequency",
1002
+ tab: "style",
1003
+ section: "Arrangement",
1004
+ type: "range",
1005
+ min: 1,
1006
+ max: 6,
1007
+ step: 1,
1008
+ rMin: 1,
1009
+ rMax: 4,
1010
+ when: (e, t = 0) => ["sine", "zigzag"].includes(J(e, t)),
1011
+ get: (e, t = 0) => W(e, t)?.path?.freq ?? 2,
1012
+ set: (e, t, n = 0) => K(e, { freq: Math.round(t) }, n)
1013
+ },
1014
+ {
1015
+ key: "rows",
1016
+ label: "Rows",
1017
+ tab: "style",
1018
+ section: "Arrangement",
1019
+ type: "range",
1020
+ min: 1,
1021
+ max: 6,
1022
+ step: 1,
1023
+ rMin: 2,
1024
+ rMax: 4,
1025
+ when: (e, t = 0) => J(e, t) === "array",
1026
+ get: (e, t = 0) => W(e, t)?.path?.rows ?? 2,
1027
+ set: (e, t, n = 0) => K(e, { rows: Math.round(t) }, n)
1028
+ },
1029
+ {
1030
+ key: "cols",
1031
+ label: "Columns",
1032
+ tab: "style",
1033
+ section: "Arrangement",
1034
+ type: "range",
1035
+ min: 1,
1036
+ max: 8,
1037
+ step: 1,
1038
+ rMin: 2,
1039
+ rMax: 6,
1040
+ when: (e, t = 0) => J(e, t) === "array",
1041
+ get: (e, t = 0) => W(e, t)?.path?.cols ?? 3,
1042
+ set: (e, t, n = 0) => K(e, { cols: Math.round(t) }, n)
1043
+ },
1044
+ {
1045
+ key: "flow",
1046
+ label: "Paragraph",
1047
+ tab: "style",
1048
+ section: "Arrangement",
1049
+ type: "select",
1050
+ noRandom: !0,
1051
+ when: Fe,
1052
+ options: [{
1053
+ value: "flow",
1054
+ label: "Flow"
1055
+ }, {
1056
+ value: "contain",
1057
+ label: "Contain"
1058
+ }],
1059
+ get: (e, t = 0) => W(e, t)?.flow ?? "flow",
1060
+ set: (e, t, n = 0) => G(e, { flow: t }, n)
1061
+ },
1062
+ {
1063
+ key: "showPath",
1064
+ label: "Show path",
1065
+ tab: "style",
1066
+ section: "Arrangement",
1067
+ type: "select",
1068
+ noRandom: !0,
1069
+ when: Fe,
1070
+ options: [{
1071
+ value: "off",
1072
+ label: "Off"
1073
+ }, {
1074
+ value: "on",
1075
+ label: "On"
1076
+ }],
1077
+ get: (e, t = 0) => W(e, t)?.showPath ? "on" : "off",
1078
+ set: (e, t, n = 0) => G(e, { showPath: t === "on" }, n)
1079
+ },
1080
+ {
1081
+ key: "offsetX",
1082
+ label: "X",
1083
+ tab: "style",
1084
+ section: "Position",
1085
+ type: "range",
1086
+ min: -1,
1087
+ max: 1,
1088
+ step: .01,
1089
+ noRandom: !0,
1090
+ get: (e, t = 0) => W(e, t)?.offset?.x ?? 0,
1091
+ set: (e, t, n = 0) => G(e, { offset: {
1092
+ ...W(e, n)?.offset ?? {},
1093
+ x: t
1094
+ } }, n)
1095
+ },
1096
+ {
1097
+ key: "offsetY",
1098
+ label: "Y",
1099
+ tab: "style",
1100
+ section: "Position",
1101
+ type: "range",
1102
+ min: -1,
1103
+ max: 1,
1104
+ step: .01,
1105
+ noRandom: !0,
1106
+ get: (e, t = 0) => W(e, t)?.offset?.y ?? 0,
1107
+ set: (e, t, n = 0) => G(e, { offset: {
1108
+ ...W(e, n)?.offset ?? {},
1109
+ y: t
1110
+ } }, n)
1111
+ },
1112
+ {
1113
+ key: "morphOn",
1114
+ label: "Morph outlines",
1115
+ tab: "style",
1116
+ section: "Morph",
1117
+ type: "select",
1118
+ noRandom: !0,
1119
+ when: Re,
1120
+ options: [{
1121
+ value: "off",
1122
+ label: "Off"
1123
+ }, {
1124
+ value: "on",
1125
+ label: "On"
1126
+ }],
1127
+ get: (e, t = 0) => X(e, t).on ? "on" : "off",
1128
+ set: (e, t, n = 0) => Z(e, { on: t === "on" }, n)
1129
+ },
1130
+ {
1131
+ key: "morphMode",
1132
+ label: "Mode",
1133
+ tab: "style",
1134
+ section: "Morph",
1135
+ type: "select",
1136
+ when: ze,
1137
+ options: S,
1138
+ get: Q,
1139
+ set: (e, t, n = 0) => Z(e, { mode: t }, n)
1140
+ },
1141
+ {
1142
+ key: "morphFace2",
1143
+ label: "Cut B face",
1144
+ tab: "style",
1145
+ section: "Morph",
1146
+ type: "select",
1147
+ noRandom: !0,
1148
+ when: Be,
1149
+ options: (e, t = 0) => [{
1150
+ value: "",
1151
+ label: "Off"
1152
+ }, ...m.filter((n) => n.value !== W(e, t)?.font)],
1153
+ get: (e, t = 0) => X(e, t).face2 ?? "",
1154
+ set: (e, t, n = 0) => Z(e, { face2: t }, n)
1155
+ },
1156
+ {
1157
+ key: "morphVf2Wdth",
1158
+ label: "Cut B · Width",
1159
+ tab: "style",
1160
+ section: "Morph",
1161
+ type: "range",
1162
+ min: 64,
1163
+ max: 172,
1164
+ step: 1,
1165
+ when: (e, t = 0) => Be(e, t) && !X(e, t).face2 && !!$(e, "wdth", t),
1166
+ get: (e, t = 0) => X(e, t).vf2?.wdth ?? $(e, "wdth", t)?.max ?? 172,
1167
+ set: (e, t, n = 0) => Ve(e, "wdth", t, n)
1168
+ },
1169
+ {
1170
+ key: "morphVf2Wght",
1171
+ label: "Cut B · Weight",
1172
+ tab: "style",
1173
+ section: "Morph",
1174
+ type: "range",
1175
+ min: 100,
1176
+ max: 900,
1177
+ step: 1,
1178
+ when: (e, t = 0) => Be(e, t) && !X(e, t).face2 && !!$(e, "wght", t),
1179
+ get: (e, t = 0) => X(e, t).vf2?.wght ?? $(e, "wght", t)?.max ?? 900,
1180
+ set: (e, t, n = 0) => Ve(e, "wght", t, n)
1181
+ },
1182
+ {
1183
+ key: "morphCurve",
1184
+ label: "Curve",
1185
+ tab: "style",
1186
+ section: "Morph",
1187
+ type: "select",
1188
+ when: (e, t = 0) => ze(e, t) && Q(e, t) === "morph",
1189
+ options: d,
1190
+ get: (e, t = 0) => X(e, t).curve ?? "flat",
1191
+ set: (e, t, n = 0) => Z(e, { curve: t }, n)
1192
+ },
1193
+ Ge(1, "x"),
1194
+ Ge(1, "y"),
1195
+ Ge(2, "x"),
1196
+ Ge(2, "y"),
1197
+ {
1198
+ key: "morphBlend",
1199
+ label: "Blend",
1200
+ tab: "style",
1201
+ section: "Morph",
1202
+ type: "range",
1203
+ min: 0,
1204
+ max: 1,
1205
+ step: .01,
1206
+ when: (e, t = 0) => ze(e, t) && Q(e, t) !== "random",
1207
+ get: (e, t = 0) => X(e, t).blend ?? .5,
1208
+ set: (e, t, n = 0) => Z(e, { blend: t }, n)
1209
+ },
1210
+ {
1211
+ key: "morphSeed",
1212
+ label: "Seed",
1213
+ tab: "style",
1214
+ section: "Morph",
1215
+ type: "range",
1216
+ min: 0,
1217
+ max: 1,
1218
+ step: .01,
1219
+ when: (e, t = 0) => ze(e, t) && Q(e, t) === "random",
1220
+ get: (e, t = 0) => X(e, t).blend ?? .5,
1221
+ set: (e, t, n = 0) => Z(e, { blend: t }, n)
1222
+ },
1223
+ {
1224
+ key: "mode",
1225
+ label: "Motion",
1226
+ tab: "anim",
1227
+ type: "select",
1228
+ noRandom: !0,
1229
+ options: [
1230
+ {
1231
+ value: "none",
1232
+ label: "None"
1233
+ },
1234
+ {
1235
+ value: "march",
1236
+ label: "March"
1237
+ },
1238
+ {
1239
+ value: "orbit",
1240
+ label: "Orbit"
1241
+ },
1242
+ {
1243
+ value: "vfwave",
1244
+ label: "Axis wave"
1245
+ },
1246
+ {
1247
+ value: "glyphwave",
1248
+ label: "Glyph wave"
1249
+ },
1250
+ {
1251
+ value: "cascade",
1252
+ label: "Cascade"
1253
+ },
1254
+ {
1255
+ value: "sweep",
1256
+ label: "Sweep"
1257
+ },
1258
+ {
1259
+ value: "sweepWeight",
1260
+ label: "Sweep weight"
1261
+ },
1262
+ {
1263
+ value: "sweepShift",
1264
+ label: "Sweep shift"
1265
+ }
1266
+ ],
1267
+ get: Y,
1268
+ set: (e, t, n = 0) => q(e, { mode: t }, n)
1269
+ },
1270
+ {
1271
+ key: "cycles",
1272
+ label: "Cycles",
1273
+ tab: "anim",
1274
+ type: "range",
1275
+ min: 1,
1276
+ max: 8,
1277
+ rMin: 1,
1278
+ rMax: 4,
1279
+ step: 1,
1280
+ rMin: 1,
1281
+ rMax: 3,
1282
+ when: (e, t = 0) => Y(e, t) !== "none",
1283
+ get: (e, t = 0) => W(e, t)?.motion?.cycles ?? 1,
1284
+ set: (e, t, n = 0) => q(e, { cycles: Math.round(t) }, n)
1285
+ },
1286
+ {
1287
+ key: "motionAmp",
1288
+ label: "Amount",
1289
+ tab: "anim",
1290
+ type: "range",
1291
+ min: .05,
1292
+ max: 1,
1293
+ step: .05,
1294
+ rMin: .15,
1295
+ rMax: .6,
1296
+ when: (e, t = 0) => [
1297
+ "glyphwave",
1298
+ "sweep",
1299
+ "sweepWeight",
1300
+ "sweepShift"
1301
+ ].includes(Y(e, t)),
1302
+ get: (e, t = 0) => W(e, t)?.motion?.amp ?? .3,
1303
+ set: (e, t, n = 0) => q(e, { amp: t }, n)
1304
+ },
1305
+ {
1306
+ key: "motionPhase",
1307
+ label: "Glyph phase",
1308
+ tab: "anim",
1309
+ type: "range",
1310
+ min: 0,
1311
+ max: 1.5,
1312
+ step: .05,
1313
+ rMin: .3,
1314
+ rMax: 1,
1315
+ when: (e, t = 0) => [
1316
+ "vfwave",
1317
+ "glyphwave",
1318
+ "cascade"
1319
+ ].includes(Y(e, t)),
1320
+ get: (e, t = 0) => W(e, t)?.motion?.phase ?? .5,
1321
+ set: (e, t, n = 0) => q(e, { phase: t }, n)
1322
+ },
1323
+ {
1324
+ key: "axis",
1325
+ label: "Axis",
1326
+ tab: "anim",
1327
+ type: "select",
1328
+ when: (e, t = 0) => ["vfwave", "sweepWeight"].includes(Y(e, t)) && E(W(e, t)?.font).axes.length > 1,
1329
+ options: (e, t = 0) => E(W(e, t)?.font).axes.map((e) => ({
1330
+ value: e.tag,
1331
+ label: v[e.tag] || e.tag
1332
+ })),
1333
+ get: (e, t = 0) => W(e, t)?.motion?.axis ?? "wght",
1334
+ set: (e, t, n = 0) => q(e, { axis: t }, n)
1335
+ },
1336
+ {
1337
+ key: "field",
1338
+ label: "Field",
1339
+ tab: "anim",
1340
+ type: "select",
1341
+ when: (e, t = 0) => [
1342
+ "sweep",
1343
+ "sweepWeight",
1344
+ "sweepShift"
1345
+ ].includes(Y(e, t)),
1346
+ options: [
1347
+ {
1348
+ value: "x",
1349
+ label: "Horizontal"
1350
+ },
1351
+ {
1352
+ value: "y",
1353
+ label: "Vertical"
1354
+ },
1355
+ {
1356
+ value: "diagonal",
1357
+ label: "Diagonal"
1358
+ },
1359
+ {
1360
+ value: "radial",
1361
+ label: "Radial"
1362
+ },
1363
+ {
1364
+ value: "angular",
1365
+ label: "Angular"
1366
+ },
1367
+ {
1368
+ value: "wave",
1369
+ label: "Wave"
1370
+ }
1371
+ ],
1372
+ get: (e, t = 0) => W(e, t)?.motion?.field ?? "x",
1373
+ set: (e, t, n = 0) => q(e, { field: t }, n)
1374
+ },
1375
+ {
1376
+ key: "stagger",
1377
+ label: "Stagger",
1378
+ tab: "anim",
1379
+ type: "range",
1380
+ min: 0,
1381
+ max: 1,
1382
+ step: .01,
1383
+ get: (e) => W(e)?.stagger ?? 0,
1384
+ set: (e, t) => Pe(e, (e, n, r) => ({
1385
+ stagger: t,
1386
+ phase: r > 1 ? n / r * t : 0
1387
+ }))
1388
+ },
1389
+ {
1390
+ key: "spin",
1391
+ label: "Spin",
1392
+ tab: "anim",
1393
+ type: "range",
1394
+ min: -8,
1395
+ max: 8,
1396
+ rMin: 0,
1397
+ rMax: 4,
1398
+ step: 1,
1399
+ rMin: 0,
1400
+ rMax: 3,
1401
+ when: (e, t = 0) => J(e, t) === "radial" || J(e, t) === "rings",
1402
+ get: (e, t = 0) => W(e, t)?.path?.spin ?? 1,
1403
+ set: (e, t, n = 0) => K(e, { spin: Math.round(t) }, n)
1404
+ }
1405
+ ], qe = (e, t, n = 0) => typeof e.options == "function" ? e.options(t, n) : e.options ?? [], Je = (e, t, n = 0) => ({
1406
+ min: typeof e.min == "function" ? e.min(t, n) : e.min,
1407
+ max: typeof e.max == "function" ? e.max(t, n) : e.max
1408
+ });
1409
+ function Ye(e, t = 0, n = Math.random, r = null) {
1410
+ let i = e;
1411
+ for (let e of Ke) if (!(e.noRandom || e.type === "color") && !(r && !r.includes(e.tab)) && !(e.when && !e.when(i, t))) {
1412
+ if (e.type === "range") {
1413
+ let r = Je(e, i, t), a = e.rMin ?? r.min, o = e.rMax ?? r.max, s = e.step ?? 1, c = a + n() * (o - a);
1414
+ i = e.set(i, Math.min(o, Math.max(a, Number((Math.round(c / s) * s).toFixed(4)))), t);
1415
+ } else if (e.type === "select") {
1416
+ let r = qe(e, i, t);
1417
+ r.length && (i = e.set(i, r[Math.floor(n() * r.length)].value, t));
1418
+ }
1419
+ }
1420
+ return i;
1421
+ }
1422
+ var Xe = (e, t) => `kin:${e}:${t}`;
1423
+ function Ze(e, t) {
1424
+ let n = e;
1425
+ for (let e in t) {
1426
+ let r = /^kin:(\d+):(.+)$/.exec(e);
1427
+ if (!r || typeof t[e] != "number") continue;
1428
+ let i = Ke.find((e) => e.key === r[2]);
1429
+ i?.type === "range" && (n = i.set(n, t[e], Number(r[1])));
1430
+ }
1431
+ return n;
1432
+ }
1433
+ //#endregion
1434
+ //#region src/editor/compose/inspectors/KineticPanel.jsx
1435
+ var Qe = {
1436
+ key: "morphBlend",
1437
+ label: "Morph blend",
1438
+ type: "range",
1439
+ min: 0,
1440
+ max: 1,
1441
+ step: .01,
1442
+ default: .5
1443
+ }, $e = new Set([
1444
+ "mode",
1445
+ "cycles",
1446
+ "motionAmp",
1447
+ "motionPhase",
1448
+ "axis",
1449
+ "field"
1450
+ ]), et = {
1451
+ mode: "glyphwave",
1452
+ cycles: 1,
1453
+ phase: .5,
1454
+ amp: .3,
1455
+ axis: "wght",
1456
+ field: "x"
1457
+ }, tt = new Set([
1458
+ "align",
1459
+ "italic",
1460
+ "fill",
1461
+ "fontSize",
1462
+ "vfWght",
1463
+ "offsetX",
1464
+ "offsetY"
1465
+ ]), nt = (e, t) => e ? String.fromCharCode(97 + t.indexOf(e) % 26) : null;
1466
+ function rt({ layer: e, setProp: t, updateLayer: n, palette: r, renderAnimate: i, tab: s, tabStrip: c, picker: l = !0 }) {
1467
+ let u = o(), d = e.comp ?? {
1468
+ bg: "#0b0d12",
1469
+ instances: []
1470
+ }, f = d.instances ?? [], [m, g] = L(0), v = Math.min(m, Math.max(0, f.length - 1)), x = (t) => {
1471
+ g(t), window.dispatchEvent(new CustomEvent("kol:kinetic-element", { detail: {
1472
+ id: e.id,
1473
+ index: t,
1474
+ from: "panel"
1475
+ } }));
1476
+ };
1477
+ be(() => {
1478
+ let t = (t) => {
1479
+ t.detail?.id === e.id && t.detail.from === "canvas" && g(t.detail.index);
1480
+ };
1481
+ return window.addEventListener("kol:kinetic-element", t), () => window.removeEventListener("kol:kinetic-element", t);
1482
+ }, [e.id]);
1483
+ let [S, T] = L([]), E = (e) => T((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]), ee = (e) => {
1484
+ let t = f[e]?.group;
1485
+ return t ? f.reduce((e, n, r) => n.group === t ? [...e, r] : e, []) : [e];
1486
+ }, [te, D] = L(0), O = f[v]?.motions ?? [], k = Math.min(te, O.length), ne = (e) => ({
1487
+ ...e,
1488
+ instances: (e.instances ?? []).map((e, t) => t === v ? {
1489
+ ...e,
1490
+ motion: { ...e.motions?.[k - 1] ?? {} }
1491
+ } : e)
1492
+ }), re = (e) => $e.has(e.key) && k > 0 ? ne(d) : d, ie = (t) => {
1493
+ t && (n(e.id, {
1494
+ presetId: t.id,
1495
+ presetLabel: t.label,
1496
+ comp: ae(t)
1497
+ }), g(0), D(0));
1498
+ }, A = (e) => t("comp", e), j = (t) => n(e.id, { comp: {
1499
+ ...d,
1500
+ instances: t
1501
+ } }), M = (e, t) => A({
1502
+ ...d,
1503
+ instances: f.map((n, r) => r === e ? {
1504
+ ...n,
1505
+ ...t
1506
+ } : n)
1507
+ }), oe = () => {
1508
+ if (S.length < 2) return;
1509
+ let e = new Set(f.map((e) => e.group).filter(Boolean)), t = 1;
1510
+ for (; e.has(`g${t}`);) t++;
1511
+ j(f.map((e) => S.includes(e.id) ? {
1512
+ ...e,
1513
+ group: `g${t}`
1514
+ } : e)), T([]);
1515
+ }, se = () => {
1516
+ S.length && (j(f.map((e) => S.includes(e.id) ? {
1517
+ ...e,
1518
+ group: null
1519
+ } : e)), T([]));
1520
+ }, le = (e, t) => {
1521
+ if ($e.has(e.key) && k > 0) {
1522
+ let n = e.set(ne(d), t, v).instances?.[v]?.motion ?? {};
1523
+ M(v, { motions: O.map((e, t) => t === k - 1 ? n : e) });
1524
+ return;
1525
+ }
1526
+ let n = ee(v);
1527
+ if (n.length > 1 && tt.has(e.key)) {
1528
+ let r = d;
1529
+ if (e.key === "fontSize") {
1530
+ let i = Number(e.get(d, v)) || 1, a = t / i;
1531
+ for (let t of n) {
1532
+ let n = Number(e.get(d, t)) || i;
1533
+ r = e.set(r, Math.max(8, Math.min(1200, Math.round(n * a))), t);
1534
+ }
1535
+ } else if (e.key === "offsetX" || e.key === "offsetY") {
1536
+ let i = t - (Number(e.get(d, v)) || 0);
1537
+ for (let t of n) r = e.set(r, (Number(e.get(d, t)) || 0) + i, t);
1538
+ } else for (let i of n) r = e.set(r, t, i);
1539
+ A(r);
1540
+ return;
1541
+ }
1542
+ A(e.set(d, t, v));
1543
+ }, F = y(e), de = (t = null) => {
1544
+ let r = F.take();
1545
+ n(e.id, {
1546
+ comp: Ye(d, v, b(r >>> 0), t),
1547
+ _rollSeed: r
1548
+ });
1549
+ }, me = () => {
1550
+ let t = F.take(), r = b(t >>> 0), i = d;
1551
+ f.forEach((e, t) => {
1552
+ i = Ye(i, t, r);
1553
+ }), n(e.id, {
1554
+ comp: i,
1555
+ _rollSeed: t
1556
+ });
1557
+ }, ge = () => {
1558
+ let t = N.find((t) => t.id === e.presetId), n = N.filter((e) => e.id !== t?.id && (!t || e.sub === t.sub));
1559
+ n.length && ie(n[Math.floor(b(F.take() >>> 0)() * n.length)]);
1560
+ }, _e = () => {
1561
+ let e = b(F.take() >>> 0);
1562
+ Se(_[Math.floor(e() * _.length)].value, e() < .5);
1563
+ }, ve = () => ie(N.find((t) => t.id === e.presetId) ?? N[0]), Se = (t, r) => {
1564
+ let i = p(t, r);
1565
+ n(e.id, {
1566
+ themeId: t,
1567
+ themeInvert: r,
1568
+ comp: {
1569
+ ...d,
1570
+ bg: i.bg,
1571
+ instances: f.map((e) => ({
1572
+ ...e,
1573
+ fill: i.fg
1574
+ }))
1575
+ }
1576
+ });
1577
+ }, B = (e) => A({
1578
+ ...d,
1579
+ instances: f.map((t) => ({
1580
+ ...t,
1581
+ fill: e
1582
+ }))
1583
+ }), Ce = s === "labs-effect" ? "style" : s, we = Ke.filter((e) => e.tab === Ce && (!e.when || e.when(re(e), v))), Te = f.some((e) => e?.morph?.on), V = f[v];
1584
+ return /* @__PURE__ */ z(xe, { children: [
1585
+ c,
1586
+ l && /* @__PURE__ */ R(it, {
1587
+ layer: e,
1588
+ onPreset: ie
1589
+ }),
1590
+ s === "generate" || s === "labs-effect" ? /* @__PURE__ */ z("div", {
1591
+ className: "flex flex-col gap-1",
1592
+ children: [
1593
+ /* @__PURE__ */ R("span", {
1594
+ className: "kol-eyebrow text-fg-80",
1595
+ children: "Elements"
1596
+ }),
1597
+ /* @__PURE__ */ R(at, {
1598
+ insts: f,
1599
+ idx: v,
1600
+ onSelect: x,
1601
+ onWrite: j,
1602
+ marked: S,
1603
+ onMark: E,
1604
+ onGroup: oe,
1605
+ onUngroup: se
1606
+ }),
1607
+ /* @__PURE__ */ R(I, {
1608
+ label: "Edit elements on the canvas (click to select, drag to move, corners to scale)",
1609
+ children: /* @__PURE__ */ R(P, {
1610
+ "aria-label": "Edit elements on the canvas (click to select, drag to move, corners to scale)",
1611
+ tone: "primary",
1612
+ size: u,
1613
+ className: "w-full",
1614
+ onClick: () => window.dispatchEvent(new CustomEvent("kol:kinetic-edit", { detail: {
1615
+ id: e.id,
1616
+ index: v
1617
+ } })),
1618
+ children: "Edit on canvas"
1619
+ })
1620
+ })
1621
+ ]
1622
+ }) : f.length > 1 && /* @__PURE__ */ z("span", {
1623
+ className: "kol-helper-12 text-meta truncate",
1624
+ children: [
1625
+ "Element ",
1626
+ v + 1,
1627
+ " · ",
1628
+ V?.text || "—"
1629
+ ]
1630
+ }),
1631
+ (s === "generate" || s === "labs-effect") && /* @__PURE__ */ z(xe, { children: [
1632
+ /* @__PURE__ */ R(ue, {
1633
+ label: "TEXT",
1634
+ children: /* @__PURE__ */ R(he, {
1635
+ variant: "filled",
1636
+ size: u,
1637
+ rows: 2,
1638
+ axis: "y",
1639
+ value: f[v]?.text ?? "",
1640
+ onChange: (e) => M(v, { text: e.target.value })
1641
+ })
1642
+ }),
1643
+ /* @__PURE__ */ z("div", {
1644
+ className: "flex flex-col gap-2",
1645
+ children: [/* @__PURE__ */ R(pe, {
1646
+ label: "Theme",
1647
+ align: "fill",
1648
+ labelWidth: a,
1649
+ children: /* @__PURE__ */ R(ce, {
1650
+ variant: "subtle",
1651
+ size: u,
1652
+ className: "w-full",
1653
+ options: _,
1654
+ value: e.themeId ?? "kol",
1655
+ onChange: (t) => Se(t, !!e.themeInvert)
1656
+ })
1657
+ }), /* @__PURE__ */ R(pe, {
1658
+ label: "Invert",
1659
+ align: "fill",
1660
+ labelWidth: a,
1661
+ children: /* @__PURE__ */ R(fe, {
1662
+ size: u,
1663
+ className: "w-full",
1664
+ options: [{
1665
+ value: "off",
1666
+ label: "Off"
1667
+ }, {
1668
+ value: "on",
1669
+ label: "On"
1670
+ }],
1671
+ value: e.themeInvert ? "on" : "off",
1672
+ onChange: (t) => Se(e.themeId ?? "kol", t === "on")
1673
+ })
1674
+ })]
1675
+ }),
1676
+ /* @__PURE__ */ R(h, {
1677
+ inline: !0,
1678
+ label: "Text color",
1679
+ value: f[0]?.fill,
1680
+ onChange: (e) => B(C(e, r) ?? e),
1681
+ palette: r
1682
+ }),
1683
+ /* @__PURE__ */ R(P, {
1684
+ tone: "primary",
1685
+ size: u,
1686
+ className: "w-full",
1687
+ onClick: ge,
1688
+ children: "Randomize preset"
1689
+ }),
1690
+ /* @__PURE__ */ z("div", {
1691
+ className: "flex gap-2",
1692
+ children: [/* @__PURE__ */ R(P, {
1693
+ tone: "primary",
1694
+ size: u,
1695
+ className: "flex-1 min-w-0",
1696
+ onClick: () => de(),
1697
+ children: "Randomize all"
1698
+ }), /* @__PURE__ */ R(I, {
1699
+ label: "Reset to defaults",
1700
+ children: /* @__PURE__ */ R(P, {
1701
+ tone: "primary",
1702
+ size: u,
1703
+ iconOnly: "refresh",
1704
+ "aria-label": "Reset to defaults",
1705
+ onClick: ve,
1706
+ className: "shrink-0"
1707
+ })
1708
+ })]
1709
+ }),
1710
+ /* @__PURE__ */ z("div", {
1711
+ className: "grid grid-cols-2 gap-2",
1712
+ children: [
1713
+ /* @__PURE__ */ R(P, {
1714
+ tone: "primary",
1715
+ size: u,
1716
+ onClick: _e,
1717
+ children: "Color"
1718
+ }),
1719
+ /* @__PURE__ */ R(P, {
1720
+ tone: "primary",
1721
+ size: u,
1722
+ onClick: () => de(["style"]),
1723
+ children: "Type"
1724
+ }),
1725
+ /* @__PURE__ */ R(P, {
1726
+ tone: "primary",
1727
+ size: u,
1728
+ onClick: () => de(["anim"]),
1729
+ children: "Motion"
1730
+ }),
1731
+ /* @__PURE__ */ R(P, {
1732
+ tone: "primary",
1733
+ size: u,
1734
+ onClick: me,
1735
+ children: "All elements"
1736
+ })
1737
+ ]
1738
+ }),
1739
+ /* @__PURE__ */ R(w, { seed: F })
1740
+ ] }),
1741
+ s === "anim" && /* @__PURE__ */ R(st, {
1742
+ motions: O,
1743
+ mIdx: k,
1744
+ onSelect: D,
1745
+ onAdd: () => {
1746
+ j(f.map((e, t) => t === v ? {
1747
+ ...e,
1748
+ motions: [...O, { ...et }]
1749
+ } : e)), D(O.length + 1);
1750
+ },
1751
+ onRemove: () => {
1752
+ k !== 0 && (j(f.map((e, t) => t === v ? {
1753
+ ...e,
1754
+ motions: O.filter((e, t) => t !== k - 1)
1755
+ } : e)), D(k - 1));
1756
+ }
1757
+ }),
1758
+ s !== "generate" && we.map((n, a) => /* @__PURE__ */ z(ye, { children: [
1759
+ n.key === "arrangement" && /* @__PURE__ */ z(xe, { children: [/* @__PURE__ */ R("span", {
1760
+ className: "kol-eyebrow text-fg-80",
1761
+ children: "OpenType"
1762
+ }), /* @__PURE__ */ R(ct, {
1763
+ value: V?.opentype ?? {},
1764
+ onToggle: (e, t) => M(v, { opentype: {
1765
+ ...V?.opentype ?? {},
1766
+ [e]: t
1767
+ } })
1768
+ })] }),
1769
+ n.section && n.section !== we[a - 1]?.section && /* @__PURE__ */ R("span", {
1770
+ className: "kol-eyebrow text-fg-80",
1771
+ children: n.section
1772
+ }),
1773
+ /* @__PURE__ */ R(ot, {
1774
+ knob: n,
1775
+ comp: re(n),
1776
+ idx: v,
1777
+ palette: r,
1778
+ onWrite: le,
1779
+ bridge: $e.has(n.key) && k > 0 ? null : {
1780
+ layer: e,
1781
+ setProp: t,
1782
+ renderAnimate: i,
1783
+ key: Xe(v, n.key)
1784
+ }
1785
+ }),
1786
+ n.key === "showPath" && V?.path?.type === "custom" && /* @__PURE__ */ R(lt, {
1787
+ inst: V,
1788
+ layer: e,
1789
+ onPoints: (e) => M(v, { path: {
1790
+ ...V?.path ?? {},
1791
+ points: e
1792
+ } })
1793
+ })
1794
+ ] }, n.key)),
1795
+ s === "anim" && Te && /* @__PURE__ */ R(ut, {
1796
+ layer: e,
1797
+ setProp: t,
1798
+ insts: f,
1799
+ renderAnimate: i
1800
+ })
1801
+ ] });
1802
+ }
1803
+ function it({ layer: e, onPreset: t }) {
1804
+ return /* @__PURE__ */ R(ee, {
1805
+ tree: A,
1806
+ presets: N,
1807
+ current: N.find((t) => t.id === e.presetId) ?? N[0],
1808
+ onPick: t,
1809
+ inline: !0
1810
+ });
1811
+ }
1812
+ function at({ insts: e, idx: t, onSelect: n, onWrite: r, marked: i, onMark: a, onGroup: s, onUngroup: c }) {
1813
+ let l = o(), u = () => {
1814
+ let t = e.length;
1815
+ for (; e.some((e) => e.id === `i${t}`);) t++;
1816
+ return `i${t}`;
1817
+ }, d = () => {
1818
+ let i = {
1819
+ id: u(),
1820
+ text: "Text"
1821
+ };
1822
+ e[t]?.fill && (i.fill = e[t].fill), r([...e, D(i, e.length)]), n(e.length);
1823
+ }, f = (t) => {
1824
+ let i = {
1825
+ ...structuredClone(e[t]),
1826
+ id: u()
1827
+ }, a = [...e];
1828
+ a.splice(t + 1, 0, i), r(a), n(t + 1);
1829
+ }, p = (t) => {
1830
+ e.length <= 1 || (r(e.filter((e, n) => n !== t)), n(Math.min(t, e.length - 2)));
1831
+ }, m = (i) => {
1832
+ let a = t + i;
1833
+ if (a < 0 || a >= e.length) return;
1834
+ let o = [...e], [s] = o.splice(t, 1);
1835
+ o.splice(a, 0, s), r(o), n(a);
1836
+ }, h = [...new Set(e.map((e) => e.group).filter(Boolean))];
1837
+ return /* @__PURE__ */ z(xe, { children: [
1838
+ /* @__PURE__ */ R("div", {
1839
+ className: "flex flex-col gap-1",
1840
+ children: e.map((r, o) => {
1841
+ let s = nt(r.group, h);
1842
+ return /* @__PURE__ */ z("div", {
1843
+ onClick: () => n(o),
1844
+ className: `flex items-center gap-2 pl-2 pr-1 py-1 rounded cursor-pointer kol-helper-12 ${o === t ? "bg-oq-08 text-emphasis" : "text-body hover:bg-oq-04 hover:text-emphasis"}`,
1845
+ children: [
1846
+ /* @__PURE__ */ R("span", {
1847
+ onClick: (e) => e.stopPropagation(),
1848
+ className: "shrink-0",
1849
+ style: { lineHeight: 0 },
1850
+ children: /* @__PURE__ */ R(ge, {
1851
+ checked: i.includes(r.id),
1852
+ onChange: () => a(r.id)
1853
+ })
1854
+ }),
1855
+ /* @__PURE__ */ R("span", {
1856
+ className: "kol-helper-10 text-meta shrink-0",
1857
+ children: o + 1
1858
+ }),
1859
+ /* @__PURE__ */ R("span", {
1860
+ className: "truncate flex-1 min-w-0",
1861
+ children: r.text || "—"
1862
+ }),
1863
+ s && /* @__PURE__ */ z("span", {
1864
+ className: "shrink-0 kol-helper-10 text-meta",
1865
+ children: ["grp ", s]
1866
+ }),
1867
+ /* @__PURE__ */ R(I, {
1868
+ label: "Duplicate element",
1869
+ children: /* @__PURE__ */ R(P, {
1870
+ tone: "ghost",
1871
+ size: l,
1872
+ quiet: !0,
1873
+ iconOnly: "copy",
1874
+ iconSize: 12,
1875
+ "aria-label": "Duplicate element",
1876
+ onClick: (e) => {
1877
+ e.stopPropagation(), f(o);
1878
+ }
1879
+ })
1880
+ }),
1881
+ /* @__PURE__ */ R("span", {
1882
+ className: e.length <= 1 ? "invisible pointer-events-none" : "contents",
1883
+ "aria-hidden": e.length <= 1 || void 0,
1884
+ children: /* @__PURE__ */ R(I, {
1885
+ label: "Delete element",
1886
+ children: /* @__PURE__ */ R(P, {
1887
+ tone: "ghost",
1888
+ size: l,
1889
+ quiet: !0,
1890
+ iconOnly: "x",
1891
+ iconSize: 10,
1892
+ "aria-label": "Delete element",
1893
+ onClick: (e) => {
1894
+ e.stopPropagation(), p(o);
1895
+ }
1896
+ })
1897
+ })
1898
+ })
1899
+ ]
1900
+ }, r.id ?? o);
1901
+ })
1902
+ }),
1903
+ i.length > 0 && /* @__PURE__ */ z("div", {
1904
+ className: "grid grid-cols-2 gap-1",
1905
+ children: [i.length >= 2 && /* @__PURE__ */ R(P, {
1906
+ tone: "primary",
1907
+ size: l,
1908
+ onClick: s,
1909
+ children: "Group"
1910
+ }), /* @__PURE__ */ R(P, {
1911
+ tone: "primary",
1912
+ size: l,
1913
+ onClick: c,
1914
+ children: "Ungroup"
1915
+ })]
1916
+ }),
1917
+ /* @__PURE__ */ z("div", {
1918
+ className: "flex items-center gap-1",
1919
+ children: [
1920
+ /* @__PURE__ */ R(P, {
1921
+ tone: "primary",
1922
+ size: l,
1923
+ className: "flex-1",
1924
+ iconLeft: "plus",
1925
+ iconSize: 12,
1926
+ onClick: d,
1927
+ children: "Add element"
1928
+ }),
1929
+ /* @__PURE__ */ R("span", {
1930
+ className: t <= 0 ? "invisible pointer-events-none" : "contents",
1931
+ "aria-hidden": t <= 0 || void 0,
1932
+ children: /* @__PURE__ */ R(I, {
1933
+ label: "Move element up",
1934
+ children: /* @__PURE__ */ R(P, {
1935
+ tone: "ghost",
1936
+ size: l,
1937
+ quiet: !0,
1938
+ iconOnly: "chevron-down",
1939
+ className: "rotate-180",
1940
+ "aria-label": "Move element up",
1941
+ onClick: () => m(-1)
1942
+ })
1943
+ })
1944
+ }),
1945
+ /* @__PURE__ */ R("span", {
1946
+ className: t >= e.length - 1 ? "invisible pointer-events-none" : "contents",
1947
+ "aria-hidden": t >= e.length - 1 || void 0,
1948
+ children: /* @__PURE__ */ R(I, {
1949
+ label: "Move element down",
1950
+ children: /* @__PURE__ */ R(P, {
1951
+ tone: "ghost",
1952
+ size: l,
1953
+ quiet: !0,
1954
+ iconOnly: "chevron-down",
1955
+ "aria-label": "Move element down",
1956
+ onClick: () => m(1)
1957
+ })
1958
+ })
1959
+ })
1960
+ ]
1961
+ })
1962
+ ] });
1963
+ }
1964
+ function ot({ knob: e, comp: t, idx: r, palette: i, onWrite: s, bridge: c }) {
1965
+ let l = o(), u = e.get(t, r), d = (t) => s(e, t);
1966
+ if (e.type === "color") return /* @__PURE__ */ R(h, {
1967
+ label: e.label,
1968
+ value: u,
1969
+ onChange: (e) => d(C(e, i) ?? e),
1970
+ palette: i,
1971
+ inline: !0
1972
+ });
1973
+ if (e.type === "select") return /* @__PURE__ */ R(pe, {
1974
+ label: e.label,
1975
+ align: "fill",
1976
+ labelWidth: a,
1977
+ children: /* @__PURE__ */ R(ce, {
1978
+ variant: "subtle",
1979
+ size: l,
1980
+ className: "w-full",
1981
+ options: qe(e, t, r),
1982
+ value: u,
1983
+ onChange: d
1984
+ })
1985
+ });
1986
+ let { min: f, max: p } = Je(e, t, r), m = c && c.layer[c.key], g = n(m), _ = typeof m == "number" ? m : u, v = typeof m == "number" ? (e) => c.setProp(c.key, e) : d;
1987
+ return /* @__PURE__ */ R(pe, {
1988
+ label: e.label,
1989
+ align: "fill",
1990
+ labelWidth: a,
1991
+ children: /* @__PURE__ */ z("div", {
1992
+ className: "flex flex-1 items-center gap-2",
1993
+ children: [/* @__PURE__ */ R("div", {
1994
+ className: "flex-1 min-w-0",
1995
+ children: g ? /* @__PURE__ */ R("div", {
1996
+ className: "kol-helper-12 text-meta italic px-1",
1997
+ children: "animated"
1998
+ }) : /* @__PURE__ */ R(me, {
1999
+ min: f,
2000
+ max: p,
2001
+ step: e.step ?? 1,
2002
+ value: typeof _ == "number" ? _ : f,
2003
+ onChange: v,
2004
+ displayWidth: String(p).length,
2005
+ className: "flex-1"
2006
+ })
2007
+ }), c?.renderAnimate?.({
2008
+ key: c.key,
2009
+ label: e.label,
2010
+ type: "range",
2011
+ min: f,
2012
+ max: p,
2013
+ step: e.step ?? 1,
2014
+ default: typeof u == "number" ? u : f
2015
+ })]
2016
+ })
2017
+ });
2018
+ }
2019
+ function st({ motions: e, mIdx: t, onSelect: n, onAdd: r, onRemove: i }) {
2020
+ let a = o(), s = [{
2021
+ value: "0",
2022
+ label: "1"
2023
+ }, ...e.map((e, t) => ({
2024
+ value: String(t + 1),
2025
+ label: String(t + 2)
2026
+ }))];
2027
+ return /* @__PURE__ */ z("div", {
2028
+ className: "flex flex-col gap-1",
2029
+ children: [/* @__PURE__ */ R("span", {
2030
+ className: "kol-eyebrow text-fg-80",
2031
+ children: "Motion layers"
2032
+ }), /* @__PURE__ */ z("div", {
2033
+ className: "flex items-center gap-1",
2034
+ children: [
2035
+ /* @__PURE__ */ R("div", {
2036
+ className: "flex-1 min-w-0",
2037
+ children: /* @__PURE__ */ R(fe, {
2038
+ size: a,
2039
+ value: String(t),
2040
+ onChange: (e) => n(Number(e)),
2041
+ options: s
2042
+ })
2043
+ }),
2044
+ /* @__PURE__ */ R(I, {
2045
+ label: "Add motion layer",
2046
+ children: /* @__PURE__ */ R(P, {
2047
+ tone: "ghost",
2048
+ size: a,
2049
+ quiet: !0,
2050
+ iconOnly: "plus",
2051
+ iconSize: 12,
2052
+ "aria-label": "Add motion layer",
2053
+ onClick: r
2054
+ })
2055
+ }),
2056
+ /* @__PURE__ */ R("span", {
2057
+ className: t === 0 ? "invisible pointer-events-none" : "contents",
2058
+ "aria-hidden": t === 0 || void 0,
2059
+ children: /* @__PURE__ */ R(I, {
2060
+ label: "Delete motion layer (the primary can only be set to None)",
2061
+ children: /* @__PURE__ */ R(P, {
2062
+ tone: "ghost",
2063
+ size: a,
2064
+ quiet: !0,
2065
+ iconOnly: "x",
2066
+ iconSize: 10,
2067
+ "aria-label": "Delete motion layer",
2068
+ onClick: i
2069
+ })
2070
+ })
2071
+ })
2072
+ ]
2073
+ })]
2074
+ });
2075
+ }
2076
+ function ct({ value: e = {}, onToggle: t }) {
2077
+ let n = o(), [r, i] = L(!1), a = ve({
2078
+ open: r,
2079
+ onOpenChange: i,
2080
+ placement: "bottom-start",
2081
+ offset: -1,
2082
+ flip: !1,
2083
+ matchReferenceWidth: !0,
2084
+ role: "listbox"
2085
+ }), s = Oe.filter((t) => e[t.tag]).length;
2086
+ return /* @__PURE__ */ z("div", {
2087
+ className: "relative w-full",
2088
+ children: [/* @__PURE__ */ R(P, {
2089
+ ref: a.refs.setReference,
2090
+ ...a.getReferenceProps(),
2091
+ tone: "primary",
2092
+ size: n,
2093
+ className: "w-full justify-between",
2094
+ iconRight: "chevron-down",
2095
+ "aria-haspopup": "listbox",
2096
+ "aria-expanded": r,
2097
+ children: s ? `${s} feature${s > 1 ? "s" : ""}` : "None"
2098
+ }), /* @__PURE__ */ R(de, {
2099
+ popover: a,
2100
+ panel: !1,
2101
+ focus: !1,
2102
+ style: {
2103
+ backgroundColor: "var(--kol-surface-secondary)",
2104
+ color: "var(--kol-surface-on-primary)",
2105
+ borderRadius: "0 0 4px 4px",
2106
+ zIndex: "var(--kol-z-dropdown)"
2107
+ },
2108
+ children: /* @__PURE__ */ R("div", {
2109
+ className: "flex max-h-[300px] flex-col items-stretch overflow-y-auto",
2110
+ role: "listbox",
2111
+ children: Oe.map((n) => /* @__PURE__ */ R(F, {
2112
+ onClick: () => t(n.tag, !e[n.tag]),
2113
+ shortcut: e[n.tag] ? /* @__PURE__ */ R(Se, {
2114
+ name: "check",
2115
+ size: 11
2116
+ }) : void 0,
2117
+ children: n.label
2118
+ }, n.tag))
2119
+ })
2120
+ })]
2121
+ });
2122
+ }
2123
+ function lt({ inst: e, layer: t, onPoints: n }) {
2124
+ let r = o(), i = e?.path?.points, a = Array.isArray(i) && i.length >= 2 ? i : te, s = t.w > 0 && t.h > 0 ? t.w / t.h : 1;
2125
+ return /* @__PURE__ */ z("div", {
2126
+ className: "flex flex-col gap-2",
2127
+ children: [/* @__PURE__ */ R(se, {
2128
+ value: a.map(([e, t]) => ({
2129
+ x: e,
2130
+ y: t
2131
+ })),
2132
+ onChange: (e) => n(e.map((e) => [Number(e.x.toFixed(3)), Number(e.y.toFixed(3))])),
2133
+ aspect: s,
2134
+ size: r,
2135
+ minPoints: 2,
2136
+ ariaLabel: "Custom path points"
2137
+ }), /* @__PURE__ */ z("div", {
2138
+ className: "grid grid-cols-2 gap-2",
2139
+ children: [/* @__PURE__ */ R(P, {
2140
+ tone: "primary",
2141
+ size: r,
2142
+ onClick: () => n([...a, [.5, .5]]),
2143
+ children: "Add point"
2144
+ }), a.length > 2 && /* @__PURE__ */ R(P, {
2145
+ tone: "primary",
2146
+ size: r,
2147
+ onClick: () => n(a.slice(0, -1)),
2148
+ children: "Remove point"
2149
+ })]
2150
+ })]
2151
+ });
2152
+ }
2153
+ function ut({ layer: e, setProp: t, insts: r, renderAnimate: i }) {
2154
+ let o = Qe, s = e[o.key], c = n(s), l = r.find((e) => e?.morph?.on)?.morph?.blend ?? o.default, u = typeof s == "number" ? s : l, d = c ? /* @__PURE__ */ R("div", {
2155
+ className: "kol-helper-12 text-meta italic px-1",
2156
+ children: "animated"
2157
+ }) : /* @__PURE__ */ R(me, {
2158
+ min: o.min,
2159
+ max: o.max,
2160
+ step: o.step,
2161
+ value: u,
2162
+ onChange: (e) => t(o.key, e)
2163
+ });
2164
+ return /* @__PURE__ */ R(pe, {
2165
+ label: o.label,
2166
+ align: "fill",
2167
+ labelWidth: a,
2168
+ children: /* @__PURE__ */ z("div", {
2169
+ className: "flex flex-1 items-center gap-2",
2170
+ children: [/* @__PURE__ */ R("div", {
2171
+ className: "flex-1 min-w-0",
2172
+ children: d
2173
+ }), i(o)]
2174
+ })
2175
+ });
2176
+ }
2177
+ //#endregion
2178
+ //#region src/editor/params/TransportBar.jsx
2179
+ function dt({ seconds: e, onCommit: t, size: n }) {
2180
+ let r = String(e), [i, a] = L(r), [o, s] = L(!1);
2181
+ return be(() => {
2182
+ o || a(r);
2183
+ }, [r, o]), /* @__PURE__ */ R(I, {
2184
+ label: "Loop length",
2185
+ triggerClassName: "flex w-full",
2186
+ children: /* @__PURE__ */ R(le, {
2187
+ type: "text",
2188
+ inputMode: "decimal",
2189
+ variant: "property",
2190
+ size: n,
2191
+ affordance: "Loop /",
2192
+ unit: "s",
2193
+ chars: 3,
2194
+ "aria-label": "Loop length in seconds",
2195
+ value: i,
2196
+ onFocus: (e) => {
2197
+ s(!0), e.target.select();
2198
+ },
2199
+ onChange: (e) => a(e.target.value),
2200
+ onBlur: () => {
2201
+ s(!1);
2202
+ let e = Number(i.trim());
2203
+ if (i.trim() === "" || !Number.isFinite(e)) {
2204
+ a(r);
2205
+ return;
2206
+ }
2207
+ t(e);
2208
+ },
2209
+ onKeyDown: (e) => {
2210
+ e.key === "Enter" && e.currentTarget.blur(), e.key === "Escape" && (a(r), s(!1), e.currentTarget.blur());
2211
+ },
2212
+ className: "justify-center",
2213
+ inputClassName: "text-center"
2214
+ })
2215
+ });
2216
+ }
2217
+ var ft = (e, t) => /* @__PURE__ */ R(Se, {
2218
+ name: e,
2219
+ size: _e(t, !0)
2220
+ }), pt = {
2221
+ sm: "shrink-0 [&_.kol-seg-cell]:flex-none [&_.kol-seg-cell]:px-0 [&_.kol-seg-cell]:w-[var(--kol-ctl-sm)]",
2222
+ md: "shrink-0 [&_.kol-seg-cell]:flex-none [&_.kol-seg-cell]:px-0 [&_.kol-seg-cell]:w-[var(--kol-ctl-md)]",
2223
+ lg: "shrink-0 [&_.kol-seg-cell]:flex-none [&_.kol-seg-cell]:px-0 [&_.kol-seg-cell]:w-[var(--kol-ctl-lg)]"
2224
+ };
2225
+ function mt({ size: e = "sm" }) {
2226
+ let { playing: t, loopSeconds: n, play: r, pause: i, stop: a, rewind: o, setLoopSeconds: s } = T();
2227
+ return /* @__PURE__ */ z("div", {
2228
+ className: "flex items-center gap-2",
2229
+ children: [
2230
+ /* @__PURE__ */ R(fe, {
2231
+ size: e,
2232
+ ariaLabel: "Playback",
2233
+ value: t ? "play" : "pause",
2234
+ className: pt[e],
2235
+ onChange: (e) => e === "play" ? r() : i(),
2236
+ options: [{
2237
+ value: "play",
2238
+ ariaLabel: "Play",
2239
+ tooltip: "Play (Space)",
2240
+ label: ft("play", e)
2241
+ }, {
2242
+ value: "pause",
2243
+ ariaLabel: "Pause",
2244
+ tooltip: "Pause (Space)",
2245
+ label: ft("pause", e)
2246
+ }]
2247
+ }),
2248
+ /* @__PURE__ */ R("div", {
2249
+ className: "flex-1 min-w-0",
2250
+ children: /* @__PURE__ */ R(dt, {
2251
+ seconds: n,
2252
+ onCommit: s,
2253
+ size: e
2254
+ })
2255
+ }),
2256
+ /* @__PURE__ */ R(fe, {
2257
+ size: e,
2258
+ ariaLabel: "Reset",
2259
+ value: null,
2260
+ className: pt[e],
2261
+ onChange: (e) => e === "stop" ? a() : o(),
2262
+ options: [{
2263
+ value: "stop",
2264
+ ariaLabel: "Stop",
2265
+ label: ft("stop", e)
2266
+ }, {
2267
+ value: "rewind",
2268
+ ariaLabel: "Rewind",
2269
+ label: ft("rewind", e)
2270
+ }]
2271
+ })
2272
+ ]
2273
+ });
2274
+ }
2275
+ //#endregion
2276
+ //#region src/packs/motion.js
2277
+ var ht = {
2278
+ layerTypes: ["kinetic"],
2279
+ kineticPresetById: O,
2280
+ presetComp: ae,
2281
+ KINETIC_TREE: A,
2282
+ KINETIC_PRESETS: N,
2283
+ KineticType: Ne,
2284
+ applyKnobBridges: Ze,
2285
+ loadFonts: i,
2286
+ warmFontCss: u,
2287
+ kineticFontCss: g,
2288
+ KineticPanel: rt,
2289
+ TimelineDock: oe,
2290
+ useTimelineUp: j,
2291
+ TransportBar: mt
2292
+ };
2293
+ s("motion", ht);
2294
+ //#endregion
2295
+ export { rt as n, Ye as r, ht as t };