@lumencast/runtime 0.6.0 → 0.8.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.
Files changed (133) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/broadcast-Gcd-dmC7.js +12 -0
  3. package/dist/broadcast-Gcd-dmC7.js.map +1 -0
  4. package/dist/control-C5TfClga.js +17 -0
  5. package/dist/control-C5TfClga.js.map +1 -0
  6. package/dist/{index-Crkij3C4.js → index-N-VqrIxN.js} +305 -210
  7. package/dist/index-N-VqrIxN.js.map +1 -0
  8. package/dist/index.d.ts +3 -0
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.html +1 -1
  11. package/dist/index.js +13 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/lumencast.js +14 -9
  14. package/dist/modes/broadcast.d.ts.map +1 -1
  15. package/dist/modes/broadcast.js +6 -1
  16. package/dist/modes/broadcast.js.map +1 -1
  17. package/dist/modes/control.d.ts.map +1 -1
  18. package/dist/modes/control.js +6 -1
  19. package/dist/modes/control.js.map +1 -1
  20. package/dist/modes/test.d.ts.map +1 -1
  21. package/dist/modes/test.js +2 -1
  22. package/dist/modes/test.js.map +1 -1
  23. package/dist/render/allowed-hosts.d.ts +41 -0
  24. package/dist/render/allowed-hosts.d.ts.map +1 -0
  25. package/dist/render/allowed-hosts.js +88 -0
  26. package/dist/render/allowed-hosts.js.map +1 -0
  27. package/dist/render/asset-resolve.d.ts +27 -0
  28. package/dist/render/asset-resolve.d.ts.map +1 -0
  29. package/dist/render/asset-resolve.js +86 -0
  30. package/dist/render/asset-resolve.js.map +1 -0
  31. package/dist/render/blend-mode.d.ts +7 -0
  32. package/dist/render/blend-mode.d.ts.map +1 -0
  33. package/dist/render/blend-mode.js +49 -0
  34. package/dist/render/blend-mode.js.map +1 -0
  35. package/dist/render/bundle.d.ts +9 -1
  36. package/dist/render/bundle.d.ts.map +1 -1
  37. package/dist/render/bundle.js.map +1 -1
  38. package/dist/render/fill.d.ts +36 -3
  39. package/dist/render/fill.d.ts.map +1 -1
  40. package/dist/render/fill.js +222 -23
  41. package/dist/render/fill.js.map +1 -1
  42. package/dist/render/headless.d.ts +39 -0
  43. package/dist/render/headless.d.ts.map +1 -0
  44. package/dist/render/headless.js +83 -0
  45. package/dist/render/headless.js.map +1 -0
  46. package/dist/render/mask.d.ts +87 -0
  47. package/dist/render/mask.d.ts.map +1 -0
  48. package/dist/render/mask.js +243 -0
  49. package/dist/render/mask.js.map +1 -0
  50. package/dist/render/primitives/frame.d.ts.map +1 -1
  51. package/dist/render/primitives/frame.js +91 -5
  52. package/dist/render/primitives/frame.js.map +1 -1
  53. package/dist/render/primitives/grid.d.ts +1 -1
  54. package/dist/render/primitives/grid.d.ts.map +1 -1
  55. package/dist/render/primitives/grid.js +4 -1
  56. package/dist/render/primitives/grid.js.map +1 -1
  57. package/dist/render/primitives/image.d.ts +8 -1
  58. package/dist/render/primitives/image.d.ts.map +1 -1
  59. package/dist/render/primitives/image.js +17 -3
  60. package/dist/render/primitives/image.js.map +1 -1
  61. package/dist/render/primitives/index.d.ts +7 -0
  62. package/dist/render/primitives/index.d.ts.map +1 -1
  63. package/dist/render/primitives/index.js.map +1 -1
  64. package/dist/render/primitives/media.d.ts +11 -2
  65. package/dist/render/primitives/media.d.ts.map +1 -1
  66. package/dist/render/primitives/media.js +14 -3
  67. package/dist/render/primitives/media.js.map +1 -1
  68. package/dist/render/primitives/shape.d.ts.map +1 -1
  69. package/dist/render/primitives/shape.js +29 -26
  70. package/dist/render/primitives/shape.js.map +1 -1
  71. package/dist/render/primitives/stack.d.ts +1 -1
  72. package/dist/render/primitives/stack.d.ts.map +1 -1
  73. package/dist/render/primitives/stack.js +5 -1
  74. package/dist/render/primitives/stack.js.map +1 -1
  75. package/dist/render/primitives/text.d.ts.map +1 -1
  76. package/dist/render/primitives/text.js +0 -1
  77. package/dist/render/primitives/text.js.map +1 -1
  78. package/dist/render/prop-allowlist.d.ts.map +1 -1
  79. package/dist/render/prop-allowlist.js +25 -2
  80. package/dist/render/prop-allowlist.js.map +1 -1
  81. package/dist/render/shape-geometry.d.ts +81 -0
  82. package/dist/render/shape-geometry.d.ts.map +1 -0
  83. package/dist/render/shape-geometry.js +199 -0
  84. package/dist/render/shape-geometry.js.map +1 -0
  85. package/dist/render/shape-index.d.ts +28 -0
  86. package/dist/render/shape-index.d.ts.map +1 -0
  87. package/dist/render/shape-index.js +77 -0
  88. package/dist/render/shape-index.js.map +1 -0
  89. package/dist/render/tree.d.ts.map +1 -1
  90. package/dist/render/tree.js +175 -3
  91. package/dist/render/tree.js.map +1 -1
  92. package/dist/render/universal-wrapper.d.ts +27 -1
  93. package/dist/render/universal-wrapper.d.ts.map +1 -1
  94. package/dist/render/universal-wrapper.js +98 -22
  95. package/dist/render/universal-wrapper.js.map +1 -1
  96. package/dist/{status-pill-BT5b-yET.js → status-pill-BaLQoIDl.js} +2 -2
  97. package/dist/{status-pill-BT5b-yET.js.map → status-pill-BaLQoIDl.js.map} +1 -1
  98. package/dist/{test-_hh1JvAd.js → test-CA30C2By.js} +51 -51
  99. package/dist/{test-_hh1JvAd.js.map → test-CA30C2By.js.map} +1 -1
  100. package/dist/tree-1coZ32nd.js +1777 -0
  101. package/dist/tree-1coZ32nd.js.map +1 -0
  102. package/package.json +6 -5
  103. package/src/index.ts +24 -0
  104. package/src/modes/broadcast.tsx +12 -1
  105. package/src/modes/control.tsx +10 -1
  106. package/src/modes/test.tsx +4 -1
  107. package/src/render/allowed-hosts.tsx +100 -0
  108. package/src/render/asset-resolve.ts +97 -0
  109. package/src/render/blend-mode.ts +50 -0
  110. package/src/render/bundle.ts +6 -1
  111. package/src/render/fill.tsx +266 -24
  112. package/src/render/headless.tsx +129 -0
  113. package/src/render/mask.tsx +389 -0
  114. package/src/render/primitives/frame.tsx +101 -5
  115. package/src/render/primitives/grid.tsx +4 -1
  116. package/src/render/primitives/image.tsx +17 -3
  117. package/src/render/primitives/index.ts +7 -0
  118. package/src/render/primitives/media.tsx +14 -3
  119. package/src/render/primitives/shape.tsx +39 -75
  120. package/src/render/primitives/stack.tsx +5 -1
  121. package/src/render/primitives/text.tsx +0 -1
  122. package/src/render/prop-allowlist.ts +25 -2
  123. package/src/render/shape-geometry.tsx +315 -0
  124. package/src/render/shape-index.tsx +90 -0
  125. package/src/render/tree.tsx +214 -12
  126. package/src/render/universal-wrapper.tsx +128 -21
  127. package/dist/broadcast-DO7jEkix.js +0 -11
  128. package/dist/broadcast-DO7jEkix.js.map +0 -1
  129. package/dist/control-BSfl4_cO.js +0 -16
  130. package/dist/control-BSfl4_cO.js.map +0 -1
  131. package/dist/index-Crkij3C4.js.map +0 -1
  132. package/dist/tree-DBj9SJgs.js +0 -1230
  133. package/dist/tree-DBj9SJgs.js.map +0 -1
