@elucim/dsl 0.7.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.
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { easeOutBounce as he, easeOutElastic as fe, easeOutBack as oe, easeInBack as ge, easeInOutExpo as me, easeOutExpo as ye, easeInExpo as be, easeInOutSine as xe, easeOutSine as ve, easeInSine as de, easeInOutQuart as we, easeOutQuart as ke, easeInQuart as Ie, easeInOutCubic as Se, easeOutCubic as $e, easeInCubic as Oe, easeInOutQuad as Ae, easeOutQuad as Ce, easeInQuad as ze, linear as pe, spring as Ee, cubicBezier as Re, Presentation as Fe, Scene as Pe, Player as Te, Slide as Me, Parallel as Ne, Stagger as _e, Morph as De, Transform as We, Write as Ve, Draw as Le, FadeOut as je, FadeIn as qe, BarChart as Be, LaTeX as Ue, Graph as He, Matrix as Ge, Text as L, VectorField as Ke, Vector as Qe, FunctionPlot as Xe, Axes as Je, Image as Ye, Polygon as Ze, Rect as et, Arrow as tt, Line as at, Circle as rt, BezierCurve as it, Group as nt, Sequence as st } from "@elucim/core";
2
- import { jsx as c, jsxs as R } from "react/jsx-runtime";
3
- import Q, { forwardRef as ct, useRef as lt, useImperativeHandle as ut, useSyncExternalStore as ht } from "react";
4
- import { renderToStaticMarkup as ft } from "react-dom/server";
5
- const B = {
1
+ import { easeOutBounce as fe, easeOutElastic as ge, easeOutBack as oe, easeInBack as me, easeInOutExpo as ye, easeOutExpo as be, easeInExpo as xe, easeInOutSine as de, easeOutSine as ve, easeInSine as we, easeInOutQuart as ke, easeOutQuart as Ie, easeInQuart as Se, easeInOutCubic as $e, easeOutCubic as Oe, easeInCubic as Ce, easeInOutQuad as Ae, easeOutQuad as ze, easeInQuad as pe, linear as Ee, spring as Fe, cubicBezier as Re, Presentation as Pe, Scene as Me, Player as Te, Slide as Ne, Parallel as We, Stagger as De, Morph as _e, Transform as Ve, Write as Le, Draw as je, FadeOut as Be, FadeIn as qe, BarChart as Ue, LaTeX as Ge, Graph as He, Matrix as Ke, Text as j, VectorField as Qe, Vector as Xe, FunctionPlot as Je, Axes as Ye, Image as Ze, Polygon as et, Rect as tt, Arrow as at, Line as rt, Circle as it, BezierCurve as nt, Group as st, Sequence as ct } from "@elucim/core";
2
+ import { jsx as l, jsxs as R } from "react/jsx-runtime";
3
+ import X, { forwardRef as lt, useRef as ut, useImperativeHandle as ht, useSyncExternalStore as ft } from "react";
4
+ import { renderToStaticMarkup as gt } from "react-dom/server";
5
+ const U = {
6
6
  sin: Math.sin,
7
7
  cos: Math.cos,
8
8
  tan: Math.tan,
@@ -22,12 +22,12 @@ const B = {
22
22
  max: (...e) => Math.max(...e),
23
23
  sign: Math.sign,
24
24
  pow: Math.pow
25
- }, X = {
25
+ }, J = {
26
26
  PI: Math.PI,
27
27
  E: Math.E,
28
28
  TAU: Math.PI * 2
29
29
  };
30
- function G(e) {
30
+ function K(e) {
31
31
  const a = [];
32
32
  let t = 0;
33
33
  for (; t < e.length; ) {
@@ -85,12 +85,12 @@ function G(e) {
85
85
  a.push({ type: "COMMA", value: ",", pos: i });
86
86
  break;
87
87
  default:
88
- throw new S(`Unexpected character '${r}'`, i);
88
+ throw new A(`Unexpected character '${r}'`, i);
89
89
  }
90
90
  }
91
91
  return a.push({ type: "EOF", value: "", pos: t }), a;
92
92
  }
93
- class K {
93
+ class Q {
94
94
  constructor(a) {
95
95
  this.pos = 0, this.tokens = a;
96
96
  }
@@ -104,7 +104,7 @@ class K {
104
104
  expect(a) {
105
105
  const t = this.peek();
106
106
  if (t.type !== a)
107
- throw new S(
107
+ throw new A(
108
108
  `Expected ${a} but got ${t.type} ('${t.value}')`,
109
109
  t.pos
110
110
  );
@@ -115,7 +115,7 @@ class K {
115
115
  const a = this.parseExpression();
116
116
  if (this.peek().type !== "EOF") {
117
117
  const t = this.peek();
118
- throw new S(
118
+ throw new A(
119
119
  `Unexpected token '${t.value}' after expression`,
120
120
  t.pos
121
121
  );
@@ -168,14 +168,14 @@ class K {
168
168
  if (this.peek().type !== "RPAREN")
169
169
  for (r.push(this.parseExpression()); this.peek().type === "COMMA"; )
170
170
  this.advance(), r.push(this.parseExpression());
171
- if (this.expect("RPAREN"), !Object.prototype.hasOwnProperty.call(B, t))
172
- throw new S(
173
- `Unknown function '${t}'. Available: ${Object.keys(B).join(", ")}`,
171
+ if (this.expect("RPAREN"), !Object.prototype.hasOwnProperty.call(U, t))
172
+ throw new A(
173
+ `Unknown function '${t}'. Available: ${Object.keys(U).join(", ")}`,
174
174
  a.pos
175
175
  );
176
176
  return { kind: "call", name: t, args: r };
177
177
  }
178
- return Object.prototype.hasOwnProperty.call(X, t) ? { kind: "number", value: X[t] } : { kind: "variable", name: t };
178
+ return Object.prototype.hasOwnProperty.call(J, t) ? { kind: "number", value: J[t] } : { kind: "variable", name: t };
179
179
  }
180
180
  if (a.type === "LPAREN") {
181
181
  this.advance();
@@ -190,24 +190,24 @@ class K {
190
190
  this.advance(), t.push(this.parseExpression());
191
191
  return this.expect("RBRACKET"), { kind: "array", elements: t };
192
192
  }
193
- throw new S(
193
+ throw new A(
194
194
  `Unexpected token '${a.value}'`,
195
195
  a.pos
196
196
  );
197
197
  }
198
198
  }
199
- function z(e, a) {
199
+ function E(e, a) {
200
200
  switch (e.kind) {
201
201
  case "number":
202
202
  return e.value;
203
203
  case "variable":
204
204
  if (Object.prototype.hasOwnProperty.call(a, e.name)) return a[e.name];
205
- throw new S(`Unknown variable '${e.name}'`, 0);
205
+ throw new A(`Unknown variable '${e.name}'`, 0);
206
206
  case "unary":
207
- const t = z(e.operand, a);
207
+ const t = E(e.operand, a);
208
208
  return e.op === "-" ? -t : t;
209
209
  case "binary": {
210
- const r = z(e.left, a), i = z(e.right, a);
210
+ const r = E(e.left, a), i = E(e.right, a);
211
211
  switch (e.op) {
212
212
  case "+":
213
213
  return r + i;
@@ -223,74 +223,74 @@ function z(e, a) {
223
223
  break;
224
224
  }
225
225
  case "call": {
226
- const r = B[e.name], i = e.args.map((n) => z(n, a));
226
+ const r = U[e.name], i = e.args.map((n) => E(n, a));
227
227
  return r(...i);
228
228
  }
229
229
  case "array":
230
- return e.elements.map((r) => z(r, a));
230
+ return e.elements.map((r) => E(r, a));
231
231
  }
232
- throw new S("Invalid AST node", 0);
232
+ throw new A("Invalid AST node", 0);
233
233
  }
234
- class S extends Error {
234
+ class A extends Error {
235
235
  constructor(a, t) {
236
236
  super(a), this.name = "ExpressionError", this.position = t;
237
237
  }
238
238
  }
239
239
  function ot(e) {
240
- const a = G(e), t = new K(a).parse();
241
- return (r) => z(t, r);
240
+ const a = K(e), t = new Q(a).parse();
241
+ return (r) => E(t, r);
242
242
  }
243
- function gt(e) {
244
- const a = G(e), t = new K(a).parse();
243
+ function mt(e) {
244
+ const a = K(e), t = new Q(a).parse();
245
245
  if (t.kind !== "array" || t.elements.length !== 2)
246
- throw new S(
246
+ throw new A(
247
247
  'Vector expression must be an array of 2 elements, e.g. "[-y, x]"',
248
248
  0
249
249
  );
250
- return (r) => z(t, r);
250
+ return (r) => E(t, r);
251
251
  }
252
- function ee(e) {
252
+ function te(e) {
253
253
  try {
254
- const a = G(e);
255
- return new K(a).parse(), null;
254
+ const a = K(e);
255
+ return new Q(a).parse(), null;
256
256
  } catch (a) {
257
- return a instanceof S ? `${a.message} (at position ${a.position})` : String(a);
257
+ return a instanceof A ? `${a.message} (at position ${a.position})` : String(a);
258
258
  }
259
259
  }
260
- const U = {
261
- linear: pe,
262
- easeInQuad: ze,
263
- easeOutQuad: Ce,
260
+ const G = {
261
+ linear: Ee,
262
+ easeInQuad: pe,
263
+ easeOutQuad: ze,
264
264
  easeInOutQuad: Ae,
265
- easeInCubic: Oe,
266
- easeOutCubic: $e,
267
- easeInOutCubic: Se,
268
- easeInQuart: Ie,
269
- easeOutQuart: ke,
270
- easeInOutQuart: we,
271
- easeInSine: de,
265
+ easeInCubic: Ce,
266
+ easeOutCubic: Oe,
267
+ easeInOutCubic: $e,
268
+ easeInQuart: Se,
269
+ easeOutQuart: Ie,
270
+ easeInOutQuart: ke,
271
+ easeInSine: we,
272
272
  easeOutSine: ve,
273
- easeInOutSine: xe,
274
- easeInExpo: be,
275
- easeOutExpo: ye,
276
- easeInOutExpo: me,
277
- easeInBack: ge,
273
+ easeInOutSine: de,
274
+ easeInExpo: xe,
275
+ easeOutExpo: be,
276
+ easeInOutExpo: ye,
277
+ easeInBack: me,
278
278
  easeOutBack: oe,
279
- easeOutElastic: fe,
280
- easeOutBounce: he
279
+ easeOutElastic: ge,
280
+ easeOutBounce: fe
281
281
  };
282
- function o(e) {
282
+ function g(e) {
283
283
  if (e !== void 0) {
284
284
  if (typeof e == "string") {
285
- const a = U[e];
285
+ const a = G[e];
286
286
  if (!a) {
287
- const t = Object.keys(U), r = t.find((n) => n.toLowerCase() === e.toLowerCase()), i = r ? ` Did you mean '${r}'?` : "";
287
+ const t = Object.keys(G), r = t.find((n) => n.toLowerCase() === e.toLowerCase()), i = r ? ` Did you mean '${r}'?` : "";
288
288
  throw new Error(`Unknown easing '${e}'.${i} Available: ${t.join(", ")}`);
289
289
  }
290
290
  return a;
291
291
  }
292
292
  if (e.type === "spring")
293
- return Ee({
293
+ return Fe({
294
294
  stiffness: e.stiffness,
295
295
  damping: e.damping,
296
296
  mass: e.mass
@@ -300,18 +300,18 @@ function o(e) {
300
300
  throw new Error(`Unknown easing type: ${e.type}`);
301
301
  }
302
302
  }
303
- const j = Object.keys(U);
304
- function te(e) {
303
+ const B = Object.keys(G);
304
+ function ae(e) {
305
305
  const a = [];
306
306
  if (!e || typeof e != "object")
307
307
  return a.push({ path: "", message: "Document must be an object", severity: "error" }), { valid: !1, errors: a };
308
308
  const t = e;
309
- return t.version !== "1.0" && a.push({ path: "version", message: `Expected version "1.0", got "${t.version}"`, severity: "error" }), !t.root || typeof t.root != "object" ? (a.push({ path: "root", message: 'Missing or invalid "root" node', severity: "error" }), { valid: a.filter((r) => r.severity === "error").length === 0, errors: a }) : (mt(t.root, "root", a), {
309
+ return t.version !== "1.0" && a.push({ path: "version", message: `Expected version "1.0", got "${t.version}"`, severity: "error" }), !t.root || typeof t.root != "object" ? (a.push({ path: "root", message: 'Missing or invalid "root" node', severity: "error" }), { valid: a.filter((r) => r.severity === "error").length === 0, errors: a }) : (yt(t.root, "root", a), {
310
310
  valid: a.filter((r) => r.severity === "error").length === 0,
311
311
  errors: a
312
312
  });
313
313
  }
314
- const J = ["scene", "player", "presentation"], D = ["card", "slide", "square"], q = [
314
+ const Y = ["scene", "player", "presentation"], _ = ["card", "slide", "square"], q = [
315
315
  "sequence",
316
316
  "group",
317
317
  "bezierCurve",
@@ -340,57 +340,57 @@ const J = ["scene", "player", "presentation"], D = ["card", "slide", "square"],
340
340
  "parallel",
341
341
  "player",
342
342
  "scene"
343
- ], Y = ["none", "fade", "slide-left", "slide-up", "zoom"];
344
- function mt(e, a, t) {
343
+ ], Z = ["none", "fade", "slide-left", "slide-up", "zoom"];
344
+ function yt(e, a, t) {
345
345
  const r = e.type;
346
- if (!J.includes(r)) {
347
- t.push({ path: `${a}.type`, message: `Root type must be one of: ${J.join(", ")}. Got "${r}"`, severity: "error" });
346
+ if (!Y.includes(r)) {
347
+ t.push({ path: `${a}.type`, message: `Root type must be one of: ${Y.join(", ")}. Got "${r}"`, severity: "error" });
348
348
  return;
349
349
  }
350
- r === "scene" || r === "player" ? ae(e, a, r, t) : r === "presentation" && yt(e, a, t);
350
+ r === "scene" || r === "player" ? re(e, a, r, t) : r === "presentation" && bt(e, a, t);
351
351
  }
352
- function ae(e, a, t, r) {
353
- Lt(e, "durationInFrames", a, r), g(e, "width", a, r), g(e, "height", a, r), g(e, "fps", a, r), A(e, "background", a, r), e.preset !== void 0 && (typeof e.preset != "string" || !D.includes(e.preset)) && r.push({ path: `${a}.preset`, message: `preset must be one of: ${D.join(", ")}. Got "${e.preset}"`, severity: "error" }), t === "player" && (N(e, "controls", a, r), N(e, "loop", a, r), N(e, "autoPlay", a, r)), C(e, a, r);
352
+ function re(e, a, t, r) {
353
+ jt(e, "durationInFrames", a, r), b(e, "width", a, r), b(e, "height", a, r), b(e, "fps", a, r), z(e, "background", a, r), e.preset !== void 0 && (typeof e.preset != "string" || !_.includes(e.preset)) && r.push({ path: `${a}.preset`, message: `preset must be one of: ${_.join(", ")}. Got "${e.preset}"`, severity: "error" }), t === "player" && (W(e, "controls", a, r), W(e, "loop", a, r), W(e, "autoPlay", a, r)), p(e, a, r);
354
354
  }
355
- function yt(e, a, t) {
356
- if (g(e, "width", a, t), g(e, "height", a, t), A(e, "background", a, t), g(e, "transitionDuration", a, t), N(e, "showHud", a, t), N(e, "showNotes", a, t), e.preset !== void 0 && (typeof e.preset != "string" || !D.includes(e.preset)) && t.push({ path: `${a}.preset`, message: `preset must be one of: ${D.join(", ")}. Got "${e.preset}"`, severity: "error" }), e.transition !== void 0 && (Y.includes(e.transition) || t.push({
355
+ function bt(e, a, t) {
356
+ if (b(e, "width", a, t), b(e, "height", a, t), z(e, "background", a, t), b(e, "transitionDuration", a, t), W(e, "showHud", a, t), W(e, "showNotes", a, t), e.preset !== void 0 && (typeof e.preset != "string" || !_.includes(e.preset)) && t.push({ path: `${a}.preset`, message: `preset must be one of: ${_.join(", ")}. Got "${e.preset}"`, severity: "error" }), e.transition !== void 0 && (Z.includes(e.transition) || t.push({
357
357
  path: `${a}.transition`,
358
- message: `Invalid transition "${e.transition}". Must be one of: ${Y.join(", ")}`,
358
+ message: `Invalid transition "${e.transition}". Must be one of: ${Z.join(", ")}`,
359
359
  severity: "error"
360
360
  })), !Array.isArray(e.slides)) {
361
361
  t.push({ path: `${a}.slides`, message: 'Presentation must have a "slides" array', severity: "error" });
362
362
  return;
363
363
  }
364
364
  e.slides.length === 0 && t.push({ path: `${a}.slides`, message: "Presentation must have at least one slide", severity: "warning" }), e.slides.forEach((r, i) => {
365
- bt(r, `${a}.slides[${i}]`, t);
365
+ xt(r, `${a}.slides[${i}]`, t);
366
366
  });
367
367
  }
368
- function bt(e, a, t) {
368
+ function xt(e, a, t) {
369
369
  if (!e || typeof e != "object") {
370
370
  t.push({ path: a, message: "Slide must be an object", severity: "error" });
371
371
  return;
372
372
  }
373
- A(e, "title", a, t), A(e, "notes", a, t), A(e, "background", a, t), e.children !== void 0 && (Array.isArray(e.children) ? e.children.forEach((r, i) => {
374
- re(r, `${a}.children[${i}]`, t);
373
+ z(e, "title", a, t), z(e, "notes", a, t), z(e, "background", a, t), e.children !== void 0 && (Array.isArray(e.children) ? e.children.forEach((r, i) => {
374
+ ie(r, `${a}.children[${i}]`, t);
375
375
  }) : t.push({ path: `${a}.children`, message: "Slide children must be an array", severity: "error" }));
376
376
  }
377
- function C(e, a, t) {
377
+ function p(e, a, t) {
378
378
  if (!Array.isArray(e.children)) {
379
379
  t.push({ path: `${a}.children`, message: 'Expected "children" array', severity: "error" });
380
380
  return;
381
381
  }
382
382
  e.children.forEach((r, i) => {
383
- re(r, `${a}.children[${i}]`, t);
383
+ ie(r, `${a}.children[${i}]`, t);
384
384
  });
385
385
  }
386
- function re(e, a, t) {
386
+ function ie(e, a, t) {
387
387
  if (!e || typeof e != "object") {
388
388
  t.push({ path: a, message: "Element must be an object", severity: "error" });
389
389
  return;
390
390
  }
391
391
  const r = e.type;
392
392
  if (!r || !q.includes(r)) {
393
- const i = r ? ie(r, q) : "";
393
+ const i = r ? ne(r, q) : "";
394
394
  t.push({
395
395
  path: `${a}.type`,
396
396
  message: `Unknown element type "${r}".${i} Valid types: ${q.join(", ")}`,
@@ -400,136 +400,136 @@ function re(e, a, t) {
400
400
  }
401
401
  switch (r) {
402
402
  case "bezierCurve":
403
- xt(e, a, t);
403
+ dt(e, a, t);
404
404
  break;
405
405
  case "circle":
406
406
  vt(e, a, t);
407
407
  break;
408
408
  case "line":
409
- dt(e, a, t);
409
+ wt(e, a, t);
410
410
  break;
411
411
  case "arrow":
412
- wt(e, a, t);
412
+ kt(e, a, t);
413
413
  break;
414
414
  case "rect":
415
- kt(e, a, t);
415
+ It(e, a, t);
416
416
  break;
417
417
  case "polygon":
418
- It(e, a, t);
418
+ St(e, a, t);
419
419
  break;
420
420
  case "text":
421
- St(e, a, t);
421
+ $t(e, a, t);
422
422
  break;
423
423
  case "image":
424
- Dt(e, a, t);
424
+ _t(e, a, t);
425
425
  break;
426
426
  case "axes":
427
- $t(e, a, t);
427
+ Ot(e, a, t);
428
428
  break;
429
429
  case "functionPlot":
430
- Ot(e, a, t);
430
+ Ct(e, a, t);
431
431
  break;
432
432
  case "vector":
433
433
  At(e, a, t);
434
434
  break;
435
435
  case "vectorField":
436
- Ct(e, a, t);
436
+ zt(e, a, t);
437
437
  break;
438
438
  case "matrix":
439
- zt(e, a, t);
439
+ pt(e, a, t);
440
440
  break;
441
441
  case "graph":
442
- pt(e, a, t);
442
+ Et(e, a, t);
443
443
  break;
444
444
  case "latex":
445
- Et(e, a, t);
445
+ Ft(e, a, t);
446
446
  break;
447
447
  case "barChart":
448
- Vt(e, a, t);
448
+ Lt(e, a, t);
449
449
  break;
450
450
  case "sequence":
451
451
  Rt(e, a, t);
452
452
  break;
453
453
  case "group":
454
- Wt(e, a, t);
454
+ Vt(e, a, t);
455
455
  break;
456
456
  case "parallel":
457
- C(e, a, t);
457
+ p(e, a, t);
458
458
  break;
459
459
  case "fadeIn":
460
460
  case "fadeOut":
461
461
  case "draw":
462
462
  case "write":
463
- Ft(e, a, t);
463
+ Pt(e, a, t);
464
464
  break;
465
465
  case "transform":
466
- Pt(e, a, t);
466
+ Mt(e, a, t);
467
467
  break;
468
468
  case "morph":
469
469
  Tt(e, a, t);
470
470
  break;
471
471
  case "stagger":
472
- Mt(e, a, t);
472
+ Nt(e, a, t);
473
473
  break;
474
474
  case "scene":
475
475
  case "player":
476
- ae(e, a, r, t);
476
+ re(e, a, r, t);
477
477
  break;
478
478
  }
479
479
  }
480
- function xt(e, a, t) {
481
- h(e, "x1", a, t), h(e, "y1", a, t), h(e, "cx1", a, t), h(e, "cy1", a, t), h(e, "x2", a, t), h(e, "y2", a, t), e.cx2 !== void 0 && F(e, "cx2", a, t), e.cy2 !== void 0 && F(e, "cy2", a, t), v(e, a, t);
480
+ function dt(e, a, t) {
481
+ h(e, "x1", a, t), h(e, "y1", a, t), h(e, "cx1", a, t), h(e, "cy1", a, t), h(e, "x2", a, t), h(e, "y2", a, t), e.cx2 !== void 0 && P(e, "cx2", a, t), e.cy2 !== void 0 && P(e, "cy2", a, t), w(e, a, t);
482
482
  }
483
483
  function vt(e, a, t) {
484
- h(e, "cx", a, t), h(e, "cy", a, t), p(e, "r", a, t), v(e, a, t);
485
- }
486
- function dt(e, a, t) {
487
- h(e, "x1", a, t), h(e, "y1", a, t), h(e, "x2", a, t), h(e, "y2", a, t), v(e, a, t);
484
+ h(e, "cx", a, t), h(e, "cy", a, t), F(e, "r", a, t), w(e, a, t);
488
485
  }
489
486
  function wt(e, a, t) {
490
- h(e, "x1", a, t), h(e, "y1", a, t), h(e, "x2", a, t), h(e, "y2", a, t), v(e, a, t);
487
+ h(e, "x1", a, t), h(e, "y1", a, t), h(e, "x2", a, t), h(e, "y2", a, t), w(e, a, t);
491
488
  }
492
489
  function kt(e, a, t) {
493
- h(e, "x", a, t), h(e, "y", a, t), p(e, "width", a, t), p(e, "height", a, t), v(e, a, t);
490
+ h(e, "x1", a, t), h(e, "y1", a, t), h(e, "x2", a, t), h(e, "y2", a, t), w(e, a, t);
494
491
  }
495
492
  function It(e, a, t) {
496
- Array.isArray(e.points) ? e.points.length < 3 ? t.push({ path: `${a}.points`, message: "Polygon requires at least 3 points", severity: "error" }) : e.points.forEach((r, i) => {
497
- (!Array.isArray(r) || r.length !== 2 || typeof r[0] != "number" || typeof r[1] != "number") && t.push({ path: `${a}.points[${i}]`, message: "Each point must be [number, number]", severity: "error" });
498
- }) : t.push({ path: `${a}.points`, message: 'Polygon requires a "points" array', severity: "error" }), v(e, a, t);
493
+ h(e, "x", a, t), h(e, "y", a, t), F(e, "width", a, t), F(e, "height", a, t), w(e, a, t);
499
494
  }
500
495
  function St(e, a, t) {
501
- h(e, "x", a, t), h(e, "y", a, t), typeof e.content != "string" && t.push({ path: `${a}.content`, message: 'Text requires a "content" string', severity: "error" }), v(e, a, t);
496
+ Array.isArray(e.points) ? e.points.length < 3 ? t.push({ path: `${a}.points`, message: "Polygon requires at least 3 points", severity: "error" }) : e.points.forEach((r, i) => {
497
+ (!Array.isArray(r) || r.length !== 2 || typeof r[0] != "number" || typeof r[1] != "number") && t.push({ path: `${a}.points[${i}]`, message: "Each point must be [number, number]", severity: "error" });
498
+ }) : t.push({ path: `${a}.points`, message: 'Polygon requires a "points" array', severity: "error" }), w(e, a, t);
502
499
  }
503
500
  function $t(e, a, t) {
504
- k(e, "domain", a, t), k(e, "range", a, t), k(e, "origin", a, t), W(e, a, t);
501
+ h(e, "x", a, t), h(e, "y", a, t), typeof e.content != "string" && t.push({ path: `${a}.content`, message: 'Text requires a "content" string', severity: "error" }), w(e, a, t);
505
502
  }
506
503
  function Ot(e, a, t) {
504
+ S(e, "domain", a, t), S(e, "range", a, t), S(e, "origin", a, t), V(e, a, t);
505
+ }
506
+ function Ct(e, a, t) {
507
507
  if (typeof e.fn != "string")
508
508
  t.push({ path: `${a}.fn`, message: 'FunctionPlot requires a "fn" expression string', severity: "error" });
509
509
  else {
510
- const r = ee(e.fn);
510
+ const r = te(e.fn);
511
511
  r && t.push({ path: `${a}.fn`, message: `Invalid expression: ${r}`, severity: "error" });
512
512
  }
513
- k(e, "domain", a, t), W(e, a, t);
513
+ S(e, "domain", a, t), V(e, a, t);
514
514
  }
515
515
  function At(e, a, t) {
516
- (!Array.isArray(e.to) || e.to.length !== 2) && t.push({ path: `${a}.to`, message: 'Vector requires a "to" array of [number, number]', severity: "error" }), k(e, "from", a, t), W(e, a, t);
516
+ (!Array.isArray(e.to) || e.to.length !== 2) && t.push({ path: `${a}.to`, message: 'Vector requires a "to" array of [number, number]', severity: "error" }), S(e, "from", a, t), V(e, a, t);
517
517
  }
518
- function Ct(e, a, t) {
518
+ function zt(e, a, t) {
519
519
  if (typeof e.fn != "string")
520
520
  t.push({ path: `${a}.fn`, message: 'VectorField requires a "fn" expression string', severity: "error" });
521
521
  else {
522
- const r = ee(e.fn);
522
+ const r = te(e.fn);
523
523
  r && t.push({ path: `${a}.fn`, message: `Invalid vector expression: ${r}`, severity: "error" });
524
524
  }
525
- k(e, "domain", a, t), k(e, "range", a, t), W(e, a, t);
525
+ S(e, "domain", a, t), S(e, "range", a, t), V(e, a, t);
526
526
  }
527
- function zt(e, a, t) {
527
+ function pt(e, a, t) {
528
528
  Array.isArray(e.values) ? e.values.forEach((r, i) => {
529
529
  Array.isArray(r) || t.push({ path: `${a}.values[${i}]`, message: "Each matrix row must be an array", severity: "error" });
530
- }) : t.push({ path: `${a}.values`, message: 'Matrix requires a "values" 2D array', severity: "error" }), v(e, a, t);
530
+ }) : t.push({ path: `${a}.values`, message: 'Matrix requires a "values" 2D array', severity: "error" }), w(e, a, t);
531
531
  }
532
- function pt(e, a, t) {
532
+ function Et(e, a, t) {
533
533
  if (!Array.isArray(e.nodes))
534
534
  t.push({ path: `${a}.nodes`, message: 'Graph requires a "nodes" array', severity: "error" });
535
535
  else {
@@ -540,19 +540,19 @@ function pt(e, a, t) {
540
540
  (typeof i.from != "string" || !r.has(i.from)) && t.push({ path: `${a}.edges[${n}].from`, message: `Edge "from" references unknown node "${i.from}"`, severity: "error" }), (typeof i.to != "string" || !r.has(i.to)) && t.push({ path: `${a}.edges[${n}].to`, message: `Edge "to" references unknown node "${i.to}"`, severity: "error" });
541
541
  });
542
542
  }
543
- v(e, a, t);
543
+ w(e, a, t);
544
544
  }
545
- function Et(e, a, t) {
546
- typeof e.expression != "string" && t.push({ path: `${a}.expression`, message: 'LaTeX requires an "expression" string', severity: "error" }), h(e, "x", a, t), h(e, "y", a, t), v(e, a, t);
545
+ function Ft(e, a, t) {
546
+ typeof e.expression != "string" && t.push({ path: `${a}.expression`, message: 'LaTeX requires an "expression" string', severity: "error" }), h(e, "x", a, t), h(e, "y", a, t), w(e, a, t);
547
547
  }
548
548
  function Rt(e, a, t) {
549
- h(e, "from", a, t), jt(e, "durationInFrames", a, t), C(e, a, t);
550
- }
551
- function Ft(e, a, t) {
552
- g(e, "duration", a, t), P(e, a, t), C(e, a, t);
549
+ h(e, "from", a, t), Bt(e, "durationInFrames", a, t), p(e, a, t);
553
550
  }
554
551
  function Pt(e, a, t) {
555
- if (g(e, "duration", a, t), P(e, a, t), e.translate !== void 0) {
552
+ b(e, "duration", a, t), M(e, a, t), p(e, a, t);
553
+ }
554
+ function Mt(e, a, t) {
555
+ if (b(e, "duration", a, t), M(e, a, t), e.translate !== void 0) {
556
556
  const r = e.translate;
557
557
  (!r || typeof r != "object") && t.push({ path: `${a}.translate`, message: "translate must be { from: [x,y], to: [x,y] }", severity: "error" });
558
558
  }
@@ -568,51 +568,51 @@ function Pt(e, a, t) {
568
568
  const r = e.opacity;
569
569
  (!r || typeof r != "object" || typeof r.from != "number" || typeof r.to != "number") && t.push({ path: `${a}.opacity`, message: "opacity must be { from: number, to: number }", severity: "error" });
570
570
  }
571
- C(e, a, t);
571
+ p(e, a, t);
572
572
  }
573
573
  function Tt(e, a, t) {
574
- g(e, "duration", a, t), P(e, a, t), A(e, "fromColor", a, t), A(e, "toColor", a, t), C(e, a, t);
574
+ b(e, "duration", a, t), M(e, a, t), z(e, "fromColor", a, t), z(e, "toColor", a, t), p(e, a, t);
575
575
  }
576
- function Mt(e, a, t) {
577
- g(e, "staggerDelay", a, t), P(e, a, t), C(e, a, t);
576
+ function Nt(e, a, t) {
577
+ b(e, "staggerDelay", a, t), M(e, a, t), p(e, a, t);
578
578
  }
579
- function v(e, a, t) {
580
- g(e, "fadeIn", a, t), g(e, "fadeOut", a, t), g(e, "draw", a, t), P(e, a, t), Nt(e, a, t);
579
+ function w(e, a, t) {
580
+ b(e, "fadeIn", a, t), b(e, "fadeOut", a, t), b(e, "draw", a, t), M(e, a, t), Wt(e, a, t);
581
581
  }
582
- function W(e, a, t) {
583
- g(e, "fadeIn", a, t), g(e, "fadeOut", a, t), g(e, "draw", a, t), P(e, a, t), _t(e, a, t);
582
+ function V(e, a, t) {
583
+ b(e, "fadeIn", a, t), b(e, "fadeOut", a, t), b(e, "draw", a, t), M(e, a, t), Dt(e, a, t);
584
584
  }
585
- const Z = ["none", "circle", "ellipse"];
586
- function Nt(e, a, t) {
587
- if (F(e, "rotation", a, t), k(e, "rotationOrigin", a, t), k(e, "translate", a, t), F(e, "zIndex", a, t), e.scale !== void 0) {
585
+ const ee = ["none", "circle", "ellipse"];
586
+ function Wt(e, a, t) {
587
+ if (P(e, "rotation", a, t), S(e, "rotationOrigin", a, t), S(e, "translate", a, t), P(e, "zIndex", a, t), e.scale !== void 0) {
588
588
  const r = e.scale;
589
589
  typeof r == "number" || Array.isArray(r) && r.length === 2 && typeof r[0] == "number" && typeof r[1] == "number" || t.push({ path: `${a}.scale`, message: '"scale" must be a number or [number, number]', severity: "error" });
590
590
  }
591
591
  }
592
- function _t(e, a, t) {
593
- F(e, "rotation", a, t), k(e, "rotationOrigin", a, t), k(e, "translate", a, t), F(e, "zIndex", a, t);
594
- }
595
592
  function Dt(e, a, t) {
596
- typeof e.src != "string" && t.push({ path: `${a}.src`, message: 'Image requires a "src" string', severity: "error" }), h(e, "x", a, t), h(e, "y", a, t), p(e, "width", a, t), p(e, "height", a, t), A(e, "preserveAspectRatio", a, t), e.borderRadius !== void 0 && (typeof e.borderRadius != "number" || e.borderRadius < 0) && t.push({ path: `${a}.borderRadius`, message: '"borderRadius" must be a number >= 0', severity: "error" }), e.clipShape !== void 0 && (Z.includes(e.clipShape) || t.push({
593
+ P(e, "rotation", a, t), S(e, "rotationOrigin", a, t), S(e, "translate", a, t), P(e, "zIndex", a, t);
594
+ }
595
+ function _t(e, a, t) {
596
+ typeof e.src != "string" && t.push({ path: `${a}.src`, message: 'Image requires a "src" string', severity: "error" }), h(e, "x", a, t), h(e, "y", a, t), F(e, "width", a, t), F(e, "height", a, t), z(e, "preserveAspectRatio", a, t), e.borderRadius !== void 0 && (typeof e.borderRadius != "number" || e.borderRadius < 0) && t.push({ path: `${a}.borderRadius`, message: '"borderRadius" must be a number >= 0', severity: "error" }), e.clipShape !== void 0 && (ee.includes(e.clipShape) || t.push({
597
597
  path: `${a}.clipShape`,
598
- message: `Invalid clipShape "${e.clipShape}". Must be one of: ${Z.join(", ")}`,
598
+ message: `Invalid clipShape "${e.clipShape}". Must be one of: ${ee.join(", ")}`,
599
599
  severity: "error"
600
- })), v(e, a, t);
601
- }
602
- function Wt(e, a, t) {
603
- C(e, a, t), v(e, a, t);
600
+ })), w(e, a, t);
604
601
  }
605
602
  function Vt(e, a, t) {
606
- h(e, "x", a, t), h(e, "y", a, t), p(e, "width", a, t), p(e, "height", a, t), Array.isArray(e.bars) || t.push({ path: `${a}.bars`, message: 'BarChart requires a "bars" array', severity: "error" }), v(e, a, t);
603
+ p(e, a, t), w(e, a, t);
604
+ }
605
+ function Lt(e, a, t) {
606
+ h(e, "x", a, t), h(e, "y", a, t), F(e, "width", a, t), F(e, "height", a, t), Array.isArray(e.bars) || t.push({ path: `${a}.bars`, message: 'BarChart requires a "bars" array', severity: "error" }), w(e, a, t);
607
607
  }
608
- function P(e, a, t) {
608
+ function M(e, a, t) {
609
609
  if (e.easing !== void 0) {
610
610
  if (typeof e.easing == "string") {
611
- if (!j.includes(e.easing)) {
612
- const r = ie(e.easing, j);
611
+ if (!B.includes(e.easing)) {
612
+ const r = ne(e.easing, B);
613
613
  t.push({
614
614
  path: `${a}.easing`,
615
- message: `Unknown easing "${e.easing}".${r} Available: ${j.join(", ")}`,
615
+ message: `Unknown easing "${e.easing}".${r} Available: ${B.join(", ")}`,
616
616
  severity: "error"
617
617
  });
618
618
  }
@@ -635,40 +635,40 @@ function P(e, a, t) {
635
635
  function h(e, a, t, r) {
636
636
  typeof e[a] != "number" && r.push({ path: `${t}.${a}`, message: `Required numeric field "${a}" is missing or not a number`, severity: "error" });
637
637
  }
638
- function p(e, a, t, r) {
638
+ function F(e, a, t, r) {
639
639
  (typeof e[a] != "number" || e[a] <= 0) && r.push({ path: `${t}.${a}`, message: `"${a}" must be a positive number`, severity: "error" });
640
640
  }
641
- function Lt(e, a, t, r) {
641
+ function jt(e, a, t, r) {
642
642
  const i = e[a];
643
643
  (typeof i != "number" || i <= 0 || !Number.isInteger(i)) && r.push({ path: `${t}.${a}`, message: `"${a}" must be a positive integer`, severity: "error" });
644
644
  }
645
- function g(e, a, t, r) {
645
+ function b(e, a, t, r) {
646
646
  e[a] !== void 0 && (typeof e[a] != "number" || e[a] <= 0) && r.push({ path: `${t}.${a}`, message: `"${a}" must be a positive number`, severity: "error" });
647
647
  }
648
- function jt(e, a, t, r) {
648
+ function Bt(e, a, t, r) {
649
649
  const i = e[a];
650
650
  i !== void 0 && (typeof i != "number" || i <= 0 || !Number.isInteger(i)) && r.push({ path: `${t}.${a}`, message: `"${a}" must be a positive integer`, severity: "error" });
651
651
  }
652
- function A(e, a, t, r) {
652
+ function z(e, a, t, r) {
653
653
  e[a] !== void 0 && typeof e[a] != "string" && r.push({ path: `${t}.${a}`, message: `"${a}" must be a string`, severity: "error" });
654
654
  }
655
- function F(e, a, t, r) {
655
+ function P(e, a, t, r) {
656
656
  e[a] !== void 0 && typeof e[a] != "number" && r.push({ path: `${t}.${a}`, message: `"${a}" must be a number`, severity: "error" });
657
657
  }
658
- function N(e, a, t, r) {
658
+ function W(e, a, t, r) {
659
659
  e[a] !== void 0 && typeof e[a] != "boolean" && r.push({ path: `${t}.${a}`, message: `"${a}" must be a boolean`, severity: "error" });
660
660
  }
661
- function k(e, a, t, r) {
661
+ function S(e, a, t, r) {
662
662
  const i = e[a];
663
663
  i !== void 0 && (!Array.isArray(i) || i.length !== 2 || typeof i[0] != "number" || typeof i[1] != "number") && r.push({ path: `${t}.${a}`, message: `"${a}" must be [number, number]`, severity: "error" });
664
664
  }
665
- function ie(e, a) {
665
+ function ne(e, a) {
666
666
  const t = e.toLowerCase(), r = a.find((n) => n.toLowerCase() === t);
667
667
  if (r) return ` Did you mean '${r}'?`;
668
668
  const i = a.find((n) => n.toLowerCase().startsWith(t.slice(0, 4)));
669
669
  return i ? ` Did you mean '${i}'?` : "";
670
670
  }
671
- const ne = {
671
+ const se = {
672
672
  foreground: { cssVar: "--elucim-foreground", fallback: "#c8d6e5" },
673
673
  background: { cssVar: "--elucim-background", fallback: "#0a0a1e" },
674
674
  title: { cssVar: "--elucim-title", fallback: "#e0e7ff" },
@@ -683,11 +683,11 @@ const ne = {
683
683
  success: { cssVar: "--elucim-success", fallback: "#34d399" },
684
684
  warning: { cssVar: "--elucim-warning", fallback: "#fbbf24" },
685
685
  error: { cssVar: "--elucim-error", fallback: "#f87171" }
686
- }, ca = Object.keys(ne);
686
+ }, fa = Object.keys(se);
687
687
  function u(e) {
688
688
  if (e === void 0) return;
689
689
  if (!e.startsWith("$")) return e;
690
- const a = e.slice(1), t = ne[a];
690
+ const a = e.slice(1), t = se[a];
691
691
  return t ? `var(${t.cssVar}, ${t.fallback})` : `var(--elucim-${a})`;
692
692
  }
693
693
  const qt = {
@@ -695,18 +695,18 @@ const qt = {
695
695
  slide: [1280, 720],
696
696
  square: [600, 600]
697
697
  };
698
- function V(e, a, t) {
698
+ function L(e, a, t) {
699
699
  if (!e) return { width: a, height: t };
700
700
  const [r, i] = qt[e];
701
701
  return { width: a ?? r, height: t ?? i };
702
702
  }
703
- function se(e, a) {
703
+ function ce(e, a) {
704
704
  switch (e.type) {
705
705
  case "scene":
706
706
  return H(e, a);
707
707
  case "player":
708
708
  if ((a == null ? void 0 : a.frame) !== void 0) {
709
- const { width: t, height: r } = V(e.preset, e.width, e.height);
709
+ const { width: t, height: r } = L(e.preset, e.width, e.height);
710
710
  return H(
711
711
  {
712
712
  width: t,
@@ -719,29 +719,30 @@ function se(e, a) {
719
719
  a
720
720
  );
721
721
  }
722
- return ce(e, a);
722
+ return le(e, a);
723
723
  case "presentation":
724
- return Bt(e);
724
+ return Ut(e);
725
725
  }
726
726
  }
727
727
  function H(e, a) {
728
- const t = (a == null ? void 0 : a.frame) !== void 0, { width: r, height: i } = V(e.preset, e.width, e.height);
729
- return /* @__PURE__ */ c(
730
- Pe,
728
+ const t = (a == null ? void 0 : a.frame) !== void 0, { width: r, height: i } = L(e.preset, e.width, e.height);
729
+ return /* @__PURE__ */ l(
730
+ Me,
731
731
  {
732
732
  width: r,
733
733
  height: i,
734
734
  fps: e.fps,
735
735
  durationInFrames: e.durationInFrames,
736
736
  background: u(e.background),
737
+ colorScheme: a == null ? void 0 : a.colorScheme,
737
738
  ...t ? { frame: a.frame, autoPlay: !1 } : {},
738
- children: e.children.map((n, s) => x(n, s))
739
+ children: e.children.map((n, s) => v(n, s))
739
740
  }
740
741
  );
741
742
  }
742
- function ce(e, a) {
743
- const { width: t, height: r } = V(e.preset, e.width, e.height);
744
- return /* @__PURE__ */ c(
743
+ function le(e, a) {
744
+ const { width: t, height: r } = L(e.preset, e.width, e.height);
745
+ return /* @__PURE__ */ l(
745
746
  Te,
746
747
  {
747
748
  ref: a == null ? void 0 : a.playerRef,
@@ -753,14 +754,15 @@ function ce(e, a) {
753
754
  controls: e.controls,
754
755
  loop: e.loop,
755
756
  autoPlay: e.autoPlay,
756
- children: e.children.map((i, n) => x(i, n))
757
+ colorScheme: a == null ? void 0 : a.colorScheme,
758
+ children: e.children.map((i, n) => v(i, n))
757
759
  }
758
760
  );
759
761
  }
760
- function Bt(e) {
761
- const { width: a, height: t } = V(e.preset, e.width, e.height);
762
- return /* @__PURE__ */ c(
763
- Fe,
762
+ function Ut(e) {
763
+ const { width: a, height: t } = L(e.preset, e.width, e.height);
764
+ return /* @__PURE__ */ l(
765
+ Pe,
764
766
  {
765
767
  width: a,
766
768
  height: t,
@@ -769,38 +771,38 @@ function Bt(e) {
769
771
  transitionDuration: e.transitionDuration,
770
772
  showHUD: e.showHud,
771
773
  showNotes: e.showNotes,
772
- children: e.slides.map((r, i) => Ut(r, i))
774
+ children: e.slides.map((r, i) => Gt(r, i))
773
775
  }
774
776
  );
775
777
  }
776
- function Ut(e, a) {
778
+ function Gt(e, a) {
777
779
  var t;
778
- return /* @__PURE__ */ c(Me, { title: e.title, notes: e.notes, background: u(e.background), children: (t = e.children) == null ? void 0 : t.map((r, i) => x(r, i)) }, a);
780
+ return /* @__PURE__ */ l(Ne, { title: e.title, notes: e.notes, background: u(e.background), children: (t = e.children) == null ? void 0 : t.map((r, i) => v(r, i)) }, a);
779
781
  }
780
- function x(e, a) {
782
+ function v(e, a) {
781
783
  var t, r, i, n;
782
784
  switch (e.type) {
783
785
  case "sequence":
784
- return /* @__PURE__ */ c(st, { from: e.from, durationInFrames: e.durationInFrames, name: e.name, children: e.children.map((s, l) => x(s, l)) }, a);
786
+ return /* @__PURE__ */ l(ct, { from: e.from, durationInFrames: e.durationInFrames, name: e.name, children: e.children.map((s, c) => v(s, c)) }, a);
785
787
  case "group":
786
- return /* @__PURE__ */ c(
787
- nt,
788
+ return /* @__PURE__ */ l(
789
+ st,
788
790
  {
789
791
  fadeIn: e.fadeIn,
790
792
  fadeOut: e.fadeOut,
791
- easing: o(e.easing),
793
+ easing: g(e.easing),
792
794
  rotation: e.rotation,
793
795
  rotationOrigin: e.rotationOrigin,
794
796
  scale: e.scale,
795
797
  translate: e.translate,
796
798
  zIndex: e.zIndex,
797
- children: e.children.map((s, l) => x(s, l))
799
+ children: e.children.map((s, c) => v(s, c))
798
800
  },
799
801
  a
800
802
  );
801
803
  case "bezierCurve":
802
- return /* @__PURE__ */ c(
803
- it,
804
+ return /* @__PURE__ */ l(
805
+ nt,
804
806
  {
805
807
  x1: e.x1,
806
808
  y1: e.y1,
@@ -818,7 +820,7 @@ function x(e, a) {
818
820
  fadeIn: e.fadeIn,
819
821
  fadeOut: e.fadeOut,
820
822
  draw: e.draw,
821
- easing: o(e.easing),
823
+ easing: g(e.easing),
822
824
  rotation: e.rotation,
823
825
  rotationOrigin: e.rotationOrigin,
824
826
  scale: e.scale,
@@ -828,8 +830,8 @@ function x(e, a) {
828
830
  a
829
831
  );
830
832
  case "circle":
831
- return /* @__PURE__ */ c(
832
- rt,
833
+ return /* @__PURE__ */ l(
834
+ it,
833
835
  {
834
836
  cx: e.cx,
835
837
  cy: e.cy,
@@ -841,7 +843,7 @@ function x(e, a) {
841
843
  fadeIn: e.fadeIn,
842
844
  fadeOut: e.fadeOut,
843
845
  draw: e.draw,
844
- easing: o(e.easing),
846
+ easing: g(e.easing),
845
847
  rotation: e.rotation,
846
848
  rotationOrigin: e.rotationOrigin,
847
849
  scale: e.scale,
@@ -851,8 +853,8 @@ function x(e, a) {
851
853
  a
852
854
  );
853
855
  case "line":
854
- return /* @__PURE__ */ c(
855
- at,
856
+ return /* @__PURE__ */ l(
857
+ rt,
856
858
  {
857
859
  x1: e.x1,
858
860
  y1: e.y1,
@@ -865,7 +867,7 @@ function x(e, a) {
865
867
  fadeIn: e.fadeIn,
866
868
  fadeOut: e.fadeOut,
867
869
  draw: e.draw,
868
- easing: o(e.easing),
870
+ easing: g(e.easing),
869
871
  rotation: e.rotation,
870
872
  rotationOrigin: e.rotationOrigin,
871
873
  scale: e.scale,
@@ -875,8 +877,8 @@ function x(e, a) {
875
877
  a
876
878
  );
877
879
  case "arrow":
878
- return /* @__PURE__ */ c(
879
- tt,
880
+ return /* @__PURE__ */ l(
881
+ at,
880
882
  {
881
883
  x1: e.x1,
882
884
  y1: e.y1,
@@ -890,7 +892,7 @@ function x(e, a) {
890
892
  fadeIn: e.fadeIn,
891
893
  fadeOut: e.fadeOut,
892
894
  draw: e.draw,
893
- easing: o(e.easing),
895
+ easing: g(e.easing),
894
896
  rotation: e.rotation,
895
897
  rotationOrigin: e.rotationOrigin,
896
898
  scale: e.scale,
@@ -900,8 +902,8 @@ function x(e, a) {
900
902
  a
901
903
  );
902
904
  case "rect":
903
- return /* @__PURE__ */ c(
904
- et,
905
+ return /* @__PURE__ */ l(
906
+ tt,
905
907
  {
906
908
  x: e.x,
907
909
  y: e.y,
@@ -917,7 +919,7 @@ function x(e, a) {
917
919
  fadeIn: e.fadeIn,
918
920
  fadeOut: e.fadeOut,
919
921
  draw: e.draw,
920
- easing: o(e.easing),
922
+ easing: g(e.easing),
921
923
  rotation: e.rotation,
922
924
  rotationOrigin: e.rotationOrigin,
923
925
  scale: e.scale,
@@ -927,8 +929,8 @@ function x(e, a) {
927
929
  a
928
930
  );
929
931
  case "polygon":
930
- return /* @__PURE__ */ c(
931
- Ze,
932
+ return /* @__PURE__ */ l(
933
+ et,
932
934
  {
933
935
  points: e.points,
934
936
  fill: u(e.fill),
@@ -939,7 +941,7 @@ function x(e, a) {
939
941
  fadeIn: e.fadeIn,
940
942
  fadeOut: e.fadeOut,
941
943
  draw: e.draw,
942
- easing: o(e.easing),
944
+ easing: g(e.easing),
943
945
  rotation: e.rotation,
944
946
  rotationOrigin: e.rotationOrigin,
945
947
  scale: e.scale,
@@ -949,8 +951,8 @@ function x(e, a) {
949
951
  a
950
952
  );
951
953
  case "text":
952
- return /* @__PURE__ */ c(
953
- L,
954
+ return /* @__PURE__ */ l(
955
+ j,
954
956
  {
955
957
  x: e.x,
956
958
  y: e.y,
@@ -963,7 +965,7 @@ function x(e, a) {
963
965
  opacity: e.opacity,
964
966
  fadeIn: e.fadeIn,
965
967
  fadeOut: e.fadeOut,
966
- easing: o(e.easing),
968
+ easing: g(e.easing),
967
969
  rotation: e.rotation,
968
970
  rotationOrigin: e.rotationOrigin,
969
971
  scale: e.scale,
@@ -974,8 +976,8 @@ function x(e, a) {
974
976
  a
975
977
  );
976
978
  case "image":
977
- return /* @__PURE__ */ c(
978
- Ye,
979
+ return /* @__PURE__ */ l(
980
+ Ze,
979
981
  {
980
982
  src: e.src,
981
983
  x: e.x,
@@ -988,7 +990,7 @@ function x(e, a) {
988
990
  opacity: e.opacity,
989
991
  fadeIn: e.fadeIn,
990
992
  fadeOut: e.fadeOut,
991
- easing: o(e.easing),
993
+ easing: g(e.easing),
992
994
  rotation: e.rotation,
993
995
  rotationOrigin: e.rotationOrigin,
994
996
  scale: e.scale,
@@ -998,8 +1000,8 @@ function x(e, a) {
998
1000
  a
999
1001
  );
1000
1002
  case "axes":
1001
- return /* @__PURE__ */ c(
1002
- Je,
1003
+ return /* @__PURE__ */ l(
1004
+ Ye,
1003
1005
  {
1004
1006
  domain: e.domain,
1005
1007
  range: e.range,
@@ -1016,7 +1018,7 @@ function x(e, a) {
1016
1018
  fadeIn: e.fadeIn,
1017
1019
  fadeOut: e.fadeOut,
1018
1020
  draw: e.draw,
1019
- easing: o(e.easing),
1021
+ easing: g(e.easing),
1020
1022
  rotation: e.rotation,
1021
1023
  rotationOrigin: e.rotationOrigin,
1022
1024
  translate: e.translate,
@@ -1029,8 +1031,8 @@ function x(e, a) {
1029
1031
  try {
1030
1032
  s = ot(e.fn);
1031
1033
  } catch {
1032
- return /* @__PURE__ */ c(
1033
- L,
1034
+ return /* @__PURE__ */ l(
1035
+ j,
1034
1036
  {
1035
1037
  x: ((t = e.origin) == null ? void 0 : t[0]) ?? 400,
1036
1038
  y: (((r = e.origin) == null ? void 0 : r[1]) ?? 300) - 20,
@@ -1042,10 +1044,10 @@ function x(e, a) {
1042
1044
  a
1043
1045
  );
1044
1046
  }
1045
- return /* @__PURE__ */ c(
1046
- Xe,
1047
+ return /* @__PURE__ */ l(
1048
+ Je,
1047
1049
  {
1048
- fn: (l) => s({ x: l }),
1050
+ fn: (c) => s({ x: c }),
1049
1051
  domain: e.domain,
1050
1052
  yClamp: e.yClamp,
1051
1053
  origin: e.origin,
@@ -1054,7 +1056,7 @@ function x(e, a) {
1054
1056
  strokeWidth: e.strokeWidth,
1055
1057
  samples: e.samples,
1056
1058
  draw: e.draw,
1057
- easing: o(e.easing),
1059
+ easing: g(e.easing),
1058
1060
  opacity: e.opacity,
1059
1061
  rotation: e.rotation,
1060
1062
  rotationOrigin: e.rotationOrigin,
@@ -1065,8 +1067,8 @@ function x(e, a) {
1065
1067
  );
1066
1068
  }
1067
1069
  case "vector":
1068
- return /* @__PURE__ */ c(
1069
- Qe,
1070
+ return /* @__PURE__ */ l(
1071
+ Xe,
1070
1072
  {
1071
1073
  from: e.from,
1072
1074
  to: e.to,
@@ -1082,7 +1084,7 @@ function x(e, a) {
1082
1084
  fadeIn: e.fadeIn,
1083
1085
  fadeOut: e.fadeOut,
1084
1086
  draw: e.draw,
1085
- easing: o(e.easing),
1087
+ easing: g(e.easing),
1086
1088
  rotation: e.rotation,
1087
1089
  rotationOrigin: e.rotationOrigin,
1088
1090
  translate: e.translate,
@@ -1093,10 +1095,10 @@ function x(e, a) {
1093
1095
  case "vectorField": {
1094
1096
  let s;
1095
1097
  try {
1096
- s = gt(e.fn);
1098
+ s = mt(e.fn);
1097
1099
  } catch {
1098
- return /* @__PURE__ */ c(
1099
- L,
1100
+ return /* @__PURE__ */ l(
1101
+ j,
1100
1102
  {
1101
1103
  x: ((i = e.origin) == null ? void 0 : i[0]) ?? 400,
1102
1104
  y: (((n = e.origin) == null ? void 0 : n[1]) ?? 300) - 20,
@@ -1108,10 +1110,10 @@ function x(e, a) {
1108
1110
  a
1109
1111
  );
1110
1112
  }
1111
- return /* @__PURE__ */ c(
1112
- Ke,
1113
+ return /* @__PURE__ */ l(
1114
+ Qe,
1113
1115
  {
1114
- fn: (l, $) => s({ x: l, y: $ }),
1116
+ fn: (c, x) => s({ x: c, y: x }),
1115
1117
  domain: e.domain,
1116
1118
  range: e.range,
1117
1119
  step: e.step,
@@ -1125,7 +1127,7 @@ function x(e, a) {
1125
1127
  maxLength: e.maxLength,
1126
1128
  fadeIn: e.fadeIn,
1127
1129
  fadeOut: e.fadeOut,
1128
- easing: o(e.easing),
1130
+ easing: g(e.easing),
1129
1131
  rotation: e.rotation,
1130
1132
  rotationOrigin: e.rotationOrigin,
1131
1133
  translate: e.translate,
@@ -1135,8 +1137,8 @@ function x(e, a) {
1135
1137
  );
1136
1138
  }
1137
1139
  case "matrix":
1138
- return /* @__PURE__ */ c(
1139
- Ge,
1140
+ return /* @__PURE__ */ l(
1141
+ Ke,
1140
1142
  {
1141
1143
  values: e.values,
1142
1144
  x: e.x,
@@ -1147,7 +1149,7 @@ function x(e, a) {
1147
1149
  fontSize: e.fontSize,
1148
1150
  fadeIn: e.fadeIn,
1149
1151
  fadeOut: e.fadeOut,
1150
- easing: o(e.easing),
1152
+ easing: g(e.easing),
1151
1153
  rotation: e.rotation,
1152
1154
  rotationOrigin: e.rotationOrigin,
1153
1155
  scale: e.scale,
@@ -1157,7 +1159,7 @@ function x(e, a) {
1157
1159
  a
1158
1160
  );
1159
1161
  case "graph":
1160
- return /* @__PURE__ */ c(
1162
+ return /* @__PURE__ */ l(
1161
1163
  He,
1162
1164
  {
1163
1165
  nodes: e.nodes,
@@ -1170,7 +1172,7 @@ function x(e, a) {
1170
1172
  labelFontSize: e.labelFontSize,
1171
1173
  fadeIn: e.fadeIn,
1172
1174
  fadeOut: e.fadeOut,
1173
- easing: o(e.easing),
1175
+ easing: g(e.easing),
1174
1176
  rotation: e.rotation,
1175
1177
  rotationOrigin: e.rotationOrigin,
1176
1178
  scale: e.scale,
@@ -1180,8 +1182,8 @@ function x(e, a) {
1180
1182
  a
1181
1183
  );
1182
1184
  case "latex":
1183
- return /* @__PURE__ */ c(
1184
- Ue,
1185
+ return /* @__PURE__ */ l(
1186
+ Ge,
1185
1187
  {
1186
1188
  expression: e.expression,
1187
1189
  x: e.x,
@@ -1191,7 +1193,7 @@ function x(e, a) {
1191
1193
  align: e.align,
1192
1194
  fadeIn: e.fadeIn,
1193
1195
  fadeOut: e.fadeOut,
1194
- easing: o(e.easing),
1196
+ easing: g(e.easing),
1195
1197
  rotation: e.rotation,
1196
1198
  rotationOrigin: e.rotationOrigin,
1197
1199
  scale: e.scale,
@@ -1201,8 +1203,8 @@ function x(e, a) {
1201
1203
  a
1202
1204
  );
1203
1205
  case "barChart":
1204
- return /* @__PURE__ */ c(
1205
- Be,
1206
+ return /* @__PURE__ */ l(
1207
+ Ue,
1206
1208
  {
1207
1209
  bars: e.bars,
1208
1210
  x: e.x,
@@ -1218,7 +1220,7 @@ function x(e, a) {
1218
1220
  valueFormat: e.valueFormat,
1219
1221
  fadeIn: e.fadeIn,
1220
1222
  fadeOut: e.fadeOut,
1221
- easing: o(e.easing),
1223
+ easing: g(e.easing),
1222
1224
  rotation: e.rotation,
1223
1225
  rotationOrigin: e.rotationOrigin,
1224
1226
  scale: e.scale,
@@ -1228,56 +1230,56 @@ function x(e, a) {
1228
1230
  a
1229
1231
  );
1230
1232
  case "fadeIn":
1231
- return /* @__PURE__ */ c(qe, { duration: e.duration, easing: o(e.easing), children: e.children.map((s, l) => x(s, l)) }, a);
1233
+ return /* @__PURE__ */ l(qe, { duration: e.duration, easing: g(e.easing), children: e.children.map((s, c) => v(s, c)) }, a);
1232
1234
  case "fadeOut":
1233
- return /* @__PURE__ */ c(je, { duration: e.duration, totalFrames: e.totalFrames, easing: o(e.easing), children: e.children.map((s, l) => x(s, l)) }, a);
1235
+ return /* @__PURE__ */ l(Be, { duration: e.duration, totalFrames: e.totalFrames, easing: g(e.easing), children: e.children.map((s, c) => v(s, c)) }, a);
1234
1236
  case "draw":
1235
- return /* @__PURE__ */ c(Le, { duration: e.duration, pathLength: e.pathLength, easing: o(e.easing), children: x(e.children[0], 0) }, a);
1237
+ return /* @__PURE__ */ l(je, { duration: e.duration, pathLength: e.pathLength, easing: g(e.easing), children: v(e.children[0], 0) }, a);
1236
1238
  case "write":
1237
- return /* @__PURE__ */ c(Ve, { duration: e.duration, easing: o(e.easing), children: e.children.map((s, l) => x(s, l)) }, a);
1239
+ return /* @__PURE__ */ l(Le, { duration: e.duration, easing: g(e.easing), children: e.children.map((s, c) => v(s, c)) }, a);
1238
1240
  case "transform":
1239
- return /* @__PURE__ */ c(
1240
- We,
1241
+ return /* @__PURE__ */ l(
1242
+ Ve,
1241
1243
  {
1242
1244
  duration: e.duration,
1243
- easing: o(e.easing),
1245
+ easing: g(e.easing),
1244
1246
  translate: e.translate,
1245
1247
  scale: e.scale,
1246
1248
  rotate: e.rotate,
1247
1249
  opacity: e.opacity,
1248
- children: e.children.map((s, l) => x(s, l))
1250
+ children: e.children.map((s, c) => v(s, c))
1249
1251
  },
1250
1252
  a
1251
1253
  );
1252
1254
  case "morph":
1253
- return /* @__PURE__ */ c(
1254
- De,
1255
+ return /* @__PURE__ */ l(
1256
+ _e,
1255
1257
  {
1256
1258
  duration: e.duration,
1257
- easing: o(e.easing),
1259
+ easing: g(e.easing),
1258
1260
  fromColor: u(e.fromColor),
1259
1261
  toColor: u(e.toColor),
1260
1262
  fromOpacity: e.fromOpacity,
1261
1263
  toOpacity: e.toOpacity,
1262
1264
  fromScale: e.fromScale,
1263
1265
  toScale: e.toScale,
1264
- children: e.children.map((s, l) => x(s, l))
1266
+ children: e.children.map((s, c) => v(s, c))
1265
1267
  },
1266
1268
  a
1267
1269
  );
1268
1270
  case "stagger":
1269
- return /* @__PURE__ */ c(_e, { staggerDelay: e.staggerDelay, easing: o(e.easing), children: e.children.map((s, l) => x(s, l)) }, a);
1271
+ return /* @__PURE__ */ l(De, { staggerDelay: e.staggerDelay, easing: g(e.easing), children: e.children.map((s, c) => v(s, c)) }, a);
1270
1272
  case "parallel":
1271
- return /* @__PURE__ */ c(Ne, { children: e.children.map((s, l) => x(s, l)) }, a);
1273
+ return /* @__PURE__ */ l(We, { children: e.children.map((s, c) => v(s, c)) }, a);
1272
1274
  case "scene":
1273
- return /* @__PURE__ */ c(Q.Fragment, { children: H(e) }, a);
1275
+ return /* @__PURE__ */ l(X.Fragment, { children: H(e) }, a);
1274
1276
  case "player":
1275
- return /* @__PURE__ */ c(Q.Fragment, { children: ce(e) }, a);
1277
+ return /* @__PURE__ */ l(X.Fragment, { children: le(e) }, a);
1276
1278
  default:
1277
1279
  return null;
1278
1280
  }
1279
1281
  }
1280
- const le = {
1282
+ const ue = {
1281
1283
  background: "#0a0a1e",
1282
1284
  title: "#e0e7ff",
1283
1285
  subtitle: "#94a3b8",
@@ -1308,14 +1310,14 @@ const le = {
1308
1310
  error: "#dc2626",
1309
1311
  palette: ["#2563eb", "#7c3aed", "#db2777", "#16a34a", "#d97706", "#ea580c", "#4f46e5", "#0891b2"]
1310
1312
  };
1311
- function Gt(e) {
1313
+ function Kt(e) {
1312
1314
  if (!e) return {};
1313
1315
  const a = {};
1314
1316
  for (const [t, r] of Object.entries(e))
1315
1317
  r !== void 0 && (a[`--elucim-${t}`] = r);
1316
1318
  return a;
1317
1319
  }
1318
- function ue(e) {
1320
+ function he(e) {
1319
1321
  return {
1320
1322
  "--elucim-foreground": e.text,
1321
1323
  "--elucim-background": e.background,
@@ -1332,58 +1334,58 @@ function ue(e) {
1332
1334
  "--elucim-error": e.error
1333
1335
  };
1334
1336
  }
1335
- const Kt = ue(le), Qt = ue(Ht);
1336
- function Xt(e) {
1337
+ const Qt = he(ue), Xt = he(Ht);
1338
+ function Jt(e) {
1337
1339
  if (typeof window > "u" || typeof window.matchMedia != "function") return () => {
1338
1340
  };
1339
1341
  const a = window.matchMedia("(prefers-color-scheme: dark)");
1340
1342
  return a.addEventListener("change", e), () => a.removeEventListener("change", e);
1341
1343
  }
1342
- function Jt() {
1344
+ function Yt() {
1343
1345
  return typeof window > "u" || typeof window.matchMedia != "function" ? !0 : window.matchMedia("(prefers-color-scheme: dark)").matches;
1344
1346
  }
1345
- function Yt() {
1347
+ function Zt() {
1346
1348
  return !0;
1347
1349
  }
1348
- function Zt() {
1349
- return ht(Xt, Jt, Yt);
1350
+ function ea() {
1351
+ return ft(Jt, Yt, Zt);
1350
1352
  }
1351
- const la = ct(function({ dsl: a, className: t, style: r, theme: i, colorScheme: n, poster: s, onError: l }, $) {
1352
- const d = lt(null), E = Zt();
1353
- ut($, () => ({
1353
+ const ga = lt(function({ dsl: a, className: t, style: r, theme: i, colorScheme: n, poster: s, onError: c }, x) {
1354
+ const o = ut(null), k = ea();
1355
+ ht(x, () => ({
1354
1356
  getSvgElement: () => {
1355
1357
  var f;
1356
- return ((f = d.current) == null ? void 0 : f.getSvgElement()) ?? null;
1358
+ return ((f = o.current) == null ? void 0 : f.getSvgElement()) ?? null;
1357
1359
  },
1358
1360
  seekToFrame: (f) => {
1359
- var I;
1360
- return (I = d.current) == null ? void 0 : I.seekToFrame(f);
1361
+ var C;
1362
+ return (C = o.current) == null ? void 0 : C.seekToFrame(f);
1361
1363
  },
1362
1364
  getTotalFrames: () => {
1363
1365
  var f;
1364
- return ((f = d.current) == null ? void 0 : f.getTotalFrames()) ?? 0;
1366
+ return ((f = o.current) == null ? void 0 : f.getTotalFrames()) ?? 0;
1365
1367
  },
1366
1368
  play: () => {
1367
1369
  var f;
1368
- return (f = d.current) == null ? void 0 : f.play();
1370
+ return (f = o.current) == null ? void 0 : f.play();
1369
1371
  },
1370
1372
  pause: () => {
1371
1373
  var f;
1372
- return (f = d.current) == null ? void 0 : f.pause();
1374
+ return (f = o.current) == null ? void 0 : f.pause();
1373
1375
  },
1374
1376
  isPlaying: () => {
1375
1377
  var f;
1376
- return ((f = d.current) == null ? void 0 : f.isPlaying()) ?? !1;
1378
+ return ((f = o.current) == null ? void 0 : f.isPlaying()) ?? !1;
1377
1379
  }
1378
1380
  }));
1379
- const w = te(a);
1380
- if (!w.valid) {
1381
- const f = w.errors.filter((y) => y.severity === "error").map((y) => ({ path: y.path, message: y.message }));
1382
- l == null || l(f);
1383
- const I = /* @__PURE__ */ new Map();
1384
- for (const y of f) {
1385
- const T = y.path.split("."), M = T.length > 1 ? T.slice(0, -1).join(".") : y.path, _ = I.get(M) ?? [];
1386
- _.push(y), I.set(M, _);
1381
+ const y = ae(a);
1382
+ if (!y.valid) {
1383
+ const f = y.errors.filter((I) => I.severity === "error").map((I) => ({ path: I.path, message: I.message }));
1384
+ c == null || c(f);
1385
+ const C = /* @__PURE__ */ new Map();
1386
+ for (const I of f) {
1387
+ const T = I.path.split("."), N = T.length > 1 ? T.slice(0, -1).join(".") : I.path, D = C.get(N) ?? [];
1388
+ D.push(I), C.set(N, D);
1387
1389
  }
1388
1390
  return /* @__PURE__ */ R(
1389
1391
  "div",
@@ -1397,37 +1399,38 @@ const la = ct(function({ dsl: a, className: t, style: r, theme: i, colorScheme:
1397
1399
  f.length,
1398
1400
  "):"
1399
1401
  ] }),
1400
- [...I.entries()].map(([y, T]) => /* @__PURE__ */ R("details", { open: !0, style: { marginTop: 8 }, children: [
1402
+ [...C.entries()].map(([I, T]) => /* @__PURE__ */ R("details", { open: !0, style: { marginTop: 8 }, children: [
1401
1403
  /* @__PURE__ */ R("summary", { style: { cursor: "pointer", fontWeight: "bold" }, children: [
1402
- y,
1404
+ I,
1403
1405
  " (",
1404
1406
  T.length,
1405
1407
  ")"
1406
1408
  ] }),
1407
- /* @__PURE__ */ c("ul", { style: { margin: "4px 0", paddingLeft: 20 }, children: T.map((M, _) => /* @__PURE__ */ R("li", { children: [
1408
- /* @__PURE__ */ c("code", { style: { color: "#ffa07a" }, children: M.path }),
1409
+ /* @__PURE__ */ l("ul", { style: { margin: "4px 0", paddingLeft: 20 }, children: T.map((N, D) => /* @__PURE__ */ R("li", { children: [
1410
+ /* @__PURE__ */ l("code", { style: { color: "#ffa07a" }, children: N.path }),
1409
1411
  ": ",
1410
- M.message
1411
- ] }, _)) })
1412
- ] }, y)),
1412
+ N.message
1413
+ ] }, D)) })
1414
+ ] }, I)),
1413
1415
  /* @__PURE__ */ R("details", { style: { marginTop: 12 }, children: [
1414
- /* @__PURE__ */ c("summary", { style: { cursor: "pointer", opacity: 0.7 }, children: "Raw JSON" }),
1415
- /* @__PURE__ */ c("pre", { style: { fontSize: 11, maxHeight: 300, overflow: "auto", marginTop: 4, padding: 8, background: "rgba(0,0,0,0.3)", borderRadius: 4 }, children: JSON.stringify(a, null, 2) })
1416
+ /* @__PURE__ */ l("summary", { style: { cursor: "pointer", opacity: 0.7 }, children: "Raw JSON" }),
1417
+ /* @__PURE__ */ l("pre", { style: { fontSize: 11, maxHeight: 300, overflow: "auto", marginTop: 4, padding: 8, background: "rgba(0,0,0,0.3)", borderRadius: 4 }, children: JSON.stringify(a, null, 2) })
1416
1418
  ] })
1417
1419
  ]
1418
1420
  }
1419
1421
  );
1420
1422
  }
1421
- const m = Gt(i);
1422
- let b = {};
1423
- n && (b = (n === "auto" ? E : n === "dark") ? Kt : Qt);
1424
- const O = s !== void 0 ? ea(s, a) : void 0;
1425
- return /* @__PURE__ */ c("div", { className: t, style: { ...b, ...m, ...r }, "data-testid": "dsl-root", children: se(a.root, {
1426
- frame: O == null ? void 0 : O.frame,
1427
- playerRef: d
1423
+ const m = Kt(i);
1424
+ let d = {};
1425
+ n && (d = (n === "auto" ? k : n === "dark") ? Qt : Xt);
1426
+ const $ = s !== void 0 ? ta(s, a) : void 0, O = n ? n === "auto" ? k ? "dark" : "light" : n : void 0;
1427
+ return /* @__PURE__ */ l("div", { className: t, style: { ...d, ...m, ...r }, "data-testid": "dsl-root", children: ce(a.root, {
1428
+ frame: $ == null ? void 0 : $.frame,
1429
+ playerRef: o,
1430
+ colorScheme: O
1428
1431
  }) });
1429
1432
  });
1430
- function ea(e, a) {
1433
+ function ta(e, a) {
1431
1434
  if (e === "first") return { frame: 0 };
1432
1435
  if (e === "last") {
1433
1436
  const r = a.root.durationInFrames ?? 1;
@@ -1435,22 +1438,58 @@ function ea(e, a) {
1435
1438
  }
1436
1439
  return { frame: e };
1437
1440
  }
1438
- function ua(e, a, t) {
1439
- const r = te(e);
1441
+ function aa(e, a, t) {
1442
+ const r = ae(e);
1440
1443
  if (!r.valid) {
1441
- const s = r.errors.filter((l) => l.severity === "error");
1444
+ const s = r.errors.filter((c) => c.severity === "error");
1442
1445
  throw new Error(
1443
1446
  `DSL validation failed:
1444
- ${s.map((l) => ` ${l.path}: ${l.message}`).join(`
1447
+ ${s.map((c) => ` ${c.path}: ${c.message}`).join(`
1445
1448
  `)}`
1446
1449
  );
1447
1450
  }
1448
1451
  const i = { ...e.root };
1449
1452
  t != null && t.width && (i.width = t.width), t != null && t.height && (i.height = t.height);
1450
- const n = se(i, { frame: a });
1451
- return ft(n);
1453
+ const n = ce(i, { frame: a });
1454
+ return gt(n);
1455
+ }
1456
+ async function oa(e, a, t) {
1457
+ const r = (t == null ? void 0 : t.scale) ?? 2, n = aa(e, a, {
1458
+ width: t == null ? void 0 : t.width,
1459
+ height: t == null ? void 0 : t.height
1460
+ }).match(/<svg[\s\S]*<\/svg>/);
1461
+ if (!n)
1462
+ throw new Error("renderToSvgString did not produce an SVG element");
1463
+ let s = n[0];
1464
+ const c = s.match(/viewBox="0 0 (\d+(?:\.\d+)?) (\d+(?:\.\d+)?)"/), x = (t == null ? void 0 : t.width) ?? (c ? parseFloat(c[1]) : 800), o = (t == null ? void 0 : t.height) ?? (c ? parseFloat(c[2]) : 600), k = Math.round(x * r), y = Math.round(o * r);
1465
+ s = s.replace(/width="100%"/, `width="${k}"`).replace(/height="100%"/, `height="${y}"`), s.includes("xmlns=") || (s = s.replace("<svg", '<svg xmlns="http://www.w3.org/2000/svg"')), s = s.replace(/style="[^"]*position:\s*absolute[^"]*"/, "");
1466
+ const m = e.root.background ?? "#ffffff", d = `<rect width="${x}" height="${o}" fill="${m}"/>`;
1467
+ s = s.replace(/>/, `>${d}`);
1468
+ const O = `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(s)))}`;
1469
+ return typeof OffscreenCanvas < "u" ? ra(O, k, y) : ia(O, k, y);
1470
+ }
1471
+ async function ra(e, a, t) {
1472
+ const i = await (await fetch(e)).blob(), n = await createImageBitmap(i, { resizeWidth: a, resizeHeight: t }), s = new OffscreenCanvas(a, t);
1473
+ s.getContext("2d").drawImage(n, 0, 0, a, t), n.close();
1474
+ const o = await (await s.convertToBlob({ type: "image/png" })).arrayBuffer();
1475
+ return new Uint8Array(o);
1476
+ }
1477
+ function ia(e, a, t) {
1478
+ return new Promise((r, i) => {
1479
+ const n = new Image();
1480
+ n.onload = () => {
1481
+ const s = document.createElement("canvas");
1482
+ s.width = a, s.height = t, s.getContext("2d").drawImage(n, 0, 0, a, t), s.toBlob(
1483
+ (x) => {
1484
+ if (!x) return i(new Error("Failed to render PNG from SVG"));
1485
+ x.arrayBuffer().then((o) => r(new Uint8Array(o)));
1486
+ },
1487
+ "image/png"
1488
+ );
1489
+ }, n.onerror = () => i(new Error("Failed to load SVG data URI for PNG render")), n.src = e;
1490
+ });
1452
1491
  }
1453
- class ta {
1492
+ class na {
1454
1493
  constructor(a, t = 30, r = 900, i = 640) {
1455
1494
  this.elements = [], this.cursor = 0, this.theme = a, this._fps = t, this._width = r, this._height = i;
1456
1495
  }
@@ -1553,7 +1592,7 @@ class ta {
1553
1592
  }
1554
1593
  /** Add an arrow */
1555
1594
  arrow(a, t, r, i, n) {
1556
- const s = (n == null ? void 0 : n.fadeIn) ?? 12, l = {
1595
+ const s = (n == null ? void 0 : n.fadeIn) ?? 12, c = {
1557
1596
  type: "arrow",
1558
1597
  x1: a,
1559
1598
  y1: t,
@@ -1565,7 +1604,7 @@ class ta {
1565
1604
  strokeDasharray: n != null && n.dashed ? "6 3" : void 0,
1566
1605
  fadeIn: s
1567
1606
  };
1568
- return this.addAtCursor(l, (n == null ? void 0 : n.advance) ?? 3);
1607
+ return this.addAtCursor(c, (n == null ? void 0 : n.advance) ?? 3);
1569
1608
  }
1570
1609
  /** Add a line */
1571
1610
  line(a, t, r, i, n) {
@@ -1669,33 +1708,33 @@ class ta {
1669
1708
  * Returns the box positions for follow-up arrows, etc.
1670
1709
  */
1671
1710
  boxRow(a, t) {
1672
- const r = (t == null ? void 0 : t.boxWidth) ?? 80, i = (t == null ? void 0 : t.boxHeight) ?? 40, n = (t == null ? void 0 : t.gap) ?? 12, s = (t == null ? void 0 : t.y) ?? 250, l = a.length * r + (a.length - 1) * n, $ = (this._width - l) / 2;
1711
+ const r = (t == null ? void 0 : t.boxWidth) ?? 80, i = (t == null ? void 0 : t.boxHeight) ?? 40, n = (t == null ? void 0 : t.gap) ?? 12, s = (t == null ? void 0 : t.y) ?? 250, c = a.length * r + (a.length - 1) * n, x = (this._width - c) / 2;
1673
1712
  t == null || t.fadeIn;
1674
- const d = a.map((w, m) => {
1675
- const b = $ + m * (r + n);
1676
- return { x: b, y: s, w: r, h: i, cx: b + r / 2, cy: s + i / 2 };
1677
- }), E = a.map((w, m) => {
1678
- var I, y;
1679
- const b = d[m], O = ((I = t == null ? void 0 : t.colors) == null ? void 0 : I[m]) ?? this.theme.boxFill, f = ((y = t == null ? void 0 : t.strokeColors) == null ? void 0 : y[m]) ?? this.theme.boxStroke;
1713
+ const o = a.map((y, m) => {
1714
+ const d = x + m * (r + n);
1715
+ return { x: d, y: s, w: r, h: i, cx: d + r / 2, cy: s + i / 2 };
1716
+ }), k = a.map((y, m) => {
1717
+ var f, C;
1718
+ const d = o[m], $ = ((f = t == null ? void 0 : t.colors) == null ? void 0 : f[m]) ?? this.theme.boxFill, O = ((C = t == null ? void 0 : t.strokeColors) == null ? void 0 : C[m]) ?? this.theme.boxStroke;
1680
1719
  return {
1681
1720
  type: "group",
1682
1721
  children: [
1683
1722
  {
1684
1723
  type: "rect",
1685
- x: b.x,
1686
- y: b.y,
1724
+ x: d.x,
1725
+ y: d.y,
1687
1726
  width: r,
1688
1727
  height: i,
1689
- fill: O,
1690
- stroke: f,
1728
+ fill: $,
1729
+ stroke: O,
1691
1730
  strokeWidth: 1.5,
1692
1731
  rx: 6
1693
1732
  },
1694
1733
  {
1695
1734
  type: "text",
1696
- x: b.cx,
1697
- y: b.cy + 5,
1698
- content: w,
1735
+ x: d.cx,
1736
+ y: d.cy + 5,
1737
+ content: y,
1699
1738
  fontSize: (t == null ? void 0 : t.fontSize) ?? 13,
1700
1739
  fill: (t == null ? void 0 : t.textColor) ?? this.theme.text,
1701
1740
  textAnchor: "middle",
@@ -1707,21 +1746,21 @@ class ta {
1707
1746
  return this.addAtCursor({
1708
1747
  type: "stagger",
1709
1748
  staggerDelay: 3,
1710
- children: E
1711
- }, 8 + a.length * 2), d;
1749
+ children: k
1750
+ }, 8 + a.length * 2), o;
1712
1751
  }
1713
1752
  /**
1714
1753
  * Render a vertical stack of labeled boxes.
1715
1754
  */
1716
1755
  boxColumn(a, t) {
1717
- const r = (t == null ? void 0 : t.boxWidth) ?? 160, i = (t == null ? void 0 : t.boxHeight) ?? 36, n = (t == null ? void 0 : t.gap) ?? 8, s = (t == null ? void 0 : t.y) ?? 150, l = (t == null ? void 0 : t.x) ?? this.cx;
1756
+ const r = (t == null ? void 0 : t.boxWidth) ?? 160, i = (t == null ? void 0 : t.boxHeight) ?? 36, n = (t == null ? void 0 : t.gap) ?? 8, s = (t == null ? void 0 : t.y) ?? 150, c = (t == null ? void 0 : t.x) ?? this.cx;
1718
1757
  t == null || t.fadeIn;
1719
- const $ = a.map((E, w) => {
1720
- const m = s + w * (i + n);
1721
- return { x: l - r / 2, y: m, w: r, h: i, cx: l, cy: m + i / 2 };
1722
- }), d = a.map((E, w) => {
1723
- var O, f;
1724
- const m = $[w], b = ((O = t == null ? void 0 : t.colors) == null ? void 0 : O[w]) ?? this.theme.boxFill;
1758
+ const x = a.map((k, y) => {
1759
+ const m = s + y * (i + n);
1760
+ return { x: c - r / 2, y: m, w: r, h: i, cx: c, cy: m + i / 2 };
1761
+ }), o = a.map((k, y) => {
1762
+ var $, O;
1763
+ const m = x[y], d = (($ = t == null ? void 0 : t.colors) == null ? void 0 : $[y]) ?? this.theme.boxFill;
1725
1764
  return {
1726
1765
  type: "group",
1727
1766
  children: [
@@ -1731,8 +1770,8 @@ class ta {
1731
1770
  y: m.y,
1732
1771
  width: r,
1733
1772
  height: i,
1734
- fill: b,
1735
- stroke: (f = t == null ? void 0 : t.colors) != null && f[w] ? t.colors[w] : this.theme.boxStroke,
1773
+ fill: d,
1774
+ stroke: (O = t == null ? void 0 : t.colors) != null && O[y] ? t.colors[y] : this.theme.boxStroke,
1736
1775
  strokeWidth: 1.5,
1737
1776
  rx: 6
1738
1777
  },
@@ -1740,7 +1779,7 @@ class ta {
1740
1779
  type: "text",
1741
1780
  x: m.cx,
1742
1781
  y: m.cy + 5,
1743
- content: E,
1782
+ content: k,
1744
1783
  fontSize: (t == null ? void 0 : t.fontSize) ?? 13,
1745
1784
  fill: (t == null ? void 0 : t.textColor) ?? this.theme.text,
1746
1785
  textAnchor: "middle"
@@ -1751,8 +1790,8 @@ class ta {
1751
1790
  return this.addAtCursor({
1752
1791
  type: "stagger",
1753
1792
  staggerDelay: 3,
1754
- children: d
1755
- }, 8 + a.length * 2), $;
1793
+ children: o
1794
+ }, 8 + a.length * 2), x;
1756
1795
  }
1757
1796
  /**
1758
1797
  * Draw arrows connecting sequential positions (e.g., output of boxRow/boxColumn).
@@ -1835,9 +1874,9 @@ class ta {
1835
1874
  return { elements: this.elements, durationInFrames: a };
1836
1875
  }
1837
1876
  }
1838
- class aa {
1877
+ class sa {
1839
1878
  constructor(a, t, r) {
1840
- this._slides = [], this._title = a, this._theme = t ?? le, this._opts = {
1879
+ this._slides = [], this._title = a, this._theme = t ?? ue, this._opts = {
1841
1880
  width: 900,
1842
1881
  height: 640,
1843
1882
  fps: 30,
@@ -1855,7 +1894,7 @@ class aa {
1855
1894
  /** Build the final ElucimDocument */
1856
1895
  build() {
1857
1896
  const a = this._slides.map((r) => {
1858
- const i = new ta(
1897
+ const i = new na(
1859
1898
  this._theme,
1860
1899
  this._opts.fps,
1861
1900
  this._opts.width,
@@ -1901,29 +1940,30 @@ class aa {
1901
1940
  return JSON.stringify(this.build(), null, a ? 2 : void 0);
1902
1941
  }
1903
1942
  }
1904
- function ha(e, a, t) {
1905
- return new aa(e, a, t);
1943
+ function ma(e, a, t) {
1944
+ return new sa(e, a, t);
1906
1945
  }
1907
1946
  export {
1908
- la as DslRenderer,
1909
- aa as PresentationBuilder,
1910
- ne as SEMANTIC_TOKENS,
1911
- ta as SlideBuilder,
1912
- ca as TOKEN_NAMES,
1947
+ ga as DslRenderer,
1948
+ sa as PresentationBuilder,
1949
+ se as SEMANTIC_TOKENS,
1950
+ na as SlideBuilder,
1951
+ fa as TOKEN_NAMES,
1913
1952
  ot as compileExpression,
1914
- gt as compileVectorExpression,
1915
- le as darkTheme,
1953
+ mt as compileVectorExpression,
1954
+ ue as darkTheme,
1916
1955
  Ht as lightTheme,
1917
- ha as presentation,
1918
- x as renderElement,
1919
- ce as renderPlayer,
1920
- Bt as renderPresentation,
1921
- se as renderRoot,
1956
+ ma as presentation,
1957
+ v as renderElement,
1958
+ le as renderPlayer,
1959
+ Ut as renderPresentation,
1960
+ ce as renderRoot,
1922
1961
  H as renderScene,
1923
- Ut as renderSlide,
1924
- ua as renderToSvgString,
1962
+ Gt as renderSlide,
1963
+ oa as renderToPng,
1964
+ aa as renderToSvgString,
1925
1965
  u as resolveColor,
1926
- o as resolveEasing,
1927
- te as validate,
1928
- ee as validateExpression
1966
+ g as resolveEasing,
1967
+ ae as validate,
1968
+ te as validateExpression
1929
1969
  };