@kolkrabbi/design-editor 0.24.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +2 -2
  2. package/dist/BindDot-CMUtpJPX.js +84 -0
  3. package/dist/BufferGeometryUtils-Cc8LNd5v.js +150 -0
  4. package/dist/ColorModesWindow-CWhL6nfm.js +1493 -0
  5. package/dist/GLTFLoader-BFir8PCc.js +1361 -0
  6. package/dist/OBJLoader-BgqC_-Jn.js +287 -0
  7. package/dist/{OrbitControls-Cql8Rn2i.js → OrbitControls-DVpLgmKv.js} +2755 -2202
  8. package/dist/STLLoader-C6DGLf6r.js +83 -0
  9. package/dist/TreePicker-nMf17QGH.js +68 -0
  10. package/dist/core-CfGqY4VB.js +17504 -0
  11. package/dist/core.js +4 -3
  12. package/dist/design-editor.css +1 -1
  13. package/dist/design-editor.js +2114 -916
  14. package/dist/effects-DZEmfY7a.js +444 -0
  15. package/dist/effects.js +1 -1
  16. package/dist/generators-D1tFSZgG.js +2961 -0
  17. package/dist/generators.js +1 -1
  18. package/dist/{host-qtFVROOD.js → host-CRsCCafL.js} +429 -370
  19. package/dist/{host-be1CWhN1.js → host-ZLJKCZ54.js} +137 -136
  20. package/dist/motion-BJ8xqUKI.js +3096 -0
  21. package/dist/motion.js +1 -1
  22. package/dist/previewScale-BMkeLc6w.js +26 -0
  23. package/dist/{rolls-Bg1XHuvJ.js → rolls-BGtqxVYq.js} +2621 -1522
  24. package/dist/{src-B5fQgAVE.js → src-BpTckTDZ.js} +1 -1
  25. package/dist/{labels-B5qkocWy.js → timelinePinned-BwYq1Msi.js} +321 -164
  26. package/dist/{useLayerEdit-ieOjHx6x.js → useLayerEdit-BFcZhiNX.js} +20992 -12580
  27. package/package.json +10 -8
  28. package/dist/RuleRow-DIbuUt37.js +0 -650
  29. package/dist/TreePicker-DLmMl0aU.js +0 -68
  30. package/dist/core-CNI8b_83.js +0 -12314
  31. package/dist/effectCategories-0PnGZvjd.js +0 -4210
  32. package/dist/effects-BujxwoNY.js +0 -469
  33. package/dist/generators-SpRHQDMq.js +0 -2517
  34. package/dist/motion-Bn3FVkCS.js +0 -2260
