@kolkrabbi/design-editor 0.20.0 → 0.22.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.
@@ -1,19 +1,20 @@
1
- import { B as e, Ft as t, It as n, L as r, S as i, Xt as a, Zt as o, a as s, at as c, b as l, c as u, i as d, it as f, j as p, l as m, n as h, o as g, ot as _, r as v, rt as y, tt as b, u as ee, w as x, wt as te, x as S } from "./rolls-CkmuE-Ya.js";
2
- import { c as C, d as w, f as T, l as E, n as D, o as O, p as ne, r as k, t as A } from "./registry-CSOtIU7o.js";
3
- import { c as j, n as M, s as N } from "./generators-C4R15Cgp.js";
4
- import { n as P, r as F, t as I } from "./useLayerEdit-B-NfMWe-.js";
5
- import { a as L, c as R, d as z, f as re, i as ie, l as B, n as ae, o as oe, r as se, s as ce, u as V } from "./effects-At3W3Ak1.js";
6
- import { t as le } from "./BindDot-CuCS4LS-.js";
7
- import { a as H, i as ue, n as de, o as fe, r as pe, s as me } from "./motion-CntX25g3.js";
8
- import { A as he, B as ge, C as _e, D as ve, E as ye, F as be, G as xe, H as Se, I as Ce, K as we, L as Te, M as Ee, N as De, O as Oe, P as ke, R as Ae, S as je, T as Me, U as Ne, V as Pe, W as Fe, _ as Ie, a as Le, b as Re, c as ze, d as Be, f as Ve, g as He, h as Ue, i as We, j as Ge, k as Ke, l as qe, m as Je, n as Ye, o as Xe, p as Ze, q as Qe, r as $e, s as et, t as tt, u as nt, v as rt, w as it, x as at, y as ot, z as st } from "./core-BWSY6z9e.js";
9
- import { Button as U, Divider as ct, Dropdown as lt, FullscreenOverlay as ut, LabeledControlSection as W, SegmentedToggle as G, ToggleSwitch as dt, Tooltip as ft } from "@kolkrabbi/kol-component";
10
- import { createContext as pt, useCallback as mt, useContext as ht, useEffect as K, useRef as q, useState as J } from "react";
11
- import { Fragment as Y, jsx as X, jsxs as Z } from "react/jsx-runtime";
12
- import { Icon as gt } from "@kolkrabbi/kol-icons";
13
- import { useDragResize as _t, useTheme as vt } from "@kolkrabbi/kol-framework";
1
+ import { B as e, L as t, Rt as n, S as r, a as i, at as a, b as o, c as s, i as c, it as l, j as u, l as d, mn as f, n as p, o as m, ot as h, pn as g, r as _, rt as v, tt as y, u as b, w as x, wt as ee, x as S, zt as C } from "./rolls-Bg1XHuvJ.js";
2
+ import { a as te, d as ne, f as w, g as T, h as E, i as D, l as re, m as O, n as k, o as A, r as j, t as M } from "./useLayerEdit-ieOjHx6x.js";
3
+ import { s as N } from "./RuleRow-BXkjpTyN.js";
4
+ import { n as P } from "./generators-B8_StNAy.js";
5
+ import { a as F, f as I, i as L, l as ie, n as R, o as ae, r as z, s as oe, t as se, u as B } from "./effectCategories-BcaQSD_V.js";
6
+ import { n as ce, r as V } from "./effects-pCd8YTdQ.js";
7
+ import { c as le, i as H, r as ue } from "./labels-B5qkocWy.js";
8
+ import { i as U, n as de, r as fe } from "./motion-DFnAar_2.js";
9
+ import { $ as pe, A as me, B as he, C as ge, D as _e, E as ve, F as ye, G as be, H as xe, I as Se, J as Ce, K as we, L as W, M as Te, N as Ee, O as De, P as Oe, Q as ke, R as Ae, S as je, T as Me, U as Ne, V as Pe, W as Fe, X as Ie, Y as Le, Z as Re, _ as ze, a as Be, b as Ve, c as He, d as Ue, et as We, f as Ge, g as Ke, h as qe, i as Je, it as Ye, j as Xe, k as Ze, l as Qe, m as $e, n as et, nt as tt, o as nt, p as rt, q as it, r as at, rt as ot, s as st, t as ct, tt as lt, u as ut, v as dt, w as ft, x as pt, y as mt, z as G } from "./core-G5e-pSOt.js";
10
+ import { Button as K, Divider as ht, Dropdown as gt, LabeledControlSection as _t, SegmentedToggle as q, ToggleSwitch as vt, Tooltip as yt } from "@kolkrabbi/kol-component";
11
+ import { createContext as bt, useCallback as xt, useContext as St, useEffect as J, useRef as Y, useState as X } from "react";
12
+ import { Fragment as Ct, jsx as Z, jsxs as Q } from "react/jsx-runtime";
13
+ import { Icon as wt } from "@kolkrabbi/kol-icons";
14
+ import { useDragResize as Tt, useTheme as Et } from "@kolkrabbi/kol-framework";
14
15
  //#region src/editor/labs/useLabsLayer.js
