@kolkrabbi/design-editor 0.13.0 → 0.15.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,2579 @@
1
+ import { Ft as e, S as t, V as n, Xt as r, Zt as i, a, c as o, i as s, j as c, l, n as u, o as d, s as f, t as p, u as m, x as h, z as g } from "./rolls-CkmuE-Ya.js";
2
+ import { A as ee, F as _, I as te, L as ne, M as v, N as y, P as b, Q as x, R as re, X as S, Y as C, Z as w, a as ie, c as ae, d as T, f as E, i as oe, j as D, l as O, n as k, o as se, p as ce, s as A, u as j } from "./registry-CSOtIU7o.js";
3
+ import { a as M, i as le, n as N, t as ue, y as P } from "./TreePicker-D5XZT0Zi.js";
4
+ import { n as F, t as de } from "./useLayerEdit-BDXtPeAP.js";
5
+ import { i as fe, t as pe } from "./RuleRow-4eAy_jzf.js";
6
+ import { Button as I, CurveEditor as L, Dropdown as R, KeyframeEditor as me, LabeledControl as z, LabeledControlSection as he, SegmentedToggle as ge, SettingsRow as _e, Slider as ve, Tooltip as B, ViewToggle as ye, XYPad as be } from "@kolkrabbi/kol-component";
7
+ import { useEffect as xe, useRef as Se, useState as Ce } from "react";
8
+ import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
9
+ //#region src/loops/taxonomy.js
10
+ var we = [
11
+ {
12
+ label: "Scanline",
13
+ groups: ["scanline"]
14
+ },
15
+ {
16
+ label: "Pattern",
17
+ groups: ["pattern"]
18
+ },
19
+ {
20
+ label: "Loops",
21
+ groups: [
22
+ "shape",
23
+ "field",
24
+ "patternloop"
25
+ ]
26
+ },
27
+ {
28
+ label: "Math",
29
+ groups: ["math"]
30
+ },
31
+ {
32
+ label: "Penrose",
33
+ groups: ["penrose"]
34
+ },
35
+ {
36
+ label: "Drift",
37
+ groups: ["drift"]
38
+ },
39
+ {
40
+ label: "Gradients",
41
+ groups: ["gradients"]
42
+ },
43
+ {
44
+ label: "Soft Forms",
45
+ groups: ["softforms"]
46
+ },
47
+ {
48
+ label: "Soft Forms 3D",
49
+ groups: ["softforms3d"]
50
+ },
51
+ {
52
+ label: "3D Scene",
53
+ groups: [
54
+ "scene",
55
+ "ribbon",
56
+ "forms",
57
+ "environment",
58
+ "abstract"
59
+ ],
60
+ labels: { scene: "Primitive" }
61
+ }
62
+ ], Te = [{
63
+ label: "Para Type",
64
+ groups: ["paratype"]
65
+ }], Ee = we, De = {
66
+ optic: "Pattern · Effects",
67
+ paratype: "Para Type · Misc",
68
+ distress: "Distressor · Vector",
69
+ modulator: "Modulator · Vector"
70
+ }, Oe = Object.fromEntries(ee.params.map((e) => [e.key, e.default]));
71
+ function ke(e) {
72
+ let t = { ...Oe };
73
+ for (let n of Object.keys(Oe)) {
74
+ let r = e[n];
75
+ r != null && typeof r != "object" && (t[n] = r);
76
+ }
77
+ return t;
78
+ }
79
+ function Ae(e, t) {
80
+ let n = t.stemWidth ?? 18, r = 0;
81
+ return (t.serif ?? 0) > 0 && (r = Math.max(2, n * .7) * t.serif + (t.jut ?? 0) * n * 1.5 + 1), e === "i" && (r = Math.max(r, n * .1 + 1)), r;
82
+ }
83
+ var W = (e) => Number(e.toFixed(2));
84
+ function je(e, t, n) {
85
+ if (!e || e.loopId !== "paratype-glyph") return null;
86
+ let r = Math.max(1, e.w ?? 480), i = Math.max(1, e.h ?? 480), a = ke(e), o = D(a, r, i);
87
+ if (!o.length) return null;
88
+ let s = [];
89
+ t.bg && s.push({
90
+ id: n("shape"),
91
+ type: "shape",
92
+ kind: "rect",
93
+ color: t.bg,
94
+ x: 0,
95
+ y: 0,
96
+ w: r,
97
+ h: i,
98
+ visible: !0,
99
+ opacity: 1,
100
+ blend: "normal"
101
+ });
102
+ for (let e of o) {
103
+ let r = Ae(e.name, a) + 1.5, i = 1.5, o = e.gw + r * 2, c = e.gh + i * 2, l = e.g.paths.map((e) => `<path d="${e.d.replace(/\s+/g, " ").trim()}"${e.fillRule ? ` fill-rule="${e.fillRule}"` : ""} fill="currentColor"/>`).join(""), u = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${W(o)} ${W(c)}" preserveAspectRatio="none"><g transform="translate(${W(r)} ${W(e.y1 + i)}) scale(1 -1)">${l}</g></svg>`;
104
+ s.push({
105
+ id: n("shape"),
106
+ type: "shape",
107
+ kind: "flatten",
108
+ svg: u,
109
+ fit: "fill",
110
+ color: t.fg,
111
+ x: W(e.tx - r * e.s),
112
+ y: W(e.ty - (e.y1 + i) * e.s),
113
+ w: Math.max(1, W(o * e.s)),
114
+ h: Math.max(1, W(c * e.s)),
115
+ visible: !0,
116
+ opacity: 1,
117
+ blend: "normal"
118
+ });
119
+ }
120
+ return {
121
+ id: n("group"),
122
+ type: "group",
123
+ x: e.x ?? 0,
124
+ y: e.y ?? 0,
125
+ w: r,
126
+ h: i,
127
+ visible: e.visible ?? !0,
128
+ opacity: e.opacity ?? 1,
129
+ blend: e.blend ?? "normal",
130
+ children: s
131
+ };
132
+ }
133
+ //#endregion
134
+ //#region src/editor/compose/inspectors/LoopPicker.jsx
135
+ function Me({ layer: e, tree: t = Ee, inline: n = !1 }) {
136
+ let { updateLayer: r } = c(), i = e.loopGroup ?? "shape", a = t.find((e) => e.groups.includes(i)) ?? null, o = T(i), s = o.find((t) => t.id === e.presetId), l = [...new Set(o.map((e) => e.sub).filter(Boolean))], u = s?.sub ?? l[0], d = l.length ? o.filter((e) => e.sub === u) : o, f = (t, n = i) => {
137
+ t && r(e.id, {
138
+ loopGroup: n,
139
+ presetId: t.id,
140
+ presetLabel: t.label,
141
+ loopId: t.loop,
142
+ _framePreset: "custom",
143
+ _formPreset: "custom",
144
+ _lookPreset: "custom",
145
+ ...j(t)
146
+ });
147
+ };
148
+ return /* @__PURE__ */ U(V, { children: [
149
+ t.length > 1 || !a ? /* @__PURE__ */ H(N, {
150
+ label: "Type",
151
+ inline: n,
152
+ children: /* @__PURE__ */ U("div", {
153
+ className: "flex flex-col gap-1 w-full",
154
+ children: [a ? /* @__PURE__ */ H(ue, {
155
+ options: t.map((e) => ({
156
+ value: e.label,
157
+ label: e.label
158
+ })),
159
+ value: a.label,
160
+ onChange: (e) => {
161
+ let n = t.find((t) => t.label === e);
162
+ n && f(T(n.groups[0])[0], n.groups[0]);
163
+ }
164
+ }) : /* @__PURE__ */ H("span", {
165
+ className: "kol-helper-12 text-meta px-1",
166
+ children: De[i] ?? k(i).label
167
+ }), a && a.groups.length > 1 && /* @__PURE__ */ H(ue, {
168
+ options: a.groups.map((e) => ({
169
+ value: e,
170
+ label: a.labels?.[e] ?? k(e).label
171
+ })),
172
+ value: i,
173
+ onChange: (e) => f(T(e)[0], e)
174
+ })]
175
+ })
176
+ }) : null,
177
+ l.length > 1 && /* @__PURE__ */ H(N, {
178
+ inline: n,
179
+ label: "Category",
180
+ options: l.map((e) => ({
181
+ value: e,
182
+ label: e
183
+ })),
184
+ value: u,
185
+ onChange: (e) => f(o.find((t) => t.sub === e))
186
+ }),
187
+ /* @__PURE__ */ H(N, {
188
+ inline: n,
189
+ label: "Preset",
190
+ options: d.map((e) => ({
191
+ value: e.id,
192
+ label: e.label
193
+ })),
194
+ value: e.presetId,
195
+ onChange: (e) => f(o.find((t) => t.id === e))
196
+ })
197
+ ] });
198
+ }
199
+ //#endregion
200
+ //#region src/editor/params/motionPresets.js
201
+ var Ne = (e) => r("generators")?.loopById(e) ?? null, Pe = {
202
+ frame: [
203
+ {
204
+ id: "static",
205
+ label: "Static",
206
+ params: { flow: 0 }
207
+ },
208
+ {
209
+ id: "drift",
210
+ label: "Drift",
211
+ params: {
212
+ flow: 1,
213
+ spin: 0
214
+ }
215
+ },
216
+ {
217
+ id: "spin",
218
+ label: "Spin",
219
+ params: {
220
+ flow: 1,
221
+ spin: 1
222
+ }
223
+ },
224
+ {
225
+ id: "rush",
226
+ label: "Rush",
227
+ params: {
228
+ flow: 2,
229
+ spin: 0
230
+ }
231
+ }
232
+ ],
233
+ form: [
234
+ {
235
+ id: "static",
236
+ label: "Static",
237
+ params: {
238
+ sweep: 0,
239
+ pulse: 0
240
+ }
241
+ },
242
+ {
243
+ id: "sweep",
244
+ label: "Sweep",
245
+ params: {
246
+ sweep: .6,
247
+ pulse: 0
248
+ }
249
+ },
250
+ {
251
+ id: "breathe",
252
+ label: "Breathe",
253
+ params: {
254
+ sweep: 0,
255
+ pulse: .5
256
+ }
257
+ },
258
+ {
259
+ id: "ripple",
260
+ label: "Ripple",
261
+ params: {
262
+ sweep: .5,
263
+ pulse: .4
264
+ }
265
+ }
266
+ ]
267
+ }, Fe = [
268
+ {
269
+ id: "static",
270
+ label: "Static",
271
+ params: { camFlow: 0 }
272
+ },
273
+ {
274
+ id: "pan-right",
275
+ label: "Pan Right",
276
+ params: {
277
+ camFlow: 1,
278
+ panDir: "right"
279
+ }
280
+ },
281
+ {
282
+ id: "pan-left",
283
+ label: "Pan Left",
284
+ params: {
285
+ camFlow: 1,
286
+ panDir: "left"
287
+ }
288
+ },
289
+ {
290
+ id: "pan-up",
291
+ label: "Pan Up",
292
+ params: {
293
+ camFlow: 1,
294
+ panDir: "up"
295
+ }
296
+ },
297
+ {
298
+ id: "pan-down",
299
+ label: "Pan Down",
300
+ params: {
301
+ camFlow: 1,
302
+ panDir: "down"
303
+ }
304
+ },
305
+ {
306
+ id: "drift",
307
+ label: "Drift",
308
+ params: {
309
+ camFlow: 1,
310
+ panDir: "diag"
311
+ }
312
+ },
313
+ {
314
+ id: "glide",
315
+ label: "Glide",
316
+ params: {
317
+ camFlow: 2,
318
+ panDir: "anti"
319
+ }
320
+ }
321
+ ], Ie = [
322
+ {
323
+ id: "static",
324
+ label: "Static",
325
+ params: {
326
+ spin: 0,
327
+ animAxis: "none",
328
+ animCycles: 1,
329
+ animWaves: 2,
330
+ pulse: 0,
331
+ fade: 0,
332
+ swing: 0,
333
+ colorMix: 0
334
+ }
335
+ },
336
+ {
337
+ id: "spin",
338
+ label: "Spin",
339
+ params: {
340
+ spin: 1,
341
+ animAxis: "none",
342
+ animCycles: 1,
343
+ animWaves: 2,
344
+ pulse: 0,
345
+ fade: 0,
346
+ swing: 0,
347
+ colorMix: 0
348
+ }
349
+ },
350
+ {
351
+ id: "breathe",
352
+ label: "Breathe",
353
+ params: {
354
+ spin: 0,
355
+ animAxis: "radial",
356
+ animCycles: 1,
357
+ animWaves: 2,
358
+ pulse: .6,
359
+ fade: 0,
360
+ swing: 0,
361
+ colorMix: 0
362
+ }
363
+ },
364
+ {
365
+ id: "pulse-wave",
366
+ label: "Pulse Wave",
367
+ params: {
368
+ spin: 0,
369
+ animAxis: "diag",
370
+ animCycles: 1,
371
+ animWaves: 3,
372
+ pulse: .7,
373
+ fade: 0,
374
+ swing: 0,
375
+ colorMix: 0
376
+ }
377
+ },
378
+ {
379
+ id: "fade-wave",
380
+ label: "Fade Wave",
381
+ params: {
382
+ spin: 0,
383
+ animAxis: "col",
384
+ animCycles: 1,
385
+ animWaves: 2,
386
+ pulse: 0,
387
+ fade: .8,
388
+ swing: 0,
389
+ colorMix: 0
390
+ }
391
+ },
392
+ {
393
+ id: "sway",
394
+ label: "Sway",
395
+ params: {
396
+ spin: 0,
397
+ animAxis: "diag",
398
+ animCycles: 1,
399
+ animWaves: 2,
400
+ pulse: 0,
401
+ fade: 0,
402
+ swing: 60,
403
+ colorMix: 0
404
+ }
405
+ },
406
+ {
407
+ id: "colour-sweep",
408
+ label: "Colour Sweep",
409
+ params: {
410
+ spin: 0,
411
+ animAxis: "diag",
412
+ animCycles: 1,
413
+ animWaves: 2,
414
+ pulse: 0,
415
+ fade: 0,
416
+ swing: 0,
417
+ colorMix: 1
418
+ }
419
+ },
420
+ {
421
+ id: "ripple",
422
+ label: "Ripple",
423
+ params: {
424
+ spin: 0,
425
+ animAxis: "radial",
426
+ animCycles: 1,
427
+ animWaves: 4,
428
+ pulse: .5,
429
+ fade: .5,
430
+ swing: 0,
431
+ colorMix: 0
432
+ }
433
+ }
434
+ ], Le = [
435
+ {
436
+ id: "static",
437
+ label: "Static",
438
+ params: {
439
+ camFlow: 0,
440
+ panDir: "right"
441
+ }
442
+ },
443
+ {
444
+ id: "drift",
445
+ label: "Drift",
446
+ params: {
447
+ camFlow: 1,
448
+ panDir: "right"
449
+ }
450
+ },
451
+ {
452
+ id: "reverse",
453
+ label: "Reverse",
454
+ params: {
455
+ camFlow: 1,
456
+ panDir: "left"
457
+ }
458
+ },
459
+ {
460
+ id: "glide",
461
+ label: "Glide",
462
+ params: {
463
+ camFlow: 2,
464
+ panDir: "right"
465
+ }
466
+ },
467
+ {
468
+ id: "rush",
469
+ label: "Rush",
470
+ params: {
471
+ camFlow: 3,
472
+ panDir: "right"
473
+ }
474
+ },
475
+ {
476
+ id: "bias",
477
+ label: "Bias",
478
+ params: {
479
+ camFlow: 1,
480
+ panDir: "right",
481
+ stripeAngle: 30
482
+ }
483
+ },
484
+ {
485
+ id: "diagonal",
486
+ label: "Diagonal",
487
+ params: {
488
+ camFlow: 1,
489
+ panDir: "right",
490
+ stripeAngle: 45
491
+ }
492
+ },
493
+ {
494
+ id: "counter",
495
+ label: "Counter",
496
+ params: {
497
+ camFlow: 1,
498
+ panDir: "right",
499
+ stripeAngle: 135
500
+ }
501
+ }
502
+ ], Re = [
503
+ {
504
+ id: "static",
505
+ label: "Static",
506
+ params: {
507
+ camFlow: 0,
508
+ waveFlow: 0,
509
+ panDir: "right"
510
+ }
511
+ },
512
+ {
513
+ id: "drift",
514
+ label: "Drift",
515
+ params: {
516
+ camFlow: 1,
517
+ waveFlow: 0,
518
+ panDir: "right"
519
+ }
520
+ },
521
+ {
522
+ id: "travel",
523
+ label: "Travel",
524
+ params: {
525
+ camFlow: 0,
526
+ waveFlow: 1,
527
+ panDir: "right"
528
+ }
529
+ },
530
+ {
531
+ id: "both",
532
+ label: "Both",
533
+ params: {
534
+ camFlow: 1,
535
+ waveFlow: 1,
536
+ panDir: "right"
537
+ }
538
+ },
539
+ {
540
+ id: "reverse",
541
+ label: "Reverse",
542
+ params: {
543
+ camFlow: 1,
544
+ waveFlow: 0,
545
+ panDir: "left"
546
+ }
547
+ },
548
+ {
549
+ id: "glide",
550
+ label: "Glide",
551
+ params: {
552
+ camFlow: 1,
553
+ waveFlow: 2,
554
+ panDir: "right"
555
+ }
556
+ },
557
+ {
558
+ id: "diagonal",
559
+ label: "Diagonal",
560
+ params: {
561
+ camFlow: 1,
562
+ waveFlow: 1,
563
+ panDir: "right",
564
+ stripeAngle: 45
565
+ }
566
+ }
567
+ ], ze = [
568
+ {
569
+ id: "static",
570
+ label: "Static",
571
+ params: {
572
+ fieldSway: 0,
573
+ fieldStagger: 0,
574
+ fieldCycles: 1
575
+ }
576
+ },
577
+ {
578
+ id: "sway",
579
+ label: "Sway",
580
+ params: {
581
+ fieldSway: .5,
582
+ fieldStagger: .3,
583
+ fieldCycles: 1
584
+ }
585
+ },
586
+ {
587
+ id: "alternate",
588
+ label: "Alternate",
589
+ params: {
590
+ fieldSway: .6,
591
+ fieldStagger: 1,
592
+ fieldCycles: 1
593
+ }
594
+ },
595
+ {
596
+ id: "ripple",
597
+ label: "Ripple",
598
+ params: {
599
+ fieldSway: .45,
600
+ fieldStagger: .5,
601
+ fieldCycles: 1
602
+ }
603
+ }
604
+ ], Be = [
605
+ {
606
+ id: "static",
607
+ label: "Static",
608
+ params: {
609
+ animAxis: "none",
610
+ animCycles: 1,
611
+ animWaves: 2,
612
+ pulse: 0,
613
+ fade: 0
614
+ }
615
+ },
616
+ {
617
+ id: "pulse",
618
+ label: "Pulse",
619
+ params: {
620
+ animAxis: "diag",
621
+ animCycles: 1,
622
+ animWaves: 3,
623
+ pulse: .6,
624
+ fade: 0
625
+ }
626
+ },
627
+ {
628
+ id: "fade",
629
+ label: "Fade",
630
+ params: {
631
+ animAxis: "col",
632
+ animCycles: 1,
633
+ animWaves: 2,
634
+ pulse: 0,
635
+ fade: .7
636
+ }
637
+ },
638
+ {
639
+ id: "ripple",
640
+ label: "Ripple",
641
+ params: {
642
+ animAxis: "radial",
643
+ animCycles: 1,
644
+ animWaves: 4,
645
+ pulse: .4,
646
+ fade: .4
647
+ }
648
+ }
649
+ ], Ve = {
650
+ frame: [
651
+ {
652
+ id: "static",
653
+ label: "Static",
654
+ params: { flow: 0 }
655
+ },
656
+ {
657
+ id: "drift",
658
+ label: "Drift",
659
+ params: {
660
+ flow: 1,
661
+ panDir: "right"
662
+ }
663
+ },
664
+ {
665
+ id: "reverse",
666
+ label: "Reverse",
667
+ params: {
668
+ flow: 1,
669
+ panDir: "left"
670
+ }
671
+ },
672
+ {
673
+ id: "rise",
674
+ label: "Rise",
675
+ params: {
676
+ flow: 1,
677
+ panDir: "up"
678
+ }
679
+ },
680
+ {
681
+ id: "fall",
682
+ label: "Fall",
683
+ params: {
684
+ flow: 1,
685
+ panDir: "down"
686
+ }
687
+ },
688
+ {
689
+ id: "diagonal",
690
+ label: "Diagonal",
691
+ params: {
692
+ flow: 1,
693
+ panDir: "diag"
694
+ }
695
+ },
696
+ {
697
+ id: "glide",
698
+ label: "Glide",
699
+ params: {
700
+ flow: 2,
701
+ panDir: "anti"
702
+ }
703
+ },
704
+ {
705
+ id: "rush",
706
+ label: "Rush",
707
+ params: {
708
+ flow: 3,
709
+ panDir: "right"
710
+ }
711
+ }
712
+ ],
713
+ form: [
714
+ {
715
+ id: "static",
716
+ label: "Static",
717
+ params: {
718
+ speed: 0,
719
+ stagger: 0,
720
+ pulse: 0,
721
+ fade: 0,
722
+ swing: 0
723
+ }
724
+ },
725
+ {
726
+ id: "scroll",
727
+ label: "Scroll",
728
+ params: {
729
+ speed: .45,
730
+ stagger: 0,
731
+ pulse: 0,
732
+ fade: 0,
733
+ swing: 0
734
+ }
735
+ },
736
+ {
737
+ id: "morph",
738
+ label: "Morph",
739
+ params: {
740
+ speed: .3,
741
+ stagger: .5,
742
+ pulse: 0,
743
+ fade: 0,
744
+ swing: 0
745
+ }
746
+ },
747
+ {
748
+ id: "sway",
749
+ label: "Sway",
750
+ params: {
751
+ speed: .3,
752
+ stagger: 0,
753
+ pulse: 0,
754
+ fade: 0,
755
+ swing: 30
756
+ }
757
+ },
758
+ {
759
+ id: "breathe",
760
+ label: "Breathe",
761
+ params: {
762
+ speed: .3,
763
+ stagger: 0,
764
+ pulse: .6,
765
+ fade: 0,
766
+ swing: 0
767
+ }
768
+ },
769
+ {
770
+ id: "shimmer",
771
+ label: "Shimmer",
772
+ params: {
773
+ speed: .4,
774
+ stagger: 0,
775
+ pulse: 0,
776
+ fade: .7,
777
+ swing: 0
778
+ }
779
+ },
780
+ {
781
+ id: "rich",
782
+ label: "Rich",
783
+ params: {
784
+ speed: .4,
785
+ stagger: .35,
786
+ pulse: .4,
787
+ fade: .3,
788
+ swing: 18
789
+ }
790
+ }
791
+ ]
792
+ }, He = {
793
+ frame: [
794
+ {
795
+ id: "static",
796
+ label: "Static",
797
+ params: { spin: 0 }
798
+ },
799
+ {
800
+ id: "orbit",
801
+ label: "Orbit",
802
+ params: { spin: 1 }
803
+ },
804
+ {
805
+ id: "spin",
806
+ label: "Spin",
807
+ params: { spin: 2 }
808
+ }
809
+ ],
810
+ form: [
811
+ {
812
+ id: "static",
813
+ label: "Static",
814
+ params: {
815
+ morph: 0,
816
+ ripple: 0,
817
+ fade: 0
818
+ }
819
+ },
820
+ {
821
+ id: "breathe",
822
+ label: "Breathe",
823
+ params: {
824
+ morph: .25,
825
+ ripple: 0,
826
+ fade: 0
827
+ }
828
+ },
829
+ {
830
+ id: "pulse",
831
+ label: "Pulse",
832
+ params: {
833
+ morph: .5,
834
+ ripple: 0,
835
+ fade: 0
836
+ }
837
+ },
838
+ {
839
+ id: "ripple",
840
+ label: "Ripple",
841
+ params: {
842
+ morph: 0,
843
+ ripple: .6,
844
+ fade: 0
845
+ }
846
+ },
847
+ {
848
+ id: "shimmer",
849
+ label: "Shimmer",
850
+ params: {
851
+ morph: 0,
852
+ ripple: 0,
853
+ fade: .6
854
+ }
855
+ },
856
+ {
857
+ id: "rich",
858
+ label: "Rich",
859
+ params: {
860
+ morph: .3,
861
+ ripple: .4,
862
+ fade: .3
863
+ }
864
+ }
865
+ ]
866
+ }, Ue = {
867
+ frame: [
868
+ {
869
+ id: "static",
870
+ label: "Static",
871
+ params: {
872
+ flowSpeed: 0,
873
+ swirl: 0,
874
+ drift: 0
875
+ }
876
+ },
877
+ {
878
+ id: "drift",
879
+ label: "Drift",
880
+ params: {
881
+ flowSpeed: 1,
882
+ swirl: 0,
883
+ drift: 0
884
+ }
885
+ },
886
+ {
887
+ id: "wind",
888
+ label: "Wind",
889
+ params: {
890
+ flowSpeed: 1,
891
+ swirl: 0,
892
+ drift: .6,
893
+ driftDir: "right"
894
+ }
895
+ },
896
+ {
897
+ id: "vortex",
898
+ label: "Vortex",
899
+ params: {
900
+ flowSpeed: 1,
901
+ swirl: .5,
902
+ drift: 0
903
+ }
904
+ },
905
+ {
906
+ id: "rush",
907
+ label: "Rush",
908
+ params: {
909
+ flowSpeed: 2.4,
910
+ swirl: 0,
911
+ drift: 0
912
+ }
913
+ }
914
+ ],
915
+ form: [
916
+ {
917
+ id: "lines",
918
+ label: "Lines",
919
+ params: {
920
+ dots: !1,
921
+ pulse: 0,
922
+ jitter: 0
923
+ }
924
+ },
925
+ {
926
+ id: "dots",
927
+ label: "Dots",
928
+ params: {
929
+ dots: !0,
930
+ pulse: 0,
931
+ jitter: 0
932
+ }
933
+ },
934
+ {
935
+ id: "pulse",
936
+ label: "Pulse",
937
+ params: {
938
+ dots: !1,
939
+ pulse: .6,
940
+ jitter: 0
941
+ }
942
+ },
943
+ {
944
+ id: "shimmer",
945
+ label: "Shimmer",
946
+ params: {
947
+ dots: !0,
948
+ pulse: .3,
949
+ jitter: .5
950
+ }
951
+ }
952
+ ]
953
+ }, We = {
954
+ frame: [
955
+ {
956
+ id: "static",
957
+ label: "Static",
958
+ params: {
959
+ hueSpeed: 0,
960
+ cspin: 0,
961
+ czoom: 0
962
+ }
963
+ },
964
+ {
965
+ id: "cycle",
966
+ label: "Cycle",
967
+ params: {
968
+ hueSpeed: 1,
969
+ cspin: 0,
970
+ czoom: 0
971
+ }
972
+ },
973
+ {
974
+ id: "turn",
975
+ label: "Turn",
976
+ params: {
977
+ hueSpeed: .4,
978
+ cspin: .6,
979
+ czoom: 0
980
+ }
981
+ },
982
+ {
983
+ id: "breathe",
984
+ label: "Breathe",
985
+ params: {
986
+ hueSpeed: .4,
987
+ cspin: 0,
988
+ czoom: .6
989
+ }
990
+ },
991
+ {
992
+ id: "rush",
993
+ label: "Rush",
994
+ params: {
995
+ hueSpeed: 2,
996
+ cspin: 1,
997
+ czoom: 0
998
+ }
999
+ }
1000
+ ],
1001
+ form: [
1002
+ {
1003
+ id: "static",
1004
+ label: "Static",
1005
+ params: {
1006
+ ringSpeed: 0,
1007
+ shade: 0
1008
+ }
1009
+ },
1010
+ {
1011
+ id: "rings",
1012
+ label: "Rings",
1013
+ params: {
1014
+ ringSpeed: 1,
1015
+ shade: 0
1016
+ }
1017
+ },
1018
+ {
1019
+ id: "pulse",
1020
+ label: "Pulse",
1021
+ params: {
1022
+ ringSpeed: 1,
1023
+ shade: .4
1024
+ }
1025
+ },
1026
+ {
1027
+ id: "fast",
1028
+ label: "Fast",
1029
+ params: {
1030
+ ringSpeed: 2.4,
1031
+ shade: 0
1032
+ }
1033
+ }
1034
+ ]
1035
+ }, Ge = {
1036
+ frame: [
1037
+ {
1038
+ id: "static",
1039
+ label: "Static",
1040
+ params: {
1041
+ vpSpin: 0,
1042
+ vpZoom: 1
1043
+ }
1044
+ },
1045
+ {
1046
+ id: "spin",
1047
+ label: "Spin",
1048
+ params: {
1049
+ vpSpin: 1,
1050
+ vpZoom: 1
1051
+ }
1052
+ },
1053
+ {
1054
+ id: "spin2",
1055
+ label: "Spin ×2",
1056
+ params: {
1057
+ vpSpin: 2,
1058
+ vpZoom: 1
1059
+ }
1060
+ },
1061
+ {
1062
+ id: "push",
1063
+ label: "Push in",
1064
+ params: {
1065
+ vpSpin: 0,
1066
+ vpZoom: 1.3
1067
+ }
1068
+ }
1069
+ ],
1070
+ form: [
1071
+ {
1072
+ id: "static",
1073
+ label: "Static",
1074
+ params: {
1075
+ vpPulse: 0,
1076
+ vpWobble: 0
1077
+ }
1078
+ },
1079
+ {
1080
+ id: "pulse",
1081
+ label: "Pulse",
1082
+ params: {
1083
+ vpPulse: .3,
1084
+ vpWobble: 0
1085
+ }
1086
+ },
1087
+ {
1088
+ id: "wobble",
1089
+ label: "Wobble",
1090
+ params: {
1091
+ vpPulse: 0,
1092
+ vpWobble: 8
1093
+ }
1094
+ },
1095
+ {
1096
+ id: "breathe",
1097
+ label: "Breathe",
1098
+ params: {
1099
+ vpPulse: .22,
1100
+ vpWobble: 5
1101
+ }
1102
+ }
1103
+ ]
1104
+ };
1105
+ function Ke(e, t = {}) {
1106
+ switch (e) {
1107
+ case "scanline": return Pe;
1108
+ case "pattern-rules": {
1109
+ let e = t.render ?? "tiles", n = e === "field" && t.field === "organic";
1110
+ return {
1111
+ frame: e === "tiles" ? Fe : n ? Re : Le,
1112
+ form: e === "tiles" ? Ie : e === "weave" ? Be : ze
1113
+ };
1114
+ }
1115
+ case "math-waveform": return Ve;
1116
+ case "math-surface": return He;
1117
+ case "math-field": return (t.kind ?? "scalar") === "complex" ? We : Ue;
1118
+ default: return Ne(e)?.params?.some((e) => e.key === "vpSpin") ? Ge : null;
1119
+ }
1120
+ }
1121
+ function qe(e) {
1122
+ let t = /* @__PURE__ */ new Set();
1123
+ for (let n of e ?? []) for (let e of Object.keys(n.params ?? {})) t.add(e);
1124
+ return t;
1125
+ }
1126
+ //#endregion
1127
+ //#region src/editor/params/lookPresets.js
1128
+ var Je = {
1129
+ Spectrum: {
1130
+ palette: "spectrum",
1131
+ spectral: !0,
1132
+ hue: 0,
1133
+ irid: 1.1
1134
+ },
1135
+ Iris: {
1136
+ palette: "iris",
1137
+ spectral: !1,
1138
+ hue: .1,
1139
+ irid: 1.05
1140
+ },
1141
+ Aqua: {
1142
+ palette: "aqua",
1143
+ spectral: !1,
1144
+ hue: .5,
1145
+ irid: 1
1146
+ },
1147
+ Magma: {
1148
+ palette: "magma",
1149
+ spectral: !1,
1150
+ hue: .05,
1151
+ irid: .95
1152
+ },
1153
+ Candy: {
1154
+ palette: "candy",
1155
+ spectral: !1,
1156
+ hue: .8,
1157
+ irid: 1.15
1158
+ },
1159
+ Noir: {
1160
+ palette: "spectrum",
1161
+ spectral: !0,
1162
+ hue: 0,
1163
+ irid: .6,
1164
+ rim: 1
1165
+ }
1166
+ };
1167
+ function Ye(e) {
1168
+ return e === "softforms" || e === "softforms3d" ? Je : null;
1169
+ }
1170
+ //#endregion
1171
+ //#region src/loops/gl/primitiveEasing.js
1172
+ function Xe(e) {
1173
+ let t = 7.5625, n = 2.75;
1174
+ return e < 1 / n ? t * e * e : e < 2 / n ? (e -= 1.5 / n, t * e * e + .75) : e < 2.5 / n ? (e -= 2.25 / n, t * e * e + .9375) : (e -= 2.625 / n, t * e * e + .984375);
1175
+ }
1176
+ var Ze = {
1177
+ linear: (e) => e,
1178
+ in: (e) => e * e,
1179
+ out: (e) => 1 - (1 - e) * (1 - e),
1180
+ inout: (e) => e < .5 ? 2 * e * e : 1 - (-2 * e + 2) ** 2 / 2,
1181
+ sine: (e) => -(Math.cos(Math.PI * e) - 1) / 2,
1182
+ cubicIn: (e) => e * e * e,
1183
+ cubicOut: (e) => 1 - (1 - e) ** 3,
1184
+ cubicInOut: (e) => e < .5 ? 4 * e * e * e : 1 - (-2 * e + 2) ** 3 / 2,
1185
+ expoOut: (e) => e >= 1 ? 1 : 1 - 2 ** (-10 * e),
1186
+ expoInOut: (e) => e <= 0 ? 0 : e >= 1 ? 1 : e < .5 ? 2 ** (20 * e - 10) / 2 : (2 - 2 ** (-20 * e + 10)) / 2,
1187
+ backOut: (e) => 1 + 2.70158 * (e - 1) ** 3 + 1.70158 * (e - 1) ** 2,
1188
+ backInOut: (e) => {
1189
+ let t = 1.70158 * 1.525;
1190
+ return e < .5 ? (2 * e) ** 2 * (3.5949095 * 2 * e - t) / 2 : ((2 * e - 2) ** 2 * (3.5949095 * (e * 2 - 2) + t) + 2) / 2;
1191
+ },
1192
+ elasticOut: (e) => {
1193
+ if (e <= 0) return 0;
1194
+ if (e >= 1) return 1;
1195
+ let t = 2 * Math.PI / 3;
1196
+ return 2 ** (-10 * e) * Math.sin((e * 10 - .75) * t) + 1;
1197
+ },
1198
+ bounceOut: Xe
1199
+ }, Qe = {
1200
+ linear: "Linear",
1201
+ in: "Ease in",
1202
+ out: "Ease out",
1203
+ inout: "Ease in-out",
1204
+ sine: "Sine",
1205
+ cubicIn: "Cubic in",
1206
+ cubicOut: "Cubic out",
1207
+ cubicInOut: "Cubic in-out",
1208
+ expoOut: "Expo out",
1209
+ expoInOut: "Expo in-out",
1210
+ backOut: "Back out",
1211
+ backInOut: "Back in-out",
1212
+ elasticOut: "Elastic out",
1213
+ bounceOut: "Bounce out"
1214
+ }, $e = Object.keys(Ze).map((e) => ({
1215
+ value: e,
1216
+ label: Qe[e] || e
1217
+ })), et = (e, t, n) => [
1218
+ P(e[0], t[0], n),
1219
+ P(e[1], t[1], n),
1220
+ P(e[2], t[2], n)
1221
+ ], tt = (e) => ({
1222
+ rot: e.rot || [
1223
+ 0,
1224
+ 0,
1225
+ 0
1226
+ ],
1227
+ pos: e.pos || [
1228
+ 0,
1229
+ 0,
1230
+ 0
1231
+ ],
1232
+ scale: e.scale ?? 1
1233
+ });
1234
+ function nt(e, t) {
1235
+ if (!e || !e.length) return {};
1236
+ if (e.length === 1) return tt(e[0]);
1237
+ let n = 0;
1238
+ for (; n < e.length - 1 && t > e[n + 1].t;) n++;
1239
+ let r = e[n], i = e[n + 1] || r, a = i.t - r.t || 1, o = Math.max(0, Math.min(1, (t - r.t) / a));
1240
+ return o = (Ze[i.ease] || Ze.inout)(o), {
1241
+ rot: et(r.rot || [
1242
+ 0,
1243
+ 0,
1244
+ 0
1245
+ ], i.rot || [
1246
+ 0,
1247
+ 0,
1248
+ 0
1249
+ ], o),
1250
+ pos: et(r.pos || [
1251
+ 0,
1252
+ 0,
1253
+ 0
1254
+ ], i.pos || [
1255
+ 0,
1256
+ 0,
1257
+ 0
1258
+ ], o),
1259
+ scale: P(r.scale ?? 1, i.scale ?? 1, o)
1260
+ };
1261
+ }
1262
+ var rt = [{
1263
+ t: 0,
1264
+ rot: [
1265
+ 0,
1266
+ 0,
1267
+ 0
1268
+ ],
1269
+ pos: [
1270
+ 0,
1271
+ 0,
1272
+ 0
1273
+ ],
1274
+ scale: 1,
1275
+ ease: "inout"
1276
+ }, {
1277
+ t: 1,
1278
+ rot: [
1279
+ 0,
1280
+ Math.PI * 2,
1281
+ 0
1282
+ ],
1283
+ pos: [
1284
+ 0,
1285
+ 0,
1286
+ 0
1287
+ ],
1288
+ scale: 1,
1289
+ ease: "inout"
1290
+ }];
1291
+ //#endregion
1292
+ //#region src/loops/gl/phase.js
1293
+ function it(e, t) {
1294
+ let n = Number(e), r = Number(t);
1295
+ return !n || n <= 0 || !r || r <= 0 ? 1 : Math.max(1, Math.round(r / n));
1296
+ }
1297
+ function at(e, t) {
1298
+ return e * t % 1;
1299
+ }
1300
+ //#endregion
1301
+ //#region src/editor/compose/inspectors/KeyframeEditor.jsx
1302
+ function ot({ layer: t, patch: n, defaultDuration: r = 8 }) {
1303
+ let i = () => it(t.duration ?? r, e.getLoopSeconds());
1304
+ return /* @__PURE__ */ H(me, {
1305
+ keyframes: t.keyframes,
1306
+ onChange: (e) => n({ keyframes: e }),
1307
+ t: () => e.getT() * i() % 1,
1308
+ onPause: () => e.pause(),
1309
+ onSeek: (t) => e.seek(t / i()),
1310
+ easeOptions: $e,
1311
+ defaultKeyframes: rt
1312
+ });
1313
+ }
1314
+ //#endregion
1315
+ //#region src/editor/compose/inspectors/CameraPoseSlots.jsx
1316
+ function st({ layer: e, patch: t, camParams: n, isEngine: r, showHeader: i = !1 }) {
1317
+ let a = Array.isArray(e._camSlots) ? e._camSlots : [], o = [
1318
+ a[0] ?? null,
1319
+ a[1] ?? null,
1320
+ a[2] ?? null
1321
+ ], s = (r) => {
1322
+ let i = {};
1323
+ for (let t of n) i[t.key] = e[t.key] ?? t.default;
1324
+ let a = [...o];
1325
+ a[r] = i, t({ _camSlots: a });
1326
+ }, c = (e) => {
1327
+ o[e] && t({ ...o[e] });
1328
+ };
1329
+ return /* @__PURE__ */ U(V, { children: [i && /* @__PURE__ */ H("span", {
1330
+ className: "kol-helper-10 text-meta",
1331
+ children: "Camera"
1332
+ }), /* @__PURE__ */ U("div", {
1333
+ className: "flex items-center gap-1",
1334
+ children: [n.length > 0 && o.map((e, t) => /* @__PURE__ */ H(B, {
1335
+ label: e ? "Recall pose (shift-click = overwrite)" : "Save pose",
1336
+ children: /* @__PURE__ */ H(I, {
1337
+ "aria-label": e ? "Recall pose (shift-click = overwrite)" : "Save pose",
1338
+ variant: e ? "secondary" : "ghost",
1339
+ size: "sm",
1340
+ onClick: (n) => n.shiftKey || !e ? s(t) : c(t),
1341
+ children: t + 1
1342
+ })
1343
+ }, t)), /* @__PURE__ */ H(I, {
1344
+ variant: "primary",
1345
+ size: "sm",
1346
+ className: "ml-auto",
1347
+ onClick: () => {
1348
+ let i = {};
1349
+ for (let e of n) i[e.key] = e.default;
1350
+ t(i), r && import("./host-DiI1hniH.js").then((t) => t.hostAction?.(e.id, "resetCamera")).catch(() => {});
1351
+ },
1352
+ children: "Reset"
1353
+ })]
1354
+ })] });
1355
+ }
1356
+ //#endregion
1357
+ //#region src/editor/compose/inspectors/RulesEditor.jsx
1358
+ function ct({ layer: e, patch: t, seed: n }) {
1359
+ let r = e.rules ?? [], i = (e, n) => t({
1360
+ rules: e,
1361
+ ...n
1362
+ }), a = () => i([...r, S()]), o = (e, t) => i(r.map((n, r) => r === e ? t : n)), s = (e) => i(r.filter((t, n) => n !== e)), c = (e) => {
1363
+ let t = n.take(), a = l(t >>> 0);
1364
+ i(r.map((t, n) => n === e ? {
1365
+ ...w(a),
1366
+ id: t.id
1367
+ } : t), { _rollSeed: t });
1368
+ };
1369
+ return /* @__PURE__ */ H(z, {
1370
+ label: `Rules · ${r.length}`,
1371
+ children: /* @__PURE__ */ U("div", {
1372
+ className: "flex flex-col gap-2",
1373
+ children: [r.map((e, t) => /* @__PURE__ */ H(pe, {
1374
+ rule: e,
1375
+ onChange: (e) => o(t, e),
1376
+ onRemove: () => s(t),
1377
+ onReroll: () => c(t)
1378
+ }, e.id ?? t)), /* @__PURE__ */ U("div", {
1379
+ className: "grid grid-cols-2 gap-2",
1380
+ children: [/* @__PURE__ */ H(I, {
1381
+ variant: "primary",
1382
+ size: "sm",
1383
+ iconLeft: "plus",
1384
+ onClick: a,
1385
+ children: "Add rule"
1386
+ }), /* @__PURE__ */ H(I, {
1387
+ variant: "primary",
1388
+ size: "sm",
1389
+ onClick: () => {
1390
+ let e = n.take(), t = l(e >>> 0), r = 1 + Math.floor(t() * 3);
1391
+ i(Array.from({ length: r }, () => w(t)), { _rollSeed: e });
1392
+ },
1393
+ children: "Randomize"
1394
+ })]
1395
+ })]
1396
+ })
1397
+ });
1398
+ }
1399
+ //#endregion
1400
+ //#region src/editor/compose/inspectors/ProfileEditor.jsx
1401
+ var G = 240, K = 120, lt = 12, q = (e, t, n) => Math.max(t, Math.min(n, e)), J = (e) => e * G, Y = (e) => K / 2 - e * (K / 2 - lt);
1402
+ function ut({ value: e, onChange: t }) {
1403
+ let n = Array.isArray(e) && e.length > 1 ? e : C, r = Se(null), i = Se(null), a = (e) => {
1404
+ let t = r.current, n = t.createSVGPoint();
1405
+ n.x = e.clientX, n.y = e.clientY;
1406
+ let i = n.matrixTransform(t.getScreenCTM().inverse());
1407
+ return {
1408
+ nx: i.x / G,
1409
+ ny: (K / 2 - i.y) / (K / 2 - lt)
1410
+ };
1411
+ }, o = (e) => {
1412
+ let r = i.current;
1413
+ if (!r) return;
1414
+ let { nx: o, ny: s } = a(e), c = q(s, -1, 1), l = n.map((e) => ({ ...e })), u = l[r.i];
1415
+ if (r.type === "anchor") {
1416
+ let e = r.i === 0, t = r.i === l.length - 1;
1417
+ !e && !t && (u.x = q(o, l[r.i - 1].x + .02, l[r.i + 1].x - .02)), u.y = c, e && (l[l.length - 1].y = c), t && (l[0].y = c);
1418
+ } else r.type === "hr" ? (u.hrx = o - u.x, u.hry = c - u.y) : (u.hlx = o - u.x, u.hly = c - u.y);
1419
+ t(l);
1420
+ }, s = (e, t) => (n) => {
1421
+ n.stopPropagation(), i.current = {
1422
+ type: e,
1423
+ i: t
1424
+ };
1425
+ try {
1426
+ n.target.setPointerCapture(n.pointerId);
1427
+ } catch {}
1428
+ }, c = (e) => {
1429
+ i.current = null;
1430
+ try {
1431
+ e.target.releasePointerCapture(e.pointerId);
1432
+ } catch {}
1433
+ }, l = (e) => {
1434
+ let { nx: r, ny: i } = a(e), o = q(r, .04, .96), s = n.findIndex((e) => e.x > o), c = s < 0 ? n.length - 1 : s, l = n.map((e) => ({ ...e }));
1435
+ l.splice(c, 0, {
1436
+ x: o,
1437
+ y: q(i, -1, 1),
1438
+ hlx: -.08,
1439
+ hly: 0,
1440
+ hrx: .08,
1441
+ hry: 0
1442
+ }), t(l);
1443
+ }, u = (e) => (r) => {
1444
+ r.stopPropagation(), !(e === 0 || e === n.length - 1 || n.length <= 3) && t(n.filter((t, n) => n !== e));
1445
+ }, d = n.map((e, t) => {
1446
+ if (t === 0) return `M ${J(e.x)} ${Y(e.y)}`;
1447
+ let r = n[t - 1];
1448
+ return `C ${J(r.x + r.hrx)} ${Y(r.y + r.hry)}, ${J(e.x + e.hlx)} ${Y(e.y + e.hly)}, ${J(e.x)} ${Y(e.y)}`;
1449
+ }).join(" ");
1450
+ return /* @__PURE__ */ U("svg", {
1451
+ ref: r,
1452
+ width: "100%",
1453
+ height: K,
1454
+ viewBox: `0 0 ${G} ${K}`,
1455
+ className: "rounded touch-none select-none",
1456
+ style: { background: "var(--kol-surface-primary)" },
1457
+ onPointerMove: o,
1458
+ onPointerUp: c,
1459
+ onPointerLeave: c,
1460
+ onDoubleClick: l,
1461
+ children: [
1462
+ /* @__PURE__ */ H("line", {
1463
+ x1: "0",
1464
+ y1: K / 2,
1465
+ x2: G,
1466
+ y2: K / 2,
1467
+ stroke: "var(--kol-fg-16)",
1468
+ strokeWidth: "1"
1469
+ }),
1470
+ /* @__PURE__ */ H("path", {
1471
+ d,
1472
+ fill: "none",
1473
+ stroke: "var(--kol-fg-80)",
1474
+ strokeWidth: "1.5",
1475
+ vectorEffect: "non-scaling-stroke"
1476
+ }),
1477
+ n.map((e, t) => /* @__PURE__ */ U("g", { children: [
1478
+ /* @__PURE__ */ H("line", {
1479
+ x1: J(e.x),
1480
+ y1: Y(e.y),
1481
+ x2: J(e.x + e.hlx),
1482
+ y2: Y(e.y + e.hly),
1483
+ stroke: "var(--kol-fg-32)",
1484
+ vectorEffect: "non-scaling-stroke"
1485
+ }),
1486
+ /* @__PURE__ */ H("line", {
1487
+ x1: J(e.x),
1488
+ y1: Y(e.y),
1489
+ x2: J(e.x + e.hrx),
1490
+ y2: Y(e.y + e.hry),
1491
+ stroke: "var(--kol-fg-32)",
1492
+ vectorEffect: "non-scaling-stroke"
1493
+ }),
1494
+ /* @__PURE__ */ H("circle", {
1495
+ cx: J(e.x + e.hlx),
1496
+ cy: Y(e.y + e.hly),
1497
+ r: "3.5",
1498
+ fill: "var(--kol-fg-48)",
1499
+ className: "cursor-grab",
1500
+ onPointerDown: s("hl", t)
1501
+ }),
1502
+ /* @__PURE__ */ H("circle", {
1503
+ cx: J(e.x + e.hrx),
1504
+ cy: Y(e.y + e.hry),
1505
+ r: "3.5",
1506
+ fill: "var(--kol-fg-48)",
1507
+ className: "cursor-grab",
1508
+ onPointerDown: s("hr", t)
1509
+ }),
1510
+ /* @__PURE__ */ H("circle", {
1511
+ cx: J(e.x),
1512
+ cy: Y(e.y),
1513
+ r: "5",
1514
+ fill: "var(--kol-surface-on-primary)",
1515
+ className: "cursor-grab",
1516
+ onPointerDown: s("anchor", t),
1517
+ onDoubleClick: u(t)
1518
+ })
1519
+ ] }, t))
1520
+ ]
1521
+ });
1522
+ }
1523
+ function dt({ layer: e, patch: t }) {
1524
+ return e.render !== "field" || e.field !== "organic" || e.waveProfile !== "custom" ? null : /* @__PURE__ */ H(z, {
1525
+ label: "Profile curve",
1526
+ children: /* @__PURE__ */ H(ut, {
1527
+ value: Array.isArray(e.waveCurve) && e.waveCurve.length > 1 ? e.waveCurve : C,
1528
+ onChange: (e) => t({ waveCurve: e })
1529
+ })
1530
+ });
1531
+ }
1532
+ //#endregion
1533
+ //#region src/editor/compose/inspectors/CurveEditor.jsx
1534
+ function ft({ layer: e, patch: t }) {
1535
+ let n = e.clip === "custom", r = n ? null : _(e.clip), i = n ? null : {
1536
+ label: (v.find((t) => t.id === e.clip) || v[0]).label,
1537
+ copies: r.copies,
1538
+ spiral: r.spiral,
1539
+ layerCopies: e.copies,
1540
+ layerSpiral: e.spiral
1541
+ };
1542
+ return /* @__PURE__ */ H(L, {
1543
+ value: n ? e.custom ?? b("polar") : r.def,
1544
+ stock: i,
1545
+ onChange: (e, { extras: n }) => t({
1546
+ clip: "custom",
1547
+ ...n,
1548
+ custom: e
1549
+ }),
1550
+ validate: te,
1551
+ kinds: y,
1552
+ defaultFor: b
1553
+ });
1554
+ }
1555
+ //#endregion
1556
+ //#region src/editor/compose/inspectors/ParatypeTools.jsx
1557
+ function pt({ layer: e, patch: t, tab: n }) {
1558
+ return e?.loopId === "paratype-glyph" ? n === "generate" ? /* @__PURE__ */ H(mt, { layer: e }) : n === "style" ? /* @__PURE__ */ H(ht, {
1559
+ layer: e,
1560
+ patch: t
1561
+ }) : null : null;
1562
+ }
1563
+ function mt({ layer: e }) {
1564
+ let { flattenParatype: t } = c();
1565
+ return t ? /* @__PURE__ */ H(B, {
1566
+ label: "Flatten the glyph(s) to vector shape layers (one-way)",
1567
+ children: /* @__PURE__ */ H(I, {
1568
+ "aria-label": "Flatten the glyph(s) to vector shape layers (one-way)",
1569
+ variant: "primary",
1570
+ size: "sm",
1571
+ className: "w-full",
1572
+ onClick: () => t(e.id),
1573
+ children: "Flatten to vector"
1574
+ })
1575
+ }) : null;
1576
+ }
1577
+ function ht({ layer: e, patch: t }) {
1578
+ let r = n(se(e.loopId)?.params ?? [], e).filter((e) => e.type === "range");
1579
+ if (r.length < 2) return null;
1580
+ let i = (e, t) => r.some((t) => t.key === e) && e !== t ? e : r.find((e) => e.key !== t)?.key, a = i(e._xyX ?? "stemWidth", null), o = i(e._xyY ?? "oWidth", a), s = r.find((e) => e.key === a), c = r.find((e) => e.key === o);
1581
+ if (!s || !c) return null;
1582
+ let l = (t, n) => typeof e[t] == "number" ? e[t] : n.default, u = (e, t) => {
1583
+ let n = t.step ?? 1;
1584
+ return n < 1 ? Number((Math.round(e / n) * n).toFixed(4)) : Math.round(e);
1585
+ }, d = r.map((e) => ({
1586
+ value: e.key,
1587
+ label: e.label
1588
+ }));
1589
+ return /* @__PURE__ */ U(V, { children: [
1590
+ /* @__PURE__ */ H("span", {
1591
+ className: "kol-helper-10 text-meta",
1592
+ children: "Explore"
1593
+ }),
1594
+ /* @__PURE__ */ U("div", {
1595
+ className: "grid grid-cols-2 gap-2",
1596
+ children: [/* @__PURE__ */ H(z, {
1597
+ label: "X axis",
1598
+ children: /* @__PURE__ */ H(R, {
1599
+ variant: "subtle",
1600
+ size: "sm",
1601
+ className: "w-full",
1602
+ options: d,
1603
+ value: a,
1604
+ onChange: (e) => t({ _xyX: e })
1605
+ })
1606
+ }), /* @__PURE__ */ H(z, {
1607
+ label: "Y axis",
1608
+ children: /* @__PURE__ */ H(R, {
1609
+ variant: "subtle",
1610
+ size: "sm",
1611
+ className: "w-full",
1612
+ options: d,
1613
+ value: o,
1614
+ onChange: (e) => t({ _xyY: e })
1615
+ })
1616
+ })]
1617
+ }),
1618
+ /* @__PURE__ */ H(be, {
1619
+ xValue: l(a, s),
1620
+ yValue: l(o, c),
1621
+ xMin: s.min ?? 0,
1622
+ xMax: s.max ?? 1,
1623
+ yMin: c.min ?? 0,
1624
+ yMax: c.max ?? 1,
1625
+ xLabel: s.label,
1626
+ yLabel: c.label,
1627
+ onChange: (e, n) => t({
1628
+ [a]: u(e, s),
1629
+ [o]: u(n, c)
1630
+ })
1631
+ })
1632
+ ] });
1633
+ }
1634
+ //#endregion
1635
+ //#region src/editor/compose/inspectors/SoftformsLayers.jsx
1636
+ var X = 5, gt = [
1637
+ {
1638
+ value: "teardrop",
1639
+ label: "Teardrop"
1640
+ },
1641
+ {
1642
+ value: "pill",
1643
+ label: "Pill"
1644
+ },
1645
+ {
1646
+ value: "dome",
1647
+ label: "Dome"
1648
+ },
1649
+ {
1650
+ value: "orb",
1651
+ label: "Orb"
1652
+ },
1653
+ {
1654
+ value: "super",
1655
+ label: "Lozenge"
1656
+ }
1657
+ ], _t = [
1658
+ {
1659
+ value: "sphere",
1660
+ label: "Sphere"
1661
+ },
1662
+ {
1663
+ value: "capsule",
1664
+ label: "Capsule"
1665
+ },
1666
+ {
1667
+ value: "teardrop",
1668
+ label: "Teardrop"
1669
+ },
1670
+ {
1671
+ value: "lozenge",
1672
+ label: "Lozenge"
1673
+ }
1674
+ ], vt = [
1675
+ {
1676
+ k: "x",
1677
+ label: "Position X",
1678
+ min: -1,
1679
+ max: 1,
1680
+ step: .01,
1681
+ def: 0
1682
+ },
1683
+ {
1684
+ k: "y",
1685
+ label: "Position Y",
1686
+ min: -1,
1687
+ max: 1,
1688
+ step: .01,
1689
+ def: 0
1690
+ },
1691
+ {
1692
+ k: "sx",
1693
+ label: "Scale X",
1694
+ min: .12,
1695
+ max: 1.6,
1696
+ step: .01,
1697
+ def: .6
1698
+ },
1699
+ {
1700
+ k: "sy",
1701
+ label: "Scale Y",
1702
+ min: .12,
1703
+ max: 1.6,
1704
+ step: .01,
1705
+ def: .6,
1706
+ fallback: "sx"
1707
+ },
1708
+ {
1709
+ k: "rot",
1710
+ label: "Rotation",
1711
+ min: 0,
1712
+ max: 360,
1713
+ step: 1,
1714
+ def: 0
1715
+ },
1716
+ {
1717
+ k: "hue",
1718
+ label: "Hue",
1719
+ min: 0,
1720
+ max: 1,
1721
+ step: .01,
1722
+ def: 0
1723
+ }
1724
+ ], yt = [
1725
+ {
1726
+ k: "x",
1727
+ label: "Position X",
1728
+ min: -1.2,
1729
+ max: 1.2,
1730
+ step: .01,
1731
+ def: 0
1732
+ },
1733
+ {
1734
+ k: "y",
1735
+ label: "Position Y",
1736
+ min: -1.2,
1737
+ max: 1.2,
1738
+ step: .01,
1739
+ def: 0
1740
+ },
1741
+ {
1742
+ k: "z",
1743
+ label: "Position Z",
1744
+ min: -1.2,
1745
+ max: 1.2,
1746
+ step: .01,
1747
+ def: 0
1748
+ },
1749
+ {
1750
+ k: "sx",
1751
+ label: "Scale X",
1752
+ min: .12,
1753
+ max: 1.6,
1754
+ step: .01,
1755
+ def: .7
1756
+ },
1757
+ {
1758
+ k: "sy",
1759
+ label: "Scale Y",
1760
+ min: .12,
1761
+ max: 1.6,
1762
+ step: .01,
1763
+ def: .7,
1764
+ fallback: "sx"
1765
+ },
1766
+ {
1767
+ k: "sz",
1768
+ label: "Scale Z",
1769
+ min: .12,
1770
+ max: 1.6,
1771
+ step: .01,
1772
+ def: .7,
1773
+ fallback: "sx"
1774
+ },
1775
+ {
1776
+ k: "rot",
1777
+ label: "Rotation",
1778
+ min: 0,
1779
+ max: 360,
1780
+ step: 1,
1781
+ def: 0
1782
+ },
1783
+ {
1784
+ k: "hue",
1785
+ label: "Hue",
1786
+ min: 0,
1787
+ max: 1,
1788
+ step: .01,
1789
+ def: 0
1790
+ }
1791
+ ], bt = Math.PI * 2, xt = (e, t, n) => Math.min(n, Math.max(t, e)), Z = (e) => Math.round(e * 100) / 100, Q = (e, t, n) => t + e() * (n - t), St = (e, t) => {
1792
+ let n = t * Math.sqrt(e()), r = e() * bt;
1793
+ return [n * Math.cos(r), n * Math.sin(r)];
1794
+ }, Ct = (e, t) => {
1795
+ let n = t * Math.cbrt(e()), r = e() * bt, i = Math.acos(2 * e() - 1);
1796
+ return [
1797
+ n * Math.sin(i) * Math.cos(r),
1798
+ n * Math.sin(i) * Math.sin(r),
1799
+ n * Math.cos(i) * .8
1800
+ ];
1801
+ }, wt = (e) => {
1802
+ let t = e.length || 1, n = e.reduce((e, n) => ({
1803
+ x: e.x + n.x / t,
1804
+ y: e.y + n.y / t
1805
+ }), {
1806
+ x: 0,
1807
+ y: 0
1808
+ });
1809
+ return e.map((e) => ({
1810
+ ...e,
1811
+ x: Z(e.x - n.x),
1812
+ y: Z(e.y - n.y)
1813
+ }));
1814
+ }, Tt = (e) => {
1815
+ let t = e.length || 1, n = e.reduce((e, n) => ({
1816
+ x: e.x + n.x / t,
1817
+ y: e.y + n.y / t,
1818
+ z: e.z + n.z / t
1819
+ }), {
1820
+ x: 0,
1821
+ y: 0,
1822
+ z: 0
1823
+ });
1824
+ return e.map((e) => ({
1825
+ ...e,
1826
+ x: Z(e.x - n.x),
1827
+ y: Z(e.y - n.y),
1828
+ z: Z(e.z - n.z)
1829
+ }));
1830
+ }, Et = (e, t) => e.find((e) => e.value === t)?.label ?? t;
1831
+ function Dt({ layer: e }) {
1832
+ let { updateLayer: t } = c(), n = de(e.id, { history: "coalesce" }), r = e.loopId === "softforms3d", i = r && !!e.metaball, a = r ? _t : gt, o = r ? yt : vt, s = i ? 2 : 1, u = Array.isArray(e.forms) ? e.forms : [], [d, f] = Ce(-1), p = d >= 0 && d < u.length ? u[d] : null, h = (t) => {
1833
+ f(t), window.dispatchEvent(new CustomEvent("kol:softform-select", { detail: {
1834
+ id: e.id,
1835
+ index: t,
1836
+ from: "panel"
1837
+ } }));
1838
+ };
1839
+ xe(() => {
1840
+ let t = (t) => {
1841
+ t.detail?.id === e.id && t.detail.from === "canvas" && f(t.detail.index);
1842
+ };
1843
+ return window.addEventListener("kol:softform-select", t), () => window.removeEventListener("kol:softform-select", t);
1844
+ }, [e.id]);
1845
+ let g = (n) => t(e.id, { forms: n }), ee = (e, t) => n.patch({ forms: u.map((n, r) => r === d ? {
1846
+ ...n,
1847
+ [e]: t
1848
+ } : n) }), _ = () => {
1849
+ if (u.length >= X) return;
1850
+ let e = r ? {
1851
+ t: "sphere",
1852
+ x: 0,
1853
+ y: 0,
1854
+ z: 0,
1855
+ sx: .7,
1856
+ sy: .7,
1857
+ sz: .7,
1858
+ rot: 0,
1859
+ hue: Z(Math.random())
1860
+ } : {
1861
+ t: "dome",
1862
+ x: 0,
1863
+ y: 0,
1864
+ sx: .6,
1865
+ sy: .6,
1866
+ rot: 0,
1867
+ hue: Z(Math.random())
1868
+ };
1869
+ g([...u, e]), h(u.length);
1870
+ }, te = (e) => {
1871
+ if (u.length >= X) return;
1872
+ let t = {
1873
+ ...u[e],
1874
+ x: xt((u[e].x ?? 0) + .12, -1.2, 1.2),
1875
+ y: xt((u[e].y ?? 0) - .1, -1.2, 1.2)
1876
+ };
1877
+ g([
1878
+ ...u.slice(0, e + 1),
1879
+ t,
1880
+ ...u.slice(e + 1)
1881
+ ]), h(e + 1);
1882
+ }, ne = (e) => {
1883
+ u.length <= s || (g(u.filter((t, n) => n !== e)), h(-1));
1884
+ }, v = (e, t) => {
1885
+ if (t < 0 || t >= u.length) return;
1886
+ let n = [...u];
1887
+ [n[e], n[t]] = [n[t], n[e]], g(n), h(t);
1888
+ };
1889
+ return /* @__PURE__ */ U("div", {
1890
+ className: "flex flex-col gap-2",
1891
+ children: [
1892
+ /* @__PURE__ */ H("span", {
1893
+ className: "kol-helper-10 text-meta",
1894
+ children: "Forms"
1895
+ }),
1896
+ /* @__PURE__ */ H("div", {
1897
+ className: "flex flex-col gap-1",
1898
+ children: u.map((e, t) => {
1899
+ let n = u.length - 1 - t, r = u[n];
1900
+ return /* @__PURE__ */ U("div", {
1901
+ onClick: () => h(n),
1902
+ className: `flex items-center gap-2 pl-2 pr-1 py-1 rounded cursor-pointer kol-helper-12 ${n === d ? "bg-[color-mix(in_srgb,var(--kol-accent-primary)_26%,transparent)] text-emphasis" : "text-body hover:bg-fg-04 hover:text-emphasis"}`,
1903
+ children: [
1904
+ /* @__PURE__ */ H("span", {
1905
+ className: "kol-helper-10 text-meta shrink-0",
1906
+ children: n + 1
1907
+ }),
1908
+ /* @__PURE__ */ H("span", {
1909
+ className: "truncate flex-1 min-w-0",
1910
+ children: Et(a, r.t)
1911
+ }),
1912
+ /* @__PURE__ */ H(B, {
1913
+ label: "Move form up",
1914
+ children: /* @__PURE__ */ H(I, {
1915
+ variant: "ghost",
1916
+ size: "sm",
1917
+ quiet: !0,
1918
+ iconOnly: "chevron-down",
1919
+ iconSize: 12,
1920
+ "aria-label": "Move form up",
1921
+ disabled: n >= u.length - 1,
1922
+ onClick: (e) => {
1923
+ e.stopPropagation(), v(n, n + 1);
1924
+ },
1925
+ style: { transform: "rotate(180deg)" }
1926
+ })
1927
+ }),
1928
+ /* @__PURE__ */ H(B, {
1929
+ label: "Move form down",
1930
+ children: /* @__PURE__ */ H(I, {
1931
+ variant: "ghost",
1932
+ size: "sm",
1933
+ quiet: !0,
1934
+ iconOnly: "chevron-down",
1935
+ iconSize: 12,
1936
+ "aria-label": "Move form down",
1937
+ disabled: n <= 0,
1938
+ onClick: (e) => {
1939
+ e.stopPropagation(), v(n, n - 1);
1940
+ }
1941
+ })
1942
+ }),
1943
+ /* @__PURE__ */ H(B, {
1944
+ label: "Duplicate form",
1945
+ children: /* @__PURE__ */ H(I, {
1946
+ variant: "ghost",
1947
+ size: "sm",
1948
+ quiet: !0,
1949
+ iconOnly: "copy",
1950
+ iconSize: 12,
1951
+ "aria-label": "Duplicate form",
1952
+ disabled: u.length >= X,
1953
+ onClick: (e) => {
1954
+ e.stopPropagation(), te(n);
1955
+ }
1956
+ })
1957
+ }),
1958
+ /* @__PURE__ */ H(B, {
1959
+ label: "Delete form",
1960
+ children: /* @__PURE__ */ H(I, {
1961
+ variant: "ghost",
1962
+ size: "sm",
1963
+ quiet: !0,
1964
+ iconOnly: "trash",
1965
+ iconSize: 12,
1966
+ "aria-label": "Delete form",
1967
+ disabled: u.length <= s,
1968
+ onClick: (e) => {
1969
+ e.stopPropagation(), ne(n);
1970
+ }
1971
+ })
1972
+ })
1973
+ ]
1974
+ }, n);
1975
+ })
1976
+ }),
1977
+ /* @__PURE__ */ H(I, {
1978
+ variant: "primary",
1979
+ size: "sm",
1980
+ className: "w-full",
1981
+ iconLeft: "plus",
1982
+ iconSize: 12,
1983
+ disabled: u.length >= X,
1984
+ onClick: _,
1985
+ children: "Add form"
1986
+ }),
1987
+ !r && /* @__PURE__ */ H(B, {
1988
+ label: "Edit forms on the canvas (click to select, drag to move, corners to scale, knob to rotate)",
1989
+ children: /* @__PURE__ */ H(I, {
1990
+ "aria-label": "Edit forms on the canvas (click to select, drag to move, corners to scale, knob to rotate)",
1991
+ variant: "primary",
1992
+ size: "sm",
1993
+ className: "w-full",
1994
+ onClick: () => window.dispatchEvent(new CustomEvent("kol:softform-edit", { detail: {
1995
+ id: e.id,
1996
+ index: Math.max(0, d)
1997
+ } })),
1998
+ children: "Edit forms on canvas"
1999
+ })
2000
+ }),
2001
+ p && /* @__PURE__ */ U("div", {
2002
+ className: "flex flex-col gap-2 pt-1",
2003
+ children: [
2004
+ /* @__PURE__ */ H("span", {
2005
+ className: "kol-helper-10 text-meta",
2006
+ children: "Selected form"
2007
+ }),
2008
+ /* @__PURE__ */ H(z, {
2009
+ label: "Type",
2010
+ children: /* @__PURE__ */ H(R, {
2011
+ variant: "subtle",
2012
+ size: "sm",
2013
+ className: "w-full",
2014
+ options: a,
2015
+ value: p.t,
2016
+ onChange: (e) => g(u.map((t, n) => n === d ? {
2017
+ ...t,
2018
+ t: e
2019
+ } : t))
2020
+ })
2021
+ }),
2022
+ o.map((e) => {
2023
+ let t = p[e.k] ?? (e.fallback ? p[e.fallback] : void 0), n = typeof t == "number" ? t : e.def;
2024
+ return /* @__PURE__ */ H(z, {
2025
+ label: e.label,
2026
+ children: /* @__PURE__ */ H(ve, {
2027
+ min: e.min,
2028
+ max: e.max,
2029
+ step: e.step,
2030
+ value: n,
2031
+ onChange: (t) => ee(e.k, t)
2032
+ })
2033
+ }, e.k);
2034
+ })
2035
+ ]
2036
+ }),
2037
+ /* @__PURE__ */ H("span", {
2038
+ className: "kol-helper-10 text-meta pt-1",
2039
+ children: "Randomise forms"
2040
+ }),
2041
+ /* @__PURE__ */ U("div", {
2042
+ className: "grid grid-cols-2 gap-2",
2043
+ children: [
2044
+ /* @__PURE__ */ H(I, {
2045
+ variant: "primary",
2046
+ size: "sm",
2047
+ onClick: () => {
2048
+ let e = l(m());
2049
+ g(u.map((t) => ({
2050
+ ...t,
2051
+ hue: Z(e())
2052
+ })));
2053
+ },
2054
+ children: "Color"
2055
+ }),
2056
+ /* @__PURE__ */ H(I, {
2057
+ variant: "primary",
2058
+ size: "sm",
2059
+ onClick: () => {
2060
+ let e = l(m());
2061
+ g(u.map((t) => r ? {
2062
+ ...t,
2063
+ x: Z(Q(e, -.7, .7)),
2064
+ y: Z(Q(e, -.7, .7)),
2065
+ z: Z(Q(e, -.5, .5)),
2066
+ rot: Math.round(Q(e, 0, 360))
2067
+ } : {
2068
+ ...t,
2069
+ x: Z(Q(e, -.55, .55)),
2070
+ y: Z(Q(e, -.75, .75)),
2071
+ rot: Math.round(Q(e, 0, 360))
2072
+ }));
2073
+ },
2074
+ children: "Transform"
2075
+ }),
2076
+ /* @__PURE__ */ H(I, {
2077
+ variant: "primary",
2078
+ size: "sm",
2079
+ onClick: () => {
2080
+ let e = l(m());
2081
+ g(u.map((t) => {
2082
+ let n = Z(Q(e, .35, .95)), i = Z(Q(e, .35, .95));
2083
+ return r ? {
2084
+ ...t,
2085
+ sx: n,
2086
+ sy: i,
2087
+ sz: Z(Q(e, .35, .95))
2088
+ } : {
2089
+ ...t,
2090
+ sx: n,
2091
+ sy: i
2092
+ };
2093
+ }));
2094
+ },
2095
+ children: "Scale"
2096
+ }),
2097
+ /* @__PURE__ */ H(I, {
2098
+ variant: "primary",
2099
+ size: "sm",
2100
+ onClick: () => {
2101
+ let n = l(m());
2102
+ t(e.id, {
2103
+ motion: Z(Q(n, 0, 1.1)),
2104
+ sweep: Math.round(Q(n, 0, 360))
2105
+ });
2106
+ },
2107
+ children: "Animation"
2108
+ })
2109
+ ]
2110
+ }),
2111
+ /* @__PURE__ */ H(I, {
2112
+ variant: "primary",
2113
+ size: "sm",
2114
+ className: "w-full",
2115
+ onClick: () => {
2116
+ let e = l(m());
2117
+ if (r) {
2118
+ if (i) {
2119
+ let t = 2 + Math.floor(e() * 4), n = Q(e, .45, .9);
2120
+ g(Tt(Array.from({ length: t }, (r, i) => {
2121
+ let [a, o, s] = Ct(e, n), c = Z(Q(e, .5, .92));
2122
+ return {
2123
+ t: "sphere",
2124
+ x: Z(a),
2125
+ y: Z(o),
2126
+ z: Z(s),
2127
+ sx: c,
2128
+ sy: c,
2129
+ sz: c,
2130
+ rot: 0,
2131
+ hue: Z(i / t)
2132
+ };
2133
+ })));
2134
+ } else {
2135
+ let t = Q(e, .6, 1.15);
2136
+ g(Tt(u.map((n) => {
2137
+ let [r, i, a] = Ct(e, t);
2138
+ return {
2139
+ ...n,
2140
+ x: Z(r),
2141
+ y: Z(i),
2142
+ z: Z(a),
2143
+ rot: Math.round(Q(e, 0, 360))
2144
+ };
2145
+ })));
2146
+ }
2147
+ return;
2148
+ }
2149
+ let t = 2 + Math.floor(e() * 4), n = Q(e, .45, .85);
2150
+ g(wt(Array.from({ length: t }, (r, i) => {
2151
+ let [a, o] = St(e, n);
2152
+ return {
2153
+ t: gt[Math.floor(e() * gt.length)].value,
2154
+ x: Z(a),
2155
+ y: Z(o),
2156
+ sx: Z(Q(e, .4, .85)),
2157
+ sy: Z(Q(e, .4, .85)),
2158
+ rot: Math.round(Q(e, 0, 360)),
2159
+ hue: Z(i / t)
2160
+ };
2161
+ })));
2162
+ },
2163
+ children: "Rearrange"
2164
+ })
2165
+ ]
2166
+ });
2167
+ }
2168
+ //#endregion
2169
+ //#region src/loops/theme.js
2170
+ function Ot(e, t, n, r) {
2171
+ let i = M(n, r), a = {
2172
+ bg: i.bg,
2173
+ fg: i.fg,
2174
+ accent: i.accent,
2175
+ dim: i.dim ?? i.accent,
2176
+ warm: i.warm ?? i.accent
2177
+ }, o = { ...e };
2178
+ for (let e of t || []) e.type === "color" && e.role && a[e.role] && (o[e.key] = a[e.role]);
2179
+ return o;
2180
+ }
2181
+ //#endregion
2182
+ //#region src/editor/compose/inspectors/LoopFields.jsx
2183
+ var kt = (e, t) => {
2184
+ let n = e.map((e) => ({
2185
+ value: e.id,
2186
+ label: e.label
2187
+ }));
2188
+ return t == null || t === "custom" ? [{
2189
+ value: "custom",
2190
+ label: "Custom"
2191
+ }, ...n] : n;
2192
+ };
2193
+ function $({ inline: e, label: t, align: n = "fill", children: r }) {
2194
+ return e ? /* @__PURE__ */ H(_e, {
2195
+ label: t,
2196
+ align: n,
2197
+ labelWidth: 96,
2198
+ children: r
2199
+ }) : /* @__PURE__ */ H(z, {
2200
+ label: t,
2201
+ children: r
2202
+ });
2203
+ }
2204
+ var At = [{
2205
+ value: "off",
2206
+ label: "Off"
2207
+ }, {
2208
+ value: "on",
2209
+ label: "On"
2210
+ }];
2211
+ function jt({ inline: e, cs: t, on: n, onChange: r }) {
2212
+ return e ? /* @__PURE__ */ H(ge, {
2213
+ variant: "filled",
2214
+ size: t,
2215
+ className: `w-full ${h(t) ?? ""}`,
2216
+ options: At,
2217
+ value: n ? "on" : "off",
2218
+ onChange: (e) => r(e === "on")
2219
+ }) : /* @__PURE__ */ H(ye, {
2220
+ size: t,
2221
+ options: At,
2222
+ viewMode: n ? "on" : "off",
2223
+ onViewChange: (e) => r(e === "on")
2224
+ });
2225
+ }
2226
+ function Mt({ layer: e, setProp: n, patch: r, updateLayer: i, palette: c, renderAnimate: m, tab: h, tabStrip: ee, tree: _, picker: te = !0, inline: v = !1 }) {
2227
+ let y = t(), b = se(e.loopId), x = b?.params ?? [], S = e.themeId ?? "kol", C = !!e.themeInvert, w = (t) => i(e.id, {
2228
+ themeId: t,
2229
+ ...Ot(e, b?.params, t, C)
2230
+ }), ae = (t) => i(e.id, {
2231
+ themeInvert: t,
2232
+ ...Ot(e, b?.params, S, t)
2233
+ }), E = Ye(e.loopId), oe = E ? Object.keys(E).map((e) => ({
2234
+ id: e,
2235
+ label: e
2236
+ })) : null, D = E ? new Set(Object.values(E).flatMap((e) => Object.keys(e))) : null, O = o(e), k = d(x, e), A = Ke(e.loopId, e), j = (t, n, r) => {
2237
+ let o = a(e, t, O.take(), {
2238
+ stripNoRandom: !!n?.motion,
2239
+ ...r
2240
+ });
2241
+ A && n?.motion && (n.id !== "Form" && (o._framePreset = "custom"), n.id !== "Frame" && (o._formPreset = "custom")), D && Object.keys(o).some((e) => D.has(e)) && (o._lookPreset = "custom"), i(e.id, o);
2242
+ }, M = (t) => {
2243
+ let n = T(e.loopGroup).find((t) => t.id === e.presetId)?.params ?? {}, r = {};
2244
+ for (let e of t) {
2245
+ let t = n[e.key] === void 0 ? e.default : n[e.key];
2246
+ t !== void 0 && (r[e.key] = t);
2247
+ }
2248
+ i(e.id, r);
2249
+ }, N = A ? qe(A.frame) : null, ue = A ? qe(A.form) : null, P = (e, t) => {
2250
+ let n = {};
2251
+ N?.has(e) && (n._framePreset = "custom"), ue?.has(e) && (n._formPreset = "custom"), D?.has(e) && (n._lookPreset = "custom"), r({
2252
+ [e]: t,
2253
+ ...n
2254
+ });
2255
+ }, de = (e, t) => (n) => {
2256
+ let i = t.find((e) => e.id === n);
2257
+ r({
2258
+ [e]: n,
2259
+ ...i?.params ?? {}
2260
+ });
2261
+ }, pe = (e) => r({
2262
+ _lookPreset: e,
2263
+ ...E?.[e] ?? {}
2264
+ }), L = b?.camera ? b.camera.map((e) => ({
2265
+ ...e,
2266
+ section: "Camera"
2267
+ })) : null, me = [...b?.camera ?? [], ...x.filter((e) => g(e) === "Camera")], z = b?.kind === "engine", ge = me.length > 0 || z && b?.orbit, _e = b?.engine === "scene" && (e.animMode === "keyframes" || e.animMode === "keyframe"), ve = b?.orbit ? {
2268
+ yaw: 1,
2269
+ dist: 1
2270
+ } : ce(b), B = ve ? /* @__PURE__ */ U("p", {
2271
+ className: `kol-mono-10 text-meta${v ? "" : " col-span-2"}`,
2272
+ children: [
2273
+ "Press C (Orbit tool) to move the camera — ",
2274
+ b?.orbit ? "drag to orbit, scroll to zoom" : ve.yaw ? "drag to rotate, scroll to zoom" : "scroll to zoom",
2275
+ "."
2276
+ ]
2277
+ }) : null;
2278
+ return /* @__PURE__ */ U(V, { children: [
2279
+ te && (v ? /* @__PURE__ */ H(he, {
2280
+ divided: !0,
2281
+ children: /* @__PURE__ */ H(Me, {
2282
+ layer: e,
2283
+ tree: _,
2284
+ inline: !0
2285
+ })
2286
+ }) : /* @__PURE__ */ H(Me, {
2287
+ layer: e,
2288
+ tree: _
2289
+ })),
2290
+ ee,
2291
+ (h === "generate" || h === "labs-effect") && /* @__PURE__ */ U(V, { children: [
2292
+ (e.loopId === "softforms" || e.loopId === "softforms3d") && /* @__PURE__ */ H(Dt, { layer: e }),
2293
+ E && !v && /* @__PURE__ */ H($, {
2294
+ inline: v,
2295
+ label: "Look",
2296
+ children: /* @__PURE__ */ H(R, {
2297
+ variant: "subtle",
2298
+ size: y,
2299
+ className: "w-full",
2300
+ options: kt(oe, e._lookPreset),
2301
+ value: e._lookPreset ?? "custom",
2302
+ onChange: pe
2303
+ })
2304
+ }),
2305
+ v && /* @__PURE__ */ U(he, {
2306
+ divided: !0,
2307
+ children: [
2308
+ E && /* @__PURE__ */ H($, {
2309
+ inline: !0,
2310
+ label: "Look",
2311
+ children: /* @__PURE__ */ H(R, {
2312
+ variant: "subtle",
2313
+ size: y,
2314
+ className: "w-full",
2315
+ options: kt(oe, e._lookPreset),
2316
+ value: e._lookPreset ?? "custom",
2317
+ onChange: pe
2318
+ })
2319
+ }),
2320
+ /* @__PURE__ */ H($, {
2321
+ inline: !0,
2322
+ label: "Theme",
2323
+ children: /* @__PURE__ */ H(R, {
2324
+ variant: "subtle",
2325
+ size: y,
2326
+ className: "w-full",
2327
+ options: le,
2328
+ value: S,
2329
+ onChange: w
2330
+ })
2331
+ }),
2332
+ /* @__PURE__ */ H($, {
2333
+ inline: !0,
2334
+ label: "Invert",
2335
+ children: /* @__PURE__ */ H(jt, {
2336
+ inline: !0,
2337
+ cs: y,
2338
+ on: C,
2339
+ onChange: ae
2340
+ })
2341
+ }),
2342
+ ie(b) && /* @__PURE__ */ H($, {
2343
+ inline: !0,
2344
+ label: "Background",
2345
+ children: /* @__PURE__ */ H(jt, {
2346
+ inline: !0,
2347
+ cs: y,
2348
+ on: e.bgOn !== !1,
2349
+ onChange: (e) => n("bgOn", e)
2350
+ })
2351
+ }),
2352
+ B
2353
+ ]
2354
+ }),
2355
+ !v && /* @__PURE__ */ U("div", {
2356
+ className: "grid grid-cols-2 gap-2",
2357
+ children: [
2358
+ /* @__PURE__ */ H($, {
2359
+ inline: !1,
2360
+ label: "Theme",
2361
+ children: /* @__PURE__ */ H(R, {
2362
+ variant: "subtle",
2363
+ size: y,
2364
+ className: "w-full",
2365
+ options: le,
2366
+ value: S,
2367
+ onChange: w
2368
+ })
2369
+ }),
2370
+ /* @__PURE__ */ H($, {
2371
+ inline: !1,
2372
+ label: "Invert",
2373
+ children: /* @__PURE__ */ H(jt, {
2374
+ inline: !1,
2375
+ cs: y,
2376
+ on: C,
2377
+ onChange: ae
2378
+ })
2379
+ }),
2380
+ ie(b) && /* @__PURE__ */ H($, {
2381
+ inline: !1,
2382
+ label: "Background",
2383
+ children: /* @__PURE__ */ H(jt, {
2384
+ inline: !1,
2385
+ cs: y,
2386
+ on: e.bgOn !== !1,
2387
+ onChange: (e) => n("bgOn", e)
2388
+ })
2389
+ }),
2390
+ B
2391
+ ]
2392
+ }),
2393
+ /* @__PURE__ */ H(F, {
2394
+ schema: x,
2395
+ layer: e,
2396
+ setProp: P,
2397
+ palette: c,
2398
+ renderAnimate: m,
2399
+ tab: "generate",
2400
+ inline: v
2401
+ }),
2402
+ f(e).length > 0 && /* @__PURE__ */ H(I, {
2403
+ variant: "primary",
2404
+ size: y,
2405
+ className: "w-full",
2406
+ onClick: () => {
2407
+ let t = s(e, O.take());
2408
+ t && i(e.id, t);
2409
+ },
2410
+ children: "Randomize preset"
2411
+ }),
2412
+ /* @__PURE__ */ H(I, {
2413
+ variant: "primary",
2414
+ size: y,
2415
+ className: "w-full",
2416
+ onClick: (t) => t.altKey ? M(u(x, e)) : j(u(x, e), void 0, { withFilters: !0 }),
2417
+ children: "Randomize all"
2418
+ }),
2419
+ k.length > 0 && /* @__PURE__ */ U("div", {
2420
+ className: "grid grid-cols-2 gap-2",
2421
+ children: [k.map((e) => /* @__PURE__ */ H(I, {
2422
+ variant: "primary",
2423
+ size: y,
2424
+ onClick: (t) => t.altKey ? M(e.params) : j(e.params, e),
2425
+ children: e.label
2426
+ }, e.id)), e.loopId === "math-expression" && /* @__PURE__ */ H(I, {
2427
+ variant: "primary",
2428
+ size: y,
2429
+ onClick: (t) => {
2430
+ if (t.altKey) return M(k.find((e) => e.id === "Expression")?.params ?? []);
2431
+ let n = O.take();
2432
+ i(e.id, {
2433
+ expr: re(l(n >>> 0)),
2434
+ _rollSeed: n
2435
+ });
2436
+ },
2437
+ children: "Wild"
2438
+ })]
2439
+ }),
2440
+ !v && /* @__PURE__ */ H(p, { seed: O }),
2441
+ e.loopId === "pattern-rules" && (e.render ?? "tiles") === "tiles" && /* @__PURE__ */ H(ct, {
2442
+ layer: e,
2443
+ patch: r,
2444
+ seed: O
2445
+ })
2446
+ ] }),
2447
+ (h === "style" || h === "labs-effect") && /* @__PURE__ */ U(V, { children: [
2448
+ /* @__PURE__ */ H(F, {
2449
+ schema: x,
2450
+ layer: e,
2451
+ setProp: P,
2452
+ palette: c,
2453
+ renderAnimate: m,
2454
+ tab: "style",
2455
+ inline: v
2456
+ }),
2457
+ e.loopId === "pattern-rules" && /* @__PURE__ */ H(dt, {
2458
+ layer: e,
2459
+ patch: r
2460
+ }),
2461
+ e.loopId === "math-curves" && /* @__PURE__ */ H(ft, {
2462
+ layer: e,
2463
+ patch: r
2464
+ }),
2465
+ e.loopId === "math-expression" && /* @__PURE__ */ U("div", {
2466
+ className: "grid grid-cols-2 gap-2",
2467
+ children: [/* @__PURE__ */ H(I, {
2468
+ variant: "primary",
2469
+ size: y,
2470
+ onClick: () => i(e.id, ne(e)),
2471
+ children: "Fit"
2472
+ }), /* @__PURE__ */ H(I, {
2473
+ variant: "primary",
2474
+ size: y,
2475
+ onClick: () => M(k.find((e) => e.id === "View")?.params ?? []),
2476
+ children: "Reset"
2477
+ })]
2478
+ })
2479
+ ] }),
2480
+ h === "anim" && /* @__PURE__ */ U(V, { children: [
2481
+ A && /* @__PURE__ */ U(V, { children: [
2482
+ /* @__PURE__ */ H("span", {
2483
+ className: "kol-helper-10 text-meta",
2484
+ children: "Motion"
2485
+ }),
2486
+ /* @__PURE__ */ H($, {
2487
+ inline: v,
2488
+ label: "Frame",
2489
+ children: /* @__PURE__ */ H(R, {
2490
+ variant: "subtle",
2491
+ size: y,
2492
+ className: "w-full",
2493
+ options: kt(A.frame, e._framePreset),
2494
+ value: e._framePreset ?? "custom",
2495
+ onChange: de("_framePreset", A.frame)
2496
+ })
2497
+ }),
2498
+ /* @__PURE__ */ H($, {
2499
+ inline: v,
2500
+ label: "Form",
2501
+ children: /* @__PURE__ */ H(R, {
2502
+ variant: "subtle",
2503
+ size: y,
2504
+ className: "w-full",
2505
+ options: kt(A.form, e._formPreset),
2506
+ value: e._formPreset ?? "custom",
2507
+ onChange: de("_formPreset", A.form)
2508
+ })
2509
+ })
2510
+ ] }),
2511
+ /* @__PURE__ */ H(fe, {
2512
+ layer: e,
2513
+ schema: x,
2514
+ setProp: P
2515
+ }),
2516
+ /* @__PURE__ */ H(F, {
2517
+ schema: x,
2518
+ layer: e,
2519
+ setProp: P,
2520
+ palette: c,
2521
+ renderAnimate: m,
2522
+ tab: "anim",
2523
+ inline: v
2524
+ }),
2525
+ _e && /* @__PURE__ */ H(ot, {
2526
+ layer: e,
2527
+ patch: r,
2528
+ defaultDuration: b?.duration ?? 8
2529
+ }),
2530
+ L && /* @__PURE__ */ H(F, {
2531
+ schema: L,
2532
+ layer: e,
2533
+ setProp: n,
2534
+ palette: c,
2535
+ renderAnimate: m,
2536
+ inline: v
2537
+ }),
2538
+ ge && /* @__PURE__ */ H(st, {
2539
+ layer: e,
2540
+ patch: r,
2541
+ camParams: me,
2542
+ isEngine: z,
2543
+ showHeader: !L
2544
+ })
2545
+ ] }),
2546
+ /* @__PURE__ */ H(pt, {
2547
+ layer: e,
2548
+ patch: r,
2549
+ tab: h === "labs-effect" ? "style" : h
2550
+ })
2551
+ ] });
2552
+ }
2553
+ //#endregion
2554
+ //#region src/packs/generators.js
2555
+ var Nt = {
2556
+ layerTypes: ["loop", "misc"],
2557
+ loopById: se,
2558
+ loopDrawParams: A,
2559
+ resolveCameraKeys: ce,
2560
+ loopBgToggleable: ie,
2561
+ presetById: ae,
2562
+ presetParams: j,
2563
+ presetsInGroup: T,
2564
+ presetsInSub: E,
2565
+ presetLayerPatch: O,
2566
+ isToolPreset: oe,
2567
+ groupById: k,
2568
+ drawLoopFrame: x,
2569
+ GENERATIVE_TREE: we,
2570
+ MISC_TREE: Te,
2571
+ THEME_OPTIONS: le,
2572
+ buildParatypeFlattenGroup: je,
2573
+ LoopPicker: Me,
2574
+ LoopFields: Mt,
2575
+ loadGlHost: () => import("./host-DiI1hniH.js")
2576
+ };
2577
+ i("generators", Nt);
2578
+ //#endregion
2579
+ export { rt as a, Te as c, at as i, Mt as n, nt as o, it as r, we as s, Nt as t };