@kolkrabbi/design-editor 0.46.0 → 0.47.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 (50) hide show
  1. package/dist/{BindDot-B0VcuOag.js → BindDot-B85UV79g.js} +9 -8
  2. package/dist/{BufferResource-BfLgK37S.js → BufferResource-Di5teicy.js} +2 -2
  3. package/dist/{CanvasPool-YNSF8hsR.js → CanvasPool-JdLj49b-.js} +1 -1
  4. package/dist/CanvasRenderer-fXDObOOi.js +2 -0
  5. package/dist/{FederatedEventTarget-BJgROaRQ.js → FederatedEventTarget-CH0bzxx1.js} +1 -1
  6. package/dist/{FilterSystem-BUrPNXx-.js → FilterSystem-C-ZoyuTO.js} +3 -3
  7. package/dist/{Geometry-C5s5KpWq.js → Geometry-D4tiuMOr.js} +1 -1
  8. package/dist/KolboxView-n6kEPJtV.js +21615 -0
  9. package/dist/{RenderTargetSystem-oFwWv5IW.js → RenderTargetSystem-Bom_vhlS.js} +1 -1
  10. package/dist/{Timeline-Ck1rBV8S.js → Timeline-EbecYeGh.js} +49 -47
  11. package/dist/TreePicker-2RUSyGl4.js +209 -0
  12. package/dist/WebGLRenderer-4hvrGmfW.js +2 -0
  13. package/dist/WebGPURenderer-BjzMV7Pg.js +2 -0
  14. package/dist/__vite-browser-external-y2xWjzgx.js +780 -0
  15. package/dist/browserAll-BFE0MRLW.js +6 -0
  16. package/dist/{canvasUtils-BoNfkAod.js → canvasUtils-DUNsu3ct.js} +1 -1
  17. package/dist/{core-BBb9Tk4Q.js → core-9UlJPBwX.js} +6272 -6239
  18. package/dist/core.js +6 -5
  19. package/dist/design-editor.css +2 -1
  20. package/dist/design-editor.js +7 -3644
  21. package/dist/{effectCategories-Ccye-8LP.js → effectCategories-CCpYmxS0.js} +8965 -4984
  22. package/dist/effects-DspYFJAM.js +447 -0
  23. package/dist/effects.js +1 -1
  24. package/dist/{generators-BdVXv0jY.js → generators-DY4_ymWh.js} +2386 -2416
  25. package/dist/generators.js +1 -1
  26. package/dist/{getTextureBatchBindGroup-CNWhZRbV.js → getTextureBatchBindGroup-ZMqkwiZS.js} +1 -1
  27. package/dist/{host-meUhieO9.js → host-0qv2SCjk.js} +1 -1
  28. package/dist/{host-9pJ7NvnR.js → host-Bo6itV50.js} +50 -50
  29. package/dist/init-DkGhdexn.js +4 -0
  30. package/dist/{morphStore-D6mkLJ-8.js → morphStore-Bm30Ekce.js} +1 -1
  31. package/dist/{motion-wsc6Qd7S.js → motion-BOWE4m3Q.js} +762 -759
  32. package/dist/motion.js +1 -1
  33. package/dist/{pipeline-CMpuPUaX.js → pipeline-hZsOKbHd.js} +12 -12
  34. package/dist/{previewScale-SYKvfhUm.js → previewScale-C6EBx--U.js} +8 -8
  35. package/dist/{rolls-KpWCAeDv.js → rolls-DugKaHUw.js} +10549 -4517
  36. package/dist/src-BlvCHYVY.js +3672 -0
  37. package/dist/{src-B5o6fGRJ.js → src-D-TQbBo2.js} +1 -2
  38. package/dist/{store-iBb0I6hk.js → store-BMGP1qou.js} +295 -275
  39. package/dist/{useLayerEdit-Ba7RA6qX.js → useLayerEdit-B5nF5I9b.js} +103 -102
  40. package/dist/webworkerAll-0WBQ2FBr.js +2 -0
  41. package/package.json +12 -9
  42. package/dist/CanvasRenderer-Bl0rlqNq.js +0 -2
  43. package/dist/TreePicker-Dv0zpJwe.js +0 -166
  44. package/dist/WebGLRenderer-CXxpVIx3.js +0 -2
  45. package/dist/WebGPURenderer-BwLEUYBa.js +0 -2
  46. package/dist/browserAll-CAzdTUbR.js +0 -6
  47. package/dist/chunk-3b4jIN3o.js +0 -13
  48. package/dist/effects-B47bpwGh.js +0 -447
  49. package/dist/init-jApIMi04.js +0 -4
  50. package/dist/webworkerAll-DEZhpG90.js +0 -2