15
- function Q() {
16
- let { layers: e, addLayer: t, removeLayer: n, updateLayer: r, select: i, beginTransaction: a, commitTransaction: o } = p(), s = mt((s, c) => {
16
+ function $() {
17
+ let { layers: e, addLayer: t, removeLayer: n, updateLayer: r, select: i, beginTransaction: a, commitTransaction: o } = u(), s = xt((s, c) => {
17
18
  let [l, ...u] = e;
18
19
  a();
19
20
  for (let e of u) n(e.id);
@@ -34,214 +35,10 @@ function Q() {
34
35
  };
35
36
  }
36
37
  //#endregion
37
- //#region src/editor/labs/catalog.js
38
- var $ = {
39
- "fx:halftone": "ptrn-dot",
40
- "fx:scanline": "grid-horizontal",
41
- "fx:crt": "desktop",
42
- "fx:refraction": "circle",
43
- "fx:fx-rack": "target",
44
- "fx:pattern": "ptrn-checker",
45
- "fx:other": "more",
46
- "gen:Scanline": "grid-horizontal",
47
- "gen:Pattern": "ptrn-checker",
48
- "gen:Loops": "refresh",
49
- "gen:Math": "sum",
50
- "gen:Penrose": "a-framed",
51
- "gen:Drift": "dith-flow",
52
- "gen:Gradients": "circle",
53
- "gen:Soft Forms": "paint-drop",
54
- "gen:Soft Forms 3D": "ball",
55
- "gen:3D Scene": "ball",
56
- "kin:Type": "font-01",
57
- "kin:Kinetic": "font-01",
58
- "misc:Para Type": "aa",
59
- "vec:Distressor": "scribble",
60
- "vec:Modulator": "dashed-circle"
61
- }, yt = {
62
- effects: "filter",
63
- generative: "layers",
64
- vector: "pen-nib",
65
- composition: "type",
66
- modulation: "frequency",
67
- mode: "mode-toggle-01"
68
- }, bt = {
69
- editor: "desktop",
70
- labs: "globe",
71
- randomiser: "refresh"
72
- }, xt = [
73
- "Moiré",
74
- "Mesh Gradient",
75
- "Reaction",
76
- "Halftone"
77
- ], St = [
78
- {
79
- label: "Spaced",
80
- patch: {
81
- geometry: "rows",
82
- mark: "dots"
83
- }
84
- },
85
- {
86
- label: "Glyph",
87
- patch: { mark: "glyph" }
88
- },
89
- {
90
- label: "Lattice",
91
- patch: { mark: "lattice" }
92
- },
93
- {
94
- label: "Vortex",
95
- patch: {
96
- geometry: "radial",
97
- swirl: .8,
98
- rayCount: 220
99
- }
100
- },
101
- {
102
- label: "Rings",
103
- patch: { geometry: "rings" }
104
- },
105
- {
106
- label: "Spiral",
107
- patch: { geometry: "spiral" }
108
- }
109
- ], Ct = (e = {}) => {
110
- let t = e.geometry ?? "rows";
111
- return t === "radial" ? "Vortex" : t === "rings" ? "Rings" : t === "spiral" ? "Spiral" : e.mark === "glyph" ? "Glyph" : e.mark === "lattice" ? "Lattice" : "Spaced";
112
- };
113
- function wt({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource: i }) {
114
- let a = (e, a) => {
115
- let o = t("photo", {
116
- ...i(),
117
- filters: [],
118
- fxGroup: null
119
- });
120
- o && (n(o, e), a && r(o, 0, a)), window.dispatchEvent(new CustomEvent("kol:open-effects"));
121
- }, o = (e) => {
122
- t("photo", {
123
- ...i(),
124
- filters: [],
125
- fxGroup: e
126
- }), window.dispatchEvent(new CustomEvent("kol:open-effects"));
127
- }, s = (e, n) => {
128
- t("loop", E(e, n)), window.dispatchEvent(new CustomEvent("kol:open-params"));
129
- }, c = (e) => {
130
- t("kinetic", {
131
- presetId: e.id,
132
- presetLabel: e.label,
133
- comp: me(e)
134
- }), window.dispatchEvent(new CustomEvent("kol:open-params"));
135
- }, l = e?.presetId ?? null, u = e?.filters?.[0]?.id ?? null, d = l ? w(e?.loopGroup).find((e) => e.id === l) ?? null : null, f = (n, r = "loop", i) => {
136
- let a = w(n), o = [...new Set(a.map((e) => e.sub).filter(Boolean))], c = (e) => r === "misc" ? () => {
137
- t("misc", E(e, n)), window.dispatchEvent(new CustomEvent("kol:open-params"));
138
- } : () => s(e, n);
139
- return o.length ? o.map((t) => ({
140
- label: t,
141
- onSelect: c(T(n, t)[0]),
142
- active: e?.loopGroup === n && d?.sub === t
143
- })) : [{
144
- label: i ?? D(n).label,
145
- onSelect: c(a[0]),
146
- active: e?.loopGroup === n
147
- }];
148
- }, p = (e) => e.groups.flatMap((t) => {
149
- let n = e.labels?.[t] ?? D(t).label, r = w(t).some((e) => e.sub), i = f(t, "loop", n);
150
- return e.groups.length > 1 && r ? [{
151
- label: n,
152
- children: i
153
- }] : i;
154
- });
155
- return [
156
- {
157
- id: "sec:effects",
158
- label: "Effects"
159
- },
160
- ...oe(re).map((t) => ({
161
- id: `fx:${t.id}`,
162
- label: t.label,
163
- icon: $[`fx:${t.id}`] ?? "square",
164
- pages: t.rack ? ie.map((t) => ({
165
- label: t.label,
166
- onSelect: () => o(t.id),
167
- active: e?.fxGroup === t.id
168
- })) : t.id === "pattern" ? xt.map((t) => ({
169
- label: t,
170
- onSelect: () => s(T("optic", t)[0], "optic"),
171
- active: e?.loopGroup === "optic" && d?.sub === t
172
- })) : t.id === "scanline" ? St.map((t) => ({
173
- label: t.label,
174
- onSelect: () => a("scanline", t.patch),
175
- active: !e?.fxGroup && u === "scanline" && Ct(e?.filters?.[0]?.params) === t.label
176
- })) : t.filters.map((t) => ({
177
- label: t.label ?? t.id,
178
- onSelect: () => a(t.id),
179
- active: !e?.fxGroup && u === t.id
180
- }))
181
- })),
182
- {
183
- id: "sec:generative",
184
- label: "Generative"
185
- },
186
- ...N.map((e) => ({
187
- id: `gen:${e.label}`,
188
- label: e.label,
189
- icon: $[`gen:${e.label}`] ?? "square",
190
- pages: p(e)
191
- })),
192
- {
193
- id: "sec:vector",
194
- label: "Vector"
195
- },
196
- {
197
- id: "vec:Distressor",
198
- label: "Distressor",
199
- icon: $["vec:Distressor"] ?? "square",
200
- pages: f("distress")
201
- },
202
- {
203
- id: "vec:Modulator",
204
- label: "Modulator",
205
- icon: $["vec:Modulator"] ?? "square",
206
- pages: f("modulator")
207
- },
208
- {
209
- id: "sec:composition",
210
- label: "Composition"
211
- },
212
- ...fe.map((t) => ({
213
- id: `kin:${t.label}`,
214
- label: t.label,
215
- icon: $[`kin:${t.label}`] ?? "square",
216
- pages: t.subs.map((t) => ({
217
- label: t,
218
- onSelect: () => c(H.find((e) => e.sub === t)),
219
- active: e?.type === "kinetic" && H.some((e) => e.sub === t && e.id === l)
220
- }))
221
- })),
222
- ...j.map((e) => ({
223
- id: `misc:${e.label}`,
224
- label: e.label,
225
- icon: $[`misc:${e.label}`] ?? "square",
226
- pages: e.groups.flatMap((e) => f(e, "misc"))
227
- })),
228
- {
229
- id: "sec:modulation",
230
- label: "Modulation"
231
- },
232
- {
233
- id: "mod:animation",
234
- label: "Animation",
235
- icon: "frequency",
236
- onSelect: () => window.dispatchEvent(new CustomEvent("kol:open-params"))
237
- }
238
- ];
239
- }
240
- //#endregion
241
38
  //#region src/editor/labs/LabsNav.jsx
242
- function Tt() {
243
- let { addFilter: e, patchFilter: n } = p(), { layer: r, setOnly: i } = Q(), a = q(null);
244
- K(() => {
39
+ function Dt() {
40
+ let { addFilter: e, patchFilter: t } = u(), { layer: r, setOnly: i } = $(), a = Y(null);
41
+ J(() => {
245
42
  r?.type === "photo" && r.src && (a.current = {
246
43
  src: r.src,
247
44
  srcType: r.srcType,
@@ -253,192 +50,53 @@ function Tt() {
253
50
  r?.srcType,
254
51
  r?.fit
255
52
  ]);
256
- let o = wt({
53
+ let o = Pe({
257
54
  layer: r,
258
55
  setOnly: i,
259
56
  addFilter: e,
260
- patchFilter: n,
57
+ patchFilter: t,
261
58
  carriedSource: () => r?.type === "photo" ? {
262
59
  src: r.src,
263
60
  srcType: r.srcType,
264
61
  fit: r.fit
265
62
  } : a.current ?? {}
266
63
  });
267
- return K(() => {
268
- let e = /* @__PURE__ */ new Map(), n = [];
269
- o.forEach((t) => {
270
- if (t.id.startsWith("sec:")) {
271
- let e = t.id.slice(4);
272
- n.push({
273
- icon: yt[e] ?? "square",
274
- path: `${et}${t.id}`,
275
- label: t.label,
64
+ return J(() => {
65
+ let e = /* @__PURE__ */ new Map(), t = [];
66
+ o.forEach((n) => {
67
+ if (n.id.startsWith("sec:")) {
68
+ let e = n.id.slice(4);
69
+ t.push({
70
+ icon: he[e] ?? "square",
71
+ path: `${et}${n.id}`,
72
+ label: n.label,
276
73
  sub: []
277
74
  });
278
75
  return;
279
76
  }
280
- let r = `${et}${t.id}`, i = t.pages ?? [], a = t.onSelect ?? i[0]?.onSelect ?? i[0]?.children?.[0]?.onSelect;
77
+ let r = `${et}${n.id}`, i = n.pages ?? [], a = n.onSelect ?? i[0]?.onSelect ?? i[0]?.children?.[0]?.onSelect;
281
78
  a && e.set(r, a);
282
- let o = n[n.length - 1], s = {
283
- icon: t.icon,
79
+ let o = t[t.length - 1], s = {
80
+ icon: n.icon,
284
81
  path: r,
285
- label: t.label
82
+ label: n.label
286
83
  };
287
- o?.sub ? o.sub.push(s) : n.push(s);
84
+ o?.sub ? o.sub.push(s) : t.push(s);
288
85
  });
289
- let r = $e() && !Xe();
290
- return ze({
291
- items: n,
292
- dispatch: (n) => {
293
- let i = e.get(n);
294
- return i ? (i(), r && t.play(), !0) : !1;
86
+ let r = Fe() && !Le();
87
+ return at({
88
+ items: t,
89
+ dispatch: (t) => {
90
+ let i = e.get(t);
91
+ return i ? (i(), r && n.play(), !0) : !1;
295
92
  }
296
- }), () => ze(null);
93
+ }), () => at(null);
297
94
  }), null;
298
95
  }
299
96
  //#endregion
300
- //#region src/editor/labs/LabsSourcePicker.jsx
301
- function Et(e) {
302
- let { patch: t } = I(e.id), n = q(null), [r, i] = J(!1), a = e.type === "loop" && e.loopGroup === "distress";
303
- return {
304
- nodes: /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X("input", {
305
- ref: n,
306
- type: "file",
307
- accept: a ? ".svg,image/svg+xml" : "image/*,video/*",
308
- className: "hidden",
309
- onChange: (n) => {
310
- let r = n.target.files?.[0];
311
- if (n.target.value = "", !r) return;
312
- if (a) {
313
- let e = new FileReader();
314
- e.onload = () => t({ svgSrc: e.result }), e.readAsText(r);
315
- return;
316
- }
317
- if (r.type.startsWith("video/")) {
318
- b(e.id, r), t({
319
- src: URL.createObjectURL(r),
320
- srcType: "video"
321
- });
322
- return;
323
- }
324
- let i = new FileReader();
325
- i.onload = () => t({
326
- src: i.result,
327
- srcType: "image"
328
- }), i.readAsDataURL(r);
329
- }
330
- }), /* @__PURE__ */ X(He, {
331
- open: r,
332
- onClose: () => i(!1),
333
- onPick: (e, { contentType: n } = {}) => {
334
- if (a) {
335
- t({ svgSrc: rt(e) });
336
- return;
337
- }
338
- t({
339
- src: rt(e),
340
- srcType: Ie(n) ? "video" : "image"
341
- });
342
- },
343
- accept: a ? "svg" : "all"
344
- })] }),
345
- svgMode: a,
346
- openLibrary: () => i(!0),
347
- openUpload: () => n.current?.click(),
348
- openCamera: () => {
349
- at(e.id).then(() => t({
350
- src: null,
351
- srcType: "webcam"
352
- })).catch(() => {});
353
- }
354
- };
355
- }
356
- function Dt({ layer: e }) {
357
- let t = i(), n = Et(e);
358
- return /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(G, {
359
- value: null,
360
- onChange: (e) => ({
361
- library: n.openLibrary,
362
- upload: n.openUpload,
363
- camera: n.openCamera
364
- })[e]?.(),
365
- options: n.svgMode ? kt : Ot,
366
- size: t,
367
- ariaLabel: "Source",
368
- className: S(t)
369
- }), n.nodes] });
370
- }
371
- var Ot = [
372
- {
373
- value: "library",
374
- label: "Library"
375
- },
376
- {
377
- value: "upload",
378
- label: "Upload"
379
- },
380
- {
381
- value: "camera",
382
- label: "Camera"
383
- }
384
- ], kt = Ot.slice(0, 2);
385
- function At({ layer: e }) {
386
- let t = Et(e), n = "flex-1 flex flex-col items-center justify-center gap-3 cursor-pointer text-oq-48 hover:text-emphasis hover:bg-oq-02 transition-colors";
387
- return /* @__PURE__ */ Z("div", {
388
- className: "w-full h-full flex items-stretch p-6 gap-px",
389
- children: [
390
- /* @__PURE__ */ Z("button", {
391
- type: "button",
392
- className: n,
393
- onClick: t.openLibrary,
394
- children: [/* @__PURE__ */ X(gt, {
395
- name: "image",
396
- size: 28
397
- }), /* @__PURE__ */ X("span", {
398
- className: "kol-mono-12",
399
- children: "From library"
400
- })]
401
- }),
402
- /* @__PURE__ */ X("div", {
403
- className: "w-px",
404
- style: { background: "var(--kol-oq-08)" }
405
- }),
406
- /* @__PURE__ */ Z("button", {
407
- type: "button",
408
- className: n,
409
- onClick: t.openUpload,
410
- children: [/* @__PURE__ */ X(gt, {
411
- name: "upload",
412
- size: 28
413
- }), /* @__PURE__ */ X("span", {
414
- className: "kol-mono-12",
415
- children: "Upload"
416
- })]
417
- }),
418
- /* @__PURE__ */ X("div", {
419
- className: "w-px",
420
- style: { background: "var(--kol-oq-08)" }
421
- }),
422
- /* @__PURE__ */ Z("button", {
423
- type: "button",
424
- className: n,
425
- onClick: t.openCamera,
426
- children: [/* @__PURE__ */ X(gt, {
427
- name: "camera",
428
- size: 28
429
- }), /* @__PURE__ */ X("span", {
430
- className: "kol-mono-12",
431
- children: "Camera"
432
- })]
433
- }),
434
- t.nodes
435
- ]
436
- });
437
- }
438
- //#endregion
439
97
  //#region src/editor/labs/LabsParams.jsx
440
- function jt(e, t) {
441
- K(() => {
98
+ function Ot(e, t) {
99
+ J(() => {
442
100
  let n = (n) => {
443
101
  if (n.key !== "r" && n.key !== "R" || n.metaKey || n.ctrlKey || n.altKey) return;
444
102
  let r = n.target;
@@ -447,13 +105,13 @@ function jt(e, t) {
447
105
  return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
448
106
  });
449
107
  }
450
- var Mt = [{
108
+ var kt = [{
451
109
  value: "effect",
452
110
  label: "Effect"
453
111
  }, {
454
112
  value: "anim",
455
113
  label: "Motion"
456
- }], Nt = [
114
+ }], At = [
457
115
  {
458
116
  value: "generate",
459
117
  label: "Generate"
@@ -466,7 +124,7 @@ var Mt = [{
466
124
  value: "anim",
467
125
  label: "Animation"
468
126
  }
469
- ], Pt = [
127
+ ], jt = [
470
128
  {
471
129
  value: "generate",
472
130
  label: "Gen"
@@ -480,39 +138,39 @@ var Mt = [{
480
138
  label: "Anim"
481
139
  }
482
140
  ];
483
- function Ft({ options: e, active: t, onPick: n, spread: r = !1, pills: i = !1 }) {
484
- return e?.length ? i ? /* @__PURE__ */ X("div", {
141
+ function Mt({ options: e, active: t, onPick: n, spread: i = !1, pills: a = !1 }) {
142
+ let o = r();
143
+ return e?.length ? a ? /* @__PURE__ */ Z("div", {
485
144
  className: "flex items-center gap-1 flex-wrap",
486
- children: e.map((e) => /* @__PURE__ */ X("button", {
145
+ children: e.map((e) => /* @__PURE__ */ Z("button", {
487
146
  type: "button",
488
147
  onClick: () => n(e.value),
489
148
  className: `px-2 py-0.5 rounded kol-helper-10 tracking-widest border transition-colors cursor-pointer ${e.value === t ? "bg-fg-16 border-oq-24 text-emphasis" : "bg-transparent border-oq-08 text-meta hover:border-oq-16 hover:text-body"}`,
490
149
  children: e.label
491
150
  }, e.value))
492
- }) : /* @__PURE__ */ X("div", {
493
- className: `flex flex-wrap items-center gap-x-5 gap-y-1.5${r ? " justify-between" : ""}`,
494
- children: e.map((e) => /* @__PURE__ */ X("button", {
495
- type: "button",
496
- onClick: () => n(e.value),
497
- className: ["kol-helper-12 cursor-pointer", e.value === t ? "text-emphasis" : "text-meta hover:text-emphasis"].join(" "),
498
- children: e.label
499
- }, e.value))
151
+ }) : /* @__PURE__ */ Z(q, {
152
+ value: t ?? null,
153
+ onChange: n,
154
+ options: e,
155
+ size: o,
156
+ ariaLabel: "Siblings",
157
+ className: S(o)
500
158
  }) : null;
501
159
  }
502
- function It({ chips: e, active: t, onPick: n, spread: r, pills: a, title: o, tabStrip: s, preStrip: c, fx: l = !1, children: u }) {
503
- let d = i() === "sm";
504
- return /* @__PURE__ */ Z("div", {
160
+ function Nt({ chips: e, active: t, onPick: n, spread: i, pills: a, title: o, tabStrip: s, preStrip: c, fx: l = !1, children: u }) {
161
+ let d = r() === "sm";
162
+ return /* @__PURE__ */ Q("div", {
505
163
  className: `flex flex-col gap-5${l ? " kol-labs-fx" : ""}`,
506
164
  children: [
507
- o && d && /* @__PURE__ */ X("p", {
165
+ o && d && /* @__PURE__ */ Z("p", {
508
166
  className: "kol-eyebrow text-fg-96",
509
167
  children: o
510
168
  }),
511
- e && /* @__PURE__ */ X(Ft, {
169
+ e && /* @__PURE__ */ Z(Mt, {
512
170
  options: e,
513
171
  active: t,
514
172
  onPick: n,
515
- spread: r,
173
+ spread: i,
516
174
  pills: a
517
175
  }),
518
176
  c,
@@ -521,27 +179,27 @@ function It({ chips: e, active: t, onPick: n, spread: r, pills: a, title: o, tab
521
179
  ]
522
180
  });
523
181
  }
524
- function Lt({ layer: t, showMod: n }) {
525
- let a = i(), [o, c] = J("effect");
526
- K(() => {
182
+ function Pt({ layer: n, showMod: a }) {
183
+ let o = r(), [s, c] = X("effect");
184
+ J(() => {
527
185
  let e = () => c("effect");
528
186
  return window.addEventListener("kol:open-effects", e), () => window.removeEventListener("kol:open-effects", e);
529
187
  }, []);
530
- let { addFilter: l, replaceFilter: u, removeFilter: d, toggleFilter: f, updateLayer: m, palette: g } = p(), _ = I(t.id, { history: "coalesce" }), v = r(t), y = v[0] ?? null, b = oe(re).find((e) => e.id === L(y?.id)), x = b?.id === "halftone", te = x ? (b?.filters ?? []).map((e) => ({
188
+ let { addFilter: l, replaceFilter: d, removeFilter: f, toggleFilter: m, updateLayer: h, palette: g } = u(), _ = M(n.id, { history: "coalesce" }), v = t(n), y = v[0] ?? null, x = z(I).find((e) => e.id === R(y?.id)), ee = x?.id === "halftone", C = ee ? (x?.filters ?? []).map((e) => ({
531
189
  value: e.id,
532
190
  label: e.label
533
- })) : null, C = !x && y ? y.def.label : null, w = (e) => {
191
+ })) : null, te = !ee && y ? y.def.label : null, ne = (e) => {
534
192
  if (!y) {
535
- l(t.id, e);
193
+ l(n.id, e);
536
194
  return;
537
195
  }
538
- e !== y.id && u(t.id, 0, e);
539
- }, T = v.map(({ def: e, ...t }) => t), E = y ? {
540
- ...t,
196
+ e !== y.id && d(n.id, 0, e);
197
+ }, w = v.map(({ def: e, ...t }) => t), T = y ? {
198
+ ...n,
541
199
  ...y.params,
542
- id: t.id
543
- } : t, D = (e) => (t, n) => {
544
- let r = T.map((r, i) => i === e ? {
200
+ id: n.id
201
+ } : n, E = (e) => (t, n) => {
202
+ let r = w.map((r, i) => i === e ? {
545
203
  ...r,
546
204
  params: {
547
205
  ...r.params,
@@ -549,246 +207,245 @@ function Lt({ layer: t, showMod: n }) {
549
207
  }
550
208
  } : r);
551
209
  _.patch({ filters: r });
552
- }, O = D(0), ne = n ? (e) => /* @__PURE__ */ X(le, {
553
- layer: E,
210
+ }, D = E(0), re = a ? (e) => /* @__PURE__ */ Z(B, {
211
+ layer: T,
554
212
  param: e,
555
- setProp: O
556
- }) : void 0, k = (e) => {
557
- let n = T.map((t, n) => n === 0 ? {
213
+ setProp: D
214
+ }) : void 0, O = (e) => {
215
+ let t = w.map((t, n) => n === 0 ? {
558
216
  ...t,
559
217
  params: {
560
218
  ...t.params,
561
219
  ...e
562
220
  }
563
221
  } : t);
564
- m(t.id, { filters: n });
222
+ h(n.id, { filters: t });
565
223
  };
566
- jt(() => {
567
- y && m(t.id, { filters: T.map((e, t) => t === 0 ? {
224
+ Ot(() => {
225
+ y && h(n.id, { filters: w.map((e, t) => t === 0 ? {
568
226
  ...e,
569
227
  params: {}
570
228
  } : e) });
571
229
  }, () => {
572
- y && k(s(E, h(y.def.params, E), ee()));
230
+ y && O(i(T, p(y.def.params, T), b()));
573
231
  });
574
- let A = t.fxGroup ? ie.find((e) => e.id === t.fxGroup) : null;
232
+ let A = n.fxGroup ? se.find((e) => e.id === n.fxGroup) : null;
575
233
  if (A) {
576
234
  let e = {
577
235
  chain: v,
578
- layer: t,
579
- hostView: E,
580
- toggleFilter: f,
581
- removeFilter: d,
582
- setStagePropAt: D,
236
+ layer: n,
237
+ hostView: T,
238
+ toggleFilter: m,
239
+ removeFilter: f,
240
+ setStagePropAt: E,
583
241
  palette: g,
584
- showMod: n
585
- }, r = [{
242
+ showMod: a
243
+ }, t = [{
586
244
  value: "",
587
245
  label: "Add effect…"
588
- }, ...z(A, re).map((e) => ({
246
+ }, ...ie(A, I).map((e) => ({
589
247
  value: e.id,
590
248
  label: `${e.label ?? e.id}${e.kind === "pixi" ? " · GPU" : ""}`
591
249
  }))];
592
- return /* @__PURE__ */ Z(It, {
250
+ return /* @__PURE__ */ Q(Nt, {
593
251
  title: "Effects",
594
252
  fx: !0,
595
- tabStrip: /* @__PURE__ */ X(G, {
596
- value: o,
253
+ tabStrip: /* @__PURE__ */ Z(q, {
254
+ value: s,
597
255
  onChange: c,
598
- options: Mt,
599
- size: a,
600
- className: S(a)
256
+ options: kt,
257
+ size: o,
258
+ className: S(o)
601
259
  }),
602
- children: [o === "effect" && /* @__PURE__ */ Z(Y, { children: [
603
- /* @__PURE__ */ Z(W, {
260
+ children: [s === "effect" && /* @__PURE__ */ Q(Ct, { children: [
261
+ /* @__PURE__ */ Q(_t, {
604
262
  label: "Effect Stack",
605
263
  divided: !0,
606
- children: [v.length === 0 && /* @__PURE__ */ X(F, {
264
+ children: [v.length === 0 && /* @__PURE__ */ Z(j, {
607
265
  className: "kol-mono-10 text-meta",
608
266
  children: "No effects yet — add one below."
609
- }), /* @__PURE__ */ X(Rt, {
267
+ }), /* @__PURE__ */ Z(Ft, {
610
268
  ...e,
611
269
  from: 0
612
270
  })]
613
271
  }),
614
- /* @__PURE__ */ X(ct, {}),
615
- /* @__PURE__ */ X(W, {
272
+ /* @__PURE__ */ Z(ht, {}),
273
+ /* @__PURE__ */ Z(_t, {
616
274
  label: A.label,
617
275
  divided: !0,
618
- children: /* @__PURE__ */ X(lt, {
276
+ children: /* @__PURE__ */ Z(gt, {
619
277
  variant: "subtle",
620
- size: a,
278
+ size: o,
621
279
  className: "w-full",
622
- options: r,
280
+ options: t,
623
281
  value: "",
624
282
  disabled: v.length >= 8,
625
283
  onChange: (e) => {
626
- e && l(t.id, e);
284
+ e && l(n.id, e);
627
285
  }
628
286
  })
629
287
  })
630
- ] }), o === "anim" && y?.def?.sweeps && /* @__PURE__ */ X(se, {
288
+ ] }), s === "anim" && y?.def?.sweeps && /* @__PURE__ */ Z(V, {
631
289
  sweeps: Array.isArray(y.params.sweeps) ? y.params.sweeps : [],
632
- onChange: (e) => O("sweeps", e),
290
+ onChange: (e) => D("sweeps", e),
633
291
  inline: !0
634
292
  })]
635
293
  });
636
294
  }
637
- if (!y) return /* @__PURE__ */ X(It, {
638
- chips: te,
295
+ if (!y) return /* @__PURE__ */ Z(Nt, {
296
+ chips: C,
639
297
  active: null,
640
- onPick: w,
641
- spread: x,
298
+ onPick: ne,
299
+ spread: ee,
642
300
  fx: !0,
643
- tabStrip: /* @__PURE__ */ X(G, {
644
- value: o,
301
+ tabStrip: /* @__PURE__ */ Z(q, {
302
+ value: s,
645
303
  onChange: c,
646
- options: Mt,
647
- size: a,
648
- className: S(a)
304
+ options: kt,
305
+ size: o,
306
+ className: S(o)
649
307
  }),
650
- children: /* @__PURE__ */ X(P, {
651
- schema: Ue,
652
- layer: t,
308
+ children: /* @__PURE__ */ Z(k, {
309
+ schema: ut,
310
+ layer: n,
653
311
  setProp: _.setProp,
654
312
  palette: g,
655
- renderAnimate: (e) => /* @__PURE__ */ X(le, {
656
- layer: t,
313
+ renderAnimate: (e) => /* @__PURE__ */ Z(B, {
314
+ layer: n,
657
315
  param: e,
658
316
  setProp: _.setProp
659
317
  }),
660
- tab: o === "anim" ? "anim" : "style",
318
+ tab: s === "anim" ? "anim" : "style",
661
319
  emptyHint: "Pick an effect from the nav."
662
320
  })
663
321
  });
664
- let j = y.def.params.filter((t) => e(t) !== "anim"), M = V(y.def.id), N = M ? j.findIndex((e) => e.key === M) : -1, R = j.length;
665
- if (N >= 0) {
666
- let e = N;
667
- for (; e + 1 < j.length && j[e + 1].type === "select";) e++;
668
- R = e + 1;
322
+ let N = y.def.params.filter((t) => e(t) !== "anim"), P = oe(y.def.id), F = P ? N.findIndex((e) => e.key === P) : -1, L = N.length;
323
+ if (F >= 0) {
324
+ let e = F;
325
+ for (; e + 1 < N.length && N[e + 1].type === "select";) e++;
326
+ L = e + 1;
669
327
  }
670
- let B = N > 0 ? j.slice(0, N) : [], ce = N >= 0 ? j.slice(N, R).map((e) => ({
328
+ let ae = F > 0 ? N.slice(0, F) : [], le = F >= 0 ? N.slice(F, L).map((e) => ({
671
329
  ...e,
672
330
  section: void 0
673
- })) : j, H = {
674
- layer: E,
675
- setProp: O,
331
+ })) : N, H = {
332
+ layer: T,
333
+ setProp: D,
676
334
  palette: g,
677
- renderAnimate: ne,
335
+ renderAnimate: re,
678
336
  inline: !0
679
337
  };
680
- return /* @__PURE__ */ Z(It, {
681
- chips: te,
338
+ return /* @__PURE__ */ Q(Nt, {
339
+ chips: C,
682
340
  active: y.id,
683
- onPick: w,
684
- spread: x,
685
- title: C,
341
+ onPick: ne,
342
+ spread: ee,
343
+ title: te,
686
344
  fx: !0,
687
- preStrip: /* @__PURE__ */ X(Dt, { layer: t }),
688
- tabStrip: /* @__PURE__ */ X(G, {
689
- value: o,
345
+ tabStrip: /* @__PURE__ */ Z(q, {
346
+ value: s,
690
347
  onChange: c,
691
- options: Mt,
692
- size: a,
693
- className: S(a)
348
+ options: kt,
349
+ size: o,
350
+ className: S(o)
694
351
  }),
695
- children: [o === "effect" && /* @__PURE__ */ Z(Y, { children: [
696
- B.length > 0 && /* @__PURE__ */ X(P, {
697
- schema: B,
352
+ children: [s === "effect" && /* @__PURE__ */ Q(Ct, { children: [
353
+ ae.length > 0 && /* @__PURE__ */ Z(k, {
354
+ schema: ae,
698
355
  ...H
699
356
  }),
700
- /* @__PURE__ */ Z(W, {
357
+ /* @__PURE__ */ Q(_t, {
701
358
  divided: !0,
702
- children: [/* @__PURE__ */ X(P, {
703
- schema: ce,
359
+ children: [/* @__PURE__ */ Z(k, {
360
+ schema: le,
704
361
  ...H
705
- }), /* @__PURE__ */ X(ae, {
362
+ }), /* @__PURE__ */ Z(ce, {
706
363
  inline: !0,
707
364
  def: y.def,
708
- view: E,
365
+ view: T,
709
366
  tab: "effect",
710
- onPatch: k
367
+ onPatch: O
711
368
  })]
712
369
  }),
713
- /* @__PURE__ */ X(ct, {}),
714
- R < j.length && /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(P, {
715
- schema: j.slice(R),
370
+ /* @__PURE__ */ Z(ht, {}),
371
+ L < N.length && /* @__PURE__ */ Q(Ct, { children: [/* @__PURE__ */ Z(k, {
372
+ schema: N.slice(L),
716
373
  ...H
717
- }), /* @__PURE__ */ X(ct, {})] }),
718
- /* @__PURE__ */ X(zt, {
374
+ }), /* @__PURE__ */ Z(ht, {})] }),
375
+ /* @__PURE__ */ Z(It, {
719
376
  chain: v,
720
- layer: t,
721
- hostView: E,
377
+ layer: n,
378
+ hostView: T,
722
379
  addFilter: l,
723
- removeFilter: d,
724
- toggleFilter: f,
725
- setStagePropAt: D,
380
+ removeFilter: f,
381
+ toggleFilter: m,
382
+ setStagePropAt: E,
726
383
  palette: g,
727
- showMod: n
384
+ showMod: a
728
385
  })
729
- ] }), o === "anim" && /* @__PURE__ */ Z(Y, { children: [
730
- /* @__PURE__ */ X(P, {
386
+ ] }), s === "anim" && /* @__PURE__ */ Q(Ct, { children: [
387
+ /* @__PURE__ */ Z(k, {
731
388
  schema: y.def.params,
732
389
  ...H,
733
390
  tab: "anim"
734
391
  }),
735
- /* @__PURE__ */ X(ae, {
392
+ /* @__PURE__ */ Z(ce, {
736
393
  inline: !0,
737
394
  def: y.def,
738
- view: E,
395
+ view: T,
739
396
  tab: "anim",
740
- onPatch: k
397
+ onPatch: O
741
398
  }),
742
- y.def.sweeps && /* @__PURE__ */ X(se, {
399
+ y.def.sweeps && /* @__PURE__ */ Z(V, {
743
400
  sweeps: Array.isArray(y.params.sweeps) ? y.params.sweeps : [],
744
- onChange: (e) => O("sweeps", e),
401
+ onChange: (e) => D("sweeps", e),
745
402
  inline: !0
746
403
  })
747
404
  ] })]
748
405
  });
749
406
  }
750
- function Rt({ chain: t, from: n = 0, layer: r, hostView: a, toggleFilter: o, removeFilter: s, setStagePropAt: c, palette: l, showMod: u }) {
751
- let d = i();
752
- return t.slice(n).map((t, i) => {
753
- let f = i + n, p = t.enabled !== !1, m = {
407
+ function Ft({ chain: t, from: n = 0, layer: i, hostView: a, toggleFilter: o, removeFilter: s, setStagePropAt: c, palette: l, showMod: u }) {
408
+ let d = r();
409
+ return t.slice(n).map((t, r) => {
410
+ let f = r + n, p = t.enabled !== !1, m = {
754
411
  ...a,
755
412
  ...t.params,
756
- id: r.id
413
+ id: i.id
757
414
  }, h = c(f);
758
- return /* @__PURE__ */ Z("div", {
415
+ return /* @__PURE__ */ Q("div", {
759
416
  className: "flex flex-col gap-2 p-2 rounded bg-oq-04",
760
- children: [/* @__PURE__ */ Z("div", {
417
+ children: [/* @__PURE__ */ Q("div", {
761
418
  className: "flex items-center gap-2",
762
- children: [/* @__PURE__ */ X(dt, {
419
+ children: [/* @__PURE__ */ Z(vt, {
763
420
  size: d,
764
421
  checked: p,
765
- onChange: () => o(r.id, f),
422
+ onChange: () => o(i.id, f),
766
423
  label: t.def?.label ?? t.id
767
- }), /* @__PURE__ */ X(ft, {
424
+ }), /* @__PURE__ */ Z(yt, {
768
425
  asChild: !0,
769
426
  label: "Remove effect",
770
- children: /* @__PURE__ */ X("button", {
427
+ children: /* @__PURE__ */ Z("button", {
771
428
  type: "button",
772
429
  "aria-label": "Remove effect",
773
- onClick: () => s(r.id, f),
430
+ onClick: () => s(i.id, f),
774
431
  className: "ml-auto inline-flex items-center justify-center w-5 h-5 shrink-0 text-oq-64 hover:text-emphasis cursor-pointer",
775
432
  style: {
776
433
  border: "none",
777
434
  background: "transparent"
778
435
  },
779
- children: /* @__PURE__ */ X(gt, {
436
+ children: /* @__PURE__ */ Z(wt, {
780
437
  name: "x",
781
438
  size: 12
782
439
  })
783
440
  })
784
441
  })]
785
- }), p && t.def && /* @__PURE__ */ X(P, {
442
+ }), p && t.def && /* @__PURE__ */ Z(k, {
786
443
  schema: t.def.params.filter((t) => e(t) !== "anim"),
787
444
  layer: m,
788
445
  setProp: h,
789
446
  palette: l,
790
447
  inline: !0,
791
- renderAnimate: u ? (e) => /* @__PURE__ */ X(le, {
448
+ renderAnimate: u ? (e) => /* @__PURE__ */ Z(B, {
792
449
  layer: m,
793
450
  param: e,
794
451
  setProp: h
@@ -797,18 +454,18 @@ function Rt({ chain: t, from: n = 0, layer: r, hostView: a, toggleFilter: o, rem
797
454
  }, t.key ?? f);
798
455
  });
799
456
  }
800
- function zt({ chain: e, layer: t, hostView: n, addFilter: r, removeFilter: a, toggleFilter: o, setStagePropAt: s, palette: c, showMod: l }) {
801
- let u = i(), d = [{
457
+ function It({ chain: e, layer: t, hostView: n, addFilter: i, removeFilter: a, toggleFilter: o, setStagePropAt: s, palette: c, showMod: l }) {
458
+ let u = r(), d = [{
802
459
  value: "",
803
460
  label: "Add FX..."
804
- }, ...B(re).map((e) => ({
461
+ }, ...ae(I).map((e) => ({
805
462
  value: e.id,
806
463
  label: e.label ?? e.id
807
464
  }))];
808
- return /* @__PURE__ */ Z(W, {
465
+ return /* @__PURE__ */ Q(_t, {
809
466
  label: "Post-Processing",
810
467
  divided: !0,
811
- children: [/* @__PURE__ */ X(Rt, {
468
+ children: [/* @__PURE__ */ Z(Ft, {
812
469
  chain: e,
813
470
  from: 1,
814
471
  layer: t,
@@ -818,7 +475,7 @@ function zt({ chain: e, layer: t, hostView: n, addFilter: r, removeFilter: a, to
818
475
  setStagePropAt: s,
819
476
  palette: c,
820
477
  showMod: l
821
- }), /* @__PURE__ */ X(lt, {
478
+ }), /* @__PURE__ */ Z(gt, {
822
479
  variant: "subtle",
823
480
  size: u,
824
481
  className: "w-full",
@@ -826,256 +483,267 @@ function zt({ chain: e, layer: t, hostView: n, addFilter: r, removeFilter: a, to
826
483
  value: "",
827
484
  disabled: e.length >= 8,
828
485
  onChange: (e) => {
829
- e && r(t.id, e);
486
+ e && i(t.id, e);
830
487
  }
831
488
  })]
832
489
  });
833
490
  }
834
- function Bt({ layer: e, showMod: t, tree: n }) {
835
- let r = i(), [a, o] = J("generate"), { updateLayer: c, palette: l } = p(), { setOnly: u } = Q(), d = I(e.id, { history: "coalesce" }), f = w(e.loopGroup).find((t) => t.id === e.presetId), m = D(e.loopGroup)?.label ?? "", g = e.loopGroup === "paratype" && f?.sub === "Glyphs" ? T("paratype", "Glyphs") : null, _ = g ? g.map((e) => ({
491
+ function Lt({ layer: e, showMod: t, tree: n }) {
492
+ let a = r(), [o, s] = X("generate"), { updateLayer: c, palette: l } = u(), { setOnly: d } = $(), f = M(e.id, { history: "coalesce" }), m = O(e.loopGroup).find((t) => t.id === e.presetId), h = te(e.loopGroup)?.label ?? "", g = e.loopGroup === "paratype" && m?.sub === "Glyphs" ? E("paratype", "Glyphs") : null, _ = g ? g.map((e) => ({
836
493
  value: e.id,
837
494
  label: e.label
838
495
  })) : null;
839
- return jt(() => {
840
- f && u(e.type, E(f, e.loopGroup));
496
+ return Ot(() => {
497
+ m && d(e.type, w(m, e.loopGroup));
841
498
  }, () => {
842
- let t = O(e.loopId)?.params ?? [];
843
- c(e.id, s(e, h(t, e), ee(), { withFilters: !0 }));
844
- }), /* @__PURE__ */ X(It, {
845
- title: m,
499
+ let t = re(e.loopId)?.params ?? [];
500
+ c(e.id, i(e, p(t, e), b(), { withFilters: !0 }));
501
+ }), /* @__PURE__ */ Z(Nt, {
502
+ title: h,
846
503
  chips: _,
847
504
  active: e.presetId,
848
505
  onPick: (t) => {
849
506
  let n = g?.find((e) => e.id === t);
850
- n && t !== e.presetId && u(e.type, E(n, e.loopGroup));
507
+ n && t !== e.presetId && d(e.type, w(n, e.loopGroup));
851
508
  },
852
509
  pills: !0,
853
- preStrip: e.loopGroup === "distress" ? /* @__PURE__ */ X(Dt, { layer: e }) : void 0,
854
- tabStrip: /* @__PURE__ */ X(G, {
855
- value: a,
856
- onChange: o,
857
- options: r === "sm" ? Nt : Pt,
858
- size: r,
859
- className: S(r)
510
+ tabStrip: /* @__PURE__ */ Z(q, {
511
+ value: o,
512
+ onChange: s,
513
+ options: a === "sm" ? At : jt,
514
+ size: a,
515
+ className: S(a)
860
516
  }),
861
- children: /* @__PURE__ */ X(M, {
517
+ children: /* @__PURE__ */ Z(P, {
862
518
  layer: e,
863
- setProp: d.setProp,
864
- patch: d.patch,
519
+ setProp: f.setProp,
520
+ patch: f.patch,
865
521
  updateLayer: c,
866
522
  palette: l,
867
- renderAnimate: t ? (t) => /* @__PURE__ */ X(le, {
523
+ renderAnimate: t ? (t) => /* @__PURE__ */ Z(B, {
868
524
  layer: e,
869
525
  param: t,
870
- setProp: d.setProp
526
+ setProp: f.setProp
871
527
  }) : void 0,
872
- tab: a,
528
+ tab: o,
873
529
  tabStrip: null,
874
530
  tree: n,
875
531
  inline: !0
876
532
  })
877
533
  });
878
534
  }
879
- function Vt({ layer: e, showMod: t }) {
880
- let n = i(), [r, a] = J("generate"), { updateLayer: o, palette: s } = p(), { setOnly: c } = Q(), l = I(e.id, { history: "coalesce" }), u = H.find((t) => t.id === e.presetId), d = fe.find((e) => e.subs.includes(u?.sub))?.label ?? "Kinetic";
881
- return jt(() => {
882
- u && c("kinetic", {
883
- presetId: u.id,
884
- presetLabel: u.label,
885
- comp: me(u)
535
+ function Rt({ layer: e, showMod: t }) {
536
+ let n = r(), [i, a] = X("generate"), { updateLayer: o, palette: s } = u(), { setOnly: c } = $(), l = M(e.id, { history: "coalesce" }), f = ue.find((t) => t.id === e.presetId), p = H.find((e) => e.subs.includes(f?.sub))?.label ?? "Kinetic";
537
+ return Ot(() => {
538
+ f && c("kinetic", {
539
+ presetId: f.id,
540
+ presetLabel: f.label,
541
+ comp: le(f)
886
542
  });
887
543
  }, () => {
888
- let t = ee(), n = m(t >>> 0), r = e.comp ?? { instances: [] };
544
+ let t = b(), n = d(t >>> 0), r = e.comp ?? { instances: [] };
889
545
  (r.instances ?? []).forEach((e, t) => {
890
- r = ue(r, t, n);
546
+ r = U(r, t, n);
891
547
  }), o(e.id, {
892
548
  comp: r,
893
549
  _rollSeed: t
894
550
  });
895
- }), /* @__PURE__ */ X(It, {
896
- title: d,
897
- tabStrip: /* @__PURE__ */ X(G, {
898
- value: r,
551
+ }), /* @__PURE__ */ Z(Nt, {
552
+ title: p,
553
+ tabStrip: /* @__PURE__ */ Z(q, {
554
+ value: i,
899
555
  onChange: a,
900
- options: n === "sm" ? Nt : Pt,
556
+ options: n === "sm" ? At : jt,
901
557
  size: n,
902
558
  className: S(n)
903
559
  }),
904
- children: /* @__PURE__ */ X(pe, {
560
+ children: /* @__PURE__ */ Z(fe, {
905
561
  layer: e,
906
562
  setProp: l.setProp,
907
563
  updateLayer: o,
908
564
  palette: s,
909
- renderAnimate: t ? (t) => /* @__PURE__ */ X(le, {
565
+ renderAnimate: t ? (t) => /* @__PURE__ */ Z(B, {
910
566
  layer: e,
911
567
  param: t,
912
568
  setProp: l.setProp
913
569
  }) : () => null,
914
- tab: r,
570
+ tab: i,
915
571
  tabStrip: null
916
572
  })
917
573
  });
918
574
  }
919
- function Ht() {
920
- let { layer: e } = Q(), t = !!_().labsModDots;
921
- return K(() => {
575
+ function zt() {
576
+ let { layer: e } = $(), t = !!h().labsModDots;
577
+ return J(() => {
922
578
  let e = (e) => {
923
579
  if (e.key !== "m" && e.key !== "M" || e.metaKey || e.ctrlKey || e.altKey) return;
924
580
  let t = e.target;
925
- t?.tagName === "INPUT" || t?.tagName === "TEXTAREA" || t?.isContentEditable || f("labsModDots", !y().labsModDots);
581
+ t?.tagName === "INPUT" || t?.tagName === "TEXTAREA" || t?.isContentEditable || l("labsModDots", !v().labsModDots);
926
582
  };
927
583
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
928
- }, []), e ? e.type === "photo" ? /* @__PURE__ */ X(Lt, {
584
+ }, []), e ? e.type === "photo" ? /* @__PURE__ */ Z(Pt, {
929
585
  layer: e,
930
586
  showMod: t
931
- }, e.id) : e.type === "loop" ? /* @__PURE__ */ X(Bt, {
587
+ }, e.id) : e.type === "loop" ? /* @__PURE__ */ Z(Lt, {
932
588
  layer: e,
933
589
  showMod: t
934
- }, e.id) : e.type === "misc" ? /* @__PURE__ */ X(Bt, {
590
+ }, e.id) : e.type === "misc" ? /* @__PURE__ */ Z(Lt, {
935
591
  layer: e,
936
592
  showMod: t,
937
- tree: j
938
- }, e.id) : e.type === "kinetic" ? /* @__PURE__ */ X(Vt, {
593
+ tree: N
594
+ }, e.id) : e.type === "kinetic" ? /* @__PURE__ */ Z(Rt, {
939
595
  layer: e,
940
596
  showMod: t
941
- }, e.id) : /* @__PURE__ */ X(F, { children: "This layer has no labs surface." }) : /* @__PURE__ */ X(F, { children: "Pick an effect or generator from the nav." });
597
+ }, e.id) : /* @__PURE__ */ Z(j, { children: "This layer has no labs surface." }) : /* @__PURE__ */ Z(j, { children: "Pick an effect or generator from the nav." });
942
598
  }
943
599
  //#endregion
944
- //#region src/editor/labs/LabsShortcuts.jsx
945
- var Ut = [
946
- ["0.5", "a plain value — stays put (normal slider)"],
947
- ["t", "counts up in seconds: 0, 1, 2 …"],
948
- ["t*0.1", "counts up slowly"],
949
- ["sin(t)", "smooth swing, -1 … 1"],
950
- ["sin(t*2)*0.5", "faster, smaller swing"],
951
- ["wave(t)", "bounce 0 → 1 → 0, once per second"],
952
- ["wave(t*0.5)*40", "bounce, scaled to 0 … 40"],
953
- ["saw(t)", "ramp 0 → 1, repeat"],
954
- ["tri(t)", "triangle 0 → 1 → 0"]
955
- ], Wt = [
956
- ["Oscillators · 0…1", "wave saw tri pulse(t,w) ease(t,c) bell step(t,n)"],
957
- ["Trig", "sin cos tan atan2"],
958
- ["Math", "abs floor ceil round sqrt pow"],
959
- ["Helpers", "clamp(x,a,b) lerp(a,b,u) mod(a,b) frac smooth"],
960
- ["Constants", "PI TAU PHI E"]
961
- ], Gt = () => [...Ne("labs").flatMap(({ items: e }) => e.map((e) => [Se(e.combo), e.label])), ["Esc", "close"]];
962
- function Kt() {
963
- let [e, t] = J(!1);
964
- return K(() => {
965
- let e = (e) => {
966
- let n = e.target;
967
- n?.tagName === "INPUT" || n?.tagName === "TEXTAREA" || n?.isContentEditable || (e.key === "Escape" && t(!1), (e.key === "s" || e.key === "S") && !e.metaKey && !e.ctrlKey && !e.altKey && (e.preventDefault(), t((e) => !e)));
968
- };
969
- return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
970
- }, []), e ? /* @__PURE__ */ X(ut, {
971
- open: !0,
972
- onClose: () => t(!1),
973
- children: /* @__PURE__ */ Z("div", {
974
- className: "flex flex-col",
975
- style: {
976
- width: 640,
977
- maxWidth: "100%"
600
+ //#region src/editor/labs/LabsSourcePicker.jsx
601
+ function Bt(e) {
602
+ let { patch: t } = M(e.id), n = Y(null), [r, i] = X(!1), a = e.type === "loop" && e.loopGroup === "distress";
603
+ return {
604
+ nodes: /* @__PURE__ */ Q(Ct, { children: [/* @__PURE__ */ Z("input", {
605
+ ref: n,
606
+ type: "file",
607
+ accept: a ? ".svg,image/svg+xml" : "image/*,video/*",
608
+ className: "hidden",
609
+ onChange: (n) => {
610
+ let r = n.target.files?.[0];
611
+ if (n.target.value = "", !r) return;
612
+ if (a) {
613
+ let e = new FileReader();
614
+ e.onload = () => t({ svgSrc: e.result }), e.readAsText(r);
615
+ return;
616
+ }
617
+ if (r.type.startsWith("video/")) {
618
+ y(e.id, r), t({
619
+ src: URL.createObjectURL(r),
620
+ srcType: "video"
621
+ });
622
+ return;
623
+ }
624
+ let i = new FileReader();
625
+ i.onload = () => t({
626
+ src: i.result,
627
+ srcType: "image"
628
+ }), i.readAsDataURL(r);
629
+ }
630
+ }), /* @__PURE__ */ Z(Ue, {
631
+ open: r,
632
+ onClose: () => i(!1),
633
+ onPick: (e, { contentType: n } = {}) => {
634
+ if (a) {
635
+ t({ svgSrc: rt(e) });
636
+ return;
637
+ }
638
+ t({
639
+ src: rt(e),
640
+ srcType: Ge(n) ? "video" : "image"
641
+ });
978
642
  },
979
- children: [/* @__PURE__ */ X("div", {
980
- className: "flex items-start justify-between px-6 pt-5",
981
- children: /* @__PURE__ */ Z("div", { children: [/* @__PURE__ */ X("p", {
982
- className: "kol-eyebrow text-meta mb-1",
983
- children: "Shortcuts"
984
- }), /* @__PURE__ */ X("p", {
985
- className: "kol-mono-16 text-emphasis",
986
- children: "Animate any value"
987
- })] })
988
- }), /* @__PURE__ */ Z("div", {
989
- className: "overflow-y-auto px-6 pb-6 flex flex-col gap-5",
990
- children: [
991
- /* @__PURE__ */ Z("p", {
992
- className: "kol-mono-12 text-body",
993
- children: [
994
- "Type math into any slider's number box instead of a number. It re-evaluates every frame, so the value animates — no keyframes.",
995
- " ",
996
- /* @__PURE__ */ X("span", {
997
- className: "text-emphasis",
998
- children: "t"
999
- }),
1000
- " is the playhead in seconds, so it pauses / scrubs / tempo-scales with the transport. Drag the slider to clear an expression."
1001
- ]
1002
- }),
1003
- /* @__PURE__ */ X(W, {
1004
- label: "Examples",
1005
- children: /* @__PURE__ */ X("div", {
1006
- className: "flex flex-col gap-1",
1007
- children: Ut.map(([e, t]) => /* @__PURE__ */ Z("div", {
1008
- className: "flex items-center gap-4",
1009
- children: [/* @__PURE__ */ X("code", {
1010
- className: "kol-mono-12 text-emphasis bg-oq-04 rounded px-2 py-0.5",
1011
- style: { minWidth: 132 },
1012
- children: e
1013
- }), /* @__PURE__ */ X("span", {
1014
- className: "kol-mono-12 text-body flex-1 min-w-0",
1015
- children: t
1016
- })]
1017
- }, e))
1018
- })
1019
- }),
1020
- /* @__PURE__ */ X(W, {
1021
- label: "Loop",
1022
- children: /* @__PURE__ */ Z("p", {
1023
- className: "kol-mono-12 text-body",
1024
- children: [
1025
- "The transport clock is a loop, not a BPM —",
1026
- " ",
1027
- /* @__PURE__ */ X("span", {
1028
- className: "text-emphasis",
1029
- children: "Loop / N s"
1030
- }),
1031
- " in the transport bar is the loop length in seconds, and every oscillator, sweep and export wraps seamlessly over it. Type a new length there; the default lives in Settings → Loop length."
1032
- ]
1033
- })
1034
- }),
1035
- /* @__PURE__ */ X(W, {
1036
- label: "Functions",
1037
- children: /* @__PURE__ */ X("div", {
1038
- className: "flex flex-col gap-2",
1039
- children: Wt.map(([e, t]) => /* @__PURE__ */ Z("div", { children: [/* @__PURE__ */ X("p", {
1040
- className: "kol-helper-10 text-subtle",
1041
- children: e
1042
- }), /* @__PURE__ */ X("p", {
1043
- className: "kol-mono-12 text-emphasis",
1044
- children: t
1045
- })] }, e))
1046
- })
1047
- }),
1048
- /* @__PURE__ */ X("div", {
1049
- className: "pt-3 border-t border-oq-08 flex flex-wrap gap-x-5 gap-y-1",
1050
- children: Gt().map(([e, t]) => /* @__PURE__ */ Z("span", {
1051
- className: "kol-mono-12",
1052
- children: [
1053
- /* @__PURE__ */ X("span", {
1054
- className: "text-emphasis",
1055
- children: e
1056
- }),
1057
- " ",
1058
- /* @__PURE__ */ X("span", {
1059
- className: "text-meta",
1060
- children: t
1061
- })
1062
- ]
1063
- }, e))
1064
- })
1065
- ]
1066
- })]
643
+ accept: a ? "svg" : "all"
644
+ })] }),
645
+ svgMode: a,
646
+ openLibrary: () => i(!0),
647
+ openUpload: () => n.current?.click(),
648
+ openCamera: () => {
649
+ Ke(e.id).then(() => t({
650
+ src: null,
651
+ srcType: "webcam"
652
+ })).catch(() => {});
653
+ }
654
+ };
655
+ }
656
+ [
657
+ {
658
+ value: "library",
659
+ label: "Library"
660
+ },
661
+ {
662
+ value: "upload",
663
+ label: "Upload"
664
+ },
665
+ {
666
+ value: "camera",
667
+ label: "Camera"
668
+ }
669
+ ].slice(0, 2);
670
+ function Vt({ layer: e }) {
671
+ let t = Bt(e);
672
+ return /* @__PURE__ */ Q("div", {
673
+ className: "flex flex-col gap-2",
674
+ children: [
675
+ /* @__PURE__ */ Z(K, {
676
+ tone: "primary",
677
+ size: "lg",
678
+ className: W,
679
+ iconLeft: "image",
680
+ iconRight: "image",
681
+ onClick: t.openLibrary,
682
+ children: "From library"
683
+ }),
684
+ /* @__PURE__ */ Z(K, {
685
+ tone: "primary",
686
+ size: "lg",
687
+ className: W,
688
+ iconLeft: "upload",
689
+ iconRight: "upload",
690
+ onClick: t.openUpload,
691
+ children: "Upload"
692
+ }),
693
+ !t.svgMode && /* @__PURE__ */ Z(K, {
694
+ tone: "primary",
695
+ size: "lg",
696
+ className: "w-full [&>span]:w-full [&>span]:justify-between",
697
+ iconLeft: "camera",
698
+ iconRight: "camera",
699
+ onClick: t.openCamera,
700
+ children: "Camera"
701
+ }),
702
+ t.nodes
703
+ ]
704
+ });
705
+ }
706
+ function Ht({ layer: e, title: t, onBack: n }) {
707
+ return Ae(n), /* @__PURE__ */ Z("div", {
708
+ 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",
709
+ style: { zIndex: "var(--kol-z-modal)" },
710
+ children: /* @__PURE__ */ Q("div", {
711
+ className: "my-auto w-full max-w-sm rounded p-8 flex flex-col gap-6",
712
+ style: { background: "var(--kol-surface-primary)" },
713
+ children: [
714
+ /* @__PURE__ */ Q("div", {
715
+ className: "flex flex-col gap-2",
716
+ children: [/* @__PURE__ */ Z("span", {
717
+ className: "kol-eyebrow text-body",
718
+ children: t
719
+ }), /* @__PURE__ */ Z("span", {
720
+ className: "kol-mono-12 text-meta",
721
+ children: "Pick the media it works on."
722
+ })]
723
+ }),
724
+ /* @__PURE__ */ Z(Vt, { layer: e }),
725
+ /* @__PURE__ */ Z(K, {
726
+ tone: "grey",
727
+ size: "lg",
728
+ className: W,
729
+ iconLeft: "arrow-left",
730
+ iconRight: "arrow-left",
731
+ onClick: n,
732
+ children: "Back"
733
+ })
734
+ ]
1067
735
  })
1068
- }) : null;
736
+ });
1069
737
  }
1070
738
  //#endregion
1071
739
  //#region src/editor/components/PanelHeader.jsx
1072
- function qt({ title: e, onCollapse: t, action: n, className: r = "px-3" }) {
1073
- return /* @__PURE__ */ Z("div", {
740
+ function Ut({ title: e, onCollapse: t, action: n, className: r = "px-3" }) {
741
+ return /* @__PURE__ */ Q("div", {
1074
742
  className: `flex w-full shrink-0 items-center ${r}`,
1075
- children: [/* @__PURE__ */ Z("button", {
743
+ children: [/* @__PURE__ */ Q("button", {
1076
744
  className: "kol-helper-12 text-meta flex flex-1 items-center gap-2 py-2.5",
1077
745
  onClick: t,
1078
- children: [/* @__PURE__ */ X("span", { children: e }), /* @__PURE__ */ X(gt, {
746
+ children: [/* @__PURE__ */ Z("span", { children: e }), /* @__PURE__ */ Z(wt, {
1079
747
  name: "chevron-down",
1080
748
  size: 16,
1081
749
  className: "text-oq-48"
@@ -1083,16 +751,16 @@ function qt({ title: e, onCollapse: t, action: n, className: r = "px-3" }) {
1083
751
  }), n]
1084
752
  });
1085
753
  }
1086
- function Jt({ label: e, onOpen: t, size: n = "lg", tone: r = "primary", children: i }) {
1087
- return /* @__PURE__ */ Z("div", {
754
+ function Wt({ label: e, onOpen: t, size: n = "lg", tone: r = "primary", children: i }) {
755
+ return /* @__PURE__ */ Q("div", {
1088
756
  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-wrap-reverse gap-2 px-3 [&>*]:pointer-events-auto",
1089
- children: [/* @__PURE__ */ X(U, {
757
+ children: [/* @__PURE__ */ Z(K, {
1090
758
  tone: r,
1091
759
  size: n,
1092
760
  onClick: t,
1093
- children: /* @__PURE__ */ Z("span", {
761
+ children: /* @__PURE__ */ Q("span", {
1094
762
  className: "flex items-center gap-2",
1095
- children: [e, /* @__PURE__ */ X(gt, {
763
+ children: [e, /* @__PURE__ */ Z(wt, {
1096
764
  name: "chevron-down",
1097
765
  size: 16,
1098
766
  className: "rotate-180"
@@ -1101,122 +769,189 @@ function Jt({ label: e, onOpen: t, size: n = "lg", tone: r = "primary", children
1101
769
  }), i]
1102
770
  });
1103
771
  }
772
+ var Gt = {
773
+ half: "50dvh",
774
+ tall: "85dvh"
775
+ };
776
+ function Kt({ tall: e, onToggle: t, onDrag: n }) {
777
+ let r = Y({
778
+ y: null,
779
+ moved: !1,
780
+ swallow: !1
781
+ }).current;
782
+ return /* @__PURE__ */ Z("button", {
783
+ type: "button",
784
+ "aria-label": e ? "Lower the sheet" : "Raise the sheet",
785
+ "aria-pressed": e,
786
+ className: "flex h-6 w-full shrink-0 touch-none items-center justify-center",
787
+ onPointerDown: (e) => {
788
+ r.y = e.clientY, r.moved = !1, e.currentTarget.setPointerCapture?.(e.pointerId);
789
+ },
790
+ onPointerMove: (e) => {
791
+ r.y !== null && Math.abs(e.clientY - r.y) > 32 && (r.moved = !0);
792
+ },
793
+ onPointerUp: (e) => {
794
+ if (r.y === null) return;
795
+ let t = e.clientY - r.y;
796
+ r.y = null, r.moved && n && (n(t < 0 ? -1 : 1), r.swallow = !0);
797
+ },
798
+ onPointerCancel: () => {
799
+ r.y = null;
800
+ },
801
+ onClick: () => {
802
+ if (r.swallow) {
803
+ r.swallow = !1;
804
+ return;
805
+ }
806
+ t?.();
807
+ },
808
+ children: /* @__PURE__ */ Z("span", { className: "h-1 w-9 rounded-full bg-oq-16" })
809
+ });
810
+ }
811
+ //#endregion
812
+ //#region src/editor/labs/LabsCatalogCard.jsx
813
+ function qt({ onPicked: e, onClose: t }) {
814
+ let { items: n, dispatch: r } = Je(), [i, a] = X(null);
815
+ Ae(t);
816
+ let o = n.filter((e) => e.path !== "#rail/sec:modulation"), s = o.find((e) => e.path === i) ?? null, c = s ? s.sub : o;
817
+ return /* @__PURE__ */ Z("div", {
818
+ 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",
819
+ style: { zIndex: "var(--kol-z-modal)" },
820
+ children: /* @__PURE__ */ Q("div", {
821
+ className: "my-auto w-full max-w-sm rounded p-8 flex flex-col gap-6",
822
+ style: { background: "var(--kol-surface-primary)" },
823
+ children: [/* @__PURE__ */ Z("span", {
824
+ className: "kol-eyebrow text-body",
825
+ children: s ? s.label : "Labs"
826
+ }), /* @__PURE__ */ Q("div", {
827
+ className: "flex flex-col gap-2",
828
+ children: [c.map((t) => /* @__PURE__ */ Z(K, {
829
+ tone: "primary",
830
+ size: "lg",
831
+ className: W,
832
+ iconLeft: t.icon,
833
+ iconRight: t.icon,
834
+ onClick: () => {
835
+ if (!s && t.sub?.length) {
836
+ a(t.path);
837
+ return;
838
+ }
839
+ r?.(t.path) && e?.();
840
+ },
841
+ children: t.label
842
+ }, t.path)), s && /* @__PURE__ */ Z(K, {
843
+ tone: "grey",
844
+ size: "lg",
845
+ className: "w-full [&>span]:w-full [&>span]:justify-between",
846
+ iconLeft: "arrow-left",
847
+ iconRight: "arrow-left",
848
+ onClick: () => a(null),
849
+ children: "Back"
850
+ })]
851
+ })]
852
+ })
853
+ });
854
+ }
1104
855
  //#endregion
1105
856
  //#region src/editor/labs/sheetLabels.js
1106
- function Yt(e) {
857
+ function Jt(e) {
1107
858
  if (!e) return {
1108
859
  title: "Labs",
1109
860
  pill: "Labs"
1110
861
  };
1111
862
  if (e.type === "loop" || e.type === "misc") return {
1112
- title: `${D(e.loopGroup)?.label ?? "Labs"} · ${e.presetLabel}`,
863
+ title: `${te(e.loopGroup)?.label ?? "Labs"} · ${e.presetLabel}`,
1113
864
  pill: e.presetLabel
1114
865
  };
1115
866
  if (e.type === "photo") {
1116
- let t = r(e)[0]?.def?.label ?? "Media";
867
+ let n = t(e)[0]?.def?.label ?? "Media";
1117
868
  return {
1118
- title: t,
1119
- pill: t
869
+ title: n,
870
+ pill: n
1120
871
  };
1121
872
  }
1122
- let t = e.presetLabel ?? "Labs";
873
+ let n = e.presetLabel ?? "Labs";
1123
874
  return {
1124
- title: t,
1125
- pill: t
875
+ title: n,
876
+ pill: n
1126
877
  };
1127
878
  }
1128
879
  //#endregion
1129
880
  //#region src/editor/labs/LabsView.jsx
1130
- var Xt = .85, Zt = .3, Qt = 2.5, $t = {
881
+ var Yt = .85, Xt = .3, Zt = 2.5, Qt = {
1131
882
  0: 1,
1132
883
  1: .5,
1133
884
  2: 1,
1134
885
  3: 1.5,
1135
886
  4: 2
1136
- }, en = "px-2 py-1 rounded border border-oq-08 bg-surface-secondary kol-mono-12 text-emphasis tabular-nums";
1137
- function tn() {
1138
- let { layer: e } = Q(), t = e?.type === "photo" && !e.src && e.srcType !== "webcam", [n, r] = J(1), [i, a] = J(!1), o = st(i), s = q(null), c = (e) => Math.min(Qt, Math.max(Zt, e)), l = (e) => r((t) => c(t * (e > 0 ? 1.25 : .8))), { tool: u } = Qe(), d = u === "orbit", f = q(d);
1139
- return f.current = d, K(() => {
1140
- let e = s.current;
887
+ }, $t = "px-2 py-1 rounded border border-oq-08 bg-surface-secondary kol-mono-12 text-emphasis tabular-nums";
888
+ function en() {
889
+ let { layer: e } = $(), { removeLayer: t } = u(), n = e?.type === "photo" && !e.src && e.srcType !== "webcam", [r, i] = X(1), [a, o] = X(!1), s = ve(a), c = Y(null), l = (e) => Math.min(Zt, Math.max(Xt, e)), d = (e) => i((t) => l(t * (e > 0 ? 1.25 : .8))), { tool: f } = ye(), p = f === "orbit", m = Y(p);
890
+ return m.current = p, J(() => {
891
+ let e = c.current;
1141
892
  if (!e) return;
1142
893
  let t = (e) => {
1143
- f.current || (e.preventDefault(), r((t) => c(t * (e.deltaY > 0 ? .94 : 1.06))));
894
+ m.current || (e.preventDefault(), i((t) => l(t * (e.deltaY > 0 ? .94 : 1.06))));
1144
895
  };
1145
896
  return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
1146
- }, []), K(() => {
897
+ }, []), J(() => {
1147
898
  let e = (e) => {
1148
899
  if (e.metaKey || e.ctrlKey || e.altKey) return;
1149
900
  let t = e.target;
1150
901
  if (!(t?.tagName === "INPUT" || t?.tagName === "TEXTAREA" || t?.isContentEditable)) {
1151
902
  if (e.key === "f" || e.key === "F") {
1152
- a((e) => !e);
903
+ o((e) => !e);
904
+ return;
905
+ }
906
+ if (e.key === "-" || e.key === "_") {
907
+ d(-1);
908
+ return;
909
+ }
910
+ if (e.key === "+" || e.key === "=") {
911
+ d(1);
1153
912
  return;
1154
913
  }
1155
- $t[e.key] !== void 0 && r($t[e.key]);
914
+ Qt[e.key] !== void 0 && i(Qt[e.key]);
1156
915
  }
1157
916
  };
1158
917
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
1159
- }, []), /* @__PURE__ */ Z("div", {
1160
- ref: s,
918
+ }, []), /* @__PURE__ */ Q("div", {
919
+ ref: c,
1161
920
  className: "relative w-full h-full flex items-center justify-center",
1162
921
  style: { background: "var(--kol-surface-secondary)" },
1163
- onDoubleClick: () => r(1),
1164
- children: [t ? /* @__PURE__ */ X(At, { layer: e }) : /* @__PURE__ */ X("div", {
1165
- style: {
1166
- width: `${n * Xt * 100}%`,
1167
- height: `${n * Xt * 100}%`
1168
- },
1169
- children: /* @__PURE__ */ X(nt, {})
1170
- }), /* @__PURE__ */ Z("div", {
1171
- className: "absolute bottom-3 right-3 z-[3] flex items-center gap-2 [@media(pointer:coarse)]:bottom-1",
1172
- children: [
1173
- /* @__PURE__ */ X(ft, {
1174
- label: "Zoom out",
1175
- children: /* @__PURE__ */ X("button", {
1176
- "aria-label": "Zoom out",
1177
- type: "button",
1178
- className: en,
1179
- onClick: () => l(-1),
1180
- children: "−"
1181
- })
1182
- }),
1183
- /* @__PURE__ */ X(ft, {
1184
- label: "Reset zoom (0)",
1185
- children: /* @__PURE__ */ Z("button", {
1186
- "aria-label": "Reset zoom (0)",
1187
- type: "button",
1188
- className: en,
1189
- onClick: () => r(1),
1190
- children: [Math.round(n * 100), "%"]
1191
- })
1192
- }),
1193
- /* @__PURE__ */ X(ft, {
1194
- label: "Zoom in",
1195
- children: /* @__PURE__ */ X("button", {
1196
- "aria-label": "Zoom in",
1197
- type: "button",
1198
- className: en,
1199
- onClick: () => l(1),
1200
- children: "+"
1201
- })
1202
- }),
1203
- i && /* @__PURE__ */ X(ft, {
922
+ onDoubleClick: () => i(1),
923
+ children: [
924
+ /* @__PURE__ */ Z("div", {
925
+ style: {
926
+ width: `${r * Yt * 100}%`,
927
+ height: `${r * Yt * 100}%`
928
+ },
929
+ children: /* @__PURE__ */ Z(Be, {})
930
+ }),
931
+ n && /* @__PURE__ */ Z(Ht, {
932
+ layer: e,
933
+ title: Jt(e).title,
934
+ onBack: () => t(e.id)
935
+ }),
936
+ a && /* @__PURE__ */ Z("div", {
937
+ className: "absolute bottom-3 right-3 z-[3] flex items-center gap-2 [@media(pointer:coarse)]:bottom-1",
938
+ children: /* @__PURE__ */ Z(yt, {
1204
939
  label: "Framerate — press F to hide",
1205
- children: /* @__PURE__ */ Z("span", {
1206
- className: en,
1207
- children: [o, " fps"]
940
+ children: /* @__PURE__ */ Q("span", {
941
+ className: $t,
942
+ children: [s, " fps"]
1208
943
  })
1209
944
  })
1210
- ]
1211
- })]
945
+ })
946
+ ]
1212
947
  });
1213
948
  }
1214
- function nn() {
1215
- let e = q(null), { grabProps: t } = _t(e, {
949
+ function tn() {
950
+ let e = Y(null), { grabProps: t } = Tt(e, {
1216
951
  token: "kol-rail",
1217
952
  side: "right"
1218
953
  });
1219
- return K(() => {
954
+ return J(() => {
1220
955
  let e = document.documentElement, t = !1, n = () => {
1221
956
  let t = parseFloat(getComputedStyle(e).getPropertyValue("--kol-shell-rail-width"));
1222
957
  return Number.isFinite(t) ? t <= 49 : null;
@@ -1253,36 +988,52 @@ function nn() {
1253
988
  }), () => {
1254
989
  c.disconnect(), l.disconnect();
1255
990
  };
1256
- }, []), /* @__PURE__ */ Z("div", {
991
+ }, []), /* @__PURE__ */ Q("div", {
1257
992
  ref: e,
1258
993
  className: "kol-compose-rail kol-compose-rail--inspector",
1259
- children: [/* @__PURE__ */ X("div", { ...t }), /* @__PURE__ */ X("div", {
994
+ children: [/* @__PURE__ */ Z("div", { ...t }), /* @__PURE__ */ Z("div", {
1260
995
  className: "kol-compose-inspector-body",
1261
- children: /* @__PURE__ */ X(Ht, {})
996
+ children: /* @__PURE__ */ Z(zt, {})
1262
997
  })]
1263
998
  });
1264
999
  }
1265
- var rn = pt(null);
1266
- function an() {
1267
- let { collapseParams: e } = ht(rn), { layer: t } = Q();
1268
- return /* @__PURE__ */ X(qt, {
1269
- title: Yt(t).title,
1000
+ var nn = bt(null);
1001
+ function rn() {
1002
+ let { collapseParams: e, catalog: t, toggleCatalog: n } = St(nn), { layer: r } = $(), i = /* @__PURE__ */ Z("button", {
1003
+ className: "kol-helper-12 text-meta py-2.5",
1004
+ "aria-pressed": t,
1005
+ onClick: n,
1006
+ children: "Catalog"
1007
+ });
1008
+ return /* @__PURE__ */ Z(Ut, {
1009
+ title: Jt(r).title,
1270
1010
  onCollapse: e,
1271
- className: "px-4"
1011
+ className: "px-4",
1012
+ action: i
1013
+ });
1014
+ }
1015
+ function an() {
1016
+ let { tall: e, setTall: t, collapseParams: n } = St(nn);
1017
+ return /* @__PURE__ */ Z(Kt, {
1018
+ tall: e,
1019
+ onToggle: () => t((e) => !e),
1020
+ onDrag: (r) => {
1021
+ r < 0 ? t(!0) : e ? t(!1) : n();
1022
+ }
1272
1023
  });
1273
1024
  }
1274
1025
  function on() {
1275
- return /* @__PURE__ */ X("div", {
1026
+ return /* @__PURE__ */ Z("div", {
1276
1027
  className: "kol-compose-rail kol-compose-rail--inspector",
1277
- children: /* @__PURE__ */ X("div", {
1028
+ children: /* @__PURE__ */ Z("div", {
1278
1029
  className: "kol-compose-inspector-body",
1279
- children: /* @__PURE__ */ X(Ht, {})
1030
+ children: /* @__PURE__ */ Z(zt, {})
1280
1031
  })
1281
1032
  });
1282
1033
  }
1283
1034
  var sn = {
1284
1035
  topbar: () => null,
1285
- canvas: tn,
1036
+ canvas: en,
1286
1037
  panels: [
1287
1038
  {
1288
1039
  slot: "canvas.footer",
@@ -1292,197 +1043,161 @@ var sn = {
1292
1043
  {
1293
1044
  slot: "right.body",
1294
1045
  order: 0,
1295
- Component: nn
1046
+ Component: tn
1296
1047
  },
1297
1048
  {
1298
1049
  slot: "right.footer",
1299
1050
  order: 0,
1300
- Component: Je
1051
+ Component: Qe
1301
1052
  }
1302
1053
  ]
1303
1054
  }, cn = {
1304
1055
  ...sn,
1305
- panels: [{
1306
- slot: "right.header",
1307
- order: 0,
1308
- Component: an
1309
- }, ...sn.panels.map((e) => e.Component === nn ? {
1310
- ...e,
1311
- Component: on
1312
- } : e)]
1056
+ panels: [
1057
+ {
1058
+ slot: "right.header",
1059
+ order: 0,
1060
+ Component: an
1061
+ },
1062
+ {
1063
+ slot: "right.header",
1064
+ order: 1,
1065
+ Component: rn
1066
+ },
1067
+ ...sn.panels.map((e) => e.Component === tn ? {
1068
+ ...e,
1069
+ Component: on
1070
+ } : e)
1071
+ ]
1313
1072
  };
1314
1073
  function ln() {
1315
- let { setAspect: e, selectedId: n, select: r } = p(), { layer: i, setOnly: a } = Q(), o = q(!1), s = $e() && !Xe(), [c, u] = J(!0);
1316
- K(() => {
1317
- if (!s) return;
1318
- let e = () => u(!0);
1074
+ let { setAspect: e, selectedId: t, select: r } = u(), { layer: i, setOnly: a } = $(), s = Y(!1), c = it(xe), l = Fe() && !Le() || c;
1075
+ J(() => {
1076
+ l && document.documentElement.removeAttribute("data-rail");
1077
+ }, [l]);
1078
+ let [d, f] = X(!0), [p, m] = X(!1), [h, g] = X(() => !i);
1079
+ J(() => {
1080
+ g(!i);
1081
+ }, [i?.id]), J(() => {
1082
+ i && !l && document.documentElement.removeAttribute("data-rail");
1083
+ }, [i?.id]), J(() => {
1084
+ if (!l) return;
1085
+ let e = () => f(!0);
1319
1086
  return window.addEventListener("kol:open-params", e), window.addEventListener("kol:open-effects", e), () => {
1320
1087
  window.removeEventListener("kol:open-params", e), window.removeEventListener("kol:open-effects", e);
1321
1088
  };
1322
- }, [s]), Pe(), K(() => {
1323
- if (o.current) return;
1324
- o.current = !0;
1325
- let n = y();
1326
- n.defaultAspect && n.defaultAspect !== "custom" && e(n.defaultAspect), n.defaultLoopSeconds && t.setLoopSeconds(n.defaultLoopSeconds);
1089
+ }, [l]), De(), J(() => (tt("labs"), () => tt(null)), []), J(() => {
1090
+ if (s.current) return;
1091
+ s.current = !0;
1092
+ let t = v();
1093
+ t.defaultAspect && t.defaultAspect !== "custom" && e(t.defaultAspect), t.defaultLoopSeconds && n.setLoopSeconds(t.defaultLoopSeconds);
1327
1094
  }, []);
1328
- let d = q(!1);
1329
- K(() => {
1330
- if (d.current) return;
1331
- d.current = !0;
1332
- let e = new URLSearchParams(window.location.search).get("preset"), t = e ? k(e) : null;
1333
- t && a("loop", E(C(e), t));
1095
+ let _ = Y(!1);
1096
+ J(() => {
1097
+ if (_.current) return;
1098
+ _.current = !0;
1099
+ let e = new URLSearchParams(window.location.search).get("preset"), t = e ? A(e) : null;
1100
+ t && a("loop", w(ne(e), t));
1334
1101
  }, [a]);
1335
- let { tool: f, setTool: m } = Qe(), h = q(f);
1336
- return h.current = f, K(() => {
1102
+ let { tool: y, setTool: b } = ye(), x = Y(y);
1103
+ return x.current = y, J(() => {
1337
1104
  let e = (e) => {
1338
- let n = e.target;
1339
- if (!(n?.tagName === "INPUT" || n?.tagName === "TEXTAREA" || n?.isContentEditable)) {
1105
+ let t = e.target;
1106
+ if (!(t?.tagName === "INPUT" || t?.tagName === "TEXTAREA" || t?.isContentEditable)) {
1340
1107
  if (e.code === "Space") {
1341
- e.preventDefault(), t.toggle();
1108
+ e.preventDefault(), n.toggle();
1342
1109
  return;
1343
1110
  }
1344
- (e.key === "c" || e.key === "C") && !e.metaKey && !e.ctrlKey && !e.altKey && m(h.current === "orbit" ? "select" : "orbit");
1111
+ if ((e.key === "s" || e.key === "S") && !e.metaKey && !e.ctrlKey && !e.altKey) {
1112
+ window.dispatchEvent(new CustomEvent("kol:show-shortcuts"));
1113
+ return;
1114
+ }
1115
+ (e.key === "c" || e.key === "C") && !e.metaKey && !e.ctrlKey && !e.altKey && b(x.current === "orbit" ? "select" : "orbit");
1345
1116
  }
1346
1117
  };
1347
1118
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
1348
- }, [m]), K(() => {
1119
+ }, [b]), J(() => {
1349
1120
  if (!i?.presetId) return;
1350
1121
  let e = new URLSearchParams(window.location.search);
1351
1122
  e.get("preset") !== i.presetId && (e.set("view", "labs"), e.set("preset", i.presetId), i.loopGroup ? e.set("cat", i.loopGroup) : e.delete("cat"), window.history.replaceState(null, "", `${window.location.pathname}?${e}`));
1352
- }, [i?.presetId, i?.loopGroup]), K(() => {
1353
- i && n !== i.id && r(i.id);
1123
+ }, [i?.presetId, i?.loopGroup]), J(() => {
1124
+ i && t !== i.id && r(i.id);
1354
1125
  }, [
1355
1126
  i,
1356
- n,
1127
+ t,
1357
1128
  r
1358
- ]), /* @__PURE__ */ Z("div", {
1129
+ ]), /* @__PURE__ */ Q("div", {
1359
1130
  className: "kol-editor-labs contents",
1360
- "data-touch": s || void 0,
1361
- "data-params": c ? "open" : void 0,
1131
+ "data-touch": l || void 0,
1132
+ "data-params": d ? "open" : void 0,
1133
+ "data-empty": i ? void 0 : "",
1134
+ style: p ? { "--kol-sheet-h": Gt.tall } : void 0,
1362
1135
  children: [
1363
- /* @__PURE__ */ X(Tt, {}),
1364
- s ? /* @__PURE__ */ Z(rn.Provider, {
1365
- value: { collapseParams: () => u(!1) },
1366
- children: [/* @__PURE__ */ X(l.Provider, {
1136
+ /* @__PURE__ */ Z(Dt, {}),
1137
+ l ? /* @__PURE__ */ Q(nn.Provider, {
1138
+ value: {
1139
+ collapseParams: () => f(!1),
1140
+ tall: p,
1141
+ setTall: m,
1142
+ catalog: h,
1143
+ toggleCatalog: () => g((e) => !e)
1144
+ },
1145
+ children: [/* @__PURE__ */ Z(o.Provider, {
1367
1146
  value: "md",
1368
- children: /* @__PURE__ */ X(je, { registry: cn })
1369
- }), !c && /* @__PURE__ */ X(Jt, {
1147
+ children: /* @__PURE__ */ Z(ze, { registry: cn })
1148
+ }), !d && /* @__PURE__ */ Z(Wt, {
1370
1149
  tone: "grey",
1371
- label: Yt(i).pill,
1372
- onOpen: () => u(!0)
1150
+ label: Jt(i).pill,
1151
+ onOpen: () => f(!0)
1373
1152
  })]
1374
- }) : /* @__PURE__ */ X(je, { registry: sn }),
1375
- /* @__PURE__ */ X(Kt, {})
1153
+ }) : /* @__PURE__ */ Z(ze, { registry: sn }),
1154
+ h && /* @__PURE__ */ Z(qt, {
1155
+ onPicked: () => g(!1),
1156
+ onClose: () => g(!1)
1157
+ })
1376
1158
  ]
1377
1159
  });
1378
1160
  }
1379
1161
  var un = "kol.editor.labs-draft";
1380
1162
  function dn() {
1381
- return /* @__PURE__ */ X(Ze, {
1163
+ return /* @__PURE__ */ Z(He, {
1382
1164
  draftKey: un,
1383
- children: /* @__PURE__ */ X(ln, {})
1384
- });
1385
- }
1386
- //#endregion
1387
- //#region src/editor/mobile/CategoryScreen.jsx
1388
- var fn = "w-full [&>span]:w-full [&>span]:justify-between";
1389
- function pn(e) {
1390
- K(() => {
1391
- let t = (t) => {
1392
- t.key === "Escape" && e?.();
1393
- };
1394
- return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
1395
- }, [e]), K(() => {
1396
- let e = t.isPlaying();
1397
- return t.pause(), () => {
1398
- e && t.play();
1399
- };
1400
- }, []);
1401
- }
1402
- function mn({ onPick: e, onInsert: t, onBack: n, onDismiss: r }) {
1403
- return pn(r ?? n), /* @__PURE__ */ X("div", {
1404
- 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",
1405
- style: { zIndex: "var(--kol-z-modal)" },
1406
- children: /* @__PURE__ */ Z("div", {
1407
- className: "my-auto w-full max-w-sm rounded p-8 flex flex-col gap-6",
1408
- style: { background: "var(--kol-surface-primary)" },
1409
- children: [
1410
- /* @__PURE__ */ X("div", {
1411
- className: "kol-eyebrow text-body",
1412
- children: "Pick a generator"
1413
- }),
1414
- /* @__PURE__ */ X("div", {
1415
- className: "flex flex-col gap-2",
1416
- children: N.map((t) => {
1417
- let n = $[`gen:${t.label}`] ?? "square";
1418
- return /* @__PURE__ */ X(U, {
1419
- tone: "primary",
1420
- size: "lg",
1421
- className: fn,
1422
- iconLeft: n,
1423
- iconRight: n,
1424
- onClick: () => e(t),
1425
- children: t.label
1426
- }, t.label);
1427
- })
1428
- }),
1429
- /* @__PURE__ */ Z("div", {
1430
- className: "flex flex-col gap-2",
1431
- children: [t && /* @__PURE__ */ X(U, {
1432
- tone: "grey",
1433
- size: "lg",
1434
- className: "w-full [&>span]:w-full [&>span]:justify-between",
1435
- iconLeft: "image",
1436
- iconRight: "image",
1437
- onClick: t,
1438
- children: "Insert image or video"
1439
- }), n && /* @__PURE__ */ X(U, {
1440
- tone: "grey",
1441
- size: "lg",
1442
- className: "w-full [&>span]:w-full [&>span]:justify-between",
1443
- iconLeft: "arrow-left",
1444
- iconRight: "arrow-left",
1445
- onClick: n,
1446
- children: "Back"
1447
- })]
1448
- })
1449
- ]
1450
- })
1165
+ children: /* @__PURE__ */ Z(ln, {})
1451
1166
  });
1452
1167
  }
1453
1168
  //#endregion
1454
1169
  //#region src/editor/mobile/EffectScreen.jsx
1455
- function hn({ layer: e, chain: t, onPick: n, onBack: r }) {
1456
- let [i, a] = J(null);
1457
- pn(r);
1458
- let { engineHost: o } = ce(e), s = o && !t.some((e) => e.def?.kind === "engine"), c = R(re.filter((e) => e.kind !== "engine" || s)), l = c.find((e) => e.id === i) ?? null;
1459
- return /* @__PURE__ */ X("div", {
1170
+ function fn({ layer: e, chain: t, onPick: n, onBack: r }) {
1171
+ let [i, a] = X(null);
1172
+ Ae(r);
1173
+ let { engineHost: o } = L(e), s = o && !t.some((e) => e.def?.kind === "engine"), c = F(I.filter((e) => e.kind !== "engine" || s)), l = c.find((e) => e.id === i) ?? null;
1174
+ return /* @__PURE__ */ Z("div", {
1460
1175
  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",
1461
1176
  style: { zIndex: "var(--kol-z-modal)" },
1462
- children: /* @__PURE__ */ Z("div", {
1177
+ children: /* @__PURE__ */ Q("div", {
1463
1178
  className: "my-auto w-full max-w-sm rounded p-8 flex flex-col gap-6",
1464
1179
  style: { background: "var(--kol-surface-primary)" },
1465
1180
  children: [
1466
- /* @__PURE__ */ X("div", {
1181
+ /* @__PURE__ */ Z("div", {
1467
1182
  className: "kol-eyebrow text-body",
1468
1183
  children: l ? l.label : "Pick an effect"
1469
1184
  }),
1470
- /* @__PURE__ */ X("div", {
1185
+ /* @__PURE__ */ Z("div", {
1471
1186
  className: "flex flex-col gap-2",
1472
- children: (l ? l.filters : c).map((e) => /* @__PURE__ */ X(U, {
1187
+ children: (l ? l.filters : c).map((e) => /* @__PURE__ */ Z(K, {
1473
1188
  tone: "primary",
1474
1189
  size: "lg",
1475
- className: fn,
1190
+ className: W,
1476
1191
  iconLeft: l ? "filter" : "chevron-right",
1477
1192
  iconRight: l ? "filter" : "chevron-right",
1478
1193
  onClick: () => l ? n(e.id) : a(e.id),
1479
1194
  children: e.label
1480
1195
  }, e.id))
1481
1196
  }),
1482
- /* @__PURE__ */ X(U, {
1197
+ /* @__PURE__ */ Z(K, {
1483
1198
  tone: "grey",
1484
1199
  size: "lg",
1485
- className: fn,
1200
+ className: W,
1486
1201
  iconLeft: "arrow-left",
1487
1202
  iconRight: "arrow-left",
1488
1203
  onClick: () => l ? a(null) : r(),
@@ -1494,7 +1209,7 @@ function hn({ layer: e, chain: t, onPick: n, onBack: r }) {
1494
1209
  }
1495
1210
  //#endregion
1496
1211
  //#region src/editor/mobile/MobileOverlay.jsx
1497
- var gn = { background: "var(--kol-surface-primary)" }, _n = [
1212
+ var pn = { background: "var(--kol-surface-primary)" }, mn = [
1498
1213
  {
1499
1214
  value: "generate",
1500
1215
  label: "Generate"
@@ -1511,29 +1226,29 @@ var gn = { background: "var(--kol-surface-primary)" }, _n = [
1511
1226
  value: "output",
1512
1227
  label: "Output"
1513
1228
  }
1514
- ], vn = _n.filter((e) => e.value !== "generate"), yn = "[&_.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)]", bn = {
1229
+ ], hn = mn.filter((e) => e.value !== "generate"), gn = "[&_.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)]", _n = {
1515
1230
  lg: 9.6,
1516
1231
  sm: 7.2
1517
- }, xn = 10, Sn = 232;
1518
- function Cn(e, t) {
1519
- let n = t === "sm" ? Sn : Math.min(window.innerWidth, 480) - 24, r = [], i = [], a = 0;
1232
+ }, vn = 10, yn = 232;
1233
+ function bn(e, t) {
1234
+ let n = t === "sm" ? yn : Math.min(window.innerWidth, 480) - 24, r = [], i = [], a = 0;
1520
1235
  for (let o of e) {
1521
- let e = o.label.length * bn[t] + xn, s = Math.max(a, e);
1236
+ let e = o.label.length * _n[t] + vn, s = Math.max(a, e);
1522
1237
  i.length && (i.length + 1) * s > n ? (r.push(i), i = [o], a = e) : (i.push(o), a = s);
1523
1238
  }
1524
1239
  return i.length && r.push(i), r;
1525
1240
  }
1526
- function wn({ cells: e, size: t }) {
1527
- return Cn(e, t).map((e, n) => /* @__PURE__ */ X(G, {
1241
+ function xn({ cells: e, size: t }) {
1242
+ return bn(e, t).map((e, n) => /* @__PURE__ */ Z(q, {
1528
1243
  value: null,
1529
1244
  onChange: (t) => e.find((e) => e.value === t)?.run(),
1530
1245
  options: e,
1531
1246
  size: t,
1532
1247
  ariaLabel: "Randomize scope",
1533
- className: yn
1248
+ className: gn
1534
1249
  }, n));
1535
1250
  }
1536
- var Tn = [
1251
+ var Sn = [
1537
1252
  2,
1538
1253
  4,
1539
1254
  8,
@@ -1542,17 +1257,17 @@ var Tn = [
1542
1257
  value: String(e),
1543
1258
  label: `${e}s`
1544
1259
  }));
1545
- function En({ size: e }) {
1546
- let { loopSeconds: t, setLoopSeconds: r } = n();
1547
- return /* @__PURE__ */ X(G, {
1260
+ function Cn({ size: e }) {
1261
+ let { loopSeconds: t, setLoopSeconds: n } = C();
1262
+ return /* @__PURE__ */ Z(q, {
1548
1263
  value: String(t),
1549
- onChange: (e) => r(Number(e)),
1550
- options: Tn,
1264
+ onChange: (e) => n(Number(e)),
1265
+ options: Sn,
1551
1266
  size: e,
1552
1267
  ariaLabel: "Loop length"
1553
1268
  });
1554
1269
  }
1555
- var Dn = [
1270
+ var wn = [
1556
1271
  {
1557
1272
  value: "9:16",
1558
1273
  label: "9:16"
@@ -1569,7 +1284,7 @@ var Dn = [
1569
1284
  value: "1:1",
1570
1285
  label: "1:1"
1571
1286
  }
1572
- ], On = [
1287
+ ], Tn = [
1573
1288
  {
1574
1289
  value: "5:4",
1575
1290
  label: "5:4"
@@ -1587,366 +1302,381 @@ var Dn = [
1587
1302
  label: "Fill"
1588
1303
  }
1589
1304
  ];
1590
- function kn({ layer: e, onSwitchCategory: n, onInsert: i, onRestart: o, aspectValue: c, onAspect: l, openEffects: f = !1, rail: m = !1, onRail: _ }) {
1591
- let { updateLayer: y, addFilter: b, removeFilter: ee } = p(), { onExportPng: x } = ke(), [te, S] = J(!1), [C, w] = J(!0), [T, E] = J(!1), [ne, k] = J(!1), [A, j] = J("generate"), M = u(e);
1592
- K(() => {
1593
- f && (w(!0), k(!0));
1305
+ function En({ layer: e, onSwitchCategory: r, onInsert: a, onRestart: o, aspectValue: l, onAspect: d, openEffects: f = !1, rail: h = !1, onRail: v, onSheet: y }) {
1306
+ let { updateLayer: b, addFilter: x, removeFilter: ee } = u(), { onExportPng: S } = pt(), [C, ne] = X(!1), [w, T] = X(!0), [E, D] = X(!1), [O, k] = X(!1), [A, j] = X("generate"), [M, N] = X(!1), P = s(e);
1307
+ J(() => {
1308
+ f && (T(!0), k(!0));
1594
1309
  }, [f]);
1595
- let N = m ? "sm" : "lg", P = m && !!e && C && !te;
1596
- if (K(() => (_?.(P), () => _?.(!1)), [P]), !e) return null;
1597
- if (te) return /* @__PURE__ */ X("button", {
1310
+ let F = h ? "sm" : "lg", I = h && !!e && w && !C;
1311
+ J(() => (v?.(I), () => v?.(!1)), [I]);
1312
+ let ie = !h && e && w && !C ? M ? Gt.tall : Gt.half : null;
1313
+ if (J(() => (y?.(ie), () => y?.(null)), [ie]), !e) return null;
1314
+ if (C) return /* @__PURE__ */ Z("button", {
1598
1315
  "aria-label": "Show controls",
1599
1316
  className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] z-20",
1600
- onClick: () => S(!1)
1317
+ onClick: () => ne(!1)
1601
1318
  });
1602
- let F = e.type === "loop", I = F ? `${D(e.loopGroup).label} · ${e.presetLabel}` : "Media", L = F ? O(e.loopId)?.params ?? [] : [], R = F ? g(L, e) : [], z = () => y(e.id, s(e, h(L, e), M.take(), { withFilters: !0 })), re = (t) => y(e.id, s(e, t.params, M.take(), { stripNoRandom: !!t.motion })), ie = () => {
1603
- let t = d(e, M.take());
1604
- t && y(e.id, t);
1605
- }, B = r(e), { effectable: ae } = ce(e), oe = () => {
1606
- let t = v(e, M.take());
1607
- t && y(e.id, { filters: t });
1319
+ let R = e.type === "loop", ae = R ? `${te(e.loopGroup).label} · ${e.presetLabel}` : "Media", z = R ? re(e.loopId)?.params ?? [] : [], oe = R ? m(z, e) : [], se = () => b(e.id, i(e, p(z, e), P.take(), { withFilters: !0 })), B = (t) => b(e.id, i(e, t.params, P.take(), { stripNoRandom: !!t.motion })), ce = () => {
1320
+ let t = c(e, P.take());
1321
+ t && b(e.id, t);
1322
+ }, V = t(e), { effectable: le } = L(e), H = () => {
1323
+ let t = _(e, P.take());
1324
+ t && b(e.id, { filters: t });
1608
1325
  };
1609
- if (!C) return /* @__PURE__ */ Z(Jt, {
1610
- label: F ? e.presetLabel : "Media",
1611
- onOpen: () => w(!0),
1612
- size: N,
1613
- children: [(F || B.length > 0) && /* @__PURE__ */ X(U, {
1326
+ if (!w) return /* @__PURE__ */ Q(Wt, {
1327
+ label: R ? e.presetLabel : "Media",
1328
+ onOpen: () => T(!0),
1329
+ size: F,
1330
+ children: [(R || V.length > 0) && /* @__PURE__ */ Z(K, {
1614
1331
  tone: "primary",
1615
- size: N,
1616
- onClick: z,
1332
+ size: F,
1333
+ onClick: se,
1617
1334
  children: "Randomize all"
1618
- }), /* @__PURE__ */ X(U, {
1335
+ }), /* @__PURE__ */ Z(K, {
1619
1336
  tone: "primary",
1620
- size: N,
1621
- onClick: () => x(2),
1337
+ size: F,
1338
+ onClick: () => S(2),
1622
1339
  children: "Download"
1623
1340
  })]
1624
1341
  });
1625
- let se = (F ? _n : vn).filter((e) => (e.value !== "effects" || ae) && (e.value !== "transport" || a("motion"))), V = se.some((e) => e.value === A) ? A : se[0].value;
1626
- return /* @__PURE__ */ Z(Y, { children: [
1627
- T && /* @__PURE__ */ X(mn, {
1342
+ let ue = (R ? mn : hn).filter((e) => (e.value !== "effects" || le) && (e.value !== "transport" || g("motion"))), U = ue.some((e) => e.value === A) ? A : ue[0].value;
1343
+ return /* @__PURE__ */ Q(Ct, { children: [
1344
+ E && /* @__PURE__ */ Z(Se, {
1628
1345
  onPick: (e) => {
1629
- n(e), E(!1);
1346
+ r(e), D(!1);
1630
1347
  },
1631
1348
  onInsert: () => {
1632
- E(!1), i();
1349
+ D(!1), a();
1633
1350
  },
1634
1351
  onBack: () => {
1635
- E(!1), o();
1352
+ D(!1), o();
1636
1353
  },
1637
- onDismiss: () => E(!1)
1354
+ onDismiss: () => D(!1)
1638
1355
  }),
1639
- ne && /* @__PURE__ */ X(hn, {
1356
+ O && /* @__PURE__ */ Z(fn, {
1640
1357
  layer: e,
1641
- chain: B,
1358
+ chain: V,
1642
1359
  onPick: (t) => {
1643
- b(e.id, t), k(!1);
1360
+ x(e.id, t), k(!1);
1644
1361
  },
1645
1362
  onBack: () => k(!1)
1646
1363
  }),
1647
- /* @__PURE__ */ Z("div", {
1648
- className: m ? "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 pb-[env(safe-area-inset-bottom)]",
1649
- style: gn,
1650
- children: [/* @__PURE__ */ X(qt, {
1651
- title: I,
1652
- onCollapse: () => w(!1),
1653
- className: m ? "px-4 pt-2.5 pb-1.5" : "px-3",
1654
- action: /* @__PURE__ */ X("button", {
1655
- className: "kol-helper-12 text-meta py-2.5",
1656
- onClick: o,
1657
- children: "Start over"
1658
- })
1659
- }), /* @__PURE__ */ Z("div", {
1660
- className: m ? "px-4 pb-5" : "px-3 pb-3",
1661
- children: [
1662
- /* @__PURE__ */ X(G, {
1663
- value: V,
1664
- onChange: j,
1665
- options: se,
1666
- size: N,
1667
- className: m ? yn : "[&_.kol-seg-cell]:min-w-0 [&_.kol-seg-cell]:px-2 [&_.kol-seg-cell]:overflow-hidden"
1668
- }),
1669
- V === "generate" && F && /* @__PURE__ */ Z("div", {
1670
- className: "flex flex-col gap-2 pt-3",
1671
- children: [
1672
- /* @__PURE__ */ Z("div", {
1364
+ /* @__PURE__ */ Q("div", {
1365
+ className: h ? "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)]",
1366
+ style: h ? pn : {
1367
+ ...pn,
1368
+ top: `calc(100dvh - ${ie ?? Gt.half})`
1369
+ },
1370
+ children: [
1371
+ !h && /* @__PURE__ */ Z(Kt, {
1372
+ tall: M,
1373
+ onToggle: () => N((e) => !e),
1374
+ onDrag: (e) => {
1375
+ e < 0 ? N(!0) : M ? N(!1) : T(!1);
1376
+ }
1377
+ }),
1378
+ /* @__PURE__ */ Z(Ut, {
1379
+ title: ae,
1380
+ onCollapse: () => T(!1),
1381
+ className: h ? "px-4 pt-2.5 pb-1.5" : "px-3",
1382
+ action: /* @__PURE__ */ Z("button", {
1383
+ className: "kol-helper-12 text-meta py-2.5",
1384
+ onClick: o,
1385
+ children: "Start over"
1386
+ })
1387
+ }),
1388
+ /* @__PURE__ */ Q("div", {
1389
+ className: h ? "px-4 pb-5" : "min-h-0 flex-1 overflow-y-auto px-3 pb-3",
1390
+ children: [
1391
+ /* @__PURE__ */ Z(q, {
1392
+ value: U,
1393
+ onChange: j,
1394
+ options: ue,
1395
+ size: F,
1396
+ className: h ? gn : "[&_.kol-seg-cell]:min-w-0 [&_.kol-seg-cell]:px-2 [&_.kol-seg-cell]:overflow-hidden"
1397
+ }),
1398
+ U === "generate" && R && /* @__PURE__ */ Q("div", {
1399
+ className: "flex flex-col gap-2 pt-3",
1400
+ children: [
1401
+ /* @__PURE__ */ Q("div", {
1402
+ className: "grid grid-cols-2 gap-2",
1403
+ children: [/* @__PURE__ */ Z(K, {
1404
+ tone: "primary",
1405
+ size: F,
1406
+ iconRight: "refresh",
1407
+ onClick: ce,
1408
+ children: "Preset"
1409
+ }), /* @__PURE__ */ Z(K, {
1410
+ tone: "primary",
1411
+ size: F,
1412
+ onClick: () => D(!0),
1413
+ children: "Generator"
1414
+ })]
1415
+ }),
1416
+ /* @__PURE__ */ Z(K, {
1417
+ tone: "primary",
1418
+ size: F,
1419
+ className: "w-full",
1420
+ onClick: se,
1421
+ children: "Randomize all"
1422
+ }),
1423
+ oe.length > 0 && /* @__PURE__ */ Z(xn, {
1424
+ size: F,
1425
+ cells: [...oe.map((e) => ({
1426
+ value: e.id,
1427
+ label: e.label,
1428
+ run: () => B(e)
1429
+ })), {
1430
+ value: "__retrigger",
1431
+ label: "Re-trigger",
1432
+ run: () => n.rewind()
1433
+ }]
1434
+ })
1435
+ ]
1436
+ }),
1437
+ U === "effects" && /* @__PURE__ */ Q("div", {
1438
+ className: "flex flex-col gap-2 pt-3",
1439
+ children: [/* @__PURE__ */ Q("div", {
1673
1440
  className: "grid grid-cols-2 gap-2",
1674
- children: [/* @__PURE__ */ X(U, {
1441
+ children: [/* @__PURE__ */ Z(K, {
1675
1442
  tone: "primary",
1676
- size: N,
1677
- iconRight: "refresh",
1678
- onClick: ie,
1679
- children: "Preset"
1680
- }), /* @__PURE__ */ X(U, {
1443
+ size: F,
1444
+ onClick: () => k(!0),
1445
+ children: "Add effect"
1446
+ }), /* @__PURE__ */ Z(K, {
1681
1447
  tone: "primary",
1682
- size: N,
1683
- onClick: () => E(!0),
1684
- children: "Generator"
1448
+ size: F,
1449
+ disabled: !V.length,
1450
+ onClick: H,
1451
+ children: "Randomize"
1685
1452
  })]
1686
- }),
1687
- /* @__PURE__ */ X(U, {
1688
- tone: "primary",
1689
- size: N,
1690
- className: "w-full",
1691
- onClick: z,
1692
- children: "Randomize all"
1693
- }),
1694
- R.length > 0 && /* @__PURE__ */ X(wn, {
1695
- size: N,
1696
- cells: [...R.map((e) => ({
1697
- value: e.id,
1698
- label: e.label,
1699
- run: () => re(e)
1700
- })), {
1701
- value: "__retrigger",
1702
- label: "Re-trigger",
1703
- run: () => t.rewind()
1704
- }]
1705
- })
1706
- ]
1707
- }),
1708
- V === "effects" && /* @__PURE__ */ Z("div", {
1709
- className: "flex flex-col gap-2 pt-3",
1710
- children: [/* @__PURE__ */ Z("div", {
1711
- className: "grid grid-cols-2 gap-2",
1712
- children: [/* @__PURE__ */ X(U, {
1713
- tone: "primary",
1714
- size: N,
1715
- onClick: () => k(!0),
1716
- children: "Add effect"
1717
- }), /* @__PURE__ */ X(U, {
1718
- tone: "primary",
1719
- size: N,
1720
- disabled: !B.length,
1721
- onClick: oe,
1722
- children: "Randomize"
1723
- })]
1724
- }), B.map((t, n) => {
1725
- let r = {
1726
- ...e,
1727
- ...t.params,
1728
- id: e.id
1729
- }, i = t.def ? g(t.def.params, r) : [], a = (t) => {
1730
- let i = s(r, t.params, M.take(), { stripNoRandom: !!t.motion }), a = B.map(({ def: e, ...t }) => t);
1731
- y(e.id, { filters: a.map((e, t) => t === n ? {
1453
+ }), V.map((t, n) => {
1454
+ let r = {
1732
1455
  ...e,
1733
- params: {
1734
- ...e.params,
1735
- ...i
1736
- }
1737
- } : e) });
1738
- };
1739
- return /* @__PURE__ */ Z("div", {
1740
- className: "flex flex-col gap-2",
1741
- children: [/* @__PURE__ */ X(U, {
1742
- tone: "grey",
1743
- size: N,
1744
- className: "w-full [&>span]:w-full [&>span]:justify-between",
1745
- iconLeft: "trash",
1746
- iconRight: "trash",
1747
- onClick: () => ee(e.id, n),
1748
- children: `${n + 1}. ${t.def?.label ?? t.id}`
1749
- }), i.length > 0 && /* @__PURE__ */ X(wn, {
1750
- size: N,
1751
- cells: i.map((e) => ({
1752
- value: e.id,
1753
- label: e.label,
1754
- run: () => a(e)
1755
- }))
1756
- })]
1757
- }, t.key);
1758
- })]
1759
- }),
1760
- V === "transport" && a("motion") && /* @__PURE__ */ Z("div", {
1761
- className: "flex flex-col gap-2 pt-3",
1762
- children: [(() => {
1763
- let e = a("motion").TransportBar;
1764
- return /* @__PURE__ */ X(e, { size: N });
1765
- })(), /* @__PURE__ */ X(En, { size: N })]
1766
- }),
1767
- V === "output" && /* @__PURE__ */ Z("div", {
1768
- className: "flex flex-col gap-2 pt-3",
1769
- children: [
1770
- /* @__PURE__ */ X(G, {
1771
- value: c,
1772
- onChange: l,
1773
- options: Dn,
1774
- size: N,
1775
- ariaLabel: "Aspect"
1776
- }),
1777
- /* @__PURE__ */ X(G, {
1778
- value: c,
1779
- onChange: l,
1780
- options: On,
1781
- size: N,
1782
- ariaLabel: "Aspect (landscape) and fill"
1783
- }),
1784
- /* @__PURE__ */ Z("div", {
1785
- className: "grid grid-cols-3 gap-2",
1786
- children: [
1787
- /* @__PURE__ */ X(U, {
1788
- tone: "primary",
1789
- size: N,
1790
- onClick: () => x(2),
1791
- children: "Download"
1792
- }),
1793
- /* @__PURE__ */ X(U, {
1794
- tone: "primary",
1795
- size: N,
1796
- onClick: () => S(!0),
1797
- children: "Hide UI"
1798
- }),
1799
- /* @__PURE__ */ X(U, {
1800
- tone: "primary",
1801
- size: N,
1802
- onClick: o,
1803
- children: "Start over"
1804
- })
1805
- ]
1806
- })
1807
- ]
1808
- })
1809
- ]
1810
- })]
1456
+ ...t.params,
1457
+ id: e.id
1458
+ }, a = t.def ? m(t.def.params, r) : [], o = (t) => {
1459
+ let a = i(r, t.params, P.take(), { stripNoRandom: !!t.motion }), o = V.map(({ def: e, ...t }) => t);
1460
+ b(e.id, { filters: o.map((e, t) => t === n ? {
1461
+ ...e,
1462
+ params: {
1463
+ ...e.params,
1464
+ ...a
1465
+ }
1466
+ } : e) });
1467
+ };
1468
+ return /* @__PURE__ */ Q("div", {
1469
+ className: "flex flex-col gap-2",
1470
+ children: [/* @__PURE__ */ Z(K, {
1471
+ tone: "grey",
1472
+ size: F,
1473
+ className: "w-full [&>span]:w-full [&>span]:justify-between",
1474
+ iconLeft: "trash",
1475
+ iconRight: "trash",
1476
+ onClick: () => ee(e.id, n),
1477
+ children: `${n + 1}. ${t.def?.label ?? t.id}`
1478
+ }), a.length > 0 && /* @__PURE__ */ Z(xn, {
1479
+ size: F,
1480
+ cells: a.map((e) => ({
1481
+ value: e.id,
1482
+ label: e.label,
1483
+ run: () => o(e)
1484
+ }))
1485
+ })]
1486
+ }, t.key);
1487
+ })]
1488
+ }),
1489
+ U === "transport" && g("motion") && /* @__PURE__ */ Q("div", {
1490
+ className: "flex flex-col gap-2 pt-3",
1491
+ children: [(() => {
1492
+ let e = g("motion").TransportBar;
1493
+ return /* @__PURE__ */ Z(e, { size: F });
1494
+ })(), /* @__PURE__ */ Z(Cn, { size: F })]
1495
+ }),
1496
+ U === "output" && /* @__PURE__ */ Q("div", {
1497
+ className: "flex flex-col gap-2 pt-3",
1498
+ children: [
1499
+ /* @__PURE__ */ Z(q, {
1500
+ value: l,
1501
+ onChange: d,
1502
+ options: wn,
1503
+ size: F,
1504
+ ariaLabel: "Aspect"
1505
+ }),
1506
+ /* @__PURE__ */ Z(q, {
1507
+ value: l,
1508
+ onChange: d,
1509
+ options: Tn,
1510
+ size: F,
1511
+ ariaLabel: "Aspect (landscape) and fill"
1512
+ }),
1513
+ /* @__PURE__ */ Q("div", {
1514
+ className: "grid grid-cols-3 gap-2",
1515
+ children: [
1516
+ /* @__PURE__ */ Z(K, {
1517
+ tone: "primary",
1518
+ size: F,
1519
+ onClick: () => S(2),
1520
+ children: "Download"
1521
+ }),
1522
+ /* @__PURE__ */ Z(K, {
1523
+ tone: "primary",
1524
+ size: F,
1525
+ onClick: () => ne(!0),
1526
+ children: "Hide UI"
1527
+ }),
1528
+ /* @__PURE__ */ Z(K, {
1529
+ tone: "primary",
1530
+ size: F,
1531
+ onClick: o,
1532
+ children: "Start over"
1533
+ })
1534
+ ]
1535
+ })
1536
+ ]
1537
+ })
1538
+ ]
1539
+ })
1540
+ ]
1811
1541
  })
1812
1542
  ] });
1813
1543
  }
1814
1544
  //#endregion
1815
1545
  //#region src/editor/mobile/MobileView.jsx
1816
- function An({ onGenerate: e, onEffects: t, chromes: n }) {
1817
- return /* @__PURE__ */ X("div", {
1546
+ function Dn({ onGenerate: e, onEffects: t, chromes: n }) {
1547
+ return /* @__PURE__ */ Z("div", {
1818
1548
  className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] kol-overlay-scrim flex flex-col items-center justify-center p-6",
1819
1549
  style: { zIndex: "var(--kol-z-modal)" },
1820
- children: /* @__PURE__ */ Z("div", {
1550
+ children: /* @__PURE__ */ Q("div", {
1821
1551
  className: "w-full max-w-sm rounded p-8 flex flex-col gap-6",
1822
1552
  style: { background: "var(--kol-surface-primary)" },
1823
- children: [n ? /* @__PURE__ */ Z("div", {
1553
+ children: [n ? /* @__PURE__ */ Q("div", {
1824
1554
  className: "flex flex-col gap-2",
1825
- children: [/* @__PURE__ */ X("span", {
1555
+ children: [/* @__PURE__ */ Z("span", {
1826
1556
  className: "kol-eyebrow text-body",
1827
1557
  children: "Select chrome"
1828
- }), /* @__PURE__ */ X("span", {
1558
+ }), /* @__PURE__ */ Z("span", {
1829
1559
  className: "kol-mono-16 text-emphasis",
1830
1560
  children: "Effexor FXR"
1831
1561
  })]
1832
- }) : /* @__PURE__ */ X("span", {
1562
+ }) : /* @__PURE__ */ Z("span", {
1833
1563
  className: "kol-eyebrow text-body",
1834
- children: ve("randomiser").label
1835
- }), /* @__PURE__ */ Z("div", {
1564
+ children: We("randomiser").label
1565
+ }), /* @__PURE__ */ Q("div", {
1836
1566
  className: "flex flex-col gap-2",
1837
1567
  children: [
1838
- /* @__PURE__ */ X(U, {
1568
+ /* @__PURE__ */ Z(K, {
1839
1569
  tone: "primary",
1840
1570
  size: "lg",
1841
- className: fn,
1842
- iconLeft: bt.randomiser,
1843
- iconRight: bt.randomiser,
1571
+ className: W,
1572
+ iconLeft: G.randomiser,
1573
+ iconRight: G.randomiser,
1844
1574
  onClick: e,
1845
1575
  children: "Generate"
1846
1576
  }),
1847
- /* @__PURE__ */ X(U, {
1577
+ /* @__PURE__ */ Z(K, {
1848
1578
  tone: "primary",
1849
1579
  size: "lg",
1850
- className: fn,
1580
+ className: W,
1851
1581
  iconLeft: "filter",
1852
1582
  iconRight: "filter",
1853
1583
  onClick: t,
1854
1584
  children: "Effects"
1855
1585
  }),
1856
- n && We() && /* @__PURE__ */ X(U, {
1586
+ n && be() && /* @__PURE__ */ Z(K, {
1857
1587
  tone: "primary",
1858
1588
  size: "lg",
1859
1589
  className: "w-full [&>span]:w-full [&>span]:justify-between",
1860
- iconLeft: bt.editor,
1861
- iconRight: bt.editor,
1862
- onClick: Ye,
1863
- children: ve("editor").label
1590
+ iconLeft: G.editor,
1591
+ iconRight: G.editor,
1592
+ onClick: Ne,
1593
+ children: We("editor").label
1864
1594
  }),
1865
- n && /* @__PURE__ */ X(U, {
1595
+ n && /* @__PURE__ */ Z(K, {
1866
1596
  tone: "primary",
1867
1597
  size: "lg",
1868
1598
  className: "w-full [&>span]:w-full [&>span]:justify-between",
1869
- iconLeft: bt.labs,
1870
- iconRight: bt.labs,
1871
- onClick: ye,
1872
- children: ve("labs").label
1599
+ iconLeft: G.labs,
1600
+ iconRight: G.labs,
1601
+ onClick: pe,
1602
+ children: We("labs").label
1873
1603
  })
1874
1604
  ]
1875
1605
  })]
1876
1606
  })
1877
1607
  });
1878
1608
  }
1879
- function jn() {
1880
- let { layers: e, addLayer: n, removeLayer: r, updateLayer: i, canvasW: a, canvasH: o, aspect: s, setAspect: c } = p(), { setTool: l } = Qe(), u = $e() && !Xe(), d = () => "entry", [f, m] = J(d), [h, g] = J(!1), [_, v] = J(null), [y, b] = J("contain"), [ee, S] = J(!1), [C, w] = J(1), T = q({
1609
+ function On() {
1610
+ let { layers: e, addLayer: t, removeLayer: r, updateLayer: i, canvasW: a, canvasH: o, aspect: s, setAspect: c } = u(), { setTool: l } = ye(), d = Fe() && !Le(), f = Ce(), p = () => "entry", [m, h] = X(p), [g, _] = X(!1), [v, y] = X(null), [b, S] = X("contain"), [C, te] = X(!1), [ne, w] = X(null), [E, O] = X(1), k = Y({
1881
1611
  pts: /* @__PURE__ */ new Map(),
1882
1612
  startDist: 0,
1883
1613
  startScale: 1
1884
- }), E = q(null), D = () => {
1885
- let [e, t] = [...T.current.pts.values()];
1614
+ }), A = Y(null), j = () => {
1615
+ let [e, t] = [...k.current.pts.values()];
1886
1616
  return Math.hypot(e.x - t.x, e.y - t.y);
1887
- }, k = (e) => {
1888
- T.current.pts.set(e.pointerId, {
1617
+ }, M = (e) => {
1618
+ k.current.pts.set(e.pointerId, {
1889
1619
  x: e.clientX,
1890
1620
  y: e.clientY
1891
- }), E.current = T.current.pts.size === 1 ? {
1621
+ }), A.current = k.current.pts.size === 1 ? {
1892
1622
  id: e.pointerId,
1893
1623
  x: e.clientX,
1894
1624
  y: e.clientY,
1895
1625
  t: performance.now()
1896
- } : null, T.current.pts.size === 2 && (T.current.startDist = D(), T.current.startScale = C, t.setStagePointer(null), e.stopPropagation());
1897
- }, j = (e) => {
1898
- let t = T.current;
1626
+ } : null, k.current.pts.size === 2 && (k.current.startDist = j(), k.current.startScale = E, n.setStagePointer(null), e.stopPropagation());
1627
+ }, N = (e) => {
1628
+ let t = k.current;
1899
1629
  t.pts.has(e.pointerId) && (t.pts.set(e.pointerId, {
1900
1630
  x: e.clientX,
1901
1631
  y: e.clientY
1902
- }), t.pts.size >= 2 && t.startDist > 0 && (e.stopPropagation(), w(Math.min(3, Math.max(.5, t.startScale * (D() / t.startDist))))));
1903
- }, M = (e) => {
1904
- let n = E.current;
1905
- if (n && n.id === e.pointerId && e.type === "pointerup" && f === "live" && performance.now() - n.t < 350 && Math.hypot(e.clientX - n.x, e.clientY - n.y) < 12 && N?.type === "loop") {
1906
- let e = O(N.loopId);
1907
- e && e.group !== "penrose" && e.kind !== "engine" && !ne(e) && t.rewind();
1632
+ }), t.pts.size >= 2 && t.startDist > 0 && (e.stopPropagation(), O(Math.min(3, Math.max(.5, t.startScale * (j() / t.startDist))))));
1633
+ }, P = (e) => {
1634
+ let t = A.current;
1635
+ if (t && t.id === e.pointerId && e.type === "pointerup" && m === "live" && performance.now() - t.t < 350 && Math.hypot(e.clientX - t.x, e.clientY - t.y) < 12 && F?.type === "loop") {
1636
+ let e = re(F.loopId);
1637
+ e && e.group !== "penrose" && e.kind !== "engine" && !T(e) && n.rewind();
1908
1638
  }
1909
- n?.id === e.pointerId && (E.current = null), T.current.pts.delete(e.pointerId), T.current.pts.size < 2 && (T.current.startDist = 0);
1639
+ t?.id === e.pointerId && (A.current = null), k.current.pts.delete(e.pointerId), k.current.pts.size < 2 && (k.current.startDist = 0);
1910
1640
  };
1911
- vt(), K(() => {
1641
+ Et(), J(() => (tt("randomiser"), () => tt(null)), []), J(() => {
1912
1642
  c("4:5"), l("orbit");
1913
1643
  }, []);
1914
- let N = e.find((e) => e.id === _) ?? (e.length === 1 ? e[0] : null), P = f === "live" && N?.type === "photo" && !N.src && N.srcType !== "webcam";
1915
- K(() => {
1916
- if (!P) return;
1644
+ let F = e.find((e) => e.id === v) ?? (e.length === 1 ? e[0] : null), I = m === "live" && F?.type === "photo" && !F.src && F.srcType !== "webcam";
1645
+ J(() => {
1646
+ if (!I) return;
1917
1647
  let e = (e) => {
1918
1648
  e.key === "Escape" && z();
1919
1649
  };
1920
1650
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
1921
- }), K(() => {
1922
- if (!P) return;
1923
- let e = t.isPlaying();
1924
- return t.pause(), () => {
1925
- e && t.play();
1651
+ }), J(() => {
1652
+ if (!I) return;
1653
+ let e = n.isPlaying();
1654
+ return n.pause(), () => {
1655
+ e && n.play();
1926
1656
  };
1927
- }, [P]);
1928
- let F = (e) => {
1929
- let r = A(e);
1930
- r && (v(n("loop", r)), t.play(), m("live"));
1931
- }, I = (e) => {
1932
- let t = A(e);
1933
- t && _ && i(_, t);
1934
- }, L = () => {
1935
- v(n("photo", {
1657
+ }, [I]);
1658
+ let L = (e) => {
1659
+ let r = D(e);
1660
+ r && (y(t("loop", r)), n.play(), h("live"));
1661
+ }, ie = (e) => {
1662
+ let t = D(e);
1663
+ t && v && i(v, t);
1664
+ }, R = () => {
1665
+ y(t("photo", {
1936
1666
  fit: "cover",
1937
1667
  x: 0,
1938
1668
  y: 0,
1939
1669
  w: x,
1940
1670
  h: Math.round(x * o / a)
1941
- })), t.play(), m("live");
1942
- }, R = (e) => {
1671
+ })), n.play(), h("live");
1672
+ }, ae = (e) => {
1943
1673
  if (e === "fill") {
1944
- b("cover");
1674
+ S("cover");
1945
1675
  return;
1946
1676
  }
1947
- b("contain"), c(e);
1948
- let t = te[e];
1949
- _ && t && i(_, {
1677
+ S("contain"), c(e);
1678
+ let t = ee[e];
1679
+ v && t && i(v, {
1950
1680
  x: 0,
1951
1681
  y: 0,
1952
1682
  w: x,
@@ -1954,58 +1684,60 @@ function jn() {
1954
1684
  });
1955
1685
  }, z = () => {
1956
1686
  for (let t of [...e]) r(t.id);
1957
- v(null), w(1), g(!1), m(d());
1687
+ y(null), O(1), _(!1), h(p());
1958
1688
  };
1959
- return /* @__PURE__ */ Z("div", {
1960
- className: "relative h-dvh bg-black",
1689
+ return /* @__PURE__ */ Q("div", {
1690
+ className: "kol-editor-randomiser relative h-dvh bg-black",
1961
1691
  children: [
1962
- /* @__PURE__ */ X("div", {
1963
- className: "absolute inset-y-0 left-0 touch-none",
1692
+ /* @__PURE__ */ Z("div", {
1693
+ className: "absolute inset-y-0 left-0 touch-none overflow-hidden",
1964
1694
  style: {
1965
- transform: `scale(${C})`,
1966
- right: ee ? "var(--kol-sidenav-w, 320px)" : 0
1695
+ transform: `scale(${E})`,
1696
+ right: C ? "var(--kol-sidenav-w, 320px)" : 0,
1697
+ bottom: ne ?? 0
1967
1698
  },
1968
- onPointerDownCapture: k,
1969
- onPointerMoveCapture: j,
1970
- onPointerUpCapture: M,
1971
- onPointerCancelCapture: M,
1972
- onPointerLeave: M,
1973
- children: /* @__PURE__ */ X(Be, { fit: y })
1699
+ onPointerDownCapture: M,
1700
+ onPointerMoveCapture: N,
1701
+ onPointerUpCapture: P,
1702
+ onPointerCancelCapture: P,
1703
+ onPointerLeave: P,
1704
+ children: /* @__PURE__ */ Z(nt, { fit: b })
1974
1705
  }),
1975
- f === "entry" && /* @__PURE__ */ X(An, {
1976
- chromes: u,
1977
- onGenerate: () => m("category"),
1706
+ m === "entry" && /* @__PURE__ */ Z(Dn, {
1707
+ chromes: d,
1708
+ onGenerate: () => h("category"),
1978
1709
  onEffects: () => {
1979
- g(!0), L();
1710
+ _(!0), R();
1980
1711
  }
1981
1712
  }),
1982
- f === "category" && /* @__PURE__ */ X(mn, {
1983
- onPick: F,
1984
- onInsert: L,
1985
- onBack: () => m("entry")
1713
+ m === "category" && /* @__PURE__ */ Z(Se, {
1714
+ onPick: L,
1715
+ onInsert: R,
1716
+ onBack: () => h("entry")
1986
1717
  }),
1987
- f === "live" && /* @__PURE__ */ X(kn, {
1988
- layer: N,
1989
- onSwitchCategory: I,
1718
+ m === "live" && !I && /* @__PURE__ */ Z(En, {
1719
+ layer: F,
1720
+ onSwitchCategory: ie,
1990
1721
  onInsert: () => {
1991
- z(), L();
1722
+ z(), R();
1992
1723
  },
1993
1724
  onRestart: z,
1994
- aspectValue: y === "cover" ? "fill" : s,
1995
- openEffects: h && !P,
1996
- onAspect: R,
1997
- rail: !u,
1998
- onRail: S
1725
+ aspectValue: b === "cover" ? "fill" : s,
1726
+ openEffects: g && !I,
1727
+ onAspect: ae,
1728
+ rail: !d && !f,
1729
+ onRail: te,
1730
+ onSheet: w
1999
1731
  }),
2000
- P && /* @__PURE__ */ Z("div", {
1732
+ I && /* @__PURE__ */ Q("div", {
2001
1733
  className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] kol-overlay-scrim flex flex-col",
2002
1734
  style: { zIndex: "var(--kol-z-modal)" },
2003
- children: [/* @__PURE__ */ X("div", {
1735
+ children: [/* @__PURE__ */ Z("div", {
2004
1736
  className: "flex-1 min-h-0",
2005
- children: /* @__PURE__ */ X(At, { layer: N })
2006
- }), /* @__PURE__ */ X("div", {
1737
+ children: /* @__PURE__ */ Z(Vt, { layer: F })
1738
+ }), /* @__PURE__ */ Z("div", {
2007
1739
  className: "flex justify-center pb-[max(0.75rem,env(safe-area-inset-bottom))]",
2008
- children: /* @__PURE__ */ X(U, {
1740
+ children: /* @__PURE__ */ Z(K, {
2009
1741
  tone: "outline",
2010
1742
  size: "lg",
2011
1743
  onClick: z,
@@ -2016,11 +1748,11 @@ function jn() {
2016
1748
  ]
2017
1749
  });
2018
1750
  }
2019
- function Mn() {
2020
- return /* @__PURE__ */ X(Ze, {
1751
+ function kn() {
1752
+ return /* @__PURE__ */ Z(He, {
2021
1753
  persistDraft: !1,
2022
- children: /* @__PURE__ */ X(jn, {})
1754
+ children: /* @__PURE__ */ Z(On, {})
2023
1755
  });
2024
1756
  }
2025
1757
  //#endregion
2026
- export { Ge as AppSettingsSections, ge as BRAND, tt as DesignEditor, tt as default, Ee as DisplaySettingsDrawer, Ze as EditorProviders, Ae as FilesDialog, Fe as GeneratorLibraryProvider, un as LABS_DRAFT_KEY, xe as LIBRARY_SLOT_KEYS, dn as LabsView, _e as MODES, Mn as MobileView, nt as OutputCanvas, Be as OutputStage, Ve as OutputView, et as RAIL_EXTRA_PREFIX, it as VIEW_PATHS, be as closeFiles, Se as comboLabel, Me as currentView, $e as isMobileDevice, Ce as openFiles, o as registerPack, ot as setMediaClient, Re as setMediaProxyBase, Oe as setMode, Ke as setNavigator, ze as setRailExtras, c as setSettingsStore, Le as setWantsDesktop, Ne as shortcutsBySection, Te as useFilesDialog, we as useGeneratorLibrary, qe as useRailExtras, De as useSettingsSections, Xe as wantsDesktop, he as withView };
1758
+ export { dt as AppSettingsSections, _e as BRAND, ct as DesignEditor, ct as default, mt as DisplaySettingsDrawer, He as EditorProviders, Me as FilesDialog, Xe as GeneratorLibraryProvider, un as LABS_DRAFT_KEY, Te as LIBRARY_SLOT_KEYS, dn as LabsView, Ie as MODES, kn as MobileView, Be as OutputCanvas, nt as OutputStage, st as OutputView, et as RAIL_EXTRA_PREFIX, Re as VIEW_PATHS, je as closeFiles, Ze as comboLabel, ke as currentView, Fe as isMobileDevice, Ee as loadLibrary, ge as openFiles, f as registerPack, $e as setMediaClient, qe as setMediaProxyBase, lt as setMode, ot as setNavigator, at as setRailExtras, a as setSettingsStore, we as setWantsDesktop, me as shortcutsBySection, ft as useFilesDialog, Oe as useGeneratorLibrary, Je as useRailExtras, Ve as useSettingsSections, Le as wantsDesktop, Ye as withView };