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