@@ -0,0 +1,2961 @@
1
+ import { C as e, D as t, F as n, I as r, In as i, J as a, L as o, Ln as s, Pn as c, Qt as l, S as u, Zt as d, _n as f, a as p, c as m, d as h, en as g, f as _, it as ee, jn as v, l as y, m as te, n as b, nt as ne, o as re, p as x, s as S, t as ie, u as ae, x as oe, yn as se } from "./rolls-BGtqxVYq.js";
2
+ import { A as ce, C as le, D as ue, E as de, O as C, S as w, T as fe, _t as pe, a as T, at as me, b as E, ct as D, dt as he, f as O, ft as ge, gt as _e, h as k, ht as ve, i as A, it as j, j as ye, k as M, lt as N, m as P, mt as be, n as F, o as xe, ot as Se, st as I, t as Ce, ut as we, vt as L, w as Te, yt as Ee } from "./useLayerEdit-BFcZhiNX.js";
3
+ import { A as De, D as Oe, M as ke, N as Ae, P as je, j as Me, n as Ne } from "./ColorModesWindow-CWhL6nfm.js";
4
+ import { n as R, t as z } from "./TreePicker-nMf17QGH.js";
5
+ import { BezierPathEditor as Pe, Button as B, CurveEditor as Fe, Divider as Ie, Dropdown as V, FullscreenOverlay as Le, KeyframeEditor as Re, LabeledControl as H, LabeledControlSection as U, SegmentedToggle as ze, SettingsRow as Be, Slider as Ve, StepList as He, ToggleSwitch as Ue, Tooltip as W, ViewToggle as We, XYPad as Ge } from "@kolkrabbi/kol-component";
6
+ import { useEffect as Ke, useId as qe, useState as Je } from "react";
7
+ import { Fragment as G, jsx as K, jsxs as q } from "react/jsx-runtime";
8
+ //#region src/loops/paratype/flatten.js
9
+ var Ye = Object.fromEntries(j.params.map((e) => [e.key, e.default]));
10
+ function Xe(e) {
11
+ let t = { ...Ye };
12
+ for (let n of Object.keys(Ye)) {
13
+ let r = e[n];
14
+ r != null && typeof r != "object" && (t[n] = r);
15
+ }
16
+ return t;
17
+ }
18
+ function Ze(e, t) {
19
+ let n = t.stemWidth ?? 18, r = 0;
20
+ 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;
21
+ }
22
+ var J = (e) => Number(e.toFixed(2));
23
+ function Qe(e, t, n) {
24
+ if (!e || e.loopId !== "paratype-glyph") return null;
25
+ let r = Math.max(1, e.w ?? 480), i = Math.max(1, e.h ?? 480), a = Xe(e), o = me(a, r, i);
26
+ if (!o.length) return null;
27
+ let s = [];
28
+ t.bg && s.push({
29
+ id: n("shape"),
30
+ type: "shape",
31
+ kind: "rect",
32
+ color: t.bg,
33
+ x: 0,
34
+ y: 0,
35
+ w: r,
36
+ h: i,
37
+ visible: !0,
38
+ opacity: 1,
39
+ blend: "normal"
40
+ });
41
+ for (let e of o) {
42
+ let r = Ze(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 ${J(o)} ${J(c)}" preserveAspectRatio="none"><g transform="translate(${J(r)} ${J(e.y1 + i)}) scale(1 -1)">${l}</g></svg>`;
43
+ s.push({
44
+ id: n("shape"),
45
+ type: "shape",
46
+ kind: "flatten",
47
+ svg: u,
48
+ fit: "fill",
49
+ color: t.fg,
50
+ x: J(e.tx - r * e.s),
51
+ y: J(e.ty - (e.y1 + i) * e.s),
52
+ w: Math.max(1, J(o * e.s)),
53
+ h: Math.max(1, J(c * e.s)),
54
+ visible: !0,
55
+ opacity: 1,
56
+ blend: "normal"
57
+ });
58
+ }
59
+ return {
60
+ id: n("group"),
61
+ type: "group",
62
+ x: e.x ?? 0,
63
+ y: e.y ?? 0,
64
+ w: r,
65
+ h: i,
66
+ visible: e.visible ?? !0,
67
+ opacity: e.opacity ?? 1,
68
+ blend: e.blend ?? "normal",
69
+ children: s
70
+ };
71
+ }
72
+ //#endregion
73
+ //#region src/editor/labs/presetStep.js
74
+ function Y(e, t) {
75
+ return {
76
+ loopGroup: t,
77
+ presetId: e.id,
78
+ presetLabel: e.label,
79
+ loopId: e.loop,
80
+ _framePreset: "custom",
81
+ _formPreset: "custom",
82
+ _lookPreset: "custom",
83
+ ...C(e)
84
+ };
85
+ }
86
+ function $e(e, t, n = "preset") {
87
+ if (!e?.loopGroup) return null;
88
+ let r = e.loopGroup, i = M(r);
89
+ if (!i.length) return null;
90
+ let a = i.find((t) => t.id === e.presetId) ?? i[0], o = (e, t) => (e % t + t) % t;
91
+ if (n === "category") {
92
+ let e = [...new Set(i.map((e) => e.sub).filter(Boolean))];
93
+ if (e.length < 2) return null;
94
+ let n = e[o(e.indexOf(a.sub) + t, e.length)];
95
+ return Y(i.find((e) => e.sub === n), r);
96
+ }
97
+ let s = a.sub ? i.filter((e) => e.sub === a.sub) : i;
98
+ return s.length < 2 ? null : Y(s[o(s.indexOf(a) + t, s.length)], r);
99
+ }
100
+ var et = {
101
+ h: ["preset", -1],
102
+ ArrowLeft: ["preset", -1],
103
+ l: ["preset", 1],
104
+ ArrowRight: ["preset", 1],
105
+ k: ["category", -1],
106
+ ArrowUp: ["category", -1],
107
+ j: ["category", 1],
108
+ ArrowDown: ["category", 1]
109
+ };
110
+ function tt(e, t, n) {
111
+ let r = e?.loopGroup;
112
+ if (!r) return !1;
113
+ let i = M(r).filter((e) => !w(e)), a = i.find((t) => t.id === e.presetId) ?? i[0];
114
+ return t === "type" ? n.some((e) => e !== r && M(e).some((e) => !w(e))) : t === "category" ? new Set(i.map((e) => e.sub).filter((e) => e && e !== a?.sub)).size > 0 : i.some((e) => e.id !== a?.id && (!a?.sub || e.sub === a.sub));
115
+ }
116
+ function nt(e, t, n, r) {
117
+ let i = e?.loopGroup;
118
+ if (!i) return null;
119
+ let a = (e) => e[Math.floor(n() * e.length)], o = (e) => M(e).filter((e) => !w(e));
120
+ if (t === "type") {
121
+ let e = r.filter((e) => e !== i && o(e).length);
122
+ if (!e.length) return null;
123
+ let t = a(e);
124
+ return Y(a(o(t)), t);
125
+ }
126
+ let s = o(i), c = s.find((t) => t.id === e.presetId) ?? s[0];
127
+ if (t === "category") {
128
+ let e = [...new Set(s.map((e) => e.sub).filter((e) => e && e !== c?.sub))];
129
+ if (!e.length) return null;
130
+ let t = a(e);
131
+ return Y(a(s.filter((e) => e.sub === t)), i);
132
+ }
133
+ let l = s.filter((e) => e.id !== c?.id && (!c?.sub || e.sub === c.sub));
134
+ return l.length ? Y(a(l), i) : null;
135
+ }
136
+ function rt(e, t, n) {
137
+ let r = {};
138
+ for (let i of t) {
139
+ if (i.type !== "range" || i.noRandom || i.min == null || i.max == null) continue;
140
+ let t = e[i.key];
141
+ if (typeof t == "object" && t) continue;
142
+ let a = Number(t ?? i.default ?? i.min), o = i.max - i.min, s = a + (n() - .5) * .3 * o;
143
+ s = Math.min(i.max, Math.max(i.min, s)), i.step && (s = Math.round((s - i.min) / i.step) * i.step + i.min), r[i.key] = +s.toFixed(6);
144
+ }
145
+ return r;
146
+ }
147
+ var it = null, at = () => it ??= [...xe(k).filter((e) => !e.rack).map((e) => ({
148
+ id: e.id,
149
+ filters: e.filters
150
+ })), ...A.map((e) => ({
151
+ id: e.id,
152
+ filters: P(e, k)
153
+ }))].filter((e) => e.filters.length);
154
+ function ot(e, t, n) {
155
+ let r = (e) => e[Math.floor(n() * e.length)], i = T(e);
156
+ if (t === "type") {
157
+ let e = at().filter((e) => e.id !== i);
158
+ return e.length ? r(r(e).filters).id : null;
159
+ }
160
+ let a = at().find((e) => e.id === i)?.filters.filter((t) => t.id !== e) ?? [];
161
+ return a.length ? r(a).id : null;
162
+ }
163
+ function st(e, t, n) {
164
+ let r = O(e?.id), i = (e?.params.find((e) => e.key === r)?.options ?? []).map((e) => typeof e == "object" ? e.value : e).filter((e) => e !== t[r]);
165
+ return i.length ? i[Math.floor(n() * i.length)] : null;
166
+ }
167
+ function ct(e, t) {
168
+ return e ? t === "type" ? at().length > 1 : t === "category" ? (at().find((t) => t.id === T(e.id))?.filters.length ?? 0) > 1 : t === "preset" ? !!O(e.id) : !0 : !1;
169
+ }
170
+ //#endregion
171
+ //#region src/editor/compose/inspectors/LoopPicker.jsx
172
+ function lt({ layer: e, tree: t = je, inline: n = !0, about: r = null }) {
173
+ let { updateLayer: i } = a(), s = o(), c = e.loopGroup ?? "shape", l = t.find((e) => e.groups.includes(c)) ?? null, u = M(c), d = u.find((t) => t.id === e.presetId), f = [...new Set(u.map((e) => e.sub).filter(Boolean))], p = d?.sub ?? f[0], m = f.length ? u.filter((e) => e.sub === p) : u, h = (t, n = c) => {
174
+ t && i(e.id, {
175
+ loopGroup: n,
176
+ presetId: t.id,
177
+ presetLabel: t.label,
178
+ loopId: t.loop,
179
+ _framePreset: "custom",
180
+ _formPreset: "custom",
181
+ _lookPreset: "custom",
182
+ ...C(t)
183
+ });
184
+ };
185
+ return /* @__PURE__ */ q(G, { children: [
186
+ t.length > 1 || !l ? /* @__PURE__ */ K(R, {
187
+ label: "Type",
188
+ inline: n,
189
+ children: /* @__PURE__ */ q("div", {
190
+ className: "flex flex-col gap-1 w-full",
191
+ children: [l ? /* @__PURE__ */ K(z, {
192
+ options: t.map((e) => ({
193
+ value: e.label,
194
+ label: e.label
195
+ })),
196
+ value: l.label,
197
+ onChange: (e) => {
198
+ let n = t.find((t) => t.label === e);
199
+ n && h(M(n.groups[0])[0], n.groups[0]);
200
+ }
201
+ }) : /* @__PURE__ */ K("span", {
202
+ className: "kol-helper-12 text-meta px-1",
203
+ children: ke[c] ?? E(c).label
204
+ }), l && l.groups.length > 1 && /* @__PURE__ */ K(z, {
205
+ options: l.groups.map((e) => ({
206
+ value: e,
207
+ label: l.labels?.[e] ?? E(e).label
208
+ })),
209
+ value: c,
210
+ onChange: (e) => h(M(e)[0], e)
211
+ })]
212
+ })
213
+ }) : null,
214
+ f.length > 1 && /* @__PURE__ */ K(R, {
215
+ inline: n,
216
+ label: "Category",
217
+ options: f.map((e) => ({
218
+ value: e,
219
+ label: e
220
+ })),
221
+ value: p,
222
+ onChange: (e) => h(u.find((t) => t.sub === e))
223
+ }),
224
+ /* @__PURE__ */ K(R, {
225
+ inline: n,
226
+ label: "Preset",
227
+ children: /* @__PURE__ */ q("div", {
228
+ className: "flex w-full gap-1",
229
+ children: [
230
+ m.length > 1 && /* @__PURE__ */ K(B, {
231
+ size: s,
232
+ iconOnly: "chevron-left",
233
+ "aria-label": "Previous preset (H)",
234
+ onClick: () => {
235
+ let t = $e(e, -1);
236
+ t && i(e.id, t);
237
+ }
238
+ }),
239
+ /* @__PURE__ */ K(z, {
240
+ className: "flex-1 min-w-0",
241
+ options: m.map((e) => ({
242
+ value: e.id,
243
+ label: e.label
244
+ })),
245
+ value: e.presetId,
246
+ onChange: (e) => h(u.find((t) => t.id === e))
247
+ }),
248
+ m.length > 1 && /* @__PURE__ */ K(B, {
249
+ size: s,
250
+ iconOnly: "chevron-right",
251
+ "aria-label": "Next preset (L)",
252
+ onClick: () => {
253
+ let t = $e(e, 1);
254
+ t && i(e.id, t);
255
+ }
256
+ }),
257
+ r
258
+ ]
259
+ })
260
+ })
261
+ ] });
262
+ }
263
+ //#endregion
264
+ //#region src/editor/params/RollScopesDialog.jsx
265
+ function ut({ open: e, onClose: t, schema: n, layer: r, size: i = "md" }) {
266
+ if (se(), !e) return null;
267
+ let a = re(n ?? [], r);
268
+ return /* @__PURE__ */ K(Le, {
269
+ open: !0,
270
+ scrim: !0,
271
+ onClose: t,
272
+ children: /* @__PURE__ */ q("div", {
273
+ className: "kol-roll-scopes flex flex-col gap-4 p-5 rounded bg-surface-primary border border-oq-08",
274
+ style: { width: "min(420px, calc(100vw - 32px))" },
275
+ children: [
276
+ /* @__PURE__ */ K("p", {
277
+ className: "kol-eyebrow text-fg-96",
278
+ children: "Randomize all rolls"
279
+ }),
280
+ /* @__PURE__ */ q(U, {
281
+ divided: !0,
282
+ children: [a.map((e) => /* @__PURE__ */ K(Be, {
283
+ label: e.label,
284
+ children: /* @__PURE__ */ K(Ue, {
285
+ checked: m(e.id),
286
+ onChange: (t) => y(e.id, t),
287
+ "aria-label": e.label
288
+ })
289
+ }, e.id)), /* @__PURE__ */ K(Be, {
290
+ label: "Effects",
291
+ children: /* @__PURE__ */ K(Ue, {
292
+ checked: S(),
293
+ onChange: (e) => f("rollEffects", !!e),
294
+ "aria-label": "Effects"
295
+ })
296
+ })]
297
+ }),
298
+ /* @__PURE__ */ K("p", {
299
+ className: "kol-mono-12 text-meta",
300
+ children: "A scope switched off still rolls from its own button."
301
+ }),
302
+ /* @__PURE__ */ K(B, {
303
+ tone: "primary",
304
+ size: i,
305
+ className: "w-full",
306
+ onClick: t,
307
+ children: "Done"
308
+ })
309
+ ]
310
+ })
311
+ });
312
+ }
313
+ //#endregion
314
+ //#region src/editor/params/motionPresets.js
315
+ var dt = (e) => i("generators")?.loopById(e) ?? null, ft = {
316
+ frame: [
317
+ {
318
+ id: "static",
319
+ label: "Static",
320
+ params: { flow: 0 }
321
+ },
322
+ {
323
+ id: "drift",
324
+ label: "Drift",
325
+ params: {
326
+ flow: 1,
327
+ spin: 0
328
+ }
329
+ },
330
+ {
331
+ id: "spin",
332
+ label: "Spin",
333
+ params: {
334
+ flow: 1,
335
+ spin: 1
336
+ }
337
+ },
338
+ {
339
+ id: "rush",
340
+ label: "Rush",
341
+ params: {
342
+ flow: 2,
343
+ spin: 0
344
+ }
345
+ }
346
+ ],
347
+ form: [
348
+ {
349
+ id: "static",
350
+ label: "Static",
351
+ params: {
352
+ sweep: 0,
353
+ pulse: 0
354
+ }
355
+ },
356
+ {
357
+ id: "sweep",
358
+ label: "Sweep",
359
+ params: {
360
+ sweep: .6,
361
+ pulse: 0
362
+ }
363
+ },
364
+ {
365
+ id: "breathe",
366
+ label: "Breathe",
367
+ params: {
368
+ sweep: 0,
369
+ pulse: .5
370
+ }
371
+ },
372
+ {
373
+ id: "ripple",
374
+ label: "Ripple",
375
+ params: {
376
+ sweep: .5,
377
+ pulse: .4
378
+ }
379
+ }
380
+ ]
381
+ }, pt = [
382
+ {
383
+ id: "static",
384
+ label: "Static",
385
+ params: { camFlow: 0 }
386
+ },
387
+ {
388
+ id: "pan-right",
389
+ label: "Pan Right",
390
+ params: {
391
+ camFlow: 1,
392
+ panDir: "right"
393
+ }
394
+ },
395
+ {
396
+ id: "pan-left",
397
+ label: "Pan Left",
398
+ params: {
399
+ camFlow: 1,
400
+ panDir: "left"
401
+ }
402
+ },
403
+ {
404
+ id: "pan-up",
405
+ label: "Pan Up",
406
+ params: {
407
+ camFlow: 1,
408
+ panDir: "up"
409
+ }
410
+ },
411
+ {
412
+ id: "pan-down",
413
+ label: "Pan Down",
414
+ params: {
415
+ camFlow: 1,
416
+ panDir: "down"
417
+ }
418
+ },
419
+ {
420
+ id: "drift",
421
+ label: "Drift",
422
+ params: {
423
+ camFlow: 1,
424
+ panDir: "diag"
425
+ }
426
+ },
427
+ {
428
+ id: "glide",
429
+ label: "Glide",
430
+ params: {
431
+ camFlow: 2,
432
+ panDir: "anti"
433
+ }
434
+ }
435
+ ], mt = [
436
+ {
437
+ id: "static",
438
+ label: "Static",
439
+ params: {
440
+ spin: 0,
441
+ animAxis: "none",
442
+ animCycles: 1,
443
+ animWaves: 2,
444
+ pulse: 0,
445
+ fade: 0,
446
+ swing: 0,
447
+ colorMix: 0
448
+ }
449
+ },
450
+ {
451
+ id: "spin",
452
+ label: "Spin",
453
+ params: {
454
+ spin: 1,
455
+ animAxis: "none",
456
+ animCycles: 1,
457
+ animWaves: 2,
458
+ pulse: 0,
459
+ fade: 0,
460
+ swing: 0,
461
+ colorMix: 0
462
+ }
463
+ },
464
+ {
465
+ id: "breathe",
466
+ label: "Breathe",
467
+ params: {
468
+ spin: 0,
469
+ animAxis: "radial",
470
+ animCycles: 1,
471
+ animWaves: 2,
472
+ pulse: .6,
473
+ fade: 0,
474
+ swing: 0,
475
+ colorMix: 0
476
+ }
477
+ },
478
+ {
479
+ id: "pulse-wave",
480
+ label: "Pulse Wave",
481
+ params: {
482
+ spin: 0,
483
+ animAxis: "diag",
484
+ animCycles: 1,
485
+ animWaves: 3,
486
+ pulse: .7,
487
+ fade: 0,
488
+ swing: 0,
489
+ colorMix: 0
490
+ }
491
+ },
492
+ {
493
+ id: "fade-wave",
494
+ label: "Fade Wave",
495
+ params: {
496
+ spin: 0,
497
+ animAxis: "col",
498
+ animCycles: 1,
499
+ animWaves: 2,
500
+ pulse: 0,
501
+ fade: .8,
502
+ swing: 0,
503
+ colorMix: 0
504
+ }
505
+ },
506
+ {
507
+ id: "sway",
508
+ label: "Sway",
509
+ params: {
510
+ spin: 0,
511
+ animAxis: "diag",
512
+ animCycles: 1,
513
+ animWaves: 2,
514
+ pulse: 0,
515
+ fade: 0,
516
+ swing: 60,
517
+ colorMix: 0
518
+ }
519
+ },
520
+ {
521
+ id: "colour-sweep",
522
+ label: "Color Sweep",
523
+ params: {
524
+ spin: 0,
525
+ animAxis: "diag",
526
+ animCycles: 1,
527
+ animWaves: 2,
528
+ pulse: 0,
529
+ fade: 0,
530
+ swing: 0,
531
+ colorMix: 1
532
+ }
533
+ },
534
+ {
535
+ id: "ripple",
536
+ label: "Ripple",
537
+ params: {
538
+ spin: 0,
539
+ animAxis: "radial",
540
+ animCycles: 1,
541
+ animWaves: 4,
542
+ pulse: .5,
543
+ fade: .5,
544
+ swing: 0,
545
+ colorMix: 0
546
+ }
547
+ }
548
+ ], ht = [
549
+ {
550
+ id: "static",
551
+ label: "Static",
552
+ params: {
553
+ camFlow: 0,
554
+ panDir: "right"
555
+ }
556
+ },
557
+ {
558
+ id: "drift",
559
+ label: "Drift",
560
+ params: {
561
+ camFlow: 1,
562
+ panDir: "right"
563
+ }
564
+ },
565
+ {
566
+ id: "reverse",
567
+ label: "Reverse",
568
+ params: {
569
+ camFlow: 1,
570
+ panDir: "left"
571
+ }
572
+ },
573
+ {
574
+ id: "glide",
575
+ label: "Glide",
576
+ params: {
577
+ camFlow: 2,
578
+ panDir: "right"
579
+ }
580
+ },
581
+ {
582
+ id: "rush",
583
+ label: "Rush",
584
+ params: {
585
+ camFlow: 3,
586
+ panDir: "right"
587
+ }
588
+ },
589
+ {
590
+ id: "bias",
591
+ label: "Bias",
592
+ params: {
593
+ camFlow: 1,
594
+ panDir: "right",
595
+ stripeAngle: 30
596
+ }
597
+ },
598
+ {
599
+ id: "diagonal",
600
+ label: "Diagonal",
601
+ params: {
602
+ camFlow: 1,
603
+ panDir: "right",
604
+ stripeAngle: 45
605
+ }
606
+ },
607
+ {
608
+ id: "counter",
609
+ label: "Counter",
610
+ params: {
611
+ camFlow: 1,
612
+ panDir: "right",
613
+ stripeAngle: 135
614
+ }
615
+ }
616
+ ], gt = [
617
+ {
618
+ id: "static",
619
+ label: "Static",
620
+ params: {
621
+ camFlow: 0,
622
+ waveFlow: 0,
623
+ panDir: "right"
624
+ }
625
+ },
626
+ {
627
+ id: "drift",
628
+ label: "Drift",
629
+ params: {
630
+ camFlow: 1,
631
+ waveFlow: 0,
632
+ panDir: "right"
633
+ }
634
+ },
635
+ {
636
+ id: "travel",
637
+ label: "Travel",
638
+ params: {
639
+ camFlow: 0,
640
+ waveFlow: 1,
641
+ panDir: "right"
642
+ }
643
+ },
644
+ {
645
+ id: "both",
646
+ label: "Both",
647
+ params: {
648
+ camFlow: 1,
649
+ waveFlow: 1,
650
+ panDir: "right"
651
+ }
652
+ },
653
+ {
654
+ id: "reverse",
655
+ label: "Reverse",
656
+ params: {
657
+ camFlow: 1,
658
+ waveFlow: 0,
659
+ panDir: "left"
660
+ }
661
+ },
662
+ {
663
+ id: "glide",
664
+ label: "Glide",
665
+ params: {
666
+ camFlow: 1,
667
+ waveFlow: 2,
668
+ panDir: "right"
669
+ }
670
+ },
671
+ {
672
+ id: "diagonal",
673
+ label: "Diagonal",
674
+ params: {
675
+ camFlow: 1,
676
+ waveFlow: 1,
677
+ panDir: "right",
678
+ stripeAngle: 45
679
+ }
680
+ }
681
+ ], _t = [
682
+ {
683
+ id: "static",
684
+ label: "Static",
685
+ params: {
686
+ fieldSway: 0,
687
+ fieldStagger: 0,
688
+ fieldCycles: 1
689
+ }
690
+ },
691
+ {
692
+ id: "sway",
693
+ label: "Sway",
694
+ params: {
695
+ fieldSway: .5,
696
+ fieldStagger: .3,
697
+ fieldCycles: 1
698
+ }
699
+ },
700
+ {
701
+ id: "alternate",
702
+ label: "Alternate",
703
+ params: {
704
+ fieldSway: .6,
705
+ fieldStagger: 1,
706
+ fieldCycles: 1
707
+ }
708
+ },
709
+ {
710
+ id: "ripple",
711
+ label: "Ripple",
712
+ params: {
713
+ fieldSway: .45,
714
+ fieldStagger: .5,
715
+ fieldCycles: 1
716
+ }
717
+ }
718
+ ], vt = [
719
+ {
720
+ id: "static",
721
+ label: "Static",
722
+ params: {
723
+ animAxis: "none",
724
+ animCycles: 1,
725
+ animWaves: 2,
726
+ pulse: 0,
727
+ fade: 0
728
+ }
729
+ },
730
+ {
731
+ id: "pulse",
732
+ label: "Pulse",
733
+ params: {
734
+ animAxis: "diag",
735
+ animCycles: 1,
736
+ animWaves: 3,
737
+ pulse: .6,
738
+ fade: 0
739
+ }
740
+ },
741
+ {
742
+ id: "fade",
743
+ label: "Fade",
744
+ params: {
745
+ animAxis: "col",
746
+ animCycles: 1,
747
+ animWaves: 2,
748
+ pulse: 0,
749
+ fade: .7
750
+ }
751
+ },
752
+ {
753
+ id: "ripple",
754
+ label: "Ripple",
755
+ params: {
756
+ animAxis: "radial",
757
+ animCycles: 1,
758
+ animWaves: 4,
759
+ pulse: .4,
760
+ fade: .4
761
+ }
762
+ }
763
+ ], yt = {
764
+ frame: [
765
+ {
766
+ id: "static",
767
+ label: "Static",
768
+ params: { flow: 0 }
769
+ },
770
+ {
771
+ id: "drift",
772
+ label: "Drift",
773
+ params: {
774
+ flow: 1,
775
+ panDir: "right"
776
+ }
777
+ },
778
+ {
779
+ id: "reverse",
780
+ label: "Reverse",
781
+ params: {
782
+ flow: 1,
783
+ panDir: "left"
784
+ }
785
+ },
786
+ {
787
+ id: "rise",
788
+ label: "Rise",
789
+ params: {
790
+ flow: 1,
791
+ panDir: "up"
792
+ }
793
+ },
794
+ {
795
+ id: "fall",
796
+ label: "Fall",
797
+ params: {
798
+ flow: 1,
799
+ panDir: "down"
800
+ }
801
+ },
802
+ {
803
+ id: "diagonal",
804
+ label: "Diagonal",
805
+ params: {
806
+ flow: 1,
807
+ panDir: "diag"
808
+ }
809
+ },
810
+ {
811
+ id: "glide",
812
+ label: "Glide",
813
+ params: {
814
+ flow: 2,
815
+ panDir: "anti"
816
+ }
817
+ },
818
+ {
819
+ id: "rush",
820
+ label: "Rush",
821
+ params: {
822
+ flow: 3,
823
+ panDir: "right"
824
+ }
825
+ }
826
+ ],
827
+ form: [
828
+ {
829
+ id: "static",
830
+ label: "Static",
831
+ params: {
832
+ speed: 0,
833
+ stagger: 0,
834
+ pulse: 0,
835
+ fade: 0,
836
+ swing: 0
837
+ }
838
+ },
839
+ {
840
+ id: "scroll",
841
+ label: "Scroll",
842
+ params: {
843
+ speed: .45,
844
+ stagger: 0,
845
+ pulse: 0,
846
+ fade: 0,
847
+ swing: 0
848
+ }
849
+ },
850
+ {
851
+ id: "morph",
852
+ label: "Morph",
853
+ params: {
854
+ speed: .3,
855
+ stagger: .5,
856
+ pulse: 0,
857
+ fade: 0,
858
+ swing: 0
859
+ }
860
+ },
861
+ {
862
+ id: "sway",
863
+ label: "Sway",
864
+ params: {
865
+ speed: .3,
866
+ stagger: 0,
867
+ pulse: 0,
868
+ fade: 0,
869
+ swing: 30
870
+ }
871
+ },
872
+ {
873
+ id: "breathe",
874
+ label: "Breathe",
875
+ params: {
876
+ speed: .3,
877
+ stagger: 0,
878
+ pulse: .6,
879
+ fade: 0,
880
+ swing: 0
881
+ }
882
+ },
883
+ {
884
+ id: "shimmer",
885
+ label: "Shimmer",
886
+ params: {
887
+ speed: .4,
888
+ stagger: 0,
889
+ pulse: 0,
890
+ fade: .7,
891
+ swing: 0
892
+ }
893
+ },
894
+ {
895
+ id: "rich",
896
+ label: "Rich",
897
+ params: {
898
+ speed: .4,
899
+ stagger: .35,
900
+ pulse: .4,
901
+ fade: .3,
902
+ swing: 18
903
+ }
904
+ }
905
+ ]
906
+ }, bt = {
907
+ frame: [
908
+ {
909
+ id: "static",
910
+ label: "Static",
911
+ params: { spin: 0 }
912
+ },
913
+ {
914
+ id: "orbit",
915
+ label: "Orbit",
916
+ params: { spin: 1 }
917
+ },
918
+ {
919
+ id: "spin",
920
+ label: "Spin",
921
+ params: { spin: 2 }
922
+ }
923
+ ],
924
+ form: [
925
+ {
926
+ id: "static",
927
+ label: "Static",
928
+ params: {
929
+ morph: 0,
930
+ ripple: 0,
931
+ fade: 0
932
+ }
933
+ },
934
+ {
935
+ id: "breathe",
936
+ label: "Breathe",
937
+ params: {
938
+ morph: .25,
939
+ ripple: 0,
940
+ fade: 0
941
+ }
942
+ },
943
+ {
944
+ id: "pulse",
945
+ label: "Pulse",
946
+ params: {
947
+ morph: .5,
948
+ ripple: 0,
949
+ fade: 0
950
+ }
951
+ },
952
+ {
953
+ id: "ripple",
954
+ label: "Ripple",
955
+ params: {
956
+ morph: 0,
957
+ ripple: .6,
958
+ fade: 0
959
+ }
960
+ },
961
+ {
962
+ id: "shimmer",
963
+ label: "Shimmer",
964
+ params: {
965
+ morph: 0,
966
+ ripple: 0,
967
+ fade: .6
968
+ }
969
+ },
970
+ {
971
+ id: "rich",
972
+ label: "Rich",
973
+ params: {
974
+ morph: .3,
975
+ ripple: .4,
976
+ fade: .3
977
+ }
978
+ }
979
+ ]
980
+ }, xt = {
981
+ frame: [
982
+ {
983
+ id: "static",
984
+ label: "Static",
985
+ params: {
986
+ flowSpeed: 0,
987
+ swirl: 0,
988
+ drift: 0
989
+ }
990
+ },
991
+ {
992
+ id: "drift",
993
+ label: "Drift",
994
+ params: {
995
+ flowSpeed: 1,
996
+ swirl: 0,
997
+ drift: 0
998
+ }
999
+ },
1000
+ {
1001
+ id: "wind",
1002
+ label: "Wind",
1003
+ params: {
1004
+ flowSpeed: 1,
1005
+ swirl: 0,
1006
+ drift: .6,
1007
+ driftDir: "right"
1008
+ }
1009
+ },
1010
+ {
1011
+ id: "vortex",
1012
+ label: "Vortex",
1013
+ params: {
1014
+ flowSpeed: 1,
1015
+ swirl: .5,
1016
+ drift: 0
1017
+ }
1018
+ },
1019
+ {
1020
+ id: "rush",
1021
+ label: "Rush",
1022
+ params: {
1023
+ flowSpeed: 2.4,
1024
+ swirl: 0,
1025
+ drift: 0
1026
+ }
1027
+ }
1028
+ ],
1029
+ form: [
1030
+ {
1031
+ id: "lines",
1032
+ label: "Lines",
1033
+ params: {
1034
+ dots: !1,
1035
+ pulse: 0,
1036
+ jitter: 0
1037
+ }
1038
+ },
1039
+ {
1040
+ id: "dots",
1041
+ label: "Dots",
1042
+ params: {
1043
+ dots: !0,
1044
+ pulse: 0,
1045
+ jitter: 0
1046
+ }
1047
+ },
1048
+ {
1049
+ id: "pulse",
1050
+ label: "Pulse",
1051
+ params: {
1052
+ dots: !1,
1053
+ pulse: .6,
1054
+ jitter: 0
1055
+ }
1056
+ },
1057
+ {
1058
+ id: "shimmer",
1059
+ label: "Shimmer",
1060
+ params: {
1061
+ dots: !0,
1062
+ pulse: .3,
1063
+ jitter: .5
1064
+ }
1065
+ }
1066
+ ]
1067
+ }, St = {
1068
+ frame: [
1069
+ {
1070
+ id: "static",
1071
+ label: "Static",
1072
+ params: {
1073
+ hueSpeed: 0,
1074
+ cspin: 0,
1075
+ czoom: 0
1076
+ }
1077
+ },
1078
+ {
1079
+ id: "cycle",
1080
+ label: "Cycle",
1081
+ params: {
1082
+ hueSpeed: 1,
1083
+ cspin: 0,
1084
+ czoom: 0
1085
+ }
1086
+ },
1087
+ {
1088
+ id: "turn",
1089
+ label: "Turn",
1090
+ params: {
1091
+ hueSpeed: .4,
1092
+ cspin: .6,
1093
+ czoom: 0
1094
+ }
1095
+ },
1096
+ {
1097
+ id: "breathe",
1098
+ label: "Breathe",
1099
+ params: {
1100
+ hueSpeed: .4,
1101
+ cspin: 0,
1102
+ czoom: .6
1103
+ }
1104
+ },
1105
+ {
1106
+ id: "rush",
1107
+ label: "Rush",
1108
+ params: {
1109
+ hueSpeed: 2,
1110
+ cspin: 1,
1111
+ czoom: 0
1112
+ }
1113
+ }
1114
+ ],
1115
+ form: [
1116
+ {
1117
+ id: "static",
1118
+ label: "Static",
1119
+ params: {
1120
+ ringSpeed: 0,
1121
+ shade: 0
1122
+ }
1123
+ },
1124
+ {
1125
+ id: "rings",
1126
+ label: "Rings",
1127
+ params: {
1128
+ ringSpeed: 1,
1129
+ shade: 0
1130
+ }
1131
+ },
1132
+ {
1133
+ id: "pulse",
1134
+ label: "Pulse",
1135
+ params: {
1136
+ ringSpeed: 1,
1137
+ shade: .4
1138
+ }
1139
+ },
1140
+ {
1141
+ id: "fast",
1142
+ label: "Fast",
1143
+ params: {
1144
+ ringSpeed: 2.4,
1145
+ shade: 0
1146
+ }
1147
+ }
1148
+ ]
1149
+ }, Ct = {
1150
+ frame: [
1151
+ {
1152
+ id: "static",
1153
+ label: "Static",
1154
+ params: {
1155
+ vpSpin: 0,
1156
+ vpZoom: 1
1157
+ }
1158
+ },
1159
+ {
1160
+ id: "spin",
1161
+ label: "Spin",
1162
+ params: {
1163
+ vpSpin: 1,
1164
+ vpZoom: 1
1165
+ }
1166
+ },
1167
+ {
1168
+ id: "spin2",
1169
+ label: "Spin ×2",
1170
+ params: {
1171
+ vpSpin: 2,
1172
+ vpZoom: 1
1173
+ }
1174
+ },
1175
+ {
1176
+ id: "push",
1177
+ label: "Push in",
1178
+ params: {
1179
+ vpSpin: 0,
1180
+ vpZoom: 1.3
1181
+ }
1182
+ }
1183
+ ],
1184
+ form: [
1185
+ {
1186
+ id: "static",
1187
+ label: "Static",
1188
+ params: {
1189
+ vpPulse: 0,
1190
+ vpWobble: 0
1191
+ }
1192
+ },
1193
+ {
1194
+ id: "pulse",
1195
+ label: "Pulse",
1196
+ params: {
1197
+ vpPulse: .3,
1198
+ vpWobble: 0
1199
+ }
1200
+ },
1201
+ {
1202
+ id: "wobble",
1203
+ label: "Wobble",
1204
+ params: {
1205
+ vpPulse: 0,
1206
+ vpWobble: 8
1207
+ }
1208
+ },
1209
+ {
1210
+ id: "breathe",
1211
+ label: "Breathe",
1212
+ params: {
1213
+ vpPulse: .22,
1214
+ vpWobble: 5
1215
+ }
1216
+ }
1217
+ ]
1218
+ };
1219
+ function wt(e, t = {}) {
1220
+ switch (e) {
1221
+ case "scanline": return ft;
1222
+ case "pattern-rules": {
1223
+ let e = t.render ?? "tiles", n = e === "field" && t.field === "organic";
1224
+ return {
1225
+ frame: e === "tiles" ? pt : n ? gt : ht,
1226
+ form: e === "tiles" ? mt : e === "weave" ? vt : _t
1227
+ };
1228
+ }
1229
+ case "math-waveform": return yt;
1230
+ case "math-surface": return bt;
1231
+ case "math-field": return (t.kind ?? "scalar") === "complex" ? St : xt;
1232
+ default: return dt(e)?.params?.some((e) => e.key === "vpSpin") ? Ct : null;
1233
+ }
1234
+ }
1235
+ function Tt(e) {
1236
+ let t = /* @__PURE__ */ new Set();
1237
+ for (let n of e ?? []) for (let e of Object.keys(n.params ?? {})) t.add(e);
1238
+ return t;
1239
+ }
1240
+ //#endregion
1241
+ //#region src/editor/params/lookPresets.js
1242
+ var Et = {
1243
+ Spectrum: {
1244
+ palette: "spectrum",
1245
+ spectral: !0,
1246
+ hue: 0,
1247
+ irid: 1.1
1248
+ },
1249
+ Iris: {
1250
+ palette: "iris",
1251
+ spectral: !1,
1252
+ hue: .1,
1253
+ irid: 1.05
1254
+ },
1255
+ Aqua: {
1256
+ palette: "aqua",
1257
+ spectral: !1,
1258
+ hue: .5,
1259
+ irid: 1
1260
+ },
1261
+ Magma: {
1262
+ palette: "magma",
1263
+ spectral: !1,
1264
+ hue: .05,
1265
+ irid: .95
1266
+ },
1267
+ Candy: {
1268
+ palette: "candy",
1269
+ spectral: !1,
1270
+ hue: .8,
1271
+ irid: 1.15
1272
+ },
1273
+ Noir: {
1274
+ palette: "spectrum",
1275
+ spectral: !0,
1276
+ hue: 0,
1277
+ irid: .6,
1278
+ rim: 1
1279
+ }
1280
+ };
1281
+ function Dt(e) {
1282
+ return e === "softforms" || e === "softforms3d" ? Et : null;
1283
+ }
1284
+ //#endregion
1285
+ //#region src/loops/gl/primitiveEasing.js
1286
+ function Ot(e) {
1287
+ let t = 7.5625, n = 2.75;
1288
+ 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);
1289
+ }
1290
+ var kt = {
1291
+ linear: (e) => e,
1292
+ in: (e) => e * e,
1293
+ out: (e) => 1 - (1 - e) * (1 - e),
1294
+ inout: (e) => e < .5 ? 2 * e * e : 1 - (-2 * e + 2) ** 2 / 2,
1295
+ sine: (e) => -(Math.cos(Math.PI * e) - 1) / 2,
1296
+ cubicIn: (e) => e * e * e,
1297
+ cubicOut: (e) => 1 - (1 - e) ** 3,
1298
+ cubicInOut: (e) => e < .5 ? 4 * e * e * e : 1 - (-2 * e + 2) ** 3 / 2,
1299
+ expoOut: (e) => e >= 1 ? 1 : 1 - 2 ** (-10 * e),
1300
+ expoInOut: (e) => e <= 0 ? 0 : e >= 1 ? 1 : e < .5 ? 2 ** (20 * e - 10) / 2 : (2 - 2 ** (-20 * e + 10)) / 2,
1301
+ backOut: (e) => 1 + 2.70158 * (e - 1) ** 3 + 1.70158 * (e - 1) ** 2,
1302
+ backInOut: (e) => {
1303
+ let t = 1.70158 * 1.525;
1304
+ return e < .5 ? (2 * e) ** 2 * (3.5949095 * 2 * e - t) / 2 : ((2 * e - 2) ** 2 * (3.5949095 * (e * 2 - 2) + t) + 2) / 2;
1305
+ },
1306
+ elasticOut: (e) => {
1307
+ if (e <= 0) return 0;
1308
+ if (e >= 1) return 1;
1309
+ let t = 2 * Math.PI / 3;
1310
+ return 2 ** (-10 * e) * Math.sin((e * 10 - .75) * t) + 1;
1311
+ },
1312
+ bounceOut: Ot
1313
+ }, At = {
1314
+ linear: "Linear",
1315
+ in: "Ease in",
1316
+ out: "Ease out",
1317
+ inout: "Ease in-out",
1318
+ sine: "Sine",
1319
+ cubicIn: "Cubic in",
1320
+ cubicOut: "Cubic out",
1321
+ cubicInOut: "Cubic in-out",
1322
+ expoOut: "Expo out",
1323
+ expoInOut: "Expo in-out",
1324
+ backOut: "Back out",
1325
+ backInOut: "Back in-out",
1326
+ elasticOut: "Elastic out",
1327
+ bounceOut: "Bounce out"
1328
+ }, jt = Object.keys(kt).map((e) => ({
1329
+ value: e,
1330
+ label: At[e] || e
1331
+ })), Mt = (e, t, n) => [
1332
+ c(e[0], t[0], n),
1333
+ c(e[1], t[1], n),
1334
+ c(e[2], t[2], n)
1335
+ ], Nt = (e) => ({
1336
+ rot: e.rot || [
1337
+ 0,
1338
+ 0,
1339
+ 0
1340
+ ],
1341
+ pos: e.pos || [
1342
+ 0,
1343
+ 0,
1344
+ 0
1345
+ ],
1346
+ scale: e.scale ?? 1
1347
+ });
1348
+ function Pt(e, t) {
1349
+ if (!e || !e.length) return {};
1350
+ if (e.length === 1) return Nt(e[0]);
1351
+ let n = 0;
1352
+ for (; n < e.length - 1 && t > e[n + 1].t;) n++;
1353
+ 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));
1354
+ return o = (kt[i.ease] || kt.inout)(o), {
1355
+ rot: Mt(r.rot || [
1356
+ 0,
1357
+ 0,
1358
+ 0
1359
+ ], i.rot || [
1360
+ 0,
1361
+ 0,
1362
+ 0
1363
+ ], o),
1364
+ pos: Mt(r.pos || [
1365
+ 0,
1366
+ 0,
1367
+ 0
1368
+ ], i.pos || [
1369
+ 0,
1370
+ 0,
1371
+ 0
1372
+ ], o),
1373
+ scale: c(r.scale ?? 1, i.scale ?? 1, o)
1374
+ };
1375
+ }
1376
+ var Ft = [{
1377
+ t: 0,
1378
+ rot: [
1379
+ 0,
1380
+ 0,
1381
+ 0
1382
+ ],
1383
+ pos: [
1384
+ 0,
1385
+ 0,
1386
+ 0
1387
+ ],
1388
+ scale: 1,
1389
+ ease: "inout"
1390
+ }, {
1391
+ t: 1,
1392
+ rot: [
1393
+ 0,
1394
+ Math.PI * 2,
1395
+ 0
1396
+ ],
1397
+ pos: [
1398
+ 0,
1399
+ 0,
1400
+ 0
1401
+ ],
1402
+ scale: 1,
1403
+ ease: "inout"
1404
+ }];
1405
+ //#endregion
1406
+ //#region src/loops/gl/phase.js
1407
+ function It(e, t) {
1408
+ let n = Number(e), r = Number(t);
1409
+ return !n || n <= 0 || !r || r <= 0 ? 1 : Math.max(1, Math.round(r / n));
1410
+ }
1411
+ function Lt(e, t) {
1412
+ return e * t % 1;
1413
+ }
1414
+ //#endregion
1415
+ //#region src/editor/compose/inspectors/KeyframeEditor.jsx
1416
+ function Rt({ layer: e, patch: t, defaultDuration: n = 8 }) {
1417
+ let r = () => It(e.duration ?? n, g.getLoopSeconds());
1418
+ return /* @__PURE__ */ K(Re, {
1419
+ keyframes: e.keyframes,
1420
+ onChange: (e) => t({ keyframes: e }),
1421
+ t: () => g.getT() * r() % 1,
1422
+ onPause: () => g.pause(),
1423
+ onSeek: (e) => g.seek(e / r()),
1424
+ easeOptions: jt,
1425
+ defaultKeyframes: Ft
1426
+ });
1427
+ }
1428
+ //#endregion
1429
+ //#region src/editor/compose/inspectors/CameraPoseSlots.jsx
1430
+ function zt({ layer: e, patch: t, camParams: n, isEngine: r, showHeader: i = !1 }) {
1431
+ let a = o(), s = Array.isArray(e._camSlots) ? e._camSlots : [], c = [
1432
+ s[0] ?? null,
1433
+ s[1] ?? null,
1434
+ s[2] ?? null
1435
+ ], l = (r) => {
1436
+ let i = {};
1437
+ for (let t of n) i[t.key] = e[t.key] ?? t.default;
1438
+ let a = [...c];
1439
+ a[r] = i, t({ _camSlots: a });
1440
+ }, u = (e) => {
1441
+ c[e] && t({ ...c[e] });
1442
+ };
1443
+ return /* @__PURE__ */ q(G, { children: [i && /* @__PURE__ */ K("span", {
1444
+ className: "kol-eyebrow text-fg-80",
1445
+ children: "Camera"
1446
+ }), /* @__PURE__ */ q("div", {
1447
+ className: "flex items-center gap-1",
1448
+ children: [n.length > 0 && c.map((e, t) => /* @__PURE__ */ K(W, {
1449
+ label: e ? "Recall pose (shift-click = overwrite)" : "Save pose",
1450
+ children: /* @__PURE__ */ K(B, {
1451
+ "aria-label": e ? "Recall pose (shift-click = overwrite)" : "Save pose",
1452
+ tone: e ? "inverted" : "ghost",
1453
+ size: a,
1454
+ onClick: (n) => n.shiftKey || !e ? l(t) : u(t),
1455
+ children: t + 1
1456
+ })
1457
+ }, t)), /* @__PURE__ */ K(B, {
1458
+ tone: "primary",
1459
+ size: a,
1460
+ className: "ml-auto",
1461
+ onClick: () => {
1462
+ let i = {};
1463
+ for (let e of n) i[e.key] = e.default;
1464
+ t(i), r && import("./host-CRsCCafL.js").then((t) => t.hostAction?.(e.id, "resetCamera")).catch(() => {});
1465
+ },
1466
+ children: "Reset"
1467
+ })]
1468
+ })] });
1469
+ }
1470
+ //#endregion
1471
+ //#region src/editor/compose/inspectors/RulesEditor.jsx
1472
+ function Bt({ layer: e, patch: t, seed: n }) {
1473
+ let r = o(), i = e.rules ?? [], a = (e, n) => t({
1474
+ rules: e,
1475
+ ...n
1476
+ }), s = () => a([...i, pe()]), c = (e, t) => a(i.map((n, r) => r === e ? t : n)), l = (e) => a(i.filter((t, n) => n !== e)), u = (e) => {
1477
+ let t = n.take(), r = _(t >>> 0);
1478
+ a(i.map((t, n) => n === e ? {
1479
+ ...L(r),
1480
+ id: t.id
1481
+ } : t), { _rollSeed: t });
1482
+ };
1483
+ return /* @__PURE__ */ K(H, {
1484
+ label: `Rules · ${i.length}`,
1485
+ children: /* @__PURE__ */ q("div", {
1486
+ className: "flex flex-col gap-2",
1487
+ children: [i.map((e, t) => /* @__PURE__ */ K(Oe, {
1488
+ rule: e,
1489
+ onChange: (e) => c(t, e),
1490
+ onRemove: () => l(t),
1491
+ onReroll: () => u(t)
1492
+ }, e.id ?? t)), /* @__PURE__ */ q("div", {
1493
+ className: "grid grid-cols-2 gap-2",
1494
+ children: [/* @__PURE__ */ K(B, {
1495
+ tone: "primary",
1496
+ size: r,
1497
+ iconLeft: "plus",
1498
+ onClick: s,
1499
+ children: "Add rule"
1500
+ }), /* @__PURE__ */ K(B, {
1501
+ tone: "primary",
1502
+ size: r,
1503
+ onClick: () => {
1504
+ let e = n.take(), t = _(e >>> 0), r = 1 + Math.floor(t() * 3);
1505
+ a(Array.from({ length: r }, () => L(t)), { _rollSeed: e });
1506
+ },
1507
+ children: "Randomize"
1508
+ })]
1509
+ })]
1510
+ })
1511
+ });
1512
+ }
1513
+ //#endregion
1514
+ //#region src/editor/compose/inspectors/ProfileEditor.jsx
1515
+ var Vt = (e) => e.map((e) => ({
1516
+ x: e.x,
1517
+ y: (1 - e.y) / 2,
1518
+ hl: {
1519
+ x: e.hlx ?? 0,
1520
+ y: -(e.hly ?? 0) / 2
1521
+ },
1522
+ hr: {
1523
+ x: e.hrx ?? 0,
1524
+ y: -(e.hry ?? 0) / 2
1525
+ }
1526
+ })), Ht = (e) => e.map((e) => ({
1527
+ x: e.x,
1528
+ y: v(1 - 2 * e.y, -1, 1),
1529
+ hlx: e.hl?.x ?? 0,
1530
+ hly: -2 * (e.hl?.y ?? 0),
1531
+ hrx: e.hr?.x ?? 0,
1532
+ hry: -2 * (e.hr?.y ?? 0)
1533
+ }));
1534
+ function Ut({ value: e, onChange: t }) {
1535
+ let n = Array.isArray(e) && e.length > 1 ? e : _e, r = o();
1536
+ return /* @__PURE__ */ K(Pe, {
1537
+ value: Vt(n),
1538
+ onChange: (e) => {
1539
+ let r = Ht(e);
1540
+ if (r.length < 3 || r[0].x > .001 || r[r.length - 1].x < .999) return;
1541
+ r[0].x = 0, r[r.length - 1].x = 1;
1542
+ let i = Math.abs(r[0].y - n[0].y) > 1e-6 ? r[0].y : r[r.length - 1].y;
1543
+ r[0].y = i, r[r.length - 1].y = i;
1544
+ for (let e = 1; e < r.length - 1; e++) r[e].x = v(r[e].x, r[e - 1].x + .02, .98);
1545
+ t(r);
1546
+ },
1547
+ aspect: 2,
1548
+ size: r,
1549
+ minPoints: 3,
1550
+ ariaLabel: "Profile curve"
1551
+ });
1552
+ }
1553
+ function Wt({ layer: e, patch: t }) {
1554
+ return e.render !== "field" || e.field !== "organic" || e.waveProfile !== "custom" ? null : /* @__PURE__ */ K(H, {
1555
+ label: "Profile curve",
1556
+ children: /* @__PURE__ */ K(Ut, {
1557
+ value: Array.isArray(e.waveCurve) && e.waveCurve.length > 1 ? e.waveCurve : _e,
1558
+ onChange: (e) => t({ waveCurve: e })
1559
+ })
1560
+ });
1561
+ }
1562
+ //#endregion
1563
+ //#region src/editor/compose/inspectors/CurveEditor.jsx
1564
+ function Gt({ layer: e, patch: t }) {
1565
+ let n = e.clip === "custom", r = n ? null : N(e.clip), i = n ? null : {
1566
+ label: (Se.find((t) => t.id === e.clip) || Se[0]).label,
1567
+ copies: r.copies,
1568
+ spiral: r.spiral,
1569
+ layerCopies: e.copies,
1570
+ layerSpiral: e.spiral
1571
+ };
1572
+ return /* @__PURE__ */ K(Fe, {
1573
+ value: n ? e.custom ?? D("polar") : r.def,
1574
+ stock: i,
1575
+ onChange: (e, { extras: n }) => t({
1576
+ clip: "custom",
1577
+ ...n,
1578
+ custom: e
1579
+ }),
1580
+ validate: we,
1581
+ kinds: I,
1582
+ defaultFor: D
1583
+ });
1584
+ }
1585
+ //#endregion
1586
+ //#region src/editor/compose/inspectors/ParatypeTools.jsx
1587
+ function Kt({ layer: e, patch: t, tab: n, renderAnimate: r }) {
1588
+ return e?.loopId === "paratype-glyph" ? n === "generate" ? /* @__PURE__ */ K(qt, { layer: e }) : n === "style" ? /* @__PURE__ */ K(Jt, {
1589
+ layer: e,
1590
+ patch: t,
1591
+ renderAnimate: r
1592
+ }) : null : null;
1593
+ }
1594
+ function qt({ layer: e }) {
1595
+ let t = o(), { flattenParatype: n } = a();
1596
+ return n ? /* @__PURE__ */ K(W, {
1597
+ label: "Flatten the glyph(s) to vector shape layers (one-way)",
1598
+ children: /* @__PURE__ */ K(B, {
1599
+ "aria-label": "Flatten the glyph(s) to vector shape layers (one-way)",
1600
+ tone: "primary",
1601
+ size: t,
1602
+ className: "w-full",
1603
+ onClick: () => n(e.id),
1604
+ children: "Flatten to vector"
1605
+ })
1606
+ }) : null;
1607
+ }
1608
+ function Jt({ layer: e, patch: n, renderAnimate: r }) {
1609
+ let i = o(), a = ee(Te(e.loopId)?.params ?? [], e).filter((e) => e.type === "range");
1610
+ if (a.length < 2) return null;
1611
+ let s = (e, t) => a.some((t) => t.key === e) && e !== t ? e : a.find((e) => e.key !== t)?.key, c = s(e._xyX ?? "stemWidth", null), l = s(e._xyY ?? "oWidth", c), u = a.find((e) => e.key === c), d = a.find((e) => e.key === l);
1612
+ if (!u || !d) return null;
1613
+ let f = (t, n) => typeof e[t] == "number" ? e[t] : n.default, p = (n) => t(e[n]), m = (e, t) => {
1614
+ let n = t.step ?? 1;
1615
+ return n < 1 ? Number((Math.round(e / n) * n).toFixed(4)) : Math.round(e);
1616
+ }, h = a.map((e) => ({
1617
+ value: e.key,
1618
+ label: e.label
1619
+ }));
1620
+ return /* @__PURE__ */ q(G, { children: [
1621
+ /* @__PURE__ */ K("span", {
1622
+ className: "kol-eyebrow text-fg-80",
1623
+ children: "Explore"
1624
+ }),
1625
+ /* @__PURE__ */ q("div", {
1626
+ className: "grid grid-cols-2 gap-2",
1627
+ children: [/* @__PURE__ */ K(H, {
1628
+ label: "X axis",
1629
+ children: /* @__PURE__ */ q("div", {
1630
+ className: "flex items-center gap-2",
1631
+ children: [/* @__PURE__ */ K(V, {
1632
+ variant: "subtle",
1633
+ size: i,
1634
+ className: "w-full min-w-0",
1635
+ options: h,
1636
+ value: c,
1637
+ onChange: (e) => n({ _xyX: e })
1638
+ }), r?.(u)]
1639
+ })
1640
+ }), /* @__PURE__ */ K(H, {
1641
+ label: "Y axis",
1642
+ children: /* @__PURE__ */ q("div", {
1643
+ className: "flex items-center gap-2",
1644
+ children: [/* @__PURE__ */ K(V, {
1645
+ variant: "subtle",
1646
+ size: i,
1647
+ className: "w-full min-w-0",
1648
+ options: h,
1649
+ value: l,
1650
+ onChange: (e) => n({ _xyY: e })
1651
+ }), r?.(d)]
1652
+ })
1653
+ })]
1654
+ }),
1655
+ /* @__PURE__ */ K(Ge, {
1656
+ xValue: f(c, u),
1657
+ yValue: f(l, d),
1658
+ xMin: u.min ?? 0,
1659
+ xMax: u.max ?? 1,
1660
+ yMin: d.min ?? 0,
1661
+ yMax: d.max ?? 1,
1662
+ xLabel: u.label,
1663
+ yLabel: d.label,
1664
+ onChange: (e, t) => n({
1665
+ ...!p(c) && { [c]: m(e, u) },
1666
+ ...!p(l) && { [l]: m(t, d) }
1667
+ })
1668
+ })
1669
+ ] });
1670
+ }
1671
+ //#endregion
1672
+ //#region src/editor/compose/inspectors/SoftformsLayers.jsx
1673
+ var Yt = 5, Xt = [
1674
+ {
1675
+ value: "teardrop",
1676
+ label: "Teardrop"
1677
+ },
1678
+ {
1679
+ value: "pill",
1680
+ label: "Pill"
1681
+ },
1682
+ {
1683
+ value: "dome",
1684
+ label: "Dome"
1685
+ },
1686
+ {
1687
+ value: "orb",
1688
+ label: "Orb"
1689
+ },
1690
+ {
1691
+ value: "super",
1692
+ label: "Lozenge"
1693
+ }
1694
+ ], Zt = [
1695
+ {
1696
+ value: "sphere",
1697
+ label: "Sphere"
1698
+ },
1699
+ {
1700
+ value: "capsule",
1701
+ label: "Capsule"
1702
+ },
1703
+ {
1704
+ value: "teardrop",
1705
+ label: "Teardrop"
1706
+ },
1707
+ {
1708
+ value: "lozenge",
1709
+ label: "Lozenge"
1710
+ }
1711
+ ], Qt = [
1712
+ {
1713
+ k: "x",
1714
+ label: "Position X",
1715
+ min: -1,
1716
+ max: 1,
1717
+ step: .01,
1718
+ def: 0
1719
+ },
1720
+ {
1721
+ k: "y",
1722
+ label: "Position Y",
1723
+ min: -1,
1724
+ max: 1,
1725
+ step: .01,
1726
+ def: 0
1727
+ },
1728
+ {
1729
+ k: "sx",
1730
+ label: "Scale X",
1731
+ min: .12,
1732
+ max: 1.6,
1733
+ step: .01,
1734
+ def: .6
1735
+ },
1736
+ {
1737
+ k: "sy",
1738
+ label: "Scale Y",
1739
+ min: .12,
1740
+ max: 1.6,
1741
+ step: .01,
1742
+ def: .6,
1743
+ fallback: "sx"
1744
+ },
1745
+ {
1746
+ k: "rot",
1747
+ label: "Rotation",
1748
+ min: 0,
1749
+ max: 360,
1750
+ step: 1,
1751
+ def: 0
1752
+ },
1753
+ {
1754
+ k: "hue",
1755
+ label: "Hue",
1756
+ min: 0,
1757
+ max: 1,
1758
+ step: .01,
1759
+ def: 0
1760
+ }
1761
+ ], $t = [
1762
+ {
1763
+ k: "x",
1764
+ label: "Position X",
1765
+ min: -1.2,
1766
+ max: 1.2,
1767
+ step: .01,
1768
+ def: 0
1769
+ },
1770
+ {
1771
+ k: "y",
1772
+ label: "Position Y",
1773
+ min: -1.2,
1774
+ max: 1.2,
1775
+ step: .01,
1776
+ def: 0
1777
+ },
1778
+ {
1779
+ k: "z",
1780
+ label: "Position Z",
1781
+ min: -1.2,
1782
+ max: 1.2,
1783
+ step: .01,
1784
+ def: 0
1785
+ },
1786
+ {
1787
+ k: "sx",
1788
+ label: "Scale X",
1789
+ min: .12,
1790
+ max: 1.6,
1791
+ step: .01,
1792
+ def: .7
1793
+ },
1794
+ {
1795
+ k: "sy",
1796
+ label: "Scale Y",
1797
+ min: .12,
1798
+ max: 1.6,
1799
+ step: .01,
1800
+ def: .7,
1801
+ fallback: "sx"
1802
+ },
1803
+ {
1804
+ k: "sz",
1805
+ label: "Scale Z",
1806
+ min: .12,
1807
+ max: 1.6,
1808
+ step: .01,
1809
+ def: .7,
1810
+ fallback: "sx"
1811
+ },
1812
+ {
1813
+ k: "rot",
1814
+ label: "Rotation",
1815
+ min: 0,
1816
+ max: 360,
1817
+ step: 1,
1818
+ def: 0
1819
+ },
1820
+ {
1821
+ k: "hue",
1822
+ label: "Hue",
1823
+ min: 0,
1824
+ max: 1,
1825
+ step: .01,
1826
+ def: 0
1827
+ }
1828
+ ], en = Math.PI * 2, X = (e) => Math.round(e * 100) / 100, Z = (e, t, n) => t + e() * (n - t), tn = (e, t) => {
1829
+ let n = t * Math.sqrt(e()), r = e() * en;
1830
+ return [n * Math.cos(r), n * Math.sin(r)];
1831
+ }, nn = (e, t) => {
1832
+ let n = t * Math.cbrt(e()), r = e() * en, i = Math.acos(2 * e() - 1);
1833
+ return [
1834
+ n * Math.sin(i) * Math.cos(r),
1835
+ n * Math.sin(i) * Math.sin(r),
1836
+ n * Math.cos(i) * .8
1837
+ ];
1838
+ }, rn = (e) => {
1839
+ let t = e.length || 1, n = e.reduce((e, n) => ({
1840
+ x: e.x + n.x / t,
1841
+ y: e.y + n.y / t
1842
+ }), {
1843
+ x: 0,
1844
+ y: 0
1845
+ });
1846
+ return e.map((e) => ({
1847
+ ...e,
1848
+ x: X(e.x - n.x),
1849
+ y: X(e.y - n.y)
1850
+ }));
1851
+ }, an = (e) => {
1852
+ let t = e.length || 1, n = e.reduce((e, n) => ({
1853
+ x: e.x + n.x / t,
1854
+ y: e.y + n.y / t,
1855
+ z: e.z + n.z / t
1856
+ }), {
1857
+ x: 0,
1858
+ y: 0,
1859
+ z: 0
1860
+ });
1861
+ return e.map((e) => ({
1862
+ ...e,
1863
+ x: X(e.x - n.x),
1864
+ y: X(e.y - n.y),
1865
+ z: X(e.z - n.z)
1866
+ }));
1867
+ }, on = (e, t) => e.find((e) => e.value === t)?.label ?? t;
1868
+ function sn({ layer: e }) {
1869
+ let t = o(), { updateLayer: n } = a(), r = Ce(e.id, { history: "coalesce" }), i = e.loopId === "softforms3d", s = i && !!e.metaball, c = i ? Zt : Xt, l = i ? $t : Qt, u = s ? 2 : 1, d = Array.isArray(e.forms) ? e.forms : [], [f, p] = Je(-1), m = f >= 0 && f < d.length ? d[f] : null, h = (t) => {
1870
+ p(t), window.dispatchEvent(new CustomEvent("kol:softform-select", { detail: {
1871
+ id: e.id,
1872
+ index: t,
1873
+ from: "panel"
1874
+ } }));
1875
+ };
1876
+ Ke(() => {
1877
+ let t = (t) => {
1878
+ t.detail?.id === e.id && t.detail.from === "canvas" && p(t.detail.index);
1879
+ };
1880
+ return window.addEventListener("kol:softform-select", t), () => window.removeEventListener("kol:softform-select", t);
1881
+ }, [e.id]);
1882
+ let g = (t) => n(e.id, { forms: t }), ee = (e, t) => r.patch({ forms: d.map((n, r) => r === f ? {
1883
+ ...n,
1884
+ [e]: t
1885
+ } : n) }), y = () => {
1886
+ if (d.length >= Yt) return;
1887
+ let e = i ? {
1888
+ t: "sphere",
1889
+ x: 0,
1890
+ y: 0,
1891
+ z: 0,
1892
+ sx: .7,
1893
+ sy: .7,
1894
+ sz: .7,
1895
+ rot: 0,
1896
+ hue: X(Math.random())
1897
+ } : {
1898
+ t: "dome",
1899
+ x: 0,
1900
+ y: 0,
1901
+ sx: .6,
1902
+ sy: .6,
1903
+ rot: 0,
1904
+ hue: X(Math.random())
1905
+ };
1906
+ g([...d, e]), h(d.length);
1907
+ }, te = (e) => {
1908
+ if (d.length >= Yt) return;
1909
+ let t = {
1910
+ ...d[e],
1911
+ x: v((d[e].x ?? 0) + .12, -1.2, 1.2),
1912
+ y: v((d[e].y ?? 0) - .1, -1.2, 1.2)
1913
+ };
1914
+ g([
1915
+ ...d.slice(0, e + 1),
1916
+ t,
1917
+ ...d.slice(e + 1)
1918
+ ]), h(e + 1);
1919
+ }, b = (e) => {
1920
+ d.length <= u || (g(d.filter((t, n) => n !== e)), h(-1));
1921
+ }, ne = (e, t) => {
1922
+ if (t < 0 || t >= d.length) return;
1923
+ let n = [...d];
1924
+ [n[e], n[t]] = [n[t], n[e]], g(n), h(t);
1925
+ };
1926
+ return /* @__PURE__ */ q("div", {
1927
+ className: "flex flex-col gap-2",
1928
+ children: [
1929
+ /* @__PURE__ */ K("span", {
1930
+ className: "kol-eyebrow text-fg-80",
1931
+ children: "Forms"
1932
+ }),
1933
+ /* @__PURE__ */ K(He, {
1934
+ size: t,
1935
+ reorder: "grab",
1936
+ activeIndex: f >= 0 ? d.length - 1 - f : null,
1937
+ items: d.map((e, t) => {
1938
+ let n = d.length - 1 - t;
1939
+ return {
1940
+ id: n,
1941
+ label: on(c, d[n].t),
1942
+ actions: [{
1943
+ icon: "copy",
1944
+ label: "Duplicate form",
1945
+ hidden: d.length >= Yt,
1946
+ onClick: () => te(n)
1947
+ }, {
1948
+ icon: "trash",
1949
+ label: "Delete form",
1950
+ hidden: d.length <= u,
1951
+ onClick: () => b(n)
1952
+ }]
1953
+ };
1954
+ }),
1955
+ onSelect: (e) => h(d.length - 1 - e),
1956
+ onMove: (e, t) => ne(d.length - 1 - e, d.length - 1 - t)
1957
+ }),
1958
+ d.length < Yt && /* @__PURE__ */ K(B, {
1959
+ tone: "primary",
1960
+ size: t,
1961
+ className: "w-full",
1962
+ iconLeft: "plus",
1963
+ iconSize: 12,
1964
+ onClick: y,
1965
+ children: "Add form"
1966
+ }),
1967
+ !i && /* @__PURE__ */ K(W, {
1968
+ label: "Edit forms on the canvas (click to select, drag to move, corners to scale, knob to rotate)",
1969
+ children: /* @__PURE__ */ K(B, {
1970
+ "aria-label": "Edit forms on the canvas (click to select, drag to move, corners to scale, knob to rotate)",
1971
+ tone: "primary",
1972
+ size: t,
1973
+ className: "w-full",
1974
+ onClick: () => window.dispatchEvent(new CustomEvent("kol:softform-edit", { detail: {
1975
+ id: e.id,
1976
+ index: Math.max(0, f)
1977
+ } })),
1978
+ children: "Edit forms on canvas"
1979
+ })
1980
+ }),
1981
+ m && /* @__PURE__ */ q("div", {
1982
+ className: "flex flex-col gap-2 pt-1",
1983
+ children: [
1984
+ /* @__PURE__ */ K("span", {
1985
+ className: "kol-eyebrow text-fg-80",
1986
+ children: "Selected form"
1987
+ }),
1988
+ /* @__PURE__ */ K(H, {
1989
+ label: "Type",
1990
+ children: /* @__PURE__ */ K(V, {
1991
+ variant: "subtle",
1992
+ size: t,
1993
+ className: "w-full",
1994
+ options: c,
1995
+ value: m.t,
1996
+ onChange: (e) => g(d.map((t, n) => n === f ? {
1997
+ ...t,
1998
+ t: e
1999
+ } : t))
2000
+ })
2001
+ }),
2002
+ l.map((e) => {
2003
+ let t = m[e.k] ?? (e.fallback ? m[e.fallback] : void 0), n = typeof t == "number" ? t : e.def;
2004
+ return /* @__PURE__ */ K(H, {
2005
+ label: e.label,
2006
+ children: /* @__PURE__ */ K(Ve, {
2007
+ min: e.min,
2008
+ max: e.max,
2009
+ step: e.step,
2010
+ value: n,
2011
+ onChange: (t) => ee(e.k, t)
2012
+ })
2013
+ }, e.k);
2014
+ })
2015
+ ]
2016
+ }),
2017
+ /* @__PURE__ */ K("span", {
2018
+ className: "kol-helper-10 text-meta pt-1",
2019
+ children: "Randomize forms"
2020
+ }),
2021
+ /* @__PURE__ */ q("div", {
2022
+ className: "grid grid-cols-2 gap-2",
2023
+ children: [
2024
+ /* @__PURE__ */ K(B, {
2025
+ tone: "primary",
2026
+ size: t,
2027
+ onClick: () => {
2028
+ let e = _(x());
2029
+ g(d.map((t) => ({
2030
+ ...t,
2031
+ hue: X(e())
2032
+ })));
2033
+ },
2034
+ children: "Color"
2035
+ }),
2036
+ /* @__PURE__ */ K(B, {
2037
+ tone: "primary",
2038
+ size: t,
2039
+ onClick: () => {
2040
+ let e = _(x());
2041
+ g(d.map((t) => i ? {
2042
+ ...t,
2043
+ x: X(Z(e, -.7, .7)),
2044
+ y: X(Z(e, -.7, .7)),
2045
+ z: X(Z(e, -.5, .5)),
2046
+ rot: Math.round(Z(e, 0, 360))
2047
+ } : {
2048
+ ...t,
2049
+ x: X(Z(e, -.55, .55)),
2050
+ y: X(Z(e, -.75, .75)),
2051
+ rot: Math.round(Z(e, 0, 360))
2052
+ }));
2053
+ },
2054
+ children: "Transform"
2055
+ }),
2056
+ /* @__PURE__ */ K(B, {
2057
+ tone: "primary",
2058
+ size: t,
2059
+ onClick: () => {
2060
+ let e = _(x());
2061
+ g(d.map((t) => {
2062
+ let n = X(Z(e, .35, .95)), r = X(Z(e, .35, .95));
2063
+ return i ? {
2064
+ ...t,
2065
+ sx: n,
2066
+ sy: r,
2067
+ sz: X(Z(e, .35, .95))
2068
+ } : {
2069
+ ...t,
2070
+ sx: n,
2071
+ sy: r
2072
+ };
2073
+ }));
2074
+ },
2075
+ children: "Scale"
2076
+ }),
2077
+ /* @__PURE__ */ K(B, {
2078
+ tone: "primary",
2079
+ size: t,
2080
+ onClick: () => {
2081
+ let t = _(x());
2082
+ n(e.id, {
2083
+ motion: X(Z(t, 0, 1.1)),
2084
+ sweep: Math.round(Z(t, 0, 360))
2085
+ });
2086
+ },
2087
+ children: "Animation"
2088
+ })
2089
+ ]
2090
+ }),
2091
+ /* @__PURE__ */ K(B, {
2092
+ tone: "primary",
2093
+ size: t,
2094
+ className: "w-full",
2095
+ onClick: () => {
2096
+ let e = _(x());
2097
+ if (i) {
2098
+ if (s) {
2099
+ let t = 2 + Math.floor(e() * 4), n = Z(e, .45, .9);
2100
+ g(an(Array.from({ length: t }, (r, i) => {
2101
+ let [a, o, s] = nn(e, n), c = X(Z(e, .5, .92));
2102
+ return {
2103
+ t: "sphere",
2104
+ x: X(a),
2105
+ y: X(o),
2106
+ z: X(s),
2107
+ sx: c,
2108
+ sy: c,
2109
+ sz: c,
2110
+ rot: 0,
2111
+ hue: X(i / t)
2112
+ };
2113
+ })));
2114
+ } else {
2115
+ let t = Z(e, .6, 1.15);
2116
+ g(an(d.map((n) => {
2117
+ let [r, i, a] = nn(e, t);
2118
+ return {
2119
+ ...n,
2120
+ x: X(r),
2121
+ y: X(i),
2122
+ z: X(a),
2123
+ rot: Math.round(Z(e, 0, 360))
2124
+ };
2125
+ })));
2126
+ }
2127
+ return;
2128
+ }
2129
+ let t = 2 + Math.floor(e() * 4), n = Z(e, .45, .85);
2130
+ g(rn(Array.from({ length: t }, (r, i) => {
2131
+ let [a, o] = tn(e, n);
2132
+ return {
2133
+ t: Xt[Math.floor(e() * Xt.length)].value,
2134
+ x: X(a),
2135
+ y: X(o),
2136
+ sx: X(Z(e, .4, .85)),
2137
+ sy: X(Z(e, .4, .85)),
2138
+ rot: Math.round(Z(e, 0, 360)),
2139
+ hue: X(i / t)
2140
+ };
2141
+ })));
2142
+ },
2143
+ children: "Rearrange"
2144
+ })
2145
+ ]
2146
+ });
2147
+ }
2148
+ //#endregion
2149
+ //#region src/editor/compose/inspectors/PenroseLayers.jsx
2150
+ var cn = [
2151
+ {
2152
+ role: "fg",
2153
+ label: "Foreground"
2154
+ },
2155
+ {
2156
+ role: "accent",
2157
+ label: "Accent"
2158
+ },
2159
+ {
2160
+ role: "dim",
2161
+ label: "Dim"
2162
+ },
2163
+ {
2164
+ role: "warm",
2165
+ label: "Warm"
2166
+ }
2167
+ ], ln = {
2168
+ fg: 1,
2169
+ accent: 1,
2170
+ dim: 5,
2171
+ warm: 1
2172
+ };
2173
+ function un({ layer: e, setProp: t, patch: n }) {
2174
+ let r = o();
2175
+ ve();
2176
+ let i = be(e.loopId), a = cn.filter((e) => i?.has(e.role));
2177
+ if (!a.length) return null;
2178
+ let s = e._layerPrev ?? {};
2179
+ return /* @__PURE__ */ K(U, {
2180
+ label: "Layers",
2181
+ divided: !0,
2182
+ children: /* @__PURE__ */ K(He, {
2183
+ size: r,
2184
+ items: a.map(({ role: n, label: r }) => {
2185
+ let i = `${n}Opacity`, a = Number(e[i] ?? ln[n]);
2186
+ return {
2187
+ id: n,
2188
+ label: r,
2189
+ swatch: e[n] ?? null,
2190
+ shown: a > 0,
2191
+ control: /* @__PURE__ */ K(Ve, {
2192
+ min: 0,
2193
+ max: 5,
2194
+ step: .1,
2195
+ value: a,
2196
+ onChange: (e) => t(i, e),
2197
+ formatValue: (e) => e.toFixed(1),
2198
+ displayWidth: 3,
2199
+ readoutPreset: "rail",
2200
+ className: "w-full min-w-0",
2201
+ "aria-label": `${r} opacity`
2202
+ })
2203
+ };
2204
+ }),
2205
+ onToggleShown: (t) => {
2206
+ let { role: r } = a[t], i = `${r}Opacity`, o = Number(e[i] ?? ln[r]);
2207
+ n(o > 0 ? {
2208
+ [i]: 0,
2209
+ _layerPrev: {
2210
+ ...s,
2211
+ [r]: o
2212
+ }
2213
+ } : { [i]: s[r] || ln[r] });
2214
+ }
2215
+ })
2216
+ });
2217
+ }
2218
+ //#endregion
2219
+ //#region src/loops/about.js
2220
+ var dn = {
2221
+ "morph-circle": "Shape interpolation — a circle eased into polygons, point by point",
2222
+ "square-circle": "Superellipse morph between a square and a circle",
2223
+ "star-morph": "Star polygon whose inner radius and point count are tweened",
2224
+ blob: "Noise-displaced closed curve — a circle pushed by periodic noise",
2225
+ lissajous: "Lissajous figures — two perpendicular sine oscillations at an integer ratio",
2226
+ spiral: "Archimedean and logarithmic spirals",
2227
+ "rose-curve": "Rose curves (rhodonea) — r = cos(kθ)",
2228
+ "ring-pulse": "Concentric rings pulsing on a phase offset",
2229
+ "concentric-arcs": "Concentric arc segments rotating at harmonic rates",
2230
+ "bars-wave": "A row of bars sampling a travelling sine wave",
2231
+ "wave-grid": "A grid displaced by a 2D sine field",
2232
+ "checker-pulse": "Checkerboard whose cells scale on a phase wave",
2233
+ "grid-rotor": "A grid of marks each rotating with a phase offset",
2234
+ "arc-sweep": "Arcs sweeping on staggered timing",
2235
+ "radial-bars": "Bars arranged radially, lengths driven by a wave",
2236
+ "orbit-dots": "Dots on circular orbits at harmonic speeds",
2237
+ "sliced-solid": "Sliced solid — a solid of revolution cut into translucent discs that drift along its axis",
2238
+ "pattern-rules": "Rule-based repeat patterns — stripes, tiles and lattices from a small rule set",
2239
+ stripes: "Periodic stripe field — a sine of position, thresholded",
2240
+ "checker-field": "Checkerboard field from two crossed square waves",
2241
+ halftone: "Halftone — dot size follows a field value, as in print screening",
2242
+ "gradient-field": "Multi-stop colour gradient field",
2243
+ plasma: "Plasma — summed sines of position and time (the demoscene effect)",
2244
+ "rings-field": "Concentric ring field — sine of the distance from a centre",
2245
+ interference: "Wave interference — summed circular waves from several sources",
2246
+ swirl: "Swirl — a field rotated by an angle that falls off with distance",
2247
+ moire: "Moiré — two fine line patterns overlaid at an offset",
2248
+ contour: "Contour lines (isolines) of a noise field",
2249
+ scanline: "Scanline art — rows of marks displaced and sized by a field",
2250
+ "optic-halftone": "Op-art halftone matrix — dot screens with optical interference",
2251
+ "optic-moire": "Op-art moiré — line grids interfering",
2252
+ "optic-reaction": "Reaction-diffusion pattern (Gray-Scott) in op-art tones",
2253
+ meshgradient: "Mesh gradient — colour points blended over a deformable mesh",
2254
+ "abstract-rd": "Reaction-diffusion — Gray-Scott chemistry (spots, stripes, coral)",
2255
+ "abstract-mstp": "Multi-scale Turing patterns (Jonathan McCabe)",
2256
+ "math-expression": "Oscilloscope — a typed expression traced like an XY scope",
2257
+ "math-waveform": "Waveform plots — stacked periodic functions",
2258
+ "math-curves": "Parametric curves in 3D — epicycles, knots, harmonographs",
2259
+ "math-spinner": "Spinners — rotating epicycle stacks",
2260
+ "math-threads": "String art — chords between points on a circle by a multiplication rule",
2261
+ "math-surface": "Parametric surface z = f(x, y), drawn as a 3D wireframe",
2262
+ "math-field": "Vector field plot — direction marks over a function of position",
2263
+ "math-orbits": "Orbital paths — bodies on Keplerian and harmonic orbits",
2264
+ "math-pendulum": "Pendulum wave — N pendulums whose swing counts differ by one; in-phase groups form at every rational fraction of the cycle",
2265
+ "paratype-glyph": "Parametric type — glyphs built from adjustable strokes",
2266
+ "modulator-rings": "Modulated rings — circles displaced by stacked oscillators",
2267
+ "vector-distress": "Vector distress — SVG paths roughened by noise and erosion",
2268
+ "flow-obstacles": "Flow field around obstacles — particles following a curl-noise field",
2269
+ "flow-charges": "Electric field lines between point charges",
2270
+ "flow-glyphs": "Glyph vortex — characters carried by a rotating flow",
2271
+ "flow-ascii": "ASCII field — characters chosen by a noise field’s value",
2272
+ "flow-voronoi": "Voronoi diagram whose cells pulse",
2273
+ "flow-growth": "Differential growth — one closed line that grows, splits and repels (Anders Hoff’s differential line)",
2274
+ "flow-letter-gap": "Letter-gap flow — lines that route around set type",
2275
+ "drift-air": "Clouds and sky — fractal noise with domain warping",
2276
+ "drift-water": "Water — Gerstner-style waves and caustics",
2277
+ "drift-cloth": "Cloth — folded sine sheets with lighting",
2278
+ iridescent: "Thin-film iridescence — colour from viewing angle over gradient forms",
2279
+ softforms: "Soft forms — 2D signed-distance shapes, smooth-unioned and lit",
2280
+ softforms3d: "3D soft forms — ray-marched signed-distance shapes with metaball blending",
2281
+ scene3d: "3D scene — primitive meshes, lighting and a camera",
2282
+ forms3d: "3D forms — instanced shapes arranged in space",
2283
+ environment: "Environment — a 3D landscape scene (terrain, tunnel)",
2284
+ ribbon: "Ribbon — a swept 3D surface along a curve",
2285
+ "life-game": "Conway’s Game of Life and eight other B/S cellular automata (from kol-monitor)",
2286
+ glass: "Glass — refraction through a distorted lens surface",
2287
+ dither: "Ordered and error-diffusion dithering (Bayer, Floyd–Steinberg)",
2288
+ "fx-chromatic": "Chromatic aberration — RGB channels offset",
2289
+ "fx-edge": "Edge detection — Sobel gradient magnitude",
2290
+ "fx-posterize": "Posterize — colour levels quantised",
2291
+ "fx-pixelsort": "Pixel sorting — runs of pixels sorted by brightness",
2292
+ "fx-mirror": "Mirror — the frame reflected about an axis",
2293
+ "fx-kaleido": "Kaleidoscope — a wedge mirrored around a centre",
2294
+ "fx-threshold": "Threshold — two tones split at a brightness level",
2295
+ "fx-blocks": "Block glitch — rectangles displaced and repeated",
2296
+ "fx-media": "Media motion — the image moved, scaled and rotated over time",
2297
+ "fx-ascii": "ASCII art — brightness mapped to characters",
2298
+ "fx-halftone-dither": "Halftone dither — print screens and ordered dither",
2299
+ "fx-bitmap": "1-bit bitmap — threshold with a dither pattern",
2300
+ "fx-growth": "Differential growth line drawn over the image’s brightness",
2301
+ "fx-slice-wave": "Slice wave — horizontal slices offset by a sine",
2302
+ "fx-riso": "Risograph — two spot-colour layers with misregistration and grain",
2303
+ "fx-hsl": "HSL colour adjustment",
2304
+ "fx-hsv": "HSV colour adjustment",
2305
+ "fx-brightness": "Brightness adjustment",
2306
+ "fx-contrast": "Contrast adjustment",
2307
+ "fx-rgb": "Per-channel RGB levels",
2308
+ "fx-invert": "Colour inversion",
2309
+ "fx-sepia": "Sepia toning",
2310
+ "fx-grayscale": "Greyscale (luma)",
2311
+ "fx-enhance": "Enhance — local contrast and saturation",
2312
+ "fx-blur": "Gaussian blur",
2313
+ "fx-pixelate": "Pixelate — mosaic blocks",
2314
+ "fx-solarize": "Solarisation — tones above a level inverted",
2315
+ "fx-emboss": "Emboss — a directional relief kernel",
2316
+ "fx-noise": "Film grain noise",
2317
+ "gl-trails": "Feedback trails — the previous frame fed back and faded",
2318
+ "gl-scan": "Rutt-Etra — scanlines displaced by brightness (the 1970s video synthesiser)",
2319
+ "gl-slitscan": "Slit-scan — time smeared across the frame, a row at a time",
2320
+ "gl-disco": "Disco — a mirror-ball facet shader",
2321
+ "gl-distort": "Distortion — noise-driven UV displacement",
2322
+ "gl-lens": "Lens — barrel and pincushion distortion",
2323
+ "filter-adjustment": "Gamma, saturation, contrast and brightness adjustment",
2324
+ "filter-hsl-adjustment": "HSL adjustment",
2325
+ "filter-color-gradient": "Gradient map overlay",
2326
+ "filter-color-map": "Colour lookup (LUT) mapping",
2327
+ "filter-color-overlay": "Flat colour overlay",
2328
+ "filter-color-replace": "Replace one colour with another",
2329
+ "filter-multi-color-replace": "Replace several colours",
2330
+ "filter-radial-blur": "Radial (spin) blur",
2331
+ "filter-zoom-blur": "Zoom blur",
2332
+ "filter-motion-blur": "Directional motion blur",
2333
+ "filter-kawase-blur": "Kawase blur — a fast multi-pass blur",
2334
+ "filter-tilt-shift": "Tilt-shift — a band of focus",
2335
+ "filter-backdrop-blur": "Backdrop blur",
2336
+ "filter-displacement": "Displacement map — pixels pushed by a second image",
2337
+ "filter-twist": "Twist — a swirl distortion",
2338
+ "filter-bulge-pinch": "Bulge / pinch lens distortion",
2339
+ "filter-shockwave": "Shockwave — an expanding ring of refraction",
2340
+ "filter-ascii": "ASCII characters by brightness",
2341
+ "filter-cross-hatch": "Cross-hatching by brightness",
2342
+ "filter-dot": "Dot screen (halftone)",
2343
+ "filter-crt": "CRT — scanlines, curvature and vignette",
2344
+ "filter-old-film": "Old film — scratches, grain and sepia",
2345
+ "filter-glitch": "Glitch — slices offset with colour shift",
2346
+ "filter-rgb-split": "RGB split",
2347
+ "filter-simplex-noise": "Simplex noise overlay",
2348
+ "filter-bloom": "Bloom — bright areas glow",
2349
+ "filter-advanced-bloom": "Bloom with threshold and brightness control",
2350
+ "filter-glow": "Glow around edges",
2351
+ "filter-godray": "God rays — volumetric light shafts",
2352
+ "filter-simple-lightmap": "Light map — a texture multiplies the light",
2353
+ "filter-bevel": "Bevel — edges lit as relief",
2354
+ "filter-drop-shadow": "Drop shadow",
2355
+ "filter-outline": "Outline around shapes",
2356
+ "filter-reflection": "Water reflection with waves",
2357
+ "filter-convolution": "Custom 3×3 convolution kernel"
2358
+ }, fn = new Set([
2359
+ "drift",
2360
+ "iridescent",
2361
+ "softforms",
2362
+ "mesh"
2363
+ ]), pn = new Set([
2364
+ "scene",
2365
+ "forms",
2366
+ "environment",
2367
+ "ribbon"
2368
+ ]);
2369
+ function mn(e, t = !1) {
2370
+ return t ? e.pixi || /^filter-/.test(e.id) ? "WebGL shader (PixiJS)" : e.kind === "engine" || /^gl-/.test(e.id) ? "WebGL shader" : "canvas 2D" : e.group === "field" && e.id !== "halftone" || e.id === "optic-moire" ? "WebGL shader" : pn.has(e.engine) ? "three.js" : e.engine === "softforms3d" ? "WebGL shader (ray-marched)" : fn.has(e.engine) ? "WebGL shader" : "canvas 2D";
2371
+ }
2372
+ function hn(e, t = !1) {
2373
+ if (!e) return null;
2374
+ let n = e.about ?? {};
2375
+ return {
2376
+ kind: n.kind ?? (t ? "effect" : "generative"),
2377
+ basis: n.basis ?? dn[e.id] ?? null,
2378
+ engine: n.engine ?? mn(e, t),
2379
+ dimension: n.dimension ?? (e.is3D ? "3D" : "2D")
2380
+ };
2381
+ }
2382
+ //#endregion
2383
+ //#region src/editor/compose/inspectors/AboutLine.jsx
2384
+ function gn({ def: e, isFilter: t = !1 }) {
2385
+ let n = qe(), r = o(), i = hn(e, t);
2386
+ return i ? /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ K(B, {
2387
+ size: r,
2388
+ iconOnly: "info",
2389
+ "aria-label": "About this preset",
2390
+ popoverTarget: n
2391
+ }), /* @__PURE__ */ q("div", {
2392
+ id: n,
2393
+ popover: "auto",
2394
+ className: "m-auto w-[min(320px,calc(100vw-32px))] rounded-[var(--kol-radius-sm)] border-0 bg-surface-primary p-4 text-body shadow-[var(--kol-shadow-rail-up)]",
2395
+ children: [/* @__PURE__ */ q("p", {
2396
+ className: "kol-eyebrow text-meta",
2397
+ children: [
2398
+ i.kind,
2399
+ " · ",
2400
+ i.engine,
2401
+ " · ",
2402
+ i.dimension
2403
+ ]
2404
+ }), i.basis && /* @__PURE__ */ K("p", {
2405
+ className: "kol-sans-body-03 mt-2",
2406
+ children: i.basis
2407
+ })]
2408
+ })] }) : null;
2409
+ }
2410
+ //#endregion
2411
+ //#region src/loops/theme.js
2412
+ function _n(t, n, r, i) {
2413
+ return oe(t, n, e(l(r, i)));
2414
+ }
2415
+ //#endregion
2416
+ //#region src/editor/compose/inspectors/LoopFields.jsx
2417
+ var vn = Me.flatMap((e) => e.groups), yn = (e, t) => {
2418
+ let n = e.map((e) => ({
2419
+ value: e.id,
2420
+ label: e.label
2421
+ }));
2422
+ return t == null || t === "custom" ? [{
2423
+ value: "custom",
2424
+ label: "Custom"
2425
+ }, ...n] : n;
2426
+ };
2427
+ function Q({ inline: e, label: t, align: r = "fill", children: i }) {
2428
+ return e ? /* @__PURE__ */ K(Be, {
2429
+ label: t,
2430
+ align: r,
2431
+ labelWidth: n,
2432
+ children: i
2433
+ }) : /* @__PURE__ */ K(H, {
2434
+ label: t,
2435
+ children: i
2436
+ });
2437
+ }
2438
+ var bn = [{
2439
+ value: "off",
2440
+ label: "Off"
2441
+ }, {
2442
+ value: "on",
2443
+ label: "On"
2444
+ }];
2445
+ function $({ inline: e, cs: t, on: n, onChange: i }) {
2446
+ return e ? /* @__PURE__ */ K(ze, {
2447
+ tone: "sunken",
2448
+ size: t,
2449
+ className: `w-full ${r(t) ?? ""}`,
2450
+ options: bn,
2451
+ value: n ? "on" : "off",
2452
+ onChange: (e) => i(e === "on")
2453
+ }) : /* @__PURE__ */ K(We, {
2454
+ size: t,
2455
+ options: bn,
2456
+ viewMode: n ? "on" : "off",
2457
+ onViewChange: (e) => i(e === "on")
2458
+ });
2459
+ }
2460
+ function xn({ layer: e, setProp: t, patch: n, updateLayer: r, palette: i, renderAnimate: a, tab: s, tabStrip: c, tree: l, picker: m = !0, inline: g = !1, showSeed: ee = !g, onReset: v }) {
2461
+ let y = o(), S = Te(e.loopId), ce = se(), ue = (S?.params ?? []).some((e) => e.key === "orbit"), de = (e) => {
2462
+ L("orbit", e), e && !ce.grab && f("grab", !0);
2463
+ }, C = S?.params ?? [], w = e.themeId ?? "kol", fe = !!e.themeInvert, pe = (t) => r(e.id, {
2464
+ themeId: t,
2465
+ ..._n(e, S?.params, t, fe)
2466
+ }), T = (t) => r(e.id, {
2467
+ themeInvert: t,
2468
+ ..._n(e, S?.params, w, t)
2469
+ }), me = e._paletteRelation ?? "analogous", E = (S?.params ?? []).filter((e) => e.type === "color"), D = new Set(e._rollKeep ?? []), O = (t = me, n = {}) => {
2470
+ let i = u(_(x()), t), a = oe(e, S?.params, i, { rotate: !0 });
2471
+ r(e.id, {
2472
+ ...n,
2473
+ ...Object.fromEntries(E.filter((e) => !D.has(e.key)).map((e) => [e.key, a[e.key]]))
2474
+ });
2475
+ }, _e = (e) => t("_rollKeep", D.has(e) ? [...D].filter((t) => t !== e) : [...D, e]), k = Dt(e.loopId), ve = k ? Object.keys(k).map((e) => ({
2476
+ id: e,
2477
+ label: e
2478
+ })) : null, A = k ? new Set(Object.values(k).flatMap((e) => Object.keys(e))) : null, j = h(e), N = ae(re(C, e), b(C, e)), P = wt(e.loopId, e), [be, xe] = Je(!1), Se = (t, n, i) => {
2479
+ let a = p(e, t, j.take(), {
2480
+ stripNoRandom: !!n?.motion,
2481
+ ...i
2482
+ });
2483
+ P && n?.motion && (n.id !== "Form" && (a._framePreset = "custom"), n.id !== "Frame" && (a._formPreset = "custom")), A && Object.keys(a).some((e) => A.has(e)) && (a._lookPreset = "custom"), r(e.id, a);
2484
+ }, I = (t) => {
2485
+ let n = M(e.loopGroup).find((t) => t.id === e.presetId)?.params ?? {}, i = {};
2486
+ for (let e of t) {
2487
+ let t = n[e.key] === void 0 ? e.default : n[e.key];
2488
+ t !== void 0 && (i[e.key] = t);
2489
+ }
2490
+ r(e.id, i);
2491
+ }, Ce = P ? Tt(P.frame) : null, we = P ? Tt(P.form) : null, L = (e, t) => {
2492
+ let r = {};
2493
+ Ce?.has(e) && (r._framePreset = "custom"), we?.has(e) && (r._formPreset = "custom"), A?.has(e) && (r._lookPreset = "custom"), n({
2494
+ [e]: t,
2495
+ ...r
2496
+ });
2497
+ }, Ee = (e, t) => (r) => {
2498
+ let i = t.find((e) => e.id === r);
2499
+ n({
2500
+ [e]: r,
2501
+ ...i?.params ?? {}
2502
+ });
2503
+ }, Oe = (e) => n({
2504
+ _lookPreset: e,
2505
+ ...k?.[e] ?? {}
2506
+ }), ke = S?.camera ? S.camera.map((e) => ({
2507
+ ...e,
2508
+ section: "Camera"
2509
+ })) : null, Ae = [...S?.camera ?? [], ...C.filter((e) => ne(e) === "Camera")], je = S?.kind === "engine", Me = Ae.length > 0 || je && S?.orbit, R = S?.engine === "scene" && (e.animMode === "keyframes" || e.animMode === "keyframe"), z = S?.orbit ? {
2510
+ yaw: 1,
2511
+ dist: 1
2512
+ } : ye(S), Pe = z ? /* @__PURE__ */ K("p", {
2513
+ className: `kol-mono-10 text-meta${g ? "" : " col-span-2"}`,
2514
+ children: S?.orbit ? "Press C, then drag to orbit the camera and scroll to zoom." : z.yaw ? "Press C, then drag to rotate and scroll to zoom." : "Press C, then scroll to zoom."
2515
+ }) : null;
2516
+ return /* @__PURE__ */ q(G, { children: [
2517
+ c,
2518
+ m && (g ? s === "generate" && /* @__PURE__ */ K(U, {
2519
+ divided: !0,
2520
+ children: /* @__PURE__ */ K(lt, {
2521
+ layer: e,
2522
+ tree: l,
2523
+ inline: !0,
2524
+ about: /* @__PURE__ */ K(gn, { def: S })
2525
+ })
2526
+ }) : /* @__PURE__ */ K(lt, {
2527
+ layer: e,
2528
+ tree: l,
2529
+ about: /* @__PURE__ */ K(gn, { def: S })
2530
+ })),
2531
+ (s === "generate" || s === "labs-effect") && /* @__PURE__ */ q(G, { children: [
2532
+ (e.loopId === "softforms" || e.loopId === "softforms3d") && /* @__PURE__ */ K(sn, { layer: e }),
2533
+ k && !g && /* @__PURE__ */ K(Q, {
2534
+ inline: g,
2535
+ label: "Look",
2536
+ children: /* @__PURE__ */ K(V, {
2537
+ variant: "subtle",
2538
+ size: y,
2539
+ className: "w-full",
2540
+ options: yn(ve, e._lookPreset),
2541
+ value: e._lookPreset ?? "custom",
2542
+ onChange: Oe
2543
+ })
2544
+ }),
2545
+ g && /* @__PURE__ */ q(U, {
2546
+ divided: !0,
2547
+ children: [
2548
+ k && /* @__PURE__ */ K(Q, {
2549
+ inline: !0,
2550
+ label: "Look",
2551
+ children: /* @__PURE__ */ K(V, {
2552
+ variant: "subtle",
2553
+ size: y,
2554
+ className: "w-full",
2555
+ options: yn(ve, e._lookPreset),
2556
+ value: e._lookPreset ?? "custom",
2557
+ onChange: Oe
2558
+ })
2559
+ }),
2560
+ /* @__PURE__ */ K(Q, {
2561
+ inline: !0,
2562
+ label: "Theme",
2563
+ children: /* @__PURE__ */ K(V, {
2564
+ variant: "subtle",
2565
+ size: y,
2566
+ className: "w-full",
2567
+ options: d,
2568
+ value: w,
2569
+ onChange: pe
2570
+ })
2571
+ }),
2572
+ /* @__PURE__ */ K(Q, {
2573
+ inline: !0,
2574
+ label: "Invert",
2575
+ children: /* @__PURE__ */ K($, {
2576
+ inline: !0,
2577
+ cs: y,
2578
+ on: fe,
2579
+ onChange: T
2580
+ })
2581
+ }),
2582
+ E.length > 0 && /* @__PURE__ */ K(Q, {
2583
+ inline: !0,
2584
+ label: "Palette",
2585
+ children: /* @__PURE__ */ q("div", {
2586
+ className: "flex w-full gap-2",
2587
+ children: [
2588
+ /* @__PURE__ */ K(V, {
2589
+ variant: "subtle",
2590
+ size: y,
2591
+ className: "flex-1 min-w-0",
2592
+ options: te.map((e) => ({
2593
+ value: e.id,
2594
+ label: e.label
2595
+ })),
2596
+ value: me,
2597
+ onChange: (e) => O(e, { _paletteRelation: e })
2598
+ }),
2599
+ /* @__PURE__ */ K(B, {
2600
+ tone: "primary",
2601
+ size: y,
2602
+ onClick: () => O(),
2603
+ children: "Roll"
2604
+ }),
2605
+ /* @__PURE__ */ K(W, {
2606
+ label: "Edit in Color Modes",
2607
+ children: /* @__PURE__ */ K(B, {
2608
+ tone: "primary",
2609
+ size: y,
2610
+ iconOnly: "clr-tri",
2611
+ "aria-label": "Edit in Color Modes",
2612
+ onClick: Ne
2613
+ })
2614
+ })
2615
+ ]
2616
+ })
2617
+ }),
2618
+ E.length > 1 && /* @__PURE__ */ K(Q, {
2619
+ inline: !0,
2620
+ label: "Rolls",
2621
+ children: /* @__PURE__ */ K("div", {
2622
+ className: "flex w-full flex-wrap gap-1",
2623
+ children: E.map((e) => /* @__PURE__ */ K(B, {
2624
+ size: y,
2625
+ tone: D.has(e.key) ? "ghost" : "primary",
2626
+ pressed: !D.has(e.key),
2627
+ "aria-label": `Roll ${e.label}`,
2628
+ onClick: () => _e(e.key),
2629
+ children: e.label
2630
+ }, e.key))
2631
+ })
2632
+ }),
2633
+ le(S) && /* @__PURE__ */ K(Q, {
2634
+ inline: !0,
2635
+ label: "Background",
2636
+ children: /* @__PURE__ */ K($, {
2637
+ inline: !0,
2638
+ cs: y,
2639
+ on: e.bgOn !== !1,
2640
+ onChange: (e) => t("bgOn", e)
2641
+ })
2642
+ }),
2643
+ Pe
2644
+ ]
2645
+ }),
2646
+ !g && /* @__PURE__ */ q("div", {
2647
+ className: "grid grid-cols-2 gap-2",
2648
+ children: [
2649
+ /* @__PURE__ */ K(Q, {
2650
+ inline: !1,
2651
+ label: "Theme",
2652
+ children: /* @__PURE__ */ K(V, {
2653
+ variant: "subtle",
2654
+ size: y,
2655
+ className: "w-full",
2656
+ options: d,
2657
+ value: w,
2658
+ onChange: pe
2659
+ })
2660
+ }),
2661
+ /* @__PURE__ */ K(Q, {
2662
+ inline: !1,
2663
+ label: "Invert",
2664
+ children: /* @__PURE__ */ K($, {
2665
+ inline: !1,
2666
+ cs: y,
2667
+ on: fe,
2668
+ onChange: T
2669
+ })
2670
+ }),
2671
+ le(S) && /* @__PURE__ */ K(Q, {
2672
+ inline: !1,
2673
+ label: "Background",
2674
+ children: /* @__PURE__ */ K($, {
2675
+ inline: !1,
2676
+ cs: y,
2677
+ on: e.bgOn !== !1,
2678
+ onChange: (e) => t("bgOn", e)
2679
+ })
2680
+ }),
2681
+ Pe
2682
+ ]
2683
+ }),
2684
+ /* @__PURE__ */ K(F, {
2685
+ schema: C,
2686
+ layer: e,
2687
+ setProp: L,
2688
+ palette: i,
2689
+ renderAnimate: a,
2690
+ tab: "generate",
2691
+ inline: g
2692
+ }),
2693
+ g && /* @__PURE__ */ K(Ie, {}),
2694
+ /* @__PURE__ */ q("div", {
2695
+ className: "flex gap-2",
2696
+ children: [
2697
+ [
2698
+ ["type", "Type"],
2699
+ ["category", "Category"],
2700
+ ["preset", "Preset"]
2701
+ ].filter(([t]) => tt(e, t, vn)).map(([t, n]) => /* @__PURE__ */ K(B, {
2702
+ tone: "primary",
2703
+ size: y,
2704
+ className: "flex-1 min-w-0",
2705
+ "aria-label": `Randomize ${n.toLowerCase()}`,
2706
+ onClick: () => {
2707
+ let n = j.take(), i = nt(e, t, _(n >>> 0), vn);
2708
+ i && r(e.id, {
2709
+ ...i,
2710
+ _rollSeed: n
2711
+ });
2712
+ },
2713
+ children: n
2714
+ }, t)),
2715
+ /* @__PURE__ */ K(B, {
2716
+ tone: "primary",
2717
+ size: y,
2718
+ className: "flex-1 min-w-0",
2719
+ "aria-label": "Randomize settings",
2720
+ onClick: (t) => {
2721
+ if (t.altKey) return I(b(C, e));
2722
+ let n = j.take();
2723
+ r(e.id, {
2724
+ ...rt(e, b(C, e), _(n >>> 0)),
2725
+ _rollSeed: n
2726
+ });
2727
+ },
2728
+ children: "Settings"
2729
+ }),
2730
+ /* @__PURE__ */ K(B, {
2731
+ tone: "primary",
2732
+ size: y,
2733
+ iconOnly: "nav-settings",
2734
+ "aria-label": "What Settings rolls",
2735
+ onClick: () => xe(!0),
2736
+ className: "shrink-0"
2737
+ }),
2738
+ /* @__PURE__ */ K(W, {
2739
+ label: "Reset to defaults",
2740
+ shortcut: "R",
2741
+ children: /* @__PURE__ */ K(B, {
2742
+ tone: "primary",
2743
+ size: y,
2744
+ iconOnly: "refresh",
2745
+ "aria-label": "Reset to defaults",
2746
+ onClick: v ?? (() => I(b(C, e))),
2747
+ className: "shrink-0"
2748
+ })
2749
+ })
2750
+ ]
2751
+ }),
2752
+ /* @__PURE__ */ K(ut, {
2753
+ open: be,
2754
+ onClose: () => xe(!1),
2755
+ schema: C,
2756
+ layer: e,
2757
+ size: y
2758
+ }),
2759
+ N.length > 0 && /* @__PURE__ */ q("div", {
2760
+ className: `grid ${g ? "grid-cols-3" : "grid-cols-2"} gap-2`,
2761
+ children: [N.map((e) => /* @__PURE__ */ K(B, {
2762
+ tone: "primary",
2763
+ size: y,
2764
+ onClick: (t) => t.altKey ? I(e.params) : Se(e.params, e),
2765
+ children: e.label
2766
+ }, e.id)), e.loopId === "math-expression" && /* @__PURE__ */ K(B, {
2767
+ tone: "primary",
2768
+ size: y,
2769
+ onClick: (t) => {
2770
+ if (t.altKey) return I(N.find((e) => e.id === "Expression")?.params ?? []);
2771
+ let n = j.take();
2772
+ r(e.id, {
2773
+ expr: ge(_(n >>> 0)),
2774
+ _rollSeed: n
2775
+ });
2776
+ },
2777
+ children: "Wild"
2778
+ })]
2779
+ }),
2780
+ ee && b(C, e).length >= 5 && /* @__PURE__ */ K(ie, {
2781
+ seed: j,
2782
+ inline: g
2783
+ }),
2784
+ e.loopId === "pattern-rules" && (e.render ?? "tiles") === "tiles" && /* @__PURE__ */ K(Bt, {
2785
+ layer: e,
2786
+ patch: n,
2787
+ seed: j
2788
+ })
2789
+ ] }),
2790
+ (s === "style" || s === "labs-effect") && /* @__PURE__ */ q(G, { children: [
2791
+ /* @__PURE__ */ K(F, {
2792
+ schema: C,
2793
+ layer: e,
2794
+ setProp: L,
2795
+ palette: i,
2796
+ renderAnimate: a,
2797
+ tab: "style",
2798
+ inline: g
2799
+ }),
2800
+ S?.group === "penrose" && e.loopId?.startsWith("penrose-") && /* @__PURE__ */ K(un, {
2801
+ layer: e,
2802
+ setProp: L,
2803
+ patch: n
2804
+ }),
2805
+ e.loopId === "pattern-rules" && /* @__PURE__ */ K(Wt, {
2806
+ layer: e,
2807
+ patch: n
2808
+ }),
2809
+ e.loopId === "math-curves" && /* @__PURE__ */ K(Gt, {
2810
+ layer: e,
2811
+ patch: n
2812
+ }),
2813
+ e.loopId === "math-expression" && /* @__PURE__ */ q("div", {
2814
+ className: "grid grid-cols-2 gap-2",
2815
+ children: [/* @__PURE__ */ K(B, {
2816
+ tone: "primary",
2817
+ size: y,
2818
+ onClick: () => r(e.id, he(e)),
2819
+ children: "Fit"
2820
+ }), /* @__PURE__ */ K(B, {
2821
+ tone: "primary",
2822
+ size: y,
2823
+ onClick: () => I(N.find((e) => e.id === "View")?.params ?? []),
2824
+ children: "Reset"
2825
+ })]
2826
+ })
2827
+ ] }),
2828
+ s === "anim" && /* @__PURE__ */ q(G, { children: [
2829
+ P && /* @__PURE__ */ q(U, {
2830
+ label: "Motion",
2831
+ divided: !0,
2832
+ children: [/* @__PURE__ */ K(Q, {
2833
+ inline: g,
2834
+ label: "Frame",
2835
+ children: /* @__PURE__ */ K(V, {
2836
+ variant: "subtle",
2837
+ size: y,
2838
+ className: "w-full",
2839
+ options: yn(P.frame, e._framePreset),
2840
+ value: e._framePreset ?? "custom",
2841
+ onChange: Ee("_framePreset", P.frame)
2842
+ })
2843
+ }), /* @__PURE__ */ K(Q, {
2844
+ inline: g,
2845
+ label: "Form",
2846
+ children: /* @__PURE__ */ K(V, {
2847
+ variant: "subtle",
2848
+ size: y,
2849
+ className: "w-full",
2850
+ options: yn(P.form, e._formPreset),
2851
+ value: e._formPreset ?? "custom",
2852
+ onChange: Ee("_formPreset", P.form)
2853
+ })
2854
+ })]
2855
+ }),
2856
+ /* @__PURE__ */ K(De, {
2857
+ layer: e,
2858
+ schema: C,
2859
+ setProp: L
2860
+ }),
2861
+ ue && !S?.is3D && /* @__PURE__ */ K(U, {
2862
+ label: "Interaction",
2863
+ divided: !0,
2864
+ children: /* @__PURE__ */ K(Q, {
2865
+ inline: g,
2866
+ label: "Drag (C)",
2867
+ children: /* @__PURE__ */ K($, {
2868
+ inline: g,
2869
+ cs: y,
2870
+ on: !!ce.grab && e.orbit !== !1,
2871
+ onChange: de
2872
+ })
2873
+ })
2874
+ }),
2875
+ S?.is3D && /* @__PURE__ */ q(U, {
2876
+ label: "3D",
2877
+ divided: !0,
2878
+ children: [/* @__PURE__ */ K(Q, {
2879
+ inline: g,
2880
+ label: "Orbit (C)",
2881
+ children: /* @__PURE__ */ K($, {
2882
+ inline: g,
2883
+ cs: y,
2884
+ on: !!ce.grab && e.orbit !== !1,
2885
+ onChange: de
2886
+ })
2887
+ }), S.zoom3dKey && /* @__PURE__ */ K(F, {
2888
+ schema: C.filter((e) => e.key === S.zoom3dKey).map(({ section: e, ...t }) => t),
2889
+ layer: e,
2890
+ setProp: L,
2891
+ palette: i,
2892
+ renderAnimate: a,
2893
+ tab: "anim",
2894
+ inline: g
2895
+ })]
2896
+ }),
2897
+ /* @__PURE__ */ K(F, {
2898
+ schema: S?.is3D && S.zoom3dKey ? C.filter((e) => e.key !== S.zoom3dKey) : C,
2899
+ layer: e,
2900
+ setProp: L,
2901
+ palette: i,
2902
+ renderAnimate: a,
2903
+ tab: "anim",
2904
+ inline: g
2905
+ }),
2906
+ R && /* @__PURE__ */ K(Rt, {
2907
+ layer: e,
2908
+ patch: n,
2909
+ defaultDuration: S?.duration ?? 8
2910
+ }),
2911
+ ke && /* @__PURE__ */ K(F, {
2912
+ schema: ke,
2913
+ layer: e,
2914
+ setProp: t,
2915
+ palette: i,
2916
+ renderAnimate: a,
2917
+ inline: g
2918
+ }),
2919
+ Me && /* @__PURE__ */ K(zt, {
2920
+ layer: e,
2921
+ patch: n,
2922
+ camParams: Ae,
2923
+ isEngine: je,
2924
+ showHeader: !ke
2925
+ })
2926
+ ] }),
2927
+ /* @__PURE__ */ K(Kt, {
2928
+ layer: e,
2929
+ patch: n,
2930
+ renderAnimate: a,
2931
+ tab: s === "labs-effect" ? "style" : s
2932
+ })
2933
+ ] });
2934
+ }
2935
+ //#endregion
2936
+ //#region src/packs/generators.js
2937
+ var Sn = {
2938
+ layerTypes: ["loop", "misc"],
2939
+ loopById: Te,
2940
+ loopDrawParams: fe,
2941
+ resolveCameraKeys: ye,
2942
+ loopBgToggleable: le,
2943
+ presetById: de,
2944
+ presetParams: C,
2945
+ presetsInGroup: M,
2946
+ presetsInSub: ce,
2947
+ presetLayerPatch: ue,
2948
+ isToolPreset: w,
2949
+ groupById: E,
2950
+ drawLoopFrame: Ee,
2951
+ GENERATIVE_TREE: Me,
2952
+ MISC_TREE: Ae,
2953
+ THEME_OPTIONS: d,
2954
+ buildParatypeFlattenGroup: Qe,
2955
+ LoopPicker: lt,
2956
+ LoopFields: xn,
2957
+ loadGlHost: () => import("./host-CRsCCafL.js")
2958
+ };
2959
+ s("generators", Sn);
2960
+ //#endregion
2961
+ export { Lt as a, ut as c, rt as d, ot as f, It as i, et as l, $e as m, xn as n, Ft as o, st as p, gn as r, Pt as s, Sn as t, ct as u };