@@ -1,3644 +1,7 @@
1
- import { B as e, D as t, Dn as n, F as r, Gn as i, I as a, J as o, Kn as s, L as c, Lt as l, Mn as u, On as d, P as f, Un as p, Wn as m, a as h, bn as g, d as _, dn as v, er as y, f as b, ft as x, gt as S, hn as C, ht as w, i as T, j as E, jn as D, ln as O, mn as k, n as A, nn as j, o as M, p as ee, r as N, tr as te, un as P, vn as F, xn as I } from "./rolls-KpWCAeDv.js";
2
- import { n as L, r as R, t as ne } from "./useLayerEdit-Ba7RA6qX.js";
3
- import { C as z, D as B, E as V, _ as H, a as re, c as U, d as ie, f as W, g as ae, i as G, l as oe, m as se, n as ce, r as le, t as ue, u as de, v as fe, w as pe, x as K, y as me } from "./effectCategories-Ccye-8LP.js";
4
- import { r as he } from "./TreePicker-Dv0zpJwe.js";
5
- import { _ as ge, a as _e, b as ve, f as ye, g as be, h as xe, i as Se, m as Ce, n as we, o as Te, p as Ee, r as De, s as Oe, v as ke, y as Ae } from "./generators-BdVXv0jY.js";
6
- import { A as je, C as Me, D as Ne, E as Pe, M as Fe, O as Ie, S as Le, T as Re, _ as ze, b as Be, c as Ve, h as He, j as Ue, k as We, l as Ge, m as Ke, u as qe, v as Je, w as Ye, y as Xe } from "./store-iBb0I6hk.js";
7
- import { a as Ze, c as Qe, d as $e, f as et, i as tt, l as nt, n as rt, o as it, p as at, r as ot, s as q, t as st, u as ct } from "./morphStore-D6mkLJ-8.js";
8
- import { n as lt, r as ut, t as dt } from "./BindDot-B0VcuOag.js";
9
- import { n as ft, r as pt } from "./effects-B47bpwGh.js";
10
- import { a as mt, i as ht, n as gt, o as _t, r as vt } from "./motion-wsc6Qd7S.js";
11
- import { n as yt, r as bt, t as xt } from "./Timeline-Ck1rBV8S.js";
12
- import { $ as St, A as Ct, B as wt, C as Tt, D as Et, E as Dt, F as Ot, G as kt, H as At, I as jt, J as Mt, K as Nt, L as Pt, M as Ft, N as It, O as Lt, P as Rt, Q as zt, R as Bt, S as Vt, T as Ht, U as Ut, V as Wt, W as Gt, X as Kt, Y as qt, Z as Jt, _ as Yt, a as Xt, at as Zt, b as Qt, c as $t, ct as en, d as tn, dt as nn, et as rn, f as an, ft as on, g as sn, h as cn, i as ln, it as un, j as dn, k as fn, l as pn, lt as mn, m as hn, mt as gn, n as _n, nt as vn, o as yn, ot as bn, p as xn, pt as Sn, q as Cn, r as wn, rt as Tn, s as En, st as Dn, t as On, tt as kn, u as An, ut as jn, v as Mn, w as Nn, x as Pn, y as Fn, z as In } from "./core-BBb9Tk4Q.js";
13
- import { Button as J, ButtonGroup as Ln, Divider as Rn, LabeledControlSection as zn, MultiSelect as Bn, NavRail as Vn, StepList as Hn, Tag as Un, Tooltip as Wn, useGrabEdge as Gn, useMediaQuery as Kn, useModal as qn } from "@kolkrabbi/kol-component";
14
- import { createContext as Jn, useContext as Yn, useEffect as Y, useRef as X, useState as Z, useSyncExternalStore as Xn } from "react";
15
- import { Fragment as Zn, jsx as Q, jsxs as $ } from "react/jsx-runtime";
16
- import { IconLoader as Qn } from "@kolkrabbi/kol-icons";
17
- import { PropertyRail as $n, RailDisplayControls as er, RailTrigger as tr } from "@kolkrabbi/kol-shell";
18
- import { useDragResize as nr, useTheme as rr } from "@kolkrabbi/kol-framework";
19
- import { createPortal as ir } from "react-dom";
20
- //#region src/phoneFloats.js
21
- var ar = (e) => {
22
- let t = e, n = /* @__PURE__ */ new Set(), r = (e) => (n.add(e), () => n.delete(e));
23
- return {
24
- set: (e) => {
25
- e !== t && (t = e, n.forEach((e) => e()));
26
- },
27
- use: () => Xn(r, () => t, () => t)
28
- };
29
- }, or = ar(null), sr = ar(null), cr = or.set;
30
- or.use, sr.set;
31
- var lr = sr.use, ur = [
32
- {
33
- id: "shape",
34
- label: "Shape",
35
- icon: "line-circle"
36
- },
37
- {
38
- id: "blend",
39
- label: "Blend",
40
- icon: "shaper-scurve"
41
- },
42
- {
43
- id: "crossfade",
44
- label: "Crossfade",
45
- icon: "dashed-circle"
46
- }
47
- ], dr = {
48
- shape: [
49
- ["Loops", ["morph-circle", "star-morph"]],
50
- ["Loops", [
51
- "square-circle",
52
- "blob",
53
- "lissajous"
54
- ]],
55
- ["Loops", [
56
- "morph-circle",
57
- "star-morph",
58
- "blob",
59
- "spiral"
60
- ]],
61
- ["Math", ["math-spinner", "math-threads"]],
62
- ["Field", ["halftone", "checker-field"]],
63
- ["Flow", ["flow-obstacles", "flow-voronoi"]]
64
- ],
65
- crossfade: [
66
- ["Scanline", ["scanline", "plasma"]],
67
- ["Scanline", [
68
- "scanline",
69
- "flow-charges",
70
- "math-surface"
71
- ]],
72
- ["Field", ["plasma", "math-field"]],
73
- ["Field", ["gradient-field", "optic-moire"]],
74
- ["Penrose", ["penrose-02-diffgrow", "flow-growth"]],
75
- ["Penrose", [
76
- "penrose-01-packing-lloyd",
77
- "optic-reaction",
78
- "abstract-rd",
79
- "flow-voronoi"
80
- ]],
81
- ["Math", ["math-threads", "flow-ascii"]],
82
- ["Math", ["math-waveform", "scanline"]]
83
- ],
84
- blend: [
85
- [
86
- "Scanline",
87
- "scanline",
88
- 2
89
- ],
90
- [
91
- "Scanline",
92
- "scanline",
93
- 3
94
- ],
95
- [
96
- "Field",
97
- "plasma",
98
- 2
99
- ],
100
- [
101
- "Math",
102
- "math-curves",
103
- 2
104
- ],
105
- [
106
- "Math",
107
- "math-spinner",
108
- 4
109
- ],
110
- [
111
- "Optic",
112
- "optic-moire",
113
- 2
114
- ],
115
- [
116
- "Flow",
117
- "flow-obstacles",
118
- 2
119
- ]
120
- ]
121
- }, fr = null;
122
- function pr(e) {
123
- if (!fr) {
124
- fr = /* @__PURE__ */ new Map();
125
- let e = /* @__PURE__ */ new Set();
126
- for (let t of se) for (let n of V(t.id)) e.has(n.id) || me(n) || (e.add(n.id), fr.has(n.loop) || fr.set(n.loop, []), fr.get(n.loop).push(n));
127
- }
128
- return fr.get(e) ?? [];
129
- }
130
- var mr = (e, t) => e.length < t ? null : Array.from({ length: t }, (n, r) => e[Math.round(r * (e.length - 1) / (t - 1))]), hr = null;
131
- function gr() {
132
- if (hr) return hr;
133
- let e = [];
134
- for (let t of ur) for (let n of dr[t.id]) {
135
- let [r] = n, i = t.id === "blend" ? mr(pr(n[1]), n[2]) : n[1].map((e) => pr(e)[0]);
136
- if (!i || i.some((e) => !e) || new Set(i.map((e) => e.id)).size < i.length) continue;
137
- let a = i.map((e) => e.label).join(" → "), o = `ship:morph:${t.id}:${i.map((e) => e.id).join("--")}`;
138
- e.push({
139
- id: o,
140
- type: t.id,
141
- typeLabel: t.label,
142
- category: r,
143
- sub: `${t.label} · ${r}`,
144
- label: a,
145
- steps: i,
146
- morph: {
147
- mode: t.id,
148
- loopId: i[0].loop,
149
- steps: i.map(Se),
150
- curve: "in-out",
151
- cycle: "loop",
152
- resolution: 0,
153
- syncLoop: !1,
154
- seconds: 2 * i.length
155
- }
156
- });
157
- }
158
- return hr = e;
159
- }
160
- var _r = () => ur.map((e) => ({
161
- label: e.label,
162
- subs: [...new Set(gr().filter((t) => t.type === e.id).map((e) => e.sub))]
163
- })), vr = (e, t) => gr().find((n) => n.type === e && (!t || n.category === t)), yr = (e) => gr().find((t) => t.id === e);
164
- function br(e) {
165
- e && (it({
166
- active: !0,
167
- ...e.morph,
168
- fileId: null,
169
- fileName: e.label,
170
- presetId: e.id
171
- }), n.setLoopSeconds(e.morph.seconds), /\/morph\/?$/.test(window.location.pathname) || jn("/morph"));
172
- }
173
- //#endregion
174
- //#region src/editor/labs/catalog.js
175
- var xr = {
176
- "fx:halftone": "ptrn-dot",
177
- "fx:scanline": "grid-horizontal",
178
- "fx:crt": "desktop",
179
- "fx:refraction": "circle",
180
- "fx:fx-rack": "target",
181
- "fx:pattern": "ptrn-checker",
182
- "fx:other": "more",
183
- "gen:Scanline": "grid-horizontal",
184
- "gen:Pattern": "ptrn-checker",
185
- "gen:Loops": "refresh",
186
- "gen:Math": "sum",
187
- "gen:Penrose": "a-framed",
188
- "gen:Flow": "wave",
189
- "gen:Letter Gap": "letter-spacing",
190
- "gen:Drift": "dith-flow",
191
- "gen:Gradients": "circle",
192
- "gen:Soft Forms": "paint-drop",
193
- "gen:3D Scene": "ball",
194
- "kin:Type": "font-01",
195
- "kin:Kinetic": "font-01",
196
- "misc:Para Type": "aa",
197
- "vec:Distressor": "scribble",
198
- "vec:Modulator": "dashed-circle"
199
- }, Sr = {
200
- effects: "filter",
201
- generative: "layers",
202
- vector: "pen-nib",
203
- composition: "type",
204
- morph: "swap",
205
- mode: "mode-toggle-01"
206
- }, Cr = [
207
- "Moiré",
208
- "Mesh Gradient",
209
- "Reaction",
210
- "Halftone"
211
- ], wr = [
212
- {
213
- label: "Spaced",
214
- patch: {
215
- geometry: "rows",
216
- mark: "dots"
217
- }
218
- },
219
- {
220
- label: "Glyph",
221
- patch: { mark: "glyph" }
222
- },
223
- {
224
- label: "Lattice",
225
- patch: { mark: "lattice" }
226
- },
227
- {
228
- label: "Vortex",
229
- patch: {
230
- geometry: "radial",
231
- swirl: .8,
232
- rayCount: 220
233
- }
234
- },
235
- {
236
- label: "Rings",
237
- patch: { geometry: "rings" }
238
- },
239
- {
240
- label: "Spiral",
241
- patch: { geometry: "spiral" }
242
- }
243
- ], Tr = (e = {}) => {
244
- let t = e.geometry ?? "rows";
245
- return t === "radial" ? "Vortex" : t === "rings" ? "Rings" : t === "spiral" ? "Spiral" : e.mark === "glyph" ? "Glyph" : e.mark === "lattice" ? "Lattice" : "Spaced";
246
- };
247
- function Er({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource: i }) {
248
- let a = () => e?.type === "photo" ? (e.filters ?? []).filter((e) => e?.id === "fx-media") : [], o = (e, o) => {
249
- let s = a(), c = t("photo", {
250
- ...i(),
251
- filters: s,
252
- fxGroup: null
253
- });
254
- c && (n(c, e), o && r(c, s.length, o)), window.dispatchEvent(new CustomEvent("kol:open-effects"));
255
- }, s = (e) => {
256
- t("photo", {
257
- ...i(),
258
- filters: a(),
259
- fxGroup: e
260
- }), window.dispatchEvent(new CustomEvent("kol:open-effects"));
261
- }, c = (e, n) => {
262
- t("loop", pe(e, n)), window.dispatchEvent(new CustomEvent("kol:open-params"));
263
- }, l = (e) => {
264
- t("kinetic", {
265
- presetId: e.id,
266
- presetLabel: e.label,
267
- comp: _t(e)
268
- }), window.dispatchEvent(new CustomEvent("kol:open-params"));
269
- }, u = e?.presetId ?? null, d = (e?.filters ?? []).find((e) => e?.id !== "fx-media")?.id ?? null, f = u ? V(e?.loopGroup).find((e) => e.id === u) ?? null : null, p = (n, r = "loop", i) => {
270
- let a = V(n), o = [...new Set(a.map((e) => e.sub).filter(Boolean))], s = (e) => r === "misc" ? () => {
271
- t("misc", pe(e, n)), window.dispatchEvent(new CustomEvent("kol:open-params"));
272
- } : () => c(e, n);
273
- return o.length ? o.map((t) => ({
274
- label: t,
275
- onSelect: s(B(n, t)[0]),
276
- active: e?.loopGroup === n && f?.sub === t
277
- })) : [{
278
- label: i ?? H(n).label,
279
- onSelect: s(a[0]),
280
- active: e?.loopGroup === n
281
- }];
282
- }, m = (e) => e.groups.flatMap((t) => {
283
- let n = e.labels?.[t] ?? H(t).label, r = V(t).some((e) => e.sub), i = p(t, "loop", n);
284
- return e.groups.length > 1 && r ? [{
285
- label: n,
286
- children: i
287
- }] : i;
288
- });
289
- return [
290
- {
291
- id: "color",
292
- label: "Color",
293
- icon: "clr-tri",
294
- onSelect: Ve,
295
- pages: []
296
- },
297
- {
298
- id: "sec:effects",
299
- label: "Effects"
300
- },
301
- ...le(W).map((t) => ({
302
- id: `fx:${t.id}`,
303
- label: t.label,
304
- icon: xr[`fx:${t.id}`] ?? "square",
305
- pages: t.rack ? ue.map((t) => ({
306
- label: t.label,
307
- onSelect: () => s(t.id),
308
- active: e?.fxGroup === t.id
309
- })) : t.id === "pattern" ? Cr.map((t) => ({
310
- label: t,
311
- onSelect: () => c(B("optic", t)[0], "optic"),
312
- active: e?.loopGroup === "optic" && f?.sub === t
313
- })) : t.id === "scanline" ? wr.map((t) => ({
314
- label: t.label,
315
- onSelect: () => o("scanline", t.patch),
316
- active: !e?.fxGroup && d === "scanline" && Tr((e?.filters ?? []).find((e) => e?.id === "scanline")?.params) === t.label
317
- })) : t.filters.map((t) => ({
318
- label: t.label ?? t.id,
319
- onSelect: () => o(t.id),
320
- active: !e?.fxGroup && d === t.id
321
- }))
322
- })),
323
- {
324
- id: "sec:generative",
325
- label: "Generative"
326
- },
327
- ...Ae.map((e) => ({
328
- id: `gen:${e.label}`,
329
- label: e.label,
330
- icon: xr[`gen:${e.label}`] ?? "square",
331
- pages: m(e)
332
- })),
333
- {
334
- id: "sec:morph",
335
- label: "Morph"
336
- },
337
- ...ur.map((e) => ({
338
- id: `morph:${e.id}`,
339
- label: e.label,
340
- icon: e.icon,
341
- pages: [...new Set(gr().filter((t) => t.type === e.id).map((e) => e.category))].map((t) => ({
342
- label: t,
343
- onSelect: () => br(vr(e.id, t)),
344
- active: (() => {
345
- let n = gr().find((e) => e.id === rt().presetId);
346
- return n?.type === e.id && n.category === t;
347
- })()
348
- }))
349
- })),
350
- {
351
- id: "sec:vector",
352
- label: "Vector"
353
- },
354
- {
355
- id: "vec:Distressor",
356
- label: "Distressor",
357
- icon: xr["vec:Distressor"] ?? "square",
358
- pages: p("distress")
359
- },
360
- {
361
- id: "vec:Modulator",
362
- label: "Modulator",
363
- icon: xr["vec:Modulator"] ?? "square",
364
- pages: p("modulator")
365
- },
366
- {
367
- id: "sec:composition",
368
- label: "Composition"
369
- },
370
- ...mt.map((t) => ({
371
- id: `kin:${t.label}`,
372
- label: t.label,
373
- icon: xr[`kin:${t.label}`] ?? "square",
374
- pages: t.subs.map((t) => ({
375
- label: t,
376
- onSelect: () => l(ht.find((e) => e.sub === t)),
377
- active: e?.type === "kinetic" && ht.some((e) => e.sub === t && e.id === u)
378
- }))
379
- })),
380
- ...ve.map((e) => ({
381
- id: `misc:${e.label}`,
382
- label: e.label,
383
- icon: xr[`misc:${e.label}`] ?? "square",
384
- pages: e.groups.flatMap((e) => p(e, "misc"))
385
- }))
386
- ];
387
- }
388
- //#endregion
389
- //#region src/editor/labs/LabsNav.jsx
390
- function Dr() {
391
- let { addFilter: e, patchFilter: t } = o(), { layer: n, setOnly: r } = _e(), i = X(null);
392
- Y(() => {
393
- n?.type === "photo" && n.src && (i.current = {
394
- src: n.src,
395
- srcType: n.srcType,
396
- fit: n.fit
397
- });
398
- }, [
399
- n?.type,
400
- n?.src,
401
- n?.srcType,
402
- n?.fit
403
- ]);
404
- let a = Er({
405
- layer: n,
406
- setOnly: r,
407
- addFilter: e,
408
- patchFilter: t,
409
- carriedSource: () => n?.type === "photo" ? {
410
- src: n.src,
411
- srcType: n.srcType,
412
- fit: n.fit
413
- } : i.current ?? {}
414
- });
415
- return Y(() => {
416
- let e = /* @__PURE__ */ new Map(), t = [];
417
- return a.forEach((n) => {
418
- if (n.id.startsWith("sec:")) {
419
- let e = n.id.slice(4);
420
- t.push({
421
- icon: Sr[e] ?? "square",
422
- path: `${$t}${n.id}`,
423
- label: n.label,
424
- sub: []
425
- });
426
- return;
427
- }
428
- let r = `${$t}${n.id}`, i = n.pages ?? [], a = n.onSelect ?? i[0]?.onSelect ?? i[0]?.children?.[0]?.onSelect;
429
- a && e.set(r, a);
430
- let o = t[t.length - 1], s = {
431
- icon: n.icon,
432
- path: r,
433
- label: n.label
434
- };
435
- o?.sub ? o.sub.push(s) : t.push(s);
436
- }), pn({
437
- items: t,
438
- dispatch: (t) => {
439
- let n = e.get(t);
440
- return n ? (n(), !0) : !1;
441
- }
442
- }), () => pn(null);
443
- }), null;
444
- }
445
- //#endregion
446
- //#region src/editor/morph/MorphTab.jsx
447
- var Or = (e, t) => JSON.stringify(e) === JSON.stringify(t), kr = [
448
- {
449
- key: "curve",
450
- label: "Curve",
451
- type: "select",
452
- options: $e,
453
- section: "Curve"
454
- },
455
- {
456
- key: "cycle",
457
- label: "Cycle",
458
- type: "select",
459
- options: et,
460
- section: "Curve"
461
- },
462
- {
463
- key: "syncLoop",
464
- label: "Sync loop",
465
- type: "toggle",
466
- section: "Curve"
467
- },
468
- {
469
- key: "resolution",
470
- label: "Resolution",
471
- type: "range",
472
- min: 0,
473
- max: 1024,
474
- step: 1,
475
- default: 0,
476
- format: (e) => e || "Auto",
477
- when: (e) => e.mode === "shape"
478
- }
479
- ];
480
- function Ar({ layer: e, readOnly: t = !1, editTabs: r = null }) {
481
- let i = c(), s = ct(), { steps: l, curve: u, cycle: d, mode: f, resolution: p, editing: m, fileId: h, editRequest: g } = s, { updateLayer: _, removeLayer: v, setCurrentPresetId: y, setCurrentPresetName: b, palette: x } = o(), { setOnly: S } = _e(), { buildSavedSpec: C } = Gt(), { addItem: w, updateItem: T } = Je(), E = qn(), A = D(), j = ne(e?.id ?? null, { history: "coalesce" }), [M, ee] = Z("generate"), N = l[0], te = l.every((e) => e.loopId === N?.loopId), F = l.filter((e) => !Nt(K(e.loopId)) || !kt(K(e.loopId))), I = F.length === 0, R = {
482
- blend: te ? null : "Blend tweens one generator — these steps are different generators",
483
- shape: I ? null : `No outline to morph: ${F.map((e) => Qe(e, l.indexOf(e))).join(", ")} (GL)`,
484
- crossfade: I ? null : `Cannot fade: ${F.map((e) => Qe(e, l.indexOf(e))).join(", ")} (GL)`
485
- }, z = [
486
- {
487
- value: "shape",
488
- label: "Shape",
489
- disabled: !!R.shape,
490
- tooltip: R.shape ?? void 0
491
- },
492
- {
493
- value: "blend",
494
- label: "Blend",
495
- disabled: !!R.blend,
496
- tooltip: R.blend ?? void 0
497
- },
498
- {
499
- value: "crossfade",
500
- label: "Crossfade",
501
- disabled: !!R.crossfade,
502
- tooltip: R.crossfade ?? void 0
503
- }
504
- ];
505
- Y(() => {
506
- if (t || l.length < 2 || !R[f]) return;
507
- let e = [
508
- "shape",
509
- "crossfade",
510
- "blend"
511
- ].find((e) => !R[e]);
512
- e && q({ mode: e });
513
- }, [
514
- f,
515
- te,
516
- I,
517
- l.length,
518
- t
519
- ]), Y(() => {
520
- !t && l.length === 0 && e?.type === "loop" && e.loopId && !e.morph && st(De(e));
521
- }, []);
522
- let B = X(l.length), V = () => {
523
- let t = l.length < B.current;
524
- if (B.current = l.length, l.length < 2) {
525
- if (!e || !t) return;
526
- if (l.length === 0) {
527
- v(e.id);
528
- return;
529
- }
530
- let n = {};
531
- for (let t in e) e[t]?.bind === "track" && (n[t] = e[t].keys?.[0]?.v);
532
- let r = l[0];
533
- _(e.id, {
534
- ...n,
535
- loopGroup: r.loopGroup,
536
- presetId: r.presetId,
537
- presetLabel: r.presetLabel,
538
- loopId: r.loopId,
539
- ...r.params,
540
- morph: null,
541
- morphT: null
542
- });
543
- return;
544
- }
545
- let n = {
546
- loopGroup: N.loopGroup,
547
- presetId: N.presetId,
548
- presetLabel: N.presetLabel,
549
- loopId: N.loopId
550
- }, r = {
551
- mode: f,
552
- steps: l.map((e, t) => ({
553
- loopId: e.loopId,
554
- params: e.params,
555
- label: Qe(e, t)
556
- })),
557
- cycle: d,
558
- curve: u,
559
- resolution: p,
560
- syncLoop: s.syncLoop,
561
- name: s.fileName
562
- }, i = f === "blend" ? {
563
- ...n,
564
- ...at({
565
- snapshots: l.map((e) => e.params),
566
- schema: K(N.loopId)?.params ?? [],
567
- curve: u,
568
- cycle: d
569
- }).patch,
570
- morph: r,
571
- morphT: null
572
- } : {
573
- ...n,
574
- ...N.params,
575
- morph: r,
576
- morphT: {
577
- bind: "track",
578
- keys: Cn(l.length, d, u)
579
- }
580
- };
581
- e ? _(e.id, i) : S("loop", i);
582
- }, H = X(V);
583
- H.current = V;
584
- let re = JSON.stringify([
585
- f,
586
- l.map((e) => [e.loopId, e.params]),
587
- u,
588
- d,
589
- p,
590
- s.syncLoop
591
- ]), U = X(null);
592
- Y(() => {
593
- t || m != null || re === U.current || l.length >= 2 && R[f] || (U.current = re, H.current());
594
- }, [
595
- re,
596
- m,
597
- l.length,
598
- t
599
- ]), Y(() => {
600
- if (t || m == null || !e) return;
601
- let n = ot(e, K(e.loopId)?.params ?? []);
602
- Or(n, l[m]?.params) || nt(m, n);
603
- }, [e]), Y(() => {
604
- t || !A || m == null || (q({ editing: null }), U.current = null);
605
- }, [
606
- A,
607
- m,
608
- t
609
- ]), Y(() => () => {
610
- !t && s.editing != null && (q({ editing: null }), H.current());
611
- }, []);
612
- let ie = (e) => {
613
- let t = l[e];
614
- t && (n.pause(), q({ editing: e }), S("loop", {
615
- loopGroup: t.loopGroup,
616
- presetId: t.presetId,
617
- presetLabel: t.presetLabel,
618
- loopId: t.loopId,
619
- ...t.params,
620
- morph: null,
621
- morphT: null
622
- }));
623
- };
624
- return Y(() => {
625
- t || g == null || (q({ editRequest: null }), ie(g));
626
- }, [g]), /* @__PURE__ */ $("div", {
627
- className: "flex flex-col gap-5",
628
- children: [
629
- /* @__PURE__ */ Q(P, {
630
- layout: "joined",
631
- tone: "sunken",
632
- value: f,
633
- onChange: (e) => !t && q({ mode: e }),
634
- options: z,
635
- size: i,
636
- className: a(i)
637
- }),
638
- !t && /* @__PURE__ */ Q(k, {
639
- divided: !0,
640
- children: /* @__PURE__ */ Q(he, {
641
- tree: _r(),
642
- presets: gr(),
643
- current: yr(s.presetId) ?? { typeLabel: ur.find((e) => e.id === f)?.label },
644
- subLabel: (e) => e.split(" · ").pop(),
645
- onPick: br
646
- })
647
- }),
648
- /* @__PURE__ */ $(k, {
649
- divided: !0,
650
- children: [
651
- /* @__PURE__ */ Q(Hn, {
652
- items: l.map((e, t) => ({
653
- id: t,
654
- label: Qe(e, t)
655
- })),
656
- activeIndex: m,
657
- reorder: "grab",
658
- readOnly: t,
659
- size: i,
660
- onSelect: ie,
661
- onRemove: tt,
662
- onMove: Ze,
663
- onAdd: () => q({
664
- active: !0,
665
- picker: "preset"
666
- }),
667
- addLabel: "Add a step"
668
- }),
669
- l.length < 2 && !t && /* @__PURE__ */ Q("p", {
670
- className: "kol-mono-12 text-meta",
671
- children: "Two steps or more and the stage plays the morph."
672
- }),
673
- l.length >= 2 && R[f] && /* @__PURE__ */ Q("p", {
674
- className: "kol-mono-12 text-meta",
675
- children: R[f]
676
- })
677
- ]
678
- }),
679
- m != null && !t && e && r && /* @__PURE__ */ $(k, {
680
- label: `Step ${m + 1}`,
681
- divided: !0,
682
- children: [
683
- /* @__PURE__ */ Q(P, {
684
- layout: "joined",
685
- tone: "sunken",
686
- value: M,
687
- onChange: ee,
688
- options: r,
689
- size: i,
690
- className: a(i)
691
- }),
692
- /* @__PURE__ */ Q(Te, {
693
- layer: e,
694
- setProp: j.setProp,
695
- patch: j.patch,
696
- updateLayer: _,
697
- palette: x,
698
- tab: M,
699
- tabStrip: null,
700
- inline: !0,
701
- picker: !1
702
- }),
703
- /* @__PURE__ */ $("p", {
704
- className: "kol-mono-12 text-emphasis",
705
- children: [
706
- "Editing step ",
707
- m + 1,
708
- " — press Play to run the morph."
709
- ]
710
- })
711
- ]
712
- }),
713
- /* @__PURE__ */ Q(L, {
714
- schema: kr,
715
- layer: s,
716
- setProp: (e, n) => {
717
- !t && (typeof n != "object" || !n) && q({ [e]: n });
718
- },
719
- inline: !0
720
- }),
721
- !t && l.length >= 2 && /* @__PURE__ */ Q(k, {
722
- divided: !0,
723
- children: /* @__PURE__ */ Q(O, {
724
- tone: "primary",
725
- size: i,
726
- className: "w-full",
727
- onClick: async () => {
728
- if (l.length < 2) return;
729
- let e = s.fileName;
730
- if (!h && (e = await E.prompt("Name this morph:", ""), e === null)) return;
731
- m != null && (q({ editing: null }), H.current());
732
- let t = {
733
- ...await C(e || null),
734
- mode: "morph",
735
- morph: {
736
- mode: f,
737
- loopId: s.loopId,
738
- steps: l,
739
- curve: u,
740
- cycle: d,
741
- resolution: p,
742
- syncLoop: s.syncLoop,
743
- seconds: n.getLoopSeconds()
744
- }
745
- };
746
- if (h) {
747
- T("preset", h, t);
748
- return;
749
- }
750
- let r = w("preset", t);
751
- r && (q({
752
- fileId: r,
753
- fileName: e || null
754
- }), y(r), b(e || null));
755
- },
756
- children: h ? "Save" : "Save…"
757
- })
758
- })
759
- ]
760
- });
761
- }
762
- //#endregion
763
- //#region src/editor/params/QuickMotion.jsx
764
- var jr = [
765
- {
766
- value: "breathe",
767
- label: "Breathe",
768
- source: "lfo-sine",
769
- rate: 1
770
- },
771
- {
772
- value: "sweep",
773
- label: "Sweep",
774
- source: "lfo-triangle",
775
- rate: 1
776
- },
777
- {
778
- value: "jitter",
779
- label: "Jitter",
780
- source: "lfo-square",
781
- rate: 8
782
- }
783
- ], Mr = .2;
784
- function Nr(e) {
785
- if (!t(e)) return "off";
786
- if (e.bind !== "mod") return "custom";
787
- let n = jr.find((t) => t.source === e.source && (e.transform?.rate ?? 1) === t.rate);
788
- return n ? n.value : "custom";
789
- }
790
- function Pr({ schema: e, layer: t, setProp: i, label: a = "Modulate" }) {
791
- let o = c(), s = S(e ?? [], t).filter((e) => e.type === "range" && e.animatable !== !1 && w(e) !== "anim" && e.min != null && e.max != null && !/seed/i.test(e.key));
792
- if (!s.length) return null;
793
- let l = (e, r) => {
794
- let a = t[e.key];
795
- if (r === "off") {
796
- let r = a?.transform?.range;
797
- i(e.key, Array.isArray(r) ? (r[0] + r[1]) / 2 : E(a, n.getCtx(), t) ?? e.default ?? e.min);
798
- return;
799
- }
800
- let o = jr.find((e) => e.value === r);
801
- if (!o) return;
802
- let s = Number(E(a, n.getCtx(), t) ?? e.default ?? e.min), c = (e.max - e.min) * Mr, l = Math.max(e.min, s - c), u = Math.min(e.max, s + c);
803
- i(e.key, {
804
- bind: "mod",
805
- source: o.source,
806
- transform: {
807
- range: [l, u],
808
- rate: o.rate
809
- }
810
- });
811
- };
812
- return /* @__PURE__ */ Q(k, {
813
- label: a,
814
- divided: !0,
815
- children: s.map((e) => {
816
- let n = Nr(t[e.key]), i = [
817
- {
818
- value: "off",
819
- label: "Off"
820
- },
821
- ...jr.map(({ value: e, label: t }) => ({
822
- value: e,
823
- label: t
824
- })),
825
- ...n === "custom" ? [{
826
- value: "custom",
827
- label: "Custom"
828
- }] : []
829
- ];
830
- return /* @__PURE__ */ Q(C, {
831
- label: e.label,
832
- align: "fill",
833
- labelWidth: r,
834
- children: /* @__PURE__ */ Q(v, {
835
- size: o,
836
- variant: "subtle",
837
- className: "w-full",
838
- options: i,
839
- value: n,
840
- onChange: (t) => t !== "custom" && l(e, t)
841
- })
842
- }, e.key);
843
- })
844
- });
845
- }
846
- //#endregion
847
- //#region src/editor/params/InputRows.jsx
848
- var Fr = [
849
- {
850
- value: "off",
851
- label: "Off"
852
- },
853
- {
854
- value: "mouseX",
855
- label: "Mouse X"
856
- },
857
- {
858
- value: "mouseY",
859
- label: "Mouse Y"
860
- },
861
- {
862
- value: "audio-level",
863
- label: "Mic"
864
- },
865
- {
866
- value: "audio-bass",
867
- label: "Beat"
868
- },
869
- {
870
- value: "lfo-sine",
871
- label: "LFO"
872
- }
873
- ], Ir = new Set(Fr.map((e) => e.value));
874
- function Lr({ schema: e, layer: r, setProp: i, inputs: a = null }) {
875
- let o = c(), s = S(e ?? [], r).filter((e) => e.type === "range" && e.animatable !== !1 && e.min != null && e.max != null && !/seed/i.test(e.key));
876
- if (!s.length) return null;
877
- let l = new Map(s.map((e) => [e.key, e])), d = (a ?? []).filter((e) => l.has(e)), f = [...d, ...s.map((e) => e.key).filter((e) => !d.includes(e))], p = d.length ? d : f.slice(0, 3), m = (e) => {
878
- let n = r[e];
879
- return t(n) && n.bind === "mod" && Ir.has(n.source);
880
- }, h = f.filter(m), g = (e) => {
881
- let t = l.get(e);
882
- return Number(E(r[e], n.getCtx(), r) ?? t.default ?? t.min);
883
- }, _ = (e, n, a = t(r[e]) ? r[e].transform?.base ?? g(e) : g(e)) => {
884
- let o = l.get(e);
885
- u(n)?.ensure?.().catch(() => {}), i(e, {
886
- bind: "mod",
887
- source: n,
888
- transform: {
889
- range: [o.min, o.max],
890
- base: a,
891
- ...n.startsWith("lfo") ? { rate: 1 } : {}
892
- }
893
- });
894
- }, v = (e) => i(e, t(r[e]) ? r[e].transform?.base ?? g(e) : g(e)), y = p.find((e) => !m(e)) ?? f.find((e) => !m(e));
895
- return /* @__PURE__ */ $(k, {
896
- label: "Inputs",
897
- divided: !0,
898
- children: [h.map((e) => /* @__PURE__ */ Q(Bn, {
899
- size: o,
900
- className: "w-full [&>button]:w-full",
901
- groups: [{
902
- id: "source",
903
- label: "Source",
904
- options: Fr
905
- }, {
906
- id: "drives",
907
- label: "Drives",
908
- options: f.map((e) => ({
909
- value: e,
910
- label: l.get(e).label + (p.includes(e) ? " ★" : "")
911
- }))
912
- }],
913
- value: {
914
- source: r[e].source,
915
- drives: e
916
- },
917
- label: `${Fr.find((t) => t.value === r[e].source)?.label} → ${l.get(e).label}`,
918
- onChange: (t, n) => {
919
- if (t === "source") {
920
- n === "off" ? v(e) : _(e, n);
921
- return;
922
- }
923
- if (n === e || m(n)) return;
924
- let i = r[e].source;
925
- v(e), _(n, i);
926
- }
927
- }, e)), y && /* @__PURE__ */ Q(O, {
928
- size: o,
929
- iconLeft: "plus",
930
- className: "w-full",
931
- onClick: () => _(y, "mouseX"),
932
- children: "Add input"
933
- })]
934
- });
935
- }
936
- //#endregion
937
- //#region src/editor/labs/ModelSource.jsx
938
- var Rr = /\.(obj|glb|gltf|stl)$/i, zr = (e) => Rr.test(e.key ?? e.name ?? ""), Br = (e) => (e.match(Rr)?.[1] ?? "obj").toLowerCase(), Vr = (e) => e?.startsWith("data:") ? "Local file" : decodeURIComponent(String(e ?? "").split("/").pop() || "—");
939
- function Hr({ layer: e, setProp: t }) {
940
- let n = c(), [r, i] = Z(!1), a = X(null), o = (e, n) => {
941
- t("meshSrc", e), t("meshType", n);
942
- };
943
- return /* @__PURE__ */ $(k, {
944
- label: "Model",
945
- divided: !0,
946
- children: [
947
- /* @__PURE__ */ Q("span", {
948
- className: "kol-mono-12 text-meta truncate",
949
- children: Vr(e.meshSrc)
950
- }),
951
- /* @__PURE__ */ $("div", {
952
- className: "grid grid-cols-2 gap-2",
953
- children: [/* @__PURE__ */ Q(O, {
954
- tone: "primary",
955
- size: n,
956
- onClick: () => i(!0),
957
- children: "From library"
958
- }), /* @__PURE__ */ Q(O, {
959
- tone: "primary",
960
- size: n,
961
- onClick: () => a.current?.click(),
962
- children: "Upload"
963
- })]
964
- }),
965
- /* @__PURE__ */ Q("input", {
966
- ref: a,
967
- type: "file",
968
- accept: ".obj,.glb,.gltf,.stl",
969
- className: "hidden",
970
- onChange: (e) => {
971
- let t = e.target.files?.[0];
972
- if (e.target.value = "", !t) return;
973
- let n = new FileReader();
974
- n.onload = () => o(n.result, Br(t.name)), n.readAsDataURL(t);
975
- }
976
- }),
977
- /* @__PURE__ */ Q(Mn, {
978
- open: r,
979
- accept: zr,
980
- onClose: () => i(!1),
981
- onSelect: (e) => {
982
- i(!1), o(Qt(e), Br(e));
983
- }
984
- })
985
- ]
986
- });
987
- }
988
- //#endregion
989
- //#region src/editor/labs/useLabsKeys.js
990
- function Ur(e, t) {
991
- Y(() => {
992
- let n = (n) => {
993
- n.key !== "r" && n.key !== "R" || n.metaKey || n.ctrlKey || n.altKey || wt(n) || (n.preventDefault(), n.shiftKey ? t?.() : e?.());
994
- };
995
- return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
996
- });
997
- }
998
- //#endregion
999
- //#region src/editor/labs/LabsParams.jsx
1000
- var Wr = [{
1001
- value: "effect",
1002
- label: "Effect"
1003
- }, {
1004
- value: "anim",
1005
- label: "Motion"
1006
- }], Gr = [
1007
- {
1008
- value: "generate",
1009
- label: "Generate"
1010
- },
1011
- {
1012
- value: "style",
1013
- label: "Style"
1014
- },
1015
- {
1016
- value: "anim",
1017
- label: "Animation"
1018
- }
1019
- ], Kr = [
1020
- {
1021
- value: "generate",
1022
- label: "Gen"
1023
- },
1024
- {
1025
- value: "style",
1026
- label: "Style"
1027
- },
1028
- {
1029
- value: "anim",
1030
- label: "Anim"
1031
- }
1032
- ];
1033
- function qr({ options: e, active: t, onPick: n, spread: r = !1, pills: i = !1 }) {
1034
- let o = c();
1035
- return e?.length ? i ? /* @__PURE__ */ Q("div", {
1036
- className: "flex items-center gap-1 flex-wrap",
1037
- children: e.map((e) => /* @__PURE__ */ Q(Un, {
1038
- size: "xs",
1039
- hash: !1,
1040
- active: e.value === t,
1041
- onClick: () => n(e.value),
1042
- children: e.label
1043
- }, e.value))
1044
- }) : /* @__PURE__ */ Q(P, {
1045
- layout: "joined",
1046
- tone: "sunken",
1047
- value: t ?? null,
1048
- onChange: n,
1049
- options: e,
1050
- size: o,
1051
- ariaLabel: "Siblings",
1052
- className: a(o)
1053
- }) : null;
1054
- }
1055
- function Jr() {
1056
- let { undo: e, redo: t, canUndo: n, canRedo: r } = o(), i = c(), a = (e, t) => e ? t : /* @__PURE__ */ Q("span", {
1057
- "aria-hidden": "true",
1058
- className: "invisible pointer-events-none",
1059
- children: t
1060
- });
1061
- return /* @__PURE__ */ $(Zn, { children: [a(n, /* @__PURE__ */ Q(Wn, {
1062
- label: "Undo",
1063
- shortcut: "⌘Z",
1064
- children: /* @__PURE__ */ Q(O, {
1065
- size: i,
1066
- iconOnly: "arrow-left",
1067
- "aria-label": "Undo",
1068
- tabIndex: n ? void 0 : -1,
1069
- onClick: e
1070
- })
1071
- })), a(r, /* @__PURE__ */ Q(Wn, {
1072
- label: "Redo",
1073
- shortcut: "⇧⌘Z",
1074
- children: /* @__PURE__ */ Q(O, {
1075
- size: i,
1076
- iconOnly: "arrow-right",
1077
- "aria-label": "Redo",
1078
- tabIndex: r ? void 0 : -1,
1079
- onClick: t
1080
- })
1081
- }))] });
1082
- }
1083
- function Yr({ chips: e, active: t, onPick: n, spread: i, pills: a, title: o, tabStrip: s, preStrip: l, fx: u = !1, scope: d, ghostLabels: f, children: p }) {
1084
- let m = c() === "sm", h = I() === "float";
1085
- return /* @__PURE__ */ $("div", {
1086
- className: `flex flex-col gap-5${u ? " kol-labs-fx" : ""}`,
1087
- "data-label-scope": d,
1088
- children: [
1089
- o && m && /* @__PURE__ */ $("div", {
1090
- className: "flex items-center gap-1",
1091
- children: [/* @__PURE__ */ Q("p", {
1092
- className: `${h ? "kol-float-label text-fg-emphasis" : "kol-eyebrow text-fg-96"} flex-1 min-w-0`,
1093
- children: o
1094
- }), /* @__PURE__ */ Q(Jr, {})]
1095
- }),
1096
- e && /* @__PURE__ */ Q(qr, {
1097
- options: e,
1098
- active: t,
1099
- onPick: n,
1100
- spread: i,
1101
- pills: a
1102
- }),
1103
- l,
1104
- s,
1105
- p,
1106
- f?.length > 0 && /* @__PURE__ */ Q("div", {
1107
- "aria-hidden": "true",
1108
- className: "invisible h-0 overflow-hidden flex flex-col",
1109
- children: f.map((e, t) => /* @__PURE__ */ Q("span", {
1110
- className: "kol-helper-10 tracking-widest whitespace-nowrap",
1111
- style: { width: r },
1112
- children: String(e).toUpperCase()
1113
- }, t))
1114
- })
1115
- ]
1116
- });
1117
- }
1118
- function Xr({ layer: e, showMod: t }) {
1119
- let n = s(), i = c(), [l, u] = Z("effect");
1120
- Y(() => {
1121
- let e = () => u("effect");
1122
- return window.addEventListener("kol:open-effects", e), () => window.removeEventListener("kol:open-effects", e);
1123
- }, []);
1124
- let { addFilter: d, replaceFilter: f, removeFilter: p, toggleFilter: g, updateLayer: _, palette: y } = o(), S = ne(e.id, { history: "coalesce" }), T = x(e), E = T.findIndex((e) => !e.def?.first), D = E < 0 ? T.length : E, j = E < 0 ? null : T[E], M = le(W).find((e) => e.id === ce(j?.id)), N = M?.id === "halftone", te = N ? (M?.filters ?? []).map((e) => ({
1125
- value: e.id,
1126
- label: e.label
1127
- })) : null, F = !N && j ? j.def.label : null, I = (t) => {
1128
- if (!j) {
1129
- d(e.id, t);
1130
- return;
1131
- }
1132
- t !== j.id && f(e.id, D, t);
1133
- }, z = T.map(({ def: e, ...t }) => t), B = j ? {
1134
- ...e,
1135
- ...j.params,
1136
- id: e.id
1137
- } : e, V = (e) => (t, n) => {
1138
- let r = z.map((r, i) => i === e ? {
1139
- ...r,
1140
- params: {
1141
- ...r.params,
1142
- [t]: n
1143
- }
1144
- } : r);
1145
- S.patch({ filters: r });
1146
- }, H = V(D), re = t ? (e) => /* @__PURE__ */ Q(dt, {
1147
- layer: B,
1148
- param: e,
1149
- setProp: H
1150
- }) : void 0, U = (t) => {
1151
- let n = z.map((e, n) => n === D ? {
1152
- ...e,
1153
- params: {
1154
- ...e.params,
1155
- ...t
1156
- }
1157
- } : e);
1158
- _(e.id, { filters: n });
1159
- };
1160
- Ur(() => {
1161
- j && _(e.id, { filters: z.map((e, t) => t === 0 ? {
1162
- ...e,
1163
- params: {}
1164
- } : e) });
1165
- }, () => {
1166
- j && U(h(B, A(j.def.params, B), ee()));
1167
- });
1168
- let ae = e.fxGroup ? ue.find((t) => t.id === e.fxGroup) : null;
1169
- if (ae) {
1170
- let n = {
1171
- chain: T,
1172
- layer: e,
1173
- hostView: B,
1174
- toggleFilter: g,
1175
- removeFilter: p,
1176
- setStagePropAt: V,
1177
- palette: y,
1178
- showMod: t
1179
- }, r = [{
1180
- value: "",
1181
- label: "Add effect…"
1182
- }, ...ie(ae, W).map((e) => ({
1183
- value: e.id,
1184
- label: `${e.label ?? e.id}${e.kind === "pixi" ? " · GPU" : ""}`
1185
- }))];
1186
- return /* @__PURE__ */ $(Yr, {
1187
- title: "Effects",
1188
- fx: !0,
1189
- tabStrip: /* @__PURE__ */ Q(P, {
1190
- layout: "joined",
1191
- tone: "sunken",
1192
- value: l,
1193
- onChange: u,
1194
- options: Wr,
1195
- size: i,
1196
- className: a(i)
1197
- }),
1198
- children: [l === "effect" && /* @__PURE__ */ $(Zn, { children: [
1199
- /* @__PURE__ */ $(k, {
1200
- label: "Effect stack",
1201
- divided: !0,
1202
- children: [T.length === 0 && /* @__PURE__ */ Q(R, {
1203
- className: "kol-mono-10 text-meta",
1204
- children: "No effects yet — add one below."
1205
- }), /* @__PURE__ */ Q(ei, {
1206
- ...n,
1207
- from: 0
1208
- })]
1209
- }),
1210
- /* @__PURE__ */ Q(Rn, {}),
1211
- T.length < 8 && /* @__PURE__ */ Q(k, {
1212
- label: ae.label,
1213
- divided: !0,
1214
- children: /* @__PURE__ */ Q(v, {
1215
- variant: "subtle",
1216
- size: i,
1217
- className: "w-full",
1218
- options: r,
1219
- value: "",
1220
- onChange: (t) => {
1221
- t && d(e.id, t);
1222
- }
1223
- })
1224
- })
1225
- ] }), l === "anim" && j?.def?.sweeps && /* @__PURE__ */ Q(pt, {
1226
- sweeps: Array.isArray(j.params.sweeps) ? j.params.sweeps : [],
1227
- onChange: (e) => H("sweeps", e),
1228
- inline: !0
1229
- })]
1230
- });
1231
- }
1232
- if (!j) return /* @__PURE__ */ Q(Yr, {
1233
- chips: te,
1234
- active: null,
1235
- onPick: I,
1236
- spread: N,
1237
- fx: !0,
1238
- tabStrip: /* @__PURE__ */ Q(P, {
1239
- layout: "joined",
1240
- tone: "sunken",
1241
- value: l,
1242
- onChange: u,
1243
- options: Wr,
1244
- size: i,
1245
- className: a(i)
1246
- }),
1247
- children: /* @__PURE__ */ Q(L, {
1248
- schema: Yt,
1249
- layer: e,
1250
- setProp: S.setProp,
1251
- palette: y,
1252
- renderAnimate: (t) => /* @__PURE__ */ Q(dt, {
1253
- layer: e,
1254
- param: t,
1255
- setProp: S.setProp
1256
- }),
1257
- tab: l === "anim" ? "anim" : "style",
1258
- emptyHint: "Pick an effect from the nav."
1259
- })
1260
- });
1261
- let G = j.def.params.filter((e) => w(e) !== "anim"), se = oe(j.def.id), fe = se ? G.findIndex((e) => e.key === se) : -1, pe = G.length;
1262
- if (fe >= 0) {
1263
- let e = fe;
1264
- for (; e + 1 < G.length && G[e + 1].type === "select";) e++;
1265
- pe = e + 1;
1266
- }
1267
- let K = fe > 0 ? G.slice(0, fe) : [], me = fe >= 0 ? G.slice(fe, pe).map((e) => ({
1268
- ...e,
1269
- section: void 0
1270
- })) : G, he = {
1271
- layer: B,
1272
- setProp: H,
1273
- palette: y,
1274
- renderAnimate: re,
1275
- inline: !0
1276
- };
1277
- return /* @__PURE__ */ $(Yr, {
1278
- chips: te,
1279
- active: j.id,
1280
- onPick: I,
1281
- spread: N,
1282
- title: F,
1283
- fx: !0,
1284
- scope: j.id,
1285
- ghostLabels: j.def.params.map((e) => e.label).filter(Boolean),
1286
- tabStrip: /* @__PURE__ */ Q(P, {
1287
- layout: "joined",
1288
- tone: "sunken",
1289
- value: l,
1290
- onChange: u,
1291
- options: Wr,
1292
- size: i,
1293
- className: a(i)
1294
- }),
1295
- children: [l === "effect" && /* @__PURE__ */ $(Zn, { children: [
1296
- K.length > 0 && /* @__PURE__ */ Q(L, {
1297
- schema: K,
1298
- ...he
1299
- }),
1300
- /* @__PURE__ */ $(k, {
1301
- divided: !0,
1302
- children: [/* @__PURE__ */ Q(L, {
1303
- schema: me,
1304
- ...he
1305
- }), /* @__PURE__ */ Q(ft, {
1306
- inline: !0,
1307
- def: j.def,
1308
- view: B,
1309
- tab: "effect",
1310
- onPatch: U,
1311
- levels: /* @__PURE__ */ $(Zn, { children: [
1312
- [
1313
- ["type", "Type"],
1314
- ["category", "Category"],
1315
- ["preset", "Preset"]
1316
- ].filter(([e]) => Ce(j.def, e)).map(([t, n]) => /* @__PURE__ */ Q(O, {
1317
- tone: "primary",
1318
- size: i,
1319
- className: "flex-1 min-w-0",
1320
- "aria-label": `Randomize ${n.toLowerCase()}`,
1321
- onClick: () => {
1322
- let n = b(ee() >>> 0);
1323
- if (t === "preset") {
1324
- let e = ge(j.def, B, n);
1325
- e != null && U(de(j.def, e));
1326
- return;
1327
- }
1328
- let r = be(j.id, t, n);
1329
- r && f(e.id, D, r);
1330
- },
1331
- children: n
1332
- }, t)),
1333
- /* @__PURE__ */ Q(O, {
1334
- tone: "primary",
1335
- size: i,
1336
- className: "flex-1 min-w-0",
1337
- "aria-label": "Randomize settings",
1338
- onClick: () => {
1339
- U(xe(B, A(j.def.params.filter((e) => w(e) !== "anim"), B), b(ee() >>> 0)));
1340
- },
1341
- children: "Settings"
1342
- }),
1343
- /* @__PURE__ */ Q(Oe, {
1344
- def: j.def,
1345
- isFilter: !0
1346
- })
1347
- ] })
1348
- })]
1349
- }),
1350
- /* @__PURE__ */ Q(Rn, {}),
1351
- pe < G.length && /* @__PURE__ */ $(Zn, { children: [/* @__PURE__ */ Q(L, {
1352
- schema: G.slice(pe),
1353
- ...he
1354
- }), /* @__PURE__ */ Q(Rn, {})] }),
1355
- /* @__PURE__ */ Q(ti, {
1356
- chain: T,
1357
- from: D + 1,
1358
- layer: e,
1359
- hostView: B,
1360
- addFilter: d,
1361
- removeFilter: p,
1362
- toggleFilter: g,
1363
- setStagePropAt: V,
1364
- palette: y,
1365
- showMod: t
1366
- })
1367
- ] }), l === "anim" && /* @__PURE__ */ $(Zn, { children: [
1368
- /* @__PURE__ */ Q(Lr, {
1369
- schema: j.def.params,
1370
- layer: B,
1371
- setProp: H,
1372
- inputs: j.def.inputs
1373
- }),
1374
- /* @__PURE__ */ Q(L, {
1375
- schema: j.def.params,
1376
- ...he,
1377
- tab: "anim"
1378
- }),
1379
- j.def.orbit && /* @__PURE__ */ Q(k, {
1380
- label: "Interaction",
1381
- divided: !0,
1382
- children: /* @__PURE__ */ Q(C, {
1383
- label: "ORBIT (C)",
1384
- align: "fill",
1385
- labelWidth: r,
1386
- children: /* @__PURE__ */ Q(P, {
1387
- layout: "joined",
1388
- tone: "sunken",
1389
- size: i,
1390
- className: "w-full",
1391
- value: n.grab && B.orbit !== !1 ? "on" : "off",
1392
- options: [{
1393
- value: "off",
1394
- label: "Off"
1395
- }, {
1396
- value: "on",
1397
- label: "On"
1398
- }],
1399
- onChange: (e) => {
1400
- H("orbit", e === "on"), e === "on" && !n.grab && m("grab", !0);
1401
- }
1402
- })
1403
- })
1404
- }),
1405
- /* @__PURE__ */ Q(k, {
1406
- divided: !0,
1407
- children: /* @__PURE__ */ Q(ft, {
1408
- inline: !0,
1409
- def: j.def,
1410
- view: B,
1411
- tab: "anim",
1412
- onPatch: U
1413
- })
1414
- }),
1415
- j.def.sweeps && /* @__PURE__ */ Q(pt, {
1416
- sweeps: Array.isArray(j.params.sweeps) ? j.params.sweeps : [],
1417
- onChange: (e) => H("sweeps", e),
1418
- inline: !0
1419
- }),
1420
- /* @__PURE__ */ Q(Pr, {
1421
- schema: j.def.params,
1422
- layer: B,
1423
- setProp: H
1424
- }),
1425
- /* @__PURE__ */ Q($r, {
1426
- chain: T,
1427
- layer: e,
1428
- hostView: B,
1429
- addFilter: d,
1430
- removeFilter: p,
1431
- setStagePropAt: V,
1432
- palette: y,
1433
- showMod: t
1434
- })
1435
- ] })]
1436
- });
1437
- }
1438
- var Zr = W.filter((e) => !e.kind && !e.first);
1439
- function Qr({ layer: e, edit: t, palette: n, showMod: r }) {
1440
- let { addFilter: i, removeFilter: a, toggleFilter: s } = o(), c = x(e), l = c.map(({ def: e, ...t }) => t);
1441
- return /* @__PURE__ */ Q(ti, {
1442
- chain: c,
1443
- from: 0,
1444
- filters: Zr,
1445
- layer: e,
1446
- hostView: e,
1447
- addFilter: i,
1448
- removeFilter: a,
1449
- toggleFilter: s,
1450
- setStagePropAt: (e) => (n, r) => t.patch({ filters: l.map((t, i) => i === e ? {
1451
- ...t,
1452
- params: {
1453
- ...t.params,
1454
- [n]: r
1455
- }
1456
- } : t) }),
1457
- palette: n,
1458
- showMod: r
1459
- });
1460
- }
1461
- function $r({ chain: e, layer: t, hostView: n, addFilter: r, removeFilter: i, setStagePropAt: a, palette: o, showMod: s }) {
1462
- let l = c(), u = e.findIndex((e) => e.id === "fx-media"), d = u < 0 ? null : e[u], f = d ? {
1463
- ...n,
1464
- ...d.params,
1465
- id: t.id
1466
- } : null, p = d ? a(u) : null;
1467
- return /* @__PURE__ */ Q(k, {
1468
- label: "Media",
1469
- divided: !0,
1470
- children: d?.def ? /* @__PURE__ */ $(Zn, { children: [/* @__PURE__ */ Q(L, {
1471
- schema: d.def.params,
1472
- layer: f,
1473
- setProp: p,
1474
- palette: o,
1475
- inline: !0,
1476
- renderAnimate: s ? (e) => /* @__PURE__ */ Q(dt, {
1477
- layer: f,
1478
- param: e,
1479
- setProp: p
1480
- }) : void 0
1481
- }), /* @__PURE__ */ Q(O, {
1482
- tone: "primary",
1483
- size: l,
1484
- className: "w-full",
1485
- iconLeft: "x",
1486
- iconSize: 12,
1487
- onClick: () => i(t.id, u),
1488
- children: "Remove media motion"
1489
- })] }) : e.length < 8 && /* @__PURE__ */ Q(O, {
1490
- tone: "primary",
1491
- size: l,
1492
- className: "w-full",
1493
- iconLeft: "plus",
1494
- iconSize: 12,
1495
- onClick: () => r(t.id, "fx-media"),
1496
- children: "Add media motion"
1497
- })
1498
- });
1499
- }
1500
- function ei({ chain: e, from: t = 0, layer: n, hostView: r, toggleFilter: i, removeFilter: a, setStagePropAt: o, palette: s, showMod: l }) {
1501
- let u = c();
1502
- return e.slice(t).map((e, c) => {
1503
- let d = c + t, f = e.enabled !== !1, p = {
1504
- ...r,
1505
- ...e.params,
1506
- id: n.id
1507
- }, m = o(d);
1508
- return /* @__PURE__ */ $("div", {
1509
- className: "flex flex-col gap-2 p-2 rounded bg-oq-04",
1510
- children: [/* @__PURE__ */ $("div", {
1511
- className: "flex items-center gap-2",
1512
- children: [/* @__PURE__ */ Q(F, {
1513
- size: u,
1514
- checked: f,
1515
- onChange: () => i(n.id, d),
1516
- label: e.def?.label ?? e.id
1517
- }), /* @__PURE__ */ Q(Wn, {
1518
- asChild: !0,
1519
- label: "Delete effect",
1520
- children: /* @__PURE__ */ Q(O, {
1521
- tone: "ghost",
1522
- quiet: !0,
1523
- size: "xs",
1524
- iconOnly: "x",
1525
- "aria-label": "Delete effect",
1526
- className: "ml-auto shrink-0",
1527
- onClick: () => a(n.id, d)
1528
- })
1529
- })]
1530
- }), f && e.def && /* @__PURE__ */ Q(L, {
1531
- schema: e.def.params.filter((e) => w(e) !== "anim"),
1532
- layer: p,
1533
- setProp: m,
1534
- palette: s,
1535
- inline: !0,
1536
- renderAnimate: l ? (e) => /* @__PURE__ */ Q(dt, {
1537
- layer: p,
1538
- param: e,
1539
- setProp: m
1540
- }) : void 0
1541
- })]
1542
- }, e.key ?? d);
1543
- });
1544
- }
1545
- function ti({ chain: e, from: t = 1, filters: n = null, layer: r, hostView: i, addFilter: a, removeFilter: o, toggleFilter: s, setStagePropAt: l, palette: u, showMod: d }) {
1546
- let f = c(), p = [{
1547
- value: "",
1548
- label: "Add FX…"
1549
- }, ...(n ?? U(W)).map((e) => ({
1550
- value: e.id,
1551
- label: e.label ?? e.id
1552
- }))];
1553
- return /* @__PURE__ */ $(k, {
1554
- label: "Post-Processing",
1555
- divided: !0,
1556
- children: [/* @__PURE__ */ Q(ei, {
1557
- chain: e,
1558
- from: t,
1559
- layer: r,
1560
- hostView: i,
1561
- toggleFilter: s,
1562
- removeFilter: o,
1563
- setStagePropAt: l,
1564
- palette: u,
1565
- showMod: d
1566
- }), e.length < 8 && /* @__PURE__ */ Q(v, {
1567
- variant: "subtle",
1568
- size: f,
1569
- className: "w-full",
1570
- options: p,
1571
- value: "",
1572
- onChange: (e) => {
1573
- e && a(r.id, e);
1574
- }
1575
- })]
1576
- });
1577
- }
1578
- function ni({ layer: e, showMod: t, tree: n }) {
1579
- let r = c(), [i, s] = Z("generate"), { updateLayer: l, palette: u } = o(), { setOnly: d } = _e(), f = ne(e.id, { history: "coalesce" }), p = V(e.loopGroup).find((t) => t.id === e.presetId), m = H(e.loopGroup), g = (n ?? Ae).find((t) => t.groups.includes(e.loopGroup)), _ = g?.labels?.[e.loopGroup] ?? m?.label ?? "", v = g && g.label !== _ ? `${g.label} / ${_}` : _, y = e.loopGroup === "paratype" && p?.sub === "Glyphs" ? B("paratype", "Glyphs") : null, b = y ? y.map((e) => ({
1580
- value: e.id,
1581
- label: e.label
1582
- })) : null, x = (t) => {
1583
- let n = y?.find((e) => e.id === t);
1584
- n && t !== e.presetId && d(e.type, pe(n, e.loopGroup));
1585
- }, S = () => {
1586
- p && d(e.type, pe(p, e.loopGroup));
1587
- };
1588
- return Ur(S, () => {
1589
- let t = K(e.loopId)?.params ?? [];
1590
- l(e.id, h(e, A(t, e), ee(), { withFilters: !0 }));
1591
- }), /* @__PURE__ */ $(Yr, {
1592
- title: v,
1593
- chips: b,
1594
- active: e.presetId,
1595
- onPick: x,
1596
- pills: !0,
1597
- scope: e.loopId,
1598
- ghostLabels: (K(e.loopId)?.params ?? []).filter((e) => e.type !== "color" && e.label).map((e) => e.label),
1599
- tabStrip: /* @__PURE__ */ Q(P, {
1600
- layout: "joined",
1601
- tone: "sunken",
1602
- value: i,
1603
- onChange: s,
1604
- options: r === "sm" ? Gr : Kr,
1605
- size: r,
1606
- className: a(r)
1607
- }),
1608
- children: [
1609
- i === "anim" && /* @__PURE__ */ Q(Lr, {
1610
- schema: K(e.loopId)?.params ?? [],
1611
- layer: e,
1612
- setProp: f.setProp,
1613
- inputs: K(e.loopId)?.inputs
1614
- }),
1615
- /* @__PURE__ */ Q(Te, {
1616
- layer: e,
1617
- setProp: f.setProp,
1618
- patch: f.patch,
1619
- updateLayer: l,
1620
- palette: u,
1621
- renderAnimate: t ? (t) => /* @__PURE__ */ Q(dt, {
1622
- layer: e,
1623
- param: t,
1624
- setProp: f.setProp
1625
- }) : void 0,
1626
- tab: i,
1627
- tabStrip: null,
1628
- tree: n,
1629
- inline: !0,
1630
- onReset: S
1631
- }),
1632
- i === "generate" && e.loopId === "scene3d" && e.primitive === "mesh" && /* @__PURE__ */ Q(Hr, {
1633
- layer: e,
1634
- setProp: f.setProp
1635
- }),
1636
- i === "style" && /* @__PURE__ */ Q(Qr, {
1637
- layer: e,
1638
- edit: f,
1639
- palette: u,
1640
- showMod: t
1641
- }),
1642
- i === "anim" && /* @__PURE__ */ Q(Pr, {
1643
- schema: K(e.loopId)?.params ?? [],
1644
- layer: e,
1645
- setProp: f.setProp
1646
- })
1647
- ]
1648
- });
1649
- }
1650
- function ri({ layer: e, showMod: t }) {
1651
- let n = c(), [r, i] = Z("generate"), { updateLayer: s, palette: l } = o(), { setOnly: u } = _e(), d = ne(e.id, { history: "coalesce" }), f = ht.find((t) => t.id === e.presetId), p = mt.find((e) => e.subs.includes(f?.sub))?.label ?? "Kinetic";
1652
- return Ur(() => {
1653
- f && u("kinetic", {
1654
- presetId: f.id,
1655
- presetLabel: f.label,
1656
- comp: _t(f)
1657
- });
1658
- }, () => {
1659
- let t = ee(), n = b(t >>> 0), r = e.comp ?? { instances: [] };
1660
- (r.instances ?? []).forEach((e, t) => {
1661
- r = vt(r, t, n);
1662
- }), s(e.id, {
1663
- comp: r,
1664
- _rollSeed: t
1665
- });
1666
- }), /* @__PURE__ */ Q(Yr, {
1667
- title: p,
1668
- tabStrip: /* @__PURE__ */ Q(P, {
1669
- layout: "joined",
1670
- tone: "sunken",
1671
- value: r,
1672
- onChange: i,
1673
- options: n === "sm" ? Gr : Kr,
1674
- size: n,
1675
- className: a(n)
1676
- }),
1677
- children: /* @__PURE__ */ Q(gt, {
1678
- layer: e,
1679
- setProp: d.setProp,
1680
- updateLayer: s,
1681
- palette: l,
1682
- renderAnimate: t ? (t) => /* @__PURE__ */ Q(dt, {
1683
- layer: e,
1684
- param: t,
1685
- setProp: d.setProp
1686
- }) : () => null,
1687
- tab: r,
1688
- tabStrip: null
1689
- })
1690
- });
1691
- }
1692
- function ii() {
1693
- let { layer: e } = _e(), t = ct(), n = c(), r = ut();
1694
- return Y(() => {
1695
- let e = (e) => {
1696
- e.key !== "m" && e.key !== "M" || e.metaKey || e.ctrlKey || e.altKey || wt(e) || lt();
1697
- };
1698
- return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
1699
- }, []), t.active ? /* @__PURE__ */ Q(Yr, {
1700
- title: "Morph",
1701
- children: /* @__PURE__ */ Q(Ar, {
1702
- layer: e,
1703
- editTabs: n === "sm" ? Gr : Kr
1704
- })
1705
- }) : e ? e.type === "photo" ? /* @__PURE__ */ Q(Xr, {
1706
- layer: e,
1707
- showMod: r
1708
- }, e.id) : e.type === "loop" ? /* @__PURE__ */ Q(ni, {
1709
- layer: e,
1710
- showMod: r
1711
- }, e.id) : e.type === "misc" ? /* @__PURE__ */ Q(ni, {
1712
- layer: e,
1713
- showMod: r,
1714
- tree: ve
1715
- }, e.id) : e.type === "kinetic" ? /* @__PURE__ */ Q(ri, {
1716
- layer: e,
1717
- showMod: r
1718
- }, e.id) : /* @__PURE__ */ Q(R, { children: "This layer has no labs surface." }) : /* @__PURE__ */ Q(R, { children: "Pick an effect or generator from the nav." });
1719
- }
1720
- //#endregion
1721
- //#region src/editor/mobile/CategoryScreen.jsx
1722
- function ai(e) {
1723
- Y(() => {
1724
- let t = (t) => {
1725
- t.key === "Escape" && e?.();
1726
- };
1727
- return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
1728
- }, [e]), Y(() => {
1729
- let e = n.isPlaying();
1730
- return n.pause(), () => {
1731
- e && n.play();
1732
- };
1733
- }, []);
1734
- }
1735
- function oi({ onPick: e, onInsert: t, onBack: n, onDismiss: r }) {
1736
- return ai(r ?? n), /* @__PURE__ */ Q("div", {
1737
- className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] kol-overlay-scrim flex flex-col items-center overflow-y-auto p-6",
1738
- style: { zIndex: "var(--kol-z-modal)" },
1739
- children: /* @__PURE__ */ $("div", {
1740
- className: "my-auto w-full max-w-sm rounded p-8 flex flex-col gap-6",
1741
- style: { background: "var(--kol-surface-primary)" },
1742
- children: [
1743
- /* @__PURE__ */ Q("div", {
1744
- className: "kol-eyebrow text-body",
1745
- children: "Pick a generator"
1746
- }),
1747
- /* @__PURE__ */ Q("div", {
1748
- className: "flex flex-col gap-2",
1749
- children: Ae.map((t) => {
1750
- let n = xr[`gen:${t.label}`] ?? "square";
1751
- return /* @__PURE__ */ Q(J, {
1752
- tone: "primary",
1753
- size: "lg",
1754
- className: Kt,
1755
- iconLeft: n,
1756
- iconRight: n,
1757
- onClick: () => e(t),
1758
- children: t.label
1759
- }, t.label);
1760
- })
1761
- }),
1762
- /* @__PURE__ */ $("div", {
1763
- className: "flex flex-col gap-2",
1764
- children: [t && /* @__PURE__ */ Q(J, {
1765
- tone: "grey",
1766
- size: "lg",
1767
- className: "w-full [&>span]:w-full [&>span]:justify-between",
1768
- iconLeft: "image",
1769
- iconRight: "image",
1770
- onClick: t,
1771
- children: "Insert image or video"
1772
- }), n && /* @__PURE__ */ Q(J, {
1773
- tone: "grey",
1774
- size: "lg",
1775
- className: "w-full [&>span]:w-full [&>span]:justify-between",
1776
- iconLeft: "arrow-left",
1777
- iconRight: "arrow-left",
1778
- onClick: n,
1779
- children: "Back"
1780
- })]
1781
- })
1782
- ]
1783
- })
1784
- });
1785
- }
1786
- //#endregion
1787
- //#region src/editor/labs/LabsSourcePicker.jsx
1788
- var si = (e) => /\.svg$/i.test(e.key) || /svg/i.test(e.contentType || "");
1789
- function ci(e) {
1790
- let { patch: t } = ne(e.id), n = X(null), [r, i] = Z(!1), a = e.type === "loop" && e.loopGroup === "distress";
1791
- return {
1792
- nodes: /* @__PURE__ */ $(Zn, { children: [/* @__PURE__ */ Q("input", {
1793
- ref: n,
1794
- type: "file",
1795
- accept: a ? ".svg,image/svg+xml" : "image/*,video/*",
1796
- className: "hidden",
1797
- onChange: (n) => {
1798
- let r = n.target.files?.[0];
1799
- if (n.target.value = "", r) {
1800
- if (a) {
1801
- let e = new FileReader();
1802
- e.onload = () => t({ svgSrc: e.result }), e.readAsText(r);
1803
- return;
1804
- }
1805
- if (r.type.startsWith("video/")) {
1806
- l(e.id, r), t({
1807
- src: URL.createObjectURL(r),
1808
- srcType: "video"
1809
- });
1810
- return;
1811
- }
1812
- Tt(r).then((e) => t({
1813
- src: e,
1814
- srcType: "image"
1815
- }));
1816
- }
1817
- }
1818
- }), /* @__PURE__ */ Q(Mn, {
1819
- open: r,
1820
- accept: a ? si : ["image", "video"],
1821
- onClose: () => i(!1),
1822
- onSelect: (e, { contentType: n } = {}) => {
1823
- if (a) {
1824
- t({ svgSrc: Qt(e) });
1825
- return;
1826
- }
1827
- t({
1828
- src: Qt(e),
1829
- srcType: Fn(n) ? "video" : "image"
1830
- });
1831
- }
1832
- })] }),
1833
- svgMode: a,
1834
- openLibrary: () => i(!0),
1835
- openUpload: () => n.current?.click(),
1836
- openCamera: () => {
1837
- Ht(e.id).then(() => t({
1838
- src: null,
1839
- srcType: "webcam"
1840
- })).catch(() => {});
1841
- }
1842
- };
1843
- }
1844
- [
1845
- {
1846
- value: "library",
1847
- label: "Library"
1848
- },
1849
- {
1850
- value: "upload",
1851
- label: "Upload"
1852
- },
1853
- {
1854
- value: "camera",
1855
- label: "Camera"
1856
- }
1857
- ].slice(0, 2);
1858
- function li({ layer: e }) {
1859
- let t = ci(e);
1860
- return /* @__PURE__ */ $("div", {
1861
- className: "flex flex-col gap-2",
1862
- children: [
1863
- /* @__PURE__ */ Q(O, {
1864
- tone: "primary",
1865
- size: "lg",
1866
- className: Kt,
1867
- iconLeft: "image",
1868
- iconRight: "image",
1869
- onClick: t.openLibrary,
1870
- children: "From library"
1871
- }),
1872
- /* @__PURE__ */ Q(O, {
1873
- tone: "primary",
1874
- size: "lg",
1875
- className: Kt,
1876
- iconLeft: "upload",
1877
- iconRight: "upload",
1878
- onClick: t.openUpload,
1879
- children: "Upload"
1880
- }),
1881
- !t.svgMode && /* @__PURE__ */ Q(O, {
1882
- tone: "primary",
1883
- size: "lg",
1884
- className: "w-full [&>span]:w-full [&>span]:justify-between",
1885
- iconLeft: "camera",
1886
- iconRight: "camera",
1887
- onClick: t.openCamera,
1888
- children: "Camera"
1889
- }),
1890
- t.nodes
1891
- ]
1892
- });
1893
- }
1894
- function ui({ layer: e, title: t, onBack: n }) {
1895
- return ai(n), /* @__PURE__ */ Q("div", {
1896
- className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] kol-overlay-scrim flex flex-col items-center overflow-y-auto p-6",
1897
- style: { zIndex: "calc(var(--kol-z-sticky) - 2)" },
1898
- children: /* @__PURE__ */ $("div", {
1899
- className: "my-auto w-full max-w-sm rounded p-8 flex flex-col gap-6",
1900
- style: { background: "var(--kol-surface-primary)" },
1901
- children: [
1902
- /* @__PURE__ */ $("div", {
1903
- className: "flex flex-col gap-2",
1904
- children: [/* @__PURE__ */ Q("span", {
1905
- className: "kol-eyebrow text-body",
1906
- children: t
1907
- }), /* @__PURE__ */ Q("span", {
1908
- className: "kol-mono-12 text-meta",
1909
- children: "Pick the media it works on."
1910
- })]
1911
- }),
1912
- /* @__PURE__ */ Q(li, { layer: e }),
1913
- /* @__PURE__ */ Q(O, {
1914
- tone: "grey",
1915
- size: "lg",
1916
- className: Kt,
1917
- iconLeft: "arrow-left",
1918
- iconRight: "arrow-left",
1919
- onClick: n,
1920
- children: "Back"
1921
- })
1922
- ]
1923
- })
1924
- });
1925
- }
1926
- //#endregion
1927
- //#region src/editor/components/PanelHeader.jsx
1928
- function di({ title: e, onCollapse: t, action: n, className: r = "px-3" }) {
1929
- return /* @__PURE__ */ $("div", {
1930
- className: `flex w-full shrink-0 items-center ${r}`,
1931
- children: [/* @__PURE__ */ $("button", {
1932
- className: "kol-helper-12 text-meta flex flex-1 items-center gap-2 py-2.5",
1933
- onClick: t,
1934
- children: [/* @__PURE__ */ Q("span", { children: e }), /* @__PURE__ */ Q(Qn, {
1935
- name: "chevron-down",
1936
- size: 16,
1937
- className: "text-oq-48"
1938
- })]
1939
- }), n]
1940
- });
1941
- }
1942
- function fi({ label: e, onOpen: t, size: n = "lg", tone: r = "primary", children: i }) {
1943
- return /* @__PURE__ */ $("div", {
1944
- className: "pointer-events-none fixed bottom-[max(0.75rem,env(safe-area-inset-bottom))] left-[var(--fxr-rail,0px)] right-0 z-10 flex flex-nowrap items-center gap-2 px-3 [&>*]:pointer-events-auto",
1945
- children: [/* @__PURE__ */ Q(J, {
1946
- tone: r,
1947
- size: n,
1948
- onClick: t,
1949
- className: "min-w-0 shrink",
1950
- children: /* @__PURE__ */ $("span", {
1951
- className: "flex items-center gap-2 min-w-0",
1952
- children: [/* @__PURE__ */ Q("span", {
1953
- className: "truncate",
1954
- children: e
1955
- }), /* @__PURE__ */ Q(Qn, {
1956
- name: "chevron-down",
1957
- size: 16,
1958
- className: "rotate-180 shrink-0"
1959
- })]
1960
- })
1961
- }), i]
1962
- });
1963
- }
1964
- var pi = {
1965
- half: "50dvh",
1966
- tall: "85dvh"
1967
- }, mi = 4;
1968
- function hi({ tall: e, onToggle: t, onDrag: n, onResize: r, onResizeEnd: i }) {
1969
- let a = X(null);
1970
- Gn(a, { axis: "x" });
1971
- let o = X({
1972
- y: null,
1973
- h0: 0,
1974
- moved: !1,
1975
- swallow: !1,
1976
- last: 0
1977
- }).current;
1978
- return /* @__PURE__ */ Q("button", {
1979
- ref: a,
1980
- type: "button",
1981
- "aria-label": e ? "Lower the sheet" : "Raise the sheet",
1982
- "aria-pressed": e,
1983
- className: "kol-sheet-grab relative flex h-6 w-full shrink-0 touch-none items-center justify-center",
1984
- onPointerDown: (e) => {
1985
- o.y = e.clientY, o.moved = !1, o.h0 = window.innerHeight - e.currentTarget.getBoundingClientRect().top, e.currentTarget.setPointerCapture?.(e.pointerId);
1986
- },
1987
- onPointerMove: (e) => {
1988
- if (o.y === null) return;
1989
- let t = e.clientY - o.y;
1990
- Math.abs(t) > mi && (o.moved = !0), o.moved && r && (o.last = o.h0 - t, r(o.last));
1991
- },
1992
- onPointerUp: (e) => {
1993
- if (o.y === null) return;
1994
- let t = e.clientY - o.y;
1995
- o.y = null, o.moved && (o.swallow = !0, r ? i?.(o.h0 - t) : n?.(t < 0 ? -1 : 1));
1996
- },
1997
- onPointerCancel: () => {
1998
- o.y = null;
1999
- },
2000
- onClick: () => {
2001
- if (o.swallow) {
2002
- o.swallow = !1;
2003
- return;
2004
- }
2005
- t?.();
2006
- },
2007
- children: /* @__PURE__ */ Q("span", { className: "h-1 w-9 rounded-full bg-oq-16" })
2008
- });
2009
- }
2010
- //#endregion
2011
- //#region src/editor/labs/LabsCatalogCard.jsx
2012
- var gi = new Set(["#rail/sec:effects"]);
2013
- function _i({ onPicked: e, onClose: t, initialOpen: n = null, hasMedia: r = !0, onNeedMedia: i }) {
2014
- let { items: a, dispatch: o } = An(), [s, c] = Z(n);
2015
- ai(t);
2016
- let l = a.find((e) => e.path === s) ?? null, u = l ? l.sub : a;
2017
- return /* @__PURE__ */ Q("div", {
2018
- className: "fixed bottom-0 top-12 md:top-0 right-0 left-[var(--fxr-rail,0px)] kol-overlay-scrim flex flex-col items-center overflow-y-auto p-6",
2019
- style: { zIndex: "calc(var(--kol-z-sticky) - 2)" },
2020
- onClick: (e) => {
2021
- e.target === e.currentTarget && t?.();
2022
- },
2023
- children: /* @__PURE__ */ $("div", {
2024
- className: "my-auto w-full max-w-sm rounded p-4 flex flex-col gap-6",
2025
- style: { background: "var(--kol-surface-primary)" },
2026
- children: [/* @__PURE__ */ Q("span", {
2027
- className: "kol-eyebrow text-body",
2028
- children: l ? l.label : "Labs"
2029
- }), /* @__PURE__ */ $("div", {
2030
- className: "flex flex-col gap-2",
2031
- children: [u.map((t) => /* @__PURE__ */ Q(J, {
2032
- tone: "primary",
2033
- size: "lg",
2034
- className: Kt,
2035
- iconLeft: t.icon,
2036
- iconRight: t.icon,
2037
- onClick: () => {
2038
- if (!l && gi.has(t.path) && !r && i) {
2039
- i(t.path);
2040
- return;
2041
- }
2042
- if (!l && t.sub?.length) {
2043
- c(t.path);
2044
- return;
2045
- }
2046
- o?.(t.path) && e?.();
2047
- },
2048
- children: t.label
2049
- }, t.path)), l && /* @__PURE__ */ Q(J, {
2050
- tone: "grey",
2051
- size: "lg",
2052
- className: "w-full [&>span]:w-full [&>span]:justify-between",
2053
- iconLeft: "arrow-left",
2054
- iconRight: "arrow-left",
2055
- onClick: () => c(null),
2056
- children: "Back"
2057
- })]
2058
- })]
2059
- })
2060
- });
2061
- }
2062
- //#endregion
2063
- //#region src/editor/labs/sheetLabels.js
2064
- function vi(e) {
2065
- if (rt().active) return {
2066
- title: "Morph",
2067
- pill: "Morph"
2068
- };
2069
- if (!e) return {
2070
- title: "Labs",
2071
- pill: "Labs"
2072
- };
2073
- if (e.type === "loop" || e.type === "misc") return {
2074
- title: H(e.loopGroup)?.label ?? "Labs",
2075
- kind: e.presetLabel,
2076
- pill: e.presetLabel
2077
- };
2078
- if (e.type === "photo") {
2079
- let t = x(e)[0]?.def?.label ?? "Media";
2080
- return {
2081
- title: t,
2082
- pill: t
2083
- };
2084
- }
2085
- let t = e.presetLabel ?? "Labs";
2086
- return {
2087
- title: t,
2088
- pill: t
2089
- };
2090
- }
2091
- //#endregion
2092
- //#region src/editor/labs/LabsView.jsx
2093
- var yi = .85, bi = .3, xi = 2.5, Si = {
2094
- 0: 1,
2095
- 1: .5,
2096
- 2: 1,
2097
- 3: 1.5,
2098
- 4: 2
2099
- }, Ci = "px-2 py-1 rounded border border-oq-08 bg-surface-secondary kol-mono-12 text-emphasis tabular-nums";
2100
- function wi() {
2101
- let { layer: e } = _e(), { removeLayer: t, layers: r, updateLayer: i, beginTransaction: a, commitTransaction: s, select: c } = o(), [l, u] = Z(null);
2102
- Y(() => {
2103
- let e = (e) => {
2104
- let { id: t, index: n } = e.detail || {};
2105
- if (l?.id === t) {
2106
- u(null);
2107
- return;
2108
- }
2109
- r.some((e) => e.id === t && e.type === "kinetic" && !e.locked) && (c(t), u({
2110
- id: t,
2111
- index: n ?? 0
2112
- }));
2113
- };
2114
- return window.addEventListener("kol:kinetic-edit", e), () => window.removeEventListener("kol:kinetic-edit", e);
2115
- }, [
2116
- r,
2117
- l,
2118
- c
2119
- ]);
2120
- let d = l && r.find((e) => e.id === l.id && e.type === "kinetic"), f = e?.type === "photo" && !e.src && e.srcType !== "webcam", [m, h] = Z(1), [g, _] = Z(!1), v = jt(g), y = X(null), b = (e) => Math.min(xi, Math.max(bi, e)), x = (e) => h((t) => b(t * (e > 0 ? 1.25 : .8))), { tool: S } = Mt(), C = S === "orbit", w = X(C);
2121
- w.current = C, Y(() => {
2122
- let e = y.current;
2123
- if (!e) return;
2124
- let t = (e) => {
2125
- w.current || (e.preventDefault(), !p().zoomLock && h((t) => b(t * (e.deltaY > 0 ? .94 : 1.06))));
2126
- };
2127
- return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
2128
- }, []), Y(() => {
2129
- let e = (e) => {
2130
- if (!(e.metaKey || e.ctrlKey || e.altKey) && !wt(e)) {
2131
- if (e.key === "f" || e.key === "F") {
2132
- _((e) => !e);
2133
- return;
2134
- }
2135
- if (!(p().zoomLock && (e.key === "-" || e.key === "_" || e.key === "+" || e.key === "=" || Si[e.key] !== void 0))) {
2136
- if (e.key === "-" || e.key === "_") {
2137
- x(-1);
2138
- return;
2139
- }
2140
- if (e.key === "+" || e.key === "=") {
2141
- x(1);
2142
- return;
2143
- }
2144
- Si[e.key] !== void 0 && h(Si[e.key]);
2145
- }
2146
- }
2147
- };
2148
- return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
2149
- }, []);
2150
- let [T, E] = Z({
2151
- x: 0,
2152
- y: 0
2153
- }), D = X({
2154
- pts: /* @__PURE__ */ new Map(),
2155
- start: null,
2156
- tap: null
2157
- }), O = X({
2158
- zoom: m,
2159
- pan: T
2160
- });
2161
- O.current = {
2162
- zoom: m,
2163
- pan: T
2164
- };
2165
- let k = (e) => {
2166
- if (e.pointerType !== "touch") return;
2167
- let t = D.current;
2168
- if (t.pts.set(e.pointerId, {
2169
- x: e.clientX,
2170
- y: e.clientY
2171
- }), t.tap = t.pts.size === 1 ? {
2172
- id: e.pointerId,
2173
- x: e.clientX,
2174
- y: e.clientY,
2175
- at: performance.now()
2176
- } : null, t.pts.size === 2) {
2177
- let [r, i] = [...t.pts.values()], a = y.current.getBoundingClientRect(), o = a.left + a.width / 2, s = a.top + a.height / 2, c = (r.x + i.x) / 2, l = (r.y + i.y) / 2, { zoom: u, pan: d } = O.current;
2178
- t.start = {
2179
- d: Math.hypot(r.x - i.x, r.y - i.y),
2180
- cx: o,
2181
- cy: s,
2182
- z0: u,
2183
- qx: (c - o - d.x) / u,
2184
- qy: (l - s - d.y) / u
2185
- }, n.setStagePointer?.(null), e.stopPropagation();
2186
- }
2187
- }, A = (e) => {
2188
- let t = D.current;
2189
- if (!(e.pointerType !== "touch" || !t.pts.has(e.pointerId)) && (t.pts.set(e.pointerId, {
2190
- x: e.clientX,
2191
- y: e.clientY
2192
- }), t.pts.size >= 2 && t.start)) {
2193
- e.stopPropagation();
2194
- let [n, r] = [...t.pts.values()], i = t.start, a = p().zoomLock ? i.z0 : b(i.z0 * (Math.hypot(n.x - r.x, n.y - r.y) / i.d)), o = (n.x + r.x) / 2, s = (n.y + r.y) / 2;
2195
- h(a), E({
2196
- x: o - i.cx - a * i.qx,
2197
- y: s - i.cy - a * i.qy
2198
- });
2199
- }
2200
- }, j = (t) => {
2201
- let r = D.current;
2202
- if (t.pointerType !== "touch") return;
2203
- let i = r.tap;
2204
- i && i.id === t.pointerId && t.type === "pointerup" && !r.start && performance.now() - i.at < 350 && Math.hypot(t.clientX - i.x, t.clientY - i.y) < 12 && (e?.type === "loop" ? K(e.loopId) : null)?.group !== "penrose" && n.toggle(), i?.id === t.pointerId && (r.tap = null), r.pts.delete(t.pointerId), r.pts.size < 2 && (r.start = null);
2205
- };
2206
- return /* @__PURE__ */ $("div", {
2207
- ref: y,
2208
- className: "relative w-full h-full flex items-center justify-center overflow-hidden touch-none",
2209
- style: { background: "var(--kol-surface-secondary)" },
2210
- onDoubleClick: () => {
2211
- h(1), E({
2212
- x: 0,
2213
- y: 0
2214
- });
2215
- },
2216
- onPointerDownCapture: k,
2217
- onPointerMoveCapture: A,
2218
- onPointerUpCapture: j,
2219
- onPointerCancelCapture: j,
2220
- children: [
2221
- /* @__PURE__ */ Q("div", {
2222
- style: {
2223
- flex: "none",
2224
- width: `${m * yi * 100}%`,
2225
- height: `${m * yi * 100}%`,
2226
- transform: `translate(${T.x}px, ${T.y}px)`
2227
- },
2228
- children: /* @__PURE__ */ Q(tn, { overlay: d ? (e) => /* @__PURE__ */ Q(Nn, {
2229
- layer: d,
2230
- initialIndex: l.index,
2231
- toVirtual: e,
2232
- updateLayer: i,
2233
- beginTransaction: a,
2234
- commitTransaction: s,
2235
- onExit: () => u(null)
2236
- }) : void 0 })
2237
- }),
2238
- f && /* @__PURE__ */ Q(ui, {
2239
- layer: e,
2240
- title: vi(e).title,
2241
- onBack: () => t(e.id)
2242
- }),
2243
- g && /* @__PURE__ */ Q("div", {
2244
- className: "absolute bottom-3 right-3 z-[var(--kol-z-base)] flex items-center gap-2 [@media(pointer:coarse)]:bottom-1",
2245
- children: /* @__PURE__ */ Q(Wn, {
2246
- label: "Framerate — press F to hide",
2247
- children: /* @__PURE__ */ $("span", {
2248
- className: Ci,
2249
- children: [v, " fps"]
2250
- })
2251
- })
2252
- })
2253
- ]
2254
- });
2255
- }
2256
- function Ti() {
2257
- let e = X(null), { grabProps: t } = nr(e, {
2258
- token: "kol-rail",
2259
- side: "right"
2260
- });
2261
- return Y(() => {
2262
- let e = document.documentElement, t = !1, n = () => {
2263
- let t = parseFloat(getComputedStyle(e).getPropertyValue("--kol-shell-rail-width"));
2264
- return Number.isFinite(t) ? t <= 49 : null;
2265
- }, r = () => e.getAttribute("data-rail") === "collapsed", i = () => [...document.querySelectorAll(".kol-rail-grab")].sort((e, t) => e.getBoundingClientRect().left - t.getBoundingClientRect().left)[0], a = () => {
2266
- let e = i();
2267
- if (!e) return;
2268
- let t = e.getBoundingClientRect(), n = {
2269
- bubbles: !0,
2270
- cancelable: !0,
2271
- pointerId: 1,
2272
- clientX: t.left + t.width / 2,
2273
- clientY: t.top + t.height / 2
2274
- };
2275
- e.dispatchEvent(new PointerEvent("pointerdown", n)), e.dispatchEvent(new PointerEvent("pointerup", n));
2276
- }, o = () => {
2277
- if (t) return;
2278
- let i = n();
2279
- i === null || i === r() || (t = !0, i ? e.setAttribute("data-rail", "collapsed") : e.removeAttribute("data-rail"), t = !1);
2280
- }, s = () => {
2281
- if (t) return;
2282
- let e = n();
2283
- e === null || e === r() || (t = !0, a(), t = !1);
2284
- };
2285
- o();
2286
- let c = new MutationObserver(o);
2287
- c.observe(e, {
2288
- attributes: !0,
2289
- attributeFilter: ["style"]
2290
- });
2291
- let l = new MutationObserver(s);
2292
- return l.observe(e, {
2293
- attributes: !0,
2294
- attributeFilter: ["data-rail"]
2295
- }), () => {
2296
- c.disconnect(), l.disconnect();
2297
- };
2298
- }, []), /* @__PURE__ */ $("div", {
2299
- ref: e,
2300
- className: "kol-compose-rail kol-compose-rail--inspector",
2301
- children: [/* @__PURE__ */ Q("div", { ...t }), /* @__PURE__ */ Q("div", {
2302
- className: "kol-compose-inspector-body",
2303
- children: /* @__PURE__ */ Q(ii, {})
2304
- })]
2305
- });
2306
- }
2307
- var Ei = Jn(null);
2308
- function Di() {
2309
- let { tall: e, setTall: t, collapseParams: n, setSheetPx: r } = Yn(Ei);
2310
- return /* @__PURE__ */ Q(hi, {
2311
- tall: e,
2312
- onToggle: () => {
2313
- r(null), t((e) => !e);
2314
- },
2315
- onResize: (e) => r(Math.max(96, Math.min(window.innerHeight * .92, e))),
2316
- onResizeEnd: (e) => {
2317
- e < 96 && (r(null), n());
2318
- }
2319
- });
2320
- }
2321
- var Oi = [
2322
- 2,
2323
- 4,
2324
- 8,
2325
- 12,
2326
- 16
2327
- ];
2328
- function ki({ paramsOpen: e, setParamsOpen: t, catalog: n, toggleCatalog: r, railHeight: i }) {
2329
- let { playing: a, loopSeconds: o, play: s, pause: c, stop: l, rewind: u, setLoopSeconds: f } = d(), [p, m] = Z(!0), h = [
2330
- {
2331
- icon: "home-01",
2332
- path: "#home",
2333
- label: "Home",
2334
- onPress: () => jn("/")
2335
- },
2336
- {
2337
- icon: "grid",
2338
- path: "#catalog",
2339
- label: "Catalog",
2340
- onPress: r,
2341
- selected: n
2342
- },
2343
- {
2344
- icon: "slider-01",
2345
- path: "#params",
2346
- label: "Params",
2347
- onPress: () => t((e) => !e),
2348
- selected: e
2349
- },
2350
- {
2351
- icon: "play-solid",
2352
- path: "#transport",
2353
- label: "Transport",
2354
- onPress: () => m((e) => !e),
2355
- selected: p
2356
- }
2357
- ], g = [{
2358
- icon: "download",
2359
- label: "Output",
2360
- onPress: () => {
2361
- t(!0), Et("Output");
2362
- }
2363
- }, {
2364
- icon: "file",
2365
- label: "File",
2366
- onPress: () => {
2367
- t(!0), Et("File");
2368
- }
2369
- }], _ = p ? {
2370
- items: [
2371
- {
2372
- id: "play",
2373
- icon: "play",
2374
- label: "Play",
2375
- onPress: s,
2376
- selected: a
2377
- },
2378
- {
2379
- id: "pause",
2380
- icon: "pause",
2381
- label: "Pause",
2382
- onPress: c,
2383
- selected: !a
2384
- },
2385
- {
2386
- id: "loop",
2387
- icon: "stopwatch-solid",
2388
- label: "Loop length"
2389
- },
2390
- {
2391
- id: "stop",
2392
- icon: "stop",
2393
- label: "Stop",
2394
- onPress: l
2395
- },
2396
- {
2397
- id: "rewind",
2398
- icon: "rewind",
2399
- label: "Rewind",
2400
- onPress: u
2401
- }
2402
- ],
2403
- sheetFor: { loop: Oi.map((e) => ({
2404
- label: `${e} s`,
2405
- checked: o === e,
2406
- onPress: () => f(e)
2407
- })) }
2408
- } : void 0;
2409
- return Y(() => {
2410
- cr({
2411
- items: h,
2412
- actions: g,
2413
- transport: _,
2414
- railOpen: e,
2415
- railHeight: i
2416
- });
2417
- }, [
2418
- e,
2419
- n,
2420
- p,
2421
- a,
2422
- o,
2423
- i
2424
- ]), Y(() => () => cr(null), []), null;
2425
- }
2426
- function Ai() {
2427
- return /* @__PURE__ */ Q("div", {
2428
- className: "kol-compose-rail kol-compose-rail--inspector",
2429
- children: /* @__PURE__ */ Q("div", {
2430
- className: "kol-compose-inspector-body",
2431
- children: /* @__PURE__ */ Q(ii, {})
2432
- })
2433
- });
2434
- }
2435
- var ji = {
2436
- topbar: () => null,
2437
- canvas: wi,
2438
- panels: [
2439
- {
2440
- slot: "canvas.footer",
2441
- order: 0,
2442
- Component: xt
2443
- },
2444
- {
2445
- slot: "right.body",
2446
- order: 0,
2447
- Component: Ti
2448
- },
2449
- {
2450
- slot: "right.footer",
2451
- order: 0,
2452
- Component: sn
2453
- }
2454
- ]
2455
- }, Mi = {
2456
- ...ji,
2457
- panels: [{
2458
- slot: "right.header",
2459
- order: 0,
2460
- Component: Di
2461
- }, ...ji.panels.map((e) => e.Component === Ti ? {
2462
- ...e,
2463
- Component: Ai
2464
- } : e)]
2465
- };
2466
- function Ni() {
2467
- let { setAspect: e } = o(), t = X(!1);
2468
- Y(() => {
2469
- if (t.current) return;
2470
- t.current = !0;
2471
- let r = p();
2472
- r.defaultAspect && r.defaultAspect !== "custom" && e(r.defaultAspect), r.defaultLoopSeconds && n.setLoopSeconds(r.defaultLoopSeconds);
2473
- }, []);
2474
- let { clearHistory: r } = o();
2475
- Y(() => {
2476
- let e = setTimeout(r, 800);
2477
- return () => clearTimeout(e);
2478
- }, [r]);
2479
- }
2480
- function Pi() {
2481
- let { selectedId: e, select: t } = o(), { layer: r, setOnly: i } = _e(), a = kn(qt), c = zt() && !Tn() || a;
2482
- Y(() => {
2483
- c && document.documentElement.removeAttribute("data-rail");
2484
- }, [c]);
2485
- let [l, u] = Z(!0), [d, h] = Z(!1), [g, _] = Z(null), v = g ? `${g}px` : d ? pi.tall : pi.half, y = { "--kol-sheet-h": v }, b = lr(), x = ct(), [S, C] = Z(() => !r);
2486
- Y(() => {
2487
- C(!r);
2488
- }, [r?.id]);
2489
- let [w, T] = Z(null), E = r?.type === "photo" && (!!r.src || r.srcType === "webcam");
2490
- Y(() => {
2491
- w && E && C(!0);
2492
- }, [w, E]), Y(() => {
2493
- r || T(null);
2494
- }, [r]), Y(() => {
2495
- if (!r || c) return;
2496
- let e = 0, t = 0;
2497
- return e = requestAnimationFrame(() => {
2498
- t = requestAnimationFrame(() => document.documentElement.removeAttribute("data-rail"));
2499
- }), () => {
2500
- cancelAnimationFrame(e), cancelAnimationFrame(t);
2501
- };
2502
- }, [r?.id]), Y(() => {
2503
- if (!x.active || c) return;
2504
- let e = 0, t = 0;
2505
- return e = requestAnimationFrame(() => {
2506
- t = requestAnimationFrame(() => document.documentElement.removeAttribute("data-rail"));
2507
- }), () => {
2508
- cancelAnimationFrame(e), cancelAnimationFrame(t);
2509
- };
2510
- }, [x.active, c]), Y(() => At((e) => i("photo", {
2511
- src: e.url,
2512
- srcType: e.srcType
2513
- })), [i]), Y(() => {
2514
- if (!c) return;
2515
- let e = () => u(!0);
2516
- return window.addEventListener("kol:open-params", e), window.addEventListener("kol:open-effects", e), () => {
2517
- window.removeEventListener("kol:open-params", e), window.removeEventListener("kol:open-effects", e);
2518
- };
2519
- }, [c]), Bt(), Y(() => (on("labs"), () => on(null)), []), Ni();
2520
- let D = X(!1);
2521
- Y(() => {
2522
- if (D.current) return;
2523
- D.current = !0;
2524
- let e = Ut();
2525
- if (e.open || e.fresh) return;
2526
- let t = new URLSearchParams(window.location.search).get("preset"), n = t ? fe(t) : null;
2527
- n && i("loop", pe(z(t), n));
2528
- }, [i]);
2529
- let { tool: O, setTool: k } = Mt(), A = X(O);
2530
- A.current = O;
2531
- let { updateLayer: j, undo: M, redo: ee } = o(), N = X({
2532
- undo: M,
2533
- redo: ee
2534
- });
2535
- N.current = {
2536
- undo: M,
2537
- redo: ee
2538
- };
2539
- let te = !!s().grab;
2540
- Y(() => {
2541
- k(te ? "orbit" : "select");
2542
- }, [te, k]);
2543
- let P = X(r);
2544
- P.current = r;
2545
- let F = X(j);
2546
- return F.current = j, Y(() => {
2547
- let e = (e) => {
2548
- if (wt(e)) return;
2549
- if ((e.metaKey || e.ctrlKey) && (e.key === "z" || e.key === "Z")) {
2550
- e.preventDefault(), e.shiftKey ? N.current.redo() : N.current.undo();
2551
- return;
2552
- }
2553
- if (e.code === "Space") {
2554
- e.preventDefault(), n.toggle();
2555
- return;
2556
- }
2557
- if ((e.key === "s" || e.key === "S") && !e.metaKey && !e.ctrlKey && !e.altKey) {
2558
- window.dispatchEvent(new CustomEvent("kol:show-shortcuts"));
2559
- return;
2560
- }
2561
- if ((e.key === "c" || e.key === "C") && !e.metaKey && !e.ctrlKey && !e.altKey) {
2562
- m("grab", !p().grab);
2563
- return;
2564
- }
2565
- if ((e.key === "z" || e.key === "Z") && !e.metaKey && !e.ctrlKey && !e.altKey) {
2566
- m("zoomLock", !p().zoomLock);
2567
- return;
2568
- }
2569
- let t = !e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey && Ee[e.key.length === 1 ? e.key.toLowerCase() : e.key];
2570
- if (t && P.current) {
2571
- let n = ke(P.current, t[1], t[0]);
2572
- n && (e.preventDefault(), F.current(P.current.id, n));
2573
- }
2574
- };
2575
- return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
2576
- }, [k]), Y(() => {
2577
- if (!r?.presetId) return;
2578
- let e = new URLSearchParams(window.location.search);
2579
- e.get("preset") !== r.presetId && (e.delete("view"), e.set("preset", r.presetId), r.loopGroup ? e.set("cat", r.loopGroup) : e.delete("cat"), window.history.replaceState(null, "", `${window.location.pathname}?${e}`));
2580
- }, [r?.presetId, r?.loopGroup]), Y(() => {
2581
- r && e !== r.id && t(r.id);
2582
- }, [
2583
- r,
2584
- e,
2585
- t
2586
- ]), /* @__PURE__ */ $("div", {
2587
- className: "kol-editor-labs contents",
2588
- "data-touch": c || void 0,
2589
- "data-params": l ? "open" : void 0,
2590
- "data-empty": r || x.active ? void 0 : "",
2591
- style: y,
2592
- children: [
2593
- /* @__PURE__ */ Q(Dr, {}),
2594
- c ? /* @__PURE__ */ $(Ei.Provider, {
2595
- value: {
2596
- collapseParams: () => u(!1),
2597
- tall: d,
2598
- setTall: h,
2599
- setSheetPx: _,
2600
- catalog: S,
2601
- toggleCatalog: () => C((e) => !e)
2602
- },
2603
- children: [/* @__PURE__ */ Q(f.Provider, {
2604
- value: "md",
2605
- children: /* @__PURE__ */ Q(Dt, {
2606
- registry: Mi,
2607
- rightIn: (e) => b ? ir(/* @__PURE__ */ Q("div", {
2608
- className: "kol-editor-labs flex flex-col h-full",
2609
- "data-touch": "",
2610
- "data-params": "open",
2611
- style: y,
2612
- children: e
2613
- }), b) : null
2614
- })
2615
- }), /* @__PURE__ */ Q(ki, {
2616
- paramsOpen: l,
2617
- setParamsOpen: u,
2618
- catalog: S,
2619
- toggleCatalog: () => C((e) => !e),
2620
- railHeight: v
2621
- })]
2622
- }) : /* @__PURE__ */ Q(Dt, { registry: ji }),
2623
- S && !x.picker && !(x.active && !r) && /* @__PURE__ */ Q(_i, {
2624
- initialOpen: w,
2625
- hasMedia: E,
2626
- onNeedMedia: (e) => {
2627
- T(e), i("photo", {
2628
- filters: [],
2629
- fxGroup: null
2630
- });
2631
- },
2632
- onPicked: () => {
2633
- T(null), C(!1);
2634
- },
2635
- onClose: () => {
2636
- T(null), C(!1);
2637
- }
2638
- })
2639
- ]
2640
- });
2641
- }
2642
- var Fi = "kol.editor.labs-draft";
2643
- function Ii() {
2644
- let e = /\/morph\/?$/.test(typeof window > "u" ? "" : window.location.pathname);
2645
- return Y(() => (q(e ? { active: !0 } : {
2646
- active: !1,
2647
- editing: null
2648
- }), () => q({
2649
- active: !1,
2650
- editing: null
2651
- })), [e]), /* @__PURE__ */ $(hn, {
2652
- draftKey: Fi,
2653
- children: [
2654
- /* @__PURE__ */ Q(Pi, {}),
2655
- /* @__PURE__ */ Q(dn, {}),
2656
- /* @__PURE__ */ Q(we, {})
2657
- ]
2658
- });
2659
- }
2660
- //#endregion
2661
- //#region src/editor/mobile/EffectScreen.jsx
2662
- function Li({ layer: e, chain: t, onPick: n, onBack: r }) {
2663
- let [i, a] = Z(null);
2664
- ai(r);
2665
- let { engineHost: o } = G(e), s = o && !t.some((e) => e.def?.kind === "engine"), c = re(W.filter((e) => e.kind !== "engine" || s)), l = c.find((e) => e.id === i) ?? null;
2666
- return /* @__PURE__ */ Q("div", {
2667
- className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] kol-overlay-scrim flex flex-col items-center overflow-y-auto p-6",
2668
- style: { zIndex: "var(--kol-z-modal)" },
2669
- children: /* @__PURE__ */ $("div", {
2670
- className: "my-auto w-full max-w-sm rounded p-8 flex flex-col gap-6",
2671
- style: { background: "var(--kol-surface-primary)" },
2672
- children: [
2673
- /* @__PURE__ */ Q("div", {
2674
- className: "kol-eyebrow text-body",
2675
- children: l ? l.label : "Pick an effect"
2676
- }),
2677
- /* @__PURE__ */ Q("div", {
2678
- className: "flex flex-col gap-2",
2679
- children: (l ? l.filters : c).map((e) => /* @__PURE__ */ Q(J, {
2680
- tone: "primary",
2681
- size: "lg",
2682
- className: Kt,
2683
- iconLeft: l ? "filter" : "chevron-right",
2684
- iconRight: l ? "filter" : "chevron-right",
2685
- onClick: () => l ? n(e.id) : a(e.id),
2686
- children: e.label
2687
- }, e.id))
2688
- }),
2689
- /* @__PURE__ */ Q(J, {
2690
- tone: "grey",
2691
- size: "lg",
2692
- className: Kt,
2693
- iconLeft: "arrow-left",
2694
- iconRight: "arrow-left",
2695
- onClick: () => l ? a(null) : r(),
2696
- children: "Back"
2697
- })
2698
- ]
2699
- })
2700
- });
2701
- }
2702
- //#endregion
2703
- //#region src/editor/mobile/MobileOverlay.jsx
2704
- var Ri = { background: "var(--kol-surface-primary)" }, zi = [
2705
- {
2706
- value: "generate",
2707
- label: "Generate"
2708
- },
2709
- {
2710
- value: "effects",
2711
- label: "Effects"
2712
- },
2713
- {
2714
- value: "transport",
2715
- label: "Transport"
2716
- },
2717
- {
2718
- value: "output",
2719
- label: "Output"
2720
- }
2721
- ], Bi = zi.filter((e) => e.value !== "generate"), Vi = "[&_.kol-seg-cell]:min-w-0 [&_.kol-seg-cell]:px-1 [&_.kol-seg-cell]:overflow-hidden [@media(hover:none)]:[&_.kol-seg-cell:hover]:text-[var(--kol-oq-48)]", Hi = {
2722
- lg: 9.6,
2723
- sm: 7.2
2724
- }, Ui = 10, Wi = 232;
2725
- function Gi(e, t) {
2726
- let n = t === "sm" ? Wi : Math.min(window.innerWidth, 480) - 24, r = [], i = [], a = 0;
2727
- for (let o of e) {
2728
- let e = o.label.length * Hi[t] + Ui, s = Math.max(a, e);
2729
- i.length && (i.length + 1) * s > n ? (r.push(i), i = [o], a = e) : (i.push(o), a = s);
2730
- }
2731
- return i.length && r.push(i), r;
2732
- }
2733
- function Ki({ cells: e, size: t }) {
2734
- return Gi(e, t).map((e, n) => /* @__PURE__ */ Q(Ln, {
2735
- layout: "joined",
2736
- value: null,
2737
- onChange: (t) => e.find((e) => e.value === t)?.run(),
2738
- options: e,
2739
- size: t,
2740
- ariaLabel: "Randomize scope",
2741
- className: Vi
2742
- }, n));
2743
- }
2744
- var qi = [
2745
- 2,
2746
- 4,
2747
- 8,
2748
- 16
2749
- ].map((e) => ({
2750
- value: String(e),
2751
- label: `${e}s`
2752
- }));
2753
- function Ji({ size: e }) {
2754
- let { loopSeconds: t, setLoopSeconds: n } = d();
2755
- return /* @__PURE__ */ Q(Ln, {
2756
- layout: "joined",
2757
- value: String(t),
2758
- onChange: (e) => n(Number(e)),
2759
- options: qi,
2760
- size: e,
2761
- ariaLabel: "Loop length"
2762
- });
2763
- }
2764
- var Yi = [
2765
- {
2766
- value: "9:16",
2767
- label: "9:16"
2768
- },
2769
- {
2770
- value: "3:5",
2771
- label: "3:5"
2772
- },
2773
- {
2774
- value: "4:5",
2775
- label: "4:5"
2776
- },
2777
- {
2778
- value: "1:1",
2779
- label: "1:1"
2780
- }
2781
- ], Xi = [
2782
- {
2783
- value: "5:4",
2784
- label: "5:4"
2785
- },
2786
- {
2787
- value: "5:3",
2788
- label: "5:3"
2789
- },
2790
- {
2791
- value: "16:9",
2792
- label: "16:9"
2793
- },
2794
- {
2795
- value: "fill",
2796
- label: "Fill"
2797
- }
2798
- ];
2799
- function Zi({ layer: e, onSwitchCategory: t, onInsert: r, onRestart: i, aspectValue: a, onAspect: s, openEffects: c = !1, rail: l = !1, onRail: u, onSheet: d }) {
2800
- let f = ct(), { updateLayer: p, addFilter: m, removeFilter: g } = o(), { onExportPng: v } = Gt(), [b, S] = Z(!1), [C, w] = Z(!0), [E, D] = Z(!1), [O, k] = Z(!1), [j, ee] = Z("generate"), [te, P] = Z(!1), [F, I] = Z(!1), { aspect: L } = o(), [R, ne] = Z(null), z = _(e);
2801
- Y(() => {
2802
- c && (w(!0), k(!0));
2803
- }, [c]);
2804
- let B = l ? "sm" : "lg", re = l && !!e && C && !b;
2805
- Y(() => (u?.(re), () => u?.(!1)), [re]);
2806
- let U = !l && e && C && !b ? R ? `${R}px` : te ? pi.tall : pi.half : null;
2807
- Y(() => (d?.(U), () => d?.(null)), [U]);
2808
- let ie = () => {
2809
- let t = e?.type === "loop" && V(e.loopGroup).find((t) => t.id === e.presetId);
2810
- t && p(e.id, pe(t, e.loopGroup));
2811
- };
2812
- if (Ur(ie, () => {
2813
- e?.type === "loop" && p(e.id, h(e, A(K(e.loopId)?.params ?? [], e), z.take(), { withFilters: !0 }));
2814
- }), !e) return null;
2815
- if (b) return /* @__PURE__ */ Q("button", {
2816
- "aria-label": "Show controls",
2817
- className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] z-20",
2818
- onClick: () => S(!1)
2819
- });
2820
- let W = e.type === "loop", ae = W ? `${H(e.loopGroup).label} · ${e.presetLabel}` : "Media", oe = W ? K(e.loopId)?.params ?? [] : [], se = W ? M(oe, e) : [], ce = () => p(e.id, h(e, A(oe, e), z.take(), { withFilters: !0 })), le = (t) => p(e.id, h(e, t.params, z.take(), { stripNoRandom: !!t.motion })), ue = () => {
2821
- let t = T(e, z.take());
2822
- t && p(e.id, t);
2823
- }, de = x(e), { effectable: fe } = G(e), me = () => {
2824
- let t = N(e, z.take());
2825
- t && p(e.id, { filters: t });
2826
- };
2827
- if (!C) return /* @__PURE__ */ $(fi, {
2828
- label: W ? e.presetLabel : "Media",
2829
- onOpen: () => w(!0),
2830
- size: B,
2831
- children: [
2832
- (W || de.length > 0) && /* @__PURE__ */ Q(Wn, {
2833
- label: "Randomize all",
2834
- children: /* @__PURE__ */ Q(J, {
2835
- tone: "primary",
2836
- size: B,
2837
- iconOnly: "bolt",
2838
- "aria-label": "Randomize all",
2839
- onClick: ce,
2840
- className: "shrink-0"
2841
- })
2842
- }),
2843
- /* @__PURE__ */ Q(Wn, {
2844
- label: "Download",
2845
- children: /* @__PURE__ */ Q(J, {
2846
- tone: "primary",
2847
- size: B,
2848
- iconOnly: "download",
2849
- "aria-label": "Download",
2850
- onClick: () => v(2),
2851
- className: "shrink-0"
2852
- })
2853
- }),
2854
- /* @__PURE__ */ Q(Wn, {
2855
- label: "Hide UI",
2856
- children: /* @__PURE__ */ Q(J, {
2857
- tone: "primary",
2858
- size: B,
2859
- iconOnly: "eye-off",
2860
- "aria-label": "Hide UI",
2861
- onClick: () => S(!0),
2862
- className: "shrink-0"
2863
- })
2864
- }),
2865
- /* @__PURE__ */ Q(Wn, {
2866
- label: a === "fill" ? "Back to the frame" : "Fill the screen",
2867
- children: /* @__PURE__ */ Q(J, {
2868
- tone: "primary",
2869
- size: B,
2870
- iconOnly: "maximize",
2871
- "aria-label": a === "fill" ? "Back to the frame" : "Fill the screen",
2872
- "aria-pressed": a === "fill",
2873
- onClick: () => s(a === "fill" ? L : "fill"),
2874
- className: "shrink-0"
2875
- })
2876
- })
2877
- ]
2878
- });
2879
- let he = [...W ? zi : Bi, ...W && f.steps.length >= 2 ? [{
2880
- value: "morph",
2881
- label: "Morph"
2882
- }] : []].filter((e) => (e.value !== "effects" || fe) && (e.value !== "transport" || y("motion"))), ge = he.some((e) => e.value === j) ? j : he[0].value;
2883
- return /* @__PURE__ */ $(Zn, { children: [
2884
- /* @__PURE__ */ Q(ye, {
2885
- open: F,
2886
- onClose: () => I(!1),
2887
- schema: oe,
2888
- layer: e,
2889
- size: B
2890
- }),
2891
- E && /* @__PURE__ */ Q(oi, {
2892
- onPick: (e) => {
2893
- t(e), D(!1);
2894
- },
2895
- onInsert: () => {
2896
- D(!1), r();
2897
- },
2898
- onBack: () => {
2899
- D(!1), i();
2900
- },
2901
- onDismiss: () => D(!1)
2902
- }),
2903
- O && /* @__PURE__ */ Q(Li, {
2904
- layer: e,
2905
- chain: de,
2906
- onPick: (t) => {
2907
- m(e.id, t), k(!1);
2908
- },
2909
- onBack: () => k(!1)
2910
- }),
2911
- /* @__PURE__ */ $("div", {
2912
- className: l ? "fixed top-0 right-0 bottom-0 z-10 flex w-[var(--kol-sidenav-w,320px)] flex-col overflow-y-auto border-l border-oq-08" : "fixed right-0 left-[var(--fxr-rail,0px)] bottom-0 z-10 flex flex-col pb-[env(safe-area-inset-bottom)]",
2913
- style: l ? Ri : {
2914
- ...Ri,
2915
- top: `calc(100dvh - ${U ?? pi.half})`
2916
- },
2917
- children: [
2918
- !l && /* @__PURE__ */ Q(hi, {
2919
- tall: te,
2920
- onToggle: () => {
2921
- ne(null), P((e) => !e);
2922
- },
2923
- onResize: (e) => ne(Math.max(96, Math.min(window.innerHeight * .92, e))),
2924
- onResizeEnd: (e) => {
2925
- e < 96 && (ne(null), w(!1));
2926
- }
2927
- }),
2928
- /* @__PURE__ */ Q(di, {
2929
- title: ae,
2930
- onCollapse: () => w(!1),
2931
- className: l ? "px-4 pt-2.5 pb-1.5" : "px-3",
2932
- action: /* @__PURE__ */ Q(J, {
2933
- tone: "ghost",
2934
- quiet: !0,
2935
- size: "sm",
2936
- onClick: i,
2937
- children: "Start over"
2938
- })
2939
- }),
2940
- /* @__PURE__ */ $("div", {
2941
- className: l ? "px-4 pb-5" : "min-h-0 flex-1 overflow-y-auto px-3 pb-3",
2942
- children: [
2943
- /* @__PURE__ */ Q(Ln, {
2944
- layout: "joined",
2945
- value: ge,
2946
- onChange: ee,
2947
- options: he,
2948
- size: B,
2949
- className: l ? Vi : "[&_.kol-seg-cell]:min-w-0 [&_.kol-seg-cell]:px-2 [&_.kol-seg-cell]:overflow-hidden"
2950
- }),
2951
- ge === "morph" && W && /* @__PURE__ */ Q(Ar, {
2952
- layer: e,
2953
- readOnly: !0
2954
- }),
2955
- ge === "generate" && W && /* @__PURE__ */ $("div", {
2956
- className: "flex flex-col gap-2 pt-3",
2957
- children: [
2958
- /* @__PURE__ */ $("div", {
2959
- className: "grid grid-cols-2 gap-2",
2960
- children: [/* @__PURE__ */ Q(J, {
2961
- tone: "primary",
2962
- size: B,
2963
- iconRight: "refresh",
2964
- onClick: ue,
2965
- children: "Preset"
2966
- }), /* @__PURE__ */ Q(J, {
2967
- tone: "primary",
2968
- size: B,
2969
- onClick: () => D(!0),
2970
- children: "Generator"
2971
- })]
2972
- }),
2973
- /* @__PURE__ */ $("div", {
2974
- className: "flex gap-2",
2975
- children: [
2976
- /* @__PURE__ */ Q(J, {
2977
- tone: "primary",
2978
- size: B,
2979
- className: "flex-1 min-w-0",
2980
- onClick: ce,
2981
- children: "Randomize all"
2982
- }),
2983
- /* @__PURE__ */ Q(Wn, {
2984
- label: "What Randomize all rolls",
2985
- children: /* @__PURE__ */ Q(J, {
2986
- tone: "primary",
2987
- size: B,
2988
- iconOnly: "nav-settings",
2989
- "aria-label": "What Randomize all rolls",
2990
- onClick: () => I(!0),
2991
- className: "shrink-0"
2992
- })
2993
- }),
2994
- /* @__PURE__ */ Q(Wn, {
2995
- label: "Reset to defaults",
2996
- shortcut: "R",
2997
- children: /* @__PURE__ */ Q(J, {
2998
- tone: "primary",
2999
- size: B,
3000
- iconOnly: "refresh",
3001
- "aria-label": "Reset to defaults",
3002
- onClick: ie,
3003
- className: "shrink-0"
3004
- })
3005
- })
3006
- ]
3007
- }),
3008
- se.length > 0 && /* @__PURE__ */ Q(Ki, {
3009
- size: B,
3010
- cells: [...se.map((e) => ({
3011
- value: e.id,
3012
- label: e.label,
3013
- run: () => le(e)
3014
- })), {
3015
- value: "__retrigger",
3016
- label: "Re-trigger",
3017
- run: () => n.rewind()
3018
- }]
3019
- })
3020
- ]
3021
- }),
3022
- ge === "effects" && /* @__PURE__ */ $("div", {
3023
- className: "flex flex-col gap-2 pt-3",
3024
- children: [/* @__PURE__ */ $("div", {
3025
- className: "grid grid-cols-2 gap-2",
3026
- children: [
3027
- /* @__PURE__ */ Q(J, {
3028
- tone: "primary",
3029
- size: B,
3030
- onClick: () => k(!0),
3031
- children: "Add effect"
3032
- }),
3033
- de.length > 0 && /* @__PURE__ */ Q(J, {
3034
- tone: "primary",
3035
- size: B,
3036
- onClick: me,
3037
- children: "Randomize"
3038
- }),
3039
- " "
3040
- ]
3041
- }), de.map((t, n) => {
3042
- let r = {
3043
- ...e,
3044
- ...t.params,
3045
- id: e.id
3046
- }, i = t.def ? M(t.def.params, r) : [], a = (t) => {
3047
- let i = h(r, t.params, z.take(), { stripNoRandom: !!t.motion }), a = de.map(({ def: e, ...t }) => t);
3048
- p(e.id, { filters: a.map((e, t) => t === n ? {
3049
- ...e,
3050
- params: {
3051
- ...e.params,
3052
- ...i
3053
- }
3054
- } : e) });
3055
- };
3056
- return /* @__PURE__ */ $("div", {
3057
- className: "flex flex-col gap-2",
3058
- children: [/* @__PURE__ */ Q(J, {
3059
- tone: "grey",
3060
- size: B,
3061
- className: "w-full [&>span]:w-full [&>span]:justify-between",
3062
- iconLeft: "trash",
3063
- iconRight: "trash",
3064
- onClick: () => g(e.id, n),
3065
- children: `${n + 1}. ${t.def?.label ?? t.id}`
3066
- }), i.length > 0 && /* @__PURE__ */ Q(Ki, {
3067
- size: B,
3068
- cells: i.map((e) => ({
3069
- value: e.id,
3070
- label: e.label,
3071
- run: () => a(e)
3072
- }))
3073
- })]
3074
- }, t.key);
3075
- })]
3076
- }),
3077
- ge === "transport" && y("motion") && /* @__PURE__ */ $("div", {
3078
- className: "flex flex-col gap-2 pt-3",
3079
- children: [(() => {
3080
- let e = y("motion").TransportBar;
3081
- return /* @__PURE__ */ Q(e, { size: B });
3082
- })(), /* @__PURE__ */ Q(Ji, { size: B })]
3083
- }),
3084
- ge === "output" && /* @__PURE__ */ $("div", {
3085
- className: "flex flex-col gap-2 pt-3",
3086
- children: [
3087
- /* @__PURE__ */ Q(Ln, {
3088
- layout: "joined",
3089
- value: a,
3090
- onChange: s,
3091
- options: Yi,
3092
- size: B,
3093
- ariaLabel: "Aspect"
3094
- }),
3095
- /* @__PURE__ */ Q(Ln, {
3096
- layout: "joined",
3097
- value: a,
3098
- onChange: s,
3099
- options: Xi,
3100
- size: B,
3101
- ariaLabel: "Aspect (landscape) and fill"
3102
- }),
3103
- /* @__PURE__ */ $("div", {
3104
- className: "grid grid-cols-2 gap-2",
3105
- children: [
3106
- /* @__PURE__ */ Q(J, {
3107
- tone: "primary",
3108
- size: B,
3109
- onClick: () => It({ focusName: !0 }),
3110
- children: "Save…"
3111
- }),
3112
- /* @__PURE__ */ Q(J, {
3113
- tone: "primary",
3114
- size: B,
3115
- onClick: () => v(2),
3116
- children: "Download"
3117
- }),
3118
- /* @__PURE__ */ Q(J, {
3119
- tone: "primary",
3120
- size: B,
3121
- onClick: () => S(!0),
3122
- children: "Hide UI"
3123
- }),
3124
- /* @__PURE__ */ Q(J, {
3125
- tone: "primary",
3126
- size: B,
3127
- onClick: i,
3128
- children: "Start over"
3129
- })
3130
- ]
3131
- })
3132
- ]
3133
- })
3134
- ]
3135
- })
3136
- ]
3137
- })
3138
- ] });
3139
- }
3140
- //#endregion
3141
- //#region src/editor/mobile/MobileView.jsx
3142
- function Qi({ onGenerate: e, onEffects: t, chromes: n }) {
3143
- return /* @__PURE__ */ Q("div", {
3144
- className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] kol-overlay-scrim flex flex-col items-center justify-center p-6",
3145
- style: { zIndex: "var(--kol-z-modal)" },
3146
- children: /* @__PURE__ */ $("div", {
3147
- className: "w-full max-w-sm rounded p-8 flex flex-col gap-6",
3148
- style: { background: "var(--kol-surface-primary)" },
3149
- children: [n ? /* @__PURE__ */ $("div", {
3150
- className: "flex flex-col gap-2",
3151
- children: [/* @__PURE__ */ Q("span", {
3152
- className: "kol-eyebrow text-body",
3153
- children: "Select chrome"
3154
- }), /* @__PURE__ */ Q("span", {
3155
- className: "kol-mono-16 text-emphasis",
3156
- children: "FXR"
3157
- })]
3158
- }) : /* @__PURE__ */ Q("span", {
3159
- className: "kol-eyebrow text-body",
3160
- children: mn("randomiser").label
3161
- }), /* @__PURE__ */ $("div", {
3162
- className: "flex flex-col gap-2",
3163
- children: [
3164
- /* @__PURE__ */ Q(J, {
3165
- tone: "primary",
3166
- size: "lg",
3167
- className: Kt,
3168
- iconLeft: Zt.randomiser,
3169
- iconRight: Zt.randomiser,
3170
- onClick: e,
3171
- children: "Generate"
3172
- }),
3173
- /* @__PURE__ */ Q(J, {
3174
- tone: "primary",
3175
- size: "lg",
3176
- className: Kt,
3177
- iconLeft: "filter",
3178
- iconRight: "filter",
3179
- onClick: t,
3180
- children: "Effects"
3181
- }),
3182
- n && St() && /* @__PURE__ */ Q(J, {
3183
- tone: "primary",
3184
- size: "lg",
3185
- className: "w-full [&>span]:w-full [&>span]:justify-between",
3186
- iconLeft: Zt.editor,
3187
- iconRight: Zt.editor,
3188
- onClick: Jt,
3189
- children: mn("editor").label
3190
- }),
3191
- n && /* @__PURE__ */ Q(J, {
3192
- tone: "primary",
3193
- size: "lg",
3194
- className: "w-full [&>span]:w-full [&>span]:justify-between",
3195
- iconLeft: Zt.labs,
3196
- iconRight: Zt.labs,
3197
- onClick: en,
3198
- children: mn("labs").label
3199
- }),
3200
- n && /* @__PURE__ */ Q(J, {
3201
- tone: "primary",
3202
- size: "lg",
3203
- className: "w-full [&>span]:w-full [&>span]:justify-between",
3204
- iconLeft: "swap",
3205
- iconRight: "swap",
3206
- onClick: () => jn("/morph"),
3207
- children: "Morph"
3208
- })
3209
- ]
3210
- })]
3211
- })
3212
- });
3213
- }
3214
- function $i() {
3215
- let { layers: t, addLayer: r, removeLayer: i, updateLayer: a, canvasW: s, canvasH: c, aspect: l, setAspect: u } = o(), { setTool: d } = Mt(), f = zt() && !Tn(), p = vn(), m = () => {
3216
- let e = new URLSearchParams(window.location.search);
3217
- return e.get("open") ? "live" : e.get("start") === "category" ? "category" : "entry";
3218
- }, [h, g] = Z(m), [_, v] = Z(!1), [y, b] = Z(null), [x, S] = Z("contain"), [C, w] = Z(!1), [T, E] = Z(null), [D, O] = Z({
3219
- s: 1,
3220
- x: 0,
3221
- y: 0
3222
- }), k = X(null), A = X({
3223
- pts: /* @__PURE__ */ new Map(),
3224
- start: null,
3225
- live: {
3226
- s: 1,
3227
- x: 0,
3228
- y: 0
3229
- }
3230
- }), M = X(null), ee = () => {
3231
- let [e, t] = [...A.current.pts.values()];
3232
- return {
3233
- d: Math.hypot(e.x - t.x, e.y - t.y),
3234
- mx: (e.x + t.x) / 2,
3235
- my: (e.y + t.y) / 2
3236
- };
3237
- }, N = (e) => `translate(${e.x}px, ${e.y}px) scale(${e.s})`, te = (e) => {
3238
- if (A.current.pts.set(e.pointerId, {
3239
- x: e.clientX,
3240
- y: e.clientY
3241
- }), M.current = A.current.pts.size === 1 ? {
3242
- id: e.pointerId,
3243
- x: e.clientX,
3244
- y: e.clientY,
3245
- t: performance.now()
3246
- } : null, A.current.pts.size === 2) {
3247
- let t = k.current?.getBoundingClientRect(), r = ee(), i = (t?.left ?? 0) - D.x, a = (t?.top ?? 0) - D.y;
3248
- A.current.start = {
3249
- ...r,
3250
- ox: i,
3251
- oy: a,
3252
- v: D,
3253
- px: (r.mx - i - D.x) / D.s,
3254
- py: (r.my - a - D.y) / D.s
3255
- }, A.current.live = D, n.setStagePointer(null), e.stopPropagation();
3256
- }
3257
- }, P = (e) => {
3258
- let t = A.current;
3259
- if (t.pts.has(e.pointerId) && (t.pts.set(e.pointerId, {
3260
- x: e.clientX,
3261
- y: e.clientY
3262
- }), t.pts.size >= 2 && t.start)) {
3263
- e.stopPropagation();
3264
- let n = ee(), r = t.start, i = Math.min(4, Math.max(.5, r.v.s * (n.d / r.d)));
3265
- t.live = {
3266
- s: i,
3267
- x: n.mx - r.ox - i * r.px,
3268
- y: n.my - r.oy - i * r.py
3269
- }, k.current && (k.current.style.transform = N(t.live));
3270
- }
3271
- }, F = (e) => {
3272
- let t = M.current;
3273
- t && t.id === e.pointerId && e.type === "pointerup" && h === "live" && performance.now() - t.t < 350 && Math.hypot(e.clientX - t.x, e.clientY - t.y) < 12 && (I?.type === "loop" ? K(I.loopId) : null)?.group !== "penrose" && n.toggle(), t?.id === e.pointerId && (M.current = null), A.current.pts.delete(e.pointerId), A.current.pts.size < 2 && A.current.start && (A.current.start = null, O(A.current.live));
3274
- };
3275
- rr(), Y(() => (on("randomiser"), () => on(null)), []), Y(() => {
3276
- u("4:5"), d("orbit");
3277
- }, []);
3278
- let I = t.find((e) => e.id === y) ?? (t.length === 1 ? t[0] : null), L = h === "live" && I?.type === "photo" && !I.src && I.srcType !== "webcam";
3279
- Y(() => {
3280
- if (!L) return;
3281
- let e = (e) => {
3282
- e.key === "Escape" && V();
3283
- };
3284
- return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
3285
- }), Y(() => {
3286
- if (!L) return;
3287
- let e = n.isPlaying();
3288
- return n.pause(), () => {
3289
- e && n.play();
3290
- };
3291
- }, [L]);
3292
- let R = (e) => {
3293
- let t = ae(e);
3294
- t && (b(r("loop", t)), g("live"));
3295
- }, ne = (e) => {
3296
- let t = ae(e);
3297
- t && y && a(y, t);
3298
- }, z = () => {
3299
- b(r("photo", {
3300
- fit: "cover",
3301
- x: 0,
3302
- y: 0,
3303
- w: e,
3304
- h: Math.round(e * c / s)
3305
- })), g("live");
3306
- };
3307
- Y(() => {
3308
- let e = new URL(window.location.href), t = e.searchParams.get("start");
3309
- t && (t === "effects" && (v(!0), z()), e.searchParams.delete("start"), window.history.replaceState(window.history.state, "", e));
3310
- }, []);
3311
- let B = (t) => {
3312
- if (t === "fill") {
3313
- S("cover");
3314
- return;
3315
- }
3316
- S("contain"), u(t);
3317
- let n = j[t];
3318
- y && n && a(y, {
3319
- x: 0,
3320
- y: 0,
3321
- w: e,
3322
- h: Math.round(e * n.h / n.w)
3323
- });
3324
- }, V = () => {
3325
- for (let e of [...t]) i(e.id);
3326
- b(null), O({
3327
- s: 1,
3328
- x: 0,
3329
- y: 0
3330
- }), v(!1), g(m());
3331
- };
3332
- return /* @__PURE__ */ $("div", {
3333
- className: "kol-editor-randomiser relative h-dvh bg-black",
3334
- children: [
3335
- /* @__PURE__ */ Q("div", {
3336
- ref: k,
3337
- className: "absolute inset-y-0 left-0 touch-none overflow-hidden",
3338
- style: {
3339
- transform: N(D),
3340
- transformOrigin: "0 0",
3341
- right: C ? "var(--kol-sidenav-w, 320px)" : 0,
3342
- bottom: T ?? 0
3343
- },
3344
- onPointerDownCapture: te,
3345
- onPointerMoveCapture: P,
3346
- onPointerUpCapture: F,
3347
- onPointerCancelCapture: F,
3348
- onPointerLeave: F,
3349
- children: /* @__PURE__ */ Q(an, { fit: x })
3350
- }),
3351
- h === "entry" && /* @__PURE__ */ Q(Qi, {
3352
- chromes: f,
3353
- onGenerate: () => g("category"),
3354
- onEffects: () => {
3355
- v(!0), z();
3356
- }
3357
- }),
3358
- h === "category" && /* @__PURE__ */ Q(oi, {
3359
- onPick: R,
3360
- onInsert: z,
3361
- onBack: () => g("entry")
3362
- }),
3363
- h === "live" && !L && /* @__PURE__ */ Q(Zi, {
3364
- layer: I,
3365
- onSwitchCategory: ne,
3366
- onInsert: () => {
3367
- V(), z();
3368
- },
3369
- onRestart: V,
3370
- aspectValue: x === "cover" ? "fill" : l,
3371
- openEffects: _ && !L,
3372
- onAspect: B,
3373
- rail: !f && !p,
3374
- onRail: w,
3375
- onSheet: E
3376
- }),
3377
- L && /* @__PURE__ */ $("div", {
3378
- className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] kol-overlay-scrim flex flex-col",
3379
- style: { zIndex: "var(--kol-z-modal)" },
3380
- children: [/* @__PURE__ */ Q("div", {
3381
- className: "flex-1 min-h-0",
3382
- children: /* @__PURE__ */ Q(li, { layer: I })
3383
- }), /* @__PURE__ */ Q("div", {
3384
- className: "flex justify-center pb-[max(0.75rem,env(safe-area-inset-bottom))]",
3385
- children: /* @__PURE__ */ Q(J, {
3386
- tone: "outline",
3387
- size: "lg",
3388
- onClick: V,
3389
- children: "Back"
3390
- })
3391
- })]
3392
- })
3393
- ]
3394
- });
3395
- }
3396
- function ea() {
3397
- return /* @__PURE__ */ $(hn, {
3398
- persistDraft: !1,
3399
- children: [/* @__PURE__ */ Q($i, {}), /* @__PURE__ */ Q(dn, {})]
3400
- });
3401
- }
3402
- //#endregion
3403
- //#region src/editor/float/Movable.jsx
3404
- var ta = "button, a, input, select, textarea, [role=button], [role=tab], [role=slider]", na = (e, t) => Math.max(0, Math.min(e, t));
3405
- function ra({ id: e, start: t = {
3406
- right: 24,
3407
- bottom: 24
3408
- }, onMoved: n, className: r = "", children: i }) {
3409
- let a = `kol-float-pos:${e}`, o = JSON.stringify(t), [s, c] = Z(() => {
3410
- try {
3411
- let e = JSON.parse(localStorage.getItem(a));
3412
- return e?.start === o ? e.right == null ? {
3413
- left: e.left,
3414
- top: e.top
3415
- } : {
3416
- right: e.right,
3417
- bottom: e.bottom
3418
- } : null;
3419
- } catch {
3420
- return null;
3421
- }
3422
- }), l = X(null);
3423
- return Y(() => {
3424
- n?.(!!s);
3425
- }, [!!s]), /* @__PURE__ */ Q("div", {
3426
- ref: l,
3427
- onPointerDown: (e) => {
3428
- if (e.button !== 0 || e.target.closest(ta)) return;
3429
- let t = l.current, n = t.getBoundingClientRect(), r = t.offsetParent.getBoundingClientRect(), i = e.clientX - n.left, s = e.clientY - n.top, u = null;
3430
- t.setPointerCapture(e.pointerId);
3431
- let d = (t) => {
3432
- if (!u && Math.hypot(t.clientX - e.clientX, t.clientY - e.clientY) < 4) return;
3433
- let a = na(t.clientX - r.left - i, r.width - n.width), o = na(t.clientY - r.top - s, r.height - n.height);
3434
- u = {
3435
- right: r.width - a - n.width,
3436
- bottom: r.height - o - n.height
3437
- }, c(u);
3438
- }, f = () => {
3439
- if (t.removeEventListener("pointermove", d), t.removeEventListener("pointerup", f), t.removeEventListener("pointercancel", f), u) try {
3440
- localStorage.setItem(a, JSON.stringify({
3441
- ...u,
3442
- start: o
3443
- }));
3444
- } catch {}
3445
- };
3446
- t.addEventListener("pointermove", d), t.addEventListener("pointerup", f), t.addEventListener("pointercancel", f);
3447
- },
3448
- style: s ?? t,
3449
- onDoubleClick: (e) => {
3450
- if (!e.target.closest(ta)) {
3451
- c(null);
3452
- try {
3453
- localStorage.removeItem(a);
3454
- } catch {}
3455
- }
3456
- },
3457
- className: `absolute z-[var(--kol-z-sticky)] cursor-grab active:cursor-grabbing touch-none select-none ${r}`.trim(),
3458
- children: i
3459
- });
3460
- }
3461
- //#endregion
3462
- //#region src/editor/labs/FloatLabs.jsx
3463
- function ia() {
3464
- let { addFilter: e, patchFilter: t } = o(), { layer: n, setOnly: r } = _e(), i = X(null);
3465
- Y(() => {
3466
- n?.type === "photo" && n.src && (i.current = {
3467
- src: n.src,
3468
- srcType: n.srcType,
3469
- fit: n.fit
3470
- });
3471
- }, [
3472
- n?.type,
3473
- n?.src,
3474
- n?.srcType,
3475
- n?.fit
3476
- ]);
3477
- let a = Er({
3478
- layer: n,
3479
- setOnly: r,
3480
- addFilter: e,
3481
- patchFilter: t,
3482
- carriedSource: () => n?.type === "photo" ? {
3483
- src: n.src,
3484
- srcType: n.srcType,
3485
- fit: n.fit
3486
- } : i.current ?? {}
3487
- }), s = [], c = /* @__PURE__ */ new Map(), l = null;
3488
- return a.forEach((e) => {
3489
- if (e.id.startsWith("sec:")) {
3490
- s.push({
3491
- icon: Sr[e.id.slice(4)] ?? "square",
3492
- label: e.label,
3493
- path: e.id,
3494
- sub: []
3495
- });
3496
- return;
3497
- }
3498
- let t = e.pages ?? [], n = e.onSelect ?? t[0]?.onSelect ?? t[0]?.children?.[0]?.onSelect;
3499
- n && c.set(e.id, n), (e.active || t.some((e) => e.active || e.children?.some((e) => e.active))) && (l = e.id);
3500
- let r = {
3501
- icon: e.icon,
3502
- label: e.label,
3503
- path: e.id
3504
- }, i = s[s.length - 1];
3505
- i?.sub ? i.sub.push(r) : s.push(r);
3506
- }), {
3507
- items: s,
3508
- active: l,
3509
- pick: (e) => c.get(e)?.()
3510
- };
3511
- }
3512
- function aa() {
3513
- let { layer: e } = _e(), { removeLayer: t } = o(), n = e?.type === "photo" && !e.src && e.srcType !== "webcam";
3514
- return /* @__PURE__ */ $("div", {
3515
- className: "kol-float-labs-stage absolute inset-0 flex items-center justify-center overflow-hidden bg-surface-primary",
3516
- children: [/* @__PURE__ */ Q("div", {
3517
- style: {
3518
- flex: "none",
3519
- width: "85%",
3520
- height: "85%"
3521
- },
3522
- children: /* @__PURE__ */ Q(tn, {})
3523
- }), n && /* @__PURE__ */ Q(ui, {
3524
- layer: e,
3525
- title: vi(e).title,
3526
- onBack: () => t(e.id)
3527
- })]
3528
- });
3529
- }
3530
- function oa() {
3531
- Bt(), Ni();
3532
- let e = Kn("(max-width: 767px)"), { layer: t } = _e(), { selectedId: n, select: r } = o();
3533
- Y(() => {
3534
- t && n !== t.id && r(t.id);
3535
- }, [
3536
- t,
3537
- n,
3538
- r
3539
- ]);
3540
- let i = ia(), { title: a, kind: s } = t ? vi(t) : { title: "Labs" }, c = i.items.filter((e) => e.sub?.length).map((e) => e.path), [l, u] = Z(e), [d, f] = Z(e), [p, m] = Z(!1), [h, g] = Z(!1);
3541
- return /* @__PURE__ */ $("div", {
3542
- className: "kol-float-labs kol-editor-shell relative h-dvh overflow-hidden",
3543
- "data-editor-keep-selection": !0,
3544
- children: [
3545
- /* @__PURE__ */ Q(aa, {}),
3546
- d ? /* @__PURE__ */ Q(tr, {
3547
- items: i.items,
3548
- currentPath: i.active ?? "",
3549
- onNavigate: i.pick,
3550
- title: "Labs",
3551
- breadcrumb: ["Labs", a],
3552
- onRestore: () => f(!1),
3553
- className: "absolute left-6 top-6 z-[var(--kol-z-sticky)]"
3554
- }) : /* @__PURE__ */ Q(Vn, {
3555
- variant: "float",
3556
- items: i.items,
3557
- currentPath: i.active ?? "",
3558
- onNavigate: i.pick,
3559
- title: "Labs",
3560
- icon: "globe",
3561
- defaultExpanded: c,
3562
- collapsed: l,
3563
- onCollapsedChange: u,
3564
- onHide: () => f(!0),
3565
- collapsibleV: !0,
3566
- collapsedV: h,
3567
- onCollapseV: g,
3568
- footer: l ? void 0 : /* @__PURE__ */ Q(er, {
3569
- onCollapse: () => u(!0),
3570
- onHide: () => f(!0)
3571
- }),
3572
- className: `absolute left-6 top-6 z-[var(--kol-z-sticky)] ${h && !l ? "" : "bottom-6 !h-auto"}`
3573
- }),
3574
- !e && /* @__PURE__ */ Q(ra, {
3575
- id: "labs-transport",
3576
- start: {
3577
- right: 24,
3578
- bottom: 24
3579
- },
3580
- onMoved: m,
3581
- children: /* @__PURE__ */ Q(cn, { collapsibleH: !0 })
3582
- }),
3583
- /* @__PURE__ */ Q("div", {
3584
- className: `absolute ${e ? "left-6 right-6 top-[88px]" : "top-6 right-6"} ${!e && !p ? "bottom-24" : "bottom-6"} z-[var(--kol-z-sticky)] flex flex-col pointer-events-none [&>*]:pointer-events-auto`,
3585
- children: /* @__PURE__ */ Q($n, {
3586
- wide: !0,
3587
- width: e ? "100%" : void 0,
3588
- density: "compact",
3589
- surface: "solid",
3590
- className: "max-h-full",
3591
- windows: [
3592
- {
3593
- id: "params",
3594
- title: a || "Labs",
3595
- kind: s,
3596
- defaultCollapsedV: e,
3597
- className: "[&_.kol-compose-inspector-body]:!p-0",
3598
- children: t ? /* @__PURE__ */ Q("div", {
3599
- className: "kol-editor-labs",
3600
- children: /* @__PURE__ */ Q("div", {
3601
- className: "kol-compose-inspector-body",
3602
- children: /* @__PURE__ */ Q(ii, {})
3603
- })
3604
- }) : /* @__PURE__ */ Q(zn, {
3605
- variant: "float",
3606
- label: "Parameters"
3607
- })
3608
- },
3609
- {
3610
- id: "output",
3611
- title: "Output",
3612
- defaultCollapsedV: e,
3613
- children: /* @__PURE__ */ Q("div", {
3614
- className: "kol-editor-labs",
3615
- children: /* @__PURE__ */ Q(sn, { part: "output" })
3616
- })
3617
- },
3618
- {
3619
- id: "file",
3620
- title: "File",
3621
- defaultCollapsedV: e,
3622
- children: /* @__PURE__ */ Q("div", {
3623
- className: "kol-editor-labs",
3624
- children: /* @__PURE__ */ Q(sn, { part: "file" })
3625
- })
3626
- }
3627
- ]
3628
- })
3629
- })
3630
- ]
3631
- });
3632
- }
3633
- function sa() {
3634
- return /* @__PURE__ */ Q(g.Provider, {
3635
- value: "float",
3636
- children: /* @__PURE__ */ $(hn, {
3637
- draftKey: Fi,
3638
- modalVariant: "float",
3639
- children: [/* @__PURE__ */ Q(oa, {}), /* @__PURE__ */ Q(dn, {})]
3640
- })
3641
- });
3642
- }
3643
- //#endregion
3644
- export { Lt as AppSettingsSections, Pt as BRAND, On as DesignEditor, On as default, fn as DisplaySettingsDrawer, hn as EditorProviders, Ot as FilesDialog, _n as FloatDesignEditor, sa as FloatLabsView, Ge as GeneratorLibraryProvider, Fi as LABS_DRAFT_KEY, qe as LIBRARY_SLOT_KEYS, Ii as LabsView, un as MODES, ea as MobileView, tn as OutputCanvas, an as OutputStage, xn as OutputView, $t as RAIL_EXTRA_PREFIX, yt as TimelineRail, Xe as UnauthorizedError, bn as VIEW_PATHS, Ft as closeFiles, In as comboLabel, wn as copyStored, Dn as currentView, ln as duplicateStored, Be as getLibraryApi, Le as inviteFromRequest, zt as isMobileDevice, Me as listInviteRequests, Ke as loadLibrary, Ye as mintInvite, It as openFiles, He as readLibraryRaw, te as registerPack, Xt as removeStored, yn as renameStored, Re as requestInvite, Pe as setLibraryApi, Pn as setMediaClient, Vt as setMediaProxyBase, nn as setMode, Sn as setNavigator, pn as setRailExtras, i as setSettingsStore, En as setThumbStored, rn as setWantsDesktop, Wt as shortcutsBySection, Ne as signInLibrary, Ie as signOutLibrary, We as signUpLibrary, ze as subscribeLibrary, bt as timelineView, je as updateAccount, Ue as useAccount, Rt as useFilesDialog, Je as useGeneratorLibrary, Fe as useLibrarySession, An as useRailExtras, Ct as useSettingsSections, Tn as wantsDesktop, gn as withView };
1
+ import { E as e, T as t } from "./__vite-browser-external-y2xWjzgx.js";
2
+ import { Ir as n, ir as r, nr as i, rr as a } from "./rolls-DugKaHUw.js";
3
+ import { A as o, D as s, E as c, M as l, N as u, O as d, P as f, S as p, T as m, _ as h, b as g, d as _, f as v, g as y, j as b, k as x, w as S, x as C, y as w } from "./store-BMGP1qou.js";
4
+ import { i as T, n as E } from "./Timeline-EbecYeGh.js";
5
+ import { a as D, i as O, n as k, r as A, t as j } from "./src-BlvCHYVY.js";
6
+ import { F as M, P as N, _n as P, a as F, c as I, cn as L, ct as ee, d as R, dn as z, f as B, hn as V, ht as H, i as U, in as W, it as G, l as K, lt as q, m as J, n as Y, nn as X, nt as Z, o as Q, ot as $, p as te, pt as ne, r as re, rt as ie, s as ae, sn as oe, st as se, u as ce, un as le, vn as ue, yt as de } from "./core-9UlJPBwX.js";
7
+ export { Z as AppSettingsSections, ne as BRAND, j as DesignEditor, j as default, ie as DisplaySettingsDrawer, J as EditorProviders, q as FilesDialog, Y as FloatDesignEditor, k as FloatLabsView, _ as GeneratorLibraryProvider, O as LABS_DRAFT_KEY, v as LIBRARY_SLOT_KEYS, D as LabsView, L as MODES, A as MobileView, R as OutputCanvas, B as OutputStage, te as OutputView, I as RAIL_EXTRA_PREFIX, i as STYLE_OPTIONS, E as TimelineRail, C as UnauthorizedError, le as VIEW_PATHS, a as VariantContext, $ as closeFiles, H as comboLabel, re as copyStored, z as currentView, U as duplicateStored, p as getLibraryApi, S as inviteFromRequest, X as isMobileDevice, m as listInviteRequests, y as loadLibrary, c as mintInvite, se as openFiles, h as readLibraryRaw, n as registerPack, F as removeStored, Q as renameStored, s as requestInvite, d as setLibraryApi, N as setMediaClient, M as setMediaProxyBase, V as setMode, P as setNavigator, K as setRailExtras, t as setSettingsStore, ae as setThumbStored, W as setWantsDesktop, de as shortcutsBySection, x as signInLibrary, o as signOutLibrary, b as signUpLibrary, w as subscribeLibrary, T as timelineView, l as updateAccount, u as useAccount, e as useAppSettings, ee as useFilesDialog, g as useGeneratorLibrary, f as useLibrarySession, ce as useRailExtras, G as useSettingsSections, r as useVariant, oe as wantsDesktop, ue as withView };