@kolkrabbi/design-editor 0.13.0 → 0.14.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.
@@ -0,0 +1,4319 @@
1
+ import { Bt as e, C as t, M as n, b as r, ft as i, gt as a, h as o, ht as s, j as c, l, mt as u, n as d, p as f, pt as p, t as m, tn as h, u as g } from "./EditorIcon-BbFMmc1G.js";
2
+ import { _, a as v, d as y, f as b, g as x, h as S, i as ee, l as C, m as w, p as te, r as ne, s as T, u as E, y as D } from "./TreePicker-DlEXH2kw.js";
3
+ import { t as re } from "./labels-B10g9Um5.js";
4
+ import { Button as O, Dropdown as ie, Input as ae, LabeledControl as k, MenuDropdownItem as oe, PopoverPanel as se, SegmentedToggle as A, Slider as j, Textarea as ce, ToggleCheckbox as le, ViewToggle as ue, usePopover as de } from "@kolkrabbi/kol-component";
5
+ import { Fragment as fe, useEffect as pe, useMemo as me, useRef as M, useState as N } from "react";
6
+ import { Fragment as he, jsx as P, jsxs as F } from "react/jsx-runtime";
7
+ //#region src/kinetic/paths.js
8
+ var ge = Math.PI * 2, I = (e) => Math.round(e * 100) / 100;
9
+ function _e(e) {
10
+ return e.map((e, t) => `${t === 0 ? "M" : "L"} ${I(e[0])} ${I(e[1])}`).join(" ");
11
+ }
12
+ var ve = [
13
+ [.12, .55],
14
+ [.37, .32],
15
+ [.63, .68],
16
+ [.88, .45]
17
+ ];
18
+ function ye(e, t, n) {
19
+ let r = e.map(([e, r]) => [e * t, r * n]);
20
+ if (r.length < 2) return `M ${I(t / 2)} ${I(n / 2)} L ${I(t / 2 + 1)} ${I(n / 2)}`;
21
+ let i = `M ${I(r[0][0])} ${I(r[0][1])}`;
22
+ for (let e = 0; e < r.length - 1; e++) {
23
+ let t = r[e - 1] || r[e], n = r[e], a = r[e + 1], o = r[e + 2] || r[e + 1], s = n[0] + (a[0] - t[0]) / 6, c = n[1] + (a[1] - t[1]) / 6, l = a[0] - (o[0] - n[0]) / 6, u = a[1] - (o[1] - n[1]) / 6;
24
+ i += ` C ${I(s)} ${I(c)} ${I(l)} ${I(u)} ${I(a[0])} ${I(a[1])}`;
25
+ }
26
+ return i;
27
+ }
28
+ var be = (e) => e === "array", xe = (e) => e === "radial", L = (e) => e === "rings", Se = {
29
+ amp: .4,
30
+ freq: 2,
31
+ turns: 3,
32
+ radius: .72,
33
+ rows: 2,
34
+ cols: 3,
35
+ count: 12,
36
+ inner: .12,
37
+ spin: 1,
38
+ twist: .5,
39
+ grow: .6
40
+ };
41
+ function Ce(e, t, n, r = {}) {
42
+ let i = t / 2, a = n / 2, o = Math.min(t, n) * .12, s = r.amp ?? Se.amp, c = Math.max(1, Math.round(r.freq ?? Se.freq)), l = Math.max(1, Math.round(r.turns ?? Se.turns)), u = r.radius ?? Se.radius;
43
+ switch (e) {
44
+ case "arc": {
45
+ let e = n * .62, r = e - s * n * .7;
46
+ return {
47
+ d: `M ${I(o)} ${I(e)} Q ${I(i)} ${I(r)} ${I(t - o)} ${I(e)}`,
48
+ closed: !1
49
+ };
50
+ }
51
+ case "circle": {
52
+ let e = Math.min(t, n) * .5 * u;
53
+ return {
54
+ d: `M ${I(i - e)} ${I(a)} A ${I(e)} ${I(e)} 0 1 1 ${I(i + e)} ${I(a)} A ${I(e)} ${I(e)} 0 1 1 ${I(i - e)} ${I(a)} Z`,
55
+ closed: !0
56
+ };
57
+ }
58
+ case "ellipse": {
59
+ let e = (t * .5 - o) * u, r = (n * .5 - o) * u;
60
+ return {
61
+ d: `M ${I(i - e)} ${I(a)} A ${I(e)} ${I(r)} 0 1 1 ${I(i + e)} ${I(a)} A ${I(e)} ${I(r)} 0 1 1 ${I(i - e)} ${I(a)} Z`,
62
+ closed: !0
63
+ };
64
+ }
65
+ case "sine": {
66
+ let e = [];
67
+ for (let r = 0; r <= 120; r++) {
68
+ let i = r / 120;
69
+ e.push([o + i * (t - 2 * o), a + s * n * .32 * Math.sin(i * c * ge)]);
70
+ }
71
+ return {
72
+ d: _e(e),
73
+ closed: !1
74
+ };
75
+ }
76
+ case "spiral": {
77
+ let e = Math.min(t, n) * .45 * u, r = [];
78
+ for (let t = 0; t <= 420; t++) {
79
+ let n = t / 420, o = n * l * ge, s = n * e;
80
+ r.push([i + Math.cos(o) * s, a + Math.sin(o) * s]);
81
+ }
82
+ return {
83
+ d: _e(r),
84
+ closed: !1
85
+ };
86
+ }
87
+ case "zigzag": {
88
+ let e = c * 2, r = [];
89
+ for (let i = 0; i <= e; i++) {
90
+ let c = i / e;
91
+ r.push([o + c * (t - 2 * o), a + (i % 2 == 0 ? -1 : 1) * s * n * .28]);
92
+ }
93
+ return {
94
+ d: _e(r),
95
+ closed: !1
96
+ };
97
+ }
98
+ case "custom": return {
99
+ d: ye(Array.isArray(r.points) && r.points.length >= 2 ? r.points : ve, t, n),
100
+ closed: !1
101
+ };
102
+ default: {
103
+ let e = a + (r.offset || 0) * n;
104
+ return {
105
+ d: `M ${I(o)} ${I(e)} L ${I(t - o)} ${I(e)}`,
106
+ closed: !1
107
+ };
108
+ }
109
+ }
110
+ }
111
+ //#endregion
112
+ //#region src/kinetic/presets.js
113
+ var we = "#0b0d12", Te = "#e8e4dc", R = {
114
+ text: "Kinetic",
115
+ font: "gullhamrar",
116
+ fontSize: 120,
117
+ fill: "#e8e4dc",
118
+ italic: !1,
119
+ case: "none",
120
+ letterSpacing: 0,
121
+ align: "center",
122
+ multiply: 1,
123
+ group: null,
124
+ flow: "flow",
125
+ offset: {
126
+ x: 0,
127
+ y: 0
128
+ },
129
+ phase: 0,
130
+ stagger: 0,
131
+ vf: {},
132
+ opentype: {},
133
+ showPath: !1,
134
+ path: {
135
+ type: "line",
136
+ ...Se
137
+ },
138
+ motion: {
139
+ mode: "none",
140
+ cycles: 1,
141
+ phase: .5,
142
+ amp: .3,
143
+ axis: "wght",
144
+ field: "x"
145
+ },
146
+ motions: [],
147
+ morph: {
148
+ on: !1,
149
+ mode: "morph",
150
+ vf2: {},
151
+ face2: "",
152
+ curve: "flat",
153
+ blend: .5,
154
+ cp1: {
155
+ x: .33,
156
+ y: .33
157
+ },
158
+ cp2: {
159
+ x: .66,
160
+ y: .66
161
+ }
162
+ }
163
+ };
164
+ function Ee(e, t = {}) {
165
+ let n = y(e), r = E(n);
166
+ for (let e of n.axes) t[e.tag] != null && (r[e.tag] = t[e.tag]);
167
+ return r;
168
+ }
169
+ function De(e = {}, t = 0) {
170
+ let n = {
171
+ id: e.id || `i${t}`,
172
+ ...R,
173
+ ...e,
174
+ path: {
175
+ ...R.path,
176
+ ...e.path || {}
177
+ },
178
+ motion: {
179
+ ...R.motion,
180
+ ...e.motion || {}
181
+ },
182
+ motions: Array.isArray(e.motions) ? e.motions.map((e) => ({
183
+ ...R.motion,
184
+ ...e
185
+ })) : [],
186
+ offset: {
187
+ ...R.offset,
188
+ ...e.offset || {}
189
+ },
190
+ opentype: { ...e.opentype || {} },
191
+ morph: {
192
+ ...R.morph,
193
+ ...e.morph || {},
194
+ vf2: { ...e.morph?.vf2 || {} }
195
+ }
196
+ };
197
+ return n.vf = Ee(n.font, e.vf), n;
198
+ }
199
+ var z = (e) => ({
200
+ bg: we,
201
+ instances: [De({
202
+ font: "rot",
203
+ fill: Te,
204
+ ...e
205
+ }, 0)]
206
+ }), Oe = "#16202E", B = (...e) => ({
207
+ bg: Oe,
208
+ instances: e.map((e, t) => De(e, t))
209
+ }), ke = (e, ...t) => ({
210
+ bg: e,
211
+ instances: t.map((e, t) => De(e, t))
212
+ }), V = [
213
+ {
214
+ id: "sunburst",
215
+ label: "Sunburst",
216
+ sub: "Radial",
217
+ comp: z({
218
+ text: "Without a soul, is it a place?",
219
+ fontSize: 26,
220
+ vf: {
221
+ wdth: 100,
222
+ wght: 500
223
+ },
224
+ path: {
225
+ type: "radial",
226
+ count: 14,
227
+ inner: .1,
228
+ spin: 1
229
+ }
230
+ })
231
+ },
232
+ {
233
+ id: "dense-burst",
234
+ label: "Dense burst",
235
+ sub: "Radial",
236
+ comp: z({
237
+ text: "is it a place",
238
+ fontSize: 30,
239
+ vf: {
240
+ wdth: 90,
241
+ wght: 600
242
+ },
243
+ path: {
244
+ type: "radial",
245
+ count: 28,
246
+ inner: .06,
247
+ spin: 1
248
+ }
249
+ })
250
+ },
251
+ {
252
+ id: "double-twirl",
253
+ label: "Double twirl",
254
+ sub: "Radial",
255
+ comp: z({
256
+ text: "turning and turning",
257
+ fontSize: 24,
258
+ font: "malromur",
259
+ vf: { wght: 500 },
260
+ path: {
261
+ type: "radial",
262
+ count: 18,
263
+ inner: .12,
264
+ spin: 2
265
+ }
266
+ })
267
+ },
268
+ {
269
+ id: "pulse-burst",
270
+ label: "Pulse burst",
271
+ sub: "Radial",
272
+ comp: z({
273
+ text: "breathe in, breathe out",
274
+ fontSize: 26,
275
+ font: "gullhamrar",
276
+ vf: { wght: 600 },
277
+ path: {
278
+ type: "radial",
279
+ count: 16,
280
+ inner: .1,
281
+ spin: 1
282
+ },
283
+ motion: {
284
+ mode: "cascade",
285
+ cycles: 2,
286
+ phase: .5
287
+ }
288
+ })
289
+ },
290
+ {
291
+ id: "vortex",
292
+ label: "Vortex",
293
+ sub: "Rings",
294
+ comp: z({
295
+ text: "Does a community make a place? ",
296
+ fontSize: 24,
297
+ vf: {
298
+ wdth: 100,
299
+ wght: 500
300
+ },
301
+ path: {
302
+ type: "rings",
303
+ count: 12,
304
+ inner: .1,
305
+ radius: .94,
306
+ spin: 1,
307
+ twist: .6,
308
+ grow: .8
309
+ }
310
+ })
311
+ },
312
+ {
313
+ id: "galaxy",
314
+ label: "Galaxy",
315
+ sub: "Rings",
316
+ comp: z({
317
+ text: "spiralling inward forever ",
318
+ fontSize: 22,
319
+ font: "malromur",
320
+ vf: { wght: 500 },
321
+ path: {
322
+ type: "rings",
323
+ count: 16,
324
+ inner: .05,
325
+ radius: .96,
326
+ spin: 1,
327
+ twist: 1.25,
328
+ grow: .9
329
+ }
330
+ })
331
+ },
332
+ {
333
+ id: "wide-rings",
334
+ label: "Wide rings",
335
+ sub: "Rings",
336
+ comp: z({
337
+ text: "around and around ",
338
+ fontSize: 28,
339
+ font: "gullhamrar",
340
+ vf: { wght: 600 },
341
+ path: {
342
+ type: "rings",
343
+ count: 8,
344
+ inner: .18,
345
+ radius: .92,
346
+ spin: 1,
347
+ twist: .3,
348
+ grow: 1.2
349
+ }
350
+ })
351
+ },
352
+ {
353
+ id: "orbit",
354
+ label: "Orbit",
355
+ sub: "Path",
356
+ comp: z({
357
+ text: "KOLKRABBI · REYKJAVIK · ",
358
+ fontSize: 40,
359
+ font: "malromur",
360
+ vf: { wght: 500 },
361
+ path: {
362
+ type: "circle",
363
+ radius: .82
364
+ },
365
+ motion: {
366
+ mode: "orbit",
367
+ cycles: 1
368
+ }
369
+ })
370
+ },
371
+ {
372
+ id: "spiral",
373
+ label: "Spiral",
374
+ sub: "Path",
375
+ comp: z({
376
+ text: "into the spiral we go ",
377
+ fontSize: 30,
378
+ vf: {
379
+ wdth: 100,
380
+ wght: 500
381
+ },
382
+ path: {
383
+ type: "spiral",
384
+ turns: 4,
385
+ radius: .95
386
+ },
387
+ motion: {
388
+ mode: "march",
389
+ cycles: 1
390
+ }
391
+ })
392
+ },
393
+ {
394
+ id: "template",
395
+ label: "Template",
396
+ sub: "Path",
397
+ comp: z({
398
+ text: "Type here",
399
+ fontSize: 160,
400
+ vf: {
401
+ wdth: 100,
402
+ wght: 600
403
+ }
404
+ })
405
+ },
406
+ {
407
+ id: "big-statement",
408
+ label: "Flood",
409
+ sub: "Scenes",
410
+ comp: B({
411
+ text: "BIG",
412
+ font: "rot",
413
+ fontSize: 220,
414
+ vf: {
415
+ wdth: 140,
416
+ wght: 100
417
+ },
418
+ fill: "#c2502e",
419
+ motion: {
420
+ mode: "vfwave",
421
+ axis: "wght",
422
+ cycles: 1,
423
+ phase: .5
424
+ }
425
+ })
426
+ },
427
+ {
428
+ id: "ring-and-word",
429
+ label: "Ring",
430
+ sub: "Scenes",
431
+ comp: B({
432
+ id: "a",
433
+ text: "KOLKRABBI · REYKJAVIK · ",
434
+ font: "malromur",
435
+ fontSize: 56,
436
+ vf: { wght: 500 },
437
+ fill: "#9ec1ff",
438
+ path: {
439
+ type: "circle",
440
+ radius: .86
441
+ },
442
+ motion: {
443
+ mode: "orbit",
444
+ cycles: 1
445
+ }
446
+ }, {
447
+ id: "b",
448
+ text: "KOL",
449
+ font: "gullhamrar",
450
+ fontSize: 180,
451
+ vf: { wght: 800 },
452
+ fill: "#e8e4dc",
453
+ path: { type: "line" }
454
+ })
455
+ },
456
+ {
457
+ id: "custom-s",
458
+ label: "Flow",
459
+ sub: "Scenes",
460
+ comp: B({
461
+ text: "freeform",
462
+ fontSize: 96,
463
+ vf: { wght: 600 },
464
+ path: { type: "custom" },
465
+ showPath: !0
466
+ })
467
+ },
468
+ {
469
+ id: "malromur-wave",
470
+ label: "Morph",
471
+ sub: "Scenes",
472
+ comp: B({
473
+ text: "Malromur",
474
+ font: "malromur",
475
+ fontSize: 132,
476
+ vf: { wght: 300 },
477
+ motion: {
478
+ mode: "vfwave",
479
+ axis: "wght",
480
+ cycles: 2,
481
+ phase: .5
482
+ }
483
+ })
484
+ },
485
+ {
486
+ id: "flag",
487
+ label: "Wave",
488
+ sub: "Scenes",
489
+ comp: B({
490
+ text: "flag",
491
+ font: "rot",
492
+ fontSize: 168,
493
+ vf: {
494
+ wdth: 120,
495
+ wght: 600
496
+ },
497
+ motion: {
498
+ mode: "glyphwave",
499
+ cycles: 1,
500
+ phase: .5,
501
+ amp: .5
502
+ }
503
+ })
504
+ },
505
+ {
506
+ id: "sweep-grid",
507
+ label: "Reveal",
508
+ sub: "Scenes",
509
+ comp: B({
510
+ text: "KOL",
511
+ font: "rot",
512
+ fontSize: 56,
513
+ vf: {
514
+ wdth: 90,
515
+ wght: 500
516
+ },
517
+ fill: "#7fd1ff",
518
+ path: {
519
+ type: "array",
520
+ rows: 4,
521
+ cols: 5
522
+ },
523
+ motion: {
524
+ mode: "sweep",
525
+ field: "diagonal",
526
+ cycles: 1,
527
+ amp: .3
528
+ }
529
+ })
530
+ },
531
+ {
532
+ id: "baseline",
533
+ label: "Baseline",
534
+ sub: "Elements",
535
+ comp: B({
536
+ text: "Typography",
537
+ fontSize: 120,
538
+ vf: { wght: 500 }
539
+ })
540
+ },
541
+ {
542
+ id: "arc-kinetic",
543
+ label: "Arcs",
544
+ sub: "Elements",
545
+ comp: B({
546
+ text: "Kinetic",
547
+ fontSize: 130,
548
+ vf: { wght: 600 },
549
+ path: {
550
+ type: "arc",
551
+ amp: .45
552
+ }
553
+ })
554
+ },
555
+ {
556
+ id: "ellipse-loop",
557
+ label: "Loops",
558
+ sub: "Elements",
559
+ comp: B({
560
+ text: "REYKJAVIK",
561
+ font: "rot",
562
+ fontSize: 78,
563
+ vf: {
564
+ wdth: 120,
565
+ wght: 600
566
+ },
567
+ path: {
568
+ type: "ellipse",
569
+ radius: .92
570
+ },
571
+ motion: { mode: "orbit" }
572
+ })
573
+ },
574
+ {
575
+ id: "zigzag",
576
+ label: "Angular",
577
+ sub: "Elements",
578
+ comp: B({
579
+ text: "ZIGZAG",
580
+ font: "malromur",
581
+ fontSize: 92,
582
+ vf: { wght: 700 },
583
+ path: {
584
+ type: "zigzag",
585
+ amp: .5,
586
+ freq: 3
587
+ }
588
+ })
589
+ },
590
+ {
591
+ id: "array-grid",
592
+ label: "Grid",
593
+ sub: "Elements",
594
+ comp: B({
595
+ text: "KOL",
596
+ fontSize: 64,
597
+ vf: { wght: 600 },
598
+ path: {
599
+ type: "array",
600
+ rows: 3,
601
+ cols: 4
602
+ }
603
+ })
604
+ },
605
+ {
606
+ id: "weight-pulse",
607
+ label: "Weight",
608
+ sub: "Elements",
609
+ comp: B({
610
+ text: "WEIGHT",
611
+ fontSize: 150,
612
+ vf: { wght: 300 },
613
+ motion: {
614
+ mode: "vfwave",
615
+ axis: "wght",
616
+ cycles: 1,
617
+ phase: .6
618
+ }
619
+ })
620
+ },
621
+ {
622
+ id: "rot-width",
623
+ label: "Width",
624
+ sub: "Elements",
625
+ comp: B({
626
+ text: "WIDTH",
627
+ font: "rot",
628
+ fontSize: 150,
629
+ vf: {
630
+ wdth: 64,
631
+ wght: 600
632
+ },
633
+ motion: {
634
+ mode: "vfwave",
635
+ axis: "wdth",
636
+ cycles: 1,
637
+ phase: .6
638
+ }
639
+ })
640
+ },
641
+ {
642
+ id: "cascade",
643
+ label: "Cascade",
644
+ sub: "Elements",
645
+ comp: B({
646
+ text: "CASCADE",
647
+ fontSize: 130,
648
+ vf: { wght: 600 },
649
+ motion: {
650
+ mode: "cascade",
651
+ cycles: 1,
652
+ phase: .6
653
+ }
654
+ })
655
+ },
656
+ {
657
+ id: "baseline-mono",
658
+ label: "Mono line",
659
+ sub: "Lines",
660
+ comp: B({
661
+ text: "monospace",
662
+ font: "rot",
663
+ fontSize: 110,
664
+ vf: {
665
+ wdth: 90,
666
+ wght: 500
667
+ },
668
+ fill: "#7fd1ff"
669
+ })
670
+ },
671
+ {
672
+ id: "baseline-light",
673
+ label: "On paper",
674
+ sub: "Lines",
675
+ comp: ke("#f4f1ea", {
676
+ text: "Reykjavik",
677
+ font: "malromur",
678
+ fontSize: 130,
679
+ vf: { wght: 600 },
680
+ fill: "#0b0b0e"
681
+ })
682
+ },
683
+ {
684
+ id: "sine-flow",
685
+ label: "Sine flow",
686
+ sub: "Curves",
687
+ comp: B({
688
+ text: "wave along",
689
+ font: "rot",
690
+ fontSize: 96,
691
+ vf: {
692
+ wdth: 90,
693
+ wght: 500
694
+ },
695
+ path: {
696
+ type: "sine",
697
+ amp: .4,
698
+ freq: 2
699
+ },
700
+ motion: {
701
+ mode: "march",
702
+ cycles: 1
703
+ }
704
+ })
705
+ },
706
+ {
707
+ id: "spiral-in",
708
+ label: "Spiral",
709
+ sub: "Curves",
710
+ comp: B({
711
+ text: "spiral",
712
+ fontSize: 88,
713
+ vf: { wght: 700 },
714
+ path: {
715
+ type: "spiral",
716
+ turns: 3
717
+ }
718
+ })
719
+ },
720
+ {
721
+ id: "arc-march",
722
+ label: "Arc march",
723
+ sub: "Curves",
724
+ comp: B({
725
+ text: "on the arc",
726
+ font: "rot",
727
+ fontSize: 96,
728
+ vf: {
729
+ wdth: 100,
730
+ wght: 500
731
+ },
732
+ path: {
733
+ type: "arc",
734
+ amp: .5
735
+ },
736
+ motion: { mode: "march" }
737
+ })
738
+ },
739
+ {
740
+ id: "arc-up",
741
+ label: "High arc",
742
+ sub: "Curves",
743
+ comp: B({
744
+ text: "over the top",
745
+ font: "malromur",
746
+ fontSize: 92,
747
+ vf: { wght: 600 },
748
+ path: {
749
+ type: "arc",
750
+ amp: .7
751
+ }
752
+ })
753
+ },
754
+ {
755
+ id: "arc-wide",
756
+ label: "Wide arc",
757
+ sub: "Curves",
758
+ comp: B({
759
+ text: "WIDEARC",
760
+ font: "rot",
761
+ fontSize: 96,
762
+ vf: {
763
+ wdth: 150,
764
+ wght: 600
765
+ },
766
+ path: {
767
+ type: "arc",
768
+ amp: .4
769
+ }
770
+ })
771
+ },
772
+ {
773
+ id: "sine-fast",
774
+ label: "Fast wave",
775
+ sub: "Curves",
776
+ comp: B({
777
+ text: "up and down",
778
+ fontSize: 90,
779
+ vf: { wght: 600 },
780
+ path: {
781
+ type: "sine",
782
+ amp: .4,
783
+ freq: 3
784
+ },
785
+ motion: {
786
+ mode: "march",
787
+ cycles: 2
788
+ }
789
+ })
790
+ },
791
+ {
792
+ id: "sine-tall",
793
+ label: "Tall wave",
794
+ sub: "Curves",
795
+ comp: B({
796
+ text: "rolling",
797
+ font: "rot",
798
+ fontSize: 100,
799
+ vf: {
800
+ wdth: 90,
801
+ wght: 500
802
+ },
803
+ path: {
804
+ type: "sine",
805
+ amp: .6,
806
+ freq: 2
807
+ }
808
+ })
809
+ },
810
+ {
811
+ id: "spiral-march",
812
+ label: "Spiral march",
813
+ sub: "Curves",
814
+ comp: B({
815
+ text: "into the spiral",
816
+ font: "rot",
817
+ fontSize: 72,
818
+ vf: {
819
+ wdth: 100,
820
+ wght: 500
821
+ },
822
+ path: {
823
+ type: "spiral",
824
+ turns: 5
825
+ },
826
+ motion: {
827
+ mode: "march",
828
+ cycles: 1
829
+ }
830
+ })
831
+ },
832
+ {
833
+ id: "circle-orbit",
834
+ label: "Circle",
835
+ sub: "Closed",
836
+ comp: B({
837
+ text: "KOLKRABBI",
838
+ font: "malromur",
839
+ fontSize: 80,
840
+ vf: { wght: 500 },
841
+ path: {
842
+ type: "circle",
843
+ radius: .72
844
+ },
845
+ motion: {
846
+ mode: "orbit",
847
+ cycles: 1
848
+ }
849
+ })
850
+ },
851
+ {
852
+ id: "circle-big",
853
+ label: "Big circle",
854
+ sub: "Closed",
855
+ comp: B({
856
+ text: "AROUND WE GO",
857
+ fontSize: 76,
858
+ vf: { wght: 600 },
859
+ path: {
860
+ type: "circle",
861
+ radius: .85
862
+ },
863
+ motion: { mode: "orbit" }
864
+ })
865
+ },
866
+ {
867
+ id: "circle-mono",
868
+ label: "Mono circle",
869
+ sub: "Closed",
870
+ comp: B({
871
+ text: "LOOP/LOOP/",
872
+ font: "rot",
873
+ fontSize: 72,
874
+ vf: {
875
+ wdth: 90,
876
+ wght: 500
877
+ },
878
+ fill: "#f6c453",
879
+ path: {
880
+ type: "circle",
881
+ radius: .78
882
+ },
883
+ motion: { mode: "orbit" }
884
+ })
885
+ },
886
+ {
887
+ id: "ellipse-wide",
888
+ label: "Wide ellipse",
889
+ sub: "Closed",
890
+ comp: B({
891
+ text: "ELLIPTICAL",
892
+ font: "malromur",
893
+ fontSize: 74,
894
+ vf: { wght: 500 },
895
+ path: {
896
+ type: "ellipse",
897
+ radius: 1
898
+ },
899
+ motion: { mode: "orbit" }
900
+ })
901
+ },
902
+ {
903
+ id: "zigzag-fine",
904
+ label: "Fine zigzag",
905
+ sub: "Angular",
906
+ comp: B({
907
+ text: "sawtooth",
908
+ font: "rot",
909
+ fontSize: 80,
910
+ vf: {
911
+ wdth: 90,
912
+ wght: 600
913
+ },
914
+ path: {
915
+ type: "zigzag",
916
+ amp: .35,
917
+ freq: 5
918
+ }
919
+ })
920
+ },
921
+ {
922
+ id: "custom-march",
923
+ label: "Custom march",
924
+ sub: "Custom",
925
+ comp: B({
926
+ text: "follow me",
927
+ font: "rot",
928
+ fontSize: 90,
929
+ vf: {
930
+ wdth: 90,
931
+ wght: 500
932
+ },
933
+ path: { type: "custom" },
934
+ motion: { mode: "march" }
935
+ })
936
+ },
937
+ {
938
+ id: "ordspor-pulse",
939
+ label: "Ordspor",
940
+ sub: "Weight",
941
+ comp: B({
942
+ text: "Ordspor",
943
+ font: "rot",
944
+ fontSize: 132,
945
+ vf: {
946
+ wdth: 90,
947
+ wght: 300
948
+ },
949
+ motion: {
950
+ mode: "vfwave",
951
+ axis: "wght",
952
+ cycles: 1,
953
+ phase: .7
954
+ }
955
+ })
956
+ },
957
+ {
958
+ id: "rot-weight",
959
+ label: "Rot weight",
960
+ sub: "Weight",
961
+ comp: B({
962
+ text: "ROT",
963
+ font: "rot",
964
+ fontSize: 200,
965
+ vf: {
966
+ wdth: 120,
967
+ wght: 100
968
+ },
969
+ motion: {
970
+ mode: "vfwave",
971
+ axis: "wght",
972
+ cycles: 1,
973
+ phase: .5
974
+ }
975
+ })
976
+ },
977
+ {
978
+ id: "weight-slow",
979
+ label: "Slow weight",
980
+ sub: "Weight",
981
+ comp: B({
982
+ text: "breathe",
983
+ fontSize: 150,
984
+ vf: { wght: 300 },
985
+ motion: {
986
+ mode: "vfwave",
987
+ axis: "wght",
988
+ cycles: 1,
989
+ phase: .3
990
+ }
991
+ })
992
+ },
993
+ {
994
+ id: "weight-fast",
995
+ label: "Fast weight",
996
+ sub: "Weight",
997
+ comp: B({
998
+ text: "PULSE",
999
+ fontSize: 160,
1000
+ vf: { wght: 300 },
1001
+ motion: {
1002
+ mode: "vfwave",
1003
+ axis: "wght",
1004
+ cycles: 3,
1005
+ phase: .6
1006
+ }
1007
+ })
1008
+ },
1009
+ {
1010
+ id: "malromur-heavy",
1011
+ label: "Heavy swing",
1012
+ sub: "Weight",
1013
+ comp: ke("#f4f1ea", {
1014
+ text: "Malromur",
1015
+ font: "malromur",
1016
+ fontSize: 130,
1017
+ vf: { wght: 300 },
1018
+ fill: "#0b0b0e",
1019
+ motion: {
1020
+ mode: "vfwave",
1021
+ axis: "wght",
1022
+ cycles: 1,
1023
+ phase: .5
1024
+ }
1025
+ })
1026
+ },
1027
+ {
1028
+ id: "ordspor-wave2",
1029
+ label: "Ordspor ×2",
1030
+ sub: "Weight",
1031
+ comp: B({
1032
+ text: "twice",
1033
+ font: "rot",
1034
+ fontSize: 150,
1035
+ vf: {
1036
+ wdth: 90,
1037
+ wght: 300
1038
+ },
1039
+ motion: {
1040
+ mode: "vfwave",
1041
+ axis: "wght",
1042
+ cycles: 2,
1043
+ phase: .5
1044
+ }
1045
+ })
1046
+ },
1047
+ {
1048
+ id: "rot-weight2",
1049
+ label: "Rot weight ×2",
1050
+ sub: "Weight",
1051
+ comp: B({
1052
+ text: "ROT",
1053
+ font: "rot",
1054
+ fontSize: 200,
1055
+ vf: {
1056
+ wdth: 120,
1057
+ wght: 100
1058
+ },
1059
+ motion: {
1060
+ mode: "vfwave",
1061
+ axis: "wght",
1062
+ cycles: 2,
1063
+ phase: .4
1064
+ }
1065
+ })
1066
+ },
1067
+ {
1068
+ id: "malromur-bigwave",
1069
+ label: "Big wave",
1070
+ sub: "Weight",
1071
+ comp: B({
1072
+ text: "WEIGHT",
1073
+ font: "malromur",
1074
+ fontSize: 150,
1075
+ vf: { wght: 300 },
1076
+ fill: "#f6c453",
1077
+ motion: {
1078
+ mode: "vfwave",
1079
+ axis: "wght",
1080
+ cycles: 2,
1081
+ phase: .7
1082
+ }
1083
+ })
1084
+ },
1085
+ {
1086
+ id: "ordspor-accent",
1087
+ label: "Ordspor accent",
1088
+ sub: "Weight",
1089
+ comp: B({
1090
+ text: "Ordspor",
1091
+ font: "rot",
1092
+ fontSize: 140,
1093
+ vf: {
1094
+ wdth: 90,
1095
+ wght: 300
1096
+ },
1097
+ fill: "#8f5ad0",
1098
+ motion: {
1099
+ mode: "vfwave",
1100
+ axis: "wght",
1101
+ cycles: 1,
1102
+ phase: .6
1103
+ }
1104
+ })
1105
+ },
1106
+ {
1107
+ id: "rot-dual",
1108
+ label: "Variable",
1109
+ sub: "Width",
1110
+ comp: B({
1111
+ text: "variable",
1112
+ font: "rot",
1113
+ fontSize: 124,
1114
+ vf: {
1115
+ wdth: 100,
1116
+ wght: 400
1117
+ },
1118
+ motion: {
1119
+ mode: "vfwave",
1120
+ axis: "wdth",
1121
+ cycles: 2,
1122
+ phase: .4
1123
+ }
1124
+ })
1125
+ },
1126
+ {
1127
+ id: "rot-width-fast",
1128
+ label: "Width ×2",
1129
+ sub: "Width",
1130
+ comp: B({
1131
+ text: "STRETCH",
1132
+ font: "rot",
1133
+ fontSize: 130,
1134
+ vf: {
1135
+ wdth: 64,
1136
+ wght: 600
1137
+ },
1138
+ motion: {
1139
+ mode: "vfwave",
1140
+ axis: "wdth",
1141
+ cycles: 2,
1142
+ phase: .5
1143
+ }
1144
+ })
1145
+ },
1146
+ {
1147
+ id: "rot-width-slow",
1148
+ label: "Width slow",
1149
+ sub: "Width",
1150
+ comp: B({
1151
+ text: "expand",
1152
+ font: "rot",
1153
+ fontSize: 130,
1154
+ vf: {
1155
+ wdth: 100,
1156
+ wght: 500
1157
+ },
1158
+ motion: {
1159
+ mode: "vfwave",
1160
+ axis: "wdth",
1161
+ cycles: 1,
1162
+ phase: .3
1163
+ }
1164
+ })
1165
+ },
1166
+ {
1167
+ id: "morph-mtl",
1168
+ label: "Made to last",
1169
+ sub: "Morph",
1170
+ comp: B({
1171
+ text: "Made to last",
1172
+ font: "rot",
1173
+ fontSize: 150,
1174
+ vf: {
1175
+ wdth: 64,
1176
+ wght: 100
1177
+ },
1178
+ morph: {
1179
+ on: !0,
1180
+ mode: "morph",
1181
+ curve: "linear",
1182
+ blend: .5,
1183
+ vf2: {
1184
+ wdth: 172,
1185
+ wght: 900
1186
+ }
1187
+ }
1188
+ })
1189
+ },
1190
+ {
1191
+ id: "morph-wave",
1192
+ label: "Morph wave",
1193
+ sub: "Morph",
1194
+ comp: B({
1195
+ text: "MORPH",
1196
+ font: "rot",
1197
+ fontSize: 200,
1198
+ vf: {
1199
+ wdth: 64,
1200
+ wght: 200
1201
+ },
1202
+ morph: {
1203
+ on: !0,
1204
+ mode: "morph",
1205
+ curve: "sine",
1206
+ blend: .5,
1207
+ vf2: {
1208
+ wdth: 172,
1209
+ wght: 900
1210
+ }
1211
+ }
1212
+ })
1213
+ },
1214
+ {
1215
+ id: "morph-ease",
1216
+ label: "Heavy → light",
1217
+ sub: "Morph",
1218
+ comp: B({
1219
+ text: "gradient",
1220
+ font: "rot",
1221
+ fontSize: 150,
1222
+ vf: {
1223
+ wdth: 120,
1224
+ wght: 900
1225
+ },
1226
+ morph: {
1227
+ on: !0,
1228
+ mode: "morph",
1229
+ curve: "ease",
1230
+ blend: .5,
1231
+ vf2: {
1232
+ wdth: 120,
1233
+ wght: 100
1234
+ }
1235
+ }
1236
+ })
1237
+ },
1238
+ {
1239
+ id: "morph-random",
1240
+ label: "Ransom note",
1241
+ sub: "Morph",
1242
+ comp: B({
1243
+ text: "CHAOS",
1244
+ font: "rot",
1245
+ fontSize: 170,
1246
+ vf: {
1247
+ wdth: 100,
1248
+ wght: 500
1249
+ },
1250
+ morph: {
1251
+ on: !0,
1252
+ mode: "random",
1253
+ blend: .37
1254
+ }
1255
+ })
1256
+ },
1257
+ {
1258
+ id: "morph-fade",
1259
+ label: "Fade A↔B",
1260
+ sub: "Morph",
1261
+ comp: B({
1262
+ text: "between",
1263
+ font: "gullhamrar",
1264
+ fontSize: 150,
1265
+ vf: { wght: 300 },
1266
+ morph: {
1267
+ on: !0,
1268
+ mode: "fade",
1269
+ blend: .5,
1270
+ vf2: { wght: 900 }
1271
+ }
1272
+ })
1273
+ },
1274
+ {
1275
+ id: "morph-cross",
1276
+ label: "Cross-face",
1277
+ sub: "Morph",
1278
+ comp: B({
1279
+ text: "hybrid",
1280
+ font: "rot",
1281
+ fontSize: 150,
1282
+ vf: {
1283
+ wdth: 100,
1284
+ wght: 600
1285
+ },
1286
+ morph: {
1287
+ on: !0,
1288
+ mode: "morph",
1289
+ blend: .5,
1290
+ face2: "gullhamrar"
1291
+ }
1292
+ })
1293
+ },
1294
+ {
1295
+ id: "arc-weight",
1296
+ label: "Morph on arc",
1297
+ sub: "On path",
1298
+ comp: B({
1299
+ text: "morph",
1300
+ fontSize: 120,
1301
+ path: {
1302
+ type: "arc",
1303
+ amp: .3
1304
+ },
1305
+ motion: {
1306
+ mode: "vfwave",
1307
+ axis: "wght",
1308
+ cycles: 1,
1309
+ phase: .6
1310
+ }
1311
+ })
1312
+ },
1313
+ {
1314
+ id: "sine-weight",
1315
+ label: "Wave + weight",
1316
+ sub: "On path",
1317
+ comp: B({
1318
+ text: "modulated",
1319
+ fontSize: 92,
1320
+ vf: { wght: 400 },
1321
+ path: {
1322
+ type: "sine",
1323
+ amp: .3,
1324
+ freq: 2
1325
+ },
1326
+ motion: {
1327
+ mode: "vfwave",
1328
+ axis: "wght",
1329
+ cycles: 1,
1330
+ phase: .5
1331
+ }
1332
+ })
1333
+ },
1334
+ {
1335
+ id: "circle-weight",
1336
+ label: "Ring + weight",
1337
+ sub: "On path",
1338
+ comp: B({
1339
+ text: "ROTATING",
1340
+ font: "malromur",
1341
+ fontSize: 78,
1342
+ vf: { wght: 300 },
1343
+ path: {
1344
+ type: "circle",
1345
+ radius: .74
1346
+ },
1347
+ motion: {
1348
+ mode: "vfwave",
1349
+ axis: "wght",
1350
+ cycles: 2,
1351
+ phase: .6
1352
+ }
1353
+ })
1354
+ },
1355
+ {
1356
+ id: "arc-width",
1357
+ label: "Arc + width",
1358
+ sub: "On path",
1359
+ comp: B({
1360
+ text: "arcwidth",
1361
+ font: "rot",
1362
+ fontSize: 96,
1363
+ vf: {
1364
+ wdth: 80,
1365
+ wght: 600
1366
+ },
1367
+ path: {
1368
+ type: "arc",
1369
+ amp: .4
1370
+ },
1371
+ motion: {
1372
+ mode: "vfwave",
1373
+ axis: "wdth",
1374
+ cycles: 1,
1375
+ phase: .5
1376
+ }
1377
+ })
1378
+ },
1379
+ {
1380
+ id: "pop",
1381
+ label: "Pop",
1382
+ sub: "Reveal",
1383
+ comp: B({
1384
+ text: "POP POP",
1385
+ fontSize: 130,
1386
+ vf: { wght: 800 },
1387
+ motion: {
1388
+ mode: "cascade",
1389
+ cycles: 2,
1390
+ phase: .8
1391
+ }
1392
+ })
1393
+ },
1394
+ {
1395
+ id: "arc-cascade",
1396
+ label: "Curve cascade",
1397
+ sub: "Reveal",
1398
+ comp: B({
1399
+ text: "on a curve",
1400
+ font: "rot",
1401
+ fontSize: 100,
1402
+ vf: {
1403
+ wdth: 90,
1404
+ wght: 500
1405
+ },
1406
+ path: {
1407
+ type: "arc",
1408
+ amp: .4
1409
+ },
1410
+ motion: {
1411
+ mode: "cascade",
1412
+ cycles: 1,
1413
+ phase: .5
1414
+ }
1415
+ })
1416
+ },
1417
+ {
1418
+ id: "cascade-slow",
1419
+ label: "Slow cascade",
1420
+ sub: "Reveal",
1421
+ comp: B({
1422
+ text: "unfold",
1423
+ fontSize: 130,
1424
+ vf: { wght: 600 },
1425
+ motion: {
1426
+ mode: "cascade",
1427
+ cycles: 1,
1428
+ phase: .4
1429
+ }
1430
+ })
1431
+ },
1432
+ {
1433
+ id: "cascade-fast",
1434
+ label: "Fast cascade",
1435
+ sub: "Reveal",
1436
+ comp: B({
1437
+ text: "flicker",
1438
+ fontSize: 130,
1439
+ vf: { wght: 700 },
1440
+ motion: {
1441
+ mode: "cascade",
1442
+ cycles: 2,
1443
+ phase: .7
1444
+ }
1445
+ })
1446
+ },
1447
+ {
1448
+ id: "typewriter",
1449
+ label: "Typewriter",
1450
+ sub: "Reveal",
1451
+ comp: B({
1452
+ text: "type_type_",
1453
+ font: "rot",
1454
+ fontSize: 100,
1455
+ vf: {
1456
+ wdth: 90,
1457
+ wght: 500
1458
+ },
1459
+ fill: "#7fd1ff",
1460
+ motion: {
1461
+ mode: "cascade",
1462
+ cycles: 1,
1463
+ phase: 1
1464
+ }
1465
+ })
1466
+ },
1467
+ {
1468
+ id: "spiral-cascade",
1469
+ label: "Spiral reveal",
1470
+ sub: "Reveal",
1471
+ comp: B({
1472
+ text: "spiral down",
1473
+ fontSize: 74,
1474
+ vf: { wght: 600 },
1475
+ path: {
1476
+ type: "spiral",
1477
+ turns: 3
1478
+ },
1479
+ motion: {
1480
+ mode: "cascade",
1481
+ cycles: 1,
1482
+ phase: .5
1483
+ }
1484
+ })
1485
+ },
1486
+ {
1487
+ id: "circle-cascade",
1488
+ label: "Ring reveal",
1489
+ sub: "Reveal",
1490
+ comp: B({
1491
+ text: "AROUND",
1492
+ font: "malromur",
1493
+ fontSize: 86,
1494
+ vf: { wght: 600 },
1495
+ path: {
1496
+ type: "circle",
1497
+ radius: .74
1498
+ },
1499
+ motion: {
1500
+ mode: "cascade",
1501
+ cycles: 1,
1502
+ phase: .6
1503
+ }
1504
+ })
1505
+ },
1506
+ {
1507
+ id: "pop-mono",
1508
+ label: "Mono pop",
1509
+ sub: "Reveal",
1510
+ comp: B({
1511
+ text: "POP.POP.",
1512
+ font: "rot",
1513
+ fontSize: 110,
1514
+ vf: {
1515
+ wdth: 90,
1516
+ wght: 500
1517
+ },
1518
+ fill: "#f6c453",
1519
+ motion: {
1520
+ mode: "cascade",
1521
+ cycles: 2,
1522
+ phase: .8
1523
+ }
1524
+ })
1525
+ },
1526
+ {
1527
+ id: "glyph-wave",
1528
+ label: "Ripple",
1529
+ sub: "Wave",
1530
+ comp: B({
1531
+ text: "ripple",
1532
+ font: "malromur",
1533
+ fontSize: 140,
1534
+ vf: { wght: 600 },
1535
+ motion: {
1536
+ mode: "glyphwave",
1537
+ cycles: 1,
1538
+ phase: .6,
1539
+ amp: .4
1540
+ }
1541
+ })
1542
+ },
1543
+ {
1544
+ id: "sine-ripple",
1545
+ label: "Sine ripple",
1546
+ sub: "Wave",
1547
+ comp: B({
1548
+ text: "wavewave",
1549
+ font: "rot",
1550
+ fontSize: 108,
1551
+ vf: {
1552
+ wdth: 110,
1553
+ wght: 600
1554
+ },
1555
+ path: {
1556
+ type: "sine",
1557
+ amp: .3,
1558
+ freq: 2
1559
+ },
1560
+ motion: {
1561
+ mode: "glyphwave",
1562
+ amp: .3
1563
+ }
1564
+ })
1565
+ },
1566
+ {
1567
+ id: "glyph-big",
1568
+ label: "Big ripple",
1569
+ sub: "Wave",
1570
+ comp: B({
1571
+ text: "WAVES",
1572
+ fontSize: 150,
1573
+ vf: { wght: 700 },
1574
+ motion: {
1575
+ mode: "glyphwave",
1576
+ cycles: 1,
1577
+ phase: .6,
1578
+ amp: .6
1579
+ }
1580
+ })
1581
+ },
1582
+ {
1583
+ id: "glyph-fast",
1584
+ label: "Fast ripple",
1585
+ sub: "Wave",
1586
+ comp: B({
1587
+ text: "shiver",
1588
+ font: "malromur",
1589
+ fontSize: 140,
1590
+ vf: { wght: 600 },
1591
+ motion: {
1592
+ mode: "glyphwave",
1593
+ cycles: 2,
1594
+ phase: .5,
1595
+ amp: .35
1596
+ }
1597
+ })
1598
+ },
1599
+ {
1600
+ id: "arc-glyphwave",
1601
+ label: "Arc ripple",
1602
+ sub: "Wave",
1603
+ comp: B({
1604
+ text: "on a curve",
1605
+ font: "rot",
1606
+ fontSize: 96,
1607
+ vf: {
1608
+ wdth: 90,
1609
+ wght: 500
1610
+ },
1611
+ path: {
1612
+ type: "arc",
1613
+ amp: .4
1614
+ },
1615
+ motion: {
1616
+ mode: "glyphwave",
1617
+ amp: .3
1618
+ }
1619
+ })
1620
+ },
1621
+ {
1622
+ id: "rot-flag-fast",
1623
+ label: "Rot flag",
1624
+ sub: "Wave",
1625
+ comp: B({
1626
+ text: "flutter",
1627
+ font: "rot",
1628
+ fontSize: 150,
1629
+ vf: {
1630
+ wdth: 120,
1631
+ wght: 600
1632
+ },
1633
+ motion: {
1634
+ mode: "glyphwave",
1635
+ cycles: 2,
1636
+ phase: .5,
1637
+ amp: .5
1638
+ }
1639
+ })
1640
+ },
1641
+ {
1642
+ id: "sine-ripple2",
1643
+ label: "Sine flutter",
1644
+ sub: "Wave",
1645
+ comp: B({
1646
+ text: "flowflow",
1647
+ font: "rot",
1648
+ fontSize: 100,
1649
+ vf: {
1650
+ wdth: 90,
1651
+ wght: 500
1652
+ },
1653
+ path: {
1654
+ type: "sine",
1655
+ amp: .3,
1656
+ freq: 2
1657
+ },
1658
+ motion: {
1659
+ mode: "glyphwave",
1660
+ cycles: 2,
1661
+ amp: .3
1662
+ }
1663
+ })
1664
+ },
1665
+ {
1666
+ id: "sweep-x",
1667
+ label: "Sweep X",
1668
+ sub: "Sweep",
1669
+ comp: B({
1670
+ text: "SWEEP",
1671
+ fontSize: 150,
1672
+ vf: { wght: 700 },
1673
+ motion: {
1674
+ mode: "sweep",
1675
+ field: "x",
1676
+ cycles: 1,
1677
+ amp: .3
1678
+ }
1679
+ })
1680
+ },
1681
+ {
1682
+ id: "sweep-y",
1683
+ label: "Sweep Y",
1684
+ sub: "Sweep",
1685
+ comp: B({
1686
+ text: "descend",
1687
+ font: "rot",
1688
+ fontSize: 130,
1689
+ vf: {
1690
+ wdth: 90,
1691
+ wght: 500
1692
+ },
1693
+ motion: {
1694
+ mode: "sweep",
1695
+ field: "y",
1696
+ cycles: 1,
1697
+ amp: .35
1698
+ }
1699
+ })
1700
+ },
1701
+ {
1702
+ id: "sweep-radial",
1703
+ label: "Radial pulse",
1704
+ sub: "Sweep",
1705
+ comp: B({
1706
+ text: "PULSE",
1707
+ font: "malromur",
1708
+ fontSize: 140,
1709
+ vf: { wght: 600 },
1710
+ motion: {
1711
+ mode: "sweep",
1712
+ field: "radial",
1713
+ cycles: 1,
1714
+ amp: .4
1715
+ }
1716
+ })
1717
+ },
1718
+ {
1719
+ id: "sweep-weight",
1720
+ label: "Sweep weight",
1721
+ sub: "Sweep",
1722
+ comp: B({
1723
+ text: "WEIGHT",
1724
+ fontSize: 150,
1725
+ vf: { wght: 300 },
1726
+ motion: {
1727
+ mode: "sweepWeight",
1728
+ field: "x",
1729
+ cycles: 1,
1730
+ amp: .4
1731
+ }
1732
+ })
1733
+ },
1734
+ {
1735
+ id: "sweep-shift",
1736
+ label: "Sweep shift",
1737
+ sub: "Sweep",
1738
+ comp: B({
1739
+ text: "shiver",
1740
+ font: "rot",
1741
+ fontSize: 130,
1742
+ vf: {
1743
+ wdth: 110,
1744
+ wght: 600
1745
+ },
1746
+ motion: {
1747
+ mode: "sweepShift",
1748
+ field: "wave",
1749
+ cycles: 1,
1750
+ amp: .3
1751
+ }
1752
+ })
1753
+ },
1754
+ {
1755
+ id: "orbit-spin",
1756
+ label: "Orbit",
1757
+ sub: "Orbit",
1758
+ comp: B({
1759
+ text: "ORBIT",
1760
+ font: "malromur",
1761
+ fontSize: 88,
1762
+ vf: { wght: 600 },
1763
+ path: {
1764
+ type: "circle",
1765
+ radius: .7
1766
+ },
1767
+ motion: {
1768
+ mode: "orbit",
1769
+ cycles: 1
1770
+ }
1771
+ })
1772
+ },
1773
+ {
1774
+ id: "orbit-fast",
1775
+ label: "Fast orbit",
1776
+ sub: "Orbit",
1777
+ comp: B({
1778
+ text: "spinning",
1779
+ fontSize: 84,
1780
+ vf: { wght: 600 },
1781
+ path: {
1782
+ type: "circle",
1783
+ radius: .72
1784
+ },
1785
+ motion: {
1786
+ mode: "orbit",
1787
+ cycles: 2
1788
+ }
1789
+ })
1790
+ },
1791
+ {
1792
+ id: "ellipse-orbit",
1793
+ label: "Ellipse orbit",
1794
+ sub: "Orbit",
1795
+ comp: B({
1796
+ text: "ORBITAL",
1797
+ font: "rot",
1798
+ fontSize: 78,
1799
+ vf: {
1800
+ wdth: 110,
1801
+ wght: 600
1802
+ },
1803
+ path: {
1804
+ type: "ellipse",
1805
+ radius: .95
1806
+ },
1807
+ motion: {
1808
+ mode: "orbit",
1809
+ cycles: 1
1810
+ }
1811
+ })
1812
+ },
1813
+ {
1814
+ id: "array-pulse",
1815
+ label: "Grid pulse",
1816
+ sub: "Array",
1817
+ comp: B({
1818
+ text: "NODE",
1819
+ font: "rot",
1820
+ fontSize: 44,
1821
+ vf: {
1822
+ wdth: 90,
1823
+ wght: 500
1824
+ },
1825
+ fill: "#7fd1ff",
1826
+ path: {
1827
+ type: "array",
1828
+ rows: 4,
1829
+ cols: 5
1830
+ },
1831
+ motion: {
1832
+ mode: "cascade",
1833
+ cycles: 1,
1834
+ phase: .5
1835
+ }
1836
+ })
1837
+ },
1838
+ {
1839
+ id: "array-wave",
1840
+ label: "Grid wave",
1841
+ sub: "Array",
1842
+ comp: B({
1843
+ text: "echo",
1844
+ font: "rot",
1845
+ fontSize: 52,
1846
+ vf: {
1847
+ wdth: 90,
1848
+ wght: 500
1849
+ },
1850
+ path: {
1851
+ type: "array",
1852
+ rows: 3,
1853
+ cols: 3
1854
+ },
1855
+ motion: {
1856
+ mode: "glyphwave",
1857
+ cycles: 1,
1858
+ phase: .7,
1859
+ amp: .4
1860
+ }
1861
+ })
1862
+ },
1863
+ {
1864
+ id: "array-weight",
1865
+ label: "Grid weight",
1866
+ sub: "Array",
1867
+ comp: B({
1868
+ text: "OK",
1869
+ font: "rot",
1870
+ fontSize: 88,
1871
+ vf: {
1872
+ wdth: 100,
1873
+ wght: 200
1874
+ },
1875
+ path: {
1876
+ type: "array",
1877
+ rows: 2,
1878
+ cols: 3
1879
+ },
1880
+ motion: {
1881
+ mode: "vfwave",
1882
+ axis: "wght",
1883
+ cycles: 1,
1884
+ phase: .6
1885
+ }
1886
+ })
1887
+ },
1888
+ {
1889
+ id: "stacked",
1890
+ label: "Stacked",
1891
+ sub: "Composite",
1892
+ comp: B({
1893
+ id: "a",
1894
+ text: "KINETIC",
1895
+ font: "gullhamrar",
1896
+ fontSize: 130,
1897
+ vf: { wght: 700 },
1898
+ fill: "#e8e4dc",
1899
+ path: {
1900
+ type: "line",
1901
+ offset: -.16
1902
+ }
1903
+ }, {
1904
+ id: "b",
1905
+ text: "typography",
1906
+ font: "rot",
1907
+ fontSize: 90,
1908
+ vf: {
1909
+ wdth: 90,
1910
+ wght: 400
1911
+ },
1912
+ fill: "#f6c453",
1913
+ path: {
1914
+ type: "line",
1915
+ offset: .16
1916
+ },
1917
+ motion: {
1918
+ mode: "vfwave",
1919
+ axis: "wght",
1920
+ cycles: 1,
1921
+ phase: .5
1922
+ }
1923
+ })
1924
+ },
1925
+ {
1926
+ id: "grid-and-ring",
1927
+ label: "Grid + ring",
1928
+ sub: "Composite",
1929
+ comp: ke("#0a0b14", {
1930
+ id: "a",
1931
+ text: "echo",
1932
+ font: "rot",
1933
+ fontSize: 40,
1934
+ vf: {
1935
+ wdth: 90,
1936
+ wght: 500
1937
+ },
1938
+ fill: "#3a4a6a",
1939
+ path: {
1940
+ type: "array",
1941
+ rows: 4,
1942
+ cols: 5
1943
+ }
1944
+ }, {
1945
+ id: "b",
1946
+ text: "SIGNAL · SIGNAL · ",
1947
+ font: "rot",
1948
+ fontSize: 60,
1949
+ vf: {
1950
+ wdth: 110,
1951
+ wght: 600
1952
+ },
1953
+ fill: "#9ec1ff",
1954
+ path: {
1955
+ type: "circle",
1956
+ radius: .7
1957
+ },
1958
+ motion: {
1959
+ mode: "orbit",
1960
+ cycles: 1
1961
+ }
1962
+ })
1963
+ }
1964
+ ], Ae = (e) => V.find((t) => t.id === e) || V[0], je = [
1965
+ "Radial",
1966
+ "Rings",
1967
+ "Path"
1968
+ ], Me = [{
1969
+ label: "Type",
1970
+ subs: je
1971
+ }, {
1972
+ label: "Kinetic",
1973
+ subs: [...new Set(V.map((e) => e.sub))].filter((e) => !je.includes(e))
1974
+ }], Ne = (e) => structuredClone(e.comp), H = {
1975
+ dLen: 0,
1976
+ dNormal: 0,
1977
+ scale: 1,
1978
+ dRot: 0,
1979
+ opacity: 1,
1980
+ vf: null
1981
+ }, Pe = {
1982
+ none: () => H,
1983
+ march: (e) => ({
1984
+ ...H,
1985
+ dLen: e.u * e.pathLen * Math.max(1, Math.round(e.m.cycles || 1))
1986
+ }),
1987
+ orbit: (e) => ({
1988
+ ...H,
1989
+ dLen: e.u * e.pathLen * Math.max(1, Math.round(e.m.cycles || 1))
1990
+ }),
1991
+ vfwave: (e) => {
1992
+ let t = Math.max(1, Math.round(e.m.cycles || 1)), n = .5 + .5 * Math.sin(e.u * x * t - e.i * (e.m.phase ?? .5));
1993
+ return {
1994
+ ...H,
1995
+ vf: { [e.axisTag]: D(e.axisMin, e.axisMax, n) }
1996
+ };
1997
+ },
1998
+ glyphwave: (e) => {
1999
+ let t = Math.max(1, Math.round(e.m.cycles || 1)), n = Math.sin(e.u * x * t - e.i * (e.m.phase ?? .5));
2000
+ return {
2001
+ ...H,
2002
+ dNormal: (e.m.amp ?? .3) * e.sizePx * n
2003
+ };
2004
+ },
2005
+ cascade: (e) => {
2006
+ let t = Math.max(1, Math.round(e.m.cycles || 1)), n = .5 + .5 * Math.sin(e.u * x * t - e.i * (e.m.phase ?? .6));
2007
+ return {
2008
+ ...H,
2009
+ scale: D(.25, 1, n),
2010
+ opacity: D(.15, 1, n)
2011
+ };
2012
+ },
2013
+ sweep: (e) => {
2014
+ let t = Re(e);
2015
+ return {
2016
+ ...H,
2017
+ scale: D(.25, 1, t),
2018
+ opacity: D(.12, 1, t)
2019
+ };
2020
+ },
2021
+ sweepWeight: (e) => {
2022
+ let t = Re(e);
2023
+ return {
2024
+ ...H,
2025
+ vf: { [e.axisTag]: D(e.axisMin, e.axisMax, t) }
2026
+ };
2027
+ },
2028
+ sweepShift: (e) => {
2029
+ let t = Re(e);
2030
+ return {
2031
+ ...H,
2032
+ dNormal: t * .6 * e.sizePx
2033
+ };
2034
+ }
2035
+ }, Fe = (e) => e - Math.floor(e);
2036
+ function Ie(e, t) {
2037
+ if (t <= 0) return 0;
2038
+ let n = Math.min(1, e / t);
2039
+ return 1 - n * n * (3 - 2 * n);
2040
+ }
2041
+ function Le(e, t, n, r, i, a) {
2042
+ let o = Fe(r * i), s = Math.max(.02, a * .5), c = (e) => {
2043
+ let t = Math.abs(Fe(e) - o);
2044
+ return Ie(Math.min(t, 1 - t), s);
2045
+ };
2046
+ switch (e) {
2047
+ case "y": return c(n);
2048
+ case "diagonal": return c(.5 + (t - .5) * .7071 + (n - .5) * .7071);
2049
+ case "radial": return c(Math.hypot(t - .5, n - .5) / .7071);
2050
+ case "angular": return c(Math.atan2(n - .5, t - .5) / x + .5);
2051
+ case "wave": {
2052
+ let e = Math.max(1, Math.round(1 + (1 - a) * 6));
2053
+ return .5 + .5 * Math.sin((t * e - r * i) * x);
2054
+ }
2055
+ default: return c(t);
2056
+ }
2057
+ }
2058
+ var Re = (e) => Le(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);
2059
+ function ze(e, t) {
2060
+ return (Pe[e] || Pe.none)(t);
2061
+ }
2062
+ //#endregion
2063
+ //#region src/kinetic/features.js
2064
+ var Be = [
2065
+ {
2066
+ tag: "liga",
2067
+ label: "Ligatures"
2068
+ },
2069
+ {
2070
+ tag: "dlig",
2071
+ label: "Discretionary ligatures"
2072
+ },
2073
+ {
2074
+ tag: "smcp",
2075
+ label: "Small caps"
2076
+ },
2077
+ {
2078
+ tag: "case",
2079
+ label: "Case-sensitive forms"
2080
+ },
2081
+ {
2082
+ tag: "onum",
2083
+ label: "Oldstyle figures"
2084
+ },
2085
+ {
2086
+ tag: "tnum",
2087
+ label: "Tabular figures"
2088
+ },
2089
+ {
2090
+ tag: "frac",
2091
+ label: "Fractions"
2092
+ },
2093
+ {
2094
+ tag: "swsh",
2095
+ label: "Swashes"
2096
+ },
2097
+ {
2098
+ tag: "ss01",
2099
+ label: "Stylistic set 1"
2100
+ },
2101
+ {
2102
+ tag: "ss02",
2103
+ label: "Stylistic set 2"
2104
+ }
2105
+ ];
2106
+ function Ve(e) {
2107
+ if (!e) return "normal";
2108
+ let t = [];
2109
+ for (let [n, r] of Object.entries(e)) t.push(`"${n}" ${+!!r}`);
2110
+ return t.length ? t.join(", ") : "normal";
2111
+ }
2112
+ //#endregion
2113
+ //#region src/kinetic/KineticType.js
2114
+ var He = "http://www.w3.org/2000/svg", U = (e) => e - Math.floor(e), W = (e) => document.createElementNS(He, e);
2115
+ function Ue(e, t) {
2116
+ 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;
2117
+ }
2118
+ function We(e) {
2119
+ if (!e) return {
2120
+ bg: "#16202E",
2121
+ instances: []
2122
+ };
2123
+ if (Array.isArray(e.instances)) return e;
2124
+ let { bg: t, ...n } = e;
2125
+ return {
2126
+ bg: t || "#16202E",
2127
+ instances: [{
2128
+ id: "main",
2129
+ ...n
2130
+ }]
2131
+ };
2132
+ }
2133
+ var Ge = class {
2134
+ constructor(e) {
2135
+ this.host = e, this.params = We(null), this.w = 0, this.h = 0, this._rt = /* @__PURE__ */ new Map(), this._instSig = "", this._needsRemeasure = !1;
2136
+ let t = W("svg");
2137
+ t.setAttribute("xmlns", He), 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 = W("rect"), this.layer = W("g"), this.measEl = W("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(() => {
2138
+ this._needsRemeasure = !0;
2139
+ }).catch(() => {});
2140
+ }
2141
+ resize(e, t) {
2142
+ 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);
2143
+ for (let e of this._rt.values()) e.cache = null;
2144
+ }
2145
+ setComposition(e) {
2146
+ this.params = We(e);
2147
+ }
2148
+ renderAt(e) {
2149
+ !this.w || !this.h || this._render(_(e));
2150
+ }
2151
+ getInstanceRect(e) {
2152
+ let t = this._rt.get(e);
2153
+ if (!t || !t.glyphG) return null;
2154
+ let n;
2155
+ try {
2156
+ n = t.glyphG.getBBox();
2157
+ } catch {
2158
+ return null;
2159
+ }
2160
+ if (!n || !n.width || !n.height) return null;
2161
+ let r = (this.params.instances || []).find((t) => t.id === e), i = (r?.offset?.x || 0) * this.w, a = (r?.offset?.y || 0) * this.h;
2162
+ return {
2163
+ x: n.x + i,
2164
+ y: n.y + a,
2165
+ w: n.width,
2166
+ h: n.height
2167
+ };
2168
+ }
2169
+ hitTest(e, t) {
2170
+ let n = this.svg.getBoundingClientRect();
2171
+ if (!n.width || !n.height) return null;
2172
+ let r = (e - n.left) * (this.w / n.width), i = (t - n.top) * (this.h / n.height), a = this.params.instances || [];
2173
+ for (let e = a.length - 1; e >= 0; e--) {
2174
+ let t = this.getInstanceRect(a[e].id);
2175
+ if (t && r >= t.x && r <= t.x + t.w && i >= t.y && i <= t.y + t.h) return a[e].id;
2176
+ }
2177
+ return null;
2178
+ }
2179
+ dispose() {
2180
+ this.host && this.host.__kolKineticEngine === this && delete this.host.__kolKineticEngine, this.svg && this.svg.parentNode === this.host && this.host.removeChild(this.svg);
2181
+ }
2182
+ _syncInstances() {
2183
+ let e = this.params.instances || [], t = e.map((e) => e.id).join("|");
2184
+ if (t === this._instSig) return;
2185
+ this._instSig = t;
2186
+ let n = new Set(e.map((e) => e.id));
2187
+ for (let [e, t] of this._rt) n.has(e) || (t.group.remove(), this._rt.delete(e));
2188
+ for (let t of e) {
2189
+ let e = this._rt.get(t.id);
2190
+ if (!e) {
2191
+ let n = W("g"), r = W("path");
2192
+ r.setAttribute("fill", "none");
2193
+ let i = W("g");
2194
+ i.setAttribute("data-glyphs", t.id), n.append(r, i), e = {
2195
+ group: n,
2196
+ pathEl: r,
2197
+ glyphG: i,
2198
+ glyphEls: [],
2199
+ cache: null,
2200
+ glyphKey: "",
2201
+ closed: !1
2202
+ }, this._rt.set(t.id, e);
2203
+ }
2204
+ this.layer.appendChild(e.group);
2205
+ }
2206
+ }
2207
+ _render(e) {
2208
+ let t = this.params.clip !== !1;
2209
+ if (t !== this._clipApplied && (this._clipApplied = t, this.svg.style.overflow = t ? "hidden" : "visible"), this._needsRemeasure) {
2210
+ this._needsRemeasure = !1;
2211
+ for (let e of this._rt.values()) e.cache = null;
2212
+ }
2213
+ this.bg.setAttribute("fill", this.params.bg || "#16202E"), this._syncInstances();
2214
+ for (let t of this.params.instances || []) {
2215
+ let n = this._rt.get(t.id);
2216
+ n && this._renderInstance(t, n, e);
2217
+ }
2218
+ }
2219
+ _ensureGlyphs(e, t, n, r) {
2220
+ let i = `${t}|${n.family}|${r}`;
2221
+ if (i !== e.glyphKey) {
2222
+ e.glyphKey = i, e.glyphG.textContent = "", e.glyphEls = [];
2223
+ for (let n = 0; n < r; n++) for (let n of t) {
2224
+ let t = W("text");
2225
+ t.setAttribute("text-anchor", "middle"), t.setAttribute("dominant-baseline", "central"), t.textContent = n, e.glyphG.appendChild(t), e.glyphEls.push(t);
2226
+ }
2227
+ }
2228
+ }
2229
+ _measure(e, t, n, r) {
2230
+ let i = t.letterSpacing || 0, a = Ve(t.opentype), o = `${r}|${n.family}|${t.fontSize}|${i}|${w(t.vf)}|${a}`;
2231
+ if (e.cache && e.cache.key === o) return e.cache;
2232
+ let s = this.measEl;
2233
+ s.style.fontFamily = `'${n.family}'`, s.style.fontSize = `${t.fontSize}px`, s.style.letterSpacing = `${i}px`, s.style.fontVariationSettings = w(t.vf), s.style.fontFeatureSettings = a, s.textContent = r;
2234
+ let c = r.length, l = Array(c), u = 0;
2235
+ try {
2236
+ u = s.getComputedTextLength();
2237
+ let e = Array(c);
2238
+ for (let t = 0; t < c; t++) e[t] = s.getStartPositionOfChar(t).x;
2239
+ for (let t = 0; t < c; t++) l[t] = (e[t] + (t + 1 < c ? e[t + 1] : u)) / 2;
2240
+ } catch {
2241
+ u = t.fontSize * .6 * c;
2242
+ for (let e = 0; e < c; e++) l[e] = (e + .5) * (u / Math.max(1, c));
2243
+ }
2244
+ return e.cache = {
2245
+ key: o,
2246
+ centers: l,
2247
+ total: u
2248
+ }, e.cache;
2249
+ }
2250
+ _renderInstance(e, t, n) {
2251
+ let r = y(e.font), i = e.phase ? U(n + e.phase) : n, o = Ue(e.text || "", e.case), c = Math.max(1, Math.round(e.multiply || 1)), l = c > 1 && o ? Array(c).fill(o).join(" ") : o, u = e.path?.type || "line", d = (e.offset?.x || 0) * this.w, f = (e.offset?.y || 0) * this.h;
2252
+ if (t.group.setAttribute("transform", `translate(${d.toFixed(2)} ${f.toFixed(2)})`), e.morph?.on && !xe(u) && !L(u)) {
2253
+ let n = r.url, o = e.morph.face2 ? y(e.morph.face2) : null, c = o ? o.url : n, d = a(n), f = a(c);
2254
+ if (d && f) {
2255
+ this._setKind(t, "morph"), this._renderMorph(e, t, i, d, f, r, l, u);
2256
+ return;
2257
+ }
2258
+ d || s(n).catch(() => {}), !f && c !== n && s(c).catch(() => {});
2259
+ }
2260
+ if (this._setKind(t, "text"), be(u)) {
2261
+ t.pathEl.setAttribute("d", ""), t.pathEl.style.opacity = 0;
2262
+ let n = Math.max(1, Math.round(e.path?.rows ?? 2)), a = Math.max(1, Math.round(e.path?.cols ?? 3));
2263
+ if (this._ensureGlyphs(t, l, r, n * a), !l.length) return;
2264
+ this._measure(t, e, r, l), this._placeArray(e, t, r, i, t.glyphEls, n, a);
2265
+ return;
2266
+ }
2267
+ if (xe(u) || L(u)) {
2268
+ t.pathEl.setAttribute("d", ""), t.pathEl.style.opacity = 0;
2269
+ let n = Math.max(1, Math.round(e.path?.count ?? 12));
2270
+ if (this._ensureGlyphs(t, l, r, n), !l.length) return;
2271
+ this._measure(t, e, r, l), xe(u) ? this._placeRadial(e, t, r, i, t.glyphEls, n) : this._placeRings(e, t, r, i, t.glyphEls, n);
2272
+ return;
2273
+ }
2274
+ let p = Ce(u, this.w, this.h, e.path || {});
2275
+ t.closed = p.closed, t.pathEl.setAttribute("d", p.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, l, r, 1), l.length && (this._measure(t, e, r, l), this._placeOnPath(e, t, r, i, t.glyphEls));
2276
+ }
2277
+ _styleGlyph(e, t, n, r) {
2278
+ e.style.fontFamily = `'${n.family}'`, e.style.fontSize = `${t.fontSize}px`, e.style.fontStyle = t.italic ? "italic" : "normal", e.style.fontVariationSettings = w(r.vf ? {
2279
+ ...t.vf,
2280
+ ...r.vf
2281
+ } : t.vf), e.style.fontFeatureSettings = Ve(t.opentype), e.setAttribute("fill", t.fill || "#e8e4dc"), e.setAttribute("opacity", r.opacity);
2282
+ }
2283
+ _anim(e, t, n) {
2284
+ 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;
2285
+ for (let e of r) {
2286
+ if (!e || (e.mode || "none") === "none") continue;
2287
+ let r = n.axes.find((t) => t.tag === (e.axis || n.axes[0] && n.axes[0].tag)), u = ze(e.mode, {
2288
+ ...t,
2289
+ m: e,
2290
+ axisTag: r ? r.tag : "wght",
2291
+ axisMin: r ? r.min : 100,
2292
+ axisMax: r ? r.max : 900
2293
+ });
2294
+ i += u.dLen, a += u.dNormal, o += u.dRot, s *= u.scale, c *= u.opacity, u.vf && (l = {
2295
+ ...l || {},
2296
+ ...u.vf
2297
+ });
2298
+ }
2299
+ return {
2300
+ dLen: i,
2301
+ dNormal: a,
2302
+ scale: s,
2303
+ dRot: o,
2304
+ opacity: c,
2305
+ vf: l
2306
+ };
2307
+ }
2308
+ _placeOnPath(e, t, n, r, i) {
2309
+ let a = t.cache;
2310
+ if (!a) return;
2311
+ let o = t.pathEl.getTotalLength();
2312
+ if (!o) return;
2313
+ let { centers: s, total: c } = a, l = e.align || "center", u = l === "start" ? 0 : l === "end" ? o - c : (o - c) / 2, d = .75, f = t.closed, p = e.flow === "flow" && !f, m = (e) => f ? (e % o + o) % o : Math.max(0, Math.min(o, e)), h = (e) => {
2314
+ if (p && (e < 0 || e > o)) {
2315
+ let n = e < 0 ? 0 : o, r = t.pathEl.getPointAtLength(n), i = t.pathEl.getPointAtLength(Math.max(0, n - d)), a = t.pathEl.getPointAtLength(Math.min(o, n + d)), s = a.x - i.x, c = a.y - i.y, l = Math.hypot(s, c) || 1;
2316
+ s /= l, c /= l;
2317
+ let u = e - n;
2318
+ return {
2319
+ x: r.x + s * u,
2320
+ y: r.y + c * u
2321
+ };
2322
+ }
2323
+ return t.pathEl.getPointAtLength(m(e));
2324
+ }, g = Math.min(i.length, s.length), v = _(e.stagger || 0), y = Math.max(1, Math.round(e.multiply || 1)), b = (s.length + 2) / y;
2325
+ for (let t = 0; t < g; t++) {
2326
+ let a = u + s[t], c = h(a), l = v && y > 1 ? U(r + v * Math.floor(t / b) / y) : r, f = this._anim(e, {
2327
+ i: t,
2328
+ n: s.length,
2329
+ u: l,
2330
+ sizePx: e.fontSize,
2331
+ pathLen: o,
2332
+ nx: this.w ? c.x / this.w : .5,
2333
+ ny: this.h ? c.y / this.h : .5
2334
+ }, n), p = a + f.dLen, m = h(p), g = h(p - d), _ = h(p + d), x = Math.atan2(_.y - g.y, _.x - g.x) * 180 / Math.PI;
2335
+ i[t].setAttribute("transform", `translate(${m.x.toFixed(2)} ${m.y.toFixed(2)}) rotate(${(x + f.dRot).toFixed(2)}) translate(0 ${(-f.dNormal).toFixed(2)}) scale(${f.scale.toFixed(3)})`), this._styleGlyph(i[t], e, n, f);
2336
+ }
2337
+ }
2338
+ _placeArray(e, t, n, r, i, a, o) {
2339
+ let s = t.cache;
2340
+ if (!s) return;
2341
+ let { centers: c, total: l } = s, u = c.length;
2342
+ if (!u) return;
2343
+ let d = Math.min(this.w, this.h) * .08, f = (this.w - 2 * d) / o, p = (this.h - 2 * d) / a, m = _(e.stagger || 0), h = a * o;
2344
+ for (let t = 0; t < h; t++) {
2345
+ let a = Math.floor(t / o), s = d + t % o * f + f / 2, g = d + a * p + p / 2, _ = s - l / 2, v = m ? U(r + m * t / h) : r;
2346
+ for (let r = 0; r < u; r++) {
2347
+ let a = i[t * u + r];
2348
+ if (!a) continue;
2349
+ let o = _ + c[r], s = this._anim(e, {
2350
+ i: t * u + r,
2351
+ n: h * u,
2352
+ u: v,
2353
+ sizePx: e.fontSize,
2354
+ pathLen: 0,
2355
+ nx: this.w ? o / this.w : .5,
2356
+ ny: this.h ? g / this.h : .5
2357
+ }, n), l = g - s.dNormal;
2358
+ a.setAttribute("transform", `translate(${o.toFixed(2)} ${l.toFixed(2)}) rotate(${s.dRot.toFixed(2)}) scale(${s.scale.toFixed(3)})`), this._styleGlyph(a, e, n, s);
2359
+ }
2360
+ }
2361
+ }
2362
+ _placeRadial(e, t, n, r, i, a) {
2363
+ let o = t.cache;
2364
+ if (!o) return;
2365
+ let { centers: s } = o, c = s.length;
2366
+ if (!c) return;
2367
+ let l = this.w / 2, u = this.h / 2, d = Math.min(this.w, this.h) * .5, f = d * Math.max(0, Math.min(.95, e.path?.inner ?? .12)), p = Math.round(e.path?.spin ?? 1), m = _(e.stagger || 0);
2368
+ for (let t = 0; t < a; t++) {
2369
+ let o = a > 1 ? t / (a - 1) : 0, h = p + (m ? Math.round(m * 2 * o) : 0), g = t / a * x + r * x * h, _ = m ? U(r + m * t / a) : r, v = Math.cos(g), y = Math.sin(g), b = g * 180 / Math.PI;
2370
+ for (let r = 0; r < c; r++) {
2371
+ let o = t * c + r, p = i[o];
2372
+ if (!p) continue;
2373
+ let m = f + s[r], h = l + v * m, g = u + y * m, x = this._anim(e, {
2374
+ i: o,
2375
+ n: a * c,
2376
+ u: _,
2377
+ sizePx: e.fontSize,
2378
+ pathLen: d,
2379
+ nx: this.w ? h / this.w : .5,
2380
+ ny: this.h ? g / this.h : .5
2381
+ }, n), S = m + x.dLen, ee = l + v * S, C = u + y * S;
2382
+ p.setAttribute("transform", `translate(${ee.toFixed(2)} ${C.toFixed(2)}) rotate(${(b + x.dRot).toFixed(2)}) translate(0 ${(-x.dNormal).toFixed(2)}) scale(${x.scale.toFixed(3)})`), this._styleGlyph(p, e, n, x);
2383
+ }
2384
+ }
2385
+ }
2386
+ _placeRings(e, t, n, r, i, a) {
2387
+ let o = t.cache;
2388
+ if (!o) return;
2389
+ let { centers: s, total: c } = o, l = s.length;
2390
+ if (!l) return;
2391
+ let u = this.w / 2, d = this.h / 2, f = Math.min(this.w, this.h) * .5 * Math.max(.1, Math.min(1, e.path?.radius ?? .92)), p = f * Math.max(.02, Math.min(.95, e.path?.inner ?? .14)), m = Math.round(e.path?.spin ?? 1), h = e.path?.twist ?? .5, g = e.path?.grow ?? .6, v = _(e.stagger || 0);
2392
+ for (let t = 0; t < a; t++) {
2393
+ let o = a > 1 ? t / (a - 1) : 0, _ = Math.max(1, p + o * (f - p)), y = m + (v ? Math.round(v * 2 * o) : 0), b = r * x * y + o * h * x, S = v ? U(r + v * t / a) : r, ee = 1 + g * o;
2394
+ for (let r = 0; r < l; r++) {
2395
+ let o = t * l + r, f = i[o];
2396
+ if (!f) continue;
2397
+ let p = b + (s[r] - c / 2) / _, m = u + Math.cos(p) * _, h = d + Math.sin(p) * _, g = this._anim(e, {
2398
+ i: o,
2399
+ n: a * l,
2400
+ u: S,
2401
+ sizePx: e.fontSize,
2402
+ pathLen: x * _,
2403
+ nx: this.w ? m / this.w : .5,
2404
+ ny: this.h ? h / this.h : .5
2405
+ }, n), v = p + g.dLen / _, y = _ - g.dNormal, C = u + Math.cos(v) * y, w = d + Math.sin(v) * y, te = v * 180 / Math.PI + 90 + g.dRot;
2406
+ f.setAttribute("transform", `translate(${C.toFixed(2)} ${w.toFixed(2)}) rotate(${te.toFixed(2)}) scale(${(g.scale * ee).toFixed(3)})`), this._styleGlyph(f, e, n, g);
2407
+ }
2408
+ }
2409
+ }
2410
+ _setKind(e, t) {
2411
+ e.kind !== t && (e.kind = t, e.glyphG.textContent = "", e.glyphEls = [], e.morphEls = [], e.glyphKey = "", e.morphKey = "", e.morphPoolKey = "", e.cache = null);
2412
+ }
2413
+ _renderMorph(e, t, n, r, i, a, o, s) {
2414
+ let c = e.fontSize, l = a.axes || [], d = {};
2415
+ for (let t of l) d[t.tag] = e.vf?.[t.tag] ?? t.def;
2416
+ let f = !!e.morph.face2, p = {};
2417
+ if (!f) for (let t of l) p[t.tag] = e.morph.vf2?.[t.tag] ?? t.max;
2418
+ let m = c * .12 + (e.letterSpacing || 0), h = e.morph.mode || "morph", g = e.morph.blend ?? .5, _ = e.morph.curve || "flat", v = e.morph.cp1 || {
2419
+ x: .33,
2420
+ y: .33
2421
+ }, y = e.morph.cp2 || {
2422
+ x: .66,
2423
+ y: .66
2424
+ }, b = e.fill || "#e8e4dc", x = JSON.stringify([
2425
+ o,
2426
+ e.font,
2427
+ e.morph.face2 || "",
2428
+ c,
2429
+ d,
2430
+ p,
2431
+ h,
2432
+ g,
2433
+ _,
2434
+ v,
2435
+ y,
2436
+ e.letterSpacing || 0,
2437
+ b
2438
+ ]), S = x !== t.morphKey;
2439
+ if (S) {
2440
+ t.morphKey = x;
2441
+ let e = u(r, i, o, c, {
2442
+ mode: h,
2443
+ blend: g,
2444
+ curve: _,
2445
+ cp1: v,
2446
+ cp2: y,
2447
+ coordsA: d,
2448
+ coordsB: p,
2449
+ axes: l,
2450
+ gap: m
2451
+ });
2452
+ t.morphData = e;
2453
+ let n = [], a = 0;
2454
+ for (let t of e.glyphs) n.push(a + t.advance / 2), a += t.advance;
2455
+ t.morphCenters = n, t.morphTotal = e.totalAdvance;
2456
+ }
2457
+ let ee = t.morphData?.glyphs.length || 0;
2458
+ if (!o.length || !ee) {
2459
+ t.pathEl.setAttribute("d", ""), t.pathEl.style.opacity = 0;
2460
+ return;
2461
+ }
2462
+ let C = be(s), w = C ? Math.max(1, Math.round(e.path?.rows ?? 2)) : 1, te = C ? Math.max(1, Math.round(e.path?.cols ?? 3)) : 1, ne = C ? w * te : 1, T = this._ensureMorphPool(t, ee, ne, h);
2463
+ if ((S || T) && this._refreshMorphPaths(t, ne, h, b), C) {
2464
+ t.pathEl.setAttribute("d", ""), t.pathEl.style.opacity = 0, this._placeMorphArray(e, t, a, n, w, te);
2465
+ return;
2466
+ }
2467
+ let E = Ce(s, this.w, this.h, e.path || {});
2468
+ t.closed = E.closed, t.pathEl.setAttribute("d", E.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._placeMorphOnPath(e, t, a, n);
2469
+ }
2470
+ _ensureMorphPool(e, t, n, r) {
2471
+ let i = `${t}|${n}|${r}`;
2472
+ if (i === e.morphPoolKey) return !1;
2473
+ e.morphPoolKey = i, e.glyphG.textContent = "", e.morphEls = [];
2474
+ let a = t * n;
2475
+ for (let t = 0; t < a; t++) {
2476
+ let t = W("g");
2477
+ t.appendChild(W("path")), r === "fade" && t.appendChild(W("path")), e.glyphG.appendChild(t), e.morphEls.push(t);
2478
+ }
2479
+ return !0;
2480
+ }
2481
+ _refreshMorphPaths(e, t, n, r) {
2482
+ let i = e.morphData?.glyphs || [], a = i.length;
2483
+ if (a) for (let t = 0; t < e.morphEls.length; t++) {
2484
+ let o = e.morphEls[t], s = i[t % a];
2485
+ if (!s) continue;
2486
+ let c = o.childNodes;
2487
+ 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);
2488
+ }
2489
+ }
2490
+ _setMorphPath(e, t, n, r, i) {
2491
+ if (!e) return;
2492
+ e.setAttribute("d", t || ""), e.setAttribute("fill", r), e.setAttribute("fill-rule", "evenodd"), e.setAttribute("opacity", i);
2493
+ let a = (n.x1 + n.x2) / 2, o = (n.y1 + n.y2) / 2;
2494
+ e.setAttribute("transform", `translate(${(-a).toFixed(2)} ${(-o).toFixed(2)})`);
2495
+ }
2496
+ _placeMorphOnPath(e, t, n, r, i = t.morphEls) {
2497
+ let a = t.morphCenters, o = t.morphTotal;
2498
+ if (!a || !i) return;
2499
+ let s = t.pathEl.getTotalLength();
2500
+ if (!s) return;
2501
+ let c = e.align || "center", l = c === "start" ? 0 : c === "end" ? s - o : (s - o) / 2, u = .75, d = t.closed, f = e.flow === "flow" && !d, p = (e) => d ? (e % s + s) % s : Math.max(0, Math.min(s, e)), m = (e) => {
2502
+ if (f && (e < 0 || e > s)) {
2503
+ let n = e < 0 ? 0 : s, r = t.pathEl.getPointAtLength(n), i = t.pathEl.getPointAtLength(Math.max(0, n - u)), a = t.pathEl.getPointAtLength(Math.min(s, n + u)), o = a.x - i.x, c = a.y - i.y, l = Math.hypot(o, c) || 1;
2504
+ o /= l, c /= l;
2505
+ let d = e - n;
2506
+ return {
2507
+ x: r.x + o * d,
2508
+ y: r.y + c * d
2509
+ };
2510
+ }
2511
+ return t.pathEl.getPointAtLength(p(e));
2512
+ }, h = e.italic ? " skewX(-12)" : "", g = Math.min(i.length, a.length), v = _(e.stagger || 0), y = Math.max(1, Math.round(e.multiply || 1)), b = (a.length + 2) / y;
2513
+ for (let t = 0; t < g; t++) {
2514
+ let o = l + a[t], c = m(o), d = v && y > 1 ? U(r + v * Math.floor(t / b) / y) : r, f = this._anim(e, {
2515
+ i: t,
2516
+ n: a.length,
2517
+ u: d,
2518
+ sizePx: e.fontSize,
2519
+ pathLen: s,
2520
+ nx: this.w ? c.x / this.w : .5,
2521
+ ny: this.h ? c.y / this.h : .5
2522
+ }, n), p = o + f.dLen, g = m(p), _ = m(p - u), x = m(p + u), S = Math.atan2(x.y - _.y, x.x - _.x) * 180 / Math.PI;
2523
+ i[t].setAttribute("transform", `translate(${g.x.toFixed(2)} ${g.y.toFixed(2)}) rotate(${(S + f.dRot).toFixed(2)}) translate(0 ${(-f.dNormal).toFixed(2)}) scale(${f.scale.toFixed(3)})${h}`), i[t].setAttribute("opacity", f.opacity);
2524
+ }
2525
+ }
2526
+ _placeMorphArray(e, t, n, r, i, a, o = t.morphEls) {
2527
+ let s = t.morphCenters, c = t.morphTotal;
2528
+ if (!s || !o) return;
2529
+ let l = s.length;
2530
+ if (!l) return;
2531
+ let u = Math.min(this.w, this.h) * .08, d = (this.w - 2 * u) / a, f = (this.h - 2 * u) / i, p = e.italic ? " skewX(-12)" : "", m = _(e.stagger || 0), h = i * a;
2532
+ for (let t = 0; t < h; t++) {
2533
+ let i = Math.floor(t / a), g = u + t % a * d + d / 2, _ = u + i * f + f / 2, v = g - c / 2, y = m ? U(r + m * t / h) : r;
2534
+ for (let r = 0; r < l; r++) {
2535
+ let i = t * l + r, a = o[i];
2536
+ if (!a) continue;
2537
+ let c = v + s[r], u = this._anim(e, {
2538
+ i,
2539
+ n: h * l,
2540
+ u: y,
2541
+ sizePx: e.fontSize,
2542
+ pathLen: 0,
2543
+ nx: this.w ? c / this.w : .5,
2544
+ ny: this.h ? _ / this.h : .5
2545
+ }, n), d = _ - u.dNormal;
2546
+ a.setAttribute("transform", `translate(${c.toFixed(2)} ${d.toFixed(2)}) rotate(${u.dRot.toFixed(2)}) scale(${u.scale.toFixed(3)})${p}`), a.setAttribute("opacity", u.opacity);
2547
+ }
2548
+ }
2549
+ }
2550
+ }, G = (e, t = 0) => e?.instances?.[t] ?? null, K = (e, t, n = 0) => ({
2551
+ ...e,
2552
+ instances: (e.instances ?? []).map((e, r) => r === n ? {
2553
+ ...e,
2554
+ ...t
2555
+ } : e)
2556
+ }), Ke = (e, t) => ({
2557
+ ...e,
2558
+ instances: (e.instances ?? []).map((e, n, r) => ({
2559
+ ...e,
2560
+ ...t(e, n, r.length)
2561
+ }))
2562
+ }), q = (e, t, n = 0) => K(e, { path: {
2563
+ ...G(e, n)?.path ?? {},
2564
+ ...t
2565
+ } }, n), J = (e, t, n = 0) => K(e, { motion: {
2566
+ ...G(e, n)?.motion ?? {},
2567
+ ...t
2568
+ } }, n), Y = (e, t = 0) => G(e, t)?.path?.type ?? "line", X = (e, t = 0) => G(e, t)?.motion?.mode ?? "none", qe = (e, t = 0) => ![
2569
+ "radial",
2570
+ "rings",
2571
+ "array"
2572
+ ].includes(Y(e, t)), Je = [
2573
+ {
2574
+ value: "line",
2575
+ label: "Line"
2576
+ },
2577
+ {
2578
+ value: "arc",
2579
+ label: "Arc"
2580
+ },
2581
+ {
2582
+ value: "sine",
2583
+ label: "Sine"
2584
+ },
2585
+ {
2586
+ value: "zigzag",
2587
+ label: "Zigzag"
2588
+ },
2589
+ {
2590
+ value: "spiral",
2591
+ label: "Spiral"
2592
+ },
2593
+ {
2594
+ value: "circle",
2595
+ label: "Circle"
2596
+ },
2597
+ {
2598
+ value: "ellipse",
2599
+ label: "Ellipse"
2600
+ },
2601
+ {
2602
+ value: "custom",
2603
+ label: "Custom"
2604
+ },
2605
+ {
2606
+ value: "array",
2607
+ label: "Array"
2608
+ },
2609
+ {
2610
+ value: "radial",
2611
+ label: "Radial"
2612
+ },
2613
+ {
2614
+ value: "rings",
2615
+ label: "Rings"
2616
+ }
2617
+ ], Z = (e, t = 0) => G(e, t)?.morph ?? {}, Q = (e, t, n = 0) => K(e, { morph: {
2618
+ ...G(e, n)?.morph ?? {},
2619
+ ...t
2620
+ } }, n), Ye = (e, t, n, r = 0) => Q(e, { vf2: {
2621
+ ...Z(e, r).vf2 ?? {},
2622
+ [t]: n
2623
+ } }, r), Xe = (e, t = 0) => !["radial", "rings"].includes(Y(e, t)), Ze = (e, t = 0) => Xe(e, t) && !!Z(e, t).on, Qe = (e, t = 0) => Z(e, t).mode ?? "morph", $e = (e, t = 0) => Ze(e, t) && ["morph", "fade"].includes(Qe(e, t)), $ = (e, t, n = 0) => y(G(e, n)?.font).axes.find((e) => e.tag === t), et = (e, t, n, r = 0) => {
2624
+ let i = $(e, t, r), a = i ? Math.min(i.max, Math.max(i.min, n)) : n;
2625
+ return Ye(e, t, Math.round(a), r);
2626
+ }, tt = (e, t, n, r = 0) => {
2627
+ let i = $(e, t, r), a = i ? Math.min(i.max, Math.max(i.min, n)) : n;
2628
+ return K(e, { vf: {
2629
+ ...G(e, r)?.vf ?? {},
2630
+ [t]: Math.round(a)
2631
+ } }, r);
2632
+ }, nt = (e) => ({
2633
+ key: `vf${e[0].toUpperCase()}${e.slice(1)}`,
2634
+ label: T[e] || e,
2635
+ tab: "style",
2636
+ section: "Axes",
2637
+ type: "range",
2638
+ step: 1,
2639
+ min: (t, n = 0) => $(t, e, n)?.min ?? 0,
2640
+ max: (t, n = 0) => $(t, e, n)?.max ?? 1e3,
2641
+ when: (t, n = 0) => !!$(t, e, n),
2642
+ get: (t, n = 0) => G(t, n)?.vf?.[e] ?? $(t, e, n)?.def ?? 0,
2643
+ set: (t, n, r = 0) => tt(t, e, n, r)
2644
+ }), rt = (e, t = 0) => Ze(e, t) && Qe(e, t) === "morph" && (Z(e, t).curve ?? "flat") === "custom", it = (e, t) => ({
2645
+ key: `morphC${e}${t}`,
2646
+ label: `P${e} ${t.toUpperCase()}`,
2647
+ tab: "style",
2648
+ section: "Morph",
2649
+ type: "range",
2650
+ min: 0,
2651
+ max: 1,
2652
+ step: .01,
2653
+ noRandom: !0,
2654
+ when: rt,
2655
+ get: (n, r = 0) => Z(n, r)[`cp${e}`]?.[t] ?? (e === 1 ? .33 : .66),
2656
+ set: (n, r, i = 0) => Q(n, { [`cp${e}`]: {
2657
+ ...Z(n, i)[`cp${e}`] ?? {
2658
+ x: e === 1 ? .33 : .66,
2659
+ y: e === 1 ? .33 : .66
2660
+ },
2661
+ [t]: r
2662
+ } }, i)
2663
+ }), at = [
2664
+ {
2665
+ key: "bg",
2666
+ label: "Background",
2667
+ tab: "style",
2668
+ type: "color",
2669
+ noRandom: !0,
2670
+ get: (e) => e.bg,
2671
+ set: (e, t) => ({
2672
+ ...e,
2673
+ bg: t
2674
+ })
2675
+ },
2676
+ {
2677
+ key: "fill",
2678
+ label: "Fill",
2679
+ tab: "style",
2680
+ type: "color",
2681
+ noRandom: !0,
2682
+ get: (e, t = 0) => G(e, t)?.fill,
2683
+ set: (e, t, n = 0) => K(e, { fill: t }, n)
2684
+ },
2685
+ {
2686
+ key: "font",
2687
+ label: "Font",
2688
+ tab: "style",
2689
+ type: "select",
2690
+ options: C,
2691
+ noRandom: !0,
2692
+ get: (e, t = 0) => G(e, t)?.font,
2693
+ set: (e, t, n = 0) => K(e, {
2694
+ font: t,
2695
+ vf: Ee(t, G(e, n)?.vf)
2696
+ }, n)
2697
+ },
2698
+ {
2699
+ key: "italic",
2700
+ label: "Italic",
2701
+ tab: "style",
2702
+ type: "select",
2703
+ noRandom: !0,
2704
+ options: [{
2705
+ value: "off",
2706
+ label: "Off"
2707
+ }, {
2708
+ value: "on",
2709
+ label: "On"
2710
+ }],
2711
+ get: (e, t = 0) => G(e, t)?.italic ? "on" : "off",
2712
+ set: (e, t, n = 0) => K(e, { italic: t === "on" }, n)
2713
+ },
2714
+ {
2715
+ key: "case",
2716
+ label: "Case",
2717
+ tab: "style",
2718
+ type: "select",
2719
+ noRandom: !0,
2720
+ options: [
2721
+ {
2722
+ value: "none",
2723
+ label: "Aa"
2724
+ },
2725
+ {
2726
+ value: "upper",
2727
+ label: "AA"
2728
+ },
2729
+ {
2730
+ value: "lower",
2731
+ label: "aa"
2732
+ },
2733
+ {
2734
+ value: "title",
2735
+ label: "Tt"
2736
+ }
2737
+ ],
2738
+ get: (e, t = 0) => G(e, t)?.case ?? "none",
2739
+ set: (e, t, n = 0) => K(e, { case: t }, n)
2740
+ },
2741
+ {
2742
+ key: "fontSize",
2743
+ label: "Font size",
2744
+ tab: "style",
2745
+ type: "range",
2746
+ min: 8,
2747
+ max: 1200,
2748
+ step: 1,
2749
+ rMin: 36,
2750
+ rMax: 150,
2751
+ get: (e, t = 0) => G(e, t)?.fontSize ?? 26,
2752
+ set: (e, t, n = 0) => K(e, { fontSize: Math.round(t) }, n)
2753
+ },
2754
+ {
2755
+ key: "letterSpacing",
2756
+ label: "Letter spacing",
2757
+ tab: "style",
2758
+ type: "range",
2759
+ min: -10,
2760
+ max: 400,
2761
+ step: .5,
2762
+ rMin: 0,
2763
+ rMax: 12,
2764
+ get: (e, t = 0) => G(e, t)?.letterSpacing ?? 0,
2765
+ set: (e, t, n = 0) => K(e, { letterSpacing: t }, n)
2766
+ },
2767
+ {
2768
+ key: "align",
2769
+ label: "Align",
2770
+ tab: "style",
2771
+ type: "select",
2772
+ noRandom: !0,
2773
+ when: qe,
2774
+ options: [
2775
+ {
2776
+ value: "start",
2777
+ label: "Start"
2778
+ },
2779
+ {
2780
+ value: "center",
2781
+ label: "Center"
2782
+ },
2783
+ {
2784
+ value: "end",
2785
+ label: "End"
2786
+ }
2787
+ ],
2788
+ get: (e, t = 0) => G(e, t)?.align ?? "center",
2789
+ set: (e, t, n = 0) => K(e, { align: t }, n)
2790
+ },
2791
+ {
2792
+ key: "multiply",
2793
+ label: "Copies",
2794
+ tab: "style",
2795
+ type: "range",
2796
+ min: 1,
2797
+ max: 24,
2798
+ step: 1,
2799
+ noRandom: !0,
2800
+ when: qe,
2801
+ get: (e, t = 0) => G(e, t)?.multiply ?? 1,
2802
+ set: (e, t, n = 0) => K(e, { multiply: Math.round(t) }, n)
2803
+ },
2804
+ nt("wdth"),
2805
+ nt("wght"),
2806
+ {
2807
+ key: "arrangement",
2808
+ label: "Arrangement",
2809
+ tab: "style",
2810
+ section: "Arrangement",
2811
+ type: "select",
2812
+ noRandom: !0,
2813
+ options: Je,
2814
+ get: Y,
2815
+ set: (e, t, n = 0) => q(e, { type: t }, n)
2816
+ },
2817
+ {
2818
+ key: "spokes",
2819
+ label: "Spokes",
2820
+ tab: "style",
2821
+ section: "Arrangement",
2822
+ type: "range",
2823
+ min: 2,
2824
+ max: 32,
2825
+ step: 1,
2826
+ rMin: 6,
2827
+ rMax: 28,
2828
+ when: (e, t = 0) => Y(e, t) === "radial",
2829
+ get: (e, t = 0) => G(e, t)?.path?.count ?? 12,
2830
+ set: (e, t, n = 0) => q(e, { count: Math.round(t) }, n)
2831
+ },
2832
+ {
2833
+ key: "rings",
2834
+ label: "Rings",
2835
+ tab: "style",
2836
+ section: "Arrangement",
2837
+ type: "range",
2838
+ min: 2,
2839
+ max: 24,
2840
+ step: 1,
2841
+ rMin: 4,
2842
+ rMax: 16,
2843
+ when: (e, t = 0) => Y(e, t) === "rings",
2844
+ get: (e, t = 0) => G(e, t)?.path?.count ?? 12,
2845
+ set: (e, t, n = 0) => q(e, { count: Math.round(t) }, n)
2846
+ },
2847
+ {
2848
+ key: "inner",
2849
+ label: "Inner radius",
2850
+ tab: "style",
2851
+ section: "Arrangement",
2852
+ type: "range",
2853
+ min: 0,
2854
+ max: .9,
2855
+ step: .01,
2856
+ rMin: .04,
2857
+ rMax: .4,
2858
+ when: (e, t = 0) => Y(e, t) === "radial" || Y(e, t) === "rings",
2859
+ get: (e, t = 0) => G(e, t)?.path?.inner ?? .12,
2860
+ set: (e, t, n = 0) => q(e, { inner: t }, n)
2861
+ },
2862
+ {
2863
+ key: "ringRadius",
2864
+ label: "Radius",
2865
+ tab: "style",
2866
+ section: "Arrangement",
2867
+ type: "range",
2868
+ min: .1,
2869
+ max: 1,
2870
+ step: .01,
2871
+ rMin: .6,
2872
+ rMax: 1,
2873
+ when: (e, t = 0) => Y(e, t) === "rings",
2874
+ get: (e, t = 0) => G(e, t)?.path?.radius ?? .92,
2875
+ set: (e, t, n = 0) => q(e, { radius: t }, n)
2876
+ },
2877
+ {
2878
+ key: "twist",
2879
+ label: "Twist",
2880
+ tab: "style",
2881
+ section: "Arrangement",
2882
+ type: "range",
2883
+ min: 0,
2884
+ max: 2,
2885
+ step: .05,
2886
+ rMin: 0,
2887
+ rMax: 1.5,
2888
+ when: (e, t = 0) => Y(e, t) === "rings",
2889
+ get: (e, t = 0) => G(e, t)?.path?.twist ?? .5,
2890
+ set: (e, t, n = 0) => q(e, { twist: t }, n)
2891
+ },
2892
+ {
2893
+ key: "grow",
2894
+ label: "Grow",
2895
+ tab: "style",
2896
+ section: "Arrangement",
2897
+ type: "range",
2898
+ min: 0,
2899
+ max: 2,
2900
+ step: .05,
2901
+ rMin: 0,
2902
+ rMax: 1.5,
2903
+ when: (e, t = 0) => Y(e, t) === "rings",
2904
+ get: (e, t = 0) => G(e, t)?.path?.grow ?? .6,
2905
+ set: (e, t, n = 0) => q(e, { grow: t }, n)
2906
+ },
2907
+ {
2908
+ key: "pathRadius",
2909
+ label: "Radius",
2910
+ tab: "style",
2911
+ section: "Arrangement",
2912
+ type: "range",
2913
+ min: .2,
2914
+ max: 1,
2915
+ step: .01,
2916
+ rMin: .5,
2917
+ rMax: 1,
2918
+ when: (e, t = 0) => [
2919
+ "circle",
2920
+ "ellipse",
2921
+ "spiral"
2922
+ ].includes(Y(e, t)),
2923
+ get: (e, t = 0) => G(e, t)?.path?.radius ?? .72,
2924
+ set: (e, t, n = 0) => q(e, { radius: t }, n)
2925
+ },
2926
+ {
2927
+ key: "turns",
2928
+ label: "Turns",
2929
+ tab: "style",
2930
+ section: "Arrangement",
2931
+ type: "range",
2932
+ min: 1,
2933
+ max: 6,
2934
+ step: 1,
2935
+ rMin: 2,
2936
+ rMax: 5,
2937
+ when: (e, t = 0) => Y(e, t) === "spiral",
2938
+ get: (e, t = 0) => G(e, t)?.path?.turns ?? 3,
2939
+ set: (e, t, n = 0) => q(e, { turns: Math.round(t) }, n)
2940
+ },
2941
+ {
2942
+ key: "amp",
2943
+ label: "Amplitude",
2944
+ tab: "style",
2945
+ section: "Arrangement",
2946
+ type: "range",
2947
+ min: 0,
2948
+ max: 1,
2949
+ step: .05,
2950
+ rMin: .2,
2951
+ rMax: .7,
2952
+ when: (e, t = 0) => [
2953
+ "arc",
2954
+ "sine",
2955
+ "zigzag"
2956
+ ].includes(Y(e, t)),
2957
+ get: (e, t = 0) => G(e, t)?.path?.amp ?? .4,
2958
+ set: (e, t, n = 0) => q(e, { amp: t }, n)
2959
+ },
2960
+ {
2961
+ key: "freq",
2962
+ label: "Frequency",
2963
+ tab: "style",
2964
+ section: "Arrangement",
2965
+ type: "range",
2966
+ min: 1,
2967
+ max: 6,
2968
+ step: 1,
2969
+ rMin: 1,
2970
+ rMax: 4,
2971
+ when: (e, t = 0) => ["sine", "zigzag"].includes(Y(e, t)),
2972
+ get: (e, t = 0) => G(e, t)?.path?.freq ?? 2,
2973
+ set: (e, t, n = 0) => q(e, { freq: Math.round(t) }, n)
2974
+ },
2975
+ {
2976
+ key: "rows",
2977
+ label: "Rows",
2978
+ tab: "style",
2979
+ section: "Arrangement",
2980
+ type: "range",
2981
+ min: 1,
2982
+ max: 6,
2983
+ step: 1,
2984
+ rMin: 2,
2985
+ rMax: 4,
2986
+ when: (e, t = 0) => Y(e, t) === "array",
2987
+ get: (e, t = 0) => G(e, t)?.path?.rows ?? 2,
2988
+ set: (e, t, n = 0) => q(e, { rows: Math.round(t) }, n)
2989
+ },
2990
+ {
2991
+ key: "cols",
2992
+ label: "Columns",
2993
+ tab: "style",
2994
+ section: "Arrangement",
2995
+ type: "range",
2996
+ min: 1,
2997
+ max: 8,
2998
+ step: 1,
2999
+ rMin: 2,
3000
+ rMax: 6,
3001
+ when: (e, t = 0) => Y(e, t) === "array",
3002
+ get: (e, t = 0) => G(e, t)?.path?.cols ?? 3,
3003
+ set: (e, t, n = 0) => q(e, { cols: Math.round(t) }, n)
3004
+ },
3005
+ {
3006
+ key: "flow",
3007
+ label: "Paragraph",
3008
+ tab: "style",
3009
+ section: "Arrangement",
3010
+ type: "select",
3011
+ noRandom: !0,
3012
+ when: qe,
3013
+ options: [{
3014
+ value: "flow",
3015
+ label: "Flow"
3016
+ }, {
3017
+ value: "contain",
3018
+ label: "Contain"
3019
+ }],
3020
+ get: (e, t = 0) => G(e, t)?.flow ?? "flow",
3021
+ set: (e, t, n = 0) => K(e, { flow: t }, n)
3022
+ },
3023
+ {
3024
+ key: "showPath",
3025
+ label: "Show path",
3026
+ tab: "style",
3027
+ section: "Arrangement",
3028
+ type: "select",
3029
+ noRandom: !0,
3030
+ when: qe,
3031
+ options: [{
3032
+ value: "off",
3033
+ label: "Off"
3034
+ }, {
3035
+ value: "on",
3036
+ label: "On"
3037
+ }],
3038
+ get: (e, t = 0) => G(e, t)?.showPath ? "on" : "off",
3039
+ set: (e, t, n = 0) => K(e, { showPath: t === "on" }, n)
3040
+ },
3041
+ {
3042
+ key: "offsetX",
3043
+ label: "X",
3044
+ tab: "style",
3045
+ section: "Position",
3046
+ type: "range",
3047
+ min: -1,
3048
+ max: 1,
3049
+ step: .01,
3050
+ noRandom: !0,
3051
+ get: (e, t = 0) => G(e, t)?.offset?.x ?? 0,
3052
+ set: (e, t, n = 0) => K(e, { offset: {
3053
+ ...G(e, n)?.offset ?? {},
3054
+ x: t
3055
+ } }, n)
3056
+ },
3057
+ {
3058
+ key: "offsetY",
3059
+ label: "Y",
3060
+ tab: "style",
3061
+ section: "Position",
3062
+ type: "range",
3063
+ min: -1,
3064
+ max: 1,
3065
+ step: .01,
3066
+ noRandom: !0,
3067
+ get: (e, t = 0) => G(e, t)?.offset?.y ?? 0,
3068
+ set: (e, t, n = 0) => K(e, { offset: {
3069
+ ...G(e, n)?.offset ?? {},
3070
+ y: t
3071
+ } }, n)
3072
+ },
3073
+ {
3074
+ key: "morphOn",
3075
+ label: "Morph outlines",
3076
+ tab: "style",
3077
+ section: "Morph",
3078
+ type: "select",
3079
+ noRandom: !0,
3080
+ when: Xe,
3081
+ options: [{
3082
+ value: "off",
3083
+ label: "Off"
3084
+ }, {
3085
+ value: "on",
3086
+ label: "On"
3087
+ }],
3088
+ get: (e, t = 0) => Z(e, t).on ? "on" : "off",
3089
+ set: (e, t, n = 0) => Q(e, { on: t === "on" }, n)
3090
+ },
3091
+ {
3092
+ key: "morphMode",
3093
+ label: "Mode",
3094
+ tab: "style",
3095
+ section: "Morph",
3096
+ type: "select",
3097
+ when: Ze,
3098
+ options: p,
3099
+ get: Qe,
3100
+ set: (e, t, n = 0) => Q(e, { mode: t }, n)
3101
+ },
3102
+ {
3103
+ key: "morphFace2",
3104
+ label: "Cut B face",
3105
+ tab: "style",
3106
+ section: "Morph",
3107
+ type: "select",
3108
+ noRandom: !0,
3109
+ when: $e,
3110
+ options: (e, t = 0) => [{
3111
+ value: "",
3112
+ label: "Off"
3113
+ }, ...C.filter((n) => n.value !== G(e, t)?.font)],
3114
+ get: (e, t = 0) => Z(e, t).face2 ?? "",
3115
+ set: (e, t, n = 0) => Q(e, { face2: t }, n)
3116
+ },
3117
+ {
3118
+ key: "morphVf2Wdth",
3119
+ label: "Cut B · Width",
3120
+ tab: "style",
3121
+ section: "Morph",
3122
+ type: "range",
3123
+ min: 64,
3124
+ max: 172,
3125
+ step: 1,
3126
+ when: (e, t = 0) => $e(e, t) && !Z(e, t).face2 && !!$(e, "wdth", t),
3127
+ get: (e, t = 0) => Z(e, t).vf2?.wdth ?? $(e, "wdth", t)?.max ?? 172,
3128
+ set: (e, t, n = 0) => et(e, "wdth", t, n)
3129
+ },
3130
+ {
3131
+ key: "morphVf2Wght",
3132
+ label: "Cut B · Weight",
3133
+ tab: "style",
3134
+ section: "Morph",
3135
+ type: "range",
3136
+ min: 100,
3137
+ max: 900,
3138
+ step: 1,
3139
+ when: (e, t = 0) => $e(e, t) && !Z(e, t).face2 && !!$(e, "wght", t),
3140
+ get: (e, t = 0) => Z(e, t).vf2?.wght ?? $(e, "wght", t)?.max ?? 900,
3141
+ set: (e, t, n = 0) => et(e, "wght", t, n)
3142
+ },
3143
+ {
3144
+ key: "morphCurve",
3145
+ label: "Curve",
3146
+ tab: "style",
3147
+ section: "Morph",
3148
+ type: "select",
3149
+ when: (e, t = 0) => Ze(e, t) && Qe(e, t) === "morph",
3150
+ options: i,
3151
+ get: (e, t = 0) => Z(e, t).curve ?? "flat",
3152
+ set: (e, t, n = 0) => Q(e, { curve: t }, n)
3153
+ },
3154
+ it(1, "x"),
3155
+ it(1, "y"),
3156
+ it(2, "x"),
3157
+ it(2, "y"),
3158
+ {
3159
+ key: "morphBlend",
3160
+ label: "Blend",
3161
+ tab: "style",
3162
+ section: "Morph",
3163
+ type: "range",
3164
+ min: 0,
3165
+ max: 1,
3166
+ step: .01,
3167
+ when: (e, t = 0) => Ze(e, t) && Qe(e, t) !== "random",
3168
+ get: (e, t = 0) => Z(e, t).blend ?? .5,
3169
+ set: (e, t, n = 0) => Q(e, { blend: t }, n)
3170
+ },
3171
+ {
3172
+ key: "morphSeed",
3173
+ label: "Seed",
3174
+ tab: "style",
3175
+ section: "Morph",
3176
+ type: "range",
3177
+ min: 0,
3178
+ max: 1,
3179
+ step: .01,
3180
+ when: (e, t = 0) => Ze(e, t) && Qe(e, t) === "random",
3181
+ get: (e, t = 0) => Z(e, t).blend ?? .5,
3182
+ set: (e, t, n = 0) => Q(e, { blend: t }, n)
3183
+ },
3184
+ {
3185
+ key: "mode",
3186
+ label: "Motion",
3187
+ tab: "anim",
3188
+ type: "select",
3189
+ noRandom: !0,
3190
+ options: [
3191
+ {
3192
+ value: "none",
3193
+ label: "None"
3194
+ },
3195
+ {
3196
+ value: "march",
3197
+ label: "March"
3198
+ },
3199
+ {
3200
+ value: "orbit",
3201
+ label: "Orbit"
3202
+ },
3203
+ {
3204
+ value: "vfwave",
3205
+ label: "Axis wave"
3206
+ },
3207
+ {
3208
+ value: "glyphwave",
3209
+ label: "Glyph wave"
3210
+ },
3211
+ {
3212
+ value: "cascade",
3213
+ label: "Cascade"
3214
+ },
3215
+ {
3216
+ value: "sweep",
3217
+ label: "Sweep"
3218
+ },
3219
+ {
3220
+ value: "sweepWeight",
3221
+ label: "Sweep weight"
3222
+ },
3223
+ {
3224
+ value: "sweepShift",
3225
+ label: "Sweep shift"
3226
+ }
3227
+ ],
3228
+ get: X,
3229
+ set: (e, t, n = 0) => J(e, { mode: t }, n)
3230
+ },
3231
+ {
3232
+ key: "cycles",
3233
+ label: "Cycles",
3234
+ tab: "anim",
3235
+ type: "range",
3236
+ min: 1,
3237
+ max: 4,
3238
+ step: 1,
3239
+ rMin: 1,
3240
+ rMax: 3,
3241
+ when: (e, t = 0) => X(e, t) !== "none",
3242
+ get: (e, t = 0) => G(e, t)?.motion?.cycles ?? 1,
3243
+ set: (e, t, n = 0) => J(e, { cycles: Math.round(t) }, n)
3244
+ },
3245
+ {
3246
+ key: "motionAmp",
3247
+ label: "Amount",
3248
+ tab: "anim",
3249
+ type: "range",
3250
+ min: .05,
3251
+ max: 1,
3252
+ step: .05,
3253
+ rMin: .15,
3254
+ rMax: .6,
3255
+ when: (e, t = 0) => [
3256
+ "glyphwave",
3257
+ "sweep",
3258
+ "sweepWeight",
3259
+ "sweepShift"
3260
+ ].includes(X(e, t)),
3261
+ get: (e, t = 0) => G(e, t)?.motion?.amp ?? .3,
3262
+ set: (e, t, n = 0) => J(e, { amp: t }, n)
3263
+ },
3264
+ {
3265
+ key: "motionPhase",
3266
+ label: "Glyph phase",
3267
+ tab: "anim",
3268
+ type: "range",
3269
+ min: 0,
3270
+ max: 1.5,
3271
+ step: .05,
3272
+ rMin: .3,
3273
+ rMax: 1,
3274
+ when: (e, t = 0) => [
3275
+ "vfwave",
3276
+ "glyphwave",
3277
+ "cascade"
3278
+ ].includes(X(e, t)),
3279
+ get: (e, t = 0) => G(e, t)?.motion?.phase ?? .5,
3280
+ set: (e, t, n = 0) => J(e, { phase: t }, n)
3281
+ },
3282
+ {
3283
+ key: "axis",
3284
+ label: "Axis",
3285
+ tab: "anim",
3286
+ type: "select",
3287
+ when: (e, t = 0) => ["vfwave", "sweepWeight"].includes(X(e, t)) && y(G(e, t)?.font).axes.length > 1,
3288
+ options: (e, t = 0) => y(G(e, t)?.font).axes.map((e) => ({
3289
+ value: e.tag,
3290
+ label: T[e.tag] || e.tag
3291
+ })),
3292
+ get: (e, t = 0) => G(e, t)?.motion?.axis ?? "wght",
3293
+ set: (e, t, n = 0) => J(e, { axis: t }, n)
3294
+ },
3295
+ {
3296
+ key: "field",
3297
+ label: "Field",
3298
+ tab: "anim",
3299
+ type: "select",
3300
+ when: (e, t = 0) => [
3301
+ "sweep",
3302
+ "sweepWeight",
3303
+ "sweepShift"
3304
+ ].includes(X(e, t)),
3305
+ options: [
3306
+ {
3307
+ value: "x",
3308
+ label: "Horizontal"
3309
+ },
3310
+ {
3311
+ value: "y",
3312
+ label: "Vertical"
3313
+ },
3314
+ {
3315
+ value: "diagonal",
3316
+ label: "Diagonal"
3317
+ },
3318
+ {
3319
+ value: "radial",
3320
+ label: "Radial"
3321
+ },
3322
+ {
3323
+ value: "angular",
3324
+ label: "Angular"
3325
+ },
3326
+ {
3327
+ value: "wave",
3328
+ label: "Wave"
3329
+ }
3330
+ ],
3331
+ get: (e, t = 0) => G(e, t)?.motion?.field ?? "x",
3332
+ set: (e, t, n = 0) => J(e, { field: t }, n)
3333
+ },
3334
+ {
3335
+ key: "stagger",
3336
+ label: "Stagger",
3337
+ tab: "anim",
3338
+ type: "range",
3339
+ min: 0,
3340
+ max: 1,
3341
+ step: .01,
3342
+ get: (e) => G(e)?.stagger ?? 0,
3343
+ set: (e, t) => Ke(e, (e, n, r) => ({
3344
+ stagger: t,
3345
+ phase: r > 1 ? n / r * t : 0
3346
+ }))
3347
+ },
3348
+ {
3349
+ key: "spin",
3350
+ label: "Spin",
3351
+ tab: "anim",
3352
+ type: "range",
3353
+ min: 0,
3354
+ max: 4,
3355
+ step: 1,
3356
+ rMin: 0,
3357
+ rMax: 3,
3358
+ when: (e, t = 0) => Y(e, t) === "radial" || Y(e, t) === "rings",
3359
+ get: (e, t = 0) => G(e, t)?.path?.spin ?? 1,
3360
+ set: (e, t, n = 0) => q(e, { spin: Math.round(t) }, n)
3361
+ }
3362
+ ], ot = (e, t, n = 0) => typeof e.options == "function" ? e.options(t, n) : e.options ?? [], st = (e, t, n = 0) => ({
3363
+ min: typeof e.min == "function" ? e.min(t, n) : e.min,
3364
+ max: typeof e.max == "function" ? e.max(t, n) : e.max
3365
+ });
3366
+ function ct(e, t = 0, n = Math.random) {
3367
+ let r = e;
3368
+ for (let e of at) if (!(e.noRandom || e.type === "color") && !(e.when && !e.when(r, t))) {
3369
+ if (e.type === "range") {
3370
+ let i = st(e, r, t), a = e.rMin ?? i.min, o = e.rMax ?? i.max, s = e.step ?? 1, c = a + n() * (o - a);
3371
+ r = e.set(r, Math.min(o, Math.max(a, Number((Math.round(c / s) * s).toFixed(4)))), t);
3372
+ } else if (e.type === "select") {
3373
+ let i = ot(e, r, t);
3374
+ i.length && (r = e.set(r, i[Math.floor(n() * i.length)].value, t));
3375
+ }
3376
+ }
3377
+ return r;
3378
+ }
3379
+ //#endregion
3380
+ //#region src/editor/compose/inspectors/KineticPanel.jsx
3381
+ var lt = {
3382
+ key: "morphBlend",
3383
+ label: "Morph blend",
3384
+ type: "range",
3385
+ min: 0,
3386
+ max: 1,
3387
+ step: .01,
3388
+ default: .5
3389
+ }, ut = new Set([
3390
+ "mode",
3391
+ "cycles",
3392
+ "motionAmp",
3393
+ "motionPhase",
3394
+ "axis",
3395
+ "field"
3396
+ ]), dt = {
3397
+ mode: "glyphwave",
3398
+ cycles: 1,
3399
+ phase: .5,
3400
+ amp: .3,
3401
+ axis: "wght",
3402
+ field: "x"
3403
+ }, ft = new Set([
3404
+ "align",
3405
+ "italic",
3406
+ "fill",
3407
+ "fontSize",
3408
+ "vfWght",
3409
+ "offsetX",
3410
+ "offsetY"
3411
+ ]), pt = {
3412
+ lineHeight: 0,
3413
+ display: "inline-flex",
3414
+ alignItems: "center",
3415
+ justifyContent: "center"
3416
+ }, mt = (e, t) => e ? String.fromCharCode(97 + t.indexOf(e) % 26) : null;
3417
+ function ht({ layer: e, setProp: n, updateLayer: r, palette: i, renderAnimate: a, tab: o, tabStrip: s, picker: u = !0 }) {
3418
+ let p = t(), m = e.comp ?? {
3419
+ bg: "#0b0d12",
3420
+ instances: []
3421
+ }, h = m.instances ?? [], [_, y] = N(0), b = Math.min(_, Math.max(0, h.length - 1)), x = (t) => {
3422
+ y(t), window.dispatchEvent(new CustomEvent("kol:kinetic-element", { detail: {
3423
+ id: e.id,
3424
+ index: t,
3425
+ from: "panel"
3426
+ } }));
3427
+ };
3428
+ pe(() => {
3429
+ let t = (t) => {
3430
+ t.detail?.id === e.id && t.detail.from === "canvas" && y(t.detail.index);
3431
+ };
3432
+ return window.addEventListener("kol:kinetic-element", t), () => window.removeEventListener("kol:kinetic-element", t);
3433
+ }, [e.id]);
3434
+ let [S, C] = N([]), w = (e) => C((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]), te = (e) => {
3435
+ let t = h[e]?.group;
3436
+ return t ? h.reduce((e, n, r) => n.group === t ? [...e, r] : e, []) : [e];
3437
+ }, [ne, T] = N(0), E = h[b]?.motions ?? [], D = Math.min(ne, E.length), re = (e) => ({
3438
+ ...e,
3439
+ instances: (e.instances ?? []).map((e, t) => t === b ? {
3440
+ ...e,
3441
+ motion: { ...e.motions?.[D - 1] ?? {} }
3442
+ } : e)
3443
+ }), ae = (e) => ut.has(e.key) && D > 0 ? re(m) : m, oe = (t) => {
3444
+ t && (r(e.id, {
3445
+ presetId: t.id,
3446
+ presetLabel: t.label,
3447
+ comp: Ne(t)
3448
+ }), y(0), T(0));
3449
+ }, se = (e) => n("comp", e), A = (t) => r(e.id, { comp: {
3450
+ ...m,
3451
+ instances: t
3452
+ } }), j = (e, t) => se({
3453
+ ...m,
3454
+ instances: h.map((n, r) => r === e ? {
3455
+ ...n,
3456
+ ...t
3457
+ } : n)
3458
+ }), le = () => {
3459
+ if (S.length < 2) return;
3460
+ let e = new Set(h.map((e) => e.group).filter(Boolean)), t = 1;
3461
+ for (; e.has(`g${t}`);) t++;
3462
+ A(h.map((e) => S.includes(e.id) ? {
3463
+ ...e,
3464
+ group: `g${t}`
3465
+ } : e)), C([]);
3466
+ }, de = () => {
3467
+ S.length && (A(h.map((e) => S.includes(e.id) ? {
3468
+ ...e,
3469
+ group: null
3470
+ } : e)), C([]));
3471
+ }, me = (e, t) => {
3472
+ if (ut.has(e.key) && D > 0) {
3473
+ let n = e.set(re(m), t, b).instances?.[b]?.motion ?? {};
3474
+ j(b, { motions: E.map((e, t) => t === D - 1 ? n : e) });
3475
+ return;
3476
+ }
3477
+ let n = te(b);
3478
+ if (n.length > 1 && ft.has(e.key)) {
3479
+ let r = m;
3480
+ if (e.key === "fontSize") {
3481
+ let i = Number(e.get(m, b)) || 1, a = t / i;
3482
+ for (let t of n) {
3483
+ let n = Number(e.get(m, t)) || i;
3484
+ r = e.set(r, Math.max(8, Math.min(1200, Math.round(n * a))), t);
3485
+ }
3486
+ } else if (e.key === "offsetX" || e.key === "offsetY") {
3487
+ let i = t - (Number(e.get(m, b)) || 0);
3488
+ for (let t of n) r = e.set(r, (Number(e.get(m, t)) || 0) + i, t);
3489
+ } else for (let i of n) r = e.set(r, t, i);
3490
+ se(r);
3491
+ return;
3492
+ }
3493
+ se(e.set(m, t, b));
3494
+ }, M = l(e), ge = () => {
3495
+ let t = M.take();
3496
+ r(e.id, {
3497
+ comp: ct(m, b, g(t >>> 0)),
3498
+ _rollSeed: t
3499
+ });
3500
+ }, I = () => {
3501
+ let t = M.take(), n = g(t >>> 0), i = m;
3502
+ h.forEach((e, t) => {
3503
+ i = ct(i, t, n);
3504
+ }), r(e.id, {
3505
+ comp: i,
3506
+ _rollSeed: t
3507
+ });
3508
+ }, _e = (t, n) => {
3509
+ let i = v(t, n);
3510
+ r(e.id, {
3511
+ themeId: t,
3512
+ themeInvert: n,
3513
+ comp: {
3514
+ ...m,
3515
+ bg: i.bg,
3516
+ instances: h.map((e) => ({
3517
+ ...e,
3518
+ fill: i.fg
3519
+ }))
3520
+ }
3521
+ });
3522
+ }, ve = (e) => se({
3523
+ ...m,
3524
+ instances: h.map((t) => ({
3525
+ ...t,
3526
+ fill: e
3527
+ }))
3528
+ }), ye = o === "labs-effect" ? "style" : o, be = at.filter((e) => e.tab === ye && (!e.when || e.when(ae(e), b))), xe = h.some((e) => e?.morph?.on), L = h[b];
3529
+ return /* @__PURE__ */ F(he, { children: [
3530
+ u && /* @__PURE__ */ P(gt, {
3531
+ layer: e,
3532
+ onPreset: oe
3533
+ }),
3534
+ /* @__PURE__ */ F("div", {
3535
+ className: "flex flex-col gap-1",
3536
+ children: [
3537
+ /* @__PURE__ */ P("span", {
3538
+ className: "kol-helper-10 text-meta",
3539
+ children: "Elements"
3540
+ }),
3541
+ /* @__PURE__ */ P(_t, {
3542
+ insts: h,
3543
+ idx: b,
3544
+ onSelect: x,
3545
+ onWrite: A,
3546
+ marked: S,
3547
+ onMark: w,
3548
+ onGroup: le,
3549
+ onUngroup: de
3550
+ }),
3551
+ /* @__PURE__ */ P(O, {
3552
+ variant: "primary",
3553
+ size: p,
3554
+ className: "w-full",
3555
+ title: "Edit elements on the canvas (click to select, drag to move, corners to scale)",
3556
+ onClick: () => window.dispatchEvent(new CustomEvent("kol:kinetic-edit", { detail: {
3557
+ id: e.id,
3558
+ index: b
3559
+ } })),
3560
+ children: "Edit on canvas"
3561
+ })
3562
+ ]
3563
+ }),
3564
+ s,
3565
+ (o === "generate" || o === "labs-effect") && /* @__PURE__ */ F(he, { children: [
3566
+ /* @__PURE__ */ P(k, {
3567
+ label: "Text",
3568
+ children: /* @__PURE__ */ P(ce, {
3569
+ variant: "filled",
3570
+ size: p,
3571
+ rows: 2,
3572
+ axis: "y",
3573
+ value: h[b]?.text ?? "",
3574
+ onChange: (e) => j(b, { text: e.target.value })
3575
+ })
3576
+ }),
3577
+ /* @__PURE__ */ F("div", {
3578
+ className: "grid grid-cols-2 gap-2",
3579
+ children: [/* @__PURE__ */ P(k, {
3580
+ label: "Theme",
3581
+ children: /* @__PURE__ */ P(ie, {
3582
+ variant: "subtle",
3583
+ size: p,
3584
+ className: "w-full",
3585
+ options: ee,
3586
+ value: e.themeId ?? "kol",
3587
+ onChange: (t) => _e(t, !!e.themeInvert)
3588
+ })
3589
+ }), /* @__PURE__ */ P(k, {
3590
+ label: "Invert",
3591
+ children: /* @__PURE__ */ P(ue, {
3592
+ options: [{
3593
+ value: "off",
3594
+ label: "Off"
3595
+ }, {
3596
+ value: "on",
3597
+ label: "On"
3598
+ }],
3599
+ viewMode: e.themeInvert ? "on" : "off",
3600
+ onViewChange: (t) => _e(e.themeId ?? "kol", t === "on")
3601
+ })
3602
+ })]
3603
+ }),
3604
+ /* @__PURE__ */ P(f, {
3605
+ label: "Text colour",
3606
+ value: h[0]?.fill,
3607
+ onChange: (e) => ve(c(e, i) ?? e),
3608
+ palette: i
3609
+ }),
3610
+ /* @__PURE__ */ F("div", {
3611
+ className: "grid grid-cols-2 gap-2",
3612
+ children: [/* @__PURE__ */ P(O, {
3613
+ variant: "primary",
3614
+ size: p,
3615
+ onClick: ge,
3616
+ children: "Randomise"
3617
+ }), /* @__PURE__ */ P(O, {
3618
+ variant: "primary",
3619
+ size: p,
3620
+ onClick: I,
3621
+ children: "All elements"
3622
+ })]
3623
+ }),
3624
+ /* @__PURE__ */ P(d, { seed: M })
3625
+ ] }),
3626
+ o === "anim" && /* @__PURE__ */ P(yt, {
3627
+ motions: E,
3628
+ mIdx: D,
3629
+ onSelect: T,
3630
+ onAdd: () => {
3631
+ A(h.map((e, t) => t === b ? {
3632
+ ...e,
3633
+ motions: [...E, { ...dt }]
3634
+ } : e)), T(E.length + 1);
3635
+ },
3636
+ onRemove: () => {
3637
+ D !== 0 && (A(h.map((e, t) => t === b ? {
3638
+ ...e,
3639
+ motions: E.filter((e, t) => t !== D - 1)
3640
+ } : e)), T(D - 1));
3641
+ }
3642
+ }),
3643
+ o !== "generate" && be.map((t, n) => /* @__PURE__ */ F(fe, { children: [
3644
+ t.key === "arrangement" && /* @__PURE__ */ F(he, { children: [/* @__PURE__ */ P("span", {
3645
+ className: "kol-helper-10 text-meta",
3646
+ children: "OpenType"
3647
+ }), /* @__PURE__ */ P(bt, {
3648
+ value: L?.opentype ?? {},
3649
+ onToggle: (e, t) => j(b, { opentype: {
3650
+ ...L?.opentype ?? {},
3651
+ [e]: t
3652
+ } })
3653
+ })] }),
3654
+ t.section && t.section !== be[n - 1]?.section && /* @__PURE__ */ P("span", {
3655
+ className: "kol-helper-10 text-meta",
3656
+ children: t.section
3657
+ }),
3658
+ /* @__PURE__ */ P(vt, {
3659
+ knob: t,
3660
+ comp: ae(t),
3661
+ idx: b,
3662
+ palette: i,
3663
+ onWrite: me
3664
+ }),
3665
+ t.key === "showPath" && L?.path?.type === "custom" && /* @__PURE__ */ P(xt, {
3666
+ inst: L,
3667
+ layer: e,
3668
+ onPoints: (e) => j(b, { path: {
3669
+ ...L?.path ?? {},
3670
+ points: e
3671
+ } })
3672
+ })
3673
+ ] }, t.key)),
3674
+ o === "anim" && xe && /* @__PURE__ */ P(St, {
3675
+ layer: e,
3676
+ setProp: n,
3677
+ insts: h,
3678
+ renderAnimate: a
3679
+ })
3680
+ ] });
3681
+ }
3682
+ function gt({ layer: e, onPreset: t }) {
3683
+ return /* @__PURE__ */ P(ne, {
3684
+ tree: Me,
3685
+ presets: V,
3686
+ current: V.find((t) => t.id === e.presetId) ?? V[0],
3687
+ onPick: t
3688
+ });
3689
+ }
3690
+ function _t({ insts: e, idx: n, onSelect: r, onWrite: i, marked: a, onMark: o, onGroup: s, onUngroup: c }) {
3691
+ let l = t(), u = () => {
3692
+ let t = e.length;
3693
+ for (; e.some((e) => e.id === `i${t}`);) t++;
3694
+ return `i${t}`;
3695
+ }, d = () => {
3696
+ let t = {
3697
+ id: u(),
3698
+ text: "Text"
3699
+ };
3700
+ e[n]?.fill && (t.fill = e[n].fill), i([...e, De(t, e.length)]), r(e.length);
3701
+ }, f = (t) => {
3702
+ let n = {
3703
+ ...structuredClone(e[t]),
3704
+ id: u()
3705
+ }, a = [...e];
3706
+ a.splice(t + 1, 0, n), i(a), r(t + 1);
3707
+ }, p = (t) => {
3708
+ e.length <= 1 || (i(e.filter((e, n) => n !== t)), r(Math.min(t, e.length - 2)));
3709
+ }, h = (t) => {
3710
+ let a = n + t;
3711
+ if (a < 0 || a >= e.length) return;
3712
+ let o = [...e], [s] = o.splice(n, 1);
3713
+ o.splice(a, 0, s), i(o), r(a);
3714
+ }, g = [...new Set(e.map((e) => e.group).filter(Boolean))];
3715
+ return /* @__PURE__ */ F(he, { children: [
3716
+ /* @__PURE__ */ P("div", {
3717
+ className: "flex flex-col gap-1",
3718
+ children: e.map((t, i) => {
3719
+ let s = mt(t.group, g);
3720
+ return /* @__PURE__ */ F("div", {
3721
+ onClick: () => r(i),
3722
+ className: `flex items-center gap-2 pl-2 pr-1 py-1 rounded cursor-pointer kol-helper-12 ${i === n ? "bg-[color-mix(in_srgb,var(--kol-accent-primary)_26%,transparent)] text-emphasis" : "text-body hover:bg-fg-04 hover:text-emphasis"}`,
3723
+ children: [
3724
+ /* @__PURE__ */ P("span", {
3725
+ onClick: (e) => e.stopPropagation(),
3726
+ className: "shrink-0",
3727
+ style: { lineHeight: 0 },
3728
+ children: /* @__PURE__ */ P(le, {
3729
+ checked: a.includes(t.id),
3730
+ onChange: () => o(t.id)
3731
+ })
3732
+ }),
3733
+ /* @__PURE__ */ P("span", {
3734
+ className: "kol-helper-10 text-meta shrink-0",
3735
+ children: i + 1
3736
+ }),
3737
+ /* @__PURE__ */ P("span", {
3738
+ className: "truncate flex-1 min-w-0",
3739
+ children: t.text || "—"
3740
+ }),
3741
+ s && /* @__PURE__ */ F("span", {
3742
+ className: "shrink-0 kol-helper-10 text-meta",
3743
+ children: ["grp ", s]
3744
+ }),
3745
+ /* @__PURE__ */ P(O, {
3746
+ iconComponent: m,
3747
+ variant: "ghost",
3748
+ size: l,
3749
+ quiet: !0,
3750
+ iconOnly: "duplicate",
3751
+ iconSize: 12,
3752
+ "aria-label": "Duplicate element",
3753
+ title: "Duplicate element",
3754
+ onClick: (e) => {
3755
+ e.stopPropagation(), f(i);
3756
+ }
3757
+ }),
3758
+ /* @__PURE__ */ P(O, {
3759
+ iconComponent: m,
3760
+ variant: "ghost",
3761
+ size: l,
3762
+ quiet: !0,
3763
+ iconOnly: "close",
3764
+ iconSize: 10,
3765
+ "aria-label": "Remove element",
3766
+ title: "Remove element",
3767
+ disabled: e.length <= 1,
3768
+ onClick: (e) => {
3769
+ e.stopPropagation(), p(i);
3770
+ }
3771
+ })
3772
+ ]
3773
+ }, t.id ?? i);
3774
+ })
3775
+ }),
3776
+ /* @__PURE__ */ F("div", {
3777
+ className: "grid grid-cols-2 gap-1",
3778
+ children: [/* @__PURE__ */ P(O, {
3779
+ variant: "primary",
3780
+ size: l,
3781
+ disabled: a.length < 2,
3782
+ onClick: s,
3783
+ children: "Group"
3784
+ }), /* @__PURE__ */ P(O, {
3785
+ variant: "primary",
3786
+ size: l,
3787
+ disabled: !a.length,
3788
+ onClick: c,
3789
+ children: "Ungroup"
3790
+ })]
3791
+ }),
3792
+ /* @__PURE__ */ F("div", {
3793
+ className: "flex items-center gap-1",
3794
+ children: [
3795
+ /* @__PURE__ */ P(O, {
3796
+ iconComponent: m,
3797
+ variant: "primary",
3798
+ size: l,
3799
+ className: "flex-1",
3800
+ iconLeft: "plus",
3801
+ iconSize: 12,
3802
+ onClick: d,
3803
+ children: "Add element"
3804
+ }),
3805
+ /* @__PURE__ */ P(O, {
3806
+ variant: "ghost",
3807
+ size: l,
3808
+ quiet: !0,
3809
+ style: pt,
3810
+ "aria-label": "Move element up",
3811
+ title: "Move element up",
3812
+ disabled: n <= 0,
3813
+ onClick: () => h(-1),
3814
+ children: /* @__PURE__ */ P(m, {
3815
+ name: "chevron-down",
3816
+ size: 12,
3817
+ style: { transform: "rotate(180deg)" }
3818
+ })
3819
+ }),
3820
+ /* @__PURE__ */ P(O, {
3821
+ variant: "ghost",
3822
+ size: l,
3823
+ quiet: !0,
3824
+ style: pt,
3825
+ "aria-label": "Move element down",
3826
+ title: "Move element down",
3827
+ disabled: n >= e.length - 1,
3828
+ onClick: () => h(1),
3829
+ children: /* @__PURE__ */ P(m, {
3830
+ name: "chevron-down",
3831
+ size: 12
3832
+ })
3833
+ })
3834
+ ]
3835
+ })
3836
+ ] });
3837
+ }
3838
+ function vt({ knob: e, comp: n, idx: r, palette: i, onWrite: a }) {
3839
+ let o = t(), s = e.get(n, r), l = (t) => a(e, t);
3840
+ if (e.type === "color") return /* @__PURE__ */ P(f, {
3841
+ label: e.label,
3842
+ value: s,
3843
+ onChange: (e) => l(c(e, i) ?? e),
3844
+ palette: i
3845
+ });
3846
+ if (e.type === "select") return /* @__PURE__ */ P(k, {
3847
+ label: e.label,
3848
+ children: /* @__PURE__ */ P(ie, {
3849
+ variant: "subtle",
3850
+ size: o,
3851
+ className: "w-full",
3852
+ options: ot(e, n, r),
3853
+ value: s,
3854
+ onChange: l
3855
+ })
3856
+ });
3857
+ let { min: u, max: d } = st(e, n, r);
3858
+ return /* @__PURE__ */ P(k, {
3859
+ label: e.label,
3860
+ children: /* @__PURE__ */ P(j, {
3861
+ min: u,
3862
+ max: d,
3863
+ step: e.step ?? 1,
3864
+ value: typeof s == "number" ? s : u,
3865
+ onChange: l
3866
+ })
3867
+ });
3868
+ }
3869
+ function yt({ motions: e, mIdx: n, onSelect: r, onAdd: i, onRemove: a }) {
3870
+ let o = t(), s = [{
3871
+ value: "0",
3872
+ label: "1"
3873
+ }, ...e.map((e, t) => ({
3874
+ value: String(t + 1),
3875
+ label: String(t + 2)
3876
+ }))];
3877
+ return /* @__PURE__ */ F("div", {
3878
+ className: "flex flex-col gap-1",
3879
+ children: [/* @__PURE__ */ P("span", {
3880
+ className: "kol-helper-10 text-meta",
3881
+ children: "Motion layers"
3882
+ }), /* @__PURE__ */ F("div", {
3883
+ className: "flex items-center gap-1",
3884
+ children: [
3885
+ /* @__PURE__ */ P("div", {
3886
+ className: "flex-1 min-w-0",
3887
+ children: /* @__PURE__ */ P(A, {
3888
+ value: String(n),
3889
+ onChange: (e) => r(Number(e)),
3890
+ options: s
3891
+ })
3892
+ }),
3893
+ /* @__PURE__ */ P(O, {
3894
+ iconComponent: m,
3895
+ variant: "ghost",
3896
+ size: o,
3897
+ quiet: !0,
3898
+ iconOnly: "plus",
3899
+ iconSize: 12,
3900
+ "aria-label": "Add motion layer",
3901
+ title: "Add motion layer",
3902
+ onClick: i
3903
+ }),
3904
+ /* @__PURE__ */ P(O, {
3905
+ iconComponent: m,
3906
+ variant: "ghost",
3907
+ size: o,
3908
+ quiet: !0,
3909
+ iconOnly: "close",
3910
+ iconSize: 10,
3911
+ "aria-label": "Remove motion layer",
3912
+ title: "Remove motion layer (the primary can only be set to None)",
3913
+ disabled: n === 0,
3914
+ onClick: a
3915
+ })
3916
+ ]
3917
+ })]
3918
+ });
3919
+ }
3920
+ function bt({ value: e = {}, onToggle: t }) {
3921
+ let [n, r] = N(!1), i = de({
3922
+ open: n,
3923
+ onOpenChange: r,
3924
+ placement: "bottom-start",
3925
+ offset: -1,
3926
+ flip: !1,
3927
+ matchReferenceWidth: !0,
3928
+ role: "listbox"
3929
+ }), a = Be.filter((t) => e[t.tag]).length;
3930
+ return /* @__PURE__ */ F("div", {
3931
+ className: "relative w-full",
3932
+ children: [/* @__PURE__ */ F("button", {
3933
+ ref: i.refs.setReference,
3934
+ ...i.getReferenceProps(),
3935
+ type: "button",
3936
+ className: "w-full flex items-center justify-between kol-helper-12 rounded",
3937
+ style: {
3938
+ border: "1px solid transparent",
3939
+ borderRadius: n ? "4px 4px 0 0" : "4px",
3940
+ backgroundColor: "var(--kol-surface-secondary)",
3941
+ color: "var(--kol-surface-on-primary)",
3942
+ padding: "4px 12px",
3943
+ cursor: "pointer"
3944
+ },
3945
+ "aria-haspopup": "listbox",
3946
+ "aria-expanded": n,
3947
+ children: [/* @__PURE__ */ P("span", { children: a ? `${a} feature${a > 1 ? "s" : ""}` : "None" }), /* @__PURE__ */ P(m, {
3948
+ name: "chevron-down",
3949
+ size: 10,
3950
+ className: "ml-auto",
3951
+ style: {
3952
+ transform: n ? "rotate(180deg)" : "rotate(0deg)",
3953
+ transition: "transform 300ms"
3954
+ }
3955
+ })]
3956
+ }), /* @__PURE__ */ P(se, {
3957
+ popover: i,
3958
+ panel: !1,
3959
+ focus: !1,
3960
+ style: {
3961
+ backgroundColor: "var(--kol-surface-secondary)",
3962
+ color: "var(--kol-surface-on-primary)",
3963
+ borderRadius: "0 0 4px 4px",
3964
+ zIndex: 200
3965
+ },
3966
+ children: /* @__PURE__ */ P("div", {
3967
+ className: "flex max-h-[300px] flex-col items-stretch overflow-y-auto",
3968
+ role: "listbox",
3969
+ children: Be.map((n) => /* @__PURE__ */ P(oe, {
3970
+ onClick: () => t(n.tag, !e[n.tag]),
3971
+ shortcut: e[n.tag] ? /* @__PURE__ */ P(m, {
3972
+ name: "check",
3973
+ size: 11
3974
+ }) : void 0,
3975
+ children: n.label
3976
+ }, n.tag))
3977
+ })
3978
+ })]
3979
+ });
3980
+ }
3981
+ function xt({ inst: e, layer: n, onPoints: r }) {
3982
+ let i = t(), a = M(null), o = M(null), s = e?.path?.points, c = Array.isArray(s) && s.length >= 2 ? s : ve, l = n.w > 0 && n.h > 0 ? n.w / n.h : 1, u = Ce("custom", 100, 100, { points: c }).d, d = (e) => (t) => {
3983
+ t.preventDefault(), t.stopPropagation(), t.currentTarget.setPointerCapture(t.pointerId), o.current = { i: e };
3984
+ }, f = (e) => {
3985
+ let t = o.current, n = a.current;
3986
+ if (!t || !n) return;
3987
+ let i = n.getBoundingClientRect();
3988
+ if (!i.width || !i.height) return;
3989
+ let s = Math.max(0, Math.min(1, (e.clientX - i.left) / i.width)), l = Math.max(0, Math.min(1, (e.clientY - i.top) / i.height));
3990
+ r(c.map((e, n) => n === t.i ? [Number(s.toFixed(3)), Number(l.toFixed(3))] : e));
3991
+ }, p = (e) => {
3992
+ o.current = null;
3993
+ try {
3994
+ e.currentTarget.releasePointerCapture(e.pointerId);
3995
+ } catch {}
3996
+ };
3997
+ return /* @__PURE__ */ F("div", {
3998
+ className: "flex flex-col gap-2",
3999
+ children: [/* @__PURE__ */ F("div", {
4000
+ ref: a,
4001
+ className: "relative w-full rounded border border-oq-08 overflow-hidden",
4002
+ style: { aspectRatio: `${l}` },
4003
+ children: [/* @__PURE__ */ P("svg", {
4004
+ className: "absolute inset-0 w-full h-full",
4005
+ viewBox: "0 0 100 100",
4006
+ preserveAspectRatio: "none",
4007
+ children: /* @__PURE__ */ P("path", {
4008
+ d: u,
4009
+ fill: "none",
4010
+ stroke: "var(--kol-accent-primary)",
4011
+ strokeWidth: 1.5,
4012
+ vectorEffect: "non-scaling-stroke"
4013
+ })
4014
+ }), c.map((e, t) => /* @__PURE__ */ P("div", {
4015
+ onPointerDown: d(t),
4016
+ onPointerMove: f,
4017
+ onPointerUp: p,
4018
+ className: "absolute cursor-grab rounded-full",
4019
+ style: {
4020
+ left: `${e[0] * 100}%`,
4021
+ top: `${e[1] * 100}%`,
4022
+ width: 12,
4023
+ height: 12,
4024
+ marginLeft: -6,
4025
+ marginTop: -6,
4026
+ background: "var(--kol-accent-primary)",
4027
+ border: "2px solid white",
4028
+ boxShadow: "0 0 0 1px rgba(0,0,0,0.5)"
4029
+ }
4030
+ }, t))]
4031
+ }), /* @__PURE__ */ F("div", {
4032
+ className: "grid grid-cols-2 gap-2",
4033
+ children: [/* @__PURE__ */ P(O, {
4034
+ variant: "primary",
4035
+ size: i,
4036
+ onClick: () => r([...c, [.5, .5]]),
4037
+ children: "Add point"
4038
+ }), /* @__PURE__ */ P(O, {
4039
+ variant: "primary",
4040
+ size: i,
4041
+ disabled: c.length <= 2,
4042
+ onClick: () => r(c.slice(0, -1)),
4043
+ children: "Remove point"
4044
+ })]
4045
+ })]
4046
+ });
4047
+ }
4048
+ function St({ layer: e, setProp: t, insts: n, renderAnimate: r }) {
4049
+ let i = lt, a = e[i.key], s = o(a), c = n.find((e) => e?.morph?.on)?.morph?.blend ?? i.default, l = typeof a == "number" ? a : c, u = s ? /* @__PURE__ */ P("div", {
4050
+ className: "kol-helper-12 text-meta italic px-1",
4051
+ children: "animated"
4052
+ }) : /* @__PURE__ */ P(j, {
4053
+ min: i.min,
4054
+ max: i.max,
4055
+ step: i.step,
4056
+ value: l,
4057
+ onChange: (e) => t(i.key, e)
4058
+ });
4059
+ return /* @__PURE__ */ P(k, {
4060
+ label: i.label,
4061
+ children: /* @__PURE__ */ F("div", {
4062
+ className: "flex items-center gap-2",
4063
+ children: [/* @__PURE__ */ P("div", {
4064
+ className: "flex-1 min-w-0",
4065
+ children: u
4066
+ }), r(i)]
4067
+ })
4068
+ });
4069
+ }
4070
+ //#endregion
4071
+ //#region src/editor/params/TimelineDock.jsx
4072
+ function Ct(e, t = []) {
4073
+ for (let n of e) {
4074
+ for (let e in n) {
4075
+ let r = n[e];
4076
+ o(r) && r.bind === "track" && t.push({
4077
+ layer: n,
4078
+ key: e,
4079
+ keys: r.keys
4080
+ });
4081
+ }
4082
+ Array.isArray(n.children) && Ct(n.children, t);
4083
+ }
4084
+ return t;
4085
+ }
4086
+ function wt() {
4087
+ let { layers: t, updateLayer: r } = n(), { t: i, seek: a } = e(), o = me(() => Ct(t), [t]), [s, c] = N(null);
4088
+ if (o.length === 0) return null;
4089
+ let l = (e, t) => {
4090
+ let n = [...t].sort((e, t) => e.t - t.t);
4091
+ r(e.layer.id, { [e.key]: {
4092
+ bind: "track",
4093
+ keys: n
4094
+ } });
4095
+ };
4096
+ return /* @__PURE__ */ F("div", {
4097
+ className: "border-t border-oq-08 px-4 py-2 flex flex-col gap-1 select-none",
4098
+ style: { background: "var(--kol-surface-primary)" },
4099
+ children: [
4100
+ /* @__PURE__ */ P(Tt, {
4101
+ t: i,
4102
+ seek: a
4103
+ }),
4104
+ o.map((e) => /* @__PURE__ */ P(Dt, {
4105
+ track: e,
4106
+ t: i,
4107
+ selected: s,
4108
+ setSelected: c,
4109
+ writeKeys: l
4110
+ }, `${e.layer.id}:${e.key}`)),
4111
+ /* @__PURE__ */ P(kt, {
4112
+ tracks: o,
4113
+ selected: s,
4114
+ setSelected: c,
4115
+ writeKeys: l
4116
+ })
4117
+ ]
4118
+ });
4119
+ }
4120
+ function Tt({ t: e, seek: t }) {
4121
+ let n = M(null), r = (e) => {
4122
+ let t = n.current.getBoundingClientRect();
4123
+ return Math.min(1, Math.max(0, (e.clientX - t.left) / t.width));
4124
+ };
4125
+ return /* @__PURE__ */ F("div", {
4126
+ className: "flex items-center gap-3",
4127
+ children: [/* @__PURE__ */ P("span", {
4128
+ className: "kol-mono-12 text-meta tabular-nums shrink-0 text-right",
4129
+ style: { width: 120 },
4130
+ children: e.toFixed(2)
4131
+ }), /* @__PURE__ */ P("div", {
4132
+ ref: n,
4133
+ className: "relative flex-1 h-4 cursor-ew-resize rounded",
4134
+ style: { background: "var(--kol-fg-04)" },
4135
+ onPointerDown: (e) => {
4136
+ e.currentTarget.setPointerCapture(e.pointerId), t(r(e));
4137
+ },
4138
+ onPointerMove: (e) => {
4139
+ e.buttons & 1 && t(r(e));
4140
+ },
4141
+ children: /* @__PURE__ */ P(Et, { t: e })
4142
+ })]
4143
+ });
4144
+ }
4145
+ function Et({ t: e }) {
4146
+ return /* @__PURE__ */ P("span", {
4147
+ "aria-hidden": "true",
4148
+ className: "absolute top-0 bottom-0",
4149
+ style: {
4150
+ left: `${e * 100}%`,
4151
+ width: 1.5,
4152
+ background: "var(--kol-accent-primary)"
4153
+ }
4154
+ });
4155
+ }
4156
+ function Dt({ track: e, t, selected: n, setSelected: r, writeKeys: i }) {
4157
+ let a = M(null), o = M(null), [, s] = N(0), c = (e) => {
4158
+ let t = a.current.getBoundingClientRect();
4159
+ return Math.min(1, Math.max(0, (e.clientX - t.left) / t.width));
4160
+ }, l = (t) => n && n.layerId === e.layer.id && n.key === e.key && n.index === t, u = (t) => {
4161
+ if (t.target.dataset.diamond !== void 0) return;
4162
+ let n = c(t), a = Ot(e.keys, n), o = [...e.keys, {
4163
+ t: n,
4164
+ v: a,
4165
+ easing: "linear"
4166
+ }].sort((e, t) => e.t - t.t);
4167
+ i(e, o), r({
4168
+ layerId: e.layer.id,
4169
+ key: e.key,
4170
+ index: o.findIndex((e) => e.t === n)
4171
+ });
4172
+ }, d = (t) => (n) => {
4173
+ if (n.stopPropagation(), n.altKey) {
4174
+ e.keys.length > 1 && (i(e, e.keys.filter((e, n) => n !== t)), r(null));
4175
+ return;
4176
+ }
4177
+ n.currentTarget.setPointerCapture(n.pointerId), o.current = {
4178
+ index: t,
4179
+ t: e.keys[t].t
4180
+ }, r({
4181
+ layerId: e.layer.id,
4182
+ key: e.key,
4183
+ index: t
4184
+ });
4185
+ }, f = (e) => (t) => {
4186
+ !o.current || o.current.index !== e || (o.current.t = c(t), s((e) => e + 1));
4187
+ }, p = (t) => () => {
4188
+ if (!o.current || o.current.index !== t) return;
4189
+ let n = {
4190
+ ...e.keys[t],
4191
+ t: o.current.t
4192
+ }, a = e.keys.map((e, r) => r === t ? n : e);
4193
+ o.current = null, i(e, a), r(null);
4194
+ };
4195
+ return /* @__PURE__ */ F("div", {
4196
+ className: "flex items-center gap-3",
4197
+ children: [/* @__PURE__ */ F("span", {
4198
+ className: "kol-helper-10 text-meta truncate shrink-0 text-right",
4199
+ style: { width: 120 },
4200
+ title: `${re(e.layer)} · ${e.key}`,
4201
+ children: [
4202
+ re(e.layer),
4203
+ " · ",
4204
+ e.key
4205
+ ]
4206
+ }), /* @__PURE__ */ F("div", {
4207
+ ref: a,
4208
+ className: "relative flex-1 h-5 rounded cursor-copy",
4209
+ style: { background: "var(--kol-fg-04)" },
4210
+ onPointerDown: u,
4211
+ children: [/* @__PURE__ */ P(Et, { t }), e.keys.map((e, t) => {
4212
+ let n = o.current?.index === t ? o.current.t : e.t;
4213
+ return /* @__PURE__ */ P("span", {
4214
+ "data-diamond": "",
4215
+ onPointerDown: d(t),
4216
+ onPointerMove: f(t),
4217
+ onPointerUp: p(t),
4218
+ title: `t=${n.toFixed(2)} v=${typeof e.v == "number" ? Math.round(e.v * 100) / 100 : e.v} (alt-click deletes)`,
4219
+ className: "absolute top-1/2 cursor-grab",
4220
+ style: {
4221
+ left: `${n * 100}%`,
4222
+ width: 9,
4223
+ height: 9,
4224
+ transform: "translate(-50%, -50%) rotate(45deg)",
4225
+ background: l(t) ? "var(--kol-accent-primary)" : "var(--kol-fg-emphasis)",
4226
+ borderRadius: 1.5
4227
+ }
4228
+ }, t);
4229
+ })]
4230
+ })]
4231
+ });
4232
+ }
4233
+ function Ot(e, t) {
4234
+ if (e.length === 0) return 0;
4235
+ if (t <= e[0].t) return e[0].v;
4236
+ let n = e[e.length - 1];
4237
+ if (t >= n.t) return n.v;
4238
+ let r = 0;
4239
+ for (; r < e.length - 1 && e[r + 1].t <= t;) r++;
4240
+ let i = e[r], a = e[r + 1];
4241
+ if (typeof i.v != "number" || typeof a.v != "number") return i.v;
4242
+ let o = a.t - i.t || 1;
4243
+ return i.v + (a.v - i.v) * ((t - i.t) / o);
4244
+ }
4245
+ function kt({ tracks: e, selected: t, setSelected: n, writeKeys: i }) {
4246
+ if (!t) return null;
4247
+ let a = e.find((e) => e.layer.id === t.layerId && e.key === t.key), o = a?.keys[t.index];
4248
+ if (!o) return null;
4249
+ let s = (e) => {
4250
+ i(a, a.keys.map((n, r) => r === t.index ? {
4251
+ ...n,
4252
+ ...e
4253
+ } : n));
4254
+ }, c = typeof o.v == "number";
4255
+ return /* @__PURE__ */ F("div", {
4256
+ className: "flex items-center gap-2 pt-1",
4257
+ children: [
4258
+ /* @__PURE__ */ F("span", {
4259
+ className: "kol-helper-10 text-meta shrink-0",
4260
+ children: ["key @ ", o.t.toFixed(2)]
4261
+ }),
4262
+ /* @__PURE__ */ P(ae, {
4263
+ variant: "ghost",
4264
+ size: "sm",
4265
+ chars: 7,
4266
+ type: c ? "number" : "text",
4267
+ value: String(o.v),
4268
+ onChange: (e) => s({ v: c ? Number(e.target.value) || 0 : e.target.value })
4269
+ }),
4270
+ /* @__PURE__ */ P(ie, {
4271
+ variant: "subtle",
4272
+ size: "sm",
4273
+ options: r,
4274
+ value: Array.isArray(o.easing) ? "linear" : o.easing ?? "linear",
4275
+ onChange: (e) => s({ easing: e })
4276
+ }),
4277
+ /* @__PURE__ */ P("button", {
4278
+ type: "button",
4279
+ className: "kol-helper-10 text-meta hover:text-emphasis px-2",
4280
+ style: {
4281
+ background: "transparent",
4282
+ border: "none",
4283
+ cursor: "pointer"
4284
+ },
4285
+ onClick: () => {
4286
+ a.keys.length > 1 && i(a, a.keys.filter((e, n) => n !== t.index)), n(null);
4287
+ },
4288
+ children: "Delete key"
4289
+ }),
4290
+ /* @__PURE__ */ P("button", {
4291
+ type: "button",
4292
+ className: "kol-helper-10 text-meta hover:text-emphasis px-2 ml-auto",
4293
+ style: {
4294
+ background: "transparent",
4295
+ border: "none",
4296
+ cursor: "pointer"
4297
+ },
4298
+ onClick: () => n(null),
4299
+ children: "Close"
4300
+ })
4301
+ ]
4302
+ });
4303
+ }
4304
+ //#endregion
4305
+ //#region src/packs/motion.js
4306
+ var At = {
4307
+ layerTypes: ["kinetic"],
4308
+ kineticPresetById: Ae,
4309
+ presetComp: Ne,
4310
+ KineticType: Ge,
4311
+ loadFonts: te,
4312
+ warmFontCss: S,
4313
+ kineticFontCss: b,
4314
+ KineticPanel: ht,
4315
+ TimelineDock: wt
4316
+ };
4317
+ h("motion", At);
4318
+ //#endregion
4319
+ export { V as a, ct as i, wt as n, Me as o, ht as r, Ne as s, At as t };