@@ -1,1230 +0,0 @@
1
- import { jsx as p, jsxs as Ct, Fragment as lt } from "react/jsx-runtime";
2
- import { useSignals as ct } from "@preact/signals-react/runtime";
3
- import { motion as D, useMotionValue as _, useTransform as Bt, animate as gt } from "framer-motion";
4
- import { useContext as K, createContext as Nt, useRef as st, useEffect as Tt, useState as Xt, useMemo as Ot } from "react";
5
- import { e as S, r as Z, m as J, t as X, s as Ht, w as Rt, F as It, c as ht, a as jt } from "./index-Crkij3C4.js";
6
- import { effect as Vt } from "@preact/signals-react";
7
- function Yt({ resolved: t, children: e }) {
8
- const n = t.direction ?? "vertical", r = mt(t.gap, 0), i = t.wrap === !0, s = mt(t.crossGap, 0), o = t.align ?? "stretch", l = t.justify ?? "flex-start", a = n === "horizontal", c = {
9
- display: "flex",
10
- flexDirection: a ? "row" : "column",
11
- alignItems: o,
12
- justifyContent: l
13
- };
14
- return i ? (c.flexWrap = "wrap", a ? (c.columnGap = r, c.rowGap = s) : (c.rowGap = r, c.columnGap = s)) : c.gap = r, /* @__PURE__ */ p("div", { style: c, children: e });
15
- }
16
- function mt(t, e) {
17
- return typeof t == "number" && Number.isFinite(t) ? t : e;
18
- }
19
- function Ut({ resolved: t, children: e }) {
20
- const n = t.cols ?? "1fr", r = t.rows ?? "auto", i = t.gap ?? 0;
21
- return /* @__PURE__ */ p(
22
- "div",
23
- {
24
- style: {
25
- display: "grid",
26
- gridTemplateColumns: n,
27
- gridTemplateRows: r,
28
- gap: i
29
- },
30
- children: e
31
- }
32
- );
33
- }
34
- const Kt = 64, Zt = /^[#a-zA-Z0-9(),.% ]{1,64}$/, Jt = /^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/, P = String.raw`\d{1,3}(?:\.\d{1,4})?`, Et = String.raw`(?:0|1|0?\.\d{1,4}|${P}%)`, k = String.raw`[ ]{0,4}`, Qt = new RegExp(
35
- `^rgba?\\(${k}(${P})(%?)${k},${k}(${P})(%?)${k},${k}(${P})(%?)${k}(?:,${k}${Et}${k})?\\)$`
36
- ), te = new RegExp(
37
- `^hsla?\\(${k}(${P})(?:deg)?${k},${k}(${P})%${k},${k}(${P})%${k}(?:,${k}${Et}${k})?\\)$`
38
- ), ee = new Set(
39
- "aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple rebeccapurple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen transparent currentcolor".split(" ")
40
- );
41
- function F(t) {
42
- if (typeof t != "string") return null;
43
- const e = t.trim();
44
- if (e.length === 0 || e.length > Kt) return null;
45
- const n = e.toLowerCase();
46
- if (n.includes("url(") || e.includes(";") || e.includes("}") || !Zt.test(e)) return null;
47
- if (e.startsWith("#")) return Jt.test(e) ? e : null;
48
- if (n.startsWith("rgb")) {
49
- const r = Qt.exec(n);
50
- if (!r) return null;
51
- const i = [r[2], r[4], r[6]];
52
- if (!(i.every((o) => o === "%") || i.every((o) => o === ""))) return null;
53
- const s = i[0] === "%" ? 100 : 255;
54
- for (const o of [r[1], r[3], r[5]])
55
- if (Number(o) > s) return null;
56
- return n;
57
- }
58
- if (n.startsWith("hsl")) {
59
- const r = te.exec(n);
60
- return !r || Number(r[1]) > 360 || Number(r[2]) > 100 || Number(r[3]) > 100 ? null : n;
61
- }
62
- return ee.has(n) ? n : null;
63
- }
64
- function M(t, e) {
65
- S(
66
- e,
67
- t,
68
- "rejected unsafe colour : not a strict hex/rgb()/hsl()/named colour"
69
- );
70
- }
71
- let et = 0;
72
- function ne() {
73
- return et = (et + 1) % 1e6, `lumen-grad-${et.toString(36)}`;
74
- }
75
- function re(t) {
76
- if (t.kind === "solid")
77
- return { defs: [], ref: t.color };
78
- const e = ne();
79
- if (t.kind === "linear-gradient") {
80
- const l = ((t.angle_deg ?? 0) - 90) * Math.PI / 180, a = 0.5 - 0.5 * Math.cos(l), c = 0.5 - 0.5 * Math.sin(l), f = 0.5 + 0.5 * Math.cos(l), h = 0.5 + 0.5 * Math.sin(l);
81
- return { defs: [
82
- /* @__PURE__ */ p(
83
- "linearGradient",
84
- {
85
- id: e,
86
- x1: `${a * 100}%`,
87
- y1: `${c * 100}%`,
88
- x2: `${f * 100}%`,
89
- y2: `${h * 100}%`,
90
- children: t.stops.map((m, b) => /* @__PURE__ */ p(
91
- "stop",
92
- {
93
- offset: m.offset,
94
- stopColor: m.color,
95
- ...m.opacity !== void 0 ? { stopOpacity: m.opacity } : {}
96
- },
97
- b
98
- ))
99
- },
100
- e
101
- )
102
- ], ref: `url(#${e})` };
103
- }
104
- const n = t.center?.x ?? 0.5, r = t.center?.y ?? 0.5, i = t.radius ?? 0.5;
105
- return { defs: [
106
- /* @__PURE__ */ p("radialGradient", { id: e, cx: `${n * 100}%`, cy: `${r * 100}%`, r: `${i * 100}%`, children: t.stops.map((o, l) => /* @__PURE__ */ p(
107
- "stop",
108
- {
109
- offset: o.offset,
110
- stopColor: o.color,
111
- ...o.opacity !== void 0 ? { stopOpacity: o.opacity } : {}
112
- },
113
- l
114
- )) }, e)
115
- ], ref: `url(#${e})` };
116
- }
117
- function ie(t, e) {
118
- const n = t.map((r) => oe(r, e)).filter(Boolean);
119
- return n.length === 0 ? {} : { backgroundImage: n.join(", ") };
120
- }
121
- function oe(t, e) {
122
- if (t.kind === "solid") {
123
- const o = F(t.color);
124
- return o === null ? (M("fill.color", e), null) : `linear-gradient(${o}, ${o})`;
125
- }
126
- const n = [];
127
- for (const o of t.stops) {
128
- const l = F(o.color);
129
- if (l === null)
130
- return M("fill.stops.color", e), null;
131
- const a = o.opacity !== void 0 ? se(l, o.opacity) : l;
132
- n.push(`${a} ${(o.offset * 100).toFixed(2)}%`);
133
- }
134
- const r = n.join(", ");
135
- if (t.kind === "linear-gradient")
136
- return `linear-gradient(${t.angle_deg ?? 0}deg, ${r})`;
137
- const i = (t.center?.x ?? 0.5) * 100, s = (t.center?.y ?? 0.5) * 100;
138
- return `radial-gradient(circle at ${i}% ${s}%, ${r})`;
139
- }
140
- function se(t, e) {
141
- const n = t.match(/^#([0-9a-f]{6})$/i);
142
- if (n) {
143
- const r = Math.round(e * 255).toString(16).padStart(2, "0");
144
- return `#${n[1]}${r}`;
145
- }
146
- return `color-mix(in srgb, ${t} ${e * 100}%, transparent)`;
147
- }
148
- function ae(t, e, n) {
149
- const r = [];
150
- for (const i of t) {
151
- if (i.kind === "solid") {
152
- const l = F(i.color);
153
- if (l === null) {
154
- M(`${e}.color`, n);
155
- continue;
156
- }
157
- r.push({ ...i, color: l });
158
- continue;
159
- }
160
- const s = [];
161
- let o = !1;
162
- for (const l of i.stops ?? []) {
163
- const a = F(l.color);
164
- if (a === null) {
165
- M(`${e}.stops.color`, n), o = !0;
166
- break;
167
- }
168
- s.push({ ...l, color: a });
169
- }
170
- o || r.push({ ...i, stops: s });
171
- }
172
- return r;
173
- }
174
- function Pt(t, e, n) {
175
- if (!Array.isArray(t)) return [];
176
- if (e !== void 0)
177
- for (const r of t)
178
- yt(r) || S(
179
- n,
180
- `${e}.kind`,
181
- "fill kind is not renderable by this runtime ; layer dropped (angular/diamond gradients land with LSML 1.2)"
182
- );
183
- return t.filter(yt);
184
- }
185
- function yt(t) {
186
- if (typeof t != "object" || t === null) return !1;
187
- const e = t.kind;
188
- return e === "solid" || e === "linear-gradient" || e === "radial-gradient";
189
- }
190
- function le({
191
- resolved: t,
192
- nodeId: e,
193
- transitionFor: n,
194
- animateInitial: r,
195
- children: i
196
- }) {
197
- const s = G(t.x, 0), o = G(t.y, 0), l = bt(t.width), a = bt(t.height), c = G(t.opacity, 1), f = G(t.scale, 1), h = G(t.rotate, 0), d = t.background, m = d === void 0 ? void 0 : F(d);
198
- d !== void 0 && m === null && M("frame.background", e);
199
- const b = Pt(t.backgrounds, "frame.backgrounds", e), C = ce(t.clipsContent, e), z = Z(
200
- n,
201
- ["opacity", "scale", "rotate", "x", "y"],
202
- r
203
- ), N = {
204
- position: "absolute",
205
- left: 0,
206
- top: 0,
207
- width: l,
208
- height: a,
209
- willChange: "transform, opacity",
210
- // LSML 1.1 §4.3 `clipsContent` (default `true`) — children outside
211
- // the frame's `size` are clipped. Static layout property : it never
212
- // animates, so it stays off the 0-layout-event hot path (ADR 001
213
- // §3.2.5). `false` => omit the declaration (CSS initial = visible).
214
- ...C ? { overflow: "hidden" } : {}
215
- };
216
- b.length > 0 ? Object.assign(N, ie(b, e)) : m != null && (N.background = m);
217
- const y = J({ opacity: c, x: s, y: o, scale: f, rotate: h }, r, e);
218
- return /* @__PURE__ */ p(
219
- D.div,
220
- {
221
- style: N,
222
- initial: y.initial,
223
- animate: y.animate,
224
- transition: X(z),
225
- children: i
226
- }
227
- );
228
- }
229
- function ce(t, e) {
230
- return t === void 0 ? !0 : typeof t == "boolean" ? t : (S(e, "frame.clipsContent", "rejected value : not a boolean"), !0);
231
- }
232
- function G(t, e) {
233
- return typeof t == "number" && Number.isFinite(t) ? t : e;
234
- }
235
- function bt(t) {
236
- if (typeof t == "number" && Number.isFinite(t) || typeof t == "string" && t.length > 0) return t;
237
- }
238
- const ue = /* @__PURE__ */ new Set(["none", "uppercase", "lowercase", "capitalize"]), fe = /* @__PURE__ */ new Set(["none", "underline", "line-through"]), pe = /* @__PURE__ */ new Set(["normal", "italic", "oblique"]), de = 1e3, ge = 100, wt = 1e3, he = /^[a-zA-Z0-9 ,.'"_-]{1,256}$/;
239
- function me(t) {
240
- if (typeof t != "string") return null;
241
- const e = t.trim();
242
- return e.length === 0 ? null : he.test(e) ? e : null;
243
- }
244
- function ye({ resolved: t, nodeId: e, transitionFor: n, animateInitial: r }) {
245
- const i = t.value === void 0 ? "" : String(t.value), s = t.size ?? "1rem", o = t.weight ?? 400;
246
- let l;
247
- if (t.font !== void 0) {
248
- const b = me(t.font);
249
- b === null ? S(e, "text.font", "rejected fontFamily : outside the family-list grammar") : l = b;
250
- }
251
- let a = "currentColor";
252
- if (t.colour !== void 0) {
253
- const b = F(t.colour);
254
- b === null ? M("text.colour", e) : a = b;
255
- }
256
- const c = t.align ?? "start", f = be(t.opacity, 1), h = we(t, e), d = Z(n, ["opacity", "value"], r), m = J({ opacity: f }, r, e);
257
- return /* @__PURE__ */ p(
258
- D.span,
259
- {
260
- style: {
261
- display: "inline-block",
262
- fontSize: s,
263
- // `font` carries LSML text.style.fontFamily (spec'd in schema.json).
264
- // Omitted => inherit the host/container font.
265
- ...l !== void 0 ? { fontFamily: l } : {},
266
- fontWeight: o,
267
- color: a,
268
- textAlign: c,
269
- ...h,
270
- willChange: "opacity, transform"
271
- },
272
- initial: m.initial,
273
- animate: m.animate,
274
- transition: X(d),
275
- children: i
276
- }
277
- );
278
- }
279
- function be(t, e) {
280
- return typeof t == "number" && Number.isFinite(t) ? t : e;
281
- }
282
- function we(t, e) {
283
- const n = kt(
284
- t.lineHeight,
285
- 0,
286
- ge,
287
- "text.lineHeight",
288
- e
289
- ), r = kt(
290
- t.letterSpacing,
291
- -wt,
292
- wt,
293
- "text.letterSpacing",
294
- e
295
- ), i = nt(
296
- t.textTransform,
297
- ue,
298
- "text.textTransform",
299
- e
300
- ), s = nt(
301
- t.textDecoration,
302
- fe,
303
- "text.textDecoration",
304
- e
305
- ), o = nt(t.fontStyle, pe, "text.fontStyle", e), l = ke(t.maxLines, de, "text.maxLines", e);
306
- return {
307
- ...n !== void 0 ? { lineHeight: n } : {},
308
- // Built from a validated finite number — no string passthrough.
309
- ...r !== void 0 ? { letterSpacing: `${r}px` } : {},
310
- ...i !== void 0 ? { textTransform: i } : {},
311
- ...s !== void 0 ? { textDecoration: s } : {},
312
- ...o !== void 0 ? { fontStyle: o } : {},
313
- ...l !== void 0 ? {
314
- display: "-webkit-box",
315
- WebkitBoxOrient: "vertical",
316
- WebkitLineClamp: l,
317
- overflow: "hidden",
318
- textOverflow: "ellipsis"
319
- } : {}
320
- };
321
- }
322
- function nt(t, e, n, r) {
323
- if (t !== void 0) {
324
- if (typeof t == "string" && e.has(t)) return t;
325
- ut(n, r);
326
- }
327
- }
328
- function kt(t, e, n, r, i) {
329
- if (t !== void 0) {
330
- if (typeof t == "number" && Number.isFinite(t) && t >= e && t <= n) return t;
331
- ut(r, i);
332
- }
333
- }
334
- function ke(t, e, n, r) {
335
- if (t !== void 0) {
336
- if (typeof t == "number" && Number.isInteger(t) && t >= 1 && t <= e) return t;
337
- ut(n, r);
338
- }
339
- }
340
- function ut(t, e) {
341
- S(
342
- e,
343
- t,
344
- "rejected typography value : outside the field's spec'd grammar or caps"
345
- );
346
- }
347
- function xe({ resolved: t, nodeId: e, transitionFor: n, animateInitial: r }) {
348
- const i = t.src;
349
- if (!i) return null;
350
- const s = typeof t.alt == "string" ? t.alt : "", o = t.fit ?? "contain", l = t.position ?? "center", a = $e(t.opacity, 1), c = xt(t.width, "100%"), f = xt(t.height, "100%"), h = Z(n, ["opacity", "src"], r), d = J({ opacity: a }, r, e);
351
- return /* @__PURE__ */ p(
352
- D.img,
353
- {
354
- src: i,
355
- alt: s,
356
- style: {
357
- objectFit: o,
358
- objectPosition: l,
359
- width: c,
360
- height: f,
361
- willChange: "opacity, transform"
362
- },
363
- initial: d.initial,
364
- animate: d.animate,
365
- transition: X(h),
366
- draggable: !1
367
- }
368
- );
369
- }
370
- function $e(t, e) {
371
- return typeof t == "number" && Number.isFinite(t) ? t : e;
372
- }
373
- function xt(t, e) {
374
- return typeof t == "number" && Number.isFinite(t) ? `${t}px` : typeof t == "string" && t.length > 0 ? t : e;
375
- }
376
- const Se = 8192, Ae = 4e3, ve = 64, _e = new Set("MmLlHhVvCcSsQqTtAaZz");
377
- function rt(t) {
378
- return t >= 48 && t <= 57;
379
- }
380
- function Fe(t) {
381
- return t === 32 || t === 9 || t === 13 || t === 10 || t === 44;
382
- }
383
- function $t(t) {
384
- if (typeof t != "string" || t.length === 0 || t.length > Se) return null;
385
- const e = t.trim();
386
- if (e.length === 0) return null;
387
- const n = e.toLowerCase();
388
- if (n.includes("url(") || n.includes("data:") || e.includes("<") || e.includes("&")) return null;
389
- const r = e.length;
390
- let i = 0, s = 0, o = !1;
391
- for (; i < r; ) {
392
- const l = e.charCodeAt(i);
393
- if (Fe(l)) {
394
- i++;
395
- continue;
396
- }
397
- const a = e[i];
398
- if (_e.has(a)) {
399
- if (!o && a !== "M" && a !== "m" || (o = !0, s++, s > Ae)) return null;
400
- i++;
401
- continue;
402
- }
403
- if (!o) return null;
404
- (a === "+" || a === "-") && i++;
405
- let c = 0;
406
- for (; i < r && rt(e.charCodeAt(i)); )
407
- i++, c++;
408
- if (i < r && e[i] === ".") {
409
- i++;
410
- let f = 0;
411
- for (; i < r && rt(e.charCodeAt(i)); )
412
- i++, f++;
413
- if (f === 0 && i < r && e[i] === ".") return null;
414
- c += f;
415
- }
416
- if (c === 0) return null;
417
- if (i < r && (e[i] === "e" || e[i] === "E")) {
418
- i++, i < r && (e[i] === "+" || e[i] === "-") && i++;
419
- let f = 0;
420
- for (; i < r && rt(e.charCodeAt(i)); )
421
- i++, f++;
422
- if (f === 0) return null;
423
- }
424
- }
425
- return s === 0 ? null : e;
426
- }
427
- function Me(t, e) {
428
- const n = t.paths, r = t.pathData;
429
- if (Array.isArray(n)) {
430
- r !== void 0 && E(e, "shape.pathData", "mutually exclusive with paths[] ; paths[] wins");
431
- const i = [];
432
- for (let s = 0; s < n.length; s++) {
433
- if (i.length >= ve) {
434
- E(e, "shape.paths", "subpath cap exceeded ; remaining entries dropped");
435
- break;
436
- }
437
- const o = n[s], l = $t(
438
- typeof o == "object" && o !== null ? o.data : void 0
439
- );
440
- if (l === null) {
441
- E(e, "shape.paths.data", "not a strict SVG path grammar (allowlist/caps)");
442
- continue;
443
- }
444
- i.push({ d: l, fillRule: Ce(o?.windingRule, e) });
445
- }
446
- return i.length === 0 && n.length > 0 && E(e, "shape.paths", "no renderable subpath ; shape geometry omitted"), i;
447
- }
448
- if (r !== void 0) {
449
- const i = $t(r);
450
- return i === null ? (E(e, "shape.pathData", "not a strict SVG path grammar (allowlist/caps)"), []) : [{ d: i, fillRule: "nonzero" }];
451
- }
452
- return E(e, "shape.paths", "geometry is path but neither pathData nor paths[] is present"), [];
453
- }
454
- function Ce(t, e) {
455
- return t === void 0 || t === "NONZERO" ? "nonzero" : t === "EVENODD" ? "evenodd" : (E(e, "shape.paths.windingRule", "unknown winding rule ; defaulting to nonzero"), "nonzero");
456
- }
457
- function E(t, e, n) {
458
- S(t, e, n);
459
- }
460
- function Ne({ resolved: t, nodeId: e, transitionFor: n, animateInitial: r }) {
461
- const i = t.geometry ?? t.kind ?? "rect", s = it(t.fill, "shape.fill", e) ?? "transparent", o = it(t.stroke, "shape.stroke", e) ?? "transparent", l = B(t.stroke_width, 0), a = B(t.width, 100), c = B(t.height, 100), f = B(t.radius, 0), h = B(t.opacity, 1), d = typeof t.ariaLabel == "string" ? t.ariaLabel : void 0, m = Z(n, ["opacity"], r), b = X(m), C = J({ opacity: h }, r, e), z = ae(
462
- Pt(t.fills, "shape.fills", e),
463
- "shape.fills",
464
- e
465
- ), N = Te(t.strokes), y = i === "path" ? Me(t, e) : [], w = z.map(re), T = w.flatMap((u) => u.defs), q = w.length > 0 ? w.map((u) => u.ref) : [s], H = N.length > 0 ? N.map((u) => ({
466
- color: it(u.color, "shape.strokes.color", e) ?? "transparent",
467
- width: u.width ?? 0
468
- })) : [{ color: o, width: l }], I = [...q].reverse(), W = [...H].reverse(), V = i === "path" ? W.filter((u) => u.width > 0 && u.color !== "transparent") : W, Y = (u, g, $) => i === "path" ? /* @__PURE__ */ p("g", { children: y.map((v, O) => /* @__PURE__ */ p(
469
- "path",
470
- {
471
- d: v.d,
472
- fillRule: v.fillRule,
473
- fill: u,
474
- stroke: g.color,
475
- strokeWidth: g.width
476
- },
477
- O
478
- )) }, $) : i === "circle" ? /* @__PURE__ */ p(
479
- "circle",
480
- {
481
- cx: a / 2,
482
- cy: c / 2,
483
- r: Math.min(a, c) / 2 - g.width / 2,
484
- fill: u,
485
- stroke: g.color,
486
- strokeWidth: g.width
487
- },
488
- $
489
- ) : i === "line" ? /* @__PURE__ */ p(
490
- "line",
491
- {
492
- x1: "0",
493
- y1: c / 2,
494
- x2: a,
495
- y2: c / 2,
496
- stroke: g.color || u,
497
- strokeWidth: g.width || 1
498
- },
499
- $
500
- ) : /* @__PURE__ */ p(
501
- "rect",
502
- {
503
- x: g.width / 2,
504
- y: g.width / 2,
505
- width: Math.max(0, a - g.width),
506
- height: Math.max(0, c - g.width),
507
- rx: f,
508
- ry: f,
509
- fill: u,
510
- stroke: g.color,
511
- strokeWidth: g.width
512
- },
513
- $
514
- );
515
- return /* @__PURE__ */ Ct(
516
- D.svg,
517
- {
518
- width: a,
519
- height: c,
520
- viewBox: `0 0 ${a} ${c}`,
521
- ...d !== void 0 ? { "aria-label": d, role: "img" } : {},
522
- initial: C.initial,
523
- animate: C.animate,
524
- transition: b,
525
- style: { willChange: "opacity, transform" },
526
- children: [
527
- T.length > 0 && /* @__PURE__ */ p("defs", { children: T }),
528
- I.map(
529
- (u, g) => Y(u, { color: "transparent", width: 0 }, `fill-${g}`)
530
- ),
531
- V.map((u, g) => Y("none", u, `stroke-${g}`))
532
- ]
533
- }
534
- );
535
- }
536
- function it(t, e, n) {
537
- if (typeof t != "string") return null;
538
- const r = F(t);
539
- return r === null && M(e, n), r;
540
- }
541
- function Te(t) {
542
- return Array.isArray(t) ? t.filter(
543
- (e) => typeof e == "object" && e !== null && ("color" in e || "width" in e)
544
- ) : [];
545
- }
546
- function B(t, e) {
547
- return typeof t == "number" && Number.isFinite(t) ? t : e;
548
- }
549
- function Oe({ resolved: t }) {
550
- const e = t.src;
551
- if (!e) return null;
552
- const n = t.loop ?? !0, r = t.mute ?? !0, i = t.autoplay ?? !0, s = t.fit ?? "cover";
553
- return /* @__PURE__ */ p(
554
- "video",
555
- {
556
- src: e,
557
- autoPlay: i,
558
- loop: n,
559
- muted: r,
560
- playsInline: !0,
561
- style: {
562
- width: "100%",
563
- height: "100%",
564
- objectFit: s
565
- }
566
- }
567
- );
568
- }
569
- const St = /* @__PURE__ */ new Set();
570
- function Re({ resolved: t, nodeId: e }) {
571
- const n = t.scene_id, r = t.scene_version;
572
- if (!n || !r)
573
- return S(e, "instance.scene_id", "missing scene_id or scene_version ; not rendered"), null;
574
- const i = `${n}:${r}`;
575
- St.has(i) || (St.add(i), S(
576
- e,
577
- "instance",
578
- "scaffold render — async bundle fetch + __params.* injection are not yet wired (LSML 1.1 §4.9)"
579
- ));
580
- const s = t.size, o = t.position;
581
- return /* @__PURE__ */ p(
582
- "div",
583
- {
584
- "data-lumencast-instance": n,
585
- "data-lumencast-version": r,
586
- style: {
587
- position: o ? "absolute" : "relative",
588
- left: o?.x,
589
- top: o?.y,
590
- width: s?.w,
591
- height: s?.h,
592
- outline: "none",
593
- boxSizing: "border-box"
594
- }
595
- }
596
- );
597
- }
598
- const je = {
599
- stack: Yt,
600
- grid: Ut,
601
- frame: le,
602
- text: ye,
603
- image: xe,
604
- shape: Ne,
605
- media: Oe,
606
- instance: Re
607
- }, at = Nt("");
608
- function Ee({ prefix: t, children: e }) {
609
- const n = K(at), r = n ? `${n}.${t}` : t;
610
- return /* @__PURE__ */ p(at.Provider, { value: r, children: e });
611
- }
612
- function ft() {
613
- return K(at);
614
- }
615
- function L(t, e) {
616
- return !t || e.startsWith("__") ? e : `${t}.${e}`;
617
- }
618
- function At(t) {
619
- switch (t) {
620
- case "fixed":
621
- return "0 0 auto";
622
- case "hug":
623
- return "0 1 auto";
624
- case "fill":
625
- return "1 1 auto";
626
- default:
627
- return;
628
- }
629
- }
630
- function Pe({
631
- visible: t,
632
- opacity: e,
633
- rotation: n,
634
- sizing: r,
635
- children: i
636
- }) {
637
- if (t === !1)
638
- return null;
639
- const s = typeof e == "number" && e !== 1, o = typeof n == "number" && n !== 0, l = r?.x !== void 0 || r?.y !== void 0;
640
- if (!s && !o && !l)
641
- return /* @__PURE__ */ p(lt, { children: i });
642
- const a = {};
643
- if (s && (a.opacity = e), o && (a.transform = `rotate(${n}deg)`), l) {
644
- const c = At(r?.x), f = At(r?.y);
645
- c === f && c !== void 0 ? a.flex = c : a.flex = c ?? f;
646
- }
647
- return /* @__PURE__ */ p("div", { style: a, children: i });
648
- }
649
- const Le = {
650
- linear: "linear",
651
- "ease-in": "easeIn",
652
- "ease-out": "easeOut",
653
- "ease-in-out": "easeInOut"
654
- };
655
- function De(t, e) {
656
- const n = t.steps;
657
- if (!Array.isArray(n) || n.length < 2) return;
658
- const r = n[0], i = n[n.length - 1];
659
- if (r.at !== 0 || i.at !== 1) return;
660
- const s = n.map((l) => l.at), o = {};
661
- return vt(n, "opacity", o, e), vt(n, "filter", o, e), U(n, "scale", o), U(n, "translateX", o), U(n, "translateY", o), U(n, "rotate", o), {
662
- animate: o,
663
- transition: {
664
- duration: t.duration_ms / 1e3,
665
- ease: Le[t.easing ?? "linear"],
666
- times: s
667
- }
668
- };
669
- }
670
- function vt(t, e, n, r) {
671
- let i = !1;
672
- const s = [];
673
- let o;
674
- for (const l of t) {
675
- let a = l[e];
676
- if (e === "filter" && a !== void 0) {
677
- const c = Ht(a);
678
- c === null ? (Rt("keyframes.steps[].filter", r), a = void 0) : a = c;
679
- }
680
- a !== void 0 ? (i = !0, o = a, s.push(a)) : s.push(o ?? (e === "opacity" ? 1 : It));
681
- }
682
- i && (n[e] = s);
683
- }
684
- function U(t, e, n) {
685
- let r = !1;
686
- const i = [];
687
- let s;
688
- for (const o of t) {
689
- const l = o.transform?.[e];
690
- typeof l == "number" ? (r = !0, s = l, i.push(l)) : i.push(s ?? ze(e));
691
- }
692
- r && (e === "rotate" ? n.rotate = i.map((o) => `${o}deg`) : n[e] = i);
693
- }
694
- function ze(t) {
695
- return t === "scale" ? 1 : 0;
696
- }
697
- const pt = Nt(0), _t = 2e3;
698
- function qe(t, e) {
699
- if (e <= 0) return 0;
700
- const n = t * e;
701
- return n > _t ? _t : n;
702
- }
703
- function We({
704
- keyframes: t,
705
- store: e,
706
- nodeId: n,
707
- children: r
708
- }) {
709
- ct();
710
- const i = ft(), s = K(pt), o = st(void 0), l = st(0);
711
- if (t.key !== void 0) {
712
- const f = e.signal(L(i, t.key)).value;
713
- o.current !== f && (o.current = f, l.current += 1);
714
- }
715
- const a = De(t, n);
716
- if (!a)
717
- return /* @__PURE__ */ p(lt, { children: r });
718
- const c = s > 0 ? { ...a.transition, delay: s / 1e3 } : a.transition;
719
- return /* @__PURE__ */ Ct(
720
- D.div,
721
- {
722
- style: { display: "contents" },
723
- initial: Be(a.animate),
724
- animate: a.animate,
725
- transition: c,
726
- children: [
727
- /* @__PURE__ */ p(Ge, {}),
728
- r
729
- ]
730
- },
731
- l.current
732
- );
733
- }
734
- function Ge() {
735
- return Tt(() => {
736
- }, []), null;
737
- }
738
- function Be(t) {
739
- const e = {};
740
- for (const [n, r] of Object.entries(t))
741
- r.length > 0 && (e[n] = r[0]);
742
- return e;
743
- }
744
- function Xe(t, e = (r) => requestAnimationFrame(r), n = (r) => cancelAnimationFrame(r)) {
745
- const r = /* @__PURE__ */ new Map();
746
- let i = null, s = !1;
747
- const o = () => {
748
- i = null;
749
- const l = [...r.entries()];
750
- r.clear();
751
- for (const [a, c] of l)
752
- t(a, c);
753
- };
754
- return {
755
- push(l, a) {
756
- s || (r.set(l, a), i === null && (i = e(o)));
757
- },
758
- dispose() {
759
- s = !0, r.clear(), i !== null && (n(i), i = null);
760
- }
761
- };
762
- }
763
- const He = {
764
- aliceblue: 15792383,
765
- antiquewhite: 16444375,
766
- aqua: 65535,
767
- aquamarine: 8388564,
768
- azure: 15794175,
769
- beige: 16119260,
770
- bisque: 16770244,
771
- black: 0,
772
- blanchedalmond: 16772045,
773
- blue: 255,
774
- blueviolet: 9055202,
775
- brown: 10824234,
776
- burlywood: 14596231,
777
- cadetblue: 6266528,
778
- chartreuse: 8388352,
779
- chocolate: 13789470,
780
- coral: 16744272,
781
- cornflowerblue: 6591981,
782
- cornsilk: 16775388,
783
- crimson: 14423100,
784
- cyan: 65535,
785
- darkblue: 139,
786
- darkcyan: 35723,
787
- darkgoldenrod: 12092939,
788
- darkgray: 11119017,
789
- darkgreen: 25600,
790
- darkgrey: 11119017,
791
- darkkhaki: 12433259,
792
- darkmagenta: 9109643,
793
- darkolivegreen: 5597999,
794
- darkorange: 16747520,
795
- darkorchid: 10040012,
796
- darkred: 9109504,
797
- darksalmon: 15308410,
798
- darkseagreen: 9419919,
799
- darkslateblue: 4734347,
800
- darkslategray: 3100495,
801
- darkslategrey: 3100495,
802
- darkturquoise: 52945,
803
- darkviolet: 9699539,
804
- deeppink: 16716947,
805
- deepskyblue: 49151,
806
- dimgray: 6908265,
807
- dimgrey: 6908265,
808
- dodgerblue: 2003199,
809
- firebrick: 11674146,
810
- floralwhite: 16775920,
811
- forestgreen: 2263842,
812
- fuchsia: 16711935,
813
- gainsboro: 14474460,
814
- ghostwhite: 16316671,
815
- gold: 16766720,
816
- goldenrod: 14329120,
817
- gray: 8421504,
818
- green: 32768,
819
- greenyellow: 11403055,
820
- grey: 8421504,
821
- honeydew: 15794160,
822
- hotpink: 16738740,
823
- indianred: 13458524,
824
- indigo: 4915330,
825
- ivory: 16777200,
826
- khaki: 15787660,
827
- lavender: 15132410,
828
- lavenderblush: 16773365,
829
- lawngreen: 8190976,
830
- lemonchiffon: 16775885,
831
- lightblue: 11393254,
832
- lightcoral: 15761536,
833
- lightcyan: 14745599,
834
- lightgoldenrodyellow: 16448210,
835
- lightgray: 13882323,
836
- lightgreen: 9498256,
837
- lightgrey: 13882323,
838
- lightpink: 16758465,
839
- lightsalmon: 16752762,
840
- lightseagreen: 2142890,
841
- lightskyblue: 8900346,
842
- lightslategray: 7833753,
843
- lightslategrey: 7833753,
844
- lightsteelblue: 11584734,
845
- lightyellow: 16777184,
846
- lime: 65280,
847
- limegreen: 3329330,
848
- linen: 16445670,
849
- magenta: 16711935,
850
- maroon: 8388608,
851
- mediumaquamarine: 6737322,
852
- mediumblue: 205,
853
- mediumorchid: 12211667,
854
- mediumpurple: 9662683,
855
- mediumseagreen: 3978097,
856
- mediumslateblue: 8087790,
857
- mediumspringgreen: 64154,
858
- mediumturquoise: 4772300,
859
- mediumvioletred: 13047173,
860
- midnightblue: 1644912,
861
- mintcream: 16121850,
862
- mistyrose: 16770273,
863
- moccasin: 16770229,
864
- navajowhite: 16768685,
865
- navy: 128,
866
- oldlace: 16643558,
867
- olive: 8421376,
868
- olivedrab: 7048739,
869
- orange: 16753920,
870
- orangered: 16729344,
871
- orchid: 14315734,
872
- palegoldenrod: 15657130,
873
- palegreen: 10025880,
874
- paleturquoise: 11529966,
875
- palevioletred: 14381203,
876
- papayawhip: 16773077,
877
- peachpuff: 16767673,
878
- peru: 13468991,
879
- pink: 16761035,
880
- plum: 14524637,
881
- powderblue: 11591910,
882
- purple: 8388736,
883
- rebeccapurple: 6697881,
884
- red: 16711680,
885
- rosybrown: 12357519,
886
- royalblue: 4286945,
887
- saddlebrown: 9127187,
888
- salmon: 16416882,
889
- sandybrown: 16032864,
890
- seagreen: 3050327,
891
- seashell: 16774638,
892
- sienna: 10506797,
893
- silver: 12632256,
894
- skyblue: 8900331,
895
- slateblue: 6970061,
896
- slategray: 7372944,
897
- slategrey: 7372944,
898
- snow: 16775930,
899
- springgreen: 65407,
900
- steelblue: 4620980,
901
- tan: 13808780,
902
- teal: 32896,
903
- thistle: 14204888,
904
- tomato: 16737095,
905
- turquoise: 4251856,
906
- violet: 15631086,
907
- wheat: 16113331,
908
- white: 16777215,
909
- whitesmoke: 16119285,
910
- yellow: 16776960,
911
- yellowgreen: 10145074
912
- };
913
- function Ie(t) {
914
- const e = F(t);
915
- if (e === null) return null;
916
- if (e.startsWith("#")) return Ve(e);
917
- if (e.startsWith("rgb")) {
918
- const i = e.slice(e.indexOf("(") + 1, -1).split(",").map((h) => h.trim());
919
- if (i.length < 3) return null;
920
- const o = i[0].endsWith("%") ? 100 : 255, l = ot(i[0], o), a = ot(i[1], o), c = ot(i[2], o), f = i.length > 3 ? Ft(i[3]) : 1;
921
- return l === null || a === null || c === null || f === null ? null : [l, a, c, f];
922
- }
923
- if (e.startsWith("hsl")) {
924
- const i = e.slice(e.indexOf("(") + 1, -1).split(",").map((d) => d.trim());
925
- if (i.length < 3) return null;
926
- const s = Number(i[0].replace("deg", "")), o = Number(i[1].replace("%", "")) / 100, l = Number(i[2].replace("%", "")) / 100, a = i.length > 3 ? Ft(i[3]) : 1;
927
- if (![s, o, l].every(Number.isFinite) || a === null) return null;
928
- const [c, f, h] = Ye(s, o, l);
929
- return [c, f, h, a];
930
- }
931
- if (e === "transparent") return [0, 0, 0, 0];
932
- if (e === "currentcolor") return null;
933
- const n = He[e];
934
- return n === void 0 ? null : [(n >> 16 & 255) / 255, (n >> 8 & 255) / 255, (n & 255) / 255, 1];
935
- }
936
- function Ve(t) {
937
- const e = t.slice(1);
938
- if (e.length === 3 || e.length === 4) {
939
- const n = parseInt(e[0] + e[0], 16), r = parseInt(e[1] + e[1], 16), i = parseInt(e[2] + e[2], 16), s = e.length === 4 ? parseInt(e[3] + e[3], 16) : 255;
940
- return [n / 255, r / 255, i / 255, s / 255];
941
- }
942
- if (e.length === 6 || e.length === 8) {
943
- const n = parseInt(e.slice(0, 2), 16), r = parseInt(e.slice(2, 4), 16), i = parseInt(e.slice(4, 6), 16), s = e.length === 8 ? parseInt(e.slice(6, 8), 16) : 255;
944
- return [n / 255, r / 255, i / 255, s / 255];
945
- }
946
- return null;
947
- }
948
- function ot(t, e) {
949
- const n = Number(t.replace("%", ""));
950
- return Number.isFinite(n) ? x(n / e) : null;
951
- }
952
- function Ft(t) {
953
- const e = t.endsWith("%"), n = Number(t.replace("%", ""));
954
- return Number.isFinite(n) ? x(e ? n / 100 : n) : null;
955
- }
956
- function Ye(t, e, n) {
957
- const r = (t % 360 + 360) % 360, i = (1 - Math.abs(2 * n - 1)) * e, s = r / 60, o = i * (1 - Math.abs(s % 2 - 1));
958
- let l = 0, a = 0, c = 0;
959
- s < 1 ? [l, a, c] = [i, o, 0] : s < 2 ? [l, a, c] = [o, i, 0] : s < 3 ? [l, a, c] = [0, i, o] : s < 4 ? [l, a, c] = [0, o, i] : s < 5 ? [l, a, c] = [o, 0, i] : [l, a, c] = [i, 0, o];
960
- const f = n - i / 2;
961
- return [x(l + f), x(a + f), x(c + f)];
962
- }
963
- function Ue(t, e, n) {
964
- return [
965
- x(t[0] + n * (e[0] - t[0])),
966
- x(t[1] + n * (e[1] - t[1])),
967
- x(t[2] + n * (e[2] - t[2])),
968
- x(t[3] + n * (e[3] - t[3]))
969
- ];
970
- }
971
- function Mt(t) {
972
- const e = Math.round(x(t[0]) * 255), n = Math.round(x(t[1]) * 255), r = Math.round(x(t[2]) * 255), i = Math.round(x(t[3]) * 1e4) / 1e4;
973
- return `rgba(${e}, ${n}, ${r}, ${i})`;
974
- }
975
- function x(t) {
976
- return t < 0 ? 0 : t > 1 ? 1 : t;
977
- }
978
- const Lt = {
979
- "style.color": "colour",
980
- fill: "fill",
981
- background: "background"
982
- };
983
- function Ke(t, e) {
984
- switch (t) {
985
- case "opacity": {
986
- const n = j(e);
987
- return n === null ? null : { opacity: n < 0 ? 0 : n > 1 ? 1 : n };
988
- }
989
- case "transform.translate": {
990
- if (!Array.isArray(e) || e.length !== 2) return null;
991
- const n = j(e[0]), r = j(e[1]);
992
- return n === null || r === null ? null : { x: n, y: r };
993
- }
994
- case "transform.scale": {
995
- const n = j(e);
996
- if (n !== null) return { scaleX: n, scaleY: n };
997
- if (Array.isArray(e) && e.length === 2) {
998
- const r = j(e[0]), i = j(e[1]);
999
- return r === null || i === null ? null : { scaleX: r, scaleY: i };
1000
- }
1001
- return null;
1002
- }
1003
- case "transform.rotate": {
1004
- const n = j(e);
1005
- return n === null ? null : { rotate: n };
1006
- }
1007
- case "filter.blur": {
1008
- const n = ht("blur", e);
1009
- return n === null ? null : { blur: n };
1010
- }
1011
- case "filter.brightness": {
1012
- const n = ht("brightness", e);
1013
- return n === null ? null : { brightness: n };
1014
- }
1015
- default:
1016
- return null;
1017
- }
1018
- }
1019
- function j(t) {
1020
- return typeof t != "number" || !Number.isFinite(t) ? null : Object.is(t, -0) ? 0 : t;
1021
- }
1022
- const Ze = {
1023
- kind: "spring",
1024
- stiffness: 170,
1025
- damping: 26,
1026
- mass: 1
1027
- };
1028
- function Je(t) {
1029
- switch (t) {
1030
- case "opacity":
1031
- return "opacity";
1032
- case "transform.translate":
1033
- return "x";
1034
- case "transform.scale":
1035
- return "scale";
1036
- case "transform.rotate":
1037
- return "rotate";
1038
- case "filter.blur":
1039
- case "filter.brightness":
1040
- return "filter";
1041
- default:
1042
- return Lt[t] ?? t;
1043
- }
1044
- }
1045
- const Qe = {};
1046
- function tn(t, e, n) {
1047
- const r = t.animateBindings, i = K(pt), s = _(1), o = _(0), l = _(0), a = _(1), c = _(1), f = _(0), h = _(0), d = _(1), m = Bt(
1048
- [h, d],
1049
- ([y, w]) => `blur(${y}px) brightness(${w})`
1050
- ), [b, C] = Xt(Qe), z = st({
1051
- opacity: s,
1052
- x: o,
1053
- y: l,
1054
- scaleX: a,
1055
- scaleY: c,
1056
- rotate: f,
1057
- blur: h,
1058
- brightness: d
1059
- });
1060
- return Tt(() => {
1061
- if (!r || Object.keys(r).length === 0) return;
1062
- const y = z.current, w = /* @__PURE__ */ new Map(), T = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Set();
1063
- let H = !1;
1064
- const I = (u, g) => {
1065
- const v = e.transitionSignal(g).peek() ?? t.transitions?.[Je(u)], O = X(v ?? Ze);
1066
- return i > 0 && !q.has(u) ? { ...O, delay: i / 1e3 } : O;
1067
- }, W = (u, g, $) => {
1068
- const v = Lt[u], O = L(n, r[u]);
1069
- if (v !== void 0) {
1070
- const A = Ie(g);
1071
- if (A === null) {
1072
- M(`bindAnimate.${u}`, t.id);
1073
- return;
1074
- }
1075
- const R = T.get(u);
1076
- if ($ || R === void 0) {
1077
- T.set(u, { current: A }), C((tt) => ({ ...tt, [v]: Mt(A) }));
1078
- return;
1079
- }
1080
- const qt = R.current, Wt = I(u, O);
1081
- q.add(u), w.get(`color:${u}`)?.stop(), w.set(
1082
- `color:${u}`,
1083
- gt(0, 1, {
1084
- ...Wt,
1085
- onUpdate: (tt) => {
1086
- const dt = Ue(qt, A, tt);
1087
- R.current = dt, C((Gt) => ({ ...Gt, [v]: Mt(dt) }));
1088
- }
1089
- })
1090
- );
1091
- return;
1092
- }
1093
- const Q = Ke(u, g);
1094
- if (Q === null) {
1095
- u.startsWith("filter.") ? Rt(`bindAnimate.${u}`, t.id) : en(u, t.id);
1096
- return;
1097
- }
1098
- if ($) {
1099
- for (const [A, R] of Object.entries(Q))
1100
- y[A].jump(R);
1101
- return;
1102
- }
1103
- const zt = I(u, O);
1104
- q.add(u);
1105
- for (const [A, R] of Object.entries(Q))
1106
- w.set(A, gt(y[A], R, zt));
1107
- }, V = Xe((u, g) => W(u, g, !1)), Y = Object.entries(r).map(
1108
- ([u, g]) => Vt(() => {
1109
- const $ = e.signal(L(n, g)).value;
1110
- $ !== void 0 && (H ? V.push(u, $) : W(u, $, !0));
1111
- })
1112
- );
1113
- return H = !0, () => {
1114
- for (const u of Y) u();
1115
- V.dispose();
1116
- for (const u of w.values()) u.stop();
1117
- };
1118
- }, [t, r, e, n, i]), { motionStyle: Ot(() => {
1119
- if (!r) return null;
1120
- const y = {};
1121
- let w = !1;
1122
- for (const T of Object.keys(r))
1123
- switch (T) {
1124
- case "opacity":
1125
- y.opacity = s, w = !0;
1126
- break;
1127
- case "transform.translate":
1128
- y.x = o, y.y = l, w = !0;
1129
- break;
1130
- case "transform.scale":
1131
- y.scaleX = a, y.scaleY = c, w = !0;
1132
- break;
1133
- case "transform.rotate":
1134
- y.rotate = f, w = !0;
1135
- break;
1136
- case "filter.blur":
1137
- case "filter.brightness":
1138
- y.filter = m, w = !0;
1139
- break;
1140
- }
1141
- return w ? (y.willChange = "transform, opacity, filter", y) : null;
1142
- }, [r, s, o, l, a, c, f, m]), colorProps: b };
1143
- }
1144
- function en(t, e) {
1145
- S(
1146
- e,
1147
- `bindAnimate.${t}`,
1148
- "rejected bound value : JSON shape does not match the property type (LSML §6.3)"
1149
- );
1150
- }
1151
- function Dt({ node: t, store: e }) {
1152
- return t.kind === "repeat" ? /* @__PURE__ */ p(on, { node: t, store: e }) : /* @__PURE__ */ p(nn, { node: t, store: e });
1153
- }
1154
- function nn({ node: t, store: e }) {
1155
- ct();
1156
- const n = ft(), r = Ot(
1157
- () => sn(t, e, n),
1158
- // We re-build per render — signals re-render cheaply, and the
1159
- // resolution itself is O(bindings) which is small. The memo is a
1160
- // micro-optimisation to keep object identity stable across renders
1161
- // when the inputs haven't changed.
1162
- [t, e, n, ...an(t, e, n)]
1163
- ), i = tn(t, e, n);
1164
- jt(t);
1165
- const s = je[t.kind];
1166
- if (!s)
1167
- return S(t.id, "kind", "unknown render kind ; node not rendered"), null;
1168
- const o = {};
1169
- if (t.bindings)
1170
- for (const [d, m] of Object.entries(t.bindings)) {
1171
- const b = e.transitionSignal(L(n, m)).value;
1172
- b !== void 0 && (o[d] = b);
1173
- }
1174
- const l = (d) => d in o ? o[d] : t.transitions?.[d], a = t.children?.map((d, m) => /* @__PURE__ */ p(Dt, { node: d, store: e }, d.id ?? m)), c = {
1175
- visible: typeof r.visible == "boolean" ? r.visible : void 0,
1176
- opacity: typeof r.universal_opacity == "number" ? r.universal_opacity : void 0,
1177
- rotation: typeof r.rotation == "number" ? r.rotation : void 0,
1178
- sizing: rn(r.sizing)
1179
- }, f = Object.keys(i.colorProps).length > 0 ? { ...r, ...i.colorProps } : r;
1180
- let h = /* @__PURE__ */ p(Pe, { ...c, children: /* @__PURE__ */ p(
1181
- s,
1182
- {
1183
- resolved: f,
1184
- nodeId: t.id,
1185
- transitionFor: l,
1186
- animateInitial: t.animate_initial,
1187
- children: a
1188
- }
1189
- ) });
1190
- return i.motionStyle && (h = /* @__PURE__ */ p(D.div, { "data-lumencast-bind-animate": t.id ?? "", style: i.motionStyle, children: h })), t.keyframes ? /* @__PURE__ */ p(We, { keyframes: t.keyframes, store: e, nodeId: t.id, children: h }) : h;
1191
- }
1192
- function rn(t) {
1193
- if (typeof t != "object" || t === null) return;
1194
- const e = t, n = {};
1195
- return (e.x === "fixed" || e.x === "hug" || e.x === "fill") && (n.x = e.x), (e.y === "fixed" || e.y === "hug" || e.y === "fill") && (n.y = e.y), n.x !== void 0 || n.y !== void 0 ? n : void 0;
1196
- }
1197
- function on({ node: t, store: e }) {
1198
- ct();
1199
- const n = ft();
1200
- jt(t);
1201
- const r = t.bindings?.items, i = r === void 0 ? [] : e.signal(L(n, r)).value ?? [];
1202
- if (!Array.isArray(i)) return null;
1203
- const s = t.children?.[0];
1204
- if (!s) return null;
1205
- const o = typeof t.stagger_ms == "number" ? t.stagger_ms : 0;
1206
- return /* @__PURE__ */ p(lt, { children: i.map((l, a) => {
1207
- const c = qe(a, o), f = /* @__PURE__ */ p(Ee, { prefix: `${r ?? ""}.${a}`, children: /* @__PURE__ */ p(Dt, { node: s, store: e }) }, a);
1208
- return c <= 0 ? f : /* @__PURE__ */ p(pt.Provider, { value: c, children: f }, a);
1209
- }) });
1210
- }
1211
- function sn(t, e, n) {
1212
- const r = { ...t.props ?? {} };
1213
- if (t.bindings)
1214
- for (const [i, s] of Object.entries(t.bindings)) {
1215
- const o = L(n, s);
1216
- r[i] = e.signal(o).value;
1217
- }
1218
- return r;
1219
- }
1220
- function an(t, e, n) {
1221
- if (!t.bindings) return [];
1222
- const r = [];
1223
- for (const i of Object.values(t.bindings))
1224
- r.push(e.signal(L(n, i)).value);
1225
- return r;
1226
- }
1227
- export {
1228
- Dt as T
1229
- };
1230
- //# sourceMappingURL=tree-DBj9SJgs.js.map