@kolkrabbi/design-editor 0.14.0 → 0.15.0

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