@kolkrabbi/design-editor 0.14.0 → 0.16.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,40 +1,41 @@
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";
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
10
  import { createContext as dt, useCallback as ft, useContext as pt, useEffect as G, useRef as K, useState as q } from "react";
11
11
  import { Fragment as J, jsx as Y, jsxs as X } from "react/jsx-runtime";
12
+ import { Icon as Z } from "@kolkrabbi/kol-icons";
12
13
  import { useDragResize as mt, useTheme as ht } from "@kolkrabbi/kol-framework";
13
14
  //#region src/editor/labs/useLabsLayer.js
14
- function Z() {
15
- let { layers: e, addLayer: t, removeLayer: r, updateLayer: i, select: a, beginTransaction: o, commitTransaction: s } = n(), c = ft((n, c) => {
15
+ function Q() {
16
+ let { layers: e, addLayer: t, removeLayer: n, updateLayer: r, select: i, beginTransaction: a, commitTransaction: o } = f(), s = ft((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
36
37
  //#region src/editor/labs/catalog.js
37
- var Q = {
38
+ var $ = {
38
39
  "fx:halftone": "ptrn-dot",
39
40
  "fx:scanline": "grid-horizontal",
40
41
  "fx:crt": "desktop",
@@ -64,16 +65,16 @@ var Q = {
64
65
  composition: "type",
65
66
  modulation: "frequency",
66
67
  mode: "mode-toggle-01"
67
- }, $ = {
68
+ }, _t = {
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" ? () => {
@@ -159,19 +160,19 @@ function bt({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource:
159
160
  ...ae(z).map((t) => ({
160
161
  id: `fx:${t.id}`,
161
162
  label: t.label,
162
- icon: Q[`fx:${t.id}`] ?? "square",
163
+ icon: $[`fx:${t.id}`] ?? "square",
163
164
  pages: t.rack ? re.map((t) => ({
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),
@@ -185,7 +186,7 @@ function bt({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource:
185
186
  ...F.map((e) => ({
186
187
  id: `gen:${e.label}`,
187
188
  label: e.label,
188
- icon: Q[`gen:${e.label}`] ?? "square",
189
+ icon: $[`gen:${e.label}`] ?? "square",
189
190
  pages: p(e)
190
191
  })),
191
192
  {
@@ -195,33 +196,33 @@ function bt({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource:
195
196
  {
196
197
  id: "vec:Distressor",
197
198
  label: "Distressor",
198
- icon: Q["vec:Distressor"] ?? "square",
199
+ icon: $["vec:Distressor"] ?? "square",
199
200
  pages: f("distress")
200
201
  },
201
202
  {
202
203
  id: "vec:Modulator",
203
204
  label: "Modulator",
204
- icon: Q["vec:Modulator"] ?? "square",
205
+ icon: $["vec:Modulator"] ?? "square",
205
206
  pages: f("modulator")
206
207
  },
207
208
  {
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
- icon: Q[`kin:${t.label}`] ?? "square",
215
+ icon: $[`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) => ({
222
223
  id: `misc:${e.label}`,
223
224
  label: e.label,
224
- icon: Q[`misc:${e.label}`] ?? "square",
225
+ icon: $[`misc:${e.label}`] ?? "square",
225
226
  pages: e.groups.flatMap((e) => f(e, "misc"))
226
227
  })),
227
228
  {
@@ -238,8 +239,8 @@ 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);
242
+ function St() {
243
+ let { addFilter: e, patchFilter: n } = f(), { layer: r, setOnly: i } = Q(), a = K(null);
243
244
  G(() => {
244
245
  r?.type === "photo" && r.src && (a.current = {
245
246
  src: r.src,
@@ -252,11 +253,11 @@ 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,
@@ -264,40 +265,40 @@ function xt() {
264
265
  } : a.current ?? {}
265
266
  });
266
267
  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({
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({
272
273
  icon: gt[e] ?? "square",
273
- path: `${$e}${n.id}`,
274
- label: n.label,
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
+ function Ct(e) {
301
302
  let { patch: t } = ee(e.id), n = K(null), [r, i] = q(!1), a = e.type === "loop" && e.loopGroup === "distress";
302
303
  return {
303
304
  nodes: /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y("input", {
@@ -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__ */ Y(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__ */ X(J, { children: [/* @__PURE__ */ Y(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,9 +382,9 @@ 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";
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";
386
388
  return /* @__PURE__ */ X("div", {
387
389
  className: "w-full h-full flex items-stretch p-6 gap-px",
388
390
  children: [
@@ -390,7 +392,7 @@ function Et({ layer: e }) {
390
392
  type: "button",
391
393
  className: n,
392
394
  onClick: t.openLibrary,
393
- children: [/* @__PURE__ */ Y(v, {
395
+ children: [/* @__PURE__ */ Y(Z, {
394
396
  name: "image",
395
397
  size: 28
396
398
  }), /* @__PURE__ */ Y("span", {
@@ -400,13 +402,13 @@ function Et({ layer: e }) {
400
402
  }),
401
403
  /* @__PURE__ */ Y("div", {
402
404
  className: "w-px",
403
- style: { background: "var(--kol-fg-08)" }
405
+ style: { background: "var(--kol-oq-08)" }
404
406
  }),
405
407
  /* @__PURE__ */ X("button", {
406
408
  type: "button",
407
409
  className: n,
408
410
  onClick: t.openUpload,
409
- children: [/* @__PURE__ */ Y(v, {
411
+ children: [/* @__PURE__ */ Y(Z, {
410
412
  name: "upload",
411
413
  size: 28
412
414
  }), /* @__PURE__ */ Y("span", {
@@ -416,13 +418,13 @@ function Et({ layer: e }) {
416
418
  }),
417
419
  /* @__PURE__ */ Y("div", {
418
420
  className: "w-px",
419
- style: { background: "var(--kol-fg-08)" }
421
+ style: { background: "var(--kol-oq-08)" }
420
422
  }),
421
423
  /* @__PURE__ */ X("button", {
422
424
  type: "button",
423
425
  className: n,
424
426
  onClick: t.openCamera,
425
- children: [/* @__PURE__ */ Y(v, {
427
+ children: [/* @__PURE__ */ Y(Z, {
426
428
  name: "camera",
427
429
  size: 28
428
430
  }), /* @__PURE__ */ Y("span", {
@@ -436,7 +438,7 @@ function Et({ layer: e }) {
436
438
  }
437
439
  //#endregion
438
440
  //#region src/editor/labs/LabsParams.jsx
439
- function Dt(e, t) {
441
+ function Ot(e, t) {
440
442
  G(() => {
441
443
  let n = (n) => {
442
444
  if (n.key !== "r" && n.key !== "R" || n.metaKey || n.ctrlKey || n.altKey) return;
@@ -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,7 +481,7 @@ 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 }) {
484
+ function Mt({ options: e, active: t, onPick: n, spread: r = !1, pills: i = !1 }) {
483
485
  return e?.length ? i ? /* @__PURE__ */ Y("div", {
484
486
  className: "flex items-center gap-1 flex-wrap",
485
487
  children: e.map((e) => /* @__PURE__ */ Y("button", {
@@ -498,7 +500,7 @@ 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 }) {
503
+ function Nt({ chips: e, active: t, onPick: n, spread: r, pills: i, title: a, tabStrip: o, preStrip: s, fx: c = !1, children: l }) {
502
504
  return /* @__PURE__ */ X("div", {
503
505
  className: `flex flex-col gap-5${c ? " kol-labs-fx" : ""}`,
504
506
  children: [
@@ -506,7 +508,7 @@ function Mt({ chips: e, active: t, onPick: n, spread: r, pills: i, title: a, tab
506
508
  className: "kol-eyebrow text-fg-96",
507
509
  children: a
508
510
  }),
509
- e && /* @__PURE__ */ Y(jt, {
511
+ e && /* @__PURE__ */ Y(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
+ function Pt({ layer: t, showMod: n }) {
525
+ let a = i(), [o, c] = q("effect");
524
526
  G(() => {
525
- let e = () => l("effect");
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,163 +548,166 @@ 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__ */ Y(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__ */ X(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__ */ Y(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__ */ X(J, { children: [
604
+ /* @__PURE__ */ X(H, {
602
605
  label: "Effect Stack",
603
606
  divided: !0,
604
- children: [b.length === 0 && /* @__PURE__ */ Y(L, {
607
+ children: [v.length === 0 && /* @__PURE__ */ Y(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__ */ Y(Ft, {
611
+ ...e,
609
612
  from: 0
610
613
  })]
611
614
  }),
612
615
  /* @__PURE__ */ Y(st, {}),
613
- /* @__PURE__ */ Y(U, {
616
+ /* @__PURE__ */ Y(H, {
614
617
  label: N.label,
615
618
  divided: !0,
616
619
  children: /* @__PURE__ */ Y(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__ */ Y(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__ */ Y(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__ */ Y(U, {
645
+ variant: "filled",
646
+ value: o,
647
+ onChange: c,
648
+ options: kt,
649
+ size: a,
650
+ className: C(a)
647
651
  }),
648
652
  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
653
+ schema: Ue,
654
+ layer: t,
655
+ setProp: _.setProp,
656
+ palette: g,
657
+ renderAnimate: (e) => /* @__PURE__ */ Y(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__ */ X(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__ */ Y(wt, { layer: t }),
690
+ tabStrip: /* @__PURE__ */ Y(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: [
698
+ children: [o === "effect" && /* @__PURE__ */ X(J, { children: [
694
699
  se.length > 0 && /* @__PURE__ */ Y(I, {
695
700
  schema: se,
696
- ...ue
701
+ ...de
697
702
  }),
698
- /* @__PURE__ */ X(U, {
703
+ /* @__PURE__ */ X(H, {
699
704
  divided: !0,
700
705
  children: [/* @__PURE__ */ Y(I, {
701
- schema: le,
702
- ...ue
706
+ schema: ue,
707
+ ...de
703
708
  }), /* @__PURE__ */ Y(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
@@ -711,102 +716,106 @@ function Nt({ layer: e, showMod: r }) {
711
716
  /* @__PURE__ */ Y(st, {}),
712
717
  B < P.length && /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(I, {
713
718
  schema: P.slice(B),
714
- ...ue
719
+ ...de
715
720
  }), /* @__PURE__ */ Y(st, {})] }),
716
- /* @__PURE__ */ Y(Ft, {
717
- chain: b,
718
- layer: e,
721
+ /* @__PURE__ */ Y(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: [
732
+ ] }), o === "anim" && /* @__PURE__ */ X(J, { children: [
728
733
  /* @__PURE__ */ Y(I, {
729
- schema: x.def.params,
730
- ...ue,
734
+ schema: y.def.params,
735
+ ...de,
731
736
  tab: "anim"
732
737
  }),
733
738
  /* @__PURE__ */ Y(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__ */ Y(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
761
  return /* @__PURE__ */ X("div", {
757
- className: "flex flex-col gap-2 p-2 rounded bg-fg-04",
762
+ className: "flex flex-col gap-2 p-2 rounded bg-oq-04",
758
763
  children: [/* @__PURE__ */ X("div", {
759
764
  className: "flex items-center gap-2",
760
765
  children: [/* @__PURE__ */ Y(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", {
766
- type: "button",
767
- "aria-label": "Remove effect",
768
- onClick: () => o(r.id, f),
769
- className: "ml-auto inline-flex items-center justify-center w-5 h-5 shrink-0 text-oq-64 hover:text-emphasis cursor-pointer",
770
- style: {
771
- border: "none",
772
- background: "transparent"
773
- },
774
- children: /* @__PURE__ */ Y(v, {
775
- name: "close",
776
- size: 12
768
+ onChange: () => o(r.id, f),
769
+ label: t.def?.label ?? t.id
770
+ }), /* @__PURE__ */ Y(W, {
771
+ asChild: !0,
772
+ label: "Remove effect",
773
+ children: /* @__PURE__ */ Y("button", {
774
+ type: "button",
775
+ "aria-label": "Remove effect",
776
+ onClick: () => s(r.id, f),
777
+ className: "ml-auto inline-flex items-center justify-center w-5 h-5 shrink-0 text-oq-64 hover:text-emphasis cursor-pointer",
778
+ style: {
779
+ border: "none",
780
+ background: "transparent"
781
+ },
782
+ children: /* @__PURE__ */ Y(Z, {
783
+ name: "x",
784
+ size: 12
785
+ })
777
786
  })
778
787
  })]
779
- }), p && e.def && /* @__PURE__ */ Y(I, {
780
- schema: e.def.params.filter((e) => s(e) !== "anim"),
788
+ }), p && t.def && /* @__PURE__ */ Y(I, {
789
+ schema: t.def.params.filter((t) => e(t) !== "anim"),
781
790
  layer: m,
782
791
  setProp: h,
783
792
  palette: l,
784
793
  inline: !0,
785
- renderAnimate: u ? (e) => /* @__PURE__ */ Y(V, {
794
+ renderAnimate: u ? (e) => /* @__PURE__ */ Y(le, {
786
795
  layer: m,
787
796
  param: e,
788
797
  setProp: h
789
798
  }) : void 0
790
799
  })]
791
- }, e.key ?? f);
800
+ }, t.key ?? f);
792
801
  });
793
802
  }
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 = [{
803
+ function It({ chain: e, layer: t, hostView: n, addFilter: r, removeFilter: a, toggleFilter: o, setStagePropAt: s, palette: c, showMod: l }) {
804
+ let u = i(), d = [{
796
805
  value: "",
797
806
  label: "Add FX..."
798
807
  }, ...B(z).map((e) => ({
799
808
  value: e.id,
800
809
  label: e.label ?? e.id
801
810
  }))];
802
- return /* @__PURE__ */ X(U, {
811
+ return /* @__PURE__ */ X(H, {
803
812
  label: "Post-Processing",
804
813
  divided: !0,
805
- children: [/* @__PURE__ */ Y(Pt, {
814
+ children: [/* @__PURE__ */ Y(Ft, {
806
815
  chain: e,
807
816
  from: 1,
808
- layer: n,
809
- hostView: r,
817
+ layer: t,
818
+ hostView: n,
810
819
  toggleFilter: o,
811
820
  removeFilter: a,
812
821
  setStagePropAt: s,
@@ -820,123 +829,125 @@ function Ft({ chain: e, layer: n, hostView: r, addFilter: i, removeFilter: a, to
820
829
  value: "",
821
830
  disabled: e.length >= 8,
822
831
  onChange: (e) => {
823
- e && i(n.id, e);
832
+ e && r(t.id, e);
824
833
  }
825
834
  })]
826
835
  });
827
836
  }
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) => ({
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) => ({
830
839
  value: e.id,
831
840
  label: e.label
832
841
  })) : null;
833
- return Dt(() => {
834
- g && f(e.type, D(g, e.loopGroup));
842
+ return Ot(() => {
843
+ p && u(e.type, D(p, e.loopGroup));
835
844
  }, () => {
836
845
  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,
846
+ c(e.id, s(e, m(t, e), b(), { withFilters: !0 }));
847
+ }), /* @__PURE__ */ Y(Nt, {
848
+ title: h,
849
+ chips: _,
841
850
  active: e.presetId,
842
851
  onPick: (t) => {
843
- let n = v?.find((e) => e.id === t);
844
- n && t !== e.presetId && f(e.type, D(n, e.loopGroup));
852
+ let n = g?.find((e) => e.id === t);
853
+ n && t !== e.presetId && u(e.type, D(n, e.loopGroup));
845
854
  },
846
855
  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)
856
+ preStrip: e.loopGroup === "distress" ? /* @__PURE__ */ Y(wt, { layer: e }) : void 0,
857
+ tabStrip: /* @__PURE__ */ Y(U, {
858
+ variant: "filled",
859
+ value: a,
860
+ onChange: o,
861
+ options: r === "sm" ? At : jt,
862
+ size: r,
863
+ className: C(r)
854
864
  }),
855
865
  children: /* @__PURE__ */ Y(P, {
856
866
  layer: e,
857
- setProp: p.setProp,
858
- patch: p.patch,
859
- updateLayer: l,
860
- palette: u,
861
- renderAnimate: r ? (t) => /* @__PURE__ */ Y(V, {
867
+ setProp: d.setProp,
868
+ patch: d.patch,
869
+ updateLayer: c,
870
+ palette: l,
871
+ renderAnimate: t ? (t) => /* @__PURE__ */ Y(le, {
862
872
  layer: e,
863
873
  param: t,
864
- setProp: p.setProp
874
+ setProp: d.setProp
865
875
  }) : void 0,
866
- tab: s,
876
+ tab: a,
867
877
  tabStrip: null,
868
- tree: i,
878
+ tree: n,
869
879
  inline: !0
870
880
  })
871
881
  });
872
882
  }
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)
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(() => {
886
+ u && c("kinetic", {
887
+ presetId: u.id,
888
+ presetLabel: u.label,
889
+ comp: he(u)
880
890
  });
881
891
  }, () => {
882
- let t = d(), n = b(t >>> 0), r = e.comp ?? { instances: [] };
892
+ let t = b(), n = p(t >>> 0), r = e.comp ?? { instances: [] };
883
893
  (r.instances ?? []).forEach((e, t) => {
884
- r = ue(r, t, n);
885
- }), c(e.id, {
894
+ r = de(r, t, n);
895
+ }), o(e.id, {
886
896
  comp: r,
887
897
  _rollSeed: t
888
898
  });
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)
899
+ }), /* @__PURE__ */ Y(Nt, {
900
+ title: d,
901
+ tabStrip: /* @__PURE__ */ Y(U, {
902
+ variant: "filled",
903
+ value: r,
904
+ onChange: a,
905
+ options: n === "sm" ? At : jt,
906
+ size: n,
907
+ className: C(n)
897
908
  }),
898
- children: /* @__PURE__ */ Y(pe, {
909
+ children: /* @__PURE__ */ Y(me, {
899
910
  layer: e,
900
- setProp: f.setProp,
901
- updateLayer: c,
902
- palette: l,
903
- renderAnimate: r ? (t) => /* @__PURE__ */ Y(V, {
911
+ setProp: l.setProp,
912
+ updateLayer: o,
913
+ palette: s,
914
+ renderAnimate: t ? (t) => /* @__PURE__ */ Y(le, {
904
915
  layer: e,
905
916
  param: t,
906
- setProp: f.setProp
917
+ setProp: l.setProp
907
918
  }) : () => null,
908
- tab: o,
919
+ tab: r,
909
920
  tabStrip: null
910
921
  })
911
922
  });
912
923
  }
913
- function Rt() {
914
- let { layer: e } = Z(), t = !!x().labsModDots;
924
+ function zt() {
925
+ let { layer: e } = Q(), t = !!g().labsModDots;
915
926
  return G(() => {
916
927
  let e = (e) => {
917
928
  if (e.key !== "m" && e.key !== "M" || e.metaKey || e.ctrlKey || e.altKey) return;
918
929
  let t = e.target;
919
- t?.tagName === "INPUT" || t?.tagName === "TEXTAREA" || t?.isContentEditable || u("labsModDots", !_().labsModDots);
930
+ t?.tagName === "INPUT" || t?.tagName === "TEXTAREA" || t?.isContentEditable || d("labsModDots", !v().labsModDots);
920
931
  };
921
932
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
922
- }, []), e ? e.type === "photo" ? /* @__PURE__ */ Y(Nt, {
933
+ }, []), e ? e.type === "photo" ? /* @__PURE__ */ Y(Pt, {
923
934
  layer: e,
924
935
  showMod: t
925
- }, e.id) : e.type === "loop" ? /* @__PURE__ */ Y(It, {
936
+ }, e.id) : e.type === "loop" ? /* @__PURE__ */ Y(Lt, {
926
937
  layer: e,
927
938
  showMod: t
928
- }, e.id) : e.type === "misc" ? /* @__PURE__ */ Y(It, {
939
+ }, e.id) : e.type === "misc" ? /* @__PURE__ */ Y(Lt, {
929
940
  layer: e,
930
941
  showMod: t,
931
942
  tree: N
932
- }, e.id) : e.type === "kinetic" ? /* @__PURE__ */ Y(Lt, {
943
+ }, e.id) : e.type === "kinetic" ? /* @__PURE__ */ Y(Rt, {
933
944
  layer: e,
934
945
  showMod: t
935
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." });
936
947
  }
937
948
  //#endregion
938
949
  //#region src/editor/labs/LabsShortcuts.jsx
939
- var zt = [
950
+ var Bt = [
940
951
  ["0.5", "a plain value — stays put (normal slider)"],
941
952
  ["t", "counts up in seconds: 0, 1, 2 …"],
942
953
  ["t*0.1", "counts up slowly"],
@@ -946,14 +957,14 @@ var zt = [
946
957
  ["wave(t*0.5)*40", "bounce, scaled to 0 … 40"],
947
958
  ["saw(t)", "ramp 0 → 1, repeat"],
948
959
  ["tri(t)", "triangle 0 → 1 → 0"]
949
- ], Bt = [
960
+ ], Vt = [
950
961
  ["Oscillators · 0…1", "wave saw tri pulse(t,w) ease(t,c) bell step(t,n)"],
951
962
  ["Trig", "sin cos tan atan2"],
952
963
  ["Math", "abs floor ceil round sqrt pow"],
953
964
  ["Helpers", "clamp(x,a,b) lerp(a,b,u) mod(a,b) frac smooth"],
954
965
  ["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() {
966
+ ], Ht = () => [...Pe("labs").flatMap(({ items: e }) => e.map((e) => [_e(e.combo), e.label])), ["Esc", "close"]];
967
+ function Ut() {
957
968
  let [e, t] = q(!1);
958
969
  return G(() => {
959
970
  let e = (e) => {
@@ -994,14 +1005,14 @@ function Ht() {
994
1005
  " is the playhead in seconds, so it pauses / scrubs / tempo-scales with the transport. Drag the slider to clear an expression."
995
1006
  ]
996
1007
  }),
997
- /* @__PURE__ */ Y(U, {
1008
+ /* @__PURE__ */ Y(H, {
998
1009
  label: "Examples",
999
1010
  children: /* @__PURE__ */ Y("div", {
1000
1011
  className: "flex flex-col gap-1",
1001
- children: zt.map(([e, t]) => /* @__PURE__ */ X("div", {
1012
+ children: Bt.map(([e, t]) => /* @__PURE__ */ X("div", {
1002
1013
  className: "flex items-center gap-4",
1003
1014
  children: [/* @__PURE__ */ Y("code", {
1004
- className: "kol-mono-12 text-emphasis bg-fg-04 rounded px-2 py-0.5",
1015
+ className: "kol-mono-12 text-emphasis bg-oq-04 rounded px-2 py-0.5",
1005
1016
  style: { minWidth: 132 },
1006
1017
  children: e
1007
1018
  }), /* @__PURE__ */ Y("span", {
@@ -1011,7 +1022,7 @@ function Ht() {
1011
1022
  }, e))
1012
1023
  })
1013
1024
  }),
1014
- /* @__PURE__ */ Y(U, {
1025
+ /* @__PURE__ */ Y(H, {
1015
1026
  label: "Loop",
1016
1027
  children: /* @__PURE__ */ X("p", {
1017
1028
  className: "kol-mono-12 text-body",
@@ -1026,11 +1037,11 @@ function Ht() {
1026
1037
  ]
1027
1038
  })
1028
1039
  }),
1029
- /* @__PURE__ */ Y(U, {
1040
+ /* @__PURE__ */ Y(H, {
1030
1041
  label: "Functions",
1031
1042
  children: /* @__PURE__ */ Y("div", {
1032
1043
  className: "flex flex-col gap-2",
1033
- children: Bt.map(([e, t]) => /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("p", {
1044
+ children: Vt.map(([e, t]) => /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("p", {
1034
1045
  className: "kol-helper-10 text-subtle",
1035
1046
  children: e
1036
1047
  }), /* @__PURE__ */ Y("p", {
@@ -1041,7 +1052,7 @@ function Ht() {
1041
1052
  }),
1042
1053
  /* @__PURE__ */ Y("div", {
1043
1054
  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", {
1055
+ children: Ht().map(([e, t]) => /* @__PURE__ */ X("span", {
1045
1056
  className: "kol-mono-12",
1046
1057
  children: [
1047
1058
  /* @__PURE__ */ Y("span", {
@@ -1063,15 +1074,15 @@ function Ht() {
1063
1074
  }
1064
1075
  //#endregion
1065
1076
  //#region src/editor/labs/LabsView.jsx
1066
- var Ut = .85, Wt = .3, Gt = 2.5, Kt = {
1077
+ var Wt = .85, Gt = .3, Kt = 2.5, qt = {
1067
1078
  0: 1,
1068
1079
  1: .5,
1069
1080
  2: 1,
1070
1081
  3: 1.5,
1071
1082
  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);
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);
1075
1086
  return f.current = d, G(() => {
1076
1087
  let e = s.current;
1077
1088
  if (!e) return;
@@ -1088,7 +1099,7 @@ function Jt() {
1088
1099
  a((e) => !e);
1089
1100
  return;
1090
1101
  }
1091
- Kt[e.key] !== void 0 && r(Kt[e.key]);
1102
+ qt[e.key] !== void 0 && r(qt[e.key]);
1092
1103
  }
1093
1104
  };
1094
1105
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
@@ -1097,46 +1108,57 @@ function Jt() {
1097
1108
  className: "relative w-full h-full flex items-center justify-center",
1098
1109
  style: { background: "var(--kol-surface-secondary)" },
1099
1110
  onDoubleClick: () => r(1),
1100
- children: [t ? /* @__PURE__ */ Y(Et, { layer: e }) : /* @__PURE__ */ Y("div", {
1111
+ children: [t ? /* @__PURE__ */ Y(Dt, { layer: e }) : /* @__PURE__ */ Y("div", {
1101
1112
  style: {
1102
- width: `${n * Ut * 100}%`,
1103
- height: `${n * Ut * 100}%`
1113
+ width: `${n * Wt * 100}%`,
1114
+ height: `${n * Wt * 100}%`
1104
1115
  },
1105
1116
  children: /* @__PURE__ */ Y(tt, {})
1106
1117
  }), /* @__PURE__ */ X("div", {
1107
1118
  className: "absolute bottom-3 right-3 z-[3] flex items-center gap-2",
1108
1119
  children: [
1109
- /* @__PURE__ */ Y("button", {
1110
- type: "button",
1111
- className: qt,
1112
- title: "Zoom out",
1113
- onClick: () => l(-1),
1114
- children: "−"
1120
+ /* @__PURE__ */ Y(W, {
1121
+ label: "Zoom out",
1122
+ children: /* @__PURE__ */ Y("button", {
1123
+ "aria-label": "Zoom out",
1124
+ type: "button",
1125
+ className: Jt,
1126
+ onClick: () => l(-1),
1127
+ children: "−"
1128
+ })
1115
1129
  }),
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), "%"]
1130
+ /* @__PURE__ */ Y(W, {
1131
+ label: "Reset zoom (0)",
1132
+ children: /* @__PURE__ */ X("button", {
1133
+ "aria-label": "Reset zoom (0)",
1134
+ type: "button",
1135
+ className: Jt,
1136
+ onClick: () => r(1),
1137
+ children: [Math.round(n * 100), "%"]
1138
+ })
1122
1139
  }),
1123
- /* @__PURE__ */ Y("button", {
1124
- type: "button",
1125
- className: qt,
1126
- title: "Zoom in",
1127
- onClick: () => l(1),
1128
- children: "+"
1140
+ /* @__PURE__ */ Y(W, {
1141
+ label: "Zoom in",
1142
+ children: /* @__PURE__ */ Y("button", {
1143
+ "aria-label": "Zoom in",
1144
+ type: "button",
1145
+ className: Jt,
1146
+ onClick: () => l(1),
1147
+ children: "+"
1148
+ })
1129
1149
  }),
1130
- i && /* @__PURE__ */ X("span", {
1131
- className: qt,
1132
- title: "Framerate — press F to hide",
1133
- children: [o, " fps"]
1150
+ i && /* @__PURE__ */ Y(W, {
1151
+ label: "Framerate — press F to hide",
1152
+ children: /* @__PURE__ */ X("span", {
1153
+ className: Jt,
1154
+ children: [o, " fps"]
1155
+ })
1134
1156
  })
1135
1157
  ]
1136
1158
  })]
1137
1159
  });
1138
1160
  }
1139
- function Yt() {
1161
+ function Xt() {
1140
1162
  let e = K(null), { grabProps: t } = mt(e, {
1141
1163
  token: "kol-rail",
1142
1164
  side: "right"
@@ -1183,47 +1205,50 @@ function Yt() {
1183
1205
  className: "kol-compose-rail kol-compose-rail--inspector",
1184
1206
  children: [/* @__PURE__ */ Y("div", { ...t }), /* @__PURE__ */ Y("div", {
1185
1207
  className: "kol-compose-inspector-body",
1186
- children: /* @__PURE__ */ Y(Rt, {})
1208
+ children: /* @__PURE__ */ Y(zt, {})
1187
1209
  })]
1188
1210
  });
1189
1211
  }
1190
- var Xt = dt(null);
1191
- function Zt() {
1192
- let { paramsOpen: e, toggleParams: t } = pt(Xt);
1212
+ var Zt = dt(null);
1213
+ function Qt() {
1214
+ let { paramsOpen: e, toggleParams: t } = pt(Zt);
1193
1215
  return /* @__PURE__ */ Y("div", {
1194
1216
  className: "flex h-12 shrink-0 items-center border-b border-oq-08 bg-surface-primary px-2",
1195
- children: /* @__PURE__ */ Y(H, {
1196
- variant: "nav",
1197
- size: "lg",
1198
- iconOnly: "panel-right",
1199
- "aria-label": "Parameters",
1200
- pressed: e,
1201
- onClick: t
1217
+ children: /* @__PURE__ */ Y(W, {
1218
+ label: "Parameters",
1219
+ children: /* @__PURE__ */ Y(V, {
1220
+ variant: "nav",
1221
+ size: "lg",
1222
+ iconOnly: "panel-right",
1223
+ "aria-label": "Parameters",
1224
+ pressed: e,
1225
+ onClick: t
1226
+ })
1202
1227
  })
1203
1228
  });
1204
1229
  }
1205
- function Qt() {
1230
+ function $t() {
1206
1231
  return /* @__PURE__ */ Y("div", {
1207
1232
  className: "kol-compose-rail kol-compose-rail--inspector",
1208
1233
  children: /* @__PURE__ */ Y("div", {
1209
1234
  className: "kol-compose-inspector-body",
1210
- children: /* @__PURE__ */ Y(Rt, {})
1235
+ children: /* @__PURE__ */ Y(zt, {})
1211
1236
  })
1212
1237
  });
1213
1238
  }
1214
- var $t = {
1239
+ var en = {
1215
1240
  topbar: () => null,
1216
- canvas: Jt,
1241
+ canvas: Yt,
1217
1242
  panels: [
1218
1243
  {
1219
1244
  slot: "canvas.footer",
1220
1245
  order: 0,
1221
- Component: de
1246
+ Component: fe
1222
1247
  },
1223
1248
  {
1224
1249
  slot: "right.body",
1225
1250
  order: 0,
1226
- Component: Yt
1251
+ Component: Xt
1227
1252
  },
1228
1253
  {
1229
1254
  slot: "right.footer",
@@ -1231,97 +1256,97 @@ var $t = {
1231
1256
  Component: Je
1232
1257
  }
1233
1258
  ]
1234
- }, en = {
1235
- ...$t,
1236
- topbar: Zt,
1237
- panels: $t.panels.map((e) => e.Component === Yt ? {
1259
+ }, tn = {
1260
+ ...en,
1261
+ topbar: Qt,
1262
+ panels: en.panels.map((e) => e.Component === Xt ? {
1238
1263
  ...e,
1239
- Component: Qt
1264
+ Component: $t
1240
1265
  } : e)
1241
1266
  };
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(() => {
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(() => {
1245
1270
  if (o.current) return;
1246
1271
  o.current = !0;
1247
- let t = _();
1248
- t.defaultAspect && t.defaultAspect !== "custom" && e(t.defaultAspect), t.defaultLoopSeconds && C.setLoopSeconds(t.defaultLoopSeconds);
1272
+ let n = v();
1273
+ n.defaultAspect && n.defaultAspect !== "custom" && e(n.defaultAspect), n.defaultLoopSeconds && t.setLoopSeconds(n.defaultLoopSeconds);
1249
1274
  }, []);
1250
- let u = K(!1);
1275
+ let d = K(!1);
1251
1276
  G(() => {
1252
- if (u.current) return;
1253
- u.current = !0;
1277
+ if (d.current) return;
1278
+ d.current = !0;
1254
1279
  let e = new URLSearchParams(window.location.search).get("preset"), t = e ? j(e) : null;
1255
1280
  t && a("loop", D(w(e), t));
1256
1281
  }, [a]);
1257
- let { tool: d, setTool: f } = we(), p = K(d);
1258
- return p.current = d, G(() => {
1282
+ let { tool: p, setTool: m } = Se(), h = K(p);
1283
+ return h.current = p, G(() => {
1259
1284
  let e = (e) => {
1260
- let t = e.target;
1261
- if (!(t?.tagName === "INPUT" || t?.tagName === "TEXTAREA" || t?.isContentEditable)) {
1285
+ let n = e.target;
1286
+ if (!(n?.tagName === "INPUT" || n?.tagName === "TEXTAREA" || n?.isContentEditable)) {
1262
1287
  if (e.code === "Space") {
1263
- e.preventDefault(), C.toggle();
1288
+ e.preventDefault(), t.toggle();
1264
1289
  return;
1265
1290
  }
1266
- (e.key === "c" || e.key === "C") && !e.metaKey && !e.ctrlKey && !e.altKey && f(p.current === "orbit" ? "select" : "orbit");
1291
+ (e.key === "c" || e.key === "C") && !e.metaKey && !e.ctrlKey && !e.altKey && m(h.current === "orbit" ? "select" : "orbit");
1267
1292
  }
1268
1293
  };
1269
1294
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
1270
- }, [f]), G(() => {
1295
+ }, [m]), G(() => {
1271
1296
  if (!i?.presetId) return;
1272
1297
  let e = new URLSearchParams(window.location.search);
1273
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}`));
1274
1299
  }, [i?.presetId, i?.loopGroup]), G(() => {
1275
- i && t !== i.id && r(i.id);
1300
+ i && n !== i.id && r(i.id);
1276
1301
  }, [
1277
1302
  i,
1278
- t,
1303
+ n,
1279
1304
  r
1280
1305
  ]), /* @__PURE__ */ X("div", {
1281
1306
  className: "kol-editor-labs contents",
1282
1307
  "data-touch": s || void 0,
1283
- "data-params": c ? "open" : void 0,
1308
+ "data-params": l ? "open" : void 0,
1284
1309
  children: [
1285
- /* @__PURE__ */ Y(xt, {}),
1286
- s ? /* @__PURE__ */ Y(Xt.Provider, {
1310
+ /* @__PURE__ */ Y(St, {}),
1311
+ s ? /* @__PURE__ */ Y(Zt.Provider, {
1287
1312
  value: {
1288
- paramsOpen: c,
1289
- toggleParams: () => l((e) => !e)
1313
+ paramsOpen: l,
1314
+ toggleParams: () => u((e) => !e)
1290
1315
  },
1291
- children: /* @__PURE__ */ Y(S.Provider, {
1316
+ children: /* @__PURE__ */ Y(c.Provider, {
1292
1317
  value: "md",
1293
- children: /* @__PURE__ */ Y(it, { registry: en })
1318
+ children: /* @__PURE__ */ Y(Re, { registry: tn })
1294
1319
  })
1295
- }) : /* @__PURE__ */ Y(it, { registry: $t }),
1296
- /* @__PURE__ */ Y(Ht, {})
1320
+ }) : /* @__PURE__ */ Y(Re, { registry: en }),
1321
+ /* @__PURE__ */ Y(Ut, {})
1297
1322
  ]
1298
1323
  });
1299
1324
  }
1300
- var nn = "kol.editor.labs-draft";
1301
- function rn() {
1325
+ var rn = "kol.editor.labs-draft";
1326
+ function an() {
1302
1327
  return /* @__PURE__ */ Y(Ze, {
1303
- draftKey: nn,
1304
- children: /* @__PURE__ */ Y(tn, {})
1328
+ draftKey: rn,
1329
+ children: /* @__PURE__ */ Y(nn, {})
1305
1330
  });
1306
1331
  }
1307
1332
  //#endregion
1308
1333
  //#region src/editor/mobile/CategoryScreen.jsx
1309
- var an = "w-full [&>span]:w-full [&>span]:justify-between";
1310
- function on(e) {
1334
+ var on = "w-full [&>span]:w-full [&>span]:justify-between";
1335
+ function sn(e) {
1311
1336
  G(() => {
1312
1337
  let t = (t) => {
1313
1338
  t.key === "Escape" && e?.();
1314
1339
  };
1315
1340
  return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
1316
1341
  }, [e]), G(() => {
1317
- let e = C.isPlaying();
1318
- return C.pause(), () => {
1319
- e && C.play();
1342
+ let e = t.isPlaying();
1343
+ return t.pause(), () => {
1344
+ e && t.play();
1320
1345
  };
1321
1346
  }, []);
1322
1347
  }
1323
- function sn({ onPick: e, onInsert: t, onBack: n, onDismiss: r }) {
1324
- return on(r ?? n), /* @__PURE__ */ Y("div", {
1348
+ function cn({ onPick: e, onInsert: t, onBack: n, onDismiss: r }) {
1349
+ return sn(r ?? n), /* @__PURE__ */ Y("div", {
1325
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",
1326
1351
  style: { zIndex: "var(--kol-z-modal)" },
1327
1352
  children: /* @__PURE__ */ X("div", {
@@ -1335,11 +1360,11 @@ function sn({ onPick: e, onInsert: t, onBack: n, onDismiss: r }) {
1335
1360
  /* @__PURE__ */ Y("div", {
1336
1361
  className: "flex flex-col gap-2",
1337
1362
  children: F.map((t) => {
1338
- let n = Q[`gen:${t.label}`] ?? "square";
1339
- return /* @__PURE__ */ Y(H, {
1363
+ let n = $[`gen:${t.label}`] ?? "square";
1364
+ return /* @__PURE__ */ Y(V, {
1340
1365
  variant: "primary",
1341
1366
  size: "lg",
1342
- className: an,
1367
+ className: on,
1343
1368
  iconLeft: n,
1344
1369
  iconRight: n,
1345
1370
  onClick: () => e(t),
@@ -1349,7 +1374,7 @@ function sn({ onPick: e, onInsert: t, onBack: n, onDismiss: r }) {
1349
1374
  }),
1350
1375
  /* @__PURE__ */ X("div", {
1351
1376
  className: "flex flex-col gap-2",
1352
- children: [t && /* @__PURE__ */ Y(H, {
1377
+ children: [t && /* @__PURE__ */ Y(V, {
1353
1378
  variant: "grey",
1354
1379
  size: "lg",
1355
1380
  className: "w-full [&>span]:w-full [&>span]:justify-between",
@@ -1357,7 +1382,7 @@ function sn({ onPick: e, onInsert: t, onBack: n, onDismiss: r }) {
1357
1382
  iconRight: "image",
1358
1383
  onClick: t,
1359
1384
  children: "Insert image or video"
1360
- }), n && /* @__PURE__ */ Y(H, {
1385
+ }), n && /* @__PURE__ */ Y(V, {
1361
1386
  variant: "grey",
1362
1387
  size: "lg",
1363
1388
  className: "w-full [&>span]:w-full [&>span]:justify-between",
@@ -1373,9 +1398,9 @@ function sn({ onPick: e, onInsert: t, onBack: n, onDismiss: r }) {
1373
1398
  }
1374
1399
  //#endregion
1375
1400
  //#region src/editor/mobile/EffectScreen.jsx
1376
- function cn({ layer: e, chain: t, onPick: n, onBack: r }) {
1401
+ function ln({ layer: e, chain: t, onPick: n, onBack: r }) {
1377
1402
  let [i, a] = q(null);
1378
- on(r);
1403
+ sn(r);
1379
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;
1380
1405
  return /* @__PURE__ */ Y("div", {
1381
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",
@@ -1390,20 +1415,20 @@ function cn({ layer: e, chain: t, onPick: n, onBack: r }) {
1390
1415
  }),
1391
1416
  /* @__PURE__ */ Y("div", {
1392
1417
  className: "flex flex-col gap-2",
1393
- children: (l ? l.filters : c).map((e) => /* @__PURE__ */ Y(H, {
1418
+ children: (l ? l.filters : c).map((e) => /* @__PURE__ */ Y(V, {
1394
1419
  variant: "primary",
1395
1420
  size: "lg",
1396
- className: an,
1421
+ className: on,
1397
1422
  iconLeft: l ? "filter" : "chevron-right",
1398
1423
  iconRight: l ? "filter" : "chevron-right",
1399
1424
  onClick: () => l ? n(e.id) : a(e.id),
1400
1425
  children: e.label
1401
1426
  }, e.id))
1402
1427
  }),
1403
- /* @__PURE__ */ Y(H, {
1428
+ /* @__PURE__ */ Y(V, {
1404
1429
  variant: "grey",
1405
1430
  size: "lg",
1406
- className: an,
1431
+ className: on,
1407
1432
  iconLeft: "arrow-left",
1408
1433
  iconRight: "arrow-left",
1409
1434
  onClick: () => l ? a(null) : r(),
@@ -1415,7 +1440,7 @@ function cn({ layer: e, chain: t, onPick: n, onBack: r }) {
1415
1440
  }
1416
1441
  //#endregion
1417
1442
  //#region src/editor/mobile/MobileOverlay.jsx
1418
- var ln = { background: "var(--kol-surface-primary)" }, un = [
1443
+ var un = { background: "var(--kol-surface-primary)" }, dn = [
1419
1444
  {
1420
1445
  value: "generate",
1421
1446
  label: "Generate"
@@ -1432,26 +1457,27 @@ var ln = { background: "var(--kol-surface-primary)" }, un = [
1432
1457
  value: "output",
1433
1458
  label: "Output"
1434
1459
  }
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) {
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) {
1437
1462
  let t = Math.min(window.innerWidth, 480) - 24, n = [], r = [], i = 0;
1438
1463
  for (let a of e) {
1439
- let e = a.label.length * pn + mn, o = Math.max(i, e);
1464
+ let e = a.label.length * mn + hn, o = Math.max(i, e);
1440
1465
  r.length && (r.length + 1) * o > t ? (n.push(r), r = [a], i = e) : (r.push(a), i = o);
1441
1466
  }
1442
1467
  return r.length && n.push(r), n;
1443
1468
  }
1444
- function gn({ cells: e }) {
1445
- return hn(e).map((e, t) => /* @__PURE__ */ Y(W, {
1469
+ function _n({ cells: e }) {
1470
+ return gn(e).map((e, t) => /* @__PURE__ */ Y(U, {
1471
+ variant: "filled",
1446
1472
  value: null,
1447
1473
  onChange: (t) => e.find((e) => e.value === t)?.run(),
1448
1474
  options: e,
1449
1475
  size: "lg",
1450
1476
  ariaLabel: "Randomize scope",
1451
- className: fn
1477
+ className: pn
1452
1478
  }, t));
1453
1479
  }
1454
- var _n = [
1480
+ var vn = [
1455
1481
  2,
1456
1482
  4,
1457
1483
  8,
@@ -1460,17 +1486,18 @@ var _n = [
1460
1486
  value: String(e),
1461
1487
  label: `${e}s`
1462
1488
  }));
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,
1489
+ function yn() {
1490
+ let { loopSeconds: e, setLoopSeconds: t } = n();
1491
+ return /* @__PURE__ */ Y(U, {
1492
+ variant: "filled",
1493
+ value: String(e),
1494
+ onChange: (e) => t(Number(e)),
1495
+ options: vn,
1469
1496
  size: "lg",
1470
1497
  ariaLabel: "Loop length"
1471
1498
  });
1472
1499
  }
1473
- var yn = [
1500
+ var bn = [
1474
1501
  {
1475
1502
  value: "9:16",
1476
1503
  label: "9:16"
@@ -1487,7 +1514,7 @@ var yn = [
1487
1514
  value: "1:1",
1488
1515
  label: "1:1"
1489
1516
  }
1490
- ], bn = [
1517
+ ], xn = [
1491
1518
  {
1492
1519
  value: "5:4",
1493
1520
  label: "5:4"
@@ -1505,95 +1532,96 @@ var yn = [
1505
1532
  label: "Fill"
1506
1533
  }
1507
1534
  ];
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);
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);
1510
1537
  if (!e) return null;
1511
- if (y) return /* @__PURE__ */ Y("button", {
1538
+ if (b) return /* @__PURE__ */ Y("button", {
1512
1539
  "aria-label": "Show controls",
1513
1540
  className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] z-20",
1514
- onClick: () => b(!1)
1541
+ onClick: () => x(!1)
1515
1542
  });
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 });
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 });
1522
1549
  };
1523
- if (!x) return /* @__PURE__ */ X("div", {
1550
+ if (!S) return /* @__PURE__ */ X("div", {
1524
1551
  className: "fixed bottom-[max(0.75rem,env(safe-area-inset-bottom))] left-[var(--fxr-rail,0px)] z-10 flex gap-2 px-3",
1525
1552
  children: [
1526
- /* @__PURE__ */ Y(H, {
1553
+ /* @__PURE__ */ Y(V, {
1527
1554
  variant: "primary",
1528
1555
  size: "lg",
1529
- onClick: () => S(!0),
1556
+ onClick: () => C(!0),
1530
1557
  children: /* @__PURE__ */ X("span", {
1531
1558
  className: "flex items-center gap-2",
1532
- children: [N ? e.presetLabel : "Media", /* @__PURE__ */ Y(v, {
1559
+ children: [N ? e.presetLabel : "Media", /* @__PURE__ */ Y(Z, {
1533
1560
  name: "chevron-down",
1534
1561
  size: 16,
1535
1562
  className: "rotate-180"
1536
1563
  })]
1537
1564
  })
1538
1565
  }),
1539
- (N || R.length > 0) && /* @__PURE__ */ Y(H, {
1566
+ (N || R.length > 0) && /* @__PURE__ */ Y(V, {
1540
1567
  variant: "primary",
1541
1568
  size: "lg",
1542
1569
  onClick: L,
1543
1570
  children: "Randomize all"
1544
1571
  }),
1545
- /* @__PURE__ */ Y(H, {
1572
+ /* @__PURE__ */ Y(V, {
1546
1573
  variant: "primary",
1547
1574
  size: "lg",
1548
- onClick: () => _(2),
1575
+ onClick: () => y(2),
1549
1576
  children: "Download"
1550
1577
  })
1551
1578
  ]
1552
1579
  });
1553
- let re = (N ? un : dn).filter((e) => e.value !== "effects" || ne), B = re.some((e) => e.value === A) ? A : re[0].value;
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;
1554
1581
  return /* @__PURE__ */ X(J, { children: [
1555
- w && /* @__PURE__ */ Y(sn, {
1582
+ w && /* @__PURE__ */ Y(cn, {
1556
1583
  onPick: (e) => {
1557
- t(e), T(!1);
1584
+ n(e), T(!1);
1558
1585
  },
1559
1586
  onInsert: () => {
1560
- T(!1), r();
1587
+ T(!1), i();
1561
1588
  },
1562
1589
  onBack: () => {
1563
- T(!1), a();
1590
+ T(!1), o();
1564
1591
  },
1565
1592
  onDismiss: () => T(!1)
1566
1593
  }),
1567
- E && /* @__PURE__ */ Y(cn, {
1594
+ E && /* @__PURE__ */ Y(ln, {
1568
1595
  layer: e,
1569
1596
  chain: R,
1570
1597
  onPick: (t) => {
1571
- u(e.id, t), D(!1);
1598
+ g(e.id, t), D(!1);
1572
1599
  },
1573
1600
  onBack: () => D(!1)
1574
1601
  }),
1575
1602
  /* @__PURE__ */ X("div", {
1576
1603
  className: "fixed right-0 left-[var(--fxr-rail,0px)] bottom-0 z-10 pb-[env(safe-area-inset-bottom)]",
1577
- style: ln,
1604
+ style: un,
1578
1605
  children: [/* @__PURE__ */ X("div", {
1579
1606
  className: "flex w-full items-center px-3",
1580
1607
  children: [/* @__PURE__ */ X("button", {
1581
1608
  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, {
1609
+ onClick: () => C(!1),
1610
+ children: [/* @__PURE__ */ Y("span", { children: P }), /* @__PURE__ */ Y(Z, {
1584
1611
  name: "chevron-down",
1585
1612
  size: 16,
1586
1613
  className: "text-oq-48"
1587
1614
  })]
1588
1615
  }), /* @__PURE__ */ Y("button", {
1589
1616
  className: "kol-helper-12 text-meta py-2.5",
1590
- onClick: a,
1617
+ onClick: o,
1591
1618
  children: "Start over"
1592
1619
  })]
1593
1620
  }), /* @__PURE__ */ X("div", {
1594
1621
  className: "px-3 pb-3",
1595
1622
  children: [
1596
- /* @__PURE__ */ Y(W, {
1623
+ /* @__PURE__ */ Y(U, {
1624
+ variant: "filled",
1597
1625
  value: B,
1598
1626
  onChange: j,
1599
1627
  options: re,
@@ -1605,35 +1633,34 @@ function xn({ layer: e, onSwitchCategory: t, onInsert: r, onRestart: a, aspectVa
1605
1633
  children: [
1606
1634
  /* @__PURE__ */ X("div", {
1607
1635
  className: "grid grid-cols-2 gap-2",
1608
- children: [/* @__PURE__ */ Y(H, {
1609
- iconComponent: v,
1636
+ children: [/* @__PURE__ */ Y(V, {
1610
1637
  variant: "primary",
1611
1638
  size: "lg",
1612
1639
  iconRight: "refresh",
1613
1640
  onClick: te,
1614
1641
  children: "Preset"
1615
- }), /* @__PURE__ */ Y(H, {
1642
+ }), /* @__PURE__ */ Y(V, {
1616
1643
  variant: "primary",
1617
1644
  size: "lg",
1618
1645
  onClick: () => T(!0),
1619
1646
  children: "Generator"
1620
1647
  })]
1621
1648
  }),
1622
- /* @__PURE__ */ Y(H, {
1649
+ /* @__PURE__ */ Y(V, {
1623
1650
  variant: "primary",
1624
1651
  size: "lg",
1625
1652
  className: "w-full",
1626
1653
  onClick: L,
1627
1654
  children: "Randomize all"
1628
1655
  }),
1629
- I.length > 0 && /* @__PURE__ */ Y(gn, { cells: [...I.map((e) => ({
1656
+ I.length > 0 && /* @__PURE__ */ Y(_n, { cells: [...I.map((e) => ({
1630
1657
  value: e.id,
1631
1658
  label: e.label,
1632
1659
  run: () => ee(e)
1633
1660
  })), {
1634
1661
  value: "__retrigger",
1635
1662
  label: "Re-trigger",
1636
- run: () => C.rewind()
1663
+ run: () => t.rewind()
1637
1664
  }] })
1638
1665
  ]
1639
1666
  }),
@@ -1641,12 +1668,12 @@ function xn({ layer: e, onSwitchCategory: t, onInsert: r, onRestart: a, aspectVa
1641
1668
  className: "flex flex-col gap-2 pt-3",
1642
1669
  children: [/* @__PURE__ */ X("div", {
1643
1670
  className: "grid grid-cols-2 gap-2",
1644
- children: [/* @__PURE__ */ Y(H, {
1671
+ children: [/* @__PURE__ */ Y(V, {
1645
1672
  variant: "primary",
1646
1673
  size: "lg",
1647
1674
  onClick: () => D(!0),
1648
1675
  children: "Add effect"
1649
- }), /* @__PURE__ */ Y(H, {
1676
+ }), /* @__PURE__ */ Y(V, {
1650
1677
  variant: "primary",
1651
1678
  size: "lg",
1652
1679
  disabled: !R.length,
@@ -1658,9 +1685,9 @@ function xn({ layer: e, onSwitchCategory: t, onInsert: r, onRestart: a, aspectVa
1658
1685
  ...e,
1659
1686
  ...t.params,
1660
1687
  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 ? {
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 ? {
1664
1691
  ...e,
1665
1692
  params: {
1666
1693
  ...e.params,
@@ -1670,15 +1697,15 @@ function xn({ layer: e, onSwitchCategory: t, onInsert: r, onRestart: a, aspectVa
1670
1697
  };
1671
1698
  return /* @__PURE__ */ X("div", {
1672
1699
  className: "flex flex-col gap-2",
1673
- children: [/* @__PURE__ */ Y(H, {
1700
+ children: [/* @__PURE__ */ Y(V, {
1674
1701
  variant: "grey",
1675
1702
  size: "lg",
1676
1703
  className: "w-full [&>span]:w-full [&>span]:justify-between",
1677
1704
  iconLeft: "trash",
1678
1705
  iconRight: "trash",
1679
- onClick: () => d(e.id, n),
1706
+ onClick: () => v(e.id, n),
1680
1707
  children: `${n + 1}. ${t.def?.label ?? t.id}`
1681
- }), i.length > 0 && /* @__PURE__ */ Y(gn, { cells: i.map((e) => ({
1708
+ }), i.length > 0 && /* @__PURE__ */ Y(_n, { cells: i.map((e) => ({
1682
1709
  value: e.id,
1683
1710
  label: e.label,
1684
1711
  run: () => a(e)
@@ -1686,46 +1713,51 @@ function xn({ layer: e, onSwitchCategory: t, onInsert: r, onRestart: a, aspectVa
1686
1713
  }, t.key);
1687
1714
  })]
1688
1715
  }),
1689
- B === "transport" && /* @__PURE__ */ X("div", {
1716
+ B === "transport" && a("motion") && /* @__PURE__ */ X("div", {
1690
1717
  className: "flex flex-col gap-2 pt-3",
1691
- children: [/* @__PURE__ */ Y(Ue, { size: "lg" }), /* @__PURE__ */ Y(vn, {})]
1718
+ children: [(() => {
1719
+ let e = a("motion").TransportBar;
1720
+ return /* @__PURE__ */ Y(e, { size: "lg" });
1721
+ })(), /* @__PURE__ */ Y(yn, {})]
1692
1722
  }),
1693
1723
  B === "output" && /* @__PURE__ */ X("div", {
1694
1724
  className: "flex flex-col gap-2 pt-3",
1695
1725
  children: [
1696
- /* @__PURE__ */ Y(W, {
1697
- value: o,
1698
- onChange: s,
1699
- options: yn,
1726
+ /* @__PURE__ */ Y(U, {
1727
+ variant: "filled",
1728
+ value: c,
1729
+ onChange: d,
1730
+ options: bn,
1700
1731
  size: "lg",
1701
1732
  ariaLabel: "Aspect"
1702
1733
  }),
1703
- /* @__PURE__ */ Y(W, {
1704
- value: o,
1705
- onChange: s,
1706
- options: bn,
1734
+ /* @__PURE__ */ Y(U, {
1735
+ variant: "filled",
1736
+ value: c,
1737
+ onChange: d,
1738
+ options: xn,
1707
1739
  size: "lg",
1708
1740
  ariaLabel: "Aspect (landscape) and fill"
1709
1741
  }),
1710
1742
  /* @__PURE__ */ X("div", {
1711
1743
  className: "grid grid-cols-3 gap-2",
1712
1744
  children: [
1713
- /* @__PURE__ */ Y(H, {
1745
+ /* @__PURE__ */ Y(V, {
1714
1746
  variant: "primary",
1715
1747
  size: "lg",
1716
- onClick: () => _(2),
1748
+ onClick: () => y(2),
1717
1749
  children: "Download"
1718
1750
  }),
1719
- /* @__PURE__ */ Y(H, {
1751
+ /* @__PURE__ */ Y(V, {
1720
1752
  variant: "primary",
1721
1753
  size: "lg",
1722
- onClick: () => b(!0),
1754
+ onClick: () => x(!0),
1723
1755
  children: "Hide UI"
1724
1756
  }),
1725
- /* @__PURE__ */ Y(H, {
1757
+ /* @__PURE__ */ Y(V, {
1726
1758
  variant: "primary",
1727
1759
  size: "lg",
1728
- onClick: a,
1760
+ onClick: o,
1729
1761
  children: "Start over"
1730
1762
  })
1731
1763
  ]
@@ -1739,7 +1771,7 @@ function xn({ layer: e, onSwitchCategory: t, onInsert: r, onRestart: a, aspectVa
1739
1771
  }
1740
1772
  //#endregion
1741
1773
  //#region src/editor/mobile/MobileView.jsx
1742
- function Sn({ onGenerate: e }) {
1774
+ function Cn({ onGenerate: e }) {
1743
1775
  return /* @__PURE__ */ Y("div", {
1744
1776
  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
1777
  style: { zIndex: "var(--kol-z-modal)" },
@@ -1758,74 +1790,74 @@ function Sn({ onGenerate: e }) {
1758
1790
  }), /* @__PURE__ */ X("div", {
1759
1791
  className: "flex flex-col gap-2",
1760
1792
  children: [
1761
- /* @__PURE__ */ Y(H, {
1793
+ /* @__PURE__ */ Y(V, {
1762
1794
  variant: "primary",
1763
1795
  size: "lg",
1764
- className: an,
1765
- iconLeft: $.randomiser,
1766
- iconRight: $.randomiser,
1796
+ className: on,
1797
+ iconLeft: _t.randomiser,
1798
+ iconRight: _t.randomiser,
1767
1799
  onClick: e,
1768
1800
  children: "Generate"
1769
1801
  }),
1770
- We() && /* @__PURE__ */ Y(H, {
1802
+ We() && /* @__PURE__ */ Y(V, {
1771
1803
  variant: "primary",
1772
1804
  size: "lg",
1773
1805
  className: "w-full [&>span]:w-full [&>span]:justify-between",
1774
- iconLeft: $.editor,
1775
- iconRight: $.editor,
1806
+ iconLeft: _t.editor,
1807
+ iconRight: _t.editor,
1776
1808
  onClick: Ye,
1777
- children: ye("editor").label
1809
+ children: Me("editor").label
1778
1810
  }),
1779
- /* @__PURE__ */ Y(H, {
1811
+ /* @__PURE__ */ Y(V, {
1780
1812
  variant: "primary",
1781
1813
  size: "lg",
1782
- className: an,
1783
- iconLeft: $.labs,
1784
- iconRight: $.labs,
1785
- onClick: Me,
1786
- children: ye("labs").label
1814
+ className: on,
1815
+ iconLeft: _t.labs,
1816
+ iconRight: _t.labs,
1817
+ onClick: rt,
1818
+ children: Me("labs").label
1787
1819
  })
1788
1820
  ]
1789
1821
  })]
1790
1822
  })
1791
1823
  });
1792
1824
  }
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({
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({
1795
1827
  pts: /* @__PURE__ */ new Map(),
1796
1828
  startDist: 0,
1797
1829
  startScale: 1
1798
- }), S = K(null), w = () => {
1799
- let [e, t] = [...x.current.pts.values()];
1830
+ }), C = K(null), w = () => {
1831
+ let [e, t] = [...b.current.pts.values()];
1800
1832
  return Math.hypot(e.x - t.x, e.y - t.y);
1801
1833
  }, T = (e) => {
1802
- x.current.pts.set(e.pointerId, {
1834
+ b.current.pts.set(e.pointerId, {
1803
1835
  x: e.clientX,
1804
1836
  y: e.clientY
1805
- }), S.current = x.current.pts.size === 1 ? {
1837
+ }), C.current = b.current.pts.size === 1 ? {
1806
1838
  id: e.pointerId,
1807
1839
  x: e.clientX,
1808
1840
  y: e.clientY,
1809
1841
  t: performance.now()
1810
- } : null, x.current.pts.size === 2 && (x.current.startDist = w(), x.current.startScale = y, C.setStagePointer(null), e.stopPropagation());
1842
+ } : null, b.current.pts.size === 2 && (b.current.startDist = w(), b.current.startScale = v, t.setStagePointer(null), e.stopPropagation());
1811
1843
  }, E = (e) => {
1812
- let t = x.current;
1844
+ let t = b.current;
1813
1845
  t.pts.has(e.pointerId) && (t.pts.set(e.pointerId, {
1814
1846
  x: e.clientX,
1815
1847
  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))))));
1848
+ }), t.pts.size >= 2 && t.startDist > 0 && (e.stopPropagation(), y(Math.min(3, Math.max(.5, t.startScale * (w() / t.startDist))))));
1817
1849
  }, 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") {
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") {
1820
1852
  let e = k(O.loopId);
1821
- e && e.group !== "penrose" && e.kind !== "engine" && !A(e) && C.rewind();
1853
+ e && e.group !== "penrose" && e.kind !== "engine" && !A(e) && t.rewind();
1822
1854
  }
1823
- t?.id === e.pointerId && (S.current = null), x.current.pts.delete(e.pointerId), x.current.pts.size < 2 && (x.current.startDist = 0);
1855
+ n?.id === e.pointerId && (C.current = null), b.current.pts.delete(e.pointerId), b.current.pts.size < 2 && (b.current.startDist = 0);
1824
1856
  };
1825
1857
  ht(), G(() => {
1826
- u("4:5"), d("orbit");
1858
+ c("4:5"), l("orbit");
1827
1859
  }, []);
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";
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";
1829
1861
  G(() => {
1830
1862
  if (!j) return;
1831
1863
  let e = (e) => {
@@ -1834,69 +1866,69 @@ function Cn() {
1834
1866
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
1835
1867
  }), G(() => {
1836
1868
  if (!j) return;
1837
- let e = C.isPlaying();
1838
- return C.pause(), () => {
1839
- e && C.play();
1869
+ let e = t.isPlaying();
1870
+ return t.pause(), () => {
1871
+ e && t.play();
1840
1872
  };
1841
1873
  }, [j]);
1842
1874
  let N = (e) => {
1843
- let n = M(e);
1844
- n && (g(t("loop", n)), C.play(), m("live"));
1875
+ let r = M(e);
1876
+ r && (h(n("loop", r)), t.play(), p("live"));
1845
1877
  }, P = (e) => {
1846
1878
  let t = M(e);
1847
- t && h && a(h, t);
1879
+ t && m && i(m, t);
1848
1880
  }, F = () => {
1849
- g(t("photo", {
1881
+ h(n("photo", {
1850
1882
  fit: "cover",
1851
1883
  x: 0,
1852
1884
  y: 0,
1853
- w: o,
1854
- h: Math.round(o * c / s)
1855
- })), C.play(), m("live");
1885
+ w: x,
1886
+ h: Math.round(x * o / a)
1887
+ })), t.play(), p("live");
1856
1888
  }, I = (e) => {
1857
1889
  if (e === "fill") {
1858
- v("cover");
1890
+ _("cover");
1859
1891
  return;
1860
1892
  }
1861
- v("contain"), u(e);
1862
- let t = r[e];
1863
- h && t && a(h, {
1893
+ _("contain"), c(e);
1894
+ let t = S[e];
1895
+ m && t && i(m, {
1864
1896
  x: 0,
1865
1897
  y: 0,
1866
- w: o,
1867
- h: Math.round(o * t.h / t.w)
1898
+ w: x,
1899
+ h: Math.round(x * t.h / t.w)
1868
1900
  });
1869
1901
  }, L = () => {
1870
- for (let t of [...e]) i(t.id);
1871
- g(null), b(1), m(f());
1902
+ for (let t of [...e]) r(t.id);
1903
+ h(null), y(1), p(u());
1872
1904
  };
1873
1905
  return /* @__PURE__ */ X("div", {
1874
1906
  className: "relative h-dvh bg-black",
1875
1907
  children: [
1876
1908
  /* @__PURE__ */ Y("div", {
1877
1909
  className: "absolute inset-0 touch-none",
1878
- style: { transform: `scale(${y})` },
1910
+ style: { transform: `scale(${v})` },
1879
1911
  onPointerDownCapture: T,
1880
1912
  onPointerMoveCapture: E,
1881
1913
  onPointerUpCapture: D,
1882
1914
  onPointerCancelCapture: D,
1883
1915
  onPointerLeave: D,
1884
- children: /* @__PURE__ */ Y(Be, { fit: _ })
1916
+ children: /* @__PURE__ */ Y(Be, { fit: g })
1885
1917
  }),
1886
- p === "entry" && /* @__PURE__ */ Y(Sn, { onGenerate: () => m("category") }),
1887
- p === "category" && /* @__PURE__ */ Y(sn, {
1918
+ d === "entry" && /* @__PURE__ */ Y(Cn, { onGenerate: () => p("category") }),
1919
+ d === "category" && /* @__PURE__ */ Y(cn, {
1888
1920
  onPick: N,
1889
1921
  onInsert: F,
1890
- onBack: f() === "entry" ? () => m("entry") : void 0
1922
+ onBack: u() === "entry" ? () => p("entry") : void 0
1891
1923
  }),
1892
- p === "live" && /* @__PURE__ */ Y(xn, {
1924
+ d === "live" && /* @__PURE__ */ Y(Sn, {
1893
1925
  layer: O,
1894
1926
  onSwitchCategory: P,
1895
1927
  onInsert: () => {
1896
1928
  L(), F();
1897
1929
  },
1898
1930
  onRestart: L,
1899
- aspectValue: _ === "cover" ? "fill" : l,
1931
+ aspectValue: g === "cover" ? "fill" : s,
1900
1932
  onAspect: I
1901
1933
  }),
1902
1934
  j && /* @__PURE__ */ X("div", {
@@ -1904,10 +1936,10 @@ function Cn() {
1904
1936
  style: { zIndex: "var(--kol-z-modal)" },
1905
1937
  children: [/* @__PURE__ */ Y("div", {
1906
1938
  className: "flex-1 min-h-0",
1907
- children: /* @__PURE__ */ Y(Et, { layer: O })
1939
+ children: /* @__PURE__ */ Y(Dt, { layer: O })
1908
1940
  }), /* @__PURE__ */ Y("div", {
1909
1941
  className: "flex justify-center pb-[max(0.75rem,env(safe-area-inset-bottom))]",
1910
- children: /* @__PURE__ */ Y(H, {
1942
+ children: /* @__PURE__ */ Y(V, {
1911
1943
  variant: "outline",
1912
1944
  size: "lg",
1913
1945
  onClick: L,
@@ -1918,11 +1950,11 @@ function Cn() {
1918
1950
  ]
1919
1951
  });
1920
1952
  }
1921
- function wn() {
1953
+ function Tn() {
1922
1954
  return /* @__PURE__ */ Y(Ze, {
1923
1955
  persistDraft: !1,
1924
- children: /* @__PURE__ */ Y(Cn, {})
1956
+ children: /* @__PURE__ */ Y(wn, {})
1925
1957
  });
1926
1958
  }
1927
1959
  //#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 };
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 };