@elucim/dsl 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.
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { easeOutBounce as ne, easeOutElastic as se, easeOutBack as ce, easeInBack as le, easeInOutExpo as ue, easeOutExpo as he, easeInExpo as fe, easeInOutSine as ge, easeOutSine as oe, easeInSine as ye, easeInOutQuart as me, easeOutQuart as be, easeInQuart as xe, easeInOutCubic as ve, easeOutCubic as de, easeInCubic as ke, easeInOutQuad as we, easeOutQuad as Ie, easeInQuad as Se, linear as $e, spring as Oe, cubicBezier as Ae, Presentation as Ce, Scene as ze, Player as pe, Slide as Ee, Parallel as Fe, Stagger as Pe, Morph as Re, Transform as Ne, Write as Te, Draw as Me, FadeOut as We, FadeIn as _e, BarChart as De, LaTeX as Ve, Graph as Le, Matrix as je, Text as _, VectorField as qe, Vector as Be, FunctionPlot as Ue, Axes as He, Image as Ge, Polygon as Ke, Rect as Qe, Arrow as Xe, Line as Je, Circle as Ye, BezierCurve as Ze, Group as et, Sequence as tt } from "@elucim/core";
2
- import { jsx as c, jsxs as F } from "react/jsx-runtime";
3
- import H, { forwardRef as at, useRef as rt, useImperativeHandle as it } from "react";
4
- import { renderToStaticMarkup as nt } from "react-dom/server";
5
- const L = {
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 L = {
22
22
  max: (...e) => Math.max(...e),
23
23
  sign: Math.sign,
24
24
  pow: Math.pow
25
- }, G = {
25
+ }, J = {
26
26
  PI: Math.PI,
27
27
  E: Math.E,
28
28
  TAU: Math.PI * 2
29
29
  };
30
- function B(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 B(e) {
85
85
  a.push({ type: "COMMA", value: ",", pos: i });
86
86
  break;
87
87
  default:
88
- throw new I(`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 U {
93
+ class Q {
94
94
  constructor(a) {
95
95
  this.pos = 0, this.tokens = a;
96
96
  }
@@ -104,7 +104,7 @@ class U {
104
104
  expect(a) {
105
105
  const t = this.peek();
106
106
  if (t.type !== a)
107
- throw new I(
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 U {
115
115
  const a = this.parseExpression();
116
116
  if (this.peek().type !== "EOF") {
117
117
  const t = this.peek();
118
- throw new I(
118
+ throw new A(
119
119
  `Unexpected token '${t.value}' after expression`,
120
120
  t.pos
121
121
  );
@@ -168,14 +168,14 @@ class U {
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(L, t))
172
- throw new I(
173
- `Unknown function '${t}'. Available: ${Object.keys(L).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(G, t) ? { kind: "number", value: G[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 U {
190
190
  this.advance(), t.push(this.parseExpression());
191
191
  return this.expect("RBRACKET"), { kind: "array", elements: t };
192
192
  }
193
- throw new I(
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 I(`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,95 +223,95 @@ function z(e, a) {
223
223
  break;
224
224
  }
225
225
  case "call": {
226
- const r = L[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 I("Invalid AST node", 0);
232
+ throw new A("Invalid AST node", 0);
233
233
  }
234
- class I 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
- function st(e) {
240
- const a = B(e), t = new U(a).parse();
241
- return (r) => z(t, r);
239
+ function ot(e) {
240
+ const a = K(e), t = new Q(a).parse();
241
+ return (r) => E(t, r);
242
242
  }
243
- function ct(e) {
244
- const a = B(e), t = new U(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 I(
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 J(e) {
252
+ function te(e) {
253
253
  try {
254
- const a = B(e);
255
- return new U(a).parse(), null;
254
+ const a = K(e);
255
+ return new Q(a).parse(), null;
256
256
  } catch (a) {
257
- return a instanceof I ? `${a.message} (at position ${a.position})` : String(a);
258
- }
259
- }
260
- const j = {
261
- linear: $e,
262
- easeInQuad: Se,
263
- easeOutQuad: Ie,
264
- easeInOutQuad: we,
265
- easeInCubic: ke,
266
- easeOutCubic: de,
267
- easeInOutCubic: ve,
268
- easeInQuart: xe,
269
- easeOutQuart: be,
270
- easeInOutQuart: me,
271
- easeInSine: ye,
272
- easeOutSine: oe,
273
- easeInOutSine: ge,
274
- easeInExpo: fe,
275
- easeOutExpo: he,
276
- easeInOutExpo: ue,
277
- easeInBack: le,
278
- easeOutBack: ce,
279
- easeOutElastic: se,
280
- easeOutBounce: ne
257
+ return a instanceof A ? `${a.message} (at position ${a.position})` : String(a);
258
+ }
259
+ }
260
+ const G = {
261
+ linear: Ee,
262
+ easeInQuad: pe,
263
+ easeOutQuad: ze,
264
+ easeInOutQuad: Ae,
265
+ easeInCubic: Ce,
266
+ easeOutCubic: Oe,
267
+ easeInOutCubic: $e,
268
+ easeInQuart: Se,
269
+ easeOutQuart: Ie,
270
+ easeInOutQuart: ke,
271
+ easeInSine: we,
272
+ easeOutSine: ve,
273
+ easeInOutSine: de,
274
+ easeInExpo: xe,
275
+ easeOutExpo: be,
276
+ easeInOutExpo: ye,
277
+ easeInBack: me,
278
+ easeOutBack: oe,
279
+ easeOutElastic: ge,
280
+ easeOutBounce: fe
281
281
  };
282
282
  function g(e) {
283
283
  if (e !== void 0) {
284
284
  if (typeof e == "string") {
285
- const a = j[e];
285
+ const a = G[e];
286
286
  if (!a) {
287
- const t = Object.keys(j), 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 Oe({
293
+ return Fe({
294
294
  stiffness: e.stiffness,
295
295
  damping: e.damping,
296
296
  mass: e.mass
297
297
  });
298
298
  if (e.type === "cubicBezier")
299
- return Ae(e.x1, e.y1, e.x2, e.y2);
299
+ return Re(e.x1, e.y1, e.x2, e.y2);
300
300
  throw new Error(`Unknown easing type: ${e.type}`);
301
301
  }
302
302
  }
303
- const D = Object.keys(j);
304
- function Y(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 }) : (lt(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 K = ["scene", "player", "presentation"], T = ["card", "slide", "square"], V = [
314
+ const Y = ["scene", "player", "presentation"], _ = ["card", "slide", "square"], q = [
315
315
  "sequence",
316
316
  "group",
317
317
  "bezierCurve",
@@ -340,219 +340,219 @@ const K = ["scene", "player", "presentation"], T = ["card", "slide", "square"],
340
340
  "parallel",
341
341
  "player",
342
342
  "scene"
343
- ], Q = ["none", "fade", "slide-left", "slide-up", "zoom"];
344
- function lt(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 (!K.includes(r)) {
347
- t.push({ path: `${a}.type`, message: `Root type must be one of: ${K.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" ? Z(e, a, r, t) : r === "presentation" && ut(e, a, t);
350
+ r === "scene" || r === "player" ? re(e, a, r, t) : r === "presentation" && bt(e, a, t);
351
351
  }
352
- function Z(e, a, t, r) {
353
- Tt(e, "durationInFrames", a, r), m(e, "width", a, r), m(e, "height", a, r), m(e, "fps", a, r), $(e, "background", a, r), e.preset !== void 0 && (typeof e.preset != "string" || !T.includes(e.preset)) && r.push({ path: `${a}.preset`, message: `preset must be one of: ${T.join(", ")}. Got "${e.preset}"`, severity: "error" }), t === "player" && (N(e, "controls", a, r), N(e, "loop", a, r), N(e, "autoPlay", a, r)), O(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 ut(e, a, t) {
356
- if (m(e, "width", a, t), m(e, "height", a, t), $(e, "background", a, t), m(e, "transitionDuration", a, t), N(e, "showHud", a, t), N(e, "showNotes", a, t), e.preset !== void 0 && (typeof e.preset != "string" || !T.includes(e.preset)) && t.push({ path: `${a}.preset`, message: `preset must be one of: ${T.join(", ")}. Got "${e.preset}"`, severity: "error" }), e.transition !== void 0 && (Q.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: ${Q.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
- ht(r, `${a}.slides[${i}]`, t);
365
+ xt(r, `${a}.slides[${i}]`, t);
366
366
  });
367
367
  }
368
- function ht(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
- $(e, "title", a, t), $(e, "notes", a, t), $(e, "background", a, t), e.children !== void 0 && (Array.isArray(e.children) ? e.children.forEach((r, i) => {
374
- ee(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 O(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
- ee(r, `${a}.children[${i}]`, t);
383
+ ie(r, `${a}.children[${i}]`, t);
384
384
  });
385
385
  }
386
- function ee(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
- if (!r || !V.includes(r)) {
393
- const i = r ? te(r, V) : "";
392
+ if (!r || !q.includes(r)) {
393
+ const i = r ? ne(r, q) : "";
394
394
  t.push({
395
395
  path: `${a}.type`,
396
- message: `Unknown element type "${r}".${i} Valid types: ${V.join(", ")}`,
396
+ message: `Unknown element type "${r}".${i} Valid types: ${q.join(", ")}`,
397
397
  severity: "error"
398
398
  });
399
399
  return;
400
400
  }
401
401
  switch (r) {
402
402
  case "bezierCurve":
403
- ft(e, a, t);
403
+ dt(e, a, t);
404
404
  break;
405
405
  case "circle":
406
- gt(e, a, t);
406
+ vt(e, a, t);
407
407
  break;
408
408
  case "line":
409
- ot(e, a, t);
409
+ wt(e, a, t);
410
410
  break;
411
411
  case "arrow":
412
- yt(e, a, t);
412
+ kt(e, a, t);
413
413
  break;
414
414
  case "rect":
415
- mt(e, a, t);
415
+ It(e, a, t);
416
416
  break;
417
417
  case "polygon":
418
- bt(e, a, t);
418
+ St(e, a, t);
419
419
  break;
420
420
  case "text":
421
- xt(e, a, t);
421
+ $t(e, a, t);
422
422
  break;
423
423
  case "image":
424
- Pt(e, a, t);
424
+ _t(e, a, t);
425
425
  break;
426
426
  case "axes":
427
- vt(e, a, t);
427
+ Ot(e, a, t);
428
428
  break;
429
429
  case "functionPlot":
430
- dt(e, a, t);
430
+ Ct(e, a, t);
431
431
  break;
432
432
  case "vector":
433
- kt(e, a, t);
433
+ At(e, a, t);
434
434
  break;
435
435
  case "vectorField":
436
- wt(e, a, t);
436
+ zt(e, a, t);
437
437
  break;
438
438
  case "matrix":
439
- It(e, a, t);
439
+ pt(e, a, t);
440
440
  break;
441
441
  case "graph":
442
- St(e, a, t);
442
+ Et(e, a, t);
443
443
  break;
444
444
  case "latex":
445
- $t(e, a, t);
445
+ Ft(e, a, t);
446
446
  break;
447
447
  case "barChart":
448
- Nt(e, a, t);
448
+ Lt(e, a, t);
449
449
  break;
450
450
  case "sequence":
451
- Ot(e, a, t);
451
+ Rt(e, a, t);
452
452
  break;
453
453
  case "group":
454
- Rt(e, a, t);
454
+ Vt(e, a, t);
455
455
  break;
456
456
  case "parallel":
457
- O(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
- At(e, a, t);
463
+ Pt(e, a, t);
464
464
  break;
465
465
  case "transform":
466
- Ct(e, a, t);
466
+ Mt(e, a, t);
467
467
  break;
468
468
  case "morph":
469
- zt(e, a, t);
469
+ Tt(e, a, t);
470
470
  break;
471
471
  case "stagger":
472
- pt(e, a, t);
472
+ Nt(e, a, t);
473
473
  break;
474
474
  case "scene":
475
475
  case "player":
476
- Z(e, a, r, t);
476
+ re(e, a, r, t);
477
477
  break;
478
478
  }
479
479
  }
480
- function ft(e, a, t) {
481
- f(e, "x1", a, t), f(e, "y1", a, t), f(e, "cx1", a, t), f(e, "cy1", a, t), f(e, "x2", a, t), f(e, "y2", a, t), e.cx2 !== void 0 && P(e, "cx2", a, t), e.cy2 !== void 0 && P(e, "cy2", a, t), d(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
- function gt(e, a, t) {
484
- f(e, "cx", a, t), f(e, "cy", a, t), p(e, "r", a, t), d(e, a, t);
483
+ function vt(e, a, t) {
484
+ h(e, "cx", a, t), h(e, "cy", a, t), F(e, "r", a, t), w(e, a, t);
485
485
  }
486
- function ot(e, a, t) {
487
- f(e, "x1", a, t), f(e, "y1", a, t), f(e, "x2", a, t), f(e, "y2", a, t), d(e, a, t);
486
+ function wt(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);
488
488
  }
489
- function yt(e, a, t) {
490
- f(e, "x1", a, t), f(e, "y1", a, t), f(e, "x2", a, t), f(e, "y2", a, t), d(e, a, t);
489
+ function kt(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);
491
491
  }
492
- function mt(e, a, t) {
493
- f(e, "x", a, t), f(e, "y", a, t), p(e, "width", a, t), p(e, "height", a, t), d(e, a, t);
492
+ function It(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);
494
494
  }
495
- function bt(e, a, t) {
495
+ function St(e, a, t) {
496
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
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" }), d(e, a, t);
498
+ }) : t.push({ path: `${a}.points`, message: 'Polygon requires a "points" array', severity: "error" }), w(e, a, t);
499
499
  }
500
- function xt(e, a, t) {
501
- f(e, "x", a, t), f(e, "y", a, t), typeof e.content != "string" && t.push({ path: `${a}.content`, message: 'Text requires a "content" string', severity: "error" }), d(e, a, t);
500
+ function $t(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);
502
502
  }
503
- function vt(e, a, t) {
504
- k(e, "domain", a, t), k(e, "range", a, t), k(e, "origin", a, t), M(e, a, t);
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
505
  }
506
- function dt(e, a, t) {
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 = J(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), M(e, a, t);
513
+ S(e, "domain", a, t), V(e, a, t);
514
514
  }
515
- function kt(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), M(e, a, t);
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" }), S(e, "from", a, t), V(e, a, t);
517
517
  }
518
- function wt(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 = J(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), M(e, a, t);
525
+ S(e, "domain", a, t), S(e, "range", a, t), V(e, a, t);
526
526
  }
527
- function It(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" }), d(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 St(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 {
536
536
  const r = /* @__PURE__ */ new Set();
537
537
  e.nodes.forEach((i, n) => {
538
- typeof i.id != "string" ? t.push({ path: `${a}.nodes[${n}].id`, message: 'Graph node requires a string "id"', severity: "error" }) : (r.has(i.id) && t.push({ path: `${a}.nodes[${n}].id`, message: `Duplicate node id "${i.id}"`, severity: "error" }), r.add(i.id)), f(i, "x", `${a}.nodes[${n}]`, t), f(i, "y", `${a}.nodes[${n}]`, t);
538
+ typeof i.id != "string" ? t.push({ path: `${a}.nodes[${n}].id`, message: 'Graph node requires a string "id"', severity: "error" }) : (r.has(i.id) && t.push({ path: `${a}.nodes[${n}].id`, message: `Duplicate node id "${i.id}"`, severity: "error" }), r.add(i.id)), h(i, "x", `${a}.nodes[${n}]`, t), h(i, "y", `${a}.nodes[${n}]`, t);
539
539
  }), Array.isArray(e.edges) && e.edges.forEach((i, n) => {
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
- d(e, a, t);
543
+ w(e, a, t);
544
544
  }
545
- function $t(e, a, t) {
546
- typeof e.expression != "string" && t.push({ path: `${a}.expression`, message: 'LaTeX requires an "expression" string', severity: "error" }), f(e, "x", a, t), f(e, "y", a, t), d(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
- function Ot(e, a, t) {
549
- f(e, "from", a, t), Mt(e, "durationInFrames", a, t), O(e, a, t);
548
+ function Rt(e, a, t) {
549
+ h(e, "from", a, t), Bt(e, "durationInFrames", a, t), p(e, a, t);
550
550
  }
551
- function At(e, a, t) {
552
- m(e, "duration", a, t), R(e, a, t), O(e, a, t);
551
+ function Pt(e, a, t) {
552
+ b(e, "duration", a, t), M(e, a, t), p(e, a, t);
553
553
  }
554
- function Ct(e, a, t) {
555
- if (m(e, "duration", a, t), R(e, a, t), e.translate !== void 0) {
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 Ct(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
- O(e, a, t);
571
+ p(e, a, t);
572
572
  }
573
- function zt(e, a, t) {
574
- m(e, "duration", a, t), R(e, a, t), $(e, "fromColor", a, t), $(e, "toColor", a, t), O(e, a, t);
573
+ function Tt(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 pt(e, a, t) {
577
- m(e, "staggerDelay", a, t), R(e, a, t), O(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 d(e, a, t) {
580
- m(e, "fadeIn", a, t), m(e, "fadeOut", a, t), m(e, "draw", a, t), R(e, a, t), Et(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 M(e, a, t) {
583
- m(e, "fadeIn", a, t), m(e, "fadeOut", a, t), m(e, "draw", a, t), R(e, a, t), Ft(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 X = ["none", "circle", "ellipse"];
586
- function Et(e, a, t) {
587
- if (P(e, "rotation", a, t), k(e, "rotationOrigin", a, t), k(e, "translate", a, t), P(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 Ft(e, a, t) {
593
- P(e, "rotation", a, t), k(e, "rotationOrigin", a, t), k(e, "translate", a, t), P(e, "zIndex", a, t);
592
+ function Dt(e, a, t) {
593
+ P(e, "rotation", a, t), S(e, "rotationOrigin", a, t), S(e, "translate", a, t), P(e, "zIndex", a, t);
594
594
  }
595
- function Pt(e, a, t) {
596
- typeof e.src != "string" && t.push({ path: `${a}.src`, message: 'Image requires a "src" string', severity: "error" }), f(e, "x", a, t), f(e, "y", a, t), p(e, "width", a, t), p(e, "height", a, t), $(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 && (X.includes(e.clipShape) || t.push({
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: ${X.join(", ")}`,
598
+ message: `Invalid clipShape "${e.clipShape}". Must be one of: ${ee.join(", ")}`,
599
599
  severity: "error"
600
- })), d(e, a, t);
600
+ })), w(e, a, t);
601
601
  }
602
- function Rt(e, a, t) {
603
- O(e, a, t), d(e, a, t);
602
+ function Vt(e, a, t) {
603
+ p(e, a, t), w(e, a, t);
604
604
  }
605
- function Nt(e, a, t) {
606
- f(e, "x", a, t), f(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" }), d(e, a, t);
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 R(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 (!D.includes(e.easing)) {
612
- const r = te(e.easing, D);
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: ${D.join(", ")}`,
615
+ message: `Unknown easing "${e.easing}".${r} Available: ${B.join(", ")}`,
616
616
  severity: "error"
617
617
  });
618
618
  }
@@ -632,45 +632,47 @@ function R(e, a, t) {
632
632
  t.push({ path: `${a}.easing`, message: 'Easing must be a string name or { type: "spring"|"cubicBezier", ... }', severity: "error" });
633
633
  }
634
634
  }
635
- function f(e, a, t, r) {
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 Tt(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 m(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 Mt(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 $(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
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 te(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 ae = {
672
- foreground: { cssVar: "--elucim-foreground", fallback: "#e0e0e0" },
673
- background: { cssVar: "--elucim-background", fallback: "#0f172a" },
671
+ const se = {
672
+ foreground: { cssVar: "--elucim-foreground", fallback: "#c8d6e5" },
673
+ background: { cssVar: "--elucim-background", fallback: "#0a0a1e" },
674
+ title: { cssVar: "--elucim-title", fallback: "#e0e7ff" },
675
+ subtitle: { cssVar: "--elucim-subtitle", fallback: "#94a3b8" },
674
676
  accent: { cssVar: "--elucim-accent", fallback: "#4fc3f7" },
675
677
  muted: { cssVar: "--elucim-muted", fallback: "#64748b" },
676
678
  surface: { cssVar: "--elucim-surface", fallback: "#1e293b" },
@@ -681,31 +683,31 @@ const ae = {
681
683
  success: { cssVar: "--elucim-success", fallback: "#34d399" },
682
684
  warning: { cssVar: "--elucim-warning", fallback: "#fbbf24" },
683
685
  error: { cssVar: "--elucim-error", fallback: "#f87171" }
684
- }, Qt = Object.keys(ae);
685
- function h(e) {
686
+ }, fa = Object.keys(se);
687
+ function u(e) {
686
688
  if (e === void 0) return;
687
689
  if (!e.startsWith("$")) return e;
688
- const a = e.slice(1), t = ae[a];
690
+ const a = e.slice(1), t = se[a];
689
691
  return t ? `var(${t.cssVar}, ${t.fallback})` : `var(--elucim-${a})`;
690
692
  }
691
- const Wt = {
693
+ const qt = {
692
694
  card: [640, 360],
693
695
  slide: [1280, 720],
694
696
  square: [600, 600]
695
697
  };
696
- function W(e, a, t) {
698
+ function L(e, a, t) {
697
699
  if (!e) return { width: a, height: t };
698
- const [r, i] = Wt[e];
700
+ const [r, i] = qt[e];
699
701
  return { width: a ?? r, height: t ?? i };
700
702
  }
701
- function re(e, a) {
703
+ function ce(e, a) {
702
704
  switch (e.type) {
703
705
  case "scene":
704
- return q(e, a);
706
+ return H(e, a);
705
707
  case "player":
706
708
  if ((a == null ? void 0 : a.frame) !== void 0) {
707
- const { width: t, height: r } = W(e.preset, e.width, e.height);
708
- return q(
709
+ const { width: t, height: r } = L(e.preset, e.width, e.height);
710
+ return H(
709
711
  {
710
712
  width: t,
711
713
  height: r,
@@ -717,72 +719,74 @@ function re(e, a) {
717
719
  a
718
720
  );
719
721
  }
720
- return ie(e, a);
722
+ return le(e, a);
721
723
  case "presentation":
722
- return _t(e);
724
+ return Ut(e);
723
725
  }
724
726
  }
725
- function q(e, a) {
726
- const t = (a == null ? void 0 : a.frame) !== void 0, { width: r, height: i } = W(e.preset, e.width, e.height);
727
- return /* @__PURE__ */ c(
728
- ze,
727
+ function H(e, a) {
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,
729
731
  {
730
732
  width: r,
731
733
  height: i,
732
734
  fps: e.fps,
733
735
  durationInFrames: e.durationInFrames,
734
- background: h(e.background),
736
+ background: u(e.background),
737
+ colorScheme: a == null ? void 0 : a.colorScheme,
735
738
  ...t ? { frame: a.frame, autoPlay: !1 } : {},
736
739
  children: e.children.map((n, s) => v(n, s))
737
740
  }
738
741
  );
739
742
  }
740
- function ie(e, a) {
741
- const { width: t, height: r } = W(e.preset, e.width, e.height);
742
- return /* @__PURE__ */ c(
743
- pe,
743
+ function le(e, a) {
744
+ const { width: t, height: r } = L(e.preset, e.width, e.height);
745
+ return /* @__PURE__ */ l(
746
+ Te,
744
747
  {
745
748
  ref: a == null ? void 0 : a.playerRef,
746
749
  width: t,
747
750
  height: r,
748
751
  fps: e.fps,
749
752
  durationInFrames: e.durationInFrames,
750
- background: h(e.background),
753
+ background: u(e.background),
751
754
  controls: e.controls,
752
755
  loop: e.loop,
753
756
  autoPlay: e.autoPlay,
757
+ colorScheme: a == null ? void 0 : a.colorScheme,
754
758
  children: e.children.map((i, n) => v(i, n))
755
759
  }
756
760
  );
757
761
  }
758
- function _t(e) {
759
- const { width: a, height: t } = W(e.preset, e.width, e.height);
760
- return /* @__PURE__ */ c(
761
- Ce,
762
+ function Ut(e) {
763
+ const { width: a, height: t } = L(e.preset, e.width, e.height);
764
+ return /* @__PURE__ */ l(
765
+ Pe,
762
766
  {
763
767
  width: a,
764
768
  height: t,
765
- background: h(e.background),
769
+ background: u(e.background),
766
770
  transition: e.transition,
767
771
  transitionDuration: e.transitionDuration,
768
772
  showHUD: e.showHud,
769
773
  showNotes: e.showNotes,
770
- children: e.slides.map((r, i) => Dt(r, i))
774
+ children: e.slides.map((r, i) => Gt(r, i))
771
775
  }
772
776
  );
773
777
  }
774
- function Dt(e, a) {
778
+ function Gt(e, a) {
775
779
  var t;
776
- return /* @__PURE__ */ c(Ee, { title: e.title, notes: e.notes, background: h(e.background), children: (t = e.children) == null ? void 0 : t.map((r, i) => v(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);
777
781
  }
778
782
  function v(e, a) {
779
783
  var t, r, i, n;
780
784
  switch (e.type) {
781
785
  case "sequence":
782
- return /* @__PURE__ */ c(tt, { from: e.from, durationInFrames: e.durationInFrames, name: e.name, children: e.children.map((s, l) => v(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);
783
787
  case "group":
784
- return /* @__PURE__ */ c(
785
- et,
788
+ return /* @__PURE__ */ l(
789
+ st,
786
790
  {
787
791
  fadeIn: e.fadeIn,
788
792
  fadeOut: e.fadeOut,
@@ -792,13 +796,13 @@ function v(e, a) {
792
796
  scale: e.scale,
793
797
  translate: e.translate,
794
798
  zIndex: e.zIndex,
795
- children: e.children.map((s, l) => v(s, l))
799
+ children: e.children.map((s, c) => v(s, c))
796
800
  },
797
801
  a
798
802
  );
799
803
  case "bezierCurve":
800
- return /* @__PURE__ */ c(
801
- Ze,
804
+ return /* @__PURE__ */ l(
805
+ nt,
802
806
  {
803
807
  x1: e.x1,
804
808
  y1: e.y1,
@@ -808,9 +812,9 @@ function v(e, a) {
808
812
  cy2: e.cy2,
809
813
  x2: e.x2,
810
814
  y2: e.y2,
811
- stroke: h(e.stroke),
815
+ stroke: u(e.stroke),
812
816
  strokeWidth: e.strokeWidth,
813
- fill: h(e.fill),
817
+ fill: u(e.fill),
814
818
  strokeDasharray: e.strokeDasharray,
815
819
  opacity: e.opacity,
816
820
  fadeIn: e.fadeIn,
@@ -826,14 +830,14 @@ function v(e, a) {
826
830
  a
827
831
  );
828
832
  case "circle":
829
- return /* @__PURE__ */ c(
830
- Ye,
833
+ return /* @__PURE__ */ l(
834
+ it,
831
835
  {
832
836
  cx: e.cx,
833
837
  cy: e.cy,
834
838
  r: e.r,
835
- fill: h(e.fill),
836
- stroke: h(e.stroke),
839
+ fill: u(e.fill),
840
+ stroke: u(e.stroke),
837
841
  strokeWidth: e.strokeWidth,
838
842
  opacity: e.opacity,
839
843
  fadeIn: e.fadeIn,
@@ -849,14 +853,14 @@ function v(e, a) {
849
853
  a
850
854
  );
851
855
  case "line":
852
- return /* @__PURE__ */ c(
853
- Je,
856
+ return /* @__PURE__ */ l(
857
+ rt,
854
858
  {
855
859
  x1: e.x1,
856
860
  y1: e.y1,
857
861
  x2: e.x2,
858
862
  y2: e.y2,
859
- stroke: h(e.stroke),
863
+ stroke: u(e.stroke),
860
864
  strokeWidth: e.strokeWidth,
861
865
  strokeDasharray: e.strokeDasharray,
862
866
  opacity: e.opacity,
@@ -873,14 +877,14 @@ function v(e, a) {
873
877
  a
874
878
  );
875
879
  case "arrow":
876
- return /* @__PURE__ */ c(
877
- Xe,
880
+ return /* @__PURE__ */ l(
881
+ at,
878
882
  {
879
883
  x1: e.x1,
880
884
  y1: e.y1,
881
885
  x2: e.x2,
882
886
  y2: e.y2,
883
- stroke: h(e.stroke),
887
+ stroke: u(e.stroke),
884
888
  strokeWidth: e.strokeWidth,
885
889
  headSize: e.headSize,
886
890
  strokeDasharray: e.strokeDasharray,
@@ -898,15 +902,15 @@ function v(e, a) {
898
902
  a
899
903
  );
900
904
  case "rect":
901
- return /* @__PURE__ */ c(
902
- Qe,
905
+ return /* @__PURE__ */ l(
906
+ tt,
903
907
  {
904
908
  x: e.x,
905
909
  y: e.y,
906
910
  width: e.width,
907
911
  height: e.height,
908
- fill: h(e.fill),
909
- stroke: h(e.stroke),
912
+ fill: u(e.fill),
913
+ stroke: u(e.stroke),
910
914
  strokeWidth: e.strokeWidth,
911
915
  rx: e.rx,
912
916
  ry: e.ry,
@@ -925,12 +929,12 @@ function v(e, a) {
925
929
  a
926
930
  );
927
931
  case "polygon":
928
- return /* @__PURE__ */ c(
929
- Ke,
932
+ return /* @__PURE__ */ l(
933
+ et,
930
934
  {
931
935
  points: e.points,
932
- fill: h(e.fill),
933
- stroke: h(e.stroke),
936
+ fill: u(e.fill),
937
+ stroke: u(e.stroke),
934
938
  strokeWidth: e.strokeWidth,
935
939
  closed: e.closed,
936
940
  opacity: e.opacity,
@@ -947,12 +951,12 @@ function v(e, a) {
947
951
  a
948
952
  );
949
953
  case "text":
950
- return /* @__PURE__ */ c(
951
- _,
954
+ return /* @__PURE__ */ l(
955
+ j,
952
956
  {
953
957
  x: e.x,
954
958
  y: e.y,
955
- fill: h(e.fill),
959
+ fill: u(e.fill),
956
960
  fontSize: e.fontSize,
957
961
  fontFamily: e.fontFamily,
958
962
  fontWeight: e.fontWeight,
@@ -972,8 +976,8 @@ function v(e, a) {
972
976
  a
973
977
  );
974
978
  case "image":
975
- return /* @__PURE__ */ c(
976
- Ge,
979
+ return /* @__PURE__ */ l(
980
+ Ze,
977
981
  {
978
982
  src: e.src,
979
983
  x: e.x,
@@ -996,8 +1000,8 @@ function v(e, a) {
996
1000
  a
997
1001
  );
998
1002
  case "axes":
999
- return /* @__PURE__ */ c(
1000
- He,
1003
+ return /* @__PURE__ */ l(
1004
+ Ye,
1001
1005
  {
1002
1006
  domain: e.domain,
1003
1007
  range: e.range,
@@ -1007,9 +1011,9 @@ function v(e, a) {
1007
1011
  showTicks: e.showTicks,
1008
1012
  showLabels: e.showLabels,
1009
1013
  tickStep: e.tickStep,
1010
- axisColor: h(e.axisColor),
1011
- gridColor: h(e.gridColor),
1012
- labelColor: h(e.labelColor),
1014
+ axisColor: u(e.axisColor),
1015
+ gridColor: u(e.gridColor),
1016
+ labelColor: u(e.labelColor),
1013
1017
  labelFontSize: e.labelFontSize,
1014
1018
  fadeIn: e.fadeIn,
1015
1019
  fadeOut: e.fadeOut,
@@ -1025,10 +1029,10 @@ function v(e, a) {
1025
1029
  case "functionPlot": {
1026
1030
  let s;
1027
1031
  try {
1028
- s = st(e.fn);
1032
+ s = ot(e.fn);
1029
1033
  } catch {
1030
- return /* @__PURE__ */ c(
1031
- _,
1034
+ return /* @__PURE__ */ l(
1035
+ j,
1032
1036
  {
1033
1037
  x: ((t = e.origin) == null ? void 0 : t[0]) ?? 400,
1034
1038
  y: (((r = e.origin) == null ? void 0 : r[1]) ?? 300) - 20,
@@ -1040,15 +1044,15 @@ function v(e, a) {
1040
1044
  a
1041
1045
  );
1042
1046
  }
1043
- return /* @__PURE__ */ c(
1044
- Ue,
1047
+ return /* @__PURE__ */ l(
1048
+ Je,
1045
1049
  {
1046
- fn: (l) => s({ x: l }),
1050
+ fn: (c) => s({ x: c }),
1047
1051
  domain: e.domain,
1048
1052
  yClamp: e.yClamp,
1049
1053
  origin: e.origin,
1050
1054
  scale: e.scale,
1051
- color: h(e.color),
1055
+ color: u(e.color),
1052
1056
  strokeWidth: e.strokeWidth,
1053
1057
  samples: e.samples,
1054
1058
  draw: e.draw,
@@ -1063,19 +1067,19 @@ function v(e, a) {
1063
1067
  );
1064
1068
  }
1065
1069
  case "vector":
1066
- return /* @__PURE__ */ c(
1067
- Be,
1070
+ return /* @__PURE__ */ l(
1071
+ Xe,
1068
1072
  {
1069
1073
  from: e.from,
1070
1074
  to: e.to,
1071
1075
  origin: e.origin,
1072
1076
  scale: e.scale,
1073
- color: h(e.color),
1077
+ color: u(e.color),
1074
1078
  strokeWidth: e.strokeWidth,
1075
1079
  headSize: e.headSize,
1076
1080
  label: e.label,
1077
1081
  labelOffset: e.labelOffset,
1078
- labelColor: h(e.labelColor),
1082
+ labelColor: u(e.labelColor),
1079
1083
  labelFontSize: e.labelFontSize,
1080
1084
  fadeIn: e.fadeIn,
1081
1085
  fadeOut: e.fadeOut,
@@ -1091,10 +1095,10 @@ function v(e, a) {
1091
1095
  case "vectorField": {
1092
1096
  let s;
1093
1097
  try {
1094
- s = ct(e.fn);
1098
+ s = mt(e.fn);
1095
1099
  } catch {
1096
- return /* @__PURE__ */ c(
1097
- _,
1100
+ return /* @__PURE__ */ l(
1101
+ j,
1098
1102
  {
1099
1103
  x: ((i = e.origin) == null ? void 0 : i[0]) ?? 400,
1100
1104
  y: (((n = e.origin) == null ? void 0 : n[1]) ?? 300) - 20,
@@ -1106,17 +1110,17 @@ function v(e, a) {
1106
1110
  a
1107
1111
  );
1108
1112
  }
1109
- return /* @__PURE__ */ c(
1110
- qe,
1113
+ return /* @__PURE__ */ l(
1114
+ Qe,
1111
1115
  {
1112
- fn: (l, b) => s({ x: l, y: b }),
1116
+ fn: (c, x) => s({ x: c, y: x }),
1113
1117
  domain: e.domain,
1114
1118
  range: e.range,
1115
1119
  step: e.step,
1116
1120
  origin: e.origin,
1117
1121
  scale: e.scale,
1118
1122
  arrowScale: e.arrowScale,
1119
- color: h(e.color),
1123
+ color: u(e.color),
1120
1124
  strokeWidth: e.strokeWidth,
1121
1125
  headSize: e.headSize,
1122
1126
  normalize: e.normalize,
@@ -1133,15 +1137,15 @@ function v(e, a) {
1133
1137
  );
1134
1138
  }
1135
1139
  case "matrix":
1136
- return /* @__PURE__ */ c(
1137
- je,
1140
+ return /* @__PURE__ */ l(
1141
+ Ke,
1138
1142
  {
1139
1143
  values: e.values,
1140
1144
  x: e.x,
1141
1145
  y: e.y,
1142
1146
  cellSize: e.cellSize,
1143
- color: h(e.color),
1144
- bracketColor: h(e.bracketColor),
1147
+ color: u(e.color),
1148
+ bracketColor: u(e.bracketColor),
1145
1149
  fontSize: e.fontSize,
1146
1150
  fadeIn: e.fadeIn,
1147
1151
  fadeOut: e.fadeOut,
@@ -1155,16 +1159,16 @@ function v(e, a) {
1155
1159
  a
1156
1160
  );
1157
1161
  case "graph":
1158
- return /* @__PURE__ */ c(
1159
- Le,
1162
+ return /* @__PURE__ */ l(
1163
+ He,
1160
1164
  {
1161
1165
  nodes: e.nodes,
1162
1166
  edges: e.edges,
1163
- nodeColor: h(e.nodeColor),
1167
+ nodeColor: u(e.nodeColor),
1164
1168
  nodeRadius: e.nodeRadius,
1165
- edgeColor: h(e.edgeColor),
1169
+ edgeColor: u(e.edgeColor),
1166
1170
  edgeWidth: e.edgeWidth,
1167
- labelColor: h(e.labelColor),
1171
+ labelColor: u(e.labelColor),
1168
1172
  labelFontSize: e.labelFontSize,
1169
1173
  fadeIn: e.fadeIn,
1170
1174
  fadeOut: e.fadeOut,
@@ -1178,13 +1182,13 @@ function v(e, a) {
1178
1182
  a
1179
1183
  );
1180
1184
  case "latex":
1181
- return /* @__PURE__ */ c(
1182
- Ve,
1185
+ return /* @__PURE__ */ l(
1186
+ Ge,
1183
1187
  {
1184
1188
  expression: e.expression,
1185
1189
  x: e.x,
1186
1190
  y: e.y,
1187
- color: h(e.color),
1191
+ color: u(e.color),
1188
1192
  fontSize: e.fontSize,
1189
1193
  align: e.align,
1190
1194
  fadeIn: e.fadeIn,
@@ -1199,16 +1203,16 @@ function v(e, a) {
1199
1203
  a
1200
1204
  );
1201
1205
  case "barChart":
1202
- return /* @__PURE__ */ c(
1203
- De,
1206
+ return /* @__PURE__ */ l(
1207
+ Ue,
1204
1208
  {
1205
1209
  bars: e.bars,
1206
1210
  x: e.x,
1207
1211
  y: e.y,
1208
1212
  width: e.width,
1209
1213
  height: e.height,
1210
- barColor: h(e.barColor),
1211
- labelColor: h(e.labelColor),
1214
+ barColor: u(e.barColor),
1215
+ labelColor: u(e.labelColor),
1212
1216
  labelFontSize: e.labelFontSize,
1213
1217
  showValues: e.showValues,
1214
1218
  maxValue: e.maxValue,
@@ -1226,16 +1230,16 @@ function v(e, a) {
1226
1230
  a
1227
1231
  );
1228
1232
  case "fadeIn":
1229
- return /* @__PURE__ */ c(_e, { duration: e.duration, easing: g(e.easing), children: e.children.map((s, l) => v(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);
1230
1234
  case "fadeOut":
1231
- return /* @__PURE__ */ c(We, { duration: e.duration, totalFrames: e.totalFrames, easing: g(e.easing), children: e.children.map((s, l) => v(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);
1232
1236
  case "draw":
1233
- return /* @__PURE__ */ c(Me, { duration: e.duration, pathLength: e.pathLength, easing: g(e.easing), children: v(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);
1234
1238
  case "write":
1235
- return /* @__PURE__ */ c(Te, { duration: e.duration, easing: g(e.easing), children: e.children.map((s, l) => v(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);
1236
1240
  case "transform":
1237
- return /* @__PURE__ */ c(
1238
- Ne,
1241
+ return /* @__PURE__ */ l(
1242
+ Ve,
1239
1243
  {
1240
1244
  duration: e.duration,
1241
1245
  easing: g(e.easing),
@@ -1243,122 +1247,190 @@ function v(e, a) {
1243
1247
  scale: e.scale,
1244
1248
  rotate: e.rotate,
1245
1249
  opacity: e.opacity,
1246
- children: e.children.map((s, l) => v(s, l))
1250
+ children: e.children.map((s, c) => v(s, c))
1247
1251
  },
1248
1252
  a
1249
1253
  );
1250
1254
  case "morph":
1251
- return /* @__PURE__ */ c(
1252
- Re,
1255
+ return /* @__PURE__ */ l(
1256
+ _e,
1253
1257
  {
1254
1258
  duration: e.duration,
1255
1259
  easing: g(e.easing),
1256
- fromColor: h(e.fromColor),
1257
- toColor: h(e.toColor),
1260
+ fromColor: u(e.fromColor),
1261
+ toColor: u(e.toColor),
1258
1262
  fromOpacity: e.fromOpacity,
1259
1263
  toOpacity: e.toOpacity,
1260
1264
  fromScale: e.fromScale,
1261
1265
  toScale: e.toScale,
1262
- children: e.children.map((s, l) => v(s, l))
1266
+ children: e.children.map((s, c) => v(s, c))
1263
1267
  },
1264
1268
  a
1265
1269
  );
1266
1270
  case "stagger":
1267
- return /* @__PURE__ */ c(Pe, { staggerDelay: e.staggerDelay, easing: g(e.easing), children: e.children.map((s, l) => v(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);
1268
1272
  case "parallel":
1269
- return /* @__PURE__ */ c(Fe, { children: e.children.map((s, l) => v(s, l)) }, a);
1273
+ return /* @__PURE__ */ l(We, { children: e.children.map((s, c) => v(s, c)) }, a);
1270
1274
  case "scene":
1271
- return /* @__PURE__ */ c(H.Fragment, { children: q(e) }, a);
1275
+ return /* @__PURE__ */ l(X.Fragment, { children: H(e) }, a);
1272
1276
  case "player":
1273
- return /* @__PURE__ */ c(H.Fragment, { children: ie(e) }, a);
1277
+ return /* @__PURE__ */ l(X.Fragment, { children: le(e) }, a);
1274
1278
  default:
1275
1279
  return null;
1276
1280
  }
1277
1281
  }
1278
- function Vt(e) {
1282
+ const ue = {
1283
+ background: "#0a0a1e",
1284
+ title: "#e0e7ff",
1285
+ subtitle: "#94a3b8",
1286
+ primary: "#4fc3f7",
1287
+ secondary: "#a78bfa",
1288
+ tertiary: "#f472b6",
1289
+ muted: "#64748b",
1290
+ text: "#c8d6e5",
1291
+ boxFill: "rgba(79,195,247,0.12)",
1292
+ boxStroke: "#4fc3f7",
1293
+ success: "#34d399",
1294
+ warning: "#fbbf24",
1295
+ error: "#f87171",
1296
+ palette: ["#4fc3f7", "#a78bfa", "#f472b6", "#34d399", "#fbbf24", "#fb923c", "#6366f1", "#22d3ee"]
1297
+ }, Ht = {
1298
+ background: "#f8fafc",
1299
+ title: "#1e293b",
1300
+ subtitle: "#64748b",
1301
+ primary: "#2563eb",
1302
+ secondary: "#7c3aed",
1303
+ tertiary: "#db2777",
1304
+ muted: "#94a3b8",
1305
+ text: "#334155",
1306
+ boxFill: "rgba(37,99,235,0.08)",
1307
+ boxStroke: "#2563eb",
1308
+ success: "#16a34a",
1309
+ warning: "#d97706",
1310
+ error: "#dc2626",
1311
+ palette: ["#2563eb", "#7c3aed", "#db2777", "#16a34a", "#d97706", "#ea580c", "#4f46e5", "#0891b2"]
1312
+ };
1313
+ function Kt(e) {
1279
1314
  if (!e) return {};
1280
1315
  const a = {};
1281
1316
  for (const [t, r] of Object.entries(e))
1282
1317
  r !== void 0 && (a[`--elucim-${t}`] = r);
1283
1318
  return a;
1284
1319
  }
1285
- const Xt = at(function({ dsl: a, className: t, style: r, theme: i, poster: n, onError: s }, l) {
1286
- const b = rt(null);
1287
- it(l, () => ({
1320
+ function he(e) {
1321
+ return {
1322
+ "--elucim-foreground": e.text,
1323
+ "--elucim-background": e.background,
1324
+ "--elucim-title": e.title,
1325
+ "--elucim-subtitle": e.subtitle,
1326
+ "--elucim-accent": e.primary,
1327
+ "--elucim-muted": e.muted,
1328
+ "--elucim-surface": e.background,
1329
+ "--elucim-primary": e.primary,
1330
+ "--elucim-secondary": e.secondary,
1331
+ "--elucim-tertiary": e.tertiary,
1332
+ "--elucim-success": e.success,
1333
+ "--elucim-warning": e.warning,
1334
+ "--elucim-error": e.error
1335
+ };
1336
+ }
1337
+ const Qt = he(ue), Xt = he(Ht);
1338
+ function Jt(e) {
1339
+ if (typeof window > "u" || typeof window.matchMedia != "function") return () => {
1340
+ };
1341
+ const a = window.matchMedia("(prefers-color-scheme: dark)");
1342
+ return a.addEventListener("change", e), () => a.removeEventListener("change", e);
1343
+ }
1344
+ function Yt() {
1345
+ return typeof window > "u" || typeof window.matchMedia != "function" ? !0 : window.matchMedia("(prefers-color-scheme: dark)").matches;
1346
+ }
1347
+ function Zt() {
1348
+ return !0;
1349
+ }
1350
+ function ea() {
1351
+ return ft(Jt, Yt, Zt);
1352
+ }
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, () => ({
1288
1356
  getSvgElement: () => {
1289
- var u;
1290
- return ((u = b.current) == null ? void 0 : u.getSvgElement()) ?? null;
1357
+ var f;
1358
+ return ((f = o.current) == null ? void 0 : f.getSvgElement()) ?? null;
1291
1359
  },
1292
- seekToFrame: (u) => {
1293
- var o;
1294
- return (o = b.current) == null ? void 0 : o.seekToFrame(u);
1360
+ seekToFrame: (f) => {
1361
+ var C;
1362
+ return (C = o.current) == null ? void 0 : C.seekToFrame(f);
1295
1363
  },
1296
1364
  getTotalFrames: () => {
1297
- var u;
1298
- return ((u = b.current) == null ? void 0 : u.getTotalFrames()) ?? 0;
1365
+ var f;
1366
+ return ((f = o.current) == null ? void 0 : f.getTotalFrames()) ?? 0;
1299
1367
  },
1300
1368
  play: () => {
1301
- var u;
1302
- return (u = b.current) == null ? void 0 : u.play();
1369
+ var f;
1370
+ return (f = o.current) == null ? void 0 : f.play();
1303
1371
  },
1304
1372
  pause: () => {
1305
- var u;
1306
- return (u = b.current) == null ? void 0 : u.pause();
1373
+ var f;
1374
+ return (f = o.current) == null ? void 0 : f.pause();
1307
1375
  },
1308
1376
  isPlaying: () => {
1309
- var u;
1310
- return ((u = b.current) == null ? void 0 : u.isPlaying()) ?? !1;
1377
+ var f;
1378
+ return ((f = o.current) == null ? void 0 : f.isPlaying()) ?? !1;
1311
1379
  }
1312
1380
  }));
1313
- const A = Y(a);
1314
- if (!A.valid) {
1315
- const u = A.errors.filter((y) => y.severity === "error").map((y) => ({ path: y.path, message: y.message }));
1316
- s == null || s(u);
1317
- const o = /* @__PURE__ */ new Map();
1318
- for (const y of u) {
1319
- const w = y.path.split("."), S = w.length > 1 ? w.slice(0, -1).join(".") : y.path, C = o.get(S) ?? [];
1320
- C.push(y), o.set(S, C);
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);
1321
1389
  }
1322
- return /* @__PURE__ */ F(
1390
+ return /* @__PURE__ */ R(
1323
1391
  "div",
1324
1392
  {
1325
1393
  className: t,
1326
1394
  style: { color: "#ff6b6b", fontFamily: "monospace", padding: 16, fontSize: 13, ...r },
1327
1395
  "data-testid": "dsl-error",
1328
1396
  children: [
1329
- /* @__PURE__ */ F("strong", { children: [
1397
+ /* @__PURE__ */ R("strong", { children: [
1330
1398
  "Elucim DSL Validation Errors (",
1331
- u.length,
1399
+ f.length,
1332
1400
  "):"
1333
1401
  ] }),
1334
- [...o.entries()].map(([y, w]) => /* @__PURE__ */ F("details", { open: !0, style: { marginTop: 8 }, children: [
1335
- /* @__PURE__ */ F("summary", { style: { cursor: "pointer", fontWeight: "bold" }, children: [
1336
- y,
1402
+ [...C.entries()].map(([I, T]) => /* @__PURE__ */ R("details", { open: !0, style: { marginTop: 8 }, children: [
1403
+ /* @__PURE__ */ R("summary", { style: { cursor: "pointer", fontWeight: "bold" }, children: [
1404
+ I,
1337
1405
  " (",
1338
- w.length,
1406
+ T.length,
1339
1407
  ")"
1340
1408
  ] }),
1341
- /* @__PURE__ */ c("ul", { style: { margin: "4px 0", paddingLeft: 20 }, children: w.map((S, C) => /* @__PURE__ */ F("li", { children: [
1342
- /* @__PURE__ */ c("code", { style: { color: "#ffa07a" }, children: S.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 }),
1343
1411
  ": ",
1344
- S.message
1345
- ] }, C)) })
1346
- ] }, y)),
1347
- /* @__PURE__ */ F("details", { style: { marginTop: 12 }, children: [
1348
- /* @__PURE__ */ c("summary", { style: { cursor: "pointer", opacity: 0.7 }, children: "Raw JSON" }),
1349
- /* @__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) })
1412
+ N.message
1413
+ ] }, D)) })
1414
+ ] }, I)),
1415
+ /* @__PURE__ */ R("details", { style: { marginTop: 12 }, children: [
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) })
1350
1418
  ] })
1351
1419
  ]
1352
1420
  }
1353
1421
  );
1354
1422
  }
1355
- const E = Vt(i), x = n !== void 0 ? Lt(n, a) : void 0;
1356
- return /* @__PURE__ */ c("div", { className: t, style: { ...E, ...r }, "data-testid": "dsl-root", children: re(a.root, {
1357
- frame: x == null ? void 0 : x.frame,
1358
- playerRef: b
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
1359
1431
  }) });
1360
1432
  });
1361
- function Lt(e, a) {
1433
+ function ta(e, a) {
1362
1434
  if (e === "first") return { frame: 0 };
1363
1435
  if (e === "last") {
1364
1436
  const r = a.root.durationInFrames ?? 1;
@@ -1366,22 +1438,58 @@ function Lt(e, a) {
1366
1438
  }
1367
1439
  return { frame: e };
1368
1440
  }
1369
- function Jt(e, a, t) {
1370
- const r = Y(e);
1441
+ function aa(e, a, t) {
1442
+ const r = ae(e);
1371
1443
  if (!r.valid) {
1372
- const s = r.errors.filter((l) => l.severity === "error");
1444
+ const s = r.errors.filter((c) => c.severity === "error");
1373
1445
  throw new Error(
1374
1446
  `DSL validation failed:
1375
- ${s.map((l) => ` ${l.path}: ${l.message}`).join(`
1447
+ ${s.map((c) => ` ${c.path}: ${c.message}`).join(`
1376
1448
  `)}`
1377
1449
  );
1378
1450
  }
1379
1451
  const i = { ...e.root };
1380
1452
  t != null && t.width && (i.width = t.width), t != null && t.height && (i.height = t.height);
1381
- const n = re(i, { frame: a });
1382
- return nt(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
+ });
1383
1491
  }
1384
- class jt {
1492
+ class na {
1385
1493
  constructor(a, t = 30, r = 900, i = 640) {
1386
1494
  this.elements = [], this.cursor = 0, this.theme = a, this._fps = t, this._width = r, this._height = i;
1387
1495
  }
@@ -1484,7 +1592,7 @@ class jt {
1484
1592
  }
1485
1593
  /** Add an arrow */
1486
1594
  arrow(a, t, r, i, n) {
1487
- const s = (n == null ? void 0 : n.fadeIn) ?? 12, l = {
1595
+ const s = (n == null ? void 0 : n.fadeIn) ?? 12, c = {
1488
1596
  type: "arrow",
1489
1597
  x1: a,
1490
1598
  y1: t,
@@ -1496,7 +1604,7 @@ class jt {
1496
1604
  strokeDasharray: n != null && n.dashed ? "6 3" : void 0,
1497
1605
  fadeIn: s
1498
1606
  };
1499
- return this.addAtCursor(l, (n == null ? void 0 : n.advance) ?? 3);
1607
+ return this.addAtCursor(c, (n == null ? void 0 : n.advance) ?? 3);
1500
1608
  }
1501
1609
  /** Add a line */
1502
1610
  line(a, t, r, i, n) {
@@ -1600,33 +1708,33 @@ class jt {
1600
1708
  * Returns the box positions for follow-up arrows, etc.
1601
1709
  */
1602
1710
  boxRow(a, t) {
1603
- 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, b = (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;
1604
1712
  t == null || t.fadeIn;
1605
- const A = a.map((x, u) => {
1606
- const o = b + u * (r + n);
1607
- return { x: o, y: s, w: r, h: i, cx: o + r / 2, cy: s + i / 2 };
1608
- }), E = a.map((x, u) => {
1609
- var S, C;
1610
- const o = A[u], y = ((S = t == null ? void 0 : t.colors) == null ? void 0 : S[u]) ?? this.theme.boxFill, w = ((C = t == null ? void 0 : t.strokeColors) == null ? void 0 : C[u]) ?? 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;
1611
1719
  return {
1612
1720
  type: "group",
1613
1721
  children: [
1614
1722
  {
1615
1723
  type: "rect",
1616
- x: o.x,
1617
- y: o.y,
1724
+ x: d.x,
1725
+ y: d.y,
1618
1726
  width: r,
1619
1727
  height: i,
1620
- fill: y,
1621
- stroke: w,
1728
+ fill: $,
1729
+ stroke: O,
1622
1730
  strokeWidth: 1.5,
1623
1731
  rx: 6
1624
1732
  },
1625
1733
  {
1626
1734
  type: "text",
1627
- x: o.cx,
1628
- y: o.cy + 5,
1629
- content: x,
1735
+ x: d.cx,
1736
+ y: d.cy + 5,
1737
+ content: y,
1630
1738
  fontSize: (t == null ? void 0 : t.fontSize) ?? 13,
1631
1739
  fill: (t == null ? void 0 : t.textColor) ?? this.theme.text,
1632
1740
  textAnchor: "middle",
@@ -1638,40 +1746,40 @@ class jt {
1638
1746
  return this.addAtCursor({
1639
1747
  type: "stagger",
1640
1748
  staggerDelay: 3,
1641
- children: E
1642
- }, 8 + a.length * 2), A;
1749
+ children: k
1750
+ }, 8 + a.length * 2), o;
1643
1751
  }
1644
1752
  /**
1645
1753
  * Render a vertical stack of labeled boxes.
1646
1754
  */
1647
1755
  boxColumn(a, t) {
1648
- 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;
1649
1757
  t == null || t.fadeIn;
1650
- const b = a.map((E, x) => {
1651
- const u = s + x * (i + n);
1652
- return { x: l - r / 2, y: u, w: r, h: i, cx: l, cy: u + i / 2 };
1653
- }), A = a.map((E, x) => {
1654
- var y, w;
1655
- const u = b[x], o = ((y = t == null ? void 0 : t.colors) == null ? void 0 : y[x]) ?? 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;
1656
1764
  return {
1657
1765
  type: "group",
1658
1766
  children: [
1659
1767
  {
1660
1768
  type: "rect",
1661
- x: u.x,
1662
- y: u.y,
1769
+ x: m.x,
1770
+ y: m.y,
1663
1771
  width: r,
1664
1772
  height: i,
1665
- fill: o,
1666
- stroke: (w = t == null ? void 0 : t.colors) != null && w[x] ? t.colors[x] : this.theme.boxStroke,
1773
+ fill: d,
1774
+ stroke: (O = t == null ? void 0 : t.colors) != null && O[y] ? t.colors[y] : this.theme.boxStroke,
1667
1775
  strokeWidth: 1.5,
1668
1776
  rx: 6
1669
1777
  },
1670
1778
  {
1671
1779
  type: "text",
1672
- x: u.cx,
1673
- y: u.cy + 5,
1674
- content: E,
1780
+ x: m.cx,
1781
+ y: m.cy + 5,
1782
+ content: k,
1675
1783
  fontSize: (t == null ? void 0 : t.fontSize) ?? 13,
1676
1784
  fill: (t == null ? void 0 : t.textColor) ?? this.theme.text,
1677
1785
  textAnchor: "middle"
@@ -1682,8 +1790,8 @@ class jt {
1682
1790
  return this.addAtCursor({
1683
1791
  type: "stagger",
1684
1792
  staggerDelay: 3,
1685
- children: A
1686
- }, 8 + a.length * 2), b;
1793
+ children: o
1794
+ }, 8 + a.length * 2), x;
1687
1795
  }
1688
1796
  /**
1689
1797
  * Draw arrows connecting sequential positions (e.g., output of boxRow/boxColumn).
@@ -1766,40 +1874,9 @@ class jt {
1766
1874
  return { elements: this.elements, durationInFrames: a };
1767
1875
  }
1768
1876
  }
1769
- const qt = {
1770
- background: "#0a0a1e",
1771
- title: "#e0e7ff",
1772
- subtitle: "#94a3b8",
1773
- primary: "#4fc3f7",
1774
- secondary: "#a78bfa",
1775
- tertiary: "#f472b6",
1776
- muted: "#64748b",
1777
- text: "#c8d6e5",
1778
- boxFill: "rgba(79,195,247,0.12)",
1779
- boxStroke: "#4fc3f7",
1780
- success: "#34d399",
1781
- warning: "#fbbf24",
1782
- error: "#f87171",
1783
- palette: ["#4fc3f7", "#a78bfa", "#f472b6", "#34d399", "#fbbf24", "#fb923c", "#6366f1", "#22d3ee"]
1784
- }, Yt = {
1785
- background: "#f8fafc",
1786
- title: "#1e293b",
1787
- subtitle: "#64748b",
1788
- primary: "#2563eb",
1789
- secondary: "#7c3aed",
1790
- tertiary: "#db2777",
1791
- muted: "#94a3b8",
1792
- text: "#334155",
1793
- boxFill: "rgba(37,99,235,0.08)",
1794
- boxStroke: "#2563eb",
1795
- success: "#16a34a",
1796
- warning: "#d97706",
1797
- error: "#dc2626",
1798
- palette: ["#2563eb", "#7c3aed", "#db2777", "#16a34a", "#d97706", "#ea580c", "#4f46e5", "#0891b2"]
1799
- };
1800
- class Bt {
1877
+ class sa {
1801
1878
  constructor(a, t, r) {
1802
- this._slides = [], this._title = a, this._theme = t ?? qt, this._opts = {
1879
+ this._slides = [], this._title = a, this._theme = t ?? ue, this._opts = {
1803
1880
  width: 900,
1804
1881
  height: 640,
1805
1882
  fps: 30,
@@ -1817,7 +1894,7 @@ class Bt {
1817
1894
  /** Build the final ElucimDocument */
1818
1895
  build() {
1819
1896
  const a = this._slides.map((r) => {
1820
- const i = new jt(
1897
+ const i = new na(
1821
1898
  this._theme,
1822
1899
  this._opts.fps,
1823
1900
  this._opts.width,
@@ -1863,29 +1940,30 @@ class Bt {
1863
1940
  return JSON.stringify(this.build(), null, a ? 2 : void 0);
1864
1941
  }
1865
1942
  }
1866
- function Zt(e, a, t) {
1867
- return new Bt(e, a, t);
1943
+ function ma(e, a, t) {
1944
+ return new sa(e, a, t);
1868
1945
  }
1869
1946
  export {
1870
- Xt as DslRenderer,
1871
- Bt as PresentationBuilder,
1872
- ae as SEMANTIC_TOKENS,
1873
- jt as SlideBuilder,
1874
- Qt as TOKEN_NAMES,
1875
- st as compileExpression,
1876
- ct as compileVectorExpression,
1877
- qt as darkTheme,
1878
- Yt as lightTheme,
1879
- Zt as presentation,
1947
+ ga as DslRenderer,
1948
+ sa as PresentationBuilder,
1949
+ se as SEMANTIC_TOKENS,
1950
+ na as SlideBuilder,
1951
+ fa as TOKEN_NAMES,
1952
+ ot as compileExpression,
1953
+ mt as compileVectorExpression,
1954
+ ue as darkTheme,
1955
+ Ht as lightTheme,
1956
+ ma as presentation,
1880
1957
  v as renderElement,
1881
- ie as renderPlayer,
1882
- _t as renderPresentation,
1883
- re as renderRoot,
1884
- q as renderScene,
1885
- Dt as renderSlide,
1886
- Jt as renderToSvgString,
1887
- h as resolveColor,
1958
+ le as renderPlayer,
1959
+ Ut as renderPresentation,
1960
+ ce as renderRoot,
1961
+ H as renderScene,
1962
+ Gt as renderSlide,
1963
+ oa as renderToPng,
1964
+ aa as renderToSvgString,
1965
+ u as resolveColor,
1888
1966
  g as resolveEasing,
1889
- Y as validate,
1890
- J as validateExpression
1967
+ ae as validate,
1968
+ te as validateExpression
1891
1969
  };