@kolkrabbi/design-editor 0.29.0 → 0.31.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,6 +1,6 @@
1
- import { $t as e, At as t, D as n, En as r, F as i, L as a, Mt as o, Ot as s, Qt as c, Sn as l, T as u, d, f, jt as p, kn as m, kt as h, nn as g, q as _, t as v, wn as y } from "./rolls-CGma4Bua.js";
2
- import { c as b, d as x, f as S, i as C, l as w, o as T, r as ee, s as te, u as ne } from "./TreePicker-BQYPaQv3.js";
3
- import { i as E, t as D } from "./Timeline-BxVRu-R0.js";
1
+ import { Bt as e, D as t, F as n, Ht as r, In as i, L as a, Pn as o, Rn as s, T as c, Ut as l, Vn as u, Vt as d, Wt as f, d as p, dn as m, f as h, mn as g, q as _, t as v, un as y } from "./rolls-CEQmdcp3.js";
2
+ import { c as b, d as x, f as S, i as C, l as w, o as T, r as ee, s as te, u as ne } from "./TreePicker-1_NZG8GB.js";
3
+ import { i as E, t as D } from "./Timeline-BKYyRqYg.js";
4
4
  import { BezierPathEditor as O, Button as k, Dropdown as re, Input as ie, LabeledControl as ae, MenuDropdownItem as oe, PopoverPanel as se, SegmentedToggle as ce, SettingsRow as le, Slider as A, Textarea as ue, ToggleCheckbox as j, Tooltip as M, glyphSize as de, usePopover as fe } from "@kolkrabbi/kol-component";
5
5
  import { Fragment as pe, useEffect as me, useState as N } from "react";
6
6
  import { Fragment as he, jsx as P, jsxs as F } from "react/jsx-runtime";
@@ -1990,40 +1990,40 @@ var z = (e) => ({
1990
1990
  dLen: e.u * e.pathLen * Math.max(1, Math.round(e.m.cycles || 1))
1991
1991
  }),
1992
1992
  vfwave: (e) => {
1993
- let t = Math.max(1, Math.round(e.m.cycles || 1)), n = .5 + .5 * Math.sin(e.u * l * t - e.i * (e.m.phase ?? .5));
1993
+ let t = Math.max(1, Math.round(e.m.cycles || 1)), n = .5 + .5 * Math.sin(e.u * o * t - e.i * (e.m.phase ?? .5));
1994
1994
  return {
1995
1995
  ...H,
1996
- vf: { [e.axisTag]: r(e.axisMin, e.axisMax, n) }
1996
+ vf: { [e.axisTag]: s(e.axisMin, e.axisMax, n) }
1997
1997
  };
1998
1998
  },
1999
1999
  glyphwave: (e) => {
2000
- let t = Math.max(1, Math.round(e.m.cycles || 1)), n = Math.sin(e.u * l * t - e.i * (e.m.phase ?? .5));
2000
+ let t = Math.max(1, Math.round(e.m.cycles || 1)), n = Math.sin(e.u * o * t - e.i * (e.m.phase ?? .5));
2001
2001
  return {
2002
2002
  ...H,
2003
2003
  dNormal: (e.m.amp ?? .3) * e.sizePx * n
2004
2004
  };
2005
2005
  },
2006
2006
  cascade: (e) => {
2007
- let t = Math.max(1, Math.round(e.m.cycles || 1)), n = .5 + .5 * Math.sin(e.u * l * t - e.i * (e.m.phase ?? .6));
2007
+ let t = Math.max(1, Math.round(e.m.cycles || 1)), n = .5 + .5 * Math.sin(e.u * o * t - e.i * (e.m.phase ?? .6));
2008
2008
  return {
2009
2009
  ...H,
2010
- scale: r(.25, 1, n),
2011
- opacity: r(.15, 1, n)
2010
+ scale: s(.25, 1, n),
2011
+ opacity: s(.15, 1, n)
2012
2012
  };
2013
2013
  },
2014
2014
  sweep: (e) => {
2015
2015
  let t = ze(e);
2016
2016
  return {
2017
2017
  ...H,
2018
- scale: r(.25, 1, t),
2019
- opacity: r(.12, 1, t)
2018
+ scale: s(.25, 1, t),
2019
+ opacity: s(.12, 1, t)
2020
2020
  };
2021
2021
  },
2022
2022
  sweepWeight: (e) => {
2023
2023
  let t = ze(e);
2024
2024
  return {
2025
2025
  ...H,
2026
- vf: { [e.axisTag]: r(e.axisMin, e.axisMax, t) }
2026
+ vf: { [e.axisTag]: s(e.axisMin, e.axisMax, t) }
2027
2027
  };
2028
2028
  },
2029
2029
  sweepShift: (e) => {
@@ -2040,20 +2040,20 @@ function Le(e, t) {
2040
2040
  return 1 - n * n * (3 - 2 * n);
2041
2041
  }
2042
2042
  function Re(e, t, n, r, i, a) {
2043
- let o = Ie(r * i), s = Math.max(.02, a * .5), c = (e) => {
2044
- let t = Math.abs(Ie(e) - o);
2045
- return Le(Math.min(t, 1 - t), s);
2043
+ let s = Ie(r * i), c = Math.max(.02, a * .5), l = (e) => {
2044
+ let t = Math.abs(Ie(e) - s);
2045
+ return Le(Math.min(t, 1 - t), c);
2046
2046
  };
2047
2047
  switch (e) {
2048
- case "y": return c(n);
2049
- case "diagonal": return c(.5 + (t - .5) * .7071 + (n - .5) * .7071);
2050
- case "radial": return c(Math.hypot(t - .5, n - .5) / .7071);
2051
- case "angular": return c(Math.atan2(n - .5, t - .5) / l + .5);
2048
+ case "y": return l(n);
2049
+ case "diagonal": return l(.5 + (t - .5) * .7071 + (n - .5) * .7071);
2050
+ case "radial": return l(Math.hypot(t - .5, n - .5) / .7071);
2051
+ case "angular": return l(Math.atan2(n - .5, t - .5) / o + .5);
2052
2052
  case "wave": {
2053
2053
  let e = Math.max(1, Math.round(1 + (1 - a) * 6));
2054
- return .5 + .5 * Math.sin((t * e - r * i) * l);
2054
+ return .5 + .5 * Math.sin((t * e - r * i) * o);
2055
2055
  }
2056
- default: return c(t);
2056
+ default: return l(t);
2057
2057
  }
2058
2058
  }
2059
2059
  var ze = (e) => Re(e.m.field || "x", e.nx ?? .5, e.ny ?? .5, e.u, Math.max(1, Math.round(e.m.cycles || 1)), e.m.amp ?? .35);
@@ -2147,7 +2147,7 @@ var Ke = class {
2147
2147
  this.params = Ge(e);
2148
2148
  }
2149
2149
  renderAt(e) {
2150
- !this.w || !this.h || this._render(y(e));
2150
+ !this.w || !this.h || this._render(i(e));
2151
2151
  }
2152
2152
  getInstanceRect(e) {
2153
2153
  let t = this._rt.get(e);
@@ -2249,31 +2249,31 @@ var Ke = class {
2249
2249
  }, e.cache;
2250
2250
  }
2251
2251
  _renderInstance(e, t, n) {
2252
- let r = b(e.font), i = e.phase ? U(n + e.phase) : n, a = We(e.text || "", e.case), s = Math.max(1, Math.round(e.multiply || 1)), c = s > 1 && a ? Array(s).fill(a).join(" ") : a, l = e.path?.type || "line", u = (e.offset?.x || 0) * this.w, d = (e.offset?.y || 0) * this.h;
2253
- if (t.group.setAttribute("transform", `translate(${u.toFixed(2)} ${d.toFixed(2)})`), e.morph?.on && !Se(l) && !Ce(l)) {
2254
- let n = r.url, a = e.morph.face2 ? b(e.morph.face2) : null, s = a ? a.url : n, u = o(n), d = o(s);
2252
+ let r = b(e.font), i = e.phase ? U(n + e.phase) : n, a = We(e.text || "", e.case), o = Math.max(1, Math.round(e.multiply || 1)), s = o > 1 && a ? Array(o).fill(a).join(" ") : a, c = e.path?.type || "line", u = (e.offset?.x || 0) * this.w, d = (e.offset?.y || 0) * this.h;
2253
+ if (t.group.setAttribute("transform", `translate(${u.toFixed(2)} ${d.toFixed(2)})`), e.morph?.on && !Se(c) && !Ce(c)) {
2254
+ let n = r.url, a = e.morph.face2 ? b(e.morph.face2) : null, o = a ? a.url : n, u = f(n), d = f(o);
2255
2255
  if (u && d) {
2256
- this._setKind(t, "morph"), this._renderMorph(e, t, i, u, d, r, c, l);
2256
+ this._setKind(t, "morph"), this._renderMorph(e, t, i, u, d, r, s, c);
2257
2257
  return;
2258
2258
  }
2259
- u || p(n).catch(() => {}), !d && s !== n && p(s).catch(() => {});
2259
+ u || l(n).catch(() => {}), !d && o !== n && l(o).catch(() => {});
2260
2260
  }
2261
- if (this._setKind(t, "text"), xe(l)) {
2261
+ if (this._setKind(t, "text"), xe(c)) {
2262
2262
  t.pathEl.setAttribute("d", ""), t.pathEl.style.opacity = 0;
2263
2263
  let n = Math.max(1, Math.round(e.path?.rows ?? 2)), a = Math.max(1, Math.round(e.path?.cols ?? 3));
2264
- if (this._ensureGlyphs(t, c, r, n * a), !c.length) return;
2265
- this._measure(t, e, r, c), this._placeArray(e, t, r, i, t.glyphEls, n, a);
2264
+ if (this._ensureGlyphs(t, s, r, n * a), !s.length) return;
2265
+ this._measure(t, e, r, s), this._placeArray(e, t, r, i, t.glyphEls, n, a);
2266
2266
  return;
2267
2267
  }
2268
- if (Se(l) || Ce(l)) {
2268
+ if (Se(c) || Ce(c)) {
2269
2269
  t.pathEl.setAttribute("d", ""), t.pathEl.style.opacity = 0;
2270
2270
  let n = Math.max(1, Math.round(e.path?.count ?? 12));
2271
- if (this._ensureGlyphs(t, c, r, n), !c.length) return;
2272
- this._measure(t, e, r, c), Se(l) ? this._placeRadial(e, t, r, i, t.glyphEls, n) : this._placeRings(e, t, r, i, t.glyphEls, n);
2271
+ if (this._ensureGlyphs(t, s, r, n), !s.length) return;
2272
+ this._measure(t, e, r, s), Se(c) ? this._placeRadial(e, t, r, i, t.glyphEls, n) : this._placeRings(e, t, r, i, t.glyphEls, n);
2273
2273
  return;
2274
2274
  }
2275
- let f = we(l, this.w, this.h, e.path || {});
2276
- t.closed = f.closed, t.pathEl.setAttribute("d", f.d), t.pathEl.setAttribute("stroke", e.showPath ? e.fill || "#888" : "none"), t.pathEl.setAttribute("stroke-width", +!!e.showPath), t.pathEl.style.opacity = e.showPath ? .25 : 0, this._ensureGlyphs(t, c, r, 1), c.length && (this._measure(t, e, r, c), this._placeOnPath(e, t, r, i, t.glyphEls));
2275
+ let p = we(c, this.w, this.h, e.path || {});
2276
+ t.closed = p.closed, t.pathEl.setAttribute("d", p.d), t.pathEl.setAttribute("stroke", e.showPath ? e.fill || "#888" : "none"), t.pathEl.setAttribute("stroke-width", +!!e.showPath), t.pathEl.style.opacity = e.showPath ? .25 : 0, this._ensureGlyphs(t, s, r, 1), s.length && (this._measure(t, e, r, s), this._placeOnPath(e, t, r, i, t.glyphEls));
2277
2277
  }
2278
2278
  _styleGlyph(e, t, n, r) {
2279
2279
  e.style.fontFamily = `'${n.family}'`, e.style.fontSize = `${t.fontSize}px`, e.style.fontStyle = t.italic ? "italic" : "normal", e.style.fontVariationSettings = x(r.vf ? {
@@ -2306,112 +2306,112 @@ var Ke = class {
2306
2306
  vf: l
2307
2307
  };
2308
2308
  }
2309
- _placeOnPath(e, t, n, r, i) {
2310
- let a = t.cache;
2311
- if (!a) return;
2312
- let o = t.pathEl.getTotalLength();
2309
+ _placeOnPath(e, t, n, r, a) {
2310
+ let o = t.cache;
2313
2311
  if (!o) return;
2314
- let { centers: s, total: c } = a, l = e.align || "center", u = l === "start" ? 0 : l === "end" ? o - c : (o - c) / 2, d = .75, f = t.closed, p = e.flow === "flow" && !f, m = (e) => f ? (e % o + o) % o : Math.max(0, Math.min(o, e)), h = (e) => {
2315
- if (p && (e < 0 || e > o)) {
2316
- let n = e < 0 ? 0 : o, r = t.pathEl.getPointAtLength(n), i = t.pathEl.getPointAtLength(Math.max(0, n - d)), a = t.pathEl.getPointAtLength(Math.min(o, n + d)), s = a.x - i.x, c = a.y - i.y, l = Math.hypot(s, c) || 1;
2317
- s /= l, c /= l;
2312
+ let s = t.pathEl.getTotalLength();
2313
+ if (!s) return;
2314
+ let { centers: c, total: l } = o, u = e.align || "center", d = u === "start" ? 0 : u === "end" ? s - l : (s - l) / 2, f = .75, p = t.closed, m = e.flow === "flow" && !p, h = (e) => p ? (e % s + s) % s : Math.max(0, Math.min(s, e)), g = (e) => {
2315
+ if (m && (e < 0 || e > s)) {
2316
+ let n = e < 0 ? 0 : s, r = t.pathEl.getPointAtLength(n), i = t.pathEl.getPointAtLength(Math.max(0, n - f)), a = t.pathEl.getPointAtLength(Math.min(s, n + f)), o = a.x - i.x, c = a.y - i.y, l = Math.hypot(o, c) || 1;
2317
+ o /= l, c /= l;
2318
2318
  let u = e - n;
2319
2319
  return {
2320
- x: r.x + s * u,
2320
+ x: r.x + o * u,
2321
2321
  y: r.y + c * u
2322
2322
  };
2323
2323
  }
2324
- return t.pathEl.getPointAtLength(m(e));
2325
- }, g = Math.min(i.length, s.length), _ = y(e.stagger || 0), v = Math.max(1, Math.round(e.multiply || 1)), b = (s.length + 2) / v;
2326
- for (let t = 0; t < g; t++) {
2327
- let a = u + s[t], c = h(a), l = _ && v > 1 ? U(r + _ * Math.floor(t / b) / v) : r, f = this._anim(e, {
2324
+ return t.pathEl.getPointAtLength(h(e));
2325
+ }, _ = Math.min(a.length, c.length), v = i(e.stagger || 0), y = Math.max(1, Math.round(e.multiply || 1)), b = (c.length + 2) / y;
2326
+ for (let t = 0; t < _; t++) {
2327
+ let i = d + c[t], o = g(i), l = v && y > 1 ? U(r + v * Math.floor(t / b) / y) : r, u = this._anim(e, {
2328
2328
  i: t,
2329
- n: s.length,
2329
+ n: c.length,
2330
2330
  u: l,
2331
2331
  sizePx: e.fontSize,
2332
- pathLen: o,
2333
- nx: this.w ? c.x / this.w : .5,
2334
- ny: this.h ? c.y / this.h : .5
2335
- }, n), p = a + f.dLen, m = h(p), g = h(p - d), y = h(p + d), x = Math.atan2(y.y - g.y, y.x - g.x) * 180 / Math.PI;
2336
- i[t].setAttribute("transform", `translate(${m.x.toFixed(2)} ${m.y.toFixed(2)}) rotate(${(x + f.dRot).toFixed(2)}) translate(0 ${(-f.dNormal).toFixed(2)}) scale(${f.scale.toFixed(3)})`), this._styleGlyph(i[t], e, n, f);
2332
+ pathLen: s,
2333
+ nx: this.w ? o.x / this.w : .5,
2334
+ ny: this.h ? o.y / this.h : .5
2335
+ }, n), p = i + u.dLen, m = g(p), h = g(p - f), _ = g(p + f), x = Math.atan2(_.y - h.y, _.x - h.x) * 180 / Math.PI;
2336
+ a[t].setAttribute("transform", `translate(${m.x.toFixed(2)} ${m.y.toFixed(2)}) rotate(${(x + u.dRot).toFixed(2)}) translate(0 ${(-u.dNormal).toFixed(2)}) scale(${u.scale.toFixed(3)})`), this._styleGlyph(a[t], e, n, u);
2337
2337
  }
2338
2338
  }
2339
- _placeArray(e, t, n, r, i, a, o) {
2340
- let s = t.cache;
2341
- if (!s) return;
2342
- let { centers: c, total: l } = s, u = c.length;
2343
- if (!u) return;
2344
- let d = Math.min(this.w, this.h) * .08, f = (this.w - 2 * d) / o, p = (this.h - 2 * d) / a, m = y(e.stagger || 0), h = a * o;
2345
- for (let t = 0; t < h; t++) {
2346
- let a = Math.floor(t / o), s = d + t % o * f + f / 2, g = d + a * p + p / 2, _ = s - l / 2, v = m ? U(r + m * t / h) : r;
2347
- for (let r = 0; r < u; r++) {
2348
- let a = i[t * u + r];
2349
- if (!a) continue;
2350
- let o = _ + c[r], s = this._anim(e, {
2351
- i: t * u + r,
2352
- n: h * u,
2339
+ _placeArray(e, t, n, r, a, o, s) {
2340
+ let c = t.cache;
2341
+ if (!c) return;
2342
+ let { centers: l, total: u } = c, d = l.length;
2343
+ if (!d) return;
2344
+ let f = Math.min(this.w, this.h) * .08, p = (this.w - 2 * f) / s, m = (this.h - 2 * f) / o, h = i(e.stagger || 0), g = o * s;
2345
+ for (let t = 0; t < g; t++) {
2346
+ let i = Math.floor(t / s), o = f + t % s * p + p / 2, c = f + i * m + m / 2, _ = o - u / 2, v = h ? U(r + h * t / g) : r;
2347
+ for (let r = 0; r < d; r++) {
2348
+ let i = a[t * d + r];
2349
+ if (!i) continue;
2350
+ let o = _ + l[r], s = this._anim(e, {
2351
+ i: t * d + r,
2352
+ n: g * d,
2353
2353
  u: v,
2354
2354
  sizePx: e.fontSize,
2355
2355
  pathLen: 0,
2356
2356
  nx: this.w ? o / this.w : .5,
2357
- ny: this.h ? g / this.h : .5
2358
- }, n), l = g - s.dNormal;
2359
- a.setAttribute("transform", `translate(${o.toFixed(2)} ${l.toFixed(2)}) rotate(${s.dRot.toFixed(2)}) scale(${s.scale.toFixed(3)})`), this._styleGlyph(a, e, n, s);
2357
+ ny: this.h ? c / this.h : .5
2358
+ }, n), u = c - s.dNormal;
2359
+ i.setAttribute("transform", `translate(${o.toFixed(2)} ${u.toFixed(2)}) rotate(${s.dRot.toFixed(2)}) scale(${s.scale.toFixed(3)})`), this._styleGlyph(i, e, n, s);
2360
2360
  }
2361
2361
  }
2362
2362
  }
2363
- _placeRadial(e, t, n, r, i, a) {
2364
- let o = t.cache;
2365
- if (!o) return;
2366
- let { centers: s } = o, c = s.length;
2363
+ _placeRadial(e, t, n, r, a, s) {
2364
+ let c = t.cache;
2367
2365
  if (!c) return;
2368
- let u = this.w / 2, d = this.h / 2, f = Math.min(this.w, this.h) * .5, p = f * Math.max(0, Math.min(.95, e.path?.inner ?? .12)), m = Math.round(e.path?.spin ?? 1), h = y(e.stagger || 0);
2369
- for (let t = 0; t < a; t++) {
2370
- let o = a > 1 ? t / (a - 1) : 0, g = m + (h ? Math.round(h * 2 * o) : 0), _ = t / a * l + r * l * g, v = h ? U(r + h * t / a) : r, y = Math.cos(_), b = Math.sin(_), x = _ * 180 / Math.PI;
2371
- for (let r = 0; r < c; r++) {
2372
- let o = t * c + r, l = i[o];
2373
- if (!l) continue;
2374
- let m = p + s[r], h = u + y * m, g = d + b * m, _ = this._anim(e, {
2375
- i: o,
2376
- n: a * c,
2366
+ let { centers: l } = c, u = l.length;
2367
+ if (!u) return;
2368
+ let d = this.w / 2, f = this.h / 2, p = Math.min(this.w, this.h) * .5, m = p * Math.max(0, Math.min(.95, e.path?.inner ?? .12)), h = Math.round(e.path?.spin ?? 1), g = i(e.stagger || 0);
2369
+ for (let t = 0; t < s; t++) {
2370
+ let i = s > 1 ? t / (s - 1) : 0, c = h + (g ? Math.round(g * 2 * i) : 0), _ = t / s * o + r * o * c, v = g ? U(r + g * t / s) : r, y = Math.cos(_), b = Math.sin(_), x = _ * 180 / Math.PI;
2371
+ for (let r = 0; r < u; r++) {
2372
+ let i = t * u + r, o = a[i];
2373
+ if (!o) continue;
2374
+ let c = m + l[r], h = d + y * c, g = f + b * c, _ = this._anim(e, {
2375
+ i,
2376
+ n: s * u,
2377
2377
  u: v,
2378
2378
  sizePx: e.fontSize,
2379
- pathLen: f,
2379
+ pathLen: p,
2380
2380
  nx: this.w ? h / this.w : .5,
2381
2381
  ny: this.h ? g / this.h : .5
2382
- }, n), S = m + _.dLen, C = u + y * S, w = d + b * S;
2383
- l.setAttribute("transform", `translate(${C.toFixed(2)} ${w.toFixed(2)}) rotate(${(x + _.dRot).toFixed(2)}) translate(0 ${(-_.dNormal).toFixed(2)}) scale(${_.scale.toFixed(3)})`), this._styleGlyph(l, e, n, _);
2382
+ }, n), S = c + _.dLen, C = d + y * S, w = f + b * S;
2383
+ o.setAttribute("transform", `translate(${C.toFixed(2)} ${w.toFixed(2)}) rotate(${(x + _.dRot).toFixed(2)}) translate(0 ${(-_.dNormal).toFixed(2)}) scale(${_.scale.toFixed(3)})`), this._styleGlyph(o, e, n, _);
2384
2384
  }
2385
2385
  }
2386
2386
  }
2387
- _placeRings(e, t, n, r, i, a) {
2388
- let o = t.cache;
2389
- if (!o) return;
2390
- let { centers: s, total: c } = o, u = s.length;
2391
- if (!u) return;
2392
- let d = this.w / 2, f = this.h / 2, p = Math.min(this.w, this.h) * .5 * Math.max(.1, Math.min(1, e.path?.radius ?? .92)), m = p * Math.max(.02, Math.min(.95, e.path?.inner ?? .14)), h = Math.round(e.path?.spin ?? 1), g = e.path?.twist ?? .5, _ = e.path?.grow ?? .6, v = y(e.stagger || 0);
2393
- for (let t = 0; t < a; t++) {
2394
- let o = a > 1 ? t / (a - 1) : 0, y = Math.max(1, m + o * (p - m)), b = h + (v ? Math.round(v * 2 * o) : 0), x = r * l * b + o * g * l, S = v ? U(r + v * t / a) : r, C = 1 + _ * o;
2395
- for (let r = 0; r < u; r++) {
2396
- let o = t * u + r, p = i[o];
2397
- if (!p) continue;
2398
- let m = x + (s[r] - c / 2) / y, h = d + Math.cos(m) * y, g = f + Math.sin(m) * y, _ = this._anim(e, {
2399
- i: o,
2400
- n: a * u,
2387
+ _placeRings(e, t, n, r, a, s) {
2388
+ let c = t.cache;
2389
+ if (!c) return;
2390
+ let { centers: l, total: u } = c, d = l.length;
2391
+ if (!d) return;
2392
+ let f = this.w / 2, p = this.h / 2, m = Math.min(this.w, this.h) * .5 * Math.max(.1, Math.min(1, e.path?.radius ?? .92)), h = m * Math.max(.02, Math.min(.95, e.path?.inner ?? .14)), g = Math.round(e.path?.spin ?? 1), _ = e.path?.twist ?? .5, v = e.path?.grow ?? .6, y = i(e.stagger || 0);
2393
+ for (let t = 0; t < s; t++) {
2394
+ let i = s > 1 ? t / (s - 1) : 0, c = Math.max(1, h + i * (m - h)), b = g + (y ? Math.round(y * 2 * i) : 0), x = r * o * b + i * _ * o, S = y ? U(r + y * t / s) : r, C = 1 + v * i;
2395
+ for (let r = 0; r < d; r++) {
2396
+ let i = t * d + r, m = a[i];
2397
+ if (!m) continue;
2398
+ let h = x + (l[r] - u / 2) / c, g = f + Math.cos(h) * c, _ = p + Math.sin(h) * c, v = this._anim(e, {
2399
+ i,
2400
+ n: s * d,
2401
2401
  u: S,
2402
2402
  sizePx: e.fontSize,
2403
- pathLen: l * y,
2404
- nx: this.w ? h / this.w : .5,
2405
- ny: this.h ? g / this.h : .5
2406
- }, n), v = m + _.dLen / y, b = y - _.dNormal, w = d + Math.cos(v) * b, T = f + Math.sin(v) * b, ee = v * 180 / Math.PI + 90 + _.dRot;
2407
- p.setAttribute("transform", `translate(${w.toFixed(2)} ${T.toFixed(2)}) rotate(${ee.toFixed(2)}) scale(${(_.scale * C).toFixed(3)})`), this._styleGlyph(p, e, n, _);
2403
+ pathLen: o * c,
2404
+ nx: this.w ? g / this.w : .5,
2405
+ ny: this.h ? _ / this.h : .5
2406
+ }, n), y = h + v.dLen / c, b = c - v.dNormal, w = f + Math.cos(y) * b, T = p + Math.sin(y) * b, ee = y * 180 / Math.PI + 90 + v.dRot;
2407
+ m.setAttribute("transform", `translate(${w.toFixed(2)} ${T.toFixed(2)}) rotate(${ee.toFixed(2)}) scale(${(v.scale * C).toFixed(3)})`), this._styleGlyph(m, e, n, v);
2408
2408
  }
2409
2409
  }
2410
2410
  }
2411
2411
  _setKind(e, t) {
2412
2412
  e.kind !== t && (e.kind = t, e.glyphG.textContent = "", e.glyphEls = [], e.morphEls = [], e.glyphKey = "", e.morphKey = "", e.morphPoolKey = "", e.cache = null);
2413
2413
  }
2414
- _renderMorph(e, n, r, i, a, o, s, c) {
2414
+ _renderMorph(e, t, n, i, a, o, s, c) {
2415
2415
  let l = e.fontSize, u = o.axes || [], d = {};
2416
2416
  for (let t of u) d[t.tag] = e.vf?.[t.tag] ?? t.def;
2417
2417
  let f = !!e.morph.face2, p = {};
@@ -2436,10 +2436,10 @@ var Ke = class {
2436
2436
  y,
2437
2437
  e.letterSpacing || 0,
2438
2438
  b
2439
- ]), S = x !== n.morphKey;
2439
+ ]), S = x !== t.morphKey;
2440
2440
  if (S) {
2441
- n.morphKey = x;
2442
- let e = t(i, a, s, l, {
2441
+ t.morphKey = x;
2442
+ let e = r(i, a, s, l, {
2443
2443
  mode: h,
2444
2444
  blend: g,
2445
2445
  curve: _,
@@ -2450,23 +2450,23 @@ var Ke = class {
2450
2450
  axes: u,
2451
2451
  gap: m
2452
2452
  });
2453
- n.morphData = e;
2454
- let r = [], o = 0;
2455
- for (let t of e.glyphs) r.push(o + t.advance / 2), o += t.advance;
2456
- n.morphCenters = r, n.morphTotal = e.totalAdvance;
2453
+ t.morphData = e;
2454
+ let n = [], o = 0;
2455
+ for (let t of e.glyphs) n.push(o + t.advance / 2), o += t.advance;
2456
+ t.morphCenters = n, t.morphTotal = e.totalAdvance;
2457
2457
  }
2458
- let C = n.morphData?.glyphs.length || 0;
2458
+ let C = t.morphData?.glyphs.length || 0;
2459
2459
  if (!s.length || !C) {
2460
- n.pathEl.setAttribute("d", ""), n.pathEl.style.opacity = 0;
2460
+ t.pathEl.setAttribute("d", ""), t.pathEl.style.opacity = 0;
2461
2461
  return;
2462
2462
  }
2463
- let w = xe(c), T = w ? Math.max(1, Math.round(e.path?.rows ?? 2)) : 1, ee = w ? Math.max(1, Math.round(e.path?.cols ?? 3)) : 1, te = w ? T * ee : 1, ne = this._ensureMorphPool(n, C, te, h);
2464
- if ((S || ne) && this._refreshMorphPaths(n, te, h, b), w) {
2465
- n.pathEl.setAttribute("d", ""), n.pathEl.style.opacity = 0, this._placeMorphArray(e, n, o, r, T, ee);
2463
+ let w = xe(c), T = w ? Math.max(1, Math.round(e.path?.rows ?? 2)) : 1, ee = w ? Math.max(1, Math.round(e.path?.cols ?? 3)) : 1, te = w ? T * ee : 1, ne = this._ensureMorphPool(t, C, te, h);
2464
+ if ((S || ne) && this._refreshMorphPaths(t, te, h, b), w) {
2465
+ t.pathEl.setAttribute("d", ""), t.pathEl.style.opacity = 0, this._placeMorphArray(e, t, o, n, T, ee);
2466
2466
  return;
2467
2467
  }
2468
2468
  let E = we(c, this.w, this.h, e.path || {});
2469
- n.closed = E.closed, n.pathEl.setAttribute("d", E.d), n.pathEl.setAttribute("stroke", e.showPath ? e.fill || "#888" : "none"), n.pathEl.setAttribute("stroke-width", +!!e.showPath), n.pathEl.style.opacity = e.showPath ? .25 : 0, this._placeMorphOnPath(e, n, o, r);
2469
+ t.closed = E.closed, t.pathEl.setAttribute("d", E.d), t.pathEl.setAttribute("stroke", e.showPath ? e.fill || "#888" : "none"), t.pathEl.setAttribute("stroke-width", +!!e.showPath), t.pathEl.style.opacity = e.showPath ? .25 : 0, this._placeMorphOnPath(e, t, o, n);
2470
2470
  }
2471
2471
  _ensureMorphPool(e, t, n, r) {
2472
2472
  let i = `${t}|${n}|${r}`;
@@ -2494,57 +2494,57 @@ var Ke = class {
2494
2494
  let a = (n.x1 + n.x2) / 2, o = (n.y1 + n.y2) / 2;
2495
2495
  e.setAttribute("transform", `translate(${(-a).toFixed(2)} ${(-o).toFixed(2)})`);
2496
2496
  }
2497
- _placeMorphOnPath(e, t, n, r, i = t.morphEls) {
2498
- let a = t.morphCenters, o = t.morphTotal;
2499
- if (!a || !i) return;
2500
- let s = t.pathEl.getTotalLength();
2501
- if (!s) return;
2502
- let c = e.align || "center", l = c === "start" ? 0 : c === "end" ? s - o : (s - o) / 2, u = .75, d = t.closed, f = e.flow === "flow" && !d, p = (e) => d ? (e % s + s) % s : Math.max(0, Math.min(s, e)), m = (e) => {
2503
- if (f && (e < 0 || e > s)) {
2504
- let n = e < 0 ? 0 : s, r = t.pathEl.getPointAtLength(n), i = t.pathEl.getPointAtLength(Math.max(0, n - u)), a = t.pathEl.getPointAtLength(Math.min(s, n + u)), o = a.x - i.x, c = a.y - i.y, l = Math.hypot(o, c) || 1;
2505
- o /= l, c /= l;
2506
- let d = e - n;
2497
+ _placeMorphOnPath(e, t, n, r, a = t.morphEls) {
2498
+ let o = t.morphCenters, s = t.morphTotal;
2499
+ if (!o || !a) return;
2500
+ let c = t.pathEl.getTotalLength();
2501
+ if (!c) return;
2502
+ let l = e.align || "center", u = l === "start" ? 0 : l === "end" ? c - s : (c - s) / 2, d = .75, f = t.closed, p = e.flow === "flow" && !f, m = (e) => f ? (e % c + c) % c : Math.max(0, Math.min(c, e)), h = (e) => {
2503
+ if (p && (e < 0 || e > c)) {
2504
+ let n = e < 0 ? 0 : c, r = t.pathEl.getPointAtLength(n), i = t.pathEl.getPointAtLength(Math.max(0, n - d)), a = t.pathEl.getPointAtLength(Math.min(c, n + d)), o = a.x - i.x, s = a.y - i.y, l = Math.hypot(o, s) || 1;
2505
+ o /= l, s /= l;
2506
+ let u = e - n;
2507
2507
  return {
2508
- x: r.x + o * d,
2509
- y: r.y + c * d
2508
+ x: r.x + o * u,
2509
+ y: r.y + s * u
2510
2510
  };
2511
2511
  }
2512
- return t.pathEl.getPointAtLength(p(e));
2513
- }, h = e.italic ? " skewX(-12)" : "", g = Math.min(i.length, a.length), _ = y(e.stagger || 0), v = Math.max(1, Math.round(e.multiply || 1)), b = (a.length + 2) / v;
2514
- for (let t = 0; t < g; t++) {
2515
- let o = l + a[t], c = m(o), d = _ && v > 1 ? U(r + _ * Math.floor(t / b) / v) : r, f = this._anim(e, {
2512
+ return t.pathEl.getPointAtLength(m(e));
2513
+ }, g = e.italic ? " skewX(-12)" : "", _ = Math.min(a.length, o.length), v = i(e.stagger || 0), y = Math.max(1, Math.round(e.multiply || 1)), b = (o.length + 2) / y;
2514
+ for (let t = 0; t < _; t++) {
2515
+ let i = u + o[t], s = h(i), l = v && y > 1 ? U(r + v * Math.floor(t / b) / y) : r, f = this._anim(e, {
2516
2516
  i: t,
2517
- n: a.length,
2518
- u: d,
2517
+ n: o.length,
2518
+ u: l,
2519
2519
  sizePx: e.fontSize,
2520
- pathLen: s,
2521
- nx: this.w ? c.x / this.w : .5,
2522
- ny: this.h ? c.y / this.h : .5
2523
- }, n), p = o + f.dLen, g = m(p), y = m(p - u), x = m(p + u), S = Math.atan2(x.y - y.y, x.x - y.x) * 180 / Math.PI;
2524
- i[t].setAttribute("transform", `translate(${g.x.toFixed(2)} ${g.y.toFixed(2)}) rotate(${(S + f.dRot).toFixed(2)}) translate(0 ${(-f.dNormal).toFixed(2)}) scale(${f.scale.toFixed(3)})${h}`), i[t].setAttribute("opacity", f.opacity);
2520
+ pathLen: c,
2521
+ nx: this.w ? s.x / this.w : .5,
2522
+ ny: this.h ? s.y / this.h : .5
2523
+ }, n), p = i + f.dLen, m = h(p), _ = h(p - d), x = h(p + d), S = Math.atan2(x.y - _.y, x.x - _.x) * 180 / Math.PI;
2524
+ a[t].setAttribute("transform", `translate(${m.x.toFixed(2)} ${m.y.toFixed(2)}) rotate(${(S + f.dRot).toFixed(2)}) translate(0 ${(-f.dNormal).toFixed(2)}) scale(${f.scale.toFixed(3)})${g}`), a[t].setAttribute("opacity", f.opacity);
2525
2525
  }
2526
2526
  }
2527
- _placeMorphArray(e, t, n, r, i, a, o = t.morphEls) {
2528
- let s = t.morphCenters, c = t.morphTotal;
2529
- if (!s || !o) return;
2530
- let l = s.length;
2531
- if (!l) return;
2532
- let u = Math.min(this.w, this.h) * .08, d = (this.w - 2 * u) / a, f = (this.h - 2 * u) / i, p = e.italic ? " skewX(-12)" : "", m = y(e.stagger || 0), h = i * a;
2533
- for (let t = 0; t < h; t++) {
2534
- let i = Math.floor(t / a), g = u + t % a * d + d / 2, _ = u + i * f + f / 2, v = g - c / 2, y = m ? U(r + m * t / h) : r;
2535
- for (let r = 0; r < l; r++) {
2536
- let i = t * l + r, a = o[i];
2527
+ _placeMorphArray(e, t, n, r, a, o, s = t.morphEls) {
2528
+ let c = t.morphCenters, l = t.morphTotal;
2529
+ if (!c || !s) return;
2530
+ let u = c.length;
2531
+ if (!u) return;
2532
+ let d = Math.min(this.w, this.h) * .08, f = (this.w - 2 * d) / o, p = (this.h - 2 * d) / a, m = e.italic ? " skewX(-12)" : "", h = i(e.stagger || 0), g = a * o;
2533
+ for (let t = 0; t < g; t++) {
2534
+ let i = Math.floor(t / o), a = d + t % o * f + f / 2, _ = d + i * p + p / 2, v = a - l / 2, y = h ? U(r + h * t / g) : r;
2535
+ for (let r = 0; r < u; r++) {
2536
+ let i = t * u + r, a = s[i];
2537
2537
  if (!a) continue;
2538
- let c = v + s[r], u = this._anim(e, {
2538
+ let o = v + c[r], l = this._anim(e, {
2539
2539
  i,
2540
- n: h * l,
2540
+ n: g * u,
2541
2541
  u: y,
2542
2542
  sizePx: e.fontSize,
2543
2543
  pathLen: 0,
2544
- nx: this.w ? c / this.w : .5,
2544
+ nx: this.w ? o / this.w : .5,
2545
2545
  ny: this.h ? _ / this.h : .5
2546
- }, n), d = _ - u.dNormal;
2547
- a.setAttribute("transform", `translate(${c.toFixed(2)} ${d.toFixed(2)}) rotate(${u.dRot.toFixed(2)}) scale(${u.scale.toFixed(3)})${p}`), a.setAttribute("opacity", u.opacity);
2546
+ }, n), d = _ - l.dNormal;
2547
+ a.setAttribute("transform", `translate(${o.toFixed(2)} ${d.toFixed(2)}) rotate(${l.dRot.toFixed(2)}) scale(${l.scale.toFixed(3)})${m}`), a.setAttribute("opacity", l.opacity);
2548
2548
  }
2549
2549
  }
2550
2550
  }
@@ -3100,7 +3100,7 @@ var Ke = class {
3100
3100
  section: "Morph",
3101
3101
  type: "select",
3102
3102
  when: Qe,
3103
- options: h,
3103
+ options: d,
3104
3104
  get: $e,
3105
3105
  set: (e, t, n = 0) => Q(e, { mode: t }, n)
3106
3106
  },
@@ -3152,7 +3152,7 @@ var Ke = class {
3152
3152
  section: "Morph",
3153
3153
  type: "select",
3154
3154
  when: (e, t = 0) => Qe(e, t) && $e(e, t) === "morph",
3155
- options: s,
3155
+ options: e,
3156
3156
  get: (e, t = 0) => Z(e, t).curve ?? "flat",
3157
3157
  set: (e, t, n = 0) => Q(e, { curve: t }, n)
3158
3158
  },
@@ -3429,131 +3429,131 @@ var ft = {
3429
3429
  "offsetX",
3430
3430
  "offsetY"
3431
3431
  ]), gt = (e, t) => e ? String.fromCharCode(97 + t.indexOf(e) % 26) : null;
3432
- function _t({ layer: t, setProp: n, updateLayer: r, palette: o, renderAnimate: s, tab: l, tabStrip: p, picker: m = !0 }) {
3433
- let h = a(), g = t.comp ?? {
3432
+ function _t({ layer: e, setProp: t, updateLayer: r, palette: i, renderAnimate: o, tab: s, tabStrip: l, picker: u = !0 }) {
3433
+ let d = a(), f = e.comp ?? {
3434
3434
  bg: "#0b0d12",
3435
3435
  instances: []
3436
- }, y = g.instances ?? [], [b, x] = N(0), S = Math.min(b, Math.max(0, y.length - 1)), C = (e) => {
3437
- x(e), window.dispatchEvent(new CustomEvent("kol:kinetic-element", { detail: {
3438
- id: t.id,
3439
- index: e,
3436
+ }, g = f.instances ?? [], [b, x] = N(0), S = Math.min(b, Math.max(0, g.length - 1)), C = (t) => {
3437
+ x(t), window.dispatchEvent(new CustomEvent("kol:kinetic-element", { detail: {
3438
+ id: e.id,
3439
+ index: t,
3440
3440
  from: "panel"
3441
3441
  } }));
3442
3442
  };
3443
3443
  me(() => {
3444
- let e = (e) => {
3445
- e.detail?.id === t.id && e.detail.from === "canvas" && x(e.detail.index);
3444
+ let t = (t) => {
3445
+ t.detail?.id === e.id && t.detail.from === "canvas" && x(t.detail.index);
3446
3446
  };
3447
- return window.addEventListener("kol:kinetic-element", e), () => window.removeEventListener("kol:kinetic-element", e);
3448
- }, [t.id]);
3447
+ return window.addEventListener("kol:kinetic-element", t), () => window.removeEventListener("kol:kinetic-element", t);
3448
+ }, [e.id]);
3449
3449
  let [w, T] = N([]), ee = (e) => T((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]), te = (e) => {
3450
- let t = y[e]?.group;
3451
- return t ? y.reduce((e, n, r) => n.group === t ? [...e, r] : e, []) : [e];
3452
- }, [ne, E] = N(0), D = y[S]?.motions ?? [], O = Math.min(ne, D.length), ie = (e) => ({
3450
+ let t = g[e]?.group;
3451
+ return t ? g.reduce((e, n, r) => n.group === t ? [...e, r] : e, []) : [e];
3452
+ }, [ne, E] = N(0), D = g[S]?.motions ?? [], O = Math.min(ne, D.length), ie = (e) => ({
3453
3453
  ...e,
3454
3454
  instances: (e.instances ?? []).map((e, t) => t === S ? {
3455
3455
  ...e,
3456
3456
  motion: { ...e.motions?.[O - 1] ?? {} }
3457
3457
  } : e)
3458
- }), oe = (e) => pt.has(e.key) && O > 0 ? ie(g) : g, se = (e) => {
3459
- e && (r(t.id, {
3460
- presetId: e.id,
3461
- presetLabel: e.label,
3462
- comp: Pe(e)
3458
+ }), oe = (e) => pt.has(e.key) && O > 0 ? ie(f) : f, se = (t) => {
3459
+ t && (r(e.id, {
3460
+ presetId: t.id,
3461
+ presetLabel: t.label,
3462
+ comp: Pe(t)
3463
3463
  }), x(0), E(0));
3464
- }, A = (e) => n("comp", e), j = (e) => r(t.id, { comp: {
3465
- ...g,
3466
- instances: e
3464
+ }, A = (e) => t("comp", e), j = (t) => r(e.id, { comp: {
3465
+ ...f,
3466
+ instances: t
3467
3467
  } }), de = (e, t) => A({
3468
- ...g,
3469
- instances: y.map((n, r) => r === e ? {
3468
+ ...f,
3469
+ instances: g.map((n, r) => r === e ? {
3470
3470
  ...n,
3471
3471
  ...t
3472
3472
  } : n)
3473
3473
  }), fe = () => {
3474
3474
  if (w.length < 2) return;
3475
- let e = new Set(y.map((e) => e.group).filter(Boolean)), t = 1;
3475
+ let e = new Set(g.map((e) => e.group).filter(Boolean)), t = 1;
3476
3476
  for (; e.has(`g${t}`);) t++;
3477
- j(y.map((e) => w.includes(e.id) ? {
3477
+ j(g.map((e) => w.includes(e.id) ? {
3478
3478
  ...e,
3479
3479
  group: `g${t}`
3480
3480
  } : e)), T([]);
3481
3481
  }, ge = () => {
3482
- w.length && (j(y.map((e) => w.includes(e.id) ? {
3482
+ w.length && (j(g.map((e) => w.includes(e.id) ? {
3483
3483
  ...e,
3484
3484
  group: null
3485
3485
  } : e)), T([]));
3486
3486
  }, _e = (e, t) => {
3487
3487
  if (pt.has(e.key) && O > 0) {
3488
- let n = e.set(ie(g), t, S).instances?.[S]?.motion ?? {};
3488
+ let n = e.set(ie(f), t, S).instances?.[S]?.motion ?? {};
3489
3489
  de(S, { motions: D.map((e, t) => t === O - 1 ? n : e) });
3490
3490
  return;
3491
3491
  }
3492
3492
  let n = te(S);
3493
3493
  if (n.length > 1 && ht.has(e.key)) {
3494
- let r = g;
3494
+ let r = f;
3495
3495
  if (e.key === "fontSize") {
3496
- let i = Number(e.get(g, S)) || 1, a = t / i;
3496
+ let i = Number(e.get(f, S)) || 1, a = t / i;
3497
3497
  for (let t of n) {
3498
- let n = Number(e.get(g, t)) || i;
3498
+ let n = Number(e.get(f, t)) || i;
3499
3499
  r = e.set(r, Math.max(8, Math.min(1200, Math.round(n * a))), t);
3500
3500
  }
3501
3501
  } else if (e.key === "offsetX" || e.key === "offsetY") {
3502
- let i = t - (Number(e.get(g, S)) || 0);
3503
- for (let t of n) r = e.set(r, (Number(e.get(g, t)) || 0) + i, t);
3502
+ let i = t - (Number(e.get(f, S)) || 0);
3503
+ for (let t of n) r = e.set(r, (Number(e.get(f, t)) || 0) + i, t);
3504
3504
  } else for (let i of n) r = e.set(r, t, i);
3505
3505
  A(r);
3506
3506
  return;
3507
3507
  }
3508
- A(e.set(g, t, S));
3509
- }, I = d(t), ve = (e = null) => {
3508
+ A(e.set(f, t, S));
3509
+ }, I = p(e), ve = (t = null) => {
3510
3510
  let n = I.take();
3511
- r(t.id, {
3512
- comp: lt(g, S, f(n >>> 0), e),
3511
+ r(e.id, {
3512
+ comp: lt(f, S, h(n >>> 0), t),
3513
3513
  _rollSeed: n
3514
3514
  });
3515
3515
  }, ye = () => {
3516
- let e = I.take(), n = f(e >>> 0), i = g;
3517
- y.forEach((e, t) => {
3516
+ let t = I.take(), n = h(t >>> 0), i = f;
3517
+ g.forEach((e, t) => {
3518
3518
  i = lt(i, t, n);
3519
- }), r(t.id, {
3519
+ }), r(e.id, {
3520
3520
  comp: i,
3521
- _rollSeed: e
3521
+ _rollSeed: t
3522
3522
  });
3523
3523
  }, be = () => {
3524
- let e = V.find((e) => e.id === t.presetId), n = V.filter((t) => t.id !== e?.id && (!e || t.sub === e.sub));
3525
- n.length && se(n[Math.floor(f(I.take() >>> 0)() * n.length)]);
3524
+ let t = V.find((t) => t.id === e.presetId), n = V.filter((e) => e.id !== t?.id && (!t || e.sub === t.sub));
3525
+ n.length && se(n[Math.floor(h(I.take() >>> 0)() * n.length)]);
3526
3526
  }, xe = () => {
3527
- let e = f(I.take() >>> 0);
3528
- Ce(c[Math.floor(e() * c.length)].value, e() < .5);
3529
- }, Se = () => se(V.find((e) => e.id === t.presetId) ?? V[0]), Ce = (n, i) => {
3530
- let a = e(n, i);
3531
- r(t.id, {
3532
- themeId: n,
3533
- themeInvert: i,
3527
+ let e = h(I.take() >>> 0);
3528
+ Ce(y[Math.floor(e() * y.length)].value, e() < .5);
3529
+ }, Se = () => se(V.find((t) => t.id === e.presetId) ?? V[0]), Ce = (t, n) => {
3530
+ let i = m(t, n);
3531
+ r(e.id, {
3532
+ themeId: t,
3533
+ themeInvert: n,
3534
3534
  comp: {
3535
- ...g,
3536
- bg: a.bg,
3537
- instances: y.map((e) => ({
3535
+ ...f,
3536
+ bg: i.bg,
3537
+ instances: g.map((e) => ({
3538
3538
  ...e,
3539
- fill: a.fg
3539
+ fill: i.fg
3540
3540
  }))
3541
3541
  }
3542
3542
  });
3543
3543
  }, L = (e) => A({
3544
- ...g,
3545
- instances: y.map((t) => ({
3544
+ ...f,
3545
+ instances: g.map((t) => ({
3546
3546
  ...t,
3547
3547
  fill: e
3548
3548
  }))
3549
- }), we = l === "labs-effect" ? "style" : l, Te = ot.filter((e) => e.tab === we && (!e.when || e.when(oe(e), S))), Ee = y.some((e) => e?.morph?.on), R = y[S];
3549
+ }), we = s === "labs-effect" ? "style" : s, Te = ot.filter((e) => e.tab === we && (!e.when || e.when(oe(e), S))), Ee = g.some((e) => e?.morph?.on), R = g[S];
3550
3550
  return /* @__PURE__ */ F(he, { children: [
3551
- p,
3552
- m && /* @__PURE__ */ P(vt, {
3553
- layer: t,
3551
+ l,
3552
+ u && /* @__PURE__ */ P(vt, {
3553
+ layer: e,
3554
3554
  onPreset: se
3555
3555
  }),
3556
- l === "generate" || l === "labs-effect" ? /* @__PURE__ */ F("div", {
3556
+ s === "generate" || s === "labs-effect" ? /* @__PURE__ */ F("div", {
3557
3557
  className: "flex flex-col gap-1",
3558
3558
  children: [
3559
3559
  /* @__PURE__ */ P("span", {
@@ -3561,7 +3561,7 @@ function _t({ layer: t, setProp: n, updateLayer: r, palette: o, renderAnimate: s
3561
3561
  children: "Elements"
3562
3562
  }),
3563
3563
  /* @__PURE__ */ P(yt, {
3564
- insts: y,
3564
+ insts: g,
3565
3565
  idx: S,
3566
3566
  onSelect: C,
3567
3567
  onWrite: j,
@@ -3575,17 +3575,17 @@ function _t({ layer: t, setProp: n, updateLayer: r, palette: o, renderAnimate: s
3575
3575
  children: /* @__PURE__ */ P(k, {
3576
3576
  "aria-label": "Edit elements on the canvas (click to select, drag to move, corners to scale)",
3577
3577
  tone: "primary",
3578
- size: h,
3578
+ size: d,
3579
3579
  className: "w-full",
3580
3580
  onClick: () => window.dispatchEvent(new CustomEvent("kol:kinetic-edit", { detail: {
3581
- id: t.id,
3581
+ id: e.id,
3582
3582
  index: S
3583
3583
  } })),
3584
3584
  children: "Edit on canvas"
3585
3585
  })
3586
3586
  })
3587
3587
  ]
3588
- }) : y.length > 1 && /* @__PURE__ */ F("span", {
3588
+ }) : g.length > 1 && /* @__PURE__ */ F("span", {
3589
3589
  className: "kol-helper-12 text-meta truncate",
3590
3590
  children: [
3591
3591
  "Element ",
@@ -3594,15 +3594,15 @@ function _t({ layer: t, setProp: n, updateLayer: r, palette: o, renderAnimate: s
3594
3594
  R?.text || "—"
3595
3595
  ]
3596
3596
  }),
3597
- (l === "generate" || l === "labs-effect") && /* @__PURE__ */ F(he, { children: [
3597
+ (s === "generate" || s === "labs-effect") && /* @__PURE__ */ F(he, { children: [
3598
3598
  /* @__PURE__ */ P(ae, {
3599
3599
  label: "TEXT",
3600
3600
  children: /* @__PURE__ */ P(ue, {
3601
3601
  variant: "filled",
3602
- size: h,
3602
+ size: d,
3603
3603
  rows: 2,
3604
3604
  axis: "y",
3605
- value: y[S]?.text ?? "",
3605
+ value: g[S]?.text ?? "",
3606
3606
  onChange: (e) => de(S, { text: e.target.value })
3607
3607
  })
3608
3608
  }),
@@ -3611,21 +3611,21 @@ function _t({ layer: t, setProp: n, updateLayer: r, palette: o, renderAnimate: s
3611
3611
  children: [/* @__PURE__ */ P(le, {
3612
3612
  label: "Theme",
3613
3613
  align: "fill",
3614
- labelWidth: i,
3614
+ labelWidth: n,
3615
3615
  children: /* @__PURE__ */ P(re, {
3616
3616
  variant: "subtle",
3617
- size: h,
3617
+ size: d,
3618
3618
  className: "w-full",
3619
- options: c,
3620
- value: t.themeId ?? "kol",
3621
- onChange: (e) => Ce(e, !!t.themeInvert)
3619
+ options: y,
3620
+ value: e.themeId ?? "kol",
3621
+ onChange: (t) => Ce(t, !!e.themeInvert)
3622
3622
  })
3623
3623
  }), /* @__PURE__ */ P(le, {
3624
3624
  label: "Invert",
3625
3625
  align: "fill",
3626
- labelWidth: i,
3626
+ labelWidth: n,
3627
3627
  children: /* @__PURE__ */ P(ce, {
3628
- size: h,
3628
+ size: d,
3629
3629
  className: "w-full",
3630
3630
  options: [{
3631
3631
  value: "off",
@@ -3634,21 +3634,21 @@ function _t({ layer: t, setProp: n, updateLayer: r, palette: o, renderAnimate: s
3634
3634
  value: "on",
3635
3635
  label: "On"
3636
3636
  }],
3637
- value: t.themeInvert ? "on" : "off",
3638
- onChange: (e) => Ce(t.themeId ?? "kol", e === "on")
3637
+ value: e.themeInvert ? "on" : "off",
3638
+ onChange: (t) => Ce(e.themeId ?? "kol", t === "on")
3639
3639
  })
3640
3640
  })]
3641
3641
  }),
3642
- /* @__PURE__ */ P(u, {
3642
+ /* @__PURE__ */ P(c, {
3643
3643
  inline: !0,
3644
3644
  label: "Text color",
3645
- value: y[0]?.fill,
3646
- onChange: (e) => L(_(e, o) ?? e),
3647
- palette: o
3645
+ value: g[0]?.fill,
3646
+ onChange: (e) => L(_(e, i) ?? e),
3647
+ palette: i
3648
3648
  }),
3649
3649
  /* @__PURE__ */ P(k, {
3650
3650
  tone: "primary",
3651
- size: h,
3651
+ size: d,
3652
3652
  className: "w-full",
3653
3653
  onClick: be,
3654
3654
  children: "Randomize preset"
@@ -3657,7 +3657,7 @@ function _t({ layer: t, setProp: n, updateLayer: r, palette: o, renderAnimate: s
3657
3657
  className: "flex gap-2",
3658
3658
  children: [/* @__PURE__ */ P(k, {
3659
3659
  tone: "primary",
3660
- size: h,
3660
+ size: d,
3661
3661
  className: "flex-1 min-w-0",
3662
3662
  onClick: () => ve(),
3663
3663
  children: "Randomize all"
@@ -3665,7 +3665,7 @@ function _t({ layer: t, setProp: n, updateLayer: r, palette: o, renderAnimate: s
3665
3665
  label: "Reset to defaults",
3666
3666
  children: /* @__PURE__ */ P(k, {
3667
3667
  tone: "primary",
3668
- size: h,
3668
+ size: d,
3669
3669
  iconOnly: "refresh",
3670
3670
  "aria-label": "Reset to defaults",
3671
3671
  onClick: Se,
@@ -3678,25 +3678,25 @@ function _t({ layer: t, setProp: n, updateLayer: r, palette: o, renderAnimate: s
3678
3678
  children: [
3679
3679
  /* @__PURE__ */ P(k, {
3680
3680
  tone: "primary",
3681
- size: h,
3681
+ size: d,
3682
3682
  onClick: xe,
3683
3683
  children: "Color"
3684
3684
  }),
3685
3685
  /* @__PURE__ */ P(k, {
3686
3686
  tone: "primary",
3687
- size: h,
3687
+ size: d,
3688
3688
  onClick: () => ve(["style"]),
3689
3689
  children: "Type"
3690
3690
  }),
3691
3691
  /* @__PURE__ */ P(k, {
3692
3692
  tone: "primary",
3693
- size: h,
3693
+ size: d,
3694
3694
  onClick: () => ve(["anim"]),
3695
3695
  children: "Motion"
3696
3696
  }),
3697
3697
  /* @__PURE__ */ P(k, {
3698
3698
  tone: "primary",
3699
- size: h,
3699
+ size: d,
3700
3700
  onClick: ye,
3701
3701
  children: "All elements"
3702
3702
  })
@@ -3704,25 +3704,25 @@ function _t({ layer: t, setProp: n, updateLayer: r, palette: o, renderAnimate: s
3704
3704
  }),
3705
3705
  /* @__PURE__ */ P(v, { seed: I })
3706
3706
  ] }),
3707
- l === "anim" && /* @__PURE__ */ P(xt, {
3707
+ s === "anim" && /* @__PURE__ */ P(xt, {
3708
3708
  motions: D,
3709
3709
  mIdx: O,
3710
3710
  onSelect: E,
3711
3711
  onAdd: () => {
3712
- j(y.map((e, t) => t === S ? {
3712
+ j(g.map((e, t) => t === S ? {
3713
3713
  ...e,
3714
3714
  motions: [...D, { ...mt }]
3715
3715
  } : e)), E(D.length + 1);
3716
3716
  },
3717
3717
  onRemove: () => {
3718
- O !== 0 && (j(y.map((e, t) => t === S ? {
3718
+ O !== 0 && (j(g.map((e, t) => t === S ? {
3719
3719
  ...e,
3720
3720
  motions: D.filter((e, t) => t !== O - 1)
3721
3721
  } : e)), E(O - 1));
3722
3722
  }
3723
3723
  }),
3724
- l !== "generate" && Te.map((e, r) => /* @__PURE__ */ F(pe, { children: [
3725
- e.key === "arrangement" && /* @__PURE__ */ F(he, { children: [/* @__PURE__ */ P("span", {
3724
+ s !== "generate" && Te.map((n, r) => /* @__PURE__ */ F(pe, { children: [
3725
+ n.key === "arrangement" && /* @__PURE__ */ F(he, { children: [/* @__PURE__ */ P("span", {
3726
3726
  className: "kol-eyebrow text-fg-80",
3727
3727
  children: "OpenType"
3728
3728
  }), /* @__PURE__ */ P(St, {
@@ -3732,37 +3732,37 @@ function _t({ layer: t, setProp: n, updateLayer: r, palette: o, renderAnimate: s
3732
3732
  [e]: t
3733
3733
  } })
3734
3734
  })] }),
3735
- e.section && e.section !== Te[r - 1]?.section && /* @__PURE__ */ P("span", {
3735
+ n.section && n.section !== Te[r - 1]?.section && /* @__PURE__ */ P("span", {
3736
3736
  className: "kol-eyebrow text-fg-80",
3737
- children: e.section
3737
+ children: n.section
3738
3738
  }),
3739
3739
  /* @__PURE__ */ P(bt, {
3740
- knob: e,
3741
- comp: oe(e),
3740
+ knob: n,
3741
+ comp: oe(n),
3742
3742
  idx: S,
3743
- palette: o,
3743
+ palette: i,
3744
3744
  onWrite: _e,
3745
- bridge: pt.has(e.key) && O > 0 ? null : {
3746
- layer: t,
3747
- setProp: n,
3748
- renderAnimate: s,
3749
- key: ut(S, e.key)
3745
+ bridge: pt.has(n.key) && O > 0 ? null : {
3746
+ layer: e,
3747
+ setProp: t,
3748
+ renderAnimate: o,
3749
+ key: ut(S, n.key)
3750
3750
  }
3751
3751
  }),
3752
- e.key === "showPath" && R?.path?.type === "custom" && /* @__PURE__ */ P(Ct, {
3752
+ n.key === "showPath" && R?.path?.type === "custom" && /* @__PURE__ */ P(Ct, {
3753
3753
  inst: R,
3754
- layer: t,
3754
+ layer: e,
3755
3755
  onPoints: (e) => de(S, { path: {
3756
3756
  ...R?.path ?? {},
3757
3757
  points: e
3758
3758
  } })
3759
3759
  })
3760
- ] }, e.key)),
3761
- l === "anim" && Ee && /* @__PURE__ */ P(wt, {
3762
- layer: t,
3763
- setProp: n,
3764
- insts: y,
3765
- renderAnimate: s
3760
+ ] }, n.key)),
3761
+ s === "anim" && Ee && /* @__PURE__ */ P(wt, {
3762
+ layer: e,
3763
+ setProp: t,
3764
+ insts: g,
3765
+ renderAnimate: o
3766
3766
  })
3767
3767
  ] });
3768
3768
  }
@@ -3927,9 +3927,9 @@ function yt({ insts: e, idx: t, onSelect: n, onWrite: r, marked: i, onMark: o, o
3927
3927
  })
3928
3928
  ] });
3929
3929
  }
3930
- function bt({ knob: e, comp: t, idx: r, palette: o, onWrite: s, bridge: c }) {
3931
- let l = a(), d = e.get(t, r), f = (t) => s(e, t);
3932
- if (e.type === "color") return /* @__PURE__ */ P(u, {
3930
+ function bt({ knob: e, comp: r, idx: i, palette: o, onWrite: s, bridge: l }) {
3931
+ let u = a(), d = e.get(r, i), f = (t) => s(e, t);
3932
+ if (e.type === "color") return /* @__PURE__ */ P(c, {
3933
3933
  label: e.label,
3934
3934
  value: d,
3935
3935
  onChange: (e) => f(_(e, o) ?? e),
@@ -3939,21 +3939,21 @@ function bt({ knob: e, comp: t, idx: r, palette: o, onWrite: s, bridge: c }) {
3939
3939
  if (e.type === "select") return /* @__PURE__ */ P(le, {
3940
3940
  label: e.label,
3941
3941
  align: "fill",
3942
- labelWidth: i,
3942
+ labelWidth: n,
3943
3943
  children: /* @__PURE__ */ P(re, {
3944
3944
  variant: "subtle",
3945
- size: l,
3945
+ size: u,
3946
3946
  className: "w-full",
3947
- options: st(e, t, r),
3947
+ options: st(e, r, i),
3948
3948
  value: d,
3949
3949
  onChange: f
3950
3950
  })
3951
3951
  });
3952
- let { min: p, max: m } = ct(e, t, r), h = c && c.layer[c.key], g = n(h), v = typeof h == "number" ? h : d, y = typeof h == "number" ? (e) => c.setProp(c.key, e) : f;
3952
+ let { min: p, max: m } = ct(e, r, i), h = l && l.layer[l.key], g = t(h), v = typeof h == "number" ? h : d, y = typeof h == "number" ? (e) => l.setProp(l.key, e) : f;
3953
3953
  return /* @__PURE__ */ P(le, {
3954
3954
  label: e.label,
3955
3955
  align: "fill",
3956
- labelWidth: i,
3956
+ labelWidth: n,
3957
3957
  children: /* @__PURE__ */ F("div", {
3958
3958
  className: "flex flex-1 items-center gap-2",
3959
3959
  children: [/* @__PURE__ */ P("div", {
@@ -3970,8 +3970,8 @@ function bt({ knob: e, comp: t, idx: r, palette: o, onWrite: s, bridge: c }) {
3970
3970
  displayWidth: String(m).length,
3971
3971
  className: "flex-1"
3972
3972
  })
3973
- }), c?.renderAnimate?.({
3974
- key: c.key,
3973
+ }), l?.renderAnimate?.({
3974
+ key: l.key,
3975
3975
  label: e.label,
3976
3976
  type: "range",
3977
3977
  min: p,
@@ -4116,8 +4116,8 @@ function Ct({ inst: e, layer: t, onPoints: n }) {
4116
4116
  })]
4117
4117
  });
4118
4118
  }
4119
- function wt({ layer: e, setProp: t, insts: r, renderAnimate: a }) {
4120
- let o = ft, s = e[o.key], c = n(s), l = r.find((e) => e?.morph?.on)?.morph?.blend ?? o.default, u = typeof s == "number" ? s : l, d = c ? /* @__PURE__ */ P("div", {
4119
+ function wt({ layer: e, setProp: r, insts: i, renderAnimate: a }) {
4120
+ let o = ft, s = e[o.key], c = t(s), l = i.find((e) => e?.morph?.on)?.morph?.blend ?? o.default, u = typeof s == "number" ? s : l, d = c ? /* @__PURE__ */ P("div", {
4121
4121
  className: "kol-helper-12 text-meta italic px-1",
4122
4122
  children: "animated"
4123
4123
  }) : /* @__PURE__ */ P(A, {
@@ -4125,12 +4125,12 @@ function wt({ layer: e, setProp: t, insts: r, renderAnimate: a }) {
4125
4125
  max: o.max,
4126
4126
  step: o.step,
4127
4127
  value: u,
4128
- onChange: (e) => t(o.key, e)
4128
+ onChange: (e) => r(o.key, e)
4129
4129
  });
4130
4130
  return /* @__PURE__ */ P(le, {
4131
4131
  label: o.label,
4132
4132
  align: "fill",
4133
- labelWidth: i,
4133
+ labelWidth: n,
4134
4134
  children: /* @__PURE__ */ F("div", {
4135
4135
  className: "flex flex-1 items-center gap-2",
4136
4136
  children: [/* @__PURE__ */ P("div", {
@@ -4256,6 +4256,6 @@ var kt = {
4256
4256
  useTimelineUp: E,
4257
4257
  TransportBar: Ot
4258
4258
  };
4259
- m("motion", kt);
4259
+ u("motion", kt);
4260
4260
  //#endregion
4261
4261
  export { Ne as a, V as i, _t as n, Pe as o, lt as r, kt as t };